@jackuait/blok 0.4.1-beta.1 → 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-CEXLTV6f.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 +29 -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-C8XbyLHh.mjs +0 -25795
- package/dist/blok.umd.js +0 -181
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BlockTool, BlockToolConstructable, BlockToolConstructorOptions, BlockToolData } from './block-tool';
|
|
2
|
+
import { MenuConfig } from './menu-config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* List styles enum
|
|
6
|
+
*/
|
|
7
|
+
export type ListStyle = 'unordered' | 'ordered' | 'checklist';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* List Tool's input and output data format
|
|
11
|
+
*/
|
|
12
|
+
export interface ListData extends BlockToolData {
|
|
13
|
+
/** Item text content (can include HTML) */
|
|
14
|
+
text: string;
|
|
15
|
+
/** List style: unordered, ordered, or checklist */
|
|
16
|
+
style: ListStyle;
|
|
17
|
+
/** Checked state for checklist items */
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
/** Starting number for ordered lists (only applies to root items) */
|
|
20
|
+
start?: number;
|
|
21
|
+
/** Nesting depth level (0 = root, 1 = first indent, etc.) */
|
|
22
|
+
depth?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List Tool's configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface ListConfig {
|
|
29
|
+
/** Default list style */
|
|
30
|
+
defaultStyle?: ListStyle;
|
|
31
|
+
/**
|
|
32
|
+
* Available list styles for the settings menu.
|
|
33
|
+
* When specified, only these styles will be available in the block settings dropdown.
|
|
34
|
+
*/
|
|
35
|
+
styles?: ListStyle[];
|
|
36
|
+
/**
|
|
37
|
+
* List styles to show in the toolbox.
|
|
38
|
+
* When specified, only these list types will appear as separate entries in the toolbox.
|
|
39
|
+
* If not specified, all list types (unordered, ordered, checklist) will be shown.
|
|
40
|
+
*/
|
|
41
|
+
toolboxStyles?: ListStyle[];
|
|
42
|
+
/**
|
|
43
|
+
* Custom color for list items.
|
|
44
|
+
* Accepts any valid CSS color value (hex, rgb, hsl, named colors, etc.)
|
|
45
|
+
*/
|
|
46
|
+
itemColor?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Custom font size for list items.
|
|
49
|
+
* Accepts any valid CSS font-size value (px, rem, em, etc.)
|
|
50
|
+
*/
|
|
51
|
+
itemSize?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* List Tool for the Blok Editor
|
|
56
|
+
* Provides Ordered, Unordered, and Checklist Blocks
|
|
57
|
+
*/
|
|
58
|
+
export interface List extends BlockTool {
|
|
59
|
+
/**
|
|
60
|
+
* Return Tool's view
|
|
61
|
+
*/
|
|
62
|
+
render(): HTMLElement;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns list block tunes config
|
|
66
|
+
*/
|
|
67
|
+
renderSettings(): MenuConfig;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Method that specified how to merge two List blocks.
|
|
71
|
+
* Called by Editor by backspace at the beginning of the Block
|
|
72
|
+
*/
|
|
73
|
+
merge(data: ListData): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Validate List block data
|
|
77
|
+
*/
|
|
78
|
+
validate(blockData: ListData): boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Extract Tool's data from the view
|
|
82
|
+
*/
|
|
83
|
+
save(): ListData;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* List Tool constructor
|
|
88
|
+
*/
|
|
89
|
+
export interface ListConstructable extends BlockToolConstructable {
|
|
90
|
+
new(config: BlockToolConstructorOptions<ListData, ListConfig>): List;
|
|
91
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { BlockTool, BlockToolConstructable, BlockToolConstructorOptions, BlockToolData } from './block-tool';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Paragraph Tool's input and output data format
|
|
5
|
+
*/
|
|
6
|
+
export interface ParagraphData extends BlockToolData {
|
|
7
|
+
/** Paragraph's content. Can include HTML tags: <a><b><i> */
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Style overrides for paragraph customization
|
|
13
|
+
*/
|
|
14
|
+
export interface ParagraphStyleConfig {
|
|
15
|
+
/** Custom font size (e.g., '16px', '1rem') */
|
|
16
|
+
size?: string;
|
|
17
|
+
/** Custom line height (e.g., '1.6', '24px') */
|
|
18
|
+
lineHeight?: string;
|
|
19
|
+
/** Custom margin top (e.g., '10px', '0.5rem') */
|
|
20
|
+
marginTop?: string;
|
|
21
|
+
/** Custom margin bottom (e.g., '10px', '0.5rem') */
|
|
22
|
+
marginBottom?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Paragraph Tool's configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface ParagraphConfig {
|
|
29
|
+
/** Placeholder for the empty paragraph */
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
/** Whether or not to keep blank paragraphs when saving editor data */
|
|
32
|
+
preserveBlank?: boolean;
|
|
33
|
+
/** Style overrides for paragraph customization */
|
|
34
|
+
styles?: ParagraphStyleConfig;
|
|
35
|
+
/** Custom icon SVG string for the toolbox */
|
|
36
|
+
icon?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Paragraph Tool for the Blok Editor
|
|
41
|
+
* Provides Text Block
|
|
42
|
+
*/
|
|
43
|
+
export interface Paragraph extends BlockTool {
|
|
44
|
+
/**
|
|
45
|
+
* Return Tool's view
|
|
46
|
+
*/
|
|
47
|
+
render(): HTMLDivElement;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Method that specified how to merge two Paragraph blocks.
|
|
51
|
+
* Called by Editor by backspace at the beginning of the Block
|
|
52
|
+
*/
|
|
53
|
+
merge(data: ParagraphData): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Validate Paragraph block data
|
|
57
|
+
*/
|
|
58
|
+
validate(savedData: ParagraphData): boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Extract Tool's data from the view
|
|
62
|
+
*/
|
|
63
|
+
save(toolsContent: HTMLDivElement): ParagraphData;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Paragraph Tool constructor
|
|
68
|
+
*/
|
|
69
|
+
export interface ParagraphConstructable extends BlockToolConstructable {
|
|
70
|
+
new(config: BlockToolConstructorOptions<ParagraphData, ParagraphConfig>): Paragraph;
|
|
71
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { ToolConfig } from './tool-config';
|
|
2
2
|
import { ToolConstructable, BlockToolData, MenuConfig, MenuConfigItem } from './index';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Permissive type for tool class - accepts any constructor.
|
|
6
|
+
* Runtime validation ensures the tool has required methods.
|
|
7
|
+
*/
|
|
8
|
+
export type ToolClass = new (...args: any[]) => any;
|
|
9
|
+
|
|
4
10
|
/**
|
|
5
11
|
* Tool may specify its toolbox configuration
|
|
6
12
|
* It may include several entries as well
|
|
@@ -12,10 +18,17 @@ export type ToolboxConfig = ToolboxConfigEntry | ToolboxConfigEntry[];
|
|
|
12
18
|
*/
|
|
13
19
|
export interface ToolboxConfigEntry {
|
|
14
20
|
/**
|
|
15
|
-
* Tool title for Toolbox
|
|
21
|
+
* Tool title for Toolbox (human-readable fallback)
|
|
16
22
|
*/
|
|
17
23
|
title?: string;
|
|
18
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Translation key for the title (e.g., 'text', 'heading', 'bulletedList').
|
|
27
|
+
* Used to look up translations in the toolNames.* namespace.
|
|
28
|
+
* If provided, the translated value is used; otherwise falls back to title.
|
|
29
|
+
*/
|
|
30
|
+
titleKey?: string;
|
|
31
|
+
|
|
19
32
|
/**
|
|
20
33
|
* HTML string with an icon for Toolbox
|
|
21
34
|
*/
|
|
@@ -24,7 +37,21 @@ export interface ToolboxConfigEntry {
|
|
|
24
37
|
/**
|
|
25
38
|
* May contain overrides for tool default data
|
|
26
39
|
*/
|
|
27
|
-
data?: BlockToolData
|
|
40
|
+
data?: BlockToolData;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Unique name for the toolbox entry, used for data-blok-item-name attribute.
|
|
44
|
+
* If not provided, falls back to the tool name.
|
|
45
|
+
* Useful when a tool has multiple toolbox entries (e.g., list with ordered/unordered/checklist variants).
|
|
46
|
+
*/
|
|
47
|
+
name?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Additional search terms for the tool (e.g., ['h1', 'title', 'header']).
|
|
51
|
+
* Users can search by these aliases in addition to the displayed title.
|
|
52
|
+
* Terms are matched case-insensitively.
|
|
53
|
+
*/
|
|
54
|
+
searchTerms?: string[];
|
|
28
55
|
}
|
|
29
56
|
|
|
30
57
|
/**
|
|
@@ -35,9 +62,9 @@ export interface ToolboxConfigEntry {
|
|
|
35
62
|
export interface ExternalToolSettings<Config extends object = any> {
|
|
36
63
|
|
|
37
64
|
/**
|
|
38
|
-
* Tool's class
|
|
65
|
+
* Tool's class - accepts any constructor, validated at runtime
|
|
39
66
|
*/
|
|
40
|
-
class: ToolConstructable;
|
|
67
|
+
class: ToolConstructable | ToolClass;
|
|
41
68
|
|
|
42
69
|
/**
|
|
43
70
|
* User configuration object that will be passed to the Tool's constructor
|
|
@@ -66,6 +93,13 @@ export interface ExternalToolSettings<Config extends object = any> {
|
|
|
66
93
|
* It will be hidden from Toolbox when false is specified.
|
|
67
94
|
*/
|
|
68
95
|
toolbox?: ToolboxConfig | false;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Additional search terms for finding this tool in the toolbox.
|
|
99
|
+
* Merged with any searchTerms defined in the tool's toolbox config.
|
|
100
|
+
* Useful for adding locale-specific search terms.
|
|
101
|
+
*/
|
|
102
|
+
searchTerms?: string[];
|
|
69
103
|
}
|
|
70
104
|
|
|
71
105
|
/**
|
|
@@ -74,6 +108,58 @@ export interface ExternalToolSettings<Config extends object = any> {
|
|
|
74
108
|
export type InternalToolSettings<Config extends object = any> = Omit<ExternalToolSettings<Config>, 'class'> & Partial<Pick<ExternalToolSettings<Config>, 'class'>>;
|
|
75
109
|
|
|
76
110
|
/**
|
|
77
|
-
*
|
|
111
|
+
* Keys that Blok extracts from tool settings (not passed to tool constructor)
|
|
112
|
+
*/
|
|
113
|
+
export type BlokToolSettingsKeys = 'class' | 'inlineToolbar' | 'tunes' | 'shortcut' | 'toolbox' | 'config';
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Flat tool settings - tool-specific options at top level.
|
|
117
|
+
* Blok extracts known keys and passes the rest as `config` to the tool.
|
|
118
|
+
*/
|
|
119
|
+
export interface FlatToolSettings<Config extends object = any> {
|
|
120
|
+
/**
|
|
121
|
+
* Tool's class
|
|
122
|
+
*/
|
|
123
|
+
class: ToolConstructable | ToolClass;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Is need to show Inline Toolbar.
|
|
127
|
+
* Defaults to true for block tools.
|
|
128
|
+
*/
|
|
129
|
+
inlineToolbar?: boolean | string[];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* BlockTunes for Tool
|
|
133
|
+
*/
|
|
134
|
+
tunes?: boolean | string[];
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Define shortcut that will render Tool
|
|
138
|
+
*/
|
|
139
|
+
shortcut?: string;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Tool's Toolbox settings
|
|
143
|
+
*/
|
|
144
|
+
toolbox?: ToolboxConfig | false;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Legacy nested config - merged with top-level tool options
|
|
148
|
+
* @deprecated Use flat config instead
|
|
149
|
+
*/
|
|
150
|
+
config?: ToolConfig<Config>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Tool-specific options (placeholder, levels, etc.)
|
|
154
|
+
* These are passed to the tool constructor as `config`
|
|
155
|
+
*/
|
|
156
|
+
[key: string]: unknown;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Union of all tool settings formats
|
|
78
161
|
*/
|
|
79
|
-
export type ToolSettings<Config extends object = any> =
|
|
162
|
+
export type ToolSettings<Config extends object = any> =
|
|
163
|
+
| InternalToolSettings<Config>
|
|
164
|
+
| ExternalToolSettings<Config>
|
|
165
|
+
| FlatToolSettings<Config>;
|
package/types/tools/tool.d.ts
CHANGED
|
@@ -51,6 +51,12 @@ export interface BaseToolConstructable {
|
|
|
51
51
|
*/
|
|
52
52
|
title?: string;
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Translation key for the tool title (e.g., 'bold', 'italic', 'link').
|
|
56
|
+
* Used to look up translations in the toolNames.* namespace.
|
|
57
|
+
*/
|
|
58
|
+
titleKey?: string;
|
|
59
|
+
|
|
54
60
|
/**
|
|
55
61
|
* Tool`s prepare method. Can be async
|
|
56
62
|
* @param data
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for @jackuait/blok/tools entry point
|
|
3
|
+
* Re-exports all built-in tools for easy importing
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { HeaderConstructable, HeaderData, HeaderConfig } from './tools/header';
|
|
7
|
+
import { ParagraphConstructable, ParagraphData, ParagraphConfig } from './tools/paragraph';
|
|
8
|
+
import { ListConstructable, ListData, ListConfig, ListStyle } from './tools/list';
|
|
9
|
+
import { InlineToolConstructable } from './tools/inline-tool';
|
|
10
|
+
import { BlockTuneConstructable } from './block-tunes';
|
|
11
|
+
import { ToolSettings } from './tools';
|
|
12
|
+
|
|
13
|
+
// Block tools
|
|
14
|
+
export const Paragraph: ParagraphConstructable;
|
|
15
|
+
export const Header: HeaderConstructable;
|
|
16
|
+
export const List: ListConstructable;
|
|
17
|
+
|
|
18
|
+
// Re-export data and config types for convenience
|
|
19
|
+
export { HeaderData, HeaderConfig } from './tools/header';
|
|
20
|
+
export { ParagraphData, ParagraphConfig } from './tools/paragraph';
|
|
21
|
+
export { ListData, ListConfig, ListStyle } from './tools/list';
|
|
22
|
+
|
|
23
|
+
// Inline tools
|
|
24
|
+
export const Bold: InlineToolConstructable;
|
|
25
|
+
export const Italic: InlineToolConstructable;
|
|
26
|
+
export const Link: InlineToolConstructable;
|
|
27
|
+
export const Convert: InlineToolConstructable;
|
|
28
|
+
|
|
29
|
+
// Block tunes
|
|
30
|
+
export const Delete: BlockTuneConstructable;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Default block tools configuration
|
|
34
|
+
*/
|
|
35
|
+
export const defaultBlockTools: {
|
|
36
|
+
readonly paragraph: { readonly inlineToolbar: true; readonly config: { readonly preserveBlank: true } };
|
|
37
|
+
readonly header: { readonly inlineToolbar: true };
|
|
38
|
+
readonly list: { readonly inlineToolbar: true };
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Default inline tools configuration
|
|
43
|
+
*/
|
|
44
|
+
export const defaultInlineTools: {
|
|
45
|
+
readonly bold: {};
|
|
46
|
+
readonly italic: {};
|
|
47
|
+
readonly link: {};
|
|
48
|
+
readonly convertTo: {};
|
|
49
|
+
};
|
|
@@ -134,11 +134,6 @@ export interface PopoverItemDefaultBaseParams {
|
|
|
134
134
|
*/
|
|
135
135
|
title?: string;
|
|
136
136
|
|
|
137
|
-
/**
|
|
138
|
-
* @deprecated Use title instead
|
|
139
|
-
*/
|
|
140
|
-
label?: string;
|
|
141
|
-
|
|
142
137
|
/**
|
|
143
138
|
* Item icon to be appeared near a title
|
|
144
139
|
*/
|
|
@@ -182,6 +177,24 @@ export interface PopoverItemDefaultBaseParams {
|
|
|
182
177
|
*/
|
|
183
178
|
hint?: HintParams;
|
|
184
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Custom data attributes to be added to the item element.
|
|
182
|
+
* Keys should be in camelCase (e.g., 'headerLevel' becomes 'data-header-level')
|
|
183
|
+
*/
|
|
184
|
+
dataset?: Record<string, string>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* English title for multilingual search.
|
|
188
|
+
* Used to search against English terms even when UI is in another language.
|
|
189
|
+
*/
|
|
190
|
+
englishTitle?: string;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Additional search terms for this item.
|
|
194
|
+
* Used to match alternative names or keywords.
|
|
195
|
+
*/
|
|
196
|
+
searchTerms?: string[];
|
|
197
|
+
|
|
185
198
|
/**
|
|
186
199
|
* Popover item activation handler
|
|
187
200
|
*
|
|
@@ -38,6 +38,13 @@ export interface PopoverParams {
|
|
|
38
38
|
*/
|
|
39
39
|
flipper?: Flipper;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Allow keyboard navigation from contenteditable elements.
|
|
43
|
+
* When true, arrow keys will navigate the popover even when focus is in a contenteditable.
|
|
44
|
+
* False by default.
|
|
45
|
+
*/
|
|
46
|
+
handleContentEditableNavigation?: boolean;
|
|
47
|
+
|
|
41
48
|
/**
|
|
42
49
|
* Popover texts overrides
|
|
43
50
|
*/
|