@cratis/scene.react 4.11.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/cjs/core/coreComponents.js +1 -0
  2. package/dist/cjs/core/coreComponents.js.map +1 -1
  3. package/dist/cjs/core/coreDescriptors.js +1 -0
  4. package/dist/cjs/core/coreDescriptors.js.map +1 -1
  5. package/dist/cjs/index.js +17 -0
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/cjs/navigation/diagnoseRenderedNavigation.js +17 -0
  8. package/dist/cjs/navigation/diagnoseRenderedNavigation.js.map +1 -0
  9. package/dist/cjs/navigation/identityRoute.js +19 -0
  10. package/dist/cjs/navigation/identityRoute.js.map +1 -0
  11. package/dist/cjs/navigation/navigationRouteKey.js +19 -0
  12. package/dist/cjs/navigation/navigationRouteKey.js.map +1 -0
  13. package/dist/cjs/navigation/resolveDestination.js +2 -10
  14. package/dist/cjs/navigation/resolveDestination.js.map +1 -1
  15. package/dist/cjs/packages/DesignTimeContractVersion.js +15 -0
  16. package/dist/cjs/packages/DesignTimeContractVersion.js.map +1 -0
  17. package/dist/cjs/packages/DesignTimeExtensionPoint.js +26 -0
  18. package/dist/cjs/packages/DesignTimeExtensionPoint.js.map +1 -0
  19. package/dist/cjs/packages/PackageHostConfiguration.js +1 -0
  20. package/dist/cjs/packages/PackageHostConfiguration.js.map +1 -1
  21. package/dist/cjs/packages/loadDesignTimeContributions.js +80 -0
  22. package/dist/cjs/packages/loadDesignTimeContributions.js.map +1 -0
  23. package/dist/cjs/packages/resolveDesignTimeHost.js +114 -0
  24. package/dist/cjs/packages/resolveDesignTimeHost.js.map +1 -0
  25. package/dist/cjs/packages/runDesignTimeAction.js +50 -0
  26. package/dist/cjs/packages/runDesignTimeAction.js.map +1 -0
  27. package/dist/esm/core/coreComponents.js +1 -0
  28. package/dist/esm/core/coreComponents.js.map +1 -1
  29. package/dist/esm/core/coreDescriptors.js +1 -0
  30. package/dist/esm/core/coreDescriptors.js.map +1 -1
  31. package/dist/esm/index.js +8 -0
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/esm/navigation/diagnoseRenderedNavigation.d.ts +3 -0
  34. package/dist/esm/navigation/diagnoseRenderedNavigation.d.ts.map +1 -0
  35. package/dist/esm/navigation/diagnoseRenderedNavigation.js +15 -0
  36. package/dist/esm/navigation/diagnoseRenderedNavigation.js.map +1 -0
  37. package/dist/esm/navigation/identityRoute.d.ts +3 -0
  38. package/dist/esm/navigation/identityRoute.d.ts.map +1 -0
  39. package/dist/esm/navigation/identityRoute.js +17 -0
  40. package/dist/esm/navigation/identityRoute.js.map +1 -0
  41. package/dist/esm/navigation/index.d.ts +3 -0
  42. package/dist/esm/navigation/index.d.ts.map +1 -1
  43. package/dist/esm/navigation/index.js +3 -0
  44. package/dist/esm/navigation/index.js.map +1 -1
  45. package/dist/esm/navigation/navigationRouteKey.d.ts +3 -0
  46. package/dist/esm/navigation/navigationRouteKey.d.ts.map +1 -0
  47. package/dist/esm/navigation/navigationRouteKey.js +17 -0
  48. package/dist/esm/navigation/navigationRouteKey.js.map +1 -0
  49. package/dist/esm/navigation/resolveDestination.d.ts.map +1 -1
  50. package/dist/esm/navigation/resolveDestination.js +1 -9
  51. package/dist/esm/navigation/resolveDestination.js.map +1 -1
  52. package/dist/esm/packages/DesignTimeActionOutcome.d.ts +7 -0
  53. package/dist/esm/packages/DesignTimeActionOutcome.d.ts.map +1 -0
  54. package/dist/esm/packages/DesignTimeActionOutcome.js +2 -0
  55. package/dist/esm/packages/DesignTimeActionOutcome.js.map +1 -0
  56. package/dist/esm/packages/DesignTimeActionState.d.ts +9 -0
  57. package/dist/esm/packages/DesignTimeActionState.d.ts.map +1 -0
  58. package/dist/esm/packages/DesignTimeActionState.js +2 -0
  59. package/dist/esm/packages/DesignTimeActionState.js.map +1 -0
  60. package/dist/esm/packages/DesignTimeContractVersion.d.ts +2 -0
  61. package/dist/esm/packages/DesignTimeContractVersion.d.ts.map +1 -0
  62. package/dist/esm/packages/DesignTimeContractVersion.js +13 -0
  63. package/dist/esm/packages/DesignTimeContractVersion.js.map +1 -0
  64. package/dist/esm/packages/DesignTimeExtensionPoint.d.ts +9 -0
  65. package/dist/esm/packages/DesignTimeExtensionPoint.d.ts.map +1 -0
  66. package/dist/esm/packages/DesignTimeExtensionPoint.js +23 -0
  67. package/dist/esm/packages/DesignTimeExtensionPoint.js.map +1 -0
  68. package/dist/esm/packages/DesignTimeResolution.d.ts +7 -0
  69. package/dist/esm/packages/DesignTimeResolution.d.ts.map +1 -0
  70. package/dist/esm/packages/DesignTimeResolution.js +2 -0
  71. package/dist/esm/packages/DesignTimeResolution.js.map +1 -0
  72. package/dist/esm/packages/PackageHostConfiguration.d.ts +3 -0
  73. package/dist/esm/packages/PackageHostConfiguration.d.ts.map +1 -1
  74. package/dist/esm/packages/PackageHostConfiguration.js +2 -1
  75. package/dist/esm/packages/PackageHostConfiguration.js.map +1 -1
  76. package/dist/esm/packages/index.d.ts +8 -0
  77. package/dist/esm/packages/index.d.ts.map +1 -1
  78. package/dist/esm/packages/index.js +8 -0
  79. package/dist/esm/packages/index.js.map +1 -1
  80. package/dist/esm/packages/loadDesignTimeContributions.d.ts +11 -0
  81. package/dist/esm/packages/loadDesignTimeContributions.d.ts.map +1 -0
  82. package/dist/esm/packages/loadDesignTimeContributions.js +78 -0
  83. package/dist/esm/packages/loadDesignTimeContributions.js.map +1 -0
  84. package/dist/esm/packages/resolveDesignTimeHost.d.ts +26 -0
  85. package/dist/esm/packages/resolveDesignTimeHost.d.ts.map +1 -0
  86. package/dist/esm/packages/resolveDesignTimeHost.js +112 -0
  87. package/dist/esm/packages/resolveDesignTimeHost.js.map +1 -0
  88. package/dist/esm/packages/runDesignTimeAction.d.ts +4 -0
  89. package/dist/esm/packages/runDesignTimeAction.d.ts.map +1 -0
  90. package/dist/esm/packages/runDesignTimeAction.js +48 -0
  91. package/dist/esm/packages/runDesignTimeAction.js.map +1 -0
  92. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  93. package/navigation/diagnoseRenderedNavigation.ts +14 -0
  94. package/navigation/identityRoute.ts +14 -0
  95. package/navigation/index.ts +3 -0
  96. package/navigation/navigationRouteKey.ts +22 -0
  97. package/navigation/resolveDestination.ts +1 -6
  98. package/package.json +5 -5
  99. package/packages/DesignTimeActionOutcome.ts +18 -0
  100. package/packages/DesignTimeActionState.ts +21 -0
  101. package/packages/DesignTimeContractVersion.ts +12 -0
  102. package/packages/DesignTimeExtensionPoint.ts +23 -0
  103. package/packages/DesignTimeResolution.ts +23 -0
  104. package/packages/PackageHostConfiguration.ts +11 -1
  105. package/packages/index.ts +8 -0
  106. package/packages/loadDesignTimeContributions.ts +98 -0
  107. package/packages/resolveDesignTimeHost.ts +133 -0
  108. package/packages/runDesignTimeAction.ts +36 -0
@@ -0,0 +1,114 @@
1
+ 'use strict';
2
+
3
+ var DesignTimeExtensionPoint = require('./DesignTimeExtensionPoint.js');
4
+ var loadDesignTimeContributions = require('./loadDesignTimeContributions.js');
5
+ var PackageHostConfiguration = require('./PackageHostConfiguration.js');
6
+ var runDesignTimeAction = require('./runDesignTimeAction.js');
7
+
8
+ // Copyright (c) Cratis. All rights reserved.
9
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
10
+ /**
11
+ * Resolves a package host and the design-time contributions of its approved packages. Design-time code is
12
+ * only loaded when the host policy sets `loadDesignTime`; a runtime host gets generic fallbacks everywhere.
13
+ */ function resolveDesignTimeHost(configuration, options = {}) {
14
+ const host = PackageHostConfiguration.resolvePackageHost(configuration);
15
+ const loaded = loadDesignTimeContributions.loadDesignTimeContributions(host.bundles, configuration.policy.loadDesignTime === true);
16
+ const hostEditorKinds = new Set(options.hostEditorKinds ?? []);
17
+ const approved = new Set(host.bundles.map((bundle)=>bundle.manifest.name));
18
+ const lookup = (descriptor, point, kind)=>{
19
+ if (!kind) return {};
20
+ const label = DesignTimeExtensionPoint.designTimeExtensionPointLabels[point];
21
+ const separator = kind.indexOf(':');
22
+ const owner = separator > 0 ? kind.substring(0, separator) : ownerOf(descriptor);
23
+ const name = separator > 0 ? kind.substring(separator + 1) : kind;
24
+ const outcome = point === DesignTimeExtensionPoint.DesignTimeExtensionPoint.Action ? 'the host shows it disabled' : `the host uses its generic ${label}`;
25
+ const fallback = (reason)=>({
26
+ diagnostic: `'${descriptor.component}' asks for the ${label} '${kind}', ${reason}; ${outcome}`
27
+ });
28
+ if (!approved.has(owner)) return fallback(`but package '${owner}' is not approved by this host`);
29
+ const contributions = loaded.packages.get(owner);
30
+ if (contributions?.unavailableReason) return fallback(`but design-time contributions from package '${owner}' are not loaded`);
31
+ const contribution = contributions?.contributions[point]?.[name];
32
+ if (contribution !== undefined) return {
33
+ contribution,
34
+ package: owner
35
+ };
36
+ if (point === DesignTimeExtensionPoint.DesignTimeExtensionPoint.PropertyEditor && separator < 0 && hostEditorKinds.has(kind)) return {
37
+ hostKind: kind
38
+ };
39
+ return fallback(`which package '${owner}' does not provide`);
40
+ };
41
+ const actionOf = (descriptor, actionId)=>loaded.packages.get(ownerOf(descriptor))?.contributions[DesignTimeExtensionPoint.DesignTimeExtensionPoint.Action]?.[actionId];
42
+ const actions = (descriptor, context)=>(descriptor.actions ?? []).map((action)=>{
43
+ const state = {
44
+ descriptor: action,
45
+ package: ownerOf(descriptor)
46
+ };
47
+ const handler = actionOf(descriptor, action.id);
48
+ if (!handler) {
49
+ const resolution = lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.Action, action.id);
50
+ return {
51
+ ...state,
52
+ visible: true,
53
+ enabled: false,
54
+ diagnostic: resolution.diagnostic
55
+ };
56
+ }
57
+ try {
58
+ return {
59
+ ...state,
60
+ visible: handler.isVisible(context),
61
+ enabled: handler.isEnabled(context)
62
+ };
63
+ } catch (error) {
64
+ return {
65
+ ...state,
66
+ visible: true,
67
+ enabled: false,
68
+ diagnostic: `Action '${action.id}' could not decide its availability: ${String(error)}`
69
+ };
70
+ }
71
+ });
72
+ const descriptors = host.bundles.flatMap((bundle)=>bundle.descriptors ?? []);
73
+ return {
74
+ host,
75
+ diagnostics: [
76
+ ...host.diagnostics,
77
+ ...loaded.diagnostics
78
+ ],
79
+ preview: (descriptor)=>lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.Preview, descriptor.previewKind),
80
+ designer: (descriptor)=>lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.Designer, descriptor.editorKind),
81
+ propertyEditor: (descriptor, property)=>lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.PropertyEditor, property.editorKind),
82
+ propertyDisplay: (descriptor)=>lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.PropertyDisplay, descriptor.propertyDisplayKind),
83
+ actions,
84
+ runAction: (descriptor, actionId, context)=>{
85
+ const state = actions(descriptor, context).find((action)=>action.descriptor.id === actionId);
86
+ const handler = actionOf(descriptor, actionId);
87
+ if (!state || !handler || !state.visible || !state.enabled) {
88
+ const reason = state?.diagnostic ?? (state ? `Action '${actionId}' is not available here` : `'${descriptor.component}' has no action '${actionId}'`);
89
+ return {
90
+ submitted: false,
91
+ edits: [],
92
+ diagnostics: [
93
+ reason
94
+ ]
95
+ };
96
+ }
97
+ return runDesignTimeAction.runDesignTimeAction(handler, context);
98
+ },
99
+ diagnoseDescriptors: ()=>descriptors.flatMap((descriptor)=>[
100
+ lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.Preview, descriptor.previewKind),
101
+ lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.Designer, descriptor.editorKind),
102
+ lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.PropertyDisplay, descriptor.propertyDisplayKind),
103
+ ...descriptor.properties.map((property)=>lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.PropertyEditor, property.editorKind)),
104
+ ...(descriptor.actions ?? []).map((action)=>lookup(descriptor, DesignTimeExtensionPoint.DesignTimeExtensionPoint.Action, action.id))
105
+ ]).map((resolution)=>resolution.diagnostic).filter((diagnostic)=>diagnostic !== undefined)
106
+ };
107
+ }
108
+ function ownerOf(descriptor) {
109
+ const separator = descriptor.component.indexOf(':');
110
+ return separator > 0 ? descriptor.component.substring(0, separator) : descriptor.component;
111
+ }
112
+
113
+ exports.resolveDesignTimeHost = resolveDesignTimeHost;
114
+ //# sourceMappingURL=resolveDesignTimeHost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveDesignTimeHost.js","sources":["../../../packages/resolveDesignTimeHost.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 { ComponentType } from 'react';\nimport { ComponentDescriptor, PropertyDescriptor } from '@cratis/scene.model';\nimport { DesignTimeAction, DesignTimeActionContext } from './DesignTimeAction';\nimport { DesignTimeActionOutcome } from './DesignTimeActionOutcome';\nimport { DesignTimeActionState } from './DesignTimeActionState';\nimport { DesignTimeComponentProps } from './DesignTimeComponentProps';\nimport { DesignTimeExtensionPoint, designTimeExtensionPointLabels } from './DesignTimeExtensionPoint';\nimport { DesignTimePropertyDisplayProps } from './DesignTimePropertyDisplayProps';\nimport { DesignTimePropertyEditorProps } from './DesignTimePropertyEditorProps';\nimport { DesignTimeResolution } from './DesignTimeResolution';\nimport { LoadedDesignTimeContributions, loadDesignTimeContributions } from './loadDesignTimeContributions';\nimport { PackageHostConfiguration, ResolvedPackageHost, resolvePackageHost } from './PackageHostConfiguration';\nimport { runDesignTimeAction } from './runDesignTimeAction';\n\n/**\n * The generic design-time host contract: every package - first or third party - is reached through these\n * lookups, so a designer never switches on package or component names.\n */\nexport interface DesignTimeHost {\n /** The runtime package host the design-time contributions were loaded alongside. */\n host: ResolvedPackageHost;\n\n /** Package-level problems: the host's own, contract version mismatches and declared/provided disagreements. */\n diagnostics: string[];\n\n preview(descriptor: ComponentDescriptor): DesignTimeResolution<ComponentType<DesignTimeComponentProps>>;\n designer(descriptor: ComponentDescriptor): DesignTimeResolution<ComponentType<DesignTimeComponentProps>>;\n propertyEditor(descriptor: ComponentDescriptor, property: PropertyDescriptor): DesignTimeResolution<ComponentType<DesignTimePropertyEditorProps>>;\n propertyDisplay(descriptor: ComponentDescriptor): DesignTimeResolution<ComponentType<DesignTimePropertyDisplayProps>>;\n\n /** The component's actions, with the visibility and enablement their owning package decides. */\n actions(descriptor: ComponentDescriptor, context: DesignTimeActionContext): DesignTimeActionState[];\n\n /** Runs an action and submits its canonical edit batch to the host through `context.submitAction`. */\n runAction(descriptor: ComponentDescriptor, actionId: string, context: DesignTimeActionContext): DesignTimeActionOutcome;\n\n /** Every unknown or unavailable extension the approved packages' descriptors ask for. */\n diagnoseDescriptors(): string[];\n}\n\n/** Options for {@link resolveDesignTimeHost}. */\nexport interface DesignTimeHostOptions {\n /** Property editor kinds the host implements itself, such as an icon picker or a query binder. */\n hostEditorKinds?: string[];\n}\n\n/**\n * Resolves a package host and the design-time contributions of its approved packages. Design-time code is\n * only loaded when the host policy sets `loadDesignTime`; a runtime host gets generic fallbacks everywhere.\n */\nexport function resolveDesignTimeHost(configuration: PackageHostConfiguration, options: DesignTimeHostOptions = {}): DesignTimeHost {\n const host = resolvePackageHost(configuration);\n const loaded = loadDesignTimeContributions(host.bundles, configuration.policy.loadDesignTime === true);\n const hostEditorKinds = new Set(options.hostEditorKinds ?? []);\n const approved = new Set(host.bundles.map(bundle => bundle.manifest.name));\n\n const lookup = <T>(descriptor: ComponentDescriptor, point: DesignTimeExtensionPoint, kind: string | undefined): DesignTimeResolution<T> => {\n if (!kind) return {};\n const label = designTimeExtensionPointLabels[point];\n const separator = kind.indexOf(':');\n const owner = separator > 0 ? kind.substring(0, separator) : ownerOf(descriptor);\n const name = separator > 0 ? kind.substring(separator + 1) : kind;\n const outcome = point === DesignTimeExtensionPoint.Action ? 'the host shows it disabled' : `the host uses its generic ${label}`;\n const fallback = (reason: string) => ({ diagnostic: `'${descriptor.component}' asks for the ${label} '${kind}', ${reason}; ${outcome}` });\n\n if (!approved.has(owner)) return fallback(`but package '${owner}' is not approved by this host`);\n const contributions: LoadedDesignTimeContributions | undefined = loaded.packages.get(owner);\n if (contributions?.unavailableReason) return fallback(`but design-time contributions from package '${owner}' are not loaded`);\n const contribution = contributions?.contributions[point]?.[name] as T | undefined;\n if (contribution !== undefined) return { contribution, package: owner };\n if (point === DesignTimeExtensionPoint.PropertyEditor && separator < 0 && hostEditorKinds.has(kind)) return { hostKind: kind };\n return fallback(`which package '${owner}' does not provide`);\n };\n\n const actionOf = (descriptor: ComponentDescriptor, actionId: string): DesignTimeAction | undefined =>\n loaded.packages.get(ownerOf(descriptor))?.contributions[DesignTimeExtensionPoint.Action]?.[actionId] as DesignTimeAction | undefined;\n\n const actions = (descriptor: ComponentDescriptor, context: DesignTimeActionContext): DesignTimeActionState[] =>\n (descriptor.actions ?? []).map(action => {\n const state = { descriptor: action, package: ownerOf(descriptor) };\n const handler = actionOf(descriptor, action.id);\n if (!handler) {\n const resolution = lookup<DesignTimeAction>(descriptor, DesignTimeExtensionPoint.Action, action.id);\n return { ...state, visible: true, enabled: false, diagnostic: resolution.diagnostic };\n }\n\n try {\n return { ...state, visible: handler.isVisible(context), enabled: handler.isEnabled(context) };\n } catch (error) {\n return { ...state, visible: true, enabled: false, diagnostic: `Action '${action.id}' could not decide its availability: ${String(error)}` };\n }\n });\n\n const descriptors = host.bundles.flatMap(bundle => bundle.descriptors ?? []);\n\n return {\n host,\n diagnostics: [...host.diagnostics, ...loaded.diagnostics],\n preview: descriptor => lookup(descriptor, DesignTimeExtensionPoint.Preview, descriptor.previewKind),\n designer: descriptor => lookup(descriptor, DesignTimeExtensionPoint.Designer, descriptor.editorKind),\n propertyEditor: (descriptor, property) => lookup(descriptor, DesignTimeExtensionPoint.PropertyEditor, property.editorKind),\n propertyDisplay: descriptor => lookup(descriptor, DesignTimeExtensionPoint.PropertyDisplay, descriptor.propertyDisplayKind),\n actions,\n runAction: (descriptor, actionId, context) => {\n const state = actions(descriptor, context).find(action => action.descriptor.id === actionId);\n const handler = actionOf(descriptor, actionId);\n if (!state || !handler || !state.visible || !state.enabled) {\n const reason = state?.diagnostic ?? (state ? `Action '${actionId}' is not available here` : `'${descriptor.component}' has no action '${actionId}'`);\n return { submitted: false, edits: [], diagnostics: [reason] };\n }\n\n return runDesignTimeAction(handler, context);\n },\n diagnoseDescriptors: () =>\n descriptors.flatMap(descriptor => [\n lookup(descriptor, DesignTimeExtensionPoint.Preview, descriptor.previewKind),\n lookup(descriptor, DesignTimeExtensionPoint.Designer, descriptor.editorKind),\n lookup(descriptor, DesignTimeExtensionPoint.PropertyDisplay, descriptor.propertyDisplayKind),\n ...descriptor.properties.map(property => lookup(descriptor, DesignTimeExtensionPoint.PropertyEditor, property.editorKind)),\n ...(descriptor.actions ?? []).map(action => lookup(descriptor, DesignTimeExtensionPoint.Action, action.id)),\n ])\n .map(resolution => resolution.diagnostic)\n .filter((diagnostic): diagnostic is string => diagnostic !== undefined),\n };\n}\n\nfunction ownerOf(descriptor: ComponentDescriptor): string {\n const separator = descriptor.component.indexOf(':');\n return separator > 0 ? descriptor.component.substring(0, separator) : descriptor.component;\n}\n"],"names":["resolveDesignTimeHost","configuration","options","host","resolvePackageHost","loaded","loadDesignTimeContributions","bundles","policy","loadDesignTime","hostEditorKinds","Set","approved","map","bundle","manifest","name","lookup","descriptor","point","kind","label","designTimeExtensionPointLabels","separator","indexOf","owner","substring","ownerOf","outcome","DesignTimeExtensionPoint","Action","fallback","reason","diagnostic","component","has","contributions","packages","get","unavailableReason","contribution","undefined","package","PropertyEditor","hostKind","actionOf","actionId","actions","context","action","state","handler","id","resolution","visible","enabled","isVisible","isEnabled","error","String","descriptors","flatMap","diagnostics","preview","Preview","previewKind","designer","Designer","editorKind","propertyEditor","property","propertyDisplay","PropertyDisplay","propertyDisplayKind","runAction","find","submitted","edits","runDesignTimeAction","diagnoseDescriptors","properties","filter"],"mappings":";;;;;;;AAAA;AACA;AAgDA;;;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AS,CAACV,OAAO,CAAC,GAAA,CAAA;IAC/C,OAAOD,SAAAA,GAAY,CAAA,GAAIL,UAAAA,CAAWgB,SAAS,CAACR,SAAS,CAAC,CAAA,EAAGH,SAAAA,CAAAA,GAAaL,UAAAA,CAAWgB,SAAS;AAC9F;;"}
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ const editKinds = new Set(Object.values(scene_model.SceneEditKind));
8
+ /**
9
+ * Runs one design-time action and hands its edit batch to the host as a single canonical batch, so the host's
10
+ * own validation and undo/redo stay authoritative. A batch containing anything that is not a canonical Scene
11
+ * edit is rejected whole - a partially applied action is never reported as success.
12
+ */ function runDesignTimeAction(action, context) {
13
+ let result;
14
+ try {
15
+ result = action.execute(context);
16
+ } catch (error) {
17
+ return {
18
+ submitted: false,
19
+ edits: [],
20
+ diagnostics: [
21
+ `Action '${action.descriptor.id}' failed: ${String(error)}`
22
+ ]
23
+ };
24
+ }
25
+ const invalid = result.edits.filter((edit)=>!editKinds.has(edit.kind ?? ''));
26
+ if (invalid.length > 0) {
27
+ return {
28
+ submitted: false,
29
+ edits: result.edits,
30
+ diagnostics: [
31
+ ...result.diagnostics,
32
+ `Action '${action.descriptor.id}' produced ${invalid.length} edit(s) that are not canonical Scene edits; nothing was submitted`
33
+ ]
34
+ };
35
+ }
36
+ if (result.edits.length === 0) return {
37
+ submitted: false,
38
+ edits: [],
39
+ diagnostics: result.diagnostics
40
+ };
41
+ context.submitAction(action.descriptor.id, result.edits);
42
+ return {
43
+ submitted: true,
44
+ edits: result.edits,
45
+ diagnostics: result.diagnostics
46
+ };
47
+ }
48
+
49
+ exports.runDesignTimeAction = runDesignTimeAction;
50
+ //# sourceMappingURL=runDesignTimeAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runDesignTimeAction.js","sources":["../../../packages/runDesignTimeAction.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 { SceneEdit, SceneEditKind } from '@cratis/scene.model';\nimport { DesignTimeAction, DesignTimeActionContext } from './DesignTimeAction';\nimport { DesignTimeActionOutcome } from './DesignTimeActionOutcome';\n\nconst editKinds = new Set<string>(Object.values(SceneEditKind));\n\n/**\n * Runs one design-time action and hands its edit batch to the host as a single canonical batch, so the host's\n * own validation and undo/redo stay authoritative. A batch containing anything that is not a canonical Scene\n * edit is rejected whole - a partially applied action is never reported as success.\n */\nexport function runDesignTimeAction(action: DesignTimeAction, context: DesignTimeActionContext): DesignTimeActionOutcome {\n let result: { edits: SceneEdit[]; diagnostics: string[] };\n try {\n result = action.execute(context);\n } catch (error) {\n return { submitted: false, edits: [], diagnostics: [`Action '${action.descriptor.id}' failed: ${String(error)}`] };\n }\n\n const invalid = result.edits.filter(edit => !editKinds.has((edit as { kind?: string }).kind ?? ''));\n if (invalid.length > 0) {\n return {\n submitted: false,\n edits: result.edits,\n diagnostics: [...result.diagnostics, `Action '${action.descriptor.id}' produced ${invalid.length} edit(s) that are not canonical Scene edits; nothing was submitted`],\n };\n }\n\n if (result.edits.length === 0) return { submitted: false, edits: [], diagnostics: result.diagnostics };\n\n context.submitAction(action.descriptor.id, result.edits);\n return { submitted: true, edits: result.edits, diagnostics: result.diagnostics };\n}\n"],"names":["editKinds","Set","Object","values","SceneEditKind","runDesignTimeAction","action","context","result","execute","error","submitted","edits","diagnostics","descriptor","id","String","invalid","filter","edit","has","kind","length","submitAction"],"mappings":";;;;AAAA;AACA;AAMA,MAAMA,SAAAA,GAAY,IAAIC,GAAAA,CAAYC,MAAAA,CAAOC,MAAM,CAACC,yBAAAA,CAAAA,CAAAA;AAEhD;;;;AAIC,IACM,SAASC,mBAAAA,CAAoBC,MAAwB,EAAEC,OAAgC,EAAA;IAC1F,IAAIC,MAAAA;IACJ,IAAI;QACAA,MAAAA,GAASF,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A;AACnF;;"}
@@ -5,6 +5,7 @@ import '@cratis/scene.engine';
5
5
  import '../interactions/useInteractions.js';
6
6
  import '../interactions/NotificationHost.js';
7
7
  import { componentRegistryKey } from '../packages/ScenePackageBundle.js';
8
+ import '../packages/runDesignTimeAction.js';
8
9
  import { CoreText } from './CoreText.js';
9
10
  import { CoreButton } from './CoreButton.js';
10
11
  import { CoreCard } from './CoreCard.js';
@@ -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 {\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};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAsBA;;;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;AACrD;;"}
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 {\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};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AAsBA;;;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;AACrD;;"}
@@ -5,6 +5,7 @@ import '@cratis/scene.engine';
5
5
  import '../interactions/useInteractions.js';
6
6
  import '../interactions/NotificationHost.js';
7
7
  import { componentRegistryKey } from '../packages/ScenePackageBundle.js';
8
+ import '../packages/runDesignTimeAction.js';
8
9
 
9
10
  // Copyright (c) Cratis. All rights reserved.
10
11
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
@@ -1 +1 @@
1
- {"version":3,"file":"coreDescriptors.js","sources":["../../../core/coreDescriptors.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 { ComponentDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey } from '../packages';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nexport const coreDescriptors: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n"],"names":["key","name","componentRegistryKey","coreDescriptors","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","minimumLength","Icon","Destination"],"mappings":";;;;;;;;AAAA;AACA;AAKA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;UAOaE,eAAAA,GAAyC;AAClD,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;A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AA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBW,WAAW;4BAAEP,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;;;"}
1
+ {"version":3,"file":"coreDescriptors.js","sources":["../../../core/coreDescriptors.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 { ComponentDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey } from '../packages';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nexport const coreDescriptors: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n"],"names":["key","name","componentRegistryKey","coreDescriptors","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","minimumLength","Icon","Destination"],"mappings":";;;;;;;;;AAAA;AACA;AAKA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,oBAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;UAOaE,eAAAA,GAAyC;AAClD,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACI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gCAAMG,aAAAA,EAAe;AAAE;AAAE,yBAAA;AAC1I,wBAAA;4BAAEb,IAAAA,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBU,IAAI;4BAAEN,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,kBAAkBW,WAAW;4BAAEP,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;;;"}
package/dist/esm/index.js CHANGED
@@ -18,17 +18,25 @@ export { extractNavigationItem } from './NavBar/extractNavigationItem.js';
18
18
  export { SceneNavigationProvider, useSceneNavigation } from './navigation/SceneNavigationContext.js';
19
19
  export { SceneNavigationHost } from './navigation/SceneNavigationHost.js';
20
20
  export { resolveDestination } from './navigation/resolveDestination.js';
21
+ export { diagnoseRenderedNavigation } from './navigation/diagnoseRenderedNavigation.js';
22
+ export { identityRoute } from './navigation/identityRoute.js';
23
+ export { navigationRouteKey } from './navigation/navigationRouteKey.js';
21
24
  export { IconAdapterRegistry, createIconAdapterRegistry } from './icons/IconAdapterRegistry.js';
22
25
  export { IconAdapterProvider, useIconAdapters } from './icons/IconAdapterContext.js';
23
26
  export { useIconGlyph } from './icons/useIconGlyph.js';
24
27
  export { SceneIcon } from './icons/SceneIcon.js';
25
28
  export { validateDesignTimeBundle } from './packages/DesignTimeBundle.js';
29
+ export { DesignTimeContractVersion } from './packages/DesignTimeContractVersion.js';
30
+ export { DesignTimeExtensionPoint, designTimeExtensionPointLabels } from './packages/DesignTimeExtensionPoint.js';
26
31
  export { DesignTimeProvider, useDesignTimeContext } from './packages/DesignTimeProvider.js';
27
32
  export { EmbeddedPackageHost } from './packages/EmbeddedPackageHost.js';
33
+ export { loadDesignTimeContributions } from './packages/loadDesignTimeContributions.js';
28
34
  export { PackageHostAssets } from './packages/PackageHostAssets.js';
29
35
  export { resolvePackageHost } from './packages/PackageHostConfiguration.js';
30
36
  export { PackageHostRenderMode } from './packages/PackageHostRenderMode.js';
31
37
  export { PackageHostView } from './packages/PackageHostView.js';
38
+ export { resolveDesignTimeHost } from './packages/resolveDesignTimeHost.js';
39
+ export { runDesignTimeAction } from './packages/runDesignTimeAction.js';
32
40
  export { componentRegistryKey, mergeIconAdapters, mergePackageRegistries, validatePackageBundle } from './packages/ScenePackageBundle.js';
33
41
  export { StandalonePackageHost } from './packages/StandalonePackageHost.js';
34
42
  export { WebViewPackageHost } from './packages/WebViewPackageHost.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NavigationDiagnostic, NavigationGraph } from '@cratis/scene.engine';
2
+ export declare function diagnoseRenderedNavigation(graph: NavigationGraph): NavigationDiagnostic[];
3
+ //# sourceMappingURL=diagnoseRenderedNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnoseRenderedNavigation.d.ts","sourceRoot":"","sources":["../../../navigation/diagnoseRenderedNavigation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAsB,MAAM,sBAAsB,CAAC;AAQjG,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,GAAG,oBAAoB,EAAE,CAEzF"}
@@ -0,0 +1,15 @@
1
+ import { diagnoseNavigation } from '@cratis/scene.engine';
2
+ import { navigationRouteKey } from './navigationRouteKey.js';
3
+
4
+ // Copyright (c) Cratis. All rights reserved.
5
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
6
+ /**
7
+ * Diagnoses navigation the way this renderer routes it: the engine's checks, with duplicate routes compared
8
+ * by the URLs `resolveDestination` actually builds - identity-derived routes included, parameter spellings
9
+ * treated as equal.
10
+ */ function diagnoseRenderedNavigation(graph) {
11
+ return diagnoseNavigation(graph, navigationRouteKey);
12
+ }
13
+
14
+ export { diagnoseRenderedNavigation };
15
+ //# sourceMappingURL=diagnoseRenderedNavigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnoseRenderedNavigation.js","sources":["../../../navigation/diagnoseRenderedNavigation.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 { NavigationDiagnostic, NavigationGraph, diagnoseNavigation } from '@cratis/scene.engine';\nimport { navigationRouteKey } from './navigationRouteKey';\n\n/**\n * Diagnoses navigation the way this renderer routes it: the engine's checks, with duplicate routes compared\n * by the URLs `resolveDestination` actually builds - identity-derived routes included, parameter spellings\n * treated as equal.\n */\nexport function diagnoseRenderedNavigation(graph: NavigationGraph): NavigationDiagnostic[] {\n return diagnoseNavigation(graph, navigationRouteKey);\n}\n"],"names":["diagnoseRenderedNavigation","graph","diagnoseNavigation","navigationRouteKey"],"mappings":";;;AAAA;AACA;AAKA;;;;IAKO,SAASA,0BAAAA,CAA2BC,KAAsB,EAAA;AAC7D,IAAA,OAAOC,mBAAmBD,KAAAA,EAAOE,kBAAAA,CAAAA;AACrC;;"}
@@ -0,0 +1,3 @@
1
+ import { DestinationReference } from '@cratis/scene.model';
2
+ export declare function identityRoute(destination: DestinationReference): string | undefined;
3
+ //# sourceMappingURL=identityRoute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identityRoute.d.ts","sourceRoot":"","sources":["../../../navigation/identityRoute.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAM3D,wBAAgB,aAAa,CAAC,WAAW,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAInF"}
@@ -0,0 +1,17 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ /**
4
+ * The route a destination gets when no route override was authored: its screen name, or its stable
5
+ * module/feature/slice identity as a path.
6
+ */ function identityRoute(destination) {
7
+ if (destination.screen) return destination.screen;
8
+ const parts = [
9
+ destination.module,
10
+ destination.feature,
11
+ destination.slice
12
+ ].filter((part)=>typeof part === 'string' && part.length > 0);
13
+ return parts.length ? parts.join('/') : undefined;
14
+ }
15
+
16
+ export { identityRoute };
17
+ //# sourceMappingURL=identityRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identityRoute.js","sources":["../../../navigation/identityRoute.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 { DestinationReference } from '@cratis/scene.model';\n\n/**\n * The route a destination gets when no route override was authored: its screen name, or its stable\n * module/feature/slice identity as a path.\n */\nexport function identityRoute(destination: DestinationReference): string | undefined {\n if (destination.screen) return destination.screen;\n const parts = [destination.module, destination.feature, destination.slice].filter((part): part is string => typeof part === 'string' && part.length > 0);\n return parts.length ? parts.join('/') : undefined;\n}\n"],"names":["identityRoute","destination","screen","parts","module","feature","slice","filter","part","length","join","undefined"],"mappings":"AAAA;AACA;AAIA;;;IAIO,SAASA,aAAAA,CAAcC,WAAiC,EAAA;AAC3D,IAAA,IAAIA,WAAAA,CAAYC,MAAM,EAAE,OAAOD,YAAYC,MAAM;AACjD,IAAA,MAAMC,KAAAA,GAAQ;AAACF,QAAAA,WAAAA,CAAYG,MAAM;AAAEH,QAAAA,WAAAA,CAAYI,OAAO;AAAEJ,QAAAA,WAAAA,CAAYK;KAAM,CAACC,MAAM,CAAC,CAACC,IAAAA,GAAyB,OAAOA,IAAAA,KAAS,QAAA,IAAYA,IAAAA,CAAKC,MAAM,GAAG,CAAA,CAAA;AACtJ,IAAA,OAAON,MAAMM,MAAM,GAAGN,KAAAA,CAAMO,IAAI,CAAC,GAAA,CAAA,GAAOC,SAAAA;AAC5C;;"}
@@ -2,4 +2,7 @@ export * from './DestinationResolution';
2
2
  export * from './SceneNavigationContext';
3
3
  export * from './SceneNavigationHost';
4
4
  export * from './resolveDestination';
5
+ export * from './diagnoseRenderedNavigation';
6
+ export * from './identityRoute';
7
+ export * from './navigationRouteKey';
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
@@ -2,4 +2,7 @@ export * from './DestinationResolution';
2
2
  export * from './SceneNavigationContext';
3
3
  export * from './SceneNavigationHost';
4
4
  export * from './resolveDestination';
5
+ export * from './diagnoseRenderedNavigation';
6
+ export * from './identityRoute';
7
+ export * from './navigationRouteKey';
5
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { NavigationRouteKey } from '@cratis/scene.engine';
2
+ export declare const navigationRouteKey: NavigationRouteKey;
3
+ //# sourceMappingURL=navigationRouteKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigationRouteKey.d.ts","sourceRoot":"","sources":["../../../navigation/navigationRouteKey.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAS1D,eAAO,MAAM,kBAAkB,EAAE,kBAShC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { identityRoute } from './identityRoute.js';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * The route a destination occupies in this renderer: the authored override or the identity-derived route -
7
+ * the same base `resolveDestination` builds a URL from - with surrounding slashes removed and every parameter
8
+ * placeholder (`{id}` or `:id`) reduced to one marker, so `/invoices/{id}` and `invoices/:invoiceId` are the
9
+ * same URL.
10
+ */ const navigationRouteKey = (destination)=>{
11
+ const route = destination.route ?? identityRoute(destination);
12
+ if (!route?.trim()) return undefined;
13
+ return route.trim().split('/').filter((segment)=>segment.length > 0).map((segment)=>/^\{[^}]*\}$/.test(segment) || /^:.+$/.test(segment) ? '{}' : segment).join('/');
14
+ };
15
+
16
+ export { navigationRouteKey };
17
+ //# sourceMappingURL=navigationRouteKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigationRouteKey.js","sources":["../../../navigation/navigationRouteKey.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 { NavigationRouteKey } from '@cratis/scene.engine';\nimport { identityRoute } from './identityRoute';\n\n/**\n * The route a destination occupies in this renderer: the authored override or the identity-derived route -\n * the same base `resolveDestination` builds a URL from - with surrounding slashes removed and every parameter\n * placeholder (`{id}` or `:id`) reduced to one marker, so `/invoices/{id}` and `invoices/:invoiceId` are the\n * same URL.\n */\nexport const navigationRouteKey: NavigationRouteKey = destination => {\n const route = destination.route ?? identityRoute(destination);\n if (!route?.trim()) return undefined;\n return route\n .trim()\n .split('/')\n .filter(segment => segment.length > 0)\n .map(segment => (/^\\{[^}]*\\}$/.test(segment) || /^:.+$/.test(segment) ? '{}' : segment))\n .join('/');\n};\n"],"names":["navigationRouteKey","destination","route","identityRoute","trim","undefined","split","filter","segment","length","map","test","join"],"mappings":";;AAAA;AACA;AAKA;;;;;IAMO,MAAMA,kBAAAA,GAAyCC,CAAAA,WAAAA,GAAAA;AAClD,IAAA,MAAMC,KAAAA,GAAQD,WAAAA,CAAYC,KAAK,IAAIC,aAAAA,CAAcF,WAAAA,CAAAA;IACjD,IAAI,CAACC,KAAAA,EAAOE,IAAAA,EAAAA,EAAQ,OAAOC,SAAAA;AAC3B,IAAA,OAAOH,KAAAA,CACFE,IAAI,EAAA,CACJE,KAAK,CAAC,GAAA,CAAA,CACNC,MAAM,CAACC,CAAAA,OAAAA,GAAWA,OAAAA,CAAQC,MAAM,GAAG,CAAA,CAAA,CACnCC,GAAG,CAACF,CAAAA,OAAAA,GAAY,aAAA,CAAcG,IAAI,CAACH,OAAAA,CAAAA,IAAY,OAAA,CAAQG,IAAI,CAACH,OAAAA,CAAAA,GAAW,IAAA,GAAOA,OAAAA,CAAAA,CAC9EI,IAAI,CAAC,GAAA,CAAA;AACd;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDestination.d.ts","sourceRoot":"","sources":["../../../navigation/resolveDestination.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAA4B,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAmB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,oBAAoB,EAAE,KAAK,GAAE,YAAiB,GAAG,qBAAqB,CAiBrH"}
1
+ {"version":3,"file":"resolveDestination.d.ts","sourceRoot":"","sources":["../../../navigation/resolveDestination.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAA4B,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAmB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAMhE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,oBAAoB,EAAE,KAAK,GAAE,YAAiB,GAAG,qBAAqB,CAiBrH"}
@@ -1,5 +1,6 @@
1
1
  import { resolveBindingExpression } from '@cratis/scene.engine';
2
2
  import { DestinationKind } from '@cratis/scene.model';
3
+ import { identityRoute } from './identityRoute.js';
3
4
 
4
5
  // Copyright (c) Cratis. All rights reserved.
5
6
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
@@ -24,15 +25,6 @@ import { DestinationKind } from '@cratis/scene.model';
24
25
  diagnostics
25
26
  };
26
27
  }
27
- function identityRoute(destination) {
28
- if (destination.screen) return destination.screen;
29
- const parts = [
30
- destination.module,
31
- destination.feature,
32
- destination.slice
33
- ].filter((part)=>typeof part === 'string' && part.length > 0);
34
- return parts.length ? parts.join('/') : undefined;
35
- }
36
28
  function appendParameters(route, parameters) {
37
29
  if (!parameters.length) return route;
38
30
  let replaced = route;
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDestination.js","sources":["../../../navigation/resolveDestination.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 { BindingScope, resolveBindingExpression } from '@cratis/scene.engine';\nimport { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { DestinationResolution } from './DestinationResolution';\n\n/**\n * Resolves a destination into a renderer-neutral navigation action, deep link and target outlet/dialog.\n */\nexport function resolveDestination(destination: DestinationReference, scope: BindingScope = {}): DestinationResolution {\n const diagnostics: string[] = [];\n const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);\n const parameters = Object.entries(destination.routeParameterBindings ?? {})\n .map(([name, binding]) => [name, String(resolveBindingExpression(binding, scope) ?? '')] as const);\n const base = destination.route ?? identityRoute(destination);\n if (!base && kind !== DestinationKind.Dialog) diagnostics.push('Destination has no routeable screen, stable identity or route.');\n\n const url = base ? appendParameters(base, parameters) : undefined;\n return {\n kind,\n url,\n outlet: destination.outlet,\n dialog: destination.dialog,\n action: kind === DestinationKind.Dialog ? 'openDialog' : kind === DestinationKind.External ? 'openExternal' : 'navigate',\n diagnostics,\n };\n}\n\nfunction identityRoute(destination: DestinationReference): string | undefined {\n if (destination.screen) return destination.screen;\n const parts = [destination.module, destination.feature, destination.slice].filter((part): part is string => typeof part === 'string' && part.length > 0);\n return parts.length ? parts.join('/') : undefined;\n}\n\nfunction appendParameters(route: string, parameters: readonly (readonly [string, string])[]): string {\n if (!parameters.length) return route;\n let replaced = route;\n const unused: string[] = [];\n for (const [name, value] of parameters) {\n const marker = `{${name}}`;\n if (replaced.includes(marker)) {\n replaced = replaced.split(marker).join(encodeURIComponent(value));\n } else {\n unused.push(`${encodeURIComponent(name)}=${encodeURIComponent(value)}`);\n }\n }\n\n return unused.length ? `${replaced}?${unused.join('&')}` : replaced;\n}\n"],"names":["resolveDestination","destination","scope","diagnostics","kind","dialog","DestinationKind","Dialog","Outlet","parameters","Object","entries","routeParameterBindings","map","name","binding","String","resolveBindingExpression","base","route","identityRoute","push","url","appendParameters","undefined","outlet","action","External","screen","parts","module","feature","slice","filter","part","length","join","replaced","unused","value","marker","includes","split","encodeURIComponent"],"mappings":";;;AAAA;AACA;AAMA;;AAEC,IACM,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}
1
+ {"version":3,"file":"resolveDestination.js","sources":["../../../navigation/resolveDestination.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 { BindingScope, resolveBindingExpression } from '@cratis/scene.engine';\nimport { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { DestinationResolution } from './DestinationResolution';\nimport { identityRoute } from './identityRoute';\n\n/**\n * Resolves a destination into a renderer-neutral navigation action, deep link and target outlet/dialog.\n */\nexport function resolveDestination(destination: DestinationReference, scope: BindingScope = {}): DestinationResolution {\n const diagnostics: string[] = [];\n const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);\n const parameters = Object.entries(destination.routeParameterBindings ?? {})\n .map(([name, binding]) => [name, String(resolveBindingExpression(binding, scope) ?? '')] as const);\n const base = destination.route ?? identityRoute(destination);\n if (!base && kind !== DestinationKind.Dialog) diagnostics.push('Destination has no routeable screen, stable identity or route.');\n\n const url = base ? appendParameters(base, parameters) : undefined;\n return {\n kind,\n url,\n outlet: destination.outlet,\n dialog: destination.dialog,\n action: kind === DestinationKind.Dialog ? 'openDialog' : kind === DestinationKind.External ? 'openExternal' : 'navigate',\n diagnostics,\n };\n}\n\nfunction appendParameters(route: string, parameters: readonly (readonly [string, string])[]): string {\n if (!parameters.length) return route;\n let replaced = route;\n const unused: string[] = [];\n for (const [name, value] of parameters) {\n const marker = `{${name}}`;\n if (replaced.includes(marker)) {\n replaced = replaced.split(marker).join(encodeURIComponent(value));\n } else {\n unused.push(`${encodeURIComponent(name)}=${encodeURIComponent(value)}`);\n }\n }\n\n return unused.length ? `${replaced}?${unused.join('&')}` : replaced;\n}\n"],"names":["resolveDestination","destination","scope","diagnostics","kind","dialog","DestinationKind","Dialog","Outlet","parameters","Object","entries","routeParameterBindings","map","name","binding","String","resolveBindingExpression","base","route","identityRoute","push","url","appendParameters","undefined","outlet","action","External","length","replaced","unused","value","marker","includes","split","join","encodeURIComponent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vF,IAAA,IAAI,CAACA,UAAAA,CAAWmB,MAAM,EAAE,OAAOT,KAAAA;AAC/B,IAAA,IAAIU,QAAAA,GAAWV,KAAAA;AACf,IAAA,MAAMW,SAAmB,EAAE;AAC3B,IAAA,KAAK,MAAM,CAAChB,IAAAA,EAAMiB,KAAAA,CAAM,IAAItB,UAAAA,CAAY;AACpC,QAAA,MAAMuB,SAAS,CAAC,CAAC,EAAElB,IAAAA,CAAK,CAAC,CAAC;QAC1B,IAAIe,QAAAA,CAASI,QAAQ,CAACD,MAAAA,CAAAA,EAAS;AAC3BH,YAAAA,QAAAA,GAAWA,SAASK,KAAK,CAACF,MAAAA,CAAAA,CAAQG,IAAI,CAACC,kBAAAA,CAAmBL,KAAAA,CAAAA,CAAAA;QAC9D,CAAA,MAAO;YACHD,MAAAA,CAAOT,IAAI,CAAC,CAAA,EAAGe,kBAAAA,CAAmBtB,MAAM,CAAC,EAAEsB,mBAAmBL,KAAAA,CAAAA,CAAAA,CAAQ,CAAA;AAC1E,QAAA;AACJ,IAAA;IAEA,OAAOD,MAAAA,CAAOF,MAAM,GAAG,CAAA,EAAGC,QAAAA,CAAS,CAAC,EAAEC,MAAAA,CAAOK,IAAI,CAAC,GAAA,CAAA,CAAA,CAAM,GAAGN,QAAAA;AAC/D;;"}
@@ -0,0 +1,7 @@
1
+ import { SceneEdit } from '@cratis/scene.model';
2
+ export interface DesignTimeActionOutcome {
3
+ submitted: boolean;
4
+ edits: SceneEdit[];
5
+ diagnostics: string[];
6
+ }
7
+ //# sourceMappingURL=DesignTimeActionOutcome.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeActionOutcome.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeActionOutcome.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,MAAM,WAAW,uBAAuB;IAEpC,SAAS,EAAE,OAAO,CAAC;IAGnB,KAAK,EAAE,SAAS,EAAE,CAAC;IAGnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DesignTimeActionOutcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeActionOutcome.js","sourceRoot":"","sources":["../../../packages/DesignTimeActionOutcome.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { DesignTimeActionDescriptor } from '@cratis/scene.model';
2
+ export interface DesignTimeActionState {
3
+ descriptor: DesignTimeActionDescriptor;
4
+ package: string;
5
+ visible: boolean;
6
+ enabled: boolean;
7
+ diagnostic?: string;
8
+ }
9
+ //# sourceMappingURL=DesignTimeActionState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeActionState.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeActionState.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAMjE,MAAM,WAAW,qBAAqB;IAClC,UAAU,EAAE,0BAA0B,CAAC;IAGvC,OAAO,EAAE,MAAM,CAAC;IAEhB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IAGjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DesignTimeActionState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeActionState.js","sourceRoot":"","sources":["../../../packages/DesignTimeActionState.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare const DesignTimeContractVersion = "1.0";
2
+ //# sourceMappingURL=DesignTimeContractVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeContractVersion.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeContractVersion.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,yBAAyB,QAAQ,CAAC"}
@@ -0,0 +1,13 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ /**
4
+ * The design-time extension contract this host implements, as `major.minor`.
5
+ *
6
+ * The contract is the set of extension points a package's design-time bundle fills - previews, designers,
7
+ * property editors, property displays and actions - and the props and context each receives. A minor
8
+ * version adds optional members; a major version changes or removes them. A host loads a package's
9
+ * contributions only when the package's declared major version matches this one.
10
+ */ const DesignTimeContractVersion = '1.0';
11
+
12
+ export { DesignTimeContractVersion };
13
+ //# sourceMappingURL=DesignTimeContractVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeContractVersion.js","sources":["../../../packages/DesignTimeContractVersion.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\n/**\n * The design-time extension contract this host implements, as `major.minor`.\n *\n * The contract is the set of extension points a package's design-time bundle fills - previews, designers,\n * property editors, property displays and actions - and the props and context each receives. A minor\n * version adds optional members; a major version changes or removes them. A host loads a package's\n * contributions only when the package's declared major version matches this one.\n */\nexport const DesignTimeContractVersion = '1.0';\n"],"names":["DesignTimeContractVersion"],"mappings":"AAAA;AACA;AAEA;;;;;;;IAQO,MAAMA,yBAAAA,GAA4B;;"}
@@ -0,0 +1,9 @@
1
+ export declare enum DesignTimeExtensionPoint {
2
+ Preview = "previews",
3
+ Designer = "designers",
4
+ PropertyEditor = "propertyEditors",
5
+ PropertyDisplay = "propertyDisplays",
6
+ Action = "actions"
7
+ }
8
+ export declare const designTimeExtensionPointLabels: Record<DesignTimeExtensionPoint, string>;
9
+ //# sourceMappingURL=DesignTimeExtensionPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeExtensionPoint.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeExtensionPoint.ts"],"names":[],"mappings":"AAOA,oBAAY,wBAAwB;IAChC,OAAO,aAAa;IACpB,QAAQ,cAAc;IACtB,cAAc,oBAAoB;IAClC,eAAe,qBAAqB;IACpC,MAAM,YAAY;CACrB;AAGD,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,wBAAwB,EAAE,MAAM,CAMnF,CAAC"}