@solidjs/web 2.0.0-rc.16 → 2.0.0-rc.18
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/server.dev.js +195 -35
- package/dist/server.js +190 -35
- package/dist/server.observe.js +190 -35
- package/dist/web.dev.js +53 -1
- package/dist/web.js +4 -1
- package/dist/web.observe.js +4 -1
- package/frames/dist/server.dev.js +356 -43
- package/frames/dist/server.js +355 -43
- package/frames/dist/server.observe.js +355 -43
- package/frames/dist/wire.js +110 -14
- package/package.json +4 -4
- package/serialization/dist/decode.js +10 -5
- package/serialization/dist/serialization.js +121 -61
- package/serialization/types/index.d.ts +12 -4
- package/serialization/types/serializer.d.ts +12 -4
- package/server-functions/dist/client.dev.js +10 -21
- package/server-functions/dist/client.js +10 -21
- package/server-functions/dist/client.observe.js +10 -21
- package/server-functions/dist/rich-args.js +54 -3
- package/server-functions/dist/server.dev.js +313 -11
- package/server-functions/dist/server.js +313 -11
- package/server-functions/dist/server.observe.js +313 -11
- package/types/client.d.ts +12 -0
- package/types/diagnostics.d.ts +16 -0
- package/types/frames/frame-morph.d.ts +1 -0
- package/types/frames/serializer.d.ts +12 -4
- package/types/serializer.d.ts +12 -4
- package/types/server-functions/argument-codec.d.ts +11 -2
- package/types/server-functions/client.d.ts +13 -4
- package/types/server-functions/server.d.ts +33 -0
- package/types/server-functions/shared.d.ts +9 -0
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server.d.ts +1 -1
package/dist/server.observe.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY,
|
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
3
|
import { sharedConfig, ssrSanitizeError, beginEdgesRender, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
4
|
export { ssrScope as scope } from 'solid-js/internal';
|
|
5
|
-
import { createStream,
|
|
5
|
+
import { createStream, Feature, getCrossReferenceHeader, crossSerializeStream } from 'seroval';
|
|
6
6
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
7
7
|
|
|
8
8
|
const DOMWithState = {
|
|
@@ -531,15 +531,92 @@ function resolveSerializerPlugins(customPlugins) {
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
const defaultDisabledFeatures = () => Feature.AggregateError | Feature.BigIntTypedArray;
|
|
534
|
-
const serializeOnlyDisabledFeatures = serializeErrorStacks => (
|
|
534
|
+
const serializeOnlyDisabledFeatures = serializeErrorStacks => (process.env.NODE_ENV === "development" ) ? 0 : Feature.ErrorPrototypeStack;
|
|
535
535
|
const HYDRATION_GLOBAL = "_$HY.r";
|
|
536
|
-
function
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
536
|
+
function createKeyedSerializer(serialize, onError, onDone) {
|
|
537
|
+
const cancels = new Set();
|
|
538
|
+
let pendingWrites = 0;
|
|
539
|
+
let flushed = false;
|
|
540
|
+
let done = false;
|
|
541
|
+
let closed = false;
|
|
542
|
+
const maybeDone = () => {
|
|
543
|
+
if (flushed && pendingWrites === 0 && !done) {
|
|
544
|
+
done = true;
|
|
545
|
+
onDone && onDone();
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
return {
|
|
549
|
+
write(key, value) {
|
|
550
|
+
if (flushed) return;
|
|
551
|
+
pendingWrites++;
|
|
552
|
+
let settled = false;
|
|
553
|
+
let failed = false;
|
|
554
|
+
let started = false;
|
|
555
|
+
let cancel = null;
|
|
556
|
+
const settle = () => {
|
|
557
|
+
if (settled) return;
|
|
558
|
+
settled = true;
|
|
559
|
+
if (cancel) cancels.delete(cancel);
|
|
560
|
+
pendingWrites--;
|
|
561
|
+
maybeDone();
|
|
562
|
+
};
|
|
563
|
+
let stream;
|
|
564
|
+
try {
|
|
565
|
+
stream = serialize(key, value, {
|
|
566
|
+
onError: onError && (err => {
|
|
567
|
+
failed = true;
|
|
568
|
+
onError(err);
|
|
569
|
+
if (cancel) {
|
|
570
|
+
cancel();
|
|
571
|
+
settle();
|
|
572
|
+
}
|
|
573
|
+
}),
|
|
574
|
+
onDone: settle
|
|
575
|
+
}, initial => {
|
|
576
|
+
if (initial) started = true;
|
|
577
|
+
return !closed;
|
|
578
|
+
});
|
|
579
|
+
} catch (err) {
|
|
580
|
+
settle();
|
|
581
|
+
throw err;
|
|
582
|
+
}
|
|
583
|
+
if (settled) return;
|
|
584
|
+
if (closed || failed) {
|
|
585
|
+
stream();
|
|
586
|
+
settle();
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
cancel = stream;
|
|
590
|
+
cancels.add(cancel);
|
|
591
|
+
},
|
|
592
|
+
flush() {
|
|
593
|
+
flushed = true;
|
|
594
|
+
maybeDone();
|
|
595
|
+
},
|
|
596
|
+
close() {
|
|
597
|
+
closed = flushed = true;
|
|
598
|
+
for (const cancel of cancels) cancel();
|
|
599
|
+
cancels.clear();
|
|
600
|
+
if (!done) {
|
|
601
|
+
done = true;
|
|
602
|
+
onDone && onDone();
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
};
|
|
542
606
|
}
|
|
607
|
+
const KEY_ESCAPES = {
|
|
608
|
+
'"': '\\"',
|
|
609
|
+
"\\": "\\\\",
|
|
610
|
+
"\n": "\\n",
|
|
611
|
+
"\r": "\\r",
|
|
612
|
+
"\b": "\\b",
|
|
613
|
+
"\t": "\\t",
|
|
614
|
+
"\f": "\\f",
|
|
615
|
+
"<": "\\x3C",
|
|
616
|
+
"\u2028": "\\u2028",
|
|
617
|
+
"\u2029": "\\u2029"
|
|
618
|
+
};
|
|
619
|
+
const serializeKey = key => ("" + key).replace(/["\\\n\r\b\t\f<\u2028\u2029]/g, c => KEY_ESCAPES[c]);
|
|
543
620
|
function createHydrationSerializer({
|
|
544
621
|
onData,
|
|
545
622
|
onDone,
|
|
@@ -547,14 +624,20 @@ function createHydrationSerializer({
|
|
|
547
624
|
onError,
|
|
548
625
|
plugins
|
|
549
626
|
}) {
|
|
550
|
-
|
|
627
|
+
const resolvedPlugins = resolveSerializerPlugins(plugins);
|
|
628
|
+
const disabledFeatures = defaultDisabledFeatures() | serializeOnlyDisabledFeatures();
|
|
629
|
+
const refs = new Map();
|
|
630
|
+
return createKeyedSerializer((key, value, callbacks, live) => crossSerializeStream(value, {
|
|
551
631
|
scopeId,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
632
|
+
refs,
|
|
633
|
+
plugins: resolvedPlugins,
|
|
634
|
+
disabledFeatures,
|
|
635
|
+
onSerialize(data, initial) {
|
|
636
|
+
if (!live(initial)) return;
|
|
637
|
+
onData(initial ? HYDRATION_GLOBAL + '["' + serializeKey(key) + '"]=' + data : data);
|
|
638
|
+
},
|
|
639
|
+
...callbacks
|
|
640
|
+
}), onError, onDone);
|
|
558
641
|
}
|
|
559
642
|
function getLocalHeaderScript(id) {
|
|
560
643
|
return getCrossReferenceHeader(id) + ";";
|
|
@@ -1714,6 +1797,13 @@ function renderToStream(code, options = {}) {
|
|
|
1714
1797
|
const requestEvent = peekRequestEvent();
|
|
1715
1798
|
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1716
1799
|
const errorScope = requestEvent || {};
|
|
1800
|
+
const reportFailure = (err, handling) => {
|
|
1801
|
+
reportServerError(err, {
|
|
1802
|
+
kind: "render",
|
|
1803
|
+
handling
|
|
1804
|
+
}, null, options.onError, errorScope);
|
|
1805
|
+
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1806
|
+
};
|
|
1717
1807
|
let dispose;
|
|
1718
1808
|
let dead = false;
|
|
1719
1809
|
let render;
|
|
@@ -1768,15 +1858,7 @@ function renderToStream(code, options = {}) {
|
|
|
1768
1858
|
if (dispose) {
|
|
1769
1859
|
const d = dispose;
|
|
1770
1860
|
dispose = () => {};
|
|
1771
|
-
|
|
1772
|
-
d();
|
|
1773
|
-
} catch (err) {
|
|
1774
|
-
reportServerError(err, {
|
|
1775
|
-
kind: "render",
|
|
1776
|
-
handling: "failed"
|
|
1777
|
-
}, null, options.onError, errorScope);
|
|
1778
|
-
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1779
|
-
}
|
|
1861
|
+
d();
|
|
1780
1862
|
}
|
|
1781
1863
|
if (serializer && typeof serializer.close === "function") {
|
|
1782
1864
|
try {
|
|
@@ -1799,11 +1881,7 @@ function renderToStream(code, options = {}) {
|
|
|
1799
1881
|
} else if (!sink && onDisconnectedBeforeShell) onDisconnectedBeforeShell();
|
|
1800
1882
|
};
|
|
1801
1883
|
const failRender = err => {
|
|
1802
|
-
|
|
1803
|
-
kind: "render",
|
|
1804
|
-
handling: "failed"
|
|
1805
|
-
}, null, options.onError, errorScope);
|
|
1806
|
-
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1884
|
+
reportFailure(err, "failed");
|
|
1807
1885
|
abandon();
|
|
1808
1886
|
};
|
|
1809
1887
|
const failRootRender = err => {
|
|
@@ -1972,7 +2050,7 @@ function renderToStream(code, options = {}) {
|
|
|
1972
2050
|
plugins: options.plugins,
|
|
1973
2051
|
onData: payload => sink.data(payload),
|
|
1974
2052
|
onDone,
|
|
1975
|
-
onError:
|
|
2053
|
+
onError: err => reportFailure(err, "serialize")
|
|
1976
2054
|
});
|
|
1977
2055
|
let rootAssetsSerialized = false;
|
|
1978
2056
|
const serializeRootAssets = () => {
|
|
@@ -2343,7 +2421,11 @@ function renderToStream(code, options = {}) {
|
|
|
2343
2421
|
context.trace = undefined;
|
|
2344
2422
|
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
2345
2423
|
if (endEdges) endEdges();
|
|
2346
|
-
|
|
2424
|
+
try {
|
|
2425
|
+
d();
|
|
2426
|
+
} catch (err) {
|
|
2427
|
+
reportFailure(err, "failed");
|
|
2428
|
+
}
|
|
2347
2429
|
};
|
|
2348
2430
|
rootOwner = claimRenderRoot(context);
|
|
2349
2431
|
if (requestEvent) claimEventRender(requestEvent, context);
|
|
@@ -2853,11 +2935,19 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
2853
2935
|
}
|
|
2854
2936
|
function rowOps(last, rows) {
|
|
2855
2937
|
const ops = [];
|
|
2856
|
-
|
|
2857
|
-
|
|
2938
|
+
const html = [];
|
|
2939
|
+
for (let i = 0; i < rows.length; i++) if (i >= last.length || rows[i] !== last[i]) {
|
|
2940
|
+
const patch = i < last.length ? rowPatch(last[i], rows[i]) : null;
|
|
2941
|
+
ops.push(patch ? [i, patch.p] : [i, rows[i]]);
|
|
2942
|
+
html.push(rows[i]);
|
|
2943
|
+
}
|
|
2944
|
+
if (ops.length >= rows.length) return null;
|
|
2945
|
+
return Object.defineProperty({
|
|
2858
2946
|
n: rows.length,
|
|
2859
2947
|
r: ops
|
|
2860
|
-
}
|
|
2948
|
+
}, ROW_HTML, {
|
|
2949
|
+
value: html
|
|
2950
|
+
});
|
|
2861
2951
|
}
|
|
2862
2952
|
function resolveHoleValue(hole) {
|
|
2863
2953
|
const result = {
|
|
@@ -3223,6 +3313,71 @@ function attrNames(text) {
|
|
|
3223
3313
|
while (m = re.exec(text)) names.push(m[1]);
|
|
3224
3314
|
return names;
|
|
3225
3315
|
}
|
|
3316
|
+
const ROW_HTML = Symbol.for("solid.rowHtml");
|
|
3317
|
+
const ROW_TOKEN = /<(\/?)([a-zA-Z][^\s/>]*)((?:[^>"']|"[^"]*"|'[^']*')*)>|<!--([\s\S]*?)-->/g;
|
|
3318
|
+
const ROW_VOID = /^(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)$/i;
|
|
3319
|
+
const ROW_FOREIGN = /^(?:svg|math)$/i;
|
|
3320
|
+
const ROW_RAW = /^(?:script|style|textarea|title|template)$/i;
|
|
3321
|
+
const ROW_KEY = /\s_key(?:="[^"]*")?(?![^\s/])/;
|
|
3322
|
+
const rowKey = attrs => (ROW_KEY.exec(attrs) || [""])[0];
|
|
3323
|
+
const ROW_ENTITY = /&(?:amp|lt|gt|quot|#39);/g;
|
|
3324
|
+
const ROW_ENTITIES = {
|
|
3325
|
+
"&": "&",
|
|
3326
|
+
"<": "<",
|
|
3327
|
+
">": ">",
|
|
3328
|
+
""": '"',
|
|
3329
|
+
"'": "'"
|
|
3330
|
+
};
|
|
3331
|
+
function rowText(text) {
|
|
3332
|
+
if (!text.includes("&")) return text;
|
|
3333
|
+
if (text.replace(ROW_ENTITY, "").includes("&")) return null;
|
|
3334
|
+
return text.replace(ROW_ENTITY, e => ROW_ENTITIES[e]);
|
|
3335
|
+
}
|
|
3336
|
+
const ROW_HASH_SEED = 0x811c9dc5;
|
|
3337
|
+
function rowPatch(a, b) {
|
|
3338
|
+
const ra = new RegExp(ROW_TOKEN);
|
|
3339
|
+
const rb = new RegExp(ROW_TOKEN);
|
|
3340
|
+
const p = [];
|
|
3341
|
+
const stack = [[-1, 0, false]];
|
|
3342
|
+
let el = -1;
|
|
3343
|
+
let h = ROW_HASH_SEED;
|
|
3344
|
+
let ia = 0;
|
|
3345
|
+
let ib = 0;
|
|
3346
|
+
for (;;) {
|
|
3347
|
+
const ma = ra.exec(a);
|
|
3348
|
+
const mb = rb.exec(b);
|
|
3349
|
+
const ta = a.slice(ia, ma ? ma.index : a.length);
|
|
3350
|
+
const tb = b.slice(ib, mb ? mb.index : b.length);
|
|
3351
|
+
const top = stack[stack.length - 1];
|
|
3352
|
+
if (ta !== tb) {
|
|
3353
|
+
const text = rowText(tb);
|
|
3354
|
+
if (text === null) return null;
|
|
3355
|
+
p.push([top[0], top[1], text]);
|
|
3356
|
+
}
|
|
3357
|
+
if (!ma || !mb) return !ma && !mb ? {
|
|
3358
|
+
p,
|
|
3359
|
+
h: h >>> 0
|
|
3360
|
+
} : null;
|
|
3361
|
+
ia = ra.lastIndex;
|
|
3362
|
+
ib = rb.lastIndex;
|
|
3363
|
+
if (ma[4] !== undefined || mb[4] !== undefined) {
|
|
3364
|
+
if (ma[4] !== mb[4]) return null;
|
|
3365
|
+
top[1]++;
|
|
3366
|
+
} else if (ma[1] !== mb[1] || ma[2] !== mb[2]) return null;else if (ROW_RAW.test(ma[2])) return null;else if (ma[1]) {
|
|
3367
|
+
if (stack.length === 1) return null;
|
|
3368
|
+
stack.pop();
|
|
3369
|
+
} else {
|
|
3370
|
+
el++;
|
|
3371
|
+
top[1]++;
|
|
3372
|
+
const foreign = top[2] || ROW_FOREIGN.test(ma[2]);
|
|
3373
|
+
if (ma[3] !== mb[3]) {
|
|
3374
|
+
if (foreign || rowKey(ma[3]) !== rowKey(mb[3])) return null;
|
|
3375
|
+
p.push([el, mb[3].replace(/\/$/, "")]);
|
|
3376
|
+
}
|
|
3377
|
+
if (!ROW_VOID.test(ma[2]) && !ma[3].endsWith("/")) stack.push([el, 0, foreign]);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3226
3381
|
function ssr(t) {
|
|
3227
3382
|
const len = arguments.length;
|
|
3228
3383
|
if (len === 1) return {
|
|
@@ -4719,4 +4874,4 @@ function httpHeader(name, value, options) {
|
|
|
4719
4874
|
}
|
|
4720
4875
|
}
|
|
4721
4876
|
|
|
4722
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, 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, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|
|
4877
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, 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, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStatefulProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|
package/dist/web.dev.js
CHANGED
|
@@ -240,6 +240,49 @@ function lowercaseEventAttribute(name, node) {
|
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
|
+
const statefulWrites = /*#__PURE__*/new WeakMap();
|
|
244
|
+
function statefulRecord(node, prop) {
|
|
245
|
+
if (DOMWithState[node.nodeName]?.[prop] !== 1 || node.nodeName === "SELECT") return;
|
|
246
|
+
let records = statefulWrites.get(node);
|
|
247
|
+
if (!records) statefulWrites.set(node, records = {});
|
|
248
|
+
return records;
|
|
249
|
+
}
|
|
250
|
+
function checkStatefulWrite(node, prop, value) {
|
|
251
|
+
const record = statefulRecord(node, prop)?.[prop];
|
|
252
|
+
if (!record || record.w || value !== record.v || node[prop] === record.d) return;
|
|
253
|
+
record.w = 1;
|
|
254
|
+
const tag = node.localName;
|
|
255
|
+
const type = tag === "input" ? node.type : undefined;
|
|
256
|
+
const name = node.getAttribute("name") || undefined,
|
|
257
|
+
id = node.id || undefined;
|
|
258
|
+
let element = `<${tag}`;
|
|
259
|
+
if (type) element += ` type="${type}"`;
|
|
260
|
+
if (name) element += ` name="${name}"`;else if (id) element += ` id="${id}"`;
|
|
261
|
+
element += `>.${prop}`;
|
|
262
|
+
const handler = prop === "muted" ? "onVolumeChange" : prop === "value" ? "onInput" : "onChange";
|
|
263
|
+
const defaultProp = "default" + prop.charAt(0).toUpperCase() + prop.slice(1);
|
|
264
|
+
devCheck({
|
|
265
|
+
code: "UNCOMMITTED_INPUT_OVERWRITTEN",
|
|
266
|
+
kind: "render",
|
|
267
|
+
severity: "warn",
|
|
268
|
+
message: `[UNCOMMITTED_INPUT_OVERWRITTEN] ${element} was changed by the user, but the change was ` + `never committed to the signal bound to \`${prop}\`, and Solid is writing the bound value ` + `back over it: the user's input is lost. A compiled \`${prop}\` binding re-applies the ` + `bound value whenever its effect runs — here with the value unchanged, because another ` + `binding in the same template changed, a spread re-ran, or the source fired with an equal ` + `value — and the signal is the source of truth. Write the signal on every edit ` + `(\`${handler}={e => setValue(e.currentTarget.${prop})}\`, a draft signal you commit ` + `later), use \`${defaultProp}\` for an uncontrolled element, or write a rejected edit back ` + `explicitly (\`e.currentTarget.${prop} = next\`).`,
|
|
269
|
+
data: {
|
|
270
|
+
tag,
|
|
271
|
+
prop,
|
|
272
|
+
type,
|
|
273
|
+
name,
|
|
274
|
+
id
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function recordStatefulWrite(node, prop, value) {
|
|
279
|
+
const records = statefulRecord(node, prop);
|
|
280
|
+
if (records) records[prop] = {
|
|
281
|
+
v: value,
|
|
282
|
+
d: node[prop],
|
|
283
|
+
w: records[prop]?.w
|
|
284
|
+
};
|
|
285
|
+
}
|
|
243
286
|
|
|
244
287
|
const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
|
|
245
288
|
const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
|
|
@@ -637,11 +680,18 @@ function setProperty(node, name, value) {
|
|
|
637
680
|
tagElement(node);
|
|
638
681
|
if (isHydrating(node)) return;
|
|
639
682
|
const nodeName = node.nodeName;
|
|
683
|
+
checkStatefulWrite(node, name, value);
|
|
640
684
|
if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
641
685
|
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
|
|
642
686
|
} else node[name] = value;
|
|
687
|
+
recordStatefulWrite(node, name, value);
|
|
643
688
|
reclaimAttribute(node, name);
|
|
644
689
|
}
|
|
690
|
+
function setStatefulProperty(node, name, value) {
|
|
691
|
+
checkStatefulWrite(node, name, value);
|
|
692
|
+
node[name] = value;
|
|
693
|
+
recordStatefulWrite(node, name, value);
|
|
694
|
+
}
|
|
645
695
|
let claimHandlers = null;
|
|
646
696
|
const claimAttributeSets = [];
|
|
647
697
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -1904,9 +1954,11 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
|
1904
1954
|
}
|
|
1905
1955
|
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
1906
1956
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
1957
|
+
checkStatefulWrite(node, prop, value);
|
|
1907
1958
|
if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
|
|
1908
1959
|
if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
|
|
1909
1960
|
} else node[prop] = value;
|
|
1961
|
+
recordStatefulWrite(node, prop, value);
|
|
1910
1962
|
reclaimAttribute(node, prop);
|
|
1911
1963
|
} else {
|
|
1912
1964
|
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
@@ -2460,4 +2512,4 @@ _moduleUrl) {
|
|
|
2460
2512
|
function httpStatus(_code, _text) {}
|
|
2461
2513
|
function httpHeader(_name, _value, _options) {}
|
|
2462
2514
|
|
|
2463
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
2515
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStatefulProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
package/dist/web.js
CHANGED
|
@@ -510,6 +510,9 @@ function setProperty(node, name, value) {
|
|
|
510
510
|
} else node[name] = value;
|
|
511
511
|
reclaimAttribute(node, name);
|
|
512
512
|
}
|
|
513
|
+
function setStatefulProperty(node, name, value) {
|
|
514
|
+
node[name] = value;
|
|
515
|
+
}
|
|
513
516
|
let claimHandlers = null;
|
|
514
517
|
const claimAttributeSets = [];
|
|
515
518
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -2197,4 +2200,4 @@ _moduleUrl) {
|
|
|
2197
2200
|
function httpStatus(_code, _text) {}
|
|
2198
2201
|
function httpHeader(_name, _value, _options) {}
|
|
2199
2202
|
|
|
2200
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
2203
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStatefulProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
package/dist/web.observe.js
CHANGED
|
@@ -541,6 +541,9 @@ function setProperty(node, name, value) {
|
|
|
541
541
|
} else node[name] = value;
|
|
542
542
|
reclaimAttribute(node, name);
|
|
543
543
|
}
|
|
544
|
+
function setStatefulProperty(node, name, value) {
|
|
545
|
+
node[name] = value;
|
|
546
|
+
}
|
|
544
547
|
let claimHandlers = null;
|
|
545
548
|
const claimAttributeSets = [];
|
|
546
549
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -2248,4 +2251,4 @@ _moduleUrl) {
|
|
|
2248
2251
|
function httpStatus(_code, _text) {}
|
|
2249
2252
|
function httpHeader(_name, _value, _options) {}
|
|
2250
2253
|
|
|
2251
|
-
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
2254
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStatefulProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|