@cratis/event-models 0.174.0 → 0.176.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/Inspector/PropertiesPanel.d.ts +1 -3
- package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +2 -4
- 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 +2997 -4376
- 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,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
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { useEffect as w, useMemo as V, useState as g } from "react";
|
|
2
|
+
import { parseIconReference as C } from "@cratis/scene.model";
|
|
3
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
4
|
+
import { SceneIcon as S } from "@cratis/scene.react";
|
|
5
|
+
import { IconPicker as A, isIconPickerAllowed as L, isSameIconPickerValue as M } from "@cratis/components/IconPicker";
|
|
6
|
+
function N(r, e) {
|
|
7
|
+
return r.replace(/\{(\w+)\}/g, (i, n) => e[n] ?? i);
|
|
8
|
+
}
|
|
9
|
+
function O(r, e) {
|
|
10
|
+
const i = r.diagnostic ? e.diagnostics[r.diagnostic.kind] : e.notAllowed;
|
|
11
|
+
return N(i, {
|
|
12
|
+
library: r.reference.library,
|
|
13
|
+
key: r.reference.key,
|
|
14
|
+
variant: r.reference.variant
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function x(r, e, i, n) {
|
|
18
|
+
if (!i) return;
|
|
19
|
+
const o = r.lookup(i);
|
|
20
|
+
if (!o) return;
|
|
21
|
+
if (!o.isResolved) return {
|
|
22
|
+
reference: i,
|
|
23
|
+
diagnostic: o.diagnostic,
|
|
24
|
+
isNotAllowed: !1
|
|
25
|
+
};
|
|
26
|
+
const s = e.icons.find((t) => M(t, i));
|
|
27
|
+
return s && n && !L(s, n) ? {
|
|
28
|
+
reference: i,
|
|
29
|
+
isNotAllowed: !0
|
|
30
|
+
} : void 0;
|
|
31
|
+
}
|
|
32
|
+
var z = 24;
|
|
33
|
+
function E(r) {
|
|
34
|
+
return r.libraries.map((e) => ({
|
|
35
|
+
id: e.library,
|
|
36
|
+
name: e.package.displayName ?? e.package.name,
|
|
37
|
+
version: e.package.version,
|
|
38
|
+
attribution: e.package.iconLibrary?.attribution
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
function R(r, e) {
|
|
42
|
+
return r.flatMap((i) => i.references.map((n) => ({
|
|
43
|
+
library: n.library,
|
|
44
|
+
key: n.key,
|
|
45
|
+
...n.variant === void 0 ? {} : { variant: n.variant },
|
|
46
|
+
name: i.entry.name,
|
|
47
|
+
categories: i.entry.categories,
|
|
48
|
+
tags: i.entry.tags,
|
|
49
|
+
aliases: i.entry.aliases,
|
|
50
|
+
renderPreview: () => /* @__PURE__ */ m(S, {
|
|
51
|
+
reference: n,
|
|
52
|
+
adapters: e,
|
|
53
|
+
size: z
|
|
54
|
+
})
|
|
55
|
+
})));
|
|
56
|
+
}
|
|
57
|
+
function h(r, e, i, n = { status: "ready" }) {
|
|
58
|
+
return {
|
|
59
|
+
libraries: E(r),
|
|
60
|
+
icons: R(e, i),
|
|
61
|
+
status: n.status,
|
|
62
|
+
error: n.error
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function j(r) {
|
|
66
|
+
return r.error ? {
|
|
67
|
+
status: "error",
|
|
68
|
+
error: r.error
|
|
69
|
+
} : r.diagnostics.some((e) => e.kind === "catalog-unavailable") ? { status: "error" } : { status: "ready" };
|
|
70
|
+
}
|
|
71
|
+
function F(r, e) {
|
|
72
|
+
const [i, n] = g(), [o, s] = g(0);
|
|
73
|
+
return w(() => {
|
|
74
|
+
let t = !0;
|
|
75
|
+
return r.search().then((a) => {
|
|
76
|
+
t && (n({
|
|
77
|
+
source: r,
|
|
78
|
+
entries: a.entries,
|
|
79
|
+
diagnostics: [...r.diagnostics, ...a.diagnostics]
|
|
80
|
+
}), s((c) => c + 1));
|
|
81
|
+
}).catch((a) => {
|
|
82
|
+
t && (n({
|
|
83
|
+
source: r,
|
|
84
|
+
entries: [],
|
|
85
|
+
diagnostics: r.diagnostics,
|
|
86
|
+
error: a instanceof Error ? a.message : String(a)
|
|
87
|
+
}), s((c) => c + 1));
|
|
88
|
+
}), () => {
|
|
89
|
+
t = !1;
|
|
90
|
+
};
|
|
91
|
+
}, [r]), V(() => {
|
|
92
|
+
const t = i?.source === r ? i : void 0, a = t ? j(t) : { status: "loading" };
|
|
93
|
+
return {
|
|
94
|
+
catalog: h(r, t?.entries ?? [], e, a),
|
|
95
|
+
diagnostics: t?.diagnostics ?? r.diagnostics,
|
|
96
|
+
loadedVersion: o
|
|
97
|
+
};
|
|
98
|
+
}, [
|
|
99
|
+
r,
|
|
100
|
+
e,
|
|
101
|
+
i,
|
|
102
|
+
o
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
function J({ value: r, onChange: e, catalog: i, adapters: n, allowed: o, readOnly: s, disabled: t, validationMessage: a, showMessage: c = !0, invalid: v, strings: l, pickerLabels: k, placement: p, id: I, ...d }) {
|
|
106
|
+
const { catalog: f, loadedVersion: P } = F(i, n), y = P > 0 ? x(i, f, r, o) : void 0, b = a ?? (y ? O(y, l) : void 0);
|
|
107
|
+
return /* @__PURE__ */ m(A, {
|
|
108
|
+
id: I,
|
|
109
|
+
value: r,
|
|
110
|
+
onChange: (u) => e({
|
|
111
|
+
library: u.library,
|
|
112
|
+
key: u.key,
|
|
113
|
+
...u.variant === void 0 ? {} : { variant: u.variant }
|
|
114
|
+
}),
|
|
115
|
+
catalog: f,
|
|
116
|
+
allowed: o,
|
|
117
|
+
readOnly: s,
|
|
118
|
+
disabled: t,
|
|
119
|
+
invalid: b !== void 0 || v === !0,
|
|
120
|
+
validationMessage: c ? b : void 0,
|
|
121
|
+
placement: p,
|
|
122
|
+
labels: {
|
|
123
|
+
...l.picker,
|
|
124
|
+
...k
|
|
125
|
+
},
|
|
126
|
+
"aria-label": d["aria-label"] ?? (d["aria-labelledby"] ? void 0 : l.ariaLabel),
|
|
127
|
+
"aria-labelledby": d["aria-labelledby"],
|
|
128
|
+
"aria-describedby": d["aria-describedby"]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function K(r) {
|
|
132
|
+
if (r !== void 0)
|
|
133
|
+
return r.filter((e) => typeof e.value == "string").map((e) => C(e.value)).filter((e) => e !== void 0);
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
J as n,
|
|
137
|
+
K as t
|
|
138
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var i = (n) => `${typeof n}:${String(n)}`;
|
|
2
|
+
function u(n, l) {
|
|
3
|
+
const e = n.map((a) => ({
|
|
4
|
+
key: i(a.value),
|
|
5
|
+
label: a.label,
|
|
6
|
+
value: a.value
|
|
7
|
+
}));
|
|
8
|
+
return l == null || e.some((a) => a.key === i(l)) ? e : [...e, {
|
|
9
|
+
key: i(l),
|
|
10
|
+
label: String(l),
|
|
11
|
+
value: l
|
|
12
|
+
}];
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
u as n,
|
|
16
|
+
i as t
|
|
17
|
+
};
|