@jackuait/blok 0.4.1-beta.4 → 0.4.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -17
- package/codemod/README.md +16 -0
- package/codemod/migrate-editorjs-to-blok.js +868 -92
- package/codemod/test.js +682 -77
- package/dist/blok.mjs +5 -2
- package/dist/chunks/blok-B5qs7C5l.mjs +12838 -0
- package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
- package/dist/chunks/i18next-loader-CTrK3HzG.mjs +43 -0
- package/dist/{index-XWGz4gev.mjs → chunks/index-DDpzQn-0.mjs} +2 -2
- package/dist/chunks/inline-tool-convert-RBcopmCh.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 +26 -225
- package/package.json +49 -23
- 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 +23 -10
- package/types/configs/blok-config.d.ts +29 -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 -12
- 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/header.d.ts +18 -0
- package/types/tools/index.d.ts +1 -0
- package/types/tools/list.d.ts +91 -0
- package/types/tools/paragraph.d.ts +71 -0
- package/types/tools/tool-settings.d.ts +16 -2
- package/types/tools/tool.d.ts +6 -0
- package/types/tools-entry.d.ts +49 -0
- package/types/utils/popover/popover-item.d.ts +6 -5
- package/dist/blok-B870U2fw.mjs +0 -25803
- package/dist/blok.umd.js +0 -181
|
@@ -1,93 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Structure of the i18n dictionary
|
|
2
|
+
* Structure of the i18n dictionary - flat key-value pairs
|
|
3
|
+
*
|
|
4
|
+
* Keys use dot notation to represent the translation path:
|
|
5
|
+
* - "toolNames.text" - Tool name translations
|
|
6
|
+
* - "tools.link.addLink" - Tool-specific translations
|
|
7
|
+
* - "blockSettings.delete" - Block settings translations
|
|
8
|
+
* - "popover.search" - Popover component translations
|
|
9
|
+
* - "a11y.dragHandle" - Accessibility translations
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* {
|
|
13
|
+
* "toolNames.text": "Текст",
|
|
14
|
+
* "tools.link.addLink": "Добавить ссылку",
|
|
15
|
+
* "popover.search": "Поиск"
|
|
16
|
+
* }
|
|
3
17
|
*/
|
|
4
|
-
export
|
|
5
|
-
/**
|
|
6
|
-
* Section for translation Tool Names: both block and inline tools
|
|
7
|
-
* Example:
|
|
8
|
-
* "toolNames": {
|
|
9
|
-
* "Text": "Параграф",
|
|
10
|
-
* "Heading": "Заголовок",
|
|
11
|
-
* "List": "Список",
|
|
12
|
-
* ...
|
|
13
|
-
* },
|
|
14
|
-
*/
|
|
15
|
-
toolNames?: Dictionary;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Section for passing translations to the external tools classes
|
|
19
|
-
* The first-level keys of this object should be equal of keys ot the 'tools' property of BlokConfig
|
|
20
|
-
* Includes internal tools: "paragraph", "stub"
|
|
21
|
-
*
|
|
22
|
-
* Example:
|
|
23
|
-
* "tools": {
|
|
24
|
-
* "warning": {
|
|
25
|
-
* "Title": "Название",
|
|
26
|
-
* "Message": "Сообщение",
|
|
27
|
-
* },
|
|
28
|
-
* "link": {
|
|
29
|
-
* "Add a link": "Вставьте ссылку"
|
|
30
|
-
* },
|
|
31
|
-
* },
|
|
32
|
-
*/
|
|
33
|
-
tools?: Dictionary;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Section allows to translate Block Tunes
|
|
37
|
-
* The first-level keys of this object should be equal of 'name' ot the 'tools.<toolName>.tunes' property of BlokConfig
|
|
38
|
-
* Including some internal block-tunes: "delete", "moveUp", "moveDown
|
|
39
|
-
*
|
|
40
|
-
* Example:
|
|
41
|
-
* "blockTunes": {
|
|
42
|
-
* "delete": {
|
|
43
|
-
* "Delete": "Удалить"
|
|
44
|
-
* },
|
|
45
|
-
* "moveUp": {
|
|
46
|
-
* "Move up": "Переместить вверх"
|
|
47
|
-
* },
|
|
48
|
-
* "moveDown": {
|
|
49
|
-
* "Move down": "Переместить вниз"
|
|
50
|
-
* }
|
|
51
|
-
* },
|
|
52
|
-
*/
|
|
53
|
-
blockTunes?: Dictionary;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Translation of internal UI components of the blok.js core
|
|
57
|
-
*/
|
|
58
|
-
ui?: Dictionary;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Represent item of the I18nDictionary config
|
|
63
|
-
*/
|
|
64
|
-
export interface Dictionary {
|
|
65
|
-
/**
|
|
66
|
-
* The keys of the object can represent two entities:
|
|
67
|
-
* 1. Dictionary key usually is an original string from default locale, like "Convert to"
|
|
68
|
-
* 2. Sub-namespace section, like "toolbar.converter.<...>"
|
|
69
|
-
*
|
|
70
|
-
* Example of 1:
|
|
71
|
-
* toolbox: {
|
|
72
|
-
* "Add": "Добавить",
|
|
73
|
-
* }
|
|
74
|
-
*
|
|
75
|
-
* Example of 2:
|
|
76
|
-
* ui: {
|
|
77
|
-
* toolbar: {
|
|
78
|
-
* toolbox: { <-- Example of 1
|
|
79
|
-
* "Add": "Добавить"
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
* }
|
|
83
|
-
*/
|
|
84
|
-
[key: string]: DictValue;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The value of the dictionary can be:
|
|
89
|
-
* - other dictionary
|
|
90
|
-
* - result translate string
|
|
91
|
-
*/
|
|
92
|
-
export type DictValue = {[key: string]: Dictionary | string} | string;
|
|
18
|
+
export type I18nDictionary = Record<string, string>;
|
|
93
19
|
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized data attributes used across the Blok editor.
|
|
3
|
+
* This is the single source of truth for all data-blok-* attributes.
|
|
4
|
+
*
|
|
5
|
+
* Access via Blok.DATA_ATTR
|
|
6
|
+
*/
|
|
7
|
+
export const DATA_ATTR: {
|
|
8
|
+
// Core Element Identifiers
|
|
9
|
+
readonly interface: 'data-blok-interface';
|
|
10
|
+
readonly element: 'data-blok-element';
|
|
11
|
+
readonly elementContent: 'data-blok-element-content';
|
|
12
|
+
readonly editor: 'data-blok-editor';
|
|
13
|
+
readonly redactor: 'data-blok-redactor';
|
|
14
|
+
|
|
15
|
+
// Block Identifiers
|
|
16
|
+
readonly id: 'data-blok-id';
|
|
17
|
+
readonly component: 'data-blok-component';
|
|
18
|
+
readonly tool: 'data-blok-tool';
|
|
19
|
+
readonly depth: 'data-blok-depth';
|
|
20
|
+
|
|
21
|
+
// Global States
|
|
22
|
+
readonly hidden: 'data-blok-hidden';
|
|
23
|
+
readonly disabled: 'data-blok-disabled';
|
|
24
|
+
readonly focused: 'data-blok-focused';
|
|
25
|
+
readonly selected: 'data-blok-selected';
|
|
26
|
+
readonly stretched: 'data-blok-stretched';
|
|
27
|
+
readonly empty: 'data-blok-empty';
|
|
28
|
+
|
|
29
|
+
// Editor Modes
|
|
30
|
+
readonly narrow: 'data-blok-narrow';
|
|
31
|
+
readonly rtl: 'data-blok-rtl';
|
|
32
|
+
|
|
33
|
+
// Drag and Drop
|
|
34
|
+
readonly dragging: 'data-blok-dragging';
|
|
35
|
+
readonly draggingMulti: 'data-blok-dragging-multi';
|
|
36
|
+
readonly duplicating: 'data-blok-duplicating';
|
|
37
|
+
readonly dragHandle: 'data-blok-drag-handle';
|
|
38
|
+
|
|
39
|
+
// Toolbar
|
|
40
|
+
readonly toolbar: 'data-blok-toolbar';
|
|
41
|
+
readonly settingsToggler: 'data-blok-settings-toggler';
|
|
42
|
+
readonly toolboxOpened: 'data-blok-toolbox-opened';
|
|
43
|
+
readonly opened: 'data-blok-opened';
|
|
44
|
+
|
|
45
|
+
// Popover Container
|
|
46
|
+
readonly popover: 'data-blok-popover';
|
|
47
|
+
readonly popoverContainer: 'data-blok-popover-container';
|
|
48
|
+
readonly popoverItems: 'data-blok-popover-items';
|
|
49
|
+
readonly popoverOverlay: 'data-blok-popover-overlay';
|
|
50
|
+
readonly popoverCustomContent: 'data-blok-popover-custom-content';
|
|
51
|
+
readonly popoverCustomClass: 'data-blok-popover-custom-class';
|
|
52
|
+
readonly popoverInline: 'data-blok-popover-inline';
|
|
53
|
+
readonly popoverOpened: 'data-blok-popover-opened';
|
|
54
|
+
readonly popoverOpenTop: 'data-blok-popover-open-top';
|
|
55
|
+
readonly popoverOpenLeft: 'data-blok-popover-open-left';
|
|
56
|
+
|
|
57
|
+
// Popover Nesting
|
|
58
|
+
readonly nested: 'data-blok-nested';
|
|
59
|
+
readonly nestedLevel: 'data-blok-nested-level';
|
|
60
|
+
|
|
61
|
+
// Popover Header
|
|
62
|
+
readonly popoverHeader: 'data-blok-popover-header';
|
|
63
|
+
readonly popoverHeaderText: 'data-blok-popover-header-text';
|
|
64
|
+
readonly popoverHeaderBackButton: 'data-blok-popover-header-back-button';
|
|
65
|
+
|
|
66
|
+
// Popover Items
|
|
67
|
+
readonly popoverItem: 'data-blok-popover-item';
|
|
68
|
+
readonly popoverItemIcon: 'data-blok-popover-item-icon';
|
|
69
|
+
readonly popoverItemIconChevronRight: 'data-blok-popover-item-icon-chevron-right';
|
|
70
|
+
readonly popoverItemTitle: 'data-blok-popover-item-title';
|
|
71
|
+
readonly popoverItemSecondaryTitle: 'data-blok-popover-item-secondary-title';
|
|
72
|
+
readonly popoverItemActive: 'data-blok-popover-item-active';
|
|
73
|
+
readonly popoverItemConfirmation: 'data-blok-popover-item-confirmation';
|
|
74
|
+
readonly popoverItemNoHover: 'data-blok-popover-item-no-hover';
|
|
75
|
+
readonly popoverItemNoFocus: 'data-blok-popover-item-no-focus';
|
|
76
|
+
readonly popoverItemWobble: 'data-blok-popover-item-wobble';
|
|
77
|
+
readonly popoverItemSeparator: 'data-blok-popover-item-separator';
|
|
78
|
+
readonly popoverItemSeparatorLine: 'data-blok-popover-item-separator-line';
|
|
79
|
+
readonly popoverItemHtml: 'data-blok-popover-item-html';
|
|
80
|
+
readonly hasChildren: 'data-blok-has-children';
|
|
81
|
+
readonly itemName: 'data-blok-item-name';
|
|
82
|
+
readonly nothingFoundDisplayed: 'data-blok-nothing-found-displayed';
|
|
83
|
+
|
|
84
|
+
// Overlay / Selection
|
|
85
|
+
readonly overlay: 'data-blok-overlay';
|
|
86
|
+
readonly overlayContainer: 'data-blok-overlay-container';
|
|
87
|
+
readonly overlayRectangle: 'data-blok-overlay-rectangle';
|
|
88
|
+
readonly overlayHidden: 'data-blok-overlay-hidden';
|
|
89
|
+
readonly fakeCursor: 'data-blok-fake-cursor';
|
|
90
|
+
readonly fakeBackground: 'data-blok-fake-background';
|
|
91
|
+
|
|
92
|
+
// Scroll
|
|
93
|
+
readonly scrollZone: 'data-blok-scroll-zone';
|
|
94
|
+
readonly scrollLocked: 'data-blok-scroll-locked';
|
|
95
|
+
readonly scrollLockedHard: 'data-blok-scroll-locked-hard';
|
|
96
|
+
|
|
97
|
+
// Caret
|
|
98
|
+
readonly shadowCaret: 'data-blok-shadow-caret';
|
|
99
|
+
|
|
100
|
+
// Placeholders
|
|
101
|
+
readonly placeholder: 'data-blok-placeholder';
|
|
102
|
+
readonly placeholderActive: 'data-blok-placeholder-active';
|
|
103
|
+
|
|
104
|
+
// Mutation Tracking
|
|
105
|
+
readonly mutationFree: 'data-blok-mutation-free';
|
|
106
|
+
|
|
107
|
+
// Navigation
|
|
108
|
+
readonly navigationFocused: 'data-blok-navigation-focused';
|
|
109
|
+
readonly flipperNavigationTarget: 'data-blok-flipper-navigation-target';
|
|
110
|
+
|
|
111
|
+
// Inline Toolbar
|
|
112
|
+
readonly inlineToolbar: 'data-blok-inline-toolbar';
|
|
113
|
+
|
|
114
|
+
// Link Tool
|
|
115
|
+
readonly linkToolActive: 'data-blok-link-tool-active';
|
|
116
|
+
readonly linkToolUnlink: 'data-blok-link-tool-unlink';
|
|
117
|
+
readonly linkToolInputOpened: 'data-blok-link-tool-input-opened';
|
|
118
|
+
|
|
119
|
+
// Bold Tool
|
|
120
|
+
readonly boldCollapsedLength: 'data-blok-bold-collapsed-length';
|
|
121
|
+
readonly boldCollapsedActive: 'data-blok-bold-collapsed-active';
|
|
122
|
+
readonly boldPrevLength: 'data-blok-bold-prev-length';
|
|
123
|
+
readonly boldLeadingWs: 'data-blok-bold-leading-ws';
|
|
124
|
+
readonly boldMarker: 'data-blok-bold-marker';
|
|
125
|
+
|
|
126
|
+
// Tooltip
|
|
127
|
+
readonly shown: 'data-blok-shown';
|
|
128
|
+
readonly placement: 'data-blok-placement';
|
|
129
|
+
|
|
130
|
+
// Notifier
|
|
131
|
+
readonly bounceIn: 'data-blok-bounce-in';
|
|
132
|
+
|
|
133
|
+
// Announcer (Accessibility)
|
|
134
|
+
readonly announcer: 'data-blok-announcer';
|
|
135
|
+
|
|
136
|
+
// Stub Block
|
|
137
|
+
readonly stub: 'data-blok-stub';
|
|
138
|
+
readonly stubInfo: 'data-blok-stub-info';
|
|
139
|
+
readonly stubTitle: 'data-blok-stub-title';
|
|
140
|
+
readonly stubSubtitle: 'data-blok-stub-subtitle';
|
|
141
|
+
|
|
142
|
+
// Testing
|
|
143
|
+
readonly testid: 'data-blok-testid';
|
|
144
|
+
readonly forceHover: 'data-blok-force-hover';
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Type for DATA_ATTR keys
|
|
149
|
+
*/
|
|
150
|
+
export type DataAttrKey = keyof typeof DATA_ATTR;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Type for DATA_ATTR values
|
|
154
|
+
*/
|
|
155
|
+
export type DataAttrValue = (typeof DATA_ATTR)[DataAttrKey];
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Helper function to create a CSS selector from an attribute
|
|
159
|
+
*
|
|
160
|
+
* @param attr - The data attribute name from DATA_ATTR
|
|
161
|
+
* @param value - Optional value for the attribute (defaults to presence selector)
|
|
162
|
+
* @returns CSS selector string
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* createSelector(DATA_ATTR.element) // '[data-blok-element]'
|
|
166
|
+
* createSelector(DATA_ATTR.selected, true) // '[data-blok-selected="true"]'
|
|
167
|
+
* createSelector(DATA_ATTR.tool, 'paragraph') // '[data-blok-tool="paragraph"]'
|
|
168
|
+
*/
|
|
169
|
+
export const createSelector: (attr: DataAttrValue, value?: string | boolean) => string;
|
|
@@ -26,6 +26,21 @@ export interface OutputBlockData<Type extends string = string, Data extends obje
|
|
|
26
26
|
* Block Tunes data
|
|
27
27
|
*/
|
|
28
28
|
tunes?: {[name: string]: BlockTuneData};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Parent block id for hierarchical/nested blocks (Notion-like flat-with-references model).
|
|
32
|
+
* When present, this block is a child of the block with the specified id.
|
|
33
|
+
* Omit for root-level blocks.
|
|
34
|
+
*/
|
|
35
|
+
parent?: BlockId;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Array of child block ids (Notion-like flat-with-references model).
|
|
39
|
+
* References blocks that are children of this block.
|
|
40
|
+
* The referenced blocks should have their `parent` field set to this block's id.
|
|
41
|
+
* Omit if block has no children.
|
|
42
|
+
*/
|
|
43
|
+
content?: BlockId[];
|
|
29
44
|
}
|
|
30
45
|
|
|
31
46
|
export interface OutputData {
|
package/types/full.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for @jackuait/blok/full entry point
|
|
3
|
+
* Full bundle with Blok core + all built-in tools
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Re-export everything from core
|
|
7
|
+
export { Blok, version, DATA_ATTR } from './index';
|
|
8
|
+
|
|
9
|
+
// Re-export all types from core
|
|
10
|
+
export * from './index';
|
|
11
|
+
|
|
12
|
+
// Re-export all tools
|
|
13
|
+
export {
|
|
14
|
+
Paragraph,
|
|
15
|
+
Header,
|
|
16
|
+
List,
|
|
17
|
+
Bold,
|
|
18
|
+
Italic,
|
|
19
|
+
Link,
|
|
20
|
+
Convert,
|
|
21
|
+
Delete,
|
|
22
|
+
defaultBlockTools,
|
|
23
|
+
defaultInlineTools,
|
|
24
|
+
HeaderData,
|
|
25
|
+
HeaderConfig,
|
|
26
|
+
ParagraphData,
|
|
27
|
+
ParagraphConfig,
|
|
28
|
+
ListData,
|
|
29
|
+
ListConfig,
|
|
30
|
+
ListStyle,
|
|
31
|
+
} from './tools';
|
|
32
|
+
|
|
33
|
+
import { ParagraphConstructable } from './tools/paragraph';
|
|
34
|
+
import { HeaderConstructable } from './tools/header';
|
|
35
|
+
import { ListConstructable } from './tools/list';
|
|
36
|
+
import { InlineToolConstructable } from './tools/inline-tool';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Default tools configuration matching pre-modularization behavior.
|
|
40
|
+
* Includes Paragraph, Header, and List with inline toolbar enabled.
|
|
41
|
+
*/
|
|
42
|
+
export const defaultTools: {
|
|
43
|
+
readonly paragraph: {
|
|
44
|
+
readonly class: ParagraphConstructable;
|
|
45
|
+
readonly inlineToolbar: true;
|
|
46
|
+
readonly config: { readonly preserveBlank: true };
|
|
47
|
+
};
|
|
48
|
+
readonly header: {
|
|
49
|
+
readonly class: HeaderConstructable;
|
|
50
|
+
readonly inlineToolbar: true;
|
|
51
|
+
};
|
|
52
|
+
readonly list: {
|
|
53
|
+
readonly class: ListConstructable;
|
|
54
|
+
readonly inlineToolbar: true;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* All built-in tools including inline tools.
|
|
60
|
+
* For users who want every tool available.
|
|
61
|
+
*/
|
|
62
|
+
export const allTools: {
|
|
63
|
+
readonly paragraph: {
|
|
64
|
+
readonly class: ParagraphConstructable;
|
|
65
|
+
readonly inlineToolbar: true;
|
|
66
|
+
readonly config: { readonly preserveBlank: true };
|
|
67
|
+
};
|
|
68
|
+
readonly header: {
|
|
69
|
+
readonly class: HeaderConstructable;
|
|
70
|
+
readonly inlineToolbar: true;
|
|
71
|
+
};
|
|
72
|
+
readonly list: {
|
|
73
|
+
readonly class: ListConstructable;
|
|
74
|
+
readonly inlineToolbar: true;
|
|
75
|
+
};
|
|
76
|
+
readonly bold: { readonly class: InlineToolConstructable };
|
|
77
|
+
readonly italic: { readonly class: InlineToolConstructable };
|
|
78
|
+
readonly link: { readonly class: InlineToolConstructable };
|
|
79
|
+
readonly convertTo: { readonly class: InlineToolConstructable };
|
|
80
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -143,19 +143,19 @@ export interface API {
|
|
|
143
143
|
ui: Ui;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
import {
|
|
146
|
+
import { DATA_ATTR, DataAttrKey, DataAttrValue, createSelector } from './data-attributes';
|
|
147
|
+
|
|
148
|
+
export { DATA_ATTR, DataAttrKey, DataAttrValue, createSelector };
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
|
-
*
|
|
151
|
+
* Blok version string
|
|
150
152
|
*/
|
|
151
|
-
|
|
152
|
-
public static version: string;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Header tool bundled with Blok
|
|
156
|
-
*/
|
|
157
|
-
public static Header: HeaderConstructable;
|
|
153
|
+
export const version: string;
|
|
158
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Main Blok class
|
|
157
|
+
*/
|
|
158
|
+
export class Blok {
|
|
159
159
|
public isReady: Promise<void>;
|
|
160
160
|
|
|
161
161
|
public blocks: Blocks;
|
|
@@ -215,6 +215,3 @@ declare class Blok {
|
|
|
215
215
|
*/
|
|
216
216
|
public destroy(): void;
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
export as namespace Blok;
|
|
220
|
-
export default Blok;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point for locale imports.
|
|
3
|
+
* Only English is bundled by default - all 68 other locales are loaded on-demand.
|
|
4
|
+
* @see README.md#localization for usage examples
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { LocaleConfig, LocaleRegistry, SupportedLocale } from './configs/i18n-config';
|
|
8
|
+
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Constants
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
/** Default locale code ('en') */
|
|
14
|
+
export declare const DEFAULT_LOCALE: SupportedLocale;
|
|
15
|
+
|
|
16
|
+
/** All supported locale codes (68 languages) - all available for lazy loading */
|
|
17
|
+
export declare const ALL_LOCALE_CODES: readonly SupportedLocale[];
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// English locale - always bundled (default/fallback)
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
export declare const enLocale: LocaleConfig;
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Lazy loading functions
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
/** Load a single locale on-demand */
|
|
30
|
+
export declare const loadLocale: (code: SupportedLocale) => Promise<LocaleConfig>;
|
|
31
|
+
|
|
32
|
+
/** Preload multiple locales */
|
|
33
|
+
export declare const preloadLocales: (codes: readonly SupportedLocale[]) => Promise<void>;
|
|
34
|
+
|
|
35
|
+
/** Build a registry from locale codes (async) */
|
|
36
|
+
export declare const buildRegistry: (codes: readonly SupportedLocale[]) => Promise<LocaleRegistry>;
|
|
37
|
+
|
|
38
|
+
/** Get a loaded locale synchronously (returns undefined if not loaded) */
|
|
39
|
+
export declare const getLocaleSync: (code: SupportedLocale) => LocaleConfig | undefined;
|
|
40
|
+
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Utility functions
|
|
43
|
+
// ============================================================================
|
|
44
|
+
|
|
45
|
+
/** Get text direction for a locale code */
|
|
46
|
+
export declare const getDirection: (code: SupportedLocale) => 'ltr' | 'rtl';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Clear the locale cache.
|
|
50
|
+
* Primarily useful for testing to ensure test isolation.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare const clearLocaleCache: () => void;
|
|
54
|
+
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Re-export types
|
|
57
|
+
// ============================================================================
|
|
58
|
+
|
|
59
|
+
export type { LocaleConfig, LocaleRegistry, SupportedLocale };
|
|
@@ -7,4 +7,14 @@ interface InlineToolAdapter extends BaseToolAdapter<ToolType.Inline, InlineTool>
|
|
|
7
7
|
* Constructs new InlineTool instance from constructable
|
|
8
8
|
*/
|
|
9
9
|
create(): IInlineTool;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns the tool title
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the translation key for the tool title
|
|
18
|
+
*/
|
|
19
|
+
titleKey: string | undefined;
|
|
10
20
|
}
|
|
@@ -78,6 +78,15 @@ export interface BlockTool extends BaseTool {
|
|
|
78
78
|
* Called after block was moved
|
|
79
79
|
*/
|
|
80
80
|
moved?(event: MoveEvent): void;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns the horizontal offset of the content at the hovered element.
|
|
84
|
+
* Used by the toolbar to position itself closer to nested content (e.g., nested list items).
|
|
85
|
+
*
|
|
86
|
+
* @param hoveredElement - The element that is currently being hovered
|
|
87
|
+
* @returns Object with left offset in pixels, or undefined if no offset should be applied
|
|
88
|
+
*/
|
|
89
|
+
getContentOffset?(hoveredElement: Element): { left: number } | undefined;
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
/**
|
package/types/tools/header.d.ts
CHANGED
|
@@ -11,6 +11,22 @@ export interface HeaderData extends BlockToolData {
|
|
|
11
11
|
level: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Level-specific overrides for customization
|
|
16
|
+
*/
|
|
17
|
+
export interface HeaderLevelConfig {
|
|
18
|
+
/** Custom HTML tag to use (e.g., 'div', 'p', 'span') */
|
|
19
|
+
tag?: string;
|
|
20
|
+
/** Custom display name for this level */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Custom font size (e.g., '3em', '24px') */
|
|
23
|
+
size?: string;
|
|
24
|
+
/** Custom margin top (e.g., '20px', '1rem') */
|
|
25
|
+
marginTop?: string;
|
|
26
|
+
/** Custom margin bottom (e.g., '10px', '0.5rem') */
|
|
27
|
+
marginBottom?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
/**
|
|
15
31
|
* Header Tool's configuration
|
|
16
32
|
*/
|
|
@@ -21,6 +37,8 @@ export interface HeaderConfig {
|
|
|
21
37
|
levels?: number[];
|
|
22
38
|
/** Default level */
|
|
23
39
|
defaultLevel?: number;
|
|
40
|
+
/** Level-specific overrides keyed by level number (1-6) */
|
|
41
|
+
levelOverrides?: Record<number, HeaderLevelConfig>;
|
|
24
42
|
}
|
|
25
43
|
|
|
26
44
|
/**
|
package/types/tools/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './paste-events';
|
|
|
12
12
|
export * from './hook-events';
|
|
13
13
|
export * from './menu-config';
|
|
14
14
|
export * from './header';
|
|
15
|
+
export * from './list';
|
|
15
16
|
|
|
16
17
|
export type Tool = BlockTool | InlineTool | BlockTune;
|
|
17
18
|
export type ToolConstructable = BlockToolConstructable | InlineToolConstructable | BlockTuneConstructable;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BlockTool, BlockToolConstructable, BlockToolConstructorOptions, BlockToolData } from './block-tool';
|
|
2
|
+
import { MenuConfig } from './menu-config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* List styles enum
|
|
6
|
+
*/
|
|
7
|
+
export type ListStyle = 'unordered' | 'ordered' | 'checklist';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* List Tool's input and output data format
|
|
11
|
+
*/
|
|
12
|
+
export interface ListData extends BlockToolData {
|
|
13
|
+
/** Item text content (can include HTML) */
|
|
14
|
+
text: string;
|
|
15
|
+
/** List style: unordered, ordered, or checklist */
|
|
16
|
+
style: ListStyle;
|
|
17
|
+
/** Checked state for checklist items */
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
/** Starting number for ordered lists (only applies to root items) */
|
|
20
|
+
start?: number;
|
|
21
|
+
/** Nesting depth level (0 = root, 1 = first indent, etc.) */
|
|
22
|
+
depth?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List Tool's configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface ListConfig {
|
|
29
|
+
/** Default list style */
|
|
30
|
+
defaultStyle?: ListStyle;
|
|
31
|
+
/**
|
|
32
|
+
* Available list styles for the settings menu.
|
|
33
|
+
* When specified, only these styles will be available in the block settings dropdown.
|
|
34
|
+
*/
|
|
35
|
+
styles?: ListStyle[];
|
|
36
|
+
/**
|
|
37
|
+
* List styles to show in the toolbox.
|
|
38
|
+
* When specified, only these list types will appear as separate entries in the toolbox.
|
|
39
|
+
* If not specified, all list types (unordered, ordered, checklist) will be shown.
|
|
40
|
+
*/
|
|
41
|
+
toolboxStyles?: ListStyle[];
|
|
42
|
+
/**
|
|
43
|
+
* Custom color for list items.
|
|
44
|
+
* Accepts any valid CSS color value (hex, rgb, hsl, named colors, etc.)
|
|
45
|
+
*/
|
|
46
|
+
itemColor?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Custom font size for list items.
|
|
49
|
+
* Accepts any valid CSS font-size value (px, rem, em, etc.)
|
|
50
|
+
*/
|
|
51
|
+
itemSize?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* List Tool for the Blok Editor
|
|
56
|
+
* Provides Ordered, Unordered, and Checklist Blocks
|
|
57
|
+
*/
|
|
58
|
+
export interface List extends BlockTool {
|
|
59
|
+
/**
|
|
60
|
+
* Return Tool's view
|
|
61
|
+
*/
|
|
62
|
+
render(): HTMLElement;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns list block tunes config
|
|
66
|
+
*/
|
|
67
|
+
renderSettings(): MenuConfig;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Method that specified how to merge two List blocks.
|
|
71
|
+
* Called by Editor by backspace at the beginning of the Block
|
|
72
|
+
*/
|
|
73
|
+
merge(data: ListData): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Validate List block data
|
|
77
|
+
*/
|
|
78
|
+
validate(blockData: ListData): boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Extract Tool's data from the view
|
|
82
|
+
*/
|
|
83
|
+
save(): ListData;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* List Tool constructor
|
|
88
|
+
*/
|
|
89
|
+
export interface ListConstructable extends BlockToolConstructable {
|
|
90
|
+
new(config: BlockToolConstructorOptions<ListData, ListConfig>): List;
|
|
91
|
+
}
|