@cratis/scene.blueprint.default 4.39.0 → 4.41.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 (281) hide show
  1. package/ComponentName.ts +27 -0
  2. package/defaultBlueprint.ts +1 -0
  3. package/defaultBlueprintComponents.ts +10 -1
  4. package/dist/cjs/ComponentName.js +9 -0
  5. package/dist/cjs/ComponentName.js.map +1 -1
  6. package/dist/cjs/defaultBlueprint.js +18 -1
  7. package/dist/cjs/defaultBlueprint.js.map +1 -1
  8. package/dist/cjs/defaultBlueprintComponentMetadata.js +9 -0
  9. package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
  10. package/dist/cjs/defaultBlueprintComponents.js +28 -1
  11. package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
  12. package/dist/cjs/foundation/BulkBar.js +62 -0
  13. package/dist/cjs/foundation/BulkBar.js.map +1 -0
  14. package/dist/cjs/foundation/DataList.js +436 -0
  15. package/dist/cjs/foundation/DataList.js.map +1 -0
  16. package/dist/cjs/foundation/FormScreenBody.js +447 -0
  17. package/dist/cjs/foundation/FormScreenBody.js.map +1 -0
  18. package/dist/cjs/foundation/FoundationStates.js +2 -1
  19. package/dist/cjs/foundation/FoundationStates.js.map +1 -1
  20. package/dist/cjs/foundation/GlobalSearch.js +54 -0
  21. package/dist/cjs/foundation/GlobalSearch.js.map +1 -0
  22. package/dist/cjs/foundation/KanbanBoard.js +222 -0
  23. package/dist/cjs/foundation/KanbanBoard.js.map +1 -0
  24. package/dist/cjs/foundation/NotificationsButton.js +45 -0
  25. package/dist/cjs/foundation/NotificationsButton.js.map +1 -0
  26. package/dist/cjs/foundation/SubNavigation.js +72 -0
  27. package/dist/cjs/foundation/SubNavigation.js.map +1 -0
  28. package/dist/cjs/foundation/TabSet.js +101 -0
  29. package/dist/cjs/foundation/TabSet.js.map +1 -0
  30. package/dist/cjs/foundation/WizardProgress.js +185 -0
  31. package/dist/cjs/foundation/WizardProgress.js.map +1 -0
  32. package/dist/cjs/foundation/boardModel.js +67 -0
  33. package/dist/cjs/foundation/boardModel.js.map +1 -0
  34. package/dist/cjs/foundation/formModel.js +158 -0
  35. package/dist/cjs/foundation/formModel.js.map +1 -0
  36. package/dist/cjs/foundation/foundationComponentMetadata.js +54 -0
  37. package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
  38. package/dist/cjs/foundation/foundationDescriptors.js +400 -0
  39. package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
  40. package/dist/cjs/foundation/foundationSamples.js +303 -0
  41. package/dist/cjs/foundation/foundationSamples.js.map +1 -1
  42. package/dist/cjs/foundation/foundationStrings.js +72 -0
  43. package/dist/cjs/foundation/foundationStrings.js.map +1 -1
  44. package/dist/cjs/foundation/listModel.js +200 -0
  45. package/dist/cjs/foundation/listModel.js.map +1 -0
  46. package/dist/cjs/foundation/tabModel.js +41 -0
  47. package/dist/cjs/foundation/tabModel.js.map +1 -0
  48. package/dist/cjs/foundation/templates/boardScreenTemplate.js +76 -0
  49. package/dist/cjs/foundation/templates/boardScreenTemplate.js.map +1 -0
  50. package/dist/cjs/foundation/templates/dashboardScreenTemplate.js +128 -0
  51. package/dist/cjs/foundation/templates/dashboardScreenTemplate.js.map +1 -0
  52. package/dist/cjs/foundation/templates/formScreenTemplate.js +71 -0
  53. package/dist/cjs/foundation/templates/formScreenTemplate.js.map +1 -0
  54. package/dist/cjs/foundation/templates/index.js +39 -0
  55. package/dist/cjs/foundation/templates/index.js.map +1 -0
  56. package/dist/cjs/foundation/templates/listScreenTemplate.js +124 -0
  57. package/dist/cjs/foundation/templates/listScreenTemplate.js.map +1 -0
  58. package/dist/cjs/foundation/templates/masterDetailScreenTemplate.js +79 -0
  59. package/dist/cjs/foundation/templates/masterDetailScreenTemplate.js.map +1 -0
  60. package/dist/cjs/foundation/templates/recordPageTemplate.js +137 -0
  61. package/dist/cjs/foundation/templates/recordPageTemplate.js.map +1 -0
  62. package/dist/cjs/foundation/templates/templateParts.js +38 -0
  63. package/dist/cjs/foundation/templates/templateParts.js.map +1 -0
  64. package/dist/cjs/foundation/templates/wizardScreenTemplate.js +95 -0
  65. package/dist/cjs/foundation/templates/wizardScreenTemplate.js.map +1 -0
  66. package/dist/cjs/foundation/templates/workspaceScreenTemplate.js +62 -0
  67. package/dist/cjs/foundation/templates/workspaceScreenTemplate.js.map +1 -0
  68. package/dist/cjs/foundation/urlState.js +57 -0
  69. package/dist/cjs/foundation/urlState.js.map +1 -0
  70. package/dist/cjs/foundation/useCompactWidth.js +23 -0
  71. package/dist/cjs/foundation/useCompactWidth.js.map +1 -0
  72. package/dist/cjs/foundation/wizardModel.js +50 -0
  73. package/dist/cjs/foundation/wizardModel.js.map +1 -0
  74. package/dist/cjs/gallery/GalleryScreenPreview.js +76 -4
  75. package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -1
  76. package/dist/cjs/gallery/applicationChrome.js +18 -1
  77. package/dist/cjs/gallery/applicationChrome.js.map +1 -1
  78. package/dist/cjs/gallery/composeScreen.js +5 -3
  79. package/dist/cjs/gallery/composeScreen.js.map +1 -1
  80. package/dist/cjs/gallery/screens.js +83 -2
  81. package/dist/cjs/gallery/screens.js.map +1 -1
  82. package/dist/cjs/index.js +96 -0
  83. package/dist/cjs/index.js.map +1 -1
  84. package/dist/esm/ComponentName.d.ts +10 -1
  85. package/dist/esm/ComponentName.d.ts.map +1 -1
  86. package/dist/esm/ComponentName.js +9 -0
  87. package/dist/esm/ComponentName.js.map +1 -1
  88. package/dist/esm/defaultBlueprint.d.ts.map +1 -1
  89. package/dist/esm/defaultBlueprint.js +18 -1
  90. package/dist/esm/defaultBlueprint.js.map +1 -1
  91. package/dist/esm/defaultBlueprintComponentMetadata.js +9 -0
  92. package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
  93. package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
  94. package/dist/esm/defaultBlueprintComponents.js +28 -1
  95. package/dist/esm/defaultBlueprintComponents.js.map +1 -1
  96. package/dist/esm/foundation/BulkBar.d.ts +4 -0
  97. package/dist/esm/foundation/BulkBar.d.ts.map +1 -0
  98. package/dist/esm/foundation/BulkBar.js +59 -0
  99. package/dist/esm/foundation/BulkBar.js.map +1 -0
  100. package/dist/esm/foundation/DataList.d.ts +3 -0
  101. package/dist/esm/foundation/DataList.d.ts.map +1 -0
  102. package/dist/esm/foundation/DataList.js +434 -0
  103. package/dist/esm/foundation/DataList.js.map +1 -0
  104. package/dist/esm/foundation/FormScreenBody.d.ts +3 -0
  105. package/dist/esm/foundation/FormScreenBody.d.ts.map +1 -0
  106. package/dist/esm/foundation/FormScreenBody.js +445 -0
  107. package/dist/esm/foundation/FormScreenBody.js.map +1 -0
  108. package/dist/esm/foundation/FoundationStates.js +2 -1
  109. package/dist/esm/foundation/FoundationStates.js.map +1 -1
  110. package/dist/esm/foundation/GlobalSearch.d.ts +3 -0
  111. package/dist/esm/foundation/GlobalSearch.d.ts.map +1 -0
  112. package/dist/esm/foundation/GlobalSearch.js +52 -0
  113. package/dist/esm/foundation/GlobalSearch.js.map +1 -0
  114. package/dist/esm/foundation/KanbanBoard.d.ts +3 -0
  115. package/dist/esm/foundation/KanbanBoard.d.ts.map +1 -0
  116. package/dist/esm/foundation/KanbanBoard.js +220 -0
  117. package/dist/esm/foundation/KanbanBoard.js.map +1 -0
  118. package/dist/esm/foundation/NotificationsButton.d.ts +3 -0
  119. package/dist/esm/foundation/NotificationsButton.d.ts.map +1 -0
  120. package/dist/esm/foundation/NotificationsButton.js +43 -0
  121. package/dist/esm/foundation/NotificationsButton.js.map +1 -0
  122. package/dist/esm/foundation/SubNavigation.d.ts +3 -0
  123. package/dist/esm/foundation/SubNavigation.d.ts.map +1 -0
  124. package/dist/esm/foundation/SubNavigation.js +70 -0
  125. package/dist/esm/foundation/SubNavigation.js.map +1 -0
  126. package/dist/esm/foundation/TabSet.d.ts +3 -0
  127. package/dist/esm/foundation/TabSet.d.ts.map +1 -0
  128. package/dist/esm/foundation/TabSet.js +99 -0
  129. package/dist/esm/foundation/TabSet.js.map +1 -0
  130. package/dist/esm/foundation/WizardProgress.d.ts +3 -0
  131. package/dist/esm/foundation/WizardProgress.d.ts.map +1 -0
  132. package/dist/esm/foundation/WizardProgress.js +183 -0
  133. package/dist/esm/foundation/WizardProgress.js.map +1 -0
  134. package/dist/esm/foundation/boardModel.d.ts +22 -0
  135. package/dist/esm/foundation/boardModel.d.ts.map +1 -0
  136. package/dist/esm/foundation/boardModel.js +61 -0
  137. package/dist/esm/foundation/boardModel.js.map +1 -0
  138. package/dist/esm/foundation/formModel.d.ts +48 -0
  139. package/dist/esm/foundation/formModel.d.ts.map +1 -0
  140. package/dist/esm/foundation/formModel.js +147 -0
  141. package/dist/esm/foundation/formModel.js.map +1 -0
  142. package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
  143. package/dist/esm/foundation/foundationComponentMetadata.js +54 -0
  144. package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -1
  145. package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -1
  146. package/dist/esm/foundation/foundationDescriptors.js +400 -0
  147. package/dist/esm/foundation/foundationDescriptors.js.map +1 -1
  148. package/dist/esm/foundation/foundationSamples.d.ts.map +1 -1
  149. package/dist/esm/foundation/foundationSamples.js +303 -0
  150. package/dist/esm/foundation/foundationSamples.js.map +1 -1
  151. package/dist/esm/foundation/foundationStrings.d.ts +72 -0
  152. package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
  153. package/dist/esm/foundation/foundationStrings.js +72 -0
  154. package/dist/esm/foundation/foundationStrings.js.map +1 -1
  155. package/dist/esm/foundation/index.d.ts +17 -0
  156. package/dist/esm/foundation/index.d.ts.map +1 -1
  157. package/dist/esm/foundation/index.js +17 -0
  158. package/dist/esm/foundation/index.js.map +1 -1
  159. package/dist/esm/foundation/listModel.d.ts +49 -0
  160. package/dist/esm/foundation/listModel.d.ts.map +1 -0
  161. package/dist/esm/foundation/listModel.js +183 -0
  162. package/dist/esm/foundation/listModel.js.map +1 -0
  163. package/dist/esm/foundation/tabModel.d.ts +10 -0
  164. package/dist/esm/foundation/tabModel.d.ts.map +1 -0
  165. package/dist/esm/foundation/tabModel.js +37 -0
  166. package/dist/esm/foundation/tabModel.js.map +1 -0
  167. package/dist/esm/foundation/templates/boardScreenTemplate.d.ts +3 -0
  168. package/dist/esm/foundation/templates/boardScreenTemplate.d.ts.map +1 -0
  169. package/dist/esm/foundation/templates/boardScreenTemplate.js +74 -0
  170. package/dist/esm/foundation/templates/boardScreenTemplate.js.map +1 -0
  171. package/dist/esm/foundation/templates/dashboardScreenTemplate.d.ts +3 -0
  172. package/dist/esm/foundation/templates/dashboardScreenTemplate.d.ts.map +1 -0
  173. package/dist/esm/foundation/templates/dashboardScreenTemplate.js +126 -0
  174. package/dist/esm/foundation/templates/dashboardScreenTemplate.js.map +1 -0
  175. package/dist/esm/foundation/templates/formScreenTemplate.d.ts +3 -0
  176. package/dist/esm/foundation/templates/formScreenTemplate.d.ts.map +1 -0
  177. package/dist/esm/foundation/templates/formScreenTemplate.js +69 -0
  178. package/dist/esm/foundation/templates/formScreenTemplate.js.map +1 -0
  179. package/dist/esm/foundation/templates/index.d.ts +11 -0
  180. package/dist/esm/foundation/templates/index.d.ts.map +1 -0
  181. package/dist/esm/foundation/templates/index.js +25 -0
  182. package/dist/esm/foundation/templates/index.js.map +1 -0
  183. package/dist/esm/foundation/templates/listScreenTemplate.d.ts +3 -0
  184. package/dist/esm/foundation/templates/listScreenTemplate.d.ts.map +1 -0
  185. package/dist/esm/foundation/templates/listScreenTemplate.js +122 -0
  186. package/dist/esm/foundation/templates/listScreenTemplate.js.map +1 -0
  187. package/dist/esm/foundation/templates/masterDetailScreenTemplate.d.ts +3 -0
  188. package/dist/esm/foundation/templates/masterDetailScreenTemplate.d.ts.map +1 -0
  189. package/dist/esm/foundation/templates/masterDetailScreenTemplate.js +77 -0
  190. package/dist/esm/foundation/templates/masterDetailScreenTemplate.js.map +1 -0
  191. package/dist/esm/foundation/templates/recordPageTemplate.d.ts +3 -0
  192. package/dist/esm/foundation/templates/recordPageTemplate.d.ts.map +1 -0
  193. package/dist/esm/foundation/templates/recordPageTemplate.js +135 -0
  194. package/dist/esm/foundation/templates/recordPageTemplate.js.map +1 -0
  195. package/dist/esm/foundation/templates/templateParts.d.ts +6 -0
  196. package/dist/esm/foundation/templates/templateParts.d.ts.map +1 -0
  197. package/dist/esm/foundation/templates/templateParts.js +33 -0
  198. package/dist/esm/foundation/templates/templateParts.js.map +1 -0
  199. package/dist/esm/foundation/templates/wizardScreenTemplate.d.ts +3 -0
  200. package/dist/esm/foundation/templates/wizardScreenTemplate.d.ts.map +1 -0
  201. package/dist/esm/foundation/templates/wizardScreenTemplate.js +93 -0
  202. package/dist/esm/foundation/templates/wizardScreenTemplate.js.map +1 -0
  203. package/dist/esm/foundation/templates/workspaceScreenTemplate.d.ts +3 -0
  204. package/dist/esm/foundation/templates/workspaceScreenTemplate.d.ts.map +1 -0
  205. package/dist/esm/foundation/templates/workspaceScreenTemplate.js +60 -0
  206. package/dist/esm/foundation/templates/workspaceScreenTemplate.js.map +1 -0
  207. package/dist/esm/foundation/urlState.d.ts +4 -0
  208. package/dist/esm/foundation/urlState.d.ts.map +1 -0
  209. package/dist/esm/foundation/urlState.js +53 -0
  210. package/dist/esm/foundation/urlState.js.map +1 -0
  211. package/dist/esm/foundation/useCompactWidth.d.ts +3 -0
  212. package/dist/esm/foundation/useCompactWidth.d.ts.map +1 -0
  213. package/dist/esm/foundation/useCompactWidth.js +20 -0
  214. package/dist/esm/foundation/useCompactWidth.js.map +1 -0
  215. package/dist/esm/foundation/wizardModel.d.ts +16 -0
  216. package/dist/esm/foundation/wizardModel.d.ts.map +1 -0
  217. package/dist/esm/foundation/wizardModel.js +43 -0
  218. package/dist/esm/foundation/wizardModel.js.map +1 -0
  219. package/dist/esm/gallery/GalleryScreenPreview.d.ts +13 -2
  220. package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -1
  221. package/dist/esm/gallery/GalleryScreenPreview.js +75 -5
  222. package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -1
  223. package/dist/esm/gallery/applicationChrome.d.ts.map +1 -1
  224. package/dist/esm/gallery/applicationChrome.js +18 -1
  225. package/dist/esm/gallery/applicationChrome.js.map +1 -1
  226. package/dist/esm/gallery/composeScreen.d.ts.map +1 -1
  227. package/dist/esm/gallery/composeScreen.js +5 -3
  228. package/dist/esm/gallery/composeScreen.js.map +1 -1
  229. package/dist/esm/gallery/screens.d.ts.map +1 -1
  230. package/dist/esm/gallery/screens.js +83 -2
  231. package/dist/esm/gallery/screens.js.map +1 -1
  232. package/dist/esm/index.js +27 -1
  233. package/dist/esm/index.js.map +1 -1
  234. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  235. package/foundation/BulkBar.tsx +38 -0
  236. package/foundation/DataList.tsx +208 -0
  237. package/foundation/FormScreenBody.tsx +196 -0
  238. package/foundation/FoundationStates.tsx +1 -1
  239. package/foundation/GlobalSearch.tsx +33 -0
  240. package/foundation/KanbanBoard.tsx +97 -0
  241. package/foundation/NotificationsButton.tsx +28 -0
  242. package/foundation/SubNavigation.tsx +49 -0
  243. package/foundation/TabSet.tsx +65 -0
  244. package/foundation/WizardProgress.tsx +109 -0
  245. package/foundation/boardModel.ts +64 -0
  246. package/foundation/formModel.ts +146 -0
  247. package/foundation/foundationComponentMetadata.ts +9 -0
  248. package/foundation/foundationDescriptors.ts +195 -0
  249. package/foundation/foundationSamples.ts +56 -0
  250. package/foundation/foundationStrings.ts +72 -0
  251. package/foundation/index.ts +17 -0
  252. package/foundation/listModel.ts +190 -0
  253. package/foundation/tabModel.ts +41 -0
  254. package/foundation/templates/boardScreenTemplate.ts +28 -0
  255. package/foundation/templates/dashboardScreenTemplate.ts +37 -0
  256. package/foundation/templates/formScreenTemplate.ts +28 -0
  257. package/foundation/templates/index.ts +26 -0
  258. package/foundation/templates/listScreenTemplate.ts +37 -0
  259. package/foundation/templates/masterDetailScreenTemplate.ts +28 -0
  260. package/foundation/templates/recordPageTemplate.ts +36 -0
  261. package/foundation/templates/templateParts.ts +30 -0
  262. package/foundation/templates/wizardScreenTemplate.ts +33 -0
  263. package/foundation/templates/workspaceScreenTemplate.ts +27 -0
  264. package/foundation/urlState.ts +52 -0
  265. package/foundation/useCompactWidth.ts +23 -0
  266. package/foundation/wizardModel.ts +54 -0
  267. package/gallery/GalleryScreenPreview.tsx +64 -5
  268. package/gallery/applicationChrome.ts +6 -1
  269. package/gallery/composeScreen.ts +4 -2
  270. package/gallery/screens.ts +16 -1
  271. package/package.json +10 -8
  272. package/sampleData/foundation-en.json +512 -0
  273. package/shell/layout.css +513 -0
  274. package/thumbnails/BoardScreen.svg +15 -0
  275. package/thumbnails/DashboardScreen.svg +18 -0
  276. package/thumbnails/FormScreen.svg +14 -0
  277. package/thumbnails/ListScreen.svg +16 -0
  278. package/thumbnails/MasterDetailScreen.svg +22 -0
  279. package/thumbnails/RecordPage.svg +17 -0
  280. package/thumbnails/WizardScreen.svg +16 -0
  281. package/thumbnails/WorkspaceScreen.svg +12 -0
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+ var flowBuilders = require('../../layouts/flowBuilders.js');
5
+ var templateParts = require('./templateParts.js');
6
+
7
+ // Copyright (c) Cratis. All rights reserved.
8
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
9
+ /**
10
+ * The record page: a header, the key facts, then tabs (overview, related, files, history) with the record's main content, its related records and its
11
+ * activity, and an aside. The tabs are configurable by changing one property.
12
+ */ const recordPageTemplate = {
13
+ name: 'RecordPage',
14
+ fitsSlot: 'content',
15
+ slots: [
16
+ {
17
+ name: 'header'
18
+ },
19
+ {
20
+ name: 'summary'
21
+ },
22
+ {
23
+ name: 'tabs'
24
+ },
25
+ {
26
+ name: 'main'
27
+ },
28
+ {
29
+ name: 'related'
30
+ },
31
+ {
32
+ name: 'activity'
33
+ },
34
+ {
35
+ name: 'aside'
36
+ }
37
+ ],
38
+ arrangement: {
39
+ root: flowBuilders.column([
40
+ flowBuilders.slotLeaf('header'),
41
+ flowBuilders.slotLeaf('summary'),
42
+ flowBuilders.grid([
43
+ flowBuilders.column([
44
+ flowBuilders.slotLeaf('tabs'),
45
+ flowBuilders.slotLeaf('main'),
46
+ flowBuilders.slotLeaf('related'),
47
+ flowBuilders.slotLeaf('activity')
48
+ ], 16, {
49
+ span: 2
50
+ }),
51
+ flowBuilders.slotLeaf('aside')
52
+ ], 3, 16)
53
+ ], 16),
54
+ overrides: [
55
+ {
56
+ width: scene_model.WidthSizeClass.Compact,
57
+ root: flowBuilders.column([
58
+ flowBuilders.slotLeaf('header'),
59
+ flowBuilders.slotLeaf('summary'),
60
+ flowBuilders.slotLeaf('tabs'),
61
+ flowBuilders.slotLeaf('main'),
62
+ flowBuilders.slotLeaf('related'),
63
+ flowBuilders.slotLeaf('activity'),
64
+ flowBuilders.slotLeaf('aside')
65
+ ], 16)
66
+ }
67
+ ]
68
+ },
69
+ content: {
70
+ header: [
71
+ templateParts.component('record-header', 'pageHeader', {
72
+ title: templateParts.fromQuery('RecordValues', '0.name'),
73
+ subtitle: 'Account'
74
+ })
75
+ ],
76
+ summary: [
77
+ templateParts.component('record-value', 'statCard', {
78
+ label: 'Lifetime value',
79
+ value: templateParts.fromQuery('Kpis', '0.value'),
80
+ format: 'currency',
81
+ currency: 'USD'
82
+ }),
83
+ templateParts.component('record-status', 'statusChip', {
84
+ status: templateParts.fromQuery('Deals', '0.status'),
85
+ tone: 'info'
86
+ }),
87
+ templateParts.component('record-people', 'avatarStack', {
88
+ people: templateParts.fromQuery('People')
89
+ })
90
+ ],
91
+ tabs: [
92
+ templateParts.component('record-tabs', 'tabSet', {
93
+ tabs: templateParts.fromQuery('RecordTabs'),
94
+ urlKey: 'tab',
95
+ label: 'Record sections'
96
+ })
97
+ ],
98
+ main: [
99
+ templateParts.component('record-form', 'formScreenBody', {
100
+ mode: 'readOnly',
101
+ sections: templateParts.fromQuery('RecordSections'),
102
+ values: templateParts.fromQuery('RecordValues', '0')
103
+ })
104
+ ],
105
+ related: [
106
+ templateParts.component('record-related', 'dataList', {
107
+ label: 'Related deals',
108
+ rows: templateParts.fromQuery('Deals'),
109
+ columns: templateParts.fromQuery('DealColumns'),
110
+ titleField: 'name',
111
+ pageSize: 5
112
+ })
113
+ ],
114
+ activity: [
115
+ templateParts.component('record-activity', 'activityFeed', {
116
+ label: 'History',
117
+ entries: templateParts.fromQuery('Activity')
118
+ })
119
+ ],
120
+ aside: [
121
+ templateParts.component('record-checklist', 'checklistSection', {
122
+ sections: templateParts.fromQuery('Checklist')
123
+ })
124
+ ]
125
+ },
126
+ displayName: 'Record page',
127
+ description: 'One record: its key facts, tabbed sections, related records and history.',
128
+ metadata: {
129
+ ...templateParts.foundationTemplateProvenance,
130
+ type: 'Detail',
131
+ category: 'Foundation / Detail',
132
+ thumbnail: templateParts.thumbnailOf('RecordPage')
133
+ }
134
+ };
135
+
136
+ exports.recordPageTemplate = recordPageTemplate;
137
+ //# sourceMappingURL=recordPageTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordPageTemplate.js","sources":["../../../../foundation/templates/recordPageTemplate.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 { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';\nimport { column, grid, row, slotLeaf } from '../../layouts/flowBuilders';\nimport { component, foundationTemplateProvenance, fromQuery, thumbnailOf } from './templateParts';\n\n/**\n * The record page: a header, the key facts, then tabs (overview, related, files, history) with the record's main content, its related records and its\n * activity, and an aside. The tabs are configurable by changing one property.\n */\nexport const recordPageTemplate: ScreenTemplate = {\n name: 'RecordPage',\n fitsSlot: 'content',\n slots: [{ name: 'header' }, { name: 'summary' }, { name: 'tabs' }, { name: 'main' }, { name: 'related' }, { name: 'activity' }, { name: 'aside' }],\n arrangement: {\n root: column([slotLeaf('header'), slotLeaf('summary'), grid([column([slotLeaf('tabs'), slotLeaf('main'), slotLeaf('related'), slotLeaf('activity')], 16, { span: 2 }), slotLeaf('aside')], 3, 16)], 16),\n overrides: [{ width: WidthSizeClass.Compact, root: column([slotLeaf('header'), slotLeaf('summary'), slotLeaf('tabs'), slotLeaf('main'), slotLeaf('related'), slotLeaf('activity'), slotLeaf('aside')], 16) }],\n },\n content: {\n header: [component('record-header', 'pageHeader', { title: fromQuery('RecordValues', '0.name'), subtitle: 'Account' })],\n summary: [\n component('record-value', 'statCard', { label: 'Lifetime value', value: fromQuery('Kpis', '0.value'), format: 'currency', currency: 'USD' }),\n component('record-status', 'statusChip', { status: fromQuery('Deals', '0.status'), tone: 'info' }),\n component('record-people', 'avatarStack', { people: fromQuery('People') }),\n ],\n tabs: [component('record-tabs', 'tabSet', { tabs: fromQuery('RecordTabs'), urlKey: 'tab', label: 'Record sections' })],\n main: [component('record-form', 'formScreenBody', { mode: 'readOnly', sections: fromQuery('RecordSections'), values: fromQuery('RecordValues', '0') })],\n related: [component('record-related', 'dataList', { label: 'Related deals', rows: fromQuery('Deals'), columns: fromQuery('DealColumns'), titleField: 'name', pageSize: 5 })],\n activity: [component('record-activity', 'activityFeed', { label: 'History', entries: fromQuery('Activity') })],\n aside: [component('record-checklist', 'checklistSection', { sections: fromQuery('Checklist') })],\n },\n displayName: 'Record page',\n description: 'One record: its key facts, tabbed sections, related records and history.',\n metadata: { ...foundationTemplateProvenance, type: 'Detail', category: 'Foundation / Detail', thumbnail: thumbnailOf('RecordPage') },\n};\n"],"names":["recordPageTemplate","name","fitsSlot","slots","arrangement","root","column","slotLeaf","grid","span","overrides","width","WidthSizeClass","Compact","content","header","component","title","fromQuery","subtitle","summary","label","value","format","currency","status","tone","people","tabs","urlKey","main","mode","sections","values","related","rows","columns","titleField","pageSize","activity","entries","aside","displayName","description","metadata","foundationTemplateProvenance","type","category","thumbnail","thumbnailOf"],"mappings":";;;;;;AAAA;AACA;AAMA;;;UAIaA,kBA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AAA,EAAY;gBAAEK,KAAAA,EAAO,eAAA;AAAiBc,gBAAAA,IAAAA,EAAMjB,uBAAAA,CAAU,OAAA,CAAA;AAAUkB,gBAAAA,OAAAA,EAASlB,uBAAAA,CAAU,aAAA,CAAA;gBAAgBmB,UAAAA,EAAY,MAAA;gBAAQC,QAAAA,EAAU;AAAE,aAAA;AAAG,SAAA;QAC5KC,QAAAA,EAAU;AAACvB,YAAAA,uBAAAA,CAAU,mBAAmB,cAAA,EAAgB;gBAAEK,KAAAA,EAAO,SAAA;AAAWmB,gBAAAA,OAAAA,EAAStB,uBAAAA,CAAU,UAAA;AAAY,aAAA;AAAG,SAAA;QAC9GuB,KAAAA,EAAO;AAACzB,YAAAA,uBAAAA,CAAU,oBAAoB,kBAAA,EAAoB;AAAEgB,gBAAAA,QAAAA,EAAUd,uBAAAA,CAAU,WAAA;AAAa,aAAA;AAAG;AACpG,KAAA;IACAwB,WAAAA,EAAa,aAAA;IACbC,WAAAA,EAAa,0EAAA;IACbC,QAAAA,EAAU;AAAE,QAAA,GAAGC,0CAA4B;QAAEC,IAAAA,EAAM,QAAA;QAAUC,QAAAA,EAAU,qBAAA;AAAuBC,QAAAA,SAAAA,EAAWC,yBAAAA,CAAY,YAAA;AAAc;AACvI;;"}
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+ var elements = require('../../gallery/elements.js');
5
+ var templateProvenance = require('../../templateProvenance.js');
6
+
7
+ // Copyright (c) Cratis. All rights reserved.
8
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
9
+ /**
10
+ * The provenance every foundation template carries. The foundation components draw themselves with no component library, so unlike the earlier
11
+ * gallery templates these require no PrimeReact or Cratis.Components: a host with only this blueprint renders them.
12
+ */ const foundationTemplateProvenance = {
13
+ compatibility: {
14
+ scene: templateProvenance.defaultBlueprintTemplateProvenance.compatibility.scene
15
+ },
16
+ attribution: {
17
+ author: 'Cratis',
18
+ url: 'https://github.com/Cratis/Scene/tree/main/Source/JavaScript/blueprint.default'
19
+ },
20
+ license: 'MIT',
21
+ licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE'
22
+ };
23
+ /** The package-relative thumbnail path of a foundation template. */ const thumbnailOf = (templateName)=>`thumbnails/${templateName}.svg`;
24
+ /**
25
+ * A property taken from a query result - never a value. A template declares *where* its data comes from and the sample-data pack, or the real
26
+ * query, supplies the rows (spec SD1); `path` reaches into the result (`0.value` is the first row's `value`, an empty path is the whole result).
27
+ */ const fromQuery = (query, path = '')=>({
28
+ kind: scene_model.BindingSourceKind.QueryResult,
29
+ query,
30
+ path
31
+ });
32
+ /** A component of this blueprint, by its bare name, with its properties and slot content. */ const component = (id, componentName, properties = {}, slots = {})=>elements.externalComponent(id, componentName, properties, slots);
33
+
34
+ exports.component = component;
35
+ exports.foundationTemplateProvenance = foundationTemplateProvenance;
36
+ exports.fromQuery = fromQuery;
37
+ exports.thumbnailOf = thumbnailOf;
38
+ //# sourceMappingURL=templateParts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateParts.js","sources":["../../../../foundation/templates/templateParts.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 { BindingExpression, BindingSourceKind, ExternalComponent, SceneElement, TemplateMetadata } from '@cratis/scene.model';\nimport { externalComponent } from '../../gallery/elements';\nimport { defaultBlueprintTemplateProvenance } from '../../templateProvenance';\n\n/**\n * The provenance every foundation template carries. The foundation components draw themselves with no component library, so unlike the earlier\n * gallery templates these require no PrimeReact or Cratis.Components: a host with only this blueprint renders them.\n */\nexport const foundationTemplateProvenance: Pick<TemplateMetadata, 'compatibility' | 'attribution' | 'license' | 'licenseUrl'> = {\n compatibility: { scene: defaultBlueprintTemplateProvenance.compatibility!.scene },\n attribution: { author: 'Cratis', url: 'https://github.com/Cratis/Scene/tree/main/Source/JavaScript/blueprint.default' },\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/** The package-relative thumbnail path of a foundation template. */\nexport const thumbnailOf = (templateName: string): string => `thumbnails/${templateName}.svg`;\n\n/**\n * A property taken from a query result - never a value. A template declares *where* its data comes from and the sample-data pack, or the real\n * query, supplies the rows (spec SD1); `path` reaches into the result (`0.value` is the first row's `value`, an empty path is the whole result).\n */\nexport const fromQuery = (query: string, path = ''): BindingExpression => ({ kind: BindingSourceKind.QueryResult, query, path });\n\n/** A component of this blueprint, by its bare name, with its properties and slot content. */\nexport const component = (id: string, componentName: string, properties: Record<string, unknown> = {}, slots: Record<string, SceneElement[]> = {}): ExternalComponent =>\n externalComponent(id, componentName, properties, slots);\n"],"names":["foundationTemplateProvenance","compatibility","scene","defaultBlueprintTemplateProvenance","attribution","author","url","license","licenseUrl","thumbnailOf","templateName","fromQuery","query","path","kind","BindingSourceKind","QueryResult","component","id","componentName","properties","slots","externalComponent"],"mappings":";;;;;;AAAA;AACA;AAMA;;;UAIaA,4BAAAA,GAAmH;IAC5HC,aAAAA,EAAe;QAAEC,KAAAA,EAAOC,qDAAAA,CAAmCF,aAAa,CAAEC;AAAM,KAAA;IAChFE,WAAAA,EAAa;QAAEC,MAAAA,EAAQ,QAAA;QAAUC,GAAAA,EAAK;AAAgF,KAAA;IACtHC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA,qEACO,MAAMC,WAAAA,GAAc,CAACC,YAAAA,GAAiC,CAAC,WAAW,EAAEA,YAAAA,CAAa,IAAI;AAE5F;;;UAIaC,SAAAA,GAAY,CAACC,OAAeC,IAAAA,GAAO,EAAE,IAAyB;AAAEC,QAAAA,IAAAA,EAAMC,8BAAkBC,WAAW;AAAEJ,QAAAA,KAAAA;AAAOC,QAAAA;AAAK,KAAA;AAE9H,8FACO,MAAMI,YAAY,CAACC,EAAAA,EAAYC,eAAuBC,UAAAA,GAAsC,EAAE,EAAEC,KAAAA,GAAwC,EAAE,GAC7IC,2BAAkBJ,EAAAA,EAAIC,aAAAA,EAAeC,YAAYC,KAAAA;;;;;"}
@@ -0,0 +1,95 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+ var flowBuilders = require('../../layouts/flowBuilders.js');
5
+ var templateParts = require('./templateParts.js');
6
+
7
+ // Copyright (c) Cratis. All rights reserved.
8
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
9
+ /**
10
+ * The wizard: linear steps with a progress list, Back and Next, and a save-draft. The last step is the review. Where the person has got to survives a refresh,
11
+ * and a refresh can never land past a step that was not done. The content of each step is the slot named by its id.
12
+ */ const wizardScreenTemplate = {
13
+ name: 'WizardScreen',
14
+ fitsSlot: 'content',
15
+ slots: [
16
+ {
17
+ name: 'header'
18
+ },
19
+ {
20
+ name: 'progress'
21
+ },
22
+ {
23
+ name: 'step'
24
+ },
25
+ {
26
+ name: 'actions'
27
+ }
28
+ ],
29
+ arrangement: {
30
+ root: flowBuilders.column([
31
+ flowBuilders.slotLeaf('header'),
32
+ flowBuilders.slotLeaf('progress'),
33
+ flowBuilders.slotLeaf('step'),
34
+ flowBuilders.slotLeaf('actions')
35
+ ], 16),
36
+ overrides: [
37
+ {
38
+ width: scene_model.WidthSizeClass.Compact,
39
+ root: flowBuilders.column([
40
+ flowBuilders.slotLeaf('header'),
41
+ flowBuilders.slotLeaf('progress'),
42
+ flowBuilders.slotLeaf('step'),
43
+ flowBuilders.slotLeaf('actions')
44
+ ], 16)
45
+ }
46
+ ]
47
+ },
48
+ content: {
49
+ header: [
50
+ templateParts.component('wizard-header', 'pageHeader', {
51
+ title: 'New account',
52
+ subtitle: 'Three short steps'
53
+ })
54
+ ],
55
+ progress: [
56
+ templateParts.component('wizard-progress', 'wizardProgress', {
57
+ steps: templateParts.fromQuery('WizardSteps'),
58
+ urlKey: 'step'
59
+ }, {
60
+ details: [
61
+ templateParts.component('wizard-details', 'formScreenBody', {
62
+ mode: 'create',
63
+ sections: templateParts.fromQuery('RecordSections'),
64
+ values: templateParts.fromQuery('RecordValues', '0')
65
+ })
66
+ ],
67
+ people: [
68
+ templateParts.component('wizard-people', 'avatarStack', {
69
+ people: templateParts.fromQuery('People')
70
+ })
71
+ ],
72
+ review: [
73
+ templateParts.component('wizard-review', 'formScreenBody', {
74
+ mode: 'readOnly',
75
+ sections: templateParts.fromQuery('RecordSections'),
76
+ values: templateParts.fromQuery('RecordValues', '0')
77
+ })
78
+ ]
79
+ })
80
+ ],
81
+ step: [],
82
+ actions: []
83
+ },
84
+ displayName: 'Wizard',
85
+ description: 'Linear steps with progress, back and next, a saved draft and a review step.',
86
+ metadata: {
87
+ ...templateParts.foundationTemplateProvenance,
88
+ type: 'Wizard',
89
+ category: 'Foundation / Wizard',
90
+ thumbnail: templateParts.thumbnailOf('WizardScreen')
91
+ }
92
+ };
93
+
94
+ exports.wizardScreenTemplate = wizardScreenTemplate;
95
+ //# sourceMappingURL=wizardScreenTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wizardScreenTemplate.js","sources":["../../../../foundation/templates/wizardScreenTemplate.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 { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';\nimport { column, grid, row, slotLeaf } from '../../layouts/flowBuilders';\nimport { component, foundationTemplateProvenance, fromQuery, thumbnailOf } from './templateParts';\n\n/**\n * The wizard: linear steps with a progress list, Back and Next, and a save-draft. The last step is the review. Where the person has got to survives a refresh,\n * and a refresh can never land past a step that was not done. The content of each step is the slot named by its id.\n */\nexport const wizardScreenTemplate: ScreenTemplate = {\n name: 'WizardScreen',\n fitsSlot: 'content',\n slots: [{ name: 'header' }, { name: 'progress' }, { name: 'step' }, { name: 'actions' }],\n arrangement: {\n root: column([slotLeaf('header'), slotLeaf('progress'), slotLeaf('step'), slotLeaf('actions')], 16),\n overrides: [{ width: WidthSizeClass.Compact, root: column([slotLeaf('header'), slotLeaf('progress'), slotLeaf('step'), slotLeaf('actions')], 16) }],\n },\n content: {\n header: [component('wizard-header', 'pageHeader', { title: 'New account', subtitle: 'Three short steps' })],\n progress: [component('wizard-progress', 'wizardProgress', { steps: fromQuery('WizardSteps'), urlKey: 'step' }, {\n details: [component('wizard-details', 'formScreenBody', { mode: 'create', sections: fromQuery('RecordSections'), values: fromQuery('RecordValues', '0') })],\n people: [component('wizard-people', 'avatarStack', { people: fromQuery('People') })],\n review: [component('wizard-review', 'formScreenBody', { mode: 'readOnly', sections: fromQuery('RecordSections'), values: fromQuery('RecordValues', '0') })],\n })],\n step: [],\n actions: [],\n },\n displayName: 'Wizard',\n description: 'Linear steps with progress, back and next, a saved draft and a review step.',\n metadata: { ...foundationTemplateProvenance, type: 'Wizard', category: 'Foundation / Wizard', thumbnail: thumbnailOf('WizardScreen') },\n};\n"],"names":["wizardScreenTemplate","name","fitsSlot","slots","arrangement","root","column","slotLeaf","overrides","width","WidthSizeClass","Compact","content","header","component","title","subtitle","progress","steps","fromQuery","urlKey","details","mode","sections","values","people","review","step","actions","displayName","description","metadata","foundationTemplateProvenance","type","category","thumbnail","thumbnailOf"],"mappings":";;;;;;AAAA;AACA;AAMA;;;UAIaA,oBAAAA,GAAuC;IAChDC,IAAAA,EAAM,cAAA;IACNC,QAAAA,EAAU,SAAA;IACVC,KAAAA,EAAO;AAAC,QAAA;YAAEF,IAAAA,EAAM;AAAS,SAAA;AAAG,QAAA;YAAEA,IAAAA,EAAM;AAAW,SAAA;AAAG,QAAA;YAAEA,IAAAA,EAAM;AAAO,SAAA;AAAG,QAAA;YAAEA,IAAAA,EAAM;AAAU;AAAE,KAAA;IACxFG,WAAAA,EAAa;AACTC,QAAAA,IAAAA,EAAMC,mBAAAA,CAAO;YAACC,qBAAAA,CAAS,QAAA,CAAA;YAAWA,qBAAAA,CAAS,UAAA,CAAA;YAAaA,qBAAAA,CAAS,MAAA,CAAA;YAASA,qBAAAA,CAAS,SAAA;SAAW,EAAE,EAAA,CAAA;QAChGC,SAAAA,E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,qBAAA;AAAG;AAC/J,aAAA;AAAG,SAAA;AACHQ,QAAAA,IAAAA,EAAM,EAAE;AACRC,QAAAA,OAAAA,EAAS;AACb,KAAA;IACAC,WAAAA,EAAa,QAAA;IACbC,WAAAA,EAAa,6EAAA;IACbC,QAAAA,EAAU;AAAE,QAAA,GAAGC,0CAA4B;QAAEC,IAAAA,EAAM,QAAA;QAAUC,QAAAA,EAAU,qBAAA;AAAuBC,QAAAA,SAAAA,EAAWC,yBAAAA,CAAY,cAAA;AAAgB;AACzI;;"}
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+ var flowBuilders = require('../../layouts/flowBuilders.js');
5
+ var templateParts = require('./templateParts.js');
6
+
7
+ // Copyright (c) Cratis. All rights reserved.
8
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
9
+ /**
10
+ * A module's own workspace: its sections beside the content of the section in force. The sections are the module's sub-navigation (a left rail that
11
+ * becomes tabs on a phone); the section in force is kept in the address, so a deep link or a refresh restores it. Feature screens go in `moduleContent`.
12
+ */ const workspaceScreenTemplate = {
13
+ name: 'WorkspaceScreen',
14
+ fitsSlot: 'content',
15
+ slots: [
16
+ {
17
+ name: 'moduleNav'
18
+ },
19
+ {
20
+ name: 'moduleContent'
21
+ }
22
+ ],
23
+ arrangement: {
24
+ root: flowBuilders.grid([
25
+ flowBuilders.slotLeaf('moduleNav'),
26
+ flowBuilders.slotLeaf('moduleContent', {
27
+ span: 3
28
+ })
29
+ ], 4, 16),
30
+ overrides: [
31
+ {
32
+ width: scene_model.WidthSizeClass.Compact,
33
+ root: flowBuilders.column([
34
+ flowBuilders.slotLeaf('moduleNav'),
35
+ flowBuilders.slotLeaf('moduleContent')
36
+ ], 16)
37
+ }
38
+ ]
39
+ },
40
+ content: {
41
+ moduleNav: [
42
+ templateParts.component('workspace-sections', 'subNavigation', {
43
+ items: templateParts.fromQuery('ModuleSections'),
44
+ orientation: 'vertical',
45
+ urlKey: 'section',
46
+ label: 'Module sections'
47
+ })
48
+ ],
49
+ moduleContent: []
50
+ },
51
+ displayName: 'Module workspace',
52
+ description: 'A module\'s sections beside the content of the section that is open.',
53
+ metadata: {
54
+ ...templateParts.foundationTemplateProvenance,
55
+ type: 'Workspace',
56
+ category: 'Foundation / Workspace',
57
+ thumbnail: templateParts.thumbnailOf('WorkspaceScreen')
58
+ }
59
+ };
60
+
61
+ exports.workspaceScreenTemplate = workspaceScreenTemplate;
62
+ //# sourceMappingURL=workspaceScreenTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaceScreenTemplate.js","sources":["../../../../foundation/templates/workspaceScreenTemplate.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 { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';\nimport { column, grid, row, slotLeaf } from '../../layouts/flowBuilders';\nimport { component, foundationTemplateProvenance, fromQuery, thumbnailOf } from './templateParts';\n\n/**\n * A module's own workspace: its sections beside the content of the section in force. The sections are the module's sub-navigation (a left rail that\n * becomes tabs on a phone); the section in force is kept in the address, so a deep link or a refresh restores it. Feature screens go in `moduleContent`.\n */\nexport const workspaceScreenTemplate: ScreenTemplate = {\n name: 'WorkspaceScreen',\n fitsSlot: 'content',\n slots: [{ name: 'moduleNav' }, { name: 'moduleContent' }],\n arrangement: {\n root: grid([slotLeaf('moduleNav'), slotLeaf('moduleContent', { span: 3 })], 4, 16),\n overrides: [{ width: WidthSizeClass.Compact, root: column([slotLeaf('moduleNav'), slotLeaf('moduleContent')], 16) }],\n },\n content: {\n moduleNav: [component('workspace-sections', 'subNavigation', { items: fromQuery('ModuleSections'), orientation: 'vertical', urlKey: 'section', label: 'Module sections' })],\n moduleContent: [],\n },\n displayName: 'Module workspace',\n description: 'A module\\'s sections beside the content of the section that is open.',\n metadata: { ...foundationTemplateProvenance, type: 'Workspace', category: 'Foundation / Workspace', thumbnail: thumbnailOf('WorkspaceScreen') },\n};\n"],"names":["workspaceScreenTemplate","name","fitsSlot","slots","arrangement","root","grid","slotLeaf","span","overrides","width","WidthSizeClass","Compact","column","content","moduleNav","component","items","fromQuery","orientation","urlKey","label","moduleContent","displayName","description","metadata","foundationTemplateProvenance","type","category","thumbnail","thumbnailOf"],"mappings":";;;;;;AAAA;AACA;AAMA;;;UAIaA,uBAAAA,GAA0C;IACnDC,IAAAA,EAAM,iBAAA;IACNC,QAAAA,EAAU,SAAA;IACVC,KAAAA,EAAO;AAAC,QAAA;YAAEF,IAAAA,EAAM;AAAY,SAAA;AAAG,QAAA;YAAEA,IAAAA,EAAM;AAAgB;AAAE,KAAA;IACzDG,WAAAA,EAAa;AACTC,QAAAA,IAAAA,EAAMC,iBAAAA,CAAK;YAACC,qBAAAA,CAAS,WAAA,CAAA;AAAcA,YAAAA,qBAAAA,CAAS,eAAA,EAAiB;gBAAEC,IAAAA,EAAM;AAAE,aAAA;AAAG,SAAA,EAAE,CAAA,EAAG,EAAA,CAAA;QAC/EC,SAAAA,EAAW;AAAC,YAAA;AAAEC,gBAAAA,KAAAA,EAAOC,2BAAeC,OAAO;AAAEP,gBAAAA,IAAAA,EAAMQ,mBAAAA,CAAO;oBAACN,qBAAAA,CAAS,WAAA,CAAA;oBAAcA,qBAAAA,CAAS,eAAA;iBAAiB,EAAE,EAAA;AAAI;AAAE;AACxH,KAAA;IACAO,OAAAA,EAAS;QACLC,SAAAA,EAAW;AAACC,YAAAA,uBAAAA,CAAU,sBAAsB,eAAA,EAAiB;AAAEC,gBAAAA,KAAAA,EAAOC,uBAAAA,CAAU,gBAAA,CAAA;gBAAmBC,WAAAA,EAAa,UAAA;gBAAYC,MAAAA,EAAQ,SAAA;gBAAWC,KAAAA,EAAO;AAAkB,aAAA;AAAG,SAAA;AAC3KC,QAAAA,aAAAA,EAAe;AACnB,KAAA;IACAC,WAAAA,EAAa,kBAAA;IACbC,WAAAA,EAAa,sEAAA;IACbC,QAAAA,EAAU;AAAE,QAAA,GAAGC,0CAA4B;QAAEC,IAAAA,EAAM,WAAA;QAAaC,QAAAA,EAAU,wBAAA;AAA0BC,QAAAA,SAAAA,EAAWC,yBAAAA,CAAY,iBAAA;AAAmB;AAClJ;;"}
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /** Reads one query-string parameter of the current address, or undefined when it is absent or there is no address (server rendering). */ function readUrlParameter(name) {
8
+ if (typeof window === 'undefined') return undefined;
9
+ const value = new URLSearchParams(window.location.search).get(name);
10
+ return value === null ? undefined : value;
11
+ }
12
+ /** Writes one query-string parameter to the address without adding a history entry; an undefined or empty value removes it. */ function writeUrlParameter(name, value) {
13
+ if (typeof window === 'undefined') return;
14
+ const parameters = new URLSearchParams(window.location.search);
15
+ if (value === undefined || value === '') parameters.delete(name);
16
+ else parameters.set(name, value);
17
+ const query = parameters.toString();
18
+ window.history.replaceState(window.history.state, '', `${window.location.pathname}${query.length > 0 ? `?${query}` : ''}${window.location.hash}`);
19
+ }
20
+ /**
21
+ * State that lives in the address bar: a list's search, sort, page and filters, a master/detail's selection, a module's active section.
22
+ *
23
+ * It starts from the address when the address has a value (so a shared link, a refresh and the back button restore the screen as it was),
24
+ * otherwise from the fallback the template supplies. Changing it rewrites the address in place and does not add a history entry per keystroke.
25
+ * Several components on one screen use distinct `key`s; a template names them (`q`, `sort`, `page`, `selected`, `section`). Without a
26
+ * `urlKey` the state is plain component state, which is what a gallery card and a design surface want.
27
+ *
28
+ * @param key The query-string parameter, or undefined to keep the state local.
29
+ * @param fallback The value used when the address has none.
30
+ * @returns The value and its setter.
31
+ */ function useUrlState(key, fallback) {
32
+ const [value, setValue] = react.useState(()=>key === undefined ? fallback : readUrlParameter(key) ?? fallback);
33
+ react.useEffect(()=>{
34
+ if (key === undefined) return;
35
+ const restore = ()=>setValue(readUrlParameter(key) ?? fallback);
36
+ window.addEventListener('popstate', restore);
37
+ return ()=>window.removeEventListener('popstate', restore);
38
+ }, [
39
+ key,
40
+ fallback
41
+ ]);
42
+ const update = react.useCallback((next)=>{
43
+ setValue(next);
44
+ if (key !== undefined) writeUrlParameter(key, next);
45
+ }, [
46
+ key
47
+ ]);
48
+ return [
49
+ value,
50
+ update
51
+ ];
52
+ }
53
+
54
+ exports.readUrlParameter = readUrlParameter;
55
+ exports.useUrlState = useUrlState;
56
+ exports.writeUrlParameter = writeUrlParameter;
57
+ //# sourceMappingURL=urlState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlState.js","sources":["../../../foundation/urlState.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 { useCallback, useEffect, useState } from 'react';\n\n/** Reads one query-string parameter of the current address, or undefined when it is absent or there is no address (server rendering). */\nexport function readUrlParameter(name: string): string | undefined {\n if (typeof window === 'undefined') return undefined;\n const value = new URLSearchParams(window.location.search).get(name);\n return value === null ? undefined : value;\n}\n\n/** Writes one query-string parameter to the address without adding a history entry; an undefined or empty value removes it. */\nexport function writeUrlParameter(name: string, value: string | undefined): void {\n if (typeof window === 'undefined') return;\n const parameters = new URLSearchParams(window.location.search);\n if (value === undefined || value === '') parameters.delete(name);\n else parameters.set(name, value);\n\n const query = parameters.toString();\n window.history.replaceState(window.history.state, '', `${window.location.pathname}${query.length > 0 ? `?${query}` : ''}${window.location.hash}`);\n}\n\n/**\n * State that lives in the address bar: a list's search, sort, page and filters, a master/detail's selection, a module's active section.\n *\n * It starts from the address when the address has a value (so a shared link, a refresh and the back button restore the screen as it was),\n * otherwise from the fallback the template supplies. Changing it rewrites the address in place and does not add a history entry per keystroke.\n * Several components on one screen use distinct `key`s; a template names them (`q`, `sort`, `page`, `selected`, `section`). Without a\n * `urlKey` the state is plain component state, which is what a gallery card and a design surface want.\n *\n * @param key The query-string parameter, or undefined to keep the state local.\n * @param fallback The value used when the address has none.\n * @returns The value and its setter.\n */\nexport function useUrlState(key: string | undefined, fallback: string | undefined): [string | undefined, (value: string | undefined) => void] {\n const [value, setValue] = useState<string | undefined>(() => (key === undefined ? fallback : readUrlParameter(key) ?? fallback));\n\n useEffect(() => {\n if (key === undefined) return;\n const restore = () => setValue(readUrlParameter(key) ?? fallback);\n window.addEventListener('popstate', restore);\n return () => window.removeEventListener('popstate', restore);\n }, [key, fallback]);\n\n const update = useCallback((next: string | undefined) => {\n setValue(next);\n if (key !== undefined) writeUrlParameter(key, next);\n }, [key]);\n\n return [value, update];\n}\n"],"names":["readUrlParameter","name","window","undefined","value","URLSearchParams","location","search","get","writeUrlParameter","parameters","delete","set","query","toString","history","replaceState","state","pathname","length","hash","useUrlState","key","fallback","setValue","useState","useEffect","restore","addEventListener","removeEventListener","update","useCallback","next"],"mappings":";;;;AAAA;AACA;AAIA,0IACO,SAASA,gBAAAA,CAAiBC,IAAY,EAAA;IACzC,IAAI,OAAOC,MAAAA,KAAW,WAAA,EAAa,OAAOC,SAAAA;IAC1C,MAAMC,KAAAA,GAAQ,IAAIC,eAAAA,CAAgBH,MAAAA,CAAOI,QAAQ,CAACC,MAAM,CAAA,CAAEC,GAAG,CAACP,IAAAA,CAAAA;IAC9D,OAAOG,KAAAA,KAAU,OAAOD,SAAAA,GAAYC,KAAAA;AACxC;AAEA,gIACO,SAASK,iBAAAA,CAAkBR,IAAY,EAAEG,KAAyB,EAAA;IACrE,IAAI,OAAOF,WAAW,WAAA,EAAa;AACnC,IAAA,MAAMQ,aAAa,IAAIL,eAAAA,CAAgBH,MAAAA,CAAOI,QAAQ,CAACC,MAAM,CAAA;AAC7D,IAAA,IAAIH,UAAUD,SAAAA,IAAaC,KAAAA,KAAU,EAAA,EAAIM,UAAAA,CAAWC,MAAM,CAACV,IAAAA,CAAAA;SACtDS,UAAAA,CAAWE,GAAG,CAACX,IAAAA,EAAMG,KAAAA,CAAAA;IAE1B,MAAMS,KAAAA,GAAQH,WAAWI,QAAQ,EAA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QAAAA,KAAAA;AAAO0B,QAAAA;AAAO,KAAA;AAC1B;;;;"}
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /** The width below which a screen is a phone's: the collapse rules of Part B 1.3 (list to cards, master-detail to stack) apply under it. */ const compactQuery = '(max-width: 40rem)';
8
+ /** Whether the viewport is phone-wide, kept up to date. Without `matchMedia` (a test environment, server rendering) it is false, so the full layout renders. */ function useCompactWidth() {
9
+ const [compact, setCompact] = react.useState(()=>typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(compactQuery).matches);
10
+ react.useEffect(()=>{
11
+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;
12
+ const query = window.matchMedia(compactQuery);
13
+ const update = ()=>setCompact(query.matches);
14
+ update();
15
+ query.addEventListener('change', update);
16
+ return ()=>query.removeEventListener('change', update);
17
+ }, []);
18
+ return compact;
19
+ }
20
+
21
+ exports.compactQuery = compactQuery;
22
+ exports.useCompactWidth = useCompactWidth;
23
+ //# sourceMappingURL=useCompactWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCompactWidth.js","sources":["../../../foundation/useCompactWidth.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 { useEffect, useState } from 'react';\n\n/** The width below which a screen is a phone's: the collapse rules of Part B 1.3 (list to cards, master-detail to stack) apply under it. */\nexport const compactQuery = '(max-width: 40rem)';\n\n/** Whether the viewport is phone-wide, kept up to date. Without `matchMedia` (a test environment, server rendering) it is false, so the full layout renders. */\nexport function useCompactWidth(): boolean {\n const [compact, setCompact] = useState(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(compactQuery).matches);\n\n useEffect(() => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;\n const query = window.matchMedia(compactQuery);\n const update = () => setCompact(query.matches);\n update();\n query.addEventListener('change', update);\n return () => query.removeEventListener('change', update);\n }, []);\n\n return compact;\n}\n"],"names":["compactQuery","useCompactWidth","compact","setCompact","useState","window","matchMedia","matches","useEffect","query","update","addEventListener","removeEventListener"],"mappings":";;;;AAAA;AACA;AAIA,6IACO,MAAMA,YAAAA,GAAe;AAE5B,iKACO,SAASC,eAAAA,GAAAA;AACZ,IAAA,MAAM,CAACC,OAAAA,EAASC,UAAAA,CAAW,GAAGC,cAAAA,CAAS,IAAM,OAAOC,MAAAA,KAAW,WAAA,IAAe,OAAOA,MAAAA,CAAOC,UAAU,KAAK,UAAA,IAAcD,OAAOC,UAAU,CAACN,cAAcO,OAAO,CAAA;IAEhKC,eAAAA,CAAU,IAAA;AACN,QAAA,IAAI,OAAOH,MAAAA,KAAW,WAAA,IAAe,OAAOA,MAAAA,CAAOC,UAAU,KAAK,UAAA,EAAY;QAC9E,MAAMG,KAAAA,GAAQJ,MAAAA,CAAOC,UAAU,CAACN,YAAAA,CAAAA;AAChC,QAAA,MAAMU,MAAAA,GAAS,IAAMP,UAAAA,CAAWM,KAAAA,CAAMF,OAAO,CAAA;AAC7CG,QAAAA,MAAAA,EAAAA;QACAD,KAAAA,CAAME,gBAAgB,CAAC,QAAA,EAAUD,MAAAA,CAAAA;AACjC,QAAA,OAAO,IAAMD,KAAAA,CAAMG,mBAAmB,CAAC,QAAA,EAAUF,MAAAA,CAAAA;AACrD,IAAA,CAAA,EAAG,EAAE,CAAA;IAEL,OAAOR,OAAAA;AACX;;;"}
@@ -0,0 +1,50 @@
1
+ 'use strict';
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
+ /** One step of a wizard. */ /** Where a step stands for the person going through the wizard. */ var StepStatus = /*#__PURE__*/ function(StepStatus) {
6
+ StepStatus["Completed"] = "completed";
7
+ StepStatus["Current"] = "current";
8
+ StepStatus["Upcoming"] = "upcoming";
9
+ return StepStatus;
10
+ }({});
11
+ /** Reads steps, dropping those without an id and repeated ids. */ function readWizardSteps(value) {
12
+ if (!Array.isArray(value)) return [];
13
+ const seen = new Set();
14
+ return value.flatMap((entry)=>{
15
+ if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return [];
16
+ const { id, label, valid } = entry;
17
+ if (typeof id !== 'string' || id.length === 0 || seen.has(id)) return [];
18
+ seen.add(id);
19
+ return [
20
+ {
21
+ id,
22
+ label: typeof label === 'string' && label.length > 0 ? label : id,
23
+ valid: valid !== false
24
+ }
25
+ ];
26
+ });
27
+ }
28
+ /** The step to show: the requested one when it exists and every step before it is completed, else the furthest step that is reachable. A refresh can never land past a step that was not done. */ function reachableStep(steps, completed, requested) {
29
+ const wanted = steps.findIndex((step)=>step.id === requested);
30
+ let furthest = 0;
31
+ while(furthest < steps.length - 1 && completed.has(steps[furthest].id))furthest++;
32
+ return steps[wanted >= 0 && wanted <= furthest ? wanted : furthest]?.id;
33
+ }
34
+ /** The status of a step: the current one, a completed one (revisitable), or upcoming. */ function statusOf(completed, current, id) {
35
+ if (id === current) return "current";
36
+ return completed.has(id) ? "completed" : "upcoming";
37
+ }
38
+ /** Whether a step may be opened from the progress indicator: a completed one, the current one, or the next one when the current is done. */ function canOpen(steps, completed, id) {
39
+ const index = steps.findIndex((step)=>step.id === id);
40
+ return index === 0 || steps.slice(0, index).every((step)=>completed.has(step.id));
41
+ }
42
+ /** The step before or after another, or undefined at either end. */ const neighbour = (steps, id, direction)=>steps[steps.findIndex((step)=>step.id === id) + direction];
43
+
44
+ exports.StepStatus = StepStatus;
45
+ exports.canOpen = canOpen;
46
+ exports.neighbour = neighbour;
47
+ exports.reachableStep = reachableStep;
48
+ exports.readWizardSteps = readWizardSteps;
49
+ exports.statusOf = statusOf;
50
+ //# sourceMappingURL=wizardModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wizardModel.js","sources":["../../../foundation/wizardModel.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/** One step of a wizard. */\nexport interface WizardStep {\n id: string;\n label: string;\n /** Whether the step's own fields are valid; a step that is not valid blocks Next. Defaults to true. */\n valid: boolean;\n}\n\n/** Where a step stands for the person going through the wizard. */\nexport enum StepStatus {\n Completed = 'completed',\n Current = 'current',\n Upcoming = 'upcoming',\n}\n\n/** Reads steps, dropping those without an id and repeated ids. */\nexport function readWizardSteps(value: unknown): WizardStep[] {\n if (!Array.isArray(value)) return [];\n\n const seen = new Set<string>();\n return value.flatMap((entry): WizardStep[] => {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return [];\n const { id, label, valid } = entry as Record<string, unknown>;\n if (typeof id !== 'string' || id.length === 0 || seen.has(id)) return [];\n seen.add(id);\n return [{ id, label: typeof label === 'string' && label.length > 0 ? label : id, valid: valid !== false }];\n });\n}\n\n/** The step to show: the requested one when it exists and every step before it is completed, else the furthest step that is reachable. A refresh can never land past a step that was not done. */\nexport function reachableStep(steps: WizardStep[], completed: ReadonlySet<string>, requested: string | undefined): string | undefined {\n const wanted = steps.findIndex(step => step.id === requested);\n let furthest = 0;\n while (furthest < steps.length - 1 && completed.has(steps[furthest].id)) furthest++;\n return steps[wanted >= 0 && wanted <= furthest ? wanted : furthest]?.id;\n}\n\n/** The status of a step: the current one, a completed one (revisitable), or upcoming. */\nexport function statusOf(completed: ReadonlySet<string>, current: string | undefined, id: string): StepStatus {\n if (id === current) return StepStatus.Current;\n return completed.has(id) ? StepStatus.Completed : StepStatus.Upcoming;\n}\n\n/** Whether a step may be opened from the progress indicator: a completed one, the current one, or the next one when the current is done. */\nexport function canOpen(steps: WizardStep[], completed: ReadonlySet<string>, id: string): boolean {\n const index = steps.findIndex(step => step.id === id);\n return index === 0 || steps.slice(0, index).every(step => completed.has(step.id));\n}\n\n/** The step before or after another, or undefined at either end. */\nexport const neighbour = (steps: WizardStep[], id: string | undefined, direction: -1 | 1): WizardStep | undefined => steps[steps.findIndex(step => step.id === id) + direction];\n"],"names":["StepStatus","readWizardSteps","value","Array","isArray","seen","Set","flatMap","entry","id","label","valid","length","has","add","reachableStep","steps","completed","requested","wanted","findIndex","step","furthest","statusOf","current","canOpen","index","slice","every","neighbour","direction"],"mappings":";;AAAA;AACA;AAEA,iGASO,IAAA,UAAKA,iBAAAA,SAAAA,UAAAA,EAAAA;;;;AAAAA,IAAAA,OAAAA,UAAAA;AAIX,CAAA,CAAA,EAAA;AAED,mEACO,SAASC,eAAAA,CAAgBC,KAAc,EAAA;AAC1C,IAAA,IAAI,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO,EAAE;AAEpC,IAAA,MAAMG,OAAO,IAAIC,GAAAA,EAAAA;IACjB,OAAOJ,KAAAA,CAAMK,OAAO,CAAC,CAACC,KAAAA,GAAAA;QAClB,IAAI,OAAOA,KAAAA,KAAU,QAAA,IAAYA,KAAAA,KAAU,IAAA,IAAQL,MAAMC,OAAO,CAACI,KAAAA,CAAAA,EAAQ,OAAO,EAAE;AAClF,QAAA,MAAM,EAAEC,EAAE,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGH,KAAAA;AAC7B,QAAA,IAAI,OAAOC,EAAAA,KAAO,QAAA,IAAYA,EAAAA,CAAGG,MAAM,KAAK,CAAA,IAAKP,IAAAA,CAAKQ,GAAG,CAACJ,EAAAA,CAAAA,EAAK,OAAO,EAAE;AACxEJ,QAAAA,IAAAA,CAAKS,GAAG,CAACL,EAAAA,CAAAA;QACT,OAAO;AAAC,YAAA;AAAEA,gBAAAA,EAAAA;AAAIC,gBAAAA,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,IAAYA,MAAME,MAAM,GAAG,IAAIF,KAAAA,GAAQD,EAAAA;AAAIE,gBAAAA,KAAAA,EAAOA,KAAAA,KAAU;AAAM;AAAE,SAAA;AAC9G,IAAA,CAAA,CAAA;AACJ;AAEA,mMACO,SAASI,aAAAA,CAAcC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