claude-sessions-mcp 0.3.0 → 0.4.0
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/README.md +25 -78
- package/dist/index.js +308 -0
- package/dist/index.js.map +1 -0
- package/package.json +14 -64
- package/dist/chunk-7MUU7A32.js +0 -47
- package/dist/chunk-7MUU7A32.js.map +0 -1
- package/dist/mcp/index.js +0 -714
- package/dist/mcp/index.js.map +0 -1
- package/dist/server.d.ts +0 -10
- package/dist/server.js +0 -9
- package/dist/server.js.map +0 -1
- package/dist/web/client/_app/immutable/assets/0.XO-DXdC4.css +0 -1
- package/dist/web/client/_app/immutable/assets/0.XO-DXdC4.css.br +0 -0
- package/dist/web/client/_app/immutable/assets/0.XO-DXdC4.css.gz +0 -0
- package/dist/web/client/_app/immutable/chunks/B2IHY0Hs.js +0 -1
- package/dist/web/client/_app/immutable/chunks/B2IHY0Hs.js.br +0 -0
- package/dist/web/client/_app/immutable/chunks/B2IHY0Hs.js.gz +0 -0
- package/dist/web/client/_app/immutable/chunks/BCJVXGHY.js +0 -1
- package/dist/web/client/_app/immutable/chunks/BCJVXGHY.js.br +0 -0
- package/dist/web/client/_app/immutable/chunks/BCJVXGHY.js.gz +0 -0
- package/dist/web/client/_app/immutable/chunks/CMwK7N_O.js +0 -1
- package/dist/web/client/_app/immutable/chunks/CMwK7N_O.js.br +0 -0
- package/dist/web/client/_app/immutable/chunks/CMwK7N_O.js.gz +0 -0
- package/dist/web/client/_app/immutable/chunks/CZTho13P.js +0 -1
- package/dist/web/client/_app/immutable/chunks/CZTho13P.js.br +0 -0
- package/dist/web/client/_app/immutable/chunks/CZTho13P.js.gz +0 -0
- package/dist/web/client/_app/immutable/chunks/F-H9hLgW.js +0 -2
- package/dist/web/client/_app/immutable/chunks/F-H9hLgW.js.br +0 -0
- package/dist/web/client/_app/immutable/chunks/F-H9hLgW.js.gz +0 -0
- package/dist/web/client/_app/immutable/chunks/gR9AL7GA.js +0 -2
- package/dist/web/client/_app/immutable/chunks/gR9AL7GA.js.br +0 -0
- package/dist/web/client/_app/immutable/chunks/gR9AL7GA.js.gz +0 -0
- package/dist/web/client/_app/immutable/entry/app.Boej0hfY.js +0 -2
- package/dist/web/client/_app/immutable/entry/app.Boej0hfY.js.br +0 -0
- package/dist/web/client/_app/immutable/entry/app.Boej0hfY.js.gz +0 -0
- package/dist/web/client/_app/immutable/entry/start.CVYJWPd9.js +0 -1
- package/dist/web/client/_app/immutable/entry/start.CVYJWPd9.js.br +0 -2
- package/dist/web/client/_app/immutable/entry/start.CVYJWPd9.js.gz +0 -0
- package/dist/web/client/_app/immutable/nodes/0.Lbeu1dpo.js +0 -1
- package/dist/web/client/_app/immutable/nodes/0.Lbeu1dpo.js.br +0 -0
- package/dist/web/client/_app/immutable/nodes/0.Lbeu1dpo.js.gz +0 -0
- package/dist/web/client/_app/immutable/nodes/1.DvRsCtcA.js +0 -1
- package/dist/web/client/_app/immutable/nodes/1.DvRsCtcA.js.br +0 -0
- package/dist/web/client/_app/immutable/nodes/1.DvRsCtcA.js.gz +0 -0
- package/dist/web/client/_app/immutable/nodes/2.CjVN0Bwe.js +0 -73
- package/dist/web/client/_app/immutable/nodes/2.CjVN0Bwe.js.br +0 -0
- package/dist/web/client/_app/immutable/nodes/2.CjVN0Bwe.js.gz +0 -0
- package/dist/web/client/_app/version.json +0 -1
- package/dist/web/client/_app/version.json.br +0 -0
- package/dist/web/client/_app/version.json.gz +0 -0
- package/dist/web/client/favicon.png +0 -0
- package/dist/web/env.js +0 -45
- package/dist/web/handler.js +0 -1390
- package/dist/web/index.js +0 -334
- package/dist/web/server/chunks/0-C_hzGzlo.js +0 -17
- package/dist/web/server/chunks/0-C_hzGzlo.js.map +0 -1
- package/dist/web/server/chunks/1-CSNAjAzD.js +0 -9
- package/dist/web/server/chunks/1-CSNAjAzD.js.map +0 -1
- package/dist/web/server/chunks/2-D_ZAFGkV.js +0 -9
- package/dist/web/server/chunks/2-D_ZAFGkV.js.map +0 -1
- package/dist/web/server/chunks/_layout.svelte-BWDuddeu.js +0 -33
- package/dist/web/server/chunks/_layout.svelte-BWDuddeu.js.map +0 -1
- package/dist/web/server/chunks/_page.svelte-BTPPI5f9.js +0 -113
- package/dist/web/server/chunks/_page.svelte-BTPPI5f9.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-B0JVJ9FB.js +0 -28
- package/dist/web/server/chunks/_server.ts-B0JVJ9FB.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-BLGLFyUk.js +0 -19
- package/dist/web/server/chunks/_server.ts-BLGLFyUk.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-BaqmP9oG.js +0 -14
- package/dist/web/server/chunks/_server.ts-BaqmP9oG.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-Beze9L3_.js +0 -19
- package/dist/web/server/chunks/_server.ts-Beze9L3_.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-BlgHsHoW.js +0 -8
- package/dist/web/server/chunks/_server.ts-BlgHsHoW.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-Bw_uJ6TN.js +0 -11
- package/dist/web/server/chunks/_server.ts-Bw_uJ6TN.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-CHX8x48n.js +0 -27
- package/dist/web/server/chunks/_server.ts-CHX8x48n.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-Cb5-fa8C.js +0 -37
- package/dist/web/server/chunks/_server.ts-Cb5-fa8C.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-ChE2aT-W.js +0 -29
- package/dist/web/server/chunks/_server.ts-ChE2aT-W.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-Cksv90lD.js +0 -18
- package/dist/web/server/chunks/_server.ts-Cksv90lD.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-D80JJ66s.js +0 -26
- package/dist/web/server/chunks/_server.ts-D80JJ66s.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-DjWf5N-i.js +0 -18
- package/dist/web/server/chunks/_server.ts-DjWf5N-i.js.map +0 -1
- package/dist/web/server/chunks/_server.ts-DmMLJ93T.js +0 -18
- package/dist/web/server/chunks/_server.ts-DmMLJ93T.js.map +0 -1
- package/dist/web/server/chunks/context-R2425nfV.js +0 -64
- package/dist/web/server/chunks/context-R2425nfV.js.map +0 -1
- package/dist/web/server/chunks/error.svelte-DazOwnSn.js +0 -45
- package/dist/web/server/chunks/error.svelte-DazOwnSn.js.map +0 -1
- package/dist/web/server/chunks/exports-BzHwARwz.js +0 -326
- package/dist/web/server/chunks/exports-BzHwARwz.js.map +0 -1
- package/dist/web/server/chunks/index-CXFDTUAl.js +0 -913
- package/dist/web/server/chunks/index-CXFDTUAl.js.map +0 -1
- package/dist/web/server/chunks/index-CoD1IJuy.js +0 -190
- package/dist/web/server/chunks/index-CoD1IJuy.js.map +0 -1
- package/dist/web/server/chunks/session-DmOGNZUD.js +0 -781
- package/dist/web/server/chunks/session-DmOGNZUD.js.map +0 -1
- package/dist/web/server/index.js +0 -7938
- package/dist/web/server/index.js.map +0 -1
- package/dist/web/server/manifest.js +0 -137
- package/dist/web/server/manifest.js.map +0 -1
- package/dist/web/shims.js +0 -32
- /package/dist/{mcp/index.d.ts → index.d.ts} +0 -0
|
@@ -1,913 +0,0 @@
|
|
|
1
|
-
import { a as set_ssr_context, b as ssr_context, p as push, c as pop, e as escape_html } from './context-R2425nfV.js';
|
|
2
|
-
|
|
3
|
-
const DERIVED = 1 << 1;
|
|
4
|
-
const EFFECT = 1 << 2;
|
|
5
|
-
const RENDER_EFFECT = 1 << 3;
|
|
6
|
-
const MANAGED_EFFECT = 1 << 24;
|
|
7
|
-
const BLOCK_EFFECT = 1 << 4;
|
|
8
|
-
const BRANCH_EFFECT = 1 << 5;
|
|
9
|
-
const ROOT_EFFECT = 1 << 6;
|
|
10
|
-
const BOUNDARY_EFFECT = 1 << 7;
|
|
11
|
-
const CONNECTED = 1 << 9;
|
|
12
|
-
const CLEAN = 1 << 10;
|
|
13
|
-
const DIRTY = 1 << 11;
|
|
14
|
-
const MAYBE_DIRTY = 1 << 12;
|
|
15
|
-
const INERT = 1 << 13;
|
|
16
|
-
const DESTROYED = 1 << 14;
|
|
17
|
-
const EFFECT_RAN = 1 << 15;
|
|
18
|
-
const EFFECT_TRANSPARENT = 1 << 16;
|
|
19
|
-
const EAGER_EFFECT = 1 << 17;
|
|
20
|
-
const HEAD_EFFECT = 1 << 18;
|
|
21
|
-
const EFFECT_PRESERVED = 1 << 19;
|
|
22
|
-
const USER_EFFECT = 1 << 20;
|
|
23
|
-
const WAS_MARKED = 1 << 15;
|
|
24
|
-
const REACTION_IS_UPDATING = 1 << 21;
|
|
25
|
-
const ASYNC = 1 << 22;
|
|
26
|
-
const ERROR_VALUE = 1 << 23;
|
|
27
|
-
const STATE_SYMBOL = Symbol("$state");
|
|
28
|
-
const LEGACY_PROPS = Symbol("legacy props");
|
|
29
|
-
const STALE_REACTION = new class StaleReactionError extends Error {
|
|
30
|
-
name = "StaleReactionError";
|
|
31
|
-
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
|
|
32
|
-
}();
|
|
33
|
-
const COMMENT_NODE = 8;
|
|
34
|
-
const HYDRATION_START = "[";
|
|
35
|
-
const HYDRATION_START_ELSE = "[!";
|
|
36
|
-
const HYDRATION_END = "]";
|
|
37
|
-
const HYDRATION_ERROR = {};
|
|
38
|
-
const ELEMENT_IS_NAMESPACED = 1;
|
|
39
|
-
const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
|
|
40
|
-
const ELEMENT_IS_INPUT = 1 << 2;
|
|
41
|
-
const UNINITIALIZED = Symbol();
|
|
42
|
-
const DOM_BOOLEAN_ATTRIBUTES = [
|
|
43
|
-
"allowfullscreen",
|
|
44
|
-
"async",
|
|
45
|
-
"autofocus",
|
|
46
|
-
"autoplay",
|
|
47
|
-
"checked",
|
|
48
|
-
"controls",
|
|
49
|
-
"default",
|
|
50
|
-
"disabled",
|
|
51
|
-
"formnovalidate",
|
|
52
|
-
"indeterminate",
|
|
53
|
-
"inert",
|
|
54
|
-
"ismap",
|
|
55
|
-
"loop",
|
|
56
|
-
"multiple",
|
|
57
|
-
"muted",
|
|
58
|
-
"nomodule",
|
|
59
|
-
"novalidate",
|
|
60
|
-
"open",
|
|
61
|
-
"playsinline",
|
|
62
|
-
"readonly",
|
|
63
|
-
"required",
|
|
64
|
-
"reversed",
|
|
65
|
-
"seamless",
|
|
66
|
-
"selected",
|
|
67
|
-
"webkitdirectory",
|
|
68
|
-
"defer",
|
|
69
|
-
"disablepictureinpicture",
|
|
70
|
-
"disableremoteplayback"
|
|
71
|
-
];
|
|
72
|
-
function is_boolean_attribute(name) {
|
|
73
|
-
return DOM_BOOLEAN_ATTRIBUTES.includes(name);
|
|
74
|
-
}
|
|
75
|
-
const PASSIVE_EVENTS = ["touchstart", "touchmove"];
|
|
76
|
-
function is_passive_event(name) {
|
|
77
|
-
return PASSIVE_EVENTS.includes(name);
|
|
78
|
-
}
|
|
79
|
-
function r(e) {
|
|
80
|
-
var t, f, n = "";
|
|
81
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
82
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
83
|
-
var o = e.length;
|
|
84
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
85
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
86
|
-
return n;
|
|
87
|
-
}
|
|
88
|
-
function clsx$1() {
|
|
89
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
90
|
-
return n;
|
|
91
|
-
}
|
|
92
|
-
const replacements = {
|
|
93
|
-
translate: /* @__PURE__ */ new Map([
|
|
94
|
-
[true, "yes"],
|
|
95
|
-
[false, "no"]
|
|
96
|
-
])
|
|
97
|
-
};
|
|
98
|
-
function attr(name, value, is_boolean = false) {
|
|
99
|
-
if (name === "hidden" && value !== "until-found") {
|
|
100
|
-
is_boolean = true;
|
|
101
|
-
}
|
|
102
|
-
if (value == null || !value && is_boolean) return "";
|
|
103
|
-
const normalized = name in replacements && replacements[name].get(value) || value;
|
|
104
|
-
const assignment = is_boolean ? "" : `="${escape_html(normalized, true)}"`;
|
|
105
|
-
return ` ${name}${assignment}`;
|
|
106
|
-
}
|
|
107
|
-
function clsx(value) {
|
|
108
|
-
if (typeof value === "object") {
|
|
109
|
-
return clsx$1(value);
|
|
110
|
-
} else {
|
|
111
|
-
return value ?? "";
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const whitespace = [..." \n\r\f \v\uFEFF"];
|
|
115
|
-
function to_class(value, hash, directives) {
|
|
116
|
-
var classname = value == null ? "" : "" + value;
|
|
117
|
-
if (hash) {
|
|
118
|
-
classname = classname ? classname + " " + hash : hash;
|
|
119
|
-
}
|
|
120
|
-
if (directives) {
|
|
121
|
-
for (var key in directives) {
|
|
122
|
-
if (directives[key]) {
|
|
123
|
-
classname = classname ? classname + " " + key : key;
|
|
124
|
-
} else if (classname.length) {
|
|
125
|
-
var len = key.length;
|
|
126
|
-
var a = 0;
|
|
127
|
-
while ((a = classname.indexOf(key, a)) >= 0) {
|
|
128
|
-
var b = a + len;
|
|
129
|
-
if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
|
|
130
|
-
classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
|
|
131
|
-
} else {
|
|
132
|
-
a = b;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return classname === "" ? null : classname;
|
|
139
|
-
}
|
|
140
|
-
function append_styles(styles, important = false) {
|
|
141
|
-
var separator = important ? " !important;" : ";";
|
|
142
|
-
var css = "";
|
|
143
|
-
for (var key in styles) {
|
|
144
|
-
var value = styles[key];
|
|
145
|
-
if (value != null && value !== "") {
|
|
146
|
-
css += " " + key + ": " + value + separator;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return css;
|
|
150
|
-
}
|
|
151
|
-
function to_css_name(name) {
|
|
152
|
-
if (name[0] !== "-" || name[1] !== "-") {
|
|
153
|
-
return name.toLowerCase();
|
|
154
|
-
}
|
|
155
|
-
return name;
|
|
156
|
-
}
|
|
157
|
-
function to_style(value, styles) {
|
|
158
|
-
if (styles) {
|
|
159
|
-
var new_style = "";
|
|
160
|
-
var normal_styles;
|
|
161
|
-
var important_styles;
|
|
162
|
-
if (Array.isArray(styles)) {
|
|
163
|
-
normal_styles = styles[0];
|
|
164
|
-
important_styles = styles[1];
|
|
165
|
-
} else {
|
|
166
|
-
normal_styles = styles;
|
|
167
|
-
}
|
|
168
|
-
if (value) {
|
|
169
|
-
value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
|
|
170
|
-
var in_str = false;
|
|
171
|
-
var in_apo = 0;
|
|
172
|
-
var in_comment = false;
|
|
173
|
-
var reserved_names = [];
|
|
174
|
-
if (normal_styles) {
|
|
175
|
-
reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
|
|
176
|
-
}
|
|
177
|
-
if (important_styles) {
|
|
178
|
-
reserved_names.push(...Object.keys(important_styles).map(to_css_name));
|
|
179
|
-
}
|
|
180
|
-
var start_index = 0;
|
|
181
|
-
var name_index = -1;
|
|
182
|
-
const len = value.length;
|
|
183
|
-
for (var i = 0; i < len; i++) {
|
|
184
|
-
var c = value[i];
|
|
185
|
-
if (in_comment) {
|
|
186
|
-
if (c === "/" && value[i - 1] === "*") {
|
|
187
|
-
in_comment = false;
|
|
188
|
-
}
|
|
189
|
-
} else if (in_str) {
|
|
190
|
-
if (in_str === c) {
|
|
191
|
-
in_str = false;
|
|
192
|
-
}
|
|
193
|
-
} else if (c === "/" && value[i + 1] === "*") {
|
|
194
|
-
in_comment = true;
|
|
195
|
-
} else if (c === '"' || c === "'") {
|
|
196
|
-
in_str = c;
|
|
197
|
-
} else if (c === "(") {
|
|
198
|
-
in_apo++;
|
|
199
|
-
} else if (c === ")") {
|
|
200
|
-
in_apo--;
|
|
201
|
-
}
|
|
202
|
-
if (!in_comment && in_str === false && in_apo === 0) {
|
|
203
|
-
if (c === ":" && name_index === -1) {
|
|
204
|
-
name_index = i;
|
|
205
|
-
} else if (c === ";" || i === len - 1) {
|
|
206
|
-
if (name_index !== -1) {
|
|
207
|
-
var name = to_css_name(value.substring(start_index, name_index).trim());
|
|
208
|
-
if (!reserved_names.includes(name)) {
|
|
209
|
-
if (c !== ";") {
|
|
210
|
-
i++;
|
|
211
|
-
}
|
|
212
|
-
var property = value.substring(start_index, i).trim();
|
|
213
|
-
new_style += " " + property + ";";
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
start_index = i + 1;
|
|
217
|
-
name_index = -1;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (normal_styles) {
|
|
223
|
-
new_style += append_styles(normal_styles);
|
|
224
|
-
}
|
|
225
|
-
if (important_styles) {
|
|
226
|
-
new_style += append_styles(important_styles, true);
|
|
227
|
-
}
|
|
228
|
-
new_style = new_style.trim();
|
|
229
|
-
return new_style === "" ? null : new_style;
|
|
230
|
-
}
|
|
231
|
-
return value == null ? null : String(value);
|
|
232
|
-
}
|
|
233
|
-
const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
|
|
234
|
-
const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
|
|
235
|
-
const EMPTY_COMMENT = `<!---->`;
|
|
236
|
-
let controller = null;
|
|
237
|
-
function abort() {
|
|
238
|
-
controller?.abort(STALE_REACTION);
|
|
239
|
-
controller = null;
|
|
240
|
-
}
|
|
241
|
-
function await_invalid() {
|
|
242
|
-
const error = new Error(`await_invalid
|
|
243
|
-
Encountered asynchronous work while rendering synchronously.
|
|
244
|
-
https://svelte.dev/e/await_invalid`);
|
|
245
|
-
error.name = "Svelte error";
|
|
246
|
-
throw error;
|
|
247
|
-
}
|
|
248
|
-
function server_context_required() {
|
|
249
|
-
const error = new Error(`server_context_required
|
|
250
|
-
Could not resolve \`render\` context.
|
|
251
|
-
https://svelte.dev/e/server_context_required`);
|
|
252
|
-
error.name = "Svelte error";
|
|
253
|
-
throw error;
|
|
254
|
-
}
|
|
255
|
-
function unresolved_hydratable(key, stack) {
|
|
256
|
-
{
|
|
257
|
-
console.warn(`https://svelte.dev/e/unresolved_hydratable`);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
function get_render_context() {
|
|
261
|
-
const store = als?.getStore();
|
|
262
|
-
{
|
|
263
|
-
server_context_required();
|
|
264
|
-
}
|
|
265
|
-
return store;
|
|
266
|
-
}
|
|
267
|
-
let als = null;
|
|
268
|
-
class Renderer {
|
|
269
|
-
/**
|
|
270
|
-
* The contents of the renderer.
|
|
271
|
-
* @type {RendererItem[]}
|
|
272
|
-
*/
|
|
273
|
-
#out = [];
|
|
274
|
-
/**
|
|
275
|
-
* Any `onDestroy` callbacks registered during execution of this renderer.
|
|
276
|
-
* @type {(() => void)[] | undefined}
|
|
277
|
-
*/
|
|
278
|
-
#on_destroy = void 0;
|
|
279
|
-
/**
|
|
280
|
-
* Whether this renderer is a component body.
|
|
281
|
-
* @type {boolean}
|
|
282
|
-
*/
|
|
283
|
-
#is_component_body = false;
|
|
284
|
-
/**
|
|
285
|
-
* The type of string content that this renderer is accumulating.
|
|
286
|
-
* @type {RendererType}
|
|
287
|
-
*/
|
|
288
|
-
type;
|
|
289
|
-
/** @type {Renderer | undefined} */
|
|
290
|
-
#parent;
|
|
291
|
-
/**
|
|
292
|
-
* Asynchronous work associated with this renderer
|
|
293
|
-
* @type {Promise<void> | undefined}
|
|
294
|
-
*/
|
|
295
|
-
promise = void 0;
|
|
296
|
-
/**
|
|
297
|
-
* State which is associated with the content tree as a whole.
|
|
298
|
-
* It will be re-exposed, uncopied, on all children.
|
|
299
|
-
* @type {SSRState}
|
|
300
|
-
* @readonly
|
|
301
|
-
*/
|
|
302
|
-
global;
|
|
303
|
-
/**
|
|
304
|
-
* State that is local to the branch it is declared in.
|
|
305
|
-
* It will be shallow-copied to all children.
|
|
306
|
-
*
|
|
307
|
-
* @type {{ select_value: string | undefined }}
|
|
308
|
-
*/
|
|
309
|
-
local;
|
|
310
|
-
/**
|
|
311
|
-
* @param {SSRState} global
|
|
312
|
-
* @param {Renderer | undefined} [parent]
|
|
313
|
-
*/
|
|
314
|
-
constructor(global, parent) {
|
|
315
|
-
this.#parent = parent;
|
|
316
|
-
this.global = global;
|
|
317
|
-
this.local = parent ? { ...parent.local } : { select_value: void 0 };
|
|
318
|
-
this.type = parent ? parent.type : "body";
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* @param {(renderer: Renderer) => void} fn
|
|
322
|
-
*/
|
|
323
|
-
head(fn) {
|
|
324
|
-
const head2 = new Renderer(this.global, this);
|
|
325
|
-
head2.type = "head";
|
|
326
|
-
this.#out.push(head2);
|
|
327
|
-
head2.child(fn);
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* @param {Array<Promise<void>>} blockers
|
|
331
|
-
* @param {(renderer: Renderer) => void} fn
|
|
332
|
-
*/
|
|
333
|
-
async_block(blockers, fn) {
|
|
334
|
-
this.#out.push(BLOCK_OPEN);
|
|
335
|
-
this.async(blockers, fn);
|
|
336
|
-
this.#out.push(BLOCK_CLOSE);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* @param {Array<Promise<void>>} blockers
|
|
340
|
-
* @param {(renderer: Renderer) => void} fn
|
|
341
|
-
*/
|
|
342
|
-
async(blockers, fn) {
|
|
343
|
-
let callback = fn;
|
|
344
|
-
if (blockers.length > 0) {
|
|
345
|
-
const context = ssr_context;
|
|
346
|
-
callback = (renderer) => {
|
|
347
|
-
return Promise.all(blockers).then(() => {
|
|
348
|
-
const previous_context = ssr_context;
|
|
349
|
-
try {
|
|
350
|
-
set_ssr_context(context);
|
|
351
|
-
return fn(renderer);
|
|
352
|
-
} finally {
|
|
353
|
-
set_ssr_context(previous_context);
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
this.child(callback);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* @param {Array<() => void>} thunks
|
|
362
|
-
*/
|
|
363
|
-
run(thunks) {
|
|
364
|
-
const context = ssr_context;
|
|
365
|
-
let promise = Promise.resolve(thunks[0]());
|
|
366
|
-
const promises = [promise];
|
|
367
|
-
for (const fn of thunks.slice(1)) {
|
|
368
|
-
promise = promise.then(() => {
|
|
369
|
-
const previous_context = ssr_context;
|
|
370
|
-
set_ssr_context(context);
|
|
371
|
-
try {
|
|
372
|
-
return fn();
|
|
373
|
-
} finally {
|
|
374
|
-
set_ssr_context(previous_context);
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
promises.push(promise);
|
|
378
|
-
}
|
|
379
|
-
return promises;
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Create a child renderer. The child renderer inherits the state from the parent,
|
|
383
|
-
* but has its own content.
|
|
384
|
-
* @param {(renderer: Renderer) => MaybePromise<void>} fn
|
|
385
|
-
*/
|
|
386
|
-
child(fn) {
|
|
387
|
-
const child = new Renderer(this.global, this);
|
|
388
|
-
this.#out.push(child);
|
|
389
|
-
const parent = ssr_context;
|
|
390
|
-
set_ssr_context({
|
|
391
|
-
...ssr_context,
|
|
392
|
-
p: parent,
|
|
393
|
-
c: null,
|
|
394
|
-
r: child
|
|
395
|
-
});
|
|
396
|
-
const result = fn(child);
|
|
397
|
-
set_ssr_context(parent);
|
|
398
|
-
if (result instanceof Promise) {
|
|
399
|
-
if (child.global.mode === "sync") {
|
|
400
|
-
await_invalid();
|
|
401
|
-
}
|
|
402
|
-
result.catch(() => {
|
|
403
|
-
});
|
|
404
|
-
child.promise = result;
|
|
405
|
-
}
|
|
406
|
-
return child;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Create a component renderer. The component renderer inherits the state from the parent,
|
|
410
|
-
* but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
|
|
411
|
-
* @param {(renderer: Renderer) => MaybePromise<void>} fn
|
|
412
|
-
* @param {Function} [component_fn]
|
|
413
|
-
* @returns {void}
|
|
414
|
-
*/
|
|
415
|
-
component(fn, component_fn) {
|
|
416
|
-
push();
|
|
417
|
-
const child = this.child(fn);
|
|
418
|
-
child.#is_component_body = true;
|
|
419
|
-
pop();
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* @param {Record<string, any>} attrs
|
|
423
|
-
* @param {(renderer: Renderer) => void} fn
|
|
424
|
-
* @param {string | undefined} [css_hash]
|
|
425
|
-
* @param {Record<string, boolean> | undefined} [classes]
|
|
426
|
-
* @param {Record<string, string> | undefined} [styles]
|
|
427
|
-
* @param {number | undefined} [flags]
|
|
428
|
-
* @returns {void}
|
|
429
|
-
*/
|
|
430
|
-
select(attrs, fn, css_hash, classes, styles, flags) {
|
|
431
|
-
const { value, ...select_attrs } = attrs;
|
|
432
|
-
this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
|
|
433
|
-
this.child((renderer) => {
|
|
434
|
-
renderer.local.select_value = value;
|
|
435
|
-
fn(renderer);
|
|
436
|
-
});
|
|
437
|
-
this.push("</select>");
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* @param {Record<string, any>} attrs
|
|
441
|
-
* @param {string | number | boolean | ((renderer: Renderer) => void)} body
|
|
442
|
-
* @param {string | undefined} [css_hash]
|
|
443
|
-
* @param {Record<string, boolean> | undefined} [classes]
|
|
444
|
-
* @param {Record<string, string> | undefined} [styles]
|
|
445
|
-
* @param {number | undefined} [flags]
|
|
446
|
-
*/
|
|
447
|
-
option(attrs, body, css_hash, classes, styles, flags) {
|
|
448
|
-
this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
|
|
449
|
-
const close = (renderer, value, { head: head2, body: body2 }) => {
|
|
450
|
-
if ("value" in attrs) {
|
|
451
|
-
value = attrs.value;
|
|
452
|
-
}
|
|
453
|
-
if (value === this.local.select_value) {
|
|
454
|
-
renderer.#out.push(" selected");
|
|
455
|
-
}
|
|
456
|
-
renderer.#out.push(`>${body2}</option>`);
|
|
457
|
-
if (head2) {
|
|
458
|
-
renderer.head((child) => child.push(head2));
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
if (typeof body === "function") {
|
|
462
|
-
this.child((renderer) => {
|
|
463
|
-
const r2 = new Renderer(this.global, this);
|
|
464
|
-
body(r2);
|
|
465
|
-
if (this.global.mode === "async") {
|
|
466
|
-
return r2.#collect_content_async().then((content) => {
|
|
467
|
-
close(renderer, content.body.replaceAll("<!---->", ""), content);
|
|
468
|
-
});
|
|
469
|
-
} else {
|
|
470
|
-
const content = r2.#collect_content();
|
|
471
|
-
close(renderer, content.body.replaceAll("<!---->", ""), content);
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
} else {
|
|
475
|
-
close(this, body, { body });
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* @param {(renderer: Renderer) => void} fn
|
|
480
|
-
*/
|
|
481
|
-
title(fn) {
|
|
482
|
-
const path = this.get_path();
|
|
483
|
-
const close = (head2) => {
|
|
484
|
-
this.global.set_title(head2, path);
|
|
485
|
-
};
|
|
486
|
-
this.child((renderer) => {
|
|
487
|
-
const r2 = new Renderer(renderer.global, renderer);
|
|
488
|
-
fn(r2);
|
|
489
|
-
if (renderer.global.mode === "async") {
|
|
490
|
-
return r2.#collect_content_async().then((content) => {
|
|
491
|
-
close(content.head);
|
|
492
|
-
});
|
|
493
|
-
} else {
|
|
494
|
-
const content = r2.#collect_content();
|
|
495
|
-
close(content.head);
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* @param {string | (() => Promise<string>)} content
|
|
501
|
-
*/
|
|
502
|
-
push(content) {
|
|
503
|
-
if (typeof content === "function") {
|
|
504
|
-
this.child(async (renderer) => renderer.push(await content()));
|
|
505
|
-
} else {
|
|
506
|
-
this.#out.push(content);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* @param {() => void} fn
|
|
511
|
-
*/
|
|
512
|
-
on_destroy(fn) {
|
|
513
|
-
(this.#on_destroy ??= []).push(fn);
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* @returns {number[]}
|
|
517
|
-
*/
|
|
518
|
-
get_path() {
|
|
519
|
-
return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* @deprecated this is needed for legacy component bindings
|
|
523
|
-
*/
|
|
524
|
-
copy() {
|
|
525
|
-
const copy = new Renderer(this.global, this.#parent);
|
|
526
|
-
copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
|
|
527
|
-
copy.promise = this.promise;
|
|
528
|
-
return copy;
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* @param {Renderer} other
|
|
532
|
-
* @deprecated this is needed for legacy component bindings
|
|
533
|
-
*/
|
|
534
|
-
subsume(other) {
|
|
535
|
-
if (this.global.mode !== other.global.mode) {
|
|
536
|
-
throw new Error(
|
|
537
|
-
"invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!"
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
this.local = other.local;
|
|
541
|
-
this.#out = other.#out.map((item) => {
|
|
542
|
-
if (item instanceof Renderer) {
|
|
543
|
-
item.subsume(item);
|
|
544
|
-
}
|
|
545
|
-
return item;
|
|
546
|
-
});
|
|
547
|
-
this.promise = other.promise;
|
|
548
|
-
this.type = other.type;
|
|
549
|
-
}
|
|
550
|
-
get length() {
|
|
551
|
-
return this.#out.length;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Only available on the server and when compiling with the `server` option.
|
|
555
|
-
* Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
|
|
556
|
-
* @template {Record<string, any>} Props
|
|
557
|
-
* @param {Component<Props>} component
|
|
558
|
-
* @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} [options]
|
|
559
|
-
* @returns {RenderOutput}
|
|
560
|
-
*/
|
|
561
|
-
static render(component, options = {}) {
|
|
562
|
-
let sync;
|
|
563
|
-
const result = (
|
|
564
|
-
/** @type {RenderOutput} */
|
|
565
|
-
{}
|
|
566
|
-
);
|
|
567
|
-
Object.defineProperties(result, {
|
|
568
|
-
html: {
|
|
569
|
-
get: () => {
|
|
570
|
-
return (sync ??= Renderer.#render(component, options)).body;
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
head: {
|
|
574
|
-
get: () => {
|
|
575
|
-
return (sync ??= Renderer.#render(component, options)).head;
|
|
576
|
-
}
|
|
577
|
-
},
|
|
578
|
-
body: {
|
|
579
|
-
get: () => {
|
|
580
|
-
return (sync ??= Renderer.#render(component, options)).body;
|
|
581
|
-
}
|
|
582
|
-
},
|
|
583
|
-
then: {
|
|
584
|
-
value: (
|
|
585
|
-
/**
|
|
586
|
-
* this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
|
|
587
|
-
*
|
|
588
|
-
* @template TResult1
|
|
589
|
-
* @template [TResult2=never]
|
|
590
|
-
* @param { (value: SyncRenderOutput) => TResult1 } onfulfilled
|
|
591
|
-
* @param { (reason: unknown) => TResult2 } onrejected
|
|
592
|
-
*/
|
|
593
|
-
(onfulfilled, onrejected) => {
|
|
594
|
-
{
|
|
595
|
-
const result2 = sync ??= Renderer.#render(component, options);
|
|
596
|
-
const user_result = onfulfilled({
|
|
597
|
-
head: result2.head,
|
|
598
|
-
body: result2.body,
|
|
599
|
-
html: result2.body
|
|
600
|
-
});
|
|
601
|
-
return Promise.resolve(user_result);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
)
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
return result;
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
|
|
611
|
-
* after awaiting `collect_async`.
|
|
612
|
-
*
|
|
613
|
-
* Child renderers are "porous" and don't affect execution order, but component body renderers
|
|
614
|
-
* create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
|
|
615
|
-
* @returns {Iterable<() => void>}
|
|
616
|
-
*/
|
|
617
|
-
*#collect_on_destroy() {
|
|
618
|
-
for (const component of this.#traverse_components()) {
|
|
619
|
-
yield* component.#collect_ondestroy();
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
/**
|
|
623
|
-
* Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
|
|
624
|
-
* @returns {Iterable<Renderer>}
|
|
625
|
-
*/
|
|
626
|
-
*#traverse_components() {
|
|
627
|
-
for (const child of this.#out) {
|
|
628
|
-
if (typeof child !== "string") {
|
|
629
|
-
yield* child.#traverse_components();
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
if (this.#is_component_body) {
|
|
633
|
-
yield this;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* @returns {Iterable<() => void>}
|
|
638
|
-
*/
|
|
639
|
-
*#collect_ondestroy() {
|
|
640
|
-
if (this.#on_destroy) {
|
|
641
|
-
for (const fn of this.#on_destroy) {
|
|
642
|
-
yield fn;
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
for (const child of this.#out) {
|
|
646
|
-
if (child instanceof Renderer && !child.#is_component_body) {
|
|
647
|
-
yield* child.#collect_ondestroy();
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Render a component. Throws if any of the children are performing asynchronous work.
|
|
653
|
-
*
|
|
654
|
-
* @template {Record<string, any>} Props
|
|
655
|
-
* @param {Component<Props>} component
|
|
656
|
-
* @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
|
|
657
|
-
* @returns {AccumulatedContent}
|
|
658
|
-
*/
|
|
659
|
-
static #render(component, options) {
|
|
660
|
-
var previous_context = ssr_context;
|
|
661
|
-
try {
|
|
662
|
-
const renderer = Renderer.#open_render("sync", component, options);
|
|
663
|
-
const content = renderer.#collect_content();
|
|
664
|
-
return Renderer.#close_render(content, renderer);
|
|
665
|
-
} finally {
|
|
666
|
-
abort();
|
|
667
|
-
set_ssr_context(previous_context);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Render a component.
|
|
672
|
-
*
|
|
673
|
-
* @template {Record<string, any>} Props
|
|
674
|
-
* @param {Component<Props>} component
|
|
675
|
-
* @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
|
|
676
|
-
* @returns {Promise<AccumulatedContent>}
|
|
677
|
-
*/
|
|
678
|
-
static async #render_async(component, options) {
|
|
679
|
-
const previous_context = ssr_context;
|
|
680
|
-
try {
|
|
681
|
-
const renderer = Renderer.#open_render("async", component, options);
|
|
682
|
-
const content = await renderer.#collect_content_async();
|
|
683
|
-
const hydratables = await renderer.#collect_hydratables();
|
|
684
|
-
if (hydratables !== null) {
|
|
685
|
-
content.head = hydratables + content.head;
|
|
686
|
-
}
|
|
687
|
-
return Renderer.#close_render(content, renderer);
|
|
688
|
-
} finally {
|
|
689
|
-
set_ssr_context(previous_context);
|
|
690
|
-
abort();
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
|
|
695
|
-
* @param {AccumulatedContent} content
|
|
696
|
-
* @returns {AccumulatedContent}
|
|
697
|
-
*/
|
|
698
|
-
#collect_content(content = { head: "", body: "" }) {
|
|
699
|
-
for (const item of this.#out) {
|
|
700
|
-
if (typeof item === "string") {
|
|
701
|
-
content[this.type] += item;
|
|
702
|
-
} else if (item instanceof Renderer) {
|
|
703
|
-
item.#collect_content(content);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return content;
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Collect all of the code from the `out` array and return it as a string.
|
|
710
|
-
* @param {AccumulatedContent} content
|
|
711
|
-
* @returns {Promise<AccumulatedContent>}
|
|
712
|
-
*/
|
|
713
|
-
async #collect_content_async(content = { head: "", body: "" }) {
|
|
714
|
-
await this.promise;
|
|
715
|
-
for (const item of this.#out) {
|
|
716
|
-
if (typeof item === "string") {
|
|
717
|
-
content[this.type] += item;
|
|
718
|
-
} else if (item instanceof Renderer) {
|
|
719
|
-
await item.#collect_content_async(content);
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
return content;
|
|
723
|
-
}
|
|
724
|
-
async #collect_hydratables() {
|
|
725
|
-
const ctx = get_render_context().hydratable;
|
|
726
|
-
for (const [_, key] of ctx.unresolved_promises) {
|
|
727
|
-
unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
|
|
728
|
-
}
|
|
729
|
-
for (const comparison of ctx.comparisons) {
|
|
730
|
-
await comparison;
|
|
731
|
-
}
|
|
732
|
-
return await Renderer.#hydratable_block(ctx);
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* @template {Record<string, any>} Props
|
|
736
|
-
* @param {'sync' | 'async'} mode
|
|
737
|
-
* @param {import('svelte').Component<Props>} component
|
|
738
|
-
* @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
|
|
739
|
-
* @returns {Renderer}
|
|
740
|
-
*/
|
|
741
|
-
static #open_render(mode, component, options) {
|
|
742
|
-
const renderer = new Renderer(
|
|
743
|
-
new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "")
|
|
744
|
-
);
|
|
745
|
-
renderer.push(BLOCK_OPEN);
|
|
746
|
-
if (options.context) {
|
|
747
|
-
push();
|
|
748
|
-
ssr_context.c = options.context;
|
|
749
|
-
ssr_context.r = renderer;
|
|
750
|
-
}
|
|
751
|
-
component(renderer, options.props ?? {});
|
|
752
|
-
if (options.context) {
|
|
753
|
-
pop();
|
|
754
|
-
}
|
|
755
|
-
renderer.push(BLOCK_CLOSE);
|
|
756
|
-
return renderer;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* @param {AccumulatedContent} content
|
|
760
|
-
* @param {Renderer} renderer
|
|
761
|
-
*/
|
|
762
|
-
static #close_render(content, renderer) {
|
|
763
|
-
for (const cleanup of renderer.#collect_on_destroy()) {
|
|
764
|
-
cleanup();
|
|
765
|
-
}
|
|
766
|
-
let head2 = content.head + renderer.global.get_title();
|
|
767
|
-
let body = content.body;
|
|
768
|
-
for (const { hash, code } of renderer.global.css) {
|
|
769
|
-
head2 += `<style id="${hash}">${code}</style>`;
|
|
770
|
-
}
|
|
771
|
-
return {
|
|
772
|
-
head: head2,
|
|
773
|
-
body
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* @param {HydratableContext} ctx
|
|
778
|
-
*/
|
|
779
|
-
static async #hydratable_block(ctx) {
|
|
780
|
-
if (ctx.lookup.size === 0) {
|
|
781
|
-
return null;
|
|
782
|
-
}
|
|
783
|
-
let entries = [];
|
|
784
|
-
let has_promises = false;
|
|
785
|
-
for (const [k, v] of ctx.lookup) {
|
|
786
|
-
if (v.promises) {
|
|
787
|
-
has_promises = true;
|
|
788
|
-
for (const p of v.promises) await p;
|
|
789
|
-
}
|
|
790
|
-
entries.push(`[${JSON.stringify(k)},${v.serialized}]`);
|
|
791
|
-
}
|
|
792
|
-
let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
|
|
793
|
-
if (has_promises) {
|
|
794
|
-
prelude = `const r = (v) => Promise.resolve(v);
|
|
795
|
-
${prelude}`;
|
|
796
|
-
}
|
|
797
|
-
return `
|
|
798
|
-
<script>
|
|
799
|
-
{
|
|
800
|
-
${prelude}
|
|
801
|
-
|
|
802
|
-
for (const [k, v] of [
|
|
803
|
-
${entries.join(",\n ")}
|
|
804
|
-
]) {
|
|
805
|
-
h.set(k, v);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
<\/script>`;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
class SSRState {
|
|
812
|
-
/** @readonly @type {'sync' | 'async'} */
|
|
813
|
-
mode;
|
|
814
|
-
/** @readonly @type {() => string} */
|
|
815
|
-
uid;
|
|
816
|
-
/** @readonly @type {Set<{ hash: string; code: string }>} */
|
|
817
|
-
css = /* @__PURE__ */ new Set();
|
|
818
|
-
/** @type {{ path: number[], value: string }} */
|
|
819
|
-
#title = { path: [], value: "" };
|
|
820
|
-
/**
|
|
821
|
-
* @param {'sync' | 'async'} mode
|
|
822
|
-
* @param {string} [id_prefix]
|
|
823
|
-
*/
|
|
824
|
-
constructor(mode, id_prefix = "") {
|
|
825
|
-
this.mode = mode;
|
|
826
|
-
let uid = 1;
|
|
827
|
-
this.uid = () => `${id_prefix}s${uid++}`;
|
|
828
|
-
}
|
|
829
|
-
get_title() {
|
|
830
|
-
return this.#title.value;
|
|
831
|
-
}
|
|
832
|
-
/**
|
|
833
|
-
* Performs a depth-first (lexicographic) comparison using the path. Rejects sets
|
|
834
|
-
* from earlier than or equal to the current value.
|
|
835
|
-
* @param {string} value
|
|
836
|
-
* @param {number[]} path
|
|
837
|
-
*/
|
|
838
|
-
set_title(value, path) {
|
|
839
|
-
const current = this.#title.path;
|
|
840
|
-
let i = 0;
|
|
841
|
-
let l = Math.min(path.length, current.length);
|
|
842
|
-
while (i < l && path[i] === current[i]) i += 1;
|
|
843
|
-
if (path[i] === void 0) return;
|
|
844
|
-
if (current[i] === void 0 || path[i] > current[i]) {
|
|
845
|
-
this.#title.path = path;
|
|
846
|
-
this.#title.value = value;
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
const INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
|
|
851
|
-
function render(component, options = {}) {
|
|
852
|
-
return Renderer.render(
|
|
853
|
-
/** @type {Component<Props>} */
|
|
854
|
-
component,
|
|
855
|
-
options
|
|
856
|
-
);
|
|
857
|
-
}
|
|
858
|
-
function head(hash, renderer, fn) {
|
|
859
|
-
renderer.head((renderer2) => {
|
|
860
|
-
renderer2.push(`<!--${hash}-->`);
|
|
861
|
-
renderer2.child(fn);
|
|
862
|
-
renderer2.push(EMPTY_COMMENT);
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
function attributes(attrs, css_hash, classes, styles, flags = 0) {
|
|
866
|
-
if (styles) {
|
|
867
|
-
attrs.style = to_style(attrs.style, styles);
|
|
868
|
-
}
|
|
869
|
-
if (attrs.class) {
|
|
870
|
-
attrs.class = clsx(attrs.class);
|
|
871
|
-
}
|
|
872
|
-
if (css_hash || classes) {
|
|
873
|
-
attrs.class = to_class(attrs.class, css_hash, classes);
|
|
874
|
-
}
|
|
875
|
-
let attr_str = "";
|
|
876
|
-
let name;
|
|
877
|
-
const is_html = (flags & ELEMENT_IS_NAMESPACED) === 0;
|
|
878
|
-
const lowercase = (flags & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
|
|
879
|
-
const is_input = (flags & ELEMENT_IS_INPUT) !== 0;
|
|
880
|
-
for (name in attrs) {
|
|
881
|
-
if (typeof attrs[name] === "function") continue;
|
|
882
|
-
if (name[0] === "$" && name[1] === "$") continue;
|
|
883
|
-
if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
|
|
884
|
-
var value = attrs[name];
|
|
885
|
-
if (lowercase) {
|
|
886
|
-
name = name.toLowerCase();
|
|
887
|
-
}
|
|
888
|
-
if (is_input) {
|
|
889
|
-
if (name === "defaultvalue" || name === "defaultchecked") {
|
|
890
|
-
name = name === "defaultvalue" ? "value" : "checked";
|
|
891
|
-
if (attrs[name]) continue;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
attr_str += attr(name, value, is_html && is_boolean_attribute(name));
|
|
895
|
-
}
|
|
896
|
-
return attr_str;
|
|
897
|
-
}
|
|
898
|
-
function stringify(value) {
|
|
899
|
-
return typeof value === "string" ? value : value == null ? "" : value + "";
|
|
900
|
-
}
|
|
901
|
-
function attr_class(value, hash, directives) {
|
|
902
|
-
var result = to_class(value, hash, directives);
|
|
903
|
-
return result ? ` class="${escape_html(result, true)}"` : "";
|
|
904
|
-
}
|
|
905
|
-
function ensure_array_like(array_like_or_iterator) {
|
|
906
|
-
if (array_like_or_iterator) {
|
|
907
|
-
return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
|
|
908
|
-
}
|
|
909
|
-
return [];
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
export { ASYNC as A, BOUNDARY_EFFECT as B, COMMENT_NODE as C, DERIVED as D, ERROR_VALUE as E, stringify as F, HYDRATION_START as H, INERT as I, LEGACY_PROPS as L, MAYBE_DIRTY as M, ROOT_EFFECT as R, STATE_SYMBOL as S, UNINITIALIZED as U, WAS_MARKED as W, HYDRATION_ERROR as a, DIRTY as b, CONNECTED as c, CLEAN as d, EFFECT as e, BLOCK_EFFECT as f, BRANCH_EFFECT as g, DESTROYED as h, is_passive_event as i, MANAGED_EFFECT as j, HEAD_EFFECT as k, REACTION_IS_UPDATING as l, EFFECT_RAN as m, EFFECT_PRESERVED as n, EFFECT_TRANSPARENT as o, EAGER_EFFECT as p, STALE_REACTION as q, render as r, HYDRATION_END as s, RENDER_EFFECT as t, HYDRATION_START_ELSE as u, USER_EFFECT as v, head as w, attr as x, ensure_array_like as y, attr_class as z };
|
|
913
|
-
//# sourceMappingURL=index-CXFDTUAl.js.map
|