@cratis/scene.components 4.16.0 → 4.17.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/cratisComponentsDescriptors.ts +16 -0
- package/dist/cjs/cratisComponentsDescriptors.js +68 -1
- package/dist/cjs/cratisComponentsDescriptors.js.map +1 -1
- package/dist/cjs/toolbar/SceneToolbarButton.js +34 -2
- package/dist/cjs/toolbar/SceneToolbarButton.js.map +1 -1
- package/dist/esm/cratisComponentsDescriptors.d.ts.map +1 -1
- package/dist/esm/cratisComponentsDescriptors.js +68 -1
- package/dist/esm/cratisComponentsDescriptors.js.map +1 -1
- package/dist/esm/toolbar/SceneToolbarButton.d.ts +1 -1
- package/dist/esm/toolbar/SceneToolbarButton.d.ts.map +1 -1
- package/dist/esm/toolbar/SceneToolbarButton.js +34 -2
- package/dist/esm/toolbar/SceneToolbarButton.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/toolbar/SceneToolbarButton.tsx +24 -2
|
@@ -87,6 +87,21 @@ const commandFormProperties: PropertyDescriptor[] = [
|
|
|
87
87
|
* Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the
|
|
88
88
|
* same way it adds a component to the manifest.
|
|
89
89
|
*/
|
|
90
|
+
const toolbarButtonProperties: PropertyDescriptor[] = [
|
|
91
|
+
{ path: 'title', label: 'Label', group: 'Content', valueType: PropertyValueType.String, description: 'The accessible name and tooltip.' },
|
|
92
|
+
{ path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'icon' },
|
|
93
|
+
{ path: 'text', label: 'Text', group: 'Content', valueType: PropertyValueType.String, description: 'Short text shown instead of the icon.' },
|
|
94
|
+
{ path: 'active', label: 'Active', group: 'Presentation', valueType: PropertyValueType.Boolean, default: false },
|
|
95
|
+
{
|
|
96
|
+
path: 'tooltipPosition', label: 'Tooltip position', group: 'Presentation', valueType: PropertyValueType.Enum, default: 'right',
|
|
97
|
+
choices: [{ value: 'top', label: 'Top' }, { value: 'right', label: 'Right' }, { value: 'bottom', label: 'Bottom' }, { value: 'left', label: 'Left' }],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
path: 'destination', label: 'Destination', group: 'Navigation', valueType: PropertyValueType.Destination,
|
|
101
|
+
description: 'The screen, slice or dialog the button opens - executed by the enclosing navigation host.',
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
|
|
90
105
|
export const cratisComponentsDescriptors: ComponentDescriptor[] = [
|
|
91
106
|
{ component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },
|
|
92
107
|
{ component: key('table'), displayName: 'Table', properties: dataTableProperties },
|
|
@@ -104,4 +119,5 @@ export const cratisComponentsDescriptors: ComponentDescriptor[] = [
|
|
|
104
119
|
description: 'Creates a deterministic editable field layout from the selected command metadata.',
|
|
105
120
|
}],
|
|
106
121
|
},
|
|
122
|
+
{ component: key('toolbarButton'), displayName: 'Toolbar button', properties: toolbarButtonProperties },
|
|
107
123
|
];
|
|
@@ -230,7 +230,69 @@ const commandFormProperties = [
|
|
|
230
230
|
* Only the query-bound tables are described so far; the form, dialog and editor composites carry
|
|
231
231
|
* Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the
|
|
232
232
|
* same way it adds a component to the manifest.
|
|
233
|
-
*/ const
|
|
233
|
+
*/ const toolbarButtonProperties = [
|
|
234
|
+
{
|
|
235
|
+
path: 'title',
|
|
236
|
+
label: 'Label',
|
|
237
|
+
group: 'Content',
|
|
238
|
+
valueType: scene_model.PropertyValueType.String,
|
|
239
|
+
description: 'The accessible name and tooltip.'
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
path: 'icon',
|
|
243
|
+
label: 'Icon',
|
|
244
|
+
group: 'Content',
|
|
245
|
+
valueType: scene_model.PropertyValueType.Icon,
|
|
246
|
+
editorKind: 'icon'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
path: 'text',
|
|
250
|
+
label: 'Text',
|
|
251
|
+
group: 'Content',
|
|
252
|
+
valueType: scene_model.PropertyValueType.String,
|
|
253
|
+
description: 'Short text shown instead of the icon.'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
path: 'active',
|
|
257
|
+
label: 'Active',
|
|
258
|
+
group: 'Presentation',
|
|
259
|
+
valueType: scene_model.PropertyValueType.Boolean,
|
|
260
|
+
default: false
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
path: 'tooltipPosition',
|
|
264
|
+
label: 'Tooltip position',
|
|
265
|
+
group: 'Presentation',
|
|
266
|
+
valueType: scene_model.PropertyValueType.Enum,
|
|
267
|
+
default: 'right',
|
|
268
|
+
choices: [
|
|
269
|
+
{
|
|
270
|
+
value: 'top',
|
|
271
|
+
label: 'Top'
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
value: 'right',
|
|
275
|
+
label: 'Right'
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
value: 'bottom',
|
|
279
|
+
label: 'Bottom'
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
value: 'left',
|
|
283
|
+
label: 'Left'
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
path: 'destination',
|
|
289
|
+
label: 'Destination',
|
|
290
|
+
group: 'Navigation',
|
|
291
|
+
valueType: scene_model.PropertyValueType.Destination,
|
|
292
|
+
description: 'The screen, slice or dialog the button opens - executed by the enclosing navigation host.'
|
|
293
|
+
}
|
|
294
|
+
];
|
|
295
|
+
const cratisComponentsDescriptors = [
|
|
234
296
|
{
|
|
235
297
|
component: key('dataTable'),
|
|
236
298
|
displayName: 'Data table',
|
|
@@ -260,6 +322,11 @@ const commandFormProperties = [
|
|
|
260
322
|
description: 'Creates a deterministic editable field layout from the selected command metadata.'
|
|
261
323
|
}
|
|
262
324
|
]
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
component: key('toolbarButton'),
|
|
328
|
+
displayName: 'Toolbar button',
|
|
329
|
+
properties: toolbarButtonProperties
|
|
263
330
|
}
|
|
264
331
|
];
|
|
265
332
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cratisComponentsDescriptors.js","sources":["../../cratisComponentsDescriptors.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 { BindingMode, BindingSourceKind, ComponentDescriptor, DesignTimeActionPlacement, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';\nimport { componentRegistryKey } from '@cratis/scene.react';\n\n// The package name, spelled out so describing components does not pull every adapter (and its UI dependencies) in\n// with it; the bundle's validation checks each key against the manifest.\nconst key = (name: string) => componentRegistryKey('Cratis.Components', name);\n\n/**\n * The properties every query-bound data table shares: which query feeds it, and the few settings that shape how\n * it shows the result.\n *\n * `query` is a `QueryReference`, so an editor binds it to a host-supplied query candidate and validates the\n * arguments against it. What is stored is a `QueryBinding`; a plain query name - what screens carried before\n * bindings existed - is still read, as a binding with no explicit connections. The columns are not properties:\n * they are the `content` slot's children, edited as nodes.\n */\nconst dataTableProperties: PropertyDescriptor[] = [\n {\n path: 'query', label: 'Query', group: 'Data', valueType: PropertyValueType.QueryReference, editorKind: 'queryBinding',\n description: 'The collection query that feeds the table.',\n constraints: { required: true, resultShapes: [QueryResultShape.Collection] },\n },\n { path: 'emptyMessage', label: 'Empty message', group: 'Content', valueType: PropertyValueType.String, default: '' },\n {\n path: 'dataKey', label: 'Row identity', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField',\n description: 'The result field that identifies a row.',\n },\n {\n path: 'globalFilterFields', label: 'Searchable fields', group: 'Data', valueType: PropertyValueType.Object, editorKind: 'resultFieldList',\n description: 'The result fields the table\\'s search box looks in.',\n },\n {\n path: 'selectedItem', label: 'Selected item', group: 'Outputs', valueType: PropertyValueType.Object, readOnly: true,\n output: true, bindingMode: BindingMode.OneWay,\n description: 'The currently selected row, or null after selection is cleared.',\n },\n];\n\nconst commandFormProperties: PropertyDescriptor[] = [\n {\n path: 'command', label: 'Command', group: 'Command', valueType: PropertyValueType.String, editorKind: 'commandBinding',\n constraints: { required: true },\n description: 'The Arc command proxy rendered through the native command form runtime.',\n },\n {\n path: 'mode', label: 'Mode', group: 'Layout', valueType: PropertyValueType.Enum,\n choices: [{ value: 'auto', label: 'Auto' }, { value: 'manual', label: 'Manual' }], default: 'auto',\n description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.',\n },\n { path: 'columns', label: 'Legacy columns', group: 'Layout', valueType: PropertyValueType.Number, default: 1, description: 'Backward-compatible column count used when no typed layout metadata is authored.' },\n { path: 'layout', label: 'Layout', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormLayout', description: 'Typed command-form geometry: columns, gaps and field placements. Independent of auto/manual field generation.' },\n {\n path: 'widthSizeClass', label: 'Width size class', group: 'Layout', valueType: PropertyValueType.Enum, default: 'Regular',\n choices: [{ value: 'Regular', label: 'Regular' }, { value: 'Compact', label: 'Compact' }],\n description: 'The width size class the host evaluated. At Compact the fields of a manual form stack in one column in reading order.',\n },\n { path: 'fieldWidths', label: 'Legacy field widths', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'fieldWidths' },\n {\n path: 'inputs', label: 'Fields', group: 'Layout', valueType: PropertyValueType.Collection, editorKind: 'commandFields',\n acceptedBindingKinds: [BindingSourceKind.DataContext, BindingSourceKind.ComponentProperty],\n item: {\n label: 'Field',\n properties: [\n { path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String },\n { path: 'type', label: 'Type', group: 'Field', valueType: PropertyValueType.Enum, choices: [{ value: 'string', label: 'String' }, { value: 'guid', label: 'Guid' }] },\n { path: 'label', label: 'Label', group: 'Field', valueType: PropertyValueType.String },\n { path: 'column', label: 'Legacy column', group: 'Layout', valueType: PropertyValueType.Number },\n { path: 'width', label: 'Legacy width token', group: 'Layout', valueType: PropertyValueType.String },\n { path: 'placement', label: 'Placement', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormFieldPlacement' },\n ],\n },\n },\n {\n path: 'exclude', label: 'Excluded fields', group: 'Command', valueType: PropertyValueType.Collection,\n item: { label: 'Excluded field', properties: [{ path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String }] },\n },\n { path: 'submitLabel', label: 'Submit label', group: 'Content', valueType: PropertyValueType.String, default: 'Submit' },\n];\n\n/**\n * What can be edited on the `Cratis.Components` package's components.\n *\n * Only the query-bound tables are described so far; the form, dialog and editor composites carry\n * Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the\n * same way it adds a component to the manifest.\n */\nexport const cratisComponentsDescriptors: ComponentDescriptor[] = [\n { component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },\n { component: key('table'), displayName: 'Table', properties: dataTableProperties },\n { component: key('observableDataTable'), displayName: 'Live data table', properties: dataTableProperties },\n {\n component: key('commandForm'),\n displayName: 'Command form',\n editorKind: 'commandFormDesigner',\n properties: commandFormProperties,\n actions: [{\n id: 'Cratis.Components.commandForm.generateFields',\n label: 'Generate fields',\n placement: DesignTimeActionPlacement.Toolbar,\n availability: 'commandForm.canGenerateFields',\n description: 'Creates a deterministic editable field layout from the selected command metadata.',\n }],\n },\n];\n"],"names":["key","name","componentRegistryKey","dataTableProperties","path","label","group","valueType","PropertyValueType","QueryReference","editorKind","description","constraints","required","resultShapes","QueryResultShape","Collection","String","default","Object","readOnly","output","bindingMode","BindingMode","OneWay","commandFormProperties","Enum","choices","value","Number","acceptedBindingKinds","BindingSourceKind","DataContext","ComponentProperty","item","properties","cratisComponentsDescriptors","component","displayName","actions","id","placement","DesignTimeActionPlacement","Toolbar","availability"],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,gCAAAA,CAAqB,mBAAA,EAAqBD,IAAAA,CAAAA;AAExE;;;;;;;;AAQC,IACD,MAAME,mBAAAA,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,IAAA;AAAEkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,OAAA,CAAA;QAAUsC,WAAAA,EAAa,OAAA;QAASH,UAAAA,EAAYhC;AAAoB,KAAA;AACjF,IAAA;AAAEkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,qBAAA,CAAA;QAAwBsC,WAAAA,EAAa,iBAAA;QAAmBH,UAAAA,EAAYhC;AAAoB,KAAA;AACzG,IAAA;AACIkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,aAAA,CAAA;QACfsC,WAAAA,EAAa,cAAA;QACb5B,UAAAA,EAAY,qBAAA;QACZyB,UAAAA,EAAYV,qBAAAA;QACZc,OAAAA,EAAS;AAAC,YAAA;gBACNC,EAAAA,EAAI,8CAAA;gBACJnC,KAAAA,EAAO,iBAAA;AACPoC,gBAAAA,SAAAA,EAAWC,sCAA0BC,OAAO;gBAC5CC,YAAAA,EAAc,+BAAA;gBACdjC,WAAAA,EAAa;AACjB;AAAE;AACN;;;"}
|
|
1
|
+
{"version":3,"file":"cratisComponentsDescriptors.js","sources":["../../cratisComponentsDescriptors.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 { BindingMode, BindingSourceKind, ComponentDescriptor, DesignTimeActionPlacement, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';\nimport { componentRegistryKey } from '@cratis/scene.react';\n\n// The package name, spelled out so describing components does not pull every adapter (and its UI dependencies) in\n// with it; the bundle's validation checks each key against the manifest.\nconst key = (name: string) => componentRegistryKey('Cratis.Components', name);\n\n/**\n * The properties every query-bound data table shares: which query feeds it, and the few settings that shape how\n * it shows the result.\n *\n * `query` is a `QueryReference`, so an editor binds it to a host-supplied query candidate and validates the\n * arguments against it. What is stored is a `QueryBinding`; a plain query name - what screens carried before\n * bindings existed - is still read, as a binding with no explicit connections. The columns are not properties:\n * they are the `content` slot's children, edited as nodes.\n */\nconst dataTableProperties: PropertyDescriptor[] = [\n {\n path: 'query', label: 'Query', group: 'Data', valueType: PropertyValueType.QueryReference, editorKind: 'queryBinding',\n description: 'The collection query that feeds the table.',\n constraints: { required: true, resultShapes: [QueryResultShape.Collection] },\n },\n { path: 'emptyMessage', label: 'Empty message', group: 'Content', valueType: PropertyValueType.String, default: '' },\n {\n path: 'dataKey', label: 'Row identity', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField',\n description: 'The result field that identifies a row.',\n },\n {\n path: 'globalFilterFields', label: 'Searchable fields', group: 'Data', valueType: PropertyValueType.Object, editorKind: 'resultFieldList',\n description: 'The result fields the table\\'s search box looks in.',\n },\n {\n path: 'selectedItem', label: 'Selected item', group: 'Outputs', valueType: PropertyValueType.Object, readOnly: true,\n output: true, bindingMode: BindingMode.OneWay,\n description: 'The currently selected row, or null after selection is cleared.',\n },\n];\n\nconst commandFormProperties: PropertyDescriptor[] = [\n {\n path: 'command', label: 'Command', group: 'Command', valueType: PropertyValueType.String, editorKind: 'commandBinding',\n constraints: { required: true },\n description: 'The Arc command proxy rendered through the native command form runtime.',\n },\n {\n path: 'mode', label: 'Mode', group: 'Layout', valueType: PropertyValueType.Enum,\n choices: [{ value: 'auto', label: 'Auto' }, { value: 'manual', label: 'Manual' }], default: 'auto',\n description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.',\n },\n { path: 'columns', label: 'Legacy columns', group: 'Layout', valueType: PropertyValueType.Number, default: 1, description: 'Backward-compatible column count used when no typed layout metadata is authored.' },\n { path: 'layout', label: 'Layout', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormLayout', description: 'Typed command-form geometry: columns, gaps and field placements. Independent of auto/manual field generation.' },\n {\n path: 'widthSizeClass', label: 'Width size class', group: 'Layout', valueType: PropertyValueType.Enum, default: 'Regular',\n choices: [{ value: 'Regular', label: 'Regular' }, { value: 'Compact', label: 'Compact' }],\n description: 'The width size class the host evaluated. At Compact the fields of a manual form stack in one column in reading order.',\n },\n { path: 'fieldWidths', label: 'Legacy field widths', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'fieldWidths' },\n {\n path: 'inputs', label: 'Fields', group: 'Layout', valueType: PropertyValueType.Collection, editorKind: 'commandFields',\n acceptedBindingKinds: [BindingSourceKind.DataContext, BindingSourceKind.ComponentProperty],\n item: {\n label: 'Field',\n properties: [\n { path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String },\n { path: 'type', label: 'Type', group: 'Field', valueType: PropertyValueType.Enum, choices: [{ value: 'string', label: 'String' }, { value: 'guid', label: 'Guid' }] },\n { path: 'label', label: 'Label', group: 'Field', valueType: PropertyValueType.String },\n { path: 'column', label: 'Legacy column', group: 'Layout', valueType: PropertyValueType.Number },\n { path: 'width', label: 'Legacy width token', group: 'Layout', valueType: PropertyValueType.String },\n { path: 'placement', label: 'Placement', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormFieldPlacement' },\n ],\n },\n },\n {\n path: 'exclude', label: 'Excluded fields', group: 'Command', valueType: PropertyValueType.Collection,\n item: { label: 'Excluded field', properties: [{ path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String }] },\n },\n { path: 'submitLabel', label: 'Submit label', group: 'Content', valueType: PropertyValueType.String, default: 'Submit' },\n];\n\n/**\n * What can be edited on the `Cratis.Components` package's components.\n *\n * Only the query-bound tables are described so far; the form, dialog and editor composites carry\n * Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the\n * same way it adds a component to the manifest.\n */\nconst toolbarButtonProperties: PropertyDescriptor[] = [\n { path: 'title', label: 'Label', group: 'Content', valueType: PropertyValueType.String, description: 'The accessible name and tooltip.' },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'icon' },\n { path: 'text', label: 'Text', group: 'Content', valueType: PropertyValueType.String, description: 'Short text shown instead of the icon.' },\n { path: 'active', label: 'Active', group: 'Presentation', valueType: PropertyValueType.Boolean, default: false },\n {\n path: 'tooltipPosition', label: 'Tooltip position', group: 'Presentation', valueType: PropertyValueType.Enum, default: 'right',\n choices: [{ value: 'top', label: 'Top' }, { value: 'right', label: 'Right' }, { value: 'bottom', label: 'Bottom' }, { value: 'left', label: 'Left' }],\n },\n {\n path: 'destination', label: 'Destination', group: 'Navigation', valueType: PropertyValueType.Destination,\n description: 'The screen, slice or dialog the button opens - executed by the enclosing navigation host.',\n },\n];\n\nexport const cratisComponentsDescriptors: ComponentDescriptor[] = [\n { component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },\n { component: key('table'), displayName: 'Table', properties: dataTableProperties },\n { component: key('observableDataTable'), displayName: 'Live data table', properties: dataTableProperties },\n {\n component: key('commandForm'),\n displayName: 'Command form',\n editorKind: 'commandFormDesigner',\n properties: commandFormProperties,\n actions: [{\n id: 'Cratis.Components.commandForm.generateFields',\n label: 'Generate fields',\n placement: DesignTimeActionPlacement.Toolbar,\n availability: 'commandForm.canGenerateFields',\n description: 'Creates a deterministic editable field layout from the selected command metadata.',\n }],\n },\n { component: key('toolbarButton'), displayName: 'Toolbar button', properties: toolbarButtonProperties },\n];\n"],"names":["key","name","componentRegistryKey","dataTableProperties","path","label","group","valueType","PropertyValueType","QueryReference","editorKind","description","constraints","required","resultShapes","QueryResultShape","Collection","String","default","Object","readOnly","output","bindingMode","BindingMode","OneWay","commandFormProperties","Enum","choices","value","Number","acceptedBindingKinds","BindingSourceKind","DataContext","ComponentProperty","item","properties","toolbarButtonProperties","Icon","Boolean","Destination","cratisComponentsDescriptors","component","displayName","actions","id","placement","DesignTimeActionPlacement","Toolbar","availability"],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,gCAAAA,CAAqB,mBAAA,EAAqBD,IAAAA,CAAAA;AAExE;;;;;;;;AAQC,IACD,MAAME,mBAAAA,GAA4C;AAC9C,IAAA;QACIC,IAAAA,EAAM,OAAA;QAASC,KAAAA,EAAO,OAAA;QAASC,KAAAA,EAAO,MAA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Ac0C,WAAAA,EAAa,YAAA;QAAcP,UAAAA,EAAYhC;AAAoB,KAAA;AAC1F,IAAA;AAAEsC,QAAAA,SAAAA,EAAWzC,GAAAA,CAAI,OAAA,CAAA;QAAU0C,WAAAA,EAAa,OAAA;QAASP,UAAAA,EAAYhC;AAAoB,KAAA;AACjF,IAAA;AAAEsC,QAAAA,SAAAA,EAAWzC,GAAAA,CAAI,qBAAA,CAAA;QAAwB0C,WAAAA,EAAa,iBAAA;QAAmBP,UAAAA,EAAYhC;AAAoB,KAAA;AACzG,IAAA;AACIsC,QAAAA,SAAAA,EAAWzC,GAAAA,CAAI,aAAA,CAAA;QACf0C,WAAAA,EAAa,cAAA;QACbhC,UAAAA,EAAY,qBAAA;QACZyB,UAAAA,EAAYV,qBAAAA;QACZkB,OAAAA,EAAS;AAAC,YAAA;gBACNC,EAAAA,EAAI,8CAAA;gBACJvC,KAAAA,EAAO,iBAAA;AACPwC,gBAAAA,SAAAA,EAAWC,sCAA0BC,OAAO;gBAC5CC,YAAAA,EAAc,+BAAA;gBACdrC,WAAAA,EAAa;AACjB;AAAE;AACN,KAAA;AACA,IAAA;AAAE8B,QAAAA,SAAAA,EAAWzC,GAAAA,CAAI,eAAA,CAAA;QAAkB0C,WAAAA,EAAa,gBAAA;QAAkBP,UAAAA,EAAYC;AAAwB;;;"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
4
5
|
var Toolbar = require('@cratis/components/Toolbar');
|
|
6
|
+
var scene_react = require('@cratis/scene.react');
|
|
5
7
|
var properties = require('../properties.js');
|
|
6
8
|
|
|
7
9
|
/** Which side of the button its tooltip appears on. */ const tooltipPositions = [
|
|
@@ -17,16 +19,46 @@ var properties = require('../properties.js');
|
|
|
17
19
|
* the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the
|
|
18
20
|
* icons. It defaults to the `text` property rather than to an empty string, so a button that has a
|
|
19
21
|
* visible label is never left nameless.
|
|
20
|
-
*/
|
|
22
|
+
*/ /**
|
|
23
|
+
* A toolbar button. Its authored `destination` - a screen in an outlet, or a dialog - is executed by the
|
|
24
|
+
* enclosing navigation host; outside one it is announced with the host-neutral `cratis.scene.navigate` event.
|
|
25
|
+
* Interactions attached by the document run first.
|
|
26
|
+
*/ function SceneToolbarButton({ element, interactions }) {
|
|
21
27
|
const text = properties.stringProperty(element.properties, 'text');
|
|
28
|
+
const navigation = react.useContext(scene_react.SceneNavigationContextInternal);
|
|
29
|
+
const destination = isDestination(element.properties.destination) ? element.properties.destination : undefined;
|
|
30
|
+
const onClick = ()=>{
|
|
31
|
+
interactions?.onClick?.({
|
|
32
|
+
stopPropagation: ()=>undefined
|
|
33
|
+
});
|
|
34
|
+
if (!destination) return;
|
|
35
|
+
if (navigation) navigation.navigate(destination);
|
|
36
|
+
else globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', {
|
|
37
|
+
detail: {
|
|
38
|
+
destination,
|
|
39
|
+
element
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
22
43
|
return /*#__PURE__*/ jsxRuntime.jsx(Toolbar.ToolbarButton, {
|
|
23
44
|
icon: properties.stringProperty(element.properties, 'icon'),
|
|
24
45
|
text: text,
|
|
25
46
|
title: properties.stringProperty(element.properties, 'title') ?? text ?? '',
|
|
26
47
|
active: properties.booleanProperty(element.properties, 'active'),
|
|
27
|
-
tooltipPosition: properties.unionProperty(element.properties, 'tooltipPosition', tooltipPositions)
|
|
48
|
+
tooltipPosition: properties.unionProperty(element.properties, 'tooltipPosition', tooltipPositions),
|
|
49
|
+
onClick: onClick
|
|
28
50
|
});
|
|
29
51
|
}
|
|
52
|
+
function isDestination(value) {
|
|
53
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
54
|
+
const candidate = value;
|
|
55
|
+
return [
|
|
56
|
+
'screen',
|
|
57
|
+
'module',
|
|
58
|
+
'route',
|
|
59
|
+
'dialog'
|
|
60
|
+
].some((key)=>typeof candidate[key] === 'string');
|
|
61
|
+
}
|
|
30
62
|
|
|
31
63
|
exports.SceneToolbarButton = SceneToolbarButton;
|
|
32
64
|
//# sourceMappingURL=SceneToolbarButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneToolbarButton.js","sources":["../../../toolbar/SceneToolbarButton.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 { ToolbarButton } from '@cratis/components/Toolbar';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty, unionProperty } from '../properties';\n\n/** Which side of the button its tooltip appears on. */\nconst tooltipPositions = ['top', 'right', 'bottom', 'left'] as const;\n\n/**\n * The `Cratis.Components:toolbarButton` component - `ToolbarButton` from `@cratis/components/Toolbar`.\n *\n * `title` is required by the underlying component and is not decoration: it is both the tooltip text and\n * the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the\n * icons. It defaults to the `text` property rather than to an empty string, so a button that has a\n * visible label is never left nameless.\n */\nexport function SceneToolbarButton({ element }: RegisteredComponentProps) {\n const text = stringProperty(element.properties, 'text');\n\n return (\n <ToolbarButton\n icon={stringProperty(element.properties, 'icon')}\n text={text}\n title={stringProperty(element.properties, 'title') ?? text ?? ''}\n active={booleanProperty(element.properties, 'active')}\n tooltipPosition={unionProperty(element.properties, 'tooltipPosition', tooltipPositions)}\n />\n );\n}\n"],"names":["tooltipPositions","SceneToolbarButton","element","text","stringProperty","properties","_jsx","ToolbarButton","icon","title","active","booleanProperty","tooltipPosition","unionProperty"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SceneToolbarButton.js","sources":["../../../toolbar/SceneToolbarButton.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 { ToolbarButton } from '@cratis/components/Toolbar';\nimport { DestinationReference } from '@cratis/scene.model';\nimport { RegisteredComponentProps, SceneNavigationContextInternal } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty, unionProperty } from '../properties';\n\n/** Which side of the button its tooltip appears on. */\nconst tooltipPositions = ['top', 'right', 'bottom', 'left'] as const;\n\n/**\n * The `Cratis.Components:toolbarButton` component - `ToolbarButton` from `@cratis/components/Toolbar`.\n *\n * `title` is required by the underlying component and is not decoration: it is both the tooltip text and\n * the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the\n * icons. It defaults to the `text` property rather than to an empty string, so a button that has a\n * visible label is never left nameless.\n */\n/**\n * A toolbar button. Its authored `destination` - a screen in an outlet, or a dialog - is executed by the\n * enclosing navigation host; outside one it is announced with the host-neutral `cratis.scene.navigate` event.\n * Interactions attached by the document run first.\n */\nexport function SceneToolbarButton({ element, interactions }: RegisteredComponentProps) {\n const text = stringProperty(element.properties, 'text');\n const navigation = useContext(SceneNavigationContextInternal);\n const destination = isDestination(element.properties.destination) ? element.properties.destination : undefined;\n const onClick = () => {\n interactions?.onClick?.({ stopPropagation: () => undefined });\n if (!destination) return;\n if (navigation) navigation.navigate(destination);\n else globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { destination, element } }));\n };\n\n return (\n <ToolbarButton\n icon={stringProperty(element.properties, 'icon')}\n text={text}\n title={stringProperty(element.properties, 'title') ?? text ?? ''}\n active={booleanProperty(element.properties, 'active')}\n tooltipPosition={unionProperty(element.properties, 'tooltipPosition', tooltipPositions)}\n onClick={onClick}\n />\n );\n}\n\nfunction isDestination(value: unknown): value is DestinationReference {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n const candidate = value as Record<string, unknown>;\n return ['screen', 'module', 'route', 'dialog'].some(key => typeof candidate[key] === 'string');\n}\n"],"names":["tooltipPositions","SceneToolbarButton","element","interactions","text","stringProperty","properties","navigation","useContext","SceneNavigationContextInternal","destination","isDestination","undefined","onClick","stopPropagation","navigate","globalThis","dispatchEvent","CustomEvent","detail","_jsx","ToolbarButton","icon","title","active","booleanProperty","tooltipPosition","unionProperty","value","Array","isArray","candidate","some","key"],"mappings":";;;;;;;;AASA,wDACA,MAAMA,gBAAAA,GAAmB;AAAC,IAAA,KAAA;AAAO,IAAA,OAAA;AAAS,IAAA,QAAA;AAAU,IAAA;AAAO,CAAA;AAE3D;;;;;;;;;;;AAYC,IACM,SAASC,kBAAAA,CAAmB,EAAEC,OAAO,EAAEC,YAAY,EAA4B,EAAA;AAClF,IAAA,MAAMC,IAAAA,GAAOC,yBAAAA,CAAeH,OAAAA,CAAQI,UAAU,EAAE,MAAA,CAAA;AAChD,IAAA,MAAMC,aAAaC,gBAAAA,CAAWC,0CAAAA,CAAAA;IAC9B,MAAMC,WAAAA,GAAcC,aAAAA,CAAcT,OAAAA,CAAQI,UAAU,CAACI,WAAW,CAAA,GAAIR,OAAAA,CAAQI,UAAU,CAACI,WAAW,GAAGE,SAAAA;AACrG,IAAA,MAAMC,OAAAA,GAAU,IAAA;AACZV,QAAAA,YAAAA,EAAcU,OAAAA,GAAU;AAAEC,YAAAA,eAAAA,EAAiB,IAAMF;AAAU,SAAA,CAAA;AAC3D,QAAA,IAAI,CAACF,WAAAA,EAAa;QAClB,IAAIH,UAAAA,EAAYA,UAAAA,CAAWQ,QAAQ,CAACL,WAAAA,CAAAA;AAC/BM,aAAAA,UAAAA,CAAWC,aAAa,CAAC,IAAIC,WAAAA,CAAY,uBAAA,EAAyB;YAAEC,MAAAA,EAAQ;AAAET,gBAAAA,WAAAA;AAAaR,gBAAAA;AAAQ;AAAE,SAAA,CAAA,CAAA;AAC9G,IAAA,CAAA;AAEA,IAAA,qBACIkB,cAAA,CAACC,qBAAAA,EAAAA;QACGC,IAAAA,EAAMjB,yBAAAA,CAAeH,OAAAA,CAAQI,UAAU,EAAE,MAAA,CAAA;QACzCF,IAAAA,EAAMA,IAAAA;AACNmB,QAAAA,KAAAA,EAAOlB,yBAAAA,CAAeH,OAAAA,CAAQI,UAAU,EAAE,YAAYF,IAAAA,IAAQ,EAAA;QAC9DoB,MAAAA,EAAQC,0BAAAA,CAAgBvB,OAAAA,CAAQI,UAAU,EAAE,QAAA,CAAA;AAC5CoB,QAAAA,eAAAA,EAAiBC,wBAAAA,CAAczB,OAAAA,CAAQI,UAAU,EAAE,iBAAA,EAAmBN,gBAAAA,CAAAA;QACtEa,OAAAA,EAASA;;AAGrB;AAEA,SAASF,cAAciB,KAAc,EAAA;IACjC,IAAIA,KAAAA,KAAU,QAAQ,OAAOA,KAAAA,KAAU,YAAYC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO,KAAA;AAChF,IAAA,MAAMG,SAAAA,GAAYH,KAAAA;IAClB,OAAO;AAAC,QAAA,QAAA;AAAU,QAAA,QAAA;AAAU,QAAA,OAAA;AAAS,QAAA;KAAS,CAACI,IAAI,CAACC,CAAAA,GAAAA,GAAO,OAAOF,SAAS,CAACE,IAAI,KAAK,QAAA,CAAA;AACzF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cratisComponentsDescriptors.d.ts","sourceRoot":"","sources":["../../cratisComponentsDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkC,mBAAmB,EAAsF,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"cratisComponentsDescriptors.d.ts","sourceRoot":"","sources":["../../cratisComponentsDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkC,mBAAmB,EAAsF,MAAM,qBAAqB,CAAC;AAqG9K,eAAO,MAAM,2BAA2B,EAAE,mBAAmB,EAkB5D,CAAC"}
|
|
@@ -228,7 +228,69 @@ const commandFormProperties = [
|
|
|
228
228
|
* Only the query-bound tables are described so far; the form, dialog and editor composites carry
|
|
229
229
|
* Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the
|
|
230
230
|
* same way it adds a component to the manifest.
|
|
231
|
-
*/ const
|
|
231
|
+
*/ const toolbarButtonProperties = [
|
|
232
|
+
{
|
|
233
|
+
path: 'title',
|
|
234
|
+
label: 'Label',
|
|
235
|
+
group: 'Content',
|
|
236
|
+
valueType: PropertyValueType.String,
|
|
237
|
+
description: 'The accessible name and tooltip.'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
path: 'icon',
|
|
241
|
+
label: 'Icon',
|
|
242
|
+
group: 'Content',
|
|
243
|
+
valueType: PropertyValueType.Icon,
|
|
244
|
+
editorKind: 'icon'
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
path: 'text',
|
|
248
|
+
label: 'Text',
|
|
249
|
+
group: 'Content',
|
|
250
|
+
valueType: PropertyValueType.String,
|
|
251
|
+
description: 'Short text shown instead of the icon.'
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
path: 'active',
|
|
255
|
+
label: 'Active',
|
|
256
|
+
group: 'Presentation',
|
|
257
|
+
valueType: PropertyValueType.Boolean,
|
|
258
|
+
default: false
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
path: 'tooltipPosition',
|
|
262
|
+
label: 'Tooltip position',
|
|
263
|
+
group: 'Presentation',
|
|
264
|
+
valueType: PropertyValueType.Enum,
|
|
265
|
+
default: 'right',
|
|
266
|
+
choices: [
|
|
267
|
+
{
|
|
268
|
+
value: 'top',
|
|
269
|
+
label: 'Top'
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
value: 'right',
|
|
273
|
+
label: 'Right'
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
value: 'bottom',
|
|
277
|
+
label: 'Bottom'
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
value: 'left',
|
|
281
|
+
label: 'Left'
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
path: 'destination',
|
|
287
|
+
label: 'Destination',
|
|
288
|
+
group: 'Navigation',
|
|
289
|
+
valueType: PropertyValueType.Destination,
|
|
290
|
+
description: 'The screen, slice or dialog the button opens - executed by the enclosing navigation host.'
|
|
291
|
+
}
|
|
292
|
+
];
|
|
293
|
+
const cratisComponentsDescriptors = [
|
|
232
294
|
{
|
|
233
295
|
component: key('dataTable'),
|
|
234
296
|
displayName: 'Data table',
|
|
@@ -258,6 +320,11 @@ const commandFormProperties = [
|
|
|
258
320
|
description: 'Creates a deterministic editable field layout from the selected command metadata.'
|
|
259
321
|
}
|
|
260
322
|
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
component: key('toolbarButton'),
|
|
326
|
+
displayName: 'Toolbar button',
|
|
327
|
+
properties: toolbarButtonProperties
|
|
261
328
|
}
|
|
262
329
|
];
|
|
263
330
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cratisComponentsDescriptors.js","sources":["../../cratisComponentsDescriptors.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 { BindingMode, BindingSourceKind, ComponentDescriptor, DesignTimeActionPlacement, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';\nimport { componentRegistryKey } from '@cratis/scene.react';\n\n// The package name, spelled out so describing components does not pull every adapter (and its UI dependencies) in\n// with it; the bundle's validation checks each key against the manifest.\nconst key = (name: string) => componentRegistryKey('Cratis.Components', name);\n\n/**\n * The properties every query-bound data table shares: which query feeds it, and the few settings that shape how\n * it shows the result.\n *\n * `query` is a `QueryReference`, so an editor binds it to a host-supplied query candidate and validates the\n * arguments against it. What is stored is a `QueryBinding`; a plain query name - what screens carried before\n * bindings existed - is still read, as a binding with no explicit connections. The columns are not properties:\n * they are the `content` slot's children, edited as nodes.\n */\nconst dataTableProperties: PropertyDescriptor[] = [\n {\n path: 'query', label: 'Query', group: 'Data', valueType: PropertyValueType.QueryReference, editorKind: 'queryBinding',\n description: 'The collection query that feeds the table.',\n constraints: { required: true, resultShapes: [QueryResultShape.Collection] },\n },\n { path: 'emptyMessage', label: 'Empty message', group: 'Content', valueType: PropertyValueType.String, default: '' },\n {\n path: 'dataKey', label: 'Row identity', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField',\n description: 'The result field that identifies a row.',\n },\n {\n path: 'globalFilterFields', label: 'Searchable fields', group: 'Data', valueType: PropertyValueType.Object, editorKind: 'resultFieldList',\n description: 'The result fields the table\\'s search box looks in.',\n },\n {\n path: 'selectedItem', label: 'Selected item', group: 'Outputs', valueType: PropertyValueType.Object, readOnly: true,\n output: true, bindingMode: BindingMode.OneWay,\n description: 'The currently selected row, or null after selection is cleared.',\n },\n];\n\nconst commandFormProperties: PropertyDescriptor[] = [\n {\n path: 'command', label: 'Command', group: 'Command', valueType: PropertyValueType.String, editorKind: 'commandBinding',\n constraints: { required: true },\n description: 'The Arc command proxy rendered through the native command form runtime.',\n },\n {\n path: 'mode', label: 'Mode', group: 'Layout', valueType: PropertyValueType.Enum,\n choices: [{ value: 'auto', label: 'Auto' }, { value: 'manual', label: 'Manual' }], default: 'auto',\n description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.',\n },\n { path: 'columns', label: 'Legacy columns', group: 'Layout', valueType: PropertyValueType.Number, default: 1, description: 'Backward-compatible column count used when no typed layout metadata is authored.' },\n { path: 'layout', label: 'Layout', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormLayout', description: 'Typed command-form geometry: columns, gaps and field placements. Independent of auto/manual field generation.' },\n {\n path: 'widthSizeClass', label: 'Width size class', group: 'Layout', valueType: PropertyValueType.Enum, default: 'Regular',\n choices: [{ value: 'Regular', label: 'Regular' }, { value: 'Compact', label: 'Compact' }],\n description: 'The width size class the host evaluated. At Compact the fields of a manual form stack in one column in reading order.',\n },\n { path: 'fieldWidths', label: 'Legacy field widths', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'fieldWidths' },\n {\n path: 'inputs', label: 'Fields', group: 'Layout', valueType: PropertyValueType.Collection, editorKind: 'commandFields',\n acceptedBindingKinds: [BindingSourceKind.DataContext, BindingSourceKind.ComponentProperty],\n item: {\n label: 'Field',\n properties: [\n { path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String },\n { path: 'type', label: 'Type', group: 'Field', valueType: PropertyValueType.Enum, choices: [{ value: 'string', label: 'String' }, { value: 'guid', label: 'Guid' }] },\n { path: 'label', label: 'Label', group: 'Field', valueType: PropertyValueType.String },\n { path: 'column', label: 'Legacy column', group: 'Layout', valueType: PropertyValueType.Number },\n { path: 'width', label: 'Legacy width token', group: 'Layout', valueType: PropertyValueType.String },\n { path: 'placement', label: 'Placement', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormFieldPlacement' },\n ],\n },\n },\n {\n path: 'exclude', label: 'Excluded fields', group: 'Command', valueType: PropertyValueType.Collection,\n item: { label: 'Excluded field', properties: [{ path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String }] },\n },\n { path: 'submitLabel', label: 'Submit label', group: 'Content', valueType: PropertyValueType.String, default: 'Submit' },\n];\n\n/**\n * What can be edited on the `Cratis.Components` package's components.\n *\n * Only the query-bound tables are described so far; the form, dialog and editor composites carry\n * Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the\n * same way it adds a component to the manifest.\n */\nexport const cratisComponentsDescriptors: ComponentDescriptor[] = [\n { component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },\n { component: key('table'), displayName: 'Table', properties: dataTableProperties },\n { component: key('observableDataTable'), displayName: 'Live data table', properties: dataTableProperties },\n {\n component: key('commandForm'),\n displayName: 'Command form',\n editorKind: 'commandFormDesigner',\n properties: commandFormProperties,\n actions: [{\n id: 'Cratis.Components.commandForm.generateFields',\n label: 'Generate fields',\n placement: DesignTimeActionPlacement.Toolbar,\n availability: 'commandForm.canGenerateFields',\n description: 'Creates a deterministic editable field layout from the selected command metadata.',\n }],\n },\n];\n"],"names":["key","name","componentRegistryKey","dataTableProperties","path","label","group","valueType","PropertyValueType","QueryReference","editorKind","description","constraints","required","resultShapes","QueryResultShape","Collection","String","default","Object","readOnly","output","bindingMode","BindingMode","OneWay","commandFormProperties","Enum","choices","value","Number","acceptedBindingKinds","BindingSourceKind","DataContext","ComponentProperty","item","properties","cratisComponentsDescriptors","component","displayName","actions","id","placement","DesignTimeActionPlacement","Toolbar","availability"],"mappings":";;;AAAA;AACA;AAKA;AACA;AACA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,mBAAA,EAAqBD,IAAAA,CAAAA;AAExE;;;;;;;;AAQC,IACD,MAAME,mBAAAA,GAA4C;AAC9C,IAAA;QACIC,IAAAA,EAAM,OAAA;QAASC,KAAAA,EAAO,OAAA;QAASC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,kBAAkBC,cAAc;QAAEC,UAAAA,EAAY,cAAA;QACvGC,WAAAA,EAAa,4CAAA;QACbC,WAAAA,EAAa;YAAEC,QAAAA,EAAU,IAAA;YAAMC,YAAAA,EAAc;AAACC,gBAAAA,gBAAAA,CAAiBC;AAAW;AAAC;AAC/E,KAAA;AACA,IAAA;QAAEZ,IAAAA,EAAM,cAAA;QAAgBC,KAAAA,EAAO,eAAA;QAAiBC,KAAAA,EAAO,SAAA;AAAWC,QAAAA,SAAAA,EAAWC,kBAAkBS,MAAM;QAAEC,OAAAA,EAAS;AAAG,KAAA;AACnH,IAAA;QACId,IAAAA,EAAM,SAAA;QAAWC,KAAAA,EAAO,cAAA;QAAgBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,kBAAkBS,MAAM;QAAEP,UAAAA,EAAY,aAAA;QACxGC,WAAAA,EAAa;AACjB,KAAA;AACA,IAAA;QACIP,IAAAA,EAAM,oBAAA;QAAsBC,KAAAA,EAAO,mBAAA;QAAqBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,kBAAkBW,MAAM;QAAET,UAAAA,EAAY,iBAAA;QACxHC,WAAAA,EAAa;AACjB,KAA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KAAA;AACA,IAAA;QAAEb,IAAAA,EAAM,aAAA;QAAeC,KAAAA,EAAO,cAAA;QAAgBC,KAAAA,EAAO,SAAA;AAAWC,QAAAA,SAAAA,EAAWC,kBAAkBS,MAAM;QAAEC,OAAAA,EAAS;AAAS;AAC1H,CAAA;AAED;;;;;;UAOakB,2BAAAA,GAAqD;AAC9D,IAAA;AAAEC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,WAAA,CAAA;QAAcsC,WAAAA,EAAa,YAAA;QAAcH,UAAAA,EAAYhC;AAAoB,KAAA;AAC1F,IAAA;AAAEkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,OAAA,CAAA;QAAUsC,WAAAA,EAAa,OAAA;QAASH,UAAAA,EAAYhC;AAAoB,KAAA;AACjF,IAAA;AAAEkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,qBAAA,CAAA;QAAwBsC,WAAAA,EAAa,iBAAA;QAAmBH,UAAAA,EAAYhC;AAAoB,KAAA;AACzG,IAAA;AACIkC,QAAAA,SAAAA,EAAWrC,GAAAA,CAAI,aAAA,CAAA;QACfsC,WAAAA,EAAa,cAAA;QACb5B,UAAAA,EAAY,qBAAA;QACZyB,UAAAA,EAAYV,qBAAAA;QACZc,OAAAA,EAAS;AAAC,YAAA;gBACNC,EAAAA,EAAI,8CAAA;gBACJnC,KAAAA,EAAO,iBAAA;AACPoC,gBAAAA,SAAAA,EAAWC,0BAA0BC,OAAO;gBAC5CC,YAAAA,EAAc,+BAAA;gBACdjC,WAAAA,EAAa;AACjB;AAAE;AACN;;;"}
|
|
1
|
+
{"version":3,"file":"cratisComponentsDescriptors.js","sources":["../../cratisComponentsDescriptors.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 { BindingMode, BindingSourceKind, ComponentDescriptor, DesignTimeActionPlacement, PropertyDescriptor, PropertyValueType, QueryResultShape } from '@cratis/scene.model';\nimport { componentRegistryKey } from '@cratis/scene.react';\n\n// The package name, spelled out so describing components does not pull every adapter (and its UI dependencies) in\n// with it; the bundle's validation checks each key against the manifest.\nconst key = (name: string) => componentRegistryKey('Cratis.Components', name);\n\n/**\n * The properties every query-bound data table shares: which query feeds it, and the few settings that shape how\n * it shows the result.\n *\n * `query` is a `QueryReference`, so an editor binds it to a host-supplied query candidate and validates the\n * arguments against it. What is stored is a `QueryBinding`; a plain query name - what screens carried before\n * bindings existed - is still read, as a binding with no explicit connections. The columns are not properties:\n * they are the `content` slot's children, edited as nodes.\n */\nconst dataTableProperties: PropertyDescriptor[] = [\n {\n path: 'query', label: 'Query', group: 'Data', valueType: PropertyValueType.QueryReference, editorKind: 'queryBinding',\n description: 'The collection query that feeds the table.',\n constraints: { required: true, resultShapes: [QueryResultShape.Collection] },\n },\n { path: 'emptyMessage', label: 'Empty message', group: 'Content', valueType: PropertyValueType.String, default: '' },\n {\n path: 'dataKey', label: 'Row identity', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField',\n description: 'The result field that identifies a row.',\n },\n {\n path: 'globalFilterFields', label: 'Searchable fields', group: 'Data', valueType: PropertyValueType.Object, editorKind: 'resultFieldList',\n description: 'The result fields the table\\'s search box looks in.',\n },\n {\n path: 'selectedItem', label: 'Selected item', group: 'Outputs', valueType: PropertyValueType.Object, readOnly: true,\n output: true, bindingMode: BindingMode.OneWay,\n description: 'The currently selected row, or null after selection is cleared.',\n },\n];\n\nconst commandFormProperties: PropertyDescriptor[] = [\n {\n path: 'command', label: 'Command', group: 'Command', valueType: PropertyValueType.String, editorKind: 'commandBinding',\n constraints: { required: true },\n description: 'The Arc command proxy rendered through the native command form runtime.',\n },\n {\n path: 'mode', label: 'Mode', group: 'Layout', valueType: PropertyValueType.Enum,\n choices: [{ value: 'auto', label: 'Auto' }, { value: 'manual', label: 'Manual' }], default: 'auto',\n description: 'Auto follows command metadata; manual renders explicit inputs inside the same native form boundary.',\n },\n { path: 'columns', label: 'Legacy columns', group: 'Layout', valueType: PropertyValueType.Number, default: 1, description: 'Backward-compatible column count used when no typed layout metadata is authored.' },\n { path: 'layout', label: 'Layout', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormLayout', description: 'Typed command-form geometry: columns, gaps and field placements. Independent of auto/manual field generation.' },\n {\n path: 'widthSizeClass', label: 'Width size class', group: 'Layout', valueType: PropertyValueType.Enum, default: 'Regular',\n choices: [{ value: 'Regular', label: 'Regular' }, { value: 'Compact', label: 'Compact' }],\n description: 'The width size class the host evaluated. At Compact the fields of a manual form stack in one column in reading order.',\n },\n { path: 'fieldWidths', label: 'Legacy field widths', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'fieldWidths' },\n {\n path: 'inputs', label: 'Fields', group: 'Layout', valueType: PropertyValueType.Collection, editorKind: 'commandFields',\n acceptedBindingKinds: [BindingSourceKind.DataContext, BindingSourceKind.ComponentProperty],\n item: {\n label: 'Field',\n properties: [\n { path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String },\n { path: 'type', label: 'Type', group: 'Field', valueType: PropertyValueType.Enum, choices: [{ value: 'string', label: 'String' }, { value: 'guid', label: 'Guid' }] },\n { path: 'label', label: 'Label', group: 'Field', valueType: PropertyValueType.String },\n { path: 'column', label: 'Legacy column', group: 'Layout', valueType: PropertyValueType.Number },\n { path: 'width', label: 'Legacy width token', group: 'Layout', valueType: PropertyValueType.String },\n { path: 'placement', label: 'Placement', group: 'Layout', valueType: PropertyValueType.Object, editorKind: 'commandFormFieldPlacement' },\n ],\n },\n },\n {\n path: 'exclude', label: 'Excluded fields', group: 'Command', valueType: PropertyValueType.Collection,\n item: { label: 'Excluded field', properties: [{ path: 'property', label: 'Property', group: 'Field', valueType: PropertyValueType.String }] },\n },\n { path: 'submitLabel', label: 'Submit label', group: 'Content', valueType: PropertyValueType.String, default: 'Submit' },\n];\n\n/**\n * What can be edited on the `Cratis.Components` package's components.\n *\n * Only the query-bound tables are described so far; the form, dialog and editor composites carry\n * Arc proxy classes by name and are configured through their own tooling. A package adds a descriptor here the\n * same way it adds a component to the manifest.\n */\nconst toolbarButtonProperties: PropertyDescriptor[] = [\n { path: 'title', label: 'Label', group: 'Content', valueType: PropertyValueType.String, description: 'The accessible name and tooltip.' },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'icon' },\n { path: 'text', label: 'Text', group: 'Content', valueType: PropertyValueType.String, description: 'Short text shown instead of the icon.' },\n { path: 'active', label: 'Active', group: 'Presentation', valueType: PropertyValueType.Boolean, default: false },\n {\n path: 'tooltipPosition', label: 'Tooltip position', group: 'Presentation', valueType: PropertyValueType.Enum, default: 'right',\n choices: [{ value: 'top', label: 'Top' }, { value: 'right', label: 'Right' }, { value: 'bottom', label: 'Bottom' }, { value: 'left', label: 'Left' }],\n },\n {\n path: 'destination', label: 'Destination', group: 'Navigation', valueType: PropertyValueType.Destination,\n description: 'The screen, slice or dialog the button opens - executed by the enclosing navigation host.',\n },\n];\n\nexport const cratisComponentsDescriptors: ComponentDescriptor[] = [\n { component: key('dataTable'), displayName: 'Data table', properties: dataTableProperties },\n { component: key('table'), displayName: 'Table', properties: dataTableProperties },\n { component: key('observableDataTable'), displayName: 'Live data table', properties: dataTableProperties },\n {\n component: key('commandForm'),\n displayName: 'Command form',\n editorKind: 'commandFormDesigner',\n properties: commandFormProperties,\n actions: [{\n id: 'Cratis.Components.commandForm.generateFields',\n label: 'Generate fields',\n placement: DesignTimeActionPlacement.Toolbar,\n availability: 'commandForm.canGenerateFields',\n description: 'Creates a deterministic editable field layout from the selected command metadata.',\n }],\n },\n { component: key('toolbarButton'), displayName: 'Toolbar button', properties: toolbarButtonProperties },\n];\n"],"names":["key","name","componentRegistryKey","dataTableProperties","path","label","group","valueType","PropertyValueType","QueryReference","editorKind","description","constraints","required","resultShapes","QueryResultShape","Collection","String","default","Object","readOnly","output","bindingMode","BindingMode","OneWay","commandFormProperties","Enum","choices","value","Number","acceptedBindingKinds","BindingSourceKind","DataContext","ComponentProperty","item","properties","toolbarButtonProperties","Icon","Boolean","Destination","cratisComponentsDescriptors","component","displayName","actions","id","placement","DesignTimeActionPlacement","Toolbar","availability"],"mappings":";;;AAAA;AACA;AAKA;AACA;AACA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,mBAAA,EAAqBD,IAAAA,CAAAA;AAExE;;;;;;;;AAQC,IACD,MAAME,mBAAAA,GAA4C;AAC9C,IAAA;QACIC,IAAAA,EAAM,OAAA;QAASC,KAAAA,EAAO,OAAA;QAASC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,kBAAkBC,cAAc;QAAEC,UAAAA,EAAY,cAAA;QACvGC,WAAAA,EAAa,4CAAA;QACbC,WAAAA,EAAa;YAAEC,QAAAA,EAAU,IAAA;YAAMC,YAAAA,EAAc;AAACC,gBAAAA,gBAAAA,CAAiBC;AAAW;AAAC;AAC/E,KAAA;AACA,IAAA;QAAEZ,IAAAA,EAAM,cAAA;QAAgBC,KAAAA,EAAO,eAAA;QAAiBC,KAAAA,EAAO,SAAA;AAAWC,QAAAA,SAAAA,EAAWC,kBAAkBS,MAAM;QAAEC,OAAAA,EAAS;AAAG,KAAA;AACnH,IAAA;QACId,IAAAA,EAAM,SAAA;QAAWC,KAAAA,EAAO,cAAA;QAAgBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,kBAAkBS,MAAM;QAAEP,UAAAA,EAAY,aAAA;QACxGC,WAAAA,EAAa;AACjB,KAAA;AACA,IAAA;QACIP,IAAAA,EAAM,oBAAA;QAAsBC,KAAAA,EAAO,mBAAA;QAAqBC,KAAAA,EAAO,MAAA;AAAQC,QAAAA,SAAAA,EAAWC,kBAAkBW,MAAM;QAAET,UAAAA,EAAY,iBAAA;QACxHC,WAAAA,EAAa;AACjB,KAAA;AACA,IAAA;QACIP,IAAAA,EAAM,cAAA;QAAgBC,KAAAA,EAAO,eAAA;QAAiBC,KAAAA,EAAO,SAAA;AAA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@cratis/scene.react';
|
|
2
|
-
export declare function SceneToolbarButton({ element }: RegisteredComponentProps): import("react").JSX.Element;
|
|
2
|
+
export declare function SceneToolbarButton({ element, interactions }: RegisteredComponentProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=SceneToolbarButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneToolbarButton.d.ts","sourceRoot":"","sources":["../../../toolbar/SceneToolbarButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SceneToolbarButton.d.ts","sourceRoot":"","sources":["../../../toolbar/SceneToolbarButton.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAkC,MAAM,qBAAqB,CAAC;AAmB/F,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,wBAAwB,+BAqBrF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import { ToolbarButton } from '@cratis/components/Toolbar';
|
|
4
|
+
import { SceneNavigationContextInternal } from '@cratis/scene.react';
|
|
3
5
|
import { stringProperty, unionProperty, booleanProperty } from '../properties.js';
|
|
4
6
|
|
|
5
7
|
/** Which side of the button its tooltip appears on. */ const tooltipPositions = [
|
|
@@ -15,16 +17,46 @@ import { stringProperty, unionProperty, booleanProperty } from '../properties.js
|
|
|
15
17
|
* the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the
|
|
16
18
|
* icons. It defaults to the `text` property rather than to an empty string, so a button that has a
|
|
17
19
|
* visible label is never left nameless.
|
|
18
|
-
*/
|
|
20
|
+
*/ /**
|
|
21
|
+
* A toolbar button. Its authored `destination` - a screen in an outlet, or a dialog - is executed by the
|
|
22
|
+
* enclosing navigation host; outside one it is announced with the host-neutral `cratis.scene.navigate` event.
|
|
23
|
+
* Interactions attached by the document run first.
|
|
24
|
+
*/ function SceneToolbarButton({ element, interactions }) {
|
|
19
25
|
const text = stringProperty(element.properties, 'text');
|
|
26
|
+
const navigation = useContext(SceneNavigationContextInternal);
|
|
27
|
+
const destination = isDestination(element.properties.destination) ? element.properties.destination : undefined;
|
|
28
|
+
const onClick = ()=>{
|
|
29
|
+
interactions?.onClick?.({
|
|
30
|
+
stopPropagation: ()=>undefined
|
|
31
|
+
});
|
|
32
|
+
if (!destination) return;
|
|
33
|
+
if (navigation) navigation.navigate(destination);
|
|
34
|
+
else globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', {
|
|
35
|
+
detail: {
|
|
36
|
+
destination,
|
|
37
|
+
element
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
20
41
|
return /*#__PURE__*/ jsx(ToolbarButton, {
|
|
21
42
|
icon: stringProperty(element.properties, 'icon'),
|
|
22
43
|
text: text,
|
|
23
44
|
title: stringProperty(element.properties, 'title') ?? text ?? '',
|
|
24
45
|
active: booleanProperty(element.properties, 'active'),
|
|
25
|
-
tooltipPosition: unionProperty(element.properties, 'tooltipPosition', tooltipPositions)
|
|
46
|
+
tooltipPosition: unionProperty(element.properties, 'tooltipPosition', tooltipPositions),
|
|
47
|
+
onClick: onClick
|
|
26
48
|
});
|
|
27
49
|
}
|
|
50
|
+
function isDestination(value) {
|
|
51
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
52
|
+
const candidate = value;
|
|
53
|
+
return [
|
|
54
|
+
'screen',
|
|
55
|
+
'module',
|
|
56
|
+
'route',
|
|
57
|
+
'dialog'
|
|
58
|
+
].some((key)=>typeof candidate[key] === 'string');
|
|
59
|
+
}
|
|
28
60
|
|
|
29
61
|
export { SceneToolbarButton };
|
|
30
62
|
//# sourceMappingURL=SceneToolbarButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneToolbarButton.js","sources":["../../../toolbar/SceneToolbarButton.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 { ToolbarButton } from '@cratis/components/Toolbar';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty, unionProperty } from '../properties';\n\n/** Which side of the button its tooltip appears on. */\nconst tooltipPositions = ['top', 'right', 'bottom', 'left'] as const;\n\n/**\n * The `Cratis.Components:toolbarButton` component - `ToolbarButton` from `@cratis/components/Toolbar`.\n *\n * `title` is required by the underlying component and is not decoration: it is both the tooltip text and\n * the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the\n * icons. It defaults to the `text` property rather than to an empty string, so a button that has a\n * visible label is never left nameless.\n */\nexport function SceneToolbarButton({ element }: RegisteredComponentProps) {\n const text = stringProperty(element.properties, 'text');\n\n return (\n <ToolbarButton\n icon={stringProperty(element.properties, 'icon')}\n text={text}\n title={stringProperty(element.properties, 'title') ?? text ?? ''}\n active={booleanProperty(element.properties, 'active')}\n tooltipPosition={unionProperty(element.properties, 'tooltipPosition', tooltipPositions)}\n />\n );\n}\n"],"names":["tooltipPositions","SceneToolbarButton","element","text","stringProperty","properties","_jsx","ToolbarButton","icon","title","active","booleanProperty","tooltipPosition","unionProperty"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SceneToolbarButton.js","sources":["../../../toolbar/SceneToolbarButton.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 { ToolbarButton } from '@cratis/components/Toolbar';\nimport { DestinationReference } from '@cratis/scene.model';\nimport { RegisteredComponentProps, SceneNavigationContextInternal } from '@cratis/scene.react';\nimport { booleanProperty, stringProperty, unionProperty } from '../properties';\n\n/** Which side of the button its tooltip appears on. */\nconst tooltipPositions = ['top', 'right', 'bottom', 'left'] as const;\n\n/**\n * The `Cratis.Components:toolbarButton` component - `ToolbarButton` from `@cratis/components/Toolbar`.\n *\n * `title` is required by the underlying component and is not decoration: it is both the tooltip text and\n * the accessible name, so a toolbar of icon-only buttons is still usable by anyone who cannot see the\n * icons. It defaults to the `text` property rather than to an empty string, so a button that has a\n * visible label is never left nameless.\n */\n/**\n * A toolbar button. Its authored `destination` - a screen in an outlet, or a dialog - is executed by the\n * enclosing navigation host; outside one it is announced with the host-neutral `cratis.scene.navigate` event.\n * Interactions attached by the document run first.\n */\nexport function SceneToolbarButton({ element, interactions }: RegisteredComponentProps) {\n const text = stringProperty(element.properties, 'text');\n const navigation = useContext(SceneNavigationContextInternal);\n const destination = isDestination(element.properties.destination) ? element.properties.destination : undefined;\n const onClick = () => {\n interactions?.onClick?.({ stopPropagation: () => undefined });\n if (!destination) return;\n if (navigation) navigation.navigate(destination);\n else globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { destination, element } }));\n };\n\n return (\n <ToolbarButton\n icon={stringProperty(element.properties, 'icon')}\n text={text}\n title={stringProperty(element.properties, 'title') ?? text ?? ''}\n active={booleanProperty(element.properties, 'active')}\n tooltipPosition={unionProperty(element.properties, 'tooltipPosition', tooltipPositions)}\n onClick={onClick}\n />\n );\n}\n\nfunction isDestination(value: unknown): value is DestinationReference {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;\n const candidate = value as Record<string, unknown>;\n return ['screen', 'module', 'route', 'dialog'].some(key => typeof candidate[key] === 'string');\n}\n"],"names":["tooltipPositions","SceneToolbarButton","element","interactions","text","stringProperty","properties","navigation","useContext","SceneNavigationContextInternal","destination","isDestination","undefined","onClick","stopPropagation","navigate","globalThis","dispatchEvent","CustomEvent","detail","_jsx","ToolbarButton","icon","title","active","booleanProperty","tooltipPosition","unionProperty","value","Array","isArray","candidate","some","key"],"mappings":";;;;;;AASA,wDACA,MAAMA,gBAAAA,GAAmB;AAAC,IAAA,KAAA;AAAO,IAAA,OAAA;AAAS,IAAA,QAAA;AAAU,IAAA;AAAO,CAAA;AAE3D;;;;;;;;;;;AAYC,IACM,SAASC,kBAAAA,CAAmB,EAAEC,OAAO,EAA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