@cratis/scene.model 4.11.0 → 4.13.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/PackageDesignTimeMetadata.ts +7 -1
- package/dist/cjs/descriptors/PackageDesignTimeMetadata.js +2 -1
- package/dist/cjs/descriptors/PackageDesignTimeMetadata.js.map +1 -1
- package/dist/cjs/forms/CommandFormLayout.js +13 -0
- package/dist/cjs/forms/CommandFormLayout.js.map +1 -0
- package/dist/cjs/forms/Form.js +2 -0
- package/dist/cjs/forms/Form.js.map +1 -1
- package/dist/cjs/forms/FormColumn.js +13 -0
- package/dist/cjs/forms/FormColumn.js.map +1 -0
- package/dist/cjs/forms/FormField.js +3 -6
- package/dist/cjs/forms/FormField.js.map +1 -1
- package/dist/cjs/forms/FormFieldPlacement.js +15 -0
- package/dist/cjs/forms/FormFieldPlacement.js.map +1 -0
- package/dist/cjs/forms/FormGenerationMode.js +14 -0
- package/dist/cjs/forms/FormGenerationMode.js.map +1 -0
- package/dist/cjs/forms/FormWidth.js +11 -0
- package/dist/cjs/forms/FormWidth.js.map +1 -0
- package/dist/cjs/forms/FormWidthUnit.js +16 -0
- package/dist/cjs/forms/FormWidthUnit.js.map +1 -0
- package/dist/cjs/index.js +16 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/screens/Outlet.js +2 -1
- package/dist/cjs/screens/Outlet.js.map +1 -1
- package/dist/cjs/screens/TemplateAttribution.js +14 -0
- package/dist/cjs/screens/TemplateAttribution.js.map +1 -0
- package/dist/cjs/screens/TemplateCompatibility.js +11 -0
- package/dist/cjs/screens/TemplateCompatibility.js.map +1 -0
- package/dist/cjs/screens/TemplateMetadata.js +5 -1
- package/dist/cjs/screens/TemplateMetadata.js.map +1 -1
- package/dist/esm/descriptors/PackageDesignTimeMetadata.d.ts +1 -0
- package/dist/esm/descriptors/PackageDesignTimeMetadata.d.ts.map +1 -1
- package/dist/esm/descriptors/PackageDesignTimeMetadata.js +2 -1
- package/dist/esm/descriptors/PackageDesignTimeMetadata.js.map +1 -1
- package/dist/esm/forms/CommandFormLayout.d.ts +11 -0
- package/dist/esm/forms/CommandFormLayout.d.ts.map +1 -0
- package/dist/esm/forms/CommandFormLayout.js +11 -0
- package/dist/esm/forms/CommandFormLayout.js.map +1 -0
- package/dist/esm/forms/Form.d.ts +4 -0
- package/dist/esm/forms/Form.d.ts.map +1 -1
- package/dist/esm/forms/Form.js +2 -0
- package/dist/esm/forms/Form.js.map +1 -1
- package/dist/esm/forms/FormColumn.d.ts +9 -0
- package/dist/esm/forms/FormColumn.d.ts.map +1 -0
- package/dist/esm/forms/FormColumn.js +11 -0
- package/dist/esm/forms/FormColumn.js.map +1 -0
- package/dist/esm/forms/FormField.d.ts +2 -0
- package/dist/esm/forms/FormField.d.ts.map +1 -1
- package/dist/esm/forms/FormField.js +3 -6
- package/dist/esm/forms/FormField.js.map +1 -1
- package/dist/esm/forms/FormFieldPlacement.d.ts +11 -0
- package/dist/esm/forms/FormFieldPlacement.d.ts.map +1 -0
- package/dist/esm/forms/FormFieldPlacement.js +13 -0
- package/dist/esm/forms/FormFieldPlacement.js.map +1 -0
- package/dist/esm/forms/FormGenerationMode.d.ts +5 -0
- package/dist/esm/forms/FormGenerationMode.d.ts.map +1 -0
- package/dist/esm/forms/FormGenerationMode.js +12 -0
- package/dist/esm/forms/FormGenerationMode.js.map +1 -0
- package/dist/esm/forms/FormWidth.d.ts +7 -0
- package/dist/esm/forms/FormWidth.d.ts.map +1 -0
- package/dist/esm/forms/FormWidth.js +9 -0
- package/dist/esm/forms/FormWidth.js.map +1 -0
- package/dist/esm/forms/FormWidthUnit.d.ts +7 -0
- package/dist/esm/forms/FormWidthUnit.d.ts.map +1 -0
- package/dist/esm/forms/FormWidthUnit.js +14 -0
- package/dist/esm/forms/FormWidthUnit.js.map +1 -0
- package/dist/esm/forms/index.d.ts +6 -0
- package/dist/esm/forms/index.d.ts.map +1 -1
- package/dist/esm/forms/index.js +6 -0
- package/dist/esm/forms/index.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/screens/Outlet.d.ts +1 -0
- package/dist/esm/screens/Outlet.d.ts.map +1 -1
- package/dist/esm/screens/Outlet.js +2 -1
- package/dist/esm/screens/Outlet.js.map +1 -1
- package/dist/esm/screens/TemplateAttribution.d.ts +7 -0
- package/dist/esm/screens/TemplateAttribution.d.ts.map +1 -0
- package/dist/esm/screens/TemplateAttribution.js +12 -0
- package/dist/esm/screens/TemplateAttribution.js.map +1 -0
- package/dist/esm/screens/TemplateCompatibility.d.ts +7 -0
- package/dist/esm/screens/TemplateCompatibility.d.ts.map +1 -0
- package/dist/esm/screens/TemplateCompatibility.js +9 -0
- package/dist/esm/screens/TemplateCompatibility.js.map +1 -0
- package/dist/esm/screens/TemplateMetadata.d.ts +6 -0
- package/dist/esm/screens/TemplateMetadata.d.ts.map +1 -1
- package/dist/esm/screens/TemplateMetadata.js +5 -1
- package/dist/esm/screens/TemplateMetadata.js.map +1 -1
- package/dist/esm/screens/index.d.ts +2 -0
- package/dist/esm/screens/index.d.ts.map +1 -1
- package/dist/esm/screens/index.js +2 -0
- package/dist/esm/screens/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/forms/CommandFormLayout.ts +18 -0
- package/forms/Form.ts +5 -1
- package/forms/FormColumn.ts +16 -0
- package/forms/FormField.ts +4 -1
- package/forms/FormFieldPlacement.ts +18 -0
- package/forms/FormGenerationMode.ts +10 -0
- package/forms/FormWidth.ts +16 -0
- package/forms/FormWidthUnit.ts +12 -0
- package/forms/index.ts +6 -0
- package/package.json +1 -1
- package/screens/Outlet.ts +8 -1
- package/screens/TemplateAttribution.ts +18 -0
- package/screens/TemplateCompatibility.ts +21 -0
- package/screens/TemplateMetadata.ts +14 -1
- package/screens/index.ts +2 -0
|
@@ -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 { FormColumn } from './FormColumn';
|
|
5
|
+
import { FormFieldPlacement } from './FormFieldPlacement';
|
|
6
|
+
import { FormWidth } from './FormWidth';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Platform-neutral command-form geometry. It is independent of auto/manual field generation mode.
|
|
10
|
+
*/
|
|
11
|
+
export interface CommandFormLayout {
|
|
12
|
+
columns: FormColumn[];
|
|
13
|
+
placements: FormFieldPlacement[];
|
|
14
|
+
columnGap?: FormWidth;
|
|
15
|
+
rowGap?: FormWidth;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const CommandFormLayoutPropertyNames: (keyof CommandFormLayout)[] = ['columns', 'placements', 'columnGap', 'rowGap'];
|
package/forms/Form.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
import { CommandFormLayout } from './CommandFormLayout';
|
|
5
|
+
import { FormGenerationMode } from './FormGenerationMode';
|
|
4
6
|
import { PopulateSource } from './PopulateSource';
|
|
5
7
|
import { FormField } from './FormField';
|
|
6
8
|
import { Behavior } from '../interactions';
|
|
@@ -12,6 +14,8 @@ export interface Form {
|
|
|
12
14
|
name: string;
|
|
13
15
|
forCommand: string;
|
|
14
16
|
populateSource?: PopulateSource;
|
|
17
|
+
generationMode?: FormGenerationMode;
|
|
18
|
+
layout?: CommandFormLayout;
|
|
15
19
|
fields: FormField[];
|
|
16
20
|
/**
|
|
17
21
|
* The behaviors attached here - what happens when someone interacts with it. Additive with whatever is
|
|
@@ -20,4 +24,4 @@ export interface Form {
|
|
|
20
24
|
behaviors?: Behavior[];
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
export const FormPropertyNames: (keyof Form)[] = ['name', 'forCommand', 'populateSource', 'fields', 'behaviors'];
|
|
27
|
+
export const FormPropertyNames: (keyof Form)[] = ['name', 'forCommand', 'populateSource', 'generationMode', 'layout', 'fields', 'behaviors'];
|
|
@@ -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
|
+
import { FormWidth } from './FormWidth';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One column in a command-form geometry grid. Indexes are one-based for authored stability.
|
|
8
|
+
*/
|
|
9
|
+
export interface FormColumn {
|
|
10
|
+
index: number;
|
|
11
|
+
width?: FormWidth;
|
|
12
|
+
minWidth?: FormWidth;
|
|
13
|
+
maxWidth?: FormWidth;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const FormColumnPropertyNames: (keyof FormColumn)[] = ['index', 'width', 'minWidth', 'maxWidth'];
|
package/forms/FormField.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
import { FormFieldPlacement } from './FormFieldPlacement';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* One field of a {@link Form}. Mirrors the three population tiers Screenplay's `form` construct
|
|
6
8
|
* establishes: auto-mapped by name (`sourceProperty` and `composeUsing` both undefined), explicitly
|
|
@@ -11,6 +13,7 @@ export interface FormField {
|
|
|
11
13
|
sourceProperty?: string;
|
|
12
14
|
composeUsing?: string;
|
|
13
15
|
label?: string;
|
|
16
|
+
placement?: FormFieldPlacement;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
export const FormFieldPropertyNames: (keyof FormField)[] = ['name', 'sourceProperty', 'composeUsing', 'label'];
|
|
19
|
+
export const FormFieldPropertyNames: (keyof FormField)[] = ['name', 'sourceProperty', 'composeUsing', 'label', 'placement'];
|
|
@@ -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 { FormWidth } from './FormWidth';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Authored placement for one command-form field in a platform-neutral grid. Row and column are one-based.
|
|
8
|
+
*/
|
|
9
|
+
export interface FormFieldPlacement {
|
|
10
|
+
field: string;
|
|
11
|
+
row: number;
|
|
12
|
+
column: number;
|
|
13
|
+
rowSpan?: number;
|
|
14
|
+
columnSpan?: number;
|
|
15
|
+
width?: FormWidth;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const FormFieldPlacementPropertyNames: (keyof FormFieldPlacement)[] = ['field', 'row', 'column', 'rowSpan', 'columnSpan', 'width'];
|
|
@@ -0,0 +1,10 @@
|
|
|
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 command form's fields are generated.
|
|
6
|
+
*/
|
|
7
|
+
export enum FormGenerationMode {
|
|
8
|
+
Auto = 'auto',
|
|
9
|
+
Manual = 'manual',
|
|
10
|
+
}
|
|
@@ -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
|
+
import { FormWidthUnit } from './FormWidthUnit';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A platform-neutral width value for form geometry.
|
|
8
|
+
*/
|
|
9
|
+
export interface FormWidth {
|
|
10
|
+
unit: FormWidthUnit;
|
|
11
|
+
|
|
12
|
+
/** The numeric value for fraction, pixel and percent widths. Omitted for `auto`. */
|
|
13
|
+
value?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const FormWidthPropertyNames: (keyof FormWidth)[] = ['unit', 'value'];
|
|
@@ -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
|
+
/**
|
|
5
|
+
* The unit used by a command-form column, gap or field width.
|
|
6
|
+
*/
|
|
7
|
+
export enum FormWidthUnit {
|
|
8
|
+
Fraction = 'fraction',
|
|
9
|
+
Pixels = 'pixels',
|
|
10
|
+
Percent = 'percent',
|
|
11
|
+
Auto = 'auto',
|
|
12
|
+
}
|
package/forms/index.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
+
export * from './CommandFormLayout';
|
|
4
5
|
export * from './Form';
|
|
6
|
+
export * from './FormColumn';
|
|
5
7
|
export * from './FormField';
|
|
8
|
+
export * from './FormFieldPlacement';
|
|
9
|
+
export * from './FormGenerationMode';
|
|
10
|
+
export * from './FormWidth';
|
|
11
|
+
export * from './FormWidthUnit';
|
|
6
12
|
export * from './PopulateSource';
|
|
7
13
|
export * from './PopulateViaQuery';
|
|
8
14
|
export * from './PopulateFromItem';
|
package/package.json
CHANGED
package/screens/Outlet.ts
CHANGED
|
@@ -10,6 +10,13 @@ export interface Outlet {
|
|
|
10
10
|
|
|
11
11
|
/** Optional description for designers. */
|
|
12
12
|
description?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The semantic template types (`TemplateMetadata.type`) a screen must have to be placed in this outlet,
|
|
16
|
+
* such as `Detail` or `Form`. Absent accepts any screen. A destination that places a screen of another
|
|
17
|
+
* type here is diagnosed as an incompatible outlet rather than rendered somewhere it was not designed for.
|
|
18
|
+
*/
|
|
19
|
+
accepts?: string[];
|
|
13
20
|
}
|
|
14
21
|
|
|
15
|
-
export const OutletPropertyNames: (keyof Outlet)[] = ['name', 'description'];
|
|
22
|
+
export const OutletPropertyNames: (keyof Outlet)[] = ['name', 'description', 'accepts'];
|
|
@@ -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
|
+
/**
|
|
5
|
+
* Who authored a template and what must accompany it when it is reused.
|
|
6
|
+
*/
|
|
7
|
+
export interface TemplateAttribution {
|
|
8
|
+
/** The person or organization that authored the template. */
|
|
9
|
+
author: string;
|
|
10
|
+
|
|
11
|
+
/** An absolute `https` URL where the template's source or documentation lives. */
|
|
12
|
+
url?: string;
|
|
13
|
+
|
|
14
|
+
/** An attribution notice a license requires to travel with the template, shown by a template browser. */
|
|
15
|
+
notice?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const TemplateAttributionPropertyNames: (keyof TemplateAttribution)[] = ['author', 'url', 'notice'];
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { PackageDependency } from '../packages/PackageDependency';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which Scene and package versions a template was authored and verified against.
|
|
8
|
+
*
|
|
9
|
+
* A template names components, slots and bindings that only exist in particular versions of Scene and of
|
|
10
|
+
* the packages that provide them. Declaring the ranges lets a catalog mark a template as incompatible with
|
|
11
|
+
* the active package set before an author picks it, instead of rendering placeholders after they have.
|
|
12
|
+
*/
|
|
13
|
+
export interface TemplateCompatibility {
|
|
14
|
+
/** The Scene model version range the template requires, such as `^4.13.0`. */
|
|
15
|
+
scene: string;
|
|
16
|
+
|
|
17
|
+
/** The packages, and their version ranges, whose components or layouts the template uses. */
|
|
18
|
+
packages?: PackageDependency[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const TemplateCompatibilityPropertyNames: (keyof TemplateCompatibility)[] = ['scene', 'packages'];
|
|
@@ -1,6 +1,9 @@
|
|
|
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 { TemplateAttribution } from './TemplateAttribution';
|
|
5
|
+
import { TemplateCompatibility } from './TemplateCompatibility';
|
|
6
|
+
|
|
4
7
|
/** The application hierarchy at which a reusable template is selected. */
|
|
5
8
|
export enum TemplateScope {
|
|
6
9
|
Application = 'Application',
|
|
@@ -21,6 +24,16 @@ export interface TemplateMetadata {
|
|
|
21
24
|
category?: string;
|
|
22
25
|
/** Explicit scope restriction. Absent uses the structural role; an empty list allows no scope. */
|
|
23
26
|
scopes?: TemplateScope[];
|
|
27
|
+
/** The Scene and package versions the template requires. Required for every shipped template. */
|
|
28
|
+
compatibility?: TemplateCompatibility;
|
|
29
|
+
/** Who authored the template. Required for every shipped template. */
|
|
30
|
+
attribution?: TemplateAttribution;
|
|
31
|
+
/** The SPDX license identifier the template is available under, such as `MIT`. Required for every shipped template. */
|
|
32
|
+
license?: string;
|
|
33
|
+
/** An absolute `https` URL to the license terms. */
|
|
34
|
+
licenseUrl?: string;
|
|
24
35
|
}
|
|
25
36
|
|
|
26
|
-
export const TemplateMetadataPropertyNames: (keyof TemplateMetadata)[] = [
|
|
37
|
+
export const TemplateMetadataPropertyNames: (keyof TemplateMetadata)[] = [
|
|
38
|
+
'type', 'category', 'scopes', 'compatibility', 'attribution', 'license', 'licenseUrl',
|
|
39
|
+
];
|
package/screens/index.ts
CHANGED