@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +86 -61
- package/dist/dev.js +81 -60
- package/dist/server.cjs +34 -17
- package/dist/server.js +35 -19
- package/dist/web.cjs +83 -59
- package/dist/web.js +78 -58
- package/frames/dist/client.cjs +8 -8
- package/frames/dist/client.dev.cjs +8 -8
- package/frames/dist/client.dev.js +8 -8
- package/frames/dist/client.js +8 -8
- package/frames/dist/server.cjs +28 -18
- package/frames/dist/server.js +29 -19
- package/package.json +20 -22
- package/serialization/dist/decode.cjs +3 -3
- package/serialization/dist/decode.js +3 -3
- package/serialization/dist/serialization.cjs +7 -11
- package/serialization/dist/serialization.js +7 -6
- package/serialization/types/index.d.ts +69 -157
- package/serialization/types/serializer-decode.d.ts +89 -112
- package/serialization/types/serializer.d.ts +94 -0
- package/serialization/types-cjs/index.d.cts +69 -157
- package/serialization/types-cjs/serializer-decode.d.cts +89 -112
- package/serialization/types-cjs/serializer.d.cts +94 -0
- package/types/client.d.ts +150 -290
- package/types/constants.d.ts +18 -0
- package/types/cookies.d.ts +31 -75
- package/types/frames/frame-client.d.ts +287 -277
- package/types/frames/frame-container-plugin.d.ts +71 -0
- package/types/frames/frame-sink.d.ts +58 -160
- package/types/frames/frame-transport.d.ts +161 -194
- package/types/frames/serializer-decode.d.ts +159 -0
- package/types/frames/serializer.d.ts +69 -157
- package/types/head.d.ts +16 -0
- package/types/index.d.ts +0 -65
- package/types/index.server.d.ts +125 -0
- package/types/jsx.d.ts +5 -13
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +4 -0
- package/types/response.d.ts +41 -153
- package/types/serializer-decode.d.ts +89 -112
- package/types/serializer.d.ts +69 -157
- package/types/server-functions/client.d.ts +93 -222
- package/types/server-functions/flash.d.ts +10 -30
- package/types/server-functions/registry.d.ts +63 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +292 -574
- package/types/server-functions/shared.d.ts +112 -458
- package/types/server-mock.d.ts +2 -2
- package/types/server.d.ts +242 -434
- package/types-cjs/client.d.cts +150 -290
- package/types-cjs/constants.d.cts +18 -0
- package/types-cjs/cookies.d.cts +31 -75
- package/types-cjs/frames/frame-client.d.cts +287 -277
- package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
- package/types-cjs/frames/frame-sink.d.cts +58 -160
- package/types-cjs/frames/frame-transport.d.cts +161 -194
- package/types-cjs/frames/serializer-decode.d.cts +159 -0
- package/types-cjs/frames/serializer.d.cts +69 -157
- package/types-cjs/head.d.cts +16 -0
- package/types-cjs/index.d.cts +0 -65
- package/types-cjs/index.server.d.cts +125 -0
- package/types-cjs/jsx.d.cts +5 -13
- package/types-cjs/reconcile.d.cts +1 -0
- package/types-cjs/render.d.cts +4 -0
- package/types-cjs/response.d.cts +41 -153
- package/types-cjs/serializer-decode.d.cts +89 -112
- package/types-cjs/serializer.d.cts +69 -157
- package/types-cjs/server-functions/client.d.cts +93 -222
- package/types-cjs/server-functions/flash.d.cts +10 -30
- package/types-cjs/server-functions/registry.d.cts +63 -0
- package/types-cjs/server-functions/rich-args.d.cts +1 -10
- package/types-cjs/server-functions/server.d.cts +292 -574
- package/types-cjs/server-functions/shared.d.cts +112 -458
- package/types-cjs/server-mock.d.cts +2 -2
- package/types-cjs/server.d.cts +242 -434
- package/LICENSE +0 -21
- package/types/core.d.ts +0 -9
- package/types-cjs/core.d.cts +0 -9
package/dist/server.cjs
CHANGED
|
@@ -57,14 +57,18 @@ const transparentOptions = {
|
|
|
57
57
|
const syncOptions = {
|
|
58
58
|
sync: true
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
function effect(fn, effectFn, options) {
|
|
61
|
+
solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
62
|
+
sync: true,
|
|
63
|
+
...options,
|
|
64
|
+
transparent: !options.scope
|
|
65
|
+
} : transparentOptions);
|
|
66
|
+
}
|
|
67
|
+
function memo(fn) {
|
|
68
|
+
return solidJs.createMemo(() => fn(), syncOptions);
|
|
69
|
+
}
|
|
66
70
|
|
|
67
|
-
const STATE = Symbol.for("
|
|
71
|
+
const STATE = Symbol.for("solid.container-trace-state");
|
|
68
72
|
const state = globalThis[STATE] || (globalThis[STATE] = {
|
|
69
73
|
materialized: new WeakMap(),
|
|
70
74
|
materializedValues: new WeakSet()
|
|
@@ -75,7 +79,7 @@ function setContainerTraceResolver(fn) {
|
|
|
75
79
|
function setContainerTraceStreamMint(fn) {
|
|
76
80
|
state.streamOf = fn;
|
|
77
81
|
}
|
|
78
|
-
const TRACE = Symbol.for("
|
|
82
|
+
const TRACE = Symbol.for("solid.container-trace");
|
|
79
83
|
function materialize(marker) {
|
|
80
84
|
let value = state.materialized.get(marker.$tr);
|
|
81
85
|
if (value === undefined) {
|
|
@@ -94,7 +98,7 @@ function parseTrace(value, ctx) {
|
|
|
94
98
|
};
|
|
95
99
|
}
|
|
96
100
|
const ContainerTracePlugin = {
|
|
97
|
-
tag: "
|
|
101
|
+
tag: "solid/container-trace",
|
|
98
102
|
test(value) {
|
|
99
103
|
return value != null && typeof value === "object" && TRACE in value;
|
|
100
104
|
},
|
|
@@ -210,11 +214,14 @@ function isSafeError(value) {
|
|
|
210
214
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
211
215
|
}
|
|
212
216
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
213
|
-
function initWithRevalidate(init) {
|
|
217
|
+
function initWithRevalidate(init = {}) {
|
|
218
|
+
const resolved = typeof init === "number" ? {
|
|
219
|
+
status: init
|
|
220
|
+
} : init;
|
|
214
221
|
const {
|
|
215
222
|
revalidate,
|
|
216
223
|
...responseInit
|
|
217
|
-
} =
|
|
224
|
+
} = resolved;
|
|
218
225
|
let headers;
|
|
219
226
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
220
227
|
headers = new Headers();
|
|
@@ -240,9 +247,7 @@ function redirect(url, init = 302) {
|
|
|
240
247
|
const {
|
|
241
248
|
responseInit,
|
|
242
249
|
headers
|
|
243
|
-
} = initWithRevalidate(
|
|
244
|
-
status: init
|
|
245
|
-
} : init);
|
|
250
|
+
} = initWithRevalidate(init);
|
|
246
251
|
if (responseInit.status === undefined) {
|
|
247
252
|
responseInit.status = 302;
|
|
248
253
|
}
|
|
@@ -1877,6 +1882,15 @@ function createLiveHoles(sink, scoped) {
|
|
|
1877
1882
|
const stamp = typeof solidJs.creationStamp === "function" ? solidJs.creationStamp : () => 0;
|
|
1878
1883
|
const inScope = scoped && typeof solidJs.inServerComponentScope === "function" ? solidJs.inServerComponentScope : null;
|
|
1879
1884
|
const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->/g, "");
|
|
1885
|
+
const swept = (owner, ctx, fn) => {
|
|
1886
|
+
const prev = solidJs.sharedConfig.context;
|
|
1887
|
+
solidJs.sharedConfig.context = ctx;
|
|
1888
|
+
try {
|
|
1889
|
+
return owner ? solidJs.runWithOwner(owner, fn) : fn();
|
|
1890
|
+
} finally {
|
|
1891
|
+
solidJs.sharedConfig.context = prev;
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1880
1894
|
function resolveHoleValue(hole) {
|
|
1881
1895
|
const result = {
|
|
1882
1896
|
t: [""],
|
|
@@ -1942,6 +1956,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
1942
1956
|
const recordsBefore = engine.recordStamp;
|
|
1943
1957
|
const ownersBefore = stamp();
|
|
1944
1958
|
const owner = solidJs.getOwner();
|
|
1959
|
+
const holeCtx = solidJs.sharedConfig.context;
|
|
1945
1960
|
const b = {
|
|
1946
1961
|
key: null,
|
|
1947
1962
|
children: [],
|
|
@@ -1955,7 +1970,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
1955
1970
|
const sweepOwnersBefore = stamp();
|
|
1956
1971
|
let res;
|
|
1957
1972
|
try {
|
|
1958
|
-
res =
|
|
1973
|
+
res = swept(owner, holeCtx, () => resolveHoleValue(hole));
|
|
1959
1974
|
} catch (err) {
|
|
1960
1975
|
b.closed = true;
|
|
1961
1976
|
sink.closeBinding(b.key);
|
|
@@ -2063,6 +2078,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2063
2078
|
},
|
|
2064
2079
|
attr(cap) {
|
|
2065
2080
|
const owner = solidJs.getOwner();
|
|
2081
|
+
const holeCtx = solidJs.sharedConfig.context;
|
|
2066
2082
|
const b = {
|
|
2067
2083
|
key: "lha:" + cap.id,
|
|
2068
2084
|
children: [],
|
|
@@ -2098,7 +2114,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2098
2114
|
if (vt === "string" || vt === "number") html += v;
|
|
2099
2115
|
}
|
|
2100
2116
|
};
|
|
2101
|
-
|
|
2117
|
+
swept(owner, holeCtx, run);
|
|
2102
2118
|
} catch (err) {
|
|
2103
2119
|
if (solidJs.ssrHandleError(err, true)) return;
|
|
2104
2120
|
b.closed = true;
|
|
@@ -2434,7 +2450,7 @@ function ssrHydrationKey() {
|
|
|
2434
2450
|
const hk = getHydrationKey();
|
|
2435
2451
|
return hk ? ` _hk=${hk}` : "";
|
|
2436
2452
|
}
|
|
2437
|
-
const CLAIM_PROP = /*#__PURE__*/Symbol.for("
|
|
2453
|
+
const CLAIM_PROP = /*#__PURE__*/Symbol.for("solid.claim-prop");
|
|
2438
2454
|
const CLAIMS_STREAM = 1;
|
|
2439
2455
|
const CLAIMS_DOCUMENT = 2;
|
|
2440
2456
|
const CLAIM_UNSAFE = /[^A-Za-z0-9_.!~*'()-]/g;
|
|
@@ -3451,6 +3467,7 @@ exports.reload = reload;
|
|
|
3451
3467
|
exports.render = notSup;
|
|
3452
3468
|
exports.renderToStream = renderToStream;
|
|
3453
3469
|
exports.renderToString = renderToString;
|
|
3470
|
+
exports.resolveSSRNode = resolveSSRNode;
|
|
3454
3471
|
exports.resolveSSRSelectValues = resolveSSRSelectValues;
|
|
3455
3472
|
exports.respond = respond;
|
|
3456
3473
|
exports.runHydrationEvents = notSup;
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, createRoot, inServerComponentScope, getOwner, ssrHandleError,
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, createRoot, inServerComponentScope, getOwner, ssrHandleError, creationStamp, runWithOwner, createComponent, omit, getNextChildId, onCleanup, getProjectionTrace } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, ssrScope as scope, sharedConfig, untrack } from 'solid-js';
|
|
3
3
|
import { Feature, createStream, Serializer, getCrossReferenceHeader } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
@@ -56,14 +56,18 @@ const transparentOptions = {
|
|
|
56
56
|
const syncOptions = {
|
|
57
57
|
sync: true
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
function effect(fn, effectFn, options) {
|
|
60
|
+
createRenderEffect(fn, effectFn, options ? {
|
|
61
|
+
sync: true,
|
|
62
|
+
...options,
|
|
63
|
+
transparent: !options.scope
|
|
64
|
+
} : transparentOptions);
|
|
65
|
+
}
|
|
66
|
+
function memo(fn) {
|
|
67
|
+
return createMemo(() => fn(), syncOptions);
|
|
68
|
+
}
|
|
65
69
|
|
|
66
|
-
const STATE = Symbol.for("
|
|
70
|
+
const STATE = Symbol.for("solid.container-trace-state");
|
|
67
71
|
const state = globalThis[STATE] || (globalThis[STATE] = {
|
|
68
72
|
materialized: new WeakMap(),
|
|
69
73
|
materializedValues: new WeakSet()
|
|
@@ -74,7 +78,7 @@ function setContainerTraceResolver(fn) {
|
|
|
74
78
|
function setContainerTraceStreamMint(fn) {
|
|
75
79
|
state.streamOf = fn;
|
|
76
80
|
}
|
|
77
|
-
const TRACE = Symbol.for("
|
|
81
|
+
const TRACE = Symbol.for("solid.container-trace");
|
|
78
82
|
function materialize(marker) {
|
|
79
83
|
let value = state.materialized.get(marker.$tr);
|
|
80
84
|
if (value === undefined) {
|
|
@@ -93,7 +97,7 @@ function parseTrace(value, ctx) {
|
|
|
93
97
|
};
|
|
94
98
|
}
|
|
95
99
|
const ContainerTracePlugin = {
|
|
96
|
-
tag: "
|
|
100
|
+
tag: "solid/container-trace",
|
|
97
101
|
test(value) {
|
|
98
102
|
return value != null && typeof value === "object" && TRACE in value;
|
|
99
103
|
},
|
|
@@ -209,11 +213,14 @@ function isSafeError(value) {
|
|
|
209
213
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
210
214
|
}
|
|
211
215
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
212
|
-
function initWithRevalidate(init) {
|
|
216
|
+
function initWithRevalidate(init = {}) {
|
|
217
|
+
const resolved = typeof init === "number" ? {
|
|
218
|
+
status: init
|
|
219
|
+
} : init;
|
|
213
220
|
const {
|
|
214
221
|
revalidate,
|
|
215
222
|
...responseInit
|
|
216
|
-
} =
|
|
223
|
+
} = resolved;
|
|
217
224
|
let headers;
|
|
218
225
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
219
226
|
headers = new Headers();
|
|
@@ -239,9 +246,7 @@ function redirect(url, init = 302) {
|
|
|
239
246
|
const {
|
|
240
247
|
responseInit,
|
|
241
248
|
headers
|
|
242
|
-
} = initWithRevalidate(
|
|
243
|
-
status: init
|
|
244
|
-
} : init);
|
|
249
|
+
} = initWithRevalidate(init);
|
|
245
250
|
if (responseInit.status === undefined) {
|
|
246
251
|
responseInit.status = 302;
|
|
247
252
|
}
|
|
@@ -1876,6 +1881,15 @@ function createLiveHoles(sink, scoped) {
|
|
|
1876
1881
|
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
1877
1882
|
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
1878
1883
|
const stripMarkers = html => html.replace(/<!--lh:\/?\d+-->/g, "");
|
|
1884
|
+
const swept = (owner, ctx, fn) => {
|
|
1885
|
+
const prev = sharedConfig.context;
|
|
1886
|
+
sharedConfig.context = ctx;
|
|
1887
|
+
try {
|
|
1888
|
+
return owner ? runWithOwner(owner, fn) : fn();
|
|
1889
|
+
} finally {
|
|
1890
|
+
sharedConfig.context = prev;
|
|
1891
|
+
}
|
|
1892
|
+
};
|
|
1879
1893
|
function resolveHoleValue(hole) {
|
|
1880
1894
|
const result = {
|
|
1881
1895
|
t: [""],
|
|
@@ -1941,6 +1955,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
1941
1955
|
const recordsBefore = engine.recordStamp;
|
|
1942
1956
|
const ownersBefore = stamp();
|
|
1943
1957
|
const owner = getOwner();
|
|
1958
|
+
const holeCtx = sharedConfig.context;
|
|
1944
1959
|
const b = {
|
|
1945
1960
|
key: null,
|
|
1946
1961
|
children: [],
|
|
@@ -1954,7 +1969,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
1954
1969
|
const sweepOwnersBefore = stamp();
|
|
1955
1970
|
let res;
|
|
1956
1971
|
try {
|
|
1957
|
-
res =
|
|
1972
|
+
res = swept(owner, holeCtx, () => resolveHoleValue(hole));
|
|
1958
1973
|
} catch (err) {
|
|
1959
1974
|
b.closed = true;
|
|
1960
1975
|
sink.closeBinding(b.key);
|
|
@@ -2062,6 +2077,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2062
2077
|
},
|
|
2063
2078
|
attr(cap) {
|
|
2064
2079
|
const owner = getOwner();
|
|
2080
|
+
const holeCtx = sharedConfig.context;
|
|
2065
2081
|
const b = {
|
|
2066
2082
|
key: "lha:" + cap.id,
|
|
2067
2083
|
children: [],
|
|
@@ -2097,7 +2113,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2097
2113
|
if (vt === "string" || vt === "number") html += v;
|
|
2098
2114
|
}
|
|
2099
2115
|
};
|
|
2100
|
-
|
|
2116
|
+
swept(owner, holeCtx, run);
|
|
2101
2117
|
} catch (err) {
|
|
2102
2118
|
if (ssrHandleError(err, true)) return;
|
|
2103
2119
|
b.closed = true;
|
|
@@ -2433,7 +2449,7 @@ function ssrHydrationKey() {
|
|
|
2433
2449
|
const hk = getHydrationKey();
|
|
2434
2450
|
return hk ? ` _hk=${hk}` : "";
|
|
2435
2451
|
}
|
|
2436
|
-
const CLAIM_PROP = /*#__PURE__*/Symbol.for("
|
|
2452
|
+
const CLAIM_PROP = /*#__PURE__*/Symbol.for("solid.claim-prop");
|
|
2437
2453
|
const CLAIMS_STREAM = 1;
|
|
2438
2454
|
const CLAIMS_DOCUMENT = 2;
|
|
2439
2455
|
const CLAIM_UNSAFE = /[^A-Za-z0-9_.!~*'()-]/g;
|
|
@@ -3312,4 +3328,4 @@ function httpHeader(name, value, options) {
|
|
|
3312
3328
|
}
|
|
3313
3329
|
}
|
|
3314
3330
|
|
|
3315
|
-
export { CLAIMS_DOCUMENT, CLAIMS_STREAM, CLAIM_PROP, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|
|
3331
|
+
export { CLAIMS_DOCUMENT, CLAIMS_STREAM, CLAIM_PROP, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, scriptNonce, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClaim, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrSelectValues, ssrStyle, ssrStyleProperty, notSup as style, styleNonce, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|
package/dist/web.cjs
CHANGED
|
@@ -57,23 +57,16 @@ const transparentOptions = {
|
|
|
57
57
|
const syncOptions = {
|
|
58
58
|
sync: true
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
solidJs.runWithOwner(null, () => {
|
|
71
|
-
gate = solidJs.createMemo(() => promise);
|
|
72
|
-
});
|
|
73
|
-
assetGates.set(promise, gate);
|
|
74
|
-
}
|
|
75
|
-
gate();
|
|
76
|
-
};
|
|
60
|
+
function effect(fn, effectFn, options) {
|
|
61
|
+
solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
62
|
+
sync: true,
|
|
63
|
+
...options,
|
|
64
|
+
transparent: !options.scope
|
|
65
|
+
} : transparentOptions);
|
|
66
|
+
}
|
|
67
|
+
function memo(fn) {
|
|
68
|
+
return solidJs.createMemo(() => fn(), syncOptions);
|
|
69
|
+
}
|
|
77
70
|
|
|
78
71
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
79
72
|
let bLength = b.length,
|
|
@@ -329,11 +322,30 @@ function getServerFunctionRPC() {
|
|
|
329
322
|
return globalThis[SERVER_FUNCTION_RPC];
|
|
330
323
|
}
|
|
331
324
|
|
|
332
|
-
const
|
|
325
|
+
const assetGates = new WeakMap();
|
|
326
|
+
const waitAsset = promise => {
|
|
327
|
+
let gate = assetGates.get(promise);
|
|
328
|
+
if (!gate) {
|
|
329
|
+
solidJs.runWithOwner(null, () => {
|
|
330
|
+
gate = solidJs.createMemo(() => promise);
|
|
331
|
+
});
|
|
332
|
+
assetGates.set(promise, gate);
|
|
333
|
+
}
|
|
334
|
+
gate();
|
|
335
|
+
};
|
|
336
|
+
const $$EVENT_OWNER = "_$SOLID_EVENT_OWNER";
|
|
333
337
|
const INNER_OWNED = {};
|
|
334
338
|
const delegatedEvents = new Set();
|
|
335
339
|
const delegatedContainers = new Map();
|
|
336
|
-
function
|
|
340
|
+
function voidFn() {}
|
|
341
|
+
function generateHydrationScript(_options) {
|
|
342
|
+
return "";
|
|
343
|
+
}
|
|
344
|
+
function HydrationScript(_props) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
const getRequestEvent = voidFn;
|
|
348
|
+
function render(code, element, init, options = {}) {
|
|
337
349
|
let disposer;
|
|
338
350
|
registerDelegatedRoot(element);
|
|
339
351
|
try {
|
|
@@ -344,15 +356,20 @@ function render$1(code, element, init, options = {}) {
|
|
|
344
356
|
effect(() => solidJs.flatten(tree), () => {});
|
|
345
357
|
} else {
|
|
346
358
|
const tree = code();
|
|
347
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init,
|
|
359
|
+
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
360
|
+
...options.insertOptions,
|
|
361
|
+
schedule: true
|
|
362
|
+
});
|
|
348
363
|
}
|
|
349
364
|
}, {
|
|
350
365
|
id: options.renderId
|
|
351
366
|
});
|
|
367
|
+
solidJs.flush();
|
|
352
368
|
} catch (err) {
|
|
353
369
|
if (disposer) disposer();
|
|
354
370
|
unregisterDelegatedRoot(element);
|
|
355
371
|
throw err;
|
|
372
|
+
} finally {
|
|
356
373
|
}
|
|
357
374
|
return () => {
|
|
358
375
|
disposer();
|
|
@@ -437,7 +454,7 @@ function setProperty(node, name, value) {
|
|
|
437
454
|
node[name] = value;
|
|
438
455
|
}
|
|
439
456
|
let claimHandlers = null;
|
|
440
|
-
const CLAIM_SEAM = Symbol.for("
|
|
457
|
+
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
441
458
|
function registerElementClaim(handler) {
|
|
442
459
|
(claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
|
|
443
460
|
return () => {
|
|
@@ -1140,9 +1157,10 @@ function loadModuleAssets(mapping) {
|
|
|
1140
1157
|
}
|
|
1141
1158
|
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
1142
1159
|
}
|
|
1143
|
-
function hydrate
|
|
1160
|
+
function hydrate(code, element, options = {}) {
|
|
1161
|
+
solidJs.enableHydration();
|
|
1144
1162
|
installHydrationRuntime();
|
|
1145
|
-
if (globalThis._$HY.done) return render
|
|
1163
|
+
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
1146
1164
|
options.renderId ||= "";
|
|
1147
1165
|
if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
|
|
1148
1166
|
if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
|
|
@@ -1191,7 +1209,7 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1191
1209
|
solidJs.sharedConfig.gather = gather;
|
|
1192
1210
|
solidJs.sharedConfig.hydrating = true;
|
|
1193
1211
|
try {
|
|
1194
|
-
disposer = render
|
|
1212
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1195
1213
|
} finally {
|
|
1196
1214
|
solidJs.sharedConfig.hydrating = false;
|
|
1197
1215
|
}
|
|
@@ -1199,14 +1217,14 @@ function hydrate$1(code, element, options = {}) {
|
|
|
1199
1217
|
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
1200
1218
|
solidJs.sharedConfig.hydrating = false;
|
|
1201
1219
|
solidJs.sharedConfig.registry = undefined;
|
|
1202
|
-
disposer = render
|
|
1220
|
+
disposer = render(code, element, [...element.childNodes], options);
|
|
1203
1221
|
});
|
|
1204
1222
|
return () => disposer && disposer();
|
|
1205
1223
|
}
|
|
1206
1224
|
}
|
|
1207
1225
|
try {
|
|
1208
1226
|
gatherHydratable(element, options.renderId);
|
|
1209
|
-
return render
|
|
1227
|
+
return render(code, element, [...element.childNodes], options);
|
|
1210
1228
|
} finally {
|
|
1211
1229
|
solidJs.sharedConfig.hydrating = false;
|
|
1212
1230
|
}
|
|
@@ -1393,7 +1411,7 @@ function eventHandler(e, container, state) {
|
|
|
1393
1411
|
const handleNode = () => {
|
|
1394
1412
|
let handler = node[key];
|
|
1395
1413
|
if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
|
|
1396
|
-
const seam = globalThis[Symbol.for("
|
|
1414
|
+
const seam = globalThis[Symbol.for("solid.bnd")];
|
|
1397
1415
|
if (seam) handler = seam.resolve(node, e.type);
|
|
1398
1416
|
}
|
|
1399
1417
|
if (handler && !node.disabled) {
|
|
@@ -1442,7 +1460,16 @@ function eventHandler(e, container, state) {
|
|
|
1442
1460
|
}
|
|
1443
1461
|
function insertExpression(parent, value, current, marker) {
|
|
1444
1462
|
if (hydrationRt !== null && isHydrating(parent)) {
|
|
1445
|
-
if (value && value !== current)
|
|
1463
|
+
if (value && value !== current) {
|
|
1464
|
+
const arr = Array.isArray(value);
|
|
1465
|
+
for (const n of arr ? value : [value]) {
|
|
1466
|
+
if (n && n.nodeType) {
|
|
1467
|
+
if (!isHydrating(n)) return current;
|
|
1468
|
+
} else if (arr && (typeof n === "string" || typeof n === "number")) {
|
|
1469
|
+
return current;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1446
1473
|
return value;
|
|
1447
1474
|
}
|
|
1448
1475
|
if (value === current) return value;
|
|
@@ -1473,6 +1500,17 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1473
1500
|
if (marker) value[$$SLOT] = marker;
|
|
1474
1501
|
} else if (Array.isArray(value)) {
|
|
1475
1502
|
const currentArray = current && Array.isArray(current);
|
|
1503
|
+
for (let i = 0, len = value.length; i < len; i++) {
|
|
1504
|
+
const item = value[i],
|
|
1505
|
+
t = typeof item;
|
|
1506
|
+
if (t === "string" || t === "number") {
|
|
1507
|
+
const prev = currentArray ? current[i] : undefined;
|
|
1508
|
+
if (prev && prev.nodeType === 3) {
|
|
1509
|
+
if (prev.data !== "" + item) prev.data = item;
|
|
1510
|
+
value[i] = prev;
|
|
1511
|
+
} else value[i] = document.createTextNode(item);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1476
1514
|
if (value.length === 0) {
|
|
1477
1515
|
cleanChildren(parent, current, marker);
|
|
1478
1516
|
} else if (currentArray) {
|
|
@@ -1493,12 +1531,12 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1493
1531
|
});
|
|
1494
1532
|
if (doNotUnwrap && typeof value === "function") return value;
|
|
1495
1533
|
if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
|
|
1496
|
-
if (Array.isArray(value)) {
|
|
1534
|
+
if (solidJs.sharedConfig.hydrating && Array.isArray(value)) {
|
|
1497
1535
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
1498
1536
|
const item = value[i],
|
|
1499
1537
|
prev = current && current[i],
|
|
1500
1538
|
t = typeof item;
|
|
1501
|
-
if (t === "string" || t === "number")
|
|
1539
|
+
if ((t === "string" || t === "number") && prev && prev.nodeType === 3) value[i] = prev;
|
|
1502
1540
|
}
|
|
1503
1541
|
}
|
|
1504
1542
|
return value;
|
|
@@ -1579,7 +1617,6 @@ function gatherHydratable(element, root) {
|
|
|
1579
1617
|
function getHydrationKey() {
|
|
1580
1618
|
return solidJs.sharedConfig.getNextContextId();
|
|
1581
1619
|
}
|
|
1582
|
-
const voidFn = () => undefined;
|
|
1583
1620
|
const RequestContext = Symbol();
|
|
1584
1621
|
|
|
1585
1622
|
function throwInBrowser(func) {
|
|
@@ -1655,11 +1692,14 @@ function isSafeError(value) {
|
|
|
1655
1692
|
return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
|
|
1656
1693
|
}
|
|
1657
1694
|
const REVALIDATE_HEADER = "X-Revalidate";
|
|
1658
|
-
function initWithRevalidate(init) {
|
|
1695
|
+
function initWithRevalidate(init = {}) {
|
|
1696
|
+
const resolved = typeof init === "number" ? {
|
|
1697
|
+
status: init
|
|
1698
|
+
} : init;
|
|
1659
1699
|
const {
|
|
1660
1700
|
revalidate,
|
|
1661
1701
|
...responseInit
|
|
1662
|
-
} =
|
|
1702
|
+
} = resolved;
|
|
1663
1703
|
let headers;
|
|
1664
1704
|
if (responseInit.headers && responseInit.headers.getSetCookie) {
|
|
1665
1705
|
headers = new Headers();
|
|
@@ -1685,9 +1725,7 @@ function redirect(url, init = 302) {
|
|
|
1685
1725
|
const {
|
|
1686
1726
|
responseInit,
|
|
1687
1727
|
headers
|
|
1688
|
-
} = initWithRevalidate(
|
|
1689
|
-
status: init
|
|
1690
|
-
} : init);
|
|
1728
|
+
} = initWithRevalidate(init);
|
|
1691
1729
|
if (responseInit.status === undefined) {
|
|
1692
1730
|
responseInit.status = 302;
|
|
1693
1731
|
}
|
|
@@ -1719,26 +1757,8 @@ function respond(value, init = {}) {
|
|
|
1719
1757
|
}), value);
|
|
1720
1758
|
}
|
|
1721
1759
|
|
|
1722
|
-
const mergeProps = solidJs.merge;
|
|
1723
1760
|
const isServer = false;
|
|
1724
1761
|
const isDev = false;
|
|
1725
|
-
function render(code, element, init, options = {}) {
|
|
1726
|
-
try {
|
|
1727
|
-
const dispose = render$1(code, element, init, {
|
|
1728
|
-
...options,
|
|
1729
|
-
insertOptions: {
|
|
1730
|
-
schedule: true
|
|
1731
|
-
}
|
|
1732
|
-
});
|
|
1733
|
-
solidJs.flush();
|
|
1734
|
-
return dispose;
|
|
1735
|
-
} finally {
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
const hydrate = (...args) => {
|
|
1739
|
-
solidJs.enableHydration();
|
|
1740
|
-
return hydrate$1(...args);
|
|
1741
|
-
};
|
|
1742
1762
|
function Portal(props) {
|
|
1743
1763
|
return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
|
|
1744
1764
|
}
|
|
@@ -1791,7 +1811,7 @@ function portalImpl(props) {
|
|
|
1791
1811
|
});
|
|
1792
1812
|
return treeMarker;
|
|
1793
1813
|
}
|
|
1794
|
-
const COMPONENT_BINDING = Symbol.for("
|
|
1814
|
+
const COMPONENT_BINDING = Symbol.for("solid.component-binding");
|
|
1795
1815
|
function bindingOf(value) {
|
|
1796
1816
|
return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
|
|
1797
1817
|
}
|
|
@@ -1928,6 +1948,10 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
1928
1948
|
enumerable: true,
|
|
1929
1949
|
get: function () { return solidJs.getOwner; }
|
|
1930
1950
|
});
|
|
1951
|
+
Object.defineProperty(exports, "mergeProps", {
|
|
1952
|
+
enumerable: true,
|
|
1953
|
+
get: function () { return solidJs.merge; }
|
|
1954
|
+
});
|
|
1931
1955
|
Object.defineProperty(exports, "untrack", {
|
|
1932
1956
|
enumerable: true,
|
|
1933
1957
|
get: function () { return solidJs.untrack; }
|
|
@@ -1938,7 +1962,7 @@ exports.DOMWithState = DOMWithState;
|
|
|
1938
1962
|
exports.DelegatedEvents = DelegatedEvents;
|
|
1939
1963
|
exports.Dynamic = Dynamic;
|
|
1940
1964
|
exports.HREF = HREF;
|
|
1941
|
-
exports.HydrationScript =
|
|
1965
|
+
exports.HydrationScript = HydrationScript;
|
|
1942
1966
|
exports.MathMLElements = MathMLElements;
|
|
1943
1967
|
exports.Namespaces = Namespaces;
|
|
1944
1968
|
exports.Portal = Portal;
|
|
@@ -1968,7 +1992,7 @@ exports.dynamic = dynamic;
|
|
|
1968
1992
|
exports.dynamicProperty = dynamicProperty;
|
|
1969
1993
|
exports.effect = effect;
|
|
1970
1994
|
exports.escape = escape;
|
|
1971
|
-
exports.generateHydrationScript =
|
|
1995
|
+
exports.generateHydrationScript = generateHydrationScript;
|
|
1972
1996
|
exports.getDelegatedRoot = getDelegatedRoot;
|
|
1973
1997
|
exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
|
|
1974
1998
|
exports.getFirstChild = getFirstChild;
|
|
@@ -1977,7 +2001,7 @@ exports.getNextElement = getNextElement;
|
|
|
1977
2001
|
exports.getNextMarker = getNextMarker;
|
|
1978
2002
|
exports.getNextMatch = getNextMatch;
|
|
1979
2003
|
exports.getNextSibling = getNextSibling;
|
|
1980
|
-
exports.getRequestEvent =
|
|
2004
|
+
exports.getRequestEvent = getRequestEvent;
|
|
1981
2005
|
exports.getServerFunctionMetadata = getServerFunctionMetadata;
|
|
1982
2006
|
exports.getServerFunctionRPC = getServerFunctionRPC;
|
|
1983
2007
|
exports.hasFlashCookie = hasFlashCookie;
|
|
@@ -1994,7 +2018,6 @@ exports.isServer = isServer;
|
|
|
1994
2018
|
exports.isServerFunction = isServerFunction;
|
|
1995
2019
|
exports.markSafeError = markSafeError;
|
|
1996
2020
|
exports.memo = memo;
|
|
1997
|
-
exports.mergeProps = mergeProps;
|
|
1998
2021
|
exports.parseCookieHeader = parseCookieHeader;
|
|
1999
2022
|
exports.patchDriver = patchDriver;
|
|
2000
2023
|
exports.redirect = redirect;
|
|
@@ -2030,4 +2053,5 @@ exports.template = template;
|
|
|
2030
2053
|
exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
|
|
2031
2054
|
exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
|
|
2032
2055
|
exports.useHead = useHead;
|
|
2056
|
+
exports.waitAsset = waitAsset;
|
|
2033
2057
|
exports.warmAsset = warmAsset;
|