+2
-2
@@ -496,6 +496,6 @@ # Solid 2.0 — Cheatsheet | ||
| ```ts | ||
| import { renderToString, renderToStringAsync, renderToStream, isServer, isDev } from "@solidjs/web"; | ||
| import { renderToString, renderToStream, isServer, isDev } from "@solidjs/web"; | ||
| ``` | ||
| `Portal` throws on the server. `Reveal` `order="together"` and `collapsed` require streaming (`renderToStream` / `renderToStringAsync`). | ||
| `Portal` throws on the server. `Reveal` `order="together"` and `collapsed` require streaming (`renderToStream` — awaiting it yields the fully settled HTML string). | ||
@@ -502,0 +502,0 @@ --- |
+9
-2
@@ -595,3 +595,5 @@ 'use strict'; | ||
| pending: anyFragmentPending, | ||
| subscribe: subscribeFragments | ||
| subscribe: subscribeFragments, | ||
| claim: claimFragment, | ||
| release: releaseFragment | ||
| }; | ||
@@ -744,2 +746,6 @@ const prevFe = hy.fe; | ||
| } | ||
| function releaseFragment(id) { | ||
| const f = _fragments.get(id); | ||
| if (f) f.claimed = false; | ||
| } | ||
| function fragmentPending(hy, id) { | ||
@@ -751,3 +757,4 @@ if (_truncated.has(id)) return false; | ||
| if (hy.v && hy.v[id]) return false; | ||
| return !!document.getElementById(id); | ||
| if (!document.getElementById(id)) return false; | ||
| return !!document.getElementById("pl-" + id); | ||
| } | ||
@@ -754,0 +761,0 @@ function anyFragmentPending() { |
+9
-2
@@ -594,3 +594,5 @@ import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, getOwner, untrack, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createRevealOrder as createRevealOrder$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, peekNextChildId, getNextChildId, clearSnapshots, flush, markSnapshotScope, onCleanup, isDisposed, mapArray, repeat, DEV as DEV$1 } from '@solidjs/signals'; | ||
| pending: anyFragmentPending, | ||
| subscribe: subscribeFragments | ||
| subscribe: subscribeFragments, | ||
| claim: claimFragment, | ||
| release: releaseFragment | ||
| }; | ||
@@ -743,2 +745,6 @@ const prevFe = hy.fe; | ||
| } | ||
| function releaseFragment(id) { | ||
| const f = _fragments.get(id); | ||
| if (f) f.claimed = false; | ||
| } | ||
| function fragmentPending(hy, id) { | ||
@@ -750,3 +756,4 @@ if (_truncated.has(id)) return false; | ||
| if (hy.v && hy.v[id]) return false; | ||
| return !!document.getElementById(id); | ||
| if (!document.getElementById(id)) return false; | ||
| return !!document.getElementById("pl-" + id); | ||
| } | ||
@@ -753,0 +760,0 @@ function anyFragmentPending() { |
+105
-52
@@ -35,5 +35,2 @@ 'use strict'; | ||
| } | ||
| function consumeClientComputedSlot(owner) { | ||
| if (owner?.id != null) nextChildIdFor(owner, true); | ||
| } | ||
| function getNextChildId(owner) { | ||
@@ -332,2 +329,4 @@ return nextChildIdFor(owner, true); | ||
| update(); | ||
| } else if (comp.sync && ctx?.commitEpoch && ctx.commitEpoch() !== comp.epoch) { | ||
| update(); | ||
| } | ||
@@ -343,2 +342,3 @@ if (comp.errored) { | ||
| function createSyncMemo(compute, options) { | ||
| const ctx = sharedConfig.context; | ||
| const owner = createOwner(); | ||
@@ -349,2 +349,3 @@ let value; | ||
| let cached = false; | ||
| let epoch; | ||
| function pull() { | ||
@@ -359,2 +360,3 @@ const prev = currentOwner; | ||
| cached = true; | ||
| epoch = ctx?.commitEpoch?.(); | ||
| return value; | ||
@@ -366,2 +368,3 @@ } catch (err) { | ||
| cached = true; | ||
| epoch = ctx?.commitEpoch?.(); | ||
| throw err; | ||
@@ -379,3 +382,3 @@ } finally { | ||
| return () => { | ||
| if (cached) { | ||
| if (cached && (!ctx?.commitEpoch || ctx.commitEpoch() === epoch)) { | ||
| if (errored) throw error; | ||
@@ -450,2 +453,3 @@ return value; | ||
| const id = owner.id; | ||
| comp.sync = false; | ||
| const noHydrate = serialize === false || getContext(NoHydrateContext, owner); | ||
@@ -472,2 +476,3 @@ if (typeof result?.[Symbol.asyncIterator] !== "function" && isThenable(result)) { | ||
| comp.errored = false; | ||
| ctx?.commit?.(); | ||
| return value; | ||
@@ -479,2 +484,3 @@ }, error => { | ||
| comp.errored = true; | ||
| ctx?.commit?.(); | ||
| }, () => comp.disposed); | ||
@@ -508,2 +514,3 @@ comp.error = new signals.NotReadyError(deferred.promise); | ||
| comp.errored = false; | ||
| ctx?.commit?.(); | ||
| return value; | ||
@@ -513,2 +520,3 @@ }, error => { | ||
| comp.errored = true; | ||
| ctx?.commit?.(); | ||
| }, () => comp.disposed); | ||
@@ -543,2 +551,3 @@ if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream); | ||
| comp.errored = false; | ||
| ctx?.commit?.(); | ||
| return undefined; | ||
@@ -548,2 +557,3 @@ }, error => { | ||
| comp.errored = true; | ||
| ctx?.commit?.(); | ||
| }, () => comp.disposed); | ||
@@ -570,2 +580,20 @@ if (ctx?.async && ctx.serialize && id && !noHydrate) { | ||
| ctx.serialize(id, tapped, deferStream); | ||
| } else if (ctx?.commit) { | ||
| const pump = () => { | ||
| if (comp.disposed) { | ||
| closeAsyncIterator(iter); | ||
| return; | ||
| } | ||
| iter.next().then(r => { | ||
| if (comp.disposed) { | ||
| closeAsyncIterator(iter); | ||
| return; | ||
| } | ||
| if (r.done) return; | ||
| comp.value = r.value; | ||
| ctx.commit(); | ||
| pump(); | ||
| }, () => {}); | ||
| }; | ||
| deferred.promise.then(pump, () => {}); | ||
| } | ||
@@ -578,2 +606,4 @@ comp.error = new signals.NotReadyError(deferred.promise); | ||
| comp.value = result; | ||
| comp.sync = true; | ||
| comp.epoch = ctx?.commitEpoch?.(); | ||
| } | ||
@@ -918,24 +948,25 @@ function closeAsyncIterator(iter, value) { | ||
| const indexes = mapFn.length > 1; | ||
| const parent = currentOwner; | ||
| const rowOwner = createOwner(); | ||
| const read = createMemo(() => { | ||
| const items = list(); | ||
| const s = []; | ||
| rowOwner._childCount = 0; | ||
| if (items && items.length) { | ||
| const parent = currentOwner; | ||
| const origId = parent.id; | ||
| const origChildCount = parent._childCount; | ||
| try { | ||
| for (let i = 0, len = items.length; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| parent.id = formatChildId(origId, origChildCount + i); | ||
| runWithOwner(rowOwner, () => { | ||
| const origId = rowOwner.id; | ||
| try { | ||
| for (let i = 0, len = items.length; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| rowOwner.id = formatChildId(origId, i); | ||
| } | ||
| rowOwner._childCount = 0; | ||
| s.push(options.keyed === false ? indexes ? mapFn(() => items[i], i) : mapFn(() => items[i]) : typeof options.keyed === "function" ? indexes ? mapFn(() => items[i], () => i) : mapFn(() => items[i]) : indexes ? mapFn(items[i], () => i) : mapFn(items[i])); | ||
| } | ||
| parent._childCount = 0; | ||
| s.push(options.keyed === false ? indexes ? mapFn(() => items[i], i) : mapFn(() => items[i]) : typeof options.keyed === "function" ? indexes ? mapFn(() => items[i], () => i) : mapFn(() => items[i]) : indexes ? mapFn(items[i], () => i) : mapFn(items[i])); | ||
| } finally { | ||
| rowOwner.id = origId; | ||
| rowOwner._childCount = items.length; | ||
| } | ||
| } finally { | ||
| parent.id = origId; | ||
| parent._childCount = origChildCount + items.length; | ||
| } | ||
| }); | ||
| } else if (options.fallback) { | ||
| const fo = createOwner(); | ||
| const fo = runWithOwner(rowOwner, () => createOwner()); | ||
| s.push(runWithOwner(fo, () => options.fallback())); | ||
@@ -947,31 +978,31 @@ } | ||
| }); | ||
| consumeClientComputedSlot(parent); | ||
| return read; | ||
| } | ||
| function repeat(count, mapFn, options = {}) { | ||
| const parent = currentOwner; | ||
| const rowOwner = createOwner(); | ||
| const read = createMemo(() => { | ||
| const len = count(); | ||
| const offset = options.from?.() || 0; | ||
| rowOwner._childCount = 0; | ||
| if (!len) { | ||
| if (!options.fallback) return []; | ||
| const fo = createOwner(); | ||
| const fo = runWithOwner(rowOwner, () => createOwner()); | ||
| return [runWithOwner(fo, () => options.fallback())]; | ||
| } | ||
| const out = new Array(len); | ||
| const parent = currentOwner; | ||
| const origId = parent.id; | ||
| const origChildCount = parent._childCount; | ||
| try { | ||
| for (let i = 0; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| parent.id = formatChildId(origId, origChildCount + i); | ||
| runWithOwner(rowOwner, () => { | ||
| const origId = rowOwner.id; | ||
| try { | ||
| for (let i = 0; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| rowOwner.id = formatChildId(origId, i); | ||
| } | ||
| rowOwner._childCount = 0; | ||
| out[i] = mapFn(i + offset); | ||
| } | ||
| parent._childCount = 0; | ||
| out[i] = mapFn(i + offset); | ||
| } finally { | ||
| rowOwner.id = origId; | ||
| rowOwner._childCount = len; | ||
| } | ||
| } finally { | ||
| parent.id = origId; | ||
| parent._childCount = origChildCount + len; | ||
| } | ||
| }); | ||
| return out; | ||
@@ -981,3 +1012,2 @@ }, { | ||
| }); | ||
| consumeClientComputedSlot(parent); | ||
| return read; | ||
@@ -996,5 +1026,9 @@ } | ||
| const prevBoundary = context?._currentBoundaryId; | ||
| const prevLoadingPhase = context?._loadingPhase; | ||
| if (context) { | ||
| sharedConfig.context = context; | ||
| if (boundaryId !== undefined) context._currentBoundaryId = boundaryId; | ||
| if (boundaryId !== undefined) { | ||
| context._currentBoundaryId = boundaryId; | ||
| context._loadingPhase = true; | ||
| } | ||
| } | ||
@@ -1009,3 +1043,6 @@ try { | ||
| if (context) { | ||
| if (boundaryId !== undefined) context._currentBoundaryId = prevBoundary; | ||
| if (boundaryId !== undefined) { | ||
| context._currentBoundaryId = prevBoundary; | ||
| context._loadingPhase = prevLoadingPhase; | ||
| } | ||
| sharedConfig.context = prevCtx; | ||
@@ -1295,6 +1332,7 @@ } | ||
| function ssrHandleError(err) { | ||
| function ssrHandleError(err, probe) { | ||
| if (err instanceof signals.NotReadyError) { | ||
| return err.source; | ||
| } | ||
| if (probe) return; | ||
| const handler = getContext(ErrorContext); | ||
@@ -1469,9 +1507,9 @@ if (handler) { | ||
| function Show(props) { | ||
| const conditionValue = createMemo(() => props.when); | ||
| const o = getOwner(); | ||
| if (o?.id != null) { | ||
| if (o?.id != null && !props.keyed) { | ||
| getNextChildId(o); | ||
| if (!props.keyed) getNextChildId(o); | ||
| } | ||
| return createMemo(() => { | ||
| const when = props.when; | ||
| const when = conditionValue(); | ||
| if (when) { | ||
@@ -1491,19 +1529,34 @@ const child = props.children; | ||
| const chs = children(() => props.children); | ||
| const o = getOwner(); | ||
| if (o?.id != null) getNextChildId(o); | ||
| return createMemo(() => { | ||
| const switchFunc = createMemo(() => { | ||
| let conds = chs(); | ||
| if (!Array.isArray(conds)) conds = [conds]; | ||
| const o = getOwner(); | ||
| let func = () => undefined; | ||
| for (let i = 0; i < conds.length; i++) { | ||
| if (conds[i] == null) continue; | ||
| const w = conds[i].when; | ||
| if (w) { | ||
| const c = conds[i].children; | ||
| return typeof c === "function" && c.length > 0 ? conds[i].keyed ? c(w) : c(() => w) : c; | ||
| } | ||
| const index = i; | ||
| const mp = conds[i]; | ||
| if (mp == null) continue; | ||
| const prevFunc = func; | ||
| const conditionValue = createMemo(() => prevFunc() ? undefined : mp.when); | ||
| if (o?.id != null && !mp.keyed) getNextChildId(o); | ||
| func = () => { | ||
| const prev = prevFunc(); | ||
| if (prev) return prev; | ||
| const w = conditionValue(); | ||
| return w ? [index, w, mp] : undefined; | ||
| }; | ||
| } | ||
| return props.fallback; | ||
| return func; | ||
| }, { | ||
| sync: true | ||
| }); | ||
| return createMemo(() => { | ||
| const sel = switchFunc()(); | ||
| if (!sel) return props.fallback; | ||
| const [, w, mp] = sel; | ||
| const c = mp.children; | ||
| return typeof c === "function" && c.length > 0 ? mp.keyed ? c(w) : c(() => w) : c; | ||
| }, { | ||
| sync: true | ||
| }); | ||
| } | ||
@@ -1510,0 +1563,0 @@ function Match(props) { |
+105
-52
@@ -34,5 +34,2 @@ import { NotReadyError, $REFRESH, merge as merge$1, isWrappable, NoOwnerError, ContextNotFoundError, $PROXY, flatten } from '@solidjs/signals'; | ||
| } | ||
| function consumeClientComputedSlot(owner) { | ||
| if (owner?.id != null) nextChildIdFor(owner, true); | ||
| } | ||
| function getNextChildId(owner) { | ||
@@ -331,2 +328,4 @@ return nextChildIdFor(owner, true); | ||
| update(); | ||
| } else if (comp.sync && ctx?.commitEpoch && ctx.commitEpoch() !== comp.epoch) { | ||
| update(); | ||
| } | ||
@@ -342,2 +341,3 @@ if (comp.errored) { | ||
| function createSyncMemo(compute, options) { | ||
| const ctx = sharedConfig.context; | ||
| const owner = createOwner(); | ||
@@ -348,2 +348,3 @@ let value; | ||
| let cached = false; | ||
| let epoch; | ||
| function pull() { | ||
@@ -358,2 +359,3 @@ const prev = currentOwner; | ||
| cached = true; | ||
| epoch = ctx?.commitEpoch?.(); | ||
| return value; | ||
@@ -365,2 +367,3 @@ } catch (err) { | ||
| cached = true; | ||
| epoch = ctx?.commitEpoch?.(); | ||
| throw err; | ||
@@ -378,3 +381,3 @@ } finally { | ||
| return () => { | ||
| if (cached) { | ||
| if (cached && (!ctx?.commitEpoch || ctx.commitEpoch() === epoch)) { | ||
| if (errored) throw error; | ||
@@ -449,2 +452,3 @@ return value; | ||
| const id = owner.id; | ||
| comp.sync = false; | ||
| const noHydrate = serialize === false || getContext(NoHydrateContext, owner); | ||
@@ -471,2 +475,3 @@ if (typeof result?.[Symbol.asyncIterator] !== "function" && isThenable(result)) { | ||
| comp.errored = false; | ||
| ctx?.commit?.(); | ||
| return value; | ||
@@ -478,2 +483,3 @@ }, error => { | ||
| comp.errored = true; | ||
| ctx?.commit?.(); | ||
| }, () => comp.disposed); | ||
@@ -507,2 +513,3 @@ comp.error = new NotReadyError(deferred.promise); | ||
| comp.errored = false; | ||
| ctx?.commit?.(); | ||
| return value; | ||
@@ -512,2 +519,3 @@ }, error => { | ||
| comp.errored = true; | ||
| ctx?.commit?.(); | ||
| }, () => comp.disposed); | ||
@@ -542,2 +550,3 @@ if (ctx?.async && ctx.serialize && id && !noHydrate) ctx.serialize(id, deferred.promise, deferStream); | ||
| comp.errored = false; | ||
| ctx?.commit?.(); | ||
| return undefined; | ||
@@ -547,2 +556,3 @@ }, error => { | ||
| comp.errored = true; | ||
| ctx?.commit?.(); | ||
| }, () => comp.disposed); | ||
@@ -569,2 +579,20 @@ if (ctx?.async && ctx.serialize && id && !noHydrate) { | ||
| ctx.serialize(id, tapped, deferStream); | ||
| } else if (ctx?.commit) { | ||
| const pump = () => { | ||
| if (comp.disposed) { | ||
| closeAsyncIterator(iter); | ||
| return; | ||
| } | ||
| iter.next().then(r => { | ||
| if (comp.disposed) { | ||
| closeAsyncIterator(iter); | ||
| return; | ||
| } | ||
| if (r.done) return; | ||
| comp.value = r.value; | ||
| ctx.commit(); | ||
| pump(); | ||
| }, () => {}); | ||
| }; | ||
| deferred.promise.then(pump, () => {}); | ||
| } | ||
@@ -577,2 +605,4 @@ comp.error = new NotReadyError(deferred.promise); | ||
| comp.value = result; | ||
| comp.sync = true; | ||
| comp.epoch = ctx?.commitEpoch?.(); | ||
| } | ||
@@ -917,24 +947,25 @@ function closeAsyncIterator(iter, value) { | ||
| const indexes = mapFn.length > 1; | ||
| const parent = currentOwner; | ||
| const rowOwner = createOwner(); | ||
| const read = createMemo(() => { | ||
| const items = list(); | ||
| const s = []; | ||
| rowOwner._childCount = 0; | ||
| if (items && items.length) { | ||
| const parent = currentOwner; | ||
| const origId = parent.id; | ||
| const origChildCount = parent._childCount; | ||
| try { | ||
| for (let i = 0, len = items.length; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| parent.id = formatChildId(origId, origChildCount + i); | ||
| runWithOwner(rowOwner, () => { | ||
| const origId = rowOwner.id; | ||
| try { | ||
| for (let i = 0, len = items.length; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| rowOwner.id = formatChildId(origId, i); | ||
| } | ||
| rowOwner._childCount = 0; | ||
| s.push(options.keyed === false ? indexes ? mapFn(() => items[i], i) : mapFn(() => items[i]) : typeof options.keyed === "function" ? indexes ? mapFn(() => items[i], () => i) : mapFn(() => items[i]) : indexes ? mapFn(items[i], () => i) : mapFn(items[i])); | ||
| } | ||
| parent._childCount = 0; | ||
| s.push(options.keyed === false ? indexes ? mapFn(() => items[i], i) : mapFn(() => items[i]) : typeof options.keyed === "function" ? indexes ? mapFn(() => items[i], () => i) : mapFn(() => items[i]) : indexes ? mapFn(items[i], () => i) : mapFn(items[i])); | ||
| } finally { | ||
| rowOwner.id = origId; | ||
| rowOwner._childCount = items.length; | ||
| } | ||
| } finally { | ||
| parent.id = origId; | ||
| parent._childCount = origChildCount + items.length; | ||
| } | ||
| }); | ||
| } else if (options.fallback) { | ||
| const fo = createOwner(); | ||
| const fo = runWithOwner(rowOwner, () => createOwner()); | ||
| s.push(runWithOwner(fo, () => options.fallback())); | ||
@@ -946,31 +977,31 @@ } | ||
| }); | ||
| consumeClientComputedSlot(parent); | ||
| return read; | ||
| } | ||
| function repeat(count, mapFn, options = {}) { | ||
| const parent = currentOwner; | ||
| const rowOwner = createOwner(); | ||
| const read = createMemo(() => { | ||
| const len = count(); | ||
| const offset = options.from?.() || 0; | ||
| rowOwner._childCount = 0; | ||
| if (!len) { | ||
| if (!options.fallback) return []; | ||
| const fo = createOwner(); | ||
| const fo = runWithOwner(rowOwner, () => createOwner()); | ||
| return [runWithOwner(fo, () => options.fallback())]; | ||
| } | ||
| const out = new Array(len); | ||
| const parent = currentOwner; | ||
| const origId = parent.id; | ||
| const origChildCount = parent._childCount; | ||
| try { | ||
| for (let i = 0; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| parent.id = formatChildId(origId, origChildCount + i); | ||
| runWithOwner(rowOwner, () => { | ||
| const origId = rowOwner.id; | ||
| try { | ||
| for (let i = 0; i < len; i++) { | ||
| if (origId !== undefined) { | ||
| rowOwner.id = formatChildId(origId, i); | ||
| } | ||
| rowOwner._childCount = 0; | ||
| out[i] = mapFn(i + offset); | ||
| } | ||
| parent._childCount = 0; | ||
| out[i] = mapFn(i + offset); | ||
| } finally { | ||
| rowOwner.id = origId; | ||
| rowOwner._childCount = len; | ||
| } | ||
| } finally { | ||
| parent.id = origId; | ||
| parent._childCount = origChildCount + len; | ||
| } | ||
| }); | ||
| return out; | ||
@@ -980,3 +1011,2 @@ }, { | ||
| }); | ||
| consumeClientComputedSlot(parent); | ||
| return read; | ||
@@ -995,5 +1025,9 @@ } | ||
| const prevBoundary = context?._currentBoundaryId; | ||
| const prevLoadingPhase = context?._loadingPhase; | ||
| if (context) { | ||
| sharedConfig.context = context; | ||
| if (boundaryId !== undefined) context._currentBoundaryId = boundaryId; | ||
| if (boundaryId !== undefined) { | ||
| context._currentBoundaryId = boundaryId; | ||
| context._loadingPhase = true; | ||
| } | ||
| } | ||
@@ -1008,3 +1042,6 @@ try { | ||
| if (context) { | ||
| if (boundaryId !== undefined) context._currentBoundaryId = prevBoundary; | ||
| if (boundaryId !== undefined) { | ||
| context._currentBoundaryId = prevBoundary; | ||
| context._loadingPhase = prevLoadingPhase; | ||
| } | ||
| sharedConfig.context = prevCtx; | ||
@@ -1294,6 +1331,7 @@ } | ||
| function ssrHandleError(err) { | ||
| function ssrHandleError(err, probe) { | ||
| if (err instanceof NotReadyError) { | ||
| return err.source; | ||
| } | ||
| if (probe) return; | ||
| const handler = getContext(ErrorContext); | ||
@@ -1468,9 +1506,9 @@ if (handler) { | ||
| function Show(props) { | ||
| const conditionValue = createMemo(() => props.when); | ||
| const o = getOwner(); | ||
| if (o?.id != null) { | ||
| if (o?.id != null && !props.keyed) { | ||
| getNextChildId(o); | ||
| if (!props.keyed) getNextChildId(o); | ||
| } | ||
| return createMemo(() => { | ||
| const when = props.when; | ||
| const when = conditionValue(); | ||
| if (when) { | ||
@@ -1490,19 +1528,34 @@ const child = props.children; | ||
| const chs = children(() => props.children); | ||
| const o = getOwner(); | ||
| if (o?.id != null) getNextChildId(o); | ||
| return createMemo(() => { | ||
| const switchFunc = createMemo(() => { | ||
| let conds = chs(); | ||
| if (!Array.isArray(conds)) conds = [conds]; | ||
| const o = getOwner(); | ||
| let func = () => undefined; | ||
| for (let i = 0; i < conds.length; i++) { | ||
| if (conds[i] == null) continue; | ||
| const w = conds[i].when; | ||
| if (w) { | ||
| const c = conds[i].children; | ||
| return typeof c === "function" && c.length > 0 ? conds[i].keyed ? c(w) : c(() => w) : c; | ||
| } | ||
| const index = i; | ||
| const mp = conds[i]; | ||
| if (mp == null) continue; | ||
| const prevFunc = func; | ||
| const conditionValue = createMemo(() => prevFunc() ? undefined : mp.when); | ||
| if (o?.id != null && !mp.keyed) getNextChildId(o); | ||
| func = () => { | ||
| const prev = prevFunc(); | ||
| if (prev) return prev; | ||
| const w = conditionValue(); | ||
| return w ? [index, w, mp] : undefined; | ||
| }; | ||
| } | ||
| return props.fallback; | ||
| return func; | ||
| }, { | ||
| sync: true | ||
| }); | ||
| return createMemo(() => { | ||
| const sel = switchFunc()(); | ||
| if (!sel) return props.fallback; | ||
| const [, w, mp] = sel; | ||
| const c = mp.children; | ||
| return typeof c === "function" && c.length > 0 ? mp.keyed ? c(w) : c(() => w) : c; | ||
| }, { | ||
| sync: true | ||
| }); | ||
| } | ||
@@ -1509,0 +1562,0 @@ function Match(props) { |
+9
-2
@@ -578,3 +578,5 @@ 'use strict'; | ||
| pending: anyFragmentPending, | ||
| subscribe: subscribeFragments | ||
| subscribe: subscribeFragments, | ||
| claim: claimFragment, | ||
| release: releaseFragment | ||
| }; | ||
@@ -727,2 +729,6 @@ const prevFe = hy.fe; | ||
| } | ||
| function releaseFragment(id) { | ||
| const f = _fragments.get(id); | ||
| if (f) f.claimed = false; | ||
| } | ||
| function fragmentPending(hy, id) { | ||
@@ -734,3 +740,4 @@ if (_truncated.has(id)) return false; | ||
| if (hy.v && hy.v[id]) return false; | ||
| return !!document.getElementById(id); | ||
| if (!document.getElementById(id)) return false; | ||
| return !!document.getElementById("pl-" + id); | ||
| } | ||
@@ -737,0 +744,0 @@ function anyFragmentPending() { |
+9
-2
@@ -577,3 +577,5 @@ import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createRevealOrder as createRevealOrder$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getOwner, peekNextChildId, getNextChildId, clearSnapshots, flush, markSnapshotScope, onCleanup, isDisposed, untrack, mapArray, repeat } from '@solidjs/signals'; | ||
| pending: anyFragmentPending, | ||
| subscribe: subscribeFragments | ||
| subscribe: subscribeFragments, | ||
| claim: claimFragment, | ||
| release: releaseFragment | ||
| }; | ||
@@ -726,2 +728,6 @@ const prevFe = hy.fe; | ||
| } | ||
| function releaseFragment(id) { | ||
| const f = _fragments.get(id); | ||
| if (f) f.claimed = false; | ||
| } | ||
| function fragmentPending(hy, id) { | ||
@@ -733,3 +739,4 @@ if (_truncated.has(id)) return false; | ||
| if (hy.v && hy.v[id]) return false; | ||
| return !!document.getElementById(id); | ||
| if (!document.getElementById(id)) return false; | ||
| return !!document.getElementById("pl-" + id); | ||
| } | ||
@@ -736,0 +743,0 @@ function anyFragmentPending() { |
+2
-2
| { | ||
| "name": "solid-js", | ||
| "description": "Reactive JavaScript library for building user interfaces. Compiles JSX to real DOM with fine-grained signal-based updates — no virtual DOM.", | ||
| "version": "2.0.0-beta.31", | ||
| "version": "2.0.0-beta.32", | ||
| "author": "Ryan Carniato", | ||
@@ -131,3 +131,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@solidjs/signals": "^2.0.0-beta.31", | ||
| "@solidjs/signals": "^2.0.0-beta.32", | ||
| "csstype": "^3.1.0", | ||
@@ -134,0 +134,0 @@ "seroval": "~1.5.4", |
@@ -160,4 +160,4 @@ import type { Accessor, RevealOrder } from "./signals.cjs"; | ||
| * - `order="together"` and `collapsed` rely on streamed activation and require | ||
| * `renderToStream` / `renderToStringAsync`. Using them inside a nested `<Reveal>` | ||
| * under `renderToString` logs a warning. | ||
| * `renderToStream`. Using them inside a nested `<Reveal>` under | ||
| * `renderToString` logs a warning. | ||
| * | ||
@@ -164,0 +164,0 @@ * See `documentation/solid-2.0/03-control-flow.md` for the full outer/inner |
@@ -9,4 +9,10 @@ import type { Accessor } from "./signals.cjs"; | ||
| * or delegates to the ErrorContext handler. | ||
| * | ||
| * `probe: true` is the side-effect-free identification mode: it answers the | ||
| * pending source for NotReady and `undefined` for anything else, never | ||
| * routing or rethrowing. Used where the caller only wants to know whether a | ||
| * throw was a pending read (e.g. the head registry's shell-hold path) while | ||
| * keeping real errors on their existing handling path. | ||
| */ | ||
| export declare function ssrHandleError(err: any): Promise<any> | undefined; | ||
| export declare function ssrHandleError(err: any, probe?: boolean): Promise<any> | undefined; | ||
| export declare function createLoadingBoundary<T, U>(fn: () => T, fallback: () => U, options?: { | ||
@@ -13,0 +19,0 @@ on?: () => any; |
@@ -65,5 +65,27 @@ import type { Context } from "./signals.cjs"; | ||
| _currentBoundaryId?: string | null; | ||
| assets: any[]; | ||
| /** | ||
| * @internal True during a Loading discovery pass — the only render phase | ||
| * with a retryable NotReady catch. Set/restored by | ||
| * `runWithBoundaryErrorContext` when a boundaryId is passed; read by | ||
| * dom-expressions' head registry to escalate pending head-tag props into a | ||
| * boundary suspension instead of a flush-time warn-and-drop. | ||
| */ | ||
| _loadingPhase?: boolean; | ||
| /** True only in renderToStream — enables async data serialization and streaming. */ | ||
| async?: boolean; | ||
| /** | ||
| * Frame renders only (DR-2 case 1, set by the frame sink): signal that an | ||
| * async value settled without a serialization flush the sink could see — | ||
| * the binding ledger schedules an equality-gated sweep of watched slot | ||
| * args. No-op semantics elsewhere; absent outside frame renders. | ||
| */ | ||
| commit?: () => void; | ||
| /** | ||
| * Frame renders only (set alongside `commit`): the sink's commit epoch. | ||
| * Sync-valued memos cache per epoch — cached within one sweep, recomputed | ||
| * when pulled after a later commit — so watched-arg sweeps read current | ||
| * derivations. Absent outside frame renders (memos then cache for the | ||
| * render, the document-SSR contract). | ||
| */ | ||
| commitEpoch?: () => number; | ||
| }; | ||
@@ -70,0 +92,0 @@ export declare const NoHydrateContext: Context<boolean>; |
@@ -82,2 +82,4 @@ import { $REFRESH } from "@solidjs/signals"; | ||
| disposed: boolean; | ||
| sync?: boolean; | ||
| epoch?: number; | ||
| } | ||
@@ -84,0 +86,0 @@ type SsrSourceMode = "server" | "hybrid" | "client"; |
@@ -160,4 +160,4 @@ import type { Accessor, RevealOrder } from "./signals.js"; | ||
| * - `order="together"` and `collapsed` rely on streamed activation and require | ||
| * `renderToStream` / `renderToStringAsync`. Using them inside a nested `<Reveal>` | ||
| * under `renderToString` logs a warning. | ||
| * `renderToStream`. Using them inside a nested `<Reveal>` under | ||
| * `renderToString` logs a warning. | ||
| * | ||
@@ -164,0 +164,0 @@ * See `documentation/solid-2.0/03-control-flow.md` for the full outer/inner |
@@ -9,4 +9,10 @@ import type { Accessor } from "./signals.js"; | ||
| * or delegates to the ErrorContext handler. | ||
| * | ||
| * `probe: true` is the side-effect-free identification mode: it answers the | ||
| * pending source for NotReady and `undefined` for anything else, never | ||
| * routing or rethrowing. Used where the caller only wants to know whether a | ||
| * throw was a pending read (e.g. the head registry's shell-hold path) while | ||
| * keeping real errors on their existing handling path. | ||
| */ | ||
| export declare function ssrHandleError(err: any): Promise<any> | undefined; | ||
| export declare function ssrHandleError(err: any, probe?: boolean): Promise<any> | undefined; | ||
| export declare function createLoadingBoundary<T, U>(fn: () => T, fallback: () => U, options?: { | ||
@@ -13,0 +19,0 @@ on?: () => any; |
@@ -65,5 +65,27 @@ import type { Context } from "./signals.js"; | ||
| _currentBoundaryId?: string | null; | ||
| assets: any[]; | ||
| /** | ||
| * @internal True during a Loading discovery pass — the only render phase | ||
| * with a retryable NotReady catch. Set/restored by | ||
| * `runWithBoundaryErrorContext` when a boundaryId is passed; read by | ||
| * dom-expressions' head registry to escalate pending head-tag props into a | ||
| * boundary suspension instead of a flush-time warn-and-drop. | ||
| */ | ||
| _loadingPhase?: boolean; | ||
| /** True only in renderToStream — enables async data serialization and streaming. */ | ||
| async?: boolean; | ||
| /** | ||
| * Frame renders only (DR-2 case 1, set by the frame sink): signal that an | ||
| * async value settled without a serialization flush the sink could see — | ||
| * the binding ledger schedules an equality-gated sweep of watched slot | ||
| * args. No-op semantics elsewhere; absent outside frame renders. | ||
| */ | ||
| commit?: () => void; | ||
| /** | ||
| * Frame renders only (set alongside `commit`): the sink's commit epoch. | ||
| * Sync-valued memos cache per epoch — cached within one sweep, recomputed | ||
| * when pulled after a later commit — so watched-arg sweeps read current | ||
| * derivations. Absent outside frame renders (memos then cache for the | ||
| * render, the document-SSR contract). | ||
| */ | ||
| commitEpoch?: () => number; | ||
| }; | ||
@@ -70,0 +92,0 @@ export declare const NoHydrateContext: Context<boolean>; |
@@ -82,2 +82,4 @@ import { $REFRESH } from "@solidjs/signals"; | ||
| disposed: boolean; | ||
| sync?: boolean; | ||
| epoch?: number; | ||
| } | ||
@@ -84,0 +86,0 @@ type SsrSourceMode = "server" | "hybrid" | "client"; |
481357
1.49%10807
1.54%