@jackuait/blok 0.10.0-beta.3 → 0.10.0-beta.5
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.
- package/dist/blok.mjs +2 -2
- package/dist/chunks/{blok-CrfCy6RQ.mjs → blok-DH-WEcA8.mjs} +2213 -2200
- package/dist/chunks/{constants-BzBmIAnT.mjs → constants-Ccno9NZS.mjs} +86 -64
- package/dist/chunks/{i18next-Ch0gVA3V.mjs → i18next-G6FKbZqA.mjs} +1 -1
- package/dist/chunks/{i18next-loader-BOlOKRt8.mjs → i18next-loader-CwNimni3.mjs} +2 -2
- package/dist/chunks/{lightweight-i18n-D1n0OClP.mjs → lightweight-i18n-DWCdzAw0.mjs} +17 -1
- package/dist/{messages-D7Wofcg3.mjs → chunks/messages-1Raf1IK82.mjs} +16 -0
- package/dist/chunks/{messages-Du6j7HqD2.mjs → messages-6mikOS4D2.mjs} +16 -0
- package/dist/{messages-CyQQ8g9w2.mjs → chunks/messages-B0ffBqzr.mjs} +16 -0
- package/dist/{messages-CfaiAQHW2.mjs → chunks/messages-B2pW6jO_.mjs} +16 -0
- package/dist/{messages-4kMr3vfK2.mjs → chunks/messages-B3s2vra72.mjs} +16 -0
- package/dist/{messages-CBWUNVHy.mjs → chunks/messages-B7MIRzCa2.mjs} +16 -0
- package/dist/chunks/{messages-0Nh_GHU02.mjs → messages-BPog17132.mjs} +16 -0
- package/dist/chunks/{messages-CbXL5f99.mjs → messages-BS1nOvZ-.mjs} +16 -0
- package/dist/{messages-BCIuVjwb.mjs → chunks/messages-BW_7lfqG2.mjs} +16 -0
- package/dist/chunks/{messages-naWwXCx3.mjs → messages-BaPZuLjN.mjs} +16 -0
- package/dist/chunks/{messages-DcrkPXXn.mjs → messages-BbdNugdi.mjs} +16 -0
- package/dist/{messages-CeyO7HXV.mjs → chunks/messages-BdnSVKOw.mjs} +16 -0
- package/dist/chunks/{messages-BORQKKT9.mjs → messages-BgVEGd4c.mjs} +16 -0
- package/dist/chunks/{messages-C1pm6RWX.mjs → messages-BgsPQXfP.mjs} +16 -0
- package/dist/chunks/{messages-CYZgPXFK.mjs → messages-BkCjgGxc.mjs} +16 -0
- package/dist/{messages-DB1-0FXB.mjs → chunks/messages-BnznaKEP2.mjs} +16 -0
- package/dist/{messages-CIpXgMRr2.mjs → chunks/messages-Bpda_3PM2.mjs} +16 -0
- package/dist/{messages-D2GHT83V2.mjs → chunks/messages-BrFl5773.mjs} +16 -0
- package/dist/chunks/{messages-BLD1DC722.mjs → messages-C-b6tPad2.mjs} +16 -0
- package/dist/chunks/{messages-LiSIeruD2.mjs → messages-C11byid72.mjs} +16 -0
- package/dist/chunks/{messages-IKrYzwFq.mjs → messages-C1OqT_nL.mjs} +16 -0
- package/dist/chunks/{messages-fitmpwb3.mjs → messages-Cdx4QMR1.mjs} +16 -0
- package/dist/{messages-CLB0caVL.mjs → chunks/messages-CgRvtOEY.mjs} +16 -0
- package/dist/{messages-BxcqzUx0.mjs → chunks/messages-ClRHDxzh.mjs} +16 -0
- package/dist/{messages-DwroI9YW.mjs → chunks/messages-CljStrYi.mjs} +16 -0
- package/dist/chunks/{messages-CR48wvl32.mjs → messages-CmXADeab2.mjs} +16 -0
- package/dist/{messages-BkZDaKu6.mjs → chunks/messages-CmrMwBv3.mjs} +16 -0
- package/dist/chunks/{messages-B7Vlzmgw.mjs → messages-CpzO7KRA.mjs} +16 -0
- package/dist/{messages-DwTwecgF2.mjs → chunks/messages-Cqc-6rfh2.mjs} +16 -0
- package/dist/chunks/{messages-BN_zp4oj.mjs → messages-CrMfiGu5.mjs} +16 -0
- package/dist/{messages-BRlbE8SE.mjs → chunks/messages-Cs9XBt4T.mjs} +16 -0
- package/dist/chunks/{messages-DDM4t-j8.mjs → messages-Csvm4mtA.mjs} +16 -0
- package/dist/chunks/{messages-CuHxfDvL2.mjs → messages-Ct7AMBS82.mjs} +16 -0
- package/dist/{messages-BjEY7_jw.mjs → chunks/messages-CvfKofOP.mjs} +16 -0
- package/dist/{messages-Du0fWeyE.mjs → chunks/messages-CyNsByCY.mjs} +16 -0
- package/dist/{messages-6Cq_jyNk2.mjs → chunks/messages-Czny5pPT2.mjs} +16 -0
- package/dist/{messages-CGqRnKaM.mjs → chunks/messages-D5IgUbBD2.mjs} +16 -0
- package/dist/{messages-uP6wmMOs.mjs → chunks/messages-DA7Zk-Cy.mjs} +16 -0
- package/dist/chunks/{messages-DJ9yyqUO2.mjs → messages-DAVsuDWh2.mjs} +16 -0
- package/dist/chunks/{messages-i9ThpxZk2.mjs → messages-DBpXyvRe2.mjs} +16 -0
- package/dist/chunks/{messages-CogKhvJL.mjs → messages-DC7TX-YT.mjs} +16 -0
- package/dist/{messages-C-KPP7bC.mjs → chunks/messages-DD7BI6BK.mjs} +16 -0
- package/dist/{messages-ZMa-zmIc.mjs → chunks/messages-DHCVA7XQ.mjs} +16 -0
- package/dist/chunks/{messages-BPQA3B862.mjs → messages-DJA6fb_P2.mjs} +16 -0
- package/dist/chunks/{messages-D9SfB6MI.mjs → messages-DJkIeapn.mjs} +16 -0
- package/dist/{messages-CZkwcbV12.mjs → chunks/messages-DPykxECP2.mjs} +16 -0
- package/dist/chunks/{messages-BQvBhQem.mjs → messages-DQ5AyNCU.mjs} +16 -0
- package/dist/chunks/{messages-rxlf-Ule.mjs → messages-DR09nkcZ.mjs} +16 -0
- package/dist/chunks/{messages-B1uFbxNg.mjs → messages-DSjXen8E.mjs} +16 -0
- package/dist/chunks/{messages-OFFQT8Fg.mjs → messages-DT7fRpCy.mjs} +16 -0
- package/dist/{messages-DnNNd3RW2.mjs → chunks/messages-DUDgFEEe2.mjs} +16 -0
- package/dist/chunks/{messages-7PIvzufT.mjs → messages-Df87zXXG.mjs} +16 -0
- package/dist/chunks/{messages-CvA7Fbqf.mjs → messages-Dfpi8pDY.mjs} +16 -0
- package/dist/{messages-CXlAjnEQ.mjs → chunks/messages-Dm4YVlrm.mjs} +16 -0
- package/dist/chunks/{messages-CuJLHCj5.mjs → messages-Dplnp19q.mjs} +16 -0
- package/dist/{messages-DEfeDBuV2.mjs → chunks/messages-FHrCEJmY2.mjs} +16 -0
- package/dist/chunks/{messages-nZP1GShd.mjs → messages-ID1PHnMv.mjs} +16 -0
- package/dist/{messages-BiK5fMYF2.mjs → chunks/messages-IDEUsFhQ2.mjs} +16 -0
- package/dist/{messages-C672uqt-.mjs → chunks/messages-JQKFJo7C.mjs} +16 -0
- package/dist/{messages-DVHWIOfr2.mjs → chunks/messages-LxumrNue2.mjs} +16 -0
- package/dist/chunks/{messages-By-gACFM2.mjs → messages-R2W_rGOo2.mjs} +16 -0
- package/dist/chunks/{messages-FEjIF48t.mjs → messages-ZJ0b1C3a.mjs} +16 -0
- package/dist/{messages-nosa-xnx2.mjs → chunks/messages-d0Ky6QjR.mjs} +16 -0
- package/dist/{messages-CHaVGY89.mjs → chunks/messages-p4byLfvR.mjs} +16 -0
- package/dist/{messages-D-bnq2qy.mjs → chunks/messages-u2yxkNTE2.mjs} +16 -0
- package/dist/{messages-axsznSTn2.mjs → chunks/messages-wLSVQbsA2.mjs} +16 -0
- package/dist/chunks/{messages-DiaQNuPV.mjs → messages-xfjdrZmx.mjs} +16 -0
- package/dist/chunks/{objectSpread2-CyPxu8-u.mjs → objectSpread2-BY4mgzrQ.mjs} +1 -1
- package/dist/chunks/{tools-B6tibTzs.mjs → tools-C2_IVsQY.mjs} +2868 -1082
- package/dist/full.mjs +11 -11
- package/dist/locales.mjs +83 -67
- package/dist/{messages-BfbYJ8Wk2.mjs → messages--S8_taOd2.mjs} +16 -0
- package/dist/{chunks/messages-CkWidbwX2.mjs → messages-B-4fku2H2.mjs} +16 -0
- package/dist/{chunks/messages-Dn1ZDZUy.mjs → messages-BAcH6PtT2.mjs} +16 -0
- package/dist/{chunks/messages-2nj1xBDo.mjs → messages-BBq0M604.mjs} +16 -0
- package/dist/{messages-Dzqb5lg6.mjs → messages-BBvDbp62.mjs} +16 -0
- package/dist/{messages-kuLrhtV2.mjs → messages-BCG_evLg.mjs} +16 -0
- package/dist/{messages-DEKkIgU6.mjs → messages-BCuTVHBV.mjs} +16 -0
- package/dist/{chunks/messages-CYZL_rhV2.mjs → messages-BGsDZTQp2.mjs} +16 -0
- package/dist/{chunks/messages-cMwiuDZM.mjs → messages-BJ7BuFZi.mjs} +16 -0
- package/dist/{chunks/messages-Dl16RBg1.mjs → messages-BKjqW08U.mjs} +16 -0
- package/dist/{messages-Daza4lOM.mjs → messages-BSe3QDnQ.mjs} +16 -0
- package/dist/{chunks/messages-CDV8VcSZ2.mjs → messages-BVKZK-3t.mjs} +16 -0
- package/dist/{messages-CcPrYMHE.mjs → messages-BXI3qIos.mjs} +16 -0
- package/dist/{messages-B_6S7hBj2.mjs → messages-BcFQFcJ92.mjs} +16 -0
- package/dist/{chunks/messages-CmSsyItg.mjs → messages-Bio7KYsr2.mjs} +16 -0
- package/dist/{chunks/messages-CqdYWY192.mjs → messages-Bk984gRE2.mjs} +16 -0
- package/dist/{chunks/messages-CQgP-Fo22.mjs → messages-BmNaAyKS.mjs} +16 -0
- package/dist/{messages-DbPt9d2U.mjs → messages-Bo_FUvVH.mjs} +16 -0
- package/dist/{chunks/messages-x6GyZWWT.mjs → messages-BokEflKa.mjs} +16 -0
- package/dist/{chunks/messages-C9qPNbrJ2.mjs → messages-BtxaN-xx.mjs} +16 -0
- package/dist/{messages-6edZhK922.mjs → messages-BvgTQLf72.mjs} +16 -0
- package/dist/{chunks/messages-BVl-X2wo2.mjs → messages-BvgXeMSL2.mjs} +16 -0
- package/dist/{messages-BBauvpFc.mjs → messages-BywbKcPC.mjs} +16 -0
- package/dist/{chunks/messages-D06U2QNl2.mjs → messages-C30Vz-UZ2.mjs} +16 -0
- package/dist/{messages-BwyQiBdm2.mjs → messages-C5XPUD9T2.mjs} +16 -0
- package/dist/{chunks/messages-BivhofAQ2.mjs → messages-C6OJvnJg2.mjs} +16 -0
- package/dist/{chunks/messages-D6ZvH6hX.mjs → messages-C6Y4Jv2N.mjs} +16 -0
- package/dist/{messages-DaFDdCrr.mjs → messages-CBdQ3XP9.mjs} +16 -0
- package/dist/{chunks/messages-KihEeXdr.mjs → messages-CBzd_x7H.mjs} +16 -0
- package/dist/{messages-CsVZUVra.mjs → messages-CHJ5SOZI.mjs} +16 -0
- package/dist/{messages-us2JotS-2.mjs → messages-CM5fsPo02.mjs} +16 -0
- package/dist/{chunks/messages-DjhgPQtb.mjs → messages-CVcQD-9u.mjs} +16 -0
- package/dist/{messages-BQi_l2vs.mjs → messages-CYX48nfg.mjs} +16 -0
- package/dist/{chunks/messages-BF8c-lMm.mjs → messages-Ccd587Yn.mjs} +16 -0
- package/dist/{chunks/messages-5WyxUYVR2.mjs → messages-CdlsTFB1.mjs} +16 -0
- package/dist/{messages-ke15helG2.mjs → messages-CgzbJ8_l2.mjs} +16 -0
- package/dist/{messages-D1-_eTfM.mjs → messages-CjmSrt1D.mjs} +16 -0
- package/dist/{chunks/messages-C7YpgZ9m.mjs → messages-CqkRG9mH.mjs} +16 -0
- package/dist/{messages-Dtw27ih4.mjs → messages-D3cAcyzj.mjs} +16 -0
- package/dist/{messages-CLN3oL77.mjs → messages-DA-o8X3A.mjs} +16 -0
- package/dist/{chunks/messages-BtZ8oQXS.mjs → messages-DD5pW0zJ.mjs} +16 -0
- package/dist/{chunks/messages-A3Z4jxwt2.mjs → messages-DIRha_gg2.mjs} +16 -0
- package/dist/{chunks/messages-rnd6qiJ12.mjs → messages-DJKLtW7u.mjs} +16 -0
- package/dist/{messages-h_VN1Kyo2.mjs → messages-DJT4Bt_02.mjs} +16 -0
- package/dist/{chunks/messages-D3hNTep_.mjs → messages-DOTJ2NvJ.mjs} +16 -0
- package/dist/{chunks/messages-B18MZnaY.mjs → messages-DUBHHfEt.mjs} +16 -0
- package/dist/{chunks/messages-92ma9RJD2.mjs → messages-DV9e1DW7.mjs} +16 -0
- package/dist/{chunks/messages-DQUUtL5v.mjs → messages-DVQNjdPk.mjs} +16 -0
- package/dist/{messages-DflAKRLd.mjs → messages-DZEcrbmH.mjs} +16 -0
- package/dist/{messages-BLjz6V7y2.mjs → messages-DbxbxUiK2.mjs} +16 -0
- package/dist/{messages-QkGAxuVC2.mjs → messages-Dcyrzdxa2.mjs} +16 -0
- package/dist/{chunks/messages-DBZ-uuAV.mjs → messages-Dddxv8-f2.mjs} +16 -0
- package/dist/{messages-DVILiJw52.mjs → messages-DjJQoYvP2.mjs} +16 -0
- package/dist/{messages-B-lXqB1z2.mjs → messages-Dkg99bfr2.mjs} +16 -0
- package/dist/{messages-CCBgCmyq.mjs → messages-DnatBKPm.mjs} +16 -0
- package/dist/{messages-Dn-khi3a.mjs → messages-DqyqEw1_.mjs} +16 -0
- package/dist/{chunks/messages-D4QXMtW52.mjs → messages-DtrSrdfE2.mjs} +16 -0
- package/dist/{messages-BHIdzfAS2.mjs → messages-JhoVMjfX2.mjs} +16 -0
- package/dist/{messages-YlWV9cSl.mjs → messages-eTourT12.mjs} +16 -0
- package/dist/{messages-DzlmoWqQ.mjs → messages-fLi0P2dP.mjs} +16 -0
- package/dist/{messages-C-v50b4r.mjs → messages-hTpeKUaW.mjs} +16 -0
- package/dist/{chunks/messages-16UmLAWZ2.mjs → messages-i4S6q64n2.mjs} +16 -0
- package/dist/{messages-DP9PhNTo.mjs → messages-pgPcitDH.mjs} +16 -0
- package/dist/{chunks/messages-D5iRrf9M.mjs → messages-tK67CBqn.mjs} +16 -0
- package/dist/{chunks/messages-BTyEo5Kb.mjs → messages-tsHpMdDT2.mjs} +16 -0
- package/dist/{chunks/messages-Ct_H_5cB2.mjs → messages-upqrRZQH2.mjs} +16 -0
- package/dist/{messages-CyZZ10br.mjs → messages-xEI8gEDK.mjs} +16 -0
- package/dist/react.mjs +3 -3
- package/dist/tools.mjs +3 -3
- package/dist/vendor.LICENSE.txt +136 -1
- package/package.json +2 -1
- package/src/components/block/style-manager.ts +1 -1
- package/src/components/i18n/locales/am/messages.json +16 -0
- package/src/components/i18n/locales/ar/messages.json +16 -0
- package/src/components/i18n/locales/az/messages.json +16 -0
- package/src/components/i18n/locales/bg/messages.json +16 -0
- package/src/components/i18n/locales/bn/messages.json +16 -0
- package/src/components/i18n/locales/bs/messages.json +16 -0
- package/src/components/i18n/locales/cs/messages.json +16 -0
- package/src/components/i18n/locales/da/messages.json +16 -0
- package/src/components/i18n/locales/de/messages.json +16 -0
- package/src/components/i18n/locales/dv/messages.json +16 -0
- package/src/components/i18n/locales/el/messages.json +16 -0
- package/src/components/i18n/locales/en/messages.json +16 -0
- package/src/components/i18n/locales/es/messages.json +16 -0
- package/src/components/i18n/locales/et/messages.json +16 -0
- package/src/components/i18n/locales/fa/messages.json +16 -0
- package/src/components/i18n/locales/fi/messages.json +16 -0
- package/src/components/i18n/locales/fil/messages.json +16 -0
- package/src/components/i18n/locales/fr/messages.json +16 -0
- package/src/components/i18n/locales/gu/messages.json +16 -0
- package/src/components/i18n/locales/he/messages.json +16 -0
- package/src/components/i18n/locales/hi/messages.json +16 -0
- package/src/components/i18n/locales/hr/messages.json +16 -0
- package/src/components/i18n/locales/hu/messages.json +16 -0
- package/src/components/i18n/locales/hy/messages.json +16 -0
- package/src/components/i18n/locales/id/messages.json +16 -0
- package/src/components/i18n/locales/it/messages.json +16 -0
- package/src/components/i18n/locales/ja/messages.json +16 -0
- package/src/components/i18n/locales/ka/messages.json +16 -0
- package/src/components/i18n/locales/km/messages.json +16 -0
- package/src/components/i18n/locales/kn/messages.json +16 -0
- package/src/components/i18n/locales/ko/messages.json +16 -0
- package/src/components/i18n/locales/ku/messages.json +16 -0
- package/src/components/i18n/locales/lo/messages.json +16 -0
- package/src/components/i18n/locales/lt/messages.json +16 -0
- package/src/components/i18n/locales/lv/messages.json +16 -0
- package/src/components/i18n/locales/mk/messages.json +16 -0
- package/src/components/i18n/locales/ml/messages.json +16 -0
- package/src/components/i18n/locales/mn/messages.json +16 -0
- package/src/components/i18n/locales/mr/messages.json +16 -0
- package/src/components/i18n/locales/ms/messages.json +16 -0
- package/src/components/i18n/locales/my/messages.json +16 -0
- package/src/components/i18n/locales/ne/messages.json +16 -0
- package/src/components/i18n/locales/nl/messages.json +16 -0
- package/src/components/i18n/locales/no/messages.json +16 -0
- package/src/components/i18n/locales/pa/messages.json +16 -0
- package/src/components/i18n/locales/pl/messages.json +16 -0
- package/src/components/i18n/locales/ps/messages.json +16 -0
- package/src/components/i18n/locales/pt/messages.json +16 -0
- package/src/components/i18n/locales/ro/messages.json +16 -0
- package/src/components/i18n/locales/ru/messages.json +16 -0
- package/src/components/i18n/locales/sd/messages.json +16 -0
- package/src/components/i18n/locales/si/messages.json +16 -0
- package/src/components/i18n/locales/sk/messages.json +16 -0
- package/src/components/i18n/locales/sl/messages.json +16 -0
- package/src/components/i18n/locales/sq/messages.json +16 -0
- package/src/components/i18n/locales/sr/messages.json +16 -0
- package/src/components/i18n/locales/sv/messages.json +16 -0
- package/src/components/i18n/locales/sw/messages.json +16 -0
- package/src/components/i18n/locales/ta/messages.json +16 -0
- package/src/components/i18n/locales/te/messages.json +16 -0
- package/src/components/i18n/locales/th/messages.json +16 -0
- package/src/components/i18n/locales/tr/messages.json +16 -0
- package/src/components/i18n/locales/ug/messages.json +16 -0
- package/src/components/i18n/locales/uk/messages.json +16 -0
- package/src/components/i18n/locales/ur/messages.json +16 -0
- package/src/components/i18n/locales/vi/messages.json +16 -0
- package/src/components/i18n/locales/yi/messages.json +16 -0
- package/src/components/i18n/locales/zh/messages.json +16 -0
- package/src/components/icons/index.ts +56 -0
- package/src/components/modules/api/tools.ts +19 -0
- package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +5 -5
- package/src/components/modules/blockManager/blockManager.ts +11 -0
- package/src/components/modules/blockManager/event-binder.ts +12 -1
- package/src/components/modules/themeManager.ts +3 -1
- package/src/components/modules/toolbar/blockSettings.ts +0 -1
- package/src/components/modules/toolbar/inline/index.ts +0 -3
- package/src/components/modules/uiControllers/controllers/keyboard.ts +29 -0
- package/src/components/modules/uiControllers/controllers/selection.ts +14 -2
- package/src/components/ui/toolbox.ts +0 -1
- package/src/components/utils/popover/popover-position.ts +4 -2
- package/src/styles/main.css +1139 -0
- package/src/tools/callout/constants.ts +2 -1
- package/src/tools/database/database-backend-sync.ts +101 -0
- package/src/tools/database/database-board-view.ts +301 -0
- package/src/tools/database/database-card-drag.ts +306 -0
- package/src/tools/database/database-card-drawer.ts +546 -0
- package/src/tools/database/database-column-controls.ts +46 -0
- package/src/tools/database/database-column-drag.ts +262 -0
- package/src/tools/database/database-keyboard.ts +35 -0
- package/src/tools/database/database-list-row-drag.ts +245 -0
- package/src/tools/database/database-list-view.ts +333 -0
- package/src/tools/database/database-model.ts +246 -0
- package/src/tools/database/database-property-type-popover.ts +108 -0
- package/src/tools/database/database-tab-bar.ts +532 -0
- package/src/tools/database/database-view-popover.ts +109 -0
- package/src/tools/database/database-view-renderer.ts +25 -0
- package/src/tools/database/index.ts +948 -0
- package/src/tools/database/types.ts +144 -0
- package/src/tools/index.ts +2 -0
- package/types/api/tools.d.ts +18 -0
- package/types/index.d.ts +16 -0
- package/types/tools/database.d.ts +145 -0
|
@@ -26,5 +26,6 @@ export const DEFAULT_EMOJI = '💡';
|
|
|
26
26
|
|
|
27
27
|
// CSS — Tailwind classes
|
|
28
28
|
export const WRAPPER_STYLES = 'rounded-xl px-4 py-[5px] my-1 flex items-start gap-2';
|
|
29
|
-
|
|
29
|
+
// h-[38px] = py-[7px]×2 + 1.5rem×1 = 14+24; explicit height prevents platform-specific emoji font metrics from inflating the button
|
|
30
|
+
export const EMOJI_BUTTON_STYLES = 'text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] h-[38px] flex-shrink-0 select-none';
|
|
30
31
|
export const CHILDREN_STYLES = 'flex-1 min-w-0';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { DatabaseAdapter, PropertyDefinition, DatabaseRow, DatabaseViewConfig } from './types';
|
|
2
|
+
|
|
3
|
+
const UPDATE_DEBOUNCE_MS = 500;
|
|
4
|
+
|
|
5
|
+
export class DatabaseBackendSync {
|
|
6
|
+
private readonly adapter: DatabaseAdapter | undefined;
|
|
7
|
+
private readonly onError: ((error: unknown) => void) | undefined;
|
|
8
|
+
private readonly pendingTimers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
9
|
+
private readonly pendingUpdates = new Map<string, Parameters<DatabaseAdapter['updateRow']>[0]>();
|
|
10
|
+
|
|
11
|
+
constructor(adapter?: DatabaseAdapter, onError?: (error: unknown) => void) {
|
|
12
|
+
this.adapter = adapter;
|
|
13
|
+
this.onError = onError;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
private async safeCall<T>(fn: (adapter: DatabaseAdapter) => Promise<T>): Promise<T | undefined> {
|
|
17
|
+
if (this.adapter === undefined) return undefined;
|
|
18
|
+
try { return await fn(this.adapter); }
|
|
19
|
+
catch (error) { this.onError?.(error); return undefined; }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ─── Load ───
|
|
23
|
+
|
|
24
|
+
async syncLoadDatabase(): Promise<{ schema: PropertyDefinition[]; rows: Record<string, DatabaseRow>; views: DatabaseViewConfig[] } | undefined> {
|
|
25
|
+
return this.safeCall((a) => a.loadDatabase());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ─── Row operations ───
|
|
29
|
+
|
|
30
|
+
async syncCreateRow(params: Parameters<DatabaseAdapter['createRow']>[0]): Promise<ReturnType<DatabaseAdapter['createRow']> extends Promise<infer R> ? R | undefined : never> {
|
|
31
|
+
return this.safeCall((a) => a.createRow(params));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
syncUpdateRow(params: Parameters<DatabaseAdapter['updateRow']>[0]): void {
|
|
35
|
+
if (this.adapter === undefined) return;
|
|
36
|
+
const { rowId } = params;
|
|
37
|
+
const existing = this.pendingTimers.get(rowId);
|
|
38
|
+
if (existing !== undefined) clearTimeout(existing);
|
|
39
|
+
this.pendingUpdates.set(rowId, params);
|
|
40
|
+
this.pendingTimers.set(rowId, setTimeout(() => { this.flushRow(rowId); }, UPDATE_DEBOUNCE_MS));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async syncMoveRow(params: Parameters<DatabaseAdapter['moveRow']>[0]): Promise<ReturnType<DatabaseAdapter['moveRow']> extends Promise<infer R> ? R | undefined : never> {
|
|
44
|
+
this.flushRow(params.rowId);
|
|
45
|
+
|
|
46
|
+
return this.safeCall((a) => a.moveRow(params));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async syncDeleteRow(params: Parameters<DatabaseAdapter['deleteRow']>[0]): Promise<void> {
|
|
50
|
+
await this.safeCall((a) => a.deleteRow(params));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ─── Property operations ───
|
|
54
|
+
|
|
55
|
+
async syncCreateProperty(params: Parameters<DatabaseAdapter['createProperty']>[0]): Promise<ReturnType<DatabaseAdapter['createProperty']> extends Promise<infer R> ? R | undefined : never> {
|
|
56
|
+
return this.safeCall((a) => a.createProperty(params));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async syncUpdateProperty(params: Parameters<DatabaseAdapter['updateProperty']>[0]): Promise<ReturnType<DatabaseAdapter['updateProperty']> extends Promise<infer R> ? R | undefined : never> {
|
|
60
|
+
return this.safeCall((a) => a.updateProperty(params));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async syncDeleteProperty(params: Parameters<DatabaseAdapter['deleteProperty']>[0]): Promise<void> {
|
|
64
|
+
await this.safeCall((a) => a.deleteProperty(params));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ─── View operations ───
|
|
68
|
+
|
|
69
|
+
async syncCreateView(params: Parameters<DatabaseAdapter['createView']>[0]): Promise<ReturnType<DatabaseAdapter['createView']> extends Promise<infer R> ? R | undefined : never> {
|
|
70
|
+
return this.safeCall((a) => a.createView(params));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async syncUpdateView(params: Parameters<DatabaseAdapter['updateView']>[0]): Promise<ReturnType<DatabaseAdapter['updateView']> extends Promise<infer R> ? R | undefined : never> {
|
|
74
|
+
return this.safeCall((a) => a.updateView(params));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async syncDeleteView(params: Parameters<DatabaseAdapter['deleteView']>[0]): Promise<void> {
|
|
78
|
+
await this.safeCall((a) => a.deleteView(params));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ─── Flush & destroy ───
|
|
82
|
+
|
|
83
|
+
flushPendingUpdates(): void {
|
|
84
|
+
for (const rowId of this.pendingTimers.keys()) { this.flushRow(rowId); }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
destroy(): void {
|
|
88
|
+
for (const timer of this.pendingTimers.values()) clearTimeout(timer);
|
|
89
|
+
this.pendingTimers.clear();
|
|
90
|
+
this.pendingUpdates.clear();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private flushRow(rowId: string): void {
|
|
94
|
+
const timer = this.pendingTimers.get(rowId);
|
|
95
|
+
if (timer !== undefined) clearTimeout(timer);
|
|
96
|
+
this.pendingTimers.delete(rowId);
|
|
97
|
+
const params = this.pendingUpdates.get(rowId);
|
|
98
|
+
this.pendingUpdates.delete(rowId);
|
|
99
|
+
if (params !== undefined) void this.safeCall((a) => a.updateRow(params));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import type { I18n } from '../../../types';
|
|
2
|
+
import type { SelectOption, DatabaseRow } from './types';
|
|
3
|
+
import type { DatabaseViewRenderer } from './database-view-renderer';
|
|
4
|
+
|
|
5
|
+
interface DatabaseBoardViewOptions {
|
|
6
|
+
readOnly: boolean;
|
|
7
|
+
i18n: I18n;
|
|
8
|
+
options: SelectOption[];
|
|
9
|
+
getRows: (optionId: string) => DatabaseRow[];
|
|
10
|
+
titlePropertyId: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* DOM rendering layer for the kanban board.
|
|
15
|
+
* Receives ordered data and creates plain DOM elements (NOT contenteditable).
|
|
16
|
+
* All interactive elements use data-blok-database-* attributes for test selectors and event delegation.
|
|
17
|
+
*/
|
|
18
|
+
export class DatabaseBoardView implements DatabaseViewRenderer {
|
|
19
|
+
private readonly readOnly: boolean;
|
|
20
|
+
private readonly i18n: I18n;
|
|
21
|
+
private readonly options: SelectOption[];
|
|
22
|
+
private readonly getRows: (optionId: string) => DatabaseRow[];
|
|
23
|
+
private readonly titlePropertyId: string;
|
|
24
|
+
|
|
25
|
+
constructor({ readOnly, i18n, options, getRows, titlePropertyId }: DatabaseBoardViewOptions) {
|
|
26
|
+
this.readOnly = readOnly;
|
|
27
|
+
this.i18n = i18n;
|
|
28
|
+
this.options = options;
|
|
29
|
+
this.getRows = getRows;
|
|
30
|
+
this.titlePropertyId = titlePropertyId;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates the full board DOM from option and row data.
|
|
35
|
+
*/
|
|
36
|
+
createView(): HTMLDivElement {
|
|
37
|
+
const wrapper = document.createElement('div');
|
|
38
|
+
|
|
39
|
+
wrapper.setAttribute('data-blok-tool', 'database');
|
|
40
|
+
wrapper.setAttribute('role', 'region');
|
|
41
|
+
wrapper.setAttribute('aria-label', 'Kanban board');
|
|
42
|
+
wrapper.style.display = 'flex';
|
|
43
|
+
|
|
44
|
+
const boardArea = document.createElement('div');
|
|
45
|
+
|
|
46
|
+
boardArea.setAttribute('data-blok-database-board', '');
|
|
47
|
+
boardArea.style.display = 'flex';
|
|
48
|
+
boardArea.style.overflowX = 'auto';
|
|
49
|
+
boardArea.style.alignItems = 'flex-start';
|
|
50
|
+
boardArea.style.gap = '12px';
|
|
51
|
+
boardArea.style.paddingTop = '6px';
|
|
52
|
+
boardArea.style.paddingBottom = '24px';
|
|
53
|
+
boardArea.style.flex = '1';
|
|
54
|
+
boardArea.style.minWidth = '0';
|
|
55
|
+
|
|
56
|
+
for (const option of this.options) {
|
|
57
|
+
const columnEl = this.createColumnElement(option, this.getRows(option.id), this.titlePropertyId);
|
|
58
|
+
|
|
59
|
+
boardArea.appendChild(columnEl);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!this.readOnly) {
|
|
63
|
+
const addColumnBtn = document.createElement('button');
|
|
64
|
+
|
|
65
|
+
addColumnBtn.setAttribute('data-blok-database-add-column', '');
|
|
66
|
+
addColumnBtn.setAttribute('aria-label', this.i18n.t('tools.database.addColumn'));
|
|
67
|
+
addColumnBtn.textContent = '+ ' + this.i18n.t('tools.database.addColumn');
|
|
68
|
+
addColumnBtn.style.minWidth = '260px';
|
|
69
|
+
addColumnBtn.style.flex = '0 0 260px';
|
|
70
|
+
boardArea.appendChild(addColumnBtn);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
wrapper.appendChild(boardArea);
|
|
74
|
+
|
|
75
|
+
return wrapper;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Creates and appends a row element to a cards container.
|
|
80
|
+
*/
|
|
81
|
+
appendRow(cardsContainer: HTMLElement, row: DatabaseRow): void {
|
|
82
|
+
const cardEl = this.createCardElement(row, this.titlePropertyId);
|
|
83
|
+
|
|
84
|
+
cardsContainer.appendChild(cardEl);
|
|
85
|
+
this.updateColumnCount(cardsContainer);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Removes a row element from the wrapper by its data-row-id.
|
|
90
|
+
*/
|
|
91
|
+
removeRow(wrapper: HTMLElement, rowId: string): void {
|
|
92
|
+
const cardEl = wrapper.querySelector(`[data-row-id="${rowId}"]`);
|
|
93
|
+
const cardsContainer = cardEl?.closest('[data-blok-database-cards]') as HTMLElement | null;
|
|
94
|
+
|
|
95
|
+
cardEl?.remove();
|
|
96
|
+
|
|
97
|
+
if (cardsContainer !== null) {
|
|
98
|
+
this.updateColumnCount(cardsContainer);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Updates the visible title of a row element found by its data-row-id.
|
|
104
|
+
*/
|
|
105
|
+
updateRowTitle(wrapper: HTMLElement, rowId: string, title: string): void {
|
|
106
|
+
const cardEl = wrapper.querySelector(`[data-row-id="${rowId}"]`);
|
|
107
|
+
const titleEl = cardEl?.querySelector('[data-blok-database-card-title]');
|
|
108
|
+
|
|
109
|
+
if (titleEl !== null && titleEl !== undefined) {
|
|
110
|
+
if (title) {
|
|
111
|
+
titleEl.textContent = title;
|
|
112
|
+
titleEl.removeAttribute('data-placeholder');
|
|
113
|
+
} else {
|
|
114
|
+
titleEl.textContent = this.i18n.t('tools.database.cardTitlePlaceholder');
|
|
115
|
+
titleEl.setAttribute('data-placeholder', '');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Creates and inserts a group (column) element before the add-column button.
|
|
122
|
+
*/
|
|
123
|
+
appendGroup(wrapper: HTMLElement, option: SelectOption): void {
|
|
124
|
+
const columnEl = this.createColumnElement(option, [], '');
|
|
125
|
+
const boardArea = wrapper.querySelector('[data-blok-database-board]');
|
|
126
|
+
const container = (boardArea as HTMLElement | null) ?? wrapper;
|
|
127
|
+
const addColumnBtn = container.querySelector('[data-blok-database-add-column]');
|
|
128
|
+
|
|
129
|
+
if (addColumnBtn) {
|
|
130
|
+
container.insertBefore(columnEl, addColumnBtn);
|
|
131
|
+
} else {
|
|
132
|
+
container.appendChild(columnEl);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Removes a group (column) element from the wrapper by its data-option-id.
|
|
138
|
+
*/
|
|
139
|
+
removeGroup(wrapper: HTMLElement, optionId: string): void {
|
|
140
|
+
const columnEl = wrapper.querySelector(`[data-option-id="${optionId}"]`);
|
|
141
|
+
|
|
142
|
+
columnEl?.remove();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Creates a single column element with header, cards container, and optional add-card button.
|
|
147
|
+
*/
|
|
148
|
+
private createColumnElement(option: SelectOption, rows: DatabaseRow[], titlePropertyId: string): HTMLDivElement {
|
|
149
|
+
const columnEl = document.createElement('div');
|
|
150
|
+
|
|
151
|
+
columnEl.setAttribute('data-blok-database-column', '');
|
|
152
|
+
columnEl.setAttribute('data-option-id', option.id);
|
|
153
|
+
columnEl.setAttribute('role', 'group');
|
|
154
|
+
columnEl.setAttribute('aria-label', option.label);
|
|
155
|
+
columnEl.style.display = 'flex';
|
|
156
|
+
columnEl.style.flexDirection = 'column';
|
|
157
|
+
columnEl.style.minWidth = '260px';
|
|
158
|
+
columnEl.style.flex = '0 0 260px';
|
|
159
|
+
|
|
160
|
+
if (option.color !== undefined) {
|
|
161
|
+
columnEl.style.backgroundColor = `var(--blok-color-${option.color}-bg)`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const header = document.createElement('div');
|
|
165
|
+
|
|
166
|
+
header.setAttribute('data-blok-database-column-header', '');
|
|
167
|
+
header.style.display = 'flex';
|
|
168
|
+
header.style.alignItems = 'center';
|
|
169
|
+
header.style.padding = '6px 8px';
|
|
170
|
+
header.style.borderRadius = '4px';
|
|
171
|
+
header.style.gap = '6px';
|
|
172
|
+
header.style.cursor = 'grab';
|
|
173
|
+
|
|
174
|
+
const pill = document.createElement('div');
|
|
175
|
+
|
|
176
|
+
pill.setAttribute('data-blok-database-column-pill', '');
|
|
177
|
+
|
|
178
|
+
if (option.color !== undefined) {
|
|
179
|
+
const dot = document.createElement('span');
|
|
180
|
+
|
|
181
|
+
dot.setAttribute('data-blok-database-column-dot', '');
|
|
182
|
+
dot.style.backgroundColor = `var(--blok-color-${option.color}-text)`;
|
|
183
|
+
pill.appendChild(dot);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const titleEl = document.createElement('div');
|
|
187
|
+
|
|
188
|
+
titleEl.setAttribute('data-blok-database-column-title', '');
|
|
189
|
+
titleEl.style.fontWeight = '600';
|
|
190
|
+
titleEl.textContent = option.label;
|
|
191
|
+
pill.appendChild(titleEl);
|
|
192
|
+
|
|
193
|
+
header.appendChild(pill);
|
|
194
|
+
|
|
195
|
+
const countEl = document.createElement('span');
|
|
196
|
+
|
|
197
|
+
countEl.setAttribute('data-blok-database-column-count', '');
|
|
198
|
+
countEl.textContent = String(rows.length);
|
|
199
|
+
header.appendChild(countEl);
|
|
200
|
+
|
|
201
|
+
columnEl.appendChild(header);
|
|
202
|
+
|
|
203
|
+
const cardsContainer = document.createElement('div');
|
|
204
|
+
|
|
205
|
+
cardsContainer.setAttribute('data-blok-database-cards', '');
|
|
206
|
+
cardsContainer.setAttribute('role', 'list');
|
|
207
|
+
cardsContainer.style.display = 'flex';
|
|
208
|
+
cardsContainer.style.flexDirection = 'column';
|
|
209
|
+
cardsContainer.style.gap = '8px';
|
|
210
|
+
cardsContainer.style.paddingTop = '6px';
|
|
211
|
+
cardsContainer.style.minHeight = '40px';
|
|
212
|
+
|
|
213
|
+
for (const row of rows) {
|
|
214
|
+
const cardEl = this.createCardElement(row, titlePropertyId);
|
|
215
|
+
|
|
216
|
+
cardsContainer.appendChild(cardEl);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
columnEl.appendChild(cardsContainer);
|
|
220
|
+
|
|
221
|
+
if (!this.readOnly) {
|
|
222
|
+
const addCardBtn = document.createElement('button');
|
|
223
|
+
|
|
224
|
+
addCardBtn.setAttribute('data-blok-database-add-card', '');
|
|
225
|
+
addCardBtn.setAttribute('data-option-id', option.id);
|
|
226
|
+
addCardBtn.setAttribute('aria-label', this.i18n.t('tools.database.addCard'));
|
|
227
|
+
addCardBtn.textContent = '+ ' + this.i18n.t('tools.database.newPage');
|
|
228
|
+
|
|
229
|
+
if (option.color !== undefined) {
|
|
230
|
+
addCardBtn.style.borderColor = `color-mix(in srgb, var(--blok-color-${option.color}-text) 30%, transparent)`;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
columnEl.appendChild(addCardBtn);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return columnEl;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Creates a single card element.
|
|
241
|
+
*/
|
|
242
|
+
private createCardElement(row: DatabaseRow, titlePropertyId: string): HTMLDivElement {
|
|
243
|
+
const cardEl = document.createElement('div');
|
|
244
|
+
const title = (row.properties[titlePropertyId] as string) ?? '';
|
|
245
|
+
|
|
246
|
+
cardEl.setAttribute('data-blok-database-card', '');
|
|
247
|
+
cardEl.setAttribute('data-row-id', row.id);
|
|
248
|
+
cardEl.setAttribute('role', 'listitem');
|
|
249
|
+
cardEl.style.padding = '10px 12px';
|
|
250
|
+
cardEl.style.borderRadius = '12px';
|
|
251
|
+
cardEl.style.cursor = 'pointer';
|
|
252
|
+
cardEl.style.position = 'relative';
|
|
253
|
+
|
|
254
|
+
const titleEl = document.createElement('div');
|
|
255
|
+
|
|
256
|
+
titleEl.setAttribute('data-blok-database-card-title', '');
|
|
257
|
+
|
|
258
|
+
if (title) {
|
|
259
|
+
titleEl.textContent = title;
|
|
260
|
+
} else {
|
|
261
|
+
titleEl.textContent = this.i18n.t('tools.database.cardTitlePlaceholder');
|
|
262
|
+
titleEl.setAttribute('data-placeholder', '');
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
cardEl.appendChild(titleEl);
|
|
266
|
+
|
|
267
|
+
if (!this.readOnly) {
|
|
268
|
+
const deleteBtn = document.createElement('button');
|
|
269
|
+
|
|
270
|
+
deleteBtn.setAttribute('data-blok-database-delete-card', '');
|
|
271
|
+
deleteBtn.setAttribute('data-row-id', row.id);
|
|
272
|
+
deleteBtn.setAttribute('aria-label', this.i18n.t('tools.database.deleteCard'));
|
|
273
|
+
deleteBtn.style.position = 'absolute';
|
|
274
|
+
deleteBtn.style.top = '4px';
|
|
275
|
+
deleteBtn.style.right = '4px';
|
|
276
|
+
deleteBtn.textContent = '\u00d7';
|
|
277
|
+
cardEl.appendChild(deleteBtn);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return cardEl;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Updates the card count badge for the column containing the given cards container.
|
|
285
|
+
*/
|
|
286
|
+
private updateColumnCount(cardsContainer: HTMLElement): void {
|
|
287
|
+
const columnEl = cardsContainer.closest('[data-blok-database-column]');
|
|
288
|
+
|
|
289
|
+
if (columnEl === null) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const countEl = columnEl.querySelector('[data-blok-database-column-count]');
|
|
294
|
+
|
|
295
|
+
if (countEl !== null) {
|
|
296
|
+
const cardCount = cardsContainer.querySelectorAll('[data-blok-database-card]').length;
|
|
297
|
+
|
|
298
|
+
countEl.textContent = String(cardCount);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|