@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.
- package/core/CoreToolbar.tsx +37 -6
- package/core/coreComponentMetadata.ts +1 -0
- package/core/coreComponents.ts +2 -0
- package/core/coreDescriptors.ts +13 -0
- package/core/corePackage.ts +1 -0
- package/dist/cjs/core/CoreToolbar.js +44 -4
- package/dist/cjs/core/CoreToolbar.js.map +1 -1
- package/dist/cjs/core/coreComponentMetadata.js +6 -0
- package/dist/cjs/core/coreComponentMetadata.js.map +1 -1
- package/dist/cjs/core/coreComponents.js +3 -1
- package/dist/cjs/core/coreComponents.js.map +1 -1
- package/dist/cjs/core/coreDescriptors.js +27 -0
- package/dist/cjs/core/coreDescriptors.js.map +1 -1
- package/dist/cjs/core/corePackage.js +2 -1
- package/dist/cjs/core/corePackage.js.map +1 -1
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/SceneNavigationContext.js.map +1 -1
- package/dist/cjs/navigation/SceneNavigationHost.js +10 -5
- package/dist/cjs/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/cjs/navigation/useSceneHistoryNavigation.js +3 -1
- package/dist/cjs/navigation/useSceneHistoryNavigation.js.map +1 -1
- package/dist/cjs/slices/CoreSliceDialog.js +21 -0
- package/dist/cjs/slices/CoreSliceDialog.js.map +1 -0
- package/dist/cjs/slices/SliceCommandFieldsContext.js +22 -0
- package/dist/cjs/slices/SliceCommandFieldsContext.js.map +1 -0
- package/dist/cjs/slices/SliceDialogView.js +254 -0
- package/dist/cjs/slices/SliceDialogView.js.map +1 -0
- package/dist/cjs/slices/SliceInvokerContext.js +40 -0
- package/dist/cjs/slices/SliceInvokerContext.js.map +1 -0
- package/dist/cjs/slices/createAnnouncingInvoker.js +27 -0
- package/dist/cjs/slices/createAnnouncingInvoker.js.map +1 -0
- package/dist/cjs/slices/createDryRunInvoker.js +38 -0
- package/dist/cjs/slices/createDryRunInvoker.js.map +1 -0
- package/dist/cjs/slices/sliceDialogDestination.js +41 -0
- package/dist/cjs/slices/sliceDialogDestination.js.map +1 -0
- package/dist/esm/core/CoreToolbar.d.ts.map +1 -1
- package/dist/esm/core/CoreToolbar.js +47 -7
- package/dist/esm/core/CoreToolbar.js.map +1 -1
- package/dist/esm/core/coreComponentMetadata.d.ts.map +1 -1
- package/dist/esm/core/coreComponentMetadata.js +6 -0
- package/dist/esm/core/coreComponentMetadata.js.map +1 -1
- package/dist/esm/core/coreComponents.d.ts.map +1 -1
- package/dist/esm/core/coreComponents.js +3 -1
- package/dist/esm/core/coreComponents.js.map +1 -1
- package/dist/esm/core/coreDescriptors.d.ts.map +1 -1
- package/dist/esm/core/coreDescriptors.js +27 -0
- package/dist/esm/core/coreDescriptors.js.map +1 -1
- package/dist/esm/core/corePackage.d.ts.map +1 -1
- package/dist/esm/core/corePackage.js +2 -1
- package/dist/esm/core/corePackage.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/navigation/SceneNavigationContext.d.ts +1 -0
- package/dist/esm/navigation/SceneNavigationContext.d.ts.map +1 -1
- package/dist/esm/navigation/SceneNavigationContext.js.map +1 -1
- package/dist/esm/navigation/SceneNavigationHost.d.ts.map +1 -1
- package/dist/esm/navigation/SceneNavigationHost.js +10 -5
- package/dist/esm/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/esm/navigation/SceneNavigationState.d.ts +1 -0
- package/dist/esm/navigation/SceneNavigationState.d.ts.map +1 -1
- package/dist/esm/navigation/useSceneHistoryNavigation.d.ts.map +1 -1
- package/dist/esm/navigation/useSceneHistoryNavigation.js +3 -1
- package/dist/esm/navigation/useSceneHistoryNavigation.js.map +1 -1
- package/dist/esm/slices/CoreSliceDialog.d.ts +3 -0
- package/dist/esm/slices/CoreSliceDialog.d.ts.map +1 -0
- package/dist/esm/slices/CoreSliceDialog.js +19 -0
- package/dist/esm/slices/CoreSliceDialog.js.map +1 -0
- package/dist/esm/slices/InvocationResult.d.ts +10 -0
- package/dist/esm/slices/InvocationResult.d.ts.map +1 -0
- package/dist/esm/slices/InvocationResult.js +2 -0
- package/dist/esm/slices/InvocationResult.js.map +1 -0
- package/dist/esm/slices/InvocationValidationError.d.ts +5 -0
- package/dist/esm/slices/InvocationValidationError.d.ts.map +1 -0
- package/dist/esm/slices/InvocationValidationError.js +2 -0
- package/dist/esm/slices/InvocationValidationError.js.map +1 -0
- package/dist/esm/slices/SliceCommandField.d.ts +7 -0
- package/dist/esm/slices/SliceCommandField.d.ts.map +1 -0
- package/dist/esm/slices/SliceCommandField.js +2 -0
- package/dist/esm/slices/SliceCommandField.js.map +1 -0
- package/dist/esm/slices/SliceCommandFieldsContext.d.ts +10 -0
- package/dist/esm/slices/SliceCommandFieldsContext.d.ts.map +1 -0
- package/dist/esm/slices/SliceCommandFieldsContext.js +19 -0
- package/dist/esm/slices/SliceCommandFieldsContext.js.map +1 -0
- package/dist/esm/slices/SliceDialogView.d.ts +12 -0
- package/dist/esm/slices/SliceDialogView.d.ts.map +1 -0
- package/dist/esm/slices/SliceDialogView.js +250 -0
- package/dist/esm/slices/SliceDialogView.js.map +1 -0
- package/dist/esm/slices/SliceInvoker.d.ts +5 -0
- package/dist/esm/slices/SliceInvoker.d.ts.map +1 -0
- package/dist/esm/slices/SliceInvoker.js +2 -0
- package/dist/esm/slices/SliceInvoker.js.map +1 -0
- package/dist/esm/slices/SliceInvokerContext.d.ts +11 -0
- package/dist/esm/slices/SliceInvokerContext.d.ts.map +1 -0
- package/dist/esm/slices/SliceInvokerContext.js +36 -0
- package/dist/esm/slices/SliceInvokerContext.js.map +1 -0
- package/dist/esm/slices/createAnnouncingInvoker.d.ts +3 -0
- package/dist/esm/slices/createAnnouncingInvoker.d.ts.map +1 -0
- package/dist/esm/slices/createAnnouncingInvoker.js +25 -0
- package/dist/esm/slices/createAnnouncingInvoker.js.map +1 -0
- package/dist/esm/slices/createDryRunInvoker.d.ts +15 -0
- package/dist/esm/slices/createDryRunInvoker.d.ts.map +1 -0
- package/dist/esm/slices/createDryRunInvoker.js +36 -0
- package/dist/esm/slices/createDryRunInvoker.js.map +1 -0
- package/dist/esm/slices/index.d.ts +12 -0
- package/dist/esm/slices/index.d.ts.map +1 -0
- package/dist/esm/slices/index.js +12 -0
- package/dist/esm/slices/index.js.map +1 -0
- package/dist/esm/slices/sliceDialogDestination.d.ts +10 -0
- package/dist/esm/slices/sliceDialogDestination.d.ts.map +1 -0
- package/dist/esm/slices/sliceDialogDestination.js +38 -0
- package/dist/esm/slices/sliceDialogDestination.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/index.ts +1 -0
- package/navigation/SceneNavigationContext.tsx +3 -0
- package/navigation/SceneNavigationHost.tsx +8 -3
- package/navigation/SceneNavigationState.ts +3 -0
- package/navigation/useSceneHistoryNavigation.ts +2 -1
- package/package.json +5 -5
- package/slices/CoreSliceDialog.tsx +14 -0
- package/slices/InvocationResult.ts +27 -0
- package/slices/InvocationValidationError.ts +13 -0
- package/slices/SliceCommandField.ts +19 -0
- package/slices/SliceCommandFieldsContext.tsx +28 -0
- package/slices/SliceDialogView.tsx +176 -0
- package/slices/SliceInvoker.ts +19 -0
- package/slices/SliceInvokerContext.tsx +47 -0
- package/slices/createAnnouncingInvoker.ts +17 -0
- package/slices/createDryRunInvoker.ts +43 -0
- package/slices/index.ts +14 -0
- package/slices/sliceDialogDestination.ts +40 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationContext.js","sources":["../../../navigation/SceneNavigationContext.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 { ReactNode, createContext, useContext } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference } from '@cratis/scene.model';\nimport { DestinationResolution } from './DestinationResolution';\nimport { DialogResult } from './DialogResult';\n\nexport interface SceneNavigationContextValue {\n /** The screen the last navigation opened. */\n currentScreen: string;\n\n /** The screen in the primary region. */\n primaryScreen: string;\n\n /** Which screen each nested outlet shows, by outlet name. */\n outlets: Record<string, string>;\n currentUrl?: string;\n currentOutlet?: string;\n currentDialog?: string;\n\n /** The route parameters of the current entry - from the destination that opened it, or the deep link. */\n currentParameters: Record<string, string>;\n\n /** What the last dialog returned when it closed. */\n dialogResult?: DialogResult;\n\n /** A deep link that matched no route; the host fell back to its initial screen. */\n unresolvedUrl?: string;\n bindingScope: BindingScope;\n navigate(destination: DestinationReference): DestinationResolution;\n\n /** Closes the open dialog, returning to the entry that opened it, and records its result. */\n closeDialog(result?: unknown): void;\n\n /** Goes back one history entry. */\n back(): void;\n}\n\nconst Context = createContext<SceneNavigationContextValue | undefined>(undefined);\n\n/** The navigation context itself, for components that render outside a host as well as inside one. */\nexport const SceneNavigationContextInternal = Context;\n\nexport interface SceneNavigationProviderProps {\n value: SceneNavigationContextValue;\n children: ReactNode;\n}\n\nexport function SceneNavigationProvider({ value, children }: SceneNavigationProviderProps) {\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\nexport function useSceneNavigation(): SceneNavigationContextValue {\n const context = useContext(Context);\n if (!context) throw new Error('No Scene navigation context is available.');\n return context;\n}\n"],"names":["Context","createContext","undefined","SceneNavigationContextInternal","SceneNavigationProvider","value","children","_jsx","Provider","useSceneNavigation","context","useContext","Error"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SceneNavigationContext.js","sources":["../../../navigation/SceneNavigationContext.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 { ReactNode, createContext, useContext } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference } from '@cratis/scene.model';\nimport { DestinationResolution } from './DestinationResolution';\nimport { DialogResult } from './DialogResult';\n\nexport interface SceneNavigationContextValue {\n /** The screen the last navigation opened. */\n currentScreen: string;\n\n /** The screen in the primary region. */\n primaryScreen: string;\n\n /** Which screen each nested outlet shows, by outlet name. */\n outlets: Record<string, string>;\n currentUrl?: string;\n currentOutlet?: string;\n currentDialog?: string;\n\n /** The parameters the open dialog was opened with - a slice dialog carries its slice, command and title. */\n currentDialogParameters?: Record<string, string>;\n\n /** The route parameters of the current entry - from the destination that opened it, or the deep link. */\n currentParameters: Record<string, string>;\n\n /** What the last dialog returned when it closed. */\n dialogResult?: DialogResult;\n\n /** A deep link that matched no route; the host fell back to its initial screen. */\n unresolvedUrl?: string;\n bindingScope: BindingScope;\n navigate(destination: DestinationReference): DestinationResolution;\n\n /** Closes the open dialog, returning to the entry that opened it, and records its result. */\n closeDialog(result?: unknown): void;\n\n /** Goes back one history entry. */\n back(): void;\n}\n\nconst Context = createContext<SceneNavigationContextValue | undefined>(undefined);\n\n/** The navigation context itself, for components that render outside a host as well as inside one. */\nexport const SceneNavigationContextInternal = Context;\n\nexport interface SceneNavigationProviderProps {\n value: SceneNavigationContextValue;\n children: ReactNode;\n}\n\nexport function SceneNavigationProvider({ value, children }: SceneNavigationProviderProps) {\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\nexport function useSceneNavigation(): SceneNavigationContextValue {\n const context = useContext(Context);\n if (!context) throw new Error('No Scene navigation context is available.');\n return context;\n}\n"],"names":["Context","createContext","undefined","SceneNavigationContextInternal","SceneNavigationProvider","value","children","_jsx","Provider","useSceneNavigation","context","useContext","Error"],"mappings":";;;AA2CA,MAAMA,wBAAUC,aAAAA,CAAuDC,SAAAA,CAAAA;AAEvE,uGACO,MAAMC,8BAAAA,GAAiCH;AAOvC,SAASI,uBAAAA,CAAwB,EAAEC,KAAK,EAAEC,QAAQ,EAAgC,EAAA;IACrF,qBAAOC,GAAA,CAACP,QAAQQ,QAAQ,EAAA;QAACH,KAAAA,EAAOA,KAAAA;AAAQC,QAAAA,QAAAA,EAAAA;;AAC5C;AAEO,SAASG,kBAAAA,GAAAA;AACZ,IAAA,MAAMC,UAAUC,UAAAA,CAAWX,OAAAA,CAAAA;AAC3B,IAAA,IAAI,CAACU,OAAAA,EAAS,MAAM,IAAIE,KAAAA,CAAM,2CAAA,CAAA;IAC9B,OAAOF,OAAAA;AACX;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationHost.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationHost.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"SceneNavigationHost.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationHost.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAMrE,MAAM,WAAW,wBAAwB;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;IAM5B,OAAO,CAAC,EAAE,YAAY,CAAC;IAGvB,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAMtC,eAAe,CAAC,EAAE,oBAAoB,CAAC;IAMvC,KAAK,CAAC,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;IAGtC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAUD,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,OAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,wBAAwB,+BA0B/M"}
|
|
@@ -9,12 +9,15 @@ import { SceneOutletContext } from './SceneOutletContext.js';
|
|
|
9
9
|
import { useSceneHistoryNavigation } from './useSceneHistoryNavigation.js';
|
|
10
10
|
import { SceneNavigationModelProvider } from './region/SceneNavigationModelContext.js';
|
|
11
11
|
import { navigationDestinations } from './region/navigationDestinations.js';
|
|
12
|
+
import { SliceDialogView } from '../slices/SliceDialogView.js';
|
|
13
|
+
import { sliceDialogParameters } from '../slices/sliceDialogDestination.js';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Executes Scene destinations against an in-memory rendered hierarchy: a destination into a nested outlet -
|
|
15
17
|
* one a screen declares with `core:outlet` - places its screen there and keeps the screens above it, to any
|
|
16
18
|
* depth; any other screen route replaces the primary region,
|
|
17
|
-
* dialog destinations render dialog content over the screen that opened them
|
|
19
|
+
* dialog destinations render dialog content over the screen that opened them - a toolbar slice button's dialog falls back to
|
|
20
|
+
* the built-in task dialog (`SliceDialogView`) when `dialogs` has no template of that name -, and external destinations
|
|
18
21
|
* only report their resolved action. Every navigation is a history entry.
|
|
19
22
|
*/ function SceneNavigationHost({ screens, dialogs = {}, initialScreen, registry, bindingScope = {}, history, destinations: authoredDestinations, routes, navigationModel, frame }) {
|
|
20
23
|
const destinations = useMemo(()=>authoredDestinations ?? (navigationModel ? navigationDestinations(navigationModel.structure, navigationModel.navigation, navigationModel.screenFor) : undefined), [
|
|
@@ -40,6 +43,8 @@ import { navigationDestinations } from './region/navigationDestinations.js';
|
|
|
40
43
|
]);
|
|
41
44
|
const screen = screens[value.primaryScreen];
|
|
42
45
|
const dialog = value.currentDialog ? dialogs[value.currentDialog] : undefined;
|
|
46
|
+
const sliceDialog = !dialog && value.currentDialog && sliceDialogParameters(value.currentDialogParameters) !== undefined;
|
|
47
|
+
const dialogName = sliceDialogParameters(value.currentDialogParameters)?.title ?? value.currentDialog;
|
|
43
48
|
const outlet = /*#__PURE__*/ jsx("div", {
|
|
44
49
|
"data-scene-outlet": value.primaryScreen === value.currentScreen ? value.currentOutlet ?? 'primary' : 'primary',
|
|
45
50
|
"data-scene-url": value.currentUrl,
|
|
@@ -57,18 +62,18 @@ import { navigationDestinations } from './region/navigationDestinations.js';
|
|
|
57
62
|
value: outletContext,
|
|
58
63
|
children: [
|
|
59
64
|
frame ? frame(outlet) : outlet,
|
|
60
|
-
dialog && /*#__PURE__*/ jsx("div", {
|
|
65
|
+
(dialog || sliceDialog) && /*#__PURE__*/ jsx("div", {
|
|
61
66
|
role: "dialog",
|
|
62
67
|
"aria-modal": "true",
|
|
63
|
-
"aria-label":
|
|
68
|
+
"aria-label": dialogName,
|
|
64
69
|
"data-scene-dialog": value.currentDialog,
|
|
65
|
-
children: /*#__PURE__*/ jsx(SceneElementView, {
|
|
70
|
+
children: dialog ? /*#__PURE__*/ jsx(SceneElementView, {
|
|
66
71
|
element: dialog,
|
|
67
72
|
registry: registry,
|
|
68
73
|
dataContext: bindingScope.dataContext,
|
|
69
74
|
queryResults: bindingScope.queryResults,
|
|
70
75
|
componentOutputs: bindingScope.componentOutputs
|
|
71
|
-
})
|
|
76
|
+
}) : /*#__PURE__*/ jsx(SliceDialogView, {})
|
|
72
77
|
})
|
|
73
78
|
]
|
|
74
79
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationHost.js","sources":["../../../navigation/SceneNavigationHost.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 { ReactNode, useMemo, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference, SceneElement } from '@cratis/scene.model';\nimport { SceneElementView } from '../SceneElementView';\nimport { ComponentRegistry } from '../renderer';\nimport { createMemorySceneHistory } from './createMemorySceneHistory';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationProvider } from './SceneNavigationContext';\nimport { SceneRoute } from './SceneRoute';\nimport { sceneRoutesFrom } from './sceneRoutesFrom';\nimport { collectOutletOwners } from './collectOutletOwners';\nimport { SceneOutletContext } from './SceneOutletContext';\nimport { useSceneHistoryNavigation } from './useSceneHistoryNavigation';\nimport { SceneNavigationModel } from './region/SceneNavigationModel';\nimport { SceneNavigationModelProvider } from './region/SceneNavigationModelContext';\nimport { navigationDestinations } from './region/navigationDestinations';\n\nexport interface SceneNavigationHostProps {\n screens: Record<string, SceneElement>;\n dialogs?: Record<string, SceneElement>;\n initialScreen: string;\n registry: ComponentRegistry;\n bindingScope?: BindingScope;\n\n /**\n * Where entries are recorded. `createBrowserSceneHistory()` drives the address bar, so deep links,\n * refresh and back/forward work; the default is an in-memory history for embedded hosts.\n */\n history?: SceneHistory;\n\n /** The destinations the application navigates to, so their route overrides can be deep linked. */\n destinations?: DestinationReference[];\n\n /**\n * The application's structure and navigation. Navigation regions rendered inside the host (`NavigationRegionView`) read it,\n * and - when `destinations` is not given - the destinations of every navigation item become the deep-linkable ones.\n */\n navigationModel?: SceneNavigationModel;\n\n /**\n * Wraps the primary outlet in the application's chrome - a topbar, a sidebar, a toolbar. The chrome is part of the host,\n * so it stays mounted while the screens inside it change and navigation regions keep their state.\n */\n frame?(content: ReactNode): ReactNode;\n\n /** An explicit route table, used instead of the one derived from `screens` and `destinations`. */\n routes?: SceneRoute[];\n}\n\n/**\n * Executes Scene destinations against an in-memory rendered hierarchy: a destination into a nested outlet -\n * one a screen declares with `core:outlet` - places its screen there and keeps the screens above it, to any\n * depth; any other screen route replaces the primary region,\n * dialog destinations render dialog content over the screen that opened them
|
|
1
|
+
{"version":3,"file":"SceneNavigationHost.js","sources":["../../../navigation/SceneNavigationHost.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 { ReactNode, useMemo, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference, SceneElement } from '@cratis/scene.model';\nimport { SceneElementView } from '../SceneElementView';\nimport { ComponentRegistry } from '../renderer';\nimport { createMemorySceneHistory } from './createMemorySceneHistory';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationProvider } from './SceneNavigationContext';\nimport { SceneRoute } from './SceneRoute';\nimport { sceneRoutesFrom } from './sceneRoutesFrom';\nimport { collectOutletOwners } from './collectOutletOwners';\nimport { SceneOutletContext } from './SceneOutletContext';\nimport { useSceneHistoryNavigation } from './useSceneHistoryNavigation';\nimport { SceneNavigationModel } from './region/SceneNavigationModel';\nimport { SceneNavigationModelProvider } from './region/SceneNavigationModelContext';\nimport { navigationDestinations } from './region/navigationDestinations';\nimport { SliceDialogView } from '../slices/SliceDialogView';\nimport { sliceDialogParameters } from '../slices/sliceDialogDestination';\n\nexport interface SceneNavigationHostProps {\n screens: Record<string, SceneElement>;\n dialogs?: Record<string, SceneElement>;\n initialScreen: string;\n registry: ComponentRegistry;\n bindingScope?: BindingScope;\n\n /**\n * Where entries are recorded. `createBrowserSceneHistory()` drives the address bar, so deep links,\n * refresh and back/forward work; the default is an in-memory history for embedded hosts.\n */\n history?: SceneHistory;\n\n /** The destinations the application navigates to, so their route overrides can be deep linked. */\n destinations?: DestinationReference[];\n\n /**\n * The application's structure and navigation. Navigation regions rendered inside the host (`NavigationRegionView`) read it,\n * and - when `destinations` is not given - the destinations of every navigation item become the deep-linkable ones.\n */\n navigationModel?: SceneNavigationModel;\n\n /**\n * Wraps the primary outlet in the application's chrome - a topbar, a sidebar, a toolbar. The chrome is part of the host,\n * so it stays mounted while the screens inside it change and navigation regions keep their state.\n */\n frame?(content: ReactNode): ReactNode;\n\n /** An explicit route table, used instead of the one derived from `screens` and `destinations`. */\n routes?: SceneRoute[];\n}\n\n/**\n * Executes Scene destinations against an in-memory rendered hierarchy: a destination into a nested outlet -\n * one a screen declares with `core:outlet` - places its screen there and keeps the screens above it, to any\n * depth; any other screen route replaces the primary region,\n * dialog destinations render dialog content over the screen that opened them - a toolbar slice button's dialog falls back to\n * the built-in task dialog (`SliceDialogView`) when `dialogs` has no template of that name -, and external destinations\n * only report their resolved action. Every navigation is a history entry.\n */\nexport function SceneNavigationHost({ screens, dialogs = {}, initialScreen, registry, bindingScope = {}, history, destinations: authoredDestinations, routes, navigationModel, frame }: SceneNavigationHostProps) {\n const destinations = useMemo(\n () => authoredDestinations ?? (navigationModel ? navigationDestinations(navigationModel.structure, navigationModel.navigation, navigationModel.screenFor) : undefined),\n [authoredDestinations, navigationModel]);\n const [memoryHistory] = useState(() => createMemorySceneHistory());\n const routeTable = useMemo(() => routes ?? sceneRoutesFrom(Object.keys(screens), destinations), [destinations, routes, screens]);\n const outletOwners = useMemo(() => collectOutletOwners(screens), [screens]);\n const value = useSceneHistoryNavigation(history ?? memoryHistory, routeTable, initialScreen, bindingScope, outletOwners, destinations);\n const outletContext = useMemo(() => ({ screens, registry }), [registry, screens]);\n\n const screen = screens[value.primaryScreen];\n const dialog = value.currentDialog ? dialogs[value.currentDialog] : undefined;\n const sliceDialog = !dialog && value.currentDialog && sliceDialogParameters(value.currentDialogParameters) !== undefined;\n const dialogName = sliceDialogParameters(value.currentDialogParameters)?.title ?? value.currentDialog;\n\n const outlet = <div data-scene-outlet={value.primaryScreen === value.currentScreen ? value.currentOutlet ?? 'primary' : 'primary'} data-scene-url={value.currentUrl}>\n {screen && <SceneElementView element={screen} registry={registry} dataContext={bindingScope.dataContext} queryResults={bindingScope.queryResults} componentOutputs={bindingScope.componentOutputs} />}\n </div>;\n const page = <SceneNavigationProvider value={value}><SceneOutletContext.Provider value={outletContext}>\n {frame ? frame(outlet) : outlet}\n {(dialog || sliceDialog) && <div role='dialog' aria-modal='true' aria-label={dialogName} data-scene-dialog={value.currentDialog}>\n {dialog ? <SceneElementView element={dialog} registry={registry} dataContext={bindingScope.dataContext} queryResults={bindingScope.queryResults} componentOutputs={bindingScope.componentOutputs} /> : <SliceDialogView />}\n </div>}\n </SceneOutletContext.Provider></SceneNavigationProvider>;\n\n return navigationModel ? <SceneNavigationModelProvider model={navigationModel}>{page}</SceneNavigationModelProvider> : page;\n}\n"],"names":["SceneNavigationHost","screens","dialogs","initialScreen","registry","bindingScope","history","destinations","authoredDestinations","routes","navigationModel","frame","useMemo","navigationDestinations","structure","navigation","screenFor","undefined","memoryHistory","useState","createMemorySceneHistory","routeTable","sceneRoutesFrom","Object","keys","outletOwners","collectOutletOwners","value","useSceneHistoryNavigation","outletContext","screen","primaryScreen","dialog","currentDialog","sliceDialog","sliceDialogParameters","currentDialogParameters","dialogName","title","outlet","_jsx","div","data-scene-outlet","currentScreen","currentOutlet","data-scene-url","currentUrl","SceneElementView","element","dataContext","queryResults","componentOutputs","page","SceneNavigationProvider","_jsxs","SceneOutletContext","Provider","role","aria-modal","aria-label","data-scene-dialog","SliceDialogView","SceneNavigationModelProvider","model"],"mappings":";;;;;;;;;;;;;;AAsDA;;;;;;;AAOC,IACM,SAASA,mBAAAA,CAAoB,EAAEC,OAAO,EAAEC,OAAAA,GAAU,EAAE,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,YAAAA,GAAe,EAAE,EAAEC,OAAO,EA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A,iBAASQ,GAAA,CAACO,gBAAAA,EAAAA;wBAAiBC,OAAAA,EAAShB,MAAAA;wBAAQ5B,QAAAA,EAAUA,QAAAA;AAAU6C,wBAAAA,WAAAA,EAAa5C,aAAa4C,WAAW;AAAEC,wBAAAA,YAAAA,EAAc7C,aAAa6C,YAAY;AAAEC,wBAAAA,gBAAAA,EAAkB9C,aAAa8C;uCAAuBX,GAAA,CAACqB,eAAAA,EAAAA,EAAAA;;;;;AAIhN,IAAA,OAAOnD,gCAAkB8B,GAAA,CAACsB,4BAAAA,EAAAA;QAA6BC,KAAAA,EAAOrD,eAAAA;AAAkB0C,QAAAA,QAAAA,EAAAA;AAAuCA,KAAAA,CAAAA,GAAAA,IAAAA;AAC3H;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationState.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationState.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,oBAAoB;IAEjC,MAAM,EAAE,MAAM,CAAC;IAMf,OAAO,CAAC,EAAE,MAAM,CAAC;IAMjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC"}
|
|
1
|
+
{"version":3,"file":"SceneNavigationState.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationState.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,oBAAoB;IAEjC,MAAM,EAAE,MAAM,CAAC;IAMf,OAAO,CAAC,EAAE,MAAM,CAAC;IAMjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG1C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSceneHistoryNavigation.d.ts","sourceRoot":"","sources":["../../../navigation/useSceneHistoryNavigation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,UAAU,EAAE,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,YAAY,EAC1B,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACzC,YAAY,GAAE,oBAAoB,EAAO,GAC1C,2BAA2B,
|
|
1
|
+
{"version":3,"file":"useSceneHistoryNavigation.d.ts","sourceRoot":"","sources":["../../../navigation/useSceneHistoryNavigation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,UAAU,EAAE,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,YAAY,EAC1B,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACzC,YAAY,GAAE,oBAAoB,EAAO,GAC1C,2BAA2B,CAoE7B"}
|
|
@@ -65,7 +65,8 @@ import { resolveDestination } from './resolveDestination.js';
|
|
|
65
65
|
if (resolution.kind === DestinationKind.Dialog) {
|
|
66
66
|
if (resolution.dialog) go({
|
|
67
67
|
...state,
|
|
68
|
-
dialog: resolution.dialog
|
|
68
|
+
dialog: resolution.dialog,
|
|
69
|
+
dialogParameters: resolution.parameters
|
|
69
70
|
});
|
|
70
71
|
} else if (resolution.kind !== DestinationKind.External) {
|
|
71
72
|
const screen = destination.screen ?? destination.slice ?? state.screen;
|
|
@@ -104,6 +105,7 @@ import { resolveDestination } from './resolveDestination.js';
|
|
|
104
105
|
currentUrl: state.url,
|
|
105
106
|
currentOutlet: state.outlet,
|
|
106
107
|
currentDialog: state.dialog,
|
|
108
|
+
currentDialogParameters: state.dialogParameters,
|
|
107
109
|
currentParameters: state.parameters,
|
|
108
110
|
dialogResult,
|
|
109
111
|
unresolvedUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSceneHistoryNavigation.js","sources":["../../../navigation/useSceneHistoryNavigation.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 { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { DialogResult } from './DialogResult';\nimport { matchSceneRoute } from './matchSceneRoute';\nimport { placeInOutlet } from './placeInOutlet';\nimport { resolveDestination } from './resolveDestination';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationContextValue } from './SceneNavigationContext';\nimport { SceneNavigationState } from './SceneNavigationState';\nimport { SceneRoute } from './SceneRoute';\n\n/**\n * Keeps a navigation host's state in a {@link SceneHistory}: every navigation and every dialog is an entry,\n * so back and forward step through them, a refresh restores the stored entry, and a deep link is matched\n * against the route table. Closing a dialog goes back to the entry that opened it.\n */\nexport function useSceneHistoryNavigation(\n history: SceneHistory,\n routes: SceneRoute[],\n initialScreen: string,\n bindingScope: BindingScope,\n outletOwners: Record<string, string> = {},\n destinations: DestinationReference[] = [],\n): SceneNavigationContextValue {\n const fromLocation = useCallback((url: string | undefined): SceneNavigationState | undefined => {\n const match = url ? matchSceneRoute(url, routes) : undefined;\n if (!match) return undefined;\n const start: SceneNavigationState = { screen: initialScreen, parameters: {} };\n const placement = placeInOutlet(start, match.route.screen, match.route.outlet, outletOwners, destinations);\n return { screen: match.route.screen, url, outlet: match.route.outlet, parameters: match.parameters, ...placement };\n }, [destinations, initialScreen, outletOwners, routes]);\n const fallback = useMemo<SceneNavigationState>(() => ({ screen: initialScreen, url: initialScreen, parameters: {} }), [initialScreen]);\n\n const [unresolvedUrl] = useState(() => {\n const url = history.location();\n return !history.state() && url && !fromLocation(url) ? url : undefined;\n });\n const [state, setState] = useState<SceneNavigationState>(() => history.state() ?? fromLocation(history.location()) ?? fallback);\n const [dialogResult, setDialogResult] = useState<DialogResult>();\n\n // Back and forward restore the stored entry, or match a URL the host never wrote against the current routes.\n const restore = useRef((url: string | undefined, stored: SceneNavigationState | undefined) => stored ?? fromLocation(url) ?? fallback);\n restore.current = (url, stored) => stored ?? fromLocation(url) ?? fallback;\n const initialState = useRef(state);\n\n // The current entry is written once, when a history is attached; later entries are written by navigate.\n useEffect(() => {\n history.replace(initialState.current);\n return history.listen((url, stored) => setState(restore.current(url, stored)));\n }, [history]);\n\n const go = useCallback((next: SceneNavigationState) => {\n history.push(next);\n setState(next);\n }, [history]);\n\n const navigate = useCallback((destination: DestinationReference) => {\n const resolution = resolveDestination(destination, bindingScope);\n if (resolution.kind === DestinationKind.Dialog) {\n if (resolution.dialog) go({ ...state, dialog: resolution.dialog });\n } else if (resolution.kind !== DestinationKind.External) {\n const screen = destination.screen ?? destination.slice ?? state.screen;\n const placement = placeInOutlet(state, screen, resolution.outlet, outletOwners, destinations);\n go({ screen, url: resolution.url, outlet: resolution.outlet, parameters: resolution.parameters, ...placement });\n }\n\n return resolution;\n }, [bindingScope, destinations, go, outletOwners, state]);\n\n const closeDialog = useCallback((result?: unknown) => {\n if (!state.dialog) return;\n setDialogResult({ dialog: state.dialog, result });\n history.back();\n }, [history, state.dialog]);\n\n return useMemo(() => ({\n currentScreen: state.screen,\n primaryScreen: state.primary ?? state.screen,\n outlets: state.outlets ?? {},\n currentUrl: state.url,\n currentOutlet: state.outlet,\n currentDialog: state.dialog,\n currentParameters: state.parameters,\n dialogResult,\n unresolvedUrl,\n bindingScope,\n navigate,\n closeDialog,\n back: () => history.back(),\n }), [bindingScope, closeDialog, dialogResult, history, navigate, state, unresolvedUrl]);\n}\n"],"names":["useSceneHistoryNavigation","history","routes","initialScreen","bindingScope","outletOwners","destinations","fromLocation","useCallback","url","match","matchSceneRoute","undefined","start","screen","placement","placeInOutlet","route","outlet","parameters","fallback","useMemo","unresolvedUrl","useState","location","state","setState","dialogResult","setDialogResult","restore","useRef","stored","current","initialState","useEffect","replace","listen","go","next","push","navigate","destination","resolution","resolveDestination","kind","DestinationKind","Dialog","dialog","External","slice","closeDialog","result","back","currentScreen","primaryScreen","primary","outlets","currentUrl","currentOutlet","currentDialog","currentParameters"],"mappings":";;;;;;AAAA;AACA;AAcA;;;;AAIC,IACM,SAASA,yBAAAA,CACZC,OAAqB,EACrBC,MAAoB,EACpBC,aAAqB,EACrBC,YAA0B,EAC1BC,YAAAA,GAAuC,EAAE,EACzCC,eAAuC,EAAE,EAAA;IAEzC,MAAMC,YAAAA,GAAeC,YAAY,CAACC,GAAAA,GAAAA;AAC9B,QAAA,MAAMC,KAAAA,GAAQD,GAAAA,GAAME,eAAAA,CAAgBF,GAAAA,EAAKP,MAAAA,CAAAA,GAAUU,SAAAA;QACnD,IAAI,CAACF,O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ation.js","sources":["../../../navigation/useSceneHistoryNavigation.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 { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { DialogResult } from './DialogResult';\nimport { matchSceneRoute } from './matchSceneRoute';\nimport { placeInOutlet } from './placeInOutlet';\nimport { resolveDestination } from './resolveDestination';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationContextValue } from './SceneNavigationContext';\nimport { SceneNavigationState } from './SceneNavigationState';\nimport { SceneRoute } from './SceneRoute';\n\n/**\n * Keeps a navigation host's state in a {@link SceneHistory}: every navigation and every dialog is an entry,\n * so back and forward step through them, a refresh restores the stored entry, and a deep link is matched\n * against the route table. Closing a dialog goes back to the entry that opened it.\n */\nexport function useSceneHistoryNavigation(\n history: SceneHistory,\n routes: SceneRoute[],\n initialScreen: string,\n bindingScope: BindingScope,\n outletOwners: Record<string, string> = {},\n destinations: DestinationReference[] = [],\n): SceneNavigationContextValue {\n const fromLocation = useCallback((url: string | undefined): SceneNavigationState | undefined => {\n const match = url ? matchSceneRoute(url, routes) : undefined;\n if (!match) return undefined;\n const start: SceneNavigationState = { screen: initialScreen, parameters: {} };\n const placement = placeInOutlet(start, match.route.screen, match.route.outlet, outletOwners, destinations);\n return { screen: match.route.screen, url, outlet: match.route.outlet, parameters: match.parameters, ...placement };\n }, [destinations, initialScreen, outletOwners, routes]);\n const fallback = useMemo<SceneNavigationState>(() => ({ screen: initialScreen, url: initialScreen, parameters: {} }), [initialScreen]);\n\n const [unresolvedUrl] = useState(() => {\n const url = history.location();\n return !history.state() && url && !fromLocation(url) ? url : undefined;\n });\n const [state, setState] = useState<SceneNavigationState>(() => history.state() ?? fromLocation(history.location()) ?? fallback);\n const [dialogResult, setDialogResult] = useState<DialogResult>();\n\n // Back and forward restore the stored entry, or match a URL the host never wrote against the current routes.\n const restore = useRef((url: string | undefined, stored: SceneNavigationState | undefined) => stored ?? fromLocation(url) ?? fallback);\n restore.current = (url, stored) => stored ?? fromLocation(url) ?? fallback;\n const initialState = useRef(state);\n\n // The current entry is written once, when a history is attached; later entries are written by navigate.\n useEffect(() => {\n history.replace(initialState.current);\n return history.listen((url, stored) => setState(restore.current(url, stored)));\n }, [history]);\n\n const go = useCallback((next: SceneNavigationState) => {\n history.push(next);\n setState(next);\n }, [history]);\n\n const navigate = useCallback((destination: DestinationReference) => {\n const resolution = resolveDestination(destination, bindingScope);\n if (resolution.kind === DestinationKind.Dialog) {\n if (resolution.dialog) go({ ...state, dialog: resolution.dialog, dialogParameters: resolution.parameters });\n } else if (resolution.kind !== DestinationKind.External) {\n const screen = destination.screen ?? destination.slice ?? state.screen;\n const placement = placeInOutlet(state, screen, resolution.outlet, outletOwners, destinations);\n go({ screen, url: resolution.url, outlet: resolution.outlet, parameters: resolution.parameters, ...placement });\n }\n\n return resolution;\n }, [bindingScope, destinations, go, outletOwners, state]);\n\n const closeDialog = useCallback((result?: unknown) => {\n if (!state.dialog) return;\n setDialogResult({ dialog: state.dialog, result });\n history.back();\n }, [history, state.dialog]);\n\n return useMemo(() => ({\n currentScreen: state.screen,\n primaryScreen: state.primary ?? state.screen,\n outlets: state.outlets ?? {},\n currentUrl: state.url,\n currentOutlet: state.outlet,\n currentDialog: state.dialog,\n currentDialogParameters: state.dialogParameters,\n currentParameters: state.parameters,\n dialogResult,\n unresolvedUrl,\n bindingScope,\n navigate,\n closeDialog,\n back: () => history.back(),\n }), [bindingScope, closeDialog, dialogResult, history, navigate, state, unresolvedUrl]);\n}\n"],"names":["useSceneHistoryNavigation","history","routes","initialScreen","bindingScope","outletOwners","destinations","fromLocation","useCallback","url","match","matchSceneRoute","undefined","start","screen","placement","placeInOutlet","route","outlet","parameters","fallback","useMemo","unresolvedUrl","useState","location","state","setState","dialogResult","setDialogResult","restore","useRef","stored","current","initialState","useEffect","replace","listen","go","next","push","navigate","destination","resolution","resolveDestination","kind","DestinationKind","Dialog","dialog","dialogParameters","External","slice","closeDialog","result","back","currentScreen","primaryScreen","primary","outlets","currentUrl","currentOutlet","currentDialog","currentDialogParameters","currentParameters"],"mappings":";;;;;;AAAA;AACA;AAcA;;;;AAIC,IACM,SAASA,yBAAAA,CACZC,OAAqB,EACrBC,MAAoB,EACpBC,aAAqB,EACrBC,YAA0B,EAC1BC,YAAAA,GAAuC,EAAE,EACzCC,eAAuC,EAAE,EAAA;IAEzC,MAAMC,YAAAA,GAAeC,YAAY,CAACC,GAAAA,GAAAA;AAC9B,QAAA,MAAMC,KAAAA,GAAQD,GAAAA,GAAME,eAAAA,CAAgBF,GAAAA,EAAKP,MAAAA,CAAAA,GAAUU,SAAAA;QACnD,IAAI,CAACF,OAAO,OAAOE,SAAAA;AACnB,QAAA,MAAMC,KAAAA,GAA8B;YAAEC,MAAAA,EAAQX,aAA8B,CAAA;AAC5E,QAAA,MAAMY,SAAAA,GAAYC,aAAAA,CAAcH,KAAAA,EAAOH,KAAAA,CAAMO,KAAK,CAACH,MAAM,EAAEJ,KAAAA,CAAMO,KAAK,CAACC,MAAM,EAAEb,YAAAA,EAAcC,YAAAA,CAAAA;QAC7F,OAAO;YAAEQ,MAAAA,EAAQJ,KAAAA,CAAMO,KAAK,CAACH,MAAM;AAAEL,YAAAA,GAAAA;YAAKS,MAAAA,EAAQR,KAAAA,CAAMO,KAAK,CAACC,MAAM;AAAEC,YAAAA,UAAAA,EAAYT,MAAMS,UAAU;AAAE,YAAA,GAAGJ;AAAU,SAAA;IACrH,CAAA,EAAG;AAACT,QAAAA,YAAAA;AAAcH,QAAAA,aAAAA;AAAeE,QAAAA,YAAAA;AAAcH,QAAAA;AAAO,KAAA,CAAA;IACtD,MAAMkB,QAAAA,GAAWC,OAAAA,CAA8B,KAAO;YAAEP,MAAAA,EAAQX,aAAAA;YAAeM,GAAAA,EAAKN,aAAAA;AAAegB,YAAAA,UAAAA,EAAY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CoreSliceDialog.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAOvD,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAGpE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { SliceDialogView } from './SliceDialogView.js';
|
|
3
|
+
|
|
4
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
5
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
6
|
+
/**
|
|
7
|
+
* The `core:sliceDialog` component: the task dialog of a state change slice. Its `slice`, `command` and `title` properties are
|
|
8
|
+
* optional - opened from a toolbar button the dialog's own parameters supply them - so one dialog template serves every slice.
|
|
9
|
+
*/ function CoreSliceDialog({ element }) {
|
|
10
|
+
const text = (name)=>typeof element.properties[name] === 'string' ? element.properties[name] : undefined;
|
|
11
|
+
return /*#__PURE__*/ jsx(SliceDialogView, {
|
|
12
|
+
slice: text('slice'),
|
|
13
|
+
command: text('command'),
|
|
14
|
+
title: text('title')
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { CoreSliceDialog };
|
|
19
|
+
//# sourceMappingURL=CoreSliceDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreSliceDialog.js","sources":["../../../slices/CoreSliceDialog.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 { RegisteredComponentProps } from '../renderer';\nimport { SliceDialogView } from './SliceDialogView';\n\n/**\n * The `core:sliceDialog` component: the task dialog of a state change slice. Its `slice`, `command` and `title` properties are\n * optional - opened from a toolbar button the dialog's own parameters supply them - so one dialog template serves every slice.\n */\nexport function CoreSliceDialog({ element }: RegisteredComponentProps) {\n const text = (name: string) => typeof element.properties[name] === 'string' ? element.properties[name] as string : undefined;\n return <SliceDialogView slice={text('slice')} command={text('command')} title={text('title')} />;\n}\n"],"names":["CoreSliceDialog","element","text","name","properties","undefined","_jsx","SliceDialogView","slice","command","title"],"mappings":";;;AAAA;AACA;AAKA;;;AAGC,IACM,SAASA,eAAAA,CAAgB,EAAEC,OAAO,EAA4B,EAAA;AACjE,IAAA,MAAMC,IAAAA,GAAO,CAACC,IAAAA,GAAiB,OAAOF,QAAQG,UAAU,CAACD,IAAAA,CAAK,KAAK,QAAA,GAAWF,OAAAA,CAAQG,UAAU,CAACD,KAAK,GAAaE,SAAAA;AACnH,IAAA,qBAAOC,GAAA,CAACC,eAAAA,EAAAA;AAAgBC,QAAAA,KAAAA,EAAON,IAAAA,CAAK,OAAA,CAAA;AAAUO,QAAAA,OAAAA,EAASP,IAAAA,CAAK,SAAA,CAAA;AAAYQ,QAAAA,KAAAA,EAAOR,IAAAA,CAAK,OAAA;;AACxF;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InvocationValidationError } from './InvocationValidationError';
|
|
2
|
+
export interface InvocationResult {
|
|
3
|
+
succeeded: boolean;
|
|
4
|
+
validationErrors?: InvocationValidationError[];
|
|
5
|
+
message?: string;
|
|
6
|
+
payload?: Record<string, unknown>;
|
|
7
|
+
dryRun?: boolean;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=InvocationResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvocationResult.d.ts","sourceRoot":"","sources":["../../../slices/InvocationResult.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAKxE,MAAM,WAAW,gBAAgB;IAE7B,SAAS,EAAE,OAAO,CAAC;IAGnB,gBAAgB,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAG/C,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGlC,MAAM,CAAC,EAAE,OAAO,CAAC;IAGjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvocationResult.js","sourceRoot":"","sources":["../../../slices/InvocationResult.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvocationValidationError.d.ts","sourceRoot":"","sources":["../../../slices/InvocationValidationError.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,yBAAyB;IAEtC,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvocationValidationError.js","sourceRoot":"","sources":["../../../slices/InvocationValidationError.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceCommandField.d.ts","sourceRoot":"","sources":["../../../slices/SliceCommandField.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAE9B,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceCommandField.js","sourceRoot":"","sources":["../../../slices/SliceCommandField.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SliceCommandField } from './SliceCommandField';
|
|
3
|
+
export type SliceCommandFieldsSource = (command: string, sliceId: string) => SliceCommandField[];
|
|
4
|
+
export interface SliceCommandFieldsProviderProps {
|
|
5
|
+
fieldsFor: SliceCommandFieldsSource;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function SliceCommandFieldsProvider({ fieldsFor, children }: SliceCommandFieldsProviderProps): import("react").JSX.Element;
|
|
9
|
+
export declare function useSliceCommandFields(): SliceCommandFieldsSource | undefined;
|
|
10
|
+
//# sourceMappingURL=SliceCommandFieldsContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceCommandFieldsContext.d.ts","sourceRoot":"","sources":["../../../slices/SliceCommandFieldsContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,iBAAiB,EAAE,CAAC;AAIjG,MAAM,WAAW,+BAA+B;IAC5C,SAAS,EAAE,wBAAwB,CAAC;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAMD,wBAAgB,0BAA0B,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,+BAA+B,+BAElG;AAGD,wBAAgB,qBAAqB,IAAI,wBAAwB,GAAG,SAAS,CAE5E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, createContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const Context = /*#__PURE__*/ createContext(undefined);
|
|
5
|
+
/**
|
|
6
|
+
* Supplies the fields of a command to the task dialogs below it. The fields come from the command's metadata - Stage reads it
|
|
7
|
+
* from the generated schemas, Studio from the model - so this package does not know where commands are defined.
|
|
8
|
+
*/ function SliceCommandFieldsProvider({ fieldsFor, children }) {
|
|
9
|
+
return /*#__PURE__*/ jsx(Context.Provider, {
|
|
10
|
+
value: fieldsFor,
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/** The fields source in scope, or undefined when a host supplied none. */ function useSliceCommandFields() {
|
|
15
|
+
return useContext(Context);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { SliceCommandFieldsProvider, useSliceCommandFields };
|
|
19
|
+
//# sourceMappingURL=SliceCommandFieldsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceCommandFieldsContext.js","sources":["../../../slices/SliceCommandFieldsContext.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 { ReactNode, createContext, useContext } from 'react';\nimport { SliceCommandField } from './SliceCommandField';\n\n/** Tells a task dialog which fields a command has. */\nexport type SliceCommandFieldsSource = (command: string, sliceId: string) => SliceCommandField[];\n\nconst Context = createContext<SliceCommandFieldsSource | undefined>(undefined);\n\nexport interface SliceCommandFieldsProviderProps {\n fieldsFor: SliceCommandFieldsSource;\n children?: ReactNode;\n}\n\n/**\n * Supplies the fields of a command to the task dialogs below it. The fields come from the command's metadata - Stage reads it\n * from the generated schemas, Studio from the model - so this package does not know where commands are defined.\n */\nexport function SliceCommandFieldsProvider({ fieldsFor, children }: SliceCommandFieldsProviderProps) {\n return <Context.Provider value={fieldsFor}>{children}</Context.Provider>;\n}\n\n/** The fields source in scope, or undefined when a host supplied none. */\nexport function useSliceCommandFields(): SliceCommandFieldsSource | undefined {\n return useContext(Context);\n}\n"],"names":["Context","createContext","undefined","SliceCommandFieldsProvider","fieldsFor","children","_jsx","Provider","value","useSliceCommandFields","useContext"],"mappings":";;;AASA,MAAMA,wBAAUC,aAAAA,CAAoDC,SAAAA,CAAAA;AAOpE;;;AAGC,IACM,SAASC,0BAAAA,CAA2B,EAAEC,SAAS,EAAEC,QAAQ,EAAmC,EAAA;IAC/F,qBAAOC,GAAA,CAACN,QAAQO,QAAQ,EAAA;QAACC,KAAAA,EAAOJ,SAAAA;AAAYC,QAAAA,QAAAA,EAAAA;;AAChD;AAEA,2EACO,SAASI,qBAAAA,GAAAA;AACZ,IAAA,OAAOC,UAAAA,CAAWV,OAAAA,CAAAA;AACtB;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InvocationResult } from './InvocationResult';
|
|
2
|
+
import { SliceCommandField } from './SliceCommandField';
|
|
3
|
+
export interface SliceDialogViewProps {
|
|
4
|
+
slice?: string;
|
|
5
|
+
command?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
onClose?(result?: InvocationResult): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function sliceFieldLabel(field: SliceCommandField): string;
|
|
10
|
+
export declare function slicePayload(fields: SliceCommandField[], values: Record<string, string | boolean>): Record<string, unknown>;
|
|
11
|
+
export declare function SliceDialogView({ slice: sliceProp, command: commandProp, title: titleProp, onClose }: SliceDialogViewProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=SliceDialogView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliceDialogView.d.ts","sourceRoot":"","sources":["../../../slices/SliceDialogView.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,oBAAoB;IAEjC,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC7C;AAKD,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAIhE;AAYD,wBAAgB,YAAY,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAW3H;AAeD,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,oBAAoB,+BAsG1H"}
|