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