@cratis/scene.blueprint.default 4.32.0 → 4.34.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 (249) hide show
  1. package/ComponentName.ts +12 -0
  2. package/defaultBlueprintComponents.ts +5 -1
  3. package/dist/cjs/ComponentName.js +4 -0
  4. package/dist/cjs/ComponentName.js.map +1 -1
  5. package/dist/cjs/defaultBlueprint.js +1 -1
  6. package/dist/cjs/defaultBlueprintComponentMetadata.js +2 -2
  7. package/dist/cjs/defaultBlueprintComponents.js +10 -2
  8. package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
  9. package/dist/cjs/foundation/ChartWrapper.js +520 -0
  10. package/dist/cjs/foundation/ChartWrapper.js.map +1 -0
  11. package/dist/cjs/foundation/ColumnChooser.js +156 -0
  12. package/dist/cjs/foundation/ColumnChooser.js.map +1 -0
  13. package/dist/cjs/foundation/FilterBuilder.js +307 -0
  14. package/dist/cjs/foundation/FilterBuilder.js.map +1 -0
  15. package/dist/cjs/foundation/SavedViewsMenu.js +199 -0
  16. package/dist/cjs/foundation/SavedViewsMenu.js.map +1 -0
  17. package/dist/cjs/foundation/chartGeometry.js +101 -0
  18. package/dist/cjs/foundation/chartGeometry.js.map +1 -0
  19. package/dist/cjs/foundation/columnModel.js +43 -0
  20. package/dist/cjs/foundation/columnModel.js.map +1 -0
  21. package/dist/cjs/foundation/filterModel.js +123 -0
  22. package/dist/cjs/foundation/filterModel.js.map +1 -0
  23. package/dist/cjs/foundation/foundationComponentMetadata.js +28 -0
  24. package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
  25. package/dist/cjs/foundation/foundationDescriptors.js +153 -0
  26. package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
  27. package/dist/cjs/foundation/foundationSamples.js +130 -0
  28. package/dist/cjs/foundation/foundationSamples.js.map +1 -1
  29. package/dist/cjs/foundation/foundationStrings.js +25 -0
  30. package/dist/cjs/foundation/foundationStrings.js.map +1 -1
  31. package/dist/cjs/foundation/useElementWidth.js +31 -0
  32. package/dist/cjs/foundation/useElementWidth.js.map +1 -0
  33. package/dist/cjs/foundation/viewModel.js +24 -0
  34. package/dist/cjs/foundation/viewModel.js.map +1 -0
  35. package/dist/cjs/index.js +91 -4
  36. package/dist/cjs/index.js.map +1 -1
  37. package/dist/cjs/preview-host/ApplicationDocument.js +17 -0
  38. package/dist/cjs/preview-host/ApplicationDocument.js.map +1 -0
  39. package/dist/cjs/preview-host/ApplicationHost.js +113 -0
  40. package/dist/cjs/preview-host/ApplicationHost.js.map +1 -0
  41. package/dist/cjs/preview-host/FlowArrangementView.js +75 -0
  42. package/dist/cjs/preview-host/FlowArrangementView.js.map +1 -0
  43. package/dist/cjs/preview-host/PreviewProblem.js +32 -0
  44. package/dist/cjs/preview-host/PreviewProblem.js.map +1 -0
  45. package/dist/cjs/preview-host/PreviewProblemsView.js +51 -0
  46. package/dist/cjs/preview-host/PreviewProblemsView.js.map +1 -0
  47. package/dist/cjs/preview-host/PreviewSliceFragment.js +55 -0
  48. package/dist/cjs/preview-host/PreviewSliceFragment.js.map +1 -0
  49. package/dist/cjs/preview-host/PreviewTarget.js +17 -0
  50. package/dist/cjs/preview-host/PreviewTarget.js.map +1 -0
  51. package/dist/cjs/preview-host/PreviewTemplate.js +49 -0
  52. package/dist/cjs/preview-host/PreviewTemplate.js.map +1 -0
  53. package/dist/cjs/preview-host/PreviewToast.js +45 -0
  54. package/dist/cjs/preview-host/PreviewToast.js.map +1 -0
  55. package/dist/cjs/preview-host/ScenePreviewHost.js +290 -0
  56. package/dist/cjs/preview-host/ScenePreviewHost.js.map +1 -0
  57. package/dist/cjs/preview-host/composeApplication.js +249 -0
  58. package/dist/cjs/preview-host/composeApplication.js.map +1 -0
  59. package/dist/cjs/preview-host/defaultApplicationChrome.js +43 -0
  60. package/dist/cjs/preview-host/defaultApplicationChrome.js.map +1 -0
  61. package/dist/cjs/preview-host/diagnosePreview.js +100 -0
  62. package/dist/cjs/preview-host/diagnosePreview.js.map +1 -0
  63. package/dist/cjs/preview-host/previewProfile.js +53 -0
  64. package/dist/cjs/preview-host/previewProfile.js.map +1 -0
  65. package/dist/cjs/preview-host/previewSampleData.js +116 -0
  66. package/dist/cjs/preview-host/previewSampleData.js.map +1 -0
  67. package/dist/cjs/preview-host/resolvePreviewPlan.js +126 -0
  68. package/dist/cjs/preview-host/resolvePreviewPlan.js.map +1 -0
  69. package/dist/cjs/preview-host/useSizeClass.js +23 -0
  70. package/dist/cjs/preview-host/useSizeClass.js.map +1 -0
  71. package/dist/esm/ComponentName.d.ts +5 -1
  72. package/dist/esm/ComponentName.d.ts.map +1 -1
  73. package/dist/esm/ComponentName.js +4 -0
  74. package/dist/esm/ComponentName.js.map +1 -1
  75. package/dist/esm/defaultBlueprint.js +1 -1
  76. package/dist/esm/defaultBlueprintComponentMetadata.js +2 -2
  77. package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
  78. package/dist/esm/defaultBlueprintComponents.js +10 -2
  79. package/dist/esm/defaultBlueprintComponents.js.map +1 -1
  80. package/dist/esm/foundation/ChartWrapper.d.ts +5 -0
  81. package/dist/esm/foundation/ChartWrapper.d.ts.map +1 -0
  82. package/dist/esm/foundation/ChartWrapper.js +517 -0
  83. package/dist/esm/foundation/ChartWrapper.js.map +1 -0
  84. package/dist/esm/foundation/ColumnChooser.d.ts +3 -0
  85. package/dist/esm/foundation/ColumnChooser.d.ts.map +1 -0
  86. package/dist/esm/foundation/ColumnChooser.js +154 -0
  87. package/dist/esm/foundation/ColumnChooser.js.map +1 -0
  88. package/dist/esm/foundation/FilterBuilder.d.ts +3 -0
  89. package/dist/esm/foundation/FilterBuilder.d.ts.map +1 -0
  90. package/dist/esm/foundation/FilterBuilder.js +305 -0
  91. package/dist/esm/foundation/FilterBuilder.js.map +1 -0
  92. package/dist/esm/foundation/Foundation.stories.d.ts +16 -0
  93. package/dist/esm/foundation/Foundation.stories.d.ts.map +1 -1
  94. package/dist/esm/foundation/Foundation.stories.js +16 -0
  95. package/dist/esm/foundation/Foundation.stories.js.map +1 -1
  96. package/dist/esm/foundation/SavedViewsMenu.d.ts +4 -0
  97. package/dist/esm/foundation/SavedViewsMenu.d.ts.map +1 -0
  98. package/dist/esm/foundation/SavedViewsMenu.js +196 -0
  99. package/dist/esm/foundation/SavedViewsMenu.js.map +1 -0
  100. package/dist/esm/foundation/chartGeometry.d.ts +34 -0
  101. package/dist/esm/foundation/chartGeometry.d.ts.map +1 -0
  102. package/dist/esm/foundation/chartGeometry.js +93 -0
  103. package/dist/esm/foundation/chartGeometry.js.map +1 -0
  104. package/dist/esm/foundation/columnModel.d.ts +11 -0
  105. package/dist/esm/foundation/columnModel.d.ts.map +1 -0
  106. package/dist/esm/foundation/columnModel.js +38 -0
  107. package/dist/esm/foundation/columnModel.js.map +1 -0
  108. package/dist/esm/foundation/filterModel.d.ts +33 -0
  109. package/dist/esm/foundation/filterModel.d.ts.map +1 -0
  110. package/dist/esm/foundation/filterModel.js +112 -0
  111. package/dist/esm/foundation/filterModel.js.map +1 -0
  112. package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
  113. package/dist/esm/foundation/foundationComponentMetadata.js +28 -0
  114. package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -1
  115. package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -1
  116. package/dist/esm/foundation/foundationDescriptors.js +154 -1
  117. package/dist/esm/foundation/foundationDescriptors.js.map +1 -1
  118. package/dist/esm/foundation/foundationSamples.d.ts.map +1 -1
  119. package/dist/esm/foundation/foundationSamples.js +130 -0
  120. package/dist/esm/foundation/foundationSamples.js.map +1 -1
  121. package/dist/esm/foundation/foundationStrings.d.ts +25 -0
  122. package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
  123. package/dist/esm/foundation/foundationStrings.js +25 -0
  124. package/dist/esm/foundation/foundationStrings.js.map +1 -1
  125. package/dist/esm/foundation/index.d.ts +9 -0
  126. package/dist/esm/foundation/index.d.ts.map +1 -1
  127. package/dist/esm/foundation/index.js +9 -0
  128. package/dist/esm/foundation/index.js.map +1 -1
  129. package/dist/esm/foundation/useElementWidth.d.ts +3 -0
  130. package/dist/esm/foundation/useElementWidth.d.ts.map +1 -0
  131. package/dist/esm/foundation/useElementWidth.js +29 -0
  132. package/dist/esm/foundation/useElementWidth.js.map +1 -0
  133. package/dist/esm/foundation/viewModel.d.ts +7 -0
  134. package/dist/esm/foundation/viewModel.d.ts.map +1 -0
  135. package/dist/esm/foundation/viewModel.js +22 -0
  136. package/dist/esm/foundation/viewModel.js.map +1 -0
  137. package/dist/esm/index.d.ts +1 -0
  138. package/dist/esm/index.d.ts.map +1 -1
  139. package/dist/esm/index.js +26 -0
  140. package/dist/esm/index.js.map +1 -1
  141. package/dist/esm/preview-host/ApplicationDocument.d.ts +7 -0
  142. package/dist/esm/preview-host/ApplicationDocument.d.ts.map +1 -0
  143. package/dist/esm/preview-host/ApplicationDocument.js +15 -0
  144. package/dist/esm/preview-host/ApplicationDocument.js.map +1 -0
  145. package/dist/esm/preview-host/ApplicationHost.d.ts +21 -0
  146. package/dist/esm/preview-host/ApplicationHost.d.ts.map +1 -0
  147. package/dist/esm/preview-host/ApplicationHost.js +111 -0
  148. package/dist/esm/preview-host/ApplicationHost.js.map +1 -0
  149. package/dist/esm/preview-host/FlowArrangementView.d.ts +7 -0
  150. package/dist/esm/preview-host/FlowArrangementView.d.ts.map +1 -0
  151. package/dist/esm/preview-host/FlowArrangementView.js +73 -0
  152. package/dist/esm/preview-host/FlowArrangementView.js.map +1 -0
  153. package/dist/esm/preview-host/PreviewProblem.d.ts +26 -0
  154. package/dist/esm/preview-host/PreviewProblem.d.ts.map +1 -0
  155. package/dist/esm/preview-host/PreviewProblem.js +28 -0
  156. package/dist/esm/preview-host/PreviewProblem.js.map +1 -0
  157. package/dist/esm/preview-host/PreviewProblemsView.d.ts +7 -0
  158. package/dist/esm/preview-host/PreviewProblemsView.d.ts.map +1 -0
  159. package/dist/esm/preview-host/PreviewProblemsView.js +49 -0
  160. package/dist/esm/preview-host/PreviewProblemsView.js.map +1 -0
  161. package/dist/esm/preview-host/PreviewSliceFragment.d.ts +3 -0
  162. package/dist/esm/preview-host/PreviewSliceFragment.d.ts.map +1 -0
  163. package/dist/esm/preview-host/PreviewSliceFragment.js +53 -0
  164. package/dist/esm/preview-host/PreviewSliceFragment.js.map +1 -0
  165. package/dist/esm/preview-host/PreviewTarget.d.ts +10 -0
  166. package/dist/esm/preview-host/PreviewTarget.d.ts.map +1 -0
  167. package/dist/esm/preview-host/PreviewTarget.js +15 -0
  168. package/dist/esm/preview-host/PreviewTarget.js.map +1 -0
  169. package/dist/esm/preview-host/PreviewTemplate.d.ts +5 -0
  170. package/dist/esm/preview-host/PreviewTemplate.d.ts.map +1 -0
  171. package/dist/esm/preview-host/PreviewTemplate.js +45 -0
  172. package/dist/esm/preview-host/PreviewTemplate.js.map +1 -0
  173. package/dist/esm/preview-host/PreviewToast.d.ts +10 -0
  174. package/dist/esm/preview-host/PreviewToast.d.ts.map +1 -0
  175. package/dist/esm/preview-host/PreviewToast.js +43 -0
  176. package/dist/esm/preview-host/PreviewToast.js.map +1 -0
  177. package/dist/esm/preview-host/ScenePreviewHost.d.ts +32 -0
  178. package/dist/esm/preview-host/ScenePreviewHost.d.ts.map +1 -0
  179. package/dist/esm/preview-host/ScenePreviewHost.js +288 -0
  180. package/dist/esm/preview-host/ScenePreviewHost.js.map +1 -0
  181. package/dist/esm/preview-host/composeApplication.d.ts +34 -0
  182. package/dist/esm/preview-host/composeApplication.d.ts.map +1 -0
  183. package/dist/esm/preview-host/composeApplication.js +239 -0
  184. package/dist/esm/preview-host/composeApplication.js.map +1 -0
  185. package/dist/esm/preview-host/defaultApplicationChrome.d.ts +4 -0
  186. package/dist/esm/preview-host/defaultApplicationChrome.d.ts.map +1 -0
  187. package/dist/esm/preview-host/defaultApplicationChrome.js +41 -0
  188. package/dist/esm/preview-host/defaultApplicationChrome.js.map +1 -0
  189. package/dist/esm/preview-host/diagnosePreview.d.ts +22 -0
  190. package/dist/esm/preview-host/diagnosePreview.d.ts.map +1 -0
  191. package/dist/esm/preview-host/diagnosePreview.js +98 -0
  192. package/dist/esm/preview-host/diagnosePreview.js.map +1 -0
  193. package/dist/esm/preview-host/index.d.ts +18 -0
  194. package/dist/esm/preview-host/index.d.ts.map +1 -0
  195. package/dist/esm/preview-host/index.js +18 -0
  196. package/dist/esm/preview-host/index.js.map +1 -0
  197. package/dist/esm/preview-host/previewProfile.d.ts +6 -0
  198. package/dist/esm/preview-host/previewProfile.d.ts.map +1 -0
  199. package/dist/esm/preview-host/previewProfile.js +49 -0
  200. package/dist/esm/preview-host/previewProfile.js.map +1 -0
  201. package/dist/esm/preview-host/previewSampleData.d.ts +22 -0
  202. package/dist/esm/preview-host/previewSampleData.d.ts.map +1 -0
  203. package/dist/esm/preview-host/previewSampleData.js +113 -0
  204. package/dist/esm/preview-host/previewSampleData.js.map +1 -0
  205. package/dist/esm/preview-host/resolvePreviewPlan.d.ts +18 -0
  206. package/dist/esm/preview-host/resolvePreviewPlan.d.ts.map +1 -0
  207. package/dist/esm/preview-host/resolvePreviewPlan.js +124 -0
  208. package/dist/esm/preview-host/resolvePreviewPlan.js.map +1 -0
  209. package/dist/esm/preview-host/useSizeClass.d.ts +3 -0
  210. package/dist/esm/preview-host/useSizeClass.d.ts.map +1 -0
  211. package/dist/esm/preview-host/useSizeClass.js +21 -0
  212. package/dist/esm/preview-host/useSizeClass.js.map +1 -0
  213. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  214. package/foundation/ChartWrapper.tsx +252 -0
  215. package/foundation/ColumnChooser.tsx +73 -0
  216. package/foundation/FilterBuilder.tsx +144 -0
  217. package/foundation/Foundation.stories.tsx +16 -0
  218. package/foundation/SavedViewsMenu.tsx +94 -0
  219. package/foundation/chartGeometry.ts +108 -0
  220. package/foundation/columnModel.ts +39 -0
  221. package/foundation/filterModel.ts +111 -0
  222. package/foundation/foundationComponentMetadata.ts +4 -0
  223. package/foundation/foundationDescriptors.ts +86 -1
  224. package/foundation/foundationSamples.ts +19 -0
  225. package/foundation/foundationStrings.ts +25 -0
  226. package/foundation/index.ts +9 -0
  227. package/foundation/useElementWidth.ts +31 -0
  228. package/foundation/viewModel.ts +21 -0
  229. package/index.ts +1 -0
  230. package/package.json +8 -8
  231. package/preview-host/ApplicationDocument.ts +31 -0
  232. package/preview-host/ApplicationHost.tsx +114 -0
  233. package/preview-host/FlowArrangementView.tsx +59 -0
  234. package/preview-host/PreviewProblem.ts +68 -0
  235. package/preview-host/PreviewProblemsView.tsx +31 -0
  236. package/preview-host/PreviewSliceFragment.ts +43 -0
  237. package/preview-host/PreviewTarget.ts +19 -0
  238. package/preview-host/PreviewTemplate.tsx +45 -0
  239. package/preview-host/PreviewToast.tsx +32 -0
  240. package/preview-host/ScenePreviewHost.tsx +250 -0
  241. package/preview-host/composeApplication.ts +273 -0
  242. package/preview-host/defaultApplicationChrome.ts +33 -0
  243. package/preview-host/diagnosePreview.ts +132 -0
  244. package/preview-host/index.ts +20 -0
  245. package/preview-host/previewProfile.ts +47 -0
  246. package/preview-host/previewSampleData.ts +144 -0
  247. package/preview-host/resolvePreviewPlan.ts +100 -0
  248. package/preview-host/useSizeClass.ts +23 -0
  249. package/shell/layout.css +307 -0
@@ -0,0 +1,28 @@
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
+ /** Why a preview could not be rendered, or rendered with a caveat. */ var PreviewProblemCode = /*#__PURE__*/ function(PreviewProblemCode) {
4
+ /** The module, feature or slice the preview was asked for is not in the application structure. */ PreviewProblemCode["TargetNotFound"] = "targetNotFound";
5
+ /** The module has no feature to show. */ PreviewProblemCode["ModuleWithoutFeatures"] = "moduleWithoutFeatures";
6
+ /** The feature the preview shows has no screen in the document. */ PreviewProblemCode["ScreenMissing"] = "screenMissing";
7
+ /** The slice is neither a State Change nor a State View, so there is nothing to preview. */ PreviewProblemCode["SliceNotPreviewable"] = "sliceNotPreviewable";
8
+ /** A State View slice's data fragment was not found, so its feature's page is shown. */ PreviewProblemCode["SliceFragmentMissing"] = "sliceFragmentMissing";
9
+ /** The layout a screen names is neither in the document nor one the blueprint provides. */ PreviewProblemCode["LayoutMissing"] = "layoutMissing";
10
+ /** The screen template a screen names is neither in the document nor one the blueprint provides. */ PreviewProblemCode["TemplateMissing"] = "templateMissing";
11
+ /** A template found no single home in the layout, or nests inside itself. */ PreviewProblemCode["TemplateUnplaced"] = "templateUnplaced";
12
+ /** The application structure has a duplicate or ambiguous id. */ PreviewProblemCode["StructureInvalid"] = "structureInvalid";
13
+ /** A navigation item leads nowhere or collides with another (the engine's navigation diagnostics). */ PreviewProblemCode["NavigationInvalid"] = "navigationInvalid";
14
+ /** A toolbar button's slice does not exist, is not a State Change or is empty (the engine's toolbar diagnostics). */ PreviewProblemCode["ToolbarInvalid"] = "toolbarInvalid";
15
+ /** The profile's sample data selection names a pack or set that does not exist. */ PreviewProblemCode["SampleDataInvalid"] = "sampleDataInvalid";
16
+ return PreviewProblemCode;
17
+ }({});
18
+ /** How a problem affects the preview. */ var PreviewProblemSeverity = /*#__PURE__*/ function(PreviewProblemSeverity) {
19
+ /** The preview cannot show what was asked for; the problems are shown instead of a blank screen. */ PreviewProblemSeverity["Error"] = "error";
20
+ /** The preview renders, but something in the model will not behave as authored. */ PreviewProblemSeverity["Warning"] = "warning";
21
+ return PreviewProblemSeverity;
22
+ }({});
23
+ /** Whether any of the problems stops the preview from rendering. */ function hasBlockingProblem(problems) {
24
+ return problems.some((problem)=>problem.severity === "error");
25
+ }
26
+
27
+ export { PreviewProblemCode, PreviewProblemSeverity, hasBlockingProblem };
28
+ //# sourceMappingURL=PreviewProblem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewProblem.js","sources":["../../../preview-host/PreviewProblem.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** Why a preview could not be rendered, or rendered with a caveat. */\nexport enum PreviewProblemCode {\n /** The module, feature or slice the preview was asked for is not in the application structure. */\n TargetNotFound = 'targetNotFound',\n\n /** The module has no feature to show. */\n ModuleWithoutFeatures = 'moduleWithoutFeatures',\n\n /** The feature the preview shows has no screen in the document. */\n ScreenMissing = 'screenMissing',\n\n /** The slice is neither a State Change nor a State View, so there is nothing to preview. */\n SliceNotPreviewable = 'sliceNotPreviewable',\n\n /** A State View slice's data fragment was not found, so its feature's page is shown. */\n SliceFragmentMissing = 'sliceFragmentMissing',\n\n /** The layout a screen names is neither in the document nor one the blueprint provides. */\n LayoutMissing = 'layoutMissing',\n\n /** The screen template a screen names is neither in the document nor one the blueprint provides. */\n TemplateMissing = 'templateMissing',\n\n /** A template found no single home in the layout, or nests inside itself. */\n TemplateUnplaced = 'templateUnplaced',\n\n /** The application structure has a duplicate or ambiguous id. */\n StructureInvalid = 'structureInvalid',\n\n /** A navigation item leads nowhere or collides with another (the engine's navigation diagnostics). */\n NavigationInvalid = 'navigationInvalid',\n\n /** A toolbar button's slice does not exist, is not a State Change or is empty (the engine's toolbar diagnostics). */\n ToolbarInvalid = 'toolbarInvalid',\n\n /** The profile's sample data selection names a pack or set that does not exist. */\n SampleDataInvalid = 'sampleDataInvalid',\n}\n\n/** How a problem affects the preview. */\nexport enum PreviewProblemSeverity {\n /** The preview cannot show what was asked for; the problems are shown instead of a blank screen. */\n Error = 'error',\n\n /** The preview renders, but something in the model will not behave as authored. */\n Warning = 'warning',\n}\n\n/**\n * One problem the preview found (PRV8): what it is, where, and a sentence an author can act on. The node id is what a host\n * links to - a screen, a template, a navigation item, a toolbar button, a module, feature or slice.\n */\nexport interface PreviewProblem {\n code: PreviewProblemCode;\n severity: PreviewProblemSeverity;\n message: string;\n\n /** The model node the problem is about, when it has one. */\n nodeId?: string;\n}\n\n/** Whether any of the problems stops the preview from rendering. */\nexport function hasBlockingProblem(problems: PreviewProblem[]): boolean {\n return problems.some(problem => problem.severity === PreviewProblemSeverity.Error);\n}\n"],"names":["PreviewProblemCode","PreviewProblemSeverity","hasBlockingProblem","problems","some","problem","severity"],"mappings":"AAAA;AACA;AAEA,uEACO,IAAKA,kBAAAA,iBAAAA,SAAAA,kBAAAA,EAAAA;uGACwF,kBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;8CAGzD,kBAAA,CAAA,uBAAA,CAAA,GAAA,uBAAA;wEAG0B,kBAAA,CAAA,eAAA,CAAA,GAAA,eAAA;iGAGyB,kBAAA,CAAA,qBAAA,CAAA,GAAA,qBAAA;6FAGJ,kBAAA,CAAA,sBAAA,CAAA,GAAA,sBAAA;gGAGG,kBAAA,CAAA,eAAA,CAAA,GAAA,eAAA;yGAGS,kBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAA;kFAGvB,kBAAA,CAAA,kBAAA,CAAA,GAAA,kBAAA;sEAGZ,kBAAA,CAAA,kBAAA,CAAA,GAAA,kBAAA;2GAGqC,kBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAA;0HAGe,kBAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;wFAGlC,kBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAA;AAlCzEA,IAAAA,OAAAA,kBAAAA;AAoCX,CAAA,CAAA,EAAA;AAED,0CACO,IAAKC,sBAAAA,iBAAAA,SAAAA,sBAAAA,EAAAA;yGAC0F,sBAAA,CAAA,OAAA,CAAA,GAAA,OAAA;wFAGjB,sBAAA,CAAA,SAAA,CAAA,GAAA,SAAA;AAJzEA,IAAAA,OAAAA,sBAAAA;AAMX,CAAA,CAAA,EAAA;AAeD,qEACO,SAASC,kBAAAA,CAAmBC,QAA0B,EAAA;AACzD,IAAA,OAAOA,SAASC,IAAI,CAACC,CAAAA,OAAAA,GAAWA,QAAQC,QAAQ,KAAA,OAAA,CAAA;AACpD;;"}
@@ -0,0 +1,7 @@
1
+ import { PreviewProblem } from './PreviewProblem';
2
+ export interface PreviewProblemsViewProps {
3
+ problems: PreviewProblem[];
4
+ onSelectProblem?(problem: PreviewProblem): void;
5
+ }
6
+ export declare function PreviewProblemsView({ problems, onSelectProblem }: PreviewProblemsViewProps): import("react").JSX.Element;
7
+ //# sourceMappingURL=PreviewProblemsView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewProblemsView.d.ts","sourceRoot":"","sources":["../../../preview-host/PreviewProblemsView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACrC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAG3B,eAAe,CAAC,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;CACnD;AAMD,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,wBAAwB,+BAc1F"}
@@ -0,0 +1,49 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
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
+ * What a preview shows instead of a blank screen when the model has errors that would break rendering (PRV8): each problem
7
+ * with its code, its message and a link to the offending node.
8
+ */ function PreviewProblemsView({ problems, onSelectProblem }) {
9
+ return /*#__PURE__*/ jsxs("section", {
10
+ className: "scene-preview-problems",
11
+ role: "alert",
12
+ "data-scene-preview-problems": true,
13
+ children: [
14
+ /*#__PURE__*/ jsx("h2", {
15
+ children: "This preview cannot be shown"
16
+ }),
17
+ /*#__PURE__*/ jsx("ul", {
18
+ children: problems.map((problem, index)=>/*#__PURE__*/ jsxs("li", {
19
+ "data-severity": problem.severity,
20
+ "data-code": problem.code,
21
+ "data-node-id": problem.nodeId,
22
+ children: [
23
+ /*#__PURE__*/ jsx("code", {
24
+ children: problem.code
25
+ }),
26
+ " ",
27
+ problem.message,
28
+ problem.nodeId !== undefined && onSelectProblem && /*#__PURE__*/ jsxs(Fragment, {
29
+ children: [
30
+ " ",
31
+ /*#__PURE__*/ jsxs("button", {
32
+ type: "button",
33
+ onClick: ()=>onSelectProblem(problem),
34
+ children: [
35
+ "Show ",
36
+ problem.nodeId
37
+ ]
38
+ })
39
+ ]
40
+ })
41
+ ]
42
+ }, `${problem.code}-${problem.nodeId ?? index}-${index}`))
43
+ })
44
+ ]
45
+ });
46
+ }
47
+
48
+ export { PreviewProblemsView };
49
+ //# sourceMappingURL=PreviewProblemsView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewProblemsView.js","sources":["../../../preview-host/PreviewProblemsView.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PreviewProblem } from './PreviewProblem';\n\nexport interface PreviewProblemsViewProps {\n problems: PreviewProblem[];\n\n /** Called when the author follows a problem to the node it is about. */\n onSelectProblem?(problem: PreviewProblem): void;\n}\n\n/**\n * What a preview shows instead of a blank screen when the model has errors that would break rendering (PRV8): each problem\n * with its code, its message and a link to the offending node.\n */\nexport function PreviewProblemsView({ problems, onSelectProblem }: PreviewProblemsViewProps) {\n return (\n <section className='scene-preview-problems' role='alert' data-scene-preview-problems>\n <h2>This preview cannot be shown</h2>\n <ul>\n {problems.map((problem, index) => (\n <li key={`${problem.code}-${problem.nodeId ?? index}-${index}`} data-severity={problem.severity} data-code={problem.code} data-node-id={problem.nodeId}>\n <code>{problem.code}</code> {problem.message}\n {problem.nodeId !== undefined && onSelectProblem && <> <button type='button' onClick={() => onSelectProblem(problem)}>Show {problem.nodeId}</button></>}\n </li>\n ))}\n </ul>\n </section>\n );\n}\n"],"names":["PreviewProblemsView","problems","onSelectProblem","_jsxs","section","className","role","data-scene-preview-problems","_jsx","h2","ul","map","problem","index","li","data-severity","severity","data-code","code","data-node-id","nodeId","message","undefined","_Fragment","button","type","onClick"],"mappings":";;AAAA;AACA;AAWA;;;AAGC,IACM,SAASA,mBAAAA,CAAoB,EAAEC,QAAQ,EAAEC,eAAe,EAA4B,EAAA;AACvF,IAAA,qBACIC,IAAA,CAACC,SAAAA,EAAAA;QAAQC,SAAAA,EAAU,wBAAA;QAAyBC,IAAAA,EAAK,OAAA;QAAQC,6BAA2B,EAAA,IAAA;;0BAChFC,GAAA,CAACC,IAAAA,EAAAA;AAAG,gBAAA,QAAA,EAAA;;0BACJD,GAAA,CAACE,IAAAA,EAAAA;AACIT,gBAAAA,QAAAA,EAAAA,QAAAA,CAASU,GAAG,CAAC,CAACC,OAAAA,EAASC,sBACpBV,IAAA,CAACW,IAAAA,EAAAA;AAA+DC,wBAAAA,eAAAA,EAAeH,QAAQI,QAAQ;AAAEC,wBAAAA,WAAAA,EAAWL,QAAQM,IAAI;AAAEC,wBAAAA,cAAAA,EAAcP,QAAQQ,MAAM;;0CAClJZ,GAAA,CAACU,MAAAA,EAAAA;AAAMN,gCAAAA,QAAAA,EAAAA,OAAAA,CAAQM;;AAAY,4BAAA,GAAA;AAAEN,4BAAAA,OAAAA,CAAQS,OAAO;4BAC3CT,OAAAA,CAAQQ,MAAM,KAAKE,SAAAA,IAAapB,eAAAA,kBAAmBC,IAAA,CAAAoB,QAAA,EAAA;;AAAE,oCAAA,GAAA;kDAACpB,IAAA,CAACqB,QAAAA,EAAAA;wCAAOC,IAAAA,EAAK,QAAA;AAASC,wCAAAA,OAAAA,EAAS,IAAMxB,eAAAA,CAAgBU,OAAAA,CAAAA;;AAAU,4CAAA,OAAA;AAAMA,4CAAAA,OAAAA,CAAQQ;;;;;;uBAF/H,CAAA,EAAGR,OAAAA,CAAQM,IAAI,CAAC,CAAC,EAAEN,OAAAA,CAAQQ,MAAM,IAAIP,KAAAA,CAAM,CAAC,EAAEA,KAAAA,CAAAA,CAAO,CAAA;;;;AAQlF;;"}
@@ -0,0 +1,3 @@
1
+ import { SceneElement, Screen, SliceNode } from '@cratis/scene.model';
2
+ export declare function findSliceFragment(screen: Screen, sliceId: string, slice: SliceNode): SceneElement[];
3
+ //# sourceMappingURL=PreviewSliceFragment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewSliceFragment.d.ts","sourceRoot":"","sources":["../../../preview-host/PreviewSliceFragment.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAyBzF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY,EAAE,CAcnG"}
@@ -0,0 +1,53 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ function matches(element, names) {
4
+ const properties = element.properties;
5
+ return [
6
+ 'query',
7
+ 'readModel',
8
+ 'slice'
9
+ ].some((key)=>{
10
+ const value = properties?.[key];
11
+ return typeof value === 'string' && (names.has(value) || names.has(value.slice(value.lastIndexOf('.') + 1)));
12
+ });
13
+ }
14
+ function childrenOf(element) {
15
+ const node = element;
16
+ return [
17
+ ...Object.values(node.slots ?? {}).flat(),
18
+ ...Array.isArray(node.children) ? node.children : [],
19
+ ...node.content ? [
20
+ node.content
21
+ ] : [],
22
+ ...node.itemTemplate ? [
23
+ node.itemTemplate
24
+ ] : []
25
+ ];
26
+ }
27
+ /**
28
+ * The data fragment of a State View slice (PRV3): the outermost components of the slice's screen bound to the slice's read model
29
+ * or query - by the slice's qualified id, its id, its name or its command - each with everything inside it. Empty when the screen
30
+ * has nothing bound to it.
31
+ */ function findSliceFragment(screen, sliceId, slice) {
32
+ const names = new Set([
33
+ sliceId,
34
+ slice.id,
35
+ slice.name,
36
+ ...slice.command ? [
37
+ slice.command
38
+ ] : []
39
+ ]);
40
+ const found = [];
41
+ const visit = (element)=>{
42
+ if (element.componentName !== undefined && matches(element, names)) {
43
+ found.push(element);
44
+ return;
45
+ }
46
+ childrenOf(element).forEach(visit);
47
+ };
48
+ Object.values(screen.slotContent).flat().forEach(visit);
49
+ return found;
50
+ }
51
+
52
+ export { findSliceFragment };
53
+ //# sourceMappingURL=PreviewSliceFragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewSliceFragment.js","sources":["../../../preview-host/PreviewSliceFragment.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 { ExternalComponent, SceneElement, Screen, SliceNode } from '@cratis/scene.model';\n\nfunction matches(element: ExternalComponent, names: Set<string>): boolean {\n const properties = element.properties as Record<string, unknown> | undefined;\n return ['query', 'readModel', 'slice'].some(key => {\n const value = properties?.[key];\n return typeof value === 'string' && (names.has(value) || names.has(value.slice(value.lastIndexOf('.') + 1)));\n });\n}\n\nfunction childrenOf(element: SceneElement): SceneElement[] {\n const node = element as { slots?: Record<string, SceneElement[]>; children?: SceneElement[]; content?: SceneElement; itemTemplate?: SceneElement };\n return [\n ...Object.values(node.slots ?? {}).flat(),\n ...(Array.isArray(node.children) ? node.children : []),\n ...(node.content ? [node.content] : []),\n ...(node.itemTemplate ? [node.itemTemplate] : []),\n ];\n}\n\n/**\n * The data fragment of a State View slice (PRV3): the outermost components of the slice's screen bound to the slice's read model\n * or query - by the slice's qualified id, its id, its name or its command - each with everything inside it. Empty when the screen\n * has nothing bound to it.\n */\nexport function findSliceFragment(screen: Screen, sliceId: string, slice: SliceNode): SceneElement[] {\n const names = new Set([sliceId, slice.id, slice.name, ...(slice.command ? [slice.command] : [])]);\n const found: SceneElement[] = [];\n const visit = (element: SceneElement) => {\n if ((element as ExternalComponent).componentName !== undefined && matches(element as ExternalComponent, names)) {\n found.push(element);\n return;\n }\n\n childrenOf(element).forEach(visit);\n };\n\n Object.values(screen.slotContent).flat().forEach(visit);\n return found;\n}\n"],"names":["matches","element","names","properties","some","key","value","has","slice","lastIndexOf","childrenOf","node","Object","values","slots","flat","Array","isArray","children","content","itemTemplate","findSliceFragment","screen","sliceId","Set","id","name","command","found","visit","componentName","undefined","push","forEach","slotContent"],"mappings":"AAAA;AACA;AAIA,SAASA,OAAAA,CAAQC,OAA0B,EAAEC,KAAkB,EAAA;IAC3D,MAAMC,UAAAA,GAAaF,QAAQE,UAAU;IACrC,OAAO;AAAC,QAAA,OAAA;AAAS,QAAA,WAAA;AAAa,QAAA;KAAQ,CAACC,IAAI,CAACC,CAAAA,GAAAA,GAAAA;QACxC,MAAMC,KAAAA,GAAQH,UAAAA,GAAaE,GAAAA,CAAI;AAC/B,QAAA,OAAO,OAAOC,KAAAA,KAAU,QAAA,KAAaJ,KAAAA,CAAMK,GAAG,CAACD,KAAAA,CAAAA,IAAUJ,KAAAA,CAAMK,GAAG,CAACD,MAAME,KAAK,CAACF,MAAMG,WAAW,CAAC,OAAO,CAAA,CAAA,CAAE,CAAA;AAC9G,IAAA,CAAA,CAAA;AACJ;AAEA,SAASC,WAAWT,OAAqB,EAAA;AACrC,IAAA,MAAMU,IAAAA,GAAOV,OAAAA;IACb,OAAO;AACAW,QAAAA,GAAAA,MAAAA,CAAOC,MAAM,CAACF,IAAAA,CAAKG,KAAK,IAAI,IAAIC,IAAI,EAAA;WACnCC,KAAAA,CAAMC,OAAO,CAACN,IAAAA,CAAKO,QAAQ,IAAIP,IAAAA,CAAKO,QAAQ,GAAG,EAAE;AACjDP,QAAAA,GAAAA,IAAAA,CAAKQ,OAAO,GAAG;AAACR,YAAAA,IAAAA,CAAKQ;AAAQ,SAAA,GAAG,EAAE;AAClCR,QAAAA,GAAAA,IAAAA,CAAKS,YAAY,GAAG;AAACT,YAAAA,IAAAA,CAAKS;AAAa,SAAA,GAAG;AACjD,KAAA;AACL;AAEA;;;;AAIC,IACM,SAASC,iBAAAA,CAAkBC,MAAc,EAAEC,OAAe,EAAEf,KAAgB,EAAA;IAC/E,MAAMN,KAAAA,GAAQ,IAAIsB,GAAAA,CAAI;AAACD,QAAAA,OAAAA;AAASf,QAAAA,KAAAA,CAAMiB,EAAE;AAAEjB,QAAAA,KAAAA,CAAMkB,IAAI;AAAMlB,QAAAA,GAAAA,KAAAA,CAAMmB,OAAO,GAAG;AAACnB,YAAAA,KAAAA,CAAMmB;AAAQ,SAAA,GAAG;AAAI,KAAA,CAAA;AAChG,IAAA,MAAMC,QAAwB,EAAE;AAChC,IAAA,MAAMC,QAAQ,CAAC5B,OAAAA,GAAAA;AACX,QAAA,IAAI,OAACA,CAA8B6B,aAAa,KAAKC,SAAAA,IAAa/B,OAAAA,CAAQC,SAA8BC,KAAAA,CAAAA,EAAQ;AAC5G0B,YAAAA,KAAAA,CAAMI,IAAI,CAAC/B,OAAAA,CAAAA;AACX,YAAA;AACJ,QAAA;QAEAS,UAAAA,CAAWT,OAAAA,CAAAA,CAASgC,OAAO,CAACJ,KAAAA,CAAAA;AAChC,IAAA,CAAA;IAEAjB,MAAAA,CAAOC,MAAM,CAACS,MAAAA,CAAOY,WAAW,EAAEnB,IAAI,EAAA,CAAGkB,OAAO,CAACJ,KAAAA,CAAAA;IACjD,OAAOD,KAAAA;AACX;;"}
@@ -0,0 +1,10 @@
1
+ export type PreviewTarget = {
2
+ module: string;
3
+ feature?: string;
4
+ } | {
5
+ slice: string;
6
+ };
7
+ export declare function isSliceTarget(target: PreviewTarget): target is {
8
+ slice: string;
9
+ };
10
+ //# sourceMappingURL=PreviewTarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewTarget.d.ts","sourceRoot":"","sources":["../../../preview-host/PreviewTarget.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,aAAa,GACnB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAGxB,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,IAAI;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAEhF"}
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ /**
4
+ * What a preview shows (spec PRV1/PRV3): a module - the application shell with the module's effective navigation and its
5
+ * first feature -, one of its features - the same shell with that feature - or a slice. Ids are the qualified ids of the
6
+ * application structure: `sales`, `sales.orders`, `sales.orders.PlaceOrder`. A feature may also be given relative to its module
7
+ * (`orders`).
8
+ *
9
+ * A State Change slice opens its dialog over a minimal host page; a State View slice renders its data fragment.
10
+ */ /** Whether a target names a slice. */ function isSliceTarget(target) {
11
+ return 'slice' in target;
12
+ }
13
+
14
+ export { isSliceTarget };
15
+ //# sourceMappingURL=PreviewTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewTarget.js","sources":["../../../preview-host/PreviewTarget.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * What a preview shows (spec PRV1/PRV3): a module - the application shell with the module's effective navigation and its\n * first feature -, one of its features - the same shell with that feature - or a slice. Ids are the qualified ids of the\n * application structure: `sales`, `sales.orders`, `sales.orders.PlaceOrder`. A feature may also be given relative to its module\n * (`orders`).\n *\n * A State Change slice opens its dialog over a minimal host page; a State View slice renders its data fragment.\n */\nexport type PreviewTarget =\n | { module: string; feature?: string }\n | { slice: string };\n\n/** Whether a target names a slice. */\nexport function isSliceTarget(target: PreviewTarget): target is { slice: string } {\n return 'slice' in target;\n}\n"],"names":["isSliceTarget","target"],"mappings":"AAAA;AACA;AAEA;;;;;;;AAOC,2CAMM,SAASA,cAAcC,MAAqB,EAAA;AAC/C,IAAA,OAAO,OAAA,IAAWA,MAAAA;AACtB;;"}
@@ -0,0 +1,5 @@
1
+ import type { ComponentRegistry, RegisteredComponentProps } from '@cratis/scene.react';
2
+ export declare const previewTemplateComponent = "Scene:template";
3
+ export declare function PreviewTemplate({ element, slots }: RegisteredComponentProps): import("react").JSX.Element;
4
+ export declare const previewComponents: ComponentRegistry;
5
+ //# sourceMappingURL=PreviewTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewTemplate.d.ts","sourceRoot":"","sources":["../../../preview-host/PreviewTemplate.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAKvF,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAazD,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,wBAAwB,+BAe3E;AAGD,eAAO,MAAM,iBAAiB,EAAE,iBAE/B,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { evaluateFlowArrangement } from '@cratis/scene.engine';
3
+ import { FlowArrangementView } from './FlowArrangementView.js';
4
+ import { useSizeClass } from './useSizeClass.js';
5
+
6
+ // Copyright (c) Cratis. All rights reserved.
7
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
8
+ /** The name the template wrapper is registered under. */ const previewTemplateComponent = 'Scene:template';
9
+ function isFlowArrangement(arrangement) {
10
+ return !!arrangement && typeof arrangement === 'object' && 'root' in arrangement;
11
+ }
12
+ /**
13
+ * A screen's content inside the screen template it names.
14
+ *
15
+ * The template's own `arrangement flow` positions its slots - header, body, aside - exactly as the document wrote it, evaluated
16
+ * for the window's current size class. A template with no flow arrangement stacks them. It sits inside the shell's content
17
+ * slot, so the shell, not this, owns the chrome around it. Stage and the preview host render templates with this one component.
18
+ */ function PreviewTemplate({ element, slots }) {
19
+ const sizeClass = useSizeClass();
20
+ const arrangement = element.properties?.arrangement;
21
+ const nodes = {};
22
+ for (const [name, content] of Object.entries(slots)){
23
+ nodes[name] = /*#__PURE__*/ jsx("section", {
24
+ className: "scene-template-slot",
25
+ "data-slot": name,
26
+ children: content
27
+ });
28
+ }
29
+ return /*#__PURE__*/ jsx("div", {
30
+ className: "scene-template",
31
+ "data-scene-id": element.id,
32
+ children: isFlowArrangement(arrangement) ? /*#__PURE__*/ jsx(FlowArrangementView, {
33
+ node: evaluateFlowArrangement(arrangement, sizeClass),
34
+ slots: nodes
35
+ }) : Object.entries(nodes).map(([name, node])=>/*#__PURE__*/ jsx("div", {
36
+ children: node
37
+ }, name))
38
+ });
39
+ }
40
+ /** The components the preview host and the Stage add to the registry for composed screens. */ const previewComponents = {
41
+ [previewTemplateComponent]: PreviewTemplate
42
+ };
43
+
44
+ export { PreviewTemplate, previewComponents, previewTemplateComponent };
45
+ //# sourceMappingURL=PreviewTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewTemplate.js","sources":["../../../preview-host/PreviewTemplate.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ReactNode } from 'react';\nimport type { FlowArrangement } from '@cratis/scene.model';\nimport { evaluateFlowArrangement } from '@cratis/scene.engine';\nimport type { ComponentRegistry, RegisteredComponentProps } from '@cratis/scene.react';\nimport { FlowArrangementView } from './FlowArrangementView';\nimport { useSizeClass } from './useSizeClass';\n\n/** The name the template wrapper is registered under. */\nexport const previewTemplateComponent = 'Scene:template';\n\nfunction isFlowArrangement(arrangement: unknown): arrangement is FlowArrangement {\n return !!arrangement && typeof arrangement === 'object' && 'root' in arrangement;\n}\n\n/**\n * A screen's content inside the screen template it names.\n *\n * The template's own `arrangement flow` positions its slots - header, body, aside - exactly as the document wrote it, evaluated\n * for the window's current size class. A template with no flow arrangement stacks them. It sits inside the shell's content\n * slot, so the shell, not this, owns the chrome around it. Stage and the preview host render templates with this one component.\n */\nexport function PreviewTemplate({ element, slots }: RegisteredComponentProps) {\n const sizeClass = useSizeClass();\n const arrangement = (element.properties as Record<string, unknown> | undefined)?.arrangement;\n const nodes: Record<string, ReactNode> = {};\n for (const [name, content] of Object.entries(slots)) {\n nodes[name] = <section className='scene-template-slot' data-slot={name}>{content}</section>;\n }\n\n return (\n <div className='scene-template' data-scene-id={element.id}>\n {isFlowArrangement(arrangement)\n ? <FlowArrangementView node={evaluateFlowArrangement(arrangement, sizeClass)} slots={nodes} />\n : Object.entries(nodes).map(([name, node]) => <div key={name}>{node}</div>)}\n </div>\n );\n}\n\n/** The components the preview host and the Stage add to the registry for composed screens. */\nexport const previewComponents: ComponentRegistry = {\n [previewTemplateComponent]: PreviewTemplate,\n};\n"],"names":["previewTemplateComponent","isFlowArrangement","arrangement","PreviewTemplate","element","slots","sizeClass","useSizeClass","properties","nodes","name","content","Object","entries","_jsx","section","className","data-slot","div","data-scene-id","id","FlowArrangementView","node","evaluateFlowArrangement","map","previewComponents"],"mappings":";;;;;AAAA;AACA;AASA,0DACO,MAAMA,wBAAAA,GAA2B;AAExC,SAASC,kBAAkBC,WAAoB,EAAA;AAC3C,IAAA,OAAO,CAAC,CAACA,WAAAA,IAAe,OAAOA,WAAAA,KAAgB,YAAY,MAAA,IAAUA,WAAAA;AACzE;AAEA;;;;;;AAMC,IACM,SAASC,eAAAA,CAAgB,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;AACxE,IAAA,MAAMC,SAAAA,GAAYC,YAAAA,EAAAA;IAClB,MAAML,WAAAA,GAAeE,OAAAA,CAAQI,UAAU,EAA0CN,WAAAA;AACjF,IAAA,MAAMO,QAAmC,EAAC;IAC1C,KAAK,MAAM,CAACC,IAAAA,EAAMC,OAAAA,CAAQ,IAAIC,MAAAA,CAAOC,OAAO,CAACR,KAAAA,CAAAA,CAAQ;QACjDI,KAAK,CAACC,IAAAA,CAAK,iBAAGI,GAAA,CAACC,SAAAA,EAAAA;YAAQC,SAAAA,EAAU,qBAAA;YAAsBC,WAAAA,EAAWP,IAAAA;AAAOC,YAAAA,QAAAA,EAAAA;;AAC7E,IAAA;AAEA,IAAA,qBACIG,GAAA,CAACI,KAAAA,EAAAA;QAAIF,SAAAA,EAAU,gBAAA;AAAiBG,QAAAA,eAAAA,EAAef,QAAQgB,EAAE;AACpDnB,QAAAA,QAAAA,EAAAA,iBAAAA,CAAkBC,6BACbY,GAAA,CAACO,mBAAAA,EAAAA;AAAoBC,YAAAA,IAAAA,EAAMC,wBAAwBrB,WAAAA,EAAaI,SAAAA,CAAAA;YAAYD,KAAAA,EAAOI;aACnFG,MAAAA,CAAOC,OAAO,CAACJ,KAAAA,CAAAA,CAAOe,GAAG,CAAC,CAAC,CAACd,IAAAA,EAAMY,IAAAA,CAAK,iBAAKR,GAAA,CAACI,KAAAA,EAAAA;AAAgBI,gBAAAA,QAAAA,EAAAA;AAAPZ,aAAAA,EAAAA,IAAAA,CAAAA;;AAGxE;AAEA,+FACO,MAAMe,iBAAAA,GAAuC;AAChD,IAAA,CAACzB,2BAA2BG;AAChC;;"}
@@ -0,0 +1,10 @@
1
+ export interface PreviewInvocation {
2
+ sliceId: string;
3
+ command?: string;
4
+ payload: Record<string, unknown>;
5
+ }
6
+ export declare function PreviewToast({ invocation, onDismiss }: {
7
+ invocation: PreviewInvocation;
8
+ onDismiss(): void;
9
+ }): import("react").JSX.Element;
10
+ //# sourceMappingURL=PreviewToast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewToast.d.ts","sourceRoot":"","sources":["../../../preview-host/PreviewToast.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAE9B,OAAO,EAAE,MAAM,CAAC;IAGhB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAMD,wBAAgB,YAAY,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE;IAAE,UAAU,EAAE,iBAAiB,CAAC;IAAC,SAAS,IAAI,IAAI,CAAA;CAAE,+BAY3G"}
@@ -0,0 +1,43 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * The toast that confirms a dry run: "Command would be sent", with the payload in an expandable detail. Nothing was sent to
7
+ * Chronicle or Arc.
8
+ */ function PreviewToast({ invocation, onDismiss }) {
9
+ return /*#__PURE__*/ jsxs("div", {
10
+ className: "scene-preview-toast",
11
+ role: "status",
12
+ "data-scene-preview-toast": true,
13
+ children: [
14
+ /*#__PURE__*/ jsx("strong", {
15
+ children: "Command would be sent"
16
+ }),
17
+ /*#__PURE__*/ jsxs("span", {
18
+ children: [
19
+ " · ",
20
+ invocation.command ?? invocation.sliceId
21
+ ]
22
+ }),
23
+ /*#__PURE__*/ jsxs("details", {
24
+ children: [
25
+ /*#__PURE__*/ jsx("summary", {
26
+ children: "Payload"
27
+ }),
28
+ /*#__PURE__*/ jsx("pre", {
29
+ children: JSON.stringify(invocation.payload, null, 2)
30
+ })
31
+ ]
32
+ }),
33
+ /*#__PURE__*/ jsx("button", {
34
+ type: "button",
35
+ onClick: onDismiss,
36
+ children: "Dismiss"
37
+ })
38
+ ]
39
+ });
40
+ }
41
+
42
+ export { PreviewToast };
43
+ //# sourceMappingURL=PreviewToast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewToast.js","sources":["../../../preview-host/PreviewToast.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** What a dry run reports (PRV5). */\nexport interface PreviewInvocation {\n /** The qualified id of the slice. */\n sliceId: string;\n\n /** The command the slice accepts, when known. */\n command?: string;\n\n /** The payload that would have been sent. */\n payload: Record<string, unknown>;\n}\n\n/**\n * The toast that confirms a dry run: \"Command would be sent\", with the payload in an expandable detail. Nothing was sent to\n * Chronicle or Arc.\n */\nexport function PreviewToast({ invocation, onDismiss }: { invocation: PreviewInvocation; onDismiss(): void }) {\n return (\n <div className='scene-preview-toast' role='status' data-scene-preview-toast>\n <strong>Command would be sent</strong>\n <span> · {invocation.command ?? invocation.sliceId}</span>\n <details>\n <summary>Payload</summary>\n <pre>{JSON.stringify(invocation.payload, null, 2)}</pre>\n </details>\n <button type='button' onClick={onDismiss}>Dismiss</button>\n </div>\n );\n}\n"],"names":["PreviewToast","invocation","onDismiss","_jsxs","div","className","role","data-scene-preview-toast","_jsx","strong","span","command","sliceId","details","summary","pre","JSON","stringify","payload","button","type","onClick"],"mappings":";;AAAA;AACA;AAcA;;;AAGC,IACM,SAASA,YAAAA,CAAa,EAAEC,UAAU,EAAEC,SAAS,EAAwD,EAAA;AACxG,IAAA,qBACIC,IAAA,CAACC,KAAAA,EAAAA;QAAIC,SAAAA,EAAU,qBAAA;QAAsBC,IAAAA,EAAK,QAAA;QAASC,0BAAwB,EAAA,IAAA;;0BACvEC,GAAA,CAACC,QAAAA,EAAAA;AAAO,gBAAA,QAAA,EAAA;;0BACRN,IAAA,CAACO,MAAAA,EAAAA;;AAAK,oBAAA,KAAA;oBAAIT,UAAAA,CAAWU,OAAO,IAAIV,UAAAA,CAAWW;;;0BAC3CT,IAAA,CAACU,SAAAA,EAAAA;;kCACGL,GAAA,CAACM,SAAAA,EAAAA;AAAQ,wBAAA,QAAA,EAAA;;kCACTN,GAAA,CAACO,KAAAA,EAAAA;AAAKC,wBAAAA,QAAAA,EAAAA,IAAAA,CAAKC,SAAS,CAAChB,UAAAA,CAAWiB,OAAO,EAAE,IAAA,EAAM,CAAA;;;;0BAEnDV,GAAA,CAACW,QAAAA,EAAAA;gBAAOC,IAAAA,EAAK,QAAA;gBAASC,OAAAA,EAASnB,SAAAA;AAAW,gBAAA,QAAA,EAAA;;;;AAGtD;;"}
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+ import { ApplicationStructure, NavigationModel, Theme } from '@cratis/scene.model';
3
+ import { ApplicationStructureIndex, EffectiveNavItem } from '@cratis/scene.engine';
4
+ import { ComponentRegistry, SceneHistory, SliceCommandFieldsSource, SliceInvoker } from '@cratis/scene.react';
5
+ import { ApplicationDocument } from './ApplicationDocument';
6
+ import { CompositionOptions } from './composeApplication';
7
+ import { PreviewProblem } from './PreviewProblem';
8
+ import { PreviewSampleData } from './previewSampleData';
9
+ import { PreviewTarget } from './PreviewTarget';
10
+ import { PreviewInvocation } from './PreviewToast';
11
+ export interface ScenePreviewHostProps {
12
+ document: ApplicationDocument;
13
+ structure: ApplicationStructure | ApplicationStructureIndex;
14
+ navigation?: NavigationModel;
15
+ target: PreviewTarget;
16
+ sampleData?: PreviewSampleData;
17
+ registry: ComponentRegistry;
18
+ invoker?: SliceInvoker;
19
+ onInvoked?(invocation: PreviewInvocation): void;
20
+ fieldsFor?: SliceCommandFieldsSource;
21
+ composition?: CompositionOptions;
22
+ theme?: Theme;
23
+ isVisible?(item: EffectiveNavItem): boolean;
24
+ history?: SceneHistory;
25
+ onProblems?(problems: PreviewProblem[]): void;
26
+ onSelectProblem?(problem: PreviewProblem): void;
27
+ onBreadcrumbChange?(breadcrumb: string[]): void;
28
+ onExit?(): void;
29
+ children?: ReactNode;
30
+ }
31
+ export declare function ScenePreviewHost({ document: application, structure, navigation, target, sampleData, registry, invoker, onInvoked, fieldsFor, composition, theme, isVisible, history, onProblems, onSelectProblem, onBreadcrumbChange, onExit, children, }: ScenePreviewHostProps): import("react").JSX.Element;
32
+ //# sourceMappingURL=ScenePreviewHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScenePreviewHost.d.ts","sourceRoot":"","sources":["../../../preview-host/ScenePreviewHost.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAqD,MAAM,OAAO,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAqB,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACtG,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAwB,MAAM,sBAAsB,CAAC;AACzG,OAAO,EACH,iBAAiB,EAAE,YAAY,EAAkD,wBAAwB,EAAE,YAAY,EAE1H,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAkE,MAAM,kBAAkB,CAAC;AAElH,OAAO,EAAE,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAgB,MAAM,gBAAgB,CAAC;AAGjE,MAAM,WAAW,qBAAqB;IAElC,QAAQ,EAAE,mBAAmB,CAAC;IAG9B,SAAS,EAAE,oBAAoB,GAAG,yBAAyB,CAAC;IAG5D,UAAU,CAAC,EAAE,eAAe,CAAC;IAG7B,MAAM,EAAE,aAAa,CAAC;IAGtB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAG/B,QAAQ,EAAE,iBAAiB,CAAC;IAG5B,OAAO,CAAC,EAAE,YAAY,CAAC;IAGvB,SAAS,CAAC,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAGhD,SAAS,CAAC,EAAE,wBAAwB,CAAC;IAGrC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAGjC,KAAK,CAAC,EAAE,KAAK,CAAC;IAGd,SAAS,CAAC,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAG5C,OAAO,CAAC,EAAE,YAAY,CAAC;IAGvB,UAAU,CAAC,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAG9C,eAAe,CAAC,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IAGhD,kBAAkB,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAGhD,MAAM,CAAC,IAAI,IAAI,CAAC;IAGhB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAgCD,wBAAgB,gBAAgB,CAAC,EAC7B,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,UAAyB,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAgB,EAC1I,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,QAAQ,GAC/F,EAAE,qBAAqB,+BAuGvB"}