@niscorp/loom 0.1.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.
Files changed (76) hide show
  1. package/DESIGN.md +253 -0
  2. package/LICENSE +202 -0
  3. package/README.md +101 -0
  4. package/dist/chunk-A3UOFGL4.js +29 -0
  5. package/dist/chunk-A3UOFGL4.js.map +1 -0
  6. package/dist/chunk-D743DI5J.js +17 -0
  7. package/dist/chunk-D743DI5J.js.map +1 -0
  8. package/dist/chunk-DWQWPBBV.js +63 -0
  9. package/dist/chunk-DWQWPBBV.js.map +1 -0
  10. package/dist/chunk-LWY5TG7M.js +208 -0
  11. package/dist/chunk-LWY5TG7M.js.map +1 -0
  12. package/dist/chunk-MIRMQPUE.js +132 -0
  13. package/dist/chunk-MIRMQPUE.js.map +1 -0
  14. package/dist/chunk-PTXRAWJX.js +58 -0
  15. package/dist/chunk-PTXRAWJX.js.map +1 -0
  16. package/dist/chunk-TV4U22MY.js +176 -0
  17. package/dist/chunk-TV4U22MY.js.map +1 -0
  18. package/dist/chunk-X7PCPONB.js +380 -0
  19. package/dist/chunk-X7PCPONB.js.map +1 -0
  20. package/dist/chunk-XTY7XO5C.js +61 -0
  21. package/dist/chunk-XTY7XO5C.js.map +1 -0
  22. package/dist/index.cjs +630 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.d.cts +40 -0
  25. package/dist/index.d.ts +40 -0
  26. package/dist/index.js +6 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/loom-editor-CQ_GI4IA.d.cts +27 -0
  29. package/dist/loom-editor-D5SBQ4_F.d.ts +27 -0
  30. package/dist/plugins/nova/index.cjs +81 -0
  31. package/dist/plugins/nova/index.cjs.map +1 -0
  32. package/dist/plugins/nova/index.d.cts +14 -0
  33. package/dist/plugins/nova/index.d.ts +14 -0
  34. package/dist/plugins/nova/index.js +5 -0
  35. package/dist/plugins/nova/index.js.map +1 -0
  36. package/dist/plugins/nova/react/index.cjs +107 -0
  37. package/dist/plugins/nova/react/index.cjs.map +1 -0
  38. package/dist/plugins/nova/react/index.d.cts +17 -0
  39. package/dist/plugins/nova/react/index.d.ts +17 -0
  40. package/dist/plugins/nova/react/index.js +36 -0
  41. package/dist/plugins/nova/react/index.js.map +1 -0
  42. package/dist/plugins/prism/index.cjs +48 -0
  43. package/dist/plugins/prism/index.cjs.map +1 -0
  44. package/dist/plugins/prism/index.d.cts +18 -0
  45. package/dist/plugins/prism/index.d.ts +18 -0
  46. package/dist/plugins/prism/index.js +4 -0
  47. package/dist/plugins/prism/index.js.map +1 -0
  48. package/dist/plugins/prism/react/index.cjs +744 -0
  49. package/dist/plugins/prism/react/index.cjs.map +1 -0
  50. package/dist/plugins/prism/react/index.d.cts +12 -0
  51. package/dist/plugins/prism/react/index.d.ts +12 -0
  52. package/dist/plugins/prism/react/index.js +419 -0
  53. package/dist/plugins/prism/react/index.js.map +1 -0
  54. package/dist/plugins/vex/index.cjs +67 -0
  55. package/dist/plugins/vex/index.cjs.map +1 -0
  56. package/dist/plugins/vex/index.d.cts +25 -0
  57. package/dist/plugins/vex/index.d.ts +25 -0
  58. package/dist/plugins/vex/index.js +4 -0
  59. package/dist/plugins/vex/index.js.map +1 -0
  60. package/dist/plugins/vex/react/index.cjs +432 -0
  61. package/dist/plugins/vex/react/index.cjs.map +1 -0
  62. package/dist/plugins/vex/react/index.d.cts +13 -0
  63. package/dist/plugins/vex/react/index.d.ts +13 -0
  64. package/dist/plugins/vex/react/index.js +296 -0
  65. package/dist/plugins/vex/react/index.js.map +1 -0
  66. package/dist/react/index.cjs +1076 -0
  67. package/dist/react/index.cjs.map +1 -0
  68. package/dist/react/index.d.cts +82 -0
  69. package/dist/react/index.d.ts +82 -0
  70. package/dist/react/index.js +120 -0
  71. package/dist/react/index.js.map +1 -0
  72. package/dist/schema--OhtatTX.d.cts +10 -0
  73. package/dist/schema--OhtatTX.d.ts +10 -0
  74. package/dist/types-BonjN3CB.d.cts +144 -0
  75. package/dist/types-BonjN3CB.d.ts +144 -0
  76. package/package.json +144 -0
@@ -0,0 +1,744 @@
1
+ 'use strict';
2
+
3
+ var prism$1 = require('@niscorp/prism');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var react = require('react');
6
+ var react$1 = require('@niscorp/nova/adapters/react');
7
+
8
+ // src/plugins/prism/index.ts
9
+
10
+ // src/editor/view.ts
11
+ var mountView = (editor, action, read) => {
12
+ const { shell } = editor;
13
+ shell.registerAction(action);
14
+ shell.addCanvas({ id: action.id, initial: action.id });
15
+ const instance = shell.getCanvasState(action.id).active?.id;
16
+ if (instance === void 0) return;
17
+ const sync = () => {
18
+ shell.getRuntime(instance)?.setData(read(editor));
19
+ };
20
+ editor.on("change", sync);
21
+ sync();
22
+ };
23
+
24
+ // src/plugins/prism/preview.layout.ts
25
+ var PREVIEW = "prism:preview";
26
+ var previewLayout = {
27
+ component: PREVIEW,
28
+ props: { config: "$.config" }
29
+ };
30
+
31
+ // src/plugins/prism/preview.action.ts
32
+ var previewAction = {
33
+ id: PREVIEW,
34
+ layout: previewLayout,
35
+ data: { config: null }
36
+ };
37
+
38
+ // src/plugins/prism/index.ts
39
+ var NODE = "prism:node";
40
+ var prismPlugin = (options) => ({
41
+ name: "prism",
42
+ documents: { config: options.schema ?? prism$1.NodeSchema },
43
+ widgets: [{ role: NODE, match: (field) => field.kind === "union" && field.path === "" }],
44
+ mount: (editor) => mountView(editor, previewAction, (e) => ({ config: e.documents["config"] }))
45
+ });
46
+ var mono = "ui-monospace, SFMono-Regular, Menlo, monospace";
47
+ var Note = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, color: "#6b7280", padding: 12 }, children });
48
+ var jsonStyle = (tone) => ({
49
+ margin: 0,
50
+ padding: 12,
51
+ borderRadius: 6,
52
+ fontSize: 12,
53
+ fontFamily: mono,
54
+ whiteSpace: "pre-wrap",
55
+ wordBreak: "break-word",
56
+ maxHeight: 320,
57
+ overflow: "auto",
58
+ border: "1px solid #e5e7eb",
59
+ background: tone === "error" ? "#fef2f2" : tone === "muted" ? "#f9fafb" : "#ffffff",
60
+ color: tone === "error" ? "#991b1b" : "#1f2937"
61
+ });
62
+ var head = { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: 0.4, color: "#6b7280", margin: "0 0 4px" };
63
+ var Panel = ({ label: label2, tone = "plain", children }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
64
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: head, children: label2 }),
65
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { style: jsonStyle(tone), children })
66
+ ] });
67
+ var show = (value) => JSON.stringify(value, null, 2);
68
+ var makePreview = (input2) => {
69
+ const Preview = ({ config }) => {
70
+ if (config === null || config === void 0) return /* @__PURE__ */ jsxRuntime.jsx(Note, { children: "Edit the config to see its output." });
71
+ const parsed = prism$1.ConfigSchema.safeParse(config);
72
+ const result = parsed.success ? prism$1.evaluateSafe(parsed.data, input2) : void 0;
73
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
74
+ /* @__PURE__ */ jsxRuntime.jsx(Panel, { label: "Input", tone: "muted", children: show(input2) }),
75
+ !parsed.success ? /* @__PURE__ */ jsxRuntime.jsx(Panel, { label: "Output", tone: "error", children: parsed.error.message }) : result !== void 0 && result.ok ? /* @__PURE__ */ jsxRuntime.jsx(Panel, { label: "Output", children: show(result.data) }) : /* @__PURE__ */ jsxRuntime.jsx(Panel, { label: "Output", tone: "error", children: result !== void 0 && !result.ok ? result.error.message : "" })
76
+ ] });
77
+ };
78
+ return Preview;
79
+ };
80
+
81
+ // src/compile/parse.ts
82
+ var defOf = (schema) => schema.def;
83
+ var INTEGER_FORMAT = "safeint";
84
+ var stringFormat = (schema) => {
85
+ const def = defOf(schema);
86
+ if (def.format !== void 0) return def.format;
87
+ for (const check of def.checks ?? []) {
88
+ if (check.def?.format !== void 0) return check.def.format;
89
+ }
90
+ return void 0;
91
+ };
92
+ var isInteger = (schema) => {
93
+ const def = defOf(schema);
94
+ if (def.format === INTEGER_FORMAT) return true;
95
+ return (def.checks ?? []).some((check) => check.def?.format === INTEGER_FORMAT);
96
+ };
97
+ var enumOptions = (schema) => Object.values(defOf(schema).entries ?? {}).map((value) => ({ value, label: String(value) }));
98
+ var objectFields = (schema, walk) => Object.entries(defOf(schema).shape ?? {}).map(([key, value]) => ({
99
+ key,
100
+ // A property is optional when the schema accepts `undefined` for it
101
+ // (covers `.optional()` and `.default()`) — asked of Zod, not inferred.
102
+ required: !value.safeParse(void 0).success,
103
+ field: parseField(value, walk)
104
+ }));
105
+ var branchKeys = (branch) => Object.keys(defOf(branch).shape ?? {});
106
+ var JSON_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "object", "array", "null"]);
107
+ var jsonType = (branch) => {
108
+ const type = defOf(branch).type;
109
+ return JSON_TYPES.has(type) ? type : void 0;
110
+ };
111
+ var distinguish = (branch, siblings, tag2) => {
112
+ if (tag2 !== void 0) {
113
+ const literal = (defOf(branch).shape ?? {})[tag2];
114
+ return { kind: "tag", key: tag2, value: literal !== void 0 ? defOf(literal).values?.[0] : void 0 };
115
+ }
116
+ const elsewhere = new Set(siblings.flatMap(branchKeys));
117
+ const key = branchKeys(branch).find((k) => !elsewhere.has(k));
118
+ if (key !== void 0) return { kind: "key", key };
119
+ const type = jsonType(branch);
120
+ if (type !== void 0 && siblings.every((s) => jsonType(s) !== type)) return { kind: "type", type };
121
+ return void 0;
122
+ };
123
+ var patternLabel = (pattern) => pattern.kind === "tag" ? String(pattern.value) : pattern.kind === "key" ? pattern.key : pattern.kind === "type" ? pattern.type : "other";
124
+ var flattenBranches = (branches, seen = /* @__PURE__ */ new Set()) => branches.flatMap((branch) => {
125
+ const { core } = unwrap(branch);
126
+ const def = defOf(core);
127
+ if (def.type !== "union" || seen.has(def)) return [branch];
128
+ return flattenBranches(def.options ?? [], new Set(seen).add(def));
129
+ });
130
+ var branchField = (branch, walk, tag2) => tag2 === void 0 ? parseField(branch, walk) : { kind: "object", fields: objectFields(branch, walk).filter((f) => f.key !== tag2) };
131
+ var parseByType = {
132
+ string: (schema) => {
133
+ const format = stringFormat(schema);
134
+ return format !== void 0 ? { kind: "string", format } : { kind: "string" };
135
+ },
136
+ number: (schema) => isInteger(schema) ? { kind: "number", integer: true } : { kind: "number" },
137
+ boolean: () => ({ kind: "boolean" }),
138
+ enum: (schema) => ({ kind: "enum", options: enumOptions(schema) }),
139
+ object: (schema, walk) => {
140
+ const def = defOf(schema);
141
+ walk.stack.add(def);
142
+ const fields = objectFields(schema, walk);
143
+ walk.stack.delete(def);
144
+ return walk.targets.has(def) ? { kind: "object", fields, recursive: true } : { kind: "object", fields };
145
+ },
146
+ array: (schema, walk) => {
147
+ const element = defOf(schema).element;
148
+ return { kind: "array", item: element !== void 0 ? parseField(element, walk) : { kind: "unknown" } };
149
+ },
150
+ tuple: (schema, walk) => ({ kind: "tuple", items: (defOf(schema).items ?? []).map((item) => parseField(item, walk)) }),
151
+ union: (schema, walk) => {
152
+ const branches = [...new Set(flattenBranches(defOf(schema).options ?? []))];
153
+ const tag2 = defOf(schema).discriminator;
154
+ const patterns = branches.map((b) => distinguish(b, branches.filter((x) => x !== b), tag2));
155
+ const open = patterns.reduce((acc, p, i) => p === void 0 ? [...acc, i] : acc, []);
156
+ if (branches.length === 0 || open.length > 1) return { kind: "unknown" };
157
+ if (open.length === 1) patterns[open[0]] = { kind: "fallback" };
158
+ const def = defOf(schema);
159
+ walk.stack.add(def);
160
+ const variants = branches.map((branch, i) => ({
161
+ label: readMeta(branch).title ?? patternLabel(patterns[i]),
162
+ field: branchField(branch, walk, tag2),
163
+ pattern: patterns[i]
164
+ }));
165
+ walk.stack.delete(def);
166
+ return walk.targets.has(def) ? { kind: "union", variants, recursive: true } : { kind: "union", variants };
167
+ }
168
+ };
169
+ var unknownField = () => ({ kind: "unknown" });
170
+ var WRAPPERS = /* @__PURE__ */ new Set(["optional", "nullable", "default", "readonly"]);
171
+ var lazyResolved = /* @__PURE__ */ new WeakMap();
172
+ var resolveLazy = (lazy) => {
173
+ const def = defOf(lazy);
174
+ const cached = lazyResolved.get(def);
175
+ if (cached !== void 0) return cached;
176
+ const resolved = def.getter?.();
177
+ if (resolved !== void 0) lazyResolved.set(def, resolved);
178
+ return resolved;
179
+ };
180
+ var unwrap = (schema) => {
181
+ let core = schema;
182
+ let fallback;
183
+ let def = defOf(core);
184
+ while (WRAPPERS.has(def.type) || def.type === "lazy") {
185
+ const inner = def.type === "lazy" ? resolveLazy(core) : def.innerType;
186
+ if (inner === void 0) break;
187
+ if ("defaultValue" in def) fallback = def.defaultValue;
188
+ core = inner;
189
+ def = defOf(core);
190
+ }
191
+ return fallback !== void 0 ? { core, default: fallback } : { core };
192
+ };
193
+ var readMeta = (schema) => {
194
+ const meta = {};
195
+ const title = schema.meta()?.title;
196
+ if (typeof title === "string") meta.title = title;
197
+ if (schema.description !== void 0) meta.description = schema.description;
198
+ return meta;
199
+ };
200
+ var parseField = (schema, walk) => {
201
+ const { core, default: fallback } = unwrap(schema);
202
+ if (walk.stack.has(defOf(core))) {
203
+ walk.targets.add(defOf(core));
204
+ return { kind: "self" };
205
+ }
206
+ const body = (parseByType[defOf(core).type] ?? unknownField)(core, walk);
207
+ const meta = { ...readMeta(core), ...readMeta(schema) };
208
+ return { ...body, ...meta, ...fallback !== void 0 ? { default: fallback } : {} };
209
+ };
210
+ var parse = (schema) => parseField(schema, { stack: /* @__PURE__ */ new Set(), targets: /* @__PURE__ */ new Set() });
211
+ var EMPTY = {
212
+ string: () => "",
213
+ number: () => 0,
214
+ boolean: () => false,
215
+ // No neutral in-domain value: "no selection" is absence (undefined), which
216
+ // an optional enum accepts and a required one flags — unlike null, which a
217
+ // Zod enum rejects outright. Defaults drop undefined, so no stray key.
218
+ enum: () => void 0,
219
+ array: () => [],
220
+ // Each slot built from its own field; a fixed-length list, so no growth.
221
+ tuple: (field, options) => field.kind === "tuple" ? field.items.map((item) => buildDocument(item, options)) : [],
222
+ // A recursion point has no value of its own; the array holding it defaults to [].
223
+ self: () => void 0,
224
+ unknown: () => null,
225
+ object: (field, options) => {
226
+ if (field.kind !== "object") return {};
227
+ const includeOptional = options.includeOptional ?? true;
228
+ const document = {};
229
+ for (const child of field.fields) {
230
+ if (!child.required && !includeOptional) continue;
231
+ const value = buildDocument(child.field, options);
232
+ if (value !== void 0) document[child.key] = value;
233
+ }
234
+ return document;
235
+ },
236
+ // An empty union defaults to its first variant (tag + branch defaults).
237
+ union: (field) => {
238
+ if (field.kind !== "union") return {};
239
+ const first = field.variants[0];
240
+ return first === void 0 ? {} : variantDefaults(first);
241
+ }
242
+ };
243
+ var buildDocument = (field, options) => {
244
+ if (field.default !== void 0) return field.default;
245
+ return (options.empty?.[field.kind] ?? EMPTY[field.kind])(field, options);
246
+ };
247
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
248
+ var variantDefaults = (variant) => {
249
+ const defaults = buildDocument(variant.field, {});
250
+ if (variant.pattern.kind !== "tag") return defaults;
251
+ return { [variant.pattern.key]: variant.pattern.value, ...isRecord(defaults) ? defaults : {} };
252
+ };
253
+ var useModelWrite = (model) => {
254
+ const dispatch = react$1.useNovaDispatch();
255
+ return (value) => {
256
+ if (model !== void 0) dispatch({ type: "ui:model", ref: model.ref, payload: value });
257
+ };
258
+ };
259
+
260
+ // src/react/kit/shared.ts
261
+ var inputStyle = { padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6, fontSize: 14, width: "100%", boxSizing: "border-box" };
262
+ var rawStyle = {
263
+ ...inputStyle,
264
+ margin: 0,
265
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
266
+ fontSize: 13,
267
+ minHeight: 64,
268
+ resize: "vertical",
269
+ width: "100%",
270
+ boxSizing: "border-box"
271
+ };
272
+ var showJson = (value) => JSON.stringify(value ?? null, null, 2);
273
+ var JsonEditor = ({ value, onChange }) => {
274
+ const [text, setText] = react.useState(() => showJson(value));
275
+ const [valid, setValid] = react.useState(true);
276
+ const serialized = JSON.stringify(value ?? null);
277
+ react.useEffect(() => {
278
+ let mine;
279
+ try {
280
+ mine = JSON.parse(text);
281
+ } catch {
282
+ setText(showJson(value));
283
+ setValid(true);
284
+ return;
285
+ }
286
+ if (JSON.stringify(mine ?? null) !== serialized) {
287
+ setText(showJson(value));
288
+ setValid(true);
289
+ }
290
+ }, [serialized]);
291
+ return /* @__PURE__ */ jsxRuntime.jsx(
292
+ "textarea",
293
+ {
294
+ value: text,
295
+ spellCheck: false,
296
+ onChange: (event) => {
297
+ const next = event.target.value;
298
+ setText(next);
299
+ try {
300
+ const parsed = JSON.parse(next);
301
+ setValid(true);
302
+ onChange(parsed);
303
+ } catch {
304
+ setValid(false);
305
+ }
306
+ },
307
+ style: valid ? rawStyle : { ...rawStyle, borderColor: "#dc2626", background: "#fef2f2" }
308
+ }
309
+ );
310
+ };
311
+ var trigger = { padding: "4px 8px", border: "1px solid #d1d5db", borderRadius: 6, background: "#fff", cursor: "pointer", fontSize: 13, lineHeight: 1 };
312
+ var base = { position: "absolute", zIndex: 30, minWidth: 170, display: "flex", flexDirection: "column", background: "#fff", border: "1px solid #d1d5db", borderRadius: 6, boxShadow: "0 6px 16px rgba(0,0,0,0.12)", padding: 4 };
313
+ var menuRight = { ...base, top: "100%", right: 0, marginTop: 4 };
314
+ var menuLeft = { ...base, top: "100%", left: 0, marginTop: 4 };
315
+ var flyLeft = { ...base, top: 0, right: "100%", maxHeight: 280, overflowY: "auto" };
316
+ var flyRight = { ...base, top: 0, left: "100%", maxHeight: 280, overflowY: "auto" };
317
+ var itemStyle = { width: "100%", boxSizing: "border-box", textAlign: "left", padding: "6px 10px", cursor: "pointer", fontSize: 13, borderRadius: 4, whiteSpace: "nowrap", display: "flex", justifyContent: "space-between", gap: 12 };
318
+ var itemDisabled = { ...itemStyle, color: "#9ca3af", cursor: "default" };
319
+ var MENU_CSS = ".loom-menu-item{background:transparent;border:none;}.loom-menu-item:hover:not(:disabled){background:#f3f4f6;}";
320
+ var MenuContext = react.createContext({ close: () => {
321
+ }, anchor: "right" });
322
+ var ActionMenu = ({
323
+ label: label2 = "\u22EF",
324
+ ariaLabel = "Actions",
325
+ anchor = "right",
326
+ children
327
+ }) => {
328
+ const [open, setOpen] = react.useState(false);
329
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
330
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": ariaLabel, onClick: () => setOpen((was) => !was), style: trigger, children: label2 }),
331
+ open ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
332
+ /* @__PURE__ */ jsxRuntime.jsx("div", { onMouseDown: () => setOpen(false), style: { position: "fixed", inset: 0, zIndex: 29 } }),
333
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: anchor === "right" ? menuRight : menuLeft, children: [
334
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: MENU_CSS }),
335
+ /* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value: { close: () => setOpen(false), anchor }, children })
336
+ ] })
337
+ ] }) : null
338
+ ] });
339
+ };
340
+ var MenuItem = ({ label: label2, onSelect, disabled }) => {
341
+ const { close } = react.useContext(MenuContext);
342
+ return /* @__PURE__ */ jsxRuntime.jsx(
343
+ "button",
344
+ {
345
+ type: "button",
346
+ className: "loom-menu-item",
347
+ disabled,
348
+ onClick: () => {
349
+ onSelect();
350
+ close();
351
+ },
352
+ style: disabled ? itemDisabled : itemStyle,
353
+ children: typeof label2 === "string" ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: label2 }) : label2
354
+ }
355
+ );
356
+ };
357
+ var SubMenu = ({ label: label2, children }) => {
358
+ const { anchor } = react.useContext(MenuContext);
359
+ const [open, setOpen] = react.useState(false);
360
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), children: [
361
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "loom-menu-item", onClick: () => setOpen((was) => !was), style: itemStyle, children: [
362
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label2 }),
363
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u25B8" })
364
+ ] }),
365
+ open ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: anchor === "right" ? flyLeft : flyRight, children }) : null
366
+ ] });
367
+ };
368
+ var CATEGORY_ORDER = ["Value", "Core", "Array", "Math", "String", "Predicate", "Logic", "Structure", "Object", "Time", "Sugar"];
369
+ var OP_CATEGORY = {
370
+ $ref: "Core",
371
+ $const: "Core",
372
+ $var: "Core",
373
+ $get: "Core",
374
+ $with: "Core",
375
+ $map: "Array",
376
+ $filter: "Array",
377
+ $reduce: "Array",
378
+ $slice: "Array",
379
+ $flatten: "Array",
380
+ $unique: "Array",
381
+ $sortBy: "Array",
382
+ $add: "Math",
383
+ $sub: "Math",
384
+ $mul: "Math",
385
+ $div: "Math",
386
+ $round: "Math",
387
+ $join: "String",
388
+ $toString: "String",
389
+ $interpolate: "String",
390
+ $trim: "String",
391
+ $lower: "String",
392
+ $upper: "String",
393
+ $split: "String",
394
+ $replace: "String",
395
+ $eq: "Predicate",
396
+ $neq: "Predicate",
397
+ $gt: "Predicate",
398
+ $gte: "Predicate",
399
+ $lt: "Predicate",
400
+ $lte: "Predicate",
401
+ $empty: "Predicate",
402
+ $startsWith: "Predicate",
403
+ $endsWith: "Predicate",
404
+ $contains: "Predicate",
405
+ $not: "Logic",
406
+ $and: "Logic",
407
+ $or: "Logic",
408
+ $merge: "Structure",
409
+ $coalesce: "Structure",
410
+ $case: "Structure",
411
+ $entriesOf: "Structure",
412
+ $keyBy: "Structure",
413
+ $groupBy: "Structure",
414
+ $keys: "Object",
415
+ $values: "Object",
416
+ $fromEntries: "Object",
417
+ $pick: "Object",
418
+ $omit: "Object",
419
+ $type: "Object",
420
+ $length: "Object",
421
+ $date: "Time",
422
+ $dateAdd: "Time",
423
+ $dateDiff: "Time",
424
+ $sum: "Sugar",
425
+ $avg: "Sugar",
426
+ $count: "Sugar",
427
+ $min: "Sugar",
428
+ $max: "Sugar",
429
+ $pluck: "Sugar",
430
+ $take: "Sugar",
431
+ $drop: "Sugar",
432
+ $match: "Sugar",
433
+ $flatMap: "Sugar"
434
+ };
435
+ var TYPE_LABEL = { string: "string", number: "number", boolean: "boolean", null: "null", array: "array of nodes" };
436
+ var NODE_IR = parse(prism$1.NodeSchema);
437
+ var KINDS = (NODE_IR.kind === "union" ? NODE_IR.variants : []).map((variant) => {
438
+ if (variant.pattern.kind === "key") {
439
+ const id = variant.pattern.key;
440
+ return { id, label: id, category: OP_CATEGORY[id] ?? "Other", variant };
441
+ }
442
+ if (variant.pattern.kind === "type") {
443
+ const id = variant.pattern.type;
444
+ return { id, label: TYPE_LABEL[id] ?? id, category: "Value", variant };
445
+ }
446
+ return { id: "template", label: "object (template)", category: "Value", variant };
447
+ });
448
+ var BY_ID = new Map(KINDS.map((kind) => [kind.id, kind]));
449
+ var OP_KEYS = new Set(KINDS.filter((kind) => kind.category !== "Value").map((kind) => kind.id));
450
+ var isObj = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
451
+ var argFieldOf = (variant) => variant.field.kind === "object" ? variant.field.fields[0]?.field : variant.field;
452
+ var kindOf = (value) => {
453
+ if (Array.isArray(value)) return "array";
454
+ if (value === null || value === void 0) return "null";
455
+ const type = typeof value;
456
+ if (type === "string" || type === "number" || type === "boolean") return type;
457
+ if (type === "object") return Object.keys(value).find((key) => OP_KEYS.has(key)) ?? "template";
458
+ return "template";
459
+ };
460
+ var defaultFor = (id) => {
461
+ switch (id) {
462
+ case "template":
463
+ return {};
464
+ case "array":
465
+ return [];
466
+ case "string":
467
+ return "";
468
+ case "number":
469
+ return 0;
470
+ case "boolean":
471
+ return false;
472
+ case "null":
473
+ return null;
474
+ default: {
475
+ const arg = argFieldOf(BY_ID.get(id).variant);
476
+ return { [id]: arg !== void 0 ? buildDocument(arg, {}) : {} };
477
+ }
478
+ }
479
+ };
480
+ var defaultItem = (field) => field.kind === "self" ? null : field.kind === "string" ? "" : field.kind === "number" ? 0 : field.kind === "boolean" ? false : buildDocument(field, {});
481
+ var nodeSlot = (field) => {
482
+ if (field.kind === "self") return (node) => node;
483
+ if (field.kind === "array" && field.item.kind === "self") return (node) => [node];
484
+ if (field.kind === "tuple") {
485
+ const at = field.items.findIndex((item) => item.kind === "self");
486
+ if (at < 0) return void 0;
487
+ return (node) => {
488
+ const slots = buildDocument(field, {}).slice();
489
+ slots[at] = node;
490
+ return slots;
491
+ };
492
+ }
493
+ if (field.kind === "object") {
494
+ const prop = field.fields.find((p) => nodeSlot(p.field) !== void 0);
495
+ if (prop === void 0) return void 0;
496
+ const place = nodeSlot(prop.field);
497
+ return (node) => ({ ...isObj(buildDocument(field, {})) ? buildDocument(field, {}) : {}, [prop.key]: place(node) });
498
+ }
499
+ return void 0;
500
+ };
501
+ var WRAP_TARGETS = KINDS.filter((kind) => {
502
+ if (kind.id === "array") return true;
503
+ if (kind.category === "Value") return false;
504
+ const arg = argFieldOf(kind.variant);
505
+ return arg !== void 0 && nodeSlot(arg) !== void 0;
506
+ });
507
+ var wrapInto = (id, node) => id === "array" ? [node] : { [id]: nodeSlot(argFieldOf(BY_ID.get(id).variant))(node) };
508
+ var nodeChildren = (field, value) => {
509
+ if (field === void 0) return [];
510
+ if (field.kind === "self") return [{ label: "value", node: value }];
511
+ if (field.kind === "array" && field.item.kind === "self") return (Array.isArray(value) ? value : []).map((node, i) => ({ label: `#${i + 1}`, node }));
512
+ if (field.kind === "tuple") return field.items.flatMap((item, i) => item.kind === "self" ? [{ label: `#${i + 1}`, node: Array.isArray(value) ? value[i] : void 0 }] : []);
513
+ if (field.kind === "object") {
514
+ return field.fields.flatMap((p) => {
515
+ const inner = isObj(value) ? value[p.key] : void 0;
516
+ const at = p.field.title ?? p.key;
517
+ if (p.field.kind === "self") return [{ label: at, node: inner }];
518
+ if (p.field.kind === "array" && p.field.item.kind === "self") return (Array.isArray(inner) ? inner : []).map((node, i) => ({ label: `${at} #${i + 1}`, node }));
519
+ if (p.field.kind === "tuple") return p.field.items.flatMap((item, i) => item.kind === "self" ? [{ label: `${at} #${i + 1}`, node: Array.isArray(inner) ? inner[i] : void 0 }] : []);
520
+ return [];
521
+ });
522
+ }
523
+ return [];
524
+ };
525
+ var unwrapChildren = (value) => {
526
+ const id = kindOf(value);
527
+ if (id === "array") return (Array.isArray(value) ? value : []).map((node, i) => ({ label: `#${i + 1}`, node }));
528
+ if (id === "template") return Object.entries(isObj(value) ? value : {}).map(([key, node]) => ({ label: key, node }));
529
+ const kind = BY_ID.get(id);
530
+ if (kind === void 0 || kind.category === "Value") return [];
531
+ return nodeChildren(argFieldOf(kind.variant), isObj(value) ? value[id] : void 0);
532
+ };
533
+ var input = { padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6, fontSize: 14, width: "100%", boxSizing: "border-box" };
534
+ var block = { display: "flex", flexDirection: "column", gap: 8 };
535
+ var nested = { ...block, paddingLeft: 12, borderLeft: "2px solid #e5e7eb" };
536
+ var groupBox = { ...block, padding: 10, border: "1px solid #e5e7eb", borderRadius: 6 };
537
+ var label = { fontSize: 12, fontWeight: 600, color: "#374151" };
538
+ var rowStyle = { display: "flex", gap: 6, alignItems: "flex-start" };
539
+ var iconBtn = { padding: "4px 8px", border: "1px solid #d1d5db", borderRadius: 6, background: "#fff", cursor: "pointer", fontSize: 13, lineHeight: 1 };
540
+ var addBtn = { ...input, alignSelf: "flex-start", cursor: "pointer", background: "#f3f4f6", width: "auto" };
541
+ var chooserBtn = { ...input, display: "flex", justifyContent: "space-between", alignItems: "center", cursor: "pointer", background: "#fff", textAlign: "left" };
542
+ var popover = { position: "absolute", top: "100%", left: 0, zIndex: 40, marginTop: 4, width: 380, background: "#fff", border: "1px solid #d1d5db", borderRadius: 8, boxShadow: "0 8px 24px rgba(0,0,0,0.14)", overflow: "hidden" };
543
+ var catPane = { minWidth: 132, borderRight: "1px solid #e5e7eb", overflowY: "auto", padding: 4 };
544
+ var opPane = { flex: 1, overflowY: "auto", padding: 4 };
545
+ var tag = { fontSize: 11, color: "#9ca3af" };
546
+ var empty = { padding: 12, fontSize: 13, color: "#9ca3af" };
547
+ var CHOOSER_CSS = '.prism-pick{width:100%;box-sizing:border-box;text-align:left;padding:6px 10px;border:none;border-radius:4px;background:transparent;cursor:pointer;font-size:13px;display:flex;justify-content:space-between;gap:10px;align-items:center;}.prism-pick:hover{background:#f3f4f6;}.prism-pick[data-active="true"]{background:#eff6ff;color:#1d4ed8;font-weight:600;}';
548
+ var NodeKindChooser = ({ current, onPick }) => {
549
+ const here = BY_ID.get(current);
550
+ const [open, setOpen] = react.useState(false);
551
+ const [query, setQuery] = react.useState("");
552
+ const [category, setCategory] = react.useState(here?.category ?? "Value");
553
+ const categories = CATEGORY_ORDER.filter((cat) => KINDS.some((kind) => kind.category === cat));
554
+ const q = query.trim().toLowerCase();
555
+ const found = q ? KINDS.filter((kind) => kind.id.toLowerCase().includes(q) || kind.label.toLowerCase().includes(q)) : [];
556
+ const inCategory = KINDS.filter((kind) => kind.category === category);
557
+ const pick = (id) => {
558
+ onPick(id);
559
+ setOpen(false);
560
+ setQuery("");
561
+ };
562
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
563
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", style: chooserBtn, onClick: () => setOpen((was) => !was), children: [
564
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: here?.label ?? current }),
565
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { opacity: 0.5 }, children: "\u25BE" })
566
+ ] }),
567
+ open ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
568
+ /* @__PURE__ */ jsxRuntime.jsx("div", { onMouseDown: () => setOpen(false), style: { position: "fixed", inset: 0, zIndex: 39 } }),
569
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: popover, children: [
570
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: CHOOSER_CSS }),
571
+ /* @__PURE__ */ jsxRuntime.jsx(
572
+ "input",
573
+ {
574
+ autoFocus: true,
575
+ placeholder: "Search ops\u2026",
576
+ value: query,
577
+ onChange: (event) => setQuery(event.target.value),
578
+ style: { ...input, margin: 8, width: "calc(100% - 16px)", borderRadius: 6 }
579
+ }
580
+ ),
581
+ q ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { maxHeight: 300, overflowY: "auto", paddingBottom: 4 }, children: found.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: empty, children: "No match" }) : found.map((kind) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "prism-pick", "data-active": kind.id === current, onClick: () => pick(kind.id), children: [
582
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: kind.label }),
583
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: tag, children: kind.category })
584
+ ] }, kind.id)) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", maxHeight: 300 }, children: [
585
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: catPane, children: categories.map((cat) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "prism-pick", "data-active": cat === category, onMouseEnter: () => setCategory(cat), onClick: () => setCategory(cat), children: [
586
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: cat }),
587
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { opacity: 0.4 }, children: "\u25B8" })
588
+ ] }, cat)) }),
589
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: opPane, children: inCategory.map((kind) => /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "prism-pick", "data-active": kind.id === current, onClick: () => pick(kind.id), children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: kind.label }) }, kind.id)) })
590
+ ] })
591
+ ] })
592
+ ] }) : null
593
+ ] });
594
+ };
595
+ var Labeled = ({ label: text, required, children }) => /* @__PURE__ */ jsxRuntime.jsxs("label", { style: block, children: [
596
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: label, children: [
597
+ text,
598
+ required ? " *" : ""
599
+ ] }),
600
+ children
601
+ ] });
602
+ var ArgEditor = ({ field, value, onChange }) => {
603
+ switch (field.kind) {
604
+ case "string":
605
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { style: input, value: String(value ?? ""), onChange: (event) => onChange(event.target.value) });
606
+ case "number":
607
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { style: input, type: "number", value: Number.isFinite(value) ? value : "", onChange: (event) => onChange(event.target.value === "" ? null : Number(event.target.value)) });
608
+ case "boolean":
609
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: Boolean(value), onChange: (event) => onChange(event.target.checked), style: { width: 16, height: 16 } });
610
+ case "enum":
611
+ return /* @__PURE__ */ jsxRuntime.jsx("select", { style: input, value: String(value ?? ""), onChange: (event) => onChange(event.target.value), children: field.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: String(option.value), children: option.label }, String(option.value))) });
612
+ case "self":
613
+ return /* @__PURE__ */ jsxRuntime.jsx(NodeEditor, { value, onChange });
614
+ case "array":
615
+ return /* @__PURE__ */ jsxRuntime.jsx(ListEditor, { itemField: field.item, value, onChange });
616
+ case "tuple":
617
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: groupBox, children: field.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(Labeled, { label: `#${index + 1}`, children: /* @__PURE__ */ jsxRuntime.jsx(
618
+ ArgEditor,
619
+ {
620
+ field: item,
621
+ value: Array.isArray(value) ? value[index] : void 0,
622
+ onChange: (next) => {
623
+ const slots = Array.isArray(value) ? [...value] : [];
624
+ slots[index] = next;
625
+ onChange(slots);
626
+ }
627
+ }
628
+ ) }, index)) });
629
+ case "object":
630
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: groupBox, children: field.fields.map((prop) => /* @__PURE__ */ jsxRuntime.jsx(Labeled, { label: prop.field.title ?? prop.key, required: prop.required, children: /* @__PURE__ */ jsxRuntime.jsx(
631
+ ArgEditor,
632
+ {
633
+ field: prop.field,
634
+ value: isObj(value) ? value[prop.key] : void 0,
635
+ onChange: (next) => onChange({ ...isObj(value) ? value : {}, [prop.key]: next })
636
+ }
637
+ ) }, prop.key)) });
638
+ default:
639
+ return /* @__PURE__ */ jsxRuntime.jsx(JsonEditor, { value, onChange });
640
+ }
641
+ };
642
+ var ListEditor = ({ itemField, value, onChange }) => {
643
+ const list = Array.isArray(value) ? value : [];
644
+ const setAt = (index, next) => onChange(list.map((entry, i) => i === index ? next : entry));
645
+ const removeAt = (index) => onChange(list.filter((_, i) => i !== index));
646
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: block, children: [
647
+ list.map(
648
+ (item, index) => (
649
+ // A node item carries its own menu, so removal lives there; a scalar item
650
+ // has no menu, so it keeps the inline ✕.
651
+ itemField.kind === "self" ? /* @__PURE__ */ jsxRuntime.jsx(NodeEditor, { value: item, onChange: (next) => setAt(index, next), onRemove: () => removeAt(index) }, index) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle, children: [
652
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(ArgEditor, { field: itemField, value: item, onChange: (next) => setAt(index, next) }) }),
653
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: iconBtn, onClick: () => removeAt(index), children: "\u2715" })
654
+ ] }, index)
655
+ )
656
+ ),
657
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: addBtn, onClick: () => onChange([...list, defaultItem(itemField)]), children: "Add" })
658
+ ] });
659
+ };
660
+ var TemplateEditor = ({ value, onChange }) => {
661
+ const entries = Object.entries(isObj(value) ? value : {});
662
+ const rename = (from, to) => {
663
+ if (to === from) return;
664
+ onChange(Object.fromEntries(entries.map(([key, val]) => [key === from ? to : key, val])));
665
+ };
666
+ const addField = () => {
667
+ const taken = new Set(entries.map(([key2]) => key2));
668
+ let key = "field";
669
+ for (let n = 1; taken.has(key); n += 1) key = `field${n}`;
670
+ onChange({ ...Object.fromEntries(entries), [key]: null });
671
+ };
672
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: block, children: [
673
+ entries.map(([key, val], index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...rowStyle, alignItems: "flex-start" }, children: [
674
+ /* @__PURE__ */ jsxRuntime.jsx("input", { style: { ...input, width: 150 }, value: key, onChange: (event) => rename(key, event.target.value) }),
675
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
676
+ NodeEditor,
677
+ {
678
+ value: val,
679
+ onChange: (next) => onChange(Object.fromEntries(entries.map(([k, v]) => [k, k === key ? next : v]))),
680
+ onRemove: () => onChange(Object.fromEntries(entries.filter(([k]) => k !== key)))
681
+ }
682
+ ) })
683
+ ] }, index)),
684
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: addBtn, onClick: addField, children: "Add field" })
685
+ ] });
686
+ };
687
+ var NodeEditor = ({ value, onChange, onRemove }) => {
688
+ const id = kindOf(value);
689
+ const kind = BY_ID.get(id);
690
+ const body = (() => {
691
+ if (kind === void 0) return /* @__PURE__ */ jsxRuntime.jsx(JsonEditor, { value, onChange });
692
+ if (kind.category !== "Value") {
693
+ const arg = argFieldOf(kind.variant);
694
+ if (arg === void 0) return null;
695
+ return /* @__PURE__ */ jsxRuntime.jsx(ArgEditor, { field: arg, value: isObj(value) ? value[id] : void 0, onChange: (next) => onChange({ [id]: next }) });
696
+ }
697
+ switch (id) {
698
+ case "string":
699
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { style: input, value: String(value ?? ""), onChange: (event) => onChange(event.target.value) });
700
+ case "number":
701
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { style: input, type: "number", value: Number.isFinite(value) ? value : "", onChange: (event) => onChange(event.target.value === "" ? null : Number(event.target.value)) });
702
+ case "boolean":
703
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: Boolean(value), onChange: (event) => onChange(event.target.checked), style: { width: 16, height: 16 } });
704
+ case "null":
705
+ return null;
706
+ case "array":
707
+ return /* @__PURE__ */ jsxRuntime.jsx(ListEditor, { itemField: { kind: "self" }, value, onChange });
708
+ case "template":
709
+ return /* @__PURE__ */ jsxRuntime.jsx(TemplateEditor, { value, onChange });
710
+ default:
711
+ return /* @__PURE__ */ jsxRuntime.jsx(JsonEditor, { value, onChange });
712
+ }
713
+ })();
714
+ const children = unwrapChildren(value);
715
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: nested, children: [
716
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle, children: [
717
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(NodeKindChooser, { current: id, onPick: (next) => onChange(defaultFor(next)) }) }),
718
+ /* @__PURE__ */ jsxRuntime.jsxs(ActionMenu, { ariaLabel: "Restructure", children: [
719
+ /* @__PURE__ */ jsxRuntime.jsx(SubMenu, { label: "\u29C9 Wrap in", children: WRAP_TARGETS.map((target) => /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { label: target.label, onSelect: () => onChange(wrapInto(target.id, value)) }, target.id)) }),
720
+ children.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(SubMenu, { label: "\u21F2 Unwrap", children: children.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { label: `to ${child.label}`, onSelect: () => onChange(child.node) }, index)) }) : null,
721
+ onRemove !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { label: "\u2715 Remove", onSelect: onRemove }) : null
722
+ ] })
723
+ ] }),
724
+ body
725
+ ] });
726
+ };
727
+ var PrismNode = ({ value, novaModel }) => {
728
+ const set = useModelWrite(novaModel);
729
+ return /* @__PURE__ */ jsxRuntime.jsx(NodeEditor, { value, onChange: set });
730
+ };
731
+
732
+ // src/plugins/prism/react/index.ts
733
+ var prism = (options) => {
734
+ const { name, documents, widgets, mount } = prismPlugin(options);
735
+ const components = {
736
+ [NODE]: PrismNode,
737
+ [PREVIEW]: makePreview(options.input)
738
+ };
739
+ return { name, documents, widgets, mount, components };
740
+ };
741
+
742
+ exports.prism = prism;
743
+ //# sourceMappingURL=index.cjs.map
744
+ //# sourceMappingURL=index.cjs.map