@cratis/scene.blueprint.components 4.9.0 → 4.11.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/dist/cjs/componentsBlueprint.js +7 -7
- package/dist/cjs/gallery/GalleryScreenPreview.js +109 -16
- package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/cjs/gallery/businessGallery.js +34 -0
- package/dist/cjs/gallery/businessGallery.js.map +1 -0
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/templates/commandTemplates.js +8 -0
- package/dist/cjs/templates/commandTemplates.js.map +1 -1
- package/dist/cjs/templates/listTemplates.js +21 -0
- package/dist/cjs/templates/listTemplates.js.map +1 -1
- package/dist/esm/componentsBlueprint.js +7 -7
- package/dist/esm/gallery/BusinessGalleryCategory.d.ts +6 -0
- package/dist/esm/gallery/BusinessGalleryCategory.d.ts.map +1 -0
- package/dist/esm/gallery/BusinessGalleryCategory.js +2 -0
- package/dist/esm/gallery/BusinessGalleryCategory.js.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts +4 -3
- package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -1
- package/dist/esm/gallery/GalleryScreenPreview.js +114 -22
- package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/esm/gallery/businessGallery.d.ts +4 -0
- package/dist/esm/gallery/businessGallery.d.ts.map +1 -0
- package/dist/esm/gallery/businessGallery.js +32 -0
- package/dist/esm/gallery/businessGallery.js.map +1 -0
- 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/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/templates/commandTemplates.d.ts.map +1 -1
- package/dist/esm/templates/commandTemplates.js +8 -0
- package/dist/esm/templates/commandTemplates.js.map +1 -1
- package/dist/esm/templates/listTemplates.d.ts.map +1 -1
- package/dist/esm/templates/listTemplates.js +22 -1
- package/dist/esm/templates/listTemplates.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/gallery/BusinessGalleryCategory.ts +12 -0
- package/gallery/GalleryScreenPreview.tsx +85 -19
- package/gallery/businessGallery.ts +19 -0
- package/gallery/index.ts +2 -0
- package/package.json +11 -11
- package/templates/commandTemplates.ts +2 -1
- package/templates/listTemplates.ts +4 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ScreenTemplate } from '@cratis/scene.model';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A categorized set of templates a business gallery can show for a scope.
|
|
8
|
+
*/
|
|
9
|
+
export interface BusinessGalleryCategory {
|
|
10
|
+
category: string;
|
|
11
|
+
templates: ScreenTemplate[];
|
|
12
|
+
}
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { PrimeReactProvider } from '@primereact/core';
|
|
6
|
+
import { PackageKind } from '@cratis/scene.model';
|
|
7
|
+
import { ComponentRegistry, PackageHostView, RegisteredComponentProps, ScenePackageBundle, corePackage, resolvePackageHost } from '@cratis/scene.react';
|
|
8
|
+
import { cratisComponentsPackage } from '@cratis/scene.components';
|
|
9
|
+
import { defaultBlueprint, LayoutConfigProvider, LayoutConfigState, LayoutThemeProvider, composeScreenElement, defaultBlueprintThemes, resolveElementComponentNames } from '@cratis/scene.blueprint.default';
|
|
8
10
|
import { componentsBlueprintComponents } from '../componentsBlueprintComponents';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import { componentsBlueprintName } from '../packageName';
|
|
12
|
+
import { componentsDialogTemplates, componentsScreenTemplates } from '../templates';
|
|
13
|
+
import { componentsBlueprintCatalog, componentsBlueprintProfile, primeReactComponentNames } from './previewProfile';
|
|
14
|
+
import { componentsGalleryScreen, componentsGalleryScreens } from './screens';
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* The registry a preview resolves against: `core`, `Cratis.Components`, the default blueprint, and this one.
|
|
@@ -20,12 +24,66 @@ import { componentsGalleryScreen } from './screens';
|
|
|
20
24
|
* table comes out unresolved - and it never reaches the DOM, because the table it belongs to is a
|
|
21
25
|
* placeholder until a host registers its query.
|
|
22
26
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const previewComponent = ({ element }: RegisteredComponentProps) => <span data-preview-component={element.componentName}>{String(element.properties.label ?? element.componentName)}</span>;
|
|
28
|
+
|
|
29
|
+
export const componentsPreviewBundles: ScenePackageBundle[] = [
|
|
30
|
+
corePackage,
|
|
31
|
+
{
|
|
32
|
+
manifest: {
|
|
33
|
+
name: 'Tailwind',
|
|
34
|
+
version: '4.0.0',
|
|
35
|
+
kind: PackageKind.Styling,
|
|
36
|
+
dependencies: [],
|
|
37
|
+
components: [],
|
|
38
|
+
layouts: [],
|
|
39
|
+
screenTemplates: [],
|
|
40
|
+
dialogTemplates: [],
|
|
41
|
+
themes: [],
|
|
42
|
+
assets: ['styles/tailwind.css', 'fonts/inter.woff2'],
|
|
43
|
+
},
|
|
44
|
+
components: {},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
manifest: {
|
|
48
|
+
name: 'PrimeReact',
|
|
49
|
+
version: '11.1.0',
|
|
50
|
+
kind: PackageKind.ComponentLibrary,
|
|
51
|
+
dependencies: [{ name: 'Tailwind' }],
|
|
52
|
+
components: primeReactComponentNames,
|
|
53
|
+
layouts: [],
|
|
54
|
+
screenTemplates: [],
|
|
55
|
+
dialogTemplates: [],
|
|
56
|
+
themes: [],
|
|
57
|
+
},
|
|
58
|
+
components: Object.fromEntries(primeReactComponentNames.map(name => [`PrimeReact:${name}`, previewComponent])),
|
|
59
|
+
},
|
|
60
|
+
cratisComponentsPackage,
|
|
61
|
+
defaultBlueprint,
|
|
62
|
+
{
|
|
63
|
+
manifest: {
|
|
64
|
+
name: componentsBlueprintName,
|
|
65
|
+
version: '1.0.0',
|
|
66
|
+
kind: PackageKind.Blueprint,
|
|
67
|
+
dependencies: [{ name: 'Cratis.Blueprint.Default' }, { name: 'Cratis.Components' }],
|
|
68
|
+
components: Object.keys(componentsBlueprintComponents).map(name => name.slice(`${componentsBlueprintName}:`.length)),
|
|
69
|
+
layouts: [],
|
|
70
|
+
screenTemplates: componentsScreenTemplates.map(template => template.name),
|
|
71
|
+
dialogTemplates: componentsDialogTemplates.map(template => template.name),
|
|
72
|
+
themes: [],
|
|
73
|
+
},
|
|
74
|
+
components: componentsBlueprintComponents,
|
|
75
|
+
screenTemplates: componentsScreenTemplates,
|
|
76
|
+
dialogTemplates: componentsDialogTemplates,
|
|
77
|
+
screens: componentsGalleryScreens,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
/** Compatibility registry for callers that render individual gallery elements directly. */
|
|
82
|
+
export const componentsPreviewRegistry: ComponentRegistry = resolvePackageHost({
|
|
83
|
+
profile: componentsBlueprintProfile,
|
|
84
|
+
bundles: componentsPreviewBundles,
|
|
85
|
+
policy: { allowExecutableImports: false, allowNetworkAssets: false },
|
|
86
|
+
}).components;
|
|
29
87
|
|
|
30
88
|
export interface GalleryScreenPreviewProps {
|
|
31
89
|
/** The name of the gallery screen to boot. */
|
|
@@ -34,8 +92,8 @@ export interface GalleryScreenPreviewProps {
|
|
|
34
92
|
/** Configuration to start from - a story pinning a layout mode, or a host restoring a session. */
|
|
35
93
|
initialConfig?: Partial<LayoutConfigState>;
|
|
36
94
|
|
|
37
|
-
/** The
|
|
38
|
-
|
|
95
|
+
/** The approved package set to render against. Defaults to {@link componentsPreviewBundles}. */
|
|
96
|
+
bundles?: ScenePackageBundle[];
|
|
39
97
|
}
|
|
40
98
|
|
|
41
99
|
/**
|
|
@@ -50,7 +108,7 @@ export interface GalleryScreenPreviewProps {
|
|
|
50
108
|
* previewed is the default blueprint's shell. This package provides Arc-bound pages to put inside it, and
|
|
51
109
|
* previewing them without the thing they were designed to sit in would prove the wrong thing.
|
|
52
110
|
*/
|
|
53
|
-
export function GalleryScreenPreview({ screenName, initialConfig,
|
|
111
|
+
export function GalleryScreenPreview({ screenName, initialConfig, bundles = componentsPreviewBundles }: GalleryScreenPreviewProps) {
|
|
54
112
|
const element = useMemo(() => {
|
|
55
113
|
const screen = componentsGalleryScreen(screenName);
|
|
56
114
|
if (!screen) {
|
|
@@ -61,10 +119,18 @@ export function GalleryScreenPreview({ screenName, initialConfig, registry = com
|
|
|
61
119
|
}, [screenName]);
|
|
62
120
|
|
|
63
121
|
return (
|
|
64
|
-
<
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
122
|
+
<PrimeReactProvider>
|
|
123
|
+
<LayoutConfigProvider initialConfig={initialConfig} storage={null}>
|
|
124
|
+
<LayoutThemeProvider themes={defaultBlueprintThemes}>
|
|
125
|
+
<PackageHostView
|
|
126
|
+
configuration={{
|
|
127
|
+
profile: componentsBlueprintProfile,
|
|
128
|
+
bundles,
|
|
129
|
+
policy: { allowExecutableImports: false, allowNetworkAssets: false },
|
|
130
|
+
}}
|
|
131
|
+
element={element} />
|
|
132
|
+
</LayoutThemeProvider>
|
|
133
|
+
</LayoutConfigProvider>
|
|
134
|
+
</PrimeReactProvider>
|
|
69
135
|
);
|
|
70
136
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ScreenTemplate, TemplateScope } from '@cratis/scene.model';
|
|
5
|
+
import { BusinessGalleryCategory } from './BusinessGalleryCategory';
|
|
6
|
+
import { componentsPageTemplates } from '../templates';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns templates grouped by visible gallery category and filtered by scope metadata.
|
|
10
|
+
*/
|
|
11
|
+
export function businessGallery(scope: TemplateScope, templates: ScreenTemplate[] = componentsPageTemplates): BusinessGalleryCategory[] {
|
|
12
|
+
const categories = new Map<string, ScreenTemplate[]>();
|
|
13
|
+
for (const template of templates.filter(template => template.metadata?.scopes?.includes(scope))) {
|
|
14
|
+
const category = template.metadata?.category ?? 'Business / Other';
|
|
15
|
+
categories.set(category, [...(categories.get(category) ?? []), template]);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return [...categories.entries()].map(([category, categoryTemplates]) => ({ category, templates: categoryTemplates }));
|
|
19
|
+
}
|
package/gallery/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
export * from './BusinessGalleryCategory';
|
|
5
|
+
export * from './businessGallery';
|
|
4
6
|
export * from './navigation';
|
|
5
7
|
export * from './applicationChrome';
|
|
6
8
|
export * from './screens';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/scene.blueprint.components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "A blueprint of Arc-bound screen and dialog templates: full pages built from Cratis Components composites, so a data list, a command form or a master-detail screen is a template rather than something you assemble.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cratis",
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@cratis/components": "^4.25.0",
|
|
55
|
-
"@cratis/scene.blueprint.default": "4.
|
|
56
|
-
"@cratis/scene.components": "4.
|
|
57
|
-
"@cratis/scene.engine": "4.
|
|
58
|
-
"@cratis/scene.model": "4.
|
|
59
|
-
"@cratis/scene.react": "4.
|
|
55
|
+
"@cratis/scene.blueprint.default": "4.11.0",
|
|
56
|
+
"@cratis/scene.components": "4.11.0",
|
|
57
|
+
"@cratis/scene.engine": "4.11.0",
|
|
58
|
+
"@cratis/scene.model": "4.11.0",
|
|
59
|
+
"@cratis/scene.react": "4.11.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@cratis/components": "^4.25.0",
|
|
63
|
-
"@cratis/scene.blueprint.default": "4.
|
|
64
|
-
"@cratis/scene.components": "4.
|
|
65
|
-
"@cratis/scene.engine": "4.
|
|
66
|
-
"@cratis/scene.model": "4.
|
|
67
|
-
"@cratis/scene.react": "4.
|
|
63
|
+
"@cratis/scene.blueprint.default": "4.11.0",
|
|
64
|
+
"@cratis/scene.components": "4.11.0",
|
|
65
|
+
"@cratis/scene.engine": "4.11.0",
|
|
66
|
+
"@cratis/scene.model": "4.11.0",
|
|
67
|
+
"@cratis/scene.react": "4.11.0",
|
|
68
68
|
"@primereact/core": "11.2.0",
|
|
69
69
|
"@primereact/headless": "11.2.0",
|
|
70
70
|
"@storybook/addon-links": "^10.6.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import { ScreenTemplate } from '@cratis/scene.model';
|
|
4
|
+
import { ScreenTemplate, TemplateScope } from '@cratis/scene.model';
|
|
5
5
|
import { SlotName, TemplateSlotName, column, slotLeaf } from '@cratis/scene.blueprint.default';
|
|
6
6
|
import { arcPageHeader, page, toolbar, toolbarButton, toolbarSeparator } from './elements';
|
|
7
7
|
import { commandForm } from './formElements';
|
|
@@ -51,6 +51,7 @@ export const commandFormPageTemplate: ScreenTemplate = {
|
|
|
51
51
|
]),
|
|
52
52
|
],
|
|
53
53
|
},
|
|
54
|
+
metadata: { type: 'Form', category: 'Business / Command', scopes: [TemplateScope.Slice] },
|
|
54
55
|
displayName: 'Command form page',
|
|
55
56
|
description: 'A generated command form under a header that states the command, with its own action bar.',
|
|
56
57
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';
|
|
4
|
+
import { ScreenTemplate, TemplateScope, WidthSizeClass } from '@cratis/scene.model';
|
|
5
5
|
import { SlotName, TemplateSlotName, column, row, slotLeaf } from '@cratis/scene.blueprint.default';
|
|
6
6
|
import { dataPage, invoiceColumns, invoiceTableOptions, observableDataTable } from './dataElements';
|
|
7
7
|
import { objectContentEditor, objectNavigationalBar, timeMachine } from './editorElements';
|
|
@@ -55,6 +55,7 @@ export const dataListPageTemplate: ScreenTemplate = {
|
|
|
55
55
|
],
|
|
56
56
|
[TemplateSlotName.Body]: [dataPage('data-list-body', SampleBindingName.AllInvoices, invoiceTableOptions, invoiceColumns)],
|
|
57
57
|
},
|
|
58
|
+
metadata: { type: 'List', category: 'Business / List', scopes: [TemplateScope.Slice] },
|
|
58
59
|
displayName: 'Data list page',
|
|
59
60
|
description: 'A dataPage bound to one query, under a header that states the binding - the whole list screen in two elements.',
|
|
60
61
|
};
|
|
@@ -87,6 +88,7 @@ export const observableDataListPageTemplate: ScreenTemplate = {
|
|
|
87
88
|
]),
|
|
88
89
|
],
|
|
89
90
|
},
|
|
91
|
+
metadata: { type: 'List', category: 'Business / Live operations', scopes: [TemplateScope.Slice] },
|
|
90
92
|
displayName: 'Observable data list page',
|
|
91
93
|
description: 'A live list over an observable query, which re-renders when the read model changes on the server.',
|
|
92
94
|
};
|
|
@@ -134,6 +136,7 @@ export const dataListWithDetailPageTemplate: ScreenTemplate = {
|
|
|
134
136
|
]),
|
|
135
137
|
],
|
|
136
138
|
},
|
|
139
|
+
metadata: { type: 'Detail', category: 'Business / Master detail', scopes: [TemplateScope.Slice] },
|
|
137
140
|
displayName: 'Data list with detail page',
|
|
138
141
|
description: 'A dataPage beside a detail region showing the selected record document and its history.',
|
|
139
142
|
};
|