@cratis/event-models 0.240.1 → 0.242.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/Preview/previewDataView.d.ts +94 -0
- package/dist/screen-editor/ScreenEditor/Runtime/screenEditorRuntimeForProfile.d.ts +2 -1
- package/dist/screen-editor/ScreenEditor/Surface/DesignTime/designTimeDataComponents.d.ts +8 -0
- package/dist/screen-editor/ScreenEditor/Surface/DesignTime/sampleCellValue.d.ts +9 -0
- package/dist/screen-editor/ScreenEditor/Templates/nativeStandIns.d.ts +29 -0
- package/dist/screen-editor/UiProfile/StoredUiProfileShape.d.ts +53 -0
- package/dist/screen-editor/UiProfile/profileStyle.d.ts +19 -0
- package/dist/screen-editor/UiProfile/settingsFromPersisted.d.ts +17 -0
- package/dist/screen-editor/UiProfile/withStoredLook.d.ts +25 -0
- package/dist/screen-editor/UiProfile/withStoredRoot.d.ts +11 -0
- package/dist/screen-editor/index.js +2731 -2428
- package/dist/screen-editor/screen-editor.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** A data element of a screen: the query it reads, the read model it yields and whether that is a collection. */
|
|
2
|
+
export interface PreviewDataSource {
|
|
3
|
+
readonly query: string;
|
|
4
|
+
readonly typeName: string;
|
|
5
|
+
readonly isCollection: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** A column or a field of a table or a summary: the property it shows and the label it carries. */
|
|
8
|
+
export interface PreviewDataField {
|
|
9
|
+
readonly property: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Every data element of the screens: the pairs of a query and the read model it yields that the tables and summaries of the preview read their rows by.
|
|
14
|
+
*
|
|
15
|
+
* @param content Anything that holds screens.
|
|
16
|
+
* @returns The data sources, in the order they are met.
|
|
17
|
+
*/
|
|
18
|
+
export declare function previewDataSourcesOf(content: unknown): PreviewDataSource[];
|
|
19
|
+
/**
|
|
20
|
+
* The query a table or a summary of a read model reads its rows from: the one whose data element yields the same read model, a collection for a table and a
|
|
21
|
+
* single record for a summary, and the other kind when the screen has only that one.
|
|
22
|
+
*
|
|
23
|
+
* @param sources The data sources of the screens.
|
|
24
|
+
* @param typeName The read model the table or summary shows.
|
|
25
|
+
* @param wantsCollection Whether it is a table, which shows many rows.
|
|
26
|
+
* @returns The name of the query, or `undefined` when no data element yields that read model.
|
|
27
|
+
*/
|
|
28
|
+
export declare function queryOfTypeName(sources: readonly PreviewDataSource[], typeName: string, wantsCollection: boolean): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The rows a query's sample data answers, each a plain record.
|
|
31
|
+
*
|
|
32
|
+
* @param result What the render scope holds for the query.
|
|
33
|
+
* @returns The rows; none when the query has no sample data.
|
|
34
|
+
*/
|
|
35
|
+
export declare function rowsOfQueryResult(result: unknown): Record<string, unknown>[];
|
|
36
|
+
/**
|
|
37
|
+
* How a value reads in a cell: the text itself, a number as it is, a flag as yes or no, and what is nested as its JSON.
|
|
38
|
+
*
|
|
39
|
+
* @param value The value of the property in a row.
|
|
40
|
+
* @returns The text to show.
|
|
41
|
+
*/
|
|
42
|
+
export declare function cellText(value: unknown): string;
|
|
43
|
+
/**
|
|
44
|
+
* The columns or fields an element carries in one of its slots, in the order they are written.
|
|
45
|
+
*
|
|
46
|
+
* @param element The table or the summary.
|
|
47
|
+
* @param slot The slot that holds them: `columns` or `fields`.
|
|
48
|
+
* @returns The properties and their labels; a label that was not written is the property.
|
|
49
|
+
*/
|
|
50
|
+
export declare function previewFieldsOf(element: {
|
|
51
|
+
slots?: Record<string, readonly unknown[]>;
|
|
52
|
+
}, slot: string): PreviewDataField[];
|
|
53
|
+
/** A binding to a value: a path read from the row of a table (`item.orderId`), or from anywhere else the host can resolve. */
|
|
54
|
+
export interface PreviewBinding {
|
|
55
|
+
readonly path?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* How the bindings of an interaction on a row resolve: `item.<field>` is the field of that row - `with orderId from item.orderId` hands the order the person
|
|
59
|
+
* double clicked to the screen it opens - and everything else resolves as it does outside the row.
|
|
60
|
+
*
|
|
61
|
+
* @param row The row.
|
|
62
|
+
* @param outer How a binding resolves outside the row.
|
|
63
|
+
* @returns The resolver for the row.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveInRow<TBinding extends PreviewBinding>(row: Record<string, unknown>, outer: (binding: TBinding) => unknown): (binding: TBinding) => unknown;
|
|
66
|
+
/** What the preview does for the actions a row can start: it goes to the screen, and does nothing else - there is no backend behind a preview. */
|
|
67
|
+
export interface PreviewNavigator {
|
|
68
|
+
navigate(destination: {
|
|
69
|
+
screen: string;
|
|
70
|
+
}): unknown;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The seam the interactions of a table row run through in the preview. Navigating is the one effect a preview has; a command, a dialog and the rest
|
|
74
|
+
* answer as if nothing happened, because nothing is sent from a preview.
|
|
75
|
+
*
|
|
76
|
+
* @param navigator Where the preview goes when a row says to open a screen, or `undefined` outside a preview.
|
|
77
|
+
* @returns The dispatcher.
|
|
78
|
+
*/
|
|
79
|
+
export declare function previewRowDispatcher(navigator: PreviewNavigator | undefined): {
|
|
80
|
+
executeCommand: () => Promise<{
|
|
81
|
+
isSuccess: boolean;
|
|
82
|
+
}>;
|
|
83
|
+
navigate: (screen: string) => void;
|
|
84
|
+
navigateBack: () => void;
|
|
85
|
+
openDialog: () => Promise<{
|
|
86
|
+
isConfirmed: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
closeDialog: () => void;
|
|
89
|
+
refreshQuery: () => Promise<void>;
|
|
90
|
+
setState: () => void;
|
|
91
|
+
notify: () => void;
|
|
92
|
+
confirm: () => Promise<boolean>;
|
|
93
|
+
raise: () => Promise<void>;
|
|
94
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ScenePackageBundle } from '@cratis/scene.react';
|
|
2
2
|
import type { PersistedUiProfile } from '../../UiProfile/PersistedUiProfile';
|
|
3
3
|
import type { SampleDataSelectionSettings } from '../../UiProfile/SampleDataSelectionSettings';
|
|
4
|
+
import { type StoredLook } from '../../UiProfile/withStoredLook';
|
|
4
5
|
import type { ScreenEditorAppearance } from './ScreenEditorAppearance';
|
|
5
6
|
import { type ScreenEditorRuntime } from './screenEditorRuntime';
|
|
6
|
-
export declare function screenEditorRuntimeForProfile(applied?: PersistedUiProfile, bundles?: ScenePackageBundle[], appearance?: ScreenEditorAppearance, sampleData?: SampleDataSelectionSettings): ScreenEditorRuntime;
|
|
7
|
+
export declare function screenEditorRuntimeForProfile(applied?: PersistedUiProfile, bundles?: ScenePackageBundle[], appearance?: ScreenEditorAppearance, sampleData?: SampleDataSelectionSettings, look?: StoredLook): ScreenEditorRuntime;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ComponentRegistry } from '@cratis/scene.react';
|
|
2
|
+
/**
|
|
3
|
+
* The components the surface draws a screenplay table and summary with: the heading and labels the screen says, over sample rows and values.
|
|
4
|
+
*
|
|
5
|
+
* @param registry The runtime's registry, whose own table and summary draw what is not a screenplay's.
|
|
6
|
+
* @returns The registry entries that replace Scene's two for design time.
|
|
7
|
+
*/
|
|
8
|
+
export declare function designTimeDataComponents(registry: ComponentRegistry): ComponentRegistry;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const sampleRows = 3;
|
|
2
|
+
/**
|
|
3
|
+
* A sample value for a property of a read model.
|
|
4
|
+
*
|
|
5
|
+
* @param property The property name, as the table's column or the summary's field names it.
|
|
6
|
+
* @param row Which sample row it is for, so the rows differ.
|
|
7
|
+
* @returns The text to draw in the cell.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sampleCellValue(property: string, row: number): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SceneElement } from '@cratis/scene.model';
|
|
2
|
+
export interface NativeEntry {
|
|
3
|
+
at?: number;
|
|
4
|
+
text?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The stand-ins for what a screen keeps natively in one of its slots.
|
|
8
|
+
*
|
|
9
|
+
* @param entries The `native.slots[slot]` entries of the screen.
|
|
10
|
+
* @param slot The slot they sit in, which keeps their ids apart from the other slots'.
|
|
11
|
+
* @returns A read-only element for each directive the entries hold, in the order the entries state them.
|
|
12
|
+
*/
|
|
13
|
+
export declare function nativeStandIns(entries: readonly NativeEntry[] | undefined, slot: string): SceneElement[];
|
|
14
|
+
export interface FormStandInSource {
|
|
15
|
+
name?: string;
|
|
16
|
+
forCommand?: string;
|
|
17
|
+
fields?: {
|
|
18
|
+
name?: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The stand-ins for the command forms of a screen.
|
|
24
|
+
*
|
|
25
|
+
* @param forms The `forms` of the screen.
|
|
26
|
+
* @param placed The commands a form element already placed on the canvas stands for, which are not drawn twice.
|
|
27
|
+
* @returns A read-only form for each command that is not placed.
|
|
28
|
+
*/
|
|
29
|
+
export declare function formStandIns(forms: readonly FormStandInSource[] | undefined, placed?: ReadonlySet<string>): SceneElement[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** A reference to a template, as the application stores it. */
|
|
2
|
+
export interface StoredTemplateReference {
|
|
3
|
+
source: string;
|
|
4
|
+
blueprint: string;
|
|
5
|
+
id: string;
|
|
6
|
+
version: string;
|
|
7
|
+
isNone: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** The root template (the shell) and its options, as the application stores them. */
|
|
10
|
+
export interface StoredUiProfileRoot {
|
|
11
|
+
template: StoredTemplateReference;
|
|
12
|
+
optionsJson: string;
|
|
13
|
+
}
|
|
14
|
+
/** The defaults for new work, as the application stores them. */
|
|
15
|
+
export interface StoredUiProfileDefaults {
|
|
16
|
+
newScreenTemplate: StoredTemplateReference;
|
|
17
|
+
}
|
|
18
|
+
/** The complete profile in the root-template shape: what the designer saves. */
|
|
19
|
+
/** The application's name and logo as stored; every member empty takes Scene's default. */
|
|
20
|
+
export interface StoredUiProfileIdentity {
|
|
21
|
+
name: string;
|
|
22
|
+
logoKind: string;
|
|
23
|
+
initials: string;
|
|
24
|
+
icon: string;
|
|
25
|
+
image: string;
|
|
26
|
+
showName: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** The members Scene added for the designer, stored beside the root, appearance and defaults. */
|
|
29
|
+
export interface StoredUiProfileStyle {
|
|
30
|
+
identity: StoredUiProfileIdentity;
|
|
31
|
+
corners: string;
|
|
32
|
+
font: string;
|
|
33
|
+
}
|
|
34
|
+
export interface UiProfileDocumentValue {
|
|
35
|
+
packages: string[];
|
|
36
|
+
templatePacks: string[];
|
|
37
|
+
resolvedPackages: string[];
|
|
38
|
+
theme: string;
|
|
39
|
+
root: StoredUiProfileRoot;
|
|
40
|
+
appearance: {
|
|
41
|
+
colorScheme: string;
|
|
42
|
+
accent: string;
|
|
43
|
+
};
|
|
44
|
+
defaults: StoredUiProfileDefaults;
|
|
45
|
+
style: StoredUiProfileStyle;
|
|
46
|
+
}
|
|
47
|
+
/** What was stored before the designer opened, so what it does not edit is saved back as it was. */
|
|
48
|
+
export interface StoredUiProfileShape {
|
|
49
|
+
settings: import('./UiProfileSettings').UiProfileSettings;
|
|
50
|
+
root?: StoredUiProfileRoot;
|
|
51
|
+
defaults?: StoredUiProfileDefaults;
|
|
52
|
+
style?: StoredUiProfileStyle;
|
|
53
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StoredUiProfileStyle } from './StoredUiProfileShape';
|
|
2
|
+
import type { UiProfileSettings } from './UiProfileSettings';
|
|
3
|
+
/**
|
|
4
|
+
* Turns the identity, corners and font a draft holds into what the application stores. Anything the author left out is stored empty, which reads
|
|
5
|
+
* back as Scene's default: no member is invented here.
|
|
6
|
+
*
|
|
7
|
+
* @param settings The settings to store.
|
|
8
|
+
* @returns The stored style.
|
|
9
|
+
*/
|
|
10
|
+
export declare function styleOf(settings: UiProfileSettings): StoredUiProfileStyle;
|
|
11
|
+
/**
|
|
12
|
+
* Reads a stored style back into the choices a draft edits. A profile stored before the style existed has none and keeps Scene's defaults; a corner
|
|
13
|
+
* style this build does not know is dropped rather than thrown, so the page still opens.
|
|
14
|
+
*
|
|
15
|
+
* @param settings The settings read so far.
|
|
16
|
+
* @param style What was stored beside the profile, if anything.
|
|
17
|
+
* @returns The settings with the identity, corners and font.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withStoredStyle(settings: UiProfileSettings, style: StoredUiProfileStyle | undefined | null): UiProfileSettings;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ScenePackageBundle } from '@cratis/scene.react';
|
|
2
|
+
import { PersistedUiProfile } from './PersistedUiProfile';
|
|
3
|
+
import type { SampleDataSelectionSettings } from './SampleDataSelectionSettings';
|
|
4
|
+
import { UiProfileSettings } from './UiProfileSettings';
|
|
5
|
+
/**
|
|
6
|
+
* Reads stored settings back into the choices a draft edits.
|
|
7
|
+
*
|
|
8
|
+
* A stored color scheme or navigation mode this build does not know - written by a newer shell, say - falls
|
|
9
|
+
* back to the default rather than throwing, so the page still opens and the next apply repairs the value.
|
|
10
|
+
*
|
|
11
|
+
* @param persisted The stored profile.
|
|
12
|
+
* @param sampleData The application's sample data choice, which is stored apart from the profile; absent when none was made.
|
|
13
|
+
* @param bundles Every known package bundle. With them, a stored layout that is not the blueprint's first one is read back as the profile's root template; without
|
|
14
|
+
* them the profile is read as the blueprint's shell.
|
|
15
|
+
* @returns The {@link UiProfileSettings} it records.
|
|
16
|
+
*/
|
|
17
|
+
export declare function settingsFromPersisted(persisted: PersistedUiProfile, sampleData?: SampleDataSelectionSettings, bundles?: ScenePackageBundle[]): UiProfileSettings;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ScenePackageBundle } from '@cratis/scene.react';
|
|
2
|
+
import type { UiProfile } from '@cratis/scene.model';
|
|
3
|
+
import type { PersistedUiProfile } from './PersistedUiProfile';
|
|
4
|
+
import type { SampleDataSelectionSettings } from './SampleDataSelectionSettings';
|
|
5
|
+
import type { StoredUiProfileRoot, StoredUiProfileStyle } from './StoredUiProfileShape';
|
|
6
|
+
/** What an application stored beside the legacy members of its UI profile, which is the application's own look: the shell with its menu options and the identity, corners and font. */
|
|
7
|
+
export interface StoredLook {
|
|
8
|
+
/** The root template and the options of the shell (menu mode and theme), when the profile is in the root-template shape. */
|
|
9
|
+
root?: StoredUiProfileRoot;
|
|
10
|
+
/** The name, logo, corners and font, when the profile stored them. */
|
|
11
|
+
style?: StoredUiProfileStyle | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gives a Scene profile the application's own look: the accent and colour scheme, the logo and name, the corners and font, and the shell's menu mode
|
|
15
|
+
* and menu theme. The preview and the UI Profile designer draw from the same resolution, so an application previews as the designer shows it and as it
|
|
16
|
+
* will run - not in the theme's bare defaults, which is all the legacy members of the stored profile carry.
|
|
17
|
+
*
|
|
18
|
+
* @param profile The profile built from the legacy members.
|
|
19
|
+
* @param persisted The stored profile the legacy members are read from.
|
|
20
|
+
* @param look What the profile stored beside them.
|
|
21
|
+
* @param sampleData The application's sample data choice.
|
|
22
|
+
* @param bundles The bundles in play.
|
|
23
|
+
* @returns The profile with the look; the input when the application stored none.
|
|
24
|
+
*/
|
|
25
|
+
export declare function withStoredLook(profile: UiProfile, persisted: PersistedUiProfile, look: StoredLook | undefined, sampleData?: SampleDataSelectionSettings, bundles?: ScenePackageBundle[]): UiProfile;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoredUiProfileRoot } from './StoredUiProfileShape';
|
|
2
|
+
import type { UiProfileSettings } from './UiProfileSettings';
|
|
3
|
+
/**
|
|
4
|
+
* The settings with the root template the application stored: its template with its version pin, the options of the shell and the navigation mode among them.
|
|
5
|
+
* A profile that stored none (the legacy shape, or the bare shell) is left as it is - the blueprint's first layout is then its shell.
|
|
6
|
+
*
|
|
7
|
+
* @param settings What the legacy members say.
|
|
8
|
+
* @param root The stored root template, when the profile has one.
|
|
9
|
+
* @returns The settings, with `root` when the profile stored one.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withStoredRoot(settings: UiProfileSettings, root: StoredUiProfileRoot | undefined): UiProfileSettings;
|