@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
|
@@ -3,14 +3,64 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { I18nDictionary } from './i18n-dictionary';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Supported locale codes that have built-in translations.
|
|
8
|
+
*
|
|
9
|
+
* When adding a new locale:
|
|
10
|
+
* 1. Add the code to this union type
|
|
11
|
+
* 2. Add the code to ALL_LOCALE_CODES in src/components/i18n/locales/index.ts
|
|
12
|
+
* 3. Add the importer to localeImporters in the same file
|
|
13
|
+
* 4. Create the messages.json file in src/components/i18n/locales/{code}/
|
|
14
|
+
*
|
|
15
|
+
* TypeScript will error if localeImporters is missing any code from this type.
|
|
16
|
+
*/
|
|
17
|
+
export type SupportedLocale = 'am' | 'ar' | 'az' | 'bg' | 'bn' | 'bs' | 'cs' | 'da' | 'de' | 'dv' | 'el' | 'en' | 'es' | 'et' | 'fa' | 'fi' | 'fil' | 'fr' | 'gu' | 'he' | 'hi' | 'hr' | 'hu' | 'hy' | 'id' | 'it' | 'ja' | 'ka' | 'km' | 'kn' | 'ko' | 'ku' | 'lo' | 'lt' | 'lv' | 'mk' | 'ml' | 'mn' | 'mr' | 'ms' | 'my' | 'ne' | 'nl' | 'no' | 'pa' | 'pl' | 'ps' | 'pt' | 'ro' | 'ru' | 'sd' | 'si' | 'sk' | 'sl' | 'sq' | 'sr' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tr' | 'ug' | 'uk' | 'ur' | 'vi' | 'yi' | 'zh';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for a single locale including its dictionary and text direction.
|
|
21
|
+
* This is the single source of truth for locale configuration shape.
|
|
22
|
+
*/
|
|
23
|
+
export interface LocaleConfig {
|
|
24
|
+
/** Translation dictionary mapping keys to translated strings */
|
|
25
|
+
dictionary: I18nDictionary;
|
|
26
|
+
/** Text direction for the locale */
|
|
27
|
+
direction: 'ltr' | 'rtl';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Registry of locale configurations.
|
|
32
|
+
*/
|
|
33
|
+
export type LocaleRegistry = Partial<Record<SupportedLocale, LocaleConfig>>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* I18n configuration options.
|
|
37
|
+
*
|
|
38
|
+
* All 68 supported locales are available for lazy loading by default.
|
|
39
|
+
*
|
|
40
|
+
* @see README.md#localization for usage examples
|
|
41
|
+
*/
|
|
6
42
|
export interface I18nConfig {
|
|
7
43
|
/**
|
|
8
|
-
*
|
|
44
|
+
* Active locale code ('en', 'ru', etc.) or 'auto' to detect from browser.
|
|
45
|
+
* All 68 locales are supported and will be loaded on-demand.
|
|
46
|
+
* @default 'auto'
|
|
47
|
+
*/
|
|
48
|
+
locale?: SupportedLocale | 'auto';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Custom dictionary that overrides locale-based translations.
|
|
9
52
|
*/
|
|
10
53
|
messages?: I18nDictionary;
|
|
11
54
|
|
|
12
55
|
/**
|
|
13
|
-
* Text direction.
|
|
56
|
+
* Text direction. Auto-determined by locale if not set.
|
|
57
|
+
* @default 'ltr'
|
|
14
58
|
*/
|
|
15
59
|
direction?: 'ltr' | 'rtl';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Fallback locale when detection fails or requested locale unavailable.
|
|
63
|
+
* @default 'en'
|
|
64
|
+
*/
|
|
65
|
+
defaultLocale?: SupportedLocale;
|
|
16
66
|
}
|
|
@@ -1,93 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Structure of the i18n dictionary
|
|
2
|
+
* Structure of the i18n dictionary - flat key-value pairs
|
|
3
|
+
*
|
|
4
|
+
* Keys use dot notation to represent the translation path:
|
|
5
|
+
* - "toolNames.text" - Tool name translations
|
|
6
|
+
* - "tools.link.addLink" - Tool-specific translations
|
|
7
|
+
* - "blockSettings.delete" - Block settings translations
|
|
8
|
+
* - "popover.search" - Popover component translations
|
|
9
|
+
* - "a11y.dragHandle" - Accessibility translations
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* {
|
|
13
|
+
* "toolNames.text": "Текст",
|
|
14
|
+
* "tools.link.addLink": "Добавить ссылку",
|
|
15
|
+
* "popover.search": "Поиск"
|
|
16
|
+
* }
|
|
3
17
|
*/
|
|
4
|
-
export
|
|
5
|
-
/**
|
|
6
|
-
* Section for translation Tool Names: both block and inline tools
|
|
7
|
-
* Example:
|
|
8
|
-
* "toolNames": {
|
|
9
|
-
* "Text": "Параграф",
|
|
10
|
-
* "Heading": "Заголовок",
|
|
11
|
-
* "List": "Список",
|
|
12
|
-
* ...
|
|
13
|
-
* },
|
|
14
|
-
*/
|
|
15
|
-
toolNames?: Dictionary;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Section for passing translations to the external tools classes
|
|
19
|
-
* The first-level keys of this object should be equal of keys ot the 'tools' property of BlokConfig
|
|
20
|
-
* Includes internal tools: "paragraph", "stub"
|
|
21
|
-
*
|
|
22
|
-
* Example:
|
|
23
|
-
* "tools": {
|
|
24
|
-
* "warning": {
|
|
25
|
-
* "Title": "Название",
|
|
26
|
-
* "Message": "Сообщение",
|
|
27
|
-
* },
|
|
28
|
-
* "link": {
|
|
29
|
-
* "Add a link": "Вставьте ссылку"
|
|
30
|
-
* },
|
|
31
|
-
* },
|
|
32
|
-
*/
|
|
33
|
-
tools?: Dictionary;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Section allows to translate Block Tunes
|
|
37
|
-
* The first-level keys of this object should be equal of 'name' ot the 'tools.<toolName>.tunes' property of BlokConfig
|
|
38
|
-
* Including some internal block-tunes: "delete", "moveUp", "moveDown
|
|
39
|
-
*
|
|
40
|
-
* Example:
|
|
41
|
-
* "blockTunes": {
|
|
42
|
-
* "delete": {
|
|
43
|
-
* "Delete": "Удалить"
|
|
44
|
-
* },
|
|
45
|
-
* "moveUp": {
|
|
46
|
-
* "Move up": "Переместить вверх"
|
|
47
|
-
* },
|
|
48
|
-
* "moveDown": {
|
|
49
|
-
* "Move down": "Переместить вниз"
|
|
50
|
-
* }
|
|
51
|
-
* },
|
|
52
|
-
*/
|
|
53
|
-
blockTunes?: Dictionary;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Translation of internal UI components of the blok.js core
|
|
57
|
-
*/
|
|
58
|
-
ui?: Dictionary;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Represent item of the I18nDictionary config
|
|
63
|
-
*/
|
|
64
|
-
export interface Dictionary {
|
|
65
|
-
/**
|
|
66
|
-
* The keys of the object can represent two entities:
|
|
67
|
-
* 1. Dictionary key usually is an original string from default locale, like "Convert to"
|
|
68
|
-
* 2. Sub-namespace section, like "toolbar.converter.<...>"
|
|
69
|
-
*
|
|
70
|
-
* Example of 1:
|
|
71
|
-
* toolbox: {
|
|
72
|
-
* "Add": "Добавить",
|
|
73
|
-
* }
|
|
74
|
-
*
|
|
75
|
-
* Example of 2:
|
|
76
|
-
* ui: {
|
|
77
|
-
* toolbar: {
|
|
78
|
-
* toolbox: { <-- Example of 1
|
|
79
|
-
* "Add": "Добавить"
|
|
80
|
-
* }
|
|
81
|
-
* }
|
|
82
|
-
* }
|
|
83
|
-
*/
|
|
84
|
-
[key: string]: DictValue;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The value of the dictionary can be:
|
|
89
|
-
* - other dictionary
|
|
90
|
-
* - result translate string
|
|
91
|
-
*/
|
|
92
|
-
export type DictValue = {[key: string]: Dictionary | string} | string;
|
|
18
|
+
export type I18nDictionary = Record<string, string>;
|
|
93
19
|
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized data attributes used across the Blok editor.
|
|
3
|
+
* This is the single source of truth for all data-blok-* attributes.
|
|
4
|
+
*
|
|
5
|
+
* Access via Blok.DATA_ATTR
|
|
6
|
+
*/
|
|
7
|
+
export const DATA_ATTR: {
|
|
8
|
+
// Core Element Identifiers
|
|
9
|
+
readonly interface: 'data-blok-interface';
|
|
10
|
+
readonly element: 'data-blok-element';
|
|
11
|
+
readonly elementContent: 'data-blok-element-content';
|
|
12
|
+
readonly editor: 'data-blok-editor';
|
|
13
|
+
readonly redactor: 'data-blok-redactor';
|
|
14
|
+
|
|
15
|
+
// Block Identifiers
|
|
16
|
+
readonly id: 'data-blok-id';
|
|
17
|
+
readonly component: 'data-blok-component';
|
|
18
|
+
readonly tool: 'data-blok-tool';
|
|
19
|
+
readonly depth: 'data-blok-depth';
|
|
20
|
+
|
|
21
|
+
// Global States
|
|
22
|
+
readonly hidden: 'data-blok-hidden';
|
|
23
|
+
readonly disabled: 'data-blok-disabled';
|
|
24
|
+
readonly focused: 'data-blok-focused';
|
|
25
|
+
readonly selected: 'data-blok-selected';
|
|
26
|
+
readonly stretched: 'data-blok-stretched';
|
|
27
|
+
readonly empty: 'data-blok-empty';
|
|
28
|
+
|
|
29
|
+
// Editor Modes
|
|
30
|
+
readonly narrow: 'data-blok-narrow';
|
|
31
|
+
readonly rtl: 'data-blok-rtl';
|
|
32
|
+
|
|
33
|
+
// Drag and Drop
|
|
34
|
+
readonly dragging: 'data-blok-dragging';
|
|
35
|
+
readonly draggingMulti: 'data-blok-dragging-multi';
|
|
36
|
+
readonly duplicating: 'data-blok-duplicating';
|
|
37
|
+
readonly dragHandle: 'data-blok-drag-handle';
|
|
38
|
+
|
|
39
|
+
// Toolbar
|
|
40
|
+
readonly toolbar: 'data-blok-toolbar';
|
|
41
|
+
readonly settingsToggler: 'data-blok-settings-toggler';
|
|
42
|
+
readonly toolboxOpened: 'data-blok-toolbox-opened';
|
|
43
|
+
readonly blockSettingsOpened: 'data-blok-block-settings-opened';
|
|
44
|
+
readonly opened: 'data-blok-opened';
|
|
45
|
+
|
|
46
|
+
// Popover Container
|
|
47
|
+
readonly popover: 'data-blok-popover';
|
|
48
|
+
readonly popoverContainer: 'data-blok-popover-container';
|
|
49
|
+
readonly popoverItems: 'data-blok-popover-items';
|
|
50
|
+
readonly popoverOverlay: 'data-blok-popover-overlay';
|
|
51
|
+
readonly popoverCustomContent: 'data-blok-popover-custom-content';
|
|
52
|
+
readonly popoverCustomClass: 'data-blok-popover-custom-class';
|
|
53
|
+
readonly popoverInline: 'data-blok-popover-inline';
|
|
54
|
+
readonly popoverOpened: 'data-blok-popover-opened';
|
|
55
|
+
readonly popoverOpenTop: 'data-blok-popover-open-top';
|
|
56
|
+
readonly popoverOpenLeft: 'data-blok-popover-open-left';
|
|
57
|
+
|
|
58
|
+
// Popover Nesting
|
|
59
|
+
readonly nested: 'data-blok-nested';
|
|
60
|
+
readonly nestedLevel: 'data-blok-nested-level';
|
|
61
|
+
|
|
62
|
+
// Popover Header
|
|
63
|
+
readonly popoverHeader: 'data-blok-popover-header';
|
|
64
|
+
readonly popoverHeaderText: 'data-blok-popover-header-text';
|
|
65
|
+
readonly popoverHeaderBackButton: 'data-blok-popover-header-back-button';
|
|
66
|
+
|
|
67
|
+
// Popover Items
|
|
68
|
+
readonly popoverItem: 'data-blok-popover-item';
|
|
69
|
+
readonly popoverItemIcon: 'data-blok-popover-item-icon';
|
|
70
|
+
readonly popoverItemIconChevronRight: 'data-blok-popover-item-icon-chevron-right';
|
|
71
|
+
readonly popoverItemTitle: 'data-blok-popover-item-title';
|
|
72
|
+
readonly popoverItemSecondaryTitle: 'data-blok-popover-item-secondary-title';
|
|
73
|
+
readonly popoverItemActive: 'data-blok-popover-item-active';
|
|
74
|
+
readonly popoverItemConfirmation: 'data-blok-popover-item-confirmation';
|
|
75
|
+
readonly popoverItemNoHover: 'data-blok-popover-item-no-hover';
|
|
76
|
+
readonly popoverItemNoFocus: 'data-blok-popover-item-no-focus';
|
|
77
|
+
readonly popoverItemWobble: 'data-blok-popover-item-wobble';
|
|
78
|
+
readonly popoverItemSeparator: 'data-blok-popover-item-separator';
|
|
79
|
+
readonly popoverItemSeparatorLine: 'data-blok-popover-item-separator-line';
|
|
80
|
+
readonly popoverItemHtml: 'data-blok-popover-item-html';
|
|
81
|
+
readonly hasChildren: 'data-blok-has-children';
|
|
82
|
+
readonly itemName: 'data-blok-item-name';
|
|
83
|
+
readonly nothingFoundDisplayed: 'data-blok-nothing-found-displayed';
|
|
84
|
+
|
|
85
|
+
// Overlay / Selection
|
|
86
|
+
readonly overlay: 'data-blok-overlay';
|
|
87
|
+
readonly overlayContainer: 'data-blok-overlay-container';
|
|
88
|
+
readonly overlayRectangle: 'data-blok-overlay-rectangle';
|
|
89
|
+
readonly overlayHidden: 'data-blok-overlay-hidden';
|
|
90
|
+
readonly fakeCursor: 'data-blok-fake-cursor';
|
|
91
|
+
readonly fakeBackground: 'data-blok-fake-background';
|
|
92
|
+
|
|
93
|
+
// Scroll
|
|
94
|
+
readonly scrollZone: 'data-blok-scroll-zone';
|
|
95
|
+
readonly scrollLocked: 'data-blok-scroll-locked';
|
|
96
|
+
readonly scrollLockedHard: 'data-blok-scroll-locked-hard';
|
|
97
|
+
|
|
98
|
+
// Caret
|
|
99
|
+
readonly shadowCaret: 'data-blok-shadow-caret';
|
|
100
|
+
|
|
101
|
+
// Placeholders
|
|
102
|
+
readonly placeholder: 'data-blok-placeholder';
|
|
103
|
+
readonly placeholderActive: 'data-blok-placeholder-active';
|
|
104
|
+
|
|
105
|
+
// Mutation Tracking
|
|
106
|
+
readonly mutationFree: 'data-blok-mutation-free';
|
|
107
|
+
|
|
108
|
+
// Navigation
|
|
109
|
+
readonly navigationFocused: 'data-blok-navigation-focused';
|
|
110
|
+
readonly flipperNavigationTarget: 'data-blok-flipper-navigation-target';
|
|
111
|
+
|
|
112
|
+
// Inline Toolbar
|
|
113
|
+
readonly inlineToolbar: 'data-blok-inline-toolbar';
|
|
114
|
+
|
|
115
|
+
// Link Tool
|
|
116
|
+
readonly linkToolActive: 'data-blok-link-tool-active';
|
|
117
|
+
readonly linkToolUnlink: 'data-blok-link-tool-unlink';
|
|
118
|
+
readonly linkToolInputOpened: 'data-blok-link-tool-input-opened';
|
|
119
|
+
|
|
120
|
+
// Bold Tool
|
|
121
|
+
readonly boldCollapsedLength: 'data-blok-bold-collapsed-length';
|
|
122
|
+
readonly boldCollapsedActive: 'data-blok-bold-collapsed-active';
|
|
123
|
+
readonly boldPrevLength: 'data-blok-bold-prev-length';
|
|
124
|
+
readonly boldLeadingWs: 'data-blok-bold-leading-ws';
|
|
125
|
+
readonly boldMarker: 'data-blok-bold-marker';
|
|
126
|
+
|
|
127
|
+
// Tooltip
|
|
128
|
+
readonly shown: 'data-blok-shown';
|
|
129
|
+
readonly placement: 'data-blok-placement';
|
|
130
|
+
|
|
131
|
+
// Notifier
|
|
132
|
+
readonly bounceIn: 'data-blok-bounce-in';
|
|
133
|
+
|
|
134
|
+
// Announcer (Accessibility)
|
|
135
|
+
readonly announcer: 'data-blok-announcer';
|
|
136
|
+
|
|
137
|
+
// Stub Block
|
|
138
|
+
readonly stub: 'data-blok-stub';
|
|
139
|
+
readonly stubInfo: 'data-blok-stub-info';
|
|
140
|
+
readonly stubTitle: 'data-blok-stub-title';
|
|
141
|
+
readonly stubSubtitle: 'data-blok-stub-subtitle';
|
|
142
|
+
|
|
143
|
+
// Testing
|
|
144
|
+
readonly testid: 'data-blok-testid';
|
|
145
|
+
readonly forceHover: 'data-blok-force-hover';
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Type for DATA_ATTR keys
|
|
150
|
+
*/
|
|
151
|
+
export type DataAttrKey = keyof typeof DATA_ATTR;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Type for DATA_ATTR values
|
|
155
|
+
*/
|
|
156
|
+
export type DataAttrValue = (typeof DATA_ATTR)[DataAttrKey];
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Helper function to create a CSS selector from an attribute
|
|
160
|
+
*
|
|
161
|
+
* @param attr - The data attribute name from DATA_ATTR
|
|
162
|
+
* @param value - Optional value for the attribute (defaults to presence selector)
|
|
163
|
+
* @returns CSS selector string
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* createSelector(DATA_ATTR.element) // '[data-blok-element]'
|
|
167
|
+
* createSelector(DATA_ATTR.selected, true) // '[data-blok-selected="true"]'
|
|
168
|
+
* createSelector(DATA_ATTR.tool, 'paragraph') // '[data-blok-tool="paragraph"]'
|
|
169
|
+
*/
|
|
170
|
+
export const createSelector: (attr: DataAttrValue, value?: string | boolean) => string;
|
|
@@ -26,6 +26,21 @@ export interface OutputBlockData<Type extends string = string, Data extends obje
|
|
|
26
26
|
* Block Tunes data
|
|
27
27
|
*/
|
|
28
28
|
tunes?: {[name: string]: BlockTuneData};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Parent block id for hierarchical/nested blocks (Notion-like flat-with-references model).
|
|
32
|
+
* When present, this block is a child of the block with the specified id.
|
|
33
|
+
* Omit for root-level blocks.
|
|
34
|
+
*/
|
|
35
|
+
parent?: BlockId;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Array of child block ids (Notion-like flat-with-references model).
|
|
39
|
+
* References blocks that are children of this block.
|
|
40
|
+
* The referenced blocks should have their `parent` field set to this block's id.
|
|
41
|
+
* Omit if block has no children.
|
|
42
|
+
*/
|
|
43
|
+
content?: BlockId[];
|
|
29
44
|
}
|
|
30
45
|
|
|
31
46
|
export interface OutputData {
|
package/types/full.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for @jackuait/blok/full entry point
|
|
3
|
+
* Full bundle with Blok core + all built-in tools
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Re-export everything from core
|
|
7
|
+
export { Blok, version, DATA_ATTR } from './index';
|
|
8
|
+
|
|
9
|
+
// Re-export all types from core
|
|
10
|
+
export * from './index';
|
|
11
|
+
|
|
12
|
+
// Re-export all tools
|
|
13
|
+
export {
|
|
14
|
+
Paragraph,
|
|
15
|
+
Header,
|
|
16
|
+
List,
|
|
17
|
+
Bold,
|
|
18
|
+
Italic,
|
|
19
|
+
Link,
|
|
20
|
+
Convert,
|
|
21
|
+
Delete,
|
|
22
|
+
defaultBlockTools,
|
|
23
|
+
defaultInlineTools,
|
|
24
|
+
HeaderData,
|
|
25
|
+
HeaderConfig,
|
|
26
|
+
ParagraphData,
|
|
27
|
+
ParagraphConfig,
|
|
28
|
+
ListData,
|
|
29
|
+
ListConfig,
|
|
30
|
+
ListStyle,
|
|
31
|
+
} from './tools';
|
|
32
|
+
|
|
33
|
+
import { ParagraphConstructable } from './tools/paragraph';
|
|
34
|
+
import { HeaderConstructable } from './tools/header';
|
|
35
|
+
import { ListConstructable } from './tools/list';
|
|
36
|
+
import { InlineToolConstructable } from './tools/inline-tool';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Default tools configuration matching pre-modularization behavior.
|
|
40
|
+
* Includes Paragraph, Header, and List with inline toolbar enabled.
|
|
41
|
+
*/
|
|
42
|
+
export const defaultTools: {
|
|
43
|
+
readonly paragraph: {
|
|
44
|
+
readonly class: ParagraphConstructable;
|
|
45
|
+
readonly inlineToolbar: true;
|
|
46
|
+
readonly config: { readonly preserveBlank: true };
|
|
47
|
+
};
|
|
48
|
+
readonly header: {
|
|
49
|
+
readonly class: HeaderConstructable;
|
|
50
|
+
readonly inlineToolbar: true;
|
|
51
|
+
};
|
|
52
|
+
readonly list: {
|
|
53
|
+
readonly class: ListConstructable;
|
|
54
|
+
readonly inlineToolbar: true;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* All built-in tools including inline tools.
|
|
60
|
+
* For users who want every tool available.
|
|
61
|
+
*/
|
|
62
|
+
export const allTools: {
|
|
63
|
+
readonly paragraph: {
|
|
64
|
+
readonly class: ParagraphConstructable;
|
|
65
|
+
readonly inlineToolbar: true;
|
|
66
|
+
readonly config: { readonly preserveBlank: true };
|
|
67
|
+
};
|
|
68
|
+
readonly header: {
|
|
69
|
+
readonly class: HeaderConstructable;
|
|
70
|
+
readonly inlineToolbar: true;
|
|
71
|
+
};
|
|
72
|
+
readonly list: {
|
|
73
|
+
readonly class: ListConstructable;
|
|
74
|
+
readonly inlineToolbar: true;
|
|
75
|
+
};
|
|
76
|
+
readonly bold: { readonly class: InlineToolConstructable };
|
|
77
|
+
readonly italic: { readonly class: InlineToolConstructable };
|
|
78
|
+
readonly link: { readonly class: InlineToolConstructable };
|
|
79
|
+
readonly convertTo: { readonly class: InlineToolConstructable };
|
|
80
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -85,7 +85,26 @@ export * from './utils/popover';
|
|
|
85
85
|
|
|
86
86
|
export { OutputData, OutputBlockData} from './data-formats/output-data';
|
|
87
87
|
export { BlockId } from './data-formats/block-id';
|
|
88
|
-
export {
|
|
88
|
+
export {
|
|
89
|
+
BlockAPI,
|
|
90
|
+
Blocks,
|
|
91
|
+
Caret,
|
|
92
|
+
Events,
|
|
93
|
+
History,
|
|
94
|
+
InlineToolbar,
|
|
95
|
+
Listeners,
|
|
96
|
+
Notifier,
|
|
97
|
+
ReadOnly,
|
|
98
|
+
Sanitizer,
|
|
99
|
+
Saver,
|
|
100
|
+
Selection,
|
|
101
|
+
Styles,
|
|
102
|
+
Toolbar,
|
|
103
|
+
Tooltip,
|
|
104
|
+
I18n,
|
|
105
|
+
Ui,
|
|
106
|
+
Tools,
|
|
107
|
+
} from './api';
|
|
89
108
|
export {
|
|
90
109
|
BlockMutationType,
|
|
91
110
|
BlockMutationEvent,
|
|
@@ -124,23 +143,24 @@ export interface API {
|
|
|
124
143
|
ui: Ui;
|
|
125
144
|
}
|
|
126
145
|
|
|
127
|
-
import {
|
|
146
|
+
import { DATA_ATTR, DataAttrKey, DataAttrValue, createSelector } from './data-attributes';
|
|
147
|
+
|
|
148
|
+
export { DATA_ATTR, DataAttrKey, DataAttrValue, createSelector };
|
|
128
149
|
|
|
129
150
|
/**
|
|
130
|
-
*
|
|
151
|
+
* Blok version string
|
|
131
152
|
*/
|
|
132
|
-
|
|
133
|
-
public static version: string;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Header tool bundled with Blok
|
|
137
|
-
*/
|
|
138
|
-
public static Header: HeaderConstructable;
|
|
153
|
+
export const version: string;
|
|
139
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Main Blok class
|
|
157
|
+
*/
|
|
158
|
+
export class Blok {
|
|
140
159
|
public isReady: Promise<void>;
|
|
141
160
|
|
|
142
161
|
public blocks: Blocks;
|
|
143
162
|
public caret: Caret;
|
|
163
|
+
public history: History;
|
|
144
164
|
public sanitizer: Sanitizer;
|
|
145
165
|
public saver: Saver;
|
|
146
166
|
public selection: Selection;
|
|
@@ -195,6 +215,3 @@ declare class Blok {
|
|
|
195
215
|
*/
|
|
196
216
|
public destroy(): void;
|
|
197
217
|
}
|
|
198
|
-
|
|
199
|
-
export as namespace Blok;
|
|
200
|
-
export default Blok;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point for locale imports.
|
|
3
|
+
* Only English is bundled by default - all 68 other locales are loaded on-demand.
|
|
4
|
+
* @see README.md#localization for usage examples
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { LocaleConfig, LocaleRegistry, SupportedLocale } from './configs/i18n-config';
|
|
8
|
+
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Constants
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
/** Default locale code ('en') */
|
|
14
|
+
export declare const DEFAULT_LOCALE: SupportedLocale;
|
|
15
|
+
|
|
16
|
+
/** All supported locale codes (68 languages) - all available for lazy loading */
|
|
17
|
+
export declare const ALL_LOCALE_CODES: readonly SupportedLocale[];
|
|
18
|
+
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// English locale - always bundled (default/fallback)
|
|
21
|
+
// ============================================================================
|
|
22
|
+
|
|
23
|
+
export declare const enLocale: LocaleConfig;
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Lazy loading functions
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
/** Load a single locale on-demand */
|
|
30
|
+
export declare const loadLocale: (code: SupportedLocale) => Promise<LocaleConfig>;
|
|
31
|
+
|
|
32
|
+
/** Preload multiple locales */
|
|
33
|
+
export declare const preloadLocales: (codes: readonly SupportedLocale[]) => Promise<void>;
|
|
34
|
+
|
|
35
|
+
/** Build a registry from locale codes (async) */
|
|
36
|
+
export declare const buildRegistry: (codes: readonly SupportedLocale[]) => Promise<LocaleRegistry>;
|
|
37
|
+
|
|
38
|
+
/** Get a loaded locale synchronously (returns undefined if not loaded) */
|
|
39
|
+
export declare const getLocaleSync: (code: SupportedLocale) => LocaleConfig | undefined;
|
|
40
|
+
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Utility functions
|
|
43
|
+
// ============================================================================
|
|
44
|
+
|
|
45
|
+
/** Get text direction for a locale code */
|
|
46
|
+
export declare const getDirection: (code: SupportedLocale) => 'ltr' | 'rtl';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Clear the locale cache.
|
|
50
|
+
* Primarily useful for testing to ensure test isolation.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare const clearLocaleCache: () => void;
|
|
54
|
+
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Re-export types
|
|
57
|
+
// ============================================================================
|
|
58
|
+
|
|
59
|
+
export type { LocaleConfig, LocaleRegistry, SupportedLocale };
|
|
@@ -7,4 +7,14 @@ interface InlineToolAdapter extends BaseToolAdapter<ToolType.Inline, InlineTool>
|
|
|
7
7
|
* Constructs new InlineTool instance from constructable
|
|
8
8
|
*/
|
|
9
9
|
create(): IInlineTool;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns the tool title
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the translation key for the tool title
|
|
18
|
+
*/
|
|
19
|
+
titleKey: string | undefined;
|
|
10
20
|
}
|
|
@@ -78,6 +78,15 @@ export interface BlockTool extends BaseTool {
|
|
|
78
78
|
* Called after block was moved
|
|
79
79
|
*/
|
|
80
80
|
moved?(event: MoveEvent): void;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns the horizontal offset of the content at the hovered element.
|
|
84
|
+
* Used by the toolbar to position itself closer to nested content (e.g., nested list items).
|
|
85
|
+
*
|
|
86
|
+
* @param hoveredElement - The element that is currently being hovered
|
|
87
|
+
* @returns Object with left offset in pixels, or undefined if no offset should be applied
|
|
88
|
+
*/
|
|
89
|
+
getContentOffset?(hoveredElement: Element): { left: number } | undefined;
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
/**
|
package/types/tools/header.d.ts
CHANGED
|
@@ -11,6 +11,22 @@ export interface HeaderData extends BlockToolData {
|
|
|
11
11
|
level: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Level-specific overrides for customization
|
|
16
|
+
*/
|
|
17
|
+
export interface HeaderLevelConfig {
|
|
18
|
+
/** Custom HTML tag to use (e.g., 'div', 'p', 'span') */
|
|
19
|
+
tag?: string;
|
|
20
|
+
/** Custom display name for this level */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Custom font size (e.g., '3em', '24px') */
|
|
23
|
+
size?: string;
|
|
24
|
+
/** Custom margin top (e.g., '20px', '1rem') */
|
|
25
|
+
marginTop?: string;
|
|
26
|
+
/** Custom margin bottom (e.g., '10px', '0.5rem') */
|
|
27
|
+
marginBottom?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
/**
|
|
15
31
|
* Header Tool's configuration
|
|
16
32
|
*/
|
|
@@ -21,6 +37,8 @@ export interface HeaderConfig {
|
|
|
21
37
|
levels?: number[];
|
|
22
38
|
/** Default level */
|
|
23
39
|
defaultLevel?: number;
|
|
40
|
+
/** Level-specific overrides keyed by level number (1-6) */
|
|
41
|
+
levelOverrides?: Record<number, HeaderLevelConfig>;
|
|
24
42
|
}
|
|
25
43
|
|
|
26
44
|
/**
|
package/types/tools/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './paste-events';
|
|
|
12
12
|
export * from './hook-events';
|
|
13
13
|
export * from './menu-config';
|
|
14
14
|
export * from './header';
|
|
15
|
+
export * from './list';
|
|
15
16
|
|
|
16
17
|
export type Tool = BlockTool | InlineTool | BlockTune;
|
|
17
18
|
export type ToolConstructable = BlockToolConstructable | InlineToolConstructable | BlockTuneConstructable;
|