@cratis/event-models 0.175.0 → 0.177.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/screen-editor/BindingExpressionPropertyEditor-DbYpy_bX.js +426 -0
  2. package/dist/screen-editor/BooleanEditor-eC1yCpz0.js +17 -0
  3. package/dist/screen-editor/CollectionEditor-C7eX8Hw7.js +320 -0
  4. package/dist/screen-editor/ColorEditor-Cc6Xq8pW.js +49 -0
  5. package/dist/screen-editor/ColumnListEditor-Cku6GGLp.js +103 -0
  6. package/dist/screen-editor/EnumEditor-DNnnf9i3.js +26 -0
  7. package/dist/screen-editor/FieldEditor-SquvComm.js +66 -0
  8. package/dist/screen-editor/FieldListEditor-CNxskXPf.js +56 -0
  9. package/dist/screen-editor/IconEditor-C0ibqn-e.js +22 -0
  10. package/dist/screen-editor/InheritanceModeEditor-CtdsACnc.js +65 -0
  11. package/dist/screen-editor/ListEditor-CfFPVVJ4.js +53 -0
  12. package/dist/screen-editor/NavigationTargetEditor-DGnW5pVF.js +41 -0
  13. package/dist/screen-editor/NumberEditor-Cyo9_23Z.js +48 -0
  14. package/dist/screen-editor/QueryBindingEditor-3C_utVJm.js +17 -0
  15. package/dist/screen-editor/QueryBindingPropertyEditor-DLlC-slh.js +169 -0
  16. package/dist/screen-editor/ReferenceEditor-BnI2Qd7H.js +32 -0
  17. package/dist/screen-editor/ReferenceTargetEditors-COKAWO5q.js +19 -0
  18. package/dist/screen-editor/RenderingSlotEditor-Cani_PtT.js +128 -0
  19. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +9 -0
  20. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorOverlay.d.ts +1 -1
  21. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWorkspace.d.ts +1 -1
  22. package/dist/screen-editor/ScreenEditor/Host/useScreenEditor.d.ts +2 -1
  23. package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +1 -3
  24. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +5 -4
  25. package/dist/screen-editor/ScreenEditor/Palette/ComponentPicker.d.ts +21 -0
  26. package/dist/screen-editor/ScreenEditor/Palette/PaletteFolders.d.ts +12 -4
  27. package/dist/screen-editor/ScreenEditor/Palette/buildPalette.d.ts +2 -9
  28. package/dist/screen-editor/ScreenEditor/Palette/componentPickerModel.d.ts +54 -0
  29. package/dist/screen-editor/ScreenEditor/Palette/componentPickerStorage.d.ts +15 -0
  30. package/dist/screen-editor/ScreenEditor/Palette/useComponentPalette.d.ts +18 -0
  31. package/dist/screen-editor/ScreenEditor/Properties/choiceKeys.d.ts +9 -0
  32. package/dist/screen-editor/ScreenEditor/Properties/toPropertyGroups.d.ts +6 -7
  33. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/BooleanEditor.d.ts +2 -0
  34. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ColorEditor.d.ts +2 -0
  35. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/EnumEditor.d.ts +2 -0
  36. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/IconEditor.d.ts +3 -0
  37. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ListEditor.d.ts +2 -0
  38. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/NumberEditor.d.ts +2 -0
  39. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ReferenceEditor.d.ts +2 -0
  40. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/SelectEditor.d.ts +2 -0
  41. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/TextEditor.d.ts +2 -0
  42. package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/draftProblem.d.ts +3 -0
  43. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +13 -0
  44. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +91 -0
  45. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorRegistry.d.ts +24 -0
  46. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +73 -0
  47. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +26 -0
  48. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +20 -0
  49. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createPropertyEditorRegistry.d.ts +2 -0
  50. package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/screenEditorPropertyEditors.d.ts +1 -0
  51. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/BindingExpressionPropertyEditor.d.ts +3 -0
  52. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/CollectionEditor.d.ts +2 -0
  53. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ColumnListEditor.d.ts +2 -0
  54. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldEditor.d.ts +23 -0
  55. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldListEditor.d.ts +2 -0
  56. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/InheritanceModeEditor.d.ts +4 -0
  57. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationTargetEditor.d.ts +2 -0
  58. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/OrderedItemsEditor.d.ts +2 -0
  59. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts +3 -0
  60. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +3 -0
  61. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/RenderingSlotEditor.d.ts +8 -0
  62. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +5 -0
  63. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StateChangeEditors.d.ts +2 -0
  64. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StructuredPropertyEditor.d.ts +2 -0
  65. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SummaryEditor.d.ts +2 -0
  66. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/UndescribedEditor.d.ts +2 -0
  67. package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/fieldKind.d.ts +1 -0
  68. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/index.d.ts +0 -3
  69. package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +109 -0
  70. package/dist/screen-editor/SelectEditor-BuQPlIyf.js +26 -0
  71. package/dist/screen-editor/SliceEditor-Dle8OlsB.js +45 -0
  72. package/dist/screen-editor/StateChangeEditors-9k3Gqtc0.js +15 -0
  73. package/dist/screen-editor/StructuredPropertyEditor-B3lVjrHZ.js +13 -0
  74. package/dist/screen-editor/StructuredValueEditor-CcwyOga0.js +337 -0
  75. package/dist/screen-editor/SummaryEditor-C5wP1uIH.js +23 -0
  76. package/dist/screen-editor/TextEditor-BEH-9K1S.js +40 -0
  77. package/dist/screen-editor/UndescribedEditor-Cqs6bHhD.js +10 -0
  78. package/dist/screen-editor/allowedIconChoices-DBgeRdGI.js +138 -0
  79. package/dist/screen-editor/choiceKeys-DQcUX97p.js +17 -0
  80. package/dist/screen-editor/defaultStructuredEditorStrings-Ch1I0Lci.js +137 -0
  81. package/dist/screen-editor/draftProblem-BGC5Gfsv.js +12 -0
  82. package/dist/screen-editor/iconDiagnostics-Ds4CnqD0.js +49 -0
  83. package/dist/screen-editor/index.js +3395 -4482
  84. package/dist/screen-editor/screen-editor.css +1 -1
  85. package/dist/screen-editor/structuredValue-vqCZttsk.js +61 -0
  86. package/package.json +12 -12
  87. package/dist/screen-editor/ScreenEditor/Inspector/IconProperties.d.ts +0 -14
  88. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/StructuredProperties.d.ts +0 -9
  89. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/UndescribedProperties.d.ts +0 -7
  90. package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/classifyStructures.d.ts +0 -6
@@ -0,0 +1,21 @@
1
+ import { type PickerEntry } from './componentPickerModel';
2
+ import type { ComponentPickerMemory } from './componentPickerStorage';
3
+ export interface ComponentPickerStrings {
4
+ heading: string;
5
+ filterPlaceholder: string;
6
+ filterLabel: string;
7
+ frequentlyUsed: string;
8
+ groupsHint: string;
9
+ nothingMatches: string;
10
+ viaKeyword: (badge: string, query: string, keyword: string) => string;
11
+ addLabel: (component: string) => string;
12
+ }
13
+ export declare const defaultComponentPickerStrings: ComponentPickerStrings;
14
+ export interface ComponentPickerProps {
15
+ entries: readonly PickerEntry[];
16
+ memory: ComponentPickerMemory;
17
+ strings?: ComponentPickerStrings;
18
+ onAdd: (entry: PickerEntry) => void;
19
+ usageVersion?: number;
20
+ }
21
+ export declare const ComponentPicker: ({ entries, memory, strings, onAdd, usageVersion }: ComponentPickerProps) => import("react").JSX.Element;
@@ -1,7 +1,15 @@
1
- import type { PaletteDrawer } from './buildPalette';
1
+ import type { ReactNode } from 'react';
2
+ import { type ComponentPickerStrings } from './ComponentPicker';
3
+ import type { PickerEntry } from './componentPickerModel';
4
+ import type { ComponentPickerMemory } from './componentPickerStorage';
2
5
  export interface PaletteFoldersProps {
3
- drawers: readonly PaletteDrawer[];
6
+ entries: readonly PickerEntry[];
7
+ memory: ComponentPickerMemory;
8
+ icon: ReactNode;
9
+ title: string;
4
10
  closeLabel: string;
5
- onActivate: (payload: unknown) => void;
11
+ strings?: ComponentPickerStrings;
12
+ usageVersion: number;
13
+ onAdd: (entry: PickerEntry) => void;
6
14
  }
7
- export declare const PaletteFolders: ({ drawers, closeLabel, onActivate }: PaletteFoldersProps) => import("react").JSX.Element;
15
+ export declare const PaletteFolders: ({ entries, memory, icon, title, closeLabel, strings, usageVersion, onAdd }: PaletteFoldersProps) => import("react").JSX.Element;
@@ -1,16 +1,10 @@
1
- import type { ToolbarDrawerItem } from '@cratis/components/Toolbar';
1
+ import type { ComponentDescriptor } from '@cratis/scene.model';
2
2
  import type { ReactNode } from 'react';
3
- import type { LayoutLabels } from '../Layouts/toLayoutContainerDescriptors';
4
3
  import type { LayoutItem } from '../Layouts/LayoutItem';
5
- export interface PaletteDrawer {
6
- id: string;
7
- title: string;
8
- icon: ReactNode;
9
- items: ToolbarDrawerItem[];
10
- }
11
4
  export interface PaletteSource {
12
5
  package: string;
13
6
  components: readonly string[];
7
+ descriptors?: readonly ComponentDescriptor[];
14
8
  }
15
9
  export interface PaletteIcons {
16
10
  layout: (item: LayoutItem) => ReactNode;
@@ -20,4 +14,3 @@ export interface PaletteIcons {
20
14
  package: (packageName: string) => ReactNode;
21
15
  };
22
16
  }
23
- export declare function buildPalette(layoutTitle: string, labels: LayoutLabels, icons: PaletteIcons, sources: readonly PaletteSource[], packageTitles?: Readonly<Record<string, string>>): PaletteDrawer[];
@@ -0,0 +1,54 @@
1
+ import { type ComponentQueryMatch, type ComponentUsage } from '@cratis/scene.engine';
2
+ import { type ComponentDescriptor } from '@cratis/scene.model';
3
+ import type { PalettePayload } from './PaletteEntry';
4
+ export interface PickerEntry {
5
+ key: string;
6
+ label: string;
7
+ badge: string;
8
+ category: string;
9
+ keywords: readonly string[];
10
+ package?: string;
11
+ packageTitle?: string;
12
+ payload: PalettePayload;
13
+ }
14
+ export interface PickerSource {
15
+ package: string;
16
+ components: readonly string[];
17
+ descriptors?: readonly ComponentDescriptor[];
18
+ }
19
+ export interface PickerLayout {
20
+ item: string;
21
+ label: string;
22
+ }
23
+ export declare const uncategorised = "Other";
24
+ export declare const layoutCategory: "Layout";
25
+ export declare function buildPickerEntries(sources: readonly PickerSource[], layouts: readonly PickerLayout[], packageTitles?: Readonly<Record<string, string>>): PickerEntry[];
26
+ export interface PickerRow {
27
+ entry: PickerEntry;
28
+ match: ComponentQueryMatch;
29
+ }
30
+ export interface PickerGroup {
31
+ id: string;
32
+ title: string;
33
+ frequent: boolean;
34
+ count: number;
35
+ expanded: boolean;
36
+ rows: PickerRow[];
37
+ }
38
+ export interface PickerViewInputs {
39
+ entries: readonly PickerEntry[];
40
+ usage: Readonly<Record<string, ComponentUsage>>;
41
+ query: string;
42
+ groups: Readonly<Record<string, boolean>>;
43
+ frequentTitle: string;
44
+ }
45
+ export declare const frequentGroupId = "frequent";
46
+ export declare function buildPickerView({ entries, usage, query, groups, frequentTitle }: PickerViewInputs): PickerGroup[];
47
+ export declare const visibleRows: (view: readonly PickerGroup[]) => {
48
+ group: PickerGroup;
49
+ row: PickerRow;
50
+ }[];
51
+ export declare function highlightParts(text: string, ranges: readonly [number, number][]): {
52
+ text: string;
53
+ marked: boolean;
54
+ }[];
@@ -0,0 +1,15 @@
1
+ import { type ComponentUsage } from '@cratis/scene.engine';
2
+ export declare const componentUsageKey = "cratis.studio.componentUsage.v1";
3
+ export declare const componentGroupsKey = "cratis.studio.componentGroups.v1";
4
+ export interface ComponentPickerStorage {
5
+ getItem(key: string): string | null;
6
+ setItem(key: string, value: string): void;
7
+ }
8
+ export interface ComponentPickerMemory {
9
+ readUsage(): Record<string, ComponentUsage>;
10
+ recordAdded(key: string, now?: number): Record<string, ComponentUsage>;
11
+ readGroups(): Record<string, boolean>;
12
+ writeGroups(groups: Readonly<Record<string, boolean>>): void;
13
+ }
14
+ export declare const browserComponentPickerStorage: () => ComponentPickerStorage | undefined;
15
+ export declare function createComponentPickerMemory(storage?: ComponentPickerStorage | undefined, userId?: string): ComponentPickerMemory;
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { LayoutLabels } from '../Layouts/toLayoutContainerDescriptors';
3
+ import type { ScreenEditorStrings } from '../Inspector/ScreenEditorStrings';
4
+ import type { PaletteIcons, PaletteSource } from './buildPalette';
5
+ import { type PickerEntry } from './componentPickerModel';
6
+ import { type ComponentPickerMemory } from './componentPickerStorage';
7
+ export interface ComponentPaletteInputs {
8
+ strings: ScreenEditorStrings;
9
+ layoutLabels: LayoutLabels;
10
+ icons: PaletteIcons;
11
+ paletteSources: readonly PaletteSource[];
12
+ onAdd: (entry: PickerEntry) => void;
13
+ memory?: ComponentPickerMemory;
14
+ }
15
+ export declare function useComponentPalette({ strings, layoutLabels, icons, paletteSources, onAdd, memory: given }: ComponentPaletteInputs): {
16
+ palette: ReactNode;
17
+ recordInserted: (key: string) => void;
18
+ };
@@ -4,3 +4,12 @@ export declare const selectedChoiceKey: (value: unknown) => string;
4
4
  export declare function choiceValueOf(property: InspectedProperty, key: unknown): {
5
5
  value: unknown;
6
6
  } | undefined;
7
+ export interface ChoiceOption {
8
+ key: string;
9
+ label: string;
10
+ value: unknown;
11
+ }
12
+ export declare function choiceOptions(choices: readonly {
13
+ value: unknown;
14
+ label: string;
15
+ }[], stored: unknown): ChoiceOption[];
@@ -1,9 +1,8 @@
1
1
  import { type InspectedProperty } from '@cratis/scene.model';
2
- import type { PropertyDescriptor as ControlDescriptor, PropertyGroup } from '@cratis/components/ConfigurationEditor';
3
- export declare const isSimpleProperty: (property: InspectedProperty) => boolean;
4
2
  export declare const isDrawnByItsOwnEditor: (typeId: string, path: string) => boolean;
5
- export declare function toControlDescriptor(property: InspectedProperty): ControlDescriptor;
6
- export declare function toPropertyGroups(properties: readonly InspectedProperty[], typeId?: string): {
7
- groups: PropertyGroup[];
8
- values: Record<string, unknown>;
9
- };
3
+ export declare const editableProperties: (properties: readonly InspectedProperty[], typeId: string, isDrawnElsewhere?: (property: InspectedProperty) => boolean) => InspectedProperty[];
4
+ export interface PropertyGroup {
5
+ name: string;
6
+ properties: InspectedProperty[];
7
+ }
8
+ export declare function groupProperties(properties: readonly InspectedProperty[]): PropertyGroup[];
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const BooleanEditor: ({ value, onChange, descriptor, disabled, id }: PropertyEditorProps<boolean>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const ColorEditor: ({ value, onChange, descriptor, context, disabled, id }: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const EnumEditor: ({ value, onChange, descriptor, disabled, id }: PropertyEditorProps<unknown>) => import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { type IconReference } from '@cratis/scene.model';
2
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
3
+ export declare const IconEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<IconReference>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const ListEditor: ({ value, onChange, descriptor, context, disabled, id }: PropertyEditorProps<unknown[]>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const NumberEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<number>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const ReferenceEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const SelectEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<unknown>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const TextEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { PropertyDescriptor } from '@cratis/scene.model';
2
+ import type { EditorProblem } from '../Registry/PropertyEditorProps';
3
+ export declare function draftProblem(descriptor: PropertyDescriptor, value: unknown): EditorProblem | undefined;
@@ -0,0 +1,13 @@
1
+ import type { InspectedProperty, SceneDiagnostic } from '@cratis/scene.model';
2
+ import type { EditorContext, EditorProblem } from './PropertyEditorProps';
3
+ import type { PropertyEditorRegistry } from './PropertyEditorRegistry';
4
+ export interface PropertyEditorHostProps {
5
+ registry: PropertyEditorRegistry;
6
+ property: InspectedProperty;
7
+ context: EditorContext;
8
+ componentId: string;
9
+ onChange: (property: InspectedProperty, value: unknown) => void;
10
+ diagnostics: readonly SceneDiagnostic[];
11
+ }
12
+ export declare const PropertyEditorHost: ({ registry, property, context, componentId, onChange, diagnostics }: PropertyEditorHostProps) => import("react").JSX.Element;
13
+ export declare function problemOf(property: InspectedProperty, diagnostics: readonly SceneDiagnostic[]): EditorProblem | undefined;
@@ -0,0 +1,91 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { ConfigurationDestination } from '@cratis/components/ConfigurationEditor';
3
+ import type { InspectedProperty, PropertyDescriptor, QueryCandidate, QueryResultField, SceneDiagnostic, SceneDocument } from '@cratis/scene.model';
4
+ import type { EffectiveIconCatalog } from '@cratis/scene.engine';
5
+ import type { IconAdapterRegistry } from '@cratis/scene.react';
6
+ import type { BindingTypeScope } from '@cratis/scene.engine';
7
+ import type { StateChangeSlice } from '../../Actions/StateChangeSlice';
8
+ import type { ScreenEditorController } from '../../Host/ScreenEditorController';
9
+ import type { ScreenEditorEnvironment } from '../../Host/ScreenEditorHost';
10
+ import type { ScreenEditorStrings } from '../../Inspector/ScreenEditorStrings';
11
+ import type { Ownership } from '../../Structure/Ownership';
12
+ import type { StructuredEditorStrings } from '../Structured/StructuredEditorStrings';
13
+ import type { PropertyEditorStrings } from './PropertyEditorStrings';
14
+ import type { IconPropertyFieldStrings } from '../../../Icons/IconPropertyFieldStrings';
15
+ export interface EditorContext {
16
+ model: SceneDocument;
17
+ selection?: {
18
+ id: string;
19
+ component: string;
20
+ properties: Readonly<Record<string, unknown>>;
21
+ };
22
+ level: 'screen' | 'template';
23
+ structure: {
24
+ ownership?: Ownership;
25
+ onCanvas: boolean;
26
+ };
27
+ lookups: EditorLookups;
28
+ strings: EditorStrings;
29
+ session?: EditorSession;
30
+ }
31
+ export interface EditorSession {
32
+ controller: ScreenEditorController;
33
+ environment: ScreenEditorEnvironment;
34
+ property: InspectedProperty;
35
+ bindingScope: BindingTypeScope;
36
+ screenStrings: ScreenEditorStrings;
37
+ copyInheritedItems?: (copy: boolean) => void;
38
+ }
39
+ export interface EditorLookups {
40
+ stateChangeSlices: readonly StateChangeSlice[];
41
+ slices: readonly EditorSlice[];
42
+ destinations: readonly ConfigurationDestination[];
43
+ slots: readonly string[];
44
+ queryCandidates: readonly QueryCandidate[];
45
+ availableSources: Readonly<Record<string, string>>;
46
+ fields: readonly QueryResultField[];
47
+ colorTokens: readonly ColorToken[];
48
+ icons: {
49
+ catalog: EffectiveIconCatalog;
50
+ adapters: IconAdapterRegistry;
51
+ diagnostics: readonly SceneDiagnostic[];
52
+ };
53
+ references: (target: string) => readonly EditorReference[];
54
+ }
55
+ export interface EditorSlice {
56
+ id: string;
57
+ name: string;
58
+ kind: string;
59
+ path: readonly string[];
60
+ }
61
+ export interface ColorToken {
62
+ name: string;
63
+ label: string;
64
+ value?: string;
65
+ }
66
+ export interface EditorReference {
67
+ id: string;
68
+ label: string;
69
+ group?: string;
70
+ }
71
+ export interface EditorStrings {
72
+ editors: PropertyEditorStrings;
73
+ structured: StructuredEditorStrings;
74
+ icon: IconPropertyFieldStrings;
75
+ iconPicker: Record<string, string>;
76
+ }
77
+ export interface PropertyEditorProps<T = unknown> {
78
+ value: T | undefined;
79
+ onChange: (value: T | undefined) => void;
80
+ descriptor: PropertyDescriptor;
81
+ context: EditorContext;
82
+ disabled?: boolean;
83
+ readOnlyReason?: string;
84
+ problem?: EditorProblem;
85
+ id: string;
86
+ }
87
+ export interface EditorProblem {
88
+ code: string;
89
+ message: string;
90
+ }
91
+ export type PropertyEditor<T = unknown> = ComponentType<PropertyEditorProps<T>>;
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type PropertyDescriptor } from '@cratis/scene.model';
3
+ import type { PropertyEditor } from './PropertyEditorProps';
4
+ export type PropertyEditorLoader = () => Promise<(props: never) => ReactNode>;
5
+ export type EditorResolutionTier = 'kind' | 'package' | 'default';
6
+ export interface EditorResolution {
7
+ id: string;
8
+ tier: EditorResolutionTier;
9
+ }
10
+ export interface ResolveOptions {
11
+ packageEditor?: boolean;
12
+ }
13
+ export declare const maximumChipChoices = 4;
14
+ export declare function defaultEditorId(descriptor: PropertyDescriptor): string | undefined;
15
+ export declare class PropertyEditorRegistry {
16
+ #private;
17
+ register(id: string, loader: PropertyEditorLoader): this;
18
+ loadedOf(id: string): PropertyEditor<unknown> | undefined;
19
+ load(id: string): Promise<PropertyEditor<unknown>>;
20
+ has(id: string): boolean;
21
+ get ids(): readonly string[];
22
+ loaderOf(id: string): PropertyEditorLoader | undefined;
23
+ resolve(descriptor: PropertyDescriptor, options?: ResolveOptions): EditorResolution | undefined;
24
+ }
@@ -0,0 +1,73 @@
1
+ export interface PropertyEditorStrings {
2
+ readOnly: string;
3
+ inherited: string;
4
+ unresolved: string;
5
+ undescribed: (label: string) => string;
6
+ cannotLoad: (label: string) => string;
7
+ loading: string;
8
+ select: {
9
+ placeholder: string;
10
+ search: string;
11
+ empty: string;
12
+ clear: string;
13
+ notAvailable: (kind: string) => string;
14
+ };
15
+ text: {
16
+ placeholder: string;
17
+ };
18
+ number: {
19
+ invalid: string;
20
+ };
21
+ color: {
22
+ tokens: string;
23
+ custom: string;
24
+ clear: string;
25
+ hex: string;
26
+ };
27
+ list: {
28
+ add: string;
29
+ remove: string;
30
+ moveUp: string;
31
+ moveDown: string;
32
+ };
33
+ navigationTarget: {
34
+ placeholder: string;
35
+ unresolved: (target: string) => string;
36
+ };
37
+ renderingSlot: {
38
+ none: string;
39
+ diagram: (slot: string) => string;
40
+ };
41
+ slice: {
42
+ placeholder: string;
43
+ notKind: (kind: string) => string;
44
+ };
45
+ inheritanceMode: {
46
+ modes: Record<'inherit' | 'extend' | 'override', {
47
+ label: string;
48
+ effect: string;
49
+ }>;
50
+ copyPrompt: string;
51
+ copyYes: string;
52
+ copyNo: string;
53
+ };
54
+ field: {
55
+ placeholder: string;
56
+ typed: (kind: string) => string;
57
+ };
58
+ columnList: {
59
+ add: string;
60
+ remove: string;
61
+ field: string;
62
+ header: string;
63
+ width: string;
64
+ align: string;
65
+ format: string;
66
+ alignments: Record<'start' | 'center' | 'end', string>;
67
+ };
68
+ summary: {
69
+ editedBy: (owner: string) => string;
70
+ empty: string;
71
+ };
72
+ }
73
+ export declare const defaultPropertyEditorStrings: PropertyEditorStrings;
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface SelectOption {
3
+ value: string;
4
+ label: string;
5
+ group?: string;
6
+ disabled?: boolean;
7
+ reason?: string;
8
+ }
9
+ export declare function filterOptions(options: readonly SelectOption[], query: string): SelectOption[];
10
+ export interface SearchableSelectProps {
11
+ id: string;
12
+ options: readonly SelectOption[];
13
+ value: string | undefined;
14
+ onChange: (value: string | undefined) => void;
15
+ disabled?: boolean;
16
+ invalid?: boolean;
17
+ placeholder: string;
18
+ searchLabel: string;
19
+ emptyLabel: string;
20
+ clearLabel: string;
21
+ clearable?: boolean;
22
+ renderClosed?: (option: SelectOption | undefined) => ReactNode;
23
+ 'aria-labelledby'?: string;
24
+ 'aria-describedby'?: string;
25
+ }
26
+ export declare const SearchableSelect: ({ id, options, value, onChange, disabled, invalid, placeholder, searchLabel, emptyLabel, clearLabel, clearable, renderClosed, ...aria }: SearchableSelectProps) => import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import type { InspectedProperty, QueryCandidate, QueryResultField, SceneDiagnostic } from '@cratis/scene.model';
2
+ import type { BindingTypeScope } from '@cratis/scene.engine';
3
+ import type { ScreenEditorController } from '../../Host/ScreenEditorController';
4
+ import type { ScreenEditorEnvironment } from '../../Host/ScreenEditorHost';
5
+ import type { ScreenEditorStrings } from '../../Inspector/ScreenEditorStrings';
6
+ import type { Ownership } from '../../Structure/Ownership';
7
+ import type { EditorContext } from './PropertyEditorProps';
8
+ export interface EditorContextInputs {
9
+ controller: ScreenEditorController;
10
+ environment: ScreenEditorEnvironment;
11
+ strings: ScreenEditorStrings;
12
+ ownership: Ownership | undefined;
13
+ authoringTemplate?: string;
14
+ diagnostics: readonly SceneDiagnostic[];
15
+ inCanvas: boolean;
16
+ bindingScope: BindingTypeScope;
17
+ }
18
+ export declare function fieldsOfBoundQuery(properties: Readonly<Record<string, unknown>> | undefined, candidates: readonly QueryCandidate[]): readonly QueryResultField[];
19
+ export declare function createEditorContext(inputs: EditorContextInputs): EditorContext;
20
+ export declare function withSession(context: EditorContext, inputs: EditorContextInputs, property: InspectedProperty): EditorContext;
@@ -0,0 +1,2 @@
1
+ import { PropertyEditorRegistry } from './PropertyEditorRegistry';
2
+ export declare function createPropertyEditorRegistry(): PropertyEditorRegistry;
@@ -0,0 +1 @@
1
+ export declare const screenEditorPropertyEditors: import("./PropertyEditorRegistry").PropertyEditorRegistry;
@@ -0,0 +1,3 @@
1
+ import type { BindingExpression } from '@cratis/scene.model';
2
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
3
+ export declare const BindingExpressionPropertyEditor: ({ onChange, context, disabled }: PropertyEditorProps<BindingExpression>) => import("react").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const CollectionEditor: (props: PropertyEditorProps<unknown>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const ColumnListEditor: ({ value, onChange, descriptor, context, disabled, id }: PropertyEditorProps<Record<string, unknown>[]>) => import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare function fieldCandidates(descriptor: {
3
+ editorKind?: string;
4
+ editorOptions?: {
5
+ fieldKinds?: string[];
6
+ };
7
+ }, lookups: {
8
+ fields: readonly {
9
+ name: string;
10
+ type: string;
11
+ }[];
12
+ availableSources: Readonly<Record<string, string>>;
13
+ }): {
14
+ all: {
15
+ name: string;
16
+ type: string;
17
+ }[];
18
+ offered: {
19
+ name: string;
20
+ type: string;
21
+ }[];
22
+ };
23
+ export declare const FieldEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const FieldListEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<string[]>) => import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ type Mode = 'inherit' | 'extend' | 'override';
3
+ export declare const InheritanceModeEditor: ({ value, onChange, context, disabled, id }: PropertyEditorProps<Mode>) => import("react").JSX.Element;
4
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const NavigationTargetEditor: ({ value, onChange, descriptor, context, disabled, id }: PropertyEditorProps<unknown>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const OrderedItemsEditor: ({ context }: PropertyEditorProps<unknown>) => import("react").JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ import type { QueryBinding } from '@cratis/scene.model';
2
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
3
+ export declare const QueryBindingPropertyEditor: ({ onChange, context, disabled }: PropertyEditorProps<QueryBinding>) => import("react").JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const TemplateEditor: (props: PropertyEditorProps<string>) => import("react").JSX.Element;
3
+ export declare const SampleDataEditor: (props: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare function slotRegion(slot: string, slots: readonly string[]): {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export declare const RenderingSlotEditor: ({ value, onChange, context, disabled, id }: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { PropertyEditorProps, EditorLookups } from '../Registry/PropertyEditorProps';
2
+ import type { PropertyEditorStrings } from '../Registry/PropertyEditorStrings';
3
+ import type { SelectOption } from '../Registry/SearchableSelect';
4
+ export declare function sliceOptions(lookups: Pick<EditorLookups, 'slices' | 'stateChangeSlices'>, kinds: readonly string[] | undefined, text: PropertyEditorStrings): SelectOption[];
5
+ export declare const SliceEditor: ({ value, onChange, descriptor, context, disabled, problem, id }: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const StateChangeEditor: (props: PropertyEditorProps<string>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const StructuredPropertyEditor: ({ value, onChange, descriptor, context, disabled, id }: PropertyEditorProps<unknown>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const SummaryEditor: ({ value, descriptor, context, id }: PropertyEditorProps<unknown>) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PropertyEditorProps } from '../Registry/PropertyEditorProps';
2
+ export declare const UndescribedEditor: ({ descriptor, context, id }: PropertyEditorProps<unknown>) => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function fieldKindOf(type: string): 'number' | 'boolean' | 'date' | 'id' | 'string';
@@ -1,8 +1,5 @@
1
1
  export * from './StructuredEditorStrings';
2
- export * from './classifyStructures';
3
- export * from './StructuredProperties';
4
2
  export * from './StructuredValueEditor';
5
- export * from './UndescribedProperties';
6
3
  export * from './defaultStructuredEditorStrings';
7
4
  export * from './structuredValue';
8
5
  export * from './structuredProblem';