@antelopejs/dms 0.25.8 → 0.25.9-next.1183.ga9db169

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 (477) hide show
  1. package/CHANGELOG.md +0 -48
  2. package/E2E.md +138 -0
  3. package/README.md +2 -2
  4. package/data/mockup-example/spec.json +13 -0
  5. package/data/mockup-spec.schema.json +399 -16
  6. package/dist/e2e/index.d.mts +2 -1
  7. package/dist/implementations/dms/live-pages.d.ts +6 -0
  8. package/dist/implementations/dms/live-pages.js +139 -0
  9. package/dist/implementations/dms/live-pages.js.map +1 -0
  10. package/dist/implementations/dms/page/notifications.js +2 -0
  11. package/dist/implementations/dms/page/notifications.js.map +1 -1
  12. package/dist/implementations/dms/page/registry.js +19 -4
  13. package/dist/implementations/dms/page/registry.js.map +1 -1
  14. package/dist/implementations/dms/registry-snapshot.d.ts +32 -0
  15. package/dist/implementations/dms/registry-snapshot.js +55 -0
  16. package/dist/implementations/dms/registry-snapshot.js.map +1 -0
  17. package/dist/implementations/dms/services.d.ts +2 -0
  18. package/dist/implementations/dms/services.js +2 -0
  19. package/dist/implementations/dms/services.js.map +1 -1
  20. package/dist/implementations/dms/tenant-access.d.ts +1 -0
  21. package/dist/implementations/dms/tenant-access.js +7 -0
  22. package/dist/implementations/dms/tenant-access.js.map +1 -1
  23. package/dist/implementations/dms-builder/engine/compose-page.js +1 -1
  24. package/dist/implementations/dms-builder/engine/compose-page.js.map +1 -1
  25. package/dist/implementations/dms-builder/engine/map-resources-pages.js +1 -1
  26. package/dist/implementations/dms-builder/engine/map-resources-pages.js.map +1 -1
  27. package/dist/implementations/dms-builder/engine/ops-blocks.d.ts +2 -1
  28. package/dist/implementations/dms-builder/engine/ops-blocks.js +12 -1
  29. package/dist/implementations/dms-builder/engine/ops-blocks.js.map +1 -1
  30. package/dist/implementations/dms-builder/engine/table-view-settings.js +9 -33
  31. package/dist/implementations/dms-builder/engine/table-view-settings.js.map +1 -1
  32. package/dist/index.js +2 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/mcp/index.d.ts +2 -0
  35. package/dist/mcp/index.js +9 -0
  36. package/dist/mcp/index.js.map +1 -1
  37. package/dist/mcp/mockup-export/capture.d.ts +19 -0
  38. package/dist/mcp/mockup-export/capture.js +99 -0
  39. package/dist/mcp/mockup-export/capture.js.map +1 -0
  40. package/dist/mcp/mockup-export/document.d.ts +4 -0
  41. package/dist/mcp/mockup-export/document.js +199 -0
  42. package/dist/mcp/mockup-export/document.js.map +1 -0
  43. package/dist/mcp/mockup-export/index.d.ts +20 -0
  44. package/dist/mcp/mockup-export/index.js +112 -0
  45. package/dist/mcp/mockup-export/index.js.map +1 -0
  46. package/dist/mcp/mockup-export/jobs.d.ts +32 -0
  47. package/dist/mcp/mockup-export/jobs.js +49 -0
  48. package/dist/mcp/mockup-export/jobs.js.map +1 -0
  49. package/dist/mcp/mockup-export/plan.d.ts +78 -0
  50. package/dist/mcp/mockup-export/plan.js +296 -0
  51. package/dist/mcp/mockup-export/plan.js.map +1 -0
  52. package/dist/mcp/mockup-export/route.d.ts +23 -0
  53. package/dist/mcp/mockup-export/route.js +91 -0
  54. package/dist/mcp/mockup-export/route.js.map +1 -0
  55. package/dist/mcp/page-verify/index.d.ts +15 -0
  56. package/dist/mcp/page-verify/index.js +16 -6
  57. package/dist/mcp/page-verify/index.js.map +1 -1
  58. package/dist/mcp/page-verify/mockup.d.ts +3 -1
  59. package/dist/mcp/page-verify/mockup.js +2 -0
  60. package/dist/mcp/page-verify/mockup.js.map +1 -1
  61. package/dist/mcp/page-verify/modules.d.ts +1 -0
  62. package/dist/mcp/page-verify/modules.js +22 -0
  63. package/dist/mcp/page-verify/modules.js.map +1 -0
  64. package/dist/mcp/page-verify/page-probe.d.ts +5 -0
  65. package/dist/mcp/page-verify/page-probe.js +2 -0
  66. package/dist/mcp/page-verify/page-probe.js.map +1 -1
  67. package/dist/mcp/page-verify/playwright.d.ts +22 -4
  68. package/dist/mcp/page-verify/playwright.js.map +1 -1
  69. package/dist/mcp/page-verify/report.d.ts +1 -0
  70. package/dist/mcp/tools/builder-compose.js +4 -1
  71. package/dist/mcp/tools/builder-compose.js.map +1 -1
  72. package/dist/mcp/tools/builder-pages.js +1 -1
  73. package/dist/mcp/tools/builder-pages.js.map +1 -1
  74. package/dist/mcp/tools/index.d.ts +2 -0
  75. package/dist/mcp/tools/index.js +6 -1
  76. package/dist/mcp/tools/index.js.map +1 -1
  77. package/dist/mcp/tools/mockup-export-pdf.d.ts +1 -0
  78. package/dist/mcp/tools/mockup-export-pdf.js +69 -0
  79. package/dist/mcp/tools/mockup-export-pdf.js.map +1 -0
  80. package/dist/mcp/tools/mockup-install-modules.d.ts +9 -0
  81. package/dist/mcp/tools/mockup-install-modules.js +122 -0
  82. package/dist/mcp/tools/mockup-install-modules.js.map +1 -0
  83. package/dist/mcp/tools/mockup-module-catalog.d.ts +3 -0
  84. package/dist/mcp/tools/mockup-module-catalog.js +52 -0
  85. package/dist/mcp/tools/mockup-module-catalog.js.map +1 -0
  86. package/dist/mcp/tools/mockup-patch-spec.js +1 -1
  87. package/dist/mcp/tools/mockup-patch-spec.js.map +1 -1
  88. package/dist/mcp/tools/mockup-read-spec.js +8 -6
  89. package/dist/mcp/tools/mockup-read-spec.js.map +1 -1
  90. package/dist/mcp/tools/mockup-support.js +18 -5
  91. package/dist/mcp/tools/mockup-support.js.map +1 -1
  92. package/dist/mcp/tools/mockup-write-spec.js +1 -1
  93. package/dist/mcp/tools/mockup-write-spec.js.map +1 -1
  94. package/dist/mcp/tools/mockup.js +6 -0
  95. package/dist/mcp/tools/mockup.js.map +1 -1
  96. package/dist/mcp/tools/page-verify.d.ts +1 -0
  97. package/dist/mcp/tools/page-verify.js +6 -2
  98. package/dist/mcp/tools/page-verify.js.map +1 -1
  99. package/dist/mcp/tools/pages.d.ts +1 -0
  100. package/dist/mcp/tools/pages.js +9 -3
  101. package/dist/mcp/tools/pages.js.map +1 -1
  102. package/dist/mockup/annotations.js +2 -2
  103. package/dist/mockup/annotations.js.map +1 -1
  104. package/dist/mockup/apply-notes.js +1 -1
  105. package/dist/mockup/apply-notes.js.map +1 -1
  106. package/dist/mockup/compile-layouts.d.ts +5 -0
  107. package/dist/mockup/compile-layouts.js +74 -0
  108. package/dist/mockup/compile-layouts.js.map +1 -0
  109. package/dist/mockup/compile-modules.d.ts +5 -0
  110. package/dist/mockup/compile-modules.js +40 -0
  111. package/dist/mockup/compile-modules.js.map +1 -0
  112. package/dist/mockup/compile-nodes.d.ts +11 -0
  113. package/dist/mockup/compile-nodes.js +119 -0
  114. package/dist/mockup/compile-nodes.js.map +1 -0
  115. package/dist/mockup/compile-pages.d.ts +20 -0
  116. package/dist/mockup/compile-pages.js +272 -0
  117. package/dist/mockup/compile-pages.js.map +1 -0
  118. package/dist/mockup/compile.d.ts +10 -12
  119. package/dist/mockup/compile.js +36 -292
  120. package/dist/mockup/compile.js.map +1 -1
  121. package/dist/mockup/controller-blocks.js +2 -0
  122. package/dist/mockup/controller-blocks.js.map +1 -1
  123. package/dist/mockup/create.d.ts +16 -0
  124. package/dist/mockup/create.js +78 -0
  125. package/dist/mockup/create.js.map +1 -0
  126. package/dist/mockup/created-watch.d.ts +18 -0
  127. package/dist/mockup/created-watch.js +110 -0
  128. package/dist/mockup/created-watch.js.map +1 -0
  129. package/dist/mockup/database-routes.d.ts +15 -0
  130. package/dist/mockup/database-routes.js +58 -0
  131. package/dist/mockup/database-routes.js.map +1 -0
  132. package/dist/mockup/database-schema.d.ts +17 -0
  133. package/dist/mockup/database-schema.js +41 -0
  134. package/dist/mockup/database-schema.js.map +1 -0
  135. package/dist/mockup/entities.d.ts +20 -0
  136. package/dist/mockup/entities.js +213 -0
  137. package/dist/mockup/entities.js.map +1 -0
  138. package/dist/mockup/etag.d.ts +1 -0
  139. package/dist/mockup/etag.js +10 -0
  140. package/dist/mockup/etag.js.map +1 -0
  141. package/dist/mockup/extensions.d.ts +34 -0
  142. package/dist/mockup/extensions.js +107 -0
  143. package/dist/mockup/extensions.js.map +1 -0
  144. package/dist/mockup/files.d.ts +2 -1
  145. package/dist/mockup/files.js +2 -1
  146. package/dist/mockup/files.js.map +1 -1
  147. package/dist/mockup/fixture-answers.d.ts +3 -2
  148. package/dist/mockup/fixture-answers.js +13 -4
  149. package/dist/mockup/fixture-answers.js.map +1 -1
  150. package/dist/mockup/fixture-batch.d.ts +21 -0
  151. package/dist/mockup/fixture-batch.js +111 -0
  152. package/dist/mockup/fixture-batch.js.map +1 -0
  153. package/dist/mockup/fixture-routes.d.ts +21 -0
  154. package/dist/mockup/fixture-routes.js +136 -0
  155. package/dist/mockup/fixture-routes.js.map +1 -0
  156. package/dist/mockup/fixtures.d.ts +2 -29
  157. package/dist/mockup/fixtures.js +0 -111
  158. package/dist/mockup/fixtures.js.map +1 -1
  159. package/dist/mockup/from-page.js +2 -9
  160. package/dist/mockup/from-page.js.map +1 -1
  161. package/dist/mockup/generate.js +4 -1
  162. package/dist/mockup/generate.js.map +1 -1
  163. package/dist/mockup/history-routes.d.ts +2 -4
  164. package/dist/mockup/history-routes.js +30 -39
  165. package/dist/mockup/history-routes.js.map +1 -1
  166. package/dist/mockup/history.js +7 -3
  167. package/dist/mockup/history.js.map +1 -1
  168. package/dist/mockup/index.d.ts +14 -0
  169. package/dist/mockup/index.js +14 -0
  170. package/dist/mockup/index.js.map +1 -1
  171. package/dist/mockup/json-schema-entities.d.ts +5 -0
  172. package/dist/mockup/json-schema-entities.js +141 -0
  173. package/dist/mockup/json-schema-entities.js.map +1 -0
  174. package/dist/mockup/json-schema-layout.d.ts +1 -0
  175. package/dist/mockup/json-schema-layout.js +95 -2
  176. package/dist/mockup/json-schema-layout.js.map +1 -1
  177. package/dist/mockup/json-schema.d.ts +1 -1
  178. package/dist/mockup/json-schema.js +41 -20
  179. package/dist/mockup/json-schema.js.map +1 -1
  180. package/dist/mockup/json.d.ts +8 -0
  181. package/dist/mockup/json.js +20 -0
  182. package/dist/mockup/json.js.map +1 -0
  183. package/dist/mockup/layout-model.d.ts +156 -0
  184. package/dist/mockup/layout-model.js +96 -0
  185. package/dist/mockup/layout-model.js.map +1 -0
  186. package/dist/mockup/layouts.d.ts +9 -0
  187. package/dist/mockup/layouts.js +40 -0
  188. package/dist/mockup/layouts.js.map +1 -0
  189. package/dist/mockup/manage-routes.d.ts +3 -1
  190. package/dist/mockup/manage-routes.js +38 -1
  191. package/dist/mockup/manage-routes.js.map +1 -1
  192. package/dist/mockup/manage.js +1 -1
  193. package/dist/mockup/manage.js.map +1 -1
  194. package/dist/mockup/model.d.ts +145 -99
  195. package/dist/mockup/model.js +101 -86
  196. package/dist/mockup/model.js.map +1 -1
  197. package/dist/mockup/module-context.d.ts +25 -0
  198. package/dist/mockup/module-context.js +83 -0
  199. package/dist/mockup/module-context.js.map +1 -0
  200. package/dist/mockup/module-install.d.ts +22 -0
  201. package/dist/mockup/module-install.js +71 -0
  202. package/dist/mockup/module-install.js.map +1 -0
  203. package/dist/mockup/module-states.d.ts +17 -0
  204. package/dist/mockup/module-states.js +167 -0
  205. package/dist/mockup/module-states.js.map +1 -0
  206. package/dist/mockup/modules-schema.d.ts +2 -0
  207. package/dist/mockup/modules-schema.js +38 -0
  208. package/dist/mockup/modules-schema.js.map +1 -0
  209. package/dist/mockup/modules.d.ts +9 -10
  210. package/dist/mockup/modules.js +104 -25
  211. package/dist/mockup/modules.js.map +1 -1
  212. package/dist/mockup/page-capture-routes.d.ts +19 -0
  213. package/dist/mockup/page-capture-routes.js +92 -0
  214. package/dist/mockup/page-capture-routes.js.map +1 -0
  215. package/dist/mockup/page-captures.d.ts +61 -0
  216. package/dist/mockup/page-captures.js +252 -0
  217. package/dist/mockup/page-captures.js.map +1 -0
  218. package/dist/mockup/page-descriptions.d.ts +2 -0
  219. package/dist/mockup/page-descriptions.js +18 -0
  220. package/dist/mockup/page-descriptions.js.map +1 -0
  221. package/dist/mockup/parse-spec.d.ts +10 -0
  222. package/dist/mockup/parse-spec.js +62 -0
  223. package/dist/mockup/parse-spec.js.map +1 -0
  224. package/dist/mockup/places.d.ts +17 -0
  225. package/dist/mockup/places.js +75 -0
  226. package/dist/mockup/places.js.map +1 -0
  227. package/dist/mockup/presence-board.js +1 -1
  228. package/dist/mockup/presence-board.js.map +1 -1
  229. package/dist/mockup/presence-routes.js +2 -2
  230. package/dist/mockup/presence-routes.js.map +1 -1
  231. package/dist/mockup/refusals.d.ts +6 -0
  232. package/dist/mockup/refusals.js +17 -0
  233. package/dist/mockup/refusals.js.map +1 -1
  234. package/dist/mockup/routes.d.ts +3 -5
  235. package/dist/mockup/routes.js +24 -163
  236. package/dist/mockup/routes.js.map +1 -1
  237. package/dist/mockup/sketch-limits.d.ts +1 -0
  238. package/dist/mockup/sketch-limits.js +2 -1
  239. package/dist/mockup/sketch-limits.js.map +1 -1
  240. package/dist/mockup/sketch.d.ts +2 -2
  241. package/dist/mockup/sketch.js +2 -1
  242. package/dist/mockup/sketch.js.map +1 -1
  243. package/dist/mockup/slug.d.ts +3 -0
  244. package/dist/mockup/slug.js +7 -0
  245. package/dist/mockup/slug.js.map +1 -0
  246. package/dist/mockup/source-routes.d.ts +5 -4
  247. package/dist/mockup/source-routes.js +26 -17
  248. package/dist/mockup/source-routes.js.map +1 -1
  249. package/dist/mockup/source.d.ts +3 -3
  250. package/dist/mockup/source.js +4 -3
  251. package/dist/mockup/source.js.map +1 -1
  252. package/dist/mockup/state-patch.d.ts +22 -0
  253. package/dist/mockup/state-patch.js +76 -0
  254. package/dist/mockup/state-patch.js.map +1 -0
  255. package/dist/mockup/state.d.ts +163 -0
  256. package/dist/mockup/state.js +24 -0
  257. package/dist/mockup/state.js.map +1 -0
  258. package/dist/mockup/store-list.d.ts +28 -0
  259. package/dist/mockup/store-list.js +89 -0
  260. package/dist/mockup/store-list.js.map +1 -0
  261. package/dist/mockup/store.d.ts +25 -38
  262. package/dist/mockup/store.js +126 -203
  263. package/dist/mockup/store.js.map +1 -1
  264. package/dist/mockup/table-archive.d.ts +0 -1
  265. package/dist/mockup/table-archive.js +0 -16
  266. package/dist/mockup/table-archive.js.map +1 -1
  267. package/dist/mockup/tenancy.d.ts +19 -0
  268. package/dist/mockup/tenancy.js +73 -0
  269. package/dist/mockup/tenancy.js.map +1 -0
  270. package/dist/mockup/tenant-rows.d.ts +4 -0
  271. package/dist/mockup/tenant-rows.js +19 -0
  272. package/dist/mockup/tenant-rows.js.map +1 -0
  273. package/dist/mockup/unknown-keys.d.ts +2 -2
  274. package/dist/mockup/unknown-keys.js +8 -4
  275. package/dist/mockup/unknown-keys.js.map +1 -1
  276. package/dist/mockup/validate.d.ts +2 -2
  277. package/dist/mockup/validate.js.map +1 -1
  278. package/dist/store/catalog.d.ts +5 -1
  279. package/dist/store/catalog.js +12 -1
  280. package/dist/store/catalog.js.map +1 -1
  281. package/dist/store/changes.d.ts +3 -0
  282. package/dist/store/changes.js +22 -0
  283. package/dist/store/changes.js.map +1 -0
  284. package/dist/store/index.d.ts +2 -0
  285. package/dist/store/index.js +2 -0
  286. package/dist/store/index.js.map +1 -1
  287. package/dist/store/listing.js +5 -5
  288. package/dist/store/listing.js.map +1 -1
  289. package/dist/store/operations.d.ts +8 -0
  290. package/dist/store/operations.js +27 -3
  291. package/dist/store/operations.js.map +1 -1
  292. package/dist/store/registry.d.ts +1 -0
  293. package/dist/store/registry.js +9 -0
  294. package/dist/store/registry.js.map +1 -1
  295. package/dist/store/types.d.ts +3 -0
  296. package/dist/types/index.d.ts +1 -0
  297. package/dist/types/index.js +1 -0
  298. package/dist/types/index.js.map +1 -1
  299. package/dist/types/live-pages.d.ts +41 -0
  300. package/dist/types/live-pages.js +3 -0
  301. package/dist/types/live-pages.js.map +1 -0
  302. package/dist/validation/store.schema.d.ts +1 -0
  303. package/dist/validation/store.schema.js +4 -4
  304. package/dist/validation/store.schema.js.map +1 -1
  305. package/e2e/index.mjs +3 -2
  306. package/frontend-vue/build/viewer-chunks.ts +181 -0
  307. package/frontend-vue/dms.frontend.build.ts +2 -1
  308. package/frontend-vue/dms.frontend.ts +7 -0
  309. package/frontend-vue/eslint-globals.generated.mjs +27 -24
  310. package/frontend-vue/layers/dms-core/app/build/utils/asyncDataScope.ts +3 -31
  311. package/frontend-vue/layers/dms-core/app/build/utils/previewFrame.ts +6 -1
  312. package/frontend-vue/layers/dms-core/app/composables/auth/useAuthFetch.ts +8 -2
  313. package/frontend-vue/layers/dms-core/app/utils/localFetchAnswers.ts +124 -0
  314. package/frontend-vue/layers/dms-core/app/utils/textDigest.ts +29 -0
  315. package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +4 -0
  316. package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +4 -0
  317. package/frontend-vue/layers/dms-layout/app/build/components/layout/DashboardSidebar.vue +89 -31
  318. package/frontend-vue/layers/dms-layout/app/build/components/layout/MockupSidebarMenu.vue +21 -6
  319. package/frontend-vue/layers/dms-layout/app/build/components/layout/SidebarUserMenu.vue +61 -8
  320. package/frontend-vue/layers/dms-layout/app/build/components/layout/mockupMenu.ts +79 -9
  321. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsNav.vue +57 -8
  322. package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/shell/SettingsShell.vue +12 -0
  323. package/frontend-vue/layers/dms-layout/app/build/composables/settings/useSettingsNavigation.ts +42 -62
  324. package/frontend-vue/layers/dms-layout/app/build/mockups/created-mockups.ts +12 -2
  325. package/frontend-vue/layers/dms-layout/app/build/mockups/created-toast.ts +9 -1
  326. package/frontend-vue/layers/dms-layout/app/composables/page/useMockupStoreInstaller.ts +85 -0
  327. package/frontend-vue/layers/dms-layout/app/custom-layouts/MockupLayout.vue +0 -2
  328. package/frontend-vue/layers/dms-layout/app/custom-layouts/PreviewLayout.vue +53 -6
  329. package/frontend-vue/layers/dms-layout/app/plugins/mockup-store-installer.ts +10 -0
  330. package/frontend-vue/layers/dms-layout/app/plugins/registered-sidebar-widgets.ts +10 -0
  331. package/frontend-vue/layers/dms-layout/app/plugins/seo.ts +7 -0
  332. package/frontend-vue/layers/dms-layout/app/theme/actions.ts +11 -7
  333. package/frontend-vue/layers/dms-onboarding/app/middleware/onboarding.global.ts +3 -3
  334. package/frontend-vue/layers/dms-onboarding/app/plugins/onboarding-preload.ts +5 -1
  335. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/BlockPreviewSketch.vue +31 -5
  336. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupCanvasChrome.vue +2 -2
  337. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabase.vue +204 -0
  338. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseData.vue +288 -0
  339. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseDiagram.vue +91 -0
  340. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseRelationEdge.vue +40 -0
  341. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupDatabaseTableNode.vue +133 -0
  342. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupEmptyState.vue +23 -0
  343. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModuleStore.vue +240 -0
  344. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverview.vue +54 -33
  345. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSectionLabel.vue +52 -0
  346. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewSlot.vue +65 -12
  347. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPagesList.vue +21 -0
  348. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinCard.vue +1 -1
  349. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupPinLayer.vue +1 -1
  350. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupReconnecting.vue +17 -0
  351. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTenantBanner.vue +48 -0
  352. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTitle.vue +24 -15
  353. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupToolbar.vue +196 -0
  354. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupTopBar.vue +200 -179
  355. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWarningsMenu.vue +59 -0
  356. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +152 -57
  357. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkspaceSwitcher.vue +142 -0
  358. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewAdmission.ts +20 -0
  359. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewCapture.ts +71 -4
  360. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewNavigation.ts +44 -4
  361. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/previewSwapHold.ts +157 -0
  362. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/registeredSidebarWidgets.ts +20 -0
  363. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/storeModuleInstaller.ts +32 -0
  364. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockInspector.ts +14 -2
  365. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +309 -41
  366. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useFixtureBatches.ts +154 -0
  367. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupActivation.ts +182 -0
  368. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupConnectionTables.ts +80 -0
  369. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupDatabase.ts +212 -0
  370. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupEditing.ts +13 -1
  371. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameRender.ts +126 -0
  372. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupFrameSize.ts +10 -5
  373. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupOverview.ts +50 -23
  374. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageFrame.ts +103 -29
  375. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPageZoom.ts +146 -0
  376. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPdfExport.ts +124 -0
  377. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupPins.ts +1 -1
  378. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRealData.ts +11 -4
  379. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupRoutePage.ts +60 -14
  380. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSession.ts +8 -3
  381. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +6 -2
  382. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupTenancy.ts +36 -0
  383. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupToolModes.ts +5 -7
  384. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerActivation.ts +59 -0
  385. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerExport.ts +46 -0
  386. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerPages.ts +44 -10
  387. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +13 -2
  388. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupWarningFocus.ts +145 -0
  389. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useOverviewCaptures.ts +39 -10
  390. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePersistedCaptures.ts +151 -0
  391. package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +41 -0
  392. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCards.vue +37 -3
  393. package/frontend-vue/layers/dms-ui/app/build/mockups/MockupCreateModal.vue +130 -0
  394. package/frontend-vue/layers/dms-ui/app/build/mockups/manage.ts +20 -1
  395. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +137 -78
  396. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewChannel.ts +1 -8
  397. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +165 -103
  398. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewNavigation.ts +321 -0
  399. package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewRects.ts +22 -0
  400. package/frontend-vue/layers/dms-ui/app/build/utils/mockup.ts +112 -175
  401. package/frontend-vue/layers/dms-ui/app/build/utils/mockupActivation.ts +120 -0
  402. package/frontend-vue/layers/dms-ui/app/build/utils/mockupAnnotations.ts +146 -0
  403. package/frontend-vue/layers/dms-ui/app/build/utils/mockupCaptures.ts +118 -9
  404. package/frontend-vue/layers/dms-ui/app/build/utils/mockupDiagram.ts +330 -0
  405. package/frontend-vue/layers/dms-ui/app/build/utils/mockupEntities.ts +80 -0
  406. package/frontend-vue/layers/dms-ui/app/build/utils/mockupFrame.ts +123 -8
  407. package/frontend-vue/layers/dms-ui/app/build/utils/mockupLinks.ts +11 -2
  408. package/frontend-vue/layers/dms-ui/app/build/utils/mockupModuleNavigation.ts +215 -0
  409. package/frontend-vue/layers/dms-ui/app/build/utils/mockupModules.ts +240 -0
  410. package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverview.ts +21 -3
  411. package/frontend-vue/layers/dms-ui/app/build/utils/mockupOverviewSections.ts +66 -0
  412. package/frontend-vue/layers/dms-ui/app/build/utils/mockupPageTree.ts +15 -0
  413. package/frontend-vue/layers/dms-ui/app/build/utils/mockupPins.ts +6 -8
  414. package/frontend-vue/layers/dms-ui/app/build/utils/mockupRealData.ts +23 -5
  415. package/frontend-vue/layers/dms-ui/app/build/utils/mockupRows.ts +83 -0
  416. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSchema.ts +173 -0
  417. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSettings.ts +218 -0
  418. package/frontend-vue/layers/dms-ui/app/build/utils/mockupShortcuts.ts +17 -6
  419. package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +20 -0
  420. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStatePatch.ts +180 -0
  421. package/frontend-vue/layers/dms-ui/app/build/utils/mockupStream.ts +17 -2
  422. package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenancy.ts +148 -0
  423. package/frontend-vue/layers/dms-ui/app/build/utils/mockupTenants.ts +23 -0
  424. package/frontend-vue/layers/dms-ui/app/build/utils/mockupTitles.ts +33 -0
  425. package/frontend-vue/layers/dms-ui/app/build/utils/mockupVersions.ts +2 -7
  426. package/frontend-vue/layers/dms-ui/app/build/utils/previewFixtureAnswers.ts +156 -0
  427. package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +37 -19
  428. package/frontend-vue/layers/dms-ui/app/build/utils/previewOptionRules.ts +129 -0
  429. package/frontend-vue/layers/dms-ui/app/build/utils/previewPageLayout.ts +108 -6
  430. package/frontend-vue/layers/dms-ui/app/build/utils/previewPageQuery.ts +5 -1
  431. package/frontend-vue/layers/dms-ui/app/build/utils/previewRows.ts +400 -0
  432. package/frontend-vue/layers/dms-ui/app/build/utils/recordGuards.ts +15 -0
  433. package/frontend-vue/layers/dms-ui/app/build/utils/settingsGroups.ts +73 -0
  434. package/frontend-vue/layers/dms-ui/app/build/utils/sketch.ts +68 -12
  435. package/frontend-vue/layers/dms-ui/app/build/utils/urlVariables.ts +15 -0
  436. package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +61 -12
  437. package/frontend-vue/layers/dms-ui/app/components/block-preview/MockupViewer.vue +4 -1
  438. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupModuleStore.ts +2 -0
  439. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupTenantBanner.ts +2 -0
  440. package/frontend-vue/layers/dms-ui/app/entries/components/block-preview/MockupWorkspaceSwitcher.ts +2 -0
  441. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/registeredSidebarWidgets.ts +1 -0
  442. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/storeModuleInstaller.ts +1 -0
  443. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useFixtureBatches.ts +1 -0
  444. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupActivation.ts +1 -0
  445. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupOverview.ts +1 -0
  446. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupPdfExport.ts +1 -0
  447. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupRoutePage.ts +1 -0
  448. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupSession.ts +1 -0
  449. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/useMockupTenancy.ts +1 -0
  450. package/frontend-vue/layers/dms-ui/app/entries/composables/block-preview/usePersistedCaptures.ts +1 -0
  451. package/frontend-vue/layers/dms-ui/app/entries/utils/blockPreview.ts +1 -0
  452. package/frontend-vue/layers/dms-ui/app/entries/utils/json.ts +1 -0
  453. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupActivation.ts +1 -0
  454. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupAnnotations.ts +1 -0
  455. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupDiagram.ts +1 -0
  456. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupModuleNavigation.ts +1 -0
  457. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupOverviewSections.ts +1 -0
  458. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupRows.ts +1 -0
  459. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSchema.ts +1 -0
  460. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupSettings.ts +1 -0
  461. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupStatePatch.ts +1 -0
  462. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenancy.ts +1 -0
  463. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTenants.ts +1 -0
  464. package/frontend-vue/layers/dms-ui/app/entries/utils/mockupTitles.ts +1 -0
  465. package/frontend-vue/layers/dms-ui/app/entries/utils/previewFixtureAnswers.ts +1 -0
  466. package/frontend-vue/layers/dms-ui/app/entries/utils/previewRows.ts +1 -0
  467. package/frontend-vue/layers/dms-ui/app/entries/utils/settingsGroups.ts +1 -0
  468. package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +85 -7
  469. package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +85 -7
  470. package/frontend-vue/package.json +2 -2
  471. package/frontend-vue/scripts/test-dms-components.mjs +1 -1
  472. package/package.json +6 -5
  473. package/dist/mockup/row-filters.d.ts +0 -8
  474. package/dist/mockup/row-filters.js +0 -107
  475. package/dist/mockup/row-filters.js.map +0 -1
  476. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupModules.vue +0 -47
  477. package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupOverviewZoom.vue +0 -67
@@ -31,11 +31,17 @@ export interface MockupCombo {
31
31
  /**
32
32
  * What the canvas shows: one page of the mockup as it is now, or of a past
33
33
  * version of it, read-only; every page of either side by side, in the
34
- * overview; or a page as the dashboard runs it, in Preview, where a click
35
- * reaches the page.
34
+ * overview; a page as the dashboard runs it, in Preview, where a click
35
+ * reaches the page unless the Comment tool is armed; or the DB explorer over the canvas, where no key reaches
36
+ * the page behind it.
36
37
  */
37
38
  export type MockupView =
38
- "current" | "version" | "overview" | "overview_version" | "preview";
39
+ | "current"
40
+ | "version"
41
+ | "overview"
42
+ | "overview_version"
43
+ | "preview"
44
+ | "database";
39
45
 
40
46
  const PAGE_VIEWS: readonly MockupView[] = ["current", "version"];
41
47
  const OVERVIEW_VIEWS: readonly MockupView[] = ["overview", "overview_version"];
@@ -88,12 +94,12 @@ export const MOCKUP_SHORTCUTS = {
88
94
  cancel: {
89
95
  group: "editing",
90
96
  combos: [{ key: "escape" }],
91
- views: ["current", "overview"],
97
+ views: ["current", "overview", "preview"],
92
98
  },
93
99
  comment: {
94
100
  group: "comments",
95
101
  combos: [{ key: "c" }],
96
- views: ["current", "overview"],
102
+ views: ["current", "overview", "preview"],
97
103
  },
98
104
  undo: {
99
105
  group: "history",
@@ -118,7 +124,7 @@ export const MOCKUP_SHORTCUTS = {
118
124
  fit_all: {
119
125
  group: "overview",
120
126
  combos: [{ key: "1", code: "Digit1", shift: true }],
121
- views: OVERVIEW_VIEWS,
127
+ views: [...EVERY_VIEW, "preview"],
122
128
  },
123
129
  preview: {
124
130
  group: "preview",
@@ -130,6 +136,11 @@ export const MOCKUP_SHORTCUTS = {
130
136
  combos: [{ key: "escape" }],
131
137
  views: ["preview"],
132
138
  },
139
+ close_database: {
140
+ group: "panels",
141
+ combos: [{ key: "escape" }],
142
+ views: ["database"],
143
+ },
133
144
  } as const satisfies Record<string, MockupShortcut>;
134
145
 
135
146
  export type MockupShortcutId = keyof typeof MOCKUP_SHORTCUTS;
@@ -216,6 +216,26 @@ export function parseNodePointer(
216
216
  return { page: Number(page), steps: [Number(root), ...deeper] };
217
217
  }
218
218
 
219
+ const WARNED_PATTERN =
220
+ /^\/pages\/(\d+)(\/tree\/\d+(?:\/children\/\d+)*)?(?=\/|$)/;
221
+
222
+ /**
223
+ * The page a warning's pointer is on, by index, and the pointer of the node
224
+ * it is in, when it is in one: `/pages/0/tree/2/options/to` is in the node
225
+ * `/pages/0/tree/2`, `/pages/0` is on the page alone. Undefined when it is on
226
+ * no page.
227
+ */
228
+ export function warnedNode(
229
+ pointer: string,
230
+ ): { page: number; node?: string } | undefined {
231
+ const match = WARNED_PATTERN.exec(pointer);
232
+ if (!match) return undefined;
233
+ const [, page, steps] = match;
234
+ return steps === undefined
235
+ ? { page: Number(page) }
236
+ : { page: Number(page), node: `/pages/${page}${steps}` };
237
+ }
238
+
219
239
  /** The spec pointer of the node at `address`. */
220
240
  export function nodePointer(address: MockupNodeAddress): string {
221
241
  const [root, ...deeper] = address.steps;
@@ -0,0 +1,180 @@
1
+ import type { isObject } from "../../../../dms-core/app/utils/type-check";
2
+ import { isNumber, isString } from "../../../../dms-core/app/utils/type-check";
3
+ import {
4
+ isPageState,
5
+ parseMockupState,
6
+ type MockupPageState,
7
+ type MockupState,
8
+ } from "./mockup";
9
+ import { isRecord } from "./recordGuards";
10
+
11
+ /** The keys of a state besides its name, revision and pages. */
12
+ type FieldKey = Exclude<keyof MockupState, "name" | "revision" | "pages">;
13
+
14
+ /**
15
+ * `fields` as the tuple it is, when it lists every {@link FieldKey}: a key
16
+ * added to {@link MockupState} and left out of the list is an argument of
17
+ * type `never`, so the file stops compiling.
18
+ */
19
+ function allFields<const Listed extends readonly FieldKey[]>(
20
+ fields: Listed &
21
+ ([Exclude<FieldKey, Listed[number]>] extends [never] ? unknown : never),
22
+ ): Listed {
23
+ return fields;
24
+ }
25
+
26
+ /** The keys of a state besides its name, revision and pages: each is sent whole when it changed. */
27
+ const STATE_FIELDS = allFields([
28
+ "title",
29
+ "categories",
30
+ "sidebar",
31
+ "modules",
32
+ "entities",
33
+ "tenants",
34
+ "connection",
35
+ "settings",
36
+ "issues",
37
+ "warnings",
38
+ ]);
39
+
40
+ type StateField = (typeof STATE_FIELDS)[number];
41
+
42
+ /** The fields a state can lose: every one but its issues, which it always lists. */
43
+ type DroppableField = Exclude<StateField, "issues">;
44
+
45
+ /**
46
+ * What changed from the state the stream sent last to the state now: the
47
+ * revision it was diffed against, the revision it leads to, the fields that
48
+ * changed, and for the pages the ones that changed or came whole, the ids of
49
+ * the ones that went, and the ids in order when the order changed.
50
+ */
51
+ export interface MockupStatePatch {
52
+ /** The revision of the state the patch applies to, and only to. */
53
+ from: number;
54
+ revision: number;
55
+ set?: Partial<Pick<MockupState, StateField>>;
56
+ unset?: DroppableField[];
57
+ pages?: {
58
+ changed: MockupPageState[];
59
+ removed: string[];
60
+ order?: string[];
61
+ };
62
+ }
63
+
64
+ const FIELD_NAMES: ReadonlySet<string> = new Set(STATE_FIELDS);
65
+
66
+ function isField(value: Parameters<typeof isString>[0]): value is StateField {
67
+ return isString(value) && FIELD_NAMES.has(value);
68
+ }
69
+
70
+ function isDroppable(
71
+ value: Parameters<typeof isString>[0],
72
+ ): value is DroppableField {
73
+ return isField(value) && value !== "issues";
74
+ }
75
+
76
+ /** The fields a patch sets, each as a state holds it, or undefined when one is no such value. */
77
+ function parseSet(
78
+ set: Parameters<typeof isObject>[0],
79
+ ): MockupStatePatch["set"] | undefined {
80
+ if (!isRecord(set) || !Object.keys(set).every(isField)) return undefined;
81
+ const parsed = parseMockupState({
82
+ name: "patch",
83
+ revision: 0,
84
+ pages: [],
85
+ issues: [],
86
+ ...set,
87
+ });
88
+ if (!parsed) return undefined;
89
+ return Object.fromEntries(
90
+ Object.keys(set).flatMap((field) =>
91
+ isField(field) ? [[field, parsed[field]]] : [],
92
+ ),
93
+ );
94
+ }
95
+
96
+ function parsePages(
97
+ pages: Parameters<typeof isObject>[0],
98
+ ): MockupStatePatch["pages"] | undefined {
99
+ if (!isRecord(pages)) return undefined;
100
+ const { changed, removed, order } = pages;
101
+ const isIds = (ids: Parameters<typeof isObject>[0]) =>
102
+ Array.isArray(ids) && ids.every(isString);
103
+ if (
104
+ !Array.isArray(changed) ||
105
+ !changed.every(isPageState) ||
106
+ !isIds(removed) ||
107
+ !Array.isArray(removed) ||
108
+ (order !== undefined && !isIds(order))
109
+ ) {
110
+ return undefined;
111
+ }
112
+ return {
113
+ changed,
114
+ removed: removed.filter(isString),
115
+ ...(Array.isArray(order) && { order: order.filter(isString) }),
116
+ };
117
+ }
118
+
119
+ /** The patch a stream event carries, or undefined when the data is not one. */
120
+ export function parseStatePatch(
121
+ value: Parameters<typeof isObject>[0],
122
+ ): MockupStatePatch | undefined {
123
+ if (!isRecord(value) || !isNumber(value.revision) || !isNumber(value.from)) {
124
+ return undefined;
125
+ }
126
+ const set = value.set === undefined ? undefined : parseSet(value.set);
127
+ const pages = value.pages === undefined ? undefined : parsePages(value.pages);
128
+ const unset = value.unset;
129
+ const isValid =
130
+ (value.set === undefined || set !== undefined) &&
131
+ (value.pages === undefined || pages !== undefined) &&
132
+ (unset === undefined || (Array.isArray(unset) && unset.every(isDroppable)));
133
+ if (!isValid) return undefined;
134
+ return {
135
+ from: value.from,
136
+ revision: value.revision,
137
+ ...(set && { set }),
138
+ ...(Array.isArray(unset) && { unset: unset.filter(isDroppable) }),
139
+ ...(pages && { pages }),
140
+ };
141
+ }
142
+
143
+ /** The pages of `state` with `patch` applied, an unchanged page being the object it was. */
144
+ function patchedPages(
145
+ state: MockupState,
146
+ pages: NonNullable<MockupStatePatch["pages"]>,
147
+ ): MockupPageState[] | undefined {
148
+ const byId = new Map(state.pages.map((page) => [page.id, page]));
149
+ for (const id of pages.removed) byId.delete(id);
150
+ for (const page of pages.changed) byId.set(page.id, page);
151
+ const order = pages.order ?? state.pages.map((page) => page.id);
152
+ const ordered = order.flatMap((id) => byId.get(id) ?? []);
153
+ return ordered.length === order.length ? ordered : undefined;
154
+ }
155
+
156
+ /**
157
+ * `state` as `patch` changes it: the new revision, the fields it sets and
158
+ * drops, and the pages it changes, adds, removes and reorders. Every page the
159
+ * patch leaves alone is the object `state` already held, so nothing that
160
+ * watches it fires. Undefined when `state` is not the revision the patch was
161
+ * diffed against, or the patch names a page `state` has not and the patch does
162
+ * not bring: the viewer then opens the stream again, which sends the state
163
+ * whole.
164
+ */
165
+ export function applyStatePatch(
166
+ state: MockupState,
167
+ patch: MockupStatePatch,
168
+ ): MockupState | undefined {
169
+ if (patch.from !== state.revision) return undefined;
170
+ const pages = patch.pages ? patchedPages(state, patch.pages) : state.pages;
171
+ if (!pages) return undefined;
172
+ const next: MockupState = {
173
+ ...state,
174
+ ...patch.set,
175
+ pages,
176
+ revision: patch.revision,
177
+ };
178
+ for (const field of patch.unset ?? []) Reflect.deleteProperty(next, field);
179
+ return next;
180
+ }
@@ -3,12 +3,13 @@ import { isString } from "../../../../dms-core/app/utils/type-check";
3
3
  import { isJsonValue } from "./json";
4
4
  import {
5
5
  MOCKUP_ANNOTATIONS_EVENT,
6
+ MOCKUP_PATCH_EVENT,
6
7
  MOCKUP_STATE_EVENT,
7
- parseAnnotations,
8
8
  parseMockupState,
9
- type MockupAnnotation,
10
9
  type MockupState,
11
10
  } from "./mockup";
11
+ import { parseAnnotations, type MockupAnnotation } from "./mockupAnnotations";
12
+ import { type MockupStatePatch, parseStatePatch } from "./mockupStatePatch";
12
13
  import {
13
14
  MOCKUP_PRESENCE_EVENT,
14
15
  parseMockupPresence,
@@ -18,7 +19,10 @@ import {
18
19
  const REOPEN_DELAY_MS = 2000;
19
20
 
20
21
  export interface MockupStreamHandlers {
22
+ /** The state, whole: on connect, and again when the stream reconnects. */
21
23
  onState: (state: MockupState) => void;
24
+ /** What changed since the last state or patch the stream sent, which the patch names by its `from`. */
25
+ onPatch: (patch: MockupStatePatch) => void;
22
26
  onAnnotations: (annotations: MockupAnnotation[]) => void;
23
27
  /** Who is on the mockup and which blocks they hold, on connect and after each change. */
24
28
  onPresence: (presence: MockupPresence) => void;
@@ -28,6 +32,8 @@ export interface MockupStreamHandlers {
28
32
 
29
33
  export interface MockupStream {
30
34
  close: () => void;
35
+ /** Opens the stream again at once: the server sends the state whole on connect. */
36
+ reopen: () => void;
31
37
  }
32
38
 
33
39
  interface StreamState {
@@ -72,6 +78,10 @@ function open(state: StreamState): void {
72
78
  const mockup = parseMockupState(readJson(event));
73
79
  if (mockup) state.handlers.onState(mockup);
74
80
  });
81
+ source.addEventListener(MOCKUP_PATCH_EVENT, (event) => {
82
+ const patch = parseStatePatch(readJson(event));
83
+ if (patch) state.handlers.onPatch(patch);
84
+ });
75
85
  source.addEventListener(MOCKUP_ANNOTATIONS_EVENT, (event) => {
76
86
  const annotations = parseAnnotations(readJson(event));
77
87
  if (annotations) state.handlers.onAnnotations(annotations);
@@ -103,6 +113,11 @@ export function openMockupStream(
103
113
  };
104
114
  open(state);
105
115
  return {
116
+ reopen: () => {
117
+ if (state.reopenTimer) clearTimeout(state.reopenTimer);
118
+ state.reopenTimer = null;
119
+ open(state);
120
+ },
106
121
  close: () => {
107
122
  state.isClosed = true;
108
123
  if (state.reopenTimer) clearTimeout(state.reopenTimer);
@@ -0,0 +1,148 @@
1
+ import type { PreviewNode } from "./blockPreview";
2
+ import type {
3
+ PreviewHiddenRows,
4
+ PreviewWorkspace,
5
+ } from "./blockPreviewNavigation";
6
+ import {
7
+ isWritableObject,
8
+ type JsonWritable,
9
+ type JsonWritableObject,
10
+ } from "./json";
11
+ import { isString } from "../../../../dms-core/app/utils/type-check";
12
+ import { mockupEndpoint } from "./mockup";
13
+ import type { MockupEntityState } from "./mockupEntities";
14
+ import type { MockupTenant } from "./mockupTenants";
15
+
16
+ /**
17
+ * The tenant SaaS mode shows: `preferred` while the spec still lists it, else
18
+ * the first one; undefined when the spec lists none.
19
+ */
20
+ export function activeTenantId(
21
+ tenants: readonly MockupTenant[],
22
+ preferred: string | undefined,
23
+ ): string | undefined {
24
+ return tenants.some((tenant) => tenant.id === preferred)
25
+ ? preferred
26
+ : tenants[0]?.id;
27
+ }
28
+
29
+ function scopedFields(
30
+ fields: JsonWritableObject,
31
+ from: string,
32
+ to: string,
33
+ ): JsonWritableObject {
34
+ return Object.fromEntries(
35
+ Object.entries(fields).map(([key, field]) => [
36
+ key,
37
+ field === undefined ? undefined : scopedJson(field, from, to),
38
+ ]),
39
+ );
40
+ }
41
+
42
+ function scopedJson(
43
+ value: JsonWritable,
44
+ from: string,
45
+ to: string,
46
+ ): JsonWritable {
47
+ if (isString(value)) {
48
+ return value.startsWith(from) ? `${to}${value.slice(from.length)}` : value;
49
+ }
50
+ if (Array.isArray(value)) {
51
+ return value.map((item) => scopedJson(item, from, to));
52
+ }
53
+ return isWritableObject(value) ? scopedFields(value, from, to) : value;
54
+ }
55
+
56
+ function scopedNode(node: PreviewNode, from: string, to: string): PreviewNode {
57
+ return {
58
+ ...node,
59
+ ...(node.options && { options: scopedFields(node.options, from, to) }),
60
+ ...(node.children && {
61
+ children: node.children.map((child) => scopedNode(child, from, to)),
62
+ }),
63
+ };
64
+ }
65
+
66
+ /**
67
+ * `tree` with every string that starts at the mockup's fixture routes,
68
+ * `/api/mockup/<name>/pages/`, moved under the tenant's,
69
+ * `/api/mockup/<name>/tenants/<tenant>/pages/`, at any depth. What follows
70
+ * the prefix, a suffix or a query, stays as it is; any other string stays too.
71
+ */
72
+ export function withTenantFixtures(
73
+ tree: readonly PreviewNode[],
74
+ name: string,
75
+ tenant: string,
76
+ ): PreviewNode[] {
77
+ const from = mockupEndpoint(name, "/pages/");
78
+ const to = mockupEndpoint(
79
+ name,
80
+ `/tenants/${encodeURIComponent(tenant)}/pages/`,
81
+ );
82
+ return tree.map((node) => scopedNode(node, from, to));
83
+ }
84
+
85
+ const FIXTURE_BATCH_ROUTE = /^(\/api\/mockup\/[^/]+)\/pages\//;
86
+
87
+ /**
88
+ * `route`, the fixture batch of a page of the mockup, as the tenant `tenant`
89
+ * sees it: moved under the tenant's routes, as {@link withTenantFixtures}
90
+ * moves a tree's.
91
+ */
92
+ export function tenantFixtureRoute(route: string, tenant: string): string {
93
+ return route.replace(
94
+ FIXTURE_BATCH_ROUTE,
95
+ (_, mockup: string) =>
96
+ `${mockup}/tenants/${encodeURIComponent(tenant)}/pages/`,
97
+ );
98
+ }
99
+
100
+ /**
101
+ * Each tenant-scoped entity the page `page` holds, with the rows of the
102
+ * tenant `tenant` it shows out of all its rows; empty for a page that holds
103
+ * none.
104
+ */
105
+ export function hiddenRows(
106
+ entities: readonly MockupEntityState[] | undefined,
107
+ page: string | undefined,
108
+ tenant: string,
109
+ ): PreviewHiddenRows[] {
110
+ return (entities ?? []).flatMap((entity) =>
111
+ entity.tenantScoped === true &&
112
+ page !== undefined &&
113
+ entity.pages.includes(page)
114
+ ? [
115
+ {
116
+ entity: entity.name,
117
+ shown: entity.rows.filter((row) => row.tenantId === tenant).length,
118
+ total: entity.rows.length,
119
+ },
120
+ ]
121
+ : [],
122
+ );
123
+ }
124
+
125
+ /**
126
+ * What the preview's sidebar and banner draw of SaaS mode: the tenants of
127
+ * `spec`, the active one and the rows hidden on `page`. Undefined when there
128
+ * is no active tenant, which is the case in single-tenant mode and for a spec
129
+ * that lists no tenant.
130
+ */
131
+ export function mockupWorkspace(
132
+ spec:
133
+ | {
134
+ tenants?: readonly MockupTenant[];
135
+ entities?: readonly MockupEntityState[];
136
+ }
137
+ | undefined,
138
+ tenant: string | undefined,
139
+ page: string | undefined,
140
+ ): PreviewWorkspace | undefined {
141
+ const tenants = spec?.tenants;
142
+ if (tenant === undefined || !tenants?.length) return undefined;
143
+ return {
144
+ tenants: [...tenants],
145
+ active: tenant,
146
+ hidden: hiddenRows(spec?.entities, page, tenant),
147
+ };
148
+ }
@@ -0,0 +1,23 @@
1
+ import { isString } from "../../../../dms-core/app/utils/type-check";
2
+ import { isOptionalString, isRecord } from "./recordGuards";
3
+
4
+ /** A workspace of the mockup's SaaS mode: one of `fixtures.tenants` of the spec. */
5
+ export interface MockupTenant {
6
+ id: string;
7
+ name: string;
8
+ plan?: string;
9
+ }
10
+
11
+ function isTenant(value: unknown): value is MockupTenant {
12
+ return (
13
+ isRecord(value) &&
14
+ isString(value.id) &&
15
+ isString(value.name) &&
16
+ isOptionalString(value.plan)
17
+ );
18
+ }
19
+
20
+ /** Whether `value` is a list of tenants, each read. */
21
+ export function isMockupTenants(value: unknown): value is MockupTenant[] {
22
+ return Array.isArray(value) && value.every(isTenant);
23
+ }
@@ -0,0 +1,33 @@
1
+ import { readTranslationKey } from "../../../../dms-core/app/composables/translation/useTranslation";
2
+
3
+ /** Resolves a display string as the dashboard does: an i18n key (`$…`) as its translation, any other text as it is. */
4
+ export type ProcessI18n = (text: string) => string;
5
+
6
+ /**
7
+ * The title of a page as the dashboard shows it: an i18n key (`$…`) as its
8
+ * translation. Any other title, and a key the locale has no text for, which
9
+ * `processI18n` answers with the bare key, is as written, so a title the spec
10
+ * writes, a `$` in it included, reads as it was.
11
+ */
12
+ export function displayTitle(title: string, processI18n: ProcessI18n): string {
13
+ const { isKey, key } = readTranslationKey(title);
14
+ const resolved = processI18n(title);
15
+ return isKey && resolved === key ? title : resolved;
16
+ }
17
+
18
+ /**
19
+ * `pages` with each title as {@link displayTitle} gives it. A page the project
20
+ * registers keeps the key it registered its title under (`$saas.billing.title`),
21
+ * which the real dashboard translates where it shows it: the viewer does so in
22
+ * one place, so the explorer, the sidebar, the breadcrumb and every panel
23
+ * read the same text.
24
+ */
25
+ export function withDisplayTitles<Page extends { title: string }>(
26
+ pages: readonly Page[],
27
+ processI18n: ProcessI18n,
28
+ ): Page[] {
29
+ return pages.map((page) => {
30
+ const title = displayTitle(page.title, processI18n);
31
+ return title === page.title ? page : { ...page, title };
32
+ });
33
+ }
@@ -3,13 +3,8 @@ import {
3
3
  isObject,
4
4
  isString,
5
5
  } from "../../../../dms-core/app/utils/type-check";
6
- import {
7
- mockupEndpoint,
8
- parseAnnotations,
9
- parseMockupState,
10
- type MockupAnnotation,
11
- type MockupState,
12
- } from "./mockup";
6
+ import { mockupEndpoint, parseMockupState, type MockupState } from "./mockup";
7
+ import { parseAnnotations, type MockupAnnotation } from "./mockupAnnotations";
13
8
 
14
9
  /** Who wrote a version of a mockup: the AI's tools, this viewer, or an edit of the file. */
15
10
  export type MockupVersionAuthor = "ai" | "you" | "disk";