@cratis/scene.blueprint.components 4.10.0 → 4.12.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.
Files changed (32) hide show
  1. package/dist/cjs/componentsBlueprint.js +7 -7
  2. package/dist/cjs/gallery/GalleryScreenPreview.js +109 -16
  3. package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -1
  4. package/dist/cjs/gallery/businessGallery.js +34 -0
  5. package/dist/cjs/gallery/businessGallery.js.map +1 -0
  6. package/dist/cjs/index.js +3 -0
  7. package/dist/cjs/index.js.map +1 -1
  8. package/dist/esm/componentsBlueprint.js +7 -7
  9. package/dist/esm/gallery/BusinessGalleryCategory.d.ts +6 -0
  10. package/dist/esm/gallery/BusinessGalleryCategory.d.ts.map +1 -0
  11. package/dist/esm/gallery/BusinessGalleryCategory.js +2 -0
  12. package/dist/esm/gallery/BusinessGalleryCategory.js.map +1 -0
  13. package/dist/esm/gallery/GalleryScreenPreview.d.ts +4 -3
  14. package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -1
  15. package/dist/esm/gallery/GalleryScreenPreview.js +114 -22
  16. package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -1
  17. package/dist/esm/gallery/businessGallery.d.ts +4 -0
  18. package/dist/esm/gallery/businessGallery.d.ts.map +1 -0
  19. package/dist/esm/gallery/businessGallery.js +32 -0
  20. package/dist/esm/gallery/businessGallery.js.map +1 -0
  21. package/dist/esm/gallery/index.d.ts +2 -0
  22. package/dist/esm/gallery/index.d.ts.map +1 -1
  23. package/dist/esm/gallery/index.js +2 -0
  24. package/dist/esm/gallery/index.js.map +1 -1
  25. package/dist/esm/index.js +2 -1
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  28. package/gallery/BusinessGalleryCategory.ts +12 -0
  29. package/gallery/GalleryScreenPreview.tsx +85 -19
  30. package/gallery/businessGallery.ts +19 -0
  31. package/gallery/index.ts +2 -0
  32. package/package.json +11 -11
@@ -3,14 +3,7 @@
3
3
  var scene_model = require('@cratis/scene.model');
4
4
  var ComponentName = require('./ComponentName.js');
5
5
  var componentsBlueprintComponents = require('./componentsBlueprintComponents.js');
6
- require('./gallery/navigation.js');
7
6
  require('@cratis/scene.blueprint.default');
8
- var screens = require('./gallery/screens.js');
9
- require('./gallery/previewProfile.js');
10
- require('./gallery/GalleryScreenPreview.js');
11
- require('react/jsx-runtime');
12
- require('react');
13
- require('@cratis/scene.react');
14
7
  require('./templates/listTemplates.js');
15
8
  require('./templates/workspaceTemplates.js');
16
9
  require('./templates/commandTemplates.js');
@@ -18,6 +11,13 @@ require('./templates/editorTemplates.js');
18
11
  require('./templates/nesting.js');
19
12
  var dialogTemplates = require('./templates/dialogTemplates.js');
20
13
  var screenTemplates = require('./templates/screenTemplates.js');
14
+ require('./gallery/navigation.js');
15
+ var screens = require('./gallery/screens.js');
16
+ require('./gallery/previewProfile.js');
17
+ require('./gallery/GalleryScreenPreview.js');
18
+ require('react/jsx-runtime');
19
+ require('react');
20
+ require('@cratis/scene.react');
21
21
  var packageName = require('./packageName.js');
22
22
 
23
23
  // Copyright (c) Cratis. All rights reserved.
@@ -2,10 +2,20 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var react = require('react');
5
+ var core = require('@primereact/core');
6
+ var scene_model = require('@cratis/scene.model');
5
7
  var scene_react = require('@cratis/scene.react');
6
8
  var scene_components = require('@cratis/scene.components');
7
9
  var scene_blueprint_default = require('@cratis/scene.blueprint.default');
8
10
  var componentsBlueprintComponents = require('../componentsBlueprintComponents.js');
11
+ var packageName = require('../packageName.js');
12
+ require('../templates/listTemplates.js');
13
+ require('../templates/workspaceTemplates.js');
14
+ require('../templates/commandTemplates.js');
15
+ require('../templates/editorTemplates.js');
16
+ require('../templates/nesting.js');
17
+ var dialogTemplates = require('../templates/dialogTemplates.js');
18
+ var screenTemplates = require('../templates/screenTemplates.js');
9
19
  var previewProfile = require('./previewProfile.js');
10
20
  var screens = require('./screens.js');
11
21
 
@@ -19,12 +29,86 @@ var screens = require('./screens.js');
19
29
  * Four of the profile's five packages are present. `PrimeReact` is not, which is why a `column` inside a
20
30
  * table comes out unresolved - and it never reaches the DOM, because the table it belongs to is a
21
31
  * placeholder until a host registers its query.
22
- */ const componentsPreviewRegistry = {
23
- ...scene_react.coreComponents,
24
- ...scene_components.cratisComponents,
25
- ...scene_blueprint_default.defaultBlueprintComponents,
26
- ...componentsBlueprintComponents.componentsBlueprintComponents
27
- };
32
+ */ const previewComponent = ({ element })=>/*#__PURE__*/ jsxRuntime.jsx("span", {
33
+ "data-preview-component": element.componentName,
34
+ children: String(element.properties.label ?? element.componentName)
35
+ });
36
+ const componentsPreviewBundles = [
37
+ scene_react.corePackage,
38
+ {
39
+ manifest: {
40
+ name: 'Tailwind',
41
+ version: '4.0.0',
42
+ kind: scene_model.PackageKind.Styling,
43
+ dependencies: [],
44
+ components: [],
45
+ layouts: [],
46
+ screenTemplates: [],
47
+ dialogTemplates: [],
48
+ themes: [],
49
+ assets: [
50
+ 'styles/tailwind.css',
51
+ 'fonts/inter.woff2'
52
+ ]
53
+ },
54
+ components: {}
55
+ },
56
+ {
57
+ manifest: {
58
+ name: 'PrimeReact',
59
+ version: '11.1.0',
60
+ kind: scene_model.PackageKind.ComponentLibrary,
61
+ dependencies: [
62
+ {
63
+ name: 'Tailwind'
64
+ }
65
+ ],
66
+ components: previewProfile.primeReactComponentNames,
67
+ layouts: [],
68
+ screenTemplates: [],
69
+ dialogTemplates: [],
70
+ themes: []
71
+ },
72
+ components: Object.fromEntries(previewProfile.primeReactComponentNames.map((name)=>[
73
+ `PrimeReact:${name}`,
74
+ previewComponent
75
+ ]))
76
+ },
77
+ scene_components.cratisComponentsPackage,
78
+ scene_blueprint_default.defaultBlueprint,
79
+ {
80
+ manifest: {
81
+ name: packageName.componentsBlueprintName,
82
+ version: '1.0.0',
83
+ kind: scene_model.PackageKind.Blueprint,
84
+ dependencies: [
85
+ {
86
+ name: 'Cratis.Blueprint.Default'
87
+ },
88
+ {
89
+ name: 'Cratis.Components'
90
+ }
91
+ ],
92
+ components: Object.keys(componentsBlueprintComponents.componentsBlueprintComponents).map((name)=>name.slice(`${packageName.componentsBlueprintName}:`.length)),
93
+ layouts: [],
94
+ screenTemplates: screenTemplates.componentsScreenTemplates.map((template)=>template.name),
95
+ dialogTemplates: dialogTemplates.componentsDialogTemplates.map((template)=>template.name),
96
+ themes: []
97
+ },
98
+ components: componentsBlueprintComponents.componentsBlueprintComponents,
99
+ screenTemplates: screenTemplates.componentsScreenTemplates,
100
+ dialogTemplates: dialogTemplates.componentsDialogTemplates,
101
+ screens: screens.componentsGalleryScreens
102
+ }
103
+ ];
104
+ /** Compatibility registry for callers that render individual gallery elements directly. */ const componentsPreviewRegistry = scene_react.resolvePackageHost({
105
+ profile: previewProfile.componentsBlueprintProfile,
106
+ bundles: componentsPreviewBundles,
107
+ policy: {
108
+ allowExecutableImports: false,
109
+ allowNetworkAssets: false
110
+ }
111
+ }).components;
28
112
  /**
29
113
  * Boots one gallery screen through the real engine.
30
114
  *
@@ -36,7 +120,7 @@ var screens = require('./screens.js');
36
120
  * `LayoutConfigProvider` and `LayoutThemeProvider` are the default blueprint's, because the shell being
37
121
  * previewed is the default blueprint's shell. This package provides Arc-bound pages to put inside it, and
38
122
  * previewing them without the thing they were designed to sit in would prove the wrong thing.
39
- */ function GalleryScreenPreview({ screenName, initialConfig, registry = componentsPreviewRegistry }) {
123
+ */ function GalleryScreenPreview({ screenName, initialConfig, bundles = componentsPreviewBundles }) {
40
124
  const element = react.useMemo(()=>{
41
125
  const screen = screens.componentsGalleryScreen(screenName);
42
126
  if (!screen) {
@@ -46,20 +130,29 @@ var screens = require('./screens.js');
46
130
  }, [
47
131
  screenName
48
132
  ]);
49
- return /*#__PURE__*/ jsxRuntime.jsx(scene_blueprint_default.LayoutConfigProvider, {
50
- initialConfig: initialConfig,
51
- storage: null,
52
- children: /*#__PURE__*/ jsxRuntime.jsx(scene_blueprint_default.LayoutThemeProvider, {
53
- themes: scene_blueprint_default.defaultBlueprintThemes,
54
- children: /*#__PURE__*/ jsxRuntime.jsx(scene_react.SceneElementView, {
55
- element: element,
56
- registry: registry,
57
- resolveBinding: ()=>undefined
133
+ return /*#__PURE__*/ jsxRuntime.jsx(core.PrimeReactProvider, {
134
+ children: /*#__PURE__*/ jsxRuntime.jsx(scene_blueprint_default.LayoutConfigProvider, {
135
+ initialConfig: initialConfig,
136
+ storage: null,
137
+ children: /*#__PURE__*/ jsxRuntime.jsx(scene_blueprint_default.LayoutThemeProvider, {
138
+ themes: scene_blueprint_default.defaultBlueprintThemes,
139
+ children: /*#__PURE__*/ jsxRuntime.jsx(scene_react.PackageHostView, {
140
+ configuration: {
141
+ profile: previewProfile.componentsBlueprintProfile,
142
+ bundles,
143
+ policy: {
144
+ allowExecutableImports: false,
145
+ allowNetworkAssets: false
146
+ }
147
+ },
148
+ element: element
149
+ })
58
150
  })
59
151
  })
60
152
  });
61
153
  }
62
154
 
63
155
  exports.GalleryScreenPreview = GalleryScreenPreview;
156
+ exports.componentsPreviewBundles = componentsPreviewBundles;
64
157
  exports.componentsPreviewRegistry = componentsPreviewRegistry;
65
158
  //# sourceMappingURL=GalleryScreenPreview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryScreenPreview.js","sources":["../../../gallery/GalleryScreenPreview.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo } from 'react';\nimport { ComponentRegistry, SceneElementView, coreComponents } from '@cratis/scene.react';\nimport { cratisComponents } from '@cratis/scene.components';\nimport { LayoutConfigProvider, LayoutConfigState, LayoutThemeProvider, composeScreenElement, defaultBlueprintComponents, defaultBlueprintThemes, resolveElementComponentNames } from '@cratis/scene.blueprint.default';\nimport { componentsBlueprintComponents } from '../componentsBlueprintComponents';\nimport { componentsBlueprintCatalog, componentsBlueprintProfile } from './previewProfile';\nimport { componentsGalleryScreen } from './screens';\n\n/**\n * The registry a preview resolves against: `core`, `Cratis.Components`, the default blueprint, and this one.\n *\n * Merged by hand rather than through `mergePackageRegistries`, because reaching for this blueprint's own\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 *\n * Four of the profile's five packages are present. `PrimeReact` is not, which is why a `column` inside a\n * table comes out unresolved - and it never reaches the DOM, because the table it belongs to is a\n * placeholder until a host registers its query.\n */\nexport const componentsPreviewRegistry: ComponentRegistry = {\n ...coreComponents,\n ...cratisComponents,\n ...defaultBlueprintComponents,\n ...componentsBlueprintComponents,\n};\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 layout mode, or a host restoring a session. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The component registry to render against. Defaults to {@link componentsPreviewRegistry}. */\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 `Screen`, its element tree is resolved by the\n * real `resolveComponentName`, and it is rendered by the real `SceneElementView` against the real registry.\n * That is the point of shipping a gallery at all - a mockup proves someone can draw an invoice list, and\n * this proves the blueprint renders one.\n *\n * `LayoutConfigProvider` and `LayoutThemeProvider` are the default blueprint's, because the shell being\n * previewed is the default blueprint's shell. This package provides Arc-bound pages to put inside it, and\n * previewing them without the thing they were designed to sit in would prove the wrong thing.\n */\nexport function GalleryScreenPreview({ screenName, initialConfig, registry = componentsPreviewRegistry }: GalleryScreenPreviewProps) {\n const element = useMemo(() => {\n const screen = componentsGalleryScreen(screenName);\n if (!screen) {\n throw new Error(`The gallery has no screen named '${screenName}'.`);\n }\n\n return resolveElementComponentNames(composeScreenElement(screen), componentsBlueprintProfile, componentsBlueprintCatalog);\n }, [screenName]);\n\n return (\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={defaultBlueprintThemes}>\n <SceneElementView element={element} registry={registry} resolveBinding={() => undefined} />\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n );\n}\n"],"names":["componentsPreviewRegistry","coreComponents","cratisComponents","defaultBlueprintComponents","componentsBlueprintComponents","GalleryScreenPreview","screenName","initialConfig","registry","element","useMemo","screen","componentsGalleryScreen","Error","resolveElementComponentNames","composeScreenElement","componentsBlueprintProfile","componentsBlueprintCatalog","_jsx","LayoutConfigProvider","storage","LayoutThemeProvider","themes","defaultBlueprintThemes","SceneElementView","resolveBinding","undefined"],"mappings":";;;;;;;;;;;AAWA;;;;;;;;;;UAWaA,yBAAAA,GAA+C;AACxD,IAAA,GAAGC,0BAAc;AACjB,IAAA,GAAGC,iCAAgB;AACnB,IAAA,GAAGC,kDAA0B;AAC7B,IAAA,GAAGC;AACP;AAaA;;;;;;;;;;;IAYO,SAASC,oBAAAA,CAAqB,EAAEC,UAAU,EAAEC,aAAa,EAAEC,QAAAA,GAAWR,yBAAyB,EAA6B,EAAA;AAC/H,IAAA,MAAMS,UAAUC,aAAAA,CAAQ,IAAA;AACpB,QAAA,MAAMC,SAASC,+BAAAA,CAAwBN,UAAAA,CAAAA;AACvC,QAAA,IAAI,CAACK,MAAAA,EAAQ;AACT,YAAA,MAAM,IAAIE,KAAAA,CAAM,CAAC,iCAAiC,EAAEP,UAAAA,CAAW,EAAE,CAAC,CAAA;AACtE,QAAA;QAEA,OAAOQ,oDAAAA,CAA6BC,4CAAAA,CAAqBJ,MAAAA,CAAAA,EAASK,yCAAAA,EAA4BC,yCAAAA,CAAAA;IAClG,CAAA,EAAG;AAACX,QAAAA;AAAW,KAAA,CAAA;AAEf,IAAA,qBACIY,cAAA,CAACC,4CAAAA,EAAAA;QAAqBZ,aAAAA,EAAeA,aAAAA;QAAea,OAAAA,EAAS,IAAA;AACzD,QAAA,QAAA,gBAAAF,cAAA,CAACG,2CAAAA,EAAAA;YAAoBC,MAAAA,EAAQC,8CAAAA;AACzB,YAAA,QAAA,gBAAAL,cAAA,CAACM,4BAAAA,EAAAA;gBAAiBf,OAAAA,EAASA,OAAAA;gBAASD,QAAAA,EAAUA,QAAAA;AAAUiB,gBAAAA,cAAAA,EAAgB,IAAMC;;;;AAI9F;;;"}
1
+ {"version":3,"file":"GalleryScreenPreview.js","sources":["../../../gallery/GalleryScreenPreview.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo } from 'react';\nimport { PrimeReactProvider } from '@primereact/core';\nimport { PackageKind } from '@cratis/scene.model';\nimport { ComponentRegistry, PackageHostView, RegisteredComponentProps, ScenePackageBundle, corePackage, resolvePackageHost } from '@cratis/scene.react';\nimport { cratisComponentsPackage } from '@cratis/scene.components';\nimport { defaultBlueprint, LayoutConfigProvider, LayoutConfigState, LayoutThemeProvider, composeScreenElement, defaultBlueprintThemes, resolveElementComponentNames } from '@cratis/scene.blueprint.default';\nimport { componentsBlueprintComponents } from '../componentsBlueprintComponents';\nimport { componentsBlueprintName } from '../packageName';\nimport { componentsDialogTemplates, componentsScreenTemplates } from '../templates';\nimport { componentsBlueprintCatalog, componentsBlueprintProfile, primeReactComponentNames } from './previewProfile';\nimport { componentsGalleryScreen, componentsGalleryScreens } from './screens';\n\n/**\n * The registry a preview resolves against: `core`, `Cratis.Components`, the default blueprint, and this one.\n *\n * Merged by hand rather than through `mergePackageRegistries`, because reaching for this blueprint's own\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 *\n * Four of the profile's five packages are present. `PrimeReact` is not, which is why a `column` inside a\n * table comes out unresolved - and it never reaches the DOM, because the table it belongs to is a\n * placeholder until a host registers its query.\n */\nconst previewComponent = ({ element }: RegisteredComponentProps) => <span data-preview-component={element.componentName}>{String(element.properties.label ?? element.componentName)}</span>;\n\nexport const componentsPreviewBundles: ScenePackageBundle[] = [\n corePackage,\n {\n manifest: {\n name: 'Tailwind',\n version: '4.0.0',\n kind: PackageKind.Styling,\n dependencies: [],\n components: [],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n assets: ['styles/tailwind.css', 'fonts/inter.woff2'],\n },\n components: {},\n },\n {\n manifest: {\n name: 'PrimeReact',\n version: '11.1.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [{ name: 'Tailwind' }],\n components: primeReactComponentNames,\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n },\n components: Object.fromEntries(primeReactComponentNames.map(name => [`PrimeReact:${name}`, previewComponent])),\n },\n cratisComponentsPackage,\n defaultBlueprint,\n {\n manifest: {\n name: componentsBlueprintName,\n version: '1.0.0',\n kind: PackageKind.Blueprint,\n dependencies: [{ name: 'Cratis.Blueprint.Default' }, { name: 'Cratis.Components' }],\n components: Object.keys(componentsBlueprintComponents).map(name => name.slice(`${componentsBlueprintName}:`.length)),\n layouts: [],\n screenTemplates: componentsScreenTemplates.map(template => template.name),\n dialogTemplates: componentsDialogTemplates.map(template => template.name),\n themes: [],\n },\n components: componentsBlueprintComponents,\n screenTemplates: componentsScreenTemplates,\n dialogTemplates: componentsDialogTemplates,\n screens: componentsGalleryScreens,\n },\n];\n\n/** Compatibility registry for callers that render individual gallery elements directly. */\nexport const componentsPreviewRegistry: ComponentRegistry = resolvePackageHost({\n profile: componentsBlueprintProfile,\n bundles: componentsPreviewBundles,\n policy: { allowExecutableImports: false, allowNetworkAssets: false },\n}).components;\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 layout mode, or a host restoring a session. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The approved package set to render against. Defaults to {@link componentsPreviewBundles}. */\n bundles?: ScenePackageBundle[];\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 `Screen`, its element tree is resolved by the\n * real `resolveComponentName`, and it is rendered by the real `SceneElementView` against the real registry.\n * That is the point of shipping a gallery at all - a mockup proves someone can draw an invoice list, and\n * this proves the blueprint renders one.\n *\n * `LayoutConfigProvider` and `LayoutThemeProvider` are the default blueprint's, because the shell being\n * previewed is the default blueprint's shell. This package provides Arc-bound pages to put inside it, and\n * previewing them without the thing they were designed to sit in would prove the wrong thing.\n */\nexport function GalleryScreenPreview({ screenName, initialConfig, bundles = componentsPreviewBundles }: GalleryScreenPreviewProps) {\n const element = useMemo(() => {\n const screen = componentsGalleryScreen(screenName);\n if (!screen) {\n throw new Error(`The gallery has no screen named '${screenName}'.`);\n }\n\n return resolveElementComponentNames(composeScreenElement(screen), componentsBlueprintProfile, componentsBlueprintCatalog);\n }, [screenName]);\n\n return (\n <PrimeReactProvider>\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={defaultBlueprintThemes}>\n <PackageHostView\n configuration={{\n profile: componentsBlueprintProfile,\n bundles,\n policy: { allowExecutableImports: false, allowNetworkAssets: false },\n }}\n element={element} />\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n </PrimeReactProvider>\n );\n}\n"],"names":["previewComponent","element","_jsx","span","data-preview-component","componentName","String","properties","label","componentsPreviewBundles","corePackage","manifest","name","version","kind","PackageKind","Styling","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","assets","ComponentLibrary","primeReactComponentNames","Object","fromEntries","map","cratisComponentsPackage","defaultBlueprint","componentsBlueprintName","Blueprint","keys","componentsBlueprintComponents","slice","length","componentsScreenTemplates","template","componentsDialogTemplates","screens","componentsGalleryScreens","componentsPreviewRegistry","resolvePackageHost","profile","componentsBlueprintProfile","bundles","policy","allowExecutableImports","allowNetworkAssets","GalleryScreenPreview","screenName","initialConfig","useMemo","screen","componentsGalleryScreen","Error","resolveElementComponentNames","composeScreenElement","componentsBlueprintCatalog","PrimeReactProvider","LayoutConfigProvider","storage","LayoutThemeProvider","defaultBlueprintThemes","PackageHostView","configuration"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA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aAAa,EAAEN,OAAAA,GAAUrC,wBAAwB,EAA6B,EAAA;AAC7H,IAAA,MAAMR,UAAUoD,aAAAA,CAAQ,IAAA;AACpB,QAAA,MAAMC,SAASC,+BAAAA,CAAwBJ,UAAAA,CAAAA;AACvC,QAAA,IAAI,CAACG,MAAAA,EAAQ;AACT,YAAA,MAAM,IAAIE,KAAAA,CAAM,CAAC,iCAAiC,EAAEL,UAAAA,CAAW,EAAE,CAAC,CAAA;AACtE,QAAA;QAEA,OAAOM,oDAAAA,CAA6BC,4CAAAA,CAAqBJ,MAAAA,CAAAA,EAAST,yCAAAA,EAA4Bc,yCAAAA,CAAAA;IAClG,CAAA,EAAG;AAACR,QAAAA;AAAW,KAAA,CAAA;AAEf,IAAA,qBACIjD,cAAA,CAAC0D,uBAAAA,EAAAA;AACG,QAAA,QAAA,gBAAA1D,cAAA,CAAC2D,4CAAAA,EAAAA;YAAqBT,aAAAA,EAAeA,aAAAA;YAAeU,OAAAA,EAAS,IAAA;AACzD,YAAA,QAAA,gBAAA5D,cAAA,CAAC6D,2CAAAA,EAAAA;gBAAoBzC,MAAAA,EAAQ0C,8CAAAA;AACzB,gBAAA,QAAA,gBAAA9D,cAAA,CAAC+D,2BAAAA,EAAAA;oBACGC,aAAAA,EAAe;wBACXtB,OAAAA,EAASC,yCAAAA;AACTC,wBAAAA,OAAAA;wBACAC,MAAAA,EAAQ;4BAAEC,sBAAAA,EAAwB,KAAA;4BAAOC,kBAAAA,EAAoB;AAAM;AACvE,qBAAA;oBACAhD,OAAAA,EAASA;;;;;AAKjC;;;;"}
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ require('@cratis/scene.blueprint.default');
4
+ require('../templates/listTemplates.js');
5
+ require('../templates/workspaceTemplates.js');
6
+ require('../templates/commandTemplates.js');
7
+ require('../templates/editorTemplates.js');
8
+ require('../templates/nesting.js');
9
+ require('../templates/dialogTemplates.js');
10
+ var screenTemplates = require('../templates/screenTemplates.js');
11
+
12
+ // Copyright (c) Cratis. All rights reserved.
13
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
14
+ /**
15
+ * Returns templates grouped by visible gallery category and filtered by scope metadata.
16
+ */ function businessGallery(scope, templates = screenTemplates.componentsPageTemplates) {
17
+ const categories = new Map();
18
+ for (const template of templates.filter((template)=>template.metadata?.scopes?.includes(scope))){
19
+ const category = template.metadata?.category ?? 'Business / Other';
20
+ categories.set(category, [
21
+ ...categories.get(category) ?? [],
22
+ template
23
+ ]);
24
+ }
25
+ return [
26
+ ...categories.entries()
27
+ ].map(([category, categoryTemplates])=>({
28
+ category,
29
+ templates: categoryTemplates
30
+ }));
31
+ }
32
+
33
+ exports.businessGallery = businessGallery;
34
+ //# sourceMappingURL=businessGallery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"businessGallery.js","sources":["../../../gallery/businessGallery.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, TemplateScope } from '@cratis/scene.model';\nimport { BusinessGalleryCategory } from './BusinessGalleryCategory';\nimport { componentsPageTemplates } from '../templates';\n\n/**\n * Returns templates grouped by visible gallery category and filtered by scope metadata.\n */\nexport function businessGallery(scope: TemplateScope, templates: ScreenTemplate[] = componentsPageTemplates): BusinessGalleryCategory[] {\n const categories = new Map<string, ScreenTemplate[]>();\n for (const template of templates.filter(template => template.metadata?.scopes?.includes(scope))) {\n const category = template.metadata?.category ?? 'Business / Other';\n categories.set(category, [...(categories.get(category) ?? []), template]);\n }\n\n return [...categories.entries()].map(([category, categoryTemplates]) => ({ category, templates: categoryTemplates }));\n}\n"],"names":["businessGallery","scope","templates","componentsPageTemplates","categories","Map","template","filter","metadata","scopes","includes","category","set","get","entries","map","categoryTemplates"],"mappings":";;;;;;;;;;;AAAA;AACA;AAMA;;AAEC,IACM,SAASA,eAAAA,CAAgBC,KAAoB,EAAEC,YAA8BC,uCAAuB,EAAA;AACvG,IAAA,MAAMC,aAAa,IAAIC,GAAAA,EAAAA;AACvB,IAAA,KAAK,MAAMC,QAAAA,IAAYJ,SAAAA,CAAUK,MAAM,CAACD,CAAAA,QAAAA,GAAYA,QAAAA,CAASE,QAAQ,EAAEC,MAAAA,EAAQC,QAAAA,CAAST,KAAAA,CAAAA,CAAAA,CAAS;AAC7F,QAAA,MAAMU,QAAAA,GAAWL,QAAAA,CAASE,QAAQ,EAAEG,QAAAA,IAAY,kBAAA;QAChDP,UAAAA,CAAWQ,GAAG,CAACD,QAAAA,EAAU;eAAKP,UAAAA,CAAWS,GAAG,CAACF,QAAAA,CAAAA,IAAa,EAAE;AAAGL,YAAAA;AAAS,SAAA,CAAA;AAC5E,IAAA;IAEA,OAAO;AAAIF,QAAAA,GAAAA,UAAAA,CAAWU,OAAO;AAAG,KAAA,CAACC,GAAG,CAAC,CAAC,CAACJ,QAAAA,EAAUK,iBAAAA,CAAkB,IAAM;AAAEL,YAAAA,QAAAA;YAAUT,SAAAA,EAAWc;SAAkB,CAAA,CAAA;AACtH;;"}
package/dist/cjs/index.js CHANGED
@@ -21,6 +21,7 @@ var editorTemplates = require('./templates/editorTemplates.js');
21
21
  var nesting = require('./templates/nesting.js');
22
22
  var dialogTemplates = require('./templates/dialogTemplates.js');
23
23
  var screenTemplates = require('./templates/screenTemplates.js');
24
+ var businessGallery = require('./gallery/businessGallery.js');
24
25
  var navigation = require('./gallery/navigation.js');
25
26
  var applicationChrome = require('./gallery/applicationChrome.js');
26
27
  var screens = require('./gallery/screens.js');
@@ -98,6 +99,7 @@ exports.componentsDialogTemplates = dialogTemplates.componentsDialogTemplates;
98
99
  exports.confirmDialogTemplate = dialogTemplates.confirmDialogTemplate;
99
100
  exports.componentsPageTemplates = screenTemplates.componentsPageTemplates;
100
101
  exports.componentsScreenTemplates = screenTemplates.componentsScreenTemplates;
102
+ exports.businessGallery = businessGallery.businessGallery;
101
103
  exports.componentsNavigationContributions = navigation.componentsNavigationContributions;
102
104
  exports.componentsNavigationEntries = navigation.componentsNavigationEntries;
103
105
  exports.componentsNavigationGroups = navigation.componentsNavigationGroups;
@@ -111,6 +113,7 @@ exports.componentsBlueprintCatalog = previewProfile.componentsBlueprintCatalog;
111
113
  exports.componentsBlueprintProfile = previewProfile.componentsBlueprintProfile;
112
114
  exports.primeReactComponentNames = previewProfile.primeReactComponentNames;
113
115
  exports.GalleryScreenPreview = GalleryScreenPreview.GalleryScreenPreview;
116
+ exports.componentsPreviewBundles = GalleryScreenPreview.componentsPreviewBundles;
114
117
  exports.componentsPreviewRegistry = GalleryScreenPreview.componentsPreviewRegistry;
115
118
  exports.DialogTemplatePreview = DialogTemplatePreview.DialogTemplatePreview;
116
119
  exports.componentsBlueprintComponents = componentsBlueprintComponents.componentsBlueprintComponents;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,14 +1,7 @@
1
1
  import { PackageKind } from '@cratis/scene.model';
2
2
  import { ComponentName } from './ComponentName.js';
3
3
  import { componentsBlueprintComponents } from './componentsBlueprintComponents.js';
4
- import './gallery/navigation.js';
5
4
  import '@cratis/scene.blueprint.default';
6
- import { componentsGalleryScreens } from './gallery/screens.js';
7
- import './gallery/previewProfile.js';
8
- import './gallery/GalleryScreenPreview.js';
9
- import 'react/jsx-runtime';
10
- import 'react';
11
- import '@cratis/scene.react';
12
5
  import './templates/listTemplates.js';
13
6
  import './templates/workspaceTemplates.js';
14
7
  import './templates/commandTemplates.js';
@@ -16,6 +9,13 @@ import './templates/editorTemplates.js';
16
9
  import './templates/nesting.js';
17
10
  import { componentsDialogTemplates } from './templates/dialogTemplates.js';
18
11
  import { componentsScreenTemplates } from './templates/screenTemplates.js';
12
+ import './gallery/navigation.js';
13
+ import { componentsGalleryScreens } from './gallery/screens.js';
14
+ import './gallery/previewProfile.js';
15
+ import './gallery/GalleryScreenPreview.js';
16
+ import 'react/jsx-runtime';
17
+ import 'react';
18
+ import '@cratis/scene.react';
19
19
  import { componentsBlueprintName } from './packageName.js';
20
20
 
21
21
  // Copyright (c) Cratis. All rights reserved.
@@ -0,0 +1,6 @@
1
+ import { ScreenTemplate } from '@cratis/scene.model';
2
+ export interface BusinessGalleryCategory {
3
+ category: string;
4
+ templates: ScreenTemplate[];
5
+ }
6
+ //# sourceMappingURL=BusinessGalleryCategory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BusinessGalleryCategory.d.ts","sourceRoot":"","sources":["../../../gallery/BusinessGalleryCategory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,cAAc,EAAE,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=BusinessGalleryCategory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BusinessGalleryCategory.js","sourceRoot":"","sources":["../../../gallery/BusinessGalleryCategory.ts"],"names":[],"mappings":""}
@@ -1,10 +1,11 @@
1
- import { ComponentRegistry } from '@cratis/scene.react';
1
+ import { ComponentRegistry, ScenePackageBundle } from '@cratis/scene.react';
2
2
  import { LayoutConfigState } from '@cratis/scene.blueprint.default';
3
+ export declare const componentsPreviewBundles: ScenePackageBundle[];
3
4
  export declare const componentsPreviewRegistry: ComponentRegistry;
4
5
  export interface GalleryScreenPreviewProps {
5
6
  screenName: string;
6
7
  initialConfig?: Partial<LayoutConfigState>;
7
- registry?: ComponentRegistry;
8
+ bundles?: ScenePackageBundle[];
8
9
  }
9
- export declare function GalleryScreenPreview({ screenName, initialConfig, registry }: GalleryScreenPreviewProps): import("react").JSX.Element;
10
+ export declare function GalleryScreenPreview({ screenName, initialConfig, bundles }: GalleryScreenPreviewProps): import("react").JSX.Element;
10
11
  //# sourceMappingURL=GalleryScreenPreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryScreenPreview.d.ts","sourceRoot":"","sources":["../../../gallery/GalleryScreenPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAoC,MAAM,qBAAqB,CAAC;AAE1F,OAAO,EAAwB,iBAAiB,EAA+H,MAAM,iCAAiC,CAAC;AAgBvN,eAAO,MAAM,yBAAyB,EAAE,iBAKvC,CAAC;AAEF,MAAM,WAAW,yBAAyB;IAEtC,UAAU,EAAE,MAAM,CAAC;IAGnB,aAAa,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAG3C,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAcD,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAoC,EAAE,EAAE,yBAAyB,+BAiBlI"}
1
+ {"version":3,"file":"GalleryScreenPreview.d.ts","sourceRoot":"","sources":["../../../gallery/GalleryScreenPreview.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAA6C,kBAAkB,EAAmC,MAAM,qBAAqB,CAAC;AAExJ,OAAO,EAA0C,iBAAiB,EAAmG,MAAM,iCAAiC,CAAC;AAoB7M,eAAO,MAAM,wBAAwB,EAAE,kBAAkB,EAkDxD,CAAC;AAGF,eAAO,MAAM,yBAAyB,EAAE,iBAI3B,CAAC;AAEd,MAAM,WAAW,yBAAyB;IAEtC,UAAU,EAAE,MAAM,CAAC;IAGnB,aAAa,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAG3C,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAcD,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,OAAkC,EAAE,EAAE,yBAAyB,+BAyBhI"}
@@ -1,11 +1,21 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { useMemo } from 'react';
3
- import { coreComponents, SceneElementView } from '@cratis/scene.react';
4
- import { cratisComponents } from '@cratis/scene.components';
5
- import { defaultBlueprintComponents, resolveElementComponentNames, composeScreenElement, LayoutConfigProvider, LayoutThemeProvider, defaultBlueprintThemes } from '@cratis/scene.blueprint.default';
3
+ import { PrimeReactProvider } from '@primereact/core';
4
+ import { PackageKind } from '@cratis/scene.model';
5
+ import { corePackage, resolvePackageHost, PackageHostView } from '@cratis/scene.react';
6
+ import { cratisComponentsPackage } from '@cratis/scene.components';
7
+ import { defaultBlueprint, resolveElementComponentNames, composeScreenElement, LayoutConfigProvider, LayoutThemeProvider, defaultBlueprintThemes } from '@cratis/scene.blueprint.default';
6
8
  import { componentsBlueprintComponents } from '../componentsBlueprintComponents.js';
7
- import { componentsBlueprintProfile, componentsBlueprintCatalog } from './previewProfile.js';
8
- import { componentsGalleryScreen } from './screens.js';
9
+ import { componentsBlueprintName } from '../packageName.js';
10
+ import '../templates/listTemplates.js';
11
+ import '../templates/workspaceTemplates.js';
12
+ import '../templates/commandTemplates.js';
13
+ import '../templates/editorTemplates.js';
14
+ import '../templates/nesting.js';
15
+ import { componentsDialogTemplates } from '../templates/dialogTemplates.js';
16
+ import { componentsScreenTemplates } from '../templates/screenTemplates.js';
17
+ import { primeReactComponentNames, componentsBlueprintProfile, componentsBlueprintCatalog } from './previewProfile.js';
18
+ import { componentsGalleryScreens, componentsGalleryScreen } from './screens.js';
9
19
 
10
20
  /**
11
21
  * The registry a preview resolves against: `core`, `Cratis.Components`, the default blueprint, and this one.
@@ -17,12 +27,86 @@ import { componentsGalleryScreen } from './screens.js';
17
27
  * Four of the profile's five packages are present. `PrimeReact` is not, which is why a `column` inside a
18
28
  * table comes out unresolved - and it never reaches the DOM, because the table it belongs to is a
19
29
  * placeholder until a host registers its query.
20
- */ const componentsPreviewRegistry = {
21
- ...coreComponents,
22
- ...cratisComponents,
23
- ...defaultBlueprintComponents,
24
- ...componentsBlueprintComponents
25
- };
30
+ */ const previewComponent = ({ element })=>/*#__PURE__*/ jsx("span", {
31
+ "data-preview-component": element.componentName,
32
+ children: String(element.properties.label ?? element.componentName)
33
+ });
34
+ const componentsPreviewBundles = [
35
+ corePackage,
36
+ {
37
+ manifest: {
38
+ name: 'Tailwind',
39
+ version: '4.0.0',
40
+ kind: PackageKind.Styling,
41
+ dependencies: [],
42
+ components: [],
43
+ layouts: [],
44
+ screenTemplates: [],
45
+ dialogTemplates: [],
46
+ themes: [],
47
+ assets: [
48
+ 'styles/tailwind.css',
49
+ 'fonts/inter.woff2'
50
+ ]
51
+ },
52
+ components: {}
53
+ },
54
+ {
55
+ manifest: {
56
+ name: 'PrimeReact',
57
+ version: '11.1.0',
58
+ kind: PackageKind.ComponentLibrary,
59
+ dependencies: [
60
+ {
61
+ name: 'Tailwind'
62
+ }
63
+ ],
64
+ components: primeReactComponentNames,
65
+ layouts: [],
66
+ screenTemplates: [],
67
+ dialogTemplates: [],
68
+ themes: []
69
+ },
70
+ components: Object.fromEntries(primeReactComponentNames.map((name)=>[
71
+ `PrimeReact:${name}`,
72
+ previewComponent
73
+ ]))
74
+ },
75
+ cratisComponentsPackage,
76
+ defaultBlueprint,
77
+ {
78
+ manifest: {
79
+ name: componentsBlueprintName,
80
+ version: '1.0.0',
81
+ kind: PackageKind.Blueprint,
82
+ dependencies: [
83
+ {
84
+ name: 'Cratis.Blueprint.Default'
85
+ },
86
+ {
87
+ name: 'Cratis.Components'
88
+ }
89
+ ],
90
+ components: Object.keys(componentsBlueprintComponents).map((name)=>name.slice(`${componentsBlueprintName}:`.length)),
91
+ layouts: [],
92
+ screenTemplates: componentsScreenTemplates.map((template)=>template.name),
93
+ dialogTemplates: componentsDialogTemplates.map((template)=>template.name),
94
+ themes: []
95
+ },
96
+ components: componentsBlueprintComponents,
97
+ screenTemplates: componentsScreenTemplates,
98
+ dialogTemplates: componentsDialogTemplates,
99
+ screens: componentsGalleryScreens
100
+ }
101
+ ];
102
+ /** Compatibility registry for callers that render individual gallery elements directly. */ const componentsPreviewRegistry = resolvePackageHost({
103
+ profile: componentsBlueprintProfile,
104
+ bundles: componentsPreviewBundles,
105
+ policy: {
106
+ allowExecutableImports: false,
107
+ allowNetworkAssets: false
108
+ }
109
+ }).components;
26
110
  /**
27
111
  * Boots one gallery screen through the real engine.
28
112
  *
@@ -34,7 +118,7 @@ import { componentsGalleryScreen } from './screens.js';
34
118
  * `LayoutConfigProvider` and `LayoutThemeProvider` are the default blueprint's, because the shell being
35
119
  * previewed is the default blueprint's shell. This package provides Arc-bound pages to put inside it, and
36
120
  * previewing them without the thing they were designed to sit in would prove the wrong thing.
37
- */ function GalleryScreenPreview({ screenName, initialConfig, registry = componentsPreviewRegistry }) {
121
+ */ function GalleryScreenPreview({ screenName, initialConfig, bundles = componentsPreviewBundles }) {
38
122
  const element = useMemo(()=>{
39
123
  const screen = componentsGalleryScreen(screenName);
40
124
  if (!screen) {
@@ -44,19 +128,27 @@ import { componentsGalleryScreen } from './screens.js';
44
128
  }, [
45
129
  screenName
46
130
  ]);
47
- return /*#__PURE__*/ jsx(LayoutConfigProvider, {
48
- initialConfig: initialConfig,
49
- storage: null,
50
- children: /*#__PURE__*/ jsx(LayoutThemeProvider, {
51
- themes: defaultBlueprintThemes,
52
- children: /*#__PURE__*/ jsx(SceneElementView, {
53
- element: element,
54
- registry: registry,
55
- resolveBinding: ()=>undefined
131
+ return /*#__PURE__*/ jsx(PrimeReactProvider, {
132
+ children: /*#__PURE__*/ jsx(LayoutConfigProvider, {
133
+ initialConfig: initialConfig,
134
+ storage: null,
135
+ children: /*#__PURE__*/ jsx(LayoutThemeProvider, {
136
+ themes: defaultBlueprintThemes,
137
+ children: /*#__PURE__*/ jsx(PackageHostView, {
138
+ configuration: {
139
+ profile: componentsBlueprintProfile,
140
+ bundles,
141
+ policy: {
142
+ allowExecutableImports: false,
143
+ allowNetworkAssets: false
144
+ }
145
+ },
146
+ element: element
147
+ })
56
148
  })
57
149
  })
58
150
  });
59
151
  }
60
152
 
61
- export { GalleryScreenPreview, componentsPreviewRegistry };
153
+ export { GalleryScreenPreview, componentsPreviewBundles, componentsPreviewRegistry };
62
154
  //# sourceMappingURL=GalleryScreenPreview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryScreenPreview.js","sources":["../../../gallery/GalleryScreenPreview.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo } from 'react';\nimport { ComponentRegistry, SceneElementView, coreComponents } from '@cratis/scene.react';\nimport { cratisComponents } from '@cratis/scene.components';\nimport { LayoutConfigProvider, LayoutConfigState, LayoutThemeProvider, composeScreenElement, defaultBlueprintComponents, defaultBlueprintThemes, resolveElementComponentNames } from '@cratis/scene.blueprint.default';\nimport { componentsBlueprintComponents } from '../componentsBlueprintComponents';\nimport { componentsBlueprintCatalog, componentsBlueprintProfile } from './previewProfile';\nimport { componentsGalleryScreen } from './screens';\n\n/**\n * The registry a preview resolves against: `core`, `Cratis.Components`, the default blueprint, and this one.\n *\n * Merged by hand rather than through `mergePackageRegistries`, because reaching for this blueprint's own\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 *\n * Four of the profile's five packages are present. `PrimeReact` is not, which is why a `column` inside a\n * table comes out unresolved - and it never reaches the DOM, because the table it belongs to is a\n * placeholder until a host registers its query.\n */\nexport const componentsPreviewRegistry: ComponentRegistry = {\n ...coreComponents,\n ...cratisComponents,\n ...defaultBlueprintComponents,\n ...componentsBlueprintComponents,\n};\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 layout mode, or a host restoring a session. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The component registry to render against. Defaults to {@link componentsPreviewRegistry}. */\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 `Screen`, its element tree is resolved by the\n * real `resolveComponentName`, and it is rendered by the real `SceneElementView` against the real registry.\n * That is the point of shipping a gallery at all - a mockup proves someone can draw an invoice list, and\n * this proves the blueprint renders one.\n *\n * `LayoutConfigProvider` and `LayoutThemeProvider` are the default blueprint's, because the shell being\n * previewed is the default blueprint's shell. This package provides Arc-bound pages to put inside it, and\n * previewing them without the thing they were designed to sit in would prove the wrong thing.\n */\nexport function GalleryScreenPreview({ screenName, initialConfig, registry = componentsPreviewRegistry }: GalleryScreenPreviewProps) {\n const element = useMemo(() => {\n const screen = componentsGalleryScreen(screenName);\n if (!screen) {\n throw new Error(`The gallery has no screen named '${screenName}'.`);\n }\n\n return resolveElementComponentNames(composeScreenElement(screen), componentsBlueprintProfile, componentsBlueprintCatalog);\n }, [screenName]);\n\n return (\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={defaultBlueprintThemes}>\n <SceneElementView element={element} registry={registry} resolveBinding={() => undefined} />\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n );\n}\n"],"names":["componentsPreviewRegistry","coreComponents","cratisComponents","defaultBlueprintComponents","componentsBlueprintComponents","GalleryScreenPreview","screenName","initialConfig","registry","element","useMemo","screen","componentsGalleryScreen","Error","resolveElementComponentNames","composeScreenElement","componentsBlueprintProfile","componentsBlueprintCatalog","_jsx","LayoutConfigProvider","storage","LayoutThemeProvider","themes","defaultBlueprintThemes","SceneElementView","resolveBinding","undefined"],"mappings":";;;;;;;;;AAWA;;;;;;;;;;UAWaA,yBAAAA,GAA+C;AACxD,IAAA,GAAGC,cAAc;AACjB,IAAA,GAAGC,gBAAgB;AACnB,IAAA,GAAGC,0BAA0B;AAC7B,IAAA,GAAGC;AACP;AAaA;;;;;;;;;;;IAYO,SAASC,oBAAAA,CAAqB,EAAEC,UAAU,EAAEC,aAAa,EAAEC,QAAAA,GAAWR,yBAAyB,EAA6B,EAAA;AAC/H,IAAA,MAAMS,UAAUC,OAAAA,CAAQ,IAAA;AACpB,QAAA,MAAMC,SAASC,uBAAAA,CAAwBN,UAAAA,CAAAA;AACvC,QAAA,IAAI,CAACK,MAAAA,EAAQ;AACT,YAAA,MAAM,IAAIE,KAAAA,CAAM,CAAC,iCAAiC,EAAEP,UAAAA,CAAW,EAAE,CAAC,CAAA;AACtE,QAAA;QAEA,OAAOQ,4BAAAA,CAA6BC,oBAAAA,CAAqBJ,MAAAA,CAAAA,EAASK,0BAAAA,EAA4BC,0BAAAA,CAAAA;IAClG,CAAA,EAAG;AAACX,QAAAA;AAAW,KAAA,CAAA;AAEf,IAAA,qBACIY,GAAA,CAACC,oBAAAA,EAAAA;QAAqBZ,aAAAA,EAAeA,aAAAA;QAAea,OAAAA,EAAS,IAAA;AACzD,QAAA,QAAA,gBAAAF,GAAA,CAACG,mBAAAA,EAAAA;YAAoBC,MAAAA,EAAQC,sBAAAA;AACzB,YAAA,QAAA,gBAAAL,GAAA,CAACM,gBAAAA,EAAAA;gBAAiBf,OAAAA,EAASA,OAAAA;gBAASD,QAAAA,EAAUA,QAAAA;AAAUiB,gBAAAA,cAAAA,EAAgB,IAAMC;;;;AAI9F;;"}
1
+ {"version":3,"file":"GalleryScreenPreview.js","sources":["../../../gallery/GalleryScreenPreview.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo } from 'react';\nimport { PrimeReactProvider } from '@primereact/core';\nimport { PackageKind } from '@cratis/scene.model';\nimport { ComponentRegistry, PackageHostView, RegisteredComponentProps, ScenePackageBundle, corePackage, resolvePackageHost } from '@cratis/scene.react';\nimport { cratisComponentsPackage } from '@cratis/scene.components';\nimport { defaultBlueprint, LayoutConfigProvider, LayoutConfigState, LayoutThemeProvider, composeScreenElement, defaultBlueprintThemes, resolveElementComponentNames } from '@cratis/scene.blueprint.default';\nimport { componentsBlueprintComponents } from '../componentsBlueprintComponents';\nimport { componentsBlueprintName } from '../packageName';\nimport { componentsDialogTemplates, componentsScreenTemplates } from '../templates';\nimport { componentsBlueprintCatalog, componentsBlueprintProfile, primeReactComponentNames } from './previewProfile';\nimport { componentsGalleryScreen, componentsGalleryScreens } from './screens';\n\n/**\n * The registry a preview resolves against: `core`, `Cratis.Components`, the default blueprint, and this one.\n *\n * Merged by hand rather than through `mergePackageRegistries`, because reaching for this blueprint's own\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 *\n * Four of the profile's five packages are present. `PrimeReact` is not, which is why a `column` inside a\n * table comes out unresolved - and it never reaches the DOM, because the table it belongs to is a\n * placeholder until a host registers its query.\n */\nconst previewComponent = ({ element }: RegisteredComponentProps) => <span data-preview-component={element.componentName}>{String(element.properties.label ?? element.componentName)}</span>;\n\nexport const componentsPreviewBundles: ScenePackageBundle[] = [\n corePackage,\n {\n manifest: {\n name: 'Tailwind',\n version: '4.0.0',\n kind: PackageKind.Styling,\n dependencies: [],\n components: [],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n assets: ['styles/tailwind.css', 'fonts/inter.woff2'],\n },\n components: {},\n },\n {\n manifest: {\n name: 'PrimeReact',\n version: '11.1.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [{ name: 'Tailwind' }],\n components: primeReactComponentNames,\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n },\n components: Object.fromEntries(primeReactComponentNames.map(name => [`PrimeReact:${name}`, previewComponent])),\n },\n cratisComponentsPackage,\n defaultBlueprint,\n {\n manifest: {\n name: componentsBlueprintName,\n version: '1.0.0',\n kind: PackageKind.Blueprint,\n dependencies: [{ name: 'Cratis.Blueprint.Default' }, { name: 'Cratis.Components' }],\n components: Object.keys(componentsBlueprintComponents).map(name => name.slice(`${componentsBlueprintName}:`.length)),\n layouts: [],\n screenTemplates: componentsScreenTemplates.map(template => template.name),\n dialogTemplates: componentsDialogTemplates.map(template => template.name),\n themes: [],\n },\n components: componentsBlueprintComponents,\n screenTemplates: componentsScreenTemplates,\n dialogTemplates: componentsDialogTemplates,\n screens: componentsGalleryScreens,\n },\n];\n\n/** Compatibility registry for callers that render individual gallery elements directly. */\nexport const componentsPreviewRegistry: ComponentRegistry = resolvePackageHost({\n profile: componentsBlueprintProfile,\n bundles: componentsPreviewBundles,\n policy: { allowExecutableImports: false, allowNetworkAssets: false },\n}).components;\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 layout mode, or a host restoring a session. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The approved package set to render against. Defaults to {@link componentsPreviewBundles}. */\n bundles?: ScenePackageBundle[];\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 `Screen`, its element tree is resolved by the\n * real `resolveComponentName`, and it is rendered by the real `SceneElementView` against the real registry.\n * That is the point of shipping a gallery at all - a mockup proves someone can draw an invoice list, and\n * this proves the blueprint renders one.\n *\n * `LayoutConfigProvider` and `LayoutThemeProvider` are the default blueprint's, because the shell being\n * previewed is the default blueprint's shell. This package provides Arc-bound pages to put inside it, and\n * previewing them without the thing they were designed to sit in would prove the wrong thing.\n */\nexport function GalleryScreenPreview({ screenName, initialConfig, bundles = componentsPreviewBundles }: GalleryScreenPreviewProps) {\n const element = useMemo(() => {\n const screen = componentsGalleryScreen(screenName);\n if (!screen) {\n throw new Error(`The gallery has no screen named '${screenName}'.`);\n }\n\n return resolveElementComponentNames(composeScreenElement(screen), componentsBlueprintProfile, componentsBlueprintCatalog);\n }, [screenName]);\n\n return (\n <PrimeReactProvider>\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={defaultBlueprintThemes}>\n <PackageHostView\n configuration={{\n profile: componentsBlueprintProfile,\n bundles,\n policy: { allowExecutableImports: false, allowNetworkAssets: false },\n }}\n element={element} />\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n </PrimeReactProvider>\n );\n}\n"],"names":["previewComponent","element","_jsx","span","data-preview-component","componentName","String","properties","label","componentsPreviewBundles","corePackage","manifest","name","version","kind","PackageKind","Styling","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","assets","ComponentLibrary","primeReactComponentNames","Object","fromEntries","map","cratisComponentsPackage","defaultBlueprint","componentsBlueprintName","Blueprint","keys","componentsBlueprintComponents","slice","length","componentsScreenTemplates","template","componentsDialogTemplates","screens","componentsGalleryScreens","componentsPreviewRegistry","resolvePackageHost","profile","componentsBlueprintProfile","bundles","policy","allowExecutableImports","allowNetworkAssets","GalleryScreenPreview","screenName","initialConfig","useMemo","screen","componentsGalleryScreen","Error","resolveElementComponentNames","composeScreenElement","componentsBlueprintCatalog","PrimeReactProvider","LayoutConfigProvider","storage","LayoutThemeProvider","defaultBlueprintThemes","PackageHostView","configuration"],"mappings":";;;;;;;;;;;;;;;;;;;AAeA;;;;;;;;;;AAUC,IACD,MAAMA,gBAAAA,GAAmB,CAAC,EAAEC,OAAO,EAA4B,iBAAKC,GAAA,CAACC,MAAAA,EAAAA;AAAKC,QAAAA,wBAAAA,EAAwBH,QAAQI,aAAa;AAAGC,QAAAA,QAAAA,EAAAA,MAAAA,CAAOL,QAAQM,UAAU,CAACC,KAAK,IAAIP,QAAQI,aAAa;;MAErKI,wBAAAA,GAAiD;AAC1DC,IAAAA,WAAAA;AACA,IAAA;QACIC,QAAAA,EAAU;YACNC,IAAAA,EAAM,UAAA;YACNC,OAAAA,EAAS,OAAA;AACTC,YAAAA,IAAAA,EAAMC,YAAYC,OAAO;AACzBC,YAAAA,YAAAA,EAAc,EAAE;AAChBC,Y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AA,qBACIjD,GAAA,CAAC0D,kBAAAA,EAAAA;AACG,QAAA,QAAA,gBAAA1D,GAAA,CAAC2D,oBAAAA,EAAAA;YAAqBT,aAAAA,EAAeA,aAAAA;YAAeU,OAAAA,EAAS,IAAA;AACzD,YAAA,QAAA,gBAAA5D,GAAA,CAAC6D,mBAAAA,EAAAA;gBAAoBzC,MAAAA,EAAQ0C,sBAAAA;AACzB,gBAAA,QAAA,gBAAA9D,GAAA,CAAC+D,eAAAA,EAAAA;oBACGC,aAAAA,EAAe;wBACXtB,OAAAA,EAASC,0BAAAA;AACTC,wBAAAA,OAAAA;wBACAC,MAAAA,EAAQ;4BAAEC,sBAAAA,EAAwB,KAAA;4BAAOC,kBAAAA,EAAoB;AAAM;AACvE,qBAAA;oBACAhD,OAAAA,EAASA;;;;;AAKjC;;"}
@@ -0,0 +1,4 @@
1
+ import { ScreenTemplate, TemplateScope } from '@cratis/scene.model';
2
+ import { BusinessGalleryCategory } from './BusinessGalleryCategory';
3
+ export declare function businessGallery(scope: TemplateScope, templates?: ScreenTemplate[]): BusinessGalleryCategory[];
4
+ //# sourceMappingURL=businessGallery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"businessGallery.d.ts","sourceRoot":"","sources":["../../../gallery/businessGallery.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAMpE,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,GAAE,cAAc,EAA4B,GAAG,uBAAuB,EAAE,CAQtI"}
@@ -0,0 +1,32 @@
1
+ import '@cratis/scene.blueprint.default';
2
+ import '../templates/listTemplates.js';
3
+ import '../templates/workspaceTemplates.js';
4
+ import '../templates/commandTemplates.js';
5
+ import '../templates/editorTemplates.js';
6
+ import '../templates/nesting.js';
7
+ import '../templates/dialogTemplates.js';
8
+ import { componentsPageTemplates } from '../templates/screenTemplates.js';
9
+
10
+ // Copyright (c) Cratis. All rights reserved.
11
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
12
+ /**
13
+ * Returns templates grouped by visible gallery category and filtered by scope metadata.
14
+ */ function businessGallery(scope, templates = componentsPageTemplates) {
15
+ const categories = new Map();
16
+ for (const template of templates.filter((template)=>template.metadata?.scopes?.includes(scope))){
17
+ const category = template.metadata?.category ?? 'Business / Other';
18
+ categories.set(category, [
19
+ ...categories.get(category) ?? [],
20
+ template
21
+ ]);
22
+ }
23
+ return [
24
+ ...categories.entries()
25
+ ].map(([category, categoryTemplates])=>({
26
+ category,
27
+ templates: categoryTemplates
28
+ }));
29
+ }
30
+
31
+ export { businessGallery };
32
+ //# sourceMappingURL=businessGallery.js.map