@jackuait/blok 0.10.0-beta.5 → 0.10.0-beta.7

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 (471) hide show
  1. package/codemod/migrate-editorjs-to-blok.js +0 -2
  2. package/codemod/test.js +0 -6
  3. package/dist/blok.mjs +3 -3
  4. package/dist/chunks/_basePickBy-BHRNO12X.mjs +410 -0
  5. package/dist/chunks/_baseUniq-DtFPDBML.mjs +1045 -0
  6. package/dist/chunks/_getTag-ozrhqxk_.mjs +26 -0
  7. package/dist/chunks/arc-BEqJP9HX.mjs +80 -0
  8. package/dist/chunks/architecture-YZFGNWBL-Bcu-90pi.mjs +3 -0
  9. package/dist/chunks/architectureDiagram-Q4EWVU46-BMno5LCn.mjs +4066 -0
  10. package/dist/chunks/array-Cyf-61SV.mjs +6 -0
  11. package/dist/chunks/blockDiagram-DXYQGD6D-DlP_cPth.mjs +3259 -0
  12. package/dist/chunks/{blok-DH-WEcA8.mjs → blok-CiLRmoHI.mjs} +2030 -1996
  13. package/dist/chunks/c4Diagram-AHTNJAMY-BbVV8EXj.mjs +2956 -0
  14. package/dist/chunks/channel-DPcniO2B.mjs +5 -0
  15. package/dist/chunks/chunk-2KRD3SAO-CazES4VS.mjs +20 -0
  16. package/dist/chunks/chunk-336JU56O-heO72r_k.mjs +49 -0
  17. package/dist/chunks/chunk-426QAEUC-CmCcml1z.mjs +13 -0
  18. package/dist/chunks/chunk-4BX2VUAB-B10DxOza.mjs +19 -0
  19. package/dist/chunks/chunk-4TB4RGXK-B0snhZOU.mjs +3250 -0
  20. package/dist/chunks/chunk-55IACEB6-CGkn5ABd.mjs +8 -0
  21. package/dist/chunks/chunk-5FUZZQ4R-USdumo_u.mjs +3786 -0
  22. package/dist/chunks/chunk-5PVQY5BW-CxUGVzQL.mjs +1692 -0
  23. package/dist/chunks/chunk-67CJDMHE-Bvw55oRa.mjs +20 -0
  24. package/dist/chunks/chunk-7N4EOEYR-Bs2qDy88.mjs +29 -0
  25. package/dist/chunks/chunk-AA7GKIK3-Bss0LgrN.mjs +24 -0
  26. package/dist/chunks/chunk-BSJP7CBP-CpUW7gi5.mjs +83 -0
  27. package/dist/chunks/chunk-CIAEETIT-DlRbLLf3.mjs +20 -0
  28. package/dist/chunks/chunk-D6kmoKXy.mjs +20 -0
  29. package/dist/chunks/chunk-EDXVE4YY-DEcX4XWm.mjs +26 -0
  30. package/dist/chunks/chunk-ENJZ2VHE-B4THRZkR.mjs +566 -0
  31. package/dist/chunks/chunk-FMBD7UC4-CF6BKEiV.mjs +5 -0
  32. package/dist/chunks/chunk-FOC6F5B3--xuza7Yn.mjs +20 -0
  33. package/dist/chunks/chunk-ICPOFSXX-BMja8cuy.mjs +3290 -0
  34. package/dist/chunks/chunk-K5T4RW27-CHEqGHFS.mjs +16370 -0
  35. package/dist/chunks/chunk-KGLVRYIC-DHYYpR8v.mjs +20 -0
  36. package/dist/chunks/chunk-LIHQZDEY-AvbOvyLE.mjs +55 -0
  37. package/dist/chunks/chunk-ORNJ4GCN-38fbR5OS.mjs +25 -0
  38. package/dist/chunks/chunk-OYMX7WX6-BiqlATPA.mjs +2038 -0
  39. package/dist/chunks/chunk-QZHKN3VN-DitZIvj8.mjs +12 -0
  40. package/dist/chunks/chunk-U2HBQHQK-DJytnHmZ.mjs +1875 -0
  41. package/dist/chunks/chunk-X2U36JSP-DlOifw1K.mjs +68 -0
  42. package/dist/chunks/chunk-XPW4576I-s4fsi4XO.mjs +1146 -0
  43. package/dist/chunks/chunk-YZCP3GAM-Ch258bXC.mjs +60 -0
  44. package/dist/chunks/chunk-ZZ45TVLE-DWziaKxP.mjs +33 -0
  45. package/dist/chunks/classDiagram-6PBFFD2Q-BOkAe08u.mjs +30 -0
  46. package/dist/chunks/classDiagram-v2-HSJHXN6E-DeKatSvh.mjs +30 -0
  47. package/dist/chunks/clone-CJCz7VRp.mjs +8 -0
  48. package/dist/chunks/{constants-Ccno9NZS.mjs → constants-DFS8l39Y.mjs} +525 -552
  49. package/dist/chunks/cose-bilkent-S5V4N54A-CzLGVqvr.mjs +2246 -0
  50. package/dist/chunks/cytoscape.esm-D0iglm-M.mjs +18108 -0
  51. package/dist/chunks/dagre-KV5264BT-XbHSjleO.mjs +298 -0
  52. package/dist/chunks/dagre-XY8CZ1sg.mjs +1536 -0
  53. package/dist/chunks/default-DIfXCS2E.mjs +4 -0
  54. package/dist/chunks/defaultLocale-DFhS1600.mjs +201 -0
  55. package/dist/chunks/diagram-5BDNPKRD-CM7c3UTI.mjs +112 -0
  56. package/dist/chunks/diagram-G4DWMVQ6-Bhg4ps6b.mjs +546 -0
  57. package/dist/chunks/diagram-MMDJMWI5-C-UCVaxB.mjs +234 -0
  58. package/dist/chunks/diagram-TYMM5635-BOHSujSD.mjs +144 -0
  59. package/dist/chunks/dist-DHsXIYdd.mjs +59 -0
  60. package/dist/chunks/erDiagram-SMLLAGMA-CwKxXFMB.mjs +1712 -0
  61. package/dist/chunks/flowDiagram-DWJPFMVM-rQJKfyuO.mjs +4175 -0
  62. package/dist/chunks/ganttDiagram-T4ZO3ILL-DfaZirLX.mjs +3083 -0
  63. package/dist/chunks/gitGraph-7Q5UKJZL-BKG8cHGz.mjs +3 -0
  64. package/dist/chunks/gitGraphDiagram-UUTBAWPF-CRa-ymsI.mjs +792 -0
  65. package/dist/chunks/graphlib-CuDElSdG.mjs +223 -0
  66. package/dist/chunks/{i18next-G6FKbZqA.mjs → i18next-BBGW2sDE.mjs} +1 -1
  67. package/dist/chunks/{i18next-loader-CwNimni3.mjs → i18next-loader-CasQQb5s.mjs} +2 -2
  68. package/dist/chunks/info-OMHHGYJF-FKqYyUn9.mjs +3 -0
  69. package/dist/chunks/infoDiagram-42DDH7IO-CvyJU2nE.mjs +29 -0
  70. package/dist/chunks/init-JlKGZtuT.mjs +15 -0
  71. package/dist/chunks/ishikawaDiagram-UXIWVN3A-CIpbw1BK.mjs +719 -0
  72. package/dist/chunks/journeyDiagram-VCZTEJTY-H96UcUK9.mjs +885 -0
  73. package/dist/chunks/kanban-definition-6JOO6SKY-BYZT3srA.mjs +980 -0
  74. package/dist/chunks/katex-JyOgX6MW.mjs +22026 -0
  75. package/dist/chunks/{lightweight-i18n-DWCdzAw0.mjs → lightweight-i18n-Cvv8CWh4.mjs} +29 -18
  76. package/dist/chunks/line-B9xUUA7k.mjs +34 -0
  77. package/dist/chunks/linear-Dj-1yA_B.mjs +289 -0
  78. package/dist/chunks/mdast-util-math-CHYUxOHk.mjs +151 -0
  79. package/dist/chunks/mermaid-parser.core-D6OPAUtM.mjs +57 -0
  80. package/dist/chunks/mermaid.core-BPN9ZHKQ.mjs +989 -0
  81. package/dist/{messages-B-4fku2H2.mjs → chunks/messages--YKhFEDE.mjs} +30 -19
  82. package/dist/{messages-BCG_evLg.mjs → chunks/messages-0Uwu1AMJ2.mjs} +28 -17
  83. package/dist/{messages-CdlsTFB1.mjs → chunks/messages-1__0Ph4Q.mjs} +28 -17
  84. package/dist/chunks/{messages-wLSVQbsA2.mjs → messages-4sm9Pb0C.mjs} +28 -17
  85. package/dist/chunks/{messages-R2W_rGOo2.mjs → messages-4uxjtzKW.mjs} +28 -17
  86. package/dist/chunks/{messages-Dm4YVlrm.mjs → messages-B-SwLgkQ.mjs} +30 -19
  87. package/dist/{messages--S8_taOd2.mjs → chunks/messages-B1ylBxXQ.mjs} +28 -17
  88. package/dist/chunks/{messages-B7MIRzCa2.mjs → messages-B5m3dhKc.mjs} +28 -17
  89. package/dist/chunks/{messages-Dplnp19q.mjs → messages-B6n2zDtv.mjs} +29 -18
  90. package/dist/chunks/{messages-DD7BI6BK.mjs → messages-BC9w4zAT.mjs} +28 -17
  91. package/dist/chunks/{messages-BrFl5773.mjs → messages-BOj-7N3p.mjs} +28 -17
  92. package/dist/chunks/{messages-BbdNugdi.mjs → messages-BRYHTS18.mjs} +28 -17
  93. package/dist/chunks/{messages-JQKFJo7C.mjs → messages-BSBbVjor.mjs} +35 -24
  94. package/dist/{messages-CBzd_x7H.mjs → chunks/messages-BUUkmUGc.mjs} +28 -17
  95. package/dist/{messages-CjmSrt1D.mjs → chunks/messages-Bb3YEV2P.mjs} +33 -22
  96. package/dist/{messages-BvgXeMSL2.mjs → chunks/messages-Be_6YLzJ.mjs} +29 -18
  97. package/dist/{messages-pgPcitDH.mjs → chunks/messages-BevRhv5d.mjs} +28 -17
  98. package/dist/chunks/{messages-BW_7lfqG2.mjs → messages-Bhqr7Im2.mjs} +28 -17
  99. package/dist/chunks/{messages-LxumrNue2.mjs → messages-BpJFjSKa.mjs} +29 -18
  100. package/dist/{messages-xEI8gEDK.mjs → chunks/messages-BqYlq_Bn.mjs} +28 -17
  101. package/dist/{messages-CBdQ3XP9.mjs → chunks/messages-BtAwCUfD.mjs} +28 -17
  102. package/dist/{messages-D3cAcyzj.mjs → chunks/messages-Bthbp65G.mjs} +29 -18
  103. package/dist/{messages-CYX48nfg.mjs → chunks/messages-BvHMZ8Pi2.mjs} +28 -17
  104. package/dist/{messages-Dddxv8-f2.mjs → chunks/messages-Bw1BE9jW.mjs} +28 -17
  105. package/dist/chunks/{messages-d0Ky6QjR.mjs → messages-Bx6Wt285.mjs} +28 -17
  106. package/dist/chunks/{messages-BPog17132.mjs → messages-BzslJRYv.mjs} +29 -18
  107. package/dist/{messages-hTpeKUaW.mjs → chunks/messages-C02M0Tpw.mjs} +28 -17
  108. package/dist/chunks/{messages-C-b6tPad2.mjs → messages-C1u3E9qg.mjs} +28 -17
  109. package/dist/{messages-BJ7BuFZi.mjs → chunks/messages-C68WgSKk.mjs} +29 -18
  110. package/dist/chunks/{messages-Bpda_3PM2.mjs → messages-C8w8JCP0.mjs} +30 -19
  111. package/dist/chunks/{messages-CmrMwBv3.mjs → messages-CFOZdSk4.mjs} +28 -17
  112. package/dist/{messages-DVQNjdPk.mjs → chunks/messages-CGOY79lr.mjs} +28 -17
  113. package/dist/chunks/{messages-DAVsuDWh2.mjs → messages-CGaSMZPu.mjs} +28 -17
  114. package/dist/{messages-DtrSrdfE2.mjs → chunks/messages-CJJgQ0BH.mjs} +28 -17
  115. package/dist/{messages-CgzbJ8_l2.mjs → chunks/messages-CTD6rtQj2.mjs} +28 -17
  116. package/dist/chunks/{messages-p4byLfvR.mjs → messages-CZymJML9.mjs} +32 -21
  117. package/dist/{messages-CqkRG9mH.mjs → chunks/messages-CfeFJbiv.mjs} +32 -21
  118. package/dist/{messages-DjJQoYvP2.mjs → chunks/messages-Cgatzu_z.mjs} +30 -19
  119. package/dist/{messages-CM5fsPo02.mjs → chunks/messages-Ch2zBI602.mjs} +28 -17
  120. package/dist/chunks/{messages-CyNsByCY.mjs → messages-CiAHsUfO.mjs} +28 -17
  121. package/dist/{messages-BXI3qIos.mjs → chunks/messages-Cuzq-tNW.mjs} +28 -17
  122. package/dist/chunks/{messages-FHrCEJmY2.mjs → messages-Cw4qiMwb.mjs} +28 -17
  123. package/dist/chunks/{messages-xfjdrZmx.mjs → messages-Cyh-mz40.mjs} +28 -17
  124. package/dist/{messages-Bo_FUvVH.mjs → chunks/messages-D-I2QO8H.mjs} +28 -17
  125. package/dist/chunks/{messages-Ct7AMBS82.mjs → messages-D0D2gruy.mjs} +28 -17
  126. package/dist/chunks/{messages-CrMfiGu5.mjs → messages-D1BKxfLD.mjs} +29 -18
  127. package/dist/chunks/{messages-CmXADeab2.mjs → messages-D4eDs6R_.mjs} +28 -17
  128. package/dist/chunks/{messages-ClRHDxzh.mjs → messages-D9Xr-hES.mjs} +28 -17
  129. package/dist/{messages-tsHpMdDT2.mjs → chunks/messages-D9eJPHia.mjs} +30 -19
  130. package/dist/{messages-DUBHHfEt.mjs → chunks/messages-DBFWSzKY2.mjs} +28 -17
  131. package/dist/{messages-i4S6q64n2.mjs → chunks/messages-DC0wu2S7.mjs} +28 -17
  132. package/dist/chunks/{messages-BnznaKEP2.mjs → messages-DF9o19rG.mjs} +28 -17
  133. package/dist/{messages-DA-o8X3A.mjs → chunks/messages-DFS_n986.mjs} +51 -40
  134. package/dist/{messages-BGsDZTQp2.mjs → chunks/messages-DGS4H30T.mjs} +28 -17
  135. package/dist/chunks/{messages-Cdx4QMR1.mjs → messages-DKjddpzJ.mjs} +30 -19
  136. package/dist/chunks/{messages-B3s2vra72.mjs → messages-DMvTdUXC.mjs} +30 -19
  137. package/dist/{messages-Dcyrzdxa2.mjs → chunks/messages-DQUX-QYI2.mjs} +28 -17
  138. package/dist/chunks/{messages-BS1nOvZ-.mjs → messages-DUigq8FO2.mjs} +28 -17
  139. package/dist/{messages-BKjqW08U.mjs → chunks/messages-DY0FJdpH.mjs} +28 -17
  140. package/dist/{messages-BBvDbp62.mjs → chunks/messages-DfVXiqt-2.mjs} +28 -17
  141. package/dist/chunks/{messages-DHCVA7XQ.mjs → messages-DgZc9TJw.mjs} +28 -17
  142. package/dist/chunks/{messages-1Raf1IK82.mjs → messages-QD4BCUDP.mjs} +28 -17
  143. package/dist/{messages-JhoVMjfX2.mjs → chunks/messages-USmweex9.mjs} +28 -17
  144. package/dist/chunks/{messages-DBpXyvRe2.mjs → messages-a1JTi0Qm.mjs} +31 -20
  145. package/dist/chunks/{messages-D5IgUbBD2.mjs → messages-jcgCHPRn.mjs} +28 -17
  146. package/dist/chunks/{messages-Dfpi8pDY.mjs → messages-tnnqHpbd.mjs} +29 -18
  147. package/dist/{messages-DZEcrbmH.mjs → chunks/messages-vzWKPLJO.mjs} +28 -17
  148. package/dist/chunks/micromark-extension-math-Cz_ZZ_0Y.mjs +169 -0
  149. package/dist/chunks/micromark-factory-space-WwmyBO_J.mjs +36 -0
  150. package/dist/chunks/mindmap-definition-QFDTVHPH-BswFuNN6.mjs +1013 -0
  151. package/dist/chunks/{notifier-Butv4Dvo.mjs → notifier-B1zCi9G1.mjs} +1 -1
  152. package/dist/chunks/{objectSpread2-BY4mgzrQ.mjs → objectSpread2-CWwMYL_U.mjs} +1 -1
  153. package/dist/chunks/ordinal-D1_lEgAO.mjs +65 -0
  154. package/dist/chunks/packet-4T2RLAQJ-DTUW2U0C.mjs +3 -0
  155. package/dist/chunks/path-6nYPAvNb.mjs +85 -0
  156. package/dist/chunks/pie-ZZUOXDRM-D-umqvEM.mjs +3 -0
  157. package/dist/chunks/pieDiagram-DEJITSTG-1WJgvK1w.mjs +179 -0
  158. package/dist/chunks/quadrantDiagram-34T5L4WZ-B_YH8QGl.mjs +1960 -0
  159. package/dist/chunks/radar-PYXPWWZC-DkQelf08.mjs +3 -0
  160. package/dist/chunks/requirementDiagram-MS252O5E-DRl0YJRI.mjs +2224 -0
  161. package/dist/chunks/rough.esm-CSWJruu5.mjs +1353 -0
  162. package/dist/chunks/sankeyDiagram-XADWPNL6-B-8IrknH.mjs +909 -0
  163. package/dist/chunks/sequenceDiagram-FGHM5R23-DTLb8qmO.mjs +4181 -0
  164. package/dist/chunks/src-CRgEHLPW.mjs +2149 -0
  165. package/dist/chunks/stateDiagram-FHFEXIEX-B0JFjLFy.mjs +218 -0
  166. package/dist/chunks/stateDiagram-v2-QKLJ7IA2-Co9CUU_z.mjs +28 -0
  167. package/dist/chunks/timeline-definition-GMOUNBTQ-CS9KTh-Q.mjs +1084 -0
  168. package/dist/chunks/{tools-C2_IVsQY.mjs → tools-CSYsrnud.mjs} +2846 -3098
  169. package/dist/chunks/treeView-SZITEDCU-DOOoyNP9.mjs +3 -0
  170. package/dist/chunks/treemap-W4RFUUIX-CsOoUA-u.mjs +3 -0
  171. package/dist/chunks/vennDiagram-DHZGUBPP-0BNu5Wna.mjs +1876 -0
  172. package/dist/chunks/wardley-RL74JXVD-CCzZcmEk.mjs +3 -0
  173. package/dist/chunks/wardleyDiagram-NUSXRM2D-Ca9XByNH.mjs +594 -0
  174. package/dist/chunks/xychartDiagram-5P7HB3ND-C8AyKUAE.mjs +2017 -0
  175. package/dist/cli.mjs +1 -1
  176. package/dist/full.mjs +14 -14
  177. package/dist/locales.mjs +95 -84
  178. package/dist/markdown.mjs +3962 -0
  179. package/dist/{chunks/messages-6mikOS4D2.mjs → messages-5jvKxQNu2.mjs} +28 -17
  180. package/dist/{messages-BAcH6PtT2.mjs → messages-7QD-X6XT2.mjs} +28 -17
  181. package/dist/{messages-DbxbxUiK2.mjs → messages-96iaAUds2.mjs} +29 -18
  182. package/dist/{messages-CVcQD-9u.mjs → messages-B19o-Teb.mjs} +30 -19
  183. package/dist/{messages-Ccd587Yn.mjs → messages-B1ZUQagA.mjs} +28 -17
  184. package/dist/{messages-upqrRZQH2.mjs → messages-B7ieAJBd2.mjs} +28 -17
  185. package/dist/{chunks/messages-Csvm4mtA.mjs → messages-BECMxmfX.mjs} +28 -17
  186. package/dist/{chunks/messages-DA7Zk-Cy.mjs → messages-BIHc0KHY.mjs} +29 -18
  187. package/dist/{chunks/messages-BdnSVKOw.mjs → messages-BIoeoik5.mjs} +28 -17
  188. package/dist/{chunks/messages-DQ5AyNCU.mjs → messages-BJeGJksD.mjs} +28 -17
  189. package/dist/{messages-C5XPUD9T2.mjs → messages-BRZX964b2.mjs} +29 -18
  190. package/dist/{messages-Dkg99bfr2.mjs → messages-BTQPpoM42.mjs} +31 -20
  191. package/dist/{messages-fLi0P2dP.mjs → messages-BYNcD6uR.mjs} +28 -17
  192. package/dist/{messages-BvgTQLf72.mjs → messages-BYmmMDrN2.mjs} +28 -17
  193. package/dist/{chunks/messages-CgRvtOEY.mjs → messages-BbYq1pk-.mjs} +28 -17
  194. package/dist/{chunks/messages-DUDgFEEe2.mjs → messages-BiUGXvYr2.mjs} +28 -17
  195. package/dist/{chunks/messages-DJkIeapn.mjs → messages-BiiongNz2.mjs} +28 -17
  196. package/dist/{messages-BBq0M604.mjs → messages-Bm0Feca1.mjs} +32 -21
  197. package/dist/{messages-eTourT12.mjs → messages-BmAn22OX.mjs} +28 -17
  198. package/dist/{messages-C6Y4Jv2N.mjs → messages-Bq3F2Tp_.mjs} +28 -17
  199. package/dist/{messages-DIRha_gg2.mjs → messages-BsycN_JI2.mjs} +28 -17
  200. package/dist/{chunks/messages-CljStrYi.mjs → messages-BwHs4cm1.mjs} +32 -21
  201. package/dist/{chunks/messages-Cs9XBt4T.mjs → messages-CJTy6JZt.mjs} +28 -17
  202. package/dist/{messages-BokEflKa.mjs → messages-CR_L_UtK.mjs} +28 -17
  203. package/dist/{chunks/messages-ZJ0b1C3a.mjs → messages-CSUHBs4c2.mjs} +28 -17
  204. package/dist/{messages-BcFQFcJ92.mjs → messages-CWIXvnDf2.mjs} +28 -17
  205. package/dist/{messages-DnatBKPm.mjs → messages-CcF4y-E4.mjs} +28 -17
  206. package/dist/{messages-BywbKcPC.mjs → messages-Ce6KVEbT.mjs} +29 -18
  207. package/dist/{messages-DOTJ2NvJ.mjs → messages-Ci0KqX-J.mjs} +35 -24
  208. package/dist/{messages-BtxaN-xx.mjs → messages-CjbnogEC.mjs} +28 -17
  209. package/dist/{messages-BSe3QDnQ.mjs → messages-CmB406HW.mjs} +30 -19
  210. package/dist/{messages-BVKZK-3t.mjs → messages-CqXtJTpU.mjs} +28 -17
  211. package/dist/{chunks/messages-DJA6fb_P2.mjs → messages-D0aw5_0k2.mjs} +30 -19
  212. package/dist/{chunks/messages-DPykxECP2.mjs → messages-D8FQWulF2.mjs} +28 -17
  213. package/dist/{chunks/messages-CpzO7KRA.mjs → messages-DBiVgUs2.mjs} +29 -18
  214. package/dist/{chunks/messages-B0ffBqzr.mjs → messages-DIJlIqlQ2.mjs} +28 -17
  215. package/dist/{chunks/messages-BaPZuLjN.mjs → messages-DLX_iBDJ.mjs} +28 -17
  216. package/dist/{chunks/messages-CvfKofOP.mjs → messages-DLlc9QPw.mjs} +28 -17
  217. package/dist/{chunks/messages-Czny5pPT2.mjs → messages-DMr62KiO2.mjs} +28 -17
  218. package/dist/{chunks/messages-IDEUsFhQ2.mjs → messages-DPA-mMWC2.mjs} +29 -18
  219. package/dist/{messages-BCuTVHBV.mjs → messages-DTh9a8mR.mjs} +28 -17
  220. package/dist/{chunks/messages-DT7fRpCy.mjs → messages-DY4IqlhY.mjs} +28 -17
  221. package/dist/{chunks/messages-BgVEGd4c.mjs → messages-DYTTu0O12.mjs} +28 -17
  222. package/dist/{messages-Bk984gRE2.mjs → messages-DbySKTKt2.mjs} +30 -19
  223. package/dist/{chunks/messages-ID1PHnMv.mjs → messages-Ddnj2iTG2.mjs} +28 -17
  224. package/dist/{messages-BmNaAyKS.mjs → messages-DkLU_rWm.mjs} +28 -17
  225. package/dist/{messages-C6OJvnJg2.mjs → messages-Dl3Sv6Rq2.mjs} +29 -18
  226. package/dist/{chunks/messages-C1OqT_nL.mjs → messages-Dl5Y2-Ia.mjs} +51 -40
  227. package/dist/{chunks/messages-Cqc-6rfh2.mjs → messages-DnG0ef8t2.mjs} +30 -19
  228. package/dist/{chunks/messages-BkCjgGxc.mjs → messages-DnGJD4TL.mjs} +28 -17
  229. package/dist/{messages-Bio7KYsr2.mjs → messages-Dnp9N6RU2.mjs} +28 -17
  230. package/dist/{chunks/messages-Df87zXXG.mjs → messages-Dvn35ksS.mjs} +28 -17
  231. package/dist/{messages-CHJ5SOZI.mjs → messages-Dw__BcTj.mjs} +28 -17
  232. package/dist/{chunks/messages-DC7TX-YT.mjs → messages-Dy-Y_nEI.mjs} +28 -17
  233. package/dist/{messages-DV9e1DW7.mjs → messages-E_ZuzGDt.mjs} +28 -17
  234. package/dist/{messages-DD5pW0zJ.mjs → messages-F2xRoY1w.mjs} +28 -17
  235. package/dist/{chunks/messages-BgsPQXfP.mjs → messages-Smt4GBbj.mjs} +33 -22
  236. package/dist/{messages-DJT4Bt_02.mjs → messages-aMXpHt5X2.mjs} +28 -17
  237. package/dist/{chunks/messages-B2pW6jO_.mjs → messages-aWZH50vu2.mjs} +30 -19
  238. package/dist/{chunks/messages-u2yxkNTE2.mjs → messages-dv19AkyJ.mjs} +28 -17
  239. package/dist/{messages-DJKLtW7u.mjs → messages-hWwSRF-2.mjs} +28 -17
  240. package/dist/{messages-tK67CBqn.mjs → messages-j7o5rT9s.mjs} +28 -17
  241. package/dist/{messages-DqyqEw1_.mjs → messages-nUVjeh7K.mjs} +29 -18
  242. package/dist/{chunks/messages-DSjXen8E.mjs → messages-nlhESX9t.mjs} +28 -17
  243. package/dist/{messages-C30Vz-UZ2.mjs → messages-rk-A1Wa42.mjs} +30 -19
  244. package/dist/{chunks/messages-DR09nkcZ.mjs → messages-xh2eOLvs.mjs} +28 -17
  245. package/dist/{chunks/messages-C11byid72.mjs → messages-ynAe7ewZ.mjs} +28 -17
  246. package/dist/react.mjs +3 -3
  247. package/dist/tools.mjs +3 -3
  248. package/dist/vendor.LICENSE.txt +4609 -212
  249. package/package.json +21 -3
  250. package/src/components/blocks.ts +26 -1
  251. package/src/components/constants/data-attributes.ts +0 -2
  252. package/src/components/i18n/locales/am/messages.json +28 -17
  253. package/src/components/i18n/locales/ar/messages.json +28 -17
  254. package/src/components/i18n/locales/az/messages.json +28 -17
  255. package/src/components/i18n/locales/bg/messages.json +28 -17
  256. package/src/components/i18n/locales/bn/messages.json +28 -17
  257. package/src/components/i18n/locales/bs/messages.json +30 -19
  258. package/src/components/i18n/locales/cs/messages.json +32 -21
  259. package/src/components/i18n/locales/da/messages.json +35 -24
  260. package/src/components/i18n/locales/de/messages.json +33 -22
  261. package/src/components/i18n/locales/dv/messages.json +28 -17
  262. package/src/components/i18n/locales/el/messages.json +28 -17
  263. package/src/components/i18n/locales/en/messages.json +28 -17
  264. package/src/components/i18n/locales/es/messages.json +29 -18
  265. package/src/components/i18n/locales/et/messages.json +32 -21
  266. package/src/components/i18n/locales/fa/messages.json +28 -17
  267. package/src/components/i18n/locales/fi/messages.json +28 -17
  268. package/src/components/i18n/locales/fil/messages.json +51 -40
  269. package/src/components/i18n/locales/fr/messages.json +29 -18
  270. package/src/components/i18n/locales/gu/messages.json +28 -17
  271. package/src/components/i18n/locales/he/messages.json +28 -17
  272. package/src/components/i18n/locales/hi/messages.json +28 -17
  273. package/src/components/i18n/locales/hr/messages.json +30 -19
  274. package/src/components/i18n/locales/hu/messages.json +29 -18
  275. package/src/components/i18n/locales/hy/messages.json +28 -17
  276. package/src/components/i18n/locales/id/messages.json +28 -17
  277. package/src/components/i18n/locales/it/messages.json +29 -18
  278. package/src/components/i18n/locales/ja/messages.json +28 -17
  279. package/src/components/i18n/locales/ka/messages.json +28 -17
  280. package/src/components/i18n/locales/km/messages.json +28 -17
  281. package/src/components/i18n/locales/kn/messages.json +28 -17
  282. package/src/components/i18n/locales/ko/messages.json +28 -17
  283. package/src/components/i18n/locales/ku/messages.json +28 -17
  284. package/src/components/i18n/locales/lo/messages.json +28 -17
  285. package/src/components/i18n/locales/lt/messages.json +28 -17
  286. package/src/components/i18n/locales/lv/messages.json +28 -17
  287. package/src/components/i18n/locales/mk/messages.json +28 -17
  288. package/src/components/i18n/locales/ml/messages.json +28 -17
  289. package/src/components/i18n/locales/mn/messages.json +28 -17
  290. package/src/components/i18n/locales/mr/messages.json +28 -17
  291. package/src/components/i18n/locales/ms/messages.json +30 -19
  292. package/src/components/i18n/locales/my/messages.json +28 -17
  293. package/src/components/i18n/locales/ne/messages.json +28 -17
  294. package/src/components/i18n/locales/nl/messages.json +30 -19
  295. package/src/components/i18n/locales/no/messages.json +31 -20
  296. package/src/components/i18n/locales/pa/messages.json +28 -17
  297. package/src/components/i18n/locales/pl/messages.json +29 -18
  298. package/src/components/i18n/locales/ps/messages.json +28 -17
  299. package/src/components/i18n/locales/pt/messages.json +29 -18
  300. package/src/components/i18n/locales/ro/messages.json +29 -18
  301. package/src/components/i18n/locales/ru/messages.json +28 -17
  302. package/src/components/i18n/locales/sd/messages.json +28 -17
  303. package/src/components/i18n/locales/si/messages.json +28 -17
  304. package/src/components/i18n/locales/sk/messages.json +30 -19
  305. package/src/components/i18n/locales/sl/messages.json +30 -19
  306. package/src/components/i18n/locales/sq/messages.json +29 -18
  307. package/src/components/i18n/locales/sr/messages.json +28 -17
  308. package/src/components/i18n/locales/sv/messages.json +30 -19
  309. package/src/components/i18n/locales/sw/messages.json +28 -17
  310. package/src/components/i18n/locales/ta/messages.json +28 -17
  311. package/src/components/i18n/locales/te/messages.json +28 -17
  312. package/src/components/i18n/locales/th/messages.json +28 -17
  313. package/src/components/i18n/locales/tr/messages.json +28 -17
  314. package/src/components/i18n/locales/ug/messages.json +28 -17
  315. package/src/components/i18n/locales/uk/messages.json +28 -17
  316. package/src/components/i18n/locales/ur/messages.json +28 -17
  317. package/src/components/i18n/locales/vi/messages.json +28 -17
  318. package/src/components/i18n/locales/yi/messages.json +28 -17
  319. package/src/components/i18n/locales/zh/messages.json +28 -17
  320. package/src/components/icons/index.ts +59 -47
  321. package/src/components/inline-tools/inline-tool-code.ts +399 -0
  322. package/src/components/modules/api/blocks.ts +17 -0
  323. package/src/components/modules/api/tools.ts +0 -19
  324. package/src/components/modules/blockEvents/composers/blockSelectionKeys.ts +20 -3
  325. package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +5 -5
  326. package/src/components/modules/blockManager/blockManager.ts +0 -11
  327. package/src/components/modules/blockManager/event-binder.ts +1 -12
  328. package/src/components/modules/paste/handlers/html-handler.ts +13 -10
  329. package/src/components/modules/paste/handlers/index.ts +1 -0
  330. package/src/components/modules/paste/index.ts +6 -0
  331. package/src/components/modules/themeManager.ts +1 -3
  332. package/src/components/modules/toolbar/blockSettings.ts +1 -0
  333. package/src/components/modules/toolbar/inline/index.ts +3 -0
  334. package/src/components/modules/ui.ts +0 -13
  335. package/src/components/modules/uiControllers/controllers/keyboard.ts +0 -29
  336. package/src/components/modules/uiControllers/controllers/selection.ts +2 -14
  337. package/src/components/ui/toolbox.ts +1 -0
  338. package/src/components/utils/popover/popover-position.ts +2 -4
  339. package/src/markdown/index.ts +63 -0
  340. package/src/markdown/markdown-handler.ts +110 -0
  341. package/src/markdown/mdast-to-blocks.ts +418 -0
  342. package/src/markdown/phrasing-to-html.ts +60 -0
  343. package/src/markdown/types.ts +42 -0
  344. package/src/stories/EditorModes.stories.ts +0 -60
  345. package/src/styles/main.css +39 -1140
  346. package/src/tools/callout/emoji-picker/index.ts +3 -2
  347. package/src/tools/callout/index.ts +24 -0
  348. package/src/tools/code/code-keyboard.ts +142 -0
  349. package/src/tools/code/constants.ts +96 -0
  350. package/src/tools/code/dom-builder.ts +181 -0
  351. package/src/tools/code/highlight-applier.ts +229 -0
  352. package/src/tools/code/index.ts +462 -0
  353. package/src/tools/code/katex-loader.ts +50 -0
  354. package/src/tools/code/language-picker.ts +241 -0
  355. package/src/tools/code/mermaid-loader.ts +45 -0
  356. package/src/tools/code/shiki-loader.ts +135 -0
  357. package/src/tools/divider/index.ts +9 -1
  358. package/src/tools/index.ts +4 -2
  359. package/src/tools/list/block-operations.ts +3 -1
  360. package/src/tools/list/depth-validator.ts +4 -7
  361. package/src/tools/list/dom-builder.ts +5 -3
  362. package/src/tools/list/index.ts +21 -3
  363. package/src/tools/list/list-helpers.ts +9 -2
  364. package/src/tools/list/list-keyboard.ts +56 -14
  365. package/src/tools/list/list-lifecycle.ts +3 -1
  366. package/src/tools/list/marker-calculator.ts +37 -0
  367. package/src/tools/list/ordered-marker-manager.ts +4 -2
  368. package/src/tools/table/core/table-commands.ts +16 -0
  369. package/src/tools/table/core/table-controller.ts +29 -0
  370. package/src/tools/table/core/table-events.ts +17 -0
  371. package/src/tools/table/index.ts +196 -13
  372. package/src/tools/table/table-cell-blocks.ts +9 -6
  373. package/src/tools/table/table-cell-clipboard.ts +7 -2
  374. package/src/tools/table/table-cell-placement-picker.ts +133 -0
  375. package/src/tools/table/table-cell-selection.ts +174 -19
  376. package/src/tools/table/table-core.ts +321 -113
  377. package/src/tools/table/table-map.ts +279 -0
  378. package/src/tools/table/table-model.ts +901 -1
  379. package/src/tools/table/table-operations.ts +78 -44
  380. package/src/tools/table/table-resize.ts +19 -17
  381. package/src/tools/table/table-row-col-drag.ts +24 -10
  382. package/src/tools/table/types.ts +24 -2
  383. package/types/api/tools.d.ts +0 -18
  384. package/types/data-attributes.d.ts +0 -1
  385. package/types/index.d.ts +0 -16
  386. package/types/markdown.d.ts +2 -0
  387. package/types/tools/code.d.ts +13 -0
  388. package/src/tools/database/database-backend-sync.ts +0 -101
  389. package/src/tools/database/database-board-view.ts +0 -301
  390. package/src/tools/database/database-card-drag.ts +0 -306
  391. package/src/tools/database/database-card-drawer.ts +0 -546
  392. package/src/tools/database/database-column-controls.ts +0 -46
  393. package/src/tools/database/database-column-drag.ts +0 -262
  394. package/src/tools/database/database-keyboard.ts +0 -35
  395. package/src/tools/database/database-list-row-drag.ts +0 -245
  396. package/src/tools/database/database-list-view.ts +0 -333
  397. package/src/tools/database/database-model.ts +0 -246
  398. package/src/tools/database/database-property-type-popover.ts +0 -108
  399. package/src/tools/database/database-tab-bar.ts +0 -532
  400. package/src/tools/database/database-view-popover.ts +0 -109
  401. package/src/tools/database/database-view-renderer.ts +0 -25
  402. package/src/tools/database/index.ts +0 -948
  403. package/src/tools/database/types.ts +0 -144
  404. package/types/tools/database.d.ts +0 -145
  405. /package/dist/chunks/{am-CHDDMHkd.mjs → am-rVzV1W41.mjs} +0 -0
  406. /package/dist/chunks/{ar-DoqfNqut.mjs → ar-C710lkoH.mjs} +0 -0
  407. /package/dist/chunks/{az-C34P9iEa.mjs → az-BOp1pgua.mjs} +0 -0
  408. /package/dist/chunks/{bg-jroXLY8Y.mjs → bg-CL9p09ZD.mjs} +0 -0
  409. /package/dist/chunks/{bn-BRI-WqxY.mjs → bn-CNmSeyAy.mjs} +0 -0
  410. /package/dist/chunks/{bs-CCGUpNHu.mjs → bs-BRzMGqzk.mjs} +0 -0
  411. /package/dist/chunks/{cs-D5qZOGuc.mjs → cs-BYPBLmnF.mjs} +0 -0
  412. /package/dist/chunks/{da-DrJ7W37K.mjs → da-CBC_LR1c.mjs} +0 -0
  413. /package/dist/chunks/{de-BW6-kp2c.mjs → de-DxRFMoAj.mjs} +0 -0
  414. /package/dist/chunks/{el-C-Vc_Otu.mjs → el-Bk6YbySf.mjs} +0 -0
  415. /package/dist/chunks/{es-B6fI5K9i.mjs → es-DpT3FCMR.mjs} +0 -0
  416. /package/dist/chunks/{et-BhVlZ-Yz.mjs → et-DE9Dr_g9.mjs} +0 -0
  417. /package/dist/chunks/{fa-D55Ijdqa.mjs → fa-Banj1QUE.mjs} +0 -0
  418. /package/dist/chunks/{fi-jNLjhKUQ.mjs → fi-DfN3M5ER.mjs} +0 -0
  419. /package/dist/chunks/{fil-DYd0T5aX.mjs → fil-DbCsRS1d.mjs} +0 -0
  420. /package/dist/chunks/{fr-yxy5xWw_.mjs → fr-D1clKhgt.mjs} +0 -0
  421. /package/dist/chunks/{gu-CcY_LJe7.mjs → gu-1CsZyRwT.mjs} +0 -0
  422. /package/dist/chunks/{he-DL9s7wNw.mjs → he-qQdnL6eK.mjs} +0 -0
  423. /package/dist/chunks/{hi-C8eGXgw5.mjs → hi-DxM0Nff1.mjs} +0 -0
  424. /package/dist/chunks/{hr-DLpybOhU.mjs → hr-Onldyi-u.mjs} +0 -0
  425. /package/dist/chunks/{hu-BkT0gT00.mjs → hu-CAn3pBuY.mjs} +0 -0
  426. /package/dist/chunks/{hy-CVFDCp2S.mjs → hy-D43q7NxE.mjs} +0 -0
  427. /package/dist/chunks/{id-0P4W9Az0.mjs → id-Xrw5Dd0Y.mjs} +0 -0
  428. /package/dist/chunks/{it-mLY6_uoW.mjs → it-CA9ZDMSc.mjs} +0 -0
  429. /package/dist/chunks/{ja-7RkeRNWG.mjs → ja-D0J6WRFh.mjs} +0 -0
  430. /package/dist/chunks/{ka-C7Lx-Qsh.mjs → ka-BZL7xDuY.mjs} +0 -0
  431. /package/dist/chunks/{km-Q8udaraH.mjs → km-BimgQZVU.mjs} +0 -0
  432. /package/dist/chunks/{kn-BiETM-iq.mjs → kn-C2n2cPHK.mjs} +0 -0
  433. /package/dist/chunks/{ko-tiB80pF1.mjs → ko-n4Cn93D3.mjs} +0 -0
  434. /package/dist/chunks/{ku-CY-OABkR.mjs → ku-BYZCgT44.mjs} +0 -0
  435. /package/dist/chunks/{lo-CTBhEnyk.mjs → lo-DVXiAE4N.mjs} +0 -0
  436. /package/dist/chunks/{lt-BHKHEtqK.mjs → lt-B9KlQFnY.mjs} +0 -0
  437. /package/dist/chunks/{lv-DWxgtfUg.mjs → lv-BINeOdyx.mjs} +0 -0
  438. /package/dist/chunks/{mk-BjookGdx.mjs → mk-_-QrPrLN.mjs} +0 -0
  439. /package/dist/chunks/{ml-L-NnZcp9.mjs → ml-KvJSC1KT.mjs} +0 -0
  440. /package/dist/chunks/{mn-OMWi7Hl_.mjs → mn-CjFjWnRG.mjs} +0 -0
  441. /package/dist/chunks/{mr-B6JPzITo.mjs → mr-DqAZ7FRX.mjs} +0 -0
  442. /package/dist/chunks/{ms-CG3S-sPB.mjs → ms-BZcV4UG_.mjs} +0 -0
  443. /package/dist/chunks/{my-BLAmGfhT.mjs → my-97SC9jYN.mjs} +0 -0
  444. /package/dist/chunks/{native-BPcABu9z.mjs → native-CzYG0YgY.mjs} +0 -0
  445. /package/dist/chunks/{ne-D1JHLfYw.mjs → ne-Bs-M2TyF.mjs} +0 -0
  446. /package/dist/chunks/{nl-Ca7Q8FnY.mjs → nl-2ZwQilo-.mjs} +0 -0
  447. /package/dist/chunks/{no-Coxcohcz.mjs → no-fOQTpFq1.mjs} +0 -0
  448. /package/dist/chunks/{pa-CCaXqpaI.mjs → pa-DLOqkMi0.mjs} +0 -0
  449. /package/dist/chunks/{pl-Cl_fAZ84.mjs → pl-FYs9QrXU.mjs} +0 -0
  450. /package/dist/chunks/{ps-WD5qGAWy.mjs → ps-CTXe6pSe.mjs} +0 -0
  451. /package/dist/chunks/{pt-C4zvLfvq.mjs → pt-B1X4x7d1.mjs} +0 -0
  452. /package/dist/chunks/{ro-DbefHcmM.mjs → ro-Bf7S2FaR.mjs} +0 -0
  453. /package/dist/chunks/{ru-uU1J14jd.mjs → ru-B8lqnu_j.mjs} +0 -0
  454. /package/dist/chunks/{sd-DKu368Ip.mjs → sd-CHRYJm2r.mjs} +0 -0
  455. /package/dist/chunks/{si-BsJCiPkZ.mjs → si-CI0Hs6vH.mjs} +0 -0
  456. /package/dist/chunks/{sk-CD-a3SN6.mjs → sk-Bdvq1Kb_.mjs} +0 -0
  457. /package/dist/chunks/{sl-CXhrPJe_.mjs → sl-B_qiFTV5.mjs} +0 -0
  458. /package/dist/chunks/{sq-CTctCoFQ.mjs → sq-E0j1hysP.mjs} +0 -0
  459. /package/dist/chunks/{sr-BZkhBwXj.mjs → sr-VPpVNTZw.mjs} +0 -0
  460. /package/dist/chunks/{sv-NmRZb_xi.mjs → sv-gKmDSR3d.mjs} +0 -0
  461. /package/dist/chunks/{sw-Be5ik3H6.mjs → sw-zeFLiO23.mjs} +0 -0
  462. /package/dist/chunks/{ta-DsXh6neL.mjs → ta-Ci-j89hR.mjs} +0 -0
  463. /package/dist/chunks/{te-CwpCbM8M.mjs → te-qyMI0M7a.mjs} +0 -0
  464. /package/dist/chunks/{th-CcZ15OLk.mjs → th-DPxHtpdb.mjs} +0 -0
  465. /package/dist/chunks/{tr-q3bTgvhW.mjs → tr-CRV6GS-G.mjs} +0 -0
  466. /package/dist/chunks/{tw-DmW6-pCY.mjs → tw-CqxBf-1Y.mjs} +0 -0
  467. /package/dist/chunks/{ug-919EhLsL.mjs → ug-DW0YFpo5.mjs} +0 -0
  468. /package/dist/chunks/{uk-aNMEzd0Y.mjs → uk-ssteuphK.mjs} +0 -0
  469. /package/dist/chunks/{ur-BwQI77sh.mjs → ur-qhY3-jY7.mjs} +0 -0
  470. /package/dist/chunks/{vi-Dxq806-F.mjs → vi-CHriMMC8.mjs} +0 -0
  471. /package/dist/chunks/{zh-BcHuy1Ti.mjs → zh-BJktawVN.mjs} +0 -0
@@ -1,948 +0,0 @@
1
- import type { API, BlockAPI, BlockTool, BlockToolConstructorOptions, OutputData, ToolboxConfig } from '../../../types';
2
- import type { DatabaseData, DatabaseConfig, DatabaseRow, ViewType, SelectOption, DatabaseViewConfig, PropertyValue } from './types';
3
- import { DatabaseModel } from './database-model';
4
- import { DatabaseBoardView } from './database-board-view';
5
- import { DatabaseListView } from './database-list-view';
6
- import type { DatabaseViewRenderer } from './database-view-renderer';
7
- import { DatabaseBackendSync } from './database-backend-sync';
8
- import { DatabaseCardDrag } from './database-card-drag';
9
- import type { CardDragResult } from './database-card-drag';
10
- import { DatabaseColumnDrag } from './database-column-drag';
11
- import type { GroupDragResult } from './database-column-drag';
12
- import { DatabaseColumnControls } from './database-column-controls';
13
- import { DatabaseListRowDrag } from './database-list-row-drag';
14
- import type { ListRowDragResult } from './database-list-row-drag';
15
- import { DatabaseCardDrawer } from './database-card-drawer';
16
- import { DatabaseKeyboard } from './database-keyboard';
17
- import { DatabaseTabBar } from './database-tab-bar';
18
- import { IconDatabase, IconBoard } from '../../components/icons';
19
- import { nanoid } from 'nanoid';
20
-
21
- /**
22
- * DatabaseTool — a multi-view Kanban board block tool for Blok.
23
- *
24
- * Orchestrates a single DatabaseModel (schema + rows + view configs), DatabaseView (DOM),
25
- * DatabaseBackendSync (adapter), and a DatabaseTabBar for view switching.
26
- */
27
- export class DatabaseTool implements BlockTool {
28
- private readonly api: API;
29
- private readonly block: BlockAPI;
30
- private readonly readOnly: boolean;
31
- private readonly config: DatabaseConfig;
32
-
33
- private activeViewId: string;
34
- private model: DatabaseModel;
35
- private view!: DatabaseViewRenderer;
36
- private sync!: DatabaseBackendSync;
37
-
38
- private element: HTMLDivElement | null = null;
39
- private boardContainer: HTMLDivElement | null = null;
40
- private tabBar: DatabaseTabBar | null = null;
41
-
42
- private cardDrag: DatabaseCardDrag | null = null;
43
- private columnDrag: DatabaseColumnDrag | null = null;
44
- private columnControls: DatabaseColumnControls | null = null;
45
- private listRowDrag: DatabaseListRowDrag | null = null;
46
- private cardDrawer: DatabaseCardDrawer | null = null;
47
- private keyboard: DatabaseKeyboard | null = null;
48
-
49
- constructor({ data, config, api, block, readOnly }: BlockToolConstructorOptions<DatabaseData, DatabaseConfig>) {
50
- this.api = api;
51
- this.block = block;
52
- this.readOnly = readOnly;
53
- this.config = config ?? {};
54
-
55
- this.model = new DatabaseModel(data as DatabaseData | undefined);
56
- const views = this.model.getViews();
57
- this.activeViewId = (data as DatabaseData | undefined)?.activeViewId ?? (views.length > 0 ? views[0].id : '');
58
-
59
- this.activateView(this.activeViewId);
60
- }
61
-
62
- static get toolbox(): ToolboxConfig {
63
- return [
64
- {
65
- icon: IconDatabase,
66
- title: 'Database',
67
- titleKey: 'database',
68
- name: 'database',
69
- searchTerms: ['database', 'kanban', 'board', 'cards', 'columns'],
70
- },
71
- {
72
- icon: IconBoard,
73
- title: 'Board',
74
- titleKey: 'board',
75
- name: 'board',
76
- searchTerms: ['board', 'kanban', 'cards', 'columns', 'database'],
77
- },
78
- ];
79
- }
80
-
81
- static get isReadOnlySupported(): boolean {
82
- return true;
83
- }
84
-
85
- render(): HTMLDivElement {
86
- const wrapper = document.createElement('div');
87
- wrapper.setAttribute('data-blok-tool', 'database');
88
- wrapper.setAttribute('data-blok-database-wrapper', '');
89
- wrapper.style.display = 'flex';
90
- wrapper.style.flexDirection = 'column';
91
- this.element = wrapper;
92
-
93
- if (!this.readOnly) {
94
- this.tabBar = this.createTabBar();
95
- wrapper.appendChild(this.tabBar.render());
96
- }
97
-
98
- const boardContainer = document.createElement('div');
99
- boardContainer.setAttribute('data-blok-database-board-container', '');
100
- boardContainer.style.overflow = 'hidden';
101
- boardContainer.style.position = 'relative';
102
- this.boardContainer = boardContainer;
103
- wrapper.appendChild(boardContainer);
104
-
105
- const boardEl = this.renderActiveView();
106
- boardContainer.appendChild(boardEl);
107
-
108
- if (!this.readOnly) {
109
- this.attachViewListeners(boardEl);
110
- this.initSubsystems(boardEl);
111
- }
112
-
113
- return wrapper;
114
- }
115
-
116
- rendered(): void {
117
- this.block.stretched = true;
118
- if (this.config.adapter !== undefined) {
119
- void this.loadFromBackend();
120
- }
121
- }
122
-
123
- private async loadFromBackend(): Promise<void> {
124
- const data = await this.sync.syncLoadDatabase();
125
-
126
- if (data === undefined) {
127
- return;
128
- }
129
-
130
- this.model.hydrate(data);
131
- const views = this.model.getViews();
132
-
133
- if (views.length > 0 && !views.some((v) => v.id === this.activeViewId)) {
134
- this.activeViewId = views[0].id;
135
- }
136
-
137
- this.rerenderView();
138
- }
139
-
140
- save(_blockContent: HTMLElement): DatabaseData {
141
- return {
142
- ...this.model.snapshot(),
143
- activeViewId: this.activeViewId,
144
- };
145
- }
146
-
147
- validate(savedData: DatabaseData): boolean {
148
- const hasTitleProp = savedData.schema?.some((p) => p.type === 'title') ?? false;
149
- const hasViews = savedData.views !== undefined && savedData.views.length > 0;
150
- const boardViewsValid = savedData.views?.filter((v) => v.type === 'board')
151
- .every((v) => v.groupBy !== undefined) ?? true;
152
- return hasTitleProp && hasViews && boardViewsValid;
153
- }
154
-
155
- destroy(): void {
156
- this.cardDrag?.destroy();
157
- this.columnDrag?.destroy();
158
- this.columnControls?.destroy();
159
- this.listRowDrag?.destroy();
160
- this.listRowDrag = null;
161
- this.cardDrawer?.destroy();
162
- this.keyboard?.destroy();
163
- this.tabBar?.destroy();
164
- this.sync.flushPendingUpdates();
165
- this.sync.destroy();
166
- this.element = null;
167
- this.boardContainer = null;
168
- this.tabBar = null;
169
- }
170
-
171
- // ---------------------------------------------------------------------------
172
- // View management
173
- // ---------------------------------------------------------------------------
174
-
175
- private activateView(viewId: string): void {
176
- const viewConfig = this.model.getView(viewId);
177
-
178
- if (viewConfig === undefined) {
179
- return;
180
- }
181
-
182
- this.activeViewId = viewId;
183
- this.sync = new DatabaseBackendSync(
184
- this.config.adapter,
185
- (error) => {
186
- this.api.notifier.show({
187
- message: String(error),
188
- style: 'error',
189
- });
190
- },
191
- );
192
- }
193
-
194
- private switchView(viewId: string): void {
195
- if (viewId === this.activeViewId || this.boardContainer === null) {
196
- return;
197
- }
198
-
199
- // Destroy per-view subsystems (not cardDrawer)
200
- this.cardDrag?.destroy();
201
- this.columnDrag?.destroy();
202
- this.columnControls?.destroy();
203
- this.listRowDrag?.destroy();
204
- this.keyboard?.destroy();
205
- this.cardDrag = null;
206
- this.columnDrag = null;
207
- this.columnControls = null;
208
- this.listRowDrag = null;
209
- this.keyboard = null;
210
-
211
- this.sync.flushPendingUpdates();
212
- this.sync.destroy();
213
-
214
- this.activateView(viewId);
215
-
216
- this.boardContainer.innerHTML = '';
217
- const newBoardWrapper = this.renderActiveView();
218
- this.boardContainer.appendChild(newBoardWrapper);
219
-
220
- if (!this.readOnly) {
221
- this.attachViewListeners(newBoardWrapper);
222
- this.initSubsystems(newBoardWrapper);
223
- }
224
-
225
- this.rebuildTabBar();
226
- }
227
-
228
- addView(type: ViewType): void {
229
- const statusProp = this.model.getSchema().find((p) => p.type === 'select');
230
- const defaultName = type === 'list' ? 'List' : 'Board';
231
- const newView = this.model.addView(defaultName, type, {
232
- groupBy: type === 'board' ? statusProp?.id : undefined,
233
- });
234
- void this.sync.syncCreateView({ id: newView.id, name: newView.name, type: newView.type, position: newView.position, groupBy: newView.groupBy });
235
- this.switchView(newView.id);
236
- }
237
-
238
- renameView(viewId: string, name: string): void {
239
- this.model.updateView(viewId, { name });
240
- void this.sync.syncUpdateView({ viewId, changes: { name } });
241
- }
242
-
243
- duplicateView(viewId: string): void {
244
- const sourceView = this.model.getView(viewId);
245
-
246
- if (sourceView === undefined) {
247
- return;
248
- }
249
-
250
- const newView = this.model.addView(sourceView.name, sourceView.type, {
251
- groupBy: sourceView.groupBy,
252
- sorts: [...sourceView.sorts],
253
- filters: [...sourceView.filters],
254
- visibleProperties: [...sourceView.visibleProperties],
255
- });
256
- void this.sync.syncCreateView({ id: newView.id, name: newView.name, type: newView.type, position: newView.position, groupBy: newView.groupBy });
257
- this.switchView(newView.id);
258
- }
259
-
260
- deleteView(viewId: string): void {
261
- const views = this.model.getViews();
262
-
263
- if (views.length <= 1) {
264
- return;
265
- }
266
-
267
- const index = views.findIndex((v) => v.id === viewId);
268
-
269
- if (index === -1) {
270
- return;
271
- }
272
-
273
- const wasActive = viewId === this.activeViewId;
274
-
275
- this.model.deleteView(viewId);
276
- void this.sync.syncDeleteView({ viewId });
277
-
278
- if (wasActive) {
279
- const remaining = this.model.getViews();
280
- const neighborIndex = Math.min(index, remaining.length - 1);
281
- this.switchView(remaining[neighborIndex].id);
282
- } else {
283
- this.rebuildTabBar();
284
- }
285
- }
286
-
287
- reorderView(viewId: string, newPosition: string): void {
288
- this.model.updateView(viewId, { position: newPosition });
289
- void this.sync.syncUpdateView({ viewId, changes: { position: newPosition } });
290
- this.rebuildTabBar();
291
- }
292
-
293
- private rebuildTabBar(): void {
294
- if (this.element === null || this.tabBar === null) {
295
- return;
296
- }
297
-
298
- const oldBarEl = this.element.querySelector('[data-blok-database-tab-bar]');
299
-
300
- this.tabBar.destroy();
301
- this.tabBar = this.createTabBar();
302
- const newBarEl = this.tabBar.render();
303
-
304
- if (oldBarEl !== null) {
305
- oldBarEl.replaceWith(newBarEl);
306
- } else {
307
- // Tab bar should be first child (before boardContainer)
308
- this.element.insertBefore(newBarEl, this.boardContainer);
309
- }
310
- }
311
-
312
- private createTabBar(): DatabaseTabBar {
313
- return new DatabaseTabBar({
314
- views: this.model.getViews(),
315
- activeViewId: this.activeViewId,
316
- onTabClick: (viewId) => this.switchView(viewId),
317
- onAddView: (type) => this.addView(type),
318
- onRename: (viewId, name) => this.renameView(viewId, name),
319
- onDuplicate: (viewId) => this.duplicateView(viewId),
320
- onDelete: (viewId) => this.deleteView(viewId),
321
- onReorder: (viewId, newPosition) => this.reorderView(viewId, newPosition),
322
- });
323
- }
324
-
325
- // ---------------------------------------------------------------------------
326
- // Board rendering helpers
327
- // ---------------------------------------------------------------------------
328
-
329
- private renderActiveView(): HTMLDivElement {
330
- const viewConfig = this.model.getView(this.activeViewId);
331
- const titleProp = this.model.getSchema().find((p) => p.type === 'title');
332
- const titlePropId = titleProp?.id ?? '';
333
- const groupByPropId = viewConfig?.groupBy;
334
-
335
- if (viewConfig?.type === 'list') {
336
- return this.renderListView(titlePropId, groupByPropId, viewConfig);
337
- }
338
-
339
- return this.renderBoardView(titlePropId, groupByPropId);
340
- }
341
-
342
- private renderBoardView(titlePropId: string, groupByPropId: string | undefined): HTMLDivElement {
343
- const options = groupByPropId !== undefined ? this.model.getSelectOptions(groupByPropId) : [];
344
- const groups: Map<string, DatabaseRow[]> = groupByPropId !== undefined ? this.model.getRowsGroupedBy(groupByPropId) : new Map<string, DatabaseRow[]>();
345
-
346
- this.view = new DatabaseBoardView({
347
- readOnly: this.readOnly,
348
- i18n: this.api.i18n,
349
- options,
350
- getRows: (optionId) => groups.get(optionId) ?? [],
351
- titlePropertyId: titlePropId,
352
- });
353
-
354
- return this.view.createView();
355
- }
356
-
357
- private renderListView(titlePropId: string, groupByPropId: string | undefined, viewConfig: DatabaseViewConfig): HTMLDivElement {
358
- const schema = this.model.getSchema();
359
-
360
- if (groupByPropId !== undefined) {
361
- const options = this.model.getSelectOptions(groupByPropId);
362
- const groups = this.model.getRowsGroupedBy(groupByPropId);
363
-
364
- this.view = new DatabaseListView({
365
- readOnly: this.readOnly,
366
- i18n: this.api.i18n,
367
- rows: [],
368
- titlePropertyId: titlePropId,
369
- schema,
370
- visiblePropertyIds: viewConfig.visibleProperties,
371
- options,
372
- getRows: (optionId) => groups.get(optionId) ?? [],
373
- });
374
- } else {
375
- this.view = new DatabaseListView({
376
- readOnly: this.readOnly,
377
- i18n: this.api.i18n,
378
- rows: this.model.getOrderedRows(),
379
- titlePropertyId: titlePropId,
380
- schema,
381
- visiblePropertyIds: viewConfig.visibleProperties,
382
- });
383
- }
384
-
385
- return this.view.createView();
386
- }
387
-
388
- // ---------------------------------------------------------------------------
389
- // Event listeners & subsystems
390
- // ---------------------------------------------------------------------------
391
-
392
- /**
393
- * Attaches a single click listener on the board element for event delegation.
394
- */
395
- private attachViewListeners(boardEl: HTMLDivElement): void {
396
- boardEl.addEventListener('click', (event) => {
397
- const target = event.target as HTMLElement;
398
-
399
- const addCardBtn = target.closest('[data-blok-database-add-card]');
400
-
401
- if (addCardBtn !== null) {
402
- const optionId = addCardBtn.getAttribute('data-option-id');
403
-
404
- if (optionId !== null) {
405
- this.handleAddRow(optionId, boardEl);
406
- }
407
-
408
- return;
409
- }
410
-
411
- const addColumnBtn = target.closest('[data-blok-database-add-column]');
412
-
413
- if (addColumnBtn !== null) {
414
- this.handleAddColumn(boardEl);
415
-
416
- return;
417
- }
418
-
419
- const deleteCardBtn = target.closest('[data-blok-database-delete-card]');
420
-
421
- if (deleteCardBtn !== null) {
422
- const rowId = deleteCardBtn.getAttribute('data-row-id');
423
-
424
- if (rowId !== null) {
425
- event.stopPropagation();
426
- this.model.deleteRow(rowId);
427
- this.view.removeRow(boardEl, rowId);
428
- void this.sync.syncDeleteRow({ rowId });
429
- }
430
-
431
- return;
432
- }
433
-
434
- // List: add row
435
- const addRowBtn = target.closest('[data-blok-database-add-row]');
436
-
437
- if (addRowBtn !== null) {
438
- const optionId = addRowBtn.getAttribute('data-option-id');
439
- this.handleAddListRow(optionId, boardEl);
440
- return;
441
- }
442
-
443
- // List: delete row
444
- const deleteRowBtn = target.closest('[data-blok-database-delete-row]');
445
-
446
- if (deleteRowBtn !== null) {
447
- const rowId = deleteRowBtn.getAttribute('data-row-id');
448
-
449
- if (rowId !== null) {
450
- event.stopPropagation();
451
- this.model.deleteRow(rowId);
452
- this.view.removeRow(boardEl, rowId);
453
- void this.sync.syncDeleteRow({ rowId });
454
- }
455
-
456
- return;
457
- }
458
-
459
- // List: row click
460
- const listRowEl = target.closest('[data-blok-database-list-row]');
461
-
462
- if (listRowEl !== null) {
463
- const rowId = listRowEl.getAttribute('data-row-id');
464
-
465
- if (rowId !== null) {
466
- this.handleRowClick(rowId);
467
- }
468
-
469
- return;
470
- }
471
-
472
- const cardEl = target.closest('[data-blok-database-card]');
473
-
474
- if (cardEl !== null) {
475
- const rowId = cardEl.getAttribute('data-row-id');
476
-
477
- if (rowId !== null) {
478
- this.handleRowClick(rowId);
479
- }
480
- }
481
- });
482
- }
483
-
484
- private handleAddListRow(optionId: string | null, viewEl: HTMLDivElement): void {
485
- const titleProp = this.model.getSchema().find((p) => p.type === 'title');
486
- const titlePropId = titleProp?.id ?? '';
487
- const viewConfig = this.model.getView(this.activeViewId);
488
- const groupByPropId = viewConfig?.groupBy;
489
-
490
- const properties: Record<string, PropertyValue> = { [titlePropId]: '' };
491
-
492
- if (groupByPropId !== undefined && optionId !== null) {
493
- properties[groupByPropId] = optionId;
494
- }
495
-
496
- const row = this.model.addRow(properties);
497
- this.view.appendRow(viewEl, row);
498
-
499
- void this.sync.syncCreateRow({
500
- id: row.id,
501
- properties: row.properties,
502
- position: row.position,
503
- });
504
- }
505
-
506
- private handleAddRow(optionId: string, boardEl: HTMLDivElement): void {
507
- const viewConfig = this.model.getView(this.activeViewId);
508
- const groupByPropId = viewConfig?.groupBy;
509
-
510
- if (groupByPropId === undefined) {
511
- return;
512
- }
513
-
514
- const titleProp = this.model.getSchema().find((p) => p.type === 'title');
515
- const titlePropId = titleProp?.id ?? '';
516
- const row = this.model.addRow({
517
- [titlePropId]: '',
518
- [groupByPropId]: optionId,
519
- });
520
-
521
- const columnEl = boardEl.querySelector(`[data-option-id="${optionId}"][data-blok-database-column]`);
522
-
523
- if (columnEl === null) {
524
- return;
525
- }
526
-
527
- const cardsContainer = columnEl.querySelector('[data-blok-database-cards]');
528
-
529
- if (cardsContainer === null) {
530
- return;
531
- }
532
-
533
- this.view.appendRow(cardsContainer as HTMLElement, row);
534
-
535
- void this.sync.syncCreateRow({
536
- id: row.id,
537
- properties: row.properties,
538
- position: row.position,
539
- });
540
- }
541
-
542
- private handleAddColumn(boardEl: HTMLDivElement): void {
543
- const viewConfig = this.model.getView(this.activeViewId);
544
- const groupByPropId = viewConfig?.groupBy;
545
-
546
- if (groupByPropId === undefined) {
547
- return;
548
- }
549
-
550
- const prop = this.model.getProperty(groupByPropId);
551
-
552
- if (prop?.config === undefined) {
553
- return;
554
- }
555
-
556
- const existingOptions = prop.config.options;
557
- const lastPos = existingOptions.length > 0 ? existingOptions[existingOptions.length - 1].position : null;
558
- const newOption: SelectOption = {
559
- id: nanoid(),
560
- label: this.api.i18n.t('tools.database.columnTitlePlaceholder'),
561
- position: DatabaseModel.positionBetween(lastPos, null),
562
- };
563
-
564
- this.model.updateProperty(groupByPropId, {
565
- config: { options: [...existingOptions, newOption] },
566
- });
567
-
568
- this.view.appendGroup?.(boardEl, newOption);
569
- void this.sync.syncUpdateProperty({ propertyId: groupByPropId, changes: { config: { options: [...existingOptions, newOption] } } });
570
- }
571
-
572
- /**
573
- * Initializes all subsystems: card drag, column drag, column controls, card drawer, keyboard.
574
- * boardEl is the current board element for drag/column operations.
575
- * cardDrawer is attached to this.element (outer wrapper) so it persists across view switches.
576
- */
577
- private initSubsystems(boardEl: HTMLDivElement): void {
578
- if (this.element === null) {
579
- return;
580
- }
581
-
582
- const viewConfig = this.model.getView(this.activeViewId);
583
- const isList = viewConfig?.type === 'list';
584
-
585
- const titleProp = this.model.getSchema().find((p) => p.type === 'title');
586
- const titlePropId = titleProp?.id ?? '';
587
- const descriptionProp = this.model.getSchema().find((p) => p.type === 'richText');
588
- const descriptionPropId = descriptionProp?.id;
589
-
590
- if (isList) {
591
- this.listRowDrag = new DatabaseListRowDrag({
592
- wrapper: boardEl,
593
- onDrop: (result) => this.handleListRowDrop(result),
594
- });
595
- } else {
596
- this.cardDrag = new DatabaseCardDrag({
597
- wrapper: boardEl,
598
- onDrop: (result) => this.handleRowDrop(result),
599
- });
600
-
601
- this.columnDrag = new DatabaseColumnDrag({
602
- wrapper: boardEl,
603
- onDrop: (result) => this.handleGroupDrop(result),
604
- });
605
-
606
- this.columnControls = new DatabaseColumnControls({
607
- i18n: this.api.i18n,
608
- onRename: (optionId, label) => this.handleOptionRename(optionId, label),
609
- onDelete: (optionId) => this.handleOptionDelete(optionId, boardEl),
610
- });
611
-
612
- this.makeColumnHeadersEditable(boardEl);
613
- }
614
-
615
- // cardDrawer is attached to outer wrapper so it stays across view switches
616
- if (this.cardDrawer === null) {
617
- this.cardDrawer = new DatabaseCardDrawer({
618
- wrapper: this.element,
619
- readOnly: this.readOnly,
620
- i18n: this.api.i18n,
621
- toolsConfig: this.api.tools.getToolsConfig(),
622
- titlePropertyId: titlePropId,
623
- descriptionPropertyId: descriptionPropId,
624
- schema: this.model.getSchema(),
625
- onTitleChange: (rowId, title) => {
626
- this.model.updateRow(rowId, { [titlePropId]: title });
627
- const currentView = this.boardContainer?.querySelector<HTMLElement>('[data-blok-database-board]')
628
- ?? this.boardContainer?.querySelector<HTMLElement>('[data-blok-database-list]');
629
-
630
- if (currentView !== null && currentView !== undefined) {
631
- this.view.updateRowTitle(currentView, rowId, title);
632
- }
633
-
634
- this.sync.syncUpdateRow({ rowId, properties: { [titlePropId]: title } });
635
- },
636
- onDescriptionChange: (rowId, description: OutputData) => {
637
- if (descriptionPropId !== undefined) {
638
- this.model.updateRow(rowId, { [descriptionPropId]: description });
639
- this.sync.syncUpdateRow({ rowId, properties: { [descriptionPropId]: description } });
640
- }
641
- },
642
- onClose: () => { /* no-op; drawer handles its own DOM cleanup */ },
643
- onAddProperty: (type) => {
644
- const prop = this.model.addProperty('Property', type);
645
- void this.sync.syncCreateProperty({
646
- id: prop.id,
647
- name: prop.name,
648
- type: prop.type,
649
- position: prop.position,
650
- });
651
- this.cardDrawer?.refreshSchema(this.model.getSchema());
652
- },
653
- });
654
- }
655
-
656
- this.keyboard = new DatabaseKeyboard({
657
- wrapper: boardEl,
658
- onEscape: () => {
659
- if (this.cardDrawer?.isOpen) {
660
- this.cardDrawer.close();
661
-
662
- return true;
663
- }
664
-
665
- return false;
666
- },
667
- });
668
- this.keyboard.attach();
669
-
670
- boardEl.addEventListener('pointerdown', (e) => {
671
- const target = e.target as HTMLElement;
672
-
673
- // Board: column header drag
674
- const columnHeader = target.closest('[data-blok-database-column-header]');
675
-
676
- if (columnHeader !== null) {
677
- const columnEl = columnHeader.closest<HTMLElement>('[data-blok-database-column]');
678
- const optId = columnEl?.getAttribute('data-option-id') ?? null;
679
-
680
- if (optId !== null) {
681
- e.preventDefault();
682
- e.stopPropagation();
683
- this.columnDrag?.beginTracking(optId, e.clientX, e.clientY);
684
- }
685
-
686
- return;
687
- }
688
-
689
- // Board: card drag
690
- const cardEl = target.closest('[data-blok-database-card]');
691
-
692
- if (cardEl !== null) {
693
- const rowId = cardEl.getAttribute('data-row-id');
694
-
695
- if (rowId !== null) {
696
- e.preventDefault();
697
- e.stopPropagation();
698
- this.cardDrag?.beginTracking(rowId, e.clientX, e.clientY);
699
- }
700
-
701
- return;
702
- }
703
-
704
- // List: row drag
705
- const listRowEl = target.closest('[data-blok-database-list-row]');
706
-
707
- if (listRowEl !== null) {
708
- const rowId = listRowEl.getAttribute('data-row-id');
709
-
710
- if (rowId !== null) {
711
- e.preventDefault();
712
- e.stopPropagation();
713
- this.listRowDrag?.beginTracking(rowId, e.clientX, e.clientY);
714
- }
715
- }
716
- });
717
- }
718
-
719
- private makeColumnHeadersEditable(boardEl: HTMLDivElement): void {
720
- if (this.columnControls === null) {
721
- return;
722
- }
723
-
724
- const headers = Array.from(boardEl.querySelectorAll<HTMLElement>('[data-blok-database-column-header]'));
725
-
726
- for (const header of headers) {
727
- const columnEl = header.closest<HTMLElement>('[data-blok-database-column]');
728
- const optId = columnEl?.getAttribute('data-option-id');
729
-
730
- if (optId !== null && optId !== undefined) {
731
- this.columnControls.makeEditable(header, optId);
732
- }
733
- }
734
- }
735
-
736
- private handleListRowDrop(result: ListRowDragResult): void {
737
- const { rowId, beforeRowId, afterRowId } = result;
738
-
739
- const beforeRow = beforeRowId !== null ? this.model.getRow(beforeRowId) : undefined;
740
- const afterRow = afterRowId !== null ? this.model.getRow(afterRowId) : undefined;
741
- const position = DatabaseModel.positionBetween(afterRow?.position ?? null, beforeRow?.position ?? null);
742
-
743
- this.model.moveRow(rowId, position);
744
- this.rerenderView();
745
-
746
- void this.sync.syncMoveRow({ rowId, position });
747
- }
748
-
749
- private handleRowDrop(result: CardDragResult): void {
750
- const { rowId, toOptionId, beforeRowId, afterRowId } = result;
751
- const viewConfig = this.model.getView(this.activeViewId);
752
- const groupByPropId = viewConfig?.groupBy;
753
-
754
- if (groupByPropId === undefined) {
755
- return;
756
- }
757
-
758
- const beforeRow = beforeRowId !== null ? this.model.getRow(beforeRowId) : undefined;
759
- const afterRow = afterRowId !== null ? this.model.getRow(afterRowId) : undefined;
760
- const position = DatabaseModel.positionBetween(afterRow?.position ?? null, beforeRow?.position ?? null);
761
-
762
- this.model.updateRow(rowId, { [groupByPropId]: toOptionId });
763
- this.model.moveRow(rowId, position);
764
- this.rerenderView();
765
-
766
- this.sync.syncUpdateRow({ rowId, properties: { [groupByPropId]: toOptionId } });
767
- void this.sync.syncMoveRow({ rowId, position });
768
- }
769
-
770
- private handleGroupDrop(result: GroupDragResult): void {
771
- const { optionId, beforeOptionId, afterOptionId } = result;
772
- const viewConfig = this.model.getView(this.activeViewId);
773
- const groupByPropId = viewConfig?.groupBy;
774
-
775
- if (groupByPropId === undefined) {
776
- return;
777
- }
778
-
779
- const prop = this.model.getProperty(groupByPropId);
780
-
781
- if (prop?.config === undefined) {
782
- return;
783
- }
784
-
785
- const options = [...prop.config.options];
786
- const draggedIdx = options.findIndex((o) => o.id === optionId);
787
-
788
- if (draggedIdx === -1) {
789
- return;
790
- }
791
-
792
- const beforeOpt = beforeOptionId !== null ? options.find((o) => o.id === beforeOptionId) : undefined;
793
- const afterOpt = afterOptionId !== null ? options.find((o) => o.id === afterOptionId) : undefined;
794
- const newPosition = DatabaseModel.positionBetween(afterOpt?.position ?? null, beforeOpt?.position ?? null);
795
-
796
- options[draggedIdx] = { ...options[draggedIdx], position: newPosition };
797
- this.model.updateProperty(groupByPropId, { config: { options } });
798
-
799
- this.moveColumnInDom(optionId, beforeOptionId);
800
- void this.sync.syncUpdateProperty({ propertyId: groupByPropId, changes: { config: { options } } });
801
- }
802
-
803
- /**
804
- * Moves a column element to a new position in the DOM without full re-render.
805
- */
806
- private moveColumnInDom(optionId: string, beforeOptionId: string | null): void {
807
- const boardEl = this.boardContainer?.querySelector<HTMLElement>('[data-blok-database-board]');
808
-
809
- if (boardEl === null || boardEl === undefined) {
810
- return;
811
- }
812
-
813
- const columnEl = boardEl.querySelector<HTMLElement>(`[data-option-id="${optionId}"]`);
814
-
815
- if (columnEl === null) {
816
- return;
817
- }
818
-
819
- if (beforeOptionId !== null) {
820
- const beforeEl = boardEl.querySelector(`[data-option-id="${beforeOptionId}"]`);
821
-
822
- if (beforeEl !== null) {
823
- boardEl.insertBefore(columnEl, beforeEl);
824
- }
825
- } else {
826
- const addColumnBtn = boardEl.querySelector('[data-blok-database-add-column]');
827
-
828
- if (addColumnBtn !== null) {
829
- boardEl.insertBefore(columnEl, addColumnBtn);
830
- } else {
831
- boardEl.appendChild(columnEl);
832
- }
833
- }
834
- }
835
-
836
- private handleOptionRename(optionId: string, label: string): void {
837
- const viewConfig = this.model.getView(this.activeViewId);
838
- const groupByPropId = viewConfig?.groupBy;
839
-
840
- if (groupByPropId === undefined) {
841
- return;
842
- }
843
-
844
- const prop = this.model.getProperty(groupByPropId);
845
-
846
- if (prop?.config === undefined) {
847
- return;
848
- }
849
-
850
- const options = prop.config.options.map((o) => o.id === optionId ? { ...o, label } : o);
851
- this.model.updateProperty(groupByPropId, { config: { options } });
852
- void this.sync.syncUpdateProperty({ propertyId: groupByPropId, changes: { config: { options } } });
853
- }
854
-
855
- private handleOptionDelete(optionId: string, boardEl: HTMLDivElement): void {
856
- const viewConfig = this.model.getView(this.activeViewId);
857
- const groupByPropId = viewConfig?.groupBy;
858
-
859
- if (groupByPropId === undefined) {
860
- return;
861
- }
862
-
863
- const prop = this.model.getProperty(groupByPropId);
864
-
865
- if (prop?.config === undefined) {
866
- return;
867
- }
868
-
869
- if (prop.config.options.length <= 1) {
870
- return;
871
- }
872
-
873
- // Delete rows in this group
874
- const groups = this.model.getRowsGroupedBy(groupByPropId);
875
- const rowsInGroup = groups.get(optionId) ?? [];
876
-
877
- for (const row of rowsInGroup) {
878
- this.model.deleteRow(row.id);
879
- void this.sync.syncDeleteRow({ rowId: row.id });
880
- }
881
-
882
- // Remove the option
883
- const filteredOptions = prop.config.options.filter((o) => o.id !== optionId);
884
- this.model.updateProperty(groupByPropId, { config: { options: filteredOptions } });
885
- this.view.removeGroup?.(boardEl, optionId);
886
- void this.sync.syncUpdateProperty({ propertyId: groupByPropId, changes: { config: { options: filteredOptions } } });
887
- }
888
-
889
- private handleRowClick(rowId: string): void {
890
- const row = this.model.getRow(rowId);
891
-
892
- if (row === undefined) {
893
- return;
894
- }
895
-
896
- this.cardDrawer?.open(row);
897
- }
898
-
899
- /**
900
- * Full re-render of the active board: tears down subsystems, rebuilds DOM, re-inits.
901
- *
902
- * Board DOM structure:
903
- * boardContainer
904
- * boardWrapper (div returned by createBoard / renderActiveBoard)
905
- * boardArea ([data-blok-database-board] — scrollable area with columns)
906
- */
907
- private rerenderView(): void {
908
- if (this.boardContainer === null) {
909
- return;
910
- }
911
-
912
- // The old board wrapper is the first/only direct child of boardContainer
913
- const oldBoardWrapper = this.boardContainer.querySelector<HTMLElement>('[data-blok-database-board]')
914
- ?.closest<HTMLElement>('[data-blok-tool]')
915
- ?? this.boardContainer.querySelector<HTMLElement>('[data-blok-database-list]')
916
- ?? this.boardContainer.firstElementChild as HTMLElement | null;
917
-
918
- const oldBoardArea = this.boardContainer.querySelector<HTMLElement>('[data-blok-database-board]');
919
- const savedScrollLeft = oldBoardArea?.scrollLeft ?? 0;
920
-
921
- this.cardDrag?.destroy();
922
- this.columnDrag?.destroy();
923
- this.columnControls?.destroy();
924
- this.listRowDrag?.destroy();
925
- this.listRowDrag = null;
926
- this.cardDrawer?.destroy();
927
- this.cardDrawer = null;
928
- this.keyboard?.destroy();
929
-
930
- const newBoardWrapper = this.renderActiveView();
931
-
932
- if (oldBoardWrapper !== null && oldBoardWrapper !== undefined) {
933
- oldBoardWrapper.replaceWith(newBoardWrapper);
934
- } else {
935
- this.boardContainer.appendChild(newBoardWrapper);
936
- }
937
-
938
- // Restore horizontal scroll on the new board area
939
- const newBoardArea = newBoardWrapper.querySelector<HTMLElement>('[data-blok-database-board]');
940
-
941
- if (newBoardArea !== null) {
942
- newBoardArea.scrollLeft = savedScrollLeft;
943
- }
944
-
945
- this.attachViewListeners(newBoardWrapper);
946
- this.initSubsystems(newBoardWrapper);
947
- }
948
- }