@cratis/stage.runtime 4.184.0 → 4.186.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.
@@ -1,18 +1,27 @@
1
- import type { ExternalComponent } from '@cratis/scene.model';
2
- export interface SchemaProperty {
3
- name: string;
4
- type?: 'text' | 'number' | 'boolean' | 'date';
5
- required: boolean;
6
- unsupportedReason?: string;
7
- }
1
+ import type { ExternalComponent, FormField } from '@cratis/scene.model';
2
+ import { schemaPropertiesOf } from './stageFormSchema';
3
+ import type { SchemaProperty } from './stageFormSchema';
4
+ export { schemaPropertiesOf };
5
+ export type { SchemaProperty };
6
+ /**
7
+ * What a command form that sits in a dialog calls once its command succeeded, so the dialog it was opened in closes and the screen behind it
8
+ * - the next step of a wizard - is reachable again. A form outside a dialog has nothing to close.
9
+ */
10
+ export declare const StageDialogContext: import("react").Context<(() => void) | undefined>;
8
11
  interface StageCommandFormProps {
9
12
  element: ExternalComponent;
10
13
  }
14
+ interface StageCommandContent {
15
+ [key: string]: unknown;
16
+ }
11
17
  /** Renders an authored screen form through Cratis Arc's native CommandForm boundary. */
12
18
  export declare function StageCommandForm({ element }: StageCommandFormProps): import("react").JSX.Element;
13
19
  /**
14
- * The properties a command's JSON schema declares, with the type the native form gives each and whether it is required. A toolbar
15
- * slice's task dialog is built from the same reading, so a command is the same fields wherever it is presented.
20
+ * The identity a session acts as - the shopper's basket - for the identifier properties a form does not show.
21
+ *
22
+ * A command like AddToBasket is about the shopper's own basket, which the shopper never types: the form lists the product and the quantity.
23
+ * A required uuid property that the form does not list is that kind of identity - the screen's own parameter when it carries one, otherwise one value per
24
+ * identifier concept for as long as this browser keeps the session - the same basket for every add, change and checkout, a different one for
25
+ * another browser - and a command is never submitted for an identity nobody chose.
16
26
  */
17
- export declare function schemaPropertiesOf(schema: string): SchemaProperty[];
18
- export {};
27
+ export declare function sessionIdentifiers(fields: FormField[], schema: SchemaProperty[], parameters: Record<string, string>): StageCommandContent;
@@ -0,0 +1,14 @@
1
+ import { type WrappedFieldProps } from '@cratis/arc.react/commands';
2
+ import { type SchemaProperty } from './stageFormSchema';
3
+ interface ValueFieldProps extends WrappedFieldProps<unknown> {
4
+ /** What the command's schema says about the member the field is bound to. */
5
+ descriptor: SchemaProperty;
6
+ title?: string;
7
+ }
8
+ /**
9
+ * A command member that is a record or a collection, presented as the fields it holds: a record is a group of its members, a
10
+ * collection a list of its elements the shopper adds to and removes from. One Arc form field binds the whole value, so the command
11
+ * is submitted with the record and the list exactly as the schema declares them.
12
+ */
13
+ export declare const StageValueField: (<TCommand = unknown>(props: import("@cratis/arc.react/commands").CommandFormFieldComponentProps<ValueFieldProps, TCommand>) => React.ReactElement) & import("@cratis/arc.react/commands").CommandFormMarked;
14
+ 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}.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);padding:.5rem}.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;font-size:.85rem;font-weight:600}.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-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}
1
+ body{min-width:20rem;min-height:100vh;margin:0;font-family:system-ui,-apple-system,Segoe UI,sans-serif}button{font:inherit}.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);padding:.5rem}.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;font-size:.85rem;font-weight:600}.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-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}
2
2
  /*$vite$:1*/