@cratis/scene.react 4.16.0 → 4.17.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/coreComponents.ts +2 -0
- package/core/coreDescriptors.ts +6 -0
- package/core/corePackage.ts +1 -0
- package/dist/cjs/core/coreComponents.js +3 -1
- package/dist/cjs/core/coreComponents.js.map +1 -1
- package/dist/cjs/core/coreDescriptors.js +16 -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 +11 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/CoreOutlet.js +32 -0
- package/dist/cjs/navigation/CoreOutlet.js.map +1 -0
- package/dist/cjs/navigation/SceneNavigationContext.js +2 -0
- package/dist/cjs/navigation/SceneNavigationContext.js.map +1 -1
- package/dist/cjs/navigation/SceneNavigationHost.js +46 -29
- package/dist/cjs/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/cjs/navigation/SceneOutletContext.js +14 -0
- package/dist/cjs/navigation/SceneOutletContext.js.map +1 -0
- package/dist/cjs/navigation/collectOutletOwners.js +36 -0
- package/dist/cjs/navigation/collectOutletOwners.js.map +1 -0
- package/dist/cjs/navigation/placeInOutlet.js +65 -0
- package/dist/cjs/navigation/placeInOutlet.js.map +1 -0
- package/dist/cjs/navigation/useSceneHistoryNavigation.js +22 -6
- package/dist/cjs/navigation/useSceneHistoryNavigation.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 +16 -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.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/navigation/CoreOutlet.d.ts +3 -0
- package/dist/esm/navigation/CoreOutlet.d.ts.map +1 -0
- package/dist/esm/navigation/CoreOutlet.js +30 -0
- package/dist/esm/navigation/CoreOutlet.js.map +1 -0
- package/dist/esm/navigation/SceneNavigationContext.d.ts +3 -0
- package/dist/esm/navigation/SceneNavigationContext.d.ts.map +1 -1
- package/dist/esm/navigation/SceneNavigationContext.js +3 -2
- 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 +47 -30
- package/dist/esm/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/esm/navigation/SceneNavigationState.d.ts +2 -0
- package/dist/esm/navigation/SceneNavigationState.d.ts.map +1 -1
- package/dist/esm/navigation/SceneOutletContext.d.ts +9 -0
- package/dist/esm/navigation/SceneOutletContext.d.ts.map +1 -0
- package/dist/esm/navigation/SceneOutletContext.js +11 -0
- package/dist/esm/navigation/SceneOutletContext.js.map +1 -0
- package/dist/esm/navigation/collectOutletOwners.d.ts +4 -0
- package/dist/esm/navigation/collectOutletOwners.d.ts.map +1 -0
- package/dist/esm/navigation/collectOutletOwners.js +33 -0
- package/dist/esm/navigation/collectOutletOwners.js.map +1 -0
- package/dist/esm/navigation/index.d.ts +4 -0
- package/dist/esm/navigation/index.d.ts.map +1 -1
- package/dist/esm/navigation/index.js +4 -0
- package/dist/esm/navigation/index.js.map +1 -1
- package/dist/esm/navigation/placeInOutlet.d.ts +4 -0
- package/dist/esm/navigation/placeInOutlet.d.ts.map +1 -0
- package/dist/esm/navigation/placeInOutlet.js +63 -0
- package/dist/esm/navigation/placeInOutlet.js.map +1 -0
- package/dist/esm/navigation/useSceneHistoryNavigation.d.ts +2 -1
- package/dist/esm/navigation/useSceneHistoryNavigation.d.ts.map +1 -1
- package/dist/esm/navigation/useSceneHistoryNavigation.js +22 -6
- package/dist/esm/navigation/useSceneHistoryNavigation.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/navigation/CoreOutlet.tsx +26 -0
- package/navigation/SceneNavigationContext.tsx +10 -0
- package/navigation/SceneNavigationHost.tsx +12 -6
- package/navigation/SceneNavigationState.ts +13 -0
- package/navigation/SceneOutletContext.tsx +19 -0
- package/navigation/collectOutletOwners.ts +30 -0
- package/navigation/index.ts +4 -0
- package/navigation/placeInOutlet.ts +68 -0
- package/navigation/useSceneHistoryNavigation.ts +20 -5
- package/package.json +5 -5
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var scene_model = require('@cratis/scene.model');
|
|
5
5
|
var matchSceneRoute = require('./matchSceneRoute.js');
|
|
6
|
+
var placeInOutlet = require('./placeInOutlet.js');
|
|
6
7
|
var resolveDestination = require('./resolveDestination.js');
|
|
7
8
|
|
|
8
9
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -11,16 +12,24 @@ var resolveDestination = require('./resolveDestination.js');
|
|
|
11
12
|
* Keeps a navigation host's state in a {@link SceneHistory}: every navigation and every dialog is an entry,
|
|
12
13
|
* so back and forward step through them, a refresh restores the stored entry, and a deep link is matched
|
|
13
14
|
* against the route table. Closing a dialog goes back to the entry that opened it.
|
|
14
|
-
*/ function useSceneHistoryNavigation(history, routes, initialScreen, bindingScope) {
|
|
15
|
+
*/ function useSceneHistoryNavigation(history, routes, initialScreen, bindingScope, outletOwners = {}, destinations = []) {
|
|
15
16
|
const fromLocation = react.useCallback((url)=>{
|
|
16
17
|
const match = url ? matchSceneRoute.matchSceneRoute(url, routes) : undefined;
|
|
17
|
-
|
|
18
|
+
if (!match) return undefined;
|
|
19
|
+
const start = {
|
|
20
|
+
screen: initialScreen};
|
|
21
|
+
const placement = placeInOutlet.placeInOutlet(start, match.route.screen, match.route.outlet, outletOwners, destinations);
|
|
22
|
+
return {
|
|
18
23
|
screen: match.route.screen,
|
|
19
24
|
url,
|
|
20
25
|
outlet: match.route.outlet,
|
|
21
|
-
parameters: match.parameters
|
|
22
|
-
|
|
26
|
+
parameters: match.parameters,
|
|
27
|
+
...placement
|
|
28
|
+
};
|
|
23
29
|
}, [
|
|
30
|
+
destinations,
|
|
31
|
+
initialScreen,
|
|
32
|
+
outletOwners,
|
|
24
33
|
routes
|
|
25
34
|
]);
|
|
26
35
|
const fallback = react.useMemo(()=>({
|
|
@@ -61,17 +70,22 @@ var resolveDestination = require('./resolveDestination.js');
|
|
|
61
70
|
dialog: resolution.dialog
|
|
62
71
|
});
|
|
63
72
|
} else if (resolution.kind !== scene_model.DestinationKind.External) {
|
|
73
|
+
const screen = destination.screen ?? destination.slice ?? state.screen;
|
|
74
|
+
const placement = placeInOutlet.placeInOutlet(state, screen, resolution.outlet, outletOwners, destinations);
|
|
64
75
|
go({
|
|
65
|
-
screen
|
|
76
|
+
screen,
|
|
66
77
|
url: resolution.url,
|
|
67
78
|
outlet: resolution.outlet,
|
|
68
|
-
parameters: resolution.parameters
|
|
79
|
+
parameters: resolution.parameters,
|
|
80
|
+
...placement
|
|
69
81
|
});
|
|
70
82
|
}
|
|
71
83
|
return resolution;
|
|
72
84
|
}, [
|
|
73
85
|
bindingScope,
|
|
86
|
+
destinations,
|
|
74
87
|
go,
|
|
88
|
+
outletOwners,
|
|
75
89
|
state
|
|
76
90
|
]);
|
|
77
91
|
const closeDialog = react.useCallback((result)=>{
|
|
@@ -87,6 +101,8 @@ var resolveDestination = require('./resolveDestination.js');
|
|
|
87
101
|
]);
|
|
88
102
|
return react.useMemo(()=>({
|
|
89
103
|
currentScreen: state.screen,
|
|
104
|
+
primaryScreen: state.primary ?? state.screen,
|
|
105
|
+
outlets: state.outlets ?? {},
|
|
90
106
|
currentUrl: state.url,
|
|
91
107
|
currentOutlet: state.outlet,
|
|
92
108
|
currentDialog: state.dialog,
|
|
@@ -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 { 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(history: SceneHistory
|
|
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,kBAAY,CAACC,GAAAA,GAAAA;AAC9B,QAAA,MAAMC,KAAAA,GAAQD,GAAAA,GAAME,+BAAAA,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,2BAAAA,CAAcH,KAAAA,EAAOH,KAAAA,CAAMO,KAAK,CAACH,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BnC,MAAMN,UAAU;AACnCQ,YAAAA,YAAAA;AACAL,YAAAA,aAAAA;AACAlB,YAAAA,YAAAA;AACAoC,YAAAA,QAAAA;AACAU,YAAAA,WAAAA;YACAE,IAAAA,EAAM,IAAMnD,QAAQmD,IAAI;AAC5B,SAAA,CAAA,EAAI;AAAChD,QAAAA,YAAAA;AAAc8C,QAAAA,WAAAA;AAAavB,QAAAA,YAAAA;AAAc1B,QAAAA,OAAAA;AAASuC,QAAAA,QAAAA;AAAUf,QAAAA,KAAAA;AAAOH,QAAAA;AAAc,KAAA,CAAA;AAC1F;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreComponents.d.ts","sourceRoot":"","sources":["../../../core/coreComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"coreComponents.d.ts","sourceRoot":"","sources":["../../../core/coreComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAyBhD,eAAO,MAAM,cAAc,EAAE,iBAiB5B,CAAC"}
|
|
@@ -4,6 +4,7 @@ import '@cratis/scene.engine';
|
|
|
4
4
|
import '@cratis/scene.model';
|
|
5
5
|
import '../interactions/useInteractions.js';
|
|
6
6
|
import '../interactions/NotificationHost.js';
|
|
7
|
+
import { CoreOutlet } from '../navigation/CoreOutlet.js';
|
|
7
8
|
import { componentRegistryKey } from '../packages/ScenePackageBundle.js';
|
|
8
9
|
import '../packages/runDesignTimeAction.js';
|
|
9
10
|
import { CoreText } from './CoreText.js';
|
|
@@ -32,7 +33,8 @@ import { CoreFile, CoreCode, CoreField, CoreSummary, CoreColumn, CoreTable, Core
|
|
|
32
33
|
[componentRegistryKey('core', 'field')]: CoreField,
|
|
33
34
|
[componentRegistryKey('core', 'code')]: CoreCode,
|
|
34
35
|
[componentRegistryKey('core', 'file')]: CoreFile,
|
|
35
|
-
[componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar
|
|
36
|
+
[componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,
|
|
37
|
+
[componentRegistryKey('core', 'outlet')]: CoreOutlet
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export { coreComponents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreComponents.js","sources":["../../../core/coreComponents.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentRegistry } from '../renderer';\nimport { componentRegistryKey } from '../packages';\nimport { CoreText } from './CoreText';\nimport { CoreButton } from './CoreButton';\nimport { CoreCard } from './CoreCard';\nimport { CoreNavigationBar } from './CoreNavigationBar';\nimport {\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};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar"],"mappings":"
|
|
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 { 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};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","Core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A,EAAQ,QAAA,CAAA,GAAYgB;AAC9C;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreDescriptors.d.ts","sourceRoot":"","sources":["../../../core/coreDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAqB,MAAM,qBAAqB,CAAC;AAY7E,eAAO,MAAM,eAAe,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"coreDescriptors.d.ts","sourceRoot":"","sources":["../../../core/coreDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAqB,MAAM,qBAAqB,CAAC;AAY7E,eAAO,MAAM,eAAe,EAAE,mBAAmB,EAiEhD,CAAC"}
|
|
@@ -107,6 +107,22 @@ const key = (name)=>componentRegistryKey('core', name);
|
|
|
107
107
|
}
|
|
108
108
|
]
|
|
109
109
|
},
|
|
110
|
+
{
|
|
111
|
+
component: key('outlet'),
|
|
112
|
+
displayName: 'Outlet',
|
|
113
|
+
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.',
|
|
114
|
+
properties: [
|
|
115
|
+
{
|
|
116
|
+
path: 'name',
|
|
117
|
+
label: 'Name',
|
|
118
|
+
group: 'Navigation',
|
|
119
|
+
valueType: PropertyValueType.String,
|
|
120
|
+
constraints: {
|
|
121
|
+
required: true
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
110
126
|
{
|
|
111
127
|
component: key('navigationBar'),
|
|
112
128
|
displayName: 'Navigation bar',
|
|
@@ -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, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey } from '../packages';\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 */\nexport const coreDescriptors: 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('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('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"],"names":["key","name","componentRegistryKey","coreDescriptors","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","minimumLength","Icon","Destination"],"mappings":";;;;;;;;;AAAA;AACA;AAKA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;UAOaE,eAAAA,GAAyC;AAClD,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC;AAAO,aAAA;AACvF,YAAA;gBACIL,IAAAA,EAAM,SAAA;gBAAWC,KAAAA,EAAO,SAAA;gBAAWC,KAAAA,EAAO,UAAA;AAAYC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBACzFG,UAAAA,EAAY,sBAAA;gBAAwBC,WAAAA,EAAa;oBAAEC,QAAAA,EAAU;AAAK,iBAAA;g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":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, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey } from '../packages';\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 */\nexport const coreDescriptors: 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('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"],"names":["key","name","componentRegistryKey","coreDescriptors","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","minimumLength","Icon","Destination"],"mappings":";;;;;;;;;AAAA;AACA;AAKA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;UAOaE,eAAAA,GAAyC;AAClD,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR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,EAAM;oBACFX,KAAAA,EAAO,iBAAA;oBACPF,UAAAA,EAAY;AACR,wBAAA;4BAAEC,IAAAA,EAAM,OAAA;4BAASC,KAAAA,EAAO,OAAA;4BAASC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;4BAAEI,WAAAA,EAAa;gCAAEC,QAAAA,EAAU,IAAA;gCAAMG,aAAAA,EAAe;AAAE;AAAE,yBAAA;AAC1I,wBAAA;4BAAEb,IAAAA,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBU,IAAI;4BAAEN,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBW,WAAW;4BAAEP,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corePackage.d.ts","sourceRoot":"","sources":["../../../core/corePackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWjD,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"corePackage.d.ts","sourceRoot":"","sources":["../../../core/corePackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWjD,eAAO,MAAM,mBAAmB,EAAE,YAgCjC,CAAC;AAKF,eAAO,MAAM,WAAW,EAAE,kBAIzB,CAAC"}
|
|
@@ -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 ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,cAAAA;IACZC,WAAAA,EAAaC;AACjB;;"}
|
|
1
|
+
{"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '../packages';\nimport { coreComponents } from './coreComponents';\nimport { coreDescriptors } from './coreDescriptors';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n 'navigationBar',\n 'outlet',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,eAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,cAAAA;IACZC,WAAAA,EAAaC;AACjB;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export { coreComponents } from './core/coreComponents.js';
|
|
|
18
18
|
export { corePackage, corePackageManifest } from './core/corePackage.js';
|
|
19
19
|
export { NavBar } from './NavBar/NavBar.js';
|
|
20
20
|
export { extractNavigationItem } from './NavBar/extractNavigationItem.js';
|
|
21
|
-
export { SceneNavigationProvider, useSceneNavigation } from './navigation/SceneNavigationContext.js';
|
|
21
|
+
export { SceneNavigationContextInternal, SceneNavigationProvider, useSceneNavigation } from './navigation/SceneNavigationContext.js';
|
|
22
22
|
export { SceneNavigationHost } from './navigation/SceneNavigationHost.js';
|
|
23
23
|
export { createBrowserSceneHistory } from './navigation/createBrowserSceneHistory.js';
|
|
24
24
|
export { createHashSceneHistory } from './navigation/createHashSceneHistory.js';
|
|
@@ -30,6 +30,10 @@ export { navigationRouteKey } from './navigation/navigationRouteKey.js';
|
|
|
30
30
|
export { resolveDestination } from './navigation/resolveDestination.js';
|
|
31
31
|
export { sceneRoutesFrom } from './navigation/sceneRoutesFrom.js';
|
|
32
32
|
export { useSceneHistoryNavigation } from './navigation/useSceneHistoryNavigation.js';
|
|
33
|
+
export { CoreOutlet } from './navigation/CoreOutlet.js';
|
|
34
|
+
export { SceneOutletContext, useSceneOutlets } from './navigation/SceneOutletContext.js';
|
|
35
|
+
export { collectOutletOwners, outletComponentName } from './navigation/collectOutletOwners.js';
|
|
36
|
+
export { placeInOutlet } from './navigation/placeInOutlet.js';
|
|
33
37
|
export { IconAdapterRegistry, createIconAdapterRegistry } from './icons/IconAdapterRegistry.js';
|
|
34
38
|
export { IconAdapterProvider, useIconAdapters } from './icons/IconAdapterContext.js';
|
|
35
39
|
export { useIconGlyph } from './icons/useIconGlyph.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreOutlet.d.ts","sourceRoot":"","sources":["../../../navigation/CoreOutlet.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAUzE,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAW/D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { SceneElementView } from '../SceneElementView.js';
|
|
4
|
+
import { SceneNavigationContextInternal } from './SceneNavigationContext.js';
|
|
5
|
+
import { useSceneOutlets } from './SceneOutletContext.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A nested outlet a screen declares: `core:outlet` with a `name`. Inside a navigation host it renders the
|
|
9
|
+
* screen placed in that outlet - which may declare outlets of its own, so composition nests to any depth -
|
|
10
|
+
* and nothing while the outlet is empty. Outside a navigation host it renders the empty region.
|
|
11
|
+
*/ function CoreOutlet({ element }) {
|
|
12
|
+
const name = typeof element.properties.name === 'string' ? element.properties.name : '';
|
|
13
|
+
const navigation = useContext(SceneNavigationContextInternal);
|
|
14
|
+
const outlets = useSceneOutlets();
|
|
15
|
+
const placed = navigation?.outlets[name];
|
|
16
|
+
const screen = placed && outlets ? outlets.screens[placed] : undefined;
|
|
17
|
+
return /*#__PURE__*/ jsx("div", {
|
|
18
|
+
"data-scene-outlet": name,
|
|
19
|
+
"data-scene-outlet-screen": placed,
|
|
20
|
+
children: screen && outlets && /*#__PURE__*/ jsx(SceneElementView, {
|
|
21
|
+
element: screen,
|
|
22
|
+
registry: outlets.registry,
|
|
23
|
+
dataContext: navigation?.bindingScope.dataContext,
|
|
24
|
+
queryResults: navigation?.bindingScope.queryResults
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { CoreOutlet };
|
|
30
|
+
//# sourceMappingURL=CoreOutlet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreOutlet.js","sources":["../../../navigation/CoreOutlet.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 { RegisteredComponentProps } from '../renderer/ComponentRegistry';\nimport { SceneElementView } from '../SceneElementView';\nimport { SceneNavigationContextInternal } from './SceneNavigationContext';\nimport { useSceneOutlets } from './SceneOutletContext';\n\n/**\n * A nested outlet a screen declares: `core:outlet` with a `name`. Inside a navigation host it renders the\n * screen placed in that outlet - which may declare outlets of its own, so composition nests to any depth -\n * and nothing while the outlet is empty. Outside a navigation host it renders the empty region.\n */\nexport function CoreOutlet({ element }: RegisteredComponentProps) {\n const name = typeof element.properties.name === 'string' ? element.properties.name : '';\n const navigation = useContext(SceneNavigationContextInternal);\n const outlets = useSceneOutlets();\n const placed = navigation?.outlets[name];\n const screen = placed && outlets ? outlets.screens[placed] : undefined;\n\n return <div data-scene-outlet={name} data-scene-outlet-screen={placed}>\n {screen && outlets && <SceneElementView element={screen} registry={outlets.registry}\n dataContext={navigation?.bindingScope.dataContext} queryResults={navigation?.bindingScope.queryResults} />}\n </div>;\n}\n"],"names":["CoreOutlet","element","name","properties","navigation","useContext","SceneNavigationContextInternal","outlets","useSceneOutlets","placed","screen","screens","undefined","_jsx","div","data-scene-outlet","data-scene-outlet-screen","SceneElementView","registry","dataContext","bindingScope","queryResults"],"mappings":";;;;;;AASA;;;;AAIC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAA4B,EAAA;AAC5D,IAAA,MAAMC,IAAAA,GAAO,OAAOD,OAAAA,CAAQE,UAAU,CAACD,IAAI,KAAK,QAAA,GAAWD,OAAAA,CAAQE,UAAU,CAACD,IAAI,GAAG,EAAA;AACrF,IAAA,MAAME,aAAaC,UAAAA,CAAWC,8BAAAA,CAAAA;AAC9B,IAAA,MAAMC,OAAAA,GAAUC,eAAAA,EAAAA;AAChB,IAAA,MAAMC,MAAAA,GAASL,UAAAA,EAAYG,OAAO,CAACL,IAAAA,CAAK;AACxC,IAAA,MAAMQ,SAASD,MAAAA,IAAUF,OAAAA,GAAUA,QAAQI,OAAO,CAACF,OAAO,GAAGG,SAAAA;AAE7D,IAAA,qBAAOC,GAAA,CAACC,KAAAA,EAAAA;QAAIC,mBAAAA,EAAmBb,IAAAA;QAAMc,0BAAAA,EAA0BP,MAAAA;AAC1DC,QAAAA,QAAAA,EAAAA,MAAAA,IAAUH,yBAAWM,GAAA,CAACI,gBAAAA,EAAAA;YAAiBhB,OAAAA,EAASS,MAAAA;AAAQQ,YAAAA,QAAAA,EAAUX,QAAQW,QAAQ;AAC/EC,YAAAA,WAAAA,EAAaf,YAAYgB,YAAAA,CAAaD,WAAAA;AAAaE,YAAAA,YAAAA,EAAcjB,YAAYgB,YAAAA,CAAaC;;;AAEtG;;"}
|
|
@@ -5,6 +5,8 @@ import { DestinationResolution } from './DestinationResolution';
|
|
|
5
5
|
import { DialogResult } from './DialogResult';
|
|
6
6
|
export interface SceneNavigationContextValue {
|
|
7
7
|
currentScreen: string;
|
|
8
|
+
primaryScreen: string;
|
|
9
|
+
outlets: Record<string, string>;
|
|
8
10
|
currentUrl?: string;
|
|
9
11
|
currentOutlet?: string;
|
|
10
12
|
currentDialog?: string;
|
|
@@ -16,6 +18,7 @@ export interface SceneNavigationContextValue {
|
|
|
16
18
|
closeDialog(result?: unknown): void;
|
|
17
19
|
back(): void;
|
|
18
20
|
}
|
|
21
|
+
export declare const SceneNavigationContextInternal: import("react").Context<SceneNavigationContextValue | undefined>;
|
|
19
22
|
export interface SceneNavigationProviderProps {
|
|
20
23
|
value: SceneNavigationContextValue;
|
|
21
24
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationContext.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,WAAW,2BAA2B;
|
|
1
|
+
{"version":3,"file":"SceneNavigationContext.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,WAAW,2BAA2B;IAExC,aAAa,EAAE,MAAM,CAAC;IAGtB,aAAa,EAAE,MAAM,CAAC;IAGtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG1C,YAAY,CAAC,EAAE,YAAY,CAAC;IAG5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,oBAAoB,GAAG,qBAAqB,CAAC;IAGnE,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAGpC,IAAI,IAAI,IAAI,CAAC;CAChB;AAKD,eAAO,MAAM,8BAA8B,kEAAU,CAAC;AAEtD,MAAM,WAAW,4BAA4B;IACzC,KAAK,EAAE,2BAA2B,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,4BAA4B,+BAExF;AAED,wBAAgB,kBAAkB,IAAI,2BAA2B,CAIhE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
3
|
|
|
4
4
|
const Context = /*#__PURE__*/ createContext(undefined);
|
|
5
|
+
/** The navigation context itself, for components that render outside a host as well as inside one. */ const SceneNavigationContextInternal = Context;
|
|
5
6
|
function SceneNavigationProvider({ value, children }) {
|
|
6
7
|
return /*#__PURE__*/ jsx(Context.Provider, {
|
|
7
8
|
value: value,
|
|
@@ -14,5 +15,5 @@ function useSceneNavigation() {
|
|
|
14
15
|
return context;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export { SceneNavigationProvider, useSceneNavigation };
|
|
18
|
+
export { SceneNavigationContextInternal, SceneNavigationProvider, useSceneNavigation };
|
|
18
19
|
//# sourceMappingURL=SceneNavigationContext.js.map
|
|
@@ -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 currentScreen: 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\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","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 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":";;;AAwCA,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":"AAIA,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;
|
|
1
|
+
{"version":3,"file":"SceneNavigationHost.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationHost.tsx"],"names":[],"mappings":"AAIA,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;AAM1C,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;IAGtC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AASD,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,OAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,wBAAwB,+BAkBjK"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useMemo } from 'react';
|
|
3
3
|
import { SceneElementView } from '../SceneElementView.js';
|
|
4
4
|
import { createMemorySceneHistory } from './createMemorySceneHistory.js';
|
|
5
5
|
import { SceneNavigationProvider } from './SceneNavigationContext.js';
|
|
6
6
|
import { sceneRoutesFrom } from './sceneRoutesFrom.js';
|
|
7
|
+
import { collectOutletOwners } from './collectOutletOwners.js';
|
|
8
|
+
import { SceneOutletContext } from './SceneOutletContext.js';
|
|
7
9
|
import { useSceneHistoryNavigation } from './useSceneHistoryNavigation.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
|
-
* Executes Scene destinations against an in-memory rendered hierarchy:
|
|
12
|
+
* Executes Scene destinations against an in-memory rendered hierarchy: a destination into a nested outlet -
|
|
13
|
+
* one a screen declares with `core:outlet` - places its screen there and keeps the screens above it, to any
|
|
14
|
+
* depth; any other screen route replaces the primary region,
|
|
11
15
|
* dialog destinations render dialog content over the screen that opened them, and external destinations
|
|
12
16
|
* only report their resolved action. Every navigation is a history entry.
|
|
13
17
|
*/ function SceneNavigationHost({ screens, dialogs = {}, initialScreen, registry, bindingScope = {}, history, destinations, routes }) {
|
|
@@ -17,37 +21,50 @@ import { useSceneHistoryNavigation } from './useSceneHistoryNavigation.js';
|
|
|
17
21
|
routes,
|
|
18
22
|
screens
|
|
19
23
|
]);
|
|
20
|
-
const
|
|
21
|
-
|
|
24
|
+
const outletOwners = useMemo(()=>collectOutletOwners(screens), [
|
|
25
|
+
screens
|
|
26
|
+
]);
|
|
27
|
+
const value = useSceneHistoryNavigation(history ?? memoryHistory, routeTable, initialScreen, bindingScope, outletOwners, destinations);
|
|
28
|
+
const outletContext = useMemo(()=>({
|
|
29
|
+
screens,
|
|
30
|
+
registry
|
|
31
|
+
}), [
|
|
32
|
+
registry,
|
|
33
|
+
screens
|
|
34
|
+
]);
|
|
35
|
+
const screen = screens[value.primaryScreen];
|
|
22
36
|
const dialog = value.currentDialog ? dialogs[value.currentDialog] : undefined;
|
|
23
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/ jsx(SceneNavigationProvider, {
|
|
24
38
|
value: value,
|
|
25
|
-
children:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
children: /*#__PURE__*/ jsxs(SceneOutletContext.Provider, {
|
|
40
|
+
value: outletContext,
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ jsx("div", {
|
|
43
|
+
"data-scene-outlet": value.primaryScreen === value.currentScreen ? value.currentOutlet ?? 'primary' : 'primary',
|
|
44
|
+
"data-scene-url": value.currentUrl,
|
|
45
|
+
children: screen && /*#__PURE__*/ jsx(SceneElementView, {
|
|
46
|
+
element: screen,
|
|
47
|
+
registry: registry,
|
|
48
|
+
dataContext: bindingScope.dataContext,
|
|
49
|
+
queryResults: bindingScope.queryResults,
|
|
50
|
+
componentOutputs: bindingScope.componentOutputs
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
dialog && /*#__PURE__*/ jsx("div", {
|
|
54
|
+
role: "dialog",
|
|
55
|
+
"aria-modal": "true",
|
|
56
|
+
"aria-label": value.currentDialog,
|
|
57
|
+
"data-scene-dialog": value.currentDialog,
|
|
58
|
+
children: /*#__PURE__*/ jsx(SceneElementView, {
|
|
59
|
+
element: dialog,
|
|
60
|
+
registry: registry,
|
|
61
|
+
dataContext: bindingScope.dataContext,
|
|
62
|
+
queryResults: bindingScope.queryResults,
|
|
63
|
+
componentOutputs: bindingScope.componentOutputs
|
|
64
|
+
})
|
|
48
65
|
})
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
]
|
|
67
|
+
})
|
|
51
68
|
});
|
|
52
69
|
}
|
|
53
70
|
|
|
@@ -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 { 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 { useSceneHistoryNavigation } from './useSceneHistoryNavigation';\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 /** 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: screen
|
|
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 { 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';\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 /** 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, 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, routes }: SceneNavigationHostProps) {\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\n return <SceneNavigationProvider value={value}><SceneOutletContext.Provider value={outletContext}>\n <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 {dialog && <div role='dialog' aria-modal='true' aria-label={value.currentDialog} data-scene-dialog={value.currentDialog}>\n <SceneElementView element={dialog} registry={registry} dataContext={bindingScope.dataContext} queryResults={bindingScope.queryResults} componentOutputs={bindingScope.componentOutputs} />\n </div>}\n </SceneOutletContext.Provider></SceneNavigationProvider>;\n}\n"],"names":["SceneNavigationHost","screens","dialogs","initialScreen","registry","bindingScope","history","destinations","routes","memoryHistory","useState","createMemorySceneHistory","routeTable","useMemo","sceneRoutesFrom","Object","keys","outletOwners","collectOutletOwners","value","useSceneHistoryNavigation","outletContext","screen","primaryScreen","dialog","currentDialog","undefined","_jsx","SceneNavigationProvider","_jsxs","SceneOutletContext","Provider","div","data-scene-outlet","currentScreen","currentOutlet","data-scene-url","currentUrl","SceneElementView","element","dataContext","queryResults","componentOutputs","role","aria-modal","aria-label","data-scene-dialog"],"mappings":";;;;;;;;;;AAqCA;;;;;;IAOO,SAASA,mBAAAA,CAAoB,EAAEC,OAAO,EAAEC,OAAAA,GAAU,EAAE,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,YAAAA,GAAe,EAAE,EAAEC,OAAO,EAAEC,YAAY,EAAEC,MAAM,EAA4B,EAAA;AAC9J,IAAA,MAAM,CAACC,aAAAA,CAAc,GAAGC,QAAAA,CAAS,IAAMC,wBAAAA,EAAAA,CAAAA;IACvC,MAAMC,UAAAA,GAAaC,QAAQ,IAAML,MAAAA,IAAUM,gBAAgBC,MAAAA,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AUA,QAAAA;AAAUoC,wBAAAA,WAAAA,EAAanC,aAAamC,WAAW;AAAEC,wBAAAA,YAAAA,EAAcpC,aAAaoC,YAAY;AAAEC,wBAAAA,gBAAAA,EAAkBrC,aAAaqC;;;AAEpLlB,gBAAAA,MAAAA,kBAAUG,GAAA,CAACK,KAAAA,EAAAA;oBAAIW,IAAAA,EAAK,QAAA;oBAASC,YAAAA,EAAW,MAAA;AAAOC,oBAAAA,YAAAA,EAAY1B,MAAMM,aAAa;AAAEqB,oBAAAA,mBAAAA,EAAmB3B,MAAMM,aAAa;AACnH,oBAAA,QAAA,gBAAAE,GAAA,CAACW,gBAAAA,EAAAA;wBAAiBC,OAAAA,EAASf,MAAAA;wBAAQpB,QAAAA,EAAUA,QAAAA;AAAUoC,wBAAAA,WAAAA,EAAanC,aAAamC,WAAW;AAAEC,wBAAAA,YAAAA,EAAcpC,aAAaoC,YAAY;AAAEC,wBAAAA,gBAAAA,EAAkBrC,aAAaqC;;;;;;AAGlL;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationState.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationState.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,oBAAoB;
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SceneElement } from '@cratis/scene.model';
|
|
2
|
+
import { ComponentRegistry } from '../renderer';
|
|
3
|
+
export interface SceneOutletContextValue {
|
|
4
|
+
screens: Record<string, SceneElement>;
|
|
5
|
+
registry: ComponentRegistry;
|
|
6
|
+
}
|
|
7
|
+
export declare const SceneOutletContext: import("react").Context<SceneOutletContextValue | undefined>;
|
|
8
|
+
export declare function useSceneOutlets(): SceneOutletContextValue | undefined;
|
|
9
|
+
//# sourceMappingURL=SceneOutletContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneOutletContext.d.ts","sourceRoot":"","sources":["../../../navigation/SceneOutletContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,QAAQ,EAAE,iBAAiB,CAAC;CAC/B;AAED,eAAO,MAAM,kBAAkB,8DAAgE,CAAC;AAGhG,wBAAgB,eAAe,IAAI,uBAAuB,GAAG,SAAS,CAErE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
const SceneOutletContext = /*#__PURE__*/ createContext(undefined);
|
|
6
|
+
/** The screens and registry of the enclosing navigation host, or undefined outside one. */ function useSceneOutlets() {
|
|
7
|
+
return useContext(SceneOutletContext);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { SceneOutletContext, useSceneOutlets };
|
|
11
|
+
//# sourceMappingURL=SceneOutletContext.js.map
|