@cratis/event-models 0.179.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.
Files changed (86) hide show
  1. package/dist/screen-editor/CascadeMenu/CascadeEntry.d.ts +44 -0
  2. package/dist/screen-editor/CascadeMenu/CascadeEntryKind.d.ts +15 -0
  3. package/dist/screen-editor/CascadeMenu/CascadeFilter.d.ts +9 -0
  4. package/dist/screen-editor/CascadeMenu/CascadeMenu.d.ts +25 -0
  5. package/dist/screen-editor/CascadeMenu/CascadePanel.d.ts +26 -0
  6. package/dist/screen-editor/CascadeMenu/OpenSubmenu.d.ts +8 -0
  7. package/dist/screen-editor/CascadeMenu/cascadeNavigation.d.ts +27 -0
  8. package/dist/screen-editor/CascadeMenu/index.d.ts +6 -0
  9. package/dist/screen-editor/CascadeMenu/keepInputInMenu.d.ts +18 -0
  10. package/dist/screen-editor/CascadeMenu/placeCascadePanel.d.ts +37 -0
  11. package/dist/screen-editor/{ColumnListEditor-Cku6GGLp.js → ColumnListEditor-BHLrr4WK.js} +1 -1
  12. package/dist/screen-editor/{FieldEditor-SquvComm.js → FieldEditor-4a_4uQit.js} +1 -1
  13. package/dist/screen-editor/{FieldListEditor-CNxskXPf.js → FieldListEditor-RGb59BLM.js} +1 -1
  14. package/dist/screen-editor/NavigationItemTargetEditor-C3epn45p.js +72 -0
  15. package/dist/screen-editor/{NavigationTargetEditor-DGnW5pVF.js → NavigationTargetEditor-BZ0uQnIl.js} +1 -1
  16. package/dist/screen-editor/{ReferenceEditor-BnI2Qd7H.js → ReferenceEditor-BGuaEvY7.js} +1 -1
  17. package/dist/screen-editor/ReferenceTargetEditors-kxd9SIuG.js +18 -0
  18. package/dist/screen-editor/{RenderingSlotEditor-Cani_PtT.js → RenderingSlotEditor-D0ppEIOx.js} +4 -4
  19. package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeChrome.d.ts +15 -0
  20. package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeFrames.d.ts +9 -0
  21. package/dist/screen-editor/ScreenEditor/DesignMode/DesignModePopover.d.ts +19 -0
  22. package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeStrings.d.ts +73 -0
  23. package/dist/screen-editor/ScreenEditor/DesignMode/FloatingItemToolbar.d.ts +19 -0
  24. package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/EditorLogoContext.d.ts +7 -0
  25. package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/EditorNavigationScope.d.ts +10 -0
  26. package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/navigationDocument.d.ts +8 -0
  27. package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/navigationItemOps.d.ts +11 -0
  28. package/dist/screen-editor/ScreenEditor/DesignMode/Navigation/regionItemSource.d.ts +25 -0
  29. package/dist/screen-editor/ScreenEditor/DesignMode/cloneWithNewIds.d.ts +2 -0
  30. package/dist/screen-editor/ScreenEditor/DesignMode/collectionItemSource.d.ts +10 -0
  31. package/dist/screen-editor/ScreenEditor/DesignMode/designModeKeys.d.ts +7 -0
  32. package/dist/screen-editor/ScreenEditor/DesignMode/designModeRules.d.ts +9 -0
  33. package/dist/screen-editor/ScreenEditor/DesignMode/designModeTypes.d.ts +89 -0
  34. package/dist/screen-editor/ScreenEditor/DesignMode/elementItemSource.d.ts +22 -0
  35. package/dist/screen-editor/ScreenEditor/DesignMode/placeFloatingToolbar.d.ts +18 -0
  36. package/dist/screen-editor/ScreenEditor/DesignMode/resolveDesignMode.d.ts +21 -0
  37. package/dist/screen-editor/ScreenEditor/DesignMode/useDesignMode.d.ts +31 -0
  38. package/dist/screen-editor/ScreenEditor/DesignMode/useDesignModeMeasurement.d.ts +10 -0
  39. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +12 -2
  40. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +7 -0
  41. package/dist/screen-editor/ScreenEditor/Inspector/DiagnosticList.d.ts +7 -2
  42. package/dist/screen-editor/ScreenEditor/Inspector/NavigationSection.d.ts +13 -0
  43. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +4 -7
  44. package/dist/screen-editor/ScreenEditor/Inspector/ToolbarButtonSection.d.ts +9 -0
  45. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +2 -1
  46. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +3 -1
  47. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +11 -0
  48. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +4 -1
  49. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +1 -0
  50. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationItemTargetEditor.d.ts +16 -0
  51. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +0 -1
  52. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +1 -1
  53. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/TemplatePropertyEditor.d.ts +2 -0
  54. package/dist/screen-editor/ScreenEditor/Surface/ScreenSurface.d.ts +4 -2
  55. package/dist/screen-editor/ScreenEditor/Surface/designTimePointer.d.ts +2 -0
  56. package/dist/screen-editor/ScreenEditor/Surface/elementRect.d.ts +1 -0
  57. package/dist/screen-editor/ScreenEditor/Surface/useDesignTimePointer.d.ts +1 -1
  58. package/dist/screen-editor/ScreenEditor/Templates/screenTemplateTarget.d.ts +21 -0
  59. package/dist/screen-editor/ScreenEditor/Toolbar/slicesOfStructure.d.ts +3 -0
  60. package/dist/screen-editor/ScreenEditor/Toolbar/toolbarDiagnostics.d.ts +8 -0
  61. package/dist/screen-editor/ScreenEditor/Toolbar/upgradeToolbarButton.d.ts +5 -0
  62. package/dist/screen-editor/ScreenTemplates/TemplateReference.d.ts +8 -0
  63. package/dist/screen-editor/ScreenTemplates/TemplateReferenceKind.d.ts +7 -0
  64. package/dist/screen-editor/ScreenTemplates/toTemplateSources.d.ts +18 -0
  65. package/dist/screen-editor/SearchableSelect-C4yzIyo_.js +110 -0
  66. package/dist/screen-editor/{SelectEditor-BuQPlIyf.js → SelectEditor-eeAE7a9p.js} +1 -1
  67. package/dist/screen-editor/SliceEditor-DLqvdYge.js +51 -0
  68. package/dist/screen-editor/{StateChangeEditors-9k3Gqtc0.js → StateChangeEditors-OQ-OUDrv.js} +1 -1
  69. package/dist/screen-editor/TemplatePicker/TemplatePicker.d.ts +28 -0
  70. package/dist/screen-editor/TemplatePicker/TemplatePickerHandlers.d.ts +14 -0
  71. package/dist/screen-editor/TemplatePicker/TemplatePickerLabels.d.ts +27 -0
  72. package/dist/screen-editor/TemplatePicker/TemplatePickerMenu.d.ts +26 -0
  73. package/dist/screen-editor/TemplatePicker/describeTemplatePicker.d.ts +26 -0
  74. package/dist/screen-editor/TemplatePicker/index.d.ts +6 -0
  75. package/dist/screen-editor/TemplatePicker/templateMatchesFilter.d.ts +11 -0
  76. package/dist/screen-editor/TemplatePropertyEditor-D_OaRTPe.js +38 -0
  77. package/dist/screen-editor/index.js +4671 -2982
  78. package/dist/screen-editor/screen-editor.css +1 -1
  79. package/dist/screen-editor/toTemplateSources-CN-BMZ39.js +492 -0
  80. package/package.json +12 -12
  81. package/dist/screen-editor/ReferenceTargetEditors-COKAWO5q.js +0 -19
  82. package/dist/screen-editor/ScreenEditor/Inspector/TemplateBrowser.d.ts +0 -13
  83. package/dist/screen-editor/ScreenEditor/Templates/TemplateInapplicability.d.ts +0 -4
  84. package/dist/screen-editor/ScreenEditor/Templates/templateBrowser.d.ts +0 -21
  85. package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +0 -109
  86. package/dist/screen-editor/SliceEditor-Dle8OlsB.js +0 -45
@@ -0,0 +1,110 @@
1
+ import { useId as P, useMemo as Q, useRef as R, useState as p } from "react";
2
+ import { jsx as l, jsxs as d } from "react/jsx-runtime";
3
+ function T(u, a) {
4
+ const s = a.trim().toLowerCase();
5
+ return u.filter((o) => s === "" || o.label.toLowerCase().includes(s) || (o.group ?? "").toLowerCase().includes(s));
6
+ }
7
+ var $ = ({ id: u, options: a, value: s, onChange: o, disabled: b, invalid: A, placeholder: j, searchLabel: v, emptyLabel: O, clearLabel: E, clearable: I, renderClosed: g, inline: i, ...y }) => {
8
+ const [K, w] = p(!1), c = i === !0 || K, [h, N] = p(""), [k, m] = p(0), x = P(), D = R(null), f = a.find((e) => e.value === s), n = Q(() => T(a, h), [a, h]), r = n.filter((e) => e.disabled !== !0), _ = () => {
9
+ i !== !0 && w(!1), N("");
10
+ }, C = (e) => {
11
+ e.disabled || (o(e.value), _());
12
+ }, L = (e) => {
13
+ if (e.key === "Escape") {
14
+ e.stopPropagation(), _();
15
+ return;
16
+ }
17
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
18
+ if (e.preventDefault(), r.length === 0) return;
19
+ m((t) => (t + (e.key === "ArrowDown" ? 1 : -1) + r.length) % r.length);
20
+ } else if (e.key === "Enter") {
21
+ e.preventDefault();
22
+ const t = r[Math.min(k, r.length - 1)];
23
+ t && C(t);
24
+ }
25
+ }, M = n.some((e) => e.section !== void 0), S = (e) => M ? e.section ?? "" : e.group ?? "", q = [...new Set(n.map(S))].sort((e, t) => M ? 0 : e === "" ? -1 : t === "" ? 1 : 0), B = r[Math.min(k, Math.max(r.length - 1, 0))]?.value;
26
+ return /* @__PURE__ */ d("div", {
27
+ ref: D,
28
+ className: "studio-editor-select",
29
+ onKeyDown: c ? L : void 0,
30
+ onBlur: (e) => {
31
+ D.current?.contains(e.relatedTarget) || _();
32
+ },
33
+ children: [
34
+ i !== !0 && /* @__PURE__ */ l("button", {
35
+ type: "button",
36
+ id: u,
37
+ role: "combobox",
38
+ "aria-haspopup": "listbox",
39
+ "aria-expanded": c,
40
+ "aria-controls": c ? x : void 0,
41
+ "aria-invalid": A || void 0,
42
+ className: "studio-editor-select__trigger",
43
+ disabled: b,
44
+ ...y,
45
+ onClick: () => {
46
+ w(!c), m(0);
47
+ },
48
+ children: g ? g(f) : /* @__PURE__ */ l("span", {
49
+ className: f ? void 0 : "studio-editor-select__placeholder",
50
+ children: f?.label ?? j
51
+ })
52
+ }),
53
+ I === !0 && s !== void 0 && !b && /* @__PURE__ */ l("button", {
54
+ type: "button",
55
+ className: "studio-editor-select__clear",
56
+ "aria-label": E,
57
+ onClick: () => o(void 0),
58
+ children: "×"
59
+ }),
60
+ c && /* @__PURE__ */ d("div", {
61
+ className: `studio-editor-select__panel${i === !0 ? " studio-editor-select__panel--inline" : ""}`,
62
+ children: [(i !== !0 || a.length > 10) && /* @__PURE__ */ l("input", {
63
+ type: "search",
64
+ autoFocus: !0,
65
+ className: "studio-editor-select__search",
66
+ "aria-label": v,
67
+ placeholder: v,
68
+ value: h,
69
+ onChange: (e) => {
70
+ N(e.target.value), m(0);
71
+ }
72
+ }), /* @__PURE__ */ d("ul", {
73
+ id: x,
74
+ role: "listbox",
75
+ "aria-labelledby": y["aria-labelledby"],
76
+ className: "studio-editor-select__options",
77
+ children: [n.length === 0 && /* @__PURE__ */ l("li", {
78
+ className: "studio-editor-select__empty",
79
+ children: O
80
+ }), q.map((e) => /* @__PURE__ */ d("li", {
81
+ role: "presentation",
82
+ children: [e !== "" && /* @__PURE__ */ l("div", {
83
+ className: "studio-editor-select__group",
84
+ children: e
85
+ }), /* @__PURE__ */ l("ul", {
86
+ role: "presentation",
87
+ children: n.filter((t) => S(t) === e).map((t) => /* @__PURE__ */ d("li", {
88
+ role: "option",
89
+ "aria-selected": t.value === s,
90
+ "aria-disabled": t.disabled || void 0,
91
+ className: [
92
+ "studio-editor-select__option",
93
+ t.value === B ? "studio-editor-select__option--active" : "",
94
+ t.value === s ? "studio-editor-select__option--chosen" : ""
95
+ ].join(" ").trim(),
96
+ title: t.reason ?? (t.group ? t.group : void 0),
97
+ onMouseDown: (F) => F.preventDefault(),
98
+ onClick: () => C(t),
99
+ children: [/* @__PURE__ */ l("span", { children: t.label }), t.trailing !== void 0 ? /* @__PURE__ */ l("small", { children: t.trailing }) : t.disabled && t.reason && /* @__PURE__ */ l("small", { children: t.reason })]
100
+ }, t.value))
101
+ })]
102
+ }, e))]
103
+ })]
104
+ })
105
+ ]
106
+ });
107
+ };
108
+ export {
109
+ $ as t
110
+ };
@@ -1,5 +1,5 @@
1
1
  import { n as b, t as p } from "./choiceKeys-DQcUX97p.js";
2
- import { t as h } from "./SearchableSelect-WUNlC3tk.js";
2
+ import { t as h } from "./SearchableSelect-C4yzIyo_.js";
3
3
  import { jsx as m } from "react/jsx-runtime";
4
4
  var x = ({ value: i, onChange: c, descriptor: o, context: s, disabled: n, problem: d, id: r }) => {
5
5
  const a = s.strings.editors.select, l = i ?? void 0, t = b(o.choices ?? [], l);
@@ -0,0 +1,51 @@
1
+ import { t as m } from "./SearchableSelect-C4yzIyo_.js";
2
+ import { jsx as b } from "react/jsx-runtime";
3
+ function h(a, i, t) {
4
+ const l = a.slices.length > 0 ? a.slices : a.stateChangeSlices.map((e) => ({
5
+ id: e.id,
6
+ name: e.name,
7
+ kind: "StateChange",
8
+ path: e.origin
9
+ })), c = i !== void 0, r = l.map((e) => {
10
+ const o = i === void 0 || i.includes(e.kind);
11
+ return {
12
+ value: e.id,
13
+ label: e.name,
14
+ group: e.path.join(" › "),
15
+ ...c ? {
16
+ section: o ? t.slice.sections.accepted : t.slice.sections.refused,
17
+ trailing: o ? e.path[0] ?? "" : t.slice.kindName(e.kind)
18
+ } : {},
19
+ ...o ? {} : {
20
+ disabled: !0,
21
+ reason: t.slice.notKind(t.slice.kindName(i?.[0] ?? e.kind))
22
+ }
23
+ };
24
+ });
25
+ return c ? [...r.filter((e) => e.disabled !== !0), ...r.filter((e) => e.disabled === !0)] : r;
26
+ }
27
+ var f = ({ value: a, onChange: i, descriptor: t, context: l, disabled: c, problem: r, inline: e, id: o }) => {
28
+ const s = l.strings.editors, d = h(l.lookups, t.editorOptions?.kinds, s), n = typeof a == "string" && a !== "" ? a : void 0, p = n !== void 0 && !d.some((u) => u.value === n);
29
+ return /* @__PURE__ */ b(m, {
30
+ id: o,
31
+ ...e ? { inline: e } : {},
32
+ options: p ? [...d, {
33
+ value: n,
34
+ label: n,
35
+ group: ""
36
+ }] : d,
37
+ value: n,
38
+ disabled: c,
39
+ invalid: p || r !== void 0,
40
+ placeholder: s.slice.placeholder,
41
+ searchLabel: s.select.search,
42
+ emptyLabel: s.select.empty,
43
+ clearLabel: s.select.clear,
44
+ clearable: t.constraints?.required !== !0,
45
+ "aria-labelledby": `${o}-label`,
46
+ onChange: i
47
+ });
48
+ };
49
+ export {
50
+ f as SliceEditor
51
+ };
@@ -1,4 +1,4 @@
1
- import { SliceEditor as r } from "./SliceEditor-Dle8OlsB.js";
1
+ import { SliceEditor as r } from "./SliceEditor-DLqvdYge.js";
2
2
  import { jsx as i } from "react/jsx-runtime";
3
3
  var d = (t) => /* @__PURE__ */ i(r, {
4
4
  ...t,
@@ -0,0 +1,28 @@
1
+ import type { ApplicableTemplateSet } from '@cratis/scene.engine';
2
+ import { TemplateReference } from '../ScreenTemplates/TemplateReference';
3
+ import { TemplatePickerHandlers } from './TemplatePickerHandlers';
4
+ import { TemplatePickerLabels } from './TemplatePickerLabels';
5
+ export interface TemplatePickerProps {
6
+ /** What applies at the target - Scene's `applicableTemplates`. */
7
+ applicable: ApplicableTemplateSet;
8
+ /** The template in effect, which gets the check. */
9
+ current?: TemplateReference;
10
+ /** What to show for it in the closed control. */
11
+ currentLabel?: string;
12
+ /** A line under the control, for example where an inherited template was chosen. */
13
+ status?: string;
14
+ /** The labels to use. */
15
+ labels: TemplatePickerLabels;
16
+ /** What choosing does. */
17
+ handlers: TemplatePickerHandlers;
18
+ /** The accessible name of the control. */
19
+ ariaLabel: string;
20
+ /** Whether the control can be used. */
21
+ disabled?: boolean;
22
+ }
23
+ /**
24
+ * The control that chooses a template: a select-shaped button showing what is in effect, which opens the one
25
+ * {@link TemplatePickerMenu}. It is parameterised by the target alone - what applies comes from Scene - so every
26
+ * place that applies a template uses this and none draws a menu of its own (spec TPL4).
27
+ */
28
+ export declare const TemplatePicker: ({ applicable, current, currentLabel, status, labels, handlers, ariaLabel, disabled }: TemplatePickerProps) => import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import type { ApplicableTemplate } from '@cratis/scene.engine';
2
+ /** What choosing in the template picker does. */
3
+ export interface TemplatePickerHandlers {
4
+ /** A template was chosen: the reference to store. */
5
+ onChoose: (template: ApplicableTemplate) => void;
6
+ /** The user asked to copy a blueprint template into their own (spec TPL3). Absent when copying is not offered. */
7
+ onCopyToMine?: (template: ApplicableTemplate) => void;
8
+ /** The user asked to look at a template before choosing it. Absent when the host cannot show one. */
9
+ onPreview?: (template: ApplicableTemplate) => void;
10
+ /** The user asked for a new template made from what is there now. Absent when that is not offered. */
11
+ onNewFromCurrent?: () => void;
12
+ /** The user gave up the choice, so the level inherits again (or has no template). Absent when there is nothing to give up. */
13
+ onClear?: () => void;
14
+ }
@@ -0,0 +1,27 @@
1
+ /** Every label the template picker shows. The host owns the resource file; declaring the shape here makes a missing label a compile error there. */
2
+ export interface TemplatePickerLabels {
3
+ /** The filter field's placeholder and accessible name. */
4
+ filter: string;
5
+ /** The heading over the user's own templates. */
6
+ myTemplates: string;
7
+ /** The row that opens the blueprints, and the heading of the panel it opens. */
8
+ blueprints: string;
9
+ /** The category heading for templates that name none, shown only beside named ones. */
10
+ uncategorized: string;
11
+ /** The footer action that makes a template from what is there now. */
12
+ newFromCurrent: string;
13
+ /** The footer action that gives up the choice. */
14
+ clear: string;
15
+ /** The secondary action on a blueprint template that copies it into the user's own. */
16
+ copyToMine: string;
17
+ /** The secondary action on a template that opens it to look at before it is chosen. */
18
+ preview: string;
19
+ /** Shown when nothing applies at the target, or nothing matches the filter. */
20
+ nothingApplies: string;
21
+ /** What the control shows when no template is chosen. */
22
+ noTemplate: string;
23
+ /** The accessible name of the menu. */
24
+ menu: string;
25
+ /** The text beside a pinned blueprint template when its blueprint has since been updated; `{version}` is the installed version. */
26
+ updateAvailable: string;
27
+ }
@@ -0,0 +1,26 @@
1
+ import type { ApplicableTemplateSet } from '@cratis/scene.engine';
2
+ import { TemplateReference } from '../ScreenTemplates/TemplateReference';
3
+ import { TemplatePickerHandlers } from './TemplatePickerHandlers';
4
+ import { TemplatePickerLabels } from './TemplatePickerLabels';
5
+ export interface TemplatePickerMenuProps {
6
+ /** Where the menu opens: the control that was pressed. */
7
+ anchor: DOMRect;
8
+ /** The control that opened the menu. */
9
+ trigger?: HTMLElement | null;
10
+ /** What applies at the target - Scene's `applicableTemplates`. */
11
+ applicable: ApplicableTemplateSet;
12
+ /** The template in effect, which gets the check. */
13
+ current?: TemplateReference;
14
+ /** The labels to use. */
15
+ labels: TemplatePickerLabels;
16
+ /** What choosing does. */
17
+ handlers: TemplatePickerHandlers;
18
+ /** Called when the menu should go away. */
19
+ onClose: () => void;
20
+ }
21
+ /**
22
+ * The template picker's menu, for a host that has its own control to open it from - a header action, a row's caret.
23
+ * Everything that chooses a template draws this one menu (spec TPL4): the levels of the board, the UI Profile default,
24
+ * the screen editor's `template` property.
25
+ */
26
+ export declare const TemplatePickerMenu: ({ anchor, trigger, applicable, current, labels, handlers, onClose }: TemplatePickerMenuProps) => import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import type { ApplicableTemplate, ApplicableTemplateSet } from '@cratis/scene.engine';
2
+ import { CascadeEntry } from '../CascadeMenu';
3
+ import { TemplateReference } from '../ScreenTemplates/TemplateReference';
4
+ import { TemplatePickerHandlers } from './TemplatePickerHandlers';
5
+ import { TemplatePickerLabels } from './TemplatePickerLabels';
6
+ /** The separator between the two names in a blueprint's category heading: `CRM · Workspace`. */
7
+ export declare const blueprintCategorySeparator = " \u00B7 ";
8
+ /** Whether a template is the one in effect. */
9
+ export declare function isCurrentTemplate(template: ApplicableTemplate, current: TemplateReference | undefined): boolean;
10
+ /**
11
+ * The rows of the template picker, from what Scene says applies at the target.
12
+ *
13
+ * The user's own templates come first, directly, grouped by category with a check on the one in effect; the blueprints
14
+ * are always one level deeper (`Blueprints ▸`, then the blueprint, then its templates grouped as
15
+ * `Blueprint · Category`), and a blueprint with nothing applicable is not in the set at all, so it is never listed
16
+ * (spec TPL2). The footer holds "New template from current…" and "Clear template". Nothing here decides what applies:
17
+ * a template that is not in the set is not shown, and one that is, is.
18
+ *
19
+ * @param set What applies at the target - Scene's `applicableTemplates`.
20
+ * @param current The template in effect, if any.
21
+ * @param filter What was typed into the filter.
22
+ * @param labels The labels to use.
23
+ * @param handlers What choosing does.
24
+ * @returns The rows of the first panel.
25
+ */
26
+ export declare function describeTemplatePicker(set: ApplicableTemplateSet, current: TemplateReference | undefined, filter: string, labels: TemplatePickerLabels, handlers: TemplatePickerHandlers): CascadeEntry[];
@@ -0,0 +1,6 @@
1
+ export * from './TemplatePickerLabels';
2
+ export * from './TemplatePickerHandlers';
3
+ export * from './templateMatchesFilter';
4
+ export * from './describeTemplatePicker';
5
+ export * from './TemplatePickerMenu';
6
+ export * from './TemplatePicker';
@@ -0,0 +1,11 @@
1
+ import type { ApplicableTemplate } from '@cratis/scene.engine';
2
+ /**
3
+ * Whether a template matches what was typed into the picker's filter: its name, description, category or blueprint,
4
+ * ignoring case. A blank filter matches everything.
5
+ *
6
+ * @param template The template.
7
+ * @param blueprint The blueprint it comes from, or `undefined` for an own template.
8
+ * @param filter What was typed.
9
+ * @returns Whether it matches.
10
+ */
11
+ export declare function templateMatchesFilter(template: ApplicableTemplate, blueprint: string | undefined, filter: string): boolean;
@@ -0,0 +1,38 @@
1
+ import { i as b, n as v, r as k, t as g } from "./toTemplateSources-CN-BMZ39.js";
2
+ import { useMemo as y } from "react";
3
+ import { applicableTemplates as S } from "@cratis/scene.engine";
4
+ import { jsx as m } from "react/jsx-runtime";
5
+ var j = ({ value: o, onChange: i, context: p, disabled: c, id: d }) => {
6
+ const n = p.session?.environment, s = p.session?.screenStrings.properties.templates.picker, t = n?.runtime.bundles, a = n?.runtime.profile, l = n?.templateScope, u = y(() => S({ blueprints: g(t ?? []) }, v({
7
+ bundles: t ?? [],
8
+ profile: a ?? {},
9
+ scope: l
10
+ })), [
11
+ t,
12
+ a,
13
+ l
14
+ ]), e = typeof o == "string" && o !== "" ? o : void 0;
15
+ if (!s) return /* @__PURE__ */ m("output", {
16
+ id: d,
17
+ children: e ?? ""
18
+ });
19
+ const f = t?.flatMap((r) => [...r.screenTemplates ?? [], ...r.dialogTemplates ?? []]).find((r) => r.name === e), T = {
20
+ onChoose: (r) => i(r.name),
21
+ onClear: e ? () => i(void 0) : void 0
22
+ };
23
+ return /* @__PURE__ */ m(k, {
24
+ ariaLabel: s.menu,
25
+ applicable: u,
26
+ current: e ? {
27
+ kind: b.Blueprint,
28
+ id: e
29
+ } : void 0,
30
+ currentLabel: e ? f?.displayName ?? e : void 0,
31
+ labels: s,
32
+ handlers: T,
33
+ disabled: c
34
+ });
35
+ };
36
+ export {
37
+ j as TemplatePropertyEditor
38
+ };