@fictjs/runtime 0.5.0 → 0.5.2
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 +9 -9
- package/dist/advanced.js +4 -4
- package/dist/{chunk-5AA7HP4S.js → chunk-4NUHM77Z.js} +3 -3
- package/dist/{chunk-BQG7VEBY.js → chunk-D2IWOO4X.js} +2 -2
- package/dist/{chunk-KYLNC4CD.cjs → chunk-KNGHYGK4.cjs} +17 -17
- package/dist/{chunk-KYLNC4CD.cjs.map → chunk-KNGHYGK4.cjs.map} +1 -1
- package/dist/{chunk-FKDMDAUR.js → chunk-LRFMCJY3.js} +119 -19
- package/dist/chunk-LRFMCJY3.js.map +1 -0
- package/dist/{chunk-GHUV2FLD.cjs → chunk-QB2UD62G.cjs} +8 -8
- package/dist/{chunk-GHUV2FLD.cjs.map → chunk-QB2UD62G.cjs.map} +1 -1
- package/dist/{chunk-KKKYW54Z.js → chunk-SLFAEVKJ.js} +3 -3
- package/dist/{chunk-TKWN42TA.cjs → chunk-Z6M3HKLG.cjs} +156 -156
- package/dist/{chunk-TKWN42TA.cjs.map → chunk-Z6M3HKLG.cjs.map} +1 -1
- package/dist/{chunk-6SOPF5LZ.cjs → chunk-ZR435MDC.cjs} +120 -20
- package/dist/chunk-ZR435MDC.cjs.map +1 -0
- package/dist/index.cjs +95 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.js +120 -25
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +60 -10
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +64 -42
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +12 -3
- package/dist/internal.d.ts +12 -3
- package/dist/internal.js +25 -3
- package/dist/internal.js.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +671 -0
- package/dist/jsx-dev-runtime.d.ts +671 -0
- package/dist/loader.cjs +60 -8
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.d.cts +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +53 -1
- package/dist/loader.js.map +1 -1
- package/dist/{resume-Dx8_l72o.d.ts → resume-CqeQ3v_q.d.ts} +5 -1
- package/dist/{resume-BrAkmSTY.d.cts → resume-i-A3EFox.d.cts} +5 -1
- package/package.json +1 -1
- package/src/cycle-guard.ts +1 -1
- package/src/internal.ts +4 -0
- package/src/list-helpers.ts +19 -4
- package/src/loader.ts +58 -0
- package/src/resume.ts +55 -0
- package/src/signal.ts +47 -22
- package/src/ssr-stream.ts +38 -0
- package/src/suspense.ts +62 -7
- package/dist/chunk-6SOPF5LZ.cjs.map +0 -1
- package/dist/chunk-FKDMDAUR.js.map +0 -1
- /package/dist/{chunk-5AA7HP4S.js.map → chunk-4NUHM77Z.js.map} +0 -0
- /package/dist/{chunk-BQG7VEBY.js.map → chunk-D2IWOO4X.js.map} +0 -0
- /package/dist/{chunk-KKKYW54Z.js.map → chunk-SLFAEVKJ.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createContext,
|
|
3
3
|
hasContext,
|
|
4
4
|
useContext
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SLFAEVKJ.js";
|
|
6
6
|
import {
|
|
7
7
|
Fragment,
|
|
8
8
|
batch,
|
|
@@ -19,8 +19,11 @@ import {
|
|
|
19
19
|
untrack,
|
|
20
20
|
useDeferredValue,
|
|
21
21
|
useTransition
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-D2IWOO4X.js";
|
|
23
23
|
import {
|
|
24
|
+
__fictGetSSRStreamHooks,
|
|
25
|
+
__fictPopSSRBoundary,
|
|
26
|
+
__fictPushSSRBoundary,
|
|
24
27
|
createEffect,
|
|
25
28
|
createMemo,
|
|
26
29
|
createRoot,
|
|
@@ -37,7 +40,7 @@ import {
|
|
|
37
40
|
registerErrorHandler,
|
|
38
41
|
registerSuspenseHandler,
|
|
39
42
|
signal
|
|
40
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-LRFMCJY3.js";
|
|
41
44
|
|
|
42
45
|
// src/ref.ts
|
|
43
46
|
function createRef() {
|
|
@@ -151,6 +154,7 @@ function createSuspenseToken() {
|
|
|
151
154
|
}
|
|
152
155
|
var isThenable = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
|
|
153
156
|
function Suspense(props) {
|
|
157
|
+
const streamHooks = __fictGetSSRStreamHooks();
|
|
154
158
|
const pending = signal(0);
|
|
155
159
|
let resolvedOnce = false;
|
|
156
160
|
let epoch = 0;
|
|
@@ -171,7 +175,12 @@ function Suspense(props) {
|
|
|
171
175
|
const root = createRootContext(hostRoot);
|
|
172
176
|
const prev = pushRoot(root);
|
|
173
177
|
let nodes = [];
|
|
178
|
+
let boundaryPushed = false;
|
|
174
179
|
try {
|
|
180
|
+
if (streamBoundaryId) {
|
|
181
|
+
__fictPushSSRBoundary(streamBoundaryId);
|
|
182
|
+
boundaryPushed = true;
|
|
183
|
+
}
|
|
175
184
|
const output = createElement(view);
|
|
176
185
|
nodes = toNodeArray(output);
|
|
177
186
|
const suspendedAttempt = root.suspended || nodes.length > 0 && nodes.every((node) => node instanceof Comment && node.data === "fict:suspend");
|
|
@@ -180,9 +189,9 @@ function Suspense(props) {
|
|
|
180
189
|
destroyRoot(root);
|
|
181
190
|
return;
|
|
182
191
|
}
|
|
183
|
-
const parentNode =
|
|
192
|
+
const parentNode = endMarker.parentNode;
|
|
184
193
|
if (parentNode) {
|
|
185
|
-
insertNodesBefore(parentNode, nodes,
|
|
194
|
+
insertNodesBefore(parentNode, nodes, endMarker);
|
|
186
195
|
}
|
|
187
196
|
} catch (err) {
|
|
188
197
|
popRoot(prev);
|
|
@@ -191,6 +200,10 @@ function Suspense(props) {
|
|
|
191
200
|
throw err;
|
|
192
201
|
}
|
|
193
202
|
return;
|
|
203
|
+
} finally {
|
|
204
|
+
if (boundaryPushed) {
|
|
205
|
+
__fictPopSSRBoundary(streamBoundaryId ?? void 0);
|
|
206
|
+
}
|
|
194
207
|
}
|
|
195
208
|
popRoot(prev);
|
|
196
209
|
flushOnMount(root);
|
|
@@ -201,10 +214,21 @@ function Suspense(props) {
|
|
|
201
214
|
activeNodes = nodes;
|
|
202
215
|
};
|
|
203
216
|
const fragment = document.createDocumentFragment();
|
|
204
|
-
const
|
|
205
|
-
|
|
217
|
+
const startMarker = document.createComment("fict:suspense-start");
|
|
218
|
+
const endMarker = document.createComment("fict:suspense-end");
|
|
219
|
+
fragment.appendChild(startMarker);
|
|
220
|
+
fragment.appendChild(endMarker);
|
|
206
221
|
let cleanup;
|
|
207
222
|
let activeNodes = [];
|
|
223
|
+
let streamBoundaryId = null;
|
|
224
|
+
let streamPending = false;
|
|
225
|
+
if (streamHooks?.registerBoundary) {
|
|
226
|
+
streamBoundaryId = streamHooks.registerBoundary(startMarker, endMarker) ?? null;
|
|
227
|
+
if (streamBoundaryId) {
|
|
228
|
+
startMarker.data = `fict:suspense-start:${streamBoundaryId}`;
|
|
229
|
+
endMarker.data = `fict:suspense-end:${streamBoundaryId}`;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
208
232
|
const onResolveMaybe = () => {
|
|
209
233
|
if (!resolvedOnce) {
|
|
210
234
|
resolvedOnce = true;
|
|
@@ -213,6 +237,10 @@ function Suspense(props) {
|
|
|
213
237
|
};
|
|
214
238
|
registerSuspenseHandler((token) => {
|
|
215
239
|
const tokenEpoch = epoch;
|
|
240
|
+
if (!streamPending && streamBoundaryId && streamHooks?.boundaryPending) {
|
|
241
|
+
streamPending = true;
|
|
242
|
+
streamHooks.boundaryPending(streamBoundaryId);
|
|
243
|
+
}
|
|
216
244
|
pending(pending() + 1);
|
|
217
245
|
renderView(toFallback());
|
|
218
246
|
const thenable = token.then ? token : isThenable(token) ? token : null;
|
|
@@ -226,6 +254,10 @@ function Suspense(props) {
|
|
|
226
254
|
pending(newPending);
|
|
227
255
|
if (newPending === 0) {
|
|
228
256
|
renderView(props.children ?? null);
|
|
257
|
+
if (streamPending && streamBoundaryId && streamHooks?.boundaryResolved) {
|
|
258
|
+
streamPending = false;
|
|
259
|
+
streamHooks.boundaryResolved(streamBoundaryId);
|
|
260
|
+
}
|
|
229
261
|
onResolveMaybe();
|
|
230
262
|
}
|
|
231
263
|
},
|
|
@@ -235,9 +267,23 @@ function Suspense(props) {
|
|
|
235
267
|
}
|
|
236
268
|
const newPending = Math.max(0, pending() - 1);
|
|
237
269
|
pending(newPending);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
270
|
+
let rejectionError = err;
|
|
271
|
+
try {
|
|
272
|
+
props.onReject?.(err);
|
|
273
|
+
} catch (callbackError) {
|
|
274
|
+
rejectionError = callbackError;
|
|
275
|
+
}
|
|
276
|
+
const handled = handleError(rejectionError, { source: "render" }, hostRoot);
|
|
277
|
+
if (!handled) {
|
|
278
|
+
if (streamHooks?.onError) {
|
|
279
|
+
streamHooks.onError(rejectionError, streamBoundaryId ?? void 0);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
throw rejectionError;
|
|
283
|
+
}
|
|
284
|
+
if (newPending === 0 && streamPending && streamBoundaryId && streamHooks?.boundaryResolved) {
|
|
285
|
+
streamPending = false;
|
|
286
|
+
streamHooks.boundaryResolved(streamBoundaryId);
|
|
241
287
|
}
|
|
242
288
|
}
|
|
243
289
|
);
|
|
@@ -257,6 +303,10 @@ function Suspense(props) {
|
|
|
257
303
|
epoch++;
|
|
258
304
|
pending(0);
|
|
259
305
|
renderView(props.children ?? null);
|
|
306
|
+
if (streamPending && streamBoundaryId && streamHooks?.boundaryResolved) {
|
|
307
|
+
streamPending = false;
|
|
308
|
+
streamHooks.boundaryResolved(streamBoundaryId);
|
|
309
|
+
}
|
|
260
310
|
}
|
|
261
311
|
});
|
|
262
312
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ref.ts","../src/error-boundary.ts","../src/suspense.ts"],"sourcesContent":["import type { RefObject } from './types'\n\n/**\n * Create a ref object for DOM element references.\n *\n * @returns A ref object with a `current` property initialized to `null`\n *\n * @example\n * ```tsx\n * import { createRef } from 'fict'\n *\n * function Component() {\n * const inputRef = createRef<HTMLInputElement>()\n *\n * $effect(() => {\n * inputRef.current?.focus()\n * })\n *\n * return <input ref={inputRef} />\n * }\n * ```\n */\nexport function createRef<T extends Element = HTMLElement>(): RefObject<T> {\n return { current: null }\n}\n","import { createElement } from './dom'\nimport { createEffect } from './effect'\nimport {\n createRootContext,\n destroyRoot,\n flushOnMount,\n getCurrentRoot,\n pushRoot,\n popRoot,\n registerErrorHandler,\n} from './lifecycle'\nimport { insertNodesBefore, removeNodes, toNodeArray } from './node-ops'\nimport type { BaseProps, FictNode } from './types'\n\ninterface ErrorBoundaryProps extends BaseProps {\n fallback: FictNode | ((err: unknown, reset?: () => void) => FictNode)\n onError?: (err: unknown) => void\n resetKeys?: unknown | (() => unknown)\n}\n\nexport function ErrorBoundary(props: ErrorBoundaryProps): FictNode {\n const fragment = document.createDocumentFragment()\n const marker = document.createComment('fict:error-boundary')\n fragment.appendChild(marker)\n\n const hostRoot = getCurrentRoot()\n\n let cleanup: (() => void) | undefined\n let activeNodes: Node[] = []\n let renderingFallback = false\n\n let reset = () => {}\n const toView = (err: unknown | null): FictNode | null => {\n if (err != null) {\n return typeof props.fallback === 'function'\n ? (props.fallback as (e: unknown, reset?: () => void) => FictNode)(err, reset)\n : props.fallback\n }\n return props.children ?? null\n }\n\n const renderValue = (value: FictNode | null) => {\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n if (activeNodes.length) {\n removeNodes(activeNodes)\n activeNodes = []\n }\n\n if (value == null || value === false) {\n return\n }\n\n const root = createRootContext(hostRoot)\n const prev = pushRoot(root)\n let nodes: Node[] = []\n try {\n const output = createElement(value)\n nodes = toNodeArray(output)\n const parentNode = marker.parentNode as (ParentNode & Node) | null\n if (parentNode) {\n insertNodesBefore(parentNode, nodes, marker)\n }\n } catch (err) {\n popRoot(prev)\n destroyRoot(root)\n // Fall back immediately on render errors, avoid infinite recursion\n if (renderingFallback) {\n throw err\n }\n // nested errors. If fallback rendering also throws, we should NOT reset\n // the flag until we're sure no more recursion is happening.\n renderingFallback = true\n try {\n renderValue(toView(err))\n // Only reset if successful - if renderValue threw, we want to keep\n // renderingFallback = true to prevent infinite recursion\n renderingFallback = false\n props.onError?.(err)\n } catch (fallbackErr) {\n // Fallback rendering failed - keep renderingFallback = true\n // to prevent further attempts, then rethrow\n // If fallback fails, report both errors\n props.onError?.(err)\n throw fallbackErr\n }\n return\n }\n popRoot(prev)\n flushOnMount(root)\n\n cleanup = () => {\n destroyRoot(root)\n removeNodes(nodes)\n }\n activeNodes = nodes\n }\n\n reset = () => {\n renderingFallback = false\n renderValue(toView(null))\n }\n\n renderValue(props.children ?? null)\n\n registerErrorHandler(err => {\n renderValue(toView(err))\n props.onError?.(err)\n return true\n })\n\n if (props.resetKeys !== undefined) {\n const isGetter =\n typeof props.resetKeys === 'function' && (props.resetKeys as () => unknown).length === 0\n const getter = isGetter ? (props.resetKeys as () => unknown) : undefined\n let prev = isGetter ? getter!() : props.resetKeys\n createEffect(() => {\n const next = getter ? getter() : props.resetKeys\n if (prev !== next) {\n prev = next\n renderValue(toView(null))\n }\n })\n }\n\n return fragment\n}\n","import { createElement } from './dom'\nimport { createEffect } from './effect'\nimport {\n createRootContext,\n destroyRoot,\n flushOnMount,\n getCurrentRoot,\n handleError,\n pushRoot,\n popRoot,\n registerSuspenseHandler,\n} from './lifecycle'\nimport { insertNodesBefore, removeNodes, toNodeArray } from './node-ops'\nimport { createSignal } from './signal'\nimport type { BaseProps, FictNode, SuspenseToken } from './types'\n\nexport interface SuspenseProps extends BaseProps {\n fallback: FictNode | ((err?: unknown) => FictNode)\n onResolve?: () => void\n onReject?: (err: unknown) => void\n resetKeys?: unknown | (() => unknown)\n}\n\nexport interface SuspenseHandle {\n token: SuspenseToken\n resolve: () => void\n reject: (err: unknown) => void\n}\n\nexport function createSuspenseToken(): SuspenseHandle {\n let resolve!: () => void\n let reject!: (err: unknown) => void\n const promise = new Promise<void>((res, rej) => {\n resolve = res\n reject = rej\n })\n return {\n token: {\n then: promise.then.bind(promise),\n },\n resolve,\n reject,\n }\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> =>\n typeof value === 'object' &&\n value !== null &&\n typeof (value as PromiseLike<unknown>).then === 'function'\n\nexport function Suspense(props: SuspenseProps): FictNode {\n const pending = createSignal(0)\n let resolvedOnce = false\n let epoch = 0\n const hostRoot = getCurrentRoot()\n\n const toFallback = (err?: unknown) =>\n typeof props.fallback === 'function'\n ? (props.fallback as (e?: unknown) => FictNode)(err)\n : props.fallback\n\n const renderView = (view: FictNode | null) => {\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n if (activeNodes.length) {\n removeNodes(activeNodes)\n activeNodes = []\n }\n\n if (view == null || view === false) {\n return\n }\n\n const root = createRootContext(hostRoot)\n const prev = pushRoot(root)\n let nodes: Node[] = []\n try {\n const output = createElement(view)\n nodes = toNodeArray(output)\n // Suspended view: child threw a suspense token and was handled upstream.\n // Avoid replacing existing fallback content; tear down this attempt.\n const suspendedAttempt =\n root.suspended ||\n (nodes.length > 0 &&\n nodes.every(node => node instanceof Comment && (node as Comment).data === 'fict:suspend'))\n if (suspendedAttempt) {\n popRoot(prev)\n destroyRoot(root)\n return\n }\n const parentNode = marker.parentNode as (ParentNode & Node) | null\n if (parentNode) {\n insertNodesBefore(parentNode, nodes, marker)\n }\n } catch (err) {\n popRoot(prev)\n destroyRoot(root)\n if (!handleError(err, { source: 'render' }, hostRoot)) {\n throw err\n }\n return\n }\n popRoot(prev)\n flushOnMount(root)\n\n cleanup = () => {\n destroyRoot(root)\n removeNodes(nodes)\n }\n activeNodes = nodes\n }\n\n const fragment = document.createDocumentFragment()\n const marker = document.createComment('fict:suspense')\n fragment.appendChild(marker)\n let cleanup: (() => void) | undefined\n let activeNodes: Node[] = []\n\n const onResolveMaybe = () => {\n if (!resolvedOnce) {\n resolvedOnce = true\n props.onResolve?.()\n }\n }\n\n registerSuspenseHandler(token => {\n const tokenEpoch = epoch\n pending(pending() + 1)\n // Directly render fallback instead of using switchView to avoid\n // triggering the effect which would cause duplicate renders\n renderView(toFallback())\n\n const thenable = (token as SuspenseToken).then\n ? (token as SuspenseToken)\n : isThenable(token)\n ? token\n : null\n\n if (thenable) {\n thenable.then(\n () => {\n // This prevents stale token resolutions from affecting state after\n // a reset. The order is important: check epoch first, then update state.\n if (epoch !== tokenEpoch) {\n // Token is stale (from before a reset), ignore it completely\n return\n }\n // Use Math.max as a defensive measure - pending should never go below 0,\n // but this protects against edge cases where a token might resolve twice\n // or after the component has been reset.\n const newPending = Math.max(0, pending() - 1)\n pending(newPending)\n if (newPending === 0) {\n // Directly render children instead of using switchView\n renderView(props.children ?? null)\n onResolveMaybe()\n }\n },\n err => {\n // Same epoch check - ignore stale tokens\n if (epoch !== tokenEpoch) {\n return\n }\n const newPending = Math.max(0, pending() - 1)\n pending(newPending)\n props.onReject?.(err)\n if (!handleError(err, { source: 'render' }, hostRoot)) {\n throw err\n }\n },\n )\n return true\n }\n\n return false\n })\n\n // Initial render - render children directly\n // Note: This will be called synchronously during component creation.\n // If children suspend, the handler above will be called and switch to fallback.\n renderView(props.children ?? null)\n\n if (props.resetKeys !== undefined) {\n const isGetter =\n typeof props.resetKeys === 'function' && (props.resetKeys as () => unknown).length === 0\n const getter = isGetter ? (props.resetKeys as () => unknown) : undefined\n let prev = isGetter ? getter!() : props.resetKeys\n createEffect(() => {\n const next = getter ? getter() : props.resetKeys\n if (prev !== next) {\n prev = next\n epoch++\n pending(0)\n // Directly render children instead of using switchView\n renderView(props.children ?? null)\n }\n })\n }\n\n return fragment\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,YAA2D;AACzE,SAAO,EAAE,SAAS,KAAK;AACzB;;;ACJO,SAAS,cAAc,OAAqC;AACjE,QAAM,WAAW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K,IACd,QACA;AAEN,QAAI,UAAU;AACZ,eAAS;AAAA,QACP,MAAM;AAGJ,cAAI,UAAU,YAAY;AAExB;AAAA,UACF;AAIA,gBAAM,aAAa,KAAK,IAAI,GAAG,QAAQ,IAAI,CAAC;AAC5C,kBAAQ,UAAU;AAClB,cAAI,eAAe,GAAG;AAEpB,uBAAW,MAAM,YAAY,IAAI;AACjC,2BAAe;AAAA,UACjB;AAAA,QACF;AAAA,QACA,SAAO;AAEL,cAAI,UAAU,YAAY;AACxB;AAAA,UACF;AACA,gBAAM,aAAa,KAAK,IAAI,GAAG,QAAQ,IAAI,CAAC;AAC5C,kBAAQ,UAAU;AAClB,gBAAM,WAAW,GAAG;AACpB,cAAI,CAAC,YAAY,KAAK,EAAE,QAAQ,SAAS,GAAG,QAAQ,GAAG;AACrD,kBAAM;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AAKD,aAAW,MAAM,YAAY,IAAI;AAEjC,MAAI,MAAM,cAAc,QAAW;AACjC,UAAM,WACJ,OAAO,MAAM,cAAc,cAAe,MAAM,UAA4B,WAAW;AACzF,UAAM,SAAS,WAAY,MAAM,YAA8B;AAC/D,QAAI,OAAO,WAAW,OAAQ,IAAI,MAAM;AACxC,iBAAa,MAAM;AACjB,YAAM,OAAO,SAAS,OAAO,IAAI,MAAM;AACvC,UAAI,SAAS,MAAM;AACjB,eAAO;AACP;AACA,gBAAQ,CAAC;AAET,mBAAW,MAAM,YAAY,IAAI;AAAA,MACnC;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/ref.ts","../src/error-boundary.ts","../src/suspense.ts"],"sourcesContent":["import type { RefObject } from './types'\n\n/**\n * Create a ref object for DOM element references.\n *\n * @returns A ref object with a `current` property initialized to `null`\n *\n * @example\n * ```tsx\n * import { createRef } from 'fict'\n *\n * function Component() {\n * const inputRef = createRef<HTMLInputElement>()\n *\n * $effect(() => {\n * inputRef.current?.focus()\n * })\n *\n * return <input ref={inputRef} />\n * }\n * ```\n */\nexport function createRef<T extends Element = HTMLElement>(): RefObject<T> {\n return { current: null }\n}\n","import { createElement } from './dom'\nimport { createEffect } from './effect'\nimport {\n createRootContext,\n destroyRoot,\n flushOnMount,\n getCurrentRoot,\n pushRoot,\n popRoot,\n registerErrorHandler,\n} from './lifecycle'\nimport { insertNodesBefore, removeNodes, toNodeArray } from './node-ops'\nimport type { BaseProps, FictNode } from './types'\n\ninterface ErrorBoundaryProps extends BaseProps {\n fallback: FictNode | ((err: unknown, reset?: () => void) => FictNode)\n onError?: (err: unknown) => void\n resetKeys?: unknown | (() => unknown)\n}\n\nexport function ErrorBoundary(props: ErrorBoundaryProps): FictNode {\n const fragment = document.createDocumentFragment()\n const marker = document.createComment('fict:error-boundary')\n fragment.appendChild(marker)\n\n const hostRoot = getCurrentRoot()\n\n let cleanup: (() => void) | undefined\n let activeNodes: Node[] = []\n let renderingFallback = false\n\n let reset = () => {}\n const toView = (err: unknown | null): FictNode | null => {\n if (err != null) {\n return typeof props.fallback === 'function'\n ? (props.fallback as (e: unknown, reset?: () => void) => FictNode)(err, reset)\n : props.fallback\n }\n return props.children ?? null\n }\n\n const renderValue = (value: FictNode | null) => {\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n if (activeNodes.length) {\n removeNodes(activeNodes)\n activeNodes = []\n }\n\n if (value == null || value === false) {\n return\n }\n\n const root = createRootContext(hostRoot)\n const prev = pushRoot(root)\n let nodes: Node[] = []\n try {\n const output = createElement(value)\n nodes = toNodeArray(output)\n const parentNode = marker.parentNode as (ParentNode & Node) | null\n if (parentNode) {\n insertNodesBefore(parentNode, nodes, marker)\n }\n } catch (err) {\n popRoot(prev)\n destroyRoot(root)\n // Fall back immediately on render errors, avoid infinite recursion\n if (renderingFallback) {\n throw err\n }\n // nested errors. If fallback rendering also throws, we should NOT reset\n // the flag until we're sure no more recursion is happening.\n renderingFallback = true\n try {\n renderValue(toView(err))\n // Only reset if successful - if renderValue threw, we want to keep\n // renderingFallback = true to prevent infinite recursion\n renderingFallback = false\n props.onError?.(err)\n } catch (fallbackErr) {\n // Fallback rendering failed - keep renderingFallback = true\n // to prevent further attempts, then rethrow\n // If fallback fails, report both errors\n props.onError?.(err)\n throw fallbackErr\n }\n return\n }\n popRoot(prev)\n flushOnMount(root)\n\n cleanup = () => {\n destroyRoot(root)\n removeNodes(nodes)\n }\n activeNodes = nodes\n }\n\n reset = () => {\n renderingFallback = false\n renderValue(toView(null))\n }\n\n renderValue(props.children ?? null)\n\n registerErrorHandler(err => {\n renderValue(toView(err))\n props.onError?.(err)\n return true\n })\n\n if (props.resetKeys !== undefined) {\n const isGetter =\n typeof props.resetKeys === 'function' && (props.resetKeys as () => unknown).length === 0\n const getter = isGetter ? (props.resetKeys as () => unknown) : undefined\n let prev = isGetter ? getter!() : props.resetKeys\n createEffect(() => {\n const next = getter ? getter() : props.resetKeys\n if (prev !== next) {\n prev = next\n renderValue(toView(null))\n }\n })\n }\n\n return fragment\n}\n","import { createElement } from './dom'\nimport { createEffect } from './effect'\nimport {\n createRootContext,\n destroyRoot,\n flushOnMount,\n getCurrentRoot,\n handleError,\n pushRoot,\n popRoot,\n registerSuspenseHandler,\n} from './lifecycle'\nimport { insertNodesBefore, removeNodes, toNodeArray } from './node-ops'\nimport { createSignal } from './signal'\nimport { __fictGetSSRStreamHooks, __fictPopSSRBoundary, __fictPushSSRBoundary } from './ssr-stream'\nimport type { BaseProps, FictNode, SuspenseToken } from './types'\n\nexport interface SuspenseProps extends BaseProps {\n fallback: FictNode | ((err?: unknown) => FictNode)\n onResolve?: () => void\n onReject?: (err: unknown) => void\n resetKeys?: unknown | (() => unknown)\n}\n\nexport interface SuspenseHandle {\n token: SuspenseToken\n resolve: () => void\n reject: (err: unknown) => void\n}\n\nexport function createSuspenseToken(): SuspenseHandle {\n let resolve!: () => void\n let reject!: (err: unknown) => void\n const promise = new Promise<void>((res, rej) => {\n resolve = res\n reject = rej\n })\n return {\n token: {\n then: promise.then.bind(promise),\n },\n resolve,\n reject,\n }\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> =>\n typeof value === 'object' &&\n value !== null &&\n typeof (value as PromiseLike<unknown>).then === 'function'\n\nexport function Suspense(props: SuspenseProps): FictNode {\n const streamHooks = __fictGetSSRStreamHooks()\n const pending = createSignal(0)\n let resolvedOnce = false\n let epoch = 0\n const hostRoot = getCurrentRoot()\n\n const toFallback = (err?: unknown) =>\n typeof props.fallback === 'function'\n ? (props.fallback as (e?: unknown) => FictNode)(err)\n : props.fallback\n\n const renderView = (view: FictNode | null) => {\n if (cleanup) {\n cleanup()\n cleanup = undefined\n }\n if (activeNodes.length) {\n removeNodes(activeNodes)\n activeNodes = []\n }\n\n if (view == null || view === false) {\n return\n }\n\n const root = createRootContext(hostRoot)\n const prev = pushRoot(root)\n let nodes: Node[] = []\n let boundaryPushed = false\n try {\n if (streamBoundaryId) {\n __fictPushSSRBoundary(streamBoundaryId)\n boundaryPushed = true\n }\n const output = createElement(view)\n nodes = toNodeArray(output)\n // Suspended view: child threw a suspense token and was handled upstream.\n // Avoid replacing existing fallback content; tear down this attempt.\n const suspendedAttempt =\n root.suspended ||\n (nodes.length > 0 &&\n nodes.every(node => node instanceof Comment && (node as Comment).data === 'fict:suspend'))\n if (suspendedAttempt) {\n popRoot(prev)\n destroyRoot(root)\n return\n }\n const parentNode = endMarker.parentNode as (ParentNode & Node) | null\n if (parentNode) {\n insertNodesBefore(parentNode, nodes, endMarker)\n }\n } catch (err) {\n popRoot(prev)\n destroyRoot(root)\n if (!handleError(err, { source: 'render' }, hostRoot)) {\n throw err\n }\n return\n } finally {\n if (boundaryPushed) {\n __fictPopSSRBoundary(streamBoundaryId ?? undefined)\n }\n }\n popRoot(prev)\n flushOnMount(root)\n\n cleanup = () => {\n destroyRoot(root)\n removeNodes(nodes)\n }\n activeNodes = nodes\n }\n\n const fragment = document.createDocumentFragment()\n const startMarker = document.createComment('fict:suspense-start')\n const endMarker = document.createComment('fict:suspense-end')\n fragment.appendChild(startMarker)\n fragment.appendChild(endMarker)\n let cleanup: (() => void) | undefined\n let activeNodes: Node[] = []\n let streamBoundaryId: string | null = null\n let streamPending = false\n\n if (streamHooks?.registerBoundary) {\n streamBoundaryId = streamHooks.registerBoundary(startMarker, endMarker) ?? null\n if (streamBoundaryId) {\n startMarker.data = `fict:suspense-start:${streamBoundaryId}`\n endMarker.data = `fict:suspense-end:${streamBoundaryId}`\n }\n }\n\n const onResolveMaybe = () => {\n if (!resolvedOnce) {\n resolvedOnce = true\n props.onResolve?.()\n }\n }\n\n registerSuspenseHandler(token => {\n const tokenEpoch = epoch\n if (!streamPending && streamBoundaryId && streamHooks?.boundaryPending) {\n streamPending = true\n streamHooks.boundaryPending(streamBoundaryId)\n }\n pending(pending() + 1)\n // Directly render fallback instead of using switchView to avoid\n // triggering the effect which would cause duplicate renders\n renderView(toFallback())\n\n const thenable = (token as SuspenseToken).then\n ? (token as SuspenseToken)\n : isThenable(token)\n ? token\n : null\n\n if (thenable) {\n thenable.then(\n () => {\n // This prevents stale token resolutions from affecting state after\n // a reset. The order is important: check epoch first, then update state.\n if (epoch !== tokenEpoch) {\n // Token is stale (from before a reset), ignore it completely\n return\n }\n // Use Math.max as a defensive measure - pending should never go below 0,\n // but this protects against edge cases where a token might resolve twice\n // or after the component has been reset.\n const newPending = Math.max(0, pending() - 1)\n pending(newPending)\n if (newPending === 0) {\n // Directly render children instead of using switchView\n renderView(props.children ?? null)\n if (streamPending && streamBoundaryId && streamHooks?.boundaryResolved) {\n streamPending = false\n streamHooks.boundaryResolved(streamBoundaryId)\n }\n onResolveMaybe()\n }\n },\n err => {\n // Same epoch check - ignore stale tokens\n if (epoch !== tokenEpoch) {\n return\n }\n const newPending = Math.max(0, pending() - 1)\n pending(newPending)\n let rejectionError = err\n try {\n props.onReject?.(err)\n } catch (callbackError) {\n rejectionError = callbackError\n }\n\n const handled = handleError(rejectionError, { source: 'render' }, hostRoot)\n if (!handled) {\n if (streamHooks?.onError) {\n streamHooks.onError(rejectionError, streamBoundaryId ?? undefined)\n return\n }\n throw rejectionError\n }\n if (\n newPending === 0 &&\n streamPending &&\n streamBoundaryId &&\n streamHooks?.boundaryResolved\n ) {\n streamPending = false\n streamHooks.boundaryResolved(streamBoundaryId)\n }\n },\n )\n return true\n }\n\n return false\n })\n\n // Initial render - render children directly\n // Note: This will be called synchronously during component creation.\n // If children suspend, the handler above will be called and switch to fallback.\n renderView(props.children ?? null)\n\n if (props.resetKeys !== undefined) {\n const isGetter =\n typeof props.resetKeys === 'function' && (props.resetKeys as () => unknown).length === 0\n const getter = isGetter ? (props.resetKeys as () => unknown) : undefined\n let prev = isGetter ? getter!() : props.resetKeys\n createEffect(() => {\n const next = getter ? getter() : props.resetKeys\n if (prev !== next) {\n prev = next\n epoch++\n pending(0)\n // Directly render children instead of using switchView\n renderView(props.children ?? null)\n if (streamPending && streamBoundaryId && streamHooks?.boundaryResolved) {\n streamPending = false\n streamHooks.boundaryResolved(streamBoundaryId)\n }\n }\n })\n }\n\n return fragment\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,SAAS,YAA2D;AACzE,SAAO,EAAE,SAAS,KAAK;AACzB;;;ACJO,SAAS,cAAc,OAAqC;AACjE,QAAM,WAAW,SAAS,uBAAuB;AACjD,QAAM,SAAS,SAAS,cAAc,qBAAqB;AAC3D,WAAS,YAAY,MAAM;AAE3B,QAAM,WAAW,eAAe;AAEhC,MAAI;AACJ,MAAI,cAAsB,CAAC;AAC3B,MAAI,oBAAoB;AAExB,MAAI,QAAQ,MAAM;AAAA,EAAC;AACnB,QAAM,SAAS,CAAC,QAAyC;AACvD,QAAI,OAAO,MAAM;AACf,aAAO,OAAO,MAAM,aAAa,aAC5B,MAAM,SAA0D,KAAK,KAAK,IAC3E,MAAM;AAAA,IACZ;AACA,WAAO,MAAM,YAAY;AAAA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AAY,IAAI;AAEjC,MAAI,MAAM,cAAc,QAAW;AACjC,UAAM,WACJ,OAAO,MAAM,cAAc,cAAe,MAAM,UAA4B,WAAW;AACzF,UAAM,SAAS,WAAY,MAAM,YAA8B;AAC/D,QAAI,OAAO,WAAW,OAAQ,IAAI,MAAM;AACxC,iBAAa,MAAM;AACjB,YAAM,OAAO,SAAS,OAAO,IAAI,MAAM;AACvC,UAAI,SAAS,MAAM;AACjB,eAAO;AACP;AACA,gBAAQ,CAAC;AAET,mBAAW,MAAM,YAAY,IAAI;AACjC,YAAI,iBAAiB,oBAAoB,aAAa,kBAAkB;AACtE,0BAAgB;AAChB,sBAAY,iBAAiB,gBAAgB;AAAA,QAC/C;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
|
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 _chunkQB2UD62Gcjs = require('./chunk-QB2UD62G.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -41,7 +41,7 @@ var _chunkGHUV2FLDcjs = require('./chunk-GHUV2FLD.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunkZ6M3HKLGcjs = require('./chunk-Z6M3HKLG.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -102,7 +102,12 @@ var _chunkTKWN42TAcjs = require('./chunk-TKWN42TA.cjs');
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
var _chunkZR435MDCcjs = require('./chunk-ZR435MDC.cjs');
|
|
106
111
|
|
|
107
112
|
// src/reconcile.ts
|
|
108
113
|
function reconcileArrays(parentNode, a, b) {
|
|
@@ -192,6 +197,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
192
197
|
|
|
193
198
|
// src/list-helpers.ts
|
|
194
199
|
var isDev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process === "undefined" || _optionalChain([process, 'access', _7 => _7.env, 'optionalAccess', _8 => _8.NODE_ENV]) !== "production";
|
|
200
|
+
var isShadowRoot = (node) => typeof ShadowRoot !== "undefined" && node instanceof ShadowRoot;
|
|
195
201
|
function moveNodesBefore(parent, nodes, anchor) {
|
|
196
202
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
197
203
|
const node = nodes[i];
|
|
@@ -231,7 +237,7 @@ var MAX_SAFE_VERSION = 9007199254740991;
|
|
|
231
237
|
function createVersionedSignalAccessor(initialValue) {
|
|
232
238
|
let current = initialValue;
|
|
233
239
|
let version = 0;
|
|
234
|
-
const track =
|
|
240
|
+
const track = _chunkZR435MDCcjs.signal.call(void 0, version);
|
|
235
241
|
function accessor(value) {
|
|
236
242
|
if (arguments.length === 0) {
|
|
237
243
|
track();
|
|
@@ -248,7 +254,7 @@ function createKeyedListContainer(startOverride, endOverride) {
|
|
|
248
254
|
const endMarker = _nullishCoalesce(endOverride, () => ( document.createComment("fict:list:end")));
|
|
249
255
|
const dispose = () => {
|
|
250
256
|
for (const block of container.blocks.values()) {
|
|
251
|
-
|
|
257
|
+
_chunkZR435MDCcjs.destroyRoot.call(void 0, block.root);
|
|
252
258
|
}
|
|
253
259
|
container.blocks.clear();
|
|
254
260
|
container.nextBlocks.clear();
|
|
@@ -287,32 +293,32 @@ function createKeyedListContainer(startOverride, endOverride) {
|
|
|
287
293
|
}
|
|
288
294
|
function createKeyedBlock(key, item, index, render2, needsIndex = true, hostRoot) {
|
|
289
295
|
const itemSig = createVersionedSignalAccessor(item);
|
|
290
|
-
const indexSig = needsIndex ?
|
|
296
|
+
const indexSig = needsIndex ? _chunkZR435MDCcjs.signal.call(void 0, index) : ((next) => {
|
|
291
297
|
if (arguments.length === 0) return index;
|
|
292
298
|
index = next;
|
|
293
299
|
return index;
|
|
294
300
|
});
|
|
295
|
-
const root =
|
|
296
|
-
const prevRoot =
|
|
301
|
+
const root = _chunkZR435MDCcjs.createRootContext.call(void 0, hostRoot);
|
|
302
|
+
const prevRoot = _chunkZR435MDCcjs.pushRoot.call(void 0, root);
|
|
297
303
|
let nodes = [];
|
|
298
304
|
let scopeDispose;
|
|
299
|
-
const prevSub =
|
|
305
|
+
const prevSub = _chunkZR435MDCcjs.setActiveSub.call(void 0, void 0);
|
|
300
306
|
try {
|
|
301
|
-
scopeDispose =
|
|
307
|
+
scopeDispose = _chunkZR435MDCcjs.effectScope.call(void 0, () => {
|
|
302
308
|
const rendered = render2(itemSig, indexSig, key);
|
|
303
309
|
if (rendered instanceof Node || Array.isArray(rendered) && rendered.every((n) => n instanceof Node)) {
|
|
304
|
-
nodes =
|
|
310
|
+
nodes = _chunkZ6M3HKLGcjs.toNodeArray.call(void 0, rendered);
|
|
305
311
|
} else {
|
|
306
|
-
const element =
|
|
307
|
-
nodes =
|
|
312
|
+
const element = _chunkZ6M3HKLGcjs.createElement.call(void 0, rendered);
|
|
313
|
+
nodes = _chunkZ6M3HKLGcjs.toNodeArray.call(void 0, element);
|
|
308
314
|
}
|
|
309
315
|
});
|
|
310
316
|
if (scopeDispose) {
|
|
311
317
|
root.cleanups.push(scopeDispose);
|
|
312
318
|
}
|
|
313
319
|
} finally {
|
|
314
|
-
|
|
315
|
-
|
|
320
|
+
_chunkZR435MDCcjs.setActiveSub.call(void 0, prevSub);
|
|
321
|
+
_chunkZR435MDCcjs.popRoot.call(void 0, prevRoot);
|
|
316
322
|
}
|
|
317
323
|
return {
|
|
318
324
|
key,
|
|
@@ -425,7 +431,7 @@ function createKeyedList(getItems, keyFn, renderItem, needsIndex, startMarker, e
|
|
|
425
431
|
}
|
|
426
432
|
function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, startOverride, endOverride) {
|
|
427
433
|
const container = createKeyedListContainer(startOverride, endOverride);
|
|
428
|
-
const hostRoot =
|
|
434
|
+
const hostRoot = _chunkZR435MDCcjs.getCurrentRoot.call(void 0, );
|
|
429
435
|
const useProvided = !!(startOverride && endOverride);
|
|
430
436
|
const fragment = useProvided ? container.startMarker : document.createDocumentFragment();
|
|
431
437
|
if (!useProvided) {
|
|
@@ -437,7 +443,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
437
443
|
let connectObserver = null;
|
|
438
444
|
let effectStarted = false;
|
|
439
445
|
let startScheduled = false;
|
|
440
|
-
let initialHydrating =
|
|
446
|
+
let initialHydrating = _chunkZR435MDCcjs.__fictIsHydrating.call(void 0, );
|
|
441
447
|
const collectBetween = () => {
|
|
442
448
|
const nodes = [];
|
|
443
449
|
let cursor = container.startMarker.nextSibling;
|
|
@@ -455,21 +461,27 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
455
461
|
if ("isConnected" in parentNode && !parentNode.isConnected) return null;
|
|
456
462
|
return parentNode;
|
|
457
463
|
}
|
|
464
|
+
if (endParent && startParent && endParent === startParent && isShadowRoot(endParent)) {
|
|
465
|
+
const shadowRoot = endParent;
|
|
466
|
+
const host = shadowRoot.host;
|
|
467
|
+
if ("isConnected" in host && !host.isConnected) return null;
|
|
468
|
+
return shadowRoot;
|
|
469
|
+
}
|
|
458
470
|
return null;
|
|
459
471
|
};
|
|
460
472
|
const performDiff = () => {
|
|
461
473
|
if (disposed) return;
|
|
462
|
-
const isSSR =
|
|
474
|
+
const isSSR = _chunkZR435MDCcjs.__fictIsSSR.call(void 0, );
|
|
463
475
|
const parent = isSSR ? container.startMarker.parentNode : getConnectedParent();
|
|
464
476
|
if (!parent) return;
|
|
465
|
-
|
|
477
|
+
_chunkZ6M3HKLGcjs.batch.call(void 0, () => {
|
|
466
478
|
const oldBlocks = container.blocks;
|
|
467
479
|
const newBlocks = container.nextBlocks;
|
|
468
480
|
const prevOrderedBlocks = container.orderedBlocks;
|
|
469
481
|
const nextOrderedBlocks = container.nextOrderedBlocks;
|
|
470
482
|
const orderedIndexByKey = container.orderedIndexByKey;
|
|
471
483
|
const newItems = getItems();
|
|
472
|
-
if (initialHydrating &&
|
|
484
|
+
if (initialHydrating && _chunkZ6M3HKLGcjs.isHydratingActive.call(void 0, )) {
|
|
473
485
|
initialHydrating = false;
|
|
474
486
|
newBlocks.clear();
|
|
475
487
|
nextOrderedBlocks.length = 0;
|
|
@@ -482,7 +494,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
482
494
|
return;
|
|
483
495
|
}
|
|
484
496
|
const createdBlocks2 = [];
|
|
485
|
-
|
|
497
|
+
_chunkZ6M3HKLGcjs.withHydrationRange.call(void 0,
|
|
486
498
|
container.startMarker.nextSibling,
|
|
487
499
|
container.endMarker,
|
|
488
500
|
_nullishCoalesce(parent.ownerDocument, () => ( document)),
|
|
@@ -498,8 +510,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
498
510
|
}
|
|
499
511
|
const existing = newBlocks.get(key);
|
|
500
512
|
if (existing) {
|
|
501
|
-
|
|
502
|
-
|
|
513
|
+
_chunkZR435MDCcjs.destroyRoot.call(void 0, existing.root);
|
|
514
|
+
_chunkZ6M3HKLGcjs.removeNodes.call(void 0, existing.nodes);
|
|
503
515
|
}
|
|
504
516
|
}
|
|
505
517
|
const block = createKeyedBlock(key, item, index, renderItem, needsIndex, hostRoot);
|
|
@@ -520,7 +532,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
520
532
|
container.nextNodes.length = 0;
|
|
521
533
|
for (const block of createdBlocks2) {
|
|
522
534
|
if (newBlocks.get(block.key) === block) {
|
|
523
|
-
|
|
535
|
+
_chunkZR435MDCcjs.flushOnMount.call(void 0, block.root);
|
|
524
536
|
}
|
|
525
537
|
}
|
|
526
538
|
return;
|
|
@@ -528,7 +540,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
528
540
|
if (newItems.length === 0) {
|
|
529
541
|
if (oldBlocks.size > 0) {
|
|
530
542
|
for (const block of oldBlocks.values()) {
|
|
531
|
-
|
|
543
|
+
_chunkZR435MDCcjs.destroyRoot.call(void 0, block.root);
|
|
532
544
|
}
|
|
533
545
|
const range = document.createRange();
|
|
534
546
|
range.setStartAfter(container.startMarker);
|
|
@@ -609,8 +621,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
609
621
|
`[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.`
|
|
610
622
|
);
|
|
611
623
|
}
|
|
612
|
-
|
|
613
|
-
|
|
624
|
+
_chunkZR435MDCcjs.destroyRoot.call(void 0, existingBlock.root);
|
|
625
|
+
_chunkZ6M3HKLGcjs.removeNodes.call(void 0, existingBlock.nodes);
|
|
614
626
|
}
|
|
615
627
|
block = createKeyedBlock(key, item, index, renderItem, needsIndex, hostRoot);
|
|
616
628
|
createdBlocks.push(block);
|
|
@@ -623,8 +635,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
623
635
|
hasDuplicateKey = true;
|
|
624
636
|
const prior = nextOrderedBlocks[position];
|
|
625
637
|
if (prior && prior !== resolvedBlock) {
|
|
626
|
-
|
|
627
|
-
|
|
638
|
+
_chunkZR435MDCcjs.destroyRoot.call(void 0, prior.root);
|
|
639
|
+
_chunkZ6M3HKLGcjs.removeNodes.call(void 0, prior.nodes);
|
|
628
640
|
}
|
|
629
641
|
nextOrderedBlocks[position] = resolvedBlock;
|
|
630
642
|
} else {
|
|
@@ -662,7 +674,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
662
674
|
}
|
|
663
675
|
}
|
|
664
676
|
if (appendedNodes.length > 0) {
|
|
665
|
-
|
|
677
|
+
_chunkZ6M3HKLGcjs.insertNodesBefore.call(void 0, parent, appendedNodes, container.endMarker);
|
|
666
678
|
const currentNodes = container.currentNodes;
|
|
667
679
|
currentNodes.pop();
|
|
668
680
|
for (let i = 0; i < appendedNodes.length; i++) {
|
|
@@ -676,15 +688,15 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
676
688
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
677
689
|
for (const block of createdBlocks) {
|
|
678
690
|
if (newBlocks.get(block.key) === block) {
|
|
679
|
-
|
|
691
|
+
_chunkZR435MDCcjs.flushOnMount.call(void 0, block.root);
|
|
680
692
|
}
|
|
681
693
|
}
|
|
682
694
|
return;
|
|
683
695
|
}
|
|
684
696
|
if (oldBlocks.size > 0) {
|
|
685
697
|
for (const block of oldBlocks.values()) {
|
|
686
|
-
|
|
687
|
-
|
|
698
|
+
_chunkZR435MDCcjs.destroyRoot.call(void 0, block.root);
|
|
699
|
+
_chunkZ6M3HKLGcjs.removeNodes.call(void 0, block.nodes);
|
|
688
700
|
}
|
|
689
701
|
oldBlocks.clear();
|
|
690
702
|
}
|
|
@@ -743,7 +755,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
743
755
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
744
756
|
for (const block of createdBlocks) {
|
|
745
757
|
if (newBlocks.get(block.key) === block) {
|
|
746
|
-
|
|
758
|
+
_chunkZR435MDCcjs.flushOnMount.call(void 0, block.root);
|
|
747
759
|
}
|
|
748
760
|
}
|
|
749
761
|
});
|
|
@@ -754,19 +766,19 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
754
766
|
};
|
|
755
767
|
const ensureEffectStarted = () => {
|
|
756
768
|
if (disposed || effectStarted) return effectStarted;
|
|
757
|
-
const isSSR =
|
|
769
|
+
const isSSR = _chunkZR435MDCcjs.__fictIsSSR.call(void 0, );
|
|
758
770
|
const parent = isSSR ? container.startMarker.parentNode : getConnectedParent();
|
|
759
771
|
if (!parent) return false;
|
|
760
772
|
const start = () => {
|
|
761
|
-
effectDispose =
|
|
773
|
+
effectDispose = _chunkZR435MDCcjs.createRenderEffect.call(void 0, performDiff);
|
|
762
774
|
effectStarted = true;
|
|
763
775
|
};
|
|
764
776
|
if (hostRoot) {
|
|
765
|
-
const prev =
|
|
777
|
+
const prev = _chunkZR435MDCcjs.pushRoot.call(void 0, hostRoot);
|
|
766
778
|
try {
|
|
767
779
|
start();
|
|
768
780
|
} finally {
|
|
769
|
-
|
|
781
|
+
_chunkZR435MDCcjs.popRoot.call(void 0, prev);
|
|
770
782
|
}
|
|
771
783
|
} else {
|
|
772
784
|
start();
|
|
@@ -775,16 +787,21 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
775
787
|
};
|
|
776
788
|
const waitForConnection = () => {
|
|
777
789
|
if (connectObserver || typeof MutationObserver === "undefined") return;
|
|
790
|
+
const root = _nullishCoalesce(_optionalChain([container, 'access', _11 => _11.startMarker, 'access', _12 => _12.getRootNode, 'optionalCall', _13 => _13()]), () => ( document));
|
|
791
|
+
const shadowRoot = root && root.nodeType === 11 && isShadowRoot(root) ? root : null;
|
|
778
792
|
connectObserver = new MutationObserver(() => {
|
|
779
793
|
if (disposed) return;
|
|
780
794
|
if (getConnectedParent()) {
|
|
781
795
|
disconnectObserver();
|
|
782
796
|
if (ensureEffectStarted()) {
|
|
783
|
-
|
|
797
|
+
_chunkZR435MDCcjs.flush.call(void 0, );
|
|
784
798
|
}
|
|
785
799
|
}
|
|
786
800
|
});
|
|
787
801
|
connectObserver.observe(document, { childList: true, subtree: true });
|
|
802
|
+
if (shadowRoot) {
|
|
803
|
+
connectObserver.observe(shadowRoot, { childList: true, subtree: true });
|
|
804
|
+
}
|
|
788
805
|
};
|
|
789
806
|
const scheduleStart = () => {
|
|
790
807
|
if (startScheduled || disposed || effectStarted) return;
|
|
@@ -814,14 +831,14 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
814
831
|
if (disposed) return;
|
|
815
832
|
scheduleStart();
|
|
816
833
|
if (ensureEffectStarted()) {
|
|
817
|
-
|
|
834
|
+
_chunkZR435MDCcjs.flush.call(void 0, );
|
|
818
835
|
} else {
|
|
819
836
|
waitForConnection();
|
|
820
837
|
}
|
|
821
838
|
},
|
|
822
839
|
dispose: () => {
|
|
823
840
|
disposed = true;
|
|
824
|
-
_optionalChain([effectDispose, 'optionalCall',
|
|
841
|
+
_optionalChain([effectDispose, 'optionalCall', _14 => _14()]);
|
|
825
842
|
disconnectObserver();
|
|
826
843
|
container.dispose();
|
|
827
844
|
}
|
|
@@ -919,5 +936,10 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex, sta
|
|
|
919
936
|
|
|
920
937
|
|
|
921
938
|
|
|
922
|
-
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
exports.Aliases = _chunkZR435MDCcjs.Aliases; exports.BooleanAttributes = _chunkZR435MDCcjs.BooleanAttributes; exports.ChildProperties = _chunkZR435MDCcjs.ChildProperties; exports.DelegatedEvents = _chunkZR435MDCcjs.DelegatedEvents; exports.Fragment = _chunkZ6M3HKLGcjs.Fragment; exports.Properties = _chunkZR435MDCcjs.Properties; exports.SVGElements = _chunkZR435MDCcjs.SVGElements; exports.SVGNamespace = _chunkZR435MDCcjs.SVGNamespace; exports.UnitlessStyles = _chunkZR435MDCcjs.UnitlessStyles; exports.__fictDisableResumable = _chunkZR435MDCcjs.__fictDisableResumable; exports.__fictDisableSSR = _chunkZR435MDCcjs.__fictDisableSSR; exports.__fictEnableResumable = _chunkZR435MDCcjs.__fictEnableResumable; exports.__fictEnableSSR = _chunkZR435MDCcjs.__fictEnableSSR; exports.__fictEnsureScope = _chunkZR435MDCcjs.__fictEnsureScope; exports.__fictEnterHydration = _chunkZR435MDCcjs.__fictEnterHydration; exports.__fictExitHydration = _chunkZR435MDCcjs.__fictExitHydration; exports.__fictGetResume = _chunkZR435MDCcjs.__fictGetResume; exports.__fictGetSSRScope = _chunkZR435MDCcjs.__fictGetSSRScope; exports.__fictGetSSRStreamHooks = _chunkZR435MDCcjs.__fictGetSSRStreamHooks; exports.__fictGetScopeProps = _chunkZR435MDCcjs.__fictGetScopeProps; exports.__fictGetScopeRegistry = _chunkZR435MDCcjs.__fictGetScopeRegistry; exports.__fictGetScopesForBoundary = _chunkZR435MDCcjs.__fictGetScopesForBoundary; exports.__fictIsHydrating = _chunkZR435MDCcjs.__fictIsHydrating; exports.__fictIsResumable = _chunkZR435MDCcjs.__fictIsResumable; exports.__fictIsSSR = _chunkZR435MDCcjs.__fictIsSSR; exports.__fictMergeSSRState = _chunkZR435MDCcjs.__fictMergeSSRState; exports.__fictPopContext = _chunkZR435MDCcjs.__fictPopContext; exports.__fictPrepareContext = _chunkZR435MDCcjs.__fictPrepareContext; exports.__fictProp = _chunkZ6M3HKLGcjs.__fictProp; exports.__fictPropsRest = _chunkZ6M3HKLGcjs.__fictPropsRest; exports.__fictPushContext = _chunkZR435MDCcjs.__fictPushContext; exports.__fictQrl = _chunkZR435MDCcjs.__fictQrl; exports.__fictRegisterResume = _chunkZR435MDCcjs.__fictRegisterResume; exports.__fictRegisterScope = _chunkZR435MDCcjs.__fictRegisterScope; exports.__fictRender = _chunkZR435MDCcjs.__fictRender; exports.__fictResetContext = _chunkZR435MDCcjs.__fictResetContext; exports.__fictSerializeSSRState = _chunkZR435MDCcjs.__fictSerializeSSRState; exports.__fictSerializeSSRStateForScopes = _chunkZR435MDCcjs.__fictSerializeSSRStateForScopes; exports.__fictSetSSRState = _chunkZR435MDCcjs.__fictSetSSRState; exports.__fictSetSSRStreamHooks = _chunkZR435MDCcjs.__fictSetSSRStreamHooks; exports.__fictUseContext = _chunkZR435MDCcjs.__fictUseContext; exports.__fictUseEffect = _chunkZR435MDCcjs.__fictUseEffect; exports.__fictUseLexicalScope = _chunkZR435MDCcjs.__fictUseLexicalScope; exports.__fictUseMemo = _chunkZR435MDCcjs.__fictUseMemo; exports.__fictUseSignal = _chunkZR435MDCcjs.__fictUseSignal; exports.__resetReactiveState = _chunkZR435MDCcjs.__resetReactiveState; exports.addEventListener = _chunkZ6M3HKLGcjs.addEventListener; exports.assign = _chunkZ6M3HKLGcjs.assign; exports.bindAttribute = _chunkZ6M3HKLGcjs.bindAttribute; exports.bindClass = _chunkZ6M3HKLGcjs.bindClass; exports.bindEvent = _chunkZ6M3HKLGcjs.bindEvent; exports.bindProperty = _chunkZ6M3HKLGcjs.bindProperty; exports.bindRef = _chunkZ6M3HKLGcjs.bindRef; exports.bindStyle = _chunkZ6M3HKLGcjs.bindStyle; exports.bindText = _chunkZ6M3HKLGcjs.bindText; exports.callEventHandler = _chunkZ6M3HKLGcjs.callEventHandler; exports.classList = _chunkZ6M3HKLGcjs.classList; exports.clearDelegatedEvents = _chunkZ6M3HKLGcjs.clearDelegatedEvents; exports.createConditional = _chunkZ6M3HKLGcjs.createConditional; exports.createEffect = _chunkZR435MDCcjs.createEffect; exports.createElement = _chunkZ6M3HKLGcjs.createElement; exports.createKeyedList = createKeyedList; exports.createMemo = _chunkZR435MDCcjs.createMemo; exports.createPortal = _chunkZ6M3HKLGcjs.createPortal; exports.createPropsProxy = _chunkZ6M3HKLGcjs.createPropsProxy; exports.createRenderEffect = _chunkZR435MDCcjs.createRenderEffect; exports.createSelector = _chunkZR435MDCcjs.createSelector; exports.createSignal = _chunkZR435MDCcjs.signal; exports.createStore = _chunkZR435MDCcjs.createStore; exports.delegateEvents = _chunkZ6M3HKLGcjs.delegateEvents; exports.deserializeValue = _chunkZR435MDCcjs.deserializeValue; exports.getPropAlias = _chunkZR435MDCcjs.getPropAlias; exports.getSlotEnd = _chunkZ6M3HKLGcjs.getSlotEnd; exports.hydrateComponent = _chunkZ6M3HKLGcjs.hydrateComponent; exports.insert = _chunkZ6M3HKLGcjs.insert; exports.insertBetween = _chunkZ6M3HKLGcjs.insertBetween; exports.insertNodesBefore = _chunkZ6M3HKLGcjs.insertNodesBefore; exports.isNodeBetweenMarkers = isNodeBetweenMarkers; exports.isReactive = _chunkZ6M3HKLGcjs.isReactive; exports.isStoreProxy = _chunkZR435MDCcjs.isStoreProxy; exports.keyed = _chunkZ6M3HKLGcjs.keyed; exports.mergeProps = _chunkZ6M3HKLGcjs.mergeProps; exports.moveNodesBefore = moveNodesBefore; exports.onDestroy = _chunkZR435MDCcjs.onDestroy; exports.prop = _chunkZ6M3HKLGcjs.prop; exports.reconcileArrays = reconcileArrays; exports.removeNodes = _chunkZ6M3HKLGcjs.removeNodes; exports.render = _chunkZ6M3HKLGcjs.render; exports.resolvePath = _chunkZ6M3HKLGcjs.resolvePath; exports.runInScope = _chunkQB2UD62Gcjs.runInScope; exports.serializeValue = _chunkZR435MDCcjs.serializeValue; exports.spread = _chunkZ6M3HKLGcjs.spread; exports.template = _chunkZ6M3HKLGcjs.template; exports.toNodeArray = _chunkZ6M3HKLGcjs.toNodeArray; exports.unwrap = _chunkZ6M3HKLGcjs.unwrap; exports.unwrapStore = _chunkZR435MDCcjs.unwrapStore;
|
|
923
945
|
//# sourceMappingURL=internal.cjs.map
|