@jackuait/blok 0.10.0-beta.4 → 0.10.0-beta.6

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 (355) hide show
  1. package/dist/blok.mjs +3 -3
  2. package/dist/chunks/{blok-D_0qAdUd.mjs → blok-BdlR_lX6.mjs} +2073 -2034
  3. package/dist/chunks/chunk-Byubey_H.mjs +20 -0
  4. package/dist/chunks/{constants-DxSXr7kd.mjs → constants-Cp8O0UfP.mjs} +524 -550
  5. package/dist/chunks/default-DIfXCS2E.mjs +4 -0
  6. package/dist/chunks/{i18next-G6FKbZqA.mjs → i18next-KNC_XV5x.mjs} +1 -1
  7. package/dist/chunks/{i18next-loader-CwNimni3.mjs → i18next-loader-oDO9ZKUV.mjs} +2 -2
  8. package/dist/chunks/katex-NjLaA6AJ.mjs +22026 -0
  9. package/dist/chunks/{lightweight-i18n-DWCdzAw0.mjs → lightweight-i18n-DTySD6f6.mjs} +16 -18
  10. package/dist/chunks/mdast-util-math-yS0EygZV.mjs +151 -0
  11. package/dist/{messages-DVQNjdPk.mjs → chunks/messages-5ArOv8cj.mjs} +3 -17
  12. package/dist/chunks/{messages-Czny5pPT2.mjs → messages-876bKyUj2.mjs} +3 -17
  13. package/dist/{messages-JhoVMjfX2.mjs → chunks/messages-9l49jauY.mjs} +3 -17
  14. package/dist/{messages-D3cAcyzj.mjs → chunks/messages-B5aAzExz.mjs} +3 -17
  15. package/dist/chunks/{messages-CmrMwBv3.mjs → messages-B5fKJXd6.mjs} +3 -17
  16. package/dist/chunks/{messages-DBpXyvRe2.mjs → messages-B9N__q552.mjs} +3 -17
  17. package/dist/{messages-CVcQD-9u.mjs → chunks/messages-BAP2OAQk.mjs} +3 -17
  18. package/dist/chunks/{messages-R2W_rGOo2.mjs → messages-BDXl53cy2.mjs} +3 -17
  19. package/dist/{messages-CM5fsPo02.mjs → chunks/messages-BGCQCeWd.mjs} +3 -17
  20. package/dist/{messages-DtrSrdfE2.mjs → chunks/messages-BHhbHLoq.mjs} +3 -17
  21. package/dist/{messages-C6Y4Jv2N.mjs → chunks/messages-BMq9k_lI.mjs} +3 -17
  22. package/dist/{messages-DjJQoYvP2.mjs → chunks/messages-BXSXk3oS2.mjs} +3 -17
  23. package/dist/{messages-pgPcitDH.mjs → chunks/messages-BXn9Vzbx2.mjs} +3 -17
  24. package/dist/chunks/{messages-DR09nkcZ.mjs → messages-BaoJwsEZ.mjs} +3 -17
  25. package/dist/{messages-CdlsTFB1.mjs → chunks/messages-BbfLRqLh2.mjs} +3 -17
  26. package/dist/{messages-BvgTQLf72.mjs → chunks/messages-BhcYsC_M2.mjs} +3 -17
  27. package/dist/chunks/{messages-Cdx4QMR1.mjs → messages-BlO_37l_.mjs} +3 -17
  28. package/dist/{messages--S8_taOd2.mjs → chunks/messages-BlcRm2I3.mjs} +3 -17
  29. package/dist/{messages-DbxbxUiK2.mjs → chunks/messages-Btr121zI2.mjs} +3 -17
  30. package/dist/chunks/{messages-p4byLfvR.mjs → messages-BxBID_0B.mjs} +3 -17
  31. package/dist/chunks/{messages-Cs9XBt4T.mjs → messages-ByAqzAhB.mjs} +3 -17
  32. package/dist/chunks/{messages-JQKFJo7C.mjs → messages-C-jA6Rf7.mjs} +3 -17
  33. package/dist/{messages-BAcH6PtT2.mjs → chunks/messages-C5aCWL7B.mjs} +3 -17
  34. package/dist/{messages-BCG_evLg.mjs → chunks/messages-CF_PfacZ.mjs} +3 -17
  35. package/dist/{messages-B-4fku2H2.mjs → chunks/messages-CKRJDX0K2.mjs} +3 -17
  36. package/dist/chunks/{messages-CrMfiGu5.mjs → messages-CL3mCbi6.mjs} +3 -17
  37. package/dist/chunks/{messages-BnznaKEP2.mjs → messages-CNEJxD8q2.mjs} +3 -17
  38. package/dist/{messages-hTpeKUaW.mjs → chunks/messages-CZ5Sbf8U.mjs} +3 -17
  39. package/dist/chunks/{messages-CljStrYi.mjs → messages-CcyIKgGU.mjs} +3 -17
  40. package/dist/{messages-Dcyrzdxa2.mjs → chunks/messages-CdzF0Hvl.mjs} +3 -17
  41. package/dist/chunks/{messages-IDEUsFhQ2.mjs → messages-CgedvWCf.mjs} +3 -17
  42. package/dist/chunks/{messages-CmXADeab2.mjs → messages-CjVPwkVy.mjs} +3 -17
  43. package/dist/chunks/{messages-wLSVQbsA2.mjs → messages-CnQydQJd2.mjs} +3 -17
  44. package/dist/chunks/{messages-BS1nOvZ-.mjs → messages-CqgEz7C5.mjs} +3 -17
  45. package/dist/{messages-BCuTVHBV.mjs → chunks/messages-CvlMT1e62.mjs} +3 -17
  46. package/dist/{messages-CYX48nfg.mjs → chunks/messages-CyxDkx8a.mjs} +3 -17
  47. package/dist/chunks/{messages-ClRHDxzh.mjs → messages-D7n_wJK7.mjs} +3 -17
  48. package/dist/chunks/{messages-Dplnp19q.mjs → messages-D8-N0FmU.mjs} +3 -17
  49. package/dist/chunks/{messages-DAVsuDWh2.mjs → messages-D8dKkyII2.mjs} +3 -17
  50. package/dist/chunks/{messages-B3s2vra72.mjs → messages-DGD6BiGd.mjs} +3 -17
  51. package/dist/chunks/{messages-DHCVA7XQ.mjs → messages-DJO0ERQT.mjs} +3 -17
  52. package/dist/chunks/{messages-B7MIRzCa2.mjs → messages-DMyRdafk2.mjs} +3 -17
  53. package/dist/chunks/{messages-C-b6tPad2.mjs → messages-DN-194c32.mjs} +3 -17
  54. package/dist/chunks/{messages-BW_7lfqG2.mjs → messages-DQ5ng0_t2.mjs} +3 -17
  55. package/dist/{messages-DUBHHfEt.mjs → chunks/messages-DRv4g-IA.mjs} +3 -17
  56. package/dist/chunks/{messages-xfjdrZmx.mjs → messages-DSO2U-ul.mjs} +3 -17
  57. package/dist/{messages-CgzbJ8_l2.mjs → chunks/messages-DUGEqDEG.mjs} +3 -17
  58. package/dist/{messages-DA-o8X3A.mjs → chunks/messages-DVKifYlq.mjs} +3 -17
  59. package/dist/{messages-tsHpMdDT2.mjs → chunks/messages-DWD0ry9x.mjs} +3 -17
  60. package/dist/{messages-Dddxv8-f2.mjs → chunks/messages-DYizZHT2.mjs} +3 -17
  61. package/dist/chunks/{messages-Csvm4mtA.mjs → messages-DZwCufSb.mjs} +3 -17
  62. package/dist/{messages-BJ7BuFZi.mjs → chunks/messages-DdmWzF5M.mjs} +3 -17
  63. package/dist/{messages-Bo_FUvVH.mjs → chunks/messages-DgEGJECT.mjs} +3 -17
  64. package/dist/chunks/{messages-Bpda_3PM2.mjs → messages-Dgng6KN8.mjs} +3 -17
  65. package/dist/{messages-CBzd_x7H.mjs → chunks/messages-DkTxBa1V.mjs} +3 -17
  66. package/dist/{messages-Bio7KYsr2.mjs → chunks/messages-DnJHflSh.mjs} +3 -17
  67. package/dist/{messages-CjmSrt1D.mjs → chunks/messages-DopbvJlg.mjs} +3 -17
  68. package/dist/{messages-DIRha_gg2.mjs → chunks/messages-Dux1S0-D2.mjs} +3 -17
  69. package/dist/chunks/{messages-1Raf1IK82.mjs → messages-Dw2rmKMi2.mjs} +3 -17
  70. package/dist/chunks/{messages-D5IgUbBD2.mjs → messages-Dz3UhEco2.mjs} +3 -17
  71. package/dist/{messages-C6OJvnJg2.mjs → chunks/messages-FYl9woii2.mjs} +3 -17
  72. package/dist/{messages-BBvDbp62.mjs → chunks/messages-Jps5Tc77.mjs} +3 -17
  73. package/dist/chunks/{messages-Dfpi8pDY.mjs → messages-NJsvFwJj.mjs} +3 -17
  74. package/dist/chunks/{messages-DPykxECP2.mjs → messages-SSDr5fGF2.mjs} +3 -17
  75. package/dist/{messages-BXI3qIos.mjs → chunks/messages-bmwto4UV.mjs} +3 -17
  76. package/dist/{messages-CBdQ3XP9.mjs → chunks/messages-vN4T4r67.mjs} +3 -17
  77. package/dist/{messages-tK67CBqn.mjs → chunks/messages-yszqJukE.mjs} +3 -17
  78. package/dist/chunks/micromark-extension-math-CCEGWpdz.mjs +169 -0
  79. package/dist/chunks/micromark-factory-space-WwmyBO_J.mjs +36 -0
  80. package/dist/chunks/{notifier-Butv4Dvo.mjs → notifier-BOwxj_Ok.mjs} +1 -1
  81. package/dist/chunks/{objectSpread2-BY4mgzrQ.mjs → objectSpread2-CWwMYL_U.mjs} +1 -1
  82. package/dist/chunks/{tools-DVZ3zU40.mjs → tools-DGOsJbHH.mjs} +1816 -2916
  83. package/dist/full.mjs +14 -14
  84. package/dist/locales.mjs +82 -84
  85. package/dist/markdown.mjs +3962 -0
  86. package/dist/{messages-DqyqEw1_.mjs → messages--cUQf9JX.mjs} +3 -17
  87. package/dist/{messages-BtxaN-xx.mjs → messages-12_eyAo-.mjs} +3 -17
  88. package/dist/{chunks/messages-LxumrNue2.mjs → messages-B3Yhiycb2.mjs} +3 -17
  89. package/dist/{chunks/messages-Cqc-6rfh2.mjs → messages-B4lhNMKm2.mjs} +3 -17
  90. package/dist/{chunks/messages-B0ffBqzr.mjs → messages-BOE2mzCj2.mjs} +3 -17
  91. package/dist/{chunks/messages-BaPZuLjN.mjs → messages-BPL7riv-.mjs} +3 -17
  92. package/dist/{messages-DD5pW0zJ.mjs → messages-BYQ769S5.mjs} +3 -17
  93. package/dist/{chunks/messages-C11byid72.mjs → messages-B_sKqaeK.mjs} +3 -17
  94. package/dist/{messages-BmNaAyKS.mjs → messages-Bdk4ocMI.mjs} +3 -17
  95. package/dist/{chunks/messages-6mikOS4D2.mjs → messages-BeI2HORe2.mjs} +3 -17
  96. package/dist/{chunks/messages-u2yxkNTE2.mjs → messages-Bug6Du35.mjs} +3 -17
  97. package/dist/{messages-eTourT12.mjs → messages-C2veeQpU.mjs} +3 -17
  98. package/dist/{messages-BokEflKa.mjs → messages-C5Uufygq.mjs} +3 -17
  99. package/dist/{chunks/messages-BPog17132.mjs → messages-C8f1I5EQ2.mjs} +3 -17
  100. package/dist/{chunks/messages-ID1PHnMv.mjs → messages-CBPiFbEf2.mjs} +3 -17
  101. package/dist/{messages-DZEcrbmH.mjs → messages-CByBLxWk.mjs} +3 -17
  102. package/dist/{chunks/messages-BgVEGd4c.mjs → messages-CD8K1g_t2.mjs} +3 -17
  103. package/dist/{messages-Dkg99bfr2.mjs → messages-CEEzfqMO2.mjs} +3 -17
  104. package/dist/{messages-DV9e1DW7.mjs → messages-CNNcKuGH.mjs} +3 -17
  105. package/dist/{messages-C30Vz-UZ2.mjs → messages-CSl0Wla62.mjs} +3 -17
  106. package/dist/{messages-fLi0P2dP.mjs → messages-CUzBNjnc.mjs} +3 -17
  107. package/dist/{chunks/messages-DJA6fb_P2.mjs → messages-CWEL1WDy2.mjs} +3 -17
  108. package/dist/{messages-BcFQFcJ92.mjs → messages-C_HmWyXc2.mjs} +3 -17
  109. package/dist/{chunks/messages-CpzO7KRA.mjs → messages-Cb3wXGnc.mjs} +3 -17
  110. package/dist/{messages-C5XPUD9T2.mjs → messages-Cd23UgLV2.mjs} +3 -17
  111. package/dist/{chunks/messages-DSjXen8E.mjs → messages-Cg1CF4pw.mjs} +3 -17
  112. package/dist/{messages-i4S6q64n2.mjs → messages-CgEDVri-2.mjs} +3 -17
  113. package/dist/{messages-CHJ5SOZI.mjs → messages-ChTWmxS8.mjs} +3 -17
  114. package/dist/{messages-BVKZK-3t.mjs → messages-Cho2VTAX.mjs} +3 -17
  115. package/dist/{chunks/messages-d0Ky6QjR.mjs → messages-CkySRhtd2.mjs} +3 -17
  116. package/dist/{chunks/messages-C1OqT_nL.mjs → messages-Clsh86WQ.mjs} +3 -17
  117. package/dist/{chunks/messages-BrFl5773.mjs → messages-CsiGzUSP2.mjs} +3 -17
  118. package/dist/{messages-BKjqW08U.mjs → messages-Cv-DKlZd.mjs} +3 -17
  119. package/dist/{messages-BGsDZTQp2.mjs → messages-CvvbLyTy2.mjs} +3 -17
  120. package/dist/{chunks/messages-DA7Zk-Cy.mjs → messages-CwCEcbWG.mjs} +3 -17
  121. package/dist/{chunks/messages-DQ5AyNCU.mjs → messages-D38h5XlF.mjs} +3 -17
  122. package/dist/{chunks/messages-DC7TX-YT.mjs → messages-D7juvhHp.mjs} +3 -17
  123. package/dist/{chunks/messages-BdnSVKOw.mjs → messages-D8WvwU42.mjs} +3 -17
  124. package/dist/{chunks/messages-Df87zXXG.mjs → messages-DACg1XAu.mjs} +3 -17
  125. package/dist/{messages-BBq0M604.mjs → messages-DIKCwGog.mjs} +3 -17
  126. package/dist/{messages-Ccd587Yn.mjs → messages-DJU4YLij.mjs} +3 -17
  127. package/dist/{chunks/messages-Dm4YVlrm.mjs → messages-DQN1y6E9.mjs} +3 -17
  128. package/dist/{messages-CqkRG9mH.mjs → messages-DRU_IgoW.mjs} +3 -17
  129. package/dist/{chunks/messages-DT7fRpCy.mjs → messages-DbZsJAff.mjs} +3 -17
  130. package/dist/{messages-upqrRZQH2.mjs → messages-Dg2CDXZi2.mjs} +3 -17
  131. package/dist/{messages-DJKLtW7u.mjs → messages-Dj79y02X.mjs} +3 -17
  132. package/dist/{chunks/messages-Ct7AMBS82.mjs → messages-DjWfVYHS2.mjs} +3 -17
  133. package/dist/{chunks/messages-B2pW6jO_.mjs → messages-DkvQ-6HC2.mjs} +3 -17
  134. package/dist/{chunks/messages-ZJ0b1C3a.mjs → messages-DnhEzmXJ2.mjs} +3 -17
  135. package/dist/{chunks/messages-BgsPQXfP.mjs → messages-DqJTZbwt.mjs} +3 -17
  136. package/dist/{chunks/messages-DUDgFEEe2.mjs → messages-Dq_v7slw2.mjs} +3 -17
  137. package/dist/{chunks/messages-CyNsByCY.mjs → messages-En8LDjUB.mjs} +3 -17
  138. package/dist/{chunks/messages-FHrCEJmY2.mjs → messages-JK9Okzsy2.mjs} +3 -17
  139. package/dist/{messages-DnatBKPm.mjs → messages-KSxF8eib.mjs} +3 -17
  140. package/dist/{chunks/messages-DD7BI6BK.mjs → messages-KbYSpNrE.mjs} +3 -17
  141. package/dist/{messages-BvgXeMSL2.mjs → messages-KqWQKmIu2.mjs} +3 -17
  142. package/dist/{messages-BSe3QDnQ.mjs → messages-PvMdmlxI.mjs} +3 -17
  143. package/dist/{chunks/messages-DJkIeapn.mjs → messages-So3SHdIc2.mjs} +3 -17
  144. package/dist/{messages-BywbKcPC.mjs → messages-X80Nh0ib.mjs} +3 -17
  145. package/dist/{messages-DOTJ2NvJ.mjs → messages-hrSlVSHp.mjs} +3 -17
  146. package/dist/{messages-DJT4Bt_02.mjs → messages-mipkPgwQ2.mjs} +3 -17
  147. package/dist/{messages-xEI8gEDK.mjs → messages-nOe1gJYu.mjs} +3 -17
  148. package/dist/{messages-Bk984gRE2.mjs → messages-rbox5gSb2.mjs} +3 -17
  149. package/dist/{chunks/messages-CgRvtOEY.mjs → messages-uCsQjz7M.mjs} +3 -17
  150. package/dist/{chunks/messages-BbdNugdi.mjs → messages-vcoib5Ga.mjs} +3 -17
  151. package/dist/{chunks/messages-CvfKofOP.mjs → messages-vptt-pVF.mjs} +3 -17
  152. package/dist/{chunks/messages-BkCjgGxc.mjs → messages-x353UCBI.mjs} +3 -17
  153. package/dist/react.mjs +3 -3
  154. package/dist/tools.mjs +3 -3
  155. package/dist/vendor.LICENSE.txt +1622 -182
  156. package/package.json +15 -2
  157. package/src/components/blocks.ts +26 -1
  158. package/src/components/i18n/locales/am/messages.json +3 -17
  159. package/src/components/i18n/locales/ar/messages.json +3 -17
  160. package/src/components/i18n/locales/az/messages.json +3 -17
  161. package/src/components/i18n/locales/bg/messages.json +3 -17
  162. package/src/components/i18n/locales/bn/messages.json +3 -17
  163. package/src/components/i18n/locales/bs/messages.json +3 -17
  164. package/src/components/i18n/locales/cs/messages.json +3 -17
  165. package/src/components/i18n/locales/da/messages.json +3 -17
  166. package/src/components/i18n/locales/de/messages.json +3 -17
  167. package/src/components/i18n/locales/dv/messages.json +3 -17
  168. package/src/components/i18n/locales/el/messages.json +3 -17
  169. package/src/components/i18n/locales/en/messages.json +15 -17
  170. package/src/components/i18n/locales/es/messages.json +3 -17
  171. package/src/components/i18n/locales/et/messages.json +3 -17
  172. package/src/components/i18n/locales/fa/messages.json +3 -17
  173. package/src/components/i18n/locales/fi/messages.json +3 -17
  174. package/src/components/i18n/locales/fil/messages.json +3 -17
  175. package/src/components/i18n/locales/fr/messages.json +3 -17
  176. package/src/components/i18n/locales/gu/messages.json +3 -17
  177. package/src/components/i18n/locales/he/messages.json +3 -17
  178. package/src/components/i18n/locales/hi/messages.json +3 -17
  179. package/src/components/i18n/locales/hr/messages.json +3 -17
  180. package/src/components/i18n/locales/hu/messages.json +3 -17
  181. package/src/components/i18n/locales/hy/messages.json +3 -17
  182. package/src/components/i18n/locales/id/messages.json +3 -17
  183. package/src/components/i18n/locales/it/messages.json +3 -17
  184. package/src/components/i18n/locales/ja/messages.json +3 -17
  185. package/src/components/i18n/locales/ka/messages.json +3 -17
  186. package/src/components/i18n/locales/km/messages.json +3 -17
  187. package/src/components/i18n/locales/kn/messages.json +3 -17
  188. package/src/components/i18n/locales/ko/messages.json +3 -17
  189. package/src/components/i18n/locales/ku/messages.json +3 -17
  190. package/src/components/i18n/locales/lo/messages.json +3 -17
  191. package/src/components/i18n/locales/lt/messages.json +3 -17
  192. package/src/components/i18n/locales/lv/messages.json +3 -17
  193. package/src/components/i18n/locales/mk/messages.json +3 -17
  194. package/src/components/i18n/locales/ml/messages.json +3 -17
  195. package/src/components/i18n/locales/mn/messages.json +3 -17
  196. package/src/components/i18n/locales/mr/messages.json +3 -17
  197. package/src/components/i18n/locales/ms/messages.json +3 -17
  198. package/src/components/i18n/locales/my/messages.json +3 -17
  199. package/src/components/i18n/locales/ne/messages.json +3 -17
  200. package/src/components/i18n/locales/nl/messages.json +3 -17
  201. package/src/components/i18n/locales/no/messages.json +3 -17
  202. package/src/components/i18n/locales/pa/messages.json +3 -17
  203. package/src/components/i18n/locales/pl/messages.json +3 -17
  204. package/src/components/i18n/locales/ps/messages.json +3 -17
  205. package/src/components/i18n/locales/pt/messages.json +3 -17
  206. package/src/components/i18n/locales/ro/messages.json +3 -17
  207. package/src/components/i18n/locales/ru/messages.json +3 -17
  208. package/src/components/i18n/locales/sd/messages.json +3 -17
  209. package/src/components/i18n/locales/si/messages.json +3 -17
  210. package/src/components/i18n/locales/sk/messages.json +3 -17
  211. package/src/components/i18n/locales/sl/messages.json +3 -17
  212. package/src/components/i18n/locales/sq/messages.json +3 -17
  213. package/src/components/i18n/locales/sr/messages.json +3 -17
  214. package/src/components/i18n/locales/sv/messages.json +3 -17
  215. package/src/components/i18n/locales/sw/messages.json +3 -17
  216. package/src/components/i18n/locales/ta/messages.json +3 -17
  217. package/src/components/i18n/locales/te/messages.json +3 -17
  218. package/src/components/i18n/locales/th/messages.json +3 -17
  219. package/src/components/i18n/locales/tr/messages.json +3 -17
  220. package/src/components/i18n/locales/ug/messages.json +3 -17
  221. package/src/components/i18n/locales/uk/messages.json +3 -17
  222. package/src/components/i18n/locales/ur/messages.json +3 -17
  223. package/src/components/i18n/locales/vi/messages.json +3 -17
  224. package/src/components/i18n/locales/yi/messages.json +3 -17
  225. package/src/components/i18n/locales/zh/messages.json +3 -17
  226. package/src/components/icons/index.ts +30 -56
  227. package/src/components/inline-tools/inline-tool-code.ts +399 -0
  228. package/src/components/modules/api/blocks.ts +17 -0
  229. package/src/components/modules/api/tools.ts +0 -19
  230. package/src/components/modules/blockEvents/composers/blockSelectionKeys.ts +20 -3
  231. package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +5 -5
  232. package/src/components/modules/blockManager/blockManager.ts +0 -11
  233. package/src/components/modules/blockManager/event-binder.ts +1 -12
  234. package/src/components/modules/paste/handlers/html-handler.ts +13 -10
  235. package/src/components/modules/paste/handlers/index.ts +1 -0
  236. package/src/components/modules/paste/index.ts +6 -0
  237. package/src/components/modules/themeManager.ts +1 -3
  238. package/src/components/modules/toolbar/blockSettings.ts +1 -0
  239. package/src/components/modules/toolbar/inline/index.ts +3 -0
  240. package/src/components/modules/uiControllers/controllers/keyboard.ts +0 -29
  241. package/src/components/modules/uiControllers/controllers/selection.ts +2 -14
  242. package/src/components/ui/toolbox.ts +1 -0
  243. package/src/components/utils/popover/popover-position.ts +2 -4
  244. package/src/markdown/index.ts +63 -0
  245. package/src/markdown/markdown-handler.ts +110 -0
  246. package/src/markdown/mdast-to-blocks.ts +418 -0
  247. package/src/markdown/phrasing-to-html.ts +60 -0
  248. package/src/markdown/types.ts +42 -0
  249. package/src/styles/main.css +0 -1139
  250. package/src/tools/callout/index.ts +24 -0
  251. package/src/tools/code/code-keyboard.ts +135 -0
  252. package/src/tools/code/constants.ts +73 -0
  253. package/src/tools/code/dom-builder.ts +146 -0
  254. package/src/tools/code/index.ts +322 -0
  255. package/src/tools/code/katex-loader.ts +50 -0
  256. package/src/tools/code/language-picker.ts +241 -0
  257. package/src/tools/divider/index.ts +9 -1
  258. package/src/tools/index.ts +4 -2
  259. package/src/tools/list/block-operations.ts +3 -1
  260. package/src/tools/list/depth-validator.ts +4 -7
  261. package/src/tools/list/dom-builder.ts +5 -3
  262. package/src/tools/list/index.ts +21 -3
  263. package/src/tools/list/list-helpers.ts +9 -2
  264. package/src/tools/list/list-keyboard.ts +56 -14
  265. package/src/tools/list/list-lifecycle.ts +3 -1
  266. package/src/tools/list/marker-calculator.ts +37 -0
  267. package/src/tools/list/ordered-marker-manager.ts +4 -2
  268. package/src/tools/table/index.ts +2 -2
  269. package/src/tools/table/table-cell-clipboard.ts +1 -1
  270. package/types/api/tools.d.ts +0 -18
  271. package/types/markdown.d.ts +2 -0
  272. package/types/tools/code.d.ts +11 -0
  273. package/src/tools/database/database-backend-sync.ts +0 -101
  274. package/src/tools/database/database-board-view.ts +0 -301
  275. package/src/tools/database/database-card-drag.ts +0 -306
  276. package/src/tools/database/database-card-drawer.ts +0 -546
  277. package/src/tools/database/database-column-controls.ts +0 -46
  278. package/src/tools/database/database-column-drag.ts +0 -262
  279. package/src/tools/database/database-keyboard.ts +0 -35
  280. package/src/tools/database/database-list-row-drag.ts +0 -245
  281. package/src/tools/database/database-list-view.ts +0 -333
  282. package/src/tools/database/database-model.ts +0 -246
  283. package/src/tools/database/database-property-type-popover.ts +0 -108
  284. package/src/tools/database/database-tab-bar.ts +0 -532
  285. package/src/tools/database/database-view-popover.ts +0 -109
  286. package/src/tools/database/database-view-renderer.ts +0 -25
  287. package/src/tools/database/index.ts +0 -948
  288. package/src/tools/database/types.ts +0 -144
  289. /package/dist/chunks/{am-CHDDMHkd.mjs → am-CS-JjQ0N.mjs} +0 -0
  290. /package/dist/chunks/{ar-DoqfNqut.mjs → ar-Dt4XzR5U.mjs} +0 -0
  291. /package/dist/chunks/{az-C34P9iEa.mjs → az-CaDTXby8.mjs} +0 -0
  292. /package/dist/chunks/{bg-jroXLY8Y.mjs → bg-D1pLog-R.mjs} +0 -0
  293. /package/dist/chunks/{bn-BRI-WqxY.mjs → bn-Db_ae60m.mjs} +0 -0
  294. /package/dist/chunks/{bs-CCGUpNHu.mjs → bs-DJTg1R9e.mjs} +0 -0
  295. /package/dist/chunks/{cs-D5qZOGuc.mjs → cs-_Gc21gSL.mjs} +0 -0
  296. /package/dist/chunks/{da-DrJ7W37K.mjs → da-xDB8uhCd.mjs} +0 -0
  297. /package/dist/chunks/{de-BW6-kp2c.mjs → de-B6gVjh1Z.mjs} +0 -0
  298. /package/dist/chunks/{el-C-Vc_Otu.mjs → el-ClbRSnOs.mjs} +0 -0
  299. /package/dist/chunks/{es-B6fI5K9i.mjs → es-CuY9rnLK.mjs} +0 -0
  300. /package/dist/chunks/{et-BhVlZ-Yz.mjs → et-BLu5lDVc.mjs} +0 -0
  301. /package/dist/chunks/{fa-D55Ijdqa.mjs → fa-P3gnrZH8.mjs} +0 -0
  302. /package/dist/chunks/{fi-jNLjhKUQ.mjs → fi-B8PVHLjq.mjs} +0 -0
  303. /package/dist/chunks/{fil-DYd0T5aX.mjs → fil-B9JII5iF.mjs} +0 -0
  304. /package/dist/chunks/{fr-yxy5xWw_.mjs → fr-BWLDZdcc.mjs} +0 -0
  305. /package/dist/chunks/{gu-CcY_LJe7.mjs → gu-BH3R_s4c.mjs} +0 -0
  306. /package/dist/chunks/{he-DL9s7wNw.mjs → he-CCmeCVR_.mjs} +0 -0
  307. /package/dist/chunks/{hi-C8eGXgw5.mjs → hi-BBav00DN.mjs} +0 -0
  308. /package/dist/chunks/{hr-DLpybOhU.mjs → hr-B5ZX0r9G.mjs} +0 -0
  309. /package/dist/chunks/{hu-BkT0gT00.mjs → hu-1jgDa3YU.mjs} +0 -0
  310. /package/dist/chunks/{hy-CVFDCp2S.mjs → hy-LX4Kp2PE.mjs} +0 -0
  311. /package/dist/chunks/{id-0P4W9Az0.mjs → id-CcG40D1H.mjs} +0 -0
  312. /package/dist/chunks/{it-mLY6_uoW.mjs → it-Cb8_K72W.mjs} +0 -0
  313. /package/dist/chunks/{ja-7RkeRNWG.mjs → ja-ipCH91mv.mjs} +0 -0
  314. /package/dist/chunks/{ka-C7Lx-Qsh.mjs → ka-BRvREIgq.mjs} +0 -0
  315. /package/dist/chunks/{km-Q8udaraH.mjs → km-BJwVw7Fg.mjs} +0 -0
  316. /package/dist/chunks/{kn-BiETM-iq.mjs → kn-BPgUazCC.mjs} +0 -0
  317. /package/dist/chunks/{ko-tiB80pF1.mjs → ko-CQLzxe7k.mjs} +0 -0
  318. /package/dist/chunks/{ku-CY-OABkR.mjs → ku-BHhHu8Iz.mjs} +0 -0
  319. /package/dist/chunks/{lo-CTBhEnyk.mjs → lo-DsTgYblY.mjs} +0 -0
  320. /package/dist/chunks/{lt-BHKHEtqK.mjs → lt-CDzHJm71.mjs} +0 -0
  321. /package/dist/chunks/{lv-DWxgtfUg.mjs → lv-MLLIAnIX.mjs} +0 -0
  322. /package/dist/chunks/{mk-BjookGdx.mjs → mk-DQdmUquZ.mjs} +0 -0
  323. /package/dist/chunks/{ml-L-NnZcp9.mjs → ml-DqehZnra.mjs} +0 -0
  324. /package/dist/chunks/{mn-OMWi7Hl_.mjs → mn-4cFkKFjW.mjs} +0 -0
  325. /package/dist/chunks/{mr-B6JPzITo.mjs → mr-DWiztOP4.mjs} +0 -0
  326. /package/dist/chunks/{ms-CG3S-sPB.mjs → ms-BSz-iSnc.mjs} +0 -0
  327. /package/dist/chunks/{my-BLAmGfhT.mjs → my-DbtbM1MW.mjs} +0 -0
  328. /package/dist/chunks/{native-BPcABu9z.mjs → native-CzYG0YgY.mjs} +0 -0
  329. /package/dist/chunks/{ne-D1JHLfYw.mjs → ne-CqALWw_f.mjs} +0 -0
  330. /package/dist/chunks/{nl-Ca7Q8FnY.mjs → nl-D_ra6RvH.mjs} +0 -0
  331. /package/dist/chunks/{no-Coxcohcz.mjs → no-Cg_kz_jl.mjs} +0 -0
  332. /package/dist/chunks/{pa-CCaXqpaI.mjs → pa-NLAsNqwY.mjs} +0 -0
  333. /package/dist/chunks/{pl-Cl_fAZ84.mjs → pl-NHKp4YDg.mjs} +0 -0
  334. /package/dist/chunks/{ps-WD5qGAWy.mjs → ps-D1zEqNeg.mjs} +0 -0
  335. /package/dist/chunks/{pt-C4zvLfvq.mjs → pt-DBtqbUEB.mjs} +0 -0
  336. /package/dist/chunks/{ro-DbefHcmM.mjs → ro-lqr63ai5.mjs} +0 -0
  337. /package/dist/chunks/{ru-uU1J14jd.mjs → ru-BycNnDyN.mjs} +0 -0
  338. /package/dist/chunks/{sd-DKu368Ip.mjs → sd-DpHpIN9Z.mjs} +0 -0
  339. /package/dist/chunks/{si-BsJCiPkZ.mjs → si-BwiwaC7N.mjs} +0 -0
  340. /package/dist/chunks/{sk-CD-a3SN6.mjs → sk-CqRHT2Gp.mjs} +0 -0
  341. /package/dist/chunks/{sl-CXhrPJe_.mjs → sl-DA348uQ_.mjs} +0 -0
  342. /package/dist/chunks/{sq-CTctCoFQ.mjs → sq-D7JNgve1.mjs} +0 -0
  343. /package/dist/chunks/{sr-BZkhBwXj.mjs → sr-D8RK6Kwp.mjs} +0 -0
  344. /package/dist/chunks/{sv-NmRZb_xi.mjs → sv-dwgT67ZG.mjs} +0 -0
  345. /package/dist/chunks/{sw-Be5ik3H6.mjs → sw-ZRRJnkem.mjs} +0 -0
  346. /package/dist/chunks/{ta-DsXh6neL.mjs → ta-5x4L5Krl.mjs} +0 -0
  347. /package/dist/chunks/{te-CwpCbM8M.mjs → te-BZpEimwA.mjs} +0 -0
  348. /package/dist/chunks/{th-CcZ15OLk.mjs → th-Bhr-33kv.mjs} +0 -0
  349. /package/dist/chunks/{tr-q3bTgvhW.mjs → tr-6tSNKGNB.mjs} +0 -0
  350. /package/dist/chunks/{tw-DmW6-pCY.mjs → tw-CqxBf-1Y.mjs} +0 -0
  351. /package/dist/chunks/{ug-919EhLsL.mjs → ug-_e-jvr2b.mjs} +0 -0
  352. /package/dist/chunks/{uk-aNMEzd0Y.mjs → uk-DooSc2Ja.mjs} +0 -0
  353. /package/dist/chunks/{ur-BwQI77sh.mjs → ur-rb-krkIO.mjs} +0 -0
  354. /package/dist/chunks/{vi-Dxq806-F.mjs → vi-CQkLn2AQ.mjs} +0 -0
  355. /package/dist/chunks/{zh-BcHuy1Ti.mjs → zh-CXQ40Q2_.mjs} +0 -0
@@ -1,532 +0,0 @@
1
- import { generateKeyBetween } from 'fractional-indexing';
2
- import { IconBoard, IconList, IconPencil, IconCopy, IconTrash } from '../../components/icons';
3
- import { DatabaseViewPopover } from './database-view-popover';
4
- import type { DatabaseViewConfig, ViewType } from './types';
5
-
6
- const DRAG_THRESHOLD = 10;
7
-
8
- const VIEW_ICONS: Record<string, string> = {
9
- board: IconBoard,
10
- list: IconList,
11
- };
12
-
13
- export interface TabBarOptions {
14
- views: DatabaseViewConfig[];
15
- activeViewId: string;
16
- onTabClick: (viewId: string) => void;
17
- onAddView: (type: ViewType) => void;
18
- onRename: (viewId: string, newName: string) => void;
19
- onDuplicate: (viewId: string) => void;
20
- onDelete: (viewId: string) => void;
21
- onReorder: (viewId: string, newPosition: string) => void;
22
- }
23
-
24
- export class DatabaseTabBar {
25
- private readonly options: TabBarOptions;
26
- private readonly views: DatabaseViewConfig[];
27
- private readonly onReorder: (viewId: string, newPosition: string) => void;
28
- private element: HTMLElement | null = null;
29
- private barEl: HTMLElement | null = null;
30
- private viewPopover: DatabaseViewPopover | null = null;
31
- private contextPopoverEl: HTMLElement | null = null;
32
- private boundOutsideContextClick: ((e: MouseEvent) => void) | null = null;
33
-
34
- private overflowDropdownEl: HTMLElement | null = null;
35
- private boundOverflowClose: ((e: MouseEvent) => void) | null = null;
36
- private moreBtnEl: HTMLElement | null = null;
37
-
38
- private isDragging = false;
39
- private dragViewId = '';
40
- private dragStartX = 0;
41
- private ghostEl: HTMLElement | null = null;
42
- private readonly boundDragMove: (e: PointerEvent) => void;
43
- private readonly boundDragUp: (e: PointerEvent) => void;
44
- private readonly boundDragCancel: () => void;
45
- private readonly boundDragKeyDown: (e: KeyboardEvent) => void;
46
-
47
- constructor(options: TabBarOptions) {
48
- this.options = options;
49
- this.views = options.views;
50
- this.onReorder = options.onReorder;
51
-
52
- this.boundDragMove = this.handleDragMove.bind(this);
53
- this.boundDragUp = this.handleDragUp.bind(this);
54
- this.boundDragCancel = this.cleanupDrag.bind(this);
55
- this.boundDragKeyDown = (e: KeyboardEvent): void => {
56
- if (e.key === 'Escape') { this.cleanupDrag(); }
57
- };
58
- }
59
-
60
- render(): HTMLElement {
61
- const bar = document.createElement('div');
62
- bar.setAttribute('data-blok-database-tab-bar', '');
63
- this.barEl = bar;
64
- this.element = bar;
65
-
66
- const sorted = [...this.options.views].sort((a, b) => (a.position < b.position ? -1 : 1));
67
-
68
- for (const view of sorted) {
69
- bar.appendChild(this.createTab(view));
70
- }
71
-
72
- const addBtn = document.createElement('button');
73
- addBtn.setAttribute('data-blok-database-add-view', '');
74
- addBtn.textContent = '+';
75
- addBtn.addEventListener('click', () => {
76
- this.openViewPopover(addBtn);
77
- });
78
- bar.appendChild(addBtn);
79
-
80
- bar.addEventListener('click', (e: MouseEvent) => {
81
- const target = e.target as HTMLElement;
82
- const tab = target.closest('[data-blok-database-tab]');
83
- if (!(tab instanceof HTMLElement)) {
84
- return;
85
- }
86
- const viewId = tab.getAttribute('data-view-id');
87
- if (viewId === null) {
88
- return;
89
- }
90
- if (tab.hasAttribute('data-active')) {
91
- return;
92
- }
93
- this.options.onTabClick(viewId);
94
- });
95
-
96
- bar.addEventListener('contextmenu', (e: MouseEvent) => {
97
- const target = e.target as HTMLElement;
98
- const tab = target.closest('[data-blok-database-tab]');
99
- if (!(tab instanceof HTMLElement)) {
100
- return;
101
- }
102
- e.preventDefault();
103
- const viewId = tab.getAttribute('data-view-id');
104
- if (viewId === null) {
105
- return;
106
- }
107
- this.openContextPopover(tab, viewId);
108
- });
109
-
110
- bar.addEventListener('pointerdown', (e) => {
111
- const target = e.target as HTMLElement;
112
- const tab = target.closest<HTMLElement>('[data-blok-database-tab]');
113
- if (tab === null) return;
114
- const viewId = tab.getAttribute('data-view-id');
115
- if (viewId === null) return;
116
- this.dragViewId = viewId;
117
- this.dragStartX = e.clientX;
118
- this.isDragging = false;
119
- document.addEventListener('pointermove', this.boundDragMove);
120
- document.addEventListener('pointerup', this.boundDragUp);
121
- document.addEventListener('pointercancel', this.boundDragCancel);
122
- document.addEventListener('keydown', this.boundDragKeyDown);
123
- });
124
-
125
- if (typeof ResizeObserver !== 'undefined') {
126
- const ro = new ResizeObserver(() => {
127
- if (this.element === null) {
128
- return;
129
- }
130
-
131
- const tabs = Array.from(this.element.querySelectorAll<HTMLElement>('[data-blok-database-tab]'));
132
-
133
- for (const tab of tabs) {
134
- tab.style.display = '';
135
- }
136
- this.moreBtnEl?.remove();
137
- this.moreBtnEl = null;
138
-
139
- const barWidth = this.element.clientWidth;
140
- const addBtnWidth = 40;
141
- const visibleCount = tabs.findIndex((_tab, i) => {
142
- const consumed = addBtnWidth + tabs.slice(0, i + 1).reduce((w, t) => w + t.offsetWidth + 2, 0);
143
-
144
- return consumed > barWidth;
145
- });
146
- const resolved = visibleCount === -1 ? tabs.length : visibleCount;
147
-
148
- if (resolved < tabs.length) {
149
- this.handleOverflow(resolved);
150
- }
151
- });
152
-
153
- ro.observe(bar);
154
- }
155
-
156
- return bar;
157
- }
158
-
159
- private createTab(view: DatabaseViewConfig): HTMLElement {
160
- const tab = document.createElement('div');
161
- tab.setAttribute('data-blok-database-tab', '');
162
- tab.setAttribute('data-view-id', view.id);
163
-
164
- if (view.id === this.options.activeViewId) {
165
- tab.setAttribute('data-active', '');
166
- }
167
-
168
- const iconSpan = document.createElement('span');
169
- iconSpan.innerHTML = VIEW_ICONS[view.type] ?? '';
170
- tab.appendChild(iconSpan);
171
-
172
- const nameSpan = document.createElement('span');
173
- nameSpan.setAttribute('data-blok-database-tab-name', '');
174
- nameSpan.textContent = view.name;
175
- tab.appendChild(nameSpan);
176
-
177
- return tab;
178
- }
179
-
180
- private openContextPopover(tab: HTMLElement, viewId: string): void {
181
- this.closeContextPopover();
182
-
183
- const popover = document.createElement('div');
184
- popover.setAttribute('data-blok-popover', '');
185
- popover.setAttribute('data-blok-database-tab-context', '');
186
- popover.style.position = 'fixed';
187
- popover.style.zIndex = '1000';
188
-
189
- const rect = tab.getBoundingClientRect();
190
- popover.style.top = `${rect.bottom + 4}px`;
191
- popover.style.left = `${rect.left}px`;
192
-
193
- const renameItem = document.createElement('div');
194
- renameItem.setAttribute('data-blok-database-tab-action', 'rename');
195
- const renameIcon = document.createElement('span');
196
- renameIcon.setAttribute('data-blok-database-tab-action-icon', '');
197
- renameIcon.innerHTML = IconPencil;
198
- renameItem.appendChild(renameIcon);
199
- const renameLabel = document.createElement('span');
200
- renameLabel.textContent = 'Rename';
201
- renameItem.appendChild(renameLabel);
202
- renameItem.addEventListener('click', () => {
203
- this.closeContextPopover();
204
- this.startInlineRename(tab, viewId);
205
- });
206
- popover.appendChild(renameItem);
207
-
208
- const duplicateItem = document.createElement('div');
209
- duplicateItem.setAttribute('data-blok-database-tab-action', 'duplicate');
210
- const duplicateIcon = document.createElement('span');
211
- duplicateIcon.setAttribute('data-blok-database-tab-action-icon', '');
212
- duplicateIcon.innerHTML = IconCopy;
213
- duplicateItem.appendChild(duplicateIcon);
214
- const duplicateLabel = document.createElement('span');
215
- duplicateLabel.textContent = 'Duplicate';
216
- duplicateItem.appendChild(duplicateLabel);
217
- duplicateItem.addEventListener('click', () => {
218
- this.closeContextPopover();
219
- this.options.onDuplicate(viewId);
220
- });
221
- popover.appendChild(duplicateItem);
222
-
223
- const separator = document.createElement('div');
224
- separator.setAttribute('data-blok-database-tab-context-separator', '');
225
- if (this.options.views.length === 1) {
226
- separator.style.display = 'none';
227
- }
228
- popover.appendChild(separator);
229
-
230
- const deleteItem = document.createElement('div');
231
- deleteItem.setAttribute('data-blok-database-tab-action', 'delete');
232
- const deleteIcon = document.createElement('span');
233
- deleteIcon.setAttribute('data-blok-database-tab-action-icon', '');
234
- deleteIcon.innerHTML = IconTrash;
235
- deleteItem.appendChild(deleteIcon);
236
- const deleteLabel = document.createElement('span');
237
- deleteLabel.textContent = 'Delete';
238
- deleteItem.appendChild(deleteLabel);
239
- if (this.options.views.length === 1) {
240
- deleteItem.style.display = 'none';
241
- }
242
- deleteItem.addEventListener('click', () => {
243
- this.closeContextPopover();
244
- this.options.onDelete(viewId);
245
- });
246
- popover.appendChild(deleteItem);
247
-
248
- document.body.appendChild(popover);
249
- this.contextPopoverEl = popover;
250
-
251
- this.boundOutsideContextClick = (e: MouseEvent): void => {
252
- const target = e.target as HTMLElement;
253
- if (!popover.contains(target) && !tab.contains(target)) {
254
- this.closeContextPopover();
255
- }
256
- };
257
-
258
- document.addEventListener('mousedown', this.boundOutsideContextClick);
259
- }
260
-
261
- private closeContextPopover(): void {
262
- if (this.contextPopoverEl !== null) {
263
- this.contextPopoverEl.remove();
264
- this.contextPopoverEl = null;
265
- }
266
- if (this.boundOutsideContextClick !== null) {
267
- document.removeEventListener('mousedown', this.boundOutsideContextClick);
268
- this.boundOutsideContextClick = null;
269
- }
270
- }
271
-
272
- private startInlineRename(tab: HTMLElement, viewId: string): void {
273
- const nameSpan = tab.querySelector('[data-blok-database-tab-name]');
274
- if (!(nameSpan instanceof HTMLElement)) {
275
- return;
276
- }
277
-
278
- const originalName = nameSpan.textContent ?? '';
279
-
280
- const input = document.createElement('input');
281
- input.setAttribute('data-blok-database-tab-rename-input', '');
282
- input.value = originalName;
283
- nameSpan.replaceWith(input);
284
- input.focus();
285
- input.select();
286
-
287
- const commit = (): void => {
288
- const newName = input.value.trim() || originalName;
289
- const newSpan = document.createElement('span');
290
- newSpan.setAttribute('data-blok-database-tab-name', '');
291
- newSpan.textContent = newName;
292
- input.replaceWith(newSpan);
293
- if (newName !== originalName) {
294
- this.options.onRename(viewId, newName);
295
- }
296
- };
297
-
298
- input.addEventListener('blur', commit);
299
- input.addEventListener('keydown', (e: KeyboardEvent) => {
300
- e.stopPropagation();
301
- if (e.key === 'Enter') {
302
- input.blur();
303
- } else if (e.key === 'Escape') {
304
- input.removeEventListener('blur', commit);
305
- const cancelSpan = document.createElement('span');
306
- cancelSpan.setAttribute('data-blok-database-tab-name', '');
307
- cancelSpan.textContent = originalName;
308
- input.replaceWith(cancelSpan);
309
- }
310
- });
311
- }
312
-
313
- private openViewPopover(anchor: HTMLElement): void {
314
- if (this.viewPopover !== null) {
315
- this.viewPopover.destroy();
316
- }
317
- this.viewPopover = new DatabaseViewPopover({
318
- onSelect: (type) => {
319
- this.options.onAddView(type);
320
- },
321
- });
322
- this.viewPopover.open(anchor);
323
- }
324
-
325
- handleOverflow(visibleCount: number): void {
326
- if (this.element === null) return;
327
-
328
- // Remove existing more button
329
- this.moreBtnEl?.remove();
330
-
331
- const orderedViews = [...this.views].sort((a, b) => (a.position < b.position ? -1 : 1));
332
- const hiddenCount = orderedViews.length - visibleCount;
333
- if (hiddenCount <= 0) return;
334
-
335
- // Hide overflow tabs
336
- const tabs = Array.from(this.element.querySelectorAll<HTMLElement>('[data-blok-database-tab]'));
337
-
338
- for (const tab of tabs.slice(visibleCount)) {
339
- tab.style.display = 'none';
340
- }
341
-
342
- // Add "N more..." button before the + button
343
- const moreBtn = document.createElement('div');
344
- moreBtn.setAttribute('data-blok-database-tab-more', '');
345
- moreBtn.textContent = `${hiddenCount} more...`;
346
- moreBtn.style.cursor = 'pointer';
347
- moreBtn.addEventListener('click', () => {
348
- this.openOverflowDropdown(moreBtn);
349
- });
350
-
351
- const addBtn = this.element.querySelector('[data-blok-database-add-view]');
352
- if (addBtn !== null) {
353
- this.element.insertBefore(moreBtn, addBtn);
354
- } else {
355
- this.element.appendChild(moreBtn);
356
- }
357
- this.moreBtnEl = moreBtn;
358
- }
359
-
360
- private openOverflowDropdown(anchor: HTMLElement): void {
361
- this.closeOverflowDropdown();
362
-
363
- const dropdown = document.createElement('div');
364
- dropdown.setAttribute('data-blok-popover', '');
365
- dropdown.setAttribute('data-blok-database-tab-overflow-dropdown', '');
366
- dropdown.style.position = 'fixed';
367
- dropdown.style.zIndex = '1000';
368
-
369
- const rect = anchor.getBoundingClientRect();
370
- dropdown.style.top = `${rect.bottom + 4}px`;
371
- dropdown.style.left = `${rect.left}px`;
372
-
373
- const orderedViews = [...this.views].sort((a, b) => (a.position < b.position ? -1 : 1));
374
-
375
- for (const view of orderedViews) {
376
- const item = document.createElement('div');
377
- item.setAttribute('data-blok-database-tab-overflow-item', '');
378
- item.setAttribute('data-view-id', view.id);
379
-
380
- if (view.id === this.options.activeViewId) {
381
- item.setAttribute('data-active', '');
382
- }
383
-
384
- const iconSpan = document.createElement('span');
385
- iconSpan.innerHTML = VIEW_ICONS[view.type] ?? '';
386
- item.appendChild(iconSpan);
387
-
388
- const nameSpan = document.createElement('span');
389
- nameSpan.textContent = view.name;
390
- item.appendChild(nameSpan);
391
-
392
- item.addEventListener('click', () => {
393
- if (view.id !== this.options.activeViewId) {
394
- this.options.onTabClick(view.id);
395
- }
396
- this.closeOverflowDropdown();
397
- });
398
-
399
- dropdown.appendChild(item);
400
- }
401
-
402
- const separator = document.createElement('div');
403
- separator.setAttribute('data-blok-database-tab-overflow-separator', '');
404
- dropdown.appendChild(separator);
405
-
406
- const addBtn = this.element?.querySelector<HTMLElement>('[data-blok-database-add-view]');
407
- const newViewBtn = document.createElement('div');
408
- newViewBtn.setAttribute('data-blok-database-tab-overflow-new', '');
409
- newViewBtn.textContent = '+ New view';
410
- newViewBtn.addEventListener('click', () => {
411
- this.closeOverflowDropdown();
412
- if (addBtn !== null && addBtn !== undefined) {
413
- this.openViewPopover(addBtn);
414
- }
415
- });
416
- dropdown.appendChild(newViewBtn);
417
-
418
- document.body.appendChild(dropdown);
419
- this.overflowDropdownEl = dropdown;
420
-
421
- this.boundOverflowClose = (e: MouseEvent): void => {
422
- const target = e.target as HTMLElement;
423
- if (!dropdown.contains(target) && !anchor.contains(target)) {
424
- this.closeOverflowDropdown();
425
- }
426
- };
427
-
428
- document.addEventListener('mousedown', this.boundOverflowClose);
429
- }
430
-
431
- private closeOverflowDropdown(): void {
432
- if (this.overflowDropdownEl !== null) {
433
- this.overflowDropdownEl.remove();
434
- this.overflowDropdownEl = null;
435
- }
436
- if (this.boundOverflowClose !== null) {
437
- document.removeEventListener('mousedown', this.boundOverflowClose);
438
- this.boundOverflowClose = null;
439
- }
440
- }
441
-
442
- private handleDragMove(e: PointerEvent): void {
443
- const dx = Math.abs(e.clientX - this.dragStartX);
444
- if (!this.isDragging && dx < DRAG_THRESHOLD) return;
445
- if (!this.isDragging) {
446
- this.isDragging = true;
447
- this.element?.setAttribute('data-dragging', '');
448
- const sourceTab = this.element?.querySelector(`[data-view-id="${this.dragViewId}"]`) as HTMLElement | null;
449
- if (sourceTab !== null) {
450
- this.ghostEl = sourceTab.cloneNode(true) as HTMLElement;
451
- this.ghostEl.setAttribute('data-blok-database-tab-ghost', '');
452
- this.ghostEl.style.position = 'fixed';
453
- this.ghostEl.style.pointerEvents = 'none';
454
- this.ghostEl.style.zIndex = '50';
455
- this.ghostEl.style.opacity = '0.7';
456
- const rect = sourceTab.getBoundingClientRect();
457
- this.ghostEl.style.top = `${rect.top}px`;
458
- this.ghostEl.style.width = `${rect.width}px`;
459
- document.body.appendChild(this.ghostEl);
460
- sourceTab.style.opacity = '0.4';
461
- }
462
- }
463
- if (this.ghostEl !== null) {
464
- this.ghostEl.style.left = `${e.clientX - 50}px`;
465
- }
466
- }
467
-
468
- private handleDragUp(e: PointerEvent): void {
469
- if (!this.isDragging) {
470
- this.removeDragListeners();
471
- return;
472
- }
473
- const tabs = Array.from(
474
- this.element?.querySelectorAll<HTMLElement>('[data-blok-database-tab]') ?? []
475
- ).filter((t) => t.getAttribute('data-view-id') !== this.dragViewId);
476
-
477
- const dropIndex = tabs.findIndex((t) => {
478
- const rect = t.getBoundingClientRect();
479
- return e.clientX < (rect.left + rect.right) / 2;
480
- });
481
-
482
- const beforeViewId = dropIndex >= 0 ? tabs[dropIndex].getAttribute('data-view-id') : null;
483
- const afterViewId = ((): string | null => {
484
- if (dropIndex > 0) return tabs[dropIndex - 1].getAttribute('data-view-id');
485
- if (dropIndex === -1 && tabs.length > 0) return tabs[tabs.length - 1].getAttribute('data-view-id');
486
- return null;
487
- })();
488
-
489
- const orderedViews = [...this.views].sort((a, b) => (a.position < b.position ? -1 : 1));
490
- const beforeView = beforeViewId !== null ? orderedViews.find((v) => v.id === beforeViewId) : null;
491
- const afterView = afterViewId !== null ? orderedViews.find((v) => v.id === afterViewId) : null;
492
-
493
- const newPosition = generateKeyBetween(
494
- afterView?.position ?? null,
495
- beforeView?.position ?? null
496
- );
497
-
498
- this.cleanupDrag();
499
- this.onReorder(this.dragViewId, newPosition);
500
- }
501
-
502
- private cleanupDrag(): void {
503
- if (this.ghostEl !== null) {
504
- this.ghostEl.remove();
505
- this.ghostEl = null;
506
- }
507
- this.element?.removeAttribute('data-dragging');
508
- const sourceTab = this.element?.querySelector(`[data-view-id="${this.dragViewId}"]`) as HTMLElement | null;
509
- if (sourceTab !== null) {
510
- sourceTab.style.opacity = '';
511
- }
512
- this.isDragging = false;
513
- this.removeDragListeners();
514
- }
515
-
516
- private removeDragListeners(): void {
517
- document.removeEventListener('pointermove', this.boundDragMove);
518
- document.removeEventListener('pointerup', this.boundDragUp);
519
- document.removeEventListener('pointercancel', this.boundDragCancel);
520
- document.removeEventListener('keydown', this.boundDragKeyDown);
521
- }
522
-
523
- destroy(): void {
524
- this.cleanupDrag();
525
- this.closeContextPopover();
526
- this.closeOverflowDropdown();
527
- if (this.viewPopover !== null) {
528
- this.viewPopover.destroy();
529
- this.viewPopover = null;
530
- }
531
- }
532
- }
@@ -1,109 +0,0 @@
1
- import { IconBoard, IconGallery, IconList, IconTable } from '../../components/icons';
2
- import type { ViewType } from './types';
3
-
4
- interface ViewTypeOption {
5
- type: ViewType;
6
- icon: string;
7
- label: string;
8
- disabled?: boolean;
9
- }
10
-
11
- const VIEW_TYPES: ViewTypeOption[] = [
12
- { type: 'board', icon: IconBoard, label: 'Board' },
13
- { type: 'list', icon: IconList, label: 'List' },
14
- { type: 'table', icon: IconTable, label: 'Table', disabled: true },
15
- { type: 'gallery', icon: IconGallery, label: 'Gallery', disabled: true },
16
- ];
17
-
18
- export interface ViewPopoverOptions {
19
- onSelect: (type: ViewType) => void;
20
- }
21
-
22
- export class DatabaseViewPopover {
23
- private readonly onSelect: (type: ViewType) => void;
24
- private popoverEl: HTMLElement | null = null;
25
- private boundOutsideClick: ((e: MouseEvent) => void) | null = null;
26
-
27
- constructor(options: ViewPopoverOptions) {
28
- this.onSelect = options.onSelect;
29
- }
30
-
31
- open(anchor: HTMLElement): void {
32
- this.close();
33
-
34
- const popover = document.createElement('div');
35
- popover.setAttribute('data-blok-popover', '');
36
- popover.setAttribute('data-blok-database-view-popover', '');
37
- popover.style.position = 'fixed';
38
- popover.style.zIndex = '1000';
39
-
40
- const rect = anchor.getBoundingClientRect();
41
- popover.style.top = `${rect.bottom + 4}px`;
42
- popover.style.left = `${rect.left}px`;
43
-
44
- const heading = document.createElement('div');
45
- heading.setAttribute('data-blok-database-view-popover-heading', '');
46
- heading.textContent = 'Add a new view';
47
- popover.appendChild(heading);
48
-
49
- const grid = document.createElement('div');
50
- grid.setAttribute('data-blok-database-view-popover-grid', '');
51
- grid.style.display = 'grid';
52
- grid.style.gridTemplateColumns = '1fr 1fr';
53
- grid.style.gap = '2px';
54
-
55
- for (const option of VIEW_TYPES) {
56
- const item = document.createElement('div');
57
- item.setAttribute('data-blok-database-view-option', option.type);
58
-
59
- const iconEl = document.createElement('div');
60
- iconEl.setAttribute('data-blok-database-view-option-icon', '');
61
- iconEl.innerHTML = option.icon;
62
- item.appendChild(iconEl);
63
-
64
- const label = document.createElement('span');
65
- label.textContent = option.label;
66
- item.appendChild(label);
67
-
68
- if (option.disabled === true) {
69
- item.style.opacity = '0.35';
70
- item.style.pointerEvents = 'none';
71
- } else {
72
- item.addEventListener('click', () => {
73
- this.onSelect(option.type);
74
- this.close();
75
- });
76
- }
77
-
78
- grid.appendChild(item);
79
- }
80
-
81
- popover.appendChild(grid);
82
- document.body.appendChild(popover);
83
- this.popoverEl = popover;
84
-
85
- this.boundOutsideClick = (e: MouseEvent): void => {
86
- const target = e.target as HTMLElement;
87
- if (!popover.contains(target) && !anchor.contains(target)) {
88
- this.close();
89
- }
90
- };
91
-
92
- document.addEventListener('mousedown', this.boundOutsideClick);
93
- }
94
-
95
- close(): void {
96
- if (this.popoverEl !== null) {
97
- this.popoverEl.remove();
98
- this.popoverEl = null;
99
- }
100
- if (this.boundOutsideClick !== null) {
101
- document.removeEventListener('mousedown', this.boundOutsideClick);
102
- this.boundOutsideClick = null;
103
- }
104
- }
105
-
106
- destroy(): void {
107
- this.close();
108
- }
109
- }
@@ -1,25 +0,0 @@
1
- import type { DatabaseRow, SelectOption } from './types';
2
-
3
- /**
4
- * Shared contract for all database view renderers (board, list, etc.).
5
- * Each implementation receives its data through the constructor and renders via createView().
6
- */
7
- export interface DatabaseViewRenderer {
8
- /** Creates the full view DOM. Data is bound at construction time. */
9
- createView(): HTMLDivElement;
10
-
11
- /** Appends a row element to the appropriate container within the view. */
12
- appendRow(container: HTMLElement, row: DatabaseRow): void;
13
-
14
- /** Removes a row element from the view by its row ID. */
15
- removeRow(wrapper: HTMLElement, rowId: string): void;
16
-
17
- /** Updates the visible title of a row element found by its row ID. */
18
- updateRowTitle(wrapper: HTMLElement, rowId: string, title: string): void;
19
-
20
- /** Appends a group container (board: column, list: group section). Optional — not all views support it. */
21
- appendGroup?(wrapper: HTMLElement, option: SelectOption): void;
22
-
23
- /** Removes a group container by its option ID. Optional. */
24
- removeGroup?(wrapper: HTMLElement, optionId: string): void;
25
- }