@farm.js/react 0.1.0-beta.4 → 0.1.0-beta.6
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/README.md +213 -1
- package/dist/compiler-runtime.cjs +1892 -65
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +112 -4
- package/dist/compiler-runtime.d.ts +112 -4
- package/dist/compiler-runtime.mjs +1839 -66
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +1959 -44
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +1959 -44
- package/dist/vite.mjs.map +1 -1
- package/package.json +6 -4
|
@@ -19,6 +19,434 @@ function materializeIterable(source) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// src/compiler-runtime.tsx
|
|
22
|
+
var COMPILER_KEYED_COLLECTION_TOKENS = /* @__PURE__ */ new WeakMap();
|
|
23
|
+
var COMPILER_KEYED_MAP_UPDATES = /* @__PURE__ */ new WeakMap();
|
|
24
|
+
var COMPILER_KEYED_ARRAY_APPENDS = /* @__PURE__ */ new WeakMap();
|
|
25
|
+
var COMPILER_KEYED_ARRAY_FILTERS = /* @__PURE__ */ new WeakMap();
|
|
26
|
+
var COMPILER_KEYED_ARRAY_PREPENDS = /* @__PURE__ */ new WeakMap();
|
|
27
|
+
var COMPILER_KEYED_ARRAY_ROLLING_WINDOWS = /* @__PURE__ */ new WeakMap();
|
|
28
|
+
var COMPILER_KEYED_ARRAY_POSITIONS = /* @__PURE__ */ new WeakMap();
|
|
29
|
+
var COMPILER_KEYED_ARRAY_REORDERS = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
|
|
31
|
+
var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
var COMPILER_KEYED_COMMITTED_COLLECTIONS = /* @__PURE__ */ new WeakSet();
|
|
33
|
+
var NATIVE_ARRAY_PROTOTYPE = Array.prototype;
|
|
34
|
+
var NATIVE_ARRAY_ITERATOR = Array.prototype[Symbol.iterator];
|
|
35
|
+
var NATIVE_ARRAY_FILTER = Array.prototype.filter;
|
|
36
|
+
var NATIVE_ARRAY_SLICE = Array.prototype.slice;
|
|
37
|
+
var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
|
|
38
|
+
var NATIVE_ARRAY_WITH = Array.prototype.with;
|
|
39
|
+
var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
|
|
40
|
+
var NATIVE_REFLECT_APPLY = Reflect.apply;
|
|
41
|
+
function compilerObject(value) {
|
|
42
|
+
return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
|
|
43
|
+
}
|
|
44
|
+
function compilerKeyedCollectionToken(value) {
|
|
45
|
+
const target = compilerObject(value);
|
|
46
|
+
if (!target) return void 0;
|
|
47
|
+
let token = COMPILER_KEYED_COLLECTION_TOKENS.get(target);
|
|
48
|
+
if (!token) {
|
|
49
|
+
token = {};
|
|
50
|
+
COMPILER_KEYED_COLLECTION_TOKENS.set(target, token);
|
|
51
|
+
}
|
|
52
|
+
return token;
|
|
53
|
+
}
|
|
54
|
+
function commitCompilerKeyedCollection(value) {
|
|
55
|
+
const target = compilerObject(value);
|
|
56
|
+
if (!target) return void 0;
|
|
57
|
+
COMPILER_KEYED_COMMITTED_COLLECTIONS.add(target);
|
|
58
|
+
return compilerKeyedCollectionToken(target);
|
|
59
|
+
}
|
|
60
|
+
function compilerKeyedMapChangedIndices(value, sourceToken) {
|
|
61
|
+
const target = compilerObject(value);
|
|
62
|
+
if (!target || !sourceToken) return void 0;
|
|
63
|
+
const update = COMPILER_KEYED_MAP_UPDATES.get(target);
|
|
64
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
65
|
+
const changedIndices = [];
|
|
66
|
+
for (let current = update; current; current = current.previous) {
|
|
67
|
+
changedIndices.push(...current.changedIndices);
|
|
68
|
+
}
|
|
69
|
+
return changedIndices;
|
|
70
|
+
}
|
|
71
|
+
function compilerKeyedArrayAppendStart(value, sourceToken, expectedStart) {
|
|
72
|
+
const target = compilerObject(value);
|
|
73
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
74
|
+
const update = COMPILER_KEYED_ARRAY_APPENDS.get(target);
|
|
75
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
76
|
+
const updates = [];
|
|
77
|
+
for (let current = update; current; current = current.previous) {
|
|
78
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
79
|
+
updates.push(current);
|
|
80
|
+
}
|
|
81
|
+
let length = expectedStart;
|
|
82
|
+
for (let index = updates.length - 1; index >= 0; index -= 1) {
|
|
83
|
+
const current = updates[index];
|
|
84
|
+
if (current.startIndex !== length || current.resultLength < length) return void 0;
|
|
85
|
+
length = current.resultLength;
|
|
86
|
+
}
|
|
87
|
+
return length === value.length ? expectedStart : void 0;
|
|
88
|
+
}
|
|
89
|
+
function compilerKeyedArrayFilterSurvivors(value, sourceToken, expectedLength) {
|
|
90
|
+
const target = compilerObject(value);
|
|
91
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
92
|
+
const update = COMPILER_KEYED_ARRAY_FILTERS.get(target);
|
|
93
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
94
|
+
const updates = [];
|
|
95
|
+
for (let current = update; current; current = current.previous) {
|
|
96
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
97
|
+
updates.push(current);
|
|
98
|
+
}
|
|
99
|
+
let survivors = Array.from({ length: expectedLength }, (_, index) => index);
|
|
100
|
+
let keysStable = true;
|
|
101
|
+
for (let updateIndex = updates.length - 1; updateIndex >= 0; updateIndex -= 1) {
|
|
102
|
+
const current = updates[updateIndex];
|
|
103
|
+
if (current.sourceLength !== survivors.length) return void 0;
|
|
104
|
+
if (current.kind === "slice") {
|
|
105
|
+
const start = current.retainedStart;
|
|
106
|
+
const end = current.retainedEnd;
|
|
107
|
+
if (start === void 0 || end === void 0 || !Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || end < start || end > current.sourceLength || current.resultLength !== end - start) {
|
|
108
|
+
return void 0;
|
|
109
|
+
}
|
|
110
|
+
survivors = survivors.slice(start, end);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
keysStable = false;
|
|
114
|
+
const removed = /* @__PURE__ */ new Set();
|
|
115
|
+
for (const index of current.removedIndices || []) {
|
|
116
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= current.sourceLength)
|
|
117
|
+
return void 0;
|
|
118
|
+
removed.add(index);
|
|
119
|
+
}
|
|
120
|
+
if (current.resultLength !== current.sourceLength - removed.size) return void 0;
|
|
121
|
+
survivors = survivors.filter((_sourceIndex, index) => !removed.has(index));
|
|
122
|
+
}
|
|
123
|
+
return survivors.length === value.length ? { indices: survivors, keysStable } : void 0;
|
|
124
|
+
}
|
|
125
|
+
function compilerKeyedArrayPrependLength(value, sourceToken, expectedLength) {
|
|
126
|
+
const target = compilerObject(value);
|
|
127
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
128
|
+
const update = COMPILER_KEYED_ARRAY_PREPENDS.get(target);
|
|
129
|
+
if (!update || update.sourceToken !== sourceToken) return void 0;
|
|
130
|
+
const updates = [];
|
|
131
|
+
for (let current = update; current; current = current.previous) {
|
|
132
|
+
if (current.sourceToken !== sourceToken) return void 0;
|
|
133
|
+
updates.push(current);
|
|
134
|
+
}
|
|
135
|
+
let length = expectedLength;
|
|
136
|
+
let prefixLength = 0;
|
|
137
|
+
for (let index = updates.length - 1; index >= 0; index -= 1) {
|
|
138
|
+
const current = updates[index];
|
|
139
|
+
if (current.sourceLength !== length || current.prefixLength < 1 || current.resultLength !== current.sourceLength + current.prefixLength) {
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
length = current.resultLength;
|
|
143
|
+
prefixLength += current.prefixLength;
|
|
144
|
+
}
|
|
145
|
+
return length === value.length ? prefixLength : void 0;
|
|
146
|
+
}
|
|
147
|
+
function compilerKeyedArrayRollingWindow(value, sourceToken, expectedLength) {
|
|
148
|
+
const target = compilerObject(value);
|
|
149
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
150
|
+
const update = COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.get(target);
|
|
151
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.retainedStart < 1 || update.retainedEnd !== update.sourceLength || update.resultLength <= update.retainedEnd - update.retainedStart) {
|
|
152
|
+
return void 0;
|
|
153
|
+
}
|
|
154
|
+
return update;
|
|
155
|
+
}
|
|
156
|
+
function compilerKeyedArrayPosition(value, sourceToken, expectedLength) {
|
|
157
|
+
const target = compilerObject(value);
|
|
158
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
159
|
+
const update = COMPILER_KEYED_ARRAY_POSITIONS.get(target);
|
|
160
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== value.length || update.position < 0 || update.position > expectedLength || update.kind === "insert" && update.resultLength !== expectedLength + 1 || update.kind === "replace" && (update.position >= expectedLength || update.resultLength !== expectedLength)) {
|
|
161
|
+
return void 0;
|
|
162
|
+
}
|
|
163
|
+
return update;
|
|
164
|
+
}
|
|
165
|
+
function compilerKeyedArrayReorder(value, sourceToken, expectedLength) {
|
|
166
|
+
const target = compilerObject(value);
|
|
167
|
+
if (!target || !sourceToken || !Array.isArray(value)) return void 0;
|
|
168
|
+
const update = COMPILER_KEYED_ARRAY_REORDERS.get(target);
|
|
169
|
+
if (!update || update.sourceToken !== sourceToken || update.sourceLength !== expectedLength || update.resultLength !== expectedLength || update.resultLength !== value.length) {
|
|
170
|
+
return void 0;
|
|
171
|
+
}
|
|
172
|
+
return update;
|
|
173
|
+
}
|
|
174
|
+
function compilerKeyedCollectionChangedKeys(value, sourceToken, kind) {
|
|
175
|
+
const target = compilerObject(value);
|
|
176
|
+
if (!target || !sourceToken) return void 0;
|
|
177
|
+
const update = COMPILER_KEYED_COLLECTION_UPDATES.get(target);
|
|
178
|
+
if (!update || update.kind !== kind || update.sourceToken !== sourceToken) return void 0;
|
|
179
|
+
const changedKeys = [];
|
|
180
|
+
for (let current = update; current; current = current.previous) {
|
|
181
|
+
if (current.kind !== kind || current.sourceToken !== sourceToken) return void 0;
|
|
182
|
+
changedKeys.push(...current.changedKeys);
|
|
183
|
+
}
|
|
184
|
+
return changedKeys;
|
|
185
|
+
}
|
|
186
|
+
function createCompilerKeyedMapUpdate(previous, value, changedIndices) {
|
|
187
|
+
const previousTarget = compilerObject(previous);
|
|
188
|
+
const valueTarget = compilerObject(value);
|
|
189
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
190
|
+
if (valueTarget && sourceToken) {
|
|
191
|
+
const previousUpdate = previousTarget && !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_MAP_UPDATES.get(previousTarget) : void 0;
|
|
192
|
+
COMPILER_KEYED_MAP_UPDATES.set(valueTarget, {
|
|
193
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
194
|
+
changedIndices,
|
|
195
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return value;
|
|
199
|
+
}
|
|
200
|
+
function createCompilerKeyedArrayAppend(previous, value) {
|
|
201
|
+
try {
|
|
202
|
+
const previousTarget = compilerObject(previous);
|
|
203
|
+
const valueTarget = compilerObject(value);
|
|
204
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
|
|
205
|
+
return value;
|
|
206
|
+
}
|
|
207
|
+
const startIndex = previous.length;
|
|
208
|
+
if (value.length < startIndex) return value;
|
|
209
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
210
|
+
if (!sourceToken) return value;
|
|
211
|
+
const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_APPENDS.get(previousTarget) : void 0;
|
|
212
|
+
COMPILER_KEYED_ARRAY_APPENDS.set(valueTarget, {
|
|
213
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
214
|
+
startIndex,
|
|
215
|
+
resultLength: value.length,
|
|
216
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
217
|
+
});
|
|
218
|
+
return value;
|
|
219
|
+
} catch {
|
|
220
|
+
return value;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function createCompilerKeyedArrayPrepend(previous, value) {
|
|
224
|
+
try {
|
|
225
|
+
const previousTarget = compilerObject(previous);
|
|
226
|
+
const valueTarget = compilerObject(value);
|
|
227
|
+
if (!previousTarget || !valueTarget || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || previous[Symbol.iterator] !== NATIVE_ARRAY_ITERATOR) {
|
|
228
|
+
return value;
|
|
229
|
+
}
|
|
230
|
+
const sourceLength = previous.length;
|
|
231
|
+
const prefixLength = value.length - sourceLength;
|
|
232
|
+
if (prefixLength < 1) return value;
|
|
233
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
234
|
+
if (!sourceToken) return value;
|
|
235
|
+
const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_PREPENDS.get(previousTarget) : void 0;
|
|
236
|
+
COMPILER_KEYED_ARRAY_PREPENDS.set(valueTarget, {
|
|
237
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
238
|
+
sourceLength,
|
|
239
|
+
resultLength: value.length,
|
|
240
|
+
prefixLength,
|
|
241
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
242
|
+
});
|
|
243
|
+
return value;
|
|
244
|
+
} catch {
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function createCompilerKeyedArrayFilter(previous, method, predicate) {
|
|
249
|
+
let canHint = false;
|
|
250
|
+
let sourceLength = 0;
|
|
251
|
+
try {
|
|
252
|
+
canHint = Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_FILTER && typeof predicate === "function";
|
|
253
|
+
if (canHint) sourceLength = previous.length;
|
|
254
|
+
} catch {
|
|
255
|
+
canHint = false;
|
|
256
|
+
}
|
|
257
|
+
if (!canHint) {
|
|
258
|
+
return NATIVE_REFLECT_APPLY(method, previous, [predicate]);
|
|
259
|
+
}
|
|
260
|
+
const removedIndices = [];
|
|
261
|
+
let visited = 0;
|
|
262
|
+
const wrappedPredicate = function(item, index, collection) {
|
|
263
|
+
visited += 1;
|
|
264
|
+
const keep = NATIVE_REFLECT_APPLY(predicate, this, [
|
|
265
|
+
item,
|
|
266
|
+
index,
|
|
267
|
+
collection
|
|
268
|
+
]);
|
|
269
|
+
if (!keep) removedIndices.push(index);
|
|
270
|
+
return keep;
|
|
271
|
+
};
|
|
272
|
+
const value = NATIVE_REFLECT_APPLY(method, previous, [
|
|
273
|
+
wrappedPredicate
|
|
274
|
+
]);
|
|
275
|
+
try {
|
|
276
|
+
const previousTarget = compilerObject(previous);
|
|
277
|
+
const valueTarget = compilerObject(value);
|
|
278
|
+
if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || visited !== sourceLength || value.length !== sourceLength - removedIndices.length) {
|
|
279
|
+
return value;
|
|
280
|
+
}
|
|
281
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
282
|
+
if (!sourceToken) return value;
|
|
283
|
+
const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
|
|
284
|
+
COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
|
|
285
|
+
kind: "filter",
|
|
286
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
287
|
+
sourceLength,
|
|
288
|
+
resultLength: value.length,
|
|
289
|
+
removedIndices,
|
|
290
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
291
|
+
});
|
|
292
|
+
} catch {
|
|
293
|
+
}
|
|
294
|
+
return value;
|
|
295
|
+
}
|
|
296
|
+
function createCompilerKeyedArraySlice(previous, method, ...args) {
|
|
297
|
+
const canHint = (() => {
|
|
298
|
+
try {
|
|
299
|
+
return Array.isArray(previous) && Object.getPrototypeOf(previous) === NATIVE_ARRAY_PROTOTYPE && method === NATIVE_ARRAY_SLICE && args.length > 0 && args.length <= 2 && args.every((value2) => Number.isSafeInteger(value2));
|
|
300
|
+
} catch {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
})();
|
|
304
|
+
const value = NATIVE_REFLECT_APPLY(method, previous, args);
|
|
305
|
+
if (!canHint) return value;
|
|
306
|
+
try {
|
|
307
|
+
const previousTarget = compilerObject(previous);
|
|
308
|
+
const valueTarget = compilerObject(value);
|
|
309
|
+
if (!previousTarget || !valueTarget || !Array.isArray(value) || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
|
|
310
|
+
return value;
|
|
311
|
+
}
|
|
312
|
+
const sourceLength = previous.length;
|
|
313
|
+
const normalize = (relative) => relative < 0 ? Math.max(sourceLength + relative, 0) : Math.min(relative, sourceLength);
|
|
314
|
+
const retainedStart = normalize(args[0]);
|
|
315
|
+
const retainedEnd = args.length === 2 ? normalize(args[1]) : sourceLength;
|
|
316
|
+
const resultLength = Math.max(retainedEnd - retainedStart, 0);
|
|
317
|
+
if (value.length !== resultLength || resultLength >= sourceLength) return value;
|
|
318
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
319
|
+
if (!sourceToken) return value;
|
|
320
|
+
const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_ARRAY_FILTERS.get(previousTarget) : void 0;
|
|
321
|
+
COMPILER_KEYED_ARRAY_FILTERS.set(valueTarget, {
|
|
322
|
+
kind: "slice",
|
|
323
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
324
|
+
sourceLength,
|
|
325
|
+
resultLength,
|
|
326
|
+
retainedEnd: Math.max(retainedEnd, retainedStart),
|
|
327
|
+
retainedStart,
|
|
328
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
329
|
+
});
|
|
330
|
+
} catch {
|
|
331
|
+
}
|
|
332
|
+
return value;
|
|
333
|
+
}
|
|
334
|
+
function createCompilerKeyedArrayRollingWindow(previous, retained, value) {
|
|
335
|
+
try {
|
|
336
|
+
const previousTarget = compilerObject(previous);
|
|
337
|
+
const retainedTarget = compilerObject(retained);
|
|
338
|
+
const valueTarget = compilerObject(value);
|
|
339
|
+
if (!previousTarget || !retainedTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(retained) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(retained) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE) {
|
|
340
|
+
return value;
|
|
341
|
+
}
|
|
342
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
343
|
+
const slice = COMPILER_KEYED_ARRAY_FILTERS.get(retainedTarget);
|
|
344
|
+
if (!sourceToken || !slice || slice.previous || slice.kind !== "slice" || slice.sourceToken !== sourceToken || slice.sourceLength !== previous.length || slice.retainedStart === void 0 || slice.retainedEnd !== previous.length || slice.retainedStart < 1 || slice.resultLength !== retained.length || value.length <= retained.length) {
|
|
345
|
+
return value;
|
|
346
|
+
}
|
|
347
|
+
for (let index = 0; index < retained.length; index += 1) {
|
|
348
|
+
if (!Object.is(value[index], retained[index])) return value;
|
|
349
|
+
}
|
|
350
|
+
COMPILER_KEYED_ARRAY_ROLLING_WINDOWS.set(valueTarget, {
|
|
351
|
+
sourceToken,
|
|
352
|
+
sourceLength: previous.length,
|
|
353
|
+
resultLength: value.length,
|
|
354
|
+
retainedEnd: slice.retainedEnd,
|
|
355
|
+
retainedStart: slice.retainedStart
|
|
356
|
+
});
|
|
357
|
+
} catch {
|
|
358
|
+
}
|
|
359
|
+
return value;
|
|
360
|
+
}
|
|
361
|
+
function createCompilerKeyedArrayPositionUpdate(previous, method, kind, position, ...args) {
|
|
362
|
+
const callArgs = [position, ...args];
|
|
363
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
364
|
+
method,
|
|
365
|
+
previous,
|
|
366
|
+
callArgs
|
|
367
|
+
);
|
|
368
|
+
try {
|
|
369
|
+
const previousTarget = compilerObject(previous);
|
|
370
|
+
const valueTarget = compilerObject(value);
|
|
371
|
+
if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || !Number.isSafeInteger(position)) {
|
|
372
|
+
return value;
|
|
373
|
+
}
|
|
374
|
+
const sourceLength = previous.length;
|
|
375
|
+
const normalizedPosition = position < 0 ? Math.max(sourceLength + position, 0) : Math.min(position, sourceLength);
|
|
376
|
+
const validInsert = kind === "insert" && method === NATIVE_ARRAY_TO_SPLICED && args.length === 2 && Object.is(args[0], 0) && value.length === sourceLength + 1;
|
|
377
|
+
const validReplace = kind === "replace" && method === NATIVE_ARRAY_WITH && args.length === 1 && position >= -sourceLength && position < sourceLength && value.length === sourceLength;
|
|
378
|
+
if (!validInsert && !validReplace) return value;
|
|
379
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
380
|
+
if (!sourceToken) return value;
|
|
381
|
+
COMPILER_KEYED_ARRAY_POSITIONS.set(valueTarget, {
|
|
382
|
+
kind,
|
|
383
|
+
sourceToken,
|
|
384
|
+
sourceLength,
|
|
385
|
+
resultLength: value.length,
|
|
386
|
+
position: normalizedPosition
|
|
387
|
+
});
|
|
388
|
+
} catch {
|
|
389
|
+
}
|
|
390
|
+
return value;
|
|
391
|
+
}
|
|
392
|
+
function createCompilerKeyedArrayReorder(previous, method) {
|
|
393
|
+
const value = NATIVE_REFLECT_APPLY(
|
|
394
|
+
method,
|
|
395
|
+
previous,
|
|
396
|
+
[]
|
|
397
|
+
);
|
|
398
|
+
try {
|
|
399
|
+
const previousTarget = compilerObject(previous);
|
|
400
|
+
const valueTarget = compilerObject(value);
|
|
401
|
+
if (!previousTarget || !valueTarget || !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) || !Array.isArray(previous) || !Array.isArray(value) || Object.getPrototypeOf(previous) !== NATIVE_ARRAY_PROTOTYPE || Object.getPrototypeOf(value) !== NATIVE_ARRAY_PROTOTYPE || method !== NATIVE_ARRAY_TO_REVERSED || value.length !== previous.length) {
|
|
402
|
+
return value;
|
|
403
|
+
}
|
|
404
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
405
|
+
if (!sourceToken) return value;
|
|
406
|
+
COMPILER_KEYED_ARRAY_REORDERS.set(valueTarget, {
|
|
407
|
+
kind: "reverse",
|
|
408
|
+
sourceToken,
|
|
409
|
+
sourceLength: previous.length,
|
|
410
|
+
resultLength: value.length
|
|
411
|
+
});
|
|
412
|
+
} catch {
|
|
413
|
+
}
|
|
414
|
+
return value;
|
|
415
|
+
}
|
|
416
|
+
function applyCompilerKeyedCollectionMutation(collection, method, operation, key, value) {
|
|
417
|
+
const args = operation === "map-set" ? [key, value] : [key];
|
|
418
|
+
const result = NATIVE_REFLECT_APPLY(method, collection, args);
|
|
419
|
+
const target = compilerObject(collection);
|
|
420
|
+
if (!target) return result;
|
|
421
|
+
const kind = operation.startsWith("set-") ? "set" : "map";
|
|
422
|
+
const nativeMethod = operation === "set-add" ? NATIVE_SET_ADD : operation === "set-delete" ? NATIVE_SET_DELETE : operation === "map-set" ? NATIVE_MAP_SET : NATIVE_MAP_DELETE;
|
|
423
|
+
const nativePrototype = kind === "set" ? NATIVE_SET_PROTOTYPE : NATIVE_MAP_PROTOTYPE;
|
|
424
|
+
if (method !== nativeMethod || Object.getPrototypeOf(collection) !== nativePrototype) {
|
|
425
|
+
return result;
|
|
426
|
+
}
|
|
427
|
+
const existing = COMPILER_KEYED_COLLECTION_DRAFTS.get(target);
|
|
428
|
+
if (existing && existing.kind !== kind) return result;
|
|
429
|
+
if (existing) existing.changedKeys.push(key);
|
|
430
|
+
else COMPILER_KEYED_COLLECTION_DRAFTS.set(target, { kind, changedKeys: [key] });
|
|
431
|
+
return result;
|
|
432
|
+
}
|
|
433
|
+
function createCompilerKeyedCollectionUpdate(previous, value, kind) {
|
|
434
|
+
const previousTarget = compilerObject(previous);
|
|
435
|
+
const valueTarget = compilerObject(value);
|
|
436
|
+
if (!previousTarget || !valueTarget || previousTarget === valueTarget) return value;
|
|
437
|
+
const draft = COMPILER_KEYED_COLLECTION_DRAFTS.get(valueTarget);
|
|
438
|
+
if (!draft || draft.kind !== kind || draft.changedKeys.length === 0) return value;
|
|
439
|
+
const sourceToken = compilerKeyedCollectionToken(previousTarget);
|
|
440
|
+
if (!sourceToken) return value;
|
|
441
|
+
const previousUpdate = !COMPILER_KEYED_COMMITTED_COLLECTIONS.has(previousTarget) ? COMPILER_KEYED_COLLECTION_UPDATES.get(previousTarget) : void 0;
|
|
442
|
+
COMPILER_KEYED_COLLECTION_UPDATES.set(valueTarget, {
|
|
443
|
+
kind,
|
|
444
|
+
sourceToken: previousUpdate?.sourceToken || sourceToken,
|
|
445
|
+
changedKeys: [...draft.changedKeys],
|
|
446
|
+
...previousUpdate ? { previous: previousUpdate } : {}
|
|
447
|
+
});
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
22
450
|
var COMPILER_HMR_REGISTRY = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
|
|
23
451
|
function getCompilerHmrRegistry() {
|
|
24
452
|
const globalTarget = globalThis;
|
|
@@ -406,6 +834,240 @@ var UNSET_KEYED_ROW_BINDING = /* @__PURE__ */ Symbol("unset interactive keyed-ro
|
|
|
406
834
|
function keyedRowIdentity(key) {
|
|
407
835
|
return String(key);
|
|
408
836
|
}
|
|
837
|
+
function keyedIdentityTargetSnapshot(value) {
|
|
838
|
+
const kind = typeof value;
|
|
839
|
+
return value === null || value === void 0 || kind === "string" || kind === "number" || kind === "bigint" ? { eligible: true, key: String(value) } : { eligible: false };
|
|
840
|
+
}
|
|
841
|
+
var NATIVE_SET_PROTOTYPE = Set.prototype;
|
|
842
|
+
var NATIVE_SET_ADD = Set.prototype.add;
|
|
843
|
+
var NATIVE_SET_DELETE = Set.prototype.delete;
|
|
844
|
+
var NATIVE_SET_HAS = Set.prototype.has;
|
|
845
|
+
var NATIVE_SET_VALUES = Set.prototype.values;
|
|
846
|
+
var KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH = 64;
|
|
847
|
+
function materializeKeyedMembershipSnapshot(snapshot) {
|
|
848
|
+
if (!snapshot.eligible) return void 0;
|
|
849
|
+
if (snapshot.values) return new Set(snapshot.values);
|
|
850
|
+
if (!snapshot.previous || !snapshot.changes) return void 0;
|
|
851
|
+
const values = materializeKeyedMembershipSnapshot(snapshot.previous);
|
|
852
|
+
if (!values) return void 0;
|
|
853
|
+
for (const [key, present] of snapshot.changes) {
|
|
854
|
+
if (present) NATIVE_SET_ADD.call(values, key);
|
|
855
|
+
else NATIVE_SET_DELETE.call(values, key);
|
|
856
|
+
}
|
|
857
|
+
return values;
|
|
858
|
+
}
|
|
859
|
+
function keyedMembershipSnapshotHas(snapshot, key) {
|
|
860
|
+
for (let current = snapshot; current; current = current.previous) {
|
|
861
|
+
if (!current.eligible) return void 0;
|
|
862
|
+
if (current.changes?.has(key)) return current.changes.get(key);
|
|
863
|
+
if (current.values) return NATIVE_SET_HAS.call(current.values, key);
|
|
864
|
+
}
|
|
865
|
+
return void 0;
|
|
866
|
+
}
|
|
867
|
+
function keyedMembershipDeltaSnapshot(value, previous) {
|
|
868
|
+
if (!previous.eligible || !previous.sourceToken) return void 0;
|
|
869
|
+
const target = compilerObject(value);
|
|
870
|
+
if (!target) return void 0;
|
|
871
|
+
const changedKeys = compilerKeyedCollectionChangedKeys(value, previous.sourceToken, "set");
|
|
872
|
+
if (!changedKeys) return void 0;
|
|
873
|
+
if (Object.getPrototypeOf(value) !== NATIVE_SET_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "has") || value.has !== NATIVE_SET_HAS) {
|
|
874
|
+
return void 0;
|
|
875
|
+
}
|
|
876
|
+
const changes = /* @__PURE__ */ new Map();
|
|
877
|
+
const targetedKeys = /* @__PURE__ */ new Set();
|
|
878
|
+
try {
|
|
879
|
+
for (const key of changedKeys) {
|
|
880
|
+
if (!keyedIdentityTargetSnapshot(key).eligible) return void 0;
|
|
881
|
+
const present = NATIVE_SET_HAS.call(value, key);
|
|
882
|
+
const before = keyedMembershipSnapshotHas(previous, key);
|
|
883
|
+
if (before === void 0) return void 0;
|
|
884
|
+
changes.set(key, present);
|
|
885
|
+
if (before !== present) NATIVE_SET_ADD.call(targetedKeys, String(key));
|
|
886
|
+
}
|
|
887
|
+
} catch {
|
|
888
|
+
return void 0;
|
|
889
|
+
}
|
|
890
|
+
const depth = (previous.depth || 0) + 1;
|
|
891
|
+
if (depth > KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH) return void 0;
|
|
892
|
+
return {
|
|
893
|
+
eligible: true,
|
|
894
|
+
previous,
|
|
895
|
+
changes,
|
|
896
|
+
sourceToken: commitCompilerKeyedCollection(value),
|
|
897
|
+
targetedKeys,
|
|
898
|
+
depth
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
function keyedMembershipTargetSnapshot(value, previous) {
|
|
902
|
+
if (previous) {
|
|
903
|
+
const delta = keyedMembershipDeltaSnapshot(value, previous);
|
|
904
|
+
if (delta) return delta;
|
|
905
|
+
}
|
|
906
|
+
if (typeof value !== "object" || value === null) return { eligible: false };
|
|
907
|
+
let iterator;
|
|
908
|
+
try {
|
|
909
|
+
iterator = NATIVE_SET_VALUES.call(value);
|
|
910
|
+
} catch {
|
|
911
|
+
return { eligible: false };
|
|
912
|
+
}
|
|
913
|
+
if (Object.getPrototypeOf(value) !== NATIVE_SET_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "has") || value.has !== NATIVE_SET_HAS) {
|
|
914
|
+
return { eligible: false };
|
|
915
|
+
}
|
|
916
|
+
const values = /* @__PURE__ */ new Set();
|
|
917
|
+
try {
|
|
918
|
+
for (const entry of iterator) {
|
|
919
|
+
if (!keyedIdentityTargetSnapshot(entry).eligible) return { eligible: false };
|
|
920
|
+
NATIVE_SET_ADD.call(values, entry);
|
|
921
|
+
}
|
|
922
|
+
} catch {
|
|
923
|
+
return { eligible: false };
|
|
924
|
+
}
|
|
925
|
+
return {
|
|
926
|
+
eligible: true,
|
|
927
|
+
values,
|
|
928
|
+
sourceToken: commitCompilerKeyedCollection(value),
|
|
929
|
+
depth: 0
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
function keyedMembershipChangedKeys(previousSnapshot, nextSnapshot) {
|
|
933
|
+
if (nextSnapshot.targetedKeys) return new Set(nextSnapshot.targetedKeys);
|
|
934
|
+
const previous = materializeKeyedMembershipSnapshot(previousSnapshot);
|
|
935
|
+
const next = materializeKeyedMembershipSnapshot(nextSnapshot);
|
|
936
|
+
const keys = /* @__PURE__ */ new Set();
|
|
937
|
+
if (!previous || !next) return keys;
|
|
938
|
+
for (const value of previous) {
|
|
939
|
+
if (!NATIVE_SET_HAS.call(next, value)) NATIVE_SET_ADD.call(keys, String(value));
|
|
940
|
+
}
|
|
941
|
+
for (const value of next) {
|
|
942
|
+
if (!NATIVE_SET_HAS.call(previous, value)) NATIVE_SET_ADD.call(keys, String(value));
|
|
943
|
+
}
|
|
944
|
+
return keys;
|
|
945
|
+
}
|
|
946
|
+
var NATIVE_MAP_PROTOTYPE = Map.prototype;
|
|
947
|
+
var NATIVE_MAP_GET = Map.prototype.get;
|
|
948
|
+
var NATIVE_MAP_HAS = Map.prototype.has;
|
|
949
|
+
var NATIVE_MAP_SET = Map.prototype.set;
|
|
950
|
+
var NATIVE_MAP_DELETE = Map.prototype.delete;
|
|
951
|
+
var NATIVE_MAP_ENTRIES = Map.prototype.entries;
|
|
952
|
+
function isSafeKeyedMapLookupValue(value) {
|
|
953
|
+
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean";
|
|
954
|
+
}
|
|
955
|
+
function materializeKeyedMapLookupSnapshot(snapshot) {
|
|
956
|
+
if (!snapshot.eligible) return void 0;
|
|
957
|
+
if (snapshot.values) return new Map(snapshot.values);
|
|
958
|
+
if (!snapshot.previous || !snapshot.changes) return void 0;
|
|
959
|
+
const values = materializeKeyedMapLookupSnapshot(snapshot.previous);
|
|
960
|
+
if (!values) return void 0;
|
|
961
|
+
for (const [key, entry] of snapshot.changes) {
|
|
962
|
+
if (entry.present) NATIVE_MAP_SET.call(values, key, entry.value);
|
|
963
|
+
else NATIVE_MAP_DELETE.call(values, key);
|
|
964
|
+
}
|
|
965
|
+
return values;
|
|
966
|
+
}
|
|
967
|
+
function keyedMapLookupSnapshotValue(snapshot, key) {
|
|
968
|
+
for (let current = snapshot; current; current = current.previous) {
|
|
969
|
+
if (!current.eligible) return void 0;
|
|
970
|
+
const changed = current.changes?.get(key);
|
|
971
|
+
if (changed) return changed;
|
|
972
|
+
if (current.values) {
|
|
973
|
+
const present = NATIVE_MAP_HAS.call(current.values, key);
|
|
974
|
+
return {
|
|
975
|
+
present,
|
|
976
|
+
...present ? { value: NATIVE_MAP_GET.call(current.values, key) } : {}
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return void 0;
|
|
981
|
+
}
|
|
982
|
+
function keyedMapLookupDeltaSnapshot(value, previous) {
|
|
983
|
+
if (!previous.eligible || !previous.sourceToken) return void 0;
|
|
984
|
+
const target = compilerObject(value);
|
|
985
|
+
if (!target) return void 0;
|
|
986
|
+
const changedKeys = compilerKeyedCollectionChangedKeys(value, previous.sourceToken, "map");
|
|
987
|
+
if (!changedKeys) return void 0;
|
|
988
|
+
if (Object.getPrototypeOf(value) !== NATIVE_MAP_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "get") || value.get !== NATIVE_MAP_GET) {
|
|
989
|
+
return void 0;
|
|
990
|
+
}
|
|
991
|
+
const changes = /* @__PURE__ */ new Map();
|
|
992
|
+
const targetedKeys = /* @__PURE__ */ new Set();
|
|
993
|
+
try {
|
|
994
|
+
for (const key of changedKeys) {
|
|
995
|
+
if (!keyedIdentityTargetSnapshot(key).eligible) return void 0;
|
|
996
|
+
const present = NATIVE_MAP_HAS.call(value, key);
|
|
997
|
+
const entry = present ? NATIVE_MAP_GET.call(value, key) : void 0;
|
|
998
|
+
if (present && !isSafeKeyedMapLookupValue(entry)) return void 0;
|
|
999
|
+
const before = keyedMapLookupSnapshotValue(previous, key);
|
|
1000
|
+
if (!before) return void 0;
|
|
1001
|
+
changes.set(key, { present, ...present ? { value: entry } : {} });
|
|
1002
|
+
if (before.present !== present || !Object.is(before.value, entry)) {
|
|
1003
|
+
NATIVE_SET_ADD.call(targetedKeys, String(key));
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
} catch {
|
|
1007
|
+
return void 0;
|
|
1008
|
+
}
|
|
1009
|
+
const depth = (previous.depth || 0) + 1;
|
|
1010
|
+
if (depth > KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH) return void 0;
|
|
1011
|
+
return {
|
|
1012
|
+
eligible: true,
|
|
1013
|
+
previous,
|
|
1014
|
+
changes,
|
|
1015
|
+
sourceToken: commitCompilerKeyedCollection(value),
|
|
1016
|
+
targetedKeys,
|
|
1017
|
+
depth
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
function keyedMapLookupTargetSnapshot(value, previous) {
|
|
1021
|
+
if (previous) {
|
|
1022
|
+
const delta = keyedMapLookupDeltaSnapshot(value, previous);
|
|
1023
|
+
if (delta) return delta;
|
|
1024
|
+
}
|
|
1025
|
+
if (typeof value !== "object" || value === null) return { eligible: false };
|
|
1026
|
+
let iterator;
|
|
1027
|
+
try {
|
|
1028
|
+
iterator = NATIVE_MAP_ENTRIES.call(value);
|
|
1029
|
+
} catch {
|
|
1030
|
+
return { eligible: false };
|
|
1031
|
+
}
|
|
1032
|
+
if (Object.getPrototypeOf(value) !== NATIVE_MAP_PROTOTYPE || Object.prototype.hasOwnProperty.call(value, "get") || value.get !== NATIVE_MAP_GET) {
|
|
1033
|
+
return { eligible: false };
|
|
1034
|
+
}
|
|
1035
|
+
const values = /* @__PURE__ */ new Map();
|
|
1036
|
+
try {
|
|
1037
|
+
for (const [key, entry] of iterator) {
|
|
1038
|
+
if (!keyedIdentityTargetSnapshot(key).eligible || !isSafeKeyedMapLookupValue(entry)) {
|
|
1039
|
+
return { eligible: false };
|
|
1040
|
+
}
|
|
1041
|
+
NATIVE_MAP_SET.call(values, key, entry);
|
|
1042
|
+
}
|
|
1043
|
+
} catch {
|
|
1044
|
+
return { eligible: false };
|
|
1045
|
+
}
|
|
1046
|
+
return {
|
|
1047
|
+
eligible: true,
|
|
1048
|
+
values,
|
|
1049
|
+
sourceToken: commitCompilerKeyedCollection(value),
|
|
1050
|
+
depth: 0
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
function keyedMapLookupChangedKeys(previousSnapshot, nextSnapshot) {
|
|
1054
|
+
if (nextSnapshot.targetedKeys) return new Set(nextSnapshot.targetedKeys);
|
|
1055
|
+
const previous = materializeKeyedMapLookupSnapshot(previousSnapshot);
|
|
1056
|
+
const next = materializeKeyedMapLookupSnapshot(nextSnapshot);
|
|
1057
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1058
|
+
if (!previous || !next) return keys;
|
|
1059
|
+
for (const [key, value] of previous) {
|
|
1060
|
+
if (!Object.is(value, NATIVE_MAP_GET.call(next, key))) {
|
|
1061
|
+
NATIVE_SET_ADD.call(keys, String(key));
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
for (const [key, value] of next) {
|
|
1065
|
+
if (!Object.is(value, NATIVE_MAP_GET.call(previous, key))) {
|
|
1066
|
+
NATIVE_SET_ADD.call(keys, String(key));
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
return keys;
|
|
1070
|
+
}
|
|
409
1071
|
function normalizedKeyedRowBindingValue(binding, value) {
|
|
410
1072
|
return binding.kind === "text" ? renderTextValue(value) : value;
|
|
411
1073
|
}
|
|
@@ -1877,11 +2539,427 @@ function longestIncreasingSubsequencePositions(sequence) {
|
|
|
1877
2539
|
}
|
|
1878
2540
|
return positions;
|
|
1879
2541
|
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2542
|
+
var keyedUpdateRuntime = {
|
|
2543
|
+
append: reconcileCompilerKeyedArrayAppend,
|
|
2544
|
+
commit: commitCompilerKeyedCollection,
|
|
2545
|
+
reconcile: reconcileCompilerKeyedMapUpdate
|
|
2546
|
+
};
|
|
2547
|
+
var keyedFilterUpdateRuntime = {
|
|
2548
|
+
...keyedUpdateRuntime,
|
|
2549
|
+
filter: reconcileCompilerKeyedArrayFilter
|
|
2550
|
+
};
|
|
2551
|
+
var keyedPrependUpdateRuntime = {
|
|
2552
|
+
...keyedUpdateRuntime,
|
|
2553
|
+
prepend: reconcileCompilerKeyedArrayPrepend
|
|
2554
|
+
};
|
|
2555
|
+
var keyedFilterPrependUpdateRuntime = {
|
|
2556
|
+
...keyedFilterUpdateRuntime,
|
|
2557
|
+
prepend: reconcileCompilerKeyedArrayPrepend
|
|
2558
|
+
};
|
|
2559
|
+
var keyedPositionUpdateRuntime = {
|
|
2560
|
+
...keyedUpdateRuntime,
|
|
2561
|
+
position: reconcileCompilerKeyedArrayPosition
|
|
2562
|
+
};
|
|
2563
|
+
var keyedReorderUpdateRuntime = {
|
|
2564
|
+
...keyedUpdateRuntime,
|
|
2565
|
+
reorder: reconcileCompilerKeyedArrayReorder
|
|
2566
|
+
};
|
|
2567
|
+
var keyedCompleteUpdateRuntime = {
|
|
2568
|
+
...keyedFilterPrependUpdateRuntime,
|
|
2569
|
+
rollingWindow: reconcileCompilerKeyedArrayRollingWindow
|
|
2570
|
+
};
|
|
2571
|
+
var keyedEveryUpdateRuntime = {
|
|
2572
|
+
...keyedCompleteUpdateRuntime,
|
|
2573
|
+
position: reconcileCompilerKeyedArrayPosition,
|
|
2574
|
+
reorder: reconcileCompilerKeyedArrayReorder
|
|
2575
|
+
};
|
|
2576
|
+
function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
|
|
2577
|
+
const dependency = props.collectionDependency;
|
|
2578
|
+
if (dependency === void 0) return void 0;
|
|
2579
|
+
const dependencies = props.dependencies || props.structureDependencies || [];
|
|
2580
|
+
const relevantDirty = [...dirtyState].filter((index) => dependencies.includes(index));
|
|
2581
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== dependency) return void 0;
|
|
2582
|
+
const finalValue = props.items();
|
|
2583
|
+
const hintedIndices = compilerKeyedMapChangedIndices(finalValue, collectionToken);
|
|
2584
|
+
if (!hintedIndices || !Array.isArray(finalValue) || finalValue.length !== instances.size) {
|
|
2585
|
+
return void 0;
|
|
2586
|
+
}
|
|
2587
|
+
const changedIndices = [...new Set(hintedIndices)].sort((left, right) => left - right);
|
|
2588
|
+
const updates = [];
|
|
2589
|
+
try {
|
|
2590
|
+
for (const index of changedIndices) {
|
|
2591
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= finalValue.length) return void 0;
|
|
2592
|
+
const item = finalValue[index];
|
|
2593
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
2594
|
+
const instance = instances.get(key);
|
|
2595
|
+
if (!instance || instance.index !== index) return void 0;
|
|
2596
|
+
updates.push({ key, item, index, instance });
|
|
2597
|
+
}
|
|
2598
|
+
} catch {
|
|
2599
|
+
return void 0;
|
|
2600
|
+
}
|
|
2601
|
+
const conditionalChanges = [];
|
|
2602
|
+
for (const { key, item, index, instance } of updates) {
|
|
2603
|
+
if (props.hostBlocks) {
|
|
2604
|
+
const descriptor = props.create(item, index);
|
|
2605
|
+
if (!instance.scope?.update(descriptor)) {
|
|
2606
|
+
return { collectionToken, conditionalChanges: [], fallback: true };
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
applyKeyedRowBindings(props, instance, item, index);
|
|
2610
|
+
const conditionalValues = conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
|
|
2611
|
+
for (const [id, values] of conditionalValues) {
|
|
2612
|
+
if (conditionals?.changed(instance.conditionalValues.get(id), values)) {
|
|
2613
|
+
conditionalChanges.push({ key, id, item, index });
|
|
2614
|
+
}
|
|
1883
2615
|
}
|
|
2616
|
+
instance.conditionalValues = conditionalValues;
|
|
2617
|
+
instance.item = item;
|
|
2618
|
+
}
|
|
2619
|
+
return {
|
|
2620
|
+
collectionToken: commitCompilerKeyedCollection(finalValue),
|
|
2621
|
+
conditionalChanges,
|
|
2622
|
+
fallback: false
|
|
1884
2623
|
};
|
|
2624
|
+
}
|
|
2625
|
+
function reconcileCompilerKeyedArrayAppend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2626
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || props.collectionDependency === void 0) {
|
|
2627
|
+
return void 0;
|
|
2628
|
+
}
|
|
2629
|
+
const collectionDependency = props.collectionDependency;
|
|
2630
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
2631
|
+
return void 0;
|
|
2632
|
+
}
|
|
2633
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
2634
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
2635
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
2636
|
+
return void 0;
|
|
2637
|
+
}
|
|
2638
|
+
const finalValue = props.items();
|
|
2639
|
+
const startIndex = compilerKeyedArrayAppendStart(finalValue, collectionToken, instances.size);
|
|
2640
|
+
if (startIndex === void 0 || !Array.isArray(finalValue)) return void 0;
|
|
2641
|
+
const nextInstances = new Map(instances);
|
|
2642
|
+
const appended = [];
|
|
2643
|
+
try {
|
|
2644
|
+
for (let index = startIndex; index < finalValue.length; index += 1) {
|
|
2645
|
+
const item = finalValue[index];
|
|
2646
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
2647
|
+
if (nextInstances.has(key)) return void 0;
|
|
2648
|
+
const descriptor = props.create(item, index);
|
|
2649
|
+
const instance = {
|
|
2650
|
+
key,
|
|
2651
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
2652
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
2653
|
+
item,
|
|
2654
|
+
index,
|
|
2655
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2656
|
+
};
|
|
2657
|
+
appended.push(instance);
|
|
2658
|
+
nextInstances.set(key, instance);
|
|
2659
|
+
}
|
|
2660
|
+
} catch {
|
|
2661
|
+
return void 0;
|
|
2662
|
+
}
|
|
2663
|
+
if (appended.length > 0) {
|
|
2664
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
2665
|
+
for (const instance of appended) fragment.append(instance.element);
|
|
2666
|
+
root.append(fragment);
|
|
2667
|
+
}
|
|
2668
|
+
return nextInstances;
|
|
2669
|
+
}
|
|
2670
|
+
function reconcileCompilerKeyedArrayRollingWindow(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2671
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
|
|
2672
|
+
return void 0;
|
|
2673
|
+
}
|
|
2674
|
+
const collectionDependency = props.collectionDependency;
|
|
2675
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
2676
|
+
return void 0;
|
|
2677
|
+
}
|
|
2678
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
2679
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
2680
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
2681
|
+
return void 0;
|
|
2682
|
+
}
|
|
2683
|
+
const finalValue = props.items();
|
|
2684
|
+
const update = compilerKeyedArrayRollingWindow(finalValue, collectionToken, instances.size);
|
|
2685
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2686
|
+
const previousInstances = [...instances.values()];
|
|
2687
|
+
const retainedLength = update.retainedEnd - update.retainedStart;
|
|
2688
|
+
const survivors = [];
|
|
2689
|
+
try {
|
|
2690
|
+
for (let index = 0; index < retainedLength; index += 1) {
|
|
2691
|
+
const sourceIndex = update.retainedStart + index;
|
|
2692
|
+
const instance = previousInstances[sourceIndex];
|
|
2693
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, finalValue[index])) {
|
|
2694
|
+
return void 0;
|
|
2695
|
+
}
|
|
2696
|
+
survivors.push(instance);
|
|
2697
|
+
}
|
|
2698
|
+
} catch {
|
|
2699
|
+
return void 0;
|
|
2700
|
+
}
|
|
2701
|
+
const knownKeys = new Set(instances.keys());
|
|
2702
|
+
const incoming = [];
|
|
2703
|
+
try {
|
|
2704
|
+
for (let index = retainedLength; index < finalValue.length; index += 1) {
|
|
2705
|
+
const item = finalValue[index];
|
|
2706
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
2707
|
+
if (knownKeys.has(key)) return void 0;
|
|
2708
|
+
knownKeys.add(key);
|
|
2709
|
+
const descriptor = props.create(item, index);
|
|
2710
|
+
incoming.push({
|
|
2711
|
+
key,
|
|
2712
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
2713
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
2714
|
+
item,
|
|
2715
|
+
index,
|
|
2716
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
} catch {
|
|
2720
|
+
return void 0;
|
|
2721
|
+
}
|
|
2722
|
+
for (let index = 0; index < update.retainedStart; index += 1) {
|
|
2723
|
+
previousInstances[index].scope?.cleanup();
|
|
2724
|
+
previousInstances[index].element.remove();
|
|
2725
|
+
}
|
|
2726
|
+
for (let index = 0; index < survivors.length; index += 1) survivors[index].index = index;
|
|
2727
|
+
if (incoming.length > 0) {
|
|
2728
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
2729
|
+
for (const instance of incoming) fragment.append(instance.element);
|
|
2730
|
+
root.append(fragment);
|
|
2731
|
+
}
|
|
2732
|
+
const nextInstances = new Map(
|
|
2733
|
+
[...survivors, ...incoming].map((instance) => [instance.key, instance])
|
|
2734
|
+
);
|
|
2735
|
+
return nextInstances;
|
|
2736
|
+
}
|
|
2737
|
+
function reconcileCompilerKeyedArrayPosition(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2738
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.positionIndexIndependent || props.collectionDependency === void 0) {
|
|
2739
|
+
return void 0;
|
|
2740
|
+
}
|
|
2741
|
+
const collectionDependency = props.collectionDependency;
|
|
2742
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
2743
|
+
return void 0;
|
|
2744
|
+
}
|
|
2745
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
2746
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
2747
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
2748
|
+
return void 0;
|
|
2749
|
+
}
|
|
2750
|
+
const finalValue = props.items();
|
|
2751
|
+
const update = compilerKeyedArrayPosition(finalValue, collectionToken, instances.size);
|
|
2752
|
+
if (!update || !Array.isArray(finalValue)) return void 0;
|
|
2753
|
+
const previousInstances = [...instances.values()];
|
|
2754
|
+
const previous = previousInstances[update.position];
|
|
2755
|
+
let item;
|
|
2756
|
+
let key;
|
|
2757
|
+
try {
|
|
2758
|
+
item = finalValue[update.position];
|
|
2759
|
+
key = keyedRowIdentity(props.rowKey(item, update.position));
|
|
2760
|
+
} catch {
|
|
2761
|
+
return void 0;
|
|
2762
|
+
}
|
|
2763
|
+
if (update.kind === "insert") {
|
|
2764
|
+
if (instances.has(key)) return void 0;
|
|
2765
|
+
let inserted;
|
|
2766
|
+
try {
|
|
2767
|
+
const descriptor = props.create(item, update.position);
|
|
2768
|
+
inserted = {
|
|
2769
|
+
key,
|
|
2770
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
2771
|
+
values: readKeyedRowBindingValues(props, item, update.position),
|
|
2772
|
+
item,
|
|
2773
|
+
index: update.position,
|
|
2774
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2775
|
+
};
|
|
2776
|
+
} catch {
|
|
2777
|
+
return void 0;
|
|
2778
|
+
}
|
|
2779
|
+
root.insertBefore(inserted.element, previous?.element || null);
|
|
2780
|
+
previousInstances.splice(update.position, 0, inserted);
|
|
2781
|
+
for (let index = update.position + 1; index < previousInstances.length; index += 1) {
|
|
2782
|
+
previousInstances[index].index = index;
|
|
2783
|
+
}
|
|
2784
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2785
|
+
}
|
|
2786
|
+
if (!previous || previous.index !== update.position) return void 0;
|
|
2787
|
+
if (key === previous.key) {
|
|
2788
|
+
try {
|
|
2789
|
+
applyKeyedRowBindings(props, previous, item, update.position);
|
|
2790
|
+
} catch {
|
|
2791
|
+
return void 0;
|
|
2792
|
+
}
|
|
2793
|
+
previous.item = item;
|
|
2794
|
+
return instances;
|
|
2795
|
+
}
|
|
2796
|
+
if (instances.has(key)) return void 0;
|
|
2797
|
+
let replacement;
|
|
2798
|
+
try {
|
|
2799
|
+
const descriptor = props.create(item, update.position);
|
|
2800
|
+
replacement = {
|
|
2801
|
+
key,
|
|
2802
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
2803
|
+
values: readKeyedRowBindingValues(props, item, update.position),
|
|
2804
|
+
item,
|
|
2805
|
+
index: update.position,
|
|
2806
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2807
|
+
};
|
|
2808
|
+
} catch {
|
|
2809
|
+
return void 0;
|
|
2810
|
+
}
|
|
2811
|
+
previous.scope?.cleanup();
|
|
2812
|
+
previous.element.replaceWith(replacement.element);
|
|
2813
|
+
previousInstances[update.position] = replacement;
|
|
2814
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2815
|
+
}
|
|
2816
|
+
function reconcileCompilerKeyedArrayReorder(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2817
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.reorderIndexIndependent || props.collectionDependency === void 0) {
|
|
2818
|
+
return void 0;
|
|
2819
|
+
}
|
|
2820
|
+
const collectionDependency = props.collectionDependency;
|
|
2821
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
2822
|
+
return void 0;
|
|
2823
|
+
}
|
|
2824
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
2825
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
2826
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
2827
|
+
return void 0;
|
|
2828
|
+
}
|
|
2829
|
+
const finalValue = props.items();
|
|
2830
|
+
const update = compilerKeyedArrayReorder(finalValue, collectionToken, instances.size);
|
|
2831
|
+
if (!update || update.kind !== "reverse" || !Array.isArray(finalValue)) return void 0;
|
|
2832
|
+
const previousInstances = [...instances.values()];
|
|
2833
|
+
try {
|
|
2834
|
+
for (let sourceIndex = 0; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
2835
|
+
const instance = previousInstances[sourceIndex];
|
|
2836
|
+
const targetIndex = previousInstances.length - sourceIndex - 1;
|
|
2837
|
+
if (instance.index !== sourceIndex || !Object.is(instance.item, finalValue[targetIndex])) {
|
|
2838
|
+
return void 0;
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
} catch {
|
|
2842
|
+
return void 0;
|
|
2843
|
+
}
|
|
2844
|
+
const activeElement = root.ownerDocument.activeElement;
|
|
2845
|
+
const restoreFocus = Boolean(activeElement && root.contains(activeElement));
|
|
2846
|
+
let anchor = previousInstances[0]?.element || null;
|
|
2847
|
+
for (let sourceIndex = 1; sourceIndex < previousInstances.length; sourceIndex += 1) {
|
|
2848
|
+
const element = previousInstances[sourceIndex].element;
|
|
2849
|
+
root.insertBefore(element, anchor);
|
|
2850
|
+
anchor = element;
|
|
2851
|
+
}
|
|
2852
|
+
previousInstances.reverse();
|
|
2853
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
2854
|
+
previousInstances[index].index = index;
|
|
2855
|
+
}
|
|
2856
|
+
if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
2857
|
+
activeElement.focus({ preventScroll: true });
|
|
2858
|
+
}
|
|
2859
|
+
return new Map(previousInstances.map((instance) => [instance.key, instance]));
|
|
2860
|
+
}
|
|
2861
|
+
function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken, instances, root, reactOwnedRows) {
|
|
2862
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.prependIndexIndependent || props.collectionDependency === void 0) {
|
|
2863
|
+
return void 0;
|
|
2864
|
+
}
|
|
2865
|
+
const collectionDependency = props.collectionDependency;
|
|
2866
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
2867
|
+
return void 0;
|
|
2868
|
+
}
|
|
2869
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
2870
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
2871
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
2872
|
+
return void 0;
|
|
2873
|
+
}
|
|
2874
|
+
const finalValue = props.items();
|
|
2875
|
+
const prefixLength = compilerKeyedArrayPrependLength(finalValue, collectionToken, instances.size);
|
|
2876
|
+
if (prefixLength === void 0 || !Array.isArray(finalValue)) return void 0;
|
|
2877
|
+
const previousInstances = [...instances.values()];
|
|
2878
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
2879
|
+
const instance = previousInstances[index];
|
|
2880
|
+
if (instance.index !== index || !Object.is(instance.item, finalValue[prefixLength + index])) {
|
|
2881
|
+
return void 0;
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
const knownKeys = new Set(instances.keys());
|
|
2885
|
+
const prepended = [];
|
|
2886
|
+
try {
|
|
2887
|
+
for (let index = 0; index < prefixLength; index += 1) {
|
|
2888
|
+
const item = finalValue[index];
|
|
2889
|
+
const key = keyedRowIdentity(props.rowKey(item, index));
|
|
2890
|
+
if (knownKeys.has(key)) return void 0;
|
|
2891
|
+
knownKeys.add(key);
|
|
2892
|
+
const descriptor = props.create(item, index);
|
|
2893
|
+
prepended.push({
|
|
2894
|
+
key,
|
|
2895
|
+
element: createCompilerHostElement(root.ownerDocument, descriptor),
|
|
2896
|
+
values: readKeyedRowBindingValues(props, item, index),
|
|
2897
|
+
item,
|
|
2898
|
+
index,
|
|
2899
|
+
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2900
|
+
});
|
|
2901
|
+
}
|
|
2902
|
+
} catch {
|
|
2903
|
+
return void 0;
|
|
2904
|
+
}
|
|
2905
|
+
if (prepended.length > 0) {
|
|
2906
|
+
const fragment = root.ownerDocument.createDocumentFragment();
|
|
2907
|
+
for (const instance of prepended) fragment.append(instance.element);
|
|
2908
|
+
root.insertBefore(fragment, root.firstChild);
|
|
2909
|
+
}
|
|
2910
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
2911
|
+
previousInstances[index].index = prefixLength + index;
|
|
2912
|
+
}
|
|
2913
|
+
return new Map([...prepended, ...previousInstances].map((instance) => [instance.key, instance]));
|
|
2914
|
+
}
|
|
2915
|
+
function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, instances, reactOwnedRows) {
|
|
2916
|
+
if (reactOwnedRows || props.hostBlocks || (props.conditionals?.length || 0) > 0 || !props.filterIndexIndependent || props.collectionDependency === void 0) {
|
|
2917
|
+
return void 0;
|
|
2918
|
+
}
|
|
2919
|
+
const collectionDependency = props.collectionDependency;
|
|
2920
|
+
if (props.bindings.some((binding) => binding.dependencies?.includes(collectionDependency))) {
|
|
2921
|
+
return void 0;
|
|
2922
|
+
}
|
|
2923
|
+
const dependencies = props.dependencies || props.structureDependencies;
|
|
2924
|
+
const relevantDirty = (dependencies || []).filter((index) => dirtyState.has(index));
|
|
2925
|
+
if (relevantDirty.length !== 1 || relevantDirty[0] !== collectionDependency) {
|
|
2926
|
+
return void 0;
|
|
2927
|
+
}
|
|
2928
|
+
const finalValue = props.items();
|
|
2929
|
+
const survivorResult = compilerKeyedArrayFilterSurvivors(
|
|
2930
|
+
finalValue,
|
|
2931
|
+
collectionToken,
|
|
2932
|
+
instances.size
|
|
2933
|
+
);
|
|
2934
|
+
if (!survivorResult || !Array.isArray(finalValue)) return void 0;
|
|
2935
|
+
const { indices: survivorIndices, keysStable } = survivorResult;
|
|
2936
|
+
const previousInstances = [...instances.values()];
|
|
2937
|
+
const survivors = [];
|
|
2938
|
+
try {
|
|
2939
|
+
for (let index = 0; index < survivorIndices.length; index += 1) {
|
|
2940
|
+
const sourceIndex = survivorIndices[index];
|
|
2941
|
+
const instance = previousInstances[sourceIndex];
|
|
2942
|
+
const item = finalValue[index];
|
|
2943
|
+
if (!instance || instance.index !== sourceIndex || !Object.is(instance.item, item) || !keysStable && keyedRowIdentity(props.rowKey(item, index)) !== instance.key) {
|
|
2944
|
+
return void 0;
|
|
2945
|
+
}
|
|
2946
|
+
survivors.push(instance);
|
|
2947
|
+
}
|
|
2948
|
+
} catch {
|
|
2949
|
+
return void 0;
|
|
2950
|
+
}
|
|
2951
|
+
const survivorSet = new Set(survivorIndices);
|
|
2952
|
+
for (let index = 0; index < previousInstances.length; index += 1) {
|
|
2953
|
+
if (survivorSet.has(index)) continue;
|
|
2954
|
+
previousInstances[index].scope?.cleanup();
|
|
2955
|
+
previousInstances[index].element.remove();
|
|
2956
|
+
}
|
|
2957
|
+
for (let index = 0; index < survivors.length; index += 1) {
|
|
2958
|
+
survivors[index].index = index;
|
|
2959
|
+
}
|
|
2960
|
+
return new Map(survivors.map((instance) => [instance.key, instance]));
|
|
2961
|
+
}
|
|
2962
|
+
function createKeyedRowConditionalRuntime() {
|
|
1885
2963
|
class FarmKeyedRowConditional extends React.Component {
|
|
1886
2964
|
constructor() {
|
|
1887
2965
|
super(...arguments);
|
|
@@ -1923,6 +3001,22 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
1923
3001
|
}
|
|
1924
3002
|
}
|
|
1925
3003
|
FarmKeyedRowConditional.displayName = "FarmCompiledKeyedRowConditional";
|
|
3004
|
+
return {
|
|
3005
|
+
Component: FarmKeyedRowConditional,
|
|
3006
|
+
readValues: readKeyedRowConditionalValues,
|
|
3007
|
+
changed: keyedRowConditionalChanged
|
|
3008
|
+
};
|
|
3009
|
+
}
|
|
3010
|
+
function createKeyedRowHostRuntime() {
|
|
3011
|
+
const owner = {
|
|
3012
|
+
subscribe: () => () => {
|
|
3013
|
+
}
|
|
3014
|
+
};
|
|
3015
|
+
return {
|
|
3016
|
+
mount: (element, descriptor, requestFallback) => mountCompilerHostTree(owner, element, descriptor, requestFallback)
|
|
3017
|
+
};
|
|
3018
|
+
}
|
|
3019
|
+
function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
1926
3020
|
class FarmKeyedRowsBlock extends React.Component {
|
|
1927
3021
|
constructor() {
|
|
1928
3022
|
super(...arguments);
|
|
@@ -1935,6 +3029,9 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
1935
3029
|
this.propSyncQueued = false;
|
|
1936
3030
|
this.currentProps = this.props;
|
|
1937
3031
|
this.instances = /* @__PURE__ */ new Map();
|
|
3032
|
+
this.identityTargets = /* @__PURE__ */ new Map();
|
|
3033
|
+
this.membershipTargets = /* @__PURE__ */ new Map();
|
|
3034
|
+
this.mapLookupTargets = /* @__PURE__ */ new Map();
|
|
1938
3035
|
this.renderVersion = 0;
|
|
1939
3036
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
1940
3037
|
this.conditionalListeners = /* @__PURE__ */ new Map();
|
|
@@ -1995,7 +3092,9 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
1995
3092
|
this.rowConditional = (item, index, conditionalId, render) => {
|
|
1996
3093
|
if (this.state.fallback) return render(item, index);
|
|
1997
3094
|
const key = keyedRowIdentity(this.currentProps.rowKey(item, index));
|
|
1998
|
-
|
|
3095
|
+
const Conditional = options.conditionals?.Component;
|
|
3096
|
+
if (!Conditional) return render(item, index);
|
|
3097
|
+
return React.createElement(Conditional, {
|
|
1999
3098
|
key: `${key}:${conditionalId}`,
|
|
2000
3099
|
owner: this.conditionalOwner,
|
|
2001
3100
|
rowKey: key,
|
|
@@ -2007,8 +3106,123 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2007
3106
|
});
|
|
2008
3107
|
};
|
|
2009
3108
|
this.refresh = (afterCommit, dirtyState) => {
|
|
3109
|
+
if (dirtyState && options.keyedUpdates && this.mounted && this.root && !this.state.fallback) {
|
|
3110
|
+
const result = options.keyedUpdates.reconcile(
|
|
3111
|
+
this.currentProps,
|
|
3112
|
+
dirtyState,
|
|
3113
|
+
this.collectionToken,
|
|
3114
|
+
this.instances,
|
|
3115
|
+
options.conditionals
|
|
3116
|
+
);
|
|
3117
|
+
if (result) {
|
|
3118
|
+
if (result.fallback) this.activateFallback(afterCommit);
|
|
3119
|
+
else {
|
|
3120
|
+
this.collectionToken = result.collectionToken;
|
|
3121
|
+
this.notifyConditionalChanges(result.conditionalChanges, afterCommit);
|
|
3122
|
+
}
|
|
3123
|
+
return;
|
|
3124
|
+
}
|
|
3125
|
+
const appendedInstances = options.keyedUpdates.append(
|
|
3126
|
+
this.currentProps,
|
|
3127
|
+
dirtyState,
|
|
3128
|
+
this.collectionToken,
|
|
3129
|
+
this.instances,
|
|
3130
|
+
this.root,
|
|
3131
|
+
this.hasReactOwnedRows()
|
|
3132
|
+
);
|
|
3133
|
+
if (appendedInstances) {
|
|
3134
|
+
this.instances = new Map(appendedInstances);
|
|
3135
|
+
this.rebuildElementIndex(this.instances);
|
|
3136
|
+
this.commitCurrentCollection(dirtyState);
|
|
3137
|
+
afterCommit?.();
|
|
3138
|
+
return;
|
|
3139
|
+
}
|
|
3140
|
+
const positionedInstances = options.keyedUpdates.position?.(
|
|
3141
|
+
this.currentProps,
|
|
3142
|
+
dirtyState,
|
|
3143
|
+
this.collectionToken,
|
|
3144
|
+
this.instances,
|
|
3145
|
+
this.root,
|
|
3146
|
+
this.hasReactOwnedRows()
|
|
3147
|
+
);
|
|
3148
|
+
if (positionedInstances) {
|
|
3149
|
+
this.instances = new Map(positionedInstances);
|
|
3150
|
+
this.rebuildElementIndex(this.instances);
|
|
3151
|
+
const keys = [...this.instances.keys()];
|
|
3152
|
+
this.pruneEventHandlers(keys);
|
|
3153
|
+
this.pruneConditionalListeners(keys);
|
|
3154
|
+
this.commitCurrentCollection(dirtyState);
|
|
3155
|
+
afterCommit?.();
|
|
3156
|
+
return;
|
|
3157
|
+
}
|
|
3158
|
+
const reorderedInstances = options.keyedUpdates.reorder?.(
|
|
3159
|
+
this.currentProps,
|
|
3160
|
+
dirtyState,
|
|
3161
|
+
this.collectionToken,
|
|
3162
|
+
this.instances,
|
|
3163
|
+
this.root,
|
|
3164
|
+
this.hasReactOwnedRows()
|
|
3165
|
+
);
|
|
3166
|
+
if (reorderedInstances) {
|
|
3167
|
+
this.instances = new Map(reorderedInstances);
|
|
3168
|
+
this.rebuildElementIndex(this.instances);
|
|
3169
|
+
this.commitCurrentCollection(dirtyState);
|
|
3170
|
+
afterCommit?.();
|
|
3171
|
+
return;
|
|
3172
|
+
}
|
|
3173
|
+
const rollingWindowInstances = options.keyedUpdates.rollingWindow?.(
|
|
3174
|
+
this.currentProps,
|
|
3175
|
+
dirtyState,
|
|
3176
|
+
this.collectionToken,
|
|
3177
|
+
this.instances,
|
|
3178
|
+
this.root,
|
|
3179
|
+
this.hasReactOwnedRows()
|
|
3180
|
+
);
|
|
3181
|
+
if (rollingWindowInstances) {
|
|
3182
|
+
this.instances = new Map(rollingWindowInstances);
|
|
3183
|
+
this.rebuildElementIndex(this.instances);
|
|
3184
|
+
const keys = [...this.instances.keys()];
|
|
3185
|
+
this.pruneEventHandlers(keys);
|
|
3186
|
+
this.pruneConditionalListeners(keys);
|
|
3187
|
+
this.commitCurrentCollection(dirtyState);
|
|
3188
|
+
afterCommit?.();
|
|
3189
|
+
return;
|
|
3190
|
+
}
|
|
3191
|
+
const filteredInstances = options.keyedUpdates.filter?.(
|
|
3192
|
+
this.currentProps,
|
|
3193
|
+
dirtyState,
|
|
3194
|
+
this.collectionToken,
|
|
3195
|
+
this.instances,
|
|
3196
|
+
this.hasReactOwnedRows()
|
|
3197
|
+
);
|
|
3198
|
+
if (filteredInstances) {
|
|
3199
|
+
this.instances = new Map(filteredInstances);
|
|
3200
|
+
this.rebuildElementIndex(this.instances);
|
|
3201
|
+
const keys = [...this.instances.keys()];
|
|
3202
|
+
this.pruneEventHandlers(keys);
|
|
3203
|
+
this.pruneConditionalListeners(keys);
|
|
3204
|
+
this.commitCurrentCollection(dirtyState);
|
|
3205
|
+
afterCommit?.();
|
|
3206
|
+
return;
|
|
3207
|
+
}
|
|
3208
|
+
const prependedInstances = options.keyedUpdates.prepend?.(
|
|
3209
|
+
this.currentProps,
|
|
3210
|
+
dirtyState,
|
|
3211
|
+
this.collectionToken,
|
|
3212
|
+
this.instances,
|
|
3213
|
+
this.root,
|
|
3214
|
+
this.hasReactOwnedRows()
|
|
3215
|
+
);
|
|
3216
|
+
if (prependedInstances) {
|
|
3217
|
+
this.instances = new Map(prependedInstances);
|
|
3218
|
+
this.rebuildElementIndex(this.instances);
|
|
3219
|
+
this.commitCurrentCollection(dirtyState);
|
|
3220
|
+
afterCommit?.();
|
|
3221
|
+
return;
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
2010
3224
|
if (dirtyState && this.refreshDirtyBindings(dirtyState, afterCommit)) return;
|
|
2011
|
-
this.reconcile(afterCommit);
|
|
3225
|
+
this.reconcile(afterCommit, dirtyState);
|
|
2012
3226
|
};
|
|
2013
3227
|
}
|
|
2014
3228
|
readRows(props) {
|
|
@@ -2089,12 +3303,10 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2089
3303
|
}
|
|
2090
3304
|
mountRowHostScope(element, descriptor, props = this.currentProps) {
|
|
2091
3305
|
if (!props.hostBlocks) return void 0;
|
|
2092
|
-
return
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
this.requestHostScopeFallback
|
|
2097
|
-
);
|
|
3306
|
+
return options.hostBlocks?.mount(element, descriptor, this.requestHostScopeFallback) || null;
|
|
3307
|
+
}
|
|
3308
|
+
readConditionalValues(props, item, index) {
|
|
3309
|
+
return options.conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
|
|
2098
3310
|
}
|
|
2099
3311
|
pruneEventHandlers(keys) {
|
|
2100
3312
|
const active = new Set(keys);
|
|
@@ -2108,8 +3320,66 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2108
3320
|
if (!active.has(key)) this.conditionalListeners.delete(key);
|
|
2109
3321
|
}
|
|
2110
3322
|
}
|
|
3323
|
+
commitCurrentCollection(dirtyState) {
|
|
3324
|
+
this.collectionToken = options.keyedUpdates?.commit(this.currentProps.items());
|
|
3325
|
+
this.commitKeyedTargets(dirtyState);
|
|
3326
|
+
}
|
|
3327
|
+
hasSafeMembershipTargets(dirtyState) {
|
|
3328
|
+
for (const binding of this.currentProps.bindings) {
|
|
3329
|
+
const target = binding.membershipTarget;
|
|
3330
|
+
if (!target || dirtyState && !dirtyState.has(target.dependency)) continue;
|
|
3331
|
+
if (!keyedMembershipTargetSnapshot(target.read()).eligible) return false;
|
|
3332
|
+
}
|
|
3333
|
+
return true;
|
|
3334
|
+
}
|
|
3335
|
+
hasSafeMapLookupTargets(dirtyState) {
|
|
3336
|
+
for (const binding of this.currentProps.bindings) {
|
|
3337
|
+
const target = binding.mapLookupTarget;
|
|
3338
|
+
if (!target || dirtyState && !dirtyState.has(target.dependency)) continue;
|
|
3339
|
+
if (!keyedMapLookupTargetSnapshot(target.read()).eligible) return false;
|
|
3340
|
+
}
|
|
3341
|
+
return true;
|
|
3342
|
+
}
|
|
3343
|
+
commitKeyedTargets(dirtyState) {
|
|
3344
|
+
if (!dirtyState) {
|
|
3345
|
+
this.identityTargets.clear();
|
|
3346
|
+
this.membershipTargets.clear();
|
|
3347
|
+
this.mapLookupTargets.clear();
|
|
3348
|
+
}
|
|
3349
|
+
for (let bindingIndex = 0; bindingIndex < this.currentProps.bindings.length; bindingIndex += 1) {
|
|
3350
|
+
const binding = this.currentProps.bindings[bindingIndex];
|
|
3351
|
+
const identityTarget = binding.identityTarget;
|
|
3352
|
+
if (!identityTarget) {
|
|
3353
|
+
this.identityTargets.delete(bindingIndex);
|
|
3354
|
+
} else if (!dirtyState || dirtyState.has(identityTarget.dependency)) {
|
|
3355
|
+
this.identityTargets.set(
|
|
3356
|
+
bindingIndex,
|
|
3357
|
+
keyedIdentityTargetSnapshot(identityTarget.read())
|
|
3358
|
+
);
|
|
3359
|
+
}
|
|
3360
|
+
const membershipTarget = binding.membershipTarget;
|
|
3361
|
+
if (!membershipTarget) {
|
|
3362
|
+
this.membershipTargets.delete(bindingIndex);
|
|
3363
|
+
} else if (!dirtyState || dirtyState.has(membershipTarget.dependency)) {
|
|
3364
|
+
this.membershipTargets.set(
|
|
3365
|
+
bindingIndex,
|
|
3366
|
+
keyedMembershipTargetSnapshot(membershipTarget.read())
|
|
3367
|
+
);
|
|
3368
|
+
}
|
|
3369
|
+
const mapLookupTarget = binding.mapLookupTarget;
|
|
3370
|
+
if (!mapLookupTarget) {
|
|
3371
|
+
this.mapLookupTargets.delete(bindingIndex);
|
|
3372
|
+
} else if (!dirtyState || dirtyState.has(mapLookupTarget.dependency)) {
|
|
3373
|
+
this.mapLookupTargets.set(
|
|
3374
|
+
bindingIndex,
|
|
3375
|
+
keyedMapLookupTargetSnapshot(mapLookupTarget.read())
|
|
3376
|
+
);
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
2111
3380
|
adopt() {
|
|
2112
3381
|
if (!this.root) return false;
|
|
3382
|
+
if (!this.hasSafeMembershipTargets() || !this.hasSafeMapLookupTargets()) return false;
|
|
2113
3383
|
const rows = this.readRows(this.currentProps);
|
|
2114
3384
|
const elements = [...this.root.children];
|
|
2115
3385
|
if (!rows || rows.items.length !== elements.length) return false;
|
|
@@ -2135,7 +3405,7 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2135
3405
|
values: this.hasReactOwnedRows() ? this.currentProps.bindings.map(() => UNSET_KEYED_ROW_BINDING) : readKeyedRowBindingValues(this.currentProps, rows.items[index], index),
|
|
2136
3406
|
item: rows.items[index],
|
|
2137
3407
|
index,
|
|
2138
|
-
conditionalValues:
|
|
3408
|
+
conditionalValues: this.readConditionalValues(
|
|
2139
3409
|
this.currentProps,
|
|
2140
3410
|
rows.items[index],
|
|
2141
3411
|
index
|
|
@@ -2151,6 +3421,7 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2151
3421
|
this.rebuildElementIndex(instances);
|
|
2152
3422
|
this.pruneEventHandlers(rows.keys);
|
|
2153
3423
|
this.pruneConditionalListeners(rows.keys);
|
|
3424
|
+
this.commitCurrentCollection();
|
|
2154
3425
|
return true;
|
|
2155
3426
|
}
|
|
2156
3427
|
hasUnsafeFallbackKeys() {
|
|
@@ -2213,21 +3484,132 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2213
3484
|
affectedBindingIndices.push(bindingIndex);
|
|
2214
3485
|
}
|
|
2215
3486
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
bindingIndex
|
|
3487
|
+
const nextIdentityTargets = /* @__PURE__ */ new Map();
|
|
3488
|
+
const nextMembershipTargets = /* @__PURE__ */ new Map();
|
|
3489
|
+
const nextMapLookupTargets = /* @__PURE__ */ new Map();
|
|
3490
|
+
for (const bindingIndex of affectedBindingIndices) {
|
|
3491
|
+
const binding = this.currentProps.bindings[bindingIndex];
|
|
3492
|
+
if (binding.identityTarget) {
|
|
3493
|
+
nextIdentityTargets.set(
|
|
3494
|
+
bindingIndex,
|
|
3495
|
+
keyedIdentityTargetSnapshot(binding.identityTarget.read())
|
|
2224
3496
|
);
|
|
2225
3497
|
}
|
|
3498
|
+
if (binding.membershipTarget) {
|
|
3499
|
+
const snapshot = keyedMembershipTargetSnapshot(
|
|
3500
|
+
binding.membershipTarget.read(),
|
|
3501
|
+
this.membershipTargets.get(bindingIndex)
|
|
3502
|
+
);
|
|
3503
|
+
if (!snapshot.eligible) {
|
|
3504
|
+
this.activateFallback(afterCommit);
|
|
3505
|
+
return true;
|
|
3506
|
+
}
|
|
3507
|
+
nextMembershipTargets.set(bindingIndex, snapshot);
|
|
3508
|
+
}
|
|
3509
|
+
if (binding.mapLookupTarget) {
|
|
3510
|
+
const snapshot = keyedMapLookupTargetSnapshot(
|
|
3511
|
+
binding.mapLookupTarget.read(),
|
|
3512
|
+
this.mapLookupTargets.get(bindingIndex)
|
|
3513
|
+
);
|
|
3514
|
+
if (!snapshot.eligible) {
|
|
3515
|
+
this.activateFallback(afterCommit);
|
|
3516
|
+
return true;
|
|
3517
|
+
}
|
|
3518
|
+
nextMapLookupTargets.set(bindingIndex, snapshot);
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
for (const bindingIndex of affectedBindingIndices) {
|
|
3522
|
+
const binding = this.currentProps.bindings[bindingIndex];
|
|
3523
|
+
const identityTarget = binding.identityTarget;
|
|
3524
|
+
const previousIdentityTarget = this.identityTargets.get(bindingIndex);
|
|
3525
|
+
const nextIdentityTarget = nextIdentityTargets.get(bindingIndex);
|
|
3526
|
+
const canTargetIdentity = Boolean(
|
|
3527
|
+
identityTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === identityTarget.dependency && dirtyState.has(identityTarget.dependency) && previousIdentityTarget?.eligible && nextIdentityTarget?.eligible
|
|
3528
|
+
);
|
|
3529
|
+
const membershipTarget = binding.membershipTarget;
|
|
3530
|
+
const previousMembershipTarget = this.membershipTargets.get(bindingIndex);
|
|
3531
|
+
const nextMembershipTarget = nextMembershipTargets.get(bindingIndex);
|
|
3532
|
+
const canTargetMembership = Boolean(
|
|
3533
|
+
membershipTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === membershipTarget.dependency && dirtyState.has(membershipTarget.dependency) && previousMembershipTarget?.eligible && nextMembershipTarget?.eligible
|
|
3534
|
+
);
|
|
3535
|
+
const mapLookupTarget = binding.mapLookupTarget;
|
|
3536
|
+
const previousMapLookupTarget = this.mapLookupTargets.get(bindingIndex);
|
|
3537
|
+
const nextMapLookupTarget = nextMapLookupTargets.get(bindingIndex);
|
|
3538
|
+
const canTargetMapLookup = Boolean(
|
|
3539
|
+
mapLookupTarget && binding.dependencies?.length === 1 && binding.dependencies[0] === mapLookupTarget.dependency && dirtyState.has(mapLookupTarget.dependency) && previousMapLookupTarget?.eligible && nextMapLookupTarget?.eligible
|
|
3540
|
+
);
|
|
3541
|
+
if (canTargetMapLookup && previousMapLookupTarget && nextMapLookupTarget) {
|
|
3542
|
+
const keys = keyedMapLookupChangedKeys(previousMapLookupTarget, nextMapLookupTarget);
|
|
3543
|
+
for (const key of keys) {
|
|
3544
|
+
const instance = this.instances.get(key);
|
|
3545
|
+
if (instance) {
|
|
3546
|
+
applyKeyedRowBinding(
|
|
3547
|
+
this.currentProps,
|
|
3548
|
+
instance,
|
|
3549
|
+
instance.item,
|
|
3550
|
+
instance.index,
|
|
3551
|
+
bindingIndex
|
|
3552
|
+
);
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
} else if (canTargetMembership && previousMembershipTarget && nextMembershipTarget) {
|
|
3556
|
+
const keys = keyedMembershipChangedKeys(previousMembershipTarget, nextMembershipTarget);
|
|
3557
|
+
for (const key of keys) {
|
|
3558
|
+
const instance = this.instances.get(key);
|
|
3559
|
+
if (instance) {
|
|
3560
|
+
applyKeyedRowBinding(
|
|
3561
|
+
this.currentProps,
|
|
3562
|
+
instance,
|
|
3563
|
+
instance.item,
|
|
3564
|
+
instance.index,
|
|
3565
|
+
bindingIndex
|
|
3566
|
+
);
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
} else if (canTargetIdentity && previousIdentityTarget && nextIdentityTarget) {
|
|
3570
|
+
const keys = /* @__PURE__ */ new Set();
|
|
3571
|
+
if (previousIdentityTarget.key !== void 0) keys.add(previousIdentityTarget.key);
|
|
3572
|
+
if (nextIdentityTarget.key !== void 0) keys.add(nextIdentityTarget.key);
|
|
3573
|
+
for (const key of keys) {
|
|
3574
|
+
const instance = this.instances.get(key);
|
|
3575
|
+
if (instance) {
|
|
3576
|
+
applyKeyedRowBinding(
|
|
3577
|
+
this.currentProps,
|
|
3578
|
+
instance,
|
|
3579
|
+
instance.item,
|
|
3580
|
+
instance.index,
|
|
3581
|
+
bindingIndex
|
|
3582
|
+
);
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
} else {
|
|
3586
|
+
for (const instance of this.instances.values()) {
|
|
3587
|
+
applyKeyedRowBinding(
|
|
3588
|
+
this.currentProps,
|
|
3589
|
+
instance,
|
|
3590
|
+
instance.item,
|
|
3591
|
+
instance.index,
|
|
3592
|
+
bindingIndex
|
|
3593
|
+
);
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
if (nextIdentityTarget) this.identityTargets.set(bindingIndex, nextIdentityTarget);
|
|
3597
|
+
else this.identityTargets.delete(bindingIndex);
|
|
3598
|
+
if (nextMembershipTarget) {
|
|
3599
|
+
this.membershipTargets.set(bindingIndex, nextMembershipTarget);
|
|
3600
|
+
} else {
|
|
3601
|
+
this.membershipTargets.delete(bindingIndex);
|
|
3602
|
+
}
|
|
3603
|
+
if (nextMapLookupTarget) {
|
|
3604
|
+
this.mapLookupTargets.set(bindingIndex, nextMapLookupTarget);
|
|
3605
|
+
} else {
|
|
3606
|
+
this.mapLookupTargets.delete(bindingIndex);
|
|
3607
|
+
}
|
|
2226
3608
|
}
|
|
2227
3609
|
afterCommit?.();
|
|
2228
3610
|
return true;
|
|
2229
3611
|
}
|
|
2230
|
-
reconcileStableRows(rows, afterCommit) {
|
|
3612
|
+
reconcileStableRows(rows, afterCommit, dirtyState) {
|
|
2231
3613
|
if (rows.keys.length !== this.instances.size) return false;
|
|
2232
3614
|
let index = 0;
|
|
2233
3615
|
for (const key of this.instances.keys()) {
|
|
@@ -2247,24 +3629,30 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2247
3629
|
}
|
|
2248
3630
|
}
|
|
2249
3631
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
2250
|
-
const conditionalValues =
|
|
3632
|
+
const conditionalValues = this.readConditionalValues(
|
|
2251
3633
|
this.currentProps,
|
|
2252
3634
|
rows.items[index],
|
|
2253
3635
|
index
|
|
2254
3636
|
);
|
|
2255
3637
|
for (const [id, values] of conditionalValues) {
|
|
2256
|
-
if (
|
|
2257
|
-
conditionalChanges.push({
|
|
3638
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
3639
|
+
conditionalChanges.push({
|
|
3640
|
+
key,
|
|
3641
|
+
id,
|
|
3642
|
+
item: rows.items[index],
|
|
3643
|
+
index
|
|
3644
|
+
});
|
|
2258
3645
|
}
|
|
2259
3646
|
}
|
|
2260
3647
|
existing.conditionalValues = conditionalValues;
|
|
2261
3648
|
existing.item = rows.items[index];
|
|
2262
3649
|
existing.index = index;
|
|
2263
3650
|
}
|
|
3651
|
+
this.commitCurrentCollection(dirtyState);
|
|
2264
3652
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
2265
3653
|
return true;
|
|
2266
3654
|
}
|
|
2267
|
-
reconcileSingleRemoval(rows, afterCommit) {
|
|
3655
|
+
reconcileSingleRemoval(rows, afterCommit, dirtyState) {
|
|
2268
3656
|
if (this.hasReactOwnedRows() || rows.keys.length + 1 !== this.instances.size) return false;
|
|
2269
3657
|
const previousKeys = [...this.instances.keys()];
|
|
2270
3658
|
let removedIndex = 0;
|
|
@@ -2290,14 +3678,19 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2290
3678
|
}
|
|
2291
3679
|
}
|
|
2292
3680
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
2293
|
-
const conditionalValues =
|
|
3681
|
+
const conditionalValues = this.readConditionalValues(
|
|
2294
3682
|
this.currentProps,
|
|
2295
3683
|
rows.items[index],
|
|
2296
3684
|
index
|
|
2297
3685
|
);
|
|
2298
3686
|
for (const [id, values] of conditionalValues) {
|
|
2299
|
-
if (
|
|
2300
|
-
conditionalChanges.push({
|
|
3687
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
3688
|
+
conditionalChanges.push({
|
|
3689
|
+
key,
|
|
3690
|
+
id,
|
|
3691
|
+
item: rows.items[index],
|
|
3692
|
+
index
|
|
3693
|
+
});
|
|
2301
3694
|
}
|
|
2302
3695
|
}
|
|
2303
3696
|
existing.conditionalValues = conditionalValues;
|
|
@@ -2309,10 +3702,11 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2309
3702
|
this.instances.delete(removedKey);
|
|
2310
3703
|
this.eventHandlers.delete(removedKey);
|
|
2311
3704
|
this.conditionalListeners.delete(removedKey);
|
|
3705
|
+
this.commitCurrentCollection(dirtyState);
|
|
2312
3706
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
2313
3707
|
return true;
|
|
2314
3708
|
}
|
|
2315
|
-
reconcile(afterCommit) {
|
|
3709
|
+
reconcile(afterCommit, dirtyState) {
|
|
2316
3710
|
if (!this.mounted || !this.root) {
|
|
2317
3711
|
afterCommit?.();
|
|
2318
3712
|
return;
|
|
@@ -2326,6 +3720,14 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2326
3720
|
this.forceUpdate(afterCommit);
|
|
2327
3721
|
return;
|
|
2328
3722
|
}
|
|
3723
|
+
if (!this.hasSafeMembershipTargets(dirtyState)) {
|
|
3724
|
+
this.activateFallback(afterCommit);
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
3727
|
+
if (!this.hasSafeMapLookupTargets(dirtyState)) {
|
|
3728
|
+
this.activateFallback(afterCommit);
|
|
3729
|
+
return;
|
|
3730
|
+
}
|
|
2329
3731
|
const rows = this.readRows(this.currentProps);
|
|
2330
3732
|
if (!rows) {
|
|
2331
3733
|
this.activateFallback(afterCommit);
|
|
@@ -2345,11 +3747,12 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2345
3747
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
2346
3748
|
this.eventHandlers.clear();
|
|
2347
3749
|
this.conditionalListeners.clear();
|
|
3750
|
+
this.commitCurrentCollection(dirtyState);
|
|
2348
3751
|
afterCommit?.();
|
|
2349
3752
|
return;
|
|
2350
3753
|
}
|
|
2351
|
-
if (this.reconcileStableRows(rows, afterCommit)) return;
|
|
2352
|
-
if (this.reconcileSingleRemoval(rows, afterCommit)) return;
|
|
3754
|
+
if (this.reconcileStableRows(rows, afterCommit, dirtyState)) return;
|
|
3755
|
+
if (this.reconcileSingleRemoval(rows, afterCommit, dirtyState)) return;
|
|
2353
3756
|
const activeElement = this.root.ownerDocument.activeElement;
|
|
2354
3757
|
const restoreFocus = Boolean(activeElement && this.root.contains(activeElement));
|
|
2355
3758
|
const nextKeys = new Set(rows.keys);
|
|
@@ -2380,14 +3783,19 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2380
3783
|
}
|
|
2381
3784
|
}
|
|
2382
3785
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
2383
|
-
const conditionalValues =
|
|
3786
|
+
const conditionalValues = this.readConditionalValues(
|
|
2384
3787
|
this.currentProps,
|
|
2385
3788
|
rows.items[index],
|
|
2386
3789
|
index
|
|
2387
3790
|
);
|
|
2388
3791
|
for (const [id, values] of conditionalValues) {
|
|
2389
|
-
if (
|
|
2390
|
-
conditionalChanges.push({
|
|
3792
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
3793
|
+
conditionalChanges.push({
|
|
3794
|
+
key,
|
|
3795
|
+
id,
|
|
3796
|
+
item: rows.items[index],
|
|
3797
|
+
index
|
|
3798
|
+
});
|
|
2391
3799
|
}
|
|
2392
3800
|
}
|
|
2393
3801
|
existing.conditionalValues = conditionalValues;
|
|
@@ -2413,7 +3821,7 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2413
3821
|
values: readKeyedRowBindingValues(this.currentProps, rows.items[index], index),
|
|
2414
3822
|
item: rows.items[index],
|
|
2415
3823
|
index,
|
|
2416
|
-
conditionalValues:
|
|
3824
|
+
conditionalValues: this.readConditionalValues(
|
|
2417
3825
|
this.currentProps,
|
|
2418
3826
|
rows.items[index],
|
|
2419
3827
|
index
|
|
@@ -2453,6 +3861,7 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2453
3861
|
if (restoreFocus && activeElement?.isConnected && activeElement.ownerDocument.activeElement !== activeElement && "focus" in activeElement) {
|
|
2454
3862
|
activeElement.focus({ preventScroll: true });
|
|
2455
3863
|
}
|
|
3864
|
+
this.commitCurrentCollection(dirtyState);
|
|
2456
3865
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
2457
3866
|
}
|
|
2458
3867
|
schedulePropSync() {
|
|
@@ -2492,6 +3901,9 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2492
3901
|
this.root = null;
|
|
2493
3902
|
this.cleanupHostScopes();
|
|
2494
3903
|
this.instances.clear();
|
|
3904
|
+
this.identityTargets.clear();
|
|
3905
|
+
this.membershipTargets.clear();
|
|
3906
|
+
this.mapLookupTargets.clear();
|
|
2495
3907
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
2496
3908
|
this.eventHandlers.clear();
|
|
2497
3909
|
this.conditionalListeners.clear();
|
|
@@ -2892,19 +4304,383 @@ function createComponentBlockComponent(owner) {
|
|
|
2892
4304
|
FarmComponentBlock.displayName = "FarmCompiledComponentIsland";
|
|
2893
4305
|
return FarmComponentBlock;
|
|
2894
4306
|
}
|
|
2895
|
-
|
|
4307
|
+
var conditionalRuntimeFeature = {
|
|
4308
|
+
name: "conditional",
|
|
4309
|
+
create: (owner) => ({
|
|
4310
|
+
Conditional: createConditionalBlockComponent(owner)
|
|
4311
|
+
})
|
|
4312
|
+
};
|
|
4313
|
+
var hostConditionalRuntimeFeature = {
|
|
4314
|
+
name: "host-conditional",
|
|
4315
|
+
create: (owner) => ({
|
|
4316
|
+
HostConditional: createHostConditionalBlockComponent(owner)
|
|
4317
|
+
})
|
|
4318
|
+
};
|
|
4319
|
+
var conditionalRangesRuntimeFeature = {
|
|
4320
|
+
name: "conditional-ranges",
|
|
4321
|
+
create: (owner) => ({
|
|
4322
|
+
ConditionalRanges: createConditionalRangesBlockComponent(owner)
|
|
4323
|
+
})
|
|
4324
|
+
};
|
|
4325
|
+
var keyedListRuntimeFeature = {
|
|
4326
|
+
name: "keyed-list",
|
|
4327
|
+
create: (owner) => ({
|
|
4328
|
+
KeyedList: createKeyedListBlockComponent(owner)
|
|
4329
|
+
})
|
|
4330
|
+
};
|
|
4331
|
+
var keyedRowsRuntimeFeature = {
|
|
4332
|
+
name: "keyed-rows",
|
|
4333
|
+
create: (owner) => ({
|
|
4334
|
+
KeyedRows: createKeyedRowsBlockComponent(owner)
|
|
4335
|
+
})
|
|
4336
|
+
};
|
|
4337
|
+
var keyedRowsHintedRuntimeFeature = {
|
|
4338
|
+
name: "keyed-rows:hinted",
|
|
4339
|
+
create: (owner) => ({
|
|
4340
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4341
|
+
keyedUpdates: keyedUpdateRuntime
|
|
4342
|
+
})
|
|
4343
|
+
})
|
|
4344
|
+
};
|
|
4345
|
+
var keyedRowsPositionHintedRuntimeFeature = {
|
|
4346
|
+
name: "keyed-rows:position-hinted",
|
|
4347
|
+
create: (owner) => ({
|
|
4348
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4349
|
+
keyedUpdates: keyedPositionUpdateRuntime
|
|
4350
|
+
})
|
|
4351
|
+
})
|
|
4352
|
+
};
|
|
4353
|
+
var keyedRowsReorderHintedRuntimeFeature = {
|
|
4354
|
+
name: "keyed-rows:reorder-hinted",
|
|
4355
|
+
create: (owner) => ({
|
|
4356
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4357
|
+
keyedUpdates: keyedReorderUpdateRuntime
|
|
4358
|
+
})
|
|
4359
|
+
})
|
|
4360
|
+
};
|
|
4361
|
+
var keyedRowsAllHintedRuntimeFeature = {
|
|
4362
|
+
name: "keyed-rows:all-hinted",
|
|
4363
|
+
create: (owner) => ({
|
|
4364
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4365
|
+
keyedUpdates: keyedCompleteUpdateRuntime
|
|
4366
|
+
})
|
|
4367
|
+
})
|
|
4368
|
+
};
|
|
4369
|
+
var keyedRowsEveryHintedRuntimeFeature = {
|
|
4370
|
+
name: "keyed-rows:every-hinted",
|
|
4371
|
+
create: (owner) => ({
|
|
4372
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4373
|
+
keyedUpdates: keyedEveryUpdateRuntime
|
|
4374
|
+
})
|
|
4375
|
+
})
|
|
4376
|
+
};
|
|
4377
|
+
var keyedRowsFilterHintedRuntimeFeature = {
|
|
4378
|
+
name: "keyed-rows:filter-hinted",
|
|
4379
|
+
create: (owner) => ({
|
|
4380
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4381
|
+
keyedUpdates: keyedFilterUpdateRuntime
|
|
4382
|
+
})
|
|
4383
|
+
})
|
|
4384
|
+
};
|
|
4385
|
+
var keyedRowsPrependHintedRuntimeFeature = {
|
|
4386
|
+
name: "keyed-rows:prepend-hinted",
|
|
4387
|
+
create: (owner) => ({
|
|
4388
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4389
|
+
keyedUpdates: keyedPrependUpdateRuntime
|
|
4390
|
+
})
|
|
4391
|
+
})
|
|
4392
|
+
};
|
|
4393
|
+
var keyedRowsFilterPrependHintedRuntimeFeature = {
|
|
4394
|
+
name: "keyed-rows:filter-prepend-hinted",
|
|
4395
|
+
create: (owner) => ({
|
|
4396
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4397
|
+
keyedUpdates: keyedFilterPrependUpdateRuntime
|
|
4398
|
+
})
|
|
4399
|
+
})
|
|
4400
|
+
};
|
|
4401
|
+
var keyedRowsConditionalRuntimeFeature = {
|
|
4402
|
+
name: "keyed-rows:conditional",
|
|
4403
|
+
create: (owner) => ({
|
|
4404
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4405
|
+
conditionals: createKeyedRowConditionalRuntime()
|
|
4406
|
+
})
|
|
4407
|
+
})
|
|
4408
|
+
};
|
|
4409
|
+
var keyedRowsConditionalHintedRuntimeFeature = {
|
|
4410
|
+
name: "keyed-rows:conditional:hinted",
|
|
4411
|
+
create: (owner) => ({
|
|
4412
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4413
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4414
|
+
keyedUpdates: keyedUpdateRuntime
|
|
4415
|
+
})
|
|
4416
|
+
})
|
|
4417
|
+
};
|
|
4418
|
+
var keyedRowsConditionalPositionHintedRuntimeFeature = {
|
|
4419
|
+
name: "keyed-rows:conditional:position-hinted",
|
|
4420
|
+
create: (owner) => ({
|
|
4421
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4422
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4423
|
+
keyedUpdates: keyedPositionUpdateRuntime
|
|
4424
|
+
})
|
|
4425
|
+
})
|
|
4426
|
+
};
|
|
4427
|
+
var keyedRowsConditionalReorderHintedRuntimeFeature = {
|
|
4428
|
+
name: "keyed-rows:conditional:reorder-hinted",
|
|
4429
|
+
create: (owner) => ({
|
|
4430
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4431
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4432
|
+
keyedUpdates: keyedReorderUpdateRuntime
|
|
4433
|
+
})
|
|
4434
|
+
})
|
|
4435
|
+
};
|
|
4436
|
+
var keyedRowsConditionalAllHintedRuntimeFeature = {
|
|
4437
|
+
name: "keyed-rows:conditional:all-hinted",
|
|
4438
|
+
create: (owner) => ({
|
|
4439
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4440
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4441
|
+
keyedUpdates: keyedCompleteUpdateRuntime
|
|
4442
|
+
})
|
|
4443
|
+
})
|
|
4444
|
+
};
|
|
4445
|
+
var keyedRowsConditionalEveryHintedRuntimeFeature = {
|
|
4446
|
+
name: "keyed-rows:conditional:every-hinted",
|
|
4447
|
+
create: (owner) => ({
|
|
4448
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4449
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4450
|
+
keyedUpdates: keyedEveryUpdateRuntime
|
|
4451
|
+
})
|
|
4452
|
+
})
|
|
4453
|
+
};
|
|
4454
|
+
var keyedRowsConditionalFilterHintedRuntimeFeature = {
|
|
4455
|
+
name: "keyed-rows:conditional:filter-hinted",
|
|
4456
|
+
create: (owner) => ({
|
|
4457
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4458
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4459
|
+
keyedUpdates: keyedFilterUpdateRuntime
|
|
4460
|
+
})
|
|
4461
|
+
})
|
|
4462
|
+
};
|
|
4463
|
+
var keyedRowsConditionalPrependHintedRuntimeFeature = {
|
|
4464
|
+
name: "keyed-rows:conditional:prepend-hinted",
|
|
4465
|
+
create: (owner) => ({
|
|
4466
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4467
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4468
|
+
keyedUpdates: keyedPrependUpdateRuntime
|
|
4469
|
+
})
|
|
4470
|
+
})
|
|
4471
|
+
};
|
|
4472
|
+
var keyedRowsConditionalFilterPrependHintedRuntimeFeature = {
|
|
4473
|
+
name: "keyed-rows:conditional:filter-prepend-hinted",
|
|
4474
|
+
create: (owner) => ({
|
|
4475
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4476
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4477
|
+
keyedUpdates: keyedFilterPrependUpdateRuntime
|
|
4478
|
+
})
|
|
4479
|
+
})
|
|
4480
|
+
};
|
|
4481
|
+
var keyedRowsHostRuntimeFeature = {
|
|
4482
|
+
name: "keyed-rows:host",
|
|
4483
|
+
create: (owner) => ({
|
|
4484
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4485
|
+
hostBlocks: createKeyedRowHostRuntime()
|
|
4486
|
+
})
|
|
4487
|
+
})
|
|
4488
|
+
};
|
|
4489
|
+
var keyedRowsHostHintedRuntimeFeature = {
|
|
4490
|
+
name: "keyed-rows:host:hinted",
|
|
4491
|
+
create: (owner) => ({
|
|
4492
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4493
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4494
|
+
keyedUpdates: keyedUpdateRuntime
|
|
4495
|
+
})
|
|
4496
|
+
})
|
|
4497
|
+
};
|
|
4498
|
+
var keyedRowsHostPositionHintedRuntimeFeature = {
|
|
4499
|
+
name: "keyed-rows:host:position-hinted",
|
|
4500
|
+
create: (owner) => ({
|
|
4501
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4502
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4503
|
+
keyedUpdates: keyedPositionUpdateRuntime
|
|
4504
|
+
})
|
|
4505
|
+
})
|
|
4506
|
+
};
|
|
4507
|
+
var keyedRowsHostReorderHintedRuntimeFeature = {
|
|
4508
|
+
name: "keyed-rows:host:reorder-hinted",
|
|
4509
|
+
create: (owner) => ({
|
|
4510
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4511
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4512
|
+
keyedUpdates: keyedReorderUpdateRuntime
|
|
4513
|
+
})
|
|
4514
|
+
})
|
|
4515
|
+
};
|
|
4516
|
+
var keyedRowsHostAllHintedRuntimeFeature = {
|
|
4517
|
+
name: "keyed-rows:host:all-hinted",
|
|
4518
|
+
create: (owner) => ({
|
|
4519
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4520
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4521
|
+
keyedUpdates: keyedCompleteUpdateRuntime
|
|
4522
|
+
})
|
|
4523
|
+
})
|
|
4524
|
+
};
|
|
4525
|
+
var keyedRowsHostEveryHintedRuntimeFeature = {
|
|
4526
|
+
name: "keyed-rows:host:every-hinted",
|
|
4527
|
+
create: (owner) => ({
|
|
4528
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4529
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4530
|
+
keyedUpdates: keyedEveryUpdateRuntime
|
|
4531
|
+
})
|
|
4532
|
+
})
|
|
4533
|
+
};
|
|
4534
|
+
var keyedRowsHostFilterHintedRuntimeFeature = {
|
|
4535
|
+
name: "keyed-rows:host:filter-hinted",
|
|
4536
|
+
create: (owner) => ({
|
|
4537
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4538
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4539
|
+
keyedUpdates: keyedFilterUpdateRuntime
|
|
4540
|
+
})
|
|
4541
|
+
})
|
|
4542
|
+
};
|
|
4543
|
+
var keyedRowsHostPrependHintedRuntimeFeature = {
|
|
4544
|
+
name: "keyed-rows:host:prepend-hinted",
|
|
4545
|
+
create: (owner) => ({
|
|
4546
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4547
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4548
|
+
keyedUpdates: keyedPrependUpdateRuntime
|
|
4549
|
+
})
|
|
4550
|
+
})
|
|
4551
|
+
};
|
|
4552
|
+
var keyedRowsHostFilterPrependHintedRuntimeFeature = {
|
|
4553
|
+
name: "keyed-rows:host:filter-prepend-hinted",
|
|
4554
|
+
create: (owner) => ({
|
|
4555
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4556
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4557
|
+
keyedUpdates: keyedFilterPrependUpdateRuntime
|
|
4558
|
+
})
|
|
4559
|
+
})
|
|
4560
|
+
};
|
|
4561
|
+
var keyedRowsCompleteRuntimeFeature = {
|
|
4562
|
+
name: "keyed-rows:complete",
|
|
4563
|
+
create: (owner) => ({
|
|
4564
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4565
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4566
|
+
hostBlocks: createKeyedRowHostRuntime()
|
|
4567
|
+
})
|
|
4568
|
+
})
|
|
4569
|
+
};
|
|
4570
|
+
var keyedRowsCompleteHintedRuntimeFeature = {
|
|
4571
|
+
name: "keyed-rows:complete:hinted",
|
|
4572
|
+
create: (owner) => ({
|
|
4573
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4574
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4575
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4576
|
+
keyedUpdates: keyedUpdateRuntime
|
|
4577
|
+
})
|
|
4578
|
+
})
|
|
4579
|
+
};
|
|
4580
|
+
var keyedRowsCompletePositionHintedRuntimeFeature = {
|
|
4581
|
+
name: "keyed-rows:complete:position-hinted",
|
|
4582
|
+
create: (owner) => ({
|
|
4583
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4584
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4585
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4586
|
+
keyedUpdates: keyedPositionUpdateRuntime
|
|
4587
|
+
})
|
|
4588
|
+
})
|
|
4589
|
+
};
|
|
4590
|
+
var keyedRowsCompleteReorderHintedRuntimeFeature = {
|
|
4591
|
+
name: "keyed-rows:complete:reorder-hinted",
|
|
4592
|
+
create: (owner) => ({
|
|
4593
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4594
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4595
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4596
|
+
keyedUpdates: keyedReorderUpdateRuntime
|
|
4597
|
+
})
|
|
4598
|
+
})
|
|
4599
|
+
};
|
|
4600
|
+
var keyedRowsCompleteAllHintedRuntimeFeature = {
|
|
4601
|
+
name: "keyed-rows:complete:all-hinted",
|
|
4602
|
+
create: (owner) => ({
|
|
4603
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4604
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4605
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4606
|
+
keyedUpdates: keyedCompleteUpdateRuntime
|
|
4607
|
+
})
|
|
4608
|
+
})
|
|
4609
|
+
};
|
|
4610
|
+
var keyedRowsCompleteEveryHintedRuntimeFeature = {
|
|
4611
|
+
name: "keyed-rows:complete:every-hinted",
|
|
4612
|
+
create: (owner) => ({
|
|
4613
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4614
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4615
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4616
|
+
keyedUpdates: keyedEveryUpdateRuntime
|
|
4617
|
+
})
|
|
4618
|
+
})
|
|
4619
|
+
};
|
|
4620
|
+
var keyedRowsCompleteFilterHintedRuntimeFeature = {
|
|
4621
|
+
name: "keyed-rows:complete:filter-hinted",
|
|
4622
|
+
create: (owner) => ({
|
|
4623
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4624
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4625
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4626
|
+
keyedUpdates: keyedFilterUpdateRuntime
|
|
4627
|
+
})
|
|
4628
|
+
})
|
|
4629
|
+
};
|
|
4630
|
+
var keyedRowsCompletePrependHintedRuntimeFeature = {
|
|
4631
|
+
name: "keyed-rows:complete:prepend-hinted",
|
|
4632
|
+
create: (owner) => ({
|
|
4633
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4634
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4635
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4636
|
+
keyedUpdates: keyedPrependUpdateRuntime
|
|
4637
|
+
})
|
|
4638
|
+
})
|
|
4639
|
+
};
|
|
4640
|
+
var keyedRowsCompleteFilterPrependHintedRuntimeFeature = {
|
|
4641
|
+
name: "keyed-rows:complete:filter-prepend-hinted",
|
|
4642
|
+
create: (owner) => ({
|
|
4643
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
4644
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
4645
|
+
hostBlocks: createKeyedRowHostRuntime(),
|
|
4646
|
+
keyedUpdates: keyedFilterPrependUpdateRuntime
|
|
4647
|
+
})
|
|
4648
|
+
})
|
|
4649
|
+
};
|
|
4650
|
+
var keyedRangesRuntimeFeature = {
|
|
4651
|
+
name: "keyed-ranges",
|
|
4652
|
+
create: (owner) => ({
|
|
4653
|
+
KeyedRanges: createKeyedRangesBlockComponent(owner)
|
|
4654
|
+
})
|
|
4655
|
+
};
|
|
4656
|
+
var mixedRangesRuntimeFeature = {
|
|
4657
|
+
name: "mixed-ranges",
|
|
4658
|
+
create: (owner) => ({
|
|
4659
|
+
MixedRanges: createMixedRangesBlockComponent(owner)
|
|
4660
|
+
})
|
|
4661
|
+
};
|
|
4662
|
+
var componentRuntimeFeature = {
|
|
4663
|
+
name: "component",
|
|
4664
|
+
create: (owner) => ({
|
|
4665
|
+
Component: createComponentBlockComponent(owner)
|
|
4666
|
+
})
|
|
4667
|
+
};
|
|
4668
|
+
function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
2896
4669
|
const stateSignature = definition.stateSignature || String(definition.initialize.length);
|
|
4670
|
+
const runtimeSignature = [...new Set(runtimeFeatures.map((feature) => feature.name))].sort().join(",");
|
|
2897
4671
|
if (definition.hmrId) {
|
|
2898
4672
|
const registry = getCompilerHmrRegistry();
|
|
2899
4673
|
const existing = registry.get(definition.hmrId);
|
|
2900
|
-
if (existing?.stateSignature === stateSignature) {
|
|
4674
|
+
if (existing?.stateSignature === stateSignature && existing.runtimeSignature === runtimeSignature) {
|
|
2901
4675
|
existing.definition.current = definition;
|
|
2902
4676
|
existing.component.displayName = `FarmCompiled(${definition.displayName})`;
|
|
2903
4677
|
for (const refresh of existing.refreshListeners) refresh();
|
|
2904
4678
|
return existing.component;
|
|
2905
4679
|
}
|
|
2906
4680
|
}
|
|
2907
|
-
const definitionReference = {
|
|
4681
|
+
const definitionReference = {
|
|
4682
|
+
current: definition
|
|
4683
|
+
};
|
|
2908
4684
|
const refreshListeners = /* @__PURE__ */ new Set();
|
|
2909
4685
|
class FarmCompiledComponent extends React.Component {
|
|
2910
4686
|
constructor(props) {
|
|
@@ -2971,34 +4747,17 @@ function createCompiledComponent(definition) {
|
|
|
2971
4747
|
}
|
|
2972
4748
|
};
|
|
2973
4749
|
});
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
HostConditional: createHostConditionalBlockComponent({
|
|
2980
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2981
|
-
}),
|
|
2982
|
-
ConditionalRanges: createConditionalRangesBlockComponent({
|
|
2983
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2984
|
-
}),
|
|
2985
|
-
KeyedList: createKeyedListBlockComponent({
|
|
2986
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2987
|
-
}),
|
|
2988
|
-
KeyedRows: createKeyedRowsBlockComponent({
|
|
2989
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2990
|
-
}),
|
|
2991
|
-
KeyedRanges: createKeyedRangesBlockComponent({
|
|
2992
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2993
|
-
}),
|
|
2994
|
-
MixedRanges: createMixedRangesBlockComponent({
|
|
2995
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2996
|
-
}),
|
|
2997
|
-
Component: createComponentBlockComponent({
|
|
2998
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2999
|
-
}),
|
|
4750
|
+
const featureOwner = {
|
|
4751
|
+
setRoot: (id, root) => this.setBlockRoot(id, root),
|
|
4752
|
+
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
4753
|
+
};
|
|
4754
|
+
const blockRuntime = {
|
|
3000
4755
|
target: (id) => this.bindingTarget(id)
|
|
3001
4756
|
};
|
|
4757
|
+
for (const feature of runtimeFeatures) {
|
|
4758
|
+
Object.assign(blockRuntime, feature.create(featureOwner));
|
|
4759
|
+
}
|
|
4760
|
+
this.blockRuntime = blockRuntime;
|
|
3002
4761
|
}
|
|
3003
4762
|
usesHybridReactivity() {
|
|
3004
4763
|
return definitionReference.current.reactivity === "hybrid";
|
|
@@ -3349,12 +5108,26 @@ function createCompiledComponent(definition) {
|
|
|
3349
5108
|
component,
|
|
3350
5109
|
definition: definitionReference,
|
|
3351
5110
|
refreshListeners,
|
|
3352
|
-
stateSignature
|
|
5111
|
+
stateSignature,
|
|
5112
|
+
runtimeSignature
|
|
3353
5113
|
});
|
|
3354
5114
|
}
|
|
3355
5115
|
return component;
|
|
3356
5116
|
}
|
|
5117
|
+
var COMPLETE_RUNTIME_FEATURES = [
|
|
5118
|
+
conditionalRuntimeFeature,
|
|
5119
|
+
hostConditionalRuntimeFeature,
|
|
5120
|
+
conditionalRangesRuntimeFeature,
|
|
5121
|
+
keyedListRuntimeFeature,
|
|
5122
|
+
keyedRowsCompleteEveryHintedRuntimeFeature,
|
|
5123
|
+
keyedRangesRuntimeFeature,
|
|
5124
|
+
mixedRangesRuntimeFeature,
|
|
5125
|
+
componentRuntimeFeature
|
|
5126
|
+
];
|
|
5127
|
+
function createCompiledComponent(definition) {
|
|
5128
|
+
return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
|
|
5129
|
+
}
|
|
3357
5130
|
|
|
3358
|
-
export { createCompiledComponent };
|
|
5131
|
+
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayFilter, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArraySlice, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
3359
5132
|
//# sourceMappingURL=compiler-runtime.mjs.map
|
|
3360
5133
|
//# sourceMappingURL=compiler-runtime.mjs.map
|