@selvajs/selva 4.21.0-beta.21 → 4.21.0-beta.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.
Files changed (45) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/chunks/{C6zhj8Tc.js → 4yJQa0sB.js} +3 -3
  3. package/build/client/_app/immutable/chunks/4yJQa0sB.js.br +0 -0
  4. package/build/client/_app/immutable/chunks/{C6zhj8Tc.js.gz → 4yJQa0sB.js.gz} +0 -0
  5. package/build/client/_app/immutable/chunks/D6XUYEYz.js +1 -0
  6. package/build/client/_app/immutable/chunks/D6XUYEYz.js.br +1 -0
  7. package/build/client/_app/immutable/chunks/D6XUYEYz.js.gz +0 -0
  8. package/build/client/_app/immutable/entry/{app.C2KpbBu3.js → app.S4XqZiwS.js} +2 -2
  9. package/build/client/_app/immutable/entry/app.S4XqZiwS.js.br +0 -0
  10. package/build/client/_app/immutable/entry/app.S4XqZiwS.js.gz +0 -0
  11. package/build/client/_app/immutable/nodes/21.CYY9kOE5.js +1 -0
  12. package/build/client/_app/immutable/nodes/21.CYY9kOE5.js.br +0 -0
  13. package/build/client/_app/immutable/nodes/21.CYY9kOE5.js.gz +0 -0
  14. package/build/client/_app/version.json +1 -1
  15. package/build/client/_app/version.json.br +0 -0
  16. package/build/client/_app/version.json.gz +0 -0
  17. package/build/server/.vite/manifest.json +9 -0
  18. package/build/server/chunks/capture.js +1 -1
  19. package/build/server/chunks/dynamic-value-list.js +301 -0
  20. package/build/server/chunks/dynamic-value-list.js.map +1 -0
  21. package/build/server/chunks/instance.js +3 -3
  22. package/build/server/chunks/internal.js +1 -1
  23. package/build/server/chunks/package.js +2 -2
  24. package/build/server/chunks/package.js.map +1 -1
  25. package/build/server/chunks/providers.server.js +1 -1
  26. package/build/server/chunks/providers.server.js.map +1 -1
  27. package/build/server/entries/endpoints/mcp/_server.ts.js +242 -39
  28. package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
  29. package/build/server/entries/pages/library/_guid_/_page.svelte.js +3 -299
  30. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  31. package/build/server/manifest-full.js +1 -1
  32. package/build/server/manifest.js +1 -1
  33. package/build/server/nodes/21.js +1 -1
  34. package/build/server/server.js +1 -1
  35. package/package.json +9 -9
  36. package/templates/.env.example +3 -2
  37. package/build/client/_app/immutable/chunks/C36Kxzt3.js +0 -1
  38. package/build/client/_app/immutable/chunks/C36Kxzt3.js.br +0 -1
  39. package/build/client/_app/immutable/chunks/C36Kxzt3.js.gz +0 -0
  40. package/build/client/_app/immutable/chunks/C6zhj8Tc.js.br +0 -0
  41. package/build/client/_app/immutable/entry/app.C2KpbBu3.js.br +0 -0
  42. package/build/client/_app/immutable/entry/app.C2KpbBu3.js.gz +0 -0
  43. package/build/client/_app/immutable/nodes/21.C3YDbmsU.js +0 -1
  44. package/build/client/_app/immutable/nodes/21.C3YDbmsU.js.br +0 -0
  45. package/build/client/_app/immutable/nodes/21.C3YDbmsU.js.gz +0 -0
@@ -0,0 +1,301 @@
1
+ import { r as getLayoutItems } from "./traversal.js";
2
+ // ../schemas/src/dynamic-value-list.ts
3
+ function isDynamicValueListPayload(value) {
4
+ return typeof value === "object" && value !== null && ("targetInputId" in value || "options" in value);
5
+ }
6
+ /**
7
+ * Normalize a raw output value into a payload object.
8
+ *
9
+ * The local/WebSocket path delivers a real object; the Rhino.Compute path delivers the
10
+ * component's JSON output as a string (possibly double-encoded by the compute layer), so try
11
+ * to parse strings before giving up.
12
+ */
13
+ function coercePayload(value) {
14
+ if (isDynamicValueListPayload(value)) return value;
15
+ let candidate = value;
16
+ for (let i = 0; i < 2 && typeof candidate === "string"; i++) {
17
+ try {
18
+ candidate = JSON.parse(candidate);
19
+ } catch {
20
+ return null;
21
+ }
22
+ if (isDynamicValueListPayload(candidate)) return candidate;
23
+ }
24
+ return null;
25
+ }
26
+ var coerceCache = /* @__PURE__ */ new Map();
27
+ var COERCE_CACHE_MAX = 8;
28
+ function coercePayloadMemo(value) {
29
+ if (typeof value !== "string" || value.length < 1024) return coercePayload(value);
30
+ const hit = coerceCache.get(value);
31
+ if (hit !== void 0 || coerceCache.has(value)) {
32
+ coerceCache.delete(value);
33
+ coerceCache.set(value, hit ?? null);
34
+ return hit ?? null;
35
+ }
36
+ const parseStart = performance.now();
37
+ const parsed = coercePayload(value);
38
+ if (value.length > 262144) {
39
+ const optionCount = parsed?.options ? Object.keys(parsed.options).length : 0;
40
+ console.info(`[DVL] parsed ${(value.length / 1048576).toFixed(1)} MB options payload (${optionCount} options) in ${(performance.now() - parseStart).toFixed(0)}ms — cache miss`);
41
+ }
42
+ if (coerceCache.size >= COERCE_CACHE_MAX) {
43
+ const oldest = coerceCache.keys().next().value;
44
+ if (oldest !== void 0) coerceCache.delete(oldest);
45
+ }
46
+ coerceCache.set(value, parsed);
47
+ return parsed;
48
+ }
49
+ /**
50
+ * Every dynamicValueList output reference in the schema.
51
+ *
52
+ * Canonical location is `schema.outputs[]` — the plugin's SchemaSynchronizer mirrors every
53
+ * dynamicValueList layout item there (`CanonicalizeDynamicValueListOutputs`). The layout scan is
54
+ * back-compat defense for schemas persisted by an older plugin that lacked that invariant; on
55
+ * current schemas it finds nothing new. Deduped by id, `outputs[]` winning so the canonical
56
+ * record's targetInputId takes precedence.
57
+ */
58
+ function collectDynamicValueListSources(schema) {
59
+ const byId = /* @__PURE__ */ new Map();
60
+ for (const item of getLayoutItems(schema)) {
61
+ if (item.type !== "output" || item.widgetType !== "dynamicValueList") continue;
62
+ const dvl = item;
63
+ if (typeof dvl.paramId !== "string") continue;
64
+ byId.set(dvl.paramId, {
65
+ id: dvl.paramId,
66
+ targetInputId: dvl.config?.targetInputId
67
+ });
68
+ }
69
+ for (const output of schema.outputs ?? []) {
70
+ if (output.type !== "dynamicValueList") continue;
71
+ byId.set(output.id, {
72
+ id: output.id,
73
+ targetInputId: output.targetInputId
74
+ });
75
+ }
76
+ return [...byId.values()];
77
+ }
78
+ function findOptionIndex(entries, pick) {
79
+ if (typeof pick !== "string") return -1;
80
+ const wanted = pick.toLowerCase();
81
+ return entries.findIndex(([name, value]) => value.toLowerCase() === wanted || name.toLowerCase() === wanted);
82
+ }
83
+ /**
84
+ * The option value a pick resolves to, as Grasshopper resolves it in the solve: the pick if still
85
+ * offered (by value or name, ignoring case), else the first option. With no options known the
86
+ * pick passes through. `packages/schemas/fixtures/dynamic-value-list-resolution.json` pins both.
87
+ */
88
+ function resolvePick(options, pick) {
89
+ const entries = Object.entries(options ?? {});
90
+ if (entries.length === 0) return typeof pick === "string" ? pick : "";
91
+ return entries[Math.max(0, findOptionIndex(entries, pick))][1];
92
+ }
93
+ /**
94
+ * Checklist: the picks still offered, in pick order; none left gives the first option. Duplicates
95
+ * collapse by option, not by value, so two options sharing a value both stay.
96
+ */
97
+ function resolvePicks(options, picks) {
98
+ const entries = Object.entries(options ?? {});
99
+ if (entries.length === 0) return picks.filter((p) => typeof p === "string");
100
+ const kept = /* @__PURE__ */ new Set();
101
+ for (const pick of picks) {
102
+ const index = findOptionIndex(entries, pick);
103
+ if (index >= 0) kept.add(index);
104
+ }
105
+ return kept.size > 0 ? [...kept].map((i) => entries[i][1]) : [entries[0][1]];
106
+ }
107
+ /**
108
+ * A checklist edit made on the resolved picks, merged back into the stored ones: picks not offered
109
+ * now were never shown, so the edit can't have removed them, and they come back when offered again.
110
+ */
111
+ function keepHiddenPicks(options, stored, edited) {
112
+ const entries = Object.entries(options ?? {});
113
+ if (entries.length === 0 || !Array.isArray(stored)) return edited;
114
+ const hidden = stored.filter((pick) => typeof pick === "string" && findOptionIndex(entries, pick) < 0 && !edited.includes(pick));
115
+ return [...edited, ...hidden];
116
+ }
117
+ /**
118
+ * A repeated input's picks. Its value is one JSON object of row key to pick, so a pick stays with
119
+ * its row when rows come and go, and the value is a plain string on the wire. Anything else reads
120
+ * as no picks.
121
+ */
122
+ function readRowPicks(value) {
123
+ if (typeof value !== "string" || !value.trimStart().startsWith("{")) return {};
124
+ try {
125
+ const parsed = JSON.parse(value);
126
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
127
+ return Object.fromEntries(Object.entries(parsed).filter((entry) => typeof entry[1] === "string"));
128
+ } catch {
129
+ return {};
130
+ }
131
+ }
132
+ /** The repeated input's value with one row's pick set. Picks for rows not shown now are kept. */
133
+ function withRowPick(value, rowKey, pick) {
134
+ return JSON.stringify({
135
+ ...readRowPicks(value),
136
+ [rowKey]: pick
137
+ });
138
+ }
139
+ /** The options each targeted payload gives its input: one set, or the same set for every row. */
140
+ function lookUpOptions(payloads, repeatById, repeatOf) {
141
+ const options = {};
142
+ const rowOptions = {};
143
+ for (const { source, payload } of payloads) {
144
+ const target = payload.targetInputId ?? source.targetInputId;
145
+ if (!target || !payload.options || typeof payload.options !== "object") continue;
146
+ const repeat = repeatById.get(repeatOf[target]);
147
+ const offered = payload.options;
148
+ if (repeat) rowOptions[target] = repeat.rows.map(() => offered);
149
+ else options[target] = offered;
150
+ }
151
+ for (const { source, payload } of payloads) {
152
+ const repeat = repeatById.get(source.id);
153
+ const offered = payload.options;
154
+ if (!repeat || !offered || Object.keys(offered).length === 0) continue;
155
+ for (const member of repeat.members) rowOptions[member] ??= repeat.rows.map(() => offered);
156
+ }
157
+ return {
158
+ options,
159
+ rowOptions
160
+ };
161
+ }
162
+ var tableOptionsCache = /* @__PURE__ */ new WeakMap();
163
+ /**
164
+ * Narrows each pick table as Grasshopper does in the solve: an input offers the values its column
165
+ * has in the rows left by the picks before it, and resolves its own pick against those.
166
+ * `packages/schemas/fixtures/pick-table.json` pins both.
167
+ */
168
+ function narrowPickTables(payloads, values, repeatById, repeatOf) {
169
+ const options = {};
170
+ const rowOptions = {};
171
+ const shown = {};
172
+ for (const { payload } of payloads) {
173
+ const table = payload.pickTable;
174
+ if (!table || !Array.isArray(table.inputs) || !Array.isArray(table.rows)) continue;
175
+ const cache = tableOptionsCache.get(table.rows) ?? /* @__PURE__ */ new Map();
176
+ tableOptionsCache.set(table.rows, cache);
177
+ const by = Array.isArray(table.by) ? table.by : [];
178
+ const held = by.map((id) => {
179
+ const value = values[id];
180
+ return (Array.isArray(value) ? value : [value]).filter((item) => item !== void 0 && item !== null).map(String);
181
+ });
182
+ const start = Array.from({ length: Math.max(1, ...held.map((h) => h.length)) }, (_, i) => {
183
+ const picked = held.map((items) => items[Math.min(i, items.length - 1)]);
184
+ return {
185
+ rows: table.rows.filter((row) => picked.every((item, d) => item === void 0 || row[d]?.toLowerCase() === item.toLowerCase())),
186
+ picked: picked.map((item) => item ?? "")
187
+ };
188
+ });
189
+ const left = [];
190
+ table.inputs.forEach((id, index) => {
191
+ const column = by.length + index;
192
+ const parent = table.parents?.[index] ?? index - 1;
193
+ const before = parent >= 0 && left[parent] ? left[parent] : start;
194
+ const repeat = repeatById.get(repeatOf[id]);
195
+ const rowPicks = repeat ? readRowPicks(values[id]) : void 0;
196
+ const picks = repeat ? repeat.rows.map((row) => rowPicks?.[row.key]) : [values[id]];
197
+ const offeredPerRow = [];
198
+ const resolved = [];
199
+ const after = picks.map((wanted, i) => {
200
+ const { rows, picked } = before[Math.min(i, before.length - 1)];
201
+ const key = JSON.stringify([column, ...picked]);
202
+ let offered = cache.get(key);
203
+ if (!offered) {
204
+ offered = {};
205
+ for (const row of rows) {
206
+ const cell = row[column];
207
+ if (typeof cell === "string" && cell !== "") offered[cell] = cell;
208
+ }
209
+ cache.set(key, offered);
210
+ }
211
+ offeredPerRow.push(offered);
212
+ const pick = resolvePick(offered, wanted);
213
+ resolved.push(pick);
214
+ return {
215
+ rows: rows.filter((row) => row[column] === pick),
216
+ picked: [...picked, `${column}:${pick}`]
217
+ };
218
+ });
219
+ if (repeat) {
220
+ rowOptions[id] = offeredPerRow;
221
+ shown[id] = resolved;
222
+ } else {
223
+ options[id] = offeredPerRow[0];
224
+ shown[id] = resolved[0];
225
+ }
226
+ left[index] = after.length > 0 ? after : before;
227
+ });
228
+ }
229
+ return {
230
+ options,
231
+ rowOptions,
232
+ shown
233
+ };
234
+ }
235
+ /**
236
+ * What the form shows, from the payloads the last solve returned and the values on screen now.
237
+ * A pick table is narrowed by the picks on screen, so changing one updates the lists that depend
238
+ * on it without a solve.
239
+ *
240
+ * Pass the previous model to keep the identity of every array that didn't change: this runs on
241
+ * each value change, and a fresh array re-renders its whole checklist or repeat.
242
+ */
243
+ function buildFormModel(schema, values, previous) {
244
+ const payloads = [];
245
+ for (const source of collectDynamicValueListSources(schema)) {
246
+ const payload = coercePayloadMemo(values[source.id]);
247
+ if (payload) payloads.push({
248
+ source,
249
+ payload
250
+ });
251
+ }
252
+ const repeats = [];
253
+ const repeatOf = {};
254
+ for (const { source, payload } of payloads) {
255
+ if (!Array.isArray(payload.rows) || !Array.isArray(payload.members)) continue;
256
+ const rows = payload.rows.filter((r) => typeof r?.key === "string");
257
+ repeats.push({
258
+ id: source.id,
259
+ rows,
260
+ members: payload.members
261
+ });
262
+ for (const member of payload.members) repeatOf[member] = source.id;
263
+ }
264
+ const repeatById = new Map(repeats.map((r) => [r.id, r]));
265
+ const tables = narrowPickTables(payloads, values, repeatById, repeatOf);
266
+ const lookup = lookUpOptions(payloads, repeatById, repeatOf);
267
+ Object.assign(lookup.options, tables.options);
268
+ Object.assign(lookup.rowOptions, tables.rowOptions);
269
+ const shown = { ...tables.shown };
270
+ for (const { source, payload } of payloads) {
271
+ const target = payload.targetInputId ?? source.targetInputId;
272
+ if (!target || !payload.resolvedInSolve || repeatOf[target]) continue;
273
+ const value = values[target];
274
+ shown[target] = Array.isArray(value) ? resolvePicks(lookup.options[target], value) : resolvePick(lookup.options[target], value);
275
+ }
276
+ for (const repeat of repeats) for (const member of repeat.members) {
277
+ const picks = readRowPicks(values[member]);
278
+ shown[member] = repeat.rows.map((row, i) => resolvePick(lookup.rowOptions[member]?.[i], picks[row.key]));
279
+ }
280
+ if (previous) {
281
+ reuseUnchanged(shown, previous.shown);
282
+ reuseUnchanged(lookup.rowOptions, previous.rowOptions);
283
+ }
284
+ return {
285
+ ...lookup,
286
+ repeats,
287
+ repeatOf,
288
+ shown
289
+ };
290
+ }
291
+ function sameValue(a, b) {
292
+ if (a === b) return true;
293
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
294
+ return a.every((item, i) => item === b[i]);
295
+ }
296
+ function reuseUnchanged(next, previous) {
297
+ for (const key of Object.keys(next)) if (key in previous && sameValue(next[key], previous[key])) next[key] = previous[key];
298
+ }
299
+ export { keepHiddenPicks as n, withRowPick as r, buildFormModel as t };
300
+
301
+ //# sourceMappingURL=dynamic-value-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-value-list.js","names":[],"sources":["../../../../schemas/src/dynamic-value-list.ts"],"sourcesContent":["import type { UISchema, OutputDynamicValueListLayoutItem } from './generated/index.js';\nimport { getLayoutItems } from './traversal.js';\n\n/**\n * The runtime payload a dynamic value list output produces, keyed by the output's id in `values`.\n * Routed back into the dynamic value list input identified by `targetInputId`.\n */\nexport interface DynamicValueListPayload {\n\ttargetInputId?: string | null;\n\t/** On a Repeat: what every row of a member offers, unless another payload fills that member. */\n\toptions?: Record<string, string>;\n\t/** Repeat: one entry per row, in order. */\n\trows?: RepeatRow[] | null;\n\t/** Repeat: the inputs shown once per row. Each value is a JSON object of row key to pick. */\n\tmembers?: string[] | null;\n\t/**\n\t * The output is wired into its target, so Grasshopper resolves the target's pick in the same\n\t * solve. The form shows the resolved pick and never sends a correction.\n\t */\n\tresolvedInSolve?: boolean | null;\n\t/** Options Table: the valid combinations for a set of inputs. */\n\tpickTable?: PickTable | null;\n}\n\n/**\n * The valid combinations for a set of inputs. Each input offers the values its cell still has in\n * the rows matching the picks it depends on: the `by` inputs, then its parent, its parent's parent\n * and so on.\n */\nexport interface PickTable {\n\t/** Ids of the inputs that narrow the rows without being filled from them. */\n\tby?: string[] | null;\n\t/** Ids of the inputs the table fills, a parent before its children. */\n\tinputs: string[];\n\t/**\n\t * For each of `inputs`, the index of the input whose pick it narrows on, or -1 for one that only\n\t * `by` narrows. Absent: one chain, each input narrowing on the one before it.\n\t */\n\tparents?: number[] | null;\n\t/** One entry per valid combination: a cell for each of `by`, then one for each of `inputs`. */\n\trows: string[][];\n}\n\nexport interface RepeatRow {\n\tkey: string;\n\tlabel?: string | null;\n\tsection?: string | null;\n}\n\nfunction isDynamicValueListPayload(value: unknown): value is DynamicValueListPayload {\n\treturn (\n\t\ttypeof value === 'object' && value !== null && ('targetInputId' in value || 'options' in value)\n\t);\n}\n\n/**\n * Normalize a raw output value into a payload object.\n *\n * The local/WebSocket path delivers a real object; the Rhino.Compute path delivers the\n * component's JSON output as a string (possibly double-encoded by the compute layer), so try\n * to parse strings before giving up.\n */\nfunction coercePayload(value: unknown): DynamicValueListPayload | null {\n\tif (isDynamicValueListPayload(value)) return value;\n\n\tlet candidate = value;\n\t// Unwrap up to two layers of JSON string encoding (compute may quote the string output).\n\tfor (let i = 0; i < 2 && typeof candidate === 'string'; i++) {\n\t\ttry {\n\t\t\tcandidate = JSON.parse(candidate);\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t\tif (isDynamicValueListPayload(candidate)) return candidate;\n\t}\n\n\treturn null;\n}\n\n// Memoizes string-payload coercion. In compute mode the payload arrives as a JSON\n// string — several MB for a large options list — and the options map is derived from\n// `values` (TabLayout), so it recomputes on EVERY value change. Unmemoized, each\n// keystroke re-parses megabytes and allocates a fresh options object whose new\n// identity re-renders the whole dropdown subtree; a 6.4 MB payload drove a tab OOM.\n// Map keys use SameValueZero, so an identical string from a later solve also hits.\nconst coerceCache = new Map<string, DynamicValueListPayload | null>();\nconst COERCE_CACHE_MAX = 8;\n\nfunction coercePayloadMemo(value: unknown): DynamicValueListPayload | null {\n\t// Only string payloads are expensive (JSON.parse); objects pass straight through.\n\tif (typeof value !== 'string' || value.length < 1024) return coercePayload(value);\n\tconst hit = coerceCache.get(value);\n\tif (hit !== undefined || coerceCache.has(value)) {\n\t\t// Refresh LRU position.\n\t\tcoerceCache.delete(value);\n\t\tcoerceCache.set(value, hit ?? null);\n\t\treturn hit ?? null;\n\t}\n\tconst parseStart = performance.now();\n\tconst parsed = coercePayload(value);\n\t// An expensive parse should happen ONCE per distinct solve result. If this line\n\t// storms the console, memoization is being defeated (payload strings differing\n\t// per recompute) — the churn pattern that could OOM a tab.\n\tif (value.length > 256 * 1024) {\n\t\tconst optionCount = parsed?.options ? Object.keys(parsed.options).length : 0;\n\t\tconsole.info(\n\t\t\t`[DVL] parsed ${(value.length / (1024 * 1024)).toFixed(1)} MB options payload ` +\n\t\t\t\t`(${optionCount} options) in ${(performance.now() - parseStart).toFixed(0)}ms — cache miss`\n\t\t);\n\t}\n\tif (coerceCache.size >= COERCE_CACHE_MAX) {\n\t\tconst oldest = coerceCache.keys().next().value;\n\t\tif (oldest !== undefined) coerceCache.delete(oldest);\n\t}\n\tcoerceCache.set(value, parsed);\n\treturn parsed;\n}\n\n/** One DynVL routing source: the id keying `values`, plus the schema-side target fallback. */\ninterface DynamicValueListSource {\n\tid: string;\n\ttargetInputId?: string | null;\n}\n\n/**\n * Every dynamicValueList output reference in the schema.\n *\n * Canonical location is `schema.outputs[]` — the plugin's SchemaSynchronizer mirrors every\n * dynamicValueList layout item there (`CanonicalizeDynamicValueListOutputs`). The layout scan is\n * back-compat defense for schemas persisted by an older plugin that lacked that invariant; on\n * current schemas it finds nothing new. Deduped by id, `outputs[]` winning so the canonical\n * record's targetInputId takes precedence.\n */\nfunction collectDynamicValueListSources(schema: UISchema): DynamicValueListSource[] {\n\tconst byId = new Map<string, DynamicValueListSource>();\n\n\tfor (const item of getLayoutItems(schema)) {\n\t\tif (item.type !== 'output' || item.widgetType !== 'dynamicValueList') continue;\n\t\tconst dvl = item as OutputDynamicValueListLayoutItem;\n\t\tif (typeof dvl.paramId !== 'string') continue;\n\t\tbyId.set(dvl.paramId, { id: dvl.paramId, targetInputId: dvl.config?.targetInputId });\n\t}\n\n\tfor (const output of schema.outputs ?? []) {\n\t\tif (output.type !== 'dynamicValueList') continue;\n\t\tbyId.set(output.id, { id: output.id, targetInputId: output.targetInputId });\n\t}\n\n\treturn [...byId.values()];\n}\n\n/**\n * Build a map of `inputId -> computed options` from the solved output values.\n *\n * Reads each dynamicValueList source's `{ targetInputId, options }` payload from `values` and routes\n * the options to the targeted input. The payload's own `targetInputId` wins; the schema-side\n * `targetInputId` is the fallback when the payload omits it.\n */\nexport function buildDynamicValueListOptions(\n\tschema: UISchema,\n\tvalues: Record<string, unknown>\n): Record<string, Record<string, string>> {\n\treturn buildFormModel(schema, values).options;\n}\n\n// ============================================================================\n// Pick tables, repeats, and picks resolved in the solve\n// ============================================================================\n\nexport interface RepeatSpec {\n\t/** The Repeat output's id. */\n\tid: string;\n\trows: RepeatRow[];\n\tmembers: string[];\n}\n\nexport interface FormModel {\n\t/** Options for each input shown once, keyed by input id. */\n\toptions: Record<string, Record<string, string>>;\n\t/** Options for each row of a repeated input, keyed by input id. */\n\trowOptions: Record<string, Record<string, string>[]>;\n\trepeats: RepeatSpec[];\n\t/** The repeat each member input belongs to. */\n\trepeatOf: Record<string, string>;\n\t/**\n\t * What each input Grasshopper resolves in the solve shows, which is also what the solve uses:\n\t * the pick if still offered, else the first option; one per row for a repeated input.\n\t */\n\tshown: Record<string, unknown>;\n}\n\nfunction findOptionIndex(entries: [string, string][], pick: unknown): number {\n\tif (typeof pick !== 'string') return -1;\n\tconst wanted = pick.toLowerCase();\n\treturn entries.findIndex(\n\t\t([name, value]) => value.toLowerCase() === wanted || name.toLowerCase() === wanted\n\t);\n}\n\n/**\n * The option value a pick resolves to, as Grasshopper resolves it in the solve: the pick if still\n * offered (by value or name, ignoring case), else the first option. With no options known the\n * pick passes through. `packages/schemas/fixtures/dynamic-value-list-resolution.json` pins both.\n */\nexport function resolvePick(options: Record<string, string> | undefined, pick: unknown): string {\n\tconst entries = Object.entries(options ?? {});\n\tif (entries.length === 0) return typeof pick === 'string' ? pick : '';\n\treturn entries[Math.max(0, findOptionIndex(entries, pick))][1];\n}\n\n/**\n * Checklist: the picks still offered, in pick order; none left gives the first option. Duplicates\n * collapse by option, not by value, so two options sharing a value both stay.\n */\nexport function resolvePicks(\n\toptions: Record<string, string> | undefined,\n\tpicks: unknown[]\n): string[] {\n\tconst entries = Object.entries(options ?? {});\n\tif (entries.length === 0) return picks.filter((p): p is string => typeof p === 'string');\n\tconst kept = new Set<number>();\n\tfor (const pick of picks) {\n\t\tconst index = findOptionIndex(entries, pick);\n\t\tif (index >= 0) kept.add(index);\n\t}\n\treturn kept.size > 0 ? [...kept].map((i) => entries[i][1]) : [entries[0][1]];\n}\n\n/**\n * A checklist edit made on the resolved picks, merged back into the stored ones: picks not offered\n * now were never shown, so the edit can't have removed them, and they come back when offered again.\n */\nexport function keepHiddenPicks(\n\toptions: Record<string, string> | undefined,\n\tstored: unknown,\n\tedited: string[]\n): string[] {\n\tconst entries = Object.entries(options ?? {});\n\tif (entries.length === 0 || !Array.isArray(stored)) return edited;\n\tconst hidden = stored.filter(\n\t\t(pick): pick is string =>\n\t\t\ttypeof pick === 'string' && findOptionIndex(entries, pick) < 0 && !edited.includes(pick)\n\t);\n\treturn [...edited, ...hidden];\n}\n\n/**\n * A repeated input's picks. Its value is one JSON object of row key to pick, so a pick stays with\n * its row when rows come and go, and the value is a plain string on the wire. Anything else reads\n * as no picks.\n */\nexport function readRowPicks(value: unknown): Record<string, string> {\n\tif (typeof value !== 'string' || !value.trimStart().startsWith('{')) return {};\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(value);\n\t\tif (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return {};\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(parsed).filter(\n\t\t\t\t(entry): entry is [string, string] => typeof entry[1] === 'string'\n\t\t\t)\n\t\t);\n\t} catch {\n\t\treturn {};\n\t}\n}\n\n/** The repeated input's value with one row's pick set. Picks for rows not shown now are kept. */\nexport function withRowPick(value: unknown, rowKey: string, pick: string): string {\n\treturn JSON.stringify({ ...readRowPicks(value), [rowKey]: pick });\n}\n\ninterface Lookup {\n\toptions: FormModel['options'];\n\trowOptions: FormModel['rowOptions'];\n}\n\ninterface SourcedPayload {\n\tsource: DynamicValueListSource;\n\tpayload: DynamicValueListPayload;\n}\n\n/** The options each targeted payload gives its input: one set, or the same set for every row. */\nfunction lookUpOptions(\n\tpayloads: SourcedPayload[],\n\trepeatById: Map<string, RepeatSpec>,\n\trepeatOf: Record<string, string>\n): Lookup {\n\tconst options: Lookup['options'] = {};\n\tconst rowOptions: Lookup['rowOptions'] = {};\n\n\tfor (const { source, payload } of payloads) {\n\t\tconst target = payload.targetInputId ?? source.targetInputId;\n\t\tif (!target || !payload.options || typeof payload.options !== 'object') continue;\n\t\tconst repeat = repeatById.get(repeatOf[target]);\n\t\tconst offered = payload.options;\n\t\tif (repeat) rowOptions[target] = repeat.rows.map(() => offered);\n\t\telse options[target] = offered;\n\t}\n\n\t// A Repeat's own options are for the members nothing else fills.\n\tfor (const { source, payload } of payloads) {\n\t\tconst repeat = repeatById.get(source.id);\n\t\tconst offered = payload.options;\n\t\tif (!repeat || !offered || Object.keys(offered).length === 0) continue;\n\t\tfor (const member of repeat.members) {\n\t\t\trowOptions[member] ??= repeat.rows.map(() => offered);\n\t\t}\n\t}\n\n\treturn { options, rowOptions };\n}\n\n// One options object per column and set of earlier picks, per table. This runs on every value\n// change, and a fresh object re-renders the dropdown it feeds.\nconst tableOptionsCache = new WeakMap<string[][], Map<string, Record<string, string>>>();\n\n/**\n * Narrows each pick table as Grasshopper does in the solve: an input offers the values its column\n * has in the rows left by the picks before it, and resolves its own pick against those.\n * `packages/schemas/fixtures/pick-table.json` pins both.\n */\nfunction narrowPickTables(\n\tpayloads: SourcedPayload[],\n\tvalues: Record<string, unknown>,\n\trepeatById: Map<string, RepeatSpec>,\n\trepeatOf: Record<string, string>\n): Lookup & { shown: Record<string, unknown> } {\n\tconst options: Lookup['options'] = {};\n\tconst rowOptions: Lookup['rowOptions'] = {};\n\tconst shown: Record<string, unknown> = {};\n\n\tfor (const { payload } of payloads) {\n\t\tconst table = payload.pickTable;\n\t\tif (!table || !Array.isArray(table.inputs) || !Array.isArray(table.rows)) continue;\n\n\t\tconst cache = tableOptionsCache.get(table.rows) ?? new Map<string, Record<string, string>>();\n\t\ttableOptionsCache.set(table.rows, cache);\n\n\t\t// The rows left by a run of picks, and those picks: one entry, or one per row of a repeat.\n\t\t// Row i reads entry i, the last entry covering the rest, so a repeated input after a single\n\t\t// one starts every row from the same rows.\n\t\ttype Left = { rows: string[][]; picked: string[] }[];\n\n\t\t// Where an input with no parent starts: the rows matching what the `by` inputs hold. A `by`\n\t\t// input holding several items (a repeated one) gives one entry per item. Cells match\n\t\t// ignoring case, so a table may say True where a toggle sends true; no value yet narrows\n\t\t// nothing.\n\t\tconst by = Array.isArray(table.by) ? table.by : [];\n\t\tconst held = by.map((id) => {\n\t\t\tconst value = values[id];\n\t\t\tconst items = Array.isArray(value) ? value : [value];\n\t\t\treturn items.filter((item) => item !== undefined && item !== null).map(String);\n\t\t});\n\t\tconst start: Left = Array.from(\n\t\t\t{ length: Math.max(1, ...held.map((h) => h.length)) },\n\t\t\t(_, i) => {\n\t\t\t\tconst picked = held.map((items) => items[Math.min(i, items.length - 1)]);\n\t\t\t\tconst rows = table.rows.filter((row) =>\n\t\t\t\t\tpicked.every(\n\t\t\t\t\t\t(item, d) => item === undefined || row[d]?.toLowerCase() === item.toLowerCase()\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\treturn { rows, picked: picked.map((item) => item ?? '') };\n\t\t\t}\n\t\t);\n\n\t\tconst left: Left[] = [];\n\t\ttable.inputs.forEach((id, index) => {\n\t\t\tconst column = by.length + index;\n\t\t\t// Without `parents` the inputs are one chain, each narrowing on the one before it.\n\t\t\tconst parent = table.parents?.[index] ?? index - 1;\n\t\t\tconst before = parent >= 0 && left[parent] ? left[parent] : start;\n\n\t\t\tconst repeat = repeatById.get(repeatOf[id]);\n\t\t\tconst rowPicks = repeat ? readRowPicks(values[id]) : undefined;\n\t\t\tconst picks = repeat ? repeat.rows.map((row) => rowPicks?.[row.key]) : [values[id]];\n\n\t\t\tconst offeredPerRow: Record<string, string>[] = [];\n\t\t\tconst resolved: string[] = [];\n\t\t\tconst after = picks.map((wanted, i) => {\n\t\t\t\tconst { rows, picked } = before[Math.min(i, before.length - 1)];\n\t\t\t\tconst key = JSON.stringify([column, ...picked]);\n\t\t\t\tlet offered = cache.get(key);\n\t\t\t\tif (!offered) {\n\t\t\t\t\toffered = {};\n\t\t\t\t\tfor (const row of rows) {\n\t\t\t\t\t\tconst cell = row[column];\n\t\t\t\t\t\tif (typeof cell === 'string' && cell !== '') offered[cell] = cell;\n\t\t\t\t\t}\n\t\t\t\t\tcache.set(key, offered);\n\t\t\t\t}\n\n\t\t\t\tofferedPerRow.push(offered);\n\t\t\t\tconst pick = resolvePick(offered, wanted);\n\t\t\t\tresolved.push(pick);\n\t\t\t\t// The column joins the picks: two inputs narrowing on the same ones offer different cells.\n\t\t\t\treturn {\n\t\t\t\t\trows: rows.filter((row) => row[column] === pick),\n\t\t\t\t\tpicked: [...picked, `${column}:${pick}`]\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tif (repeat) {\n\t\t\t\trowOptions[id] = offeredPerRow;\n\t\t\t\tshown[id] = resolved;\n\t\t\t} else {\n\t\t\t\toptions[id] = offeredPerRow[0];\n\t\t\t\tshown[id] = resolved[0];\n\t\t\t}\n\t\t\t// A repeat with no rows shows nothing; the inputs after it still start from what was left.\n\t\t\tleft[index] = after.length > 0 ? after : before;\n\t\t});\n\t}\n\n\treturn { options, rowOptions, shown };\n}\n\n/**\n * What the form shows, from the payloads the last solve returned and the values on screen now.\n * A pick table is narrowed by the picks on screen, so changing one updates the lists that depend\n * on it without a solve.\n *\n * Pass the previous model to keep the identity of every array that didn't change: this runs on\n * each value change, and a fresh array re-renders its whole checklist or repeat.\n */\nexport function buildFormModel(\n\tschema: UISchema,\n\tvalues: Record<string, unknown>,\n\tprevious?: FormModel\n): FormModel {\n\tconst payloads: SourcedPayload[] = [];\n\tfor (const source of collectDynamicValueListSources(schema)) {\n\t\tconst payload = coercePayloadMemo(values[source.id]);\n\t\tif (payload) payloads.push({ source, payload });\n\t}\n\n\tconst repeats: RepeatSpec[] = [];\n\tconst repeatOf: Record<string, string> = {};\n\tfor (const { source, payload } of payloads) {\n\t\tif (!Array.isArray(payload.rows) || !Array.isArray(payload.members)) continue;\n\t\tconst rows = payload.rows.filter((r): r is RepeatRow => typeof r?.key === 'string');\n\t\trepeats.push({ id: source.id, rows, members: payload.members });\n\t\tfor (const member of payload.members) repeatOf[member] = source.id;\n\t}\n\tconst repeatById = new Map(repeats.map((r) => [r.id, r]));\n\n\tconst tables = narrowPickTables(payloads, values, repeatById, repeatOf);\n\tconst lookup = lookUpOptions(payloads, repeatById, repeatOf);\n\tObject.assign(lookup.options, tables.options);\n\tObject.assign(lookup.rowOptions, tables.rowOptions);\n\n\tconst shown: Record<string, unknown> = { ...tables.shown };\n\tfor (const { source, payload } of payloads) {\n\t\tconst target = payload.targetInputId ?? source.targetInputId;\n\t\tif (!target || !payload.resolvedInSolve || repeatOf[target]) continue;\n\t\tconst value = values[target];\n\t\tshown[target] = Array.isArray(value)\n\t\t\t? resolvePicks(lookup.options[target], value)\n\t\t\t: resolvePick(lookup.options[target], value);\n\t}\n\tfor (const repeat of repeats) {\n\t\tfor (const member of repeat.members) {\n\t\t\tconst picks = readRowPicks(values[member]);\n\t\t\tshown[member] = repeat.rows.map((row, i) =>\n\t\t\t\tresolvePick(lookup.rowOptions[member]?.[i], picks[row.key])\n\t\t\t);\n\t\t}\n\t}\n\n\tif (previous) {\n\t\treuseUnchanged(shown, previous.shown);\n\t\treuseUnchanged(lookup.rowOptions, previous.rowOptions);\n\t}\n\treturn { ...lookup, repeats, repeatOf, shown };\n}\n\nfunction sameValue(a: unknown, b: unknown): boolean {\n\tif (a === b) return true;\n\tif (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n\treturn a.every((item, i) => item === b[i]);\n}\n\nfunction reuseUnchanged(next: Record<string, unknown>, previous: Record<string, unknown>) {\n\tfor (const key of Object.keys(next)) {\n\t\tif (key in previous && sameValue(next[key], previous[key])) next[key] = previous[key];\n\t}\n}\n"],"mappings":";;AAiDA,SAAS,0BAA0B,OAAkD;CACpF,OACC,OAAO,UAAU,YAAY,UAAU,SAAS,mBAAmB,SAAS,aAAa;AAE3F;;;;;;;;AASA,SAAS,cAAc,OAAgD;CACtE,IAAI,0BAA0B,KAAK,GAAG,OAAO;CAE7C,IAAI,YAAY;CAEhB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,OAAO,cAAc,UAAU,KAAK;EAC5D,IAAI;GACH,YAAY,KAAK,MAAM,SAAS;EACjC,QAAQ;GACP,OAAO;EACR;EACA,IAAI,0BAA0B,SAAS,GAAG,OAAO;CAClD;CAEA,OAAO;AACR;AAQA,IAAM,8BAAc,IAAI,IAA4C;AACpE,IAAM,mBAAmB;AAEzB,SAAS,kBAAkB,OAAgD;CAE1E,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,MAAM,OAAO,cAAc,KAAK;CAChF,MAAM,MAAM,YAAY,IAAI,KAAK;CACjC,IAAI,QAAQ,KAAA,KAAa,YAAY,IAAI,KAAK,GAAG;EAEhD,YAAY,OAAO,KAAK;EACxB,YAAY,IAAI,OAAO,OAAO,IAAI;EAClC,OAAO,OAAO;CACf;CACA,MAAM,aAAa,YAAY,IAAI;CACnC,MAAM,SAAS,cAAc,KAAK;CAIlC,IAAI,MAAM,SAAS,QAAY;EAC9B,MAAM,cAAc,QAAQ,UAAU,OAAO,KAAK,OAAO,OAAO,CAAC,CAAC,SAAS;EAC3E,QAAQ,KACP,iBAAiB,MAAM,SAAU,QAAA,CAAc,QAAQ,CAAC,EAAE,uBACrD,YAAY,gBAAgB,YAAY,IAAI,IAAI,WAAA,CAAY,QAAQ,CAAC,EAAE,gBAC7E;CACD;CACA,IAAI,YAAY,QAAQ,kBAAkB;EACzC,MAAM,SAAS,YAAY,KAAK,CAA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KAAK,MAAM,SAAS,IAAI,GAAG,KAAK,OAAO,SAAS;AAEnF"}
@@ -213,7 +213,7 @@ function server_data_serializer(event, state) {
213
213
  let promise_id = 1;
214
214
  let max_nodes = -1;
215
215
  const iterator = create_async_iterator();
216
- const global = "__sveltekit_1nmwjui";
216
+ const global = "__sveltekit_1hsa6gj";
217
217
  /** @param {number} index */
218
218
  function get_replacer(index) {
219
219
  /** @param {any} thing */
@@ -1443,7 +1443,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1443
1443
  "crossorigin"
1444
1444
  ]);
1445
1445
  }
1446
- const global = "__sveltekit_1nmwjui";
1446
+ const global = "__sveltekit_1hsa6gj";
1447
1447
  const { data, chunks } = data_serializer.get_data(csp);
1448
1448
  if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!(state.prerendering || state.prerender_default === true))).join("\n ")}`;
1449
1449
  if (page_config.csr && client) {
@@ -1467,7 +1467,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1467
1467
  }
1468
1468
  }
1469
1469
  const blocks = [];
1470
- const properties = [`base: ${base_expression}`, `version: ${s("1795161958304")}`];
1470
+ const properties = [`base: ${base_expression}`, `version: ${s("1795167898151")}`];
1471
1471
  if (assets) properties.push(`assets: ${s(assets)}`);
1472
1472
  if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : uneval$1(rendered_env)}`);
1473
1473
  if (chunks) {
@@ -2363,7 +2363,7 @@ function redirect_response(status, location) {
2363
2363
  * @param {Response} response
2364
2364
  */
2365
2365
  function with_version_header(response) {
2366
- response.headers.set("x-sveltekit-version", "1795161958304");
2366
+ response.headers.set("x-sveltekit-version", "1795167898151");
2367
2367
  return response;
2368
2368
  }
2369
2369
  /**
@@ -1,6 +1,6 @@
1
1
  var package_default = {
2
2
  name: "@selvajs/selva",
3
- version: "4.21.0-beta.21",
3
+ version: "4.21.0-beta.22",
4
4
  description: "Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.",
5
5
  license: "MIT",
6
6
  author: "VektorNode",
@@ -28,7 +28,7 @@ var package_default = {
28
28
  scripts: {
29
29
  "dev": "vite dev",
30
30
  "dev:lan": "vite dev --host",
31
- "build": "rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js",
31
+ "build": "rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js && node ./scripts/check-build-assets.js",
32
32
  "preview": "vite preview",
33
33
  "start": "node build/index.js",
34
34
  "clean": "rimraf build templates",
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.21\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 3\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"playwright-core\": \"catalog:\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.22\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 3\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js && node ./scripts/check-build-assets.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"playwright-core\": \"catalog:\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
@@ -35684,7 +35684,7 @@ var APP_SETTINGS = composeManifest([
35684
35684
  default: "",
35685
35685
  onInvalid: "default",
35686
35686
  class: "setting",
35687
- description: "Chromium or Chrome executable that selva_capture_preview renders with. Empty: the one `npx playwright install chromium` installs."
35687
+ description: "Chromium or Chrome executable that selva_capture_preview renders with. Empty: Playwright's own Chromium, else an installed Chrome, Edge or distro Chromium."
35688
35688
  }),
35689
35689
  defineSetting({
35690
35690
  key: "LOG_LEVEL",