@antelopejs/dms 0.25.8-next.1174.ge77e0bd → 0.25.8

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 (343) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +2 -2
  3. package/data/mockup-example/spec.json +0 -11
  4. package/data/mockup-spec.schema.json +16 -399
  5. package/dist/e2e/index.d.mts +1 -2
  6. package/dist/implementations/dms-builder/engine/table-view-settings.js +33 -9
  7. package/dist/implementations/dms-builder/engine/table-view-settings.js.map +1 -1
  8. package/dist/index.js +0 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/mcp/index.d.ts +0 -2
  11. package/dist/mcp/index.js +0 -9
  12. package/dist/mcp/index.js.map +1 -1
  13. package/dist/mcp/page-verify/index.d.ts +0 -15
  14. package/dist/mcp/page-verify/index.js +6 -16
  15. package/dist/mcp/page-verify/index.js.map +1 -1
  16. package/dist/mcp/page-verify/mockup.d.ts +1 -3
  17. package/dist/mcp/page-verify/mockup.js +1 -5
  18. package/dist/mcp/page-verify/mockup.js.map +1 -1
  19. package/dist/mcp/page-verify/page-probe.d.ts +0 -5
  20. package/dist/mcp/page-verify/page-probe.js +0 -2
  21. package/dist/mcp/page-verify/page-probe.js.map +1 -1
  22. package/dist/mcp/page-verify/playwright.d.ts +4 -22
  23. package/dist/mcp/page-verify/playwright.js.map +1 -1
  24. package/dist/mcp/page-verify/report.d.ts +0 -1
  25. package/dist/mcp/tools/mockup-read-spec.js +3 -2
  26. package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
  27. package/dist/mcp/tools/mockup.js +0 -4
  28. package/dist/mcp/tools/mockup.js.map +1 -1
  29. package/dist/mcp/tools/page-verify.d.ts +0 -1
  30. package/dist/mcp/tools/page-verify.js +2 -6
  31. package/dist/mcp/tools/page-verify.js.map +1 -1
  32. package/dist/mockup/annotations.js +2 -2
  33. package/dist/mockup/annotations.js.map +1 -1
  34. package/dist/mockup/apply-notes.js +1 -1
  35. package/dist/mockup/apply-notes.js.map +1 -1
  36. package/dist/mockup/compile.d.ts +10 -6
  37. package/dist/mockup/compile.js +290 -31
  38. package/dist/mockup/compile.js.map +1 -1
  39. package/dist/mockup/files.d.ts +1 -2
  40. package/dist/mockup/files.js +1 -2
  41. package/dist/mockup/files.js.map +1 -1
  42. package/dist/mockup/fixture-answers.d.ts +0 -1
  43. package/dist/mockup/fixture-answers.js +1 -1
  44. package/dist/mockup/fixture-answers.js.map +1 -1
  45. package/dist/mockup/fixtures.d.ts +27 -0
  46. package/dist/mockup/fixtures.js +111 -0
  47. package/dist/mockup/fixtures.js.map +1 -1
  48. package/dist/mockup/from-page.js +9 -2
  49. package/dist/mockup/from-page.js.map +1 -1
  50. package/dist/mockup/generate.js +1 -4
  51. package/dist/mockup/generate.js.map +1 -1
  52. package/dist/mockup/history-routes.d.ts +4 -2
  53. package/dist/mockup/history-routes.js +36 -27
  54. package/dist/mockup/history-routes.js.map +1 -1
  55. package/dist/mockup/history.js +1 -2
  56. package/dist/mockup/history.js.map +1 -1
  57. package/dist/mockup/index.d.ts +0 -10
  58. package/dist/mockup/index.js +0 -10
  59. package/dist/mockup/index.js.map +1 -1
  60. package/dist/mockup/json-schema-layout.d.ts +0 -1
  61. package/dist/mockup/json-schema-layout.js +2 -95
  62. package/dist/mockup/json-schema-layout.js.map +1 -1
  63. package/dist/mockup/json-schema.js +19 -40
  64. package/dist/mockup/json-schema.js.map +1 -1
  65. package/dist/mockup/manage-routes.d.ts +1 -3
  66. package/dist/mockup/manage-routes.js +1 -38
  67. package/dist/mockup/manage-routes.js.map +1 -1
  68. package/dist/mockup/manage.js +1 -1
  69. package/dist/mockup/manage.js.map +1 -1
  70. package/dist/mockup/model.d.ts +100 -137
  71. package/dist/mockup/model.js +86 -102
  72. package/dist/mockup/model.js.map +1 -1
  73. package/dist/mockup/modules.d.ts +9 -6
  74. package/dist/mockup/modules.js +24 -105
  75. package/dist/mockup/modules.js.map +1 -1
  76. package/dist/mockup/presence-board.js +1 -1
  77. package/dist/mockup/presence-board.js.map +1 -1
  78. package/dist/mockup/presence-routes.js +2 -2
  79. package/dist/mockup/presence-routes.js.map +1 -1
  80. package/dist/mockup/refusals.d.ts +0 -5
  81. package/dist/mockup/refusals.js +0 -16
  82. package/dist/mockup/refusals.js.map +1 -1
  83. package/dist/mockup/routes.d.ts +5 -3
  84. package/dist/mockup/routes.js +162 -19
  85. package/dist/mockup/routes.js.map +1 -1
  86. package/dist/mockup/row-filters.d.ts +8 -0
  87. package/dist/mockup/row-filters.js +107 -0
  88. package/dist/mockup/row-filters.js.map +1 -0
  89. package/dist/mockup/sketch-limits.d.ts +0 -1
  90. package/dist/mockup/sketch-limits.js +1 -2
  91. package/dist/mockup/sketch-limits.js.map +1 -1
  92. package/dist/mockup/sketch.d.ts +2 -2
  93. package/dist/mockup/sketch.js +1 -2
  94. package/dist/mockup/sketch.js.map +1 -1
  95. package/dist/mockup/source-routes.d.ts +4 -5
  96. package/dist/mockup/source-routes.js +17 -26
  97. package/dist/mockup/source-routes.js.map +1 -1
  98. package/dist/mockup/source.js +1 -2
  99. package/dist/mockup/source.js.map +1 -1
  100. package/dist/mockup/store.d.ts +37 -16
  101. package/dist/mockup/store.js +200 -85
  102. package/dist/mockup/store.js.map +1 -1
  103. package/dist/mockup/table-archive.d.ts +1 -0
  104. package/dist/mockup/table-archive.js +16 -0
  105. package/dist/mockup/table-archive.js.map +1 -1
  106. package/e2e/index.mjs +2 -3
  107. package/frontend-vue/eslint-globals.generated.mjs +38 -40
  108. package/frontend-vue/layers/dms-core/app/build/utils/asyncDataScope.ts +31 -3
  109. package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +2 -8
  110. package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +0 -3
  111. package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +0 -3
  112. package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +30 -110
  113. package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +6 -21
  114. package/frontend-vue/layers/dms-layout/app/build/components/layout/SidebarUserMenu.vue +7 -19
  115. package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +9 -79
  116. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsNav.vue +4 -17
  117. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +0 -12
  118. package/frontend-vue/layers/dms-layout/app/build/composables/settings/useSettingsNavigation.ts +0 -39
  119. package/frontend-vue/layers/dms-layout/app/build/mockups/created-mockups.ts +2 -12
  120. package/frontend-vue/layers/dms-layout/app/build/mockups/created-toast.ts +1 -9
  121. package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +6 -53
  122. package/frontend-vue/layers/dms-layout/app/theme/actions.ts +7 -11
  123. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +5 -31
  124. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupCanvasChrome.vue +1 -1
  125. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +47 -0
  126. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +33 -59
  127. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +12 -58
  128. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/{MockupZoomControls.vue → MockupOverviewZoom.vue} +15 -23
  129. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPagesList.vue +0 -21
  130. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinCard.vue +1 -1
  131. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinLayer.vue +1 -1
  132. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTopBar.vue +9 -77
  133. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +45 -130
  134. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +3 -70
  135. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +4 -44
  136. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockInspector.ts +2 -14
  137. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +36 -256
  138. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +1 -13
  139. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameSize.ts +5 -10
  140. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +23 -50
  141. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +29 -82
  142. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPins.ts +1 -1
  143. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRealData.ts +3 -10
  144. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +14 -60
  145. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +3 -8
  146. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +2 -6
  147. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupToolModes.ts +7 -5
  148. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +8 -29
  149. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +2 -13
  150. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +10 -39
  151. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +0 -29
  152. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +3 -37
  153. package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +1 -20
  154. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +8 -1
  155. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +103 -167
  156. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +0 -22
  157. package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +173 -75
  158. package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +9 -118
  159. package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +8 -123
  160. package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +2 -6
  161. package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +3 -21
  162. package/frontend-vue/layers/dms-ui/app/build/utils/mockupPageTree.ts +0 -15
  163. package/frontend-vue/layers/dms-ui/app/build/utils/mockupPins.ts +8 -6
  164. package/frontend-vue/layers/dms-ui/app/build/utils/mockupRealData.ts +5 -18
  165. package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +6 -17
  166. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +2 -17
  167. package/frontend-vue/layers/dms-ui/app/build/utils/mockupVersions.ts +7 -2
  168. package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +0 -8
  169. package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +6 -108
  170. package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +1 -5
  171. package/frontend-vue/layers/dms-ui/app/build/utils/sketch.ts +10 -40
  172. package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +6 -23
  173. package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +0 -2
  174. package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +4 -53
  175. package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +4 -53
  176. package/frontend-vue/package.json +2 -2
  177. package/package.json +5 -6
  178. package/E2E.md +0 -138
  179. package/dist/mcp/mockup-export/capture.d.ts +0 -19
  180. package/dist/mcp/mockup-export/capture.js +0 -99
  181. package/dist/mcp/mockup-export/capture.js.map +0 -1
  182. package/dist/mcp/mockup-export/document.d.ts +0 -4
  183. package/dist/mcp/mockup-export/document.js +0 -199
  184. package/dist/mcp/mockup-export/document.js.map +0 -1
  185. package/dist/mcp/mockup-export/index.d.ts +0 -20
  186. package/dist/mcp/mockup-export/index.js +0 -110
  187. package/dist/mcp/mockup-export/index.js.map +0 -1
  188. package/dist/mcp/mockup-export/jobs.d.ts +0 -32
  189. package/dist/mcp/mockup-export/jobs.js +0 -49
  190. package/dist/mcp/mockup-export/jobs.js.map +0 -1
  191. package/dist/mcp/mockup-export/plan.d.ts +0 -78
  192. package/dist/mcp/mockup-export/plan.js +0 -292
  193. package/dist/mcp/mockup-export/plan.js.map +0 -1
  194. package/dist/mcp/mockup-export/route.d.ts +0 -23
  195. package/dist/mcp/mockup-export/route.js +0 -91
  196. package/dist/mcp/mockup-export/route.js.map +0 -1
  197. package/dist/mcp/page-verify/modules.d.ts +0 -8
  198. package/dist/mcp/page-verify/modules.js +0 -49
  199. package/dist/mcp/page-verify/modules.js.map +0 -1
  200. package/dist/mcp/tools/mockup-export-pdf.d.ts +0 -1
  201. package/dist/mcp/tools/mockup-export-pdf.js +0 -69
  202. package/dist/mcp/tools/mockup-export-pdf.js.map +0 -1
  203. package/dist/mcp/tools/mockup-module-catalog.d.ts +0 -1
  204. package/dist/mcp/tools/mockup-module-catalog.js +0 -36
  205. package/dist/mcp/tools/mockup-module-catalog.js.map +0 -1
  206. package/dist/mockup/compile-layouts.d.ts +0 -5
  207. package/dist/mockup/compile-layouts.js +0 -74
  208. package/dist/mockup/compile-layouts.js.map +0 -1
  209. package/dist/mockup/compile-nodes.d.ts +0 -11
  210. package/dist/mockup/compile-nodes.js +0 -119
  211. package/dist/mockup/compile-nodes.js.map +0 -1
  212. package/dist/mockup/compile-pages.d.ts +0 -18
  213. package/dist/mockup/compile-pages.js +0 -189
  214. package/dist/mockup/compile-pages.js.map +0 -1
  215. package/dist/mockup/create.d.ts +0 -16
  216. package/dist/mockup/create.js +0 -78
  217. package/dist/mockup/create.js.map +0 -1
  218. package/dist/mockup/created-watch.d.ts +0 -18
  219. package/dist/mockup/created-watch.js +0 -110
  220. package/dist/mockup/created-watch.js.map +0 -1
  221. package/dist/mockup/entities.d.ts +0 -20
  222. package/dist/mockup/entities.js +0 -213
  223. package/dist/mockup/entities.js.map +0 -1
  224. package/dist/mockup/etag.d.ts +0 -1
  225. package/dist/mockup/etag.js +0 -10
  226. package/dist/mockup/etag.js.map +0 -1
  227. package/dist/mockup/extensions.d.ts +0 -18
  228. package/dist/mockup/extensions.js +0 -61
  229. package/dist/mockup/extensions.js.map +0 -1
  230. package/dist/mockup/fixture-batch.d.ts +0 -21
  231. package/dist/mockup/fixture-batch.js +0 -111
  232. package/dist/mockup/fixture-batch.js.map +0 -1
  233. package/dist/mockup/fixture-routes.d.ts +0 -21
  234. package/dist/mockup/fixture-routes.js +0 -136
  235. package/dist/mockup/fixture-routes.js.map +0 -1
  236. package/dist/mockup/json-schema-entities.d.ts +0 -5
  237. package/dist/mockup/json-schema-entities.js +0 -141
  238. package/dist/mockup/json-schema-entities.js.map +0 -1
  239. package/dist/mockup/json.d.ts +0 -8
  240. package/dist/mockup/json.js +0 -20
  241. package/dist/mockup/json.js.map +0 -1
  242. package/dist/mockup/layout-model.d.ts +0 -156
  243. package/dist/mockup/layout-model.js +0 -96
  244. package/dist/mockup/layout-model.js.map +0 -1
  245. package/dist/mockup/layouts.d.ts +0 -9
  246. package/dist/mockup/layouts.js +0 -40
  247. package/dist/mockup/layouts.js.map +0 -1
  248. package/dist/mockup/module-manifests.d.ts +0 -99
  249. package/dist/mockup/module-manifests.js +0 -95
  250. package/dist/mockup/module-manifests.js.map +0 -1
  251. package/dist/mockup/module-states.d.ts +0 -10
  252. package/dist/mockup/module-states.js +0 -85
  253. package/dist/mockup/module-states.js.map +0 -1
  254. package/dist/mockup/modules-schema.d.ts +0 -2
  255. package/dist/mockup/modules-schema.js +0 -39
  256. package/dist/mockup/modules-schema.js.map +0 -1
  257. package/dist/mockup/page-capture-routes.d.ts +0 -19
  258. package/dist/mockup/page-capture-routes.js +0 -92
  259. package/dist/mockup/page-capture-routes.js.map +0 -1
  260. package/dist/mockup/page-captures.d.ts +0 -61
  261. package/dist/mockup/page-captures.js +0 -252
  262. package/dist/mockup/page-captures.js.map +0 -1
  263. package/dist/mockup/parse-spec.d.ts +0 -10
  264. package/dist/mockup/parse-spec.js +0 -62
  265. package/dist/mockup/parse-spec.js.map +0 -1
  266. package/dist/mockup/places.d.ts +0 -17
  267. package/dist/mockup/places.js +0 -75
  268. package/dist/mockup/places.js.map +0 -1
  269. package/dist/mockup/slug.d.ts +0 -3
  270. package/dist/mockup/slug.js +0 -7
  271. package/dist/mockup/slug.js.map +0 -1
  272. package/dist/mockup/state-patch.d.ts +0 -22
  273. package/dist/mockup/state-patch.js +0 -75
  274. package/dist/mockup/state-patch.js.map +0 -1
  275. package/dist/mockup/state.d.ts +0 -112
  276. package/dist/mockup/state.js +0 -22
  277. package/dist/mockup/state.js.map +0 -1
  278. package/dist/mockup/store-list.d.ts +0 -28
  279. package/dist/mockup/store-list.js +0 -89
  280. package/dist/mockup/store-list.js.map +0 -1
  281. package/dist/mockup/tenancy.d.ts +0 -19
  282. package/dist/mockup/tenancy.js +0 -73
  283. package/dist/mockup/tenancy.js.map +0 -1
  284. package/dist/mockup/tenant-rows.d.ts +0 -4
  285. package/dist/mockup/tenant-rows.js +0 -19
  286. package/dist/mockup/tenant-rows.js.map +0 -1
  287. package/frontend-vue/layers/dms-core/app/utils/localFetchAnswers.ts +0 -124
  288. package/frontend-vue/layers/dms-core/app/utils/textDigest.ts +0 -29
  289. package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupWidgets.ts +0 -65
  290. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +0 -153
  291. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEmptyState.vue +0 -23
  292. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModuleStore.vue +0 -164
  293. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSectionLabel.vue +0 -51
  294. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupReconnecting.vue +0 -17
  295. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTenantBanner.vue +0 -48
  296. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +0 -142
  297. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useFixtureBatches.ts +0 -154
  298. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupActivation.ts +0 -157
  299. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +0 -165
  300. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameRender.ts +0 -126
  301. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageZoom.ts +0 -138
  302. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +0 -124
  303. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +0 -37
  304. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerActivation.ts +0 -56
  305. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerExport.ts +0 -46
  306. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePersistedCaptures.ts +0 -151
  307. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCreateModal.vue +0 -130
  308. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +0 -332
  309. package/frontend-vue/layers/dms-ui/app/build/utils/mockupActivation.ts +0 -100
  310. package/frontend-vue/layers/dms-ui/app/build/utils/mockupAnnotations.ts +0 -146
  311. package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +0 -80
  312. package/frontend-vue/layers/dms-ui/app/build/utils/mockupModuleNavigation.ts +0 -171
  313. package/frontend-vue/layers/dms-ui/app/build/utils/mockupModules.ts +0 -138
  314. package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverviewSections.ts +0 -66
  315. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +0 -177
  316. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStatePatch.ts +0 -179
  317. package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +0 -143
  318. package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +0 -23
  319. package/frontend-vue/layers/dms-ui/app/build/utils/previewFixtureAnswers.ts +0 -156
  320. package/frontend-vue/layers/dms-ui/app/build/utils/previewRows.ts +0 -400
  321. package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +0 -15
  322. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupModuleStore.ts +0 -2
  323. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupTenantBanner.ts +0 -2
  324. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher.ts +0 -2
  325. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useFixtureBatches.ts +0 -1
  326. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupActivation.ts +0 -1
  327. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupOverview.ts +0 -1
  328. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupPdfExport.ts +0 -1
  329. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupRoutePage.ts +0 -1
  330. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupSession.ts +0 -1
  331. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupTenancy.ts +0 -1
  332. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePersistedCaptures.ts +0 -1
  333. package/frontend-vue/layers/dms-ui/app/entries/utils/json.ts +0 -1
  334. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupActivation.ts +0 -1
  335. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupAnnotations.ts +0 -1
  336. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupModuleNavigation.ts +0 -1
  337. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupOverviewSections.ts +0 -1
  338. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.ts +0 -1
  339. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupStatePatch.ts +0 -1
  340. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenancy.ts +0 -1
  341. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenants.ts +0 -1
  342. package/frontend-vue/layers/dms-ui/app/entries/utils/previewFixtureAnswers.ts +0 -1
  343. package/frontend-vue/layers/dms-ui/app/entries/utils/previewRows.ts +0 -1
@@ -1,332 +0,0 @@
1
- import {
2
- isBoolean,
3
- isNumber,
4
- isString,
5
- } from "../../../../dms-core/app/utils/type-check";
6
- import type { PreviewSketch } from "./blockPreview";
7
- import { isMockupTenants, type MockupTenant } from "./mockupTenants";
8
- import { isOptionalString, isRecord } from "./recordGuards";
9
-
10
- /** One entry of the sidebar the preview draws around the blocks. */
11
- export interface PreviewNavigationItem {
12
- id: string;
13
- label: string;
14
- icon?: string;
15
- }
16
-
17
- /** A group of the settings navigation beside a page in the settings layout: its label, an i18n key (`$…`) or a literal, over its entries. */
18
- export interface PreviewSettingsNavGroup {
19
- label: string;
20
- items: PreviewNavigationItem[];
21
- }
22
-
23
- /** A category of the sidebar: the header its entries are listed under. */
24
- export interface PreviewNavigationCategory {
25
- id: string;
26
- title: string;
27
- icon?: string;
28
- }
29
-
30
- /** A section of the sidebar: a category and its entries, or the default section's entries. */
31
- export interface PreviewNavigationSection {
32
- /** None for the default section, which holds the pages without a category. */
33
- category?: PreviewNavigationCategory;
34
- items: PreviewNavigationItem[];
35
- }
36
-
37
- /**
38
- * The module the current page belongs to. The sidebar then draws as the
39
- * dashboard does inside a module: the module's icon and title over its pages,
40
- * and a Back entry to the module store.
41
- */
42
- export interface PreviewNavigationModule {
43
- id: string;
44
- title: string;
45
- icon: string;
46
- items: PreviewNavigationItem[];
47
- }
48
-
49
- /** A settings page a module brings, as its store card names it. */
50
- export interface PreviewStoreSetting {
51
- title: string;
52
- icon: string;
53
- }
54
-
55
- /** A page a module's store card lists: a sidebar entry, marked owner only when the module's root holds it and not when it extends a page elsewhere. */
56
- export interface PreviewStorePage extends PreviewNavigationItem {
57
- ownerOnly: boolean;
58
- }
59
-
60
- /** An installed module as the module store draws its card, and as the Modules button counts it. */
61
- export interface PreviewStoreModule {
62
- id: string;
63
- title: string;
64
- icon: string;
65
- description?: string;
66
- /** The npm package the build installs; none for a custom module. */
67
- package?: string;
68
- /** The pages it adds or extends in the menu, in order; the first opens when the card is picked. */
69
- pages: PreviewStorePage[];
70
- settings: PreviewStoreSetting[];
71
- /** The names of the sidebar widgets it brings. */
72
- widgets: string[];
73
- }
74
-
75
- /** Where a module's widget sits among the sidebar's own. */
76
- export type PreviewWidgetPosition = "above-search" | "below-search";
77
-
78
- /**
79
- * A widget an installed module puts in the sidebar: the workspace switcher,
80
- * fed by the sidebar's workspace, or a sketch.
81
- */
82
- export type PreviewModuleWidget =
83
- | { id: string; kind: "workspace-switcher"; position: PreviewWidgetPosition }
84
- | {
85
- id: string;
86
- kind: "sketch";
87
- position: PreviewWidgetPosition;
88
- sketch: PreviewSketch;
89
- };
90
-
91
- /** How many rows of a tenant-scoped entity the active tenant sees, out of all of them. */
92
- export interface PreviewHiddenRows {
93
- entity: string;
94
- shown: number;
95
- total: number;
96
- }
97
-
98
- /**
99
- * SaaS mode as the sidebar and the banner draw it: the workspaces the
100
- * switcher lists, the id of the active one, and the rows its page hides.
101
- */
102
- export interface PreviewWorkspace {
103
- tenants: MockupTenant[];
104
- active: string;
105
- hidden: PreviewHiddenRows[];
106
- }
107
-
108
- function isHiddenRows(value: unknown): value is PreviewHiddenRows {
109
- return (
110
- isRecord(value) &&
111
- isString(value.entity) &&
112
- isNumber(value.shown) &&
113
- Number.isFinite(value.shown) &&
114
- isNumber(value.total) &&
115
- Number.isFinite(value.total)
116
- );
117
- }
118
-
119
- /** Whether `value` is a workspace a sidebar may carry: its tenants and the rows it hides, each read. */
120
- export function isPreviewWorkspace(value: unknown): value is PreviewWorkspace {
121
- return (
122
- isRecord(value) &&
123
- isMockupTenants(value.tenants) &&
124
- isString(value.active) &&
125
- Array.isArray(value.hidden) &&
126
- value.hidden.every(isHiddenRows)
127
- );
128
- }
129
-
130
- function isNavigationItem(value: unknown): value is PreviewNavigationItem {
131
- return (
132
- isRecord(value) &&
133
- isString(value.id) &&
134
- isString(value.label) &&
135
- isOptionalString(value.icon)
136
- );
137
- }
138
-
139
- /** Whether `value` is a list of sidebar entries, each read. */
140
- export function isNavigationItems(
141
- value: unknown,
142
- ): value is PreviewNavigationItem[] {
143
- return Array.isArray(value) && value.every(isNavigationItem);
144
- }
145
-
146
- function isNavigationCategory(
147
- value: unknown,
148
- ): value is PreviewNavigationCategory {
149
- return (
150
- isRecord(value) &&
151
- isString(value.id) &&
152
- isString(value.title) &&
153
- isOptionalString(value.icon)
154
- );
155
- }
156
-
157
- export function isNavigationSection(
158
- value: unknown,
159
- ): value is PreviewNavigationSection {
160
- return (
161
- isRecord(value) &&
162
- (value.category === undefined || isNavigationCategory(value.category)) &&
163
- isNavigationItems(value.items)
164
- );
165
- }
166
-
167
- export function isNavigationModule(
168
- value: unknown,
169
- ): value is PreviewNavigationModule {
170
- return (
171
- isRecord(value) &&
172
- isString(value.id) &&
173
- isString(value.title) &&
174
- isString(value.icon) &&
175
- isNavigationItems(value.items)
176
- );
177
- }
178
-
179
- function isStoreSetting(value: unknown): value is PreviewStoreSetting {
180
- return isRecord(value) && isString(value.title) && isString(value.icon);
181
- }
182
-
183
- function isStorePage(value: unknown): value is PreviewStorePage {
184
- return (
185
- isNavigationItem(value) && isRecord(value) && isBoolean(value.ownerOnly)
186
- );
187
- }
188
-
189
- /** Whether `value` is a module card of the store, every page and setting read. */
190
- export function isStoreModule(value: unknown): value is PreviewStoreModule {
191
- return (
192
- isRecord(value) &&
193
- isString(value.id) &&
194
- isString(value.title) &&
195
- isString(value.icon) &&
196
- isOptionalString(value.description) &&
197
- isOptionalString(value.package) &&
198
- Array.isArray(value.pages) &&
199
- value.pages.every(isStorePage) &&
200
- Array.isArray(value.settings) &&
201
- value.settings.every(isStoreSetting) &&
202
- Array.isArray(value.widgets) &&
203
- value.widgets.every(isString)
204
- );
205
- }
206
-
207
- function isWidgetPosition(value: unknown): value is PreviewWidgetPosition {
208
- return value === "above-search" || value === "below-search";
209
- }
210
-
211
- /** Whether `value` is a sketch the preview draws: its markup, its style sheet, its caption and a finite frame height. */
212
- export function isPreviewSketch(value: unknown): value is PreviewSketch {
213
- return (
214
- isRecord(value) &&
215
- isString(value.html) &&
216
- isOptionalString(value.css) &&
217
- isOptionalString(value.caption) &&
218
- isNumber(value.height) &&
219
- Number.isFinite(value.height)
220
- );
221
- }
222
-
223
- /** Whether `value` is a module widget the sidebar may draw. */
224
- export function isModuleWidget(value: unknown): value is PreviewModuleWidget {
225
- if (!isRecord(value) || !isString(value.id)) return false;
226
- if (!isWidgetPosition(value.position)) return false;
227
- if (value.kind === "workspace-switcher") return true;
228
- return value.kind === "sketch" && isPreviewSketch(value.sketch);
229
- }
230
-
231
- /** A sketch the sidebar draws among its widgets, `caption` over it. */
232
- export interface PreviewSidebarWidget extends PreviewSketch {
233
- id: string;
234
- }
235
-
236
- /** The sidebar the preview draws around the blocks, as a dashboard does. */
237
- export interface PreviewNavigation {
238
- title?: string;
239
- /** The default section first, then each category in the menu's order. */
240
- sections: PreviewNavigationSection[];
241
- /** The pages that extend a page of the dashboard's Settings, under a Settings header after the sections; read-only, never edited. */
242
- settings?: PreviewNavigationItem[];
243
- /**
244
- * The settings navigation beside a page in the settings layout, in place of
245
- * the host app's own; inert. The entry of the active page is `active`.
246
- */
247
- settingsNav?: PreviewSettingsNavGroup[];
248
- /** The module the active page belongs to: the sidebar draws as inside a module, its pages instead of the app's menu. */
249
- module?: PreviewNavigationModule;
250
- /** The installed modules: the Modules button counts them and the module store lists them. */
251
- modules?: PreviewStoreModule[];
252
- /** The module store is open, drawn in place of the page. */
253
- store?: true;
254
- /** The id of the entry drawn as the current one. */
255
- active?: string;
256
- /** The sidebar edits its sections, each change posted as a `section-edit`. */
257
- editable?: boolean;
258
- /** Sketches the spec adds below the sidebar's own widgets. */
259
- widgets?: PreviewSidebarWidget[];
260
- /** What the installed modules put in the sidebar, in order. */
261
- moduleWidgets?: PreviewModuleWidget[];
262
- /** SaaS mode: the workspace the switcher widget lists, and a banner above the page. */
263
- workspace?: PreviewWorkspace;
264
- }
265
-
266
- function isSidebarWidget(value: unknown): value is PreviewSidebarWidget {
267
- return isRecord(value) && isString(value.id) && isPreviewSketch(value);
268
- }
269
-
270
- type PreviewNavigationPages = Pick<
271
- PreviewNavigation,
272
- | "title"
273
- | "active"
274
- | "editable"
275
- | "sections"
276
- | "settings"
277
- | "settingsNav"
278
- | "widgets"
279
- >;
280
-
281
- type PreviewNavigationModules = Pick<
282
- PreviewNavigation,
283
- "module" | "modules" | "store" | "moduleWidgets" | "workspace"
284
- >;
285
-
286
- function isSettingsNavGroup(value: unknown): value is PreviewSettingsNavGroup {
287
- return (
288
- isRecord(value) && isString(value.label) && isNavigationItems(value.items)
289
- );
290
- }
291
-
292
- function isSettingsNav(value: unknown): value is PreviewSettingsNavGroup[] {
293
- return Array.isArray(value) && value.every(isSettingsNavGroup);
294
- }
295
-
296
- function isNavigationPages(value: unknown): value is PreviewNavigationPages {
297
- return (
298
- isRecord(value) &&
299
- isOptionalString(value.title) &&
300
- isOptionalString(value.active) &&
301
- (value.editable === undefined || value.editable === true) &&
302
- Array.isArray(value.sections) &&
303
- value.sections.every(isNavigationSection) &&
304
- (value.settings === undefined || isNavigationItems(value.settings)) &&
305
- (value.settingsNav === undefined || isSettingsNav(value.settingsNav)) &&
306
- (value.widgets === undefined ||
307
- (Array.isArray(value.widgets) && value.widgets.every(isSidebarWidget)))
308
- );
309
- }
310
-
311
- function isNavigationModules(
312
- value: unknown,
313
- ): value is PreviewNavigationModules {
314
- return (
315
- isRecord(value) &&
316
- (value.module === undefined || isNavigationModule(value.module)) &&
317
- (value.modules === undefined ||
318
- (Array.isArray(value.modules) && value.modules.every(isStoreModule))) &&
319
- (value.store === undefined || value.store === true) &&
320
- (value.moduleWidgets === undefined ||
321
- (Array.isArray(value.moduleWidgets) &&
322
- value.moduleWidgets.every(isModuleWidget))) &&
323
- (value.workspace === undefined || isPreviewWorkspace(value.workspace))
324
- );
325
- }
326
-
327
- /** Whether `value` is a sidebar a `render` may carry, every entry checked. */
328
- export function isPreviewNavigation(
329
- value: unknown,
330
- ): value is PreviewNavigationPages & PreviewNavigationModules {
331
- return isNavigationPages(value) && isNavigationModules(value);
332
- }
@@ -1,100 +0,0 @@
1
- /** How long the page view's frame takes to fade in over the image of the page it draws, in milliseconds. */
2
- export const ACTIVATION_FADE_MS = 150;
3
-
4
- /**
5
- * What the page view shows of the page being opened. The frame is `idle`
6
- * while the Overview shows, and `rendering` from the moment a page is opened
7
- * until the frame acknowledged that page's render drawn, during which the
8
- * page's capture, when it has one, shows in the frame's place and the frame
9
- * itself is not seen, so the page it drew before never is. It is `drawn` from
10
- * then.
11
- */
12
- export type Activation =
13
- | { phase: "idle" }
14
- | { phase: "rendering"; scope: string }
15
- | { phase: "drawn"; scope: string };
16
-
17
- /**
18
- * What moves the page view from one {@link Activation} to the next: a page is
19
- * opened, or what the frame draws changed (`open`, which `scope` names); the
20
- * frame acknowledged the render of the page `scope` names drawn (`drawn`); the
21
- * Overview shows again (`close`).
22
- */
23
- export type ActivationEvent =
24
- | { type: "open"; scope: string }
25
- | { type: "drawn"; scope: string }
26
- | { type: "close" };
27
-
28
- /**
29
- * The identity of what the page view's frame draws: the page, the tenant it
30
- * is drawn for and whether it reads real data. A render of the same scope
31
- * redraws the page in place, so it fades nothing; another scope draws
32
- * something else, so the frame is hidden until it acknowledged that render.
33
- */
34
- export function activationScope(
35
- page: string,
36
- tenant: string | undefined,
37
- realData: boolean,
38
- ): string {
39
- return JSON.stringify([page, tenant ?? null, realData]);
40
- }
41
-
42
- /**
43
- * The activation after `event`. Opening the scope already open leaves it as
44
- * it is, and opening another while one renders replaces it, so only the
45
- * render of the new scope draws the page. An acknowledgment of another scope
46
- * than the one rendering, or while nothing renders, changes nothing.
47
- */
48
- export function nextActivation(
49
- state: Activation,
50
- event: ActivationEvent,
51
- ): Activation {
52
- switch (event.type) {
53
- case "open":
54
- return state.phase !== "idle" && state.scope === event.scope
55
- ? state
56
- : { phase: "rendering", scope: event.scope };
57
- case "drawn":
58
- return state.phase === "rendering" && state.scope === event.scope
59
- ? { phase: "drawn", scope: state.scope }
60
- : state;
61
- case "close":
62
- return { phase: "idle" };
63
- }
64
- }
65
-
66
- /**
67
- * The scope the module store is drawn under, as an activation and as a
68
- * render: it is no page, so no page's capture shows in its place, and every
69
- * render of it is the same, its tree being empty.
70
- */
71
- export const STORE_SCOPE = JSON.stringify(["module-store"]);
72
-
73
- /** What {@link renderAcknowledgments} tells an activation. */
74
- export interface RenderAcknowledgments {
75
- /** A render of the scope `scope` was posted to the frame, for the activation `activation` names. */
76
- posted: (activation: string, scope: string) => void;
77
- /** The frame says it drew the render of the scope `scope`. */
78
- drawn: (scope: string) => void;
79
- }
80
-
81
- /**
82
- * Turns what the frame acknowledges, the scope of a render it drew, into the
83
- * activation that render belongs to, which `onDrawn` is told. Only the render
84
- * posted last counts: the acknowledgment of one the frame was handed before
85
- * it, which names another scope, tells nothing, so a page that was open
86
- * before never shows the frame of the page opened after it.
87
- */
88
- export function renderAcknowledgments(
89
- onDrawn: (activation: string) => void,
90
- ): RenderAcknowledgments {
91
- let last: { activation: string; scope: string } | undefined;
92
- return {
93
- posted: (activation, scope) => {
94
- last = { activation, scope };
95
- },
96
- drawn: (scope) => {
97
- if (last?.scope === scope) onDrawn(last.activation);
98
- },
99
- };
100
- }
@@ -1,146 +0,0 @@
1
- import type { isObject } from "../../../../dms-core/app/utils/type-check";
2
- import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
3
- import { isOptionalString, isRecord } from "./recordGuards";
4
-
5
- export type MockupAnnotationStatus = "open" | "resolved";
6
-
7
- /**
8
- * The block a note is about: the node whose id is `block`, on the page `page`
9
- * when set, then the children whose ids are `steps`.
10
- */
11
- export interface MockupBlockAnchor {
12
- block: string;
13
- steps: string[];
14
- page?: string;
15
- }
16
-
17
- /** What a note is on: a block, or the page `page` as a whole. */
18
- export type MockupNoteAnchor = MockupBlockAnchor | { page: string };
19
-
20
- /** Where a pin sits on its block or page: fractions of its box, from its top left corner. */
21
- export interface MockupPinOffset {
22
- x: number;
23
- y: number;
24
- }
25
-
26
- /**
27
- * A reviewer's pin. `page` and `path` are where it is now: both on a block,
28
- * `page` alone on a page, neither when its block or page was removed.
29
- * `version` is the number of the history version it was pinned on, and
30
- * `resolvedVersion` the one it was resolved on.
31
- */
32
- export interface MockupAnnotation {
33
- id: string;
34
- anchor: MockupNoteAnchor;
35
- offset: MockupPinOffset;
36
- page?: string;
37
- /** Spec JSON pointer of the note's block now. */
38
- path?: string;
39
- text: string;
40
- status: MockupAnnotationStatus;
41
- createdAt: string;
42
- resolvedAt?: string;
43
- version?: number;
44
- resolvedVersion?: number;
45
- /** The state of the sketch the note was pinned on; absent on its own `html` and on any other block. */
46
- state?: string;
47
- }
48
-
49
- /**
50
- * Where a pin is put: on the node at `path` of page `page`, or on the page
51
- * itself without `path`, and the state of the sketch drawn there.
52
- */
53
- export interface MockupPinPlace {
54
- page: string;
55
- path?: string;
56
- offset: MockupPinOffset;
57
- state?: string;
58
- }
59
-
60
- /** What `POST /api/mockup/:name/annotations` takes. */
61
- export interface MockupAnnotationDraft extends MockupPinPlace {
62
- text: string;
63
- }
64
-
65
- /** What `PATCH /api/mockup/:name/annotations/:id` takes. */
66
- export interface MockupAnnotationPatch {
67
- status?: MockupAnnotationStatus;
68
- text?: string;
69
- place?: MockupPinPlace;
70
- }
71
-
72
- function isOptionalNumber(value: Parameters<typeof isNumber>[0]): boolean {
73
- return value === undefined || isNumber(value);
74
- }
75
-
76
- function isAnchor(
77
- value: Parameters<typeof isObject>[0],
78
- ): value is MockupNoteAnchor {
79
- if (!isRecord(value)) return false;
80
- if (value.block === undefined) return isString(value.page);
81
- return (
82
- isString(value.block) &&
83
- Array.isArray(value.steps) &&
84
- value.steps.every((step) => isString(step)) &&
85
- isOptionalString(value.page)
86
- );
87
- }
88
-
89
- function isFraction(value: Parameters<typeof isNumber>[0]): boolean {
90
- return isNumber(value) && value >= 0 && value <= 1;
91
- }
92
-
93
- function isOffset(
94
- value: Parameters<typeof isObject>[0],
95
- ): value is MockupPinOffset {
96
- return isRecord(value) && isFraction(value.x) && isFraction(value.y);
97
- }
98
-
99
- function isAnnotation(
100
- value: Parameters<typeof isObject>[0],
101
- ): value is MockupAnnotation {
102
- return (
103
- isRecord(value) &&
104
- isString(value.id) &&
105
- isAnchor(value.anchor) &&
106
- isOffset(value.offset) &&
107
- isOptionalString(value.page) &&
108
- isOptionalString(value.path) &&
109
- isString(value.text) &&
110
- (value.status === "open" || value.status === "resolved") &&
111
- isString(value.createdAt) &&
112
- isOptionalString(value.resolvedAt) &&
113
- isOptionalNumber(value.version) &&
114
- isOptionalNumber(value.resolvedVersion) &&
115
- isOptionalString(value.state)
116
- );
117
- }
118
-
119
- /** The annotation a `POST` or `PATCH` answers, or undefined when the answer is not one. */
120
- export function parseAnnotation(
121
- value: Parameters<typeof isObject>[0],
122
- ): MockupAnnotation | undefined {
123
- return isAnnotation(value) ? value : undefined;
124
- }
125
-
126
- /** The annotations of an `{ annotations }` answer or event, or undefined when it is not one. */
127
- export function parseAnnotations(
128
- value: Parameters<typeof isObject>[0],
129
- ): MockupAnnotation[] | undefined {
130
- if (!isRecord(value)) return undefined;
131
- const { annotations } = value;
132
- return Array.isArray(annotations) && annotations.every(isAnnotation)
133
- ? annotations
134
- : undefined;
135
- }
136
-
137
- /** `annotation` with the answer of a `PATCH` or `POST` merged into `list`, newest last. */
138
- export function upsertAnnotation(
139
- list: readonly MockupAnnotation[],
140
- annotation: MockupAnnotation,
141
- ): MockupAnnotation[] {
142
- const exists = list.some((entry) => entry.id === annotation.id);
143
- return exists
144
- ? list.map((entry) => (entry.id === annotation.id ? annotation : entry))
145
- : [...list, annotation];
146
- }
@@ -1,80 +0,0 @@
1
- import { isString } from "../../../../dms-core/app/utils/type-check";
2
- import { isJsonObject, type JsonObject } from "./json";
3
- import { isRecord } from "./recordGuards";
4
-
5
- /** The types a field of a spec entity takes. */
6
- export const MOCKUP_FIELD_TYPES = [
7
- "string",
8
- "number",
9
- "price",
10
- "boolean",
11
- "date",
12
- "email",
13
- "url",
14
- "enum",
15
- "ref",
16
- ] as const;
17
-
18
- /** A field type of an entity. */
19
- export type MockupFieldType = (typeof MOCKUP_FIELD_TYPES)[number];
20
-
21
- export interface MockupEntityField {
22
- name: string;
23
- type: MockupFieldType;
24
- /** The entity a `ref` points to; set on a `ref` alone. */
25
- to?: string;
26
- /** The values an `enum` takes, at least one; set on an `enum` alone. */
27
- values?: string[];
28
- }
29
-
30
- /** An entity of the spec's data model: a table of the mockup's database. */
31
- export interface MockupEntityState {
32
- name: string;
33
- tenantScoped?: true;
34
- /** `id` first (declared, else implied `{ name: "id", type: "string" }`), then the declared fields in spec order. */
35
- fields: MockupEntityField[];
36
- /** The rows of every fixture pointing to it, pages in spec order then fixture keys in order; a row whose `id` an earlier row has is dropped. */
37
- rows: JsonObject[];
38
- /** The ids of the pages holding a fixture that points to it, in spec order, each once. */
39
- pages: string[];
40
- }
41
-
42
- function isFieldType(value: unknown): value is MockupFieldType {
43
- const types: readonly unknown[] = MOCKUP_FIELD_TYPES;
44
- return types.includes(value);
45
- }
46
-
47
- function isEnumValues(value: Parameters<typeof isString>[0]): boolean {
48
- return Array.isArray(value) && value.length > 0 && value.every(isString);
49
- }
50
-
51
- /** Whether `value` is a field: a `ref` names its target and an `enum` its values, and no other type carries either. */
52
- function isEntityField(value: unknown): value is MockupEntityField {
53
- if (!isRecord(value) || !isString(value.name) || !isFieldType(value.type)) {
54
- return false;
55
- }
56
- const { type, to, values } = value;
57
- return (
58
- (type === "ref" ? isString(to) : to === undefined) &&
59
- (type === "enum" ? isEnumValues(values) : values === undefined)
60
- );
61
- }
62
-
63
- function isEntity(value: unknown): value is MockupEntityState {
64
- return (
65
- isRecord(value) &&
66
- isString(value.name) &&
67
- (value.tenantScoped === undefined || value.tenantScoped === true) &&
68
- Array.isArray(value.fields) &&
69
- value.fields.every(isEntityField) &&
70
- Array.isArray(value.rows) &&
71
- value.rows.every(isJsonObject) &&
72
- Array.isArray(value.pages) &&
73
- value.pages.every(isString)
74
- );
75
- }
76
-
77
- /** Whether `value` is a list of entities, each field, row and page id of them read. */
78
- export function isMockupEntities(value: unknown): value is MockupEntityState[] {
79
- return Array.isArray(value) && value.every(isEntity);
80
- }