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