@niscorp/loom 0.2.0 → 0.2.2
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/CHANGELOG.md +53 -0
- package/DESIGN.md +38 -8
- package/README.md +28 -5
- package/dist/{chunk-LWY5TG7M.js → chunk-IZ5B6IMX.js} +7 -3
- package/dist/chunk-IZ5B6IMX.js.map +1 -0
- package/dist/{chunk-X7PCPONB.js → chunk-TCCN6LKV.js} +6 -4
- package/dist/chunk-TCCN6LKV.js.map +1 -0
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{loom-editor-D5SBQ4_F.d.ts → loom-editor-Clohg49u.d.ts} +1 -1
- package/dist/{loom-editor-CQ_GI4IA.d.cts → loom-editor-MACwUjLC.d.cts} +1 -1
- package/dist/plugins/nova/index.d.cts +1 -1
- package/dist/plugins/nova/index.d.ts +1 -1
- package/dist/plugins/nova/react/index.d.cts +2 -2
- package/dist/plugins/nova/react/index.d.ts +2 -2
- package/dist/plugins/prism/index.d.cts +1 -1
- package/dist/plugins/prism/index.d.ts +1 -1
- package/dist/plugins/prism/react/index.d.cts +2 -2
- package/dist/plugins/prism/react/index.d.ts +2 -2
- package/dist/plugins/vex/index.d.cts +1 -1
- package/dist/plugins/vex/index.d.ts +1 -1
- package/dist/plugins/vex/react/index.d.cts +2 -2
- package/dist/plugins/vex/react/index.d.ts +2 -2
- package/dist/plugins/vex/react/index.js +1 -1
- package/dist/react/index.cjs +9 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +3 -3
- package/dist/{types-BonjN3CB.d.cts → types-l8sDxrMR.d.cts} +5 -1
- package/dist/{types-BonjN3CB.d.ts → types-l8sDxrMR.d.ts} +5 -1
- package/package.json +9 -8
- package/dist/chunk-LWY5TG7M.js.map +0 -1
- package/dist/chunk-X7PCPONB.js.map +0 -1
package/dist/react/index.cjs
CHANGED
|
@@ -556,7 +556,8 @@ var createLoomEditor = (config) => {
|
|
|
556
556
|
const ir = parse(document);
|
|
557
557
|
const wrap = needsWrap(document);
|
|
558
558
|
if (wrap) wrappedDocs.add(name);
|
|
559
|
-
const
|
|
559
|
+
const seed = artifact.documents?.[name];
|
|
560
|
+
const value = seed ?? buildDocument(ir, {});
|
|
560
561
|
const built = toNova(ir, {
|
|
561
562
|
id: canvasId,
|
|
562
563
|
...wrap ? { rootKey: ROOT_KEY } : {},
|
|
@@ -564,7 +565,8 @@ var createLoomEditor = (config) => {
|
|
|
564
565
|
widgets: plugin.widgets ?? []
|
|
565
566
|
});
|
|
566
567
|
for (const [id, node] of Object.entries(built.layouts)) store.set(id, node);
|
|
567
|
-
|
|
568
|
+
const seedsRoot = wrap && seed !== void 0 && seed !== null && !isRecord(seed) && document.safeParse(seed).success;
|
|
569
|
+
action = seedsRoot ? { ...built.action, data: { [ROOT_KEY]: seed } } : built.action;
|
|
568
570
|
}
|
|
569
571
|
shell.registerAction(action);
|
|
570
572
|
shell.addCanvas({ id: canvasId, initial: action.id });
|
|
@@ -754,7 +756,11 @@ var LoomCheckbox = ({ value, novaModel }) => {
|
|
|
754
756
|
};
|
|
755
757
|
var LoomSelect = ({ value, options, novaModel }) => {
|
|
756
758
|
const set = useModelWrite(novaModel);
|
|
757
|
-
|
|
759
|
+
const choose = (text) => {
|
|
760
|
+
const chosen = (options ?? []).find((option) => String(option.value) === text);
|
|
761
|
+
set(chosen === void 0 ? text : chosen.value);
|
|
762
|
+
};
|
|
763
|
+
return /* @__PURE__ */ jsxRuntime.jsx("select", { value: String(value ?? ""), onChange: (event) => choose(event.target.value), style: inputStyle, children: (options ?? []).map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: String(option.value), children: option.label }, String(option.value))) });
|
|
758
764
|
};
|
|
759
765
|
var LoomRaw = ({ value, novaModel }) => {
|
|
760
766
|
const set = useModelWrite(novaModel);
|