@fictjs/runtime 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.cjs +10 -8
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.d.cts +4 -3
- package/dist/advanced.d.ts +4 -3
- package/dist/advanced.js +10 -8
- package/dist/advanced.js.map +1 -1
- package/dist/{chunk-L4DIV3RC.cjs → chunk-4ZPZM5IG.cjs} +9 -7
- package/dist/chunk-4ZPZM5IG.cjs.map +1 -0
- package/dist/{chunk-XLIZJMMJ.js → chunk-5OYBRKE4.js} +8 -6
- package/dist/{chunk-XLIZJMMJ.js.map → chunk-5OYBRKE4.js.map} +1 -1
- package/dist/chunk-6RCEIWZL.cjs +2380 -0
- package/dist/chunk-6RCEIWZL.cjs.map +1 -0
- package/dist/chunk-7BO6P2KP.js +2380 -0
- package/dist/chunk-7BO6P2KP.js.map +1 -0
- package/dist/{chunk-TWELIZRY.js → chunk-AR6NSCZM.js} +5 -3
- package/dist/{chunk-TWELIZRY.js.map → chunk-AR6NSCZM.js.map} +1 -1
- package/dist/{chunk-M2TSXZ4C.cjs → chunk-LFMXNQZC.cjs} +18 -16
- package/dist/chunk-LFMXNQZC.cjs.map +1 -0
- package/dist/{chunk-SO6X7G5S.js → chunk-RY5CY4CI.js} +501 -1880
- package/dist/chunk-RY5CY4CI.js.map +1 -0
- package/dist/chunk-WJHXPF7M.cjs +2259 -0
- package/dist/chunk-WJHXPF7M.cjs.map +1 -0
- package/dist/{context-B25xyQrJ.d.cts → context-CTBE00S_.d.cts} +1 -1
- package/dist/{context-CGdP7_Jb.d.ts → context-lkLhbkFJ.d.ts} +1 -1
- package/dist/{effect-D6kaLM2-.d.cts → effect-BpSNEJJz.d.cts} +7 -67
- package/dist/{effect-D6kaLM2-.d.ts → effect-BpSNEJJz.d.ts} +7 -67
- package/dist/index.cjs +40 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.dev.js +125 -22
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +202 -203
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +13 -23
- package/dist/internal.d.ts +13 -23
- package/dist/internal.js +207 -208
- package/dist/internal.js.map +1 -1
- package/dist/loader.cjs +280 -0
- package/dist/loader.cjs.map +1 -0
- package/dist/loader.d.cts +57 -0
- package/dist/loader.d.ts +57 -0
- package/dist/loader.js +280 -0
- package/dist/loader.js.map +1 -0
- package/dist/{props-BIfromL0.d.cts → props-XTHYD19o.d.cts} +13 -2
- package/dist/{props-BEgIVMRx.d.ts → props-x-HbI-jX.d.ts} +13 -2
- package/dist/resume-BrAkmSTY.d.cts +79 -0
- package/dist/resume-Dx8_l72o.d.ts +79 -0
- package/dist/{scope-CzNkn587.d.ts → scope-CdbGmsFf.d.ts} +1 -1
- package/dist/{scope-Cx_3CjIZ.d.cts → scope-DfcP9I-A.d.cts} +1 -1
- package/dist/signal-C4ISF17w.d.cts +66 -0
- package/dist/signal-C4ISF17w.d.ts +66 -0
- package/package.json +6 -1
- package/src/binding.ts +254 -5
- package/src/cycle-guard.ts +1 -1
- package/src/dom.ts +103 -5
- package/src/hooks.ts +15 -2
- package/src/hydration.ts +75 -0
- package/src/internal.ts +34 -2
- package/src/list-helpers.ts +127 -11
- package/src/loader.ts +437 -0
- package/src/node-ops.ts +65 -0
- package/src/resume.ts +517 -0
- package/src/signal.ts +47 -22
- package/src/store.ts +8 -0
- package/dist/chunk-ID3WBWNO.cjs +0 -3638
- package/dist/chunk-ID3WBWNO.cjs.map +0 -1
- package/dist/chunk-L4DIV3RC.cjs.map +0 -1
- package/dist/chunk-M2TSXZ4C.cjs.map +0 -1
- package/dist/chunk-SO6X7G5S.js.map +0 -1
package/dist/internal.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk4ZPZM5IGcjs = require('./chunk-4ZPZM5IG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -34,6 +34,34 @@ var _chunkL4DIV3RCcjs = require('./chunk-L4DIV3RC.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var _chunkWJHXPF7Mcjs = require('./chunk-WJHXPF7M.cjs');
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
37
65
|
|
|
38
66
|
|
|
39
67
|
|
|
@@ -68,163 +96,13 @@ var _chunkL4DIV3RCcjs = require('./chunk-L4DIV3RC.cjs');
|
|
|
68
96
|
|
|
69
97
|
|
|
70
98
|
|
|
71
|
-
var _chunkID3WBWNOcjs = require('./chunk-ID3WBWNO.cjs');
|
|
72
99
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const wrapped = wrap(unwrapped);
|
|
80
|
-
function setStore(fn) {
|
|
81
|
-
_chunkID3WBWNOcjs.batch.call(void 0, () => {
|
|
82
|
-
const result = fn(wrapped);
|
|
83
|
-
if (result !== void 0) {
|
|
84
|
-
reconcile(wrapped, result);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return [wrapped, setStore];
|
|
89
|
-
}
|
|
90
|
-
var proxyCache = /* @__PURE__ */ new WeakMap();
|
|
91
|
-
var signalCache = /* @__PURE__ */ new WeakMap();
|
|
92
|
-
function wrap(value) {
|
|
93
|
-
if (value === null || typeof value !== "object") return value;
|
|
94
|
-
if (Reflect.get(value, PROXY)) return value;
|
|
95
|
-
if (proxyCache.has(value)) return proxyCache.get(value);
|
|
96
|
-
const handler = {
|
|
97
|
-
get(target, prop2, receiver) {
|
|
98
|
-
if (prop2 === PROXY) return true;
|
|
99
|
-
if (prop2 === TARGET) return target;
|
|
100
|
-
const value2 = Reflect.get(target, prop2, receiver);
|
|
101
|
-
track(target, prop2);
|
|
102
|
-
return wrap(value2);
|
|
103
|
-
},
|
|
104
|
-
has(target, prop2) {
|
|
105
|
-
const result = Reflect.has(target, prop2);
|
|
106
|
-
track(target, prop2);
|
|
107
|
-
return result;
|
|
108
|
-
},
|
|
109
|
-
ownKeys(target) {
|
|
110
|
-
track(target, ITERATE_KEY);
|
|
111
|
-
return Reflect.ownKeys(target);
|
|
112
|
-
},
|
|
113
|
-
getOwnPropertyDescriptor(target, prop2) {
|
|
114
|
-
track(target, prop2);
|
|
115
|
-
return Reflect.getOwnPropertyDescriptor(target, prop2);
|
|
116
|
-
},
|
|
117
|
-
set(target, prop2, value2, receiver) {
|
|
118
|
-
if (prop2 === PROXY || prop2 === TARGET) return false;
|
|
119
|
-
const isArrayLength = Array.isArray(target) && prop2 === "length";
|
|
120
|
-
const oldLength = isArrayLength ? target.length : void 0;
|
|
121
|
-
const hadKey = Object.prototype.hasOwnProperty.call(target, prop2);
|
|
122
|
-
const oldValue = Reflect.get(target, prop2, receiver);
|
|
123
|
-
if (oldValue === value2) return true;
|
|
124
|
-
const result = Reflect.set(target, prop2, value2, receiver);
|
|
125
|
-
if (result) {
|
|
126
|
-
trigger(target, prop2);
|
|
127
|
-
if (!hadKey) {
|
|
128
|
-
trigger(target, ITERATE_KEY);
|
|
129
|
-
}
|
|
130
|
-
if (isArrayLength) {
|
|
131
|
-
const nextLength = target.length;
|
|
132
|
-
if (typeof oldLength === "number" && nextLength < oldLength) {
|
|
133
|
-
const signals = signalCache.get(target);
|
|
134
|
-
if (signals) {
|
|
135
|
-
for (const key of signals.keys()) {
|
|
136
|
-
if (typeof key !== "string") continue;
|
|
137
|
-
const index = Number(key);
|
|
138
|
-
if (!Number.isInteger(index) || String(index) !== key) continue;
|
|
139
|
-
if (index >= nextLength && index < oldLength) {
|
|
140
|
-
trigger(target, key);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
trigger(target, ITERATE_KEY);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return result;
|
|
149
|
-
},
|
|
150
|
-
deleteProperty(target, prop2) {
|
|
151
|
-
const hadKey = Object.prototype.hasOwnProperty.call(target, prop2);
|
|
152
|
-
const result = Reflect.deleteProperty(target, prop2);
|
|
153
|
-
if (result) {
|
|
154
|
-
trigger(target, prop2);
|
|
155
|
-
if (hadKey) {
|
|
156
|
-
trigger(target, ITERATE_KEY);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
const proxy = new Proxy(value, handler);
|
|
163
|
-
proxyCache.set(value, proxy);
|
|
164
|
-
return proxy;
|
|
165
|
-
}
|
|
166
|
-
function unwrap2(value) {
|
|
167
|
-
if (value && typeof value === "object" && Reflect.get(value, PROXY)) {
|
|
168
|
-
return Reflect.get(value, TARGET);
|
|
169
|
-
}
|
|
170
|
-
return value;
|
|
171
|
-
}
|
|
172
|
-
function track(target, prop2) {
|
|
173
|
-
let signals = signalCache.get(target);
|
|
174
|
-
if (!signals) {
|
|
175
|
-
signals = /* @__PURE__ */ new Map();
|
|
176
|
-
signalCache.set(target, signals);
|
|
177
|
-
}
|
|
178
|
-
let s = signals.get(prop2);
|
|
179
|
-
if (!s) {
|
|
180
|
-
const initial = prop2 === ITERATE_KEY ? Reflect.ownKeys(target).length : getLastValue(target, prop2);
|
|
181
|
-
s = _chunkID3WBWNOcjs.signal.call(void 0, initial);
|
|
182
|
-
signals.set(prop2, s);
|
|
183
|
-
}
|
|
184
|
-
s();
|
|
185
|
-
}
|
|
186
|
-
function trigger(target, prop2) {
|
|
187
|
-
const signals = signalCache.get(target);
|
|
188
|
-
if (signals) {
|
|
189
|
-
const s = signals.get(prop2);
|
|
190
|
-
if (s) {
|
|
191
|
-
if (prop2 === ITERATE_KEY) {
|
|
192
|
-
s(Reflect.ownKeys(target).length);
|
|
193
|
-
} else {
|
|
194
|
-
s(getLastValue(target, prop2));
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function getLastValue(target, prop2) {
|
|
200
|
-
return Reflect.get(target, prop2);
|
|
201
|
-
}
|
|
202
|
-
function reconcile(target, value) {
|
|
203
|
-
if (target === value) return;
|
|
204
|
-
if (value === null || typeof value !== "object") {
|
|
205
|
-
throw new Error(
|
|
206
|
-
`[Fict] Cannot replace store with primitive value: ${String(
|
|
207
|
-
value
|
|
208
|
-
)}. setStore should return an object/array to merge.`
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
const realTarget = unwrap2(target);
|
|
212
|
-
const realValue = unwrap2(value);
|
|
213
|
-
const keys = /* @__PURE__ */ new Set([...Object.keys(realTarget), ...Object.keys(realValue)]);
|
|
214
|
-
for (const key of keys) {
|
|
215
|
-
const rTarget = realTarget;
|
|
216
|
-
const rValue = realValue;
|
|
217
|
-
if (rValue[key] === void 0 && rTarget[key] !== void 0) {
|
|
218
|
-
delete target[key];
|
|
219
|
-
} else if (rTarget[key] !== rValue[key]) {
|
|
220
|
-
;
|
|
221
|
-
target[key] = rValue[key];
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
if (Array.isArray(target) && Array.isArray(realValue) && target.length !== realValue.length) {
|
|
225
|
-
target.length = realValue.length;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
var _chunk6RCEIWZLcjs = require('./chunk-6RCEIWZL.cjs');
|
|
228
106
|
|
|
229
107
|
// src/reconcile.ts
|
|
230
108
|
function reconcileArrays(parentNode, a, b) {
|
|
@@ -314,6 +192,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
314
192
|
|
|
315
193
|
// src/list-helpers.ts
|
|
316
194
|
var isDev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || _optionalChain([process, 'access', _7 => _7.env, 'optionalAccess', _8 => _8.NODE_ENV]) !== "production";
|
|
195
|
+
var isShadowRoot = (node) => typeof ShadowRoot !== "undefined" && node instanceof ShadowRoot;
|
|
317
196
|
function moveNodesBefore(parent, nodes, anchor) {
|
|
318
197
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
319
198
|
const node = nodes[i];
|
|
@@ -353,24 +232,24 @@ var MAX_SAFE_VERSION = 9007199254740991;
|
|
|
353
232
|
function createVersionedSignalAccessor(initialValue) {
|
|
354
233
|
let current = initialValue;
|
|
355
234
|
let version = 0;
|
|
356
|
-
const
|
|
235
|
+
const track = _chunk6RCEIWZLcjs.signal.call(void 0, version);
|
|
357
236
|
function accessor(value) {
|
|
358
237
|
if (arguments.length === 0) {
|
|
359
|
-
|
|
238
|
+
track();
|
|
360
239
|
return current;
|
|
361
240
|
}
|
|
362
241
|
current = value;
|
|
363
242
|
version = version >= MAX_SAFE_VERSION ? 1 : version + 1;
|
|
364
|
-
|
|
243
|
+
track(version);
|
|
365
244
|
}
|
|
366
245
|
return accessor;
|
|
367
246
|
}
|
|
368
|
-
function createKeyedListContainer() {
|
|
369
|
-
const startMarker = document.createComment("fict:list:start");
|
|
370
|
-
const endMarker = document.createComment("fict:list:end");
|
|
247
|
+
function createKeyedListContainer(startOverride, endOverride) {
|
|
248
|
+
const startMarker = _nullishCoalesce(startOverride, () => ( document.createComment("fict:list:start")));
|
|
249
|
+
const endMarker = _nullishCoalesce(endOverride, () => ( document.createComment("fict:list:end")));
|
|
371
250
|
const dispose = () => {
|
|
372
251
|
for (const block of container.blocks.values()) {
|
|
373
|
-
|
|
252
|
+
_chunk6RCEIWZLcjs.destroyRoot.call(void 0, block.root);
|
|
374
253
|
}
|
|
375
254
|
container.blocks.clear();
|
|
376
255
|
container.nextBlocks.clear();
|
|
@@ -407,34 +286,34 @@ function createKeyedListContainer() {
|
|
|
407
286
|
};
|
|
408
287
|
return container;
|
|
409
288
|
}
|
|
410
|
-
function createKeyedBlock(key, item, index,
|
|
289
|
+
function createKeyedBlock(key, item, index, render2, needsIndex = true, hostRoot) {
|
|
411
290
|
const itemSig = createVersionedSignalAccessor(item);
|
|
412
|
-
const indexSig = needsIndex ?
|
|
291
|
+
const indexSig = needsIndex ? _chunk6RCEIWZLcjs.signal.call(void 0, index) : ((next) => {
|
|
413
292
|
if (arguments.length === 0) return index;
|
|
414
293
|
index = next;
|
|
415
294
|
return index;
|
|
416
295
|
});
|
|
417
|
-
const root =
|
|
418
|
-
const prevRoot =
|
|
296
|
+
const root = _chunk6RCEIWZLcjs.createRootContext.call(void 0, hostRoot);
|
|
297
|
+
const prevRoot = _chunk6RCEIWZLcjs.pushRoot.call(void 0, root);
|
|
419
298
|
let nodes = [];
|
|
420
299
|
let scopeDispose;
|
|
421
|
-
const prevSub =
|
|
300
|
+
const prevSub = _chunk6RCEIWZLcjs.setActiveSub.call(void 0, void 0);
|
|
422
301
|
try {
|
|
423
|
-
scopeDispose =
|
|
424
|
-
const rendered =
|
|
302
|
+
scopeDispose = _chunk6RCEIWZLcjs.effectScope.call(void 0, () => {
|
|
303
|
+
const rendered = render2(itemSig, indexSig, key);
|
|
425
304
|
if (rendered instanceof Node || Array.isArray(rendered) && rendered.every((n) => n instanceof Node)) {
|
|
426
|
-
nodes =
|
|
305
|
+
nodes = _chunkWJHXPF7Mcjs.toNodeArray.call(void 0, rendered);
|
|
427
306
|
} else {
|
|
428
|
-
const element =
|
|
429
|
-
nodes =
|
|
307
|
+
const element = _chunkWJHXPF7Mcjs.createElement.call(void 0, rendered);
|
|
308
|
+
nodes = _chunkWJHXPF7Mcjs.toNodeArray.call(void 0, element);
|
|
430
309
|
}
|
|
431
310
|
});
|
|
432
311
|
if (scopeDispose) {
|
|
433
312
|
root.cleanups.push(scopeDispose);
|
|
434
313
|
}
|
|
435
314
|
} finally {
|
|
436
|
-
|
|
437
|
-
|
|
315
|
+
_chunk6RCEIWZLcjs.setActiveSub.call(void 0, prevSub);
|
|
316
|
+
_chunk6RCEIWZLcjs.popRoot.call(void 0, prevRoot);
|
|
438
317
|
}
|
|
439
318
|
return {
|
|
440
319
|
key,
|
|
@@ -534,20 +413,41 @@ function reorderByLIS(parent, endMarker, prev, next) {
|
|
|
534
413
|
}
|
|
535
414
|
return moved;
|
|
536
415
|
}
|
|
537
|
-
function createKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
416
|
+
function createKeyedList(getItems, keyFn, renderItem, needsIndex, startMarker, endMarker) {
|
|
538
417
|
const resolvedNeedsIndex = arguments.length >= 4 ? !!needsIndex : renderItem.length > 1;
|
|
539
|
-
return createFineGrainedKeyedList(
|
|
418
|
+
return createFineGrainedKeyedList(
|
|
419
|
+
getItems,
|
|
420
|
+
keyFn,
|
|
421
|
+
renderItem,
|
|
422
|
+
resolvedNeedsIndex,
|
|
423
|
+
startMarker,
|
|
424
|
+
endMarker
|
|
425
|
+
);
|
|
540
426
|
}
|
|
541
|
-
function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
542
|
-
const container = createKeyedListContainer();
|
|
543
|
-
const hostRoot =
|
|
544
|
-
const
|
|
545
|
-
fragment
|
|
427
|
+
function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, startOverride, endOverride) {
|
|
428
|
+
const container = createKeyedListContainer(startOverride, endOverride);
|
|
429
|
+
const hostRoot = _chunk6RCEIWZLcjs.getCurrentRoot.call(void 0, );
|
|
430
|
+
const useProvided = !!(startOverride && endOverride);
|
|
431
|
+
const fragment = useProvided ? container.startMarker : document.createDocumentFragment();
|
|
432
|
+
if (!useProvided) {
|
|
433
|
+
;
|
|
434
|
+
fragment.append(container.startMarker, container.endMarker);
|
|
435
|
+
}
|
|
546
436
|
let disposed = false;
|
|
547
437
|
let effectDispose;
|
|
548
438
|
let connectObserver = null;
|
|
549
439
|
let effectStarted = false;
|
|
550
440
|
let startScheduled = false;
|
|
441
|
+
let initialHydrating = _chunk6RCEIWZLcjs.__fictIsHydrating.call(void 0, );
|
|
442
|
+
const collectBetween = () => {
|
|
443
|
+
const nodes = [];
|
|
444
|
+
let cursor = container.startMarker.nextSibling;
|
|
445
|
+
while (cursor && cursor !== container.endMarker) {
|
|
446
|
+
nodes.push(cursor);
|
|
447
|
+
cursor = cursor.nextSibling;
|
|
448
|
+
}
|
|
449
|
+
return nodes;
|
|
450
|
+
};
|
|
551
451
|
const getConnectedParent = () => {
|
|
552
452
|
const endParent = container.endMarker.parentNode;
|
|
553
453
|
const startParent = container.startMarker.parentNode;
|
|
@@ -556,23 +456,86 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
556
456
|
if ("isConnected" in parentNode && !parentNode.isConnected) return null;
|
|
557
457
|
return parentNode;
|
|
558
458
|
}
|
|
459
|
+
if (endParent && startParent && endParent === startParent && isShadowRoot(endParent)) {
|
|
460
|
+
const shadowRoot = endParent;
|
|
461
|
+
const host = shadowRoot.host;
|
|
462
|
+
if ("isConnected" in host && !host.isConnected) return null;
|
|
463
|
+
return shadowRoot;
|
|
464
|
+
}
|
|
559
465
|
return null;
|
|
560
466
|
};
|
|
561
467
|
const performDiff = () => {
|
|
562
468
|
if (disposed) return;
|
|
563
|
-
const
|
|
469
|
+
const isSSR = _chunk6RCEIWZLcjs.__fictIsSSR.call(void 0, );
|
|
470
|
+
const parent = isSSR ? container.startMarker.parentNode : getConnectedParent();
|
|
564
471
|
if (!parent) return;
|
|
565
|
-
|
|
472
|
+
_chunkWJHXPF7Mcjs.batch.call(void 0, () => {
|
|
566
473
|
const oldBlocks = container.blocks;
|
|
567
474
|
const newBlocks = container.nextBlocks;
|
|
568
475
|
const prevOrderedBlocks = container.orderedBlocks;
|
|
569
476
|
const nextOrderedBlocks = container.nextOrderedBlocks;
|
|
570
477
|
const orderedIndexByKey = container.orderedIndexByKey;
|
|
571
478
|
const newItems = getItems();
|
|
479
|
+
if (initialHydrating && _chunkWJHXPF7Mcjs.isHydratingActive.call(void 0, )) {
|
|
480
|
+
initialHydrating = false;
|
|
481
|
+
newBlocks.clear();
|
|
482
|
+
nextOrderedBlocks.length = 0;
|
|
483
|
+
orderedIndexByKey.clear();
|
|
484
|
+
if (newItems.length === 0) {
|
|
485
|
+
oldBlocks.clear();
|
|
486
|
+
prevOrderedBlocks.length = 0;
|
|
487
|
+
container.currentNodes = [container.startMarker, container.endMarker];
|
|
488
|
+
container.nextNodes.length = 0;
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const createdBlocks2 = [];
|
|
492
|
+
_chunkWJHXPF7Mcjs.withHydrationRange.call(void 0,
|
|
493
|
+
container.startMarker.nextSibling,
|
|
494
|
+
container.endMarker,
|
|
495
|
+
_nullishCoalesce(parent.ownerDocument, () => ( document)),
|
|
496
|
+
() => {
|
|
497
|
+
for (let index = 0; index < newItems.length; index++) {
|
|
498
|
+
const item = newItems[index];
|
|
499
|
+
const key = keyFn(item, index);
|
|
500
|
+
if (newBlocks.has(key)) {
|
|
501
|
+
if (isDev) {
|
|
502
|
+
console.warn(
|
|
503
|
+
`[fict] Duplicate key "${String(key)}" detected in list hydration. Each item should have a unique key.`
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
const existing = newBlocks.get(key);
|
|
507
|
+
if (existing) {
|
|
508
|
+
_chunk6RCEIWZLcjs.destroyRoot.call(void 0, existing.root);
|
|
509
|
+
_chunkWJHXPF7Mcjs.removeNodes.call(void 0, existing.nodes);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
const block = createKeyedBlock(key, item, index, renderItem, needsIndex, hostRoot);
|
|
513
|
+
createdBlocks2.push(block);
|
|
514
|
+
newBlocks.set(key, block);
|
|
515
|
+
orderedIndexByKey.set(key, nextOrderedBlocks.length);
|
|
516
|
+
nextOrderedBlocks.push(block);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
container.blocks = newBlocks;
|
|
521
|
+
container.nextBlocks = oldBlocks;
|
|
522
|
+
container.orderedBlocks = nextOrderedBlocks;
|
|
523
|
+
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
524
|
+
oldBlocks.clear();
|
|
525
|
+
prevOrderedBlocks.length = 0;
|
|
526
|
+
container.currentNodes = [container.startMarker, ...collectBetween(), container.endMarker];
|
|
527
|
+
container.nextNodes.length = 0;
|
|
528
|
+
for (const block of createdBlocks2) {
|
|
529
|
+
if (newBlocks.get(block.key) === block) {
|
|
530
|
+
_chunk6RCEIWZLcjs.flushOnMount.call(void 0, block.root);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
572
535
|
if (newItems.length === 0) {
|
|
573
536
|
if (oldBlocks.size > 0) {
|
|
574
537
|
for (const block of oldBlocks.values()) {
|
|
575
|
-
|
|
538
|
+
_chunk6RCEIWZLcjs.destroyRoot.call(void 0, block.root);
|
|
576
539
|
}
|
|
577
540
|
const range = document.createRange();
|
|
578
541
|
range.setStartAfter(container.startMarker);
|
|
@@ -653,8 +616,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
653
616
|
`[fict] Duplicate key "${String(key)}" detected in list rendering. Each item should have a unique key. The previous item with this key will be replaced.`
|
|
654
617
|
);
|
|
655
618
|
}
|
|
656
|
-
|
|
657
|
-
|
|
619
|
+
_chunk6RCEIWZLcjs.destroyRoot.call(void 0, existingBlock.root);
|
|
620
|
+
_chunkWJHXPF7Mcjs.removeNodes.call(void 0, existingBlock.nodes);
|
|
658
621
|
}
|
|
659
622
|
block = createKeyedBlock(key, item, index, renderItem, needsIndex, hostRoot);
|
|
660
623
|
createdBlocks.push(block);
|
|
@@ -667,8 +630,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
667
630
|
hasDuplicateKey = true;
|
|
668
631
|
const prior = nextOrderedBlocks[position];
|
|
669
632
|
if (prior && prior !== resolvedBlock) {
|
|
670
|
-
|
|
671
|
-
|
|
633
|
+
_chunk6RCEIWZLcjs.destroyRoot.call(void 0, prior.root);
|
|
634
|
+
_chunkWJHXPF7Mcjs.removeNodes.call(void 0, prior.nodes);
|
|
672
635
|
}
|
|
673
636
|
nextOrderedBlocks[position] = resolvedBlock;
|
|
674
637
|
} else {
|
|
@@ -706,7 +669,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
706
669
|
}
|
|
707
670
|
}
|
|
708
671
|
if (appendedNodes.length > 0) {
|
|
709
|
-
|
|
672
|
+
_chunkWJHXPF7Mcjs.insertNodesBefore.call(void 0, parent, appendedNodes, container.endMarker);
|
|
710
673
|
const currentNodes = container.currentNodes;
|
|
711
674
|
currentNodes.pop();
|
|
712
675
|
for (let i = 0; i < appendedNodes.length; i++) {
|
|
@@ -720,15 +683,15 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
720
683
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
721
684
|
for (const block of createdBlocks) {
|
|
722
685
|
if (newBlocks.get(block.key) === block) {
|
|
723
|
-
|
|
686
|
+
_chunk6RCEIWZLcjs.flushOnMount.call(void 0, block.root);
|
|
724
687
|
}
|
|
725
688
|
}
|
|
726
689
|
return;
|
|
727
690
|
}
|
|
728
691
|
if (oldBlocks.size > 0) {
|
|
729
692
|
for (const block of oldBlocks.values()) {
|
|
730
|
-
|
|
731
|
-
|
|
693
|
+
_chunk6RCEIWZLcjs.destroyRoot.call(void 0, block.root);
|
|
694
|
+
_chunkWJHXPF7Mcjs.removeNodes.call(void 0, block.nodes);
|
|
732
695
|
}
|
|
733
696
|
oldBlocks.clear();
|
|
734
697
|
}
|
|
@@ -787,7 +750,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
787
750
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
788
751
|
for (const block of createdBlocks) {
|
|
789
752
|
if (newBlocks.get(block.key) === block) {
|
|
790
|
-
|
|
753
|
+
_chunk6RCEIWZLcjs.flushOnMount.call(void 0, block.root);
|
|
791
754
|
}
|
|
792
755
|
}
|
|
793
756
|
});
|
|
@@ -798,18 +761,19 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
798
761
|
};
|
|
799
762
|
const ensureEffectStarted = () => {
|
|
800
763
|
if (disposed || effectStarted) return effectStarted;
|
|
801
|
-
const
|
|
764
|
+
const isSSR = _chunk6RCEIWZLcjs.__fictIsSSR.call(void 0, );
|
|
765
|
+
const parent = isSSR ? container.startMarker.parentNode : getConnectedParent();
|
|
802
766
|
if (!parent) return false;
|
|
803
767
|
const start = () => {
|
|
804
|
-
effectDispose =
|
|
768
|
+
effectDispose = _chunk6RCEIWZLcjs.createRenderEffect.call(void 0, performDiff);
|
|
805
769
|
effectStarted = true;
|
|
806
770
|
};
|
|
807
771
|
if (hostRoot) {
|
|
808
|
-
const prev =
|
|
772
|
+
const prev = _chunk6RCEIWZLcjs.pushRoot.call(void 0, hostRoot);
|
|
809
773
|
try {
|
|
810
774
|
start();
|
|
811
775
|
} finally {
|
|
812
|
-
|
|
776
|
+
_chunk6RCEIWZLcjs.popRoot.call(void 0, prev);
|
|
813
777
|
}
|
|
814
778
|
} else {
|
|
815
779
|
start();
|
|
@@ -818,16 +782,21 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
818
782
|
};
|
|
819
783
|
const waitForConnection = () => {
|
|
820
784
|
if (connectObserver || typeof MutationObserver === "undefined") return;
|
|
785
|
+
const root = _nullishCoalesce(_optionalChain([container, 'access', _11 => _11.startMarker, 'access', _12 => _12.getRootNode, 'optionalCall', _13 => _13()]), () => ( document));
|
|
786
|
+
const shadowRoot = root && root.nodeType === 11 && isShadowRoot(root) ? root : null;
|
|
821
787
|
connectObserver = new MutationObserver(() => {
|
|
822
788
|
if (disposed) return;
|
|
823
789
|
if (getConnectedParent()) {
|
|
824
790
|
disconnectObserver();
|
|
825
791
|
if (ensureEffectStarted()) {
|
|
826
|
-
|
|
792
|
+
_chunk6RCEIWZLcjs.flush.call(void 0, );
|
|
827
793
|
}
|
|
828
794
|
}
|
|
829
795
|
});
|
|
830
796
|
connectObserver.observe(document, { childList: true, subtree: true });
|
|
797
|
+
if (shadowRoot) {
|
|
798
|
+
connectObserver.observe(shadowRoot, { childList: true, subtree: true });
|
|
799
|
+
}
|
|
831
800
|
};
|
|
832
801
|
const scheduleStart = () => {
|
|
833
802
|
if (startScheduled || disposed || effectStarted) return;
|
|
@@ -857,14 +826,14 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
857
826
|
if (disposed) return;
|
|
858
827
|
scheduleStart();
|
|
859
828
|
if (ensureEffectStarted()) {
|
|
860
|
-
|
|
829
|
+
_chunk6RCEIWZLcjs.flush.call(void 0, );
|
|
861
830
|
} else {
|
|
862
831
|
waitForConnection();
|
|
863
832
|
}
|
|
864
833
|
},
|
|
865
834
|
dispose: () => {
|
|
866
835
|
disposed = true;
|
|
867
|
-
_optionalChain([effectDispose, 'optionalCall',
|
|
836
|
+
_optionalChain([effectDispose, 'optionalCall', _14 => _14()]);
|
|
868
837
|
disconnectObserver();
|
|
869
838
|
container.dispose();
|
|
870
839
|
}
|
|
@@ -932,5 +901,35 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
932
901
|
|
|
933
902
|
|
|
934
903
|
|
|
935
|
-
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
exports.Aliases = _chunk6RCEIWZLcjs.Aliases; exports.BooleanAttributes = _chunk6RCEIWZLcjs.BooleanAttributes; exports.ChildProperties = _chunk6RCEIWZLcjs.ChildProperties; exports.DelegatedEvents = _chunk6RCEIWZLcjs.DelegatedEvents; exports.Fragment = _chunkWJHXPF7Mcjs.Fragment; exports.Properties = _chunk6RCEIWZLcjs.Properties; exports.SVGElements = _chunk6RCEIWZLcjs.SVGElements; exports.SVGNamespace = _chunk6RCEIWZLcjs.SVGNamespace; exports.UnitlessStyles = _chunk6RCEIWZLcjs.UnitlessStyles; exports.__fictDisableResumable = _chunk6RCEIWZLcjs.__fictDisableResumable; exports.__fictDisableSSR = _chunk6RCEIWZLcjs.__fictDisableSSR; exports.__fictEnableResumable = _chunk6RCEIWZLcjs.__fictEnableResumable; exports.__fictEnableSSR = _chunk6RCEIWZLcjs.__fictEnableSSR; exports.__fictEnsureScope = _chunk6RCEIWZLcjs.__fictEnsureScope; exports.__fictEnterHydration = _chunk6RCEIWZLcjs.__fictEnterHydration; exports.__fictExitHydration = _chunk6RCEIWZLcjs.__fictExitHydration; exports.__fictGetResume = _chunk6RCEIWZLcjs.__fictGetResume; exports.__fictGetSSRScope = _chunk6RCEIWZLcjs.__fictGetSSRScope; exports.__fictGetScopeProps = _chunk6RCEIWZLcjs.__fictGetScopeProps; exports.__fictGetScopeRegistry = _chunk6RCEIWZLcjs.__fictGetScopeRegistry; exports.__fictIsHydrating = _chunk6RCEIWZLcjs.__fictIsHydrating; exports.__fictIsResumable = _chunk6RCEIWZLcjs.__fictIsResumable; exports.__fictIsSSR = _chunk6RCEIWZLcjs.__fictIsSSR; exports.__fictPopContext = _chunk6RCEIWZLcjs.__fictPopContext; exports.__fictPrepareContext = _chunk6RCEIWZLcjs.__fictPrepareContext; exports.__fictProp = _chunkWJHXPF7Mcjs.__fictProp; exports.__fictPropsRest = _chunkWJHXPF7Mcjs.__fictPropsRest; exports.__fictPushContext = _chunk6RCEIWZLcjs.__fictPushContext; exports.__fictQrl = _chunk6RCEIWZLcjs.__fictQrl; exports.__fictRegisterResume = _chunk6RCEIWZLcjs.__fictRegisterResume; exports.__fictRegisterScope = _chunk6RCEIWZLcjs.__fictRegisterScope; exports.__fictRender = _chunk6RCEIWZLcjs.__fictRender; exports.__fictResetContext = _chunk6RCEIWZLcjs.__fictResetContext; exports.__fictSerializeSSRState = _chunk6RCEIWZLcjs.__fictSerializeSSRState; exports.__fictSetSSRState = _chunk6RCEIWZLcjs.__fictSetSSRState; exports.__fictUseContext = _chunk6RCEIWZLcjs.__fictUseContext; exports.__fictUseEffect = _chunk6RCEIWZLcjs.__fictUseEffect; exports.__fictUseLexicalScope = _chunk6RCEIWZLcjs.__fictUseLexicalScope; exports.__fictUseMemo = _chunk6RCEIWZLcjs.__fictUseMemo; exports.__fictUseSignal = _chunk6RCEIWZLcjs.__fictUseSignal; exports.__resetReactiveState = _chunk6RCEIWZLcjs.__resetReactiveState; exports.addEventListener = _chunkWJHXPF7Mcjs.addEventListener; exports.assign = _chunkWJHXPF7Mcjs.assign; exports.bindAttribute = _chunkWJHXPF7Mcjs.bindAttribute; exports.bindClass = _chunkWJHXPF7Mcjs.bindClass; exports.bindEvent = _chunkWJHXPF7Mcjs.bindEvent; exports.bindProperty = _chunkWJHXPF7Mcjs.bindProperty; exports.bindRef = _chunkWJHXPF7Mcjs.bindRef; exports.bindStyle = _chunkWJHXPF7Mcjs.bindStyle; exports.bindText = _chunkWJHXPF7Mcjs.bindText; exports.callEventHandler = _chunkWJHXPF7Mcjs.callEventHandler; exports.classList = _chunkWJHXPF7Mcjs.classList; exports.clearDelegatedEvents = _chunkWJHXPF7Mcjs.clearDelegatedEvents; exports.createConditional = _chunkWJHXPF7Mcjs.createConditional; exports.createEffect = _chunk6RCEIWZLcjs.createEffect; exports.createElement = _chunkWJHXPF7Mcjs.createElement; exports.createKeyedList = createKeyedList; exports.createMemo = _chunk6RCEIWZLcjs.createMemo; exports.createPortal = _chunkWJHXPF7Mcjs.createPortal; exports.createPropsProxy = _chunkWJHXPF7Mcjs.createPropsProxy; exports.createRenderEffect = _chunk6RCEIWZLcjs.createRenderEffect; exports.createSelector = _chunk6RCEIWZLcjs.createSelector; exports.createSignal = _chunk6RCEIWZLcjs.signal; exports.createStore = _chunk6RCEIWZLcjs.createStore; exports.delegateEvents = _chunkWJHXPF7Mcjs.delegateEvents; exports.deserializeValue = _chunk6RCEIWZLcjs.deserializeValue; exports.getPropAlias = _chunk6RCEIWZLcjs.getPropAlias; exports.getSlotEnd = _chunkWJHXPF7Mcjs.getSlotEnd; exports.hydrateComponent = _chunkWJHXPF7Mcjs.hydrateComponent; exports.insert = _chunkWJHXPF7Mcjs.insert; exports.insertBetween = _chunkWJHXPF7Mcjs.insertBetween; exports.insertNodesBefore = _chunkWJHXPF7Mcjs.insertNodesBefore; exports.isNodeBetweenMarkers = isNodeBetweenMarkers; exports.isReactive = _chunkWJHXPF7Mcjs.isReactive; exports.isStoreProxy = _chunk6RCEIWZLcjs.isStoreProxy; exports.keyed = _chunkWJHXPF7Mcjs.keyed; exports.mergeProps = _chunkWJHXPF7Mcjs.mergeProps; exports.moveNodesBefore = moveNodesBefore; exports.onDestroy = _chunk6RCEIWZLcjs.onDestroy; exports.prop = _chunkWJHXPF7Mcjs.prop; exports.reconcileArrays = reconcileArrays; exports.removeNodes = _chunkWJHXPF7Mcjs.removeNodes; exports.render = _chunkWJHXPF7Mcjs.render; exports.resolvePath = _chunkWJHXPF7Mcjs.resolvePath; exports.runInScope = _chunk4ZPZM5IGcjs.runInScope; exports.serializeValue = _chunk6RCEIWZLcjs.serializeValue; exports.spread = _chunkWJHXPF7Mcjs.spread; exports.template = _chunkWJHXPF7Mcjs.template; exports.toNodeArray = _chunkWJHXPF7Mcjs.toNodeArray; exports.unwrap = _chunkWJHXPF7Mcjs.unwrap; exports.unwrapStore = _chunk6RCEIWZLcjs.unwrapStore;
|
|
936
935
|
//# sourceMappingURL=internal.cjs.map
|