@reactunity/renderer 0.15.2 → 0.16.0

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 (175) hide show
  1. package/dist/editor/index.d.ts +1 -0
  2. package/dist/editor/index.js +1 -0
  3. package/dist/editor/jsx-dev-runtime.d.ts +2 -0
  4. package/dist/editor/jsx-dev-runtime.js +1 -0
  5. package/dist/editor/jsx-runtime.d.ts +2 -0
  6. package/dist/editor/jsx-runtime.js +1 -0
  7. package/dist/index.d.ts +9 -9
  8. package/dist/index.js +9 -9
  9. package/dist/src/helpers/dictionary-watcher.d.ts +66 -66
  10. package/dist/src/helpers/dictionary-watcher.js +100 -98
  11. package/dist/src/helpers/hooks/use-globals.d.ts +6 -6
  12. package/dist/src/helpers/hooks/use-globals.js +6 -6
  13. package/dist/src/helpers/hooks/use-reactive-value.d.ts +4 -4
  14. package/dist/src/helpers/hooks/use-reactive-value.js +27 -27
  15. package/dist/src/helpers/icons.d.ts +11 -7
  16. package/dist/src/helpers/icons.js +29 -29
  17. package/dist/src/models/base.d.ts +56 -56
  18. package/dist/src/models/base.js +2 -2
  19. package/dist/src/models/editor/components.d.ts +22 -22
  20. package/dist/src/models/editor/components.js +1 -1
  21. package/dist/src/models/editor/environment.d.ts +9 -10
  22. package/dist/src/models/editor/environment.js +1 -1
  23. package/dist/src/models/editor/index.d.ts +3 -3
  24. package/dist/src/models/editor/index.js +3 -3
  25. package/dist/src/models/editor/jsx.d.ts +111 -104
  26. package/dist/src/models/editor/jsx.js +1 -1
  27. package/dist/src/models/environment/dom/common.d.ts +85 -85
  28. package/dist/src/models/environment/dom/common.js +1 -1
  29. package/dist/src/models/environment/dom/fetch.d.ts +111 -111
  30. package/dist/src/models/environment/dom/fetch.js +1 -1
  31. package/dist/src/models/environment/dom/global.d.ts +11 -11
  32. package/dist/src/models/environment/dom/global.js +1 -1
  33. package/dist/src/models/environment/dom/xhr.d.ts +161 -161
  34. package/dist/src/models/environment/dom/xhr.js +1 -1
  35. package/dist/src/models/environment/index.d.ts +43 -47
  36. package/dist/src/models/environment/index.js +2 -3
  37. package/dist/src/models/environment/interop.d.ts +23 -23
  38. package/dist/src/models/environment/interop.js +1 -1
  39. package/dist/src/models/generated/editor.d.ts +18501 -18501
  40. package/dist/src/models/generated/editor.js +6 -6
  41. package/dist/src/models/generated/index.d.ts +6 -6
  42. package/dist/src/models/generated/index.js +6 -6
  43. package/dist/src/models/generated/react.d.ts +15214 -15214
  44. package/dist/src/models/generated/react.js +6 -6
  45. package/dist/src/models/generated/system.d.ts +36731 -36731
  46. package/dist/src/models/generated/system.js +6 -6
  47. package/dist/src/models/generated/tests.d.ts +5023 -5023
  48. package/dist/src/models/generated/tests.js +6 -6
  49. package/dist/src/models/generated/unity.d.ts +43446 -43446
  50. package/dist/src/models/generated/unity.js +6 -6
  51. package/dist/src/models/generated/yoga.d.ts +368 -368
  52. package/dist/src/models/generated/yoga.js +6 -6
  53. package/dist/src/models/properties/colors.d.ts +150 -150
  54. package/dist/src/models/properties/colors.js +1 -1
  55. package/dist/src/models/properties/common.d.ts +2 -2
  56. package/dist/src/models/properties/common.js +1 -1
  57. package/dist/src/models/properties/index.d.ts +7 -7
  58. package/dist/src/models/properties/index.js +7 -7
  59. package/dist/src/models/properties/style.d.ts +10 -10
  60. package/dist/src/models/properties/style.js +1 -1
  61. package/dist/src/models/properties/styles-enums.d.ts +23 -23
  62. package/dist/src/models/properties/styles-enums.js +1 -1
  63. package/dist/src/models/properties/styles.d.ts +127 -127
  64. package/dist/src/models/properties/styles.js +1 -1
  65. package/dist/src/models/properties/values.d.ts +24 -24
  66. package/dist/src/models/properties/values.js +1 -1
  67. package/dist/src/models/properties/yoga-enums.d.ts +8 -8
  68. package/dist/src/models/properties/yoga-enums.js +1 -1
  69. package/dist/src/models/properties/yoga.d.ts +66 -66
  70. package/dist/src/models/properties/yoga.js +1 -1
  71. package/dist/src/models/renderer.d.ts +20 -20
  72. package/dist/src/models/renderer.js +1 -1
  73. package/dist/src/models/richtext.d.ts +69 -69
  74. package/dist/src/models/richtext.js +2 -2
  75. package/dist/src/models/svg.d.ts +68 -68
  76. package/dist/src/models/svg.js +1 -1
  77. package/dist/src/models/tests/index.d.ts +12 -12
  78. package/dist/src/models/tests/index.js +1 -1
  79. package/dist/src/models/ugui/components.d.ts +86 -86
  80. package/dist/src/models/ugui/components.js +1 -1
  81. package/dist/src/models/ugui/events.d.ts +74 -74
  82. package/dist/src/models/ugui/events.js +2 -2
  83. package/dist/src/models/ugui/index.d.ts +4 -4
  84. package/dist/src/models/ugui/index.js +4 -4
  85. package/dist/src/models/ugui/input.d.ts +26 -26
  86. package/dist/src/models/ugui/input.js +1 -1
  87. package/dist/src/models/ugui/jsx.d.ts +67 -60
  88. package/dist/src/models/ugui/jsx.js +1 -1
  89. package/dist/src/models/uitoolkit/components.d.ts +82 -82
  90. package/dist/src/models/uitoolkit/components.js +1 -1
  91. package/dist/src/models/uitoolkit/events.d.ts +64 -64
  92. package/dist/src/models/uitoolkit/events.js +1 -1
  93. package/dist/src/models/uitoolkit/index.d.ts +3 -3
  94. package/dist/src/models/uitoolkit/index.js +3 -3
  95. package/dist/src/models/uitoolkit/jsx.d.ts +71 -64
  96. package/dist/src/models/uitoolkit/jsx.js +1 -1
  97. package/dist/src/renderer/async/callbacks.d.ts +5 -6
  98. package/dist/src/renderer/async/callbacks.js +52 -52
  99. package/dist/src/renderer/async/commands.d.ts +98 -47
  100. package/dist/src/renderer/async/commands.js +1 -1
  101. package/dist/src/renderer/async/objects.d.ts +7 -8
  102. package/dist/src/renderer/async/objects.js +31 -31
  103. package/dist/src/renderer/async/reconciler.d.ts +2 -2
  104. package/dist/src/renderer/async/reconciler.js +304 -283
  105. package/dist/src/renderer/async/serializer.d.ts +6 -9
  106. package/dist/src/renderer/async/serializer.js +31 -31
  107. package/dist/src/renderer/async/types.d.ts +45 -45
  108. package/dist/src/renderer/async/types.js +1 -1
  109. package/dist/src/renderer/constants.d.ts +30 -30
  110. package/dist/src/renderer/constants.js +70 -70
  111. package/dist/src/renderer/diffing.d.ts +3 -3
  112. package/dist/src/renderer/diffing.js +83 -83
  113. package/dist/src/renderer/renderer.d.ts +26 -26
  114. package/dist/src/renderer/renderer.js +93 -93
  115. package/dist/src/renderer/subcontexts/index.d.ts +6 -6
  116. package/dist/src/renderer/subcontexts/index.js +6 -6
  117. package/dist/src/renderer/subcontexts/richtext.d.ts +3 -3
  118. package/dist/src/renderer/subcontexts/richtext.js +52 -52
  119. package/dist/src/renderer/subcontexts/svg.d.ts +3 -3
  120. package/dist/src/renderer/subcontexts/svg.js +70 -70
  121. package/dist/src/renderer/sync/reconciler.d.ts +2 -2
  122. package/dist/src/renderer/sync/reconciler.js +35 -35
  123. package/dist/src/version.d.ts +1 -1
  124. package/dist/src/version.js +1 -1
  125. package/dist/src/views/default-view.d.ts +8 -8
  126. package/dist/src/views/default-view.js +7 -7
  127. package/dist/src/views/error-boundary.d.ts +10 -10
  128. package/dist/src/views/error-boundary.js +42 -53
  129. package/dist/src/webgl-compat/error-messages.d.ts +9 -9
  130. package/dist/src/webgl-compat/error-messages.js +10 -10
  131. package/dist/src/webgl-compat/index.d.ts +13 -13
  132. package/dist/src/webgl-compat/index.js +8 -8
  133. package/dist/src/webgl-compat/types.d.ts +21 -21
  134. package/dist/src/webgl-compat/types.js +1 -1
  135. package/dist/src/webgl-compat/use-event-system.d.ts +3 -3
  136. package/dist/src/webgl-compat/use-event-system.js +77 -76
  137. package/dist/src/webgl-compat/use-unity-context.d.ts +31 -31
  138. package/dist/src/webgl-compat/use-unity-context.js +92 -91
  139. package/dist/tests.d.ts +1 -1
  140. package/dist/tests.js +1 -1
  141. package/dist/ugui/index.d.ts +1 -0
  142. package/dist/ugui/index.js +1 -0
  143. package/dist/ugui/jsx-dev-runtime.d.ts +2 -0
  144. package/dist/ugui/jsx-dev-runtime.js +1 -0
  145. package/dist/ugui/jsx-runtime.d.ts +2 -0
  146. package/dist/ugui/jsx-runtime.js +1 -0
  147. package/dist/uitoolkit/index.d.ts +1 -0
  148. package/dist/uitoolkit/index.js +1 -0
  149. package/dist/uitoolkit/jsx-dev-runtime.d.ts +2 -0
  150. package/dist/uitoolkit/jsx-dev-runtime.js +1 -0
  151. package/dist/uitoolkit/jsx-runtime.d.ts +2 -0
  152. package/dist/uitoolkit/jsx-runtime.js +1 -0
  153. package/dist/webgl-compat.d.ts +1 -1
  154. package/dist/webgl-compat.js +1 -1
  155. package/editor/jsx-dev-runtime.ts +4 -0
  156. package/editor/jsx-runtime.ts +4 -0
  157. package/package.json +13 -32
  158. package/ugui/jsx-dev-runtime.ts +4 -0
  159. package/ugui/jsx-runtime.ts +4 -0
  160. package/uitoolkit/jsx-dev-runtime.ts +4 -0
  161. package/uitoolkit/jsx-runtime.ts +4 -0
  162. package/dist/editor.d.ts +0 -1
  163. package/dist/editor.js +0 -1
  164. package/dist/src/models/environment/jsx.d.ts +0 -45
  165. package/dist/src/models/environment/jsx.js +0 -1
  166. package/dist/ugui.d.ts +0 -1
  167. package/dist/ugui.js +0 -1
  168. package/dist/uitoolkit.d.ts +0 -1
  169. package/dist/uitoolkit.js +0 -1
  170. package/editor.ts +0 -1
  171. package/tsconfig.editor.json +0 -6
  172. package/tsconfig.ugui.json +0 -6
  173. package/tsconfig.uitoolkit.json +0 -6
  174. package/ugui.ts +0 -1
  175. package/uitoolkit.ts +0 -1
@@ -1,93 +1,93 @@
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';
9
- var containerMap = new Map();
10
- var renderCount = 0;
11
- export function render(element, options) {
12
- if (options === void 0) { options = {}; }
13
- renderCount++;
14
- var hostContainer = (options === null || options === void 0 ? void 0 : options.hostContainer) || HostContainer;
15
- var cacheKey = hostContainer.InstanceId >= 0 ? hostContainer.InstanceId : hostContainer;
16
- var isAsync = !(options === null || options === void 0 ? void 0 : options.disableBatchRendering);
17
- var _a = containerMap.get(cacheKey) || {}, hostRoot = _a.hostRoot, asyncJobCallback = _a.asyncJobCallback;
18
- var findFiberByHostInstance = function () { return null; };
19
- if (!hostRoot) {
20
- var mode = (options === null || options === void 0 ? void 0 : options.mode) === 'legacy' ? LegacyRoot : ConcurrentRoot;
21
- if (isAsync) {
22
- var fiberCache_1 = isDevelopment ? new ObjectsRepo() : null;
23
- if (isDevelopment) {
24
- findFiberByHostInstance = function (instance) { return !instance ? null : fiberCache_1.getObject(instance.refId); };
25
- }
26
- var scheduled_1 = false;
27
- var commands_1 = [];
28
- commands_1.push = function () {
29
- var args = [];
30
- for (var _i = 0; _i < arguments.length; _i++) {
31
- args[_i] = arguments[_i];
32
- }
33
- if (!scheduled_1) {
34
- scheduled_1 = true;
35
- Promise.resolve().then(function () {
36
- asyncJobCallback();
37
- scheduled_1 = false;
38
- });
39
- }
40
- return Array.prototype.push.apply(commands_1, args);
41
- };
42
- var hostContainerInstance_1 = {
43
- type: 'native',
44
- commands: commands_1,
45
- component: hostContainer,
46
- context: hostContainer.Context,
47
- refId: hostContainer.RefId,
48
- fiberCache: fiberCache_1,
49
- };
50
- asyncJobCallback = function () {
51
- if (!commands_1.length)
52
- return;
53
- var serialized = JSON.stringify(commands_1);
54
- commands_1.length = 0;
55
- hostContainerInstance_1.context.FlushCommands(serialized);
56
- };
57
- hostRoot = asyncReconciler.createContainer(hostContainerInstance_1, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
58
- }
59
- else {
60
- hostRoot = syncReconciler.createContainer(hostContainer, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
61
- }
62
- containerMap.set(cacheKey, { hostRoot: hostRoot, asyncJobCallback: asyncJobCallback });
63
- }
64
- var shouldWrapWithHelpers = !(options === null || options === void 0 ? void 0 : options.disableHelpers);
65
- if (shouldWrapWithHelpers) {
66
- var viewWrapperProps = {
67
- withHelpers: !(options === null || options === void 0 ? void 0 : options.disableHelpers),
68
- renderCount: renderCount,
69
- };
70
- element = createElement(DefaultView, viewWrapperProps, element);
71
- }
72
- var rc = isAsync ? asyncReconciler : syncReconciler;
73
- rc.updateContainer(element, hostRoot, null);
74
- rc.injectIntoDevTools({
75
- bundleType: isDevelopment ? 1 : 0,
76
- version: version,
77
- rendererPackageName: '@reactunity/renderer',
78
- rendererConfig: { isAsync: isAsync },
79
- findFiberByHostInstance: findFiberByHostInstance,
80
- });
81
- return rc;
82
- }
83
- /**
84
- * @deprecated Instead, import `render` directly from `@reactunity/renderer`
85
- */
86
- export var Renderer = {
87
- render: function (element, options) {
88
- if (options === void 0) { options = {}; }
89
- return render(element, options);
90
- },
91
- };
92
- export var batchedUpdates = asyncReconciler.batchedUpdates;
93
- export var flushSync = asyncReconciler.flushSync;
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';
9
+ var containerMap = new Map();
10
+ var renderCount = 0;
11
+ export function render(element, options) {
12
+ if (options === void 0) { options = {}; }
13
+ renderCount++;
14
+ var hostContainer = (options === null || options === void 0 ? void 0 : options.hostContainer) || HostContainer;
15
+ var cacheKey = hostContainer.InstanceId >= 0 ? hostContainer.InstanceId : hostContainer;
16
+ var isAsync = !(options === null || options === void 0 ? void 0 : options.disableBatchRendering);
17
+ var _a = containerMap.get(cacheKey) || {}, hostRoot = _a.hostRoot, asyncJobCallback = _a.asyncJobCallback;
18
+ var findFiberByHostInstance = function () { return null; };
19
+ if (!hostRoot) {
20
+ var mode = (options === null || options === void 0 ? void 0 : options.mode) === 'legacy' ? LegacyRoot : ConcurrentRoot;
21
+ if (isAsync) {
22
+ var fiberCache_1 = isDevelopment ? new ObjectsRepo() : null;
23
+ if (isDevelopment) {
24
+ findFiberByHostInstance = function (instance) { return !instance ? null : fiberCache_1.getObject(instance.refId); };
25
+ }
26
+ var scheduled_1 = false;
27
+ var commands_1 = [];
28
+ commands_1.push = function () {
29
+ var args = [];
30
+ for (var _i = 0; _i < arguments.length; _i++) {
31
+ args[_i] = arguments[_i];
32
+ }
33
+ if (!scheduled_1) {
34
+ scheduled_1 = true;
35
+ Promise.resolve().then(function () {
36
+ asyncJobCallback();
37
+ scheduled_1 = false;
38
+ });
39
+ }
40
+ return Array.prototype.push.apply(commands_1, args);
41
+ };
42
+ var hostContainerInstance_1 = {
43
+ type: 'native',
44
+ commands: commands_1,
45
+ component: hostContainer,
46
+ context: hostContainer.Context,
47
+ refId: hostContainer.RefId,
48
+ fiberCache: fiberCache_1,
49
+ };
50
+ asyncJobCallback = function () {
51
+ if (!commands_1.length)
52
+ return;
53
+ var serialized = JSON.stringify(commands_1);
54
+ commands_1.length = 0;
55
+ hostContainerInstance_1.context.FlushCommands(serialized);
56
+ };
57
+ hostRoot = asyncReconciler.createContainer(hostContainerInstance_1, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
58
+ }
59
+ else {
60
+ hostRoot = syncReconciler.createContainer(hostContainer, mode, null, false, undefined, '', function (error) { return console.error(error); }, null);
61
+ }
62
+ containerMap.set(cacheKey, { hostRoot: hostRoot, asyncJobCallback: asyncJobCallback });
63
+ }
64
+ var shouldWrapWithHelpers = !(options === null || options === void 0 ? void 0 : options.disableHelpers);
65
+ if (shouldWrapWithHelpers) {
66
+ var viewWrapperProps = {
67
+ withHelpers: !(options === null || options === void 0 ? void 0 : options.disableHelpers),
68
+ renderCount: renderCount,
69
+ };
70
+ element = createElement(DefaultView, viewWrapperProps, element);
71
+ }
72
+ var rc = isAsync ? asyncReconciler : syncReconciler;
73
+ rc.updateContainer(element, hostRoot, null);
74
+ rc.injectIntoDevTools({
75
+ bundleType: isDevelopment ? 1 : 0,
76
+ version: version,
77
+ rendererPackageName: '@reactunity/renderer',
78
+ rendererConfig: { isAsync: isAsync },
79
+ findFiberByHostInstance: findFiberByHostInstance,
80
+ });
81
+ return rc;
82
+ }
83
+ /**
84
+ * @deprecated Instead, import `render` directly from `@reactunity/renderer`
85
+ */
86
+ export var Renderer = {
87
+ render: function (element, options) {
88
+ if (options === void 0) { options = {}; }
89
+ return render(element, options);
90
+ },
91
+ };
92
+ export var batchedUpdates = asyncReconciler.batchedUpdates;
93
+ export var flushSync = asyncReconciler.flushSync;
@@ -1,6 +1,6 @@
1
- import { stringifyRichText } from './richtext';
2
- import { stringifySVG } from './svg';
3
- export declare const subContextRenderers: {
4
- richtext: typeof stringifyRichText;
5
- svg: typeof stringifySVG;
6
- };
1
+ import { stringifyRichText } from './richtext';
2
+ import { stringifySVG } from './svg';
3
+ export declare const subContextRenderers: {
4
+ richtext: typeof stringifyRichText;
5
+ svg: typeof stringifySVG;
6
+ };
@@ -1,6 +1,6 @@
1
- import { stringifyRichText } from './richtext';
2
- import { stringifySVG } from './svg';
3
- export var subContextRenderers = {
4
- 'richtext': stringifyRichText,
5
- 'svg': stringifySVG,
6
- };
1
+ import { stringifyRichText } from './richtext';
2
+ import { stringifySVG } from './svg';
3
+ export var subContextRenderers = {
4
+ richtext: stringifyRichText,
5
+ svg: stringifySVG,
6
+ };
@@ -1,3 +1,3 @@
1
- import { RichTextNode } from '../async/types';
2
- export declare function parametrizeValue(value: string | number): string;
3
- export declare function stringifyRichText(node: RichTextNode): string;
1
+ import { RichTextNode } from '../async/types';
2
+ export declare function parametrizeValue(value: string | number): string;
3
+ export declare function stringifyRichText(node: RichTextNode): string;
@@ -1,52 +1,52 @@
1
- export function parametrizeValue(value) {
2
- if (typeof value === 'number')
3
- return value + '';
4
- value = value + '';
5
- if (value.includes(' ') || value.includes('-'))
6
- return '"' + value + '"';
7
- return value;
8
- }
9
- export function stringifyRichText(node) {
10
- var _a, _b, _c;
11
- if (node.hidden)
12
- return '';
13
- if ('text' in node)
14
- return node.text;
15
- var acc = [];
16
- var tag = node.tag;
17
- if (tag) {
18
- acc.push('<');
19
- acc.push(tag);
20
- if (((_a = node.attributes) === null || _a === void 0 ? void 0 : _a.value) != null) {
21
- var value = (_b = node.attributes) === null || _b === void 0 ? void 0 : _b.value;
22
- acc.push('=');
23
- acc.push(parametrizeValue(value));
24
- }
25
- for (var key in node.attributes) {
26
- if (key === 'value')
27
- continue;
28
- if (Object.prototype.hasOwnProperty.call(node.attributes, key)) {
29
- var value = node.attributes[key];
30
- if (value != null) {
31
- acc.push(' ');
32
- acc.push(key);
33
- acc.push('=');
34
- acc.push(parametrizeValue(value));
35
- }
36
- }
37
- }
38
- acc.push('>');
39
- }
40
- if (((_c = node.children) === null || _c === void 0 ? void 0 : _c.length) > 0) {
41
- for (var _i = 0, _d = node.children; _i < _d.length; _i++) {
42
- var child = _d[_i];
43
- acc.push(stringifyRichText(child));
44
- }
45
- if (tag) {
46
- acc.push('</');
47
- acc.push(tag);
48
- acc.push('>');
49
- }
50
- }
51
- return acc.join('');
52
- }
1
+ export function parametrizeValue(value) {
2
+ if (typeof value === 'number')
3
+ return value + '';
4
+ value = value + '';
5
+ if (value.includes(' ') || value.includes('-'))
6
+ return '"' + value + '"';
7
+ return value;
8
+ }
9
+ export function stringifyRichText(node) {
10
+ var _a, _b, _c;
11
+ if (node.hidden)
12
+ return '';
13
+ if ('text' in node)
14
+ return node.text;
15
+ var acc = [];
16
+ var tag = node.tag;
17
+ if (tag) {
18
+ acc.push('<');
19
+ acc.push(tag);
20
+ if (((_a = node.attributes) === null || _a === void 0 ? void 0 : _a.value) != null) {
21
+ var value = (_b = node.attributes) === null || _b === void 0 ? void 0 : _b.value;
22
+ acc.push('=');
23
+ acc.push(parametrizeValue(value));
24
+ }
25
+ for (var key in node.attributes) {
26
+ if (key === 'value')
27
+ continue;
28
+ if (Object.prototype.hasOwnProperty.call(node.attributes, key)) {
29
+ var value = node.attributes[key];
30
+ if (value != null) {
31
+ acc.push(' ');
32
+ acc.push(key);
33
+ acc.push('=');
34
+ acc.push(parametrizeValue(value));
35
+ }
36
+ }
37
+ }
38
+ acc.push('>');
39
+ }
40
+ if (((_c = node.children) === null || _c === void 0 ? void 0 : _c.length) > 0) {
41
+ for (var _i = 0, _d = node.children; _i < _d.length; _i++) {
42
+ var child = _d[_i];
43
+ acc.push(stringifyRichText(child));
44
+ }
45
+ if (tag) {
46
+ acc.push('</');
47
+ acc.push(tag);
48
+ acc.push('>');
49
+ }
50
+ }
51
+ return acc.join('');
52
+ }
@@ -1,3 +1,3 @@
1
- import { RichTextNode } from '../async/types';
2
- export declare function stringifyStyle(style: any): string;
3
- export declare function stringifySVG(node: RichTextNode): string;
1
+ import { RichTextNode } from '../async/types';
2
+ export declare function stringifyStyle(style: any): string;
3
+ export declare function stringifySVG(node: RichTextNode): string;
@@ -1,70 +1,70 @@
1
- function kebabize(str) {
2
- return str.split('').map(function (letter, idx) {
3
- return letter.toUpperCase() === letter
4
- ? "".concat(idx !== 0 ? '-' : '').concat(letter.toLowerCase())
5
- : letter;
6
- }).join('');
7
- }
8
- ;
9
- export function stringifyStyle(style) {
10
- if (typeof style === 'string')
11
- return style;
12
- var acc = [];
13
- for (var key in style) {
14
- if (Object.prototype.hasOwnProperty.call(style, key)) {
15
- var element = style[key];
16
- if (element != null) {
17
- acc.push(kebabize(key));
18
- acc.push(':');
19
- acc.push(element);
20
- acc.push(';');
21
- }
22
- }
23
- }
24
- return acc.join('');
25
- }
26
- export function stringifySVG(node) {
27
- var _a;
28
- if (node.hidden)
29
- return '';
30
- if ('text' in node)
31
- return node.text;
32
- var acc = [];
33
- var tag = node.tag;
34
- if (tag) {
35
- acc.push('<');
36
- acc.push(tag);
37
- for (var key in node.attributes) {
38
- if (Object.prototype.hasOwnProperty.call(node.attributes, key)) {
39
- var element = node.attributes[key];
40
- if (key === 'style')
41
- element = stringifyStyle(element);
42
- if (element != null) {
43
- acc.push(' ');
44
- acc.push(kebabize(key));
45
- acc.push('="');
46
- acc.push(element);
47
- acc.push('"');
48
- }
49
- }
50
- }
51
- }
52
- if (((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
53
- if (tag)
54
- acc.push('>');
55
- for (var _i = 0, _b = node.children; _i < _b.length; _i++) {
56
- var child = _b[_i];
57
- acc.push(stringifySVG(child));
58
- }
59
- if (tag) {
60
- acc.push('</');
61
- acc.push(tag);
62
- acc.push('>');
63
- }
64
- }
65
- else {
66
- if (tag)
67
- acc.push(' />');
68
- }
69
- return acc.join('');
70
- }
1
+ function kebabize(str) {
2
+ return str.split('').map(function (letter, idx) {
3
+ return letter.toUpperCase() === letter
4
+ ? "".concat(idx !== 0 ? '-' : '').concat(letter.toLowerCase())
5
+ : letter;
6
+ }).join('');
7
+ }
8
+ ;
9
+ export function stringifyStyle(style) {
10
+ if (typeof style === 'string')
11
+ return style;
12
+ var acc = [];
13
+ for (var key in style) {
14
+ if (Object.prototype.hasOwnProperty.call(style, key)) {
15
+ var element = style[key];
16
+ if (element != null) {
17
+ acc.push(kebabize(key));
18
+ acc.push(':');
19
+ acc.push(element);
20
+ acc.push(';');
21
+ }
22
+ }
23
+ }
24
+ return acc.join('');
25
+ }
26
+ export function stringifySVG(node) {
27
+ var _a;
28
+ if (node.hidden)
29
+ return '';
30
+ if ('text' in node)
31
+ return node.text;
32
+ var acc = [];
33
+ var tag = node.tag;
34
+ if (tag) {
35
+ acc.push('<');
36
+ acc.push(tag);
37
+ for (var key in node.attributes) {
38
+ if (Object.prototype.hasOwnProperty.call(node.attributes, key)) {
39
+ var element = node.attributes[key];
40
+ if (key === 'style')
41
+ element = stringifyStyle(element);
42
+ if (element != null) {
43
+ acc.push(' ');
44
+ acc.push(kebabize(key));
45
+ acc.push('="');
46
+ acc.push(element);
47
+ acc.push('"');
48
+ }
49
+ }
50
+ }
51
+ }
52
+ if (((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
53
+ if (tag)
54
+ acc.push('>');
55
+ for (var _i = 0, _b = node.children; _i < _b.length; _i++) {
56
+ var child = _b[_i];
57
+ acc.push(stringifySVG(child));
58
+ }
59
+ if (tag) {
60
+ acc.push('</');
61
+ acc.push(tag);
62
+ acc.push('>');
63
+ }
64
+ }
65
+ else {
66
+ if (tag)
67
+ acc.push(' />');
68
+ }
69
+ return acc.join('');
70
+ }
@@ -1,2 +1,2 @@
1
- import * as Reconciler from 'react-reconciler';
2
- export declare const syncReconciler: Reconciler.Reconciler<import("../../..").ReactUnity.IReactComponent, import("../../..").ReactUnity.IReactComponent, import("../../..").ReactUnity.ITextComponent, import("../../..").ReactUnity.IReactComponent, any>;
1
+ import * as Reconciler from 'react-reconciler';
2
+ export declare const syncReconciler: Reconciler.Reconciler<import("../../..").ReactUnity.IReactComponent, import("../../..").ReactUnity.IReactComponent, import("../../..").ReactUnity.ITextComponent, import("../../..").ReactUnity.IReactComponent, any>;
@@ -1,35 +1,35 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import * as Reconciler from 'react-reconciler';
13
- import { commonReconciler, getAllowedProps, hideClass, stringizePoolKey, textTypes } from '../constants';
14
- import { diffProperties } from '../diffing';
15
- var hostContext = {};
16
- 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);
19
- var children = aProps.children || null;
20
- delete aProps.children;
21
- return UnityBridge.createElement(props.tag || type, children, rootContainerInstance, aProps, stringizePoolKey(props.pool));
22
- }, createTextInstance: function (text, rootContainerInstance) {
23
- 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]; },
25
- // -------------------
26
- // Mutation
27
- // -------------------
28
- prepareUpdate: function (instance, type, oldProps, newProps) {
29
- return diffProperties(oldProps, newProps);
30
- }, commitUpdate: function (instance, updatePayload, type) {
31
- UnityBridge.applyUpdate(instance, getAllowedProps(updatePayload, type), type);
32
- }, 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
- // 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);
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as Reconciler from 'react-reconciler';
13
+ import { commonReconciler, getAllowedProps, hideClass, stringizePoolKey, textTypes } from '../constants';
14
+ import { diffProperties } from '../diffing';
15
+ var hostContext = {};
16
+ 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);
19
+ var children = aProps.children || null;
20
+ delete aProps.children;
21
+ return UnityBridge.createElement(props.tag || type, children, rootContainerInstance, aProps, stringizePoolKey(props.pool));
22
+ }, createTextInstance: function (text, rootContainerInstance) {
23
+ 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]; },
25
+ // -------------------
26
+ // Mutation
27
+ // -------------------
28
+ prepareUpdate: function (instance, type, oldProps, newProps) {
29
+ return diffProperties(oldProps, newProps);
30
+ }, commitUpdate: function (instance, updatePayload, type) {
31
+ UnityBridge.applyUpdate(instance, getAllowedProps(updatePayload, type), type);
32
+ }, 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
+ // 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);
@@ -1 +1 @@
1
- export declare const version = "0.15.2";
1
+ export declare const version = "0.16.0";
@@ -1 +1 @@
1
- export var version = '0.15.2';
1
+ export var version = '0.16.0';
@@ -1,8 +1,8 @@
1
- import { ReactNode } from 'react';
2
- interface Props {
3
- children?: ReactNode;
4
- withHelpers: boolean;
5
- renderCount: number;
6
- }
7
- export declare function DefaultView({ children, withHelpers, renderCount }: Props): any;
8
- export {};
1
+ import { ReactNode } from 'react';
2
+ interface Props {
3
+ children?: ReactNode;
4
+ withHelpers: boolean;
5
+ renderCount: number;
6
+ }
7
+ export declare function DefaultView({ children, withHelpers, renderCount }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -1,7 +1,7 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { ErrorBoundary } from './error-boundary';
3
- export function DefaultView(_a) {
4
- var children = _a.children, withHelpers = _a.withHelpers, renderCount = _a.renderCount;
5
- return _jsx(_Fragment, { children: !withHelpers ? children :
6
- _jsx(ErrorBoundary, { children: children }, renderCount) });
7
- }
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ErrorBoundary } from './error-boundary';
3
+ export function DefaultView(_a) {
4
+ var children = _a.children, withHelpers = _a.withHelpers, renderCount = _a.renderCount;
5
+ return _jsx(_Fragment, { children: !withHelpers ? children :
6
+ _jsx(ErrorBoundary, { children: children }, renderCount) });
7
+ }
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
2
- export declare class ErrorBoundary extends React.Component<any, any> {
3
- constructor(props: any);
4
- static getDerivedStateFromError(error: any): {
5
- hasError: boolean;
6
- error: any;
7
- };
8
- componentDidCatch(error: any, errorInfo: any): void;
9
- render(): any;
10
- }
1
+ import * as React from 'react';
2
+ export declare class ErrorBoundary extends React.Component<any, any> {
3
+ constructor(props: any);
4
+ static getDerivedStateFromError(error: any): {
5
+ hasError: boolean;
6
+ error: any;
7
+ };
8
+ componentDidCatch(error: any, errorInfo: any): void;
9
+ render(): any;
10
+ }