@cratis/event-models 0.174.0 → 0.176.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/BindingExpressionPropertyEditor-DbYpy_bX.js +426 -0
- package/dist/screen-editor/BooleanEditor-eC1yCpz0.js +17 -0
- package/dist/screen-editor/CollectionEditor-C7eX8Hw7.js +320 -0
- package/dist/screen-editor/ColorEditor-Cc6Xq8pW.js +49 -0
- package/dist/screen-editor/ColumnListEditor-Cku6GGLp.js +103 -0
- package/dist/screen-editor/EnumEditor-DNnnf9i3.js +26 -0
- package/dist/screen-editor/FieldEditor-SquvComm.js +66 -0
- package/dist/screen-editor/FieldListEditor-CNxskXPf.js +56 -0
- package/dist/screen-editor/IconEditor-C0ibqn-e.js +22 -0
- package/dist/screen-editor/InheritanceModeEditor-CtdsACnc.js +65 -0
- package/dist/screen-editor/ListEditor-CfFPVVJ4.js +53 -0
- package/dist/screen-editor/NavigationTargetEditor-DGnW5pVF.js +41 -0
- package/dist/screen-editor/NumberEditor-Cyo9_23Z.js +48 -0
- package/dist/screen-editor/QueryBindingEditor-3C_utVJm.js +17 -0
- package/dist/screen-editor/QueryBindingPropertyEditor-DLlC-slh.js +169 -0
- package/dist/screen-editor/ReferenceEditor-BnI2Qd7H.js +32 -0
- package/dist/screen-editor/ReferenceTargetEditors-COKAWO5q.js +19 -0
- package/dist/screen-editor/RenderingSlotEditor-Cani_PtT.js +128 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +1 -3
- package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +2 -4
- package/dist/screen-editor/ScreenEditor/Properties/choiceKeys.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/Properties/toPropertyGroups.d.ts +6 -7
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/BooleanEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ColorEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/EnumEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/IconEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/NumberEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/ReferenceEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/SelectEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/TextEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Generic/draftProblem.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorHost.d.ts +13 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorProps.d.ts +91 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorRegistry.d.ts +24 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/PropertyEditorStrings.d.ts +73 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/SearchableSelect.d.ts +26 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createEditorContext.d.ts +20 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/createPropertyEditorRegistry.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/screenEditorPropertyEditors.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/BindingExpressionPropertyEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/CollectionEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ColumnListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldEditor.d.ts +23 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/FieldListEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/InheritanceModeEditor.d.ts +4 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/NavigationTargetEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/OrderedItemsEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/ReferenceTargetEditors.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/RenderingSlotEditor.d.ts +8 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SliceEditor.d.ts +5 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StateChangeEditors.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/StructuredPropertyEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/SummaryEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/UndescribedEditor.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/fieldKind.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/index.d.ts +0 -3
- package/dist/screen-editor/SearchableSelect-WUNlC3tk.js +109 -0
- package/dist/screen-editor/SelectEditor-BuQPlIyf.js +26 -0
- package/dist/screen-editor/SliceEditor-Dle8OlsB.js +45 -0
- package/dist/screen-editor/StateChangeEditors-9k3Gqtc0.js +15 -0
- package/dist/screen-editor/StructuredPropertyEditor-B3lVjrHZ.js +13 -0
- package/dist/screen-editor/StructuredValueEditor-CcwyOga0.js +337 -0
- package/dist/screen-editor/SummaryEditor-C5wP1uIH.js +23 -0
- package/dist/screen-editor/TextEditor-BEH-9K1S.js +40 -0
- package/dist/screen-editor/UndescribedEditor-Cqs6bHhD.js +10 -0
- package/dist/screen-editor/allowedIconChoices-DBgeRdGI.js +138 -0
- package/dist/screen-editor/choiceKeys-DQcUX97p.js +17 -0
- package/dist/screen-editor/defaultStructuredEditorStrings-Ch1I0Lci.js +137 -0
- package/dist/screen-editor/draftProblem-BGC5Gfsv.js +12 -0
- package/dist/screen-editor/iconDiagnostics-Ds4CnqD0.js +49 -0
- package/dist/screen-editor/index.js +2997 -4376
- package/dist/screen-editor/screen-editor.css +1 -1
- package/dist/screen-editor/structuredValue-vqCZttsk.js +61 -0
- package/package.json +12 -12
- package/dist/screen-editor/ScreenEditor/Inspector/IconProperties.d.ts +0 -14
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/StructuredProperties.d.ts +0 -9
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/UndescribedProperties.d.ts +0 -7
- package/dist/screen-editor/ScreenEditor/PropertyEditors/Structured/classifyStructures.d.ts +0 -6
|
@@ -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,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;
|
package/dist/screen-editor/ScreenEditor/PropertyEditors/Registry/screenEditorPropertyEditors.d.ts
ADDED
|
@@ -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,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,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 {};
|
package/dist/screen-editor/ScreenEditor/PropertyEditors/Specific/QueryBindingPropertyEditor.d.ts
ADDED
|
@@ -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 @@
|
|
|
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';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useId as O, useMemo as q, useRef as B, useState as f } from "react";
|
|
2
|
+
import { jsx as l, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
function F(d, r) {
|
|
4
|
+
const s = r.trim().toLowerCase();
|
|
5
|
+
return d.filter((a) => s === "" || a.label.toLowerCase().includes(s) || (a.group ?? "").toLowerCase().includes(s));
|
|
6
|
+
}
|
|
7
|
+
var R = ({ id: d, options: r, value: s, onChange: a, disabled: _, invalid: D, placeholder: C, searchLabel: b, emptyLabel: M, clearLabel: A, clearable: S, renderClosed: v, ...j }) => {
|
|
8
|
+
const [i, g] = f(!1), [u, w] = f(""), [y, h] = f(0), N = O(), k = B(null), m = r.find((e) => e.value === s), n = q(() => F(r, u), [r, u]), o = n.filter((e) => e.disabled !== !0), p = () => {
|
|
9
|
+
g(!1), w("");
|
|
10
|
+
}, x = (e) => {
|
|
11
|
+
e.disabled || (a(e.value), p());
|
|
12
|
+
}, E = (e) => {
|
|
13
|
+
if (e.key === "Escape") {
|
|
14
|
+
e.stopPropagation(), p();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
18
|
+
if (e.preventDefault(), o.length === 0) return;
|
|
19
|
+
h((t) => (t + (e.key === "ArrowDown" ? 1 : -1) + o.length) % o.length);
|
|
20
|
+
} else if (e.key === "Enter") {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
const t = o[Math.min(y, o.length - 1)];
|
|
23
|
+
t && x(t);
|
|
24
|
+
}
|
|
25
|
+
}, I = [...new Set(n.map((e) => e.group ?? ""))].sort((e, t) => e === "" ? -1 : t === "" ? 1 : 0), K = o[Math.min(y, Math.max(o.length - 1, 0))]?.value;
|
|
26
|
+
return /* @__PURE__ */ c("div", {
|
|
27
|
+
ref: k,
|
|
28
|
+
className: "studio-editor-select",
|
|
29
|
+
onKeyDown: i ? E : void 0,
|
|
30
|
+
onBlur: (e) => {
|
|
31
|
+
k.current?.contains(e.relatedTarget) || p();
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ l("button", {
|
|
35
|
+
type: "button",
|
|
36
|
+
id: d,
|
|
37
|
+
role: "combobox",
|
|
38
|
+
"aria-haspopup": "listbox",
|
|
39
|
+
"aria-expanded": i,
|
|
40
|
+
"aria-controls": i ? N : void 0,
|
|
41
|
+
"aria-invalid": D || void 0,
|
|
42
|
+
className: "studio-editor-select__trigger",
|
|
43
|
+
disabled: _,
|
|
44
|
+
...j,
|
|
45
|
+
onClick: () => {
|
|
46
|
+
g(!i), h(0);
|
|
47
|
+
},
|
|
48
|
+
children: v ? v(m) : /* @__PURE__ */ l("span", {
|
|
49
|
+
className: m ? void 0 : "studio-editor-select__placeholder",
|
|
50
|
+
children: m?.label ?? C
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
S === !0 && s !== void 0 && !_ && /* @__PURE__ */ l("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
className: "studio-editor-select__clear",
|
|
56
|
+
"aria-label": A,
|
|
57
|
+
onClick: () => a(void 0),
|
|
58
|
+
children: "×"
|
|
59
|
+
}),
|
|
60
|
+
i && /* @__PURE__ */ c("div", {
|
|
61
|
+
className: "studio-editor-select__panel",
|
|
62
|
+
children: [/* @__PURE__ */ l("input", {
|
|
63
|
+
type: "search",
|
|
64
|
+
autoFocus: !0,
|
|
65
|
+
className: "studio-editor-select__search",
|
|
66
|
+
"aria-label": b,
|
|
67
|
+
placeholder: b,
|
|
68
|
+
value: u,
|
|
69
|
+
onChange: (e) => {
|
|
70
|
+
w(e.target.value), h(0);
|
|
71
|
+
}
|
|
72
|
+
}), /* @__PURE__ */ c("ul", {
|
|
73
|
+
id: N,
|
|
74
|
+
role: "listbox",
|
|
75
|
+
className: "studio-editor-select__options",
|
|
76
|
+
children: [n.length === 0 && /* @__PURE__ */ l("li", {
|
|
77
|
+
className: "studio-editor-select__empty",
|
|
78
|
+
children: M
|
|
79
|
+
}), I.map((e) => /* @__PURE__ */ c("li", {
|
|
80
|
+
role: "presentation",
|
|
81
|
+
children: [e !== "" && /* @__PURE__ */ l("div", {
|
|
82
|
+
className: "studio-editor-select__group",
|
|
83
|
+
children: e
|
|
84
|
+
}), /* @__PURE__ */ l("ul", {
|
|
85
|
+
role: "presentation",
|
|
86
|
+
children: n.filter((t) => (t.group ?? "") === e).map((t) => /* @__PURE__ */ c("li", {
|
|
87
|
+
role: "option",
|
|
88
|
+
"aria-selected": t.value === s,
|
|
89
|
+
"aria-disabled": t.disabled || void 0,
|
|
90
|
+
className: [
|
|
91
|
+
"studio-editor-select__option",
|
|
92
|
+
t.value === K ? "studio-editor-select__option--active" : "",
|
|
93
|
+
t.value === s ? "studio-editor-select__option--chosen" : ""
|
|
94
|
+
].join(" ").trim(),
|
|
95
|
+
title: t.reason,
|
|
96
|
+
onMouseDown: (L) => L.preventDefault(),
|
|
97
|
+
onClick: () => x(t),
|
|
98
|
+
children: [/* @__PURE__ */ l("span", { children: t.label }), t.disabled && t.reason && /* @__PURE__ */ l("small", { children: t.reason })]
|
|
99
|
+
}, t.value))
|
|
100
|
+
})]
|
|
101
|
+
}, e))]
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
R as t
|
|
109
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as b, t as p } from "./choiceKeys-DQcUX97p.js";
|
|
2
|
+
import { t as h } from "./SearchableSelect-WUNlC3tk.js";
|
|
3
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
4
|
+
var x = ({ value: i, onChange: c, descriptor: o, context: s, disabled: n, problem: d, id: r }) => {
|
|
5
|
+
const a = s.strings.editors.select, l = i ?? void 0, t = b(o.choices ?? [], l);
|
|
6
|
+
return /* @__PURE__ */ m(h, {
|
|
7
|
+
id: r,
|
|
8
|
+
options: t.map((e) => ({
|
|
9
|
+
value: e.key,
|
|
10
|
+
label: e.label
|
|
11
|
+
})),
|
|
12
|
+
value: l === void 0 ? void 0 : p(l),
|
|
13
|
+
disabled: n,
|
|
14
|
+
invalid: d !== void 0,
|
|
15
|
+
placeholder: a.placeholder,
|
|
16
|
+
searchLabel: a.search,
|
|
17
|
+
emptyLabel: a.empty,
|
|
18
|
+
clearLabel: a.clear,
|
|
19
|
+
clearable: o.constraints?.required !== !0,
|
|
20
|
+
"aria-labelledby": `${r}-label`,
|
|
21
|
+
onChange: (e) => c(e === void 0 ? void 0 : t.find((v) => v.key === e)?.value)
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
x as SelectEditor
|
|
26
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { t as m } from "./SearchableSelect-WUNlC3tk.js";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
function b(t, a, o) {
|
|
4
|
+
return (t.slices.length > 0 ? t.slices : t.stateChangeSlices.map((e) => ({
|
|
5
|
+
id: e.id,
|
|
6
|
+
name: e.name,
|
|
7
|
+
kind: "StateChange",
|
|
8
|
+
path: e.origin
|
|
9
|
+
}))).map((e) => {
|
|
10
|
+
const l = a === void 0 || a.includes(e.kind);
|
|
11
|
+
return {
|
|
12
|
+
value: e.id,
|
|
13
|
+
label: e.name,
|
|
14
|
+
group: e.path.join(" › "),
|
|
15
|
+
...l ? {} : {
|
|
16
|
+
disabled: !0,
|
|
17
|
+
reason: o.slice.notKind(a?.[0] ?? e.kind)
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var g = ({ value: t, onChange: a, descriptor: o, context: e, disabled: l, problem: c, id: s }) => {
|
|
23
|
+
const r = e.strings.editors, i = b(e.lookups, o.editorOptions?.kinds, r), n = typeof t == "string" && t !== "" ? t : void 0, d = n !== void 0 && !i.some((p) => p.value === n);
|
|
24
|
+
return /* @__PURE__ */ u(m, {
|
|
25
|
+
id: s,
|
|
26
|
+
options: d ? [...i, {
|
|
27
|
+
value: n,
|
|
28
|
+
label: n,
|
|
29
|
+
group: ""
|
|
30
|
+
}] : i,
|
|
31
|
+
value: n,
|
|
32
|
+
disabled: l,
|
|
33
|
+
invalid: d || c !== void 0,
|
|
34
|
+
placeholder: r.slice.placeholder,
|
|
35
|
+
searchLabel: r.select.search,
|
|
36
|
+
emptyLabel: r.select.empty,
|
|
37
|
+
clearLabel: r.select.clear,
|
|
38
|
+
clearable: o.constraints?.required !== !0,
|
|
39
|
+
"aria-labelledby": `${s}-label`,
|
|
40
|
+
onChange: a
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
g as SliceEditor
|
|
45
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SliceEditor as r } from "./SliceEditor-Dle8OlsB.js";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
var d = (t) => /* @__PURE__ */ i(r, {
|
|
4
|
+
...t,
|
|
5
|
+
descriptor: {
|
|
6
|
+
...t.descriptor,
|
|
7
|
+
editorOptions: {
|
|
8
|
+
kinds: ["StateChange"],
|
|
9
|
+
...t.descriptor.editorOptions
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
d as StateChangeEditor
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as s } from "./StructuredValueEditor-CcwyOga0.js";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
var p = ({ value: r, onChange: t, descriptor: e, context: i, disabled: d, id: o }) => /* @__PURE__ */ u(s, {
|
|
4
|
+
descriptor: e,
|
|
5
|
+
value: r,
|
|
6
|
+
idPrefix: o,
|
|
7
|
+
strings: i.strings.structured,
|
|
8
|
+
disabled: d === !0,
|
|
9
|
+
onChange: t
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
p as StructuredPropertyEditor
|
|
13
|
+
};
|