@cohesivesystems/presentation-react 0.1.0-alpha.1
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/LICENSE +55 -0
- package/dist/collection-chrome-slot-renderer-registry.d.ts +12 -0
- package/dist/collection-chrome-slot-renderer-registry.d.ts.map +1 -0
- package/dist/collection-chrome-slot-renderer-registry.js +12 -0
- package/dist/collection-chrome-slot-renderer-registry.js.map +1 -0
- package/dist/collection-selection-state-context.d.ts +6 -0
- package/dist/collection-selection-state-context.d.ts.map +1 -0
- package/dist/collection-selection-state-context.js +25 -0
- package/dist/collection-selection-state-context.js.map +1 -0
- package/dist/collection-selection-state.d.ts +3 -0
- package/dist/collection-selection-state.d.ts.map +1 -0
- package/dist/collection-selection-state.js +52 -0
- package/dist/collection-selection-state.js.map +1 -0
- package/dist/document-workspace-runtime.d.ts +262 -0
- package/dist/document-workspace-runtime.d.ts.map +1 -0
- package/dist/document-workspace-runtime.js +699 -0
- package/dist/document-workspace-runtime.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/input-form-endpoint-runtime.d.ts +140 -0
- package/dist/input-form-endpoint-runtime.d.ts.map +1 -0
- package/dist/input-form-endpoint-runtime.js +280 -0
- package/dist/input-form-endpoint-runtime.js.map +1 -0
- package/dist/local-flow-state-data-source-projection.d.ts +21 -0
- package/dist/local-flow-state-data-source-projection.d.ts.map +1 -0
- package/dist/local-flow-state-data-source-projection.js +65 -0
- package/dist/local-flow-state-data-source-projection.js.map +1 -0
- package/dist/navigation-runtime-context.d.ts +22 -0
- package/dist/navigation-runtime-context.d.ts.map +1 -0
- package/dist/navigation-runtime-context.js +23 -0
- package/dist/navigation-runtime-context.js.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts +20 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.js +9 -0
- package/dist/navigation-shell-frame-renderer-registry.js.map +1 -0
- package/dist/navigation-shell-region-component-registry.d.ts +50 -0
- package/dist/navigation-shell-region-component-registry.d.ts.map +1 -0
- package/dist/navigation-shell-region-component-registry.js +44 -0
- package/dist/navigation-shell-region-component-registry.js.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts +22 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.js +9 -0
- package/dist/navigation-shell-slot-renderer-registry.js.map +1 -0
- package/dist/page-host-projection.d.ts +127 -0
- package/dist/page-host-projection.d.ts.map +1 -0
- package/dist/page-host-projection.js +59 -0
- package/dist/page-host-projection.js.map +1 -0
- package/dist/page-host-renderer-registry.d.ts +72 -0
- package/dist/page-host-renderer-registry.d.ts.map +1 -0
- package/dist/page-host-renderer-registry.js +63 -0
- package/dist/page-host-renderer-registry.js.map +1 -0
- package/dist/presentation-action-group-runtime-options.d.ts +36 -0
- package/dist/presentation-action-group-runtime-options.d.ts.map +1 -0
- package/dist/presentation-action-group-runtime-options.js +50 -0
- package/dist/presentation-action-group-runtime-options.js.map +1 -0
- package/dist/presentation-action-runtime.d.ts +52 -0
- package/dist/presentation-action-runtime.d.ts.map +1 -0
- package/dist/presentation-action-runtime.js +78 -0
- package/dist/presentation-action-runtime.js.map +1 -0
- package/dist/presentation-data-source-binding-runtime.d.ts +3 -0
- package/dist/presentation-data-source-binding-runtime.d.ts.map +1 -0
- package/dist/presentation-data-source-binding-runtime.js +65 -0
- package/dist/presentation-data-source-binding-runtime.js.map +1 -0
- package/dist/presentation-data-source-binding.d.ts +12 -0
- package/dist/presentation-data-source-binding.d.ts.map +1 -0
- package/dist/presentation-data-source-binding.js +13 -0
- package/dist/presentation-data-source-binding.js.map +1 -0
- package/dist/presentation-flow-runtime.d.ts +139 -0
- package/dist/presentation-flow-runtime.d.ts.map +1 -0
- package/dist/presentation-flow-runtime.js +514 -0
- package/dist/presentation-flow-runtime.js.map +1 -0
- package/dist/presentation-module-context.d.ts +4 -0
- package/dist/presentation-module-context.d.ts.map +1 -0
- package/dist/presentation-module-context.js +6 -0
- package/dist/presentation-module-context.js.map +1 -0
- package/dist/presentation-module-provider.d.ts +7 -0
- package/dist/presentation-module-provider.d.ts.map +1 -0
- package/dist/presentation-module-provider.js +7 -0
- package/dist/presentation-module-provider.js.map +1 -0
- package/dist/presentation-projection-diagnostics-context.d.ts +8 -0
- package/dist/presentation-projection-diagnostics-context.d.ts.map +1 -0
- package/dist/presentation-projection-diagnostics-context.js +3 -0
- package/dist/presentation-projection-diagnostics-context.js.map +1 -0
- package/dist/presentation-projection-diagnostics-hooks.d.ts +4 -0
- package/dist/presentation-projection-diagnostics-hooks.d.ts.map +1 -0
- package/dist/presentation-projection-diagnostics-hooks.js +17 -0
- package/dist/presentation-projection-diagnostics-hooks.js.map +1 -0
- package/dist/presentation-projection-diagnostics-runtime.d.ts +12 -0
- package/dist/presentation-projection-diagnostics-runtime.d.ts.map +1 -0
- package/dist/presentation-projection-diagnostics-runtime.js +54 -0
- package/dist/presentation-projection-diagnostics-runtime.js.map +1 -0
- package/dist/presentation-projection-trace.d.ts +27 -0
- package/dist/presentation-projection-trace.d.ts.map +1 -0
- package/dist/presentation-projection-trace.js +54 -0
- package/dist/presentation-projection-trace.js.map +1 -0
- package/dist/presentation-query-form-runtime.d.ts +30 -0
- package/dist/presentation-query-form-runtime.d.ts.map +1 -0
- package/dist/presentation-query-form-runtime.js +75 -0
- package/dist/presentation-query-form-runtime.js.map +1 -0
- package/dist/presentation-query-form-state-adapter-registry.d.ts +4 -0
- package/dist/presentation-query-form-state-adapter-registry.d.ts.map +1 -0
- package/dist/presentation-query-form-state-adapter-registry.js +13 -0
- package/dist/presentation-query-form-state-adapter-registry.js.map +1 -0
- package/dist/presentation-query-form-state-context.d.ts +20 -0
- package/dist/presentation-query-form-state-context.d.ts.map +1 -0
- package/dist/presentation-query-form-state-context.js +20 -0
- package/dist/presentation-query-form-state-context.js.map +1 -0
- package/dist/presentation-query-form-state.d.ts +29 -0
- package/dist/presentation-query-form-state.d.ts.map +1 -0
- package/dist/presentation-query-form-state.js +99 -0
- package/dist/presentation-query-form-state.js.map +1 -0
- package/dist/presentation-renderer-registry.d.ts +109 -0
- package/dist/presentation-renderer-registry.d.ts.map +1 -0
- package/dist/presentation-renderer-registry.js +25 -0
- package/dist/presentation-renderer-registry.js.map +1 -0
- package/dist/presentation-standards-context.d.ts +4 -0
- package/dist/presentation-standards-context.d.ts.map +1 -0
- package/dist/presentation-standards-context.js +12 -0
- package/dist/presentation-standards-context.js.map +1 -0
- package/dist/presentation-standards-provider.d.ts +14 -0
- package/dist/presentation-standards-provider.d.ts.map +1 -0
- package/dist/presentation-standards-provider.js +16 -0
- package/dist/presentation-standards-provider.js.map +1 -0
- package/dist/projected-document-action-runtime-bindings.d.ts +20 -0
- package/dist/projected-document-action-runtime-bindings.d.ts.map +1 -0
- package/dist/projected-document-action-runtime-bindings.js +88 -0
- package/dist/projected-document-action-runtime-bindings.js.map +1 -0
- package/dist/projected-document-action-runtime.d.ts +76 -0
- package/dist/projected-document-action-runtime.d.ts.map +1 -0
- package/dist/projected-document-action-runtime.js +224 -0
- package/dist/projected-document-action-runtime.js.map +1 -0
- package/dist/projected-document-process-preview-action-runtime-bindings.d.ts +26 -0
- package/dist/projected-document-process-preview-action-runtime-bindings.d.ts.map +1 -0
- package/dist/projected-document-process-preview-action-runtime-bindings.js +106 -0
- package/dist/projected-document-process-preview-action-runtime-bindings.js.map +1 -0
- package/dist/projected-document-process-preview-action-runtime.d.ts +321 -0
- package/dist/projected-document-process-preview-action-runtime.d.ts.map +1 -0
- package/dist/projected-document-process-preview-action-runtime.js +729 -0
- package/dist/projected-document-process-preview-action-runtime.js.map +1 -0
- package/dist/projected-document-process-preview-capability-runtime.d.ts +47 -0
- package/dist/projected-document-process-preview-capability-runtime.d.ts.map +1 -0
- package/dist/projected-document-process-preview-capability-runtime.js +49 -0
- package/dist/projected-document-process-preview-capability-runtime.js.map +1 -0
- package/dist/projected-document-workspace-action-runtime.d.ts +87 -0
- package/dist/projected-document-workspace-action-runtime.d.ts.map +1 -0
- package/dist/projected-document-workspace-action-runtime.js +150 -0
- package/dist/projected-document-workspace-action-runtime.js.map +1 -0
- package/dist/projected-document-workspace-projection-renderer-diagnostics.d.ts +18 -0
- package/dist/projected-document-workspace-projection-renderer-diagnostics.d.ts.map +1 -0
- package/dist/projected-document-workspace-projection-renderer-diagnostics.js +207 -0
- package/dist/projected-document-workspace-projection-renderer-diagnostics.js.map +1 -0
- package/dist/projected-document-workspace-runtime-binding-diagnostics.d.ts +19 -0
- package/dist/projected-document-workspace-runtime-binding-diagnostics.d.ts.map +1 -0
- package/dist/projected-document-workspace-runtime-binding-diagnostics.js +124 -0
- package/dist/projected-document-workspace-runtime-binding-diagnostics.js.map +1 -0
- package/dist/projected-navigation-provider.d.ts +16 -0
- package/dist/projected-navigation-provider.d.ts.map +1 -0
- package/dist/projected-navigation-provider.js +51 -0
- package/dist/projected-navigation-provider.js.map +1 -0
- package/dist/projected-presentation-flow-host.d.ts +16 -0
- package/dist/projected-presentation-flow-host.d.ts.map +1 -0
- package/dist/projected-presentation-flow-host.js +14 -0
- package/dist/projected-presentation-flow-host.js.map +1 -0
- package/dist/projected-query-form-state-adapter.d.ts +12 -0
- package/dist/projected-query-form-state-adapter.d.ts.map +1 -0
- package/dist/projected-query-form-state-adapter.js +361 -0
- package/dist/projected-query-form-state-adapter.js.map +1 -0
- package/dist/react-router-binding.d.ts +133 -0
- package/dist/react-router-binding.d.ts.map +1 -0
- package/dist/react-router-binding.js +76 -0
- package/dist/react-router-binding.js.map +1 -0
- package/dist/react-router-path.d.ts +4 -0
- package/dist/react-router-path.d.ts.map +1 -0
- package/dist/react-router-path.js +11 -0
- package/dist/react-router-path.js.map +1 -0
- package/dist/scope-selection-context.d.ts +28 -0
- package/dist/scope-selection-context.d.ts.map +1 -0
- package/dist/scope-selection-context.js +13 -0
- package/dist/scope-selection-context.js.map +1 -0
- package/dist/scope-selection-provider.d.ts +33 -0
- package/dist/scope-selection-provider.d.ts.map +1 -0
- package/dist/scope-selection-provider.js +162 -0
- package/dist/scope-selection-provider.js.map +1 -0
- package/dist/scope-selection-request.d.ts +6 -0
- package/dist/scope-selection-request.d.ts.map +1 -0
- package/dist/scope-selection-request.js +12 -0
- package/dist/scope-selection-request.js.map +1 -0
- package/dist/standard-navigation-shell-frame-renderers.d.ts +15 -0
- package/dist/standard-navigation-shell-frame-renderers.d.ts.map +1 -0
- package/dist/standard-navigation-shell-frame-renderers.js +22 -0
- package/dist/standard-navigation-shell-frame-renderers.js.map +1 -0
- package/dist/standard-navigation-shell-slot-renderers.d.ts +59 -0
- package/dist/standard-navigation-shell-slot-renderers.d.ts.map +1 -0
- package/dist/standard-navigation-shell-slot-renderers.js +67 -0
- package/dist/standard-navigation-shell-slot-renderers.js.map +1 -0
- package/dist/view-chrome-slot-renderer-registry.d.ts +12 -0
- package/dist/view-chrome-slot-renderer-registry.d.ts.map +1 -0
- package/dist/view-chrome-slot-renderer-registry.js +12 -0
- package/dist/view-chrome-slot-renderer-registry.js.map +1 -0
- package/package.json +60 -0
- package/src/collection-chrome-slot-renderer-registry.ts +66 -0
- package/src/collection-selection-state-context.ts +51 -0
- package/src/collection-selection-state.tsx +101 -0
- package/src/document-workspace-runtime.tsx +1505 -0
- package/src/index.ts +50 -0
- package/src/input-form-endpoint-runtime.ts +632 -0
- package/src/local-flow-state-data-source-projection.ts +133 -0
- package/src/navigation-runtime-context.ts +40 -0
- package/src/navigation-shell-frame-renderer-registry.ts +54 -0
- package/src/navigation-shell-region-component-registry.tsx +127 -0
- package/src/navigation-shell-slot-renderer-registry.ts +88 -0
- package/src/page-host-projection.ts +356 -0
- package/src/page-host-renderer-registry.tsx +353 -0
- package/src/presentation-action-group-runtime-options.ts +121 -0
- package/src/presentation-action-runtime.ts +190 -0
- package/src/presentation-data-source-binding-runtime.ts +109 -0
- package/src/presentation-data-source-binding.tsx +24 -0
- package/src/presentation-flow-runtime.tsx +835 -0
- package/src/presentation-module-context.ts +10 -0
- package/src/presentation-module-provider.tsx +19 -0
- package/src/presentation-projection-diagnostics-context.ts +17 -0
- package/src/presentation-projection-diagnostics-hooks.ts +29 -0
- package/src/presentation-projection-diagnostics-runtime.tsx +95 -0
- package/src/presentation-projection-trace.ts +117 -0
- package/src/presentation-query-form-runtime.ts +148 -0
- package/src/presentation-query-form-state-adapter-registry.ts +25 -0
- package/src/presentation-query-form-state-context.ts +56 -0
- package/src/presentation-query-form-state.tsx +250 -0
- package/src/presentation-renderer-registry.ts +214 -0
- package/src/presentation-standards-context.ts +21 -0
- package/src/presentation-standards-provider.tsx +44 -0
- package/src/projected-document-action-runtime-bindings.ts +132 -0
- package/src/projected-document-action-runtime.ts +414 -0
- package/src/projected-document-process-preview-action-runtime-bindings.ts +231 -0
- package/src/projected-document-process-preview-action-runtime.ts +1725 -0
- package/src/projected-document-process-preview-capability-runtime.ts +216 -0
- package/src/projected-document-workspace-action-runtime.ts +402 -0
- package/src/projected-document-workspace-projection-renderer-diagnostics.ts +342 -0
- package/src/projected-document-workspace-runtime-binding-diagnostics.ts +208 -0
- package/src/projected-navigation-provider.tsx +104 -0
- package/src/projected-presentation-flow-host.tsx +46 -0
- package/src/projected-query-form-state-adapter.ts +578 -0
- package/src/react-router-binding.tsx +417 -0
- package/src/react-router-path.ts +16 -0
- package/src/scope-selection-context.ts +58 -0
- package/src/scope-selection-provider.tsx +324 -0
- package/src/scope-selection-request.ts +21 -0
- package/src/standard-navigation-shell-frame-renderers.tsx +106 -0
- package/src/standard-navigation-shell-slot-renderers.tsx +289 -0
- package/src/view-chrome-slot-renderer-registry.ts +66 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
navigationShellSlotKinds,
|
|
5
|
+
type NavigationDefinition,
|
|
6
|
+
type NavigationNodeDefinition,
|
|
7
|
+
type NavigationShellRegionDefinition,
|
|
8
|
+
type NavigationShellSlotDefinition,
|
|
9
|
+
} from '@cohesivesystems/presentation-contracts'
|
|
10
|
+
import {
|
|
11
|
+
createProjectedNavigationShellItems,
|
|
12
|
+
isProjectedNavigationShellItemActive,
|
|
13
|
+
resolveNavigationShellSlotRegions,
|
|
14
|
+
type ProjectedNavigationShellItem,
|
|
15
|
+
} from '@cohesivesystems/presentation-core'
|
|
16
|
+
import {
|
|
17
|
+
createNavigationShellSlotRendererRegistry,
|
|
18
|
+
getNavigationShellSlotRendererRegistryKeys,
|
|
19
|
+
resolveNavigationShellSlotRenderer,
|
|
20
|
+
type ProjectedNavigationShellSlotRenderContext,
|
|
21
|
+
} from './navigation-shell-slot-renderer-registry'
|
|
22
|
+
|
|
23
|
+
export type StandardNavigationShellBadgeVariant =
|
|
24
|
+
| 'default'
|
|
25
|
+
| 'destructive'
|
|
26
|
+
| 'ghost'
|
|
27
|
+
| 'link'
|
|
28
|
+
| 'outline'
|
|
29
|
+
| 'secondary'
|
|
30
|
+
|
|
31
|
+
export interface StandardNavigationShellBadgeProps {
|
|
32
|
+
readonly children?: ReactNode
|
|
33
|
+
readonly className?: string
|
|
34
|
+
readonly variant?: StandardNavigationShellBadgeVariant
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface StandardNavigationShellNavigationLinkProps {
|
|
38
|
+
readonly children?: ReactNode
|
|
39
|
+
readonly className?: string
|
|
40
|
+
readonly isActive?: boolean
|
|
41
|
+
readonly to: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface StandardNavigationShellComponentSystem {
|
|
45
|
+
readonly badges: {
|
|
46
|
+
readonly Badge: (props: StandardNavigationShellBadgeProps) => ReactNode
|
|
47
|
+
}
|
|
48
|
+
readonly navigation: {
|
|
49
|
+
readonly NavigationLink: (
|
|
50
|
+
props: StandardNavigationShellNavigationLinkProps
|
|
51
|
+
) => ReactNode
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface StandardNavigationShellSlotLayout {
|
|
56
|
+
readonly brandBadgeClassName: string
|
|
57
|
+
readonly brandSubtitleClassName: string
|
|
58
|
+
readonly brandTitleClassName: string
|
|
59
|
+
readonly navigationItemClassName: string
|
|
60
|
+
readonly rootClassName: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type StandardNavigationShellSlotRenderContext<
|
|
64
|
+
TComponentSystem extends StandardNavigationShellComponentSystem =
|
|
65
|
+
StandardNavigationShellComponentSystem,
|
|
66
|
+
> = ProjectedNavigationShellSlotRenderContext<
|
|
67
|
+
StandardNavigationShellSlotLayout,
|
|
68
|
+
TComponentSystem
|
|
69
|
+
>
|
|
70
|
+
|
|
71
|
+
export const standardNavigationShellSlotRenderers =
|
|
72
|
+
createNavigationShellSlotRendererRegistry<
|
|
73
|
+
StandardNavigationShellSlotLayout,
|
|
74
|
+
StandardNavigationShellComponentSystem
|
|
75
|
+
>([
|
|
76
|
+
{
|
|
77
|
+
kind: navigationShellSlotKinds.brand,
|
|
78
|
+
render: renderStandardNavigationShellBrand,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
kind: navigationShellSlotKinds.primaryNavigation,
|
|
82
|
+
render: renderStandardNavigationShellPrimaryNavigation,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
kind: navigationShellSlotKinds.utilityActions,
|
|
86
|
+
render: renderStandardNavigationShellRegionSlot,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
kind: navigationShellSlotKinds.systemNotices,
|
|
90
|
+
render: renderStandardNavigationShellRegionSlot,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
kind: navigationShellSlotKinds.routedContent,
|
|
94
|
+
render: renderStandardNavigationShellRoutedContent,
|
|
95
|
+
},
|
|
96
|
+
])
|
|
97
|
+
|
|
98
|
+
export const standardNavigationShellSlotRendererKeys =
|
|
99
|
+
getNavigationShellSlotRendererRegistryKeys(standardNavigationShellSlotRenderers)
|
|
100
|
+
|
|
101
|
+
export function renderStandardNavigationShellSlot(
|
|
102
|
+
context: StandardNavigationShellSlotRenderContext,
|
|
103
|
+
) {
|
|
104
|
+
const renderer = resolveNavigationShellSlotRenderer(
|
|
105
|
+
standardNavigationShellSlotRenderers,
|
|
106
|
+
context.slot,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return renderer?.(context) ?? null
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function StandardNavigationShellBrandSlot({
|
|
113
|
+
brandLabel,
|
|
114
|
+
componentSystem,
|
|
115
|
+
renderShellIcon,
|
|
116
|
+
shellIcon,
|
|
117
|
+
slotLayout,
|
|
118
|
+
subtitle,
|
|
119
|
+
title,
|
|
120
|
+
}: {
|
|
121
|
+
readonly brandLabel: string | null
|
|
122
|
+
readonly componentSystem: StandardNavigationShellComponentSystem
|
|
123
|
+
readonly renderShellIcon?: (icon: string) => ReactNode
|
|
124
|
+
readonly shellIcon: string | null
|
|
125
|
+
readonly slotLayout: StandardNavigationShellSlotLayout
|
|
126
|
+
readonly subtitle: string | null
|
|
127
|
+
readonly title: string | null
|
|
128
|
+
}) {
|
|
129
|
+
const Badge = componentSystem.badges.Badge
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div className={slotLayout.rootClassName}>
|
|
133
|
+
{shellIcon && renderShellIcon ? renderShellIcon(shellIcon) : null}
|
|
134
|
+
{brandLabel ? (
|
|
135
|
+
<Badge className={slotLayout.brandBadgeClassName} variant="outline">
|
|
136
|
+
{brandLabel}
|
|
137
|
+
</Badge>
|
|
138
|
+
) : null}
|
|
139
|
+
{title ? (
|
|
140
|
+
<span className={slotLayout.brandTitleClassName}>{title}</span>
|
|
141
|
+
) : null}
|
|
142
|
+
{subtitle ? (
|
|
143
|
+
<span className={slotLayout.brandSubtitleClassName}>{subtitle}</span>
|
|
144
|
+
) : null}
|
|
145
|
+
</div>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function StandardNavigationShellPrimaryNavigationSlot({
|
|
150
|
+
activePath,
|
|
151
|
+
componentSystem,
|
|
152
|
+
items,
|
|
153
|
+
navigation,
|
|
154
|
+
renderNodeIcon,
|
|
155
|
+
slotLayout,
|
|
156
|
+
}: {
|
|
157
|
+
readonly activePath: string
|
|
158
|
+
readonly componentSystem: StandardNavigationShellComponentSystem
|
|
159
|
+
readonly items: readonly ProjectedNavigationShellItem[]
|
|
160
|
+
readonly navigation: NavigationDefinition
|
|
161
|
+
readonly renderNodeIcon?: (node: NavigationNodeDefinition) => ReactNode
|
|
162
|
+
readonly slotLayout: StandardNavigationShellSlotLayout
|
|
163
|
+
}) {
|
|
164
|
+
if (items.length === 0) {
|
|
165
|
+
return null
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const NavigationLink = componentSystem.navigation.NavigationLink
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<nav className={slotLayout.rootClassName}>
|
|
172
|
+
{items.map((item) => (
|
|
173
|
+
<NavigationLink
|
|
174
|
+
className={slotLayout.navigationItemClassName}
|
|
175
|
+
isActive={isProjectedNavigationShellItemActive(
|
|
176
|
+
activePath,
|
|
177
|
+
item,
|
|
178
|
+
navigation,
|
|
179
|
+
)}
|
|
180
|
+
key={item.node.Id}
|
|
181
|
+
to={item.href}
|
|
182
|
+
>
|
|
183
|
+
{renderNodeIcon?.(item.node)}
|
|
184
|
+
{item.label}
|
|
185
|
+
</NavigationLink>
|
|
186
|
+
))}
|
|
187
|
+
</nav>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function StandardNavigationShellRegionSlot({
|
|
192
|
+
navigation,
|
|
193
|
+
renderShellRegion,
|
|
194
|
+
slot,
|
|
195
|
+
slotLayout,
|
|
196
|
+
}: {
|
|
197
|
+
readonly navigation: NavigationDefinition
|
|
198
|
+
readonly renderShellRegion?: (region: NavigationShellRegionDefinition) => ReactNode
|
|
199
|
+
readonly slot: NavigationShellSlotDefinition
|
|
200
|
+
readonly slotLayout: StandardNavigationShellSlotLayout
|
|
201
|
+
}) {
|
|
202
|
+
const regions = resolveNavigationShellSlotRegions(navigation, slot)
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<div className={slotLayout.rootClassName}>
|
|
206
|
+
{regions.map((region) => (
|
|
207
|
+
<ShellRegion key={region.Id} region={region} renderShellRegion={renderShellRegion} />
|
|
208
|
+
))}
|
|
209
|
+
</div>
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function renderStandardNavigationShellBrand({
|
|
214
|
+
componentSystem,
|
|
215
|
+
navigation,
|
|
216
|
+
renderShellIcon,
|
|
217
|
+
slotLayout,
|
|
218
|
+
}: StandardNavigationShellSlotRenderContext) {
|
|
219
|
+
const chrome = navigation.Shell.Chrome
|
|
220
|
+
const brandLabel = chrome?.BrandLabel ?? null
|
|
221
|
+
const title = chrome?.Title ?? navigation.Label
|
|
222
|
+
const subtitle = chrome?.Subtitle ?? null
|
|
223
|
+
const shellIcon = chrome?.Icon ?? null
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<StandardNavigationShellBrandSlot
|
|
227
|
+
brandLabel={brandLabel}
|
|
228
|
+
componentSystem={componentSystem}
|
|
229
|
+
renderShellIcon={renderShellIcon}
|
|
230
|
+
shellIcon={shellIcon}
|
|
231
|
+
slotLayout={slotLayout}
|
|
232
|
+
subtitle={subtitle}
|
|
233
|
+
title={title}
|
|
234
|
+
/>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function renderStandardNavigationShellPrimaryNavigation({
|
|
239
|
+
activePath,
|
|
240
|
+
componentSystem,
|
|
241
|
+
navigation,
|
|
242
|
+
renderNodeIcon,
|
|
243
|
+
slot,
|
|
244
|
+
slotLayout,
|
|
245
|
+
}: StandardNavigationShellSlotRenderContext) {
|
|
246
|
+
return (
|
|
247
|
+
<StandardNavigationShellPrimaryNavigationSlot
|
|
248
|
+
activePath={activePath}
|
|
249
|
+
componentSystem={componentSystem}
|
|
250
|
+
items={createProjectedNavigationShellItems(navigation, slot)}
|
|
251
|
+
navigation={navigation}
|
|
252
|
+
renderNodeIcon={renderNodeIcon}
|
|
253
|
+
slotLayout={slotLayout}
|
|
254
|
+
/>
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function renderStandardNavigationShellRegionSlot({
|
|
259
|
+
navigation,
|
|
260
|
+
renderShellRegion,
|
|
261
|
+
slot,
|
|
262
|
+
slotLayout,
|
|
263
|
+
}: StandardNavigationShellSlotRenderContext) {
|
|
264
|
+
return (
|
|
265
|
+
<StandardNavigationShellRegionSlot
|
|
266
|
+
navigation={navigation}
|
|
267
|
+
renderShellRegion={renderShellRegion}
|
|
268
|
+
slot={slot}
|
|
269
|
+
slotLayout={slotLayout}
|
|
270
|
+
/>
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function renderStandardNavigationShellRoutedContent({
|
|
275
|
+
children,
|
|
276
|
+
slotLayout,
|
|
277
|
+
}: StandardNavigationShellSlotRenderContext) {
|
|
278
|
+
return <div className={slotLayout.rootClassName}>{children}</div>
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function ShellRegion({
|
|
282
|
+
region,
|
|
283
|
+
renderShellRegion,
|
|
284
|
+
}: {
|
|
285
|
+
readonly region: NavigationShellRegionDefinition
|
|
286
|
+
readonly renderShellRegion?: (region: NavigationShellRegionDefinition) => ReactNode
|
|
287
|
+
}) {
|
|
288
|
+
return renderShellRegion?.(region) ?? null
|
|
289
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createViewChromeSlotRendererKey,
|
|
5
|
+
createViewChromeSlotRendererRegistry as createCoreViewChromeSlotRendererRegistry,
|
|
6
|
+
getViewChromeSlotRendererCandidateKeys,
|
|
7
|
+
getViewChromeSlotRendererRegistryKeys as getCoreViewChromeSlotRendererRegistryKeys,
|
|
8
|
+
hasViewChromeSlotRendererBinding,
|
|
9
|
+
isViewChromeSlotKind,
|
|
10
|
+
isViewChromeSlotPlacement,
|
|
11
|
+
isViewChromeSlotPlacementValue,
|
|
12
|
+
resolveViewChromeSlotRenderer as resolveCoreViewChromeSlotRenderer,
|
|
13
|
+
viewChromeSlotAnyPlacement,
|
|
14
|
+
type ViewChromeSlotRendererBinding as CoreViewChromeSlotRendererBinding,
|
|
15
|
+
type ViewChromeSlotRendererRegistry as CoreViewChromeSlotRendererRegistry,
|
|
16
|
+
} from '@cohesivesystems/presentation-core'
|
|
17
|
+
import type {
|
|
18
|
+
ViewChromeSlotDefinition,
|
|
19
|
+
ViewChromeSlotKind,
|
|
20
|
+
ViewChromeSlotPlacement,
|
|
21
|
+
} from '@cohesivesystems/presentation-contracts'
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
createViewChromeSlotRendererKey,
|
|
25
|
+
getViewChromeSlotRendererCandidateKeys,
|
|
26
|
+
hasViewChromeSlotRendererBinding,
|
|
27
|
+
isViewChromeSlotKind,
|
|
28
|
+
isViewChromeSlotPlacement,
|
|
29
|
+
isViewChromeSlotPlacementValue,
|
|
30
|
+
viewChromeSlotAnyPlacement,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ViewChromeSlotRenderer<TContext> = (
|
|
34
|
+
context: TContext,
|
|
35
|
+
) => ReactNode
|
|
36
|
+
|
|
37
|
+
export type ViewChromeSlotRendererRegistry<TContext> =
|
|
38
|
+
CoreViewChromeSlotRendererRegistry<TContext, ReactNode>
|
|
39
|
+
|
|
40
|
+
export type ViewChromeSlotRendererBinding<TContext> =
|
|
41
|
+
CoreViewChromeSlotRendererBinding<TContext, ReactNode>
|
|
42
|
+
|
|
43
|
+
export function createViewChromeSlotRendererRegistry<TContext>(
|
|
44
|
+
bindings: readonly ViewChromeSlotRendererBinding<TContext>[],
|
|
45
|
+
): ViewChromeSlotRendererRegistry<TContext> {
|
|
46
|
+
return createCoreViewChromeSlotRendererRegistry<TContext, ReactNode>(bindings)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getViewChromeSlotRendererRegistryKeys<TContext>(
|
|
50
|
+
registry: ViewChromeSlotRendererRegistry<TContext> | null | undefined,
|
|
51
|
+
) {
|
|
52
|
+
return getCoreViewChromeSlotRendererRegistryKeys<TContext, ReactNode>(registry)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function resolveViewChromeSlotRenderer<TContext>(
|
|
56
|
+
registry: ViewChromeSlotRendererRegistry<TContext> | null | undefined,
|
|
57
|
+
slot: ViewChromeSlotDefinition,
|
|
58
|
+
) {
|
|
59
|
+
return resolveCoreViewChromeSlotRenderer<TContext, ReactNode>(registry, slot)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type {
|
|
63
|
+
ViewChromeSlotDefinition,
|
|
64
|
+
ViewChromeSlotKind,
|
|
65
|
+
ViewChromeSlotPlacement,
|
|
66
|
+
}
|