@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.
- package/DESIGN.md +253 -0
- package/LICENSE +202 -0
- package/README.md +101 -0
- package/dist/chunk-A3UOFGL4.js +29 -0
- package/dist/chunk-A3UOFGL4.js.map +1 -0
- package/dist/chunk-D743DI5J.js +17 -0
- package/dist/chunk-D743DI5J.js.map +1 -0
- package/dist/chunk-DWQWPBBV.js +63 -0
- package/dist/chunk-DWQWPBBV.js.map +1 -0
- package/dist/chunk-LWY5TG7M.js +208 -0
- package/dist/chunk-LWY5TG7M.js.map +1 -0
- package/dist/chunk-MIRMQPUE.js +132 -0
- package/dist/chunk-MIRMQPUE.js.map +1 -0
- package/dist/chunk-PTXRAWJX.js +58 -0
- package/dist/chunk-PTXRAWJX.js.map +1 -0
- package/dist/chunk-TV4U22MY.js +176 -0
- package/dist/chunk-TV4U22MY.js.map +1 -0
- package/dist/chunk-X7PCPONB.js +380 -0
- package/dist/chunk-X7PCPONB.js.map +1 -0
- package/dist/chunk-XTY7XO5C.js +61 -0
- package/dist/chunk-XTY7XO5C.js.map +1 -0
- package/dist/index.cjs +630 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/loom-editor-CQ_GI4IA.d.cts +27 -0
- package/dist/loom-editor-D5SBQ4_F.d.ts +27 -0
- package/dist/plugins/nova/index.cjs +81 -0
- package/dist/plugins/nova/index.cjs.map +1 -0
- package/dist/plugins/nova/index.d.cts +14 -0
- package/dist/plugins/nova/index.d.ts +14 -0
- package/dist/plugins/nova/index.js +5 -0
- package/dist/plugins/nova/index.js.map +1 -0
- package/dist/plugins/nova/react/index.cjs +107 -0
- package/dist/plugins/nova/react/index.cjs.map +1 -0
- package/dist/plugins/nova/react/index.d.cts +17 -0
- package/dist/plugins/nova/react/index.d.ts +17 -0
- package/dist/plugins/nova/react/index.js +36 -0
- package/dist/plugins/nova/react/index.js.map +1 -0
- package/dist/plugins/prism/index.cjs +48 -0
- package/dist/plugins/prism/index.cjs.map +1 -0
- package/dist/plugins/prism/index.d.cts +18 -0
- package/dist/plugins/prism/index.d.ts +18 -0
- package/dist/plugins/prism/index.js +4 -0
- package/dist/plugins/prism/index.js.map +1 -0
- package/dist/plugins/prism/react/index.cjs +744 -0
- package/dist/plugins/prism/react/index.cjs.map +1 -0
- package/dist/plugins/prism/react/index.d.cts +12 -0
- package/dist/plugins/prism/react/index.d.ts +12 -0
- package/dist/plugins/prism/react/index.js +419 -0
- package/dist/plugins/prism/react/index.js.map +1 -0
- package/dist/plugins/vex/index.cjs +67 -0
- package/dist/plugins/vex/index.cjs.map +1 -0
- package/dist/plugins/vex/index.d.cts +25 -0
- package/dist/plugins/vex/index.d.ts +25 -0
- package/dist/plugins/vex/index.js +4 -0
- package/dist/plugins/vex/index.js.map +1 -0
- package/dist/plugins/vex/react/index.cjs +432 -0
- package/dist/plugins/vex/react/index.cjs.map +1 -0
- package/dist/plugins/vex/react/index.d.cts +13 -0
- package/dist/plugins/vex/react/index.d.ts +13 -0
- package/dist/plugins/vex/react/index.js +296 -0
- package/dist/plugins/vex/react/index.js.map +1 -0
- package/dist/react/index.cjs +1076 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +82 -0
- package/dist/react/index.d.ts +82 -0
- package/dist/react/index.js +120 -0
- package/dist/react/index.js.map +1 -0
- package/dist/schema--OhtatTX.d.cts +10 -0
- package/dist/schema--OhtatTX.d.ts +10 -0
- package/dist/types-BonjN3CB.d.cts +144 -0
- package/dist/types-BonjN3CB.d.ts +144 -0
- package/package.json +144 -0
|
@@ -0,0 +1,1076 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var react$1 = require('@niscorp/nova/adapters/react');
|
|
5
|
+
var zod = require('zod');
|
|
6
|
+
var nova = require('@niscorp/nova');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
// src/react/editor/loom-editor.tsx
|
|
10
|
+
|
|
11
|
+
// src/compile/parse.ts
|
|
12
|
+
var defOf = (schema) => schema.def;
|
|
13
|
+
var INTEGER_FORMAT = "safeint";
|
|
14
|
+
var stringFormat = (schema) => {
|
|
15
|
+
const def = defOf(schema);
|
|
16
|
+
if (def.format !== void 0) return def.format;
|
|
17
|
+
for (const check of def.checks ?? []) {
|
|
18
|
+
if (check.def?.format !== void 0) return check.def.format;
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
};
|
|
22
|
+
var isInteger = (schema) => {
|
|
23
|
+
const def = defOf(schema);
|
|
24
|
+
if (def.format === INTEGER_FORMAT) return true;
|
|
25
|
+
return (def.checks ?? []).some((check) => check.def?.format === INTEGER_FORMAT);
|
|
26
|
+
};
|
|
27
|
+
var enumOptions = (schema) => Object.values(defOf(schema).entries ?? {}).map((value) => ({ value, label: String(value) }));
|
|
28
|
+
var objectFields = (schema, walk) => Object.entries(defOf(schema).shape ?? {}).map(([key, value]) => ({
|
|
29
|
+
key,
|
|
30
|
+
// A property is optional when the schema accepts `undefined` for it
|
|
31
|
+
// (covers `.optional()` and `.default()`) — asked of Zod, not inferred.
|
|
32
|
+
required: !value.safeParse(void 0).success,
|
|
33
|
+
field: parseField(value, walk)
|
|
34
|
+
}));
|
|
35
|
+
var branchKeys = (branch) => Object.keys(defOf(branch).shape ?? {});
|
|
36
|
+
var JSON_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "object", "array", "null"]);
|
|
37
|
+
var jsonType = (branch) => {
|
|
38
|
+
const type = defOf(branch).type;
|
|
39
|
+
return JSON_TYPES.has(type) ? type : void 0;
|
|
40
|
+
};
|
|
41
|
+
var distinguish = (branch, siblings, tag) => {
|
|
42
|
+
if (tag !== void 0) {
|
|
43
|
+
const literal2 = (defOf(branch).shape ?? {})[tag];
|
|
44
|
+
return { kind: "tag", key: tag, value: literal2 !== void 0 ? defOf(literal2).values?.[0] : void 0 };
|
|
45
|
+
}
|
|
46
|
+
const elsewhere = new Set(siblings.flatMap(branchKeys));
|
|
47
|
+
const key = branchKeys(branch).find((k) => !elsewhere.has(k));
|
|
48
|
+
if (key !== void 0) return { kind: "key", key };
|
|
49
|
+
const type = jsonType(branch);
|
|
50
|
+
if (type !== void 0 && siblings.every((s) => jsonType(s) !== type)) return { kind: "type", type };
|
|
51
|
+
return void 0;
|
|
52
|
+
};
|
|
53
|
+
var patternLabel = (pattern) => pattern.kind === "tag" ? String(pattern.value) : pattern.kind === "key" ? pattern.key : pattern.kind === "type" ? pattern.type : "other";
|
|
54
|
+
var flattenBranches = (branches, seen = /* @__PURE__ */ new Set()) => branches.flatMap((branch) => {
|
|
55
|
+
const { core } = unwrap(branch);
|
|
56
|
+
const def = defOf(core);
|
|
57
|
+
if (def.type !== "union" || seen.has(def)) return [branch];
|
|
58
|
+
return flattenBranches(def.options ?? [], new Set(seen).add(def));
|
|
59
|
+
});
|
|
60
|
+
var branchField = (branch, walk, tag) => tag === void 0 ? parseField(branch, walk) : { kind: "object", fields: objectFields(branch, walk).filter((f) => f.key !== tag) };
|
|
61
|
+
var parseByType = {
|
|
62
|
+
string: (schema) => {
|
|
63
|
+
const format = stringFormat(schema);
|
|
64
|
+
return format !== void 0 ? { kind: "string", format } : { kind: "string" };
|
|
65
|
+
},
|
|
66
|
+
number: (schema) => isInteger(schema) ? { kind: "number", integer: true } : { kind: "number" },
|
|
67
|
+
boolean: () => ({ kind: "boolean" }),
|
|
68
|
+
enum: (schema) => ({ kind: "enum", options: enumOptions(schema) }),
|
|
69
|
+
object: (schema, walk) => {
|
|
70
|
+
const def = defOf(schema);
|
|
71
|
+
walk.stack.add(def);
|
|
72
|
+
const fields = objectFields(schema, walk);
|
|
73
|
+
walk.stack.delete(def);
|
|
74
|
+
return walk.targets.has(def) ? { kind: "object", fields, recursive: true } : { kind: "object", fields };
|
|
75
|
+
},
|
|
76
|
+
array: (schema, walk) => {
|
|
77
|
+
const element = defOf(schema).element;
|
|
78
|
+
return { kind: "array", item: element !== void 0 ? parseField(element, walk) : { kind: "unknown" } };
|
|
79
|
+
},
|
|
80
|
+
tuple: (schema, walk) => ({ kind: "tuple", items: (defOf(schema).items ?? []).map((item) => parseField(item, walk)) }),
|
|
81
|
+
union: (schema, walk) => {
|
|
82
|
+
const branches = [...new Set(flattenBranches(defOf(schema).options ?? []))];
|
|
83
|
+
const tag = defOf(schema).discriminator;
|
|
84
|
+
const patterns = branches.map((b) => distinguish(b, branches.filter((x) => x !== b), tag));
|
|
85
|
+
const open = patterns.reduce((acc, p, i) => p === void 0 ? [...acc, i] : acc, []);
|
|
86
|
+
if (branches.length === 0 || open.length > 1) return { kind: "unknown" };
|
|
87
|
+
if (open.length === 1) patterns[open[0]] = { kind: "fallback" };
|
|
88
|
+
const def = defOf(schema);
|
|
89
|
+
walk.stack.add(def);
|
|
90
|
+
const variants = branches.map((branch, i) => ({
|
|
91
|
+
label: readMeta(branch).title ?? patternLabel(patterns[i]),
|
|
92
|
+
field: branchField(branch, walk, tag),
|
|
93
|
+
pattern: patterns[i]
|
|
94
|
+
}));
|
|
95
|
+
walk.stack.delete(def);
|
|
96
|
+
return walk.targets.has(def) ? { kind: "union", variants, recursive: true } : { kind: "union", variants };
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var unknownField = () => ({ kind: "unknown" });
|
|
100
|
+
var WRAPPERS = /* @__PURE__ */ new Set(["optional", "nullable", "default", "readonly"]);
|
|
101
|
+
var lazyResolved = /* @__PURE__ */ new WeakMap();
|
|
102
|
+
var resolveLazy = (lazy) => {
|
|
103
|
+
const def = defOf(lazy);
|
|
104
|
+
const cached = lazyResolved.get(def);
|
|
105
|
+
if (cached !== void 0) return cached;
|
|
106
|
+
const resolved = def.getter?.();
|
|
107
|
+
if (resolved !== void 0) lazyResolved.set(def, resolved);
|
|
108
|
+
return resolved;
|
|
109
|
+
};
|
|
110
|
+
var unwrap = (schema) => {
|
|
111
|
+
let core = schema;
|
|
112
|
+
let fallback;
|
|
113
|
+
let def = defOf(core);
|
|
114
|
+
while (WRAPPERS.has(def.type) || def.type === "lazy") {
|
|
115
|
+
const inner = def.type === "lazy" ? resolveLazy(core) : def.innerType;
|
|
116
|
+
if (inner === void 0) break;
|
|
117
|
+
if ("defaultValue" in def) fallback = def.defaultValue;
|
|
118
|
+
core = inner;
|
|
119
|
+
def = defOf(core);
|
|
120
|
+
}
|
|
121
|
+
return fallback !== void 0 ? { core, default: fallback } : { core };
|
|
122
|
+
};
|
|
123
|
+
var readMeta = (schema) => {
|
|
124
|
+
const meta = {};
|
|
125
|
+
const title = schema.meta()?.title;
|
|
126
|
+
if (typeof title === "string") meta.title = title;
|
|
127
|
+
if (schema.description !== void 0) meta.description = schema.description;
|
|
128
|
+
return meta;
|
|
129
|
+
};
|
|
130
|
+
var parseField = (schema, walk) => {
|
|
131
|
+
const { core, default: fallback } = unwrap(schema);
|
|
132
|
+
if (walk.stack.has(defOf(core))) {
|
|
133
|
+
walk.targets.add(defOf(core));
|
|
134
|
+
return { kind: "self" };
|
|
135
|
+
}
|
|
136
|
+
const body = (parseByType[defOf(core).type] ?? unknownField)(core, walk);
|
|
137
|
+
const meta = { ...readMeta(core), ...readMeta(schema) };
|
|
138
|
+
return { ...body, ...meta, ...fallback !== void 0 ? { default: fallback } : {} };
|
|
139
|
+
};
|
|
140
|
+
var parse = (schema) => parseField(schema, { stack: /* @__PURE__ */ new Set(), targets: /* @__PURE__ */ new Set() });
|
|
141
|
+
var EMPTY = {
|
|
142
|
+
string: () => "",
|
|
143
|
+
number: () => 0,
|
|
144
|
+
boolean: () => false,
|
|
145
|
+
// No neutral in-domain value: "no selection" is absence (undefined), which
|
|
146
|
+
// an optional enum accepts and a required one flags — unlike null, which a
|
|
147
|
+
// Zod enum rejects outright. Defaults drop undefined, so no stray key.
|
|
148
|
+
enum: () => void 0,
|
|
149
|
+
array: () => [],
|
|
150
|
+
// Each slot built from its own field; a fixed-length list, so no growth.
|
|
151
|
+
tuple: (field, options) => field.kind === "tuple" ? field.items.map((item) => buildDocument(item, options)) : [],
|
|
152
|
+
// A recursion point has no value of its own; the array holding it defaults to [].
|
|
153
|
+
self: () => void 0,
|
|
154
|
+
unknown: () => null,
|
|
155
|
+
object: (field, options) => {
|
|
156
|
+
if (field.kind !== "object") return {};
|
|
157
|
+
const includeOptional = options.includeOptional ?? true;
|
|
158
|
+
const document = {};
|
|
159
|
+
for (const child2 of field.fields) {
|
|
160
|
+
if (!child2.required && !includeOptional) continue;
|
|
161
|
+
const value = buildDocument(child2.field, options);
|
|
162
|
+
if (value !== void 0) document[child2.key] = value;
|
|
163
|
+
}
|
|
164
|
+
return document;
|
|
165
|
+
},
|
|
166
|
+
// An empty union defaults to its first variant (tag + branch defaults).
|
|
167
|
+
union: (field) => {
|
|
168
|
+
if (field.kind !== "union") return {};
|
|
169
|
+
const first = field.variants[0];
|
|
170
|
+
return first === void 0 ? {} : variantDefaults(first);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var buildDocument = (field, options) => {
|
|
174
|
+
if (field.default !== void 0) return field.default;
|
|
175
|
+
return (options.empty?.[field.kind] ?? EMPTY[field.kind])(field, options);
|
|
176
|
+
};
|
|
177
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
178
|
+
var variantDefaults = (variant) => {
|
|
179
|
+
const defaults = buildDocument(variant.field, {});
|
|
180
|
+
if (variant.pattern.kind !== "tag") return defaults;
|
|
181
|
+
return { [variant.pattern.key]: variant.pattern.value, ...isRecord(defaults) ? defaults : {} };
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// src/compile/roles.ts
|
|
185
|
+
var Roles = {
|
|
186
|
+
// Layout primitives — arrange other nodes.
|
|
187
|
+
box: "loom:box",
|
|
188
|
+
// a flexible cell that grows to fill its row (an array item's editor)
|
|
189
|
+
group: "loom:group",
|
|
190
|
+
array: "loom:array",
|
|
191
|
+
arrayItem: "loom:array-item",
|
|
192
|
+
variant: "loom:variant",
|
|
193
|
+
// One branch of a variant — shows itself only when it's the active branch
|
|
194
|
+
// (the widget matches the value to a branch in JS and tells it through context).
|
|
195
|
+
branch: "loom:branch",
|
|
196
|
+
// Field wrapper — label, description, error, and required marker around one control.
|
|
197
|
+
field: "loom:field",
|
|
198
|
+
// Controls — edit a value; emit `ui:model`.
|
|
199
|
+
text: "loom:text",
|
|
200
|
+
number: "loom:number",
|
|
201
|
+
checkbox: "loom:checkbox",
|
|
202
|
+
select: "loom:select",
|
|
203
|
+
raw: "loom:raw",
|
|
204
|
+
// List actions — model writes to the bound array (no triggers). `append` adds
|
|
205
|
+
// a default element to the list it binds. `rowMenu` is the per-row actions menu
|
|
206
|
+
// (move / remove, and wrap / unwrap when the list's items are a recursive union
|
|
207
|
+
// with container variants); it reads `$items` and `$index` and writes the new
|
|
208
|
+
// array. Both work at any depth, since the bound path resolves per render.
|
|
209
|
+
append: "loom:append",
|
|
210
|
+
rowMenu: "loom:row-menu"
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// src/compile/to-nova.ts
|
|
214
|
+
var ERROR_NAMESPACE = "_errors";
|
|
215
|
+
var ITEM = "item";
|
|
216
|
+
var INDEX = "$index";
|
|
217
|
+
var ITEM_EXPR = `$${ITEM}`;
|
|
218
|
+
var LIST_EXPR = "$items";
|
|
219
|
+
var ROOT = { expr: "$", path: "" };
|
|
220
|
+
var child = (loc, key) => ({
|
|
221
|
+
expr: `${loc.expr}.${key}`,
|
|
222
|
+
path: loc.path === "" ? key : `${loc.path}.${key}`
|
|
223
|
+
});
|
|
224
|
+
var itemLoc = (loc) => ({ expr: ITEM_EXPR, path: loc.path === "" ? "*" : `${loc.path}.*` });
|
|
225
|
+
var TEMPLATE_ROOT = { expr: ITEM_EXPR, path: "" };
|
|
226
|
+
var errorBinding = (expr) => expr.startsWith("$.") ? `$.${ERROR_NAMESPACE}.${expr.slice(2)}` : void 0;
|
|
227
|
+
var withProps = (node, props) => Object.keys(props).length > 0 ? { ...node, props } : node;
|
|
228
|
+
var control = (role, expr, props = {}) => withProps({ component: role, model: expr }, props);
|
|
229
|
+
var literal = (data) => data === void 0 ? void 0 : JSON.stringify(data);
|
|
230
|
+
var wrapField = (loc, prop, ctx) => {
|
|
231
|
+
const error = errorBinding(loc.expr);
|
|
232
|
+
return {
|
|
233
|
+
component: Roles.field,
|
|
234
|
+
props: {
|
|
235
|
+
label: prop.field.title ?? prop.key,
|
|
236
|
+
required: prop.required,
|
|
237
|
+
...error !== void 0 ? { error } : {},
|
|
238
|
+
...prop.field.description !== void 0 ? { description: prop.field.description } : {}
|
|
239
|
+
},
|
|
240
|
+
children: buildLayout(prop.field, loc, ctx)
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
var titleProps = (field) => field.title !== void 0 ? { title: field.title } : {};
|
|
244
|
+
var withTitle = (node, field) => withProps(node, titleProps(field));
|
|
245
|
+
var stringBuild = (field, loc) => control(Roles.text, loc.expr, field.format !== void 0 ? { format: field.format } : {});
|
|
246
|
+
var numberBuild = (field, loc) => control(Roles.number, loc.expr, field.integer ? { integer: true } : {});
|
|
247
|
+
var booleanBuild = (_field, loc) => control(Roles.checkbox, loc.expr);
|
|
248
|
+
var enumBuild = (field, loc) => control(Roles.select, loc.expr, { options: field.options });
|
|
249
|
+
var unknownBuild = (_field, loc) => control(Roles.raw, loc.expr);
|
|
250
|
+
var buildGroup = (field, loc, ctx) => withTitle(
|
|
251
|
+
{
|
|
252
|
+
component: Roles.group,
|
|
253
|
+
children: field.fields.map((prop) => wrapField(child(loc, prop.key), prop, ctx))
|
|
254
|
+
},
|
|
255
|
+
field
|
|
256
|
+
);
|
|
257
|
+
var objectBuild = (field, loc, ctx) => {
|
|
258
|
+
if (field.recursive !== true) return buildGroup(field, loc, ctx);
|
|
259
|
+
const name = ctx.name();
|
|
260
|
+
ctx.templates.push({ name, defaultChild: buildDocument(field, ctx.options), containers: [] });
|
|
261
|
+
ctx.register(name, buildGroup(field, TEMPLATE_ROOT, ctx));
|
|
262
|
+
const inline = buildGroup(field, loc, ctx);
|
|
263
|
+
ctx.templates.pop();
|
|
264
|
+
return inline;
|
|
265
|
+
};
|
|
266
|
+
var tupleBuild = (field, loc, ctx) => withTitle(
|
|
267
|
+
{
|
|
268
|
+
component: Roles.group,
|
|
269
|
+
children: field.items.map(
|
|
270
|
+
(item, index) => wrapField(child(loc, String(index)), { key: String(index + 1), required: true, field: item }, ctx)
|
|
271
|
+
)
|
|
272
|
+
},
|
|
273
|
+
field
|
|
274
|
+
);
|
|
275
|
+
var selfBuild = (_field, loc, ctx) => {
|
|
276
|
+
const template = ctx.templates[ctx.templates.length - 1];
|
|
277
|
+
if (template !== void 0 && loc.expr === ITEM_EXPR) return { ref: template.name };
|
|
278
|
+
return control(Roles.raw, loc.expr);
|
|
279
|
+
};
|
|
280
|
+
var defaultItem = (field, ctx) => field.item.kind === "self" ? ctx.templates[ctx.templates.length - 1]?.defaultChild : buildDocument(field.item, ctx.options);
|
|
281
|
+
var childrenKey = (field) => {
|
|
282
|
+
if (field.kind !== "object") return void 0;
|
|
283
|
+
return field.fields.find((f) => f.field.kind === "array" && f.field.item.kind === "self")?.key;
|
|
284
|
+
};
|
|
285
|
+
var containersOf = (variants) => variants.flatMap((variant) => {
|
|
286
|
+
const key = childrenKey(variant.field);
|
|
287
|
+
return key === void 0 ? [] : [{ label: variant.label, pattern: variant.pattern, defaults: variantDefaults(variant), key }];
|
|
288
|
+
});
|
|
289
|
+
var arrayBuild = (field, loc, ctx) => {
|
|
290
|
+
const containers = field.item.kind === "self" ? ctx.templates[ctx.templates.length - 1]?.containers ?? [] : [];
|
|
291
|
+
const itemRow = {
|
|
292
|
+
component: Roles.arrayItem,
|
|
293
|
+
children: [
|
|
294
|
+
{ component: Roles.box, children: buildLayout(field.item, itemLoc(loc), ctx) },
|
|
295
|
+
// the editor cell — grows
|
|
296
|
+
{
|
|
297
|
+
component: Roles.rowMenu,
|
|
298
|
+
model: LIST_EXPR,
|
|
299
|
+
props: { index: INDEX, ...containers.length > 0 ? { containers: literal(containers) } : {} }
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
};
|
|
303
|
+
return withTitle(
|
|
304
|
+
{
|
|
305
|
+
component: Roles.array,
|
|
306
|
+
children: [
|
|
307
|
+
{ for: loc.expr, as: ITEM, do: itemRow },
|
|
308
|
+
{ component: Roles.append, model: loc.expr, props: { label: "Add", child: literal(defaultItem(field, ctx)) } }
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
field
|
|
312
|
+
);
|
|
313
|
+
};
|
|
314
|
+
var buildVariant = (field, loc, ctx) => withProps(
|
|
315
|
+
{
|
|
316
|
+
component: Roles.variant,
|
|
317
|
+
model: loc.expr,
|
|
318
|
+
// Each branch editor in its own `branch` wrapper, indexed; the widget shows
|
|
319
|
+
// only the one whose index it matched. (Nova hands a component its children
|
|
320
|
+
// as one tree, so the branches need to be individually addressable.) A
|
|
321
|
+
// branch edits the same value, so it shares the union's loc.
|
|
322
|
+
children: field.variants.map((variant, index) => ({
|
|
323
|
+
component: Roles.branch,
|
|
324
|
+
props: { index },
|
|
325
|
+
children: buildLayout(variant.field, loc, ctx)
|
|
326
|
+
}))
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
// `childrenKey` lets the chooser carry children when switching between two
|
|
330
|
+
// container variants (and warn before dropping them otherwise). Encoded as
|
|
331
|
+
// a literal: the patterns and defaults carry `$`-bearing data Nova must not
|
|
332
|
+
// resolve.
|
|
333
|
+
branches: literal(
|
|
334
|
+
field.variants.map((variant) => ({
|
|
335
|
+
label: variant.label,
|
|
336
|
+
pattern: variant.pattern,
|
|
337
|
+
defaults: variantDefaults(variant),
|
|
338
|
+
...childrenKey(variant.field) !== void 0 ? { childrenKey: childrenKey(variant.field) } : {}
|
|
339
|
+
}))
|
|
340
|
+
),
|
|
341
|
+
...titleProps(field)
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
var variantBuild = (field, loc, ctx) => {
|
|
345
|
+
if (field.recursive !== true) return buildVariant(field, loc, ctx);
|
|
346
|
+
const name = ctx.name();
|
|
347
|
+
const first = field.variants[0];
|
|
348
|
+
ctx.templates.push({ name, defaultChild: first !== void 0 ? variantDefaults(first) : {}, containers: containersOf(field.variants) });
|
|
349
|
+
ctx.register(name, buildVariant(field, TEMPLATE_ROOT, ctx));
|
|
350
|
+
const inline = buildVariant(field, loc, ctx);
|
|
351
|
+
ctx.templates.pop();
|
|
352
|
+
return inline;
|
|
353
|
+
};
|
|
354
|
+
var buildLayout = (field, loc, ctx) => {
|
|
355
|
+
const role = ctx.widgetRole(field, loc.path);
|
|
356
|
+
if (role !== void 0) return control(role, loc.expr);
|
|
357
|
+
switch (field.kind) {
|
|
358
|
+
case "string":
|
|
359
|
+
return stringBuild(field, loc);
|
|
360
|
+
case "number":
|
|
361
|
+
return numberBuild(field, loc);
|
|
362
|
+
case "boolean":
|
|
363
|
+
return booleanBuild(field, loc);
|
|
364
|
+
case "enum":
|
|
365
|
+
return enumBuild(field, loc);
|
|
366
|
+
case "object":
|
|
367
|
+
return objectBuild(field, loc, ctx);
|
|
368
|
+
case "array":
|
|
369
|
+
return arrayBuild(field, loc, ctx);
|
|
370
|
+
case "tuple":
|
|
371
|
+
return tupleBuild(field, loc, ctx);
|
|
372
|
+
case "union":
|
|
373
|
+
return variantBuild(field, loc, ctx);
|
|
374
|
+
case "self":
|
|
375
|
+
return selfBuild(field, loc, ctx);
|
|
376
|
+
case "unknown":
|
|
377
|
+
return unknownBuild(field, loc);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
var toNova = (ir, options = {}) => {
|
|
381
|
+
const layouts = {};
|
|
382
|
+
let counter = 0;
|
|
383
|
+
const matchers = options.widgets ?? [];
|
|
384
|
+
const ctx = {
|
|
385
|
+
register: (name, node) => {
|
|
386
|
+
layouts[name] = node;
|
|
387
|
+
},
|
|
388
|
+
templates: [],
|
|
389
|
+
name: () => `loom:tree:${counter++}`,
|
|
390
|
+
// Match on where the field sits (its structural path) plus its facts.
|
|
391
|
+
widgetRole: (field, path) => matchers.find(
|
|
392
|
+
(matcher) => matcher.match({ kind: field.kind, path, title: field.title, description: field.description })
|
|
393
|
+
)?.role,
|
|
394
|
+
options
|
|
395
|
+
};
|
|
396
|
+
const rootLoc = options.rootKey !== void 0 ? { expr: `$.${options.rootKey}`, path: "" } : ROOT;
|
|
397
|
+
const layout = buildLayout(ir, rootLoc, ctx);
|
|
398
|
+
const value = options.value ?? buildDocument(ir, options);
|
|
399
|
+
const document = options.rootKey !== void 0 ? { [options.rootKey]: value } : value;
|
|
400
|
+
if (!isRecord(document)) {
|
|
401
|
+
throw new Error("loom.toNova: the root document must be an object (or use rootKey).");
|
|
402
|
+
}
|
|
403
|
+
const action = {
|
|
404
|
+
id: options.id ?? "loom-form",
|
|
405
|
+
data: document,
|
|
406
|
+
layout
|
|
407
|
+
};
|
|
408
|
+
return { action, layouts };
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// src/validate.ts
|
|
412
|
+
var setPath = (root, path, message) => {
|
|
413
|
+
let node = root;
|
|
414
|
+
for (let i = 0; i < path.length - 1; i += 1) {
|
|
415
|
+
const key = String(path[i]);
|
|
416
|
+
const next = node[key];
|
|
417
|
+
node = typeof next === "object" && next !== null ? next : node[key] = {};
|
|
418
|
+
}
|
|
419
|
+
const leaf = String(path[path.length - 1]);
|
|
420
|
+
if (!(leaf in node)) node[leaf] = message;
|
|
421
|
+
};
|
|
422
|
+
var errorTree = (issues) => {
|
|
423
|
+
const tree = {};
|
|
424
|
+
for (const issue of issues) {
|
|
425
|
+
if (issue.path.length > 0) setPath(tree, issue.path, issue.message);
|
|
426
|
+
}
|
|
427
|
+
return tree;
|
|
428
|
+
};
|
|
429
|
+
var stripErrors = (data) => {
|
|
430
|
+
const { [ERROR_NAMESPACE]: _omit, ...document } = data;
|
|
431
|
+
return document;
|
|
432
|
+
};
|
|
433
|
+
var attachValidation = (shell, instanceId, schema, onDocument) => {
|
|
434
|
+
const runtime = shell.getRuntime(instanceId);
|
|
435
|
+
if (runtime === void 0) return () => {
|
|
436
|
+
};
|
|
437
|
+
let lastDocument = "";
|
|
438
|
+
const handle = (data) => {
|
|
439
|
+
const document = stripErrors(data);
|
|
440
|
+
const fingerprint = JSON.stringify(document);
|
|
441
|
+
if (fingerprint === lastDocument) return;
|
|
442
|
+
lastDocument = fingerprint;
|
|
443
|
+
const result = schema.safeParse(document);
|
|
444
|
+
const errors = result.success ? {} : errorTree(result.error.issues);
|
|
445
|
+
runtime.setData({ ...document, [ERROR_NAMESPACE]: errors });
|
|
446
|
+
};
|
|
447
|
+
return shell.onDataChange((change) => {
|
|
448
|
+
if (change.instanceId === instanceId) handle(change.data);
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// src/editor/default.layout.ts
|
|
453
|
+
var LOOM_COLUMN = "loom:column";
|
|
454
|
+
var slot = (canvasId) => ({ component: "CanvasSlot", props: { canvasId } });
|
|
455
|
+
var titleOf = (formId) => {
|
|
456
|
+
const name = formId.replace(/^form:/, "");
|
|
457
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
458
|
+
};
|
|
459
|
+
var formPanel = (formId) => ({
|
|
460
|
+
component: "Box",
|
|
461
|
+
props: { border: true, radius: 8, padding: 16 },
|
|
462
|
+
children: [{ component: "loom:group", props: { title: titleOf(formId) }, children: [slot(formId)] }]
|
|
463
|
+
});
|
|
464
|
+
var column = (grow, min, children) => ({
|
|
465
|
+
component: LOOM_COLUMN,
|
|
466
|
+
props: { grow, min },
|
|
467
|
+
children: [{ component: "Stack", props: { direction: "column", gap: 16 }, children }]
|
|
468
|
+
});
|
|
469
|
+
var defaultCanvasLayout = (formIds, viewIds) => ({
|
|
470
|
+
component: "Stack",
|
|
471
|
+
props: { direction: "row", gap: 16, align: "start" },
|
|
472
|
+
children: [
|
|
473
|
+
...formIds.length > 0 ? [column(2, 420, formIds.map(formPanel))] : [],
|
|
474
|
+
...viewIds.length > 0 ? [column(1, 340, viewIds.map(slot))] : []
|
|
475
|
+
]
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// src/editor/view.ts
|
|
479
|
+
var mountView = (editor, action, read) => {
|
|
480
|
+
const { shell } = editor;
|
|
481
|
+
shell.registerAction(action);
|
|
482
|
+
shell.addCanvas({ id: action.id, initial: action.id });
|
|
483
|
+
const instance = shell.getCanvasState(action.id).active?.id;
|
|
484
|
+
if (instance === void 0) return;
|
|
485
|
+
const sync = () => {
|
|
486
|
+
shell.getRuntime(instance)?.setData(read(editor));
|
|
487
|
+
};
|
|
488
|
+
editor.on("change", sync);
|
|
489
|
+
sync();
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
// src/editor/editor.ts
|
|
493
|
+
var formCanvas = (document) => `form:${document}`;
|
|
494
|
+
var ROOT_KEY = "$root";
|
|
495
|
+
var needsWrap = (document) => parse(document).kind !== "object";
|
|
496
|
+
var stripErrors2 = (data) => {
|
|
497
|
+
const { [ERROR_NAMESPACE]: _omit, ...document } = data;
|
|
498
|
+
return document;
|
|
499
|
+
};
|
|
500
|
+
var createLoomEditor = (config) => {
|
|
501
|
+
const plugins = /* @__PURE__ */ new Map();
|
|
502
|
+
const listeners = { change: /* @__PURE__ */ new Set(), open: /* @__PURE__ */ new Set() };
|
|
503
|
+
const emit = (event) => listeners[event].forEach((handler) => handler());
|
|
504
|
+
const store = nova.createLayoutStore();
|
|
505
|
+
const shell = nova.createShell({
|
|
506
|
+
canvases: [],
|
|
507
|
+
registry: config.registry,
|
|
508
|
+
actions: {},
|
|
509
|
+
layoutStore: store
|
|
510
|
+
});
|
|
511
|
+
let active;
|
|
512
|
+
let formInstances = {};
|
|
513
|
+
let wrappedDocs = /* @__PURE__ */ new Set();
|
|
514
|
+
let formCanvasIds = [];
|
|
515
|
+
let documents = {};
|
|
516
|
+
let validations = {};
|
|
517
|
+
let detach = [];
|
|
518
|
+
const refresh = () => {
|
|
519
|
+
const nextDocs = {};
|
|
520
|
+
const nextProblems = {};
|
|
521
|
+
for (const [name, instanceId] of Object.entries(formInstances)) {
|
|
522
|
+
const data = shell.getRuntime(instanceId)?.getData() ?? {};
|
|
523
|
+
const document = stripErrors2(data);
|
|
524
|
+
const problems = data[ERROR_NAMESPACE] ?? {};
|
|
525
|
+
if (wrappedDocs.has(name)) {
|
|
526
|
+
nextDocs[name] = document[ROOT_KEY];
|
|
527
|
+
nextProblems[name] = problems[ROOT_KEY] ?? {};
|
|
528
|
+
} else {
|
|
529
|
+
nextDocs[name] = document;
|
|
530
|
+
nextProblems[name] = problems;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
documents = nextDocs;
|
|
534
|
+
validations = nextProblems;
|
|
535
|
+
};
|
|
536
|
+
const clearForms = () => {
|
|
537
|
+
detach.forEach((off) => off());
|
|
538
|
+
detach = [];
|
|
539
|
+
for (const canvasId of formCanvasIds) shell.removeCanvas(canvasId);
|
|
540
|
+
formCanvasIds = [];
|
|
541
|
+
formInstances = {};
|
|
542
|
+
wrappedDocs = /* @__PURE__ */ new Set();
|
|
543
|
+
};
|
|
544
|
+
const open = (artifact) => {
|
|
545
|
+
const plugin = plugins.get(artifact.type);
|
|
546
|
+
if (plugin === void 0) throw new Error(`loom editor: no plugin '${artifact.type}'`);
|
|
547
|
+
clearForms();
|
|
548
|
+
active = plugin;
|
|
549
|
+
for (const [name, document] of Object.entries(plugin.documents)) {
|
|
550
|
+
const canvasId = formCanvas(name);
|
|
551
|
+
let action;
|
|
552
|
+
if (typeof document === "function") {
|
|
553
|
+
const value = artifact.documents?.[name];
|
|
554
|
+
action = { id: canvasId, data: isRecord(value) ? value : {}, layout: document(value) };
|
|
555
|
+
} else {
|
|
556
|
+
const ir = parse(document);
|
|
557
|
+
const wrap = needsWrap(document);
|
|
558
|
+
if (wrap) wrappedDocs.add(name);
|
|
559
|
+
const value = artifact.documents?.[name] ?? buildDocument(ir, {});
|
|
560
|
+
const built = toNova(ir, {
|
|
561
|
+
id: canvasId,
|
|
562
|
+
...wrap ? { rootKey: ROOT_KEY } : {},
|
|
563
|
+
...isRecord(value) ? { value } : {},
|
|
564
|
+
widgets: plugin.widgets ?? []
|
|
565
|
+
});
|
|
566
|
+
for (const [id, node] of Object.entries(built.layouts)) store.set(id, node);
|
|
567
|
+
action = built.action;
|
|
568
|
+
}
|
|
569
|
+
shell.registerAction(action);
|
|
570
|
+
shell.addCanvas({ id: canvasId, initial: action.id });
|
|
571
|
+
formCanvasIds.push(canvasId);
|
|
572
|
+
const instanceId = shell.getCanvasState(canvasId).active?.id;
|
|
573
|
+
if (instanceId !== void 0) formInstances[name] = instanceId;
|
|
574
|
+
}
|
|
575
|
+
for (const [name, instanceId] of Object.entries(formInstances)) {
|
|
576
|
+
const document = plugin.documents[name];
|
|
577
|
+
if (typeof document !== "function" && document !== void 0) {
|
|
578
|
+
const schema = wrappedDocs.has(name) ? zod.z.object({ [ROOT_KEY]: document }) : document;
|
|
579
|
+
detach.push(attachValidation(shell, instanceId, schema));
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
detach.push(
|
|
583
|
+
shell.onDataChange((change) => {
|
|
584
|
+
if (!Object.values(formInstances).includes(change.instanceId)) return;
|
|
585
|
+
refresh();
|
|
586
|
+
emit("change");
|
|
587
|
+
})
|
|
588
|
+
);
|
|
589
|
+
const viewIds = Object.keys(shell.getState().canvases).filter((id) => !formCanvasIds.includes(id)).sort((a, b) => Number(a.startsWith("loom:")) - Number(b.startsWith("loom:")));
|
|
590
|
+
shell.setCanvasLayout(defaultCanvasLayout(formCanvasIds, viewIds));
|
|
591
|
+
refresh();
|
|
592
|
+
emit("open");
|
|
593
|
+
emit("change");
|
|
594
|
+
};
|
|
595
|
+
const editor = {
|
|
596
|
+
get shell() {
|
|
597
|
+
return shell;
|
|
598
|
+
},
|
|
599
|
+
get plugin() {
|
|
600
|
+
return active;
|
|
601
|
+
},
|
|
602
|
+
get documents() {
|
|
603
|
+
return documents;
|
|
604
|
+
},
|
|
605
|
+
get validations() {
|
|
606
|
+
return validations;
|
|
607
|
+
},
|
|
608
|
+
loadPlugin: (plugin) => {
|
|
609
|
+
plugins.set(plugin.name, plugin);
|
|
610
|
+
plugin.mount?.(editor);
|
|
611
|
+
},
|
|
612
|
+
open,
|
|
613
|
+
on: (event, handler) => {
|
|
614
|
+
listeners[event].add(handler);
|
|
615
|
+
return () => listeners[event].delete(handler);
|
|
616
|
+
},
|
|
617
|
+
dispose: () => {
|
|
618
|
+
detach.forEach((off) => off());
|
|
619
|
+
detach = [];
|
|
620
|
+
shell.dispose();
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
return editor;
|
|
624
|
+
};
|
|
625
|
+
var groupStyle = { display: "flex", flexDirection: "column" };
|
|
626
|
+
var titleStyle = { fontSize: 15, fontWeight: 700, marginBottom: 8, color: "#111827" };
|
|
627
|
+
var fieldStyle = { display: "flex", flexDirection: "column", gap: 4, marginBottom: 12 };
|
|
628
|
+
var labelStyle = { fontSize: 13, fontWeight: 600, color: "#374151" };
|
|
629
|
+
var hintStyle = { fontSize: 12, color: "#6b7280" };
|
|
630
|
+
var LoomGroup = ({ title, children }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: groupStyle, children: [
|
|
631
|
+
title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: titleStyle, children: title }) : null,
|
|
632
|
+
children
|
|
633
|
+
] });
|
|
634
|
+
var LoomField = ({ label, description, required, error, children }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: fieldStyle, children: [
|
|
635
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: labelStyle, children: [
|
|
636
|
+
label,
|
|
637
|
+
required ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626" }, children: " *" }) : null
|
|
638
|
+
] }),
|
|
639
|
+
description !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: hintStyle, children: description }) : null,
|
|
640
|
+
children,
|
|
641
|
+
typeof error === "string" ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...hintStyle, color: "#dc2626" }, children: error }) : null
|
|
642
|
+
] });
|
|
643
|
+
var useModelWrite = (model) => {
|
|
644
|
+
const dispatch = react$1.useNovaDispatch();
|
|
645
|
+
return (value) => {
|
|
646
|
+
if (model !== void 0) dispatch({ type: "ui:model", ref: model.ref, payload: value });
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
// src/react/kit/shared.ts
|
|
651
|
+
var inputStyle = { padding: "6px 10px", border: "1px solid #d1d5db", borderRadius: 6, fontSize: 14, width: "100%", boxSizing: "border-box" };
|
|
652
|
+
var jsType = (value) => Array.isArray(value) ? "array" : value === null ? "null" : typeof value;
|
|
653
|
+
var decodeLiteral = (value) => typeof value === "string" ? JSON.parse(value) : value;
|
|
654
|
+
var matches = (value, pattern) => {
|
|
655
|
+
if (pattern.kind === "tag") return isRecord(value) && value[pattern.key] === pattern.value;
|
|
656
|
+
if (pattern.kind === "key") return isRecord(value) && pattern.key in value;
|
|
657
|
+
if (pattern.kind === "type") return jsType(value) === pattern.type;
|
|
658
|
+
return false;
|
|
659
|
+
};
|
|
660
|
+
var rawStyle = {
|
|
661
|
+
...inputStyle,
|
|
662
|
+
margin: 0,
|
|
663
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
664
|
+
fontSize: 13,
|
|
665
|
+
minHeight: 64,
|
|
666
|
+
resize: "vertical",
|
|
667
|
+
width: "100%",
|
|
668
|
+
boxSizing: "border-box"
|
|
669
|
+
};
|
|
670
|
+
var showJson = (value) => JSON.stringify(value ?? null, null, 2);
|
|
671
|
+
var JsonEditor = ({ value, onChange }) => {
|
|
672
|
+
const [text, setText] = react.useState(() => showJson(value));
|
|
673
|
+
const [valid, setValid] = react.useState(true);
|
|
674
|
+
const serialized = JSON.stringify(value ?? null);
|
|
675
|
+
react.useEffect(() => {
|
|
676
|
+
let mine;
|
|
677
|
+
try {
|
|
678
|
+
mine = JSON.parse(text);
|
|
679
|
+
} catch {
|
|
680
|
+
setText(showJson(value));
|
|
681
|
+
setValid(true);
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
if (JSON.stringify(mine ?? null) !== serialized) {
|
|
685
|
+
setText(showJson(value));
|
|
686
|
+
setValid(true);
|
|
687
|
+
}
|
|
688
|
+
}, [serialized]);
|
|
689
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
690
|
+
"textarea",
|
|
691
|
+
{
|
|
692
|
+
value: text,
|
|
693
|
+
spellCheck: false,
|
|
694
|
+
onChange: (event) => {
|
|
695
|
+
const next = event.target.value;
|
|
696
|
+
setText(next);
|
|
697
|
+
try {
|
|
698
|
+
const parsed = JSON.parse(next);
|
|
699
|
+
setValid(true);
|
|
700
|
+
onChange(parsed);
|
|
701
|
+
} catch {
|
|
702
|
+
setValid(false);
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
style: valid ? rawStyle : { ...rawStyle, borderColor: "#dc2626", background: "#fef2f2" }
|
|
706
|
+
}
|
|
707
|
+
);
|
|
708
|
+
};
|
|
709
|
+
var HTML_INPUT_TYPE = { email: "email", uri: "url", date: "date" };
|
|
710
|
+
var LoomText = ({
|
|
711
|
+
value,
|
|
712
|
+
format,
|
|
713
|
+
placeholder,
|
|
714
|
+
novaModel
|
|
715
|
+
}) => {
|
|
716
|
+
const set = useModelWrite(novaModel);
|
|
717
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
718
|
+
"input",
|
|
719
|
+
{
|
|
720
|
+
type: HTML_INPUT_TYPE[format ?? ""] ?? "text",
|
|
721
|
+
placeholder,
|
|
722
|
+
value: String(value ?? ""),
|
|
723
|
+
onChange: (event) => set(event.target.value),
|
|
724
|
+
style: inputStyle
|
|
725
|
+
}
|
|
726
|
+
);
|
|
727
|
+
};
|
|
728
|
+
var LoomNumber = ({ value, novaModel }) => {
|
|
729
|
+
const set = useModelWrite(novaModel);
|
|
730
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
731
|
+
"input",
|
|
732
|
+
{
|
|
733
|
+
type: "number",
|
|
734
|
+
value: Number.isFinite(value) ? value : "",
|
|
735
|
+
onChange: (event) => {
|
|
736
|
+
const raw = event.target.value;
|
|
737
|
+
set(raw ? Number(raw) : null);
|
|
738
|
+
},
|
|
739
|
+
style: inputStyle
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
};
|
|
743
|
+
var LoomCheckbox = ({ value, novaModel }) => {
|
|
744
|
+
const set = useModelWrite(novaModel);
|
|
745
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
746
|
+
"input",
|
|
747
|
+
{
|
|
748
|
+
type: "checkbox",
|
|
749
|
+
checked: Boolean(value),
|
|
750
|
+
onChange: (event) => set(event.target.checked),
|
|
751
|
+
style: { width: 16, height: 16 }
|
|
752
|
+
}
|
|
753
|
+
);
|
|
754
|
+
};
|
|
755
|
+
var LoomSelect = ({ value, options, novaModel }) => {
|
|
756
|
+
const set = useModelWrite(novaModel);
|
|
757
|
+
return /* @__PURE__ */ jsxRuntime.jsx("select", { value: String(value ?? ""), onChange: (event) => set(event.target.value), style: inputStyle, children: (options ?? []).map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: String(option.value), children: option.label }, String(option.value))) });
|
|
758
|
+
};
|
|
759
|
+
var LoomRaw = ({ value, novaModel }) => {
|
|
760
|
+
const set = useModelWrite(novaModel);
|
|
761
|
+
return /* @__PURE__ */ jsxRuntime.jsx(JsonEditor, { value, onChange: set });
|
|
762
|
+
};
|
|
763
|
+
var variantStyle = { display: "flex", flexDirection: "column", gap: 12 };
|
|
764
|
+
var ActiveBranch = react.createContext(0);
|
|
765
|
+
var LoomBranch = ({ index, children }) => react.useContext(ActiveBranch) === index ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) : null;
|
|
766
|
+
var LoomVariant = ({
|
|
767
|
+
value,
|
|
768
|
+
branches,
|
|
769
|
+
children,
|
|
770
|
+
novaModel
|
|
771
|
+
}) => {
|
|
772
|
+
const set = useModelWrite(novaModel);
|
|
773
|
+
const options = decodeLiteral(branches) ?? [];
|
|
774
|
+
const matched = options.findIndex((branch) => matches(value, branch.pattern));
|
|
775
|
+
const fallback = options.findIndex((branch) => branch.pattern.kind === "fallback");
|
|
776
|
+
const active = matched >= 0 ? matched : Math.max(0, fallback);
|
|
777
|
+
const switchTo = (chosen) => {
|
|
778
|
+
const activeKey = options[active]?.childrenKey;
|
|
779
|
+
const oldChildren = activeKey !== void 0 && isRecord(value) ? value[activeKey] : void 0;
|
|
780
|
+
if (chosen.childrenKey !== void 0 && Array.isArray(oldChildren)) {
|
|
781
|
+
set({ ...isRecord(chosen.defaults) ? chosen.defaults : {}, [chosen.childrenKey]: oldChildren });
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
if (Array.isArray(oldChildren) && oldChildren.length > 0 && !window.confirm("This type has no children. Discard them?")) return;
|
|
785
|
+
set(chosen.defaults);
|
|
786
|
+
};
|
|
787
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: variantStyle, children: [
|
|
788
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
789
|
+
"select",
|
|
790
|
+
{
|
|
791
|
+
value: active,
|
|
792
|
+
onChange: (event) => {
|
|
793
|
+
const chosen = options[Number(event.target.value)];
|
|
794
|
+
if (chosen !== void 0) switchTo(chosen);
|
|
795
|
+
},
|
|
796
|
+
style: inputStyle,
|
|
797
|
+
children: options.map((branch, index) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: index, children: branch.label }, index))
|
|
798
|
+
}
|
|
799
|
+
),
|
|
800
|
+
/* @__PURE__ */ jsxRuntime.jsx(ActiveBranch.Provider, { value: active, children })
|
|
801
|
+
] });
|
|
802
|
+
};
|
|
803
|
+
var trigger = { padding: "4px 8px", border: "1px solid #d1d5db", borderRadius: 6, background: "#fff", cursor: "pointer", fontSize: 13, lineHeight: 1 };
|
|
804
|
+
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 };
|
|
805
|
+
var menuRight = { ...base, top: "100%", right: 0, marginTop: 4 };
|
|
806
|
+
var menuLeft = { ...base, top: "100%", left: 0, marginTop: 4 };
|
|
807
|
+
var flyLeft = { ...base, top: 0, right: "100%", maxHeight: 280, overflowY: "auto" };
|
|
808
|
+
var flyRight = { ...base, top: 0, left: "100%", maxHeight: 280, overflowY: "auto" };
|
|
809
|
+
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 };
|
|
810
|
+
var itemDisabled = { ...itemStyle, color: "#9ca3af", cursor: "default" };
|
|
811
|
+
var MENU_CSS = ".loom-menu-item{background:transparent;border:none;}.loom-menu-item:hover:not(:disabled){background:#f3f4f6;}";
|
|
812
|
+
var MenuContext = react.createContext({ close: () => {
|
|
813
|
+
}, anchor: "right" });
|
|
814
|
+
var ActionMenu = ({
|
|
815
|
+
label = "\u22EF",
|
|
816
|
+
ariaLabel = "Actions",
|
|
817
|
+
anchor = "right",
|
|
818
|
+
children
|
|
819
|
+
}) => {
|
|
820
|
+
const [open, setOpen] = react.useState(false);
|
|
821
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": ariaLabel, onClick: () => setOpen((was) => !was), style: trigger, children: label }),
|
|
823
|
+
open ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
824
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { onMouseDown: () => setOpen(false), style: { position: "fixed", inset: 0, zIndex: 29 } }),
|
|
825
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: anchor === "right" ? menuRight : menuLeft, children: [
|
|
826
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: MENU_CSS }),
|
|
827
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuContext.Provider, { value: { close: () => setOpen(false), anchor }, children })
|
|
828
|
+
] })
|
|
829
|
+
] }) : null
|
|
830
|
+
] });
|
|
831
|
+
};
|
|
832
|
+
var MenuItem = ({ label, onSelect, disabled }) => {
|
|
833
|
+
const { close } = react.useContext(MenuContext);
|
|
834
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
835
|
+
"button",
|
|
836
|
+
{
|
|
837
|
+
type: "button",
|
|
838
|
+
className: "loom-menu-item",
|
|
839
|
+
disabled,
|
|
840
|
+
onClick: () => {
|
|
841
|
+
onSelect();
|
|
842
|
+
close();
|
|
843
|
+
},
|
|
844
|
+
style: disabled ? itemDisabled : itemStyle,
|
|
845
|
+
children: typeof label === "string" ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }) : label
|
|
846
|
+
}
|
|
847
|
+
);
|
|
848
|
+
};
|
|
849
|
+
var SubMenu = ({ label, children }) => {
|
|
850
|
+
const { anchor } = react.useContext(MenuContext);
|
|
851
|
+
const [open, setOpen] = react.useState(false);
|
|
852
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), children: [
|
|
853
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "loom-menu-item", onClick: () => setOpen((was) => !was), style: itemStyle, children: [
|
|
854
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u25B8" })
|
|
856
|
+
] }),
|
|
857
|
+
open ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: anchor === "right" ? flyLeft : flyRight, children }) : null
|
|
858
|
+
] });
|
|
859
|
+
};
|
|
860
|
+
var arrayStyle = { display: "flex", flexDirection: "column", gap: 8, padding: 12, border: "1px dashed #d1d5db", borderRadius: 6 };
|
|
861
|
+
var arrayItemStyle = { display: "flex", gap: 6, alignItems: "flex-start" };
|
|
862
|
+
var itemEditorStyle = { flex: 1, minWidth: 0 };
|
|
863
|
+
var addButtonStyle = { ...inputStyle, alignSelf: "flex-start", cursor: "pointer", background: "#f3f4f6" };
|
|
864
|
+
var LoomArray = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: arrayStyle, children });
|
|
865
|
+
var LoomArrayItem = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: arrayItemStyle, children });
|
|
866
|
+
var LoomBox = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: itemEditorStyle, children });
|
|
867
|
+
var LoomColumn = ({ grow, min, children }) => {
|
|
868
|
+
const style = { flexGrow: grow ?? 1, flexShrink: 1, flexBasis: min ?? 320, minWidth: min ?? 320 };
|
|
869
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style, children });
|
|
870
|
+
};
|
|
871
|
+
var LoomAppend = ({
|
|
872
|
+
label,
|
|
873
|
+
value,
|
|
874
|
+
child: child2,
|
|
875
|
+
novaModel
|
|
876
|
+
}) => {
|
|
877
|
+
const set = useModelWrite(novaModel);
|
|
878
|
+
const onClick = () => {
|
|
879
|
+
const current = Array.isArray(value) ? value : [];
|
|
880
|
+
set([...current, decodeLiteral(child2)]);
|
|
881
|
+
};
|
|
882
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick, style: addButtonStyle, children: label ?? "Add" });
|
|
883
|
+
};
|
|
884
|
+
var reorder = (list, from, to) => {
|
|
885
|
+
if (to < 0 || to >= list.length) return [...list];
|
|
886
|
+
const next = [...list];
|
|
887
|
+
const [moved] = next.splice(from, 1);
|
|
888
|
+
next.splice(to, 0, moved);
|
|
889
|
+
return next;
|
|
890
|
+
};
|
|
891
|
+
var LoomRowMenu = ({ index, containers, value, novaModel }) => {
|
|
892
|
+
const set = useModelWrite(novaModel);
|
|
893
|
+
const i = Number(index);
|
|
894
|
+
const list = Array.isArray(value) ? value : void 0;
|
|
895
|
+
if (list === void 0 || !Number.isInteger(i)) return null;
|
|
896
|
+
const element = list[i];
|
|
897
|
+
const targets = decodeLiteral(containers) ?? [];
|
|
898
|
+
const unwrapTarget = targets.find((container) => matches(element, container.pattern));
|
|
899
|
+
const wrapInto = (container) => [
|
|
900
|
+
...list.slice(0, i),
|
|
901
|
+
{ ...isRecord(container.defaults) ? container.defaults : {}, [container.key]: [element] },
|
|
902
|
+
...list.slice(i + 1)
|
|
903
|
+
];
|
|
904
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ActionMenu, { children: [
|
|
905
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItem, { label: "\u2191 Move up", onSelect: () => set(reorder(list, i, i - 1)), disabled: i === 0 }),
|
|
906
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItem, { label: "\u2193 Move down", onSelect: () => set(reorder(list, i, i + 1)), disabled: i === list.length - 1 }),
|
|
907
|
+
targets.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(SubMenu, { label: "\u29C9 Wrap in", children: targets.map((container, k) => /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { label: container.label, onSelect: () => set(wrapInto(container)) }, k)) }) : null,
|
|
908
|
+
unwrapTarget !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
909
|
+
MenuItem,
|
|
910
|
+
{
|
|
911
|
+
label: "\u21F2 Unwrap",
|
|
912
|
+
onSelect: () => {
|
|
913
|
+
const children = isRecord(element) && Array.isArray(element[unwrapTarget.key]) ? element[unwrapTarget.key] : [];
|
|
914
|
+
set([...list.slice(0, i), ...children, ...list.slice(i + 1)]);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
) : null,
|
|
918
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuItem, { label: "\u2715 Remove", onSelect: () => set(list.filter((_, j) => j !== i)) })
|
|
919
|
+
] });
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
// src/react/kit/index.ts
|
|
923
|
+
var loomComponents = {
|
|
924
|
+
[Roles.group]: LoomGroup,
|
|
925
|
+
[Roles.field]: LoomField,
|
|
926
|
+
[Roles.box]: LoomBox,
|
|
927
|
+
[Roles.array]: LoomArray,
|
|
928
|
+
[Roles.arrayItem]: LoomArrayItem,
|
|
929
|
+
[Roles.variant]: LoomVariant,
|
|
930
|
+
[Roles.branch]: LoomBranch,
|
|
931
|
+
[Roles.append]: LoomAppend,
|
|
932
|
+
[Roles.rowMenu]: LoomRowMenu,
|
|
933
|
+
[Roles.text]: LoomText,
|
|
934
|
+
[Roles.number]: LoomNumber,
|
|
935
|
+
[Roles.checkbox]: LoomCheckbox,
|
|
936
|
+
[Roles.select]: LoomSelect,
|
|
937
|
+
[Roles.raw]: LoomRaw,
|
|
938
|
+
[LOOM_COLUMN]: LoomColumn
|
|
939
|
+
};
|
|
940
|
+
var createLoomRegistry = () => {
|
|
941
|
+
const registry = nova.createComponentRegistry();
|
|
942
|
+
registry.registerAll(loomComponents);
|
|
943
|
+
return registry;
|
|
944
|
+
};
|
|
945
|
+
var LoomDocumentContext = react.createContext(void 0);
|
|
946
|
+
var useLoomDocument = () => react.useContext(LoomDocumentContext);
|
|
947
|
+
var LoomEditor = ({ plugins, artifact, onChange }) => {
|
|
948
|
+
const [api, setApi] = react.useState(null);
|
|
949
|
+
const [documents, setDocuments] = react.useState({});
|
|
950
|
+
react.useEffect(() => {
|
|
951
|
+
const registry = createLoomRegistry();
|
|
952
|
+
for (const plugin of plugins) {
|
|
953
|
+
for (const [role, component] of Object.entries(plugin.components ?? {})) registry.register(role, component);
|
|
954
|
+
}
|
|
955
|
+
const editor = createLoomEditor({ registry });
|
|
956
|
+
for (const plugin of plugins) {
|
|
957
|
+
editor.loadPlugin({
|
|
958
|
+
name: plugin.name,
|
|
959
|
+
documents: plugin.documents,
|
|
960
|
+
...plugin.widgets ? { widgets: plugin.widgets.map((w) => ({ role: w.role, match: w.match })) } : {},
|
|
961
|
+
...plugin.mount ? { mount: plugin.mount } : {}
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
editor.open(artifact);
|
|
965
|
+
setApi(editor);
|
|
966
|
+
setDocuments(editor.documents);
|
|
967
|
+
onChange?.(editor.documents);
|
|
968
|
+
const off = editor.on("change", () => {
|
|
969
|
+
setDocuments(editor.documents);
|
|
970
|
+
onChange?.(editor.documents);
|
|
971
|
+
});
|
|
972
|
+
return () => {
|
|
973
|
+
off();
|
|
974
|
+
editor.dispose();
|
|
975
|
+
setApi(null);
|
|
976
|
+
};
|
|
977
|
+
}, []);
|
|
978
|
+
const shell = api?.shell;
|
|
979
|
+
return shell === void 0 || shell === null ? null : /* @__PURE__ */ jsxRuntime.jsx(LoomDocumentContext.Provider, { value: documents, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.NovaShell, { shell }) });
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
// src/plugins/jsonviewer/jsonviewer.layout.ts
|
|
983
|
+
var JSONVIEWER = "loom:jsonviewer";
|
|
984
|
+
var jsonviewerLayout = {
|
|
985
|
+
component: JSONVIEWER,
|
|
986
|
+
props: { title: "Data", value: "$.value" }
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
// src/plugins/jsonviewer/jsonviewer.action.ts
|
|
990
|
+
var jsonviewerAction = {
|
|
991
|
+
id: JSONVIEWER,
|
|
992
|
+
layout: jsonviewerLayout,
|
|
993
|
+
data: { value: {} }
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
// src/plugins/jsonviewer/index.ts
|
|
997
|
+
var jsonviewerPlugin = () => ({
|
|
998
|
+
name: "loom:jsonviewer",
|
|
999
|
+
documents: {},
|
|
1000
|
+
mount: (editor) => mountView(editor, jsonviewerAction, (e) => ({ value: e.documents }))
|
|
1001
|
+
});
|
|
1002
|
+
var panel = { border: "1px solid #e5e7eb", borderRadius: 8, overflow: "hidden" };
|
|
1003
|
+
var head = { padding: "6px 12px", borderBottom: "1px solid #e5e7eb", background: "#f9fafb", fontSize: 12, fontWeight: 600, color: "#374151" };
|
|
1004
|
+
var pre = { margin: 0, padding: 12, fontSize: 12, fontFamily: "ui-monospace, Menlo, monospace", whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: 320, overflow: "auto" };
|
|
1005
|
+
var JsonViewer = ({ title, value }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: panel, children: [
|
|
1006
|
+
title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: head, children: title }) : null,
|
|
1007
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { style: pre, children: JSON.stringify(value ?? {}, null, 2) })
|
|
1008
|
+
] });
|
|
1009
|
+
|
|
1010
|
+
// src/plugins/jsonviewer/react/index.ts
|
|
1011
|
+
var jsonviewer = () => {
|
|
1012
|
+
const { name, documents, mount } = jsonviewerPlugin();
|
|
1013
|
+
return { name, documents, mount, components: { [JSONVIEWER]: JsonViewer } };
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
// src/plugins/validation/validation.layout.ts
|
|
1017
|
+
var VALIDATION = "loom:validation";
|
|
1018
|
+
var validationLayout = {
|
|
1019
|
+
component: VALIDATION,
|
|
1020
|
+
props: { title: "Validations", value: "$.value" }
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
// src/plugins/validation/validation.action.ts
|
|
1024
|
+
var validationAction = {
|
|
1025
|
+
id: VALIDATION,
|
|
1026
|
+
layout: validationLayout,
|
|
1027
|
+
data: { value: {} }
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
// src/plugins/validation/index.ts
|
|
1031
|
+
var validationPlugin = () => ({
|
|
1032
|
+
name: "loom:validation",
|
|
1033
|
+
documents: {},
|
|
1034
|
+
mount: (editor) => mountView(editor, validationAction, (e) => ({ value: e.validations }))
|
|
1035
|
+
});
|
|
1036
|
+
var panel2 = { border: "1px solid #e5e7eb", borderRadius: 8, overflow: "hidden" };
|
|
1037
|
+
var head2 = { padding: "6px 12px", borderBottom: "1px solid #e5e7eb", background: "#f9fafb", fontSize: 12, fontWeight: 600, color: "#374151" };
|
|
1038
|
+
var pre2 = { margin: 0, padding: 12, fontSize: 12, fontFamily: "ui-monospace, Menlo, monospace", whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: 320, overflow: "auto" };
|
|
1039
|
+
var Validation = ({ title, value }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: panel2, children: [
|
|
1040
|
+
title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: head2, children: title }) : null,
|
|
1041
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { style: pre2, children: JSON.stringify(value ?? {}, null, 2) })
|
|
1042
|
+
] });
|
|
1043
|
+
|
|
1044
|
+
// src/plugins/validation/react/index.ts
|
|
1045
|
+
var validation = () => {
|
|
1046
|
+
const { name, documents, mount } = validationPlugin();
|
|
1047
|
+
return { name, documents, mount, components: { [VALIDATION]: Validation } };
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
// src/react/editor/defaults.ts
|
|
1051
|
+
var defaultPlugins = () => [jsonviewer(), validation()];
|
|
1052
|
+
|
|
1053
|
+
exports.JsonEditor = JsonEditor;
|
|
1054
|
+
exports.LoomAppend = LoomAppend;
|
|
1055
|
+
exports.LoomArray = LoomArray;
|
|
1056
|
+
exports.LoomArrayItem = LoomArrayItem;
|
|
1057
|
+
exports.LoomBox = LoomBox;
|
|
1058
|
+
exports.LoomBranch = LoomBranch;
|
|
1059
|
+
exports.LoomCheckbox = LoomCheckbox;
|
|
1060
|
+
exports.LoomColumn = LoomColumn;
|
|
1061
|
+
exports.LoomEditor = LoomEditor;
|
|
1062
|
+
exports.LoomField = LoomField;
|
|
1063
|
+
exports.LoomGroup = LoomGroup;
|
|
1064
|
+
exports.LoomNumber = LoomNumber;
|
|
1065
|
+
exports.LoomRaw = LoomRaw;
|
|
1066
|
+
exports.LoomRowMenu = LoomRowMenu;
|
|
1067
|
+
exports.LoomSelect = LoomSelect;
|
|
1068
|
+
exports.LoomText = LoomText;
|
|
1069
|
+
exports.LoomVariant = LoomVariant;
|
|
1070
|
+
exports.createLoomRegistry = createLoomRegistry;
|
|
1071
|
+
exports.defaultPlugins = defaultPlugins;
|
|
1072
|
+
exports.loomComponents = loomComponents;
|
|
1073
|
+
exports.useLoomDocument = useLoomDocument;
|
|
1074
|
+
exports.useModelWrite = useModelWrite;
|
|
1075
|
+
//# sourceMappingURL=index.cjs.map
|
|
1076
|
+
//# sourceMappingURL=index.cjs.map
|