@cratis/scene.blueprint.default 4.40.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/defaultBlueprint.ts +1 -0
- 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 +9 -0
- package/dist/cjs/defaultBlueprintComponents.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/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/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 +25 -0
- package/dist/cjs/index.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.js +9 -0
- package/dist/esm/defaultBlueprintComponents.js.map +1 -1
- package/dist/esm/foundation/index.d.ts +1 -0
- package/dist/esm/foundation/index.d.ts.map +1 -1
- package/dist/esm/foundation/index.js +1 -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/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/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 +11 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/foundation/index.ts +1 -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/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/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
|
@@ -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,E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
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,CAAcE,SAAS;AAAEF,IAAAA,aAAAA,CAAcG,UAAU;AAAEH,IAAAA,aAAAA,CAAcI,OAAO;AAAEJ,IAAAA,aAAAA,CAAcK,YAAY;AAAEL,IAAAA,aAAAA,CAAcM;AACjJ,CAAA,CAAA;AAED,iHACO,SAASC,mBAAAA,CAAoBC,OAAqB,EAAEC,MAA4B,EAAA;AACnF,IAAA,MAAMC,QAAAA,GAAWF,OAAAA;IACjB,MAAMG,QAAAA,GAAW,OAACH,CAA0CG,QAAQ;AACpE,IAAA,MAAMC,QAAQF,QAAAA,CAASE,KAAK,GAAGC,MAAAA,CAAOC,WAAW,CAACD,MAAAA,CAAOE,OAAO,CAACL,QAAAA,CAASE,KAAK,EAAEI,GAAG,CAAC,CAAC,CAACC,IAAAA,EAAMC,MAAM,GAAK;AAACD,YAAAA,IAAAA;AAAMC,YAAAA,KAAAA,CAAMF,GAAG,CAACG,CAAAA,KAAAA,GAASZ,oBAAoBY,KAAAA,EAAOV,MAAAA,CAAAA;SAAS,CAAA,CAAA,GAAKW,SAAAA;AAC3K,IAAA,MAAMC,OAAO,OAAOX,QAAAA,CAASY,aAAa,KAAK,WAAWZ,QAAAA,CAASY,aAAa,CAACC,SAAS,CAACb,QAAAA,CAASY,aAAa,CAACE,WAAW,CAAC,OAAO,CAAA,CAAA,GAAKJ,S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 -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,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,WAAW,EAAElB,aAAAA,CAAckB,WAAW,EAAE;QAC3EN,KAAAA,EAAO,UAAA;AACPO,QAAAA,MAAAA,EAAQC,sBAAAA,CAAuBZ,GAAG,CAACa,CAAAA,SAAU;AAAEC,gBAAAA,IAAAA,EAAMD,MAAMC,IAAI;AAAEpB,gBAAAA,KAAAA,EAAOmB,MAAMC,IAAI;gBAAEC,MAAAA,EAAQF,KAAAA,CAAME,MAAM,IAAI;aAAM,CAAA;AACtH,KAAA,CAAA;AACJ;AAWA;;;;;;;;;AASC,IACM,SAASC,iBAAAA,CAAkBlB,YAAoB,EAAEmB,UAA6B,EAAA;IACjF,OAAO;QACH,CAACC,QAAAA,CAASC,MAAM,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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;gBAClBjC,KAAAA,EAAOY;AACX,aAAA;AACH,SAAA;QACD,CAACC,QAAAA,CAASqB,MAAM,GAAG;YAAChD,iBAAAA,CAAkB,QAAA,EAAUC,aAAAA,CAAc+C,MAAM,EAAE;gBAAEC,IAAAA,EAAM;AAAsC,aAAA;AAAG,SAAA;QACvH,CAACtB,QAAAA,CAASR,WAAW,GAAG;AAACD,YAAAA,WAAAA;AAAc;AAC3C,KAAA;AACJ;AAEA;;;;;;AAMC,IACM,SAASgC,cAAAA,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,Q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AAO;AAAKe,gBAAAA,GAAAA,KAAAA,CAAMX,OAAO,GAAGJ,IAAAA,CAAK,IAAI,EAAE;AAAMmB,gBAAAA,GAAAA;AAAa;AAC/D;AACJ,KAAA;AACJ;AAEA;;;;;;;;;;IAWO,SAASG,oBAAAA,CAAqBC,MAAc,EAAA;IAC/C,MAAMC,KAAAA,GAAQC,uBAAAA,CAAwBF,MAAAA,CAAO5B,MAAM,CAAA;AACnD,IAAA,IAAI,CAAC6B,KAAAA,EAAO;AACR,QAAA,MAAM,IAAIE,KAAAA,CAAM,CAAC,QAAQ,EAAEH,MAAAA,CAAOtB,IAAI,CAAC,oBAAoB,EAAEsB,MAAAA,CAAO5B,MAAM,CAAC,yCAAyC,CAAC,CAAA;AACzH,IAAA;IAEA,OAAOgC,iBAAAA,CAAkB,CAAC,OAAO,EAAEJ,OAAOtB,IAAI,CAAA,CAAE,EAAEuB,KAAAA,EAAO;AAAEI,QAAAA,UAAAA,EAAYL,OAAOtB;AAAK,KAAA,EAAGsB,OAAOM,WAAW,CAAA;AAC5G;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../../gallery/screens.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../../gallery/screens.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAmBrE,eAAO,MAAM,sBAAsB,EAAE,cAAc,EAOlD,CAAC;AA4FF,eAAO,MAAM,cAAc,EAAE,MAAM,EAA0C,CAAC;AAG9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { foundationScreenTemplates } from '../foundation/templates/index.js';
|
|
1
2
|
import { LayoutName } from '../layouts/LayoutName.js';
|
|
2
3
|
import '@cratis/scene.model';
|
|
3
4
|
import '../layouts/shellComponents.js';
|
|
@@ -21,6 +22,7 @@ import { workspaceTemplates } from './workspaceTemplates.js';
|
|
|
21
22
|
* chain that demonstrates how `fitsSlot` composes. The list is what the manifest's `screenTemplates` names
|
|
22
23
|
* and what the bundle provides; `validatePackageBundle` proves the two agree.
|
|
23
24
|
*/ const galleryScreenTemplates = [
|
|
25
|
+
...foundationScreenTemplates,
|
|
24
26
|
...workspaceTemplates,
|
|
25
27
|
...supportTemplates,
|
|
26
28
|
...authTemplates,
|
|
@@ -135,6 +137,78 @@ import { workspaceTemplates } from './workspaceTemplates.js';
|
|
|
135
137
|
label: 'Help'
|
|
136
138
|
}
|
|
137
139
|
],
|
|
140
|
+
DashboardScreen: [
|
|
141
|
+
{
|
|
142
|
+
label: 'Dashboard'
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
ListScreen: [
|
|
146
|
+
{
|
|
147
|
+
label: 'Sales',
|
|
148
|
+
targetScreen: 'DashboardScreen'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
label: 'Deals'
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
BoardScreen: [
|
|
155
|
+
{
|
|
156
|
+
label: 'Sales',
|
|
157
|
+
targetScreen: 'DashboardScreen'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: 'Pipeline'
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
WorkspaceScreen: [
|
|
164
|
+
{
|
|
165
|
+
label: 'Sales'
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
MasterDetailScreen: [
|
|
169
|
+
{
|
|
170
|
+
label: 'Sales',
|
|
171
|
+
targetScreen: 'WorkspaceScreen'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: 'Accounts'
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
RecordPage: [
|
|
178
|
+
{
|
|
179
|
+
label: 'Sales',
|
|
180
|
+
targetScreen: 'DashboardScreen'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
label: 'Accounts',
|
|
184
|
+
targetScreen: 'ListScreen'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
label: 'Account'
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
FormScreen: [
|
|
191
|
+
{
|
|
192
|
+
label: 'Sales',
|
|
193
|
+
targetScreen: 'DashboardScreen'
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
label: 'Accounts',
|
|
197
|
+
targetScreen: 'ListScreen'
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: 'New account'
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
WizardScreen: [
|
|
204
|
+
{
|
|
205
|
+
label: 'Sales',
|
|
206
|
+
targetScreen: 'DashboardScreen'
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
label: 'New account'
|
|
210
|
+
}
|
|
211
|
+
],
|
|
138
212
|
ModuleWorkspace: [
|
|
139
213
|
{
|
|
140
214
|
label: 'Operations'
|
|
@@ -196,9 +270,16 @@ import { workspaceTemplates } from './workspaceTemplates.js';
|
|
|
196
270
|
* that do not.
|
|
197
271
|
*/ function containmentChainFor(template) {
|
|
198
272
|
const depth = nestingChainTemplates.findIndex((candidate)=>candidate.name === template.name);
|
|
199
|
-
|
|
273
|
+
if (depth >= 0) return nestingChainTemplates.slice(0, depth + 1);
|
|
274
|
+
// A template that fits a container-qualified slot (`WorkspaceScreen.moduleContent`) renders inside that container, which is what the qualifier is for.
|
|
275
|
+
const [container] = (template.fitsSlot ?? '').split('.');
|
|
276
|
+
const outer = container ? foundationScreenTemplates.find((candidate)=>candidate.name === container) : undefined;
|
|
277
|
+
return outer ? [
|
|
278
|
+
outer,
|
|
279
|
+
template
|
|
280
|
+
] : [
|
|
200
281
|
template
|
|
201
|
-
]
|
|
282
|
+
];
|
|
202
283
|
}
|
|
203
284
|
function mergeSlotContent(chrome, content) {
|
|
204
285
|
const merged = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screens.js","sources":["../../../gallery/screens.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 { Layout, Screen, ScreenTemplate } from '@cratis/scene.model';\nimport { LayoutName, appShellLayout, fullPageLayout } from '../layouts';\nimport { BreadcrumbEntry, applicationChrome, fullPageChrome } from './applicationChrome';\nimport { nestScreenTemplates, templateContentInLayout } from './composeScreen';\nimport { authTemplates } from './authTemplates';\nimport { navigationContributions } from './navigation';\nimport { nestingChainTemplates } from './nesting';\nimport { statusTemplates } from './statusTemplates';\nimport { supportTemplates } from './supportTemplates';\nimport { workspaceTemplates } from './workspaceTemplates';\n\n/**\n * The screen templates this blueprint provides.\n *\n * Eleven shapes for inside the application shell, ten for the full-page shell, and the three-level nesting\n * chain that demonstrates how `fitsSlot` composes. The list is what the manifest's `screenTemplates` names\n * and what the bundle provides; `validatePackageBundle` proves the two agree.\n */\nexport const galleryScreenTemplates: ScreenTemplate[] = [\n ...workspaceTemplates,\n ...supportTemplates,\n ...authTemplates,\n ...statusTemplates,\n ...nestingChainTemplates,\n];\n\n/** Which layout each template renders inside - the application shell unless it is one of the chrome-less screens. */\nconst fullPageTemplateNames = new Set([...authTemplates, ...statusTemplates].map(template => template.name));\n\n/** The trail shown above each application-shell screen. */\nconst breadcrumbs: Record<string, BreadcrumbEntry[]> = {\n Dashboard: [{ label: 'Dashboard' }],\n CrudList: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products' }],\n MasterDetail: [{ label: 'Sales', targetScreen: 'Dashboard' }, { label: 'Customers' }],\n DetailView: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products', targetScreen: 'CrudList' }, { label: 'Bamboo Watch' }],\n FormPage: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products', targetScreen: 'CrudList' }, { label: 'New product' }],\n Empty: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products' }],\n Documentation: [{ label: 'Support', targetScreen: 'Dashboard' }, { label: 'Documentation' }],\n ProfileSettings: [{ label: 'Administration', targetScreen: 'Dashboard' }, { label: 'Your profile' }],\n UserManagement: [{ label: 'Administration', targetScreen: 'Dashboard' }, { label: 'Users' }],\n Invoice: [{ label: 'Billing', targetScreen: 'Dashboard' }, { label: 'INV-2043' }],\n Help: [{ label: 'Support', targetScreen: 'Dashboard' }, { label: 'Help' }],\n ModuleWorkspace: [{ label: 'Operations' }],\n FeatureSection: [{ label: 'Operations', targetScreen: 'ModuleWorkspace' }, { label: 'Adjustments' }],\n SliceSection: [\n { label: 'Operations', targetScreen: 'ModuleWorkspace' },\n { label: 'Adjustments', targetScreen: 'FeatureSection' },\n { label: 'Record an adjustment' },\n ],\n};\n\n/**\n * Builds the {@link Screen} that instantiates one template.\n *\n * A screen is an instance, not a shape: it names the layout it renders in, the template it fills, the\n * content that fills it, and what it contributes elsewhere. Everything structural comes from the template,\n * which is why adding a screen is a handful of lines rather than another copy of the chrome.\n */\nfunction screenFor(template: ScreenTemplate): Screen {\n const isFullPage = fullPageTemplateNames.has(template.name);\n const layout: Layout = isFullPage ? fullPageLayout : appShellLayout;\n const chrome = isFullPage ? fullPageChrome() : applicationChrome(template.name, breadcrumbs[template.name] ?? [{ label: template.displayName ?? template.name }]);\n const placeable = nestScreenTemplates(containmentChainFor(template));\n\n return {\n name: template.name,\n layout: isFullPage ? LayoutName.FullPage : LayoutName.AppShell,\n screenTemplate: template.name,\n slotContent: mergeSlotContent(chrome, templateContentInLayout(placeable, layout)),\n forms: [],\n contributions: isFullPage ? [] : navigationContributions,\n };\n}\n\n/**\n * The chain of templates a screen renders through, outermost first.\n *\n * Almost every template fits the layout's own `content` slot, so its chain is just itself. The three\n * nesting-chain templates are the exception, and the only ones that need the walk - which is the honest\n * version of the story: nesting exists for the applications that need it, and costs nothing for the ones\n * that do not.\n */\nfunction containmentChainFor(template: ScreenTemplate): ScreenTemplate[] {\n const depth = nestingChainTemplates.findIndex(candidate => candidate.name === template.name);\n return depth < 0 ? [template] : nestingChainTemplates.slice(0, depth + 1);\n}\n\nfunction mergeSlotContent(chrome: Record<string, Screen['slotContent'][string]>, content: Record<string, Screen['slotContent'][string]>): Screen['slotContent'] {\n const merged: Screen['slotContent'] = { ...chrome };\n for (const [slotName, elements] of Object.entries(content)) {\n merged[slotName] = [...(merged[slotName] ?? []), ...elements];\n }\n\n return merged;\n}\n\n/**\n * The gallery: one screen per template, ready to boot through the real engine.\n *\n * These exist so a preview is a working miniature application rather than a set of pictures - the same\n * `Screen` shape Stage produces, put through the same `Scene.Engine` and `Scene.React`, with no separate\n * preview pipeline and nothing mocked.\n */\nexport const galleryScreens: Screen[] = galleryScreenTemplates.map(screenFor);\n\n/** One gallery screen by name, for a story or a host that boots a specific one. */\nexport function galleryScreen(name: string): Screen | undefined {\n return galleryScreens.find(screen => screen.name === name);\n}\n"],"names":["galleryScreenTemplates","workspaceTemplates","supportTemplates","authTemplates","statusTemplates","nestingChainTemplates","fullPageTemplateNames","Set","map","template","name","breadcrumbs","Dashboard","label","CrudList","targetScreen","MasterDetail","DetailView","FormPage","Empty","Documentation","ProfileSettings","UserManagement","Invoice","Help","ModuleWorkspace","FeatureSection","SliceSection","screenFor","isFullPage","has","layout","fullPageLayout","appShellLayout","chrome","fullPageChrome","applicationChrome","displayName","placeable","nestScreenTemplates","containmentChainFor","LayoutName","FullPage","AppShell","screenTemplate","slotContent","mergeSlotContent","templateContentInLayout","forms","contributions","navigationContributions","depth","findIndex","candidate","slice","content","merged","slotName","elements","Object","entries","galleryScreens","galleryScreen","find","screen"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AAaA;;;;;;UAOaA,sBAAAA,GAA2C;AACjDC,IAAAA,GAAAA,kBAAAA;AACAC,IAAAA,GAAAA,gBAAAA;AACAC,IAAAA,GAAAA,aAAAA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MC,MAAAA,GAAgC;AAAE,QAAA,GAAGtB;AAAO,KAAA;IAClD,KAAK,MAAM,CAACuB,QAAAA,EAAUC,QAAAA,CAAS,IAAIC,MAAAA,CAAOC,OAAO,CAACL,OAAAA,CAAAA,CAAU;QACxDC,MAAM,CAACC,SAAS,GAAG;eAAKD,MAAM,CAACC,QAAAA,CAAS,IAAI,EAAE;AAAMC,YAAAA,GAAAA;AAAS,SAAA;AACjE,IAAA;IAEA,OAAOF,MAAAA;AACX;AAEA;;;;;;AAMC,IACM,MAAMK,cAAAA,GAA2B7D,sBAAAA,CAAuBQ,GAAG,CAACoB,SAAAA;AAEnE,oFACO,SAASkC,aAAAA,CAAcpD,IAAY,EAAA;AACtC,IAAA,OAAOmD,eAAeE,IAAI,CAACC,CAAAA,MAAAA,GAAUA,MAAAA,CAAOtD,IAAI,KAAKA,IAAAA,CAAAA;AACzD;;"}
|
|
1
|
+
{"version":3,"file":"screens.js","sources":["../../../gallery/screens.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 { Layout, Screen, ScreenTemplate } from '@cratis/scene.model';\nimport { foundationScreenTemplates } from '../foundation/templates';\nimport { LayoutName, appShellLayout, fullPageLayout } from '../layouts';\nimport { BreadcrumbEntry, applicationChrome, fullPageChrome } from './applicationChrome';\nimport { nestScreenTemplates, templateContentInLayout } from './composeScreen';\nimport { authTemplates } from './authTemplates';\nimport { navigationContributions } from './navigation';\nimport { nestingChainTemplates } from './nesting';\nimport { statusTemplates } from './statusTemplates';\nimport { supportTemplates } from './supportTemplates';\nimport { workspaceTemplates } from './workspaceTemplates';\n\n/**\n * The screen templates this blueprint provides.\n *\n * Eleven shapes for inside the application shell, ten for the full-page shell, and the three-level nesting\n * chain that demonstrates how `fitsSlot` composes. The list is what the manifest's `screenTemplates` names\n * and what the bundle provides; `validatePackageBundle` proves the two agree.\n */\nexport const galleryScreenTemplates: ScreenTemplate[] = [\n ...foundationScreenTemplates,\n ...workspaceTemplates,\n ...supportTemplates,\n ...authTemplates,\n ...statusTemplates,\n ...nestingChainTemplates,\n];\n\n/** Which layout each template renders inside - the application shell unless it is one of the chrome-less screens. */\nconst fullPageTemplateNames = new Set([...authTemplates, ...statusTemplates].map(template => template.name));\n\n/** The trail shown above each application-shell screen. */\nconst breadcrumbs: Record<string, BreadcrumbEntry[]> = {\n Dashboard: [{ label: 'Dashboard' }],\n CrudList: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products' }],\n MasterDetail: [{ label: 'Sales', targetScreen: 'Dashboard' }, { label: 'Customers' }],\n DetailView: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products', targetScreen: 'CrudList' }, { label: 'Bamboo Watch' }],\n FormPage: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products', targetScreen: 'CrudList' }, { label: 'New product' }],\n Empty: [{ label: 'Catalog', targetScreen: 'Dashboard' }, { label: 'Products' }],\n Documentation: [{ label: 'Support', targetScreen: 'Dashboard' }, { label: 'Documentation' }],\n ProfileSettings: [{ label: 'Administration', targetScreen: 'Dashboard' }, { label: 'Your profile' }],\n UserManagement: [{ label: 'Administration', targetScreen: 'Dashboard' }, { label: 'Users' }],\n Invoice: [{ label: 'Billing', targetScreen: 'Dashboard' }, { label: 'INV-2043' }],\n Help: [{ label: 'Support', targetScreen: 'Dashboard' }, { label: 'Help' }],\n DashboardScreen: [{ label: 'Dashboard' }],\n ListScreen: [{ label: 'Sales', targetScreen: 'DashboardScreen' }, { label: 'Deals' }],\n BoardScreen: [{ label: 'Sales', targetScreen: 'DashboardScreen' }, { label: 'Pipeline' }],\n WorkspaceScreen: [{ label: 'Sales' }],\n MasterDetailScreen: [{ label: 'Sales', targetScreen: 'WorkspaceScreen' }, { label: 'Accounts' }],\n RecordPage: [{ label: 'Sales', targetScreen: 'DashboardScreen' }, { label: 'Accounts', targetScreen: 'ListScreen' }, { label: 'Account' }],\n FormScreen: [{ label: 'Sales', targetScreen: 'DashboardScreen' }, { label: 'Accounts', targetScreen: 'ListScreen' }, { label: 'New account' }],\n WizardScreen: [{ label: 'Sales', targetScreen: 'DashboardScreen' }, { label: 'New account' }],\n ModuleWorkspace: [{ label: 'Operations' }],\n FeatureSection: [{ label: 'Operations', targetScreen: 'ModuleWorkspace' }, { label: 'Adjustments' }],\n SliceSection: [\n { label: 'Operations', targetScreen: 'ModuleWorkspace' },\n { label: 'Adjustments', targetScreen: 'FeatureSection' },\n { label: 'Record an adjustment' },\n ],\n};\n\n/**\n * Builds the {@link Screen} that instantiates one template.\n *\n * A screen is an instance, not a shape: it names the layout it renders in, the template it fills, the\n * content that fills it, and what it contributes elsewhere. Everything structural comes from the template,\n * which is why adding a screen is a handful of lines rather than another copy of the chrome.\n */\nfunction screenFor(template: ScreenTemplate): Screen {\n const isFullPage = fullPageTemplateNames.has(template.name);\n const layout: Layout = isFullPage ? fullPageLayout : appShellLayout;\n const chrome = isFullPage ? fullPageChrome() : applicationChrome(template.name, breadcrumbs[template.name] ?? [{ label: template.displayName ?? template.name }]);\n const placeable = nestScreenTemplates(containmentChainFor(template));\n\n return {\n name: template.name,\n layout: isFullPage ? LayoutName.FullPage : LayoutName.AppShell,\n screenTemplate: template.name,\n slotContent: mergeSlotContent(chrome, templateContentInLayout(placeable, layout)),\n forms: [],\n contributions: isFullPage ? [] : navigationContributions,\n };\n}\n\n/**\n * The chain of templates a screen renders through, outermost first.\n *\n * Almost every template fits the layout's own `content` slot, so its chain is just itself. The three\n * nesting-chain templates are the exception, and the only ones that need the walk - which is the honest\n * version of the story: nesting exists for the applications that need it, and costs nothing for the ones\n * that do not.\n */\nfunction containmentChainFor(template: ScreenTemplate): ScreenTemplate[] {\n const depth = nestingChainTemplates.findIndex(candidate => candidate.name === template.name);\n if (depth >= 0) return nestingChainTemplates.slice(0, depth + 1);\n\n // A template that fits a container-qualified slot (`WorkspaceScreen.moduleContent`) renders inside that container, which is what the qualifier is for.\n const [container] = (template.fitsSlot ?? '').split('.');\n const outer = container ? foundationScreenTemplates.find(candidate => candidate.name === container) : undefined;\n return outer ? [outer, template] : [template];\n}\n\nfunction mergeSlotContent(chrome: Record<string, Screen['slotContent'][string]>, content: Record<string, Screen['slotContent'][string]>): Screen['slotContent'] {\n const merged: Screen['slotContent'] = { ...chrome };\n for (const [slotName, elements] of Object.entries(content)) {\n merged[slotName] = [...(merged[slotName] ?? []), ...elements];\n }\n\n return merged;\n}\n\n/**\n * The gallery: one screen per template, ready to boot through the real engine.\n *\n * These exist so a preview is a working miniature application rather than a set of pictures - the same\n * `Screen` shape Stage produces, put through the same `Scene.Engine` and `Scene.React`, with no separate\n * preview pipeline and nothing mocked.\n */\nexport const galleryScreens: Screen[] = galleryScreenTemplates.map(screenFor);\n\n/** One gallery screen by name, for a story or a host that boots a specific one. */\nexport function galleryScreen(name: string): Screen | undefined {\n return galleryScreens.find(screen => screen.name === name);\n}\n"],"names":["galleryScreenTemplates","foundationScreenTemplates","workspaceTemplates","supportTemplates","authTemplates","statusTemplates","nestingChainTemplates","fullPageTemplateNames","Set","map","template","name","breadcrumbs","Dashboard","label","CrudList","targetScreen","MasterDetail","DetailView","FormPage","Empty","Documentation","ProfileSettings","UserManagement","Invoice","Help","DashboardScreen","ListScreen","BoardScreen","WorkspaceScreen","MasterDetailScreen","RecordPage","FormScreen","WizardScreen","ModuleWorkspace","FeatureSection","SliceSection","screenFor","isFullPage","has","layout","fullPageLayout","appShellLayout","chrome","fullPageChrome","applicationChrome","displayName","placeable","nestScreenTemplates","containmentChainFor","LayoutName","FullPage","AppShell","screenTemplate","slotContent","mergeSlotContent","templateContentInLayout","forms","contributions","navigationContributions","depth","findIndex","candidate","slice","container","fitsSlot","split","outer","find","undefined","content","merged","slotName","elements","Object","entries","galleryScreens","galleryScreen","screen"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAcA;;;;;;UAOaA,sBAAAA,GAA2C;AACjDC,IAAAA,GAAAA,yBAAAA;AACAC,IAAAA,GAAAA,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GAAQH,SAAAA,GAAY/D,yBAAAA,CAA0BmE,IAAI,CAACN,CAAAA,SAAAA,GAAaA,SAAAA,CAAUnD,IAAI,KAAKqD,SAAAA,CAAAA,GAAaK,SAAAA;AACtG,IAAA,OAAOF,KAAAA,GAAQ;AAACA,QAAAA,KAAAA;AAAOzD,QAAAA;KAAS,GAAG;AAACA,QAAAA;AAAS,KAAA;AACjD;AAEA,SAAS6C,gBAAAA,CAAiBZ,MAAqD,EAAE2B,OAAsD,EAAA;AACnI,IAAA,MAAMC,MAAAA,GAAgC;AAAE,QAAA,GAAG5B;AAAO,KAAA;IAClD,KAAK,MAAM,CAAC6B,QAAAA,EAAUC,QAAAA,CAAS,IAAIC,MAAAA,CAAOC,OAAO,CAACL,OAAAA,CAAAA,CAAU;QACxDC,MAAM,CAACC,SAAS,GAAG;eAAKD,MAAM,CAACC,QAAAA,CAAS,IAAI,EAAE;AAAMC,YAAAA,GAAAA;AAAS,SAAA;AACjE,IAAA;IAEA,OAAOF,MAAAA;AACX;AAEA;;;;;;AAMC,IACM,MAAMK,cAAAA,GAA2B5E,sBAAAA,CAAuBS,GAAG,CAAC4B,SAAAA;AAEnE,oFACO,SAASwC,aAAAA,CAAclE,IAAY,EAAA;AACtC,IAAA,OAAOiE,eAAeR,IAAI,CAACU,CAAAA,MAAAA,GAAUA,MAAAA,CAAOnE,IAAI,KAAKA,IAAAA,CAAAA;AACzD;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { coreComponentNames, cratisComponentsNames, primeReactComponentNames } f
|
|
|
31
31
|
export { componentNamesIn, distinctComponentNames } from './gallery/componentNames.js';
|
|
32
32
|
export { galleryComponentCatalog, galleryPreviewProfile, galleryProfile } from './gallery/previewProfile.js';
|
|
33
33
|
export { resolveElementComponentNames } from './gallery/resolveElementNames.js';
|
|
34
|
-
export { GalleryScreenPreview, galleryPreviewRegistry } from './gallery/GalleryScreenPreview.js';
|
|
34
|
+
export { GalleryScreenPreview, forceComponentState, galleryPreviewRegistry, queryResultsOf } from './gallery/GalleryScreenPreview.js';
|
|
35
35
|
export { TemplatePreviewState } from './gallery/TemplatePreviewState.js';
|
|
36
36
|
export { applyTemplatePreviewState, hasPreviewData, previewErrorMessage } from './gallery/applyTemplatePreviewState.js';
|
|
37
37
|
export { readBoolean, readNumber, readOptionalString, readRecords, readString, readStrings, recordString } from './shell/elementProperties.js';
|
|
@@ -107,6 +107,7 @@ export { bindable, foundationDescriptors, list, standardStateProperties } from '
|
|
|
107
107
|
export { foundationComponentMetadata } from './foundation/foundationComponentMetadata.js';
|
|
108
108
|
export { foundationElement, foundationSamples } from './foundation/foundationSamples.js';
|
|
109
109
|
export { FoundationStates } from './foundation/FoundationStates.js';
|
|
110
|
+
export { foundationScreenTemplates } from './foundation/templates/index.js';
|
|
110
111
|
export { blueprintThemeCompatibility } from './themes/blueprintThemeCompatibility.js';
|
|
111
112
|
export { lightTheme } from './themes/light.js';
|
|
112
113
|
export { darkTheme } from './themes/dark.js';
|
|
@@ -132,4 +133,13 @@ export { PreviewToast } from './preview-host/PreviewToast.js';
|
|
|
132
133
|
export { PreviewProblemsView } from './preview-host/PreviewProblemsView.js';
|
|
133
134
|
export { ApplicationHost } from './preview-host/ApplicationHost.js';
|
|
134
135
|
export { ScenePreviewHost } from './preview-host/ScenePreviewHost.js';
|
|
136
|
+
export { boardScreenTemplate } from './foundation/templates/boardScreenTemplate.js';
|
|
137
|
+
export { component, foundationTemplateProvenance, fromQuery, thumbnailOf } from './foundation/templates/templateParts.js';
|
|
138
|
+
export { dashboardScreenTemplate } from './foundation/templates/dashboardScreenTemplate.js';
|
|
139
|
+
export { formScreenTemplate } from './foundation/templates/formScreenTemplate.js';
|
|
140
|
+
export { listScreenTemplate } from './foundation/templates/listScreenTemplate.js';
|
|
141
|
+
export { masterDetailScreenTemplate } from './foundation/templates/masterDetailScreenTemplate.js';
|
|
142
|
+
export { recordPageTemplate } from './foundation/templates/recordPageTemplate.js';
|
|
143
|
+
export { wizardScreenTemplate } from './foundation/templates/wizardScreenTemplate.js';
|
|
144
|
+
export { workspaceScreenTemplate } from './foundation/templates/workspaceScreenTemplate.js';
|
|
135
145
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|