@cratis/event-models 0.180.0 → 0.181.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/CascadeMenu/CascadeEntry.d.ts +44 -0
- package/dist/screen-editor/CascadeMenu/CascadeEntryKind.d.ts +15 -0
- package/dist/screen-editor/CascadeMenu/CascadeFilter.d.ts +9 -0
- package/dist/screen-editor/CascadeMenu/CascadeMenu.d.ts +25 -0
- package/dist/screen-editor/CascadeMenu/CascadePanel.d.ts +26 -0
- package/dist/screen-editor/CascadeMenu/OpenSubmenu.d.ts +8 -0
- package/dist/screen-editor/CascadeMenu/cascadeNavigation.d.ts +27 -0
- package/dist/screen-editor/CascadeMenu/index.d.ts +6 -0
- package/dist/screen-editor/CascadeMenu/keepInputInMenu.d.ts +18 -0
- package/dist/screen-editor/CascadeMenu/placeCascadePanel.d.ts +37 -0
- package/dist/screen-editor/{ColumnListEditor-Cku6GGLp.js → ColumnListEditor-BHLrr4WK.js} +1 -1
- package/dist/screen-editor/{FieldEditor-SquvComm.js → FieldEditor-4a_4uQit.js} +1 -1
- package/dist/screen-editor/{FieldListEditor-CNxskXPf.js → FieldListEditor-RGb59BLM.js} +1 -1
- package/dist/screen-editor/NavigationItemTargetEditor-C3epn45p.js +72 -0
- package/dist/screen-editor/{NavigationTargetEditor-DGnW5pVF.js → NavigationTargetEditor-BZ0uQnIl.js} +1 -1
- package/dist/screen-editor/{ReferenceEditor-BnI2Qd7H.js → ReferenceEditor-BGuaEvY7.js} +1 -1
- package/dist/screen-editor/ReferenceTargetEditors-kxd9SIuG.js +18 -0
- package/dist/screen-editor/{RenderingSlotEditor-Cani_PtT.js → RenderingSlotEditor-D0ppEIOx.js} +4 -4
- package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeChrome.d.ts +15 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeFrames.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/DesignModePopover.d.ts +19 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeStrings.d.ts +73 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/FloatingItemToolbar.d.ts +19 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/EditorLogoContext.d.ts +7 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/EditorNavigationScope.d.ts +10 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/navigationDocument.d.ts +8 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/navigationItemOps.d.ts +11 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/regionItemSource.d.ts +25 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/cloneWithNewIds.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/collectionItemSource.d.ts +10 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/designModeKeys.d.ts +7 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/designModeRules.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/designModeTypes.d.ts +89 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/elementItemSource.d.ts +22 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/placeFloatingToolbar.d.ts +18 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/resolveDesignMode.d.ts +21 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/useDesignMode.d.ts +31 -0
- package/dist/screen-editor/ScreenEditor/DesignMode/useDesignModeMeasurement.d.ts +10 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +12 -2
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +7 -0
- package/dist/screen-editor/ScreenEditor/Inspector/DiagnosticList.d.ts +7 -2
- package/dist/screen-editor/ScreenEditor/Inspector/NavigationSection.d.ts +13 -0
- package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +4 -7
- package/dist/screen-editor/ScreenEditor/Inspector/ToolbarButtonSection.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +2 -1
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +3 -1
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +11 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +4 -1
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationItemTargetEditor.d.ts +16 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +0 -1
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/TemplatePropertyEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/Surface/ScreenSurface.d.ts +4 -2
- package/dist/screen-editor/ScreenEditor/Surface/designTimePointer.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/Surface/elementRect.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/Surface/useDesignTimePointer.d.ts +1 -1
- package/dist/screen-editor/ScreenEditor/Templates/screenTemplateTarget.d.ts +21 -0
- package/dist/screen-editor/ScreenEditor/Toolbar/slicesOfStructure.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/Toolbar/toolbarDiagnostics.d.ts +8 -0
- package/dist/screen-editor/ScreenEditor/Toolbar/upgradeToolbarButton.d.ts +5 -0
- package/dist/screen-editor/ScreenTemplates/TemplateReference.d.ts +8 -0
- package/dist/screen-editor/ScreenTemplates/TemplateReferenceKind.d.ts +7 -0
- package/dist/screen-editor/ScreenTemplates/toTemplateSources.d.ts +18 -0
- package/dist/screen-editor/SearchableSelect-C4yzIyo_.js +110 -0
- package/dist/screen-editor/{SelectEditor-BuQPlIyf.js → SelectEditor-eeAE7a9p.js} +1 -1
- package/dist/screen-editor/SliceEditor-DLqvdYge.js +51 -0
- package/dist/screen-editor/{StateChangeEditors-9k3Gqtc0.js → StateChangeEditors-OQ-OUDrv.js} +1 -1
- package/dist/screen-editor/TemplatePicker/TemplatePicker.d.ts +28 -0
- package/dist/screen-editor/TemplatePicker/TemplatePickerHandlers.d.ts +14 -0
- package/dist/screen-editor/TemplatePicker/TemplatePickerLabels.d.ts +27 -0
- package/dist/screen-editor/TemplatePicker/TemplatePickerMenu.d.ts +26 -0
- package/dist/screen-editor/TemplatePicker/describeTemplatePicker.d.ts +26 -0
- package/dist/screen-editor/TemplatePicker/index.d.ts +6 -0
- package/dist/screen-editor/TemplatePicker/templateMatchesFilter.d.ts +11 -0
- package/dist/screen-editor/TemplatePropertyEditor-D_OaRTPe.js +38 -0
- package/dist/screen-editor/index.js +4671 -2982
- package/dist/screen-editor/screen-editor.css +1 -1
- package/dist/screen-editor/toTemplateSources-CN-BMZ39.js +492 -0
- package/package.json +12 -12
- package/dist/screen-editor/ReferenceTargetEditors-COKAWO5q.js +0 -19
- package/dist/screen-editor/ScreenEditor/Inspector/TemplateBrowser.d.ts +0 -13
- package/dist/screen-editor/ScreenEditor/Templates/TemplateInapplicability.d.ts +0 -4
- package/dist/screen-editor/ScreenEditor/Templates/templateBrowser.d.ts +0 -21
- package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +0 -109
- package/dist/screen-editor/SliceEditor-Dle8OlsB.js +0 -45
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
import { useCallback as R, useEffect as x, useLayoutEffect as F, useMemo as q, useRef as L, useState as S } from "react";
|
|
2
|
+
import { TemplateReferenceSource as O, TemplateScope as U } from "@cratis/scene.model";
|
|
3
|
+
import { Fragment as j, jsx as s, jsxs as N } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as W } from "react-dom";
|
|
5
|
+
function G(e, a, o) {
|
|
6
|
+
const i = o.trim().toLocaleLowerCase();
|
|
7
|
+
return i.length === 0 ? !0 : [
|
|
8
|
+
e.displayName,
|
|
9
|
+
e.name,
|
|
10
|
+
e.description,
|
|
11
|
+
e.metadata?.category,
|
|
12
|
+
e.metadata?.type,
|
|
13
|
+
a
|
|
14
|
+
].some((r) => r?.toLocaleLowerCase().includes(i));
|
|
15
|
+
}
|
|
16
|
+
var l = /* @__PURE__ */ (function(e) {
|
|
17
|
+
return e.Heading = "heading", e.Subheading = "subheading", e.Item = "item", e.Submenu = "submenu", e.Separator = "separator", e.Note = "note", e;
|
|
18
|
+
})({}), M = 8, P = 4;
|
|
19
|
+
function J(e, a, o) {
|
|
20
|
+
const i = Math.max(M, Math.min(e.left, o.width - a.width - M)), r = e.top + e.height + P;
|
|
21
|
+
return {
|
|
22
|
+
left: i,
|
|
23
|
+
top: r + a.height <= o.height - M ? r : Math.max(M, e.top - a.height - P)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function K(e, a, o) {
|
|
27
|
+
const i = e.left + e.width + P;
|
|
28
|
+
return {
|
|
29
|
+
left: i + a.width <= o.width - M ? i : Math.max(M, e.left - a.width - P),
|
|
30
|
+
top: Math.max(M, Math.min(e.top - 4, o.height - a.height - M))
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
var B = ({ entries: e, depth: a, anchor: o, openPath: i, label: r, filter: u, onOpen: d, onCollapse: h, onChosen: m }) => {
|
|
34
|
+
const p = L(null), [f, _] = S();
|
|
35
|
+
F(() => {
|
|
36
|
+
const t = p.current?.getBoundingClientRect();
|
|
37
|
+
if (!t) return;
|
|
38
|
+
const c = {
|
|
39
|
+
width: window.innerWidth,
|
|
40
|
+
height: window.innerHeight
|
|
41
|
+
};
|
|
42
|
+
_(a === 0 ? J(o, t, c) : K(o, t, c));
|
|
43
|
+
}, [
|
|
44
|
+
o,
|
|
45
|
+
a,
|
|
46
|
+
e
|
|
47
|
+
]), x(() => {
|
|
48
|
+
a === 0 && f && p.current?.querySelector("[data-cascade-focusable]")?.focus();
|
|
49
|
+
}, [a, f === void 0]);
|
|
50
|
+
const k = i[a], n = k ? e.find((t) => t.kind === l.Submenu && t.id === k.id) : void 0;
|
|
51
|
+
return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ N("div", {
|
|
52
|
+
ref: p,
|
|
53
|
+
className: "studio-cascade-menu__panel",
|
|
54
|
+
role: "menu",
|
|
55
|
+
"aria-label": r,
|
|
56
|
+
"data-cascade-depth": a,
|
|
57
|
+
style: {
|
|
58
|
+
top: f?.top ?? 0,
|
|
59
|
+
left: f?.left ?? 0,
|
|
60
|
+
visibility: f ? "visible" : "hidden"
|
|
61
|
+
},
|
|
62
|
+
children: [u && /* @__PURE__ */ s("input", {
|
|
63
|
+
type: "search",
|
|
64
|
+
className: "studio-cascade-menu__filter",
|
|
65
|
+
role: "searchbox",
|
|
66
|
+
"aria-label": u.placeholder,
|
|
67
|
+
placeholder: u.placeholder,
|
|
68
|
+
value: u.value,
|
|
69
|
+
"data-cascade-focusable": "",
|
|
70
|
+
onChange: (t) => u.onChange(t.target.value)
|
|
71
|
+
}), e.map((t) => {
|
|
72
|
+
switch (t.kind) {
|
|
73
|
+
case l.Heading:
|
|
74
|
+
return /* @__PURE__ */ s("div", {
|
|
75
|
+
className: "studio-cascade-menu__heading",
|
|
76
|
+
role: "presentation",
|
|
77
|
+
"data-cascade-entry": t.id,
|
|
78
|
+
children: t.label
|
|
79
|
+
}, t.id);
|
|
80
|
+
case l.Subheading:
|
|
81
|
+
return /* @__PURE__ */ s("div", {
|
|
82
|
+
className: "studio-cascade-menu__subheading",
|
|
83
|
+
role: "presentation",
|
|
84
|
+
"data-cascade-entry": t.id,
|
|
85
|
+
children: t.label
|
|
86
|
+
}, t.id);
|
|
87
|
+
case l.Separator:
|
|
88
|
+
return /* @__PURE__ */ s("div", {
|
|
89
|
+
className: "studio-cascade-menu__separator",
|
|
90
|
+
role: "separator"
|
|
91
|
+
}, t.id);
|
|
92
|
+
case l.Note:
|
|
93
|
+
return /* @__PURE__ */ s("div", {
|
|
94
|
+
className: "studio-cascade-menu__note",
|
|
95
|
+
role: "presentation",
|
|
96
|
+
"data-cascade-entry": t.id,
|
|
97
|
+
children: t.label
|
|
98
|
+
}, t.id);
|
|
99
|
+
case l.Submenu:
|
|
100
|
+
return /* @__PURE__ */ N("button", {
|
|
101
|
+
type: "button",
|
|
102
|
+
role: "menuitem",
|
|
103
|
+
"aria-haspopup": "menu",
|
|
104
|
+
"aria-expanded": k?.id === t.id,
|
|
105
|
+
className: `studio-cascade-menu__row studio-cascade-menu__row--submenu${k?.id === t.id ? " studio-cascade-menu__row--open" : ""}`,
|
|
106
|
+
"data-cascade-focusable": "",
|
|
107
|
+
"data-cascade-entry": t.id,
|
|
108
|
+
onMouseEnter: (c) => d(a, {
|
|
109
|
+
id: t.id,
|
|
110
|
+
rect: D(c.currentTarget)
|
|
111
|
+
}),
|
|
112
|
+
onClick: (c) => d(a, {
|
|
113
|
+
id: t.id,
|
|
114
|
+
rect: D(c.currentTarget)
|
|
115
|
+
}),
|
|
116
|
+
children: [/* @__PURE__ */ s("span", {
|
|
117
|
+
className: "studio-cascade-menu__label",
|
|
118
|
+
children: t.label
|
|
119
|
+
}), /* @__PURE__ */ s("span", {
|
|
120
|
+
className: "studio-cascade-menu__chevron",
|
|
121
|
+
"aria-hidden": "true",
|
|
122
|
+
children: "▸"
|
|
123
|
+
})]
|
|
124
|
+
}, t.id);
|
|
125
|
+
default:
|
|
126
|
+
return /* @__PURE__ */ N("div", {
|
|
127
|
+
className: "studio-cascade-menu__line",
|
|
128
|
+
role: "presentation",
|
|
129
|
+
onMouseEnter: () => h(a),
|
|
130
|
+
children: [/* @__PURE__ */ N("button", {
|
|
131
|
+
type: "button",
|
|
132
|
+
role: t.checked === void 0 ? "menuitem" : "menuitemradio",
|
|
133
|
+
"aria-checked": t.checked,
|
|
134
|
+
"aria-disabled": t.disabledReason !== void 0,
|
|
135
|
+
title: t.disabledReason,
|
|
136
|
+
className: `studio-cascade-menu__row${t.checked ? " studio-cascade-menu__row--current" : ""}${t.disabledReason ? " studio-cascade-menu__row--disabled" : ""}`,
|
|
137
|
+
"data-cascade-focusable": "",
|
|
138
|
+
"data-cascade-entry": t.id,
|
|
139
|
+
onClick: () => {
|
|
140
|
+
t.disabledReason || (t.onActivate(), m());
|
|
141
|
+
},
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ s("span", {
|
|
144
|
+
className: "studio-cascade-menu__check",
|
|
145
|
+
"aria-hidden": "true",
|
|
146
|
+
children: t.checked ? "✓" : ""
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ N("span", {
|
|
149
|
+
className: "studio-cascade-menu__text",
|
|
150
|
+
children: [/* @__PURE__ */ s("span", {
|
|
151
|
+
className: "studio-cascade-menu__label",
|
|
152
|
+
children: t.label
|
|
153
|
+
}), t.description && /* @__PURE__ */ s("span", {
|
|
154
|
+
className: "studio-cascade-menu__description",
|
|
155
|
+
children: t.description
|
|
156
|
+
})]
|
|
157
|
+
}),
|
|
158
|
+
t.trailing && /* @__PURE__ */ s("span", {
|
|
159
|
+
className: "studio-cascade-menu__trailing",
|
|
160
|
+
children: t.trailing
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
}), t.actions?.map((c, g) => /* @__PURE__ */ s("button", {
|
|
164
|
+
type: "button",
|
|
165
|
+
className: "studio-cascade-menu__secondary",
|
|
166
|
+
"data-cascade-focusable": "",
|
|
167
|
+
"data-cascade-entry": `${t.id}:action-${g}`,
|
|
168
|
+
title: c.label,
|
|
169
|
+
"aria-label": `${c.label}: ${t.label}`,
|
|
170
|
+
onClick: () => {
|
|
171
|
+
c.onActivate(), c.closes && m();
|
|
172
|
+
},
|
|
173
|
+
children: c.label
|
|
174
|
+
}, g))]
|
|
175
|
+
}, t.id);
|
|
176
|
+
}
|
|
177
|
+
})]
|
|
178
|
+
}), n && n.kind === l.Submenu && /* @__PURE__ */ s(B, {
|
|
179
|
+
entries: n.entries,
|
|
180
|
+
depth: a + 1,
|
|
181
|
+
anchor: k.rect,
|
|
182
|
+
openPath: i,
|
|
183
|
+
label: n.label,
|
|
184
|
+
onOpen: d,
|
|
185
|
+
onCollapse: h,
|
|
186
|
+
onChosen: m
|
|
187
|
+
})] });
|
|
188
|
+
};
|
|
189
|
+
function D(e) {
|
|
190
|
+
const { top: a, left: o, width: i, height: r } = e.getBoundingClientRect();
|
|
191
|
+
return {
|
|
192
|
+
top: a,
|
|
193
|
+
left: o,
|
|
194
|
+
width: i,
|
|
195
|
+
height: r
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
var w = /* @__PURE__ */ (function(e) {
|
|
199
|
+
return e.Previous = "previous", e.Next = "next", e.First = "first", e.Last = "last", e.Into = "into", e.Out = "out", e;
|
|
200
|
+
})({});
|
|
201
|
+
function Q(e, a) {
|
|
202
|
+
switch (e) {
|
|
203
|
+
case "ArrowDown":
|
|
204
|
+
return w.Next;
|
|
205
|
+
case "ArrowUp":
|
|
206
|
+
return w.Previous;
|
|
207
|
+
case "ArrowRight":
|
|
208
|
+
return a ? void 0 : w.Into;
|
|
209
|
+
case "ArrowLeft":
|
|
210
|
+
return a ? void 0 : w.Out;
|
|
211
|
+
case "Home":
|
|
212
|
+
return a ? void 0 : w.First;
|
|
213
|
+
case "End":
|
|
214
|
+
return a ? void 0 : w.Last;
|
|
215
|
+
default:
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function V(e, a, o) {
|
|
220
|
+
if (o === 0) return -1;
|
|
221
|
+
switch (e) {
|
|
222
|
+
case w.First:
|
|
223
|
+
return 0;
|
|
224
|
+
case w.Last:
|
|
225
|
+
return o - 1;
|
|
226
|
+
case w.Previous:
|
|
227
|
+
return a <= 0 ? o - 1 : a - 1;
|
|
228
|
+
default:
|
|
229
|
+
return a < 0 || a >= o - 1 ? 0 : a + 1;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
var v = (e) => {
|
|
233
|
+
e.isPropagationStopped = () => !0;
|
|
234
|
+
}, X = {
|
|
235
|
+
onPointerDown: v,
|
|
236
|
+
onPointerUp: v,
|
|
237
|
+
onMouseDown: v,
|
|
238
|
+
onMouseUp: v,
|
|
239
|
+
onClick: v,
|
|
240
|
+
onDoubleClick: v,
|
|
241
|
+
onContextMenu: v,
|
|
242
|
+
onWheel: v,
|
|
243
|
+
onKeyUp: v,
|
|
244
|
+
onDragStart: v
|
|
245
|
+
}, Y = v, C = (e) => [...e.querySelectorAll('[data-cascade-focusable]:not([aria-disabled="true"])')], Z = ({ anchor: e, trigger: a, entries: o, label: i, filter: r, onClose: u }) => {
|
|
246
|
+
const d = L(null), [h, m] = S([]), [p] = S(() => ({
|
|
247
|
+
top: e.top,
|
|
248
|
+
left: e.left,
|
|
249
|
+
width: e.width,
|
|
250
|
+
height: e.height
|
|
251
|
+
}));
|
|
252
|
+
x(() => {
|
|
253
|
+
const n = a ?? (document.activeElement instanceof HTMLElement ? document.activeElement : null);
|
|
254
|
+
return () => n?.focus?.();
|
|
255
|
+
}, [a]), x(() => {
|
|
256
|
+
const n = (t) => {
|
|
257
|
+
const c = t.target;
|
|
258
|
+
!d.current?.contains(c) && !a?.contains(c) && u();
|
|
259
|
+
};
|
|
260
|
+
return document.addEventListener("pointerdown", n, !0), () => document.removeEventListener("pointerdown", n, !0);
|
|
261
|
+
}, [u, a]);
|
|
262
|
+
const f = R((n, t) => m((c) => [...c.slice(0, n), t]), []), _ = R((n) => m((t) => t.length > n ? t.slice(0, n) : t), []);
|
|
263
|
+
return W(/* @__PURE__ */ s("div", {
|
|
264
|
+
...X,
|
|
265
|
+
ref: d,
|
|
266
|
+
className: "studio-cascade-menu",
|
|
267
|
+
onKeyDown: (n) => {
|
|
268
|
+
Y(n);
|
|
269
|
+
const t = document.activeElement, c = t?.closest(".studio-cascade-menu__panel"), g = Number(c?.dataset.cascadeDepth ?? 0);
|
|
270
|
+
if (n.key === "Escape") {
|
|
271
|
+
if (n.preventDefault(), n.stopPropagation(), g > 0) {
|
|
272
|
+
const b = d.current?.querySelector(`[data-cascade-depth="${g - 1}"] [aria-expanded="true"]`);
|
|
273
|
+
_(g - 1), b?.focus();
|
|
274
|
+
} else u();
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (n.key === "Tab" && c) {
|
|
278
|
+
const b = C(c);
|
|
279
|
+
if (b.length === 0) return;
|
|
280
|
+
n.preventDefault();
|
|
281
|
+
const $ = b.indexOf(t);
|
|
282
|
+
b[n.shiftKey ? $ <= 0 ? b.length - 1 : $ - 1 : ($ + 1) % b.length]?.focus();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const T = Q(n.key, t instanceof HTMLInputElement);
|
|
286
|
+
if (!T || !c) return;
|
|
287
|
+
if (n.preventDefault(), T === w.Into) {
|
|
288
|
+
if (t?.getAttribute("aria-haspopup") !== "menu") return;
|
|
289
|
+
t.click(), requestAnimationFrame(() => {
|
|
290
|
+
const b = d.current?.querySelector(`[data-cascade-depth="${g + 1}"]`);
|
|
291
|
+
b && C(b)[0]?.focus();
|
|
292
|
+
});
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (T === w.Out) {
|
|
296
|
+
if (g === 0) return;
|
|
297
|
+
const b = d.current?.querySelector(`[data-cascade-depth="${g - 1}"] [aria-expanded="true"]`);
|
|
298
|
+
_(g - 1), b?.focus();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const A = C(c);
|
|
302
|
+
A[V(T, A.indexOf(t), A.length)]?.focus();
|
|
303
|
+
},
|
|
304
|
+
children: /* @__PURE__ */ s(B, {
|
|
305
|
+
entries: o,
|
|
306
|
+
depth: 0,
|
|
307
|
+
anchor: p,
|
|
308
|
+
openPath: h,
|
|
309
|
+
label: i,
|
|
310
|
+
filter: r,
|
|
311
|
+
onOpen: f,
|
|
312
|
+
onCollapse: _,
|
|
313
|
+
onChosen: u
|
|
314
|
+
})
|
|
315
|
+
}), document.body);
|
|
316
|
+
}, y = /* @__PURE__ */ (function(e) {
|
|
317
|
+
return e.Blueprint = "blueprint", e.Application = "application", e;
|
|
318
|
+
})({}), I = (e) => ({
|
|
319
|
+
kind: l.Separator,
|
|
320
|
+
id: e,
|
|
321
|
+
label: ""
|
|
322
|
+
}), z = " · ";
|
|
323
|
+
function ee(e, a) {
|
|
324
|
+
return a ? (e.reference.source === O.Own ? y.Application : y.Blueprint) === a.kind && e.reference.id.toLowerCase() === a.id.toLowerCase() : !1;
|
|
325
|
+
}
|
|
326
|
+
function te(e, a, o, i, r) {
|
|
327
|
+
const u = (n, t, c) => ({
|
|
328
|
+
kind: l.Item,
|
|
329
|
+
id: t,
|
|
330
|
+
label: n.displayName ?? n.name,
|
|
331
|
+
checked: ee(n, a),
|
|
332
|
+
actions: [...r.onPreview ? [{
|
|
333
|
+
label: i.preview,
|
|
334
|
+
closes: !0,
|
|
335
|
+
onActivate: () => r.onPreview(n)
|
|
336
|
+
}] : [], ...c !== void 0 && r.onCopyToMine ? [{
|
|
337
|
+
label: i.copyToMine,
|
|
338
|
+
closes: !0,
|
|
339
|
+
onActivate: () => r.onCopyToMine(n)
|
|
340
|
+
}] : []],
|
|
341
|
+
onActivate: () => r.onChoose(n)
|
|
342
|
+
}), d = H(e.own, void 0, o), h = d.length > 1 || d.some((n) => n.category !== void 0), m = d.flatMap((n, t) => [...h ? [{
|
|
343
|
+
kind: l.Subheading,
|
|
344
|
+
id: `own-category-${t}`,
|
|
345
|
+
label: n.category ?? i.uncategorized
|
|
346
|
+
}] : [], ...n.templates.map((c) => u(c, `own:${c.reference.id}`))]), p = e.blueprints.map((n) => ({
|
|
347
|
+
blueprint: n,
|
|
348
|
+
categories: H(n.categories, n.blueprint, o)
|
|
349
|
+
})).filter((n) => n.categories.length > 0), f = p.length === 0 ? [] : [{
|
|
350
|
+
kind: l.Submenu,
|
|
351
|
+
id: "blueprints",
|
|
352
|
+
label: i.blueprints,
|
|
353
|
+
entries: [{
|
|
354
|
+
kind: l.Heading,
|
|
355
|
+
id: "blueprints-heading",
|
|
356
|
+
label: i.blueprints
|
|
357
|
+
}, ...p.map(({ blueprint: n, categories: t }) => ({
|
|
358
|
+
kind: l.Submenu,
|
|
359
|
+
id: `blueprint:${n.blueprint}`,
|
|
360
|
+
label: E(n),
|
|
361
|
+
entries: t.flatMap((c, g) => [{
|
|
362
|
+
kind: l.Heading,
|
|
363
|
+
id: `blueprint:${n.blueprint}:category-${g}`,
|
|
364
|
+
label: [E(n), c.category ?? i.uncategorized].join(z)
|
|
365
|
+
}, ...c.templates.map((T) => u(T, `blueprint:${n.blueprint}:${T.reference.id}`, n.blueprint))])
|
|
366
|
+
}))]
|
|
367
|
+
}], _ = [...r.onNewFromCurrent ? [{
|
|
368
|
+
kind: l.Item,
|
|
369
|
+
id: "new-from-current",
|
|
370
|
+
label: `+ ${i.newFromCurrent}`,
|
|
371
|
+
onActivate: r.onNewFromCurrent
|
|
372
|
+
}] : [], ...r.onClear ? [{
|
|
373
|
+
kind: l.Item,
|
|
374
|
+
id: "clear",
|
|
375
|
+
label: i.clear,
|
|
376
|
+
onActivate: r.onClear
|
|
377
|
+
}] : []], k = m.length === 0 && f.length === 0;
|
|
378
|
+
return [
|
|
379
|
+
...m.length > 0 ? [{
|
|
380
|
+
kind: l.Heading,
|
|
381
|
+
id: "my-templates",
|
|
382
|
+
label: i.myTemplates
|
|
383
|
+
}, ...m] : [],
|
|
384
|
+
...k ? [{
|
|
385
|
+
kind: l.Note,
|
|
386
|
+
id: "nothing-applies",
|
|
387
|
+
label: i.nothingApplies
|
|
388
|
+
}] : [],
|
|
389
|
+
...f.length > 0 ? [...m.length > 0 ? [I("blueprints-separator")] : [], ...f] : [],
|
|
390
|
+
..._.length > 0 ? [I("footer-separator"), ..._] : []
|
|
391
|
+
];
|
|
392
|
+
}
|
|
393
|
+
function E(e) {
|
|
394
|
+
return e.displayName ?? e.blueprint;
|
|
395
|
+
}
|
|
396
|
+
function H(e, a, o) {
|
|
397
|
+
return e.map((i) => ({
|
|
398
|
+
...i,
|
|
399
|
+
templates: i.templates.filter((r) => G(r, a, o))
|
|
400
|
+
})).filter((i) => i.templates.length > 0);
|
|
401
|
+
}
|
|
402
|
+
var ae = ({ anchor: e, trigger: a, applicable: o, current: i, labels: r, handlers: u, onClose: d }) => {
|
|
403
|
+
const [h, m] = S(""), p = q(() => te(o, i, h, r, u), [
|
|
404
|
+
o,
|
|
405
|
+
i,
|
|
406
|
+
h,
|
|
407
|
+
r,
|
|
408
|
+
u
|
|
409
|
+
]);
|
|
410
|
+
return /* @__PURE__ */ s(Z, {
|
|
411
|
+
anchor: e,
|
|
412
|
+
trigger: a,
|
|
413
|
+
entries: p,
|
|
414
|
+
label: r.menu,
|
|
415
|
+
onClose: d,
|
|
416
|
+
filter: {
|
|
417
|
+
value: h,
|
|
418
|
+
placeholder: r.filter,
|
|
419
|
+
onChange: m
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}, ce = ({ applicable: e, current: a, currentLabel: o, status: i, labels: r, handlers: u, ariaLabel: d, disabled: h = !1 }) => {
|
|
423
|
+
const m = L(null), [p, f] = S();
|
|
424
|
+
return /* @__PURE__ */ N("div", {
|
|
425
|
+
className: "studio-template-picker",
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ N("button", {
|
|
428
|
+
ref: m,
|
|
429
|
+
type: "button",
|
|
430
|
+
className: "studio-template-picker__select",
|
|
431
|
+
"aria-haspopup": "menu",
|
|
432
|
+
"aria-expanded": p !== void 0,
|
|
433
|
+
"aria-label": d,
|
|
434
|
+
disabled: h,
|
|
435
|
+
onClick: () => f((_) => _ ? void 0 : m.current?.getBoundingClientRect()),
|
|
436
|
+
children: [/* @__PURE__ */ s("span", {
|
|
437
|
+
className: "studio-template-picker__value",
|
|
438
|
+
children: o ?? r.noTemplate
|
|
439
|
+
}), /* @__PURE__ */ s("span", {
|
|
440
|
+
className: "studio-template-picker__caret",
|
|
441
|
+
"aria-hidden": "true",
|
|
442
|
+
children: "▾"
|
|
443
|
+
})]
|
|
444
|
+
}),
|
|
445
|
+
i && /* @__PURE__ */ s("span", {
|
|
446
|
+
className: "studio-template-picker__status",
|
|
447
|
+
children: i
|
|
448
|
+
}),
|
|
449
|
+
p && /* @__PURE__ */ s(ae, {
|
|
450
|
+
anchor: p,
|
|
451
|
+
trigger: m.current,
|
|
452
|
+
applicable: e,
|
|
453
|
+
current: a,
|
|
454
|
+
labels: r,
|
|
455
|
+
handlers: u,
|
|
456
|
+
onClose: () => f(void 0)
|
|
457
|
+
})
|
|
458
|
+
]
|
|
459
|
+
});
|
|
460
|
+
};
|
|
461
|
+
function se({ bundles: e, profile: a, scope: o }) {
|
|
462
|
+
const i = a.layout ? [...e].reverse().flatMap((r) => [...r.layouts ?? []]).find((r) => r.name === a.layout) : void 0;
|
|
463
|
+
return {
|
|
464
|
+
scope: o ?? U.Slice,
|
|
465
|
+
...i ? { container: {
|
|
466
|
+
name: i.name,
|
|
467
|
+
slots: i.slots
|
|
468
|
+
} } : {}
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function ue(e) {
|
|
472
|
+
const a = {
|
|
473
|
+
screen: /* @__PURE__ */ new Map(),
|
|
474
|
+
dialog: /* @__PURE__ */ new Map()
|
|
475
|
+
};
|
|
476
|
+
for (const o of e) {
|
|
477
|
+
for (const i of o.screenTemplates ?? []) a.screen.set(i.name, o.manifest.name);
|
|
478
|
+
for (const i of o.dialogTemplates ?? []) a.dialog.set(i.name, o.manifest.name);
|
|
479
|
+
}
|
|
480
|
+
return e.map((o) => ({
|
|
481
|
+
manifest: o.manifest,
|
|
482
|
+
layouts: o.layouts,
|
|
483
|
+
screenTemplates: o.screenTemplates?.filter((i) => a.screen.get(i.name) === o.manifest.name),
|
|
484
|
+
dialogTemplates: o.dialogTemplates?.filter((i) => a.dialog.get(i.name) === o.manifest.name)
|
|
485
|
+
}));
|
|
486
|
+
}
|
|
487
|
+
export {
|
|
488
|
+
y as i,
|
|
489
|
+
se as n,
|
|
490
|
+
ce as r,
|
|
491
|
+
ue as t
|
|
492
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/event-models",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.181.0",
|
|
4
4
|
"description": "The Cratis event model board as a configurable React component.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Cratis",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"build": "yarn g:build && yarn run -T tsc -p .frontend/tsconfig.build.json && cp Model/event-model-document.schema.json Theme/theme.css dist/ && rm -f dist/.tsbuildinfo && node ../../scripts/package-build/strip-declaration-stylesheets.mjs dist && yarn build:screen-editor",
|
|
59
59
|
"build:screen-editor": "yarn run -T vite build --config .frontend/vite.screen-editor.config.ts && yarn run -T tsc -p .frontend/tsconfig.screen-editor.build.json && rm -f dist/screen-editor/.tsbuildinfo && node ../../scripts/package-build/strip-declaration-stylesheets.mjs dist/screen-editor",
|
|
60
60
|
"guard:boundary": "node ../../scripts/package-guards/boundary-report.mjs --package Source/EventModels --allow eventModels --entry index.ts",
|
|
61
|
-
"guard:tarball": "node ../../scripts/package-guards/tarball-guard.mjs --package Source/EventModels --budget
|
|
61
|
+
"guard:tarball": "node ../../scripts/package-guards/tarball-guard.mjs --package Source/EventModels --budget 2700000 --must-import @primereact/core/config",
|
|
62
62
|
"guard:self-test": "node ../../scripts/package-guards/tarball-guard.mjs --self-test && node ../../scripts/package-guards/boundary-report.mjs --self-test",
|
|
63
63
|
"guard:screen-editor-boundary": "node ../../scripts/package-guards/boundary-report.mjs --package Source/Editor --allow screenEditor --entry ScreenEditor/index.ts",
|
|
64
64
|
"guard:peer-floor": "node ../../scripts/package-guards/peer-floor-guard.mjs --self-test && node ../../scripts/package-guards/peer-floor-guard.mjs --package-json package.json --peer @primereact/styles --source ../Editor/ScreenEditor/Host/screenEditorPrimeReactDefaults.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@cratis/components": "^4.26.2",
|
|
70
70
|
"@cratis/fundamentals": "^7.22.0",
|
|
71
|
-
"@cratis/scene": "^0.
|
|
71
|
+
"@cratis/scene": "^0.181.0",
|
|
72
72
|
"@cratis/scene.blueprint.components": "^4.12.0",
|
|
73
73
|
"@cratis/scene.blueprint.default": "^4.12.0",
|
|
74
74
|
"@cratis/scene.components": "^4.12.0",
|
|
@@ -93,15 +93,15 @@
|
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@cratis/components": "^4.26.2",
|
|
95
95
|
"@cratis/fundamentals": "^7.22.0",
|
|
96
|
-
"@cratis/scene": "0.
|
|
97
|
-
"@cratis/scene.blueprint.components": "4.
|
|
98
|
-
"@cratis/scene.blueprint.default": "4.
|
|
99
|
-
"@cratis/scene.components": "4.
|
|
100
|
-
"@cratis/scene.engine": "4.
|
|
101
|
-
"@cratis/scene.model": "4.
|
|
102
|
-
"@cratis/scene.primereact": "4.
|
|
103
|
-
"@cratis/scene.react": "4.
|
|
104
|
-
"@cratis/scene.tailwind": "4.
|
|
96
|
+
"@cratis/scene": "0.181.0",
|
|
97
|
+
"@cratis/scene.blueprint.components": "4.30.0",
|
|
98
|
+
"@cratis/scene.blueprint.default": "4.30.0",
|
|
99
|
+
"@cratis/scene.components": "4.30.0",
|
|
100
|
+
"@cratis/scene.engine": "4.30.0",
|
|
101
|
+
"@cratis/scene.model": "4.30.0",
|
|
102
|
+
"@cratis/scene.primereact": "4.30.0",
|
|
103
|
+
"@cratis/scene.react": "4.30.0",
|
|
104
|
+
"@cratis/scene.tailwind": "4.30.0",
|
|
105
105
|
"@primereact/styles": "^11.2.0",
|
|
106
106
|
"chart.js": "4.5.1",
|
|
107
107
|
"lucide-react": "1.52.0",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ReferenceEditor as o } from "./ReferenceEditor-BnI2Qd7H.js";
|
|
2
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
-
var r = (t) => (e) => /* @__PURE__ */ i(o, {
|
|
4
|
-
...e,
|
|
5
|
-
descriptor: {
|
|
6
|
-
...e.descriptor,
|
|
7
|
-
editorOptions: {
|
|
8
|
-
...e.descriptor.editorOptions,
|
|
9
|
-
reference: {
|
|
10
|
-
target: t,
|
|
11
|
-
...e.descriptor.editorOptions?.reference
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}), m = r("template"), p = r("sampleData");
|
|
16
|
-
export {
|
|
17
|
-
p as SampleDataEditor,
|
|
18
|
-
m as TemplateEditor
|
|
19
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { TemplateScope } from '@cratis/scene.model';
|
|
2
|
-
import { type TemplateBrowserPackage } from '../Templates/templateBrowser';
|
|
3
|
-
import type { ScreenEditorStrings } from './ScreenEditorStrings';
|
|
4
|
-
export interface TemplateBrowserProps {
|
|
5
|
-
packages: readonly TemplateBrowserPackage[];
|
|
6
|
-
scope: TemplateScope | undefined;
|
|
7
|
-
selected: string | undefined;
|
|
8
|
-
disabled: boolean;
|
|
9
|
-
strings: ScreenEditorStrings['properties']['templates'];
|
|
10
|
-
onSelect: (template: string | undefined) => void;
|
|
11
|
-
onPreview?: (template: string) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare const TemplateBrowser: ({ packages, scope, selected, disabled, strings, onSelect, onPreview }: TemplateBrowserProps) => import("react").JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { TemplateScope, type ScreenTemplate } from '@cratis/scene.model';
|
|
2
|
-
import { TemplateInapplicability } from './TemplateInapplicability';
|
|
3
|
-
export declare const applicationShellType = "ApplicationShell";
|
|
4
|
-
export interface TemplateBrowserPackage {
|
|
5
|
-
manifest: {
|
|
6
|
-
name: string;
|
|
7
|
-
};
|
|
8
|
-
screenTemplates?: readonly ScreenTemplate[];
|
|
9
|
-
}
|
|
10
|
-
export interface TemplateBrowserEntry {
|
|
11
|
-
template: ScreenTemplate;
|
|
12
|
-
packageName: string;
|
|
13
|
-
label: string;
|
|
14
|
-
inapplicable?: TemplateInapplicability;
|
|
15
|
-
}
|
|
16
|
-
export interface TemplateBrowserCategory {
|
|
17
|
-
name: string;
|
|
18
|
-
entries: TemplateBrowserEntry[];
|
|
19
|
-
}
|
|
20
|
-
export declare function browseTemplates(packages: readonly TemplateBrowserPackage[], scope: TemplateScope | undefined, search: string): TemplateBrowserCategory[];
|
|
21
|
-
export declare function inapplicabilityOf(template: ScreenTemplate, scope: TemplateScope | undefined): TemplateInapplicability | undefined;
|