@cratis/scene.react 4.28.0 → 4.29.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/dist/cjs/index.js +16 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/SceneNavigationHost.js +24 -13
- package/dist/cjs/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/cjs/navigation/region/NavigationRegionClassNames.js +21 -0
- package/dist/cjs/navigation/region/NavigationRegionClassNames.js.map +1 -0
- package/dist/cjs/navigation/region/NavigationRegionView.js +283 -0
- package/dist/cjs/navigation/region/NavigationRegionView.js.map +1 -0
- package/dist/cjs/navigation/region/SceneNavigationModelContext.js +22 -0
- package/dist/cjs/navigation/region/SceneNavigationModelContext.js.map +1 -0
- package/dist/cjs/navigation/region/currentModuleOf.js +15 -0
- package/dist/cjs/navigation/region/currentModuleOf.js.map +1 -0
- package/dist/cjs/navigation/region/navigationDestinations.js +46 -0
- package/dist/cjs/navigation/region/navigationDestinations.js.map +1 -0
- package/dist/cjs/navigation/region/navigationItemActive.js +31 -0
- package/dist/cjs/navigation/region/navigationItemActive.js.map +1 -0
- package/dist/cjs/navigation/region/navigationItemDestination.js +34 -0
- package/dist/cjs/navigation/region/navigationItemDestination.js.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/navigation/SceneNavigationHost.d.ts +5 -1
- package/dist/esm/navigation/SceneNavigationHost.d.ts.map +1 -1
- package/dist/esm/navigation/SceneNavigationHost.js +25 -14
- package/dist/esm/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/esm/navigation/index.d.ts +8 -0
- package/dist/esm/navigation/index.d.ts.map +1 -1
- package/dist/esm/navigation/index.js +8 -0
- package/dist/esm/navigation/index.js.map +1 -1
- package/dist/esm/navigation/region/NavigationRegionClassNames.d.ts +12 -0
- package/dist/esm/navigation/region/NavigationRegionClassNames.d.ts.map +1 -0
- package/dist/esm/navigation/region/NavigationRegionClassNames.js +19 -0
- package/dist/esm/navigation/region/NavigationRegionClassNames.js.map +1 -0
- package/dist/esm/navigation/region/NavigationRegionView.d.ts +20 -0
- package/dist/esm/navigation/region/NavigationRegionView.d.ts.map +1 -0
- package/dist/esm/navigation/region/NavigationRegionView.js +281 -0
- package/dist/esm/navigation/region/NavigationRegionView.js.map +1 -0
- package/dist/esm/navigation/region/SceneNavigationModel.d.ts +9 -0
- package/dist/esm/navigation/region/SceneNavigationModel.d.ts.map +1 -0
- package/dist/esm/navigation/region/SceneNavigationModel.js +2 -0
- package/dist/esm/navigation/region/SceneNavigationModel.js.map +1 -0
- package/dist/esm/navigation/region/SceneNavigationModelContext.d.ts +9 -0
- package/dist/esm/navigation/region/SceneNavigationModelContext.d.ts.map +1 -0
- package/dist/esm/navigation/region/SceneNavigationModelContext.js +19 -0
- package/dist/esm/navigation/region/SceneNavigationModelContext.js.map +1 -0
- package/dist/esm/navigation/region/currentModuleOf.d.ts +3 -0
- package/dist/esm/navigation/region/currentModuleOf.d.ts.map +1 -0
- package/dist/esm/navigation/region/currentModuleOf.js +13 -0
- package/dist/esm/navigation/region/currentModuleOf.js.map +1 -0
- package/dist/esm/navigation/region/navigationDestinations.d.ts +4 -0
- package/dist/esm/navigation/region/navigationDestinations.d.ts.map +1 -0
- package/dist/esm/navigation/region/navigationDestinations.js +44 -0
- package/dist/esm/navigation/region/navigationDestinations.js.map +1 -0
- package/dist/esm/navigation/region/navigationItemActive.d.ts +5 -0
- package/dist/esm/navigation/region/navigationItemActive.d.ts.map +1 -0
- package/dist/esm/navigation/region/navigationItemActive.js +29 -0
- package/dist/esm/navigation/region/navigationItemActive.js.map +1 -0
- package/dist/esm/navigation/region/navigationItemDestination.d.ts +5 -0
- package/dist/esm/navigation/region/navigationItemDestination.d.ts.map +1 -0
- package/dist/esm/navigation/region/navigationItemDestination.js +31 -0
- package/dist/esm/navigation/region/navigationItemDestination.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/navigation/SceneNavigationHost.tsx +27 -6
- package/navigation/index.ts +8 -0
- package/navigation/region/NavigationRegionClassNames.ts +46 -0
- package/navigation/region/NavigationRegionView.tsx +234 -0
- package/navigation/region/SceneNavigationModel.ts +29 -0
- package/navigation/region/SceneNavigationModelContext.tsx +25 -0
- package/navigation/region/currentModuleOf.ts +14 -0
- package/navigation/region/navigationDestinations.ts +41 -0
- package/navigation/region/navigationItemActive.ts +39 -0
- package/navigation/region/navigationItemDestination.ts +29 -0
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationDestinations.js","sources":["../../../../navigation/region/navigationDestinations.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 { ApplicationStructure, DestinationReference, NavigationRegionKind, NavigationModel } from '@cratis/scene.model';\nimport { ApplicationStructureIndex, EffectiveNavItem, effectiveNavigation } from '@cratis/scene.engine';\nimport { navigationItemDestination } from './navigationItemDestination';\n\nfunction flatten(items: EffectiveNavItem[]): EffectiveNavItem[] {\n return items.flatMap(item => [item, ...flatten(item.children ?? [])]);\n}\n\n/**\n * Every destination the navigation of the application and of each module can lead to, once each: what a\n * `SceneNavigationHost` is given as `destinations` so deep links to a navigation item resolve, and an item that renders\n * into a nested outlet is placed with the screen that declares the outlet.\n */\nexport function navigationDestinations(\n structure: ApplicationStructure | ApplicationStructureIndex,\n navigation: NavigationModel,\n screenFor?: (item: EffectiveNavItem) => string | undefined,\n): DestinationReference[] {\n const index = structure instanceof ApplicationStructureIndex ? structure : new ApplicationStructureIndex(structure);\n const modules = [undefined, ...index.structure.modules.map(module => module.id)];\n const seen = new Set<string>();\n const destinations: DestinationReference[] = [];\n\n for (const module of modules) {\n for (const region of [NavigationRegionKind.Topbar, NavigationRegionKind.Sidebar]) {\n for (const item of flatten(effectiveNavigation(index, navigation, module, region).items)) {\n const destination = navigationItemDestination(item, screenFor);\n if (destination === undefined) continue;\n const key = JSON.stringify(destination);\n if (seen.has(key)) continue;\n seen.add(key);\n destinations.push(destination);\n }\n }\n }\n\n return destinations;\n}\n"],"names":["flatten","items","flatMap","item","children","navigationDestinations","structure","navigation","screenFor","index","ApplicationStructureIndex","modules","undefined","map","module","id","seen","Set","destinations","region","NavigationRegionKind","Topbar","Sidebar","effectiveNavigation","destination","navigationItemDestination","key","JSON","stringify","has","add","push"],"mappings":";;;;;;AAAA;AACA;AAMA,SAASA,QAAQC,KAAyB,EAAA;AACtC,IAAA,OAAOA,KAAAA,CAAMC,OAAO,CAACC,CAAAA,IAAAA,GAAQ;AAACA,YAAAA,IAAAA;eAASH,OAAAA,CAAQG,IAAAA,CAAKC,QAAQ,IAAI,EAAE;AAAE,SAAA,CAAA;AACxE;AAEA;;;;AAIC,IACM,SAASC,sBAAAA,CACZC,SAA2D,EAC3DC,UAA2B,EAC3BC,SAA0D,EAAA;AAE1D,IAAA,MAAMC,KAAAA,GAAQH,SAAAA,YAAqBI,sCAAAA,GAA4BJ,SAAAA,GAAY,IAAII,sCAAAA,CAA0BJ,SAAAA,CAAAA;AACzG,IAAA,MAAMK,OAAAA,GAAU;AAACC,QAAAA,SAAAA;WAAcH,KAAAA,CAAMH,SAAS,CAACK,OAAO,CAACE,GAAG,CAACC,CAAAA,MAAAA,GAAUA,MAAAA,CAAOC,EAAE;AAAE,KAAA;AAChF,IAAA,MAAMC,OAAO,IAAIC,GAAAA,EAAAA;AACjB,IAAA,MAAMC,eAAuC,EAAE;IAE/C,KAAK,MAAMJ,UAAUH,OAAAA,CAAS;AAC1B,QAAA,KAAK,MAAMQ,MAAAA,IAAU;AAACC,YAAAA,gCAAAA,CAAqBC,MAAM;AAAED,YAAAA,gCAAAA,CAAqBE;SAAQ,CAAE;YAC9E,KAAK,MAAMnB,QAAQH,OAAAA,CAAQuB,gCAAAA,CAAoBd,OAAOF,UAAAA,EAAYO,MAAAA,EAAQK,MAAAA,CAAAA,CAAQlB,KAAK,CAAA,CAAG;gBACtF,MAAMuB,WAAAA,GAAcC,oDAA0BtB,IAAAA,EAAMK,SAAAA,CAAAA;AACpD,gBAAA,IAAIgB,gBAAgBZ,SAAAA,EAAW;gBAC/B,MAAMc,GAAAA,GAAMC,IAAAA,CAAKC,SAAS,CAACJ,WAAAA,CAAAA;gBAC3B,IAAIR,IAAAA,CAAKa,GAAG,CAACH,GAAAA,CAAAA,EAAM;AACnBV,gBAAAA,IAAAA,CAAKc,GAAG,CAACJ,GAAAA,CAAAA;AACTR,gBAAAA,YAAAA,CAAaa,IAAI,CAACP,WAAAA,CAAAA;AACtB,YAAA;AACJ,QAAA;AACJ,IAAA;IAEA,OAAON,YAAAA;AACX;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
4
|
+
var navigationItemDestination = require('./navigationItemDestination.js');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/**
|
|
9
|
+
* Whether a navigation item is the one the page shows.
|
|
10
|
+
*
|
|
11
|
+
* An item is active when the screen it opens is the one in the slot it renders into: the primary region for the
|
|
12
|
+
* `content` slot, the nested outlet of that name otherwise. So several items can be active at once - each is shown in
|
|
13
|
+
* its own slot - and closing a slot's screen un-highlights its item. With `matchModule` - a topbar - an item that targets
|
|
14
|
+
* a module without a feature is also active while any screen of that module is in its slot.
|
|
15
|
+
*
|
|
16
|
+
* @param item The effective item.
|
|
17
|
+
* @param placement What the host currently shows.
|
|
18
|
+
* @param screenFor Names the screen an item opens; the feature the item resolves to when absent.
|
|
19
|
+
* @param matchModule Whether a module item is active on any screen of the module; a topbar's are, a sidebar's are not.
|
|
20
|
+
*/ function navigationItemActive(item, placement, screenFor = navigationItemDestination.defaultScreenFor, matchModule = false) {
|
|
21
|
+
const screen = screenFor(item);
|
|
22
|
+
if (screen === undefined) return false;
|
|
23
|
+
const shown = item.slot === scene_engine.primarySlot ? placement.primaryScreen : placement.outlets[item.slot];
|
|
24
|
+
if (shown === undefined) return false;
|
|
25
|
+
if (shown === screen) return true;
|
|
26
|
+
const target = item.target;
|
|
27
|
+
return matchModule && target !== undefined && target.feature === undefined && shown.startsWith(`${target.module}.`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.navigationItemActive = navigationItemActive;
|
|
31
|
+
//# sourceMappingURL=navigationItemActive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationItemActive.js","sources":["../../../../navigation/region/navigationItemActive.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 { EffectiveNavItem, primarySlot } from '@cratis/scene.engine';\nimport { defaultScreenFor } from './navigationItemDestination';\nimport { SceneNavigationContextValue } from '../SceneNavigationContext';\n\n/** Where the navigation host is: the part of {@link SceneNavigationContextValue} that says what is on the page. */\nexport type NavigationPlacement = Pick<SceneNavigationContextValue, 'primaryScreen' | 'outlets'>;\n\n/**\n * Whether a navigation item is the one the page shows.\n *\n * An item is active when the screen it opens is the one in the slot it renders into: the primary region for the\n * `content` slot, the nested outlet of that name otherwise. So several items can be active at once - each is shown in\n * its own slot - and closing a slot's screen un-highlights its item. With `matchModule` - a topbar - an item that targets\n * a module without a feature is also active while any screen of that module is in its slot.\n *\n * @param item The effective item.\n * @param placement What the host currently shows.\n * @param screenFor Names the screen an item opens; the feature the item resolves to when absent.\n * @param matchModule Whether a module item is active on any screen of the module; a topbar's are, a sidebar's are not.\n */\nexport function navigationItemActive(\n item: EffectiveNavItem,\n placement: NavigationPlacement,\n screenFor: (item: EffectiveNavItem) => string | undefined = defaultScreenFor,\n matchModule = false,\n): boolean {\n const screen = screenFor(item);\n if (screen === undefined) return false;\n\n const shown = item.slot === primarySlot ? placement.primaryScreen : placement.outlets[item.slot];\n if (shown === undefined) return false;\n if (shown === screen) return true;\n\n const target = item.target;\n return matchModule && target !== undefined && target.feature === undefined && shown.startsWith(`${target.module}.`);\n}\n"],"names":["navigationItemActive","item","placement","screenFor","defaultScreenFor","matchModule","screen","undefined","shown","slot","primarySlot","primaryScreen","outlets","target","feature","startsWith","module"],"mappings":";;;;;AAAA;AACA;AASA;;;;;;;;;;;;IAaO,SAASA,oBAAAA,CACZC,IAAsB,EACtBC,SAA8B,EAC9BC,SAAAA,GAA4DC,0CAAgB,EAC5EC,WAAAA,GAAc,KAAK,EAAA;AAEnB,IAAA,MAAMC,SAASH,SAAAA,CAAUF,IAAAA,CAAAA;IACzB,IAAIK,MAAAA,KAAWC,WAAW,OAAO,KAAA;AAEjC,IAAA,MAAMC,KAAAA,GAAQP,IAAAA,CAAKQ,IAAI,KAAKC,wBAAAA,GAAcR,SAAAA,CAAUS,aAAa,GAAGT,SAAAA,CAAUU,OAAO,CAACX,IAAAA,CAAKQ,IAAI,CAAC;IAChG,IAAID,KAAAA,KAAUD,WAAW,OAAO,KAAA;IAChC,IAAIC,KAAAA,KAAUF,QAAQ,OAAO,IAAA;IAE7B,MAAMO,MAAAA,GAASZ,KAAKY,MAAM;AAC1B,IAAA,OAAOR,WAAAA,IAAeQ,MAAAA,KAAWN,SAAAA,IAAaM,MAAAA,CAAOC,OAAO,KAAKP,SAAAA,IAAaC,KAAAA,CAAMO,UAAU,CAAC,CAAA,EAAGF,MAAAA,CAAOG,MAAM,CAAC,CAAC,CAAC,CAAA;AACtH;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/** The screen an item opens by default: the qualified id of the feature it resolves to. */ function defaultScreenFor(item) {
|
|
9
|
+
return item.target?.resolvedFeature;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Where activating a navigation item goes: its stable module/feature identity, the screen it opens, and the slot it
|
|
13
|
+
* renders into as the outlet - the primary `content` slot is the host's primary outlet.
|
|
14
|
+
*
|
|
15
|
+
* @param item The effective item.
|
|
16
|
+
* @param screenFor Names the screen an item opens; {@link defaultScreenFor} when absent.
|
|
17
|
+
* @returns The destination, or undefined when the item leads nowhere.
|
|
18
|
+
*/ function navigationItemDestination(item, screenFor = defaultScreenFor) {
|
|
19
|
+
const screen = screenFor(item);
|
|
20
|
+
if (screen === undefined || item.target === undefined) return undefined;
|
|
21
|
+
const resolved = item.target.resolvedFeature;
|
|
22
|
+
const destination = {
|
|
23
|
+
kind: scene_model.DestinationKind.Outlet,
|
|
24
|
+
module: item.target.module,
|
|
25
|
+
screen
|
|
26
|
+
};
|
|
27
|
+
if (resolved !== undefined && resolved.startsWith(`${item.target.module}.`)) destination.feature = resolved.substring(item.target.module.length + 1);
|
|
28
|
+
if (item.slot !== scene_engine.primarySlot) destination.outlet = item.slot;
|
|
29
|
+
return destination;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.defaultScreenFor = defaultScreenFor;
|
|
33
|
+
exports.navigationItemDestination = navigationItemDestination;
|
|
34
|
+
//# sourceMappingURL=navigationItemDestination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationItemDestination.js","sources":["../../../../navigation/region/navigationItemDestination.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 { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { EffectiveNavItem, primarySlot } from '@cratis/scene.engine';\n\n/** The screen an item opens by default: the qualified id of the feature it resolves to. */\nexport function defaultScreenFor(item: EffectiveNavItem): string | undefined {\n return item.target?.resolvedFeature;\n}\n\n/**\n * Where activating a navigation item goes: its stable module/feature identity, the screen it opens, and the slot it\n * renders into as the outlet - the primary `content` slot is the host's primary outlet.\n *\n * @param item The effective item.\n * @param screenFor Names the screen an item opens; {@link defaultScreenFor} when absent.\n * @returns The destination, or undefined when the item leads nowhere.\n */\nexport function navigationItemDestination(item: EffectiveNavItem, screenFor: (item: EffectiveNavItem) => string | undefined = defaultScreenFor): DestinationReference | undefined {\n const screen = screenFor(item);\n if (screen === undefined || item.target === undefined) return undefined;\n\n const resolved = item.target.resolvedFeature;\n const destination: DestinationReference = { kind: DestinationKind.Outlet, module: item.target.module, screen };\n if (resolved !== undefined && resolved.startsWith(`${item.target.module}.`)) destination.feature = resolved.substring(item.target.module.length + 1);\n if (item.slot !== primarySlot) destination.outlet = item.slot;\n return destination;\n}\n"],"names":["defaultScreenFor","item","target","resolvedFeature","navigationItemDestination","screenFor","screen","undefined","resolved","destination","kind","DestinationKind","Outlet","module","startsWith","feature","substring","length","slot","primarySlot","outlet"],"mappings":";;;;;AAAA;AACA;AAKA,4FACO,SAASA,gBAAAA,CAAiBC,IAAsB,EAAA;IACnD,OAAOA,IAAAA,CAAKC,MAAM,EAAEC,eAAAA;AACxB;AAEA;;;;;;;AAOC,IACM,SAASC,yBAAAA,CAA0BH,IAAsB,EAAEI,YAA4DL,gBAAgB,EAAA;AAC1I,IAAA,MAAMM,SAASD,SAAAA,CAAUJ,IAAAA,CAAAA;AACzB,IAAA,IAAIK,WAAWC,SAAAA,IAAaN,IAAAA,CAAKC,MAAM,KAAKK,WAAW,OAAOA,SAAAA;AAE9D,IAAA,MAAMC,QAAAA,GAAWP,IAAAA,CAAKC,MAAM,CAACC,eAAe;AAC5C,IAAA,MAAMM,WAAAA,GAAoC;AAAEC,QAAAA,IAAAA,EAAMC,4BAAgBC,MAAM;QAAEC,MAAAA,EAAQZ,IAAAA,CAAKC,MAAM,CAACW,MAAM;AAAEP,QAAAA;AAAO,KAAA;IAC7G,IAAIE,QAAAA,KAAaD,SAAAA,IAAaC,QAAAA,CAASM,UAAU,CAAC,CAAA,EAAGb,IAAAA,CAAKC,MAAM,CAACW,MAAM,CAAC,CAAC,CAAC,GAAGJ,WAAAA,CAAYM,OAAO,GAAGP,QAAAA,CAASQ,SAAS,CAACf,IAAAA,CAAKC,MAAM,CAACW,MAAM,CAACI,MAAM,GAAG,CAAA,CAAA;IAClJ,IAAIhB,IAAAA,CAAKiB,IAAI,KAAKC,wBAAAA,EAAaV,YAAYW,MAAM,GAAGnB,KAAKiB,IAAI;IAC7D,OAAOT,WAAAA;AACX;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -35,6 +35,13 @@ export { CoreOutlet } from './navigation/CoreOutlet.js';
|
|
|
35
35
|
export { SceneOutletContext, useSceneOutlets } from './navigation/SceneOutletContext.js';
|
|
36
36
|
export { collectOutletOwners, outletComponentName } from './navigation/collectOutletOwners.js';
|
|
37
37
|
export { placeInOutlet } from './navigation/placeInOutlet.js';
|
|
38
|
+
export { SceneNavigationModelProvider, useSceneNavigationModel } from './navigation/region/SceneNavigationModelContext.js';
|
|
39
|
+
export { defaultNavigationRegionClassNames } from './navigation/region/NavigationRegionClassNames.js';
|
|
40
|
+
export { NavigationRegionView } from './navigation/region/NavigationRegionView.js';
|
|
41
|
+
export { currentModuleOf } from './navigation/region/currentModuleOf.js';
|
|
42
|
+
export { navigationItemActive } from './navigation/region/navigationItemActive.js';
|
|
43
|
+
export { defaultScreenFor, navigationItemDestination } from './navigation/region/navigationItemDestination.js';
|
|
44
|
+
export { navigationDestinations } from './navigation/region/navigationDestinations.js';
|
|
38
45
|
export { IconAdapterRegistry, createIconAdapterRegistry } from './icons/IconAdapterRegistry.js';
|
|
39
46
|
export { IconAdapterProvider, useIconAdapters } from './icons/IconAdapterContext.js';
|
|
40
47
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { BindingScope } from '@cratis/scene.engine';
|
|
2
3
|
import { DestinationReference, SceneElement } from '@cratis/scene.model';
|
|
3
4
|
import { ComponentRegistry } from '../renderer';
|
|
4
5
|
import { SceneHistory } from './SceneHistory';
|
|
5
6
|
import { SceneRoute } from './SceneRoute';
|
|
7
|
+
import { SceneNavigationModel } from './region/SceneNavigationModel';
|
|
6
8
|
export interface SceneNavigationHostProps {
|
|
7
9
|
screens: Record<string, SceneElement>;
|
|
8
10
|
dialogs?: Record<string, SceneElement>;
|
|
@@ -11,7 +13,9 @@ export interface SceneNavigationHostProps {
|
|
|
11
13
|
bindingScope?: BindingScope;
|
|
12
14
|
history?: SceneHistory;
|
|
13
15
|
destinations?: DestinationReference[];
|
|
16
|
+
navigationModel?: SceneNavigationModel;
|
|
17
|
+
frame?(content: ReactNode): ReactNode;
|
|
14
18
|
routes?: SceneRoute[];
|
|
15
19
|
}
|
|
16
|
-
export declare function SceneNavigationHost({ screens, dialogs, initialScreen, registry, bindingScope, history, destinations, routes }: SceneNavigationHostProps): import("react").JSX.Element;
|
|
20
|
+
export declare function SceneNavigationHost({ screens, dialogs, initialScreen, registry, bindingScope, history, destinations: authoredDestinations, routes, navigationModel, frame }: SceneNavigationHostProps): import("react").JSX.Element;
|
|
17
21
|
//# sourceMappingURL=SceneNavigationHost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationHost.d.ts","sourceRoot":"","sources":["../../../navigation/SceneNavigationHost.tsx"],"names":[],"mappings":"
|
|
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;AAIrE,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;AASD,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,+BAwB/M"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
3
|
import { SceneElementView } from '../SceneElementView.js';
|
|
4
4
|
import { createMemorySceneHistory } from './createMemorySceneHistory.js';
|
|
5
5
|
import { SceneNavigationProvider } from './SceneNavigationContext.js';
|
|
@@ -7,6 +7,8 @@ import { sceneRoutesFrom } from './sceneRoutesFrom.js';
|
|
|
7
7
|
import { collectOutletOwners } from './collectOutletOwners.js';
|
|
8
8
|
import { SceneOutletContext } from './SceneOutletContext.js';
|
|
9
9
|
import { useSceneHistoryNavigation } from './useSceneHistoryNavigation.js';
|
|
10
|
+
import { SceneNavigationModelProvider } from './region/SceneNavigationModelContext.js';
|
|
11
|
+
import { navigationDestinations } from './region/navigationDestinations.js';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Executes Scene destinations against an in-memory rendered hierarchy: a destination into a nested outlet -
|
|
@@ -14,7 +16,11 @@ import { useSceneHistoryNavigation } from './useSceneHistoryNavigation.js';
|
|
|
14
16
|
* depth; any other screen route replaces the primary region,
|
|
15
17
|
* dialog destinations render dialog content over the screen that opened them, and external destinations
|
|
16
18
|
* only report their resolved action. Every navigation is a history entry.
|
|
17
|
-
*/ function SceneNavigationHost({ screens, dialogs = {}, initialScreen, registry, bindingScope = {}, history, destinations, routes }) {
|
|
19
|
+
*/ function SceneNavigationHost({ screens, dialogs = {}, initialScreen, registry, bindingScope = {}, history, destinations: authoredDestinations, routes, navigationModel, frame }) {
|
|
20
|
+
const destinations = useMemo(()=>authoredDestinations ?? (navigationModel ? navigationDestinations(navigationModel.structure, navigationModel.navigation, navigationModel.screenFor) : undefined), [
|
|
21
|
+
authoredDestinations,
|
|
22
|
+
navigationModel
|
|
23
|
+
]);
|
|
18
24
|
const [memoryHistory] = useState(()=>createMemorySceneHistory());
|
|
19
25
|
const routeTable = useMemo(()=>routes ?? sceneRoutesFrom(Object.keys(screens), destinations), [
|
|
20
26
|
destinations,
|
|
@@ -34,22 +40,23 @@ import { useSceneHistoryNavigation } from './useSceneHistoryNavigation.js';
|
|
|
34
40
|
]);
|
|
35
41
|
const screen = screens[value.primaryScreen];
|
|
36
42
|
const dialog = value.currentDialog ? dialogs[value.currentDialog] : undefined;
|
|
37
|
-
|
|
43
|
+
const outlet = /*#__PURE__*/ jsx("div", {
|
|
44
|
+
"data-scene-outlet": value.primaryScreen === value.currentScreen ? value.currentOutlet ?? 'primary' : 'primary',
|
|
45
|
+
"data-scene-url": value.currentUrl,
|
|
46
|
+
children: screen && /*#__PURE__*/ jsx(SceneElementView, {
|
|
47
|
+
element: screen,
|
|
48
|
+
registry: registry,
|
|
49
|
+
dataContext: bindingScope.dataContext,
|
|
50
|
+
queryResults: bindingScope.queryResults,
|
|
51
|
+
componentOutputs: bindingScope.componentOutputs
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
const page = /*#__PURE__*/ jsx(SceneNavigationProvider, {
|
|
38
55
|
value: value,
|
|
39
56
|
children: /*#__PURE__*/ jsxs(SceneOutletContext.Provider, {
|
|
40
57
|
value: outletContext,
|
|
41
58
|
children: [
|
|
42
|
-
|
|
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
|
-
}),
|
|
59
|
+
frame ? frame(outlet) : outlet,
|
|
53
60
|
dialog && /*#__PURE__*/ jsx("div", {
|
|
54
61
|
role: "dialog",
|
|
55
62
|
"aria-modal": "true",
|
|
@@ -66,6 +73,10 @@ import { useSceneHistoryNavigation } from './useSceneHistoryNavigation.js';
|
|
|
66
73
|
]
|
|
67
74
|
})
|
|
68
75
|
});
|
|
76
|
+
return navigationModel ? /*#__PURE__*/ jsx(SceneNavigationModelProvider, {
|
|
77
|
+
model: navigationModel,
|
|
78
|
+
children: page
|
|
79
|
+
}) : page;
|
|
69
80
|
}
|
|
70
81
|
|
|
71
82
|
export { SceneNavigationHost };
|
|
@@ -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 { 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
|
|
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, 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\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 && <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 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","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","SceneNavigationModelProvider","model"],"mappings":";;;;;;;;;;;;AAoDA;;;;;;AAMC,IACM,SAASA,mBAAAA,CAAoB,EAAEC,OAAO,EAAEC,OAAAA,GAAU,EAAE,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,YAAAA,GAAe,EAAE,EAAEC,OAAO,EAAEC,YAAAA,EAAcC,oBAAoB,EAAEC,MAAM,EAAEC,eAAe,EAAEC,KAAK,EAA4B,EAAA;AAC5M,IAAA,MAAMJ,eAAeK,OAAAA,CACjB,IAAMJ,oBAAAA,KAAyBE,kBAAkBG,sBAAAA,CAAuBH,eAAAA,CAAgBI,SAAS,EAAEJ,gBAAgBK,UAAU,EAAEL,gBAAgBM,SAAS,CAAA,GAAIC,SAAQ,CAAA,EACpK;AAACT,QAAAA,oBAAAA;AAAsBE,QAAAA;AAAgB,KAAA,CA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EAASb,MAAAA;YAAQ1B,QAAAA,EAAUA,QAAAA;AAAUwC,YAAAA,WAAAA,EAAavC,aAAauC,WAAW;AAAEC,YAAAA,YAAAA,EAAcxC,aAAawC,YAAY;AAAEC,YAAAA,gBAAAA,EAAkBzC,aAAayC;;;AAErL,IAAA,MAAMC,qBAAOZ,GAAA,CAACa,uBAAAA,EAAAA;QAAwBrB,KAAAA,EAAOA,KAAAA;gCAAOsB,IAAA,CAACC,mBAAmBC,QAAQ,EAAA;YAACxB,KAAAA,EAAOE,aAAAA;;AACnFlB,gBAAAA,KAAAA,GAAQA,MAAMuB,MAAAA,CAAAA,GAAUA,MAAAA;AACxBF,gBAAAA,MAAAA,kBAAUG,GAAA,CAACC,KAAAA,EAAAA;oBAAIgB,IAAAA,EAAK,QAAA;oBAASC,YAAAA,EAAW,MAAA;AAAOC,oBAAAA,YAAAA,EAAY3B,MAAMM,aAAa;AAAEsB,oBAAAA,mBAAAA,EAAmB5B,MAAMM,aAAa;AACnH,oBAAA,QAAA,gBAAAE,GAAA,CAACO,gBAAAA,EAAAA;wBAAiBC,OAAAA,EAASX,MAAAA;wBAAQ5B,QAAAA,EAAUA,QAAAA;AAAUwC,wBAAAA,WAAAA,EAAavC,aAAauC,WAAW;AAAEC,wBAAAA,YAAAA,EAAcxC,aAAawC,YAAY;AAAEC,wBAAAA,gBAAAA,EAAkBzC,aAAayC;;;;;;AAI9K,IAAA,OAAOpC,gCAAkByB,GAAA,CAACqB,4BAAAA,EAAAA;QAA6BC,KAAAA,EAAO/C,eAAAA;AAAkBqC,QAAAA,QAAAA,EAAAA;AAAuCA,KAAAA,CAAAA,GAAAA,IAAAA;AAC3H;;"}
|
|
@@ -19,4 +19,12 @@ export * from './CoreOutlet';
|
|
|
19
19
|
export * from './SceneOutletContext';
|
|
20
20
|
export * from './collectOutletOwners';
|
|
21
21
|
export * from './placeInOutlet';
|
|
22
|
+
export * from './region/SceneNavigationModel';
|
|
23
|
+
export * from './region/SceneNavigationModelContext';
|
|
24
|
+
export * from './region/NavigationRegionClassNames';
|
|
25
|
+
export * from './region/NavigationRegionView';
|
|
26
|
+
export * from './region/currentModuleOf';
|
|
27
|
+
export * from './region/navigationItemActive';
|
|
28
|
+
export * from './region/navigationItemDestination';
|
|
29
|
+
export * from './region/navigationDestinations';
|
|
22
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC"}
|
|
@@ -19,4 +19,12 @@ export * from './CoreOutlet';
|
|
|
19
19
|
export * from './SceneOutletContext';
|
|
20
20
|
export * from './collectOutletOwners';
|
|
21
21
|
export * from './placeInOutlet';
|
|
22
|
+
export * from './region/SceneNavigationModel';
|
|
23
|
+
export * from './region/SceneNavigationModelContext';
|
|
24
|
+
export * from './region/NavigationRegionClassNames';
|
|
25
|
+
export * from './region/NavigationRegionView';
|
|
26
|
+
export * from './region/currentModuleOf';
|
|
27
|
+
export * from './region/navigationItemActive';
|
|
28
|
+
export * from './region/navigationItemDestination';
|
|
29
|
+
export * from './region/navigationDestinations';
|
|
22
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;A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1
|
+
export interface NavigationRegionClassNames {
|
|
2
|
+
root: string;
|
|
3
|
+
list: string;
|
|
4
|
+
item: string;
|
|
5
|
+
link: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
label: string;
|
|
8
|
+
toggle: string;
|
|
9
|
+
submenu: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const defaultNavigationRegionClassNames: NavigationRegionClassNames;
|
|
12
|
+
//# sourceMappingURL=NavigationRegionClassNames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationRegionClassNames.d.ts","sourceRoot":"","sources":["../../../../navigation/region/NavigationRegionClassNames.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,0BAA0B;IAEvC,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,MAAM,CAAC;IAGb,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,MAAM,CAAC;IAGf,OAAO,EAAE,MAAM,CAAC;CACnB;AAGD,eAAO,MAAM,iCAAiC,EAAE,0BAS/C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/**
|
|
4
|
+
* The class names a {@link NavigationRegionView} puts on its nodes. The renderer carries no look of its own: a package
|
|
5
|
+
* gives the nodes its vocabulary (`blueprint.default` uses its `layout-menu` classes) and a stylesheet does the rest.
|
|
6
|
+
* State is always on data attributes as well - `data-active`, `data-expanded`, `data-read-only`, `data-origin`.
|
|
7
|
+
*/ /** The class names used when a host passes none. */ const defaultNavigationRegionClassNames = {
|
|
8
|
+
root: 'scene-nav',
|
|
9
|
+
list: 'scene-nav-list',
|
|
10
|
+
item: 'scene-nav-item',
|
|
11
|
+
link: 'scene-nav-link',
|
|
12
|
+
icon: 'scene-nav-icon',
|
|
13
|
+
label: 'scene-nav-label',
|
|
14
|
+
toggle: 'scene-nav-toggle',
|
|
15
|
+
submenu: 'scene-nav-submenu'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { defaultNavigationRegionClassNames };
|
|
19
|
+
//# sourceMappingURL=NavigationRegionClassNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationRegionClassNames.js","sources":["../../../../navigation/region/NavigationRegionClassNames.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\n\n/**\n * The class names a {@link NavigationRegionView} puts on its nodes. The renderer carries no look of its own: a package\n * gives the nodes its vocabulary (`blueprint.default` uses its `layout-menu` classes) and a stylesheet does the rest.\n * State is always on data attributes as well - `data-active`, `data-expanded`, `data-read-only`, `data-origin`.\n */\nexport interface NavigationRegionClassNames {\n /** The `nav` landmark. */\n root: string;\n\n /** Each list of items. */\n list: string;\n\n /** Each item's `li`. */\n item: string;\n\n /** The link of an item. */\n link: string;\n\n /** The icon of an item. */\n icon: string;\n\n /** The title of an item. */\n label: string;\n\n /** The button that expands or collapses an item's sub-items. */\n toggle: string;\n\n /** The list of an item's sub-items. */\n submenu: string;\n}\n\n/** The class names used when a host passes none. */\nexport const defaultNavigationRegionClassNames: NavigationRegionClassNames = {\n root: 'scene-nav',\n list: 'scene-nav-list',\n item: 'scene-nav-item',\n link: 'scene-nav-link',\n icon: 'scene-nav-icon',\n label: 'scene-nav-label',\n toggle: 'scene-nav-toggle',\n submenu: 'scene-nav-submenu',\n};\n"],"names":["defaultNavigationRegionClassNames","root","list","item","link","icon","label","toggle","submenu"],"mappings":"AAAA;AACA;AAGA;;;;AAIC,yDA4BM,MAAMA,iCAAAA,GAAgE;IACzEC,IAAAA,EAAM,WAAA;IACNC,IAAAA,EAAM,gBAAA;IACNC,IAAAA,EAAM,gBAAA;IACNC,IAAAA,EAAM,gBAAA;IACNC,IAAAA,EAAM,gBAAA;IACNC,KAAAA,EAAO,iBAAA;IACPC,MAAAA,EAAQ,kBAAA;IACRC,OAAAA,EAAS;AACb;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DestinationReference, NavigationRegionKind } from '@cratis/scene.model';
|
|
3
|
+
import { EffectiveNavItem } from '@cratis/scene.engine';
|
|
4
|
+
import { NavigationRegionClassNames } from './NavigationRegionClassNames';
|
|
5
|
+
import { SceneNavigationModel } from './SceneNavigationModel';
|
|
6
|
+
export interface NavigationRegionViewProps {
|
|
7
|
+
region: NavigationRegionKind;
|
|
8
|
+
module?: string;
|
|
9
|
+
application?: boolean;
|
|
10
|
+
model?: SceneNavigationModel;
|
|
11
|
+
expand?: 'active' | 'all';
|
|
12
|
+
label?: string;
|
|
13
|
+
classNames?: Partial<NavigationRegionClassNames>;
|
|
14
|
+
renderIcon?(icon: string): ReactNode;
|
|
15
|
+
renderAdornment?(item: EffectiveNavItem): ReactNode;
|
|
16
|
+
hrefFor?(destination: DestinationReference, url: string | undefined): string | undefined;
|
|
17
|
+
onActivate?(item: EffectiveNavItem, destination: DestinationReference): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function NavigationRegionView({ region, module, application, model: modelProp, label, expand, classNames, renderIcon, renderAdornment, hrefFor, onActivate }: NavigationRegionViewProps): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=NavigationRegionView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationRegionView.d.ts","sourceRoot":"","sources":["../../../../navigation/region/NavigationRegionView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA6B,SAAS,EAAyC,MAAM,OAAO,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAsB,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAA6B,gBAAgB,EAAkD,MAAM,sBAAsB,CAAC;AAKnI,OAAO,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