@cratis/event-models 0.175.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,426 @@
1
+ import { a as V, i as _, l as J, n as I, o as R, r as O, s as Q, t as j } from "./defaultStructuredEditorStrings-Ch1I0Lci.js";
2
+ import { c as w } from "./structuredValue-vqCZttsk.js";
3
+ import { t as D } from "./StructuredValueEditor-CcwyOga0.js";
4
+ import { useEffect as K, useRef as E, useState as k } from "react";
5
+ import { BindingSourceKind as d, PropertyValueType as C } from "@cratis/scene.model";
6
+ import { Fragment as x, jsx as t, jsxs as i } from "react/jsx-runtime";
7
+ var u = /* @__PURE__ */ (function(e) {
8
+ return e.String = "string", e.Number = "number", e.Boolean = "boolean", e.Null = "null", e.Json = "json", e;
9
+ })(u || {}), F = ({ property: e, sources: l, strings: s, disabled: c, onChange: p }) => {
10
+ const r = s.properties.binding, h = Q(e.effectiveValue) ? e.effectiveValue : void 0, m = h ? void 0 : T(e.effectiveValue), f = V(e), o = h ?? f, g = L(o, e.descriptor.acceptedBindingKinds?.length ? e.descriptor.acceptedBindingKinds : I, l, r), b = o.query ? l.queryResults.find((n) => n.id === o.query || n.name === o.query) : void 0, v = o.componentId ? l.componentOutputs.find((n) => n.componentId === o.componentId) : void 0, a = (n) => p(A({
11
+ ...o,
12
+ ...n
13
+ })), P = () => p(void 0);
14
+ return m !== void 0 ? /* @__PURE__ */ i("fieldset", {
15
+ className: "studio-editor-binding",
16
+ disabled: c,
17
+ children: [
18
+ /* @__PURE__ */ t("legend", { children: e.descriptor.label }),
19
+ /* @__PURE__ */ i("div", {
20
+ className: "studio-editor-binding__missing",
21
+ role: "alert",
22
+ children: [/* @__PURE__ */ t("p", { children: r.unsupportedValue }), /* @__PURE__ */ t("pre", { children: JSON.stringify(m, void 0, 2) ?? "" })]
23
+ }),
24
+ /* @__PURE__ */ i("div", {
25
+ className: "studio-editor-binding__row",
26
+ children: [/* @__PURE__ */ t("button", {
27
+ type: "button",
28
+ onClick: () => p(f),
29
+ children: r.replaceUnsupported
30
+ }), /* @__PURE__ */ t("button", {
31
+ type: "button",
32
+ onClick: P,
33
+ children: r.clear
34
+ })]
35
+ })
36
+ ]
37
+ }) : /* @__PURE__ */ i("fieldset", {
38
+ className: "studio-editor-binding",
39
+ disabled: c,
40
+ children: [
41
+ /* @__PURE__ */ t("legend", { children: e.descriptor.label }),
42
+ /* @__PURE__ */ i("div", {
43
+ className: "studio-editor-binding__row",
44
+ children: [
45
+ /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: r.source }), /* @__PURE__ */ t("select", {
46
+ value: o.kind ?? d.DataContext,
47
+ onChange: (n) => a(M(n.target.value, o)),
48
+ children: g.map((n) => /* @__PURE__ */ t("option", {
49
+ value: n.kind,
50
+ disabled: n.disabled,
51
+ children: n.label
52
+ }, n.kind))
53
+ })] }),
54
+ /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: r.mode }), /* @__PURE__ */ i("select", {
55
+ value: o.mode ?? "",
56
+ onChange: (n) => a({ mode: n.target.value === "" ? void 0 : n.target.value }),
57
+ children: [/* @__PURE__ */ t("option", {
58
+ value: "",
59
+ children: r.inheritedMode
60
+ }), O.map((n) => /* @__PURE__ */ t("option", {
61
+ value: n,
62
+ children: n
63
+ }, n))]
64
+ })] }),
65
+ /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: r.nullBehavior }), /* @__PURE__ */ i("select", {
66
+ value: o.nullBehavior ?? "",
67
+ onChange: (n) => a({ nullBehavior: n.target.value === "" ? void 0 : n.target.value }),
68
+ children: [/* @__PURE__ */ t("option", {
69
+ value: "",
70
+ children: r.defaultNullBehavior
71
+ }), _.map((n) => /* @__PURE__ */ t("option", {
72
+ value: n,
73
+ children: n
74
+ }, n))]
75
+ })] }),
76
+ /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: r.expectedType }), /* @__PURE__ */ i("select", {
77
+ value: o.expectedValueType ?? "",
78
+ onChange: (n) => a({ expectedValueType: n.target.value === "" ? void 0 : n.target.value }),
79
+ children: [/* @__PURE__ */ t("option", {
80
+ value: "",
81
+ children: r.inferType
82
+ }), R.map((n) => /* @__PURE__ */ t("option", {
83
+ value: n,
84
+ children: n
85
+ }, n))]
86
+ })] })
87
+ ]
88
+ }),
89
+ g.filter((n) => n.disabled && n.reason).map((n) => /* @__PURE__ */ i("p", {
90
+ className: "studio-editor-binding__missing",
91
+ children: [
92
+ n.label,
93
+ ": ",
94
+ n.reason
95
+ ]
96
+ }, `${n.kind}:reason`)),
97
+ y(o) === d.DataContext && /* @__PURE__ */ t(S, {
98
+ id: `${e.descriptor.path}-data-context-paths`,
99
+ label: r.path,
100
+ value: o.path,
101
+ options: l.dataContextPaths,
102
+ onChange: (n) => a({ path: n })
103
+ }),
104
+ y(o) === d.QueryResult && /* @__PURE__ */ i(x, { children: [
105
+ /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: r.query }), /* @__PURE__ */ i("select", {
106
+ value: o.query ?? "",
107
+ onChange: (n) => a({
108
+ query: n.target.value,
109
+ path: ""
110
+ }),
111
+ children: [
112
+ /* @__PURE__ */ t("option", {
113
+ value: "",
114
+ children: r.noSource
115
+ }),
116
+ o.query && !b && /* @__PURE__ */ t("option", {
117
+ value: o.query,
118
+ children: r.missingQuery(o.query)
119
+ }),
120
+ l.queryResults.map((n) => /* @__PURE__ */ t("option", {
121
+ value: n.id,
122
+ children: n.name
123
+ }, n.id))
124
+ ]
125
+ })] }),
126
+ /* @__PURE__ */ t(S, {
127
+ id: `${e.descriptor.path}-query-paths`,
128
+ label: r.path,
129
+ value: o.path,
130
+ options: b?.fields ?? [],
131
+ onChange: (n) => a({ path: n })
132
+ }),
133
+ o.query && !b && /* @__PURE__ */ t("p", {
134
+ className: "studio-editor-binding__missing",
135
+ role: "alert",
136
+ children: r.missingQuery(o.query)
137
+ })
138
+ ] }),
139
+ y(o) === d.ComponentProperty && /* @__PURE__ */ i(x, { children: [
140
+ /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: r.component }), /* @__PURE__ */ i("select", {
141
+ value: o.componentId ?? "",
142
+ onChange: (n) => a({
143
+ componentId: n.target.value,
144
+ componentPropertyPath: "",
145
+ path: ""
146
+ }),
147
+ children: [
148
+ /* @__PURE__ */ t("option", {
149
+ value: "",
150
+ children: r.noSource
151
+ }),
152
+ o.componentId && !v && /* @__PURE__ */ t("option", {
153
+ value: o.componentId,
154
+ children: r.missingComponent(o.componentId)
155
+ }),
156
+ l.componentOutputs.map((n) => /* @__PURE__ */ i("option", {
157
+ value: n.componentId,
158
+ children: [
159
+ n.label,
160
+ " (",
161
+ n.componentId,
162
+ ")"
163
+ ]
164
+ }, n.componentId))
165
+ ]
166
+ })] }),
167
+ /* @__PURE__ */ t(S, {
168
+ id: `${e.descriptor.path}-component-paths`,
169
+ label: r.componentProperty,
170
+ value: o.componentPropertyPath ?? o.path,
171
+ options: v?.outputs.map((n) => n.path) ?? [],
172
+ onChange: (n) => a({
173
+ componentPropertyPath: n,
174
+ path: n
175
+ })
176
+ }),
177
+ o.componentId && !v && /* @__PURE__ */ t("p", {
178
+ className: "studio-editor-binding__missing",
179
+ role: "alert",
180
+ children: r.missingComponent(o.componentId)
181
+ })
182
+ ] }),
183
+ y(o) === d.Literal && /* @__PURE__ */ t($, {
184
+ value: o.value,
185
+ descriptor: e.descriptor,
186
+ targetType: o.expectedValueType ?? e.descriptor.valueType,
187
+ strings: r,
188
+ structured: s.properties.structured ?? j,
189
+ onChange: (n) => a({
190
+ value: n,
191
+ path: ""
192
+ })
193
+ }, N(o.value, o.expectedValueType ?? e.descriptor.valueType)),
194
+ h && /* @__PURE__ */ t("button", {
195
+ type: "button",
196
+ onClick: P,
197
+ children: r.clear
198
+ })
199
+ ]
200
+ });
201
+ }, S = ({ id: e, label: l, value: s, options: c, onChange: p }) => /* @__PURE__ */ i("label", { children: [
202
+ /* @__PURE__ */ t("span", { children: l }),
203
+ /* @__PURE__ */ t("input", {
204
+ list: e,
205
+ value: s,
206
+ onChange: (r) => p(r.target.value)
207
+ }),
208
+ /* @__PURE__ */ t("datalist", {
209
+ id: e,
210
+ children: c.map((r) => /* @__PURE__ */ t("option", { value: r }, r))
211
+ })
212
+ ] }), $ = ({ value: e, descriptor: l, targetType: s, strings: c, structured: p, onChange: r }) => {
213
+ const h = q(e, s), m = N(e, s), f = E(m), [o, g] = k(h);
214
+ K(() => {
215
+ const a = N(e, s);
216
+ a !== f.current && (f.current = a, g(q(e, s)));
217
+ }, [e, s]);
218
+ const b = (a) => {
219
+ g(a);
220
+ const P = B(a);
221
+ f.current = N(P, s), r(P);
222
+ }, v = w(l);
223
+ return /* @__PURE__ */ i("div", {
224
+ className: "studio-editor-binding__literal",
225
+ children: [
226
+ /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: c.literalType }), /* @__PURE__ */ i("select", {
227
+ value: o,
228
+ onChange: (a) => b(a.target.value),
229
+ children: [
230
+ /* @__PURE__ */ t("option", {
231
+ value: u.String,
232
+ children: "String"
233
+ }),
234
+ /* @__PURE__ */ t("option", {
235
+ value: u.Number,
236
+ children: "Number"
237
+ }),
238
+ /* @__PURE__ */ t("option", {
239
+ value: u.Boolean,
240
+ children: "Boolean"
241
+ }),
242
+ /* @__PURE__ */ t("option", {
243
+ value: u.Null,
244
+ children: "Null"
245
+ }),
246
+ (v || o === u.Json) && /* @__PURE__ */ t("option", {
247
+ value: u.Json,
248
+ children: c.literalStructured
249
+ })
250
+ ]
251
+ })] }),
252
+ o === u.String && /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: c.literalValue }), /* @__PURE__ */ t("input", {
253
+ value: typeof e == "string" ? e : "",
254
+ onChange: (a) => r(a.target.value)
255
+ })] }),
256
+ o === u.Number && /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: c.literalValue }), /* @__PURE__ */ t("input", {
257
+ type: "number",
258
+ value: typeof e == "number" ? String(e) : "",
259
+ onChange: (a) => r(a.target.value === "" ? void 0 : Number(a.target.value))
260
+ })] }),
261
+ o === u.Boolean && /* @__PURE__ */ i("label", { children: [/* @__PURE__ */ t("span", { children: c.literalValue }), /* @__PURE__ */ i("select", {
262
+ value: e === !0 ? "true" : "false",
263
+ onChange: (a) => r(a.target.value === "true"),
264
+ children: [/* @__PURE__ */ t("option", {
265
+ value: "true",
266
+ children: "true"
267
+ }), /* @__PURE__ */ t("option", {
268
+ value: "false",
269
+ children: "false"
270
+ })]
271
+ })] }),
272
+ o === u.Null && /* @__PURE__ */ t("p", { children: c.literalNull }),
273
+ o === u.Json && v && /* @__PURE__ */ t(D, {
274
+ descriptor: l,
275
+ value: e,
276
+ idPrefix: "literal",
277
+ strings: p,
278
+ disabled: !1,
279
+ onChange: (a) => r(a ?? B(u.Json))
280
+ }),
281
+ o === u.Json && !v && /* @__PURE__ */ t("p", {
282
+ className: "studio-editor-binding__missing",
283
+ role: "alert",
284
+ children: c.literalNoEditor
285
+ })
286
+ ]
287
+ });
288
+ };
289
+ function L(e, l, s, c) {
290
+ const p = y(e);
291
+ return I.map((r) => {
292
+ const h = l.includes(r), m = r === d.QueryResult && s.queryResults.length === 0 || r === d.ComponentProperty && s.componentOutputs.length === 0;
293
+ return {
294
+ kind: r,
295
+ label: z(r, c.sources),
296
+ disabled: r !== p && (!h || m),
297
+ reason: h ? m ? c.unavailableSource : void 0 : c.incompatibleSource
298
+ };
299
+ });
300
+ }
301
+ function y(e) {
302
+ return e.kind ?? d.DataContext;
303
+ }
304
+ function T(e) {
305
+ if (!(!e || typeof e != "object" || Array.isArray(e)))
306
+ return [
307
+ "kind",
308
+ "path",
309
+ "query",
310
+ "componentId",
311
+ "componentPropertyPath",
312
+ "value"
313
+ ].some((l) => l in e) ? e : void 0;
314
+ }
315
+ function A(e) {
316
+ switch (y(e)) {
317
+ case d.Literal:
318
+ return {
319
+ ...e,
320
+ path: "",
321
+ query: void 0,
322
+ componentId: void 0,
323
+ componentPropertyPath: void 0
324
+ };
325
+ case d.QueryResult:
326
+ return {
327
+ ...e,
328
+ componentId: void 0,
329
+ componentPropertyPath: void 0,
330
+ value: void 0
331
+ };
332
+ case d.ComponentProperty:
333
+ return {
334
+ ...e,
335
+ query: void 0,
336
+ value: void 0,
337
+ path: e.componentPropertyPath ?? e.path
338
+ };
339
+ case d.DataContext:
340
+ return {
341
+ ...e,
342
+ query: void 0,
343
+ componentId: void 0,
344
+ componentPropertyPath: void 0,
345
+ value: void 0
346
+ };
347
+ }
348
+ }
349
+ function M(e, l) {
350
+ switch (e) {
351
+ case d.Literal:
352
+ return {
353
+ kind: e,
354
+ path: "",
355
+ value: l.value ?? ""
356
+ };
357
+ case d.QueryResult:
358
+ return {
359
+ kind: e,
360
+ query: l.query,
361
+ path: l.path
362
+ };
363
+ case d.ComponentProperty:
364
+ return {
365
+ kind: e,
366
+ componentId: l.componentId,
367
+ componentPropertyPath: l.componentPropertyPath ?? l.path,
368
+ path: l.componentPropertyPath ?? l.path
369
+ };
370
+ case d.DataContext:
371
+ return {
372
+ kind: e,
373
+ path: l.path
374
+ };
375
+ }
376
+ }
377
+ function q(e, l) {
378
+ return e === null ? u.Null : typeof e == "number" ? u.Number : typeof e == "boolean" ? u.Boolean : typeof e == "object" ? u.Json : l === C.Number ? u.Number : l === C.Boolean ? u.Boolean : l === C.Object || l === C.Collection || l === C.Json ? u.Json : u.String;
379
+ }
380
+ function N(e, l) {
381
+ return JSON.stringify({
382
+ kind: q(e, l),
383
+ value: e
384
+ }) ?? "undefined";
385
+ }
386
+ function B(e) {
387
+ switch (e) {
388
+ case u.String:
389
+ return "";
390
+ case u.Number:
391
+ return 0;
392
+ case u.Boolean:
393
+ return !1;
394
+ case u.Null:
395
+ return null;
396
+ case u.Json:
397
+ return {};
398
+ }
399
+ }
400
+ function z(e, l) {
401
+ switch (e) {
402
+ case d.DataContext:
403
+ return l.dataContext;
404
+ case d.QueryResult:
405
+ return l.queryResult;
406
+ case d.ComponentProperty:
407
+ return l.componentProperty;
408
+ case d.Literal:
409
+ return l.literal;
410
+ }
411
+ }
412
+ var Z = ({ onChange: e, context: l, disabled: s }) => {
413
+ const { session: c } = l;
414
+ if (!c) return null;
415
+ const { controller: p, environment: r } = c, h = J(p.document, p.composition.roots, p.context, r.availableSources, r.queryCandidates);
416
+ return /* @__PURE__ */ t(F, {
417
+ property: c.property,
418
+ sources: h,
419
+ strings: c.screenStrings,
420
+ disabled: s === !0,
421
+ onChange: e
422
+ });
423
+ };
424
+ export {
425
+ Z as BindingExpressionPropertyEditor
426
+ };
@@ -0,0 +1,17 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ var a = ({ value: o, onChange: i, descriptor: r, disabled: s, id: c }) => {
3
+ const t = typeof o == "boolean" ? o : r.default === !0;
4
+ return /* @__PURE__ */ e("button", {
5
+ type: "button",
6
+ id: c,
7
+ role: "switch",
8
+ "aria-checked": t,
9
+ disabled: s,
10
+ className: `studio-editor-switch${t ? " studio-editor-switch--on" : ""}`,
11
+ onClick: () => i(!t),
12
+ children: /* @__PURE__ */ e("span", { className: "studio-editor-switch__thumb" })
13
+ });
14
+ };
15
+ export {
16
+ a as BooleanEditor
17
+ };