eclipsa 0.1.9 → 0.1.10
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/{action-CArGTCnQ.mjs → action-DCc4fBhy.mjs} +80 -7
- package/action-DCc4fBhy.mjs.map +1 -0
- package/{client-B72eA7ds.mjs → client--uq9YZzN.mjs} +3 -3
- package/{client-B72eA7ds.mjs.map → client--uq9YZzN.mjs.map} +1 -1
- package/core/client/mod.mjs +3 -3
- package/core/dev-client/mod.mjs +3 -3
- package/core/internal.d.mts +1 -1
- package/core/internal.mjs +1 -1
- package/core/prod-client/mod.mjs +3 -3
- package/{internal-CHYAJznU.d.mts → internal-1QlldZaD.d.mts} +2 -1
- package/jsx/mod.mjs +1 -1
- package/mod.d.mts +2 -2
- package/mod.mjs +3 -3
- package/package.json +2 -2
- package/{signal-DBswUs2I.mjs → signal-DoW9q--8.mjs} +10 -2
- package/{signal-DBswUs2I.mjs.map → signal-DoW9q--8.mjs.map} +1 -1
- package/{ssr-BUrr2VpM.mjs → ssr-lXZqUHZs.mjs} +4 -4
- package/{ssr-BUrr2VpM.mjs.map → ssr-lXZqUHZs.mjs.map} +1 -1
- package/{ssr-D8F-DtCv.d.mts → ssr-wXShLrdB.d.mts} +2 -2
- package/vite/build/runtime.d.mts +2 -2
- package/vite/build/runtime.mjs +2 -2
- package/vite/mod.mjs +1 -1
- package/web-utils/mod.mjs +2 -2
- package/action-CArGTCnQ.mjs.map +0 -1
|
@@ -1870,7 +1870,7 @@ const parseInsertMarker = (value) => {
|
|
|
1870
1870
|
};
|
|
1871
1871
|
//#endregion
|
|
1872
1872
|
//#region core/runtime/serialization.ts
|
|
1873
|
-
const createRuntimeSerialization = ({ createProjectionSlot, ensureRouterState, ensureRuntimeElementId, evaluateProps, findRuntimeElement, getResolvedRuntimeSymbols, isPlainObject, isProjectionSlot, isRenderObject, isRouteSlot, loadSymbol, materializeScope, materializeSymbolReference, registerScope, registerSerializedScope, resolveRenderable }) => {
|
|
1873
|
+
const createRuntimeSerialization = ({ createProjectionSlot, ensureRouterState, ensureRuntimeElementId, evaluateProps, findRuntimeElement, getResolvedRuntimeSymbols, isPlainObject, isProjectionSlot, isRenderObject, isRouteSlot, loadSymbol, materializeComputedSignalReference, materializeScope, materializeSymbolReference, registerScope, registerSerializedScope, resolveRenderable }) => {
|
|
1874
1874
|
const getRenderComponentTypeRef = (value) => {
|
|
1875
1875
|
if (typeof value !== "function") return null;
|
|
1876
1876
|
return value[RENDER_COMPONENT_TYPE_KEY] ?? null;
|
|
@@ -1994,7 +1994,7 @@ const createRuntimeSerialization = ({ createProjectionSlot, ensureRouterState, e
|
|
|
1994
1994
|
const signalMeta = getSignalMeta(candidate);
|
|
1995
1995
|
if (signalMeta) return {
|
|
1996
1996
|
__eclipsa_type: "ref",
|
|
1997
|
-
kind: "signal",
|
|
1997
|
+
kind: signalMeta.kind === "computed-signal" ? "computed-signal" : "signal",
|
|
1998
1998
|
token: signalMeta.id
|
|
1999
1999
|
};
|
|
2000
2000
|
if (getNavigateMeta(candidate)) return {
|
|
@@ -2128,6 +2128,7 @@ const createRuntimeSerialization = ({ createProjectionSlot, ensureRouterState, e
|
|
|
2128
2128
|
if (!record) throw new Error(`Missing signal ${reference.token}.`);
|
|
2129
2129
|
return record.handle;
|
|
2130
2130
|
}
|
|
2131
|
+
if (reference.kind === "computed-signal") return materializeComputedSignalReference(container, reference.token);
|
|
2131
2132
|
if (reference.kind === "symbol") {
|
|
2132
2133
|
if (!reference.data || !Array.isArray(reference.data)) throw new TypeError("Symbol references require an encoded scope array.");
|
|
2133
2134
|
const scopeId = registerSerializedScope(container, reference.data);
|
|
@@ -2373,6 +2374,7 @@ const getRuntimeSerialization = () => {
|
|
|
2373
2374
|
isRenderObject,
|
|
2374
2375
|
isRouteSlot,
|
|
2375
2376
|
loadSymbol,
|
|
2377
|
+
materializeComputedSignalReference,
|
|
2376
2378
|
materializeScope,
|
|
2377
2379
|
materializeSymbolReference,
|
|
2378
2380
|
registerScope,
|
|
@@ -2394,8 +2396,15 @@ const findNextNumericId = (ids, prefix) => {
|
|
|
2394
2396
|
}
|
|
2395
2397
|
return nextId;
|
|
2396
2398
|
};
|
|
2397
|
-
const
|
|
2398
|
-
const
|
|
2399
|
+
const isWritableSignalMeta = (meta) => !!meta && meta.kind !== "computed-signal";
|
|
2400
|
+
const getRefSignalId = (value) => {
|
|
2401
|
+
const signalMeta = getSignalMeta(value);
|
|
2402
|
+
return isWritableSignalMeta(signalMeta) ? signalMeta.id : null;
|
|
2403
|
+
};
|
|
2404
|
+
const getBindableSignalId = (value) => {
|
|
2405
|
+
const signalMeta = getSignalMeta(value);
|
|
2406
|
+
return isWritableSignalMeta(signalMeta) ? signalMeta.id : null;
|
|
2407
|
+
};
|
|
2399
2408
|
const syncRuntimeRefMarker = (element, value) => {
|
|
2400
2409
|
const signalId = getRefSignalId(value);
|
|
2401
2410
|
if (signalId) {
|
|
@@ -2412,7 +2421,7 @@ const readBindableSignalValue = (value) => {
|
|
|
2412
2421
|
};
|
|
2413
2422
|
const assignRuntimeRef = (value, element, container = getCurrentContainer()) => {
|
|
2414
2423
|
const signalMeta = getSignalMeta(value);
|
|
2415
|
-
if (!signalMeta) return false;
|
|
2424
|
+
if (!isWritableSignalMeta(signalMeta)) return false;
|
|
2416
2425
|
const record = container?.signals.get(signalMeta.id);
|
|
2417
2426
|
if (record) {
|
|
2418
2427
|
writeSignalValue(container, record, element);
|
|
@@ -2567,12 +2576,41 @@ const createSignalHandle = (record, container) => {
|
|
|
2567
2576
|
setSignalMeta(handle, {
|
|
2568
2577
|
get: () => record.value,
|
|
2569
2578
|
id: record.id,
|
|
2579
|
+
kind: "signal",
|
|
2570
2580
|
set: (value) => {
|
|
2571
2581
|
writeSignalValue(container, record, value);
|
|
2572
2582
|
}
|
|
2573
2583
|
});
|
|
2574
2584
|
return handle;
|
|
2575
2585
|
};
|
|
2586
|
+
const isComputedSignalSnapshot = (value) => !!value && typeof value === "object" && value.__e_async_computed === true;
|
|
2587
|
+
const readComputedSignalValue = (record) => {
|
|
2588
|
+
recordSignalRead(record);
|
|
2589
|
+
const snapshot = record.value;
|
|
2590
|
+
if (!isComputedSignalSnapshot(snapshot)) return snapshot;
|
|
2591
|
+
if (snapshot.status === "pending") throw createPendingSignalError(snapshot.promise ?? Promise.resolve(void 0));
|
|
2592
|
+
if (snapshot.status === "rejected") throw snapshot.error;
|
|
2593
|
+
return snapshot.value;
|
|
2594
|
+
};
|
|
2595
|
+
const createComputedSignalHandle = (record, _container) => {
|
|
2596
|
+
const handle = {};
|
|
2597
|
+
Object.defineProperty(handle, "value", {
|
|
2598
|
+
configurable: true,
|
|
2599
|
+
enumerable: true,
|
|
2600
|
+
get() {
|
|
2601
|
+
return readComputedSignalValue(record);
|
|
2602
|
+
}
|
|
2603
|
+
});
|
|
2604
|
+
setSignalMeta(handle, {
|
|
2605
|
+
get: () => readComputedSignalValue(record),
|
|
2606
|
+
id: record.id,
|
|
2607
|
+
kind: "computed-signal",
|
|
2608
|
+
set: () => {
|
|
2609
|
+
throw new TypeError("Computed signals are read-only.");
|
|
2610
|
+
}
|
|
2611
|
+
});
|
|
2612
|
+
return handle;
|
|
2613
|
+
};
|
|
2576
2614
|
const isPrimitiveSignalValue = (value) => value === null || typeof value !== "object" && typeof value !== "function";
|
|
2577
2615
|
const didSignalValueChange = (previous, next) => {
|
|
2578
2616
|
if (isPrimitiveSignalValue(previous) && isPrimitiveSignalValue(next)) return !Object.is(previous, next);
|
|
@@ -2797,6 +2835,11 @@ const materializeSymbolReference = (container, symbolId, scopeId) => {
|
|
|
2797
2835
|
});
|
|
2798
2836
|
return fn;
|
|
2799
2837
|
};
|
|
2838
|
+
const materializeComputedSignalReference = (container, signalId) => {
|
|
2839
|
+
const record = container.signals.get(signalId);
|
|
2840
|
+
if (!record) throw new Error(`Missing signal ${signalId}.`);
|
|
2841
|
+
return createComputedSignalHandle(record, container);
|
|
2842
|
+
};
|
|
2800
2843
|
const materializeScope = (container, scopeId) => {
|
|
2801
2844
|
const slots = container.scopes.get(scopeId);
|
|
2802
2845
|
if (!slots) throw new Error(`Missing scope ${scopeId}.`);
|
|
@@ -5477,6 +5520,32 @@ const collectResumeHmrBoundaryIds = (container, symbolIds) => {
|
|
|
5477
5520
|
}
|
|
5478
5521
|
return result;
|
|
5479
5522
|
};
|
|
5523
|
+
const rewriteSerializedSymbolReferenceToken = (value, affectedIds, nextSymbolId) => {
|
|
5524
|
+
if (Array.isArray(value)) {
|
|
5525
|
+
for (const entry of value) rewriteSerializedSymbolReferenceToken(entry, affectedIds, nextSymbolId);
|
|
5526
|
+
return;
|
|
5527
|
+
}
|
|
5528
|
+
if (!value || typeof value !== "object" || !("__eclipsa_type" in value)) return;
|
|
5529
|
+
switch (value.__eclipsa_type) {
|
|
5530
|
+
case "object":
|
|
5531
|
+
for (const [, entry] of value.entries) rewriteSerializedSymbolReferenceToken(entry, affectedIds, nextSymbolId);
|
|
5532
|
+
return;
|
|
5533
|
+
case "map":
|
|
5534
|
+
for (const [key, entry] of value.entries) {
|
|
5535
|
+
rewriteSerializedSymbolReferenceToken(key, affectedIds, nextSymbolId);
|
|
5536
|
+
rewriteSerializedSymbolReferenceToken(entry, affectedIds, nextSymbolId);
|
|
5537
|
+
}
|
|
5538
|
+
return;
|
|
5539
|
+
case "set":
|
|
5540
|
+
for (const entry of value.entries) rewriteSerializedSymbolReferenceToken(entry, affectedIds, nextSymbolId);
|
|
5541
|
+
return;
|
|
5542
|
+
case "ref":
|
|
5543
|
+
if (value.kind === "symbol" && affectedIds.has(value.token)) value.token = nextSymbolId;
|
|
5544
|
+
if (value.data !== void 0) rewriteSerializedSymbolReferenceToken(value.data, affectedIds, nextSymbolId);
|
|
5545
|
+
return;
|
|
5546
|
+
default: return;
|
|
5547
|
+
}
|
|
5548
|
+
};
|
|
5480
5549
|
const applyResumeHmrSymbolReplacements = (container, replacements) => {
|
|
5481
5550
|
for (const [oldSymbolId, url] of Object.entries(replacements)) {
|
|
5482
5551
|
const currentUrl = container.symbols.get(oldSymbolId);
|
|
@@ -5491,6 +5560,7 @@ const applyResumeHmrSymbolReplacements = (container, replacements) => {
|
|
|
5491
5560
|
for (const component of container.components.values()) if (affectedIds.has(component.symbol)) component.symbol = nextSymbolId;
|
|
5492
5561
|
for (const watch of container.watches.values()) if (affectedIds.has(watch.symbol)) watch.symbol = nextSymbolId;
|
|
5493
5562
|
for (const visible of container.visibles.values()) if (affectedIds.has(visible.symbol)) visible.symbol = nextSymbolId;
|
|
5563
|
+
for (const slots of container.scopes.values()) for (const slot of slots) rewriteSerializedSymbolReferenceToken(slot, affectedIds, nextSymbolId);
|
|
5494
5564
|
container.symbols.set(nextSymbolId, url);
|
|
5495
5565
|
invalidateRuntimeSymbolCaches(container, [nextSymbolId]);
|
|
5496
5566
|
}
|
|
@@ -6238,7 +6308,10 @@ const useRuntimeSignal = (fallback) => {
|
|
|
6238
6308
|
};
|
|
6239
6309
|
const createDetachedRuntimeSignal = (container, id, fallback) => ensureSignalRecord(container, id, fallback).handle;
|
|
6240
6310
|
const getRuntimeComponentId = () => getCurrentFrame()?.component.id ?? null;
|
|
6241
|
-
const getRuntimeSignalId = (value) =>
|
|
6311
|
+
const getRuntimeSignalId = (value) => {
|
|
6312
|
+
const signalMeta = getSignalMeta(value);
|
|
6313
|
+
return isWritableSignalMeta(signalMeta) ? signalMeta.id : null;
|
|
6314
|
+
};
|
|
6242
6315
|
const useRuntimeNavigate = () => {
|
|
6243
6316
|
const container = getCurrentContainer();
|
|
6244
6317
|
if (!container) return createStandaloneNavigate();
|
|
@@ -6963,4 +7036,4 @@ const __eclipsaAction = (id, middlewares, handler) => {
|
|
|
6963
7036
|
//#endregion
|
|
6964
7037
|
export { shouldReconnectDetachedInsertMarkers as $, deserializeValue as $n, __eclipsaLoader as $t, getRuntimeComponentId as A, createPendingSignalError as An, getActionHookMeta as At, refreshRegisteredRouteContainers as B, createRequestFetch as Bn, getRegisteredLoaderHook as Bt, createOnCleanup as C, createContext as Cn, RESUME_FINAL_STATE_ELEMENT_ID as Ct, createStandaloneRuntimeSignal as D, materializeRuntimeContextProvider as Dn, __eclipsaLazy as Dt, createResumeContainer as E, materializeRuntimeContext as En, __eclipsaEvent as Et, notFound as F, applyActionCsrfCookie as Fn, getLoaderHandleMeta as Ft, renderSSRAttr as G, registerClientHooks as Gn, registerLoaderHook as Gt, registerRuntimeScopedStyle as H, getClientHooks as Hn, getSignalMeta as Ht, preserveReusableContentInRoots as I, ensureActionCsrfToken as In, getLoaderHookMeta as It, renderString as J, runHandleError as Jn, setExternalComponentMeta as Jt, renderSSRMap as K, resetClientHooks as Kn, setActionHandleMeta as Kt, primeLocationState as L, readActionCsrfTokenFromDocument as Ln, getNavigateMeta as Lt, getRuntimeSignalId as M, isSuspenseType as Mn, getEventMeta as Mt, getStreamingResumeBootstrapScriptContent as N, ACTION_CSRF_FIELD as Nn, getExternalComponentMeta as Nt, createWatch as O, useContext as On, __eclipsaWatch as Ot, installResumeListeners as P, ACTION_CSRF_INPUT_ATTR as Pn, getLazyMeta as Pt, restoreSignalRefs as Q, withServerRequestContext as Qn, setSignalMeta as Qt, primeRouteModules as R, APP_HOOKS_ELEMENT_ID as Rn, getRegisteredActionHook as Rt, createEffect as S, resolveRouteMetadata as Sn, ACTION_FORM_ATTR$1 as St, createOnVisible as T, getRuntimeContextReference as Tn, __eclipsaComponent as Tt, renderClientInsertable as U, getCurrentServerRequestContext as Un, getWatchMeta as Ut, registerResumeContainer as V, deserializePublicValue as Vn, getRegisteredLoaderHookIds as Vt, renderClientInsertableForOwner as W, markPublicError as Wn, registerActionHook as Wt, restoreResumedExternalComponents as X, toPublicError as Xn, setLoaderHookMeta as Xt, restoreRegisteredRpcHandles as Y, serializePublicValue as Yn, setLoaderHandleMeta as Yt, restoreResumedLocalSignalEffects as Z, transformCurrentPublicError as Zn, setNavigateMeta as Zt, beginSSRContainer as _, ROUTE_REPLACE_ATTR as _n, getRememberedInsertMarkerNodeCount as _t, action as a, loader_exports as an, IS_BROWSER as ar, useRuntimeLocation as at, collectPendingSuspenseBoundaryIds as b, composeRouteMetadata as bn, rememberManagedAttributesForNodes as bt, getActionFormSubmissionId as c, registerLoader as cn, noSerialize as cr, useRuntimeRouteParams as ct, primeActionState as d, ROUTE_DATA_REQUEST_HEADER as dn, writeAsyncSignalSnapshot as dt, consumePendingSsrLoaderIds as en, escapeInlineScriptText as er, syncRuntimeRefMarker as et, registerAction as f, ROUTE_LINK_ATTR as fn, INSERT_MARKER_PREFIX as ft, beginAsyncSSRContainer as g, ROUTE_PREFLIGHT_REQUEST_HEADER as gn, parseInsertMarker as gt, assignRuntimeRef as h, ROUTE_PREFLIGHT_ENDPOINT as hn, parseComponentBoundaryMarker as ht, __eclipsaAction as i, loader as in, serializeValue as ir, tryPatchNodeSequenceInPlace as it, getRuntimeContainer as j, isPendingSignalError as jn, getComponentMeta as jt, getResumePayloadScriptContent as k, Suspense as kn, getActionHandleMeta as kt, getNormalizedActionInput as l, resolvePendingLoaders as ln, useRuntimeSignal as lt, applyResumeHmrUpdateToRegisteredContainers as m, ROUTE_PREFETCH_ATTR as mn, createInsertMarker as mt, ACTION_FORM_ATTR as n, hasLoader as nn, parseSerializedJSON as nr, toResumePayloadSubset as nt, executeAction as o, markPendingSsrLoader as on, IS_SSR as or, useRuntimeNavigate as ot, validator as p, ROUTE_MANIFEST_ELEMENT_ID as pn, createComponentBoundaryHtmlComment as pt, renderSSRValue as q, resolveReroute as qn, setActionHookMeta as qt, ACTION_FORM_FIELD as r, isPendingSsrLoaderError as rn, serializeJSONScriptContent as rr, tryPatchElementShellInPlace as rt, executeActionSubmission as s, primeLoaderState as sn, isNoSerialize as sr, useRuntimeRouteError as st, ACTION_CONTENT_TYPE as t, executeLoader as tn, escapeJSONScriptText as tr, toResumePayload as tt, hasAction as u, ROUTE_DATA_ENDPOINT as un, withRuntimeContainer as ut, bindRuntimeEvent as v, ROUTE_RPC_URL_HEADER as vn, rememberInsertMarkerRange as vt, createOnMount as w, getContextProviderMeta as wn, RESUME_STATE_ELEMENT_ID as wt, createDetachedClientInsertOwner as x, renderRouteMetadataHead as xn, syncManagedAttributeSnapshot as xt, captureClientInsertOwner as y, ROUTE_METADATA_HEAD_ATTR as yn, rememberManagedAttributesForNode as yt, readAsyncSignalSnapshot as z, attachRequestFetch as zn, getRegisteredActionHookIds as zt };
|
|
6965
7038
|
|
|
6966
|
-
//# sourceMappingURL=action-
|
|
7039
|
+
//# sourceMappingURL=action-DCc4fBhy.mjs.map
|