@cratis/scene.react 4.27.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/core/coreDescriptors.ts +28 -1
- package/dist/cjs/core/coreDescriptors.js +64 -0
- package/dist/cjs/core/coreDescriptors.js.map +1 -1
- 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/core/coreDescriptors.d.ts.map +1 -1
- package/dist/esm/core/coreDescriptors.js +65 -1
- package/dist/esm/core/coreDescriptors.js.map +1 -1
- 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":"NavigationRegionView.js","sources":["../../../../navigation/region/NavigationRegionView.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 { KeyboardEvent, MouseEvent, ReactNode, useContext, useMemo, useRef, useState } from 'react';\nimport { DestinationReference, NavigationRegionKind, parseIconReference } from '@cratis/scene.model';\nimport { ApplicationStructureIndex, EffectiveNavItem, EffectiveNavigationRegion, effectiveNavigation } from '@cratis/scene.engine';\nimport { SceneIcon } from '../../icons/SceneIcon';\nimport { useIconAdapters } from '../../icons/IconAdapterContext';\nimport { resolveDestination } from '../resolveDestination';\nimport { SceneNavigationContextInternal } from '../SceneNavigationContext';\nimport { NavigationRegionClassNames, defaultNavigationRegionClassNames } from './NavigationRegionClassNames';\nimport { SceneNavigationModel } from './SceneNavigationModel';\nimport { useSceneNavigationModel } from './SceneNavigationModelContext';\nimport { currentModuleOf } from './currentModuleOf';\nimport { navigationItemActive } from './navigationItemActive';\nimport { defaultScreenFor, navigationItemDestination } from './navigationItemDestination';\n\nexport interface NavigationRegionViewProps {\n /** Which region to show. */\n region: NavigationRegionKind;\n\n /**\n * The module to show the region of. When absent the region follows the module of the screen on the page, so\n * navigating to another module recomputes the effective items in place; outside every module it is the application's.\n */\n module?: string;\n\n /** Pins the region to the application level, whatever screen is on the page. */\n application?: boolean;\n\n /** What to resolve against; the {@link SceneNavigationModelProvider}'s when absent. */\n model?: SceneNavigationModel;\n\n /**\n * Which sub-items of a sidebar show: only those of the parents of the active item and of items the user expanded\n * (`active`, the default), or all of them (`all`) - a design layer wants the whole hierarchy.\n */\n expand?: 'active' | 'all';\n\n /** The accessible name of the `nav` landmark. */\n label?: string;\n\n /** The class names to put on the nodes. */\n classNames?: Partial<NavigationRegionClassNames>;\n\n /**\n * Draws an item's icon from its qualified reference. By default the icon is drawn through the adapters of the\n * enclosing `IconAdapterProvider`, or not at all without one.\n */\n renderIcon?(icon: string): ReactNode;\n\n /**\n * Content a host adds to an item after its title - Studio design mode draws the lock of an inherited item here; Stage\n * ignores it. The item carries `origin` and `readOnly`.\n */\n renderAdornment?(item: EffectiveNavItem): ReactNode;\n\n /** The href of an item's link, for opening it in a new tab; the hash route of the destination by default. */\n hrefFor?(destination: DestinationReference, url: string | undefined): string | undefined;\n\n /** Called after an item has been activated and the host has navigated. */\n onActivate?(item: EffectiveNavItem, destination: DestinationReference): void;\n}\n\nfunction itemKey(path: string[]): string {\n return path.join('/');\n}\n\nfunction containsActive(item: EffectiveNavItem, isActive: (item: EffectiveNavItem) => boolean): boolean {\n return isActive(item) || (item.children ?? []).some(child => containsActive(child, isActive));\n}\n\n/**\n * Renders the effective navigation of one region - a topbar or a sidebar - for the application or a module.\n *\n * - **Items** come from `effectiveNavigation`, so inherit/extend/override is already applied; nothing here re-implements\n * it. A topbar is flat; a sidebar nests, collapses, and expands the parents of the active item.\n * - **Active state** follows what the navigation host shows: an item is active (`aria-current`, `data-active`) when the\n * screen it opens is the one in its slot, so items rendering into different slots are active at once.\n * - **Activation** goes through the enclosing navigation host (`navigate`), which renders the target in the item's slot -\n * the `outlet` of the destination; outside a host it announces `cratis.scene.navigate`.\n * - **Authorization**: `isVisible` of the model hides items, it does not disable them.\n * - **Keyboard**: arrows (left/right in a topbar, up/down in a sidebar), Home and End move between items; in a sidebar\n * right expands and left collapses (or goes to the parent).\n *\n * Nothing here draws design chrome: items carry `data-read-only` and `data-origin` for a design layer to style.\n */\nexport function NavigationRegionView({ region, module, application = false, model: modelProp, label, expand = 'active', classNames, renderIcon, renderAdornment, hrefFor, onActivate }: NavigationRegionViewProps) {\n const contextModel = useSceneNavigationModel();\n const model = modelProp ?? contextModel;\n if (!model) throw new Error('NavigationRegionView needs a navigation model: pass `model` or render it inside a SceneNavigationModelProvider.');\n\n const navigation = useContext(SceneNavigationContextInternal);\n const adapters = useIconAdapters();\n const names = { ...defaultNavigationRegionClassNames, ...classNames };\n const index = useMemo(() => model.structure instanceof ApplicationStructureIndex ? model.structure : new ApplicationStructureIndex(model.structure), [model.structure]);\n const screenFor = model.screenFor ?? defaultScreenFor;\n\n const sidebar = region === NavigationRegionKind.Sidebar;\n const placement = useMemo(() => ({ primaryScreen: navigation?.primaryScreen, outlets: navigation?.outlets ?? {} }), [navigation?.outlets, navigation?.primaryScreen]);\n const scope = application ? undefined : module ?? currentModuleOf(index, placement.primaryScreen);\n const resolved: EffectiveNavigationRegion = useMemo(() => effectiveNavigation(index, model.navigation, scope, region), [index, model.navigation, scope, region]);\n\n const isActive = (item: EffectiveNavItem) => placement.primaryScreen !== undefined && navigationItemActive(item, { primaryScreen: placement.primaryScreen, outlets: placement.outlets }, screenFor, !sidebar);\n const isVisible = model.isVisible ?? (() => true);\n const visible = useMemo(() => {\n const keep = (items: EffectiveNavItem[]): EffectiveNavItem[] => items.filter(isVisible).map(item => item.children ? { ...item, children: keep(item.children) } : item);\n return keep(resolved.items);\n }, [resolved, model.isVisible]);\n\n const activeKey = JSON.stringify([placement.primaryScreen, placement.outlets, scope]);\n const [toggled, setToggled] = useState<{ key: string; state: Record<string, boolean> }>({ key: activeKey, state: {} });\n const overrides = toggled.key === activeKey ? toggled.state : {};\n const [focused, setFocused] = useState<string>();\n const root = useRef<HTMLElement>(null);\n\n const isExpanded = (item: EffectiveNavItem, key: string) => overrides[key] ?? (expand === 'all' || containsActive(item, isActive));\n const toggle = (key: string, expanded: boolean) => setToggled({ key: activeKey, state: { ...overrides, [key]: expanded } });\n\n const activate = (item: EffectiveNavItem) => {\n const destination = navigationItemDestination(item, screenFor);\n if (destination === undefined) return;\n if (navigation) {\n navigation.navigate(destination);\n } else {\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { targetScreen: destination.screen ?? '', destination, item } }));\n }\n\n onActivate?.(item, destination);\n };\n\n const links = () => Array.from(root.current?.querySelectorAll<HTMLElement>('[data-scene-nav-link]') ?? []);\n const focusLink = (element: HTMLElement | undefined) => {\n if (!element) return;\n setFocused(element.getAttribute('data-scene-nav-link') ?? undefined);\n element.focus();\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n const all = links();\n const position = all.findIndex(link => link === document.activeElement);\n if (position < 0) return;\n const next = sidebar ? 'ArrowDown' : 'ArrowRight';\n const previous = sidebar ? 'ArrowUp' : 'ArrowLeft';\n const current = all[position];\n const key = current.getAttribute('data-scene-nav-link')!;\n const owner = current.closest('[data-scene-nav-item]') as HTMLElement | null;\n const hasChildren = owner?.getAttribute('data-scene-nav-parent') === 'true';\n const expanded = owner?.getAttribute('data-expanded') === 'true';\n\n let target: HTMLElement | undefined;\n if (event.key === next) target = all[Math.min(position + 1, all.length - 1)];\n else if (event.key === previous) target = all[Math.max(position - 1, 0)];\n else if (event.key === 'Home') target = all[0];\n else if (event.key === 'End') target = all[all.length - 1];\n else if (sidebar && event.key === 'ArrowRight' && hasChildren) {\n if (!expanded) toggle(key, true);\n else target = all[position + 1];\n } else if (sidebar && event.key === 'ArrowLeft') {\n if (hasChildren && expanded) toggle(key, false);\n else {\n const parent = owner?.parentElement?.closest('[data-scene-nav-item]')?.querySelector<HTMLElement>(':scope > [data-scene-nav-link]');\n if (parent) target = parent;\n }\n } else return;\n\n event.preventDefault();\n focusLink(target);\n };\n\n const tabStop = focused ?? undefined;\n const firstActive = (items: EffectiveNavItem[], path: string[]): string | undefined => {\n for (const item of items) {\n const key = itemKey([...path, item.id]);\n if (isActive(item)) return key;\n const inner = firstActive(item.children ?? [], [...path, item.id]);\n if (inner !== undefined && isExpanded(item, key)) return inner;\n }\n\n return undefined;\n };\n const firstKey = visible.length > 0 ? itemKey([visible[0].id]) : undefined;\n const stop = tabStop ?? firstActive(visible, []) ?? firstKey;\n\n const icon = (item: EffectiveNavItem) => {\n if (item.icon === undefined) return null;\n const drawn = renderIcon ? renderIcon(item.icon) : adapters ? (() => {\n const reference = parseIconReference(item.icon!);\n return reference ? <SceneIcon reference={reference} adapters={adapters} /> : null;\n })() : null;\n return drawn === null ? null : <span className={names.icon} aria-hidden='true' data-scene-icon={item.icon}>{drawn}</span>;\n };\n\n const renderItems = (items: EffectiveNavItem[], path: string[], level: number): ReactNode => items.map(item => {\n const key = itemKey([...path, item.id]);\n const destination = navigationItemDestination(item, screenFor);\n const active = isActive(item);\n const children = item.children ?? [];\n const parent = sidebar && children.length > 0;\n const expanded = parent && isExpanded(item, key);\n const url = destination ? resolveDestination(destination).url : undefined;\n const href = destination ? (hrefFor ? hrefFor(destination, url) : url ? `#/${url}` : undefined) : undefined;\n const onClick = (event: MouseEvent) => {\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0) return;\n event.preventDefault();\n if (destination) activate(item);\n else if (parent) toggle(key, !expanded);\n };\n const content = <>\n {icon(item)}\n <span className={names.label}>{item.title}</span>\n {renderAdornment?.(item)}\n </>;\n\n return <li key={item.id} className={names.item} data-scene-nav-item={item.id} data-scene-nav-parent={parent ? 'true' : undefined}\n data-active={active} data-active-descendant={!active && parent && children.some(child => containsActive(child, isActive)) ? true : undefined} data-expanded={parent ? expanded : undefined} data-origin={item.origin} data-read-only={item.readOnly}\n data-slot={item.slot} data-level={level}>\n {destination || parent\n ? <a className={names.link} href={href ?? '#'} data-scene-nav-link={key} aria-current={active ? 'page' : undefined}\n aria-expanded={parent && !destination ? expanded : undefined} tabIndex={key === stop ? 0 : -1}\n onClick={onClick} onFocus={() => setFocused(key)}>{content}</a>\n : <span className={names.link} aria-disabled='true' data-scene-nav-link={key} tabIndex={-1}>{content}</span>}\n {parent && <button type='button' className={names.toggle} tabIndex={-1} aria-expanded={expanded} aria-controls={`${key}-items`}\n aria-label={`${expanded ? 'Collapse' : 'Expand'} ${item.title}`} onClick={() => toggle(key, !expanded)} />}\n {parent && expanded && <ul id={`${key}-items`} className={`${names.list} ${names.submenu}`}>{renderItems(children, [...path, item.id], level + 1)}</ul>}\n </li>;\n });\n\n return <nav ref={root} className={names.root} aria-label={label ?? (sidebar ? 'Sidebar' : 'Topbar')} data-scene-nav-region={region}\n data-scene-nav-sources={resolved.sources.kind} data-scene-nav-sources-label={resolved.sources.label} data-scene-nav-module={scope}\n data-scene-nav-mode={resolved.mode} onKeyDown={onKeyDown}>\n <ul className={names.list}>{renderItems(visible, [], 0)}</ul>\n </nav>;\n}\n"],"names":["itemKey","path","join","containsActive","item","isActive","children","some","child","NavigationRegionView","region","module","application","model","modelProp","label","expand","classNames","renderIcon","renderAdornment","hrefFor","onActivate","contextModel","useSceneNavigationModel","Error","navigation","useContext","SceneNavigationContextInternal","adapters","useIconAdapters","names","defaultNavigationRegionClassNames","index","useMemo","structure","ApplicationStructureIndex","screenFor","defaultScreenFor","sidebar","NavigationRegionKind","Sidebar","placement","primaryScreen","outlets","scope","undefined","currentModuleOf","resolved","effectiveNavigation","navigationItemActive","isVisible","visible","keep","items","filter","map","activeKey","JSON","stringify","toggled","setToggled","useState","key","state","overrides","focused","setFocused","root","useRef","isExpanded","toggle","expanded","activate","destination","navigationItemDestination","navigate","globalThis","dispatchEvent","CustomEvent","detail","targetScreen","screen","links","Array","from","current","querySelectorAll","focusLink","element","getAttribute","focus","onKeyDown","event","all","position","findIndex","link","document","activeElement","next","previous","owner","closest","hasChildren","target","Math","min","length","max","parent","parentElement","querySelector","preventDefault","tabStop","firstActive","id","inner","firstKey","stop","icon","drawn","reference","parseIconReference","_jsx","SceneIcon","span","className","aria-hidden","data-scene-icon","renderItems","level","active","url","resolveDestination","href","onClick","metaKey","ctrlKey","shiftKey","button","content","_jsxs","_Fragment","title","li","data-scene-nav-item","data-scene-nav-parent","data-active","data-active-descendant","data-expanded","data-origin","origin","data-read-only","readOnly","data-slot","slot","data-level","a","data-scene-nav-link","aria-current","aria-expanded","tabIndex","onFocus","aria-disabled","type","aria-controls","aria-label","ul","list","submenu","nav","ref","data-scene-nav-region","data-scene-nav-sources","sources","kind","data-scene-nav-sources-label","data-scene-nav-module","data-scene-nav-mode","mode"],"mappings":";;;;;;;;;;;;;;;;AAgEA,SAASA,QAAQC,IAAc,EAAA;IAC3B,OAAOA,IAAAA,CAAKC,IAAI,CAAC,GAAA,CAAA;AACrB;AAEA,SAASC,cAAAA,CAAeC,IAAsB,EAAEC,QAA6C,EAAA;AACzF,IAAA,OAAOA,QAAAA,CAASD,IAAAA,CAAAA,IAAS,CAACA,KAAKE,QAAQ,IAAI,EAAC,EAAGC,IAAI,CAACC,CAAAA,KAAAA,GAASL,eAAeK,KAAAA,EAAOH,QAAAA,CAAAA,CAAAA;AACvF;AAEA;;;;;;;;;;;;;;AAcC,IACM,SAASI,oBAAAA,CAAqB,EAAEC,MAAM,EAAEC,MAAM,EAAEC,WAAAA,GAAc,KAAK,EAAEC,KAAAA,EAAOC,SAAS,EAAEC,KAAK,EAAEC,MAAAA,GAAS,QAAQ,EAAEC,UAAU,EAAEC,UAAU,EAAEC,eAAe,EAAEC,OAAO,EAAEC,UAAU,EAA6B,EAAA;AAC7M,IAAA,MAAMC,YAAAA,GAAeC,mDAAAA,EAAAA;AACrB,IAAA,MAAMV,QAAQC,SAAAA,IAAaQ,YAAAA;AAC3B,IAAA,IAAI,CAACT,KAAAA,EAAO,MAAM,IAAIW,KAAA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AAC,EAAE1I,KAAAA,CAAM2I,OAAO,CAAA,CAAE;AAAGxC,wBAAAA,QAAAA,EAAAA,WAAAA,CAAY3H,QAAAA,EAAU;AAAIL,4BAAAA,GAAAA,IAAAA;AAAMG,4BAAAA,IAAAA,CAAK+G;AAAG,yBAAA,EAAEe,KAAAA,GAAQ,CAAA;;;AAVnI9H,aAAAA,EAAAA,IAAAA,CAAK+G,EAAE,CAAA;AAY3B,QAAA,CAAA,CAAA;AAEA,IAAA,qBAAOQ,cAAA,CAAC+C,KAAAA,EAAAA;QAAIC,GAAAA,EAAKxG,IAAAA;AAAM2D,QAAAA,SAAAA,EAAWhG,MAAMqC,IAAI;AAAEmG,QAAAA,YAAAA,EAAYvJ,KAAAA,KAAUuB,OAAAA,GAAU,SAAA,GAAY,QAAO,CAAA;QAAIsI,uBAAAA,EAAuBlK,MAAAA;QACxHmK,wBAAAA,EAAwB9H,QAAAA,CAAS+H,OAAO,CAACC,IAAI;QAAEC,8BAAAA,EAA8BjI,QAAAA,CAAS+H,OAAO,CAAC/J,KAAK;QAAEkK,uBAAAA,EAAuBrI,KAAAA;AAC5HsI,QAAAA,qBAAAA,EAAqBnI,SAASoI,IAAI;QAAExF,SAAAA,EAAWA,SAAAA;AAC/C,QAAA,QAAA,gBAAAgC,cAAA,CAAC4C,IAAAA,EAAAA;AAAGzC,YAAAA,SAAAA,EAAWhG,MAAM0I,IAAI;sBAAGvC,WAAAA,CAAY9E,OAAAA,EAAS,EAAE,EAAE,CAAA;;;AAE7D;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const Context = /*#__PURE__*/ react.createContext(undefined);
|
|
7
|
+
/**
|
|
8
|
+
* Supplies the application structure and navigation every navigation region below it renders - the topbar and sidebar
|
|
9
|
+
* components of a shell find what to show here, so a screen document does not carry the application's navigation.
|
|
10
|
+
*/ function SceneNavigationModelProvider({ model, children }) {
|
|
11
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Context.Provider, {
|
|
12
|
+
value: model,
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/** The navigation model in scope, or undefined outside a {@link SceneNavigationModelProvider}. */ function useSceneNavigationModel() {
|
|
17
|
+
return react.useContext(Context);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.SceneNavigationModelProvider = SceneNavigationModelProvider;
|
|
21
|
+
exports.useSceneNavigationModel = useSceneNavigationModel;
|
|
22
|
+
//# sourceMappingURL=SceneNavigationModelContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneNavigationModelContext.js","sources":["../../../../navigation/region/SceneNavigationModelContext.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 { SceneNavigationModel } from './SceneNavigationModel';\n\nconst Context = createContext<SceneNavigationModel | undefined>(undefined);\n\nexport interface SceneNavigationModelProviderProps {\n model: SceneNavigationModel;\n children?: ReactNode;\n}\n\n/**\n * Supplies the application structure and navigation every navigation region below it renders - the topbar and sidebar\n * components of a shell find what to show here, so a screen document does not carry the application's navigation.\n */\nexport function SceneNavigationModelProvider({ model, children }: SceneNavigationModelProviderProps) {\n return <Context.Provider value={model}>{children}</Context.Provider>;\n}\n\n/** The navigation model in scope, or undefined outside a {@link SceneNavigationModelProvider}. */\nexport function useSceneNavigationModel(): SceneNavigationModel | undefined {\n return useContext(Context);\n}\n"],"names":["Context","createContext","undefined","SceneNavigationModelProvider","model","children","_jsx","Provider","value","useSceneNavigationModel","useContext"],"mappings":";;;;;AAMA,MAAMA,wBAAUC,mBAAAA,CAAgDC,SAAAA,CAAAA;AAOhE;;;AAGC,IACM,SAASC,4BAAAA,CAA6B,EAAEC,KAAK,EAAEC,QAAQ,EAAqC,EAAA;IAC/F,qBAAOC,cAAA,CAACN,QAAQO,QAAQ,EAAA;QAACC,KAAAA,EAAOJ,KAAAA;AAAQC,QAAAA,QAAAA,EAAAA;;AAC5C;AAEA,mGACO,SAASI,uBAAAA,GAAAA;AACZ,IAAA,OAAOC,gBAAAA,CAAWV,OAAAA,CAAAA;AACtB;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* The module the screen on the page belongs to: the screen's qualified id starts with its module id, so `sales.orders`
|
|
7
|
+
* is in `sales`. Undefined for a screen outside every module - the application level.
|
|
8
|
+
*/ function currentModuleOf(index, screen) {
|
|
9
|
+
if (screen === undefined) return undefined;
|
|
10
|
+
const module = screen.split('.')[0];
|
|
11
|
+
return index.findModule(module) ? module : undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.currentModuleOf = currentModuleOf;
|
|
15
|
+
//# sourceMappingURL=currentModuleOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currentModuleOf.js","sources":["../../../../navigation/region/currentModuleOf.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 { ApplicationStructureIndex } from '@cratis/scene.engine';\n\n/**\n * The module the screen on the page belongs to: the screen's qualified id starts with its module id, so `sales.orders`\n * is in `sales`. Undefined for a screen outside every module - the application level.\n */\nexport function currentModuleOf(index: ApplicationStructureIndex, screen: string | undefined): string | undefined {\n if (screen === undefined) return undefined;\n const module = screen.split('.')[0];\n return index.findModule(module) ? module : undefined;\n}\n"],"names":["currentModuleOf","index","screen","undefined","module","split","findModule"],"mappings":";;AAAA;AACA;AAIA;;;AAGC,IACM,SAASA,eAAAA,CAAgBC,KAAgC,EAAEC,MAA0B,EAAA;IACxF,IAAIA,MAAAA,KAAWC,WAAW,OAAOA,SAAAA;AACjC,IAAA,MAAMC,SAASF,MAAAA,CAAOG,KAAK,CAAC,GAAA,CAAI,CAAC,CAAA,CAAE;AACnC,IAAA,OAAOJ,KAAAA,CAAMK,UAAU,CAACF,MAAAA,CAAAA,GAAUA,MAAAA,GAASD,SAAAA;AAC/C;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
5
|
+
var navigationItemDestination = require('./navigationItemDestination.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
function flatten(items) {
|
|
10
|
+
return items.flatMap((item)=>[
|
|
11
|
+
item,
|
|
12
|
+
...flatten(item.children ?? [])
|
|
13
|
+
]);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Every destination the navigation of the application and of each module can lead to, once each: what a
|
|
17
|
+
* `SceneNavigationHost` is given as `destinations` so deep links to a navigation item resolve, and an item that renders
|
|
18
|
+
* into a nested outlet is placed with the screen that declares the outlet.
|
|
19
|
+
*/ function navigationDestinations(structure, navigation, screenFor) {
|
|
20
|
+
const index = structure instanceof scene_engine.ApplicationStructureIndex ? structure : new scene_engine.ApplicationStructureIndex(structure);
|
|
21
|
+
const modules = [
|
|
22
|
+
undefined,
|
|
23
|
+
...index.structure.modules.map((module)=>module.id)
|
|
24
|
+
];
|
|
25
|
+
const seen = new Set();
|
|
26
|
+
const destinations = [];
|
|
27
|
+
for (const module of modules){
|
|
28
|
+
for (const region of [
|
|
29
|
+
scene_model.NavigationRegionKind.Topbar,
|
|
30
|
+
scene_model.NavigationRegionKind.Sidebar
|
|
31
|
+
]){
|
|
32
|
+
for (const item of flatten(scene_engine.effectiveNavigation(index, navigation, module, region).items)){
|
|
33
|
+
const destination = navigationItemDestination.navigationItemDestination(item, screenFor);
|
|
34
|
+
if (destination === undefined) continue;
|
|
35
|
+
const key = JSON.stringify(destination);
|
|
36
|
+
if (seen.has(key)) continue;
|
|
37
|
+
seen.add(key);
|
|
38
|
+
destinations.push(destination);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return destinations;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.navigationDestinations = navigationDestinations;
|
|
46
|
+
//# sourceMappingURL=navigationDestinations.js.map
|
|
@@ -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;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreDescriptors.d.ts","sourceRoot":"","sources":["../../../core/coreDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"coreDescriptors.d.ts","sourceRoot":"","sources":["../../../core/coreDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAA0D,MAAM,qBAAqB,CAAC;AA4GlH,eAAO,MAAM,eAAe,EAAE,mBAAmB,EAAqE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropertyValueType } from '@cratis/scene.model';
|
|
1
|
+
import { PropertyValueType, PropertyEditorKind, ToolbarEmphasis } from '@cratis/scene.model';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@cratis/scene.engine';
|
|
@@ -87,6 +87,70 @@ const key = (name)=>componentRegistryKey('core', name);
|
|
|
87
87
|
}
|
|
88
88
|
]
|
|
89
89
|
},
|
|
90
|
+
{
|
|
91
|
+
component: key('toolbarItem'),
|
|
92
|
+
displayName: 'Toolbar button',
|
|
93
|
+
description: 'One toolbar button. An Action button invokes a state change slice and opens it as a task dialog over the page; a button with no slice is allowed while designing and is flagged.',
|
|
94
|
+
properties: [
|
|
95
|
+
{
|
|
96
|
+
path: 'label',
|
|
97
|
+
label: 'Title',
|
|
98
|
+
group: 'Content',
|
|
99
|
+
valueType: PropertyValueType.String,
|
|
100
|
+
default: 'Button'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
path: 'slice',
|
|
104
|
+
label: 'Slice to invoke',
|
|
105
|
+
group: 'Behavior',
|
|
106
|
+
valueType: PropertyValueType.String,
|
|
107
|
+
editorKind: PropertyEditorKind.Slice,
|
|
108
|
+
editorOptions: {
|
|
109
|
+
kinds: [
|
|
110
|
+
'StateChange'
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
description: 'Only State Change slices can be picked. State Views and Automations never take user input, so they are listed as unavailable.'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
path: 'emphasis',
|
|
117
|
+
label: 'Emphasis',
|
|
118
|
+
group: 'Appearance',
|
|
119
|
+
valueType: PropertyValueType.Enum,
|
|
120
|
+
default: ToolbarEmphasis.Secondary,
|
|
121
|
+
editorKind: PropertyEditorKind.Enum,
|
|
122
|
+
choices: [
|
|
123
|
+
{
|
|
124
|
+
value: ToolbarEmphasis.Primary,
|
|
125
|
+
label: 'Primary'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
value: ToolbarEmphasis.Secondary,
|
|
129
|
+
label: 'Secondary'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
value: ToolbarEmphasis.Quiet,
|
|
133
|
+
label: 'Quiet'
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
path: 'icon',
|
|
139
|
+
label: 'Icon',
|
|
140
|
+
group: 'Appearance',
|
|
141
|
+
valueType: PropertyValueType.Icon,
|
|
142
|
+
editorKind: 'iconPicker'
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
path: 'target',
|
|
146
|
+
label: 'Command (legacy)',
|
|
147
|
+
group: 'Behavior',
|
|
148
|
+
valueType: PropertyValueType.String,
|
|
149
|
+
editorKind: 'stateChangeReference',
|
|
150
|
+
description: 'A hand-typed command for a button that has no slice. It is converted to the slice that accepts the command when exactly one does; prefer a slice.'
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
90
154
|
{
|
|
91
155
|
component: key('column'),
|
|
92
156
|
displayName: 'Table column',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreDescriptors.js","sources":["../../../core/coreDescriptors.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey, describeComponents } from '../packages';\nimport { coreComponentMetadata } from './coreComponentMetadata';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nconst describedCore: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('outlet'),\n displayName: 'Outlet',\n description: 'A named region another screen opens into. Placing a screen here keeps this screen on the page, and the placed screen may declare outlets of its own.',\n properties: [{ path: 'name', label: 'Name', group: 'Navigation', valueType: PropertyValueType.String, constraints: { required: true } }],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n\n/** The `core` package's descriptors: the hand-written ones above with every component's category, icon, keywords and design mode (CMP1). */\nexport const coreDescriptors: ComponentDescriptor[] = describeComponents('core', describedCore, coreComponentMetadata);"],"names":["key","name","componentRegistryKey","describedCore","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","minimumLength","Icon","Destination","coreDescriptors","describeComponents","coreComponentMetadata"],"mappings":";;;;;;;;;;;AAAA;AACA;AAMA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;AAMC,IACD,MAAME,aAAAA,GAAuC;AACzC,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QA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":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentDescriptor, PropertyEditorKind, PropertyValueType, ToolbarEmphasis } from '@cratis/scene.model';\nimport { componentRegistryKey, describeComponents } from '../packages';\nimport { coreComponentMetadata } from './coreComponentMetadata';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nconst describedCore: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('toolbarItem'),\n displayName: 'Toolbar button',\n description: 'One toolbar button. An Action button invokes a state change slice and opens it as a task dialog over the page; a button with no slice is allowed while designing and is flagged.',\n properties: [\n { path: 'label', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Button' },\n {\n path: 'slice', label: 'Slice to invoke', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: PropertyEditorKind.Slice, editorOptions: { kinds: ['StateChange'] },\n description: 'Only State Change slices can be picked. State Views and Automations never take user input, so they are listed as unavailable.',\n },\n {\n path: 'emphasis', label: 'Emphasis', group: 'Appearance', valueType: PropertyValueType.Enum, default: ToolbarEmphasis.Secondary,\n editorKind: PropertyEditorKind.Enum,\n choices: [\n { value: ToolbarEmphasis.Primary, label: 'Primary' },\n { value: ToolbarEmphasis.Secondary, label: 'Secondary' },\n { value: ToolbarEmphasis.Quiet, label: 'Quiet' },\n ],\n },\n { path: 'icon', label: 'Icon', group: 'Appearance', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n {\n path: 'target', label: 'Command (legacy)', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'stateChangeReference',\n description: 'A hand-typed command for a button that has no slice. It is converted to the slice that accepts the command when exactly one does; prefer a slice.',\n },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('outlet'),\n displayName: 'Outlet',\n description: 'A named region another screen opens into. Placing a screen here keeps this screen on the page, and the placed screen may declare outlets of its own.',\n properties: [{ path: 'name', label: 'Name', group: 'Navigation', valueType: PropertyValueType.String, constraints: { required: true } }],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n\n/** The `core` package's descriptors: the hand-written ones above with every component's category, icon, keywords and design mode (CMP1). */\nexport const coreDescriptors: ComponentDescriptor[] = describeComponents('core', describedCore, coreComponentMetadata);"],"names":["key","name","componentRegistryKey","describedCore","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","PropertyEditorKind","Slice","editorOptions","kinds","Enum","ToolbarEmphasis","Secondary","choices","value","Primary","Quiet","Icon","minimumLength","Destination","coreDescriptors","describeComponents","coreComponentMetadata"],"mappings":";;;;;;;;;;;AAAA;AACA;AAMA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;AAMC,IACD,MAAME,aAAAA,GAAuC;AACzC,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC;AAAO,aAAA;AACvF,YAAA;gBACIL,IAAAA,EAAM,SAAA;gBAAWC,KAAAA,EAAO,SAAA;gBAA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AA,SAAAA,EAAWC,kBAAkBO,UAAU;AAAEL,gBAAAA,OAAAA,EAAS,EAAE;gBACrGM,IAAAA,EAAM;oBACFX,KAAAA,EAAO,iBAAA;oBACPF,UAAAA,EAAY;AACR,wBAAA;4BAAEC,IAAAA,EAAM,OAAA;4BAASC,KAAAA,EAAO,OAAA;4BAASC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;4BAAEI,WAAAA,EAAa;gCAAEC,QAAAA,EAAU,IAAA;gCAAMe,aAAAA,EAAe;AAAE;AAAE,yBAAA;AAC1I,wBAAA;4BAAEzB,IAAAA,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBoB,IAAI;4BAAEhB,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBsB,WAAW;4BAAElB,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;AACH,CAAA;AAED,6IACO,MAAMiB,kBAAyCC,kBAAAA,CAAmB,MAAA,EAAQhC,eAAeiC,qBAAAA;;"}
|
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,CAAA;AAC3C,IAAA,MAAM,CAACQ,aAAAA,CAAc,GAAGC,QAAAA,CAAS,IAAMC,wBAAAA,EAAAA,CAAAA;IACvC,MAAMC,UAAAA,GAAaT,QAAQ,IAAMH,MAAAA,IAAUa,gBAAgBC,MAAAA,CAAOC,IAAI,CAACvB,OAAAA,CAAAA,EAAUM,YAAAA,CAAAA,EAAe;AAACA,QAAAA,YAAAA;AAAcE,QAAAA,MAAAA;AAAQR,QAAAA;AAAQ,KAAA,CAAA;AAC/H,IAAA,MAAMwB,YAAAA,GAAeb,OAAAA,CAAQ,IAAMc,mBAAAA,CAAoBzB,OAAAA,CAAAA,EAAU;AAACA,QAAAA;AAAQ,KAAA,CAAA;AAC1E,IAAA,MAAM0B,QAAQC,yBAAAA,CAA0BtB,OAAAA,IAAWY,eAAeG,UAAAA,EAAYlB,aAAAA,EAAeE,cAAcoB,YAAAA,EAAclB,YAAAA,CAAAA;IACzH,MAAMsB,aAAAA,GAAgBjB,OAAAA,CAAQ,KAAO;AAAEX,YAAAA,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,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
|