@reactunity/renderer 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/editor/index.js +17 -1
  2. package/dist/editor/jsx-dev-runtime.js +17 -1
  3. package/dist/editor/jsx-runtime.js +17 -1
  4. package/dist/index.js +31 -9
  5. package/dist/src/helpers/dictionary-watcher.js +18 -14
  6. package/dist/src/helpers/hooks/use-globals.js +9 -6
  7. package/dist/src/helpers/hooks/use-reactive-value.js +9 -5
  8. package/dist/src/helpers/icons.js +5 -2
  9. package/dist/src/models/base.js +2 -1
  10. package/dist/src/models/editor/components.js +2 -1
  11. package/dist/src/models/editor/environment.js +2 -1
  12. package/dist/src/models/editor/index.js +19 -3
  13. package/dist/src/models/editor/jsx.js +2 -1
  14. package/dist/src/models/environment/dom/common.js +2 -1
  15. package/dist/src/models/environment/dom/fetch.js +2 -1
  16. package/dist/src/models/environment/dom/global.js +2 -1
  17. package/dist/src/models/environment/dom/xhr.js +2 -1
  18. package/dist/src/models/environment/index.js +18 -2
  19. package/dist/src/models/environment/interop.js +2 -1
  20. package/dist/src/models/generated/editor.js +2 -1
  21. package/dist/src/models/generated/index.js +22 -6
  22. package/dist/src/models/generated/react.js +2 -1
  23. package/dist/src/models/generated/system.js +2 -1
  24. package/dist/src/models/generated/tests.js +2 -1
  25. package/dist/src/models/generated/unity.js +2 -1
  26. package/dist/src/models/generated/yoga.js +2 -1
  27. package/dist/src/models/properties/colors.js +2 -1
  28. package/dist/src/models/properties/common.js +2 -1
  29. package/dist/src/models/properties/index.js +23 -7
  30. package/dist/src/models/properties/style.js +2 -1
  31. package/dist/src/models/properties/styles-enums.js +2 -1
  32. package/dist/src/models/properties/styles.js +2 -1
  33. package/dist/src/models/properties/values.js +2 -1
  34. package/dist/src/models/properties/yoga-enums.js +2 -1
  35. package/dist/src/models/properties/yoga.js +2 -1
  36. package/dist/src/models/renderer.js +2 -1
  37. package/dist/src/models/richtext.js +2 -1
  38. package/dist/src/models/svg.js +2 -1
  39. package/dist/src/models/tests/index.js +2 -1
  40. package/dist/src/models/ugui/components.js +2 -1
  41. package/dist/src/models/ugui/events.js +2 -1
  42. package/dist/src/models/ugui/index.js +20 -4
  43. package/dist/src/models/ugui/input.js +2 -1
  44. package/dist/src/models/ugui/jsx.js +2 -1
  45. package/dist/src/models/uitoolkit/components.js +2 -1
  46. package/dist/src/models/uitoolkit/events.js +2 -1
  47. package/dist/src/models/uitoolkit/index.js +19 -3
  48. package/dist/src/models/uitoolkit/jsx.js +2 -1
  49. package/dist/src/renderer/async/callbacks.js +6 -3
  50. package/dist/src/renderer/async/commands.js +2 -1
  51. package/dist/src/renderer/async/objects.js +4 -1
  52. package/dist/src/renderer/async/reconciler.js +21 -18
  53. package/dist/src/renderer/async/serializer.js +11 -7
  54. package/dist/src/renderer/async/types.js +2 -1
  55. package/dist/src/renderer/constants.js +21 -16
  56. package/dist/src/renderer/diffing.js +8 -4
  57. package/dist/src/renderer/renderer.js +25 -21
  58. package/dist/src/renderer/subcontexts/index.js +8 -5
  59. package/dist/src/renderer/subcontexts/richtext.js +7 -2
  60. package/dist/src/renderer/subcontexts/svg.js +7 -2
  61. package/dist/src/renderer/sync/reconciler.js +14 -11
  62. package/dist/src/version.d.ts +1 -1
  63. package/dist/src/version.js +4 -1
  64. package/dist/src/views/default-view.js +9 -5
  65. package/dist/src/views/error-boundary.js +7 -4
  66. package/dist/src/webgl-compat/error-messages.js +4 -1
  67. package/dist/src/webgl-compat/index.js +11 -6
  68. package/dist/src/webgl-compat/types.js +2 -1
  69. package/dist/src/webgl-compat/use-event-system.js +13 -8
  70. package/dist/src/webgl-compat/use-unity-context.js +17 -13
  71. package/dist/tests.js +17 -1
  72. package/dist/ugui/index.js +17 -1
  73. package/dist/ugui/jsx-dev-runtime.js +17 -1
  74. package/dist/ugui/jsx-runtime.js +17 -1
  75. package/dist/uitoolkit/index.js +17 -1
  76. package/dist/uitoolkit/jsx-dev-runtime.js +17 -1
  77. package/dist/uitoolkit/jsx-runtime.js +17 -1
  78. package/dist/webgl-compat.js +17 -1
  79. package/package.json +8 -5
  80. package/editor/jsx-dev-runtime.ts +0 -4
  81. package/editor/jsx-runtime.ts +0 -4
  82. package/tests.ts +0 -1
  83. package/ugui/jsx-dev-runtime.ts +0 -4
  84. package/ugui/jsx-runtime.ts +0 -4
  85. package/uitoolkit/jsx-dev-runtime.ts +0 -4
  86. package/uitoolkit/jsx-runtime.ts +0 -4
  87. package/version.js +0 -3
  88. package/webgl-compat.ts +0 -1
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __extends = (this && this.__extends) || (function () {
2
3
  var extendStatics = function (d, b) {
3
4
  extendStatics = Object.setPrototypeOf ||
@@ -13,7 +14,9 @@ var __extends = (this && this.__extends) || (function () {
13
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
15
  };
15
16
  })();
16
- import { ObjectsRepo } from './objects';
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CallbacksRepo = void 0;
19
+ var objects_1 = require("./objects");
17
20
  var CallbacksRepo = /** @class */ (function (_super) {
18
21
  __extends(CallbacksRepo, _super);
19
22
  function CallbacksRepo() {
@@ -48,5 +51,5 @@ var CallbacksRepo = /** @class */ (function (_super) {
48
51
  return _this;
49
52
  }
50
53
  return CallbacksRepo;
51
- }(ObjectsRepo));
52
- export { CallbacksRepo };
54
+ }(objects_1.ObjectsRepo));
55
+ exports.CallbacksRepo = CallbacksRepo;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectsRepo = void 0;
1
4
  var ObjectsRepo = /** @class */ (function () {
2
5
  function ObjectsRepo() {
3
6
  var _this = this;
@@ -28,4 +31,4 @@ var ObjectsRepo = /** @class */ (function () {
28
31
  }
29
32
  return ObjectsRepo;
30
33
  }());
31
- export { ObjectsRepo };
34
+ exports.ObjectsRepo = ObjectsRepo;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,15 +10,17 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import * as Reconciler from 'react-reconciler';
13
- import { commonReconciler, getAllowedProps, stringizePoolKey, textTypes } from '../constants';
14
- import { diffProperties } from '../diffing';
15
- import { subContextRenderers } from '../subcontexts';
16
- import { callbacksRepo, convertPropsToSerializable, objectsRepo } from './serializer';
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.asyncReconciler = void 0;
15
+ var Reconciler = require("react-reconciler");
16
+ var constants_1 = require("../constants");
17
+ var diffing_1 = require("../diffing");
18
+ var subcontexts_1 = require("../subcontexts");
19
+ var serializer_1 = require("./serializer");
17
20
  var refId = 0;
18
21
  var ctxMap = new Map();
19
22
  var updateSubContext = function (instance) {
20
- var rend = subContextRenderers[instance.type];
23
+ var rend = subcontexts_1.subContextRenderers[instance.type];
21
24
  var root = instance === null || instance === void 0 ? void 0 : instance.root;
22
25
  var cur = instance;
23
26
  while (cur && !root) {
@@ -33,10 +36,10 @@ var updateSubContext = function (instance) {
33
36
  }
34
37
  else if (instance.type === 'svg') {
35
38
  // instance.hostContext.commands.push(['u', { r: root.refId, t: 'svg', ...convertPropsToSerializable({ innerContent: content }) }]);
36
- instance.hostContext.commands.push([5, root.refId, 'svg', convertPropsToSerializable({ innerContent: content })]);
39
+ instance.hostContext.commands.push([5, root.refId, 'svg', (0, serializer_1.convertPropsToSerializable)({ innerContent: content })]);
37
40
  }
38
41
  };
39
- var hostConfig = __assign(__assign({}, commonReconciler), { getRootHostContext: function (rootContainer) {
42
+ var hostConfig = __assign(__assign({}, constants_1.commonReconciler), { getRootHostContext: function (rootContainer) {
40
43
  var context = rootContainer.context;
41
44
  if (rootContainer.refId < 0) {
42
45
  refId++;
@@ -53,13 +56,13 @@ var hostConfig = __assign(__assign({}, commonReconciler), { getRootHostContext:
53
56
  return serialized;
54
57
  };
55
58
  var fireEventByRef = function (ind, args) {
56
- return callbacksRepo.call(ind, args);
59
+ return serializer_1.callbacksRepo.call(ind, args);
57
60
  };
58
61
  var getObjectRef = function (ind) {
59
- return objectsRepo.getObject(ind);
62
+ return serializer_1.objectsRepo.getObject(ind);
60
63
  };
61
64
  var getEventAsObjectRef = function (ind) {
62
- return callbacksRepo.getObject(ind);
65
+ return serializer_1.callbacksRepo.getObject(ind);
63
66
  };
64
67
  context.BindCommands(flushCommands, fireEventByRef, getObjectRef, getEventAsObjectRef);
65
68
  var ctx = {
@@ -95,11 +98,11 @@ var hostConfig = __assign(__assign({}, commonReconciler), { getRootHostContext:
95
98
  }, supportsMutation: true, supportsHydration: false, supportsPersistence: false, supportsMicrotasks: true, supportsTestSelectors: false, isPrimaryRenderer: true, warnsIfNotActing: true, prepareForCommit: function () { return null; }, resetAfterCommit: function () { }, shouldDeprioritizeSubtree: function () { return false; }, clearContainer: function (container) {
96
99
  UnityBridge.clearContainer(container);
97
100
  }, createInstance: function (type, props, rootContainer, ctx, internalHandle) {
98
- var aProps = getAllowedProps(props, type);
101
+ var aProps = (0, constants_1.getAllowedProps)(props, type);
99
102
  if (ctx.type === 'native') {
100
103
  refId++;
101
104
  // ctx.commands.push(['c', { t: type, r: refId, k: stringizePoolKey(props.pool), ...convertPropsToSerializable(aProps) }]);
102
- ctx.commands.push([0, refId, type, convertPropsToSerializable(aProps), stringizePoolKey(props.pool)]);
105
+ ctx.commands.push([0, refId, type, (0, serializer_1.convertPropsToSerializable)(aProps), (0, constants_1.stringizePoolKey)(props.pool)]);
103
106
  if (rootContainer.fiberCache)
104
107
  rootContainer.fiberCache.setObject(refId, internalHandle);
105
108
  var res = __assign(__assign({}, ctx), { refId: refId });
@@ -167,17 +170,17 @@ var hostConfig = __assign(__assign({}, commonReconciler), { getRootHostContext:
167
170
  child.parent = parent;
168
171
  updateSubContext(child);
169
172
  }
170
- }, finalizeInitialChildren: function () { return false; }, commitMount: function (instance) { }, shouldSetTextContent: function (type) { return textTypes[type]; },
173
+ }, finalizeInitialChildren: function () { return false; }, commitMount: function (instance) { }, shouldSetTextContent: function (type) { return constants_1.textTypes[type]; },
171
174
  // -------------------
172
175
  // Mutation
173
176
  // -------------------
174
177
  prepareUpdate: function (instance, type, oldProps, newProps) {
175
- return diffProperties(oldProps, newProps);
178
+ return (0, diffing_1.diffProperties)(oldProps, newProps);
176
179
  }, commitUpdate: function (instance, updatePayload, type) {
177
- var props = getAllowedProps(updatePayload, type);
180
+ var props = (0, constants_1.getAllowedProps)(updatePayload, type);
178
181
  if (instance.type === 'native') {
179
182
  // instance.commands.push(['u', { r: instance.refId, t: type, ...convertPropsToSerializable(props) }]);
180
- instance.commands.push([5, instance.refId, type, convertPropsToSerializable(props)]);
183
+ instance.commands.push([5, instance.refId, type, (0, serializer_1.convertPropsToSerializable)(props)]);
181
184
  }
182
185
  else if (instance.type === 'richtext' || instance.type === 'svg') {
183
186
  if ('attributes' in instance.node)
@@ -301,4 +304,4 @@ var hostConfig = __assign(__assign({}, commonReconciler), { getRootHostContext:
301
304
  updateSubContext(instance);
302
305
  }
303
306
  } });
304
- export var asyncReconciler = Reconciler(hostConfig);
307
+ exports.asyncReconciler = Reconciler(hostConfig);
@@ -1,9 +1,12 @@
1
- import { CallbacksRepo } from './callbacks';
2
- import { ObjectsRepo } from './objects';
3
- export var callbacksRepo = new CallbacksRepo();
4
- export var objectsRepo = new ObjectsRepo();
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertPropsToSerializable = exports.objectsRepo = exports.callbacksRepo = void 0;
4
+ var callbacks_1 = require("./callbacks");
5
+ var objects_1 = require("./objects");
6
+ exports.callbacksRepo = new callbacks_1.CallbacksRepo();
7
+ exports.objectsRepo = new objects_1.ObjectsRepo();
5
8
  // Separates properties in 3 categories: regular props, callbacks and non-serializable objects
6
- export function convertPropsToSerializable(props) {
9
+ function convertPropsToSerializable(props) {
7
10
  var res = {};
8
11
  for (var key in props) {
9
12
  if (Object.prototype.hasOwnProperty.call(props, key)) {
@@ -15,11 +18,11 @@ export function convertPropsToSerializable(props) {
15
18
  (res.p || (res.p = {}))[key] = convertPropsToSerializable(value);
16
19
  }
17
20
  else if (key[0] === 'o' && key[1] === 'n' && typeof value === 'function') {
18
- var ind = callbacksRepo.addObject(value);
21
+ var ind = exports.callbacksRepo.addObject(value);
19
22
  (res.e || (res.e = {}))[key] = ind;
20
23
  }
21
24
  else if (typeof value === 'object' || typeof value === 'function') {
22
- var ind = objectsRepo.addObject(value);
25
+ var ind = exports.objectsRepo.addObject(value);
23
26
  (res.o || (res.o = {}))[key] = ind;
24
27
  }
25
28
  else {
@@ -29,3 +32,4 @@ export function convertPropsToSerializable(props) {
29
32
  }
30
33
  return res;
31
34
  }
35
+ exports.convertPropsToSerializable = convertPropsToSerializable;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,22 +10,24 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { ContinuousEventPriority, DefaultEventPriority, DiscreteEventPriority, IdleEventPriority } from 'react-reconciler/constants';
13
- import { styleStringSymbol } from './diffing';
14
- export var hideClass = 'react-unity__renderer__hidden';
15
- export var eventPriorities = {
16
- discrete: DiscreteEventPriority,
17
- continuous: ContinuousEventPriority,
18
- default: DefaultEventPriority,
19
- idle: IdleEventPriority,
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.isDevelopment = exports.commonReconciler = exports.getAllowedProps = exports.stringizePoolKey = exports.textTypes = exports.eventPriorities = exports.hideClass = void 0;
15
+ var constants_1 = require("react-reconciler/constants");
16
+ var diffing_1 = require("./diffing");
17
+ exports.hideClass = 'react-unity__renderer__hidden';
18
+ exports.eventPriorities = {
19
+ discrete: constants_1.DiscreteEventPriority,
20
+ continuous: constants_1.ContinuousEventPriority,
21
+ default: constants_1.DefaultEventPriority,
22
+ idle: constants_1.IdleEventPriority,
20
23
  };
21
- export var textTypes = {
24
+ exports.textTypes = {
22
25
  text: true,
23
26
  icon: true,
24
27
  style: true,
25
28
  script: true,
26
29
  };
27
- export function stringizePoolKey(key) {
30
+ function stringizePoolKey(key) {
28
31
  switch (typeof key) {
29
32
  case 'string': return key;
30
33
  case 'boolean': return key ? 'default' : '';
@@ -33,21 +36,23 @@ export function stringizePoolKey(key) {
33
36
  default: return '';
34
37
  }
35
38
  }
36
- export function getAllowedProps(props, type) {
39
+ exports.stringizePoolKey = stringizePoolKey;
40
+ function getAllowedProps(props, type) {
37
41
  var children = props.children, tag = props.tag, pool = props.pool, rest = __rest(props, ["children", "tag", "pool"]);
38
- if (textTypes[type] && 'children' in props) {
42
+ if (exports.textTypes[type] && 'children' in props) {
39
43
  rest.children = (!children || typeof children === 'boolean') ? null : Array.isArray(children) ? children.join('') : children + '';
40
44
  }
41
45
  if (typeof props.style === 'string')
42
- rest[styleStringSymbol] = props.style;
46
+ rest[diffing_1.styleStringSymbol] = props.style;
43
47
  return rest;
44
48
  }
45
- export var commonReconciler = {
49
+ exports.getAllowedProps = getAllowedProps;
50
+ exports.commonReconciler = {
46
51
  // -------------------
47
52
  // Scheduling
48
53
  // -------------------
49
54
  now: Date.now,
50
- getCurrentEventPriority: function () { return UnityBridge.CurrentEventPriority || eventPriorities.default; },
55
+ getCurrentEventPriority: function () { return UnityBridge.CurrentEventPriority || exports.eventPriorities.default; },
51
56
  noTimeout: -1,
52
57
  scheduleTimeout: function (callback, delay) { return setTimeout(callback, delay); },
53
58
  scheduleMicrotask: typeof queueMicrotask === 'function' ? queueMicrotask :
@@ -67,4 +72,4 @@ export var commonReconciler = {
67
72
  prepareScopeUpdate: function (scopeInstance, instance) {
68
73
  },
69
74
  };
70
- export var isDevelopment = process.env.NODE_ENV === 'development';
75
+ exports.isDevelopment = process.env.NODE_ENV === 'development';
@@ -1,10 +1,13 @@
1
- export var styleStringSymbol = '__style_as_string__';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.diffProperties = exports.styleStringSymbol = void 0;
4
+ exports.styleStringSymbol = '__style_as_string__';
2
5
  var propDepths = {
3
6
  style: 1,
4
7
  data: 1,
5
8
  custom: 1,
6
9
  };
7
- export function diffProperties(lastProps, nextProps, deepDiffing) {
10
+ function diffProperties(lastProps, nextProps, deepDiffing) {
8
11
  if (deepDiffing === void 0) { deepDiffing = 0; }
9
12
  if (lastProps === nextProps)
10
13
  return null;
@@ -20,7 +23,7 @@ export function diffProperties(lastProps, nextProps, deepDiffing) {
20
23
  var prop = null;
21
24
  // If style existed in the previous properties as string, set it to null
22
25
  if (propKey === 'style' && typeof lastProps.style === 'string') {
23
- (updatePayload = updatePayload || {})[styleStringSymbol] = null;
26
+ (updatePayload = updatePayload || {})[exports.styleStringSymbol] = null;
24
27
  }
25
28
  else {
26
29
  var depth = deepDiffing > 0 ? deepDiffing : (propDepths[propKey] || 0);
@@ -48,7 +51,7 @@ export function diffProperties(lastProps, nextProps, deepDiffing) {
48
51
  var prevWasString = (typeof lastProp === 'string');
49
52
  var curIsString = (typeof prop === 'string');
50
53
  if (prevWasString !== curIsString) {
51
- (updatePayload = updatePayload || {})[styleStringSymbol] = typeof prop === 'string' ? prop : null;
54
+ (updatePayload = updatePayload || {})[exports.styleStringSymbol] = typeof prop === 'string' ? prop : null;
52
55
  if (curIsString) {
53
56
  // Current style is string while previous is object, so revert all changes from the previous one
54
57
  prop = diffProperties(lastProp, {}, 0);
@@ -81,3 +84,4 @@ export function diffProperties(lastProps, nextProps, deepDiffing) {
81
84
  }
82
85
  return updatePayload;
83
86
  }
87
+ exports.diffProperties = diffProperties;
@@ -1,14 +1,17 @@
1
- import { createElement } from 'react';
2
- import { ConcurrentRoot, LegacyRoot } from 'react-reconciler/constants';
3
- import { version } from '../version';
4
- import { DefaultView } from '../views/default-view';
5
- import { ObjectsRepo } from './async/objects';
6
- import { asyncReconciler } from './async/reconciler';
7
- import { isDevelopment } from './constants';
8
- import { syncReconciler } from './sync/reconciler';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flushSync = exports.batchedUpdates = exports.Renderer = exports.render = void 0;
4
+ var react_1 = require("react");
5
+ var constants_1 = require("react-reconciler/constants");
6
+ var version_1 = require("../version");
7
+ var default_view_1 = require("../views/default-view");
8
+ var objects_1 = require("./async/objects");
9
+ var reconciler_1 = require("./async/reconciler");
10
+ var constants_2 = require("./constants");
11
+ var reconciler_2 = require("./sync/reconciler");
9
12
  var containerMap = new Map();
10
13
  var renderCount = 0;
11
- export function render(element, options) {
14
+ function render(element, options) {
12
15
  if (options === void 0) { options = {}; }
13
16
  renderCount++;
14
17
  var hostContainer = (options === null || options === void 0 ? void 0 : options.hostContainer) || HostContainer;
@@ -17,10 +20,10 @@ export function render(element, options) {
17
20
  var _a = containerMap.get(cacheKey) || {}, hostRoot = _a.hostRoot, asyncJobCallback = _a.asyncJobCallback;
18
21
  var findFiberByHostInstance = function () { return null; };
19
22
  if (!hostRoot) {
20
- var mode = (options === null || options === void 0 ? void 0 : options.mode) === 'legacy' ? LegacyRoot : ConcurrentRoot;
23
+ var mode = (options === null || options === void 0 ? void 0 : options.mode) === 'legacy' ? constants_1.LegacyRoot : constants_1.ConcurrentRoot;
21
24
  if (isAsync) {
22
- var fiberCache_1 = isDevelopment ? new ObjectsRepo() : null;
23
- if (isDevelopment) {
25
+ var fiberCache_1 = constants_2.isDevelopment ? new objects_1.ObjectsRepo() : null;
26
+ if (constants_2.isDevelopment) {
24
27
  findFiberByHostInstance = function (instance) { return !instance ? null : fiberCache_1.getObject(instance.refId); };
25
28
  }
26
29
  var scheduled_1 = false;
@@ -54,10 +57,10 @@ export function render(element, options) {
54
57
  commands_1.length = 0;
55
58
  hostContainerInstance_1.context.FlushCommands(serialized);
56
59
  };
57
- hostRoot = asyncReconciler.createContainer(hostContainerInstance_1, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
60
+ hostRoot = reconciler_1.asyncReconciler.createContainer(hostContainerInstance_1, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
58
61
  }
59
62
  else {
60
- hostRoot = syncReconciler.createContainer(hostContainer, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
63
+ hostRoot = reconciler_2.syncReconciler.createContainer(hostContainer, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
61
64
  }
62
65
  containerMap.set(cacheKey, { hostRoot: hostRoot, asyncJobCallback: asyncJobCallback });
63
66
  }
@@ -67,27 +70,28 @@ export function render(element, options) {
67
70
  withHelpers: !(options === null || options === void 0 ? void 0 : options.disableHelpers),
68
71
  renderCount: renderCount,
69
72
  };
70
- element = createElement(DefaultView, viewWrapperProps, element);
73
+ element = (0, react_1.createElement)(default_view_1.DefaultView, viewWrapperProps, element);
71
74
  }
72
- var rc = isAsync ? asyncReconciler : syncReconciler;
75
+ var rc = isAsync ? reconciler_1.asyncReconciler : reconciler_2.syncReconciler;
73
76
  rc.updateContainer(element, hostRoot, null);
74
77
  rc.injectIntoDevTools({
75
- bundleType: isDevelopment ? 1 : 0,
76
- version: version,
78
+ bundleType: constants_2.isDevelopment ? 1 : 0,
79
+ version: version_1.version,
77
80
  rendererPackageName: '@reactunity/renderer',
78
81
  rendererConfig: { isAsync: isAsync },
79
82
  findFiberByHostInstance: findFiberByHostInstance,
80
83
  });
81
84
  return rc;
82
85
  }
86
+ exports.render = render;
83
87
  /**
84
88
  * @deprecated Instead, import `render` directly from `@reactunity/renderer`
85
89
  */
86
- export var Renderer = {
90
+ exports.Renderer = {
87
91
  render: function (element, options) {
88
92
  if (options === void 0) { options = {}; }
89
93
  return render(element, options);
90
94
  },
91
95
  };
92
- export var batchedUpdates = asyncReconciler.batchedUpdates;
93
- export var flushSync = asyncReconciler.flushSync;
96
+ exports.batchedUpdates = reconciler_1.asyncReconciler.batchedUpdates;
97
+ exports.flushSync = reconciler_1.asyncReconciler.flushSync;
@@ -1,6 +1,9 @@
1
- import { stringifyRichText } from './richtext';
2
- import { stringifySVG } from './svg';
3
- export var subContextRenderers = {
4
- richtext: stringifyRichText,
5
- svg: stringifySVG,
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subContextRenderers = void 0;
4
+ var richtext_1 = require("./richtext");
5
+ var svg_1 = require("./svg");
6
+ exports.subContextRenderers = {
7
+ richtext: richtext_1.stringifyRichText,
8
+ svg: svg_1.stringifySVG,
6
9
  };
@@ -1,4 +1,7 @@
1
- export function parametrizeValue(value) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifyRichText = exports.parametrizeValue = void 0;
4
+ function parametrizeValue(value) {
2
5
  if (typeof value === 'number')
3
6
  return value + '';
4
7
  value = value + '';
@@ -6,7 +9,8 @@ export function parametrizeValue(value) {
6
9
  return '"' + value + '"';
7
10
  return value;
8
11
  }
9
- export function stringifyRichText(node) {
12
+ exports.parametrizeValue = parametrizeValue;
13
+ function stringifyRichText(node) {
10
14
  var _a, _b, _c;
11
15
  if (node.hidden)
12
16
  return '';
@@ -50,3 +54,4 @@ export function stringifyRichText(node) {
50
54
  }
51
55
  return acc.join('');
52
56
  }
57
+ exports.stringifyRichText = stringifyRichText;
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifySVG = exports.stringifyStyle = void 0;
1
4
  function kebabize(str) {
2
5
  return str.split('').map(function (letter, idx) {
3
6
  return letter.toUpperCase() === letter
@@ -6,7 +9,7 @@ function kebabize(str) {
6
9
  }).join('');
7
10
  }
8
11
  ;
9
- export function stringifyStyle(style) {
12
+ function stringifyStyle(style) {
10
13
  if (typeof style === 'string')
11
14
  return style;
12
15
  var acc = [];
@@ -23,7 +26,8 @@ export function stringifyStyle(style) {
23
26
  }
24
27
  return acc.join('');
25
28
  }
26
- export function stringifySVG(node) {
29
+ exports.stringifyStyle = stringifyStyle;
30
+ function stringifySVG(node) {
27
31
  var _a;
28
32
  if (node.hidden)
29
33
  return '';
@@ -68,3 +72,4 @@ export function stringifySVG(node) {
68
72
  }
69
73
  return acc.join('');
70
74
  }
75
+ exports.stringifySVG = stringifySVG;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -9,27 +10,29 @@ var __assign = (this && this.__assign) || function () {
9
10
  };
10
11
  return __assign.apply(this, arguments);
11
12
  };
12
- import * as Reconciler from 'react-reconciler';
13
- import { commonReconciler, getAllowedProps, hideClass, stringizePoolKey, textTypes } from '../constants';
14
- import { diffProperties } from '../diffing';
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.syncReconciler = void 0;
15
+ var Reconciler = require("react-reconciler");
16
+ var constants_1 = require("../constants");
17
+ var diffing_1 = require("../diffing");
15
18
  var hostContext = {};
16
19
  var childContext = {};
17
- var hostConfig = __assign(__assign({}, commonReconciler), { getRootHostContext: function () { return hostContext; }, getChildHostContext: function () { return childContext; }, getPublicInstance: function (instance) { return instance; }, supportsMutation: true, supportsHydration: false, supportsPersistence: false, supportsMicrotasks: true, supportsTestSelectors: false, isPrimaryRenderer: true, warnsIfNotActing: true, prepareForCommit: function () { return null; }, resetAfterCommit: function () { }, clearContainer: function (container) { return UnityBridge.clearContainer(container); }, shouldDeprioritizeSubtree: function () { return false; }, createInstance: function (type, props, rootContainerInstance) {
18
- var aProps = getAllowedProps(props, type);
20
+ var hostConfig = __assign(__assign({}, constants_1.commonReconciler), { getRootHostContext: function () { return hostContext; }, getChildHostContext: function () { return childContext; }, getPublicInstance: function (instance) { return instance; }, supportsMutation: true, supportsHydration: false, supportsPersistence: false, supportsMicrotasks: true, supportsTestSelectors: false, isPrimaryRenderer: true, warnsIfNotActing: true, prepareForCommit: function () { return null; }, resetAfterCommit: function () { }, clearContainer: function (container) { return UnityBridge.clearContainer(container); }, shouldDeprioritizeSubtree: function () { return false; }, createInstance: function (type, props, rootContainerInstance) {
21
+ var aProps = (0, constants_1.getAllowedProps)(props, type);
19
22
  var children = aProps.children || null;
20
23
  delete aProps.children;
21
- return UnityBridge.createElement(props.tag || type, children, rootContainerInstance, aProps, stringizePoolKey(props.pool));
24
+ return UnityBridge.createElement(props.tag || type, children, rootContainerInstance, aProps, (0, constants_1.stringizePoolKey)(props.pool));
22
25
  }, createTextInstance: function (text, rootContainerInstance) {
23
26
  return UnityBridge.createText(text, rootContainerInstance);
24
- }, appendInitialChild: function (parent, child) { UnityBridge.appendChild(parent, child); }, finalizeInitialChildren: function () { return false; }, commitMount: function () { }, shouldSetTextContent: function (type) { return textTypes[type]; },
27
+ }, appendInitialChild: function (parent, child) { UnityBridge.appendChild(parent, child); }, finalizeInitialChildren: function () { return false; }, commitMount: function () { }, shouldSetTextContent: function (type) { return constants_1.textTypes[type]; },
25
28
  // -------------------
26
29
  // Mutation
27
30
  // -------------------
28
31
  prepareUpdate: function (instance, type, oldProps, newProps) {
29
- return diffProperties(oldProps, newProps);
32
+ return (0, diffing_1.diffProperties)(oldProps, newProps);
30
33
  }, commitUpdate: function (instance, updatePayload, type) {
31
- UnityBridge.applyUpdate(instance, getAllowedProps(updatePayload, type), type);
34
+ UnityBridge.applyUpdate(instance, (0, constants_1.getAllowedProps)(updatePayload, type), type);
32
35
  }, commitTextUpdate: function (textInstance, oldText, newText) { UnityBridge.setText(textInstance, newText); }, appendChild: function (parent, child) { return UnityBridge.appendChild(parent, child); }, appendChildToContainer: function (parent, child) { return UnityBridge.appendChildToContainer(parent, child); }, insertBefore: function (parent, child, beforeChild) { return UnityBridge.insertBefore(parent, child, beforeChild); }, insertInContainerBefore: function (parent, child, beforeChild) { return UnityBridge.insertBefore(parent, child, beforeChild); }, removeChild: function (parent, child) { return UnityBridge.removeChild(parent, child); }, removeChildFromContainer: function (parent, child) { return UnityBridge.removeChild(parent, child); }, resetTextContent: function () { }, preparePortalMount: function () { }, detachDeletedInstance: function () { },
33
36
  // Required for Suspense
34
- hideInstance: function (instance) { instance.ClassList.Add(hideClass); }, hideTextInstance: function (instance) { instance.ClassList.Add(hideClass); }, unhideInstance: function (instance) { instance.ClassList.Remove(hideClass); }, unhideTextInstance: function (instance) { instance.ClassList.Remove(hideClass); } });
35
- export var syncReconciler = Reconciler(hostConfig);
37
+ hideInstance: function (instance) { instance.ClassList.Add(constants_1.hideClass); }, hideTextInstance: function (instance) { instance.ClassList.Add(constants_1.hideClass); }, unhideInstance: function (instance) { instance.ClassList.Remove(constants_1.hideClass); }, unhideTextInstance: function (instance) { instance.ClassList.Remove(constants_1.hideClass); } });
38
+ exports.syncReconciler = Reconciler(hostConfig);
@@ -1 +1 @@
1
- export declare const version = "0.16.0";
1
+ export declare const version = "0.16.1";
@@ -1 +1,4 @@
1
- export var version = '0.16.0';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.version = void 0;
4
+ exports.version = '0.16.1';
@@ -1,7 +1,11 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { ErrorBoundary } from './error-boundary';
3
- export function DefaultView(_a) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultView = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var error_boundary_1 = require("./error-boundary");
6
+ function DefaultView(_a) {
4
7
  var children = _a.children, withHelpers = _a.withHelpers, renderCount = _a.renderCount;
5
- return _jsx(_Fragment, { children: !withHelpers ? children :
6
- _jsx(ErrorBoundary, { children: children }, renderCount) });
8
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !withHelpers ? children :
9
+ (0, jsx_runtime_1.jsx)(error_boundary_1.ErrorBoundary, { children: children }, renderCount) });
7
10
  }
11
+ exports.DefaultView = DefaultView;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __extends = (this && this.__extends) || (function () {
2
3
  var extendStatics = function (d, b) {
3
4
  extendStatics = Object.setPrototypeOf ||
@@ -13,8 +14,10 @@ var __extends = (this && this.__extends) || (function () {
13
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
15
  };
15
16
  })();
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- import * as React from 'react';
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ErrorBoundary = void 0;
19
+ var jsx_runtime_1 = require("react/jsx-runtime");
20
+ var React = require("react");
18
21
  var ErrorBoundary = /** @class */ (function (_super) {
19
22
  __extends(ErrorBoundary, _super);
20
23
  function ErrorBoundary(props) {
@@ -33,10 +36,10 @@ var ErrorBoundary = /** @class */ (function (_super) {
33
36
  ErrorBoundary.prototype.render = function () {
34
37
  var _a, _b;
35
38
  if (this.state.hasError) {
36
- return _jsxs("view", { id: '__react-unity-error-boundary', style: { color: 'crimson', padding: 20, fontSize: 16 }, children: [_jsx("view", { style: { marginBottom: '12px' }, children: ((_a = this.state.error) === null || _a === void 0 ? void 0 : _a.message) || '' }), _jsx("view", { children: ((_b = this.state.error) === null || _b === void 0 ? void 0 : _b.stack) || '' })] });
39
+ return (0, jsx_runtime_1.jsxs)("view", { id: '__react-unity-error-boundary', style: { color: 'crimson', padding: 20, fontSize: 16 }, children: [(0, jsx_runtime_1.jsx)("view", { style: { marginBottom: '12px' }, children: ((_a = this.state.error) === null || _a === void 0 ? void 0 : _a.message) || '' }), (0, jsx_runtime_1.jsx)("view", { children: ((_b = this.state.error) === null || _b === void 0 ? void 0 : _b.stack) || '' })] });
37
40
  }
38
41
  return this.props.children;
39
42
  };
40
43
  return ErrorBoundary;
41
44
  }(React.Component));
42
- export { ErrorBoundary };
45
+ exports.ErrorBoundary = ErrorBoundary;
@@ -1,5 +1,8 @@
1
+ "use strict";
1
2
  // Original file: https://github.com/jeffreylanters/react-unity-webgl/blob/main/module/source/constants/error-messages.ts
2
- export var errorMessages = {
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.errorMessages = void 0;
5
+ exports.errorMessages = {
3
6
  genericNoUnityInstance: 'No Unity Instance found.',
4
7
  requestFullscreenNoUnityInstance: 'Unable to Set Fullscreen while Unity is not Instantiated.',
5
8
  requestPointerLockNoUnityInstanceOrCanvas: 'Unable to Request Pointer Lock while Unity is not Instantiated or the Canvas is not found.',
@@ -1,8 +1,13 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Unity = exports.useUnityContext = exports.UnityContext = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
2
5
  // <reference types="react-unity-webgl" />
3
- import { forwardRef, useImperativeHandle } from 'react';
4
- export { UnityContext, useUnityContext } from './use-unity-context';
5
- export var Unity = forwardRef(function Unity(props, ref) {
6
- useImperativeHandle(ref, function () { return ({}); });
7
- return _jsx(_Fragment, {});
6
+ var react_1 = require("react");
7
+ var use_unity_context_1 = require("./use-unity-context");
8
+ Object.defineProperty(exports, "UnityContext", { enumerable: true, get: function () { return use_unity_context_1.UnityContext; } });
9
+ Object.defineProperty(exports, "useUnityContext", { enumerable: true, get: function () { return use_unity_context_1.useUnityContext; } });
10
+ exports.Unity = (0, react_1.forwardRef)(function Unity(props, ref) {
11
+ (0, react_1.useImperativeHandle)(ref, function () { return ({}); });
12
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
8
13
  });
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });