@cratis/scene.react 4.29.0 → 4.30.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 (133) hide show
  1. package/core/CoreToolbar.tsx +37 -6
  2. package/core/coreComponentMetadata.ts +1 -0
  3. package/core/coreComponents.ts +2 -0
  4. package/core/coreDescriptors.ts +13 -0
  5. package/core/corePackage.ts +1 -0
  6. package/dist/cjs/core/CoreToolbar.js +44 -4
  7. package/dist/cjs/core/CoreToolbar.js.map +1 -1
  8. package/dist/cjs/core/coreComponentMetadata.js +6 -0
  9. package/dist/cjs/core/coreComponentMetadata.js.map +1 -1
  10. package/dist/cjs/core/coreComponents.js +3 -1
  11. package/dist/cjs/core/coreComponents.js.map +1 -1
  12. package/dist/cjs/core/coreDescriptors.js +27 -0
  13. package/dist/cjs/core/coreDescriptors.js.map +1 -1
  14. package/dist/cjs/core/corePackage.js +2 -1
  15. package/dist/cjs/core/corePackage.js.map +1 -1
  16. package/dist/cjs/index.js +20 -0
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/navigation/SceneNavigationContext.js.map +1 -1
  19. package/dist/cjs/navigation/SceneNavigationHost.js +10 -5
  20. package/dist/cjs/navigation/SceneNavigationHost.js.map +1 -1
  21. package/dist/cjs/navigation/useSceneHistoryNavigation.js +3 -1
  22. package/dist/cjs/navigation/useSceneHistoryNavigation.js.map +1 -1
  23. package/dist/cjs/slices/CoreSliceDialog.js +21 -0
  24. package/dist/cjs/slices/CoreSliceDialog.js.map +1 -0
  25. package/dist/cjs/slices/SliceCommandFieldsContext.js +22 -0
  26. package/dist/cjs/slices/SliceCommandFieldsContext.js.map +1 -0
  27. package/dist/cjs/slices/SliceDialogView.js +254 -0
  28. package/dist/cjs/slices/SliceDialogView.js.map +1 -0
  29. package/dist/cjs/slices/SliceInvokerContext.js +40 -0
  30. package/dist/cjs/slices/SliceInvokerContext.js.map +1 -0
  31. package/dist/cjs/slices/createAnnouncingInvoker.js +27 -0
  32. package/dist/cjs/slices/createAnnouncingInvoker.js.map +1 -0
  33. package/dist/cjs/slices/createDryRunInvoker.js +38 -0
  34. package/dist/cjs/slices/createDryRunInvoker.js.map +1 -0
  35. package/dist/cjs/slices/sliceDialogDestination.js +41 -0
  36. package/dist/cjs/slices/sliceDialogDestination.js.map +1 -0
  37. package/dist/esm/core/CoreToolbar.d.ts.map +1 -1
  38. package/dist/esm/core/CoreToolbar.js +47 -7
  39. package/dist/esm/core/CoreToolbar.js.map +1 -1
  40. package/dist/esm/core/coreComponentMetadata.d.ts.map +1 -1
  41. package/dist/esm/core/coreComponentMetadata.js +6 -0
  42. package/dist/esm/core/coreComponentMetadata.js.map +1 -1
  43. package/dist/esm/core/coreComponents.d.ts.map +1 -1
  44. package/dist/esm/core/coreComponents.js +3 -1
  45. package/dist/esm/core/coreComponents.js.map +1 -1
  46. package/dist/esm/core/coreDescriptors.d.ts.map +1 -1
  47. package/dist/esm/core/coreDescriptors.js +27 -0
  48. package/dist/esm/core/coreDescriptors.js.map +1 -1
  49. package/dist/esm/core/corePackage.d.ts.map +1 -1
  50. package/dist/esm/core/corePackage.js +2 -1
  51. package/dist/esm/core/corePackage.js.map +1 -1
  52. package/dist/esm/index.d.ts +1 -0
  53. package/dist/esm/index.d.ts.map +1 -1
  54. package/dist/esm/index.js +7 -0
  55. package/dist/esm/index.js.map +1 -1
  56. package/dist/esm/navigation/SceneNavigationContext.d.ts +1 -0
  57. package/dist/esm/navigation/SceneNavigationContext.d.ts.map +1 -1
  58. package/dist/esm/navigation/SceneNavigationContext.js.map +1 -1
  59. package/dist/esm/navigation/SceneNavigationHost.d.ts.map +1 -1
  60. package/dist/esm/navigation/SceneNavigationHost.js +10 -5
  61. package/dist/esm/navigation/SceneNavigationHost.js.map +1 -1
  62. package/dist/esm/navigation/SceneNavigationState.d.ts +1 -0
  63. package/dist/esm/navigation/SceneNavigationState.d.ts.map +1 -1
  64. package/dist/esm/navigation/useSceneHistoryNavigation.d.ts.map +1 -1
  65. package/dist/esm/navigation/useSceneHistoryNavigation.js +3 -1
  66. package/dist/esm/navigation/useSceneHistoryNavigation.js.map +1 -1
  67. package/dist/esm/slices/CoreSliceDialog.d.ts +3 -0
  68. package/dist/esm/slices/CoreSliceDialog.d.ts.map +1 -0
  69. package/dist/esm/slices/CoreSliceDialog.js +19 -0
  70. package/dist/esm/slices/CoreSliceDialog.js.map +1 -0
  71. package/dist/esm/slices/InvocationResult.d.ts +10 -0
  72. package/dist/esm/slices/InvocationResult.d.ts.map +1 -0
  73. package/dist/esm/slices/InvocationResult.js +2 -0
  74. package/dist/esm/slices/InvocationResult.js.map +1 -0
  75. package/dist/esm/slices/InvocationValidationError.d.ts +5 -0
  76. package/dist/esm/slices/InvocationValidationError.d.ts.map +1 -0
  77. package/dist/esm/slices/InvocationValidationError.js +2 -0
  78. package/dist/esm/slices/InvocationValidationError.js.map +1 -0
  79. package/dist/esm/slices/SliceCommandField.d.ts +7 -0
  80. package/dist/esm/slices/SliceCommandField.d.ts.map +1 -0
  81. package/dist/esm/slices/SliceCommandField.js +2 -0
  82. package/dist/esm/slices/SliceCommandField.js.map +1 -0
  83. package/dist/esm/slices/SliceCommandFieldsContext.d.ts +10 -0
  84. package/dist/esm/slices/SliceCommandFieldsContext.d.ts.map +1 -0
  85. package/dist/esm/slices/SliceCommandFieldsContext.js +19 -0
  86. package/dist/esm/slices/SliceCommandFieldsContext.js.map +1 -0
  87. package/dist/esm/slices/SliceDialogView.d.ts +12 -0
  88. package/dist/esm/slices/SliceDialogView.d.ts.map +1 -0
  89. package/dist/esm/slices/SliceDialogView.js +250 -0
  90. package/dist/esm/slices/SliceDialogView.js.map +1 -0
  91. package/dist/esm/slices/SliceInvoker.d.ts +5 -0
  92. package/dist/esm/slices/SliceInvoker.d.ts.map +1 -0
  93. package/dist/esm/slices/SliceInvoker.js +2 -0
  94. package/dist/esm/slices/SliceInvoker.js.map +1 -0
  95. package/dist/esm/slices/SliceInvokerContext.d.ts +11 -0
  96. package/dist/esm/slices/SliceInvokerContext.d.ts.map +1 -0
  97. package/dist/esm/slices/SliceInvokerContext.js +36 -0
  98. package/dist/esm/slices/SliceInvokerContext.js.map +1 -0
  99. package/dist/esm/slices/createAnnouncingInvoker.d.ts +3 -0
  100. package/dist/esm/slices/createAnnouncingInvoker.d.ts.map +1 -0
  101. package/dist/esm/slices/createAnnouncingInvoker.js +25 -0
  102. package/dist/esm/slices/createAnnouncingInvoker.js.map +1 -0
  103. package/dist/esm/slices/createDryRunInvoker.d.ts +15 -0
  104. package/dist/esm/slices/createDryRunInvoker.d.ts.map +1 -0
  105. package/dist/esm/slices/createDryRunInvoker.js +36 -0
  106. package/dist/esm/slices/createDryRunInvoker.js.map +1 -0
  107. package/dist/esm/slices/index.d.ts +12 -0
  108. package/dist/esm/slices/index.d.ts.map +1 -0
  109. package/dist/esm/slices/index.js +12 -0
  110. package/dist/esm/slices/index.js.map +1 -0
  111. package/dist/esm/slices/sliceDialogDestination.d.ts +10 -0
  112. package/dist/esm/slices/sliceDialogDestination.d.ts.map +1 -0
  113. package/dist/esm/slices/sliceDialogDestination.js +38 -0
  114. package/dist/esm/slices/sliceDialogDestination.js.map +1 -0
  115. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  116. package/index.ts +1 -0
  117. package/navigation/SceneNavigationContext.tsx +3 -0
  118. package/navigation/SceneNavigationHost.tsx +8 -3
  119. package/navigation/SceneNavigationState.ts +3 -0
  120. package/navigation/useSceneHistoryNavigation.ts +2 -1
  121. package/package.json +5 -5
  122. package/slices/CoreSliceDialog.tsx +14 -0
  123. package/slices/InvocationResult.ts +27 -0
  124. package/slices/InvocationValidationError.ts +13 -0
  125. package/slices/SliceCommandField.ts +19 -0
  126. package/slices/SliceCommandFieldsContext.tsx +28 -0
  127. package/slices/SliceDialogView.tsx +176 -0
  128. package/slices/SliceInvoker.ts +19 -0
  129. package/slices/SliceInvokerContext.tsx +47 -0
  130. package/slices/createAnnouncingInvoker.ts +17 -0
  131. package/slices/createDryRunInvoker.ts +43 -0
  132. package/slices/index.ts +14 -0
  133. package/slices/sliceDialogDestination.ts +40 -0
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * An invoker that sends nothing (PRV5): it validates, reports what it would have sent and succeeds, so a preview can walk a
7
+ * toolbar button through its dialog without touching a backend.
8
+ */ function createDryRunInvoker(options = {}) {
9
+ return {
10
+ dryRun: true,
11
+ async invoke (sliceId, payload, command) {
12
+ const invocation = {
13
+ sliceId,
14
+ payload,
15
+ ...command === undefined ? {} : {
16
+ command
17
+ }
18
+ };
19
+ const validationErrors = options.validate?.(invocation) ?? [];
20
+ if (validationErrors.length > 0) return {
21
+ succeeded: false,
22
+ validationErrors,
23
+ payload,
24
+ dryRun: true
25
+ };
26
+ options.onInvoked?.(invocation);
27
+ return {
28
+ succeeded: true,
29
+ payload,
30
+ dryRun: true,
31
+ message: `Dry run: ${command ?? sliceId} was not sent.`
32
+ };
33
+ }
34
+ };
35
+ }
36
+
37
+ exports.createDryRunInvoker = createDryRunInvoker;
38
+ //# sourceMappingURL=createDryRunInvoker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDryRunInvoker.js","sources":["../../../slices/createDryRunInvoker.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 { InvocationValidationError } from './InvocationValidationError';\nimport { SliceInvoker } from './SliceInvoker';\n\n/** What a dry run is told about each invocation. */\nexport interface DryRunInvocation {\n /** The qualified id of the slice. */\n sliceId: string;\n\n /** The command the slice accepts, when known. */\n command?: string;\n\n /** The payload that would have been sent. */\n payload: Record<string, unknown>;\n}\n\nexport interface DryRunInvokerOptions {\n /** Called for every invocation that passes validation, with the would-be payload - the Studio preview shows it as a toast. */\n onInvoked?(invocation: DryRunInvocation): void;\n\n /** Extra validation of the payload; the problems it returns are reported like the real ones and nothing is invoked. */\n validate?(invocation: DryRunInvocation): InvocationValidationError[];\n}\n\n/**\n * An invoker that sends nothing (PRV5): it validates, reports what it would have sent and succeeds, so a preview can walk a\n * toolbar button through its dialog without touching a backend.\n */\nexport function createDryRunInvoker(options: DryRunInvokerOptions = {}): SliceInvoker & { readonly dryRun: true } {\n return {\n dryRun: true,\n async invoke(sliceId, payload, command) {\n const invocation: DryRunInvocation = { sliceId, payload, ...(command === undefined ? {} : { command }) };\n const validationErrors = options.validate?.(invocation) ?? [];\n if (validationErrors.length > 0) return { succeeded: false, validationErrors, payload, dryRun: true };\n\n options.onInvoked?.(invocation);\n return { succeeded: true, payload, dryRun: true, message: `Dry run: ${command ?? sliceId} was not sent.` };\n },\n };\n}\n"],"names":["createDryRunInvoker","options","dryRun","invoke","sliceId","payload","command","invocation","undefined","validationErrors","validate","length","succeeded","onInvoked","message"],"mappings":";;AAAA;AACA;AAyBA;;;AAGC,IACM,SAASA,mBAAAA,CAAoBC,OAAAA,GAAgC,EAAE,EAAA;IAClE,OAAO;QACHC,MAAAA,EAAQ,IAAA;AACR,QAAA,MAAMC,MAAAA,CAAAA,CAAOC,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAA;AAClC,YAAA,MAAMC,UAAAA,GAA+B;AAAEH,gBAAAA,OAAAA;AAASC,gBAAAA,OAAAA;gBAAS,GAAIC,OAAAA,KAAYE,SAAAA,GAAY,EAAC,GAAI;AAAEF,oBAAAA;;AAAW,aAAA;AACvG,YAAA,MAAMG,gBAAAA,GAAmBR,OAAAA,CAAQS,QAAQ,GAAGH,eAAe,EAAE;AAC7D,YAAA,IAAIE,gBAAAA,CAAiBE,MAAM,GAAG,CAAA,EAAG,OAAO;gBAAEC,SAAAA,EAAW,KAAA;AAAOH,gBAAAA,gBAAAA;AAAkBJ,gBAAAA,OAAAA;gBAASH,MAAAA,EAAQ;AAAK,aAAA;AAEpGD,YAAAA,OAAAA,CAAQY,SAAS,GAAGN,UAAAA,CAAAA;YACpB,OAAO;gBAAEK,SAAAA,EAAW,IAAA;AAAMP,gBAAAA,OAAAA;gBAASH,MAAAA,EAAQ,IAAA;AAAMY,gBAAAA,OAAAA,EAAS,CAAC,SAAS,EAAER,OAAAA,IAAWF,OAAAA,CAAQ,cAAc;AAAE,aAAA;AAC7G,QAAA;AACJ,KAAA;AACJ;;"}
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ const literal = (value)=>({
8
+ kind: scene_model.BindingSourceKind.Literal,
9
+ path: '',
10
+ value
11
+ });
12
+ /**
13
+ * The destination that opens a toolbar button's task dialog through the navigation host: the dialog template the slice
14
+ * resolves to (`sliceDialogFor`), with the slice, its command and the button's title as parameters.
15
+ * @param button The resolved button.
16
+ * @returns The destination, or undefined when the button has no state change slice to open.
17
+ */ function sliceDialogDestination(button) {
18
+ if (!button.dialog) return undefined;
19
+ return {
20
+ kind: scene_model.DestinationKind.Dialog,
21
+ dialog: button.dialog.template,
22
+ routeParameterBindings: {
23
+ slice: literal(button.dialog.slice),
24
+ command: literal(button.dialog.command),
25
+ title: literal(button.title)
26
+ }
27
+ };
28
+ }
29
+ /** Reads the slice dialog parameters back from what the host carries; undefined when they are not those of a slice dialog. */ function sliceDialogParameters(parameters) {
30
+ const slice = parameters?.slice;
31
+ const command = parameters?.command;
32
+ return slice && command ? {
33
+ slice,
34
+ command,
35
+ title: parameters?.title || command
36
+ } : undefined;
37
+ }
38
+
39
+ exports.sliceDialogDestination = sliceDialogDestination;
40
+ exports.sliceDialogParameters = sliceDialogParameters;
41
+ //# sourceMappingURL=sliceDialogDestination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sliceDialogDestination.js","sources":["../../../slices/sliceDialogDestination.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 { BindingExpression, BindingSourceKind, DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { ResolvedToolbarButton } from '@cratis/scene.engine';\n\nconst literal = (value: string): BindingExpression => ({ kind: BindingSourceKind.Literal, path: '', value }) as BindingExpression;\n\n/** The dialog parameters a slice dialog is opened with; the navigation host hands them back as `currentDialogParameters`. */\nexport interface SliceDialogParameters {\n slice: string;\n command: string;\n title: string;\n}\n\n/**\n * The destination that opens a toolbar button's task dialog through the navigation host: the dialog template the slice\n * resolves to (`sliceDialogFor`), with the slice, its command and the button's title as parameters.\n * @param button The resolved button.\n * @returns The destination, or undefined when the button has no state change slice to open.\n */\nexport function sliceDialogDestination(button: ResolvedToolbarButton): DestinationReference | undefined {\n if (!button.dialog) return undefined;\n return {\n kind: DestinationKind.Dialog,\n dialog: button.dialog.template,\n routeParameterBindings: {\n slice: literal(button.dialog.slice),\n command: literal(button.dialog.command),\n title: literal(button.title),\n },\n };\n}\n\n/** Reads the slice dialog parameters back from what the host carries; undefined when they are not those of a slice dialog. */\nexport function sliceDialogParameters(parameters: Record<string, string> | undefined): SliceDialogParameters | undefined {\n const slice = parameters?.slice;\n const command = parameters?.command;\n return slice && command ? { slice, command, title: parameters?.title || command } : undefined;\n}\n"],"names":["literal","value","kind","BindingSourceKind","Literal","path","sliceDialogDestination","button","dialog","undefined","DestinationKind","Dialog","template","routeParameterBindings","slice","command","title","sliceDialogParameters","parameters"],"mappings":";;;;AAAA;AACA;AAKA,MAAMA,OAAAA,GAAU,CAACC,KAAAA,IAAsC;AAAEC,QAAAA,IAAAA,EAAMC,8BAAkBC,OAAO;QAAEC,IAAAA,EAAM,EAAA;AAAIJ,QAAAA;KAAM,CAAA;AAS1G;;;;;IAMO,SAASK,sBAAAA,CAAuBC,MAA6B,EAAA;AAChE,IAAA,IAAI,CAACA,MAAAA,CAAOC,MAAM,EAAE,OAAOC,SAAAA;IAC3B,OAAO;AACHP,QAAAA,IAAAA,EAAMQ,4BAAgBC,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AAE,EAAE,wBAAwB,+BAkDpE"}
1
+ {"version":3,"file":"CoreToolbar.d.ts","sourceRoot":"","sources":["../../../core/CoreToolbar.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAyD,oBAAoB,EAAmB,MAAM,qBAAqB,CAAC;AACnI,OAAO,EAAE,wBAAwB,EAAyB,MAAM,aAAa,CAAC;AAO9E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAqDvD,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAGtF;AAQD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,oBAAoB,GAAG,SAAS,CAW5G;AAMD,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,wBAAwB,+BAGvE;AAcD,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAwEpE"}
@@ -1,11 +1,14 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { useContext } from 'react';
3
- import { resolveBindingExpression } from '@cratis/scene.engine';
4
- import { DestinationKind, BindingSourceKind } from '@cratis/scene.model';
2
+ import { useContext, useMemo } from 'react';
3
+ import { toolbarButtonFromItem, ApplicationStructureIndex, resolveToolbarButton, resolveBindingExpression } from '@cratis/scene.engine';
4
+ import { DestinationKind, ToolbarEmphasis, BindingSourceKind } from '@cratis/scene.model';
5
5
  import { useRenderBindingScope } from '../renderer/RenderBindingScopeContext.js';
6
6
  import '../interactions/useInteractions.js';
7
7
  import '../interactions/NotificationHost.js';
8
8
  import { SceneNavigationContextInternal } from '../navigation/SceneNavigationContext.js';
9
+ import { useSceneNavigationModel } from '../navigation/region/SceneNavigationModelContext.js';
10
+ import { sliceDialogDestination } from '../slices/sliceDialogDestination.js';
11
+ import { useWarnEmptySlices } from '../slices/SliceInvokerContext.js';
9
12
 
10
13
  function textProperty(properties, name) {
11
14
  return typeof properties[name] === 'string' ? properties[name] : undefined;
@@ -57,6 +60,10 @@ function resolveParameters(parameters, scope) {
57
60
  ]))
58
61
  };
59
62
  }
63
+ /** How prominent the item is: its authored emphasis, else `secondary`. */ function emphasisOf(properties) {
64
+ const emphasis = textProperty(properties, 'emphasis')?.toLowerCase();
65
+ return emphasis === ToolbarEmphasis.Primary || emphasis === ToolbarEmphasis.Quiet ? emphasis : ToolbarEmphasis.Secondary;
66
+ }
60
67
  /** The mode the item's authored presentation asks for; anything it does not name shows both. */ function toolbarItemMode(presentation) {
61
68
  const mode = presentation.mode;
62
69
  return mode === 'icon' || mode === 'text' ? mode : 'both';
@@ -122,16 +129,37 @@ function resolveParameters(parameters, scope) {
122
129
  const presentation = recordProperty(element.properties, 'presentation');
123
130
  const mode = toolbarItemMode(presentation);
124
131
  const destination = toolbarItemDestination(element.properties);
132
+ const model = useSceneNavigationModel();
133
+ const warnEmptySlices = useWarnEmptySlices();
134
+ const button = useMemo(()=>toolbarButtonFromItem(element.id, element.properties), [
135
+ element.id,
136
+ element.properties
137
+ ]);
138
+ const resolved = useMemo(()=>{
139
+ if (!button || !model) return undefined;
140
+ const index = model.structure instanceof ApplicationStructureIndex ? model.structure : new ApplicationStructureIndex(model.structure);
141
+ return resolveToolbarButton(index, button);
142
+ }, [
143
+ button,
144
+ model
145
+ ]);
146
+ const dialog = resolved ? sliceDialogDestination(resolved) : undefined;
147
+ const emphasis = resolved?.emphasis ?? button?.emphasis ?? emphasisOf(element.properties);
148
+ const empty = button !== undefined && button.slice === undefined && button.target === undefined;
125
149
  const attributes = Object.fromEntries(Object.entries(presentation).filter(([key])=>/^[A-Za-z][A-Za-z0-9-]*$/.test(key)).map(([key, value])=>[
126
150
  `data-scene-presentation-${key.toLowerCase()}`,
127
151
  String(value)
128
152
  ]));
129
153
  const activate = ()=>{
130
- if (kind === 'action') {
154
+ if (dialog && navigation) {
155
+ navigation.navigate(dialog);
156
+ return;
157
+ }
158
+ if (kind === 'action' || button !== undefined) {
131
159
  const args = resolveParameters(recordProperty(element.properties, 'parameters'), scope);
132
160
  globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', {
133
161
  detail: {
134
- command: target,
162
+ command: target || button?.slice || '',
135
163
  element,
136
164
  arguments: args
137
165
  }
@@ -161,7 +189,12 @@ function resolveParameters(parameters, scope) {
161
189
  "data-scene-mode": mode,
162
190
  "aria-label": mode === 'icon' ? label : undefined,
163
191
  title: mode === 'icon' ? label : undefined,
164
- disabled: kind !== 'action' && !destination,
192
+ disabled: kind !== 'action' && button === undefined && !destination,
193
+ "aria-haspopup": dialog ? 'dialog' : undefined,
194
+ "data-scene-emphasis": emphasis,
195
+ "data-scene-slice": resolved?.slice ?? button?.slice,
196
+ "data-scene-warning": warnEmptySlices && empty ? 'emptySlice' : undefined,
197
+ className: `scene-toolbar-button scene-toolbar-button-${emphasis}`,
165
198
  onClick: activate,
166
199
  ...attributes,
167
200
  children: [
@@ -169,7 +202,14 @@ function resolveParameters(parameters, scope) {
169
202
  "aria-hidden": "true",
170
203
  "data-scene-icon-name": icon
171
204
  }),
172
- mode !== 'icon' && label
205
+ mode !== 'icon' && label,
206
+ warnEmptySlices && empty && /*#__PURE__*/ jsx("span", {
207
+ role: "img",
208
+ "aria-label": "No slice is linked to this button",
209
+ title: "No slice is linked to this button",
210
+ "data-scene-badge": "warning",
211
+ children: "!"
212
+ })
173
213
  ]
174
214
  });
175
215
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CoreToolbar.js","sources":["../../../core/CoreToolbar.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 { useContext } from 'react';\nimport { BindingScope, resolveBindingExpression } from '@cratis/scene.engine';\nimport { BindingExpression, BindingSourceKind, DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { RegisteredComponentProps, useRenderBindingScope } from '../renderer';\nimport { SceneNavigationContextInternal } from '../navigation/SceneNavigationContext';\n\n/** How a toolbar item shows its icon and label - the `mode` an item's presentation hint can name. */\nexport type ToolbarItemMode = 'icon' | 'text' | 'both';\n\nfunction textProperty(properties: Record<string, unknown>, name: string): string | undefined {\n return typeof properties[name] === 'string' ? properties[name] : undefined;\n}\n\nfunction recordProperty(properties: Record<string, unknown>, name: string): Record<string, unknown> {\n const value = properties[name];\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {};\n}\n\nfunction isDestination(value: unknown): value is DestinationReference {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n return ['screen', 'module', 'route', 'dialog', 'outlet'].some(key => typeof (value as Record<string, unknown>)[key] === 'string');\n}\n\nfunction isBinding(value: unknown): value is BindingExpression {\n return value !== null && typeof value === 'object' && typeof (value as BindingExpression).path === 'string';\n}\n\nfunction literal(value: unknown): BindingExpression {\n return { kind: BindingSourceKind.Literal, path: '', value } as BindingExpression;\n}\n\nfunction resolveParameters(parameters: Record<string, unknown>, scope: BindingScope): Record<string, unknown> {\n return Object.fromEntries(Object.entries(parameters).map(([name, binding]) =>\n [name, isBinding(binding) ? resolveBindingExpression(binding, scope) : binding]));\n}\n\n/**\n * An authored destination with its route parameters read now, against the scope the item renders in.\n *\n * A navigation host resolves a destination against its own scope, which cannot see what the screen's components\n * publish - a table's selected row, an input's value - so the item resolves them where it is, and hands the host\n * literals. (The renderer leaves a destination's bindings alone, unlike the rest of an element's properties.)\n */\nfunction withResolvedParameters(destination: DestinationReference, scope: BindingScope): DestinationReference {\n const bindings = destination.routeParameterBindings;\n if (!bindings) return destination;\n return {\n ...destination,\n routeParameterBindings: Object.fromEntries(Object.entries(bindings).map(([name, binding]) =>\n [name, literal(resolveBindingExpression(binding, scope))])),\n };\n}\n\n/** The mode the item's authored presentation asks for; anything it does not name shows both. */\nexport function toolbarItemMode(presentation: Record<string, unknown>): ToolbarItemMode {\n const mode = presentation.mode;\n return mode === 'icon' || mode === 'text' ? mode : 'both';\n}\n\n/**\n * Where activating a toolbar item goes.\n *\n * The destination the document authored wins. Without one, a `Navigate` item opens its target screen - its\n * parameters become route parameter bindings - and a `Dialog` item opens its target dialog template.\n */\nexport function toolbarItemDestination(properties: Record<string, unknown>): DestinationReference | undefined {\n if (isDestination(properties.destination)) return properties.destination;\n const kind = textProperty(properties, 'kind')?.toLowerCase();\n const target = textProperty(properties, 'target');\n if (!target) return undefined;\n // The renderer has already read each parameter's binding by the time the item sees it, so a parameter is a value.\n const routeParameterBindings = Object.fromEntries(Object.entries(recordProperty(properties, 'parameters'))\n .map(([name, value]) => [name, literal(value)])) as Record<string, BindingExpression>;\n if (kind === 'navigate') return { screen: target, routeParameterBindings };\n if (kind === 'dialog') return { kind: DestinationKind.Dialog, dialog: target, routeParameterBindings };\n return undefined;\n}\n\n/**\n * The `core:toolbar` component: the items a screen's toolbar groups, in the order they were authored.\n * The items are `core:toolbarItem` elements in its `items` slot.\n */\nexport function CoreToolbar({ element, slots }: RegisteredComponentProps) {\n const name = textProperty(element.properties, 'name');\n return <div data-scene-id={element.id} data-scene-toolbar={name} role='toolbar' aria-label={name}>{slots.items}</div>;\n}\n\n/**\n * The `core:toolbarItem` component: one toolbar entry with a label, an icon, presentation hints and what it does.\n *\n * - An `Action` item announces the command it targets with the host-neutral `cratis.scene.command` event, carrying its\n * parameters resolved against the binding scope.\n * - A `Navigate` or `Dialog` item executes its destination through the enclosing navigation host - a screen in an\n * outlet, a dialog - and, outside one, announces it with the host-neutral `cratis.scene.navigate` event.\n *\n * Presentation: `mode` is `icon`, `text` or `both` (the default); an icon-only item keeps its label as its accessible name.\n * Every presentation hint - `placement`, `density` or whatever a package reads - is also carried on the node as a\n * `data-scene-presentation-<name>` attribute so a theme can style by it.\n */\nexport function CoreToolbarItem({ element }: RegisteredComponentProps) {\n const navigation = useContext(SceneNavigationContextInternal);\n const scope = useRenderBindingScope();\n const name = textProperty(element.properties, 'name') ?? element.id;\n const kind = textProperty(element.properties, 'kind')?.toLowerCase();\n const target = textProperty(element.properties, 'target') ?? '';\n const label = textProperty(element.properties, 'label') ?? name;\n const icon = textProperty(element.properties, 'icon');\n const presentation = recordProperty(element.properties, 'presentation');\n const mode = toolbarItemMode(presentation);\n const destination = toolbarItemDestination(element.properties);\n const attributes = Object.fromEntries(Object.entries(presentation)\n .filter(([key]) => /^[A-Za-z][A-Za-z0-9-]*$/.test(key))\n .map(([key, value]) => [`data-scene-presentation-${key.toLowerCase()}`, String(value)]));\n\n const activate = () => {\n if (kind === 'action') {\n const args = resolveParameters(recordProperty(element.properties, 'parameters'), scope);\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command: target, element, arguments: args } }));\n return;\n }\n\n if (!destination) return;\n const resolved = withResolvedParameters(destination, scope);\n if (navigation) {\n navigation.navigate(resolved);\n } else {\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', {\n detail: { targetScreen: destination.screen ?? '', dialog: destination.dialog, destination: resolved, element },\n }));\n }\n };\n\n return (\n <button\n type='button'\n data-scene-id={element.id}\n data-scene-toolbar-item={name}\n data-scene-icon={icon}\n data-scene-mode={mode}\n aria-label={mode === 'icon' ? label : undefined}\n title={mode === 'icon' ? label : undefined}\n disabled={kind !== 'action' && !destination}\n onClick={activate}\n {...attributes}\n >\n {mode !== 'text' && icon && <span aria-hidden='true' data-scene-icon-name={icon} />}\n {mode !== 'icon' && label}\n </button>\n );\n}\n"],"names":["textProperty","properties","name","undefined","recordProperty","value","Array","isArray","isDestination","some","key","isBinding","path","literal","kind","BindingSourceKind","Literal","resolveParameters","parameters","scope","Object","fromEntries","entries","map","binding","resolveBindingExpression","withResolvedParameters","destination","bindings","routeParameterBindings","toolbarItemMode","presentation","mode","toolbarItemDestination","toLowerCase","target","screen","DestinationKind","Dialog","dialog","CoreToolbar","element","slots","_jsx","div","data-scene-id","id","data-scene-toolbar","role","aria-label","items","CoreToolbarItem","navigation","useContext","SceneNavigationContextInternal","useRenderBindingScope","label","icon","attributes","filter","test","String","activate","args","globalThis","dispatchEvent","CustomEvent","detail","command","arguments","resolved","navigate","targetScreen","_jsxs","button","type","data-scene-toolbar-item","data-scene-icon","data-scene-mode","title","disabled","onClick","span","aria-hidden","data-scene-icon-name"],"mappings":";;;;;;;;;AAYA,SAASA,YAAAA,CAAaC,UAAmC,EAAEC,IAAY,EAAA;IACnE,OAAO,OAAOD,UAAU,CAACC,IAAAA,CAAK,KAAK,QAAA,GAAWD,UAAU,CAACC,IAAAA,CAAK,GAAGC,SAAAA;AACrE;AAEA,SAASC,cAAAA,CAAeH,UAAmC,EAAEC,IAAY,EAAA;IACrE,MAAMG,KAAAA,GAAQJ,UAAU,CAACC,IAAAA,CAAK;IAC9B,OAAOG,KAAAA,KAAU,IAAA,IAAQ,OAAOA,KAAAA,KAAU,QAAA,IAAY,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,GAASA,KAAAA,GAAmC,EAAC;AACtH;AAEA,SAASG,cAAcH,KAAc,EAAA;IACjC,IAAIA,KAAAA,KAAU,QAAQ,OAAOA,KAAAA,KAAU,YAAYC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO,KAAA;IAChF,OAAO;AAAC,QAAA,QAAA;AAAU,QAAA,QAAA;AAAU,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA;KAAS,CAACI,IAAI,CAACC,CAAAA,GAAAA,GAAO,OAAO,KAAkC,CAACA,GAAAA,CAAI,KAAK,QAAA,CAAA;AAC5H;AAEA,SAASC,UAAUN,KAAc,EAAA;IAC7B,OAAOA,KAAAA,KAAU,QAAQ,OAAOA,KAAAA,KAAU,YAAY,OAAQA,KAAAA,CAA4BO,IAAI,KAAK,QAAA;AACvG;AAEA,SAASC,QAAQR,KAAc,EAAA;IAC3B,OAAO;AAAES,QAAAA,IAAAA,EAAMC,kBAAkBC,OAAO;QAAEJ,IAAAA,EAAM,EAAA;AAAIP,QAAAA;AAAM,KAAA;AAC9D;AAEA,SAASY,iBA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CAACa,WAAAA;QAChCsD,OAAAA,EAASnB,QAAAA;AACR,QAAA,GAAGJ,UAAU;;YAEb1B,IAAAA,KAAS,MAAA,IAAUyB,sBAAQd,GAAA,CAACuC,MAAAA,EAAAA;gBAAKC,aAAAA,EAAY,MAAA;gBAAOC,sBAAAA,EAAsB3B;;AAC1EzB,YAAAA,IAAAA,KAAS,MAAA,IAAUwB;;;AAGhC;;"}
1
+ {"version":3,"file":"CoreToolbar.js","sources":["../../../core/CoreToolbar.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 { useContext, useMemo } from 'react';\nimport { ApplicationStructureIndex, BindingScope, resolveBindingExpression, resolveToolbarButton, toolbarButtonFromItem } from '@cratis/scene.engine';\nimport { BindingExpression, BindingSourceKind, DestinationKind, DestinationReference, ToolbarEmphasis } from '@cratis/scene.model';\nimport { RegisteredComponentProps, useRenderBindingScope } from '../renderer';\nimport { SceneNavigationContextInternal } from '../navigation/SceneNavigationContext';\nimport { useSceneNavigationModel } from '../navigation/region/SceneNavigationModelContext';\nimport { sliceDialogDestination } from '../slices/sliceDialogDestination';\nimport { useWarnEmptySlices } from '../slices/SliceInvokerContext';\n\n/** How a toolbar item shows its icon and label - the `mode` an item's presentation hint can name. */\nexport type ToolbarItemMode = 'icon' | 'text' | 'both';\n\nfunction textProperty(properties: Record<string, unknown>, name: string): string | undefined {\n return typeof properties[name] === 'string' ? properties[name] : undefined;\n}\n\nfunction recordProperty(properties: Record<string, unknown>, name: string): Record<string, unknown> {\n const value = properties[name];\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {};\n}\n\nfunction isDestination(value: unknown): value is DestinationReference {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n return ['screen', 'module', 'route', 'dialog', 'outlet'].some(key => typeof (value as Record<string, unknown>)[key] === 'string');\n}\n\nfunction isBinding(value: unknown): value is BindingExpression {\n return value !== null && typeof value === 'object' && typeof (value as BindingExpression).path === 'string';\n}\n\nfunction literal(value: unknown): BindingExpression {\n return { kind: BindingSourceKind.Literal, path: '', value } as BindingExpression;\n}\n\nfunction resolveParameters(parameters: Record<string, unknown>, scope: BindingScope): Record<string, unknown> {\n return Object.fromEntries(Object.entries(parameters).map(([name, binding]) =>\n [name, isBinding(binding) ? resolveBindingExpression(binding, scope) : binding]));\n}\n\n/**\n * An authored destination with its route parameters read now, against the scope the item renders in.\n *\n * A navigation host resolves a destination against its own scope, which cannot see what the screen's components\n * publish - a table's selected row, an input's value - so the item resolves them where it is, and hands the host\n * literals. (The renderer leaves a destination's bindings alone, unlike the rest of an element's properties.)\n */\nfunction withResolvedParameters(destination: DestinationReference, scope: BindingScope): DestinationReference {\n const bindings = destination.routeParameterBindings;\n if (!bindings) return destination;\n return {\n ...destination,\n routeParameterBindings: Object.fromEntries(Object.entries(bindings).map(([name, binding]) =>\n [name, literal(resolveBindingExpression(binding, scope))])),\n };\n}\n\n/** How prominent the item is: its authored emphasis, else `secondary`. */\nfunction emphasisOf(properties: Record<string, unknown>): ToolbarEmphasis {\n const emphasis = textProperty(properties, 'emphasis')?.toLowerCase();\n return emphasis === ToolbarEmphasis.Primary || emphasis === ToolbarEmphasis.Quiet ? emphasis : ToolbarEmphasis.Secondary;\n}\n\n/** The mode the item's authored presentation asks for; anything it does not name shows both. */\nexport function toolbarItemMode(presentation: Record<string, unknown>): ToolbarItemMode {\n const mode = presentation.mode;\n return mode === 'icon' || mode === 'text' ? mode : 'both';\n}\n\n/**\n * Where activating a toolbar item goes.\n *\n * The destination the document authored wins. Without one, a `Navigate` item opens its target screen - its\n * parameters become route parameter bindings - and a `Dialog` item opens its target dialog template.\n */\nexport function toolbarItemDestination(properties: Record<string, unknown>): DestinationReference | undefined {\n if (isDestination(properties.destination)) return properties.destination;\n const kind = textProperty(properties, 'kind')?.toLowerCase();\n const target = textProperty(properties, 'target');\n if (!target) return undefined;\n // The renderer has already read each parameter's binding by the time the item sees it, so a parameter is a value.\n const routeParameterBindings = Object.fromEntries(Object.entries(recordProperty(properties, 'parameters'))\n .map(([name, value]) => [name, literal(value)])) as Record<string, BindingExpression>;\n if (kind === 'navigate') return { screen: target, routeParameterBindings };\n if (kind === 'dialog') return { kind: DestinationKind.Dialog, dialog: target, routeParameterBindings };\n return undefined;\n}\n\n/**\n * The `core:toolbar` component: the items a screen's toolbar groups, in the order they were authored.\n * The items are `core:toolbarItem` elements in its `items` slot.\n */\nexport function CoreToolbar({ element, slots }: RegisteredComponentProps) {\n const name = textProperty(element.properties, 'name');\n return <div data-scene-id={element.id} data-scene-toolbar={name} role='toolbar' aria-label={name}>{slots.items}</div>;\n}\n\n/**\n * The `core:toolbarItem` component: one toolbar entry with a label, an icon, presentation hints and what it does.\n *\n * - An `Action` item announces the command it targets with the host-neutral `cratis.scene.command` event, carrying its\n * parameters resolved against the binding scope.\n * - A `Navigate` or `Dialog` item executes its destination through the enclosing navigation host - a screen in an\n * outlet, a dialog - and, outside one, announces it with the host-neutral `cratis.scene.navigate` event.\n *\n * Presentation: `mode` is `icon`, `text` or `both` (the default); an icon-only item keeps its label as its accessible name.\n * Every presentation hint - `placement`, `density` or whatever a package reads - is also carried on the node as a\n * `data-scene-presentation-<name>` attribute so a theme can style by it.\n */\nexport function CoreToolbarItem({ element }: RegisteredComponentProps) {\n const navigation = useContext(SceneNavigationContextInternal);\n const scope = useRenderBindingScope();\n const name = textProperty(element.properties, 'name') ?? element.id;\n const kind = textProperty(element.properties, 'kind')?.toLowerCase();\n const target = textProperty(element.properties, 'target') ?? '';\n const label = textProperty(element.properties, 'label') ?? name;\n const icon = textProperty(element.properties, 'icon');\n const presentation = recordProperty(element.properties, 'presentation');\n const mode = toolbarItemMode(presentation);\n const destination = toolbarItemDestination(element.properties);\n const model = useSceneNavigationModel();\n const warnEmptySlices = useWarnEmptySlices();\n const button = useMemo(() => toolbarButtonFromItem(element.id, element.properties), [element.id, element.properties]);\n const resolved = useMemo(() => {\n if (!button || !model) return undefined;\n const index = model.structure instanceof ApplicationStructureIndex ? model.structure : new ApplicationStructureIndex(model.structure);\n return resolveToolbarButton(index, button);\n }, [button, model]);\n const dialog = resolved ? sliceDialogDestination(resolved) : undefined;\n const emphasis = resolved?.emphasis ?? button?.emphasis ?? emphasisOf(element.properties);\n const empty = button !== undefined && button.slice === undefined && button.target === undefined;\n const attributes = Object.fromEntries(Object.entries(presentation)\n .filter(([key]) => /^[A-Za-z][A-Za-z0-9-]*$/.test(key))\n .map(([key, value]) => [`data-scene-presentation-${key.toLowerCase()}`, String(value)]));\n\n const activate = () => {\n if (dialog && navigation) {\n navigation.navigate(dialog);\n return;\n }\n\n if (kind === 'action' || button !== undefined) {\n const args = resolveParameters(recordProperty(element.properties, 'parameters'), scope);\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command: target || button?.slice || '', element, arguments: args } }));\n return;\n }\n\n if (!destination) return;\n const resolved = withResolvedParameters(destination, scope);\n if (navigation) {\n navigation.navigate(resolved);\n } else {\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', {\n detail: { targetScreen: destination.screen ?? '', dialog: destination.dialog, destination: resolved, element },\n }));\n }\n };\n\n return (\n <button\n type='button'\n data-scene-id={element.id}\n data-scene-toolbar-item={name}\n data-scene-icon={icon}\n data-scene-mode={mode}\n aria-label={mode === 'icon' ? label : undefined}\n title={mode === 'icon' ? label : undefined}\n disabled={kind !== 'action' && button === undefined && !destination}\n aria-haspopup={dialog ? 'dialog' : undefined}\n data-scene-emphasis={emphasis}\n data-scene-slice={resolved?.slice ?? button?.slice}\n data-scene-warning={warnEmptySlices && empty ? 'emptySlice' : undefined}\n className={`scene-toolbar-button scene-toolbar-button-${emphasis}`}\n onClick={activate}\n {...attributes}\n >\n {mode !== 'text' && icon && <span aria-hidden='true' data-scene-icon-name={icon} />}\n {mode !== 'icon' && label}\n {warnEmptySlices && empty && <span role='img' aria-label='No slice is linked to this button' title='No slice is linked to this button' data-scene-badge='warning'>!</span>}\n </button>\n );\n}\n"],"names":["textProperty","properties","name","undefined","recordProperty","value","Array","isArray","isDestination","some","key","isBinding","path","literal","kind","BindingSourceKind","Literal","resolveParameters","parameters","scope","Object","fromEntries","entries","map","binding","resolveBindingExpression","withResolvedParameters","destination","bindings","routeParameterBindings","emphasisOf","emphasis","toLowerCase","ToolbarEmphasis","Primary","Quiet","Secondary","toolbarItemMode","presentation","mode","toolbarItemDestination","target","screen","DestinationKind","Dialog","dialog","CoreToolbar","element","slots","_jsx","div","data-scene-id","id","data-scene-toolbar","role","aria-label","items","CoreToolbarItem","navigation","useContext","SceneNavigationContextInternal","useRenderBindingScope","label","icon","model","useSceneNavigationModel","warnEmptySlices","useWarnEmptySlices","button","useMemo","toolbarButtonFromItem","resolved","index","structure","ApplicationStructureIndex","resolveToolbarButton","sliceDialogDestination","empty","slice","attributes","filter","test","String","activate","navigate","args","globalThis","dispatchEvent","CustomEvent","detail","command","arguments","targetScreen","_jsxs","type","data-scene-toolbar-item","data-scene-icon","data-scene-mode","title","disabled","aria-haspopup","data-scene-emphasis","data-scene-slice","data-scene-warning","className","onClick","span","aria-hidden","data-scene-icon-name","data-scene-badge"],"mappings":";;;;;;;;;;;;AAeA,SAASA,YAAAA,CAAaC,UAAmC,EAAEC,IAAY,EAAA;IACnE,OAAO,OAAOD,UAAU,CAACC,IAAAA,CAAK,KAAK,QAAA,GAAWD,UAAU,CAACC,IAAAA,CAAK,GAAGC,SAAAA;AACrE;AAEA,SAASC,cAAAA,CAAeH,UAAmC,EAAEC,IAAY,EAAA;IACrE,MAAMG,KAAAA,GAAQJ,UAAU,CAACC,IAAAA,CAAK;IAC9B,OAAOG,KAAAA,KAAU,IAAA,IAAQ,OAAOA,KAAAA,KAAU,QAAA,IAAY,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,GAASA,KAAAA,GAAmC,EAAC;AACtH;AAEA,SAASG,cAAcH,KAAc,EAAA;IACjC,IAAIA,KAAAA,KAAU,QAAQ,OAAOA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C,EAAEzE,QAAAA,CAAAA,CAAU;QAClE0E,OAAAA,EAAStB,QAAAA;AACR,QAAA,GAAGJ,UAAU;;YAEbxC,IAAAA,KAAS,MAAA,IAAUwB,sBAAQd,GAAA,CAACyD,MAAAA,EAAAA;gBAAKC,aAAAA,EAAY,MAAA;gBAAOC,sBAAAA,EAAsB7C;;AAC1ExB,YAAAA,IAAAA,KAAS,MAAA,IAAUuB,KAAAA;AACnBI,YAAAA,eAAAA,IAAmBW,uBAAS5B,GAAA,CAACyD,MAAAA,EAAAA;gBAAKpD,IAAAA,EAAK,KAAA;gBAAMC,YAAAA,EAAW,mCAAA;gBAAoC2C,KAAAA,EAAM,mCAAA;gBAAoCW,kBAAAA,EAAiB,SAAA;AAAU,gBAAA,QAAA,EAAA;;;;AAG9K;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"coreComponentMetadata.d.ts","sourceRoot":"","sources":["../../../core/coreComponentMetadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAmE,MAAM,aAAa,CAAC;AAGjH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAmBnE,CAAC"}
1
+ {"version":3,"file":"coreComponentMetadata.d.ts","sourceRoot":"","sources":["../../../core/coreComponentMetadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAmE,MAAM,aAAa,CAAC;AAGjH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAoBnE,CAAC"}
@@ -97,6 +97,12 @@ import { toolbarDesignMode, navigationDesignMode } from '../packages/designModes
97
97
  'buttons',
98
98
  'command bar'
99
99
  ], 'Tl', toolbarDesignMode()),
100
+ sliceDialog: componentMetadata('Slice dialog', ComponentCategory.Overlay, 'square-pen', [
101
+ 'task dialog',
102
+ 'state change',
103
+ 'form',
104
+ 'command'
105
+ ], undefined),
100
106
  toolbarItem: componentMetadata('Toolbar item', ComponentCategory.Actions, 'mouse-pointer-click', [
101
107
  'button',
102
108
  'action'
@@ -1 +1 @@
1
- {"version":3,"file":"coreComponentMetadata.js","sources":["../../../core/coreComponentMetadata.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 { ComponentCategory } from '@cratis/scene.model';\nimport { ComponentMetadata, componentMetadata as m, navigationDesignMode, toolbarDesignMode } from '../packages';\n\n/** The category, icon, keywords and picker badge of every component of the package (CMP1), keyed by bare component name. */\nexport const coreComponentMetadata: Record<string, ComponentMetadata> = {\n text: m('Text', ComponentCategory.DataDisplay, 'type', ['label', 'paragraph', 'copy']),\n button: m('Button', ComponentCategory.Actions, 'mouse-pointer-click', ['click', 'submit', 'action'], 'Bt'),\n card: m('Card', ComponentCategory.Layout, 'square', ['panel', 'box', 'container']),\n data: m('Data', ComponentCategory.DataDisplay, 'database', ['read model', 'query', 'source']),\n action: m('Command action', ComponentCategory.Actions, 'zap', ['command', 'invoke', 'submit']),\n section: m('Section', ComponentCategory.Layout, 'layout-panel-top', ['group', 'area', 'block']),\n navigate: m('Navigate', ComponentCategory.Navigation, 'corner-down-right', ['link', 'go to', 'route']),\n title: m('Title', ComponentCategory.DataDisplay, 'heading', ['heading', 'header', 'caption']),\n table: m('Table', ComponentCategory.DataDisplay, 'table', ['grid', 'rows', 'list'], 'Tb'),\n column: m('Table column', ComponentCategory.DataDisplay, 'columns-3', ['heading', 'field']),\n summary: m('Summary', ComponentCategory.DataDisplay, 'list', ['details', 'overview', 'facts']),\n field: m('Summary field', ComponentCategory.DataDisplay, 'tag', ['label', 'value', 'pair']),\n code: m('Code', ComponentCategory.DataDisplay, 'code', ['snippet', 'source', 'monospace']),\n file: m('File reference', ComponentCategory.DataDisplay, 'file', ['include', 'import', 'screen file']),\n navigationBar: m('Navigation bar', ComponentCategory.Navigation, 'navigation', ['menu', 'nav', 'links'], undefined, navigationDesignMode({ itemsPath: 'items' })),\n outlet: m('Outlet', ComponentCategory.Layout, 'panel-right', ['region', 'slot', 'side panel']),\n toolbar: m('Toolbar', ComponentCategory.Actions, 'wrench', ['actions', 'buttons', 'command bar'], 'Tl', toolbarDesignMode()),\n toolbarItem: m('Toolbar item', ComponentCategory.Actions, 'mouse-pointer-click', ['button', 'action']),\n};\n"],"names":["coreComponentMetadata","text","m","ComponentCategory","DataDisplay","button","Actions","card","Layout","data","action","section","navigate","Navigation","title","table","column","summary","field","code","file","navigationBar","undefined","navigationDesignMode","itemsPath","outlet","toolbar","toolbarDesignMode","toolbarItem"],"mappings":";;;;;;;;;;AAAA;AACA;AAKA,6HACO,MAAMA,qBAAAA,GAA2D;AACpEC,IAAAA,IAAAA,EAAMC,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkBC,WAAW,EAAE,MAAA,EAAQ;AAAC,QAAA,OAAA;AAAS,QAAA,WAAA;AAAa,QAAA;AAAO,KAAA,CAAA;AACrFC,IAAAA,MAAAA,EAAQH,iBAAAA,CAAE,QAAA,EAAUC,iBAAAA,CAAkBG,OAAO,EAAE,qBAAA,EAAuB;AAAC,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA;KAAS,EAAE,IAAA,CAAA;AACrGC,IAAAA,IAAAA,EAAML,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkBK,MAAM,EAAE,QAAA,EAAU;AAAC,QAAA,OAAA;AAAS,QAAA,KAAA;AAAO,QAAA;AAAY,KAAA,CAAA;AACjFC,IAAAA,IAAAA,EAAMP,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkBC,WAAW,EAAE,UAAA,EAAY;AAAC,QAAA,YAAA;AAAc,QAAA,OAAA;AAAS,QAAA;AAAS,KAAA,CAAA;AAC5FM,IAAAA,MAAAA,EAAQR,iBAAAA,CAAE,gBAAA,EAAkBC,iBAAAA,CAAkBG,OAAO,EAAE,KAAA,EAAO;AAAC,QAAA,SAAA;AAAW,QAAA,QAAA;AAAU,QAAA;AAAS,KAAA,CAAA;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C,WAAW,EAAE,MAAA,EAAQ;AAAC,QAAA,SAAA;AAAW,QAAA,QAAA;AAAU,QAAA;AAAY,KAAA,CAAA;AACzFgB,IAAAA,IAAAA,EAAMlB,iBAAAA,CAAE,gBAAA,EAAkBC,iBAAAA,CAAkBC,WAAW,EAAE,MAAA,EAAQ;AAAC,QAAA,SAAA;AAAW,QAAA,QAAA;AAAU,QAAA;AAAc,KAAA,CAAA;AACrGiB,IAAAA,aAAAA,EAAenB,iBAAAA,CAAE,gBAAA,EAAkBC,iBAAAA,CAAkBU,UAAU,EAAE,YAAA,EAAc;AAAC,QAAA,MAAA;AAAQ,QAAA,KAAA;AAAO,QAAA;AAAQ,KAAA,EAAES,WAAWC,oBAAAA,CAAqB;QAAEC,SAAAA,EAAW;AAAQ,KAAA,CAAA,CAAA;AAC9JC,IAAAA,MAAAA,EAAQvB,iBAAAA,CAAE,QAAA,EAAUC,iBAAAA,CAAkBK,MAAM,EAAE,aAAA,EAAe;AAAC,QAAA,QAAA;AAAU,QAAA,MAAA;AAAQ,QAAA;AAAa,KAAA,CAAA;AAC7FkB,IAAAA,OAAAA,EAASxB,iBAAAA,CAAE,SAAA,EAAWC,iBAAAA,CAAkBG,OAAO,EAAE,QAAA,EAAU;AAAC,QAAA,SAAA;AAAW,QAAA,SAAA;AAAW,QAAA;AAAc,KAAA,EAAE,IAAA,EAAMqB,iBAAAA,EAAAA,CAAAA;AACxGC,IAAAA,WAAAA,EAAa1B,iBAAAA,CAAE,cAAA,EAAgBC,iBAAAA,CAAkBG,OAAO,EAAE,qBAAA,EAAuB;AAAC,QAAA,QAAA;AAAU,QAAA;AAAS,KAAA;AACzG;;"}
1
+ {"version":3,"file":"coreComponentMetadata.js","sources":["../../../core/coreComponentMetadata.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 { ComponentCategory } from '@cratis/scene.model';\nimport { ComponentMetadata, componentMetadata as m, navigationDesignMode, toolbarDesignMode } from '../packages';\n\n/** The category, icon, keywords and picker badge of every component of the package (CMP1), keyed by bare component name. */\nexport const coreComponentMetadata: Record<string, ComponentMetadata> = {\n text: m('Text', ComponentCategory.DataDisplay, 'type', ['label', 'paragraph', 'copy']),\n button: m('Button', ComponentCategory.Actions, 'mouse-pointer-click', ['click', 'submit', 'action'], 'Bt'),\n card: m('Card', ComponentCategory.Layout, 'square', ['panel', 'box', 'container']),\n data: m('Data', ComponentCategory.DataDisplay, 'database', ['read model', 'query', 'source']),\n action: m('Command action', ComponentCategory.Actions, 'zap', ['command', 'invoke', 'submit']),\n section: m('Section', ComponentCategory.Layout, 'layout-panel-top', ['group', 'area', 'block']),\n navigate: m('Navigate', ComponentCategory.Navigation, 'corner-down-right', ['link', 'go to', 'route']),\n title: m('Title', ComponentCategory.DataDisplay, 'heading', ['heading', 'header', 'caption']),\n table: m('Table', ComponentCategory.DataDisplay, 'table', ['grid', 'rows', 'list'], 'Tb'),\n column: m('Table column', ComponentCategory.DataDisplay, 'columns-3', ['heading', 'field']),\n summary: m('Summary', ComponentCategory.DataDisplay, 'list', ['details', 'overview', 'facts']),\n field: m('Summary field', ComponentCategory.DataDisplay, 'tag', ['label', 'value', 'pair']),\n code: m('Code', ComponentCategory.DataDisplay, 'code', ['snippet', 'source', 'monospace']),\n file: m('File reference', ComponentCategory.DataDisplay, 'file', ['include', 'import', 'screen file']),\n navigationBar: m('Navigation bar', ComponentCategory.Navigation, 'navigation', ['menu', 'nav', 'links'], undefined, navigationDesignMode({ itemsPath: 'items' })),\n outlet: m('Outlet', ComponentCategory.Layout, 'panel-right', ['region', 'slot', 'side panel']),\n toolbar: m('Toolbar', ComponentCategory.Actions, 'wrench', ['actions', 'buttons', 'command bar'], 'Tl', toolbarDesignMode()),\n sliceDialog: m('Slice dialog', ComponentCategory.Overlay, 'square-pen', ['task dialog', 'state change', 'form', 'command'], undefined),\n toolbarItem: m('Toolbar item', ComponentCategory.Actions, 'mouse-pointer-click', ['button', 'action']),\n};\n"],"names":["coreComponentMetadata","text","m","ComponentCategory","DataDisplay","button","Actions","card","Layout","data","action","section","navigate","Navigation","title","table","column","summary","field","code","file","navigationBar","undefined","navigationDesignMode","itemsPath","outlet","toolbar","toolbarDesignMode","sliceDialog","Overlay","toolbarItem"],"mappings":";;;;;;;;;;AAAA;AACA;AAKA,6HACO,MAAMA,qBAAAA,GAA2D;AACpEC,IAAAA,IAAAA,EAAMC,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkBC,WAAW,EAAE,MAAA,EAAQ;AAAC,QAAA,OAAA;AAAS,QAAA,WAAA;AAAa,QAAA;AAAO,KAAA,CAAA;AACrFC,IAAAA,MAAAA,EAAQH,iBAAAA,CAAE,QAAA,EAAUC,iBAAAA,CAAkBG,OAAO,EAAE,qBAAA,EAAuB;AAAC,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA;KAAS,EAAE,IAAA,CAAA;AACrGC,IAAAA,IAAAA,EAAML,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkBK,MAAM,EAAE,QAAA,EAAU;AAAC,QAAA,OAAA;AAAS,QAAA,KAAA;AAAO,QAAA;AAAY,KAAA,CAAA;AACjFC,IAAAA,IAAAA,EAAMP,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkBC,WAAW,EAAE,UAAA,EAAY;AAAC,QAAA,YAAA;AAAc,QAAA,OAAA;AAAS,QAAA;AAAS,KAAA,CAAA;AAC5FM,IAAAA,MAAAA,EAAQR,iBAAAA,CAAE,gBAAA,EAAkBC,iBAAAA,CAAkBG,OAAO,EAAE,KAAA,EAAO;AAAC,QAAA,SAAA;AAAW,QAAA,QAAA;AAAU,QAAA;AAAS,KAAA,CAAA;AAC7FK,IAAAA,OAAAA,EAAST,iBAAAA,CAAE,SAAA,EAAWC,iBAAAA,CAAkBK,MAAM,EAAE,kBAAA,EAAoB;AAAC,QAAA,OAAA;AAAS,QAAA,MAAA;AAAQ,QAAA;AAAQ,KAAA,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EAAE,iBAmB5B,CAAC"}
1
+ {"version":3,"file":"coreComponents.d.ts","sourceRoot":"","sources":["../../../core/coreComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA2BhD,eAAO,MAAM,cAAc,EAAE,iBAoB5B,CAAC"}
@@ -12,6 +12,7 @@ import { CoreButton } from './CoreButton.js';
12
12
  import { CoreCard } from './CoreCard.js';
13
13
  import { CoreNavigationBar } from './CoreNavigationBar.js';
14
14
  import { CoreToolbarItem, CoreToolbar } from './CoreToolbar.js';
15
+ import { CoreSliceDialog } from '../slices/CoreSliceDialog.js';
15
16
  import { CoreFile, CoreCode, CoreField, CoreSummary, CoreColumn, CoreTable, CoreTitle, CoreNavigate, CoreSection, CoreAction, CoreData } from './ScreenplayCoreComponents.js';
16
17
 
17
18
  // Copyright (c) Cratis. All rights reserved.
@@ -37,7 +38,8 @@ import { CoreFile, CoreCode, CoreField, CoreSummary, CoreColumn, CoreTable, Core
37
38
  [componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,
38
39
  [componentRegistryKey('core', 'outlet')]: CoreOutlet,
39
40
  [componentRegistryKey('core', 'toolbar')]: CoreToolbar,
40
- [componentRegistryKey('core', 'toolbarItem')]: CoreToolbarItem
41
+ [componentRegistryKey('core', 'toolbarItem')]: CoreToolbarItem,
42
+ [componentRegistryKey('core', 'sliceDialog')]: CoreSliceDialog
41
43
  };
42
44
 
43
45
  export { coreComponents };
@@ -1 +1 @@
1
- {"version":3,"file":"coreComponents.js","sources":["../../../core/coreComponents.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 { ComponentRegistry } from '../renderer';\nimport { componentRegistryKey } from '../packages';\nimport { CoreText } from './CoreText';\nimport { CoreButton } from './CoreButton';\nimport { CoreCard } from './CoreCard';\nimport { CoreNavigationBar } from './CoreNavigationBar';\nimport { CoreToolbar, CoreToolbarItem } from './CoreToolbar';\nimport { CoreOutlet } from '../navigation/CoreOutlet';\nimport {\n CoreAction,\n CoreCode,\n CoreColumn,\n CoreData,\n CoreField,\n CoreFile,\n CoreNavigate,\n CoreSection,\n CoreSummary,\n CoreTable,\n CoreTitle,\n} from './ScreenplayCoreComponents';\n\n/**\n * The `core` package's component registry - the final fallback every `ui profile` resolves against\n * regardless of which other packages it lists (Scene#3).\n */\nexport const coreComponents: ComponentRegistry = {\n [componentRegistryKey('core', 'text')]: CoreText,\n [componentRegistryKey('core', 'button')]: CoreButton,\n [componentRegistryKey('core', 'card')]: CoreCard,\n [componentRegistryKey('core', 'data')]: CoreData,\n [componentRegistryKey('core', 'action')]: CoreAction,\n [componentRegistryKey('core', 'section')]: CoreSection,\n [componentRegistryKey('core', 'navigate')]: CoreNavigate,\n [componentRegistryKey('core', 'title')]: CoreTitle,\n [componentRegistryKey('core', 'table')]: CoreTable,\n [componentRegistryKey('core', 'column')]: CoreColumn,\n [componentRegistryKey('core', 'summary')]: CoreSummary,\n [componentRegistryKey('core', 'field')]: CoreField,\n [componentRegistryKey('core', 'code')]: CoreCode,\n [componentRegistryKey('core', 'file')]: CoreFile,\n [componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,\n [componentRegistryKey('core', 'outlet')]: CoreOutlet,\n [componentRegistryKey('core', 'toolbar')]: CoreToolbar,\n [componentRegistryKey('core', 'toolbarItem')]: CoreToolbarItem,\n};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar","CoreOutlet","CoreToolbar","CoreToolbarItem"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AAwBA;;;UAIaA,cAAAA,GAAoC;IAC7C,CAACC,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,QAAAA;IACxC,CAACD,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,UAAAA;IAC1C,CAACF,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG,QAAAA;IACxC,CAACH,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUI,QAAAA;IACxC,CAACJ,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYK,UAAAA;IAC1C,CAACL,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaM,WAAAA;IAC3C,CAACN,oBAAAA,CAAqB,MAAA,EAAQ,UAAA,CAAA,GAAcO,YAAAA;IAC5C,CAACP,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWQ,SAAAA;IACzC,CAACR,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWS,SAAAA;IACzC,CAACT,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYU,UAAAA;IAC1C,CAACV,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaW,WAAAA;IAC3C,CAACX,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWY,SAAAA;IACzC,CAACZ,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUa,QAAAA;IACxC,CAACb,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUc,QAAAA;IACxC,CAACd,oBAAAA,CAAqB,MAAA,EAAQ,eAAA,CAAA,GAAmBe,iBAAAA;IACjD,CAACf,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYgB,UAAAA;IAC1C,CAAChB,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaiB,WAAAA;IAC3C,CAACjB,oBAAAA,CAAqB,MAAA,EAAQ,aAAA,CAAA,GAAiBkB;AACnD;;"}
1
+ {"version":3,"file":"coreComponents.js","sources":["../../../core/coreComponents.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 { ComponentRegistry } from '../renderer';\nimport { componentRegistryKey } from '../packages';\nimport { CoreText } from './CoreText';\nimport { CoreButton } from './CoreButton';\nimport { CoreCard } from './CoreCard';\nimport { CoreNavigationBar } from './CoreNavigationBar';\nimport { CoreToolbar, CoreToolbarItem } from './CoreToolbar';\nimport { CoreOutlet } from '../navigation/CoreOutlet';\nimport { CoreSliceDialog } from '../slices/CoreSliceDialog';\nimport {\n CoreAction,\n CoreCode,\n CoreColumn,\n CoreData,\n CoreField,\n CoreFile,\n CoreNavigate,\n CoreSection,\n CoreSummary,\n CoreTable,\n CoreTitle,\n} from './ScreenplayCoreComponents';\n\n/**\n * The `core` package's component registry - the final fallback every `ui profile` resolves against\n * regardless of which other packages it lists (Scene#3).\n */\nexport const coreComponents: ComponentRegistry = {\n [componentRegistryKey('core', 'text')]: CoreText,\n [componentRegistryKey('core', 'button')]: CoreButton,\n [componentRegistryKey('core', 'card')]: CoreCard,\n [componentRegistryKey('core', 'data')]: CoreData,\n [componentRegistryKey('core', 'action')]: CoreAction,\n [componentRegistryKey('core', 'section')]: CoreSection,\n [componentRegistryKey('core', 'navigate')]: CoreNavigate,\n [componentRegistryKey('core', 'title')]: CoreTitle,\n [componentRegistryKey('core', 'table')]: CoreTable,\n [componentRegistryKey('core', 'column')]: CoreColumn,\n [componentRegistryKey('core', 'summary')]: CoreSummary,\n [componentRegistryKey('core', 'field')]: CoreField,\n [componentRegistryKey('core', 'code')]: CoreCode,\n [componentRegistryKey('core', 'file')]: CoreFile,\n [componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,\n [componentRegistryKey('core', 'outlet')]: CoreOutlet,\n [componentRegistryKey('core', 'toolbar')]: CoreToolbar,\n [componentRegistryKey('core', 'toolbarItem')]: CoreToolbarItem,\n [componentRegistryKey('core', 'sliceDialog')]: CoreSliceDialog,\n};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreN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qB,MAAA,EAAQ,QAAA,CAAA,GAAYgB,UAAAA;IAC1C,CAAChB,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaiB,WAAAA;IAC3C,CAACjB,oBAAAA,CAAqB,MAAA,EAAQ,aAAA,CAAA,GAAiBkB,eAAAA;IAC/C,CAAClB,oBAAAA,CAAqB,MAAA,EAAQ,aAAA,CAAA,GAAiBmB;AACnD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"coreDescriptors.d.ts","sourceRoot":"","sources":["../../../core/coreDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAA0D,MAAM,qBAAqB,CAAC;AA4GlH,eAAO,MAAM,eAAe,EAAE,mBAAmB,EAAqE,CAAC"}
1
+ {"version":3,"file":"coreDescriptors.d.ts","sourceRoot":"","sources":["../../../core/coreDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAA0D,MAAM,qBAAqB,CAAC;AAyHlH,eAAO,MAAM,eAAe,EAAE,mBAAmB,EAAqE,CAAC"}
@@ -151,6 +151,33 @@ const key = (name)=>componentRegistryKey('core', name);
151
151
  }
152
152
  ]
153
153
  },
154
+ {
155
+ component: key('sliceDialog'),
156
+ displayName: 'Slice dialog',
157
+ description: 'The task dialog of a state change slice: the form of its command with Cancel and a submit button. Opened from a toolbar button it takes the slice, command and title from the button; set them to fix the dialog to one slice.',
158
+ properties: [
159
+ {
160
+ path: 'slice',
161
+ label: 'Slice',
162
+ group: 'Behavior',
163
+ valueType: PropertyValueType.String,
164
+ editorKind: PropertyEditorKind.Slice,
165
+ editorOptions: {
166
+ kinds: [
167
+ 'StateChange'
168
+ ]
169
+ },
170
+ description: 'The State Change slice the dialog submits; empty to take it from the toolbar button that opens the dialog.'
171
+ },
172
+ {
173
+ path: 'title',
174
+ label: 'Title',
175
+ group: 'Content',
176
+ valueType: PropertyValueType.String,
177
+ description: 'The dialog title and submit label; empty to take the toolbar button title.'
178
+ }
179
+ ]
180
+ },
154
181
  {
155
182
  component: key('column'),
156
183
  displayName: 'Table column',
@@ -1 +1 @@
1
- {"version":3,"file":"coreDescriptors.js","sources":["../../../core/coreDescriptors.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 { ComponentDescriptor, PropertyEditorKind, PropertyValueType, ToolbarEmphasis } from '@cratis/scene.model';\nimport { componentRegistryKey, describeComponents } from '../packages';\nimport { coreComponentMetadata } from './coreComponentMetadata';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nconst describedCore: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('toolbarItem'),\n displayName: 'Toolbar button',\n description: 'One toolbar button. An Action button invokes a state change slice and opens it as a task dialog over the page; a button with no slice is allowed while designing and is flagged.',\n properties: [\n { path: 'label', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Button' },\n {\n path: 'slice', label: 'Slice to invoke', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: PropertyEditorKind.Slice, editorOptions: { kinds: ['StateChange'] },\n description: 'Only State Change slices can be picked. State Views and Automations never take user input, so they are listed as unavailable.',\n },\n {\n path: 'emphasis', label: 'Emphasis', group: 'Appearance', valueType: PropertyValueType.Enum, default: ToolbarEmphasis.Secondary,\n editorKind: PropertyEditorKind.Enum,\n choices: [\n { value: ToolbarEmphasis.Primary, label: 'Primary' },\n { value: ToolbarEmphasis.Secondary, label: 'Secondary' },\n { value: ToolbarEmphasis.Quiet, label: 'Quiet' },\n ],\n },\n { path: 'icon', label: 'Icon', group: 'Appearance', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n {\n path: 'target', label: 'Command (legacy)', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'stateChangeReference',\n description: 'A hand-typed command for a button that has no slice. It is converted to the slice that accepts the command when exactly one does; prefer a slice.',\n },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('outlet'),\n displayName: 'Outlet',\n description: 'A named region another screen opens into. Placing a screen here keeps this screen on the page, and the placed screen may declare outlets of its own.',\n properties: [{ path: 'name', label: 'Name', group: 'Navigation', valueType: PropertyValueType.String, constraints: { required: true } }],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n\n/** The `core` package's descriptors: the hand-written ones above with every component's category, icon, keywords and design mode (CMP1). */\nexport const coreDescriptors: ComponentDescriptor[] = describeComponents('core', describedCore, coreComponentMetadata);"],"names":["key","name","componentRegistryKey","describedCore","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","PropertyEditorKind","Slice","editorOptions","kinds","Enum","ToolbarEmphasis","Secondary","choices","value","Primary","Quiet","Icon","minimumLength","Destination","coreDescriptors","describeComponents","coreComponentMetadata"],"mappings":";;;;;;;;;;;AAAA;AACA;AAMA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;AAMC,IACD,MAAME,aAAAA,GAAuC;AACzC,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,S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AAA,EAAS;AAAa,aAAA;AAC9G,YAAA;gBACIN,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBO,UAAU;AAAEL,gBAAAA,OAAAA,EAAS,EAAE;gBACrGM,IAAAA,EAAM;oBACFX,KAAAA,EAAO,iBAAA;oBACPF,UAAAA,EAAY;AACR,wBAAA;4BAAEC,IAAAA,EAAM,OAAA;4BAASC,KAAAA,EAAO,OAAA;4BAASC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;4BAAEI,WAAAA,EAAa;gCAAEC,QAAAA,EAAU,IAAA;gCAAMe,aAAAA,EAAe;AAAE;AAAE,yBAAA;AAC1I,wBAAA;4BAAEzB,IAAAA,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBoB,IAAI;4BAAEhB,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBsB,WAAW;4BAAElB,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;AACH,CAAA;AAED,6IACO,MAAMiB,kBAAyCC,kBAAAA,CAAmB,MAAA,EAAQhC,eAAeiC,qBAAAA;;"}
1
+ {"version":3,"file":"coreDescriptors.js","sources":["../../../core/coreDescriptors.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 { ComponentDescriptor, PropertyEditorKind, PropertyValueType, ToolbarEmphasis } from '@cratis/scene.model';\nimport { componentRegistryKey, describeComponents } from '../packages';\nimport { coreComponentMetadata } from './coreComponentMetadata';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nconst describedCore: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('toolbarItem'),\n displayName: 'Toolbar button',\n description: 'One toolbar button. An Action button invokes a state change slice and opens it as a task dialog over the page; a button with no slice is allowed while designing and is flagged.',\n properties: [\n { path: 'label', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Button' },\n {\n path: 'slice', label: 'Slice to invoke', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: PropertyEditorKind.Slice, editorOptions: { kinds: ['StateChange'] },\n description: 'Only State Change slices can be picked. State Views and Automations never take user input, so they are listed as unavailable.',\n },\n {\n path: 'emphasis', label: 'Emphasis', group: 'Appearance', valueType: PropertyValueType.Enum, default: ToolbarEmphasis.Secondary,\n editorKind: PropertyEditorKind.Enum,\n choices: [\n { value: ToolbarEmphasis.Primary, label: 'Primary' },\n { value: ToolbarEmphasis.Secondary, label: 'Secondary' },\n { value: ToolbarEmphasis.Quiet, label: 'Quiet' },\n ],\n },\n { path: 'icon', label: 'Icon', group: 'Appearance', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n {\n path: 'target', label: 'Command (legacy)', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'stateChangeReference',\n description: 'A hand-typed command for a button that has no slice. It is converted to the slice that accepts the command when exactly one does; prefer a slice.',\n },\n ],\n },\n {\n component: key('sliceDialog'),\n displayName: 'Slice dialog',\n description: 'The task dialog of a state change slice: the form of its command with Cancel and a submit button. Opened from a toolbar button it takes the slice, command and title from the button; set them to fix the dialog to one slice.',\n properties: [\n {\n path: 'slice', label: 'Slice', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: PropertyEditorKind.Slice, editorOptions: { kinds: ['StateChange'] },\n description: 'The State Change slice the dialog submits; empty to take it from the toolbar button that opens the dialog.',\n },\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, description: 'The dialog title and submit label; empty to take the toolbar button title.' },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('outlet'),\n displayName: 'Outlet',\n description: 'A named region another screen opens into. Placing a screen here keeps this screen on the page, and the placed screen may declare outlets of its own.',\n properties: [{ path: 'name', label: 'Name', group: 'Navigation', valueType: PropertyValueType.String, constraints: { required: true } }],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n\n/** The `core` package's descriptors: the hand-written ones above with every component's category, icon, keywords and design mode (CMP1). */\nexport const coreDescriptors: ComponentDescriptor[] = describeComponents('core', describedCore, coreComponentMetadata);"],"names":["key","name","componentRegistryKey","describedCore","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","PropertyEditorKind","Slice","editorOptions","kinds","Enum","ToolbarEmphasis","Secondary","choices","value","Primary","Quiet","Icon","minimumLength","Destination","coreDescriptors","describeComponents","coreComponentMetadata"],"mappings":";;;;;;;;;;;AAAA;AACA;AAMA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;AAMC,IACD,MAAME,aAAAA,GAAuC;AACzC,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR,UA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A,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBoB,IAAI;4BAAEhB,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBsB,WAAW;4BAAElB,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;AACH,CAAA;AAED,6IACO,MAAMiB,kBAAyCC,kBAAAA,CAAmB,MAAA,EAAQhC,eAAeiC,qBAAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"corePackage.d.ts","sourceRoot":"","sources":["../../../core/corePackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWjD,eAAO,MAAM,mBAAmB,EAAE,YAkCjC,CAAC;AAKF,eAAO,MAAM,WAAW,EAAE,kBAIzB,CAAC"}
1
+ {"version":3,"file":"corePackage.d.ts","sourceRoot":"","sources":["../../../core/corePackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWjD,eAAO,MAAM,mBAAmB,EAAE,YAmCjC,CAAC;AAKF,eAAO,MAAM,WAAW,EAAE,kBAIzB,CAAC"}
@@ -33,7 +33,8 @@ import { coreDescriptors } from './coreDescriptors.js';
33
33
  'navigationBar',
34
34
  'outlet',
35
35
  'toolbar',
36
- 'toolbarItem'
36
+ 'toolbarItem',
37
+ 'sliceDialog'
37
38
  ],
38
39
  layouts: [],
39
40
  screenTemplates: [],
@@ -1 +1 @@
1
- {"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 '../packages';\nimport { coreComponents } from './coreComponents';\nimport { coreDescriptors } from './coreDescriptors';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n 'navigationBar',\n 'outlet',\n 'toolbar',\n 'toolbarItem',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,eAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,cAAAA;IACZC,WAAAA,EAAaC;AACjB;;"}
1
+ {"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 '../packages';\nimport { coreComponents } from './coreComponents';\nimport { coreDescriptors } from './coreDescriptors';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n 'navigationBar',\n 'outlet',\n 'toolbar',\n 'toolbarItem',\n 'sliceDialog',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,eAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,aAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,cAAAA;IACZC,WAAAA,EAAaC;AACjB;;"}
@@ -3,6 +3,7 @@ export * from './renderer';
3
3
  export * from './core';
4
4
  export * from './NavBar';
5
5
  export * from './navigation';
6
+ export * from './slices';
6
7
  export * from './icons';
7
8
  export * from './packages';
8
9
  export * from './theme';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -42,6 +42,13 @@ export { currentModuleOf } from './navigation/region/currentModuleOf.js';
42
42
  export { navigationItemActive } from './navigation/region/navigationItemActive.js';
43
43
  export { defaultScreenFor, navigationItemDestination } from './navigation/region/navigationItemDestination.js';
44
44
  export { navigationDestinations } from './navigation/region/navigationDestinations.js';
45
+ export { createAnnouncingInvoker } from './slices/createAnnouncingInvoker.js';
46
+ export { createDryRunInvoker } from './slices/createDryRunInvoker.js';
47
+ export { SliceInvokerProvider, useSliceInvoker, useWarnEmptySlices } from './slices/SliceInvokerContext.js';
48
+ export { SliceCommandFieldsProvider, useSliceCommandFields } from './slices/SliceCommandFieldsContext.js';
49
+ export { sliceDialogDestination, sliceDialogParameters } from './slices/sliceDialogDestination.js';
50
+ export { SliceDialogView, sliceFieldLabel, slicePayload } from './slices/SliceDialogView.js';
51
+ export { CoreSliceDialog } from './slices/CoreSliceDialog.js';
45
52
  export { IconAdapterRegistry, createIconAdapterRegistry } from './icons/IconAdapterRegistry.js';
46
53
  export { IconAdapterProvider, useIconAdapters } from './icons/IconAdapterContext.js';
47
54
  export { useIconGlyph } from './icons/useIconGlyph.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -10,6 +10,7 @@ export interface SceneNavigationContextValue {
10
10
  currentUrl?: string;
11
11
  currentOutlet?: string;
12
12
  currentDialog?: string;
13
+ currentDialogParameters?: Record<string, string>;
13
14
  currentParameters: Record<string, string>;
14
15
  dialogResult?: DialogResult;
15
16
  unresolvedUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"SceneNavigationContext.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,YAAY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