@cratis/scene.components 4.14.0 → 4.15.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.
Files changed (34) hide show
  1. package/cratisComponentsDescriptors.ts +5 -0
  2. package/cratisComponentsPackage.ts +3 -1
  3. package/dist/cjs/cratisComponentsDescriptors.js +18 -0
  4. package/dist/cjs/cratisComponentsDescriptors.js.map +1 -1
  5. package/dist/cjs/cratisComponentsPackage.js +5 -2
  6. package/dist/cjs/cratisComponentsPackage.js.map +1 -1
  7. package/dist/cjs/forms/CommandFormLayoutEditor.js +73 -0
  8. package/dist/cjs/forms/CommandFormLayoutEditor.js.map +1 -0
  9. package/dist/cjs/forms/CommandFormRuntime.js +5 -3
  10. package/dist/cjs/forms/CommandFormRuntime.js.map +1 -1
  11. package/dist/cjs/forms/SceneCommandForm.js +5 -1
  12. package/dist/cjs/forms/SceneCommandForm.js.map +1 -1
  13. package/dist/esm/cratisComponentsDescriptors.d.ts.map +1 -1
  14. package/dist/esm/cratisComponentsDescriptors.js +18 -0
  15. package/dist/esm/cratisComponentsDescriptors.js.map +1 -1
  16. package/dist/esm/cratisComponentsPackage.d.ts.map +1 -1
  17. package/dist/esm/cratisComponentsPackage.js +5 -2
  18. package/dist/esm/cratisComponentsPackage.js.map +1 -1
  19. package/dist/esm/forms/CommandFormLayoutEditor.d.ts +3 -0
  20. package/dist/esm/forms/CommandFormLayoutEditor.d.ts.map +1 -0
  21. package/dist/esm/forms/CommandFormLayoutEditor.js +71 -0
  22. package/dist/esm/forms/CommandFormLayoutEditor.js.map +1 -0
  23. package/dist/esm/forms/CommandFormRuntime.d.ts +2 -1
  24. package/dist/esm/forms/CommandFormRuntime.d.ts.map +1 -1
  25. package/dist/esm/forms/CommandFormRuntime.js +6 -4
  26. package/dist/esm/forms/CommandFormRuntime.js.map +1 -1
  27. package/dist/esm/forms/SceneCommandForm.d.ts.map +1 -1
  28. package/dist/esm/forms/SceneCommandForm.js +6 -2
  29. package/dist/esm/forms/SceneCommandForm.js.map +1 -1
  30. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  31. package/forms/CommandFormLayoutEditor.tsx +49 -0
  32. package/forms/CommandFormRuntime.tsx +9 -5
  33. package/forms/SceneCommandForm.tsx +2 -0
  34. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"cratisComponentsPackage.js","sources":["../../cratisComponentsPackage.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '@cratis/scene.react';\nimport { cratisComponents, cratisComponentsPackageName } from './cratisComponents';\nimport { cratisComponentsDescriptors } from './cratisComponentsDescriptors';\nimport { CommandFieldPropertyEditor } from './forms/CommandFieldPropertyEditor';\nimport { CommandFormDesigner } from './forms/CommandFormDesigner';\nimport { generateCommandFieldsAction } from './forms/generateCommandFieldsAction';\n\n/**\n * The `Cratis.Components` package's declaration - what a profile gets when it lists this package.\n *\n * This is the concrete case the whole package-dependency mechanism exists for. `@cratis/components` is\n * not a self-contained library: every component in it is a wrapper over a PrimeReact widget, and its own\n * styling is a `--cratis-*` token layer (`@cratis/components/tokens`) plus the component stylesheets and\n * compiled Tailwind utilities in `@cratis/components/styles`. Activate it in a profile without PrimeReact\n * and nothing renders; activate it without Tailwind and everything renders unstyled. Both are stated as\n * dependencies so a package picker can say so while the profile is being configured, instead of leaving\n * it to be discovered when the page opens.\n *\n * The version ranges are the real ones the library carries. `>=11.0.0` for PrimeReact: version 3.0.0\n * declares `primereact@^11` as a peer dependency and is built against version 11's component set, so the\n * span across the major boundary that the previous `>=10.9.0` range described is over. The `--cratis-*`\n * tokens still resolve a version 10 theme variable as their last fallback, but that is an upgrade-window\n * courtesy for an application with a compiled version 10 stylesheet still on the page - not a version of\n * PrimeReact this package can be activated against. `^4.0.0` for Tailwind, because the utility sheet is\n * compiled against Tailwind 4.\n */\nexport const cratisComponentsPackageManifest: ScenePackage = {\n name: cratisComponentsPackageName,\n version: '3.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [\n { name: 'PrimeReact', versionRange: '>=11.0.0' },\n { name: 'Tailwind', versionRange: '^4.0.0' },\n ],\n components: [\n 'page',\n 'dataPage',\n 'formElement',\n 'singleResult',\n 'queryInputForm',\n 'dataTable',\n 'table',\n 'observableDataTable',\n 'commandForm',\n 'inputTextField',\n 'numberField',\n 'checkboxField',\n 'textAreaField',\n 'dropdownField',\n 'sliderField',\n 'calendarField',\n 'colorPickerField',\n 'multiSelectField',\n 'chipsField',\n 'radioButtonField',\n 'radioGroupField',\n 'dialog',\n 'confirmationDialog',\n 'busyIndicatorDialog',\n 'commandDialog',\n 'stepperCommandDialog',\n 'icon',\n 'tooltip',\n 'dropdown',\n 'errorBoundary',\n 'objectContentEditor',\n 'objectNavigationalBar',\n 'schemaEditor',\n 'timeMachine',\n 'filterPanel',\n 'toolbar',\n 'toolbarButton',\n 'toolbarGroup',\n 'toolbarSeparator',\n ],\n\n // A component library ships components, and nothing else. Layouts, screen templates and dialog\n // templates all belong to a Blueprint: they are decisions about what an application looks like as a\n // whole, and this package deliberately makes none of them - it provides the Arc-bound composites a\n // template is *built from*, so that a blueprint can place a `dataPage` in a slot and configure it,\n // rather than shipping one opinionated data page nobody can rearrange.\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n\n // No themes either, for a different reason: `@cratis/components` has no palette of its own. It reads\n // a `--cratis-*` variable layer that resolves whatever is in front of it - the `--p-*` properties a\n // PrimeReact 11 preset emits at runtime, or a Scene theme through this package's token bridge.\n // Shipping a theme here would be this library asserting a look it was specifically built not to have.\n themes: [],\n\n displayName: 'Cratis Components',\n description: \"Cratis' Arc-bound data, form and dialog composites, built on PrimeReact and Tailwind. dataTable and table accept optional object-valued queryArguments for collection queries. singleResult displays one read-only scalar own resultField of an optional model using an explicit query, object queryArguments and enabled: true. queryInputForm commits explicit string inputs on submit to the same optional-single runtime; drafts never execute a query.\",\n module: '@cratis/scene.components',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n designTime: {\n previews: [],\n designers: ['commandFormDesigner'],\n propertyEditors: ['commandBinding', 'commandFields', 'fieldWidths'],\n propertyDisplays: [],\n actions: ['Cratis.Components.commandForm.generateFields'],\n },\n assets: ['@cratis/components/styles', '@cratis/components/tokens'],\n runtimeSingletons: ['react', '@cratis/arc', '@cratis/components'],\n};\n\n/**\n * The `Cratis.Components` package as a loadable bundle - the manifest above, plus the React components\n * behind the names it declares.\n *\n * No `layouts`, `screenTemplates`, `dialogTemplates` or `themes` are provided, matching a manifest that\n * declares none of them; `validatePackageBundle` is what proves the two halves agree.\n */\nexport const cratisComponentsPackage: ScenePackageBundle = {\n manifest: cratisComponentsPackageManifest,\n components: cratisComponents,\n descriptors: cratisComponentsDescriptors,\n designTime: {\n designers: {\n commandFormDesigner: CommandFormDesigner,\n },\n propertyEditors: {\n commandBinding: CommandFieldPropertyEditor,\n },\n actions: {\n [generateCommandFieldsAction.descriptor.id]: generateCommandFieldsAction,\n },\n },\n};\n"],"names":["cratisComponentsPackageManifest","name","cratisComponentsPackageName","version","kind","PackageKind","ComponentLibrary","dependencies","versionRange","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","designTime","previews","designers","propertyEditors","propertyDisplays","actions","assets","runtimeSingletons","cratisComponentsPackage","manifest","cratisComponents","descriptors","cratisComponentsDescriptors","commandFormDesigner","CommandFormDesigner","commandBinding","CommandFieldPropertyEditor","generateCommandFieldsAction","descriptor","id"],"mappings":";;;;;;;AAAA;AACA;AAUA;;;;;;;;;;;;;;;;;;UAmBaA,+BAAAA,GAAgD;IACzDC,IAAAA,EAAMC,2BAAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;IAClCC,YAAAA,EAAc;AACV,QAAA;YAAEN,IAAAA,EAAM,YAAA;YAAc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A,eAAA;AAAiB,YAAA;AAAc,SAAA;AACnEC,QAAAA,gBAAAA,EAAkB,EAAE;QACpBC,OAAAA,EAAS;AAAC,YAAA;AAA+C;AAC7D,KAAA;IACAC,MAAAA,EAAQ;AAAC,QAAA,2BAAA;AAA6B,QAAA;AAA4B,KAAA;IAClEC,iBAAAA,EAAmB;AAAC,QAAA,OAAA;AAAS,QAAA,aAAA;AAAe,QAAA;AAAqB;AACrE;AAEA;;;;;;UAOaC,uBAAAA,GAA8C;IACvDC,QAAAA,EAAU5B,+BAAAA;IACVS,UAAAA,EAAYoB,gBAAAA;IACZC,WAAAA,EAAaC,2BAAAA;IACbZ,UAAAA,EAAY;QACRE,SAAAA,EAAW;YACPW,mBAAAA,EAAqBC;AACzB,SAAA;QACAX,eAAAA,EAAiB;YACbY,cAAAA,EAAgBC;AACpB,SAAA;QACAX,OAAAA,EAAS;AACL,YAAA,CAACY,2BAAAA,CAA4BC,UAAU,CAACC,EAAE,GAAGF;AACjD;AACJ;AACJ;;"}
1
+ {"version":3,"file":"cratisComponentsPackage.js","sources":["../../cratisComponentsPackage.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '@cratis/scene.react';\nimport { cratisComponents, cratisComponentsPackageName } from './cratisComponents';\nimport { cratisComponentsDescriptors } from './cratisComponentsDescriptors';\nimport { CommandFieldPropertyEditor } from './forms/CommandFieldPropertyEditor';\nimport { CommandFormDesigner } from './forms/CommandFormDesigner';\nimport { CommandFormLayoutEditor } from './forms/CommandFormLayoutEditor';\nimport { generateCommandFieldsAction } from './forms/generateCommandFieldsAction';\n\n/**\n * The `Cratis.Components` package's declaration - what a profile gets when it lists this package.\n *\n * This is the concrete case the whole package-dependency mechanism exists for. `@cratis/components` is\n * not a self-contained library: every component in it is a wrapper over a PrimeReact widget, and its own\n * styling is a `--cratis-*` token layer (`@cratis/components/tokens`) plus the component stylesheets and\n * compiled Tailwind utilities in `@cratis/components/styles`. Activate it in a profile without PrimeReact\n * and nothing renders; activate it without Tailwind and everything renders unstyled. Both are stated as\n * dependencies so a package picker can say so while the profile is being configured, instead of leaving\n * it to be discovered when the page opens.\n *\n * The version ranges are the real ones the library carries. `>=11.0.0` for PrimeReact: version 3.0.0\n * declares `primereact@^11` as a peer dependency and is built against version 11's component set, so the\n * span across the major boundary that the previous `>=10.9.0` range described is over. The `--cratis-*`\n * tokens still resolve a version 10 theme variable as their last fallback, but that is an upgrade-window\n * courtesy for an application with a compiled version 10 stylesheet still on the page - not a version of\n * PrimeReact this package can be activated against. `^4.0.0` for Tailwind, because the utility sheet is\n * compiled against Tailwind 4.\n */\nexport const cratisComponentsPackageManifest: ScenePackage = {\n name: cratisComponentsPackageName,\n version: '3.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [\n { name: 'PrimeReact', versionRange: '>=11.0.0' },\n { name: 'Tailwind', versionRange: '^4.0.0' },\n ],\n components: [\n 'page',\n 'dataPage',\n 'formElement',\n 'singleResult',\n 'queryInputForm',\n 'dataTable',\n 'table',\n 'observableDataTable',\n 'commandForm',\n 'inputTextField',\n 'numberField',\n 'checkboxField',\n 'textAreaField',\n 'dropdownField',\n 'sliderField',\n 'calendarField',\n 'colorPickerField',\n 'multiSelectField',\n 'chipsField',\n 'radioButtonField',\n 'radioGroupField',\n 'dialog',\n 'confirmationDialog',\n 'busyIndicatorDialog',\n 'commandDialog',\n 'stepperCommandDialog',\n 'icon',\n 'tooltip',\n 'dropdown',\n 'errorBoundary',\n 'objectContentEditor',\n 'objectNavigationalBar',\n 'schemaEditor',\n 'timeMachine',\n 'filterPanel',\n 'toolbar',\n 'toolbarButton',\n 'toolbarGroup',\n 'toolbarSeparator',\n ],\n\n // A component library ships components, and nothing else. Layouts, screen templates and dialog\n // templates all belong to a Blueprint: they are decisions about what an application looks like as a\n // whole, and this package deliberately makes none of them - it provides the Arc-bound composites a\n // template is *built from*, so that a blueprint can place a `dataPage` in a slot and configure it,\n // rather than shipping one opinionated data page nobody can rearrange.\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n\n // No themes either, for a different reason: `@cratis/components` has no palette of its own. It reads\n // a `--cratis-*` variable layer that resolves whatever is in front of it - the `--p-*` properties a\n // PrimeReact 11 preset emits at runtime, or a Scene theme through this package's token bridge.\n // Shipping a theme here would be this library asserting a look it was specifically built not to have.\n themes: [],\n\n displayName: 'Cratis Components',\n description: \"Cratis' Arc-bound data, form and dialog composites, built on PrimeReact and Tailwind. dataTable and table accept optional object-valued queryArguments for collection queries. singleResult displays one read-only scalar own resultField of an optional model using an explicit query, object queryArguments and enabled: true. queryInputForm commits explicit string inputs on submit to the same optional-single runtime; drafts never execute a query.\",\n module: '@cratis/scene.components',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n designTime: {\n previews: [],\n designers: ['commandFormDesigner'],\n propertyEditors: ['commandBinding', 'commandFields', 'fieldWidths', 'commandFormLayout'],\n propertyDisplays: [],\n actions: ['Cratis.Components.commandForm.generateFields'],\n },\n assets: ['@cratis/components/styles', '@cratis/components/tokens'],\n runtimeSingletons: ['react', '@cratis/arc', '@cratis/components'],\n};\n\n/**\n * The `Cratis.Components` package as a loadable bundle - the manifest above, plus the React components\n * behind the names it declares.\n *\n * No `layouts`, `screenTemplates`, `dialogTemplates` or `themes` are provided, matching a manifest that\n * declares none of them; `validatePackageBundle` is what proves the two halves agree.\n */\nexport const cratisComponentsPackage: ScenePackageBundle = {\n manifest: cratisComponentsPackageManifest,\n components: cratisComponents,\n descriptors: cratisComponentsDescriptors,\n designTime: {\n designers: {\n commandFormDesigner: CommandFormDesigner,\n },\n propertyEditors: {\n commandBinding: CommandFieldPropertyEditor,\n commandFormLayout: CommandFormLayoutEditor,\n },\n actions: {\n [generateCommandFieldsAction.descriptor.id]: generateCommandFieldsAction,\n },\n },\n};\n"],"names":["cratisComponentsPackageManifest","name","cratisComponentsPackageName","version","kind","PackageKind","ComponentLibrary","dependencies","versionRange","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","designTime","previews","designers","propertyEditors","propertyDisplays","actions","assets","runtimeSingletons","cratisComponentsPackage","manifest","cratisComponents","descriptors","cratisComponentsDescriptors","commandFormDesigner","CommandFormDesigner","commandBinding","CommandFieldPropertyEditor","commandFormLayout","CommandFormLayoutEditor","generateCommandFieldsAction","descriptor","id"],"mappings":";;;;;;;;AAAA;AACA;AAWA;;;;;;;;;;;;;;;;;;UAmBaA,+BAAAA,GAAgD;IACzDC,IAAAA,EAAMC,2BAAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;IAClCC,YAAAA,EAAc;AACV,QAAA;YAAEN,IAAAA,EAAM,YAAA;YAAcO,YAAAA,EAAc;AAAW,SAAA;AAC/C,QAAA;YAAEP,IAAAA,EAAM,UAAA;YAAYO,YAAAA,EAAc;AAAS;AAC9C,KAAA;IACDC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,UAAA;AACA,QAAA,aAAA;AACA,QAAA,cAAA;AACA,QAAA,gBAAA;AACA,QAAA,WAAA;AACA,QAAA,OAAA;AACA,QAAA,qBAAA;AACA,QAAA,aAAA;AACA,QAAA,gBAAA;AACA,QAAA,aAAA;AACA,QAAA,eAAA;AACA,QAAA,eAAA;AACA,QAAA,eAAA;AACA,QAAA,aAAA;AACA,QAAA,eAAA;AACA,QAAA,kBAAA;AACA,QAAA,kBAAA;AACA,QAAA,YAAA;AACA,QAAA,kBAAA;AACA,QAAA,iBAAA;AACA,QAAA,QAAA;AACA,QAAA,oBAAA;AACA,QAAA,qBAAA;AACA,QAAA,eAAA;AACA,QAAA,sBAAA;AACA,QAAA,MAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,eAAA;AACA,QAAA,qBAAA;AACA,QAAA,uBAAA;AACA,QAAA,cAAA;AAC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1
+ import { DesignTimePropertyEditorProps } from '@cratis/scene.react';
2
+ export declare function CommandFormLayoutEditor({ context, property, value, setValue }: DesignTimePropertyEditorProps): import("react").JSX.Element;
3
+ //# sourceMappingURL=CommandFormLayoutEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandFormLayoutEditor.d.ts","sourceRoot":"","sources":["../../../forms/CommandFormLayoutEditor.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAUpE,wBAAgB,uBAAuB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,6BAA6B,+BAgC5G"}
@@ -0,0 +1,71 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
3
+ import { SceneEditKind } from '@cratis/scene.model';
4
+ import { CommandFormLayoutKey, applyCommandFormLayoutKey } from '@cratis/scene.engine';
5
+ import { commandFormLayout } from './commandFormLayout.js';
6
+
7
+ const layoutKeys = new Set(Object.values(CommandFormLayoutKey));
8
+ /**
9
+ * Arranges a command form's fields from the keyboard. Each placed field is a focusable cell: the arrow keys
10
+ * move it one cell, and Shift with an arrow key resizes it. A valid change is submitted as one canonical
11
+ * edit of the `layout` property; an invalid one is announced and the committed layout is kept.
12
+ */ function CommandFormLayoutEditor({ context, property, value, setValue }) {
13
+ const layout = commandFormLayout({
14
+ layout: value
15
+ });
16
+ const [problem, setProblem] = useState();
17
+ if (!layout) return /*#__PURE__*/ jsxs("p", {
18
+ role: "note",
19
+ children: [
20
+ property.label,
21
+ ": no layout is authored yet."
22
+ ]
23
+ });
24
+ const onKeyDown = (field)=>(event)=>{
25
+ if (!layoutKeys.has(event.key)) return;
26
+ event.preventDefault();
27
+ const draft = applyCommandFormLayoutKey(layout, field, event.key, event.shiftKey, layout.placements.map((placement)=>placement.field));
28
+ if (!draft) return;
29
+ if (!draft.isValid) {
30
+ setProblem(draft.diagnostics[0].message);
31
+ return;
32
+ }
33
+ setProblem(undefined);
34
+ commit(draft.draft);
35
+ };
36
+ const commit = (next)=>{
37
+ setValue(next);
38
+ context.submitEdits([
39
+ {
40
+ kind: SceneEditKind.SetProperty,
41
+ nodeId: context.element.id,
42
+ path: property.path,
43
+ value: next
44
+ }
45
+ ]);
46
+ };
47
+ return /*#__PURE__*/ jsxs("div", {
48
+ role: "group",
49
+ "aria-label": property.label,
50
+ "aria-describedby": `${context.element.id}-layout-help`,
51
+ children: [
52
+ /*#__PURE__*/ jsx("p", {
53
+ id: `${context.element.id}-layout-help`,
54
+ children: "Arrow keys move a field. Shift and an arrow key resize it."
55
+ }),
56
+ layout.placements.map((placement)=>/*#__PURE__*/ jsx("button", {
57
+ type: "button",
58
+ onKeyDown: onKeyDown(placement.field),
59
+ "aria-label": `${placement.field}: row ${placement.row}, column ${placement.column}, spans ${placement.columnSpan ?? 1} column(s) and ${placement.rowSpan ?? 1} row(s)`,
60
+ children: placement.field
61
+ }, placement.field)),
62
+ problem && /*#__PURE__*/ jsx("p", {
63
+ role: "alert",
64
+ children: problem
65
+ })
66
+ ]
67
+ });
68
+ }
69
+
70
+ export { CommandFormLayoutEditor };
71
+ //# sourceMappingURL=CommandFormLayoutEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandFormLayoutEditor.js","sources":["../../../forms/CommandFormLayoutEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { KeyboardEvent, useState } from 'react';\nimport { CommandFormLayout, SceneEditKind } from '@cratis/scene.model';\nimport { CommandFormLayoutKey, applyCommandFormLayoutKey } from '@cratis/scene.engine';\nimport { DesignTimePropertyEditorProps } from '@cratis/scene.react';\nimport { commandFormLayout } from './commandFormLayout';\n\nconst layoutKeys = new Set<string>(Object.values(CommandFormLayoutKey));\n\n/**\n * Arranges a command form's fields from the keyboard. Each placed field is a focusable cell: the arrow keys\n * move it one cell, and Shift with an arrow key resizes it. A valid change is submitted as one canonical\n * edit of the `layout` property; an invalid one is announced and the committed layout is kept.\n */\nexport function CommandFormLayoutEditor({ context, property, value, setValue }: DesignTimePropertyEditorProps) {\n const layout = commandFormLayout({ layout: value });\n const [problem, setProblem] = useState<string>();\n if (!layout) return <p role='note'>{property.label}: no layout is authored yet.</p>;\n\n const onKeyDown = (field: string) => (event: KeyboardEvent<HTMLButtonElement>) => {\n if (!layoutKeys.has(event.key)) return;\n event.preventDefault();\n const draft = applyCommandFormLayoutKey(layout, field, event.key as CommandFormLayoutKey, event.shiftKey, layout.placements.map(placement => placement.field));\n if (!draft) return;\n if (!draft.isValid) {\n setProblem(draft.diagnostics[0].message);\n return;\n }\n\n setProblem(undefined);\n commit(draft.draft);\n };\n\n const commit = (next: CommandFormLayout) => {\n setValue(next);\n context.submitEdits([{ kind: SceneEditKind.SetProperty, nodeId: context.element.id, path: property.path, value: next }]);\n };\n\n return <div role='group' aria-label={property.label} aria-describedby={`${context.element.id}-layout-help`}>\n <p id={`${context.element.id}-layout-help`}>Arrow keys move a field. Shift and an arrow key resize it.</p>\n {layout.placements.map(placement => <button key={placement.field} type='button' onKeyDown={onKeyDown(placement.field)}\n aria-label={`${placement.field}: row ${placement.row}, column ${placement.column}, spans ${placement.columnSpan ?? 1} column(s) and ${placement.rowSpan ?? 1} row(s)`}>\n {placement.field}\n </button>)}\n {problem && <p role='alert'>{problem}</p>}\n </div>;\n}\n"],"names":["layoutKeys","Set","Object","values","CommandFormLayoutKey","CommandFormLayoutEditor","context","property","value","setValue","layout","commandFormLayout","problem","setProblem","useState","_jsxs","p","role","label","onKeyDown","field","event","has","key","preventDefault","draft","applyCommandFormLayoutKey","shiftKey","placements","map","placement","isValid","diagnostics","message","undefined","commit","next","submitEdits","kind","SceneEditKind","SetProperty","nodeId","element","id","path","div","aria-label","aria-describedby","_jsx","button","type","row","column","columnSpan","rowSpan"],"mappings":";;;;;;AASA,MAAMA,UAAAA,GAAa,IAAIC,GAAAA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oC,GAAA,CAAChC,GAAAA,EAAAA;gBAAEC,IAAAA,EAAK,OAAA;AAASL,gBAAAA,QAAAA,EAAAA;;;;AAErC;;"}
@@ -8,7 +8,8 @@ interface CommandFormRuntimeProps {
8
8
  submitLabel: string;
9
9
  columns?: number;
10
10
  layout?: CommandFormLayout;
11
+ compact?: boolean;
11
12
  }
12
- export default function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns, layout }: CommandFormRuntimeProps): import("react").JSX.Element;
13
+ export default function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns, layout, compact }: CommandFormRuntimeProps): import("react").JSX.Element;
13
14
  export {};
14
15
  //# sourceMappingURL=CommandFormRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandFormRuntime.d.ts","sourceRoot":"","sources":["../../../forms/CommandFormRuntime.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,UAAU,uBAAuB;IAC7B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AA4CD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAW,EAAE,MAAM,EAAE,EAAE,uBAAuB,+BAiBjI"}
1
+ {"version":3,"file":"CommandFormRuntime.d.ts","sourceRoot":"","sources":["../../../forms/CommandFormRuntime.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,UAAU,uBAAuB;IAC7B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAG3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AA4CD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAW,EAAE,MAAM,EAAE,OAAe,EAAE,EAAE,uBAAuB,+BAkBlJ"}
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { AutoCommandForm } from '@cratis/components/CommandForm';
3
3
  import { CommandForm } from '@cratis/arc.react/commands';
4
- import { normalizeCommandFormLayout, validateCommandFormLayout, formWidthToCss } from '@cratis/scene.engine';
4
+ import { normalizeCommandFormLayout, validateCommandFormLayout, stackCommandFormLayout, formWidthToCss } from '@cratis/scene.engine';
5
5
  import { Guid } from '@cratis/fundamentals';
6
6
  import { CommandFormSubmit } from './CommandFormSubmit.js';
7
7
  import { ExplicitCommandField } from './ExplicitCommandField.js';
@@ -46,7 +46,7 @@ const NativeAutoCommandForm = AutoCommandForm;
46
46
  }
47
47
  return undefined;
48
48
  }
49
- /** Private lazy entry point: importing the Scene registry must not import Arc. */ function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns = 1, layout }) {
49
+ /** Private lazy entry point: importing the Scene registry must not import Arc. */ function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns = 1, layout, compact = false }) {
50
50
  const error = capability(command, inputs, exclude);
51
51
  if (error) return /*#__PURE__*/ jsx("div", {
52
52
  role: "alert",
@@ -54,18 +54,20 @@ const NativeAutoCommandForm = AutoCommandForm;
54
54
  });
55
55
  // The registry's never-argument constructor is erased; Arc creates this checked proxy with no args.
56
56
  if (inputs) {
57
- const formLayout = normalizeCommandFormLayout(layout, inputs);
58
- const diagnostics = validateCommandFormLayout(formLayout, inputs.map((input)=>input.property));
57
+ const authoredLayout = normalizeCommandFormLayout(layout, inputs);
58
+ const diagnostics = validateCommandFormLayout(authoredLayout, inputs.map((input)=>input.property));
59
59
  if (diagnostics.length) return /*#__PURE__*/ jsx("div", {
60
60
  role: "alert",
61
61
  children: diagnostics[0].message
62
62
  });
63
+ const formLayout = compact ? stackCommandFormLayout(authoredLayout) : authoredLayout;
63
64
  const columnsCss = formLayout.columns.map((column)=>formWidthToCss(column.width) ?? 'minmax(0, 1fr)').join(' ') || `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`;
64
65
  return /*#__PURE__*/ jsxs(CommandForm, {
65
66
  command: command,
66
67
  showTitles: false,
67
68
  children: [
68
69
  /*#__PURE__*/ jsx("div", {
70
+ "data-scene-form-columns": formLayout.columns.length,
69
71
  style: {
70
72
  display: 'grid',
71
73
  gridTemplateColumns: columnsCss,
@@ -1 +1 @@
1
- {"version":3,"file":"CommandFormRuntime.js","sources":["../../../forms/CommandFormRuntime.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ComponentType, ReactNode } from 'react';\nimport { AutoCommandForm } from '@cratis/components/CommandForm';\nimport { CommandForm } from '@cratis/arc.react/commands';\nimport { formWidthToCss, normalizeCommandFormLayout, validateCommandFormLayout } from '@cratis/scene.engine';\nimport { Guid } from '@cratis/fundamentals';\nimport type { BoundConstructor } from '../bindings';\nimport type { CommandInput } from './commandInputs';\nimport type { CommandFormLayout } from '@cratis/scene.model';\nimport { CommandFormSubmit } from './CommandFormSubmit';\nimport { ExplicitCommandField } from './ExplicitCommandField';\n\ninterface CommandFormRuntimeProps {\n command: BoundConstructor;\n inputs?: CommandInput[];\n exclude?: string[];\n submitLabel: string;\n columns?: number;\n layout?: CommandFormLayout;\n}\n\n// Runtime bindings erase the proxy's keys; the optional footer is a Components >=4.13 contract.\nconst NativeAutoCommandForm = AutoCommandForm as unknown as ComponentType<{\n command: BoundConstructor;\n exclude?: string[];\n footer?: ReactNode;\n}>;\n\ntype Descriptor = { name: string; type: unknown; isOptional: boolean };\n\n/** Verify the whole command before mounting any native form: partial forms must never execute. */\nfunction capability(command: BoundConstructor, inputs?: CommandInput[], exclude?: string[]): string | undefined {\n let descriptors: unknown;\n try { descriptors = (new command() as { propertyDescriptors?: unknown }).propertyDescriptors; }\n catch { return 'Unable to inspect command proxy'; }\n if (!Array.isArray(descriptors)) return 'Command proxy has no property descriptors';\n const byName = new Map<string, Descriptor>();\n for (const descriptor of descriptors) {\n if (!descriptor || typeof descriptor.name !== 'string' || !descriptor.name ||\n typeof descriptor.isOptional !== 'boolean' || byName.has(descriptor.name)) return 'Ambiguous or invalid command property descriptors';\n byName.set(descriptor.name, descriptor);\n }\n if (inputs) {\n for (const input of inputs) {\n const descriptor = byName.get(input.property);\n if (!descriptor) return `Unknown command property '${input.property}'`;\n if (descriptor.type !== (input.type === 'guid' ? Guid : String)) return `Command property '${input.property}' type does not match '${input.type}'`;\n }\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && !inputs.some(input => input.property === descriptor.name)) return `Required command property '${descriptor.name}' has no input`;\n }\n } else {\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && (exclude?.includes(descriptor.name) ||\n ![String, Number, Boolean, Date].includes(descriptor.type as typeof String))) {\n return `Required command property '${descriptor.name}' has no supported automatic field; declare inputs`;\n }\n }\n }\n return undefined;\n}\n\n/** Private lazy entry point: importing the Scene registry must not import Arc. */\nexport default function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns = 1, layout }: CommandFormRuntimeProps) {\n const error = capability(command, inputs, exclude);\n if (error) return <div role='alert'>{error}</div>;\n // The registry's never-argument constructor is erased; Arc creates this checked proxy with no args.\n if (inputs) {\n const formLayout = normalizeCommandFormLayout(layout, inputs);\n const diagnostics = validateCommandFormLayout(formLayout, inputs.map(input => input.property));\n if (diagnostics.length) return <div role='alert'>{diagnostics[0].message}</div>;\n const columnsCss = formLayout.columns.map(column => formWidthToCss(column.width) ?? 'minmax(0, 1fr)').join(' ') || `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`;\n return <CommandForm command={command as unknown as new () => object} showTitles={false}>\n <div style={{ display: 'grid', gridTemplateColumns: columnsCss, columnGap: formWidthToCss(formLayout.columnGap) ?? '1rem', rowGap: formWidthToCss(formLayout.rowGap) ?? '1rem' }}>\n {inputs.map(input => <ExplicitCommandField key={input.property} input={input} placement={formLayout.placements.find(placement => placement.field === input.property) ?? input.placement} />)}\n </div>\n <CommandFormSubmit label={submitLabel} />\n </CommandForm>;\n }\n return <NativeAutoCommandForm command={command} exclude={exclude} footer={<CommandFormSubmit label={submitLabel} />} />;\n}\n"],"names":["NativeAutoCommandForm","AutoCommandForm","capability","command","inputs","exclude","descriptors","propertyDescriptors","Array","isArray","byName","Map","descriptor","name","isOptional","has","set","input","get","property","type","Guid","String","values","some","includes","Number","Boolean","Date","undefined","CommandFormRuntime","submitLabel","columns","layout","error","_jsx","div","role","formLayout","normalizeCommandFormLayout","diagnostics","validateCommandFormLayout","map","length","message","columnsCss","column","formWidthToCss","width","join","Math","max","_jsxs","CommandForm","showTitles","style","display","gridTemplateColumns","columnGap","rowGap","ExplicitCommandField","placement","placements","find","field","CommandFormSubmit","label","footer"],"mappings":";;;;;;;;AAAA;AACA;AAsBA;AACA,MAAMA,qBAAAA,GAAwBC,eAAAA;AAQ9B,mGACA,SAASC,UAAAA,CAAWC,OAAyB,EAAEC,MAAuB,EAAEC,OAAkB,EAAA;IACtF,IAAIC,WAAAA;IACJ,IAAI;QAAEA,WAAAA,GAAe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AAOI,GAAA,CAACnC,qBAAAA,EAAAA;QAAsBG,OAAAA,EAASA,OAAAA;QAASE,OAAAA,EAASA,OAAAA;AAAS8D,QAAAA,MAAAA,gBAAQhC,GAAA,CAAC8B,iBAAAA,EAAAA;YAAkBC,KAAAA,EAAOnC;;;AACxG;;"}
1
+ {"version":3,"file":"CommandFormRuntime.js","sources":["../../../forms/CommandFormRuntime.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ComponentType, ReactNode } from 'react';\nimport { AutoCommandForm } from '@cratis/components/CommandForm';\nimport { CommandForm } from '@cratis/arc.react/commands';\nimport { formWidthToCss, normalizeCommandFormLayout, stackCommandFormLayout, validateCommandFormLayout } from '@cratis/scene.engine';\nimport { Guid } from '@cratis/fundamentals';\nimport type { BoundConstructor } from '../bindings';\nimport type { CommandInput } from './commandInputs';\nimport type { CommandFormLayout } from '@cratis/scene.model';\nimport { CommandFormSubmit } from './CommandFormSubmit';\nimport { ExplicitCommandField } from './ExplicitCommandField';\n\ninterface CommandFormRuntimeProps {\n command: BoundConstructor;\n inputs?: CommandInput[];\n exclude?: string[];\n submitLabel: string;\n columns?: number;\n layout?: CommandFormLayout;\n\n /** At a compact width the fields stack in one column, in reading order. */\n compact?: boolean;\n}\n\n// Runtime bindings erase the proxy's keys; the optional footer is a Components >=4.13 contract.\nconst NativeAutoCommandForm = AutoCommandForm as unknown as ComponentType<{\n command: BoundConstructor;\n exclude?: string[];\n footer?: ReactNode;\n}>;\n\ntype Descriptor = { name: string; type: unknown; isOptional: boolean };\n\n/** Verify the whole command before mounting any native form: partial forms must never execute. */\nfunction capability(command: BoundConstructor, inputs?: CommandInput[], exclude?: string[]): string | undefined {\n let descriptors: unknown;\n try { descriptors = (new command() as { propertyDescriptors?: unknown }).propertyDescriptors; }\n catch { return 'Unable to inspect command proxy'; }\n if (!Array.isArray(descriptors)) return 'Command proxy has no property descriptors';\n const byName = new Map<string, Descriptor>();\n for (const descriptor of descriptors) {\n if (!descriptor || typeof descriptor.name !== 'string' || !descriptor.name ||\n typeof descriptor.isOptional !== 'boolean' || byName.has(descriptor.name)) return 'Ambiguous or invalid command property descriptors';\n byName.set(descriptor.name, descriptor);\n }\n if (inputs) {\n for (const input of inputs) {\n const descriptor = byName.get(input.property);\n if (!descriptor) return `Unknown command property '${input.property}'`;\n if (descriptor.type !== (input.type === 'guid' ? Guid : String)) return `Command property '${input.property}' type does not match '${input.type}'`;\n }\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && !inputs.some(input => input.property === descriptor.name)) return `Required command property '${descriptor.name}' has no input`;\n }\n } else {\n for (const descriptor of byName.values()) {\n if (!descriptor.isOptional && (exclude?.includes(descriptor.name) ||\n ![String, Number, Boolean, Date].includes(descriptor.type as typeof String))) {\n return `Required command property '${descriptor.name}' has no supported automatic field; declare inputs`;\n }\n }\n }\n return undefined;\n}\n\n/** Private lazy entry point: importing the Scene registry must not import Arc. */\nexport default function CommandFormRuntime({ command, inputs, exclude, submitLabel, columns = 1, layout, compact = false }: CommandFormRuntimeProps) {\n const error = capability(command, inputs, exclude);\n if (error) return <div role='alert'>{error}</div>;\n // The registry's never-argument constructor is erased; Arc creates this checked proxy with no args.\n if (inputs) {\n const authoredLayout = normalizeCommandFormLayout(layout, inputs);\n const diagnostics = validateCommandFormLayout(authoredLayout, inputs.map(input => input.property));\n if (diagnostics.length) return <div role='alert'>{diagnostics[0].message}</div>;\n const formLayout = compact ? stackCommandFormLayout(authoredLayout) : authoredLayout;\n const columnsCss = formLayout.columns.map(column => formWidthToCss(column.width) ?? 'minmax(0, 1fr)').join(' ') || `repeat(${Math.max(1, columns)}, minmax(0, 1fr))`;\n return <CommandForm command={command as unknown as new () => object} showTitles={false}>\n <div data-scene-form-columns={formLayout.columns.length} style={{ display: 'grid', gridTemplateColumns: columnsCss, columnGap: formWidthToCss(formLayout.columnGap) ?? '1rem', rowGap: formWidthToCss(formLayout.rowGap) ?? '1rem' }}>\n {inputs.map(input => <ExplicitCommandField key={input.property} input={input} placement={formLayout.placements.find(placement => placement.field === input.property) ?? input.placement} />)}\n </div>\n <CommandFormSubmit label={submitLabel} />\n </CommandForm>;\n }\n return <NativeAutoCommandForm command={command} exclude={exclude} footer={<CommandFormSubmit label={submitLabel} />} />;\n}\n"],"names":["NativeAutoCommandForm","AutoCommandForm","capability","command","inputs","exclude","descriptors","propertyDescriptors","Array","isArray","byName","Map","descriptor","name","isOptional","has","set","input","get","property","type","Guid","String","values","some","includes","Number","Boolean","Date","undefined","CommandFormRuntime","submitLabel","columns","layout","compact","error","_jsx","div","role","authoredLayout","normalizeCommandFormLayout","diagnostics","validateCommandFormLayout","map","length","message","formLayout","stackCommandFormLayout","columnsCss","column","formWidthToCss","width","join","Math","max","_jsxs","CommandForm","showTitles","data-scene-form-columns","style","display","gridTemplateColumns","columnGap","rowGap","ExplicitCommandField","placement","placements","find","field","CommandFormSubmit","label","footer"],"mappings":";;;;;;;;AAAA;AACA;AAyBA;AACA,MAAMA,qBAAAA,GAAwBC,eAAAA;AAQ9B,mGACA,SAASC,UAAAA,CAAWC,OAAyB,EAAEC,MAAuB,EAAEC,OAAkB,EAAA;IACtF,IAAIC,WAAAA;IACJ,IAAI;QAAEA,WAAAA,GAAe,IAAIH,OAAAA,EAAAA,CAAgDI,mBAAmB;AAAE,IAAA,CAAA,CAC9F,OAAM;QAAE,OAAO,iCAAA;AAAmC,IAAA;AAClD,IAAA,IAAI,CAACC,KAAAA,CAAMC,OAAO,CAACH,cAAc,OAAO,2CAAA;AACxC,IAAA,MAAMI,SAAS,IAAIC,GAAAA,EAAAA;IACnB,KAAK,MAAMC,cAAcN,WAAAA,CAAa;QAClC,IAAI,CAACM,cAAc,OAAOA,UAAAA,CAAWC,IAAI,KAAK,QAAA,IAAY,CAACD,UAAAA,CAAWC,IAAI,IACtE,OAAOD,UAAAA,CAAWE,UAAU,KAAK,SAAA,IAAaJ,MAAAA,CAAOK,GAAG,CAACH,U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ms/SceneCommandForm.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AA0B/D,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAqBrE"}
1
+ {"version":3,"file":"SceneCommandForm.d.ts","sourceRoot":"","sources":["../../../forms/SceneCommandForm.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AA0B/D,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAsBrE"}
@@ -1,10 +1,11 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { lazy } from 'react';
3
+ import { WidthSizeClass } from '@cratis/scene.model';
3
4
  import { BindingKind } from '../bindings/BindingKind.js';
4
5
  import { resolveElementBinding } from '../bindings/resolveElementBinding.js';
5
6
  import { MissingBinding } from '../bindings/MissingBinding.js';
6
7
  import { ArcRuntimeBoundary } from '../bindings/ArcRuntimeBoundary.js';
7
- import { unionProperty, numberProperty, stringProperty, stringArrayProperty } from '../properties.js';
8
+ import { unionProperty, stringProperty, numberProperty, stringArrayProperty } from '../properties.js';
8
9
  import { commandFormLayout } from './commandFormLayout.js';
9
10
  import { commandInputs } from './commandInputs.js';
10
11
 
@@ -51,7 +52,10 @@ function commandKey(command) {
51
52
  },
52
53
  ...commandFormLayout(element.properties) === undefined ? {} : {
53
54
  layout: commandFormLayout(element.properties)
54
- }
55
+ },
56
+ ...stringProperty(element.properties, 'widthSizeClass') === WidthSizeClass.Compact ? {
57
+ compact: true
58
+ } : {}
55
59
  }, commandKey(target))
56
60
  });
57
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SceneCommandForm.js","sources":["../../../forms/SceneCommandForm.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { lazy } from 'react';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { ArcRuntimeBoundary, BindingKind, MissingBinding, resolveElementBinding } from '../bindings';\nimport type { BoundConstructor } from '../bindings';\nimport { numberProperty, stringArrayProperty, stringProperty, unionProperty } from '../properties';\nimport { commandFormLayout } from './commandFormLayout';\nimport { commandInputs } from './commandInputs';\n\nconst CommandFormRuntime = lazy(() => import('./CommandFormRuntime'));\n\n// Arc's useCommand constructs the proxy only on mount. Key by the actual registered class,\n// not its Scene name (which may be re-registered with a different route or roles).\nconst commandKeys = new WeakMap<BoundConstructor, number>();\nlet nextCommandKey = 0;\nfunction commandKey(command: BoundConstructor): number {\n let key = commandKeys.get(command);\n if (key === undefined) {\n key = ++nextCommandKey;\n commandKeys.set(command, key);\n }\n return key;\n}\n\n/**\n * Auto mode follows supported native proxy descriptors; opt-in inputs bind exactly named fields\n * inside a single native Arc form. Neither mode consumes the content slot.\n */\nexport function SceneCommandForm({ element }: RegisteredComponentProps) {\n const { name, target } = resolveElementBinding(element, BindingKind.Command);\n if (!target) return <MissingBinding element={element} kind={BindingKind.Command} name={name} />;\n\n const mode = unionProperty(element.properties, 'mode', ['auto', 'manual'] as const) ?? (Object.hasOwn(element.properties, 'inputs') ? 'manual' : 'auto');\n const inputs = mode === 'manual' ? commandInputs(element.properties) : undefined;\n if (mode === 'manual' && !inputs) return <div role='alert'>Invalid command form inputs declaration</div>;\n\n return (\n <ArcRuntimeBoundary>\n <CommandFormRuntime\n key={commandKey(target)}\n command={target}\n inputs={inputs}\n exclude={stringArrayProperty(element.properties, 'exclude')}\n submitLabel={stringProperty(element.properties, 'submitLabel') ?? 'Submit'}\n {...(numberProperty(element.properties, 'columns') === undefined ? {} : { columns: numberProperty(element.properties, 'columns') })}\n {...(commandFormLayout(element.properties) === undefined ? {} : { layout: commandFormLayout(element.properties) })}\n />\n </ArcRuntimeBoundary>\n );\n}\n"],"names":["CommandFormRuntime","lazy","commandKeys","WeakMap","nextCommandKey","commandKey","command","key","get","undefined","set","SceneCommandForm","element","name","target","resolveElementBinding","BindingKind","Command","_jsx","MissingBinding","kind","mode","unionProperty","properties","Object","hasOwn","inputs","commandInputs","div","role","ArcRuntimeBoundary","exclude","stringArrayProperty","submitLabel","stringProperty","numberProperty","columns","commandFormLayout","layout"],"mappings":";;;;;;;;;;AAWA,MAAMA,kBAAAA,iBAAqBC,IAAAA,CAAK,IAAM,OAAO,yBAAA,CAAA,CAAA;AAE7C;AACA;AACA,MAAMC,cAAc,IAAIC,OAAAA,EAAAA;AACxB,IAAIC,cAAAA,GAAiB,CAAA;AACrB,SAASC,WAAWC,OAAyB,EAAA;IACzC,IAAIC,GAAAA,GAAML,WAAAA,CAAYM,GAAG,CAACF,OAAAA,CAAAA;AAC1B,IAAA,IAAIC,QAAQE,SAAAA,EAAW;AACnBF,QAAAA,GAAAA,GAAM,EAAEH,cAAAA;QACRF,WAAAA,CAAYQ,GAAG,CAACJ,OAAAA,EAASC,GAAAA,CAAAA;AAC7B,IAAA;IACA,OAAOA,GAAAA;AACX;AAEA;;;AAGC,IACM,SAASI,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;IAClE,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGC,qBAAAA,CAAsBH,OAAAA,EAASI,WAAAA,CAAYC,OAAO,CAAA;IAC3E,IAAI,CAACH,MAAAA,EAAQ,qBAAOI,GAAA,CAACC,cAAAA,EAAAA;QAAeP,OAAAA,EAASA,OAAAA;AAASQ,QAAAA,IAAAA,EAAMJ,YAAYC,OAAO;QAAEJ,IAAAA,EAAMA;;AAEvF,IAAA,MAAMQ,IAAAA,GAAOC,aAAAA,CAAcV,OAAAA,CAAQW,UAAU,EAAE,MAAA,EAAQ;AAAC,QAAA,MAAA;AAAQ,QAAA;KAAS,CAAA,KAAeC,OAAOC,MAAM,CAACb,QAAQW,UAAU,EAAE,QAAA,CAAA,GAAY,QAAA,GAAW,MAAK,CAAA;AACtJ,IAAA,MAAMG,SAASL,IAAAA,KAAS,QAAA,GAAWM,aAAAA,CAAcf,OAAAA,CAAQW,UAAU,CAAA,GAAId,SAAAA;AACvE,IAAA,IAAIY,IAAAA,KAAS,QAAA,IAAY,CAACK,MAAAA,EAAQ,qBAAOR,GAAA,CAACU,KAAAA,EAAAA;QAAIC,IAAAA,EAAK,OAAA;AAAQ,QAAA,QAAA,EAAA;;AAE3D,IAAA,qBACIX,GAAA,CAACY,kBAAAA,EAAAA;AACG,QAAA,QAAA,gBAAAZ,GAAA,CAAClB,kBAAAA,EAAAA;YAEGM,OAAAA,EAASQ,MAAAA;YACTY,MAAAA,EAAQA,MAAAA;YACRK,OAAAA,EAASC,mBAAAA,CAAoBpB,OAAAA,CAAQW,UAAU,EAAE,SAAA,CAAA;AACjDU,YAAAA,WAAAA,EAAaC,cAAAA,CAAetB,OAAAA,CAAQW,UAAU,EAAE,aAAA,CAAA,IAAkB,QAAA;AACjE,YAAA,GAAIY,eAAevB,OAAAA,CAAQW,UAAU,EAAE,SAAA,CAAA,KAAed,SAAAA,GAAY,EAAC,GAAI;gBAAE2B,OAAAA,EAASD,cAAAA,CAAevB,OAAAA,CAAQW,UAAU,EAAE,SAAA;aAAY;AACjI,YAAA,GAAIc,kBAAkBzB,OAAAA,CAAQW,UAAU,CAAA,KAAMd,SAAAA,GAAY,EAAC,GAAI;gBAAE6B,MAAAA,EAAQD,iBAAAA,CAAkBzB,QAAQW,UAAU;;WANzGlB,UAAAA,CAAWS,MAAAA,CAAAA;;AAUhC;;"}
1
+ {"version":3,"file":"SceneCommandForm.js","sources":["../../../forms/SceneCommandForm.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { lazy } from 'react';\nimport { WidthSizeClass } from '@cratis/scene.model';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { ArcRuntimeBoundary, BindingKind, MissingBinding, resolveElementBinding } from '../bindings';\nimport type { BoundConstructor } from '../bindings';\nimport { numberProperty, stringArrayProperty, stringProperty, unionProperty } from '../properties';\nimport { commandFormLayout } from './commandFormLayout';\nimport { commandInputs } from './commandInputs';\n\nconst CommandFormRuntime = lazy(() => import('./CommandFormRuntime'));\n\n// Arc's useCommand constructs the proxy only on mount. Key by the actual registered class,\n// not its Scene name (which may be re-registered with a different route or roles).\nconst commandKeys = new WeakMap<BoundConstructor, number>();\nlet nextCommandKey = 0;\nfunction commandKey(command: BoundConstructor): number {\n let key = commandKeys.get(command);\n if (key === undefined) {\n key = ++nextCommandKey;\n commandKeys.set(command, key);\n }\n return key;\n}\n\n/**\n * Auto mode follows supported native proxy descriptors; opt-in inputs bind exactly named fields\n * inside a single native Arc form. Neither mode consumes the content slot.\n */\nexport function SceneCommandForm({ element }: RegisteredComponentProps) {\n const { name, target } = resolveElementBinding(element, BindingKind.Command);\n if (!target) return <MissingBinding element={element} kind={BindingKind.Command} name={name} />;\n\n const mode = unionProperty(element.properties, 'mode', ['auto', 'manual'] as const) ?? (Object.hasOwn(element.properties, 'inputs') ? 'manual' : 'auto');\n const inputs = mode === 'manual' ? commandInputs(element.properties) : undefined;\n if (mode === 'manual' && !inputs) return <div role='alert'>Invalid command form inputs declaration</div>;\n\n return (\n <ArcRuntimeBoundary>\n <CommandFormRuntime\n key={commandKey(target)}\n command={target}\n inputs={inputs}\n exclude={stringArrayProperty(element.properties, 'exclude')}\n submitLabel={stringProperty(element.properties, 'submitLabel') ?? 'Submit'}\n {...(numberProperty(element.properties, 'columns') === undefined ? {} : { columns: numberProperty(element.properties, 'columns') })}\n {...(commandFormLayout(element.properties) === undefined ? {} : { layout: commandFormLayout(element.properties) })}\n {...(stringProperty(element.properties, 'widthSizeClass') === WidthSizeClass.Compact ? { compact: true } : {})}\n />\n </ArcRuntimeBoundary>\n );\n}\n"],"names":["CommandFormRuntime","lazy","commandKeys","WeakMap","nextCommandKey","commandKey","command","key","get","undefined","set","SceneCommandForm","element","name","target","resolveElementBinding","BindingKind","Command","_jsx","MissingBinding","kind","mode","unionProperty","properties","Object","hasOwn","inputs","commandInputs","div","role","ArcRuntimeBoundary","exclude","stringArrayProperty","submitLabel","stringProperty","numberProperty","columns","commandFormLayout","layout","WidthSizeClass","Compact","compact"],"mappings":";;;;;;;;;;;AAYA,MAAMA,kBAAAA,iBAAqBC,IAAAA,CAAK,IAAM,OAAO,yBAAA,CAAA,CAAA;AAE7C;AACA;AACA,MAAMC,cAAc,IAAIC,OAAAA,EAAAA;AACxB,IAAIC,cAAAA,GAAiB,CAAA;AACrB,SAASC,WAAWC,OAAyB,EAAA;IACzC,IAAIC,GAAAA,GAAML,WAAAA,CAAYM,GAAG,CAACF,OAAAA,CAAAA;AAC1B,IAAA,IAAIC,QAAQE,SAAAA,EAAW;AACnBF,QAAAA,GAAAA,GAAM,EAAEH,cAAAA;QACRF,WAAAA,CAAYQ,GAAG,CAACJ,OAAAA,EAASC,GAAAA,CAAAA;AAC7B,IAAA;IACA,OAAOA,GAAAA;AACX;AAEA;;;AAGC,IACM,SAASI,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;IAClE,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGC,qBAAAA,CAAsBH,OAAAA,EAASI,WAAAA,CAAYC,OAAO,CAAA;IAC3E,IAAI,CAACH,MAAAA,EAAQ,qBAAOI,GAAA,CAACC,cAAAA,EAAAA;QAAeP,OAAAA,EAASA,OAAAA;AAASQ,QAAAA,IAAAA,EAAMJ,YAAYC,OAAO;QAAEJ,IAAAA,EAAMA;;AAEvF,IAAA,MAAMQ,IAAAA,GAAOC,aAAAA,CAAcV,OAAAA,CAAQW,UAAU,EAAE,MAAA,EAAQ;AAAC,QAAA,MAAA;AAAQ,QAAA;KAAS,CAAA,KAAeC,OAAOC,MAAM,CAACb,QAAQW,UAAU,EAAE,QAAA,CAAA,GAAY,QAAA,GAAW,MAAK,CAAA;AACtJ,IAAA,MAAMG,SAASL,IAAAA,KAAS,QAAA,GAAWM,aAAAA,CAAcf,OAAAA,CAAQW,UAAU,CAAA,GAAId,SAAAA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