@jackuait/blok 0.4.1-beta.1 → 0.4.1-beta.12
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-BU6NwVkN.mjs +13239 -0
- package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
- package/dist/chunks/i18next-loader-D8GzSwio.mjs +43 -0
- package/dist/{index-CEXLTV6f.mjs → chunks/index-C5e_WLFg.mjs} +2 -2
- package/dist/chunks/inline-tool-convert-CLUxkCe_.mjs +1990 -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 +3126 -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 +142 -0
- package/src/components/inline-tools/inline-tool-italic.ts +500 -0
- package/src/components/inline-tools/inline-tool-link.ts +540 -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 +782 -0
- package/src/components/modules/toolbar/index.ts +1296 -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 +610 -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 +197 -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 +682 -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 +759 -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 +126 -0
- package/src/tools/header/index.ts +647 -0
- package/src/tools/index.ts +45 -0
- package/src/tools/list/index.ts +1826 -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/configs/sanitizer-config.d.ts +25 -1
- 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 +11 -2
- 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 +99 -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 +24 -5
- package/types/utils/popover/popover.d.ts +13 -0
- package/dist/blok-C8XbyLHh.mjs +0 -25795
- package/dist/blok.umd.js +0 -181
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placeholder utilities for contenteditable elements
|
|
3
|
+
*
|
|
4
|
+
* Provides unified handling for:
|
|
5
|
+
* - Placeholder styling classes
|
|
6
|
+
* - Caret positioning when content is empty
|
|
7
|
+
* - Focus and input event handlers
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Placeholder styling classes using Tailwind arbitrary variants.
|
|
14
|
+
* Applied to ::before pseudo-element only when element is empty.
|
|
15
|
+
* Uses data-placeholder attribute for the placeholder text.
|
|
16
|
+
*/
|
|
17
|
+
export const PLACEHOLDER_CLASSES: string[] = [
|
|
18
|
+
'empty:before:pointer-events-none',
|
|
19
|
+
'empty:before:text-gray-text',
|
|
20
|
+
'empty:before:cursor-text',
|
|
21
|
+
'empty:before:content-[attr(data-placeholder)]',
|
|
22
|
+
'[&[data-blok-empty=true]]:before:pointer-events-none',
|
|
23
|
+
'[&[data-blok-empty=true]]:before:text-gray-text',
|
|
24
|
+
'[&[data-blok-empty=true]]:before:cursor-text',
|
|
25
|
+
'[&[data-blok-empty=true]]:before:content-[attr(data-placeholder)]',
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Alternative placeholder classes using data-blok-placeholder-active attribute.
|
|
30
|
+
* Used by some tools that need a different attribute name.
|
|
31
|
+
*/
|
|
32
|
+
export const PLACEHOLDER_ACTIVE_CLASSES: string[] = [
|
|
33
|
+
'empty:before:pointer-events-none',
|
|
34
|
+
'empty:before:text-gray-text',
|
|
35
|
+
'empty:before:cursor-text',
|
|
36
|
+
'empty:before:content-[attr(data-blok-placeholder-active)]',
|
|
37
|
+
'[&[data-empty=true]]:before:pointer-events-none',
|
|
38
|
+
'[&[data-empty=true]]:before:text-gray-text',
|
|
39
|
+
'[&[data-empty=true]]:before:cursor-text',
|
|
40
|
+
'[&[data-empty=true]]:before:content-[attr(data-blok-placeholder-active)]',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Placeholder classes that only show placeholder when element is focused.
|
|
45
|
+
* Uses data-blok-placeholder-active attribute and only displays when element is empty AND focused.
|
|
46
|
+
* Used by paragraph tool.
|
|
47
|
+
*/
|
|
48
|
+
export const PLACEHOLDER_FOCUS_ONLY_CLASSES: string[] = [
|
|
49
|
+
'empty:focus:before:pointer-events-none',
|
|
50
|
+
'empty:focus:before:text-gray-text',
|
|
51
|
+
'empty:focus:before:cursor-text',
|
|
52
|
+
'empty:focus:before:content-[attr(data-blok-placeholder-active)]',
|
|
53
|
+
'[&[data-empty=true]:focus]:before:pointer-events-none',
|
|
54
|
+
'[&[data-empty=true]:focus]:before:text-gray-text',
|
|
55
|
+
'[&[data-empty=true]:focus]:before:cursor-text',
|
|
56
|
+
'[&[data-empty=true]:focus]:before:content-[attr(data-blok-placeholder-active)]',
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Check if an element's content is empty
|
|
61
|
+
*
|
|
62
|
+
* @param element - The element to check
|
|
63
|
+
* @returns true if the element is empty or contains only a <br>
|
|
64
|
+
*/
|
|
65
|
+
export const isContentEmpty = (element: HTMLElement): boolean => {
|
|
66
|
+
const content = element.innerHTML.trim();
|
|
67
|
+
return content === '' || content === '<br>';
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Set caret to the start of an element.
|
|
72
|
+
* Clears any <br> tags to ensure clean empty state for placeholder.
|
|
73
|
+
*
|
|
74
|
+
* @param element - The element to set caret in
|
|
75
|
+
*/
|
|
76
|
+
export const setCaretToStart = (element: HTMLElement): void => {
|
|
77
|
+
// Clear any <br> tags to ensure clean empty state for placeholder
|
|
78
|
+
if (element.innerHTML === '<br>') {
|
|
79
|
+
// eslint-disable-next-line no-param-reassign
|
|
80
|
+
element.innerHTML = '';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const selection = window.getSelection();
|
|
84
|
+
if (!selection) return;
|
|
85
|
+
|
|
86
|
+
const range = document.createRange();
|
|
87
|
+
range.selectNodeContents(element);
|
|
88
|
+
range.collapse(true);
|
|
89
|
+
selection.removeAllRanges();
|
|
90
|
+
selection.addRange(range);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Handler that sets caret to start when element is empty.
|
|
95
|
+
* Used for focus and input events.
|
|
96
|
+
*
|
|
97
|
+
* @param element - The element to handle
|
|
98
|
+
*/
|
|
99
|
+
const handleEmptyElement = (element: HTMLElement): void => {
|
|
100
|
+
if (!isContentEmpty(element)) return;
|
|
101
|
+
setCaretToStart(element);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Set up placeholder behavior for a contenteditable element.
|
|
106
|
+
* Adds focus and input event listeners to handle caret positioning
|
|
107
|
+
* when the element is empty.
|
|
108
|
+
*
|
|
109
|
+
* @param element - The contenteditable element
|
|
110
|
+
* @param placeholder - Optional placeholder text to set
|
|
111
|
+
* @param attributeName - The attribute name for placeholder text (default: 'data-placeholder')
|
|
112
|
+
*/
|
|
113
|
+
export const setupPlaceholder = (
|
|
114
|
+
element: HTMLElement,
|
|
115
|
+
placeholder?: string,
|
|
116
|
+
attributeName: 'data-placeholder' | 'data-blok-placeholder-active' = 'data-placeholder'
|
|
117
|
+
): void => {
|
|
118
|
+
// Always set the attribute, even if empty (for consistency and testing)
|
|
119
|
+
element.setAttribute(attributeName, placeholder ?? '');
|
|
120
|
+
|
|
121
|
+
const handler = (): void => handleEmptyElement(element);
|
|
122
|
+
|
|
123
|
+
element.addEventListener('focus', handler);
|
|
124
|
+
element.addEventListener('input', handler);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Apply placeholder attribute to an element
|
|
129
|
+
*
|
|
130
|
+
* @param element - The element to apply placeholder to
|
|
131
|
+
* @param placeholder - The placeholder text
|
|
132
|
+
* @param attributeName - The attribute name (default: 'data-placeholder')
|
|
133
|
+
*/
|
|
134
|
+
export const applyPlaceholderAttribute = (
|
|
135
|
+
element: HTMLElement,
|
|
136
|
+
placeholder: string,
|
|
137
|
+
attributeName: 'data-placeholder' | 'data-blok-placeholder-active' = 'data-placeholder'
|
|
138
|
+
): void => {
|
|
139
|
+
element.setAttribute(attributeName, placeholder);
|
|
140
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Dom } from '../../../../dom';
|
|
2
|
+
import { css } from './hint.const';
|
|
3
|
+
import type { HintParams } from '@/types/utils/popover/hint';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents the hint content component
|
|
7
|
+
*/
|
|
8
|
+
export class Hint {
|
|
9
|
+
/**
|
|
10
|
+
* Html element used to display hint content on screen
|
|
11
|
+
*/
|
|
12
|
+
private nodes: {
|
|
13
|
+
root: HTMLElement;
|
|
14
|
+
title: HTMLElement;
|
|
15
|
+
description?: HTMLElement;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Constructs the hint content instance
|
|
20
|
+
* @param params - hint content parameters
|
|
21
|
+
*/
|
|
22
|
+
constructor(params: HintParams) {
|
|
23
|
+
const alignment = params.alignment === 'center' ? 'center' : 'start';
|
|
24
|
+
|
|
25
|
+
this.nodes = {
|
|
26
|
+
root: Dom.make('div', [css.root, alignment === 'center' ? css.alignedCenter : css.alignedStart]),
|
|
27
|
+
title: Dom.make('div', css.title, { textContent: params.title }),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
this.nodes.root.setAttribute('data-alignment', alignment);
|
|
31
|
+
this.nodes.root.appendChild(this.nodes.title);
|
|
32
|
+
|
|
33
|
+
if (params.description !== undefined) {
|
|
34
|
+
this.nodes.description = Dom.make('div', css.description, { textContent: params.description });
|
|
35
|
+
|
|
36
|
+
this.nodes.root.appendChild(this.nodes.description);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the root element of the hint content
|
|
42
|
+
*/
|
|
43
|
+
public getElement(): HTMLElement {
|
|
44
|
+
return this.nodes.root;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind CSS classes for popover header component
|
|
3
|
+
*/
|
|
4
|
+
export const css = {
|
|
5
|
+
root: 'flex items-center mb-2 mt-1',
|
|
6
|
+
text: 'text-lg font-semibold text-text-primary',
|
|
7
|
+
backButton: 'border-0 bg-transparent w-9 h-9 text-text-primary cursor-pointer [&_svg]:block [&_svg]:w-7 [&_svg]:h-7',
|
|
8
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { PopoverHeaderParams } from './popover-header.types';
|
|
2
|
+
import { Dom } from '../../../../dom';
|
|
3
|
+
import { css } from './popover-header.const';
|
|
4
|
+
import { DATA_ATTR } from '../../../../constants/data-attributes';
|
|
5
|
+
import { IconChevronLeft } from '../../../../icons';
|
|
6
|
+
import { Listeners } from '../../../listeners';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents popover header ui element
|
|
10
|
+
*/
|
|
11
|
+
export class PopoverHeader {
|
|
12
|
+
/**
|
|
13
|
+
* Listeners util instance
|
|
14
|
+
*/
|
|
15
|
+
private listeners = new Listeners();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Header html elements
|
|
19
|
+
*/
|
|
20
|
+
private nodes: {
|
|
21
|
+
root: HTMLElement,
|
|
22
|
+
text: HTMLElement,
|
|
23
|
+
backButton: HTMLElement
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Text displayed inside header
|
|
28
|
+
*/
|
|
29
|
+
private readonly text: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Back button click handler
|
|
33
|
+
*/
|
|
34
|
+
private readonly onBackButtonClick: () => void;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Constructs the instance
|
|
38
|
+
* @param params - popover header params
|
|
39
|
+
*/
|
|
40
|
+
constructor({ text, onBackButtonClick }: PopoverHeaderParams) {
|
|
41
|
+
this.text = text;
|
|
42
|
+
this.onBackButtonClick = onBackButtonClick;
|
|
43
|
+
|
|
44
|
+
this.nodes = {
|
|
45
|
+
root: Dom.make('div', [ css.root ], {
|
|
46
|
+
'data-blok-testid': 'popover-header',
|
|
47
|
+
[DATA_ATTR.popoverHeader]: '',
|
|
48
|
+
}),
|
|
49
|
+
backButton: Dom.make('button', [ css.backButton ], {
|
|
50
|
+
'data-blok-testid': 'popover-header-back-button',
|
|
51
|
+
[DATA_ATTR.popoverHeaderBackButton]: '',
|
|
52
|
+
}),
|
|
53
|
+
text: Dom.make('div', [ css.text ], {
|
|
54
|
+
'data-blok-testid': 'popover-header-text',
|
|
55
|
+
[DATA_ATTR.popoverHeaderText]: '',
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
this.nodes.backButton.innerHTML = IconChevronLeft;
|
|
59
|
+
this.nodes.root.appendChild(this.nodes.backButton);
|
|
60
|
+
this.listeners.on(this.nodes.backButton, 'click', this.onBackButtonClick);
|
|
61
|
+
|
|
62
|
+
this.nodes.text.innerText = this.text;
|
|
63
|
+
this.nodes.root.appendChild(this.nodes.text);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns popover header root html element
|
|
68
|
+
*/
|
|
69
|
+
public getElement(): HTMLElement | null {
|
|
70
|
+
return this.nodes.root;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Destroys the instance
|
|
75
|
+
*/
|
|
76
|
+
public destroy(): void {
|
|
77
|
+
this.nodes.root.remove();
|
|
78
|
+
this.listeners.destroy();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PopoverItemDefault } from './popover-item-default/popover-item-default';
|
|
2
|
+
import { PopoverItemSeparator } from './popover-item-separator/popover-item-separator';
|
|
3
|
+
import { PopoverItem } from './popover-item';
|
|
4
|
+
|
|
5
|
+
export * from './popover-item-default/popover-item-default.const';
|
|
6
|
+
export type * from '@/types/utils/popover/popover-item.d.ts';
|
|
7
|
+
export { PopoverItemType } from '@/types/utils/popover/popover-item-type';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
PopoverItemDefault,
|
|
11
|
+
PopoverItemSeparator,
|
|
12
|
+
PopoverItem
|
|
13
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind CSS class names for popover item
|
|
3
|
+
*/
|
|
4
|
+
export const css = {
|
|
5
|
+
/**
|
|
6
|
+
* Base item styles with hover, focus, and active support
|
|
7
|
+
* Hover is applied via can-hover:hover: for real hover and data-blok-force-hover for tests
|
|
8
|
+
* Focus is applied via data-blok-focused attribute (set by DomIterator during keyboard navigation)
|
|
9
|
+
* Active is applied via data-blok-popover-item-active attribute
|
|
10
|
+
* Note: noHover state is handled via [data-blok-popover-item-no-hover] which disables hover
|
|
11
|
+
* Priority order: active < hover < focus (focus wins when navigating with keyboard)
|
|
12
|
+
*/
|
|
13
|
+
item: 'flex items-center select-none border-none bg-transparent rounded-md p-[var(--item-padding)] text-text-primary mb-px [&[data-blok-popover-item-active]]:bg-icon-active-bg [&[data-blok-popover-item-active]]:text-icon-active-text can-hover:hover:cursor-pointer can-hover:hover:bg-item-hover-bg [&[data-blok-force-hover]]:cursor-pointer [&[data-blok-force-hover]]:bg-item-hover-bg [&[data-blok-focused="true"]]:bg-item-focus-bg [&[data-blok-popover-item-no-hover]]:hover:bg-transparent [&[data-blok-popover-item-no-hover]]:cursor-default',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Item disabled state
|
|
17
|
+
*/
|
|
18
|
+
itemDisabled: 'cursor-default pointer-events-none text-text-secondary',
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Icon container styles
|
|
22
|
+
*/
|
|
23
|
+
icon: 'flex items-center justify-center w-[26px] h-[26px] [&_svg]:w-icon [&_svg]:h-icon',
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Focused state class for DomIterator/Flipper keyboard navigation.
|
|
27
|
+
* Used alongside data-blok-focused attribute.
|
|
28
|
+
*/
|
|
29
|
+
focused: 'is-focused',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Tailwind CSS class names for inline popover item
|
|
34
|
+
*/
|
|
35
|
+
export const cssInline = {
|
|
36
|
+
/**
|
|
37
|
+
* Item in inline context - more compact styling
|
|
38
|
+
*/
|
|
39
|
+
item: 'rounded p-1',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Tailwind CSS class names for nested inline popover item
|
|
44
|
+
*/
|
|
45
|
+
export const cssNestedInline = {
|
|
46
|
+
/**
|
|
47
|
+
* Nested item - back to desktop popover styling
|
|
48
|
+
*/
|
|
49
|
+
item: 'rounded-md p-[3px] mobile:p-1',
|
|
50
|
+
};
|