@cratis/scene.engine 0.1.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 (221) hide show
  1. package/BindingResolver.ts +11 -0
  2. package/ComponentResolution.ts +22 -0
  3. package/PackageSelection.ts +87 -0
  4. package/README.md +40 -0
  5. package/Renderer.ts +33 -0
  6. package/aggregateContributions.ts +40 -0
  7. package/buildStarterProfile.ts +21 -0
  8. package/computeSizeClass.ts +30 -0
  9. package/dist/cjs/PackageSelection.js +15 -0
  10. package/dist/cjs/PackageSelection.js.map +1 -0
  11. package/dist/cjs/aggregateContributions.js +37 -0
  12. package/dist/cjs/aggregateContributions.js.map +1 -0
  13. package/dist/cjs/buildStarterProfile.js +27 -0
  14. package/dist/cjs/buildStarterProfile.js.map +1 -0
  15. package/dist/cjs/computeSizeClass.js +31 -0
  16. package/dist/cjs/computeSizeClass.js.map +1 -0
  17. package/dist/cjs/elementKind.js +26 -0
  18. package/dist/cjs/elementKind.js.map +1 -0
  19. package/dist/cjs/evaluateFlowArrangement.js +31 -0
  20. package/dist/cjs/evaluateFlowArrangement.js.map +1 -0
  21. package/dist/cjs/evaluateFreeformArrangement.js +16 -0
  22. package/dist/cjs/evaluateFreeformArrangement.js.map +1 -0
  23. package/dist/cjs/evaluateFreeformSlotArrangement.js +18 -0
  24. package/dist/cjs/evaluateFreeformSlotArrangement.js.map +1 -0
  25. package/dist/cjs/flowNodeKind.js +40 -0
  26. package/dist/cjs/flowNodeKind.js.map +1 -0
  27. package/dist/cjs/incompatibleStarterThemes.js +29 -0
  28. package/dist/cjs/incompatibleStarterThemes.js.map +1 -0
  29. package/dist/cjs/index.js +59 -0
  30. package/dist/cjs/index.js.map +1 -0
  31. package/dist/cjs/package.json +3 -0
  32. package/dist/cjs/packageCatalog.js +63 -0
  33. package/dist/cjs/packageCatalog.js.map +1 -0
  34. package/dist/cjs/packageVersionRange.js +113 -0
  35. package/dist/cjs/packageVersionRange.js.map +1 -0
  36. package/dist/cjs/renderElement.js +39 -0
  37. package/dist/cjs/renderElement.js.map +1 -0
  38. package/dist/cjs/resolveComponentName.js +67 -0
  39. package/dist/cjs/resolveComponentName.js.map +1 -0
  40. package/dist/cjs/resolvePackageDependencies.js +149 -0
  41. package/dist/cjs/resolvePackageDependencies.js.map +1 -0
  42. package/dist/cjs/resolveScreenTemplates.js +136 -0
  43. package/dist/cjs/resolveScreenTemplates.js.map +1 -0
  44. package/dist/cjs/themeCompatibility.js +45 -0
  45. package/dist/cjs/themeCompatibility.js.map +1 -0
  46. package/dist/esm/BindingResolver.d.ts +3 -0
  47. package/dist/esm/BindingResolver.d.ts.map +1 -0
  48. package/dist/esm/BindingResolver.js +2 -0
  49. package/dist/esm/BindingResolver.js.map +1 -0
  50. package/dist/esm/ComponentResolution.d.ts +6 -0
  51. package/dist/esm/ComponentResolution.d.ts.map +1 -0
  52. package/dist/esm/ComponentResolution.js +2 -0
  53. package/dist/esm/ComponentResolution.js.map +1 -0
  54. package/dist/esm/PackageSelection.d.ts +19 -0
  55. package/dist/esm/PackageSelection.d.ts.map +1 -0
  56. package/dist/esm/PackageSelection.js +13 -0
  57. package/dist/esm/PackageSelection.js.map +1 -0
  58. package/dist/esm/Renderer.d.ts +8 -0
  59. package/dist/esm/Renderer.d.ts.map +1 -0
  60. package/dist/esm/Renderer.js +2 -0
  61. package/dist/esm/Renderer.js.map +1 -0
  62. package/dist/esm/aggregateContributions.d.ts +3 -0
  63. package/dist/esm/aggregateContributions.d.ts.map +1 -0
  64. package/dist/esm/aggregateContributions.js +35 -0
  65. package/dist/esm/aggregateContributions.js.map +1 -0
  66. package/dist/esm/buildStarterProfile.d.ts +3 -0
  67. package/dist/esm/buildStarterProfile.d.ts.map +1 -0
  68. package/dist/esm/buildStarterProfile.js +25 -0
  69. package/dist/esm/buildStarterProfile.js.map +1 -0
  70. package/dist/esm/computeSizeClass.d.ts +5 -0
  71. package/dist/esm/computeSizeClass.d.ts.map +1 -0
  72. package/dist/esm/computeSizeClass.js +27 -0
  73. package/dist/esm/computeSizeClass.js.map +1 -0
  74. package/dist/esm/elementKind.d.ts +6 -0
  75. package/dist/esm/elementKind.d.ts.map +1 -0
  76. package/dist/esm/elementKind.js +21 -0
  77. package/dist/esm/elementKind.js.map +1 -0
  78. package/dist/esm/evaluateFlowArrangement.d.ts +3 -0
  79. package/dist/esm/evaluateFlowArrangement.d.ts.map +1 -0
  80. package/dist/esm/evaluateFlowArrangement.js +29 -0
  81. package/dist/esm/evaluateFlowArrangement.js.map +1 -0
  82. package/dist/esm/evaluateFreeformArrangement.d.ts +3 -0
  83. package/dist/esm/evaluateFreeformArrangement.d.ts.map +1 -0
  84. package/dist/esm/evaluateFreeformArrangement.js +14 -0
  85. package/dist/esm/evaluateFreeformArrangement.js.map +1 -0
  86. package/dist/esm/evaluateFreeformSlotArrangement.d.ts +3 -0
  87. package/dist/esm/evaluateFreeformSlotArrangement.d.ts.map +1 -0
  88. package/dist/esm/evaluateFreeformSlotArrangement.js +16 -0
  89. package/dist/esm/evaluateFreeformSlotArrangement.js.map +1 -0
  90. package/dist/esm/flowNodeKind.d.ts +8 -0
  91. package/dist/esm/flowNodeKind.d.ts.map +1 -0
  92. package/dist/esm/flowNodeKind.js +33 -0
  93. package/dist/esm/flowNodeKind.js.map +1 -0
  94. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.d.ts +2 -0
  95. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.d.ts.map +1 -0
  96. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.js +23 -0
  97. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.js.map +1 -0
  98. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.d.ts +2 -0
  99. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.d.ts.map +1 -0
  100. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.js +16 -0
  101. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.js.map +1 -0
  102. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.d.ts +2 -0
  103. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.d.ts.map +1 -0
  104. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.js +17 -0
  105. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.js.map +1 -0
  106. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts +2 -0
  107. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts.map +1 -0
  108. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.js +43 -0
  109. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.js.map +1 -0
  110. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts +2 -0
  111. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts.map +1 -0
  112. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.js +46 -0
  113. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.js.map +1 -0
  114. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts +2 -0
  115. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts.map +1 -0
  116. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.js +25 -0
  117. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.js.map +1 -0
  118. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.d.ts +2 -0
  119. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.d.ts.map +1 -0
  120. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.js +17 -0
  121. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.js.map +1 -0
  122. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.d.ts +2 -0
  123. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.d.ts.map +1 -0
  124. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.js +22 -0
  125. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.js.map +1 -0
  126. package/dist/esm/for_packageDependencies/fixtures.d.ts +38 -0
  127. package/dist/esm/for_packageDependencies/fixtures.d.ts.map +1 -0
  128. package/dist/esm/for_packageDependencies/fixtures.js +5 -0
  129. package/dist/esm/for_packageDependencies/fixtures.js.map +1 -0
  130. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.d.ts +2 -0
  131. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.d.ts.map +1 -0
  132. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.js +29 -0
  133. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.js.map +1 -0
  134. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.d.ts +2 -0
  135. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.d.ts.map +1 -0
  136. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.js +10 -0
  137. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.js.map +1 -0
  138. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.d.ts +2 -0
  139. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.d.ts.map +1 -0
  140. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.js +46 -0
  141. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.js.map +1 -0
  142. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.d.ts +2 -0
  143. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.d.ts.map +1 -0
  144. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.js +20 -0
  145. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.js.map +1 -0
  146. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.d.ts +2 -0
  147. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.d.ts.map +1 -0
  148. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.js +30 -0
  149. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.js.map +1 -0
  150. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.d.ts +2 -0
  151. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.d.ts.map +1 -0
  152. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.js +18 -0
  153. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.js.map +1 -0
  154. package/dist/esm/incompatibleStarterThemes.d.ts +3 -0
  155. package/dist/esm/incompatibleStarterThemes.d.ts.map +1 -0
  156. package/dist/esm/incompatibleStarterThemes.js +27 -0
  157. package/dist/esm/incompatibleStarterThemes.js.map +1 -0
  158. package/dist/esm/index.d.ts +21 -0
  159. package/dist/esm/index.d.ts.map +1 -0
  160. package/dist/esm/index.js +18 -0
  161. package/dist/esm/index.js.map +1 -0
  162. package/dist/esm/package.json +3 -0
  163. package/dist/esm/packageCatalog.d.ts +7 -0
  164. package/dist/esm/packageCatalog.d.ts.map +1 -0
  165. package/dist/esm/packageCatalog.js +57 -0
  166. package/dist/esm/packageCatalog.js.map +1 -0
  167. package/dist/esm/packageVersionRange.d.ts +2 -0
  168. package/dist/esm/packageVersionRange.d.ts.map +1 -0
  169. package/dist/esm/packageVersionRange.js +111 -0
  170. package/dist/esm/packageVersionRange.js.map +1 -0
  171. package/dist/esm/renderElement.d.ts +5 -0
  172. package/dist/esm/renderElement.d.ts.map +1 -0
  173. package/dist/esm/renderElement.js +37 -0
  174. package/dist/esm/renderElement.js.map +1 -0
  175. package/dist/esm/resolveComponentName.d.ts +7 -0
  176. package/dist/esm/resolveComponentName.d.ts.map +1 -0
  177. package/dist/esm/resolveComponentName.js +63 -0
  178. package/dist/esm/resolveComponentName.js.map +1 -0
  179. package/dist/esm/resolvePackageDependencies.d.ts +4 -0
  180. package/dist/esm/resolvePackageDependencies.d.ts.map +1 -0
  181. package/dist/esm/resolvePackageDependencies.js +147 -0
  182. package/dist/esm/resolvePackageDependencies.js.map +1 -0
  183. package/dist/esm/resolveScreenTemplates.d.ts +20 -0
  184. package/dist/esm/resolveScreenTemplates.d.ts.map +1 -0
  185. package/dist/esm/resolveScreenTemplates.js +133 -0
  186. package/dist/esm/resolveScreenTemplates.js.map +1 -0
  187. package/dist/esm/themeCompatibility.d.ts +5 -0
  188. package/dist/esm/themeCompatibility.d.ts.map +1 -0
  189. package/dist/esm/themeCompatibility.js +41 -0
  190. package/dist/esm/themeCompatibility.js.map +1 -0
  191. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  192. package/elementKind.ts +26 -0
  193. package/evaluateFlowArrangement.ts +35 -0
  194. package/evaluateFreeformArrangement.ts +15 -0
  195. package/evaluateFreeformSlotArrangement.ts +17 -0
  196. package/flowNodeKind.ts +38 -0
  197. package/for_aggregateContributions/when_aggregating_by_contribution_point.ts +31 -0
  198. package/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.ts +32 -0
  199. package/for_computeSizeClass/when_computing_the_size_class.ts +23 -0
  200. package/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.ts +67 -0
  201. package/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.ts +68 -0
  202. package/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.ts +47 -0
  203. package/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.ts +34 -0
  204. package/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.ts +26 -0
  205. package/for_packageDependencies/fixtures.ts +44 -0
  206. package/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.ts +39 -0
  207. package/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.ts +13 -0
  208. package/for_renderElement/when_rendering_a_mixed_tree.ts +58 -0
  209. package/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.ts +36 -0
  210. package/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.ts +49 -0
  211. package/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.ts +37 -0
  212. package/incompatibleStarterThemes.ts +24 -0
  213. package/index.ts +23 -0
  214. package/package.json +45 -0
  215. package/packageCatalog.ts +65 -0
  216. package/packageVersionRange.ts +90 -0
  217. package/renderElement.ts +40 -0
  218. package/resolveComponentName.ts +66 -0
  219. package/resolvePackageDependencies.ts +156 -0
  220. package/resolveScreenTemplates.ts +191 -0
  221. package/themeCompatibility.ts +46 -0
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ /**
4
+ * Selects the {@link FreeformSlotVariant} that targets a given {@link SizeClass} - the counterpart to
5
+ * {@link evaluateFreeformArrangement} for a `Layout`'s own macro `arrangement`, which places the layout's
6
+ * slots themselves rather than the content of one slot.
7
+ *
8
+ * @param arrangement The {@link FreeformSlotArrangement} to evaluate.
9
+ * @param sizeClass The current {@link SizeClass}.
10
+ * @returns The variant whose size class exactly matches, or `undefined` when nothing targets it. There is deliberately no fallback here - a size class with no matching variant is a design-time/build-time warning elsewhere, never a silently picked variant.
11
+ */ function evaluateFreeformSlotArrangement(arrangement, sizeClass) {
12
+ return arrangement.variants.find((variant)=>variant.sizeClass.width === sizeClass.width && variant.sizeClass.height === sizeClass.height);
13
+ }
14
+
15
+ export { evaluateFreeformSlotArrangement };
16
+ //# sourceMappingURL=evaluateFreeformSlotArrangement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluateFreeformSlotArrangement.js","sources":["../../evaluateFreeformSlotArrangement.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 { FreeformSlotArrangement, FreeformSlotVariant, SizeClass } from '@cratis/scene.model';\n\n/**\n * Selects the {@link FreeformSlotVariant} that targets a given {@link SizeClass} - the counterpart to\n * {@link evaluateFreeformArrangement} for a `Layout`'s own macro `arrangement`, which places the layout's\n * slots themselves rather than the content of one slot.\n *\n * @param arrangement The {@link FreeformSlotArrangement} to evaluate.\n * @param sizeClass The current {@link SizeClass}.\n * @returns The variant whose size class exactly matches, or `undefined` when nothing targets it. There is deliberately no fallback here - a size class with no matching variant is a design-time/build-time warning elsewhere, never a silently picked variant.\n */\nexport function evaluateFreeformSlotArrangement(arrangement: FreeformSlotArrangement, sizeClass: SizeClass): FreeformSlotVariant | undefined {\n return arrangement.variants.find(variant => variant.sizeClass.width === sizeClass.width && variant.sizeClass.height === sizeClass.height);\n}\n"],"names":["evaluateFreeformSlotArrangement","arrangement","sizeClass","variants","find","variant","width","height"],"mappings":"AAAA;AACA;AAIA;;;;;;;;AAQC,IACM,SAASA,+BAAAA,CAAgCC,WAAoC,EAAEC,SAAoB,EAAA;IACtG,OAAOD,WAAAA,CAAYE,QAAQ,CAACC,IAAI,CAACC,CAAAA,OAAAA,GAAWA,QAAQH,SAAS,CAACI,KAAK,KAAKJ,SAAAA,CAAUI,KAAK,IAAID,OAAAA,CAAQH,SAAS,CAACK,MAAM,KAAKL,SAAAA,CAAUK,MAAM,CAAA;AAC5I;;;;"}
@@ -0,0 +1,8 @@
1
+ import { FlowColumn, FlowContainer, FlowGrid, FlowLeaf, FlowNode, FlowRow, FlowSlotLeaf } from '@cratis/scene.model';
2
+ export declare function isFlowContainer(node: FlowNode): node is FlowContainer;
3
+ export declare function isFlowRow(node: FlowNode): node is FlowRow;
4
+ export declare function isFlowColumn(node: FlowNode): node is FlowColumn;
5
+ export declare function isFlowGrid(node: FlowNode): node is FlowGrid;
6
+ export declare function isFlowLeaf(node: FlowNode): node is FlowLeaf;
7
+ export declare function isFlowSlotLeaf(node: FlowNode): node is FlowSlotLeaf;
8
+ //# sourceMappingURL=flowNodeKind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowNodeKind.d.ts","sourceRoot":"","sources":["../../flowNodeKind.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAqB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAYxI,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,aAAa,CAErE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,OAAO,CAEzD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,UAAU,CAE/D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,QAAQ,CAE3D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,QAAQ,CAE3D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,YAAY,CAEnE"}
@@ -0,0 +1,33 @@
1
+ import { FlowContainerKind } from '@cratis/scene.model';
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
+ * Type guards distinguishing the concrete nodes a flow arrangement tree is built from.
7
+ *
8
+ * Leaves are told apart the same way `elementKind` tells element kinds apart - by the property each one
9
+ * alone declares. Containers cannot be: a row and a column have exactly the same members, so no structural
10
+ * test can separate them. They carry an explicit {@link FlowContainerKind} instead, which is what makes
11
+ * them a discriminated union rather than three identical shapes, and what lets a renderer decide between
12
+ * a horizontal and a vertical arrangement at all.
13
+ */ function isFlowContainer(node) {
14
+ return 'kind' in node && 'children' in node;
15
+ }
16
+ function isFlowRow(node) {
17
+ return isFlowContainer(node) && node.kind === FlowContainerKind.Row;
18
+ }
19
+ function isFlowColumn(node) {
20
+ return isFlowContainer(node) && node.kind === FlowContainerKind.Column;
21
+ }
22
+ function isFlowGrid(node) {
23
+ return isFlowContainer(node) && node.kind === FlowContainerKind.Grid;
24
+ }
25
+ function isFlowLeaf(node) {
26
+ return 'content' in node;
27
+ }
28
+ function isFlowSlotLeaf(node) {
29
+ return 'slotName' in node;
30
+ }
31
+
32
+ export { isFlowColumn, isFlowContainer, isFlowGrid, isFlowLeaf, isFlowRow, isFlowSlotLeaf };
33
+ //# sourceMappingURL=flowNodeKind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowNodeKind.js","sources":["../../flowNodeKind.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 { FlowColumn, FlowContainer, FlowContainerKind, FlowGrid, FlowLeaf, FlowNode, FlowRow, FlowSlotLeaf } from '@cratis/scene.model';\n\n/**\n * Type guards distinguishing the concrete nodes a flow arrangement tree is built from.\n *\n * Leaves are told apart the same way `elementKind` tells element kinds apart - by the property each one\n * alone declares. Containers cannot be: a row and a column have exactly the same members, so no structural\n * test can separate them. They carry an explicit {@link FlowContainerKind} instead, which is what makes\n * them a discriminated union rather than three identical shapes, and what lets a renderer decide between\n * a horizontal and a vertical arrangement at all.\n */\n\nexport function isFlowContainer(node: FlowNode): node is FlowContainer {\n return 'kind' in node && 'children' in node;\n}\n\nexport function isFlowRow(node: FlowNode): node is FlowRow {\n return isFlowContainer(node) && node.kind === FlowContainerKind.Row;\n}\n\nexport function isFlowColumn(node: FlowNode): node is FlowColumn {\n return isFlowContainer(node) && node.kind === FlowContainerKind.Column;\n}\n\nexport function isFlowGrid(node: FlowNode): node is FlowGrid {\n return isFlowContainer(node) && node.kind === FlowContainerKind.Grid;\n}\n\nexport function isFlowLeaf(node: FlowNode): node is FlowLeaf {\n return 'content' in node;\n}\n\nexport function isFlowSlotLeaf(node: FlowNode): node is FlowSlotLeaf {\n return 'slotName' in node;\n}\n"],"names":["isFlowContainer","node","isFlowRow","kind","FlowContainerKind","Row","isFlowColumn","Column","isFlowGrid","Grid","isFlowLeaf","isFlowSlotLeaf"],"mappings":";;AAAA;AACA;AAIA;;;;;;;;IAUO,SAASA,eAAAA,CAAgBC,IAAc,EAAA;IAC1C,OAAO,MAAA,IAAUA,QAAQ,UAAA,IAAcA,IAAAA;AAC3C;AAEO,SAASC,UAAUD,IAAc,EAAA;AACpC,IAAA,OAAOD,gBAAgBC,IAAAA,CAAAA,IAASA,IAAAA,CAAKE,IAAI,KAAKC,kBAAkBC,GAAG;AACvE;AAEO,SAASC,aAAaL,IAAc,EAAA;AACvC,IAAA,OAAOD,gBAAgBC,IAAAA,CAAAA,IAASA,IAAAA,CAAKE,IAAI,KAAKC,kBAAkBG,MAAM;AAC1E;AAEO,SAASC,WAAWP,IAAc,EAAA;AACrC,IAAA,OAAOD,gBAAgBC,IAAAA,CAAAA,IAASA,IAAAA,CAAKE,IAAI,KAAKC,kBAAkBK,IAAI;AACxE;AAEO,SAASC,WAAWT,IAAc,EAAA;AACrC,IAAA,OAAO,SAAA,IAAaA,IAAAA;AACxB;AAEO,SAASU,eAAeV,IAAc,EAAA;AACzC,IAAA,OAAO,UAAA,IAAcA,IAAAA;AACzB;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_aggregating_by_contribution_point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_aggregating_by_contribution_point.d.ts","sourceRoot":"","sources":["../../../for_aggregateContributions/when_aggregating_by_contribution_point.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import { aggregateContributions } from '../index';
2
+ function contribution(contributionPointName, id, order) {
3
+ return { contributionPointName, content: { id, properties: {} }, order };
4
+ }
5
+ describe('when aggregating by contribution point', () => {
6
+ it('should exclude contributions targeting a different contribution point', () => {
7
+ const result = aggregateContributions([contribution('Navigation', 'a'), contribution('Toolbar', 'b')], 'Navigation');
8
+ result.map(item => item.content.id).should.deep.equal(['a']);
9
+ });
10
+ it('should sort ordered contributions ascending by order', () => {
11
+ const result = aggregateContributions([contribution('Navigation', 'second', 20), contribution('Navigation', 'first', 10)], 'Navigation');
12
+ result.map(item => item.content.id).should.deep.equal(['first', 'second']);
13
+ });
14
+ it('should sort unordered contributions after every ordered one', () => {
15
+ const result = aggregateContributions([contribution('Navigation', 'unordered'), contribution('Navigation', 'ordered', 10)], 'Navigation');
16
+ result.map(item => item.content.id).should.deep.equal(['ordered', 'unordered']);
17
+ });
18
+ it('should preserve original relative order among unordered contributions', () => {
19
+ const result = aggregateContributions([contribution('Navigation', 'first'), contribution('Navigation', 'second')], 'Navigation');
20
+ result.map(item => item.content.id).should.deep.equal(['first', 'second']);
21
+ });
22
+ });
23
+ //# sourceMappingURL=when_aggregating_by_contribution_point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_aggregating_by_contribution_point.js","sourceRoot":"","sources":["../../../for_aggregateContributions/when_aggregating_by_contribution_point.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,SAAS,YAAY,CAAC,qBAA6B,EAAE,EAAU,EAAE,KAAc;IAC3E,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AAC7E,CAAC;AAED,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACpD,EAAE,CAAC,uEAAuE,EAAE,GAAG,EAAE;QAC7E,MAAM,MAAM,GA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AAC,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QACjI,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { buildStarterProfile } from '../index';
4
+ const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'ui-starter-fixtures.json');
5
+ const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
6
+ describe('when checking against the shared fixture corpus', () => {
7
+ for (const fixtureCase of corpus.profileCases) {
8
+ it(`should build the expected profile for "${fixtureCase.name}"`, () => {
9
+ const profile = buildStarterProfile(fixtureCase.starter, fixtureCase.targetPlatform);
10
+ profile.name.should.equal(fixtureCase.expectedProfile.name);
11
+ profile.targetPlatform.should.equal(fixtureCase.expectedProfile.targetPlatform);
12
+ profile.packages.should.deep.equal(fixtureCase.expectedProfile.packages);
13
+ });
14
+ }
15
+ });
16
+ //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAa/C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,0BAA0B,CAAC,CAAC;AACnG,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAkB,CAAC;AAEhF,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC7D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5C,EAAE,CAAC,0CAA0C,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YACnE,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;YACrF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC5D,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;YAChF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_computing_the_size_class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_computing_the_size_class.d.ts","sourceRoot":"","sources":["../../../for_computeSizeClass/when_computing_the_size_class.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { HeightSizeClass, WidthSizeClass } from '@cratis/scene.model';
2
+ import { computeSizeClass, defaultHeightBreakpoint, defaultWidthBreakpoint } from '../index';
3
+ describe('when computing the size class', () => {
4
+ it('should be compact by compact below both breakpoints', () => {
5
+ computeSizeClass(320, 480).should.deep.equal({ width: WidthSizeClass.Compact, height: HeightSizeClass.Compact });
6
+ });
7
+ it('should be regular width below height breakpoint only', () => {
8
+ computeSizeClass(1024, 480).should.deep.equal({ width: WidthSizeClass.Regular, height: HeightSizeClass.Compact });
9
+ });
10
+ it('should be regular by regular at exactly both breakpoints', () => {
11
+ computeSizeClass(defaultWidthBreakpoint, defaultHeightBreakpoint).should.deep.equal({ width: WidthSizeClass.Regular, height: HeightSizeClass.Regular });
12
+ });
13
+ it('should honor a custom breakpoint', () => {
14
+ computeSizeClass(500, 500, 400).width.should.equal(WidthSizeClass.Regular);
15
+ });
16
+ });
17
+ //# sourceMappingURL=when_computing_the_size_class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_computing_the_size_class.js","sourceRoot":"","sources":["../../../for_computeSizeClass/when_computing_the_size_class.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAE7F,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IACrH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC5D,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IACtH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAChE,gBAAgB,CAAC,sBAAsB,EAAE,uBAAuB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5J,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QACxC,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_evaluating_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_evaluating_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
4
+ import { evaluateFlowArrangement } from '../index';
5
+ const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'layout-evaluation-fixtures.json');
6
+ const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
7
+ function leaf(tag) {
8
+ const content = {
9
+ id: tag,
10
+ name: tag,
11
+ properties: {},
12
+ visibility: Visibility.Visible,
13
+ isEnabled: true,
14
+ opacity: 1,
15
+ size: {},
16
+ zIndex: 0,
17
+ minimumSize: {},
18
+ maximumSize: {},
19
+ margin: { left: 0, top: 0, right: 0, bottom: 0 },
20
+ horizontalAlignment: HorizontalAlignment.Stretch,
21
+ verticalAlignment: VerticalAlignment.Stretch,
22
+ componentName: 'core:text',
23
+ slots: {},
24
+ };
25
+ return { content };
26
+ }
27
+ describe('when evaluating against the shared fixture corpus', () => {
28
+ for (const fixtureCase of corpus.flowCases) {
29
+ it(`should match the expected tag for "${fixtureCase.name}"`, () => {
30
+ const arrangement = {
31
+ root: leaf(fixtureCase.rootTag),
32
+ overrides: fixtureCase.overrides.map((override) => ({
33
+ width: override.width ?? undefined,
34
+ height: override.height ?? undefined,
35
+ root: leaf(override.tag),
36
+ })),
37
+ };
38
+ const result = evaluateFlowArrangement(arrangement, fixtureCase.sizeClass);
39
+ result.content.id.should.equal(fixtureCase.expectedTag);
40
+ });
41
+ }
42
+ });
43
+ //# sourceMappingURL=when_evaluating_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_evaluating_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAA+E,mBAAmB,EAAa,iBAAiB,EAAE,UAAU,EAAkB,MAAM,qBAAqB,CAAC;AACjM,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAoBnD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,iCAAiC,CAAC,CAAC;AAC1G,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAkB,CAAC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AC;YACtF,MAAM,CAAC,OAA6B,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_evaluating_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_evaluating_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
4
+ import { evaluateFreeformArrangement } from '../index';
5
+ const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'layout-evaluation-fixtures.json');
6
+ const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
7
+ function placement(tag) {
8
+ const element = {
9
+ id: tag,
10
+ name: tag,
11
+ properties: {},
12
+ visibility: Visibility.Visible,
13
+ isEnabled: true,
14
+ opacity: 1,
15
+ size: {},
16
+ zIndex: 0,
17
+ minimumSize: {},
18
+ maximumSize: {},
19
+ margin: { left: 0, top: 0, right: 0, bottom: 0 },
20
+ horizontalAlignment: HorizontalAlignment.Stretch,
21
+ verticalAlignment: VerticalAlignment.Stretch,
22
+ componentName: 'core:text',
23
+ slots: {},
24
+ };
25
+ return { element, x: 0, y: 0, width: 0, height: 0 };
26
+ }
27
+ describe('when evaluating against the shared fixture corpus', () => {
28
+ for (const fixtureCase of corpus.freeformCases) {
29
+ it(`should match the expected tag for "${fixtureCase.name}"`, () => {
30
+ const arrangement = {
31
+ variants: fixtureCase.variants.map(variant => ({
32
+ sizeClass: { width: variant.width, height: variant.height },
33
+ placements: [placement(variant.tag)],
34
+ })),
35
+ };
36
+ const result = evaluateFreeformArrangement(arrangement, fixtureCase.sizeClass);
37
+ if (fixtureCase.expectedTag === null) {
38
+ (result === undefined).should.be.true;
39
+ }
40
+ else {
41
+ result.placements[0].element.id.should.equal(fixtureCase.expectedTag);
42
+ }
43
+ });
44
+ }
45
+ });
46
+ //# sourceMappingURL=when_evaluating_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_evaluating_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAA6E,mBAAmB,EAAa,iBAAiB,EAAE,UAAU,EAAkB,MAAM,qBAAqB,CAAC;AAC/L,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAmBvD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,iCAAiC,CAAC,CAAC;AAC1G,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAkB,CAAC;AAEhF,SAAS,SAAS,CAAC,GAAW;IAC1B,MAAM,OAAO,GAAsB;QAC/B,EAAE,EAAE,GAAG;QACP,IAAI,EAAE,GAAG;QACT,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,UAAU,CAAC,OAAO;QAC9B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC;QACT,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MA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C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_evaluating_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_evaluating_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { evaluateFreeformSlotArrangement } from '../index';
4
+ const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'layout-evaluation-fixtures.json');
5
+ const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
6
+ describe('when evaluating against the shared fixture corpus', () => {
7
+ for (const fixtureCase of corpus.freeformCases) {
8
+ it(`should match the expected tag for "${fixtureCase.name}"`, () => {
9
+ const arrangement = {
10
+ variants: fixtureCase.variants.map(variant => ({
11
+ sizeClass: { width: variant.width, height: variant.height },
12
+ placements: [{ slotName: variant.tag, x: 0, y: 0, width: 0, height: 0 }],
13
+ })),
14
+ };
15
+ const result = evaluateFreeformSlotArrangement(arrangement, fixtureCase.sizeClass);
16
+ if (fixtureCase.expectedTag === null) {
17
+ (result === undefined).should.be.true;
18
+ }
19
+ else {
20
+ result.placements[0].slotName.should.equal(fixtureCase.expectedTag);
21
+ }
22
+ });
23
+ }
24
+ });
25
+ //# sourceMappingURL=when_evaluating_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_evaluating_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAmB3D,M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C,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { incompatibleStarterThemes } from '../index';
4
+ const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'ui-starter-fixtures.json');
5
+ const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
6
+ describe('when checking against the shared fixture corpus', () => {
7
+ for (const fixtureCase of corpus.themeCases) {
8
+ const themes = {};
9
+ for (const [themeName, theme] of Object.entries(fixtureCase.themes)) {
10
+ themes[themeName] = { name: themeName, compatibleWith: theme.compatibleWith };
11
+ }
12
+ it(`should match the expected incompatible themes for "${fixtureCase.name}"`, () => {
13
+ incompatibleStarterThemes(fixtureCase.starter, themes).should.deep.equal(fixtureCase.expectedIncompatible);
14
+ });
15
+ }
16
+ });
17
+ //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAarD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,0BAA0B,CAAC,CAAC;AACnG,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAkB,CAAC;AAEhF,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC7D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,MAAM,MAAM,GAA0B,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YAClE,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC;QAClF,CAAC;QAED,EAAE,CAAC,sDAAsD,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YAC/E,yBAAyB,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_querying_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_querying_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_packageCatalog/when_querying_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { availablePackagesFor, baseComponentLibraries, componentsForPackages } from '../index';
2
+ import { corpus } from '../for_packageDependencies/fixtures';
3
+ function run(fixtureCase) {
4
+ switch (fixtureCase.query) {
5
+ case 'baseComponentLibraries':
6
+ return baseComponentLibraries(corpus.catalog).map((scenePackage) => scenePackage.name);
7
+ case 'availableFor':
8
+ return availablePackagesFor(corpus.catalog, fixtureCase.selected ?? []).map((scenePackage) => scenePackage.name);
9
+ case 'componentsFor':
10
+ return componentsForPackages(corpus.catalog, fixtureCase.selected ?? []);
11
+ default:
12
+ throw new Error(`The fixture corpus asks for an unknown query '${fixtureCase.query}'`);
13
+ }
14
+ }
15
+ describe('when querying against the shared fixture corpus', () => {
16
+ for (const fixtureCase of corpus.catalogCases) {
17
+ it(`should match the expected result for "${fixtureCase.name}"`, () => {
18
+ run(fixtureCase).should.deep.equal(fixtureCase.expected);
19
+ });
20
+ }
21
+ });
22
+ //# sourceMappingURL=when_querying_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_querying_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_packageCatalog/when_querying_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC/F,OAAO,EAAsB,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAEjF,SAAS,GAAG,CAAC,WAA+B;IACxC,QAAQ,WAAW,CAAC,KAAK,EAAE,CAAC;QACxB,KAAK,wBAAwB;YACzB,OAAO,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC3F,KAAK,cAAc;YACf,OAAO,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACrH,KAAK,eAAe;YAChB,OAAO,qBAAqB,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QAC7E;YACI,MAAM,IAAI,KAAK,CAAC,iDAAiD,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC;IAC/F,CAAC;AACL,CAAC;AAED,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC7D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC5C,EAAE,CAAC,yCAAyC,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YAClE,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { ScenePackage } from '@cratis/scene.model';
2
+ export interface ResolutionFixtureCase {
3
+ name: string;
4
+ selected: string[];
5
+ expectedPackages: string[];
6
+ expectedAdded: string[];
7
+ expectedMissing: {
8
+ package: string;
9
+ dependsOn: string;
10
+ }[];
11
+ expectedVersionConflicts: {
12
+ package: string;
13
+ dependsOn: string;
14
+ requiredRange: string;
15
+ actualVersion: string;
16
+ }[];
17
+ expectedCycles: string[][];
18
+ }
19
+ export interface VersionRangeFixtureCase {
20
+ version: string;
21
+ range: string | null;
22
+ expected: boolean;
23
+ }
24
+ export interface CatalogFixtureCase {
25
+ name: string;
26
+ query: string;
27
+ selected?: string[];
28
+ expected: string[];
29
+ }
30
+ interface FixtureCorpus {
31
+ catalog: ScenePackage[];
32
+ resolutionCases: ResolutionFixtureCase[];
33
+ versionRangeCases: VersionRangeFixtureCase[];
34
+ catalogCases: CatalogFixtureCase[];
35
+ }
36
+ export declare const corpus: FixtureCorpus;
37
+ export {};
38
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../for_packageDependencies/fixtures.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1D,wBAAwB,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjH,cAAc,EAAE,MAAM,EAAE,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,UAAU,aAAa;IACnB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,eAAe,EAAE,qBAAqB,EAAE,CAAC;IACzC,iBAAiB,EAAE,uBAAuB,EAAE,CAAC;IAC7C,YAAY,EAAE,kBAAkB,EAAE,CAAC;CACtC;AAQD,eAAO,MAAM,MAAM,EAAqD,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ const fixturePath = join(import.meta.dirname, '..', '..', '..', '..', 'package-dependency-fixtures.json');
4
+ export const corpus = JSON.parse(readFileSync(fixturePath, 'utf-8'));
5
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../for_packageDependencies/fixtures.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAiCjC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,kCAAkC,CAAC,CAAC;AAM1G,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_resolving_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_resolving_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import { isPackageSelectionValid, resolvePackageDependencies } from '../index';
2
+ import { corpus } from './fixtures';
3
+ describe('when resolving against the shared fixture corpus', () => {
4
+ for (const fixtureCase of corpus.resolutionCases) {
5
+ const selection = resolvePackageDependencies(fixtureCase.selected, corpus.catalog);
6
+ it(`should order the packages as expected for "${fixtureCase.name}"`, () => {
7
+ selection.packages.should.deep.equal(fixtureCase.expectedPackages);
8
+ });
9
+ it(`should report the expected transitively added packages for "${fixtureCase.name}"`, () => {
10
+ selection.added.should.deep.equal(fixtureCase.expectedAdded);
11
+ });
12
+ it(`should report the expected missing dependencies for "${fixtureCase.name}"`, () => {
13
+ selection.missing.should.deep.equal(fixtureCase.expectedMissing);
14
+ });
15
+ it(`should report the expected version conflicts for "${fixtureCase.name}"`, () => {
16
+ selection.versionConflicts.should.deep.equal(fixtureCase.expectedVersionConflicts);
17
+ });
18
+ it(`should report the expected cycles for "${fixtureCase.name}"`, () => {
19
+ selection.cycles.should.deep.equal(fixtureCase.expectedCycles);
20
+ });
21
+ it(`should consider "${fixtureCase.name}" valid only when nothing is wrong`, () => {
22
+ const expectedValid = fixtureCase.expectedMissing.length === 0 &&
23
+ fixtureCase.expectedVersionConflicts.length === 0 &&
24
+ fixtureCase.expectedCycles.length === 0;
25
+ isPackageSelectionValid(selection).should.equal(expectedValid);
26
+ });
27
+ }
28
+ });
29
+ //# sourceMappingURL=when_resolving_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_resolving_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,QAAQ,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC9D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC/C,MAAM,SAAS,GAAG,0BAA0B,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAEnF,EAAE,CAAC,8CAA8C,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YACvE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+DAA+D,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YACxF,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wDAAwD,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YACjF,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YAC9E,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YACnE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oBAAoB,WAAW,CAAC,IAAI,oCAAoC,EAAE,GAAG,EAAE;YAC9E,MAAM,aAAa,GACf,WAAW,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;gBACxC,WAAW,CAAC,wBAAwB,CAAC,MAAM,KAAK,CAAC;gBACjD,WAAW,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC;YAC5C,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { isVersionSatisfiedBy } from '../index';
2
+ import { corpus } from '../for_packageDependencies/fixtures';
3
+ describe('when checking against the shared fixture corpus', () => {
4
+ for (const fixtureCase of corpus.versionRangeCases) {
5
+ it(`should decide ${fixtureCase.version} against '${fixtureCase.range ?? '<null>'}' the same way the corpus does`, () => {
6
+ isVersionSatisfiedBy(fixtureCase.version, fixtureCase.range ?? undefined).should.equal(fixtureCase.expected);
7
+ });
8
+ }
9
+ });
10
+ //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,QAAQ,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC7D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACjD,EAAE,CAAC,iBAAiB,WAAW,CAAC,OAAO,aAAa,WAAW,CAAC,KAAK,IAAI,QAAQ,gCAAgC,EAAE,GAAG,EAAE;YACpH,oBAAoB,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACjH,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_rendering_a_mixed_tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_rendering_a_mixed_tree.d.ts","sourceRoot":"","sources":["../../../for_renderElement/when_rendering_a_mixed_tree.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
2
+ import { renderElement } from '../index';
3
+ function control(id) {
4
+ return {
5
+ id,
6
+ name: id,
7
+ properties: {},
8
+ visibility: Visibility.Visible,
9
+ isEnabled: true,
10
+ opacity: 1,
11
+ size: {},
12
+ zIndex: 0,
13
+ minimumSize: {},
14
+ maximumSize: {},
15
+ margin: { left: 0, top: 0, right: 0, bottom: 0 },
16
+ horizontalAlignment: HorizontalAlignment.Stretch,
17
+ verticalAlignment: VerticalAlignment.Stretch,
18
+ borderThickness: { left: 0, top: 0, right: 0, bottom: 0 },
19
+ padding: { left: 0, top: 0, right: 0, bottom: 0 },
20
+ tabIndex: 0,
21
+ };
22
+ }
23
+ class StringRenderer {
24
+ renderContentControl(element, content) {
25
+ return `ContentControl(${element.id})[${content}]`;
26
+ }
27
+ renderItemsControl(element, items) {
28
+ return `ItemsControl(${element.id})[${items.join(',')}]`;
29
+ }
30
+ renderExternalComponent(element, slots) {
31
+ const slotsText = Object.entries(slots).map(([name, children]) => `${name}=${children.join(',')}`).join(';');
32
+ return `ExternalComponent(${element.componentName})[${slotsText}]`;
33
+ }
34
+ renderPanel(element, children) {
35
+ return `Panel(${element.id})[${children.join(',')}]`;
36
+ }
37
+ }
38
+ describe('when rendering a mixed tree', () => {
39
+ const badge = { ...control('badge'), componentName: 'core:badge', slots: {} };
40
+ const itemTemplate = { ...control('row'), content: badge };
41
+ const items = { ...control('items'), itemsSource: { path: 'rows' }, itemTemplate };
42
+ const root = { ...control('root'), children: [items] };
43
+ const output = renderElement(root, new StringRenderer(), binding => (binding.path === 'rows' ? [{}, {}] : []));
44
+ it('should render the panel wrapping the items control', () => output.should.equal('Panel(root)[ItemsControl(items)[ContentControl(row)[ExternalComponent(core:badge)[]],ContentControl(row)[ExternalComponent(core:badge)[]]]]'));
45
+ });
46
+ //# sourceMappingURL=when_rendering_a_mixed_tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_rendering_a_mixed_tree.js","sourceRoot":"","sources":["../../../for_renderElement/when_rendering_a_mixed_tree.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8C,mBAAmB,EAAuB,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC1J,OAAO,EAAY,aAAa,EAAE,MAAM,UAAU,CAAC;AAEnD,SAAS,OAAO,CAAC,EAAU;IACvB,OA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