@cratis/stage.runtime 4.219.0 → 4.221.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.
@@ -0,0 +1,25 @@
1
+ export type StageModelReferenceKind = 'module' | 'feature' | 'slice' | 'screen';
2
+ /** The identifier the source model gave to one element of a published application. */
3
+ export interface StageModelReference {
4
+ kind: StageModelReferenceKind;
5
+ /** The dot-separated qualified name, for example `Shop.Orders.PlaceOrder`. */
6
+ name: string;
7
+ id: string;
8
+ }
9
+ /** What a published application knows about its own model, served by `stage/model-references`. */
10
+ export interface StageModelReferences {
11
+ applicationName: string;
12
+ publishedName: string;
13
+ applicationVersion: string;
14
+ publicationId: string;
15
+ /** Empty when the source model supplied no identifiers. */
16
+ references: StageModelReference[];
17
+ /** Whether the host serves the Notes backend, so the feedback button and its provider are worth rendering. */
18
+ notesEnabled?: boolean;
19
+ }
20
+ /** Reads the model references of a published application; a sandbox host has none and answers `undefined`. */
21
+ export declare function fetchModelReferences(signal?: AbortSignal, fetcher?: typeof fetch): Promise<StageModelReferences | undefined>;
22
+ /** The identifier the source model gave to the named element, if it gave one. */
23
+ export declare function modelReferenceFor(references: StageModelReferences | undefined, kind: StageModelReferenceKind, name: string): string | undefined;
24
+ /** The model reference map feedback carries: the identifier the source model gave to each element, by its qualified name. */
25
+ export declare function modelReferenceMap(references: StageModelReferences | undefined): Record<string, string>;
@@ -0,0 +1,34 @@
1
+ import type { ApplicationStructure, Screen } from '@cratis/scene.model';
2
+ /** Where a slice sits in the application, the way Arc's `<Slice>` and the Notes context name it. */
3
+ export interface StageSliceLocation {
4
+ module: string;
5
+ feature: string;
6
+ slice: string;
7
+ }
8
+ /** What the host says about feedback: whether Notes is served, and the identifiers of the model's elements by qualified name. */
9
+ export interface StageNotesState {
10
+ enabled: boolean;
11
+ modelReferences: Record<string, string>;
12
+ }
13
+ /** Reads the host's feedback state from the model references document; a host without one has Notes off. */
14
+ export declare function readStageNotes(signal: AbortSignal, fetcher?: typeof fetch): Promise<StageNotesState>;
15
+ /** Reads what the host says about Notes once; a host that says nothing (a sandbox) has Notes off. */
16
+ export declare function useStageNotes(): StageNotesState;
17
+ /** Every slice the application knows, for the slice search of the feedback dialog. */
18
+ export declare function knownSlicesOf(structure: ApplicationStructure | undefined): StageSliceLocation[];
19
+ /**
20
+ * Where the named slice is: by its qualified name (`Module.Feature.Slice`), or by the command it carries. Undefined when the structure does not
21
+ * contain it.
22
+ */
23
+ export declare function locateSlice(structure: ApplicationStructure | undefined, nameOrCommand: string | undefined): StageSliceLocation | undefined;
24
+ /**
25
+ * Where a screen is: its module and feature from the ancestry the model recorded, and the slice it shows when the structure has a slice of the
26
+ * screen's name there. A screen without ancestry is somewhere in the application without a module or feature.
27
+ */
28
+ export declare function locateScreen(structure: ApplicationStructure | undefined, screen: Screen | undefined): StageSliceLocation | undefined;
29
+ /** What Arc's application context is told about the screen being shown: its identity and the module and feature ancestry it sits in. */
30
+ export declare function screenContribution(screen: Screen | undefined): {
31
+ id: string;
32
+ name: string;
33
+ path: string;
34
+ } | undefined;
@@ -2,12 +2,15 @@ import { type ReactNode } from 'react';
2
2
  import type { StringsDictionary } from '@cratis/scene.engine';
3
3
  import type { StageRoutes } from './stageRoutes';
4
4
  import type { StageSceneApplication } from './App';
5
+ import type { StageNotesState } from './stageNotes';
5
6
  /** The content supplied by the host of a Stage application. */
6
7
  export interface StageSource {
7
8
  scene(signal: AbortSignal): Promise<StageSceneApplication>;
8
9
  routes(signal: AbortSignal): Promise<StageRoutes | undefined>;
9
10
  locales(signal: AbortSignal): Promise<string[]>;
10
11
  strings(locale: string, signal: AbortSignal): Promise<StringsDictionary>;
12
+ /** What the host says about feedback: whether Notes is served, and the model references. A source with nothing to say omits it. */
13
+ notes?(signal: AbortSignal): Promise<StageNotesState>;
11
14
  }
12
15
  /** What a generated application already holds when it is built. */
13
16
  export interface StageStaticContent {
@@ -22,6 +25,7 @@ export declare const stageEndpoints: {
22
25
  scene: string;
23
26
  routes: string;
24
27
  locales: string;
28
+ modelReferences: string;
25
29
  strings: (locale: string) => string;
26
30
  };
27
31
  /** Supplies the source the runtime below reads from. Transport belongs to the host. */
@@ -0,0 +1,21 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { ApplicationStructure, Screen } from '@cratis/scene.model';
3
+ interface StageStructure {
4
+ structure?: ApplicationStructure;
5
+ screens: Screen[];
6
+ }
7
+ /** Gives the screens and dialogs below the structure of the application, so they can declare which slice they are. */
8
+ export declare function StageStructureProvider({ structure, screens, children }: StageStructure & {
9
+ children: ReactNode;
10
+ }): import("react").JSX.Element;
11
+ /** Declares the slice a screen shows, so the markers and the application context know where the user is. */
12
+ export declare function ScreenSlice({ screen, children }: {
13
+ screen: string | undefined;
14
+ children: ReactNode;
15
+ }): import("react").JSX.Element;
16
+ /** Declares the slice a dialog was opened for, named by its qualified name or by its command. */
17
+ export declare function DialogSlice({ slice, children }: {
18
+ slice: string | undefined;
19
+ children: ReactNode;
20
+ }): import("react").JSX.Element;
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/stage.runtime",
3
- "version": "4.219.0",
3
+ "version": "4.221.0",
4
4
  "description": "The Cratis Stage application runtime for Arc and Scene",
5
5
  "author": "Cratis",
6
6
  "type": "module",
@@ -41,19 +41,21 @@
41
41
  "test": "vitest run"
42
42
  },
43
43
  "peerDependencies": {
44
- "@cratis/arc": "22.146.0",
45
- "@cratis/arc.react": "22.146.0",
46
- "@cratis/components": "4.38.1",
47
- "@cratis/fundamentals": "7.27.1",
48
- "@cratis/scene.blueprint.default": "4.87.0",
49
- "@cratis/scene.components": "4.87.0",
50
- "@cratis/scene.engine": "4.87.0",
51
- "@cratis/scene.model": "4.87.0",
52
- "@cratis/scene.primereact": "4.87.0",
53
- "@cratis/scene.react": "4.87.0",
44
+ "@cratis/arc": "22.166.1",
45
+ "@cratis/arc.react": "22.166.1",
46
+ "@cratis/components": "4.40.0",
47
+ "@cratis/fundamentals": "7.33.1",
48
+ "@cratis/scene.blueprint.default": "4.88.0",
49
+ "@cratis/scene.components": "4.88.0",
50
+ "@cratis/scene.engine": "4.88.0",
51
+ "@cratis/scene.model": "4.88.0",
52
+ "@cratis/scene.primereact": "4.88.0",
53
+ "@cratis/scene.react": "4.88.0",
54
+ "@cratis/showrunner.notes": "1.0.0",
55
+ "@cratis/showrunner.notes.react": "1.0.0",
54
56
  "@primereact/ui": "11.2.2",
55
- "@primeuix/themes": "3.0.1",
56
- "lucide-react": "1.52.0",
57
+ "@primeuix/themes": "3.1.0",
58
+ "lucide-react": "1.68.0",
57
59
  "primereact": "11.2.2",
58
60
  "react": "19.3.1",
59
61
  "react-dom": "19.3.1",
@@ -79,10 +81,10 @@
79
81
  "@types/node": "26.6.6",
80
82
  "@types/react": "19.3.0",
81
83
  "@types/react-dom": "19.3.0",
82
- "@vitejs/plugin-react": "6.1.2",
84
+ "@vitejs/plugin-react": "6.2.1",
83
85
  "jsdom": "30.1.3",
84
86
  "react-dom": "19.3.1",
85
87
  "typescript": "6.0.3",
86
- "vitest": "5.0.5"
88
+ "vitest": "5.1.0"
87
89
  }
88
90
  }