@cratis/scene.blueprint.default 4.33.0 → 4.35.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/index.js +53 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/preview-host/ApplicationDocument.js +17 -0
- package/dist/cjs/preview-host/ApplicationDocument.js.map +1 -0
- package/dist/cjs/preview-host/ApplicationHost.js +134 -0
- package/dist/cjs/preview-host/ApplicationHost.js.map +1 -0
- package/dist/cjs/preview-host/FlowArrangementView.js +75 -0
- package/dist/cjs/preview-host/FlowArrangementView.js.map +1 -0
- package/dist/cjs/preview-host/PreviewProblem.js +32 -0
- package/dist/cjs/preview-host/PreviewProblem.js.map +1 -0
- package/dist/cjs/preview-host/PreviewProblemsView.js +51 -0
- package/dist/cjs/preview-host/PreviewProblemsView.js.map +1 -0
- package/dist/cjs/preview-host/PreviewSliceFragment.js +55 -0
- package/dist/cjs/preview-host/PreviewSliceFragment.js.map +1 -0
- package/dist/cjs/preview-host/PreviewTarget.js +17 -0
- package/dist/cjs/preview-host/PreviewTarget.js.map +1 -0
- package/dist/cjs/preview-host/PreviewTemplate.js +49 -0
- package/dist/cjs/preview-host/PreviewTemplate.js.map +1 -0
- package/dist/cjs/preview-host/PreviewToast.js +45 -0
- package/dist/cjs/preview-host/PreviewToast.js.map +1 -0
- package/dist/cjs/preview-host/ScenePreviewHost.js +290 -0
- package/dist/cjs/preview-host/ScenePreviewHost.js.map +1 -0
- package/dist/cjs/preview-host/composeApplication.js +249 -0
- package/dist/cjs/preview-host/composeApplication.js.map +1 -0
- package/dist/cjs/preview-host/defaultApplicationChrome.js +43 -0
- package/dist/cjs/preview-host/defaultApplicationChrome.js.map +1 -0
- package/dist/cjs/preview-host/diagnosePreview.js +100 -0
- package/dist/cjs/preview-host/diagnosePreview.js.map +1 -0
- package/dist/cjs/preview-host/previewProfile.js +53 -0
- package/dist/cjs/preview-host/previewProfile.js.map +1 -0
- package/dist/cjs/preview-host/previewSampleData.js +116 -0
- package/dist/cjs/preview-host/previewSampleData.js.map +1 -0
- package/dist/cjs/preview-host/resolvePreviewPlan.js +126 -0
- package/dist/cjs/preview-host/resolvePreviewPlan.js.map +1 -0
- package/dist/cjs/preview-host/useSizeClass.js +23 -0
- package/dist/cjs/preview-host/useSizeClass.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/preview-host/ApplicationDocument.d.ts +7 -0
- package/dist/esm/preview-host/ApplicationDocument.d.ts.map +1 -0
- package/dist/esm/preview-host/ApplicationDocument.js +15 -0
- package/dist/esm/preview-host/ApplicationDocument.js.map +1 -0
- package/dist/esm/preview-host/ApplicationHost.d.ts +24 -0
- package/dist/esm/preview-host/ApplicationHost.d.ts.map +1 -0
- package/dist/esm/preview-host/ApplicationHost.js +132 -0
- package/dist/esm/preview-host/ApplicationHost.js.map +1 -0
- package/dist/esm/preview-host/FlowArrangementView.d.ts +7 -0
- package/dist/esm/preview-host/FlowArrangementView.d.ts.map +1 -0
- package/dist/esm/preview-host/FlowArrangementView.js +73 -0
- package/dist/esm/preview-host/FlowArrangementView.js.map +1 -0
- package/dist/esm/preview-host/PreviewProblem.d.ts +26 -0
- package/dist/esm/preview-host/PreviewProblem.d.ts.map +1 -0
- package/dist/esm/preview-host/PreviewProblem.js +28 -0
- package/dist/esm/preview-host/PreviewProblem.js.map +1 -0
- package/dist/esm/preview-host/PreviewProblemsView.d.ts +7 -0
- package/dist/esm/preview-host/PreviewProblemsView.d.ts.map +1 -0
- package/dist/esm/preview-host/PreviewProblemsView.js +49 -0
- package/dist/esm/preview-host/PreviewProblemsView.js.map +1 -0
- package/dist/esm/preview-host/PreviewSliceFragment.d.ts +3 -0
- package/dist/esm/preview-host/PreviewSliceFragment.d.ts.map +1 -0
- package/dist/esm/preview-host/PreviewSliceFragment.js +53 -0
- package/dist/esm/preview-host/PreviewSliceFragment.js.map +1 -0
- package/dist/esm/preview-host/PreviewTarget.d.ts +10 -0
- package/dist/esm/preview-host/PreviewTarget.d.ts.map +1 -0
- package/dist/esm/preview-host/PreviewTarget.js +15 -0
- package/dist/esm/preview-host/PreviewTarget.js.map +1 -0
- package/dist/esm/preview-host/PreviewTemplate.d.ts +5 -0
- package/dist/esm/preview-host/PreviewTemplate.d.ts.map +1 -0
- package/dist/esm/preview-host/PreviewTemplate.js +45 -0
- package/dist/esm/preview-host/PreviewTemplate.js.map +1 -0
- package/dist/esm/preview-host/PreviewToast.d.ts +10 -0
- package/dist/esm/preview-host/PreviewToast.d.ts.map +1 -0
- package/dist/esm/preview-host/PreviewToast.js +43 -0
- package/dist/esm/preview-host/PreviewToast.js.map +1 -0
- package/dist/esm/preview-host/ScenePreviewHost.d.ts +32 -0
- package/dist/esm/preview-host/ScenePreviewHost.d.ts.map +1 -0
- package/dist/esm/preview-host/ScenePreviewHost.js +288 -0
- package/dist/esm/preview-host/ScenePreviewHost.js.map +1 -0
- package/dist/esm/preview-host/composeApplication.d.ts +34 -0
- package/dist/esm/preview-host/composeApplication.d.ts.map +1 -0
- package/dist/esm/preview-host/composeApplication.js +239 -0
- package/dist/esm/preview-host/composeApplication.js.map +1 -0
- package/dist/esm/preview-host/defaultApplicationChrome.d.ts +4 -0
- package/dist/esm/preview-host/defaultApplicationChrome.d.ts.map +1 -0
- package/dist/esm/preview-host/defaultApplicationChrome.js +41 -0
- package/dist/esm/preview-host/defaultApplicationChrome.js.map +1 -0
- package/dist/esm/preview-host/diagnosePreview.d.ts +22 -0
- package/dist/esm/preview-host/diagnosePreview.d.ts.map +1 -0
- package/dist/esm/preview-host/diagnosePreview.js +98 -0
- package/dist/esm/preview-host/diagnosePreview.js.map +1 -0
- package/dist/esm/preview-host/index.d.ts +18 -0
- package/dist/esm/preview-host/index.d.ts.map +1 -0
- package/dist/esm/preview-host/index.js +18 -0
- package/dist/esm/preview-host/index.js.map +1 -0
- package/dist/esm/preview-host/previewProfile.d.ts +6 -0
- package/dist/esm/preview-host/previewProfile.d.ts.map +1 -0
- package/dist/esm/preview-host/previewProfile.js +49 -0
- package/dist/esm/preview-host/previewProfile.js.map +1 -0
- package/dist/esm/preview-host/previewSampleData.d.ts +22 -0
- package/dist/esm/preview-host/previewSampleData.d.ts.map +1 -0
- package/dist/esm/preview-host/previewSampleData.js +113 -0
- package/dist/esm/preview-host/previewSampleData.js.map +1 -0
- package/dist/esm/preview-host/resolvePreviewPlan.d.ts +18 -0
- package/dist/esm/preview-host/resolvePreviewPlan.d.ts.map +1 -0
- package/dist/esm/preview-host/resolvePreviewPlan.js +124 -0
- package/dist/esm/preview-host/resolvePreviewPlan.js.map +1 -0
- package/dist/esm/preview-host/useSizeClass.d.ts +3 -0
- package/dist/esm/preview-host/useSizeClass.d.ts.map +1 -0
- package/dist/esm/preview-host/useSizeClass.js +21 -0
- package/dist/esm/preview-host/useSizeClass.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/index.ts +1 -0
- package/package.json +8 -8
- package/preview-host/ApplicationDocument.ts +31 -0
- package/preview-host/ApplicationHost.tsx +155 -0
- package/preview-host/FlowArrangementView.tsx +59 -0
- package/preview-host/PreviewProblem.ts +68 -0
- package/preview-host/PreviewProblemsView.tsx +31 -0
- package/preview-host/PreviewSliceFragment.ts +43 -0
- package/preview-host/PreviewTarget.ts +19 -0
- package/preview-host/PreviewTemplate.tsx +45 -0
- package/preview-host/PreviewToast.tsx +32 -0
- package/preview-host/ScenePreviewHost.tsx +250 -0
- package/preview-host/composeApplication.ts +273 -0
- package/preview-host/defaultApplicationChrome.ts +33 -0
- package/preview-host/diagnosePreview.ts +132 -0
- package/preview-host/index.ts +20 -0
- package/preview-host/previewProfile.ts +47 -0
- package/preview-host/previewSampleData.ts +144 -0
- package/preview-host/resolvePreviewPlan.ts +100 -0
- package/preview-host/useSizeClass.ts +23 -0
- package/shell/layout.css +22 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DestinationReference, DialogTemplate, Form, Layout, SceneElement, Screen, ScreenTemplate, UiProfile, type ApplicationLogo, type EffectiveConfiguration } from '@cratis/scene.model';
|
|
2
|
+
import { DescriptorCatalog, PackageCatalog } from '@cratis/scene.engine';
|
|
3
|
+
import { ApplicationDocument } from './ApplicationDocument';
|
|
4
|
+
export interface CompositionOptions {
|
|
5
|
+
profile?: UiProfile;
|
|
6
|
+
catalog?: PackageCatalog;
|
|
7
|
+
chrome?(screen: Screen, shell: string): Record<string, SceneElement[]>;
|
|
8
|
+
form?(screenName: string, form: Form): SceneElement;
|
|
9
|
+
trailing?: SceneElement[];
|
|
10
|
+
decorate?(element: SceneElement): SceneElement;
|
|
11
|
+
blueprintTemplates?: ScreenTemplate[];
|
|
12
|
+
blueprintLayouts?: Layout[];
|
|
13
|
+
descriptors?: DescriptorCatalog;
|
|
14
|
+
logo?: ApplicationLogo;
|
|
15
|
+
}
|
|
16
|
+
export interface ComposedScreen {
|
|
17
|
+
element: SceneElement;
|
|
18
|
+
configuration?: EffectiveConfiguration;
|
|
19
|
+
templates: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function findLayout(application: ApplicationDocument, name: string, options?: CompositionOptions): Layout | undefined;
|
|
22
|
+
export declare function templatesOf(application: ApplicationDocument, options?: CompositionOptions): ScreenTemplate[];
|
|
23
|
+
export declare function templatePoolFor(application: ApplicationDocument, screen: Screen, options?: CompositionOptions): ScreenTemplate[];
|
|
24
|
+
export declare function templateChainOf(application: ApplicationDocument, screen: Screen, options?: CompositionOptions): ScreenTemplate[];
|
|
25
|
+
export declare function screenContent(application: ApplicationDocument, screen: Screen, options?: CompositionOptions): {
|
|
26
|
+
content: SceneElement[];
|
|
27
|
+
templates: string[];
|
|
28
|
+
slot: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function composeApplicationScreen(application: ApplicationDocument, screen: Screen, options?: CompositionOptions): ComposedScreen;
|
|
31
|
+
export declare function composeOutletScreen(application: ApplicationDocument, screen: Screen, options?: CompositionOptions): SceneElement;
|
|
32
|
+
export declare function composeDialog(application: ApplicationDocument, template: DialogTemplate, options?: CompositionOptions): SceneElement;
|
|
33
|
+
export declare function collectDestinations(application: ApplicationDocument): DestinationReference[];
|
|
34
|
+
//# sourceMappingURL=composeApplication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeApplication.d.ts","sourceRoot":"","sources":["../../../preview-host/composeApplication.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,oBAAoB,EAAE,cAAc,EAAoB,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EACrH,KAAK,eAAe,EAAE,KAAK,sBAAsB,EACpD,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,iBAAiB,EAAE,cAAc,EACpC,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,mBAAmB,EAAoB,MAAM,uBAAuB,CAAC;AAM9E,MAAM,WAAW,kBAAkB;IAE/B,OAAO,CAAC,EAAE,SAAS,CAAC;IAGpB,OAAO,CAAC,EAAE,cAAc,CAAC;IAMzB,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IAGvE,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,YAAY,CAAC;IAGpD,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAG1B,QAAQ,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC;IAG/C,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAC;IAGtC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAG5B,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAGhC,IAAI,CAAC,EAAE,eAAe,CAAC;CAC1B;AAGD,MAAM,WAAW,cAAc;IAE3B,OAA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"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { EditingScopeKind } from '@cratis/scene.model';
|
|
2
|
+
import { resolveScreenTemplates, resolveTemplateChain, resolveEffectiveConfiguration } from '@cratis/scene.engine';
|
|
3
|
+
import { ComponentName } from '../ComponentName.js';
|
|
4
|
+
import { externalComponent } from '../gallery/elements.js';
|
|
5
|
+
import { resolveElementComponentNames } from '../gallery/resolveElementNames.js';
|
|
6
|
+
import { galleryScreenTemplates } from '../gallery/screens.js';
|
|
7
|
+
import { SlotName } from '../layouts/SlotName.js';
|
|
8
|
+
import { shellComponentForLayout } from '../layouts/shellComponents.js';
|
|
9
|
+
import '../layouts/appShell.js';
|
|
10
|
+
import '../layouts/fullPage.js';
|
|
11
|
+
import { defaultLayouts } from '../layouts/defaultLayouts.js';
|
|
12
|
+
import { completeDocument } from './ApplicationDocument.js';
|
|
13
|
+
import { defaultApplicationChrome } from './defaultApplicationChrome.js';
|
|
14
|
+
import { previewTemplateComponent } from './PreviewTemplate.js';
|
|
15
|
+
import { previewProfile, blueprintPackageCatalog } from './previewProfile.js';
|
|
16
|
+
|
|
17
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
18
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
19
|
+
function previewCatalog(options) {
|
|
20
|
+
return options.catalog ?? blueprintPackageCatalog;
|
|
21
|
+
}
|
|
22
|
+
function profileOf(application, options) {
|
|
23
|
+
return options.profile ?? previewProfile(application.uiProfiles);
|
|
24
|
+
}
|
|
25
|
+
function defaultForm(screenName, form) {
|
|
26
|
+
return externalComponent(`form-${screenName}-${form.name}`, 'commandForm', {
|
|
27
|
+
command: form.forCommand,
|
|
28
|
+
label: form.name,
|
|
29
|
+
generationMode: form.generationMode,
|
|
30
|
+
layout: form.layout,
|
|
31
|
+
fields: form.fields
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function mergeSlots(...sources) {
|
|
35
|
+
const merged = {};
|
|
36
|
+
for (const source of sources){
|
|
37
|
+
for (const [slot, elements] of Object.entries(source ?? {}))merged[slot] = [
|
|
38
|
+
...merged[slot] ?? [],
|
|
39
|
+
...elements
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
return merged;
|
|
43
|
+
}
|
|
44
|
+
/** The layout a screen names: the document's own, or one the blueprint provides. */ function findLayout(application, name, options = {}) {
|
|
45
|
+
return application.layouts.find((candidate)=>candidate.name === name) ?? (options.blueprintLayouts ?? defaultLayouts).find((candidate)=>candidate.name === name);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The templates a screen is composed with: the document's own, then the blueprint's for any name the document does not declare.
|
|
49
|
+
* A model that writes `template CrudList` without declaring it is naming one of the blueprint's templates; the document's
|
|
50
|
+
* own declaration always wins the name.
|
|
51
|
+
*/ function templatesOf(application, options = {}) {
|
|
52
|
+
const own = application.screenTemplates;
|
|
53
|
+
return [
|
|
54
|
+
...own,
|
|
55
|
+
...(options.blueprintTemplates ?? galleryScreenTemplates).filter((template)=>!own.some((candidate)=>candidate.name === template.name))
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The templates a screen's template chain is worked out among: the document's own when the screen's template is one of them,
|
|
60
|
+
* otherwise the blueprint's as well. The blueprint's templates are never mixed into a document's own chain - several of them fit
|
|
61
|
+
* the same slot name, which would make every slot ambiguous.
|
|
62
|
+
*/ function templatePoolFor(application, screen, options = {}) {
|
|
63
|
+
return application.screenTemplates.some((candidate)=>candidate.name === screen.screenTemplate) ? application.screenTemplates : templatesOf(application, options);
|
|
64
|
+
}
|
|
65
|
+
/** The slot of the layout a template chain's outermost template fits: its declared slot, or `content`. */ function layoutSlotOf(layout, outermost) {
|
|
66
|
+
const fits = outermost.fitsSlot;
|
|
67
|
+
if (fits === undefined) return SlotName.Content;
|
|
68
|
+
const slot = fits.includes('.') ? fits.slice(fits.lastIndexOf('.') + 1) : fits;
|
|
69
|
+
return layout === undefined || layout.slots.some((candidate)=>candidate.name === slot) ? slot : SlotName.Content;
|
|
70
|
+
}
|
|
71
|
+
/** The templates a screen's own template sits inside, outermost first, ending with the screen's own template. */ function templateChainOf(application, screen, options = {}) {
|
|
72
|
+
if (!screen.screenTemplate) return [];
|
|
73
|
+
const templates = templatePoolFor(application, screen, options);
|
|
74
|
+
const own = templates.find((candidate)=>candidate.name === screen.screenTemplate);
|
|
75
|
+
if (!own) return [];
|
|
76
|
+
const layout = findLayout(application, screen.layout, options);
|
|
77
|
+
const placements = layout ? resolveScreenTemplates(layout, templates).placements : [];
|
|
78
|
+
const chain = [
|
|
79
|
+
own
|
|
80
|
+
];
|
|
81
|
+
for(let guard = 0; guard <= templates.length; guard++){
|
|
82
|
+
const placement = placements.find((candidate)=>candidate.template === chain[0].name);
|
|
83
|
+
if (!placement || placement.container === layout?.name) break;
|
|
84
|
+
const parent = templates.find((candidate)=>candidate.name === placement.container);
|
|
85
|
+
if (!parent || chain.includes(parent)) break;
|
|
86
|
+
chain.unshift(parent);
|
|
87
|
+
}
|
|
88
|
+
return chain;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* What a screen puts in the shell's content slot: the screen - inside the template chain it names, when it names one - and the
|
|
92
|
+
* forms it hosts. The same content fills the shell on the primary region and a nested outlet.
|
|
93
|
+
*
|
|
94
|
+
* The innermost template takes the screen's own slot content; each template outside it holds the one inside in the slot it
|
|
95
|
+
* declared (`fitsSlot`), so the chain's arrangements all apply.
|
|
96
|
+
*/ function screenContent(application, screen, options = {}) {
|
|
97
|
+
const form = options.form ?? defaultForm;
|
|
98
|
+
const forms = screen.forms.map((candidate)=>form(screen.name, candidate));
|
|
99
|
+
const chain = templateChainOf(application, screen, options);
|
|
100
|
+
if (chain.length === 0) {
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
...Object.values(screen.slotContent).flat(),
|
|
104
|
+
...forms
|
|
105
|
+
],
|
|
106
|
+
templates: [],
|
|
107
|
+
slot: SlotName.Content
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
let inner;
|
|
111
|
+
for(let index = chain.length - 1; index >= 0; index--){
|
|
112
|
+
const template = chain[index];
|
|
113
|
+
const slots = index === chain.length - 1 ? mergeSlots(template.content, screen.slotContent, {
|
|
114
|
+
forms
|
|
115
|
+
}) : mergeSlots(template.content, {
|
|
116
|
+
[slotName(chain[index + 1])]: [
|
|
117
|
+
inner
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
inner = externalComponent(`template-${screen.name}-${template.name}`, previewTemplateComponent, {
|
|
121
|
+
arrangement: template.arrangement
|
|
122
|
+
}, slots);
|
|
123
|
+
}
|
|
124
|
+
const layout = findLayout(application, screen.layout, options);
|
|
125
|
+
return {
|
|
126
|
+
content: [
|
|
127
|
+
inner
|
|
128
|
+
],
|
|
129
|
+
templates: chain.map((template)=>template.name),
|
|
130
|
+
slot: layoutSlotOf(layout, chain[0])
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function slotName(template) {
|
|
134
|
+
const fits = template.fitsSlot ?? SlotName.Content;
|
|
135
|
+
return fits.includes('.') ? fits.slice(fits.lastIndexOf('.') + 1) : fits;
|
|
136
|
+
}
|
|
137
|
+
function finish(element, profile, catalog, options) {
|
|
138
|
+
const decorated = options.decorate ? options.decorate(element) : element;
|
|
139
|
+
return resolveElementComponentNames(decorated, profile, catalog);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Composes one screen the way the application shows it: the shell for the screen's layout, the chrome every screen shares in the
|
|
143
|
+
* shell's slots, and the screen - inside the template chain it names - in the slot the chain fits. Stage and the preview host
|
|
144
|
+
* both compose through this, so a screen is the same screen in both (spec PRV9, REN2).
|
|
145
|
+
*
|
|
146
|
+
* A layout the selected package set does not provide stays unresolved in the rendered tree: showing that missing component is
|
|
147
|
+
* deliberate, because silently substituting a default shell would hide a package/profile problem.
|
|
148
|
+
*
|
|
149
|
+
* @param application The document and profiles.
|
|
150
|
+
* @param screen The screen to compose.
|
|
151
|
+
* @param options What the host decides.
|
|
152
|
+
* @returns The element to render, the configuration its templates resolved, and the templates around the screen.
|
|
153
|
+
*/ function composeApplicationScreen(application, screen, options = {}) {
|
|
154
|
+
const profile = profileOf(application, options);
|
|
155
|
+
const { content, templates, slot } = screenContent(application, screen, options);
|
|
156
|
+
const shell = shellComponentForLayout(screen.layout) ?? screen.layout;
|
|
157
|
+
const chrome = options.chrome ? options.chrome(screen, shell) : shell === ComponentName.FullPageShell ? {} : defaultApplicationChrome(options.logo);
|
|
158
|
+
const composed = externalComponent(`screen-${screen.name}`, shell, {
|
|
159
|
+
screenName: screen.name
|
|
160
|
+
}, {
|
|
161
|
+
...chrome,
|
|
162
|
+
[slot]: [
|
|
163
|
+
...chrome[slot] ?? [],
|
|
164
|
+
...content,
|
|
165
|
+
...slot === SlotName.Content ? options.trailing ?? [] : []
|
|
166
|
+
]
|
|
167
|
+
});
|
|
168
|
+
return {
|
|
169
|
+
element: finish(composed, profile, previewCatalog(options), options),
|
|
170
|
+
configuration: configurationOf(application, screen, options),
|
|
171
|
+
templates
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* A screen as it appears inside an outlet of another screen: its content alone, without the shell the primary region wraps
|
|
176
|
+
* every screen in, with the same name resolution.
|
|
177
|
+
*/ function composeOutletScreen(application, screen, options = {}) {
|
|
178
|
+
const { content } = screenContent(application, screen, options);
|
|
179
|
+
const element = content.length === 1 ? content[0] : {
|
|
180
|
+
id: `outlet-${screen.name}`,
|
|
181
|
+
children: content
|
|
182
|
+
};
|
|
183
|
+
return finish(element, profileOf(application, options), previewCatalog(options), options);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* A dialog template as it is shown over the application: its slot content inside the template wrapper, with the arrangement the
|
|
187
|
+
* template wrote, names resolved - the same wrapper a screen's template gets.
|
|
188
|
+
*/ function composeDialog(application, template, options = {}) {
|
|
189
|
+
const element = externalComponent(`dialog-${template.name}`, previewTemplateComponent, {
|
|
190
|
+
arrangement: template.arrangement
|
|
191
|
+
}, template.content ?? {});
|
|
192
|
+
return finish(element, profileOf(application, options), previewCatalog(options), options);
|
|
193
|
+
}
|
|
194
|
+
function configurationOf(application, screen, options) {
|
|
195
|
+
if (!options.descriptors || (application.instanceContributions ?? []).length === 0) return undefined;
|
|
196
|
+
const templates = templatesOf(application, options);
|
|
197
|
+
const document = {
|
|
198
|
+
...completeDocument(application),
|
|
199
|
+
screenTemplates: templates,
|
|
200
|
+
layouts: [
|
|
201
|
+
...application.layouts,
|
|
202
|
+
...(options.blueprintLayouts ?? defaultLayouts).filter((layout)=>!application.layouts.some((own)=>own.name === layout.name))
|
|
203
|
+
]
|
|
204
|
+
};
|
|
205
|
+
const chain = resolveTemplateChain(document, {
|
|
206
|
+
kind: EditingScopeKind.Screen,
|
|
207
|
+
name: screen.name
|
|
208
|
+
});
|
|
209
|
+
return resolveEffectiveConfiguration(chain, document.instanceContributions, options.descriptors);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Every destination the document authors - on actions, navigations, contributions and toolbar items - wherever it sits, so a
|
|
213
|
+
* route override on one of them can be deep linked.
|
|
214
|
+
*/ function collectDestinations(application) {
|
|
215
|
+
const found = [];
|
|
216
|
+
const visit = (value)=>{
|
|
217
|
+
if (value === null || typeof value !== 'object') return;
|
|
218
|
+
if (Array.isArray(value)) {
|
|
219
|
+
value.forEach(visit);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
for (const [key, entry] of Object.entries(value)){
|
|
223
|
+
if (key === 'destination' && entry !== null && typeof entry === 'object' && !Array.isArray(entry)) found.push(entry);
|
|
224
|
+
visit(entry);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
for (const screen of application.screens){
|
|
228
|
+
visit(screen.slotContent);
|
|
229
|
+
visit(screen.contributions);
|
|
230
|
+
}
|
|
231
|
+
for (const template of [
|
|
232
|
+
...application.screenTemplates,
|
|
233
|
+
...application.dialogTemplates ?? []
|
|
234
|
+
])visit(template.content);
|
|
235
|
+
return found;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { collectDestinations, composeApplicationScreen, composeDialog, composeOutletScreen, findLayout, screenContent, templateChainOf, templatePoolFor, templatesOf };
|
|
239
|
+
//# sourceMappingURL=composeApplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeApplication.js","sources":["../../../preview-host/composeApplication.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 {\n DestinationReference, DialogTemplate, EditingScopeKind, Form, Layout, SceneElement, Screen, ScreenTemplate, UiProfile,\n type ApplicationLogo, type EffectiveConfiguration,\n} from '@cratis/scene.model';\nimport {\n DescriptorCatalog, PackageCatalog, resolveEffectiveConfiguration, resolveScreenTemplates, resolveTemplateChain,\n} from '@cratis/scene.engine';\nimport { ComponentName } from '../ComponentName';\nimport { externalComponent } from '../gallery/elements';\nimport { resolveElementComponentNames } from '../gallery/resolveElementNames';\nimport { galleryScreenTemplates } from '../gallery/screens';\nimport { SlotName, defaultLayouts, shellComponentForLayout } from '../layouts';\nimport { ApplicationDocument, completeDocument } from './ApplicationDocument';\nimport { defaultApplicationChrome } from './defaultApplicationChrome';\nimport { previewTemplateComponent } from './PreviewTemplate';\nimport { blueprintPackageCatalog, previewProfile } from './previewProfile';\n\n/** What a host decides about how a screen is composed; everything else is the document's. */\nexport interface CompositionOptions {\n /** The profile names are resolved with; {@link previewProfile} of the document's profiles when absent. */\n profile?: UiProfile;\n\n /** What each package declares; the core and default blueprint packages when absent. */\n catalog?: PackageCatalog;\n\n /**\n * The chrome the shell is given in its slots - topbar, sidebar, menu, breadcrumb, footer. Absent, the shell shows the\n * application's navigation regions (`defaultApplicationChrome`). A full-page shell gets none of it unless the host says so.\n */\n chrome?(screen: Screen, shell: string): Record<string, SceneElement[]>;\n\n /** The element a screen's form becomes; the Cratis `commandForm` component when absent. */\n form?(screenName: string, form: Form): SceneElement;\n\n /** Elements placed after the screen's content in the shell's content slot - Stage's status line. */\n trailing?: SceneElement[];\n\n /** A last pass over the composed tree before names are resolved - Stage binds data sources here. */\n decorate?(element: SceneElement): SceneElement;\n\n /** The templates the blueprint provides, for a screen that names one the document does not declare; the gallery's when absent. */\n blueprintTemplates?: ScreenTemplate[];\n\n /** The layouts the blueprint provides; the default blueprint's when absent. */\n blueprintLayouts?: Layout[];\n\n /** What each component exposes, so the templates' instance contributions can be resolved; without it no configuration is resolved. */\n descriptors?: DescriptorCatalog;\n\n /** The application's logo, shown in the default chrome's topbar. */\n logo?: ApplicationLogo;\n}\n\n/** One screen composed for the application shell. */\nexport interface ComposedScreen {\n /** The shell with its chrome, the screen's template chain and the screen, names resolved. */\n element: SceneElement;\n\n /** What each scope configured on the components the templates contribute; absent when nothing was configured. */\n configuration?: EffectiveConfiguration;\n\n /** The templates around the screen, outermost first. */\n templates: string[];\n}\n\nfunction previewCatalog(options: CompositionOptions): PackageCatalog {\n return options.catalog ?? blueprintPackageCatalog;\n}\n\nfunction profileOf(application: ApplicationDocument, options: CompositionOptions): UiProfile {\n return options.profile ?? previewProfile(application.uiProfiles);\n}\n\nfunction defaultForm(screenName: string, form: Form): SceneElement {\n return externalComponent(`form-${screenName}-${form.name}`, 'commandForm', {\n command: form.forCommand,\n label: form.name,\n generationMode: form.generationMode,\n layout: form.layout,\n fields: form.fields,\n });\n}\n\nfunction mergeSlots(...sources: (Record<string, SceneElement[]> | undefined)[]): Record<string, SceneElement[]> {\n const merged: Record<string, SceneElement[]> = {};\n for (const source of sources) {\n for (const [slot, elements] of Object.entries(source ?? {})) merged[slot] = [...(merged[slot] ?? []), ...elements];\n }\n\n return merged;\n}\n\n/** The layout a screen names: the document's own, or one the blueprint provides. */\nexport function findLayout(application: ApplicationDocument, name: string, options: CompositionOptions = {}): Layout | undefined {\n return application.layouts.find(candidate => candidate.name === name)\n ?? (options.blueprintLayouts ?? defaultLayouts).find(candidate => candidate.name === name);\n}\n\n/**\n * The templates a screen is composed with: the document's own, then the blueprint's for any name the document does not declare.\n * A model that writes `template CrudList` without declaring it is naming one of the blueprint's templates; the document's\n * own declaration always wins the name.\n */\nexport function templatesOf(application: ApplicationDocument, options: CompositionOptions = {}): ScreenTemplate[] {\n const own = application.screenTemplates;\n return [...own, ...(options.blueprintTemplates ?? galleryScreenTemplates).filter(template => !own.some(candidate => candidate.name === template.name))];\n}\n\n/**\n * The templates a screen's template chain is worked out among: the document's own when the screen's template is one of them,\n * otherwise the blueprint's as well. The blueprint's templates are never mixed into a document's own chain - several of them fit\n * the same slot name, which would make every slot ambiguous.\n */\nexport function templatePoolFor(application: ApplicationDocument, screen: Screen, options: CompositionOptions = {}): ScreenTemplate[] {\n return application.screenTemplates.some(candidate => candidate.name === screen.screenTemplate)\n ? application.screenTemplates\n : templatesOf(application, options);\n}\n\n/** The slot of the layout a template chain's outermost template fits: its declared slot, or `content`. */\nfunction layoutSlotOf(layout: Layout | undefined, outermost: ScreenTemplate): string {\n const fits = outermost.fitsSlot;\n if (fits === undefined) return SlotName.Content;\n const slot = fits.includes('.') ? fits.slice(fits.lastIndexOf('.') + 1) : fits;\n return layout === undefined || layout.slots.some(candidate => candidate.name === slot) ? slot : SlotName.Content;\n}\n\n/** The templates a screen's own template sits inside, outermost first, ending with the screen's own template. */\nexport function templateChainOf(application: ApplicationDocument, screen: Screen, options: CompositionOptions = {}): ScreenTemplate[] {\n if (!screen.screenTemplate) return [];\n const templates = templatePoolFor(application, screen, options);\n const own = templates.find(candidate => candidate.name === screen.screenTemplate);\n if (!own) return [];\n\n const layout = findLayout(application, screen.layout, options);\n const placements = layout ? resolveScreenTemplates(layout, templates).placements : [];\n const chain: ScreenTemplate[] = [own];\n for (let guard = 0; guard <= templates.length; guard++) {\n const placement = placements.find(candidate => candidate.template === chain[0].name);\n if (!placement || placement.container === layout?.name) break;\n const parent = templates.find(candidate => candidate.name === placement.container);\n if (!parent || chain.includes(parent)) break;\n chain.unshift(parent);\n }\n\n return chain;\n}\n\n/**\n * What a screen puts in the shell's content slot: the screen - inside the template chain it names, when it names one - and the\n * forms it hosts. The same content fills the shell on the primary region and a nested outlet.\n *\n * The innermost template takes the screen's own slot content; each template outside it holds the one inside in the slot it\n * declared (`fitsSlot`), so the chain's arrangements all apply.\n */\nexport function screenContent(application: ApplicationDocument, screen: Screen, options: CompositionOptions = {}): { content: SceneElement[]; templates: string[]; slot: string } {\n const form = options.form ?? defaultForm;\n const forms = screen.forms.map(candidate => form(screen.name, candidate));\n const chain = templateChainOf(application, screen, options);\n if (chain.length === 0) {\n return { content: [...Object.values(screen.slotContent).flat(), ...forms], templates: [], slot: SlotName.Content };\n }\n\n let inner: SceneElement | undefined;\n for (let index = chain.length - 1; index >= 0; index--) {\n const template = chain[index];\n const slots = index === chain.length - 1\n ? mergeSlots(template.content, screen.slotContent, { forms })\n : mergeSlots(template.content, { [slotName(chain[index + 1])]: [inner!] });\n inner = externalComponent(`template-${screen.name}-${template.name}`, previewTemplateComponent, { arrangement: template.arrangement }, slots);\n }\n\n const layout = findLayout(application, screen.layout, options);\n return { content: [inner!], templates: chain.map(template => template.name), slot: layoutSlotOf(layout, chain[0]) };\n}\n\nfunction slotName(template: ScreenTemplate): string {\n const fits = template.fitsSlot ?? SlotName.Content;\n return fits.includes('.') ? fits.slice(fits.lastIndexOf('.') + 1) : fits;\n}\n\nfunction finish(element: SceneElement, profile: UiProfile, catalog: PackageCatalog, options: CompositionOptions): SceneElement {\n const decorated = options.decorate ? options.decorate(element) : element;\n return resolveElementComponentNames(decorated, profile, catalog);\n}\n\n/**\n * Composes one screen the way the application shows it: the shell for the screen's layout, the chrome every screen shares in the\n * shell's slots, and the screen - inside the template chain it names - in the slot the chain fits. Stage and the preview host\n * both compose through this, so a screen is the same screen in both (spec PRV9, REN2).\n *\n * A layout the selected package set does not provide stays unresolved in the rendered tree: showing that missing component is\n * deliberate, because silently substituting a default shell would hide a package/profile problem.\n *\n * @param application The document and profiles.\n * @param screen The screen to compose.\n * @param options What the host decides.\n * @returns The element to render, the configuration its templates resolved, and the templates around the screen.\n */\nexport function composeApplicationScreen(application: ApplicationDocument, screen: Screen, options: CompositionOptions = {}): ComposedScreen {\n const profile = profileOf(application, options);\n const { content, templates, slot } = screenContent(application, screen, options);\n\n const shell = shellComponentForLayout(screen.layout) ?? screen.layout;\n const chrome = options.chrome\n ? options.chrome(screen, shell)\n : shell === ComponentName.FullPageShell ? {} : defaultApplicationChrome(options.logo);\n const composed = externalComponent(`screen-${screen.name}`, shell, { screenName: screen.name }, {\n ...chrome,\n [slot]: [...(chrome[slot] ?? []), ...content, ...(slot === SlotName.Content ? options.trailing ?? [] : [])],\n });\n\n return { element: finish(composed, profile, previewCatalog(options), options), configuration: configurationOf(application, screen, options), templates };\n}\n\n/**\n * A screen as it appears inside an outlet of another screen: its content alone, without the shell the primary region wraps\n * every screen in, with the same name resolution.\n */\nexport function composeOutletScreen(application: ApplicationDocument, screen: Screen, options: CompositionOptions = {}): SceneElement {\n const { content } = screenContent(application, screen, options);\n const element = content.length === 1 ? content[0] : { id: `outlet-${screen.name}`, children: content } as unknown as SceneElement;\n return finish(element, profileOf(application, options), previewCatalog(options), options);\n}\n\n/**\n * A dialog template as it is shown over the application: its slot content inside the template wrapper, with the arrangement the\n * template wrote, names resolved - the same wrapper a screen's template gets.\n */\nexport function composeDialog(application: ApplicationDocument, template: DialogTemplate, options: CompositionOptions = {}): SceneElement {\n const element = externalComponent(`dialog-${template.name}`, previewTemplateComponent, { arrangement: template.arrangement }, template.content ?? {});\n return finish(element, profileOf(application, options), previewCatalog(options), options);\n}\n\nfunction configurationOf(application: ApplicationDocument, screen: Screen, options: CompositionOptions): EffectiveConfiguration | undefined {\n if (!options.descriptors || (application.instanceContributions ?? []).length === 0) return undefined;\n\n const templates = templatesOf(application, options);\n const document = { ...completeDocument(application), screenTemplates: templates, layouts: [...application.layouts, ...(options.blueprintLayouts ?? defaultLayouts).filter(layout => !application.layouts.some(own => own.name === layout.name))] };\n const chain = resolveTemplateChain(document, { kind: EditingScopeKind.Screen, name: screen.name });\n return resolveEffectiveConfiguration(chain, document.instanceContributions, options.descriptors);\n}\n\n/**\n * Every destination the document authors - on actions, navigations, contributions and toolbar items - wherever it sits, so a\n * route override on one of them can be deep linked.\n */\nexport function collectDestinations(application: ApplicationDocument): DestinationReference[] {\n const found: DestinationReference[] = [];\n const visit = (value: unknown) => {\n if (value === null || typeof value !== 'object') return;\n if (Array.isArray(value)) {\n value.forEach(visit);\n return;\n }\n\n for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {\n if (key === 'destination' && entry !== null && typeof entry === 'object' && !Array.isArray(entry)) found.push(entry as DestinationReference);\n visit(entry);\n }\n };\n\n for (const screen of application.screens) {\n visit(screen.slotContent);\n visit(screen.contributions);\n }\n\n for (const template of [...application.screenTemplates, ...(application.dialogTemplates ?? [])]) visit(template.content);\n return found;\n}\n"],"names":["previewCatalog","options","catalog","blueprintPackageCatalog","profileOf","application","profile","previewProfile","uiProfiles","defaultForm","screenName","form","externalComponent","name","command","forCommand","label","generationMode","layout","fields","mergeSlots","sources","merged","source","slot","elements","Object","entries","findLayout","layouts","find","candidate","blueprintLayouts","defaultLayouts","templatesOf","own","screenTemplates","blueprintTemplates","galleryScreenTemplates","filter","template","some","templatePoolFor","screen","screenTemplate","layoutSlotOf","outermost","fits","fitsSlot","undefined","SlotName","Content","includes","slice","lastIndexOf","slots","templateChainOf","templates","placements","resolveScreenTemplates","chain","guard","length","placement","container","parent","unshift","screenContent","forms","map","content","values","slotContent","flat","inner","index","slotName","previewTemplateComponent","arrangement","finish","element","decorated","decorate","resolveElementComponentNames","composeApplicationScreen","shell","shellComponentForLayout","chrome","ComponentName","FullPageShell","defaultApplicationChrome","logo","composed","trailing","configuration","configurationOf","composeOutletScreen","id","children","composeDialog","descriptors","instanceContributions","document","completeDocument","resolveTemplateChain","kind","EditingScopeKind","Screen","resolveEffectiveConfiguration","collectDestinations","found","visit","value","Array","isArray","forEach","key","entry","push","screens","contributions","dial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O,CAACF,KAAAA,CAAAA,EAAQ;AACtBA,YAAAA,KAAAA,CAAMG,OAAO,CAACJ,KAAAA,CAAAA;AACd,YAAA;AACJ,QAAA;QAEA,KAAK,MAAM,CAACK,GAAAA,EAAKC,KAAAA,CAAM,IAAI3F,MAAAA,CAAOC,OAAO,CAACqF,KAAAA,CAAAA,CAAmC;AACzE,YAAA,IAAII,GAAAA,KAAQ,aAAA,IAAiBC,KAAAA,KAAU,IAAA,IAAQ,OAAOA,KAAAA,KAAU,QAAA,IAAY,CAACJ,KAAAA,CAAMC,OAAO,CAACG,KAAAA,CAAAA,EAAQP,KAAAA,CAAMQ,IAAI,CAACD,KAAAA,CAAAA;YAC9GN,KAAAA,CAAMM,KAAAA,CAAAA;AACV,QAAA;AACJ,IAAA,CAAA;AAEA,IAAA,KAAK,MAAM1E,MAAAA,IAAUtC,WAAAA,CAAYkH,OAAO,CAAE;AACtCR,QAAAA,KAAAA,CAAMpE,OAAO6B,WAAW,CAAA;AACxBuC,QAAAA,KAAAA,CAAMpE,OAAO6E,aAAa,CAAA;AAC9B,IAAA;AAEA,IAAA,KAAK,MAAMhF,QAAAA,IAAY;AAAInC,QAAAA,GAAAA,WAAAA,CAAY+B,eAAe;WAAM/B,WAAAA,CAAYoH,eAAe,IAAI;KAAI,CAAEV,KAAAA,CAAMvE,SAAS8B,OAAO,CAAA;IACvH,OAAOwC,KAAAA;AACX;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApplicationLogo } from '@cratis/scene.model';
|
|
2
|
+
import type { SceneElement } from '@cratis/scene.model';
|
|
3
|
+
export declare function defaultApplicationChrome(logo?: ApplicationLogo): Record<string, SceneElement[]>;
|
|
4
|
+
//# sourceMappingURL=defaultApplicationChrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultApplicationChrome.d.ts","sourceRoot":"","sources":["../../../preview-host/defaultApplicationChrome.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAaxD,wBAAgB,wBAAwB,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAe/F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentName } from '../ComponentName.js';
|
|
2
|
+
import { externalComponent } from '../gallery/elements.js';
|
|
3
|
+
import { SlotName } from '../layouts/SlotName.js';
|
|
4
|
+
import '@cratis/scene.model';
|
|
5
|
+
import '../layouts/shellComponents.js';
|
|
6
|
+
import '../layouts/appShell.js';
|
|
7
|
+
import '../layouts/fullPage.js';
|
|
8
|
+
|
|
9
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
10
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
11
|
+
/**
|
|
12
|
+
* The chrome the application shell wraps every screen in when the model supplies navigation: a topbar and a sidebar. Neither
|
|
13
|
+
* carries items - each shows the effective navigation of its region (`NavigationRegionView`), so inherit/extend/override
|
|
14
|
+
* applies and nothing here knows the items. The logo is the application's (`navigation.application.logo`).
|
|
15
|
+
*
|
|
16
|
+
* @param logo The application's logo, when it has one.
|
|
17
|
+
* @returns The slot content to give the shell.
|
|
18
|
+
*/ function defaultApplicationChrome(logo) {
|
|
19
|
+
const slots = {};
|
|
20
|
+
if (logo) {
|
|
21
|
+
slots.logo = [
|
|
22
|
+
externalComponent('topbar-logo', ComponentName.Logo, {
|
|
23
|
+
label: logo.title,
|
|
24
|
+
initials: logo.title.slice(0, 1).toUpperCase(),
|
|
25
|
+
lightImageUrl: logo.image || undefined,
|
|
26
|
+
targetScreen: ''
|
|
27
|
+
})
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
[SlotName.Topbar]: [
|
|
32
|
+
externalComponent('topbar', ComponentName.Topbar, {}, slots)
|
|
33
|
+
],
|
|
34
|
+
[SlotName.Sidebar]: [
|
|
35
|
+
externalComponent('sidebar', ComponentName.Sidebar, {})
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { defaultApplicationChrome };
|
|
41
|
+
//# sourceMappingURL=defaultApplicationChrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultApplicationChrome.js","sources":["../../../preview-host/defaultApplicationChrome.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 type { ApplicationLogo } from '@cratis/scene.model';\nimport type { SceneElement } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { externalComponent } from '../gallery/elements';\nimport { SlotName } from '../layouts';\n\n/**\n * The chrome the application shell wraps every screen in when the model supplies navigation: a topbar and a sidebar. Neither\n * carries items - each shows the effective navigation of its region (`NavigationRegionView`), so inherit/extend/override\n * applies and nothing here knows the items. The logo is the application's (`navigation.application.logo`).\n *\n * @param logo The application's logo, when it has one.\n * @returns The slot content to give the shell.\n */\nexport function defaultApplicationChrome(logo?: ApplicationLogo): Record<string, SceneElement[]> {\n const slots: Record<string, SceneElement[]> = {};\n if (logo) {\n slots.logo = [externalComponent('topbar-logo', ComponentName.Logo, {\n label: logo.title,\n initials: logo.title.slice(0, 1).toUpperCase(),\n lightImageUrl: logo.image || undefined,\n targetScreen: '',\n })];\n }\n\n return {\n [SlotName.Topbar]: [externalComponent('topbar', ComponentName.Topbar, {}, slots)],\n [SlotName.Sidebar]: [externalComponent('sidebar', ComponentName.Sidebar, {})],\n };\n}\n"],"names":["defaultApplicationChrome","logo","slots","externalComponent","ComponentName","Logo","label","title","initials","slice","toUpperCase","lightImageUrl","image","undefined","targetScreen","SlotName","Topbar","Sidebar"],"mappings":";;;;;;;;AAAA;AACA;AAQA;;;;;;;IAQO,SAASA,wBAAAA,CAAyBC,IAAsB,EAAA;AAC3D,IAAA,MAAMC,QAAwC,EAAC;AAC/C,IAAA,IAAID,IAAAA,EAAM;AACNC,QAAAA,KAAAA,CAAMD,IAAI,GAAG;YAACE,iBAAAA,CAAkB,aAAA,EAAeC,aAAAA,CAAcC,IAAI,EAAE;AAC/DC,gBAAAA,KAAAA,EAAOL,KAAKM,KAAK;AACjBC,gBAAAA,QAAAA,EAAUP,KAAKM,KAAK,CAACE,KAAK,CAAC,CAAA,EAAG,GAAGC,WAAW,EAAA;gBAC5CC,aAAAA,EAAeV,IAAAA,CAAKW,KAAK,IAAIC,SAAAA;gBAC7BC,YAAAA,EAAc;AAClB,aAAA;AAAG,SAAA;AACP,IAAA;IAEA,OAAO;QACH,CAACC,QAAAA,CAASC,MAAM,GAAG;AAACb,YAAAA,iBAAAA,CAAkB,QAAA,EAAUC,aAAAA,CAAcY,MAAM,EAAE,EAAC,EAAGd,KAAAA;AAAO,SAAA;QACjF,CAACa,QAAAA,CAASE,OAAO,GAAG;AAACd,YAAAA,iBAAAA,CAAkB,SAAA,EAAWC,aAAAA,CAAca,OAAO,EAAE,EAAC;AAAG;AACjF,KAAA;AACJ;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ApplicationStructure, NavigationModel, Screen, SampleDataPack } from '@cratis/scene.model';
|
|
2
|
+
import { ApplicationStructureIndex } from '@cratis/scene.engine';
|
|
3
|
+
import { ApplicationDocument } from './ApplicationDocument';
|
|
4
|
+
import { CompositionOptions } from './composeApplication';
|
|
5
|
+
import { PreviewPlan } from './resolvePreviewPlan';
|
|
6
|
+
import { PreviewTarget } from './PreviewTarget';
|
|
7
|
+
import { PreviewProblem } from './PreviewProblem';
|
|
8
|
+
export interface PreviewDiagnosisInput {
|
|
9
|
+
document: ApplicationDocument;
|
|
10
|
+
structure: ApplicationStructure | ApplicationStructureIndex;
|
|
11
|
+
navigation?: NavigationModel;
|
|
12
|
+
target: PreviewTarget;
|
|
13
|
+
packs?: SampleDataPack[];
|
|
14
|
+
composition?: CompositionOptions;
|
|
15
|
+
}
|
|
16
|
+
export interface PreviewDiagnosis {
|
|
17
|
+
plan?: PreviewPlan;
|
|
18
|
+
screen?: Screen;
|
|
19
|
+
problems: PreviewProblem[];
|
|
20
|
+
}
|
|
21
|
+
export declare function diagnosePreview(input: PreviewDiagnosisInput): PreviewDiagnosis;
|
|
22
|
+
//# sourceMappingURL=diagnosePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosePreview.d.ts","sourceRoot":"","sources":["../../../preview-host/diagnosePreview.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAA0B,MAAM,qBAAqB,CAAC;AAC5H,OAAO,EACH,yBAAyB,EAE5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAA4C,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,WAAW,EAAsB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAA8C,MAAM,kBAAkB,CAAC;AAI9F,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,GAAG,yBAAyB,CAAC;IAC5D,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,MAAM,EAAE,aAAa,CAAC;IAGtB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IAGzB,WAAW,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAE7B,IAAI,CAAC,EAAE,WAAW,CAAC;IAGnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC9B;AAiBD,wBAAgB,eAAe,CAAC,KAAK,EAAE,qBAAqB,GAAG,gBAAgB,CA8C9E"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ApplicationStructureIndex, diagnoseNavigationRegions, collectComponents, toolbarButtonFromItem, validateToolbarButtons, validateSampleDataSelection, resolveScreenTemplates } from '@cratis/scene.engine';
|
|
2
|
+
import { findLayout, templatesOf, templatePoolFor } from './composeApplication.js';
|
|
3
|
+
import { resolvePreviewPlan } from './resolvePreviewPlan.js';
|
|
4
|
+
import { PreviewProblemSeverity, PreviewProblemCode } from './PreviewProblem.js';
|
|
5
|
+
import { previewProfile } from './previewProfile.js';
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
const make = (code, severity, message, nodeId)=>({
|
|
10
|
+
code,
|
|
11
|
+
severity,
|
|
12
|
+
message,
|
|
13
|
+
...nodeId === undefined ? {} : {
|
|
14
|
+
nodeId
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Finds what would break or mislead a preview before it renders (PRV8), using the same engine validators the editor and the
|
|
19
|
+
* compiler use - nothing is judged here that the engine does not already judge:
|
|
20
|
+
*
|
|
21
|
+
* - the target must be in the structure, and a module must have a feature;
|
|
22
|
+
* - the page - the screen named by the target's feature - must exist, with a layout and a template that can be found and placed;
|
|
23
|
+
* - navigation (`diagnoseNavigationRegions`), toolbar buttons (`validateToolbarButtons`, whatever their severity), the structure's own
|
|
24
|
+
* ids and the sample data selection are reported as warnings: the preview still renders, an item or button just will not behave
|
|
25
|
+
* as authored.
|
|
26
|
+
*
|
|
27
|
+
* Errors block the preview - it shows these instead of a blank screen; the node id is what the host links to.
|
|
28
|
+
*/ function diagnosePreview(input) {
|
|
29
|
+
const index = input.structure instanceof ApplicationStructureIndex ? input.structure : new ApplicationStructureIndex(input.structure);
|
|
30
|
+
const options = input.composition ?? {};
|
|
31
|
+
const problems = [];
|
|
32
|
+
for (const diagnostic of index.diagnostics){
|
|
33
|
+
problems.push(make(PreviewProblemCode.StructureInvalid, PreviewProblemSeverity.Warning, diagnostic.message, diagnostic.id));
|
|
34
|
+
}
|
|
35
|
+
const { plan, problems: targetProblems } = resolvePreviewPlan(index, input.target);
|
|
36
|
+
problems.push(...targetProblems);
|
|
37
|
+
let screen;
|
|
38
|
+
if (plan?.feature !== undefined) {
|
|
39
|
+
screen = input.document.screens.find((candidate)=>candidate.name === plan.feature);
|
|
40
|
+
// A slice is previewed over a minimal host page when its feature has no screen; a module or feature has nothing to show without one.
|
|
41
|
+
if (!screen && plan.slice === undefined) {
|
|
42
|
+
problems.push(make(PreviewProblemCode.ScreenMissing, PreviewProblemSeverity.Error, `The feature '${plan.feature}' has no screen in the document, so there is nothing to render.`, plan.feature));
|
|
43
|
+
} else if (screen) {
|
|
44
|
+
problems.push(...diagnoseScreen(input.document, screen, options));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (input.navigation) {
|
|
48
|
+
for (const diagnostic of diagnoseNavigationRegions(index, input.navigation)){
|
|
49
|
+
problems.push(make(PreviewProblemCode.NavigationInvalid, PreviewProblemSeverity.Warning, diagnostic.message, diagnostic.entry));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const buttons = input.document.screens.flatMap((candidate)=>collectComponents(candidate).filter((component)=>component.componentName.endsWith('toolbarItem')).map((component)=>toolbarButtonFromItem(component.id, component.properties)).filter((button)=>button !== undefined));
|
|
53
|
+
const toolbar = {
|
|
54
|
+
buttons
|
|
55
|
+
};
|
|
56
|
+
for (const diagnostic of validateToolbarButtons(index, toolbar)){
|
|
57
|
+
problems.push(make(PreviewProblemCode.ToolbarInvalid, PreviewProblemSeverity.Warning, diagnostic.message, diagnostic.button));
|
|
58
|
+
}
|
|
59
|
+
const selection = previewProfile(input.document.uiProfiles).sampleData;
|
|
60
|
+
if (selection) {
|
|
61
|
+
for (const message of validateSampleDataSelection(selection, input.packs ?? [])){
|
|
62
|
+
problems.push(make(PreviewProblemCode.SampleDataInvalid, PreviewProblemSeverity.Warning, message));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
plan,
|
|
67
|
+
screen,
|
|
68
|
+
problems
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function diagnoseScreen(document, screen, options) {
|
|
72
|
+
const problems = [];
|
|
73
|
+
const layout = findLayout(document, screen.layout, options);
|
|
74
|
+
if (!layout) {
|
|
75
|
+
problems.push(make(PreviewProblemCode.LayoutMissing, PreviewProblemSeverity.Error, `The screen '${screen.name}' uses the layout '${screen.layout}', which neither the document nor the blueprint provides.`, screen.name));
|
|
76
|
+
}
|
|
77
|
+
if (screen.screenTemplate === undefined) return problems;
|
|
78
|
+
const templates = templatesOf(document, options);
|
|
79
|
+
if (!templates.some((candidate)=>candidate.name === screen.screenTemplate)) {
|
|
80
|
+
problems.push(make(PreviewProblemCode.TemplateMissing, PreviewProblemSeverity.Error, `The screen '${screen.name}' uses the template '${screen.screenTemplate}', which neither the document nor the blueprint provides.`, screen.name));
|
|
81
|
+
return problems;
|
|
82
|
+
}
|
|
83
|
+
if (layout) {
|
|
84
|
+
const resolution = resolveScreenTemplates(layout, templatePoolFor(document, screen, options));
|
|
85
|
+
const unplaced = resolution.unplaced.find((candidate)=>candidate.template === screen.screenTemplate);
|
|
86
|
+
if (unplaced) {
|
|
87
|
+
problems.push(make(PreviewProblemCode.TemplateUnplaced, PreviewProblemSeverity.Error, `The template '${unplaced.template}' fits the slot '${unplaced.slot}', which ${unplaced.candidates.length === 0 ? 'nothing declares' : `${unplaced.candidates.join(' and ')} all declare`}.`, unplaced.template));
|
|
88
|
+
}
|
|
89
|
+
const cycle = resolution.cycles.find((candidate)=>candidate.includes(screen.screenTemplate));
|
|
90
|
+
if (cycle) {
|
|
91
|
+
problems.push(make(PreviewProblemCode.TemplateUnplaced, PreviewProblemSeverity.Error, `The template '${screen.screenTemplate}' nests inside itself (${cycle.join(' → ')}).`, screen.screenTemplate));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return problems;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { diagnosePreview };
|
|
98
|
+
//# sourceMappingURL=diagnosePreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosePreview.js","sources":["../../../preview-host/diagnosePreview.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 { ApplicationStructure, NavigationModel, Screen, SampleDataPack, Toolbar, ToolbarButton } from '@cratis/scene.model';\nimport {\n ApplicationStructureIndex, collectComponents, diagnoseNavigationRegions, resolveScreenTemplates,\n toolbarButtonFromItem, validateSampleDataSelection, validateToolbarButtons,\n} from '@cratis/scene.engine';\nimport { ApplicationDocument } from './ApplicationDocument';\nimport { CompositionOptions, findLayout, templatePoolFor, templatesOf } from './composeApplication';\nimport { PreviewPlan, resolvePreviewPlan } from './resolvePreviewPlan';\nimport { PreviewTarget } from './PreviewTarget';\nimport { PreviewProblem, PreviewProblemCode, PreviewProblemSeverity } from './PreviewProblem';\nimport { previewProfile } from './previewProfile';\n\n/** What {@link diagnosePreview} reads. */\nexport interface PreviewDiagnosisInput {\n document: ApplicationDocument;\n structure: ApplicationStructure | ApplicationStructureIndex;\n navigation?: NavigationModel;\n target: PreviewTarget;\n\n /** The packs available, for checking the profile's sample data selection. */\n packs?: SampleDataPack[];\n\n /** The composition options the host renders with, for the blueprint's layouts and templates. */\n composition?: CompositionOptions;\n}\n\nexport interface PreviewDiagnosis {\n /** The plan the target resolved to; absent when it did not resolve. */\n plan?: PreviewPlan;\n\n /** The screen the preview's page is, when the plan has a feature. */\n screen?: Screen;\n\n problems: PreviewProblem[];\n}\n\nconst make = (code: PreviewProblemCode, severity: PreviewProblemSeverity, message: string, nodeId?: string): PreviewProblem =>\n ({ code, severity, message, ...(nodeId === undefined ? {} : { nodeId }) });\n\n/**\n * Finds what would break or mislead a preview before it renders (PRV8), using the same engine validators the editor and the\n * compiler use - nothing is judged here that the engine does not already judge:\n *\n * - the target must be in the structure, and a module must have a feature;\n * - the page - the screen named by the target's feature - must exist, with a layout and a template that can be found and placed;\n * - navigation (`diagnoseNavigationRegions`), toolbar buttons (`validateToolbarButtons`, whatever their severity), the structure's own\n * ids and the sample data selection are reported as warnings: the preview still renders, an item or button just will not behave\n * as authored.\n *\n * Errors block the preview - it shows these instead of a blank screen; the node id is what the host links to.\n */\nexport function diagnosePreview(input: PreviewDiagnosisInput): PreviewDiagnosis {\n const index = input.structure instanceof ApplicationStructureIndex ? input.structure : new ApplicationStructureIndex(input.structure);\n const options = input.composition ?? {};\n const problems: PreviewProblem[] = [];\n\n for (const diagnostic of index.diagnostics) {\n problems.push(make(PreviewProblemCode.StructureInvalid, PreviewProblemSeverity.Warning, diagnostic.message, diagnostic.id));\n }\n\n const { plan, problems: targetProblems } = resolvePreviewPlan(index, input.target);\n problems.push(...targetProblems);\n\n let screen: Screen | undefined;\n if (plan?.feature !== undefined) {\n screen = input.document.screens.find(candidate => candidate.name === plan.feature);\n // A slice is previewed over a minimal host page when its feature has no screen; a module or feature has nothing to show without one.\n if (!screen && plan.slice === undefined) {\n problems.push(make(PreviewProblemCode.ScreenMissing, PreviewProblemSeverity.Error, `The feature '${plan.feature}' has no screen in the document, so there is nothing to render.`, plan.feature));\n } else if (screen) {\n problems.push(...diagnoseScreen(input.document, screen, options));\n }\n }\n\n if (input.navigation) {\n for (const diagnostic of diagnoseNavigationRegions(index, input.navigation)) {\n problems.push(make(PreviewProblemCode.NavigationInvalid, PreviewProblemSeverity.Warning, diagnostic.message, diagnostic.entry));\n }\n }\n\n const buttons = input.document.screens.flatMap(candidate => collectComponents(candidate)\n .filter(component => component.componentName.endsWith('toolbarItem'))\n .map(component => toolbarButtonFromItem(component.id, component.properties as Record<string, unknown>))\n .filter((button): button is ToolbarButton => button !== undefined));\n const toolbar: Toolbar = { buttons };\n for (const diagnostic of validateToolbarButtons(index, toolbar)) {\n problems.push(make(PreviewProblemCode.ToolbarInvalid, PreviewProblemSeverity.Warning, diagnostic.message, diagnostic.button));\n }\n\n const selection = previewProfile(input.document.uiProfiles).sampleData;\n if (selection) {\n for (const message of validateSampleDataSelection(selection, input.packs ?? [])) {\n problems.push(make(PreviewProblemCode.SampleDataInvalid, PreviewProblemSeverity.Warning, message));\n }\n }\n\n return { plan, screen, problems };\n}\n\nfunction diagnoseScreen(document: ApplicationDocument, screen: Screen, options: CompositionOptions): PreviewProblem[] {\n const problems: PreviewProblem[] = [];\n const layout = findLayout(document, screen.layout, options);\n if (!layout) {\n problems.push(make(PreviewProblemCode.LayoutMissing, PreviewProblemSeverity.Error, `The screen '${screen.name}' uses the layout '${screen.layout}', which neither the document nor the blueprint provides.`, screen.name));\n }\n\n if (screen.screenTemplate === undefined) return problems;\n\n const templates = templatesOf(document, options);\n if (!templates.some(candidate => candidate.name === screen.screenTemplate)) {\n problems.push(make(PreviewProblemCode.TemplateMissing, PreviewProblemSeverity.Error, `The screen '${screen.name}' uses the template '${screen.screenTemplate}', which neither the document nor the blueprint provides.`, screen.name));\n return problems;\n }\n\n if (layout) {\n const resolution = resolveScreenTemplates(layout, templatePoolFor(document, screen, options));\n const unplaced = resolution.unplaced.find(candidate => candidate.template === screen.screenTemplate);\n if (unplaced) {\n problems.push(make(PreviewProblemCode.TemplateUnplaced, PreviewProblemSeverity.Error, `The template '${unplaced.template}' fits the slot '${unplaced.slot}', which ${unplaced.candidates.length === 0 ? 'nothing declares' : `${unplaced.candidates.join(' and ')} all declare`}.`, unplaced.template));\n }\n\n const cycle = resolution.cycles.find(candidate => candidate.includes(screen.screenTemplate!));\n if (cycle) {\n problems.push(make(PreviewProblemCode.TemplateUnplaced, PreviewProblemSeverity.Error, `The template '${screen.screenTemplate}' nests inside itself (${cycle.join(' → ')}).`, screen.screenTemplate));\n }\n }\n\n return problems;\n}\n"],"names":["make","code","severity","message","nodeId","undefined","diagnosePreview","input","index","structure","ApplicationStructureIndex","options","composition","problems","diagnostic","diagnostics","push","PreviewProblemCode","StructureInvalid","PreviewProblemSeverity","Warning","id","plan","targetProblems","resolvePreviewPlan","target","screen","feature","document","screens","find","candidate","name","slice","ScreenMissing","Error","diagnoseScreen","navigation","diagnoseNavigationRegions","NavigationInvalid","entry","buttons","flatMap","collectComponents","filter","component","componentName","endsWith","map","toolbarButtonFromItem","properties","button","toolbar","validateToolbarButtons","ToolbarInvalid","selection","previewProfile","uiProfiles","sampleData","validateSampleDataSelection","packs","SampleDataInvalid","layout","findLayout","LayoutMissing","screenTemplate","templates","templatesOf","some","TemplateMissing","resolution","resolveScreenTemplates","templatePoolFor","unplaced","template","TemplateUnplaced","slot","candidates","length","join","cycle","cycles","includes"],"mappings":";;;;;;AAAA;AACA;AAsCA,MAAMA,OAAO,CAACC,IAAAA,EAA0BC,QAAAA,EAAkCC,OAAAA,EAAiBC,UACtF;AAAEH,QAAAA,IAAAA;AAAMC,QAAAA,QAAAA;AAAUC,QAAAA,OAAAA;QAAS,GAAIC,MAAAA,KAAWC,SAAAA,GAAY,EAAC,GAAI;AAAED,YAAAA;;KAAU,CAAA;AAE5E;;;;;;;;;;;IAYO,SAASE,eAAAA,CAAgBC,KAA4B,EAAA;IACxD,MAAMC,KAAAA,GAAQD,KAAAA,CAAME,SAAS,YAAYC,yBAAAA,GAA4BH,KAAAA,CAAME,SAAS,GAAG,IAAIC,yBAAAA,CAA0BH,KAAAA,CAAME,SAAS,CAAA;AACpI,IAAA,MAAME,OAAAA,GAAUJ,KAAAA,CAAMK,WAAW,IAAI,EAAC;AACtC,IAAA,MAAMC,WAA6B,EAAE;AAErC,IAAA,KAAK,MAAMC,UAAAA,IAAcN,KAAAA,CAAMO,WAAW,CAAE;AACxCF,QAAAA,QAAAA,CAASG,IAAI,CAAChB,IAAAA,CAAKiB,kBAAAA,CAAmBC,gBAAgB,EAAEC,sBAAAA,CAAuBC,OAAO,EAAEN,UAAAA,CAAWX,OAAO,EAAEW,WAAWO,EAAE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
+
export * from './previewProfile';
|
|
5
|
+
export * from './defaultApplicationChrome';
|
|
6
|
+
export * from './FlowArrangementView';
|
|
7
|
+
export * from './useSizeClass';
|
|
8
|
+
export * from './PreviewTemplate';
|
|
9
|
+
export * from './composeApplication';
|
|
10
|
+
export * from './resolvePreviewPlan';
|
|
11
|
+
export * from './diagnosePreview';
|
|
12
|
+
export * from './previewSampleData';
|
|
13
|
+
export * from './PreviewSliceFragment';
|
|
14
|
+
export * from './PreviewToast';
|
|
15
|
+
export * from './PreviewProblemsView';
|
|
16
|
+
export * from './ApplicationHost';
|
|
17
|
+
export * from './ScenePreviewHost';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../preview-host/index.ts"],"names":[],"mappings":"AAGA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './PreviewTarget';
|
|
2
|
+
export * from './PreviewProblem';
|
|
3
|
+
export * from './ApplicationDocument';
|
|
4
|
+
export * from './previewProfile';
|
|
5
|
+
export * from './defaultApplicationChrome';
|
|
6
|
+
export * from './FlowArrangementView';
|
|
7
|
+
export * from './useSizeClass';
|
|
8
|
+
export * from './PreviewTemplate';
|
|
9
|
+
export * from './composeApplication';
|
|
10
|
+
export * from './resolvePreviewPlan';
|
|
11
|
+
export * from './diagnosePreview';
|
|
12
|
+
export * from './previewSampleData';
|
|
13
|
+
export * from './PreviewSliceFragment';
|
|
14
|
+
export * from './PreviewToast';
|
|
15
|
+
export * from './PreviewProblemsView';
|
|
16
|
+
export * from './ApplicationHost';
|
|
17
|
+
export * from './ScenePreviewHost';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../preview-host/index.ts"],"names":[],"mappings":"AAGA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UiProfile } from '@cratis/scene.model';
|
|
2
|
+
import type { PackageCatalog } from '@cratis/scene.engine';
|
|
3
|
+
export declare const requiredPackages: string[];
|
|
4
|
+
export declare const blueprintPackageCatalog: PackageCatalog;
|
|
5
|
+
export declare function previewProfile(profiles: UiProfile[] | undefined, additionalPackages?: string[]): UiProfile;
|
|
6
|
+
//# sourceMappingURL=previewProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previewProfile.d.ts","sourceRoot":"","sources":["../../../preview-host/previewProfile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D,eAAO,MAAM,gBAAgB,UAAiC,CAAC;AAG/D,eAAO,MAAM,uBAAuB,EAAE,cAGrC,CAAC;AAcF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,kBAAkB,GAAE,MAAM,EAAO,GAAG,SAAS,CAgB9G"}
|