@cratis/event-models 0.312.2 → 0.314.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/ScreenEditor/Drafting/SceneScreenDraft.d.ts +30 -0
- package/dist/screen-editor/ScreenEditor/Drafting/SceneScreenDraftReview.d.ts +14 -0
- package/dist/screen-editor/ScreenEditor/Drafting/SceneScreenDraftStrings.d.ts +21 -0
- package/dist/screen-editor/ScreenEditor/Drafting/SceneScreenDraftToolbar.d.ts +16 -0
- package/dist/screen-editor/ScreenEditor/Drafting/defaultSceneScreenDraftStrings.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/Drafting/prepareSceneScreenDraft.d.ts +10 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftElement.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftEnvelope.d.ts +5 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftInsertion.d.ts +4 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftProperty.d.ts +4 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftRequest.d.ts +6 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftReviewVisibility.d.ts +1 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftSession.d.ts +16 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftState.d.ts +6 -0
- package/dist/screen-editor/ScreenEditor/Drafting/sceneScreenDraftValues.d.ts +5 -0
- package/dist/screen-editor/ScreenEditor/Drafting/useSceneScreenDraft.d.ts +21 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +7 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorOverlay.d.ts +3 -0
- package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWindow.d.ts +2 -1
- package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +2 -0
- package/dist/screen-editor/ScreenEditor/index.d.ts +1 -0
- package/dist/screen-editor/UiProfile/SampleDataSelectionSettings.d.ts +4 -2
- package/dist/screen-editor/UiProfile/sampleDataOf.d.ts +2 -2
- package/dist/screen-editor/index.js +4757 -4304
- package/package.json +3 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EditingContext } from '@cratis/scene.engine';
|
|
2
|
+
import type { SceneDocument, SceneEdit } from '@cratis/scene.model';
|
|
3
|
+
import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
|
|
4
|
+
export interface SceneScreenDraftAgent {
|
|
5
|
+
readonly context: string;
|
|
6
|
+
readonly parameterlessQueryIds: readonly string[];
|
|
7
|
+
generate(request: SceneScreenDraftRequest, signal: AbortSignal): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export interface SceneScreenDraftRequest {
|
|
10
|
+
instruction: string;
|
|
11
|
+
catalogue: string;
|
|
12
|
+
document: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PreparedSceneScreenDraft {
|
|
15
|
+
readonly base: SceneDocument;
|
|
16
|
+
readonly document: SceneDocument;
|
|
17
|
+
readonly answer: string;
|
|
18
|
+
readonly reply: string;
|
|
19
|
+
readonly edits: SceneEdit[];
|
|
20
|
+
readonly parameterlessQueryIds: readonly string[];
|
|
21
|
+
readonly runtime: ScreenEditorRuntime;
|
|
22
|
+
readonly context: EditingContext;
|
|
23
|
+
}
|
|
24
|
+
export type SceneScreenDraftPreparation = {
|
|
25
|
+
prepared: PreparedSceneScreenDraft;
|
|
26
|
+
problem?: never;
|
|
27
|
+
} | {
|
|
28
|
+
problem: string;
|
|
29
|
+
prepared?: never;
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type SceneDocument } from '@cratis/scene.model';
|
|
2
|
+
import type { ScreenEditorController } from '../Host/ScreenEditorController';
|
|
3
|
+
import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
|
|
4
|
+
import type { SceneScreenDraftAgent } from './SceneScreenDraft';
|
|
5
|
+
import type { SceneScreenDraftStrings } from './SceneScreenDraftStrings';
|
|
6
|
+
export interface SceneScreenDraftReviewProps {
|
|
7
|
+
controller: ScreenEditorController;
|
|
8
|
+
environment: ScreenEditorEnvironment;
|
|
9
|
+
agent: SceneScreenDraftAgent;
|
|
10
|
+
onPreview?: (document: SceneDocument) => void;
|
|
11
|
+
strings?: SceneScreenDraftStrings;
|
|
12
|
+
previewing?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function SceneScreenDraftReview({ controller, environment, agent, onPreview, strings: text, previewing }: SceneScreenDraftReviewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface SceneScreenDraftStrings {
|
|
2
|
+
open: string;
|
|
3
|
+
title: string;
|
|
4
|
+
discard: string;
|
|
5
|
+
discardAriaLabel: string;
|
|
6
|
+
preview: string;
|
|
7
|
+
apply: string;
|
|
8
|
+
explanation: string;
|
|
9
|
+
instruction: string;
|
|
10
|
+
generate: string;
|
|
11
|
+
generating: string;
|
|
12
|
+
status: string;
|
|
13
|
+
review: string;
|
|
14
|
+
additions: string;
|
|
15
|
+
addControl: (target: string) => string;
|
|
16
|
+
setProperty: (path: string, node: string) => string;
|
|
17
|
+
changed: string;
|
|
18
|
+
generationFailed: string;
|
|
19
|
+
applyFailed: string;
|
|
20
|
+
undoLabel: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SceneDocument } from '@cratis/scene.model';
|
|
2
|
+
import type { ScreenEditorController } from '../Host/ScreenEditorController';
|
|
3
|
+
import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
|
|
4
|
+
import type { ScreenEditorStrings } from '../Inspector/ScreenEditorStrings';
|
|
5
|
+
import type { SceneScreenDraftAgent } from './SceneScreenDraft';
|
|
6
|
+
export interface SceneScreenDraftToolbarProps {
|
|
7
|
+
controller: ScreenEditorController;
|
|
8
|
+
environment: ScreenEditorEnvironment;
|
|
9
|
+
strings: ScreenEditorStrings;
|
|
10
|
+
agent?: SceneScreenDraftAgent;
|
|
11
|
+
readOnly: boolean;
|
|
12
|
+
authoringTemplate?: string;
|
|
13
|
+
onPreview?: (document: SceneDocument) => void;
|
|
14
|
+
previewing?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const SceneScreenDraftToolbar: ({ controller, environment, strings, agent, readOnly, authoringTemplate, onPreview, previewing }: SceneScreenDraftToolbarProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type EditingContext } from '@cratis/scene.engine';
|
|
2
|
+
import { type SceneDocument } from '@cratis/scene.model';
|
|
3
|
+
import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
|
|
4
|
+
import type { SceneScreenDraftPreparation } from './SceneScreenDraft';
|
|
5
|
+
export interface SceneScreenDraftScope {
|
|
6
|
+
runtime: ScreenEditorRuntime;
|
|
7
|
+
context: EditingContext;
|
|
8
|
+
parameterlessQueryIds: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function prepareSceneScreenDraft(base: SceneDocument, answer: string, scope: SceneScreenDraftScope): SceneScreenDraftPreparation;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SceneEdit } from '@cratis/scene.model';
|
|
2
|
+
import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
|
|
3
|
+
import type { DraftState } from './sceneScreenDraftState';
|
|
4
|
+
export declare function insertEdit(raw: Record<string, unknown>, state: DraftState, runtime: ScreenEditorRuntime): SceneEdit;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type EditingContext } from '@cratis/scene.engine';
|
|
2
|
+
import { type SceneEdit } from '@cratis/scene.model';
|
|
3
|
+
import type { DraftState } from './sceneScreenDraftState';
|
|
4
|
+
export declare function propertyEdit(raw: Record<string, unknown>, state: DraftState, context: EditingContext): SceneEdit;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type PropertyDescriptor, type SceneDocument } from '@cratis/scene.model';
|
|
2
|
+
import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
|
|
3
|
+
import type { SceneScreenDraftRequest } from './SceneScreenDraft';
|
|
4
|
+
export declare const supportedDraftProperty: (property: PropertyDescriptor) => boolean;
|
|
5
|
+
export declare const supportedDraftComponents: (runtime: ScreenEditorRuntime) => import("@cratis/scene.model").ComponentDescriptor[];
|
|
6
|
+
export declare function sceneScreenDraftRequest(instruction: string, document: SceneDocument, runtime: ScreenEditorRuntime): SceneScreenDraftRequest;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sceneScreenDraftReviewVisible: (open: boolean, previewing: boolean) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EditingContext } from '@cratis/scene.engine';
|
|
2
|
+
import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
|
|
3
|
+
import type { SessionCell } from '../Session/SessionCell';
|
|
4
|
+
import type { PreparedSceneScreenDraft } from './SceneScreenDraft';
|
|
5
|
+
import type { SceneScreenDraftStrings } from './SceneScreenDraftStrings';
|
|
6
|
+
export declare function sceneScreenDraftSession(cell: SessionCell, runtime: ScreenEditorRuntime, context: EditingContext, text?: SceneScreenDraftStrings): {
|
|
7
|
+
isSceneScreenDraftCurrent: (draft: PreparedSceneScreenDraft) => boolean;
|
|
8
|
+
prepareSceneScreenDraft: (answer: string, parameterlessQueryIds: readonly string[]) => import("./SceneScreenDraft").SceneScreenDraftPreparation;
|
|
9
|
+
applySceneScreenDraft: (draft: PreparedSceneScreenDraft) => {
|
|
10
|
+
applied: boolean;
|
|
11
|
+
problem: string;
|
|
12
|
+
} | {
|
|
13
|
+
problem?: undefined;
|
|
14
|
+
applied: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
2
|
+
export declare const hasOnlyKeys: (value: Record<string, unknown>, allowed: string[]) => boolean;
|
|
3
|
+
export declare function sameValue(left: unknown, right: unknown): boolean;
|
|
4
|
+
export declare function checkTree(value: unknown, depth?: number): void;
|
|
5
|
+
export declare function collectIdentities(value: unknown, found?: Set<string>): Set<string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ScreenEditorController } from '../Host/ScreenEditorController';
|
|
2
|
+
import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
|
|
3
|
+
import type { PreparedSceneScreenDraft, SceneScreenDraftAgent } from './SceneScreenDraft';
|
|
4
|
+
import type { SceneScreenDraftStrings } from './SceneScreenDraftStrings';
|
|
5
|
+
export declare function createSceneScreenDraftRequestGate(): {
|
|
6
|
+
start: () => AbortController | undefined;
|
|
7
|
+
current: (request: AbortController) => boolean;
|
|
8
|
+
finish: (request: AbortController) => void;
|
|
9
|
+
invalidate: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useSceneScreenDraft(controller: ScreenEditorController, environment: ScreenEditorEnvironment, agent: SceneScreenDraftAgent, text?: SceneScreenDraftStrings): {
|
|
12
|
+
instruction: string;
|
|
13
|
+
setInstruction: (value: string) => void;
|
|
14
|
+
prepared: PreparedSceneScreenDraft | undefined;
|
|
15
|
+
problem: string | undefined;
|
|
16
|
+
busy: boolean;
|
|
17
|
+
generate: () => Promise<void>;
|
|
18
|
+
preview: () => import("@cratis/scene.model").SceneDocument | undefined;
|
|
19
|
+
apply: () => boolean;
|
|
20
|
+
discard: () => void;
|
|
21
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CanvasPlacement } from '../Document/placeOnCanvas';
|
|
2
|
+
import type { PreparedSceneScreenDraft, SceneScreenDraftPreparation } from '../Drafting/SceneScreenDraft';
|
|
2
3
|
import type { ApplicationStructure, Behavior, DestinationReference, DialogTemplate, NavigationModel, Form, NodeInspection, Outlet, SceneDiagnostic, SceneDocument, SceneEdit, SceneElement, ScreenTemplate, TemplateMetadata } from '@cratis/scene.model';
|
|
3
4
|
import type { EditingContext, NavigationEdit } from '@cratis/scene.engine';
|
|
4
5
|
import type { Ownership } from '../Structure/Ownership';
|
|
@@ -26,6 +27,12 @@ export interface ScreenEditorController {
|
|
|
26
27
|
selectedItemId: string | undefined;
|
|
27
28
|
selectItem: (componentId: string | undefined, itemId: string | undefined) => void;
|
|
28
29
|
document: SceneDocument;
|
|
30
|
+
prepareSceneScreenDraft?: (answer: string, parameterlessQueryIds: readonly string[]) => SceneScreenDraftPreparation;
|
|
31
|
+
applySceneScreenDraft?: (draft: PreparedSceneScreenDraft) => {
|
|
32
|
+
applied: boolean;
|
|
33
|
+
problem?: string;
|
|
34
|
+
};
|
|
35
|
+
isSceneScreenDraftCurrent?: (draft: PreparedSceneScreenDraft) => boolean;
|
|
29
36
|
composition: EditorComposition;
|
|
30
37
|
context: EditingContext;
|
|
31
38
|
selectedId?: string;
|
|
@@ -5,6 +5,7 @@ import type { PaletteIcons, PaletteSource } from '../Palette/buildPalette';
|
|
|
5
5
|
import type { LayoutLabels } from '../Layouts/toLayoutContainerDescriptors';
|
|
6
6
|
import type { ScreenEditorEnvironment, ScreenEditorResult, ScreenEditorSubject } from './ScreenEditorHost';
|
|
7
7
|
import { type WindowSizeMemory } from '../Viewport/windowSizeMemory';
|
|
8
|
+
import type { SceneScreenDraftAgent } from '../Drafting/SceneScreenDraft';
|
|
8
9
|
export interface ScreenEditorOverlayProps {
|
|
9
10
|
subject: ScreenEditorSubject;
|
|
10
11
|
environment: ScreenEditorEnvironment;
|
|
@@ -25,6 +26,8 @@ export interface ScreenEditorOverlayProps {
|
|
|
25
26
|
onBeforeClose?: (result: ScreenEditorResult) => Promise<string | undefined>;
|
|
26
27
|
onDismiss?: () => void;
|
|
27
28
|
onPreview?: (document: SceneDocument) => void;
|
|
29
|
+
previewing?: boolean;
|
|
28
30
|
readOnly?: boolean;
|
|
31
|
+
draftAgent?: SceneScreenDraftAgent;
|
|
29
32
|
}
|
|
30
33
|
export declare const ScreenEditorOverlay: (props: ScreenEditorOverlayProps) => import("react").JSX.Element;
|
|
@@ -32,5 +32,6 @@ export interface ScreenEditorWindowProps {
|
|
|
32
32
|
onDiscard?: () => void;
|
|
33
33
|
onPreview?: (document: SceneDocument) => void;
|
|
34
34
|
readOnly?: boolean;
|
|
35
|
+
toolbarActions?: ReactNode;
|
|
35
36
|
}
|
|
36
|
-
export declare const ScreenEditorWindow: ({ controller, environment, strings, window: state, authoringTemplate, title, deviceFrame, saveFailure, onKeepEditing, onDiscard, onPreview, readOnly }: ScreenEditorWindowProps) => import("react").JSX.Element;
|
|
37
|
+
export declare const ScreenEditorWindow: ({ controller, environment, strings, window: state, authoringTemplate, title, deviceFrame, saveFailure, onKeepEditing, onDiscard, onPreview, readOnly, toolbarActions }: ScreenEditorWindowProps) => import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SceneScreenDraftStrings } from '../Drafting/SceneScreenDraftStrings';
|
|
1
2
|
import type { IconPickerLabels } from '@cratis/components/IconPicker';
|
|
2
3
|
import type { IconPropertyFieldStrings } from '../../Icons/IconPropertyFieldStrings';
|
|
3
4
|
import type { ComponentPickerStrings } from '../Palette/ComponentPicker';
|
|
@@ -288,6 +289,7 @@ export interface ScreenEditorStrings {
|
|
|
288
289
|
};
|
|
289
290
|
};
|
|
290
291
|
};
|
|
292
|
+
draft?: SceneScreenDraftStrings;
|
|
291
293
|
structureLabel: string;
|
|
292
294
|
structureEmpty: string;
|
|
293
295
|
moveUp: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { SampleDataMapping } from '@cratis/scene.model';
|
|
1
|
+
import type { SampleDataBinding, SampleDataMapping } from '@cratis/scene.model';
|
|
2
2
|
/**
|
|
3
3
|
* The sample data an application uses, chosen once in the UI Profile setup and inherited everywhere: the active pack,
|
|
4
|
-
*
|
|
4
|
+
* the shape to read model mappings that go with it and the read models bound to a pack of their own. It is the `sampleData` of Scene's `UiProfile`.
|
|
5
5
|
*/
|
|
6
6
|
export interface SampleDataSelectionSettings {
|
|
7
7
|
/** The active pack's identifier - an own pack or a blueprint's - or empty for the generated data. */
|
|
8
8
|
activePack: string;
|
|
9
9
|
/** The shapes the pack names that stand in for a read model of another name. */
|
|
10
10
|
mappings: SampleDataMapping[];
|
|
11
|
+
/** The read models bound to a pack of their own, which overrides the active pack for that read model. */
|
|
12
|
+
bindings: SampleDataBinding[];
|
|
11
13
|
}
|
|
12
14
|
/** No pack chosen, no mappings: the generated, deterministic data. */
|
|
13
15
|
export declare const noSampleData: SampleDataSelectionSettings;
|
|
@@ -13,12 +13,12 @@ export declare const sampleDataOf: (settings: Pick<UiProfileSettings, 'sampleDat
|
|
|
13
13
|
*
|
|
14
14
|
* @param left The first choice.
|
|
15
15
|
* @param right The second choice.
|
|
16
|
-
* @returns `true` when the same pack is active with the same mappings, whatever their order.
|
|
16
|
+
* @returns `true` when the same pack is active with the same mappings and bindings, whatever their order.
|
|
17
17
|
*/
|
|
18
18
|
export declare const areSampleDataEqual: (left: SampleDataSelectionSettings, right: SampleDataSelectionSettings) => boolean;
|
|
19
19
|
/**
|
|
20
20
|
* The Scene `sampleData` of a profile for a choice: what Stage, the CLI and the screen editor read to resolve the data, so Studio
|
|
21
|
-
* keeps no separate notion of it. Nothing is returned for the generated data with no mappings - the profile then has no `sampleData`
|
|
21
|
+
* keeps no separate notion of it. Nothing is returned for the generated data with no mappings or bindings - the profile then has no `sampleData`
|
|
22
22
|
* at all, as one declared without it has.
|
|
23
23
|
*
|
|
24
24
|
* @param selection The choice.
|