+153
-42
@@ -211,2 +211,63 @@ 'use strict'; | ||
| } | ||
| function createShadowDraft(realDraft) { | ||
| const shadow = JSON.parse(JSON.stringify(realDraft)); | ||
| let useShadow = true; | ||
| return { | ||
| proxy: new Proxy(shadow, { | ||
| get(_, prop) { | ||
| return useShadow ? shadow[prop] : realDraft[prop]; | ||
| }, | ||
| set(_, prop, value) { | ||
| if (useShadow) { | ||
| shadow[prop] = value; | ||
| return true; | ||
| } | ||
| return Reflect.set(realDraft, prop, value); | ||
| }, | ||
| deleteProperty(_, prop) { | ||
| if (useShadow) { | ||
| delete shadow[prop]; | ||
| return true; | ||
| } | ||
| return Reflect.deleteProperty(realDraft, prop); | ||
| }, | ||
| has(_, prop) { | ||
| return prop in (useShadow ? shadow : realDraft); | ||
| }, | ||
| ownKeys() { | ||
| return Reflect.ownKeys(useShadow ? shadow : realDraft); | ||
| }, | ||
| getOwnPropertyDescriptor(_, prop) { | ||
| return Object.getOwnPropertyDescriptor(useShadow ? shadow : realDraft, prop); | ||
| } | ||
| }), | ||
| activate() { | ||
| useShadow = false; | ||
| } | ||
| }; | ||
| } | ||
| function wrapFirstYield(iterable, activate) { | ||
| const srcIt = iterable[Symbol.asyncIterator](); | ||
| let first = true; | ||
| return { | ||
| [Symbol.asyncIterator]() { | ||
| return { | ||
| next() { | ||
| const p = srcIt.next(); | ||
| if (first) { | ||
| first = false; | ||
| return p.then(r => { | ||
| activate(); | ||
| return r.done ? r : { | ||
| done: false, | ||
| value: undefined | ||
| }; | ||
| }); | ||
| } | ||
| return p; | ||
| } | ||
| }; | ||
| } | ||
| }; | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
@@ -263,3 +324,7 @@ const parent = signals.getOwner(); | ||
| const r = srcIt.next(); | ||
| return r && typeof r.then === "function" ? r.then(process) : syncThenable(process(r)); | ||
| return r && typeof r.then === "function" ? { | ||
| then(fn, rej) { | ||
| r.then(v => fn(process(v)), rej); | ||
| } | ||
| } : syncThenable(process(r)); | ||
| } | ||
@@ -293,3 +358,3 @@ if (buffered) { | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return signals.createMemo(compute, value, options); | ||
@@ -300,3 +365,5 @@ } | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const memo = signals.createMemo(prev => { | ||
@@ -332,3 +399,5 @@ if (!hydrated()) return prev ?? value; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = signals.createSignal(prev => { | ||
@@ -384,3 +453,5 @@ if (!hydrated()) return prev ?? second; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = signals.createOptimistic(prev => { | ||
@@ -411,10 +482,3 @@ if (!hydrated()) return prev ?? second; | ||
| } | ||
| function wrapStoreFn(fn, ssrSource) { | ||
| if (ssrSource === "initial") { | ||
| return draft => { | ||
| if (!sharedConfig.hydrating) return fn(draft); | ||
| subFetch(fn, draft); | ||
| return undefined; | ||
| }; | ||
| } | ||
| function wrapStoreFn(fn) { | ||
| return draft => { | ||
@@ -429,2 +493,45 @@ const o = signals.getOwner(); | ||
| } | ||
| function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| if (!hydrated()) return; | ||
| return fn(draft); | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| if (ssrSource === "hybrid") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| const o = signals.getOwner(); | ||
| if (!hydrated()) { | ||
| if (sharedConfig.has(o.id)) { | ||
| const initP = sharedConfig.load(o.id); | ||
| const init = initP?.v ?? initP; | ||
| if (init != null) { | ||
| subFetch(fn, draft); | ||
| return init; | ||
| } | ||
| } | ||
| return fn(draft); | ||
| } | ||
| const { | ||
| proxy, | ||
| activate | ||
| } = createShadowDraft(draft); | ||
| const r = fn(proxy); | ||
| return isAsyncIterable(r) ? wrapFirstYield(r, activate) : r; | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(coreFn, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return coreFn(wrapStoreFn(fn), initialValue, options); | ||
| } | ||
| function hydratedCreateStore(first, second, third) { | ||
@@ -434,8 +541,4 @@ if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createStore(first, second, third); | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return signals.createStore(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(signals.createStore, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createStore(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return signals.createStore(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(signals.createStore, first, second ?? {}, third, ssrSource); | ||
| } | ||
@@ -446,21 +549,11 @@ function hydratedCreateOptimisticStore(first, second, third) { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return signals.createOptimisticStore(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(signals.createOptimisticStore, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createOptimisticStore(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(signals.createOptimisticStore, first, second ?? {}, third, ssrSource); | ||
| } | ||
| function hydratedCreateProjection(fn, initialValue, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| return signals.createProjection(fn, initialValue, options); | ||
| } | ||
| if (!sharedConfig.hydrating) return signals.createProjection(fn, initialValue, options); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return signals.createProjection(draft => draft, initialValue, options); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(signals.createProjection, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createProjection(wrapStoreFn(fn, ssrSource), initialValue, options); | ||
| if (ssrSource === "initial") return signals.createProjection(draft => draft, initialValue, options); | ||
| return hydrateStoreLikeFn(signals.createProjection, fn, initialValue, options, ssrSource); | ||
| } | ||
@@ -471,3 +564,5 @@ function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| let active = false; | ||
@@ -606,9 +701,12 @@ coreFn(prev => { | ||
| _snapshotRootOwner = null; | ||
| _hydratingValue = false; | ||
| signals.releaseSnapshotScope(o); | ||
| signals.flush(); | ||
| _hydratingValue = false; | ||
| checkHydrationComplete(); | ||
| } | ||
| function Loading(props) { | ||
| if (!sharedConfig.hydrating) return signals.createLoadBoundary(() => props.children, () => props.fallback); | ||
| const onOpt = props.on ? { | ||
| on: () => props.on() | ||
| } : undefined; | ||
| if (!sharedConfig.hydrating) return signals.createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return signals.createMemo(() => { | ||
@@ -661,3 +759,4 @@ const o = signals.getOwner(); | ||
| } | ||
| return signals.createLoadBoundary(() => props.children, () => props.fallback); | ||
| const boundary = signals.createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return boundary; | ||
| }); | ||
@@ -834,2 +933,10 @@ } | ||
| }); | ||
| Object.defineProperty(exports, "createErrorBoundary", { | ||
| enumerable: true, | ||
| get: function () { return signals.createErrorBoundary; } | ||
| }); | ||
| Object.defineProperty(exports, "createLoadingBoundary", { | ||
| enumerable: true, | ||
| get: function () { return signals.createLoadingBoundary; } | ||
| }); | ||
| Object.defineProperty(exports, "createOwner", { | ||
@@ -855,2 +962,10 @@ enumerable: true, | ||
| }); | ||
| Object.defineProperty(exports, "enableExternalSource", { | ||
| enumerable: true, | ||
| get: function () { return signals.enableExternalSource; } | ||
| }); | ||
| Object.defineProperty(exports, "enforceLoadingBoundary", { | ||
| enumerable: true, | ||
| get: function () { return signals.enforceLoadingBoundary; } | ||
| }); | ||
| Object.defineProperty(exports, "flatten", { | ||
@@ -936,6 +1051,2 @@ enumerable: true, | ||
| }); | ||
| Object.defineProperty(exports, "setOnUnhandledAsync", { | ||
| enumerable: true, | ||
| get: function () { return signals.setOnUnhandledAsync; } | ||
| }); | ||
| Object.defineProperty(exports, "snapshot", { | ||
@@ -942,0 +1053,0 @@ enumerable: true, |
+139
-40
@@ -1,3 +0,3 @@ | ||
| import { getContext, createMemo as createMemo$1, flatten, getOwner, createRoot, setContext, untrack, createLoadBoundary, onCleanup, isDisposed, runWithOwner, createOwner, createEffect as createEffect$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, mapArray, repeat } from '@solidjs/signals'; | ||
| export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, setOnUnhandledAsync, snapshot, storePath, untrack } from '@solidjs/signals'; | ||
| import { getContext, createMemo as createMemo$1, flatten, getOwner, createRoot, setContext, untrack, createLoadingBoundary, onCleanup, isDisposed, runWithOwner, createOwner, createEffect as createEffect$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, mapArray, repeat } from '@solidjs/signals'; | ||
| export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createErrorBoundary, createLoadingBoundary, createOwner, createReaction, createRoot, createTrackedEffect, deep, enableExternalSource, enforceLoadingBoundary, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals'; | ||
@@ -210,2 +210,63 @@ const $DEVCOMP = Symbol("COMPONENT_DEV" ); | ||
| } | ||
| function createShadowDraft(realDraft) { | ||
| const shadow = JSON.parse(JSON.stringify(realDraft)); | ||
| let useShadow = true; | ||
| return { | ||
| proxy: new Proxy(shadow, { | ||
| get(_, prop) { | ||
| return useShadow ? shadow[prop] : realDraft[prop]; | ||
| }, | ||
| set(_, prop, value) { | ||
| if (useShadow) { | ||
| shadow[prop] = value; | ||
| return true; | ||
| } | ||
| return Reflect.set(realDraft, prop, value); | ||
| }, | ||
| deleteProperty(_, prop) { | ||
| if (useShadow) { | ||
| delete shadow[prop]; | ||
| return true; | ||
| } | ||
| return Reflect.deleteProperty(realDraft, prop); | ||
| }, | ||
| has(_, prop) { | ||
| return prop in (useShadow ? shadow : realDraft); | ||
| }, | ||
| ownKeys() { | ||
| return Reflect.ownKeys(useShadow ? shadow : realDraft); | ||
| }, | ||
| getOwnPropertyDescriptor(_, prop) { | ||
| return Object.getOwnPropertyDescriptor(useShadow ? shadow : realDraft, prop); | ||
| } | ||
| }), | ||
| activate() { | ||
| useShadow = false; | ||
| } | ||
| }; | ||
| } | ||
| function wrapFirstYield(iterable, activate) { | ||
| const srcIt = iterable[Symbol.asyncIterator](); | ||
| let first = true; | ||
| return { | ||
| [Symbol.asyncIterator]() { | ||
| return { | ||
| next() { | ||
| const p = srcIt.next(); | ||
| if (first) { | ||
| first = false; | ||
| return p.then(r => { | ||
| activate(); | ||
| return r.done ? r : { | ||
| done: false, | ||
| value: undefined | ||
| }; | ||
| }); | ||
| } | ||
| return p; | ||
| } | ||
| }; | ||
| } | ||
| }; | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
@@ -262,3 +323,7 @@ const parent = getOwner(); | ||
| const r = srcIt.next(); | ||
| return r && typeof r.then === "function" ? r.then(process) : syncThenable(process(r)); | ||
| return r && typeof r.then === "function" ? { | ||
| then(fn, rej) { | ||
| r.then(v => fn(process(v)), rej); | ||
| } | ||
| } : syncThenable(process(r)); | ||
| } | ||
@@ -292,3 +357,3 @@ if (buffered) { | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return createMemo$1(compute, value, options); | ||
@@ -299,3 +364,5 @@ } | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const memo = createMemo$1(prev => { | ||
@@ -331,3 +398,5 @@ if (!hydrated()) return prev ?? value; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = createSignal$1(prev => { | ||
@@ -383,3 +452,5 @@ if (!hydrated()) return prev ?? second; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = createOptimistic$1(prev => { | ||
@@ -410,10 +481,3 @@ if (!hydrated()) return prev ?? second; | ||
| } | ||
| function wrapStoreFn(fn, ssrSource) { | ||
| if (ssrSource === "initial") { | ||
| return draft => { | ||
| if (!sharedConfig.hydrating) return fn(draft); | ||
| subFetch(fn, draft); | ||
| return undefined; | ||
| }; | ||
| } | ||
| function wrapStoreFn(fn) { | ||
| return draft => { | ||
@@ -428,2 +492,45 @@ const o = getOwner(); | ||
| } | ||
| function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| if (!hydrated()) return; | ||
| return fn(draft); | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| if (ssrSource === "hybrid") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| const o = getOwner(); | ||
| if (!hydrated()) { | ||
| if (sharedConfig.has(o.id)) { | ||
| const initP = sharedConfig.load(o.id); | ||
| const init = initP?.v ?? initP; | ||
| if (init != null) { | ||
| subFetch(fn, draft); | ||
| return init; | ||
| } | ||
| } | ||
| return fn(draft); | ||
| } | ||
| const { | ||
| proxy, | ||
| activate | ||
| } = createShadowDraft(draft); | ||
| const r = fn(proxy); | ||
| return isAsyncIterable(r) ? wrapFirstYield(r, activate) : r; | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(coreFn, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return coreFn(wrapStoreFn(fn), initialValue, options); | ||
| } | ||
| function hydratedCreateStore(first, second, third) { | ||
@@ -433,8 +540,4 @@ if (typeof first !== "function" || !sharedConfig.hydrating) return createStore$1(first, second, third); | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return createStore$1(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(createStore$1, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return createStore$1(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return createStore$1(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource); | ||
| } | ||
@@ -445,21 +548,11 @@ function hydratedCreateOptimisticStore(first, second, third) { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return createOptimisticStore$1(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(createOptimisticStore$1, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return createOptimisticStore$1(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource); | ||
| } | ||
| function hydratedCreateProjection(fn, initialValue, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| return createProjection$1(fn, initialValue, options); | ||
| } | ||
| if (!sharedConfig.hydrating) return createProjection$1(fn, initialValue, options); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return createProjection$1(draft => draft, initialValue, options); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(createProjection$1, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return createProjection$1(wrapStoreFn(fn, ssrSource), initialValue, options); | ||
| if (ssrSource === "initial") return createProjection$1(draft => draft, initialValue, options); | ||
| return hydrateStoreLikeFn(createProjection$1, fn, initialValue, options, ssrSource); | ||
| } | ||
@@ -470,3 +563,5 @@ function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| let active = false; | ||
@@ -605,9 +700,12 @@ coreFn(prev => { | ||
| _snapshotRootOwner = null; | ||
| _hydratingValue = false; | ||
| releaseSnapshotScope(o); | ||
| flush(); | ||
| _hydratingValue = false; | ||
| checkHydrationComplete(); | ||
| } | ||
| function Loading(props) { | ||
| if (!sharedConfig.hydrating) return createLoadBoundary(() => props.children, () => props.fallback); | ||
| const onOpt = props.on ? { | ||
| on: () => props.on() | ||
| } : undefined; | ||
| if (!sharedConfig.hydrating) return createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return createMemo$1(() => { | ||
@@ -660,3 +758,4 @@ const o = getOwner(); | ||
| } | ||
| return createLoadBoundary(() => props.children, () => props.fallback); | ||
| const boundary = createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return boundary; | ||
| }); | ||
@@ -663,0 +762,0 @@ } |
+12
-6
@@ -496,3 +496,3 @@ 'use strict'; | ||
| } | ||
| function createLoadBoundary(fn, fallback) { | ||
| function createLoadingBoundary(fn, fallback, options) { | ||
| try { | ||
@@ -705,3 +705,3 @@ const result = fn(); | ||
| if (!ctx) { | ||
| return createLoadBoundary(() => props.children, () => props.fallback); | ||
| return createLoadingBoundary(() => props.children, () => props.fallback); | ||
| } | ||
@@ -819,2 +819,10 @@ const o = signals.createOwner(); | ||
| }); | ||
| Object.defineProperty(exports, "enableExternalSource", { | ||
| enumerable: true, | ||
| get: function () { return signals.enableExternalSource; } | ||
| }); | ||
| Object.defineProperty(exports, "enforceLoadingBoundary", { | ||
| enumerable: true, | ||
| get: function () { return signals.enforceLoadingBoundary; } | ||
| }); | ||
| Object.defineProperty(exports, "flatten", { | ||
@@ -856,6 +864,2 @@ enumerable: true, | ||
| }); | ||
| Object.defineProperty(exports, "setOnUnhandledAsync", { | ||
| enumerable: true, | ||
| get: function () { return signals.setOnUnhandledAsync; } | ||
| }); | ||
| Object.defineProperty(exports, "snapshot", { | ||
@@ -887,2 +891,4 @@ enumerable: true, | ||
| exports.createEffect = createEffect; | ||
| exports.createErrorBoundary = createErrorBoundary; | ||
| exports.createLoadingBoundary = createLoadingBoundary; | ||
| exports.createMemo = createMemo; | ||
@@ -889,0 +895,0 @@ exports.createOptimistic = createOptimistic; |
+5
-5
@@ -1,3 +0,3 @@ | ||
| import { getOwner, getContext, getNextChildId, createOwner, runWithOwner, onCleanup, NotReadyError, isWrappable, setContext, flatten, createRoot } from '@solidjs/signals'; | ||
| export { $PROXY, $REFRESH, $TRACK, NotReadyError, createOwner, createRoot, flatten, getNextChildId, getOwner, isEqual, isWrappable, merge, omit, onCleanup, runWithOwner, setOnUnhandledAsync, snapshot, storePath } from '@solidjs/signals'; | ||
| import { getOwner, getContext, getNextChildId, createOwner, runWithOwner, setContext, NotReadyError, onCleanup, isWrappable, flatten, createRoot } from '@solidjs/signals'; | ||
| export { $PROXY, $REFRESH, $TRACK, NotReadyError, createOwner, createRoot, enableExternalSource, enforceLoadingBoundary, flatten, getNextChildId, getOwner, isEqual, isWrappable, merge, omit, onCleanup, runWithOwner, snapshot, storePath } from '@solidjs/signals'; | ||
@@ -495,3 +495,3 @@ const NoHydrateContext = { | ||
| } | ||
| function createLoadBoundary(fn, fallback) { | ||
| function createLoadingBoundary(fn, fallback, options) { | ||
| try { | ||
@@ -704,3 +704,3 @@ const result = fn(); | ||
| if (!ctx) { | ||
| return createLoadBoundary(() => props.children, () => props.fallback); | ||
| return createLoadingBoundary(() => props.children, () => props.fallback); | ||
| } | ||
@@ -794,2 +794,2 @@ const o = createOwner(); | ||
| export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getObserver, isPending, isRefreshing, latest, lazy, mapArray, onSettled, reconcile, refresh, repeat, resolve, sharedConfig, ssrHandleError, ssrRunInScope, untrack, useContext }; | ||
| export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getObserver, isPending, isRefreshing, latest, lazy, mapArray, onSettled, reconcile, refresh, repeat, resolve, sharedConfig, ssrHandleError, ssrRunInScope, untrack, useContext }; |
+153
-42
@@ -190,2 +190,63 @@ 'use strict'; | ||
| } | ||
| function createShadowDraft(realDraft) { | ||
| const shadow = JSON.parse(JSON.stringify(realDraft)); | ||
| let useShadow = true; | ||
| return { | ||
| proxy: new Proxy(shadow, { | ||
| get(_, prop) { | ||
| return useShadow ? shadow[prop] : realDraft[prop]; | ||
| }, | ||
| set(_, prop, value) { | ||
| if (useShadow) { | ||
| shadow[prop] = value; | ||
| return true; | ||
| } | ||
| return Reflect.set(realDraft, prop, value); | ||
| }, | ||
| deleteProperty(_, prop) { | ||
| if (useShadow) { | ||
| delete shadow[prop]; | ||
| return true; | ||
| } | ||
| return Reflect.deleteProperty(realDraft, prop); | ||
| }, | ||
| has(_, prop) { | ||
| return prop in (useShadow ? shadow : realDraft); | ||
| }, | ||
| ownKeys() { | ||
| return Reflect.ownKeys(useShadow ? shadow : realDraft); | ||
| }, | ||
| getOwnPropertyDescriptor(_, prop) { | ||
| return Object.getOwnPropertyDescriptor(useShadow ? shadow : realDraft, prop); | ||
| } | ||
| }), | ||
| activate() { | ||
| useShadow = false; | ||
| } | ||
| }; | ||
| } | ||
| function wrapFirstYield(iterable, activate) { | ||
| const srcIt = iterable[Symbol.asyncIterator](); | ||
| let first = true; | ||
| return { | ||
| [Symbol.asyncIterator]() { | ||
| return { | ||
| next() { | ||
| const p = srcIt.next(); | ||
| if (first) { | ||
| first = false; | ||
| return p.then(r => { | ||
| activate(); | ||
| return r.done ? r : { | ||
| done: false, | ||
| value: undefined | ||
| }; | ||
| }); | ||
| } | ||
| return p; | ||
| } | ||
| }; | ||
| } | ||
| }; | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
@@ -242,3 +303,7 @@ const parent = signals.getOwner(); | ||
| const r = srcIt.next(); | ||
| return r && typeof r.then === "function" ? r.then(process) : syncThenable(process(r)); | ||
| return r && typeof r.then === "function" ? { | ||
| then(fn, rej) { | ||
| r.then(v => fn(process(v)), rej); | ||
| } | ||
| } : syncThenable(process(r)); | ||
| } | ||
@@ -272,3 +337,3 @@ if (buffered) { | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return signals.createMemo(compute, value, options); | ||
@@ -279,3 +344,5 @@ } | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const memo = signals.createMemo(prev => { | ||
@@ -311,3 +378,5 @@ if (!hydrated()) return prev ?? value; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = signals.createSignal(prev => { | ||
@@ -363,3 +432,5 @@ if (!hydrated()) return prev ?? second; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = signals.createOptimistic(prev => { | ||
@@ -390,10 +461,3 @@ if (!hydrated()) return prev ?? second; | ||
| } | ||
| function wrapStoreFn(fn, ssrSource) { | ||
| if (ssrSource === "initial") { | ||
| return draft => { | ||
| if (!sharedConfig.hydrating) return fn(draft); | ||
| subFetch(fn, draft); | ||
| return undefined; | ||
| }; | ||
| } | ||
| function wrapStoreFn(fn) { | ||
| return draft => { | ||
@@ -408,2 +472,45 @@ const o = signals.getOwner(); | ||
| } | ||
| function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| if (!hydrated()) return; | ||
| return fn(draft); | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| if (ssrSource === "hybrid") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| const o = signals.getOwner(); | ||
| if (!hydrated()) { | ||
| if (sharedConfig.has(o.id)) { | ||
| const initP = sharedConfig.load(o.id); | ||
| const init = initP?.v ?? initP; | ||
| if (init != null) { | ||
| subFetch(fn, draft); | ||
| return init; | ||
| } | ||
| } | ||
| return fn(draft); | ||
| } | ||
| const { | ||
| proxy, | ||
| activate | ||
| } = createShadowDraft(draft); | ||
| const r = fn(proxy); | ||
| return isAsyncIterable(r) ? wrapFirstYield(r, activate) : r; | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(coreFn, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return coreFn(wrapStoreFn(fn), initialValue, options); | ||
| } | ||
| function hydratedCreateStore(first, second, third) { | ||
@@ -413,8 +520,4 @@ if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createStore(first, second, third); | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return signals.createStore(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(signals.createStore, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createStore(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return signals.createStore(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(signals.createStore, first, second ?? {}, third, ssrSource); | ||
| } | ||
@@ -425,21 +528,11 @@ function hydratedCreateOptimisticStore(first, second, third) { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return signals.createOptimisticStore(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(signals.createOptimisticStore, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createOptimisticStore(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(signals.createOptimisticStore, first, second ?? {}, third, ssrSource); | ||
| } | ||
| function hydratedCreateProjection(fn, initialValue, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| return signals.createProjection(fn, initialValue, options); | ||
| } | ||
| if (!sharedConfig.hydrating) return signals.createProjection(fn, initialValue, options); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return signals.createProjection(draft => draft, initialValue, options); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(signals.createProjection, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return signals.createProjection(wrapStoreFn(fn, ssrSource), initialValue, options); | ||
| if (ssrSource === "initial") return signals.createProjection(draft => draft, initialValue, options); | ||
| return hydrateStoreLikeFn(signals.createProjection, fn, initialValue, options, ssrSource); | ||
| } | ||
@@ -450,3 +543,5 @@ function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = signals.createSignal(false); | ||
| const [hydrated, setHydrated] = signals.createSignal(false, { | ||
| pureWrite: true | ||
| }); | ||
| let active = false; | ||
@@ -585,9 +680,12 @@ coreFn(prev => { | ||
| _snapshotRootOwner = null; | ||
| _hydratingValue = false; | ||
| signals.releaseSnapshotScope(o); | ||
| signals.flush(); | ||
| _hydratingValue = false; | ||
| checkHydrationComplete(); | ||
| } | ||
| function Loading(props) { | ||
| if (!sharedConfig.hydrating) return signals.createLoadBoundary(() => props.children, () => props.fallback); | ||
| const onOpt = props.on ? { | ||
| on: () => props.on() | ||
| } : undefined; | ||
| if (!sharedConfig.hydrating) return signals.createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return signals.createMemo(() => { | ||
@@ -640,3 +738,4 @@ const o = signals.getOwner(); | ||
| } | ||
| return signals.createLoadBoundary(() => props.children, () => props.fallback); | ||
| const boundary = signals.createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return boundary; | ||
| }); | ||
@@ -790,2 +889,10 @@ } | ||
| }); | ||
| Object.defineProperty(exports, "createErrorBoundary", { | ||
| enumerable: true, | ||
| get: function () { return signals.createErrorBoundary; } | ||
| }); | ||
| Object.defineProperty(exports, "createLoadingBoundary", { | ||
| enumerable: true, | ||
| get: function () { return signals.createLoadingBoundary; } | ||
| }); | ||
| Object.defineProperty(exports, "createOwner", { | ||
@@ -811,2 +918,10 @@ enumerable: true, | ||
| }); | ||
| Object.defineProperty(exports, "enableExternalSource", { | ||
| enumerable: true, | ||
| get: function () { return signals.enableExternalSource; } | ||
| }); | ||
| Object.defineProperty(exports, "enforceLoadingBoundary", { | ||
| enumerable: true, | ||
| get: function () { return signals.enforceLoadingBoundary; } | ||
| }); | ||
| Object.defineProperty(exports, "flatten", { | ||
@@ -892,6 +1007,2 @@ enumerable: true, | ||
| }); | ||
| Object.defineProperty(exports, "setOnUnhandledAsync", { | ||
| enumerable: true, | ||
| get: function () { return signals.setOnUnhandledAsync; } | ||
| }); | ||
| Object.defineProperty(exports, "snapshot", { | ||
@@ -898,0 +1009,0 @@ enumerable: true, |
+139
-40
@@ -1,3 +0,3 @@ | ||
| import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createLoadBoundary, getOwner, onCleanup, isDisposed, runWithOwner, createOwner, createEffect as createEffect$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, untrack, mapArray, repeat } from '@solidjs/signals'; | ||
| export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, setOnUnhandledAsync, snapshot, storePath, untrack } from '@solidjs/signals'; | ||
| import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createLoadingBoundary, getOwner, onCleanup, isDisposed, runWithOwner, createOwner, createEffect as createEffect$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, untrack, mapArray, repeat } from '@solidjs/signals'; | ||
| export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createErrorBoundary, createLoadingBoundary, createOwner, createReaction, createRoot, createTrackedEffect, deep, enableExternalSource, enforceLoadingBoundary, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals'; | ||
@@ -189,2 +189,63 @@ const IS_DEV = false; | ||
| } | ||
| function createShadowDraft(realDraft) { | ||
| const shadow = JSON.parse(JSON.stringify(realDraft)); | ||
| let useShadow = true; | ||
| return { | ||
| proxy: new Proxy(shadow, { | ||
| get(_, prop) { | ||
| return useShadow ? shadow[prop] : realDraft[prop]; | ||
| }, | ||
| set(_, prop, value) { | ||
| if (useShadow) { | ||
| shadow[prop] = value; | ||
| return true; | ||
| } | ||
| return Reflect.set(realDraft, prop, value); | ||
| }, | ||
| deleteProperty(_, prop) { | ||
| if (useShadow) { | ||
| delete shadow[prop]; | ||
| return true; | ||
| } | ||
| return Reflect.deleteProperty(realDraft, prop); | ||
| }, | ||
| has(_, prop) { | ||
| return prop in (useShadow ? shadow : realDraft); | ||
| }, | ||
| ownKeys() { | ||
| return Reflect.ownKeys(useShadow ? shadow : realDraft); | ||
| }, | ||
| getOwnPropertyDescriptor(_, prop) { | ||
| return Object.getOwnPropertyDescriptor(useShadow ? shadow : realDraft, prop); | ||
| } | ||
| }), | ||
| activate() { | ||
| useShadow = false; | ||
| } | ||
| }; | ||
| } | ||
| function wrapFirstYield(iterable, activate) { | ||
| const srcIt = iterable[Symbol.asyncIterator](); | ||
| let first = true; | ||
| return { | ||
| [Symbol.asyncIterator]() { | ||
| return { | ||
| next() { | ||
| const p = srcIt.next(); | ||
| if (first) { | ||
| first = false; | ||
| return p.then(r => { | ||
| activate(); | ||
| return r.done ? r : { | ||
| done: false, | ||
| value: undefined | ||
| }; | ||
| }); | ||
| } | ||
| return p; | ||
| } | ||
| }; | ||
| } | ||
| }; | ||
| } | ||
| function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) { | ||
@@ -241,3 +302,7 @@ const parent = getOwner(); | ||
| const r = srcIt.next(); | ||
| return r && typeof r.then === "function" ? r.then(process) : syncThenable(process(r)); | ||
| return r && typeof r.then === "function" ? { | ||
| then(fn, rej) { | ||
| r.then(v => fn(process(v)), rej); | ||
| } | ||
| } : syncThenable(process(r)); | ||
| } | ||
@@ -271,3 +336,3 @@ if (buffered) { | ||
| function hydratedCreateMemo(compute, value, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| if (!sharedConfig.hydrating || options?.transparent) { | ||
| return createMemo$1(compute, value, options); | ||
@@ -278,3 +343,5 @@ } | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const memo = createMemo$1(prev => { | ||
@@ -310,3 +377,5 @@ if (!hydrated()) return prev ?? value; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = createSignal$1(prev => { | ||
@@ -362,3 +431,5 @@ if (!hydrated()) return prev ?? second; | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const sig = createOptimistic$1(prev => { | ||
@@ -389,10 +460,3 @@ if (!hydrated()) return prev ?? second; | ||
| } | ||
| function wrapStoreFn(fn, ssrSource) { | ||
| if (ssrSource === "initial") { | ||
| return draft => { | ||
| if (!sharedConfig.hydrating) return fn(draft); | ||
| subFetch(fn, draft); | ||
| return undefined; | ||
| }; | ||
| } | ||
| function wrapStoreFn(fn) { | ||
| return draft => { | ||
@@ -407,2 +471,45 @@ const o = getOwner(); | ||
| } | ||
| function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| if (!hydrated()) return; | ||
| return fn(draft); | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| if (ssrSource === "hybrid") { | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| const result = coreFn(draft => { | ||
| const o = getOwner(); | ||
| if (!hydrated()) { | ||
| if (sharedConfig.has(o.id)) { | ||
| const initP = sharedConfig.load(o.id); | ||
| const init = initP?.v ?? initP; | ||
| if (init != null) { | ||
| subFetch(fn, draft); | ||
| return init; | ||
| } | ||
| } | ||
| return fn(draft); | ||
| } | ||
| const { | ||
| proxy, | ||
| activate | ||
| } = createShadowDraft(draft); | ||
| const r = fn(proxy); | ||
| return isAsyncIterable(r) ? wrapFirstYield(r, activate) : r; | ||
| }, initialValue, options); | ||
| setHydrated(true); | ||
| return result; | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(coreFn, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return coreFn(wrapStoreFn(fn), initialValue, options); | ||
| } | ||
| function hydratedCreateStore(first, second, third) { | ||
@@ -412,8 +519,4 @@ if (typeof first !== "function" || !sharedConfig.hydrating) return createStore$1(first, second, third); | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return createStore$1(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(createStore$1, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return createStore$1(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return createStore$1(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource); | ||
| } | ||
@@ -424,21 +527,11 @@ function hydratedCreateOptimisticStore(first, second, third) { | ||
| const ssrSource = third?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return createOptimisticStore$1(second ?? {}, undefined, third); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(createOptimisticStore$1, second ?? {}, third); | ||
| if (aiResult !== null) return aiResult; | ||
| return createOptimisticStore$1(wrapStoreFn(first, ssrSource), second, third); | ||
| if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}, undefined, third); | ||
| return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource); | ||
| } | ||
| function hydratedCreateProjection(fn, initialValue, options) { | ||
| if (!sharedConfig.hydrating) { | ||
| return createProjection$1(fn, initialValue, options); | ||
| } | ||
| if (!sharedConfig.hydrating) return createProjection$1(fn, initialValue, options); | ||
| markTopLevelSnapshotScope(); | ||
| const ssrSource = options?.ssrSource; | ||
| if (ssrSource === "client" || ssrSource === "initial") { | ||
| return createProjection$1(draft => draft, initialValue, options); | ||
| } | ||
| const aiResult = hydrateStoreFromAsyncIterable(createProjection$1, initialValue, options); | ||
| if (aiResult !== null) return aiResult; | ||
| return createProjection$1(wrapStoreFn(fn, ssrSource), initialValue, options); | ||
| if (ssrSource === "initial") return createProjection$1(draft => draft, initialValue, options); | ||
| return hydrateStoreLikeFn(createProjection$1, fn, initialValue, options, ssrSource); | ||
| } | ||
@@ -449,3 +542,5 @@ function hydratedEffect(coreFn, compute, effectFn, value, options) { | ||
| if (ssrSource === "client") { | ||
| const [hydrated, setHydrated] = createSignal$1(false); | ||
| const [hydrated, setHydrated] = createSignal$1(false, { | ||
| pureWrite: true | ||
| }); | ||
| let active = false; | ||
@@ -584,9 +679,12 @@ coreFn(prev => { | ||
| _snapshotRootOwner = null; | ||
| _hydratingValue = false; | ||
| releaseSnapshotScope(o); | ||
| flush(); | ||
| _hydratingValue = false; | ||
| checkHydrationComplete(); | ||
| } | ||
| function Loading(props) { | ||
| if (!sharedConfig.hydrating) return createLoadBoundary(() => props.children, () => props.fallback); | ||
| const onOpt = props.on ? { | ||
| on: () => props.on() | ||
| } : undefined; | ||
| if (!sharedConfig.hydrating) return createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return createMemo$1(() => { | ||
@@ -639,3 +737,4 @@ const o = getOwner(); | ||
| } | ||
| return createLoadBoundary(() => props.children, () => props.fallback); | ||
| const boundary = createLoadingBoundary(() => props.children, () => props.fallback, onOpt); | ||
| return boundary; | ||
| }); | ||
@@ -642,0 +741,0 @@ } |
+2
-2
| { | ||
| "name": "solid-js", | ||
| "description": "A declarative JavaScript library for building user interfaces.", | ||
| "version": "2.0.0-beta.2", | ||
| "version": "2.0.0-beta.3", | ||
| "author": "Ryan Carniato", | ||
@@ -82,3 +82,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@solidjs/signals": "^0.12.0", | ||
| "@solidjs/signals": "^0.13.3", | ||
| "csstype": "^3.1.0", | ||
@@ -85,0 +85,0 @@ "seroval": "~1.5.0", |
@@ -81,2 +81,3 @@ import { createErrorBoundary as coreErrorBoundary, createMemo as coreMemo, createSignal as coreSignal, createOptimistic as coreOptimistic, createRenderEffect as coreRenderEffect, createEffect as coreEffect, $REFRESH, type ProjectionOptions, type Store, type StoreSetter, type Context } from "@solidjs/signals"; | ||
| fallback?: JSX.Element; | ||
| on?: () => any; | ||
| children: JSX.Element; | ||
@@ -83,0 +84,0 @@ }): JSX.Element; |
+2
-2
@@ -1,3 +0,3 @@ | ||
| export { $PROXY, $REFRESH, $TRACK, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, setOnUnhandledAsync, snapshot, storePath, untrack } from "@solidjs/signals"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals"; | ||
| export { $PROXY, $REFRESH, $TRACK, action, createErrorBoundary, createLoadingBoundary, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, enableExternalSource, enforceLoadingBoundary, snapshot, storePath, untrack } from "@solidjs/signals"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals"; | ||
| export { $DEVCOMP, children, createContext, useContext } from "./client/core.js"; | ||
@@ -4,0 +4,0 @@ export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js"; |
@@ -20,2 +20,3 @@ import type { JSX } from "../jsx.js"; | ||
| fallback?: JSX.Element; | ||
| on?: () => any; | ||
| children: JSX.Element; | ||
@@ -22,0 +23,0 @@ }): JSX.Element; |
@@ -1,3 +0,3 @@ | ||
| export { $PROXY, $REFRESH, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createOwner, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, snapshot, storePath, createDeepProxy, setOnUnhandledAsync, untrack } from "./signals.js"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter, PatchOp } from "./signals.js"; | ||
| export { $PROXY, $REFRESH, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createErrorBoundary, createLoadingBoundary, createOwner, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, snapshot, storePath, createDeepProxy, enableExternalSource, enforceLoadingBoundary, untrack } from "./signals.js"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter, PatchOp } from "./signals.js"; | ||
| export { $DEVCOMP, children, createContext, useContext, ssrRunInScope } from "./core.js"; | ||
@@ -4,0 +4,0 @@ export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./core.js"; |
@@ -1,5 +0,5 @@ | ||
| export { createRoot, createOwner, runWithOwner, getOwner, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, setOnUnhandledAsync } from "@solidjs/signals"; | ||
| export { createRoot, createOwner, runWithOwner, getOwner, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals"; | ||
| export { flatten } from "@solidjs/signals"; | ||
| export { snapshot, merge, omit, storePath, $PROXY, $REFRESH, $TRACK } from "@solidjs/signals"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals"; | ||
| export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals"; | ||
| import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals"; | ||
@@ -52,3 +52,5 @@ import { NoHydrateContext } from "./shared.js"; | ||
| export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): () => unknown; | ||
| export declare function createLoadBoundary(fn: () => any, fallback: () => any): () => unknown; | ||
| export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: { | ||
| on?: () => any; | ||
| }): () => unknown; | ||
| export declare function untrack<T>(fn: () => T): T; | ||
@@ -55,0 +57,0 @@ export declare function flush(): void; |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
389799
3.13%10263
4.42%+ Added
- Removed
Updated