@solidjs/web 2.0.0-rc.10 → 2.0.0-rc.13
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 +533 -106
- package/dist/server.js +437 -79
- package/dist/server.observe.js +449 -79
- package/dist/web.dev.js +35 -9
- package/dist/web.js +35 -9
- package/dist/web.observe.js +35 -9
- package/frames/dist/client.dev.js +362 -107
- package/frames/dist/client.js +317 -104
- package/frames/dist/client.observe.js +318 -103
- package/frames/dist/server.dev.js +288 -55
- package/frames/dist/server.js +235 -55
- package/frames/dist/server.observe.js +235 -55
- package/package.json +4 -3
- package/server-functions/dist/client.dev.js +79 -11
- package/server-functions/dist/client.observe.js +79 -11
- package/server-functions/dist/server.dev.js +30 -6
- package/server-functions/dist/server.js +30 -6
- package/server-functions/dist/server.observe.js +30 -6
- package/skills/server-components/SKILL.md +206 -0
- package/types/client.d.ts +17 -2
- package/types/frames/client.d.ts +1 -1
- package/types/frames/frame-client.d.ts +0 -18
- package/types/frames/frame-container-plugin.d.ts +0 -8
- package/types/frames/server.d.ts +28 -0
- package/types/frames/tree-rewrite.d.ts +39 -0
- package/types/index.server.d.ts +1 -1
- package/types/jsx.d.ts +11 -1
- package/types/observe.d.ts +178 -10
- package/types/request-error-hook.d.ts +5 -0
- package/types/server-observe.d.ts +8 -0
- package/types/server.d.ts +95 -8
package/frames/dist/server.js
CHANGED
|
@@ -1,10 +1,100 @@
|
|
|
1
|
-
import { ssrSanitizeError, creationStamp, ssrHandleError, runInServerComponentScope, shareAsyncIterable, getProjectionTrace } from 'solid-js/internal';
|
|
2
|
-
import {
|
|
3
|
-
import { isResponseEnvelope, renderToStream, createLiveHoles, CLAIMS_STREAM, CLAIMS_DOCUMENT,
|
|
1
|
+
import { sharedConfig, ssrSanitizeError, creationStamp, ssrHandleError, runInServerComponentScope, shareAsyncIterable, getProjectionTrace } from 'solid-js/internal';
|
|
2
|
+
import { NoHydration, getOwner, runWithOwner, createMemo, Hydration, createOwner } from 'solid-js';
|
|
3
|
+
import { isResponseEnvelope, renderToStream, createLiveHoles, CLAIMS_STREAM, CLAIMS_DOCUMENT, SLOT_FACE_DATA, slotValue, SLOT_FACE_STREAM, SLOT_FACE_MARKUP, isSlotValue } from '@solidjs/web';
|
|
4
4
|
import { Feature, createStream, toCrossJSONStream } from 'seroval';
|
|
5
5
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
6
6
|
import { textDigest, frameAddress, getEventServerFunctionInvocation, armLiveBody, createEventChunk, createChunk, ChunkReader, serializeStream, guardFailures } from '@solidjs/web/server-functions/server';
|
|
7
7
|
|
|
8
|
+
const DESCEND = Symbol("descend");
|
|
9
|
+
const CYCLE = {};
|
|
10
|
+
const TRACK = 16;
|
|
11
|
+
function rewriteTree(value, visit, withPath) {
|
|
12
|
+
if (value === null || typeof value !== "object") return value;
|
|
13
|
+
const path = withPath ? "" : undefined;
|
|
14
|
+
const state = {
|
|
15
|
+
memo: undefined,
|
|
16
|
+
ancestors: undefined
|
|
17
|
+
};
|
|
18
|
+
try {
|
|
19
|
+
return cow(value, visit, path, 0, state);
|
|
20
|
+
} catch (err) {
|
|
21
|
+
if (err !== CYCLE) throw err;
|
|
22
|
+
}
|
|
23
|
+
return clone(value, visit, path, state.memo || (state.memo = new Map()));
|
|
24
|
+
}
|
|
25
|
+
function shape(value) {
|
|
26
|
+
return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
|
|
27
|
+
}
|
|
28
|
+
function cow(value, visit, path, depth, state) {
|
|
29
|
+
const memo = state.memo;
|
|
30
|
+
if (memo !== undefined && memo.has(value)) return memo.get(value);
|
|
31
|
+
const r = visit(value, path);
|
|
32
|
+
if (r !== DESCEND) {
|
|
33
|
+
if (r !== value) (memo || (state.memo = new Map())).set(value, r);
|
|
34
|
+
return r;
|
|
35
|
+
}
|
|
36
|
+
const s = shape(value);
|
|
37
|
+
if (s === 0) return value;
|
|
38
|
+
let ancestors;
|
|
39
|
+
if (depth >= TRACK) {
|
|
40
|
+
ancestors = state.ancestors || (state.ancestors = new Set());
|
|
41
|
+
if (ancestors.has(value)) throw CYCLE;
|
|
42
|
+
ancestors.add(value);
|
|
43
|
+
}
|
|
44
|
+
let out = value;
|
|
45
|
+
if (s === 1) {
|
|
46
|
+
for (let i = 0; i < value.length; i++) {
|
|
47
|
+
const c = value[i];
|
|
48
|
+
if (c === null || typeof c !== "object") continue;
|
|
49
|
+
const next = cow(c, visit, path === undefined ? undefined : `${path}[${i}]`, depth + 1, state);
|
|
50
|
+
if (next !== c) {
|
|
51
|
+
if (out === value) out = value.slice();
|
|
52
|
+
out[i] = next;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
for (const k of Object.keys(value)) {
|
|
57
|
+
const c = value[k];
|
|
58
|
+
if (c === null || typeof c !== "object") continue;
|
|
59
|
+
const next = cow(c, visit, path === undefined ? undefined : `${path}.${k}`, depth + 1, state);
|
|
60
|
+
if (next !== c) {
|
|
61
|
+
if (out === value) out = {
|
|
62
|
+
...value
|
|
63
|
+
};
|
|
64
|
+
out[k] = next;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (ancestors !== undefined) ancestors.delete(value);
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
function clone(value, visit, path, memo) {
|
|
72
|
+
if (memo.has(value)) return memo.get(value);
|
|
73
|
+
const r = visit(value, path);
|
|
74
|
+
if (r !== DESCEND) {
|
|
75
|
+
memo.set(value, r);
|
|
76
|
+
return r;
|
|
77
|
+
}
|
|
78
|
+
const s = shape(value);
|
|
79
|
+
if (s === 0) return value;
|
|
80
|
+
const out = s === 1 ? value.slice() : {
|
|
81
|
+
...value
|
|
82
|
+
};
|
|
83
|
+
memo.set(value, out);
|
|
84
|
+
if (s === 1) {
|
|
85
|
+
for (let i = 0; i < value.length; i++) {
|
|
86
|
+
const c = value[i];
|
|
87
|
+
if (c !== null && typeof c === "object") out[i] = clone(c, visit, path === undefined ? undefined : `${path}[${i}]`, memo);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
for (const k of Object.keys(value)) {
|
|
91
|
+
const c = value[k];
|
|
92
|
+
if (c !== null && typeof c === "object") out[k] = clone(c, visit, path === undefined ? undefined : `${path}.${k}`, memo);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
|
|
8
98
|
const STATE = Symbol.for("solid.container-trace-state");
|
|
9
99
|
const state = globalThis[STATE] || (globalThis[STATE] = {
|
|
10
100
|
materialized: new WeakMap(),
|
|
@@ -29,38 +119,16 @@ function toBorderForm(value, envelopeContainers) {
|
|
|
29
119
|
const resolve = state.resolveTrace ;
|
|
30
120
|
const share = state.shareIterable;
|
|
31
121
|
if (!resolve && !share) return value;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (share && isShareableIterable(value)) return share(value);
|
|
39
|
-
if (Array.isArray(value)) {
|
|
40
|
-
let out = value;
|
|
41
|
-
for (let i = 0; i < value.length; i++) {
|
|
42
|
-
const next = toBorderForm(value[i]);
|
|
43
|
-
if (next !== value[i]) {
|
|
44
|
-
if (out === value) out = value.slice();
|
|
45
|
-
out[i] = next;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return out;
|
|
49
|
-
}
|
|
50
|
-
if (Object.getPrototypeOf(value) === Object.prototype) {
|
|
51
|
-
let out = value;
|
|
52
|
-
for (const key of Object.keys(value)) {
|
|
53
|
-
const next = toBorderForm(value[key]);
|
|
54
|
-
if (next !== value[key]) {
|
|
55
|
-
if (out === value) out = {
|
|
56
|
-
...value
|
|
57
|
-
};
|
|
58
|
-
out[key] = next;
|
|
59
|
-
}
|
|
122
|
+
return rewriteTree(value, v => {
|
|
123
|
+
if (resolve) {
|
|
124
|
+
const trace = resolve(v);
|
|
125
|
+
if (trace) return {
|
|
126
|
+
[TRACE]: trace
|
|
127
|
+
};
|
|
60
128
|
}
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
129
|
+
if (share && isShareableIterable(v)) return share(v);
|
|
130
|
+
return DESCEND;
|
|
131
|
+
}, false);
|
|
64
132
|
}
|
|
65
133
|
function isShareableIterable(value) {
|
|
66
134
|
try {
|
|
@@ -817,9 +885,52 @@ function frameStream(makeCode, options) {
|
|
|
817
885
|
function slotRange(occurrence) {
|
|
818
886
|
return {
|
|
819
887
|
t: `<!--slot:${occurrence}:start--><!--slot:${occurrence}:end-->`,
|
|
820
|
-
$slot: true
|
|
888
|
+
$slot: true,
|
|
889
|
+
$occurrence: occurrence
|
|
821
890
|
};
|
|
822
891
|
}
|
|
892
|
+
const RANGE_KEYS = new Set(["t", "h", "p", "then", "length", "slice", "constructor", "toString", "valueOf", "toJSON"]);
|
|
893
|
+
const NODE_KEYS = new Set(["t", "h", "p"]);
|
|
894
|
+
function isRangeKey(key) {
|
|
895
|
+
const c = key.charCodeAt(0);
|
|
896
|
+
return c === 36 || c >= 48 && c <= 57 || RANGE_KEYS.has(key);
|
|
897
|
+
}
|
|
898
|
+
function slotProxy(range, occurrence, face, content, onData) {
|
|
899
|
+
return new Proxy(range, {
|
|
900
|
+
get(target, key, receiver) {
|
|
901
|
+
if (typeof key !== "string" || isRangeKey(key)) return Reflect.get(target, key, receiver);
|
|
902
|
+
if (onData) onData = void onData();
|
|
903
|
+
return slotValue(occurrence, key, content ? content[key] : undefined, face);
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
function argBorderForm(value, key, occurrence) {
|
|
908
|
+
return toBorderForm(withoutStandIns(value));
|
|
909
|
+
}
|
|
910
|
+
function withoutStandIns(value, key, occurrence) {
|
|
911
|
+
return rewriteTree(value, (v, path) => {
|
|
912
|
+
if (isContainerTraced(v)) return v;
|
|
913
|
+
if (Object.getPrototypeOf(v) === Object.prototype && isSlotValue(v)) {
|
|
914
|
+
return undefined;
|
|
915
|
+
}
|
|
916
|
+
return DESCEND;
|
|
917
|
+
}, true);
|
|
918
|
+
}
|
|
919
|
+
function slotFace(range, content) {
|
|
920
|
+
if (content == null) return SLOT_FACE_DATA;
|
|
921
|
+
if (typeof content !== "object" || Array.isArray(content)) return SLOT_FACE_MARKUP;
|
|
922
|
+
if (isServerContent(content)) {
|
|
923
|
+
let data = false;
|
|
924
|
+
for (const key in content) {
|
|
925
|
+
if (!NODE_KEYS.has(key)) {
|
|
926
|
+
data = true;
|
|
927
|
+
break;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
if (!data) return SLOT_FACE_MARKUP;
|
|
931
|
+
}
|
|
932
|
+
return SLOT_FACE_DATA;
|
|
933
|
+
}
|
|
823
934
|
const OCCURRENCE_UNSAFE = /[^A-Za-z0-9_.-]/g;
|
|
824
935
|
function encodeOccurrenceKey(key) {
|
|
825
936
|
return String(key).replace(OCCURRENCE_UNSAFE, c => {
|
|
@@ -828,14 +939,58 @@ function encodeOccurrenceKey(key) {
|
|
|
828
939
|
});
|
|
829
940
|
}
|
|
830
941
|
function occurrenceId(prop, raw, counts) {
|
|
831
|
-
const
|
|
832
|
-
if (
|
|
833
|
-
return `${prop}#${encodeOccurrenceKey(k)}`;
|
|
834
|
-
}
|
|
942
|
+
const keyed = keyedId(prop, raw);
|
|
943
|
+
if (keyed !== undefined) return keyed;
|
|
835
944
|
const n = counts[prop] || 0;
|
|
836
945
|
counts[prop] = n + 1;
|
|
837
946
|
return `${prop}#${n}`;
|
|
838
947
|
}
|
|
948
|
+
function keyedId(prop, raw) {
|
|
949
|
+
const k = raw.$key;
|
|
950
|
+
return typeof k === "string" || typeof k === "number" ? `${prop}#${encodeOccurrenceKey(k)}` : undefined;
|
|
951
|
+
}
|
|
952
|
+
function structuralArgsKey(raw) {
|
|
953
|
+
let out = "";
|
|
954
|
+
let ancestors;
|
|
955
|
+
const walk = (v, top) => {
|
|
956
|
+
if (v === null) out += "N";else if (typeof v === "string") out += "s" + v.length + ":" + v;else if (typeof v === "boolean") out += v ? "T" : "F";else if (typeof v === "undefined") out += "U";else if (typeof v === "number") out += "n" + v + ";";else if (typeof v === "bigint") out += "b" + v + ";";else if (typeof v !== "object") return false;else {
|
|
957
|
+
const isArray = Array.isArray(v);
|
|
958
|
+
if (!isArray) {
|
|
959
|
+
const proto = Object.getPrototypeOf(v);
|
|
960
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
961
|
+
}
|
|
962
|
+
if (ancestors === undefined) ancestors = new Set();else if (ancestors.has(v)) return false;
|
|
963
|
+
ancestors.add(v);
|
|
964
|
+
try {
|
|
965
|
+
if (isArray) {
|
|
966
|
+
out += "[";
|
|
967
|
+
for (const item of v) if (!walk(item)) return false;
|
|
968
|
+
out += "]";
|
|
969
|
+
} else {
|
|
970
|
+
out += "{";
|
|
971
|
+
for (const k of Object.keys(v).sort()) {
|
|
972
|
+
if (top && k === "$key") continue;
|
|
973
|
+
const desc = Object.getOwnPropertyDescriptor(v, k);
|
|
974
|
+
if (desc.get || desc.set) return false;
|
|
975
|
+
out += "k" + k.length + ":" + k;
|
|
976
|
+
if (!walk(desc.value)) return false;
|
|
977
|
+
}
|
|
978
|
+
out += "}";
|
|
979
|
+
}
|
|
980
|
+
} finally {
|
|
981
|
+
ancestors.delete(v);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return true;
|
|
985
|
+
};
|
|
986
|
+
return walk(raw, true) ? out : undefined;
|
|
987
|
+
}
|
|
988
|
+
function repeatKey(prop, raw) {
|
|
989
|
+
const keyed = keyedId(prop, raw);
|
|
990
|
+
if (keyed !== undefined) return keyed;
|
|
991
|
+
const structural = structuralArgsKey(raw);
|
|
992
|
+
return structural === undefined ? undefined : prop + "\0" + structural;
|
|
993
|
+
}
|
|
839
994
|
function isAsyncValue(v) {
|
|
840
995
|
return !!v && typeof v === "object" && (typeof v.then === "function" || typeof v[Symbol.asyncIterator] === "function");
|
|
841
996
|
}
|
|
@@ -864,6 +1019,7 @@ function suppressedFill(render) {
|
|
|
864
1019
|
function createDocumentSlotProps(clientProps, frameId) {
|
|
865
1020
|
const counts = Object.create(null);
|
|
866
1021
|
const getters = new Map();
|
|
1022
|
+
const repeats = new Map();
|
|
867
1023
|
const range = (occurrence, content) => {
|
|
868
1024
|
const r = [{
|
|
869
1025
|
t: `<!--slot:${occurrence}:start-->`
|
|
@@ -871,7 +1027,10 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
871
1027
|
t: `<!--slot:${occurrence}:end-->`
|
|
872
1028
|
}];
|
|
873
1029
|
r.$slot = true;
|
|
874
|
-
|
|
1030
|
+
r.$occurrence = occurrence;
|
|
1031
|
+
const face = slotFace(r, content);
|
|
1032
|
+
r.$face = face;
|
|
1033
|
+
return slotProxy(r, occurrence, face, face === SLOT_FACE_DATA ? content : undefined);
|
|
875
1034
|
};
|
|
876
1035
|
const zoneOwner = getOwner ? getOwner() : null;
|
|
877
1036
|
const scoped = (occurrence, render) => {
|
|
@@ -895,12 +1054,20 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
895
1054
|
if (!fn) {
|
|
896
1055
|
fn = (...callArgs) => {
|
|
897
1056
|
if (callArgs.length === 0 || callArgs[0] === undefined) {
|
|
898
|
-
|
|
1057
|
+
const rk = prop + "\0";
|
|
1058
|
+
const repeat = repeats.get(rk);
|
|
1059
|
+
if (repeat) return repeat;
|
|
1060
|
+
const out = suppressedFill(() => scoped(prop, () => {
|
|
899
1061
|
const value = clientProps[prop];
|
|
900
1062
|
return range(prop, typeof value === "function" ? value() : value);
|
|
901
1063
|
}));
|
|
1064
|
+
if (out.$face === SLOT_FACE_DATA) repeats.set(rk, out);
|
|
1065
|
+
return out;
|
|
902
1066
|
}
|
|
903
1067
|
const raw = callArgs[0];
|
|
1068
|
+
const rk = repeatKey(prop, raw);
|
|
1069
|
+
const repeat = rk !== undefined && repeats.get(rk);
|
|
1070
|
+
if (repeat) return repeat;
|
|
904
1071
|
const occurrence = occurrenceId(prop, raw, counts);
|
|
905
1072
|
const slot = clientProps[prop];
|
|
906
1073
|
if (typeof slot !== "function") return range(occurrence, undefined);
|
|
@@ -992,7 +1159,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
992
1159
|
configurable: true
|
|
993
1160
|
});
|
|
994
1161
|
} else {
|
|
995
|
-
resolved[key] = value;
|
|
1162
|
+
resolved[key] = vals[key] = withoutStandIns(value);
|
|
996
1163
|
}
|
|
997
1164
|
}
|
|
998
1165
|
const out = suppressedFill(() => scoped(occurrence, () => range(occurrence, slot(resolved))));
|
|
@@ -1009,7 +1176,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1009
1176
|
continue;
|
|
1010
1177
|
}
|
|
1011
1178
|
if (!isContainerTraced(value) && isServerContent(value)) continue;
|
|
1012
|
-
args[key] =
|
|
1179
|
+
args[key] = argBorderForm(value);
|
|
1013
1180
|
}
|
|
1014
1181
|
sharedConfig.context.serialize(`sc:slot:${frameId}:${occurrence}`, {
|
|
1015
1182
|
...args
|
|
@@ -1024,7 +1191,7 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1024
1191
|
if (minted[key]) continue;
|
|
1025
1192
|
const ledgerKey = `${frameId}:${occurrence}:${key}`;
|
|
1026
1193
|
openArgBinding(liveArgs, ledgerKey, occurrence, key, evals[key], states[key], value => {
|
|
1027
|
-
args[key] =
|
|
1194
|
+
args[key] = argBorderForm(value);
|
|
1028
1195
|
liveArgs.slot(frameId, occurrence, {
|
|
1029
1196
|
...args
|
|
1030
1197
|
});
|
|
@@ -1032,10 +1199,10 @@ function createDocumentSlotProps(clientProps, frameId) {
|
|
|
1032
1199
|
}
|
|
1033
1200
|
}
|
|
1034
1201
|
}
|
|
1202
|
+
if (rk !== undefined && (rk === occurrence || out.$face === SLOT_FACE_DATA)) repeats.has(rk) || repeats.set(rk, out);
|
|
1035
1203
|
return out;
|
|
1036
1204
|
};
|
|
1037
1205
|
fn.$lhSkip = true;
|
|
1038
|
-
fn[CLAIM_PROP] = prop;
|
|
1039
1206
|
getters.set(prop, fn);
|
|
1040
1207
|
}
|
|
1041
1208
|
return fn;
|
|
@@ -1060,7 +1227,7 @@ function armDocumentLiveHoles(ctx) {
|
|
|
1060
1227
|
}
|
|
1061
1228
|
return;
|
|
1062
1229
|
}
|
|
1063
|
-
if (!live || !ctx.async ||
|
|
1230
|
+
if (!live || !ctx.async || !ctx.serialize || typeof ReadableStream !== "function") {
|
|
1064
1231
|
ctx.liveHoles = null;
|
|
1065
1232
|
if (live) live.holes = null;
|
|
1066
1233
|
return;
|
|
@@ -1168,10 +1335,17 @@ function frameTransformDirectResult(value, {
|
|
|
1168
1335
|
t: frameElementOpen(id)
|
|
1169
1336
|
},
|
|
1170
1337
|
serverOwned(() => {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1338
|
+
const page = sharedConfig.context;
|
|
1339
|
+
armDocumentLiveHoles(page);
|
|
1340
|
+
const ctx = Object.create(page);
|
|
1341
|
+
ctx.claims = CLAIMS_DOCUMENT;
|
|
1342
|
+
sharedConfig.context = ctx;
|
|
1343
|
+
try {
|
|
1344
|
+
const slotProps = createDocumentSlotProps(props, id);
|
|
1345
|
+
return serverComponentScope(() => component(slotProps), !!wrapped[LIVE_SOURCE]);
|
|
1346
|
+
} finally {
|
|
1347
|
+
sharedConfig.context = page;
|
|
1348
|
+
}
|
|
1175
1349
|
}), {
|
|
1176
1350
|
t: FRAME_ELEMENT_CLOSE
|
|
1177
1351
|
}];
|
|
@@ -1279,6 +1453,7 @@ function openArgBinding(sink, ledgerKey, occurrence, key, evaluate, state, emit)
|
|
|
1279
1453
|
function createSlotProps(sink, frame) {
|
|
1280
1454
|
const counts = Object.create(null);
|
|
1281
1455
|
const getters = new Map();
|
|
1456
|
+
const repeats = new Map();
|
|
1282
1457
|
return new Proxy(Object.create(null), {
|
|
1283
1458
|
has() {
|
|
1284
1459
|
return true;
|
|
@@ -1290,8 +1465,11 @@ function createSlotProps(sink, frame) {
|
|
|
1290
1465
|
if (!fn) {
|
|
1291
1466
|
fn = (...callArgs) => {
|
|
1292
1467
|
if (callArgs.length === 0 || callArgs[0] === undefined) {
|
|
1293
|
-
return slotRange(prop);
|
|
1468
|
+
return slotProxy(slotRange(prop), prop, SLOT_FACE_STREAM, undefined);
|
|
1294
1469
|
}
|
|
1470
|
+
const rk = repeatKey(prop, callArgs[0]);
|
|
1471
|
+
const repeat = rk !== undefined && repeats.get(rk);
|
|
1472
|
+
if (repeat) return repeat;
|
|
1295
1473
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
1296
1474
|
if (live) {
|
|
1297
1475
|
if (live.sweeping) {
|
|
@@ -1368,7 +1546,7 @@ function createSlotProps(sink, frame) {
|
|
|
1368
1546
|
};
|
|
1369
1547
|
} else {
|
|
1370
1548
|
const ref = `arg:${occurrence}:${key}`;
|
|
1371
|
-
ctx.serialize(ref,
|
|
1549
|
+
ctx.serialize(ref, argBorderForm(value, key, occurrence));
|
|
1372
1550
|
args[key] = {
|
|
1373
1551
|
$ref: ref
|
|
1374
1552
|
};
|
|
@@ -1400,7 +1578,7 @@ function createSlotProps(sink, frame) {
|
|
|
1400
1578
|
} else {
|
|
1401
1579
|
const ref = `arg:${occurrence}:${key}@${sink.nextArgRef(ledgerKey)}`;
|
|
1402
1580
|
sink.mintRef(ref);
|
|
1403
|
-
ctx.serialize(ref,
|
|
1581
|
+
ctx.serialize(ref, argBorderForm(value));
|
|
1404
1582
|
args[key] = {
|
|
1405
1583
|
$ref: ref
|
|
1406
1584
|
};
|
|
@@ -1410,10 +1588,12 @@ function createSlotProps(sink, frame) {
|
|
|
1410
1588
|
});
|
|
1411
1589
|
});
|
|
1412
1590
|
}
|
|
1413
|
-
|
|
1591
|
+
const keyed = rk === occurrence;
|
|
1592
|
+
const out = slotProxy(slotRange(occurrence), occurrence, SLOT_FACE_STREAM, undefined, rk === undefined || keyed ? undefined : () => repeats.has(rk) || repeats.set(rk, out));
|
|
1593
|
+
if (keyed) repeats.set(rk, out);
|
|
1594
|
+
return out;
|
|
1414
1595
|
};
|
|
1415
1596
|
fn.$lhSkip = true;
|
|
1416
|
-
fn[CLAIM_PROP] = prop;
|
|
1417
1597
|
getters.set(prop, fn);
|
|
1418
1598
|
}
|
|
1419
1599
|
return fn;
|