@cratis/scene.blueprint.components 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 (332) hide show
  1. package/.storybook/main.ts +61 -0
  2. package/.storybook/preview.tsx +42 -0
  3. package/BorrowedComponentName.ts +22 -0
  4. package/ComponentName.ts +27 -0
  5. package/CompositeName.ts +97 -0
  6. package/README.md +40 -0
  7. package/componentsBlueprint.ts +72 -0
  8. package/componentsBlueprintComponents.ts +23 -0
  9. package/dist/cjs/BorrowedComponentName.js +25 -0
  10. package/dist/cjs/BorrowedComponentName.js.map +1 -0
  11. package/dist/cjs/ComponentName.js +30 -0
  12. package/dist/cjs/ComponentName.js.map +1 -0
  13. package/dist/cjs/CompositeName.js +52 -0
  14. package/dist/cjs/CompositeName.js.map +1 -0
  15. package/dist/cjs/componentsBlueprint.js +93 -0
  16. package/dist/cjs/componentsBlueprint.js.map +1 -0
  17. package/dist/cjs/componentsBlueprintComponents.js +27 -0
  18. package/dist/cjs/componentsBlueprintComponents.js.map +1 -0
  19. package/dist/cjs/gallery/DialogTemplatePreview.js +46 -0
  20. package/dist/cjs/gallery/DialogTemplatePreview.js.map +1 -0
  21. package/dist/cjs/gallery/GalleryScreenPreview.js +65 -0
  22. package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -0
  23. package/dist/cjs/gallery/applicationChrome.js +137 -0
  24. package/dist/cjs/gallery/applicationChrome.js.map +1 -0
  25. package/dist/cjs/gallery/navigation.js +128 -0
  26. package/dist/cjs/gallery/navigation.js.map +1 -0
  27. package/dist/cjs/gallery/previewProfile.js +87 -0
  28. package/dist/cjs/gallery/previewProfile.js.map +1 -0
  29. package/dist/cjs/gallery/screens.js +80 -0
  30. package/dist/cjs/gallery/screens.js.map +1 -0
  31. package/dist/cjs/header/ArcPageHeader.js +65 -0
  32. package/dist/cjs/header/ArcPageHeader.js.map +1 -0
  33. package/dist/cjs/header/deriveArcHeading.js +51 -0
  34. package/dist/cjs/header/deriveArcHeading.js.map +1 -0
  35. package/dist/cjs/header/humanizeBindingName.js +36 -0
  36. package/dist/cjs/header/humanizeBindingName.js.map +1 -0
  37. package/dist/cjs/index.js +119 -0
  38. package/dist/cjs/index.js.map +1 -0
  39. package/dist/cjs/package.json +3 -0
  40. package/dist/cjs/packageName.js +15 -0
  41. package/dist/cjs/packageName.js.map +1 -0
  42. package/dist/cjs/templates/SampleBindingName.js +39 -0
  43. package/dist/cjs/templates/SampleBindingName.js.map +1 -0
  44. package/dist/cjs/templates/commandTemplates.js +82 -0
  45. package/dist/cjs/templates/commandTemplates.js.map +1 -0
  46. package/dist/cjs/templates/dataElements.js +131 -0
  47. package/dist/cjs/templates/dataElements.js.map +1 -0
  48. package/dist/cjs/templates/dialogElements.js +69 -0
  49. package/dist/cjs/templates/dialogElements.js.map +1 -0
  50. package/dist/cjs/templates/dialogTemplates.js +118 -0
  51. package/dist/cjs/templates/dialogTemplates.js.map +1 -0
  52. package/dist/cjs/templates/editorElements.js +81 -0
  53. package/dist/cjs/templates/editorElements.js.map +1 -0
  54. package/dist/cjs/templates/editorTemplates.js +172 -0
  55. package/dist/cjs/templates/editorTemplates.js.map +1 -0
  56. package/dist/cjs/templates/elements.js +101 -0
  57. package/dist/cjs/templates/elements.js.map +1 -0
  58. package/dist/cjs/templates/formElements.js +77 -0
  59. package/dist/cjs/templates/formElements.js.map +1 -0
  60. package/dist/cjs/templates/listTemplates.js +187 -0
  61. package/dist/cjs/templates/listTemplates.js.map +1 -0
  62. package/dist/cjs/templates/nesting.js +150 -0
  63. package/dist/cjs/templates/nesting.js.map +1 -0
  64. package/dist/cjs/templates/sampleData.js +141 -0
  65. package/dist/cjs/templates/sampleData.js.map +1 -0
  66. package/dist/cjs/templates/screenTemplates.js +41 -0
  67. package/dist/cjs/templates/screenTemplates.js.map +1 -0
  68. package/dist/cjs/templates/workspaceTemplates.js +212 -0
  69. package/dist/cjs/templates/workspaceTemplates.js.map +1 -0
  70. package/dist/esm/BorrowedComponentName.d.ts +4 -0
  71. package/dist/esm/BorrowedComponentName.d.ts.map +1 -0
  72. package/dist/esm/BorrowedComponentName.js +23 -0
  73. package/dist/esm/BorrowedComponentName.js.map +1 -0
  74. package/dist/esm/ComponentName.d.ts +4 -0
  75. package/dist/esm/ComponentName.d.ts.map +1 -0
  76. package/dist/esm/ComponentName.js +28 -0
  77. package/dist/esm/ComponentName.js.map +1 -0
  78. package/dist/esm/CompositeName.d.ts +28 -0
  79. package/dist/esm/CompositeName.d.ts.map +1 -0
  80. package/dist/esm/CompositeName.js +50 -0
  81. package/dist/esm/CompositeName.js.map +1 -0
  82. package/dist/esm/componentsBlueprint.d.ts +5 -0
  83. package/dist/esm/componentsBlueprint.d.ts.map +1 -0
  84. package/dist/esm/componentsBlueprint.js +90 -0
  85. package/dist/esm/componentsBlueprint.js.map +1 -0
  86. package/dist/esm/componentsBlueprintComponents.d.ts +3 -0
  87. package/dist/esm/componentsBlueprintComponents.d.ts.map +1 -0
  88. package/dist/esm/componentsBlueprintComponents.js +25 -0
  89. package/dist/esm/componentsBlueprintComponents.js.map +1 -0
  90. package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts +2 -0
  91. package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts.map +1 -0
  92. package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js +57 -0
  93. package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js.map +1 -0
  94. package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts +2 -0
  95. package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts.map +1 -0
  96. package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js +26 -0
  97. package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js.map +1 -0
  98. package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts +2 -0
  99. package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts.map +1 -0
  100. package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js +65 -0
  101. package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js.map +1 -0
  102. package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts +2 -0
  103. package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts.map +1 -0
  104. package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js +41 -0
  105. package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js.map +1 -0
  106. package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts +2 -0
  107. package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts.map +1 -0
  108. package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js +38 -0
  109. package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js.map +1 -0
  110. package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts +2 -0
  111. package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts.map +1 -0
  112. package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js +47 -0
  113. package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js.map +1 -0
  114. package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts +2 -0
  115. package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts.map +1 -0
  116. package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js +56 -0
  117. package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js.map +1 -0
  118. package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts +2 -0
  119. package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts.map +1 -0
  120. package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js +31 -0
  121. package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js.map +1 -0
  122. package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts +2 -0
  123. package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts.map +1 -0
  124. package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js +54 -0
  125. package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js.map +1 -0
  126. package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts +2 -0
  127. package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts.map +1 -0
  128. package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js +27 -0
  129. package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js.map +1 -0
  130. package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts +2 -0
  131. package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts.map +1 -0
  132. package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js +18 -0
  133. package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js.map +1 -0
  134. package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts +2 -0
  135. package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts.map +1 -0
  136. package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js +26 -0
  137. package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js.map +1 -0
  138. package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts +2 -0
  139. package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts.map +1 -0
  140. package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js +25 -0
  141. package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js.map +1 -0
  142. package/dist/esm/gallery/ArcPages.stories.d.ts +30 -0
  143. package/dist/esm/gallery/ArcPages.stories.d.ts.map +1 -0
  144. package/dist/esm/gallery/ArcPages.stories.js +34 -0
  145. package/dist/esm/gallery/ArcPages.stories.js.map +1 -0
  146. package/dist/esm/gallery/Bindings.stories.d.ts +22 -0
  147. package/dist/esm/gallery/Bindings.stories.d.ts.map +1 -0
  148. package/dist/esm/gallery/Bindings.stories.js +78 -0
  149. package/dist/esm/gallery/Bindings.stories.js.map +1 -0
  150. package/dist/esm/gallery/DialogTemplatePreview.d.ts +7 -0
  151. package/dist/esm/gallery/DialogTemplatePreview.d.ts.map +1 -0
  152. package/dist/esm/gallery/DialogTemplatePreview.js +44 -0
  153. package/dist/esm/gallery/DialogTemplatePreview.js.map +1 -0
  154. package/dist/esm/gallery/DialogTemplates.stories.d.ts +21 -0
  155. package/dist/esm/gallery/DialogTemplates.stories.d.ts.map +1 -0
  156. package/dist/esm/gallery/DialogTemplates.stories.js +23 -0
  157. package/dist/esm/gallery/DialogTemplates.stories.js.map +1 -0
  158. package/dist/esm/gallery/GalleryScreenPreview.d.ts +10 -0
  159. package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -0
  160. package/dist/esm/gallery/GalleryScreenPreview.js +62 -0
  161. package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -0
  162. package/dist/esm/gallery/applicationChrome.d.ts +3 -0
  163. package/dist/esm/gallery/applicationChrome.d.ts.map +1 -0
  164. package/dist/esm/gallery/applicationChrome.js +135 -0
  165. package/dist/esm/gallery/applicationChrome.js.map +1 -0
  166. package/dist/esm/gallery/index.d.ts +7 -0
  167. package/dist/esm/gallery/index.d.ts.map +1 -0
  168. package/dist/esm/gallery/index.js +7 -0
  169. package/dist/esm/gallery/index.js.map +1 -0
  170. package/dist/esm/gallery/navigation.d.ts +9 -0
  171. package/dist/esm/gallery/navigation.d.ts.map +1 -0
  172. package/dist/esm/gallery/navigation.js +121 -0
  173. package/dist/esm/gallery/navigation.js.map +1 -0
  174. package/dist/esm/gallery/previewProfile.d.ts +6 -0
  175. package/dist/esm/gallery/previewProfile.d.ts.map +1 -0
  176. package/dist/esm/gallery/previewProfile.js +83 -0
  177. package/dist/esm/gallery/previewProfile.js.map +1 -0
  178. package/dist/esm/gallery/screens.d.ts +4 -0
  179. package/dist/esm/gallery/screens.d.ts.map +1 -0
  180. package/dist/esm/gallery/screens.js +77 -0
  181. package/dist/esm/gallery/screens.js.map +1 -0
  182. package/dist/esm/header/ArcHeading.d.ts +9 -0
  183. package/dist/esm/header/ArcHeading.d.ts.map +1 -0
  184. package/dist/esm/header/ArcHeading.js +2 -0
  185. package/dist/esm/header/ArcHeading.js.map +1 -0
  186. package/dist/esm/header/ArcPageHeader.d.ts +3 -0
  187. package/dist/esm/header/ArcPageHeader.d.ts.map +1 -0
  188. package/dist/esm/header/ArcPageHeader.js +63 -0
  189. package/dist/esm/header/ArcPageHeader.js.map +1 -0
  190. package/dist/esm/header/deriveArcHeading.d.ts +4 -0
  191. package/dist/esm/header/deriveArcHeading.d.ts.map +1 -0
  192. package/dist/esm/header/deriveArcHeading.js +49 -0
  193. package/dist/esm/header/deriveArcHeading.js.map +1 -0
  194. package/dist/esm/header/humanizeBindingName.d.ts +2 -0
  195. package/dist/esm/header/humanizeBindingName.d.ts.map +1 -0
  196. package/dist/esm/header/humanizeBindingName.js +34 -0
  197. package/dist/esm/header/humanizeBindingName.js.map +1 -0
  198. package/dist/esm/header/index.d.ts +5 -0
  199. package/dist/esm/header/index.d.ts.map +1 -0
  200. package/dist/esm/header/index.js +5 -0
  201. package/dist/esm/header/index.js.map +1 -0
  202. package/dist/esm/index.d.ts +10 -0
  203. package/dist/esm/index.d.ts.map +1 -0
  204. package/dist/esm/index.js +30 -0
  205. package/dist/esm/index.js.map +1 -0
  206. package/dist/esm/package.json +3 -0
  207. package/dist/esm/packageName.d.ts +2 -0
  208. package/dist/esm/packageName.d.ts.map +1 -0
  209. package/dist/esm/packageName.js +13 -0
  210. package/dist/esm/packageName.js.map +1 -0
  211. package/dist/esm/templates/ArcHeaderOptions.d.ts +8 -0
  212. package/dist/esm/templates/ArcHeaderOptions.d.ts.map +1 -0
  213. package/dist/esm/templates/ArcHeaderOptions.js +2 -0
  214. package/dist/esm/templates/ArcHeaderOptions.js.map +1 -0
  215. package/dist/esm/templates/ColumnDefinition.d.ts +5 -0
  216. package/dist/esm/templates/ColumnDefinition.d.ts.map +1 -0
  217. package/dist/esm/templates/ColumnDefinition.js +2 -0
  218. package/dist/esm/templates/ColumnDefinition.js.map +1 -0
  219. package/dist/esm/templates/SampleBindingName.d.ts +11 -0
  220. package/dist/esm/templates/SampleBindingName.d.ts.map +1 -0
  221. package/dist/esm/templates/SampleBindingName.js +37 -0
  222. package/dist/esm/templates/SampleBindingName.js.map +1 -0
  223. package/dist/esm/templates/TableOptions.d.ts +6 -0
  224. package/dist/esm/templates/TableOptions.d.ts.map +1 -0
  225. package/dist/esm/templates/TableOptions.js +2 -0
  226. package/dist/esm/templates/TableOptions.js.map +1 -0
  227. package/dist/esm/templates/commandTemplates.d.ts +4 -0
  228. package/dist/esm/templates/commandTemplates.d.ts.map +1 -0
  229. package/dist/esm/templates/commandTemplates.js +79 -0
  230. package/dist/esm/templates/commandTemplates.js.map +1 -0
  231. package/dist/esm/templates/dataElements.d.ts +11 -0
  232. package/dist/esm/templates/dataElements.d.ts.map +1 -0
  233. package/dist/esm/templates/dataElements.js +123 -0
  234. package/dist/esm/templates/dataElements.js.map +1 -0
  235. package/dist/esm/templates/dialogElements.d.ts +5 -0
  236. package/dist/esm/templates/dialogElements.d.ts.map +1 -0
  237. package/dist/esm/templates/dialogElements.js +65 -0
  238. package/dist/esm/templates/dialogElements.js.map +1 -0
  239. package/dist/esm/templates/dialogTemplates.d.ts +6 -0
  240. package/dist/esm/templates/dialogTemplates.d.ts.map +1 -0
  241. package/dist/esm/templates/dialogTemplates.js +113 -0
  242. package/dist/esm/templates/dialogTemplates.js.map +1 -0
  243. package/dist/esm/templates/editorElements.d.ts +11 -0
  244. package/dist/esm/templates/editorElements.d.ts.map +1 -0
  245. package/dist/esm/templates/editorElements.js +74 -0
  246. package/dist/esm/templates/editorElements.js.map +1 -0
  247. package/dist/esm/templates/editorTemplates.d.ts +5 -0
  248. package/dist/esm/templates/editorTemplates.d.ts.map +1 -0
  249. package/dist/esm/templates/editorTemplates.js +168 -0
  250. package/dist/esm/templates/editorTemplates.js.map +1 -0
  251. package/dist/esm/templates/elements.d.ts +11 -0
  252. package/dist/esm/templates/elements.d.ts.map +1 -0
  253. package/dist/esm/templates/elements.js +92 -0
  254. package/dist/esm/templates/elements.js.map +1 -0
  255. package/dist/esm/templates/formElements.d.ts +11 -0
  256. package/dist/esm/templates/formElements.d.ts.map +1 -0
  257. package/dist/esm/templates/formElements.js +70 -0
  258. package/dist/esm/templates/formElements.js.map +1 -0
  259. package/dist/esm/templates/index.d.ts +18 -0
  260. package/dist/esm/templates/index.d.ts.map +1 -0
  261. package/dist/esm/templates/index.js +18 -0
  262. package/dist/esm/templates/index.js.map +1 -0
  263. package/dist/esm/templates/listTemplates.d.ts +6 -0
  264. package/dist/esm/templates/listTemplates.d.ts.map +1 -0
  265. package/dist/esm/templates/listTemplates.js +182 -0
  266. package/dist/esm/templates/listTemplates.js.map +1 -0
  267. package/dist/esm/templates/nesting.d.ts +6 -0
  268. package/dist/esm/templates/nesting.d.ts.map +1 -0
  269. package/dist/esm/templates/nesting.js +145 -0
  270. package/dist/esm/templates/nesting.js.map +1 -0
  271. package/dist/esm/templates/sampleData.d.ts +10 -0
  272. package/dist/esm/templates/sampleData.d.ts.map +1 -0
  273. package/dist/esm/templates/sampleData.js +134 -0
  274. package/dist/esm/templates/sampleData.js.map +1 -0
  275. package/dist/esm/templates/screenTemplates.d.ts +4 -0
  276. package/dist/esm/templates/screenTemplates.d.ts.map +1 -0
  277. package/dist/esm/templates/screenTemplates.js +38 -0
  278. package/dist/esm/templates/screenTemplates.js.map +1 -0
  279. package/dist/esm/templates/workspaceTemplates.d.ts +5 -0
  280. package/dist/esm/templates/workspaceTemplates.d.ts.map +1 -0
  281. package/dist/esm/templates/workspaceTemplates.js +208 -0
  282. package/dist/esm/templates/workspaceTemplates.js.map +1 -0
  283. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  284. package/for_ArcPageHeader/when_rendering_a_gallery_screen.tsx +79 -0
  285. package/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.ts +41 -0
  286. package/for_componentsBlueprint/when_resolving_its_dependencies.ts +85 -0
  287. package/for_componentsBlueprint/when_validating_the_bundle.ts +55 -0
  288. package/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.ts +56 -0
  289. package/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts +66 -0
  290. package/for_componentsScreenTemplates/when_following_the_nesting_chain.ts +83 -0
  291. package/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.ts +51 -0
  292. package/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.ts +72 -0
  293. package/for_deriveArcHeading/when_no_binding_is_named.ts +42 -0
  294. package/for_deriveArcHeading/when_the_binding_is_not_registered.ts +25 -0
  295. package/for_deriveArcHeading/when_the_binding_is_registered.ts +35 -0
  296. package/for_humanizeBindingName/when_reading_a_proxy_name.ts +34 -0
  297. package/gallery/ArcPages.stories.tsx +80 -0
  298. package/gallery/Bindings.stories.tsx +134 -0
  299. package/gallery/DialogTemplatePreview.tsx +49 -0
  300. package/gallery/DialogTemplates.stories.tsx +44 -0
  301. package/gallery/GalleryScreenPreview.tsx +70 -0
  302. package/gallery/applicationChrome.ts +108 -0
  303. package/gallery/index.ts +9 -0
  304. package/gallery/navigation.ts +63 -0
  305. package/gallery/previewProfile.ts +68 -0
  306. package/gallery/screens.ts +75 -0
  307. package/header/ArcHeading.ts +39 -0
  308. package/header/ArcPageHeader.tsx +44 -0
  309. package/header/deriveArcHeading.ts +47 -0
  310. package/header/humanizeBindingName.ts +36 -0
  311. package/header/index.ts +7 -0
  312. package/index.ts +12 -0
  313. package/package.json +71 -0
  314. package/packageName.ts +12 -0
  315. package/templates/ArcHeaderOptions.ts +27 -0
  316. package/templates/ColumnDefinition.ts +18 -0
  317. package/templates/SampleBindingName.ts +50 -0
  318. package/templates/TableOptions.ts +22 -0
  319. package/templates/commandTemplates.ts +59 -0
  320. package/templates/dataElements.ts +97 -0
  321. package/templates/dialogElements.ts +53 -0
  322. package/templates/dialogTemplates.ts +105 -0
  323. package/templates/editorElements.ts +69 -0
  324. package/templates/editorTemplates.ts +129 -0
  325. package/templates/elements.ts +81 -0
  326. package/templates/formElements.ts +61 -0
  327. package/templates/index.ts +20 -0
  328. package/templates/listTemplates.ts +142 -0
  329. package/templates/nesting.ts +118 -0
  330. package/templates/sampleData.ts +81 -0
  331. package/templates/screenTemplates.ts +35 -0
  332. package/templates/workspaceTemplates.ts +163 -0
@@ -0,0 +1,79 @@
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
+ import { render, screen } from '@testing-library/react';
5
+ import { SceneElement } from '@cratis/scene.model';
6
+ import { SceneElementView } from '@cratis/scene.react';
7
+ import { clearBindings, registerQuery } from '@cratis/scene.components';
8
+ import { composeScreenElement, resolveElementComponentNames } from '@cratis/scene.blueprint.default';
9
+ import { componentsBlueprintCatalog, componentsBlueprintProfile, componentsGalleryScreen, componentsPreviewRegistry } from '../gallery';
10
+ import { SampleBindingName, arcPageHeader } from '../templates';
11
+
12
+ class AllInvoices {}
13
+
14
+ function renderElement(element: SceneElement) {
15
+ render(
16
+ <SceneElementView
17
+ element={resolveElementComponentNames(element, componentsBlueprintProfile, componentsBlueprintCatalog)}
18
+ registry={componentsPreviewRegistry}
19
+ resolveBinding={() => undefined}
20
+ />,
21
+ );
22
+ }
23
+
24
+ function has(selector: string): boolean {
25
+ return document.querySelector(selector) !== null;
26
+ }
27
+
28
+ describe('when rendering a gallery screen', () => {
29
+ describe('and nothing is registered', () => {
30
+ beforeEach(() => {
31
+ clearBindings();
32
+ renderElement(composeScreenElement(componentsGalleryScreen('DataListPage')!));
33
+ });
34
+
35
+ afterEach(() => clearBindings());
36
+
37
+ it('should render inside the shell the blueprint it depends on provides', () => {
38
+ has('.layout-topbar').should.equal(true);
39
+ });
40
+
41
+ it('should render the page header this blueprint contributes', () => {
42
+ has('.layout-page-header').should.equal(true);
43
+ });
44
+
45
+ it('should render the trail derived from the section and the title', () => {
46
+ screen.getAllByLabelText('Breadcrumb').some(element => element.textContent === 'Billing › Invoices').should.equal(true);
47
+ });
48
+
49
+ it('should say which query a host still has to register', () => {
50
+ screen.getAllByText('No query registered as AllInvoices').length.should.be.greaterThan(0);
51
+ });
52
+
53
+ it('should render the unbound data page as a placeholder naming the binding it wanted', () => {
54
+ screen.getAllByText("Unresolved query binding 'AllInvoices' on Cratis.Components:dataPage").length.should.be.greaterThan(0);
55
+ });
56
+
57
+ it('should render no unresolved-component fallback, because every name the page writes resolves', () => {
58
+ has('[data-scene-unresolved-component]').should.equal(false);
59
+ });
60
+ });
61
+
62
+ describe('and the header binding is registered', () => {
63
+ beforeEach(() => {
64
+ clearBindings();
65
+ registerQuery(SampleBindingName.AllInvoices, AllInvoices);
66
+ renderElement(arcPageHeader('bound-header', { title: 'Invoices', section: 'Billing', query: SampleBindingName.AllInvoices }));
67
+ });
68
+
69
+ afterEach(() => clearBindings());
70
+
71
+ it('should report the binding as resolved rather than missing', () => {
72
+ screen.getAllByText('Bound to query AllInvoices').length.should.be.greaterThan(0);
73
+ });
74
+
75
+ it('should mark the header as bound, so a preview can be scanned for what is still unwired', () => {
76
+ has('[data-scene-binding-state="bound"]').should.equal(true);
77
+ });
78
+ });
79
+ });
@@ -0,0 +1,41 @@
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
+ import { cratisComponentsPackageManifest } from '@cratis/scene.components';
5
+ import { BorrowedComponentName } from '../BorrowedComponentName';
6
+ import { CompositeName } from '../CompositeName';
7
+ import { primeReactComponentNames } from '../gallery';
8
+
9
+ /**
10
+ * The names this blueprint writes into its templates belong to other packages, and this is the standing
11
+ * check that they still exist there.
12
+ *
13
+ * The failure this prevents is quiet. A composite renamed upstream leaves every template that referenced it
14
+ * rendering a dashed red box somewhere inside a page, and nothing in the box says which template wrote the
15
+ * name. Checking the enum against the owning manifest turns that into a failed spec in this package.
16
+ */
17
+ describe('when checking the names against the packages that declare them', () => {
18
+ const declaredByTheLibrary = new Set(cratisComponentsPackageManifest.components);
19
+
20
+ it('should have composite names to check', () => {
21
+ Object.values(CompositeName).should.not.be.empty;
22
+ });
23
+
24
+ it('should reference only composites the component library declares', () => {
25
+ Object.values(CompositeName)
26
+ .filter(name => !declaredByTheLibrary.has(name))
27
+ .should.be.empty;
28
+ });
29
+
30
+ it('should borrow only names PrimeReact declares', () => {
31
+ Object.values(BorrowedComponentName)
32
+ .filter(name => !primeReactComponentNames.includes(name))
33
+ .should.be.empty;
34
+ });
35
+
36
+ it('should borrow nothing the component library already declares, since the library would win the bare name anyway', () => {
37
+ Object.values(BorrowedComponentName)
38
+ .filter(name => declaredByTheLibrary.has(name))
39
+ .should.be.empty;
40
+ });
41
+ });
@@ -0,0 +1,85 @@
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
+ import { PackageKind, ScenePackage } from '@cratis/scene.model';
5
+ import { isPackageSelectionValid, resolvePackageDependencies } from '@cratis/scene.engine';
6
+ import { cratisComponentsPackageManifest } from '@cratis/scene.components';
7
+ import { defaultBlueprintManifest } from '@cratis/scene.blueprint.default';
8
+ import { componentsBlueprintManifest } from '../componentsBlueprint';
9
+ import { componentsBlueprintName } from '../packageName';
10
+
11
+ /** A styling package declaring nothing but itself - enough for `Cratis.Components` to depend on, and no more. */
12
+ const tailwind: ScenePackage = {
13
+ name: 'Tailwind',
14
+ version: '4.3.3',
15
+ kind: PackageKind.Styling,
16
+ dependencies: [],
17
+ components: [],
18
+ layouts: [],
19
+ screenTemplates: [],
20
+ dialogTemplates: [],
21
+ themes: [],
22
+ };
23
+
24
+ /** The base component library both of this blueprint's dependencies are written against, at the version this repository pins. */
25
+ const primeReact: ScenePackage = {
26
+ name: 'PrimeReact',
27
+ version: '10.9.8',
28
+ kind: PackageKind.ComponentLibrary,
29
+ dependencies: [{ name: 'Tailwind' }],
30
+ components: ['column', 'table', 'dialog'],
31
+ layouts: [],
32
+ screenTemplates: [],
33
+ dialogTemplates: [],
34
+ themes: [],
35
+ };
36
+
37
+ describe('when resolving its dependencies', () => {
38
+ const catalog = [tailwind, primeReact, cratisComponentsPackageManifest, defaultBlueprintManifest, componentsBlueprintManifest];
39
+ const selection = resolvePackageDependencies([componentsBlueprintName], catalog);
40
+ const positionOf = (name: string) => selection.packages.indexOf(name);
41
+
42
+ it('should be a valid selection', () => {
43
+ isPackageSelectionValid(selection).should.be.true;
44
+ });
45
+
46
+ it('should order the blueprint it layers on before it', () => {
47
+ positionOf('Cratis.Blueprint.Default').should.be.lessThan(positionOf(componentsBlueprintName));
48
+ });
49
+
50
+ it('should order the component library its templates are built from before it', () => {
51
+ positionOf('Cratis.Components').should.be.lessThan(positionOf(componentsBlueprintName));
52
+ });
53
+
54
+ it('should pull in the packages its own dependencies need, transitively', () => {
55
+ selection.added.should.contain('PrimeReact');
56
+ selection.added.should.contain('Tailwind');
57
+ });
58
+
59
+ it('should report nothing missing', () => {
60
+ selection.missing.should.deep.equal([]);
61
+ });
62
+
63
+ it('should report no version conflict', () => {
64
+ selection.versionConflicts.should.deep.equal([]);
65
+ });
66
+
67
+ it('should report no cycle, even though both blueprints depend on the same library', () => {
68
+ selection.cycles.should.deep.equal([]);
69
+ });
70
+
71
+ describe('and the default blueprint is not in the catalog', () => {
72
+ const withoutTheDefaultBlueprint = resolvePackageDependencies(
73
+ [componentsBlueprintName],
74
+ [tailwind, primeReact, cratisComponentsPackageManifest, componentsBlueprintManifest],
75
+ );
76
+
77
+ it('should report it missing rather than silently ordering around it', () => {
78
+ withoutTheDefaultBlueprint.missing.should.deep.equal([{ package: componentsBlueprintName, dependsOn: 'Cratis.Blueprint.Default' }]);
79
+ });
80
+
81
+ it('should not be a valid selection', () => {
82
+ isPackageSelectionValid(withoutTheDefaultBlueprint).should.be.false;
83
+ });
84
+ });
85
+ });
@@ -0,0 +1,55 @@
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
+ import { PackageKind } from '@cratis/scene.model';
5
+ import { validatePackageBundle } from '@cratis/scene.react';
6
+ import { componentsBlueprint, componentsBlueprintManifest } from '../componentsBlueprint';
7
+ import { componentsBlueprintName } from '../packageName';
8
+
9
+ describe('when validating the bundle', () => {
10
+ const problems = validatePackageBundle(componentsBlueprint);
11
+
12
+ it('should report no problems', () => {
13
+ problems.should.be.empty;
14
+ });
15
+
16
+ it('should declare itself a blueprint', () => {
17
+ componentsBlueprintManifest.kind.should.equal(PackageKind.Blueprint);
18
+ });
19
+
20
+ it('should be named as a blueprint package', () => {
21
+ componentsBlueprintManifest.name.should.equal(componentsBlueprintName);
22
+ });
23
+
24
+ it('should depend on the blueprint it layers on and the library its templates are built from', () => {
25
+ componentsBlueprintManifest.dependencies.map(dependency => dependency.name).should.deep.equal(['Cratis.Blueprint.Default', 'Cratis.Components']);
26
+ });
27
+
28
+ it('should ship no layout of its own, because it reuses the default blueprint shell', () => {
29
+ componentsBlueprintManifest.layouts.should.be.empty;
30
+ });
31
+
32
+ it('should provide no layout either, so the manifest and the bundle agree about that', () => {
33
+ (componentsBlueprint.layouts ?? []).should.be.empty;
34
+ });
35
+
36
+ it('should ship no theme, because the shell it themes is not its own', () => {
37
+ componentsBlueprintManifest.themes.should.be.empty;
38
+ });
39
+
40
+ it('should declare a screen template for every one it provides', () => {
41
+ componentsBlueprintManifest.screenTemplates.should.deep.equal((componentsBlueprint.screenTemplates ?? []).map(template => template.name));
42
+ });
43
+
44
+ it('should declare a dialog template for every one it provides', () => {
45
+ componentsBlueprintManifest.dialogTemplates.should.deep.equal((componentsBlueprint.dialogTemplates ?? []).map(template => template.name));
46
+ });
47
+
48
+ it('should ship a gallery screen for every screen template', () => {
49
+ (componentsBlueprint.screens ?? []).map(screen => screen.name).should.deep.equal(componentsBlueprintManifest.screenTemplates);
50
+ });
51
+
52
+ it('should name the module a host imports it from', () => {
53
+ componentsBlueprintManifest.module!.should.equal('@cratis/scene.blueprint.components');
54
+ });
55
+ });
@@ -0,0 +1,56 @@
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
+ import { Layout } from '@cratis/scene.model';
5
+ import { defaultBlueprint, shellComponentForLayout } from '@cratis/scene.blueprint.default';
6
+ import { componentsBlueprint } from '../componentsBlueprint';
7
+ import { componentsGalleryScreens } from '../gallery';
8
+
9
+ /**
10
+ * A gallery screen names a layout this package does not provide, which is the whole point of the
11
+ * dependency: it fills the default blueprint's `AppShell`. So the layout every one of them has to be
12
+ * checked against is that blueprint's, and a slot filled under a name the shell never reads renders
13
+ * nothing at all and reports nothing either.
14
+ */
15
+ describe('when checking the layouts and slots they fill', () => {
16
+ const layouts = defaultBlueprint.layouts ?? [];
17
+ const layoutsByName = new Map<string, Layout>(layouts.map(layout => [layout.name, layout]));
18
+ const templateNames = (componentsBlueprint.screenTemplates ?? []).map(template => template.name);
19
+
20
+ it('should have at least one screen to check', () => {
21
+ componentsGalleryScreens.should.not.be.empty;
22
+ });
23
+
24
+ for (const screen of componentsGalleryScreens) {
25
+ describe(`and the screen is '${screen.name}'`, () => {
26
+ const layout = layoutsByName.get(screen.layout);
27
+
28
+ it('should name a layout the blueprint it depends on provides', () => {
29
+ (layout !== undefined).should.be.true;
30
+ });
31
+
32
+ it('should fill only slots that layout declares', () => {
33
+ const declared = new Set((layout?.slots ?? []).map(slot => slot.name));
34
+ Object.keys(screen.slotContent)
35
+ .filter(name => !declared.has(name))
36
+ .should.be.empty;
37
+ });
38
+
39
+ it('should fill the content slot, which is the only one every layout declares', () => {
40
+ (screen.slotContent.content?.length ?? 0).should.be.greaterThan(0);
41
+ });
42
+
43
+ it('should name a screen template this blueprint provides', () => {
44
+ templateNames.should.contain(screen.screenTemplate);
45
+ });
46
+
47
+ it('should render in a shell the blueprint it depends on provides', () => {
48
+ (shellComponentForLayout(screen.layout) !== undefined).should.be.true;
49
+ });
50
+
51
+ it('should contribute its navigation, so the menu is the same on every screen', () => {
52
+ screen.contributions.should.not.be.empty;
53
+ });
54
+ });
55
+ }
56
+ });
@@ -0,0 +1,66 @@
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
+ import { Arrangement, FlowArrangement, FlowContainer, FlowNode, Slot } from '@cratis/scene.model';
5
+ import { componentsDialogTemplates, componentsScreenTemplates } from '../templates';
6
+
7
+ function slotNamesIn(node: FlowNode): string[] {
8
+ if ('slotName' in node) {
9
+ return [(node as { slotName: string }).slotName];
10
+ }
11
+
12
+ if ('children' in node) {
13
+ return (node as FlowContainer).children.flatMap(slotNamesIn);
14
+ }
15
+
16
+ return [];
17
+ }
18
+
19
+ function referencedSlots(arrangement: Arrangement | undefined): string[] {
20
+ const flow = arrangement as FlowArrangement | undefined;
21
+ if (!flow?.root) {
22
+ return [];
23
+ }
24
+
25
+ return [flow.root, ...(flow.overrides ?? []).map(override => override.root)].flatMap(slotNamesIn);
26
+ }
27
+
28
+ function undeclared(slots: Slot[], arrangement: Arrangement | undefined): string[] {
29
+ const declared = new Set(slots.map(slot => slot.name));
30
+ return [...new Set(referencedSlots(arrangement))].filter(name => !declared.has(name));
31
+ }
32
+
33
+ /**
34
+ * An arrangement leaf naming a slot the template never declared positions nothing, and reports nothing
35
+ * either - the region simply is not there. No type can express "one of whatever this particular container
36
+ * declared", so this is the check that stands in for one.
37
+ */
38
+ describe('when checking that arrangements reference declared slots', () => {
39
+ for (const template of componentsScreenTemplates.filter(candidate => candidate.arrangement !== undefined)) {
40
+ it(`should reference only slots the '${template.name}' template declares`, () => {
41
+ undeclared(template.slots, template.arrangement).should.be.empty;
42
+ });
43
+ }
44
+
45
+ for (const template of componentsScreenTemplates) {
46
+ it(`should file '${template.name}' content only under slots it declares`, () => {
47
+ const declared = new Set(template.slots.map(slot => slot.name));
48
+ Object.keys(template.content ?? {}).filter(name => !declared.has(name)).should.be.empty;
49
+ });
50
+ }
51
+
52
+ for (const template of componentsDialogTemplates) {
53
+ it(`should file '${template.name}' dialog content only under slots it declares`, () => {
54
+ const declared = new Set(template.slots.map(slot => slot.name));
55
+ Object.keys(template.content ?? {}).filter(name => !declared.has(name)).should.be.empty;
56
+ });
57
+ }
58
+
59
+ it('should give every dialog template exactly one slot, since the composites own their own chrome', () => {
60
+ componentsDialogTemplates.filter(template => template.slots.length !== 1).should.be.empty;
61
+ });
62
+
63
+ it('should give no dialog template a fitsSlot, because an overlay occupies no slot', () => {
64
+ componentsDialogTemplates.filter(template => 'fitsSlot' in template).should.be.empty;
65
+ });
66
+ });
@@ -0,0 +1,83 @@
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
+ import { isScreenTemplateResolutionValid, resolveScreenTemplates } from '@cratis/scene.engine';
5
+ import { appShellLayout } from '@cratis/scene.blueprint.default';
6
+ import { nestingChainTemplates } from '../templates';
7
+
8
+ /**
9
+ * The three-level chain, put through the real resolver rather than checked by walking slot lists.
10
+ *
11
+ * "It composes recursively" is the kind of claim that is true in a design document and wrong in the code,
12
+ * and the way it goes wrong is specific: a chain that reuses one slot name at several levels reads
13
+ * perfectly and resolves to nothing, because the resolver refuses to guess which of two containers a
14
+ * template belongs to. Only running it proves the chain is really placeable.
15
+ */
16
+ describe('when following the nesting chain', () => {
17
+ const resolution = resolveScreenTemplates(appShellLayout, nestingChainTemplates);
18
+ const placementOf = (name: string) => resolution.placements.find(placement => placement.template === name);
19
+
20
+ it('should be a valid resolution', () => {
21
+ isScreenTemplateResolutionValid(resolution).should.be.true;
22
+ });
23
+
24
+ it('should place all three levels', () => {
25
+ resolution.placements.should.have.lengthOf(3);
26
+ });
27
+
28
+ it('should leave nothing unplaced', () => {
29
+ resolution.unplaced.should.be.empty;
30
+ });
31
+
32
+ describe('and it is the module level', () => {
33
+ const placement = placementOf('DataModulePage')!;
34
+
35
+ it('should sit directly inside the application layout', () => {
36
+ placement.container.should.equal(appShellLayout.name);
37
+ });
38
+
39
+ it('should fill the content slot', () => {
40
+ placement.slot.should.equal('content');
41
+ });
42
+
43
+ it('should be one level below the layout', () => {
44
+ placement.depth.should.equal(1);
45
+ });
46
+ });
47
+
48
+ describe('and it is the feature level', () => {
49
+ const placement = placementOf('DataFeatureSection')!;
50
+
51
+ it('should sit inside the module template', () => {
52
+ placement.container.should.equal('DataModulePage');
53
+ });
54
+
55
+ it('should fill a slot the module template declares', () => {
56
+ placement.slot.should.equal('body');
57
+ });
58
+
59
+ it('should be two levels below the layout', () => {
60
+ placement.depth.should.equal(2);
61
+ });
62
+ });
63
+
64
+ describe('and it is the slice level', () => {
65
+ const placement = placementOf('CommandSliceSection')!;
66
+
67
+ it('should sit inside the feature template', () => {
68
+ placement.container.should.equal('DataFeatureSection');
69
+ });
70
+
71
+ it('should fill a slot the feature template declares', () => {
72
+ placement.slot.should.equal('primary');
73
+ });
74
+
75
+ it('should be three levels below the layout', () => {
76
+ placement.depth.should.equal(3);
77
+ });
78
+ });
79
+
80
+ it('should order the placements shallowest first, so a caller can build the tree top down', () => {
81
+ resolution.placements.map(placement => placement.depth).should.deep.equal([1, 2, 3]);
82
+ });
83
+ });
@@ -0,0 +1,51 @@
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
+ import { resolveScreenTemplates } from '@cratis/scene.engine';
5
+ import { appShellLayout, defaultBlueprint } from '@cratis/scene.blueprint.default';
6
+ import { componentsPageTemplates } from '../templates';
7
+
8
+ /**
9
+ * The page templates are resolved against the default blueprint's layout *and its templates*, because that
10
+ * is the situation an application is actually in: a profile that activates both blueprints has every one of
11
+ * those templates in scope, and a `fitsSlot` that became ambiguous once they were is a `fitsSlot` that
12
+ * works only in isolation.
13
+ *
14
+ * Only this package's templates are asserted on. The default blueprint's own nesting chain reuses `body` at
15
+ * three levels, so it is reported unplaced in this combined scope - which is `resolveScreenTemplates`
16
+ * behaving correctly, and not this package's result to claim or to fix.
17
+ */
18
+ describe('when placing them in the default blueprint layout', () => {
19
+ const templates = [...(defaultBlueprint.screenTemplates ?? []), ...componentsPageTemplates];
20
+ const resolution = resolveScreenTemplates(appShellLayout, templates);
21
+ const ownNames = new Set(componentsPageTemplates.map(template => template.name));
22
+ const ownPlacements = resolution.placements.filter(placement => ownNames.has(placement.template));
23
+
24
+ it('should have templates to place', () => {
25
+ componentsPageTemplates.should.not.be.empty;
26
+ });
27
+
28
+ it('should place every one of them', () => {
29
+ ownPlacements.map(placement => placement.template).sort().should.deep.equal([...ownNames].sort());
30
+ });
31
+
32
+ it('should leave none of them unplaced, even with the other blueprint templates in scope', () => {
33
+ resolution.unplaced.filter(unplaced => ownNames.has(unplaced.template)).should.be.empty;
34
+ });
35
+
36
+ it('should place every one directly inside the layout rather than inside another template', () => {
37
+ ownPlacements.filter(placement => placement.container !== appShellLayout.name).should.be.empty;
38
+ });
39
+
40
+ it('should place every one at the first level below the layout', () => {
41
+ ownPlacements.filter(placement => placement.depth !== 1).should.be.empty;
42
+ });
43
+
44
+ it('should place every one in the content slot, which is the only region a layout offers a screen', () => {
45
+ ownPlacements.filter(placement => placement.slot !== 'content').should.be.empty;
46
+ });
47
+
48
+ it('should introduce no nesting cycle', () => {
49
+ resolution.cycles.should.deep.equal([]);
50
+ });
51
+ });
@@ -0,0 +1,72 @@
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
+ import { resolveComponentName } from '@cratis/scene.engine';
5
+ import { composeScreenElement, defaultBlueprintName, distinctComponentNames } from '@cratis/scene.blueprint.default';
6
+ import { cratisComponentsPackageManifest } from '@cratis/scene.components';
7
+ import { ComponentName } from '../ComponentName';
8
+ import { CompositeName } from '../CompositeName';
9
+ import { componentsBlueprintCatalog, componentsBlueprintProfile, componentsGalleryScreens } from '../gallery';
10
+ import { componentsBlueprintName } from '../packageName';
11
+ import { componentsDialogTemplates } from '../templates';
12
+
13
+ /**
14
+ * Every name a template writes has to resolve against the profile, or it renders as a dashed red box in
15
+ * the middle of an otherwise fine page with nothing pointing back at the template that wrote it. The
16
+ * catalog is built from the real manifests of the packages this blueprint depends on, so a name renamed
17
+ * upstream fails here rather than in an application.
18
+ */
19
+ describe('when resolving the component names they reference', () => {
20
+ const fromScreens = distinctComponentNames(componentsGalleryScreens.map(composeScreenElement));
21
+ const fromDialogs = distinctComponentNames(componentsDialogTemplates.flatMap(template => Object.values(template.content ?? {}).flat()));
22
+ const names = [...new Set([...fromScreens, ...fromDialogs])].sort();
23
+ const resolutions = names.map(name => ({ name, resolution: resolveComponentName(name, componentsBlueprintProfile, componentsBlueprintCatalog) }));
24
+
25
+ it('should reference something', () => {
26
+ names.should.not.be.empty;
27
+ });
28
+
29
+ it('should reference something from the dialog templates too', () => {
30
+ fromDialogs.should.not.be.empty;
31
+ });
32
+
33
+ it('should resolve every referenced name against the profile', () => {
34
+ resolutions
35
+ .filter(entry => entry.resolution === undefined)
36
+ .map(entry => entry.name)
37
+ .should.be.empty;
38
+ });
39
+
40
+ it('should resolve its own page header to itself', () => {
41
+ resolveComponentName(ComponentName.ArcPageHeader, componentsBlueprintProfile, componentsBlueprintCatalog)!.package.should.equal(componentsBlueprintName);
42
+ });
43
+
44
+ it('should reference every component it registers, so nothing is declared and then unused', () => {
45
+ const referenced = new Set(names);
46
+ Object.values(ComponentName)
47
+ .filter(name => !referenced.has(name))
48
+ .should.be.empty;
49
+ });
50
+
51
+ it('should resolve the shell components to the blueprint it layers on', () => {
52
+ resolveComponentName('appShell', componentsBlueprintProfile, componentsBlueprintCatalog)!.package.should.equal(defaultBlueprintName);
53
+ });
54
+
55
+ it('should resolve the Arc-bound composites to the component library', () => {
56
+ resolutions
57
+ .filter(entry => (Object.values(CompositeName) as string[]).includes(entry.name))
58
+ .filter(entry => entry.resolution?.package !== cratisComponentsPackageManifest.name)
59
+ .map(entry => entry.name)
60
+ .should.be.empty;
61
+ });
62
+
63
+ it('should resolve a name both libraries declare to the Arc-aware one, and record the other as shadowed', () => {
64
+ const dataTable = resolveComponentName(CompositeName.DataTable, componentsBlueprintProfile, componentsBlueprintCatalog)!;
65
+ dataTable.package.should.equal(cratisComponentsPackageManifest.name);
66
+ dataTable.shadows.should.contain('PrimeReact');
67
+ });
68
+
69
+ it('should resolve the borrowed column to PrimeReact, since neither library declares one', () => {
70
+ resolveComponentName('column', componentsBlueprintProfile, componentsBlueprintCatalog)!.package.should.equal('PrimeReact');
71
+ });
72
+ });
@@ -0,0 +1,42 @@
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
+ import { BindingKind } from '@cratis/scene.components';
5
+ import { deriveArcHeading } from '../header';
6
+
7
+ /**
8
+ * The third state, and the one that is easiest to conflate with the second. A template that names nothing
9
+ * is not broken - the schema editor page genuinely has no query behind it - so this reads as a statement
10
+ * rather than as a problem to fix.
11
+ */
12
+ describe('when no binding is named', () => {
13
+ const heading = deriveArcHeading({ title: 'InvoiceRegistered' }, {}, BindingKind.Query);
14
+
15
+ it('should use the title the template gave it', () => {
16
+ heading.title.should.equal('InvoiceRegistered');
17
+ });
18
+
19
+ it('should build a trail of just the title when no section was given', () => {
20
+ heading.trail.should.deep.equal(['InvoiceRegistered']);
21
+ });
22
+
23
+ it('should report that it is not bound', () => {
24
+ heading.isBound.should.be.false;
25
+ });
26
+
27
+ it('should state the absence plainly rather than naming a binding nobody asked for', () => {
28
+ heading.bindingLabel.should.equal('No binding');
29
+ });
30
+
31
+ it('should carry no binding name', () => {
32
+ (heading.bindingName === undefined).should.be.true;
33
+ });
34
+
35
+ describe('and the template gave no title either', () => {
36
+ const untitled = deriveArcHeading({}, {}, BindingKind.Query);
37
+
38
+ it('should fall back to something readable rather than an empty heading', () => {
39
+ untitled.title.should.equal('Untitled page');
40
+ });
41
+ });
42
+ });
@@ -0,0 +1,25 @@
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
+ import { BindingKind } from '@cratis/scene.components';
5
+ import { deriveArcHeading } from '../header';
6
+
7
+ describe('when the binding is not registered', () => {
8
+ const heading = deriveArcHeading({ section: 'Billing' }, { name: 'RecordAdjustment' }, BindingKind.Command);
9
+
10
+ it('should fall back to the binding name read as a sentence, so the page is legible before anyone writes a title', () => {
11
+ heading.title.should.equal('Record adjustment');
12
+ });
13
+
14
+ it('should build the trail from the derived title', () => {
15
+ heading.trail.should.deep.equal(['Billing', 'Record adjustment']);
16
+ });
17
+
18
+ it('should report that it is not bound', () => {
19
+ heading.isBound.should.be.false;
20
+ });
21
+
22
+ it('should say which name a host has to register, which is the only actionable part', () => {
23
+ heading.bindingLabel.should.equal('No command registered as RecordAdjustment');
24
+ });
25
+ });