@cratis/scene.blueprint.default 4.40.0 → 4.42.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 (251) hide show
  1. package/ComponentName.ts +9 -0
  2. package/defaultBlueprint.ts +1 -0
  3. package/defaultBlueprintComponents.ts +4 -1
  4. package/dist/cjs/ComponentName.js +3 -0
  5. package/dist/cjs/ComponentName.js.map +1 -1
  6. package/dist/cjs/defaultBlueprint.js +20 -1
  7. package/dist/cjs/defaultBlueprint.js.map +1 -1
  8. package/dist/cjs/defaultBlueprintComponentMetadata.js +11 -0
  9. package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
  10. package/dist/cjs/defaultBlueprintComponents.js +17 -0
  11. package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
  12. package/dist/cjs/foundation/ActionButton.js.map +1 -1
  13. package/dist/cjs/foundation/ActionButtonControl.js +46 -0
  14. package/dist/cjs/foundation/ActionButtonControl.js.map +1 -0
  15. package/dist/cjs/foundation/DialogFrame.js +196 -0
  16. package/dist/cjs/foundation/DialogFrame.js.map +1 -0
  17. package/dist/cjs/foundation/FormScreenBody.js +13 -3
  18. package/dist/cjs/foundation/FormScreenBody.js.map +1 -1
  19. package/dist/cjs/foundation/Notice.js +51 -0
  20. package/dist/cjs/foundation/Notice.js.map +1 -0
  21. package/dist/cjs/foundation/formModel.js +1 -0
  22. package/dist/cjs/foundation/formModel.js.map +1 -1
  23. package/dist/cjs/foundation/foundationComponentMetadata.js +22 -0
  24. package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
  25. package/dist/cjs/foundation/foundationDescriptors.js +89 -0
  26. package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
  27. package/dist/cjs/foundation/foundationSamples.js +29 -0
  28. package/dist/cjs/foundation/foundationSamples.js.map +1 -1
  29. package/dist/cjs/foundation/foundationStrings.js +3 -1
  30. package/dist/cjs/foundation/foundationStrings.js.map +1 -1
  31. package/dist/cjs/foundation/templates/boardScreenTemplate.js +76 -0
  32. package/dist/cjs/foundation/templates/boardScreenTemplate.js.map +1 -0
  33. package/dist/cjs/foundation/templates/dashboardScreenTemplate.js +128 -0
  34. package/dist/cjs/foundation/templates/dashboardScreenTemplate.js.map +1 -0
  35. package/dist/cjs/foundation/templates/dialogTemplates.js +254 -0
  36. package/dist/cjs/foundation/templates/dialogTemplates.js.map +1 -0
  37. package/dist/cjs/foundation/templates/formScreenTemplate.js +71 -0
  38. package/dist/cjs/foundation/templates/formScreenTemplate.js.map +1 -0
  39. package/dist/cjs/foundation/templates/index.js +57 -0
  40. package/dist/cjs/foundation/templates/index.js.map +1 -0
  41. package/dist/cjs/foundation/templates/listScreenTemplate.js +124 -0
  42. package/dist/cjs/foundation/templates/listScreenTemplate.js.map +1 -0
  43. package/dist/cjs/foundation/templates/masterDetailScreenTemplate.js +79 -0
  44. package/dist/cjs/foundation/templates/masterDetailScreenTemplate.js.map +1 -0
  45. package/dist/cjs/foundation/templates/recordPageTemplate.js +137 -0
  46. package/dist/cjs/foundation/templates/recordPageTemplate.js.map +1 -0
  47. package/dist/cjs/foundation/templates/stateScreenTemplates.js +252 -0
  48. package/dist/cjs/foundation/templates/stateScreenTemplates.js.map +1 -0
  49. package/dist/cjs/foundation/templates/templateParts.js +38 -0
  50. package/dist/cjs/foundation/templates/templateParts.js.map +1 -0
  51. package/dist/cjs/foundation/templates/wizardScreenTemplate.js +95 -0
  52. package/dist/cjs/foundation/templates/wizardScreenTemplate.js.map +1 -0
  53. package/dist/cjs/foundation/templates/workspaceScreenTemplate.js +62 -0
  54. package/dist/cjs/foundation/templates/workspaceScreenTemplate.js.map +1 -0
  55. package/dist/cjs/gallery/GalleryDialogPreview.js +62 -0
  56. package/dist/cjs/gallery/GalleryDialogPreview.js.map +1 -0
  57. package/dist/cjs/gallery/GalleryScreenPreview.js +78 -4
  58. package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -1
  59. package/dist/cjs/gallery/applicationChrome.js +18 -1
  60. package/dist/cjs/gallery/applicationChrome.js.map +1 -1
  61. package/dist/cjs/gallery/composeScreen.js +5 -3
  62. package/dist/cjs/gallery/composeScreen.js.map +1 -1
  63. package/dist/cjs/gallery/dialogTemplates.js +41 -36
  64. package/dist/cjs/gallery/dialogTemplates.js.map +1 -1
  65. package/dist/cjs/gallery/screens.js +87 -3
  66. package/dist/cjs/gallery/screens.js.map +1 -1
  67. package/dist/cjs/index.js +61 -5
  68. package/dist/cjs/index.js.map +1 -1
  69. package/dist/esm/ComponentName.d.ts +3 -0
  70. package/dist/esm/ComponentName.d.ts.map +1 -1
  71. package/dist/esm/ComponentName.js +3 -0
  72. package/dist/esm/ComponentName.js.map +1 -1
  73. package/dist/esm/defaultBlueprint.d.ts.map +1 -1
  74. package/dist/esm/defaultBlueprint.js +20 -1
  75. package/dist/esm/defaultBlueprint.js.map +1 -1
  76. package/dist/esm/defaultBlueprintComponentMetadata.js +11 -0
  77. package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
  78. package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
  79. package/dist/esm/defaultBlueprintComponents.js +17 -0
  80. package/dist/esm/defaultBlueprintComponents.js.map +1 -1
  81. package/dist/esm/foundation/ActionButton.d.ts +1 -1
  82. package/dist/esm/foundation/ActionButton.d.ts.map +1 -1
  83. package/dist/esm/foundation/ActionButton.js.map +1 -1
  84. package/dist/esm/foundation/ActionButtonControl.d.ts +3 -0
  85. package/dist/esm/foundation/ActionButtonControl.d.ts.map +1 -0
  86. package/dist/esm/foundation/ActionButtonControl.js +44 -0
  87. package/dist/esm/foundation/ActionButtonControl.js.map +1 -0
  88. package/dist/esm/foundation/DialogFrame.d.ts +14 -0
  89. package/dist/esm/foundation/DialogFrame.d.ts.map +1 -0
  90. package/dist/esm/foundation/DialogFrame.js +190 -0
  91. package/dist/esm/foundation/DialogFrame.js.map +1 -0
  92. package/dist/esm/foundation/FormScreenBody.d.ts.map +1 -1
  93. package/dist/esm/foundation/FormScreenBody.js +13 -3
  94. package/dist/esm/foundation/FormScreenBody.js.map +1 -1
  95. package/dist/esm/foundation/Notice.d.ts +3 -0
  96. package/dist/esm/foundation/Notice.d.ts.map +1 -0
  97. package/dist/esm/foundation/Notice.js +49 -0
  98. package/dist/esm/foundation/Notice.js.map +1 -0
  99. package/dist/esm/foundation/formModel.d.ts +2 -1
  100. package/dist/esm/foundation/formModel.d.ts.map +1 -1
  101. package/dist/esm/foundation/formModel.js +1 -0
  102. package/dist/esm/foundation/formModel.js.map +1 -1
  103. package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
  104. package/dist/esm/foundation/foundationComponentMetadata.js +22 -0
  105. package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -1
  106. package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -1
  107. package/dist/esm/foundation/foundationDescriptors.js +89 -0
  108. package/dist/esm/foundation/foundationDescriptors.js.map +1 -1
  109. package/dist/esm/foundation/foundationSamples.d.ts.map +1 -1
  110. package/dist/esm/foundation/foundationSamples.js +29 -0
  111. package/dist/esm/foundation/foundationSamples.js.map +1 -1
  112. package/dist/esm/foundation/foundationStrings.d.ts +2 -0
  113. package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
  114. package/dist/esm/foundation/foundationStrings.js +3 -1
  115. package/dist/esm/foundation/foundationStrings.js.map +1 -1
  116. package/dist/esm/foundation/index.d.ts +4 -0
  117. package/dist/esm/foundation/index.d.ts.map +1 -1
  118. package/dist/esm/foundation/index.js +4 -0
  119. package/dist/esm/foundation/index.js.map +1 -1
  120. package/dist/esm/foundation/templates/boardScreenTemplate.d.ts +3 -0
  121. package/dist/esm/foundation/templates/boardScreenTemplate.d.ts.map +1 -0
  122. package/dist/esm/foundation/templates/boardScreenTemplate.js +74 -0
  123. package/dist/esm/foundation/templates/boardScreenTemplate.js.map +1 -0
  124. package/dist/esm/foundation/templates/dashboardScreenTemplate.d.ts +3 -0
  125. package/dist/esm/foundation/templates/dashboardScreenTemplate.d.ts.map +1 -0
  126. package/dist/esm/foundation/templates/dashboardScreenTemplate.js +126 -0
  127. package/dist/esm/foundation/templates/dashboardScreenTemplate.js.map +1 -0
  128. package/dist/esm/foundation/templates/dialogTemplates.d.ts +20 -0
  129. package/dist/esm/foundation/templates/dialogTemplates.d.ts.map +1 -0
  130. package/dist/esm/foundation/templates/dialogTemplates.js +243 -0
  131. package/dist/esm/foundation/templates/dialogTemplates.js.map +1 -0
  132. package/dist/esm/foundation/templates/formScreenTemplate.d.ts +3 -0
  133. package/dist/esm/foundation/templates/formScreenTemplate.d.ts.map +1 -0
  134. package/dist/esm/foundation/templates/formScreenTemplate.js +69 -0
  135. package/dist/esm/foundation/templates/formScreenTemplate.js.map +1 -0
  136. package/dist/esm/foundation/templates/index.d.ts +13 -0
  137. package/dist/esm/foundation/templates/index.d.ts.map +1 -0
  138. package/dist/esm/foundation/templates/index.js +27 -0
  139. package/dist/esm/foundation/templates/index.js.map +1 -0
  140. package/dist/esm/foundation/templates/listScreenTemplate.d.ts +3 -0
  141. package/dist/esm/foundation/templates/listScreenTemplate.d.ts.map +1 -0
  142. package/dist/esm/foundation/templates/listScreenTemplate.js +122 -0
  143. package/dist/esm/foundation/templates/listScreenTemplate.js.map +1 -0
  144. package/dist/esm/foundation/templates/masterDetailScreenTemplate.d.ts +3 -0
  145. package/dist/esm/foundation/templates/masterDetailScreenTemplate.d.ts.map +1 -0
  146. package/dist/esm/foundation/templates/masterDetailScreenTemplate.js +77 -0
  147. package/dist/esm/foundation/templates/masterDetailScreenTemplate.js.map +1 -0
  148. package/dist/esm/foundation/templates/recordPageTemplate.d.ts +3 -0
  149. package/dist/esm/foundation/templates/recordPageTemplate.d.ts.map +1 -0
  150. package/dist/esm/foundation/templates/recordPageTemplate.js +135 -0
  151. package/dist/esm/foundation/templates/recordPageTemplate.js.map +1 -0
  152. package/dist/esm/foundation/templates/stateScreenTemplates.d.ts +8 -0
  153. package/dist/esm/foundation/templates/stateScreenTemplates.d.ts.map +1 -0
  154. package/dist/esm/foundation/templates/stateScreenTemplates.js +245 -0
  155. package/dist/esm/foundation/templates/stateScreenTemplates.js.map +1 -0
  156. package/dist/esm/foundation/templates/templateParts.d.ts +6 -0
  157. package/dist/esm/foundation/templates/templateParts.d.ts.map +1 -0
  158. package/dist/esm/foundation/templates/templateParts.js +33 -0
  159. package/dist/esm/foundation/templates/templateParts.js.map +1 -0
  160. package/dist/esm/foundation/templates/wizardScreenTemplate.d.ts +3 -0
  161. package/dist/esm/foundation/templates/wizardScreenTemplate.d.ts.map +1 -0
  162. package/dist/esm/foundation/templates/wizardScreenTemplate.js +93 -0
  163. package/dist/esm/foundation/templates/wizardScreenTemplate.js.map +1 -0
  164. package/dist/esm/foundation/templates/workspaceScreenTemplate.d.ts +3 -0
  165. package/dist/esm/foundation/templates/workspaceScreenTemplate.d.ts.map +1 -0
  166. package/dist/esm/foundation/templates/workspaceScreenTemplate.js +60 -0
  167. package/dist/esm/foundation/templates/workspaceScreenTemplate.js.map +1 -0
  168. package/dist/esm/gallery/FoundationDialogs.stories.d.ts +35 -0
  169. package/dist/esm/gallery/FoundationDialogs.stories.d.ts.map +1 -0
  170. package/dist/esm/gallery/FoundationDialogs.stories.js +38 -0
  171. package/dist/esm/gallery/FoundationDialogs.stories.js.map +1 -0
  172. package/dist/esm/gallery/GalleryDialogPreview.d.ts +17 -0
  173. package/dist/esm/gallery/GalleryDialogPreview.d.ts.map +1 -0
  174. package/dist/esm/gallery/GalleryDialogPreview.js +59 -0
  175. package/dist/esm/gallery/GalleryDialogPreview.js.map +1 -0
  176. package/dist/esm/gallery/GalleryScreenPreview.d.ts +13 -2
  177. package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -1
  178. package/dist/esm/gallery/GalleryScreenPreview.js +77 -5
  179. package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -1
  180. package/dist/esm/gallery/applicationChrome.d.ts.map +1 -1
  181. package/dist/esm/gallery/applicationChrome.js +18 -1
  182. package/dist/esm/gallery/applicationChrome.js.map +1 -1
  183. package/dist/esm/gallery/composeScreen.d.ts.map +1 -1
  184. package/dist/esm/gallery/composeScreen.js +5 -3
  185. package/dist/esm/gallery/composeScreen.js.map +1 -1
  186. package/dist/esm/gallery/dialogTemplates.d.ts.map +1 -1
  187. package/dist/esm/gallery/dialogTemplates.js +42 -37
  188. package/dist/esm/gallery/dialogTemplates.js.map +1 -1
  189. package/dist/esm/gallery/index.d.ts +1 -0
  190. package/dist/esm/gallery/index.d.ts.map +1 -1
  191. package/dist/esm/gallery/index.js +1 -0
  192. package/dist/esm/gallery/index.js.map +1 -1
  193. package/dist/esm/gallery/screens.d.ts.map +1 -1
  194. package/dist/esm/gallery/screens.js +87 -3
  195. package/dist/esm/gallery/screens.js.map +1 -1
  196. package/dist/esm/index.js +17 -1
  197. package/dist/esm/index.js.map +1 -1
  198. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  199. package/foundation/ActionButton.tsx +1 -1
  200. package/foundation/ActionButtonControl.tsx +37 -0
  201. package/foundation/DialogFrame.tsx +138 -0
  202. package/foundation/FormScreenBody.tsx +6 -3
  203. package/foundation/Notice.tsx +33 -0
  204. package/foundation/formModel.ts +1 -0
  205. package/foundation/foundationComponentMetadata.ts +3 -0
  206. package/foundation/foundationDescriptors.ts +41 -0
  207. package/foundation/foundationSamples.ts +3 -0
  208. package/foundation/foundationStrings.ts +2 -0
  209. package/foundation/index.ts +4 -0
  210. package/foundation/templates/boardScreenTemplate.ts +28 -0
  211. package/foundation/templates/dashboardScreenTemplate.ts +37 -0
  212. package/foundation/templates/dialogTemplates.ts +114 -0
  213. package/foundation/templates/formScreenTemplate.ts +28 -0
  214. package/foundation/templates/index.ts +28 -0
  215. package/foundation/templates/listScreenTemplate.ts +37 -0
  216. package/foundation/templates/masterDetailScreenTemplate.ts +28 -0
  217. package/foundation/templates/recordPageTemplate.ts +36 -0
  218. package/foundation/templates/stateScreenTemplates.ts +107 -0
  219. package/foundation/templates/templateParts.ts +30 -0
  220. package/foundation/templates/wizardScreenTemplate.ts +33 -0
  221. package/foundation/templates/workspaceScreenTemplate.ts +27 -0
  222. package/gallery/FoundationDialogs.stories.tsx +74 -0
  223. package/gallery/GalleryDialogPreview.tsx +68 -0
  224. package/gallery/GalleryScreenPreview.tsx +64 -5
  225. package/gallery/applicationChrome.ts +6 -1
  226. package/gallery/composeScreen.ts +4 -2
  227. package/gallery/dialogTemplates.ts +22 -17
  228. package/gallery/index.ts +1 -0
  229. package/gallery/screens.ts +18 -2
  230. package/package.json +10 -8
  231. package/sampleData/foundation-en.json +661 -0
  232. package/shell/layout.css +219 -0
  233. package/thumbnails/BoardScreen.svg +15 -0
  234. package/thumbnails/ConfirmDialog.svg +12 -0
  235. package/thumbnails/DashboardScreen.svg +18 -0
  236. package/thumbnails/DetailDialog.svg +11 -0
  237. package/thumbnails/ErrorScreen.svg +11 -0
  238. package/thumbnails/FilterDialog.svg +16 -0
  239. package/thumbnails/ForbiddenScreen.svg +10 -0
  240. package/thumbnails/FormDialog.svg +12 -0
  241. package/thumbnails/FormScreen.svg +14 -0
  242. package/thumbnails/ListScreen.svg +16 -0
  243. package/thumbnails/LoginScreen.svg +12 -0
  244. package/thumbnails/LookupDialog.svg +13 -0
  245. package/thumbnails/MasterDetailScreen.svg +22 -0
  246. package/thumbnails/NotFoundScreen.svg +9 -0
  247. package/thumbnails/QuickCreateDialog.svg +12 -0
  248. package/thumbnails/RecordPage.svg +17 -0
  249. package/thumbnails/SideSheet.svg +13 -0
  250. package/thumbnails/WizardScreen.svg +16 -0
  251. package/thumbnails/WorkspaceScreen.svg +12 -0
@@ -0,0 +1,252 @@
1
+ 'use strict';
2
+
3
+ var elements = require('../../gallery/elements.js');
4
+ var dialogTemplates = require('./dialogTemplates.js');
5
+ var flowBuilders = require('../../layouts/flowBuilders.js');
6
+ var templateParts = require('./templateParts.js');
7
+
8
+ // Copyright (c) Cratis. All rights reserved.
9
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
10
+ const metadataOf = (name, type)=>({
11
+ ...templateParts.foundationTemplateProvenance,
12
+ type,
13
+ category: `Foundation / ${type}`,
14
+ thumbnail: templateParts.thumbnailOf(name)
15
+ });
16
+ /** The way back every state screen offers: home, which is always somewhere the person is allowed to be. */ const backToDashboard = (id)=>dialogTemplates.actionButton(id, {
17
+ label: 'Back to the dashboard',
18
+ emphasis: 'secondary',
19
+ targetScreen: 'DashboardScreen'
20
+ });
21
+ /**
22
+ * The sign-in screen: the logo, the sign-in form, a slot for the identity providers the application offers (`providers` - buttons, each starting its
23
+ * provider's flow, which the application fills), an error area that is a live region and says why a sign-in failed, and a link to help. The form is
24
+ * made of the foundation's form components, so it validates and announces like every other form.
25
+ */ const loginScreenTemplate = {
26
+ name: 'LoginScreen',
27
+ fitsSlot: 'content',
28
+ slots: [
29
+ {
30
+ name: 'logo'
31
+ },
32
+ {
33
+ name: 'error'
34
+ },
35
+ {
36
+ name: 'form'
37
+ },
38
+ {
39
+ name: 'providers'
40
+ },
41
+ {
42
+ name: 'help'
43
+ }
44
+ ],
45
+ arrangement: {
46
+ root: flowBuilders.column([
47
+ flowBuilders.slotLeaf('logo'),
48
+ flowBuilders.slotLeaf('error'),
49
+ flowBuilders.slotLeaf('form'),
50
+ flowBuilders.slotLeaf('providers'),
51
+ flowBuilders.slotLeaf('help')
52
+ ], 16)
53
+ },
54
+ content: {
55
+ logo: [
56
+ elements.externalComponent('login-logo', 'logo', {
57
+ label: 'Contoso',
58
+ initials: 'C'
59
+ })
60
+ ],
61
+ error: [
62
+ templateParts.component('login-error', 'notice', {
63
+ text: templateParts.fromQuery('SignInError', '0.message'),
64
+ tone: 'danger'
65
+ })
66
+ ],
67
+ form: [
68
+ templateParts.component('login-form', 'formScreenBody', {
69
+ mode: 'create',
70
+ saveAndNew: false,
71
+ strings: {
72
+ formSave: 'Sign in',
73
+ formCancel: 'Clear'
74
+ },
75
+ sections: templateParts.fromQuery('SignInSections'),
76
+ values: templateParts.fromQuery('SignInValues', '0'),
77
+ errors: templateParts.fromQuery('FormErrors', '0')
78
+ })
79
+ ],
80
+ providers: [
81
+ elements.panel('login-providers', [
82
+ dialogTemplates.actionButton('login-microsoft', {
83
+ label: 'Continue with Microsoft',
84
+ emphasis: 'secondary'
85
+ }),
86
+ dialogTemplates.actionButton('login-github', {
87
+ label: 'Continue with GitHub',
88
+ emphasis: 'secondary'
89
+ })
90
+ ])
91
+ ],
92
+ help: [
93
+ dialogTemplates.actionButton('login-help', {
94
+ label: 'Need help signing in?',
95
+ emphasis: 'quiet',
96
+ targetScreen: 'ForbiddenScreen'
97
+ })
98
+ ]
99
+ },
100
+ displayName: 'Sign in',
101
+ description: 'A sign-in form with a slot for identity providers, an error area and a help link.',
102
+ metadata: metadataOf('LoginScreen', 'Auth')
103
+ };
104
+ /** The wrong address: what happened in words, a search, and the way home. */ const notFoundScreenTemplate = {
105
+ name: 'NotFoundScreen',
106
+ fitsSlot: 'content',
107
+ slots: [
108
+ {
109
+ name: 'message'
110
+ },
111
+ {
112
+ name: 'search'
113
+ },
114
+ {
115
+ name: 'actions'
116
+ }
117
+ ],
118
+ arrangement: {
119
+ root: flowBuilders.column([
120
+ flowBuilders.slotLeaf('message'),
121
+ flowBuilders.slotLeaf('search'),
122
+ flowBuilders.slotLeaf('actions')
123
+ ], 16)
124
+ },
125
+ content: {
126
+ message: [
127
+ templateParts.component('not-found-message', 'emptyState', {
128
+ icon: 'file',
129
+ headline: 'That page is not here',
130
+ hint: 'The link may be old, or the thing it pointed at may have been removed.'
131
+ })
132
+ ],
133
+ search: [
134
+ templateParts.component('not-found-search', 'globalSearch', {
135
+ label: 'Search the application',
136
+ placeholder: 'Search instead'
137
+ })
138
+ ],
139
+ actions: [
140
+ backToDashboard('not-found-home')
141
+ ]
142
+ },
143
+ displayName: 'Not found',
144
+ description: 'A wrong address explained, with a search and a link home.',
145
+ metadata: metadataOf('NotFoundScreen', 'State')
146
+ };
147
+ /**
148
+ * The refusal: signed in, and still not allowed. It says so and offers to ask for access, and it shows nothing of what was refused - the template binds
149
+ * no data at all, so there is nothing to leak.
150
+ */ const forbiddenScreenTemplate = {
151
+ name: 'ForbiddenScreen',
152
+ fitsSlot: 'content',
153
+ slots: [
154
+ {
155
+ name: 'message'
156
+ },
157
+ {
158
+ name: 'actions'
159
+ }
160
+ ],
161
+ arrangement: {
162
+ root: flowBuilders.column([
163
+ flowBuilders.slotLeaf('message'),
164
+ flowBuilders.slotLeaf('actions')
165
+ ], 16)
166
+ },
167
+ content: {
168
+ message: [
169
+ templateParts.component('forbidden-message', 'emptyState', {
170
+ icon: 'lock',
171
+ headline: 'You do not have access to this',
172
+ hint: 'Your account is signed in, but it is not allowed here. An administrator can change that.',
173
+ actionLabel: 'Request access'
174
+ })
175
+ ],
176
+ actions: [
177
+ backToDashboard('forbidden-home')
178
+ ]
179
+ },
180
+ displayName: 'Forbidden',
181
+ description: 'A refusal that offers to request access and shows none of what was refused.',
182
+ metadata: metadataOf('ForbiddenScreen', 'State')
183
+ };
184
+ /** The failure on our side: a plain message, a retry, and the support reference id a person can quote. */ const errorScreenTemplate = {
185
+ name: 'ErrorScreen',
186
+ fitsSlot: 'content',
187
+ slots: [
188
+ {
189
+ name: 'message'
190
+ },
191
+ {
192
+ name: 'reference'
193
+ },
194
+ {
195
+ name: 'actions'
196
+ }
197
+ ],
198
+ arrangement: {
199
+ root: flowBuilders.column([
200
+ flowBuilders.slotLeaf('message'),
201
+ flowBuilders.slotLeaf('reference'),
202
+ flowBuilders.slotLeaf('actions')
203
+ ], 16)
204
+ },
205
+ content: {
206
+ message: [
207
+ templateParts.component('error-message', 'emptyState', {
208
+ icon: 'alert',
209
+ headline: 'Something went wrong on our side',
210
+ hint: 'The team has been told. Nothing you were working on was lost.',
211
+ actionLabel: 'Try again'
212
+ })
213
+ ],
214
+ reference: [
215
+ elements.panel('error-reference', [
216
+ elements.externalComponent('error-reference-label', 'text', {
217
+ text: 'Support reference'
218
+ }),
219
+ elements.externalComponent('error-reference-id', 'text', {
220
+ text: templateParts.fromQuery('SupportReference', '0.id')
221
+ })
222
+ ])
223
+ ],
224
+ actions: [
225
+ backToDashboard('error-home')
226
+ ]
227
+ },
228
+ displayName: 'Error',
229
+ description: 'A generic failure with a retry and the support reference id to quote.',
230
+ metadata: metadataOf('ErrorScreen', 'State')
231
+ };
232
+ /** The four auth and state screens of Part B 2.11. The legacy `Login`, `NotFound`, `AccessDenied` and `Error` remain as they were. */ const stateScreenTemplates = [
233
+ loginScreenTemplate,
234
+ notFoundScreenTemplate,
235
+ forbiddenScreenTemplate,
236
+ errorScreenTemplate
237
+ ];
238
+ /** The earlier template each spec-named one stands beside: the old name keeps working, and is the alias of the new. */ const foundationTemplateAliases = {
239
+ LoginScreen: 'Login',
240
+ NotFoundScreen: 'NotFound',
241
+ ForbiddenScreen: 'AccessDenied',
242
+ ErrorScreen: 'Error',
243
+ QuickCreateDialog: 'FormDialog'
244
+ };
245
+
246
+ exports.errorScreenTemplate = errorScreenTemplate;
247
+ exports.forbiddenScreenTemplate = forbiddenScreenTemplate;
248
+ exports.foundationTemplateAliases = foundationTemplateAliases;
249
+ exports.loginScreenTemplate = loginScreenTemplate;
250
+ exports.notFoundScreenTemplate = notFoundScreenTemplate;
251
+ exports.stateScreenTemplates = stateScreenTemplates;
252
+ //# sourceMappingURL=stateScreenTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateScreenTemplates.js","sources":["../../../../foundation/templates/stateScreenTemplates.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, TemplateMetadata } from '@cratis/scene.model';\nimport { externalComponent, panel } from '../../gallery/elements';\nimport { actionButton } from './dialogTemplates';\nimport { column, slotLeaf } from '../../layouts/flowBuilders';\nimport { component, foundationTemplateProvenance, fromQuery, thumbnailOf } from './templateParts';\n\nconst metadataOf = (name: string, type: 'Auth' | 'State'): TemplateMetadata => ({ ...foundationTemplateProvenance, type, category: `Foundation / ${type}`, thumbnail: thumbnailOf(name) });\n\n/** The way back every state screen offers: home, which is always somewhere the person is allowed to be. */\nconst backToDashboard = (id: string) => actionButton(id, { label: 'Back to the dashboard', emphasis: 'secondary', targetScreen: 'DashboardScreen' });\n\n/**\n * The sign-in screen: the logo, the sign-in form, a slot for the identity providers the application offers (`providers` - buttons, each starting its\n * provider's flow, which the application fills), an error area that is a live region and says why a sign-in failed, and a link to help. The form is\n * made of the foundation's form components, so it validates and announces like every other form.\n */\nexport const loginScreenTemplate: ScreenTemplate = {\n name: 'LoginScreen',\n fitsSlot: 'content',\n slots: [{ name: 'logo' }, { name: 'error' }, { name: 'form' }, { name: 'providers' }, { name: 'help' }],\n arrangement: { root: column([slotLeaf('logo'), slotLeaf('error'), slotLeaf('form'), slotLeaf('providers'), slotLeaf('help')], 16) },\n content: {\n logo: [externalComponent('login-logo', 'logo', { label: 'Contoso', initials: 'C' })],\n error: [component('login-error', 'notice', { text: fromQuery('SignInError', '0.message'), tone: 'danger' })],\n form: [component('login-form', 'formScreenBody', {\n mode: 'create', saveAndNew: false, strings: { formSave: 'Sign in', formCancel: 'Clear' },\n sections: fromQuery('SignInSections'), values: fromQuery('SignInValues', '0'), errors: fromQuery('FormErrors', '0'),\n })],\n providers: [panel('login-providers', [actionButton('login-microsoft', { label: 'Continue with Microsoft', emphasis: 'secondary' }), actionButton('login-github', { label: 'Continue with GitHub', emphasis: 'secondary' })])],\n help: [actionButton('login-help', { label: 'Need help signing in?', emphasis: 'quiet', targetScreen: 'ForbiddenScreen' })],\n },\n displayName: 'Sign in',\n description: 'A sign-in form with a slot for identity providers, an error area and a help link.',\n metadata: metadataOf('LoginScreen', 'Auth'),\n};\n\n/** The wrong address: what happened in words, a search, and the way home. */\nexport const notFoundScreenTemplate: ScreenTemplate = {\n name: 'NotFoundScreen',\n fitsSlot: 'content',\n slots: [{ name: 'message' }, { name: 'search' }, { name: 'actions' }],\n arrangement: { root: column([slotLeaf('message'), slotLeaf('search'), slotLeaf('actions')], 16) },\n content: {\n message: [component('not-found-message', 'emptyState', { icon: 'file', headline: 'That page is not here', hint: 'The link may be old, or the thing it pointed at may have been removed.' })],\n search: [component('not-found-search', 'globalSearch', { label: 'Search the application', placeholder: 'Search instead' })],\n actions: [backToDashboard('not-found-home')],\n },\n displayName: 'Not found',\n description: 'A wrong address explained, with a search and a link home.',\n metadata: metadataOf('NotFoundScreen', 'State'),\n};\n\n/**\n * The refusal: signed in, and still not allowed. It says so and offers to ask for access, and it shows nothing of what was refused - the template binds\n * no data at all, so there is nothing to leak.\n */\nexport const forbiddenScreenTemplate: ScreenTemplate = {\n name: 'ForbiddenScreen',\n fitsSlot: 'content',\n slots: [{ name: 'message' }, { name: 'actions' }],\n arrangement: { root: column([slotLeaf('message'), slotLeaf('actions')], 16) },\n content: {\n message: [component('forbidden-message', 'emptyState', {\n icon: 'lock', headline: 'You do not have access to this', hint: 'Your account is signed in, but it is not allowed here. An administrator can change that.', actionLabel: 'Request access',\n })],\n actions: [backToDashboard('forbidden-home')],\n },\n displayName: 'Forbidden',\n description: 'A refusal that offers to request access and shows none of what was refused.',\n metadata: metadataOf('ForbiddenScreen', 'State'),\n};\n\n/** The failure on our side: a plain message, a retry, and the support reference id a person can quote. */\nexport const errorScreenTemplate: ScreenTemplate = {\n name: 'ErrorScreen',\n fitsSlot: 'content',\n slots: [{ name: 'message' }, { name: 'reference' }, { name: 'actions' }],\n arrangement: { root: column([slotLeaf('message'), slotLeaf('reference'), slotLeaf('actions')], 16) },\n content: {\n message: [component('error-message', 'emptyState', {\n icon: 'alert', headline: 'Something went wrong on our side', hint: 'The team has been told. Nothing you were working on was lost.', actionLabel: 'Try again',\n })],\n reference: [panel('error-reference', [\n externalComponent('error-reference-label', 'text', { text: 'Support reference' }),\n externalComponent('error-reference-id', 'text', { text: fromQuery('SupportReference', '0.id') }),\n ])],\n actions: [backToDashboard('error-home')],\n },\n displayName: 'Error',\n description: 'A generic failure with a retry and the support reference id to quote.',\n metadata: metadataOf('ErrorScreen', 'State'),\n};\n\n/** The four auth and state screens of Part B 2.11. The legacy `Login`, `NotFound`, `AccessDenied` and `Error` remain as they were. */\nexport const stateScreenTemplates: ScreenTemplate[] = [loginScreenTemplate, notFoundScreenTemplate, forbiddenScreenTemplate, errorScreenTemplate];\n\n/** The earlier template each spec-named one stands beside: the old name keeps working, and is the alias of the new. */\nexport const foundationTemplateAliases: Record<string, string> = {\n LoginScreen: 'Login',\n NotFoundScreen: 'NotFound',\n ForbiddenScreen: 'AccessDenied',\n ErrorScreen: 'Error',\n QuickCreateDialog: 'FormDialog',\n};\n"],"names":["metadataOf","name","type","foundationTemplateProvenance","category","thumbnail","thumbnailOf","backToDashboard","id","actionButton","label","emphasis","targetScreen","loginScreenTemplate","fitsSlot","slots","arrangement","root","column","slotLeaf","content","logo","externalComponent","initials","error","component","text","fromQuery","tone","form","mode","saveAndNew","strings","formSave","formCancel","sections","values","errors","providers","panel","help","displayName","description","metadata","notFoundScreenTemplate","message","icon","headline","hint","search","placeholder","actions","forbiddenScreenTemplate","actionLabel","errorScreenTemplate","reference","stateScreenTemplates","foundationTemplateAliases","LoginScreen","NotFoundScreen","ForbiddenScreen","ErrorScreen","QuickCreateDialog"],"mappings":";;;;;;;AAAA;AACA;AAQA,MAAMA,UAAAA,GAAa,CAACC,IAAAA,EAAcC,IAAAA,IAA8C;AAAE,QAAA,GAAGC,0CAA4B;AAAED,QAAAA,IAAAA;QAAME,QAAAA,EAAU,CAAC,aAAa,EAAEF,IAAAA,CAAAA,CAAM;AAAEG,QAAAA,SAAAA,EAAWC,yBAAAA,CAAYL,IAAAA;KAAM,CAAA;AAExL,4GACA,MAAMM,eAAAA,GAAkB,CAACC,EAAAA,GAAeC,6BAAaD,EAAAA,EAAI;QAAEE,KAAAA,EAAO,uBAAA;QAAyBC,QAAAA,EAAU,WAAA;QAAaC,YAAAA,EAAc;AAAkB,KAAA,CAAA;AAElJ;;;;UAKaC,mBAAAA,GAAsC;IAC/CZ,IAAAA,EAAM,aAAA;IACNa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DC,WAAAA,EAAa,OAAA;IACbC,cAAAA,EAAgB,UAAA;IAChBC,eAAAA,EAAiB,cAAA;IACjBC,WAAAA,EAAa,OAAA;IACbC,iBAAAA,EAAmB;AACvB;;;;;;;"}
@@ -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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AA,uBAAAA,CAAU,kBAAkB,gBAAA,EAAkB;wBAAEQ,IAAAA,EAAM,QAAA;AAAUC,wBAAAA,QAAAA,EAAUJ,uBAAAA,CAAU,gBAAA,CAAA;AAAmBK,wBAAAA,MAAAA,EAAQL,wBAAU,cAAA,EAAgB,GAAA;AAAK,qBAAA;AAAG,iBAAA;gBAC3JM,MAAAA,EAAQ;AAACX,oBAAAA,uBAAAA,CAAU,iBAAiB,aAAA,EAAe;AAAEW,wBAAAA,MAAAA,EAAQN,uBAAAA,CAAU,QAAA;AAAU,qBAAA;AAAG,iBAAA;gBACpFO,MAAAA,EAAQ;AAACZ,oBAAAA,uBAAAA,CAAU,iBAAiB,gBAAA,EAAkB;wBAAEQ,IAAAA,EAAM,UAAA;AAAYC,wBAAAA,QAAAA,EAAUJ,uBAAAA,CAAU,gBAAA,CAAA;AAAmBK,wBAAAA,MAAAA,EAAQL,wBAAU,cAAA,EAAgB,GAAA;AAAK,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,62 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var scene_react = require('@cratis/scene.react');
6
+ var LayoutConfigProvider = require('../configuration/LayoutConfigProvider.js');
7
+ var PreviewTemplate = require('../preview-host/PreviewTemplate.js');
8
+ var defaultBlueprintThemes = require('../themes/defaultBlueprintThemes.js');
9
+ var LayoutThemeProvider = require('../themes/LayoutThemeProvider.js');
10
+ var elements = require('./elements.js');
11
+ var GalleryScreenPreview = require('./GalleryScreenPreview.js');
12
+ var dialogTemplates = require('./dialogTemplates.js');
13
+ var previewProfile = require('./previewProfile.js');
14
+ var resolveElementNames = require('./resolveElementNames.js');
15
+ var TemplatePreviewState = require('./TemplatePreviewState.js');
16
+
17
+ /** One gallery dialog template by name, for a story or a host that opens a specific one. */ const galleryDialogTemplate = (name)=>dialogTemplates.galleryDialogTemplates.find((template)=>template.name === name);
18
+ /**
19
+ * Opens one gallery dialog template the way a host does: inside a `role="dialog" aria-modal="true"` element, with the template's content in the wrapper
20
+ * a screen's template gets. Nothing here is a preview-only path - the dialog is a real {@link DialogTemplate} rendered by the real `SceneElementView`,
21
+ * and the dialog's own frame gives the host element its focus handling, placement and labelling exactly as it does in an application.
22
+ */ function GalleryDialogPreview({ dialogName, initialConfig, themes = defaultBlueprintThemes.defaultBlueprintThemes, registry = GalleryScreenPreview.galleryPreviewRegistry, state = TemplatePreviewState.TemplatePreviewState.Populated, pack, forceState }) {
23
+ const template = galleryDialogTemplate(dialogName);
24
+ if (!template) throw new Error(`The gallery has no dialog template named '${dialogName}'.`);
25
+ const element = react.useMemo(()=>{
26
+ const composed = elements.externalComponent(`dialog-${template.name}`, PreviewTemplate.previewTemplateComponent, {}, template.content ?? {});
27
+ const resolved = resolveElementNames.resolveElementComponentNames(composed, previewProfile.galleryPreviewProfile, previewProfile.galleryComponentCatalog);
28
+ return forceState ? GalleryScreenPreview.forceComponentState(resolved, forceState) : resolved;
29
+ }, [
30
+ template,
31
+ forceState
32
+ ]);
33
+ const full = react.useMemo(()=>({
34
+ ...registry,
35
+ ...PreviewTemplate.previewComponents
36
+ }), [
37
+ registry
38
+ ]);
39
+ return /*#__PURE__*/ jsxRuntime.jsx(LayoutConfigProvider.LayoutConfigProvider, {
40
+ initialConfig: initialConfig,
41
+ storage: null,
42
+ children: /*#__PURE__*/ jsxRuntime.jsx(LayoutThemeProvider.LayoutThemeProvider, {
43
+ themes: themes,
44
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
45
+ role: "dialog",
46
+ "aria-modal": "true",
47
+ "aria-label": template.displayName ?? template.name,
48
+ "data-scene-dialog": template.name,
49
+ children: /*#__PURE__*/ jsxRuntime.jsx(scene_react.SceneElementView, {
50
+ element: element,
51
+ registry: full,
52
+ resolveBinding: ()=>undefined,
53
+ queryResults: GalleryScreenPreview.queryResultsOf(pack, state)
54
+ })
55
+ })
56
+ })
57
+ });
58
+ }
59
+
60
+ exports.GalleryDialogPreview = GalleryDialogPreview;
61
+ exports.galleryDialogTemplate = galleryDialogTemplate;
62
+ //# sourceMappingURL=GalleryDialogPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryDialogPreview.js","sources":["../../../gallery/GalleryDialogPreview.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 { useMemo } from 'react';\nimport { DialogTemplate, SampleDataPack, Theme } from '@cratis/scene.model';\nimport { ComponentRegistry, SceneElementView } from '@cratis/scene.react';\nimport { LayoutConfigProvider, LayoutConfigState } from '../configuration';\nimport { previewComponents, previewTemplateComponent } from '../preview-host/PreviewTemplate';\nimport { LayoutThemeProvider, defaultBlueprintThemes } from '../themes';\nimport { externalComponent } from './elements';\nimport { ForcedComponentState, forceComponentState, galleryPreviewRegistry, queryResultsOf } from './GalleryScreenPreview';\nimport { galleryDialogTemplates } from './dialogTemplates';\nimport { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile';\nimport { resolveElementComponentNames } from './resolveElementNames';\nimport { TemplatePreviewState } from './TemplatePreviewState';\n\n/** One gallery dialog template by name, for a story or a host that opens a specific one. */\nexport const galleryDialogTemplate = (name: string): DialogTemplate | undefined => galleryDialogTemplates.find(template => template.name === name);\n\nexport interface GalleryDialogPreviewProps {\n /** The name of the gallery dialog template to open. */\n dialogName: string;\n\n /** Configuration to start from. */\n initialConfig?: Partial<LayoutConfigState>;\n\n /** The themes the preview may switch between. Defaults to the two this blueprint ships. */\n themes?: Theme[];\n\n /** The component registry to render against. Defaults to `core` plus this blueprint's own components. */\n registry?: ComponentRegistry;\n\n /** The data state to show. Defaults to the seeded, populated records. */\n state?: TemplatePreviewState;\n\n /** The sample-data pack that stands in for the queries the template binds to. */\n pack?: SampleDataPack;\n\n /** A standard state (spec Part B 1.4) to force on every foundation component of the dialog that owns the five states. */\n forceState?: ForcedComponentState;\n}\n\n/**\n * Opens one gallery dialog template the way a host does: inside a `role=\"dialog\" aria-modal=\"true\"` element, with the template's content in the wrapper\n * a screen's template gets. Nothing here is a preview-only path - the dialog is a real {@link DialogTemplate} rendered by the real `SceneElementView`,\n * and the dialog's own frame gives the host element its focus handling, placement and labelling exactly as it does in an application.\n */\nexport function GalleryDialogPreview({ dialogName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated, pack, forceState }: GalleryDialogPreviewProps) {\n const template = galleryDialogTemplate(dialogName);\n if (!template) throw new Error(`The gallery has no dialog template named '${dialogName}'.`);\n\n const element = useMemo(() => {\n const composed = externalComponent(`dialog-${template.name}`, previewTemplateComponent, {}, template.content ?? {});\n const resolved = resolveElementComponentNames(composed, galleryPreviewProfile, galleryComponentCatalog);\n return forceState ? forceComponentState(resolved, forceState) : resolved;\n }, [template, forceState]);\n const full = useMemo(() => ({ ...registry, ...previewComponents }), [registry]);\n\n return (\n <LayoutConfigProvider initialConfig={initialConfig} storage={null}>\n <LayoutThemeProvider themes={themes}>\n <div role='dialog' aria-modal='true' aria-label={template.displayName ?? template.name} data-scene-dialog={template.name}>\n <SceneElementView element={element} registry={full} resolveBinding={() => undefined} queryResults={queryResultsOf(pack, state)} />\n </div>\n </LayoutThemeProvider>\n </LayoutConfigProvider>\n );\n}\n"],"names":["galleryDialogTemplate","name","galleryDialogTemplates","find","template","GalleryDialogPreview","dialogName","initialConfig","themes","defaultBlueprintThemes","registry","galleryPreviewRegistry","state","TemplatePreviewState","Populated","pack","forceState","Error","element","useMemo","composed","externalComponent","previewTemplateComponent","content","resolved","resolveElementComponentNames","galleryPreviewProfile","galleryComponentCatalog","forceComponentState","full","previewComponents","_jsx","LayoutConfigProvider","storage","LayoutThemeProvider","div","role","aria-modal","aria-label","displayName","data-scene-dialog","SceneElementView","resolveBinding","undefined","queryResults","queryResultsO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