@jackuait/blok 0.7.2 → 0.7.3-beta.2
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 +3 -3
- package/dist/chunks/{blok-3RuPZd3G.mjs → blok-Cv1zWiST.mjs} +2147 -2099
- package/dist/chunks/{constants-BkelccB1.mjs → constants-DWpV4hCh.mjs} +186 -58
- package/dist/chunks/{i18next-loader-qjweOJ-t.mjs → i18next-loader-D5HxE5ZQ.mjs} +1 -1
- package/dist/chunks/{lightweight-i18n-vbtPx5C4.mjs → lightweight-i18n-Safdy0ua.mjs} +0 -1
- package/dist/chunks/{messages-CjcSWeud.mjs → messages-1C3OS98e.mjs} +0 -1
- package/dist/chunks/{messages-3bOAVT3X2.mjs → messages-3ePgbbpx2.mjs} +0 -1
- package/dist/chunks/{messages-CG2xl0IV.mjs → messages-6EJxSImH.mjs} +0 -1
- package/dist/{messages-BjnJajTO2.mjs → chunks/messages-6z-ULVyk.mjs} +0 -1
- package/dist/{messages-B8jjwMLK.mjs → chunks/messages-BKtWlK39.mjs} +0 -1
- package/dist/chunks/{messages-CpnXbVOK2.mjs → messages-BM1Su_Uy2.mjs} +0 -1
- package/dist/{messages-DZo0x7Bd.mjs → chunks/messages-BUy3odZo.mjs} +0 -1
- package/dist/{messages-BflWzIcP2.mjs → chunks/messages-BZ45xBlV.mjs} +0 -1
- package/dist/chunks/{messages-Dr7yA3xM.mjs → messages-B_90PYaG.mjs} +0 -1
- package/dist/{messages-49ZJ_ISf.mjs → chunks/messages-B_nVGWdk.mjs} +0 -1
- package/dist/{messages-cOqXp22e.mjs → chunks/messages-BjkDJuqh.mjs} +0 -1
- package/dist/chunks/{messages-CvamFN6x.mjs → messages-BtNOlsMj.mjs} +0 -1
- package/dist/{messages-DmX52AQr.mjs → chunks/messages-C1iQkKu82.mjs} +0 -1
- package/dist/{messages-CaAdEXoh2.mjs → chunks/messages-C1lqY56F2.mjs} +0 -1
- package/dist/chunks/{messages-BoTtYEct2.mjs → messages-C232njMF2.mjs} +0 -1
- package/dist/chunks/{messages-DPe7kW6J.mjs → messages-C3AJz_i6.mjs} +0 -1
- package/dist/{messages-BEDVb3ZX.mjs → chunks/messages-C9XSSqS5.mjs} +0 -1
- package/dist/chunks/{messages-DriB5lEF.mjs → messages-CRxkRJRN.mjs} +0 -1
- package/dist/{messages-XwPD18Kk.mjs → chunks/messages-CVzvKl6U.mjs} +0 -1
- package/dist/chunks/{messages-B_Qcy8kr2.mjs → messages-Cb-x47kY2.mjs} +0 -1
- package/dist/{messages-DvTVsLOK2.mjs → chunks/messages-CejEH4FW2.mjs} +0 -1
- package/dist/{messages-CicggErN2.mjs → chunks/messages-CficsmSH2.mjs} +0 -1
- package/dist/chunks/{messages-CFr0Ha6p2.mjs → messages-ClOxDE0y2.mjs} +0 -1
- package/dist/chunks/{messages-BRrtoRdw2.mjs → messages-Cn5n0nHe2.mjs} +0 -1
- package/dist/{messages-DwPfgL_u.mjs → chunks/messages-CnzaTbel.mjs} +0 -1
- package/dist/chunks/{messages-CIGX0FfW.mjs → messages-Cq6wj6FG.mjs} +0 -1
- package/dist/chunks/{messages-Csq7JatN.mjs → messages-CteKp81J.mjs} +0 -1
- package/dist/{messages-Dr-YJYIK2.mjs → chunks/messages-CvLXClh9.mjs} +0 -1
- package/dist/chunks/{messages-43N0Vfg42.mjs → messages-CxTq0x772.mjs} +0 -1
- package/dist/chunks/{messages-DkSwQvmi2.mjs → messages-CzCqu58X2.mjs} +0 -1
- package/dist/{messages-CkVfziK_2.mjs → chunks/messages-D6SAC8Lc2.mjs} +0 -1
- package/dist/chunks/{messages-Doxcj7Qy.mjs → messages-D7aoKTPD.mjs} +0 -1
- package/dist/chunks/{messages-B0cg-ThO2.mjs → messages-D9nReG4C2.mjs} +0 -1
- package/dist/{messages-g58itYPI.mjs → chunks/messages-D9qyilS0.mjs} +0 -1
- package/dist/chunks/{messages-BQZtOYxr2.mjs → messages-DDRCk44J2.mjs} +0 -1
- package/dist/chunks/{messages-B87-89os.mjs → messages-DDr8J4FE.mjs} +0 -1
- package/dist/{messages-DzhR8Klk.mjs → chunks/messages-DJWRON2S.mjs} +0 -1
- package/dist/{messages-DBwaWI0X.mjs → chunks/messages-DK6pBwD2.mjs} +0 -1
- package/dist/chunks/{messages-BFiMCfDX2.mjs → messages-DNrK8lCg2.mjs} +0 -1
- package/dist/chunks/{messages-D7fI9Pj52.mjs → messages-DQ4VyVJf2.mjs} +0 -1
- package/dist/{messages-BHOI7R4K.mjs → chunks/messages-DacahKek.mjs} +0 -1
- package/dist/chunks/{messages-Bn6LwI4B.mjs → messages-DbS9Oibb.mjs} +0 -1
- package/dist/chunks/{messages-Dg6kSnxq.mjs → messages-DcPtg90i.mjs} +0 -1
- package/dist/{messages-BpA30dPf.mjs → chunks/messages-DfTU2I8J.mjs} +0 -1
- package/dist/{messages-BdA_xvxj.mjs → chunks/messages-Dhe8_mnQ.mjs} +0 -1
- package/dist/{messages-CCKZS2f4.mjs → chunks/messages-DjOY_EqX.mjs} +0 -1
- package/dist/chunks/{messages-DRYKKPk8.mjs → messages-DnPkoMz1.mjs} +0 -1
- package/dist/chunks/{messages-B_uTiuQ-.mjs → messages-DoDbCS02.mjs} +0 -1
- package/dist/chunks/{messages-CRMdL0jG.mjs → messages-DotEkUpQ.mjs} +0 -1
- package/dist/chunks/{messages-DV5c_ZRQ.mjs → messages-Dxrg70jo.mjs} +0 -1
- package/dist/chunks/{messages-CwRhVVui.mjs → messages-DziA-L3p.mjs} +0 -1
- package/dist/{messages-CkAWTSc4.mjs → chunks/messages-IJhiftj5.mjs} +0 -1
- package/dist/chunks/{messages-yuqArCc6.mjs → messages-JRavIeeW.mjs} +0 -1
- package/dist/{messages-CERs9LC9.mjs → chunks/messages-Ul43l29K2.mjs} +0 -1
- package/dist/chunks/{messages-BU_YdaAf.mjs → messages-Yk__PXZQ.mjs} +0 -1
- package/dist/{messages-BX2KVzJp2.mjs → chunks/messages-h474TGR72.mjs} +0 -1
- package/dist/chunks/{messages-M8noQ6Kp2.mjs → messages-hngFJrES2.mjs} +0 -1
- package/dist/chunks/{messages-D0v0Xa_i2.mjs → messages-kHTrX3wo2.mjs} +0 -1
- package/dist/chunks/{messages-DqGQvcXv2.mjs → messages-m6bLP64R2.mjs} +0 -1
- package/dist/chunks/{messages-ClDJuy8K2.mjs → messages-nE9Ko73n2.mjs} +0 -1
- package/dist/chunks/{messages-C0ZWDShx2.mjs → messages-ni0ahgYk2.mjs} +0 -1
- package/dist/chunks/{messages-B7LU-b6n2.mjs → messages-pKUiAqlX2.mjs} +0 -1
- package/dist/{messages-BSlQrYwp.mjs → chunks/messages-rJdSnvyi.mjs} +0 -1
- package/dist/{messages-BrPEPj382.mjs → chunks/messages-tBHnC2Rj2.mjs} +0 -1
- package/dist/chunks/{messages-Cimsel4e.mjs → messages-tg78NAmW.mjs} +0 -1
- package/dist/{messages-CCm71gq3.mjs → chunks/messages-uLIUXFmU.mjs} +0 -1
- package/dist/{messages-BfgHOkAy.mjs → chunks/messages-yJmwc3zD.mjs} +0 -1
- package/dist/chunks/{tools-rsbC2UUN.mjs → tools-CUIpIxxP.mjs} +645 -641
- package/dist/full.mjs +3 -3
- package/dist/locales.mjs +67 -68
- package/dist/{chunks/messages-BhZcNoIQ.mjs → messages--XEfVx572.mjs} +0 -1
- package/dist/{messages-BTNuOkhL.mjs → messages-3aRjZXpv.mjs} +0 -1
- package/dist/{chunks/messages-JyZvGvrN.mjs → messages-6G0Eia-2.mjs} +0 -1
- package/dist/{messages-C3tLCwJp2.mjs → messages-B2bHgIcC2.mjs} +0 -1
- package/dist/{messages-aNMLsF8T2.mjs → messages-B8M4YRFO2.mjs} +0 -1
- package/dist/{messages-Bt_9ptDu.mjs → messages-B9qltgXa.mjs} +0 -1
- package/dist/{messages-CLQvtc_8.mjs → messages-BBgyeB_N.mjs} +0 -1
- package/dist/{messages-BigRnQS92.mjs → messages-BENRci-_2.mjs} +0 -1
- package/dist/{chunks/messages-DihczS7L.mjs → messages-BOxe7ewT.mjs} +0 -1
- package/dist/{chunks/messages-CA-jms9R.mjs → messages-BP8ZuVaD.mjs} +0 -1
- package/dist/{messages-DYlxQEIv.mjs → messages-BQJzUYP-.mjs} +0 -1
- package/dist/{chunks/messages-Cn1AC0Qk.mjs → messages-BU9luYgO.mjs} +0 -1
- package/dist/{messages-CYLYnOV82.mjs → messages-BZgGD0zf2.mjs} +0 -1
- package/dist/{messages-MBBSKGjJ2.mjs → messages-BbLCMWln2.mjs} +0 -1
- package/dist/{chunks/messages-elZUbCrN.mjs → messages-BdJ1lCo_.mjs} +0 -1
- package/dist/{chunks/messages-D3JVx_CH2.mjs → messages-Be1CCcsp2.mjs} +0 -1
- package/dist/{messages-D5KmRsUV2.mjs → messages-BlnZ8CkJ2.mjs} +0 -1
- package/dist/{messages-DDGzypb4.mjs → messages-Bsz7Qgj_.mjs} +0 -1
- package/dist/{messages-DdUpYaJ1.mjs → messages-Bw-GC0m5.mjs} +0 -1
- package/dist/{chunks/messages-FB_MePlt.mjs → messages-BwdowdYD.mjs} +0 -1
- package/dist/{chunks/messages-kC92TJI72.mjs → messages-BxQ1gzJF2.mjs} +0 -1
- package/dist/{messages-C45IBZtA2.mjs → messages-BztXgybv2.mjs} +0 -1
- package/dist/{chunks/messages-M0HT-kBW.mjs → messages-C0gyqo4h2.mjs} +0 -1
- package/dist/{messages-DhdWq5oQ2.mjs → messages-C7R0m6oE2.mjs} +0 -1
- package/dist/{chunks/messages-CtufKbaD.mjs → messages-C8iAUPzI.mjs} +0 -1
- package/dist/{messages-BaGwIHPb2.mjs → messages-CAffVeAE2.mjs} +0 -1
- package/dist/{messages-vssmW7KO.mjs → messages-CB0RKGVM.mjs} +0 -1
- package/dist/{messages-CPx1R-PH.mjs → messages-CE305J0p.mjs} +0 -1
- package/dist/{chunks/messages-Byp0YFMg.mjs → messages-CEhkWwqI.mjs} +0 -1
- package/dist/{messages-D0i5Vdyy2.mjs → messages-CJYE0_hr2.mjs} +0 -1
- package/dist/{messages-CYFdbooL2.mjs → messages-COU4L-pL2.mjs} +0 -1
- package/dist/{messages-BRPH_a6a.mjs → messages-CRMZ79Xf.mjs} +0 -1
- package/dist/{messages-CA0hwajz.mjs → messages-CVBsztOg.mjs} +0 -1
- package/dist/{messages-YfjdnhUF.mjs → messages-C_4VGaBC.mjs} +0 -1
- package/dist/{chunks/messages-D4jR5Oc-.mjs → messages-C_RPN2GV.mjs} +0 -1
- package/dist/{messages-CsM2iz1H2.mjs → messages-CaJRIGUu2.mjs} +0 -1
- package/dist/{messages-BeJaje7e2.mjs → messages-Cb5JJ8C_2.mjs} +0 -1
- package/dist/{chunks/messages-KdvbGwLH.mjs → messages-Cgy54529.mjs} +0 -1
- package/dist/{chunks/messages-CRdl14uE.mjs → messages-CkmVEyEQ2.mjs} +0 -1
- package/dist/{chunks/messages-CzCezryo.mjs → messages-CzSLUJQt.mjs} +0 -1
- package/dist/{chunks/messages-BWbZYIs12.mjs → messages-D6Sr5cUE.mjs} +0 -1
- package/dist/{messages-C0cXOCHN2.mjs → messages-DAssrN5L2.mjs} +0 -1
- package/dist/{messages-CYZVFnaF.mjs → messages-DB9U3VIh.mjs} +0 -1
- package/dist/{messages-DxKIxLKw.mjs → messages-DCOKudVN.mjs} +0 -1
- package/dist/{chunks/messages-DLrmLkco2.mjs → messages-DGZQXeav2.mjs} +0 -1
- package/dist/{chunks/messages-CqsES1wk2.mjs → messages-DZbsds_k2.mjs} +0 -1
- package/dist/{messages-RNusm48G2.mjs → messages-DkkrjINb2.mjs} +0 -1
- package/dist/{messages-DQGzw4IC.mjs → messages-DlrZrm3s.mjs} +0 -1
- package/dist/{messages-D-12TeCM2.mjs → messages-DpY9s4Qi2.mjs} +0 -1
- package/dist/{chunks/messages-BrvAiuWT.mjs → messages-DrouoDgp.mjs} +0 -1
- package/dist/{messages-DWZyaZNA.mjs → messages-GrVSCmXW.mjs} +0 -1
- package/dist/{chunks/messages-BLxyso1L.mjs → messages-K7ROT6ea.mjs} +0 -1
- package/dist/{chunks/messages-B3StvafX.mjs → messages-Kye1BINC.mjs} +0 -1
- package/dist/{chunks/messages-BdWTM73p.mjs → messages-MaHxNgKA.mjs} +0 -1
- package/dist/{messages-2iHnlF0U.mjs → messages-TseLyyoU.mjs} +0 -1
- package/dist/{chunks/messages-iWMOMK822.mjs → messages-e-KHuxtY2.mjs} +0 -1
- package/dist/{messages-DgstU8GH.mjs → messages-eCyczLYY.mjs} +0 -1
- package/dist/{messages-BFT0F9pw.mjs → messages-gldjQk7M.mjs} +0 -1
- package/dist/{chunks/messages-v1HkA3kF2.mjs → messages-huTzItxA.mjs} +0 -1
- package/dist/{messages-BEEr6Vh82.mjs → messages-m1uf_AMy2.mjs} +0 -1
- package/dist/{messages-Dc1yFFBM.mjs → messages-mVFAkdcY.mjs} +0 -1
- package/dist/{chunks/messages-tfyq1JIh2.mjs → messages-oH0ADQ362.mjs} +0 -1
- package/dist/{chunks/messages-Cuk0QaLM.mjs → messages-pgqtPci-.mjs} +0 -1
- package/dist/{messages-DuubRyFf.mjs → messages-q7HzQPVt.mjs} +0 -1
- package/dist/{messages-vfkwiKQo.mjs → messages-ruU_e2LK.mjs} +0 -1
- package/dist/{chunks/messages-Dgfbmyf-.mjs → messages-voUPclMU.mjs} +0 -1
- package/dist/{chunks/messages-DGodJU2R.mjs → messages-wRvz0vQ3.mjs} +0 -1
- package/dist/react.mjs +2 -2
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/blok.ts +0 -1
- package/src/components/constants/data-attributes.ts +2 -0
- package/src/components/core.ts +1 -1
- package/src/components/i18n/locales/am/messages.json +0 -1
- package/src/components/i18n/locales/ar/messages.json +0 -1
- package/src/components/i18n/locales/az/messages.json +0 -1
- package/src/components/i18n/locales/bg/messages.json +0 -1
- package/src/components/i18n/locales/bn/messages.json +0 -1
- package/src/components/i18n/locales/bs/messages.json +0 -1
- package/src/components/i18n/locales/cs/messages.json +0 -1
- package/src/components/i18n/locales/da/messages.json +0 -1
- package/src/components/i18n/locales/de/messages.json +0 -1
- package/src/components/i18n/locales/dv/messages.json +0 -1
- package/src/components/i18n/locales/el/messages.json +0 -1
- package/src/components/i18n/locales/en/messages.json +0 -1
- package/src/components/i18n/locales/es/messages.json +0 -1
- package/src/components/i18n/locales/et/messages.json +0 -1
- package/src/components/i18n/locales/fa/messages.json +0 -1
- package/src/components/i18n/locales/fi/messages.json +0 -1
- package/src/components/i18n/locales/fil/messages.json +0 -1
- package/src/components/i18n/locales/fr/messages.json +1 -2
- package/src/components/i18n/locales/gu/messages.json +0 -1
- package/src/components/i18n/locales/he/messages.json +0 -1
- package/src/components/i18n/locales/hi/messages.json +0 -1
- package/src/components/i18n/locales/hr/messages.json +0 -1
- package/src/components/i18n/locales/hu/messages.json +0 -1
- package/src/components/i18n/locales/hy/messages.json +0 -1
- package/src/components/i18n/locales/id/messages.json +0 -1
- package/src/components/i18n/locales/it/messages.json +0 -1
- package/src/components/i18n/locales/ja/messages.json +0 -1
- package/src/components/i18n/locales/ka/messages.json +0 -1
- package/src/components/i18n/locales/km/messages.json +0 -1
- package/src/components/i18n/locales/kn/messages.json +0 -1
- package/src/components/i18n/locales/ko/messages.json +0 -1
- package/src/components/i18n/locales/ku/messages.json +0 -1
- package/src/components/i18n/locales/lo/messages.json +0 -1
- package/src/components/i18n/locales/lt/messages.json +0 -1
- package/src/components/i18n/locales/lv/messages.json +0 -1
- package/src/components/i18n/locales/mk/messages.json +0 -1
- package/src/components/i18n/locales/ml/messages.json +0 -1
- package/src/components/i18n/locales/mn/messages.json +0 -1
- package/src/components/i18n/locales/mr/messages.json +0 -1
- package/src/components/i18n/locales/ms/messages.json +0 -1
- package/src/components/i18n/locales/my/messages.json +0 -1
- package/src/components/i18n/locales/ne/messages.json +0 -1
- package/src/components/i18n/locales/nl/messages.json +0 -1
- package/src/components/i18n/locales/no/messages.json +0 -1
- package/src/components/i18n/locales/pa/messages.json +0 -1
- package/src/components/i18n/locales/pl/messages.json +0 -1
- package/src/components/i18n/locales/ps/messages.json +0 -1
- package/src/components/i18n/locales/pt/messages.json +0 -1
- package/src/components/i18n/locales/ro/messages.json +0 -1
- package/src/components/i18n/locales/ru/messages.json +0 -1
- package/src/components/i18n/locales/sd/messages.json +0 -1
- package/src/components/i18n/locales/si/messages.json +0 -1
- package/src/components/i18n/locales/sk/messages.json +0 -1
- package/src/components/i18n/locales/sl/messages.json +0 -1
- package/src/components/i18n/locales/sq/messages.json +0 -1
- package/src/components/i18n/locales/sr/messages.json +0 -1
- package/src/components/i18n/locales/sv/messages.json +0 -1
- package/src/components/i18n/locales/sw/messages.json +0 -1
- package/src/components/i18n/locales/ta/messages.json +0 -1
- package/src/components/i18n/locales/te/messages.json +0 -1
- package/src/components/i18n/locales/th/messages.json +0 -1
- package/src/components/i18n/locales/tr/messages.json +0 -1
- package/src/components/i18n/locales/ug/messages.json +0 -1
- package/src/components/i18n/locales/uk/messages.json +0 -1
- package/src/components/i18n/locales/ur/messages.json +0 -1
- package/src/components/i18n/locales/vi/messages.json +0 -1
- package/src/components/i18n/locales/yi/messages.json +0 -1
- package/src/components/i18n/locales/zh/messages.json +0 -1
- package/src/components/icons/index.ts +0 -16
- package/src/components/modules/api/index.ts +1 -1
- package/src/components/modules/api/theme.ts +17 -0
- package/src/components/modules/index.ts +8 -6
- package/src/components/modules/themeManager.ts +160 -0
- package/src/components/modules/toolbar/blockSettings.ts +12 -0
- package/src/components/modules/toolbar/index.ts +27 -1
- package/src/components/ui/toolbox.ts +3 -1
- package/src/components/utils/data-model-transform.ts +149 -5
- package/src/components/utils/popover/popover-desktop.ts +329 -44
- package/src/styles/main.css +1 -1
- package/src/tools/toggle/index.ts +14 -0
- package/src/types-internal/blok-modules.d.ts +6 -4
- package/types/api/index.d.ts +2 -1
- package/types/api/theme.d.ts +29 -0
- package/types/configs/blok-config.d.ts +10 -20
- package/types/index.d.ts +8 -4
- package/types/utils/popover/popover.d.ts +7 -0
- package/src/components/block-tunes/block-tune-width.ts +0 -39
- package/src/components/modules/api/width.ts +0 -17
- package/src/components/modules/widthManager.ts +0 -69
- package/types/api/width.d.ts +0 -19
|
@@ -436,6 +436,15 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
436
436
|
|
|
437
437
|
if (blockContentElement) {
|
|
438
438
|
this.toolboxInstance.updateLeftAlignElement(blockContentElement);
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Sync toolbar content wrapper's margin with the block content element
|
|
442
|
+
* so toolbar buttons align with the block content edge, even when
|
|
443
|
+
* consumer CSS overrides the block content's margin.
|
|
444
|
+
*/
|
|
445
|
+
if (this.nodes.content) {
|
|
446
|
+
this.nodes.content.style.marginLeft = getComputedStyle(blockContentElement).marginLeft;
|
|
447
|
+
}
|
|
439
448
|
}
|
|
440
449
|
|
|
441
450
|
/**
|
|
@@ -554,6 +563,20 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
554
563
|
targetBlock.setupDraggable(settingsToggler, this.Blok.DragManager);
|
|
555
564
|
}
|
|
556
565
|
|
|
566
|
+
/**
|
|
567
|
+
* Sync toolbar content wrapper's margin with the block content element
|
|
568
|
+
* so toolbar buttons align with the block content edge.
|
|
569
|
+
*/
|
|
570
|
+
const blockContentElement = targetBlockHolder.querySelector<HTMLElement>(`[${DATA_ATTR.elementContent}]`);
|
|
571
|
+
|
|
572
|
+
if (blockContentElement) {
|
|
573
|
+
this.toolboxInstance.updateLeftAlignElement(blockContentElement);
|
|
574
|
+
|
|
575
|
+
if (this.nodes.content) {
|
|
576
|
+
this.nodes.content.style.marginLeft = getComputedStyle(blockContentElement).marginLeft;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
557
580
|
/**
|
|
558
581
|
* Reset content offset for multi-block selection
|
|
559
582
|
*/
|
|
@@ -620,11 +643,14 @@ export class Toolbar extends Module<ToolbarNodes> {
|
|
|
620
643
|
}
|
|
621
644
|
|
|
622
645
|
/**
|
|
623
|
-
* Reset the content offset transform
|
|
646
|
+
* Reset the content offset transform and margin sync
|
|
624
647
|
*/
|
|
625
648
|
if (this.nodes.actions) {
|
|
626
649
|
this.nodes.actions.style.transform = '';
|
|
627
650
|
}
|
|
651
|
+
if (this.nodes.content) {
|
|
652
|
+
this.nodes.content.style.marginLeft = '';
|
|
653
|
+
}
|
|
628
654
|
this.positioner.setHoveredTarget(null);
|
|
629
655
|
|
|
630
656
|
this.reset();
|
|
@@ -375,6 +375,7 @@ export class Toolbox extends EventsDispatcher<ToolboxEventMap> {
|
|
|
375
375
|
},
|
|
376
376
|
items: this.toolboxItemsToBeDisplayed,
|
|
377
377
|
handleContentEditableNavigation: true,
|
|
378
|
+
minWidth: '250px',
|
|
378
379
|
});
|
|
379
380
|
|
|
380
381
|
this.popover.on(PopoverEvent.Closed, this.onPopoverClose);
|
|
@@ -478,7 +479,8 @@ export class Toolbox extends EventsDispatcher<ToolboxEventMap> {
|
|
|
478
479
|
const toPopoverItem = (toolboxItem: ToolboxConfigEntry, tool: BlockToolAdapter, displaySecondaryLabel = true): PopoverItemParams => {
|
|
479
480
|
// Get English title for search fallback
|
|
480
481
|
const titleKey = toolboxItem.titleKey;
|
|
481
|
-
const
|
|
482
|
+
const resolvedTitleKey = titleKey?.includes('.') ? titleKey : `toolNames.${titleKey}`;
|
|
483
|
+
const englishTitleKey = titleKey ? resolvedTitleKey : undefined;
|
|
482
484
|
const englishTitle = englishTitleKey
|
|
483
485
|
? this.api.i18n.getEnglishTranslation(englishTitleKey)
|
|
484
486
|
: toolboxItem.title;
|
|
@@ -39,6 +39,20 @@ interface LegacyListData {
|
|
|
39
39
|
start?: number;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Legacy toggle list data structure for data model transformation.
|
|
44
|
+
* Old format: { title: string, isExpanded?: boolean, body: { blocks: [], time, version } }
|
|
45
|
+
*/
|
|
46
|
+
interface LegacyToggleListData {
|
|
47
|
+
title: string;
|
|
48
|
+
isExpanded?: boolean;
|
|
49
|
+
body?: {
|
|
50
|
+
time?: number;
|
|
51
|
+
blocks?: OutputBlockData[];
|
|
52
|
+
version?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
/**
|
|
43
57
|
* Result of analyzing the input data format
|
|
44
58
|
*/
|
|
@@ -143,6 +157,20 @@ const isLegacyListBlock = (block: OutputBlockData): block is OutputBlockData<str
|
|
|
143
157
|
return block.type === 'list' && isLegacyListData(block.data);
|
|
144
158
|
};
|
|
145
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Check if a block is in legacy toggleList format
|
|
162
|
+
* Legacy format: { type: "toggleList", data: { title: "...", body: { blocks: [...] } } }
|
|
163
|
+
*/
|
|
164
|
+
const isLegacyToggleListBlock = (block: OutputBlockData): block is OutputBlockData<string, LegacyToggleListData> => {
|
|
165
|
+
if (block.type !== 'toggleList') {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const data = block.data as Record<string, unknown>;
|
|
170
|
+
|
|
171
|
+
return typeof data === 'object' && data !== null && 'title' in data;
|
|
172
|
+
};
|
|
173
|
+
|
|
146
174
|
/**
|
|
147
175
|
* Check if a block contains nested hierarchy in its items
|
|
148
176
|
*/
|
|
@@ -179,9 +207,14 @@ export const analyzeDataFormat = (blocks: OutputBlockData[]): DataFormatAnalysis
|
|
|
179
207
|
// Check if any block uses legacy list format (items[] array)
|
|
180
208
|
const foundLegacyList = blocks.some(isLegacyListBlock);
|
|
181
209
|
|
|
182
|
-
if
|
|
210
|
+
// Check if any block uses legacy toggleList format
|
|
211
|
+
const foundLegacyToggle = blocks.some(isLegacyToggleListBlock);
|
|
212
|
+
|
|
213
|
+
if (foundLegacyList || foundLegacyToggle) {
|
|
183
214
|
// Check if there's actual nesting for the hasHierarchy flag
|
|
184
|
-
const hasNesting = blocks.some(hasNestedItems)
|
|
215
|
+
const hasNesting = blocks.some(hasNestedItems) || blocks.some(block =>
|
|
216
|
+
isLegacyToggleListBlock(block) && block.data.body?.blocks !== undefined && block.data.body.blocks.length > 0
|
|
217
|
+
);
|
|
185
218
|
|
|
186
219
|
return { format: 'legacy', hasHierarchy: hasNesting };
|
|
187
220
|
}
|
|
@@ -268,6 +301,49 @@ const expandListToHierarchical = (
|
|
|
268
301
|
return blocks;
|
|
269
302
|
};
|
|
270
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Expand a legacy toggleList block into flat toggle block + child blocks
|
|
306
|
+
*/
|
|
307
|
+
const expandToggleListToHierarchical = (
|
|
308
|
+
block: OutputBlockData<string, LegacyToggleListData>
|
|
309
|
+
): OutputBlockData[] => {
|
|
310
|
+
const blocks: OutputBlockData[] = [];
|
|
311
|
+
const toggleId = block.id ?? generateBlockId();
|
|
312
|
+
const bodyBlocks = block.data.body?.blocks ?? [];
|
|
313
|
+
|
|
314
|
+
// Collect child IDs, ensuring each child has an ID
|
|
315
|
+
const childIds: BlockId[] = [];
|
|
316
|
+
const childBlocks: OutputBlockData[] = [];
|
|
317
|
+
|
|
318
|
+
for (const childBlock of bodyBlocks) {
|
|
319
|
+
const childId = childBlock.id ?? generateBlockId();
|
|
320
|
+
|
|
321
|
+
childIds.push(childId);
|
|
322
|
+
childBlocks.push({
|
|
323
|
+
...childBlock,
|
|
324
|
+
id: childId,
|
|
325
|
+
parent: toggleId,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Create the toggle block with mapped fields
|
|
330
|
+
const toggleBlock: OutputBlockData = {
|
|
331
|
+
id: toggleId,
|
|
332
|
+
type: 'toggle',
|
|
333
|
+
data: {
|
|
334
|
+
text: block.data.title,
|
|
335
|
+
...(typeof block.data.isExpanded === 'boolean' ? { isOpen: block.data.isExpanded } : {}),
|
|
336
|
+
},
|
|
337
|
+
...(block.tunes !== undefined ? { tunes: block.tunes } : {}),
|
|
338
|
+
...(childIds.length > 0 ? { content: childIds } : {}),
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
blocks.push(toggleBlock);
|
|
342
|
+
blocks.push(...childBlocks);
|
|
343
|
+
|
|
344
|
+
return blocks;
|
|
345
|
+
};
|
|
346
|
+
|
|
271
347
|
/**
|
|
272
348
|
* Expand legacy nested format to hierarchical flat-with-references format
|
|
273
349
|
* @param blocks - array of blocks potentially containing nested structures
|
|
@@ -282,6 +358,11 @@ export const expandToHierarchical = (blocks: OutputBlockData[]): OutputBlockData
|
|
|
282
358
|
// Type guard narrows block.data to LegacyListData
|
|
283
359
|
const expanded = expandListToHierarchical(block.data, block.tunes);
|
|
284
360
|
|
|
361
|
+
expandedBlocks.push(...expanded);
|
|
362
|
+
} else if (isLegacyToggleListBlock(block)) {
|
|
363
|
+
// Expand toggleList to flat toggle + child blocks
|
|
364
|
+
const expanded = expandToggleListToHierarchical(block);
|
|
365
|
+
|
|
285
366
|
expandedBlocks.push(...expanded);
|
|
286
367
|
} else {
|
|
287
368
|
// Non-list blocks pass through unchanged (with guaranteed ID)
|
|
@@ -411,6 +492,60 @@ const processRootListItem = (
|
|
|
411
492
|
return listBlock;
|
|
412
493
|
};
|
|
413
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Process a root toggle block and convert to a legacy toggleList block
|
|
497
|
+
*/
|
|
498
|
+
const processRootToggleItem = (
|
|
499
|
+
block: OutputBlockData,
|
|
500
|
+
blockMap: Map<BlockId, OutputBlockData>,
|
|
501
|
+
processedIds: Set<BlockId>
|
|
502
|
+
): OutputBlockData => {
|
|
503
|
+
markBlockAsProcessed(block.id, processedIds);
|
|
504
|
+
|
|
505
|
+
const data: unknown = block.data;
|
|
506
|
+
const text = isObjectWithText(data) ? data.text : '';
|
|
507
|
+
const isOpen = typeof (data as Record<string, unknown>)?.isOpen === 'boolean'
|
|
508
|
+
? (data as Record<string, unknown>).isOpen as boolean
|
|
509
|
+
: undefined;
|
|
510
|
+
|
|
511
|
+
// Collect child blocks
|
|
512
|
+
const childBlocks: OutputBlockData[] = [];
|
|
513
|
+
const contentIds = block.content ?? [];
|
|
514
|
+
|
|
515
|
+
for (const childId of contentIds) {
|
|
516
|
+
const childBlock = blockMap.get(childId);
|
|
517
|
+
|
|
518
|
+
if (childBlock) {
|
|
519
|
+
markBlockAsProcessed(childId, processedIds);
|
|
520
|
+
childBlocks.push(stripHierarchyFields(childBlock));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const legacyBlock: OutputBlockData = {
|
|
525
|
+
id: block.id,
|
|
526
|
+
type: 'toggleList',
|
|
527
|
+
data: {
|
|
528
|
+
title: text,
|
|
529
|
+
...(isOpen !== undefined ? { isExpanded: isOpen } : {}),
|
|
530
|
+
...(childBlocks.length > 0 ? {
|
|
531
|
+
body: {
|
|
532
|
+
blocks: childBlocks,
|
|
533
|
+
},
|
|
534
|
+
} : {}),
|
|
535
|
+
},
|
|
536
|
+
...(block.tunes !== undefined ? { tunes: block.tunes } : {}),
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
return legacyBlock;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Check if a block is a flat-model toggle block
|
|
544
|
+
*/
|
|
545
|
+
const isFlatModelToggleBlock = (block: OutputBlockData): boolean => {
|
|
546
|
+
return block.type === 'toggle';
|
|
547
|
+
};
|
|
548
|
+
|
|
414
549
|
/**
|
|
415
550
|
* Check if a block is a flat-model list block (has 'text' field instead of 'items')
|
|
416
551
|
*/
|
|
@@ -441,10 +576,11 @@ export const collapseToLegacy = (blocks: OutputBlockData[]): OutputBlockData[] =
|
|
|
441
576
|
}
|
|
442
577
|
}
|
|
443
578
|
|
|
444
|
-
// If no flat-model list blocks, just strip hierarchy fields and return
|
|
579
|
+
// If no flat-model list or toggle blocks, just strip hierarchy fields and return
|
|
445
580
|
const hasFlatListBlocks = blocks.some(isFlatModelListBlock);
|
|
581
|
+
const hasFlatToggleBlocks = blocks.some(isFlatModelToggleBlock);
|
|
446
582
|
|
|
447
|
-
if (!hasFlatListBlocks) {
|
|
583
|
+
if (!hasFlatListBlocks && !hasFlatToggleBlocks) {
|
|
448
584
|
return blocks.map(stripHierarchyFields);
|
|
449
585
|
}
|
|
450
586
|
|
|
@@ -461,7 +597,9 @@ export const collapseToLegacy = (blocks: OutputBlockData[]): OutputBlockData[] =
|
|
|
461
597
|
|
|
462
598
|
const isFlatListBlock = isFlatModelListBlock(block);
|
|
463
599
|
const isRootListItem = isFlatListBlock && !block.parent;
|
|
464
|
-
const
|
|
600
|
+
const isFlatToggleBlock = isFlatModelToggleBlock(block);
|
|
601
|
+
const isRootToggleItem = isFlatToggleBlock && !block.parent;
|
|
602
|
+
const isNonListItem = !isFlatListBlock && !isFlatToggleBlock;
|
|
465
603
|
|
|
466
604
|
if (isRootListItem) {
|
|
467
605
|
const listBlock = processRootListItem(block, blockMap, processedIds);
|
|
@@ -469,6 +607,12 @@ export const collapseToLegacy = (blocks: OutputBlockData[]): OutputBlockData[] =
|
|
|
469
607
|
result.push(listBlock);
|
|
470
608
|
}
|
|
471
609
|
|
|
610
|
+
if (isRootToggleItem) {
|
|
611
|
+
const toggleBlock = processRootToggleItem(block, blockMap, processedIds);
|
|
612
|
+
|
|
613
|
+
result.push(toggleBlock);
|
|
614
|
+
}
|
|
615
|
+
|
|
472
616
|
if (isNonListItem) {
|
|
473
617
|
result.push(stripHierarchyFields(block));
|
|
474
618
|
markBlockAsProcessed(block.id, processedIds);
|