@cratis/event-models 0.193.0 → 0.194.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/BlueprintPreview/blueprintPreviewCatalog.d.ts +5 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorOverlay.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWindow.d.ts +3 -1
- package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/Structure/StructureTreeAdapter.d.ts +3 -0
- package/dist/screen-editor/SelectEditor-Bi_fonS5.js +34 -0
- package/dist/screen-editor/TemplatePicker/TemplatePickerHandlers.d.ts +2 -0
- package/dist/screen-editor/TemplatePicker/TemplatePickerLabels.d.ts +2 -0
- package/dist/screen-editor/{TemplatePropertyEditor-Dx1dw5aY.js → TemplatePropertyEditor-BuRsxUDC.js} +1 -1
- package/dist/screen-editor/index.js +2040 -2008
- package/dist/screen-editor/screen-editor.css +1 -1
- package/dist/screen-editor/toTemplateSources-CgAMAN8N.js +501 -0
- package/package.json +27 -12
- package/dist/screen-editor/SelectEditor-DStMNhWd.js +0 -26
- package/dist/screen-editor/toTemplateSources-DHyjt_ff.js +0 -492
|
@@ -1,492 +0,0 @@
|
|
|
1
|
-
import { useCallback as R, useEffect as x, useLayoutEffect as B, 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 c, 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 F = ({ 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
|
-
B(() => {
|
|
36
|
-
const t = p.current?.getBoundingClientRect();
|
|
37
|
-
if (!t) return;
|
|
38
|
-
const s = {
|
|
39
|
-
width: window.innerWidth,
|
|
40
|
-
height: window.innerHeight
|
|
41
|
-
};
|
|
42
|
-
_(a === 0 ? J(o, t, s) : K(o, t, s));
|
|
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__ */ c("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__ */ c("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__ */ c("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__ */ c("div", {
|
|
89
|
-
className: "studio-cascade-menu__separator",
|
|
90
|
-
role: "separator"
|
|
91
|
-
}, t.id);
|
|
92
|
-
case l.Note:
|
|
93
|
-
return /* @__PURE__ */ c("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: (s) => d(a, {
|
|
109
|
-
id: t.id,
|
|
110
|
-
rect: D(s.currentTarget)
|
|
111
|
-
}),
|
|
112
|
-
onClick: (s) => d(a, {
|
|
113
|
-
id: t.id,
|
|
114
|
-
rect: D(s.currentTarget)
|
|
115
|
-
}),
|
|
116
|
-
children: [/* @__PURE__ */ c("span", {
|
|
117
|
-
className: "studio-cascade-menu__label",
|
|
118
|
-
children: t.label
|
|
119
|
-
}), /* @__PURE__ */ c("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__ */ c("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__ */ c("span", {
|
|
151
|
-
className: "studio-cascade-menu__label",
|
|
152
|
-
children: t.label
|
|
153
|
-
}), t.description && /* @__PURE__ */ c("span", {
|
|
154
|
-
className: "studio-cascade-menu__description",
|
|
155
|
-
children: t.description
|
|
156
|
-
})]
|
|
157
|
-
}),
|
|
158
|
-
t.trailing && /* @__PURE__ */ c("span", {
|
|
159
|
-
className: "studio-cascade-menu__trailing",
|
|
160
|
-
children: t.trailing
|
|
161
|
-
})
|
|
162
|
-
]
|
|
163
|
-
}), t.actions?.map((s, g) => /* @__PURE__ */ c("button", {
|
|
164
|
-
type: "button",
|
|
165
|
-
className: "studio-cascade-menu__secondary",
|
|
166
|
-
"data-cascade-focusable": "",
|
|
167
|
-
"data-cascade-entry": `${t.id}:action-${g}`,
|
|
168
|
-
title: s.label,
|
|
169
|
-
"aria-label": `${s.label}: ${t.label}`,
|
|
170
|
-
onClick: () => {
|
|
171
|
-
s.onActivate(), s.closes && m();
|
|
172
|
-
},
|
|
173
|
-
children: s.label
|
|
174
|
-
}, g))]
|
|
175
|
-
}, t.id);
|
|
176
|
-
}
|
|
177
|
-
})]
|
|
178
|
-
}), n && n.kind === l.Submenu && /* @__PURE__ */ c(F, {
|
|
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 s = t.target;
|
|
258
|
-
!d.current?.contains(s) && !a?.contains(s) && u();
|
|
259
|
-
};
|
|
260
|
-
return document.addEventListener("pointerdown", n, !0), () => document.removeEventListener("pointerdown", n, !0);
|
|
261
|
-
}, [u, a]);
|
|
262
|
-
const f = R((n, t) => m((s) => [...s.slice(0, n), t]), []), _ = R((n) => m((t) => t.length > n ? t.slice(0, n) : t), []);
|
|
263
|
-
return W(/* @__PURE__ */ c("div", {
|
|
264
|
-
...X,
|
|
265
|
-
ref: d,
|
|
266
|
-
className: "studio-cascade-menu",
|
|
267
|
-
onKeyDown: (n) => {
|
|
268
|
-
Y(n);
|
|
269
|
-
const t = document.activeElement, s = t?.closest(".studio-cascade-menu__panel"), g = Number(s?.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" && s) {
|
|
278
|
-
const b = C(s);
|
|
279
|
-
if (b.length === 0) return;
|
|
280
|
-
n.preventDefault();
|
|
281
|
-
const A = b.indexOf(t);
|
|
282
|
-
b[n.shiftKey ? A <= 0 ? b.length - 1 : A - 1 : (A + 1) % b.length]?.focus();
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
const T = Q(n.key, t instanceof HTMLInputElement);
|
|
286
|
-
if (!T || !s) 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 $ = C(s);
|
|
302
|
-
$[V(T, $.indexOf(t), $.length)]?.focus();
|
|
303
|
-
},
|
|
304
|
-
children: /* @__PURE__ */ c(F, {
|
|
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, s) => ({
|
|
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
|
-
}] : [], ...s !== 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((s) => u(s, `own:${s.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((s, g) => [{
|
|
362
|
-
kind: l.Heading,
|
|
363
|
-
id: `blueprint:${n.blueprint}:category-${g}`,
|
|
364
|
-
label: [E(n), s.category ?? i.uncategorized].join(z)
|
|
365
|
-
}, ...s.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__ */ c(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
|
-
}, se = ({ 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__ */ c("span", {
|
|
437
|
-
className: "studio-template-picker__value",
|
|
438
|
-
children: o ?? r.noTemplate
|
|
439
|
-
}), /* @__PURE__ */ c("span", {
|
|
440
|
-
className: "studio-template-picker__caret",
|
|
441
|
-
"aria-hidden": "true",
|
|
442
|
-
children: "▾"
|
|
443
|
-
})]
|
|
444
|
-
}),
|
|
445
|
-
i && /* @__PURE__ */ c("span", {
|
|
446
|
-
className: "studio-template-picker__status",
|
|
447
|
-
children: i
|
|
448
|
-
}),
|
|
449
|
-
p && /* @__PURE__ */ c(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 ce({ 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
|
-
ce as n,
|
|
490
|
-
se as r,
|
|
491
|
-
ue as t
|
|
492
|
-
};
|