@cratis/scene.blueprint.default 4.39.0 → 4.41.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/ComponentName.ts +27 -0
- package/defaultBlueprint.ts +1 -0
- package/defaultBlueprintComponents.ts +10 -1
- package/dist/cjs/ComponentName.js +9 -0
- package/dist/cjs/ComponentName.js.map +1 -1
- package/dist/cjs/defaultBlueprint.js +18 -1
- package/dist/cjs/defaultBlueprint.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponentMetadata.js +9 -0
- package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponents.js +28 -1
- package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
- package/dist/cjs/foundation/BulkBar.js +62 -0
- package/dist/cjs/foundation/BulkBar.js.map +1 -0
- package/dist/cjs/foundation/DataList.js +436 -0
- package/dist/cjs/foundation/DataList.js.map +1 -0
- package/dist/cjs/foundation/FormScreenBody.js +447 -0
- package/dist/cjs/foundation/FormScreenBody.js.map +1 -0
- package/dist/cjs/foundation/FoundationStates.js +2 -1
- package/dist/cjs/foundation/FoundationStates.js.map +1 -1
- package/dist/cjs/foundation/GlobalSearch.js +54 -0
- package/dist/cjs/foundation/GlobalSearch.js.map +1 -0
- package/dist/cjs/foundation/KanbanBoard.js +222 -0
- package/dist/cjs/foundation/KanbanBoard.js.map +1 -0
- package/dist/cjs/foundation/NotificationsButton.js +45 -0
- package/dist/cjs/foundation/NotificationsButton.js.map +1 -0
- package/dist/cjs/foundation/SubNavigation.js +72 -0
- package/dist/cjs/foundation/SubNavigation.js.map +1 -0
- package/dist/cjs/foundation/TabSet.js +101 -0
- package/dist/cjs/foundation/TabSet.js.map +1 -0
- package/dist/cjs/foundation/WizardProgress.js +185 -0
- package/dist/cjs/foundation/WizardProgress.js.map +1 -0
- package/dist/cjs/foundation/boardModel.js +67 -0
- package/dist/cjs/foundation/boardModel.js.map +1 -0
- package/dist/cjs/foundation/formModel.js +158 -0
- package/dist/cjs/foundation/formModel.js.map +1 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js +54 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
- package/dist/cjs/foundation/foundationDescriptors.js +400 -0
- package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
- package/dist/cjs/foundation/foundationSamples.js +303 -0
- package/dist/cjs/foundation/foundationSamples.js.map +1 -1
- package/dist/cjs/foundation/foundationStrings.js +72 -0
- package/dist/cjs/foundation/foundationStrings.js.map +1 -1
- package/dist/cjs/foundation/listModel.js +200 -0
- package/dist/cjs/foundation/listModel.js.map +1 -0
- package/dist/cjs/foundation/tabModel.js +41 -0
- package/dist/cjs/foundation/tabModel.js.map +1 -0
- package/dist/cjs/foundation/templates/boardScreenTemplate.js +76 -0
- package/dist/cjs/foundation/templates/boardScreenTemplate.js.map +1 -0
- package/dist/cjs/foundation/templates/dashboardScreenTemplate.js +128 -0
- package/dist/cjs/foundation/templates/dashboardScreenTemplate.js.map +1 -0
- package/dist/cjs/foundation/templates/formScreenTemplate.js +71 -0
- package/dist/cjs/foundation/templates/formScreenTemplate.js.map +1 -0
- package/dist/cjs/foundation/templates/index.js +39 -0
- package/dist/cjs/foundation/templates/index.js.map +1 -0
- package/dist/cjs/foundation/templates/listScreenTemplate.js +124 -0
- package/dist/cjs/foundation/templates/listScreenTemplate.js.map +1 -0
- package/dist/cjs/foundation/templates/masterDetailScreenTemplate.js +79 -0
- package/dist/cjs/foundation/templates/masterDetailScreenTemplate.js.map +1 -0
- package/dist/cjs/foundation/templates/recordPageTemplate.js +137 -0
- package/dist/cjs/foundation/templates/recordPageTemplate.js.map +1 -0
- package/dist/cjs/foundation/templates/templateParts.js +38 -0
- package/dist/cjs/foundation/templates/templateParts.js.map +1 -0
- package/dist/cjs/foundation/templates/wizardScreenTemplate.js +95 -0
- package/dist/cjs/foundation/templates/wizardScreenTemplate.js.map +1 -0
- package/dist/cjs/foundation/templates/workspaceScreenTemplate.js +62 -0
- package/dist/cjs/foundation/templates/workspaceScreenTemplate.js.map +1 -0
- package/dist/cjs/foundation/urlState.js +57 -0
- package/dist/cjs/foundation/urlState.js.map +1 -0
- package/dist/cjs/foundation/useCompactWidth.js +23 -0
- package/dist/cjs/foundation/useCompactWidth.js.map +1 -0
- package/dist/cjs/foundation/wizardModel.js +50 -0
- package/dist/cjs/foundation/wizardModel.js.map +1 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js +76 -4
- package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/cjs/gallery/applicationChrome.js +18 -1
- package/dist/cjs/gallery/applicationChrome.js.map +1 -1
- package/dist/cjs/gallery/composeScreen.js +5 -3
- package/dist/cjs/gallery/composeScreen.js.map +1 -1
- package/dist/cjs/gallery/screens.js +83 -2
- package/dist/cjs/gallery/screens.js.map +1 -1
- package/dist/cjs/index.js +96 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/ComponentName.d.ts +10 -1
- package/dist/esm/ComponentName.d.ts.map +1 -1
- package/dist/esm/ComponentName.js +9 -0
- package/dist/esm/ComponentName.js.map +1 -1
- package/dist/esm/defaultBlueprint.d.ts.map +1 -1
- package/dist/esm/defaultBlueprint.js +18 -1
- package/dist/esm/defaultBlueprint.js.map +1 -1
- package/dist/esm/defaultBlueprintComponentMetadata.js +9 -0
- package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
- package/dist/esm/defaultBlueprintComponents.js +28 -1
- package/dist/esm/defaultBlueprintComponents.js.map +1 -1
- package/dist/esm/foundation/BulkBar.d.ts +4 -0
- package/dist/esm/foundation/BulkBar.d.ts.map +1 -0
- package/dist/esm/foundation/BulkBar.js +59 -0
- package/dist/esm/foundation/BulkBar.js.map +1 -0
- package/dist/esm/foundation/DataList.d.ts +3 -0
- package/dist/esm/foundation/DataList.d.ts.map +1 -0
- package/dist/esm/foundation/DataList.js +434 -0
- package/dist/esm/foundation/DataList.js.map +1 -0
- package/dist/esm/foundation/FormScreenBody.d.ts +3 -0
- package/dist/esm/foundation/FormScreenBody.d.ts.map +1 -0
- package/dist/esm/foundation/FormScreenBody.js +445 -0
- package/dist/esm/foundation/FormScreenBody.js.map +1 -0
- package/dist/esm/foundation/FoundationStates.js +2 -1
- package/dist/esm/foundation/FoundationStates.js.map +1 -1
- package/dist/esm/foundation/GlobalSearch.d.ts +3 -0
- package/dist/esm/foundation/GlobalSearch.d.ts.map +1 -0
- package/dist/esm/foundation/GlobalSearch.js +52 -0
- package/dist/esm/foundation/GlobalSearch.js.map +1 -0
- package/dist/esm/foundation/KanbanBoard.d.ts +3 -0
- package/dist/esm/foundation/KanbanBoard.d.ts.map +1 -0
- package/dist/esm/foundation/KanbanBoard.js +220 -0
- package/dist/esm/foundation/KanbanBoard.js.map +1 -0
- package/dist/esm/foundation/NotificationsButton.d.ts +3 -0
- package/dist/esm/foundation/NotificationsButton.d.ts.map +1 -0
- package/dist/esm/foundation/NotificationsButton.js +43 -0
- package/dist/esm/foundation/NotificationsButton.js.map +1 -0
- package/dist/esm/foundation/SubNavigation.d.ts +3 -0
- package/dist/esm/foundation/SubNavigation.d.ts.map +1 -0
- package/dist/esm/foundation/SubNavigation.js +70 -0
- package/dist/esm/foundation/SubNavigation.js.map +1 -0
- package/dist/esm/foundation/TabSet.d.ts +3 -0
- package/dist/esm/foundation/TabSet.d.ts.map +1 -0
- package/dist/esm/foundation/TabSet.js +99 -0
- package/dist/esm/foundation/TabSet.js.map +1 -0
- package/dist/esm/foundation/WizardProgress.d.ts +3 -0
- package/dist/esm/foundation/WizardProgress.d.ts.map +1 -0
- package/dist/esm/foundation/WizardProgress.js +183 -0
- package/dist/esm/foundation/WizardProgress.js.map +1 -0
- package/dist/esm/foundation/boardModel.d.ts +22 -0
- package/dist/esm/foundation/boardModel.d.ts.map +1 -0
- package/dist/esm/foundation/boardModel.js +61 -0
- package/dist/esm/foundation/boardModel.js.map +1 -0
- package/dist/esm/foundation/formModel.d.ts +48 -0
- package/dist/esm/foundation/formModel.d.ts.map +1 -0
- package/dist/esm/foundation/formModel.js +147 -0
- package/dist/esm/foundation/formModel.js.map +1 -0
- package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.js +54 -0
- package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -1
- package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -1
- package/dist/esm/foundation/foundationDescriptors.js +400 -0
- package/dist/esm/foundation/foundationDescriptors.js.map +1 -1
- package/dist/esm/foundation/foundationSamples.d.ts.map +1 -1
- package/dist/esm/foundation/foundationSamples.js +303 -0
- package/dist/esm/foundation/foundationSamples.js.map +1 -1
- package/dist/esm/foundation/foundationStrings.d.ts +72 -0
- package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
- package/dist/esm/foundation/foundationStrings.js +72 -0
- package/dist/esm/foundation/foundationStrings.js.map +1 -1
- package/dist/esm/foundation/index.d.ts +17 -0
- package/dist/esm/foundation/index.d.ts.map +1 -1
- package/dist/esm/foundation/index.js +17 -0
- package/dist/esm/foundation/index.js.map +1 -1
- package/dist/esm/foundation/listModel.d.ts +49 -0
- package/dist/esm/foundation/listModel.d.ts.map +1 -0
- package/dist/esm/foundation/listModel.js +183 -0
- package/dist/esm/foundation/listModel.js.map +1 -0
- package/dist/esm/foundation/tabModel.d.ts +10 -0
- package/dist/esm/foundation/tabModel.d.ts.map +1 -0
- package/dist/esm/foundation/tabModel.js +37 -0
- package/dist/esm/foundation/tabModel.js.map +1 -0
- package/dist/esm/foundation/templates/boardScreenTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/boardScreenTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/boardScreenTemplate.js +74 -0
- package/dist/esm/foundation/templates/boardScreenTemplate.js.map +1 -0
- package/dist/esm/foundation/templates/dashboardScreenTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/dashboardScreenTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/dashboardScreenTemplate.js +126 -0
- package/dist/esm/foundation/templates/dashboardScreenTemplate.js.map +1 -0
- package/dist/esm/foundation/templates/formScreenTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/formScreenTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/formScreenTemplate.js +69 -0
- package/dist/esm/foundation/templates/formScreenTemplate.js.map +1 -0
- package/dist/esm/foundation/templates/index.d.ts +11 -0
- package/dist/esm/foundation/templates/index.d.ts.map +1 -0
- package/dist/esm/foundation/templates/index.js +25 -0
- package/dist/esm/foundation/templates/index.js.map +1 -0
- package/dist/esm/foundation/templates/listScreenTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/listScreenTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/listScreenTemplate.js +122 -0
- package/dist/esm/foundation/templates/listScreenTemplate.js.map +1 -0
- package/dist/esm/foundation/templates/masterDetailScreenTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/masterDetailScreenTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/masterDetailScreenTemplate.js +77 -0
- package/dist/esm/foundation/templates/masterDetailScreenTemplate.js.map +1 -0
- package/dist/esm/foundation/templates/recordPageTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/recordPageTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/recordPageTemplate.js +135 -0
- package/dist/esm/foundation/templates/recordPageTemplate.js.map +1 -0
- package/dist/esm/foundation/templates/templateParts.d.ts +6 -0
- package/dist/esm/foundation/templates/templateParts.d.ts.map +1 -0
- package/dist/esm/foundation/templates/templateParts.js +33 -0
- package/dist/esm/foundation/templates/templateParts.js.map +1 -0
- package/dist/esm/foundation/templates/wizardScreenTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/wizardScreenTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/wizardScreenTemplate.js +93 -0
- package/dist/esm/foundation/templates/wizardScreenTemplate.js.map +1 -0
- package/dist/esm/foundation/templates/workspaceScreenTemplate.d.ts +3 -0
- package/dist/esm/foundation/templates/workspaceScreenTemplate.d.ts.map +1 -0
- package/dist/esm/foundation/templates/workspaceScreenTemplate.js +60 -0
- package/dist/esm/foundation/templates/workspaceScreenTemplate.js.map +1 -0
- package/dist/esm/foundation/urlState.d.ts +4 -0
- package/dist/esm/foundation/urlState.d.ts.map +1 -0
- package/dist/esm/foundation/urlState.js +53 -0
- package/dist/esm/foundation/urlState.js.map +1 -0
- package/dist/esm/foundation/useCompactWidth.d.ts +3 -0
- package/dist/esm/foundation/useCompactWidth.d.ts.map +1 -0
- package/dist/esm/foundation/useCompactWidth.js +20 -0
- package/dist/esm/foundation/useCompactWidth.js.map +1 -0
- package/dist/esm/foundation/wizardModel.d.ts +16 -0
- package/dist/esm/foundation/wizardModel.d.ts.map +1 -0
- package/dist/esm/foundation/wizardModel.js +43 -0
- package/dist/esm/foundation/wizardModel.js.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts +13 -2
- package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -1
- package/dist/esm/gallery/GalleryScreenPreview.js +75 -5
- package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/esm/gallery/applicationChrome.d.ts.map +1 -1
- package/dist/esm/gallery/applicationChrome.js +18 -1
- package/dist/esm/gallery/applicationChrome.js.map +1 -1
- package/dist/esm/gallery/composeScreen.d.ts.map +1 -1
- package/dist/esm/gallery/composeScreen.js +5 -3
- package/dist/esm/gallery/composeScreen.js.map +1 -1
- package/dist/esm/gallery/screens.d.ts.map +1 -1
- package/dist/esm/gallery/screens.js +83 -2
- package/dist/esm/gallery/screens.js.map +1 -1
- package/dist/esm/index.js +27 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/foundation/BulkBar.tsx +38 -0
- package/foundation/DataList.tsx +208 -0
- package/foundation/FormScreenBody.tsx +196 -0
- package/foundation/FoundationStates.tsx +1 -1
- package/foundation/GlobalSearch.tsx +33 -0
- package/foundation/KanbanBoard.tsx +97 -0
- package/foundation/NotificationsButton.tsx +28 -0
- package/foundation/SubNavigation.tsx +49 -0
- package/foundation/TabSet.tsx +65 -0
- package/foundation/WizardProgress.tsx +109 -0
- package/foundation/boardModel.ts +64 -0
- package/foundation/formModel.ts +146 -0
- package/foundation/foundationComponentMetadata.ts +9 -0
- package/foundation/foundationDescriptors.ts +195 -0
- package/foundation/foundationSamples.ts +56 -0
- package/foundation/foundationStrings.ts +72 -0
- package/foundation/index.ts +17 -0
- package/foundation/listModel.ts +190 -0
- package/foundation/tabModel.ts +41 -0
- package/foundation/templates/boardScreenTemplate.ts +28 -0
- package/foundation/templates/dashboardScreenTemplate.ts +37 -0
- package/foundation/templates/formScreenTemplate.ts +28 -0
- package/foundation/templates/index.ts +26 -0
- package/foundation/templates/listScreenTemplate.ts +37 -0
- package/foundation/templates/masterDetailScreenTemplate.ts +28 -0
- package/foundation/templates/recordPageTemplate.ts +36 -0
- package/foundation/templates/templateParts.ts +30 -0
- package/foundation/templates/wizardScreenTemplate.ts +33 -0
- package/foundation/templates/workspaceScreenTemplate.ts +27 -0
- package/foundation/urlState.ts +52 -0
- package/foundation/useCompactWidth.ts +23 -0
- package/foundation/wizardModel.ts +54 -0
- package/gallery/GalleryScreenPreview.tsx +64 -5
- package/gallery/applicationChrome.ts +6 -1
- package/gallery/composeScreen.ts +4 -2
- package/gallery/screens.ts +16 -1
- package/package.json +10 -8
- package/sampleData/foundation-en.json +512 -0
- package/shell/layout.css +513 -0
- package/thumbnails/BoardScreen.svg +15 -0
- package/thumbnails/DashboardScreen.svg +18 -0
- package/thumbnails/FormScreen.svg +14 -0
- package/thumbnails/ListScreen.svg +16 -0
- package/thumbnails/MasterDetailScreen.svg +22 -0
- package/thumbnails/RecordPage.svg +17 -0
- package/thumbnails/WizardScreen.svg +16 -0
- package/thumbnails/WorkspaceScreen.svg +12 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { WidthSizeClass } from '@cratis/scene.model';
|
|
2
|
+
import { column, slotLeaf, grid } from '../../layouts/flowBuilders.js';
|
|
3
|
+
import { component, fromQuery, foundationTemplateProvenance, thumbnailOf } from './templateParts.js';
|
|
4
|
+
|
|
5
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
6
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
7
|
+
/**
|
|
8
|
+
* A module's own workspace: its sections beside the content of the section in force. The sections are the module's sub-navigation (a left rail that
|
|
9
|
+
* becomes tabs on a phone); the section in force is kept in the address, so a deep link or a refresh restores it. Feature screens go in `moduleContent`.
|
|
10
|
+
*/ const workspaceScreenTemplate = {
|
|
11
|
+
name: 'WorkspaceScreen',
|
|
12
|
+
fitsSlot: 'content',
|
|
13
|
+
slots: [
|
|
14
|
+
{
|
|
15
|
+
name: 'moduleNav'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'moduleContent'
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
arrangement: {
|
|
22
|
+
root: grid([
|
|
23
|
+
slotLeaf('moduleNav'),
|
|
24
|
+
slotLeaf('moduleContent', {
|
|
25
|
+
span: 3
|
|
26
|
+
})
|
|
27
|
+
], 4, 16),
|
|
28
|
+
overrides: [
|
|
29
|
+
{
|
|
30
|
+
width: WidthSizeClass.Compact,
|
|
31
|
+
root: column([
|
|
32
|
+
slotLeaf('moduleNav'),
|
|
33
|
+
slotLeaf('moduleContent')
|
|
34
|
+
], 16)
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
content: {
|
|
39
|
+
moduleNav: [
|
|
40
|
+
component('workspace-sections', 'subNavigation', {
|
|
41
|
+
items: fromQuery('ModuleSections'),
|
|
42
|
+
orientation: 'vertical',
|
|
43
|
+
urlKey: 'section',
|
|
44
|
+
label: 'Module sections'
|
|
45
|
+
})
|
|
46
|
+
],
|
|
47
|
+
moduleContent: []
|
|
48
|
+
},
|
|
49
|
+
displayName: 'Module workspace',
|
|
50
|
+
description: 'A module\'s sections beside the content of the section that is open.',
|
|
51
|
+
metadata: {
|
|
52
|
+
...foundationTemplateProvenance,
|
|
53
|
+
type: 'Workspace',
|
|
54
|
+
category: 'Foundation / Workspace',
|
|
55
|
+
thumbnail: thumbnailOf('WorkspaceScreen')
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { workspaceScreenTemplate };
|
|
60
|
+
//# sourceMappingURL=workspaceScreenTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaceScreenTemplate.js","sources":["../../../../foundation/templates/workspaceScreenTemplate.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 { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';\nimport { column, grid, row, slotLeaf } from '../../layouts/flowBuilders';\nimport { component, foundationTemplateProvenance, fromQuery, thumbnailOf } from './templateParts';\n\n/**\n * A module's own workspace: its sections beside the content of the section in force. The sections are the module's sub-navigation (a left rail that\n * becomes tabs on a phone); the section in force is kept in the address, so a deep link or a refresh restores it. Feature screens go in `moduleContent`.\n */\nexport const workspaceScreenTemplate: ScreenTemplate = {\n name: 'WorkspaceScreen',\n fitsSlot: 'content',\n slots: [{ name: 'moduleNav' }, { name: 'moduleContent' }],\n arrangement: {\n root: grid([slotLeaf('moduleNav'), slotLeaf('moduleContent', { span: 3 })], 4, 16),\n overrides: [{ width: WidthSizeClass.Compact, root: column([slotLeaf('moduleNav'), slotLeaf('moduleContent')], 16) }],\n },\n content: {\n moduleNav: [component('workspace-sections', 'subNavigation', { items: fromQuery('ModuleSections'), orientation: 'vertical', urlKey: 'section', label: 'Module sections' })],\n moduleContent: [],\n },\n displayName: 'Module workspace',\n description: 'A module\\'s sections beside the content of the section that is open.',\n metadata: { ...foundationTemplateProvenance, type: 'Workspace', category: 'Foundation / Workspace', thumbnail: thumbnailOf('WorkspaceScreen') },\n};\n"],"names":["workspaceScreenTemplate","name","fitsSlot","slots","arrangement","root","grid","slotLeaf","span","overrides","width","WidthSizeClass","Compact","column","content","moduleNav","component","items","fromQuery","orientation","urlKey","label","moduleContent","displayName","description","metadata","foundationTemplateProvenance","type","category","thumbnail","thumbnailOf"],"mappings":";;;;AAAA;AACA;AAMA;;;UAIaA,uBAAAA,GAA0C;IACnDC,IAAAA,EAAM,iBAAA;IACNC,QAAAA,EAAU,SAAA;IACVC,KAAAA,EAAO;AAAC,QAAA;YAAEF,IAAAA,EAAM;AAAY,SAAA;AAAG,QAAA;YAAEA,IAAAA,EAAM;AAAgB;AAAE,KAAA;IACzDG,WAAAA,EAAa;AACTC,QAAAA,IAAAA,EAAMC,IAAAA,CAAK;YAACC,QAAAA,CAAS,WAAA,CAAA;AAAcA,YAAAA,QAAAA,CAAS,eAAA,EAAiB;gBAAEC,IAAAA,EAAM;AAAE,aAAA;AAAG,SAAA,EAAE,CAAA,EAAG,EAAA,CAAA;QAC/EC,SAAAA,EAAW;AAAC,YAAA;AAAEC,gBAAAA,KAAAA,EAAOC,eAAeC,OAAO;AAAEP,gBAAAA,IAAAA,EAAMQ,MAAAA,CAAO;oBAACN,QAAAA,CAAS,WAAA,CAAA;oBAAcA,QAAAA,CAAS,eAAA;iBAAiB,EAAE,EAAA;AAAI;AAAE;AACxH,KAAA;IACAO,OAAAA,EAAS;QACLC,SAAAA,EAAW;AAACC,YAAAA,SAAAA,CAAU,sBAAsB,eAAA,EAAiB;AAAEC,gBAAAA,KAAAA,EAAOC,SAAAA,CAAU,gBAAA,CAAA;gBAAmBC,WAAAA,EAAa,UAAA;gBAAYC,MAAAA,EAAQ,SAAA;gBAAWC,KAAAA,EAAO;AAAkB,aAAA;AAAG,SAAA;AAC3KC,QAAAA,aAAAA,EAAe;AACnB,KAAA;IACAC,WAAAA,EAAa,kBAAA;IACbC,WAAAA,EAAa,sEAAA;IACbC,QAAAA,EAAU;AAAE,QAAA,GAAGC,4BAA4B;QAAEC,IAAAA,EAAM,WAAA;QAAaC,QAAAA,EAAU,wBAAA;AAA0BC,QAAAA,SAAAA,EAAWC,WAAAA,CAAY,iBAAA;AAAmB;AAClJ;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function readUrlParameter(name: string): string | undefined;
|
|
2
|
+
export declare function writeUrlParameter(name: string, value: string | undefined): void;
|
|
3
|
+
export declare function useUrlState(key: string | undefined, fallback: string | undefined): [string | undefined, (value: string | undefined) => void];
|
|
4
|
+
//# sourceMappingURL=urlState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlState.d.ts","sourceRoot":"","sources":["../../../foundation/urlState.ts"],"names":[],"mappings":"AAMA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIjE;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAQ/E;AAcD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC,CAgB5I"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/** Reads one query-string parameter of the current address, or undefined when it is absent or there is no address (server rendering). */ function readUrlParameter(name) {
|
|
6
|
+
if (typeof window === 'undefined') return undefined;
|
|
7
|
+
const value = new URLSearchParams(window.location.search).get(name);
|
|
8
|
+
return value === null ? undefined : value;
|
|
9
|
+
}
|
|
10
|
+
/** Writes one query-string parameter to the address without adding a history entry; an undefined or empty value removes it. */ function writeUrlParameter(name, value) {
|
|
11
|
+
if (typeof window === 'undefined') return;
|
|
12
|
+
const parameters = new URLSearchParams(window.location.search);
|
|
13
|
+
if (value === undefined || value === '') parameters.delete(name);
|
|
14
|
+
else parameters.set(name, value);
|
|
15
|
+
const query = parameters.toString();
|
|
16
|
+
window.history.replaceState(window.history.state, '', `${window.location.pathname}${query.length > 0 ? `?${query}` : ''}${window.location.hash}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* State that lives in the address bar: a list's search, sort, page and filters, a master/detail's selection, a module's active section.
|
|
20
|
+
*
|
|
21
|
+
* It starts from the address when the address has a value (so a shared link, a refresh and the back button restore the screen as it was),
|
|
22
|
+
* otherwise from the fallback the template supplies. Changing it rewrites the address in place and does not add a history entry per keystroke.
|
|
23
|
+
* Several components on one screen use distinct `key`s; a template names them (`q`, `sort`, `page`, `selected`, `section`). Without a
|
|
24
|
+
* `urlKey` the state is plain component state, which is what a gallery card and a design surface want.
|
|
25
|
+
*
|
|
26
|
+
* @param key The query-string parameter, or undefined to keep the state local.
|
|
27
|
+
* @param fallback The value used when the address has none.
|
|
28
|
+
* @returns The value and its setter.
|
|
29
|
+
*/ function useUrlState(key, fallback) {
|
|
30
|
+
const [value, setValue] = useState(()=>key === undefined ? fallback : readUrlParameter(key) ?? fallback);
|
|
31
|
+
useEffect(()=>{
|
|
32
|
+
if (key === undefined) return;
|
|
33
|
+
const restore = ()=>setValue(readUrlParameter(key) ?? fallback);
|
|
34
|
+
window.addEventListener('popstate', restore);
|
|
35
|
+
return ()=>window.removeEventListener('popstate', restore);
|
|
36
|
+
}, [
|
|
37
|
+
key,
|
|
38
|
+
fallback
|
|
39
|
+
]);
|
|
40
|
+
const update = useCallback((next)=>{
|
|
41
|
+
setValue(next);
|
|
42
|
+
if (key !== undefined) writeUrlParameter(key, next);
|
|
43
|
+
}, [
|
|
44
|
+
key
|
|
45
|
+
]);
|
|
46
|
+
return [
|
|
47
|
+
value,
|
|
48
|
+
update
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { readUrlParameter, useUrlState, writeUrlParameter };
|
|
53
|
+
//# sourceMappingURL=urlState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlState.js","sources":["../../../foundation/urlState.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback, useEffect, useState } from 'react';\n\n/** Reads one query-string parameter of the current address, or undefined when it is absent or there is no address (server rendering). */\nexport function readUrlParameter(name: string): string | undefined {\n if (typeof window === 'undefined') return undefined;\n const value = new URLSearchParams(window.location.search).get(name);\n return value === null ? undefined : value;\n}\n\n/** Writes one query-string parameter to the address without adding a history entry; an undefined or empty value removes it. */\nexport function writeUrlParameter(name: string, value: string | undefined): void {\n if (typeof window === 'undefined') return;\n const parameters = new URLSearchParams(window.location.search);\n if (value === undefined || value === '') parameters.delete(name);\n else parameters.set(name, value);\n\n const query = parameters.toString();\n window.history.replaceState(window.history.state, '', `${window.location.pathname}${query.length > 0 ? `?${query}` : ''}${window.location.hash}`);\n}\n\n/**\n * State that lives in the address bar: a list's search, sort, page and filters, a master/detail's selection, a module's active section.\n *\n * It starts from the address when the address has a value (so a shared link, a refresh and the back button restore the screen as it was),\n * otherwise from the fallback the template supplies. Changing it rewrites the address in place and does not add a history entry per keystroke.\n * Several components on one screen use distinct `key`s; a template names them (`q`, `sort`, `page`, `selected`, `section`). Without a\n * `urlKey` the state is plain component state, which is what a gallery card and a design surface want.\n *\n * @param key The query-string parameter, or undefined to keep the state local.\n * @param fallback The value used when the address has none.\n * @returns The value and its setter.\n */\nexport function useUrlState(key: string | undefined, fallback: string | undefined): [string | undefined, (value: string | undefined) => void] {\n const [value, setValue] = useState<string | undefined>(() => (key === undefined ? fallback : readUrlParameter(key) ?? fallback));\n\n useEffect(() => {\n if (key === undefined) return;\n const restore = () => setValue(readUrlParameter(key) ?? fallback);\n window.addEventListener('popstate', restore);\n return () => window.removeEventListener('popstate', restore);\n }, [key, fallback]);\n\n const update = useCallback((next: string | undefined) => {\n setValue(next);\n if (key !== undefined) writeUrlParameter(key, next);\n }, [key]);\n\n return [value, update];\n}\n"],"names":["readUrlParameter","name","window","undefined","value","URLSearchParams","location","search","get","writeUrlParameter","parameters","delete","set","query","toString","history","replaceState","state","pathname","length","hash","useUrlState","key","fallback","setValue","useState","useEffect","restore","addEventListener","removeEventListener","update","useCallback","next"],"mappings":";;AAAA;AACA;AAIA,0IACO,SAASA,gBAAAA,CAAiBC,IAAY,EAAA;IACzC,IAAI,OAAOC,MAAAA,KAAW,WAAA,EAAa,OAAOC,SAAAA;IAC1C,MAAMC,KAAAA,GAAQ,IAAIC,eAAAA,CAAgBH,MAAAA,CAAOI,QAAQ,CAACC,MAAM,CAAA,CAAEC,GAAG,CAACP,IAAAA,CAAAA;IAC9D,OAAOG,KAAAA,KAAU,OAAOD,SAAAA,GAAYC,KAAAA;AACxC;AAEA,gIACO,SAASK,iBAAAA,CAAkBR,IAAY,EAAEG,KAAyB,EAAA;IACrE,IAAI,OAAOF,WAAW,WAAA,EAAa;AACnC,IAAA,MAAMQ,aAAa,IAAIL,eAAAA,CAAgBH,MAAAA,CAAOI,QAAQ,CAACC,MAAM,CAAA;AAC7D,IAAA,IAAIH,UAAUD,SAAAA,IAAaC,KAAAA,KAAU,EAAA,EAAIM,UAAAA,CAAWC,MAAM,CAACV,IAAAA,CAAAA;SACtDS,UAAAA,CAAWE,GAAG,CAACX,IAAAA,EAAMG,KAAAA,CAAAA;IAE1B,MAAMS,KAAAA,GAAQH,WAAWI,QAAQ,EAAA;AACjCZ,IAAAA,MAAAA,CAAOa,OAAO,CAACC,YAAY,CAACd,MAAAA,CAAOa,OAAO,CAACE,KAAK,EAAE,EAAA,EAAI,CAAA,EAAGf,MAAAA,CAAOI,QAAQ,CAACY,QAAQ,CAAA,EAAGL,KA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MA,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAGjD,wBAAgB,eAAe,IAAI,OAAO,CAazC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/** The width below which a screen is a phone's: the collapse rules of Part B 1.3 (list to cards, master-detail to stack) apply under it. */ const compactQuery = '(max-width: 40rem)';
|
|
6
|
+
/** Whether the viewport is phone-wide, kept up to date. Without `matchMedia` (a test environment, server rendering) it is false, so the full layout renders. */ function useCompactWidth() {
|
|
7
|
+
const [compact, setCompact] = useState(()=>typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(compactQuery).matches);
|
|
8
|
+
useEffect(()=>{
|
|
9
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;
|
|
10
|
+
const query = window.matchMedia(compactQuery);
|
|
11
|
+
const update = ()=>setCompact(query.matches);
|
|
12
|
+
update();
|
|
13
|
+
query.addEventListener('change', update);
|
|
14
|
+
return ()=>query.removeEventListener('change', update);
|
|
15
|
+
}, []);
|
|
16
|
+
return compact;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { compactQuery, useCompactWidth };
|
|
20
|
+
//# sourceMappingURL=useCompactWidth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompactWidth.js","sources":["../../../foundation/useCompactWidth.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 { useEffect, useState } from 'react';\n\n/** The width below which a screen is a phone's: the collapse rules of Part B 1.3 (list to cards, master-detail to stack) apply under it. */\nexport const compactQuery = '(max-width: 40rem)';\n\n/** Whether the viewport is phone-wide, kept up to date. Without `matchMedia` (a test environment, server rendering) it is false, so the full layout renders. */\nexport function useCompactWidth(): boolean {\n const [compact, setCompact] = useState(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(compactQuery).matches);\n\n useEffect(() => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;\n const query = window.matchMedia(compactQuery);\n const update = () => setCompact(query.matches);\n update();\n query.addEventListener('change', update);\n return () => query.removeEventListener('change', update);\n }, []);\n\n return compact;\n}\n"],"names":["compactQuery","useCompactWidth","compact","setCompact","useState","window","matchMedia","matches","useEffect","query","update","addEventListener","removeEventListener"],"mappings":";;AAAA;AACA;AAIA,6IACO,MAAMA,YAAAA,GAAe;AAE5B,iKACO,SAASC,eAAAA,GAAAA;AACZ,IAAA,MAAM,CAACC,OAAAA,EAASC,UAAAA,CAAW,GAAGC,QAAAA,CAAS,IAAM,OAAOC,MAAAA,KAAW,WAAA,IAAe,OAAOA,MAAAA,CAAOC,UAAU,KAAK,UAAA,IAAcD,OAAOC,UAAU,CAACN,cAAcO,OAAO,CAAA;IAEhKC,SAAAA,CAAU,IAAA;AACN,QAAA,IAAI,OAAOH,MAAAA,KAAW,WAAA,IAAe,OAAOA,MAAAA,CAAOC,UAAU,KAAK,UAAA,EAAY;QAC9E,MAAMG,KAAAA,GAAQJ,MAAAA,CAAOC,UAAU,CAACN,YAAAA,CAAAA;AAChC,QAAA,MAAMU,MAAAA,GAAS,IAAMP,UAAAA,CAAWM,KAAAA,CAAMF,OAAO,CAAA;AAC7CG,QAAAA,MAAAA,EAAAA;QACAD,KAAAA,CAAME,gBAAgB,CAAC,QAAA,EAAUD,MAAAA,CAAAA;AACjC,QAAA,OAAO,IAAMD,KAAAA,CAAMG,mBAAmB,CAAC,QAAA,EAAUF,MAAAA,CAAAA;AACrD,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAOR,OAAAA;AACX;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WizardStep {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
valid: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare enum StepStatus {
|
|
7
|
+
Completed = "completed",
|
|
8
|
+
Current = "current",
|
|
9
|
+
Upcoming = "upcoming"
|
|
10
|
+
}
|
|
11
|
+
export declare function readWizardSteps(value: unknown): WizardStep[];
|
|
12
|
+
export declare function reachableStep(steps: WizardStep[], completed: ReadonlySet<string>, requested: string | undefined): string | undefined;
|
|
13
|
+
export declare function statusOf(completed: ReadonlySet<string>, current: string | undefined, id: string): StepStatus;
|
|
14
|
+
export declare function canOpen(steps: WizardStep[], completed: ReadonlySet<string>, id: string): boolean;
|
|
15
|
+
export declare const neighbour: (steps: WizardStep[], id: string | undefined, direction: -1 | 1) => WizardStep | undefined;
|
|
16
|
+
//# sourceMappingURL=wizardModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizardModel.d.ts","sourceRoot":"","sources":["../../../foundation/wizardModel.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IAEd,KAAK,EAAE,OAAO,CAAC;CAClB;AAGD,oBAAY,UAAU;IAClB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACxB;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,EAAE,CAW5D;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKpI;AAGD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAG5G;AAGD,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAGhG;AAGD,eAAO,MAAM,SAAS,UAAW,UAAU,EAAE,MAAM,MAAM,GAAG,SAAS,aAAa,CAAC,CAAC,GAAG,CAAC,KAAG,UAAU,GAAG,SAAuE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
/** One step of a wizard. */ /** Where a step stands for the person going through the wizard. */ var StepStatus = /*#__PURE__*/ function(StepStatus) {
|
|
4
|
+
StepStatus["Completed"] = "completed";
|
|
5
|
+
StepStatus["Current"] = "current";
|
|
6
|
+
StepStatus["Upcoming"] = "upcoming";
|
|
7
|
+
return StepStatus;
|
|
8
|
+
}({});
|
|
9
|
+
/** Reads steps, dropping those without an id and repeated ids. */ function readWizardSteps(value) {
|
|
10
|
+
if (!Array.isArray(value)) return [];
|
|
11
|
+
const seen = new Set();
|
|
12
|
+
return value.flatMap((entry)=>{
|
|
13
|
+
if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return [];
|
|
14
|
+
const { id, label, valid } = entry;
|
|
15
|
+
if (typeof id !== 'string' || id.length === 0 || seen.has(id)) return [];
|
|
16
|
+
seen.add(id);
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
id,
|
|
20
|
+
label: typeof label === 'string' && label.length > 0 ? label : id,
|
|
21
|
+
valid: valid !== false
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** The step to show: the requested one when it exists and every step before it is completed, else the furthest step that is reachable. A refresh can never land past a step that was not done. */ function reachableStep(steps, completed, requested) {
|
|
27
|
+
const wanted = steps.findIndex((step)=>step.id === requested);
|
|
28
|
+
let furthest = 0;
|
|
29
|
+
while(furthest < steps.length - 1 && completed.has(steps[furthest].id))furthest++;
|
|
30
|
+
return steps[wanted >= 0 && wanted <= furthest ? wanted : furthest]?.id;
|
|
31
|
+
}
|
|
32
|
+
/** The status of a step: the current one, a completed one (revisitable), or upcoming. */ function statusOf(completed, current, id) {
|
|
33
|
+
if (id === current) return "current";
|
|
34
|
+
return completed.has(id) ? "completed" : "upcoming";
|
|
35
|
+
}
|
|
36
|
+
/** Whether a step may be opened from the progress indicator: a completed one, the current one, or the next one when the current is done. */ function canOpen(steps, completed, id) {
|
|
37
|
+
const index = steps.findIndex((step)=>step.id === id);
|
|
38
|
+
return index === 0 || steps.slice(0, index).every((step)=>completed.has(step.id));
|
|
39
|
+
}
|
|
40
|
+
/** The step before or after another, or undefined at either end. */ const neighbour = (steps, id, direction)=>steps[steps.findIndex((step)=>step.id === id) + direction];
|
|
41
|
+
|
|
42
|
+
export { StepStatus, canOpen, neighbour, reachableStep, readWizardSteps, statusOf };
|
|
43
|
+
//# sourceMappingURL=wizardModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizardModel.js","sources":["../../../foundation/wizardModel.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** One step of a wizard. */\nexport interface WizardStep {\n id: string;\n label: string;\n /** Whether the step's own fields are valid; a step that is not valid blocks Next. Defaults to true. */\n valid: boolean;\n}\n\n/** Where a step stands for the person going through the wizard. */\nexport enum StepStatus {\n Completed = 'completed',\n Current = 'current',\n Upcoming = 'upcoming',\n}\n\n/** Reads steps, dropping those without an id and repeated ids. */\nexport function readWizardSteps(value: unknown): WizardStep[] {\n if (!Array.isArray(value)) return [];\n\n const seen = new Set<string>();\n return value.flatMap((entry): WizardStep[] => {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return [];\n const { id, label, valid } = entry as Record<string, unknown>;\n if (typeof id !== 'string' || id.length === 0 || seen.has(id)) return [];\n seen.add(id);\n return [{ id, label: typeof label === 'string' && label.length > 0 ? label : id, valid: valid !== false }];\n });\n}\n\n/** The step to show: the requested one when it exists and every step before it is completed, else the furthest step that is reachable. A refresh can never land past a step that was not done. */\nexport function reachableStep(steps: WizardStep[], completed: ReadonlySet<string>, requested: string | undefined): string | undefined {\n const wanted = steps.findIndex(step => step.id === requested);\n let furthest = 0;\n while (furthest < steps.length - 1 && completed.has(steps[furthest].id)) furthest++;\n return steps[wanted >= 0 && wanted <= furthest ? wanted : furthest]?.id;\n}\n\n/** The status of a step: the current one, a completed one (revisitable), or upcoming. */\nexport function statusOf(completed: ReadonlySet<string>, current: string | undefined, id: string): StepStatus {\n if (id === current) return StepStatus.Current;\n return completed.has(id) ? StepStatus.Completed : StepStatus.Upcoming;\n}\n\n/** Whether a step may be opened from the progress indicator: a completed one, the current one, or the next one when the current is done. */\nexport function canOpen(steps: WizardStep[], completed: ReadonlySet<string>, id: string): boolean {\n const index = steps.findIndex(step => step.id === id);\n return index === 0 || steps.slice(0, index).every(step => completed.has(step.id));\n}\n\n/** The step before or after another, or undefined at either end. */\nexport const neighbour = (steps: WizardStep[], id: string | undefined, direction: -1 | 1): WizardStep | undefined => steps[steps.findIndex(step => step.id === id) + direction];\n"],"names":["StepStatus","readWizardSteps","value","Array","isArray","seen","Set","flatMap","entry","id","label","valid","length","has","add","reachableStep","steps","completed","requested","wanted","findIndex","step","furthest","statusOf","current","canOpen","index","slice","every","neighbour","direction"],"mappings":"AAAA;AACA;AAEA,iGASO,IAAA,UAAKA,iBAAAA,SAAAA,UAAAA,EAAAA;;;;AAAAA,IAAAA,OAAAA,UAAAA;AAIX,CAAA,CAAA,EAAA;AAED,mEACO,SAASC,eAAAA,CAAgBC,KAAc,EAAA;AAC1C,IAAA,IAAI,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO,EAAE;AAEpC,IAAA,MAAMG,OAAO,IAAIC,GAAAA,EAAAA;IACjB,OAAOJ,KAAAA,CAAMK,OAAO,CAAC,CAACC,KAAAA,GAAAA;QAClB,IAAI,OAAOA,KAAA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OAAOe,OAAAA,EAAS,OAAA,SAAA;IACpB,OAAOP,SAAAA,CAAUJ,GAAG,CAACJ,EAAAA,CAAAA,GAAAA,WAAAA,GAAAA,UAAAA;AACzB;AAEA,6IACO,SAASgB,OAAAA,CAAQT,KAAmB,EAAEC,SAA8B,EAAER,EAAU,EAAA;IACnF,MAAMiB,KAAAA,GAAQV,MAAMI,SAAS,CAACC,CAAAA,IAAAA,GAAQA,IAAAA,CAAKZ,EAAE,KAAKA,EAAAA,CAAAA;AAClD,IAAA,OAAOiB,KAAAA,KAAU,CAAA,IAAKV,KAAAA,CAAMW,KAAK,CAAC,CAAA,EAAGD,KAAAA,CAAAA,CAAOE,KAAK,CAACP,CAAAA,IAAAA,GAAQJ,SAAAA,CAAUJ,GAAG,CAACQ,KAAKZ,EAAE,CAAA,CAAA;AACnF;AAEA,qEACO,MAAMoB,SAAAA,GAAY,CAACb,KAAAA,EAAqBP,EAAAA,EAAwBqB,YAA8Cd,KAAK,CAACA,MAAMI,SAAS,CAACC,CAAAA,IAAAA,GAAQA,IAAAA,CAAKZ,EAAE,KAAKA,EAAAA,CAAAA,GAAMqB;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Theme } from '@cratis/scene.model';
|
|
1
|
+
import { SampleDataPack, SceneElement, Theme } from '@cratis/scene.model';
|
|
2
2
|
import { ComponentRegistry } from '@cratis/scene.react';
|
|
3
3
|
import { LayoutConfigState } from '../configuration';
|
|
4
|
+
import { ComponentState } from '../foundation';
|
|
4
5
|
import { TemplatePreviewState } from './TemplatePreviewState';
|
|
5
6
|
export declare const galleryPreviewRegistry: ComponentRegistry;
|
|
6
7
|
export interface GalleryScreenPreviewProps {
|
|
@@ -9,6 +10,16 @@ export interface GalleryScreenPreviewProps {
|
|
|
9
10
|
themes?: Theme[];
|
|
10
11
|
registry?: ComponentRegistry;
|
|
11
12
|
state?: TemplatePreviewState;
|
|
13
|
+
pack?: SampleDataPack;
|
|
14
|
+
forceState?: ForcedComponentState;
|
|
12
15
|
}
|
|
13
|
-
export
|
|
16
|
+
export interface ForcedComponentState {
|
|
17
|
+
state: ComponentState;
|
|
18
|
+
error?: string;
|
|
19
|
+
permissionSubject?: string;
|
|
20
|
+
failedRegions?: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function forceComponentState(element: SceneElement, forced: ForcedComponentState): SceneElement;
|
|
23
|
+
export declare const queryResultsOf: (pack: SampleDataPack | undefined, state?: TemplatePreviewState) => Record<string, unknown> | undefined;
|
|
24
|
+
export declare function GalleryScreenPreview({ screenName, initialConfig, themes, registry, state, pack, forceState }: GalleryScreenPreviewProps): import("react").JSX.Element;
|
|
14
25
|
//# sourceMappingURL=GalleryScreenPreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryScreenPreview.d.ts","sourceRoot":"","sources":["../../../gallery/GalleryScreenPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"GalleryScreenPreview.d.ts","sourceRoot":"","sources":["../../../gallery/GalleryScreenPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAqB,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAoC,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAwB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG3E,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AAOlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAU9D,eAAO,MAAM,sBAAsB,EAAE,iBAAwE,CAAC;AAE9G,MAAM,WAAW,yBAAyB;IAEtC,UAAU,EAAE,MAAM,CAAC;IAGnB,aAAa,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAG3C,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAGjB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAG7B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAM7B,IAAI,CAAC,EAAE,cAAc,CAAC;IAOtB,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAGD,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAQD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,oBAAoB,GAAG,YAAY,CAarG;AASD,eAAO,MAAM,cAAc,SAAU,cAAc,GAAG,SAAS,UAAS,oBAAoB,KAAoC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAIzJ,CAAC;AAeF,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,MAA+B,EAAE,QAAiC,EAAE,KAAsC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,yBAAyB,+BAkB1N"}
|
|
@@ -2,9 +2,26 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { coreComponents, SceneElementView } from '@cratis/scene.react';
|
|
4
4
|
import { LayoutConfigProvider } from '../configuration/LayoutConfigProvider.js';
|
|
5
|
+
import { ComponentName } from '../ComponentName.js';
|
|
5
6
|
import { defaultBlueprintComponents } from '../defaultBlueprintComponents.js';
|
|
7
|
+
import '../foundation/ComponentState.js';
|
|
8
|
+
import '../foundation/ActivityFeed.js';
|
|
9
|
+
import '../foundation/ApprovalChainStepper.js';
|
|
10
|
+
import '../foundation/foundationDescriptors.js';
|
|
11
|
+
import '../foundation/foundationComponentMetadata.js';
|
|
12
|
+
import { foundationSamples } from '../foundation/foundationSamples.js';
|
|
13
|
+
import { defaultBlueprintName } from '../packageName.js';
|
|
6
14
|
import { defaultBlueprintThemes } from '../themes/defaultBlueprintThemes.js';
|
|
7
15
|
import { LayoutThemeProvider } from '../themes/LayoutThemeProvider.js';
|
|
16
|
+
import '../foundation/templates/boardScreenTemplate.js';
|
|
17
|
+
import '../foundation/templates/dashboardScreenTemplate.js';
|
|
18
|
+
import '../foundation/templates/formScreenTemplate.js';
|
|
19
|
+
import '../foundation/templates/listScreenTemplate.js';
|
|
20
|
+
import '../foundation/templates/masterDetailScreenTemplate.js';
|
|
21
|
+
import '../foundation/templates/recordPageTemplate.js';
|
|
22
|
+
import '../foundation/templates/wizardScreenTemplate.js';
|
|
23
|
+
import '../foundation/templates/workspaceScreenTemplate.js';
|
|
24
|
+
import '../foundation/templates/templateParts.js';
|
|
8
25
|
import { composeScreenElement } from './composeScreen.js';
|
|
9
26
|
import { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile.js';
|
|
10
27
|
import { resolveElementComponentNames } from './resolveElementNames.js';
|
|
@@ -22,6 +39,56 @@ import { applyTemplatePreviewState } from './applyTemplatePreviewState.js';
|
|
|
22
39
|
...coreComponents,
|
|
23
40
|
...defaultBlueprintComponents
|
|
24
41
|
};
|
|
42
|
+
/** Components that are chrome or controls rather than data-showing regions, and so do not own the five states. */ const withoutStates = new Set([
|
|
43
|
+
ComponentName.EmptyState,
|
|
44
|
+
ComponentName.TrendChip,
|
|
45
|
+
ComponentName.StatusChip,
|
|
46
|
+
ComponentName.BulkBar,
|
|
47
|
+
ComponentName.GlobalSearch,
|
|
48
|
+
ComponentName.NotificationsButton
|
|
49
|
+
]);
|
|
50
|
+
/** Sets the forced state on every region that owns the five states, leaving chrome and controls as they are. */ function forceComponentState(element, forced) {
|
|
51
|
+
const external = element;
|
|
52
|
+
const children = element.children;
|
|
53
|
+
const slots = external.slots ? Object.fromEntries(Object.entries(external.slots).map(([slot, inner])=>[
|
|
54
|
+
slot,
|
|
55
|
+
inner.map((child)=>forceComponentState(child, forced))
|
|
56
|
+
])) : undefined;
|
|
57
|
+
const bare = typeof external.componentName === 'string' ? external.componentName.substring(external.componentName.lastIndexOf(':') + 1) : undefined;
|
|
58
|
+
const owns = bare !== undefined && external.componentName.includes(defaultBlueprintName) && bare in foundationSamples && foundationSamples[bare].stateful && !withoutStates.has(bare);
|
|
59
|
+
return {
|
|
60
|
+
...element,
|
|
61
|
+
...owns ? {
|
|
62
|
+
properties: {
|
|
63
|
+
...external.properties,
|
|
64
|
+
...forced
|
|
65
|
+
}
|
|
66
|
+
} : {},
|
|
67
|
+
...slots ? {
|
|
68
|
+
slots
|
|
69
|
+
} : {},
|
|
70
|
+
...children ? {
|
|
71
|
+
children: children.map((child)=>forceComponentState(child, forced))
|
|
72
|
+
} : {}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A pack as the query results the templates bind to: one entry for each set, keyed by the set's shape name.
|
|
77
|
+
*
|
|
78
|
+
* The state is a property of the *data*, not of the template: Empty answers every query with no rows; Loading and Error withhold the answer, which is
|
|
79
|
+
* what a query that has not come back or has failed looks like to a component, so each shows its own skeleton or error exactly as it will in an application.
|
|
80
|
+
* The elements themselves are untouched, which is why the same template previews in every state with no per-template code.
|
|
81
|
+
*/ const queryResultsOf = (pack, state = TemplatePreviewState.Populated)=>{
|
|
82
|
+
if (pack === undefined) return undefined;
|
|
83
|
+
if (state === TemplatePreviewState.Empty) return Object.fromEntries(pack.sets.map((set)=>[
|
|
84
|
+
set.shape,
|
|
85
|
+
[]
|
|
86
|
+
]));
|
|
87
|
+
return Object.fromEntries(pack.sets.map((set)=>[
|
|
88
|
+
set.shape,
|
|
89
|
+
set.rows
|
|
90
|
+
]));
|
|
91
|
+
};
|
|
25
92
|
/**
|
|
26
93
|
* Boots one gallery screen through the real engine.
|
|
27
94
|
*
|
|
@@ -34,16 +101,18 @@ import { applyTemplatePreviewState } from './applyTemplatePreviewState.js';
|
|
|
34
101
|
* come out as `UnresolvedComponent`'s dashed red box naming what is missing. That is the designed outcome:
|
|
35
102
|
* a preview of a blueprint against half a profile should look visibly incomplete rather than quietly
|
|
36
103
|
* wrong.
|
|
37
|
-
*/ function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated }) {
|
|
104
|
+
*/ function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated, pack, forceState }) {
|
|
38
105
|
const element = useMemo(()=>{
|
|
39
106
|
const screen = galleryScreen(screenName);
|
|
40
107
|
if (!screen) {
|
|
41
108
|
throw new Error(`The gallery has no screen named '${screenName}'.`);
|
|
42
109
|
}
|
|
43
|
-
|
|
110
|
+
const resolved = applyTemplatePreviewState(resolveElementComponentNames(composeScreenElement(screen), galleryPreviewProfile, galleryComponentCatalog), state);
|
|
111
|
+
return forceState ? forceComponentState(resolved, forceState) : resolved;
|
|
44
112
|
}, [
|
|
45
113
|
screenName,
|
|
46
|
-
state
|
|
114
|
+
state,
|
|
115
|
+
forceState
|
|
47
116
|
]);
|
|
48
117
|
return /*#__PURE__*/ jsx(LayoutConfigProvider, {
|
|
49
118
|
initialConfig: initialConfig,
|
|
@@ -53,11 +122,12 @@ import { applyTemplatePreviewState } from './applyTemplatePreviewState.js';
|
|
|
53
122
|
children: /*#__PURE__*/ jsx(SceneElementView, {
|
|
54
123
|
element: element,
|
|
55
124
|
registry: registry,
|
|
56
|
-
resolveBinding: ()=>undefined
|
|
125
|
+
resolveBinding: ()=>undefined,
|
|
126
|
+
queryResults: queryResultsOf(pack, state)
|
|
57
127
|
})
|
|
58
128
|
})
|
|
59
129
|
});
|
|
60
130
|
}
|
|
61
131
|
|
|
62
|
-
export { GalleryScreenPreview, galleryPreviewRegistry };
|
|
132
|
+
export { GalleryScreenPreview, forceComponentState, galleryPreviewRegistry, queryResultsOf };
|
|
63
133
|
//# sourceMappingURL=GalleryScreenPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryScreenPreview.js","sources":["../../../gallery/GalleryScreenPreview.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 } from 'react';\nimport { Theme } from '@cratis/scene.model';\nimport { ComponentRegistry, SceneElementView, coreComponents } from '@cratis/scene.react';\nimport { LayoutConfigProvider, LayoutConfigState } from '../configuration';\nimport { defaultBlueprintComponents } from '../defaultBlueprintComponents';\nimport { LayoutThemeProvider, defaultBlueprintThemes } from '../themes';\nimport { composeScreenElement } from './composeScreen';\nimport { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile';\nimport { resolveElementComponentNames } from './resolveElementNames';\nimport { galleryScreen } from './screens';\nimport { TemplatePreviewState } from './TemplatePreviewState';\nimport { applyTemplatePreviewState } from './applyTemplatePreviewState';\n\n/**\n * The registry a preview resolves against when a host does not supply one: `core` plus this blueprint.\n *\n * Merged by hand rather than through `mergePackageRegistries`, because reaching for this blueprint's\n * *bundle* here would be circular - the bundle is assembled from the gallery this file belongs to. Registry\n * keys carry their package name, so merge order cannot cause a collision either way.\n */\nexport const galleryPreviewRegistry: ComponentRegistry = { ...coreComponents, ...defaultBlueprintComponents };\n\nexport interface GalleryScreenPreviewProps {\n /** The name of the gallery screen to boot. */\n screenName: string;\n\n /** Configuration to start from - a story pinning a mode, or a host restoring a session. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The themes the configurator may switch between. Defaults to the two this blueprint ships. */\n themes?: Theme[];\n\n /** The component registry to render against. Defaults to `core` plus this blueprint's own components. */\n registry?: ComponentRegistry;\n\n /** The data state to show. Defaults to the seeded, populated records. */\n state?: TemplatePreviewState;\n}\n\n/**\n * Boots one gallery screen through the real engine.\n *\n * Nothing here is a preview-only path: the screen is a real {@link Screen}, its element tree is resolved by\n * the real `resolveComponentName`, and it is rendered by the real `SceneElementView` against the real\n * registry. That is the point of shipping a gallery at all - a mockup proves that someone can draw a\n * dashboard, and this proves the blueprint renders one.\n *\n * Component names belonging to packages the host has not loaded resolve but find no implementation, and\n * come out as `UnresolvedComponent`'s dashed red box naming what is missing. That is the designed outcome:\n * a preview of a blueprint against half a profile should look visibly incomplete rather than quietly\n * wrong.\n */\nexport function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated }: GalleryScreenPreviewProps) {\n const element = useMemo(() => {\n const screen = galleryScreen(screenName);\n if (!screen) {\n throw new Error(`The gallery has no screen named '${screenName}'.`);\n }\n\n return applyTemplatePreviewState(resolveElementComponentNames(composeScreenElement(screen), galleryPreviewProfile, galleryComponentCatalog), state);\n }, [screenName, state]);\n\n return (\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={themes}>\n <SceneElementView element={element} registry={registry} resolveBinding={() => undefined} />\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n );\n}\n"],"names":["galleryPreviewRegistry","coreComponents","defaultBlueprintComponents","GalleryScreenPreview","screenName","initialConfig","themes","defaultBlueprintThemes","registry","state","TemplatePreviewState","Populated","element","useMemo","screen","galleryScreen","Error","applyTemplatePreviewState","resolveElementComponentNames","composeScreenElement","galleryPreviewProfile","galleryComponentCatalog","_jsx","LayoutConfigProvider","storage","LayoutThemeProvider","SceneElementView","resolveBinding","undefined"],"mappings":";;;;;;;;;;;;;;AAgBA;;;;;;UAOaA,sBAAAA,GAA4C;AAAE,IAAA,GAAGC,cAAc;AAAE,IAAA,GAAGC;AAA2B;AAmB5G;;;;;;;;;;;;AAYC,IACM,SAASC,oBAAAA,CAAqB,EAAEC,UAAU,EAAEC,aAAa,EAAEC,MAAAA,GAASC,sBAAsB,EAAEC,QAAAA,GAAWR,sBAAsB,EAAES,KAAAA,GAAQC,oBAAAA,CAAqBC,SAAS,EAA6B,EAAA;AACrM,IAAA,MAAMC,UAAUC,OAAAA,CAAQ,IAAA;AACpB,QAAA,MAAMC,SAASC,aAAAA,CAAcX,UAAAA,CAAAA;AAC7B,QAAA,IAAI,CAACU,MAAAA,EAAQ;AACT,YAAA,MAAM,IAAIE,KAAAA,CAAM,CAAC,iCAAiC,EAAEZ,UAAAA,CAAW,EAAE,CAAC,CAAA;AACtE,QAAA;AAEA,QAAA,OAAOa,yBAAAA,CAA0BC,4BAAAA,CAA6BC,oBAAAA,CAAqBL,MAAAA,CAAAA,EAASM,uBAAuBC,uBAAAA,CAAAA,EAA0BZ,KAAAA,CAAAA;IACjJ,CAAA,EAAG;AAACL,QAAAA,UAAAA;AAAYK,QAAAA;AAAM,KAAA,CAAA;AAEtB,IAAA,qBACIa,GAAA,CAACC,oBAAAA,EAAAA;QAAqBlB,aAAAA,EAAeA,aAAAA;QAAemB,OAAAA,EAAS,IAAA;AACzD,QAAA,QAAA,gBAAAF,GAAA,CAACG,mBAAAA,EAAAA;YAAoBnB,MAAAA,EAAQA,MAAAA;AACzB,YAAA,QAAA,gBAAAgB,GAAA,CAACI,gBAAAA,EAAAA;gBAAiBd,OAAAA,EAASA,OAAAA;gBAASJ,QAAAA,EAAUA,QAAAA;AAAUmB,gBAAAA,cAAAA,EAAgB,IAAMC;;;;AAI9F;;"}
|
|
1
|
+
{"version":3,"file":"GalleryScreenPreview.js","sources":["../../../gallery/GalleryScreenPreview.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 } from 'react';\nimport { ExternalComponent, SampleDataPack, SceneElement, Theme } from '@cratis/scene.model';\nimport { ComponentRegistry, SceneElementView, coreComponents } from '@cratis/scene.react';\nimport { LayoutConfigProvider, LayoutConfigState } from '../configuration';\nimport { ComponentName } from '../ComponentName';\nimport { defaultBlueprintComponents } from '../defaultBlueprintComponents';\nimport { ComponentState, foundationSamples } from '../foundation';\nimport { defaultBlueprintName } from '../packageName';\nimport { LayoutThemeProvider, defaultBlueprintThemes } from '../themes';\nimport { composeScreenElement } from './composeScreen';\nimport { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile';\nimport { resolveElementComponentNames } from './resolveElementNames';\nimport { galleryScreen } from './screens';\nimport { TemplatePreviewState } from './TemplatePreviewState';\nimport { applyTemplatePreviewState } from './applyTemplatePreviewState';\n\n/**\n * The registry a preview resolves against when a host does not supply one: `core` plus this blueprint.\n *\n * Merged by hand rather than through `mergePackageRegistries`, because reaching for this blueprint's\n * *bundle* here would be circular - the bundle is assembled from the gallery this file belongs to. Registry\n * keys carry their package name, so merge order cannot cause a collision either way.\n */\nexport const galleryPreviewRegistry: ComponentRegistry = { ...coreComponents, ...defaultBlueprintComponents };\n\nexport interface GalleryScreenPreviewProps {\n /** The name of the gallery screen to boot. */\n screenName: string;\n\n /** Configuration to start from - a story pinning a mode, or a host restoring a session. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The themes the configurator may switch between. Defaults to the two this blueprint ships. */\n themes?: Theme[];\n\n /** The component registry to render against. Defaults to `core` plus this blueprint's own components. */\n registry?: ComponentRegistry;\n\n /** The data state to show. Defaults to the seeded, populated records. */\n state?: TemplatePreviewState;\n\n /**\n * The sample-data pack that stands in for the queries the templates bind to: each set's `shape` is a query name and its `rows` that query's result.\n * Templates carry no rows of their own - they declare where the data comes from (spec SD1) - so a preview of a foundation template needs one.\n */\n pack?: SampleDataPack;\n\n /**\n * A standard state (spec Part B 1.4) to force on every foundation component that owns the five states: loading, error, no-permission or partial.\n * This is how a designer inspects each one on a real template - it only sets the `state` property the components already read, so there is no\n * second code path. `error`, `permissionSubject` and `failedRegions` give the state its message.\n */\n forceState?: ForcedComponentState;\n}\n\n/** The standard states a preview can force on a template's components. */\nexport interface ForcedComponentState {\n state: ComponentState;\n error?: string;\n permissionSubject?: string;\n failedRegions?: string[];\n}\n\n/** Components that are chrome or controls rather than data-showing regions, and so do not own the five states. */\nconst withoutStates = new Set<string>([\n ComponentName.EmptyState, ComponentName.TrendChip, ComponentName.StatusChip, ComponentName.BulkBar, ComponentName.GlobalSearch, ComponentName.NotificationsButton,\n]);\n\n/** Sets the forced state on every region that owns the five states, leaving chrome and controls as they are. */\nexport function forceComponentState(element: SceneElement, forced: ForcedComponentState): SceneElement {\n const external = element as Partial<ExternalComponent>;\n const children = (element as { children?: SceneElement[] }).children;\n const slots = external.slots ? Object.fromEntries(Object.entries(external.slots).map(([slot, inner]) => [slot, inner.map(child => forceComponentState(child, forced))])) : undefined;\n const bare = typeof external.componentName === 'string' ? external.componentName.substring(external.componentName.lastIndexOf(':') + 1) : undefined;\n const owns = bare !== undefined && external.componentName!.includes(defaultBlueprintName) && (bare in foundationSamples) && foundationSamples[bare].stateful && !withoutStates.has(bare);\n\n return {\n ...element,\n ...(owns ? { properties: { ...external.properties, ...forced } } : {}),\n ...(slots ? { slots } : {}),\n ...(children ? { children: children.map(child => forceComponentState(child, forced)) } : {}),\n } as SceneElement;\n}\n\n/**\n * A pack as the query results the templates bind to: one entry for each set, keyed by the set's shape name.\n *\n * The state is a property of the *data*, not of the template: Empty answers every query with no rows; Loading and Error withhold the answer, which is\n * what a query that has not come back or has failed looks like to a component, so each shows its own skeleton or error exactly as it will in an application.\n * The elements themselves are untouched, which is why the same template previews in every state with no per-template code.\n */\nexport const queryResultsOf = (pack: SampleDataPack | undefined, state: TemplatePreviewState = TemplatePreviewState.Populated): Record<string, unknown> | undefined => {\n if (pack === undefined) return undefined;\n if (state === TemplatePreviewState.Empty) return Object.fromEntries(pack.sets.map(set => [set.shape, []]));\n return Object.fromEntries(pack.sets.map(set => [set.shape, set.rows]));\n};\n\n/**\n * Boots one gallery screen through the real engine.\n *\n * Nothing here is a preview-only path: the screen is a real {@link Screen}, its element tree is resolved by\n * the real `resolveComponentName`, and it is rendered by the real `SceneElementView` against the real\n * registry. That is the point of shipping a gallery at all - a mockup proves that someone can draw a\n * dashboard, and this proves the blueprint renders one.\n *\n * Component names belonging to packages the host has not loaded resolve but find no implementation, and\n * come out as `UnresolvedComponent`'s dashed red box naming what is missing. That is the designed outcome:\n * a preview of a blueprint against half a profile should look visibly incomplete rather than quietly\n * wrong.\n */\nexport function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated, pack, forceState }: GalleryScreenPreviewProps) {\n const element = useMemo(() => {\n const screen = galleryScreen(screenName);\n if (!screen) {\n throw new Error(`The gallery has no screen named '${screenName}'.`);\n }\n\n const resolved = applyTemplatePreviewState(resolveElementComponentNames(composeScreenElement(screen), galleryPreviewProfile, galleryComponentCatalog), state);\n return forceState ? forceComponentState(resolved, forceState) : resolved;\n }, [screenName, state, forceState]);\n\n return (\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={themes}>\n <SceneElementView element={element} registry={registry} resolveBinding={() => undefined} queryResults={queryResultsOf(pack, state)} />\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n );\n}\n"],"names":["galleryPreviewRegistry","coreComponents","defaultBlueprintComponents","withoutStates","Set","ComponentName","EmptyState","TrendChip","StatusChip","BulkBar","GlobalSearch","NotificationsButton","forceComponentState","element","forced","external","children","slots","Object","fromEntries","entries","map","slot","inner","child","undefined","bare","componentName","substring","lastIndexOf","owns","includes","defaultBlueprintName","foundationSamples","stateful","has","properties","queryResultsOf","pack","state","TemplatePreviewState","Populated","Empty","sets","set","shape","rows","GalleryScreenPreview","screenName","initialConfig","themes","defaultBlueprintThemes","registry","forceState","useMemo","screen","galleryScreen","Error","resolved","applyTemplatePreviewState","resolveElementComponentNames","composeScreenElement","galleryPreviewProfile","galleryComponentCatalog","_jsx","LayoutConfigProvider","storage","LayoutThemeProvider","SceneElementView","resolveBinding","queryResults"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA;;;;;;UAOaA,sBAAAA,GAA4C;AAAE,IAAA,GAAGC,cAAc;AAAE,IAAA,GAAGC;AAA2B;AAwC5G,mHACA,MAAMC,aAAAA,GAAgB,IAAIC,GAAAA,CAAY;AAClCC,IAAAA,aAAAA,CAAcC,UAAU;AAAED,IAAAA,aAAAA,CA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AiC,EAAET,UAAAA,CAAW,EAAE,CAAC,CAAA;AACtE,QAAA;AAEA,QAAA,MAAMU,WAAWC,yBAAAA,CAA0BC,4BAAAA,CAA6BC,oBAAAA,CAAqBN,MAAAA,CAAAA,EAASO,uBAAuBC,uBAAAA,CAAAA,EAA0BxB,KAAAA,CAAAA;QACvJ,OAAOc,UAAAA,GAAazC,mBAAAA,CAAoB8C,QAAAA,EAAUL,UAAAA,CAAAA,GAAcK,QAAAA;IACpE,CAAA,EAAG;AAACV,QAAAA,UAAAA;AAAYT,QAAAA,KAAAA;AAAOc,QAAAA;AAAW,KAAA,CAAA;AAElC,IAAA,qBACIW,GAAA,CAACC,oBAAAA,EAAAA;QAAqBhB,aAAAA,EAAeA,aAAAA;QAAeiB,OAAAA,EAAS,IAAA;AACzD,QAAA,QAAA,gBAAAF,GAAA,CAACG,mBAAAA,EAAAA;YAAoBjB,MAAAA,EAAQA,MAAAA;AACzB,YAAA,QAAA,gBAAAc,GAAA,CAACI,gBAAAA,EAAAA;gBAAiBvD,OAAAA,EAASA,OAAAA;gBAASuC,QAAAA,EAAUA,QAAAA;AAAUiB,gBAAAA,cAAAA,EAAgB,IAAM5C,SAAAA;AAAW6C,gBAAAA,YAAAA,EAAcjC,eAAeC,IAAAA,EAAMC,KAAAA;;;;AAI5I;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationChrome.d.ts","sourceRoot":"","sources":["../../../gallery/applicationChrome.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"applicationChrome.d.ts","sourceRoot":"","sources":["../../../gallery/applicationChrome.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA0CtE,MAAM,WAAW,eAAe;IAE5B,KAAK,EAAE,MAAM,CAAC;IAGd,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAYD,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAwCrH;AASD,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAE/D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { BindingSourceKind } from '@cratis/scene.model';
|
|
1
2
|
import { ComponentName } from '../ComponentName.js';
|
|
2
3
|
import { SlotName } from '../layouts/SlotName.js';
|
|
3
|
-
import '@cratis/scene.model';
|
|
4
4
|
import '../layouts/shellComponents.js';
|
|
5
5
|
import '../layouts/appShell.js';
|
|
6
6
|
import '../layouts/fullPage.js';
|
|
@@ -62,6 +62,23 @@ import { navigationGroups, entriesInGroup, navigationElement } from './navigatio
|
|
|
62
62
|
logo('topbar-logo')
|
|
63
63
|
],
|
|
64
64
|
end: [
|
|
65
|
+
// The topbar of Part B 2.1: logo, search, notifications, the environment, and the user. The search and the bell are the foundation
|
|
66
|
+
// components, so they work everywhere the shell does; the unread count is a query result, never a value.
|
|
67
|
+
externalComponent('topbar-search', ComponentName.GlobalSearch, {
|
|
68
|
+
placeholder: 'Search',
|
|
69
|
+
label: 'Search the application'
|
|
70
|
+
}),
|
|
71
|
+
externalComponent('topbar-notifications', ComponentName.NotificationsButton, {
|
|
72
|
+
count: {
|
|
73
|
+
kind: BindingSourceKind.QueryResult,
|
|
74
|
+
query: 'NotificationCount',
|
|
75
|
+
path: '0.count'
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
externalComponent('topbar-environment', ComponentName.StatusChip, {
|
|
79
|
+
status: 'Production',
|
|
80
|
+
tone: 'info'
|
|
81
|
+
}),
|
|
65
82
|
externalComponent('topbar-user', ComponentName.UserMenu, {
|
|
66
83
|
name: 'Amelia Nyquist',
|
|
67
84
|
role: 'Owner',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationChrome.js","sources":["../../../gallery/applicationChrome.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 { SceneElement } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName } from '../layouts';\nimport { defaultBlueprintThemes } from '../themes';\nimport { externalComponent } from './elements';\nimport { entriesInGroup, navigationElement, navigationGroups } from './navigation';\n\n/**\n * The chrome every screen in the application shell shares: the topbar, the sidebar, the menu, the footer\n * and the configurator.\n *\n * It is built once, per screen, rather than repeated in twenty templates. A screen template describes what\n * is *different* about a screen; if it also had to describe the topbar, then adding an item to the menu\n * would mean editing twenty files, and nineteen of them would eventually be missed.\n */\n\n/** The brand mark, shared by the topbar and the sidebar header. */\nfunction logo(id: string): SceneElement {\n return externalComponent(id, ComponentName.Logo, { label: 'Contoso', initials: 'C', targetScreen: 'Dashboard' });\n}\n\n/** One menu section per navigation group, each holding that group's entries. */\nfunction menuSections(activeScreen: string): SceneElement[] {\n return navigationGroups.map(group =>\n externalComponent(\n `menu-${group.toLowerCase()}`,\n ComponentName.Menu,\n { title: group, label: group },\n { items: entriesInGroup(group).map(entry => navigationElement(entry, activeScreen)) },\n ),\n );\n}\n\n/** The configurator, offering the themes this blueprint ships. */\nfunction configPanel(): SceneElement {\n return externalComponent(ComponentName.ConfigPanel, ComponentName.ConfigPanel, {\n title: 'Settings',\n themes: defaultBlueprintThemes.map(theme => ({ name: theme.name, label: theme.name, isDark: theme.isDark ?? false })),\n });\n}\n\n/** One trail entry: a label, and the screen it goes back to. */\nexport interface BreadcrumbEntry {\n /** What the entry is called. */\n label: string;\n\n /** The screen it navigates back to, or undefined for the current page. */\n targetScreen?: string;\n}\n\n/**\n * The application shell's slot content for one screen.\n *\n * Only the breadcrumb and which menu entry is marked active differ from screen to screen - everything else\n * is identical, which is the point of chrome.\n *\n * @param activeScreen The screen being rendered, so its menu entry is marked current.\n * @param breadcrumb The trail above the content.\n * @returns Slot content keyed by the {@link SlotName}s the `AppShell` layout declares.\n */\nexport function applicationChrome(activeScreen: string, breadcrumb: BreadcrumbEntry[]): Record<string, SceneElement[]> {\n return {\n [SlotName.Topbar]: [\n externalComponent(\n 'topbar',\n ComponentName.Topbar,\n {},\n {\n logo: [logo('topbar-logo')],\n end: [\n externalComponent('topbar-user', ComponentName.UserMenu, {\n name: 'Amelia Nyquist',\n role: 'Owner',\n initials: 'AN',\n items: [\n { label: 'Your profile', icon: 'pi pi-user', targetScreen: 'ProfileSettings' },\n { label: 'Help', icon: 'pi pi-question-circle', targetScreen: 'Help' },\n { label: 'Lock', icon: 'pi pi-lock', targetScreen: 'LockScreen' },\n ],\n }),\n ],\n },\n ),\n ],\n [SlotName.Sidebar]: [externalComponent('sidebar', ComponentName.Sidebar, { title: 'Contoso' }, { logo: [logo('sidebar-logo')] })],\n [SlotName.Menu]: menuSections(activeScreen),\n [SlotName.Breadcrumb]: [\n externalComponent('breadcrumb', ComponentName.Breadcrumb, {\n homeTargetScreen: 'Dashboard',\n items: breadcrumb,\n }),\n ],\n [SlotName.Footer]: [externalComponent('footer', ComponentName.Footer, { text: '© Contoso · Built with Cratis Scene' })],\n [SlotName.ConfigPanel]: [configPanel()],\n };\n}\n\n/**\n * The full-page shell's slot content: the configurator and nothing else.\n *\n * A sign-in screen has no navigation to render, but it does have to honor the chosen theme - it is very\n * often the first page anyone sees, and arriving at a light sign-in page before a dark application is a\n * jarring way to start.\n */\nexport function fullPageChrome(): Record<string, SceneElement[]> {\n return { [SlotName.ConfigPanel]: [configPanel()] };\n}\n"],"names":["logo","id","externalComponent","ComponentName","Logo","label","initials","targetScreen","menuSections","activeScreen","navigationGroups","map","group","toLowerCase","Menu","title","items","entriesInGroup","entry","navigationElement","configPanel","ConfigPanel","themes","defaultBlueprintThemes","theme","name","isDark","applicationChrome","breadcrumb","SlotName","Topbar","end","UserMenu","role","icon","Sidebar","Breadcrumb","homeTargetScreen","Footer","text","fullPageChrome"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AASA;;;;;;;AAOC,wEAGD,SAASA,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IAAAA,EAAM;oBAACA,IAAAA,CAAK,aAAA;AAAe,iBAAA;gBAC3B+B,GAAAA,EAAK;
|
|
1
|
+
{"version":3,"file":"applicationChrome.js","sources":["../../../gallery/applicationChrome.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 { BindingSourceKind, SceneElement } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName } from '../layouts';\nimport { defaultBlueprintThemes } from '../themes';\nimport { externalComponent } from './elements';\nimport { entriesInGroup, navigationElement, navigationGroups } from './navigation';\n\n/**\n * The chrome every screen in the application shell shares: the topbar, the sidebar, the menu, the footer\n * and the configurator.\n *\n * It is built once, per screen, rather than repeated in twenty templates. A screen template describes what\n * is *different* about a screen; if it also had to describe the topbar, then adding an item to the menu\n * would mean editing twenty files, and nineteen of them would eventually be missed.\n */\n\n/** The brand mark, shared by the topbar and the sidebar header. */\nfunction logo(id: string): SceneElement {\n return externalComponent(id, ComponentName.Logo, { label: 'Contoso', initials: 'C', targetScreen: 'Dashboard' });\n}\n\n/** One menu section per navigation group, each holding that group's entries. */\nfunction menuSections(activeScreen: string): SceneElement[] {\n return navigationGroups.map(group =>\n externalComponent(\n `menu-${group.toLowerCase()}`,\n ComponentName.Menu,\n { title: group, label: group },\n { items: entriesInGroup(group).map(entry => navigationElement(entry, activeScreen)) },\n ),\n );\n}\n\n/** The configurator, offering the themes this blueprint ships. */\nfunction configPanel(): SceneElement {\n return externalComponent(ComponentName.ConfigPanel, ComponentName.ConfigPanel, {\n title: 'Settings',\n themes: defaultBlueprintThemes.map(theme => ({ name: theme.name, label: theme.name, isDark: theme.isDark ?? false })),\n });\n}\n\n/** One trail entry: a label, and the screen it goes back to. */\nexport interface BreadcrumbEntry {\n /** What the entry is called. */\n label: string;\n\n /** The screen it navigates back to, or undefined for the current page. */\n targetScreen?: string;\n}\n\n/**\n * The application shell's slot content for one screen.\n *\n * Only the breadcrumb and which menu entry is marked active differ from screen to screen - everything else\n * is identical, which is the point of chrome.\n *\n * @param activeScreen The screen being rendered, so its menu entry is marked current.\n * @param breadcrumb The trail above the content.\n * @returns Slot content keyed by the {@link SlotName}s the `AppShell` layout declares.\n */\nexport function applicationChrome(activeScreen: string, breadcrumb: BreadcrumbEntry[]): Record<string, SceneElement[]> {\n return {\n [SlotName.Topbar]: [\n externalComponent(\n 'topbar',\n ComponentName.Topbar,\n {},\n {\n logo: [logo('topbar-logo')],\n end: [\n // The topbar of Part B 2.1: logo, search, notifications, the environment, and the user. The search and the bell are the foundation\n // components, so they work everywhere the shell does; the unread count is a query result, never a value.\n externalComponent('topbar-search', ComponentName.GlobalSearch, { placeholder: 'Search', label: 'Search the application' }),\n externalComponent('topbar-notifications', ComponentName.NotificationsButton, { count: { kind: BindingSourceKind.QueryResult, query: 'NotificationCount', path: '0.count' } }),\n externalComponent('topbar-environment', ComponentName.StatusChip, { status: 'Production', tone: 'info' }),\n externalComponent('topbar-user', ComponentName.UserMenu, {\n name: 'Amelia Nyquist',\n role: 'Owner',\n initials: 'AN',\n items: [\n { label: 'Your profile', icon: 'pi pi-user', targetScreen: 'ProfileSettings' },\n { label: 'Help', icon: 'pi pi-question-circle', targetScreen: 'Help' },\n { label: 'Lock', icon: 'pi pi-lock', targetScreen: 'LockScreen' },\n ],\n }),\n ],\n },\n ),\n ],\n [SlotName.Sidebar]: [externalComponent('sidebar', ComponentName.Sidebar, { title: 'Contoso' }, { logo: [logo('sidebar-logo')] })],\n [SlotName.Menu]: menuSections(activeScreen),\n [SlotName.Breadcrumb]: [\n externalComponent('breadcrumb', ComponentName.Breadcrumb, {\n homeTargetScreen: 'Dashboard',\n items: breadcrumb,\n }),\n ],\n [SlotName.Footer]: [externalComponent('footer', ComponentName.Footer, { text: '© Contoso · Built with Cratis Scene' })],\n [SlotName.ConfigPanel]: [configPanel()],\n };\n}\n\n/**\n * The full-page shell's slot content: the configurator and nothing else.\n *\n * A sign-in screen has no navigation to render, but it does have to honor the chosen theme - it is very\n * often the first page anyone sees, and arriving at a light sign-in page before a dark application is a\n * jarring way to start.\n */\nexport function fullPageChrome(): Record<string, SceneElement[]> {\n return { [SlotName.ConfigPanel]: [configPanel()] };\n}\n"],"names":["logo","id","externalComponent","ComponentName","Logo","label","initials","targetScreen","menuSections","activeScreen","navigationGroups","map","group","toLowerCase","Menu","title","items","entriesInGroup","entry","navigationElement","configPanel","ConfigPanel","themes","defaultBlueprintThemes","theme","name","isDark","applicationChrome","breadcrumb","SlotName","Topbar","end","GlobalSearch","placeholder","NotificationsButton","count","kind","BindingSourceKind","QueryResult","query","path","StatusChip","status","tone","UserMenu","role","icon","Sidebar","Breadcrumb","homeTargetScreen","Footer","text","fullPageChrome"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AASA;;;;;;;AAOC,wEAGD,SAASA,IAAAA,CAAKC,EAAU,EAAA;AACpB,IAAA,OAAOC,iBAAAA,CAAkBD,EAAAA,EAAIE,aAAAA,CAAcC,IAAI,EAAE;QAAEC,KAAAA,EAAO,SAAA;QAAWC,QAAAA,EAAU,GAAA;QAAKC,YAAAA,EAAc;AAAY,KAAA,CAAA;AAClH;AAEA,iFACA,SAASC,YAAAA,CAAaC,YAAoB,EAAA;AACtC,IAAA,OAAOC,gBAAAA,CAAiBC,GAAG,CAACC,CAAAA,QACxBV,iBAAAA,CACI,CAAC,KAAK,EAAEU,MAAMC,WAAW,EAAA,CAAA,CAAI,EAC7BV,aAAAA,CAAcW,IAAI,EAClB;YAAEC,KAAAA,EAAOH,KAAAA;YAAOP,KAAAA,EAAOO;SAAM,EAC7B;AAAEI,YAAAA,KAAAA,EAAOC,eAAeL,KAAAA,CAAAA,CAAOD,GAAG,CAACO,CAAAA,KAAAA,GAASC,kBAAkBD,KAAAA,EAAOT,YAAAA,CAAAA;AAAe,SAAA,CAAA,CAAA;AAGhG;AAEA,mEACA,SAASW,WAAAA,GAAAA;AACL,IAAA,OAAOlB,kBAAkBC,aAAAA,CAAckB,WAA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A;AACrD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScreen.d.ts","sourceRoot":"","sources":["../../../gallery/composeScreen.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgBtG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAqBhH;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,cAAc,CAE3E;
|
|
1
|
+
{"version":3,"file":"composeScreen.d.ts","sourceRoot":"","sources":["../../../gallery/composeScreen.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgBtG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAqBhH;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,cAAc,CAE3E;AA8BD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAOtE"}
|
|
@@ -59,13 +59,15 @@ function placeInside(outer, inner) {
|
|
|
59
59
|
if (!inner.fitsSlot) {
|
|
60
60
|
return outer;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
// A container-qualified name (`WorkspaceScreen.moduleContent`) says which container; the slot's own name is what the container's content is keyed by.
|
|
63
|
+
const slot = inner.fitsSlot.substring(inner.fitsSlot.lastIndexOf('.') + 1);
|
|
64
|
+
const innerContent = inner.slots.flatMap((innerSlot)=>inner.content?.[innerSlot.name] ?? []);
|
|
63
65
|
return {
|
|
64
66
|
...outer,
|
|
65
67
|
content: {
|
|
66
68
|
...outer.content,
|
|
67
|
-
[
|
|
68
|
-
...outer.content?.[
|
|
69
|
+
[slot]: [
|
|
70
|
+
...outer.content?.[slot] ?? [],
|
|
69
71
|
...innerContent
|
|
70
72
|
]
|
|
71
73
|
}
|