@krizaka/ui 3.63.1 → 3.64.1

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 (405) hide show
  1. package/dist/account-menu.d.ts +1 -1
  2. package/dist/account-menu.js +1 -1
  3. package/dist/account-settings.d.ts +61 -4
  4. package/dist/account-settings.js +206 -44
  5. package/dist/account-settings.js.map +1 -1
  6. package/dist/avatar/defaults.d.ts +16 -5
  7. package/dist/avatar/defaults.js +15 -1
  8. package/dist/avatar/defaults.js.map +1 -1
  9. package/dist/{avatar-BL2iG_Js.d.ts → avatar-BdZcfkWR.d.ts} +11 -4
  10. package/dist/avatar.d.ts +16 -5
  11. package/dist/avatar.js +15 -1
  12. package/dist/avatar.js.map +1 -1
  13. package/dist/blocks.css +41 -0
  14. package/dist/chat.js +1 -1
  15. package/dist/chunk-5D7NMUF6.js +35 -0
  16. package/dist/chunk-5D7NMUF6.js.map +1 -0
  17. package/dist/chunk-A7MQPIEG.js +31 -0
  18. package/dist/chunk-A7MQPIEG.js.map +1 -0
  19. package/dist/chunk-B47WSPMP.js +60 -0
  20. package/dist/chunk-B47WSPMP.js.map +1 -0
  21. package/dist/chunk-EUJ7337V.js +137 -0
  22. package/dist/chunk-EUJ7337V.js.map +1 -0
  23. package/dist/chunk-HK525THY.js +139 -0
  24. package/dist/chunk-HK525THY.js.map +1 -0
  25. package/dist/chunk-HKEAYSFS.js +19 -0
  26. package/dist/chunk-HKEAYSFS.js.map +1 -0
  27. package/dist/{chunk-3D2YI63L.js → chunk-SHBYNQFS.js} +7 -2
  28. package/dist/{chunk-3D2YI63L.js.map → chunk-SHBYNQFS.js.map} +1 -1
  29. package/dist/chunk-ZYHWJ7U5.js +20 -0
  30. package/dist/chunk-ZYHWJ7U5.js.map +1 -0
  31. package/dist/cover-hero.d.ts +4 -0
  32. package/dist/cover-hero.js +5 -2
  33. package/dist/cover-hero.js.map +1 -1
  34. package/dist/dashboard-layout.js +2 -1
  35. package/dist/dashboard-layout.js.map +1 -1
  36. package/dist/docs-layout.js +1 -1
  37. package/dist/filter-bar.d.ts +3 -3
  38. package/dist/frame-D6Xv83t8.d.ts +52 -0
  39. package/dist/match-dialog.js +1 -1
  40. package/dist/media-grid.d.ts +8 -3
  41. package/dist/media-grid.js +1 -1
  42. package/dist/native.d.ts +8 -3
  43. package/dist/native.js +51 -0
  44. package/dist/native.js.map +1 -1
  45. package/dist/service-card.d.ts +25 -1
  46. package/dist/service-card.js +7 -3
  47. package/dist/service-card.js.map +1 -1
  48. package/dist/shop/booking.d.ts +36 -0
  49. package/dist/shop/booking.js +37 -0
  50. package/dist/shop/booking.js.map +1 -0
  51. package/dist/shop/bulletin.d.ts +28 -0
  52. package/dist/shop/bulletin.js +29 -0
  53. package/dist/shop/bulletin.js.map +1 -0
  54. package/dist/shop/demo.d.ts +135 -0
  55. package/dist/shop/demo.js +141 -0
  56. package/dist/shop/demo.js.map +1 -0
  57. package/dist/shop/faq.d.ts +20 -0
  58. package/dist/shop/faq.js +33 -0
  59. package/dist/shop/faq.js.map +1 -0
  60. package/dist/shop/gallery.d.ts +46 -0
  61. package/dist/shop/gallery.js +76 -0
  62. package/dist/shop/gallery.js.map +1 -0
  63. package/dist/shop/hero.d.ts +36 -0
  64. package/dist/shop/hero.js +70 -0
  65. package/dist/shop/hero.js.map +1 -0
  66. package/dist/shop/map-gate.d.ts +22 -0
  67. package/dist/shop/map-gate.js +34 -0
  68. package/dist/shop/map-gate.js.map +1 -0
  69. package/dist/shop/policies.d.ts +18 -0
  70. package/dist/shop/policies.js +16 -0
  71. package/dist/shop/policies.js.map +1 -0
  72. package/dist/shop/reviews.d.ts +25 -0
  73. package/dist/shop/reviews.js +47 -0
  74. package/dist/shop/reviews.js.map +1 -0
  75. package/dist/shop/services.d.ts +57 -0
  76. package/dist/shop/services.js +118 -0
  77. package/dist/shop/services.js.map +1 -0
  78. package/dist/shop/social.d.ts +27 -0
  79. package/dist/shop/social.js +27 -0
  80. package/dist/shop/social.js.map +1 -0
  81. package/dist/shop/story.d.ts +24 -0
  82. package/dist/shop/story.js +26 -0
  83. package/dist/shop/story.js.map +1 -0
  84. package/dist/shop/team.d.ts +24 -0
  85. package/dist/shop/team.js +26 -0
  86. package/dist/shop/team.js.map +1 -0
  87. package/dist/shop/video.d.ts +40 -0
  88. package/dist/shop/video.js +33 -0
  89. package/dist/shop/video.js.map +1 -0
  90. package/dist/shop/visit.d.ts +29 -0
  91. package/dist/shop/visit.js +38 -0
  92. package/dist/shop/visit.js.map +1 -0
  93. package/dist/shop-composer.d.ts +490 -0
  94. package/dist/shop-composer.js +2061 -0
  95. package/dist/shop-composer.js.map +1 -0
  96. package/dist/shop.d.ts +316 -0
  97. package/dist/shop.js +389 -0
  98. package/dist/shop.js.map +1 -0
  99. package/dist/vertical-video.js +1 -1
  100. package/package.json +267 -9
  101. package/registry/account-menu.json +1 -1
  102. package/registry/account-settings.json +67 -6
  103. package/registry/achievement.json +1 -1
  104. package/registry/action-bar.json +1 -1
  105. package/registry/activity-feed.json +1 -1
  106. package/registry/agenda.json +1 -1
  107. package/registry/alert.json +1 -1
  108. package/registry/analysis-report.json +1 -1
  109. package/registry/anatomy-plate.json +1 -1
  110. package/registry/app-header.json +1 -1
  111. package/registry/app-shell.json +1 -1
  112. package/registry/argument-card.json +1 -1
  113. package/registry/audio-player.json +1 -1
  114. package/registry/auth-layout.json +1 -1
  115. package/registry/avatar.json +6 -5
  116. package/registry/badge.json +1 -1
  117. package/registry/bird-plate.json +1 -1
  118. package/registry/button.json +1 -1
  119. package/registry/captcha.json +1 -1
  120. package/registry/card-grid.json +1 -1
  121. package/registry/card.json +1 -1
  122. package/registry/catalogue-page.json +1 -1
  123. package/registry/changelog-page.json +1 -1
  124. package/registry/chapter.json +1 -1
  125. package/registry/chat.json +1 -1
  126. package/registry/checkbox.json +1 -1
  127. package/registry/chip-link.json +1 -1
  128. package/registry/chip-row.json +1 -1
  129. package/registry/chip.json +1 -1
  130. package/registry/choice-grid.json +1 -1
  131. package/registry/code-block.json +1 -1
  132. package/registry/combobox.json +1 -1
  133. package/registry/command.json +1 -1
  134. package/registry/comparison-table.json +1 -1
  135. package/registry/component-page.json +1 -1
  136. package/registry/confirm-button.json +1 -1
  137. package/registry/contact-page.json +1 -1
  138. package/registry/continue-prompt.json +1 -1
  139. package/registry/countdown.json +1 -1
  140. package/registry/cover-hero.json +2 -2
  141. package/registry/cta-panel.json +1 -1
  142. package/registry/dashboard-layout.json +2 -2
  143. package/registry/data-table.json +1 -1
  144. package/registry/date-picker.json +1 -1
  145. package/registry/decision-list.json +1 -1
  146. package/registry/description-list.json +1 -1
  147. package/registry/detail-layout.json +1 -1
  148. package/registry/dialog.json +1 -1
  149. package/registry/docs-article-page.json +1 -1
  150. package/registry/docs-hub-page.json +1 -1
  151. package/registry/docs-layout.json +1 -1
  152. package/registry/docs-nav.json +1 -1
  153. package/registry/document-viewer.json +1 -1
  154. package/registry/doodle.json +1 -1
  155. package/registry/drop-overlay.json +1 -1
  156. package/registry/dropdown-menu.json +1 -1
  157. package/registry/elephant.json +2 -2
  158. package/registry/embed-facade.json +1 -1
  159. package/registry/empty-state.json +1 -1
  160. package/registry/engine-flow.json +1 -1
  161. package/registry/environment-notice.json +1 -1
  162. package/registry/error-page.json +1 -1
  163. package/registry/examples/account-settings/avatar-picker-folder.d.ts +4 -0
  164. package/registry/examples/account-settings/avatar-picker-folder.js +27 -0
  165. package/registry/examples/account-settings/avatar-picker-folder.tsx +23 -0
  166. package/registry/examples/shop/booking-panel.d.ts +4 -0
  167. package/registry/examples/shop/booking-panel.js +12 -0
  168. package/registry/examples/shop/booking-panel.tsx +11 -0
  169. package/registry/examples/shop/booking-sticky.d.ts +4 -0
  170. package/registry/examples/shop/booking-sticky.js +15 -0
  171. package/registry/examples/shop/booking-sticky.tsx +12 -0
  172. package/registry/examples/shop/booking-strip.d.ts +4 -0
  173. package/registry/examples/shop/booking-strip.js +13 -0
  174. package/registry/examples/shop/booking-strip.tsx +12 -0
  175. package/registry/examples/shop/bulletin-banner.d.ts +4 -0
  176. package/registry/examples/shop/bulletin-banner.js +13 -0
  177. package/registry/examples/shop/bulletin-banner.tsx +12 -0
  178. package/registry/examples/shop/bulletin-board.d.ts +4 -0
  179. package/registry/examples/shop/bulletin-board.js +13 -0
  180. package/registry/examples/shop/bulletin-board.tsx +12 -0
  181. package/registry/examples/shop/cards.d.ts +4 -0
  182. package/registry/examples/shop/cards.js +13 -0
  183. package/registry/examples/shop/cards.tsx +12 -0
  184. package/registry/examples/shop/carousel.d.ts +4 -0
  185. package/registry/examples/shop/carousel.js +13 -0
  186. package/registry/examples/shop/carousel.tsx +12 -0
  187. package/registry/examples/shop/document.d.ts +4 -0
  188. package/registry/examples/shop/document.js +20 -0
  189. package/registry/examples/shop/document.tsx +13 -0
  190. package/registry/examples/shop/faq.d.ts +4 -0
  191. package/registry/examples/shop/faq.js +13 -0
  192. package/registry/examples/shop/faq.tsx +12 -0
  193. package/registry/examples/shop/gallery-filmstrip.d.ts +4 -0
  194. package/registry/examples/shop/gallery-filmstrip.js +13 -0
  195. package/registry/examples/shop/gallery-filmstrip.tsx +12 -0
  196. package/registry/examples/shop/gallery-grid.d.ts +4 -0
  197. package/registry/examples/shop/gallery-grid.js +13 -0
  198. package/registry/examples/shop/gallery-grid.tsx +12 -0
  199. package/registry/examples/shop/gallery-mosaic.d.ts +4 -0
  200. package/registry/examples/shop/gallery-mosaic.js +13 -0
  201. package/registry/examples/shop/gallery-mosaic.tsx +12 -0
  202. package/registry/examples/shop/gallery-wall.d.ts +4 -0
  203. package/registry/examples/shop/gallery-wall.js +13 -0
  204. package/registry/examples/shop/gallery-wall.tsx +12 -0
  205. package/registry/examples/shop/hero-banner.d.ts +4 -0
  206. package/registry/examples/shop/hero-banner.js +15 -0
  207. package/registry/examples/shop/hero-banner.tsx +14 -0
  208. package/registry/examples/shop/hero-poster.d.ts +4 -0
  209. package/registry/examples/shop/hero-poster.js +15 -0
  210. package/registry/examples/shop/hero-poster.tsx +14 -0
  211. package/registry/examples/shop/hero-split.d.ts +4 -0
  212. package/registry/examples/shop/hero-split.js +15 -0
  213. package/registry/examples/shop/hero-split.tsx +14 -0
  214. package/registry/examples/shop/hero-tv.d.ts +4 -0
  215. package/registry/examples/shop/hero-tv.js +15 -0
  216. package/registry/examples/shop/hero-tv.tsx +14 -0
  217. package/registry/examples/shop/index.d.ts +4 -0
  218. package/registry/examples/shop/index.js +13 -0
  219. package/registry/examples/shop/index.tsx +12 -0
  220. package/registry/examples/shop/menu-columns.d.ts +4 -0
  221. package/registry/examples/shop/menu-columns.js +13 -0
  222. package/registry/examples/shop/menu-columns.tsx +12 -0
  223. package/registry/examples/shop/menu.d.ts +4 -0
  224. package/registry/examples/shop/menu.js +25 -0
  225. package/registry/examples/shop/menu.tsx +21 -0
  226. package/registry/examples/shop/page.d.ts +4 -0
  227. package/registry/examples/shop/page.js +32 -0
  228. package/registry/examples/shop/page.tsx +27 -0
  229. package/registry/examples/shop/policies.d.ts +4 -0
  230. package/registry/examples/shop/policies.js +13 -0
  231. package/registry/examples/shop/policies.tsx +12 -0
  232. package/registry/examples/shop/reviews-quote.d.ts +4 -0
  233. package/registry/examples/shop/reviews-quote.js +13 -0
  234. package/registry/examples/shop/reviews-quote.tsx +12 -0
  235. package/registry/examples/shop/reviews-strip.d.ts +4 -0
  236. package/registry/examples/shop/reviews-strip.js +13 -0
  237. package/registry/examples/shop/reviews-strip.tsx +12 -0
  238. package/registry/examples/shop/reviews-summary-cards.d.ts +4 -0
  239. package/registry/examples/shop/reviews-summary-cards.js +13 -0
  240. package/registry/examples/shop/reviews-summary-cards.tsx +12 -0
  241. package/registry/examples/shop/social-facade.d.ts +4 -0
  242. package/registry/examples/shop/social-facade.js +13 -0
  243. package/registry/examples/shop/social-facade.tsx +12 -0
  244. package/registry/examples/shop/social-links.d.ts +4 -0
  245. package/registry/examples/shop/social-links.js +12 -0
  246. package/registry/examples/shop/social-links.tsx +11 -0
  247. package/registry/examples/shop/story-owner.d.ts +4 -0
  248. package/registry/examples/shop/story-owner.js +13 -0
  249. package/registry/examples/shop/story-owner.tsx +12 -0
  250. package/registry/examples/shop/story-quote.d.ts +4 -0
  251. package/registry/examples/shop/story-quote.js +13 -0
  252. package/registry/examples/shop/story-quote.tsx +12 -0
  253. package/registry/examples/shop/team-cards.d.ts +4 -0
  254. package/registry/examples/shop/team-cards.js +13 -0
  255. package/registry/examples/shop/team-cards.tsx +12 -0
  256. package/registry/examples/shop/team-row.d.ts +4 -0
  257. package/registry/examples/shop/team-row.js +13 -0
  258. package/registry/examples/shop/team-row.tsx +12 -0
  259. package/registry/examples/shop/video-shorts.d.ts +4 -0
  260. package/registry/examples/shop/video-shorts.js +14 -0
  261. package/registry/examples/shop/video-shorts.tsx +13 -0
  262. package/registry/examples/shop/video-tv.d.ts +4 -0
  263. package/registry/examples/shop/video-tv.js +13 -0
  264. package/registry/examples/shop/video-tv.tsx +12 -0
  265. package/registry/examples/shop/visit-card.d.ts +4 -0
  266. package/registry/examples/shop/visit-card.js +13 -0
  267. package/registry/examples/shop/visit-card.tsx +12 -0
  268. package/registry/examples/shop/visit-map.d.ts +4 -0
  269. package/registry/examples/shop/visit-map.js +13 -0
  270. package/registry/examples/shop/visit-map.tsx +12 -0
  271. package/registry/examples/shop/visit-split.d.ts +4 -0
  272. package/registry/examples/shop/visit-split.js +13 -0
  273. package/registry/examples/shop/visit-split.tsx +12 -0
  274. package/registry/examples/shop-composer/composer.d.ts +4 -0
  275. package/registry/examples/shop-composer/composer.js +17 -0
  276. package/registry/examples/shop-composer/composer.tsx +21 -0
  277. package/registry/field.json +1 -1
  278. package/registry/file-upload.json +1 -1
  279. package/registry/filter-bar.json +1 -1
  280. package/registry/flock.json +1 -1
  281. package/registry/footnote.json +1 -1
  282. package/registry/force-update-screen.json +1 -1
  283. package/registry/form.json +1 -1
  284. package/registry/gallery-page.json +1 -1
  285. package/registry/genui.json +1 -1
  286. package/registry/glossary-term.json +1 -1
  287. package/registry/glossary.json +1 -1
  288. package/registry/glow-card.json +1 -1
  289. package/registry/goal-gauge.json +1 -1
  290. package/registry/grade-stamp.json +1 -1
  291. package/registry/how-it-works-page.json +1 -1
  292. package/registry/image-cropper.json +1 -1
  293. package/registry/index.json +98 -7
  294. package/registry/iso.json +1 -1
  295. package/registry/kanban.json +1 -1
  296. package/registry/kbd.json +1 -1
  297. package/registry/kind-config-editor.json +1 -1
  298. package/registry/kpi-explained.json +1 -1
  299. package/registry/landing-page.json +1 -1
  300. package/registry/landscape.json +1 -1
  301. package/registry/language-switch.json +1 -1
  302. package/registry/legal-page.json +1 -1
  303. package/registry/link-card.json +1 -1
  304. package/registry/list.json +1 -1
  305. package/registry/loader.json +1 -1
  306. package/registry/longform-page.json +1 -1
  307. package/registry/maintenance-screen.json +1 -1
  308. package/registry/map.json +2 -2
  309. package/registry/margin-layout.json +1 -1
  310. package/registry/markdown.json +1 -1
  311. package/registry/marketing-layout.json +1 -1
  312. package/registry/marquee.json +1 -1
  313. package/registry/mascot-quote.json +1 -1
  314. package/registry/mascot-state.json +1 -1
  315. package/registry/mascots.json +1 -1
  316. package/registry/match-dialog.json +1 -1
  317. package/registry/media-capture.json +1 -1
  318. package/registry/media-gallery.json +1 -1
  319. package/registry/media-grid.json +1 -1
  320. package/registry/meta-row.json +1 -1
  321. package/registry/meter.json +1 -1
  322. package/registry/nav-bar.json +2 -2
  323. package/registry/next-actions.json +1 -1
  324. package/registry/notification-preferences.json +1 -1
  325. package/registry/number-ticker.json +1 -1
  326. package/registry/opening-hours.json +1 -1
  327. package/registry/page-header.json +1 -1
  328. package/registry/page-hero.json +1 -1
  329. package/registry/page-index.json +1 -1
  330. package/registry/page.json +1 -1
  331. package/registry/pagination.json +1 -1
  332. package/registry/photo-grid.json +1 -1
  333. package/registry/pointer-light.json +1 -1
  334. package/registry/popover.json +1 -1
  335. package/registry/pricing-page.json +1 -1
  336. package/registry/product-page.json +1 -1
  337. package/registry/profile-card.json +1 -1
  338. package/registry/progress.json +1 -1
  339. package/registry/promise-card.json +1 -1
  340. package/registry/quota-meter.json +1 -1
  341. package/registry/radio-group.json +1 -1
  342. package/registry/rail-nav.json +2 -2
  343. package/registry/recipes.json +1 -1
  344. package/registry/retro-tv.json +1 -1
  345. package/registry/reviews.json +1 -1
  346. package/registry/router.json +1 -1
  347. package/registry/scroll-stage.json +1 -1
  348. package/registry/search-field.json +1 -1
  349. package/registry/section-backdrop.json +1 -1
  350. package/registry/separator.json +1 -1
  351. package/registry/service-card.json +24 -6
  352. package/registry/settings-layout.json +1 -1
  353. package/registry/shop-composer.json +424 -0
  354. package/registry/shop.json +776 -0
  355. package/registry/showcase.json +1 -1
  356. package/registry/signature.json +1 -1
  357. package/registry/site-cahier.json +1 -1
  358. package/registry/site-footer.json +2 -2
  359. package/registry/sites.json +1 -1
  360. package/registry/skeleton.json +1 -1
  361. package/registry/skip-link.json +1 -1
  362. package/registry/slider.json +1 -1
  363. package/registry/slot-picker.json +1 -1
  364. package/registry/slot.json +1 -1
  365. package/registry/specimen-tag.json +1 -1
  366. package/registry/speed-lines.json +1 -1
  367. package/registry/spinner.json +1 -1
  368. package/registry/split-view.json +1 -1
  369. package/registry/stage-banner.json +1 -1
  370. package/registry/stat.json +1 -1
  371. package/registry/status-chip.json +1 -1
  372. package/registry/status-page.json +1 -1
  373. package/registry/step-progress.json +1 -1
  374. package/registry/step-showcase.json +1 -1
  375. package/registry/stepper.json +1 -1
  376. package/registry/sticky-action.json +1 -1
  377. package/registry/stuck.json +1 -1
  378. package/registry/swipe-deck.json +1 -1
  379. package/registry/switch.json +1 -1
  380. package/registry/tabs.json +1 -1
  381. package/registry/tag-input.json +1 -1
  382. package/registry/tag-selector.json +1 -1
  383. package/registry/taped-photo.json +1 -1
  384. package/registry/terminal-replay.json +1 -1
  385. package/registry/text-style.json +1 -1
  386. package/registry/theme.json +1 -1
  387. package/registry/toast.json +1 -1
  388. package/registry/toc.json +1 -1
  389. package/registry/tooltip.json +1 -1
  390. package/registry/tree-view.json +1 -1
  391. package/registry/update-prompt.json +1 -1
  392. package/registry/upload-queue.json +1 -1
  393. package/registry/usage.json +1 -1
  394. package/registry/verified-badge.json +1 -1
  395. package/registry/versus-card.json +1 -1
  396. package/registry/vertical-video.json +1 -1
  397. package/registry/video-player.json +1 -1
  398. package/registry/video-trimmer.json +1 -1
  399. package/registry/virtual.json +1 -1
  400. package/registry/wall.json +3 -3
  401. package/registry/waveform.json +1 -1
  402. package/dist/chunk-7AZ23BUX.js +0 -88
  403. package/dist/chunk-7AZ23BUX.js.map +0 -1
  404. package/dist/chunk-PW2FVPTV.js +0 -85
  405. package/dist/chunk-PW2FVPTV.js.map +0 -1
@@ -0,0 +1,424 @@
1
+ {
2
+ "name": "shop-composer",
3
+ "type": "primitive",
4
+ "title": "Shop composer",
5
+ "summary": "Our own editor for a shop's page document (ADR-007): the outline of the sections, the live preview of the product's page and the inspector of the selected section — variant as live thumbnails, settings as a form generated from the zod schema, words, blocks — with undo and redo, a saved draft and a publish step that shows what changes. First consumer: Akinaza's studio (akinaza#402).",
6
+ "description": "Our own editor for a shop's page document (ADR-007): the outline of the sections, the live preview of the product's page and the inspector of the selected section — variant as live thumbnails, settings as a form generated from the zod schema, words, blocks — with undo and redo, a saved draft and a publish step that shows what changes. First consumer: Akinaza's studio (akinaza#402).",
7
+ "status": "beta",
8
+ "deprecated": null,
9
+ "category": "blocks",
10
+ "platforms": "web",
11
+ "parity": {
12
+ "web": {
13
+ "state": "yes"
14
+ },
15
+ "native": {
16
+ "state": "n/a",
17
+ "reason": "The composer is the studio of the web console; a shop's page is a web page.",
18
+ "use": "shop"
19
+ },
20
+ "desktop": {
21
+ "state": "yes"
22
+ }
23
+ },
24
+ "whenToUse": [
25
+ "The studio of a product whose public page is a `ShopPage` document: the owner chooses sections, their order and how each one is drawn, within a bounded catalogue."
26
+ ],
27
+ "whenNotToUse": [
28
+ {
29
+ "when": "A free-form page builder with a canvas, nested columns and any component anywhere: the model here is a list of sections, deliberately.",
30
+ "use": "shop"
31
+ },
32
+ {
33
+ "when": "A single form of settings.",
34
+ "use": "form"
35
+ }
36
+ ],
37
+ "bestPractices": [
38
+ "The product saves the draft in `onChange` (a valid document, after 800 ms of calm) and serves its own public route with `?draft=<id>` for the preview; the composer talks to it by `postMessage` (`connectShopPreview` in `@krizaka/ui/shop` is the page's half).",
39
+ "Pass the presets of the shop's trade and the section types the trade does not use (`foldedTypes`): they are folded away, not removed.",
40
+ "Pass translated `messages`; English is the default.",
41
+ "Publish only what the composer hands to `onPublish`: it is parsed (`parseShopPage`) and the product parses it again on write."
42
+ ],
43
+ "accessibility": {
44
+ "keyboard": [
45
+ {
46
+ "keys": "↑ ↓",
47
+ "action": "Moves between the rows of the outline."
48
+ },
49
+ {
50
+ "keys": "Alt+↑ / Alt+↓",
51
+ "action": "Moves the focused section up or down; the move is announced and focus stays on its row."
52
+ },
53
+ {
54
+ "keys": "Ctrl/⌘ Z, Shift+Ctrl/⌘ Z",
55
+ "action": "Undoes and redoes (100 steps), except inside a text field."
56
+ },
57
+ {
58
+ "keys": "Enter, Space",
59
+ "action": "Selects a section, toggles its visibility, chooses a variant."
60
+ }
61
+ ],
62
+ "notes": [
63
+ "One polite live region says every move, addition, removal and undo; « Saved » is its own status.",
64
+ "The preview `iframe` is titled; the variant picker is a radio group; an invalid setting is said next to its field and the publish dialog lists every problem and stays closed to confirmation until they are fixed.",
65
+ "On a phone the composer has two steps (the list, then the section) and the preview behind a « View » button."
66
+ ]
67
+ },
68
+ "related": [
69
+ "shop",
70
+ "form",
71
+ "radio-group",
72
+ "dialog",
73
+ "dropdown-menu",
74
+ "switch"
75
+ ],
76
+ "web": {
77
+ "entry": "@krizaka/ui/shop-composer",
78
+ "import": "import { ShopComposer, defaultShopComposerMessages, applyCommand, createHistory, diffPages, describeSettings, SectionThumbnail } from \"@krizaka/ui/shop-composer\";",
79
+ "props": [
80
+ {
81
+ "component": "AUTOSAVE_MS",
82
+ "description": "How long the draft waits for calm before it is saved.",
83
+ "props": []
84
+ },
85
+ {
86
+ "component": "ShopComposer",
87
+ "description": "The shop composer.",
88
+ "props": [
89
+ {
90
+ "name": "onPublish",
91
+ "type": "(page: ShopPage) => void | Promise<void>",
92
+ "default": null,
93
+ "description": "Called with the draft once the person confirmed the diff.",
94
+ "required": true
95
+ },
96
+ {
97
+ "name": "presets",
98
+ "type": "readonly ShopComposerPreset[]",
99
+ "default": null,
100
+ "description": "The look presets of the shop's trade.",
101
+ "required": true
102
+ },
103
+ {
104
+ "name": "previewUrl",
105
+ "type": "string",
106
+ "default": null,
107
+ "description": "The page of the product, in an iframe: its own route with `?draft=<id>`. Its origin is the bridge's.",
108
+ "required": true
109
+ },
110
+ {
111
+ "name": "value",
112
+ "type": "ShopPage",
113
+ "default": null,
114
+ "description": "The draft to edit. The composer keeps its own history from it.",
115
+ "required": true
116
+ },
117
+ {
118
+ "name": "className",
119
+ "type": "string",
120
+ "default": null,
121
+ "description": "Classes merged on the root (its height: `h-[100dvh]`).",
122
+ "required": false
123
+ },
124
+ {
125
+ "name": "foldedTypes",
126
+ "type": "readonly (\"video\" | \"faq\" | \"hero\" | \"services\" | \"booking\" | \"gallery\" | \"reviews\" | \"bulletin\" | \"team\" | \"visit\" | \"story\" | \"social\" | \"policies\")[]",
127
+ "default": "[]",
128
+ "description": "The section types the trade does not use: folded under « … » in the catalogue.",
129
+ "required": false
130
+ },
131
+ {
132
+ "name": "messages",
133
+ "type": "ShopComposerMessages",
134
+ "default": "{\n title: \"Shop page\",\n sections: \"Sections\",\n addSection: \"Add a section\",\n addSectionHint: \"Choose what to add to your page.\",\n toggleVisible: \"Show {name}\",\n sectionMenu: \"Actions for {name}\",\n moveUp: \"Move up\",\n moveDown: \"Move down\",\n moveTop: \"Move to top\",\n remove: \"Remove\",\n announceMoved: \"{name} moved to position {n} of {total}\",\n announceCannotMove: \"{name} cannot move further\",\n announceAdded: \"{name} added at position {n}\",\n announceRemoved: \"{name} removed\",\n announceShown: \"{name} is shown\",\n announceHidden: \"{name} is hidden\",\n announceUndone: \"Undone\",\n announceRedone: \"Redone\",\n hiddenNote: \"hidden\",\n inspector: \"Section\",\n noSelection: \"Choose a section to change how it is drawn.\",\n backToSections: \"Back to sections\",\n variant: \"How it is drawn\",\n settings: \"Settings\",\n words: \"Your words\",\n titleField: \"Title\",\n leadField: \"Line under the title\",\n french: \"French\",\n english: \"English\",\n blocks: \"Items\",\n addBlock: \"Add\",\n removeBlock: \"Remove {name}\",\n look: \"Look\",\n preset: \"Style\",\n density: \"Spacing\",\n densityCompact: \"Compact\",\n densityAiry: \"Airy\",\n undo: \"Undo\",\n redo: \"Redo\",\n saved: \"Saved\",\n saving: \"Saving…\",\n saveFailed: \"Not saved\",\n publish: \"Publish\",\n discard: \"Discard the draft\",\n preview: \"Preview\",\n previewTitle: \"Live preview of your page\",\n phone: \"Phone\",\n desktop: \"Desktop\",\n viewPreview: \"View\",\n closePreview: \"Close\",\n publishTitle: \"Publish this page\",\n publishWhat: \"What changes\",\n publishNothing: \"Nothing has changed since the last publication.\",\n publishConfirm: \"Publish\",\n cancel: \"Cancel\",\n problemsTitle: \"Fix {n} problem before publishing\",\n problemIn: \"{name}\",\n sectionNames,\n variantNames,\n blockNames: { fact: \"Fact\", service: \"Service\", photo: \"Photo\", note: \"Note\", sign: \"Sign\", reel: \"Reel\", flyer: \"Flyer\", member: \"Member\", link: \"Link\", question: \"Question\" },\n settingNames: { media: \"Photo\", focus: \"Crop\", source: \"Source\", groupBy: \"Group by\", columns: \"Columns\", aside: \"Beside the list\", serviceId: \"Service\", count: \"How many\", texture: \"Wall\", cabinet: \"Cabinet\", channel: \"Channel\", rule: \"Which reviews\", showPhone: \"Show the phone number\", body: \"Text\", show: \"Show\" },\n optionNames: { center: \"Centre\", top: \"Top\", bottom: \"Bottom\", all: \"All\", pick: \"Pick\", category: \"Category\", none: \"None\", hours: \"Hours\", plaster: \"Plaster\", brick: \"Brick\", ridge: \"Ridge\", zellige: \"Zellige\", cabinet: \"Cabinet\", portable: \"Portable\", best: \"Best\", latest: \"Latest\", cancellation: \"Cancellation\", prices: \"Prices\", \"booking-window\": \"Booking window\" },\n diff: {\n added: \"{name} added\",\n removed: \"{name} removed\",\n moved: \"{name} moved from {from} to {to}\",\n variant: \"{name} drawn as {to} (was {from})\",\n settings: \"{name}: settings changed\",\n blocks: \"{name}: items changed\",\n text: \"{name}: words changed\",\n disabled: \"{name} hidden\",\n enabled: \"{name} shown\",\n preset: \"Style changed to {to} (was {from})\",\n density: \"Spacing changed to {to} (was {from})\",\n },\n}",
135
+ "description": "The words, translated. Default: English.",
136
+ "required": false
137
+ },
138
+ {
139
+ "name": "onChange",
140
+ "type": "((page: ShopPage) => void | Promise<void>)",
141
+ "default": null,
142
+ "description": "Called with a valid draft after 800 ms without a change: save it. A rejection says « Not saved ».",
143
+ "required": false
144
+ },
145
+ {
146
+ "name": "onDiscard",
147
+ "type": "(() => void)",
148
+ "default": null,
149
+ "description": "The discard of the draft (the product asks first, in its own dialog). Absent: no such button.",
150
+ "required": false
151
+ },
152
+ {
153
+ "name": "published",
154
+ "type": "ShopPage",
155
+ "default": null,
156
+ "description": "What is live now, for the diff of « Publish ». Absent: the document the composer was opened with.",
157
+ "required": false
158
+ },
159
+ {
160
+ "name": "resetKey",
161
+ "type": "string | number",
162
+ "default": null,
163
+ "description": "Change it to load another document (another draft): the history and the selection start again.",
164
+ "required": false
165
+ }
166
+ ]
167
+ },
168
+ {
169
+ "component": "HISTORY_LIMIT",
170
+ "description": "The most steps kept.",
171
+ "props": []
172
+ },
173
+ {
174
+ "component": "SectionThumbnail",
175
+ "description": "A picture of a section: 160 × 96 px of a 960 px page, inert and hidden from assistive technology.",
176
+ "props": [
177
+ {
178
+ "name": "type",
179
+ "type": "\"video\" | \"faq\" | \"hero\" | \"services\" | \"booking\" | \"gallery\" | \"reviews\" | \"bulletin\" | \"team\" | \"visit\" | \"story\" | \"social\" | \"policies\"",
180
+ "default": null,
181
+ "description": "The section type.",
182
+ "required": true
183
+ },
184
+ {
185
+ "name": "variant",
186
+ "type": "string",
187
+ "default": null,
188
+ "description": "Its variant: one of the type's.",
189
+ "required": true
190
+ },
191
+ {
192
+ "name": "density",
193
+ "type": "\"compact\" | \"airy\"",
194
+ "default": "compact",
195
+ "description": "The page's spacing.",
196
+ "required": false
197
+ },
198
+ {
199
+ "name": "preset",
200
+ "type": "string",
201
+ "default": null,
202
+ "description": "The look preset the page wears (`salon-vitrine`): the thumbnail wears it too.",
203
+ "required": false
204
+ }
205
+ ]
206
+ }
207
+ ],
208
+ "examples": [
209
+ {
210
+ "name": "composer",
211
+ "title": "Composer",
212
+ "description": "The salon's compact page in the composer: outline, preview, inspector.",
213
+ "path": "examples/shop-composer/composer.tsx",
214
+ "module": "@krizaka/ui/registry/examples/shop-composer/composer",
215
+ "code": "\"use client\";\n\nimport { shopStarters } from \"@krizaka/ui/shop\";\nimport { ShopComposer } from \"@krizaka/ui/shop-composer\";\n\nconst presets = [\n { id: \"salon-vitrine\", version: 1, name: \"Vitrine\", density: \"compact\", variants: { hero: \"poster\", services: \"menu\" } },\n { id: \"salon-atelier\", version: 1, name: \"Atelier\", density: \"airy\", variants: { hero: \"split\", services: \"menu\" } },\n] as const;\n\n// The product's own route goes here (`https://…/salon?draft=<id>`); a still note stands in for it.\nconst PREVIEW = \"data:text/html,%3Cbody style='margin:0;display:grid;place-items:center;height:100vh;font:15px system-ui;color:%23667'%3EThe live page of the shop appears here%3C/body%3E\";\n\n// The salon's compact page: reorder with Alt+↑ / Alt+↓, change how a section is drawn, undo with ⌘Z, publish to see what changes.\nexport default function ShopComposerExample() {\n return (\n <div className=\"h-[44rem] max-w-full p-3\">\n <ShopComposer value={shopStarters.salonCompact} previewUrl={PREVIEW} presets={presets} onPublish={() => undefined} className=\"h-full\" />\n </div>\n );\n}\n"
216
+ }
217
+ ]
218
+ },
219
+ "native": null,
220
+ "files": [
221
+ {
222
+ "path": "meta.ts",
223
+ "content": "// The documentation of a component, carried by its code: each primitive has a `meta.ts` beside its source\n// (`src/<name>/meta.ts`; a component that exists only in React Native: `src/native/meta/<name>.ts`). Never built into\n// the package: `scripts/build-registry.mjs` reads them into `registry/<name>.json`, which ui.krizaka.com (apps/site) renders as\n// ui.krizaka.com/components/<name>, and `scripts/registry.test.mjs` fails when one is missing or incomplete.\n//\n// Why a typed module and not JSDoc tags: the fields are lists and links (`related`, `whenNotToUse[].use`, examples),\n// which a type checks and a comment does not; the file is plain data (erasable TypeScript), so Node reads it without a\n// compiler, and an editor completes it.\n\n/** Every documented component: the web primitives (one entry of the package each) and the native-only ones. */\nexport type ComponentName =\n | \"notification-preferences\"\n | \"quota-meter\"\n | \"environment-notice\"\n | \"embed-facade\"\n | \"reviews\"\n | \"margin-layout\"\n | \"analysis-report\"\n | \"status-chip\"\n | \"kind-config-editor\"\n | \"agenda\"\n | \"account-settings\"\n | \"drop-overlay\"\n | \"upload-queue\"\n | \"achievement\"\n | \"anatomy-plate\"\n | \"bird-plate\"\n | \"taped-photo\"\n | \"stuck\"\n | \"doodle\"\n | \"signature\"\n | \"grade-stamp\"\n | \"versus-card\"\n | \"speed-lines\"\n | \"site-cahier\"\n | \"text-style\"\n | \"flock\"\n | \"elephant\"\n | \"footnote\"\n | \"page-index\"\n | \"chapter\"\n | \"specimen-tag\"\n | \"action-bar\"\n | \"action-sheet\"\n | \"activity-feed\"\n | \"alert\"\n | \"app-header\"\n | \"app-shell\"\n | \"argument-card\"\n | \"audio-player\"\n | \"auth-layout\"\n | \"avatar\"\n | \"badge\"\n | \"button\"\n | \"captcha\"\n | \"card\"\n | \"card-grid\"\n | \"catalogue-page\"\n | \"changelog-page\"\n | \"chat\"\n | \"checkbox\"\n | \"chip\"\n | \"chip-link\"\n | \"chip-row\"\n | \"choice-grid\"\n | \"cn\"\n | \"code-block\"\n | \"combobox\"\n | \"comparison-table\"\n | \"command\"\n | \"component-page\"\n | \"confirm-button\"\n | \"contact-page\"\n | \"continue-prompt\"\n | \"countdown\"\n | \"cover-hero\"\n | \"cta-panel\"\n | \"dashboard-layout\"\n | \"data-table\"\n | \"date-picker\"\n | \"decision-list\"\n | \"description-list\"\n | \"detail-layout\"\n | \"dialog\"\n | \"docs-article-page\"\n | \"docs-hub-page\"\n | \"docs-layout\"\n | \"docs-nav\"\n | \"document-viewer\"\n | \"dropdown-menu\"\n | \"empty-state\"\n | \"engine-flow\"\n | \"error-page\"\n | \"fab\"\n | \"field\"\n | \"file-upload\"\n | \"filter-bar\"\n | \"force-update-screen\"\n | \"form\"\n | \"gallery-page\"\n | \"genui\"\n | \"glossary\"\n | \"glossary-term\"\n | \"glow-card\"\n | \"goal-gauge\"\n | \"header\"\n | \"how-it-works-page\"\n | \"image-cropper\"\n | \"image-viewer\"\n | \"iso\"\n | \"kanban\"\n | \"kbd\"\n | \"kpi-explained\"\n | \"landing-page\"\n | \"landscape\"\n | \"legal-page\"\n | \"link-card\"\n | \"list\"\n | \"loader\"\n | \"longform-page\"\n | \"maintenance-screen\"\n | \"map\"\n | \"markdown\"\n | \"meta-row\"\n | \"waveform\"\n | \"marketing-layout\"\n | \"marquee\"\n | \"mascot-quote\"\n | \"mascot-state\"\n | \"mascots\"\n | \"match-dialog\"\n | \"media-capture\"\n | \"media-grid\"\n | \"language-switch\"\n | \"media-gallery\"\n | \"media-picker\"\n | \"meter\"\n | \"nav-bar\"\n | \"number-ticker\"\n | \"onboarding\"\n | \"opening-hours\"\n | \"otp-input\"\n | \"page\"\n | \"page-header\"\n | \"page-hero\"\n | \"pagination\"\n | \"permission-prompt\"\n | \"photo-grid\"\n | \"pointer-light\"\n | \"popover\"\n | \"pricing-page\"\n | \"product-page\"\n | \"profile-card\"\n | \"progress\"\n | \"promise-card\"\n | \"pull-to-refresh\"\n | \"retro-tv\"\n | \"radio-group\"\n | \"router\"\n | \"rail-nav\"\n | \"recipes\"\n | \"screen\"\n | \"scroll-stage\"\n | \"search-field\"\n | \"section-backdrop\"\n | \"segmented\"\n | \"separator\"\n | \"service-card\"\n | \"shop\"\n | \"shop-composer\"\n | \"settings-layout\"\n | \"account-menu\"\n | \"showcase\"\n | \"step-showcase\"\n | \"site-footer\"\n | \"sites\"\n | \"skeleton\"\n | \"skip-link\"\n | \"slider\"\n | \"slot-picker\"\n | \"slot\"\n | \"spinner\"\n | \"sticky-action\"\n | \"splash-handoff\"\n | \"split-view\"\n | \"stage-banner\"\n | \"stat\"\n | \"usage\"\n | \"status-page\"\n | \"step-progress\"\n | \"stepper\"\n | \"swipe-deck\"\n | \"swipeable-row\"\n | \"switch\"\n | \"tab-bar\"\n | \"tabs\"\n | \"tag-input\"\n | \"tag-selector\"\n | \"terminal-replay\"\n | \"theme\"\n | \"toast\"\n | \"toc\"\n | \"tooltip\"\n | \"tree-view\"\n | \"txt\"\n | \"update-prompt\"\n | \"verified-badge\"\n | \"vertical-video\"\n | \"video-player\"\n | \"video-trimmer\"\n | \"virtual\"\n | \"wall\";\n\n/** Where a component exists: `@krizaka/ui/<name>` (web), `@krizaka/ui/native` (React Native), or both. */\nexport type Platform = \"web\" | \"native\" | \"both\";\n\n/**\n * Why a component is not on a platform — a decision, never a silence (the parity matrix of ui.krizaka.com/platforms):\n * - `gap` (✗): it belongs there and is not built yet; `issue` is the issue that tracks it (`krizaka/krizaka-ui#275`);\n * - `n/a`: it is not meant for that platform (a site's page block on a phone, a swipe on a desktop); `use` names the\n * component that answers there, when one does.\n */\nexport type Absence =\n | { readonly status: \"gap\"; readonly issue: string; readonly reason: string; readonly use?: undefined }\n | { readonly status: \"n/a\"; readonly reason: string; readonly use?: ComponentName; readonly issue?: undefined };\n\n/**\n * Desktop is the Orazaka Mac app (Tauri 2: the system WebView renders the web components — ADR-002). `web`: the web\n * component runs there as it is; `desktop`: it also has a desktop form (a window's title bar, a denser layout…), said in\n * its documentation; otherwise the absence and why.\n */\nexport type DesktopSupport = \"web\" | \"desktop\" | Absence;\n\n/**\n * The three platforms of Krizaka UI — web · native (React Native, Expo) · desktop — for one component. The side a\n * component has is `platforms`; the side it lacks says why here: `native` is required for (and only for) a web-only\n * component, `web` for a native-only one; `desktop` always. `scripts/registry.test.mjs` fails on a missing decision.\n */\nexport interface Parity {\n readonly web?: Absence;\n readonly native?: Absence;\n readonly desktop: DesktopSupport;\n}\n\n/**\n * `stable`: its API only changes in a major. `beta`: it may still change in a minor. `deprecated`: no product uses it and\n * no work plans to — it still works, says what replaces it, and goes in the major named by `deprecated.removedIn`.\n */\nexport type Status = \"stable\" | \"beta\" | \"deprecated\";\n\n/** What a deprecated component says (required when `status` is `deprecated`, absent otherwise). */\nexport interface Deprecation {\n /** The version that deprecated it (`3.6.0`). */\n readonly since: string;\n /** The major that removes it (`4.0.0`). */\n readonly removedIn: string;\n /** What replaces it, when a component does. */\n readonly use?: ComponentName;\n /** Why it goes: no product uses it, no planned work needs it. */\n readonly reason: string;\n}\n\n/**\n * The group of the catalogue. `media`: video, sound, camera, files, cropping. `blocks`: the page blocks — the frame,\n * the hero, sections, cards that lead or argue, decisions, code, calls to act — that every page of a site is made of.\n * `layouts`: the shells of whole screens — an application, a dashboard, settings, sign-in, an object, a list and its\n * item, a site's page, a documentation page — each with its screens. `templates`: the page templates — whole pages of a\n * site (a landing, a product, a docs hub, a long read, a changelog, pricing, status, an error…), each a distinct\n * composition of the blocks, words and content as props.\n */\nexport type Category = \"actions\" | \"forms\" | \"navigation\" | \"overlays\" | \"feedback\" | \"data-display\" | \"media\" | \"blocks\" | \"layouts\" | \"templates\" | \"layout\" | \"foundations\";\n\n/** Why a reader needs a template: the seven intents the templates are grouped by (sidebar sub-headings, catalogue filter). */\nexport type TemplatePurpose = \"convince\" | \"explain\" | \"show\" | \"act\" | \"operate\" | \"converse\" | \"recover\";\n\n/** The groups of templates, in reading order: the title, and the one line that says when to come to that group. */\nexport const templatePurposes = {\n convince: { title: \"Convince\", useWhen: \"You come here when a visitor must decide: a landing, a product, a price, a comparison, a proof.\" },\n explain: { title: \"Explain\", useWhen: \"You come here when a reader must understand: how it works, a documentation hub or article, a changelog, a FAQ, a policy.\" },\n show: { title: \"Show\", useWhen: \"You come here when the work itself is the argument: a gallery, a story, a case study, an object and its details.\" },\n act: { title: \"Act\", useWhen: \"You come here when a person must do something once: reach the team, sign in or up, set up, pay.\" },\n operate: { title: \"Operate\", useWhen: \"You come here when a person works every day: a dashboard, a console with a table, settings, an app shell.\" },\n converse: { title: \"Converse\", useWhen: \"You come here when people talk: an inbox, a chat, comments, a notifications centre.\" },\n recover: { title: \"Recover\", useWhen: \"You come here when the way is blocked: an empty list, an error, a missing page, maintenance, a product still being built.\" },\n} as const satisfies Record<TemplatePurpose, { readonly title: string; readonly useWhen: string }>;\n\n/**\n * A named example: the file `registry/examples/<component>/<name>.tsx` (web) or\n * `registry/examples/<component>/native/<name>.tsx` (React Native) — at most 40 lines, imported by the stories and\n * shown (live, with its code) by the documentation.\n */\ninterface ExampleBase {\n /** The file name, kebab-case (`primary`, `icon-button`). */\n readonly name: string;\n /** A short title (`Primary`, `Icon button`). */\n readonly title: string;\n /** One or two sentences: when this variant is the right one. */\n readonly description: string;\n}\n\n/** A plain example, or a template: a whole screen with its intent (`purpose`) and the user goal its layout serves (`why`). */\nexport type Example =\n | (ExampleBase & { readonly template?: false; readonly purpose?: undefined; readonly why?: undefined })\n | (ExampleBase & {\n /**\n * A template: a whole screen of a product composed from the platform (a layout and its blocks, real words, its\n * phone version thought out), copied as a starting point — at most 160 lines, listed on ui.krizaka.com/templates.\n */\n readonly template: true;\n /** The intent that groups it: why you need this block. */\n readonly purpose: TemplatePurpose;\n /** Why this layout: the user goal it serves, in one sentence. */\n readonly why: string;\n });\n\n/** One platform's side of a component. */\nexport interface PlatformDocs {\n /** The names to import (`[\"Button\", \"IconButton\"]`): from `@krizaka/ui/<name>` on the web, `@krizaka/ui/native` in React Native. */\n readonly imports: readonly string[];\n /** The examples, in reading order; the first one is the component's preview. */\n readonly examples: readonly Example[];\n}\n\n/** The React Native side: the same concept, and what differs from the web API. */\nexport interface NativeDocs extends PlatformDocs {\n /**\n * The entry to import from when it is not `@krizaka/ui/native`: a component that needs an Expo module (an optional\n * peer) has its own, `@krizaka/ui/native/<name>`, so an app that does not use it never installs the module.\n */\n readonly entry?: string;\n /** What differs from the web API (`label` instead of children…); empty for a native-only component. */\n readonly differences: readonly string[];\n /** The React Native entry alone is deprecated while the web one stays (ADR-006 §7); a deprecated component says it once, above. */\n readonly deprecated?: Deprecation;\n}\n\nexport interface KeyboardInteraction {\n /** The keys, as written on a keyboard: `Space`, `Enter`, `Arrow keys`, `Esc`, `Tab`. */\n readonly keys: string;\n /** What they do. */\n readonly action: string;\n}\n\nexport interface ComponentMeta {\n /** The display name: `Button`, `Dropdown menu`. */\n readonly title: string;\n /** One sentence: what it is. */\n readonly summary: string;\n readonly status: Status;\n /** Required for, and only for, a `deprecated` component. */\n readonly deprecated?: Deprecation;\n readonly category: Category;\n /** Must match the sides below: `both` ⇔ `web` and `native`. */\n readonly platforms: Platform;\n /** The platforms it is not on, and why; and its desktop form (see `Parity`). */\n readonly parity: Parity;\n /** When to reach for it: concrete situations, one per item. */\n readonly whenToUse: readonly string[];\n /** When not to — and what to use instead (`use`), when another component is the answer. */\n readonly whenNotToUse: readonly { readonly when: string; readonly use?: ComponentName }[];\n /** How to use it well: wording, placement, composition. */\n readonly bestPractices: readonly string[];\n readonly accessibility: {\n /** The keyboard, when it does more than Tab and Enter. */\n readonly keyboard: readonly KeyboardInteraction[];\n /** Roles, names and announcements: what the component does, what the app must provide. */\n readonly notes: readonly string[];\n };\n /** The components a reader of this page should know about. */\n readonly related: readonly ComponentName[];\n readonly web?: PlatformDocs;\n readonly native?: NativeDocs;\n}\n"
224
+ },
225
+ {
226
+ "path": "shop-composer/commands.ts",
227
+ "content": "// The composer's commands (ADR-007 §5): every change of the document is a pure command on a reducer — never a mutation —\n// so undo / redo restore the exact document, and the rules of the document (a hero first, 16 sections, 24 blocks, the variants\n// of a type) hold after every step. A command that would break a rule is a no-op: the page stays valid, always.\nimport { SECTION_DEFINITIONS, sectionDefinition,type SectionType } from \"../shop/catalogue\";\nimport { SHOP_LIMITS } from \"../shop/limits\";\nimport type { Section, ShopPage } from \"../shop/schema\";\nimport type { LocalizedText } from \"../shop/text\";\n\ntype Rec = Record<string, unknown>;\n\nexport type Command =\n /** Adds a section (its type's default settings, the given or the default variant) at an index; a hero goes first. */\n | { type: \"addSection\"; sectionType: SectionType; key: string; variant?: string; at?: number; settings?: Rec }\n | { type: \"removeSection\"; key: string }\n /** Moves a section to an absolute index (the hero stays first: nothing goes above it). */\n | { type: \"moveSection\"; key: string; to: number }\n | { type: \"setVariant\"; key: string; variant: string }\n /** Merges into the settings. */\n | { type: \"patchSettings\"; key: string; patch: Rec }\n | { type: \"setText\"; key: string; field: \"title\" | \"lead\"; value: LocalizedText | undefined }\n | { type: \"toggleDisabled\"; key: string }\n | { type: \"setPreset\"; preset: { id: string; version: number }; density?: \"compact\" | \"airy\" | null }\n | { type: \"setDensity\"; density: \"compact\" | \"airy\" | undefined }\n | { type: \"addBlock\"; key: string; blockKey: string; blockType: string; settings?: Rec; at?: number }\n | { type: \"removeBlock\"; key: string; blockKey: string }\n | { type: \"moveBlock\"; key: string; blockKey: string; to: number }\n | { type: \"patchBlock\"; key: string; blockKey: string; patch: Rec };\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(Math.max(n, lo), hi);\nconst indexOfKey = (page: ShopPage, key: string) => page.sections.findIndex((s) => s.key === key);\n\n/** The array with an item moved to an index. */\nexport function moved<T>(list: readonly T[], from: number, to: number): T[] {\n const next = [...list];\n const [item] = next.splice(from, 1);\n next.splice(clamp(to, 0, next.length), 0, item as T);\n return next;\n}\n\nfunction withSection(page: ShopPage, key: string, change: (s: Section) => Section): ShopPage {\n const i = indexOfKey(page, key);\n if (i < 0) return page;\n const next = change(page.sections[i]!);\n if (next === page.sections[i]) return page;\n const sections = [...page.sections];\n sections[i] = next;\n return { ...page, sections };\n}\n\ntype Handler<T extends Command[\"type\"]> = (page: ShopPage, cmd: Extract<Command, { type: T }>) => ShopPage;\n\nconst addSection: Handler<\"addSection\"> = (page, cmd) => {\n const def = SECTION_DEFINITIONS.find((d) => d.type === cmd.sectionType);\n if (!def || page.sections.length >= SHOP_LIMITS.sections || page.sections.some((s) => s.key === cmd.key)) return page;\n const variant = cmd.variant ?? def.defaultVariant;\n if (!(def.variants as readonly string[]).includes(variant)) return page;\n const isHero = def.type === \"hero\";\n if (isHero && page.sections.some((s) => s.type === \"hero\")) return page;\n const heroFirst = page.sections[0]?.type === \"hero\";\n const at = isHero ? 0 : clamp(cmd.at ?? page.sections.length, heroFirst ? 1 : 0, page.sections.length);\n const section = { key: cmd.key, type: def.type, variant, settings: { ...(def.settingsDefault as Rec), ...cmd.settings } } as unknown as Section;\n const sections = [...page.sections];\n sections.splice(at, 0, section);\n return { ...page, sections };\n};\n\nconst removeSection: Handler<\"removeSection\"> = (page, cmd) => {\n if (indexOfKey(page, cmd.key) < 0 || page.sections.length <= 1) return page;\n return { ...page, sections: page.sections.filter((s) => s.key !== cmd.key) };\n};\n\nconst moveSection: Handler<\"moveSection\"> = (page, cmd) => {\n const from = indexOfKey(page, cmd.key);\n if (from < 0 || page.sections[from]!.type === \"hero\") return page;\n const lo = page.sections[0]?.type === \"hero\" ? 1 : 0;\n const to = clamp(cmd.to, lo, page.sections.length - 1);\n return to === from ? page : { ...page, sections: moved(page.sections, from, to) };\n};\n\nconst setVariant: Handler<\"setVariant\"> = (page, cmd) =>\n withSection(page, cmd.key, (s) => {\n const def = sectionDefinition(s.type);\n if (s.variant === cmd.variant || !(def.variants as readonly string[]).includes(cmd.variant)) return s;\n return { ...s, variant: cmd.variant } as Section;\n });\n\n/** Whether every value of a patch is already the one the object holds. */\nconst saysNothingNew = (current: Rec, patch: Rec) => Object.entries(patch).every(([k, v]) => JSON.stringify(current[k]) === JSON.stringify(v));\n\nconst patchSettings: Handler<\"patchSettings\"> = (page, cmd) =>\n withSection(page, cmd.key, (s) => {\n const current = s.settings as Rec;\n // Nothing to say when every value is already the document's (a form that reports its first values after an undo).\n return saysNothingNew(current, cmd.patch) ? s : ({ ...s, settings: { ...current, ...cmd.patch } } as Section);\n });\n\nconst setText: Handler<\"setText\"> = (page, cmd) =>\n withSection(page, cmd.key, (s) => {\n const text = { ...(s.text ?? {}) } as Rec;\n if (cmd.value === undefined) delete text[cmd.field];\n else text[cmd.field] = cmd.value;\n const next = { ...s } as Rec;\n if (Object.keys(text).length === 0) delete next.text;\n else next.text = text;\n return next as unknown as Section;\n });\n\nconst toggleDisabled: Handler<\"toggleDisabled\"> = (page, cmd) => withSection(page, cmd.key, (s) => ({ ...s, disabled: s.disabled ? undefined : true }) as Section);\n\nconst setPreset: Handler<\"setPreset\"> = (page, cmd) => {\n if (page.preset.id === cmd.preset.id && page.preset.version === cmd.preset.version && cmd.density === undefined) return page;\n let density: Partial<Pick<ShopPage, \"density\">> = {};\n if (cmd.density === null) density = { density: undefined };\n else if (cmd.density) density = { density: cmd.density };\n return { ...page, preset: { ...cmd.preset }, ...density };\n};\n\nconst setDensity: Handler<\"setDensity\"> = (page, cmd) => (page.density === cmd.density ? page : { ...page, density: cmd.density });\n\ntype Keyed = { key: string; type?: string; settings?: Rec };\n\nconst addBlock: Handler<\"addBlock\"> = (page, cmd) =>\n withSection(page, cmd.key, (s) => {\n const def = sectionDefinition(s.type);\n const blocks = (s.blocks ?? []) as readonly Keyed[];\n if (!(def.blockTypes as readonly string[]).includes(cmd.blockType) || blocks.length >= SHOP_LIMITS.blocks || blocks.some((b) => b.key === cmd.blockKey)) return s;\n const next = [...blocks];\n next.splice(clamp(cmd.at ?? blocks.length, 0, blocks.length), 0, { key: cmd.blockKey, type: cmd.blockType, settings: { ...cmd.settings } });\n return { ...s, blocks: next } as unknown as Section;\n });\n\nconst removeBlock: Handler<\"removeBlock\"> = (page, cmd) =>\n withSection(page, cmd.key, (s) => {\n const blocks = (s.blocks ?? []) as readonly Keyed[];\n if (!blocks.some((b) => b.key === cmd.blockKey)) return s;\n const next = blocks.filter((b) => b.key !== cmd.blockKey);\n return { ...s, blocks: next.length > 0 ? next : undefined } as unknown as Section;\n });\n\nconst moveBlock: Handler<\"moveBlock\"> = (page, cmd) =>\n withSection(page, cmd.key, (s) => {\n const blocks = (s.blocks ?? []) as readonly Keyed[];\n const from = blocks.findIndex((b) => b.key === cmd.blockKey);\n const to = clamp(cmd.to, 0, blocks.length - 1);\n return from < 0 || from === to ? s : ({ ...s, blocks: moved(blocks, from, to) } as unknown as Section);\n });\n\nconst patchBlock: Handler<\"patchBlock\"> = (page, cmd) =>\n withSection(page, cmd.key, (s) => {\n const blocks = (s.blocks ?? []) as readonly Keyed[];\n const block = blocks.find((b) => b.key === cmd.blockKey);\n if (!block || saysNothingNew(block.settings ?? {}, cmd.patch)) return s;\n return { ...s, blocks: blocks.map((b) => (b === block ? { ...b, settings: { ...b.settings, ...cmd.patch } } : b)) } as unknown as Section;\n });\n\nconst handlers: { [T in Command[\"type\"]]: Handler<T> } = {\n addSection, removeSection, moveSection, setVariant, patchSettings, setText, toggleDisabled, setPreset, setDensity, addBlock, removeBlock, moveBlock, patchBlock,\n};\n\n/** Applies a command to a document; returns the same object when nothing changes. */\nexport function applyCommand(page: ShopPage, cmd: Command): ShopPage {\n return (handlers[cmd.type] as (page: ShopPage, cmd: Command) => ShopPage)(page, cmd);\n}\n"
228
+ },
229
+ {
230
+ "path": "shop-composer/composer.tsx",
231
+ "content": "\"use client\";\n\n// Our own shop composer (ADR-007 §5): three panes on a laptop — the outline of the sections, the live preview of the product's own\n// public page, the inspector of the selected section — and two steps on a phone (the list, then the section; the preview behind a\n// « View » button). Every change is a command on a reducer (⌘Z / ⇧⌘Z, 100 steps), saved to the draft after 800 ms of calm; « Publish »\n// shows what changes and refuses while a setting is invalid. Every action has a keyboard path. No third-party editor: Puck was weighed\n// and not adopted (the model is a list, not a canvas).\nimport { Button } from \"@krizaka/ui/button\";\nimport { Dialog } from \"@krizaka/ui/dialog\";\nimport { RadioGroup } from \"@krizaka/ui/radio-group\";\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { SECTION_DEFINITIONS, type SectionType } from \"../shop/catalogue\";\nimport { postToPreview } from \"../shop/preview\";\nimport { parseShopPage, type ShopPage } from \"../shop/schema\";\nimport { type Command } from \"./commands\";\nimport { type DiffEntry, diffPages } from \"./diff\";\nimport { canRedo, canUndo, createHistory, type History, redo, run, undo } from \"./history\";\nimport { Inspector } from \"./inspector\";\nimport { newKey } from \"./keys\";\nimport { defaultShopComposerMessages, fill, type ShopComposerMessages } from \"./messages\";\nimport { Outline, sectionLabel } from \"./outline\";\n\n/** How long the draft waits for calm before it is saved. */\n// @fixed: ADR-007 §5 — the autosave debounce of the editor, 800 ms; not a shop setting.\nexport const AUTOSAVE_MS = 800;\n\nexport type ShopComposerPreset = { id: string; version: number; name: string; density: \"compact\" | \"airy\"; variants: Readonly<Record<string, string>> };\n\nexport type ShopComposerProps = {\n /** The draft to edit. The composer keeps its own history from it. */\n value: ShopPage;\n /** Change it to load another document (another draft): the history and the selection start again. */\n resetKey?: string | number;\n /** Called with a valid draft after 800 ms without a change: save it. A rejection says « Not saved ». */\n onChange?: (page: ShopPage) => void | Promise<void>;\n /** Called with the draft once the person confirmed the diff. */\n onPublish: (page: ShopPage) => void | Promise<void>;\n /** The discard of the draft (the product asks first, in its own dialog). Absent: no such button. */\n onDiscard?: () => void;\n /** What is live now, for the diff of « Publish ». Absent: the document the composer was opened with. */\n published?: ShopPage;\n /** The page of the product, in an iframe: its own route with `?draft=<id>`. Its origin is the bridge's. */\n previewUrl: string;\n /** The look presets of the shop's trade. */\n presets: readonly ShopComposerPreset[];\n /** The section types the trade does not use: folded under « … » in the catalogue. */\n foldedTypes?: readonly SectionType[];\n /** The words, translated. Default: English. */\n messages?: ShopComposerMessages;\n /** Classes merged on the root (its height: `h-[100dvh]`). */\n className?: string;\n};\n\ntype State = { history: History; epoch: number };\ntype Action = { type: \"run\"; cmd: Command; merge?: string } | { type: \"undo\" } | { type: \"redo\" } | { type: \"reset\"; page: ShopPage };\n\nfunction reducer(state: State, a: Action): State {\n switch (a.type) {\n case \"run\": {\n const history = run(state.history, a.cmd, a.merge);\n return history === state.history ? state : { ...state, history };\n }\n case \"undo\": {\n const history = undo(state.history);\n return history === state.history ? state : { history, epoch: state.epoch + 1 };\n }\n case \"redo\": {\n const history = redo(state.history);\n return history === state.history ? state : { history, epoch: state.epoch + 1 };\n }\n case \"reset\":\n return { history: createHistory(a.page), epoch: state.epoch + 1 };\n }\n}\n\nfunction PreviewFrame({ src, title, phone, frame }: { src: string; title: string; phone: boolean; frame: React.Ref<HTMLIFrameElement> }) {\n return (\n <div className=\"flex h-full min-h-0 justify-center overflow-auto bg-surface-2 p-3\">\n <iframe ref={frame} src={src || undefined} title={title} data-device={phone ? \"phone\" : \"desktop\"} className={phone ? \"h-full min-h-[34rem] w-[390px] max-w-full rounded-xl border border-border-default bg-surface-0\" : \"h-full min-h-[34rem] w-full rounded-xl border border-border-default bg-surface-0\"} />\n </div>\n );\n}\n\n/** The shop composer. */\nexport function ShopComposer({ value, resetKey, onChange, onPublish, onDiscard, published, previewUrl, presets, foldedTypes = [], messages = defaultShopComposerMessages, className }: ShopComposerProps) {\n const m = messages;\n const [{ history, epoch }, dispatch] = React.useReducer(reducer, value, (v): State => ({ history: createHistory(v), epoch: 0 }));\n const page = history.present;\n const [baseline, setBaseline] = React.useState(published ?? value);\n const [selected, setSelected] = React.useState<string | null>(page.sections[0]?.key ?? null);\n const [step, setStep] = React.useState<\"list\" | \"section\">(\"list\");\n const [live, setLive] = React.useState(\"\");\n const [status, setStatus] = React.useState<\"idle\" | \"saving\" | \"saved\" | \"error\">(\"idle\");\n const [adding, setAdding] = React.useState(false);\n const [publishing, setPublishing] = React.useState(false);\n const [device, setDevice] = React.useState<\"phone\" | \"desktop\">(\"desktop\");\n const [previewOpen, setPreviewOpen] = React.useState(false);\n const [invalid, setInvalid] = React.useState<ReadonlySet<string>>(new Set());\n const [focusRequest, setFocusRequest] = React.useState<{ key: string } | null>(null);\n const frame = React.useRef<HTMLIFrameElement | null>(null);\n const origin = React.useMemo(() => {\n try {\n return new URL(previewUrl, typeof location === \"undefined\" ? undefined : location.href).origin;\n } catch {\n return \"\";\n }\n }, [previewUrl]);\n\n // A `data:` or `about:` preview has an opaque origin (« null »): nothing can be addressed to it.\n const hasOrigin = origin !== \"\" && origin !== \"null\";\n\n // A new document from outside (another draft): history and selection start again.\n const first = React.useRef(true);\n const saved = React.useRef(page);\n React.useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n saved.current = value;\n dispatch({ type: \"reset\", page: value });\n setInvalid(new Set());\n setBaseline(published ?? value);\n setSelected(value.sections[0]?.key ?? null);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- only a new `resetKey` reloads the document\n }, [resetKey]);\n\n const parsed = React.useMemo(() => parseShopPage(page), [page]);\n const announce = React.useCallback((message: string) => setLive((prev) => (prev === message ? message + String.fromCodePoint(0x200b) : message)), []);\n const exec = React.useCallback((cmd: Command, merge?: string) => dispatch({ type: \"run\", cmd, merge }), []);\n const selectedSection = page.sections.find((s) => s.key === selected) ?? null;\n const selectedIndex = selectedSection ? page.sections.indexOf(selectedSection) : -1;\n\n // Autosave to the draft: a valid document, after a calm of 800 ms; the preview refreshes once it is saved.\n React.useEffect(() => {\n if (page === saved.current || !parsed.ok || !onChange) return;\n const timer = setTimeout(async () => {\n setStatus(\"saving\");\n try {\n await onChange(page);\n saved.current = page;\n setStatus(\"saved\");\n if (hasOrigin) postToPreview(frame.current?.contentWindow, origin, { source: \"krizaka-shop-composer\", type: \"refresh\" });\n } catch {\n setStatus(\"error\");\n }\n }, AUTOSAVE_MS);\n return () => clearTimeout(timer);\n }, [page, parsed.ok, onChange, origin, hasOrigin]);\n\n // The preview follows the selection: outline and scroll.\n React.useEffect(() => {\n if (selected && hasOrigin) postToPreview(frame.current?.contentWindow, origin, { source: \"krizaka-shop-composer\", type: \"scroll\", key: selected });\n }, [selected, origin, hasOrigin]);\n\n const select = (key: string) => {\n setSelected(key);\n setStep(\"section\");\n };\n\n const addSection = (type: SectionType) => {\n const def = SECTION_DEFINITIONS.find((d) => d.type === type)!;\n const preferred = presets.find((p) => p.id === page.preset.id)?.variants[type];\n const variant = preferred && (def.variants as readonly string[]).includes(preferred) ? preferred : undefined;\n const key = newKey(\"s\");\n const at = type === \"hero\" ? 0 : page.sections.length;\n exec({ type: \"addSection\", sectionType: type, key, variant, at });\n setAdding(false);\n setSelected(key);\n setFocusRequest({ key });\n announce(fill(m.announceAdded, { name: m.sectionNames[type], n: at + 1 }));\n };\n\n // Undo and redo hand the form a document it did not write: what it said was invalid is no longer true.\n const step_ = (direction: \"undo\" | \"redo\") => {\n dispatch({ type: direction });\n setInvalid(new Set());\n announce(direction === \"undo\" ? m.announceUndone : m.announceRedone);\n };\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (!(e.metaKey || e.ctrlKey) || e.key.toLowerCase() !== \"z\") return;\n const el = e.target as HTMLElement;\n if (el.closest(\"input, textarea, select, [contenteditable=true]\")) return;\n e.preventDefault();\n step_(e.shiftKey ? \"redo\" : \"undo\");\n };\n\n const changes: DiffEntry[] = publishing ? diffPages(baseline, page) : [];\n const nameOfKey = (key: string) => {\n const i = page.sections.findIndex((s) => s.key === key);\n if (i >= 0) return sectionLabel(page.sections, i, m);\n const was = baseline.sections.findIndex((s) => s.key === key);\n return was >= 0 ? sectionLabel(baseline.sections, was, m) : key;\n };\n const problems = [\n ...[...invalid].filter((key) => page.sections.some((s) => s.key === key)).map((key) => ({ key, text: fill(m.problemIn, { name: nameOfKey(key) }) })),\n ...(!parsed.ok ? parsed.issues.map((i) => ({ key: i.path, text: `${i.path}: ${i.message}` })) : []),\n ];\n const describe = (d: DiffEntry): string => {\n const name = \"key\" in d ? nameOfKey(d.key) : \"\";\n const t = m.diff[d.kind];\n switch (d.kind) {\n case \"moved\": return fill(t, { name, from: d.from + 1, to: d.to + 1 });\n case \"variant\": return fill(t, { name, from: m.variantNames[`${d.type}.${d.from}`] ?? d.from, to: m.variantNames[`${d.type}.${d.to}`] ?? d.to });\n case \"preset\": return fill(t, { from: presets.find((p) => p.id === d.from)?.name ?? d.from, to: presets.find((p) => p.id === d.to)?.name ?? d.to });\n case \"density\": return fill(t, { from: d.from ?? \"—\", to: d.to ?? \"—\" });\n default: return fill(t, { name });\n }\n };\n\n const status_ = status === \"saving\" ? m.saving : status === \"saved\" ? m.saved : status === \"error\" ? m.saveFailed : \"\";\n\n return (\n <div className={cn(\"kz-composer flex min-h-0 flex-col gap-3\", className)} onKeyDown={onKeyDown} data-step={step}>\n <header className=\"flex flex-wrap items-center gap-2 border-b border-border-subtle pb-2\">\n <h2 className=\"m-0 me-auto text-base font-semibold text-fg\">{m.title}</h2>\n <span role=\"status\" aria-live=\"polite\" className=\"text-xs text-fg-secondary\">{status_}</span>\n <Button variant=\"ghost\" size=\"sm\" disabled={!canUndo(history)} onClick={() => step_(\"undo\")} aria-keyshortcuts=\"Control+Z Meta+Z\">{m.undo}</Button>\n <Button variant=\"ghost\" size=\"sm\" disabled={!canRedo(history)} onClick={() => step_(\"redo\")} aria-keyshortcuts=\"Control+Shift+Z Meta+Shift+Z\">{m.redo}</Button>\n {onDiscard && <Button variant=\"ghost\" size=\"sm\" onClick={onDiscard}>{m.discard}</Button>}\n <Button variant=\"secondary\" size=\"sm\" className=\"lg:hidden\" onClick={() => setPreviewOpen(true)}>{m.viewPreview}</Button>\n <Button variant=\"primary\" size=\"sm\" onClick={() => setPublishing(true)}>{m.publish}</Button>\n </header>\n {/* One polite live region says every move, add, remove, undo. */}\n <p role=\"status\" aria-live=\"polite\" className=\"sr-only\">{live}</p>\n\n <div className=\"grid min-h-0 flex-1 gap-4 lg:grid-cols-[18rem_minmax(0,1fr)_24rem]\">\n <aside aria-label={m.sections} className={cn(\"flex min-h-0 flex-col gap-4 overflow-y-auto\", step === \"section\" && \"hidden lg:flex\")}>\n <Outline sections={page.sections} selected={selected} onSelect={select} run={exec} messages={m} announce={announce} onAdd={() => setAdding(true)} focusRequest={focusRequest} />\n <details className=\"rounded-lg border border-border-default p-3\" open>\n <summary className=\"min-h-9 cursor-pointer text-sm font-semibold text-fg\">{m.look}</summary>\n <div className=\"mt-2 grid gap-3\">\n <label className=\"grid gap-1 text-xs font-semibold text-fg-secondary\">\n {m.preset}\n <select\n className=\"min-h-10 rounded-md border border-border-control bg-surface-1 px-2 text-sm font-normal text-fg\"\n value={page.preset.id}\n onChange={(e) => {\n const p = presets.find((x) => x.id === e.target.value);\n if (p) exec({ type: \"setPreset\", preset: { id: p.id, version: p.version }, density: null });\n }}\n >\n {presets.map((p) => <option key={p.id} value={p.id}>{p.name}</option>)}\n </select>\n </label>\n <RadioGroup.Root label={m.density} variant=\"segmented\" value={page.density ?? presets.find((p) => p.id === page.preset.id)?.density ?? \"compact\"} onValueChange={(d) => exec({ type: \"setDensity\", density: d as \"compact\" | \"airy\" })}>\n <RadioGroup.Segment value=\"compact\">{m.densityCompact}</RadioGroup.Segment>\n <RadioGroup.Segment value=\"airy\">{m.densityAiry}</RadioGroup.Segment>\n </RadioGroup.Root>\n </div>\n </details>\n </aside>\n\n <section aria-label={m.preview} className=\"hidden min-h-0 flex-col gap-2 lg:flex\">\n <RadioGroup.Root label={m.preview} variant=\"segmented\" value={device} onValueChange={(d) => setDevice(d as \"phone\" | \"desktop\")} className=\"self-start\">\n <RadioGroup.Segment value=\"desktop\">{m.desktop}</RadioGroup.Segment>\n <RadioGroup.Segment value=\"phone\">{m.phone}</RadioGroup.Segment>\n </RadioGroup.Root>\n <PreviewFrame src={previewUrl} title={m.previewTitle} phone={device === \"phone\"} frame={frame} />\n </section>\n\n <aside aria-label={m.inspector} className={cn(\"flex min-h-0 flex-col gap-4 overflow-y-auto\", step === \"list\" && \"hidden lg:flex\")}>\n <Button variant=\"ghost\" size=\"sm\" className=\"self-start lg:hidden\" onClick={() => setStep(\"list\")}>← {m.backToSections}</Button>\n {selectedSection ? (\n <Inspector\n section={selectedSection}\n name={sectionLabel(page.sections, selectedIndex, m)}\n messages={m}\n run={exec}\n epoch={epoch}\n announce={announce}\n onInvalid={(key, bad) => setInvalid((prev) => { const next = new Set(prev); if (bad) next.add(key); else next.delete(key); return next.size === prev.size && next.has(key) === prev.has(key) ? prev : next; })}\n preset={page.preset.id}\n density={page.density}\n />\n ) : (\n <p className=\"m-0 text-sm text-fg-secondary\">{m.noSelection}</p>\n )}\n </aside>\n </div>\n\n <Dialog.Root open={adding} onOpenChange={setAdding}>\n <Dialog.Content closeLabel={m.cancel}>\n <Dialog.Header>\n <Dialog.Title>{m.addSection}</Dialog.Title>\n <Dialog.Description>{m.addSectionHint}</Dialog.Description>\n </Dialog.Header>\n <Dialog.Body>\n {[SECTION_DEFINITIONS.filter((d) => !foldedTypes.includes(d.type)), SECTION_DEFINITIONS.filter((d) => foldedTypes.includes(d.type))].map((group, g) => {\n const list = (\n <ul className=\"m-0 grid list-none gap-1 p-0\">\n {group.map((d) => (\n <li key={d.type}>\n <Button variant=\"ghost\" className=\"w-full justify-start\" disabled={d.type === \"hero\" && page.sections.some((s) => s.type === \"hero\")} onClick={() => addSection(d.type)}>\n {m.sectionNames[d.type]}\n </Button>\n </li>\n ))}\n </ul>\n );\n return group.length === 0 ? null : g === 0 ? <React.Fragment key={g}>{list}</React.Fragment> : <details key={g} className=\"mt-3\"><summary className=\"min-h-9 cursor-pointer text-sm text-fg-secondary\">…</summary>{list}</details>;\n })}\n </Dialog.Body>\n </Dialog.Content>\n </Dialog.Root>\n\n <Dialog.Root open={publishing} onOpenChange={setPublishing}>\n <Dialog.Content closeLabel={m.cancel}>\n <Dialog.Header>\n <Dialog.Title>{m.publishTitle}</Dialog.Title>\n <Dialog.Description>{m.publishWhat}</Dialog.Description>\n </Dialog.Header>\n <Dialog.Body>\n {problems.length > 0 && (\n <div role=\"alert\" className=\"mb-3 rounded-md border border-border-control bg-surface-2 p-3\">\n <p className=\"m-0 text-sm font-semibold text-fg\">{fill(m.problemsTitle, { n: problems.length })}</p>\n <ul className=\"m-0 mt-1 list-disc ps-5 text-sm text-fg-secondary\">{problems.map((p) => <li key={p.key}>{p.text}</li>)}</ul>\n </div>\n )}\n {changes.length === 0 ? (\n <p className=\"m-0 text-sm text-fg-secondary\">{m.publishNothing}</p>\n ) : (\n <ul className=\"m-0 list-disc ps-5 text-sm text-fg\">{changes.map((d, i) => <li key={i}>{describe(d)}</li>)}</ul>\n )}\n </Dialog.Body>\n <Dialog.Footer>\n <Dialog.Close asChild><Button variant=\"ghost\">{m.cancel}</Button></Dialog.Close>\n <Button variant=\"primary\" disabled={problems.length > 0 || !parsed.ok} onClick={async () => { await onPublish(page); setBaseline(page); setPublishing(false); }}>{m.publishConfirm}</Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n\n <Dialog.Root open={previewOpen} onOpenChange={setPreviewOpen}>\n <Dialog.Content closeLabel={m.closePreview} size=\"lg\">\n <Dialog.Header><Dialog.Title>{m.preview}</Dialog.Title></Dialog.Header>\n <Dialog.Body className=\"p-0\">\n {previewOpen && <PreviewFrame src={previewUrl} title={m.previewTitle} phone frame={frame} />}\n </Dialog.Body>\n </Dialog.Content>\n </Dialog.Root>\n </div>\n );\n}\n"
232
+ },
233
+ {
234
+ "path": "shop-composer/diff.ts",
235
+ "content": "// What « Publish » shows (ADR-007 §5): the sections added, removed, moved, whose variant, settings or visibility changed, and the\n// look that changed — a list of facts read from two documents, never a guess.\nimport type { Section, ShopPage } from \"../shop/schema\";\n\nexport type DiffEntry =\n | { kind: \"added\" | \"removed\"; key: string; type: string; position: number }\n | { kind: \"moved\"; key: string; type: string; from: number; to: number }\n | { kind: \"variant\"; key: string; type: string; from: string; to: string }\n | { kind: \"settings\" | \"blocks\" | \"text\"; key: string; type: string }\n | { kind: \"disabled\" | \"enabled\"; key: string; type: string }\n | { kind: \"preset\"; from: string; to: string }\n | { kind: \"density\"; from: string | undefined; to: string | undefined };\n\nconst same = (a: unknown, b: unknown) => JSON.stringify(a) === JSON.stringify(b);\n\n/** The differences between the published document and the draft, in the draft's reading order. */\nexport function diffPages(before: ShopPage, after: ShopPage): DiffEntry[] {\n const out: DiffEntry[] = [];\n const was = new Map(before.sections.map((s, i) => [s.key, { s, i }]));\n const is = new Set(after.sections.map((s) => s.key));\n // « moved » is relative: removing a section above must not mark every section under it as moved.\n const kept = before.sections.filter((s) => is.has(s.key)).map((s) => s.key);\n const order = after.sections.filter((s) => was.has(s.key)).map((s) => s.key);\n after.sections.forEach((s: Section, i) => {\n const old = was.get(s.key);\n if (!old) {\n out.push({ kind: \"added\", key: s.key, type: s.type, position: i });\n return;\n }\n if (kept.indexOf(s.key) !== order.indexOf(s.key)) out.push({ kind: \"moved\", key: s.key, type: s.type, from: old.i, to: i });\n if (old.s.variant !== s.variant) out.push({ kind: \"variant\", key: s.key, type: s.type, from: old.s.variant, to: s.variant });\n if (!same(old.s.settings, s.settings)) out.push({ kind: \"settings\", key: s.key, type: s.type });\n if (!same(old.s.blocks, s.blocks)) out.push({ kind: \"blocks\", key: s.key, type: s.type });\n if (!same(old.s.text, s.text)) out.push({ kind: \"text\", key: s.key, type: s.type });\n if (Boolean(old.s.disabled) !== Boolean(s.disabled)) out.push({ kind: s.disabled ? \"disabled\" : \"enabled\", key: s.key, type: s.type });\n });\n for (const [key, { s, i }] of was) if (!is.has(key)) out.push({ kind: \"removed\", key, type: s.type, position: i });\n if (before.preset.id !== after.preset.id || before.preset.version !== after.preset.version) out.push({ kind: \"preset\", from: before.preset.id, to: after.preset.id });\n if (before.density !== after.density) out.push({ kind: \"density\", from: before.density, to: after.density });\n return out;\n}\n"
236
+ },
237
+ {
238
+ "path": "shop-composer/fields.ts",
239
+ "content": "// The settings form of a section is generated from the zod schema of its type (ADR-007 §5): one field per setting, of the kind\n// the schema says — a choice (an enum, or a few numbers), a switch (a boolean), a text (an id or a line), the owner's words in each\n// language, a set of options. The form is the one of `@krizaka/ui/form`; this reads the schema, never a copy of it.\nimport type * as z from \"zod/mini\";\n\nexport type FieldSpec =\n | { name: string; kind: \"choice\"; options: readonly (string | number)[]; optional: boolean }\n | { name: string; kind: \"toggle\"; optional: boolean }\n | { name: string; kind: \"text\"; optional: boolean }\n | { name: string; kind: \"localized\"; optional: boolean }\n | { name: string; kind: \"multi\"; options: readonly string[]; optional: boolean };\n\n// The zod 4 definition shape, read structurally: `_zod.def` is what the schema is made of.\ntype Def = { type: string; shape?: Record<string, z.ZodMiniType>; entries?: Record<string, string>; options?: z.ZodMiniType[]; values?: unknown[]; innerType?: z.ZodMiniType; element?: z.ZodMiniType };\nconst defOf = (s: z.ZodMiniType) => (s as unknown as { _zod: { def: Def } })._zod.def;\n\nfunction specOf(name: string, schema: z.ZodMiniType, optional = false): FieldSpec | undefined {\n const def = defOf(schema);\n switch (def.type) {\n case \"optional\":\n return specOf(name, def.innerType!, true);\n case \"enum\":\n return { name, kind: \"choice\", options: Object.values(def.entries!), optional };\n case \"boolean\":\n return { name, kind: \"toggle\", optional };\n case \"string\":\n return { name, kind: \"text\", optional };\n case \"union\": {\n const options = def.options!.flatMap((o) => (defOf(o).type === \"literal\" ? (defOf(o).values as (string | number)[]) : []));\n return options.length === def.options!.length ? { name, kind: \"choice\", options, optional } : undefined;\n }\n case \"object\": {\n const keys = Object.keys(def.shape!);\n return keys.every((k) => k === \"fr\" || k === \"en\") ? { name, kind: \"localized\", optional } : undefined;\n }\n case \"array\": {\n const inner = specOf(name, def.element!);\n return inner && \"options\" in inner ? { name, kind: \"multi\", options: inner.options.map(String), optional } : undefined;\n }\n default:\n return undefined;\n }\n}\n\n/** The fields of a settings schema, in the schema's order. A setting of a kind the form does not draw is left out. */\nexport function describeSettings(schema: z.ZodMiniObject): FieldSpec[] {\n const shape = defOf(schema).shape ?? {};\n return Object.entries(shape).flatMap(([name, s]) => {\n const spec = specOf(name, s);\n return spec ? [spec] : [];\n });\n}\n"
240
+ },
241
+ {
242
+ "path": "shop-composer/history.ts",
243
+ "content": "// Undo / redo (ADR-007 §5): the document before and after every command, 100 steps. Documents are immutable and share their\n// untouched sections, so keeping a hundred of them costs a few kilobytes. A command that changes nothing is not a step; a new\n// command forgets what was undone.\nimport type { ShopPage } from \"../shop/schema\";\nimport { applyCommand, type Command } from \"./commands\";\n\n/** The most steps kept. */\n// @fixed: ADR-007 §5 — the composer's undo depth, a product decision of the editor, not a shop setting.\nexport const HISTORY_LIMIT = 100;\n\nexport type History = { readonly past: readonly ShopPage[]; readonly present: ShopPage; readonly future: readonly ShopPage[]; /** The key of the burst the last step belongs to (typing in one field). */ readonly merge?: string };\n\nexport const createHistory = (page: ShopPage): History => ({ past: [], present: page, future: [] });\n\n/**\n * Runs a command: a new step, unless it changes nothing. Commands with the same `merge` key in a row (the keystrokes of one field)\n * make one step, so a hundred letters do not use the hundred steps of undo.\n */\nexport function run(history: History, cmd: Command, merge?: string): History {\n const next = applyCommand(history.present, cmd);\n if (next === history.present) return history;\n if (merge && history.merge === merge && history.past.length > 0) return { ...history, present: next, future: [] };\n return { past: [...history.past, history.present].slice(-HISTORY_LIMIT), present: next, future: [], merge };\n}\n\nexport const canUndo = (h: History) => h.past.length > 0;\nexport const canRedo = (h: History) => h.future.length > 0;\n\nexport function undo(h: History): History {\n const previous = h.past.at(-1);\n if (!previous) return h;\n return { past: h.past.slice(0, -1), present: previous, future: [h.present, ...h.future] };\n}\n\nexport function redo(h: History): History {\n const [next, ...rest] = h.future;\n if (!next) return h;\n return { past: [...h.past, h.present], present: next, future: rest };\n}\n\n/** Replaces the document without a step (a reload from the server, a discarded draft). */\nexport const reset = (page: ShopPage): History => createHistory(page);\n"
244
+ },
245
+ {
246
+ "path": "shop-composer/index.ts",
247
+ "content": "/** @krizaka/ui/shop-composer — our own shop composer: `ShopComposer` (the outline, the live preview of the product's page, the inspector of the selected section, the look), its commands, history (⌘Z, 100 steps), the publish diff, the settings form generated from a section's zod schema. A separate entry: never in a public page's bundle. Client. */\nexport { applyCommand, type Command, moved } from \"./commands\";\nexport { AUTOSAVE_MS, ShopComposer, type ShopComposerPreset, type ShopComposerProps } from \"./composer\";\nexport { type DiffEntry, diffPages } from \"./diff\";\nexport { describeSettings, type FieldSpec } from \"./fields\";\nexport { canRedo, canUndo, createHistory, type History, HISTORY_LIMIT, redo, run, undo } from \"./history\";\nexport { newKey } from \"./keys\";\nexport { defaultShopComposerMessages, fill, type ShopComposerMessages } from \"./messages\";\nexport { SectionThumbnail, type SectionThumbnailProps } from \"./thumbnails\";\n"
248
+ },
249
+ {
250
+ "path": "shop-composer/inspector.tsx",
251
+ "content": "\"use client\";\n\n// The inspector (ADR-007 §5): for the selected section, the variant as a radio group of live thumbnails, the settings as a form\n// generated from the zod schema of its type, the owner's own words (title and line, in each language), and the blocks as a\n// sortable list (Move up / Move down, no drag needed). The look of the whole page is the first tab's concern: see `LookPanel`.\nimport { Button } from \"@krizaka/ui/button\";\nimport { RadioGroup } from \"@krizaka/ui/radio-group\";\nimport * as React from \"react\";\n\nimport { sectionDefinition } from \"../shop/catalogue\";\nimport type { Section } from \"../shop/schema\";\nimport type { Command } from \"./commands\";\nimport { newKey } from \"./keys\";\nimport { fill, type ShopComposerMessages } from \"./messages\";\nimport { SettingsForm } from \"./settings-form\";\nimport { SectionThumbnail } from \"./thumbnails\";\n\nexport type InspectorProps = {\n section: Section;\n name: string;\n messages: ShopComposerMessages;\n run: (cmd: Command, merge?: string) => void;\n /** Bumped when the document changes from outside the form (undo, redo): the settings form remounts. */\n epoch: number;\n announce: (message: string) => void;\n onInvalid: (key: string, invalid: boolean) => void;\n /** The page's look, so a thumbnail wears it. */\n preset?: string;\n density?: \"compact\" | \"airy\";\n};\n\nfunction Words({ section, m, run }: Pick<InspectorProps, \"section\" | \"run\"> & { m: ShopComposerMessages }) {\n const id = React.useId();\n const text = section.text ?? {};\n const field = (name: \"title\" | \"lead\", label: string) => (\n <fieldset className=\"m-0 grid gap-1.5 border-0 p-0\">\n <legend className=\"mb-1 text-xs font-semibold text-fg-secondary\">{label}</legend>\n {([\"fr\", \"en\"] as const).map((lang) => (\n <div key={lang} className=\"flex flex-col gap-1\">\n <label htmlFor={`${id}-${name}-${lang}`} className=\"text-xs text-fg-secondary\">{lang === \"fr\" ? m.french : m.english}</label>\n <input\n id={`${id}-${name}-${lang}`}\n className=\"min-h-10 rounded-md border border-border-control bg-surface-1 px-3 text-sm text-fg focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring\"\n maxLength={600}\n value={text[name]?.[lang] ?? \"\"}\n onChange={(e) => {\n const next = { ...(text[name] ?? {}), [lang]: e.target.value || undefined };\n const empty = !next.fr && !next.en;\n run({ type: \"setText\", key: section.key, field: name, value: empty ? undefined : next }, `text:${section.key}:${name}:${lang}`);\n }}\n />\n </div>\n ))}\n </fieldset>\n );\n return (\n <section aria-label={m.words} className=\"grid gap-3\">\n <h3 className=\"m-0 text-sm font-semibold text-fg\">{m.words}</h3>\n {field(\"title\", m.titleField)}\n {field(\"lead\", m.leadField)}\n </section>\n );\n}\n\nfunction Blocks({ section, m, run, announce }: Pick<InspectorProps, \"section\" | \"run\" | \"announce\"> & { m: ShopComposerMessages }) {\n const def = sectionDefinition(section.type);\n const blocks = ((section.blocks ?? []) as { key: string; type: string }[]);\n if (def.blockTypes.length === 0) return null;\n const label = (b: { type: string }, i: number) => `${m.blockNames[b.type] ?? b.type} ${i + 1}`;\n const move = (i: number, to: number) => {\n const b = blocks[i]!;\n if (to < 0 || to >= blocks.length) return;\n run({ type: \"moveBlock\", key: section.key, blockKey: b.key, to });\n announce(fill(m.announceMoved, { name: label(b, i), n: to + 1, total: blocks.length }));\n };\n return (\n <section aria-label={m.blocks} className=\"grid gap-2\">\n <h3 className=\"m-0 text-sm font-semibold text-fg\">{m.blocks}</h3>\n {blocks.length > 0 && (\n <ol className=\"m-0 grid list-none gap-1 p-0\">\n {blocks.map((b, i) => (\n <li key={b.key} className=\"flex items-center gap-1 rounded-md border border-border-default bg-surface-1 ps-3\">\n <span className=\"min-w-0 flex-1 truncate text-sm text-fg\">{label(b, i)}</span>\n <Button size=\"sm\" variant=\"ghost\" disabled={i === 0} aria-label={`${m.moveUp}: ${label(b, i)}`} onClick={() => move(i, i - 1)}>↑</Button>\n <Button size=\"sm\" variant=\"ghost\" disabled={i === blocks.length - 1} aria-label={`${m.moveDown}: ${label(b, i)}`} onClick={() => move(i, i + 1)}>↓</Button>\n <Button size=\"sm\" variant=\"ghost\" aria-label={fill(m.removeBlock, { name: label(b, i) })} onClick={() => run({ type: \"removeBlock\", key: section.key, blockKey: b.key })}>×</Button>\n </li>\n ))}\n </ol>\n )}\n <div className=\"flex flex-wrap gap-2\">\n {def.blockTypes.map((type) => (\n <Button key={type} size=\"sm\" variant=\"outline\" onClick={() => run({ type: \"addBlock\", key: section.key, blockKey: newKey(\"b\"), blockType: type, settings: defaultBlockSettings(type) })}>\n {m.addBlock} · {m.blockNames[type] ?? type}\n </Button>\n ))}\n </div>\n </section>\n );\n}\n\n/** The first settings of a new block: what its schema needs to be valid (a product then fills the references). */\nfunction defaultBlockSettings(type: string): Record<string, unknown> {\n switch (type) {\n case \"fact\": return { kind: \"open-now\" };\n case \"note\": return { text: \"…\" };\n case \"flyer\": return { text: \"…\" };\n case \"photo\": return { mediaId: \"\" };\n case \"service\": return { serviceId: \"\" };\n case \"member\": return { memberId: \"\" };\n case \"reel\": return { platform: \"tiktok\", url: \"https://\" };\n case \"link\": return { platform: \"instagram\", url: \"https://\" };\n case \"question\": return { question: {}, answer: {} };\n default: return {};\n }\n}\n\nexport function Inspector({ section, name, messages: m, run, epoch, announce, onInvalid, preset, density }: InspectorProps) {\n const def = sectionDefinition(section.type);\n const label = React.useId();\n return (\n <div className=\"flex min-w-0 flex-col gap-6\">\n <section aria-labelledby={label} className=\"grid gap-2\">\n <h3 id={label} className=\"m-0 text-sm font-semibold text-fg\">{m.variant}</h3>\n {/* The thumbnail is a section: it holds links and buttons, so it sits beside the radio, never inside it. */}\n <RadioGroup.Root label={`${name}: ${m.variant}`} value={section.variant} onValueChange={(variant) => run({ type: \"setVariant\", key: section.key, variant })} className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {def.variants.map((variant) => (\n <div\n key={variant}\n role=\"presentation\"\n data-checked={section.variant === variant ? \"\" : undefined}\n onClick={() => run({ type: \"setVariant\", key: section.key, variant })}\n className=\"grid cursor-pointer gap-2 rounded-lg border border-border-default bg-surface-1 p-2 data-[checked]:border-accent data-[checked]:bg-accent-soft\"\n >\n <SectionThumbnail type={section.type} variant={variant} preset={preset} density={density} />\n <RadioGroup.Item value={variant}>{m.variantNames[`${section.type}.${variant}`] ?? variant}</RadioGroup.Item>\n </div>\n ))}\n </RadioGroup.Root>\n </section>\n <SettingsForm\n key={`${section.key}:${epoch}`}\n section={section}\n messages={m}\n onValid={(settings) => run({ type: \"patchSettings\", key: section.key, patch: settings }, `settings:${section.key}`)}\n onInvalid={(invalid) => onInvalid(section.key, invalid)}\n />\n <Blocks section={section} m={m} run={run} announce={announce} />\n <Words section={section} m={m} run={run} />\n </div>\n );\n}\n"
252
+ },
253
+ {
254
+ "path": "shop-composer/keys.ts",
255
+ "content": "// Stable keys (ADR-007 §1): « s_8f2c » for a section, « b_3a91 » for a block — generated once, they survive every reorder and\n// anchor the audit. Generated by the composer, never by the reducer (which stays pure).\nconst alphabet = \"0123456789abcdef\";\n\n/** A short random key with a prefix; `random` is injectable so a test is deterministic. */\nexport function newKey(prefix: \"s\" | \"b\", random: () => number = Math.random): string {\n let out = \"\";\n for (let i = 0; i < 6; i++) out += alphabet[Math.floor(random() * 16)];\n return `${prefix}_${out}`;\n}\n"
256
+ },
257
+ {
258
+ "path": "shop-composer/messages.ts",
259
+ "content": "// The composer's words (ADR-007 §5): every string is a prop — the product passes its translated copy. English is the default, so\n// a story or a first integration works without a catalogue; `{name}`, `{n}`, `{total}` are replaced by `fill`.\nimport type { SectionType } from \"../shop/catalogue\";\nimport type { DiffEntry } from \"./diff\";\n\nexport type ShopComposerMessages = {\n title: string;\n /** The outline's name. */\n sections: string;\n addSection: string;\n addSectionHint: string;\n /** « Show {name} » / the switch's accessible name. */\n toggleVisible: string;\n sectionMenu: string;\n moveUp: string;\n moveDown: string;\n moveTop: string;\n remove: string;\n /** Announcements. */\n announceMoved: string;\n announceCannotMove: string;\n announceAdded: string;\n announceRemoved: string;\n announceShown: string;\n announceHidden: string;\n announceUndone: string;\n announceRedone: string;\n hiddenNote: string;\n /** The inspector. */\n inspector: string;\n noSelection: string;\n backToSections: string;\n variant: string;\n settings: string;\n words: string;\n titleField: string;\n leadField: string;\n french: string;\n english: string;\n blocks: string;\n addBlock: string;\n removeBlock: string;\n /** The look. */\n look: string;\n preset: string;\n density: string;\n densityCompact: string;\n densityAiry: string;\n /** The toolbar. */\n undo: string;\n redo: string;\n saved: string;\n saving: string;\n saveFailed: string;\n publish: string;\n discard: string;\n /** The preview. */\n preview: string;\n previewTitle: string;\n phone: string;\n desktop: string;\n viewPreview: string;\n closePreview: string;\n /** The publish dialog. */\n publishTitle: string;\n publishWhat: string;\n publishNothing: string;\n publishConfirm: string;\n cancel: string;\n problemsTitle: string;\n problemIn: string;\n /** The names. */\n sectionNames: Record<SectionType, string>;\n /** `type.variant` → « Poster ». */\n variantNames: Record<string, string>;\n blockNames: Record<string, string>;\n settingNames: Record<string, string>;\n optionNames: Record<string, string>;\n /** One line per kind of change, with `{name}` (the section) and `{from}` / `{to}` / `{n}`. */\n diff: Record<DiffEntry[\"kind\"], string>;\n};\n\n/** `fill(\"Moved to {n}\", { n: 2 })`. */\nexport const fill = (message: string, vars: Record<string, string | number>) => message.replace(/\\{(\\w+)\\}/g, (_, k: string) => String(vars[k] ?? `{${k}}`));\n\nconst sectionNames: Record<SectionType, string> = {\n hero: \"Hero\", services: \"Services\", booking: \"Booking\", gallery: \"Photos\", video: \"Video\", reviews: \"Reviews\", bulletin: \"News\",\n team: \"Team\", visit: \"Visit\", story: \"Story\", social: \"Social\", faq: \"Questions\", policies: \"Policies\",\n};\n\nconst variantNames: Record<string, string> = {\n \"hero.poster\": \"Poster\", \"hero.split\": \"Split\", \"hero.banner\": \"Banner\", \"hero.tv\": \"Television\",\n \"services.menu\": \"Menu\", \"services.cards\": \"Cards\", \"services.index\": \"Index cards\", \"services.carousel\": \"Carousel\",\n \"booking.strip\": \"Next times\", \"booking.panel\": \"Closing call\", \"booking.sticky\": \"Phone bar\",\n \"gallery.mosaic\": \"Mosaic\", \"gallery.filmstrip\": \"Filmstrip\", \"gallery.wall\": \"Wall\", \"gallery.grid\": \"Grid\",\n \"video.tv\": \"Television\", \"video.shorts\": \"Reels\",\n \"reviews.summary-cards\": \"Score and reviews\", \"reviews.quote\": \"One quote\", \"reviews.strip\": \"Score line\",\n \"bulletin.board\": \"Board\", \"bulletin.banner\": \"Banner line\",\n \"team.row\": \"Row\", \"team.cards\": \"Cards\",\n \"visit.card\": \"Card\", \"visit.map\": \"Map\", \"visit.split\": \"Hours and map\",\n \"story.quote\": \"Quote\", \"story.owner\": \"Owner\",\n \"social.links\": \"Links\", \"social.facade\": \"Latest reel\",\n \"faq.list\": \"List\", \"policies.inline\": \"Inline\",\n};\n\nexport const defaultShopComposerMessages: ShopComposerMessages = {\n title: \"Shop page\",\n sections: \"Sections\",\n addSection: \"Add a section\",\n addSectionHint: \"Choose what to add to your page.\",\n toggleVisible: \"Show {name}\",\n sectionMenu: \"Actions for {name}\",\n moveUp: \"Move up\",\n moveDown: \"Move down\",\n moveTop: \"Move to top\",\n remove: \"Remove\",\n announceMoved: \"{name} moved to position {n} of {total}\",\n announceCannotMove: \"{name} cannot move further\",\n announceAdded: \"{name} added at position {n}\",\n announceRemoved: \"{name} removed\",\n announceShown: \"{name} is shown\",\n announceHidden: \"{name} is hidden\",\n announceUndone: \"Undone\",\n announceRedone: \"Redone\",\n hiddenNote: \"hidden\",\n inspector: \"Section\",\n noSelection: \"Choose a section to change how it is drawn.\",\n backToSections: \"Back to sections\",\n variant: \"How it is drawn\",\n settings: \"Settings\",\n words: \"Your words\",\n titleField: \"Title\",\n leadField: \"Line under the title\",\n french: \"French\",\n english: \"English\",\n blocks: \"Items\",\n addBlock: \"Add\",\n removeBlock: \"Remove {name}\",\n look: \"Look\",\n preset: \"Style\",\n density: \"Spacing\",\n densityCompact: \"Compact\",\n densityAiry: \"Airy\",\n undo: \"Undo\",\n redo: \"Redo\",\n saved: \"Saved\",\n saving: \"Saving…\",\n saveFailed: \"Not saved\",\n publish: \"Publish\",\n discard: \"Discard the draft\",\n preview: \"Preview\",\n previewTitle: \"Live preview of your page\",\n phone: \"Phone\",\n desktop: \"Desktop\",\n viewPreview: \"View\",\n closePreview: \"Close\",\n publishTitle: \"Publish this page\",\n publishWhat: \"What changes\",\n publishNothing: \"Nothing has changed since the last publication.\",\n publishConfirm: \"Publish\",\n cancel: \"Cancel\",\n problemsTitle: \"Fix {n} problem before publishing\",\n problemIn: \"{name}\",\n sectionNames,\n variantNames,\n blockNames: { fact: \"Fact\", service: \"Service\", photo: \"Photo\", note: \"Note\", sign: \"Sign\", reel: \"Reel\", flyer: \"Flyer\", member: \"Member\", link: \"Link\", question: \"Question\" },\n settingNames: { media: \"Photo\", focus: \"Crop\", source: \"Source\", groupBy: \"Group by\", columns: \"Columns\", aside: \"Beside the list\", serviceId: \"Service\", count: \"How many\", texture: \"Wall\", cabinet: \"Cabinet\", channel: \"Channel\", rule: \"Which reviews\", showPhone: \"Show the phone number\", body: \"Text\", show: \"Show\" },\n optionNames: { center: \"Centre\", top: \"Top\", bottom: \"Bottom\", all: \"All\", pick: \"Pick\", category: \"Category\", none: \"None\", hours: \"Hours\", plaster: \"Plaster\", brick: \"Brick\", ridge: \"Ridge\", zellige: \"Zellige\", cabinet: \"Cabinet\", portable: \"Portable\", best: \"Best\", latest: \"Latest\", cancellation: \"Cancellation\", prices: \"Prices\", \"booking-window\": \"Booking window\" },\n diff: {\n added: \"{name} added\",\n removed: \"{name} removed\",\n moved: \"{name} moved from {from} to {to}\",\n variant: \"{name} drawn as {to} (was {from})\",\n settings: \"{name}: settings changed\",\n blocks: \"{name}: items changed\",\n text: \"{name}: words changed\",\n disabled: \"{name} hidden\",\n enabled: \"{name} shown\",\n preset: \"Style changed to {to} (was {from})\",\n density: \"Spacing changed to {to} (was {from})\",\n },\n};\n"
260
+ },
261
+ {
262
+ "path": "shop-composer/meta.ts",
263
+ "content": "import type { ComponentMeta } from \"../meta\";\n\nexport const meta = {\n title: \"Shop composer\",\n summary: \"Our own editor for a shop's page document (ADR-007): the outline of the sections, the live preview of the product's page and the inspector of the selected section — variant as live thumbnails, settings as a form generated from the zod schema, words, blocks — with undo and redo, a saved draft and a publish step that shows what changes. First consumer: Akinaza's studio (akinaza#402).\",\n status: \"beta\",\n category: \"blocks\",\n platforms: \"web\",\n parity: { native: { status: \"n/a\", reason: \"The composer is the studio of the web console; a shop's page is a web page.\", use: \"shop\" }, desktop: \"web\" },\n whenToUse: [\n \"The studio of a product whose public page is a `ShopPage` document: the owner chooses sections, their order and how each one is drawn, within a bounded catalogue.\",\n ],\n whenNotToUse: [\n { when: \"A free-form page builder with a canvas, nested columns and any component anywhere: the model here is a list of sections, deliberately.\", use: \"shop\" },\n { when: \"A single form of settings.\", use: \"form\" },\n ],\n bestPractices: [\n \"The product saves the draft in `onChange` (a valid document, after 800 ms of calm) and serves its own public route with `?draft=<id>` for the preview; the composer talks to it by `postMessage` (`connectShopPreview` in `@krizaka/ui/shop` is the page's half).\",\n \"Pass the presets of the shop's trade and the section types the trade does not use (`foldedTypes`): they are folded away, not removed.\",\n \"Pass translated `messages`; English is the default.\",\n \"Publish only what the composer hands to `onPublish`: it is parsed (`parseShopPage`) and the product parses it again on write.\",\n ],\n accessibility: {\n keyboard: [\n { keys: \"↑ ↓\", action: \"Moves between the rows of the outline.\" },\n { keys: \"Alt+↑ / Alt+↓\", action: \"Moves the focused section up or down; the move is announced and focus stays on its row.\" },\n { keys: \"Ctrl/⌘ Z, Shift+Ctrl/⌘ Z\", action: \"Undoes and redoes (100 steps), except inside a text field.\" },\n { keys: \"Enter, Space\", action: \"Selects a section, toggles its visibility, chooses a variant.\" },\n ],\n notes: [\n \"One polite live region says every move, addition, removal and undo; « Saved » is its own status.\",\n \"The preview `iframe` is titled; the variant picker is a radio group; an invalid setting is said next to its field and the publish dialog lists every problem and stays closed to confirmation until they are fixed.\",\n \"On a phone the composer has two steps (the list, then the section) and the preview behind a « View » button.\",\n ],\n },\n related: [\"shop\", \"form\", \"radio-group\", \"dialog\", \"dropdown-menu\", \"switch\"],\n web: {\n imports: [\"ShopComposer\", \"defaultShopComposerMessages\", \"applyCommand\", \"createHistory\", \"diffPages\", \"describeSettings\", \"SectionThumbnail\"],\n examples: [{ name: \"composer\", title: \"Composer\", description: \"The salon's compact page in the composer: outline, preview, inspector.\" }],\n },\n} satisfies ComponentMeta;\n"
264
+ },
265
+ {
266
+ "path": "shop-composer/outline.tsx",
267
+ "content": "\"use client\";\n\n// The outline (ADR-007 §5): the sections in order — name, the variant as a mono note, a visibility switch, a menu. Drag is an\n// extra the page does not need: the path is the keyboard — focus a row, `Alt+↑` / `Alt+↓` (or the row's menu: Move up, Move\n// down, Move to top). Every move is announced (« Reviews moved to position 3 of 8 ») and focus stays on the moved row.\nimport { Button } from \"@krizaka/ui/button\";\nimport { DropdownMenu } from \"@krizaka/ui/dropdown-menu\";\nimport { Switch } from \"@krizaka/ui/switch\";\nimport * as React from \"react\";\n\nimport type { Section } from \"../shop/schema\";\nimport type { Command } from \"./commands\";\nimport { fill, type ShopComposerMessages } from \"./messages\";\n\nexport type OutlineProps = {\n sections: readonly Section[];\n selected: string | null;\n onSelect: (key: string) => void;\n run: (cmd: Command, merge?: string) => void;\n messages: ShopComposerMessages;\n announce: (message: string) => void;\n onAdd: () => void;\n /** A request to focus a row (a new section): a new object each time; consumed once, after the render that drew the row. */\n focusRequest?: { key: string } | null;\n};\n\n/** « Photos », « Photos 2 » when a type appears twice. */\nexport function sectionLabel(sections: readonly Section[], index: number, messages: ShopComposerMessages): string {\n const s = sections[index]!;\n const same = sections.filter((x) => x.type === s.type);\n const base = messages.sectionNames[s.type];\n return same.length > 1 ? `${base} ${same.indexOf(s) + 1}` : base;\n}\n\nconst ICON = \"h-4 w-4\";\n\nexport function Outline({ sections, selected, onSelect, run, messages: m, announce, onAdd, focusRequest }: OutlineProps) {\n const rows = React.useRef(new Map<string, HTMLButtonElement>());\n // After a move (or a menu action) the moved row keeps the focus: the DOM may have reordered under it. A request is consumed once —\n // never on the next change of the document, which may be typing somewhere else.\n const wanted = React.useRef<string | null>(null);\n const [tick, setTick] = React.useState(0);\n const want = (key: string) => {\n wanted.current = key;\n setTick((t) => t + 1);\n };\n React.useLayoutEffect(() => {\n if (focusRequest) wanted.current = focusRequest.key;\n }, [focusRequest]);\n React.useLayoutEffect(() => {\n const key = wanted.current;\n wanted.current = null;\n if (key) rows.current.get(key)?.focus();\n }, [tick, focusRequest]);\n\n const move = (index: number, to: number) => {\n const s = sections[index]!;\n const name = sectionLabel(sections, index, m);\n const lo = sections[0]?.type === \"hero\" ? 1 : 0;\n const clamped = Math.min(Math.max(to, lo), sections.length - 1);\n if (s.type === \"hero\" || clamped === index) {\n announce(fill(m.announceCannotMove, { name }));\n return;\n }\n run({ type: \"moveSection\", key: s.key, to: clamped });\n want(s.key);\n announce(fill(m.announceMoved, { name, n: clamped + 1, total: sections.length }));\n };\n\n const onKeyDown = (e: React.KeyboardEvent, index: number) => {\n if (e.altKey && (e.key === \"ArrowUp\" || e.key === \"ArrowDown\")) {\n e.preventDefault();\n move(index, index + (e.key === \"ArrowUp\" ? -1 : 1));\n } else if (!e.altKey && (e.key === \"ArrowUp\" || e.key === \"ArrowDown\")) {\n const next = sections[index + (e.key === \"ArrowUp\" ? -1 : 1)];\n if (next) {\n e.preventDefault();\n rows.current.get(next.key)?.focus();\n }\n }\n };\n\n return (\n <nav aria-label={m.sections} className=\"flex min-h-0 flex-col gap-3\">\n <ol className=\"m-0 flex list-none flex-col gap-1 p-0\">\n {sections.map((s, i) => {\n const name = sectionLabel(sections, i, m);\n const isHero = s.type === \"hero\";\n const lo = sections[0]?.type === \"hero\" ? 1 : 0;\n return (\n <li key={s.key} data-selected={selected === s.key ? \"\" : undefined} data-disabled={s.disabled ? \"\" : undefined} className=\"flex items-center gap-1 rounded-lg border border-transparent data-[selected]:border-accent data-[selected]:bg-accent-soft\">\n <button\n type=\"button\"\n ref={(el) => {\n if (el) rows.current.set(s.key, el);\n else rows.current.delete(s.key);\n }}\n aria-current={selected === s.key ? \"true\" : undefined}\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown\"\n onClick={() => onSelect(s.key)}\n onKeyDown={(e) => onKeyDown(e, i)}\n className=\"flex min-h-11 min-w-0 flex-1 flex-col items-start justify-center rounded-lg px-3 py-1.5 text-start focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring\"\n >\n <span className=\"flex w-full items-baseline gap-2\">\n <span className={s.disabled ? \"truncate text-sm font-semibold text-fg-secondary line-through decoration-1\" : \"truncate text-sm font-semibold text-fg\"}>{name}</span>\n {s.disabled && <span className=\"font-mono text-[11px] text-fg-secondary\">{m.hiddenNote}</span>}\n </span>\n <span className=\"font-mono text-xs text-fg-secondary\">{m.variantNames[`${s.type}.${s.variant}`] ?? s.variant}</span>\n </button>\n <Switch\n size=\"sm\"\n label={fill(m.toggleVisible, { name })}\n checked={!s.disabled}\n onCheckedChange={(on) => {\n run({ type: \"toggleDisabled\", key: s.key });\n announce(fill(on ? m.announceShown : m.announceHidden, { name }));\n }}\n />\n <DropdownMenu.Root>\n <DropdownMenu.Trigger asChild>\n <Button variant=\"ghost\" size=\"icon\" aria-label={fill(m.sectionMenu, { name })}>\n <svg viewBox=\"0 0 16 16\" className={ICON} fill=\"currentColor\" aria-hidden>\n <circle cx=\"8\" cy=\"3\" r=\"1.4\" />\n <circle cx=\"8\" cy=\"8\" r=\"1.4\" />\n <circle cx=\"8\" cy=\"13\" r=\"1.4\" />\n </svg>\n </Button>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content\n onCloseAutoFocus={(e) => {\n e.preventDefault();\n rows.current.get(s.key)?.focus();\n }}\n >\n <DropdownMenu.Item disabled={isHero || i <= lo} onSelect={() => move(i, i - 1)}>{m.moveUp}</DropdownMenu.Item>\n <DropdownMenu.Item disabled={isHero || i >= sections.length - 1} onSelect={() => move(i, i + 1)}>{m.moveDown}</DropdownMenu.Item>\n <DropdownMenu.Item disabled={isHero || i <= lo} onSelect={() => move(i, lo)}>{m.moveTop}</DropdownMenu.Item>\n <DropdownMenu.Separator />\n <DropdownMenu.Item\n tone=\"danger\"\n disabled={sections.length <= 1}\n onSelect={() => {\n run({ type: \"removeSection\", key: s.key });\n announce(fill(m.announceRemoved, { name }));\n const next = sections[i + 1] ?? sections[i - 1];\n if (next) want(next.key);\n }}\n >\n {m.remove}\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n </li>\n );\n })}\n </ol>\n <Button variant=\"outline\" onClick={onAdd}>{m.addSection}</Button>\n </nav>\n );\n}\n"
268
+ },
269
+ {
270
+ "path": "shop-composer/settings-form.tsx",
271
+ "content": "\"use client\";\n\n// The settings of a section, as a form generated from the zod schema of its type (ADR-007 §5): the form is `@krizaka/ui/form`\n// (TanStack Form behind the facade), the fields are the ones the schema describes (`fields.ts`). Every valid change is committed to\n// the document at once (so undo and the preview follow); an invalid value is said next to its field, stays in the field, and is\n// reported to the composer, which refuses to publish until it is fixed.\nimport { createKrizakaForm, FormField, Switch, TextArea, TextField, useFormContext } from \"@krizaka/ui/form\";\nimport { RadioGroup } from \"@krizaka/ui/radio-group\";\nimport * as React from \"react\";\n\nimport { type SectionDefinition, sectionDefinition } from \"../shop/catalogue\";\nimport type { Section } from \"../shop/schema\";\nimport { describeSettings, type FieldSpec } from \"./fields\";\nimport type { ShopComposerMessages } from \"./messages\";\n\ntype Factory = ReturnType<typeof createKrizakaForm>;\n// One form per section type, defined once (schema + defaults), as the facade asks.\nconst factories = new Map<string, Factory>();\nfunction factoryFor(def: SectionDefinition): Factory {\n let f = factories.get(def.type);\n if (!f) {\n f = createKrizakaForm({ schema: def.settings as never, defaultValues: def.settingsDefault as never }) as unknown as Factory;\n factories.set(def.type, f);\n }\n return f;\n}\n\nconst nameOf = (m: ShopComposerMessages, key: string) => m.settingNames[key] ?? key;\nconst optionName = (m: ShopComposerMessages, o: string | number) => m.optionNames[String(o)] ?? String(o);\n\nfunction Choice({ spec, m }: { spec: Extract<FieldSpec, { kind: \"choice\" }>; m: ShopComposerMessages }) {\n return (\n <FormField name={spec.name}>\n {(f) => (\n <div className=\"grid gap-1.5\">\n <span aria-hidden className=\"text-xs font-semibold text-fg-secondary\">{nameOf(m, spec.name)}</span>\n <RadioGroup.Root label={nameOf(m, spec.name)} variant=\"segmented\" value={String(f.value)} onValueChange={(v) => f.setValue(spec.options.find((o) => String(o) === v))} onBlur={f.onBlur}>\n {spec.options.map((o) => (\n <RadioGroup.Segment key={String(o)} value={String(o)}>{optionName(m, o)}</RadioGroup.Segment>\n ))}\n </RadioGroup.Root>\n </div>\n )}\n </FormField>\n );\n}\n\nfunction Multi({ spec, m }: { spec: Extract<FieldSpec, { kind: \"multi\" }>; m: ShopComposerMessages }) {\n return (\n <FormField name={spec.name}>\n {(f) => {\n const value = (f.value as string[] | undefined) ?? [];\n return (\n <fieldset className=\"m-0 flex flex-col gap-1.5 border-0 p-0\">\n <legend className=\"mb-1 text-xs font-semibold text-fg-secondary\">{nameOf(m, spec.name)}</legend>\n {spec.options.map((o) => (\n <label key={o} className=\"flex min-h-9 items-center gap-2 text-sm text-fg\">\n <input\n type=\"checkbox\"\n className=\"h-4 w-4 accent-accent\"\n checked={value.includes(o)}\n onChange={(e) => f.setValue(e.target.checked ? [...value, o] : value.filter((x) => x !== o))}\n />\n {optionName(m, o)}\n </label>\n ))}\n </fieldset>\n );\n }}\n </FormField>\n );\n}\n\nfunction Field({ spec, m }: { spec: FieldSpec; m: ShopComposerMessages }) {\n switch (spec.kind) {\n case \"choice\":\n return <Choice spec={spec} m={m} />;\n case \"multi\":\n return <Multi spec={spec} m={m} />;\n case \"toggle\":\n return <Switch name={spec.name} label={nameOf(m, spec.name)} />;\n case \"text\":\n return <TextField name={spec.name} label={nameOf(m, spec.name)} />;\n case \"localized\":\n return (\n <div className=\"flex flex-col gap-2\">\n <TextArea name={`${spec.name}.fr`} label={`${nameOf(m, spec.name)} — ${m.french}`} rows={3} maxLength={600} />\n <TextArea name={`${spec.name}.en`} label={`${nameOf(m, spec.name)} — ${m.english}`} rows={3} maxLength={600} />\n </div>\n );\n }\n}\n\n/** What the schema is asked: an emptied text is an absent setting (an optional id), an emptied language an absent language. */\nfunction normalise(values: unknown): unknown {\n if (Array.isArray(values)) return values;\n if (typeof values !== \"object\" || values === null) return values;\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(values)) {\n if (v === \"\") continue;\n const inner = typeof v === \"object\" && v !== null && !Array.isArray(v) ? normalise(v) : v;\n out[k] = inner;\n }\n return out;\n}\n\n/** Reports the form's values: a valid set goes to `onValid`, an invalid one to `onInvalid` (and never reaches the document). */\nfunction Commit({ def, onValid, onInvalid }: { def: SectionDefinition; onValid: (settings: Record<string, unknown>) => void; onInvalid: (invalid: boolean) => void }) {\n const { api } = useFormContext();\n const latest = React.useRef({ onValid, onInvalid });\n React.useEffect(() => {\n latest.current = { onValid, onInvalid };\n });\n React.useEffect(() => {\n const sub = (api.store as { subscribe: (cb: () => void) => unknown }).subscribe(() => {\n const result = def.settings.safeParse(normalise(api.state.values));\n latest.current.onInvalid(!result.success);\n if (result.success) latest.current.onValid(result.data as Record<string, unknown>);\n });\n return () => {\n const s = sub as { unsubscribe?: () => void } | (() => void);\n if (typeof s === \"function\") s();\n else s?.unsubscribe?.();\n };\n }, [api, def]);\n return null;\n}\n\nexport type SettingsFormProps = {\n section: Section;\n messages: ShopComposerMessages;\n /** A valid set of settings: the composer commits it. */\n onValid: (settings: Record<string, unknown>) => void;\n /** Whether the form holds a value the schema refuses (publish waits). */\n onInvalid: (invalid: boolean) => void;\n};\n\n/** The form of a section's settings: remount it (a `key`) when the document is changed from outside (undo, redo). */\nexport function SettingsForm({ section, messages: m, onValid, onInvalid }: SettingsFormProps) {\n const def = sectionDefinition(section.type);\n const factory = factoryFor(def);\n const form = factory.useForm({ defaultValues: section.settings as never }) as unknown as { Form: (p: { \"aria-label\": string; className?: string; children: React.ReactNode }) => React.ReactElement };\n const specs = describeSettings(def.settings);\n if (specs.length === 0) return null;\n return (\n <form.Form aria-label={m.settings} className=\"flex flex-col gap-4\">\n {specs.map((spec) => (\n <Field key={spec.name} spec={spec} m={m} />\n ))}\n <Commit def={def} onValid={onValid} onInvalid={onInvalid} />\n </form.Form>\n );\n}\n"
272
+ },
273
+ {
274
+ "path": "shop-composer/thumbnails.tsx",
275
+ "content": "\"use client\";\n\n// The variant picker's thumbnails (ADR-007 §5): the section itself, drawn with demo data at the scale of a card — not a screenshot,\n// so a new variant or a new preset needs no new picture, and each thumbnail wears the page's look (the preset applies around it).\nimport * as React from \"react\";\n\nimport { Button } from \"../button/button\";\nimport { BookingSection } from \"../shop/booking/booking\";\nimport { BulletinSection } from \"../shop/bulletin/bulletin\";\nimport type { SectionType } from \"../shop/catalogue\";\nimport { demoSalon } from \"../shop/demo\";\nimport { FaqSection } from \"../shop/faq/faq\";\nimport { ShopFrame } from \"../shop/frame\";\nimport { GallerySection } from \"../shop/gallery/gallery\";\nimport { HeroSection } from \"../shop/hero/hero\";\nimport { PoliciesSection } from \"../shop/policies/policies\";\nimport { ReviewsSection } from \"../shop/reviews/reviews\";\nimport { ServicesSection } from \"../shop/services/services\";\nimport { SocialSection } from \"../shop/social/social\";\nimport { StorySection } from \"../shop/story/story\";\nimport { TeamSection } from \"../shop/team/team\";\nimport { VideoSection } from \"../shop/video/video\";\nimport { VisitSection } from \"../shop/visit/visit\";\n\nconst shop = demoSalon;\nconst play = { tiktok: \"Play\", \"youtube-shorts\": \"Play\", instagram: \"Play\" } as const;\nconst reel = { id: \"r\", platform: \"tiktok\" as const, url: \"https://www.tiktok.com/@salon/video/7000000000000000000\", title: \"Reel\" };\nconst summary = {\n score: 4.7, count: 38, distribution: [0, 1, 2, 7, 28] as [number, number, number, number, number],\n scoreText: \"4.7 / 5\", countText: \"38 reviews\", summaryText: \"4.7 out of 5, 38 reviews\", starText: (s: number, n: number) => `${s} stars: ${n}`,\n};\nconst review = { id: \"a\", author: \"Nadia F.\", date: \"October 2026\", dateTime: \"2026-10\", service: \"Cut and blow-dry\", rating: 5, ratingText: \"5 out of 5\", text: \"The best blow-dry in the neighbourhood, simply.\" };\n\n/** The section as it looks with demo data, in the variant asked. */\nfunction Demo({ type, variant }: { type: SectionType; variant: string }): React.ReactNode {\n const v = variant as never;\n switch (type) {\n case \"hero\":\n return <HeroSection variant={v} title={shop.name} eyebrow={shop.eyebrow} lead={shop.promise} cover={shop.cover} actions={<Button variant=\"primary\">Book</Button>} tv={{ src: \"/demo.mp4\", poster: shop.cover.src, title: \"Latest video\" } as never} />;\n case \"services\":\n return <ServicesSection variant={v} title=\"Services\" services={shop.services} chooseLabel=\"Choose\" popularLabel=\"Popular\" />;\n case \"booking\":\n return variant === \"sticky\" ? <div className=\"flex items-center justify-center border-t border-border-default bg-surface-1 p-4\"><Button variant=\"primary\" size=\"lg\">Book</Button></div> : <BookingSection variant={v} label=\"Next free times\" times={shop.times} href=\"#\" actionLabel=\"Book\" title=\"Ready when you are\" body=\"A few taps.\" />;\n case \"gallery\":\n return <GallerySection variant={v} title=\"Photos\" label=\"Photos\" photos={shop.photos} sign={shop.name} />;\n case \"video\":\n return <VideoSection variant={v} title=\"Latest\" reels={[reel, { ...reel, id: \"r2\" }]} playLabels={play} />;\n case \"reviews\":\n return <ReviewsSection variant={v} title=\"Reviews\" summary={summary} reviews={[review, { ...review, id: \"b\", author: \"Léo P.\" }]} />;\n case \"bulletin\":\n return <BulletinSection variant={v} title=\"News\" today=\"2026-10-27\" flyers={[{ id: \"f\", text: \"Closed on Monday the 3rd: see you on Tuesday!\", signature: \"Jade\" }]} />;\n case \"team\":\n return <TeamSection variant={v} title=\"Team\" members={shop.team.map((t) => ({ id: t.id, name: t.name, role: \"Stylist\" }))} />;\n case \"visit\":\n return <VisitSection variant={v} title=\"Visit\" hours={shop.hours} status={shop.status} hoursLabel=\"Hours\" address={shop.address} phone={{ href: \"tel:5145550110\", label: shop.phone }} map={{ label: \"Map\", center: [-73.58, 45.48], showLabel: \"Show the map\" }} />;\n case \"story\":\n return <StorySection variant={v} title=\"Our story\" quote=\"Cuts that last, advice that is honest.\" body=\"Three friends opened the salon in 2019, on the corner where the old bakery stood.\" owner={{ name: \"Jade\" }} />;\n case \"social\":\n return <SocialSection variant={v} title=\"Follow us\" links={[{ id: \"a\", platform: \"instagram\", url: \"https://instagram.com/salon\" }, { id: \"b\", platform: \"tiktok\", url: \"https://tiktok.com/@salon\" }]} playLabels={play} />;\n case \"faq\":\n return <FaqSection title=\"Questions\" questions={[{ id: \"q\", question: \"Do I need to book?\", answer: \"Yes, pick a time online.\" }, { id: \"q2\", question: \"Can I cancel?\", answer: \"Up to 24 hours before.\" }]} />;\n case \"policies\":\n return <PoliciesSection title=\"Policies\" items={[{ id: \"p\", term: \"Cancellation\", details: \"Free up to 24 h before\" }, { id: \"p2\", term: \"Prices\", details: \"Before taxes\" }]} />;\n }\n}\n\nexport type SectionThumbnailProps = {\n /** The section type. */\n type: SectionType;\n /** Its variant: one of the type's. */\n variant: string;\n /** The look preset the page wears (`salon-vitrine`): the thumbnail wears it too. */\n preset?: string;\n /** The page's spacing. @default \"compact\" */\n density?: \"compact\" | \"airy\";\n};\n\n/** A picture of a section: 160 × 96 px of a 960 px page, inert and hidden from assistive technology. */\nexport function SectionThumbnail({ type, variant, preset, density }: SectionThumbnailProps) {\n return (\n <div aria-hidden inert className=\"kz-shop-thumb\" data-thumb={`${type}.${variant}`}>\n <div className=\"kz-shop-thumb-inner\">\n <ShopFrame preset={preset} density={density ?? \"compact\"}>\n <Demo type={type} variant={variant} />\n </ShopFrame>\n </div>\n </div>\n );\n}\n"
276
+ }
277
+ ],
278
+ "dependencies": [
279
+ "zod@^4.6.7"
280
+ ],
281
+ "registryDependencies": [
282
+ "button",
283
+ "cn",
284
+ "dialog",
285
+ "dropdown-menu",
286
+ "form",
287
+ "radio-group",
288
+ "shop",
289
+ "switch"
290
+ ],
291
+ "demo": {
292
+ "path": "examples/shop-composer/composer.tsx",
293
+ "content": "\"use client\";\n\nimport { shopStarters } from \"@krizaka/ui/shop\";\nimport { ShopComposer } from \"@krizaka/ui/shop-composer\";\n\nconst presets = [\n { id: \"salon-vitrine\", version: 1, name: \"Vitrine\", density: \"compact\", variants: { hero: \"poster\", services: \"menu\" } },\n { id: \"salon-atelier\", version: 1, name: \"Atelier\", density: \"airy\", variants: { hero: \"split\", services: \"menu\" } },\n] as const;\n\n// The product's own route goes here (`https://…/salon?draft=<id>`); a still note stands in for it.\nconst PREVIEW = \"data:text/html,%3Cbody style='margin:0;display:grid;place-items:center;height:100vh;font:15px system-ui;color:%23667'%3EThe live page of the shop appears here%3C/body%3E\";\n\n// The salon's compact page: reorder with Alt+↑ / Alt+↓, change how a section is drawn, undo with ⌘Z, publish to see what changes.\nexport default function ShopComposerExample() {\n return (\n <div className=\"h-[44rem] max-w-full p-3\">\n <ShopComposer value={shopStarters.salonCompact} previewUrl={PREVIEW} presets={presets} onPublish={() => undefined} className=\"h-full\" />\n </div>\n );\n}\n"
294
+ },
295
+ "props": [
296
+ {
297
+ "component": "AUTOSAVE_MS",
298
+ "description": "How long the draft waits for calm before it is saved.",
299
+ "props": []
300
+ },
301
+ {
302
+ "component": "ShopComposer",
303
+ "description": "The shop composer.",
304
+ "props": [
305
+ {
306
+ "name": "onPublish",
307
+ "type": "(page: ShopPage) => void | Promise<void>",
308
+ "default": null,
309
+ "description": "Called with the draft once the person confirmed the diff.",
310
+ "required": true
311
+ },
312
+ {
313
+ "name": "presets",
314
+ "type": "readonly ShopComposerPreset[]",
315
+ "default": null,
316
+ "description": "The look presets of the shop's trade.",
317
+ "required": true
318
+ },
319
+ {
320
+ "name": "previewUrl",
321
+ "type": "string",
322
+ "default": null,
323
+ "description": "The page of the product, in an iframe: its own route with `?draft=<id>`. Its origin is the bridge's.",
324
+ "required": true
325
+ },
326
+ {
327
+ "name": "value",
328
+ "type": "ShopPage",
329
+ "default": null,
330
+ "description": "The draft to edit. The composer keeps its own history from it.",
331
+ "required": true
332
+ },
333
+ {
334
+ "name": "className",
335
+ "type": "string",
336
+ "default": null,
337
+ "description": "Classes merged on the root (its height: `h-[100dvh]`).",
338
+ "required": false
339
+ },
340
+ {
341
+ "name": "foldedTypes",
342
+ "type": "readonly (\"video\" | \"faq\" | \"hero\" | \"services\" | \"booking\" | \"gallery\" | \"reviews\" | \"bulletin\" | \"team\" | \"visit\" | \"story\" | \"social\" | \"policies\")[]",
343
+ "default": "[]",
344
+ "description": "The section types the trade does not use: folded under « … » in the catalogue.",
345
+ "required": false
346
+ },
347
+ {
348
+ "name": "messages",
349
+ "type": "ShopComposerMessages",
350
+ "default": "{\n title: \"Shop page\",\n sections: \"Sections\",\n addSection: \"Add a section\",\n addSectionHint: \"Choose what to add to your page.\",\n toggleVisible: \"Show {name}\",\n sectionMenu: \"Actions for {name}\",\n moveUp: \"Move up\",\n moveDown: \"Move down\",\n moveTop: \"Move to top\",\n remove: \"Remove\",\n announceMoved: \"{name} moved to position {n} of {total}\",\n announceCannotMove: \"{name} cannot move further\",\n announceAdded: \"{name} added at position {n}\",\n announceRemoved: \"{name} removed\",\n announceShown: \"{name} is shown\",\n announceHidden: \"{name} is hidden\",\n announceUndone: \"Undone\",\n announceRedone: \"Redone\",\n hiddenNote: \"hidden\",\n inspector: \"Section\",\n noSelection: \"Choose a section to change how it is drawn.\",\n backToSections: \"Back to sections\",\n variant: \"How it is drawn\",\n settings: \"Settings\",\n words: \"Your words\",\n titleField: \"Title\",\n leadField: \"Line under the title\",\n french: \"French\",\n english: \"English\",\n blocks: \"Items\",\n addBlock: \"Add\",\n removeBlock: \"Remove {name}\",\n look: \"Look\",\n preset: \"Style\",\n density: \"Spacing\",\n densityCompact: \"Compact\",\n densityAiry: \"Airy\",\n undo: \"Undo\",\n redo: \"Redo\",\n saved: \"Saved\",\n saving: \"Saving…\",\n saveFailed: \"Not saved\",\n publish: \"Publish\",\n discard: \"Discard the draft\",\n preview: \"Preview\",\n previewTitle: \"Live preview of your page\",\n phone: \"Phone\",\n desktop: \"Desktop\",\n viewPreview: \"View\",\n closePreview: \"Close\",\n publishTitle: \"Publish this page\",\n publishWhat: \"What changes\",\n publishNothing: \"Nothing has changed since the last publication.\",\n publishConfirm: \"Publish\",\n cancel: \"Cancel\",\n problemsTitle: \"Fix {n} problem before publishing\",\n problemIn: \"{name}\",\n sectionNames,\n variantNames,\n blockNames: { fact: \"Fact\", service: \"Service\", photo: \"Photo\", note: \"Note\", sign: \"Sign\", reel: \"Reel\", flyer: \"Flyer\", member: \"Member\", link: \"Link\", question: \"Question\" },\n settingNames: { media: \"Photo\", focus: \"Crop\", source: \"Source\", groupBy: \"Group by\", columns: \"Columns\", aside: \"Beside the list\", serviceId: \"Service\", count: \"How many\", texture: \"Wall\", cabinet: \"Cabinet\", channel: \"Channel\", rule: \"Which reviews\", showPhone: \"Show the phone number\", body: \"Text\", show: \"Show\" },\n optionNames: { center: \"Centre\", top: \"Top\", bottom: \"Bottom\", all: \"All\", pick: \"Pick\", category: \"Category\", none: \"None\", hours: \"Hours\", plaster: \"Plaster\", brick: \"Brick\", ridge: \"Ridge\", zellige: \"Zellige\", cabinet: \"Cabinet\", portable: \"Portable\", best: \"Best\", latest: \"Latest\", cancellation: \"Cancellation\", prices: \"Prices\", \"booking-window\": \"Booking window\" },\n diff: {\n added: \"{name} added\",\n removed: \"{name} removed\",\n moved: \"{name} moved from {from} to {to}\",\n variant: \"{name} drawn as {to} (was {from})\",\n settings: \"{name}: settings changed\",\n blocks: \"{name}: items changed\",\n text: \"{name}: words changed\",\n disabled: \"{name} hidden\",\n enabled: \"{name} shown\",\n preset: \"Style changed to {to} (was {from})\",\n density: \"Spacing changed to {to} (was {from})\",\n },\n}",
351
+ "description": "The words, translated. Default: English.",
352
+ "required": false
353
+ },
354
+ {
355
+ "name": "onChange",
356
+ "type": "((page: ShopPage) => void | Promise<void>)",
357
+ "default": null,
358
+ "description": "Called with a valid draft after 800 ms without a change: save it. A rejection says « Not saved ».",
359
+ "required": false
360
+ },
361
+ {
362
+ "name": "onDiscard",
363
+ "type": "(() => void)",
364
+ "default": null,
365
+ "description": "The discard of the draft (the product asks first, in its own dialog). Absent: no such button.",
366
+ "required": false
367
+ },
368
+ {
369
+ "name": "published",
370
+ "type": "ShopPage",
371
+ "default": null,
372
+ "description": "What is live now, for the diff of « Publish ». Absent: the document the composer was opened with.",
373
+ "required": false
374
+ },
375
+ {
376
+ "name": "resetKey",
377
+ "type": "string | number",
378
+ "default": null,
379
+ "description": "Change it to load another document (another draft): the history and the selection start again.",
380
+ "required": false
381
+ }
382
+ ]
383
+ },
384
+ {
385
+ "component": "HISTORY_LIMIT",
386
+ "description": "The most steps kept.",
387
+ "props": []
388
+ },
389
+ {
390
+ "component": "SectionThumbnail",
391
+ "description": "A picture of a section: 160 × 96 px of a 960 px page, inert and hidden from assistive technology.",
392
+ "props": [
393
+ {
394
+ "name": "type",
395
+ "type": "\"video\" | \"faq\" | \"hero\" | \"services\" | \"booking\" | \"gallery\" | \"reviews\" | \"bulletin\" | \"team\" | \"visit\" | \"story\" | \"social\" | \"policies\"",
396
+ "default": null,
397
+ "description": "The section type.",
398
+ "required": true
399
+ },
400
+ {
401
+ "name": "variant",
402
+ "type": "string",
403
+ "default": null,
404
+ "description": "Its variant: one of the type's.",
405
+ "required": true
406
+ },
407
+ {
408
+ "name": "density",
409
+ "type": "\"compact\" | \"airy\"",
410
+ "default": "compact",
411
+ "description": "The page's spacing.",
412
+ "required": false
413
+ },
414
+ {
415
+ "name": "preset",
416
+ "type": "string",
417
+ "default": null,
418
+ "description": "The look preset the page wears (`salon-vitrine`): the thumbnail wears it too.",
419
+ "required": false
420
+ }
421
+ ]
422
+ }
423
+ ]
424
+ }