@cratis/scene.model 4.25.0 → 4.27.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/descriptors/CollectionOperation.ts +6 -0
- package/dist/cjs/descriptors/CollectionOperation.js +4 -0
- package/dist/cjs/descriptors/CollectionOperation.js.map +1 -1
- package/dist/cjs/exposure/InstanceContribution.js +2 -1
- package/dist/cjs/exposure/InstanceContribution.js.map +1 -1
- package/dist/cjs/index.js +34 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/ApplicationLogo.js +13 -0
- package/dist/cjs/navigation/ApplicationLogo.js.map +1 -0
- package/dist/cjs/navigation/ApplicationNavigation.js +11 -0
- package/dist/cjs/navigation/ApplicationNavigation.js.map +1 -0
- package/dist/cjs/navigation/ModuleNavigation.js +11 -0
- package/dist/cjs/navigation/ModuleNavigation.js.map +1 -0
- package/dist/cjs/navigation/NavItem.js +15 -0
- package/dist/cjs/navigation/NavItem.js.map +1 -0
- package/dist/cjs/navigation/NavigationModel.js +11 -0
- package/dist/cjs/navigation/NavigationModel.js.map +1 -0
- package/dist/cjs/navigation/NavigationRegion.js +12 -0
- package/dist/cjs/navigation/NavigationRegion.js.map +1 -0
- package/dist/cjs/navigation/NavigationRegionKind.js +14 -0
- package/dist/cjs/navigation/NavigationRegionKind.js.map +1 -0
- package/dist/cjs/navigation/NavigationRegionMode.js +15 -0
- package/dist/cjs/navigation/NavigationRegionMode.js.map +1 -0
- package/dist/cjs/packages/ScenePackage.js +2 -1
- package/dist/cjs/packages/ScenePackage.js.map +1 -1
- package/dist/cjs/profiles/UiProfile.js +2 -1
- package/dist/cjs/profiles/UiProfile.js.map +1 -1
- package/dist/cjs/sampleData/SampleDataBinding.js +13 -0
- package/dist/cjs/sampleData/SampleDataBinding.js.map +1 -0
- package/dist/cjs/sampleData/SampleDataMapping.js +13 -0
- package/dist/cjs/sampleData/SampleDataMapping.js.map +1 -0
- package/dist/cjs/sampleData/SampleDataPack.js +14 -0
- package/dist/cjs/sampleData/SampleDataPack.js.map +1 -0
- package/dist/cjs/sampleData/SampleDataPackReference.js +16 -0
- package/dist/cjs/sampleData/SampleDataPackReference.js.map +1 -0
- package/dist/cjs/sampleData/SampleDataSelection.js +12 -0
- package/dist/cjs/sampleData/SampleDataSelection.js.map +1 -0
- package/dist/cjs/sampleData/SampleDataSet.js +13 -0
- package/dist/cjs/sampleData/SampleDataSet.js.map +1 -0
- package/dist/cjs/sampleData/SampleFieldKind.js +27 -0
- package/dist/cjs/sampleData/SampleFieldKind.js.map +1 -0
- package/dist/cjs/sampleData/SampleShape.js +11 -0
- package/dist/cjs/sampleData/SampleShape.js.map +1 -0
- package/dist/cjs/sampleData/SampleShapeField.js +16 -0
- package/dist/cjs/sampleData/SampleShapeField.js.map +1 -0
- package/dist/esm/descriptors/CollectionOperation.d.ts +2 -1
- package/dist/esm/descriptors/CollectionOperation.d.ts.map +1 -1
- package/dist/esm/descriptors/CollectionOperation.js +4 -0
- package/dist/esm/descriptors/CollectionOperation.js.map +1 -1
- package/dist/esm/exposure/InstanceContribution.d.ts +1 -0
- package/dist/esm/exposure/InstanceContribution.d.ts.map +1 -1
- package/dist/esm/exposure/InstanceContribution.js +2 -1
- package/dist/esm/exposure/InstanceContribution.js.map +1 -1
- package/dist/esm/index.d.ts +2 -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/navigation/ApplicationLogo.d.ts +6 -0
- package/dist/esm/navigation/ApplicationLogo.d.ts.map +1 -0
- package/dist/esm/navigation/ApplicationLogo.js +11 -0
- package/dist/esm/navigation/ApplicationLogo.js.map +1 -0
- package/dist/esm/navigation/ApplicationNavigation.d.ts +8 -0
- package/dist/esm/navigation/ApplicationNavigation.d.ts.map +1 -0
- package/dist/esm/navigation/ApplicationNavigation.js +9 -0
- package/dist/esm/navigation/ApplicationNavigation.js.map +1 -0
- package/dist/esm/navigation/ModuleNavigation.d.ts +7 -0
- package/dist/esm/navigation/ModuleNavigation.d.ts.map +1 -0
- package/dist/esm/navigation/ModuleNavigation.js +9 -0
- package/dist/esm/navigation/ModuleNavigation.js.map +1 -0
- package/dist/esm/navigation/NavItem.d.ts +11 -0
- package/dist/esm/navigation/NavItem.d.ts.map +1 -0
- package/dist/esm/navigation/NavItem.js +13 -0
- package/dist/esm/navigation/NavItem.js.map +1 -0
- package/dist/esm/navigation/NavigationModel.d.ts +8 -0
- package/dist/esm/navigation/NavigationModel.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationModel.js +9 -0
- package/dist/esm/navigation/NavigationModel.js.map +1 -0
- package/dist/esm/navigation/NavigationRegion.d.ts +10 -0
- package/dist/esm/navigation/NavigationRegion.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationRegion.js +10 -0
- package/dist/esm/navigation/NavigationRegion.js.map +1 -0
- package/dist/esm/navigation/NavigationRegionKind.d.ts +5 -0
- package/dist/esm/navigation/NavigationRegionKind.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationRegionKind.js +12 -0
- package/dist/esm/navigation/NavigationRegionKind.js.map +1 -0
- package/dist/esm/navigation/NavigationRegionMode.d.ts +6 -0
- package/dist/esm/navigation/NavigationRegionMode.d.ts.map +1 -0
- package/dist/esm/navigation/NavigationRegionMode.js +13 -0
- package/dist/esm/navigation/NavigationRegionMode.js.map +1 -0
- package/dist/esm/navigation/index.d.ts +9 -0
- package/dist/esm/navigation/index.d.ts.map +1 -0
- package/dist/esm/navigation/index.js +9 -0
- package/dist/esm/navigation/index.js.map +1 -0
- package/dist/esm/packages/ScenePackage.d.ts +2 -0
- package/dist/esm/packages/ScenePackage.d.ts.map +1 -1
- package/dist/esm/packages/ScenePackage.js +2 -1
- package/dist/esm/packages/ScenePackage.js.map +1 -1
- package/dist/esm/profiles/UiProfile.d.ts +2 -0
- package/dist/esm/profiles/UiProfile.d.ts.map +1 -1
- package/dist/esm/profiles/UiProfile.js +2 -1
- package/dist/esm/profiles/UiProfile.js.map +1 -1
- package/dist/esm/sampleData/SampleDataBinding.d.ts +6 -0
- package/dist/esm/sampleData/SampleDataBinding.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleDataBinding.js +11 -0
- package/dist/esm/sampleData/SampleDataBinding.js.map +1 -0
- package/dist/esm/sampleData/SampleDataMapping.d.ts +6 -0
- package/dist/esm/sampleData/SampleDataMapping.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleDataMapping.js +11 -0
- package/dist/esm/sampleData/SampleDataMapping.js.map +1 -0
- package/dist/esm/sampleData/SampleDataPack.d.ts +10 -0
- package/dist/esm/sampleData/SampleDataPack.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleDataPack.js +12 -0
- package/dist/esm/sampleData/SampleDataPack.js.map +1 -0
- package/dist/esm/sampleData/SampleDataPackReference.d.ts +8 -0
- package/dist/esm/sampleData/SampleDataPackReference.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleDataPackReference.js +14 -0
- package/dist/esm/sampleData/SampleDataPackReference.js.map +1 -0
- package/dist/esm/sampleData/SampleDataSelection.d.ts +9 -0
- package/dist/esm/sampleData/SampleDataSelection.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleDataSelection.js +10 -0
- package/dist/esm/sampleData/SampleDataSelection.js.map +1 -0
- package/dist/esm/sampleData/SampleDataSet.d.ts +6 -0
- package/dist/esm/sampleData/SampleDataSet.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleDataSet.js +11 -0
- package/dist/esm/sampleData/SampleDataSet.js.map +1 -0
- package/dist/esm/sampleData/SampleFieldKind.d.ts +16 -0
- package/dist/esm/sampleData/SampleFieldKind.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleFieldKind.js +25 -0
- package/dist/esm/sampleData/SampleFieldKind.js.map +1 -0
- package/dist/esm/sampleData/SampleShape.d.ts +7 -0
- package/dist/esm/sampleData/SampleShape.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleShape.js +9 -0
- package/dist/esm/sampleData/SampleShape.js.map +1 -0
- package/dist/esm/sampleData/SampleShapeField.d.ts +12 -0
- package/dist/esm/sampleData/SampleShapeField.d.ts.map +1 -0
- package/dist/esm/sampleData/SampleShapeField.js +14 -0
- package/dist/esm/sampleData/SampleShapeField.js.map +1 -0
- package/dist/esm/sampleData/index.d.ts +10 -0
- package/dist/esm/sampleData/index.d.ts.map +1 -0
- package/dist/esm/sampleData/index.js +10 -0
- package/dist/esm/sampleData/index.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/exposure/InstanceContribution.ts +8 -1
- package/index.ts +2 -0
- package/navigation/ApplicationLogo.ts +15 -0
- package/navigation/ApplicationNavigation.ts +18 -0
- package/navigation/ModuleNavigation.ts +17 -0
- package/navigation/NavItem.ts +32 -0
- package/navigation/NavigationModel.ts +18 -0
- package/navigation/NavigationRegion.ts +25 -0
- package/navigation/NavigationRegionKind.ts +13 -0
- package/navigation/NavigationRegionMode.ts +16 -0
- package/navigation/index.ts +11 -0
- package/package.json +1 -1
- package/packages/ScenePackage.ts +8 -0
- package/profiles/UiProfile.ts +10 -0
- package/sampleData/SampleDataBinding.ts +15 -0
- package/sampleData/SampleDataMapping.ts +15 -0
- package/sampleData/SampleDataPack.ts +27 -0
- package/sampleData/SampleDataPackReference.ts +22 -0
- package/sampleData/SampleDataSelection.ts +24 -0
- package/sampleData/SampleDataSet.ts +15 -0
- package/sampleData/SampleFieldKind.ts +48 -0
- package/sampleData/SampleShape.ts +18 -0
- package/sampleData/SampleShapeField.ts +33 -0
- package/sampleData/index.ts +12 -0
|
@@ -31,6 +31,13 @@ export interface InstanceContribution {
|
|
|
31
31
|
|
|
32
32
|
/** The items a collection property gets from this instance, in order. */
|
|
33
33
|
items?: ContributedItem[];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* For a collection: hide the items the owner and the levels above put in it, so only this instance's own items
|
|
37
|
+
* remain. The hidden items stay where they are and come back when this is cleared. It needs the `replace`
|
|
38
|
+
* operation to be exposed.
|
|
39
|
+
*/
|
|
40
|
+
replaceOwnerItems?: boolean;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
export const InstanceContributionPropertyNames: (keyof InstanceContribution)[] = ['instance', 'component', 'path', 'value', 'items'];
|
|
43
|
+
export const InstanceContributionPropertyNames: (keyof InstanceContribution)[] = ['instance', 'component', 'path', 'value', 'items', 'replaceOwnerItems'];
|
package/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './contributionPoints';
|
|
|
10
10
|
export * from './profiles';
|
|
11
11
|
export * from './icons';
|
|
12
12
|
export * from './packages';
|
|
13
|
+
export * from './sampleData';
|
|
13
14
|
export * from './interactions';
|
|
14
15
|
export * from './screens';
|
|
15
16
|
export * from './starters';
|
|
@@ -18,3 +19,4 @@ export * from './descriptors';
|
|
|
18
19
|
export * from './exposure';
|
|
19
20
|
export * from './editing';
|
|
20
21
|
export * from './structure';
|
|
22
|
+
export * from './navigation';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The application's logo. It is defined at the application level only; a module shows it locked.
|
|
6
|
+
*/
|
|
7
|
+
export interface ApplicationLogo {
|
|
8
|
+
/** The image reference. */
|
|
9
|
+
image: string;
|
|
10
|
+
|
|
11
|
+
/** The application name shown with or instead of the image. */
|
|
12
|
+
title: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const ApplicationLogoPropertyNames: (keyof ApplicationLogo)[] = ['image', 'title'];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ApplicationLogo } from './ApplicationLogo';
|
|
5
|
+
import { NavigationRegion } from './NavigationRegion';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The application-level navigation: the base every module inherits, extends or overrides.
|
|
9
|
+
*/
|
|
10
|
+
export interface ApplicationNavigation {
|
|
11
|
+
/** The regions the application defines items for. */
|
|
12
|
+
regions: NavigationRegion[];
|
|
13
|
+
|
|
14
|
+
/** The application logo. */
|
|
15
|
+
logo?: ApplicationLogo;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ApplicationNavigationPropertyNames: (keyof ApplicationNavigation)[] = ['regions', 'logo'];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { NavigationRegion } from './NavigationRegion';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The navigation a module declares for the regions it changes. A region it does not declare inherits the application's.
|
|
8
|
+
*/
|
|
9
|
+
export interface ModuleNavigation {
|
|
10
|
+
/** The module identity. */
|
|
11
|
+
module: string;
|
|
12
|
+
|
|
13
|
+
/** The regions the module changes. */
|
|
14
|
+
regions: NavigationRegion[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ModuleNavigationPropertyNames: (keyof ModuleNavigation)[] = ['module', 'regions'];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { DestinationReference } from '../common';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One item of a navigation region.
|
|
8
|
+
*/
|
|
9
|
+
export interface NavItem {
|
|
10
|
+
/** The item identity, unique in its region at the level that owns it. */
|
|
11
|
+
id: string;
|
|
12
|
+
|
|
13
|
+
/** The text shown for the item. */
|
|
14
|
+
title: string;
|
|
15
|
+
|
|
16
|
+
/** Qualified icon reference, when the item has one. */
|
|
17
|
+
icon?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* What the item navigates to: `module`, and optionally `feature` (a dotted path inside the module). A module
|
|
21
|
+
* without a feature goes to the module's first feature.
|
|
22
|
+
*/
|
|
23
|
+
target?: DestinationReference;
|
|
24
|
+
|
|
25
|
+
/** The rendering slot - an outlet id - the target renders into; `content`, the primary outlet, when absent. */
|
|
26
|
+
slot?: string;
|
|
27
|
+
|
|
28
|
+
/** The sub-items; only a sidebar item has them. */
|
|
29
|
+
children?: NavItem[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const NavItemPropertyNames: (keyof NavItem)[] = ['id', 'title', 'icon', 'target', 'slot', 'children'];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ApplicationNavigation } from './ApplicationNavigation';
|
|
5
|
+
import { ModuleNavigation } from './ModuleNavigation';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* All the navigation an application declares: its own regions and the regions each module changes.
|
|
9
|
+
*/
|
|
10
|
+
export interface NavigationModel {
|
|
11
|
+
/** The application-level navigation. */
|
|
12
|
+
application: ApplicationNavigation;
|
|
13
|
+
|
|
14
|
+
/** The per-module navigation; a module that is not listed inherits everything. */
|
|
15
|
+
modules: ModuleNavigation[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const NavigationModelPropertyNames: (keyof NavigationModel)[] = ['application', 'modules'];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { NavigationRegionKind } from './NavigationRegionKind';
|
|
5
|
+
import { NavigationRegionMode } from './NavigationRegionMode';
|
|
6
|
+
import { NavItem } from './NavItem';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The items one level (the application or a module) defines for one navigation region.
|
|
10
|
+
*/
|
|
11
|
+
export interface NavigationRegion {
|
|
12
|
+
/** Which region the items belong to. */
|
|
13
|
+
region: NavigationRegionKind;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* How a module's items relate to the application's. Absent at the application level, which is the base, and
|
|
17
|
+
* meaning `inherit` at a module.
|
|
18
|
+
*/
|
|
19
|
+
mode?: NavigationRegionMode;
|
|
20
|
+
|
|
21
|
+
/** The items, in order. */
|
|
22
|
+
items: NavItem[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const NavigationRegionPropertyNames: (keyof NavigationRegion)[] = ['region', 'mode', 'items'];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The navigation regions an application shell has.
|
|
6
|
+
*/
|
|
7
|
+
export enum NavigationRegionKind {
|
|
8
|
+
/** The flat strip along the top. */
|
|
9
|
+
Topbar = 'topbar',
|
|
10
|
+
|
|
11
|
+
/** The side list, whose items may have sub-items. */
|
|
12
|
+
Sidebar = 'sidebar',
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How a module's region relates to the application's items for the same region.
|
|
6
|
+
*/
|
|
7
|
+
export enum NavigationRegionMode {
|
|
8
|
+
/** Effective items are the application items; the module's own items are cleared. */
|
|
9
|
+
Inherit = 'inherit',
|
|
10
|
+
|
|
11
|
+
/** Effective items are the application items followed by the module's items. */
|
|
12
|
+
Extend = 'extend',
|
|
13
|
+
|
|
14
|
+
/** Effective items are the module's items only. */
|
|
15
|
+
Override = 'override',
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
export * from './NavigationRegionKind';
|
|
5
|
+
export * from './NavigationRegionMode';
|
|
6
|
+
export * from './NavItem';
|
|
7
|
+
export * from './NavigationRegion';
|
|
8
|
+
export * from './ApplicationLogo';
|
|
9
|
+
export * from './ApplicationNavigation';
|
|
10
|
+
export * from './ModuleNavigation';
|
|
11
|
+
export * from './NavigationModel';
|
package/package.json
CHANGED
package/packages/ScenePackage.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { PackageDesignTimeMetadata } from '../descriptors';
|
|
5
5
|
import { IconLibrary } from '../icons';
|
|
6
6
|
import { PackageDependency } from './PackageDependency';
|
|
7
|
+
import { SampleDataPackReference } from '../sampleData';
|
|
7
8
|
import { PackageKind } from './PackageKind';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -102,6 +103,12 @@ export interface ScenePackage {
|
|
|
102
103
|
|
|
103
104
|
/** Runtime singleton dependency names that must not be duplicated across approved bundles. */
|
|
104
105
|
runtimeSingletons?: string[];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The sample-data packs this package ships (`sampleData/*.json`). Design and preview time only: a
|
|
109
|
+
* Stage production build never includes or resolves them.
|
|
110
|
+
*/
|
|
111
|
+
sampleData?: SampleDataPackReference[];
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
export const ScenePackagePropertyNames: (keyof ScenePackage)[] = [
|
|
@@ -123,4 +130,5 @@ export const ScenePackagePropertyNames: (keyof ScenePackage)[] = [
|
|
|
123
130
|
'designTime',
|
|
124
131
|
'assets',
|
|
125
132
|
'runtimeSingletons',
|
|
133
|
+
'sampleData',
|
|
126
134
|
];
|
package/profiles/UiProfile.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
import { SampleDataSelection } from '../sampleData';
|
|
4
5
|
import { TargetSizeClass } from '../sizeClasses';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -46,6 +47,14 @@ export interface UiProfile {
|
|
|
46
47
|
* meaningful relative to a set of packages, which is why it is chosen here rather than by a screen.
|
|
47
48
|
*/
|
|
48
49
|
theme?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Which sample data the application previews with at design and preview time: the active pack, chosen
|
|
53
|
+
* once here for the whole application (own or from a blueprint), plus the rare shape-to-read-model
|
|
54
|
+
* mappings and per-read-model pack bindings. Never stated by a screen, slice or component, and never
|
|
55
|
+
* part of a production build. Absent selects the blueprint's default pack, then generated data.
|
|
56
|
+
*/
|
|
57
|
+
sampleData?: SampleDataSelection;
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
export const UiProfilePropertyNames: (keyof UiProfile)[] = [
|
|
@@ -55,4 +64,5 @@ export const UiProfilePropertyNames: (keyof UiProfile)[] = [
|
|
|
55
64
|
'defaultSizeClass',
|
|
56
65
|
'layout',
|
|
57
66
|
'theme',
|
|
67
|
+
'sampleData',
|
|
58
68
|
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Binds one specific pack to one read model or shape, overriding the application's active pack.
|
|
6
|
+
*/
|
|
7
|
+
export interface SampleDataBinding {
|
|
8
|
+
/** The read model or shape name the binding applies to. */
|
|
9
|
+
target: string;
|
|
10
|
+
|
|
11
|
+
/** The identity of the bound pack. */
|
|
12
|
+
pack: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SampleDataBindingPropertyNames: (keyof SampleDataBinding)[] = ['target', 'pack'];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An explicit `shape → read model` mapping, for when a pack's shape name differs from the read model's.
|
|
6
|
+
*/
|
|
7
|
+
export interface SampleDataMapping {
|
|
8
|
+
/** The shape name in the pack. */
|
|
9
|
+
shape: string;
|
|
10
|
+
|
|
11
|
+
/** The read model (or shape) name the pack's shape supplies rows for. */
|
|
12
|
+
readModel: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SampleDataMappingPropertyNames: (keyof SampleDataMapping)[] = ['shape', 'readModel'];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SampleDataSet } from './SampleDataSet';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A named dataset used by design-time editing and preview, owned by a blueprint or by the user. A pack is
|
|
8
|
+
* never part of a running application: Stage production builds do not include or resolve it.
|
|
9
|
+
*/
|
|
10
|
+
export interface SampleDataPack {
|
|
11
|
+
/** The pack's stable identity, which selections and bindings refer to. */
|
|
12
|
+
id: string;
|
|
13
|
+
|
|
14
|
+
/** The display name. A blueprint pack's selector label is `<Blueprint> · <title>`. */
|
|
15
|
+
title: string;
|
|
16
|
+
|
|
17
|
+
/** The BCP 47 locale tag of the data (`nb-NO`, `en-GB`); generated gap-filling data follows it. */
|
|
18
|
+
locale: string;
|
|
19
|
+
|
|
20
|
+
/** The owner: `blueprint:<id>` for a pack a blueprint ships, or `user` for the author's own. */
|
|
21
|
+
owner: string;
|
|
22
|
+
|
|
23
|
+
/** The rows per shape. */
|
|
24
|
+
sets: SampleDataSet[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const SampleDataPackPropertyNames: (keyof SampleDataPack)[] = ['id', 'title', 'locale', 'owner', 'sets'];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How a {@link ScenePackage} declares a sample-data pack it ships: the pack's identity, enough to list it in
|
|
6
|
+
* a selector without loading it, and where its JSON file lives (`sampleData/<name>.json`).
|
|
7
|
+
*/
|
|
8
|
+
export interface SampleDataPackReference {
|
|
9
|
+
/** The pack's identity; must equal the `id` inside the file. */
|
|
10
|
+
id: string;
|
|
11
|
+
|
|
12
|
+
/** The display name shown in a selector. */
|
|
13
|
+
title: string;
|
|
14
|
+
|
|
15
|
+
/** The BCP 47 locale tag of the pack's data. */
|
|
16
|
+
locale: string;
|
|
17
|
+
|
|
18
|
+
/** The package-relative path of the pack file, under `sampleData/` and ending in `.json`. */
|
|
19
|
+
path: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const SampleDataPackReferencePropertyNames: (keyof SampleDataPackReference)[] = ['id', 'title', 'locale', 'path'];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SampleDataBinding } from './SampleDataBinding';
|
|
5
|
+
import { SampleDataMapping } from './SampleDataMapping';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Which sample data an application previews with: the active pack, the shape→read-model mapping table and
|
|
9
|
+
* any per-read-model pack bindings. It is carried by the application's {@link UiProfile} (`sampleData`), so
|
|
10
|
+
* the choice is made once for the whole application and inherited by every screen, slice and component; it
|
|
11
|
+
* is never chosen per screen.
|
|
12
|
+
*/
|
|
13
|
+
export interface SampleDataSelection {
|
|
14
|
+
/** The application's active pack identity (an own pack or a blueprint's). Absent falls through to the blueprint's default pack, then generated data. */
|
|
15
|
+
activePack?: string;
|
|
16
|
+
|
|
17
|
+
/** Explicit `shape → read model` mappings, for where a pack's shape name is not the read model's name. */
|
|
18
|
+
mappings: SampleDataMapping[];
|
|
19
|
+
|
|
20
|
+
/** Per read model or shape pack bindings; each overrides the active pack for its target. */
|
|
21
|
+
bindings: SampleDataBinding[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const SampleDataSelectionPropertyNames: (keyof SampleDataSelection)[] = ['activePack', 'mappings', 'bindings'];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The rows a {@link SampleDataPack} provides for one shape.
|
|
6
|
+
*/
|
|
7
|
+
export interface SampleDataSet {
|
|
8
|
+
/** The shape's name. Matches a read model of the same name unless the selection maps it elsewhere. */
|
|
9
|
+
shape: string;
|
|
10
|
+
|
|
11
|
+
/** The rows: JSON objects keyed by the shape's field names. */
|
|
12
|
+
rows: Record<string, unknown>[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const SampleDataSetPropertyNames: (keyof SampleDataSet)[] = ['shape', 'rows'];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What kind of value a field holds, as far as generated sample data is concerned. The deterministic
|
|
6
|
+
* generator picks a value pool and a value range from the kind; the member values are the strings used in
|
|
7
|
+
* documents.
|
|
8
|
+
*/
|
|
9
|
+
export enum SampleFieldKind {
|
|
10
|
+
/** A stable unique identifier (a UUID). */
|
|
11
|
+
Id = 'id',
|
|
12
|
+
|
|
13
|
+
/** A person's full name. */
|
|
14
|
+
Name = 'name',
|
|
15
|
+
|
|
16
|
+
/** A company or organization name. */
|
|
17
|
+
Company = 'company',
|
|
18
|
+
|
|
19
|
+
/** An email address. */
|
|
20
|
+
Email = 'email',
|
|
21
|
+
|
|
22
|
+
/** A phone number in the pack locale's style. */
|
|
23
|
+
Phone = 'phone',
|
|
24
|
+
|
|
25
|
+
/** A city name from the pack locale. */
|
|
26
|
+
City = 'city',
|
|
27
|
+
|
|
28
|
+
/** A short free-text phrase. */
|
|
29
|
+
Text = 'text',
|
|
30
|
+
|
|
31
|
+
/** A whole number. */
|
|
32
|
+
WholeNumber = 'wholeNumber',
|
|
33
|
+
|
|
34
|
+
/** A monetary or other two-decimal amount. */
|
|
35
|
+
Amount = 'amount',
|
|
36
|
+
|
|
37
|
+
/** A true/false value. */
|
|
38
|
+
Boolean = 'boolean',
|
|
39
|
+
|
|
40
|
+
/** A calendar date, `yyyy-MM-dd`. */
|
|
41
|
+
Date = 'date',
|
|
42
|
+
|
|
43
|
+
/** A UTC date and time, `yyyy-MM-ddTHH:mm:ssZ`. */
|
|
44
|
+
DateTime = 'dateTime',
|
|
45
|
+
|
|
46
|
+
/** One of a fixed set of named values, given by the field's `enumValues`. */
|
|
47
|
+
Enum = 'enum',
|
|
48
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SampleShapeField } from './SampleShapeField';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the rows a read model or component needs: a name and the fields of one row. Components and
|
|
8
|
+
* queries declare shapes and never values; sample data fills the shape at design and preview time.
|
|
9
|
+
*/
|
|
10
|
+
export interface SampleShape {
|
|
11
|
+
/** The shape's name, matched by name against a pack's sets and a selection's mappings. */
|
|
12
|
+
name: string;
|
|
13
|
+
|
|
14
|
+
/** The fields of one row, in the order their values are generated and written. */
|
|
15
|
+
fields: SampleShapeField[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const SampleShapePropertyNames: (keyof SampleShape)[] = ['name', 'fields'];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SampleFieldKind } from './SampleFieldKind';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One field of a {@link SampleShape}: what the generator needs to know to produce a plausible value.
|
|
8
|
+
* A field gives a `kind`, or just a `type` (and name) from which the kind is inferred.
|
|
9
|
+
*/
|
|
10
|
+
export interface SampleShapeField {
|
|
11
|
+
/** The field's name, as it appears on each row. */
|
|
12
|
+
name: string;
|
|
13
|
+
|
|
14
|
+
/** The field's type name (`string`, `Guid`, `int`, `decimal`, `bool`, `DateTime` ...); used to infer the kind when `kind` is absent. */
|
|
15
|
+
type?: string;
|
|
16
|
+
|
|
17
|
+
/** The kind of value, overriding what would be inferred from `type` and `name`. Accepts the {@link SampleFieldKind} members or their strings. */
|
|
18
|
+
kind?: `${SampleFieldKind}`;
|
|
19
|
+
|
|
20
|
+
/** Whether the field may be null. A nullable field is occasionally null in generated data. */
|
|
21
|
+
nullable?: boolean;
|
|
22
|
+
|
|
23
|
+
/** The member names of an enum field. Generated values are always one of these. */
|
|
24
|
+
enumValues?: string[];
|
|
25
|
+
|
|
26
|
+
/** The smallest value of a numeric field (inclusive). */
|
|
27
|
+
min?: number;
|
|
28
|
+
|
|
29
|
+
/** The largest value of a numeric field (inclusive). */
|
|
30
|
+
max?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const SampleShapeFieldPropertyNames: (keyof SampleShapeField)[] = ['name', 'type', 'kind', 'nullable', 'enumValues', 'min', 'max'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
export * from './SampleFieldKind';
|
|
5
|
+
export * from './SampleShapeField';
|
|
6
|
+
export * from './SampleShape';
|
|
7
|
+
export * from './SampleDataSet';
|
|
8
|
+
export * from './SampleDataPack';
|
|
9
|
+
export * from './SampleDataPackReference';
|
|
10
|
+
export * from './SampleDataMapping';
|
|
11
|
+
export * from './SampleDataBinding';
|
|
12
|
+
export * from './SampleDataSelection';
|