@cratis/event-models 0.337.2 → 0.339.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 (68) hide show
  1. package/dist/screen-editor/{BindingExpressionPropertyEditor-CcIqajvT.js → BindingExpressionPropertyEditor-D63oFTJg.js} +1 -1
  2. package/dist/screen-editor/DataBindingSections-DGWtMxlD.js +1859 -0
  3. package/dist/screen-editor/HookEditors-vV4ycK6R.js +37 -0
  4. package/dist/screen-editor/HookOpensField-Ja5uMCr8.js +231 -0
  5. package/dist/screen-editor/QueryBindingPropertyEditor-QpvyESab.js +148 -0
  6. package/dist/screen-editor/ScreenEditor/Actions/ActionModel.d.ts +3 -1
  7. package/dist/screen-editor/ScreenEditor/Actions/StateChangeSlice.d.ts +4 -0
  8. package/dist/screen-editor/ScreenEditor/Actions/actionBehavior.d.ts +3 -1
  9. package/dist/screen-editor/ScreenEditor/Binding/detailShows.d.ts +18 -0
  10. package/dist/screen-editor/ScreenEditor/Binding/parameterFeeds.d.ts +22 -0
  11. package/dist/screen-editor/ScreenEditor/Binding/queryBindingModel.d.ts +1 -0
  12. package/dist/screen-editor/ScreenEditor/Data/DataField.d.ts +39 -0
  13. package/dist/screen-editor/ScreenEditor/Data/insertDataField.d.ts +29 -0
  14. package/dist/screen-editor/ScreenEditor/Data/queryTables.d.ts +10 -0
  15. package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeFrames.d.ts +3 -1
  16. package/dist/screen-editor/ScreenEditor/DesignMode/DesignModeStrings.d.ts +2 -0
  17. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/OutletStrings.d.ts +74 -0
  18. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/createOutletDesign.d.ts +34 -0
  19. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/outletBindings.d.ts +23 -0
  20. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/outletDesignModes.d.ts +6 -0
  21. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/outletDocument.d.ts +15 -0
  22. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/outletItemOps.d.ts +11 -0
  23. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/screenOutletChain.d.ts +18 -0
  24. package/dist/screen-editor/ScreenEditor/DesignMode/Outlets/screenOutlets.d.ts +44 -0
  25. package/dist/screen-editor/ScreenEditor/DesignMode/designModeTypes.d.ts +19 -2
  26. package/dist/screen-editor/ScreenEditor/DesignMode/resolveDesignMode.d.ts +2 -0
  27. package/dist/screen-editor/ScreenEditor/DesignMode/useDesignMode.d.ts +2 -0
  28. package/dist/screen-editor/ScreenEditor/Forms/fieldChoices.d.ts +14 -0
  29. package/dist/screen-editor/ScreenEditor/Forms/fieldMarkers.d.ts +8 -0
  30. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +22 -0
  31. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +11 -0
  32. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWindow.d.ts +2 -1
  33. package/dist/screen-editor/ScreenEditor/Host/openSubject.d.ts +2 -1
  34. package/dist/screen-editor/ScreenEditor/Inspector/ActionEditor.d.ts +3 -1
  35. package/dist/screen-editor/ScreenEditor/Inspector/CommandFormEditor.d.ts +3 -2
  36. package/dist/screen-editor/ScreenEditor/Inspector/DataBindingSections.d.ts +23 -0
  37. package/dist/screen-editor/ScreenEditor/Inspector/FormEditor.d.ts +3 -2
  38. package/dist/screen-editor/ScreenEditor/Inspector/OutletListEditor.d.ts +11 -0
  39. package/dist/screen-editor/ScreenEditor/Inspector/OutletSection.d.ts +12 -0
  40. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +31 -0
  41. package/dist/screen-editor/ScreenEditor/Inspector/ScreenOutletsSection.d.ts +9 -0
  42. package/dist/screen-editor/ScreenEditor/Palette/PaletteEntry.d.ts +4 -0
  43. package/dist/screen-editor/ScreenEditor/Placement/HookEnabledField.d.ts +14 -0
  44. package/dist/screen-editor/ScreenEditor/Placement/HookOpensField.d.ts +10 -0
  45. package/dist/screen-editor/ScreenEditor/Placement/PlacementStrings.d.ts +32 -0
  46. package/dist/screen-editor/ScreenEditor/Placement/hookBinding.d.ts +28 -0
  47. package/dist/screen-editor/ScreenEditor/Placement/hookPlacement.d.ts +27 -0
  48. package/dist/screen-editor/ScreenEditor/Placement/opensOptions.d.ts +16 -0
  49. package/dist/screen-editor/ScreenEditor/Placement/placementEnvironment.d.ts +12 -0
  50. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +2 -0
  51. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +2 -0
  52. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/HookEditors.d.ts +4 -0
  53. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts +1 -1
  54. package/dist/screen-editor/ScreenEditor/Surface/ScreenSurface.d.ts +1 -1
  55. package/dist/screen-editor/ScreenEditor/Surface/columnAt.d.ts +6 -0
  56. package/dist/screen-editor/ScreenEditor/Surface/useSurfaceDrop.d.ts +1 -1
  57. package/dist/screen-editor/ScreenEditor/Templates/composeEditorScreen.d.ts +5 -1
  58. package/dist/screen-editor/ScreenEditor/Templates/dialogActionsChrome.d.ts +9 -0
  59. package/dist/screen-editor/ScreenEditor/Templates/slotSections.d.ts +1 -0
  60. package/dist/screen-editor/defaultStructuredEditorStrings-Bwbw58wD.js +116 -0
  61. package/dist/screen-editor/hookBinding-DOpu2dMp.js +171 -0
  62. package/dist/screen-editor/index.js +5478 -4935
  63. package/dist/screen-editor/sceneTree-CNx3I3MJ.js +32 -0
  64. package/dist/screen-editor/screen-editor.css +1 -1
  65. package/package.json +3 -3
  66. package/dist/screen-editor/QueryBindingEditor-MTd0R7iQ.js +0 -40
  67. package/dist/screen-editor/QueryBindingPropertyEditor-Cu4PTcOz.js +0 -169
  68. package/dist/screen-editor/defaultStructuredEditorStrings-BPl2XP8A.js +0 -144
@@ -0,0 +1,10 @@
1
+ import type { PlacementEnvironment, HookPlacementInput } from './hookPlacement';
2
+ import type { PlacementStrings } from './PlacementStrings';
3
+ export interface HookOpensFieldProps {
4
+ hook: HookPlacementInput;
5
+ environment: PlacementEnvironment | undefined;
6
+ strings: PlacementStrings;
7
+ disabled?: boolean;
8
+ onChange: (value: string) => void;
9
+ }
10
+ export declare const HookOpensField: ({ hook, environment, strings, disabled, onChange }: HookOpensFieldProps) => import("react").JSX.Element | null;
@@ -0,0 +1,32 @@
1
+ export interface PlacementStrings {
2
+ opens: string;
3
+ enabled: string;
4
+ choices: Record<'automatic' | 'none' | 'dialog' | 'drawer' | 'slot', {
5
+ label: string;
6
+ hint: string;
7
+ }>;
8
+ chipAutomatic: (resolved: string) => string;
9
+ chipNothingFits: string;
10
+ chipSlot: (slot: string) => string;
11
+ chipNotSet: string;
12
+ screenless: string;
13
+ chooseSlice: string;
14
+ slotsHeading: string;
15
+ noSlots: string;
16
+ slotKind: (role: string, routed: boolean) => string;
17
+ slotRoute: (url: string) => string;
18
+ slotPlaceholder: string;
19
+ derivedFrom: string;
20
+ actsOn: string;
21
+ actsOnChoices: Record<'' | 'item' | 'screen', string>;
22
+ condition: string;
23
+ conditionHint: string;
24
+ conditionPlaceholder: string;
25
+ conditionUnreadable: string;
26
+ steps: Record<'subject' | 'authorization' | 'condition', string>;
27
+ alwaysEnabled: string;
28
+ chipForItem: string;
29
+ chipForScreen: string;
30
+ chipWhen: (condition: string) => string;
31
+ }
32
+ export declare const defaultPlacementStrings: PlacementStrings;
@@ -0,0 +1,28 @@
1
+ import { Opens, OutletSubject } from '@cratis/scene.model';
2
+ import { type Enablement } from '@cratis/scene.engine';
3
+ import type { HookPlacementInput, PlacementEnvironment } from './hookPlacement';
4
+ import { type PlacementStrings } from './PlacementStrings';
5
+ export interface HookOpensValue {
6
+ value: string;
7
+ hook: HookPlacementInput;
8
+ }
9
+ export interface HookEnabledValue extends EnabledValue {
10
+ hook: HookPlacementInput;
11
+ outletSubject?: OutletSubject;
12
+ }
13
+ export declare const opensValueOf: (opens: Opens | undefined, opensIn: string | undefined) => string;
14
+ export declare function opensChangeOf(given: unknown): {
15
+ opens?: Opens;
16
+ opensIn?: string;
17
+ } | undefined;
18
+ export interface EnabledValue {
19
+ subject?: OutletSubject;
20
+ enabledWhen?: string;
21
+ }
22
+ export declare function enabledChangeOf(value: unknown): {
23
+ subject?: OutletSubject;
24
+ enabledWhen?: string;
25
+ } | undefined;
26
+ export declare function opensChipText(hook: HookPlacementInput, environment: PlacementEnvironment | undefined, text?: PlacementStrings): string;
27
+ export declare function enabledChipText(hook: HookPlacementInput, outletSubject: OutletSubject | undefined, text?: PlacementStrings): string;
28
+ export declare const whyDisabled: (enablement: Enablement) => string | undefined;
@@ -0,0 +1,27 @@
1
+ import { Opens, OutletSubject, type Layout, type SceneDocument, type ScreenTemplate } from '@cratis/scene.model';
2
+ import { type Enablement, type EnablementPersona, type PlacementDecision, type PlacementInput, type PlacementSlot } from '@cratis/scene.engine';
3
+ import { type StateChangeSlice } from '../Actions/StateChangeSlice';
4
+ export interface PlacementEnvironment {
5
+ slices: readonly StateChangeSlice[];
6
+ slots: readonly PlacementSlot[];
7
+ itemFields: ReadonlySet<string>;
8
+ routeParameters: readonly string[];
9
+ persona?: EnablementPersona;
10
+ }
11
+ export interface HookPlacementInput {
12
+ slice?: string;
13
+ opens?: Opens;
14
+ opensIn?: string;
15
+ subject?: OutletSubject;
16
+ enabledWhen?: string;
17
+ mapping?: Readonly<Record<string, string>>;
18
+ }
19
+ export interface HookInspection {
20
+ slice?: StateChangeSlice;
21
+ screenless: boolean;
22
+ placement?: PlacementDecision;
23
+ enablement: Enablement;
24
+ }
25
+ export declare function placementInputsOf(slice: StateChangeSlice, hook: HookPlacementInput, environment: Pick<PlacementEnvironment, 'itemFields' | 'routeParameters'>): PlacementInput[];
26
+ export declare function inspectHook(hook: HookPlacementInput, environment: PlacementEnvironment): HookInspection;
27
+ export declare function screenPlacementSlots(document: SceneDocument, templates: readonly ScreenTemplate[], layouts: readonly Layout[], screen: string): PlacementSlot[];
@@ -0,0 +1,16 @@
1
+ import { Opens } from '@cratis/scene.model';
2
+ import type { PlacementDecision, PlacementRoute, SlotOption } from '@cratis/scene.engine';
3
+ import { type HookInspection, type HookPlacementInput, type PlacementEnvironment } from './hookPlacement';
4
+ export interface OpensOption {
5
+ value: Opens;
6
+ available: boolean;
7
+ reason: string;
8
+ }
9
+ export interface OpensChoices {
10
+ inspection: HookInspection;
11
+ decision?: PlacementDecision;
12
+ options: readonly OpensOption[];
13
+ slots: readonly SlotOption[];
14
+ }
15
+ export declare const routeText: (route: PlacementRoute) => string;
16
+ export declare function opensChoicesFor(hook: HookPlacementInput, environment: PlacementEnvironment): OpensChoices;
@@ -0,0 +1,12 @@
1
+ import { type Layout, type QueryCandidate, type SceneDocument, type ScreenTemplate } from '@cratis/scene.model';
2
+ import type { StateChangeSlice } from '../Actions/StateChangeSlice';
3
+ import { type PlacementEnvironment } from './hookPlacement';
4
+ export interface PlacementEnvironmentInputs {
5
+ document: SceneDocument;
6
+ screen: string;
7
+ slices: readonly StateChangeSlice[];
8
+ queries: readonly QueryCandidate[];
9
+ templates?: readonly ScreenTemplate[];
10
+ layouts?: readonly Layout[];
11
+ }
12
+ export declare function placementEnvironmentOf({ document, screen, slices, queries, templates, layouts }: PlacementEnvironmentInputs): PlacementEnvironment;
@@ -5,6 +5,7 @@ import type { EffectiveIconCatalog } from '@cratis/scene.engine';
5
5
  import type { IconAdapterRegistry } from '@cratis/scene.react';
6
6
  import type { BindingTypeScope } from '@cratis/scene.engine';
7
7
  import type { StateChangeSlice } from '../../Actions/StateChangeSlice';
8
+ import type { PlacementEnvironment } from '../../Placement/hookPlacement';
8
9
  import type { ScreenEditorController } from '../../Host/ScreenEditorController';
9
10
  import type { ScreenEditorEnvironment } from '../../Host/ScreenEditorHost';
10
11
  import type { ScreenEditorStrings } from '../../Inspector/ScreenEditorStrings';
@@ -37,6 +38,7 @@ export interface EditorSession {
37
38
  copyInheritedItems?: (copy: boolean) => void;
38
39
  }
39
40
  export interface EditorLookups {
41
+ placement?: PlacementEnvironment;
40
42
  stateChangeSlices: readonly StateChangeSlice[];
41
43
  slices: readonly EditorSlice[];
42
44
  destinations: readonly ConfigurationDestination[];
@@ -1,4 +1,6 @@
1
+ import { type PlacementStrings } from '../../Placement/PlacementStrings';
1
2
  export interface PropertyEditorStrings {
3
+ placement: PlacementStrings;
2
4
  readOnly: string;
3
5
  inherited: string;
4
6
  unresolved: string;
@@ -0,0 +1,4 @@
1
+ import type { HookEnabledValue, HookOpensValue } from '../../Placement/hookBinding';
2
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
3
+ export declare const HookOpensEditor: ({ value, onChange, context, disabled }: PropertyEditorProps<HookOpensValue>) => import("react").JSX.Element;
4
+ export declare const HookEnabledEditor: ({ value, onChange, context, disabled }: PropertyEditorProps<HookEnabledValue>) => import("react").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import type { QueryBinding } from '@cratis/scene.model';
2
2
  import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
3
- export declare const QueryBindingPropertyEditor: ({ onChange, context, disabled }: PropertyEditorProps<QueryBinding>) => import("react").JSX.Element | null;
3
+ export declare const QueryBindingPropertyEditor: ({ value, onChange, context, disabled }: PropertyEditorProps<QueryBinding>) => import("react").JSX.Element | null;
@@ -1,5 +1,5 @@
1
1
  import { type BindingResolver } from '@cratis/scene.engine';
2
- import type { EffectiveConfiguration } from '@cratis/scene.model';
2
+ import { type EffectiveConfiguration } from '@cratis/scene.model';
3
3
  import type { ScreenEditorController } from '../Host/ScreenEditorController';
4
4
  import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
5
5
  import type { SurfaceStrings } from './DesignTime/SurfaceStrings';
@@ -0,0 +1,6 @@
1
+ export declare const columnAt: (headerMiddles: readonly number[], pointer: number) => number | undefined;
2
+ export interface TableDrop {
3
+ elementId: string;
4
+ column?: number;
5
+ }
6
+ export declare function tableDropAt(target: EventTarget | null, pointer: number): TableDrop | undefined;
@@ -6,7 +6,7 @@ export interface DragFeedback {
6
6
  drop?: ResolvedDrop;
7
7
  denied: boolean;
8
8
  }
9
- type Controller = Pick<ScreenEditorController, 'insertComponent' | 'insertLayout' | 'ownershipOf' | 'move' | 'validateMove' | 'composition' | 'adapter'>;
9
+ type Controller = Pick<ScreenEditorController, 'insertComponent' | 'insertLayout' | 'insertDataField' | 'ownershipOf' | 'move' | 'validateMove' | 'composition' | 'adapter'>;
10
10
  export declare function useSurfaceDrop(surface: RefObject<HTMLDivElement | null>, measureNow: () => PlacedRegion[], controller: Controller): {
11
11
  feedback: DragFeedback | undefined;
12
12
  draggedId: string | undefined;
@@ -4,7 +4,11 @@ export interface EditorComposition {
4
4
  element: Panel;
5
5
  roots: SceneElement[];
6
6
  own: SceneElement[];
7
+ chrome: SceneElement[];
7
8
  templates: string[];
8
9
  entry?: string;
9
10
  }
10
- export declare function composeEditorScreen(document: SceneDocument, authoredTemplate?: string): EditorComposition;
11
+ export interface EditorCompositionOptions {
12
+ dialogActions?: boolean;
13
+ }
14
+ export declare function composeEditorScreen(document: SceneDocument, authoredTemplate?: string, options?: EditorCompositionOptions): EditorComposition;
@@ -0,0 +1,9 @@
1
+ import { type DialogTemplate, type Layout, type Outlet, type SceneDocument, type SceneElement, type ScreenTemplate } from '@cratis/scene.model';
2
+ export declare const dialogActionsChromeId = "dialog-actions-chrome";
3
+ export declare const defaultDialogTemplateName = "FormDialog";
4
+ export declare function screenFitsDialog(document: SceneDocument): boolean;
5
+ export declare function dialogTemplateOf(document: SceneDocument): DialogTemplate;
6
+ export declare function dialogActionsOutletOf(template: DialogTemplate): Outlet | undefined;
7
+ export declare function showsDialogActions(document: SceneDocument, templates?: readonly ScreenTemplate[], layouts?: readonly Layout[]): boolean;
8
+ export declare function documentWithChrome(document: SceneDocument, chrome: readonly SceneElement[]): SceneDocument;
9
+ export declare function dialogActionsChrome(): SceneElement;
@@ -6,6 +6,7 @@ export declare const slotOfSection: (id: string) => string;
6
6
  export declare const needsSlotSections: (template: ScreenTemplate) => boolean;
7
7
  export declare function slotTargetOf(parentId: string, authoredTemplate: string | undefined): string | undefined;
8
8
  export declare const slotIndexOf: (parentId: string, index: number) => number;
9
+ export declare function slotLabelOf(template: ScreenTemplate, slot: string): string;
9
10
  /**
10
11
  * The slots of a template as the sections they are drawn in.
11
12
  *
@@ -0,0 +1,116 @@
1
+ import { n as c } from "./sceneTree-CNx3I3MJ.js";
2
+ import { BindingMode as p, BindingNullBehavior as l, BindingSourceKind as r, PropertyValueType as o } from "@cratis/scene.model";
3
+ import { elementNodeId as m, inspect as v } from "@cratis/scene.engine";
4
+ function C(e, t, s, i, d) {
5
+ const a = c(t).map((n) => y(e, n, s)).filter((n) => !!n && n.outputs.length > 0);
6
+ return {
7
+ dataContextPaths: Object.keys(i).sort((n, u) => n.localeCompare(u)),
8
+ queryResults: d.map((n) => ({
9
+ id: n.id,
10
+ name: n.name,
11
+ fields: n.resultFields.map((u) => u.name)
12
+ })),
13
+ componentOutputs: a
14
+ };
15
+ }
16
+ function y(e, t, s) {
17
+ const i = v(e, m(t), s);
18
+ if (!i) return;
19
+ const d = i.properties.filter((a) => a.descriptor.output === !0).map((a) => ({
20
+ path: a.descriptor.path,
21
+ label: a.descriptor.label,
22
+ type: String(a.descriptor.valueType)
23
+ }));
24
+ return {
25
+ componentId: t,
26
+ label: i.label,
27
+ outputs: d
28
+ };
29
+ }
30
+ var g = [
31
+ r.DataContext,
32
+ r.QueryResult,
33
+ r.ComponentProperty,
34
+ r.Literal,
35
+ r.CommandResponse
36
+ ], T = [
37
+ r.DataContext,
38
+ r.QueryResult,
39
+ r.ComponentProperty,
40
+ r.Literal
41
+ ], w = [p.OneWay, p.TwoWay], x = [
42
+ l.Propagate,
43
+ l.Clear,
44
+ l.Preserve
45
+ ], B = [
46
+ o.String,
47
+ o.Number,
48
+ o.Boolean,
49
+ o.Enum,
50
+ o.Icon,
51
+ o.Destination,
52
+ o.QueryReference,
53
+ o.Collection,
54
+ o.Object,
55
+ o.Json
56
+ ];
57
+ function f(e) {
58
+ const t = e;
59
+ return !!t && typeof t == "object" && typeof t.path == "string" && (t.kind === void 0 || g.includes(t.kind));
60
+ }
61
+ function E(e) {
62
+ return (e.descriptor.acceptedBindingKinds?.length ?? 0) > 0 || f(e.effectiveValue);
63
+ }
64
+ function M(e) {
65
+ return {
66
+ kind: e.descriptor.acceptedBindingKinds?.[0] ?? r.DataContext,
67
+ path: "",
68
+ mode: e.descriptor.bindingMode,
69
+ expectedValueType: e.descriptor.valueType
70
+ };
71
+ }
72
+ var N = {
73
+ unset: "Not set",
74
+ item: "Item",
75
+ itemTitle: (e, t) => `${e} ${t}`,
76
+ add: (e) => `Add ${e.toLowerCase()}`,
77
+ remove: (e, t) => `Remove ${e.toLowerCase()} ${t}`,
78
+ removeText: "Remove",
79
+ moveUp: (e, t) => `Move ${e.toLowerCase()} ${t} up`,
80
+ moveUpText: "Up",
81
+ moveDown: (e, t) => `Move ${e.toLowerCase()} ${t} down`,
82
+ moveDownText: "Down",
83
+ entry: (e) => `Entry ${e}`,
84
+ moveEntryUp: (e) => `Move entry ${e} up`,
85
+ moveEntryDown: (e) => `Move entry ${e} down`,
86
+ removeEntry: (e) => `Remove entry ${e}`,
87
+ addEntry: "Add entry",
88
+ useList: "Use a list",
89
+ useSingle: "Use one value",
90
+ scalarType: "Type",
91
+ scalarText: "Text",
92
+ scalarNumber: "Number",
93
+ scalarFlag: "Yes or no",
94
+ scalarFlagOn: "Yes",
95
+ mapName: (e) => `Name ${e}`,
96
+ mapValue: (e) => `Value of ${e}`,
97
+ addMapEntry: "Add value",
98
+ removeMapEntry: (e) => `Remove ${e}`,
99
+ keptValue: "A structured value, kept as it is.",
100
+ mismatch: (e, t) => `The saved value of '${e}' does not fit what it is described as: ${t}.`,
101
+ convert: "Give its items identifiers",
102
+ clear: "Clear the value",
103
+ noEditor: (e) => `'${e}' has no editor: nothing describes what it holds, so it cannot be edited here.`
104
+ };
105
+ export {
106
+ T as a,
107
+ f as c,
108
+ x as i,
109
+ E as l,
110
+ g as n,
111
+ M as o,
112
+ w as r,
113
+ B as s,
114
+ N as t,
115
+ C as u
116
+ };
@@ -0,0 +1,171 @@
1
+ import { Opens as a, OutletSubject as c } from "@cratis/scene.model";
2
+ import { InputSourceKind as d, argumentSourceKind as p, placementSlotsOf as h, resolveEnablement as m, resolvePlacement as f } from "@cratis/scene.engine";
3
+ var b = (e) => e.commandName ?? e.name;
4
+ function v(e, t) {
5
+ if (typeof t != "string" || t === "") return;
6
+ const n = e.find((s) => s.id === t);
7
+ if (n) return n;
8
+ const i = e.filter((s) => b(s) === t);
9
+ return i.length === 1 ? i[0] : void 0;
10
+ }
11
+ function S(e, t, n) {
12
+ return e.inputs.map((i) => {
13
+ const s = t.mapping ? p(t.mapping[i.name]) : t.subject === c.Item && n.itemFields.has(i.name) ? d.DataContext : n.routeParameters.includes(i.name) ? d.Route : void 0;
14
+ return s === void 0 ? { name: i.name } : {
15
+ name: i.name,
16
+ source: s
17
+ };
18
+ });
19
+ }
20
+ function g(e, t) {
21
+ const n = e.slice === void 0 ? void 0 : v(t.slices, e.slice), i = m({
22
+ ...e.subject ? { subject: e.subject } : {},
23
+ ...n?.authorize ? { authorize: n.authorize } : {},
24
+ ...t.persona ? { persona: t.persona } : {},
25
+ ...e.enabledWhen ? { enabledWhen: e.enabledWhen } : {}
26
+ });
27
+ if (!n) return {
28
+ screenless: !1,
29
+ enablement: i
30
+ };
31
+ const s = f({
32
+ slice: n.id,
33
+ ...e.opens ? { opens: e.opens } : {},
34
+ ...e.opensIn ? { opensIn: e.opensIn } : {},
35
+ ...n.screenless ? {} : { screen: n.name },
36
+ ...n.fits ? { fits: [...n.fits] } : {},
37
+ inputs: S(n, e, t),
38
+ slots: [...t.slots]
39
+ });
40
+ return {
41
+ slice: n,
42
+ screenless: n.screenless === !0,
43
+ placement: s,
44
+ enablement: i
45
+ };
46
+ }
47
+ var O = (e, t, n, i) => {
48
+ const s = e.screens.find((o) => o.name === i) ?? e.screens[0], l = Object.entries(s?.slotContent ?? {}).filter(([, o]) => o.length > 0).map(([o]) => o), r = s?.screenTemplate ? e.screenTemplates.find((o) => o.name === s.screenTemplate) ?? t.find((o) => o.name === s.screenTemplate) : void 0;
49
+ return r ? {
50
+ slots: r.slots,
51
+ filled: l
52
+ } : {
53
+ slots: (s ? e.layouts.find((o) => o.name === s.layout) ?? n.find((o) => o.name === s.layout) : void 0)?.slots ?? [],
54
+ filled: l
55
+ };
56
+ };
57
+ function j(e, t, n, i) {
58
+ const { slots: s, filled: l } = O(e, t, n, i);
59
+ return h(s, l);
60
+ }
61
+ var u = {
62
+ opens: "Opens",
63
+ enabled: "Enabled",
64
+ choices: {
65
+ automatic: {
66
+ label: "Automatic",
67
+ hint: "The slice's first fit that the page has free."
68
+ },
69
+ none: {
70
+ label: "Run directly",
71
+ hint: "Issues the command without asking."
72
+ },
73
+ dialog: {
74
+ label: "Dialog",
75
+ hint: "Opens the slice’s screen over the page."
76
+ },
77
+ drawer: {
78
+ label: "Drawer",
79
+ hint: "Opens the slice’s screen in a drawer beside the page."
80
+ },
81
+ slot: {
82
+ label: "In a slot",
83
+ hint: "Opens the slice’s screen in a slot of the page."
84
+ }
85
+ },
86
+ chipAutomatic: (e) => `Automatic · ${e}`,
87
+ chipNothingFits: "Automatic · nothing fits",
88
+ chipSlot: (e) => `In ${e}`,
89
+ chipNotSet: "Choose a slice",
90
+ screenless: "This slice has no screen, so it can only run directly.",
91
+ chooseSlice: "Choose a slice first: where it opens depends on what it fits and needs.",
92
+ slotsHeading: "Slots of this page",
93
+ noSlots: "The page has no slots a slice could be put in.",
94
+ slotKind: (e, t) => t ? `${e}, routed` : e,
95
+ slotRoute: (e) => `Opening here changes the URL to ${e}`,
96
+ slotPlaceholder: "Choose a slot",
97
+ derivedFrom: "Enabled, worked out from",
98
+ actsOn: "Acts on",
99
+ actsOnChoices: {
100
+ "": "What the outlet says",
101
+ item: "A selected item",
102
+ screen: "The screen"
103
+ },
104
+ condition: "Enabled when",
105
+ conditionHint: 'Compare what the selected item has, such as item.status == "onSale"; join with and / or.',
106
+ conditionPlaceholder: 'item.status == "onSale"',
107
+ conditionUnreadable: "Scene cannot read this condition, so it will not be saved.",
108
+ steps: {
109
+ subject: "Subject",
110
+ authorization: "Authorization",
111
+ condition: "Condition"
112
+ },
113
+ alwaysEnabled: "Always",
114
+ chipForItem: "For item",
115
+ chipForScreen: "For screen",
116
+ chipWhen: (e) => `when ${e}`
117
+ }, w = (e, t) => e === a.Slot ? t ? `slot:${t}` : "slot" : e ?? a.Automatic;
118
+ function A(e) {
119
+ const t = typeof e == "object" && e !== null && "value" in e ? e.value : e;
120
+ if (t == null || t === "" || t === a.Automatic) return {
121
+ opens: void 0,
122
+ opensIn: void 0
123
+ };
124
+ if (typeof t == "string")
125
+ return t === a.Slot ? {
126
+ opens: a.Slot,
127
+ opensIn: void 0
128
+ } : t.startsWith("slot:") ? {
129
+ opens: a.Slot,
130
+ opensIn: t.slice(5) || void 0
131
+ } : Object.values(a).includes(t) ? {
132
+ opens: t,
133
+ opensIn: void 0
134
+ } : void 0;
135
+ }
136
+ function C(e) {
137
+ if (e == null) return {
138
+ subject: void 0,
139
+ enabledWhen: void 0
140
+ };
141
+ if (typeof e != "object") return;
142
+ const { subject: t, enabledWhen: n } = e;
143
+ return {
144
+ subject: t === c.Item || t === c.Screen ? t : void 0,
145
+ enabledWhen: typeof n == "string" && n.trim() !== "" ? n.trim() : void 0
146
+ };
147
+ }
148
+ function W(e, t, n = u) {
149
+ const i = (l) => n.choices[l ?? a.Automatic]?.label ?? String(l);
150
+ if (e.opens === a.Slot) return n.chipSlot(e.opensIn ?? n.choices.slot.label);
151
+ if (e.opens !== void 0 && e.opens !== a.Automatic) return i(e.opens);
152
+ if (!t || !e.slice) return i(a.Automatic);
153
+ const s = g(e, t).placement;
154
+ return s ? s.resolved === void 0 ? n.chipNothingFits : n.chipAutomatic(s.resolved === a.Slot ? n.chipSlot(s.slot ?? "") : i(s.resolved)) : i(a.Automatic);
155
+ }
156
+ function T(e, t, n = u) {
157
+ const i = [...(e.subject ?? t) === c.Item ? [n.chipForItem] : [], ...e.enabledWhen ? [n.chipWhen(e.enabledWhen)] : []];
158
+ return i.length > 0 ? i.join(" · ") : n.alwaysEnabled;
159
+ }
160
+ export {
161
+ w as a,
162
+ j as c,
163
+ W as i,
164
+ b as l,
165
+ T as n,
166
+ u as o,
167
+ A as r,
168
+ g as s,
169
+ C as t,
170
+ v as u
171
+ };