@cratis/scene.blueprint.default 4.40.0 → 4.42.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 +9 -0
- package/defaultBlueprint.ts +1 -0
- package/defaultBlueprintComponents.ts +4 -1
- package/dist/cjs/ComponentName.js +3 -0
- package/dist/cjs/ComponentName.js.map +1 -1
- package/dist/cjs/defaultBlueprint.js +20 -1
- package/dist/cjs/defaultBlueprint.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponentMetadata.js +11 -0
- package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponents.js +17 -0
- package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
- package/dist/cjs/foundation/ActionButton.js.map +1 -1
- package/dist/cjs/foundation/ActionButtonControl.js +46 -0
- package/dist/cjs/foundation/ActionButtonControl.js.map +1 -0
- package/dist/cjs/foundation/DialogFrame.js +196 -0
- package/dist/cjs/foundation/DialogFrame.js.map +1 -0
- package/dist/cjs/foundation/FormScreenBody.js +13 -3
- package/dist/cjs/foundation/FormScreenBody.js.map +1 -1
- package/dist/cjs/foundation/Notice.js +51 -0
- package/dist/cjs/foundation/Notice.js.map +1 -0
- package/dist/cjs/foundation/formModel.js +1 -0
- package/dist/cjs/foundation/formModel.js.map +1 -1
- package/dist/cjs/foundation/foundationComponentMetadata.js +22 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
- package/dist/cjs/foundation/foundationDescriptors.js +89 -0
- package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
- package/dist/cjs/foundation/foundationSamples.js +29 -0
- package/dist/cjs/foundation/foundationSamples.js.map +1 -1
- package/dist/cjs/foundation/foundationStrings.js +3 -1
- package/dist/cjs/foundation/foundationStrings.js.map +1 -1
- 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/dialogTemplates.js +254 -0
- package/dist/cjs/foundation/templates/dialogTemplates.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 +57 -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/stateScreenTemplates.js +252 -0
- package/dist/cjs/foundation/templates/stateScreenTemplates.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/gallery/GalleryDialogPreview.js +62 -0
- package/dist/cjs/gallery/GalleryDialogPreview.js.map +1 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js +78 -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/dialogTemplates.js +41 -36
- package/dist/cjs/gallery/dialogTemplates.js.map +1 -1
- package/dist/cjs/gallery/screens.js +87 -3
- package/dist/cjs/gallery/screens.js.map +1 -1
- package/dist/cjs/index.js +61 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/ComponentName.d.ts +3 -0
- package/dist/esm/ComponentName.d.ts.map +1 -1
- package/dist/esm/ComponentName.js +3 -0
- package/dist/esm/ComponentName.js.map +1 -1
- package/dist/esm/defaultBlueprint.d.ts.map +1 -1
- package/dist/esm/defaultBlueprint.js +20 -1
- package/dist/esm/defaultBlueprint.js.map +1 -1
- package/dist/esm/defaultBlueprintComponentMetadata.js +11 -0
- package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
- package/dist/esm/defaultBlueprintComponents.js +17 -0
- package/dist/esm/defaultBlueprintComponents.js.map +1 -1
- package/dist/esm/foundation/ActionButton.d.ts +1 -1
- package/dist/esm/foundation/ActionButton.d.ts.map +1 -1
- package/dist/esm/foundation/ActionButton.js.map +1 -1
- package/dist/esm/foundation/ActionButtonControl.d.ts +3 -0
- package/dist/esm/foundation/ActionButtonControl.d.ts.map +1 -0
- package/dist/esm/foundation/ActionButtonControl.js +44 -0
- package/dist/esm/foundation/ActionButtonControl.js.map +1 -0
- package/dist/esm/foundation/DialogFrame.d.ts +14 -0
- package/dist/esm/foundation/DialogFrame.d.ts.map +1 -0
- package/dist/esm/foundation/DialogFrame.js +190 -0
- package/dist/esm/foundation/DialogFrame.js.map +1 -0
- package/dist/esm/foundation/FormScreenBody.d.ts.map +1 -1
- package/dist/esm/foundation/FormScreenBody.js +13 -3
- package/dist/esm/foundation/FormScreenBody.js.map +1 -1
- package/dist/esm/foundation/Notice.d.ts +3 -0
- package/dist/esm/foundation/Notice.d.ts.map +1 -0
- package/dist/esm/foundation/Notice.js +49 -0
- package/dist/esm/foundation/Notice.js.map +1 -0
- package/dist/esm/foundation/formModel.d.ts +2 -1
- package/dist/esm/foundation/formModel.d.ts.map +1 -1
- package/dist/esm/foundation/formModel.js +1 -0
- package/dist/esm/foundation/formModel.js.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.js +22 -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 +89 -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 +29 -0
- package/dist/esm/foundation/foundationSamples.js.map +1 -1
- package/dist/esm/foundation/foundationStrings.d.ts +2 -0
- package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
- package/dist/esm/foundation/foundationStrings.js +3 -1
- package/dist/esm/foundation/foundationStrings.js.map +1 -1
- package/dist/esm/foundation/index.d.ts +4 -0
- package/dist/esm/foundation/index.d.ts.map +1 -1
- package/dist/esm/foundation/index.js +4 -0
- package/dist/esm/foundation/index.js.map +1 -1
- 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/dialogTemplates.d.ts +20 -0
- package/dist/esm/foundation/templates/dialogTemplates.d.ts.map +1 -0
- package/dist/esm/foundation/templates/dialogTemplates.js +243 -0
- package/dist/esm/foundation/templates/dialogTemplates.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 +13 -0
- package/dist/esm/foundation/templates/index.d.ts.map +1 -0
- package/dist/esm/foundation/templates/index.js +27 -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/stateScreenTemplates.d.ts +8 -0
- package/dist/esm/foundation/templates/stateScreenTemplates.d.ts.map +1 -0
- package/dist/esm/foundation/templates/stateScreenTemplates.js +245 -0
- package/dist/esm/foundation/templates/stateScreenTemplates.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/gallery/FoundationDialogs.stories.d.ts +35 -0
- package/dist/esm/gallery/FoundationDialogs.stories.d.ts.map +1 -0
- package/dist/esm/gallery/FoundationDialogs.stories.js +38 -0
- package/dist/esm/gallery/FoundationDialogs.stories.js.map +1 -0
- package/dist/esm/gallery/GalleryDialogPreview.d.ts +17 -0
- package/dist/esm/gallery/GalleryDialogPreview.d.ts.map +1 -0
- package/dist/esm/gallery/GalleryDialogPreview.js +59 -0
- package/dist/esm/gallery/GalleryDialogPreview.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 +77 -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/dialogTemplates.d.ts.map +1 -1
- package/dist/esm/gallery/dialogTemplates.js +42 -37
- package/dist/esm/gallery/dialogTemplates.js.map +1 -1
- package/dist/esm/gallery/index.d.ts +1 -0
- package/dist/esm/gallery/index.d.ts.map +1 -1
- package/dist/esm/gallery/index.js +1 -0
- package/dist/esm/gallery/index.js.map +1 -1
- package/dist/esm/gallery/screens.d.ts.map +1 -1
- package/dist/esm/gallery/screens.js +87 -3
- package/dist/esm/gallery/screens.js.map +1 -1
- package/dist/esm/index.js +17 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/foundation/ActionButton.tsx +1 -1
- package/foundation/ActionButtonControl.tsx +37 -0
- package/foundation/DialogFrame.tsx +138 -0
- package/foundation/FormScreenBody.tsx +6 -3
- package/foundation/Notice.tsx +33 -0
- package/foundation/formModel.ts +1 -0
- package/foundation/foundationComponentMetadata.ts +3 -0
- package/foundation/foundationDescriptors.ts +41 -0
- package/foundation/foundationSamples.ts +3 -0
- package/foundation/foundationStrings.ts +2 -0
- package/foundation/index.ts +4 -0
- package/foundation/templates/boardScreenTemplate.ts +28 -0
- package/foundation/templates/dashboardScreenTemplate.ts +37 -0
- package/foundation/templates/dialogTemplates.ts +114 -0
- package/foundation/templates/formScreenTemplate.ts +28 -0
- package/foundation/templates/index.ts +28 -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/stateScreenTemplates.ts +107 -0
- package/foundation/templates/templateParts.ts +30 -0
- package/foundation/templates/wizardScreenTemplate.ts +33 -0
- package/foundation/templates/workspaceScreenTemplate.ts +27 -0
- package/gallery/FoundationDialogs.stories.tsx +74 -0
- package/gallery/GalleryDialogPreview.tsx +68 -0
- package/gallery/GalleryScreenPreview.tsx +64 -5
- package/gallery/applicationChrome.ts +6 -1
- package/gallery/composeScreen.ts +4 -2
- package/gallery/dialogTemplates.ts +22 -17
- package/gallery/index.ts +1 -0
- package/gallery/screens.ts +18 -2
- package/package.json +10 -8
- package/sampleData/foundation-en.json +661 -0
- package/shell/layout.css +219 -0
- package/thumbnails/BoardScreen.svg +15 -0
- package/thumbnails/ConfirmDialog.svg +12 -0
- package/thumbnails/DashboardScreen.svg +18 -0
- package/thumbnails/DetailDialog.svg +11 -0
- package/thumbnails/ErrorScreen.svg +11 -0
- package/thumbnails/FilterDialog.svg +16 -0
- package/thumbnails/ForbiddenScreen.svg +10 -0
- package/thumbnails/FormDialog.svg +12 -0
- package/thumbnails/FormScreen.svg +14 -0
- package/thumbnails/ListScreen.svg +16 -0
- package/thumbnails/LoginScreen.svg +12 -0
- package/thumbnails/LookupDialog.svg +13 -0
- package/thumbnails/MasterDetailScreen.svg +22 -0
- package/thumbnails/NotFoundScreen.svg +9 -0
- package/thumbnails/QuickCreateDialog.svg +12 -0
- package/thumbnails/RecordPage.svg +17 -0
- package/thumbnails/SideSheet.svg +13 -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,35 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { SampleDataPack } from '@cratis/scene.model';
|
|
3
|
+
import { GalleryDialogPreview } from './GalleryDialogPreview';
|
|
4
|
+
import { GalleryScreenPreview } from './GalleryScreenPreview';
|
|
5
|
+
declare const loadPack: () => Promise<{
|
|
6
|
+
pack: SampleDataPack;
|
|
7
|
+
}>;
|
|
8
|
+
declare const meta: {
|
|
9
|
+
title: string;
|
|
10
|
+
component: typeof GalleryDialogPreview;
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: string;
|
|
13
|
+
};
|
|
14
|
+
loaders: (typeof loadPack)[];
|
|
15
|
+
render: (args: import("./GalleryDialogPreview").GalleryDialogPreviewProps, { loaded }: import("storybook/internal/csf").StoryContext<import("@storybook/react").ReactRenderer, import("./GalleryDialogPreview").GalleryDialogPreviewProps>) => import("react").JSX.Element;
|
|
16
|
+
args: {
|
|
17
|
+
registry: import("@cratis/scene.react").ComponentRegistry;
|
|
18
|
+
dialogName: string;
|
|
19
|
+
};
|
|
20
|
+
tags: string[];
|
|
21
|
+
};
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
export declare const Confirm: Story;
|
|
25
|
+
export declare const QuickCreate: Story;
|
|
26
|
+
export declare const Lookup: Story;
|
|
27
|
+
export declare const LookupEmpty: Story;
|
|
28
|
+
export declare const LookupLoading: Story;
|
|
29
|
+
export declare const LookupError: Story;
|
|
30
|
+
export declare const LookupNoPermission: Story;
|
|
31
|
+
export declare const LookupPartial: Story;
|
|
32
|
+
export declare const SideSheet: Story;
|
|
33
|
+
export declare const Filter: Story;
|
|
34
|
+
export declare const StateScreens: StoryObj<typeof GalleryScreenPreview>;
|
|
35
|
+
//# sourceMappingURL=FoundationDialogs.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FoundationDialogs.stories.d.ts","sourceRoot":"","sources":["../../../gallery/FoundationDialogs.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9D,QAAA,MAAM,QAAQ;UAA+D,cAAc;EAAG,CAAC;AAO/F,QAAA,MAAM,IAAI;;;;QAGQ,MAAM;;;;;;;;;CAKqB,CAAC;eAE/B,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAGjC,eAAO,MAAM,WAAW,EAAE,KAAqD,CAAC;AAGhF,eAAO,MAAM,MAAM,EAAE,KAAgD,CAAC;AAGtE,eAAO,MAAM,WAAW,EAAE,KAAmF,CAAC;AAG9G,eAAO,MAAM,aAAa,EAAE,KAA+F,CAAC;AAG5H,eAAO,MAAM,WAAW,EAAE,KAAiI,CAAC;AAG5J,eAAO,MAAM,kBAAkB,EAAE,KAAuI,CAAC;AAGzK,eAAO,MAAM,aAAa,EAAE,KAA4H,CAAC;AAGzJ,eAAO,MAAM,SAAS,EAAE,KAA6C,CAAC;AAGtE,eAAO,MAAM,MAAM,EAAE,KAAgD,CAAC;AAGtE,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,OAAO,oBAAoB,CAK9D,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { corePackage, mergePackageRegistries } from '@cratis/scene.react';
|
|
3
|
+
import { primeReactPackage } from '@cratis/scene.primereact';
|
|
4
|
+
import { defaultBlueprint } from '../defaultBlueprint';
|
|
5
|
+
import { ComponentState } from '../foundation';
|
|
6
|
+
import { GalleryDialogPreview } from './GalleryDialogPreview';
|
|
7
|
+
import { GalleryScreenPreview } from './GalleryScreenPreview';
|
|
8
|
+
import { TemplatePreviewState } from './TemplatePreviewState';
|
|
9
|
+
const registry = mergePackageRegistries([corePackage, primeReactPackage, defaultBlueprint]);
|
|
10
|
+
const packUrl = new URL('../sampleData/foundation-en.json', import.meta.url).href;
|
|
11
|
+
const loadPack = async () => ({ pack: await (await fetch(packUrl)).json() });
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'Blueprint/Foundation dialogs',
|
|
14
|
+
component: GalleryDialogPreview,
|
|
15
|
+
parameters: { layout: 'fullscreen' },
|
|
16
|
+
loaders: [loadPack],
|
|
17
|
+
render: (args, { loaded }) => _jsx(GalleryDialogPreview, { ...args, pack: loaded.pack }),
|
|
18
|
+
args: { registry, dialogName: 'ConfirmDialog' },
|
|
19
|
+
tags: ['autodocs'],
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
export const Confirm = {};
|
|
23
|
+
export const QuickCreate = { args: { dialogName: 'QuickCreateDialog' } };
|
|
24
|
+
export const Lookup = { args: { dialogName: 'LookupDialog' } };
|
|
25
|
+
export const LookupEmpty = { args: { dialogName: 'LookupDialog', state: TemplatePreviewState.Empty } };
|
|
26
|
+
export const LookupLoading = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.Loading } } };
|
|
27
|
+
export const LookupError = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.Error, error: 'The server did not answer' } } };
|
|
28
|
+
export const LookupNoPermission = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.NoPermission, permissionSubject: 'the accounts' } } };
|
|
29
|
+
export const LookupPartial = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.Partial, failedRegions: ['Accounts'] } } };
|
|
30
|
+
export const SideSheet = { args: { dialogName: 'SideSheet' } };
|
|
31
|
+
export const Filter = { args: { dialogName: 'FilterDialog' } };
|
|
32
|
+
export const StateScreens = {
|
|
33
|
+
loaders: [loadPack],
|
|
34
|
+
render: (args, { loaded }) => _jsx(GalleryScreenPreview, { ...args, registry: registry, pack: loaded.pack }),
|
|
35
|
+
args: { screenName: 'LoginScreen' },
|
|
36
|
+
argTypes: { screenName: { control: 'select', options: ['LoginScreen', 'NotFoundScreen', 'ForbiddenScreen', 'ErrorScreen'] } },
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=FoundationDialogs.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FoundationDialogs.stories.js","sourceRoot":"","sources":["../../../gallery/FoundationDialogs.stories.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,w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AE;IACnC,QAAQ,EAAE,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,CAAC,EAAE,EAAE;CAChI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DialogTemplate, SampleDataPack, Theme } from '@cratis/scene.model';
|
|
2
|
+
import { ComponentRegistry } from '@cratis/scene.react';
|
|
3
|
+
import { LayoutConfigState } from '../configuration';
|
|
4
|
+
import { ForcedComponentState } from './GalleryScreenPreview';
|
|
5
|
+
import { TemplatePreviewState } from './TemplatePreviewState';
|
|
6
|
+
export declare const galleryDialogTemplate: (name: string) => DialogTemplate | undefined;
|
|
7
|
+
export interface GalleryDialogPreviewProps {
|
|
8
|
+
dialogName: string;
|
|
9
|
+
initialConfig?: Partial<LayoutConfigState>;
|
|
10
|
+
themes?: Theme[];
|
|
11
|
+
registry?: ComponentRegistry;
|
|
12
|
+
state?: TemplatePreviewState;
|
|
13
|
+
pack?: SampleDataPack;
|
|
14
|
+
forceState?: ForcedComponentState;
|
|
15
|
+
}
|
|
16
|
+
export declare function GalleryDialogPreview({ dialogName, initialConfig, themes, registry, state, pack, forceState }: GalleryDialogPreviewProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=GalleryDialogPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryDialogPreview.d.ts","sourceRoot":"","sources":["../../../gallery/GalleryDialogPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAoB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAwB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI3E,OAAO,EAAE,oBAAoB,EAA+D,MAAM,wBAAwB,CAAC;AAI3H,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,eAAO,MAAM,qBAAqB,SAAU,MAAM,KAAG,cAAc,GAAG,SAA4E,CAAC;AAEnJ,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;IAG7B,IAAI,CAAC,EAAE,cAAc,CAAC;IAGtB,UAAU,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAOD,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,MAA+B,EAAE,QAAiC,EAAE,KAAsC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,yBAAyB,+BAoB1N"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { SceneElementView } from '@cratis/scene.react';
|
|
4
|
+
import { LayoutConfigProvider } from '../configuration/LayoutConfigProvider.js';
|
|
5
|
+
import { previewTemplateComponent, previewComponents } from '../preview-host/PreviewTemplate.js';
|
|
6
|
+
import { defaultBlueprintThemes } from '../themes/defaultBlueprintThemes.js';
|
|
7
|
+
import { LayoutThemeProvider } from '../themes/LayoutThemeProvider.js';
|
|
8
|
+
import { externalComponent } from './elements.js';
|
|
9
|
+
import { forceComponentState, galleryPreviewRegistry, queryResultsOf } from './GalleryScreenPreview.js';
|
|
10
|
+
import { galleryDialogTemplates } from './dialogTemplates.js';
|
|
11
|
+
import { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile.js';
|
|
12
|
+
import { resolveElementComponentNames } from './resolveElementNames.js';
|
|
13
|
+
import { TemplatePreviewState } from './TemplatePreviewState.js';
|
|
14
|
+
|
|
15
|
+
/** One gallery dialog template by name, for a story or a host that opens a specific one. */ const galleryDialogTemplate = (name)=>galleryDialogTemplates.find((template)=>template.name === name);
|
|
16
|
+
/**
|
|
17
|
+
* Opens one gallery dialog template the way a host does: inside a `role="dialog" aria-modal="true"` element, with the template's content in the wrapper
|
|
18
|
+
* a screen's template gets. Nothing here is a preview-only path - the dialog is a real {@link DialogTemplate} rendered by the real `SceneElementView`,
|
|
19
|
+
* and the dialog's own frame gives the host element its focus handling, placement and labelling exactly as it does in an application.
|
|
20
|
+
*/ function GalleryDialogPreview({ dialogName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated, pack, forceState }) {
|
|
21
|
+
const template = galleryDialogTemplate(dialogName);
|
|
22
|
+
if (!template) throw new Error(`The gallery has no dialog template named '${dialogName}'.`);
|
|
23
|
+
const element = useMemo(()=>{
|
|
24
|
+
const composed = externalComponent(`dialog-${template.name}`, previewTemplateComponent, {}, template.content ?? {});
|
|
25
|
+
const resolved = resolveElementComponentNames(composed, galleryPreviewProfile, galleryComponentCatalog);
|
|
26
|
+
return forceState ? forceComponentState(resolved, forceState) : resolved;
|
|
27
|
+
}, [
|
|
28
|
+
template,
|
|
29
|
+
forceState
|
|
30
|
+
]);
|
|
31
|
+
const full = useMemo(()=>({
|
|
32
|
+
...registry,
|
|
33
|
+
...previewComponents
|
|
34
|
+
}), [
|
|
35
|
+
registry
|
|
36
|
+
]);
|
|
37
|
+
return /*#__PURE__*/ jsx(LayoutConfigProvider, {
|
|
38
|
+
initialConfig: initialConfig,
|
|
39
|
+
storage: null,
|
|
40
|
+
children: /*#__PURE__*/ jsx(LayoutThemeProvider, {
|
|
41
|
+
themes: themes,
|
|
42
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
43
|
+
role: "dialog",
|
|
44
|
+
"aria-modal": "true",
|
|
45
|
+
"aria-label": template.displayName ?? template.name,
|
|
46
|
+
"data-scene-dialog": template.name,
|
|
47
|
+
children: /*#__PURE__*/ jsx(SceneElementView, {
|
|
48
|
+
element: element,
|
|
49
|
+
registry: full,
|
|
50
|
+
resolveBinding: ()=>undefined,
|
|
51
|
+
queryResults: queryResultsOf(pack, state)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { GalleryDialogPreview, galleryDialogTemplate };
|
|
59
|
+
//# sourceMappingURL=GalleryDialogPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalleryDialogPreview.js","sources":["../../../gallery/GalleryDialogPreview.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 { DialogTemplate, SampleDataPack, Theme } from '@cratis/scene.model';\nimport { ComponentRegistry, SceneElementView } from '@cratis/scene.react';\nimport { LayoutConfigProvider, LayoutConfigState } from '../configuration';\nimport { previewComponents, previewTemplateComponent } from '../preview-host/PreviewTemplate';\nimport { LayoutThemeProvider, defaultBlueprintThemes } from '../themes';\nimport { externalComponent } from './elements';\nimport { ForcedComponentState, forceComponentState, galleryPreviewRegistry, queryResultsOf } from './GalleryScreenPreview';\nimport { galleryDialogTemplates } from './dialogTemplates';\nimport { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile';\nimport { resolveElementComponentNames } from './resolveElementNames';\nimport { TemplatePreviewState } from './TemplatePreviewState';\n\n/** One gallery dialog template by name, for a story or a host that opens a specific one. */\nexport const galleryDialogTemplate = (name: string): DialogTemplate | undefined => galleryDialogTemplates.find(template => template.name === name);\n\nexport interface GalleryDialogPreviewProps {\n /** The name of the gallery dialog template to open. */\n dialogName: string;\n\n /** Configuration to start from. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The themes the preview 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 /** The sample-data pack that stands in for the queries the template binds to. */\n pack?: SampleDataPack;\n\n /** A standard state (spec Part B 1.4) to force on every foundation component of the dialog that owns the five states. */\n forceState?: ForcedComponentState;\n}\n\n/**\n * Opens one gallery dialog template the way a host does: inside a `role=\"dialog\" aria-modal=\"true\"` element, with the template's content in the wrapper\n * a screen's template gets. Nothing here is a preview-only path - the dialog is a real {@link DialogTemplate} rendered by the real `SceneElementView`,\n * and the dialog's own frame gives the host element its focus handling, placement and labelling exactly as it does in an application.\n */\nexport function GalleryDialogPreview({ dialogName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated, pack, forceState }: GalleryDialogPreviewProps) {\n const template = galleryDialogTemplate(dialogName);\n if (!template) throw new Error(`The gallery has no dialog template named '${dialogName}'.`);\n\n const element = useMemo(() => {\n const composed = externalComponent(`dialog-${template.name}`, previewTemplateComponent, {}, template.content ?? {});\n const resolved = resolveElementComponentNames(composed, galleryPreviewProfile, galleryComponentCatalog);\n return forceState ? forceComponentState(resolved, forceState) : resolved;\n }, [template, forceState]);\n const full = useMemo(() => ({ ...registry, ...previewComponents }), [registry]);\n\n return (\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={themes}>\n <div role='dialog' aria-modal='true' aria-label={template.displayName ?? template.name} data-scene-dialog={template.name}>\n <SceneElementView element={element} registry={full} resolveBinding={() => undefined} queryResults={queryResultsOf(pack, state)} />\n </div>\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n );\n}\n"],"names":["galleryDialogTemplate","name","galleryDialogTemplates","find","template","GalleryDialogPreview","dialogName","initialConfig","themes","defaultBlueprintThemes","registry","galleryPreviewRegistry","state","TemplatePreviewState","Populated","pack","forceState","Error","element","useMemo","composed","externalComponent","previewTemplateComponent","content","resolved","resolveElementComponentNames","galleryPreviewProfile","galleryComponentCatalog","forceComponentState","full","previewComponents","_jsx","LayoutConfigProvider","storage","LayoutThemeProvider","div","role","aria-modal","aria-label","displayName","data-scene-dialog","SceneElementView","resolveBinding","undefined","queryResults","queryResultsOf"],"mappings":";;;;;;;;;;;;;;AAgBA,6FACO,MAAMA,qBAAAA,GAAwB,CAACC,IAAAA,GAA6CC,sBAAAA,CAAuBC,IAAI,CAACC,CAAAA,QAAAA,GAAYA,QAAAA,CAASH,IAAI,KAAKA,IAAAA;AAyB7I;;;;IAKO,SAASI,oBAAAA,CAAqB,EAAEC,UAAU,EAAEC,aAAa,EAAEC,MAAAA,GAASC,sBAAsB,EAAEC,QAAAA,GAAWC,sBAAsB,EAAEC,KAAAA,GAAQC,oBAAAA,CAAqBC,SAAS,EAAEC,IAAI,EAAEC,UAAU,EAA6B,EAAA;AACvN,IAAA,MAAMZ,WAAWJ,qBAAAA,CAAsBM,UAAAA,CAAAA;IACvC,IAAI,CAACF,QAAAA,EAAU,MAAM,IAAIa,KAAAA,CAAM,CAAC,0CAA0C,EAAEX,UAAAA,CAAW,EAAE,CAAC,CAAA;AAE1F,IAAA,MAAMY,UAAUC,OAAAA,CAAQ,IAAA;AACpB,QAAA,MAAMC,QAAAA,GAAWC,iBAAAA,CAAkB,CAAC,OAAO,EAAEjB,QAAAA,CAASH,IAAI,CAAA,CAAE,EAAEqB,0BAA0B,EAAC,EAAGlB,QAAAA,CAASmB,OAAO,IAAI,EAAC,CAAA;QACjH,MAAMC,QAAAA,GAAWC,4BAAAA,CAA6BL,QAAAA,EAAUM,qBAAAA,EAAuBC,uBAAAA,CAAAA;QAC/E,OAAOX,UAAAA,GAAaY,mBAAAA,CAAoBJ,QAAAA,EAAUR,UAAAA,CAAAA,GAAcQ,QAAAA;IACpE,CAAA,EAAG;AAACpB,QAAAA,QAAAA;AAAUY,QAAAA;AAAW,KAAA,CAAA;IACzB,MAAMa,IAAAA,GAAOV,OAAAA,CAAQ,KAAO;AAAE,YAAA,GAAGT,QAAQ;AAAE,YAAA,GAAGoB;AAAkB,SAAA,CAAA,EAAI;AAACpB,QAAAA;AAAS,KAAA,CAAA;AAE9E,IAAA,qBACIqB,GAAA,CAACC,oBAAAA,EAAAA;QAAqBzB,aAAAA,EAAeA,aAAAA;QAAe0B,OAAAA,EAAS,IAAA;AACzD,QAAA,QAAA,gBAAAF,GAAA,CAACG,mBAAAA,EAAAA;YAAoB1B,MAAAA,EAAQA,MAAAA;AACzB,YAAA,QAAA,gBAAAuB,GAAA,CAACI,KAAAA,EAAAA;gBAAIC,IAAAA,EAAK,QAAA;gBAASC,YAAAA,EAAW,MAAA;AAAOC,gBAAAA,YAAAA,EAAYlC,QAAAA,CAASmC,WAAW,IAAInC,QAAAA,CAASH,IAAI;AAAEuC,gBAAAA,mBAAAA,EAAmBpC,SAASH,IAAI;AACpH,gBAAA,QAAA,gBAAA8B,GAAA,CAACU,gBAAAA,EAAAA;oBAAiBvB,OAAAA,EAASA,OAAAA;oBAASR,QAAAA,EAAUmB,IAAAA;AAAMa,oBAAAA,cAAAA,EAAgB,IAAMC,SAAAA;AAAWC,oBAAAA,YAAAA,EAAcC,eAAe9B,IAAAA,EAAMH,KAAAA;;;;;AAK5I;;"}
|
|
@@ -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,28 @@ 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';
|
|
25
|
+
import '../foundation/templates/dialogTemplates.js';
|
|
26
|
+
import '../foundation/templates/stateScreenTemplates.js';
|
|
8
27
|
import { composeScreenElement } from './composeScreen.js';
|
|
9
28
|
import { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile.js';
|
|
10
29
|
import { resolveElementComponentNames } from './resolveElementNames.js';
|
|
@@ -22,6 +41,56 @@ import { applyTemplatePreviewState } from './applyTemplatePreviewState.js';
|
|
|
22
41
|
...coreComponents,
|
|
23
42
|
...defaultBlueprintComponents
|
|
24
43
|
};
|
|
44
|
+
/** Components that are chrome or controls rather than data-showing regions, and so do not own the five states. */ const withoutStates = new Set([
|
|
45
|
+
ComponentName.EmptyState,
|
|
46
|
+
ComponentName.TrendChip,
|
|
47
|
+
ComponentName.StatusChip,
|
|
48
|
+
ComponentName.BulkBar,
|
|
49
|
+
ComponentName.GlobalSearch,
|
|
50
|
+
ComponentName.NotificationsButton
|
|
51
|
+
]);
|
|
52
|
+
/** Sets the forced state on every region that owns the five states, leaving chrome and controls as they are. */ function forceComponentState(element, forced) {
|
|
53
|
+
const external = element;
|
|
54
|
+
const children = element.children;
|
|
55
|
+
const slots = external.slots ? Object.fromEntries(Object.entries(external.slots).map(([slot, inner])=>[
|
|
56
|
+
slot,
|
|
57
|
+
inner.map((child)=>forceComponentState(child, forced))
|
|
58
|
+
])) : undefined;
|
|
59
|
+
const bare = typeof external.componentName === 'string' ? external.componentName.substring(external.componentName.lastIndexOf(':') + 1) : undefined;
|
|
60
|
+
const owns = bare !== undefined && external.componentName.includes(defaultBlueprintName) && bare in foundationSamples && foundationSamples[bare].stateful && !withoutStates.has(bare);
|
|
61
|
+
return {
|
|
62
|
+
...element,
|
|
63
|
+
...owns ? {
|
|
64
|
+
properties: {
|
|
65
|
+
...external.properties,
|
|
66
|
+
...forced
|
|
67
|
+
}
|
|
68
|
+
} : {},
|
|
69
|
+
...slots ? {
|
|
70
|
+
slots
|
|
71
|
+
} : {},
|
|
72
|
+
...children ? {
|
|
73
|
+
children: children.map((child)=>forceComponentState(child, forced))
|
|
74
|
+
} : {}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A pack as the query results the templates bind to: one entry for each set, keyed by the set's shape name.
|
|
79
|
+
*
|
|
80
|
+
* 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
|
|
81
|
+
* 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.
|
|
82
|
+
* The elements themselves are untouched, which is why the same template previews in every state with no per-template code.
|
|
83
|
+
*/ const queryResultsOf = (pack, state = TemplatePreviewState.Populated)=>{
|
|
84
|
+
if (pack === undefined) return undefined;
|
|
85
|
+
if (state === TemplatePreviewState.Empty) return Object.fromEntries(pack.sets.map((set)=>[
|
|
86
|
+
set.shape,
|
|
87
|
+
[]
|
|
88
|
+
]));
|
|
89
|
+
return Object.fromEntries(pack.sets.map((set)=>[
|
|
90
|
+
set.shape,
|
|
91
|
+
set.rows
|
|
92
|
+
]));
|
|
93
|
+
};
|
|
25
94
|
/**
|
|
26
95
|
* Boots one gallery screen through the real engine.
|
|
27
96
|
*
|
|
@@ -34,16 +103,18 @@ import { applyTemplatePreviewState } from './applyTemplatePreviewState.js';
|
|
|
34
103
|
* come out as `UnresolvedComponent`'s dashed red box naming what is missing. That is the designed outcome:
|
|
35
104
|
* a preview of a blueprint against half a profile should look visibly incomplete rather than quietly
|
|
36
105
|
* wrong.
|
|
37
|
-
*/ function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated }) {
|
|
106
|
+
*/ function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated, pack, forceState }) {
|
|
38
107
|
const element = useMemo(()=>{
|
|
39
108
|
const screen = galleryScreen(screenName);
|
|
40
109
|
if (!screen) {
|
|
41
110
|
throw new Error(`The gallery has no screen named '${screenName}'.`);
|
|
42
111
|
}
|
|
43
|
-
|
|
112
|
+
const resolved = applyTemplatePreviewState(resolveElementComponentNames(composeScreenElement(screen), galleryPreviewProfile, galleryComponentCatalog), state);
|
|
113
|
+
return forceState ? forceComponentState(resolved, forceState) : resolved;
|
|
44
114
|
}, [
|
|
45
115
|
screenName,
|
|
46
|
-
state
|
|
116
|
+
state,
|
|
117
|
+
forceState
|
|
47
118
|
]);
|
|
48
119
|
return /*#__PURE__*/ jsx(LayoutConfigProvider, {
|
|
49
120
|
initialConfig: initialConfig,
|
|
@@ -53,11 +124,12 @@ import { applyTemplatePreviewState } from './applyTemplatePreviewState.js';
|
|
|
53
124
|
children: /*#__PURE__*/ jsx(SceneElementView, {
|
|
54
125
|
element: element,
|
|
55
126
|
registry: registry,
|
|
56
|
-
resolveBinding: ()=>undefined
|
|
127
|
+
resolveBinding: ()=>undefined,
|
|
128
|
+
queryResults: queryResultsOf(pack, state)
|
|
57
129
|
})
|
|
58
130
|
})
|
|
59
131
|
});
|
|
60
132
|
}
|
|
61
133
|
|
|
62
|
-
export { GalleryScreenPreview, galleryPreviewRegistry };
|
|
134
|
+
export { GalleryScreenPreview, forceComponentState, galleryPreviewRegistry, queryResultsOf };
|
|
63
135
|
//# 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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CAAAA;AAC7B,QAAA,IAAI,CAACO,MAAAA,EAAQ;AACT,YAAA,MAAM,IAAIE,KAAAA,CAAM,CAAC,iCAAiC,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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,GAAG;AACf5B,YAAAA,iBAAAA,CACI,QAAA,EACAC,aAAAA,CAAc2B,MAAM,EACpB,EAAC,EACD;gBACI9B,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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GAAAA;IACZ,OAAO;QAAE,CAACvB,QAAAA,CAASR,WAAW,GAAG;AAACD,YAAAA,WAAAA;AAAc;AAAC,KAAA;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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeScreen.js","sources":["../../../gallery/composeScreen.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 { ExternalComponent, Layout, SceneElement, Screen, ScreenTemplate } from '@cratis/scene.model';\nimport { shellComponentForLayout } from '../layouts';\nimport { externalComponent } from './elements';\n\n/**\n * Turns a {@link ScreenTemplate}'s content into slot content on the {@link Layout} that contains it.\n *\n * The rule has two halves, and both matter. Content filed under a slot the *layout* also declares stays\n * under that name - which is how a sign-in template's branding half reaches the full-page layout's `aside`\n * region rather than being buried inside the form column. Everything else flows into the slot the\n * template's `fitsSlot` names, because that is what `fitsSlot` means: this template occupies that region.\n *\n * @param template The template to place.\n * @param layout The layout it is placed into.\n * @returns Slot content keyed by the layout's own slot names.\n */\nexport function templateContentInLayout(template: ScreenTemplate, layout: Layout): Record<string, SceneElement[]> {\n const layoutSlots = new Set(layout.slots.map(slot => slot.name));\n const placed: Record<string, SceneElement[]> = {};\n const ownSlotOrder = template.slots.map(slot => slot.name);\n const content = template.content ?? {};\n\n for (const slotName of ownSlotOrder) {\n const elements = content[slotName];\n if (!elements || elements.length === 0) {\n continue;\n }\n\n const target = layoutSlots.has(slotName) ? slotName : template.fitsSlot;\n if (!target) {\n continue;\n }\n\n placed[target] = [...(placed[target] ?? []), ...elements];\n }\n\n return placed;\n}\n\n/**\n * Folds a containment chain of screen templates into the outermost one.\n *\n * This is `fitsSlot` doing its job, applied repeatedly. A slice's template fits a slot on the feature's\n * template, which fits a slot on the module's, which fits a slot on the application layout - so the way to\n * place the slice is to place it in the feature, place *that* result in the module, and hand the module to\n * the layout. Folding from the inside out means the rule is written once and the chain can be any depth.\n *\n * The alternative - filing a nested template's content under its own `fitsSlot` at the top level - looks\n * right and is not: the layout has no `body` slot, so the content lands in a region nothing renders and\n * the screen comes up empty with nothing to explain it.\n *\n * @param chain The templates from outermost to innermost. A chain of one is returned unchanged.\n * @returns A template with the same slots and `fitsSlot` as the outermost, carrying the whole chain's content.\n */\nexport function nestScreenTemplates(chain: ScreenTemplate[]): ScreenTemplate {\n return chain.reduceRight((inner, outer) => (inner === outer ? outer : placeInside(outer, inner)));\n}\n\nfunction placeInside(outer: ScreenTemplate, inner: ScreenTemplate): ScreenTemplate {\n if (!inner.fitsSlot) {\n return outer;\n }\n\n const innerContent = inner.slots.flatMap(
|
|
1
|
+
{"version":3,"file":"composeScreen.js","sources":["../../../gallery/composeScreen.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 { ExternalComponent, Layout, SceneElement, Screen, ScreenTemplate } from '@cratis/scene.model';\nimport { shellComponentForLayout } from '../layouts';\nimport { externalComponent } from './elements';\n\n/**\n * Turns a {@link ScreenTemplate}'s content into slot content on the {@link Layout} that contains it.\n *\n * The rule has two halves, and both matter. Content filed under a slot the *layout* also declares stays\n * under that name - which is how a sign-in template's branding half reaches the full-page layout's `aside`\n * region rather than being buried inside the form column. Everything else flows into the slot the\n * template's `fitsSlot` names, because that is what `fitsSlot` means: this template occupies that region.\n *\n * @param template The template to place.\n * @param layout The layout it is placed into.\n * @returns Slot content keyed by the layout's own slot names.\n */\nexport function templateContentInLayout(template: ScreenTemplate, layout: Layout): Record<string, SceneElement[]> {\n const layoutSlots = new Set(layout.slots.map(slot => slot.name));\n const placed: Record<string, SceneElement[]> = {};\n const ownSlotOrder = template.slots.map(slot => slot.name);\n const content = template.content ?? {};\n\n for (const slotName of ownSlotOrder) {\n const elements = content[slotName];\n if (!elements || elements.length === 0) {\n continue;\n }\n\n const target = layoutSlots.has(slotName) ? slotName : template.fitsSlot;\n if (!target) {\n continue;\n }\n\n placed[target] = [...(placed[target] ?? []), ...elements];\n }\n\n return placed;\n}\n\n/**\n * Folds a containment chain of screen templates into the outermost one.\n *\n * This is `fitsSlot` doing its job, applied repeatedly. A slice's template fits a slot on the feature's\n * template, which fits a slot on the module's, which fits a slot on the application layout - so the way to\n * place the slice is to place it in the feature, place *that* result in the module, and hand the module to\n * the layout. Folding from the inside out means the rule is written once and the chain can be any depth.\n *\n * The alternative - filing a nested template's content under its own `fitsSlot` at the top level - looks\n * right and is not: the layout has no `body` slot, so the content lands in a region nothing renders and\n * the screen comes up empty with nothing to explain it.\n *\n * @param chain The templates from outermost to innermost. A chain of one is returned unchanged.\n * @returns A template with the same slots and `fitsSlot` as the outermost, carrying the whole chain's content.\n */\nexport function nestScreenTemplates(chain: ScreenTemplate[]): ScreenTemplate {\n return chain.reduceRight((inner, outer) => (inner === outer ? outer : placeInside(outer, inner)));\n}\n\nfunction placeInside(outer: ScreenTemplate, inner: ScreenTemplate): ScreenTemplate {\n if (!inner.fitsSlot) {\n return outer;\n }\n\n // A container-qualified name (`WorkspaceScreen.moduleContent`) says which container; the slot's own name is what the container's content is keyed by.\n const slot = inner.fitsSlot.substring(inner.fitsSlot.lastIndexOf('.') + 1);\n const innerContent = inner.slots.flatMap(innerSlot => inner.content?.[innerSlot.name] ?? []);\n return {\n ...outer,\n content: {\n ...outer.content,\n [slot]: [...(outer.content?.[slot] ?? []), ...innerContent],\n },\n };\n}\n\n/**\n * Builds the element tree that renders a {@link Screen}.\n *\n * The screen's slot content becomes the shell component's slots one-for-one, which is the whole trick: a\n * layout's slots and a shell component's slots are the same vocabulary, so nothing has to translate\n * between them and a slot filled under a name the shell does not read is a spec failure rather than a\n * silently missing region.\n *\n * @param screen The screen to render.\n * @returns The shell element, ready for `SceneElementView`.\n */\nexport function composeScreenElement(screen: Screen): ExternalComponent {\n const shell = shellComponentForLayout(screen.layout);\n if (!shell) {\n throw new Error(`Screen '${screen.name}' names the layout '${screen.layout}', which this blueprint does not provide.`);\n }\n\n return externalComponent(`screen-${screen.name}`, shell, { screenName: screen.name }, screen.slotContent);\n}\n"],"names":["templateContentInLayout","template","layout","layoutSlots","Set","slots","map","slot","name","placed","ownSlotOrder","content","slotName","elements","length","target","has","fitsSlot","nestScreenTemplates","chain","reduceRight","inner","outer","placeInside","substring","lastIndexOf","innerContent","flatMap","innerSlot","composeScreenElement","screen","shell","shellComponentForLayout","Error","externalComponent","screenName","slotContent"],"mappings":";;;;;;AAAA;AACA;AAMA;;;;;;;;;;;AAWC,IACM,SAASA,uBAAAA,CAAwBC,QAAwB,EAAEC,MAAc,EAAA;IAC5E,MAAMC,WAAAA,GAAc,IAAIC,GAAAA,CAAIF,MAAAA,CAAOG,KAAK,CAACC,GAAG,CAACC,CAAAA,IAAAA,GAAQA,IAAAA,CAAKC,IAAI,CAAA,CAAA;AAC9D,IAAA,MAAMC,SAAyC,EAAC;IAChD,MAAMC,YAAAA,GAAeT,SAASI,KAAK,CAACC,GAAG,CAACC,CAAAA,IAAAA,GAAQA,IAAAA,CAAKC,IAAI,CAAA;AACzD,IAAA,MAAMG,OAAAA,GAAUV,QAAAA,CAASU,OAAO,IAAI,EAAC;IAErC,KAAK,MAAMC,YAAYF,YAAAA,CAAc;QACjC,MAAMG,QAAAA,GAAWF,OAAO,CAACC,QAAAA,CAAS;AAClC,QAAA,IAAI,CAACC,QAAAA,IAAYA,QAAAA,CAASC,MAAM,KAAK,CAAA,EAAG;AACpC,YAAA;AACJ,QAAA;AAEA,QAAA,MAAMC,SAASZ,WAAAA,CAAYa,GAAG,CAACJ,QAAAA,CAAAA,GAAYA,QAAAA,GAAWX,SAASgB,QAAQ;AACvE,QAAA,IAAI,CAACF,MAAAA,EAAQ;AACT,YAAA;AACJ,QAAA;QAEAN,MAAM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