@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,283 +1,307 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
instance.hostContext.commands.push(['
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
instance.commands.push([
|
|
184
|
-
}
|
|
185
|
-
else if (instance.type === 'richtext' || instance.type === 'svg') {
|
|
186
|
-
instance.node
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
child.parent
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
child.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
instance.
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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.asyncReconciler = void 0;
|
|
15
|
+
var Reconciler = require("react-reconciler");
|
|
16
|
+
var constants_1 = require("../constants");
|
|
17
|
+
var diffing_1 = require("../diffing");
|
|
18
|
+
var subcontexts_1 = require("../subcontexts");
|
|
19
|
+
var serializer_1 = require("./serializer");
|
|
20
|
+
var refId = 0;
|
|
21
|
+
var ctxMap = new Map();
|
|
22
|
+
var updateSubContext = function (instance) {
|
|
23
|
+
var rend = subcontexts_1.subContextRenderers[instance.type];
|
|
24
|
+
var root = instance === null || instance === void 0 ? void 0 : instance.root;
|
|
25
|
+
var cur = instance;
|
|
26
|
+
while (cur && !root) {
|
|
27
|
+
root = cur.root;
|
|
28
|
+
cur = cur.parent;
|
|
29
|
+
}
|
|
30
|
+
if (!root)
|
|
31
|
+
return;
|
|
32
|
+
var content = rend(root.subContext.node);
|
|
33
|
+
if (instance.type === 'richtext') {
|
|
34
|
+
// instance.hostContext.commands.push(['x', { r: root.refId, c: content }]);
|
|
35
|
+
instance.hostContext.commands.push([6, root.refId, content]);
|
|
36
|
+
}
|
|
37
|
+
else if (instance.type === 'svg') {
|
|
38
|
+
// instance.hostContext.commands.push(['u', { r: root.refId, t: 'svg', ...convertPropsToSerializable({ innerContent: content }) }]);
|
|
39
|
+
instance.hostContext.commands.push([5, root.refId, 'svg', (0, serializer_1.convertPropsToSerializable)({ innerContent: content })]);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var hostConfig = __assign(__assign({}, constants_1.commonReconciler), { getRootHostContext: function (rootContainer) {
|
|
43
|
+
var context = rootContainer.context;
|
|
44
|
+
if (rootContainer.refId < 0) {
|
|
45
|
+
refId++;
|
|
46
|
+
rootContainer.context.SetRef(refId, rootContainer.component);
|
|
47
|
+
rootContainer.refId = refId;
|
|
48
|
+
}
|
|
49
|
+
var existing = ctxMap.get(context);
|
|
50
|
+
if (existing)
|
|
51
|
+
return existing;
|
|
52
|
+
var commands = rootContainer.commands;
|
|
53
|
+
var flushCommands = function () {
|
|
54
|
+
var serialized = JSON.stringify(commands);
|
|
55
|
+
commands.length = 0;
|
|
56
|
+
return serialized;
|
|
57
|
+
};
|
|
58
|
+
var fireEventByRef = function (ind, args) {
|
|
59
|
+
return serializer_1.callbacksRepo.call(ind, args);
|
|
60
|
+
};
|
|
61
|
+
var getObjectRef = function (ind) {
|
|
62
|
+
return serializer_1.objectsRepo.getObject(ind);
|
|
63
|
+
};
|
|
64
|
+
var getEventAsObjectRef = function (ind) {
|
|
65
|
+
return serializer_1.callbacksRepo.getObject(ind);
|
|
66
|
+
};
|
|
67
|
+
context.BindCommands(flushCommands, fireEventByRef, getObjectRef, getEventAsObjectRef);
|
|
68
|
+
var ctx = {
|
|
69
|
+
context: context,
|
|
70
|
+
commands: commands,
|
|
71
|
+
refId: rootContainer.refId,
|
|
72
|
+
type: 'native',
|
|
73
|
+
};
|
|
74
|
+
ctxMap.set(context, ctx);
|
|
75
|
+
return ctx;
|
|
76
|
+
}, getChildHostContext: function (parentCtx, type) {
|
|
77
|
+
if (type === 'richtext' && parentCtx.type === 'native')
|
|
78
|
+
return {
|
|
79
|
+
type: 'richtext',
|
|
80
|
+
hostContext: parentCtx,
|
|
81
|
+
node: null,
|
|
82
|
+
parent: null,
|
|
83
|
+
root: null,
|
|
84
|
+
};
|
|
85
|
+
if (type === 'svg' && parentCtx.type === 'native')
|
|
86
|
+
return {
|
|
87
|
+
type: 'svg',
|
|
88
|
+
hostContext: parentCtx,
|
|
89
|
+
node: null,
|
|
90
|
+
parent: null,
|
|
91
|
+
root: null,
|
|
92
|
+
};
|
|
93
|
+
return parentCtx;
|
|
94
|
+
}, getPublicInstance: function (instance) {
|
|
95
|
+
if (instance.type === 'native')
|
|
96
|
+
return instance.context.GetRef(instance.refId, instance.commands.length > 0);
|
|
97
|
+
return null;
|
|
98
|
+
}, supportsMutation: true, supportsHydration: false, supportsPersistence: false, supportsMicrotasks: true, supportsTestSelectors: false, isPrimaryRenderer: true, warnsIfNotActing: true, prepareForCommit: function () { return null; }, resetAfterCommit: function () { }, shouldDeprioritizeSubtree: function () { return false; }, clearContainer: function (container) {
|
|
99
|
+
UnityBridge.clearContainer(container);
|
|
100
|
+
}, createInstance: function (type, props, rootContainer, ctx, internalHandle) {
|
|
101
|
+
var aProps = (0, constants_1.getAllowedProps)(props, type);
|
|
102
|
+
if (ctx.type === 'native') {
|
|
103
|
+
refId++;
|
|
104
|
+
// ctx.commands.push(['c', { t: type, r: refId, k: stringizePoolKey(props.pool), ...convertPropsToSerializable(aProps) }]);
|
|
105
|
+
ctx.commands.push([0, refId, type, (0, serializer_1.convertPropsToSerializable)(aProps), (0, constants_1.stringizePoolKey)(props.pool)]);
|
|
106
|
+
if (rootContainer.fiberCache)
|
|
107
|
+
rootContainer.fiberCache.setObject(refId, internalHandle);
|
|
108
|
+
var res = __assign(__assign({}, ctx), { refId: refId });
|
|
109
|
+
if (type === 'richtext') {
|
|
110
|
+
res.subContext = {
|
|
111
|
+
type: 'richtext',
|
|
112
|
+
node: {
|
|
113
|
+
tag: '',
|
|
114
|
+
children: [],
|
|
115
|
+
attributes: aProps,
|
|
116
|
+
},
|
|
117
|
+
root: res,
|
|
118
|
+
hostContext: res,
|
|
119
|
+
parent: null,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (type === 'svg') {
|
|
123
|
+
res.subContext = {
|
|
124
|
+
type: 'svg',
|
|
125
|
+
node: {
|
|
126
|
+
tag: '',
|
|
127
|
+
children: [],
|
|
128
|
+
attributes: aProps,
|
|
129
|
+
},
|
|
130
|
+
root: res,
|
|
131
|
+
hostContext: res,
|
|
132
|
+
parent: null,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return res;
|
|
136
|
+
}
|
|
137
|
+
else if (ctx.type === 'richtext' || ctx.type === 'svg') {
|
|
138
|
+
return __assign(__assign({}, ctx), { node: {
|
|
139
|
+
tag: type,
|
|
140
|
+
children: [],
|
|
141
|
+
attributes: aProps,
|
|
142
|
+
} });
|
|
143
|
+
}
|
|
144
|
+
}, createTextInstance: function (text, rootContainer, ctx, internalHandle) {
|
|
145
|
+
if (ctx.type === 'native') {
|
|
146
|
+
refId++;
|
|
147
|
+
// ctx.commands.push(['t', { r: refId, c: text }]);
|
|
148
|
+
ctx.commands.push([1, refId, text]);
|
|
149
|
+
if (rootContainer.fiberCache)
|
|
150
|
+
rootContainer.fiberCache.setObject(refId, internalHandle);
|
|
151
|
+
return __assign(__assign({}, ctx), { refId: refId });
|
|
152
|
+
}
|
|
153
|
+
else if (ctx.type === 'richtext' || ctx.type === 'svg') {
|
|
154
|
+
return __assign(__assign({}, ctx), { node: { text: text } });
|
|
155
|
+
}
|
|
156
|
+
}, appendInitialChild: function (parent, child) {
|
|
157
|
+
if (!child)
|
|
158
|
+
return;
|
|
159
|
+
if (parent.type === 'native' && parent.subContext)
|
|
160
|
+
parent = parent.subContext;
|
|
161
|
+
if (parent.type === 'native' && child.type === 'native') {
|
|
162
|
+
// parent.commands.push(['a', { p: parent.refId, c: child.refId }]);
|
|
163
|
+
parent.commands.push([2, parent.refId, child.refId]);
|
|
164
|
+
}
|
|
165
|
+
else if ((parent.type === 'richtext' && child.type === 'richtext') ||
|
|
166
|
+
(parent.type === 'svg' && child.type === 'svg')) {
|
|
167
|
+
if ('children' in parent.node)
|
|
168
|
+
parent.node.children.push(child.node);
|
|
169
|
+
child.root = parent.root;
|
|
170
|
+
child.parent = parent;
|
|
171
|
+
updateSubContext(child);
|
|
172
|
+
}
|
|
173
|
+
}, finalizeInitialChildren: function () { return false; }, commitMount: function (instance) { }, shouldSetTextContent: function (type) { return constants_1.textTypes[type]; },
|
|
174
|
+
// -------------------
|
|
175
|
+
// Mutation
|
|
176
|
+
// -------------------
|
|
177
|
+
prepareUpdate: function (instance, type, oldProps, newProps) {
|
|
178
|
+
return (0, diffing_1.diffProperties)(oldProps, newProps);
|
|
179
|
+
}, commitUpdate: function (instance, updatePayload, type) {
|
|
180
|
+
var props = (0, constants_1.getAllowedProps)(updatePayload, type);
|
|
181
|
+
if (instance.type === 'native') {
|
|
182
|
+
// instance.commands.push(['u', { r: instance.refId, t: type, ...convertPropsToSerializable(props) }]);
|
|
183
|
+
instance.commands.push([5, instance.refId, type, (0, serializer_1.convertPropsToSerializable)(props)]);
|
|
184
|
+
}
|
|
185
|
+
else if (instance.type === 'richtext' || instance.type === 'svg') {
|
|
186
|
+
if ('attributes' in instance.node)
|
|
187
|
+
instance.node.attributes = __assign(__assign({}, instance.node.attributes), props);
|
|
188
|
+
updateSubContext(instance);
|
|
189
|
+
}
|
|
190
|
+
}, commitTextUpdate: function (instance, oldText, newText) {
|
|
191
|
+
if (instance.type === 'native') {
|
|
192
|
+
// instance.commands.push(['x', { r: instance.refId, c: newText }]);
|
|
193
|
+
instance.commands.push([6, instance.refId, newText]);
|
|
194
|
+
}
|
|
195
|
+
else if (instance.type === 'richtext' || instance.type === 'svg') {
|
|
196
|
+
instance.node = { text: newText };
|
|
197
|
+
updateSubContext(instance);
|
|
198
|
+
}
|
|
199
|
+
}, appendChild: function (parent, child) {
|
|
200
|
+
if (!child)
|
|
201
|
+
return;
|
|
202
|
+
if (parent.type === 'native' && parent.subContext)
|
|
203
|
+
parent = parent.subContext;
|
|
204
|
+
if (parent.type === 'native' && child.type === 'native') {
|
|
205
|
+
// child.commands.push(['a', { p: parent.refId, c: child.refId }]);
|
|
206
|
+
child.commands.push([2, parent.refId, child.refId]);
|
|
207
|
+
}
|
|
208
|
+
else if ((parent.type === 'richtext' && child.type === 'richtext') ||
|
|
209
|
+
(parent.type === 'svg' && child.type === 'svg')) {
|
|
210
|
+
if ('children' in parent.node)
|
|
211
|
+
parent.node.children.push(child.node);
|
|
212
|
+
child.root = parent.root;
|
|
213
|
+
child.parent = parent;
|
|
214
|
+
updateSubContext(child);
|
|
215
|
+
}
|
|
216
|
+
}, appendChildToContainer: function (parent, child) {
|
|
217
|
+
if (child.type === 'native')
|
|
218
|
+
// child.commands.push(['a', { p: parent.refId, c: child.refId }]);
|
|
219
|
+
child.commands.push([2, parent.refId, child.refId]);
|
|
220
|
+
}, insertBefore: function (parent, child, beforeChild) {
|
|
221
|
+
if (!child)
|
|
222
|
+
return;
|
|
223
|
+
if (parent.type === 'native' && parent.subContext)
|
|
224
|
+
parent = parent.subContext;
|
|
225
|
+
if (parent.type === 'native' && child.type === 'native' && beforeChild.type === 'native') {
|
|
226
|
+
// child.commands.push(['i', { p: parent.refId, c: child.refId, i: beforeChild.refId }]);
|
|
227
|
+
child.commands.push([4, parent.refId, child.refId, beforeChild.refId]);
|
|
228
|
+
}
|
|
229
|
+
else if ((parent.type === 'richtext' && child.type === 'richtext' && beforeChild.type === 'richtext') ||
|
|
230
|
+
(parent.type === 'svg' && child.type === 'svg' && beforeChild.type === 'svg')) {
|
|
231
|
+
if ('children' in parent.node) {
|
|
232
|
+
var index = parent.node.children.indexOf(beforeChild.node);
|
|
233
|
+
if (index >= 0)
|
|
234
|
+
parent.node.children.splice(index, 0, child.node);
|
|
235
|
+
else
|
|
236
|
+
parent.node.children.push(child.node);
|
|
237
|
+
}
|
|
238
|
+
child.root = parent.root;
|
|
239
|
+
child.parent = parent;
|
|
240
|
+
updateSubContext(child);
|
|
241
|
+
}
|
|
242
|
+
}, insertInContainerBefore: function (parent, child, beforeChild) {
|
|
243
|
+
if (child.type === 'native' && beforeChild.type === 'native')
|
|
244
|
+
// child.commands.push(['i', { p: parent.refId, c: child.refId, i: beforeChild.refId }]);
|
|
245
|
+
child.commands.push([4, parent.refId, child.refId, beforeChild.refId]);
|
|
246
|
+
}, removeChild: function (parent, child) {
|
|
247
|
+
if (!child)
|
|
248
|
+
return;
|
|
249
|
+
if (parent.type === 'native' && parent.subContext)
|
|
250
|
+
parent = parent.subContext;
|
|
251
|
+
if (parent.type === 'native' && child.type === 'native') {
|
|
252
|
+
// child.commands.push(['r', { p: parent.refId, c: child.refId }]);
|
|
253
|
+
child.commands.push([3, parent.refId, child.refId]);
|
|
254
|
+
}
|
|
255
|
+
else if ((parent.type === 'richtext' && child.type === 'richtext') ||
|
|
256
|
+
(parent.type === 'svg' && child.type === 'svg')) {
|
|
257
|
+
if ('children' in parent.node) {
|
|
258
|
+
var index = parent.node.children.indexOf(child.node);
|
|
259
|
+
if (index >= 0)
|
|
260
|
+
parent.node.children.splice(index, 1);
|
|
261
|
+
}
|
|
262
|
+
updateSubContext(parent);
|
|
263
|
+
}
|
|
264
|
+
}, removeChildFromContainer: function (parent, child) {
|
|
265
|
+
if (child.type === 'native')
|
|
266
|
+
// child.commands.push(['r', { p: parent.refId, c: child.refId }]);
|
|
267
|
+
child.commands.push([3, parent.refId, child.refId]);
|
|
268
|
+
}, resetTextContent: function () { }, preparePortalMount: function () { }, detachDeletedInstance: function () { },
|
|
269
|
+
// Required for Suspense
|
|
270
|
+
hideInstance: function (instance) {
|
|
271
|
+
if (instance.type === 'native') {
|
|
272
|
+
// instance.commands.push(['h', { r: instance.refId, h: true }]);
|
|
273
|
+
instance.commands.push([7, instance.refId, true]);
|
|
274
|
+
}
|
|
275
|
+
else if (instance.type === 'richtext' || instance.type === 'svg') {
|
|
276
|
+
instance.node.hidden = true;
|
|
277
|
+
updateSubContext(instance);
|
|
278
|
+
}
|
|
279
|
+
}, hideTextInstance: function (instance) {
|
|
280
|
+
if (instance.type === 'native') {
|
|
281
|
+
// instance.commands.push(['h', { r: instance.refId, h: true }]);
|
|
282
|
+
instance.commands.push([7, instance.refId, true]);
|
|
283
|
+
}
|
|
284
|
+
else if (instance.type === 'richtext' || instance.type === 'svg') {
|
|
285
|
+
instance.node.hidden = true;
|
|
286
|
+
updateSubContext(instance);
|
|
287
|
+
}
|
|
288
|
+
}, unhideInstance: function (instance) {
|
|
289
|
+
if (instance.type === 'native') {
|
|
290
|
+
// instance.commands.push(['h', { r: instance.refId, h: false }]);
|
|
291
|
+
instance.commands.push([7, instance.refId, false]);
|
|
292
|
+
}
|
|
293
|
+
else if (instance.type === 'richtext' || instance.type === 'svg') {
|
|
294
|
+
instance.node.hidden = false;
|
|
295
|
+
updateSubContext(instance);
|
|
296
|
+
}
|
|
297
|
+
}, unhideTextInstance: function (instance) {
|
|
298
|
+
if (instance.type === 'native') {
|
|
299
|
+
// instance.commands.push(['h', { r: instance.refId, h: false }]);
|
|
300
|
+
instance.commands.push([7, instance.refId, false]);
|
|
301
|
+
}
|
|
302
|
+
else if (instance.type === 'richtext' || instance.type === 'svg') {
|
|
303
|
+
instance.node.hidden = false;
|
|
304
|
+
updateSubContext(instance);
|
|
305
|
+
}
|
|
306
|
+
} });
|
|
307
|
+
exports.asyncReconciler = Reconciler(hostConfig);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { CallbacksRepo } from './callbacks';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
export declare
|
|
6
|
-
|
|
7
|
-
o: any;
|
|
8
|
-
e: any;
|
|
9
|
-
};
|
|
1
|
+
import { CallbacksRepo } from './callbacks';
|
|
2
|
+
import { SerializableUpdateProps } from './commands';
|
|
3
|
+
import { ObjectsRepo } from './objects';
|
|
4
|
+
export declare const callbacksRepo: CallbacksRepo;
|
|
5
|
+
export declare const objectsRepo: ObjectsRepo<any>;
|
|
6
|
+
export declare function convertPropsToSerializable(props: any): SerializableUpdateProps;
|