@cratis/scene.react 4.28.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 (193) 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 +36 -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 +34 -18
  20. package/dist/cjs/navigation/SceneNavigationHost.js.map +1 -1
  21. package/dist/cjs/navigation/region/NavigationRegionClassNames.js +21 -0
  22. package/dist/cjs/navigation/region/NavigationRegionClassNames.js.map +1 -0
  23. package/dist/cjs/navigation/region/NavigationRegionView.js +283 -0
  24. package/dist/cjs/navigation/region/NavigationRegionView.js.map +1 -0
  25. package/dist/cjs/navigation/region/SceneNavigationModelContext.js +22 -0
  26. package/dist/cjs/navigation/region/SceneNavigationModelContext.js.map +1 -0
  27. package/dist/cjs/navigation/region/currentModuleOf.js +15 -0
  28. package/dist/cjs/navigation/region/currentModuleOf.js.map +1 -0
  29. package/dist/cjs/navigation/region/navigationDestinations.js +46 -0
  30. package/dist/cjs/navigation/region/navigationDestinations.js.map +1 -0
  31. package/dist/cjs/navigation/region/navigationItemActive.js +31 -0
  32. package/dist/cjs/navigation/region/navigationItemActive.js.map +1 -0
  33. package/dist/cjs/navigation/region/navigationItemDestination.js +34 -0
  34. package/dist/cjs/navigation/region/navigationItemDestination.js.map +1 -0
  35. package/dist/cjs/navigation/useSceneHistoryNavigation.js +3 -1
  36. package/dist/cjs/navigation/useSceneHistoryNavigation.js.map +1 -1
  37. package/dist/cjs/slices/CoreSliceDialog.js +21 -0
  38. package/dist/cjs/slices/CoreSliceDialog.js.map +1 -0
  39. package/dist/cjs/slices/SliceCommandFieldsContext.js +22 -0
  40. package/dist/cjs/slices/SliceCommandFieldsContext.js.map +1 -0
  41. package/dist/cjs/slices/SliceDialogView.js +254 -0
  42. package/dist/cjs/slices/SliceDialogView.js.map +1 -0
  43. package/dist/cjs/slices/SliceInvokerContext.js +40 -0
  44. package/dist/cjs/slices/SliceInvokerContext.js.map +1 -0
  45. package/dist/cjs/slices/createAnnouncingInvoker.js +27 -0
  46. package/dist/cjs/slices/createAnnouncingInvoker.js.map +1 -0
  47. package/dist/cjs/slices/createDryRunInvoker.js +38 -0
  48. package/dist/cjs/slices/createDryRunInvoker.js.map +1 -0
  49. package/dist/cjs/slices/sliceDialogDestination.js +41 -0
  50. package/dist/cjs/slices/sliceDialogDestination.js.map +1 -0
  51. package/dist/esm/core/CoreToolbar.d.ts.map +1 -1
  52. package/dist/esm/core/CoreToolbar.js +47 -7
  53. package/dist/esm/core/CoreToolbar.js.map +1 -1
  54. package/dist/esm/core/coreComponentMetadata.d.ts.map +1 -1
  55. package/dist/esm/core/coreComponentMetadata.js +6 -0
  56. package/dist/esm/core/coreComponentMetadata.js.map +1 -1
  57. package/dist/esm/core/coreComponents.d.ts.map +1 -1
  58. package/dist/esm/core/coreComponents.js +3 -1
  59. package/dist/esm/core/coreComponents.js.map +1 -1
  60. package/dist/esm/core/coreDescriptors.d.ts.map +1 -1
  61. package/dist/esm/core/coreDescriptors.js +27 -0
  62. package/dist/esm/core/coreDescriptors.js.map +1 -1
  63. package/dist/esm/core/corePackage.d.ts.map +1 -1
  64. package/dist/esm/core/corePackage.js +2 -1
  65. package/dist/esm/core/corePackage.js.map +1 -1
  66. package/dist/esm/index.d.ts +1 -0
  67. package/dist/esm/index.d.ts.map +1 -1
  68. package/dist/esm/index.js +14 -0
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/navigation/SceneNavigationContext.d.ts +1 -0
  71. package/dist/esm/navigation/SceneNavigationContext.d.ts.map +1 -1
  72. package/dist/esm/navigation/SceneNavigationContext.js.map +1 -1
  73. package/dist/esm/navigation/SceneNavigationHost.d.ts +5 -1
  74. package/dist/esm/navigation/SceneNavigationHost.d.ts.map +1 -1
  75. package/dist/esm/navigation/SceneNavigationHost.js +35 -19
  76. package/dist/esm/navigation/SceneNavigationHost.js.map +1 -1
  77. package/dist/esm/navigation/SceneNavigationState.d.ts +1 -0
  78. package/dist/esm/navigation/SceneNavigationState.d.ts.map +1 -1
  79. package/dist/esm/navigation/index.d.ts +8 -0
  80. package/dist/esm/navigation/index.d.ts.map +1 -1
  81. package/dist/esm/navigation/index.js +8 -0
  82. package/dist/esm/navigation/index.js.map +1 -1
  83. package/dist/esm/navigation/region/NavigationRegionClassNames.d.ts +12 -0
  84. package/dist/esm/navigation/region/NavigationRegionClassNames.d.ts.map +1 -0
  85. package/dist/esm/navigation/region/NavigationRegionClassNames.js +19 -0
  86. package/dist/esm/navigation/region/NavigationRegionClassNames.js.map +1 -0
  87. package/dist/esm/navigation/region/NavigationRegionView.d.ts +20 -0
  88. package/dist/esm/navigation/region/NavigationRegionView.d.ts.map +1 -0
  89. package/dist/esm/navigation/region/NavigationRegionView.js +281 -0
  90. package/dist/esm/navigation/region/NavigationRegionView.js.map +1 -0
  91. package/dist/esm/navigation/region/SceneNavigationModel.d.ts +9 -0
  92. package/dist/esm/navigation/region/SceneNavigationModel.d.ts.map +1 -0
  93. package/dist/esm/navigation/region/SceneNavigationModel.js +2 -0
  94. package/dist/esm/navigation/region/SceneNavigationModel.js.map +1 -0
  95. package/dist/esm/navigation/region/SceneNavigationModelContext.d.ts +9 -0
  96. package/dist/esm/navigation/region/SceneNavigationModelContext.d.ts.map +1 -0
  97. package/dist/esm/navigation/region/SceneNavigationModelContext.js +19 -0
  98. package/dist/esm/navigation/region/SceneNavigationModelContext.js.map +1 -0
  99. package/dist/esm/navigation/region/currentModuleOf.d.ts +3 -0
  100. package/dist/esm/navigation/region/currentModuleOf.d.ts.map +1 -0
  101. package/dist/esm/navigation/region/currentModuleOf.js +13 -0
  102. package/dist/esm/navigation/region/currentModuleOf.js.map +1 -0
  103. package/dist/esm/navigation/region/navigationDestinations.d.ts +4 -0
  104. package/dist/esm/navigation/region/navigationDestinations.d.ts.map +1 -0
  105. package/dist/esm/navigation/region/navigationDestinations.js +44 -0
  106. package/dist/esm/navigation/region/navigationDestinations.js.map +1 -0
  107. package/dist/esm/navigation/region/navigationItemActive.d.ts +5 -0
  108. package/dist/esm/navigation/region/navigationItemActive.d.ts.map +1 -0
  109. package/dist/esm/navigation/region/navigationItemActive.js +29 -0
  110. package/dist/esm/navigation/region/navigationItemActive.js.map +1 -0
  111. package/dist/esm/navigation/region/navigationItemDestination.d.ts +5 -0
  112. package/dist/esm/navigation/region/navigationItemDestination.d.ts.map +1 -0
  113. package/dist/esm/navigation/region/navigationItemDestination.js +31 -0
  114. package/dist/esm/navigation/region/navigationItemDestination.js.map +1 -0
  115. package/dist/esm/navigation/useSceneHistoryNavigation.d.ts.map +1 -1
  116. package/dist/esm/navigation/useSceneHistoryNavigation.js +3 -1
  117. package/dist/esm/navigation/useSceneHistoryNavigation.js.map +1 -1
  118. package/dist/esm/slices/CoreSliceDialog.d.ts +3 -0
  119. package/dist/esm/slices/CoreSliceDialog.d.ts.map +1 -0
  120. package/dist/esm/slices/CoreSliceDialog.js +19 -0
  121. package/dist/esm/slices/CoreSliceDialog.js.map +1 -0
  122. package/dist/esm/slices/InvocationResult.d.ts +10 -0
  123. package/dist/esm/slices/InvocationResult.d.ts.map +1 -0
  124. package/dist/esm/slices/InvocationResult.js +2 -0
  125. package/dist/esm/slices/InvocationResult.js.map +1 -0
  126. package/dist/esm/slices/InvocationValidationError.d.ts +5 -0
  127. package/dist/esm/slices/InvocationValidationError.d.ts.map +1 -0
  128. package/dist/esm/slices/InvocationValidationError.js +2 -0
  129. package/dist/esm/slices/InvocationValidationError.js.map +1 -0
  130. package/dist/esm/slices/SliceCommandField.d.ts +7 -0
  131. package/dist/esm/slices/SliceCommandField.d.ts.map +1 -0
  132. package/dist/esm/slices/SliceCommandField.js +2 -0
  133. package/dist/esm/slices/SliceCommandField.js.map +1 -0
  134. package/dist/esm/slices/SliceCommandFieldsContext.d.ts +10 -0
  135. package/dist/esm/slices/SliceCommandFieldsContext.d.ts.map +1 -0
  136. package/dist/esm/slices/SliceCommandFieldsContext.js +19 -0
  137. package/dist/esm/slices/SliceCommandFieldsContext.js.map +1 -0
  138. package/dist/esm/slices/SliceDialogView.d.ts +12 -0
  139. package/dist/esm/slices/SliceDialogView.d.ts.map +1 -0
  140. package/dist/esm/slices/SliceDialogView.js +250 -0
  141. package/dist/esm/slices/SliceDialogView.js.map +1 -0
  142. package/dist/esm/slices/SliceInvoker.d.ts +5 -0
  143. package/dist/esm/slices/SliceInvoker.d.ts.map +1 -0
  144. package/dist/esm/slices/SliceInvoker.js +2 -0
  145. package/dist/esm/slices/SliceInvoker.js.map +1 -0
  146. package/dist/esm/slices/SliceInvokerContext.d.ts +11 -0
  147. package/dist/esm/slices/SliceInvokerContext.d.ts.map +1 -0
  148. package/dist/esm/slices/SliceInvokerContext.js +36 -0
  149. package/dist/esm/slices/SliceInvokerContext.js.map +1 -0
  150. package/dist/esm/slices/createAnnouncingInvoker.d.ts +3 -0
  151. package/dist/esm/slices/createAnnouncingInvoker.d.ts.map +1 -0
  152. package/dist/esm/slices/createAnnouncingInvoker.js +25 -0
  153. package/dist/esm/slices/createAnnouncingInvoker.js.map +1 -0
  154. package/dist/esm/slices/createDryRunInvoker.d.ts +15 -0
  155. package/dist/esm/slices/createDryRunInvoker.d.ts.map +1 -0
  156. package/dist/esm/slices/createDryRunInvoker.js +36 -0
  157. package/dist/esm/slices/createDryRunInvoker.js.map +1 -0
  158. package/dist/esm/slices/index.d.ts +12 -0
  159. package/dist/esm/slices/index.d.ts.map +1 -0
  160. package/dist/esm/slices/index.js +12 -0
  161. package/dist/esm/slices/index.js.map +1 -0
  162. package/dist/esm/slices/sliceDialogDestination.d.ts +10 -0
  163. package/dist/esm/slices/sliceDialogDestination.d.ts.map +1 -0
  164. package/dist/esm/slices/sliceDialogDestination.js +38 -0
  165. package/dist/esm/slices/sliceDialogDestination.js.map +1 -0
  166. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  167. package/index.ts +1 -0
  168. package/navigation/SceneNavigationContext.tsx +3 -0
  169. package/navigation/SceneNavigationHost.tsx +35 -9
  170. package/navigation/SceneNavigationState.ts +3 -0
  171. package/navigation/index.ts +8 -0
  172. package/navigation/region/NavigationRegionClassNames.ts +46 -0
  173. package/navigation/region/NavigationRegionView.tsx +234 -0
  174. package/navigation/region/SceneNavigationModel.ts +29 -0
  175. package/navigation/region/SceneNavigationModelContext.tsx +25 -0
  176. package/navigation/region/currentModuleOf.ts +14 -0
  177. package/navigation/region/navigationDestinations.ts +41 -0
  178. package/navigation/region/navigationItemActive.ts +39 -0
  179. package/navigation/region/navigationItemDestination.ts +29 -0
  180. package/navigation/useSceneHistoryNavigation.ts +2 -1
  181. package/package.json +5 -5
  182. package/slices/CoreSliceDialog.tsx +14 -0
  183. package/slices/InvocationResult.ts +27 -0
  184. package/slices/InvocationValidationError.ts +13 -0
  185. package/slices/SliceCommandField.ts +19 -0
  186. package/slices/SliceCommandFieldsContext.tsx +28 -0
  187. package/slices/SliceDialogView.tsx +176 -0
  188. package/slices/SliceInvoker.ts +19 -0
  189. package/slices/SliceInvokerContext.tsx +47 -0
  190. package/slices/createAnnouncingInvoker.ts +17 -0
  191. package/slices/createDryRunInvoker.ts +43 -0
  192. package/slices/index.ts +14 -0
  193. package/slices/sliceDialogDestination.ts +40 -0
@@ -1,11 +1,14 @@
1
1
  // Copyright (c) Cratis. All rights reserved.
2
2
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
 
4
- import { useContext } from 'react';
5
- import { BindingScope, resolveBindingExpression } from '@cratis/scene.engine';
6
- import { BindingExpression, BindingSourceKind, DestinationKind, DestinationReference } from '@cratis/scene.model';
4
+ import { useContext, useMemo } from 'react';
5
+ import { ApplicationStructureIndex, BindingScope, resolveBindingExpression, resolveToolbarButton, toolbarButtonFromItem } from '@cratis/scene.engine';
6
+ import { BindingExpression, BindingSourceKind, DestinationKind, DestinationReference, ToolbarEmphasis } from '@cratis/scene.model';
7
7
  import { RegisteredComponentProps, useRenderBindingScope } from '../renderer';
8
8
  import { SceneNavigationContextInternal } from '../navigation/SceneNavigationContext';
9
+ import { useSceneNavigationModel } from '../navigation/region/SceneNavigationModelContext';
10
+ import { sliceDialogDestination } from '../slices/sliceDialogDestination';
11
+ import { useWarnEmptySlices } from '../slices/SliceInvokerContext';
9
12
 
10
13
  /** How a toolbar item shows its icon and label - the `mode` an item's presentation hint can name. */
11
14
  export type ToolbarItemMode = 'icon' | 'text' | 'both';
@@ -54,6 +57,12 @@ function withResolvedParameters(destination: DestinationReference, scope: Bindin
54
57
  };
55
58
  }
56
59
 
60
+ /** How prominent the item is: its authored emphasis, else `secondary`. */
61
+ function emphasisOf(properties: Record<string, unknown>): ToolbarEmphasis {
62
+ const emphasis = textProperty(properties, 'emphasis')?.toLowerCase();
63
+ return emphasis === ToolbarEmphasis.Primary || emphasis === ToolbarEmphasis.Quiet ? emphasis : ToolbarEmphasis.Secondary;
64
+ }
65
+
57
66
  /** The mode the item's authored presentation asks for; anything it does not name shows both. */
58
67
  export function toolbarItemMode(presentation: Record<string, unknown>): ToolbarItemMode {
59
68
  const mode = presentation.mode;
@@ -111,14 +120,30 @@ export function CoreToolbarItem({ element }: RegisteredComponentProps) {
111
120
  const presentation = recordProperty(element.properties, 'presentation');
112
121
  const mode = toolbarItemMode(presentation);
113
122
  const destination = toolbarItemDestination(element.properties);
123
+ const model = useSceneNavigationModel();
124
+ const warnEmptySlices = useWarnEmptySlices();
125
+ const button = useMemo(() => toolbarButtonFromItem(element.id, element.properties), [element.id, element.properties]);
126
+ const resolved = useMemo(() => {
127
+ if (!button || !model) return undefined;
128
+ const index = model.structure instanceof ApplicationStructureIndex ? model.structure : new ApplicationStructureIndex(model.structure);
129
+ return resolveToolbarButton(index, button);
130
+ }, [button, model]);
131
+ const dialog = resolved ? sliceDialogDestination(resolved) : undefined;
132
+ const emphasis = resolved?.emphasis ?? button?.emphasis ?? emphasisOf(element.properties);
133
+ const empty = button !== undefined && button.slice === undefined && button.target === undefined;
114
134
  const attributes = Object.fromEntries(Object.entries(presentation)
115
135
  .filter(([key]) => /^[A-Za-z][A-Za-z0-9-]*$/.test(key))
116
136
  .map(([key, value]) => [`data-scene-presentation-${key.toLowerCase()}`, String(value)]));
117
137
 
118
138
  const activate = () => {
119
- if (kind === 'action') {
139
+ if (dialog && navigation) {
140
+ navigation.navigate(dialog);
141
+ return;
142
+ }
143
+
144
+ if (kind === 'action' || button !== undefined) {
120
145
  const args = resolveParameters(recordProperty(element.properties, 'parameters'), scope);
121
- globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command: target, element, arguments: args } }));
146
+ globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command: target || button?.slice || '', element, arguments: args } }));
122
147
  return;
123
148
  }
124
149
 
@@ -142,12 +167,18 @@ export function CoreToolbarItem({ element }: RegisteredComponentProps) {
142
167
  data-scene-mode={mode}
143
168
  aria-label={mode === 'icon' ? label : undefined}
144
169
  title={mode === 'icon' ? label : undefined}
145
- disabled={kind !== 'action' && !destination}
170
+ disabled={kind !== 'action' && button === undefined && !destination}
171
+ aria-haspopup={dialog ? 'dialog' : undefined}
172
+ data-scene-emphasis={emphasis}
173
+ data-scene-slice={resolved?.slice ?? button?.slice}
174
+ data-scene-warning={warnEmptySlices && empty ? 'emptySlice' : undefined}
175
+ className={`scene-toolbar-button scene-toolbar-button-${emphasis}`}
146
176
  onClick={activate}
147
177
  {...attributes}
148
178
  >
149
179
  {mode !== 'text' && icon && <span aria-hidden='true' data-scene-icon-name={icon} />}
150
180
  {mode !== 'icon' && label}
181
+ {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>}
151
182
  </button>
152
183
  );
153
184
  }
@@ -23,5 +23,6 @@ export const coreComponentMetadata: Record<string, ComponentMetadata> = {
23
23
  navigationBar: m('Navigation bar', ComponentCategory.Navigation, 'navigation', ['menu', 'nav', 'links'], undefined, navigationDesignMode({ itemsPath: 'items' })),
24
24
  outlet: m('Outlet', ComponentCategory.Layout, 'panel-right', ['region', 'slot', 'side panel']),
25
25
  toolbar: m('Toolbar', ComponentCategory.Actions, 'wrench', ['actions', 'buttons', 'command bar'], 'Tl', toolbarDesignMode()),
26
+ sliceDialog: m('Slice dialog', ComponentCategory.Overlay, 'square-pen', ['task dialog', 'state change', 'form', 'command'], undefined),
26
27
  toolbarItem: m('Toolbar item', ComponentCategory.Actions, 'mouse-pointer-click', ['button', 'action']),
27
28
  };
@@ -9,6 +9,7 @@ import { CoreCard } from './CoreCard';
9
9
  import { CoreNavigationBar } from './CoreNavigationBar';
10
10
  import { CoreToolbar, CoreToolbarItem } from './CoreToolbar';
11
11
  import { CoreOutlet } from '../navigation/CoreOutlet';
12
+ import { CoreSliceDialog } from '../slices/CoreSliceDialog';
12
13
  import {
13
14
  CoreAction,
14
15
  CoreCode,
@@ -46,4 +47,5 @@ export const coreComponents: ComponentRegistry = {
46
47
  [componentRegistryKey('core', 'outlet')]: CoreOutlet,
47
48
  [componentRegistryKey('core', 'toolbar')]: CoreToolbar,
48
49
  [componentRegistryKey('core', 'toolbarItem')]: CoreToolbarItem,
50
+ [componentRegistryKey('core', 'sliceDialog')]: CoreSliceDialog,
49
51
  };
@@ -73,6 +73,19 @@ const describedCore: ComponentDescriptor[] = [
73
73
  },
74
74
  ],
75
75
  },
76
+ {
77
+ component: key('sliceDialog'),
78
+ displayName: 'Slice dialog',
79
+ 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.',
80
+ properties: [
81
+ {
82
+ path: 'slice', label: 'Slice', group: 'Behavior', valueType: PropertyValueType.String,
83
+ editorKind: PropertyEditorKind.Slice, editorOptions: { kinds: ['StateChange'] },
84
+ description: 'The State Change slice the dialog submits; empty to take it from the toolbar button that opens the dialog.',
85
+ },
86
+ { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, description: 'The dialog title and submit label; empty to take the toolbar button title.' },
87
+ ],
88
+ },
76
89
  {
77
90
  component: key('column'),
78
91
  displayName: 'Table column',
@@ -37,6 +37,7 @@ export const corePackageManifest: ScenePackage = {
37
37
  'outlet',
38
38
  'toolbar',
39
39
  'toolbarItem',
40
+ 'sliceDialog',
40
41
  ],
41
42
  layouts: [],
42
43
  screenTemplates: [],
@@ -8,6 +8,9 @@ var RenderBindingScopeContext = require('../renderer/RenderBindingScopeContext.j
8
8
  require('../interactions/useInteractions.js');
9
9
  require('../interactions/NotificationHost.js');
10
10
  var SceneNavigationContext = require('../navigation/SceneNavigationContext.js');
11
+ var SceneNavigationModelContext = require('../navigation/region/SceneNavigationModelContext.js');
12
+ var sliceDialogDestination = require('../slices/sliceDialogDestination.js');
13
+ var SliceInvokerContext = require('../slices/SliceInvokerContext.js');
11
14
 
12
15
  function textProperty(properties, name) {
13
16
  return typeof properties[name] === 'string' ? properties[name] : undefined;
@@ -59,6 +62,10 @@ function resolveParameters(parameters, scope) {
59
62
  ]))
60
63
  };
61
64
  }
65
+ /** How prominent the item is: its authored emphasis, else `secondary`. */ function emphasisOf(properties) {
66
+ const emphasis = textProperty(properties, 'emphasis')?.toLowerCase();
67
+ return emphasis === scene_model.ToolbarEmphasis.Primary || emphasis === scene_model.ToolbarEmphasis.Quiet ? emphasis : scene_model.ToolbarEmphasis.Secondary;
68
+ }
62
69
  /** The mode the item's authored presentation asks for; anything it does not name shows both. */ function toolbarItemMode(presentation) {
63
70
  const mode = presentation.mode;
64
71
  return mode === 'icon' || mode === 'text' ? mode : 'both';
@@ -124,16 +131,37 @@ function resolveParameters(parameters, scope) {
124
131
  const presentation = recordProperty(element.properties, 'presentation');
125
132
  const mode = toolbarItemMode(presentation);
126
133
  const destination = toolbarItemDestination(element.properties);
134
+ const model = SceneNavigationModelContext.useSceneNavigationModel();
135
+ const warnEmptySlices = SliceInvokerContext.useWarnEmptySlices();
136
+ const button = react.useMemo(()=>scene_engine.toolbarButtonFromItem(element.id, element.properties), [
137
+ element.id,
138
+ element.properties
139
+ ]);
140
+ const resolved = react.useMemo(()=>{
141
+ if (!button || !model) return undefined;
142
+ const index = model.structure instanceof scene_engine.ApplicationStructureIndex ? model.structure : new scene_engine.ApplicationStructureIndex(model.structure);
143
+ return scene_engine.resolveToolbarButton(index, button);
144
+ }, [
145
+ button,
146
+ model
147
+ ]);
148
+ const dialog = resolved ? sliceDialogDestination.sliceDialogDestination(resolved) : undefined;
149
+ const emphasis = resolved?.emphasis ?? button?.emphasis ?? emphasisOf(element.properties);
150
+ const empty = button !== undefined && button.slice === undefined && button.target === undefined;
127
151
  const attributes = Object.fromEntries(Object.entries(presentation).filter(([key])=>/^[A-Za-z][A-Za-z0-9-]*$/.test(key)).map(([key, value])=>[
128
152
  `data-scene-presentation-${key.toLowerCase()}`,
129
153
  String(value)
130
154
  ]));
131
155
  const activate = ()=>{
132
- if (kind === 'action') {
156
+ if (dialog && navigation) {
157
+ navigation.navigate(dialog);
158
+ return;
159
+ }
160
+ if (kind === 'action' || button !== undefined) {
133
161
  const args = resolveParameters(recordProperty(element.properties, 'parameters'), scope);
134
162
  globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', {
135
163
  detail: {
136
- command: target,
164
+ command: target || button?.slice || '',
137
165
  element,
138
166
  arguments: args
139
167
  }
@@ -163,7 +191,12 @@ function resolveParameters(parameters, scope) {
163
191
  "data-scene-mode": mode,
164
192
  "aria-label": mode === 'icon' ? label : undefined,
165
193
  title: mode === 'icon' ? label : undefined,
166
- disabled: kind !== 'action' && !destination,
194
+ disabled: kind !== 'action' && button === undefined && !destination,
195
+ "aria-haspopup": dialog ? 'dialog' : undefined,
196
+ "data-scene-emphasis": emphasis,
197
+ "data-scene-slice": resolved?.slice ?? button?.slice,
198
+ "data-scene-warning": warnEmptySlices && empty ? 'emptySlice' : undefined,
199
+ className: `scene-toolbar-button scene-toolbar-button-${emphasis}`,
167
200
  onClick: activate,
168
201
  ...attributes,
169
202
  children: [
@@ -171,7 +204,14 @@ function resolveParameters(parameters, scope) {
171
204
  "aria-hidden": "true",
172
205
  "data-scene-icon-name": icon
173
206
  }),
174
- mode !== 'icon' && label
207
+ mode !== 'icon' && label,
208
+ warnEmptySlices && empty && /*#__PURE__*/ jsxRuntime.jsx("span", {
209
+ role: "img",
210
+ "aria-label": "No slice is linked to this button",
211
+ title: "No slice is linked to this button",
212
+ "data-scene-badge": "warning",
213
+ children: "!"
214
+ })
175
215
  ]
176
216
  });
177
217
  }
@@ -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":";;;;;;;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C,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,KAAAA,KAAU,YAAYC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO,KAAA;IAChF,OAAO;AAAC,QAAA,QAAA;AAAU,QAAA,QAAA;AAAU,QAAA,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CAACyD,MAAAA,EAAAA;gBAAKC,aAAAA,EAAY,MAAA;gBAAOC,sBAAAA,EAAsB7C;;AAC1ExB,YAAAA,IAAAA,KAAS,MAAA,IAAUuB,KAAAA;AACnBI,YAAAA,eAAAA,IAAmBW,uBAAS5B,cAAA,CAACyD,MAAAA,EAAAA;gBAAKpD,IAAAA,EAAK,KAAA;gBAAMC,YAAAA,EAAW,mCAAA;gBAAoC2C,KAAAA,EAAM,mCAAA;gBAAoCW,kBAAAA,EAAiB,SAAA;AAAU,gBAAA,QAAA,EAAA;;;;AAG9K;;;;;"}
@@ -99,6 +99,12 @@ var designModes = require('../packages/designModes.js');
99
99
  'buttons',
100
100
  'command bar'
101
101
  ], 'Tl', designModes.toolbarDesignMode()),
102
+ sliceDialog: describeComponents.componentMetadata('Slice dialog', scene_model.ComponentCategory.Overlay, 'square-pen', [
103
+ 'task dialog',
104
+ 'state change',
105
+ 'form',
106
+ 'command'
107
+ ], undefined),
102
108
  toolbarItem: describeComponents.componentMetadata('Toolbar item', scene_model.ComponentCategory.Actions, 'mouse-pointer-click', [
103
109
  'button',
104
110
  '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,oCAAAA,CAAE,MAAA,EAAQC,6BAAAA,CAAkBC,WAAW,EAAE,MAAA,EAAQ;AAAC,QAAA,OAAA;AAAS,QAAA,WAAA;AAAa,QAAA;AAAO,KAAA,CAAA;AACrFC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kBK,MAAM,EAAE,aAAA,EAAe;AAAC,QAAA,QAAA;AAAU,QAAA,MAAA;AAAQ,QAAA;AAAa,KAAA,CAAA;AAC7FkB,IAAAA,OAAAA,EAASxB,oCAAAA,CAAE,SAAA,EAAWC,6BAAAA,CAAkBG,OAAO,EAAE,QAAA,EAAU;AAAC,QAAA,SAAA;AAAW,QAAA,SAAA;AAAW,QAAA;AAAc,KAAA,EAAE,IAAA,EAAMqB,6BAAAA,EAAAA,CAAAA;AACxGC,IAAAA,WAAAA,EAAa1B,oCAAAA,CAAE,cAAA,EAAgBC,6BAAAA,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,oCAAAA,CAAE,MAAA,EAAQC,6BAAAA,CAAkBC,WAAW,EAAE,MAAA,EAAQ;AAAC,QAAA,OAAA;AAAS,QAAA,WAAA;AAAa,QAAA;AAAO,KAAA,CAAA;AACrFC,IAAAA,MAAAA,EAAQH,oCAAAA,CAAE,QAAA,EAAUC,6BAAAA,CAAkBG,OAAO,EAAE,qBAAA,EAAuB;AAAC,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA;KAAS,EAAE,IAAA,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AA,CAAkBG,OAAO,EAAE,QAAA,EAAU;AAAC,QAAA,SAAA;AAAW,QAAA,SAAA;AAAW,QAAA;AAAc,KAAA,EAAE,IAAA,EAAMqB,6BAAAA,EAAAA,CAAAA;AACxGC,IAAAA,WAAAA,EAAa1B,oCAAAA,CAAE,cAAA,EAAgBC,6BAAAA,CAAkB0B,OAAO,EAAE,YAAA,EAAc;AAAC,QAAA,aAAA;AAAe,QAAA,cAAA;AAAgB,QAAA,MAAA;AAAQ,QAAA;KAAU,EAAEP,SAAAA,CAAAA;AAC5HQ,IAAAA,WAAAA,EAAa5B,oCAAAA,CAAE,cAAA,EAAgBC,6BAAAA,CAAkBG,OAAO,EAAE,qBAAA,EAAuB;AAAC,QAAA,QAAA;AAAU,QAAA;AAAS,KAAA;AACzG;;"}
@@ -14,6 +14,7 @@ var CoreButton = require('./CoreButton.js');
14
14
  var CoreCard = require('./CoreCard.js');
15
15
  var CoreNavigationBar = require('./CoreNavigationBar.js');
16
16
  var CoreToolbar = require('./CoreToolbar.js');
17
+ var CoreSliceDialog = require('../slices/CoreSliceDialog.js');
17
18
  var ScreenplayCoreComponents = require('./ScreenplayCoreComponents.js');
18
19
 
19
20
  // Copyright (c) Cratis. All rights reserved.
@@ -39,7 +40,8 @@ var ScreenplayCoreComponents = require('./ScreenplayCoreComponents.js');
39
40
  [ScenePackageBundle.componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar.CoreNavigationBar,
40
41
  [ScenePackageBundle.componentRegistryKey('core', 'outlet')]: CoreOutlet.CoreOutlet,
41
42
  [ScenePackageBundle.componentRegistryKey('core', 'toolbar')]: CoreToolbar.CoreToolbar,
42
- [ScenePackageBundle.componentRegistryKey('core', 'toolbarItem')]: CoreToolbar.CoreToolbarItem
43
+ [ScenePackageBundle.componentRegistryKey('core', 'toolbarItem')]: CoreToolbar.CoreToolbarItem,
44
+ [ScenePackageBundle.componentRegistryKey('core', 'sliceDialog')]: CoreSliceDialog.CoreSliceDialog
43
45
  };
44
46
 
45
47
  exports.coreComponents = 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,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,iBAAAA;IACxC,CAACD,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,qBAAAA;IAC1C,CAACF,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG,iBAAAA;IACxC,CAACH,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUI,iCAAAA;IACxC,CAACJ,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYK,mCAAAA;IAC1C,CAACL,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaM,oCAAAA;IAC3C,CAACN,uCAAAA,CAAqB,MAAA,EAAQ,UAAA,CAAA,GAAcO,qCAAAA;IAC5C,CAACP,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWQ,kCAAAA;IACzC,CAACR,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWS,kCAAAA;IACzC,CAACT,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYU,mCAAAA;IAC1C,CAACV,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaW,oCAAAA;IAC3C,CAACX,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWY,kCAAAA;IACzC,CAACZ,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUa,iCAAAA;IACxC,CAACb,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUc,iCAAAA;IACxC,CAACd,uCAAAA,CAAqB,MAAA,EAAQ,eAAA,CAAA,GAAmBe,mCAAAA;IACjD,CAACf,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYgB,qBAAAA;IAC1C,CAAChB,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaiB,uBAAAA;IAC3C,CAACjB,uCAAAA,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","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar","CoreOutlet","CoreToolbar","CoreToolbarItem","CoreSliceDialog"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AAyBA;;;UAIaA,cAAAA,GAAoC;IAC7C,CAACC,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,iBAAAA;IACxC,CAACD,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,qBAAAA;IAC1C,CAACF,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG,iBAAAA;IACxC,CAACH,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUI,iCAAAA;IACxC,CAACJ,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYK,mCAAAA;IAC1C,CAACL,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaM,oCAAAA;IAC3C,CAACN,uCAAAA,CAAqB,MAAA,EAAQ,UAAA,CAAA,GAAcO,qCAAAA;IAC5C,CAACP,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWQ,kCAAAA;IACzC,CAACR,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWS,kCAAAA;IACzC,CAACT,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYU,mCAAAA;IAC1C,CAACV,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaW,oCAAAA;IAC3C,CAACX,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWY,kCAAAA;IACzC,CAACZ,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUa,iCAAAA;IACxC,CAACb,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUc,iCAAAA;IACxC,CAACd,uCAAAA,CAAqB,MAAA,EAAQ,eAAA,CAAA,GAAmBe,mCAAAA;IACjD,CAACf,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYgB,qBAAAA;IAC1C,CAAChB,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaiB,uBAAAA;IAC3C,CAACjB,uCAAAA,CAAqB,MAAA,EAAQ,aAAA,CAAA,GAAiBkB,2BAAAA;IAC/C,CAAClB,uCAAAA,CAAqB,MAAA,EAAQ,aAAA,CAAA,GAAiBmB;AACnD;;"}
@@ -153,6 +153,33 @@ const key = (name)=>ScenePackageBundle.componentRegistryKey('core', name);
153
153
  }
154
154
  ]
155
155
  },
156
+ {
157
+ component: key('sliceDialog'),
158
+ displayName: 'Slice dialog',
159
+ 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.',
160
+ properties: [
161
+ {
162
+ path: 'slice',
163
+ label: 'Slice',
164
+ group: 'Behavior',
165
+ valueType: scene_model.PropertyValueType.String,
166
+ editorKind: scene_model.PropertyEditorKind.Slice,
167
+ editorOptions: {
168
+ kinds: [
169
+ 'StateChange'
170
+ ]
171
+ },
172
+ description: 'The State Change slice the dialog submits; empty to take it from the toolbar button that opens the dialog.'
173
+ },
174
+ {
175
+ path: 'title',
176
+ label: 'Title',
177
+ group: 'Content',
178
+ valueType: scene_model.PropertyValueType.String,
179
+ description: 'The dialog title and submit label; empty to take the toolbar button title.'
180
+ }
181
+ ]
182
+ },
156
183
  {
157
184
  component: key('column'),
158
185
  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,uCAAAA,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,8BAAkBC,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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AkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAa,aAAA;AAC9G,YAAA;gBACIN,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,8BAAkBO,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,8BAAkBC,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,8BAAkBoB,IAAI;4BAAEhB,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBsB,WAAW;4BAAElB,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;AACH,CAAA;AAED,6IACO,MAAMiB,kBAAyCC,qCAAAA,CAAmB,MAAA,EAAQhC,eAAeiC,2CAAAA;;"}
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,uCAAAA,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,8BAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAA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1I,wBAAA;4BAAEzB,IAAAA,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBoB,IAAI;4BAAEhB,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBsB,WAAW;4BAAElB,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;AACH,CAAA;AAED,6IACO,MAAMiB,kBAAyCC,qCAAAA,CAAmB,MAAA,EAAQhC,eAAeiC,2CAAAA;;"}
@@ -35,7 +35,8 @@ var coreDescriptors = require('./coreDescriptors.js');
35
35
  'navigationBar',
36
36
  'outlet',
37
37
  'toolbar',
38
- 'toolbarItem'
38
+ 'toolbarItem',
39
+ 'sliceDialog'
39
40
  ],
40
41
  layouts: [],
41
42
  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,wBAAYC,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,6BAAAA;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,wBAAYC,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,6BAAAA;IACZC,WAAAA,EAAaC;AACjB;;;"}
package/dist/cjs/index.js CHANGED
@@ -37,6 +37,20 @@ var CoreOutlet = require('./navigation/CoreOutlet.js');
37
37
  var SceneOutletContext = require('./navigation/SceneOutletContext.js');
38
38
  var collectOutletOwners = require('./navigation/collectOutletOwners.js');
39
39
  var placeInOutlet = require('./navigation/placeInOutlet.js');
40
+ var SceneNavigationModelContext = require('./navigation/region/SceneNavigationModelContext.js');
41
+ var NavigationRegionClassNames = require('./navigation/region/NavigationRegionClassNames.js');
42
+ var NavigationRegionView = require('./navigation/region/NavigationRegionView.js');
43
+ var currentModuleOf = require('./navigation/region/currentModuleOf.js');
44
+ var navigationItemActive = require('./navigation/region/navigationItemActive.js');
45
+ var navigationItemDestination = require('./navigation/region/navigationItemDestination.js');
46
+ var navigationDestinations = require('./navigation/region/navigationDestinations.js');
47
+ var createAnnouncingInvoker = require('./slices/createAnnouncingInvoker.js');
48
+ var createDryRunInvoker = require('./slices/createDryRunInvoker.js');
49
+ var SliceInvokerContext = require('./slices/SliceInvokerContext.js');
50
+ var SliceCommandFieldsContext = require('./slices/SliceCommandFieldsContext.js');
51
+ var sliceDialogDestination = require('./slices/sliceDialogDestination.js');
52
+ var SliceDialogView = require('./slices/SliceDialogView.js');
53
+ var CoreSliceDialog = require('./slices/CoreSliceDialog.js');
40
54
  var IconAdapterRegistry = require('./icons/IconAdapterRegistry.js');
41
55
  var IconAdapterContext = require('./icons/IconAdapterContext.js');
42
56
  var useIconGlyph = require('./icons/useIconGlyph.js');
@@ -134,6 +148,28 @@ exports.useSceneOutlets = SceneOutletContext.useSceneOutlets;
134
148
  exports.collectOutletOwners = collectOutletOwners.collectOutletOwners;
135
149
  exports.outletComponentName = collectOutletOwners.outletComponentName;
136
150
  exports.placeInOutlet = placeInOutlet.placeInOutlet;
151
+ exports.SceneNavigationModelProvider = SceneNavigationModelContext.SceneNavigationModelProvider;
152
+ exports.useSceneNavigationModel = SceneNavigationModelContext.useSceneNavigationModel;
153
+ exports.defaultNavigationRegionClassNames = NavigationRegionClassNames.defaultNavigationRegionClassNames;
154
+ exports.NavigationRegionView = NavigationRegionView.NavigationRegionView;
155
+ exports.currentModuleOf = currentModuleOf.currentModuleOf;
156
+ exports.navigationItemActive = navigationItemActive.navigationItemActive;
157
+ exports.defaultScreenFor = navigationItemDestination.defaultScreenFor;
158
+ exports.navigationItemDestination = navigationItemDestination.navigationItemDestination;
159
+ exports.navigationDestinations = navigationDestinations.navigationDestinations;
160
+ exports.createAnnouncingInvoker = createAnnouncingInvoker.createAnnouncingInvoker;
161
+ exports.createDryRunInvoker = createDryRunInvoker.createDryRunInvoker;
162
+ exports.SliceInvokerProvider = SliceInvokerContext.SliceInvokerProvider;
163
+ exports.useSliceInvoker = SliceInvokerContext.useSliceInvoker;
164
+ exports.useWarnEmptySlices = SliceInvokerContext.useWarnEmptySlices;
165
+ exports.SliceCommandFieldsProvider = SliceCommandFieldsContext.SliceCommandFieldsProvider;
166
+ exports.useSliceCommandFields = SliceCommandFieldsContext.useSliceCommandFields;
167
+ exports.sliceDialogDestination = sliceDialogDestination.sliceDialogDestination;
168
+ exports.sliceDialogParameters = sliceDialogDestination.sliceDialogParameters;
169
+ exports.SliceDialogView = SliceDialogView.SliceDialogView;
170
+ exports.sliceFieldLabel = SliceDialogView.sliceFieldLabel;
171
+ exports.slicePayload = SliceDialogView.slicePayload;
172
+ exports.CoreSliceDialog = CoreSliceDialog.CoreSliceDialog;
137
173
  exports.IconAdapterRegistry = IconAdapterRegistry.IconAdapterRegistry;
138
174
  exports.createIconAdapterRegistry = IconAdapterRegistry.createIconAdapterRegistry;
139
175
  exports.IconAdapterProvider = IconAdapterContext.IconAdapterProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}