@cratis/event-models 0.175.0 → 0.177.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/dist/screen-editor/BindingExpressionPropertyEditor-DbYpy_bX.js +426 -0
- package/dist/screen-editor/BooleanEditor-eC1yCpz0.js +17 -0
- package/dist/screen-editor/CollectionEditor-C7eX8Hw7.js +320 -0
- package/dist/screen-editor/ColorEditor-Cc6Xq8pW.js +49 -0
- package/dist/screen-editor/ColumnListEditor-Cku6GGLp.js +103 -0
- package/dist/screen-editor/EnumEditor-DNnnf9i3.js +26 -0
- package/dist/screen-editor/FieldEditor-SquvComm.js +66 -0
- package/dist/screen-editor/FieldListEditor-CNxskXPf.js +56 -0
- package/dist/screen-editor/IconEditor-C0ibqn-e.js +22 -0
- package/dist/screen-editor/InheritanceModeEditor-CtdsACnc.js +65 -0
- package/dist/screen-editor/ListEditor-CfFPVVJ4.js +53 -0
- package/dist/screen-editor/NavigationTargetEditor-DGnW5pVF.js +41 -0
- package/dist/screen-editor/NumberEditor-Cyo9_23Z.js +48 -0
- package/dist/screen-editor/QueryBindingEditor-3C_utVJm.js +17 -0
- package/dist/screen-editor/QueryBindingPropertyEditor-DLlC-slh.js +169 -0
- package/dist/screen-editor/ReferenceEditor-BnI2Qd7H.js +32 -0
- package/dist/screen-editor/ReferenceTargetEditors-COKAWO5q.js +19 -0
- package/dist/screen-editor/RenderingSlotEditor-Cani_PtT.js +128 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorOverlay.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWorkspace.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/Host/useScreenEditor.d.ts +2 -1
- package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +1 -3
- package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +5 -4
- package/dist/screen-editor/ScreenEditor/Palette/ComponentPicker.d.ts +21 -0
- package/dist/screen-editor/ScreenEditor/Palette/PaletteFolders.d.ts +12 -4
- package/dist/screen-editor/ScreenEditor/Palette/buildPalette.d.ts +2 -9
- package/dist/screen-editor/ScreenEditor/Palette/componentPickerModel.d.ts +54 -0
- package/dist/screen-editor/ScreenEditor/Palette/componentPickerStorage.d.ts +15 -0
- package/dist/screen-editor/ScreenEditor/Palette/useComponentPalette.d.ts +18 -0
- package/dist/screen-editor/ScreenEditor/Properties/choiceKeys.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/Properties/toPropertyGroups.d.ts +6 -7
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/BooleanEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ColorEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/EnumEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/IconEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/NumberEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ReferenceEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/SelectEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/TextEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/draftProblem.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +13 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +91 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorRegistry.d.ts +24 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +73 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +26 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +20 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createPropertyEditorRegistry.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/screenEditorPropertyEditors.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/BindingExpressionPropertyEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/CollectionEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ColumnListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldEditor.d.ts +23 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/InheritanceModeEditor.d.ts +4 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationTargetEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/OrderedItemsEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/RenderingSlotEditor.d.ts +8 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +5 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StateChangeEditors.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StructuredPropertyEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SummaryEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/UndescribedEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/fieldKind.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/index.d.ts +0 -3
- package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +109 -0
- package/dist/screen-editor/SelectEditor-BuQPlIyf.js +26 -0
- package/dist/screen-editor/SliceEditor-Dle8OlsB.js +45 -0
- package/dist/screen-editor/StateChangeEditors-9k3Gqtc0.js +15 -0
- package/dist/screen-editor/StructuredPropertyEditor-B3lVjrHZ.js +13 -0
- package/dist/screen-editor/StructuredValueEditor-CcwyOga0.js +337 -0
- package/dist/screen-editor/SummaryEditor-C5wP1uIH.js +23 -0
- package/dist/screen-editor/TextEditor-BEH-9K1S.js +40 -0
- package/dist/screen-editor/UndescribedEditor-Cqs6bHhD.js +10 -0
- package/dist/screen-editor/allowedIconChoices-DBgeRdGI.js +138 -0
- package/dist/screen-editor/choiceKeys-DQcUX97p.js +17 -0
- package/dist/screen-editor/defaultStructuredEditorStrings-Ch1I0Lci.js +137 -0
- package/dist/screen-editor/draftProblem-BGC5Gfsv.js +12 -0
- package/dist/screen-editor/iconDiagnostics-Ds4CnqD0.js +49 -0
- package/dist/screen-editor/index.js +3395 -4482
- package/dist/screen-editor/screen-editor.css +1 -1
- package/dist/screen-editor/structuredValue-vqCZttsk.js +61 -0
- package/package.json +12 -12
- package/dist/screen-editor/ScreenEditor/Inspector/IconProperties.d.ts +0 -14
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/StructuredProperties.d.ts +0 -9
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/UndescribedProperties.d.ts +0 -7
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/classifyStructures.d.ts +0 -6
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useId as O, useMemo as q, useRef as B, useState as f } from "react";
|
|
2
|
+
import { jsx as l, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
function F(d, r) {
|
|
4
|
+
const s = r.trim().toLowerCase();
|
|
5
|
+
return d.filter((a) => s === "" || a.label.toLowerCase().includes(s) || (a.group ?? "").toLowerCase().includes(s));
|
|
6
|
+
}
|
|
7
|
+
var R = ({ id: d, options: r, value: s, onChange: a, disabled: _, invalid: D, placeholder: C, searchLabel: b, emptyLabel: M, clearLabel: A, clearable: S, renderClosed: v, ...j }) => {
|
|
8
|
+
const [i, g] = f(!1), [u, w] = f(""), [y, h] = f(0), N = O(), k = B(null), m = r.find((e) => e.value === s), n = q(() => F(r, u), [r, u]), o = n.filter((e) => e.disabled !== !0), p = () => {
|
|
9
|
+
g(!1), w("");
|
|
10
|
+
}, x = (e) => {
|
|
11
|
+
e.disabled || (a(e.value), p());
|
|
12
|
+
}, E = (e) => {
|
|
13
|
+
if (e.key === "Escape") {
|
|
14
|
+
e.stopPropagation(), p();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
18
|
+
if (e.preventDefault(), o.length === 0) return;
|
|
19
|
+
h((t) => (t + (e.key === "ArrowDown" ? 1 : -1) + o.length) % o.length);
|
|
20
|
+
} else if (e.key === "Enter") {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
const t = o[Math.min(y, o.length - 1)];
|
|
23
|
+
t && x(t);
|
|
24
|
+
}
|
|
25
|
+
}, I = [...new Set(n.map((e) => e.group ?? ""))].sort((e, t) => e === "" ? -1 : t === "" ? 1 : 0), K = o[Math.min(y, Math.max(o.length - 1, 0))]?.value;
|
|
26
|
+
return /* @__PURE__ */ c("div", {
|
|
27
|
+
ref: k,
|
|
28
|
+
className: "studio-editor-select",
|
|
29
|
+
onKeyDown: i ? E : void 0,
|
|
30
|
+
onBlur: (e) => {
|
|
31
|
+
k.current?.contains(e.relatedTarget) || p();
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ l("button", {
|
|
35
|
+
type: "button",
|
|
36
|
+
id: d,
|
|
37
|
+
role: "combobox",
|
|
38
|
+
"aria-haspopup": "listbox",
|
|
39
|
+
"aria-expanded": i,
|
|
40
|
+
"aria-controls": i ? N : void 0,
|
|
41
|
+
"aria-invalid": D || void 0,
|
|
42
|
+
className: "studio-editor-select__trigger",
|
|
43
|
+
disabled: _,
|
|
44
|
+
...j,
|
|
45
|
+
onClick: () => {
|
|
46
|
+
g(!i), h(0);
|
|
47
|
+
},
|
|
48
|
+
children: v ? v(m) : /* @__PURE__ */ l("span", {
|
|
49
|
+
className: m ? void 0 : "studio-editor-select__placeholder",
|
|
50
|
+
children: m?.label ?? C
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
S === !0 && s !== void 0 && !_ && /* @__PURE__ */ l("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
className: "studio-editor-select__clear",
|
|
56
|
+
"aria-label": A,
|
|
57
|
+
onClick: () => a(void 0),
|
|
58
|
+
children: "×"
|
|
59
|
+
}),
|
|
60
|
+
i && /* @__PURE__ */ c("div", {
|
|
61
|
+
className: "studio-editor-select__panel",
|
|
62
|
+
children: [/* @__PURE__ */ l("input", {
|
|
63
|
+
type: "search",
|
|
64
|
+
autoFocus: !0,
|
|
65
|
+
className: "studio-editor-select__search",
|
|
66
|
+
"aria-label": b,
|
|
67
|
+
placeholder: b,
|
|
68
|
+
value: u,
|
|
69
|
+
onChange: (e) => {
|
|
70
|
+
w(e.target.value), h(0);
|
|
71
|
+
}
|
|
72
|
+
}), /* @__PURE__ */ c("ul", {
|
|
73
|
+
id: N,
|
|
74
|
+
role: "listbox",
|
|
75
|
+
className: "studio-editor-select__options",
|
|
76
|
+
children: [n.length === 0 && /* @__PURE__ */ l("li", {
|
|
77
|
+
className: "studio-editor-select__empty",
|
|
78
|
+
children: M
|
|
79
|
+
}), I.map((e) => /* @__PURE__ */ c("li", {
|
|
80
|
+
role: "presentation",
|
|
81
|
+
children: [e !== "" && /* @__PURE__ */ l("div", {
|
|
82
|
+
className: "studio-editor-select__group",
|
|
83
|
+
children: e
|
|
84
|
+
}), /* @__PURE__ */ l("ul", {
|
|
85
|
+
role: "presentation",
|
|
86
|
+
children: n.filter((t) => (t.group ?? "") === e).map((t) => /* @__PURE__ */ c("li", {
|
|
87
|
+
role: "option",
|
|
88
|
+
"aria-selected": t.value === s,
|
|
89
|
+
"aria-disabled": t.disabled || void 0,
|
|
90
|
+
className: [
|
|
91
|
+
"studio-editor-select__option",
|
|
92
|
+
t.value === K ? "studio-editor-select__option--active" : "",
|
|
93
|
+
t.value === s ? "studio-editor-select__option--chosen" : ""
|
|
94
|
+
].join(" ").trim(),
|
|
95
|
+
title: t.reason,
|
|
96
|
+
onMouseDown: (L) => L.preventDefault(),
|
|
97
|
+
onClick: () => x(t),
|
|
98
|
+
children: [/* @__PURE__ */ l("span", { children: t.label }), t.disabled && t.reason && /* @__PURE__ */ l("small", { children: t.reason })]
|
|
99
|
+
}, t.value))
|
|
100
|
+
})]
|
|
101
|
+
}, e))]
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
R as t
|
|
109
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as b, t as p } from "./choiceKeys-DQcUX97p.js";
|
|
2
|
+
import { t as h } from "./SearchableSelect-WUNlC3tk.js";
|
|
3
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
4
|
+
var x = ({ value: i, onChange: c, descriptor: o, context: s, disabled: n, problem: d, id: r }) => {
|
|
5
|
+
const a = s.strings.editors.select, l = i ?? void 0, t = b(o.choices ?? [], l);
|
|
6
|
+
return /* @__PURE__ */ m(h, {
|
|
7
|
+
id: r,
|
|
8
|
+
options: t.map((e) => ({
|
|
9
|
+
value: e.key,
|
|
10
|
+
label: e.label
|
|
11
|
+
})),
|
|
12
|
+
value: l === void 0 ? void 0 : p(l),
|
|
13
|
+
disabled: n,
|
|
14
|
+
invalid: d !== void 0,
|
|
15
|
+
placeholder: a.placeholder,
|
|
16
|
+
searchLabel: a.search,
|
|
17
|
+
emptyLabel: a.empty,
|
|
18
|
+
clearLabel: a.clear,
|
|
19
|
+
clearable: o.constraints?.required !== !0,
|
|
20
|
+
"aria-labelledby": `${r}-label`,
|
|
21
|
+
onChange: (e) => c(e === void 0 ? void 0 : t.find((v) => v.key === e)?.value)
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
x as SelectEditor
|
|
26
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { t as m } from "./SearchableSelect-WUNlC3tk.js";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
function b(t, a, o) {
|
|
4
|
+
return (t.slices.length > 0 ? t.slices : t.stateChangeSlices.map((e) => ({
|
|
5
|
+
id: e.id,
|
|
6
|
+
name: e.name,
|
|
7
|
+
kind: "StateChange",
|
|
8
|
+
path: e.origin
|
|
9
|
+
}))).map((e) => {
|
|
10
|
+
const l = a === void 0 || a.includes(e.kind);
|
|
11
|
+
return {
|
|
12
|
+
value: e.id,
|
|
13
|
+
label: e.name,
|
|
14
|
+
group: e.path.join(" › "),
|
|
15
|
+
...l ? {} : {
|
|
16
|
+
disabled: !0,
|
|
17
|
+
reason: o.slice.notKind(a?.[0] ?? e.kind)
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var g = ({ value: t, onChange: a, descriptor: o, context: e, disabled: l, problem: c, id: s }) => {
|
|
23
|
+
const r = e.strings.editors, i = b(e.lookups, o.editorOptions?.kinds, r), n = typeof t == "string" && t !== "" ? t : void 0, d = n !== void 0 && !i.some((p) => p.value === n);
|
|
24
|
+
return /* @__PURE__ */ u(m, {
|
|
25
|
+
id: s,
|
|
26
|
+
options: d ? [...i, {
|
|
27
|
+
value: n,
|
|
28
|
+
label: n,
|
|
29
|
+
group: ""
|
|
30
|
+
}] : i,
|
|
31
|
+
value: n,
|
|
32
|
+
disabled: l,
|
|
33
|
+
invalid: d || c !== void 0,
|
|
34
|
+
placeholder: r.slice.placeholder,
|
|
35
|
+
searchLabel: r.select.search,
|
|
36
|
+
emptyLabel: r.select.empty,
|
|
37
|
+
clearLabel: r.select.clear,
|
|
38
|
+
clearable: o.constraints?.required !== !0,
|
|
39
|
+
"aria-labelledby": `${s}-label`,
|
|
40
|
+
onChange: a
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
g as SliceEditor
|
|
45
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SliceEditor as r } from "./SliceEditor-Dle8OlsB.js";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
var d = (t) => /* @__PURE__ */ i(r, {
|
|
4
|
+
...t,
|
|
5
|
+
descriptor: {
|
|
6
|
+
...t.descriptor,
|
|
7
|
+
editorOptions: {
|
|
8
|
+
kinds: ["StateChange"],
|
|
9
|
+
...t.descriptor.editorOptions
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
d as StateChangeEditor
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as s } from "./StructuredValueEditor-CcwyOga0.js";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
var p = ({ value: r, onChange: t, descriptor: e, context: i, disabled: d, id: o }) => /* @__PURE__ */ u(s, {
|
|
4
|
+
descriptor: e,
|
|
5
|
+
value: r,
|
|
6
|
+
idPrefix: o,
|
|
7
|
+
strings: i.strings.structured,
|
|
8
|
+
disabled: d === !0,
|
|
9
|
+
onChange: t
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
p as StructuredPropertyEditor
|
|
13
|
+
};
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { a as E, d as I, f as j, g as $, h as K, i as F, l as N, n as P, o as _, r as V, s as D, t as T, u as M, v as g, y as w } from "./structuredValue-vqCZttsk.js";
|
|
2
|
+
import { PropertyValueType as y } from "@cratis/scene.model";
|
|
3
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
var L = ({ descriptor: t, value: a, id: b, strings: r, disabled: n, onChange: o }) => {
|
|
5
|
+
const c = t.editorKind === I, l = T(a), u = (m) => o(m.length === 0 ? void 0 : m);
|
|
6
|
+
return /* @__PURE__ */ s("fieldset", {
|
|
7
|
+
className: "studio-editor-structured__list",
|
|
8
|
+
disabled: n,
|
|
9
|
+
children: [
|
|
10
|
+
/* @__PURE__ */ e("legend", { children: t.label }),
|
|
11
|
+
l.map((m, d) => /* @__PURE__ */ s("div", {
|
|
12
|
+
className: "studio-editor-structured__entry",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ e("input", {
|
|
15
|
+
id: `${b}-${d}`,
|
|
16
|
+
"aria-label": r.entry(d + 1),
|
|
17
|
+
type: c ? "number" : "text",
|
|
18
|
+
value: c ? typeof m == "number" ? String(m) : "" : typeof m == "string" ? m : "",
|
|
19
|
+
onChange: (i) => o(g(l, d, c ? i.target.value === "" ? 0 : Number(i.target.value) : i.target.value))
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ e("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
"aria-label": r.moveEntryUp(d + 1),
|
|
24
|
+
disabled: d === 0,
|
|
25
|
+
onClick: () => o(N(l, d, -1)),
|
|
26
|
+
children: r.moveUpText
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ e("button", {
|
|
29
|
+
type: "button",
|
|
30
|
+
"aria-label": r.moveEntryDown(d + 1),
|
|
31
|
+
disabled: d === l.length - 1,
|
|
32
|
+
onClick: () => o(N(l, d, 1)),
|
|
33
|
+
children: r.moveDownText
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ e("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
"aria-label": r.removeEntry(d + 1),
|
|
38
|
+
onClick: () => u(w(l, d)),
|
|
39
|
+
children: r.removeText
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
}, d)),
|
|
43
|
+
/* @__PURE__ */ e("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick: () => o([...l, c ? 0 : ""]),
|
|
46
|
+
children: r.addEntry
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
}, U = (t) => typeof t == "number" ? "number" : typeof t == "boolean" ? "flag" : "text", O = ({ label: t, value: a, id: b, strings: r, disabled: n, onChange: o }) => {
|
|
51
|
+
const c = U(a), l = (u) => {
|
|
52
|
+
u !== c && o(u === "number" ? typeof a == "string" && a.trim() !== "" && Number.isFinite(Number(a)) ? Number(a) : 0 : u === "flag" ? a === !0 || a === "true" : a === void 0 ? void 0 : String(a));
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ s("div", {
|
|
55
|
+
className: "studio-editor-structured__scalar",
|
|
56
|
+
children: [/* @__PURE__ */ s("select", {
|
|
57
|
+
"aria-label": `${t} ${r.scalarType}`,
|
|
58
|
+
disabled: n,
|
|
59
|
+
value: c,
|
|
60
|
+
onChange: (u) => l(u.target.value),
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ e("option", {
|
|
63
|
+
value: "text",
|
|
64
|
+
children: r.scalarText
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ e("option", {
|
|
67
|
+
value: "number",
|
|
68
|
+
children: r.scalarNumber
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ e("option", {
|
|
71
|
+
value: "flag",
|
|
72
|
+
children: r.scalarFlag
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
}), c === "flag" ? /* @__PURE__ */ s("label", { children: [/* @__PURE__ */ e("input", {
|
|
76
|
+
id: b,
|
|
77
|
+
type: "checkbox",
|
|
78
|
+
disabled: n,
|
|
79
|
+
checked: a === !0,
|
|
80
|
+
onChange: (u) => o(u.target.checked)
|
|
81
|
+
}), /* @__PURE__ */ e("span", { children: r.scalarFlagOn })] }) : /* @__PURE__ */ e("input", {
|
|
82
|
+
id: b,
|
|
83
|
+
"aria-label": t,
|
|
84
|
+
type: c === "number" ? "number" : "text",
|
|
85
|
+
disabled: n,
|
|
86
|
+
value: a === void 0 ? "" : String(a),
|
|
87
|
+
onChange: (u) => o(u.target.value === "" ? void 0 : c === "number" ? Number(u.target.value) : u.target.value)
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
}, A = (t) => [
|
|
91
|
+
"string",
|
|
92
|
+
"number",
|
|
93
|
+
"boolean"
|
|
94
|
+
].includes(typeof t), B = ({ descriptor: t, value: a, id: b, strings: r, disabled: n, onChange: o }) => {
|
|
95
|
+
const c = _(a) ? a : {}, l = Object.entries(c), u = (i) => o(i.length === 0 ? void 0 : Object.fromEntries(i)), m = (i, f) => {
|
|
96
|
+
const p = f.trim();
|
|
97
|
+
p === "" || p === l[i][0] || l.some(([h], v) => v !== i && h === p) || u(l.map(([h, v], k) => k === i ? [p, v] : [h, v]));
|
|
98
|
+
}, d = () => {
|
|
99
|
+
let i = l.length + 1;
|
|
100
|
+
for (; `value${i}` in c; ) i++;
|
|
101
|
+
u([...l, [`value${i}`, ""]]);
|
|
102
|
+
};
|
|
103
|
+
return /* @__PURE__ */ s("fieldset", {
|
|
104
|
+
className: "studio-editor-structured__list",
|
|
105
|
+
disabled: n,
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ e("legend", { children: t.label }),
|
|
108
|
+
l.map(([i, f], p) => /* @__PURE__ */ s("div", {
|
|
109
|
+
className: "studio-editor-structured__entry",
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ e("input", {
|
|
112
|
+
"aria-label": r.mapName(p + 1),
|
|
113
|
+
defaultValue: i,
|
|
114
|
+
onBlur: (h) => {
|
|
115
|
+
m(p, h.target.value), h.target.value = i;
|
|
116
|
+
}
|
|
117
|
+
}),
|
|
118
|
+
A(f) ? /* @__PURE__ */ e(O, {
|
|
119
|
+
label: r.mapValue(i),
|
|
120
|
+
value: f,
|
|
121
|
+
id: `${b}-${p}`,
|
|
122
|
+
strings: r,
|
|
123
|
+
disabled: n,
|
|
124
|
+
onChange: (h) => u(l.map(([v, k]) => v === i ? [v, h === void 0 ? "" : h] : [v, k]))
|
|
125
|
+
}) : /* @__PURE__ */ e("span", { children: r.keptValue }),
|
|
126
|
+
/* @__PURE__ */ e("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
"aria-label": r.removeMapEntry(i),
|
|
129
|
+
onClick: () => u(l.filter(([h]) => h !== i)),
|
|
130
|
+
children: r.removeText
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}, i)),
|
|
134
|
+
/* @__PURE__ */ e("button", {
|
|
135
|
+
type: "button",
|
|
136
|
+
onClick: d,
|
|
137
|
+
children: r.addMapEntry
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}, R = ({ descriptor: t, value: a, id: b, strings: r, disabled: n, onChange: o }) => Array.isArray(a) ? /* @__PURE__ */ s("div", {
|
|
142
|
+
className: "studio-editor-structured__either",
|
|
143
|
+
children: [/* @__PURE__ */ e(L, {
|
|
144
|
+
descriptor: t,
|
|
145
|
+
value: a,
|
|
146
|
+
id: b,
|
|
147
|
+
strings: r,
|
|
148
|
+
disabled: n,
|
|
149
|
+
onChange: o
|
|
150
|
+
}), /* @__PURE__ */ e("button", {
|
|
151
|
+
type: "button",
|
|
152
|
+
disabled: n,
|
|
153
|
+
onClick: () => o(typeof a[0] == "string" && a[0] !== "" ? a[0] : void 0),
|
|
154
|
+
children: `${t.label}: ${r.useSingle}`
|
|
155
|
+
})]
|
|
156
|
+
}) : /* @__PURE__ */ s("div", {
|
|
157
|
+
className: "studio-editor-structured__either",
|
|
158
|
+
children: [/* @__PURE__ */ s("label", {
|
|
159
|
+
className: "studio-editor-structured__field",
|
|
160
|
+
children: [/* @__PURE__ */ e("span", { children: t.label }), /* @__PURE__ */ e("input", {
|
|
161
|
+
id: b,
|
|
162
|
+
disabled: n,
|
|
163
|
+
value: typeof a == "string" ? a : "",
|
|
164
|
+
onChange: (c) => o(c.target.value === "" ? void 0 : c.target.value)
|
|
165
|
+
})]
|
|
166
|
+
}), /* @__PURE__ */ e("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
disabled: n,
|
|
169
|
+
onClick: () => o(typeof a == "string" && a !== "" ? [a] : [""]),
|
|
170
|
+
children: `${t.label}: ${r.useList}`
|
|
171
|
+
})]
|
|
172
|
+
}), S = ({ descriptor: t, value: a, idPrefix: b, strings: r, disabled: n, onChange: o }) => {
|
|
173
|
+
const c = `${b}-${t.path}`;
|
|
174
|
+
switch (t.valueType) {
|
|
175
|
+
case y.String:
|
|
176
|
+
return /* @__PURE__ */ s("label", {
|
|
177
|
+
className: "studio-editor-structured__field",
|
|
178
|
+
children: [/* @__PURE__ */ e("span", { children: t.label }), /* @__PURE__ */ e("input", {
|
|
179
|
+
id: c,
|
|
180
|
+
disabled: n,
|
|
181
|
+
value: typeof a == "string" ? a : "",
|
|
182
|
+
onChange: (l) => o(l.target.value === "" ? void 0 : l.target.value)
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
case y.Number:
|
|
186
|
+
return /* @__PURE__ */ s("label", {
|
|
187
|
+
className: "studio-editor-structured__field",
|
|
188
|
+
children: [/* @__PURE__ */ e("span", { children: t.label }), /* @__PURE__ */ e("input", {
|
|
189
|
+
id: c,
|
|
190
|
+
type: "number",
|
|
191
|
+
disabled: n,
|
|
192
|
+
value: typeof a == "number" ? String(a) : "",
|
|
193
|
+
onChange: (l) => o(l.target.value === "" ? void 0 : Number(l.target.value))
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
case y.Boolean:
|
|
197
|
+
return /* @__PURE__ */ s("label", {
|
|
198
|
+
className: "studio-editor-structured__field studio-editor-structured__field--flag",
|
|
199
|
+
children: [/* @__PURE__ */ e("input", {
|
|
200
|
+
id: c,
|
|
201
|
+
type: "checkbox",
|
|
202
|
+
disabled: n,
|
|
203
|
+
checked: a === !0,
|
|
204
|
+
onChange: (l) => o(l.target.checked)
|
|
205
|
+
}), /* @__PURE__ */ e("span", { children: t.label })]
|
|
206
|
+
});
|
|
207
|
+
case y.Enum: {
|
|
208
|
+
const l = t.choices ?? [], u = l.findIndex((m) => m.value === a);
|
|
209
|
+
return /* @__PURE__ */ s("label", {
|
|
210
|
+
className: "studio-editor-structured__field",
|
|
211
|
+
children: [/* @__PURE__ */ e("span", { children: t.label }), /* @__PURE__ */ s("select", {
|
|
212
|
+
id: c,
|
|
213
|
+
disabled: n,
|
|
214
|
+
value: u < 0 ? "" : String(u),
|
|
215
|
+
onChange: (m) => o(m.target.value === "" ? void 0 : l[Number(m.target.value)]?.value),
|
|
216
|
+
children: [/* @__PURE__ */ e("option", {
|
|
217
|
+
value: "",
|
|
218
|
+
children: r.unset
|
|
219
|
+
}), l.map((m, d) => /* @__PURE__ */ e("option", {
|
|
220
|
+
value: String(d),
|
|
221
|
+
children: m.label
|
|
222
|
+
}, d))]
|
|
223
|
+
})]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (E(t) && t.editorKind === j) return /* @__PURE__ */ s("label", {
|
|
228
|
+
className: "studio-editor-structured__field",
|
|
229
|
+
children: [/* @__PURE__ */ e("span", { children: t.label }), /* @__PURE__ */ e(O, {
|
|
230
|
+
label: t.label,
|
|
231
|
+
value: a,
|
|
232
|
+
id: c,
|
|
233
|
+
strings: r,
|
|
234
|
+
disabled: n,
|
|
235
|
+
onChange: o
|
|
236
|
+
})]
|
|
237
|
+
});
|
|
238
|
+
if (E(t) && t.editorKind === K) return /* @__PURE__ */ e(R, {
|
|
239
|
+
descriptor: t,
|
|
240
|
+
value: a,
|
|
241
|
+
id: c,
|
|
242
|
+
strings: r,
|
|
243
|
+
disabled: n,
|
|
244
|
+
onChange: o
|
|
245
|
+
});
|
|
246
|
+
if (D(t)) return /* @__PURE__ */ e(B, {
|
|
247
|
+
descriptor: t,
|
|
248
|
+
value: a,
|
|
249
|
+
id: c,
|
|
250
|
+
strings: r,
|
|
251
|
+
disabled: n,
|
|
252
|
+
onChange: o
|
|
253
|
+
});
|
|
254
|
+
if (E(t)) return /* @__PURE__ */ e(L, {
|
|
255
|
+
descriptor: t,
|
|
256
|
+
value: a,
|
|
257
|
+
id: c,
|
|
258
|
+
strings: r,
|
|
259
|
+
disabled: n,
|
|
260
|
+
onChange: o
|
|
261
|
+
});
|
|
262
|
+
if (F(t)) return /* @__PURE__ */ s("fieldset", {
|
|
263
|
+
className: "studio-editor-structured__object",
|
|
264
|
+
disabled: n,
|
|
265
|
+
children: [/* @__PURE__ */ e("legend", { children: t.label }), t.properties.map((l) => /* @__PURE__ */ e(S, {
|
|
266
|
+
descriptor: l,
|
|
267
|
+
value: _(a) ? a[l.path] : void 0,
|
|
268
|
+
idPrefix: c,
|
|
269
|
+
strings: r,
|
|
270
|
+
disabled: n,
|
|
271
|
+
onChange: (u) => o($(a, l.path, u))
|
|
272
|
+
}, l.path))]
|
|
273
|
+
});
|
|
274
|
+
if (V(t)) {
|
|
275
|
+
const l = T(a), u = t.item.label ?? r.item, m = t.item.positional === !0;
|
|
276
|
+
return /* @__PURE__ */ s("fieldset", {
|
|
277
|
+
className: "studio-editor-structured__collection",
|
|
278
|
+
disabled: n,
|
|
279
|
+
children: [
|
|
280
|
+
/* @__PURE__ */ e("legend", { children: t.label }),
|
|
281
|
+
l.map((d, i) => /* @__PURE__ */ s("fieldset", {
|
|
282
|
+
className: "studio-editor-structured__item",
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ e("legend", { children: r.itemTitle(u, i + 1) }),
|
|
285
|
+
t.item.properties.map((f) => /* @__PURE__ */ e(S, {
|
|
286
|
+
descriptor: f,
|
|
287
|
+
value: _(d) ? d[f.path] : void 0,
|
|
288
|
+
idPrefix: `${c}-${i}`,
|
|
289
|
+
strings: r,
|
|
290
|
+
disabled: n,
|
|
291
|
+
onChange: (p) => o(g(l, i, $(P(d, m), f.path, p) ?? {}))
|
|
292
|
+
}, f.path)),
|
|
293
|
+
/* @__PURE__ */ s("div", {
|
|
294
|
+
className: "studio-editor-structured__actions",
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ e("button", {
|
|
297
|
+
type: "button",
|
|
298
|
+
"aria-label": r.moveUp(u, i + 1),
|
|
299
|
+
disabled: i === 0,
|
|
300
|
+
onClick: () => o(N(l, i, -1)),
|
|
301
|
+
children: r.moveUpText
|
|
302
|
+
}),
|
|
303
|
+
/* @__PURE__ */ e("button", {
|
|
304
|
+
type: "button",
|
|
305
|
+
"aria-label": r.moveDown(u, i + 1),
|
|
306
|
+
disabled: i === l.length - 1,
|
|
307
|
+
onClick: () => o(N(l, i, 1)),
|
|
308
|
+
children: r.moveDownText
|
|
309
|
+
}),
|
|
310
|
+
/* @__PURE__ */ e("button", {
|
|
311
|
+
type: "button",
|
|
312
|
+
"aria-label": r.remove(u, i + 1),
|
|
313
|
+
onClick: () => o(w(l, i)),
|
|
314
|
+
children: r.removeText
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
})
|
|
318
|
+
]
|
|
319
|
+
}, !m && _(d) && typeof d.id == "string" ? d.id : i)),
|
|
320
|
+
/* @__PURE__ */ e("button", {
|
|
321
|
+
type: "button",
|
|
322
|
+
disabled: t.constraints?.maximumItems !== void 0 && l.length >= t.constraints.maximumItems,
|
|
323
|
+
onClick: () => o([...l, M(m)]),
|
|
324
|
+
children: r.add(u)
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
return /* @__PURE__ */ e("p", {
|
|
330
|
+
className: "studio-editor-structured__undescribed",
|
|
331
|
+
role: "alert",
|
|
332
|
+
children: r.noEditor(t.label)
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
export {
|
|
336
|
+
S as t
|
|
337
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { o as n } from "./structuredValue-vqCZttsk.js";
|
|
2
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
3
|
+
var a = (r) => r == null ? "" : Array.isArray(r) ? `${r.length}` : n(r) ? Object.keys(r).length === 0 ? "" : Object.keys(r).join(", ") : String(r), u = ({ value: r, descriptor: i, context: m, id: s }) => {
|
|
4
|
+
const t = m.strings.editors.summary, o = a(r);
|
|
5
|
+
return /* @__PURE__ */ d("p", {
|
|
6
|
+
id: s,
|
|
7
|
+
className: "studio-editor-summary",
|
|
8
|
+
children: [/* @__PURE__ */ e("span", { children: o === "" ? t.empty : o }), /* @__PURE__ */ e("small", {
|
|
9
|
+
className: "studio-editor-properties__hint",
|
|
10
|
+
children: t.editedBy(y(i.editorKind))
|
|
11
|
+
})]
|
|
12
|
+
});
|
|
13
|
+
}, c = {
|
|
14
|
+
commandFormLayout: "the Command form section",
|
|
15
|
+
fieldWidths: "the Command form section",
|
|
16
|
+
commandFields: "the Command form section",
|
|
17
|
+
commandFormFieldPlacement: "the Command form section",
|
|
18
|
+
size: "the Layout section",
|
|
19
|
+
gridDefinitions: "the Layout section"
|
|
20
|
+
}, y = (r) => (r !== void 0 ? c[r] : void 0) ?? "its own editor";
|
|
21
|
+
export {
|
|
22
|
+
u as SummaryEditor
|
|
23
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as g } from "./draftProblem-BGC5Gfsv.js";
|
|
2
|
+
import { useEffect as w, useState as m } from "react";
|
|
3
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
4
|
+
var O = ({ value: s, onChange: u, descriptor: n, context: v, disabled: y, problem: x, id: a }) => {
|
|
5
|
+
const o = typeof s == "string" ? s : "", [e, i] = m(o), [h, r] = m();
|
|
6
|
+
w(() => {
|
|
7
|
+
i(o), r(void 0);
|
|
8
|
+
}, [o]);
|
|
9
|
+
const E = n.editorOptions?.multiline === !0, b = n.editorOptions?.placeholder ?? v.strings.editors.text.placeholder, c = h ?? x, d = () => {
|
|
10
|
+
if (e === o) return;
|
|
11
|
+
const t = e === "" ? void 0 : e, f = g(n, t);
|
|
12
|
+
r(f), f || u(t);
|
|
13
|
+
}, l = {
|
|
14
|
+
id: a,
|
|
15
|
+
value: e,
|
|
16
|
+
disabled: y,
|
|
17
|
+
placeholder: b,
|
|
18
|
+
className: "studio-editor-field__input",
|
|
19
|
+
"aria-invalid": c ? !0 : void 0,
|
|
20
|
+
"aria-describedby": c ? `${a}-problem` : void 0,
|
|
21
|
+
onChange: (t) => i(t.target.value),
|
|
22
|
+
onBlur: d
|
|
23
|
+
};
|
|
24
|
+
return E ? /* @__PURE__ */ p("textarea", {
|
|
25
|
+
rows: 4,
|
|
26
|
+
...l,
|
|
27
|
+
onKeyDown: (t) => {
|
|
28
|
+
t.key === "Escape" && (i(o), r(void 0));
|
|
29
|
+
}
|
|
30
|
+
}) : /* @__PURE__ */ p("input", {
|
|
31
|
+
type: "text",
|
|
32
|
+
...l,
|
|
33
|
+
onKeyDown: (t) => {
|
|
34
|
+
t.key === "Enter" && d(), t.key === "Escape" && (i(o), r(void 0));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
O as TextEditor
|
|
40
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
var t = ({ descriptor: r, context: e, id: d }) => /* @__PURE__ */ s("p", {
|
|
3
|
+
id: d,
|
|
4
|
+
className: "studio-editor-structured__undescribed",
|
|
5
|
+
role: "alert",
|
|
6
|
+
children: e.strings.editors.undescribed(r.label)
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
t as UndescribedEditor
|
|
10
|
+
};
|