@jackuait/blok 0.4.1-beta.0 → 0.4.1-beta.11
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 +138 -17
- package/codemod/README.md +45 -7
- package/codemod/migrate-editorjs-to-blok.js +960 -92
- package/codemod/test.js +780 -77
- package/dist/blok.mjs +5 -2
- package/dist/chunks/blok-oNSQ3HA6.mjs +13217 -0
- package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
- package/dist/chunks/i18next-loader-BdNRw4n4.mjs +43 -0
- package/dist/{index-OwEtDFlk.mjs → chunks/index-DHgXmfki.mjs} +2 -2
- package/dist/chunks/inline-tool-convert-CRqgjRim.mjs +1989 -0
- package/dist/chunks/messages-0tDXLuyH.mjs +48 -0
- package/dist/chunks/messages-2_xedlYw.mjs +48 -0
- package/dist/chunks/messages-AHESHJm_.mjs +48 -0
- package/dist/chunks/messages-B5hdXZwA.mjs +48 -0
- package/dist/chunks/messages-B5jGUnOy.mjs +48 -0
- package/dist/chunks/messages-B5puUm7R.mjs +48 -0
- package/dist/chunks/messages-B66ZSDCJ.mjs +48 -0
- package/dist/chunks/messages-B9Oba7sq.mjs +48 -0
- package/dist/chunks/messages-BA0rcTCY.mjs +48 -0
- package/dist/chunks/messages-BBJgd5jG.mjs +48 -0
- package/dist/chunks/messages-BPqWKx5Z.mjs +48 -0
- package/dist/chunks/messages-Bdv-IkfG.mjs +48 -0
- package/dist/chunks/messages-BeUhMpsr.mjs +48 -0
- package/dist/chunks/messages-Bf6Y3_GI.mjs +48 -0
- package/dist/chunks/messages-BiExzWJv.mjs +48 -0
- package/dist/chunks/messages-BlpqL8vG.mjs +48 -0
- package/dist/chunks/messages-BmKCChWZ.mjs +48 -0
- package/dist/chunks/messages-Bn253WWC.mjs +48 -0
- package/dist/chunks/messages-BrJHUxQL.mjs +48 -0
- package/dist/chunks/messages-C5b7hr_E.mjs +48 -0
- package/dist/chunks/messages-C7I_AVH2.mjs +48 -0
- package/dist/chunks/messages-CJoBtXU6.mjs +48 -0
- package/dist/chunks/messages-CQj2JU2j.mjs +48 -0
- package/dist/chunks/messages-CUZ1x1QD.mjs +48 -0
- package/dist/chunks/messages-CUy1vn-b.mjs +48 -0
- package/dist/chunks/messages-CVeWVKsV.mjs +48 -0
- package/dist/chunks/messages-CXHd9SUK.mjs +48 -0
- package/dist/chunks/messages-CbMyJSzS.mjs +48 -0
- package/dist/chunks/messages-CbhuIWRJ.mjs +48 -0
- package/dist/chunks/messages-CeCjVKMW.mjs +48 -0
- package/dist/chunks/messages-Cj-t1bdy.mjs +48 -0
- package/dist/chunks/messages-CkFT2gle.mjs +48 -0
- package/dist/chunks/messages-Cm9aLHeX.mjs +48 -0
- package/dist/chunks/messages-CnvW8Slp.mjs +48 -0
- package/dist/chunks/messages-Cr-RJ7YB.mjs +48 -0
- package/dist/chunks/messages-CrsJ1TEJ.mjs +48 -0
- package/dist/chunks/messages-Cu08aLS3.mjs +48 -0
- package/dist/chunks/messages-CvaqJFN-.mjs +48 -0
- package/dist/chunks/messages-CyDU5lz9.mjs +48 -0
- package/dist/chunks/messages-CySyfkMU.mjs +48 -0
- package/dist/chunks/messages-Cyi2AMmz.mjs +48 -0
- package/dist/chunks/messages-D00OjS2n.mjs +48 -0
- package/dist/chunks/messages-DDLgIPDF.mjs +48 -0
- package/dist/chunks/messages-DMQIHGRj.mjs +48 -0
- package/dist/chunks/messages-DOlC_Tty.mjs +48 -0
- package/dist/chunks/messages-DV6shA9b.mjs +48 -0
- package/dist/chunks/messages-DY94ykcE.mjs +48 -0
- package/dist/chunks/messages-DbVquYKN.mjs +48 -0
- package/dist/chunks/messages-DcKOuncK.mjs +48 -0
- package/dist/chunks/messages-Dg92dXZ5.mjs +48 -0
- package/dist/chunks/messages-DnbbyJT3.mjs +48 -0
- package/dist/chunks/messages-DteYq0rv.mjs +48 -0
- package/dist/chunks/messages-GC2PhgV3.mjs +48 -0
- package/dist/chunks/messages-JGsXAReJ.mjs +48 -0
- package/dist/chunks/messages-JZUhXTuV.mjs +48 -0
- package/dist/chunks/messages-LvFKBBPa.mjs +48 -0
- package/dist/chunks/messages-NP1myMGI.mjs +48 -0
- package/dist/chunks/messages-Q4kc_ZtL.mjs +48 -0
- package/dist/chunks/messages-RvMHb2Ht.mjs +48 -0
- package/dist/chunks/messages-ftMcCEuO.mjs +48 -0
- package/dist/chunks/messages-o24dK6CU.mjs +48 -0
- package/dist/chunks/messages-pA5TvcAj.mjs +48 -0
- package/dist/chunks/messages-rRSHQDCX.mjs +48 -0
- package/dist/chunks/messages-srxrv8Yh.mjs +48 -0
- package/dist/chunks/messages-wdqp4610.mjs +48 -0
- package/dist/chunks/messages-zS1AXZ0y.mjs +48 -0
- package/dist/chunks/messages-zSzDzXej.mjs +48 -0
- package/dist/full.mjs +50 -0
- package/dist/locales.mjs +228 -0
- package/dist/messages-0tDXLuyH.mjs +48 -0
- package/dist/messages-2_xedlYw.mjs +48 -0
- package/dist/messages-AHESHJm_.mjs +48 -0
- package/dist/messages-B5hdXZwA.mjs +48 -0
- package/dist/messages-B5jGUnOy.mjs +48 -0
- package/dist/messages-B5puUm7R.mjs +48 -0
- package/dist/messages-B66ZSDCJ.mjs +48 -0
- package/dist/messages-B9Oba7sq.mjs +48 -0
- package/dist/messages-BA0rcTCY.mjs +48 -0
- package/dist/messages-BBJgd5jG.mjs +48 -0
- package/dist/messages-BPqWKx5Z.mjs +48 -0
- package/dist/messages-Bdv-IkfG.mjs +48 -0
- package/dist/messages-BeUhMpsr.mjs +48 -0
- package/dist/messages-Bf6Y3_GI.mjs +48 -0
- package/dist/messages-BiExzWJv.mjs +48 -0
- package/dist/messages-BlpqL8vG.mjs +48 -0
- package/dist/messages-BmKCChWZ.mjs +48 -0
- package/dist/messages-Bn253WWC.mjs +48 -0
- package/dist/messages-BrJHUxQL.mjs +48 -0
- package/dist/messages-C5b7hr_E.mjs +48 -0
- package/dist/messages-C7I_AVH2.mjs +48 -0
- package/dist/messages-CJoBtXU6.mjs +48 -0
- package/dist/messages-CQj2JU2j.mjs +48 -0
- package/dist/messages-CUZ1x1QD.mjs +48 -0
- package/dist/messages-CUy1vn-b.mjs +48 -0
- package/dist/messages-CVeWVKsV.mjs +48 -0
- package/dist/messages-CXHd9SUK.mjs +48 -0
- package/dist/messages-CbMyJSzS.mjs +48 -0
- package/dist/messages-CbhuIWRJ.mjs +48 -0
- package/dist/messages-CeCjVKMW.mjs +48 -0
- package/dist/messages-Cj-t1bdy.mjs +48 -0
- package/dist/messages-CkFT2gle.mjs +48 -0
- package/dist/messages-Cm9aLHeX.mjs +48 -0
- package/dist/messages-CnvW8Slp.mjs +48 -0
- package/dist/messages-Cr-RJ7YB.mjs +48 -0
- package/dist/messages-CrsJ1TEJ.mjs +48 -0
- package/dist/messages-Cu08aLS3.mjs +48 -0
- package/dist/messages-CvaqJFN-.mjs +48 -0
- package/dist/messages-CyDU5lz9.mjs +48 -0
- package/dist/messages-CySyfkMU.mjs +48 -0
- package/dist/messages-Cyi2AMmz.mjs +48 -0
- package/dist/messages-D00OjS2n.mjs +48 -0
- package/dist/messages-DDLgIPDF.mjs +48 -0
- package/dist/messages-DMQIHGRj.mjs +48 -0
- package/dist/messages-DOlC_Tty.mjs +48 -0
- package/dist/messages-DV6shA9b.mjs +48 -0
- package/dist/messages-DY94ykcE.mjs +48 -0
- package/dist/messages-DbVquYKN.mjs +48 -0
- package/dist/messages-DcKOuncK.mjs +48 -0
- package/dist/messages-Dg92dXZ5.mjs +48 -0
- package/dist/messages-DnbbyJT3.mjs +48 -0
- package/dist/messages-DteYq0rv.mjs +48 -0
- package/dist/messages-GC2PhgV3.mjs +48 -0
- package/dist/messages-JGsXAReJ.mjs +48 -0
- package/dist/messages-JZUhXTuV.mjs +48 -0
- package/dist/messages-LvFKBBPa.mjs +48 -0
- package/dist/messages-NP1myMGI.mjs +48 -0
- package/dist/messages-Q4kc_ZtL.mjs +48 -0
- package/dist/messages-RvMHb2Ht.mjs +48 -0
- package/dist/messages-ftMcCEuO.mjs +48 -0
- package/dist/messages-o24dK6CU.mjs +48 -0
- package/dist/messages-pA5TvcAj.mjs +48 -0
- package/dist/messages-rRSHQDCX.mjs +48 -0
- package/dist/messages-srxrv8Yh.mjs +48 -0
- package/dist/messages-wdqp4610.mjs +48 -0
- package/dist/messages-zS1AXZ0y.mjs +48 -0
- package/dist/messages-zSzDzXej.mjs +48 -0
- package/dist/tools.mjs +3117 -0
- package/dist/vendor.LICENSE.txt +26 -225
- package/package.json +63 -24
- 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 +1428 -0
- package/src/components/block-tunes/block-tune-delete.ts +51 -0
- package/src/components/blocks.ts +352 -0
- package/src/components/constants/data-attributes.ts +344 -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 +497 -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 +45 -0
- package/src/components/i18n/locales/ar/messages.json +45 -0
- package/src/components/i18n/locales/az/messages.json +45 -0
- package/src/components/i18n/locales/bg/messages.json +45 -0
- package/src/components/i18n/locales/bn/messages.json +45 -0
- package/src/components/i18n/locales/bs/messages.json +45 -0
- package/src/components/i18n/locales/cs/messages.json +45 -0
- package/src/components/i18n/locales/da/messages.json +45 -0
- package/src/components/i18n/locales/de/messages.json +45 -0
- package/src/components/i18n/locales/dv/messages.json +45 -0
- package/src/components/i18n/locales/el/messages.json +45 -0
- package/src/components/i18n/locales/en/messages.json +45 -0
- package/src/components/i18n/locales/es/messages.json +45 -0
- package/src/components/i18n/locales/et/messages.json +45 -0
- package/src/components/i18n/locales/fa/messages.json +45 -0
- package/src/components/i18n/locales/fi/messages.json +45 -0
- package/src/components/i18n/locales/fil/messages.json +45 -0
- package/src/components/i18n/locales/fr/messages.json +45 -0
- package/src/components/i18n/locales/gu/messages.json +45 -0
- package/src/components/i18n/locales/he/messages.json +45 -0
- package/src/components/i18n/locales/hi/messages.json +45 -0
- package/src/components/i18n/locales/hr/messages.json +45 -0
- package/src/components/i18n/locales/hu/messages.json +45 -0
- package/src/components/i18n/locales/hy/messages.json +45 -0
- package/src/components/i18n/locales/id/messages.json +45 -0
- package/src/components/i18n/locales/index.ts +231 -0
- package/src/components/i18n/locales/it/messages.json +45 -0
- package/src/components/i18n/locales/ja/messages.json +45 -0
- package/src/components/i18n/locales/ka/messages.json +45 -0
- package/src/components/i18n/locales/km/messages.json +45 -0
- package/src/components/i18n/locales/kn/messages.json +45 -0
- package/src/components/i18n/locales/ko/messages.json +45 -0
- package/src/components/i18n/locales/ku/messages.json +45 -0
- package/src/components/i18n/locales/lo/messages.json +45 -0
- package/src/components/i18n/locales/lt/messages.json +45 -0
- package/src/components/i18n/locales/lv/messages.json +45 -0
- package/src/components/i18n/locales/mk/messages.json +45 -0
- package/src/components/i18n/locales/ml/messages.json +45 -0
- package/src/components/i18n/locales/mn/messages.json +45 -0
- package/src/components/i18n/locales/mr/messages.json +45 -0
- package/src/components/i18n/locales/ms/messages.json +45 -0
- package/src/components/i18n/locales/my/messages.json +45 -0
- package/src/components/i18n/locales/ne/messages.json +45 -0
- package/src/components/i18n/locales/nl/messages.json +45 -0
- package/src/components/i18n/locales/no/messages.json +45 -0
- package/src/components/i18n/locales/pa/messages.json +45 -0
- package/src/components/i18n/locales/pl/messages.json +45 -0
- package/src/components/i18n/locales/ps/messages.json +45 -0
- package/src/components/i18n/locales/pt/messages.json +45 -0
- package/src/components/i18n/locales/ro/messages.json +45 -0
- package/src/components/i18n/locales/ru/messages.json +45 -0
- package/src/components/i18n/locales/sd/messages.json +45 -0
- package/src/components/i18n/locales/si/messages.json +45 -0
- package/src/components/i18n/locales/sk/messages.json +45 -0
- package/src/components/i18n/locales/sl/messages.json +45 -0
- package/src/components/i18n/locales/sq/messages.json +45 -0
- package/src/components/i18n/locales/sr/messages.json +45 -0
- package/src/components/i18n/locales/sv/messages.json +45 -0
- package/src/components/i18n/locales/sw/messages.json +45 -0
- package/src/components/i18n/locales/ta/messages.json +45 -0
- package/src/components/i18n/locales/te/messages.json +45 -0
- package/src/components/i18n/locales/th/messages.json +45 -0
- package/src/components/i18n/locales/tr/messages.json +45 -0
- package/src/components/i18n/locales/ug/messages.json +45 -0
- package/src/components/i18n/locales/uk/messages.json +45 -0
- package/src/components/i18n/locales/ur/messages.json +45 -0
- package/src/components/i18n/locales/vi/messages.json +45 -0
- package/src/components/i18n/locales/yi/messages.json +45 -0
- package/src/components/i18n/locales/zh/messages.json +45 -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 +377 -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 +35 -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 +1591 -0
- package/src/components/modules/blockManager.ts +1356 -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 +1204 -0
- package/src/components/modules/history.ts +1098 -0
- package/src/components/modules/i18n.ts +332 -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 +711 -0
- package/src/components/modules/renderer.ts +155 -0
- package/src/components/modules/saver.ts +283 -0
- package/src/components/modules/toolbar/blockSettings.ts +781 -0
- package/src/components/modules/toolbar/index.ts +1315 -0
- package/src/components/modules/toolbar/inline.ts +956 -0
- package/src/components/modules/tools.ts +625 -0
- package/src/components/modules/ui.ts +1283 -0
- package/src/components/polyfills.ts +113 -0
- package/src/components/selection.ts +1179 -0
- package/src/components/tools/base.ts +301 -0
- package/src/components/tools/block.ts +339 -0
- package/src/components/tools/collection.ts +67 -0
- package/src/components/tools/factory.ts +138 -0
- package/src/components/tools/inline.ts +71 -0
- package/src/components/tools/tune.ts +33 -0
- package/src/components/ui/toolbox.ts +601 -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 +680 -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 +186 -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 +178 -0
- package/src/components/utils/popover/components/search-input/search-input.types.ts +59 -0
- package/src/components/utils/popover/index.ts +13 -0
- package/src/components/utils/popover/popover-abstract.ts +457 -0
- package/src/components/utils/popover/popover-desktop.ts +676 -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 +110 -0
- package/src/components/utils/tooltip.ts +591 -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 +646 -0
- package/src/tools/index.ts +45 -0
- package/src/tools/list/index.ts +1819 -0
- package/src/tools/paragraph/index.ts +412 -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 +9 -1
- package/types/api/history.d.ts +7 -0
- package/types/api/i18n.d.ts +22 -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 +170 -0
- package/types/data-formats/output-data.d.ts +15 -0
- package/types/full.d.ts +80 -0
- package/types/index.d.ts +30 -13
- 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 +92 -6
- package/types/tools/tool.d.ts +6 -0
- package/types/tools-entry.d.ts +49 -0
- package/types/utils/popover/popover-item.d.ts +18 -5
- package/types/utils/popover/popover.d.ts +7 -0
- package/dist/blok-D_baBvTG.mjs +0 -25795
- package/dist/blok.umd.js +0 -181
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static imports for all 68 locales.
|
|
3
|
+
*
|
|
4
|
+
* This file forces Vite to bundle all locale JSON files instead of code-splitting them.
|
|
5
|
+
* It's only used for the "maximum" bundle size measurement variant.
|
|
6
|
+
*
|
|
7
|
+
* This file is NOT part of the public API.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Static imports for all locale message files
|
|
11
|
+
import am from '../components/i18n/locales/am/messages.json';
|
|
12
|
+
import ar from '../components/i18n/locales/ar/messages.json';
|
|
13
|
+
import az from '../components/i18n/locales/az/messages.json';
|
|
14
|
+
import bg from '../components/i18n/locales/bg/messages.json';
|
|
15
|
+
import bn from '../components/i18n/locales/bn/messages.json';
|
|
16
|
+
import bs from '../components/i18n/locales/bs/messages.json';
|
|
17
|
+
import cs from '../components/i18n/locales/cs/messages.json';
|
|
18
|
+
import da from '../components/i18n/locales/da/messages.json';
|
|
19
|
+
import de from '../components/i18n/locales/de/messages.json';
|
|
20
|
+
import dv from '../components/i18n/locales/dv/messages.json';
|
|
21
|
+
import el from '../components/i18n/locales/el/messages.json';
|
|
22
|
+
import en from '../components/i18n/locales/en/messages.json';
|
|
23
|
+
import es from '../components/i18n/locales/es/messages.json';
|
|
24
|
+
import et from '../components/i18n/locales/et/messages.json';
|
|
25
|
+
import fa from '../components/i18n/locales/fa/messages.json';
|
|
26
|
+
import fi from '../components/i18n/locales/fi/messages.json';
|
|
27
|
+
import fil from '../components/i18n/locales/fil/messages.json';
|
|
28
|
+
import fr from '../components/i18n/locales/fr/messages.json';
|
|
29
|
+
import gu from '../components/i18n/locales/gu/messages.json';
|
|
30
|
+
import he from '../components/i18n/locales/he/messages.json';
|
|
31
|
+
import hi from '../components/i18n/locales/hi/messages.json';
|
|
32
|
+
import hr from '../components/i18n/locales/hr/messages.json';
|
|
33
|
+
import hu from '../components/i18n/locales/hu/messages.json';
|
|
34
|
+
import hy from '../components/i18n/locales/hy/messages.json';
|
|
35
|
+
import id from '../components/i18n/locales/id/messages.json';
|
|
36
|
+
import it from '../components/i18n/locales/it/messages.json';
|
|
37
|
+
import ja from '../components/i18n/locales/ja/messages.json';
|
|
38
|
+
import ka from '../components/i18n/locales/ka/messages.json';
|
|
39
|
+
import km from '../components/i18n/locales/km/messages.json';
|
|
40
|
+
import kn from '../components/i18n/locales/kn/messages.json';
|
|
41
|
+
import ko from '../components/i18n/locales/ko/messages.json';
|
|
42
|
+
import ku from '../components/i18n/locales/ku/messages.json';
|
|
43
|
+
import lo from '../components/i18n/locales/lo/messages.json';
|
|
44
|
+
import lt from '../components/i18n/locales/lt/messages.json';
|
|
45
|
+
import lv from '../components/i18n/locales/lv/messages.json';
|
|
46
|
+
import mk from '../components/i18n/locales/mk/messages.json';
|
|
47
|
+
import ml from '../components/i18n/locales/ml/messages.json';
|
|
48
|
+
import mn from '../components/i18n/locales/mn/messages.json';
|
|
49
|
+
import mr from '../components/i18n/locales/mr/messages.json';
|
|
50
|
+
import ms from '../components/i18n/locales/ms/messages.json';
|
|
51
|
+
import my from '../components/i18n/locales/my/messages.json';
|
|
52
|
+
import ne from '../components/i18n/locales/ne/messages.json';
|
|
53
|
+
import nl from '../components/i18n/locales/nl/messages.json';
|
|
54
|
+
import no from '../components/i18n/locales/no/messages.json';
|
|
55
|
+
import pa from '../components/i18n/locales/pa/messages.json';
|
|
56
|
+
import pl from '../components/i18n/locales/pl/messages.json';
|
|
57
|
+
import ps from '../components/i18n/locales/ps/messages.json';
|
|
58
|
+
import pt from '../components/i18n/locales/pt/messages.json';
|
|
59
|
+
import ro from '../components/i18n/locales/ro/messages.json';
|
|
60
|
+
import ru from '../components/i18n/locales/ru/messages.json';
|
|
61
|
+
import sd from '../components/i18n/locales/sd/messages.json';
|
|
62
|
+
import si from '../components/i18n/locales/si/messages.json';
|
|
63
|
+
import sk from '../components/i18n/locales/sk/messages.json';
|
|
64
|
+
import sl from '../components/i18n/locales/sl/messages.json';
|
|
65
|
+
import sq from '../components/i18n/locales/sq/messages.json';
|
|
66
|
+
import sr from '../components/i18n/locales/sr/messages.json';
|
|
67
|
+
import sv from '../components/i18n/locales/sv/messages.json';
|
|
68
|
+
import sw from '../components/i18n/locales/sw/messages.json';
|
|
69
|
+
import ta from '../components/i18n/locales/ta/messages.json';
|
|
70
|
+
import te from '../components/i18n/locales/te/messages.json';
|
|
71
|
+
import th from '../components/i18n/locales/th/messages.json';
|
|
72
|
+
import tr from '../components/i18n/locales/tr/messages.json';
|
|
73
|
+
import ug from '../components/i18n/locales/ug/messages.json';
|
|
74
|
+
import uk from '../components/i18n/locales/uk/messages.json';
|
|
75
|
+
import ur from '../components/i18n/locales/ur/messages.json';
|
|
76
|
+
import vi from '../components/i18n/locales/vi/messages.json';
|
|
77
|
+
import yi from '../components/i18n/locales/yi/messages.json';
|
|
78
|
+
import zh from '../components/i18n/locales/zh/messages.json';
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* All locale dictionaries as a record.
|
|
82
|
+
* Exporting this ensures the imports are not tree-shaken.
|
|
83
|
+
*/
|
|
84
|
+
export const allLocales = {
|
|
85
|
+
am,
|
|
86
|
+
ar,
|
|
87
|
+
az,
|
|
88
|
+
bg,
|
|
89
|
+
bn,
|
|
90
|
+
bs,
|
|
91
|
+
cs,
|
|
92
|
+
da,
|
|
93
|
+
de,
|
|
94
|
+
dv,
|
|
95
|
+
el,
|
|
96
|
+
en,
|
|
97
|
+
es,
|
|
98
|
+
et,
|
|
99
|
+
fa,
|
|
100
|
+
fi,
|
|
101
|
+
fil,
|
|
102
|
+
fr,
|
|
103
|
+
gu,
|
|
104
|
+
he,
|
|
105
|
+
hi,
|
|
106
|
+
hr,
|
|
107
|
+
hu,
|
|
108
|
+
hy,
|
|
109
|
+
id,
|
|
110
|
+
it,
|
|
111
|
+
ja,
|
|
112
|
+
ka,
|
|
113
|
+
km,
|
|
114
|
+
kn,
|
|
115
|
+
ko,
|
|
116
|
+
ku,
|
|
117
|
+
lo,
|
|
118
|
+
lt,
|
|
119
|
+
lv,
|
|
120
|
+
mk,
|
|
121
|
+
ml,
|
|
122
|
+
mn,
|
|
123
|
+
mr,
|
|
124
|
+
ms,
|
|
125
|
+
my,
|
|
126
|
+
ne,
|
|
127
|
+
nl,
|
|
128
|
+
no,
|
|
129
|
+
pa,
|
|
130
|
+
pl,
|
|
131
|
+
ps,
|
|
132
|
+
pt,
|
|
133
|
+
ro,
|
|
134
|
+
ru,
|
|
135
|
+
sd,
|
|
136
|
+
si,
|
|
137
|
+
sk,
|
|
138
|
+
sl,
|
|
139
|
+
sq,
|
|
140
|
+
sr,
|
|
141
|
+
sv,
|
|
142
|
+
sw,
|
|
143
|
+
ta,
|
|
144
|
+
te,
|
|
145
|
+
th,
|
|
146
|
+
tr,
|
|
147
|
+
ug,
|
|
148
|
+
uk,
|
|
149
|
+
ur,
|
|
150
|
+
vi,
|
|
151
|
+
yi,
|
|
152
|
+
zh,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const localeCount = Object.keys(allLocales).length;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maximum bundle variant - All tools + all 68 locales
|
|
3
|
+
*
|
|
4
|
+
* This entry point bundles everything: the Blok class, all bundled tools,
|
|
5
|
+
* and all 68 locale dictionaries (statically imported, not code-split).
|
|
6
|
+
*
|
|
7
|
+
* Use this to measure the maximum bundle size when everything is included.
|
|
8
|
+
*
|
|
9
|
+
* This file is NOT part of the public API - it's only used for bundle size measurement.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// Re-export everything from the main blok entry
|
|
13
|
+
export * from '../blok';
|
|
14
|
+
|
|
15
|
+
// Import all locales to force them into the bundle
|
|
16
|
+
// The allLocales export ensures these aren't tree-shaken
|
|
17
|
+
import { allLocales, localeCount } from './all-locales';
|
|
18
|
+
|
|
19
|
+
// Export to prevent tree-shaking
|
|
20
|
+
export { allLocales, localeCount };
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Minimum bundle variant - Core editor only
|
|
5
|
+
*
|
|
6
|
+
* This entry point exports the Blok class WITHOUT bundled tools (Header, Paragraph, List).
|
|
7
|
+
* Use this to measure the minimum bundle size when users provide all tools externally.
|
|
8
|
+
*
|
|
9
|
+
* This file is NOT part of the public API - it's only used for bundle size measurement.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { BlokConfig } from '../../types';
|
|
13
|
+
import type { BlokModules } from '../types-internal/blok-modules';
|
|
14
|
+
|
|
15
|
+
import '@babel/register';
|
|
16
|
+
import '../components/polyfills';
|
|
17
|
+
import { Core } from '../components/core';
|
|
18
|
+
import { getBlokVersion, isObject, isFunction } from '../components/utils';
|
|
19
|
+
import { destroy as destroyTooltip } from '../components/utils/tooltip';
|
|
20
|
+
import { DATA_ATTR } from '../components/constants/data-attributes';
|
|
21
|
+
|
|
22
|
+
export const version = getBlokVersion();
|
|
23
|
+
export { DATA_ATTR };
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Blok - Minimum bundle (no bundled tools)
|
|
27
|
+
*/
|
|
28
|
+
class Blok {
|
|
29
|
+
private readonly initialConfiguration: BlokConfig | string | undefined;
|
|
30
|
+
public isReady: Promise<void>;
|
|
31
|
+
public destroy: () => void;
|
|
32
|
+
|
|
33
|
+
public static get version(): string {
|
|
34
|
+
return getBlokVersion();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public static DATA_ATTR = DATA_ATTR;
|
|
38
|
+
|
|
39
|
+
constructor(configuration?: BlokConfig | string) {
|
|
40
|
+
this.initialConfiguration = isObject(configuration)
|
|
41
|
+
? { ...configuration }
|
|
42
|
+
: configuration;
|
|
43
|
+
|
|
44
|
+
const onReady =
|
|
45
|
+
isObject(configuration) && isFunction(configuration.onReady)
|
|
46
|
+
? configuration.onReady
|
|
47
|
+
: () => {};
|
|
48
|
+
|
|
49
|
+
const blok = new Core(configuration);
|
|
50
|
+
|
|
51
|
+
this.destroy = (): void => {};
|
|
52
|
+
|
|
53
|
+
this.isReady = blok.isReady.then(() => {
|
|
54
|
+
this.exportAPI(blok);
|
|
55
|
+
onReady();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public exportAPI(blok: Core): void {
|
|
60
|
+
const fieldsToExport = ['configuration'];
|
|
61
|
+
const destroy = (): void => {
|
|
62
|
+
Object.values(blok.moduleInstances).forEach((moduleInstance) => {
|
|
63
|
+
if (moduleInstance === undefined || moduleInstance === null) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (
|
|
68
|
+
isFunction((moduleInstance as { destroy?: () => void }).destroy)
|
|
69
|
+
) {
|
|
70
|
+
(moduleInstance as { destroy: () => void }).destroy();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const listeners = (
|
|
74
|
+
moduleInstance as { listeners?: { removeAll?: () => void } }
|
|
75
|
+
).listeners;
|
|
76
|
+
|
|
77
|
+
if (listeners && isFunction(listeners.removeAll)) {
|
|
78
|
+
listeners.removeAll();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
destroyTooltip();
|
|
83
|
+
|
|
84
|
+
for (const field in this) {
|
|
85
|
+
if (Object.prototype.hasOwnProperty.call(this, field)) {
|
|
86
|
+
delete (this as Record<string, unknown>)[field];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Object.setPrototypeOf(this, null);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
fieldsToExport.forEach((field) => {
|
|
94
|
+
if (field !== 'configuration') {
|
|
95
|
+
(this as Record<string, unknown>)[field] = (
|
|
96
|
+
blok as unknown as Record<string, unknown>
|
|
97
|
+
)[field];
|
|
98
|
+
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const coreConfiguration = (
|
|
103
|
+
blok as unknown as { configuration?: BlokConfig | string | undefined }
|
|
104
|
+
).configuration;
|
|
105
|
+
const configurationToExport = isObject(this.initialConfiguration)
|
|
106
|
+
? this.initialConfiguration
|
|
107
|
+
: (coreConfiguration ?? this.initialConfiguration);
|
|
108
|
+
|
|
109
|
+
if (configurationToExport === undefined) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
(this as Record<string, unknown>)[field] = configurationToExport as
|
|
114
|
+
| BlokConfig
|
|
115
|
+
| string;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
this.destroy = destroy;
|
|
119
|
+
|
|
120
|
+
const apiMethods = blok.moduleInstances.API.methods;
|
|
121
|
+
const eventsDispatcherApi =
|
|
122
|
+
blok.moduleInstances.EventsAPI?.methods ?? apiMethods.events;
|
|
123
|
+
|
|
124
|
+
if (eventsDispatcherApi !== undefined) {
|
|
125
|
+
const defineDispatcher = (target: object): void => {
|
|
126
|
+
if (!Object.prototype.hasOwnProperty.call(target, 'eventsDispatcher')) {
|
|
127
|
+
Object.defineProperty(target, 'eventsDispatcher', {
|
|
128
|
+
value: eventsDispatcherApi,
|
|
129
|
+
configurable: true,
|
|
130
|
+
enumerable: true,
|
|
131
|
+
writable: false,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
defineDispatcher(apiMethods);
|
|
137
|
+
defineDispatcher(this as Record<string, unknown>);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (Object.getPrototypeOf(apiMethods) !== Blok.prototype) {
|
|
141
|
+
Object.setPrototypeOf(apiMethods, Blok.prototype);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Object.setPrototypeOf(this, apiMethods);
|
|
145
|
+
|
|
146
|
+
const moduleAliases = Object.create(null) as Record<string, unknown>;
|
|
147
|
+
const moduleInstances = blok.moduleInstances as Partial<BlokModules>;
|
|
148
|
+
const moduleInstancesRecord = moduleInstances as unknown as Record<
|
|
149
|
+
string,
|
|
150
|
+
unknown
|
|
151
|
+
>;
|
|
152
|
+
|
|
153
|
+
const getAliasName = (name: string): string =>
|
|
154
|
+
/^[A-Z]+$/.test(name)
|
|
155
|
+
? name.toLowerCase()
|
|
156
|
+
: name.charAt(0).toLowerCase() + name.slice(1);
|
|
157
|
+
|
|
158
|
+
Object.keys(moduleInstancesRecord).forEach((name) => {
|
|
159
|
+
const alias = getAliasName(name);
|
|
160
|
+
|
|
161
|
+
Object.defineProperty(moduleAliases, alias, {
|
|
162
|
+
configurable: true,
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: () => moduleInstancesRecord[name],
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
type ToolbarModuleWithSettings = {
|
|
169
|
+
blockSettings?: unknown;
|
|
170
|
+
inlineToolbar?: unknown;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const toolbarModule = moduleInstances.Toolbar as unknown as
|
|
174
|
+
| ToolbarModuleWithSettings
|
|
175
|
+
| undefined;
|
|
176
|
+
const blockSettingsModule = moduleInstances.BlockSettings;
|
|
177
|
+
|
|
178
|
+
if (
|
|
179
|
+
toolbarModule !== undefined &&
|
|
180
|
+
blockSettingsModule !== undefined &&
|
|
181
|
+
toolbarModule.blockSettings === undefined
|
|
182
|
+
) {
|
|
183
|
+
toolbarModule.blockSettings = blockSettingsModule;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const inlineToolbarModule = moduleInstances.InlineToolbar;
|
|
187
|
+
|
|
188
|
+
if (
|
|
189
|
+
toolbarModule !== undefined &&
|
|
190
|
+
inlineToolbarModule !== undefined &&
|
|
191
|
+
toolbarModule.inlineToolbar === undefined
|
|
192
|
+
) {
|
|
193
|
+
toolbarModule.inlineToolbar = inlineToolbarModule;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
Object.defineProperty(this, 'module', {
|
|
197
|
+
value: moduleAliases,
|
|
198
|
+
configurable: true,
|
|
199
|
+
enumerable: false,
|
|
200
|
+
writable: false,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
delete (this as Partial<Blok>).exportAPI;
|
|
204
|
+
|
|
205
|
+
const shorthands = {
|
|
206
|
+
blocks: {
|
|
207
|
+
clear: 'clear',
|
|
208
|
+
render: 'render',
|
|
209
|
+
},
|
|
210
|
+
caret: {
|
|
211
|
+
focus: 'focus',
|
|
212
|
+
},
|
|
213
|
+
events: {
|
|
214
|
+
on: 'on',
|
|
215
|
+
off: 'off',
|
|
216
|
+
emit: 'emit',
|
|
217
|
+
},
|
|
218
|
+
saver: {
|
|
219
|
+
save: 'save',
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
type API = {
|
|
224
|
+
blocks: Record<string, unknown>;
|
|
225
|
+
caret: Record<string, unknown>;
|
|
226
|
+
events: Record<string, unknown>;
|
|
227
|
+
saver: Record<string, unknown>;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
Object.entries(shorthands).forEach(([key, methods]) => {
|
|
231
|
+
Object.entries(methods).forEach(([name, alias]) => {
|
|
232
|
+
const apiKey = key as keyof API;
|
|
233
|
+
const apiMethodGroup = blok.moduleInstances.API.methods[
|
|
234
|
+
apiKey
|
|
235
|
+
] as unknown as Record<string, unknown>;
|
|
236
|
+
|
|
237
|
+
(this as Record<string, unknown>)[alias] = apiMethodGroup[name];
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export { Blok };
|
package/types/api/blocks.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface Blocks {
|
|
|
32
32
|
* Removes current Block
|
|
33
33
|
* @param {number} index - index of a block to delete
|
|
34
34
|
*/
|
|
35
|
-
delete(index?: number): void
|
|
35
|
+
delete(index?: number): Promise<void>;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Moves a block to a new index
|
|
@@ -133,4 +133,12 @@ export interface Blocks {
|
|
|
133
133
|
* @throws Error if conversion is not possible
|
|
134
134
|
*/
|
|
135
135
|
convert(id: string, newType: string, dataOverrides?: BlockToolData): Promise<BlockAPI>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Stops mutation watching on a block at the specified index.
|
|
139
|
+
* This is used to prevent spurious block-changed events during block replacement.
|
|
140
|
+
*
|
|
141
|
+
* @param index - index of the block to stop watching
|
|
142
|
+
*/
|
|
143
|
+
stopBlockMutationWatching(index: number): void;
|
|
136
144
|
}
|
package/types/api/history.d.ts
CHANGED
|
@@ -30,4 +30,11 @@ export interface History {
|
|
|
30
30
|
* Clears the history stacks, removing all undo/redo history
|
|
31
31
|
*/
|
|
32
32
|
clear(): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Captures the initial document state for undo/redo
|
|
36
|
+
* Typically called after the editor is fully initialized
|
|
37
|
+
* @returns Promise that resolves when the initial state is captured
|
|
38
|
+
*/
|
|
39
|
+
captureInitialState(): Promise<void>;
|
|
33
40
|
}
|
package/types/api/i18n.d.ts
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Describes Blok
|
|
2
|
+
* Describes Blok's I18n API for tools
|
|
3
3
|
*/
|
|
4
4
|
export interface I18n {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Translate a key from the global dictionary.
|
|
7
|
+
* Keys should be fully qualified (e.g., 'tools.link.addLink', 'blockSettings.delete').
|
|
7
8
|
*
|
|
8
|
-
* @param dictKey -
|
|
9
|
+
* @param dictKey - Full translation key to look up
|
|
10
|
+
* @returns Translated string, or the key itself if translation is missing
|
|
9
11
|
*/
|
|
10
12
|
t(dictKey: string): string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Check if a translation exists for the given key.
|
|
16
|
+
*
|
|
17
|
+
* @param dictKey - Full translation key to check
|
|
18
|
+
* @returns True if translation exists, false otherwise
|
|
19
|
+
*/
|
|
20
|
+
has(dictKey: string): boolean;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get the English translation for a key.
|
|
24
|
+
* Used for multilingual search - always searches against English terms.
|
|
25
|
+
*
|
|
26
|
+
* @param key - Translation key (e.g., 'toolNames.heading')
|
|
27
|
+
* @returns English translation string, or empty string if not found
|
|
28
|
+
*/
|
|
29
|
+
getEnglishTranslation(key: string): string;
|
|
11
30
|
}
|
package/types/api/selection.d.ts
CHANGED
|
@@ -27,6 +27,12 @@ export interface Selection {
|
|
|
27
27
|
*/
|
|
28
28
|
removeFakeBackground(): void;
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Clears all fake background state - both DOM elements and internal flags
|
|
32
|
+
* This is useful for cleanup after undo/redo operations or when the selection context has been lost
|
|
33
|
+
*/
|
|
34
|
+
clearFakeBackground(): void;
|
|
35
|
+
|
|
30
36
|
/**
|
|
31
37
|
* Save selection range.
|
|
32
38
|
* Allows to save selection to be able to temporally move focus away.
|
package/types/api/styles.d.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style class names for tool styling.
|
|
3
|
+
* These are single CSS class names that can be safely used with element.classList.add().
|
|
4
|
+
* The actual styles are defined using Tailwind's @apply directive in the CSS.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // Add styles to an element
|
|
8
|
+
* element.classList.add(api.styles.block);
|
|
9
|
+
*
|
|
10
|
+
* // Combine with other classes using tailwind-merge
|
|
11
|
+
* import { twMerge } from '@jackuait/blok/utils/tw';
|
|
12
|
+
* element.className = twMerge(api.styles.block, 'my-4 bg-gray-100');
|
|
13
|
+
*/
|
|
1
14
|
export interface Styles {
|
|
2
15
|
/**
|
|
3
16
|
* Base block styles - applied to block tool wrappers.
|
|
4
17
|
* Provides vertical padding for consistent block spacing.
|
|
5
18
|
* Includes placeholder styling via pseudo-element.
|
|
6
19
|
*
|
|
7
|
-
* @example '
|
|
20
|
+
* @example 'blok-block'
|
|
8
21
|
*/
|
|
9
22
|
block: string;
|
|
10
23
|
|
|
@@ -12,7 +25,7 @@ export interface Styles {
|
|
|
12
25
|
* Styles for Inline Toolbar button.
|
|
13
26
|
* Provides flexbox centering, transparent background, and proper sizing.
|
|
14
27
|
*
|
|
15
|
-
* @example '
|
|
28
|
+
* @example 'blok-inline-tool-button'
|
|
16
29
|
*/
|
|
17
30
|
inlineToolButton: string;
|
|
18
31
|
|
|
@@ -20,7 +33,7 @@ export interface Styles {
|
|
|
20
33
|
* Styles for active Inline Toolbar button.
|
|
21
34
|
* Apply alongside inlineToolButton when the tool is active.
|
|
22
35
|
*
|
|
23
|
-
* @example '
|
|
36
|
+
* @example 'blok-inline-tool-button--active'
|
|
24
37
|
*/
|
|
25
38
|
inlineToolButtonActive: string;
|
|
26
39
|
|
|
@@ -28,7 +41,7 @@ export interface Styles {
|
|
|
28
41
|
* Styles for input elements.
|
|
29
42
|
* Provides full width, border, padding, shadow, and Firefox placeholder workaround.
|
|
30
43
|
*
|
|
31
|
-
* @example '
|
|
44
|
+
* @example 'blok-input'
|
|
32
45
|
*/
|
|
33
46
|
input: string;
|
|
34
47
|
|
|
@@ -36,7 +49,7 @@ export interface Styles {
|
|
|
36
49
|
* Loader styles for loading states.
|
|
37
50
|
* Provides relative positioning, border, and spinning animation.
|
|
38
51
|
*
|
|
39
|
-
* @example '
|
|
52
|
+
* @example 'blok-loader'
|
|
40
53
|
*/
|
|
41
54
|
loader: string;
|
|
42
55
|
|
|
@@ -45,7 +58,7 @@ export interface Styles {
|
|
|
45
58
|
* Provides flexbox centering, transparent background, minimum sizing,
|
|
46
59
|
* mobile responsive sizing, and hover states.
|
|
47
60
|
*
|
|
48
|
-
* @example '
|
|
61
|
+
* @example 'blok-settings-button'
|
|
49
62
|
*/
|
|
50
63
|
settingsButton: string;
|
|
51
64
|
|
|
@@ -53,7 +66,7 @@ export interface Styles {
|
|
|
53
66
|
* Styles for active Settings box buttons.
|
|
54
67
|
* Apply alongside settingsButton when the button is active.
|
|
55
68
|
*
|
|
56
|
-
* @example '
|
|
69
|
+
* @example 'blok-settings-button--active'
|
|
57
70
|
*/
|
|
58
71
|
settingsButtonActive: string;
|
|
59
72
|
|
|
@@ -61,7 +74,7 @@ export interface Styles {
|
|
|
61
74
|
* Styles for focused Settings box buttons.
|
|
62
75
|
* Apply alongside settingsButton when the button has focus.
|
|
63
76
|
*
|
|
64
|
-
* @example '
|
|
77
|
+
* @example 'blok-settings-button--focused'
|
|
65
78
|
*/
|
|
66
79
|
settingsButtonFocused: string;
|
|
67
80
|
|
|
@@ -69,7 +82,7 @@ export interface Styles {
|
|
|
69
82
|
* Styles for focused Settings box buttons with animation.
|
|
70
83
|
* Apply alongside settingsButton and settingsButtonFocused for click animation.
|
|
71
84
|
*
|
|
72
|
-
* @example '
|
|
85
|
+
* @example 'blok-settings-button--focused-animated'
|
|
73
86
|
*/
|
|
74
87
|
settingsButtonFocusedAnimated: string;
|
|
75
88
|
|
|
@@ -77,7 +90,7 @@ export interface Styles {
|
|
|
77
90
|
* Styles for general buttons.
|
|
78
91
|
* Provides padding, border, background, shadow, hover states, and SVG styling.
|
|
79
92
|
*
|
|
80
|
-
* @example '
|
|
93
|
+
* @example 'blok-button'
|
|
81
94
|
*/
|
|
82
95
|
button: string;
|
|
83
96
|
}
|
|
@@ -4,6 +4,14 @@ import {SanitizerConfig} from './sanitizer-config';
|
|
|
4
4
|
import {I18nConfig} from './i18n-config';
|
|
5
5
|
import { BlockMutationEvent } from '../events/block';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Data model format for input/output
|
|
9
|
+
* - 'legacy': Use nested items structure (e.g., List items[] with nested items[])
|
|
10
|
+
* - 'hierarchical': Use flat blocks with parent/content references (Notion-like)
|
|
11
|
+
* - 'auto': Auto-detect input format and preserve it on output (default)
|
|
12
|
+
*/
|
|
13
|
+
export type DataModelFormat = 'legacy' | 'hierarchical' | 'auto';
|
|
14
|
+
|
|
7
15
|
export interface BlokConfig {
|
|
8
16
|
/**
|
|
9
17
|
* Element where Blok will be appended
|
|
@@ -22,6 +30,19 @@ export interface BlokConfig {
|
|
|
22
30
|
*/
|
|
23
31
|
defaultBlock?: string;
|
|
24
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Data model format for input/output.
|
|
35
|
+
* - 'legacy': Always use nested items structure (e.g., List items[] with nested items[])
|
|
36
|
+
* - 'hierarchical': Always use flat blocks with parent/content references (Notion-like)
|
|
37
|
+
* - 'auto': Auto-detect input format and preserve it on output (default)
|
|
38
|
+
*
|
|
39
|
+
* With 'auto', existing articles using legacy format will continue to work unchanged,
|
|
40
|
+
* while new hierarchical data will be preserved as-is.
|
|
41
|
+
*
|
|
42
|
+
* @default 'auto'
|
|
43
|
+
*/
|
|
44
|
+
dataModel?: DataModelFormat;
|
|
45
|
+
|
|
25
46
|
|
|
26
47
|
|
|
27
48
|
/**
|
|
@@ -52,6 +73,14 @@ export interface BlokConfig {
|
|
|
52
73
|
*/
|
|
53
74
|
historyDebounceTime?: number;
|
|
54
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Enable document-level undo/redo shortcuts.
|
|
78
|
+
* When true, Cmd+Z / Ctrl+Z and Cmd+Shift+Z / Ctrl+Shift+Z work even when
|
|
79
|
+
* the editor is not focused (e.g., after dragging a block).
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
globalUndoRedo?: boolean;
|
|
83
|
+
|
|
55
84
|
/**
|
|
56
85
|
* Map of Tools to use
|
|
57
86
|
*/
|