@solidjs/web 2.0.0-beta.4 → 2.0.0-beta.6
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 +78 -55
- package/dist/dev.js +73 -55
- package/dist/server.cjs +102 -12
- package/dist/server.js +98 -12
- package/dist/web.cjs +74 -49
- package/dist/web.js +69 -49
- package/package.json +5 -4
- package/storage/types/src/index.d.ts +1 -1
- package/types/client.d.ts +5 -6
- package/types/index.d.ts +1 -1
- package/types/server.d.ts +4 -5
package/dist/server.cjs
CHANGED
|
@@ -5,8 +5,39 @@ var seroval = require('seroval');
|
|
|
5
5
|
var web = require('seroval-plugins/web');
|
|
6
6
|
var signals = require('@solidjs/signals');
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const DOMWithState = {
|
|
9
|
+
INPUT: {
|
|
10
|
+
value: 1,
|
|
11
|
+
defaultValue: 1,
|
|
12
|
+
checked: 1,
|
|
13
|
+
defaultChecked: 1
|
|
14
|
+
},
|
|
15
|
+
SELECT: {
|
|
16
|
+
value: 1
|
|
17
|
+
},
|
|
18
|
+
OPTION: {
|
|
19
|
+
value: 1,
|
|
20
|
+
selected: 1,
|
|
21
|
+
defaultSelected: 1
|
|
22
|
+
},
|
|
23
|
+
TEXTAREA: {
|
|
24
|
+
value: 1,
|
|
25
|
+
defaultValue: 1
|
|
26
|
+
},
|
|
27
|
+
VIDEO: {
|
|
28
|
+
muted: 1,
|
|
29
|
+
defaultMuted: 1
|
|
30
|
+
},
|
|
31
|
+
AUDIO: {
|
|
32
|
+
muted: 1,
|
|
33
|
+
defaultMuted: 1
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
for (const tagName in DOMWithState) {
|
|
37
|
+
for (const propName in DOMWithState[tagName]) {
|
|
38
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
10
41
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
11
42
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
12
43
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -14,7 +45,10 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
14
45
|
"set", "stop",
|
|
15
46
|
"svg", "switch", "symbol", "text", "textPath",
|
|
16
47
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
17
|
-
const
|
|
48
|
+
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
49
|
+
const Namespaces = {
|
|
50
|
+
svg: "http://www.w3.org/2000/svg",
|
|
51
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
18
52
|
xlink: "http://www.w3.org/1999/xlink",
|
|
19
53
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
20
54
|
};
|
|
@@ -142,7 +176,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
142
176
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
143
177
|
}
|
|
144
178
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
145
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e)
|
|
179
|
+
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)if($dfl(e[i]))return e[i];return null}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
|
|
146
180
|
function renderToString(code, options = {}) {
|
|
147
181
|
const {
|
|
148
182
|
renderId = "",
|
|
@@ -267,7 +301,29 @@ function renderToStream(code, options = {}) {
|
|
|
267
301
|
let shellCompleted = false;
|
|
268
302
|
let scriptFlushed = false;
|
|
269
303
|
let headStyles;
|
|
304
|
+
const revealGroups = new Map();
|
|
270
305
|
let timer = null;
|
|
306
|
+
const emitTask = task => {
|
|
307
|
+
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
308
|
+
scriptFlushed = true;
|
|
309
|
+
};
|
|
310
|
+
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
311
|
+
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
312
|
+
let group = revealGroups.get(groupOrKeys);
|
|
313
|
+
if (!group) {
|
|
314
|
+
if (!release) return;
|
|
315
|
+
group = {
|
|
316
|
+
order: [],
|
|
317
|
+
keys: new Set(),
|
|
318
|
+
released: true
|
|
319
|
+
};
|
|
320
|
+
revealGroups.set(groupOrKeys, group);
|
|
321
|
+
} else if (release) group.released = true;
|
|
322
|
+
if (!group.order.length) return;
|
|
323
|
+
const keys = group.order.slice();
|
|
324
|
+
if (consume) revealGroups.delete(groupOrKeys);
|
|
325
|
+
return keys;
|
|
326
|
+
}
|
|
271
327
|
let rootHoles = null;
|
|
272
328
|
let nextHoleId = 0;
|
|
273
329
|
let buffer = {
|
|
@@ -317,7 +373,26 @@ function renderToStream(code, options = {}) {
|
|
|
317
373
|
escape: escape,
|
|
318
374
|
resolve: resolveSSRNode,
|
|
319
375
|
ssr: ssr,
|
|
320
|
-
registerFragment(key) {
|
|
376
|
+
registerFragment(key, options) {
|
|
377
|
+
const revealGroup = options && options.revealGroup;
|
|
378
|
+
if (revealGroup) {
|
|
379
|
+
let group = revealGroups.get(revealGroup);
|
|
380
|
+
if (!group) {
|
|
381
|
+
group = {
|
|
382
|
+
order: [],
|
|
383
|
+
keys: new Set(),
|
|
384
|
+
released: false
|
|
385
|
+
};
|
|
386
|
+
revealGroups.set(revealGroup, group);
|
|
387
|
+
}
|
|
388
|
+
if (!group.keys.has(key)) {
|
|
389
|
+
group.keys.add(key);
|
|
390
|
+
group.order.push(key);
|
|
391
|
+
}
|
|
392
|
+
if (group.released) {
|
|
393
|
+
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
321
396
|
if (!registry.has(key)) {
|
|
322
397
|
let resolve, reject;
|
|
323
398
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -327,7 +402,7 @@ function renderToStream(code, options = {}) {
|
|
|
327
402
|
queue(flushEnd);
|
|
328
403
|
}))
|
|
329
404
|
});
|
|
330
|
-
serializer.write(key, p);
|
|
405
|
+
serializer.write(key + "_fr", p);
|
|
331
406
|
}
|
|
332
407
|
return (value, error) => {
|
|
333
408
|
if (registry.has(key)) {
|
|
@@ -356,9 +431,9 @@ function renderToStream(code, options = {}) {
|
|
|
356
431
|
} else {
|
|
357
432
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
358
433
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
434
|
+
const deferActivation = !!revealGroup;
|
|
359
435
|
if (styles.length) {
|
|
360
|
-
|
|
361
|
-
scriptFlushed = true;
|
|
436
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
362
437
|
writeTasks();
|
|
363
438
|
for (const url of styles) {
|
|
364
439
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -366,8 +441,9 @@ function renderToStream(code, options = {}) {
|
|
|
366
441
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
367
442
|
} else {
|
|
368
443
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
369
|
-
|
|
370
|
-
|
|
444
|
+
if (!deferActivation) {
|
|
445
|
+
emitTask(`$df("${key}")`);
|
|
446
|
+
}
|
|
371
447
|
}
|
|
372
448
|
item.resolve(error);
|
|
373
449
|
}
|
|
@@ -375,6 +451,16 @@ function renderToStream(code, options = {}) {
|
|
|
375
451
|
}
|
|
376
452
|
return firstFlushed;
|
|
377
453
|
};
|
|
454
|
+
},
|
|
455
|
+
revealFragments(groupOrKeys) {
|
|
456
|
+
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
457
|
+
if (!keys) return;
|
|
458
|
+
emitTask(`$dfj(${JSON.stringify(keys)})`);
|
|
459
|
+
},
|
|
460
|
+
revealFallbacks(groupOrKeys) {
|
|
461
|
+
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
462
|
+
if (!keys) return;
|
|
463
|
+
emitTask(`$dflj(${JSON.stringify(keys)})`);
|
|
378
464
|
}
|
|
379
465
|
};
|
|
380
466
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -885,6 +971,10 @@ Object.defineProperty(exports, "Repeat", {
|
|
|
885
971
|
enumerable: true,
|
|
886
972
|
get: function () { return solidJs.Repeat; }
|
|
887
973
|
});
|
|
974
|
+
Object.defineProperty(exports, "Reveal", {
|
|
975
|
+
enumerable: true,
|
|
976
|
+
get: function () { return solidJs.Reveal; }
|
|
977
|
+
});
|
|
888
978
|
Object.defineProperty(exports, "Show", {
|
|
889
979
|
enumerable: true,
|
|
890
980
|
get: function () { return solidJs.Show; }
|
|
@@ -914,11 +1004,11 @@ exports.DOMElements = DOMElements;
|
|
|
914
1004
|
exports.DelegatedEvents = DelegatedEvents;
|
|
915
1005
|
exports.Dynamic = Dynamic;
|
|
916
1006
|
exports.HydrationScript = HydrationScript;
|
|
1007
|
+
exports.MathMLElements = MathMLElements;
|
|
1008
|
+
exports.Namespaces = Namespaces;
|
|
917
1009
|
exports.Portal = Portal;
|
|
918
|
-
exports.Properties = Properties;
|
|
919
1010
|
exports.RequestContext = RequestContext;
|
|
920
1011
|
exports.SVGElements = SVGElements;
|
|
921
|
-
exports.SVGNamespace = SVGNamespace;
|
|
922
1012
|
exports.addEventListener = notSup;
|
|
923
1013
|
exports.applyRef = applyRef;
|
|
924
1014
|
exports.assign = notSup;
|
package/dist/server.js
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo as createMemo$1, sharedConfig, createRoot, ssrHandleError, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
|
|
3
3
|
import { Serializer, Feature, getCrossReferenceHeader } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
5
5
|
import { createMemo } from '@solidjs/signals';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const DOMWithState = {
|
|
8
|
+
INPUT: {
|
|
9
|
+
value: 1,
|
|
10
|
+
defaultValue: 1,
|
|
11
|
+
checked: 1,
|
|
12
|
+
defaultChecked: 1
|
|
13
|
+
},
|
|
14
|
+
SELECT: {
|
|
15
|
+
value: 1
|
|
16
|
+
},
|
|
17
|
+
OPTION: {
|
|
18
|
+
value: 1,
|
|
19
|
+
selected: 1,
|
|
20
|
+
defaultSelected: 1
|
|
21
|
+
},
|
|
22
|
+
TEXTAREA: {
|
|
23
|
+
value: 1,
|
|
24
|
+
defaultValue: 1
|
|
25
|
+
},
|
|
26
|
+
VIDEO: {
|
|
27
|
+
muted: 1,
|
|
28
|
+
defaultMuted: 1
|
|
29
|
+
},
|
|
30
|
+
AUDIO: {
|
|
31
|
+
muted: 1,
|
|
32
|
+
defaultMuted: 1
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
for (const tagName in DOMWithState) {
|
|
36
|
+
for (const propName in DOMWithState[tagName]) {
|
|
37
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
9
40
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
10
41
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
11
42
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -13,7 +44,10 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
13
44
|
"set", "stop",
|
|
14
45
|
"svg", "switch", "symbol", "text", "textPath",
|
|
15
46
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
16
|
-
const
|
|
47
|
+
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
48
|
+
const Namespaces = {
|
|
49
|
+
svg: "http://www.w3.org/2000/svg",
|
|
50
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
17
51
|
xlink: "http://www.w3.org/1999/xlink",
|
|
18
52
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
19
53
|
};
|
|
@@ -141,7 +175,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
141
175
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
142
176
|
}
|
|
143
177
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
144
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e)
|
|
178
|
+
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)if($dfl(e[i]))return e[i];return null}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
|
|
145
179
|
function renderToString(code, options = {}) {
|
|
146
180
|
const {
|
|
147
181
|
renderId = "",
|
|
@@ -266,7 +300,29 @@ function renderToStream(code, options = {}) {
|
|
|
266
300
|
let shellCompleted = false;
|
|
267
301
|
let scriptFlushed = false;
|
|
268
302
|
let headStyles;
|
|
303
|
+
const revealGroups = new Map();
|
|
269
304
|
let timer = null;
|
|
305
|
+
const emitTask = task => {
|
|
306
|
+
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
307
|
+
scriptFlushed = true;
|
|
308
|
+
};
|
|
309
|
+
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
310
|
+
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
311
|
+
let group = revealGroups.get(groupOrKeys);
|
|
312
|
+
if (!group) {
|
|
313
|
+
if (!release) return;
|
|
314
|
+
group = {
|
|
315
|
+
order: [],
|
|
316
|
+
keys: new Set(),
|
|
317
|
+
released: true
|
|
318
|
+
};
|
|
319
|
+
revealGroups.set(groupOrKeys, group);
|
|
320
|
+
} else if (release) group.released = true;
|
|
321
|
+
if (!group.order.length) return;
|
|
322
|
+
const keys = group.order.slice();
|
|
323
|
+
if (consume) revealGroups.delete(groupOrKeys);
|
|
324
|
+
return keys;
|
|
325
|
+
}
|
|
270
326
|
let rootHoles = null;
|
|
271
327
|
let nextHoleId = 0;
|
|
272
328
|
let buffer = {
|
|
@@ -316,7 +372,26 @@ function renderToStream(code, options = {}) {
|
|
|
316
372
|
escape: escape,
|
|
317
373
|
resolve: resolveSSRNode,
|
|
318
374
|
ssr: ssr,
|
|
319
|
-
registerFragment(key) {
|
|
375
|
+
registerFragment(key, options) {
|
|
376
|
+
const revealGroup = options && options.revealGroup;
|
|
377
|
+
if (revealGroup) {
|
|
378
|
+
let group = revealGroups.get(revealGroup);
|
|
379
|
+
if (!group) {
|
|
380
|
+
group = {
|
|
381
|
+
order: [],
|
|
382
|
+
keys: new Set(),
|
|
383
|
+
released: false
|
|
384
|
+
};
|
|
385
|
+
revealGroups.set(revealGroup, group);
|
|
386
|
+
}
|
|
387
|
+
if (!group.keys.has(key)) {
|
|
388
|
+
group.keys.add(key);
|
|
389
|
+
group.order.push(key);
|
|
390
|
+
}
|
|
391
|
+
if (group.released) {
|
|
392
|
+
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
393
|
+
}
|
|
394
|
+
}
|
|
320
395
|
if (!registry.has(key)) {
|
|
321
396
|
let resolve, reject;
|
|
322
397
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -326,7 +401,7 @@ function renderToStream(code, options = {}) {
|
|
|
326
401
|
queue(flushEnd);
|
|
327
402
|
}))
|
|
328
403
|
});
|
|
329
|
-
serializer.write(key, p);
|
|
404
|
+
serializer.write(key + "_fr", p);
|
|
330
405
|
}
|
|
331
406
|
return (value, error) => {
|
|
332
407
|
if (registry.has(key)) {
|
|
@@ -355,9 +430,9 @@ function renderToStream(code, options = {}) {
|
|
|
355
430
|
} else {
|
|
356
431
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
357
432
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
433
|
+
const deferActivation = !!revealGroup;
|
|
358
434
|
if (styles.length) {
|
|
359
|
-
|
|
360
|
-
scriptFlushed = true;
|
|
435
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
361
436
|
writeTasks();
|
|
362
437
|
for (const url of styles) {
|
|
363
438
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -365,8 +440,9 @@ function renderToStream(code, options = {}) {
|
|
|
365
440
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
366
441
|
} else {
|
|
367
442
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
368
|
-
|
|
369
|
-
|
|
443
|
+
if (!deferActivation) {
|
|
444
|
+
emitTask(`$df("${key}")`);
|
|
445
|
+
}
|
|
370
446
|
}
|
|
371
447
|
item.resolve(error);
|
|
372
448
|
}
|
|
@@ -374,6 +450,16 @@ function renderToStream(code, options = {}) {
|
|
|
374
450
|
}
|
|
375
451
|
return firstFlushed;
|
|
376
452
|
};
|
|
453
|
+
},
|
|
454
|
+
revealFragments(groupOrKeys) {
|
|
455
|
+
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
456
|
+
if (!keys) return;
|
|
457
|
+
emitTask(`$dfj(${JSON.stringify(keys)})`);
|
|
458
|
+
},
|
|
459
|
+
revealFallbacks(groupOrKeys) {
|
|
460
|
+
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
461
|
+
if (!keys) return;
|
|
462
|
+
emitTask(`$dflj(${JSON.stringify(keys)})`);
|
|
377
463
|
}
|
|
378
464
|
};
|
|
379
465
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -856,4 +942,4 @@ function Portal(props) {
|
|
|
856
942
|
throw new Error("Portal is not supported on the server");
|
|
857
943
|
}
|
|
858
944
|
|
|
859
|
-
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript,
|
|
945
|
+
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, notSup as addEventListener, applyRef, notSup as assign, notSup as className, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
|
package/dist/web.cjs
CHANGED
|
@@ -3,8 +3,39 @@
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
var signals = require('@solidjs/signals');
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const DOMWithState = {
|
|
7
|
+
INPUT: {
|
|
8
|
+
value: 1,
|
|
9
|
+
defaultValue: 1,
|
|
10
|
+
checked: 1,
|
|
11
|
+
defaultChecked: 1
|
|
12
|
+
},
|
|
13
|
+
SELECT: {
|
|
14
|
+
value: 1
|
|
15
|
+
},
|
|
16
|
+
OPTION: {
|
|
17
|
+
value: 1,
|
|
18
|
+
selected: 1,
|
|
19
|
+
defaultSelected: 1
|
|
20
|
+
},
|
|
21
|
+
TEXTAREA: {
|
|
22
|
+
value: 1,
|
|
23
|
+
defaultValue: 1
|
|
24
|
+
},
|
|
25
|
+
VIDEO: {
|
|
26
|
+
muted: 1,
|
|
27
|
+
defaultMuted: 1
|
|
28
|
+
},
|
|
29
|
+
AUDIO: {
|
|
30
|
+
muted: 1,
|
|
31
|
+
defaultMuted: 1
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
for (const tagName in DOMWithState) {
|
|
35
|
+
for (const propName in DOMWithState[tagName]) {
|
|
36
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
8
39
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
9
40
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
10
41
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -12,7 +43,10 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
12
43
|
"set", "stop",
|
|
13
44
|
"svg", "switch", "symbol", "text", "textPath",
|
|
14
45
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
15
|
-
const
|
|
46
|
+
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
47
|
+
const Namespaces = {
|
|
48
|
+
svg: "http://www.w3.org/2000/svg",
|
|
49
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
16
50
|
xlink: "http://www.w3.org/1999/xlink",
|
|
17
51
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
18
52
|
};
|
|
@@ -98,14 +132,14 @@ function render$1(code, element, init, options = {}) {
|
|
|
98
132
|
element.textContent = "";
|
|
99
133
|
};
|
|
100
134
|
}
|
|
101
|
-
function
|
|
135
|
+
function create(html, bypassGuard, flag) {
|
|
136
|
+
const t = document.createElement("template");
|
|
137
|
+
t.innerHTML = html;
|
|
138
|
+
return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
139
|
+
}
|
|
140
|
+
function template(html, flag) {
|
|
102
141
|
let node;
|
|
103
|
-
const
|
|
104
|
-
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
105
|
-
t.innerHTML = html;
|
|
106
|
-
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
107
|
-
};
|
|
108
|
-
const fn = isImportNode ? bypassGuard => solidJs.untrack(() => document.importNode(node || (node = create()), true)) : bypassGuard => (node || (node = create())).cloneNode(true);
|
|
142
|
+
const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
|
|
109
143
|
return fn;
|
|
110
144
|
}
|
|
111
145
|
function delegateEvents(eventNames, document = window.document) {
|
|
@@ -134,16 +168,16 @@ function setAttribute(node, name, value) {
|
|
|
134
168
|
}
|
|
135
169
|
function setAttributeNS(node, namespace, name, value) {
|
|
136
170
|
if (isHydrating(node)) return;
|
|
137
|
-
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
171
|
+
if (value == null || value === false) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
|
|
138
172
|
}
|
|
139
|
-
function className(node, value,
|
|
173
|
+
function className(node, value, prev) {
|
|
140
174
|
if (isHydrating(node)) return;
|
|
141
175
|
if (value == null || value === false) {
|
|
142
176
|
prev && node.removeAttribute("class");
|
|
143
177
|
return;
|
|
144
178
|
}
|
|
145
179
|
if (typeof value === "string") {
|
|
146
|
-
value !== prev &&
|
|
180
|
+
value !== prev && node.setAttribute("class", value);
|
|
147
181
|
return;
|
|
148
182
|
}
|
|
149
183
|
if (typeof prev === "string") {
|
|
@@ -198,7 +232,7 @@ function style(node, value, prev) {
|
|
|
198
232
|
function setStyleProperty(node, name, value) {
|
|
199
233
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
200
234
|
}
|
|
201
|
-
function spread(node, props = {},
|
|
235
|
+
function spread(node, props = {}, skipChildren) {
|
|
202
236
|
const prevProps = {};
|
|
203
237
|
if (!skipChildren) insert(node, () => props.children);
|
|
204
238
|
effect(() => {
|
|
@@ -212,7 +246,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
212
246
|
newProps[prop] = props[prop];
|
|
213
247
|
}
|
|
214
248
|
return newProps;
|
|
215
|
-
}, props => assign(node, props,
|
|
249
|
+
}, props => assign(node, props, true, prevProps, true));
|
|
216
250
|
return prevProps;
|
|
217
251
|
}
|
|
218
252
|
function dynamicProperty(props, key) {
|
|
@@ -257,21 +291,21 @@ function insert(parent, accessor, marker, initial) {
|
|
|
257
291
|
}
|
|
258
292
|
effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
|
|
259
293
|
}
|
|
260
|
-
function assign(node, props,
|
|
294
|
+
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
295
|
+
const nodeName = node.nodeName;
|
|
261
296
|
props || (props = {});
|
|
262
297
|
for (const prop in prevProps) {
|
|
263
298
|
if (!(prop in props)) {
|
|
264
299
|
if (prop === "children") continue;
|
|
265
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop],
|
|
300
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
266
301
|
}
|
|
267
302
|
}
|
|
268
303
|
for (const prop in props) {
|
|
269
304
|
if (prop === "children") {
|
|
270
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
305
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
271
306
|
continue;
|
|
272
307
|
}
|
|
273
|
-
|
|
274
|
-
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
|
|
308
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
275
309
|
}
|
|
276
310
|
}
|
|
277
311
|
function hydrate$1(code, element, options = {}) {
|
|
@@ -398,18 +432,20 @@ function flattenClassList(list, result) {
|
|
|
398
432
|
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
399
433
|
}
|
|
400
434
|
}
|
|
401
|
-
function assignProp(node, prop, value, prev,
|
|
402
|
-
let forceProp;
|
|
435
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
403
436
|
if (prop === "style") return style(node, value, prev), value;
|
|
404
|
-
if (prop === "class") return className(node, value,
|
|
405
|
-
if (value === prev) return prev;
|
|
437
|
+
if (prop === "class") return className(node, value, prev), value;
|
|
438
|
+
if (value === prev && !DOMWithState[nodeName]?.[prop]) return prev;
|
|
406
439
|
if (prop === "ref") {
|
|
407
440
|
if (!skipRef && value) ref(() => value, node);
|
|
408
|
-
|
|
441
|
+
return value;
|
|
442
|
+
}
|
|
443
|
+
const hasNamespace = prop.indexOf(":") > -1;
|
|
444
|
+
if (hasNamespace && prop.slice(0, 3) === "on:") {
|
|
409
445
|
const e = prop.slice(3);
|
|
410
446
|
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
411
447
|
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
412
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
448
|
+
} else if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
413
449
|
const name = prop.slice(2).toLowerCase();
|
|
414
450
|
const delegate = DelegatedEvents.has(name);
|
|
415
451
|
if (!delegate && prev) {
|
|
@@ -420,11 +456,11 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
420
456
|
addEventListener(node, name, value, delegate);
|
|
421
457
|
delegate && delegateEvents([name]);
|
|
422
458
|
}
|
|
423
|
-
} else if (
|
|
424
|
-
if (
|
|
425
|
-
if (prop === "value" &&
|
|
459
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
460
|
+
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
461
|
+
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
426
462
|
} else {
|
|
427
|
-
const ns =
|
|
463
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
428
464
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
429
465
|
}
|
|
430
466
|
return value;
|
|
@@ -506,7 +542,6 @@ function insertExpression(parent, value, current, marker) {
|
|
|
506
542
|
appendNodes(parent, value, marker);
|
|
507
543
|
} else reconcileArrays(parent, current, value);
|
|
508
544
|
} else {
|
|
509
|
-
if (current && current.nodeType) clearHydrationRegistry(current);
|
|
510
545
|
current && cleanChildren(parent);
|
|
511
546
|
appendNodes(parent, value);
|
|
512
547
|
}
|
|
@@ -532,18 +567,6 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
532
567
|
function appendNodes(parent, array, marker = null) {
|
|
533
568
|
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
534
569
|
}
|
|
535
|
-
function clearHydrationRegistry(node) {
|
|
536
|
-
if (!solidJs.sharedConfig.registry || !node || node.nodeType !== 1) return;
|
|
537
|
-
const key = node.getAttribute("_hk");
|
|
538
|
-
if (key) solidJs.sharedConfig.registry.delete(key);
|
|
539
|
-
const descendants = node.querySelectorAll?.(`*[_hk]`);
|
|
540
|
-
if (descendants) {
|
|
541
|
-
for (let i = 0; i < descendants.length; i++) {
|
|
542
|
-
const descendantKey = descendants[i].getAttribute("_hk");
|
|
543
|
-
if (descendantKey) solidJs.sharedConfig.registry.delete(descendantKey);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
570
|
function cleanChildren(parent, current, marker, replacement) {
|
|
548
571
|
if (marker === undefined) return parent.textContent = "";
|
|
549
572
|
if (current.length) {
|
|
@@ -552,10 +575,7 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
552
575
|
const el = current[i];
|
|
553
576
|
if (replacement !== el) {
|
|
554
577
|
const isParent = el.parentNode === parent;
|
|
555
|
-
if (replacement && !inserted && !i) isParent ?
|
|
556
|
-
clearHydrationRegistry(el);
|
|
557
|
-
el.remove();
|
|
558
|
-
}
|
|
578
|
+
if (replacement && !inserted && !i) isParent ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else isParent && el.remove();
|
|
559
579
|
} else inserted = true;
|
|
560
580
|
}
|
|
561
581
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
@@ -693,6 +713,10 @@ Object.defineProperty(exports, "NoHydration", {
|
|
|
693
713
|
enumerable: true,
|
|
694
714
|
get: function () { return solidJs.NoHydration; }
|
|
695
715
|
});
|
|
716
|
+
Object.defineProperty(exports, "Reveal", {
|
|
717
|
+
enumerable: true,
|
|
718
|
+
get: function () { return solidJs.Reveal; }
|
|
719
|
+
});
|
|
696
720
|
Object.defineProperty(exports, "Show", {
|
|
697
721
|
enumerable: true,
|
|
698
722
|
get: function () { return solidJs.Show; }
|
|
@@ -720,14 +744,15 @@ Object.defineProperty(exports, "untrack", {
|
|
|
720
744
|
exports.Assets = voidFn;
|
|
721
745
|
exports.ChildProperties = ChildProperties;
|
|
722
746
|
exports.DOMElements = DOMElements;
|
|
747
|
+
exports.DOMWithState = DOMWithState;
|
|
723
748
|
exports.DelegatedEvents = DelegatedEvents;
|
|
724
749
|
exports.Dynamic = Dynamic;
|
|
725
750
|
exports.HydrationScript = voidFn;
|
|
751
|
+
exports.MathMLElements = MathMLElements;
|
|
752
|
+
exports.Namespaces = Namespaces;
|
|
726
753
|
exports.Portal = Portal;
|
|
727
|
-
exports.Properties = Properties;
|
|
728
754
|
exports.RequestContext = RequestContext;
|
|
729
755
|
exports.SVGElements = SVGElements;
|
|
730
|
-
exports.SVGNamespace = SVGNamespace;
|
|
731
756
|
exports.addEventListener = addEventListener;
|
|
732
757
|
exports.applyRef = applyRef;
|
|
733
758
|
exports.assign = assign;
|