@cratis/scene.react 4.20.0 → 4.21.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/NavBar/extractNavigationItem.ts +13 -3
- package/core/CoreToolbar.tsx +153 -0
- package/core/coreComponents.ts +3 -0
- package/core/corePackage.ts +2 -0
- package/core/index.ts +1 -0
- package/dist/cjs/NavBar/extractNavigationItem.js +12 -3
- package/dist/cjs/NavBar/extractNavigationItem.js.map +1 -1
- package/dist/cjs/core/CoreToolbar.js +183 -0
- package/dist/cjs/core/CoreToolbar.js.map +1 -0
- package/dist/cjs/core/coreComponents.js +4 -1
- package/dist/cjs/core/coreComponents.js.map +1 -1
- package/dist/cjs/core/corePackage.js +3 -1
- package/dist/cjs/core/corePackage.js.map +1 -1
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/NavBar/extractNavigationItem.d.ts.map +1 -1
- package/dist/esm/NavBar/extractNavigationItem.js +12 -3
- package/dist/esm/NavBar/extractNavigationItem.js.map +1 -1
- package/dist/esm/core/CoreToolbar.d.ts +8 -0
- package/dist/esm/core/CoreToolbar.d.ts.map +1 -0
- package/dist/esm/core/CoreToolbar.js +178 -0
- package/dist/esm/core/CoreToolbar.js.map +1 -0
- package/dist/esm/core/coreComponents.d.ts.map +1 -1
- package/dist/esm/core/coreComponents.js +4 -1
- package/dist/esm/core/coreComponents.js.map +1 -1
- package/dist/esm/core/corePackage.d.ts.map +1 -1
- package/dist/esm/core/corePackage.js +3 -1
- package/dist/esm/core/corePackage.js.map +1 -1
- package/dist/esm/core/index.d.ts +1 -0
- package/dist/esm/core/index.d.ts.map +1 -1
- package/dist/esm/core/index.js +1 -0
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Reads a {@link NavigationItem} out of a {@link Contribution} to the built-in `Navigation` contribution
|
|
5
5
|
* point. `Contribution.content` carries an {@link ExternalComponent} whose open `properties` bag holds the
|
|
6
|
-
* navigation-specific values (`label`, `targetScreen`, `routeParameterBindings`, `order`, `group
|
|
6
|
+
* navigation-specific values (`label`, `targetScreen`, `routeParameterBindings`, `order`, `group`, and the
|
|
7
|
+
* optional `id`, `icon`, `presentation`, `destination` and `hierarchy`) - the
|
|
7
8
|
* same names as {@link NavigationItem}'s own fields. This property-bag contract is Scene#2's own choice,
|
|
8
9
|
* made without a real Screenplay-to-Scene translation to confirm it against (Stage#37 hasn't been built
|
|
9
10
|
* yet) - whoever builds that seam should either produce contributions matching this contract or this
|
|
@@ -16,18 +17,26 @@
|
|
|
16
17
|
if (!content.properties) {
|
|
17
18
|
return undefined;
|
|
18
19
|
}
|
|
19
|
-
const { label, targetScreen, routeParameterBindings, order, group } = content.properties;
|
|
20
|
+
const { id, label, icon, presentation, targetScreen, routeParameterBindings, destination, order, group, hierarchy } = content.properties;
|
|
20
21
|
if (typeof label !== 'string' || typeof targetScreen !== 'string') {
|
|
21
22
|
return undefined;
|
|
22
23
|
}
|
|
23
24
|
return {
|
|
25
|
+
id: typeof id === 'string' ? id : undefined,
|
|
24
26
|
label,
|
|
27
|
+
icon: typeof icon === 'string' ? icon : undefined,
|
|
28
|
+
presentation: typeof presentation === 'string' ? presentation : undefined,
|
|
25
29
|
targetScreen,
|
|
26
30
|
routeParameterBindings: isBindingExpressionRecord(routeParameterBindings) ? routeParameterBindings : {},
|
|
27
31
|
order: typeof order === 'number' ? order : contribution.order,
|
|
28
|
-
|
|
32
|
+
destination: isDestination(destination) ? destination : undefined,
|
|
33
|
+
group: typeof group === 'string' ? group : undefined,
|
|
34
|
+
hierarchy: Array.isArray(hierarchy) ? hierarchy.filter((part)=>typeof part === 'string') : undefined
|
|
29
35
|
};
|
|
30
36
|
}
|
|
37
|
+
function isDestination(value) {
|
|
38
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
39
|
+
}
|
|
31
40
|
function isBindingExpressionRecord(value) {
|
|
32
41
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
33
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractNavigationItem.js","sources":["../../../NavBar/extractNavigationItem.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 { BindingExpression, Contribution, ExternalComponent, NavigationItem } from '@cratis/scene.model';\n\n/**\n * Reads a {@link NavigationItem} out of a {@link Contribution} to the built-in `Navigation` contribution\n * point. `Contribution.content` carries an {@link ExternalComponent} whose open `properties` bag holds the\n * navigation-specific values (`label`, `targetScreen`, `routeParameterBindings`, `order`, `group`) - the\n * same names as {@link NavigationItem}'s own fields. This property-bag contract is Scene#2's own choice,\n * made without a real Screenplay-to-Scene translation to confirm it against (Stage#37 hasn't been built\n * yet) - whoever builds that seam should either produce contributions matching this contract or this\n * function should move to match whatever Stage#37 actually emits.\n *\n * @param contribution The contribution to read.\n * @returns The extracted {@link NavigationItem}, or `undefined` when `contribution.content` isn't an {@link ExternalComponent} or is missing a required property.\n */\nexport function extractNavigationItem(contribution: Contribution): NavigationItem | undefined {\n const content = contribution.content as Partial<ExternalComponent>;\n if (!content.properties) {\n return undefined;\n }\n\n const { label, targetScreen, routeParameterBindings, order, group } = content.properties as Record<string, unknown>;\n if (typeof label !== 'string' || typeof targetScreen !== 'string') {\n return undefined;\n }\n\n return {\n label,\n targetScreen,\n routeParameterBindings: isBindingExpressionRecord(routeParameterBindings) ? routeParameterBindings : {},\n order: typeof order === 'number' ? order : contribution.order,\n group: typeof group === 'string' ? group : undefined,\n };\n}\n\nfunction isBindingExpressionRecord(value: unknown): value is Record<string, BindingExpression> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"names":["extractNavigationItem","contribution","content","properties","undefined","label","targetScreen","routeParameterBindings","order","group","isBindingExpressionRecord","
|
|
1
|
+
{"version":3,"file":"extractNavigationItem.js","sources":["../../../NavBar/extractNavigationItem.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 { BindingExpression, Contribution, DestinationReference, ExternalComponent, NavigationItem } from '@cratis/scene.model';\n\n/**\n * Reads a {@link NavigationItem} out of a {@link Contribution} to the built-in `Navigation` contribution\n * point. `Contribution.content` carries an {@link ExternalComponent} whose open `properties` bag holds the\n * navigation-specific values (`label`, `targetScreen`, `routeParameterBindings`, `order`, `group`, and the\n * optional `id`, `icon`, `presentation`, `destination` and `hierarchy`) - the\n * same names as {@link NavigationItem}'s own fields. This property-bag contract is Scene#2's own choice,\n * made without a real Screenplay-to-Scene translation to confirm it against (Stage#37 hasn't been built\n * yet) - whoever builds that seam should either produce contributions matching this contract or this\n * function should move to match whatever Stage#37 actually emits.\n *\n * @param contribution The contribution to read.\n * @returns The extracted {@link NavigationItem}, or `undefined` when `contribution.content` isn't an {@link ExternalComponent} or is missing a required property.\n */\nexport function extractNavigationItem(contribution: Contribution): NavigationItem | undefined {\n const content = contribution.content as Partial<ExternalComponent>;\n if (!content.properties) {\n return undefined;\n }\n\n const { id, label, icon, presentation, targetScreen, routeParameterBindings, destination, order, group, hierarchy } = content.properties as Record<string, unknown>;\n if (typeof label !== 'string' || typeof targetScreen !== 'string') {\n return undefined;\n }\n\n return {\n id: typeof id === 'string' ? id : undefined,\n label,\n icon: typeof icon === 'string' ? icon : undefined,\n presentation: typeof presentation === 'string' ? presentation : undefined,\n targetScreen,\n routeParameterBindings: isBindingExpressionRecord(routeParameterBindings) ? routeParameterBindings : {},\n order: typeof order === 'number' ? order : contribution.order,\n destination: isDestination(destination) ? destination : undefined,\n group: typeof group === 'string' ? group : undefined,\n hierarchy: Array.isArray(hierarchy) ? hierarchy.filter((part): part is string => typeof part === 'string') : undefined,\n };\n}\n\nfunction isDestination(value: unknown): value is DestinationReference {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isBindingExpressionRecord(value: unknown): value is Record<string, BindingExpression> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"names":["extractNavigationItem","contribution","content","properties","undefined","id","label","icon","presentation","targetScreen","routeParameterBindings","destination","order","group","hierarchy","isBindingExpressionRecord","isDestination","Array","isArray","filter","part","value"],"mappings":"AAAA;AACA;AAIA;;;;;;;;;;;;IAaO,SAASA,qBAAAA,CAAsBC,YAA0B,EAAA;IAC5D,MAAMC,OAAAA,GAAUD,aAAaC,OAAO;IACpC,IAAI,CAACA,OAAAA,CAAQC,UAAU,EAAE;QACrB,OAAOC,SAAAA;AACX,IAAA;IAEA,MAAM,EAAEC,EAAE,EAAEC,KAAK,EAAEC,IAAI,EAAEC,YAAY,EAAEC,YAAY,EAAEC,sBAAsB,EAAEC,WAAW,EAAEC,KAAK,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAGZ,OAAAA,CAAQC,UAAU;AACxI,IAAA,IAAI,OAAOG,KAAAA,KAAU,QAAA,IAAY,OAAOG,iBAAiB,QAAA,EAAU;QAC/D,OAAOL,SAAAA;AACX,IAAA;IAEA,OAAO;QACHC,EAAAA,EAAI,OAAOA,EAAAA,KAAO,QAAA,GAAWA,EAAAA,GAAKD,SAAAA;AAClCE,QAAAA,KAAAA;QACAC,IAAAA,EAAM,OAAOA,IAAAA,KAAS,QAAA,GAAWA,IAAAA,GAAOH,SAAAA;QACxCI,YAAAA,EAAc,OAAOA,YAAAA,KAAiB,QAAA,GAAWA,YAAAA,GAAeJ,SAAAA;AAChEK,QAAAA,YAAAA;QACAC,sBAAAA,EAAwBK,yBAAAA,CAA0BL,sBAAAA,CAAAA,GAA0BA,sBAAAA,GAAyB,EAAC;AACtGE,QAAAA,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQX,aAAaW,KAAK;QAC7DD,WAAAA,EAAaK,aAAAA,CAAcL,eAAeA,WAAAA,GAAcP,SAAAA;QACxDS,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQT,SAAAA;QAC3CU,SAAAA,EAAWG,KAAAA,CAAMC,OAAO,CAACJ,SAAAA,CAAAA,GAAaA,SAAAA,CAAUK,MAAM,CAAC,CAACC,IAAAA,GAAyB,OAAOA,IAAAA,KAAS,QAAA,CAAA,GAAYhB;AACjH,KAAA;AACJ;AAEA,SAASY,cAAcK,KAAc,EAAA;IACjC,OAAO,OAAOA,UAAU,QAAA,IAAYA,KAAAA,KAAU,QAAQ,CAACJ,KAAAA,CAAMC,OAAO,CAACG,KAAAA,CAAAA;AACzE;AAEA,SAASN,0BAA0BM,KAAc,EAAA;IAC7C,OAAO,OAAOA,UAAU,QAAA,IAAYA,KAAAA,KAAU,QAAQ,CAACJ,KAAAA,CAAMC,OAAO,CAACG,KAAAA,CAAAA;AACzE;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DestinationReference } from '@cratis/scene.model';
|
|
2
|
+
import { RegisteredComponentProps } from '../renderer';
|
|
3
|
+
export type ToolbarItemMode = 'icon' | 'text' | 'both';
|
|
4
|
+
export declare function toolbarItemMode(presentation: Record<string, unknown>): ToolbarItemMode;
|
|
5
|
+
export declare function toolbarItemDestination(properties: Record<string, unknown>): DestinationReference | undefined;
|
|
6
|
+
export declare function CoreToolbar({ element, slots }: RegisteredComponentProps): import("react").JSX.Element;
|
|
7
|
+
export declare function CoreToolbarItem({ element }: RegisteredComponentProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=CoreToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreToolbar.d.ts","sourceRoot":"","sources":["../../../core/CoreToolbar.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAyD,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EAAE,wBAAwB,EAAyB,MAAM,aAAa,CAAC;AAI9E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AA+CvD,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAGtF;AAQD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,oBAAoB,GAAG,SAAS,CAW5G;AAMD,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,wBAAwB,+BAGvE;AAcD,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAkDpE"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { resolveBindingExpression } from '@cratis/scene.engine';
|
|
4
|
+
import { DestinationKind, BindingSourceKind } from '@cratis/scene.model';
|
|
5
|
+
import { useRenderBindingScope } from '../renderer/RenderBindingScopeContext.js';
|
|
6
|
+
import '../interactions/useInteractions.js';
|
|
7
|
+
import '../interactions/NotificationHost.js';
|
|
8
|
+
import { SceneNavigationContextInternal } from '../navigation/SceneNavigationContext.js';
|
|
9
|
+
|
|
10
|
+
function textProperty(properties, name) {
|
|
11
|
+
return typeof properties[name] === 'string' ? properties[name] : undefined;
|
|
12
|
+
}
|
|
13
|
+
function recordProperty(properties, name) {
|
|
14
|
+
const value = properties[name];
|
|
15
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
16
|
+
}
|
|
17
|
+
function isDestination(value) {
|
|
18
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
19
|
+
return [
|
|
20
|
+
'screen',
|
|
21
|
+
'module',
|
|
22
|
+
'route',
|
|
23
|
+
'dialog',
|
|
24
|
+
'outlet'
|
|
25
|
+
].some((key)=>typeof value[key] === 'string');
|
|
26
|
+
}
|
|
27
|
+
function isBinding(value) {
|
|
28
|
+
return value !== null && typeof value === 'object' && typeof value.path === 'string';
|
|
29
|
+
}
|
|
30
|
+
function literal(value) {
|
|
31
|
+
return {
|
|
32
|
+
kind: BindingSourceKind.Literal,
|
|
33
|
+
path: '',
|
|
34
|
+
value
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function resolveParameters(parameters, scope) {
|
|
38
|
+
return Object.fromEntries(Object.entries(parameters).map(([name, binding])=>[
|
|
39
|
+
name,
|
|
40
|
+
isBinding(binding) ? resolveBindingExpression(binding, scope) : binding
|
|
41
|
+
]));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* An authored destination with its route parameters read now, against the scope the item renders in.
|
|
45
|
+
*
|
|
46
|
+
* A navigation host resolves a destination against its own scope, which cannot see what the screen's components
|
|
47
|
+
* publish - a table's selected row, an input's value - so the item resolves them where it is, and hands the host
|
|
48
|
+
* literals. (The renderer leaves a destination's bindings alone, unlike the rest of an element's properties.)
|
|
49
|
+
*/ function withResolvedParameters(destination, scope) {
|
|
50
|
+
const bindings = destination.routeParameterBindings;
|
|
51
|
+
if (!bindings) return destination;
|
|
52
|
+
return {
|
|
53
|
+
...destination,
|
|
54
|
+
routeParameterBindings: Object.fromEntries(Object.entries(bindings).map(([name, binding])=>[
|
|
55
|
+
name,
|
|
56
|
+
literal(resolveBindingExpression(binding, scope))
|
|
57
|
+
]))
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** The mode the item's authored presentation asks for; anything it does not name shows both. */ function toolbarItemMode(presentation) {
|
|
61
|
+
const mode = presentation.mode;
|
|
62
|
+
return mode === 'icon' || mode === 'text' ? mode : 'both';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Where activating a toolbar item goes.
|
|
66
|
+
*
|
|
67
|
+
* The destination the document authored wins. Without one, a `Navigate` item opens its target screen - its
|
|
68
|
+
* parameters become route parameter bindings - and a `Dialog` item opens its target dialog template.
|
|
69
|
+
*/ function toolbarItemDestination(properties) {
|
|
70
|
+
if (isDestination(properties.destination)) return properties.destination;
|
|
71
|
+
const kind = textProperty(properties, 'kind')?.toLowerCase();
|
|
72
|
+
const target = textProperty(properties, 'target');
|
|
73
|
+
if (!target) return undefined;
|
|
74
|
+
// The renderer has already read each parameter's binding by the time the item sees it, so a parameter is a value.
|
|
75
|
+
const routeParameterBindings = Object.fromEntries(Object.entries(recordProperty(properties, 'parameters')).map(([name, value])=>[
|
|
76
|
+
name,
|
|
77
|
+
literal(value)
|
|
78
|
+
]));
|
|
79
|
+
if (kind === 'navigate') return {
|
|
80
|
+
screen: target,
|
|
81
|
+
routeParameterBindings
|
|
82
|
+
};
|
|
83
|
+
if (kind === 'dialog') return {
|
|
84
|
+
kind: DestinationKind.Dialog,
|
|
85
|
+
dialog: target,
|
|
86
|
+
routeParameterBindings
|
|
87
|
+
};
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The `core:toolbar` component: the items a screen's toolbar groups, in the order they were authored.
|
|
92
|
+
* The items are `core:toolbarItem` elements in its `items` slot.
|
|
93
|
+
*/ function CoreToolbar({ element, slots }) {
|
|
94
|
+
const name = textProperty(element.properties, 'name');
|
|
95
|
+
return /*#__PURE__*/ jsx("div", {
|
|
96
|
+
"data-scene-id": element.id,
|
|
97
|
+
"data-scene-toolbar": name,
|
|
98
|
+
role: "toolbar",
|
|
99
|
+
"aria-label": name,
|
|
100
|
+
children: slots.items
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The `core:toolbarItem` component: one toolbar entry with a label, an icon, presentation hints and what it does.
|
|
105
|
+
*
|
|
106
|
+
* - An `Action` item announces the command it targets with the host-neutral `cratis.scene.command` event, carrying its
|
|
107
|
+
* parameters resolved against the binding scope.
|
|
108
|
+
* - A `Navigate` or `Dialog` item executes its destination through the enclosing navigation host - a screen in an
|
|
109
|
+
* outlet, a dialog - and, outside one, announces it with the host-neutral `cratis.scene.navigate` event.
|
|
110
|
+
*
|
|
111
|
+
* Presentation: `mode` is `icon`, `text` or `both` (the default); an icon-only item keeps its label as its accessible name.
|
|
112
|
+
* Every presentation hint - `placement`, `density` or whatever a package reads - is also carried on the node as a
|
|
113
|
+
* `data-scene-presentation-<name>` attribute so a theme can style by it.
|
|
114
|
+
*/ function CoreToolbarItem({ element }) {
|
|
115
|
+
const navigation = useContext(SceneNavigationContextInternal);
|
|
116
|
+
const scope = useRenderBindingScope();
|
|
117
|
+
const name = textProperty(element.properties, 'name') ?? element.id;
|
|
118
|
+
const kind = textProperty(element.properties, 'kind')?.toLowerCase();
|
|
119
|
+
const target = textProperty(element.properties, 'target') ?? '';
|
|
120
|
+
const label = textProperty(element.properties, 'label') ?? name;
|
|
121
|
+
const icon = textProperty(element.properties, 'icon');
|
|
122
|
+
const presentation = recordProperty(element.properties, 'presentation');
|
|
123
|
+
const mode = toolbarItemMode(presentation);
|
|
124
|
+
const destination = toolbarItemDestination(element.properties);
|
|
125
|
+
const attributes = Object.fromEntries(Object.entries(presentation).filter(([key])=>/^[A-Za-z][A-Za-z0-9-]*$/.test(key)).map(([key, value])=>[
|
|
126
|
+
`data-scene-presentation-${key.toLowerCase()}`,
|
|
127
|
+
String(value)
|
|
128
|
+
]));
|
|
129
|
+
const activate = ()=>{
|
|
130
|
+
if (kind === 'action') {
|
|
131
|
+
const args = resolveParameters(recordProperty(element.properties, 'parameters'), scope);
|
|
132
|
+
globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', {
|
|
133
|
+
detail: {
|
|
134
|
+
command: target,
|
|
135
|
+
element,
|
|
136
|
+
arguments: args
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!destination) return;
|
|
142
|
+
const resolved = withResolvedParameters(destination, scope);
|
|
143
|
+
if (navigation) {
|
|
144
|
+
navigation.navigate(resolved);
|
|
145
|
+
} else {
|
|
146
|
+
globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', {
|
|
147
|
+
detail: {
|
|
148
|
+
targetScreen: destination.screen ?? '',
|
|
149
|
+
dialog: destination.dialog,
|
|
150
|
+
destination: resolved,
|
|
151
|
+
element
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
157
|
+
type: "button",
|
|
158
|
+
"data-scene-id": element.id,
|
|
159
|
+
"data-scene-toolbar-item": name,
|
|
160
|
+
"data-scene-icon": icon,
|
|
161
|
+
"data-scene-mode": mode,
|
|
162
|
+
"aria-label": mode === 'icon' ? label : undefined,
|
|
163
|
+
title: mode === 'icon' ? label : undefined,
|
|
164
|
+
disabled: kind !== 'action' && !destination,
|
|
165
|
+
onClick: activate,
|
|
166
|
+
...attributes,
|
|
167
|
+
children: [
|
|
168
|
+
mode !== 'text' && icon && /*#__PURE__*/ jsx("span", {
|
|
169
|
+
"aria-hidden": "true",
|
|
170
|
+
"data-scene-icon-name": icon
|
|
171
|
+
}),
|
|
172
|
+
mode !== 'icon' && label
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export { CoreToolbar, CoreToolbarItem, toolbarItemDestination, toolbarItemMode };
|
|
178
|
+
//# sourceMappingURL=CoreToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreToolbar.js","sources":["../../../core/CoreToolbar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useContext } from 'react';\nimport { BindingScope, resolveBindingExpression } from '@cratis/scene.engine';\nimport { BindingExpression, BindingSourceKind, DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { RegisteredComponentProps, useRenderBindingScope } from '../renderer';\nimport { SceneNavigationContextInternal } from '../navigation/SceneNavigationContext';\n\n/** How a toolbar item shows its icon and label - the `mode` an item's presentation hint can name. */\nexport type ToolbarItemMode = 'icon' | 'text' | 'both';\n\nfunction textProperty(properties: Record<string, unknown>, name: string): string | undefined {\n return typeof properties[name] === 'string' ? properties[name] : undefined;\n}\n\nfunction recordProperty(properties: Record<string, unknown>, name: string): Record<string, unknown> {\n const value = properties[name];\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {};\n}\n\nfunction isDestination(value: unknown): value is DestinationReference {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n return ['screen', 'module', 'route', 'dialog', 'outlet'].some(key => typeof (value as Record<string, unknown>)[key] === 'string');\n}\n\nfunction isBinding(value: unknown): value is BindingExpression {\n return value !== null && typeof value === 'object' && typeof (value as BindingExpression).path === 'string';\n}\n\nfunction literal(value: unknown): BindingExpression {\n return { kind: BindingSourceKind.Literal, path: '', value } as BindingExpression;\n}\n\nfunction resolveParameters(parameters: Record<string, unknown>, scope: BindingScope): Record<string, unknown> {\n return Object.fromEntries(Object.entries(parameters).map(([name, binding]) =>\n [name, isBinding(binding) ? resolveBindingExpression(binding, scope) : binding]));\n}\n\n/**\n * An authored destination with its route parameters read now, against the scope the item renders in.\n *\n * A navigation host resolves a destination against its own scope, which cannot see what the screen's components\n * publish - a table's selected row, an input's value - so the item resolves them where it is, and hands the host\n * literals. (The renderer leaves a destination's bindings alone, unlike the rest of an element's properties.)\n */\nfunction withResolvedParameters(destination: DestinationReference, scope: BindingScope): DestinationReference {\n const bindings = destination.routeParameterBindings;\n if (!bindings) return destination;\n return {\n ...destination,\n routeParameterBindings: Object.fromEntries(Object.entries(bindings).map(([name, binding]) =>\n [name, literal(resolveBindingExpression(binding, scope))])),\n };\n}\n\n/** The mode the item's authored presentation asks for; anything it does not name shows both. */\nexport function toolbarItemMode(presentation: Record<string, unknown>): ToolbarItemMode {\n const mode = presentation.mode;\n return mode === 'icon' || mode === 'text' ? mode : 'both';\n}\n\n/**\n * Where activating a toolbar item goes.\n *\n * The destination the document authored wins. Without one, a `Navigate` item opens its target screen - its\n * parameters become route parameter bindings - and a `Dialog` item opens its target dialog template.\n */\nexport function toolbarItemDestination(properties: Record<string, unknown>): DestinationReference | undefined {\n if (isDestination(properties.destination)) return properties.destination;\n const kind = textProperty(properties, 'kind')?.toLowerCase();\n const target = textProperty(properties, 'target');\n if (!target) return undefined;\n // The renderer has already read each parameter's binding by the time the item sees it, so a parameter is a value.\n const routeParameterBindings = Object.fromEntries(Object.entries(recordProperty(properties, 'parameters'))\n .map(([name, value]) => [name, literal(value)])) as Record<string, BindingExpression>;\n if (kind === 'navigate') return { screen: target, routeParameterBindings };\n if (kind === 'dialog') return { kind: DestinationKind.Dialog, dialog: target, routeParameterBindings };\n return undefined;\n}\n\n/**\n * The `core:toolbar` component: the items a screen's toolbar groups, in the order they were authored.\n * The items are `core:toolbarItem` elements in its `items` slot.\n */\nexport function CoreToolbar({ element, slots }: RegisteredComponentProps) {\n const name = textProperty(element.properties, 'name');\n return <div data-scene-id={element.id} data-scene-toolbar={name} role='toolbar' aria-label={name}>{slots.items}</div>;\n}\n\n/**\n * The `core:toolbarItem` component: one toolbar entry with a label, an icon, presentation hints and what it does.\n *\n * - An `Action` item announces the command it targets with the host-neutral `cratis.scene.command` event, carrying its\n * parameters resolved against the binding scope.\n * - A `Navigate` or `Dialog` item executes its destination through the enclosing navigation host - a screen in an\n * outlet, a dialog - and, outside one, announces it with the host-neutral `cratis.scene.navigate` event.\n *\n * Presentation: `mode` is `icon`, `text` or `both` (the default); an icon-only item keeps its label as its accessible name.\n * Every presentation hint - `placement`, `density` or whatever a package reads - is also carried on the node as a\n * `data-scene-presentation-<name>` attribute so a theme can style by it.\n */\nexport function CoreToolbarItem({ element }: RegisteredComponentProps) {\n const navigation = useContext(SceneNavigationContextInternal);\n const scope = useRenderBindingScope();\n const name = textProperty(element.properties, 'name') ?? element.id;\n const kind = textProperty(element.properties, 'kind')?.toLowerCase();\n const target = textProperty(element.properties, 'target') ?? '';\n const label = textProperty(element.properties, 'label') ?? name;\n const icon = textProperty(element.properties, 'icon');\n const presentation = recordProperty(element.properties, 'presentation');\n const mode = toolbarItemMode(presentation);\n const destination = toolbarItemDestination(element.properties);\n const attributes = Object.fromEntries(Object.entries(presentation)\n .filter(([key]) => /^[A-Za-z][A-Za-z0-9-]*$/.test(key))\n .map(([key, value]) => [`data-scene-presentation-${key.toLowerCase()}`, String(value)]));\n\n const activate = () => {\n if (kind === 'action') {\n const args = resolveParameters(recordProperty(element.properties, 'parameters'), scope);\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command: target, element, arguments: args } }));\n return;\n }\n\n if (!destination) return;\n const resolved = withResolvedParameters(destination, scope);\n if (navigation) {\n navigation.navigate(resolved);\n } else {\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', {\n detail: { targetScreen: destination.screen ?? '', dialog: destination.dialog, destination: resolved, element },\n }));\n }\n };\n\n return (\n <button\n type='button'\n data-scene-id={element.id}\n data-scene-toolbar-item={name}\n data-scene-icon={icon}\n data-scene-mode={mode}\n aria-label={mode === 'icon' ? label : undefined}\n title={mode === 'icon' ? label : undefined}\n disabled={kind !== 'action' && !destination}\n onClick={activate}\n {...attributes}\n >\n {mode !== 'text' && icon && <span aria-hidden='true' data-scene-icon-name={icon} />}\n {mode !== 'icon' && label}\n </button>\n );\n}\n"],"names":["textProperty","properties","name","undefined","recordProperty","value","Array","isArray","isDestination","some","key","isBinding","path","literal","kind","BindingSourceKind","Literal","resolveParameters","parameters","scope","Object","fromEntries","entries","map","binding","resolveBindingExpression","withResolvedParameters","destination","bindings","routeParameterBindings","toolbarItemMode","presentation","mode","toolbarItemDestination","toLowerCase","target","screen","DestinationKind","Dialog","dialog","CoreToolbar","element","slots","_jsx","div","data-scene-id","id","data-scene-toolbar","role","aria-label","items","CoreToolbarItem","navigation","useContext","SceneNavigationContextInternal","useRenderBindingScope","label","icon","attributes","filter","test","String","activate","args","globalThis","dispatchEvent","CustomEvent","detail","command","arguments","resolved","navigate","targetScreen","_jsxs","button","type","data-scene-toolbar-item","data-scene-icon","data-scene-mode","title","disabled","onClick","span","aria-hidden","data-scene-icon-name"],"mappings":";;;;;;;;;AAYA,SAASA,YAAAA,CAAaC,UAAmC,EAAEC,IAAY,EAAA;IACnE,OAAO,OAAOD,UAAU,CAACC,IAAAA,CAAK,KAAK,QAAA,GAAWD,UAAU,CAACC,IAAAA,CAAK,GAAGC,SAAAA;AACrE;AAEA,SAASC,cAAAA,CAAeH,UAAmC,EAAEC,IAAY,EAAA;IACrE,MAAMG,KAAAA,GAAQJ,UAAU,CAACC,IAAAA,CAAK;IAC9B,OAAOG,KAAAA,KAAU,IAAA,IAAQ,OAAOA,KAAAA,KAAU,QAAA,IAAY,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,GAASA,KAAAA,GAAmC,EAAC;AACtH;AAEA,SAASG,cAAcH,KAAc,EAAA;IACjC,IAAIA,KAAAA,KAAU,QAAQ,OAAOA,KAAAA,KAAU,YAAYC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO,KAAA;IAChF,OAAO;AAAC,QAAA,QAAA;AAAU,QAAA,QAAA;AAAU,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA;KAAS,CAACI,IAAI,CAACC,CAAAA,GAAAA,GAAO,OAAO,KAAkC,CAACA,GAAAA,CAAI,KAAK,QAAA,CAAA;AAC5H;AAEA,SAASC,UAAUN,KAAc,EAAA;IAC7B,OAAOA,KAAAA,KAAU,QAAQ,OAAOA,KAAAA,KAAU,YAAY,OAAQA,KAAAA,CAA4BO,IAAI,KAAK,QAAA;AACvG;AAEA,SAASC,QAAQR,KAAc,EAAA;IAC3B,OAAO;AAAES,QAAAA,IAAAA,EAAMC,kBAAkBC,OAAO;QAAEJ,IAAAA,EAAM,EAAA;AAAIP,QAAAA;AAAM,KAAA;AAC9D;AAEA,SAASY,iBAAAA,CAAkBC,UAAmC,EAAEC,KAAmB,EAAA;AAC/E,IAAA,OAAOC,MAA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AU;;YAEb1B,IAAAA,KAAS,MAAA,IAAUyB,sBAAQd,GAAA,CAACuC,MAAAA,EAAAA;gBAAKC,aAAAA,EAAY,MAAA;gBAAOC,sBAAAA,EAAsB3B;;AAC1EzB,YAAAA,IAAAA,KAAS,MAAA,IAAUwB;;;AAGhC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreComponents.d.ts","sourceRoot":"","sources":["../../../core/coreComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"coreComponents.d.ts","sourceRoot":"","sources":["../../../core/coreComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA0BhD,eAAO,MAAM,cAAc,EAAE,iBAmB5B,CAAC"}
|
|
@@ -11,6 +11,7 @@ import { CoreText } from './CoreText.js';
|
|
|
11
11
|
import { CoreButton } from './CoreButton.js';
|
|
12
12
|
import { CoreCard } from './CoreCard.js';
|
|
13
13
|
import { CoreNavigationBar } from './CoreNavigationBar.js';
|
|
14
|
+
import { CoreToolbarItem, CoreToolbar } from './CoreToolbar.js';
|
|
14
15
|
import { CoreFile, CoreCode, CoreField, CoreSummary, CoreColumn, CoreTable, CoreTitle, CoreNavigate, CoreSection, CoreAction, CoreData } from './ScreenplayCoreComponents.js';
|
|
15
16
|
|
|
16
17
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -34,7 +35,9 @@ import { CoreFile, CoreCode, CoreField, CoreSummary, CoreColumn, CoreTable, Core
|
|
|
34
35
|
[componentRegistryKey('core', 'code')]: CoreCode,
|
|
35
36
|
[componentRegistryKey('core', 'file')]: CoreFile,
|
|
36
37
|
[componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,
|
|
37
|
-
[componentRegistryKey('core', 'outlet')]: CoreOutlet
|
|
38
|
+
[componentRegistryKey('core', 'outlet')]: CoreOutlet,
|
|
39
|
+
[componentRegistryKey('core', 'toolbar')]: CoreToolbar,
|
|
40
|
+
[componentRegistryKey('core', 'toolbarItem')]: CoreToolbarItem
|
|
38
41
|
};
|
|
39
42
|
|
|
40
43
|
export { coreComponents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreComponents.js","sources":["../../../core/coreComponents.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 { ComponentRegistry } from '../renderer';\nimport { componentRegistryKey } from '../packages';\nimport { CoreText } from './CoreText';\nimport { CoreButton } from './CoreButton';\nimport { CoreCard } from './CoreCard';\nimport { CoreNavigationBar } from './CoreNavigationBar';\nimport { CoreOutlet } from '../navigation/CoreOutlet';\nimport {\n CoreAction,\n CoreCode,\n CoreColumn,\n CoreData,\n CoreField,\n CoreFile,\n CoreNavigate,\n CoreSection,\n CoreSummary,\n CoreTable,\n CoreTitle,\n} from './ScreenplayCoreComponents';\n\n/**\n * The `core` package's component registry - the final fallback every `ui profile` resolves against\n * regardless of which other packages it lists (Scene#3).\n */\nexport const coreComponents: ComponentRegistry = {\n [componentRegistryKey('core', 'text')]: CoreText,\n [componentRegistryKey('core', 'button')]: CoreButton,\n [componentRegistryKey('core', 'card')]: CoreCard,\n [componentRegistryKey('core', 'data')]: CoreData,\n [componentRegistryKey('core', 'action')]: CoreAction,\n [componentRegistryKey('core', 'section')]: CoreSection,\n [componentRegistryKey('core', 'navigate')]: CoreNavigate,\n [componentRegistryKey('core', 'title')]: CoreTitle,\n [componentRegistryKey('core', 'table')]: CoreTable,\n [componentRegistryKey('core', 'column')]: CoreColumn,\n [componentRegistryKey('core', 'summary')]: CoreSummary,\n [componentRegistryKey('core', 'field')]: CoreField,\n [componentRegistryKey('core', 'code')]: CoreCode,\n [componentRegistryKey('core', 'file')]: CoreFile,\n [componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,\n [componentRegistryKey('core', 'outlet')]: CoreOutlet,\n};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar","CoreOutlet"],"mappings":"
|
|
1
|
+
{"version":3,"file":"coreComponents.js","sources":["../../../core/coreComponents.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 { ComponentRegistry } from '../renderer';\nimport { componentRegistryKey } from '../packages';\nimport { CoreText } from './CoreText';\nimport { CoreButton } from './CoreButton';\nimport { CoreCard } from './CoreCard';\nimport { CoreNavigationBar } from './CoreNavigationBar';\nimport { CoreToolbar, CoreToolbarItem } from './CoreToolbar';\nimport { CoreOutlet } from '../navigation/CoreOutlet';\nimport {\n CoreAction,\n CoreCode,\n CoreColumn,\n CoreData,\n CoreField,\n CoreFile,\n CoreNavigate,\n CoreSection,\n CoreSummary,\n CoreTable,\n CoreTitle,\n} from './ScreenplayCoreComponents';\n\n/**\n * The `core` package's component registry - the final fallback every `ui profile` resolves against\n * regardless of which other packages it lists (Scene#3).\n */\nexport const coreComponents: ComponentRegistry = {\n [componentRegistryKey('core', 'text')]: CoreText,\n [componentRegistryKey('core', 'button')]: CoreButton,\n [componentRegistryKey('core', 'card')]: CoreCard,\n [componentRegistryKey('core', 'data')]: CoreData,\n [componentRegistryKey('core', 'action')]: CoreAction,\n [componentRegistryKey('core', 'section')]: CoreSection,\n [componentRegistryKey('core', 'navigate')]: CoreNavigate,\n [componentRegistryKey('core', 'title')]: CoreTitle,\n [componentRegistryKey('core', 'table')]: CoreTable,\n [componentRegistryKey('core', 'column')]: CoreColumn,\n [componentRegistryKey('core', 'summary')]: CoreSummary,\n [componentRegistryKey('core', 'field')]: CoreField,\n [componentRegistryKey('core', 'code')]: CoreCode,\n [componentRegistryKey('core', 'file')]: CoreFile,\n [componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,\n [componentRegistryKey('core', 'outlet')]: CoreOutlet,\n [componentRegistryKey('core', 'toolbar')]: CoreToolbar,\n [componentRegistryKey('core', 'toolbarItem')]: CoreToolbarItem,\n};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar","CoreOutlet","CoreToolbar","CoreToolbarItem"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AAwBA;;;UAIaA,cAAAA,GAAoC;IAC7C,CAACC,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,QAAAA;IACxC,CAACD,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,UAAAA;IAC1C,CAACF,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG,QAAAA;IACxC,CAACH,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUI,QAAAA;IACxC,CAACJ,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYK,UAAAA;IAC1C,CAACL,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaM,WAAAA;IAC3C,CAACN,oBAAAA,CAAqB,MAAA,EAAQ,UAAA,CAAA,GAAcO,YAAAA;IAC5C,CAACP,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWQ,SAAAA;IACzC,CAACR,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWS,SAAAA;IACzC,CAACT,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYU,UAAAA;IAC1C,CAACV,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaW,WAAAA;IAC3C,CAACX,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWY,SAAAA;IACzC,CAACZ,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUa,QAAAA;IACxC,CAACb,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUc,QAAAA;IACxC,CAACd,oBAAAA,CAAqB,MAAA,EAAQ,eAAA,CAAA,GAAmBe,iBAAAA;IACjD,CAACf,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYgB,UAAAA;IAC1C,CAAChB,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaiB,WAAAA;IAC3C,CAACjB,oBAAAA,CAAqB,MAAA,EAAQ,aAAA,CAAA,GAAiBkB;AACnD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corePackage.d.ts","sourceRoot":"","sources":["../../../core/corePackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWjD,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"corePackage.d.ts","sourceRoot":"","sources":["../../../core/corePackage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAWjD,eAAO,MAAM,mBAAmB,EAAE,YAkCjC,CAAC;AAKF,eAAO,MAAM,WAAW,EAAE,kBAIzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '../packages';\nimport { coreComponents } from './coreComponents';\nimport { coreDescriptors } from './coreDescriptors';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n 'navigationBar',\n 'outlet',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,eAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,cAAAA;IACZC,WAAAA,EAAaC;AACjB;;"}
|
|
1
|
+
{"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '../packages';\nimport { coreComponents } from './coreComponents';\nimport { coreDescriptors } from './coreDescriptors';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n 'navigationBar',\n 'outlet',\n 'toolbar',\n 'toolbarItem',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,eAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,cAAAA;IACZC,WAAAA,EAAaC;AACjB;;"}
|
package/dist/esm/core/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './CoreText';
|
|
|
2
2
|
export * from './CoreButton';
|
|
3
3
|
export * from './CoreCard';
|
|
4
4
|
export * from './CoreNavigationBar';
|
|
5
|
+
export * from './CoreToolbar';
|
|
5
6
|
export * from './coreDescriptors';
|
|
6
7
|
export * from './ScreenplayCoreComponents';
|
|
7
8
|
export * from './coreComponents';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
package/dist/esm/core/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './CoreText';
|
|
|
2
2
|
export * from './CoreButton';
|
|
3
3
|
export * from './CoreCard';
|
|
4
4
|
export * from './CoreNavigationBar';
|
|
5
|
+
export * from './CoreToolbar';
|
|
5
6
|
export * from './coreDescriptors';
|
|
6
7
|
export * from './ScreenplayCoreComponents';
|
|
7
8
|
export * from './coreComponents';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { CoreText } from './core/CoreText.js';
|
|
|
12
12
|
export { CoreButton } from './core/CoreButton.js';
|
|
13
13
|
export { CoreCard } from './core/CoreCard.js';
|
|
14
14
|
export { CoreNavigationBar } from './core/CoreNavigationBar.js';
|
|
15
|
+
export { CoreToolbar, CoreToolbarItem, toolbarItemDestination, toolbarItemMode } from './core/CoreToolbar.js';
|
|
15
16
|
export { coreDescriptors } from './core/coreDescriptors.js';
|
|
16
17
|
export { CoreAction, CoreCode, CoreColumn, CoreData, CoreField, CoreFile, CoreNavigate, CoreSection, CoreSummary, CoreTable, CoreTitle } from './core/ScreenplayCoreComponents.js';
|
|
17
18
|
export { coreComponents } from './core/coreComponents.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|