@cratis/event-models 0.261.8 → 0.262.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.
@@ -22,6 +22,8 @@ export interface ScreenEditorStrings {
22
22
  desktopPreview: string;
23
23
  showApplicationShell: string;
24
24
  hideApplicationShell: string;
25
+ showTemplate: string;
26
+ hideTemplate: string;
25
27
  shellPeeking: (name: string) => string;
26
28
  shellPeekBack: string;
27
29
  mobilePreview: string;
@@ -8,6 +8,10 @@ export interface ViewportControlsProps {
8
8
  shown: boolean;
9
9
  toggle: () => void;
10
10
  };
11
+ template?: {
12
+ shown: boolean;
13
+ toggle: () => void;
14
+ };
11
15
  onResize: (size: ViewportSize) => void;
12
16
  }
13
- export declare const ViewportControls: ({ windowSize, available, strings, shell, onResize }: ViewportControlsProps) => import("react").JSX.Element;
17
+ export declare const ViewportControls: ({ windowSize, available, strings, shell, template, onResize }: ViewportControlsProps) => import("react").JSX.Element;
@@ -7,6 +7,8 @@ export declare enum ShellSubject {
7
7
  }
8
8
  export declare function shellSubjectOf(document: SceneDocument, authoringTemplate: string | undefined, shellName: string): ShellSubject;
9
9
  export declare const shellShownByDefault: (subject: ShellSubject) => boolean;
10
+ export declare const templateShownByDefault: (_subject: ShellSubject) => boolean;
11
+ export declare const templateCanFrame: (subject: ShellSubject) => boolean;
10
12
  export declare const shellCanFrame: (subject: ShellSubject) => boolean;
11
13
  export interface ShellPreferenceStorage {
12
14
  getItem(key: string): string | null;
@@ -15,6 +17,8 @@ export interface ShellPreferenceStorage {
15
17
  export interface ShellPreference {
16
18
  read(subject: ShellSubject): boolean | undefined;
17
19
  write(subject: ShellSubject, shown: boolean): void;
20
+ readTemplate(subject: ShellSubject): boolean | undefined;
21
+ writeTemplate(subject: ShellSubject, shown: boolean): void;
18
22
  }
19
23
  export declare const browserShellPreferenceStorage: () => ShellPreferenceStorage | undefined;
20
24
  export declare function createShellPreference(storage?: ShellPreferenceStorage | undefined): ShellPreference;
@@ -6,10 +6,15 @@ export interface ShellState {
6
6
  available: boolean;
7
7
  shown: boolean;
8
8
  toggle(): void;
9
+ template: {
10
+ available: boolean;
11
+ shown: boolean;
12
+ toggle(): void;
13
+ };
9
14
  frame?: ShellFrame;
10
15
  peeking?: DestinationReference;
11
16
  peekingName: string;
12
17
  navigate(destination: DestinationReference): void;
13
18
  back(): void;
14
19
  }
15
- export declare function useShellFrame(document: SceneDocument, runtime: ScreenEditorRuntime, authoringTemplate: string | undefined, preference?: ShellPreference): ShellState;
20
+ export declare function useShellFrame(document: SceneDocument, runtime: ScreenEditorRuntime, authoringTemplate: string | undefined, preference?: ShellPreference, hasTemplate?: boolean): ShellState;
@@ -0,0 +1,15 @@
1
+ import type { Panel } from '@cratis/scene.model';
2
+ import type { OwnershipResolver } from '../Structure/OwnershipResolver';
3
+ import { type EditorComposition } from './composeEditorScreen';
4
+ /**
5
+ * The composition without what the screen's templates put around its own content: a slice's prototype is the slice's content, and the template (and the
6
+ * application shell around it) are there to see in context only when the author asks for them.
7
+ *
8
+ * What is dropped is only what is drawn. The document, the structure, the selection and the drop regions are still the full composition's, so showing the
9
+ * template again puts back exactly what was there.
10
+ *
11
+ * @param composition The composition the editor edits.
12
+ * @param ownershipOf Who owns an element, relative to the scope being edited.
13
+ * @returns The composition's element, with only the elements the screen itself authored.
14
+ */
15
+ export declare function ownContentOnly(composition: EditorComposition, ownershipOf: OwnershipResolver): Panel;