@cratis/stage.runtime 4.214.0 → 4.216.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/src/App.d.ts CHANGED
@@ -9,6 +9,7 @@ import '@cratis/components/Common/styles';
9
9
  import '@cratis/components/Display/styles';
10
10
  import '@cratis/scene.blueprint.default/styles.css';
11
11
  import { type ApplicationIdentity } from './blueprint';
12
+ import { type StageResponseContracts } from './stageResponseContracts';
12
13
  import { type StageRouting } from './stageNavigation';
13
14
  import './app.css';
14
15
  export interface StageSceneApplication {
@@ -26,6 +27,7 @@ export interface StageSceneApplication {
26
27
  structure?: ApplicationStructure;
27
28
  /** The JSON schema of every modeled command, by name, which a toolbar slice's task dialog reads its fields from. */
28
29
  commandSchemas?: Record<string, string>;
30
+ responseContracts?: StageResponseContracts;
29
31
  }
30
32
  /**
31
33
  * The registry a Stage renders with: Scene's core vocabulary, the libraries the profile lists (PrimeReact only then) and the default blueprint, then any
@@ -48,7 +50,7 @@ export declare function stageShellOf(scene: StageSceneApplication, screenTemplat
48
50
  * What the Stage decides about composing a screen, on top of the composition it shares with the preview: its own chrome around the
49
51
  * shell (the effective navigation regions are Scene's), its command form, its status line and its data sources.
50
52
  */
51
- export declare function stageComposition(scene: StageSceneApplication, locales: string[], locale: string, packageCatalog?: PackageCatalog, dictionary?: Record<string, string>, blueprintTemplates?: ScreenTemplate[], showFooter?: boolean): CompositionOptions;
53
+ export declare function stageComposition(scene: StageSceneApplication, locales: string[], locale: string, packageCatalog?: PackageCatalog, dictionary?: Record<string, string>, blueprintTemplates?: ScreenTemplate[], showFooter?: boolean, showThemeSwitcher?: boolean): CompositionOptions;
52
54
  /**
53
55
  * What the application calls itself and how it draws its mark: the logo its navigation declares, otherwise the `identity` of the ui profile
54
56
  * (its name, an icon logo and whether the name is shown), so the model's own title replaces the Stage's. Undefined when the model says neither.
@@ -13,12 +13,14 @@ export declare const StageDialogContext: import("react").Context<(() => void) |
13
13
  export declare const StageDialogFooterContext: import("react").Context<HTMLElement | null>;
14
14
  interface StageCommandFormProps {
15
15
  element: ExternalComponent;
16
+ /** Offers a Cancel button beside the submit when the dialog around the form has none of its own. */
17
+ cancellable?: boolean;
16
18
  }
17
19
  interface StageCommandContent {
18
20
  [key: string]: unknown;
19
21
  }
20
22
  /** Renders an authored screen form through Cratis Arc's native CommandForm boundary. */
21
- export declare function StageCommandForm({ element }: StageCommandFormProps): import("react").JSX.Element;
23
+ export declare function StageCommandForm({ element, cancellable }: StageCommandFormProps): import("react").JSX.Element;
22
24
  /**
23
25
  * The identity a session acts as - the shopper's basket - for the identifier properties a form does not show.
24
26
  *
@@ -0,0 +1,19 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type WrappedFieldProps } from '@cratis/arc.react/commands';
3
+ import type { SchemaProperty, SchemaReference } from './stageFormSchema';
4
+ interface ReferenceInputProps extends WrappedFieldProps<unknown> {
5
+ id?: string;
6
+ reference: SchemaReference;
7
+ title: string;
8
+ disabled?: boolean;
9
+ }
10
+ /** Leaves ordinary fields unchanged; replaces only a field with a modeled reference. */
11
+ export declare function withReferenceField(descriptor: SchemaProperty | undefined, props: {
12
+ value: (command: unknown) => unknown;
13
+ fieldName: string;
14
+ title: string;
15
+ required: boolean;
16
+ }, fallback: ReactNode): ReactNode;
17
+ /** A reference picker bound to Arc's native command field value and validation. */
18
+ export declare const StageReferenceField: (<TCommand = unknown>(props: import("@cratis/arc.react/commands").CommandFormFieldComponentProps<ReferenceInputProps, TCommand>) => React.ReactElement) & import("@cratis/arc.react/commands").CommandFormMarked;
19
+ export {};
package/dist/src/app.css CHANGED
@@ -1,2 +1,2 @@
1
- body{min-width:20rem;min-height:100vh;margin:0;font-family:system-ui,-apple-system,Segoe UI,sans-serif}button{font:inherit}:root[data-scene-color-scheme=dark] .layout-menu-dark{--layout-sidebar-surface:color-mix(in srgb, var(--layout-background) 70%, black);--layout-sidebar-text:var(--layout-text);--layout-sidebar-muted:var(--layout-text-muted);--layout-sidebar-hover:color-mix(in srgb, var(--layout-text) 10%, transparent)}.stage-message{text-align:center;place-content:center;min-height:100vh;padding:2rem;display:grid}.stage-activity{background:var(--layout-highlight,#eef2ff);border-radius:var(--layout-radius,.5rem);color:var(--layout-highlight-text,#3730a3);margin-top:1rem;padding:.75rem}.stage-locale{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);color:var(--layout-text,inherit);padding:.35rem .5rem}.stage-table{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);min-width:0;padding:.5rem;overflow-x:auto}.stage-table table{border-collapse:collapse;width:100%}.stage-table th,.stage-table td{border-bottom:1px solid var(--layout-border,#e2e5e9);text-align:left;padding:.5rem .75rem}.stage-table th{color:var(--layout-text-muted,#6b7280);text-transform:uppercase;white-space:nowrap;font-size:.85rem;font-weight:600}.stage-table tbody tr[tabindex]{cursor:pointer}.stage-table tbody tr[tabindex]:hover td{background:var(--layout-background,#f8fafc)}.stage-table tbody tr[aria-selected=true] td,.stage-table tbody tr[aria-selected=true]:hover td{background:var(--layout-highlight,#eef2ff);color:var(--layout-highlight-text,#3730a3)}.stage-table tbody tr[aria-selected=true] td:first-child{box-shadow:inset 3px 0 0 var(--layout-highlight-text,#3730a3)}.stage-empty{color:var(--layout-text-muted,#6b7280);font-style:italic}.stage-note{color:var(--layout-text-muted,#6b7280);margin:0 0 .5rem}.stage-note--error{color:#dc2626}.stage-action{justify-items:start;gap:.75rem;display:grid}.stage-command-form__layout{gap:var(--layout-gap,1rem);width:100%;min-width:0;display:grid}.stage-command-form__field{min-width:0;display:block}.stage-command-form__field small.p-error{min-height:1.25rem;margin:.25rem 0 0;line-height:1.25rem}.stage-command-form__field:not(:has(small.p-error)):after{content:"";min-height:1.5rem;display:block}.stage-record-field,.stage-list-field{border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);gap:.6rem;min-width:0;margin:0;padding:.75rem;display:grid}.stage-record-field legend,.stage-list-field legend{padding:0 .35rem;font-weight:600}.stage-record-field[data-invalid=true],.stage-list-field[data-invalid=true]{border-color:#dc2626}.stage-list-field__row{grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:.5rem;display:grid}.stage-value-field{gap:.25rem;display:grid}.stage-value-field--check{align-items:center;gap:.5rem;display:flex}.stage-value-field>span{color:var(--layout-text-muted,#6b7280);font-size:.85rem}.stage-value-field input:not([type=checkbox]),.stage-value-field select{background:var(--layout-background,#fff);border:1px solid var(--layout-border,#e2e5e9);color:inherit;font:inherit;border-radius:.3rem;padding:.45rem .6rem}.stage-form{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);gap:.6rem;min-width:20rem;padding:1rem;display:grid}.stage-form label{gap:.25rem;display:grid}.stage-form span{color:var(--layout-text-muted,#6b7280);font-size:.85rem}.stage-form input{background:var(--layout-background,#fff);border:1px solid var(--layout-border,#e2e5e9);color:inherit;border-radius:.3rem;padding:.45rem .6rem}pre{background:var(--layout-background,#f4f5f7);border-radius:.4rem;padding:1rem;overflow:auto}[role=table] header{gap:1rem;font-weight:600;display:flex}.stage-dialog-backdrop{z-index:1000;background:#00000073;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.stage-dialog{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);color:var(--layout-text,inherit);gap:.75rem;min-width:min(90vw,24rem);max-width:min(90vw,48rem);max-height:90vh;padding:1rem;display:grid;overflow:auto;box-shadow:0 1rem 3rem #0000004d}.stage-dialog>button{justify-self:end}.stage-confirm-dialog__decisions{flex-wrap:wrap;gap:.5rem;display:flex}.stage-confirm-dialog__decision[aria-pressed=true]{box-shadow:var(--scene-focus-ring,0 0 0 2px #4f46e566)}.stage-confirm-dialog button[type=submit]{background:var(--scene-primary-color,#4f46e5);border:1px solid var(--scene-primary-color,#4f46e5);border-radius:var(--scene-content-border-radius,.5rem);color:var(--scene-primary-contrast-color,#fff);cursor:pointer;font:inherit;justify-self:end;padding:.55rem 1.1rem}.stage-confirm-dialog button[type=submit]:focus-visible{box-shadow:var(--scene-focus-ring,0 0 0 2px #4f46e566);outline:none}.stage-command-form__field>div,.stage-command-form__field .cratis-dropdown,.stage-command-form__field .cratis-field-input{box-sizing:border-box;width:100%}.stage-command-form__field .cratis-dropdown__select,.stage-command-form__field .cratis-dropdown__trigger{width:100%}.stage-command-form__submit,.scene-slice-dialog-submit{font:inherit;cursor:pointer;color:var(--scene-primary-contrast-color,#fff);background:var(--scene-primary-color,#4f46e5);border:1px solid var(--scene-primary-color,#4f46e5);border-radius:var(--scene-content-border-radius,.5rem);padding:.55rem 1.1rem}.stage-command-form__submit,.scene-slice-dialog-footer{margin-top:1rem}.stage-theme-toggle{flex-direction:column;align-items:center;display:flex}.stage-theme-toggle__button{cursor:pointer;width:2.25rem;height:2.25rem;color:var(--layout-text,inherit);background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:50%;justify-content:center;align-items:center;padding:0;display:inline-flex}.stage-theme-toggle__button:hover{background:var(--layout-hover,#eceef1)}
1
+ body{min-width:20rem;min-height:100vh;margin:0;font-family:system-ui,-apple-system,Segoe UI,sans-serif}button{font:inherit}:root[data-scene-color-scheme=dark] .layout-menu-dark{--layout-sidebar-surface:color-mix(in srgb, var(--layout-background) 70%, black);--layout-sidebar-text:var(--layout-text);--layout-sidebar-muted:var(--layout-text-muted);--layout-sidebar-hover:color-mix(in srgb, var(--layout-text) 10%, transparent)}.stage-message{text-align:center;place-content:center;min-height:100vh;padding:2rem;display:grid}.stage-activity{background:var(--layout-highlight,#eef2ff);border-radius:var(--layout-radius,.5rem);color:var(--layout-highlight-text,#3730a3);margin-top:1rem;padding:.75rem}.stage-locale{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);color:var(--layout-text,inherit);padding:.35rem .5rem}.stage-table{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);min-width:0;padding:.5rem;overflow-x:auto}.stage-table table{border-collapse:collapse;width:100%}.stage-table th,.stage-table td{border-bottom:1px solid var(--layout-border,#e2e5e9);text-align:left;padding:.5rem .75rem}.stage-table th{color:var(--layout-text-muted,#6b7280);text-transform:uppercase;white-space:nowrap;font-size:.85rem;font-weight:600}.stage-table tbody tr[tabindex]{cursor:pointer}.stage-table tbody tr[tabindex]:hover td{background:var(--layout-background,#f8fafc)}.stage-table tbody tr[aria-selected=true] td,.stage-table tbody tr[aria-selected=true]:hover td{background:var(--layout-highlight,#eef2ff);color:var(--layout-highlight-text,#3730a3)}.stage-table tbody tr[aria-selected=true] td:first-child{box-shadow:inset 3px 0 0 var(--layout-highlight-text,#3730a3)}.stage-empty{color:var(--layout-text-muted,#6b7280);font-style:italic}.stage-note{color:var(--layout-text-muted,#6b7280);margin:0 0 .5rem}.stage-note--error{color:#dc2626}.stage-action{vertical-align:top;justify-items:start;gap:.75rem;margin:0 .5rem .5rem 0;display:inline-grid}.stage-command-form__layout{gap:var(--layout-gap,1rem);width:100%;min-width:0;display:grid}.stage-command-form__field{min-width:0;display:block}.stage-command-form__field small.p-error{min-height:1.25rem;margin:.25rem 0 0;line-height:1.25rem}.stage-command-form__field:not(:has(small.p-error)):after{content:"";min-height:1.5rem;display:block}.stage-record-field,.stage-list-field{border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);gap:.6rem;min-width:0;margin:0;padding:.75rem;display:grid}.stage-record-field legend,.stage-list-field legend{padding:0 .35rem;font-weight:600}.stage-record-field[data-invalid=true],.stage-list-field[data-invalid=true]{border-color:#dc2626}.stage-list-field__row{grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:.5rem;display:grid}.stage-value-field{gap:.25rem;display:grid}.stage-value-field--check{align-items:center;gap:.5rem;display:flex}.stage-value-field>span{color:var(--layout-text-muted,#6b7280);font-size:.85rem}.stage-value-field input:not([type=checkbox]),.stage-value-field select{background:var(--layout-background,#fff);border:1px solid var(--layout-border,#e2e5e9);color:inherit;font:inherit;border-radius:.3rem;padding:.45rem .6rem}.stage-form{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);gap:.6rem;min-width:20rem;padding:1rem;display:grid}.stage-form label{gap:.25rem;display:grid}.stage-form span{color:var(--layout-text-muted,#6b7280);font-size:.85rem}.stage-form input{background:var(--layout-background,#fff);border:1px solid var(--layout-border,#e2e5e9);color:inherit;border-radius:.3rem;padding:.45rem .6rem}pre{background:var(--layout-background,#f4f5f7);border-radius:.4rem;padding:1rem;overflow:auto}[role=table] header{gap:1rem;font-weight:600;display:flex}.stage-dialog-backdrop{z-index:1000;background:#00000073;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.stage-dialog{background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:var(--layout-radius,.5rem);color:var(--layout-text,inherit);gap:.75rem;min-width:min(90vw,24rem);max-width:min(90vw,48rem);max-height:90vh;padding:1rem;display:grid;overflow:auto;box-shadow:0 1rem 3rem #0000004d}.stage-dialog>button{justify-self:end}.stage-confirm-dialog__decisions{flex-wrap:wrap;gap:.5rem;display:flex}.stage-confirm-dialog__decision[aria-pressed=true]{box-shadow:var(--scene-focus-ring,0 0 0 2px #4f46e566)}.stage-confirm-dialog button[type=submit]{background:var(--scene-primary-color,#4f46e5);border:1px solid var(--scene-primary-color,#4f46e5);border-radius:var(--scene-content-border-radius,.5rem);color:var(--scene-primary-contrast-color,#fff);cursor:pointer;font:inherit;justify-self:end;padding:.55rem 1.1rem}.stage-confirm-dialog button[type=submit]:focus-visible{box-shadow:var(--scene-focus-ring,0 0 0 2px #4f46e566);outline:none}.stage-command-form__field>div,.stage-command-form__field .cratis-dropdown,.stage-command-form__field .cratis-field-input{box-sizing:border-box;width:100%}.stage-command-form__field .cratis-dropdown__select,.stage-command-form__field .cratis-dropdown__trigger{width:100%}.stage-command-form__submit,.scene-slice-dialog-submit{font:inherit;cursor:pointer;color:var(--scene-primary-contrast-color,#fff);background:var(--scene-primary-color,#4f46e5);border:1px solid var(--scene-primary-color,#4f46e5);border-radius:var(--scene-content-border-radius,.5rem);padding:.55rem 1.1rem}.stage-command-form__submit,.scene-slice-dialog-footer{margin-top:1rem}.stage-theme-toggle{flex-direction:column;align-items:center;display:flex}.stage-theme-toggle__button{cursor:pointer;width:2.25rem;height:2.25rem;color:var(--layout-text,inherit);background:var(--layout-card,#fff);border:1px solid var(--layout-border,#e2e5e9);border-radius:50%;justify-content:center;align-items:center;padding:0;display:inline-flex}.stage-theme-toggle__button:hover{background:var(--layout-hover,#eceef1)}
2
2
  /*$vite$:1*/
@@ -62,6 +62,15 @@ export interface ApplicationIdentity {
62
62
  icon?: string;
63
63
  showName?: boolean;
64
64
  }
65
+ /** What the chrome around a screen is asked to draw besides the screen itself. */
66
+ export interface ChromeOptions {
67
+ /** Whether the model declares navigation regions, which the topbar and sidebar then draw instead of the menu. Off unless stated. */
68
+ regions?: boolean;
69
+ /** Whether the footer is drawn. On unless stated. */
70
+ showFooter?: boolean;
71
+ /** Whether the topbar offers the theme switcher. On unless stated. */
72
+ showThemeSwitcher?: boolean;
73
+ }
65
74
  /**
66
75
  * The chrome the blueprint's application shell wraps every screen in, besides the screen itself.
67
76
  *
@@ -70,7 +79,7 @@ export interface ApplicationIdentity {
70
79
  * the entries its screens authored as `Navigation` contributions - or one flat list of its screens - as the menu, and the topbar and
71
80
  * sidebar draw no region of their own.
72
81
  */
73
- export declare function applicationChrome(screens: Screen[], activeScreen: string, locales: string[], locale: string, application?: ApplicationIdentity, regions?: boolean, showFooter?: boolean): Record<string, SceneElement[]>;
82
+ export declare function applicationChrome(screens: Screen[], activeScreen: string, locales: string[], locale: string, application?: ApplicationIdentity, options?: ChromeOptions): Record<string, SceneElement[]>;
74
83
  /** The hash a screen is addressed by - what the blueprint's breadcrumb links point at. */
75
84
  export declare function screenHash(name: string): string;
76
85
  /** The screen name a hash addresses, or undefined when it addresses none. Parameters after `?` are not part of it. */
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Humanizes a name the way a label reads: PascalCase and camelCase are split into words and written in sentence case, while a run of
3
+ * capitals stays as written - `postalCode` is "Postal code", `RegisterSKU` is "Register SKU".
4
+ *
5
+ * @param name The name.
6
+ * @returns The label text; a name with no letters or digits is returned as it is.
7
+ */
8
+ export declare function humanize(name: string): string;
9
+ /**
10
+ * Humanizes a screen's name, dropping a trailing `Screen`, `Page` or `Dialog` that only says what kind of thing it is:
11
+ * `PipelineScreen` is "Pipeline". A name that is only that word is kept.
12
+ *
13
+ * @param name The screen's name.
14
+ * @returns The label text.
15
+ */
16
+ export declare function humanizeScreenName(name: string): string;
17
+ /** The Button variant a toolbar action takes: its authored emphasis, else primary for the first action and secondary for the ones after it. */
18
+ export declare function actionVariant(authored: string, followsAnotherAction: boolean): 'solid' | 'outline' | 'ghost';