@cratis/event-models 0.199.0 → 0.199.1

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.
@@ -1,10 +1,12 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { ApplicationStructure, NavigationModel } from '@cratis/scene.model';
2
+ import type { ApplicationStructure, DestinationReference, NavigationModel } from '@cratis/scene.model';
3
3
  export interface EditorNavigationScopeProps {
4
4
  structure: ApplicationStructure;
5
5
  navigation: NavigationModel;
6
6
  module: string | undefined;
7
7
  logoLockedReason: string;
8
+ onNavigate?: (destination: DestinationReference) => void;
9
+ peeking?: string;
8
10
  children: ReactNode;
9
11
  }
10
- export declare const EditorNavigationScope: ({ structure, navigation, module, logoLockedReason, children }: EditorNavigationScopeProps) => import("react").JSX.Element;
12
+ export declare const EditorNavigationScope: ({ structure, navigation, module, logoLockedReason, onNavigate, peeking, children }: EditorNavigationScopeProps) => import("react").JSX.Element;
@@ -23,10 +23,11 @@ export interface ScreenEditorWindowProps {
23
23
  environment: ScreenEditorEnvironment;
24
24
  strings: ScreenEditorStrings;
25
25
  window: ScreenEditorWindowState;
26
+ authoringTemplate?: string;
26
27
  deviceFrame?: boolean;
27
28
  saveFailure?: string;
28
29
  onSave?: () => void;
29
30
  isSaving?: boolean;
30
31
  onPreview?: (document: SceneDocument) => void;
31
32
  }
32
- export declare const ScreenEditorWindow: ({ controller, environment, strings, window: state, deviceFrame, saveFailure, onSave, isSaving, onPreview }: ScreenEditorWindowProps) => import("react").JSX.Element;
33
+ export declare const ScreenEditorWindow: ({ controller, environment, strings, window: state, authoringTemplate, deviceFrame, saveFailure, onSave, isSaving, onPreview }: ScreenEditorWindowProps) => import("react").JSX.Element;
@@ -14,5 +14,6 @@ export interface ScreenEditorEnvironmentSource {
14
14
  richText?: QuillLoader | false;
15
15
  fileUpload?: ScreenEditorFileUpload;
16
16
  templateScope?: TemplateScope;
17
+ navigation?: ScreenEditorEnvironment['navigation'];
17
18
  }
18
19
  export declare function createScreenEditorEnvironment(source: ScreenEditorEnvironmentSource): ScreenEditorEnvironment;
@@ -20,6 +20,10 @@ export interface ScreenEditorStrings {
20
20
  openInspector: string;
21
21
  closeInspector: string;
22
22
  desktopPreview: string;
23
+ showApplicationShell: string;
24
+ hideApplicationShell: string;
25
+ shellPeeking: (name: string) => string;
26
+ shellPeekBack: string;
23
27
  mobilePreview: string;
24
28
  sizeClass: (width: string, height: string) => string;
25
29
  viewportSize: (width: number, height: number) => string;
@@ -4,6 +4,10 @@ export interface ViewportControlsProps {
4
4
  windowSize: ViewportSize;
5
5
  available: ViewportSize;
6
6
  strings: ScreenEditorStrings;
7
+ shell?: {
8
+ shown: boolean;
9
+ toggle: () => void;
10
+ };
7
11
  onResize: (size: ViewportSize) => void;
8
12
  }
9
- export declare const ViewportControls: ({ windowSize, available, strings, onResize }: ViewportControlsProps) => import("react").JSX.Element;
13
+ export declare const ViewportControls: ({ windowSize, available, strings, shell, onResize }: ViewportControlsProps) => import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ export declare enum ShellPointer {
2
+ NotShell = "notShell",
3
+ Navigate = "navigate",
4
+ Ignore = "ignore"
5
+ }
6
+ export declare const screenSelector = "[data-scene-id=\"composition\"], [data-studio-element=\"composition\"]";
7
+ export declare const navigationEntrySelector = "[data-scene-nav-item], [data-target-screen]";
8
+ export declare function decideShellPointer(target: EventTarget | null, shellShown: boolean): ShellPointer;
@@ -0,0 +1,11 @@
1
+ import { type SceneDocument, type SceneElement } from '@cratis/scene.model';
2
+ import type { EffectiveShell, TemplateLibrary } from '@cratis/scene.engine';
3
+ import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
4
+ export declare function shellLibraryOf(runtime: ScreenEditorRuntime, document: SceneDocument): TemplateLibrary;
5
+ export declare const shellContentId = "studio-shell-content";
6
+ export interface ShellFrame {
7
+ element: SceneElement;
8
+ shell: EffectiveShell;
9
+ }
10
+ export declare function effectiveShellFor(runtime: ScreenEditorRuntime, document: SceneDocument): EffectiveShell;
11
+ export declare function composeShellFrame(runtime: ScreenEditorRuntime, document: SceneDocument): ShellFrame;
@@ -0,0 +1,4 @@
1
+ import { type DestinationReference, type SceneElement } from '@cratis/scene.model';
2
+ export declare function peekNameOf(destination: DestinationReference): string;
3
+ export declare function canPeek(destination: DestinationReference): boolean;
4
+ export declare function peekElement(destination: DestinationReference, text: string): SceneElement;
@@ -0,0 +1,20 @@
1
+ import type { SceneDocument } from '@cratis/scene.model';
2
+ export declare enum ShellSubject {
3
+ Screen = "screen",
4
+ ScreenTemplate = "screenTemplate",
5
+ DialogTemplate = "dialogTemplate",
6
+ TheShell = "theShell"
7
+ }
8
+ export declare function shellSubjectOf(document: SceneDocument, authoringTemplate: string | undefined, shellName: string): ShellSubject;
9
+ export declare const shellShownByDefault: (subject: ShellSubject) => boolean;
10
+ export declare const shellCanFrame: (subject: ShellSubject) => boolean;
11
+ export interface ShellPreferenceStorage {
12
+ getItem(key: string): string | null;
13
+ setItem(key: string, value: string): void;
14
+ }
15
+ export interface ShellPreference {
16
+ read(subject: ShellSubject): boolean | undefined;
17
+ write(subject: ShellSubject, shown: boolean): void;
18
+ }
19
+ export declare const browserShellPreferenceStorage: () => ShellPreferenceStorage | undefined;
20
+ export declare function createShellPreference(storage?: ShellPreferenceStorage | undefined): ShellPreference;
@@ -0,0 +1,2 @@
1
+ import type { SceneElement } from '@cratis/scene.model';
2
+ export declare function spliceContent(root: SceneElement, id: string, content: SceneElement): SceneElement;
@@ -0,0 +1,15 @@
1
+ import type { DestinationReference, SceneDocument } from '@cratis/scene.model';
2
+ import type { ScreenEditorRuntime } from '../Runtime/screenEditorRuntime';
3
+ import { type ShellFrame } from './frameInShell';
4
+ import { type ShellPreference } from './shellVisibility';
5
+ export interface ShellState {
6
+ available: boolean;
7
+ shown: boolean;
8
+ toggle(): void;
9
+ frame?: ShellFrame;
10
+ peeking?: DestinationReference;
11
+ peekingName: string;
12
+ navigate(destination: DestinationReference): void;
13
+ back(): void;
14
+ }
15
+ export declare function useShellFrame(document: SceneDocument, runtime: ScreenEditorRuntime, authoringTemplate: string | undefined, preference?: ShellPreference): ShellState;
@@ -4,6 +4,7 @@ import type { ScreenEditorController } from '../Host/ScreenEditorController';
4
4
  import type { ScreenEditorEnvironment } from '../Host/ScreenEditorHost';
5
5
  import type { SurfaceStrings } from './DesignTime/SurfaceStrings';
6
6
  import type { ScreenEditorStrings } from '../Inspector/ScreenEditorStrings';
7
+ import type { ShellState } from '../ShellFrame/useShellFrame';
7
8
  export interface ScreenSurfaceProps {
8
9
  controller: ScreenEditorController;
9
10
  environment: ScreenEditorEnvironment;
@@ -12,5 +13,6 @@ export interface ScreenSurfaceProps {
12
13
  strings: SurfaceStrings;
13
14
  editorStrings?: ScreenEditorStrings;
14
15
  viewportHeight?: number;
16
+ shell?: ShellState;
15
17
  }
16
- export declare const ScreenSurface: ({ controller, environment, resolveBinding, configuration: given, strings, editorStrings, viewportHeight }: ScreenSurfaceProps) => import("react").JSX.Element;
18
+ export declare const ScreenSurface: ({ controller, environment, resolveBinding, configuration: given, strings, editorStrings, viewportHeight, shell }: ScreenSurfaceProps) => import("react").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { type RefObject } from 'react';
2
- export declare function useDesignTimePointer(surface: RefObject<HTMLElement | null>, select: (id: string | undefined, itemId?: string) => void): void;
2
+ export declare function useDesignTimePointer(surface: RefObject<HTMLElement | null>, select: (id: string | undefined, itemId?: string) => void, shellShown?: boolean): void;
@@ -1,4 +1,5 @@
1
1
  import { ColorScheme, LayoutMode } from '@cratis/scene.blueprint.default';
2
+ import type { RootTemplate } from '@cratis/scene.model';
2
3
  import type { SampleDataSelectionSettings } from './SampleDataSelectionSettings';
3
4
  /**
4
5
  * The choices that make up an application's UI profile - what a draft edits and what applying persists.
@@ -13,8 +14,13 @@ export interface UiProfileSettings {
13
14
  * in ascending override priority. `core` is never listed: it is always the final fallback.
14
15
  */
15
16
  packages: string[];
16
- /** The blueprint supplying the application shell, or empty when none is chosen. */
17
+ /** The blueprint supplying the application shell, or empty when none is chosen. For a root template that is the blueprint's, it names that blueprint. */
17
18
  shell: string;
19
+ /**
20
+ * The application's root template - its shell - and the options the shell is given. Absent for a profile that only names a blueprint
21
+ * (`shell`): the blueprint's first layout is then the shell. Scene's `resolveEffectiveShell` reads the same shape.
22
+ */
23
+ root?: RootTemplate;
18
24
  /** Further blueprints whose reusable templates are available without changing the shell. */
19
25
  templatePacks: string[];
20
26
  /** The name of the theme, or empty to take the first one compatible with the profile. */
@@ -0,0 +1,10 @@
1
+ import { ScenePackageBundle } from '@cratis/scene.react';
2
+ import { UiProfileSettings } from './UiProfileSettings';
3
+ /**
4
+ * The layout the profile's root template names, when the root is a blueprint's layout the bundles know.
5
+ *
6
+ * @param settings The settings to read.
7
+ * @param bundles Every known package bundle.
8
+ * @returns The layout name, or `undefined` when the profile has no such root (the shell's first layout is then the shell).
9
+ */
10
+ export declare function rootLayoutOf(settings: UiProfileSettings, bundles: ScenePackageBundle[]): string | undefined;