@cratis/scene.blueprint.default 4.12.0 → 4.14.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/README.md +2 -2
- package/dist/cjs/gallery/GalleryScreenPreview.js +6 -3
- package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/cjs/gallery/TemplatePreviewState.js +17 -0
- package/dist/cjs/gallery/TemplatePreviewState.js.map +1 -0
- package/dist/cjs/gallery/applyTemplatePreviewState.js +91 -0
- package/dist/cjs/gallery/applyTemplatePreviewState.js.map +1 -0
- package/dist/cjs/gallery/authTemplates.js +25 -6
- package/dist/cjs/gallery/authTemplates.js.map +1 -1
- package/dist/cjs/gallery/dialogTemplates.js +13 -3
- package/dist/cjs/gallery/dialogTemplates.js.map +1 -1
- package/dist/cjs/gallery/navigation.js +7 -0
- package/dist/cjs/gallery/navigation.js.map +1 -1
- package/dist/cjs/gallery/nesting.js +13 -3
- package/dist/cjs/gallery/nesting.js.map +1 -1
- package/dist/cjs/gallery/screens.js +10 -1
- package/dist/cjs/gallery/screens.js.map +1 -1
- package/dist/cjs/gallery/statusTemplates.js +19 -5
- package/dist/cjs/gallery/statusTemplates.js.map +1 -1
- package/dist/cjs/gallery/supportTemplates.js +23 -6
- package/dist/cjs/gallery/supportTemplates.js.map +1 -1
- package/dist/cjs/gallery/widgets.js +20 -6
- package/dist/cjs/gallery/widgets.js.map +1 -1
- package/dist/cjs/gallery/workspaceTemplates.js +137 -8
- package/dist/cjs/gallery/workspaceTemplates.js.map +1 -1
- package/dist/cjs/index.js +10 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/layouts/appShell.js +5 -1
- package/dist/cjs/layouts/appShell.js.map +1 -1
- package/dist/cjs/layouts/fullPage.js +5 -1
- package/dist/cjs/layouts/fullPage.js.map +1 -1
- package/dist/cjs/templateProvenance.js +46 -0
- package/dist/cjs/templateProvenance.js.map +1 -0
- package/dist/esm/gallery/ApplicationScreens.stories.d.ts +1 -0
- package/dist/esm/gallery/ApplicationScreens.stories.d.ts.map +1 -1
- package/dist/esm/gallery/ApplicationScreens.stories.js +2 -1
- package/dist/esm/gallery/ApplicationScreens.stories.js.map +1 -1
- package/dist/esm/gallery/GalleryScreenPreview.d.ts +3 -1
- package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -1
- package/dist/esm/gallery/GalleryScreenPreview.js +6 -3
- package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/esm/gallery/PreviewStates.stories.d.ts +36 -0
- package/dist/esm/gallery/PreviewStates.stories.d.ts.map +1 -0
- package/dist/esm/gallery/PreviewStates.stories.js +27 -0
- package/dist/esm/gallery/PreviewStates.stories.js.map +1 -0
- package/dist/esm/gallery/TemplatePreviewState.d.ts +7 -0
- package/dist/esm/gallery/TemplatePreviewState.d.ts.map +1 -0
- package/dist/esm/gallery/TemplatePreviewState.js +15 -0
- package/dist/esm/gallery/TemplatePreviewState.js.map +1 -0
- package/dist/esm/gallery/applyTemplatePreviewState.d.ts +6 -0
- package/dist/esm/gallery/applyTemplatePreviewState.d.ts.map +1 -0
- package/dist/esm/gallery/applyTemplatePreviewState.js +87 -0
- package/dist/esm/gallery/applyTemplatePreviewState.js.map +1 -0
- package/dist/esm/gallery/authTemplates.d.ts.map +1 -1
- package/dist/esm/gallery/authTemplates.js +25 -6
- package/dist/esm/gallery/authTemplates.js.map +1 -1
- package/dist/esm/gallery/dialogTemplates.d.ts.map +1 -1
- package/dist/esm/gallery/dialogTemplates.js +13 -3
- package/dist/esm/gallery/dialogTemplates.js.map +1 -1
- package/dist/esm/gallery/index.d.ts +2 -0
- package/dist/esm/gallery/index.d.ts.map +1 -1
- package/dist/esm/gallery/index.js +2 -0
- package/dist/esm/gallery/index.js.map +1 -1
- package/dist/esm/gallery/navigation.d.ts.map +1 -1
- package/dist/esm/gallery/navigation.js +7 -0
- package/dist/esm/gallery/navigation.js.map +1 -1
- package/dist/esm/gallery/nesting.d.ts.map +1 -1
- package/dist/esm/gallery/nesting.js +13 -3
- package/dist/esm/gallery/nesting.js.map +1 -1
- package/dist/esm/gallery/screens.d.ts.map +1 -1
- package/dist/esm/gallery/screens.js +10 -1
- package/dist/esm/gallery/screens.js.map +1 -1
- package/dist/esm/gallery/statusTemplates.d.ts.map +1 -1
- package/dist/esm/gallery/statusTemplates.js +19 -5
- package/dist/esm/gallery/statusTemplates.js.map +1 -1
- package/dist/esm/gallery/supportTemplates.d.ts.map +1 -1
- package/dist/esm/gallery/supportTemplates.js +23 -6
- package/dist/esm/gallery/supportTemplates.js.map +1 -1
- package/dist/esm/gallery/widgets.d.ts +1 -1
- package/dist/esm/gallery/widgets.d.ts.map +1 -1
- package/dist/esm/gallery/widgets.js +20 -6
- package/dist/esm/gallery/widgets.js.map +1 -1
- package/dist/esm/gallery/workspaceTemplates.d.ts +1 -0
- package/dist/esm/gallery/workspaceTemplates.d.ts.map +1 -1
- package/dist/esm/gallery/workspaceTemplates.js +139 -11
- package/dist/esm/gallery/workspaceTemplates.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layouts/appShell.d.ts.map +1 -1
- package/dist/esm/layouts/appShell.js +5 -1
- package/dist/esm/layouts/appShell.js.map +1 -1
- package/dist/esm/layouts/fullPage.d.ts.map +1 -1
- package/dist/esm/layouts/fullPage.js +5 -1
- package/dist/esm/layouts/fullPage.js.map +1 -1
- package/dist/esm/templateProvenance.d.ts +4 -0
- package/dist/esm/templateProvenance.d.ts.map +1 -0
- package/dist/esm/templateProvenance.js +43 -0
- package/dist/esm/templateProvenance.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/gallery/ApplicationScreens.stories.tsx +4 -1
- package/gallery/GalleryScreenPreview.tsx +8 -3
- package/gallery/PreviewStates.stories.tsx +56 -0
- package/gallery/TemplatePreviewState.ts +20 -0
- package/gallery/applyTemplatePreviewState.ts +69 -0
- package/gallery/authTemplates.ts +7 -0
- package/gallery/dialogTemplates.ts +4 -0
- package/gallery/index.ts +2 -0
- package/gallery/navigation.ts +1 -0
- package/gallery/nesting.ts +4 -0
- package/gallery/screens.ts +2 -1
- package/gallery/statusTemplates.ts +6 -1
- package/gallery/supportTemplates.ts +7 -1
- package/gallery/widgets.ts +14 -5
- package/gallery/workspaceTemplates.ts +64 -4
- package/index.ts +1 -0
- package/layouts/appShell.ts +2 -0
- package/layouts/fullPage.ts +2 -0
- package/package.json +8 -7
- package/templateProvenance.ts +37 -0
package/README.md
CHANGED
|
@@ -27,9 +27,9 @@ blueprint.default/
|
|
|
27
27
|
| Concept | What it is | How many |
|
|
28
28
|
| --- | --- | --- |
|
|
29
29
|
| **Layout** | the application's base navigational look | one per application, chosen from two |
|
|
30
|
-
| **Screen template** | a reusable shape *inside* a layout, at module / feature / slice level | twenty-
|
|
30
|
+
| **Screen template** | a reusable shape *inside* a layout, at module / feature / slice level | twenty-four |
|
|
31
31
|
| **Dialog template** | the same, for overlays - no `fitsSlot`, because a dialog occupies no parent slot | three |
|
|
32
|
-
| **Screen** | an instance: names its layout and template, and provides the content | twenty-
|
|
32
|
+
| **Screen** | an instance: names its layout and template, and provides the content | twenty-four |
|
|
33
33
|
|
|
34
34
|
A screen template states where it belongs, in `fitsSlot`, rather than being told by whatever hosts it.
|
|
35
35
|
That one rule composes at every depth: a module's template fits the layout's `content`, a feature's fits a
|
|
@@ -11,6 +11,8 @@ var composeScreen = require('./composeScreen.js');
|
|
|
11
11
|
var previewProfile = require('./previewProfile.js');
|
|
12
12
|
var resolveElementNames = require('./resolveElementNames.js');
|
|
13
13
|
var screens = require('./screens.js');
|
|
14
|
+
var TemplatePreviewState = require('./TemplatePreviewState.js');
|
|
15
|
+
var applyTemplatePreviewState = require('./applyTemplatePreviewState.js');
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* The registry a preview resolves against when a host does not supply one: `core` plus this blueprint.
|
|
@@ -34,15 +36,16 @@ var screens = require('./screens.js');
|
|
|
34
36
|
* come out as `UnresolvedComponent`'s dashed red box naming what is missing. That is the designed outcome:
|
|
35
37
|
* a preview of a blueprint against half a profile should look visibly incomplete rather than quietly
|
|
36
38
|
* wrong.
|
|
37
|
-
*/ function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes.defaultBlueprintThemes, registry = galleryPreviewRegistry }) {
|
|
39
|
+
*/ function GalleryScreenPreview({ screenName, initialConfig, themes = defaultBlueprintThemes.defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.TemplatePreviewState.Populated }) {
|
|
38
40
|
const element = react.useMemo(()=>{
|
|
39
41
|
const screen = screens.galleryScreen(screenName);
|
|
40
42
|
if (!screen) {
|
|
41
43
|
throw new Error(`The gallery has no screen named '${screenName}'.`);
|
|
42
44
|
}
|
|
43
|
-
return resolveElementNames.resolveElementComponentNames(composeScreen.composeScreenElement(screen), previewProfile.galleryPreviewProfile, previewProfile.galleryComponentCatalog);
|
|
45
|
+
return applyTemplatePreviewState.applyTemplatePreviewState(resolveElementNames.resolveElementComponentNames(composeScreen.composeScreenElement(screen), previewProfile.galleryPreviewProfile, previewProfile.galleryComponentCatalog), state);
|
|
44
46
|
}, [
|
|
45
|
-
screenName
|
|
47
|
+
screenName,
|
|
48
|
+
state
|
|
46
49
|
]);
|
|
47
50
|
return /*#__PURE__*/ jsxRuntime.jsx(LayoutConfigProvider.LayoutConfigProvider, {
|
|
48
51
|
initialConfig: initialConfig,
|
|
@@ -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';\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\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 }: 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 resolveElementComponentNames(composeScreenElement(screen), galleryPreviewProfile, galleryComponentCatalog);\n }, [screenName]);\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","element","useMemo","screen","galleryScreen","Error","resolveElementComponentNames","composeScreenElement","galleryPreviewProfile","galleryComponentCatalog","_jsx","LayoutConfigProvider","storage","LayoutThemeProvider","SceneElementView","resolveBinding","undefined"],"mappings":"
|
|
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","Layout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Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/**
|
|
6
|
+
* The data states a template preview can show. A template is only worth choosing if it looks right in all
|
|
7
|
+
* four, because an application spends real time in each of them.
|
|
8
|
+
*/ var TemplatePreviewState = /*#__PURE__*/ function(TemplatePreviewState) {
|
|
9
|
+
/** The seeded, realistic records. */ TemplatePreviewState["Populated"] = "populated";
|
|
10
|
+
/** The query returned nothing; each table shows its empty message. */ TemplatePreviewState["Empty"] = "empty";
|
|
11
|
+
/** The query has not answered yet; each table announces that it is loading. */ TemplatePreviewState["Loading"] = "loading";
|
|
12
|
+
/** The query failed; each table announces the error in place of its rows. */ TemplatePreviewState["Error"] = "error";
|
|
13
|
+
return TemplatePreviewState;
|
|
14
|
+
}({});
|
|
15
|
+
|
|
16
|
+
exports.TemplatePreviewState = TemplatePreviewState;
|
|
17
|
+
//# sourceMappingURL=TemplatePreviewState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplatePreviewState.js","sources":["../../../gallery/TemplatePreviewState.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * The data states a template preview can show. A template is only worth choosing if it looks right in all\n * four, because an application spends real time in each of them.\n */\nexport enum TemplatePreviewState {\n /** The seeded, realistic records. */\n Populated = 'populated',\n\n /** The query returned nothing; each table shows its empty message. */\n Empty = 'empty',\n\n /** The query has not answered yet; each table announces that it is loading. */\n Loading = 'loading',\n\n /** The query failed; each table announces the error in place of its rows. */\n Error = 'error',\n}\n"],"names":["TemplatePreviewState"],"mappings":";;AAAA;AACA;AAEA;;;IAIO,IAAKA,oBAAAA,iBAAAA,SAAAA,oBAAAA,EAAAA;0CAC2B,oBAAA,CAAA,WAAA,CAAA,GAAA,WAAA;2EAGiC,oBAAA,CAAA,OAAA,CAAA,GAAA,OAAA;oFAGS,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAA;kFAGF,oBAAA,CAAA,OAAA,CAAA,GAAA,OAAA;AAVnEA,IAAAA,OAAAA,oBAAAA;AAYX,CAAA,CAAA,EAAA;;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var TemplatePreviewState = require('./TemplatePreviewState.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
|
+
/** What a table in a preview says when its data could not be loaded. */ const previewErrorMessage = 'The data could not be loaded. Try again in a moment.';
|
|
8
|
+
/**
|
|
9
|
+
* Puts every data-bearing element of a composed screen into one data state, leaving everything else - the
|
|
10
|
+
* shell, headers, actions and static content - exactly as authored.
|
|
11
|
+
*
|
|
12
|
+
* A data-bearing element is one whose `rows` are records: the seeded rows are what a query would return,
|
|
13
|
+
* so the states are expressed as a query's outcomes in the table's own vocabulary - no rows, `loading`, or
|
|
14
|
+
* an `error` message - rather than by swapping in a different component. The authored tree is not changed.
|
|
15
|
+
*/ function applyTemplatePreviewState(element, state) {
|
|
16
|
+
if (state === TemplatePreviewState.TemplatePreviewState.Populated) return element;
|
|
17
|
+
return transform(element, state);
|
|
18
|
+
}
|
|
19
|
+
/** Whether a composed screen contains anything a data state changes. */ function hasPreviewData(element) {
|
|
20
|
+
const properties = element.properties;
|
|
21
|
+
if (isDataBearing(properties)) return true;
|
|
22
|
+
return childrenOf(element).some(hasPreviewData);
|
|
23
|
+
}
|
|
24
|
+
function transform(element, state) {
|
|
25
|
+
const external = element;
|
|
26
|
+
const panel = element;
|
|
27
|
+
let result = element;
|
|
28
|
+
if (isDataBearing(external.properties)) {
|
|
29
|
+
result = {
|
|
30
|
+
...result,
|
|
31
|
+
properties: {
|
|
32
|
+
...external.properties,
|
|
33
|
+
...stateProperties(state)
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (external.slots) {
|
|
38
|
+
const slots = Object.fromEntries(Object.entries(external.slots).map(([name, children])=>[
|
|
39
|
+
name,
|
|
40
|
+
children.map((child)=>transform(child, state))
|
|
41
|
+
]));
|
|
42
|
+
result = {
|
|
43
|
+
...result,
|
|
44
|
+
slots
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(panel.children)) {
|
|
48
|
+
result = {
|
|
49
|
+
...result,
|
|
50
|
+
children: panel.children.map((child)=>transform(child, state))
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
function stateProperties(state) {
|
|
56
|
+
switch(state){
|
|
57
|
+
case TemplatePreviewState.TemplatePreviewState.Empty:
|
|
58
|
+
return {
|
|
59
|
+
rows: []
|
|
60
|
+
};
|
|
61
|
+
case TemplatePreviewState.TemplatePreviewState.Loading:
|
|
62
|
+
return {
|
|
63
|
+
rows: [],
|
|
64
|
+
loading: true
|
|
65
|
+
};
|
|
66
|
+
case TemplatePreviewState.TemplatePreviewState.Error:
|
|
67
|
+
return {
|
|
68
|
+
rows: [],
|
|
69
|
+
error: previewErrorMessage
|
|
70
|
+
};
|
|
71
|
+
default:
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function isDataBearing(properties) {
|
|
76
|
+
const rows = properties?.rows;
|
|
77
|
+
return Array.isArray(rows) && rows.every((row)=>typeof row === 'object' && row !== null && !Array.isArray(row));
|
|
78
|
+
}
|
|
79
|
+
function childrenOf(element) {
|
|
80
|
+
const external = element;
|
|
81
|
+
const panel = element;
|
|
82
|
+
return [
|
|
83
|
+
...Object.values(external.slots ?? {}).flat(),
|
|
84
|
+
...Array.isArray(panel.children) ? panel.children : []
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
exports.applyTemplatePreviewState = applyTemplatePreviewState;
|
|
89
|
+
exports.hasPreviewData = hasPreviewData;
|
|
90
|
+
exports.previewErrorMessage = previewErrorMessage;
|
|
91
|
+
//# sourceMappingURL=applyTemplatePreviewState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyTemplatePreviewState.js","sources":["../../../gallery/applyTemplatePreviewState.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, Panel, SceneElement } from '@cratis/scene.model';\nimport { TemplatePreviewState } from './TemplatePreviewState';\n\n/** What a table in a preview says when its data could not be loaded. */\nexport const previewErrorMessage = 'The data could not be loaded. Try again in a moment.';\n\n/**\n * Puts every data-bearing element of a composed screen into one data state, leaving everything else - the\n * shell, headers, actions and static content - exactly as authored.\n *\n * A data-bearing element is one whose `rows` are records: the seeded rows are what a query would return,\n * so the states are expressed as a query's outcomes in the table's own vocabulary - no rows, `loading`, or\n * an `error` message - rather than by swapping in a different component. The authored tree is not changed.\n */\nexport function applyTemplatePreviewState<T extends SceneElement>(element: T, state: TemplatePreviewState): T {\n if (state === TemplatePreviewState.Populated) return element;\n return transform(element, state) as T;\n}\n\n/** Whether a composed screen contains anything a data state changes. */\nexport function hasPreviewData(element: SceneElement): boolean {\n const properties = (element as Partial<ExternalComponent>).properties;\n if (isDataBearing(properties)) return true;\n return childrenOf(element).some(hasPreviewData);\n}\n\nfunction transform(element: SceneElement, state: TemplatePreviewState): SceneElement {\n const external = element as Partial<ExternalComponent>;\n const panel = element as Partial<Panel>;\n let result: SceneElement = element;\n\n if (isDataBearing(external.properties)) {\n result = { ...result, properties: { ...external.properties, ...stateProperties(state) } } as SceneElement;\n }\n\n if (external.slots) {\n const slots = Object.fromEntries(Object.entries(external.slots).map(([name, children]) => [name, children.map(child => transform(child, state))]));\n result = { ...result, slots } as SceneElement;\n }\n\n if (Array.isArray(panel.children)) {\n result = { ...result, children: panel.children.map(child => transform(child, state)) } as SceneElement;\n }\n\n return result;\n}\n\nfunction stateProperties(state: TemplatePreviewState): Record<string, unknown> {\n switch (state) {\n case TemplatePreviewState.Empty: return { rows: [] };\n case TemplatePreviewState.Loading: return { rows: [], loading: true };\n case TemplatePreviewState.Error: return { rows: [], error: previewErrorMessage };\n default: return {};\n }\n}\n\nfunction isDataBearing(properties: Record<string, unknown> | undefined): boolean {\n const rows = properties?.rows;\n return Array.isArray(rows) && rows.every(row => typeof row === 'object' && row !== null && !Array.isArray(row));\n}\n\nfunction childrenOf(element: SceneElement): SceneElement[] {\n const external = element as Partial<ExternalComponent>;\n const panel = element as Partial<Panel>;\n return [...Object.values(external.slots ?? {}).flat(), ...(Array.isArray(panel.children) ? panel.children : [])];\n}\n"],"names":["previewErrorMessage","applyTemplatePreviewState","element","state","TemplatePreviewState","Populated","transform","hasPreviewData","properties","isDataBearing","childrenOf","some","external","panel","result","stateProperties","slots","Object","fromEntries","entries","map","name","children","child","Array","isArray","Empty","rows","Loading","loading","Error","error","every","row","values","flat"],"mappings":";;;;AAAA;AACA;AAKA,yEACO,MAAMA,mBAAAA,GAAsB;AAEnC;;;;;;;AAOC,IACM,SAASC,yBAAAA,CAAkDC,OAAU,EAAEC,KAA2B,EAAA;AACrG,IAAA,IAAIA,KAAAA,KAAUC,yCAAAA,CAAqBC,SAAS,EAAE,OAAOH,OAAAA;AACrD,IAAA,OAAOI,UAAUJ,OAAAA,EAASC,KAAAA,CAAAA;AAC9B;AAEA,yEACO,SAASI,cAAAA,CAAeL,OAAqB,EAAA;IAChD,MAAMM,UAAAA,GAAa,OAACN,CAAuCM,UAAU;IACrE,IAAIC,aAAAA,CAAcD,aAAa,OAAO,IAAA;IACtC,OAAOE,UAAAA,CAAWR,OAAAA,CAAAA,CAASS,IAAI,CAACJ,cAAAA,CAAAA;AACpC;AAEA,SAASD,SAAAA,CAAUJ,OAAqB,EAAEC,KAA2B,EAAA;AACjE,IAAA,MAAMS,QAAAA,GAAWV,OAAAA;AACjB,IAAA,MAAMW,KAAAA,GAAQX,OAAAA;AACd,IAAA,IAAIY,MAAAA,GAAuBZ,OA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;AACpE,QAAA,KAAKzB,0CAAqB0B,KAAK;YAAE,OAAO;AAAEH,gBAAAA,IAAAA,EAAM,EAAE;gBAAEI,KAAAA,EAAO/B;AAAoB,aAAA;AAC/E,QAAA;AAAS,YAAA,OAAO,EAAC;AACrB;AACJ;AAEA,SAASS,cAAcD,UAA+C,EAAA;AAClE,IAAA,MAAMmB,OAAOnB,UAAAA,EAAYmB,IAAAA;AACzB,IAAA,OAAOH,MAAMC,OAAO,CAACE,IAAAA,CAAAA,IAASA,IAAAA,CAAKK,KAAK,CAACC,CAAAA,GAAAA,GAAO,OAAOA,QAAQ,QAAA,IAAYA,GAAAA,KAAQ,QAAQ,CAACT,KAAAA,CAAMC,OAAO,CAACQ,GAAAA,CAAAA,CAAAA;AAC9G;AAEA,SAASvB,WAAWR,OAAqB,EAAA;AACrC,IAAA,MAAMU,QAAAA,GAAWV,OAAAA;AACjB,IAAA,MAAMW,KAAAA,GAAQX,OAAAA;IACd,OAAO;AAAIe,QAAAA,GAAAA,MAAAA,CAAOiB,MAAM,CAACtB,QAAAA,CAASI,KAAK,IAAI,IAAImB,IAAI,EAAA;WAAQX,KAAAA,CAAMC,OAAO,CAACZ,KAAAA,CAAMS,QAAQ,IAAIT,KAAAA,CAAMS,QAAQ,GAAG;AAAI,KAAA;AACpH;;;;"}
|
|
@@ -9,6 +9,7 @@ require('../layouts/fullPage.js');
|
|
|
9
9
|
var TemplateSlotName = require('./TemplateSlotName.js');
|
|
10
10
|
var elements = require('./elements.js');
|
|
11
11
|
var widgets = require('./widgets.js');
|
|
12
|
+
var templateProvenance = require('../templateProvenance.js');
|
|
12
13
|
|
|
13
14
|
// Copyright (c) Cratis. All rights reserved.
|
|
14
15
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
@@ -62,7 +63,10 @@ var widgets = require('./widgets.js');
|
|
|
62
63
|
]
|
|
63
64
|
},
|
|
64
65
|
displayName: 'Sign in',
|
|
65
|
-
description: 'Email and password beside the branding panel.'
|
|
66
|
+
description: 'Email and password beside the branding panel.',
|
|
67
|
+
metadata: {
|
|
68
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
69
|
+
}
|
|
66
70
|
};
|
|
67
71
|
/** Register. */ const registerTemplate = {
|
|
68
72
|
name: 'Register',
|
|
@@ -93,7 +97,10 @@ var widgets = require('./widgets.js');
|
|
|
93
97
|
]
|
|
94
98
|
},
|
|
95
99
|
displayName: 'Register',
|
|
96
|
-
description: 'Account creation with a password strength meter and the terms checkbox.'
|
|
100
|
+
description: 'Account creation with a password strength meter and the terms checkbox.',
|
|
101
|
+
metadata: {
|
|
102
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
103
|
+
}
|
|
97
104
|
};
|
|
98
105
|
/** Forgotten password: ask for the address. */ const forgotPasswordTemplate = {
|
|
99
106
|
name: 'ForgotPassword',
|
|
@@ -119,7 +126,10 @@ var widgets = require('./widgets.js');
|
|
|
119
126
|
]
|
|
120
127
|
},
|
|
121
128
|
displayName: 'Forgotten password',
|
|
122
|
-
description: 'One field and one button - the whole point is that it asks for nothing else.'
|
|
129
|
+
description: 'One field and one button - the whole point is that it asks for nothing else.',
|
|
130
|
+
metadata: {
|
|
131
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
132
|
+
}
|
|
123
133
|
};
|
|
124
134
|
/** New password: the other end of the link. */ const newPasswordTemplate = {
|
|
125
135
|
name: 'NewPassword',
|
|
@@ -148,7 +158,10 @@ var widgets = require('./widgets.js');
|
|
|
148
158
|
]
|
|
149
159
|
},
|
|
150
160
|
displayName: 'New password',
|
|
151
|
-
description: 'Where a reset link lands: choose it, confirm it, done.'
|
|
161
|
+
description: 'Where a reset link lands: choose it, confirm it, done.',
|
|
162
|
+
metadata: {
|
|
163
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
164
|
+
}
|
|
152
165
|
};
|
|
153
166
|
/** Verification: the code from the email. */ const verificationTemplate = {
|
|
154
167
|
name: 'Verification',
|
|
@@ -182,7 +195,10 @@ var widgets = require('./widgets.js');
|
|
|
182
195
|
]
|
|
183
196
|
},
|
|
184
197
|
displayName: 'Verification',
|
|
185
|
-
description: 'The code step, with the progress indicator that tells you how much is left.'
|
|
198
|
+
description: 'The code step, with the progress indicator that tells you how much is left.',
|
|
199
|
+
metadata: {
|
|
200
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
201
|
+
}
|
|
186
202
|
};
|
|
187
203
|
/** Lock screen: the session is still there, the person has to prove they are. */ const lockScreenTemplate = {
|
|
188
204
|
name: 'LockScreen',
|
|
@@ -213,7 +229,10 @@ var widgets = require('./widgets.js');
|
|
|
213
229
|
]
|
|
214
230
|
},
|
|
215
231
|
displayName: 'Lock screen',
|
|
216
|
-
description: 'One person, one password, and no way to lose what was open.'
|
|
232
|
+
description: 'One person, one password, and no way to lose what was open.',
|
|
233
|
+
metadata: {
|
|
234
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
235
|
+
}
|
|
217
236
|
};
|
|
218
237
|
/** The six authentication templates. */ const authTemplates = [
|
|
219
238
|
loginTemplate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authTemplates.js","sources":["../../../gallery/authTemplates.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 } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName } from '../layouts';\nimport { TemplateSlotName } from './TemplateSlotName';\nimport { button, card, externalComponent, text } from './elements';\nimport { field, formActions } from './widgets';\n\n/**\n * The six screens that stand between someone and the application: sign in, register, forgotten password,\n * new password, verification and the lock screen.\n *\n * All six fit the full-page layout's `content` slot and fill its `aside` with the branding half. That\n * split - a colored panel of brand next to a narrow column of form - is the shape the premium PrimeTek\n * templates use for every one of them, and the reason it works is that it gives the form somewhere to be\n * *small*, which is what a sign-in form should be.\n */\n\n/** The branding half every authentication screen shares. */\nfunction brandingAside(id: string, headline: string, supporting: string) {\n return [\n externalComponent(`${id}-logo`, ComponentName.Logo, { label: 'Contoso', initials: 'C' }),\n text(`${id}-headline`, headline),\n text(`${id}-supporting`, supporting),\n ];\n}\n\n/** Sign in. */\nexport const loginTemplate: ScreenTemplate = {\n name: 'Login',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('login', 'Welcome back', 'Everything your team shipped since you were last here is waiting.'),\n [TemplateSlotName.Body]: [\n card('login-card', [\n text('login-title', 'Sign in'),\n field('login-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),\n field('login-password', 'Password', 'password', { feedback: false }),\n field('login-remember', 'Keep me signed in', 'checkbox', {}),\n formActions('login-actions', 'Sign in', 'Use a different account'),\n button('login-forgot', 'I forgot my password', { link: true, targetScreen: 'ForgotPassword' }),\n ]),\n ],\n },\n displayName: 'Sign in',\n description: 'Email and password beside the branding panel.',\n};\n\n/** Register. */\nexport const registerTemplate: ScreenTemplate = {\n name: 'Register',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('register', 'Start in two minutes', 'No card, no call, no sales engineer. Just an account.'),\n [TemplateSlotName.Body]: [\n card('register-card', [\n text('register-title', 'Create your account'),\n field('register-name', 'Full name', 'inputText', {}),\n field('register-email', 'Work email', 'inputText', { placeholder: 'you@contoso.com' }),\n field('register-password', 'Password', 'password', { feedback: true }),\n field('register-terms', 'I accept the terms of service', 'checkbox', {}),\n formActions('register-actions', 'Create account', 'I already have one'),\n ]),\n ],\n },\n displayName: 'Register',\n description: 'Account creation with a password strength meter and the terms checkbox.',\n};\n\n/** Forgotten password: ask for the address. */\nexport const forgotPasswordTemplate: ScreenTemplate = {\n name: 'ForgotPassword',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('forgot', 'It happens', 'Tell us the address you signed up with and we will send a link.'),\n [TemplateSlotName.Body]: [\n card('forgot-card', [\n text('forgot-title', 'Reset your password'),\n field('forgot-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),\n formActions('forgot-actions', 'Send the link', 'Back to sign in'),\n ]),\n ],\n },\n displayName: 'Forgotten password',\n description: 'One field and one button - the whole point is that it asks for nothing else.',\n};\n\n/** New password: the other end of the link. */\nexport const newPasswordTemplate: ScreenTemplate = {\n name: 'NewPassword',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('new-password', 'Almost there', 'Choose something you have not used anywhere else.'),\n [TemplateSlotName.Body]: [\n card('new-password-card', [\n text('new-password-title', 'Choose a new password'),\n field('new-password-value', 'New password', 'password', { feedback: true }),\n field('new-password-confirm', 'Confirm it', 'password', { feedback: false }),\n formActions('new-password-actions', 'Set the password', 'Cancel'),\n ]),\n ],\n },\n displayName: 'New password',\n description: 'Where a reset link lands: choose it, confirm it, done.',\n};\n\n/** Verification: the code from the email. */\nexport const verificationTemplate: ScreenTemplate = {\n name: 'Verification',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('verification', 'Check your email', 'We sent a six-digit code. It expires in ten minutes.'),\n [TemplateSlotName.Body]: [\n card('verification-card', [\n text('verification-title', 'Enter the code'),\n externalComponent('verification-steps', 'steps', { model: ['Account', 'Verify', 'Done'], activeIndex: 1 }),\n field('verification-code', 'Six-digit code', 'inputText', { maxLength: 6 }),\n formActions('verification-actions', 'Verify', 'Send it again'),\n ]),\n ],\n },\n displayName: 'Verification',\n description: 'The code step, with the progress indicator that tells you how much is left.',\n};\n\n/** Lock screen: the session is still there, the person has to prove they are. */\nexport const lockScreenTemplate: ScreenTemplate = {\n name: 'LockScreen',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('lock', 'Locked', 'Your work is exactly where you left it.'),\n [TemplateSlotName.Body]: [\n card('lock-card', [\n externalComponent('lock-avatar', 'avatar', { label: 'AN', size: 'xlarge', shape: 'circle' }),\n text('lock-name', 'Amelia Nyquist'),\n field('lock-password', 'Password', 'password', { feedback: false }),\n formActions('lock-actions', 'Unlock', 'Sign in as someone else'),\n ]),\n ],\n },\n displayName: 'Lock screen',\n description: 'One person, one password, and no way to lose what was open.',\n};\n\n/** The six authentication templates. */\nexport const authTemplates: ScreenTemplate[] = [\n loginTemplate,\n registerTemplate,\n forgotPasswordTemplate,\n newPasswordTemplate,\n verificationTemplate,\n lockScreenTemplate,\n];\n"],"names":["brandingAside","id","headline","supporting","externalComponent","ComponentName","Logo","label","initials","text","loginTemplate","name","fitsSlot","SlotName","Content","slots","Aside","TemplateSlotName","Body","content","card","field","placeholder","feedback","formActions","button","link","targetScreen","displayName","description","registerTemplate","forgotPasswordTemplate","newPasswordTemplate","verificationTemplate","model","activeIndex","maxLength","lockScreenTemplate","size","shape","authTemplates"],"mappings":";;;;;;;;;;;;AAAA;AACA;AASA;;;;;;;;iEAWA,SAASA,aAAAA,CAAcC,EAAU,EAAEC,QAAgB,EAAEC,UAAkB,EAAA;IACnE,OAAO;AACHC,QAAAA,0BAAAA,CAAkB,GAAGH,EAAAA,CAAG,KAAK,CAAC,EAAEI,2BAAAA,CAAcC,IAAI,EAAE;YAAEC,KAAAA,EAAO,SAAA;YAAWC,QAAAA,EAAU;AAAI,SAAA,CAAA;AACtFC,QAAAA,aAAAA,CAAK,CAAA,EAAGR,EAAAA,CAAG,SAAS,CAAC,EAAEC,QAAAA,CAAAA;AACvBO,QAAAA,aAAAA,CAAK,CAAA,EAAGR,EAAAA,CAAG,WAAW,CAAC,EAAEE,UAAAA;AAC5B,KAAA;AACL;AAEA,gBACO,MAAMO,aAAAA,GAAgC;IACzCC,IAAAA,EAAM,OAAA;AAC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O,IAAA;oBAAM+B,IAAAA,EAAM,QAAA;oBAAUC,KAAAA,EAAO;AAAS,iBAAA,CAAA;AAC1F9B,gBAAAA,aAAAA,CAAK,WAAA,EAAa,gBAAA,CAAA;gBAClBY,aAAAA,CAAM,eAAA,EAAiB,YAAY,UAAA,EAAY;oBAAEE,QAAAA,EAAU;AAAM,iBAAA,CAAA;AACjEC,gBAAAA,mBAAAA,CAAY,gBAAgB,QAAA,EAAU,yBAAA;AACzC,aAAA;AACJ;AACL,KAAA;IACAI,WAAAA,EAAa,aAAA;IACbC,WAAAA,EAAa;AACjB;AAEA,yCACO,MAAMW,aAAAA,GAAkC;AAC3C9B,IAAAA,aAAAA;AACAoB,IAAAA,gBAAAA;AACAC,IAAAA,sBAAAA;AACAC,IAAAA,mBAAAA;AACAC,IAAAA,oBAAAA;AACAI,IAAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"authTemplates.js","sources":["../../../gallery/authTemplates.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 } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName } from '../layouts';\nimport { TemplateSlotName } from './TemplateSlotName';\nimport { button, card, externalComponent, text } from './elements';\nimport { field, formActions } from './widgets';\nimport { defaultBlueprintTemplateProvenance } from '../templateProvenance';\n\n/**\n * The six screens that stand between someone and the application: sign in, register, forgotten password,\n * new password, verification and the lock screen.\n *\n * All six fit the full-page layout's `content` slot and fill its `aside` with the branding half. That\n * split - a colored panel of brand next to a narrow column of form - is the shape the premium PrimeTek\n * templates use for every one of them, and the reason it works is that it gives the form somewhere to be\n * *small*, which is what a sign-in form should be.\n */\n\n/** The branding half every authentication screen shares. */\nfunction brandingAside(id: string, headline: string, supporting: string) {\n return [\n externalComponent(`${id}-logo`, ComponentName.Logo, { label: 'Contoso', initials: 'C' }),\n text(`${id}-headline`, headline),\n text(`${id}-supporting`, supporting),\n ];\n}\n\n/** Sign in. */\nexport const loginTemplate: ScreenTemplate = {\n name: 'Login',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('login', 'Welcome back', 'Everything your team shipped since you were last here is waiting.'),\n [TemplateSlotName.Body]: [\n card('login-card', [\n text('login-title', 'Sign in'),\n field('login-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),\n field('login-password', 'Password', 'password', { feedback: false }),\n field('login-remember', 'Keep me signed in', 'checkbox', {}),\n formActions('login-actions', 'Sign in', 'Use a different account'),\n button('login-forgot', 'I forgot my password', { link: true, targetScreen: 'ForgotPassword' }),\n ]),\n ],\n },\n displayName: 'Sign in',\n description: 'Email and password beside the branding panel.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** Register. */\nexport const registerTemplate: ScreenTemplate = {\n name: 'Register',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('register', 'Start in two minutes', 'No card, no call, no sales engineer. Just an account.'),\n [TemplateSlotName.Body]: [\n card('register-card', [\n text('register-title', 'Create your account'),\n field('register-name', 'Full name', 'inputText', {}),\n field('register-email', 'Work email', 'inputText', { placeholder: 'you@contoso.com' }),\n field('register-password', 'Password', 'password', { feedback: true }),\n field('register-terms', 'I accept the terms of service', 'checkbox', {}),\n formActions('register-actions', 'Create account', 'I already have one'),\n ]),\n ],\n },\n displayName: 'Register',\n description: 'Account creation with a password strength meter and the terms checkbox.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** Forgotten password: ask for the address. */\nexport const forgotPasswordTemplate: ScreenTemplate = {\n name: 'ForgotPassword',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('forgot', 'It happens', 'Tell us the address you signed up with and we will send a link.'),\n [TemplateSlotName.Body]: [\n card('forgot-card', [\n text('forgot-title', 'Reset your password'),\n field('forgot-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),\n formActions('forgot-actions', 'Send the link', 'Back to sign in'),\n ]),\n ],\n },\n displayName: 'Forgotten password',\n description: 'One field and one button - the whole point is that it asks for nothing else.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** New password: the other end of the link. */\nexport const newPasswordTemplate: ScreenTemplate = {\n name: 'NewPassword',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('new-password', 'Almost there', 'Choose something you have not used anywhere else.'),\n [TemplateSlotName.Body]: [\n card('new-password-card', [\n text('new-password-title', 'Choose a new password'),\n field('new-password-value', 'New password', 'password', { feedback: true }),\n field('new-password-confirm', 'Confirm it', 'password', { feedback: false }),\n formActions('new-password-actions', 'Set the password', 'Cancel'),\n ]),\n ],\n },\n displayName: 'New password',\n description: 'Where a reset link lands: choose it, confirm it, done.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** Verification: the code from the email. */\nexport const verificationTemplate: ScreenTemplate = {\n name: 'Verification',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('verification', 'Check your email', 'We sent a six-digit code. It expires in ten minutes.'),\n [TemplateSlotName.Body]: [\n card('verification-card', [\n text('verification-title', 'Enter the code'),\n externalComponent('verification-steps', 'steps', { model: ['Account', 'Verify', 'Done'], activeIndex: 1 }),\n field('verification-code', 'Six-digit code', 'inputText', { maxLength: 6 }),\n formActions('verification-actions', 'Verify', 'Send it again'),\n ]),\n ],\n },\n displayName: 'Verification',\n description: 'The code step, with the progress indicator that tells you how much is left.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** Lock screen: the session is still there, the person has to prove they are. */\nexport const lockScreenTemplate: ScreenTemplate = {\n name: 'LockScreen',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('lock', 'Locked', 'Your work is exactly where you left it.'),\n [TemplateSlotName.Body]: [\n card('lock-card', [\n externalComponent('lock-avatar', 'avatar', { label: 'AN', size: 'xlarge', shape: 'circle' }),\n text('lock-name', 'Amelia Nyquist'),\n field('lock-password', 'Password', 'password', { feedback: false }),\n formActions('lock-actions', 'Unlock', 'Sign in as someone else'),\n ]),\n ],\n },\n displayName: 'Lock screen',\n description: 'One person, one password, and no way to lose what was open.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** The six authentication templates. */\nexport const authTemplates: ScreenTemplate[] = [\n loginTemplate,\n registerTemplate,\n forgotPasswordTemplate,\n newPasswordTemplate,\n verificationTemplate,\n lockScreenTemplate,\n];\n"],"names":["brandingAside","id","headline","supporting","externalComponent","ComponentName","Logo","label","initials","text","loginTemplate","name","fitsSlot","SlotName","Content","slots","Aside","TemplateSlotName","Body","content","card","field","placeholder","feedback","formActions","button","link","targetScreen","displayName","description","metadata","defaultBlueprintTemplateProvenance","registerTemplate","forgotPasswordTemplate","newPasswordTemplate","verificationTemplate","model","activeIndex","maxLength","lockScreenTemplate","size","shape","authTemplates"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAUA;;;;;;;;iEAWA,SAASA,aAAAA,CAAcC,EAAU,EAAEC,QAAgB,EAAEC,UAAkB,EAAA;IACnE,OAAO;AACHC,QAAAA,0BAAAA,CAAkB,GAAGH,EAAAA,CAAG,KAAK,CAAC,EAAEI,2BAAAA,CAAcC,IAAI,EAAE;YAAEC,KAAAA,EAAO,SAAA;YAAWC,QAAAA,EAAU;AAAI,SAAA,CAAA;AACtFC,QAAAA,aAAAA,CAAK,CAAA,EAAGR,EAAAA,CAAG,SAAS,CAAC,EAAEC,QAAAA,CAAAA;AACvBO,QAAAA,aAAAA,CAAK,CAAA,EAAGR,EAAAA,CAAG,WAA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AEJ,YAAAA,IAAAA,EAAME,kBAASG;AAAM,SAAA;AAAG,QAAA;AAAEL,YAAAA,IAAAA,EAAMM,kCAAiBC;AAAK;AAAE,KAAA;IAClEC,OAAAA,EAAS;AACL,QAAA,CAACN,kBAASG,KAAK,GAAGhB,aAAAA,CAAc,QAAQ,QAAA,EAAU,yCAAA,CAAA;QAClD,CAACiB,iCAAAA,CAAiBC,IAAI,GAAG;AACrBE,YAAAA,aAAAA,CAAK,WAAA,EAAa;AACdhB,gBAAAA,0BAAAA,CAAkB,eAAe,QAAA,EAAU;oBAAEG,KAAAA,EAAO,IAAA;oBAAMiC,IAAAA,EAAM,QAAA;oBAAUC,KAAAA,EAAO;AAAS,iBAAA,CAAA;AAC1FhC,gBAAAA,aAAAA,CAAK,WAAA,EAAa,gBAAA,CAAA;gBAClBY,aAAAA,CAAM,eAAA,EAAiB,YAAY,UAAA,EAAY;oBAAEE,QAAAA,EAAU;AAAM,iBAAA,CAAA;AACjEC,gBAAAA,mBAAAA,CAAY,gBAAgB,QAAA,EAAU,yBAAA;AACzC,aAAA;AACJ;AACL,KAAA;IACAI,WAAAA,EAAa,aAAA;IACbC,WAAAA,EAAa,6DAAA;IACbC,QAAAA,EAAU;AAAE,QAAA,GAAGC;AAAmC;AACtD;AAEA,yCACO,MAAMW,aAAAA,GAAkC;AAC3ChC,IAAAA,aAAAA;AACAsB,IAAAA,gBAAAA;AACAC,IAAAA,sBAAAA;AACAC,IAAAA,mBAAAA;AACAC,IAAAA,oBAAAA;AACAI,IAAAA;;;;;;;;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var TemplateSlotName = require('./TemplateSlotName.js');
|
|
4
4
|
var elements = require('./elements.js');
|
|
5
5
|
var widgets = require('./widgets.js');
|
|
6
|
+
var templateProvenance = require('../templateProvenance.js');
|
|
6
7
|
|
|
7
8
|
// Copyright (c) Cratis. All rights reserved.
|
|
8
9
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
@@ -50,7 +51,10 @@ var widgets = require('./widgets.js');
|
|
|
50
51
|
]
|
|
51
52
|
},
|
|
52
53
|
displayName: 'Confirmation dialog',
|
|
53
|
-
description: 'One question with the consequence spelled out, and a way back.'
|
|
54
|
+
description: 'One question with the consequence spelled out, and a way back.',
|
|
55
|
+
metadata: {
|
|
56
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
57
|
+
}
|
|
54
58
|
};
|
|
55
59
|
/** Form: a short capture that does not deserve a page of its own. */ const formDialogTemplate = {
|
|
56
60
|
name: 'FormDialog',
|
|
@@ -96,7 +100,10 @@ var widgets = require('./widgets.js');
|
|
|
96
100
|
]
|
|
97
101
|
},
|
|
98
102
|
displayName: 'Form dialog',
|
|
99
|
-
description: 'A handful of fields captured without leaving the page underneath.'
|
|
103
|
+
description: 'A handful of fields captured without leaving the page underneath.',
|
|
104
|
+
metadata: {
|
|
105
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
106
|
+
}
|
|
100
107
|
};
|
|
101
108
|
/** Detail: a record shown over the list it came from. */ const detailDialogTemplate = {
|
|
102
109
|
name: 'DetailDialog',
|
|
@@ -146,7 +153,10 @@ var widgets = require('./widgets.js');
|
|
|
146
153
|
]
|
|
147
154
|
},
|
|
148
155
|
displayName: 'Detail dialog',
|
|
149
|
-
description: 'A record over the list it came from, with a route to the full page.'
|
|
156
|
+
description: 'A record over the list it came from, with a route to the full page.',
|
|
157
|
+
metadata: {
|
|
158
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
159
|
+
}
|
|
150
160
|
};
|
|
151
161
|
/** The dialog templates this blueprint provides. */ const galleryDialogTemplates = [
|
|
152
162
|
confirmDialogTemplate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogTemplates.js","sources":["../../../gallery/dialogTemplates.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 { DialogTemplate } from '@cratis/scene.model';\nimport { TemplateSlotName } from './TemplateSlotName';\nimport { button, card, externalComponent, panel, text } from './elements';\nimport { field } from './widgets';\n\n/**\n * The three dialog shapes an application repeats: confirm something destructive, capture a short form, and\n * show a record without leaving the list behind it.\n *\n * A dialog template has no `fitsSlot`, and that absence is the whole distinction. A screen template is\n * *placed* - it fills a slot on whatever contains it, and the containment chain is what decides where it\n * appears. A dialog is *summoned*: it opens over the application from wherever the code that opened it\n * happens to be, so there is no parent slot for it to name.\n */\n\n/** Confirm: one question, two answers, and enough context to answer it. */\nexport const confirmDialogTemplate: DialogTemplate = {\n name: 'ConfirmDialog',\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],\n content: {\n [TemplateSlotName.Header]: [text('confirm-title', 'Archive this product?')],\n [TemplateSlotName.Body]: [\n text('confirm-message', 'Bamboo Watch will stop appearing in the catalog. Existing orders keep it.'),\n externalComponent('confirm-note', 'message', { severity: 'warn', text: 'This can be undone from the archive.' }),\n ],\n [TemplateSlotName.Actions]: [\n panel('confirm-actions', [button('confirm-yes', 'Archive', { severity: 'danger' }), button('confirm-no', 'Keep it', { severity: 'secondary' })]),\n ],\n },\n displayName: 'Confirmation dialog',\n description: 'One question with the consequence spelled out, and a way back.',\n};\n\n/** Form: a short capture that does not deserve a page of its own. */\nexport const formDialogTemplate: DialogTemplate = {\n name: 'FormDialog',\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],\n content: {\n [TemplateSlotName.Header]: [text('form-dialog-title', 'Invite someone')],\n [TemplateSlotName.Body]: [\n field('form-dialog-email', 'Email', 'inputText', { placeholder: 'them@contoso.com' }),\n field('form-dialog-role', 'Role', 'dropdown', { options: ['Viewer', 'Editor', 'Administrator'] }),\n field('form-dialog-message', 'Message', 'inputTextarea', { rows: 3 }),\n ],\n [TemplateSlotName.Actions]: [\n panel('form-dialog-actions', [button('form-dialog-send', 'Send invitation', { severity: 'primary' }), button('form-dialog-cancel', 'Cancel', { severity: 'secondary' })]),\n ],\n },\n displayName: 'Form dialog',\n description: 'A handful of fields captured without leaving the page underneath.',\n};\n\n/** Detail: a record shown over the list it came from. */\nexport const detailDialogTemplate: DialogTemplate = {\n name: 'DetailDialog',\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }, { name: TemplateSlotName.Actions }],\n content: {\n [TemplateSlotName.Header]: [text('detail-dialog-title', 'ORD-4192')],\n [TemplateSlotName.Body]: [\n card('detail-dialog-summary', [\n text('detail-dialog-customer', 'Northwind Traders'),\n text('detail-dialog-total', '$1,240.00'),\n externalComponent('detail-dialog-status', 'tag', { value: 'Shipped', severity: 'success' }),\n ]),\n ],\n [TemplateSlotName.SidePanel]: [externalComponent('detail-dialog-timeline', 'timeline', { align: 'left' })],\n [TemplateSlotName.Actions]: [\n panel('detail-dialog-actions', [button('detail-dialog-open', 'Open full record', { severity: 'primary', targetScreen: 'DetailView' }), button('detail-dialog-close', 'Close', { severity: 'secondary' })]),\n ],\n },\n displayName: 'Detail dialog',\n description: 'A record over the list it came from, with a route to the full page.',\n};\n\n/** The dialog templates this blueprint provides. */\nexport const galleryDialogTemplates: DialogTemplate[] = [confirmDialogTemplate, formDialogTemplate, detailDialogTemplate];\n"],"names":["confirmDialogTemplate","name","slots","TemplateSlotName","Header","Body","Actions","content","text","externalComponent","severity","panel","button","displayName","description","formDialogTemplate","field","placeholder","options","rows","detailDialogTemplate","SidePanel","card","value","align","targetScreen","galleryDialogTemplates"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialogTemplates.js","sources":["../../../gallery/dialogTemplates.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 { DialogTemplate } from '@cratis/scene.model';\nimport { TemplateSlotName } from './TemplateSlotName';\nimport { button, card, externalComponent, panel, text } from './elements';\nimport { field } from './widgets';\nimport { defaultBlueprintTemplateProvenance } from '../templateProvenance';\n\n/**\n * The three dialog shapes an application repeats: confirm something destructive, capture a short form, and\n * show a record without leaving the list behind it.\n *\n * A dialog template has no `fitsSlot`, and that absence is the whole distinction. A screen template is\n * *placed* - it fills a slot on whatever contains it, and the containment chain is what decides where it\n * appears. A dialog is *summoned*: it opens over the application from wherever the code that opened it\n * happens to be, so there is no parent slot for it to name.\n */\n\n/** Confirm: one question, two answers, and enough context to answer it. */\nexport const confirmDialogTemplate: DialogTemplate = {\n name: 'ConfirmDialog',\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],\n content: {\n [TemplateSlotName.Header]: [text('confirm-title', 'Archive this product?')],\n [TemplateSlotName.Body]: [\n text('confirm-message', 'Bamboo Watch will stop appearing in the catalog. Existing orders keep it.'),\n externalComponent('confirm-note', 'message', { severity: 'warn', text: 'This can be undone from the archive.' }),\n ],\n [TemplateSlotName.Actions]: [\n panel('confirm-actions', [button('confirm-yes', 'Archive', { severity: 'danger' }), button('confirm-no', 'Keep it', { severity: 'secondary' })]),\n ],\n },\n displayName: 'Confirmation dialog',\n description: 'One question with the consequence spelled out, and a way back.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** Form: a short capture that does not deserve a page of its own. */\nexport const formDialogTemplate: DialogTemplate = {\n name: 'FormDialog',\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],\n content: {\n [TemplateSlotName.Header]: [text('form-dialog-title', 'Invite someone')],\n [TemplateSlotName.Body]: [\n field('form-dialog-email', 'Email', 'inputText', { placeholder: 'them@contoso.com' }),\n field('form-dialog-role', 'Role', 'dropdown', { options: ['Viewer', 'Editor', 'Administrator'] }),\n field('form-dialog-message', 'Message', 'inputTextarea', { rows: 3 }),\n ],\n [TemplateSlotName.Actions]: [\n panel('form-dialog-actions', [button('form-dialog-send', 'Send invitation', { severity: 'primary' }), button('form-dialog-cancel', 'Cancel', { severity: 'secondary' })]),\n ],\n },\n displayName: 'Form dialog',\n description: 'A handful of fields captured without leaving the page underneath.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** Detail: a record shown over the list it came from. */\nexport const detailDialogTemplate: DialogTemplate = {\n name: 'DetailDialog',\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }, { name: TemplateSlotName.Actions }],\n content: {\n [TemplateSlotName.Header]: [text('detail-dialog-title', 'ORD-4192')],\n [TemplateSlotName.Body]: [\n card('detail-dialog-summary', [\n text('detail-dialog-customer', 'Northwind Traders'),\n text('detail-dialog-total', '$1,240.00'),\n externalComponent('detail-dialog-status', 'tag', { value: 'Shipped', severity: 'success' }),\n ]),\n ],\n [TemplateSlotName.SidePanel]: [externalComponent('detail-dialog-timeline', 'timeline', { align: 'left' })],\n [TemplateSlotName.Actions]: [\n panel('detail-dialog-actions', [button('detail-dialog-open', 'Open full record', { severity: 'primary', targetScreen: 'DetailView' }), button('detail-dialog-close', 'Close', { severity: 'secondary' })]),\n ],\n },\n displayName: 'Detail dialog',\n description: 'A record over the list it came from, with a route to the full page.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** The dialog templates this blueprint provides. */\nexport const galleryDialogTemplates: DialogTemplate[] = [confirmDialogTemplate, formDialogTemplate, detailDialogTemplate];\n"],"names":["confirmDialogTemplate","name","slots","TemplateSlotName","Header","Body","Actions","content","text","externalComponent","severity","panel","button","displayName","description","metadata","defaultBlueprintTemplateProvenance","formDialogTemplate","field","placeholder","options","rows","detailDialogTemplate","SidePanel","card","value","align","targetScreen","galleryDialogTemplates"],"mappings":";;;;;;;AAAA;AACA;AAQA;;;;;;;;AAQC,gFAGM,MAAMA,qBAAAA,GAAwC;IACjDC,IAAAA,EAAM,eAAA;IACNC,KAAAA,EAAO;AAAC,QAAA;AAAED,YAAAA,IAAAA,EAAME,kCAAiBC;AAAO,SAAA;AAAG,QAAA;AAAEH,YAAAA,IAAAA,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QACpE,CAACL,iCAAAA,CAAiBE,IAAI,GAAG;AACrBmB,YAAAA,aAAAA,CAAK,uBAAA,EAAyB;AAC1BhB,gBAAAA,aAAAA,CAAK,wBAAA,EAA0B,mBAAA,CAAA;AAC/BA,gBAAAA,aAAAA,CAAK,qBAAA,EAAuB,WAAA,CAAA;AAC5BC,gBAAAA,0BAAAA,CAAkB,wBAAwB,KAAA,EAAO;oBAAEgB,KAAAA,EAAO,SAAA;oBAAWf,QAAAA,EAAU;AAAU,iBAAA;AAC5F,aAAA;AACJ,SAAA;QACD,CAACP,iCAAAA,CAAiBoB,SAAS,GAAG;AAACd,YAAAA,0BAAAA,CAAkB,0BAA0B,UAAA,EAAY;gBAAEiB,KAAAA,EAAO;AAAO,aAAA;AAAG,SAAA;QAC1G,CAACvB,iCAAAA,CAAiBG,OAAO,GAAG;AACxBK,YAAAA,cAAAA,CAAM,uBAAA,EAAyB;AAACC,gBAAAA,eAAAA,CAAO,sBAAsB,kBAAA,EAAoB;oBAAEF,QAAAA,EAAU,SAAA;oBAAWiB,YAAAA,EAAc;AAAa,iBAAA,CAAA;AAAIf,gBAAAA,eAAAA,CAAO,uBAAuB,OAAA,EAAS;oBAAEF,QAAAA,EAAU;AAAY,iBAAA;AAAG,aAAA;AAC5M;AACL,KAAA;IACAG,WAAAA,EAAa,eAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,QAAAA,EAAU;AAAE,QAAA,GAAGC;AAAmC;AACtD;AAEA,qDACO,MAAMY,sBAAAA,GAA2C;AAAC5B,IAAAA,qBAAAA;AAAuBiB,IAAAA,kBAAAA;AAAoBK,IAAAA;;;;;;"}
|
|
@@ -35,6 +35,13 @@ var elements = require('./elements.js');
|
|
|
35
35
|
group: 'Workspace',
|
|
36
36
|
order: 30
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Customers',
|
|
40
|
+
targetScreen: 'MasterDetail',
|
|
41
|
+
icon: 'pi pi-users',
|
|
42
|
+
group: 'Workspace',
|
|
43
|
+
order: 35
|
|
44
|
+
},
|
|
38
45
|
{
|
|
39
46
|
label: 'New product',
|
|
40
47
|
targetScreen: 'FormPage',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sources":["../../../gallery/navigation.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 { Contribution, SceneElement } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { NavigationEntry } from './NavigationEntry';\nimport { externalComponent } from './elements';\n\n/** The contribution point the built-in navigation aggregation reads. */\nexport const navigationContributionPoint = 'Navigation';\n\n/**\n * The gallery's navigation, declared once.\n *\n * One list, two consumers: the sidebar menu renders it as `menuItem` elements, and the same elements go to\n * the `Navigation` contribution point where `aggregateContributions` + `extractNavigationItem` turn them\n * back into navigation items. A blueprint that maintained a menu *and* a separate navigation declaration\n * would have two lists that agree right up until someone adds a screen to one of them.\n */\nexport const navigationEntries: NavigationEntry[] = [\n { label: 'Dashboard', targetScreen: 'Dashboard', icon: 'pi pi-home', group: 'Workspace', order: 10 },\n { label: 'Products', targetScreen: 'CrudList', icon: 'pi pi-box', group: 'Workspace', order: 20 },\n { label: 'Product detail', targetScreen: 'DetailView', icon: 'pi pi-file', group: 'Workspace', order: 30 },\n { label: 'New product', targetScreen: 'FormPage', icon: 'pi pi-plus-circle', group: 'Workspace', order: 40 },\n { label: 'Invoices', targetScreen: 'Invoice', icon: 'pi pi-receipt', group: 'Workspace', order: 50 },\n { label: 'Nothing yet', targetScreen: 'Empty', icon: 'pi pi-inbox', group: 'Workspace', order: 60 },\n { label: 'Users', targetScreen: 'UserManagement', icon: 'pi pi-users', group: 'Administration', order: 10 },\n { label: 'Your profile', targetScreen: 'ProfileSettings', icon: 'pi pi-user', group: 'Administration', order: 20 },\n { label: 'Documentation', targetScreen: 'Documentation', icon: 'pi pi-book', group: 'Support', order: 10 },\n { label: 'Help', targetScreen: 'Help', icon: 'pi pi-question-circle', group: 'Support', order: 20 },\n];\n\n/**\n * The element one navigation entry becomes.\n *\n * `routeParameterBindings` is present and empty rather than omitted, because that is what\n * `extractNavigationItem` expects to read - and an omitted bag and an empty one are the same thing right\n * up until something iterates it.\n */\nexport function navigationElement(entry: NavigationEntry, activeScreen?: string): SceneElement {\n return externalComponent(`nav-${entry.targetScreen}`, ComponentName.MenuItem, {\n label: entry.label,\n targetScreen: entry.targetScreen,\n routeParameterBindings: {},\n order: entry.order,\n group: entry.group,\n icon: entry.icon,\n isActive: entry.targetScreen === activeScreen,\n });\n}\n\n/**\n * The navigation as contributions to the `Navigation` contribution point.\n *\n * A screen carries these in its `contributions`, and anything bound to the contribution point recomputes\n * from whatever is currently in scope - so a screen that contributes an extra entry gets it in the\n * navigation without the navigation knowing that screen exists.\n */\nexport const navigationContributions: Contribution[] = navigationEntries.map(entry => ({\n contributionPointName: navigationContributionPoint,\n content: navigationElement(entry),\n order: entry.order,\n}));\n\n/** The navigation entries of one group, in order. */\nexport function entriesInGroup(group: string): NavigationEntry[] {\n return navigationEntries.filter(entry => entry.group === group).sort((first, second) => first.order - second.order);\n}\n\n/** Every group named by the navigation, in first-declared order. */\nexport const navigationGroups: string[] = [...new Set(navigationEntries.map(entry => entry.group))];\n"],"names":["navigationContributionPoint","navigationEntries","label","targetScreen","icon","group","order","navigationElement","entry","activeScreen","externalComponent","ComponentName","MenuItem","routeParameterBindings","isActive","navigationContributions","map","contributionPointName","content","entriesInGroup","filter","sort","first","second","navigationGroups","Set"],"mappings":";;;;;AAAA;AACA;AAOA,yEACO,MAAMA,2BAAAA,GAA8B;AAE3C;;;;;;;UAQaC,iBAAAA,GAAuC;AAChD,IAAA;QAAEC,KAAAA,EAAO,WAAA;QAAaC,YAAAA,EAAc,WAAA;QAAaC,IAAAA,EAAM,YAAA;QAAcC,KAAAA,EAAO,WAAA;QAAaC,KAAAA,EAAO;AAAG,KAAA;AACnG,IAAA;QAAEJ,KAAAA,EAAO,UAAA;QAA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K,CAAA;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"navigation.js","sources":["../../../gallery/navigation.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 { Contribution, SceneElement } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { NavigationEntry } from './NavigationEntry';\nimport { externalComponent } from './elements';\n\n/** The contribution point the built-in navigation aggregation reads. */\nexport const navigationContributionPoint = 'Navigation';\n\n/**\n * The gallery's navigation, declared once.\n *\n * One list, two consumers: the sidebar menu renders it as `menuItem` elements, and the same elements go to\n * the `Navigation` contribution point where `aggregateContributions` + `extractNavigationItem` turn them\n * back into navigation items. A blueprint that maintained a menu *and* a separate navigation declaration\n * would have two lists that agree right up until someone adds a screen to one of them.\n */\nexport const navigationEntries: NavigationEntry[] = [\n { label: 'Dashboard', targetScreen: 'Dashboard', icon: 'pi pi-home', group: 'Workspace', order: 10 },\n { label: 'Products', targetScreen: 'CrudList', icon: 'pi pi-box', group: 'Workspace', order: 20 },\n { label: 'Product detail', targetScreen: 'DetailView', icon: 'pi pi-file', group: 'Workspace', order: 30 },\n { label: 'Customers', targetScreen: 'MasterDetail', icon: 'pi pi-users', group: 'Workspace', order: 35 },\n { label: 'New product', targetScreen: 'FormPage', icon: 'pi pi-plus-circle', group: 'Workspace', order: 40 },\n { label: 'Invoices', targetScreen: 'Invoice', icon: 'pi pi-receipt', group: 'Workspace', order: 50 },\n { label: 'Nothing yet', targetScreen: 'Empty', icon: 'pi pi-inbox', group: 'Workspace', order: 60 },\n { label: 'Users', targetScreen: 'UserManagement', icon: 'pi pi-users', group: 'Administration', order: 10 },\n { label: 'Your profile', targetScreen: 'ProfileSettings', icon: 'pi pi-user', group: 'Administration', order: 20 },\n { label: 'Documentation', targetScreen: 'Documentation', icon: 'pi pi-book', group: 'Support', order: 10 },\n { label: 'Help', targetScreen: 'Help', icon: 'pi pi-question-circle', group: 'Support', order: 20 },\n];\n\n/**\n * The element one navigation entry becomes.\n *\n * `routeParameterBindings` is present and empty rather than omitted, because that is what\n * `extractNavigationItem` expects to read - and an omitted bag and an empty one are the same thing right\n * up until something iterates it.\n */\nexport function navigationElement(entry: NavigationEntry, activeScreen?: string): SceneElement {\n return externalComponent(`nav-${entry.targetScreen}`, ComponentName.MenuItem, {\n label: entry.label,\n targetScreen: entry.targetScreen,\n routeParameterBindings: {},\n order: entry.order,\n group: entry.group,\n icon: entry.icon,\n isActive: entry.targetScreen === activeScreen,\n });\n}\n\n/**\n * The navigation as contributions to the `Navigation` contribution point.\n *\n * A screen carries these in its `contributions`, and anything bound to the contribution point recomputes\n * from whatever is currently in scope - so a screen that contributes an extra entry gets it in the\n * navigation without the navigation knowing that screen exists.\n */\nexport const navigationContributions: Contribution[] = navigationEntries.map(entry => ({\n contributionPointName: navigationContributionPoint,\n content: navigationElement(entry),\n order: entry.order,\n}));\n\n/** The navigation entries of one group, in order. */\nexport function entriesInGroup(group: string): NavigationEntry[] {\n return navigationEntries.filter(entry => entry.group === group).sort((first, second) => first.order - second.order);\n}\n\n/** Every group named by the navigation, in first-declared order. */\nexport const navigationGroups: string[] = [...new Set(navigationEntries.map(entry => entry.group))];\n"],"names":["navigationContributionPoint","navigationEntries","label","targetScreen","icon","group","order","navigationElement","entry","activeScreen","externalComponent","ComponentName","MenuItem","routeParameterBindings","isActive","navigationContributions","map","contributionPointName","content","entriesInGroup","filter","sort","first","second","navigationGroups","Set"],"mappings":";;;;;AAAA;AACA;AAOA,yEACO,MAAMA,2BAAAA,GAA8B;AAE3C;;;;;;;UAQaC,iBAAAA,GAAuC;AAChD,IAAA;QAAEC,KAAAA,EAAO,WAAA;QAAaC,YAAAA,EAAc,WAAA;QAAaC,IAAAA,EAAM,YAAA;QAAcC,KAAAA,EAAO,WAAA;QAAaC,KAAAA,EAAO;AAAG,KAAA;AACnG,IAAA;QAAEJ,KAAAA,EAAO,UAAA;QAAYC,YAAAA,EAAc,UAAA;QAAYC,IAA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,MAAMkB,gBAAAA,GAA6B;AAAI,IAAA,GAAA,IAAIC,IAAIxB,iBAAAA,CAAkBe,GAAG,CAACR,CAAAA,KAAAA,GAASA,MAAMH,KAAK,CAAA;;;;;;;;"}
|
|
@@ -9,6 +9,7 @@ require('../layouts/fullPage.js');
|
|
|
9
9
|
var TemplateSlotName = require('./TemplateSlotName.js');
|
|
10
10
|
var elements = require('./elements.js');
|
|
11
11
|
var widgets = require('./widgets.js');
|
|
12
|
+
var templateProvenance = require('../templateProvenance.js');
|
|
12
13
|
|
|
13
14
|
// Copyright (c) Cratis. All rights reserved.
|
|
14
15
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
@@ -48,7 +49,10 @@ var widgets = require('./widgets.js');
|
|
|
48
49
|
]
|
|
49
50
|
},
|
|
50
51
|
displayName: 'Module workspace',
|
|
51
|
-
description: 'Module level: fits the application layout content slot and offers a body for one feature.'
|
|
52
|
+
description: 'Module level: fits the application layout content slot and offers a body for one feature.',
|
|
53
|
+
metadata: {
|
|
54
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
55
|
+
}
|
|
52
56
|
};
|
|
53
57
|
/**
|
|
54
58
|
* Feature level: fits the module workspace's `body` slot.
|
|
@@ -79,7 +83,10 @@ var widgets = require('./widgets.js');
|
|
|
79
83
|
]
|
|
80
84
|
},
|
|
81
85
|
displayName: 'Feature section',
|
|
82
|
-
description: 'Feature level: fits a module workspace body slot and brings the action toolbar.'
|
|
86
|
+
description: 'Feature level: fits a module workspace body slot and brings the action toolbar.',
|
|
87
|
+
metadata: {
|
|
88
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
89
|
+
}
|
|
83
90
|
};
|
|
84
91
|
/**
|
|
85
92
|
* Slice level: fits the feature section's `body` slot.
|
|
@@ -114,7 +121,10 @@ var widgets = require('./widgets.js');
|
|
|
114
121
|
]
|
|
115
122
|
},
|
|
116
123
|
displayName: 'Slice section',
|
|
117
|
-
description: 'Slice level: fits a feature section body slot and hosts one behavior.'
|
|
124
|
+
description: 'Slice level: fits a feature section body slot and hosts one behavior.',
|
|
125
|
+
metadata: {
|
|
126
|
+
...templateProvenance.defaultBlueprintTemplateProvenance
|
|
127
|
+
}
|
|
118
128
|
};
|
|
119
129
|
/** The chain, outermost first - what a spec walks to prove `fitsSlot` resolves at every level. */ const nestingChainTemplates = [
|
|
120
130
|
moduleWorkspaceTemplate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nesting.js","sources":["../../../gallery/nesting.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 } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName, column, slotLeaf } from '../layouts';\nimport { TemplateSlotName } from './TemplateSlotName';\nimport { button, externalComponent } from './elements';\nimport { pageHeader } from './widgets';\n\n/**\n * A worked three-level chain, from the application layout down to a slice.\n *\n * The nesting rule is one rule applied at every depth: a template names, in `fitsSlot`, a slot declared by\n * whatever contains it. A module's template fits the application layout's `content`; a feature's template\n * fits a slot the module's template declares; a slice's fits one the feature's declares. Nothing here is a\n * special case for a particular level - which is exactly why the hierarchy can be arbitrarily deep without\n * a second mechanism.\n *\n * These three exist to make that concrete and to be asserted by a spec, because \"it composes recursively\"\n * is the kind of claim that is true in a design document and wrong in the code.\n */\n\n/**\n * Module level: fits the application shell's `content` slot.\n *\n * It brings its own header - a module always has a name and a description - and offers a body for the\n * feature inside it plus an optional side panel.\n */\nexport const moduleWorkspaceTemplate: ScreenTemplate = {\n name: 'ModuleWorkspace',\n fitsSlot: SlotName.Content,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }],\n content: {\n [TemplateSlotName.Header]: [pageHeader('module-header', 'Operations', 'Everything the operations module owns')],\n },\n displayName: 'Module workspace',\n description: 'Module level: fits the application layout content slot and offers a body for one feature.',\n};\n\n/**\n * Feature level: fits the module workspace's `body` slot.\n *\n * It brings a toolbar, because a feature is where actions belong - a module is a grouping, a slice is one\n * behavior, and the feature in between is what a user thinks of as a screen with buttons on it.\n */\nexport const featureSectionTemplate: ScreenTemplate = {\n name: 'FeatureSection',\n fitsSlot: TemplateSlotName.Body,\n slots: [{ name: TemplateSlotName.Toolbar }, { name: TemplateSlotName.Body }],\n content: {\n [TemplateSlotName.Toolbar]: [\n button('feature-new', 'New', { severity: 'primary', icon: 'pi pi-plus' }),\n button('feature-export', 'Export', { severity: 'secondary', icon: 'pi pi-download' }),\n ],\n },\n displayName: 'Feature section',\n description: 'Feature level: fits a module workspace body slot and brings the action toolbar.',\n};\n\n/**\n * Slice level: fits the feature section's `body` slot.\n *\n * The end of the chain, and deliberately the thinnest thing in it - one behavior's surface, with somewhere\n * to put it and somewhere to put its actions.\n */\nexport const sliceSectionTemplate: ScreenTemplate = {\n name: 'SliceSection',\n fitsSlot: TemplateSlotName.Body,\n slots: [{ name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],\n arrangement: {\n root: column([slotLeaf(TemplateSlotName.Body, { grow: 1 }), slotLeaf(TemplateSlotName.Actions)]),\n },\n content: {\n [TemplateSlotName.Body]: [externalComponent('slice-body', ComponentName.PageHeader, { title: 'Adjustment', subtitle: 'One behavior, one surface' })],\n },\n displayName: 'Slice section',\n description: 'Slice level: fits a feature section body slot and hosts one behavior.',\n};\n\n/** The chain, outermost first - what a spec walks to prove `fitsSlot` resolves at every level. */\nexport const nestingChainTemplates: ScreenTemplate[] = [moduleWorkspaceTemplate, featureSectionTemplate, sliceSectionTemplate];\n"],"names":["moduleWorkspaceTemplate","name","fitsSlot","SlotName","Content","slots","TemplateSlotName","Header","Body","SidePanel","content","pageHeader","displayName","description","featureSectionTemplate","Toolbar","button","severity","icon","sliceSectionTemplate","Actions","arrangement","root","column","slotLeaf","grow","externalComponent","ComponentName","PageHeader","title","subtitle","nestingChainTemplates"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nesting.js","sources":["../../../gallery/nesting.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 } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName, column, slotLeaf } from '../layouts';\nimport { TemplateSlotName } from './TemplateSlotName';\nimport { button, externalComponent } from './elements';\nimport { pageHeader } from './widgets';\nimport { defaultBlueprintTemplateProvenance } from '../templateProvenance';\n\n/**\n * A worked three-level chain, from the application layout down to a slice.\n *\n * The nesting rule is one rule applied at every depth: a template names, in `fitsSlot`, a slot declared by\n * whatever contains it. A module's template fits the application layout's `content`; a feature's template\n * fits a slot the module's template declares; a slice's fits one the feature's declares. Nothing here is a\n * special case for a particular level - which is exactly why the hierarchy can be arbitrarily deep without\n * a second mechanism.\n *\n * These three exist to make that concrete and to be asserted by a spec, because \"it composes recursively\"\n * is the kind of claim that is true in a design document and wrong in the code.\n */\n\n/**\n * Module level: fits the application shell's `content` slot.\n *\n * It brings its own header - a module always has a name and a description - and offers a body for the\n * feature inside it plus an optional side panel.\n */\nexport const moduleWorkspaceTemplate: ScreenTemplate = {\n name: 'ModuleWorkspace',\n fitsSlot: SlotName.Content,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }],\n content: {\n [TemplateSlotName.Header]: [pageHeader('module-header', 'Operations', 'Everything the operations module owns')],\n },\n displayName: 'Module workspace',\n description: 'Module level: fits the application layout content slot and offers a body for one feature.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/**\n * Feature level: fits the module workspace's `body` slot.\n *\n * It brings a toolbar, because a feature is where actions belong - a module is a grouping, a slice is one\n * behavior, and the feature in between is what a user thinks of as a screen with buttons on it.\n */\nexport const featureSectionTemplate: ScreenTemplate = {\n name: 'FeatureSection',\n fitsSlot: TemplateSlotName.Body,\n slots: [{ name: TemplateSlotName.Toolbar }, { name: TemplateSlotName.Body }],\n content: {\n [TemplateSlotName.Toolbar]: [\n button('feature-new', 'New', { severity: 'primary', icon: 'pi pi-plus' }),\n button('feature-export', 'Export', { severity: 'secondary', icon: 'pi pi-download' }),\n ],\n },\n displayName: 'Feature section',\n description: 'Feature level: fits a module workspace body slot and brings the action toolbar.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/**\n * Slice level: fits the feature section's `body` slot.\n *\n * The end of the chain, and deliberately the thinnest thing in it - one behavior's surface, with somewhere\n * to put it and somewhere to put its actions.\n */\nexport const sliceSectionTemplate: ScreenTemplate = {\n name: 'SliceSection',\n fitsSlot: TemplateSlotName.Body,\n slots: [{ name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],\n arrangement: {\n root: column([slotLeaf(TemplateSlotName.Body, { grow: 1 }), slotLeaf(TemplateSlotName.Actions)]),\n },\n content: {\n [TemplateSlotName.Body]: [externalComponent('slice-body', ComponentName.PageHeader, { title: 'Adjustment', subtitle: 'One behavior, one surface' })],\n },\n displayName: 'Slice section',\n description: 'Slice level: fits a feature section body slot and hosts one behavior.',\n metadata: { ...defaultBlueprintTemplateProvenance },\n};\n\n/** The chain, outermost first - what a spec walks to prove `fitsSlot` resolves at every level. */\nexport const nestingChainTemplates: ScreenTemplate[] = [moduleWorkspaceTemplate, featureSectionTemplate, sliceSectionTemplate];\n"],"names":["moduleWorkspaceTemplate","name","fitsSlot","SlotName","Content","slots","TemplateSlotName","Header","Body","SidePanel","content","pageHeader","displayName","description","metadata","defaultBlueprintTemplateProvenance","featureSectionTemplate","Toolbar","button","severity","icon","sliceSectionTemplate","Actions","arrangement","root","column","slotLeaf","grow","externalComponent","ComponentName","PageHeader","title","subtitle","nestingChainTemplates"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAUA;;;;;;;;;;;;;;;;UAmBaA,uBAAAA,GAA0C;IACnDC,IAAAA,EAAM,iBAAA;AACNC,IAAAA,QAAAA,EAAUC,kBAASC,OAAO;IAC1BC,KAAAA,EAAO;AAAC,QAA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;AAAEJ,YAAAA,IAAAA,EAAMK,kCAAiBE;AAAK,SAAA;AAAG,QAAA;AAAEP,YAAAA,IAAAA,EAAMK,kCAAiBgB;AAAQ;AAAE,KAAA;IAC5EC,WAAAA,EAAa;AACTC,QAAAA,IAAAA,EAAMC,mBAAAA,CAAO;YAACC,qBAAAA,CAASpB,iCAAAA,CAAiBE,IAAI,EAAE;gBAAEmB,IAAAA,EAAM;AAAE,aAAA,CAAA;AAAID,YAAAA,qBAAAA,CAASpB,kCAAiBgB,OAAO;AAAE,SAAA;AACnG,KAAA;IACAZ,OAAAA,EAAS;QACL,CAACJ,iCAAAA,CAAiBE,IAAI,GAAG;YAACoB,0BAAAA,CAAkB,YAAA,EAAcC,2BAAAA,CAAcC,UAAU,EAAE;gBAAEC,KAAAA,EAAO,YAAA;gBAAcC,QAAAA,EAAU;AAA4B,aAAA;AAAG;AACxJ,KAAA;IACApB,WAAAA,EAAa,eAAA;IACbC,WAAAA,EAAa,uEAAA;IACbC,QAAAA,EAAU;AAAE,QAAA,GAAGC;AAAmC;AACtD;AAEA,mGACO,MAAMkB,qBAAAA,GAA0C;AAACjC,IAAAA,uBAAAA;AAAyBgB,IAAAA,sBAAAA;AAAwBK,IAAAA;;;;;;"}
|
|
@@ -19,7 +19,7 @@ var workspaceTemplates = require('./workspaceTemplates.js');
|
|
|
19
19
|
/**
|
|
20
20
|
* The screen templates this blueprint provides.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
22
|
+
* Eleven shapes for inside the application shell, ten for the full-page shell, and the three-level nesting
|
|
23
23
|
* chain that demonstrates how `fitsSlot` composes. The list is what the manifest's `screenTemplates` names
|
|
24
24
|
* and what the bundle provides; `validatePackageBundle` proves the two agree.
|
|
25
25
|
*/ const galleryScreenTemplates = [
|
|
@@ -48,6 +48,15 @@ var workspaceTemplates = require('./workspaceTemplates.js');
|
|
|
48
48
|
label: 'Products'
|
|
49
49
|
}
|
|
50
50
|
],
|
|
51
|
+
MasterDetail: [
|
|
52
|
+
{
|
|
53
|
+
label: 'Sales',
|
|
54
|
+
targetScreen: 'Dashboard'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: 'Customers'
|
|
58
|
+
}
|
|
59
|
+
],
|
|
51
60
|
DetailView: [
|
|
52
61
|
{
|
|
53
62
|
label: 'Catalog',
|