@solidjs/web 2.0.0-rc.21 → 2.0.0-rc.23
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 +403 -242
- package/dist/server.js +400 -241
- package/dist/server.observe.js +400 -241
- package/dist/web.dev.js +140 -100
- package/dist/web.js +118 -99
- package/dist/web.observe.js +118 -99
- package/frames/dist/client.dev.js +7 -2
- package/frames/dist/client.js +7 -2
- package/frames/dist/client.observe.js +7 -2
- package/frames/dist/server.dev.js +122 -62
- package/frames/dist/server.js +122 -62
- package/frames/dist/server.observe.js +122 -62
- package/frames/dist/wire.js +1 -1
- package/package.json +6 -5
- package/serialization/dist/serialization.js +5 -4
- package/serialization/types/index.d.ts +8 -1
- package/serialization/types/serializer.d.ts +8 -1
- package/server-functions/dist/client.dev.js +16 -7
- package/server-functions/dist/client.js +16 -7
- package/server-functions/dist/client.observe.js +16 -7
- package/server-functions/dist/server.dev.js +20 -38
- package/server-functions/dist/server.js +20 -38
- package/server-functions/dist/server.observe.js +20 -38
- package/types/client.d.ts +54 -2
- package/types/constants.d.ts +2 -1
- package/types/frames/frame-client.d.ts +2 -0
- package/types/frames/serializer.d.ts +8 -1
- package/types/frames/tree-rewrite.d.ts +7 -0
- package/types/serializer.d.ts +8 -1
- package/types/server-functions/shared.d.ts +3 -2
- package/types/server.d.ts +48 -7
- package/types/trace.d.ts +18 -0
package/dist/web.observe.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, OBSERVE, enableHydration, $PROXY, untrack,
|
|
1
|
+
import { createRenderEffect, createMemo, OBSERVE, enableHydration, $PROXY, untrack, runRefCallback, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, runWithOwner, setSwapHook, isHidden, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig, enableServerComponentHydration,
|
|
3
|
+
import { sharedConfig, enableServerComponentHydration, hasStaticKeys, heldRead, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PROXY, SOURCE_PLAIN, sourceKeys, resolvedTable, dynamicCore } from 'solid-js/internal';
|
|
4
|
+
export { heldRead } from 'solid-js/internal';
|
|
4
5
|
|
|
5
6
|
const DOMWithState = {
|
|
6
7
|
INPUT: {
|
|
@@ -32,6 +33,7 @@ const DOMWithState = {
|
|
|
32
33
|
};
|
|
33
34
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
35
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
36
|
+
const $$INDEX = /*#__PURE__*/Symbol("index");
|
|
35
37
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
38
|
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"]);
|
|
37
39
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -82,32 +84,36 @@ function memo(fn) {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
+
let bLength = b.length,
|
|
88
|
+
aEnd = a.length,
|
|
89
|
+
bEnd = bLength,
|
|
90
|
+
aStart = 0,
|
|
91
|
+
bStart = 0,
|
|
92
|
+
stamped,
|
|
93
|
+
after,
|
|
94
|
+
index,
|
|
95
|
+
anchor;
|
|
96
|
+
while (aStart < aEnd && a[aStart] === b[bStart]) {
|
|
97
|
+
aStart++;
|
|
98
|
+
bStart++;
|
|
99
|
+
}
|
|
100
|
+
if (aStart === aEnd && bStart === bEnd) return;
|
|
101
|
+
const mv = parentNode.moveBefore && parentNode.isConnected;
|
|
87
102
|
const slot = marker || parentNode;
|
|
88
103
|
const insert = (n, ref) => {
|
|
89
|
-
|
|
104
|
+
mv && n.isConnected ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
90
105
|
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
91
106
|
};
|
|
92
|
-
if (!
|
|
107
|
+
if (!aEnd) {
|
|
93
108
|
for (const n of b) insert(n, marker);
|
|
94
109
|
return;
|
|
95
110
|
}
|
|
96
|
-
const isLive = n =>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return
|
|
111
|
+
const isLive = n => n && n.parentNode === parentNode && (!(n = n[$$SLOT]) || n === slot);
|
|
112
|
+
const ref = k => {
|
|
113
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
114
|
+
return b[k] || (after && after.parentNode !== parentNode ? marker || null : after);
|
|
100
115
|
};
|
|
101
|
-
|
|
102
|
-
aEnd = a.length,
|
|
103
|
-
bEnd = bLength,
|
|
104
|
-
aStart = 0,
|
|
105
|
-
bStart = 0,
|
|
106
|
-
tail = a[aEnd - 1],
|
|
107
|
-
after = isLive(tail) ? tail.nextSibling : marker || null,
|
|
108
|
-
map = null,
|
|
109
|
-
anchor,
|
|
110
|
-
anchorTag;
|
|
116
|
+
after = isLive(anchor = a[aEnd - 1]) ? anchor.nextSibling : marker || null;
|
|
111
117
|
while (aStart < aEnd || bStart < bEnd) {
|
|
112
118
|
if (a[aStart] === b[bStart]) {
|
|
113
119
|
aStart++;
|
|
@@ -119,52 +125,43 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
119
125
|
bEnd--;
|
|
120
126
|
}
|
|
121
127
|
if (aEnd === aStart) {
|
|
122
|
-
|
|
123
|
-
while (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const n = a[aStart++];
|
|
129
|
-
if ((!map || !map.has(n)) && isLive(n)) n.remove();
|
|
130
|
-
}
|
|
131
|
-
} else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
|
|
128
|
+
anchor = ref(bEnd);
|
|
129
|
+
while (bStart < bEnd) insert(b[bStart++], anchor);
|
|
130
|
+
} else if (!isLive(anchor = a[aStart])) aStart++;
|
|
131
|
+
else if (b[bStart] === a[aEnd - 1] && (
|
|
132
|
+
anchor === b[bEnd - 1] ||
|
|
133
|
+
!stamped && anchor === b[bStart + 1] && a[aStart + 1] === b[bStart + 2])) {
|
|
132
134
|
do {
|
|
133
135
|
insert(a[--aEnd], anchor);
|
|
134
136
|
bStart++;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
} while (aStart < aEnd - 1 && bStart < bEnd && anchor === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
138
|
+
} else if (bStart < bEnd && anchor === b[bEnd - 1] && a[aStart + 1] !== b[bEnd - 2] && isLive(b[bStart]) && isLive(a[aEnd - 1])) {
|
|
139
|
+
insert(anchor, ref(bEnd));
|
|
140
|
+
aStart++;
|
|
141
|
+
bEnd--;
|
|
137
142
|
} else {
|
|
138
|
-
if (!
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
if (!map) {
|
|
143
|
-
map = new Map();
|
|
144
|
-
let i = bStart;
|
|
145
|
-
while (i < bEnd) map.set(b[i], i++);
|
|
143
|
+
if (!stamped) {
|
|
144
|
+
stamped = 1;
|
|
145
|
+
for (index = bStart; index < bEnd;) b[index][$$INDEX] = index++;
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
if (index != null) {
|
|
147
|
+
if ((index = anchor[$$INDEX]) >= 0 && b[index] === anchor) {
|
|
149
148
|
if (bStart < index && index < bEnd) {
|
|
150
149
|
let i = aStart,
|
|
151
|
-
sequence = 1
|
|
152
|
-
|
|
153
|
-
while (++i < aEnd && i < bEnd) {
|
|
154
|
-
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
155
|
-
sequence++;
|
|
156
|
-
}
|
|
150
|
+
sequence = 1;
|
|
151
|
+
while (++i < aEnd && i < bEnd && a[i] === b[index + sequence]) sequence++;
|
|
157
152
|
if (sequence > index - bStart) {
|
|
158
|
-
|
|
159
|
-
while (bStart < index) insert(b[bStart++], node);
|
|
153
|
+
while (bStart < index) insert(b[bStart++], anchor);
|
|
160
154
|
} else {
|
|
161
|
-
const newNode = b[bStart++]
|
|
162
|
-
|
|
163
|
-
|
|
155
|
+
const newNode = b[bStart++];
|
|
156
|
+
aStart++;
|
|
157
|
+
mv ? insert(newNode, anchor) : parentNode.replaceChild(newNode, anchor);
|
|
164
158
|
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
165
159
|
}
|
|
166
160
|
} else aStart++;
|
|
167
|
-
} else
|
|
161
|
+
} else {
|
|
162
|
+
anchor.remove();
|
|
163
|
+
aStart++;
|
|
164
|
+
}
|
|
168
165
|
}
|
|
169
166
|
}
|
|
170
167
|
}
|
|
@@ -422,15 +419,22 @@ function render(code, element, init, options = {}) {
|
|
|
422
419
|
element.textContent = "";
|
|
423
420
|
};
|
|
424
421
|
}
|
|
422
|
+
let policy;
|
|
423
|
+
function setTrustedTypesPolicy(value) {
|
|
424
|
+
policy = value;
|
|
425
|
+
}
|
|
426
|
+
function trustedHTML(html) {
|
|
427
|
+
return policy ? policy.createHTML(html) : html;
|
|
428
|
+
}
|
|
425
429
|
function create(html, bypassGuard, flag) {
|
|
426
430
|
const t = document.createElement("template");
|
|
427
|
-
t.innerHTML = html;
|
|
431
|
+
t.innerHTML = policy ? policy.createHTML(html) : html;
|
|
428
432
|
const node = t.content.firstChild;
|
|
429
433
|
return flag === 2 ? node.firstChild : node;
|
|
430
434
|
}
|
|
431
435
|
function template(html, flag) {
|
|
432
436
|
let node;
|
|
433
|
-
const fn =
|
|
437
|
+
const fn = bypassGuard => (node || (node = create(html, bypassGuard, flag)), flag === 1 ? document.importNode(node, true) : node.cloneNode(true));
|
|
434
438
|
return fn;
|
|
435
439
|
}
|
|
436
440
|
function delegateEvents(eventNames) {
|
|
@@ -506,8 +510,7 @@ function getDelegatedRoot(node) {
|
|
|
506
510
|
}
|
|
507
511
|
}
|
|
508
512
|
const parentOf = node => node._$host || node.parentNode || node.host;
|
|
509
|
-
function findOwner(
|
|
510
|
-
let node = target;
|
|
513
|
+
function findOwner(node, state) {
|
|
511
514
|
let distance = 0;
|
|
512
515
|
while (node) {
|
|
513
516
|
if (state.owners.has(node)) return {
|
|
@@ -529,6 +532,9 @@ function setProperty(node, name, value) {
|
|
|
529
532
|
function setStatefulProperty(node, name, value) {
|
|
530
533
|
node[name] = value;
|
|
531
534
|
}
|
|
535
|
+
function strictHandler(fn) {
|
|
536
|
+
return fn();
|
|
537
|
+
}
|
|
532
538
|
let claimHandlers = null;
|
|
533
539
|
const claimAttributeSets = [];
|
|
534
540
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -608,7 +614,7 @@ function className(node, value, prev) {
|
|
|
608
614
|
return;
|
|
609
615
|
}
|
|
610
616
|
if (typeof value === "string") {
|
|
611
|
-
node._$classes = undefined;
|
|
617
|
+
if (node._$classes) node._$classes = undefined;
|
|
612
618
|
value !== prev && node.setAttribute("class", value);
|
|
613
619
|
return;
|
|
614
620
|
}
|
|
@@ -729,33 +735,42 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
729
735
|
}
|
|
730
736
|
const prevProps = {};
|
|
731
737
|
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
738
|
+
let held = 0;
|
|
732
739
|
const apply = newProps => {
|
|
733
740
|
const r = newProps.ref;
|
|
734
741
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
742
|
+
spreadHeld = held;
|
|
735
743
|
assign(node, newProps, true, prevProps, true);
|
|
744
|
+
spreadHeld = 0;
|
|
736
745
|
if (owner !== undefined) claimElement(node, owner);
|
|
737
746
|
};
|
|
747
|
+
const read = fn => () => {
|
|
748
|
+
const p = fn();
|
|
749
|
+
held = heldRead();
|
|
750
|
+
return p;
|
|
751
|
+
};
|
|
738
752
|
if (Array.isArray(props)) {
|
|
739
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
753
|
+
effect(read(() => collectSources({}, props, undefined, skip)), apply);
|
|
740
754
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
741
755
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
742
756
|
const s = resolveSource(props[i]);
|
|
743
|
-
if (s
|
|
757
|
+
if (s && entryHas(s, "children")) return entryGet(s, "children");
|
|
744
758
|
}
|
|
745
759
|
});
|
|
746
760
|
return prevProps;
|
|
747
761
|
}
|
|
748
|
-
|
|
762
|
+
const collect = () => {
|
|
749
763
|
const source = resolveSource(props);
|
|
750
764
|
const newProps = {};
|
|
751
765
|
const table = resolvedTable(source);
|
|
752
766
|
if (table !== undefined) return collectTable(newProps, table, skip);
|
|
753
|
-
if (source
|
|
767
|
+
if (source) {
|
|
754
768
|
const view = viewOf(source);
|
|
755
769
|
if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
|
|
756
770
|
}
|
|
757
771
|
return newProps;
|
|
758
|
-
}
|
|
772
|
+
};
|
|
773
|
+
effect(read(collect), apply);
|
|
759
774
|
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
760
775
|
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
761
776
|
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
@@ -764,7 +779,7 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
764
779
|
}
|
|
765
780
|
} else insert(node, () => {
|
|
766
781
|
const source = resolveSource(props);
|
|
767
|
-
return source
|
|
782
|
+
return source && entryHas(source, "children") ? entryGet(source, "children") : undefined;
|
|
768
783
|
});
|
|
769
784
|
}
|
|
770
785
|
return prevProps;
|
|
@@ -803,7 +818,7 @@ function pushEntry(resolved, kinds, s, kind) {
|
|
|
803
818
|
return;
|
|
804
819
|
}
|
|
805
820
|
s = resolveSource(s);
|
|
806
|
-
if (s
|
|
821
|
+
if (!s) return;
|
|
807
822
|
const view = viewOf(s);
|
|
808
823
|
if (view instanceof OmitView) {
|
|
809
824
|
resolved.push(view);
|
|
@@ -843,7 +858,7 @@ function applyRef(r, element) {
|
|
|
843
858
|
}
|
|
844
859
|
function ref(fn, element) {
|
|
845
860
|
const resolved = untrack(fn);
|
|
846
|
-
|
|
861
|
+
runRefCallback(() => applyRef(resolved, element));
|
|
847
862
|
}
|
|
848
863
|
function scope(fn) {
|
|
849
864
|
fn.$s = true;
|
|
@@ -854,6 +869,10 @@ const SCOPE_OPTIONS = {
|
|
|
854
869
|
};
|
|
855
870
|
let hydrationRt = null;
|
|
856
871
|
let selectInsert = null;
|
|
872
|
+
let hostRt = null;
|
|
873
|
+
function installHostTagging() {
|
|
874
|
+
hostRt = tagHost;
|
|
875
|
+
}
|
|
857
876
|
function installHydrationRuntime() {
|
|
858
877
|
hydrationRt = {
|
|
859
878
|
claimInitial(parent, multi, initial) {
|
|
@@ -864,8 +883,7 @@ function installHydrationRuntime() {
|
|
|
864
883
|
},
|
|
865
884
|
reclaimRegion(current, parent, marker) {
|
|
866
885
|
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
867
|
-
|
|
868
|
-
if (first == null || first.isConnected) return current;
|
|
886
|
+
if (Array.isArray(current) ? current.every(n => !n || n.isConnected) : current.isConnected) return current;
|
|
869
887
|
let nodes;
|
|
870
888
|
if (marker) {
|
|
871
889
|
nodes = [];
|
|
@@ -925,30 +943,28 @@ function claimChildNodes(parent) {
|
|
|
925
943
|
function isPlaceholderScaffolding(node, t) {
|
|
926
944
|
return t === 8 ? node.nodeValue.startsWith("pl-") : t === 1 && node.localName === "template" && node.id.startsWith("pl-");
|
|
927
945
|
}
|
|
928
|
-
function insert(parent, accessor, marker,
|
|
946
|
+
function insert(parent, accessor, marker, current, options) {
|
|
929
947
|
if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
|
|
930
948
|
...options,
|
|
931
949
|
name: spreadName + ".children",
|
|
932
950
|
loc: spreadLoc
|
|
933
951
|
};
|
|
934
952
|
const multi = marker !== undefined;
|
|
935
|
-
|
|
936
|
-
if (
|
|
937
|
-
if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
|
|
953
|
+
if (multi && !current) current = [];
|
|
954
|
+
if (hydrationRt !== null) current = hydrationRt.claimInitial(parent, multi, current);
|
|
938
955
|
if (typeof accessor !== "function") {
|
|
939
|
-
accessor = normalize(accessor,
|
|
956
|
+
accessor = normalize(accessor, current, multi, true);
|
|
940
957
|
if (typeof accessor !== "function") {
|
|
941
|
-
insertExpression(parent, accessor,
|
|
942
|
-
host &&
|
|
958
|
+
insertExpression(parent, accessor, current, marker);
|
|
959
|
+
hostRt !== null && options && options.host && hostRt(accessor, options.host);
|
|
943
960
|
return;
|
|
944
961
|
}
|
|
945
962
|
}
|
|
946
|
-
if (multi &&
|
|
963
|
+
if (multi && current.length === 0) {
|
|
947
964
|
const placeholder = document.createTextNode("");
|
|
948
965
|
parent.insertBefore(placeholder, marker);
|
|
949
|
-
|
|
966
|
+
current = [placeholder];
|
|
950
967
|
}
|
|
951
|
-
let current = initial;
|
|
952
968
|
let ran = false;
|
|
953
969
|
effect(() => {
|
|
954
970
|
if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
|
|
@@ -962,13 +978,13 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
962
978
|
} : options;
|
|
963
979
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
964
980
|
current = insertExpression(parent, inner, current, marker);
|
|
965
|
-
host &&
|
|
981
|
+
hostRt !== null && options && options.host && hostRt(current, options.host);
|
|
966
982
|
}, innerOptions);
|
|
967
983
|
return INNER_OWNED;
|
|
968
984
|
}, value => {
|
|
969
985
|
if (value === INNER_OWNED) return;
|
|
970
986
|
current = insertExpression(parent, value, current, marker);
|
|
971
|
-
host &&
|
|
987
|
+
hostRt !== null && options && options.host && hostRt(current, options.host);
|
|
972
988
|
},
|
|
973
989
|
accessor.$s ? options ? {
|
|
974
990
|
...options,
|
|
@@ -1180,6 +1196,7 @@ function initHeadRegistry() {
|
|
|
1180
1196
|
headRegistrations = [];
|
|
1181
1197
|
headOwned = new Map();
|
|
1182
1198
|
headApplied = new Map();
|
|
1199
|
+
setSwapHook(scheduleHeadApply);
|
|
1183
1200
|
const t = document.querySelector("title");
|
|
1184
1201
|
headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
|
|
1185
1202
|
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
@@ -1230,7 +1247,7 @@ function flushHeadRegistry() {
|
|
|
1230
1247
|
return;
|
|
1231
1248
|
}
|
|
1232
1249
|
headScheduled = false;
|
|
1233
|
-
const winners = resolveHead(headRegistrations);
|
|
1250
|
+
const winners = resolveHead(headRegistrations.filter(r => !isHidden(r.node)));
|
|
1234
1251
|
for (const [identity, els] of headOwned) {
|
|
1235
1252
|
if (winners.has(identity)) continue;
|
|
1236
1253
|
headOwned.delete(identity);
|
|
@@ -1342,10 +1359,12 @@ function useHead(tags) {
|
|
|
1342
1359
|
initHeadRegistry();
|
|
1343
1360
|
const reg = {
|
|
1344
1361
|
seq: -1,
|
|
1345
|
-
tags: null
|
|
1362
|
+
tags: null,
|
|
1363
|
+
node: null
|
|
1346
1364
|
};
|
|
1347
1365
|
const uid = ++headUid;
|
|
1348
1366
|
effect(() => {
|
|
1367
|
+
reg.node = getOwner();
|
|
1349
1368
|
let list = typeof tags === "function" ? tags() : tags;
|
|
1350
1369
|
if (!Array.isArray(list)) list = [list];
|
|
1351
1370
|
const replaceable = [];
|
|
@@ -1667,10 +1686,11 @@ function flattenClassList(list, result) {
|
|
|
1667
1686
|
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1668
1687
|
}
|
|
1669
1688
|
}
|
|
1689
|
+
let spreadHeld = 0;
|
|
1670
1690
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
1671
1691
|
if (prop === "style") return style(node, value, prev), value;
|
|
1672
1692
|
if (prop === "class") return className(node, value, prev), value;
|
|
1673
|
-
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
1693
|
+
if (value === prev && (spreadHeld || DOMWithState[nodeName]?.[prop] !== 1)) return prev;
|
|
1674
1694
|
if (prop === "ref") {
|
|
1675
1695
|
if (!skipRef && value) ref(() => value, node);
|
|
1676
1696
|
return value;
|
|
@@ -1715,37 +1735,32 @@ function eventHandler(e, container, state) {
|
|
|
1715
1735
|
e[$$EVENT_OWNER] = owner;
|
|
1716
1736
|
let node = resumeNode || e.target;
|
|
1717
1737
|
const key = EVENT_KEY + e.type;
|
|
1718
|
-
const
|
|
1738
|
+
const define = (name, value) => Object.defineProperty(e, name, {
|
|
1719
1739
|
configurable: true,
|
|
1720
1740
|
value
|
|
1721
1741
|
});
|
|
1722
1742
|
const handleNode = () => {
|
|
1723
1743
|
const handler = node[key];
|
|
1724
1744
|
if (handler && !node.disabled) {
|
|
1745
|
+
define("currentTarget", node);
|
|
1725
1746
|
const data = node[`${key}Data`];
|
|
1726
1747
|
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1727
1748
|
if (e.cancelBubble) return;
|
|
1728
1749
|
}
|
|
1729
|
-
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) &&
|
|
1750
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && define("target", node.host);
|
|
1730
1751
|
return true;
|
|
1731
1752
|
};
|
|
1732
1753
|
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1733
1754
|
const walkUpTree = () => {
|
|
1734
1755
|
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1735
1756
|
};
|
|
1736
|
-
Object.defineProperty(e, "currentTarget", {
|
|
1737
|
-
configurable: true,
|
|
1738
|
-
get() {
|
|
1739
|
-
return node || owner;
|
|
1740
|
-
}
|
|
1741
|
-
});
|
|
1742
1757
|
if (resumeNode) {
|
|
1743
1758
|
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
1744
1759
|
if (node && node !== owner) walkUpTree();
|
|
1745
1760
|
} else if (e.composedPath) {
|
|
1746
1761
|
const path = e.composedPath();
|
|
1747
1762
|
if (path.length) {
|
|
1748
|
-
|
|
1763
|
+
define("target", path[0]);
|
|
1749
1764
|
for (let i = 0; i < path.length; i++) {
|
|
1750
1765
|
node = path[i];
|
|
1751
1766
|
if (!handleNode()) break;
|
|
@@ -1781,8 +1796,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1781
1796
|
const tracked = [].concat(current ?? []);
|
|
1782
1797
|
if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
|
|
1783
1798
|
}
|
|
1784
|
-
const t = typeof value
|
|
1785
|
-
multi = marker !== undefined;
|
|
1799
|
+
const t = typeof value;
|
|
1786
1800
|
if (t === "string" || t === "number") {
|
|
1787
1801
|
const tc = typeof current;
|
|
1788
1802
|
if (tc === "string" || tc === "number") {
|
|
@@ -1797,7 +1811,7 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1797
1811
|
cleanChildren(parent, current, marker);
|
|
1798
1812
|
} else if (value.nodeType) {
|
|
1799
1813
|
if (Array.isArray(current)) {
|
|
1800
|
-
cleanChildren(parent, current,
|
|
1814
|
+
cleanChildren(parent, current, marker ?? null, value);
|
|
1801
1815
|
} else if (current != null && current.nodeType) {
|
|
1802
1816
|
current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
|
|
1803
1817
|
} else if (current != null && parent.firstChild) {
|
|
@@ -1814,7 +1828,8 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1814
1828
|
if (t === "string" || t === "number") {
|
|
1815
1829
|
const prev = currentArray ? current[i] : undefined;
|
|
1816
1830
|
if (prev && prev.nodeType === 3) {
|
|
1817
|
-
|
|
1831
|
+
const last = prev._$d;
|
|
1832
|
+
if (last !== item && (last !== undefined || prev.data !== "" + item)) prev.data = prev._$d = item;
|
|
1818
1833
|
value[i] = prev;
|
|
1819
1834
|
} else value[i] = document.createTextNode(item);
|
|
1820
1835
|
}
|
|
@@ -1874,13 +1889,16 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1874
1889
|
}
|
|
1875
1890
|
return value;
|
|
1876
1891
|
}
|
|
1892
|
+
function hostGetter() {
|
|
1893
|
+
return this[$$HOST]();
|
|
1894
|
+
}
|
|
1877
1895
|
function tagHost(value, host) {
|
|
1878
1896
|
if (Array.isArray(value)) {
|
|
1879
1897
|
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
1880
1898
|
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
1881
1899
|
value[$$HOST] = host;
|
|
1882
1900
|
Object.defineProperty(value, "_$host", {
|
|
1883
|
-
get:
|
|
1901
|
+
get: hostGetter,
|
|
1884
1902
|
configurable: true
|
|
1885
1903
|
});
|
|
1886
1904
|
}
|
|
@@ -2141,6 +2159,7 @@ function portalImpl(props) {
|
|
|
2141
2159
|
const m = untrack(mount);
|
|
2142
2160
|
m.appendChild(endMarker);
|
|
2143
2161
|
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
2162
|
+
installHostTagging();
|
|
2144
2163
|
insert(m, c, endMarker, undefined, {
|
|
2145
2164
|
host: () => treeMarker.parentNode
|
|
2146
2165
|
});
|
|
@@ -2226,4 +2245,4 @@ _moduleUrl) {
|
|
|
2226
2245
|
function httpStatus(_code, _text) {}
|
|
2227
2246
|
function httpHeader(_name, _value, _options) {}
|
|
2228
2247
|
|
|
2229
|
-
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 };
|
|
2248
|
+
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, installHostTagging, 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, setTrustedTypesPolicy, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, strictHandler, style, takeHydrationValue, template, trustedHTML, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OBSERVE, DEV, getOwner, onCleanup, createMemo, runWithOwner, untrack, createRenderEffect, onHydrationEnd, createSignal, createOwner } from 'solid-js';
|
|
2
|
-
import { installServerComponentHydration, insert } from '@solidjs/web';
|
|
2
|
+
import { installServerComponentHydration, insert, trustedHTML } from '@solidjs/web';
|
|
3
3
|
import { frameAddress, SINGLE_FLIGHT_HEADER, LIVE_WIRE, deserializeStream, getServerFunctionsCodec, createChunk, deliverFlightData, ERROR_HEADER, hasFlightMetadata, ChunkReader, configureServerFunctionsClient } from '@solidjs/web/server-functions/client';
|
|
4
4
|
import { setSignalIdentities, sharedConfig, createLoadingBoundary, setWriteHook, setReadWatch, signalName, storeName } from 'solid-js/internal';
|
|
5
5
|
|
|
@@ -900,9 +900,13 @@ function removeUntil(parent, n, stop) {
|
|
|
900
900
|
n = next;
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
|
+
let trusted;
|
|
904
|
+
function setTrustedHTML(wrap) {
|
|
905
|
+
trusted = wrap;
|
|
906
|
+
}
|
|
903
907
|
function parseFragment(html) {
|
|
904
908
|
const template = document.createElement("template");
|
|
905
|
-
template.innerHTML = html;
|
|
909
|
+
template.innerHTML = trusted ? trusted(html) : html;
|
|
906
910
|
return template.content;
|
|
907
911
|
}
|
|
908
912
|
function isPlaceholderStart(node, id) {
|
|
@@ -1382,6 +1386,7 @@ function createServerComponentHandler({
|
|
|
1382
1386
|
}
|
|
1383
1387
|
}
|
|
1384
1388
|
|
|
1389
|
+
setTrustedHTML(trustedHTML);
|
|
1385
1390
|
const TRACE_STATE = Symbol.for("solid.container-trace-state");
|
|
1386
1391
|
tierLoaders.trace = () => import('@solidjs/web/frames/trace');
|
|
1387
1392
|
tierLoaders.regions = () => import('@solidjs/web/frames/regions');
|
package/frames/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOwner, onCleanup, createMemo, runWithOwner, untrack, createRenderEffect, onHydrationEnd, createSignal, createOwner } from 'solid-js';
|
|
2
|
-
import { installServerComponentHydration, insert } from '@solidjs/web';
|
|
2
|
+
import { installServerComponentHydration, insert, trustedHTML } from '@solidjs/web';
|
|
3
3
|
import { LIVE_WIRE, ChunkReader, frameAddress, SINGLE_FLIGHT_HEADER, deserializeStream, getServerFunctionsCodec, createChunk, deliverFlightData, ERROR_HEADER, hasFlightMetadata, configureServerFunctionsClient } from '@solidjs/web/server-functions/client';
|
|
4
4
|
import { setSignalIdentities, sharedConfig, createLoadingBoundary, setWriteHook, signalName, storeName } from 'solid-js/internal';
|
|
5
5
|
|
|
@@ -885,9 +885,13 @@ function removeUntil(parent, n, stop) {
|
|
|
885
885
|
n = next;
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
|
+
let trusted;
|
|
889
|
+
function setTrustedHTML(wrap) {
|
|
890
|
+
trusted = wrap;
|
|
891
|
+
}
|
|
888
892
|
function parseFragment(html) {
|
|
889
893
|
const template = document.createElement("template");
|
|
890
|
-
template.innerHTML = html;
|
|
894
|
+
template.innerHTML = trusted ? trusted(html) : html;
|
|
891
895
|
return template.content;
|
|
892
896
|
}
|
|
893
897
|
function isPlaceholderStart(node, id) {
|
|
@@ -1255,6 +1259,7 @@ function createServerComponentHandler({
|
|
|
1255
1259
|
}
|
|
1256
1260
|
}
|
|
1257
1261
|
|
|
1262
|
+
setTrustedHTML(trustedHTML);
|
|
1258
1263
|
const TRACE_STATE = Symbol.for("solid.container-trace-state");
|
|
1259
1264
|
tierLoaders.trace = () => import('@solidjs/web/frames/trace');
|
|
1260
1265
|
tierLoaders.regions = () => import('@solidjs/web/frames/regions');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as core from 'solid-js';
|
|
2
2
|
import { OBSERVE, getOwner, onCleanup, createMemo, runWithOwner, untrack, createRenderEffect, onHydrationEnd, createSignal, createOwner } from 'solid-js';
|
|
3
|
-
import { installServerComponentHydration, insert } from '@solidjs/web';
|
|
3
|
+
import { installServerComponentHydration, insert, trustedHTML } from '@solidjs/web';
|
|
4
4
|
import { frameAddress, SINGLE_FLIGHT_HEADER, LIVE_WIRE, deserializeStream, getServerFunctionsCodec, createChunk, deliverFlightData, ERROR_HEADER, hasFlightMetadata, ChunkReader, configureServerFunctionsClient } from '@solidjs/web/server-functions/client';
|
|
5
5
|
|
|
6
6
|
const ELEMENT_NODE = 1;
|
|
@@ -890,9 +890,13 @@ function removeUntil(parent, n, stop) {
|
|
|
890
890
|
n = next;
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
+
let trusted;
|
|
894
|
+
function setTrustedHTML(wrap) {
|
|
895
|
+
trusted = wrap;
|
|
896
|
+
}
|
|
893
897
|
function parseFragment(html) {
|
|
894
898
|
const template = document.createElement("template");
|
|
895
|
-
template.innerHTML = html;
|
|
899
|
+
template.innerHTML = trusted ? trusted(html) : html;
|
|
896
900
|
return template.content;
|
|
897
901
|
}
|
|
898
902
|
function isPlaceholderStart(node, id) {
|
|
@@ -1365,6 +1369,7 @@ const storeName = core.storeName;
|
|
|
1365
1369
|
const createLoadingBoundary = core.createLoadingBoundary;
|
|
1366
1370
|
const sharedConfig = core.sharedConfig;
|
|
1367
1371
|
|
|
1372
|
+
setTrustedHTML(trustedHTML);
|
|
1368
1373
|
const TRACE_STATE = Symbol.for("solid.container-trace-state");
|
|
1369
1374
|
tierLoaders.trace = () => import('@solidjs/web/frames/trace');
|
|
1370
1375
|
tierLoaders.regions = () => import('@solidjs/web/frames/regions');
|