@cratis/scene.react 4.8.0 → 4.10.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 (134) hide show
  1. package/SceneElementView.tsx +34 -5
  2. package/dist/cjs/SceneElementView.js +20 -5
  3. package/dist/cjs/SceneElementView.js.map +1 -1
  4. package/dist/cjs/core/coreComponents.js +4 -0
  5. package/dist/cjs/core/coreComponents.js.map +1 -1
  6. package/dist/cjs/core/coreDescriptors.js +3 -0
  7. package/dist/cjs/core/coreDescriptors.js.map +1 -1
  8. package/dist/cjs/index.js +19 -0
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/navigation/resolveDestination.js +54 -0
  11. package/dist/cjs/navigation/resolveDestination.js.map +1 -0
  12. package/dist/cjs/packages/DesignTimeBundle.js +17 -0
  13. package/dist/cjs/packages/DesignTimeBundle.js.map +1 -0
  14. package/dist/cjs/packages/DesignTimeProvider.js +23 -0
  15. package/dist/cjs/packages/DesignTimeProvider.js.map +1 -0
  16. package/dist/cjs/packages/PackageHostConfiguration.js +71 -0
  17. package/dist/cjs/packages/PackageHostConfiguration.js.map +1 -0
  18. package/dist/cjs/packages/ScenePackageBundle.js +2 -0
  19. package/dist/cjs/packages/ScenePackageBundle.js.map +1 -1
  20. package/dist/cjs/renderer/AbortableQueryRunner.js +26 -0
  21. package/dist/cjs/renderer/AbortableQueryRunner.js.map +1 -0
  22. package/dist/cjs/renderer/BindingOutputContext.js +74 -0
  23. package/dist/cjs/renderer/BindingOutputContext.js.map +1 -0
  24. package/dist/cjs/renderer/InteractiveComponent.js +37 -2
  25. package/dist/cjs/renderer/InteractiveComponent.js.map +1 -1
  26. package/dist/cjs/renderer/RenderBindingScopeContext.js +77 -0
  27. package/dist/cjs/renderer/RenderBindingScopeContext.js.map +1 -0
  28. package/dist/esm/SceneElementView.d.ts +6 -2
  29. package/dist/esm/SceneElementView.d.ts.map +1 -1
  30. package/dist/esm/SceneElementView.js +20 -5
  31. package/dist/esm/SceneElementView.js.map +1 -1
  32. package/dist/esm/core/coreComponents.js +4 -0
  33. package/dist/esm/core/coreComponents.js.map +1 -1
  34. package/dist/esm/core/coreDescriptors.js +3 -0
  35. package/dist/esm/core/coreDescriptors.js.map +1 -1
  36. package/dist/esm/index.d.ts +1 -0
  37. package/dist/esm/index.d.ts.map +1 -1
  38. package/dist/esm/index.js +7 -0
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/navigation/DestinationResolution.d.ts +10 -0
  41. package/dist/esm/navigation/DestinationResolution.d.ts.map +1 -0
  42. package/dist/esm/navigation/DestinationResolution.js +2 -0
  43. package/dist/esm/navigation/DestinationResolution.js.map +1 -0
  44. package/dist/esm/navigation/index.d.ts +3 -0
  45. package/dist/esm/navigation/index.d.ts.map +1 -0
  46. package/dist/esm/navigation/index.js +3 -0
  47. package/dist/esm/navigation/index.js.map +1 -0
  48. package/dist/esm/navigation/resolveDestination.d.ts +5 -0
  49. package/dist/esm/navigation/resolveDestination.d.ts.map +1 -0
  50. package/dist/esm/navigation/resolveDestination.js +52 -0
  51. package/dist/esm/navigation/resolveDestination.js.map +1 -0
  52. package/dist/esm/packages/DesignTimeAction.d.ts +22 -0
  53. package/dist/esm/packages/DesignTimeAction.d.ts.map +1 -0
  54. package/dist/esm/packages/DesignTimeAction.js +2 -0
  55. package/dist/esm/packages/DesignTimeAction.js.map +1 -0
  56. package/dist/esm/packages/DesignTimeBundle.d.ts +14 -0
  57. package/dist/esm/packages/DesignTimeBundle.d.ts.map +1 -0
  58. package/dist/esm/packages/DesignTimeBundle.js +15 -0
  59. package/dist/esm/packages/DesignTimeBundle.js.map +1 -0
  60. package/dist/esm/packages/DesignTimeComponentProps.d.ts +5 -0
  61. package/dist/esm/packages/DesignTimeComponentProps.d.ts.map +1 -0
  62. package/dist/esm/packages/DesignTimeComponentProps.js +2 -0
  63. package/dist/esm/packages/DesignTimeComponentProps.js.map +1 -0
  64. package/dist/esm/packages/DesignTimeContext.d.ts +18 -0
  65. package/dist/esm/packages/DesignTimeContext.d.ts.map +1 -0
  66. package/dist/esm/packages/DesignTimeContext.js +2 -0
  67. package/dist/esm/packages/DesignTimeContext.js.map +1 -0
  68. package/dist/esm/packages/DesignTimePropertyDisplayProps.d.ts +8 -0
  69. package/dist/esm/packages/DesignTimePropertyDisplayProps.d.ts.map +1 -0
  70. package/dist/esm/packages/DesignTimePropertyDisplayProps.js +2 -0
  71. package/dist/esm/packages/DesignTimePropertyDisplayProps.js.map +1 -0
  72. package/dist/esm/packages/DesignTimePropertyEditorProps.d.ts +9 -0
  73. package/dist/esm/packages/DesignTimePropertyEditorProps.d.ts.map +1 -0
  74. package/dist/esm/packages/DesignTimePropertyEditorProps.js +2 -0
  75. package/dist/esm/packages/DesignTimePropertyEditorProps.js.map +1 -0
  76. package/dist/esm/packages/DesignTimeProvider.d.ts +9 -0
  77. package/dist/esm/packages/DesignTimeProvider.d.ts.map +1 -0
  78. package/dist/esm/packages/DesignTimeProvider.js +20 -0
  79. package/dist/esm/packages/DesignTimeProvider.js.map +1 -0
  80. package/dist/esm/packages/PackageHostConfiguration.d.ts +25 -0
  81. package/dist/esm/packages/PackageHostConfiguration.d.ts.map +1 -0
  82. package/dist/esm/packages/PackageHostConfiguration.js +69 -0
  83. package/dist/esm/packages/PackageHostConfiguration.js.map +1 -0
  84. package/dist/esm/packages/ScenePackageBundle.d.ts +2 -0
  85. package/dist/esm/packages/ScenePackageBundle.d.ts.map +1 -1
  86. package/dist/esm/packages/ScenePackageBundle.js +2 -0
  87. package/dist/esm/packages/ScenePackageBundle.js.map +1 -1
  88. package/dist/esm/packages/index.d.ts +9 -0
  89. package/dist/esm/packages/index.d.ts.map +1 -1
  90. package/dist/esm/packages/index.js +9 -0
  91. package/dist/esm/packages/index.js.map +1 -1
  92. package/dist/esm/renderer/AbortableQueryRunner.d.ts +7 -0
  93. package/dist/esm/renderer/AbortableQueryRunner.d.ts.map +1 -0
  94. package/dist/esm/renderer/AbortableQueryRunner.js +24 -0
  95. package/dist/esm/renderer/AbortableQueryRunner.js.map +1 -0
  96. package/dist/esm/renderer/BindingOutputContext.d.ts +18 -0
  97. package/dist/esm/renderer/BindingOutputContext.d.ts.map +1 -0
  98. package/dist/esm/renderer/BindingOutputContext.js +70 -0
  99. package/dist/esm/renderer/BindingOutputContext.js.map +1 -0
  100. package/dist/esm/renderer/ComponentRegistry.d.ts +2 -0
  101. package/dist/esm/renderer/ComponentRegistry.d.ts.map +1 -1
  102. package/dist/esm/renderer/InteractiveComponent.d.ts.map +1 -1
  103. package/dist/esm/renderer/InteractiveComponent.js +38 -3
  104. package/dist/esm/renderer/InteractiveComponent.js.map +1 -1
  105. package/dist/esm/renderer/RenderBindingScopeContext.d.ts +14 -0
  106. package/dist/esm/renderer/RenderBindingScopeContext.d.ts.map +1 -0
  107. package/dist/esm/renderer/RenderBindingScopeContext.js +73 -0
  108. package/dist/esm/renderer/RenderBindingScopeContext.js.map +1 -0
  109. package/dist/esm/renderer/index.d.ts +3 -0
  110. package/dist/esm/renderer/index.d.ts.map +1 -1
  111. package/dist/esm/renderer/index.js +3 -0
  112. package/dist/esm/renderer/index.js.map +1 -1
  113. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  114. package/index.ts +1 -0
  115. package/navigation/DestinationResolution.ts +13 -0
  116. package/navigation/index.ts +5 -0
  117. package/navigation/resolveDestination.ts +50 -0
  118. package/package.json +5 -5
  119. package/packages/DesignTimeAction.ts +24 -0
  120. package/packages/DesignTimeBundle.ts +30 -0
  121. package/packages/DesignTimeComponentProps.ts +11 -0
  122. package/packages/DesignTimeContext.ts +32 -0
  123. package/packages/DesignTimePropertyDisplayProps.ts +14 -0
  124. package/packages/DesignTimePropertyEditorProps.ts +15 -0
  125. package/packages/DesignTimeProvider.tsx +25 -0
  126. package/packages/PackageHostConfiguration.ts +98 -0
  127. package/packages/ScenePackageBundle.ts +5 -0
  128. package/packages/index.ts +9 -0
  129. package/renderer/AbortableQueryRunner.ts +27 -0
  130. package/renderer/BindingOutputContext.tsx +69 -0
  131. package/renderer/ComponentRegistry.ts +4 -0
  132. package/renderer/InteractiveComponent.tsx +30 -3
  133. package/renderer/RenderBindingScopeContext.tsx +73 -0
  134. package/renderer/index.ts +3 -0
@@ -0,0 +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,SAASA,kBAAAA,CAAmBC,WAAiC,EAAEC,KAAAA,GAAsB,EAAE,EAAA;AAC1F,IAAA,MAAMC,cAAwB,EAAE;AAChC,IAAA,MAAMC,IAAAA,GAAOH,WAAAA,CAAYG,IAAI,KAAKH,WAAAA,CAAYI,MAAM,GAAGC,eAAAA,CAAgBC,MAAM,GAAGD,eAAAA,CAAgBE,MAAM,CAAD;AACrG,IAAA,MAAMC,UAAAA,GAAaC,MAAAA,CAAOC,OAAO,CAACV,YAAYW,sBAAsB,IAAI,EAAC,CAAA,CACpEC,GAAG,CAAC,CAAC,CAACC,IAAAA,EAAMC,QAAQ,GAAK;AAACD,YAAAA,IAAAA;YAAME,MAAAA,CAAOC,wBAAAA,CAAyBF,SAASb,KAAAA,CAAAA,IAAU,EAAA;AAAI,SAAA,CAAA;AAC5F,IAAA,MAAMgB,IAAAA,GAAOjB,WAAAA,CAAYkB,KAAK,IAAIC,aAAAA,CAAcnB,WAAAA,CAAAA;IAChD,IAAI,CAACiB,QAAQd,IAAAA,KAASE,eAAAA,CAAgBC,MAAM,EAAEJ,WAAAA,CAAYkB,IAAI,CAAC,gEAAA,CAAA;AAE/D,IAAA,MAAMC,GAAAA,GAAMJ,IAAAA,GAAOK,gBAAAA,CAAiBL,IAAAA,EAAMT,UAAAA,CAAAA,GAAce,SAAAA;IACxD,OAAO;AACHpB,QAAAA,IAAAA;AACAkB,QAAAA,GAAAA;AACAG,QA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A,CAAAA,CAAAA;QAC9D,CAAA,MAAO;YACHD,MAAAA,CAAOjB,IAAI,CAAC,CAAA,EAAGsB,kBAAAA,CAAmB7B,MAAM,CAAC,EAAE6B,mBAAmBJ,KAAAA,CAAAA,CAAAA,CAAQ,CAAA;AAC1E,QAAA;AACJ,IAAA;IAEA,OAAOD,MAAAA,CAAOH,MAAM,GAAG,CAAA,EAAGE,QAAAA,CAAS,CAAC,EAAEC,MAAAA,CAAOF,IAAI,CAAC,GAAA,CAAA,CAAA,CAAM,GAAGC,QAAAA;AAC/D;;"}
@@ -0,0 +1,22 @@
1
+ import { DesignTimeActionDescriptor, SceneEdit } from '@cratis/scene.model';
2
+ import { DesignTimeContext } from './DesignTimeContext';
3
+ export interface DesignTimeActionContext extends DesignTimeContext {
4
+ commandMetadata?: {
5
+ properties: {
6
+ name: string;
7
+ type: string;
8
+ label?: string;
9
+ }[];
10
+ };
11
+ }
12
+ export interface DesignTimeActionResult {
13
+ edits: SceneEdit[];
14
+ diagnostics: string[];
15
+ }
16
+ export interface DesignTimeAction {
17
+ descriptor: DesignTimeActionDescriptor;
18
+ isVisible(context: DesignTimeActionContext): boolean;
19
+ isEnabled(context: DesignTimeActionContext): boolean;
20
+ execute(context: DesignTimeActionContext): DesignTimeActionResult;
21
+ }
22
+ //# sourceMappingURL=DesignTimeAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeAction.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeAction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAC9D,eAAe,CAAC,EAAE;QAAE,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;CACtF;AAED,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,0BAA0B,CAAC;IACvC,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC;IACrD,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC;IACrD,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAAC;CACrE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DesignTimeAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeAction.js","sourceRoot":"","sources":["../../../packages/DesignTimeAction.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { ComponentType } from 'react';
2
+ import { DesignTimeAction } from './DesignTimeAction';
3
+ import { DesignTimeComponentProps } from './DesignTimeComponentProps';
4
+ import { DesignTimePropertyDisplayProps } from './DesignTimePropertyDisplayProps';
5
+ import { DesignTimePropertyEditorProps } from './DesignTimePropertyEditorProps';
6
+ export interface DesignTimeBundle {
7
+ previews?: Record<string, ComponentType<DesignTimeComponentProps>>;
8
+ designers?: Record<string, ComponentType<DesignTimeComponentProps>>;
9
+ propertyEditors?: Record<string, ComponentType<DesignTimePropertyEditorProps>>;
10
+ propertyDisplays?: Record<string, ComponentType<DesignTimePropertyDisplayProps>>;
11
+ actions?: Record<string, DesignTimeAction>;
12
+ }
13
+ export declare function validateDesignTimeBundle(bundle: DesignTimeBundle | undefined): string[];
14
+ //# sourceMappingURL=DesignTimeBundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeBundle.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeBundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC9C;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,GAAG,MAAM,EAAE,CASvF"}
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ function validateDesignTimeBundle(bundle) {
4
+ if (!bundle) return [];
5
+ const problems = [];
6
+ for (const [name, action] of Object.entries(bundle.actions ?? {})){
7
+ if (action.descriptor.id !== name) {
8
+ problems.push(`registers design-time action '${name}' with descriptor id '${action.descriptor.id}'`);
9
+ }
10
+ }
11
+ return problems;
12
+ }
13
+
14
+ export { validateDesignTimeBundle };
15
+ //# sourceMappingURL=DesignTimeBundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeBundle.js","sources":["../../../packages/DesignTimeBundle.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 { DesignTimeAction } from './DesignTimeAction';\nimport { DesignTimeComponentProps } from './DesignTimeComponentProps';\nimport { DesignTimePropertyDisplayProps } from './DesignTimePropertyDisplayProps';\nimport { DesignTimePropertyEditorProps } from './DesignTimePropertyEditorProps';\n\n/**\n * Optional React-only design-time surface a package may publish beside its runtime bundle.\n */\nexport interface DesignTimeBundle {\n previews?: Record<string, ComponentType<DesignTimeComponentProps>>;\n designers?: Record<string, ComponentType<DesignTimeComponentProps>>;\n propertyEditors?: Record<string, ComponentType<DesignTimePropertyEditorProps>>;\n propertyDisplays?: Record<string, ComponentType<DesignTimePropertyDisplayProps>>;\n actions?: Record<string, DesignTimeAction>;\n}\n\nexport function validateDesignTimeBundle(bundle: DesignTimeBundle | undefined): string[] {\n if (!bundle) return [];\n const problems: string[] = [];\n for (const [name, action] of Object.entries(bundle.actions ?? {})) {\n if (action.descriptor.id !== name) {\n problems.push(`registers design-time action '${name}' with descriptor id '${action.descriptor.id}'`);\n }\n }\n return problems;\n}\n"],"names":["validateDesignTimeBundle","bundle","problems","name","action","Object","entries","actions","descriptor","id","push"],"mappings":"AAAA;AACA;AAmBO,SAASA,yBAAyBC,MAAoC,EAAA;IACzE,IAAI,CAACA,MAAAA,EAAQ,OAAO,EAAE;AACtB,IAAA,MAAMC,WAAqB,EAAE;AAC7B,IAAA,KAAK,MAAM,CAACC,IAAAA,EAAMC,MAAAA,CAAO,IAAIC,MAAAA,CAAOC,OAAO,CAACL,MAAAA,CAAOM,OAAO,IAAI,EAAC,CAAA,CAAI;AAC/D,QAAA,IAAIH,MAAAA,CAAOI,UAAU,CAACC,EAAE,KAAKN,IAAAA,EAAM;AAC/BD,YAAAA,QAAAA,CAASQ,IAAI,CAAC,CAAC,8BAA8B,EAAEP,IAAAA,CAAK,sBAAsB,EAAEC,MAAAA,CAAOI,UAAU,CAACC,EAAE,CAAC,CAAC,CAAC,CAAA;AACvG,QAAA;AACJ,IAAA;IACA,OAAOP,QAAAA;AACX;;"}
@@ -0,0 +1,5 @@
1
+ import { DesignTimeContext } from './DesignTimeContext';
2
+ export interface DesignTimeComponentProps {
3
+ context: DesignTimeContext;
4
+ }
5
+ //# sourceMappingURL=DesignTimeComponentProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeComponentProps.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeComponentProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,wBAAwB;IACrC,OAAO,EAAE,iBAAiB,CAAC;CAC9B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DesignTimeComponentProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeComponentProps.js","sourceRoot":"","sources":["../../../packages/DesignTimeComponentProps.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { ComponentDescriptor, EffectiveConfiguration, ExternalComponent, SceneEdit, SceneElement, Screen, UiProfile } from '@cratis/scene.model';
2
+ import { BindingDiagnostic } from '@cratis/scene.engine';
3
+ import { ScenePackageBundle } from './ScenePackageBundle';
4
+ export interface DesignTimeContext {
5
+ element: ExternalComponent;
6
+ root: SceneElement;
7
+ screen?: Screen;
8
+ descriptor: ComponentDescriptor;
9
+ configuration?: EffectiveConfiguration;
10
+ profile: UiProfile;
11
+ bundles: ScenePackageBundle[];
12
+ permissions: Record<string, boolean>;
13
+ capabilities: Record<string, boolean>;
14
+ diagnostics: BindingDiagnostic[];
15
+ submitEdits(edits: SceneEdit[]): void;
16
+ submitAction(actionId: string, edits: SceneEdit[]): void;
17
+ }
18
+ //# sourceMappingURL=DesignTimeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeContext.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeContext.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,SAAS,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK1D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,mBAAmB,CAAC;IAChC,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACtC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;CAC5D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DesignTimeContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeContext.js","sourceRoot":"","sources":["../../../packages/DesignTimeContext.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { PropertyDescriptor } from '@cratis/scene.model';
2
+ import { DesignTimeContext } from './DesignTimeContext';
3
+ export interface DesignTimePropertyDisplayProps {
4
+ context: DesignTimeContext;
5
+ property: PropertyDescriptor;
6
+ value: unknown;
7
+ }
8
+ //# sourceMappingURL=DesignTimePropertyDisplayProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimePropertyDisplayProps.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimePropertyDisplayProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,8BAA8B;IAC3C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DesignTimePropertyDisplayProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimePropertyDisplayProps.js","sourceRoot":"","sources":["../../../packages/DesignTimePropertyDisplayProps.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { PropertyDescriptor } from '@cratis/scene.model';
2
+ import { DesignTimeContext } from './DesignTimeContext';
3
+ export interface DesignTimePropertyEditorProps {
4
+ context: DesignTimeContext;
5
+ property: PropertyDescriptor;
6
+ value: unknown;
7
+ setValue(value: unknown): void;
8
+ }
9
+ //# sourceMappingURL=DesignTimePropertyEditorProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimePropertyEditorProps.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimePropertyEditorProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,6BAA6B;IAC1C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DesignTimePropertyEditorProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimePropertyEditorProps.js","sourceRoot":"","sources":["../../../packages/DesignTimePropertyEditorProps.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { DesignTimeContext } from './DesignTimeContext';
3
+ export interface DesignTimeProviderProps {
4
+ context: DesignTimeContext;
5
+ children: ReactNode;
6
+ }
7
+ export declare function DesignTimeProvider({ context, children }: DesignTimeProviderProps): import("react").JSX.Element;
8
+ export declare function useDesignTimeContext(): DesignTimeContext;
9
+ //# sourceMappingURL=DesignTimeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeProvider.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAKD,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,uBAAuB,+BAEhF;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAIxD"}
@@ -0,0 +1,20 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useContext, createContext } from 'react';
3
+
4
+ const Context = /*#__PURE__*/ createContext(undefined);
5
+ /**
6
+ * Makes the generic package-side design-time context available to nested package components.
7
+ */ function DesignTimeProvider({ context, children }) {
8
+ return /*#__PURE__*/ jsx(Context.Provider, {
9
+ value: context,
10
+ children: children
11
+ });
12
+ }
13
+ function useDesignTimeContext() {
14
+ const context = useContext(Context);
15
+ if (!context) throw new Error('No Scene design-time context is available.');
16
+ return context;
17
+ }
18
+
19
+ export { DesignTimeProvider, useDesignTimeContext };
20
+ //# sourceMappingURL=DesignTimeProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DesignTimeProvider.js","sources":["../../../packages/DesignTimeProvider.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 { ReactNode, createContext, useContext } from 'react';\nimport { DesignTimeContext } from './DesignTimeContext';\n\nconst Context = createContext<DesignTimeContext | undefined>(undefined);\n\nexport interface DesignTimeProviderProps {\n context: DesignTimeContext;\n children: ReactNode;\n}\n\n/**\n * Makes the generic package-side design-time context available to nested package components.\n */\nexport function DesignTimeProvider({ context, children }: DesignTimeProviderProps) {\n return <Context.Provider value={context}>{children}</Context.Provider>;\n}\n\nexport function useDesignTimeContext(): DesignTimeContext {\n const context = useContext(Context);\n if (!context) throw new Error('No Scene design-time context is available.');\n return context;\n}\n"],"names":["Context","createContext","undefined","DesignTimeProvider","context","children","_jsx","Provider","value","useDesignTimeContext","useContext","Error"],"mappings":";;;AAMA,MAAMA,wBAAUC,aAAAA,CAA6CC,SAAAA,CAAAA;AAO7D;;AAEC,IACM,SAASC,kBAAAA,CAAmB,EAAEC,OAAO,EAAEC,QAAQ,EAA2B,EAAA;IAC7E,qBAAOC,GAAA,CAACN,QAAQO,QAAQ,EAAA;QAACC,KAAAA,EAAOJ,OAAAA;AAAUC,QAAAA,QAAAA,EAAAA;;AAC9C;AAEO,SAASI,oBAAAA,GAAAA;AACZ,IAAA,MAAML,UAAUM,UAAAA,CAAWV,OAAAA,CAAAA;AAC3B,IAAA,IAAI,CAACI,OAAAA,EAAS,MAAM,IAAIO,KAAAA,CAAM,4CAAA,CAAA;IAC9B,OAAOP,OAAAA;AACX;;"}
@@ -0,0 +1,25 @@
1
+ import { DialogTemplate, Layout, ScreenTemplate, Theme, UiProfile } from '@cratis/scene.model';
2
+ import { IconAdapterRegistry } from '../icons/IconAdapterRegistry';
3
+ import { ScenePackageBundle, mergePackageRegistries } from './ScenePackageBundle';
4
+ export interface PackageHostPolicy {
5
+ allowExecutableImports: boolean;
6
+ allowNetworkAssets: boolean;
7
+ }
8
+ export interface PackageHostConfiguration {
9
+ bundles: ScenePackageBundle[];
10
+ profile: UiProfile;
11
+ policy: PackageHostPolicy;
12
+ }
13
+ export interface ResolvedPackageHost {
14
+ bundles: ScenePackageBundle[];
15
+ components: ReturnType<typeof mergePackageRegistries>;
16
+ layouts: Layout[];
17
+ screenTemplates: ScreenTemplate[];
18
+ dialogTemplates: DialogTemplate[];
19
+ themes: Theme[];
20
+ icons: IconAdapterRegistry;
21
+ assets: string[];
22
+ diagnostics: string[];
23
+ }
24
+ export declare function resolvePackageHost(configuration: PackageHostConfiguration): ResolvedPackageHost;
25
+ //# sourceMappingURL=PackageHostConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageHostConfiguration.d.ts","sourceRoot":"","sources":["../../../packages/PackageHostConfiguration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAA6B,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAyB,MAAM,sBAAsB,CAAC;AAEzG,MAAM,WAAW,iBAAiB;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACrC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,UAAU,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;IACtD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,wBAAwB,GAAG,mBAAmB,CA+D/F"}
@@ -0,0 +1,69 @@
1
+ import { resolvePackageDependencies } from '@cratis/scene.engine';
2
+ import { createIconAdapterRegistry } from '../icons/IconAdapterRegistry.js';
3
+ import { validatePackageBundle, mergePackageRegistries } from './ScenePackageBundle.js';
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
+ /**
8
+ * Resolves the approved package set a standalone or embedded React host uses.
9
+ */ function resolvePackageHost(configuration) {
10
+ const diagnostics = [];
11
+ const names = new Map();
12
+ for (const bundle of configuration.bundles){
13
+ names.set(bundle.manifest.name, (names.get(bundle.manifest.name) ?? 0) + 1);
14
+ }
15
+ for (const [name, count] of names){
16
+ if (count > 1) diagnostics.push(`Package '${name}' is approved more than once; duplicate bundles are ambiguous`);
17
+ }
18
+ const byName = new Map(configuration.bundles.map((bundle)=>[
19
+ bundle.manifest.name,
20
+ bundle
21
+ ]));
22
+ const selection = resolvePackageDependencies(configuration.profile.packages, configuration.bundles.map((bundle)=>bundle.manifest));
23
+ for (const missing of selection.missing)diagnostics.push(`Package '${missing.package}' depends on missing package '${missing.dependsOn}'`);
24
+ for (const conflict of selection.versionConflicts){
25
+ diagnostics.push(`Package '${conflict.package}' requires '${conflict.dependsOn}' ${conflict.requiredRange} but approved version is ${conflict.actualVersion}`);
26
+ }
27
+ for (const cycle of selection.cycles)diagnostics.push(`Package dependency cycle: ${cycle.join(' -> ')}`);
28
+ const bundles = [];
29
+ const runtimeSingletons = new Map();
30
+ const assets = [];
31
+ for (const packageName of selection.packages){
32
+ const bundle = byName.get(packageName);
33
+ if (!bundle) {
34
+ diagnostics.push(`UI profile asks for '${packageName}' but the host did not approve a bundle for it`);
35
+ continue;
36
+ }
37
+ diagnostics.push(...validatePackageBundle(bundle).map((problem)=>`${packageName}: ${problem}`));
38
+ if (!configuration.policy.allowExecutableImports && bundle.designTime) {
39
+ diagnostics.push(`Package '${packageName}' provides executable design-time contributions, but host policy forbids them`);
40
+ }
41
+ const packageAssets = bundle.manifest.assets ?? [];
42
+ if (!configuration.policy.allowNetworkAssets && packageAssets.some((asset)=>/^https?:\/\//.test(asset))) {
43
+ diagnostics.push(`Package '${packageName}' declares network assets, but host policy forbids them`);
44
+ }
45
+ assets.push(...packageAssets);
46
+ for (const dependency of bundle.manifest.runtimeSingletons ?? []){
47
+ const owner = runtimeSingletons.get(dependency);
48
+ if (owner && owner !== packageName) {
49
+ diagnostics.push(`Runtime singleton '${dependency}' is provided by both '${owner}' and '${packageName}'`);
50
+ }
51
+ runtimeSingletons.set(dependency, packageName);
52
+ }
53
+ bundles.push(bundle);
54
+ }
55
+ return {
56
+ bundles,
57
+ components: mergePackageRegistries(bundles),
58
+ layouts: bundles.flatMap((bundle)=>bundle.layouts ?? []),
59
+ screenTemplates: bundles.flatMap((bundle)=>bundle.screenTemplates ?? []),
60
+ dialogTemplates: bundles.flatMap((bundle)=>bundle.dialogTemplates ?? []),
61
+ themes: bundles.flatMap((bundle)=>bundle.themes ?? []),
62
+ icons: createIconAdapterRegistry(bundles.map((bundle)=>bundle.iconLibrary?.adapter).filter((adapter)=>adapter !== undefined)),
63
+ assets,
64
+ diagnostics
65
+ };
66
+ }
67
+
68
+ export { resolvePackageHost };
69
+ //# sourceMappingURL=PackageHostConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageHostConfiguration.js","sources":["../../../packages/PackageHostConfiguration.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 { DialogTemplate, Layout, ScreenTemplate, Theme, UiProfile } from '@cratis/scene.model';\nimport { resolvePackageDependencies } from '@cratis/scene.engine';\nimport { IconAdapterRegistry, createIconAdapterRegistry } from '../icons/IconAdapterRegistry';\nimport { ScenePackageBundle, mergePackageRegistries, validatePackageBundle } from './ScenePackageBundle';\n\nexport interface PackageHostPolicy {\n allowExecutableImports: boolean;\n allowNetworkAssets: boolean;\n}\n\nexport interface PackageHostConfiguration {\n bundles: ScenePackageBundle[];\n profile: UiProfile;\n policy: PackageHostPolicy;\n}\n\nexport interface ResolvedPackageHost {\n bundles: ScenePackageBundle[];\n components: ReturnType<typeof mergePackageRegistries>;\n layouts: Layout[];\n screenTemplates: ScreenTemplate[];\n dialogTemplates: DialogTemplate[];\n themes: Theme[];\n icons: IconAdapterRegistry;\n assets: string[];\n diagnostics: string[];\n}\n\n/**\n * Resolves the approved package set a standalone or embedded React host uses.\n */\nexport function resolvePackageHost(configuration: PackageHostConfiguration): ResolvedPackageHost {\n const diagnostics: string[] = [];\n const names = new Map<string, number>();\n for (const bundle of configuration.bundles) {\n names.set(bundle.manifest.name, (names.get(bundle.manifest.name) ?? 0) + 1);\n }\n\n for (const [name, count] of names) {\n if (count > 1) diagnostics.push(`Package '${name}' is approved more than once; duplicate bundles are ambiguous`);\n }\n\n const byName = new Map(configuration.bundles.map(bundle => [bundle.manifest.name, bundle]));\n const selection = resolvePackageDependencies(configuration.profile.packages, configuration.bundles.map(bundle => bundle.manifest));\n for (const missing of selection.missing) diagnostics.push(`Package '${missing.package}' depends on missing package '${missing.dependsOn}'`);\n for (const conflict of selection.versionConflicts) {\n diagnostics.push(`Package '${conflict.package}' requires '${conflict.dependsOn}' ${conflict.requiredRange} but approved version is ${conflict.actualVersion}`);\n }\n for (const cycle of selection.cycles) diagnostics.push(`Package dependency cycle: ${cycle.join(' -> ')}`);\n\n const bundles: ScenePackageBundle[] = [];\n const runtimeSingletons = new Map<string, string>();\n const assets: string[] = [];\n\n for (const packageName of selection.packages) {\n const bundle = byName.get(packageName);\n if (!bundle) {\n diagnostics.push(`UI profile asks for '${packageName}' but the host did not approve a bundle for it`);\n continue;\n }\n\n diagnostics.push(...validatePackageBundle(bundle).map(problem => `${packageName}: ${problem}`));\n if (!configuration.policy.allowExecutableImports && bundle.designTime) {\n diagnostics.push(`Package '${packageName}' provides executable design-time contributions, but host policy forbids them`);\n }\n\n const packageAssets = bundle.manifest.assets ?? [];\n if (!configuration.policy.allowNetworkAssets && packageAssets.some(asset => /^https?:\\/\\//.test(asset))) {\n diagnostics.push(`Package '${packageName}' declares network assets, but host policy forbids them`);\n }\n assets.push(...packageAssets);\n\n for (const dependency of bundle.manifest.runtimeSingletons ?? []) {\n const owner = runtimeSingletons.get(dependency);\n if (owner && owner !== packageName) {\n diagnostics.push(`Runtime singleton '${dependency}' is provided by both '${owner}' and '${packageName}'`);\n }\n runtimeSingletons.set(dependency, packageName);\n }\n\n bundles.push(bundle);\n }\n\n return {\n bundles,\n components: mergePackageRegistries(bundles),\n layouts: bundles.flatMap(bundle => bundle.layouts ?? []),\n screenTemplates: bundles.flatMap(bundle => bundle.screenTemplates ?? []),\n dialogTemplates: bundles.flatMap(bundle => bundle.dialogTemplates ?? []),\n themes: bundles.flatMap(bundle => bundle.themes ?? []),\n icons: createIconAdapterRegistry(bundles.map(bundle => bundle.iconLibrary?.adapter).filter(adapter => adapter !== undefined)),\n assets,\n diagnostics,\n };\n}\n"],"names":["resolvePackageHost","configuration","diagnostics","names","Map","bundle","bundles","set","manifest","name","get","count","push","byName","map","selection","resolvePackageDependencies","profile","packages","missing","package","dependsOn","conflict","versionConflicts","requiredRange","actualVersion","cycle","cycles","join","runtimeSingletons","assets","packageName","validatePackageBundle","problem","policy","allowExecutableImports","designTime","packageAssets","allowNetworkAssets","some","asset","test","dependency","owner","components","mergePackageRegistries","layouts","flatMap","screenTemplates","dialogTemplates","themes","icons","createIconAdapterRegistry","iconLibrary","adapter","filter","undefined"],"mappings":";;;;AAAA;AACA;AA8BA;;IAGO,SAASA,kBAAAA,CAAmBC,aAAuC,EAAA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MAAAA,CAAO4C,eAAe,IAAI,EAAE,CAAA;QACvEC,MAAAA,EAAQ5C,OAAAA,CAAQyC,OAAO,CAAC1C,CAAAA,SAAUA,MAAAA,CAAO6C,MAAM,IAAI,EAAE,CAAA;AACrDC,QAAAA,KAAAA,EAAOC,yBAAAA,CAA0B9C,OAAAA,CAAQQ,GAAG,CAACT,CAAAA,MAAAA,GAAUA,MAAAA,CAAOgD,WAAW,EAAEC,OAAAA,CAAAA,CAASC,MAAM,CAACD,CAAAA,UAAWA,OAAAA,KAAYE,SAAAA,CAAAA,CAAAA;AAClH1B,QAAAA,MAAAA;AACA5B,QAAAA;AACJ,KAAA;AACJ;;"}
@@ -3,6 +3,7 @@ import { IconAdapterRegistry } from '../icons/IconAdapterRegistry';
3
3
  import { IconLibraryBundle } from '../icons/IconLibraryBundle';
4
4
  import { ComponentRegistry } from '../renderer';
5
5
  import { ComponentsUiLibraryContract } from './ComponentsUiLibraryContract';
6
+ import { DesignTimeBundle } from './DesignTimeBundle';
6
7
  export interface ScenePackageBundle {
7
8
  manifest: ScenePackage;
8
9
  components: ComponentRegistry;
@@ -14,6 +15,7 @@ export interface ScenePackageBundle {
14
15
  themes?: Theme[];
15
16
  iconLibrary?: IconLibraryBundle;
16
17
  componentsUiLibrary?: ComponentsUiLibraryContract;
18
+ designTime?: DesignTimeBundle;
17
19
  }
18
20
  export declare function componentRegistryKey(packageName: string, componentName: string): string;
19
21
  export declare function validatePackageBundle(bundle: ScenePackageBundle): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"ScenePackageBundle.d.ts","sourceRoot":"","sources":["../../../packages/ScenePackageBundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,EAAkC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC/J,OAAO,EAAE,mBAAmB,EAA6B,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,iBAAiB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OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAuC,MAAM,+BAA+B,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAA4B,MAAM,oBAAoB,CAAC;AAchF,MAAM,WAAW,kBAAkB;IAK/B,QAAQ,EAAE,YAAY,CAAC;IAKvB,UAAU,EAAE,iBAAiB,CAAC;IAK9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAMnB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAKnC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IAMnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAQnB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAKpC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAMjB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAMhC,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;IAGlD,UAAU,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAYD,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAEvF;AAWD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAyD1E;AAmFD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,iBAAiB,CAEvF;AAOD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,mBAAmB,CAEpF"}
@@ -1,6 +1,7 @@
1
1
  import { PackageKind, PropertyValueType } from '@cratis/scene.model';
2
2
  import { createIconAdapterRegistry } from '../icons/IconAdapterRegistry.js';
3
3
  import { validateComponentsUiLibraryContract } from './ComponentsUiLibraryContract.js';
4
+ import { validateDesignTimeBundle } from './DesignTimeBundle.js';
4
5
 
5
6
  // Copyright (c) Cratis. All rights reserved.
6
7
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
@@ -70,6 +71,7 @@ import { validateComponentsUiLibraryContract } from './ComponentsUiLibraryContra
70
71
  }
71
72
  problems.push(...validateIconLibrary(bundle));
72
73
  problems.push(...validateDescriptors(bundle));
74
+ problems.push(...validateDesignTimeBundle(bundle.designTime));
73
75
  return problems;
74
76
  }
75
77
  function validateIconLibrary(bundle) {
@@ -1 +1 @@
1
- {"version":3,"file":"ScenePackageBundle.js","sources":["../../../packages/ScenePackageBundle.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, DialogTemplate, Layout, PackageKind, PropertyValueType, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';\nimport { IconAdapterRegistry, createIconAdapterRegistry } from '../icons/IconAdapterRegistry';\nimport { IconLibraryBundle } from '../icons/IconLibraryBundle';\nimport { ComponentRegistry } from '../renderer';\nimport { ComponentsUiLibraryContract, validateComponentsUiLibraryContract } from './ComponentsUiLibraryContract';\n\n/**\n * What a package actually ships to a React renderer, as opposed to what it *declares*.\n *\n * `ScenePackage` is the declaration — a name, a kind, dependencies, and the names of what it\n * contributes. It is deliberately platform-agnostic and lives in `Scene.Model`, because Stage's build and\n * Studio's design-time queries both read it without ever loading a component. A bundle is the other half:\n * the real React components, layouts, screens and themes behind those names, which only a renderer needs.\n *\n * A package publishes exactly one bundle, as a named export following its own name —\n * `primeReactPackage`, `cratisComponentsPackage`, `corePackage`. A host loads it from the module the\n * declaration's `ScenePackage.module` names.\n */\nexport interface ScenePackageBundle {\n /**\n * The package's own declaration. Its `components`, `layouts` and `themes` name lists must agree with\n * what this bundle actually provides — {@link validatePackageBundle} is what proves they do.\n */\n manifest: ScenePackage;\n\n /**\n * The components this package provides, keyed by {@link componentRegistryKey}.\n */\n components: ComponentRegistry;\n\n /**\n * The application shells this package provides, if any. Only a blueprint has these.\n */\n layouts?: Layout[];\n\n /**\n * The screen templates this package provides — the shapes that go inside a layout, each declaring\n * which of its parent's slots it fills.\n */\n screenTemplates?: ScreenTemplate[];\n\n /**\n * The dialog templates this package provides.\n */\n dialogTemplates?: DialogTemplate[];\n\n /**\n * Sample screens this package ships — a layout package's gallery, so a preview has real content to\n * put through the real engine rather than a mockup.\n */\n screens?: Screen[];\n\n /**\n * What can be edited on this package's components - one {@link ComponentDescriptor} per component that is\n * editable at design time. They are data, so Studio reads them without rendering anything, and they travel with\n * the components they describe rather than in a registry of their own. {@link validatePackageBundle} checks\n * that every descriptor names a component the manifest declares.\n */\n descriptors?: ComponentDescriptor[];\n\n /**\n * The themes this package ships, if any.\n */\n themes?: Theme[];\n\n /**\n * The icon catalog and renderer adapter of an icon-library package. Present exactly when the\n * manifest declares an icon library.\n */\n iconLibrary?: IconLibraryBundle;\n\n /**\n * Optional web-renderer mapping to a Components UiLibrary. Scene's catalog remains independently\n * authored; hosts check the loaded export with validateComponentsUiLibraryMapping before rendering.\n */\n componentsUiLibrary?: ComponentsUiLibraryContract;\n}\n\n/**\n * The key a component is registered and looked up under: the package that provides it, then the bare name\n * a screen refers to it by.\n *\n * A screen writes a bare name (`button`) or a package-qualified one (`PrimeReact.button`);\n * `resolveComponentName` turns either into a `{ name, package }` pair, and this turns that pair into the\n * registry key. Nothing should build this string by hand — the separator is an implementation detail of\n * the registry, deliberately not the `.` used for qualification in a screen, so a package name containing\n * dots stays unambiguous.\n */\nexport function componentRegistryKey(packageName: string, componentName: string): string {\n return `${packageName}:${componentName}`;\n}\n\n/**\n * Checks that a bundle provides everything its manifest declares, and declares everything it provides, and that\n * every descriptor it ships is for a component it declares and is well formed.\n *\n * A manifest that promises a component the bundle does not register renders as `UnresolvedComponent` at\n * runtime — a blank box, far from where the mistake was made. A component registered but not declared is\n * invisible to `resolveComponentName`, so a screen can never name it. Both are silent failures, which is\n * why every package's specs run this.\n */\nexport function validatePackageBundle(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest } = bundle;\n\n for (const name of manifest.components) {\n if (!(componentRegistryKey(manifest.name, name) in bundle.components)) {\n problems.push(`declares the component '${name}' but registers no implementation for it`);\n }\n }\n\n const declared = new Set(manifest.components.map((name) => componentRegistryKey(manifest.name, name)));\n for (const key of Object.keys(bundle.components)) {\n if (!declared.has(key)) {\n problems.push(`registers '${key}', which the manifest does not declare`);\n }\n }\n\n const providedLayouts = new Set((bundle.layouts ?? []).map((layout) => layout.name));\n for (const name of manifest.layouts) {\n if (!providedLayouts.has(name)) {\n problems.push(`declares the layout '${name}' but provides no definition for it`);\n }\n }\n\n const providedScreenTemplates = new Set((bundle.screenTemplates ?? []).map((template) => template.name));\n for (const name of manifest.screenTemplates) {\n if (!providedScreenTemplates.has(name)) {\n problems.push(`declares the screen template '${name}' but provides no definition for it`);\n }\n }\n\n const providedDialogTemplates = new Set((bundle.dialogTemplates ?? []).map((template) => template.name));\n for (const name of manifest.dialogTemplates) {\n if (!providedDialogTemplates.has(name)) {\n problems.push(`declares the dialog template '${name}' but provides no definition for it`);\n }\n }\n\n const providedThemes = new Set((bundle.themes ?? []).map((theme) => theme.name));\n for (const name of manifest.themes) {\n if (!providedThemes.has(name)) {\n problems.push(`declares the theme '${name}' but provides no definition for it`);\n }\n }\n\n if (bundle.componentsUiLibrary) {\n if (manifest.kind !== PackageKind.ComponentLibrary) {\n problems.push('declares a Components UI library mapping but is not of kind ComponentLibrary');\n }\n problems.push(...validateComponentsUiLibraryContract(bundle.componentsUiLibrary));\n }\n\n problems.push(...validateIconLibrary(bundle));\n problems.push(...validateDescriptors(bundle));\n\n return problems;\n}\n\nfunction validateIconLibrary(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest, iconLibrary } = bundle;\n const declaresIconLibrary = manifest.kind === PackageKind.IconLibrary || manifest.iconLibrary !== undefined;\n\n if (manifest.kind === PackageKind.IconLibrary && !manifest.iconLibrary) {\n problems.push('is an icon library but declares no iconLibrary metadata');\n }\n\n if (manifest.kind !== PackageKind.IconLibrary && manifest.iconLibrary) {\n problems.push('declares iconLibrary metadata but is not of kind IconLibrary');\n }\n\n if (declaresIconLibrary && !iconLibrary) {\n problems.push('declares an icon library but the bundle provides no catalog or adapter for it');\n }\n\n if (!declaresIconLibrary && iconLibrary) {\n problems.push('provides an icon catalog and adapter, which the manifest does not declare');\n }\n\n if (iconLibrary) {\n if (iconLibrary.catalog.library !== manifest.name) {\n problems.push(`provides an icon catalog for '${iconLibrary.catalog.library}' instead of '${manifest.name}'`);\n }\n\n if (iconLibrary.adapter.library !== manifest.name) {\n problems.push(`provides an icon adapter for '${iconLibrary.adapter.library}' instead of '${manifest.name}'`);\n }\n\n if (manifest.iconLibrary && !manifest.iconLibrary.renderers.includes('react')) {\n problems.push(\"provides a React icon adapter but does not list 'react' among its icon renderers\");\n }\n }\n\n return problems;\n}\n\nfunction validateDescriptors(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const declared = new Set(bundle.manifest.components.map((name) => componentRegistryKey(bundle.manifest.name, name)));\n const described = new Set<string>();\n\n for (const descriptor of bundle.descriptors ?? []) {\n if (!declared.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}', which the manifest does not declare as a component`);\n }\n\n if (described.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}' more than once`);\n }\n\n described.add(descriptor.component);\n\n const paths = new Set<string>();\n for (const property of descriptor.properties) {\n if (paths.has(property.path)) {\n problems.push(`'${descriptor.component}' describes the property '${property.path}' more than once`);\n }\n\n paths.add(property.path);\n\n if (property.valueType === PropertyValueType.Collection && property.item === undefined) {\n problems.push(`'${descriptor.component}' describes the collection '${property.path}' without describing its items`);\n }\n\n if (property.valueType === PropertyValueType.Enum && (property.choices ?? []).length === 0) {\n problems.push(`'${descriptor.component}' describes the enum '${property.path}' without choices`);\n }\n }\n }\n\n return problems;\n}\n\n/**\n * Merges the component registries of several bundles into the single registry a renderer consumes.\n *\n * Keys carry their package name, so nothing collides and merge order does not matter — which package wins\n * a *bare* name is decided earlier, by `resolveComponentName` walking the profile's priority order.\n */\nexport function mergePackageRegistries(bundles: ScenePackageBundle[]): ComponentRegistry {\n return Object.assign({}, ...bundles.map((bundle) => bundle.components)) as ComponentRegistry;\n}\n\n/**\n * Collects the icon adapters of several bundles into the registry `SceneIcon` renders through.\n *\n * @throws Error when two bundles provide an adapter for the same library.\n */\nexport function mergeIconAdapters(bundles: ScenePackageBundle[]): IconAdapterRegistry {\n return createIconAdapterRegistry(bundles.flatMap((bundle) => (bundle.iconLibrary ? [bundle.iconLibrary.adapter] : [])));\n}\n"],"names":["componentRegistryKey","packageName","componentName","validatePackageBundle","bundle","problems","manifest","name","components","push","declared","Set","map","key","Object","keys","has","providedLayouts","layouts","layout","providedScreenTemplates","screenTemplates","template","providedDialogTemplates","dialogTemplates","providedThemes","themes","theme","componentsUiLibrary","kind","PackageKind","ComponentLibrary","validateComponentsUiLibraryContract","validateIconLibrary","validateDescriptors","iconLibrary","declaresIconLibrary","IconLibrary","undefined","catalog","library","adapter","renderers","includes","described","descriptor","descriptors","component","add","paths","property","properties","path","valueType","PropertyValueType","Collection","item","Enum","choices","length","mergePackageRegistries","bundles","assign","mergeIconAdapters","createIconAdapterRegistry","flatMap"],"mappings":";;;;AAAA;AACA;AAgFA;;;;;;;;;AASC,IACM,SAASA,oBAAAA,CAAqBC,WAAmB,EAAEC,aAAqB,EAAA;AAC3E,IAAA,OAAO,CAAA,EAAGD,WAAAA,CAAY,CAAC,EAAEC,aAAAA,CAAAA,CAAe;AAC5C;AAEA;;;;;;;;IASO,SAASC,qBAAAA,CAAsBC,MAA0B,EAAA;AAC5D,IAAA,MAAMC,WAAqB,EAAE;IAC7B,MAAM,EAAEC,QAAQ,EAAE,GAAGF,MAAAA;AAErB,IAAA,KAAK,MAAMG,IAAAA,IAAQD,QAAAA,CAASE,UAAU,CAAE;QACpC,IAAI,EAAER,oBAAAA,CAAqBM,QAAAA,CAASC,IAAI,EAAEA,IAAAA,CAAAA,IAASH,MAAAA,CAAOI,UAAS,CAAA,EAAI;AACnEH,YAAAA,QAAAA,CA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,OAA6B,EAAA;IAChE,OAAO/C,MAAAA,CAAOgD,MAAM,CAAC,EAAC,EAAA,GAAMD,OAAAA,CAAQjD,GAAG,CAAC,CAACR,MAAAA,GAAWA,MAAAA,CAAOI,UAAU,CAAA,CAAA;AACzE;AAEA;;;;IAKO,SAASuD,iBAAAA,CAAkBF,OAA6B,EAAA;IAC3D,OAAOG,yBAAAA,CAA0BH,QAAQI,OAAO,CAAC,CAAC7D,MAAAA,GAAYA,MAAAA,CAAO+B,WAAW,GAAG;YAAC/B,MAAAA,CAAO+B,WAAW,CAACM;AAAQ,SAAA,GAAG,EAAE,CAAA,CAAA;AACxH;;"}
1
+ {"version":3,"file":"ScenePackageBundle.js","sources":["../../../packages/ScenePackageBundle.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, DialogTemplate, Layout, PackageKind, PropertyValueType, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';\nimport { IconAdapterRegistry, createIconAdapterRegistry } from '../icons/IconAdapterRegistry';\nimport { IconLibraryBundle } from '../icons/IconLibraryBundle';\nimport { ComponentRegistry } from '../renderer';\nimport { ComponentsUiLibraryContract, validateComponentsUiLibraryContract } from './ComponentsUiLibraryContract';\nimport { DesignTimeBundle, validateDesignTimeBundle } from './DesignTimeBundle';\n\n/**\n * What a package actually ships to a React renderer, as opposed to what it *declares*.\n *\n * `ScenePackage` is the declaration — a name, a kind, dependencies, and the names of what it\n * contributes. It is deliberately platform-agnostic and lives in `Scene.Model`, because Stage's build and\n * Studio's design-time queries both read it without ever loading a component. A bundle is the other half:\n * the real React components, layouts, screens and themes behind those names, which only a renderer needs.\n *\n * A package publishes exactly one bundle, as a named export following its own name —\n * `primeReactPackage`, `cratisComponentsPackage`, `corePackage`. A host loads it from the module the\n * declaration's `ScenePackage.module` names.\n */\nexport interface ScenePackageBundle {\n /**\n * The package's own declaration. Its `components`, `layouts` and `themes` name lists must agree with\n * what this bundle actually provides — {@link validatePackageBundle} is what proves they do.\n */\n manifest: ScenePackage;\n\n /**\n * The components this package provides, keyed by {@link componentRegistryKey}.\n */\n components: ComponentRegistry;\n\n /**\n * The application shells this package provides, if any. Only a blueprint has these.\n */\n layouts?: Layout[];\n\n /**\n * The screen templates this package provides — the shapes that go inside a layout, each declaring\n * which of its parent's slots it fills.\n */\n screenTemplates?: ScreenTemplate[];\n\n /**\n * The dialog templates this package provides.\n */\n dialogTemplates?: DialogTemplate[];\n\n /**\n * Sample screens this package ships — a layout package's gallery, so a preview has real content to\n * put through the real engine rather than a mockup.\n */\n screens?: Screen[];\n\n /**\n * What can be edited on this package's components - one {@link ComponentDescriptor} per component that is\n * editable at design time. They are data, so Studio reads them without rendering anything, and they travel with\n * the components they describe rather than in a registry of their own. {@link validatePackageBundle} checks\n * that every descriptor names a component the manifest declares.\n */\n descriptors?: ComponentDescriptor[];\n\n /**\n * The themes this package ships, if any.\n */\n themes?: Theme[];\n\n /**\n * The icon catalog and renderer adapter of an icon-library package. Present exactly when the\n * manifest declares an icon library.\n */\n iconLibrary?: IconLibraryBundle;\n\n /**\n * Optional web-renderer mapping to a Components UiLibrary. Scene's catalog remains independently\n * authored; hosts check the loaded export with validateComponentsUiLibraryMapping before rendering.\n */\n componentsUiLibrary?: ComponentsUiLibraryContract;\n\n /** Optional React-only design-time tooling. Runtime hosts can omit it entirely. */\n designTime?: DesignTimeBundle;\n}\n\n/**\n * The key a component is registered and looked up under: the package that provides it, then the bare name\n * a screen refers to it by.\n *\n * A screen writes a bare name (`button`) or a package-qualified one (`PrimeReact.button`);\n * `resolveComponentName` turns either into a `{ name, package }` pair, and this turns that pair into the\n * registry key. Nothing should build this string by hand — the separator is an implementation detail of\n * the registry, deliberately not the `.` used for qualification in a screen, so a package name containing\n * dots stays unambiguous.\n */\nexport function componentRegistryKey(packageName: string, componentName: string): string {\n return `${packageName}:${componentName}`;\n}\n\n/**\n * Checks that a bundle provides everything its manifest declares, and declares everything it provides, and that\n * every descriptor it ships is for a component it declares and is well formed.\n *\n * A manifest that promises a component the bundle does not register renders as `UnresolvedComponent` at\n * runtime — a blank box, far from where the mistake was made. A component registered but not declared is\n * invisible to `resolveComponentName`, so a screen can never name it. Both are silent failures, which is\n * why every package's specs run this.\n */\nexport function validatePackageBundle(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest } = bundle;\n\n for (const name of manifest.components) {\n if (!(componentRegistryKey(manifest.name, name) in bundle.components)) {\n problems.push(`declares the component '${name}' but registers no implementation for it`);\n }\n }\n\n const declared = new Set(manifest.components.map((name) => componentRegistryKey(manifest.name, name)));\n for (const key of Object.keys(bundle.components)) {\n if (!declared.has(key)) {\n problems.push(`registers '${key}', which the manifest does not declare`);\n }\n }\n\n const providedLayouts = new Set((bundle.layouts ?? []).map((layout) => layout.name));\n for (const name of manifest.layouts) {\n if (!providedLayouts.has(name)) {\n problems.push(`declares the layout '${name}' but provides no definition for it`);\n }\n }\n\n const providedScreenTemplates = new Set((bundle.screenTemplates ?? []).map((template) => template.name));\n for (const name of manifest.screenTemplates) {\n if (!providedScreenTemplates.has(name)) {\n problems.push(`declares the screen template '${name}' but provides no definition for it`);\n }\n }\n\n const providedDialogTemplates = new Set((bundle.dialogTemplates ?? []).map((template) => template.name));\n for (const name of manifest.dialogTemplates) {\n if (!providedDialogTemplates.has(name)) {\n problems.push(`declares the dialog template '${name}' but provides no definition for it`);\n }\n }\n\n const providedThemes = new Set((bundle.themes ?? []).map((theme) => theme.name));\n for (const name of manifest.themes) {\n if (!providedThemes.has(name)) {\n problems.push(`declares the theme '${name}' but provides no definition for it`);\n }\n }\n\n if (bundle.componentsUiLibrary) {\n if (manifest.kind !== PackageKind.ComponentLibrary) {\n problems.push('declares a Components UI library mapping but is not of kind ComponentLibrary');\n }\n problems.push(...validateComponentsUiLibraryContract(bundle.componentsUiLibrary));\n }\n\n problems.push(...validateIconLibrary(bundle));\n problems.push(...validateDescriptors(bundle));\n problems.push(...validateDesignTimeBundle(bundle.designTime));\n\n return problems;\n}\n\nfunction validateIconLibrary(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest, iconLibrary } = bundle;\n const declaresIconLibrary = manifest.kind === PackageKind.IconLibrary || manifest.iconLibrary !== undefined;\n\n if (manifest.kind === PackageKind.IconLibrary && !manifest.iconLibrary) {\n problems.push('is an icon library but declares no iconLibrary metadata');\n }\n\n if (manifest.kind !== PackageKind.IconLibrary && manifest.iconLibrary) {\n problems.push('declares iconLibrary metadata but is not of kind IconLibrary');\n }\n\n if (declaresIconLibrary && !iconLibrary) {\n problems.push('declares an icon library but the bundle provides no catalog or adapter for it');\n }\n\n if (!declaresIconLibrary && iconLibrary) {\n problems.push('provides an icon catalog and adapter, which the manifest does not declare');\n }\n\n if (iconLibrary) {\n if (iconLibrary.catalog.library !== manifest.name) {\n problems.push(`provides an icon catalog for '${iconLibrary.catalog.library}' instead of '${manifest.name}'`);\n }\n\n if (iconLibrary.adapter.library !== manifest.name) {\n problems.push(`provides an icon adapter for '${iconLibrary.adapter.library}' instead of '${manifest.name}'`);\n }\n\n if (manifest.iconLibrary && !manifest.iconLibrary.renderers.includes('react')) {\n problems.push(\"provides a React icon adapter but does not list 'react' among its icon renderers\");\n }\n }\n\n return problems;\n}\n\nfunction validateDescriptors(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const declared = new Set(bundle.manifest.components.map((name) => componentRegistryKey(bundle.manifest.name, name)));\n const described = new Set<string>();\n\n for (const descriptor of bundle.descriptors ?? []) {\n if (!declared.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}', which the manifest does not declare as a component`);\n }\n\n if (described.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}' more than once`);\n }\n\n described.add(descriptor.component);\n\n const paths = new Set<string>();\n for (const property of descriptor.properties) {\n if (paths.has(property.path)) {\n problems.push(`'${descriptor.component}' describes the property '${property.path}' more than once`);\n }\n\n paths.add(property.path);\n\n if (property.valueType === PropertyValueType.Collection && property.item === undefined) {\n problems.push(`'${descriptor.component}' describes the collection '${property.path}' without describing its items`);\n }\n\n if (property.valueType === PropertyValueType.Enum && (property.choices ?? []).length === 0) {\n problems.push(`'${descriptor.component}' describes the enum '${property.path}' without choices`);\n }\n }\n }\n\n return problems;\n}\n\n/**\n * Merges the component registries of several bundles into the single registry a renderer consumes.\n *\n * Keys carry their package name, so nothing collides and merge order does not matter — which package wins\n * a *bare* name is decided earlier, by `resolveComponentName` walking the profile's priority order.\n */\nexport function mergePackageRegistries(bundles: ScenePackageBundle[]): ComponentRegistry {\n return Object.assign({}, ...bundles.map((bundle) => bundle.components)) as ComponentRegistry;\n}\n\n/**\n * Collects the icon adapters of several bundles into the registry `SceneIcon` renders through.\n *\n * @throws Error when two bundles provide an adapter for the same library.\n */\nexport function mergeIconAdapters(bundles: ScenePackageBundle[]): IconAdapterRegistry {\n return createIconAdapterRegistry(bundles.flatMap((bundle) => (bundle.iconLibrary ? [bundle.iconLibrary.adapter] : [])));\n}\n"],"names":["componentRegistryKey","packageName","componentName","validatePackageBundle","bundle","problems","manifest","name","components","push","declared","Set","map","key","Object","keys","has","providedLayouts","layouts","layout","providedScreenTemplates","screenTemplates","template","providedDialogTemplates","dialogTemplates","providedThemes","themes","theme","componentsUiLibrary","kind","PackageKind","ComponentLibrary","validateComponentsUiLibraryContract","validateIconLibrary","validateDescriptors","validateDesignTimeBundle","designTime","iconLibrary","declaresIconLibrary","IconLibrary","undefined","catalog","library","adapter","renderers","includes","described","descriptor","descriptors","component","add","paths","property","properties","path","valueType","PropertyValueType","Collection","item","Enum","choices","length","mergePackageRegistries","bundles","assign","mergeIconAdapters","createIconAdapterRegistry","flatMap"],"mappings":";;;;;AAAA;AACA;AAoFA;;;;;;;;;AASC,IACM,SAASA,oBAAAA,CAAqBC,WAAmB,EAAEC,aAAqB,EAAA;AAC3E,IAAA,OAAO,CAAA,EAAGD,WAAAA,CAAY,CAAC,EAAEC,aAAAA,CAAAA,CAAe;AAC5C;A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,CAASE,IAAI,CAAC,8BAA8B,CAAC,CAAA;AACtH,YAAA;AAEA,YAAA,IAAIF,SAASG,SAAS,KAAKC,iBAAAA,CAAkBG,IAAI,IAAI,CAACP,QAAAA,CAASQ,OAAO,IAAI,EAAC,EAAGC,MAAM,KAAK,CAAA,EAAG;AACxFxD,gBAAAA,QAAAA,CAASI,IAAI,CAAC,CAAC,CAAC,EAAEsC,UAAAA,CAAWE,SAAS,CAAC,sBAAsB,EAAEG,QAAAA,CAASE,IAAI,CAAC,iBAAiB,CAAC,CAAA;AACnG,YAAA;AACJ,QAAA;AACJ,IAAA;IAEA,OAAOjD,QAAAA;AACX;AAEA;;;;;IAMO,SAASyD,sBAAAA,CAAuBC,OAA6B,EAAA;IAChE,OAAOjD,MAAAA,CAAOkD,MAAM,CAAC,EAAC,EAAA,GAAMD,OAAAA,CAAQnD,GAAG,CAAC,CAACR,MAAAA,GAAWA,MAAAA,CAAOI,UAAU,CAAA,CAAA;AACzE;AAEA;;;;IAKO,SAASyD,iBAAAA,CAAkBF,OAA6B,EAAA;IAC3D,OAAOG,yBAAAA,CAA0BH,QAAQI,OAAO,CAAC,CAAC/D,MAAAA,GAAYA,MAAAA,CAAOiC,WAAW,GAAG;YAACjC,MAAAA,CAAOiC,WAAW,CAACM;AAAQ,SAAA,GAAG,EAAE,CAAA,CAAA;AACxH;;"}
@@ -1,3 +1,12 @@
1
+ export * from './DesignTimeAction';
2
+ export * from './DesignTimeBundle';
3
+ export * from './DesignTimeComponentProps';
4
+ export * from './DesignTimeContext';
5
+ export * from './DesignTimePropertyDisplayProps';
6
+ export * from './DesignTimePropertyEditorProps';
7
+ export * from './DesignTimeProvider';
8
+ export * from '../navigation';
9
+ export * from './PackageHostConfiguration';
1
10
  export * from './ScenePackageBundle';
2
11
  export * from './ComponentsUiLibraryContract';
3
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC"}
@@ -1,3 +1,12 @@
1
+ export * from './DesignTimeAction';
2
+ export * from './DesignTimeBundle';
3
+ export * from './DesignTimeComponentProps';
4
+ export * from './DesignTimeContext';
5
+ export * from './DesignTimePropertyDisplayProps';
6
+ export * from './DesignTimePropertyEditorProps';
7
+ export * from './DesignTimeProvider';
8
+ export * from '../navigation';
9
+ export * from './PackageHostConfiguration';
1
10
  export * from './ScenePackageBundle';
2
11
  export * from './ComponentsUiLibraryContract';
3
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/index.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type QueryPerformer = (query: string, argumentsValue: unknown, signal: AbortSignal) => Promise<unknown>;
2
+ export declare class AbortableQueryRunner {
3
+ #private;
4
+ run(query: string, argumentsValue: unknown, performer: QueryPerformer): Promise<unknown | undefined>;
5
+ clear(): void;
6
+ }
7
+ //# sourceMappingURL=AbortableQueryRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbortableQueryRunner.d.ts","sourceRoot":"","sources":["../../../renderer/AbortableQueryRunner.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAK/G,qBAAa,oBAAoB;;IAIvB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAOzG;IAED,KAAK,IAAI,IAAI,CAIZ;CACJ"}
@@ -0,0 +1,24 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ /**
4
+ * Runs query bindings so a newer argument set aborts and ignores older work.
5
+ */ class AbortableQueryRunner {
6
+ #controller;
7
+ #generation = 0;
8
+ async run(query, argumentsValue, performer) {
9
+ this.#controller?.abort();
10
+ const controller = new AbortController();
11
+ const generation = ++this.#generation;
12
+ this.#controller = controller;
13
+ const result = await performer(query, argumentsValue, controller.signal);
14
+ return generation === this.#generation && !controller.signal.aborted ? result : undefined;
15
+ }
16
+ clear() {
17
+ this.#controller?.abort();
18
+ this.#generation++;
19
+ this.#controller = undefined;
20
+ }
21
+ }
22
+
23
+ export { AbortableQueryRunner };
24
+ //# sourceMappingURL=AbortableQueryRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbortableQueryRunner.js","sources":["../../../renderer/AbortableQueryRunner.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\nexport type QueryPerformer = (query: string, argumentsValue: unknown, signal: AbortSignal) => Promise<unknown>;\n\n/**\n * Runs query bindings so a newer argument set aborts and ignores older work.\n */\nexport class AbortableQueryRunner {\n #controller?: AbortController;\n #generation = 0;\n\n async run(query: string, argumentsValue: unknown, performer: QueryPerformer): Promise<unknown | undefined> {\n this.#controller?.abort();\n const controller = new AbortController();\n const generation = ++this.#generation;\n this.#controller = controller;\n const result = await performer(query, argumentsValue, controller.signal);\n return generation === this.#generation && !controller.signal.aborted ? result : undefined;\n }\n\n clear(): void {\n this.#controller?.abort();\n this.#generation++;\n this.#controller = undefined;\n }\n}\n"],"names":["AbortableQueryRunner","run","query","argumentsValue","performer","abort","controller","AbortController","generation","result","signal","aborted","undefined","clear"],"mappings":"AAAA;AACA;AAIA;;AAEC,IACM,MAAMA,oBAAAA,CAAAA;AACT,IAAA,WAAW;IACX,WAAW,GAAG,CAAA;AAEd,IAAA,MAAMC,IAAIC,KAAa,EAAEC,cAAuB,EAAEC,SAAyB,EAAgC;QACvG,IAAI,CAAC,WAAW,EAAEC,KAAAA,EAAAA;AAClB,QAAA,MAAMC,aAAa,IAAIC,eAAAA,EAAAA;AACvB,QAAA,MAAMC,UAAAA,GAAa,EAAE,IAAI,CAAC,WAAW;QACrC,IAAI,CAAC,WAAW,GAAGF,UAAAA;AACnB,QAAA,MAAMG,SAAS,MAAML,SAAAA,CAAUF,KAAAA,EAAOC,cAAAA,EAAgBG,WAAWI,MAAM,CAAA;AACvE,QAAA,OAAOF,UAAAA,KAAe,IAAI,CAAC,WAAW,IAAI,CAACF,UAAAA,CAAWI,MAAM,CAACC,OAAO,GAAGF,MAAAA,GAASG,SAAAA;AACpF,IAAA;IAEAC,KAAAA,GAAc;QACV,IAAI,CAAC,WAAW,EAAER,KAAAA,EAAAA;QAClB,IAAI,CAAC,WAAW,EAAA;QAChB,IAAI,CAAC,WAAW,GAAGO,SAAAA;AACvB,IAAA;AACJ;;"}
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ComponentBindingOutputs {
3
+ setOutput(property: string, value: unknown): void;
4
+ clearOutput(property: string): void;
5
+ clearAll(): void;
6
+ }
7
+ export interface BindingOutputProviderValue {
8
+ outputs: Record<string, Record<string, unknown>>;
9
+ outputFor(elementId: string): ComponentBindingOutputs;
10
+ }
11
+ export interface BindingOutputProviderProps {
12
+ children: ReactNode;
13
+ onOutputsChanged?: (outputs: Record<string, Record<string, unknown>>) => void;
14
+ }
15
+ export declare function BindingOutputProvider({ children, onOutputsChanged }: BindingOutputProviderProps): import("react").JSX.Element;
16
+ export declare function useBindingOutputs(elementId: string): ComponentBindingOutputs;
17
+ export declare function useBindingOutputScope(): Record<string, Record<string, unknown>>;
18
+ //# sourceMappingURL=BindingOutputContext.d.ts.map