@cratis/event-models 0.350.3 → 0.351.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/Slices/SliceHeaderAction.d.ts +1 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/screen-editor/{BindingExpressionPropertyEditor-BDzuLWUA.js → BindingExpressionPropertyEditor-C01GX5mV.js} +1 -1
- package/dist/screen-editor/{CollectionEditor-BvAtXikL.js → CollectionEditor-DxpJWgWa.js} +1 -1
- package/dist/screen-editor/ScreenEditor/Drafting/SceneScreenDraftReview.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/Drafting/SceneScreenDraftToolbar.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorOverlay.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWindow.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/withIconReferences.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/Surface/designTimePointer.d.ts +4 -1
- package/dist/screen-editor/{StructuredPropertyEditor-Bd-8GBgK.js → StructuredPropertyEditor-CdG5bfkx.js} +1 -1
- package/dist/screen-editor/StructuredValueEditor-DZbDHWDg.js +349 -0
- package/dist/screen-editor/index.js +2499 -2465
- package/dist/screen-editor/screen-editor.css +1 -1
- package/package.json +3 -3
- package/dist/screen-editor/StructuredValueEditor-DUSATTWd.js +0 -337
|
@@ -1,337 +0,0 @@
|
|
|
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 { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
3
|
-
import { PropertyValueType as y } from "@cratis/scene.model";
|
|
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
|
-
};
|