@cratis/event-models 0.135.0 → 0.135.2

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 (27) hide show
  1. package/dist/screen-editor/FormDesigner/FieldMapping.d.ts +9 -0
  2. package/dist/screen-editor/FormDesigner/FieldMappingKind.d.ts +15 -0
  3. package/dist/screen-editor/FormDesigner/FormDesigner.d.ts +16 -0
  4. package/dist/screen-editor/FormDesigner/PopulateSourceKind.d.ts +12 -0
  5. package/dist/screen-editor/FormDesigner/PopulateSourceSummary.d.ts +21 -0
  6. package/dist/screen-editor/FormDesigner/classifyFormFields.d.ts +13 -0
  7. package/dist/screen-editor/ScreenEditor/Binding/bindingExpressionModel.d.ts +8 -0
  8. package/dist/screen-editor/ScreenEditor/Binding/bindingSources.d.ts +21 -0
  9. package/dist/screen-editor/ScreenEditor/Inspector/BindingExpressionEditor.d.ts +11 -0
  10. package/dist/screen-editor/ScreenEditor/Inspector/DesignTimeActionsSection.d.ts +13 -0
  11. package/dist/screen-editor/ScreenEditor/Inspector/FormAuthoringSection.d.ts +10 -0
  12. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +36 -0
  13. package/dist/screen-editor/ScreenEditor/Integration/BindingSourceChoice.d.ts +6 -0
  14. package/dist/screen-editor/ScreenEditor/Integration/BindingSourceChoiceInputs.d.ts +4 -0
  15. package/dist/screen-editor/ScreenEditor/Integration/CommandFormColumn.d.ts +5 -0
  16. package/dist/screen-editor/ScreenEditor/Integration/CommandFormConfiguration.d.ts +9 -0
  17. package/dist/screen-editor/ScreenEditor/Integration/CommandFormInput.d.ts +9 -0
  18. package/dist/screen-editor/ScreenEditor/Integration/CommandFormMode.d.ts +4 -0
  19. package/dist/screen-editor/ScreenEditor/Integration/DesignTimeActionExecutionContext.d.ts +8 -0
  20. package/dist/screen-editor/ScreenEditor/Integration/DesignTimeActionResult.d.ts +7 -0
  21. package/dist/screen-editor/ScreenEditor/Integration/bindingSourceChoices.d.ts +3 -0
  22. package/dist/screen-editor/ScreenEditor/Integration/index.d.ts +14 -0
  23. package/dist/screen-editor/ScreenEditor/Integration/runDesignTimeAction.d.ts +4 -0
  24. package/dist/screen-editor/ScreenEditor/index.d.ts +1 -0
  25. package/dist/screen-editor/index.js +2899 -2238
  26. package/dist/screen-editor/screen-editor.css +1 -1
  27. package/package.json +19 -19
@@ -0,0 +1,9 @@
1
+ import { FormField } from '@cratis/scene.model';
2
+ import { FieldMappingKind } from './FieldMappingKind';
3
+ /**
4
+ * A {@link FormField} together with the {@link FieldMappingKind} it classifies as - see `classifyFormFields`.
5
+ */
6
+ export interface FieldMapping {
7
+ field: FormField;
8
+ kind: FieldMappingKind;
9
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The three population tiers a {@link FormField} can be in, plus the designer-only `Broken` state for a
3
+ * field whose source property no longer exists on the command - part of StudioIssues#157, surfacing the
4
+ * compiler's rename-breaks-the-build guarantee visually instead of only failing at build time.
5
+ */
6
+ export declare enum FieldMappingKind {
7
+ /** `sourceProperty` and `composeUsing` are both unset - the field maps to a command property of the same name. */
8
+ AutoMapped = "autoMapped",
9
+ /** `sourceProperty` is set - the field maps to a differently-named command property. */
10
+ Renamed = "renamed",
11
+ /** `composeUsing` is set - the field's value is computed by a callback. */
12
+ Composed = "composed",
13
+ /** The field's source property (its own name, or `sourceProperty` when renamed) does not exist on the command. */
14
+ Broken = "broken"
15
+ }
@@ -0,0 +1,16 @@
1
+ import { Form } from '@cratis/scene.model';
2
+ export interface FormDesignerProps {
3
+ form: Form;
4
+ /** The property names declared on the form's `forCommand` - see `classifyFormFields`. */
5
+ commandProperties: readonly string[];
6
+ /** Called with a field's name when its row is activated - the compose-using/rename affordances hand off to the caller rather than editing inline (see StudioIssues#157's open question). */
7
+ onFieldSelected?: (fieldName: string) => void;
8
+ }
9
+ /**
10
+ * The field mapping surface for a {@link Form} - StudioIssues#157. Shows the populate source and every
11
+ * field's mapping tier, with a `Broken` state for a field whose source property no longer exists on the
12
+ * command, surfacing the compiler's rename-breaks-the-build guarantee visually instead of only at build
13
+ * time. `Composed` fields hand off `onFieldSelected` to the caller rather than editing the callback
14
+ * inline - the callback is arbitrary C#, so this designer is not a code editor.
15
+ */
16
+ export declare function FormDesigner({ form, commandProperties, onFieldSelected }: FormDesignerProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Which kind of `PopulateSource` a {@link Form} declares, or that it declares none - part of
3
+ * StudioIssues#157's populate-source picker.
4
+ */
5
+ export declare enum PopulateSourceKind {
6
+ /** The form has no `populateSource` - its fields start empty. */
7
+ None = "none",
8
+ /** `populate via query <Query> [by <param>]`. */
9
+ ViaQuery = "viaQuery",
10
+ /** `populate from item`. */
11
+ FromItem = "fromItem"
12
+ }
@@ -0,0 +1,21 @@
1
+ import { PopulateSource } from '@cratis/scene.model';
2
+ import { PopulateSourceKind } from './PopulateSourceKind';
3
+ /**
4
+ * A display-ready summary of a {@link Form}'s `populateSource` - part of StudioIssues#157's
5
+ * populate-source picker.
6
+ */
7
+ export interface PopulateSourceSummary {
8
+ kind: PopulateSourceKind;
9
+ queryName?: string;
10
+ parameterNames: string[];
11
+ }
12
+ /**
13
+ * Summarizes a {@link Form}'s `populateSource` for display. `PopulateSource` is a marker interface with no
14
+ * discriminant, so this narrows structurally on the property each variant actually declares
15
+ * (`queryName` for {@link PopulateViaQuery}, `itemBinding` for `PopulateFromItem`) - the same
16
+ * duck-typing approach `extractNavigationItem` (Cratis/Scene#2) uses for `Contribution.content.properties`.
17
+ *
18
+ * @param populateSource The form's `populateSource`, or `undefined` when it declares none.
19
+ * @returns The {@link PopulateSourceSummary}.
20
+ */
21
+ export declare function summarizePopulateSource(populateSource: PopulateSource | undefined): PopulateSourceSummary;
@@ -0,0 +1,13 @@
1
+ import { Form } from '@cratis/scene.model';
2
+ import { FieldMapping } from './FieldMapping';
3
+ /**
4
+ * Classifies every field of a {@link Form} into its {@link FieldMappingKind} - part of StudioIssues#157's
5
+ * field mapping UI. `commandProperties` is the set of property names the form's `forCommand` actually
6
+ * declares (from the generated command proxy or the compiled Screenplay AST); this function does not fetch
7
+ * it, so the designer stays free to source that list however it has it in scope.
8
+ *
9
+ * @param form The {@link Form} whose fields to classify.
10
+ * @param commandProperties The property names declared on the form's target command.
11
+ * @returns One {@link FieldMapping} per field, in the form's own field order.
12
+ */
13
+ export declare function classifyFormFields(form: Form, commandProperties: readonly string[]): FieldMapping[];
@@ -0,0 +1,8 @@
1
+ import { BindingMode, BindingNullBehavior, BindingSourceKind, PropertyValueType, type BindingExpression, type InspectedProperty } from '@cratis/scene.model';
2
+ export declare const allBindingSourceKinds: BindingSourceKind[];
3
+ export declare const bindingModes: BindingMode[];
4
+ export declare const bindingNullBehaviors: BindingNullBehavior[];
5
+ export declare const expectedValueTypes: PropertyValueType[];
6
+ export declare function isBindingExpression(value: unknown): value is BindingExpression;
7
+ export declare function isBindingProperty(property: InspectedProperty): boolean;
8
+ export declare function defaultBinding(property: InspectedProperty): BindingExpression;
@@ -0,0 +1,21 @@
1
+ import { type EditingContext } from '@cratis/scene.engine';
2
+ import type { QueryCandidate, SceneDocument, SceneElement } from '@cratis/scene.model';
3
+ export interface ComponentOutputSource {
4
+ componentId: string;
5
+ label: string;
6
+ outputs: {
7
+ path: string;
8
+ label: string;
9
+ type: string;
10
+ }[];
11
+ }
12
+ export interface BindingSourceInventory {
13
+ dataContextPaths: string[];
14
+ queryResults: {
15
+ id: string;
16
+ name: string;
17
+ fields: string[];
18
+ }[];
19
+ componentOutputs: ComponentOutputSource[];
20
+ }
21
+ export declare function bindingSourceInventory(document: SceneDocument, roots: readonly SceneElement[], context: EditingContext, availableSources: Record<string, string>, candidates: readonly QueryCandidate[]): BindingSourceInventory;
@@ -0,0 +1,11 @@
1
+ import { type BindingExpression, type InspectedProperty } from '@cratis/scene.model';
2
+ import type { BindingSourceInventory } from '../Binding/bindingSources';
3
+ import type { ScreenEditorStrings } from './ScreenEditorStrings';
4
+ export interface BindingExpressionEditorProps {
5
+ property: InspectedProperty;
6
+ sources: BindingSourceInventory;
7
+ strings: ScreenEditorStrings;
8
+ disabled: boolean;
9
+ onChange: (binding: BindingExpression | undefined) => void;
10
+ }
11
+ export declare const BindingExpressionEditor: ({ property, sources, strings, disabled, onChange }: BindingExpressionEditorProps) => import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { ComponentDescriptor, ExternalComponent } from '@cratis/scene.model';
2
+ import type { ScreenEditorController } from '../Host/ScreenEditorController';
3
+ import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
4
+ import type { ScreenEditorStrings } from './ScreenEditorStrings';
5
+ export interface DesignTimeActionsSectionProps {
6
+ component: ExternalComponent;
7
+ descriptor: ComponentDescriptor;
8
+ controller: ScreenEditorController;
9
+ environment: ScreenEditorEnvironment;
10
+ strings: ScreenEditorStrings;
11
+ disabled: boolean;
12
+ }
13
+ export declare const DesignTimeActionsSection: ({ component, descriptor, controller, environment, strings, disabled }: DesignTimeActionsSectionProps) => import("react").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ import type { StateChangeSlice } from '../Actions/StateChangeSlice';
2
+ import type { ScreenEditorController } from '../Host/ScreenEditorController';
3
+ import type { ScreenEditorStrings } from './ScreenEditorStrings';
4
+ export interface FormAuthoringSectionProps {
5
+ controller: ScreenEditorController;
6
+ slices: readonly StateChangeSlice[];
7
+ strings: ScreenEditorStrings;
8
+ disabled: boolean;
9
+ }
10
+ export declare const FormAuthoringSection: ({ controller, slices, strings, disabled }: FormAuthoringSectionProps) => import("react").JSX.Element | null;
@@ -45,6 +45,7 @@ export interface ScreenEditorStrings {
45
45
  properties: {
46
46
  diagnostics: string;
47
47
  noProperties: string;
48
+ designTimeActions: string;
48
49
  layoutType: string;
49
50
  changeLayout: string;
50
51
  confirmLayoutTitle: string;
@@ -59,6 +60,41 @@ export interface ScreenEditorStrings {
59
60
  icon: IconPropertyFieldStrings;
60
61
  iconPickerLabels?: IconPickerLabels;
61
62
  json?: JsonPropertyFieldStrings;
63
+ forms: {
64
+ label: string;
65
+ add: string;
66
+ chooseCommand: string;
67
+ mode: string;
68
+ auto: string;
69
+ manual: string;
70
+ fieldLabel: string;
71
+ sourceProperty: string;
72
+ remove: string;
73
+ };
74
+ binding: {
75
+ source: string;
76
+ sources: {
77
+ dataContext: string;
78
+ queryResult: string;
79
+ componentProperty: string;
80
+ literal: string;
81
+ };
82
+ path: string;
83
+ query: string;
84
+ component: string;
85
+ componentProperty: string;
86
+ literalValue: string;
87
+ mode: string;
88
+ inheritedMode: string;
89
+ nullBehavior: string;
90
+ defaultNullBehavior: string;
91
+ expectedType: string;
92
+ inferType: string;
93
+ noSource: string;
94
+ clear: string;
95
+ missingQuery: (query: string) => string;
96
+ missingComponent: (componentId: string) => string;
97
+ };
62
98
  query: {
63
99
  label: string;
64
100
  choose: string;
@@ -0,0 +1,6 @@
1
+ import type { BindingSourceKind } from '@cratis/scene.model';
2
+ export interface BindingSourceChoice {
3
+ kind: BindingSourceKind;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
@@ -0,0 +1,4 @@
1
+ export interface BindingSourceChoiceInputs {
2
+ queryResults: readonly string[];
3
+ componentOutputs: readonly string[];
4
+ }
@@ -0,0 +1,5 @@
1
+ export interface CommandFormColumn {
2
+ property: string;
3
+ label: string;
4
+ width?: string;
5
+ }
@@ -0,0 +1,9 @@
1
+ import type { CommandFormColumn } from './CommandFormColumn';
2
+ import type { CommandFormInput } from './CommandFormInput';
3
+ import { CommandFormMode } from './CommandFormMode';
4
+ export interface CommandFormConfiguration {
5
+ command: string;
6
+ mode: CommandFormMode;
7
+ inputs: CommandFormInput[];
8
+ columns?: CommandFormColumn[];
9
+ }
@@ -0,0 +1,9 @@
1
+ import type { BindingExpression } from '@cratis/scene.model';
2
+ export interface CommandFormInput {
3
+ property: string;
4
+ type: 'string' | 'guid';
5
+ label: string;
6
+ column?: number;
7
+ width?: string;
8
+ value?: BindingExpression;
9
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum CommandFormMode {
2
+ Auto = "auto",
3
+ Manual = "manual"
4
+ }
@@ -0,0 +1,8 @@
1
+ import type { EditingContext } from '@cratis/scene.engine';
2
+ import type { SceneDocument } from '@cratis/scene.model';
3
+ import type { DesignTimeActionContext } from '@cratis/scene.react';
4
+ export interface DesignTimeActionExecutionContext {
5
+ document: SceneDocument;
6
+ editing: EditingContext;
7
+ actionContext: DesignTimeActionContext;
8
+ }
@@ -0,0 +1,7 @@
1
+ import type { SceneDiagnostic, SceneDocument, SceneEdit } from '@cratis/scene.model';
2
+ export interface DesignTimeActionResult {
3
+ document: SceneDocument;
4
+ diagnostics: (SceneDiagnostic | string)[];
5
+ edits: SceneEdit[];
6
+ applied: boolean;
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { BindingSourceChoice } from './BindingSourceChoice';
2
+ import type { BindingSourceChoiceInputs } from './BindingSourceChoiceInputs';
3
+ export declare function bindingSourceChoices(inputs: BindingSourceChoiceInputs): BindingSourceChoice[];
@@ -0,0 +1,14 @@
1
+ export type { BindingExpression, DestinationReference, DesignTimeActionDescriptor, SceneEdit } from '@cratis/scene.model';
2
+ export { BindingMode, BindingNullBehavior, BindingSourceKind, DestinationKind } from '@cratis/scene.model';
3
+ export type { DesignTimeAction, DesignTimeActionContext, PackageHostConfiguration } from '@cratis/scene.react';
4
+ export type { EditingContext } from '@cratis/scene.engine';
5
+ export * from './BindingSourceChoice';
6
+ export * from './BindingSourceChoiceInputs';
7
+ export * from './CommandFormColumn';
8
+ export * from './CommandFormConfiguration';
9
+ export * from './CommandFormInput';
10
+ export * from './CommandFormMode';
11
+ export * from './DesignTimeActionExecutionContext';
12
+ export * from './DesignTimeActionResult';
13
+ export * from './bindingSourceChoices';
14
+ export * from './runDesignTimeAction';
@@ -0,0 +1,4 @@
1
+ import type { DesignTimeAction } from '@cratis/scene.react';
2
+ import type { DesignTimeActionExecutionContext } from './DesignTimeActionExecutionContext';
3
+ import type { DesignTimeActionResult } from './DesignTimeActionResult';
4
+ export declare function runDesignTimeAction(action: DesignTimeAction, context: DesignTimeActionExecutionContext): DesignTimeActionResult;
@@ -34,6 +34,7 @@ export * from './Layouts/toLayoutContainerDescriptors';
34
34
  export * from './Palette/buildPalette';
35
35
  export * from './Actions/StateChangeSlice';
36
36
  export * from './Binding/toSceneCandidates';
37
+ export * from './Integration';
37
38
  export * from './Document/readSceneDocument';
38
39
  export * from './Structure/Ownership';
39
40
  export * from './Structure/StructureEditRejection';