@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.
Files changed (81) hide show
  1. package/dist/screen-editor/BindingExpressionPropertyEditor-DbYpy_bX.js +426 -0
  2. package/dist/screen-editor/BooleanEditor-eC1yCpz0.js +17 -0
  3. package/dist/screen-editor/CollectionEditor-C7eX8Hw7.js +320 -0
  4. package/dist/screen-editor/ColorEditor-Cc6Xq8pW.js +49 -0
  5. package/dist/screen-editor/ColumnListEditor-Cku6GGLp.js +103 -0
  6. package/dist/screen-editor/EnumEditor-DNnnf9i3.js +26 -0
  7. package/dist/screen-editor/FieldEditor-SquvComm.js +66 -0
  8. package/dist/screen-editor/FieldListEditor-CNxskXPf.js +56 -0
  9. package/dist/screen-editor/IconEditor-C0ibqn-e.js +22 -0
  10. package/dist/screen-editor/InheritanceModeEditor-CtdsACnc.js +65 -0
  11. package/dist/screen-editor/ListEditor-CfFPVVJ4.js +53 -0
  12. package/dist/screen-editor/NavigationTargetEditor-DGnW5pVF.js +41 -0
  13. package/dist/screen-editor/NumberEditor-Cyo9_23Z.js +48 -0
  14. package/dist/screen-editor/QueryBindingEditor-3C_utVJm.js +17 -0
  15. package/dist/screen-editor/QueryBindingPropertyEditor-DLlC-slh.js +169 -0
  16. package/dist/screen-editor/ReferenceEditor-BnI2Qd7H.js +32 -0
  17. package/dist/screen-editor/ReferenceTargetEditors-COKAWO5q.js +19 -0
  18. package/dist/screen-editor/RenderingSlotEditor-Cani_PtT.js +128 -0
  19. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +9 -0
  20. package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +1 -3
  21. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +2 -4
  22. package/dist/screen-editor/ScreenEditor/Properties/choiceKeys.d.ts +9 -0
  23. package/dist/screen-editor/ScreenEditor/Properties/toPropertyGroups.d.ts +6 -7
  24. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/BooleanEditor.d.ts +2 -0
  25. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ColorEditor.d.ts +2 -0
  26. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/EnumEditor.d.ts +2 -0
  27. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/IconEditor.d.ts +3 -0
  28. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ListEditor.d.ts +2 -0
  29. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/NumberEditor.d.ts +2 -0
  30. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ReferenceEditor.d.ts +2 -0
  31. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/SelectEditor.d.ts +2 -0
  32. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/TextEditor.d.ts +2 -0
  33. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/draftProblem.d.ts +3 -0
  34. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +13 -0
  35. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +91 -0
  36. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorRegistry.d.ts +24 -0
  37. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +73 -0
  38. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +26 -0
  39. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +20 -0
  40. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createPropertyEditorRegistry.d.ts +2 -0
  41. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/screenEditorPropertyEditors.d.ts +1 -0
  42. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/BindingExpressionPropertyEditor.d.ts +3 -0
  43. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/CollectionEditor.d.ts +2 -0
  44. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ColumnListEditor.d.ts +2 -0
  45. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldEditor.d.ts +23 -0
  46. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldListEditor.d.ts +2 -0
  47. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/InheritanceModeEditor.d.ts +4 -0
  48. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationTargetEditor.d.ts +2 -0
  49. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/OrderedItemsEditor.d.ts +2 -0
  50. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts +3 -0
  51. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +3 -0
  52. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/RenderingSlotEditor.d.ts +8 -0
  53. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +5 -0
  54. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StateChangeEditors.d.ts +2 -0
  55. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StructuredPropertyEditor.d.ts +2 -0
  56. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SummaryEditor.d.ts +2 -0
  57. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/UndescribedEditor.d.ts +2 -0
  58. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/fieldKind.d.ts +1 -0
  59. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/index.d.ts +0 -3
  60. package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +109 -0
  61. package/dist/screen-editor/SelectEditor-BuQPlIyf.js +26 -0
  62. package/dist/screen-editor/SliceEditor-Dle8OlsB.js +45 -0
  63. package/dist/screen-editor/StateChangeEditors-9k3Gqtc0.js +15 -0
  64. package/dist/screen-editor/StructuredPropertyEditor-B3lVjrHZ.js +13 -0
  65. package/dist/screen-editor/StructuredValueEditor-CcwyOga0.js +337 -0
  66. package/dist/screen-editor/SummaryEditor-C5wP1uIH.js +23 -0
  67. package/dist/screen-editor/TextEditor-BEH-9K1S.js +40 -0
  68. package/dist/screen-editor/UndescribedEditor-Cqs6bHhD.js +10 -0
  69. package/dist/screen-editor/allowedIconChoices-DBgeRdGI.js +138 -0
  70. package/dist/screen-editor/choiceKeys-DQcUX97p.js +17 -0
  71. package/dist/screen-editor/defaultStructuredEditorStrings-Ch1I0Lci.js +137 -0
  72. package/dist/screen-editor/draftProblem-BGC5Gfsv.js +12 -0
  73. package/dist/screen-editor/iconDiagnostics-Ds4CnqD0.js +49 -0
  74. package/dist/screen-editor/index.js +2997 -4376
  75. package/dist/screen-editor/screen-editor.css +1 -1
  76. package/dist/screen-editor/structuredValue-vqCZttsk.js +61 -0
  77. package/package.json +12 -12
  78. package/dist/screen-editor/ScreenEditor/Inspector/IconProperties.d.ts +0 -14
  79. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/StructuredProperties.d.ts +0 -9
  80. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/UndescribedProperties.d.ts +0 -7
  81. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/classifyStructures.d.ts +0 -6
@@ -0,0 +1,320 @@
1
+ import { a as u, i as D, r as T, t as A } from "./iconDiagnostics-Ds4CnqD0.js";
2
+ import { n as P, t as $ } from "./allowedIconChoices-DBgeRdGI.js";
3
+ import { StructuredPropertyEditor as U } from "./StructuredPropertyEditor-B3lVjrHZ.js";
4
+ import { CollectionOperation as C, DestinationKind as v, PropertyValueType as L, SceneEditKind as O } from "@cratis/scene.model";
5
+ import { jsx as n, jsxs as c } from "react/jsx-runtime";
6
+ import { OrderedItemEditor as F } from "@cratis/components/ConfigurationEditor";
7
+ var K = /* @__PURE__ */ new Set([
8
+ "label",
9
+ "icon",
10
+ "destination"
11
+ ]), j = (e) => e.valueType === L.Collection && e.item !== void 0 && e.item.properties.every((i) => K.has(i.path)), N = (e) => typeof e == "string" ? e : "";
12
+ function V(e) {
13
+ const i = (e.items ?? []).map((t) => ({
14
+ id: t.id,
15
+ label: N(t.values.label),
16
+ ...t.values.icon ? { icon: t.values.icon } : {},
17
+ ...Z(t.values.destination) ? {
18
+ destinationReference: t.values.destination,
19
+ destination: t.values.destination.screen
20
+ } : {},
21
+ values: t.values,
22
+ editable: t.editable
23
+ }));
24
+ return {
25
+ fixed: i.filter((t) => !t.editable),
26
+ items: i.filter((t) => t.editable)
27
+ };
28
+ }
29
+ function W(e) {
30
+ const i = new Set(e.operations ?? []), t = i.has(C.EditFields), r = e.descriptor.constraints?.maximumItems;
31
+ return {
32
+ add: i.has(C.Add),
33
+ remove: i.has(C.Remove),
34
+ reorder: i.has(C.Reorder),
35
+ fields: {
36
+ label: t ? "editable" : "readonly",
37
+ icon: t ? "editable" : "readonly",
38
+ destination: t ? "editable" : "readonly"
39
+ },
40
+ ...r !== void 0 ? { maxItems: r } : {},
41
+ ...e.reason ? { reasons: {
42
+ add: e.reason,
43
+ remove: e.reason,
44
+ reorder: e.reason
45
+ } } : {}
46
+ };
47
+ }
48
+ function _(e, i, t) {
49
+ const r = {
50
+ component: e,
51
+ path: i.descriptor.path
52
+ };
53
+ switch (t.kind) {
54
+ case "add":
55
+ return [{
56
+ kind: O.AddCollectionItem,
57
+ ...r,
58
+ item: {
59
+ id: t.item.id,
60
+ values: M(t.item)
61
+ },
62
+ index: t.index
63
+ }];
64
+ case "remove":
65
+ return [{
66
+ kind: O.RemoveCollectionItem,
67
+ ...r,
68
+ itemId: t.item.id
69
+ }];
70
+ case "move":
71
+ return [{
72
+ kind: O.ReorderCollectionItem,
73
+ ...r,
74
+ itemId: t.item.id,
75
+ index: t.toIndex
76
+ }];
77
+ case "update":
78
+ return [{
79
+ kind: O.EditCollectionItem,
80
+ ...r,
81
+ itemId: t.item.id,
82
+ field: t.field,
83
+ value: z(t.item, t.field)
84
+ }];
85
+ }
86
+ }
87
+ var z = (e, i) => i === "destination" ? x(e) : e[i], M = (e) => ({
88
+ ...e.values,
89
+ label: e.label,
90
+ ...e.icon ? { icon: e.icon } : {},
91
+ ...x(e) ? { destination: x(e) } : {}
92
+ });
93
+ function x(e) {
94
+ if (!(!e.destination && !e.destinationReference))
95
+ return {
96
+ ...e.destinationReference ?? {},
97
+ ...e.destination ? { screen: e.destination } : {}
98
+ };
99
+ }
100
+ function Z(e) {
101
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : [
102
+ "screen",
103
+ "module",
104
+ "feature",
105
+ "slice",
106
+ "outlet",
107
+ "route",
108
+ "kind",
109
+ "dialog",
110
+ "routeParameterBindings"
111
+ ].some((i) => i in e);
112
+ }
113
+ var q = /^:[A-Za-z_][A-Za-z0-9_]*$/;
114
+ function B(e, i) {
115
+ if (!e) return [];
116
+ const t = [];
117
+ return !e.screen && !e.route && !e.dialog && !e.slice && t.push(u.NoTarget), e.screen && !i.screens.includes(e.screen) && t.push(u.UnknownScreen), e.route !== void 0 && !G(e.route, e.kind) && t.push(u.InvalidRoute), e.outlet && !i.outlets.includes(e.outlet) && t.push(u.UnknownOutlet), e.dialog && !i.dialogTemplates.includes(e.dialog) && t.push(u.UnknownDialog), e.slice && !i.slices.includes(e.slice) && t.push(u.UnknownSlice), e.kind === v.Outlet && !e.outlet && t.push(u.OutletKindWithoutOutlet), e.kind === v.Dialog && !e.dialog && t.push(u.DialogKindWithoutDialog), e.kind === v.External && !e.route && t.push(u.ExternalKindWithoutRoute), t;
118
+ }
119
+ function G(e, i) {
120
+ if (i === v.External) return H(e);
121
+ if (!e.startsWith("/") || /\s/.test(e) || e.includes("//")) return !1;
122
+ const t = e.split("/").filter((r) => r.startsWith(":"));
123
+ return t.every((r) => q.test(r)) ? new Set(t).size === t.length : !1;
124
+ }
125
+ function H(e) {
126
+ try {
127
+ const i = new URL(e);
128
+ return i.protocol === "https:" || i.protocol === "http:";
129
+ } catch {
130
+ return !1;
131
+ }
132
+ }
133
+ var J = ({ id: e, label: i, value: t, destinations: r, outlets: s, dialogTemplates: p, problems: m = [], disabled: I, strings: a, onChange: b }) => {
134
+ const d = t ?? {}, h = (o) => b(Y({
135
+ ...d,
136
+ ...o
137
+ })), y = () => b(void 0), g = `${e}-outlets`, k = `${e}-dialogs`;
138
+ return /* @__PURE__ */ c("fieldset", {
139
+ className: "studio-editor-destination",
140
+ disabled: I,
141
+ children: [
142
+ /* @__PURE__ */ n("legend", { children: i || a.label }),
143
+ /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ n("span", { children: a.screen }), /* @__PURE__ */ c("select", {
144
+ value: d.screen ?? "",
145
+ onChange: (o) => h({ screen: o.target.value || void 0 }),
146
+ children: [
147
+ /* @__PURE__ */ n("option", {
148
+ value: "",
149
+ children: a.noScreen
150
+ }),
151
+ X(d.screen, r) && /* @__PURE__ */ n("option", {
152
+ value: d.screen,
153
+ children: a.missingScreen(d.screen)
154
+ }),
155
+ r.map((o) => /* @__PURE__ */ n("option", {
156
+ value: o.id,
157
+ children: Q(o)
158
+ }, o.id))
159
+ ]
160
+ })] }),
161
+ /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ n("span", { children: a.route }), /* @__PURE__ */ n("input", {
162
+ value: d.route ?? "",
163
+ placeholder: a.routePlaceholder,
164
+ onChange: (o) => h({ route: o.target.value || void 0 })
165
+ })] }),
166
+ /* @__PURE__ */ c("label", { children: [/* @__PURE__ */ n("span", { children: a.kind }), /* @__PURE__ */ c("select", {
167
+ value: d.kind ?? "",
168
+ onChange: (o) => h({ kind: o.target.value || void 0 }),
169
+ children: [
170
+ /* @__PURE__ */ n("option", {
171
+ value: "",
172
+ children: a.kinds.default
173
+ }),
174
+ /* @__PURE__ */ n("option", {
175
+ value: v.Outlet,
176
+ children: a.kinds.outlet
177
+ }),
178
+ /* @__PURE__ */ n("option", {
179
+ value: v.Dialog,
180
+ children: a.kinds.dialog
181
+ }),
182
+ /* @__PURE__ */ n("option", {
183
+ value: v.External,
184
+ children: a.kinds.external
185
+ })
186
+ ]
187
+ })] }),
188
+ /* @__PURE__ */ c("label", { children: [
189
+ /* @__PURE__ */ n("span", { children: a.outlet }),
190
+ /* @__PURE__ */ n("input", {
191
+ list: g,
192
+ value: d.outlet ?? "",
193
+ onChange: (o) => h({ outlet: o.target.value || void 0 })
194
+ }),
195
+ /* @__PURE__ */ n("datalist", {
196
+ id: g,
197
+ children: s.map((o) => /* @__PURE__ */ n("option", { value: o }, o))
198
+ })
199
+ ] }),
200
+ /* @__PURE__ */ c("label", { children: [
201
+ /* @__PURE__ */ n("span", { children: a.dialog }),
202
+ /* @__PURE__ */ n("input", {
203
+ list: k,
204
+ value: d.dialog ?? "",
205
+ onChange: (o) => h({ dialog: o.target.value || void 0 })
206
+ }),
207
+ /* @__PURE__ */ n("datalist", {
208
+ id: k,
209
+ children: p.map((o) => /* @__PURE__ */ n("option", { value: o }, o))
210
+ })
211
+ ] }),
212
+ /* @__PURE__ */ n("button", {
213
+ type: "button",
214
+ onClick: y,
215
+ children: a.clear
216
+ }),
217
+ m.length > 0 && /* @__PURE__ */ n("ul", {
218
+ className: "studio-editor-diagnostics",
219
+ role: "alert",
220
+ "aria-label": i || a.label,
221
+ children: m.map((o) => /* @__PURE__ */ n("li", {
222
+ "data-severity": "error",
223
+ children: a.problems[o]
224
+ }, o))
225
+ })
226
+ ]
227
+ });
228
+ };
229
+ function Q(e) {
230
+ return e.group ? `${e.group} / ${e.label}` : e.label;
231
+ }
232
+ function X(e, i) {
233
+ return !!e && !i.some((t) => t.id === e);
234
+ }
235
+ function Y(e) {
236
+ const i = {
237
+ ...e,
238
+ ...e.screen ? { screen: e.screen } : {},
239
+ ...e.route ? { route: e.route } : {},
240
+ ...e.outlet ? { outlet: e.outlet } : {},
241
+ ...e.dialog ? { dialog: e.dialog } : {}
242
+ };
243
+ for (const t of [
244
+ "screen",
245
+ "route",
246
+ "outlet",
247
+ "dialog",
248
+ "kind"
249
+ ]) i[t] || delete i[t];
250
+ return Object.keys(i).length > 0 ? i : void 0;
251
+ }
252
+ var ee = ({ context: e }) => {
253
+ const { session: i } = e;
254
+ if (!i) return null;
255
+ const { controller: t, environment: r, property: s, screenStrings: p } = i, m = e.selection?.id ?? "", I = r.destinations, a = e.lookups.icons, { items: b, fixed: d } = V(s), h = A(a.diagnostics, s.descriptor.path), y = W(s), g = y.fields.destination !== "readonly" || s.editable, k = [...d, ...b].filter((l) => l.destination !== void 0 || l.destinationReference !== void 0 || g), o = T(r, t.document), R = te(o, s), S = (l, f) => {
256
+ t.setCollectionItemDestination(m, s.descriptor.path, l.id, f, p.properties.destination.label);
257
+ };
258
+ return /* @__PURE__ */ c("section", {
259
+ className: "studio-editor-properties__collection",
260
+ children: [/* @__PURE__ */ n(F, {
261
+ items: b,
262
+ fixedItems: d,
263
+ capabilities: y,
264
+ destinations: I,
265
+ validation: h,
266
+ renderIconField: (l) => /* @__PURE__ */ n(P, {
267
+ value: l.value,
268
+ onChange: l.onChange,
269
+ allowed: $(s.descriptor.item?.properties.find((f) => f.path === "icon")?.choices),
270
+ catalog: a.catalog,
271
+ adapters: a.adapters,
272
+ readOnly: l.readOnly,
273
+ showMessage: !1,
274
+ invalid: l.invalid,
275
+ strings: p.properties.icon,
276
+ pickerLabels: p.properties.iconPickerLabels,
277
+ "aria-label": l["aria-label"],
278
+ "aria-describedby": l["aria-describedby"]
279
+ }),
280
+ "aria-label": s.descriptor.label,
281
+ createItem: () => ({
282
+ id: globalThis.crypto.randomUUID(),
283
+ label: "",
284
+ values: {}
285
+ }),
286
+ onChange: (l) => t.applyAll(_(m, s, l), p.properties.itemsLabel)
287
+ }), k.length > 0 && /* @__PURE__ */ c("div", {
288
+ className: "studio-editor-destinations",
289
+ children: [/* @__PURE__ */ n("strong", { children: p.properties.destination.label }), k.map((l) => /* @__PURE__ */ n(J, {
290
+ id: `${m}-${s.descriptor.path}-${l.id}`,
291
+ label: l.label,
292
+ value: l.destinationReference,
293
+ destinations: I,
294
+ outlets: R.outlets,
295
+ dialogTemplates: R.dialogTemplates,
296
+ problems: B(l.destinationReference, o),
297
+ disabled: !g || d.some((f) => f.id === l.id),
298
+ strings: p.properties.destination,
299
+ onChange: (f) => S(l, f)
300
+ }, l.id))]
301
+ })]
302
+ });
303
+ };
304
+ function te(e, i) {
305
+ const t = (i.items ?? []).map((s) => E(s.values.destination) ? s.values.destination.outlet : void 0).filter(w), r = (i.items ?? []).map((s) => E(s.values.destination) ? s.values.destination.dialog : void 0).filter(w);
306
+ return {
307
+ outlets: D([...e.outlets, ...t]),
308
+ dialogTemplates: D([...e.dialogTemplates, ...r])
309
+ };
310
+ }
311
+ function w(e) {
312
+ return typeof e == "string";
313
+ }
314
+ function E(e) {
315
+ return !!e && typeof e == "object" && !Array.isArray(e);
316
+ }
317
+ var se = (e) => j(e.descriptor) && e.context.session ? /* @__PURE__ */ n(ee, { ...e }) : /* @__PURE__ */ n(U, { ...e });
318
+ export {
319
+ se as CollectionEditor
320
+ };
@@ -0,0 +1,49 @@
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
+ var p = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i, _ = ({ value: c, onChange: t, descriptor: v, context: d, disabled: a, id: u }) => {
3
+ const l = d.strings.editors.color, s = d.lookups.colorTokens, e = typeof c == "string" ? c : void 0, n = e !== void 0 && !s.some((o) => o.name === e), b = p.test(e ?? "") ? e : "#000000";
4
+ return /* @__PURE__ */ m("div", {
5
+ id: u,
6
+ className: "studio-editor-color",
7
+ role: "group",
8
+ "aria-labelledby": `${u}-label`,
9
+ children: [s.length > 0 && /* @__PURE__ */ r("div", {
10
+ className: "studio-editor-color__tokens",
11
+ role: "radiogroup",
12
+ "aria-label": l.tokens,
13
+ children: s.map((o) => /* @__PURE__ */ r("button", {
14
+ type: "button",
15
+ role: "radio",
16
+ "aria-checked": e === o.name,
17
+ "aria-label": o.label,
18
+ title: o.label,
19
+ disabled: a,
20
+ className: `studio-editor-color__swatch${e === o.name ? " studio-editor-color__swatch--chosen" : ""}`,
21
+ style: o.value ? { background: o.value } : void 0,
22
+ onClick: () => t(e === o.name ? void 0 : o.name)
23
+ }, o.name))
24
+ }), v.editorOptions?.tokensOnly !== !0 && /* @__PURE__ */ m("div", {
25
+ className: "studio-editor-color__custom",
26
+ children: [/* @__PURE__ */ r("input", {
27
+ type: "color",
28
+ "aria-label": l.custom,
29
+ disabled: a,
30
+ value: b,
31
+ onChange: (o) => t(o.target.value)
32
+ }), /* @__PURE__ */ r("input", {
33
+ type: "text",
34
+ "aria-label": l.hex,
35
+ placeholder: "#rrggbb",
36
+ disabled: a,
37
+ className: "studio-editor-field__input",
38
+ defaultValue: n ? e : "",
39
+ onBlur: (o) => {
40
+ const i = o.target.value.trim();
41
+ i === "" ? n && t(void 0) : p.test(i) && t(i);
42
+ }
43
+ }, e ?? "")]
44
+ })]
45
+ });
46
+ };
47
+ export {
48
+ _ as ColorEditor
49
+ };
@@ -0,0 +1,103 @@
1
+ import { l as m, o as _, v as N, y } from "./structuredValue-vqCZttsk.js";
2
+ import { FieldEditor as C } from "./FieldEditor-SquvComm.js";
3
+ import { jsx as a, jsxs as u } from "react/jsx-runtime";
4
+ var p = [
5
+ "start",
6
+ "center",
7
+ "end"
8
+ ], B = ({ value: h, onChange: b, descriptor: v, context: n, disabled: c, id: f }) => {
9
+ const r = n.strings.editors.columnList, l = (Array.isArray(h) ? h : []).filter(_), d = (t) => b(t.length === 0 ? void 0 : t), s = (t, i, e) => {
10
+ const o = { ...l[t] };
11
+ e === void 0 || e === "" ? delete o[i] : o[i] = e, d(N(l, t, o));
12
+ }, w = {
13
+ ...v,
14
+ editorKind: "field",
15
+ label: r.field
16
+ };
17
+ return /* @__PURE__ */ u("fieldset", {
18
+ id: f,
19
+ className: "studio-editor-columns",
20
+ disabled: c,
21
+ children: [l.map((t, i) => /* @__PURE__ */ u("div", {
22
+ className: "studio-editor-columns__row",
23
+ children: [
24
+ /* @__PURE__ */ a(C, {
25
+ id: `${f}-${i}-field`,
26
+ value: t.field,
27
+ descriptor: w,
28
+ context: n,
29
+ disabled: c,
30
+ onChange: (e) => s(i, "field", e)
31
+ }),
32
+ /* @__PURE__ */ a("input", {
33
+ className: "studio-editor-field__input",
34
+ "aria-label": r.header,
35
+ placeholder: r.header,
36
+ defaultValue: String(t.header ?? ""),
37
+ onBlur: (e) => {
38
+ e.target.value !== (t.header ?? "") && s(i, "header", e.target.value);
39
+ }
40
+ }, String(t.header ?? "")),
41
+ /* @__PURE__ */ a("input", {
42
+ className: "studio-editor-field__input studio-editor-columns__width",
43
+ "aria-label": r.width,
44
+ placeholder: r.width,
45
+ defaultValue: String(t.width ?? ""),
46
+ onBlur: (e) => {
47
+ const o = e.target.value.trim(), g = o === "" ? void 0 : Number.isFinite(Number(o)) ? Number(o) : o;
48
+ g !== t.width && s(i, "width", g);
49
+ }
50
+ }, String(t.width ?? "")),
51
+ /* @__PURE__ */ u("select", {
52
+ "aria-label": r.align,
53
+ value: p.includes(t.align) ? String(t.align) : "",
54
+ onChange: (e) => s(i, "align", e.target.value),
55
+ children: [/* @__PURE__ */ a("option", {
56
+ value: "",
57
+ children: r.align
58
+ }), p.map((e) => /* @__PURE__ */ a("option", {
59
+ value: e,
60
+ children: r.alignments[e]
61
+ }, e))]
62
+ }),
63
+ /* @__PURE__ */ a("input", {
64
+ className: "studio-editor-field__input",
65
+ "aria-label": r.format,
66
+ placeholder: r.format,
67
+ defaultValue: String(t.format ?? ""),
68
+ onBlur: (e) => {
69
+ e.target.value !== (t.format ?? "") && s(i, "format", e.target.value);
70
+ }
71
+ }, String(t.format ?? "")),
72
+ /* @__PURE__ */ a("button", {
73
+ type: "button",
74
+ "aria-label": n.strings.editors.list.moveUp,
75
+ disabled: i === 0,
76
+ onClick: () => d(m(l, i, -1)),
77
+ children: "↑"
78
+ }),
79
+ /* @__PURE__ */ a("button", {
80
+ type: "button",
81
+ "aria-label": n.strings.editors.list.moveDown,
82
+ disabled: i === l.length - 1,
83
+ onClick: () => d(m(l, i, 1)),
84
+ children: "↓"
85
+ }),
86
+ /* @__PURE__ */ a("button", {
87
+ type: "button",
88
+ "aria-label": r.remove,
89
+ onClick: () => d(y(l, i)),
90
+ children: "×"
91
+ })
92
+ ]
93
+ }, typeof t.id == "string" ? t.id : i)), /* @__PURE__ */ a("button", {
94
+ type: "button",
95
+ className: "studio-editor-list__add",
96
+ onClick: () => d([...l, { id: globalThis.crypto.randomUUID() }]),
97
+ children: r.add
98
+ })]
99
+ });
100
+ };
101
+ export {
102
+ B as ColumnListEditor
103
+ };
@@ -0,0 +1,26 @@
1
+ import { n as u, t as h } from "./choiceKeys-DQcUX97p.js";
2
+ import { jsx as c } from "react/jsx-runtime";
3
+ var b = ({ value: s, onChange: a, descriptor: i, disabled: d, id: t }) => {
4
+ const o = s ?? void 0, n = u(i.choices ?? [], o), l = i.constraints?.required === !0;
5
+ return /* @__PURE__ */ c("div", {
6
+ id: t,
7
+ role: "radiogroup",
8
+ "aria-labelledby": `${t}-label`,
9
+ className: "studio-editor-chips",
10
+ children: n.map((e) => {
11
+ const r = o !== void 0 && e.key === h(o);
12
+ return /* @__PURE__ */ c("button", {
13
+ type: "button",
14
+ role: "radio",
15
+ "aria-checked": r,
16
+ disabled: d,
17
+ className: `studio-editor-chip${r ? " studio-editor-chip--chosen" : ""}`,
18
+ onClick: () => a(r && !l ? void 0 : e.value),
19
+ children: e.label
20
+ }, e.key);
21
+ })
22
+ });
23
+ };
24
+ export {
25
+ b as EnumEditor
26
+ };
@@ -0,0 +1,66 @@
1
+ import { t as y } from "./SearchableSelect-WUNlC3tk.js";
2
+ import { Fragment as h, jsx as d, jsxs as v } from "react/jsx-runtime";
3
+ function g(n) {
4
+ const e = n.toLowerCase().replace(/[?[\]]/g, "");
5
+ return /^(u?int\d*|long|short|byte|float|double|decimal|number|single)$/.test(e) ? "number" : e === "bool" || e === "boolean" ? "boolean" : /^(date|time|datetime|datetimeoffset|dateonly|timeonly|timestamp)$/.test(e) ? "date" : e === "guid" || e === "uuid" ? "id" : "string";
6
+ }
7
+ function x(n, e) {
8
+ const r = n.editorKind === "bindingPath" ? Object.entries(e.availableSources).map(([t, s]) => ({
9
+ name: t,
10
+ type: s
11
+ })) : e.fields.map((t) => ({
12
+ name: t.name,
13
+ type: t.type
14
+ })), l = n.editorOptions?.fieldKinds;
15
+ return {
16
+ all: r,
17
+ offered: r.filter((t) => l === void 0 || l.includes(g(t.type)))
18
+ };
19
+ }
20
+ var K = ({ value: n, onChange: e, descriptor: r, context: l, disabled: t, problem: s, id: c }) => {
21
+ const o = l.strings.editors, f = r.editorOptions?.fieldKinds, { all: b, offered: m } = x(r, l.lookups), a = typeof n == "string" && n !== "" ? n : void 0, u = a === void 0 || m.some((i) => i.name === a);
22
+ return b.length === 0 ? /* @__PURE__ */ d("input", {
23
+ id: c,
24
+ type: "text",
25
+ className: "studio-editor-field__input",
26
+ disabled: t,
27
+ defaultValue: a ?? "",
28
+ "aria-invalid": s ? !0 : void 0,
29
+ onBlur: (i) => {
30
+ const p = i.target.value.trim();
31
+ p !== (a ?? "") && e(p === "" ? void 0 : p);
32
+ }
33
+ }, a ?? "") : /* @__PURE__ */ v(h, { children: [
34
+ /* @__PURE__ */ d(y, {
35
+ id: c,
36
+ options: (u ? m : [...m, {
37
+ name: a,
38
+ type: ""
39
+ }]).map((i) => ({
40
+ value: i.name,
41
+ label: i.type ? `${i.name} · ${i.type}` : i.name
42
+ })),
43
+ value: a,
44
+ disabled: t,
45
+ invalid: !u || s !== void 0,
46
+ placeholder: o.field.placeholder,
47
+ searchLabel: o.select.search,
48
+ emptyLabel: o.select.empty,
49
+ clearLabel: o.select.clear,
50
+ clearable: r.constraints?.required !== !0,
51
+ "aria-labelledby": `${c}-label`,
52
+ onChange: e
53
+ }),
54
+ f !== void 0 && /* @__PURE__ */ d("small", {
55
+ className: "studio-editor-properties__hint",
56
+ children: f.map(o.field.typed).join(", ")
57
+ }),
58
+ !u && /* @__PURE__ */ d("span", {
59
+ className: "studio-editor-chip studio-editor-chip--error",
60
+ children: o.unresolved
61
+ })
62
+ ] });
63
+ };
64
+ export {
65
+ K as FieldEditor
66
+ };
@@ -0,0 +1,56 @@
1
+ import { l as c, t as g, v as w, y as m } from "./structuredValue-vqCZttsk.js";
2
+ import { FieldEditor as y } from "./FieldEditor-SquvComm.js";
3
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
4
+ var $ = ({ value: p, onChange: b, descriptor: h, context: l, disabled: a, problem: v, id: d }) => {
5
+ const s = l.strings.editors.list, o = g(p).filter((i) => typeof i == "string"), e = (i) => b(i.length === 0 ? void 0 : i), f = {
6
+ ...h,
7
+ editorKind: "field"
8
+ };
9
+ return /* @__PURE__ */ u("fieldset", {
10
+ id: d,
11
+ className: "studio-editor-list",
12
+ disabled: a,
13
+ children: [o.map((i, t) => /* @__PURE__ */ u("div", {
14
+ className: "studio-editor-list__row",
15
+ children: [
16
+ /* @__PURE__ */ r(y, {
17
+ id: `${d}-${t}`,
18
+ value: i,
19
+ descriptor: f,
20
+ context: l,
21
+ disabled: a,
22
+ problem: v,
23
+ onChange: (n) => e(n === void 0 ? m(o, t) : w(o, t, n))
24
+ }),
25
+ /* @__PURE__ */ r("button", {
26
+ type: "button",
27
+ "aria-label": s.moveUp,
28
+ disabled: t === 0,
29
+ onClick: () => e(c(o, t, -1)),
30
+ children: "↑"
31
+ }),
32
+ /* @__PURE__ */ r("button", {
33
+ type: "button",
34
+ "aria-label": s.moveDown,
35
+ disabled: t === o.length - 1,
36
+ onClick: () => e(c(o, t, 1)),
37
+ children: "↓"
38
+ }),
39
+ /* @__PURE__ */ r("button", {
40
+ type: "button",
41
+ "aria-label": s.remove,
42
+ onClick: () => e(m(o, t)),
43
+ children: "×"
44
+ })
45
+ ]
46
+ }, `${t}:${i}`)), /* @__PURE__ */ r("button", {
47
+ type: "button",
48
+ className: "studio-editor-list__add",
49
+ onClick: () => e([...o, ""]),
50
+ children: s.add
51
+ })]
52
+ });
53
+ };
54
+ export {
55
+ $ as FieldListEditor
56
+ };
@@ -0,0 +1,22 @@
1
+ import { n as t, t as d } from "./allowedIconChoices-DBgeRdGI.js";
2
+ import { isIconReference as p } from "@cratis/scene.model";
3
+ import { jsx as g } from "react/jsx-runtime";
4
+ var I = ({ value: a, onChange: s, descriptor: i, context: o, disabled: l, problem: n, id: e }) => {
5
+ const { icons: r } = o.lookups;
6
+ return /* @__PURE__ */ g(t, {
7
+ id: e,
8
+ value: p(a) ? a : void 0,
9
+ onChange: (c) => s(c),
10
+ catalog: r.catalog,
11
+ adapters: r.adapters,
12
+ allowed: d(i.choices),
13
+ readOnly: l,
14
+ validationMessage: n?.message,
15
+ strings: o.strings.icon,
16
+ pickerLabels: o.strings.iconPicker,
17
+ "aria-labelledby": `${e}-label`
18
+ });
19
+ };
20
+ export {
21
+ I as IconEditor
22
+ };