@cratis/event-models 0.175.0 → 0.177.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) 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/Host/ScreenEditorOverlay.d.ts +1 -1
  21. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWorkspace.d.ts +1 -1
  22. package/dist/screen-editor/ScreenEditor/Host/useScreenEditor.d.ts +2 -1
  23. package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +1 -3
  24. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +5 -4
  25. package/dist/screen-editor/ScreenEditor/Palette/ComponentPicker.d.ts +21 -0
  26. package/dist/screen-editor/ScreenEditor/Palette/PaletteFolders.d.ts +12 -4
  27. package/dist/screen-editor/ScreenEditor/Palette/buildPalette.d.ts +2 -9
  28. package/dist/screen-editor/ScreenEditor/Palette/componentPickerModel.d.ts +54 -0
  29. package/dist/screen-editor/ScreenEditor/Palette/componentPickerStorage.d.ts +15 -0
  30. package/dist/screen-editor/ScreenEditor/Palette/useComponentPalette.d.ts +18 -0
  31. package/dist/screen-editor/ScreenEditor/Properties/choiceKeys.d.ts +9 -0
  32. package/dist/screen-editor/ScreenEditor/Properties/toPropertyGroups.d.ts +6 -7
  33. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/BooleanEditor.d.ts +2 -0
  34. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ColorEditor.d.ts +2 -0
  35. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/EnumEditor.d.ts +2 -0
  36. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/IconEditor.d.ts +3 -0
  37. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ListEditor.d.ts +2 -0
  38. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/NumberEditor.d.ts +2 -0
  39. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ReferenceEditor.d.ts +2 -0
  40. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/SelectEditor.d.ts +2 -0
  41. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/TextEditor.d.ts +2 -0
  42. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/draftProblem.d.ts +3 -0
  43. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +13 -0
  44. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +91 -0
  45. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorRegistry.d.ts +24 -0
  46. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +73 -0
  47. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +26 -0
  48. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +20 -0
  49. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createPropertyEditorRegistry.d.ts +2 -0
  50. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/screenEditorPropertyEditors.d.ts +1 -0
  51. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/BindingExpressionPropertyEditor.d.ts +3 -0
  52. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/CollectionEditor.d.ts +2 -0
  53. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ColumnListEditor.d.ts +2 -0
  54. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldEditor.d.ts +23 -0
  55. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldListEditor.d.ts +2 -0
  56. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/InheritanceModeEditor.d.ts +4 -0
  57. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationTargetEditor.d.ts +2 -0
  58. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/OrderedItemsEditor.d.ts +2 -0
  59. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts +3 -0
  60. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +3 -0
  61. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/RenderingSlotEditor.d.ts +8 -0
  62. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +5 -0
  63. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StateChangeEditors.d.ts +2 -0
  64. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StructuredPropertyEditor.d.ts +2 -0
  65. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SummaryEditor.d.ts +2 -0
  66. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/UndescribedEditor.d.ts +2 -0
  67. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/fieldKind.d.ts +1 -0
  68. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/index.d.ts +0 -3
  69. package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +109 -0
  70. package/dist/screen-editor/SelectEditor-BuQPlIyf.js +26 -0
  71. package/dist/screen-editor/SliceEditor-Dle8OlsB.js +45 -0
  72. package/dist/screen-editor/StateChangeEditors-9k3Gqtc0.js +15 -0
  73. package/dist/screen-editor/StructuredPropertyEditor-B3lVjrHZ.js +13 -0
  74. package/dist/screen-editor/StructuredValueEditor-CcwyOga0.js +337 -0
  75. package/dist/screen-editor/SummaryEditor-C5wP1uIH.js +23 -0
  76. package/dist/screen-editor/TextEditor-BEH-9K1S.js +40 -0
  77. package/dist/screen-editor/UndescribedEditor-Cqs6bHhD.js +10 -0
  78. package/dist/screen-editor/allowedIconChoices-DBgeRdGI.js +138 -0
  79. package/dist/screen-editor/choiceKeys-DQcUX97p.js +17 -0
  80. package/dist/screen-editor/defaultStructuredEditorStrings-Ch1I0Lci.js +137 -0
  81. package/dist/screen-editor/draftProblem-BGC5Gfsv.js +12 -0
  82. package/dist/screen-editor/iconDiagnostics-Ds4CnqD0.js +49 -0
  83. package/dist/screen-editor/index.js +3395 -4482
  84. package/dist/screen-editor/screen-editor.css +1 -1
  85. package/dist/screen-editor/structuredValue-vqCZttsk.js +61 -0
  86. package/package.json +12 -12
  87. package/dist/screen-editor/ScreenEditor/Inspector/IconProperties.d.ts +0 -14
  88. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/StructuredProperties.d.ts +0 -9
  89. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/UndescribedProperties.d.ts +0 -7
  90. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/classifyStructures.d.ts +0 -6
@@ -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
+ };
@@ -0,0 +1,137 @@
1
+ import { BindingMode as p, BindingNullBehavior as c, BindingSourceKind as d, PropertyValueType as i } from "@cratis/scene.model";
2
+ import { elementNodeId as f, inspect as y, isCanvas as g, isExternalComponent as h, isPanel as $ } from "@cratis/scene.engine";
3
+ function u(e) {
4
+ return $(e) ? e.children : h(e) ? Object.values(e.slots).flat() : [];
5
+ }
6
+ function m(e) {
7
+ return e.flatMap((t) => [t.id, ...m(u(t))]);
8
+ }
9
+ function b(e, t) {
10
+ for (const n of e) {
11
+ if (n.id === t) return n;
12
+ const o = b(u(n), t);
13
+ if (o) return o;
14
+ }
15
+ }
16
+ function v(e, t) {
17
+ for (const n of e) {
18
+ if (u(n).some((s) => s.id === t)) return n;
19
+ const o = v(u(n), t);
20
+ if (o) return o;
21
+ }
22
+ }
23
+ function B(e, t) {
24
+ const n = v(e, t);
25
+ return n !== void 0 && g(n);
26
+ }
27
+ function M(e, t, n, o, s) {
28
+ const a = m(t).map((r) => C(e, r, n)).filter((r) => !!r && r.outputs.length > 0);
29
+ return {
30
+ dataContextPaths: Object.keys(o).sort((r, l) => r.localeCompare(l)),
31
+ queryResults: s.map((r) => ({
32
+ id: r.id,
33
+ name: r.name,
34
+ fields: r.resultFields.map((l) => l.name)
35
+ })),
36
+ componentOutputs: a
37
+ };
38
+ }
39
+ function C(e, t, n) {
40
+ const o = y(e, f(t), n);
41
+ if (!o) return;
42
+ const s = o.properties.filter((a) => a.descriptor.output === !0).map((a) => ({
43
+ path: a.descriptor.path,
44
+ label: a.descriptor.label,
45
+ type: String(a.descriptor.valueType)
46
+ }));
47
+ return {
48
+ componentId: t,
49
+ label: o.label,
50
+ outputs: s
51
+ };
52
+ }
53
+ var E = [
54
+ d.DataContext,
55
+ d.QueryResult,
56
+ d.ComponentProperty,
57
+ d.Literal
58
+ ], S = [p.OneWay, p.TwoWay], N = [
59
+ c.Propagate,
60
+ c.Clear,
61
+ c.Preserve
62
+ ], O = [
63
+ i.String,
64
+ i.Number,
65
+ i.Boolean,
66
+ i.Enum,
67
+ i.Icon,
68
+ i.Destination,
69
+ i.QueryReference,
70
+ i.Collection,
71
+ i.Object,
72
+ i.Json
73
+ ];
74
+ function T(e) {
75
+ const t = e;
76
+ return !!t && typeof t == "object" && typeof t.path == "string" && (t.kind === void 0 || E.includes(t.kind));
77
+ }
78
+ function D(e) {
79
+ return (e.descriptor.acceptedBindingKinds?.length ?? 0) > 0 || T(e.effectiveValue);
80
+ }
81
+ function P(e) {
82
+ return {
83
+ kind: e.descriptor.acceptedBindingKinds?.[0] ?? d.DataContext,
84
+ path: "",
85
+ mode: e.descriptor.bindingMode,
86
+ expectedValueType: e.descriptor.valueType
87
+ };
88
+ }
89
+ var R = {
90
+ unset: "Not set",
91
+ item: "Item",
92
+ itemTitle: (e, t) => `${e} ${t}`,
93
+ add: (e) => `Add ${e.toLowerCase()}`,
94
+ remove: (e, t) => `Remove ${e.toLowerCase()} ${t}`,
95
+ removeText: "Remove",
96
+ moveUp: (e, t) => `Move ${e.toLowerCase()} ${t} up`,
97
+ moveUpText: "Up",
98
+ moveDown: (e, t) => `Move ${e.toLowerCase()} ${t} down`,
99
+ moveDownText: "Down",
100
+ entry: (e) => `Entry ${e}`,
101
+ moveEntryUp: (e) => `Move entry ${e} up`,
102
+ moveEntryDown: (e) => `Move entry ${e} down`,
103
+ removeEntry: (e) => `Remove entry ${e}`,
104
+ addEntry: "Add entry",
105
+ useList: "Use a list",
106
+ useSingle: "Use one value",
107
+ scalarType: "Type",
108
+ scalarText: "Text",
109
+ scalarNumber: "Number",
110
+ scalarFlag: "Yes or no",
111
+ scalarFlagOn: "Yes",
112
+ mapName: (e) => `Name ${e}`,
113
+ mapValue: (e) => `Value of ${e}`,
114
+ addMapEntry: "Add value",
115
+ removeMapEntry: (e) => `Remove ${e}`,
116
+ keptValue: "A structured value, kept as it is.",
117
+ mismatch: (e, t) => `The saved value of '${e}' does not fit what it is described as: ${t}.`,
118
+ convert: "Give its items identifiers",
119
+ clear: "Clear the value",
120
+ noEditor: (e) => `'${e}' has no editor: nothing describes what it holds, so it cannot be edited here.`
121
+ };
122
+ export {
123
+ P as a,
124
+ D as c,
125
+ m as d,
126
+ b as f,
127
+ N as i,
128
+ M as l,
129
+ v as m,
130
+ E as n,
131
+ O as o,
132
+ B as p,
133
+ S as r,
134
+ T as s,
135
+ R as t,
136
+ u
137
+ };
@@ -0,0 +1,12 @@
1
+ import { validateValue as r } from "@cratis/scene.engine";
2
+ function d(e, o) {
3
+ if (o === void 0) return;
4
+ const i = r(e, o);
5
+ return i === void 0 ? void 0 : {
6
+ code: "invalidValue",
7
+ message: i
8
+ };
9
+ }
10
+ export {
11
+ d as t
12
+ };
@@ -0,0 +1,49 @@
1
+ import { DiagnosticCode as i, DiagnosticSeverity as u } from "@cratis/scene.model";
2
+ var p = /* @__PURE__ */ (function(t) {
3
+ return t.NoTarget = "noTarget", t.UnknownScreen = "unknownScreen", t.InvalidRoute = "invalidRoute", t.UnknownOutlet = "unknownOutlet", t.UnknownDialog = "unknownDialog", t.UnknownSlice = "unknownSlice", t.OutletKindWithoutOutlet = "outletKindWithoutOutlet", t.DialogKindWithoutDialog = "dialogKindWithoutDialog", t.ExternalKindWithoutRoute = "externalKindWithoutRoute", t;
4
+ })({});
5
+ function d(t, a) {
6
+ const o = t.runtime.bundles;
7
+ return {
8
+ screens: s(t.destinations.map((e) => e.id)),
9
+ outlets: s([
10
+ ...o.flatMap((e) => (e.layouts ?? []).flatMap((n) => n.outlets ?? [])),
11
+ ...o.flatMap((e) => (e.screenTemplates ?? []).flatMap((n) => n.outlets ?? [])),
12
+ ...a.screenTemplates.flatMap((e) => e.outlets ?? [])
13
+ ].map((e) => e.name)),
14
+ dialogTemplates: s([...o.flatMap((e) => e.dialogTemplates ?? []), ...a.dialogTemplates].map((e) => e.name)),
15
+ slices: s(t.stateChangeSlices.map((e) => e.id))
16
+ };
17
+ }
18
+ function s(t) {
19
+ return [...new Set(t.filter((a) => a.length > 0))].sort((a, o) => a.localeCompare(o));
20
+ }
21
+ var r = /* @__PURE__ */ new Set([
22
+ i.MissingIconLibrary,
23
+ i.MissingIcon,
24
+ i.MissingIconVariant,
25
+ i.IncompatibleIconLibrary,
26
+ i.IconCatalogUnavailable,
27
+ i.IconNotVerified
28
+ ]), l = (t) => r.has(t.code), c = (t) => t.code === i.IconNotVerified;
29
+ function f(t, a, o) {
30
+ const e = t.filter((n) => l(n) && !c(n) && n.path === a && n.itemId === o);
31
+ return (e.find((n) => n.severity === u.Error) ?? e[0])?.message;
32
+ }
33
+ var I = (t) => t.filter((a) => !l(a));
34
+ function m(t, a) {
35
+ const o = {};
36
+ for (const e of t) {
37
+ if (e.itemId === void 0) continue;
38
+ const n = f(t, a, e.itemId);
39
+ n && (o[e.itemId] = { icon: n });
40
+ }
41
+ return o;
42
+ }
43
+ export {
44
+ p as a,
45
+ s as i,
46
+ I as n,
47
+ d as r,
48
+ m as t
49
+ };