@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.
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +17 -0
- package/dist/editor/jsx-dev-runtime.d.ts +2 -0
- package/dist/editor/jsx-dev-runtime.js +17 -0
- package/dist/editor/jsx-runtime.d.ts +2 -0
- package/dist/editor/jsx-runtime.js +17 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +31 -9
- package/dist/src/helpers/dictionary-watcher.d.ts +66 -66
- package/dist/src/helpers/dictionary-watcher.js +104 -98
- package/dist/src/helpers/hooks/use-globals.d.ts +6 -6
- package/dist/src/helpers/hooks/use-globals.js +9 -6
- package/dist/src/helpers/hooks/use-reactive-value.d.ts +4 -4
- package/dist/src/helpers/hooks/use-reactive-value.js +31 -27
- package/dist/src/helpers/icons.d.ts +11 -7
- package/dist/src/helpers/icons.js +32 -29
- package/dist/src/models/base.d.ts +56 -56
- package/dist/src/models/base.js +3 -2
- package/dist/src/models/editor/components.d.ts +22 -22
- package/dist/src/models/editor/components.js +2 -1
- package/dist/src/models/editor/environment.d.ts +9 -10
- package/dist/src/models/editor/environment.js +2 -1
- package/dist/src/models/editor/index.d.ts +3 -3
- package/dist/src/models/editor/index.js +19 -3
- package/dist/src/models/editor/jsx.d.ts +111 -104
- package/dist/src/models/editor/jsx.js +2 -1
- package/dist/src/models/environment/dom/common.d.ts +85 -85
- package/dist/src/models/environment/dom/common.js +2 -1
- package/dist/src/models/environment/dom/fetch.d.ts +111 -111
- package/dist/src/models/environment/dom/fetch.js +2 -1
- package/dist/src/models/environment/dom/global.d.ts +11 -11
- package/dist/src/models/environment/dom/global.js +2 -1
- package/dist/src/models/environment/dom/xhr.d.ts +161 -161
- package/dist/src/models/environment/dom/xhr.js +2 -1
- package/dist/src/models/environment/index.d.ts +43 -47
- package/dist/src/models/environment/index.js +18 -3
- package/dist/src/models/environment/interop.d.ts +23 -23
- package/dist/src/models/environment/interop.js +2 -1
- package/dist/src/models/generated/editor.d.ts +18501 -18501
- package/dist/src/models/generated/editor.js +7 -6
- package/dist/src/models/generated/index.d.ts +6 -6
- package/dist/src/models/generated/index.js +22 -6
- package/dist/src/models/generated/react.d.ts +15214 -15214
- package/dist/src/models/generated/react.js +7 -6
- package/dist/src/models/generated/system.d.ts +36731 -36731
- package/dist/src/models/generated/system.js +7 -6
- package/dist/src/models/generated/tests.d.ts +5023 -5023
- package/dist/src/models/generated/tests.js +7 -6
- package/dist/src/models/generated/unity.d.ts +43446 -43446
- package/dist/src/models/generated/unity.js +7 -6
- package/dist/src/models/generated/yoga.d.ts +368 -368
- package/dist/src/models/generated/yoga.js +7 -6
- package/dist/src/models/properties/colors.d.ts +150 -150
- package/dist/src/models/properties/colors.js +2 -1
- package/dist/src/models/properties/common.d.ts +2 -2
- package/dist/src/models/properties/common.js +2 -1
- package/dist/src/models/properties/index.d.ts +7 -7
- package/dist/src/models/properties/index.js +23 -7
- package/dist/src/models/properties/style.d.ts +10 -10
- package/dist/src/models/properties/style.js +2 -1
- package/dist/src/models/properties/styles-enums.d.ts +23 -23
- package/dist/src/models/properties/styles-enums.js +2 -1
- package/dist/src/models/properties/styles.d.ts +127 -127
- package/dist/src/models/properties/styles.js +2 -1
- package/dist/src/models/properties/values.d.ts +24 -24
- package/dist/src/models/properties/values.js +2 -1
- package/dist/src/models/properties/yoga-enums.d.ts +8 -8
- package/dist/src/models/properties/yoga-enums.js +2 -1
- package/dist/src/models/properties/yoga.d.ts +66 -66
- package/dist/src/models/properties/yoga.js +2 -1
- package/dist/src/models/renderer.d.ts +20 -20
- package/dist/src/models/renderer.js +2 -1
- package/dist/src/models/richtext.d.ts +69 -69
- package/dist/src/models/richtext.js +3 -2
- package/dist/src/models/svg.d.ts +68 -68
- package/dist/src/models/svg.js +2 -1
- package/dist/src/models/tests/index.d.ts +12 -12
- package/dist/src/models/tests/index.js +2 -1
- package/dist/src/models/ugui/components.d.ts +86 -86
- package/dist/src/models/ugui/components.js +2 -1
- package/dist/src/models/ugui/events.d.ts +74 -74
- package/dist/src/models/ugui/events.js +3 -2
- package/dist/src/models/ugui/index.d.ts +4 -4
- package/dist/src/models/ugui/index.js +20 -4
- package/dist/src/models/ugui/input.d.ts +26 -26
- package/dist/src/models/ugui/input.js +2 -1
- package/dist/src/models/ugui/jsx.d.ts +67 -60
- package/dist/src/models/ugui/jsx.js +2 -1
- package/dist/src/models/uitoolkit/components.d.ts +82 -82
- package/dist/src/models/uitoolkit/components.js +2 -1
- package/dist/src/models/uitoolkit/events.d.ts +64 -64
- package/dist/src/models/uitoolkit/events.js +2 -1
- package/dist/src/models/uitoolkit/index.d.ts +3 -3
- package/dist/src/models/uitoolkit/index.js +19 -3
- package/dist/src/models/uitoolkit/jsx.d.ts +71 -64
- package/dist/src/models/uitoolkit/jsx.js +2 -1
- package/dist/src/renderer/async/callbacks.d.ts +5 -6
- package/dist/src/renderer/async/callbacks.js +55 -52
- package/dist/src/renderer/async/commands.d.ts +98 -47
- package/dist/src/renderer/async/commands.js +2 -1
- package/dist/src/renderer/async/objects.d.ts +7 -8
- package/dist/src/renderer/async/objects.js +34 -31
- package/dist/src/renderer/async/reconciler.d.ts +2 -2
- package/dist/src/renderer/async/reconciler.js +307 -283
- package/dist/src/renderer/async/serializer.d.ts +6 -9
- package/dist/src/renderer/async/serializer.js +35 -31
- package/dist/src/renderer/async/types.d.ts +45 -45
- package/dist/src/renderer/async/types.js +2 -1
- package/dist/src/renderer/constants.d.ts +30 -30
- package/dist/src/renderer/constants.js +75 -70
- package/dist/src/renderer/diffing.d.ts +3 -3
- package/dist/src/renderer/diffing.js +87 -83
- package/dist/src/renderer/renderer.d.ts +26 -26
- package/dist/src/renderer/renderer.js +97 -93
- package/dist/src/renderer/subcontexts/index.d.ts +6 -6
- package/dist/src/renderer/subcontexts/index.js +9 -6
- package/dist/src/renderer/subcontexts/richtext.d.ts +3 -3
- package/dist/src/renderer/subcontexts/richtext.js +57 -52
- package/dist/src/renderer/subcontexts/svg.d.ts +3 -3
- package/dist/src/renderer/subcontexts/svg.js +75 -70
- package/dist/src/renderer/sync/reconciler.d.ts +2 -2
- package/dist/src/renderer/sync/reconciler.js +38 -35
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +4 -1
- package/dist/src/views/default-view.d.ts +8 -8
- package/dist/src/views/default-view.js +11 -7
- package/dist/src/views/error-boundary.d.ts +10 -10
- package/dist/src/views/error-boundary.js +45 -53
- package/dist/src/webgl-compat/error-messages.d.ts +9 -9
- package/dist/src/webgl-compat/error-messages.js +13 -10
- package/dist/src/webgl-compat/index.d.ts +13 -13
- package/dist/src/webgl-compat/index.js +13 -8
- package/dist/src/webgl-compat/types.d.ts +21 -21
- package/dist/src/webgl-compat/types.js +2 -1
- package/dist/src/webgl-compat/use-event-system.d.ts +3 -3
- package/dist/src/webgl-compat/use-event-system.js +82 -76
- package/dist/src/webgl-compat/use-unity-context.d.ts +31 -31
- package/dist/src/webgl-compat/use-unity-context.js +96 -91
- package/dist/tests.d.ts +1 -1
- package/dist/tests.js +17 -1
- package/dist/ugui/index.d.ts +1 -0
- package/dist/ugui/index.js +17 -0
- package/dist/ugui/jsx-dev-runtime.d.ts +2 -0
- package/dist/ugui/jsx-dev-runtime.js +17 -0
- package/dist/ugui/jsx-runtime.d.ts +2 -0
- package/dist/ugui/jsx-runtime.js +17 -0
- package/dist/uitoolkit/index.d.ts +1 -0
- package/dist/uitoolkit/index.js +17 -0
- package/dist/uitoolkit/jsx-dev-runtime.d.ts +2 -0
- package/dist/uitoolkit/jsx-dev-runtime.js +17 -0
- package/dist/uitoolkit/jsx-runtime.d.ts +2 -0
- package/dist/uitoolkit/jsx-runtime.js +17 -0
- package/dist/webgl-compat.d.ts +1 -1
- package/dist/webgl-compat.js +17 -1
- package/package.json +16 -32
- package/dist/editor.d.ts +0 -1
- package/dist/editor.js +0 -1
- package/dist/src/models/environment/jsx.d.ts +0 -45
- package/dist/src/models/environment/jsx.js +0 -1
- package/dist/ugui.d.ts +0 -1
- package/dist/ugui.js +0 -1
- package/dist/uitoolkit.d.ts +0 -1
- package/dist/uitoolkit.js +0 -1
- package/editor.ts +0 -1
- package/tests.ts +0 -1
- package/tsconfig.editor.json +0 -6
- package/tsconfig.ugui.json +0 -6
- package/tsconfig.uitoolkit.json +0 -6
- package/ugui.ts +0 -1
- package/uitoolkit.ts +0 -1
- package/version.js +0 -3
- package/webgl-compat.ts +0 -1
|
@@ -1,93 +1,97 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
commands_1.length
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
hostRoot =
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (value
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
acc.push(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
acc.push(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
acc.push('
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
acc.push(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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);
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.16.1";
|
package/dist/src/version.js
CHANGED
|
@@ -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):
|
|
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 {};
|