@jackuait/blok 0.4.1 → 0.4.3-beta.1
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 +45 -7
- package/codemod/migrate-editorjs-to-blok.js +951 -92
- package/codemod/test.js +780 -77
- package/dist/blok.mjs +5 -2
- package/dist/chunks/blok-8ptWuVZC.mjs +12838 -0
- package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
- package/dist/chunks/i18next-loader-bLawSYRV.mjs +43 -0
- package/dist/{index-CBkApZKo.mjs → chunks/index-5nYtWZD2.mjs} +2 -2
- package/dist/chunks/inline-tool-convert-CvMDAIzb.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 +60 -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
package/dist/vendor.LICENSE.txt
CHANGED
|
@@ -34,138 +34,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
Name: nanoid
|
|
38
|
-
Version: 5.1.6
|
|
39
|
-
License: MIT
|
|
40
|
-
Private: false
|
|
41
|
-
Description: A tiny (118 bytes), secure URL-friendly unique string ID generator
|
|
42
|
-
Repository: undefined
|
|
43
|
-
Author: Andrey Sitnik <andrey@sitnik.ru>
|
|
44
|
-
License Copyright:
|
|
45
|
-
===
|
|
46
|
-
|
|
47
|
-
The MIT License (MIT)
|
|
48
|
-
|
|
49
|
-
Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
|
|
50
|
-
|
|
51
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
52
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
53
|
-
the Software without restriction, including without limitation the rights to
|
|
54
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
55
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
56
|
-
subject to the following conditions:
|
|
57
|
-
|
|
58
|
-
The above copyright notice and this permission notice shall be included in all
|
|
59
|
-
copies or substantial portions of the Software.
|
|
60
|
-
|
|
61
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
62
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
63
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
64
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
65
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
66
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
Name: lodash
|
|
71
|
-
Version: 4.17.21
|
|
72
|
-
License: MIT
|
|
73
|
-
Private: false
|
|
74
|
-
Description: Lodash modular utilities.
|
|
75
|
-
Repository: undefined
|
|
76
|
-
Homepage: https://lodash.com/
|
|
77
|
-
Author: John-David Dalton <john.david.dalton@gmail.com>
|
|
78
|
-
Contributors:
|
|
79
|
-
John-David Dalton <john.david.dalton@gmail.com>
|
|
80
|
-
Mathias Bynens <mathias@qiwi.be>
|
|
81
|
-
License Copyright:
|
|
82
|
-
===
|
|
83
|
-
|
|
84
|
-
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
85
|
-
|
|
86
|
-
Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
87
|
-
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
88
|
-
|
|
89
|
-
This software consists of voluntary contributions made by many
|
|
90
|
-
individuals. For exact contribution history, see the revision history
|
|
91
|
-
available at https://github.com/lodash/lodash
|
|
92
|
-
|
|
93
|
-
The following license applies to all parts of this software except as
|
|
94
|
-
documented below:
|
|
95
|
-
|
|
96
|
-
====
|
|
97
|
-
|
|
98
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
99
|
-
a copy of this software and associated documentation files (the
|
|
100
|
-
"Software"), to deal in the Software without restriction, including
|
|
101
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
102
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
103
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
104
|
-
the following conditions:
|
|
105
|
-
|
|
106
|
-
The above copyright notice and this permission notice shall be
|
|
107
|
-
included in all copies or substantial portions of the Software.
|
|
108
|
-
|
|
109
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
110
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
111
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
112
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
113
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
114
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
115
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
116
|
-
|
|
117
|
-
====
|
|
118
|
-
|
|
119
|
-
Copyright and related rights for sample code are waived via CC0. Sample
|
|
120
|
-
code is defined as all source code displayed within the prose of the
|
|
121
|
-
documentation.
|
|
122
|
-
|
|
123
|
-
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
|
124
|
-
|
|
125
|
-
====
|
|
126
|
-
|
|
127
|
-
Files located in the node_modules and vendor directories are externally
|
|
128
|
-
maintained libraries used by this software which have their own
|
|
129
|
-
licenses; we recommend you read them, as their terms may differ from the
|
|
130
|
-
terms above.
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
Name: tailwind-merge
|
|
135
|
-
Version: 3.4.0
|
|
136
|
-
License: MIT
|
|
137
|
-
Private: false
|
|
138
|
-
Description: Merge Tailwind CSS classes without style conflicts
|
|
139
|
-
Repository: https://github.com/dcastil/tailwind-merge.git
|
|
140
|
-
Homepage: https://github.com/dcastil/tailwind-merge
|
|
141
|
-
Author: Dany Castillo
|
|
142
|
-
License Copyright:
|
|
143
|
-
===
|
|
144
|
-
|
|
145
|
-
MIT License
|
|
146
|
-
|
|
147
|
-
Copyright (c) 2021 Dany Castillo
|
|
148
|
-
|
|
149
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
150
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
151
|
-
in the Software without restriction, including without limitation the rights
|
|
152
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
153
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
154
|
-
furnished to do so, subject to the following conditions:
|
|
155
|
-
|
|
156
|
-
The above copyright notice and this permission notice shall be included in all
|
|
157
|
-
copies or substantial portions of the Software.
|
|
158
|
-
|
|
159
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
160
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
161
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
162
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
163
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
164
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
165
|
-
SOFTWARE.
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
37
|
Name: html-janitor
|
|
170
38
|
Version: 2.0.4
|
|
171
39
|
License: null
|
|
@@ -378,33 +246,68 @@ Apache License
|
|
|
378
246
|
|
|
379
247
|
---
|
|
380
248
|
|
|
381
|
-
Name:
|
|
382
|
-
Version: 1.
|
|
249
|
+
Name: nanoid
|
|
250
|
+
Version: 5.1.6
|
|
251
|
+
License: MIT
|
|
252
|
+
Private: false
|
|
253
|
+
Description: A tiny (118 bytes), secure URL-friendly unique string ID generator
|
|
254
|
+
Repository: undefined
|
|
255
|
+
Author: Andrey Sitnik <andrey@sitnik.ru>
|
|
256
|
+
License Copyright:
|
|
257
|
+
===
|
|
258
|
+
|
|
259
|
+
The MIT License (MIT)
|
|
260
|
+
|
|
261
|
+
Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
|
|
262
|
+
|
|
263
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
264
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
265
|
+
the Software without restriction, including without limitation the rights to
|
|
266
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
267
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
268
|
+
subject to the following conditions:
|
|
269
|
+
|
|
270
|
+
The above copyright notice and this permission notice shall be included in all
|
|
271
|
+
copies or substantial portions of the Software.
|
|
272
|
+
|
|
273
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
274
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
275
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
276
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
277
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
278
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
Name: i18next
|
|
283
|
+
Version: 25.7.3
|
|
383
284
|
License: MIT
|
|
384
285
|
Private: false
|
|
385
|
-
Description:
|
|
386
|
-
Repository:
|
|
286
|
+
Description: i18next internationalization framework
|
|
287
|
+
Repository: https://github.com/i18next/i18next.git
|
|
288
|
+
Homepage: https://www.i18next.com
|
|
289
|
+
Author: Jan Mühlemann <jan.muehlemann@gmail.com> (https://github.com/jamuhl)
|
|
387
290
|
License Copyright:
|
|
388
291
|
===
|
|
389
292
|
|
|
390
|
-
MIT License
|
|
391
|
-
|
|
392
|
-
Copyright (c)
|
|
393
|
-
|
|
394
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
395
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
396
|
-
in the Software without restriction, including without limitation the rights
|
|
397
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
398
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
399
|
-
furnished to do so, subject to the following conditions:
|
|
400
|
-
|
|
401
|
-
The above copyright notice and this permission notice shall be included in all
|
|
402
|
-
copies or substantial portions of the Software.
|
|
403
|
-
|
|
404
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
405
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
406
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
407
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
408
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
409
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
293
|
+
The MIT License (MIT)
|
|
294
|
+
|
|
295
|
+
Copyright (c) 2025 i18next
|
|
296
|
+
|
|
297
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
298
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
299
|
+
in the Software without restriction, including without limitation the rights
|
|
300
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
301
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
302
|
+
furnished to do so, subject to the following conditions:
|
|
303
|
+
|
|
304
|
+
The above copyright notice and this permission notice shall be included in all
|
|
305
|
+
copies or substantial portions of the Software.
|
|
306
|
+
|
|
307
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
308
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
309
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
310
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
311
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
312
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
410
313
|
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,21 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackuait/blok",
|
|
3
|
-
"version": "0.4.1",
|
|
3
|
+
"version": "0.4.3-beta.1",
|
|
4
4
|
"description": "Blok — headless, highly extensible rich text editor built for developers who need to implement a block-based editing experience (similar to Notion) without building it from scratch",
|
|
5
|
-
"main": "dist/blok.umd.js",
|
|
6
5
|
"module": "dist/blok.mjs",
|
|
7
6
|
"types": "./types/index.d.ts",
|
|
7
|
+
"typesVersions": {
|
|
8
|
+
"*": {
|
|
9
|
+
"tools": [
|
|
10
|
+
"./types/tools-entry.d.ts"
|
|
11
|
+
],
|
|
12
|
+
"full": [
|
|
13
|
+
"./types/full.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"locales": [
|
|
16
|
+
"./types/locales.d.ts"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./types/index.d.ts",
|
|
23
|
+
"import": "./dist/blok.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./tools": {
|
|
26
|
+
"types": "./types/tools-entry.d.ts",
|
|
27
|
+
"import": "./dist/tools.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./full": {
|
|
30
|
+
"types": "./types/full.d.ts",
|
|
31
|
+
"import": "./dist/full.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./locales": {
|
|
34
|
+
"types": "./types/locales.d.ts",
|
|
35
|
+
"import": "./dist/locales.mjs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
8
38
|
"bin": {
|
|
9
39
|
"migrate-from-editorjs": "./codemod/migrate-editorjs-to-blok.js"
|
|
10
40
|
},
|
|
11
41
|
"files": [
|
|
12
42
|
"dist",
|
|
13
43
|
"types",
|
|
44
|
+
"src",
|
|
14
45
|
"codemod"
|
|
15
46
|
],
|
|
16
47
|
"publishConfig": {
|
|
17
48
|
"access": "public"
|
|
18
49
|
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.0.0"
|
|
52
|
+
},
|
|
19
53
|
"keywords": [
|
|
20
54
|
"blok",
|
|
21
55
|
"text editor",
|
|
@@ -25,15 +59,21 @@
|
|
|
25
59
|
"headless editor",
|
|
26
60
|
"extensible editor"
|
|
27
61
|
],
|
|
62
|
+
"sideEffects": [
|
|
63
|
+
"./src/components/polyfills.ts",
|
|
64
|
+
"*.css"
|
|
65
|
+
],
|
|
28
66
|
"scripts": {
|
|
29
67
|
"serve": "vite --no-open",
|
|
30
|
-
"build": "vite build --mode production",
|
|
31
|
-
"build:test": "vite build --mode test",
|
|
68
|
+
"build": "vite build --mode production && node scripts/build-locales.mjs",
|
|
69
|
+
"build:test": "vite build --mode test && node scripts/build-locales.mjs test",
|
|
32
70
|
"lint": "sh -c 'eslint .; ESLINT_EXIT=$?; tsc --noEmit; TSC_EXIT=$?; if [ $ESLINT_EXIT -ne 0 ] || [ $TSC_EXIT -ne 0 ]; then exit 1; fi'",
|
|
33
71
|
"lint:fix": "eslint . --fix",
|
|
34
72
|
"lint:tests": "eslint test/",
|
|
35
73
|
"lint:types": "tsc --noEmit",
|
|
74
|
+
"i18n:check": "node scripts/i18n/check-translations.mjs",
|
|
36
75
|
"e2e": "playwright test",
|
|
76
|
+
"e2e:smoke": "playwright test --project=chromium --grep=\"@smoke\"",
|
|
37
77
|
"e2e:chrome": "playwright test --project=chromium",
|
|
38
78
|
"e2e:firefox": "playwright test --project=firefox",
|
|
39
79
|
"e2e:safari": "playwright test --project=webkit",
|
|
@@ -48,16 +88,22 @@
|
|
|
48
88
|
"jscpd:report": "jscpd . --reporters html,json --output .jscpd-report",
|
|
49
89
|
"prepublishOnly": "yarn build",
|
|
50
90
|
"prepare": "husky",
|
|
51
|
-
"release": "./scripts/release.sh release",
|
|
52
|
-
"release:alpha": "./scripts/release.sh prerelease alpha",
|
|
53
|
-
"release:rc": "./scripts/release.sh prerelease rc",
|
|
54
|
-
"release:dry": "./scripts/release.sh release beta true",
|
|
55
91
|
"storybook": "storybook dev -p 6006 --no-open",
|
|
56
92
|
"storybook:build": "storybook build --stats-json",
|
|
57
93
|
"storybook:test": "vitest --project=storybook --run",
|
|
58
94
|
"chromatic": "chromatic --exit-zero-on-changes",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
95
|
+
"verify:package": "node scripts/verify-published-package.mjs",
|
|
96
|
+
"verify:package:local": "npm pack && node scripts/verify-published-package.mjs --local",
|
|
97
|
+
"verify:version": "node scripts/verify-version.mjs",
|
|
98
|
+
"unpublish": "node scripts/unpublish-package.mjs",
|
|
99
|
+
"bundle:track": "node scripts/track-bundle-size.mjs --verbose",
|
|
100
|
+
"bundle:variants": "node scripts/build-bundle-variants.mjs --verbose",
|
|
101
|
+
"bundle:trends": "node scripts/view-bundle-trends.mjs --trends",
|
|
102
|
+
"bundle:history": "node scripts/view-bundle-trends.mjs",
|
|
103
|
+
"perf:analyze": "node scripts/analyze-performance.mjs",
|
|
104
|
+
"perf:compare": "node scripts/analyze-performance.mjs --baseline",
|
|
105
|
+
"perf:dashboard": "node scripts/generate-performance-dashboard.mjs",
|
|
106
|
+
"e2e:validate-categories": "node scripts/validate-test-categories.mjs"
|
|
61
107
|
},
|
|
62
108
|
"author": "JackUait",
|
|
63
109
|
"contributors": [
|
|
@@ -75,13 +121,14 @@
|
|
|
75
121
|
"@commitlint/cli": "20.1.0",
|
|
76
122
|
"@commitlint/config-conventional": "20.0.0",
|
|
77
123
|
"@playwright/test": "1.57.0",
|
|
124
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
125
|
+
"@semantic-release/git": "^10.0.1",
|
|
78
126
|
"@storybook/addon-a11y": "10.1.1",
|
|
79
127
|
"@storybook/addon-vitest": "10.1.1",
|
|
80
128
|
"@storybook/global": "5.0.0",
|
|
81
129
|
"@storybook/html-vite": "10.1.1",
|
|
82
130
|
"@types/eslint-plugin-tailwindcss": "3",
|
|
83
131
|
"@types/node": "22.19.0",
|
|
84
|
-
"@types/sortablejs": "1.15.9",
|
|
85
132
|
"@vitest/browser-playwright": "4.0.14",
|
|
86
133
|
"@vitest/coverage-v8": "4.0.14",
|
|
87
134
|
"@vitest/ui": "4.0.14",
|
|
@@ -103,6 +150,7 @@
|
|
|
103
150
|
"playwright": "1.57.0",
|
|
104
151
|
"postcss": "8.5.6",
|
|
105
152
|
"rollup-plugin-license": "3.6.0",
|
|
153
|
+
"semantic-release": "^25.0.2",
|
|
106
154
|
"storybook": "10.1.1",
|
|
107
155
|
"tailwindcss": "3",
|
|
108
156
|
"tslint": "6.1.3",
|
|
@@ -114,9 +162,6 @@
|
|
|
114
162
|
"yaml": "2.8.1"
|
|
115
163
|
},
|
|
116
164
|
"dependencies": {
|
|
117
|
-
"
|
|
118
|
-
"lodash": "4.17.21",
|
|
119
|
-
"sortablejs": "1.15.6",
|
|
120
|
-
"tailwind-merge": "3.4.0"
|
|
165
|
+
"i18next": "^25.7.3"
|
|
121
166
|
}
|
|
122
167
|
}
|
package/src/blok.ts
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import type { BlokConfig, API } from '../types';
|
|
4
|
+
import type { BlokModules } from './types-internal/blok-modules';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Apply polyfills
|
|
8
|
+
*/
|
|
9
|
+
import '@babel/register';
|
|
10
|
+
|
|
11
|
+
import './components/polyfills';
|
|
12
|
+
import { Core } from './components/core';
|
|
13
|
+
import { getBlokVersion, isObject, isFunction } from './components/utils';
|
|
14
|
+
import { destroy as destroyTooltip } from './components/utils/tooltip';
|
|
15
|
+
import { DATA_ATTR } from './components/constants/data-attributes';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Export version as a named export
|
|
19
|
+
*/
|
|
20
|
+
export const version = getBlokVersion();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Re-export DATA_ATTR for querying editor elements
|
|
24
|
+
*/
|
|
25
|
+
export { DATA_ATTR } from './components/constants/data-attributes';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Blok
|
|
29
|
+
* @license Apache-2.0
|
|
30
|
+
*/
|
|
31
|
+
class Blok {
|
|
32
|
+
/**
|
|
33
|
+
* Store user-provided configuration for later export
|
|
34
|
+
*/
|
|
35
|
+
private readonly initialConfiguration: BlokConfig|string|undefined;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Promise that resolves when core modules are ready and UI is rendered on the page
|
|
39
|
+
*/
|
|
40
|
+
public isReady: Promise<void>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Stores destroy method implementation.
|
|
44
|
+
* Clear heap occupied by Blok and remove UI components from the DOM.
|
|
45
|
+
*/
|
|
46
|
+
public destroy: () => void;
|
|
47
|
+
|
|
48
|
+
/** Blok version */
|
|
49
|
+
public static get version(): string {
|
|
50
|
+
return getBlokVersion();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Data attributes used by the editor.
|
|
55
|
+
* Single source of truth for all data-blok-* attributes.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Query editor elements
|
|
59
|
+
* document.querySelectorAll(`[${Blok.DATA_ATTR.element}]`);
|
|
60
|
+
*
|
|
61
|
+
* // Check if block is selected
|
|
62
|
+
* block.getAttribute(Blok.DATA_ATTR.selected) === 'true';
|
|
63
|
+
*/
|
|
64
|
+
public static DATA_ATTR = DATA_ATTR;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {BlokConfig|string|undefined} [configuration] - user configuration
|
|
68
|
+
*/
|
|
69
|
+
constructor(configuration?: BlokConfig|string) {
|
|
70
|
+
this.initialConfiguration = isObject(configuration)
|
|
71
|
+
? { ...configuration }
|
|
72
|
+
: configuration;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Set default onReady function or use the one from configuration if provided
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
const onReady = (isObject(configuration) && isFunction(configuration.onReady))
|
|
79
|
+
? configuration.onReady
|
|
80
|
+
: () => {};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Create a Blok instance
|
|
84
|
+
*/
|
|
85
|
+
const blok = new Core(configuration);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Initialize destroy with a no-op function that will be replaced in exportAPI
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
this.destroy = (): void => {};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* We need to export isReady promise in the constructor
|
|
95
|
+
* as it can be used before other API methods are exported
|
|
96
|
+
* @type {Promise<void>}
|
|
97
|
+
*/
|
|
98
|
+
this.isReady = blok.isReady.then(() => {
|
|
99
|
+
this.exportAPI(blok);
|
|
100
|
+
/**
|
|
101
|
+
* @todo pass API as an argument. It will allow to use Blok's API when blok is ready
|
|
102
|
+
*/
|
|
103
|
+
onReady();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Export external API methods
|
|
109
|
+
* @param {Core} blok — Blok's instance
|
|
110
|
+
*/
|
|
111
|
+
public exportAPI(blok: Core): void {
|
|
112
|
+
const fieldsToExport = [ 'configuration' ];
|
|
113
|
+
const destroy = (): void => {
|
|
114
|
+
Object.values(blok.moduleInstances)
|
|
115
|
+
.forEach((moduleInstance) => {
|
|
116
|
+
if (moduleInstance === undefined || moduleInstance === null) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (isFunction((moduleInstance as { destroy?: () => void }).destroy)) {
|
|
121
|
+
(moduleInstance as { destroy: () => void }).destroy();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const listeners = (moduleInstance as { listeners?: { removeAll?: () => void } }).listeners;
|
|
125
|
+
|
|
126
|
+
if (listeners && isFunction(listeners.removeAll)) {
|
|
127
|
+
listeners.removeAll();
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
destroyTooltip();
|
|
132
|
+
|
|
133
|
+
for (const field in this) {
|
|
134
|
+
if (Object.prototype.hasOwnProperty.call(this, field)) {
|
|
135
|
+
delete (this as Record<string, unknown>)[field];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
Object.setPrototypeOf(this, null);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
fieldsToExport.forEach((field) => {
|
|
143
|
+
if (field !== 'configuration') {
|
|
144
|
+
(this as Record<string, unknown>)[field] = (blok as unknown as Record<string, unknown>)[field];
|
|
145
|
+
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const coreConfiguration = (blok as unknown as { configuration?: BlokConfig|string|undefined }).configuration;
|
|
150
|
+
const configurationToExport = isObject(this.initialConfiguration)
|
|
151
|
+
? this.initialConfiguration
|
|
152
|
+
: coreConfiguration ?? this.initialConfiguration;
|
|
153
|
+
|
|
154
|
+
if (configurationToExport === undefined) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
(this as Record<string, unknown>)[field] = configurationToExport as BlokConfig|string;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
this.destroy = destroy;
|
|
162
|
+
|
|
163
|
+
const apiMethods = blok.moduleInstances.API.methods;
|
|
164
|
+
const eventsDispatcherApi = blok.moduleInstances.EventsAPI?.methods ?? apiMethods.events;
|
|
165
|
+
|
|
166
|
+
if (eventsDispatcherApi !== undefined) {
|
|
167
|
+
const defineDispatcher = (target: object): void => {
|
|
168
|
+
if (!Object.prototype.hasOwnProperty.call(target, 'eventsDispatcher')) {
|
|
169
|
+
Object.defineProperty(target, 'eventsDispatcher', {
|
|
170
|
+
value: eventsDispatcherApi,
|
|
171
|
+
configurable: true,
|
|
172
|
+
enumerable: true,
|
|
173
|
+
writable: false,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
defineDispatcher(apiMethods);
|
|
179
|
+
defineDispatcher(this as Record<string, unknown>);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (Object.getPrototypeOf(apiMethods) !== Blok.prototype) {
|
|
183
|
+
Object.setPrototypeOf(apiMethods, Blok.prototype);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
Object.setPrototypeOf(this, apiMethods);
|
|
187
|
+
|
|
188
|
+
const moduleAliases = Object.create(null) as Record<string, unknown>;
|
|
189
|
+
const moduleInstances = blok.moduleInstances as Partial<BlokModules>;
|
|
190
|
+
const moduleInstancesRecord = moduleInstances as unknown as Record<string, unknown>;
|
|
191
|
+
|
|
192
|
+
const getAliasName = (name: string): string => (
|
|
193
|
+
/^[A-Z]+$/.test(name)
|
|
194
|
+
? name.toLowerCase()
|
|
195
|
+
: name.charAt(0).toLowerCase() + name.slice(1)
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
Object.keys(moduleInstancesRecord)
|
|
199
|
+
.forEach((name) => {
|
|
200
|
+
const alias = getAliasName(name);
|
|
201
|
+
|
|
202
|
+
Object.defineProperty(moduleAliases, alias, {
|
|
203
|
+
configurable: true,
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: () => moduleInstancesRecord[name],
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
type ToolbarModuleWithSettings = {
|
|
210
|
+
blockSettings?: unknown;
|
|
211
|
+
inlineToolbar?: unknown;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const toolbarModule = moduleInstances.Toolbar as unknown as ToolbarModuleWithSettings | undefined;
|
|
215
|
+
const blockSettingsModule = moduleInstances.BlockSettings;
|
|
216
|
+
|
|
217
|
+
if (toolbarModule !== undefined && blockSettingsModule !== undefined && toolbarModule.blockSettings === undefined) {
|
|
218
|
+
toolbarModule.blockSettings = blockSettingsModule;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const inlineToolbarModule = moduleInstances.InlineToolbar;
|
|
222
|
+
|
|
223
|
+
if (toolbarModule !== undefined && inlineToolbarModule !== undefined && toolbarModule.inlineToolbar === undefined) {
|
|
224
|
+
toolbarModule.inlineToolbar = inlineToolbarModule;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
Object.defineProperty(this, 'module', {
|
|
228
|
+
value: moduleAliases,
|
|
229
|
+
configurable: true,
|
|
230
|
+
enumerable: false,
|
|
231
|
+
writable: false,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
delete (this as Partial<Blok>).exportAPI;
|
|
235
|
+
|
|
236
|
+
const shorthands = {
|
|
237
|
+
blocks: {
|
|
238
|
+
clear: 'clear',
|
|
239
|
+
render: 'render',
|
|
240
|
+
},
|
|
241
|
+
caret: {
|
|
242
|
+
focus: 'focus',
|
|
243
|
+
},
|
|
244
|
+
events: {
|
|
245
|
+
on: 'on',
|
|
246
|
+
off: 'off',
|
|
247
|
+
emit: 'emit',
|
|
248
|
+
},
|
|
249
|
+
saver: {
|
|
250
|
+
save: 'save',
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
Object.entries(shorthands)
|
|
255
|
+
.forEach(([key, methods]) => {
|
|
256
|
+
Object.entries(methods)
|
|
257
|
+
.forEach(([name, alias]) => {
|
|
258
|
+
const apiKey = key as keyof API;
|
|
259
|
+
const apiMethodGroup = blok.moduleInstances.API.methods[apiKey] as unknown as Record<string, unknown>;
|
|
260
|
+
|
|
261
|
+
(this as Record<string, unknown>)[alias] = apiMethodGroup[name];
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export { Blok };
|