@cratis/scene.model 4.24.0 → 4.26.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 +21 -0
- package/dist/cjs/index.js.map +1 -1
- 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/cjs/screens/TemplateMetadata.js +2 -1
- package/dist/cjs/screens/TemplateMetadata.js.map +1 -1
- package/dist/cjs/screens/TemplateReference.js +19 -0
- package/dist/cjs/screens/TemplateReference.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 +10 -0
- package/dist/esm/index.js.map +1 -1
- 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/screens/TemplateMetadata.d.ts +2 -0
- package/dist/esm/screens/TemplateMetadata.d.ts.map +1 -1
- package/dist/esm/screens/TemplateMetadata.js +2 -1
- package/dist/esm/screens/TemplateMetadata.js.map +1 -1
- package/dist/esm/screens/TemplateReference.d.ts +12 -0
- package/dist/esm/screens/TemplateReference.d.ts.map +1 -0
- package/dist/esm/screens/TemplateReference.js +16 -0
- package/dist/esm/screens/TemplateReference.js.map +1 -0
- package/dist/esm/screens/index.d.ts +1 -0
- package/dist/esm/screens/index.d.ts.map +1 -1
- package/dist/esm/screens/index.js +1 -0
- package/dist/esm/screens/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/index.ts +1 -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
- package/screens/TemplateMetadata.ts +9 -2
- package/screens/TemplateReference.ts +30 -0
- package/screens/index.ts +1 -0
package/index.ts
CHANGED
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';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { TemplateAttribution } from './TemplateAttribution';
|
|
5
5
|
import { TemplateCompatibility } from './TemplateCompatibility';
|
|
6
|
+
import { SliceKind } from '../structure';
|
|
6
7
|
|
|
7
8
|
/** The application hierarchy at which a reusable template is selected. */
|
|
8
9
|
export enum TemplateScope {
|
|
@@ -14,7 +15,7 @@ export enum TemplateScope {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Semantic and browsing metadata. Category is required for blueprint templates and recommended for own templates. Type and category are open strings so packages can
|
|
18
19
|
* introduce their own vocabulary without a Scene release. Category never determines applicability.
|
|
19
20
|
*/
|
|
20
21
|
export interface TemplateMetadata {
|
|
@@ -32,8 +33,14 @@ export interface TemplateMetadata {
|
|
|
32
33
|
license?: string;
|
|
33
34
|
/** An absolute `https` URL to the license terms. */
|
|
34
35
|
licenseUrl?: string;
|
|
36
|
+
/**
|
|
37
|
+
* For a template that applies at {@link TemplateScope.Slice}, the slice kinds it applies to. Absent uses the
|
|
38
|
+
* structural default: a dialog template applies to state change slices, a screen template to every kind that
|
|
39
|
+
* presents something. Declaring slice kinds without scopes makes the default scope Slice.
|
|
40
|
+
*/
|
|
41
|
+
sliceKinds?: SliceKind[];
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
export const TemplateMetadataPropertyNames: (keyof TemplateMetadata)[] = [
|
|
38
|
-
'type', 'category', 'scopes', 'compatibility', 'attribution', 'license', 'licenseUrl',
|
|
45
|
+
'type', 'category', 'scopes', 'compatibility', 'attribution', 'license', 'licenseUrl', 'sliceKinds',
|
|
39
46
|
];
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
/** Where a referenced template comes from. */
|
|
5
|
+
export enum TemplateReferenceSource {
|
|
6
|
+
/** A template the user created in the workspace. */
|
|
7
|
+
Own = 'Own',
|
|
8
|
+
/** A template shipped by a blueprint package, referenced by blueprint name, template name and version range. */
|
|
9
|
+
Blueprint = 'Blueprint',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* How a module, feature or slice refers to the template it uses: an own template by name, or a blueprint
|
|
14
|
+
* template by blueprint, name and the version range of the blueprint it was chosen from.
|
|
15
|
+
*/
|
|
16
|
+
export interface TemplateReference {
|
|
17
|
+
/** Whether the template is the user's own or comes from a blueprint. */
|
|
18
|
+
source: TemplateReferenceSource;
|
|
19
|
+
/** The template's name - within the workspace for an own template, within the blueprint for a blueprint template. */
|
|
20
|
+
id: string;
|
|
21
|
+
/** The blueprint package name. Present exactly when `source` is {@link TemplateReferenceSource.Blueprint}. */
|
|
22
|
+
blueprint?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The semver range of the blueprint the reference accepts, such as `^1.2.0`. Defaults to the caret range of the
|
|
25
|
+
* installed blueprint version when a reference is created; absent means any version. Only meaningful for a blueprint reference.
|
|
26
|
+
*/
|
|
27
|
+
version?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const TemplateReferencePropertyNames: (keyof TemplateReference)[] = ['source', 'id', 'blueprint', 'version'];
|
package/screens/index.ts
CHANGED