@ossy/app 1.40.2 → 3.0.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/README.md +49 -12
- package/cli/build.task.js +49 -10
- package/cli/get-platform-files.task.js +21 -15
- package/cli/manifest-plugin.js +340 -48
- package/package.json +25 -13
- package/runtime/merge-shell-slots.js +148 -0
- package/runtime/page-runtime.js +36 -18
- package/runtime/resolve-app-slots.js +126 -0
- package/src/en.translations.json +8 -0
- package/src/manifest/action-id-to-tool-name.js +29 -0
- package/src/manifest/build-action-input-schema.js +220 -0
- package/src/manifest/build-actions-schema.js +36 -0
- package/src/manifest/build-capabilities.js +190 -0
- package/src/manifest/build-manifest-summary.js +11 -5
- package/src/manifest/extract-task-catalog.js +1 -0
- package/src/manifest/resolve-page-layout.js +51 -0
- package/src/manifest/serialize-package-definition.js +2 -3
- package/src/manifest/template-to-json-schema.js +103 -0
- package/src/shell/App.jsx +18 -9
- package/src/shell/AppSettings.jsx +17 -0
- package/src/shell/DevPagesPanel.jsx +17 -13
- package/src/shell/HeaderAuthActions.jsx +49 -0
- package/src/shell/LanguageList.jsx +83 -0
- package/src/shell/LanguageSelect.jsx +73 -0
- package/src/shell/ThemeEditor.jsx +19 -34
- package/src/shell/ThemeSelect.jsx +101 -0
- package/src/shell/WorkspaceAppSettingsSync.jsx +39 -0
- package/src/shell/buildSidebarNav.js +113 -0
- package/src/shell/index.js +11 -0
- package/src/shell/languageCode.js +31 -0
- package/src/shell/patchUserAppSettings.js +10 -0
- package/src/shell/resolveEndpoints.js +43 -0
- package/src/shell/resolveWorkspaceServices.js +20 -0
- package/src/shell/themeEditorStyles.js +49 -0
- package/src/shell/useCompactShellLayout.js +24 -0
- package/src/shell/useShellWorkspace.js +40 -0
- package/src/shell-registry/blank.layout.jsx +8 -0
- package/src/shell-registry/default.layout.jsx +101 -0
- package/src/shell-registry/footer-default.component.jsx +39 -0
- package/src/shell-registry/head-default.component.jsx +17 -0
- package/src/shell-registry/header-default.component.jsx +50 -0
- package/src/shell-registry/logo-logomark.component.jsx +8 -0
- package/src/shell-registry/logo-logotype.component.jsx +15 -0
- package/src/shell-registry/minimal.layout.jsx +58 -0
- package/src/shell-registry/sidebar-default.component.jsx +281 -0
- package/src/sv.translations.json +8 -0
- package/runtime/resolve-shell-slots.js +0 -112
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/** Canonical shell slot names (namespaced). App layout maps chrome only — not content. */
|
|
2
|
-
export const SHELL_SLOT_NAMES = [
|
|
3
|
-
'shell:header',
|
|
4
|
-
'shell:sidebar',
|
|
5
|
-
'shell:toolbar',
|
|
6
|
-
'shell:notifications',
|
|
7
|
-
'shell:system-messages',
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
/** Platform-owned slot filled with the current route page component. */
|
|
11
|
-
export const CONTENT_SLOT_NAME = 'shell:content'
|
|
12
|
-
|
|
13
|
-
/** Bare shell region → namespaced key (legacy fallback for app components only). */
|
|
14
|
-
const BARE_SHELL_REGION = {
|
|
15
|
-
header: 'shell:header',
|
|
16
|
-
sidebar: 'shell:sidebar',
|
|
17
|
-
toolbar: 'shell:toolbar',
|
|
18
|
-
notifications: 'shell:notifications',
|
|
19
|
-
'system-messages': 'shell:system-messages',
|
|
20
|
-
content: CONTENT_SLOT_NAME,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Normalize a slot map key to the canonical namespaced form when it is a bare shell region.
|
|
25
|
-
*
|
|
26
|
-
* @param {string} slotName
|
|
27
|
-
* @returns {string}
|
|
28
|
-
*/
|
|
29
|
-
export function normalizeShellSlotName (slotName) {
|
|
30
|
-
const key = typeof slotName === 'string' ? slotName.trim() : ''
|
|
31
|
-
return BARE_SHELL_REGION[key] ?? key
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Build `Record<slotName, Component>` from the app layout's static `slots` map
|
|
36
|
-
* (`slotName → componentId`) and components loaded by `metadata.id`.
|
|
37
|
-
*
|
|
38
|
-
* One component per slot. Optional fallback (app components only): if the layout
|
|
39
|
-
* map omits a slot, use a component whose id equals the slot name (e.g. `shell:header`)
|
|
40
|
-
* or the bare region name (e.g. `header`).
|
|
41
|
-
*
|
|
42
|
-
* Does not resolve `shell:content` — use {@link resolvePageSlots}.
|
|
43
|
-
*
|
|
44
|
-
* @param {Record<string, string> | null | undefined} layoutSlotsMap
|
|
45
|
-
* @param {Record<string, import('react').ComponentType>} componentsById
|
|
46
|
-
* @returns {Record<string, import('react').ComponentType>}
|
|
47
|
-
*/
|
|
48
|
-
export function resolveShellSlots (layoutSlotsMap, componentsById) {
|
|
49
|
-
/** @type {Record<string, import('react').ComponentType>} */
|
|
50
|
-
const resolved = {}
|
|
51
|
-
|
|
52
|
-
const map = layoutSlotsMap && typeof layoutSlotsMap === 'object' ? layoutSlotsMap : {}
|
|
53
|
-
for (const [rawSlot, componentId] of Object.entries(map)) {
|
|
54
|
-
const slotName = normalizeShellSlotName(rawSlot)
|
|
55
|
-
const id = typeof componentId === 'string' ? componentId.trim() : ''
|
|
56
|
-
if (!slotName || !id || slotName === CONTENT_SLOT_NAME) continue
|
|
57
|
-
const Component = componentsById[id]
|
|
58
|
-
if (Component) resolved[slotName] = Component
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
for (const slotName of SHELL_SLOT_NAMES) {
|
|
62
|
-
if (resolved[slotName]) continue
|
|
63
|
-
if (componentsById[slotName]) {
|
|
64
|
-
resolved[slotName] = componentsById[slotName]
|
|
65
|
-
continue
|
|
66
|
-
}
|
|
67
|
-
const bare = slotName.slice('shell:'.length)
|
|
68
|
-
if (componentsById[bare]) resolved[slotName] = componentsById[bare]
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return resolved
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const RESOURCE_SLOT_PREFIX = 'resource:'
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Map manifest components whose `metadata.id` is a `resource:{type}/{view}` key.
|
|
78
|
-
*
|
|
79
|
-
* @param {Record<string, import('react').ComponentType>} componentsById
|
|
80
|
-
* @returns {Record<string, import('react').ComponentType>}
|
|
81
|
-
*/
|
|
82
|
-
export function resolveResourceSlots (componentsById) {
|
|
83
|
-
/** @type {Record<string, import('react').ComponentType>} */
|
|
84
|
-
const resolved = {}
|
|
85
|
-
for (const [id, Component] of Object.entries(componentsById || {})) {
|
|
86
|
-
if (typeof id === 'string' && id.startsWith(RESOURCE_SLOT_PREFIX) && Component) {
|
|
87
|
-
resolved[id] = Component
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return resolved
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Full provider slot map for a page request: shell chrome, resource views, and page content.
|
|
95
|
-
*
|
|
96
|
-
* @param {{
|
|
97
|
-
* layoutSlots?: Record<string, string> | null,
|
|
98
|
-
* componentsById?: Record<string, import('react').ComponentType>,
|
|
99
|
-
* pageComponent?: import('react').ComponentType | null,
|
|
100
|
-
* }} options
|
|
101
|
-
* @returns {Record<string, import('react').ComponentType>}
|
|
102
|
-
*/
|
|
103
|
-
export function resolvePageSlots ({ layoutSlots, componentsById = {}, pageComponent = null } = {}) {
|
|
104
|
-
const shellSlots = resolveShellSlots(layoutSlots, componentsById)
|
|
105
|
-
const resourceSlots = resolveResourceSlots(componentsById)
|
|
106
|
-
/** @type {Record<string, import('react').ComponentType>} */
|
|
107
|
-
const resolved = { ...componentsById, ...shellSlots, ...resourceSlots }
|
|
108
|
-
if (pageComponent) {
|
|
109
|
-
resolved[CONTENT_SLOT_NAME] = pageComponent
|
|
110
|
-
}
|
|
111
|
-
return resolved
|
|
112
|
-
}
|