@jackuait/blok 0.4.1 → 0.4.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/README.md +136 -17
- package/codemod/README.md +16 -0
- package/codemod/migrate-editorjs-to-blok.js +859 -92
- package/codemod/test.js +682 -77
- package/dist/blok.mjs +5 -2
- package/dist/chunks/blok-BjgH1REI.mjs +12838 -0
- package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
- package/dist/chunks/i18next-loader-DfiUa_gd.mjs +43 -0
- package/dist/{index-CBkApZKo.mjs → chunks/index-5m5JWNey.mjs} +2 -2
- package/dist/chunks/inline-tool-convert-Bx5BVd8I.mjs +1988 -0
- package/dist/chunks/messages-2434tVOK.mjs +47 -0
- package/dist/chunks/messages-3DcCwXMF.mjs +47 -0
- package/dist/chunks/messages-4kMwVAKY.mjs +47 -0
- package/dist/chunks/messages-57uL5htT.mjs +47 -0
- package/dist/chunks/messages-76-iJV9Q.mjs +47 -0
- package/dist/chunks/messages-8p86Eyf2.mjs +47 -0
- package/dist/chunks/messages-BBX0p0Pi.mjs +47 -0
- package/dist/chunks/messages-BCm2eudQ.mjs +47 -0
- package/dist/chunks/messages-BFiUomgG.mjs +47 -0
- package/dist/chunks/messages-BIPNHHAV.mjs +47 -0
- package/dist/chunks/messages-BUlwu9mo.mjs +47 -0
- package/dist/chunks/messages-BX-DPa-z.mjs +47 -0
- package/dist/chunks/messages-BextV3Qh.mjs +47 -0
- package/dist/chunks/messages-BiPSFlUG.mjs +47 -0
- package/dist/chunks/messages-BiXe9G-O.mjs +47 -0
- package/dist/chunks/messages-Bl5z_Igo.mjs +47 -0
- package/dist/chunks/messages-BnsE97ku.mjs +47 -0
- package/dist/chunks/messages-BoO8gsVD.mjs +47 -0
- package/dist/chunks/messages-BqWaOGMn.mjs +47 -0
- package/dist/chunks/messages-BqkL2_Ro.mjs +47 -0
- package/dist/chunks/messages-BvCkXKX-.mjs +47 -0
- package/dist/chunks/messages-C6tbPLoj.mjs +47 -0
- package/dist/chunks/messages-CA6T3-gQ.mjs +47 -0
- package/dist/chunks/messages-CFFPFdWP.mjs +47 -0
- package/dist/chunks/messages-CFrKE-TN.mjs +47 -0
- package/dist/chunks/messages-CHz8VlG-.mjs +47 -0
- package/dist/chunks/messages-CLixzySl.mjs +47 -0
- package/dist/chunks/messages-CV7OM_qk.mjs +47 -0
- package/dist/chunks/messages-CXHt3eCC.mjs +47 -0
- package/dist/chunks/messages-CbmsBrB0.mjs +47 -0
- package/dist/chunks/messages-Ceo1KtFx.mjs +47 -0
- package/dist/chunks/messages-Cm0LJLtB.mjs +47 -0
- package/dist/chunks/messages-CmymP_Ar.mjs +47 -0
- package/dist/chunks/messages-D0ohMB5H.mjs +47 -0
- package/dist/chunks/messages-D3GrDwXh.mjs +47 -0
- package/dist/chunks/messages-D3vTzIpL.mjs +47 -0
- package/dist/chunks/messages-D5WeksbV.mjs +47 -0
- package/dist/chunks/messages-DGaab4EP.mjs +47 -0
- package/dist/chunks/messages-DKha57ZU.mjs +47 -0
- package/dist/chunks/messages-DOaujgMW.mjs +47 -0
- package/dist/chunks/messages-DVbPLd_0.mjs +47 -0
- package/dist/chunks/messages-D_FCyfW6.mjs +47 -0
- package/dist/chunks/messages-Dd5iZN3c.mjs +47 -0
- package/dist/chunks/messages-DehM7135.mjs +47 -0
- package/dist/chunks/messages-Dg1OHftD.mjs +47 -0
- package/dist/chunks/messages-Di6Flq-b.mjs +47 -0
- package/dist/chunks/messages-Dqhhex6e.mjs +47 -0
- package/dist/chunks/messages-DueVe0F1.mjs +47 -0
- package/dist/chunks/messages-Dx3eFwI0.mjs +47 -0
- package/dist/chunks/messages-FOtiUoKl.mjs +47 -0
- package/dist/chunks/messages-FTOZNhRD.mjs +47 -0
- package/dist/chunks/messages-IQxGfQIV.mjs +47 -0
- package/dist/chunks/messages-JF2fzCkK.mjs +47 -0
- package/dist/chunks/messages-MOGl7I5v.mjs +47 -0
- package/dist/chunks/messages-QgYhPL-3.mjs +47 -0
- package/dist/chunks/messages-WYWIbQwo.mjs +47 -0
- package/dist/chunks/messages-a6A_LgDv.mjs +47 -0
- package/dist/chunks/messages-bSf31LJi.mjs +47 -0
- package/dist/chunks/messages-diGozhTn.mjs +47 -0
- package/dist/chunks/messages-er-kd-VO.mjs +47 -0
- package/dist/chunks/messages-ez3w5NBn.mjs +47 -0
- package/dist/chunks/messages-f3uXjegd.mjs +47 -0
- package/dist/chunks/messages-ohwI1UGv.mjs +47 -0
- package/dist/chunks/messages-p9BZJaFV.mjs +47 -0
- package/dist/chunks/messages-qIQ4L4rw.mjs +47 -0
- package/dist/chunks/messages-qWkXPggi.mjs +47 -0
- package/dist/chunks/messages-w5foGze_.mjs +47 -0
- package/dist/full.mjs +50 -0
- package/dist/locales.mjs +227 -0
- package/dist/messages-2434tVOK.mjs +47 -0
- package/dist/messages-3DcCwXMF.mjs +47 -0
- package/dist/messages-4kMwVAKY.mjs +47 -0
- package/dist/messages-57uL5htT.mjs +47 -0
- package/dist/messages-76-iJV9Q.mjs +47 -0
- package/dist/messages-8p86Eyf2.mjs +47 -0
- package/dist/messages-BBX0p0Pi.mjs +47 -0
- package/dist/messages-BCm2eudQ.mjs +47 -0
- package/dist/messages-BFiUomgG.mjs +47 -0
- package/dist/messages-BIPNHHAV.mjs +47 -0
- package/dist/messages-BUlwu9mo.mjs +47 -0
- package/dist/messages-BX-DPa-z.mjs +47 -0
- package/dist/messages-BextV3Qh.mjs +47 -0
- package/dist/messages-BiPSFlUG.mjs +47 -0
- package/dist/messages-BiXe9G-O.mjs +47 -0
- package/dist/messages-Bl5z_Igo.mjs +47 -0
- package/dist/messages-BnsE97ku.mjs +47 -0
- package/dist/messages-BoO8gsVD.mjs +47 -0
- package/dist/messages-BqWaOGMn.mjs +47 -0
- package/dist/messages-BqkL2_Ro.mjs +47 -0
- package/dist/messages-BvCkXKX-.mjs +47 -0
- package/dist/messages-C6tbPLoj.mjs +47 -0
- package/dist/messages-CA6T3-gQ.mjs +47 -0
- package/dist/messages-CFFPFdWP.mjs +47 -0
- package/dist/messages-CFrKE-TN.mjs +47 -0
- package/dist/messages-CHz8VlG-.mjs +47 -0
- package/dist/messages-CLixzySl.mjs +47 -0
- package/dist/messages-CV7OM_qk.mjs +47 -0
- package/dist/messages-CXHt3eCC.mjs +47 -0
- package/dist/messages-CbmsBrB0.mjs +47 -0
- package/dist/messages-Ceo1KtFx.mjs +47 -0
- package/dist/messages-Cm0LJLtB.mjs +47 -0
- package/dist/messages-CmymP_Ar.mjs +47 -0
- package/dist/messages-D0ohMB5H.mjs +47 -0
- package/dist/messages-D3GrDwXh.mjs +47 -0
- package/dist/messages-D3vTzIpL.mjs +47 -0
- package/dist/messages-D5WeksbV.mjs +47 -0
- package/dist/messages-DGaab4EP.mjs +47 -0
- package/dist/messages-DKha57ZU.mjs +47 -0
- package/dist/messages-DOaujgMW.mjs +47 -0
- package/dist/messages-DVbPLd_0.mjs +47 -0
- package/dist/messages-D_FCyfW6.mjs +47 -0
- package/dist/messages-Dd5iZN3c.mjs +47 -0
- package/dist/messages-DehM7135.mjs +47 -0
- package/dist/messages-Dg1OHftD.mjs +47 -0
- package/dist/messages-Di6Flq-b.mjs +47 -0
- package/dist/messages-Dqhhex6e.mjs +47 -0
- package/dist/messages-DueVe0F1.mjs +47 -0
- package/dist/messages-Dx3eFwI0.mjs +47 -0
- package/dist/messages-FOtiUoKl.mjs +47 -0
- package/dist/messages-FTOZNhRD.mjs +47 -0
- package/dist/messages-IQxGfQIV.mjs +47 -0
- package/dist/messages-JF2fzCkK.mjs +47 -0
- package/dist/messages-MOGl7I5v.mjs +47 -0
- package/dist/messages-QgYhPL-3.mjs +47 -0
- package/dist/messages-WYWIbQwo.mjs +47 -0
- package/dist/messages-a6A_LgDv.mjs +47 -0
- package/dist/messages-bSf31LJi.mjs +47 -0
- package/dist/messages-diGozhTn.mjs +47 -0
- package/dist/messages-er-kd-VO.mjs +47 -0
- package/dist/messages-ez3w5NBn.mjs +47 -0
- package/dist/messages-f3uXjegd.mjs +47 -0
- package/dist/messages-ohwI1UGv.mjs +47 -0
- package/dist/messages-p9BZJaFV.mjs +47 -0
- package/dist/messages-qIQ4L4rw.mjs +47 -0
- package/dist/messages-qWkXPggi.mjs +47 -0
- package/dist/messages-w5foGze_.mjs +47 -0
- package/dist/tools.mjs +3073 -0
- package/dist/vendor.LICENSE.txt +59 -156
- package/package.json +47 -15
- package/src/blok.ts +267 -0
- package/src/components/__module.ts +139 -0
- package/src/components/block/api.ts +155 -0
- package/src/components/block/index.ts +1427 -0
- package/src/components/block-tunes/block-tune-delete.ts +51 -0
- package/src/components/blocks.ts +338 -0
- package/src/components/constants/data-attributes.ts +342 -0
- package/src/components/constants.ts +76 -0
- package/src/components/core.ts +392 -0
- package/src/components/dom.ts +773 -0
- package/src/components/domIterator.ts +189 -0
- package/src/components/errors/critical.ts +5 -0
- package/src/components/events/BlockChanged.ts +16 -0
- package/src/components/events/BlockHovered.ts +21 -0
- package/src/components/events/BlockSettingsClosed.ts +12 -0
- package/src/components/events/BlockSettingsOpened.ts +12 -0
- package/src/components/events/BlokMobileLayoutToggled.ts +15 -0
- package/src/components/events/FakeCursorAboutToBeToggled.ts +17 -0
- package/src/components/events/FakeCursorHaveBeenSet.ts +17 -0
- package/src/components/events/HistoryStateChanged.ts +19 -0
- package/src/components/events/RedactorDomChanged.ts +14 -0
- package/src/components/events/index.ts +46 -0
- package/src/components/flipper.ts +481 -0
- package/src/components/i18n/i18next-loader.ts +84 -0
- package/src/components/i18n/lightweight-i18n.ts +86 -0
- package/src/components/i18n/locales/TRANSLATION_GUIDELINES.md +113 -0
- package/src/components/i18n/locales/am/messages.json +44 -0
- package/src/components/i18n/locales/ar/messages.json +44 -0
- package/src/components/i18n/locales/az/messages.json +44 -0
- package/src/components/i18n/locales/bg/messages.json +44 -0
- package/src/components/i18n/locales/bn/messages.json +44 -0
- package/src/components/i18n/locales/bs/messages.json +44 -0
- package/src/components/i18n/locales/cs/messages.json +44 -0
- package/src/components/i18n/locales/da/messages.json +44 -0
- package/src/components/i18n/locales/de/messages.json +44 -0
- package/src/components/i18n/locales/dv/messages.json +44 -0
- package/src/components/i18n/locales/el/messages.json +44 -0
- package/src/components/i18n/locales/en/messages.json +44 -0
- package/src/components/i18n/locales/es/messages.json +44 -0
- package/src/components/i18n/locales/et/messages.json +44 -0
- package/src/components/i18n/locales/fa/messages.json +44 -0
- package/src/components/i18n/locales/fi/messages.json +44 -0
- package/src/components/i18n/locales/fil/messages.json +44 -0
- package/src/components/i18n/locales/fr/messages.json +44 -0
- package/src/components/i18n/locales/gu/messages.json +44 -0
- package/src/components/i18n/locales/he/messages.json +44 -0
- package/src/components/i18n/locales/hi/messages.json +44 -0
- package/src/components/i18n/locales/hr/messages.json +44 -0
- package/src/components/i18n/locales/hu/messages.json +44 -0
- package/src/components/i18n/locales/hy/messages.json +44 -0
- package/src/components/i18n/locales/id/messages.json +44 -0
- package/src/components/i18n/locales/index.ts +225 -0
- package/src/components/i18n/locales/it/messages.json +44 -0
- package/src/components/i18n/locales/ja/messages.json +44 -0
- package/src/components/i18n/locales/ka/messages.json +44 -0
- package/src/components/i18n/locales/km/messages.json +44 -0
- package/src/components/i18n/locales/kn/messages.json +44 -0
- package/src/components/i18n/locales/ko/messages.json +44 -0
- package/src/components/i18n/locales/ku/messages.json +44 -0
- package/src/components/i18n/locales/lo/messages.json +44 -0
- package/src/components/i18n/locales/lt/messages.json +44 -0
- package/src/components/i18n/locales/lv/messages.json +44 -0
- package/src/components/i18n/locales/mk/messages.json +44 -0
- package/src/components/i18n/locales/ml/messages.json +44 -0
- package/src/components/i18n/locales/mn/messages.json +44 -0
- package/src/components/i18n/locales/mr/messages.json +44 -0
- package/src/components/i18n/locales/ms/messages.json +44 -0
- package/src/components/i18n/locales/my/messages.json +44 -0
- package/src/components/i18n/locales/ne/messages.json +44 -0
- package/src/components/i18n/locales/nl/messages.json +44 -0
- package/src/components/i18n/locales/no/messages.json +44 -0
- package/src/components/i18n/locales/pa/messages.json +44 -0
- package/src/components/i18n/locales/pl/messages.json +44 -0
- package/src/components/i18n/locales/ps/messages.json +44 -0
- package/src/components/i18n/locales/pt/messages.json +44 -0
- package/src/components/i18n/locales/ro/messages.json +44 -0
- package/src/components/i18n/locales/ru/messages.json +44 -0
- package/src/components/i18n/locales/sd/messages.json +44 -0
- package/src/components/i18n/locales/si/messages.json +44 -0
- package/src/components/i18n/locales/sk/messages.json +44 -0
- package/src/components/i18n/locales/sl/messages.json +44 -0
- package/src/components/i18n/locales/sq/messages.json +44 -0
- package/src/components/i18n/locales/sr/messages.json +44 -0
- package/src/components/i18n/locales/sv/messages.json +44 -0
- package/src/components/i18n/locales/sw/messages.json +44 -0
- package/src/components/i18n/locales/ta/messages.json +44 -0
- package/src/components/i18n/locales/te/messages.json +44 -0
- package/src/components/i18n/locales/th/messages.json +44 -0
- package/src/components/i18n/locales/tr/messages.json +44 -0
- package/src/components/i18n/locales/ug/messages.json +44 -0
- package/src/components/i18n/locales/uk/messages.json +44 -0
- package/src/components/i18n/locales/ur/messages.json +44 -0
- package/src/components/i18n/locales/vi/messages.json +44 -0
- package/src/components/i18n/locales/yi/messages.json +44 -0
- package/src/components/i18n/locales/zh/messages.json +44 -0
- package/src/components/icons/index.ts +242 -0
- package/src/components/inline-tools/inline-tool-bold.ts +2213 -0
- package/src/components/inline-tools/inline-tool-convert.ts +141 -0
- package/src/components/inline-tools/inline-tool-italic.ts +500 -0
- package/src/components/inline-tools/inline-tool-link.ts +539 -0
- package/src/components/modules/api/blocks.ts +363 -0
- package/src/components/modules/api/caret.ts +125 -0
- package/src/components/modules/api/events.ts +51 -0
- package/src/components/modules/api/history.ts +73 -0
- package/src/components/modules/api/i18n.ts +33 -0
- package/src/components/modules/api/index.ts +39 -0
- package/src/components/modules/api/inlineToolbar.ts +33 -0
- package/src/components/modules/api/listeners.ts +56 -0
- package/src/components/modules/api/notifier.ts +46 -0
- package/src/components/modules/api/readonly.ts +39 -0
- package/src/components/modules/api/sanitizer.ts +30 -0
- package/src/components/modules/api/saver.ts +52 -0
- package/src/components/modules/api/selection.ts +48 -0
- package/src/components/modules/api/styles.ts +72 -0
- package/src/components/modules/api/toolbar.ts +79 -0
- package/src/components/modules/api/tools.ts +16 -0
- package/src/components/modules/api/tooltip.ts +67 -0
- package/src/components/modules/api/ui.ts +36 -0
- package/src/components/modules/blockEvents.ts +1375 -0
- package/src/components/modules/blockManager.ts +1348 -0
- package/src/components/modules/blockSelection.ts +708 -0
- package/src/components/modules/caret.ts +853 -0
- package/src/components/modules/crossBlockSelection.ts +329 -0
- package/src/components/modules/dragManager.ts +1141 -0
- package/src/components/modules/history.ts +1098 -0
- package/src/components/modules/i18n.ts +325 -0
- package/src/components/modules/index.ts +139 -0
- package/src/components/modules/modificationsObserver.ts +147 -0
- package/src/components/modules/paste.ts +1092 -0
- package/src/components/modules/readonly.ts +136 -0
- package/src/components/modules/rectangleSelection.ts +668 -0
- package/src/components/modules/renderer.ts +155 -0
- package/src/components/modules/saver.ts +283 -0
- package/src/components/modules/toolbar/blockSettings.ts +776 -0
- package/src/components/modules/toolbar/index.ts +1311 -0
- package/src/components/modules/toolbar/inline.ts +956 -0
- package/src/components/modules/tools.ts +589 -0
- package/src/components/modules/ui.ts +1179 -0
- package/src/components/polyfills.ts +113 -0
- package/src/components/selection.ts +1189 -0
- package/src/components/tools/base.ts +274 -0
- package/src/components/tools/block.ts +291 -0
- package/src/components/tools/collection.ts +67 -0
- package/src/components/tools/factory.ts +85 -0
- package/src/components/tools/inline.ts +71 -0
- package/src/components/tools/tune.ts +33 -0
- package/src/components/ui/toolbox.ts +497 -0
- package/src/components/utils/announcer.ts +205 -0
- package/src/components/utils/api.ts +20 -0
- package/src/components/utils/bem.ts +26 -0
- package/src/components/utils/blocks.ts +284 -0
- package/src/components/utils/caret.ts +1067 -0
- package/src/components/utils/data-model-transform.ts +382 -0
- package/src/components/utils/events.ts +117 -0
- package/src/components/utils/keyboard.ts +60 -0
- package/src/components/utils/listeners.ts +296 -0
- package/src/components/utils/mutations.ts +39 -0
- package/src/components/utils/notifier/draw.ts +190 -0
- package/src/components/utils/notifier/index.ts +66 -0
- package/src/components/utils/notifier/types.ts +1 -0
- package/src/components/utils/notifier.ts +77 -0
- package/src/components/utils/placeholder.ts +140 -0
- package/src/components/utils/popover/components/hint/hint.const.ts +10 -0
- package/src/components/utils/popover/components/hint/hint.ts +46 -0
- package/src/components/utils/popover/components/hint/index.ts +6 -0
- package/src/components/utils/popover/components/popover-header/index.ts +2 -0
- package/src/components/utils/popover/components/popover-header/popover-header.const.ts +8 -0
- package/src/components/utils/popover/components/popover-header/popover-header.ts +80 -0
- package/src/components/utils/popover/components/popover-header/popover-header.types.ts +14 -0
- package/src/components/utils/popover/components/popover-item/index.ts +13 -0
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +50 -0
- package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +666 -0
- package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.const.ts +14 -0
- package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.ts +136 -0
- package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.const.ts +20 -0
- package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.ts +117 -0
- package/src/components/utils/popover/components/popover-item/popover-item.ts +187 -0
- package/src/components/utils/popover/components/search-input/index.ts +2 -0
- package/src/components/utils/popover/components/search-input/search-input.const.ts +8 -0
- package/src/components/utils/popover/components/search-input/search-input.ts +181 -0
- package/src/components/utils/popover/components/search-input/search-input.types.ts +30 -0
- package/src/components/utils/popover/index.ts +13 -0
- package/src/components/utils/popover/popover-abstract.ts +448 -0
- package/src/components/utils/popover/popover-desktop.ts +643 -0
- package/src/components/utils/popover/popover-inline.ts +338 -0
- package/src/components/utils/popover/popover-mobile.ts +201 -0
- package/src/components/utils/popover/popover.const.ts +81 -0
- package/src/components/utils/popover/utils/popover-states-history.ts +72 -0
- package/src/components/utils/promise-queue.ts +43 -0
- package/src/components/utils/sanitizer.ts +537 -0
- package/src/components/utils/scroll-locker.ts +87 -0
- package/src/components/utils/shortcut.ts +231 -0
- package/src/components/utils/shortcuts.ts +113 -0
- package/src/components/utils/tools.ts +105 -0
- package/src/components/utils/tooltip.ts +642 -0
- package/src/components/utils/tw.ts +241 -0
- package/src/components/utils.ts +1081 -0
- package/src/env.d.ts +13 -0
- package/src/full.ts +69 -0
- package/src/locales.ts +51 -0
- package/src/stories/Block.stories.ts +498 -0
- package/src/stories/EditorModes.stories.ts +505 -0
- package/src/stories/Header.stories.ts +137 -0
- package/src/stories/InlineToolbar.stories.ts +498 -0
- package/src/stories/List.stories.ts +259 -0
- package/src/stories/Notifier.stories.ts +340 -0
- package/src/stories/Paragraph.stories.ts +112 -0
- package/src/stories/Placeholder.stories.ts +319 -0
- package/src/stories/Popover.stories.ts +844 -0
- package/src/stories/Selection.stories.ts +250 -0
- package/src/stories/StubBlock.stories.ts +156 -0
- package/src/stories/Toolbar.stories.ts +223 -0
- package/src/stories/Toolbox.stories.ts +166 -0
- package/src/stories/Tooltip.stories.ts +198 -0
- package/src/stories/helpers.ts +463 -0
- package/src/styles/main.css +123 -0
- package/src/tools/header/index.ts +570 -0
- package/src/tools/index.ts +38 -0
- package/src/tools/list/index.ts +1803 -0
- package/src/tools/paragraph/index.ts +411 -0
- package/src/tools/stub/index.ts +107 -0
- package/src/types-internal/blok-modules.d.ts +87 -0
- package/src/types-internal/html-janitor.d.ts +28 -0
- package/src/types-internal/module-config.d.ts +11 -0
- package/src/variants/all-locales.ts +155 -0
- package/src/variants/blok-maximum.ts +20 -0
- package/src/variants/blok-minimum.ts +243 -0
- package/types/api/blocks.d.ts +1 -1
- package/types/api/i18n.d.ts +5 -3
- package/types/api/selection.d.ts +6 -0
- package/types/api/styles.d.ts +0 -5
- package/types/configs/blok-config.d.ts +21 -0
- package/types/configs/i18n-config.d.ts +52 -2
- package/types/configs/i18n-dictionary.d.ts +16 -90
- package/types/data-attributes.d.ts +169 -0
- package/types/data-formats/output-data.d.ts +15 -0
- package/types/full.d.ts +80 -0
- package/types/index.d.ts +9 -24
- package/types/locales.d.ts +59 -0
- package/types/tools/adapters/inline-tool-adapter.d.ts +10 -0
- package/types/tools/block-tool.d.ts +9 -0
- package/types/tools/list.d.ts +25 -18
- package/types/tools/tool-settings.d.ts +8 -1
- package/types/tools/tool.d.ts +6 -0
- package/types/tools-entry.d.ts +49 -0
- package/types/utils/popover/popover-item.d.ts +0 -5
- package/dist/blok-BwPfU8ro.mjs +0 -21510
- package/dist/blok.umd.js +0 -198
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storybook test helpers for Blok editor stories.
|
|
3
|
+
* These utilities help work around browser environment differences in Chromatic.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Blok } from '../blok';
|
|
7
|
+
import type { OutputData, BlokConfig, ToolConstructable, ToolSettings, I18nConfig } from '@/types';
|
|
8
|
+
import { Paragraph } from '../tools/paragraph';
|
|
9
|
+
import { Header } from '../tools/header';
|
|
10
|
+
import { ListItem } from '../tools/list';
|
|
11
|
+
import { BoldInlineTool } from '../components/inline-tools/inline-tool-bold';
|
|
12
|
+
import { ItalicInlineTool } from '../components/inline-tools/inline-tool-italic';
|
|
13
|
+
import { LinkInlineTool } from '../components/inline-tools/inline-tool-link';
|
|
14
|
+
import { ConvertInlineTool } from '../components/inline-tools/inline-tool-convert';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Default tools configuration for Storybook stories.
|
|
18
|
+
* Since tools are no longer bundled by default, stories need to explicitly include them.
|
|
19
|
+
*/
|
|
20
|
+
export const defaultTools: { [toolName: string]: ToolConstructable | ToolSettings } = {
|
|
21
|
+
paragraph: {
|
|
22
|
+
class: Paragraph,
|
|
23
|
+
inlineToolbar: true,
|
|
24
|
+
config: { preserveBlank: true },
|
|
25
|
+
},
|
|
26
|
+
header: {
|
|
27
|
+
class: Header,
|
|
28
|
+
inlineToolbar: true,
|
|
29
|
+
},
|
|
30
|
+
list: {
|
|
31
|
+
class: ListItem,
|
|
32
|
+
inlineToolbar: true,
|
|
33
|
+
},
|
|
34
|
+
bold: BoldInlineTool,
|
|
35
|
+
italic: ItalicInlineTool,
|
|
36
|
+
link: LinkInlineTool,
|
|
37
|
+
convertTo: ConvertInlineTool,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Test ID selectors used in story tests
|
|
42
|
+
*/
|
|
43
|
+
export const TOOLBAR_TESTID = '[data-blok-testid="toolbar"]';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Configuration options for the shared editor factory
|
|
47
|
+
*/
|
|
48
|
+
export interface EditorFactoryOptions {
|
|
49
|
+
/** Minimum height of the editor container in pixels */
|
|
50
|
+
minHeight?: number;
|
|
51
|
+
/** Width of the editor container in pixels (optional, defaults to auto) */
|
|
52
|
+
width?: number;
|
|
53
|
+
/** Initial data to populate the editor */
|
|
54
|
+
data?: OutputData;
|
|
55
|
+
/** Whether the editor is read-only */
|
|
56
|
+
readOnly?: boolean;
|
|
57
|
+
/** Placeholder text for empty blocks */
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
/** Whether to autofocus the editor */
|
|
60
|
+
autofocus?: boolean;
|
|
61
|
+
/** Tools configuration */
|
|
62
|
+
tools?: { [toolName: string]: ToolConstructable | ToolSettings };
|
|
63
|
+
/** i18n configuration (e.g., for RTL support) */
|
|
64
|
+
i18n?: I18nConfig;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Extended HTMLElement interface that stores the Blok editor instance
|
|
69
|
+
*/
|
|
70
|
+
export interface EditorContainer extends HTMLElement {
|
|
71
|
+
__blokEditor?: Blok;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Shared editor state to avoid let declarations */
|
|
75
|
+
const editorState: { editor: Blok | null; holder: HTMLElement | null } = {
|
|
76
|
+
editor: null,
|
|
77
|
+
holder: null,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Creates an editor container with a Blok editor instance.
|
|
82
|
+
* Reuses a single shared editor instance across stories when possible.
|
|
83
|
+
*
|
|
84
|
+
* @param options - Configuration options for the editor
|
|
85
|
+
* @returns HTMLElement container with the editor
|
|
86
|
+
*/
|
|
87
|
+
export const createEditorContainer = (options: EditorFactoryOptions = {}): HTMLElement => {
|
|
88
|
+
const {
|
|
89
|
+
minHeight = 300,
|
|
90
|
+
width,
|
|
91
|
+
data,
|
|
92
|
+
readOnly = false,
|
|
93
|
+
placeholder,
|
|
94
|
+
autofocus = false,
|
|
95
|
+
tools,
|
|
96
|
+
i18n,
|
|
97
|
+
} = options;
|
|
98
|
+
|
|
99
|
+
const container = document.createElement('div') as EditorContainer;
|
|
100
|
+
|
|
101
|
+
container.style.border = '1px solid #e0e0e0';
|
|
102
|
+
container.style.borderRadius = '8px';
|
|
103
|
+
container.style.padding = '16px';
|
|
104
|
+
container.style.minHeight = `${minHeight}px`;
|
|
105
|
+
container.style.backgroundColor = '#fff';
|
|
106
|
+
container.setAttribute('data-story-container', 'true');
|
|
107
|
+
|
|
108
|
+
if (width) {
|
|
109
|
+
container.style.width = `${width}px`;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const editorHolder = document.createElement('div');
|
|
113
|
+
|
|
114
|
+
editorHolder.id = `blok-editor-${Date.now()}`;
|
|
115
|
+
container.appendChild(editorHolder);
|
|
116
|
+
|
|
117
|
+
// Merge default tools with user-provided tools (user tools override defaults)
|
|
118
|
+
const mergedTools = { ...defaultTools, ...tools };
|
|
119
|
+
|
|
120
|
+
const config: BlokConfig = {
|
|
121
|
+
holder: editorHolder,
|
|
122
|
+
autofocus,
|
|
123
|
+
readOnly,
|
|
124
|
+
data,
|
|
125
|
+
placeholder,
|
|
126
|
+
tools: mergedTools,
|
|
127
|
+
i18n,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Clean up and initialize editor after DOM is ready
|
|
131
|
+
setTimeout(async () => {
|
|
132
|
+
// Destroy previous editor if it exists and holder changed
|
|
133
|
+
if (editorState.editor && editorState.holder !== editorHolder) {
|
|
134
|
+
try {
|
|
135
|
+
await editorState.editor.destroy();
|
|
136
|
+
} catch {
|
|
137
|
+
// Editor may already be destroyed
|
|
138
|
+
}
|
|
139
|
+
editorState.editor = null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Create new editor instance
|
|
143
|
+
const editor = new Blok(config);
|
|
144
|
+
|
|
145
|
+
await editor.isReady;
|
|
146
|
+
await waitForIdleCallback();
|
|
147
|
+
|
|
148
|
+
// Store references
|
|
149
|
+
editorState.editor = editor;
|
|
150
|
+
editorState.holder = editorHolder;
|
|
151
|
+
container.__blokEditor = editor;
|
|
152
|
+
}, 0);
|
|
153
|
+
|
|
154
|
+
return container;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Gets the current shared editor instance (if available)
|
|
159
|
+
*/
|
|
160
|
+
export const getSharedEditor = (): Blok | null => editorState.editor;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Cleans up the shared editor instance
|
|
164
|
+
*/
|
|
165
|
+
export const destroySharedEditor = async (): Promise<void> => {
|
|
166
|
+
if (editorState.editor) {
|
|
167
|
+
try {
|
|
168
|
+
await editorState.editor.destroy();
|
|
169
|
+
} catch {
|
|
170
|
+
// Editor may already be destroyed
|
|
171
|
+
}
|
|
172
|
+
editorState.editor = null;
|
|
173
|
+
editorState.holder = null;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Simulates a full click sequence (mousedown → mouseup → click) with proper event bubbling.
|
|
179
|
+
* This is needed because userEvent.click() doesn't properly trigger mousedown events
|
|
180
|
+
* in headless browser environments like Chromatic.
|
|
181
|
+
*/
|
|
182
|
+
export const simulateClick = (element: Element): void => {
|
|
183
|
+
const rect = element.getBoundingClientRect();
|
|
184
|
+
const clientX = rect.left + rect.width / 2;
|
|
185
|
+
const clientY = rect.top + rect.height / 2;
|
|
186
|
+
|
|
187
|
+
const eventOptions = {
|
|
188
|
+
bubbles: true,
|
|
189
|
+
cancelable: true,
|
|
190
|
+
clientX,
|
|
191
|
+
clientY,
|
|
192
|
+
button: 0,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
element.dispatchEvent(new MouseEvent('mousedown', eventOptions));
|
|
196
|
+
element.dispatchEvent(new MouseEvent('mouseup', eventOptions));
|
|
197
|
+
element.dispatchEvent(new MouseEvent('click', eventOptions));
|
|
198
|
+
|
|
199
|
+
if (element instanceof HTMLElement) {
|
|
200
|
+
element.focus();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Waits for requestIdleCallback to fire, ensuring toolbar is fully initialized.
|
|
206
|
+
* This is needed because toolbar UI is created in requestIdleCallback.
|
|
207
|
+
*/
|
|
208
|
+
export const waitForIdleCallback = (): Promise<void> => {
|
|
209
|
+
return new Promise<void>((resolve) => {
|
|
210
|
+
if ('requestIdleCallback' in window) {
|
|
211
|
+
window.requestIdleCallback(() => resolve(), { timeout: 100 });
|
|
212
|
+
} else {
|
|
213
|
+
setTimeout(resolve, 0);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Waits for the toolbar element to be present in the DOM.
|
|
220
|
+
* The toolbar is created in requestIdleCallback with a 2000ms timeout,
|
|
221
|
+
* so we need to poll for its existence.
|
|
222
|
+
* @param container - The container element to search within
|
|
223
|
+
* @param timeout - Maximum time to wait in ms (default: 3000)
|
|
224
|
+
*/
|
|
225
|
+
export const waitForToolbar = (container: Element, timeout = 3000): Promise<Element> => {
|
|
226
|
+
return new Promise((resolve, reject) => {
|
|
227
|
+
const startTime = Date.now();
|
|
228
|
+
const checkInterval = 50;
|
|
229
|
+
|
|
230
|
+
const check = (): void => {
|
|
231
|
+
const toolbar = container.querySelector(TOOLBAR_TESTID);
|
|
232
|
+
|
|
233
|
+
if (toolbar) {
|
|
234
|
+
resolve(toolbar);
|
|
235
|
+
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (Date.now() - startTime >= timeout) {
|
|
240
|
+
reject(new Error(`Toolbar not found within ${timeout}ms`));
|
|
241
|
+
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
setTimeout(check, checkInterval);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
check();
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Key codes used for keyboard event simulation
|
|
254
|
+
*/
|
|
255
|
+
const KEY_CODES: Record<string, number> = {
|
|
256
|
+
TAB: 9,
|
|
257
|
+
ENTER: 13,
|
|
258
|
+
ARROW_LEFT: 37,
|
|
259
|
+
ARROW_UP: 38,
|
|
260
|
+
ARROW_RIGHT: 39,
|
|
261
|
+
ARROW_DOWN: 40,
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Dispatches a keyboard event from a target element or finds a suitable target.
|
|
266
|
+
* This is needed because userEvent.keyboard() may not properly trigger
|
|
267
|
+
* document-level event listeners in headless browser environments.
|
|
268
|
+
* @param key - The key to simulate (e.g., 'ArrowDown', 'Enter', 'Tab')
|
|
269
|
+
* @param options - Additional event options (ctrlKey, metaKey, shiftKey, target)
|
|
270
|
+
*/
|
|
271
|
+
export const dispatchKeyboardEvent = (
|
|
272
|
+
key: string,
|
|
273
|
+
options: { ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean; target?: Element } = {}
|
|
274
|
+
): void => {
|
|
275
|
+
const keyCode = KEY_CODES[key.toUpperCase().replace('ARROW', 'ARROW_')] ?? 0;
|
|
276
|
+
|
|
277
|
+
const event = new KeyboardEvent('keydown', {
|
|
278
|
+
bubbles: true,
|
|
279
|
+
cancelable: true,
|
|
280
|
+
key,
|
|
281
|
+
code: key,
|
|
282
|
+
ctrlKey: options.ctrlKey ?? false,
|
|
283
|
+
metaKey: options.metaKey ?? false,
|
|
284
|
+
shiftKey: options.shiftKey ?? false,
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// Set keyCode for older browser compatibility
|
|
288
|
+
Object.defineProperty(event, 'keyCode', { get: () => keyCode });
|
|
289
|
+
Object.defineProperty(event, 'which', { get: () => keyCode });
|
|
290
|
+
|
|
291
|
+
// Dispatch from the target element if provided, otherwise from body
|
|
292
|
+
// This ensures event.target has proper DOM methods like closest()
|
|
293
|
+
const targetElement = options.target ?? document.activeElement ?? document.body;
|
|
294
|
+
|
|
295
|
+
targetElement.dispatchEvent(event);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Simulates typing text by dispatching keyboard events and input events.
|
|
300
|
+
* This is needed for search/filter functionality that listens to document-level events.
|
|
301
|
+
* @param text - The text to type
|
|
302
|
+
*/
|
|
303
|
+
export const simulateTyping = (text: string): void => {
|
|
304
|
+
for (const char of text) {
|
|
305
|
+
const keydownEvent = new KeyboardEvent('keydown', {
|
|
306
|
+
bubbles: true,
|
|
307
|
+
cancelable: true,
|
|
308
|
+
key: char,
|
|
309
|
+
code: `Key${char.toUpperCase()}`,
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
document.dispatchEvent(keydownEvent);
|
|
313
|
+
|
|
314
|
+
// Also dispatch keypress for compatibility
|
|
315
|
+
const keypressEvent = new KeyboardEvent('keypress', {
|
|
316
|
+
bubbles: true,
|
|
317
|
+
cancelable: true,
|
|
318
|
+
key: char,
|
|
319
|
+
code: `Key${char.toUpperCase()}`,
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
document.dispatchEvent(keypressEvent);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Triggers a select-all action using the cross-platform shortcut.
|
|
328
|
+
* Uses Ctrl+A which works in Chromium browser (used by storybook tests).
|
|
329
|
+
* @param element - The element to focus before triggering select-all
|
|
330
|
+
*/
|
|
331
|
+
export const triggerSelectAll = (element: Element): void => {
|
|
332
|
+
if (element instanceof HTMLElement) {
|
|
333
|
+
element.focus();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Dispatch Ctrl+A (works in Chromium, which is used for storybook tests)
|
|
337
|
+
const event = new KeyboardEvent('keydown', {
|
|
338
|
+
bubbles: true,
|
|
339
|
+
cancelable: true,
|
|
340
|
+
key: 'a',
|
|
341
|
+
code: 'KeyA',
|
|
342
|
+
ctrlKey: true,
|
|
343
|
+
metaKey: false,
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
Object.defineProperty(event, 'keyCode', { get: () => 65 });
|
|
347
|
+
Object.defineProperty(event, 'which', { get: () => 65 });
|
|
348
|
+
|
|
349
|
+
element.dispatchEvent(event);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Selects text within a block, handling DOM normalization (e.g., <b> → <strong>).
|
|
354
|
+
* Focuses the contenteditable element and creates a proper selection.
|
|
355
|
+
* @param block - The block wrapper element containing the contenteditable
|
|
356
|
+
* @param selector - CSS selector for the element to select (e.g., 'strong', 'em', 'a')
|
|
357
|
+
* @param contentEditableSelector - Selector for the contenteditable element
|
|
358
|
+
* @returns True if selection was created successfully
|
|
359
|
+
*/
|
|
360
|
+
export const selectTextInBlock = (
|
|
361
|
+
block: Element,
|
|
362
|
+
selector: string,
|
|
363
|
+
contentEditableSelector = '[contenteditable="true"]'
|
|
364
|
+
): boolean => {
|
|
365
|
+
const contentEditable = block.querySelector(contentEditableSelector);
|
|
366
|
+
const targetElement = block.querySelector(selector);
|
|
367
|
+
|
|
368
|
+
if (!contentEditable || !targetElement) {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Focus the contenteditable first to ensure selection is rendered
|
|
373
|
+
if (contentEditable instanceof HTMLElement) {
|
|
374
|
+
contentEditable.focus();
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Create and apply the selection
|
|
378
|
+
const range = document.createRange();
|
|
379
|
+
|
|
380
|
+
range.selectNodeContents(targetElement);
|
|
381
|
+
|
|
382
|
+
const selection = window.getSelection();
|
|
383
|
+
|
|
384
|
+
selection?.removeAllRanges();
|
|
385
|
+
selection?.addRange(range);
|
|
386
|
+
|
|
387
|
+
// Dispatch selectionchange event to trigger toolbar
|
|
388
|
+
document.dispatchEvent(new Event('selectionchange'));
|
|
389
|
+
|
|
390
|
+
return true;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Focuses the popover search input and types text into it.
|
|
395
|
+
* This is needed because userEvent.keyboard() types into the wrong element.
|
|
396
|
+
* @param text - The text to type into the search input
|
|
397
|
+
* @param searchInputSelector - Selector for the search input
|
|
398
|
+
* @returns True if search was performed successfully
|
|
399
|
+
*/
|
|
400
|
+
export const focusSearchInput = (
|
|
401
|
+
text: string,
|
|
402
|
+
searchInputSelector = '[data-blok-testid="popover-search-input"]'
|
|
403
|
+
): boolean => {
|
|
404
|
+
const searchInput = document.querySelector(searchInputSelector) as HTMLInputElement | null;
|
|
405
|
+
|
|
406
|
+
if (!searchInput) {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
searchInput.focus();
|
|
411
|
+
searchInput.value = text;
|
|
412
|
+
searchInput.dispatchEvent(new Event('input', { bubbles: true }));
|
|
413
|
+
|
|
414
|
+
return true;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Waits for an element to have pointer-events enabled.
|
|
419
|
+
* This is needed because popover containers start with pointer-events: none.
|
|
420
|
+
* @param selector - CSS selector for the element to check
|
|
421
|
+
* @param timeout - Maximum time to wait in ms (default: 3000)
|
|
422
|
+
*/
|
|
423
|
+
export const waitForPointerEvents = (selector: string, timeout = 3000): Promise<Element> => {
|
|
424
|
+
return new Promise((resolve, reject) => {
|
|
425
|
+
const startTime = Date.now();
|
|
426
|
+
const checkInterval = 50;
|
|
427
|
+
|
|
428
|
+
const check = (): void => {
|
|
429
|
+
const isTimedOut = Date.now() - startTime >= timeout;
|
|
430
|
+
const element = document.querySelector(selector);
|
|
431
|
+
|
|
432
|
+
if (!element && isTimedOut) {
|
|
433
|
+
reject(new Error(`Element ${selector} did not get pointer-events enabled within ${timeout}ms`));
|
|
434
|
+
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if (!element) {
|
|
439
|
+
setTimeout(check, checkInterval);
|
|
440
|
+
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const computedStyle = window.getComputedStyle(element);
|
|
445
|
+
|
|
446
|
+
if (computedStyle.pointerEvents !== 'none') {
|
|
447
|
+
resolve(element);
|
|
448
|
+
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (isTimedOut) {
|
|
453
|
+
reject(new Error(`Element ${selector} did not get pointer-events enabled within ${timeout}ms`));
|
|
454
|
+
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
setTimeout(check, checkInterval);
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
check();
|
|
462
|
+
});
|
|
463
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* Tailwind CSS - must be first */
|
|
2
|
+
@import 'tailwindcss/base';
|
|
3
|
+
@import 'tailwindcss/components';
|
|
4
|
+
@import 'tailwindcss/utilities';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Component classes for the Styles API.
|
|
8
|
+
* These single-class names can be safely used with classList.add() by external plugins.
|
|
9
|
+
* Each class bundles multiple Tailwind utilities using @apply.
|
|
10
|
+
*/
|
|
11
|
+
@layer components {
|
|
12
|
+
/* Base Blok styles - applied to block tool wrappers */
|
|
13
|
+
.blok-block {
|
|
14
|
+
@apply py-[3px] px-[2px] [&::-webkit-input-placeholder]:!leading-normal;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Inline Tools styles */
|
|
18
|
+
.blok-inline-tool-button {
|
|
19
|
+
@apply flex justify-center items-center border-0 rounded h-full p-0 w-7 bg-transparent cursor-pointer leading-normal text-black;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.blok-inline-tool-button--active {
|
|
23
|
+
@apply bg-icon-active-bg text-icon-active-text;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Input element styles */
|
|
27
|
+
.blok-input {
|
|
28
|
+
@apply w-full rounded-[3px] border border-line-gray px-3 py-2.5 outline-none shadow-input [&[data-blok-placeholder]]:before:!static [&[data-blok-placeholder]]:before:inline-block [&[data-blok-placeholder]]:before:w-0 [&[data-blok-placeholder]]:before:whitespace-nowrap [&[data-blok-placeholder]]:before:pointer-events-none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Loader styles with spinning animation */
|
|
32
|
+
.blok-loader {
|
|
33
|
+
@apply relative border border-line-gray before:absolute before:left-1/2 before:top-1/2 before:w-[18px] before:h-[18px] before:rounded-full before:content-[''] before:-ml-[11px] before:-mt-[11px] before:border-2 before:border-line-gray before:border-l-active-icon before:animate-rotation;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Button styles */
|
|
37
|
+
.blok-button {
|
|
38
|
+
@apply p-[13px] rounded-[3px] border border-line-gray text-[14.9px] bg-white text-center cursor-pointer text-gray-text shadow-button-base hover:bg-[#fbfcfe] hover:shadow-button-base-hover [&_svg]:h-5 [&_svg]:mr-[0.2em] [&_svg]:-mt-0.5;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Settings button styles */
|
|
42
|
+
.blok-settings-button {
|
|
43
|
+
@apply inline-flex items-center justify-center rounded-[3px] cursor-pointer border-0 outline-none bg-transparent align-bottom text-inherit m-0 min-w-toolbox-btn min-h-toolbox-btn [&_svg]:w-auto [&_svg]:h-auto mobile:w-toolbox-btn-mobile mobile:h-toolbox-btn-mobile mobile:rounded-lg mobile:[&_svg]:w-icon-mobile mobile:[&_svg]:h-icon-mobile can-hover:hover:bg-bg-light;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.blok-settings-button--active {
|
|
47
|
+
@apply text-active-icon;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.blok-settings-button--focused {
|
|
51
|
+
@apply shadow-button-focused bg-item-focus-bg;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.blok-settings-button--focused-animated {
|
|
55
|
+
@apply animate-button-clicked;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Navigation mode styles
|
|
61
|
+
* Applied when user enters block navigation mode via Escape key
|
|
62
|
+
*/
|
|
63
|
+
[data-blok-navigation-focused="true"] {
|
|
64
|
+
@apply bg-item-focus-bg rounded-md w-content-width max-w-full mx-auto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Delete button hover styles
|
|
69
|
+
* Makes the delete button text and icon appear red on hover
|
|
70
|
+
*/
|
|
71
|
+
@media (hover: hover) {
|
|
72
|
+
[data-blok-item-name="delete"]:hover {
|
|
73
|
+
@apply text-item-confirm-bg transition-colors;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Drop indicator styles for drag and drop
|
|
79
|
+
* Shows a visual line at the top or bottom of a block during drag
|
|
80
|
+
* The --drop-indicator-depth CSS variable controls indentation based on target nesting level
|
|
81
|
+
*/
|
|
82
|
+
[data-drop-indicator] {
|
|
83
|
+
@apply relative;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[data-drop-indicator]::before {
|
|
87
|
+
@apply content-[''] absolute -translate-x-1/2 w-full max-w-content h-1.5 rounded-sm bg-[#d4e3fc] pointer-events-none z-10;
|
|
88
|
+
left: calc(50% + var(--drop-indicator-depth, 0) * 12px);
|
|
89
|
+
max-width: calc(650px - var(--drop-indicator-depth, 0) * 24px);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
[data-drop-indicator="bottom"]::before {
|
|
93
|
+
@apply translate-y-1/2 bottom-0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[data-drop-indicator="top"]::before {
|
|
97
|
+
@apply -translate-y-1/2 top-0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Multi-block drag visual feedback
|
|
102
|
+
* Makes selected blocks semi-transparent during multi-block drag operation
|
|
103
|
+
*/
|
|
104
|
+
[data-blok-dragging-multi="true"] [data-blok-selected="true"] {
|
|
105
|
+
@apply opacity-40 transition-opacity duration-200;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* List item selection styles
|
|
110
|
+
* Applies selection background to the list item itself (not the content wrapper)
|
|
111
|
+
* so that margin-left indentation is respected
|
|
112
|
+
*/
|
|
113
|
+
[data-blok-selected="true"] [data-blok-element-content]:has([data-list-style]) {
|
|
114
|
+
@apply bg-transparent;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
[data-blok-selected="true"] [data-list-style] [role="listitem"] {
|
|
118
|
+
@apply bg-selection rounded-[4px];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[data-blok-selected="true"] [data-list-style] [role="listitem"] [contenteditable] {
|
|
122
|
+
@apply select-none;
|
|
123
|
+
}
|