@solidjs/web 2.0.0-rc.20 → 2.0.0-rc.22
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 +521 -280
- package/dist/server.js +518 -279
- package/dist/server.observe.js +518 -279
- package/dist/web.dev.js +142 -106
- package/dist/web.js +120 -105
- package/dist/web.observe.js +120 -105
- 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 +124 -68
- package/frames/dist/server.js +124 -68
- package/frames/dist/server.observe.js +124 -68
- package/frames/dist/wire.js +1 -1
- package/package.json +2 -2
- package/serialization/dist/serialization.js +53 -12
- package/serialization/types/index.d.ts +42 -0
- package/serialization/types/serializer.d.ts +42 -0
- package/server-functions/dist/client.dev.js +5 -3
- package/server-functions/dist/client.js +5 -3
- package/server-functions/dist/client.observe.js +5 -3
- package/server-functions/dist/rich-args.js +27 -9
- package/server-functions/dist/server.dev.js +122 -36
- package/server-functions/dist/server.js +122 -36
- package/server-functions/dist/server.observe.js +122 -36
- package/types/client.d.ts +54 -3
- package/types/constants.d.ts +2 -1
- package/types/frames/frame-client.d.ts +2 -0
- package/types/frames/serializer.d.ts +42 -0
- package/types/frames/tree-rewrite.d.ts +7 -0
- package/types/serializer.d.ts +42 -0
- package/types/server-functions/client.d.ts +0 -1
- package/types/server-functions/server.d.ts +0 -1
- package/types/server-functions/shared.d.ts +3 -2
- package/types/server-functions/uploads.d.ts +3 -0
- package/types/server-mock.d.ts +35 -8
- package/types/server.d.ts +89 -18
package/dist/web.observe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, OBSERVE, enableHydration, $PROXY, untrack,
|
|
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,
|
|
1
|
+
import { createRenderEffect, createMemo, OBSERVE, enableHydration, $PROXY, untrack, runRefCallback, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, runWithOwner, heldRead, setSwapHook, isHidden, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, heldRead, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
+
import { sharedConfig, enableServerComponentHydration, hasStaticKeys, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PROXY, SOURCE_PLAIN, sourceKeys, resolvedTable, dynamicCore } from 'solid-js/internal';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
@@ -32,6 +32,7 @@ const DOMWithState = {
|
|
|
32
32
|
};
|
|
33
33
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
34
34
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
35
|
+
const $$INDEX = /*#__PURE__*/Symbol("index");
|
|
35
36
|
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
36
37
|
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
38
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -82,32 +83,36 @@ function memo(fn) {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
function reconcileArrays(parentNode, a, b, marker) {
|
|
85
|
-
let
|
|
86
|
-
|
|
86
|
+
let bLength = b.length,
|
|
87
|
+
aEnd = a.length,
|
|
88
|
+
bEnd = bLength,
|
|
89
|
+
aStart = 0,
|
|
90
|
+
bStart = 0,
|
|
91
|
+
stamped,
|
|
92
|
+
after,
|
|
93
|
+
index,
|
|
94
|
+
anchor;
|
|
95
|
+
while (aStart < aEnd && a[aStart] === b[bStart]) {
|
|
96
|
+
aStart++;
|
|
97
|
+
bStart++;
|
|
98
|
+
}
|
|
99
|
+
if (aStart === aEnd && bStart === bEnd) return;
|
|
100
|
+
const mv = parentNode.moveBefore && parentNode.isConnected;
|
|
87
101
|
const slot = marker || parentNode;
|
|
88
102
|
const insert = (n, ref) => {
|
|
89
|
-
|
|
103
|
+
mv && n.isConnected ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
|
|
90
104
|
if (marker || n[$$SLOT]) n[$$SLOT] = slot;
|
|
91
105
|
};
|
|
92
|
-
if (!
|
|
106
|
+
if (!aEnd) {
|
|
93
107
|
for (const n of b) insert(n, marker);
|
|
94
108
|
return;
|
|
95
109
|
}
|
|
96
|
-
const isLive = n =>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return
|
|
110
|
+
const isLive = n => n && n.parentNode === parentNode && (!(n = n[$$SLOT]) || n === slot);
|
|
111
|
+
const ref = k => {
|
|
112
|
+
while (k < bLength && !isLive(b[k])) k++;
|
|
113
|
+
return b[k] || (after && after.parentNode !== parentNode ? marker || null : after);
|
|
100
114
|
};
|
|
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;
|
|
115
|
+
after = isLive(anchor = a[aEnd - 1]) ? anchor.nextSibling : marker || null;
|
|
111
116
|
while (aStart < aEnd || bStart < bEnd) {
|
|
112
117
|
if (a[aStart] === b[bStart]) {
|
|
113
118
|
aStart++;
|
|
@@ -119,52 +124,43 @@ function reconcileArrays(parentNode, a, b, marker) {
|
|
|
119
124
|
bEnd--;
|
|
120
125
|
}
|
|
121
126
|
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)) {
|
|
127
|
+
anchor = ref(bEnd);
|
|
128
|
+
while (bStart < bEnd) insert(b[bStart++], anchor);
|
|
129
|
+
} else if (!isLive(anchor = a[aStart])) aStart++;
|
|
130
|
+
else if (b[bStart] === a[aEnd - 1] && (
|
|
131
|
+
anchor === b[bEnd - 1] ||
|
|
132
|
+
!stamped && anchor === b[bStart + 1] && a[aStart + 1] === b[bStart + 2])) {
|
|
132
133
|
do {
|
|
133
134
|
insert(a[--aEnd], anchor);
|
|
134
135
|
bStart++;
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
} while (aStart < aEnd - 1 && bStart < bEnd && anchor === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
|
|
137
|
+
} else if (bStart < bEnd && anchor === b[bEnd - 1] && a[aStart + 1] !== b[bEnd - 2] && isLive(b[bStart]) && isLive(a[aEnd - 1])) {
|
|
138
|
+
insert(anchor, ref(bEnd));
|
|
139
|
+
aStart++;
|
|
140
|
+
bEnd--;
|
|
137
141
|
} else {
|
|
138
|
-
if (!
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
if (!stamped) {
|
|
143
|
+
stamped = 1;
|
|
144
|
+
for (index = bStart; index < bEnd;) b[index][$$INDEX] = index++;
|
|
141
145
|
}
|
|
142
|
-
if (
|
|
143
|
-
map = new Map();
|
|
144
|
-
let i = bStart;
|
|
145
|
-
while (i < bEnd) map.set(b[i], i++);
|
|
146
|
-
}
|
|
147
|
-
const index = map.get(a[aStart]);
|
|
148
|
-
if (index != null) {
|
|
146
|
+
if ((index = anchor[$$INDEX]) >= 0 && b[index] === anchor) {
|
|
149
147
|
if (bStart < index && index < bEnd) {
|
|
150
148
|
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
|
-
}
|
|
149
|
+
sequence = 1;
|
|
150
|
+
while (++i < aEnd && i < bEnd && a[i] === b[index + sequence]) sequence++;
|
|
157
151
|
if (sequence > index - bStart) {
|
|
158
|
-
|
|
159
|
-
while (bStart < index) insert(b[bStart++], node);
|
|
152
|
+
while (bStart < index) insert(b[bStart++], anchor);
|
|
160
153
|
} else {
|
|
161
|
-
const newNode = b[bStart++]
|
|
162
|
-
|
|
163
|
-
|
|
154
|
+
const newNode = b[bStart++];
|
|
155
|
+
aStart++;
|
|
156
|
+
mv ? insert(newNode, anchor) : parentNode.replaceChild(newNode, anchor);
|
|
164
157
|
if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
|
|
165
158
|
}
|
|
166
159
|
} else aStart++;
|
|
167
|
-
} else
|
|
160
|
+
} else {
|
|
161
|
+
anchor.remove();
|
|
162
|
+
aStart++;
|
|
163
|
+
}
|
|
168
164
|
}
|
|
169
165
|
}
|
|
170
166
|
}
|
|
@@ -401,16 +397,11 @@ function render(code, element, init, options = {}) {
|
|
|
401
397
|
createRoot(dispose => {
|
|
402
398
|
disposer = dispose;
|
|
403
399
|
if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
410
|
-
...options.insertOptions,
|
|
411
|
-
schedule: true
|
|
412
|
-
});
|
|
413
|
-
}
|
|
400
|
+
const tree = code();
|
|
401
|
+
if (element === document) effect(() => flatten(tree), () => {});else insert(element, () => tree, element.firstChild ? null : undefined, init, {
|
|
402
|
+
...options.insertOptions,
|
|
403
|
+
schedule: true
|
|
404
|
+
});
|
|
414
405
|
}, {
|
|
415
406
|
id: options.renderId
|
|
416
407
|
});
|
|
@@ -427,10 +418,18 @@ function render(code, element, init, options = {}) {
|
|
|
427
418
|
element.textContent = "";
|
|
428
419
|
};
|
|
429
420
|
}
|
|
421
|
+
let policy;
|
|
422
|
+
function setTrustedTypesPolicy(value) {
|
|
423
|
+
policy = value;
|
|
424
|
+
}
|
|
425
|
+
function trustedHTML(html) {
|
|
426
|
+
return policy ? policy.createHTML(html) : html;
|
|
427
|
+
}
|
|
430
428
|
function create(html, bypassGuard, flag) {
|
|
431
429
|
const t = document.createElement("template");
|
|
432
|
-
t.innerHTML = html;
|
|
433
|
-
|
|
430
|
+
t.innerHTML = policy ? policy.createHTML(html) : html;
|
|
431
|
+
const node = t.content.firstChild;
|
|
432
|
+
return flag === 2 ? node.firstChild : node;
|
|
434
433
|
}
|
|
435
434
|
function template(html, flag) {
|
|
436
435
|
let node;
|
|
@@ -438,8 +437,7 @@ function template(html, flag) {
|
|
|
438
437
|
return fn;
|
|
439
438
|
}
|
|
440
439
|
function delegateEvents(eventNames) {
|
|
441
|
-
for (
|
|
442
|
-
const name = eventNames[i];
|
|
440
|
+
for (const name of eventNames) {
|
|
443
441
|
if (!delegatedEvents.has(name)) {
|
|
444
442
|
delegatedEvents.add(name);
|
|
445
443
|
delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
|
|
@@ -507,9 +505,10 @@ function dispatchAsInteraction(e, fn) {
|
|
|
507
505
|
function getDelegatedRoot(node) {
|
|
508
506
|
while (node) {
|
|
509
507
|
if (delegatedContainers.get(node)?.roots) return node;
|
|
510
|
-
node = node
|
|
508
|
+
node = parentOf(node);
|
|
511
509
|
}
|
|
512
510
|
}
|
|
511
|
+
const parentOf = node => node._$host || node.parentNode || node.host;
|
|
513
512
|
function findOwner(target, state) {
|
|
514
513
|
let node = target;
|
|
515
514
|
let distance = 0;
|
|
@@ -519,7 +518,7 @@ function findOwner(target, state) {
|
|
|
519
518
|
distance
|
|
520
519
|
};
|
|
521
520
|
distance++;
|
|
522
|
-
node = node
|
|
521
|
+
node = parentOf(node);
|
|
523
522
|
}
|
|
524
523
|
}
|
|
525
524
|
function setProperty(node, name, value) {
|
|
@@ -533,6 +532,9 @@ function setProperty(node, name, value) {
|
|
|
533
532
|
function setStatefulProperty(node, name, value) {
|
|
534
533
|
node[name] = value;
|
|
535
534
|
}
|
|
535
|
+
function strictHandler(fn) {
|
|
536
|
+
return fn();
|
|
537
|
+
}
|
|
536
538
|
let claimHandlers = null;
|
|
537
539
|
const claimAttributeSets = [];
|
|
538
540
|
const CLAIM_SEAM = Symbol.for("solid.element-claims");
|
|
@@ -612,7 +614,7 @@ function className(node, value, prev) {
|
|
|
612
614
|
return;
|
|
613
615
|
}
|
|
614
616
|
if (typeof value === "string") {
|
|
615
|
-
node._$classes = undefined;
|
|
617
|
+
if (node._$classes) node._$classes = undefined;
|
|
616
618
|
value !== prev && node.setAttribute("class", value);
|
|
617
619
|
return;
|
|
618
620
|
}
|
|
@@ -733,14 +735,22 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
733
735
|
}
|
|
734
736
|
const prevProps = {};
|
|
735
737
|
const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
|
|
738
|
+
let held = 0;
|
|
736
739
|
const apply = newProps => {
|
|
737
740
|
const r = newProps.ref;
|
|
738
741
|
if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
|
|
742
|
+
spreadHeld = held;
|
|
739
743
|
assign(node, newProps, true, prevProps, true);
|
|
744
|
+
spreadHeld = 0;
|
|
740
745
|
if (owner !== undefined) claimElement(node, owner);
|
|
741
746
|
};
|
|
747
|
+
const read = fn => () => {
|
|
748
|
+
const p = fn();
|
|
749
|
+
held = heldRead();
|
|
750
|
+
return p;
|
|
751
|
+
};
|
|
742
752
|
if (Array.isArray(props)) {
|
|
743
|
-
effect(() => collectSources({}, props, undefined, skip), apply);
|
|
753
|
+
effect(read(() => collectSources({}, props, undefined, skip)), apply);
|
|
744
754
|
if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
|
|
745
755
|
for (let i = props.length - 1; i >= 0; i--) {
|
|
746
756
|
const s = resolveSource(props[i]);
|
|
@@ -749,7 +759,7 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
749
759
|
});
|
|
750
760
|
return prevProps;
|
|
751
761
|
}
|
|
752
|
-
|
|
762
|
+
const collect = () => {
|
|
753
763
|
const source = resolveSource(props);
|
|
754
764
|
const newProps = {};
|
|
755
765
|
const table = resolvedTable(source);
|
|
@@ -759,7 +769,8 @@ function spread(node, props, skipChildren, skip, name, loc) {
|
|
|
759
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);
|
|
760
770
|
}
|
|
761
771
|
return newProps;
|
|
762
|
-
}
|
|
772
|
+
};
|
|
773
|
+
effect(read(collect), apply);
|
|
763
774
|
if (!skipChildren && !(skip !== undefined && skip("children"))) {
|
|
764
775
|
if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
|
|
765
776
|
const desc = Object.getOwnPropertyDescriptor(props, "children");
|
|
@@ -847,7 +858,7 @@ function applyRef(r, element) {
|
|
|
847
858
|
}
|
|
848
859
|
function ref(fn, element) {
|
|
849
860
|
const resolved = untrack(fn);
|
|
850
|
-
|
|
861
|
+
runRefCallback(() => applyRef(resolved, element));
|
|
851
862
|
}
|
|
852
863
|
function scope(fn) {
|
|
853
864
|
fn.$s = true;
|
|
@@ -858,6 +869,10 @@ const SCOPE_OPTIONS = {
|
|
|
858
869
|
};
|
|
859
870
|
let hydrationRt = null;
|
|
860
871
|
let selectInsert = null;
|
|
872
|
+
let hostRt = null;
|
|
873
|
+
function installHostTagging() {
|
|
874
|
+
hostRt = tagHost;
|
|
875
|
+
}
|
|
861
876
|
function installHydrationRuntime() {
|
|
862
877
|
hydrationRt = {
|
|
863
878
|
claimInitial(parent, multi, initial) {
|
|
@@ -868,8 +883,7 @@ function installHydrationRuntime() {
|
|
|
868
883
|
},
|
|
869
884
|
reclaimRegion(current, parent, marker) {
|
|
870
885
|
if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
|
|
871
|
-
|
|
872
|
-
if (first == null || first.isConnected) return current;
|
|
886
|
+
if (Array.isArray(current) ? current.every(n => !n || n.isConnected) : current.isConnected) return current;
|
|
873
887
|
let nodes;
|
|
874
888
|
if (marker) {
|
|
875
889
|
nodes = [];
|
|
@@ -943,7 +957,7 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
943
957
|
accessor = normalize(accessor, initial, multi, true);
|
|
944
958
|
if (typeof accessor !== "function") {
|
|
945
959
|
insertExpression(parent, accessor, initial, marker);
|
|
946
|
-
host &&
|
|
960
|
+
hostRt !== null && host && hostRt(accessor, host);
|
|
947
961
|
return;
|
|
948
962
|
}
|
|
949
963
|
}
|
|
@@ -966,13 +980,13 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
966
980
|
} : options;
|
|
967
981
|
effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
|
|
968
982
|
current = insertExpression(parent, inner, current, marker);
|
|
969
|
-
host &&
|
|
983
|
+
hostRt !== null && host && hostRt(current, host);
|
|
970
984
|
}, innerOptions);
|
|
971
985
|
return INNER_OWNED;
|
|
972
986
|
}, value => {
|
|
973
987
|
if (value === INNER_OWNED) return;
|
|
974
988
|
current = insertExpression(parent, value, current, marker);
|
|
975
|
-
host &&
|
|
989
|
+
hostRt !== null && host && hostRt(current, host);
|
|
976
990
|
},
|
|
977
991
|
accessor.$s ? options ? {
|
|
978
992
|
...options,
|
|
@@ -1055,7 +1069,7 @@ function trackAssetLoad(entry, adopted) {
|
|
|
1055
1069
|
}
|
|
1056
1070
|
entry.loadState = "pending";
|
|
1057
1071
|
entry.loadPromise = new Promise(resolve => {
|
|
1058
|
-
const settle = state => {
|
|
1072
|
+
const settle = entry.settle = state => {
|
|
1059
1073
|
entry.loadState = state;
|
|
1060
1074
|
resolve();
|
|
1061
1075
|
};
|
|
@@ -1167,6 +1181,7 @@ function acquireAsset(descriptor) {
|
|
|
1167
1181
|
entry.timer = setTimeout(() => {
|
|
1168
1182
|
assetRegistry.delete(key);
|
|
1169
1183
|
entry.element && entry.element.remove();
|
|
1184
|
+
if (entry.loadState === "pending") entry.settle("errored");
|
|
1170
1185
|
}, ASSET_REMOVAL_GRACE);
|
|
1171
1186
|
};
|
|
1172
1187
|
}
|
|
@@ -1183,6 +1198,7 @@ function initHeadRegistry() {
|
|
|
1183
1198
|
headRegistrations = [];
|
|
1184
1199
|
headOwned = new Map();
|
|
1185
1200
|
headApplied = new Map();
|
|
1201
|
+
setSwapHook(scheduleHeadApply);
|
|
1186
1202
|
const t = document.querySelector("title");
|
|
1187
1203
|
headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
|
|
1188
1204
|
if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
|
|
@@ -1233,7 +1249,7 @@ function flushHeadRegistry() {
|
|
|
1233
1249
|
return;
|
|
1234
1250
|
}
|
|
1235
1251
|
headScheduled = false;
|
|
1236
|
-
const winners = resolveHead(headRegistrations);
|
|
1252
|
+
const winners = resolveHead(headRegistrations.filter(r => !isHidden(r.node)));
|
|
1237
1253
|
for (const [identity, els] of headOwned) {
|
|
1238
1254
|
if (winners.has(identity)) continue;
|
|
1239
1255
|
headOwned.delete(identity);
|
|
@@ -1345,10 +1361,12 @@ function useHead(tags) {
|
|
|
1345
1361
|
initHeadRegistry();
|
|
1346
1362
|
const reg = {
|
|
1347
1363
|
seq: -1,
|
|
1348
|
-
tags: null
|
|
1364
|
+
tags: null,
|
|
1365
|
+
node: null
|
|
1349
1366
|
};
|
|
1350
1367
|
const uid = ++headUid;
|
|
1351
1368
|
effect(() => {
|
|
1369
|
+
reg.node = getOwner();
|
|
1352
1370
|
let list = typeof tags === "function" ? tags() : tags;
|
|
1353
1371
|
if (!Array.isArray(list)) list = [list];
|
|
1354
1372
|
const replaceable = [];
|
|
@@ -1670,10 +1688,11 @@ function flattenClassList(list, result) {
|
|
|
1670
1688
|
else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
|
|
1671
1689
|
}
|
|
1672
1690
|
}
|
|
1691
|
+
let spreadHeld = 0;
|
|
1673
1692
|
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
1674
1693
|
if (prop === "style") return style(node, value, prev), value;
|
|
1675
1694
|
if (prop === "class") return className(node, value, prev), value;
|
|
1676
|
-
if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
|
|
1695
|
+
if (value === prev && (spreadHeld || DOMWithState[nodeName]?.[prop] !== 1)) return prev;
|
|
1677
1696
|
if (prop === "ref") {
|
|
1678
1697
|
if (!skipRef && value) ref(() => value, node);
|
|
1679
1698
|
return value;
|
|
@@ -1718,39 +1737,32 @@ function eventHandler(e, container, state) {
|
|
|
1718
1737
|
e[$$EVENT_OWNER] = owner;
|
|
1719
1738
|
let node = resumeNode || e.target;
|
|
1720
1739
|
const key = EVENT_KEY + e.type;
|
|
1721
|
-
const
|
|
1740
|
+
const define = (name, value) => Object.defineProperty(e, name, {
|
|
1722
1741
|
configurable: true,
|
|
1723
1742
|
value
|
|
1724
1743
|
});
|
|
1725
1744
|
const handleNode = () => {
|
|
1726
1745
|
const handler = node[key];
|
|
1727
1746
|
if (handler && !node.disabled) {
|
|
1747
|
+
define("currentTarget", node);
|
|
1728
1748
|
const data = node[`${key}Data`];
|
|
1729
1749
|
data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
|
|
1730
1750
|
if (e.cancelBubble) return;
|
|
1731
1751
|
}
|
|
1732
|
-
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) &&
|
|
1752
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && define("target", node.host);
|
|
1733
1753
|
return true;
|
|
1734
1754
|
};
|
|
1755
|
+
const atOwner = () => node === owner || node.parentNode === owner;
|
|
1735
1756
|
const walkUpTree = () => {
|
|
1736
|
-
while (node && handleNode())
|
|
1737
|
-
if (node === owner || node.parentNode === owner) break;
|
|
1738
|
-
node = node._$host || node.parentNode || node.host;
|
|
1739
|
-
}
|
|
1757
|
+
while (node && handleNode() && !atOwner()) node = parentOf(node);
|
|
1740
1758
|
};
|
|
1741
|
-
Object.defineProperty(e, "currentTarget", {
|
|
1742
|
-
configurable: true,
|
|
1743
|
-
get() {
|
|
1744
|
-
return node || owner;
|
|
1745
|
-
}
|
|
1746
|
-
});
|
|
1747
1759
|
if (resumeNode) {
|
|
1748
|
-
if (resumeNode === e.target) node = resumeNode
|
|
1760
|
+
if (resumeNode === e.target) node = parentOf(resumeNode);
|
|
1749
1761
|
if (node && node !== owner) walkUpTree();
|
|
1750
1762
|
} else if (e.composedPath) {
|
|
1751
1763
|
const path = e.composedPath();
|
|
1752
1764
|
if (path.length) {
|
|
1753
|
-
|
|
1765
|
+
define("target", path[0]);
|
|
1754
1766
|
for (let i = 0; i < path.length; i++) {
|
|
1755
1767
|
node = path[i];
|
|
1756
1768
|
if (!handleNode()) break;
|
|
@@ -1759,9 +1771,7 @@ function eventHandler(e, container, state) {
|
|
|
1759
1771
|
walkUpTree();
|
|
1760
1772
|
break;
|
|
1761
1773
|
}
|
|
1762
|
-
if (
|
|
1763
|
-
break;
|
|
1764
|
-
}
|
|
1774
|
+
if (atOwner()) break;
|
|
1765
1775
|
}
|
|
1766
1776
|
} else walkUpTree();
|
|
1767
1777
|
}
|
|
@@ -1821,7 +1831,8 @@ function insertExpression(parent, value, current, marker) {
|
|
|
1821
1831
|
if (t === "string" || t === "number") {
|
|
1822
1832
|
const prev = currentArray ? current[i] : undefined;
|
|
1823
1833
|
if (prev && prev.nodeType === 3) {
|
|
1824
|
-
|
|
1834
|
+
const last = prev._$d;
|
|
1835
|
+
if (last !== item && (last !== undefined || prev.data !== "" + item)) prev.data = prev._$d = item;
|
|
1825
1836
|
value[i] = prev;
|
|
1826
1837
|
} else value[i] = document.createTextNode(item);
|
|
1827
1838
|
}
|
|
@@ -1881,13 +1892,16 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
1881
1892
|
}
|
|
1882
1893
|
return value;
|
|
1883
1894
|
}
|
|
1895
|
+
function hostGetter() {
|
|
1896
|
+
return this[$$HOST]();
|
|
1897
|
+
}
|
|
1884
1898
|
function tagHost(value, host) {
|
|
1885
1899
|
if (Array.isArray(value)) {
|
|
1886
1900
|
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
1887
1901
|
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
1888
1902
|
value[$$HOST] = host;
|
|
1889
1903
|
Object.defineProperty(value, "_$host", {
|
|
1890
|
-
get:
|
|
1904
|
+
get: hostGetter,
|
|
1891
1905
|
configurable: true
|
|
1892
1906
|
});
|
|
1893
1907
|
}
|
|
@@ -2148,6 +2162,7 @@ function portalImpl(props) {
|
|
|
2148
2162
|
const m = untrack(mount);
|
|
2149
2163
|
m.appendChild(endMarker);
|
|
2150
2164
|
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
2165
|
+
installHostTagging();
|
|
2151
2166
|
insert(m, c, endMarker, undefined, {
|
|
2152
2167
|
host: () => treeMarker.parentNode
|
|
2153
2168
|
});
|
|
@@ -2233,4 +2248,4 @@ _moduleUrl) {
|
|
|
2233
2248
|
function httpStatus(_code, _text) {}
|
|
2234
2249
|
function httpHeader(_name, _value, _options) {}
|
|
2235
2250
|
|
|
2236
|
-
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 };
|
|
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, 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');
|