@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,1989 @@
|
|
|
1
|
+
var K = Object.defineProperty, J = Object.defineProperties;
|
|
2
|
+
var Y = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var P = Object.getOwnPropertySymbols;
|
|
4
|
+
var Q = Object.prototype.hasOwnProperty, tt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var V = (o, t, e) => t in o ? K(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, I = (o, t) => {
|
|
6
|
+
for (var e in t || (t = {}))
|
|
7
|
+
Q.call(t, e) && V(o, e, t[e]);
|
|
8
|
+
if (P)
|
|
9
|
+
for (var e of P(t))
|
|
10
|
+
tt.call(t, e) && V(o, e, t[e]);
|
|
11
|
+
return o;
|
|
12
|
+
}, O = (o, t) => J(o, Y(t));
|
|
13
|
+
const et = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
14
|
+
let nt = (o = 21) => {
|
|
15
|
+
let t = "", e = crypto.getRandomValues(new Uint8Array(o |= 0));
|
|
16
|
+
for (; o--; )
|
|
17
|
+
t += et[e[o] & 63];
|
|
18
|
+
return t;
|
|
19
|
+
};
|
|
20
|
+
var ot = /* @__PURE__ */ ((o) => (o.VERBOSE = "VERBOSE", o.INFO = "INFO", o.WARN = "WARN", o.ERROR = "ERROR", o))(ot || {});
|
|
21
|
+
const rt = () => "0.4.1-beta.11", Ct = {
|
|
22
|
+
BACKSPACE: 8,
|
|
23
|
+
TAB: 9,
|
|
24
|
+
ENTER: 13,
|
|
25
|
+
LEFT: 37,
|
|
26
|
+
UP: 38,
|
|
27
|
+
DOWN: 40,
|
|
28
|
+
RIGHT: 39,
|
|
29
|
+
DELETE: 46
|
|
30
|
+
}, yt = {
|
|
31
|
+
LEFT: 0
|
|
32
|
+
}, st = 1e8, it = 16, m = (() => {
|
|
33
|
+
try {
|
|
34
|
+
return Function("return this")();
|
|
35
|
+
} catch (o) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
})();
|
|
39
|
+
m && typeof m.window == "undefined" && (m.window = m);
|
|
40
|
+
const B = () => {
|
|
41
|
+
if (m != null && m.window)
|
|
42
|
+
return m.window;
|
|
43
|
+
}, Z = () => {
|
|
44
|
+
if (m != null && m.navigator)
|
|
45
|
+
return m.navigator;
|
|
46
|
+
const o = B();
|
|
47
|
+
return o == null ? void 0 : o.navigator;
|
|
48
|
+
}, N = (o, t, e = "log", n, r = "color: inherit") => {
|
|
49
|
+
const s = typeof console == "undefined" ? void 0 : console;
|
|
50
|
+
if (!s || typeof s[e] != "function")
|
|
51
|
+
return;
|
|
52
|
+
const i = ["info", "log", "warn", "error"].includes(e), l = [];
|
|
53
|
+
switch (N.logLevel) {
|
|
54
|
+
case "ERROR":
|
|
55
|
+
if (e !== "error")
|
|
56
|
+
return;
|
|
57
|
+
break;
|
|
58
|
+
case "WARN":
|
|
59
|
+
if (!["error", "warn"].includes(e))
|
|
60
|
+
return;
|
|
61
|
+
break;
|
|
62
|
+
case "INFO":
|
|
63
|
+
if (!i || o)
|
|
64
|
+
return;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
n && l.push(n);
|
|
68
|
+
const c = `Blok ${rt()}`, a = `line-height: 1em;
|
|
69
|
+
color: #006FEA;
|
|
70
|
+
display: inline-block;
|
|
71
|
+
font-size: 11px;
|
|
72
|
+
line-height: 1em;
|
|
73
|
+
background-color: #fff;
|
|
74
|
+
padding: 4px 9px;
|
|
75
|
+
border-radius: 30px;
|
|
76
|
+
border: 1px solid rgba(56, 138, 229, 0.16);
|
|
77
|
+
margin: 4px 5px 4px 0;`, d = o ? i ? (l.unshift(a, r), `%c${c}%c ${t}`) : `( ${c} )${t}` : t, u = i ? n !== void 0 ? [`${d} %o`, ...l] : [d, ...l] : [d];
|
|
78
|
+
try {
|
|
79
|
+
s[e](...u);
|
|
80
|
+
} catch (p) {
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
N.logLevel = "VERBOSE";
|
|
84
|
+
const Et = (o) => {
|
|
85
|
+
N.logLevel = o;
|
|
86
|
+
}, M = (o, t = "log", e, n) => {
|
|
87
|
+
N(!1, o, t, e, n);
|
|
88
|
+
}, Tt = (o, t = "log", e, n) => {
|
|
89
|
+
N(!0, o, t, e, n);
|
|
90
|
+
}, F = (o) => typeof o == "function", L = (o) => {
|
|
91
|
+
if (o === null || typeof o != "object")
|
|
92
|
+
return !1;
|
|
93
|
+
const t = Object.getPrototypeOf(o);
|
|
94
|
+
return t === null || t === Object.prototype;
|
|
95
|
+
}, x = (o) => typeof o == "string", xt = (o) => typeof o == "boolean", W = (o) => typeof o == "number", At = function(o) {
|
|
96
|
+
return o === void 0;
|
|
97
|
+
}, z = (o) => o == null ? !0 : typeof o == "string" || Array.isArray(o) ? o.length === 0 : o instanceof Map || o instanceof Set ? o.size === 0 : typeof o == "object" ? Object.keys(o).length === 0 : !1, at = (o) => Array.from(o), Nt = (o, t) => function(...e) {
|
|
98
|
+
setTimeout(() => o.apply(this, e), t);
|
|
99
|
+
}, St = (o) => {
|
|
100
|
+
var t;
|
|
101
|
+
return (t = o.name.split(".").pop()) != null ? t : "";
|
|
102
|
+
}, It = (o) => /^[-\w]+\/([-+\w]+|\*)$/.test(o), Rt = (o, t, e) => {
|
|
103
|
+
const n = {
|
|
104
|
+
timeoutId: null
|
|
105
|
+
};
|
|
106
|
+
return function(...r) {
|
|
107
|
+
const s = () => {
|
|
108
|
+
n.timeoutId = null, o.apply(this, r);
|
|
109
|
+
};
|
|
110
|
+
n.timeoutId !== null && clearTimeout(n.timeoutId), n.timeoutId = setTimeout(s, t);
|
|
111
|
+
};
|
|
112
|
+
}, Mt = (o, t, e) => {
|
|
113
|
+
const n = {
|
|
114
|
+
lastCallTime: void 0,
|
|
115
|
+
lastInvokeTime: 0,
|
|
116
|
+
timerId: void 0,
|
|
117
|
+
lastArgs: void 0,
|
|
118
|
+
lastThis: void 0
|
|
119
|
+
}, r = (a) => {
|
|
120
|
+
n.lastInvokeTime = a;
|
|
121
|
+
const d = n.lastArgs, u = n.lastThis;
|
|
122
|
+
return n.lastArgs = void 0, n.lastThis = void 0, o.apply(u, d != null ? d : []);
|
|
123
|
+
}, s = (a) => {
|
|
124
|
+
var h;
|
|
125
|
+
const d = a - ((h = n.lastCallTime) != null ? h : 0), u = a - n.lastInvokeTime, p = t - d;
|
|
126
|
+
return Math.min(p, t - u);
|
|
127
|
+
}, i = (a) => {
|
|
128
|
+
var p;
|
|
129
|
+
const d = a - ((p = n.lastCallTime) != null ? p : 0), u = a - n.lastInvokeTime;
|
|
130
|
+
return n.lastCallTime === void 0 || d >= t || d < 0 || u >= t;
|
|
131
|
+
}, l = () => {
|
|
132
|
+
const a = Date.now();
|
|
133
|
+
if (!i(a)) {
|
|
134
|
+
n.timerId = setTimeout(l, s(a));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
n.timerId = void 0, n.lastArgs !== void 0 && r(a), n.lastArgs = void 0, n.lastThis = void 0;
|
|
138
|
+
};
|
|
139
|
+
return function(...a) {
|
|
140
|
+
const d = Date.now(), u = i(d);
|
|
141
|
+
if (n.lastArgs = a, n.lastThis = this, n.lastCallTime = d, !!(u && n.timerId === void 0))
|
|
142
|
+
return n.lastInvokeTime = d, n.timerId = setTimeout(l, t), r(d);
|
|
143
|
+
};
|
|
144
|
+
}, lt = () => {
|
|
145
|
+
var r, s;
|
|
146
|
+
const o = {
|
|
147
|
+
win: !1,
|
|
148
|
+
mac: !1,
|
|
149
|
+
x11: !1,
|
|
150
|
+
linux: !1
|
|
151
|
+
}, t = Z(), e = (s = (r = t == null ? void 0 : t.userAgent) == null ? void 0 : r.toLowerCase()) != null ? s : "", n = e ? Object.keys(o).find((i) => e.indexOf(i) !== -1) : void 0;
|
|
152
|
+
return n !== void 0 && (o[n] = !0), o;
|
|
153
|
+
}, ct = (o) => o && o.slice(0, 1).toUpperCase() + o.slice(1), X = (o, t) => {
|
|
154
|
+
const e = I({}, o);
|
|
155
|
+
return Object.keys(t).forEach((n) => {
|
|
156
|
+
const r = e[n], s = t[n];
|
|
157
|
+
if (s === void 0)
|
|
158
|
+
return;
|
|
159
|
+
if (L(s) && L(r) && !Array.isArray(s)) {
|
|
160
|
+
e[n] = X(
|
|
161
|
+
r,
|
|
162
|
+
s
|
|
163
|
+
);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
e[n] = s;
|
|
167
|
+
}), e;
|
|
168
|
+
}, Lt = (o, ...t) => {
|
|
169
|
+
if (!L(o) || t.length === 0)
|
|
170
|
+
return o;
|
|
171
|
+
const e = t.reduce((n, r) => L(r) ? X(n, r) : n, o);
|
|
172
|
+
return Object.assign(o, e), o;
|
|
173
|
+
}, Bt = (o) => {
|
|
174
|
+
const t = lt(), e = o.replace(/shift/gi, "⇧").replace(/backspace/gi, "⌫").replace(/enter/gi, "⏎").replace(/up/gi, "↑").replace(/left/gi, "→").replace(/down/gi, "↓").replace(/right/gi, "←").replace(/escape/gi, "⎋").replace(/insert/gi, "Ins").replace(/delete/gi, "␡").replace(/\+/gi, " + ");
|
|
175
|
+
return t.mac ? e.replace(/ctrl|cmd/gi, "⌘").replace(/alt/gi, "⌥") : e.replace(/cmd/gi, "Ctrl").replace(/windows/gi, "WIN");
|
|
176
|
+
}, Ot = (o) => {
|
|
177
|
+
try {
|
|
178
|
+
return new URL(o).href;
|
|
179
|
+
} catch (e) {
|
|
180
|
+
}
|
|
181
|
+
const t = B();
|
|
182
|
+
return o.substring(0, 2) === "//" ? t ? `${t.location.protocol}${o}` : o : t ? `${t.location.origin}${o}` : o;
|
|
183
|
+
}, $t = () => nt(10), Ft = (o) => {
|
|
184
|
+
const t = B();
|
|
185
|
+
t && t.open(o, "_blank");
|
|
186
|
+
}, Ht = (o = "") => `${o}${Math.floor(Math.random() * st).toString(it)}`, dt = 650, ut = () => {
|
|
187
|
+
const o = B();
|
|
188
|
+
return !o || typeof o.matchMedia != "function" ? !1 : o.matchMedia(`(max-width: ${dt}px)`).matches;
|
|
189
|
+
}, Gt = (() => {
|
|
190
|
+
var c;
|
|
191
|
+
const o = Z();
|
|
192
|
+
if (!o)
|
|
193
|
+
return !1;
|
|
194
|
+
const t = o.userAgent || "", e = o.userAgentData, n = e == null ? void 0 : e.platform;
|
|
195
|
+
if (/iP(ad|hone|od)/.test(t) || n !== void 0 && n !== "" && /iP(ad|hone|od)/.test(n))
|
|
196
|
+
return !0;
|
|
197
|
+
const r = ((c = o.maxTouchPoints) != null ? c : 0) > 1, s = () => (
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Fallback for older browsers that don't support User-Agent Client Hints
|
|
199
|
+
o.platform
|
|
200
|
+
), i = n !== void 0 && n !== "" ? n : void 0;
|
|
201
|
+
return (r ? i != null ? i : s() : void 0) === "MacIntel";
|
|
202
|
+
})(), pt = (o, t) => o.length !== t.length ? !1 : o.every((e, n) => H(e, t[n])), H = (o, t) => {
|
|
203
|
+
if (o === t)
|
|
204
|
+
return !0;
|
|
205
|
+
if (o === null || t === null || typeof o != "object" || typeof t != "object" || Array.isArray(o) !== Array.isArray(t))
|
|
206
|
+
return !1;
|
|
207
|
+
if (Array.isArray(o) && Array.isArray(t))
|
|
208
|
+
return pt(o, t);
|
|
209
|
+
const e = Object.keys(o), n = Object.keys(t);
|
|
210
|
+
return e.length !== n.length ? !1 : e.every(
|
|
211
|
+
(r) => Object.prototype.hasOwnProperty.call(t, r) && H(o[r], t[r])
|
|
212
|
+
);
|
|
213
|
+
}, jt = (o) => {
|
|
214
|
+
if (!o || !o.includes("data-blok-fake-background"))
|
|
215
|
+
return o;
|
|
216
|
+
const t = document.createElement("div");
|
|
217
|
+
return t.innerHTML = o, t.querySelectorAll('[data-blok-fake-background="true"]').forEach((n) => {
|
|
218
|
+
const r = n.parentNode;
|
|
219
|
+
if (r) {
|
|
220
|
+
for (; n.firstChild; )
|
|
221
|
+
r.insertBefore(n.firstChild, n);
|
|
222
|
+
r.removeChild(n);
|
|
223
|
+
}
|
|
224
|
+
}), t.innerHTML;
|
|
225
|
+
};
|
|
226
|
+
class g {
|
|
227
|
+
/**
|
|
228
|
+
* Check if passed tag has no closed tag
|
|
229
|
+
* @param {HTMLElement} tag - element to check
|
|
230
|
+
* @returns {boolean}
|
|
231
|
+
*/
|
|
232
|
+
static isSingleTag(t) {
|
|
233
|
+
return !!t.tagName && [
|
|
234
|
+
"AREA",
|
|
235
|
+
"BASE",
|
|
236
|
+
"BR",
|
|
237
|
+
"COL",
|
|
238
|
+
"COMMAND",
|
|
239
|
+
"EMBED",
|
|
240
|
+
"HR",
|
|
241
|
+
"IMG",
|
|
242
|
+
"INPUT",
|
|
243
|
+
"KEYGEN",
|
|
244
|
+
"LINK",
|
|
245
|
+
"META",
|
|
246
|
+
"PARAM",
|
|
247
|
+
"SOURCE",
|
|
248
|
+
"TRACK",
|
|
249
|
+
"WBR"
|
|
250
|
+
].includes(t.tagName);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Check if element is BR or WBR
|
|
254
|
+
* @param {HTMLElement} element - element to check
|
|
255
|
+
* @returns {boolean}
|
|
256
|
+
*/
|
|
257
|
+
static isLineBreakTag(t) {
|
|
258
|
+
return !!t && ["BR", "WBR"].includes(t.tagName);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Checks if a class name is valid for use with classList.add()
|
|
262
|
+
* classList.add() throws if class contains whitespace, is empty, or contains invalid characters
|
|
263
|
+
* @param className - class name to validate
|
|
264
|
+
* @returns {boolean} - true if valid for classList.add()
|
|
265
|
+
*/
|
|
266
|
+
static isValidClassName(t) {
|
|
267
|
+
if (t === "" || /\s/.test(t))
|
|
268
|
+
return !1;
|
|
269
|
+
try {
|
|
270
|
+
return document.createElement("div").classList.add(t), !0;
|
|
271
|
+
} catch (e) {
|
|
272
|
+
return !1;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Safely adds class names to an element, filtering out invalid ones
|
|
277
|
+
* @param element - element to add classes to
|
|
278
|
+
* @param classNames - array of class names to add
|
|
279
|
+
*/
|
|
280
|
+
static safelyAddClasses(t, e) {
|
|
281
|
+
const n = [], r = [];
|
|
282
|
+
for (const s of e)
|
|
283
|
+
g.isValidClassName(s) ? n.push(s) : r.push(s);
|
|
284
|
+
if (n.length > 0 && t.classList.add(...n), r.length > 0) {
|
|
285
|
+
const s = t.className, i = s ? `${s} ${r.join(" ")}` : r.join(" ");
|
|
286
|
+
t.setAttribute("class", i);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Helper for making Elements with class name and attributes
|
|
291
|
+
* @param {string} tagName - new Element tag name
|
|
292
|
+
* @param {string[]|string} [classNames] - list or name of CSS class name(s)
|
|
293
|
+
* @param {object} [attributes] - any attributes
|
|
294
|
+
* @returns {HTMLElement}
|
|
295
|
+
*/
|
|
296
|
+
static make(t, e = null, n = {}) {
|
|
297
|
+
const r = document.createElement(t);
|
|
298
|
+
if (Array.isArray(e)) {
|
|
299
|
+
const s = e.filter((i) => i !== void 0 && i !== "").flatMap((i) => i.split(" ")).filter((i) => i !== "");
|
|
300
|
+
g.safelyAddClasses(r, s);
|
|
301
|
+
}
|
|
302
|
+
if (typeof e == "string" && e !== "") {
|
|
303
|
+
const s = e.split(" ").filter((i) => i !== "");
|
|
304
|
+
g.safelyAddClasses(r, s);
|
|
305
|
+
}
|
|
306
|
+
for (const s in n) {
|
|
307
|
+
if (!Object.prototype.hasOwnProperty.call(n, s))
|
|
308
|
+
continue;
|
|
309
|
+
const i = n[s];
|
|
310
|
+
if (i != null) {
|
|
311
|
+
if (s in r) {
|
|
312
|
+
r[s] = i;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
r.setAttribute(s, String(i));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return r;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Creates Text Node with the passed content
|
|
322
|
+
* @param {string} content - text content
|
|
323
|
+
* @returns {Text}
|
|
324
|
+
*/
|
|
325
|
+
static text(t) {
|
|
326
|
+
return document.createTextNode(t);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Append one or several elements to the parent
|
|
330
|
+
* @param {Element|DocumentFragment} parent - where to append
|
|
331
|
+
* @param {Element|Element[]|DocumentFragment|Text|Text[]} elements - element or elements list
|
|
332
|
+
*/
|
|
333
|
+
static append(t, e) {
|
|
334
|
+
Array.isArray(e) ? e.forEach((n) => t.appendChild(n)) : t.appendChild(e);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Append element or a couple to the beginning of the parent elements
|
|
338
|
+
* @param {Element} parent - where to append
|
|
339
|
+
* @param {Element|Element[]} elements - element or elements list
|
|
340
|
+
*/
|
|
341
|
+
static prepend(t, e) {
|
|
342
|
+
Array.isArray(e) ? [...e].reverse().forEach((r) => t.prepend(r)) : t.prepend(e);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Selector Decorator
|
|
346
|
+
*
|
|
347
|
+
* Returns first match
|
|
348
|
+
* @param {Element} el - element we searching inside. Default - DOM Document
|
|
349
|
+
* @param {string} selector - searching string
|
|
350
|
+
* @returns {Element}
|
|
351
|
+
*/
|
|
352
|
+
static find(t = document, e) {
|
|
353
|
+
return t.querySelector(e);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Get Element by Id
|
|
357
|
+
* @param {string} id - id to find
|
|
358
|
+
* @returns {HTMLElement | null}
|
|
359
|
+
*/
|
|
360
|
+
static get(t) {
|
|
361
|
+
return document.getElementById(t);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Selector Decorator.
|
|
365
|
+
*
|
|
366
|
+
* Returns all matches
|
|
367
|
+
* @param {Element|Document} el - element we searching inside. Default - DOM Document
|
|
368
|
+
* @param {string} selector - searching string
|
|
369
|
+
* @returns {NodeList}
|
|
370
|
+
*/
|
|
371
|
+
static findAll(t = document, e) {
|
|
372
|
+
return t.querySelectorAll(e);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Returns CSS selector for all text inputs
|
|
376
|
+
*/
|
|
377
|
+
static get allInputsSelector() {
|
|
378
|
+
return "[contenteditable=true], textarea, input:not([type]), " + ["text", "password", "email", "number", "search", "tel", "url"].map((e) => `input[type="${e}"]`).join(", ");
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Find all contenteditable, textarea and editable input elements passed holder contains
|
|
382
|
+
* @param holder - element where to find inputs
|
|
383
|
+
*/
|
|
384
|
+
static findAllInputs(t) {
|
|
385
|
+
return at(t.querySelectorAll(g.allInputsSelector)).reduce((e, n) => g.isNativeInput(n) || g.containsOnlyInlineElements(n) ? [...e, n] : [...e, ...g.getDeepestBlockElements(n)], []);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Search for deepest node which is Leaf.
|
|
389
|
+
* Leaf is the vertex that doesn't have any child nodes
|
|
390
|
+
* @description Method recursively goes throw the all Node until it finds the Leaf
|
|
391
|
+
* @param {Node} node - root Node. From this vertex we start Deep-first search
|
|
392
|
+
* {@link https://en.wikipedia.org/wiki/Depth-first_search}
|
|
393
|
+
* @param {boolean} [atLast] - find last text node
|
|
394
|
+
* @returns - it can be text Node or Element Node, so that caret will able to work with it
|
|
395
|
+
* Can return null if node is Document or DocumentFragment, or node is not attached to the DOM
|
|
396
|
+
*/
|
|
397
|
+
static getDeepestNode(t, e = !1) {
|
|
398
|
+
var d;
|
|
399
|
+
const n = e ? "lastChild" : "firstChild", r = e ? "previousSibling" : "nextSibling";
|
|
400
|
+
if (t === null || t.nodeType !== Node.ELEMENT_NODE)
|
|
401
|
+
return t;
|
|
402
|
+
const s = t[n];
|
|
403
|
+
if (s === null)
|
|
404
|
+
return t;
|
|
405
|
+
const i = s;
|
|
406
|
+
if (!(g.isSingleTag(i) && !g.isNativeInput(i) && !g.isLineBreakTag(i)))
|
|
407
|
+
return this.getDeepestNode(i, e);
|
|
408
|
+
const c = i[r];
|
|
409
|
+
if (c)
|
|
410
|
+
return this.getDeepestNode(c, e);
|
|
411
|
+
const a = (d = i.parentNode) == null ? void 0 : d[r];
|
|
412
|
+
return a ? this.getDeepestNode(a, e) : i.parentNode;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Check if object is DOM node
|
|
416
|
+
* @param {*} node - object to check
|
|
417
|
+
* @returns {boolean}
|
|
418
|
+
*/
|
|
419
|
+
static isElement(t) {
|
|
420
|
+
return W(t) ? !1 : t != null && t.nodeType != null && t.nodeType === Node.ELEMENT_NODE;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Check if object is DocumentFragment node
|
|
424
|
+
* @param {object} node - object to check
|
|
425
|
+
* @returns {boolean}
|
|
426
|
+
*/
|
|
427
|
+
static isFragment(t) {
|
|
428
|
+
return W(t) ? !1 : t != null && t.nodeType != null && t.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Check if passed element is contenteditable
|
|
432
|
+
* @param {HTMLElement} element - html element to check
|
|
433
|
+
* @returns {boolean}
|
|
434
|
+
*/
|
|
435
|
+
static isContentEditable(t) {
|
|
436
|
+
return t.contentEditable === "true";
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Checks target if it is native input
|
|
440
|
+
* @param {*} target - HTML element or string
|
|
441
|
+
* @returns {boolean}
|
|
442
|
+
*/
|
|
443
|
+
static isNativeInput(t) {
|
|
444
|
+
const e = [
|
|
445
|
+
"INPUT",
|
|
446
|
+
"TEXTAREA"
|
|
447
|
+
];
|
|
448
|
+
return t != null && typeof t.tagName == "string" ? e.includes(t.tagName) : !1;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Checks if we can set caret
|
|
452
|
+
* @param {HTMLElement} target - target to check
|
|
453
|
+
* @returns {boolean}
|
|
454
|
+
*/
|
|
455
|
+
static canSetCaret(t) {
|
|
456
|
+
return g.isNativeInput(t) ? !(/* @__PURE__ */ new Set([
|
|
457
|
+
"file",
|
|
458
|
+
"checkbox",
|
|
459
|
+
"radio",
|
|
460
|
+
"hidden",
|
|
461
|
+
"submit",
|
|
462
|
+
"button",
|
|
463
|
+
"image",
|
|
464
|
+
"reset"
|
|
465
|
+
])).has(t.type) : g.isContentEditable(t);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Checks node if it is empty
|
|
469
|
+
* @description Method checks simple Node without any childs for emptiness
|
|
470
|
+
* If you have Node with 2 or more children id depth, you better use {@link Dom#isEmpty} method
|
|
471
|
+
* @param {Node} node - node to check
|
|
472
|
+
* @param {string} [ignoreChars] - char or substring to treat as empty
|
|
473
|
+
* @returns {boolean} true if it is empty
|
|
474
|
+
*/
|
|
475
|
+
static isNodeEmpty(t, e) {
|
|
476
|
+
var s, i;
|
|
477
|
+
if (this.isSingleTag(t) && !this.isLineBreakTag(t))
|
|
478
|
+
return !1;
|
|
479
|
+
const n = this.isElement(t) && this.isNativeInput(t) ? t.value : (s = t.textContent) == null ? void 0 : s.replace("", ""), r = e ? n == null ? void 0 : n.replace(new RegExp(e, "g"), "") : n;
|
|
480
|
+
return ((i = r == null ? void 0 : r.length) != null ? i : 0) === 0;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* checks node if it is doesn't have any child nodes
|
|
484
|
+
* @param {Node} node - node to check
|
|
485
|
+
* @returns {boolean}
|
|
486
|
+
*/
|
|
487
|
+
static isLeaf(t) {
|
|
488
|
+
return t ? t.childNodes.length === 0 : !1;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* breadth-first search (BFS)
|
|
492
|
+
* {@link https://en.wikipedia.org/wiki/Breadth-first_search}
|
|
493
|
+
* @description Pushes to stack all DOM leafs and checks for emptiness
|
|
494
|
+
* @param {Node} node - node to check
|
|
495
|
+
* @param {string} [ignoreChars] - char or substring to treat as empty
|
|
496
|
+
* @returns {boolean}
|
|
497
|
+
*/
|
|
498
|
+
static isEmpty(t, e) {
|
|
499
|
+
const n = [t];
|
|
500
|
+
for (; n.length > 0; ) {
|
|
501
|
+
const r = n.shift();
|
|
502
|
+
if (r) {
|
|
503
|
+
if (this.isLeaf(r) && !this.isNodeEmpty(r, e))
|
|
504
|
+
return !1;
|
|
505
|
+
r.childNodes && n.push(...Array.from(r.childNodes));
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return !0;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Check if string contains html elements
|
|
512
|
+
* @param {string} str - string to check
|
|
513
|
+
* @returns {boolean}
|
|
514
|
+
*/
|
|
515
|
+
static isHTMLString(t) {
|
|
516
|
+
const e = g.make("div");
|
|
517
|
+
return e.innerHTML = t, e.childElementCount > 0;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Return length of node`s text content
|
|
521
|
+
* @param {Node} node - node with content
|
|
522
|
+
* @returns {number}
|
|
523
|
+
*/
|
|
524
|
+
static getContentLength(t) {
|
|
525
|
+
var e, n;
|
|
526
|
+
return g.isNativeInput(t) ? t.value.length : t.nodeType === Node.TEXT_NODE ? t.length : (n = (e = t.textContent) == null ? void 0 : e.length) != null ? n : 0;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Return array of names of block html elements
|
|
530
|
+
* @returns {string[]}
|
|
531
|
+
*/
|
|
532
|
+
static get blockElements() {
|
|
533
|
+
return [
|
|
534
|
+
"address",
|
|
535
|
+
"article",
|
|
536
|
+
"aside",
|
|
537
|
+
"blockquote",
|
|
538
|
+
"canvas",
|
|
539
|
+
"div",
|
|
540
|
+
"dl",
|
|
541
|
+
"dt",
|
|
542
|
+
"fieldset",
|
|
543
|
+
"figcaption",
|
|
544
|
+
"figure",
|
|
545
|
+
"footer",
|
|
546
|
+
"form",
|
|
547
|
+
"h1",
|
|
548
|
+
"h2",
|
|
549
|
+
"h3",
|
|
550
|
+
"h4",
|
|
551
|
+
"h5",
|
|
552
|
+
"h6",
|
|
553
|
+
"header",
|
|
554
|
+
"hgroup",
|
|
555
|
+
"hr",
|
|
556
|
+
"li",
|
|
557
|
+
"main",
|
|
558
|
+
"nav",
|
|
559
|
+
"noscript",
|
|
560
|
+
"ol",
|
|
561
|
+
"output",
|
|
562
|
+
"p",
|
|
563
|
+
"pre",
|
|
564
|
+
"ruby",
|
|
565
|
+
"section",
|
|
566
|
+
"table",
|
|
567
|
+
"tbody",
|
|
568
|
+
"thead",
|
|
569
|
+
"tr",
|
|
570
|
+
"tfoot",
|
|
571
|
+
"ul",
|
|
572
|
+
"video"
|
|
573
|
+
];
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Check if passed content includes only inline elements
|
|
577
|
+
* @param {string|HTMLElement} data - element or html string
|
|
578
|
+
* @returns {boolean}
|
|
579
|
+
*/
|
|
580
|
+
static containsOnlyInlineElements(t) {
|
|
581
|
+
const e = x(t) ? (() => {
|
|
582
|
+
const r = document.createElement("div");
|
|
583
|
+
return r.innerHTML = t, r;
|
|
584
|
+
})() : t, n = (r) => !g.blockElements.includes(r.tagName.toLowerCase()) && Array.from(r.children).every(n);
|
|
585
|
+
return Array.from(e.children).every(n);
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Find and return all block elements in the passed parent (including subtree)
|
|
589
|
+
* @param {HTMLElement} parent - root element
|
|
590
|
+
* @returns {HTMLElement[]}
|
|
591
|
+
*/
|
|
592
|
+
static getDeepestBlockElements(t) {
|
|
593
|
+
return g.containsOnlyInlineElements(t) ? [t] : Array.from(t.children).reduce((e, n) => [...e, ...g.getDeepestBlockElements(n)], []);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Helper for get holder from {string} or return HTMLElement
|
|
597
|
+
* @param {string | HTMLElement} element - holder's id or holder's HTML Element
|
|
598
|
+
* @returns {HTMLElement}
|
|
599
|
+
*/
|
|
600
|
+
static getHolder(t) {
|
|
601
|
+
if (!x(t))
|
|
602
|
+
return t;
|
|
603
|
+
const e = document.getElementById(t);
|
|
604
|
+
if (e !== null)
|
|
605
|
+
return e;
|
|
606
|
+
throw new Error(`Element with id "${t}" not found`);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Returns true if element is anchor (is A tag)
|
|
610
|
+
* @param {Element} element - element to check
|
|
611
|
+
* @returns {boolean}
|
|
612
|
+
*/
|
|
613
|
+
static isAnchor(t) {
|
|
614
|
+
return t.tagName.toLowerCase() === "a";
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Return element's offset related to the document
|
|
618
|
+
* @todo handle case when blok initialized in scrollable popup
|
|
619
|
+
* @param el - element to compute offset
|
|
620
|
+
*/
|
|
621
|
+
static offset(t) {
|
|
622
|
+
const e = t.getBoundingClientRect(), n = window.scrollX || document.documentElement.scrollLeft, r = window.scrollY || document.documentElement.scrollTop, s = e.top + r, i = e.left + n;
|
|
623
|
+
return {
|
|
624
|
+
top: s,
|
|
625
|
+
left: i,
|
|
626
|
+
bottom: s + e.height,
|
|
627
|
+
right: i + e.width
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Find text node and offset by total content offset
|
|
632
|
+
* @param {Node} root - root node to start search from
|
|
633
|
+
* @param {number} totalOffset - offset relative to the root node content
|
|
634
|
+
* @returns {{node: Node | null, offset: number}} - node and offset inside node
|
|
635
|
+
*/
|
|
636
|
+
static getNodeByOffset(t, e) {
|
|
637
|
+
const n = document.createTreeWalker(
|
|
638
|
+
t,
|
|
639
|
+
NodeFilter.SHOW_TEXT,
|
|
640
|
+
null
|
|
641
|
+
), r = (a, d, u, p) => {
|
|
642
|
+
var b;
|
|
643
|
+
if (!a && u) {
|
|
644
|
+
const k = d - p, w = Math.max(e - k, 0), C = Math.min(w, p);
|
|
645
|
+
return {
|
|
646
|
+
node: u,
|
|
647
|
+
offset: C
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
if (!a)
|
|
651
|
+
return {
|
|
652
|
+
node: null,
|
|
653
|
+
offset: 0
|
|
654
|
+
};
|
|
655
|
+
const f = ((b = a.textContent) != null ? b : "").length;
|
|
656
|
+
return d + f >= e ? {
|
|
657
|
+
node: a,
|
|
658
|
+
offset: Math.min(e - d, f)
|
|
659
|
+
} : r(
|
|
660
|
+
n.nextNode(),
|
|
661
|
+
d + f,
|
|
662
|
+
a,
|
|
663
|
+
f
|
|
664
|
+
);
|
|
665
|
+
}, s = n.nextNode(), { node: i, offset: l } = r(s, 0, null, 0);
|
|
666
|
+
if (!i)
|
|
667
|
+
return {
|
|
668
|
+
node: null,
|
|
669
|
+
offset: 0
|
|
670
|
+
};
|
|
671
|
+
const c = i.textContent;
|
|
672
|
+
return !c || c.length === 0 ? {
|
|
673
|
+
node: null,
|
|
674
|
+
offset: 0
|
|
675
|
+
} : {
|
|
676
|
+
node: i,
|
|
677
|
+
offset: l
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
const Pt = (o) => !/[^\t\n\r \u200B]/.test(o), Vt = (o) => {
|
|
682
|
+
o.setAttribute("data-blok-empty", g.isEmpty(o) ? "true" : "false");
|
|
683
|
+
}, gt = [
|
|
684
|
+
// Max-width: max-w-* classes conflict with each other
|
|
685
|
+
{ pattern: /^max-w-(.+)$/, getGroup: () => "max-w" },
|
|
686
|
+
// Width: w-* classes conflict with each other
|
|
687
|
+
{ pattern: /^w-(.+)$/, getGroup: () => "w" },
|
|
688
|
+
// Min-width: min-w-* classes conflict with each other
|
|
689
|
+
{ pattern: /^min-w-(.+)$/, getGroup: () => "min-w" },
|
|
690
|
+
// Height: h-* classes conflict with each other
|
|
691
|
+
{ pattern: /^h-(.+)$/, getGroup: () => "h" },
|
|
692
|
+
// Display: block, inline-block, flex, hidden, etc.
|
|
693
|
+
{ pattern: /^(block|inline-block|inline|flex|inline-flex|grid|inline-grid|hidden|contents|flow-root|list-item)$/, getGroup: () => "display" },
|
|
694
|
+
// Flex direction: flex-row, flex-col
|
|
695
|
+
{ pattern: /^flex-(row|col|row-reverse|col-reverse)$/, getGroup: () => "flex-dir" },
|
|
696
|
+
// Justify content: justify-*
|
|
697
|
+
{ pattern: /^justify-(.+)$/, getGroup: () => "justify" },
|
|
698
|
+
// Align items: items-*
|
|
699
|
+
{ pattern: /^items-(.+)$/, getGroup: () => "items" },
|
|
700
|
+
// Text alignment: text-left, text-center, text-right
|
|
701
|
+
{ pattern: /^text-(left|center|right|justify|start|end)$/, getGroup: () => "text-align" },
|
|
702
|
+
// Text color: text-{color} (but not text-align classes)
|
|
703
|
+
{ pattern: /^text-((?!left|center|right|justify|start|end).+)$/, getGroup: () => "text-color" },
|
|
704
|
+
// Background: bg-*
|
|
705
|
+
{ pattern: /^bg-(.+)$/, getGroup: () => "bg" },
|
|
706
|
+
// Opacity: opacity-*
|
|
707
|
+
{ pattern: /^opacity-(.+)$/, getGroup: () => "opacity" },
|
|
708
|
+
// Z-index: z-*
|
|
709
|
+
{ pattern: /^z-(.+)$/, getGroup: () => "z" },
|
|
710
|
+
// Position: static, fixed, absolute, relative, sticky
|
|
711
|
+
{ pattern: /^(static|fixed|absolute|relative|sticky)$/, getGroup: () => "position" },
|
|
712
|
+
// Inset (all sides): inset-*
|
|
713
|
+
{ pattern: /^inset-(.+)$/, getGroup: () => "inset" },
|
|
714
|
+
// Top/Right/Bottom/Left positioning
|
|
715
|
+
{ pattern: /^(top|right|bottom|left)-(.+)$/, getGroup: (o) => o[1] },
|
|
716
|
+
// Margin: m-*, mx-*, my-*, mt-*, mr-*, mb-*, ml-*
|
|
717
|
+
{ pattern: /^!?m-(.+)$/, getGroup: () => "m" },
|
|
718
|
+
{ pattern: /^!?mx-(.+)$/, getGroup: () => "mx" },
|
|
719
|
+
{ pattern: /^!?my-(.+)$/, getGroup: () => "my" },
|
|
720
|
+
{ pattern: /^!?mt-(.+)$/, getGroup: () => "mt" },
|
|
721
|
+
{ pattern: /^!?mr-(.+)$/, getGroup: () => "mr" },
|
|
722
|
+
{ pattern: /^!?mb-(.+)$/, getGroup: () => "mb" },
|
|
723
|
+
{ pattern: /^!?ml-(.+)$/, getGroup: () => "ml" },
|
|
724
|
+
// Padding: p-*, px-*, py-*, pt-*, pr-*, pb-*, pl-*
|
|
725
|
+
{ pattern: /^p-(.+)$/, getGroup: () => "p" },
|
|
726
|
+
{ pattern: /^px-(.+)$/, getGroup: () => "px" },
|
|
727
|
+
{ pattern: /^py-(.+)$/, getGroup: () => "py" },
|
|
728
|
+
{ pattern: /^pt-(.+)$/, getGroup: () => "pt" },
|
|
729
|
+
{ pattern: /^pr-(.+)$/, getGroup: () => "pr" },
|
|
730
|
+
{ pattern: /^pb-(.+)$/, getGroup: () => "pb" },
|
|
731
|
+
{ pattern: /^pl-(.+)$/, getGroup: () => "pl" },
|
|
732
|
+
// Gap: gap-*, gap-x-*, gap-y-*
|
|
733
|
+
{ pattern: /^gap-(.+)$/, getGroup: () => "gap" },
|
|
734
|
+
// Border radius: rounded-*
|
|
735
|
+
{ pattern: /^rounded(-.*)?$/, getGroup: () => "rounded" },
|
|
736
|
+
// Visibility: visible, invisible
|
|
737
|
+
{ pattern: /^(visible|invisible)$/, getGroup: () => "visibility" },
|
|
738
|
+
// Overflow: overflow-*
|
|
739
|
+
{ pattern: /^overflow-(.+)$/, getGroup: () => "overflow" },
|
|
740
|
+
// Cursor: cursor-*
|
|
741
|
+
{ pattern: /^cursor-(.+)$/, getGroup: () => "cursor" },
|
|
742
|
+
// Pointer events: pointer-events-*
|
|
743
|
+
{ pattern: /^pointer-events-(.+)$/, getGroup: () => "pointer-events" },
|
|
744
|
+
// Transition: transition-*
|
|
745
|
+
{ pattern: /^transition(-.*)?$/, getGroup: () => "transition" },
|
|
746
|
+
// Duration: duration-*
|
|
747
|
+
{ pattern: /^duration-(.+)$/, getGroup: () => "duration" },
|
|
748
|
+
// Ease: ease-*
|
|
749
|
+
{ pattern: /^ease-(.+)$/, getGroup: () => "ease" },
|
|
750
|
+
// Animation: animate-*
|
|
751
|
+
{ pattern: /^animate-(.+)$/, getGroup: () => "animate" },
|
|
752
|
+
// Font weight: font-*
|
|
753
|
+
{ pattern: /^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/, getGroup: () => "font-weight" },
|
|
754
|
+
// Font size: text-{size}
|
|
755
|
+
{ pattern: /^text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/, getGroup: () => "font-size" },
|
|
756
|
+
// Line height: leading-*
|
|
757
|
+
{ pattern: /^leading-(.+)$/, getGroup: () => "leading" },
|
|
758
|
+
// Outline: outline-*
|
|
759
|
+
{ pattern: /^outline(-.*)?$/, getGroup: () => "outline" },
|
|
760
|
+
// Border: border-*
|
|
761
|
+
{ pattern: /^border(-.*)?$/, getGroup: () => "border" },
|
|
762
|
+
// Shadow: shadow-*
|
|
763
|
+
{ pattern: /^shadow(-.*)?$/, getGroup: () => "shadow" }
|
|
764
|
+
], $ = /* @__PURE__ */ new Map(), ht = (o) => {
|
|
765
|
+
const t = $.get(o);
|
|
766
|
+
if (t !== void 0)
|
|
767
|
+
return t;
|
|
768
|
+
for (const { pattern: e, getGroup: n } of gt) {
|
|
769
|
+
const r = o.match(e);
|
|
770
|
+
if (r) {
|
|
771
|
+
const s = n(r);
|
|
772
|
+
return $.set(o, s), s;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return $.set(o, null), null;
|
|
776
|
+
}, ft = (o, t, e) => {
|
|
777
|
+
const n = ht(o);
|
|
778
|
+
if (n) {
|
|
779
|
+
t.set(n, o);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
e.includes(o) || e.push(o);
|
|
783
|
+
}, mt = (o) => {
|
|
784
|
+
const t = [];
|
|
785
|
+
for (const e of o)
|
|
786
|
+
if (e) {
|
|
787
|
+
if (Array.isArray(e)) {
|
|
788
|
+
t.push(...e.filter(Boolean));
|
|
789
|
+
continue;
|
|
790
|
+
}
|
|
791
|
+
t.push(e);
|
|
792
|
+
}
|
|
793
|
+
return t;
|
|
794
|
+
}, Wt = (...o) => {
|
|
795
|
+
const t = /* @__PURE__ */ new Map(), e = [], n = mt(o);
|
|
796
|
+
for (const r of n)
|
|
797
|
+
r.split(/\s+/).filter(Boolean).forEach((i) => ft(i, t, e));
|
|
798
|
+
return [...e, ...t.values()].join(" ");
|
|
799
|
+
}, Dt = (...o) => o.filter(Boolean).join(" "), E = {
|
|
800
|
+
// ============================================
|
|
801
|
+
// Core Element Identifiers
|
|
802
|
+
// ============================================
|
|
803
|
+
/** Interface type identifier (blok, inline-toolbar, tooltip) */
|
|
804
|
+
interface: "data-blok-interface",
|
|
805
|
+
/** Block element wrapper */
|
|
806
|
+
element: "data-blok-element",
|
|
807
|
+
/** Block element content wrapper */
|
|
808
|
+
elementContent: "data-blok-element-content",
|
|
809
|
+
/** Editor wrapper container */
|
|
810
|
+
editor: "data-blok-editor",
|
|
811
|
+
/** Redactor zone */
|
|
812
|
+
redactor: "data-blok-redactor",
|
|
813
|
+
// ============================================
|
|
814
|
+
// Block Identifiers
|
|
815
|
+
// ============================================
|
|
816
|
+
/** Block unique identifier */
|
|
817
|
+
id: "data-blok-id",
|
|
818
|
+
/** Block component/tool type */
|
|
819
|
+
component: "data-blok-component",
|
|
820
|
+
/** Tool type attribute */
|
|
821
|
+
tool: "data-blok-tool",
|
|
822
|
+
/** Block nesting depth */
|
|
823
|
+
depth: "data-blok-depth",
|
|
824
|
+
// ============================================
|
|
825
|
+
// Global States
|
|
826
|
+
// ============================================
|
|
827
|
+
/** Element is hidden from view */
|
|
828
|
+
hidden: "data-blok-hidden",
|
|
829
|
+
/** Element is disabled and non-interactive */
|
|
830
|
+
disabled: "data-blok-disabled",
|
|
831
|
+
/** Element is focused via keyboard navigation */
|
|
832
|
+
focused: "data-blok-focused",
|
|
833
|
+
/** Block is selected */
|
|
834
|
+
selected: "data-blok-selected",
|
|
835
|
+
/** Block is stretched */
|
|
836
|
+
stretched: "data-blok-stretched",
|
|
837
|
+
/** Editor or element is empty */
|
|
838
|
+
empty: "data-blok-empty",
|
|
839
|
+
// ============================================
|
|
840
|
+
// Editor Modes
|
|
841
|
+
// ============================================
|
|
842
|
+
/** Narrow mode state */
|
|
843
|
+
narrow: "data-blok-narrow",
|
|
844
|
+
/** Right-to-left mode */
|
|
845
|
+
rtl: "data-blok-rtl",
|
|
846
|
+
// ============================================
|
|
847
|
+
// Drag and Drop
|
|
848
|
+
// ============================================
|
|
849
|
+
/** Block is being dragged */
|
|
850
|
+
dragging: "data-blok-dragging",
|
|
851
|
+
/** Multiple blocks being dragged */
|
|
852
|
+
draggingMulti: "data-blok-dragging-multi",
|
|
853
|
+
/** Block is being duplicated (Alt+drag) */
|
|
854
|
+
duplicating: "data-blok-duplicating",
|
|
855
|
+
/** Drag handle element */
|
|
856
|
+
dragHandle: "data-blok-drag-handle",
|
|
857
|
+
// ============================================
|
|
858
|
+
// Toolbar
|
|
859
|
+
// ============================================
|
|
860
|
+
/** Toolbar element */
|
|
861
|
+
toolbar: "data-blok-toolbar",
|
|
862
|
+
/** Settings toggler button */
|
|
863
|
+
settingsToggler: "data-blok-settings-toggler",
|
|
864
|
+
/** Toolbox is open */
|
|
865
|
+
toolboxOpened: "data-blok-toolbox-opened",
|
|
866
|
+
/** Block settings is open */
|
|
867
|
+
blockSettingsOpened: "data-blok-block-settings-opened",
|
|
868
|
+
/** Element is opened (generic) */
|
|
869
|
+
opened: "data-blok-opened",
|
|
870
|
+
// ============================================
|
|
871
|
+
// Popover Container
|
|
872
|
+
// ============================================
|
|
873
|
+
/** Root popover element */
|
|
874
|
+
popover: "data-blok-popover",
|
|
875
|
+
/** Popover container wrapper */
|
|
876
|
+
popoverContainer: "data-blok-popover-container",
|
|
877
|
+
/** Popover items list */
|
|
878
|
+
popoverItems: "data-blok-popover-items",
|
|
879
|
+
/** Popover overlay element */
|
|
880
|
+
popoverOverlay: "data-blok-popover-overlay",
|
|
881
|
+
/** Popover custom content area */
|
|
882
|
+
popoverCustomContent: "data-blok-popover-custom-content",
|
|
883
|
+
/** Popover custom class */
|
|
884
|
+
popoverCustomClass: "data-blok-popover-custom-class",
|
|
885
|
+
/** Inline popover variant */
|
|
886
|
+
popoverInline: "data-blok-popover-inline",
|
|
887
|
+
/** Popover is open */
|
|
888
|
+
popoverOpened: "data-blok-popover-opened",
|
|
889
|
+
/** Popover opens upward */
|
|
890
|
+
popoverOpenTop: "data-blok-popover-open-top",
|
|
891
|
+
/** Popover opens leftward */
|
|
892
|
+
popoverOpenLeft: "data-blok-popover-open-left",
|
|
893
|
+
// ============================================
|
|
894
|
+
// Popover Nesting
|
|
895
|
+
// ============================================
|
|
896
|
+
/** Nested popover indicator */
|
|
897
|
+
nested: "data-blok-nested",
|
|
898
|
+
/** Nesting level value */
|
|
899
|
+
nestedLevel: "data-blok-nested-level",
|
|
900
|
+
// ============================================
|
|
901
|
+
// Popover Header
|
|
902
|
+
// ============================================
|
|
903
|
+
/** Header container */
|
|
904
|
+
popoverHeader: "data-blok-popover-header",
|
|
905
|
+
/** Header text element */
|
|
906
|
+
popoverHeaderText: "data-blok-popover-header-text",
|
|
907
|
+
/** Back button in nested popover */
|
|
908
|
+
popoverHeaderBackButton: "data-blok-popover-header-back-button",
|
|
909
|
+
// ============================================
|
|
910
|
+
// Popover Items
|
|
911
|
+
// ============================================
|
|
912
|
+
/** Item container */
|
|
913
|
+
popoverItem: "data-blok-popover-item",
|
|
914
|
+
/** Item icon wrapper */
|
|
915
|
+
popoverItemIcon: "data-blok-popover-item-icon",
|
|
916
|
+
/** Chevron icon for nested items */
|
|
917
|
+
popoverItemIconChevronRight: "data-blok-popover-item-icon-chevron-right",
|
|
918
|
+
/** Item title text */
|
|
919
|
+
popoverItemTitle: "data-blok-popover-item-title",
|
|
920
|
+
/** Item secondary title */
|
|
921
|
+
popoverItemSecondaryTitle: "data-blok-popover-item-secondary-title",
|
|
922
|
+
/** Item is active/selected */
|
|
923
|
+
popoverItemActive: "data-blok-popover-item-active",
|
|
924
|
+
/** Confirmation state */
|
|
925
|
+
popoverItemConfirmation: "data-blok-popover-item-confirmation",
|
|
926
|
+
/** Disable hover styling */
|
|
927
|
+
popoverItemNoHover: "data-blok-popover-item-no-hover",
|
|
928
|
+
/** Disable focus handling */
|
|
929
|
+
popoverItemNoFocus: "data-blok-popover-item-no-focus",
|
|
930
|
+
/** Wobble animation */
|
|
931
|
+
popoverItemWobble: "data-blok-popover-item-wobble",
|
|
932
|
+
/** Separator item */
|
|
933
|
+
popoverItemSeparator: "data-blok-popover-item-separator",
|
|
934
|
+
/** Separator line element */
|
|
935
|
+
popoverItemSeparatorLine: "data-blok-popover-item-separator-line",
|
|
936
|
+
/** HTML-based item */
|
|
937
|
+
popoverItemHtml: "data-blok-popover-item-html",
|
|
938
|
+
/** Item has child menu */
|
|
939
|
+
hasChildren: "data-blok-has-children",
|
|
940
|
+
/** Item name identifier */
|
|
941
|
+
itemName: "data-blok-item-name",
|
|
942
|
+
/** No search results shown */
|
|
943
|
+
nothingFoundDisplayed: "data-blok-nothing-found-displayed",
|
|
944
|
+
// ============================================
|
|
945
|
+
// Overlay / Selection
|
|
946
|
+
// ============================================
|
|
947
|
+
/** Selection overlay */
|
|
948
|
+
overlay: "data-blok-overlay",
|
|
949
|
+
/** Overlay container */
|
|
950
|
+
overlayContainer: "data-blok-overlay-container",
|
|
951
|
+
/** Selection rectangle */
|
|
952
|
+
overlayRectangle: "data-blok-overlay-rectangle",
|
|
953
|
+
/** Overlay is hidden */
|
|
954
|
+
overlayHidden: "data-blok-overlay-hidden",
|
|
955
|
+
/** Fake cursor indicator */
|
|
956
|
+
fakeCursor: "data-blok-fake-cursor",
|
|
957
|
+
/** Fake background for selection */
|
|
958
|
+
fakeBackground: "data-blok-fake-background",
|
|
959
|
+
// ============================================
|
|
960
|
+
// Scroll
|
|
961
|
+
// ============================================
|
|
962
|
+
/** Auto-scroll zone (top/bottom) */
|
|
963
|
+
scrollZone: "data-blok-scroll-zone",
|
|
964
|
+
/** Scroll is locked */
|
|
965
|
+
scrollLocked: "data-blok-scroll-locked",
|
|
966
|
+
/** Hard scroll lock */
|
|
967
|
+
scrollLockedHard: "data-blok-scroll-locked-hard",
|
|
968
|
+
// ============================================
|
|
969
|
+
// Caret
|
|
970
|
+
// ============================================
|
|
971
|
+
/** Shadow caret element */
|
|
972
|
+
shadowCaret: "data-blok-shadow-caret",
|
|
973
|
+
// ============================================
|
|
974
|
+
// Placeholders
|
|
975
|
+
// ============================================
|
|
976
|
+
/** Placeholder text */
|
|
977
|
+
placeholder: "data-blok-placeholder",
|
|
978
|
+
/** Active placeholder text */
|
|
979
|
+
placeholderActive: "data-blok-placeholder-active",
|
|
980
|
+
// ============================================
|
|
981
|
+
// Mutation Tracking
|
|
982
|
+
// ============================================
|
|
983
|
+
/** Element excluded from mutation tracking */
|
|
984
|
+
mutationFree: "data-blok-mutation-free",
|
|
985
|
+
// ============================================
|
|
986
|
+
// Navigation
|
|
987
|
+
// ============================================
|
|
988
|
+
/** Block has navigation focus */
|
|
989
|
+
navigationFocused: "data-blok-navigation-focused",
|
|
990
|
+
/** Flipper navigation target */
|
|
991
|
+
flipperNavigationTarget: "data-blok-flipper-navigation-target",
|
|
992
|
+
// ============================================
|
|
993
|
+
// Inline Toolbar
|
|
994
|
+
// ============================================
|
|
995
|
+
/** Inline toolbar enabled on external element */
|
|
996
|
+
inlineToolbar: "data-blok-inline-toolbar",
|
|
997
|
+
// ============================================
|
|
998
|
+
// Link Tool
|
|
999
|
+
// ============================================
|
|
1000
|
+
/** Link tool is active */
|
|
1001
|
+
linkToolActive: "data-blok-link-tool-active",
|
|
1002
|
+
/** Link tool unlink mode */
|
|
1003
|
+
linkToolUnlink: "data-blok-link-tool-unlink",
|
|
1004
|
+
/** Link tool input is opened */
|
|
1005
|
+
linkToolInputOpened: "data-blok-link-tool-input-opened",
|
|
1006
|
+
// ============================================
|
|
1007
|
+
// Bold Tool
|
|
1008
|
+
// ============================================
|
|
1009
|
+
/** Bold collapsed length tracking */
|
|
1010
|
+
boldCollapsedLength: "data-blok-bold-collapsed-length",
|
|
1011
|
+
/** Bold collapsed active state */
|
|
1012
|
+
boldCollapsedActive: "data-blok-bold-collapsed-active",
|
|
1013
|
+
/** Bold previous length tracking */
|
|
1014
|
+
boldPrevLength: "data-blok-bold-prev-length",
|
|
1015
|
+
/** Bold leading whitespace */
|
|
1016
|
+
boldLeadingWs: "data-blok-bold-leading-ws",
|
|
1017
|
+
/** Bold marker */
|
|
1018
|
+
boldMarker: "data-blok-bold-marker",
|
|
1019
|
+
// ============================================
|
|
1020
|
+
// Tooltip
|
|
1021
|
+
// ============================================
|
|
1022
|
+
/** Tooltip is shown */
|
|
1023
|
+
shown: "data-blok-shown",
|
|
1024
|
+
/** Tooltip placement */
|
|
1025
|
+
placement: "data-blok-placement",
|
|
1026
|
+
// ============================================
|
|
1027
|
+
// Notifier
|
|
1028
|
+
// ============================================
|
|
1029
|
+
/** Bounce in animation */
|
|
1030
|
+
bounceIn: "data-blok-bounce-in",
|
|
1031
|
+
// ============================================
|
|
1032
|
+
// Announcer (Accessibility)
|
|
1033
|
+
// ============================================
|
|
1034
|
+
/** Live region announcer */
|
|
1035
|
+
announcer: "data-blok-announcer",
|
|
1036
|
+
// ============================================
|
|
1037
|
+
// Stub Block
|
|
1038
|
+
// ============================================
|
|
1039
|
+
/** Stub block element */
|
|
1040
|
+
stub: "data-blok-stub",
|
|
1041
|
+
/** Stub info section */
|
|
1042
|
+
stubInfo: "data-blok-stub-info",
|
|
1043
|
+
/** Stub title */
|
|
1044
|
+
stubTitle: "data-blok-stub-title",
|
|
1045
|
+
/** Stub subtitle */
|
|
1046
|
+
stubSubtitle: "data-blok-stub-subtitle",
|
|
1047
|
+
// ============================================
|
|
1048
|
+
// Testing
|
|
1049
|
+
// ============================================
|
|
1050
|
+
/** Test identifier (for E2E tests) */
|
|
1051
|
+
testid: "data-blok-testid",
|
|
1052
|
+
/** Force hover state (for tests/storybook) */
|
|
1053
|
+
forceHover: "data-blok-force-hover"
|
|
1054
|
+
}, R = (o, t) => t === void 0 ? `[${o}]` : `[${o}="${t}"]`, _t = 180, Ut = 400, Zt = "blok", zt = "inline-toolbar", Xt = "tooltip", qt = "[data-blok-interface=inline-toolbar]";
|
|
1055
|
+
typeof process != "undefined" && process.platform ? process.platform === "darwin" ? "Meta" : "Control" : typeof navigator != "undefined" && navigator.userAgent.toLowerCase().includes("mac") ? "Meta" : "Control";
|
|
1056
|
+
class v {
|
|
1057
|
+
constructor() {
|
|
1058
|
+
this.instance = null, this.selection = null, this.savedSelectionRange = null, this.isFakeBackgroundEnabled = !1;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Returns selected anchor
|
|
1062
|
+
* {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorNode}
|
|
1063
|
+
* @returns {Node|null}
|
|
1064
|
+
*/
|
|
1065
|
+
static get anchorNode() {
|
|
1066
|
+
const t = window.getSelection();
|
|
1067
|
+
return t ? t.anchorNode : null;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Returns selected anchor element
|
|
1071
|
+
* @returns {Element|null}
|
|
1072
|
+
*/
|
|
1073
|
+
static get anchorElement() {
|
|
1074
|
+
const t = window.getSelection();
|
|
1075
|
+
if (!t)
|
|
1076
|
+
return null;
|
|
1077
|
+
const e = t.anchorNode;
|
|
1078
|
+
return e ? g.isElement(e) ? e : e.parentElement : null;
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Returns selection offset according to the anchor node
|
|
1082
|
+
* {@link https://developer.mozilla.org/ru/docs/Web/API/Selection/anchorOffset}
|
|
1083
|
+
* @returns {number|null}
|
|
1084
|
+
*/
|
|
1085
|
+
static get anchorOffset() {
|
|
1086
|
+
const t = window.getSelection();
|
|
1087
|
+
return t ? t.anchorOffset : null;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Is current selection range collapsed
|
|
1091
|
+
* @returns {boolean|null}
|
|
1092
|
+
*/
|
|
1093
|
+
static get isCollapsed() {
|
|
1094
|
+
const t = window.getSelection();
|
|
1095
|
+
return t ? t.isCollapsed : null;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Check current selection if it is at Blok's zone
|
|
1099
|
+
* @returns {boolean}
|
|
1100
|
+
*/
|
|
1101
|
+
static get isAtBlok() {
|
|
1102
|
+
return this.isSelectionAtBlok(v.get());
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Check if passed selection is at Blok's zone
|
|
1106
|
+
* @param selection - Selection object to check
|
|
1107
|
+
*/
|
|
1108
|
+
static isSelectionAtBlok(t) {
|
|
1109
|
+
if (!t)
|
|
1110
|
+
return !1;
|
|
1111
|
+
const e = t.anchorNode || t.focusNode, n = e && e.nodeType === Node.TEXT_NODE ? e.parentNode : e, r = n && n instanceof Element ? n.closest(R(E.redactor)) : null;
|
|
1112
|
+
return r ? r.nodeType === Node.ELEMENT_NODE : !1;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Check if passed range at Blok zone
|
|
1116
|
+
* @param range - range to check
|
|
1117
|
+
*/
|
|
1118
|
+
static isRangeAtBlok(t) {
|
|
1119
|
+
if (!t)
|
|
1120
|
+
return;
|
|
1121
|
+
const e = t.startContainer && t.startContainer.nodeType === Node.TEXT_NODE ? t.startContainer.parentNode : t.startContainer, n = e && e instanceof Element ? e.closest(R(E.redactor)) : null;
|
|
1122
|
+
return n ? n.nodeType === Node.ELEMENT_NODE : !1;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Methods return boolean that true if selection exists on the page
|
|
1126
|
+
*/
|
|
1127
|
+
static get isSelectionExists() {
|
|
1128
|
+
const t = v.get();
|
|
1129
|
+
return !!(t != null && t.anchorNode);
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Return first range
|
|
1133
|
+
* @returns {Range|null}
|
|
1134
|
+
*/
|
|
1135
|
+
static get range() {
|
|
1136
|
+
return this.getRangeFromSelection(this.get());
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Returns range from passed Selection object
|
|
1140
|
+
* @param selection - Selection object to get Range from
|
|
1141
|
+
*/
|
|
1142
|
+
static getRangeFromSelection(t) {
|
|
1143
|
+
return t && t.rangeCount ? t.getRangeAt(0) : null;
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Calculates position and size of selected text
|
|
1147
|
+
* @returns {DOMRect}
|
|
1148
|
+
*/
|
|
1149
|
+
static get rect() {
|
|
1150
|
+
const t = document.selection, e = {
|
|
1151
|
+
x: 0,
|
|
1152
|
+
y: 0,
|
|
1153
|
+
width: 0,
|
|
1154
|
+
height: 0
|
|
1155
|
+
};
|
|
1156
|
+
if (t && t.type !== "Control") {
|
|
1157
|
+
const l = t.createRange();
|
|
1158
|
+
return e.x = l.boundingLeft, e.y = l.boundingTop, e.width = l.boundingWidth, e.height = l.boundingHeight, e;
|
|
1159
|
+
}
|
|
1160
|
+
const n = window.getSelection();
|
|
1161
|
+
if (!n)
|
|
1162
|
+
return M("Method window.getSelection returned null", "warn"), e;
|
|
1163
|
+
if (n.rangeCount === null || isNaN(n.rangeCount))
|
|
1164
|
+
return M("Method SelectionUtils.rangeCount is not supported", "warn"), e;
|
|
1165
|
+
if (n.rangeCount === 0)
|
|
1166
|
+
return e;
|
|
1167
|
+
const r = n.getRangeAt(0).cloneRange(), s = r.getBoundingClientRect();
|
|
1168
|
+
if (s.x === 0 && s.y === 0) {
|
|
1169
|
+
const i = document.createElement("span");
|
|
1170
|
+
i.appendChild(document.createTextNode("")), r.insertNode(i);
|
|
1171
|
+
const l = i.getBoundingClientRect(), c = i.parentNode;
|
|
1172
|
+
return c == null || c.removeChild(i), c == null || c.normalize(), l;
|
|
1173
|
+
}
|
|
1174
|
+
return s;
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Returns selected text as String
|
|
1178
|
+
* @returns {string}
|
|
1179
|
+
*/
|
|
1180
|
+
static get text() {
|
|
1181
|
+
var e;
|
|
1182
|
+
const t = window.getSelection();
|
|
1183
|
+
return (e = t == null ? void 0 : t.toString()) != null ? e : "";
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Returns window SelectionUtils
|
|
1187
|
+
* {@link https://developer.mozilla.org/ru/docs/Web/API/Window/getSelection}
|
|
1188
|
+
* @returns {Selection}
|
|
1189
|
+
*/
|
|
1190
|
+
static get() {
|
|
1191
|
+
return window.getSelection();
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Set focus to contenteditable or native input element
|
|
1195
|
+
* @param element - element where to set focus
|
|
1196
|
+
* @param offset - offset of cursor
|
|
1197
|
+
*/
|
|
1198
|
+
static setCursor(t, e = 0) {
|
|
1199
|
+
const n = document.createRange(), r = window.getSelection(), s = g.isNativeInput(t);
|
|
1200
|
+
if (s && !g.canSetCaret(t))
|
|
1201
|
+
return t.getBoundingClientRect();
|
|
1202
|
+
if (s) {
|
|
1203
|
+
const i = t;
|
|
1204
|
+
return i.focus(), i.selectionStart = e, i.selectionEnd = e, i.getBoundingClientRect();
|
|
1205
|
+
}
|
|
1206
|
+
return n.setStart(t, e), n.setEnd(t, e), r ? (r.removeAllRanges(), r.addRange(n), n.getBoundingClientRect()) : t.getBoundingClientRect();
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Check if current range exists and belongs to container
|
|
1210
|
+
* @param container - where range should be
|
|
1211
|
+
*/
|
|
1212
|
+
static isRangeInsideContainer(t) {
|
|
1213
|
+
const e = v.range;
|
|
1214
|
+
return e === null ? !1 : t.contains(e.startContainer);
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Adds fake cursor to the current range
|
|
1218
|
+
*/
|
|
1219
|
+
static addFakeCursor() {
|
|
1220
|
+
const t = v.range;
|
|
1221
|
+
if (t === null)
|
|
1222
|
+
return;
|
|
1223
|
+
const e = g.make("span");
|
|
1224
|
+
e.setAttribute(E.fakeCursor, ""), e.setAttribute("data-blok-mutation-free", "true"), t.collapse(), t.insertNode(e);
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Check if passed element contains a fake cursor
|
|
1228
|
+
* @param el - where to check
|
|
1229
|
+
*/
|
|
1230
|
+
static isFakeCursorInsideContainer(t) {
|
|
1231
|
+
return g.find(t, R(E.fakeCursor)) !== null;
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Removes fake cursor from a container
|
|
1235
|
+
* @param container - container to look for
|
|
1236
|
+
*/
|
|
1237
|
+
static removeFakeCursor(t = document.body) {
|
|
1238
|
+
const e = g.find(t, R(E.fakeCursor));
|
|
1239
|
+
e && e.remove();
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Removes fake background
|
|
1243
|
+
* Unwraps the highlight spans and restores the selection
|
|
1244
|
+
*/
|
|
1245
|
+
removeFakeBackground() {
|
|
1246
|
+
this.removeOrphanedFakeBackgroundElements(), this.isFakeBackgroundEnabled && (this.removeHighlightSpans(), this.isFakeBackgroundEnabled = !1);
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Removes highlight spans and reconstructs the saved selection range
|
|
1250
|
+
*/
|
|
1251
|
+
removeHighlightSpans() {
|
|
1252
|
+
var i;
|
|
1253
|
+
const t = document.querySelectorAll('[data-blok-fake-background="true"]');
|
|
1254
|
+
if (t.length === 0)
|
|
1255
|
+
return;
|
|
1256
|
+
const e = t[0], n = t[t.length - 1], r = e.firstChild, s = n.lastChild;
|
|
1257
|
+
if (t.forEach((l) => {
|
|
1258
|
+
this.unwrapFakeBackground(l);
|
|
1259
|
+
}), r && s) {
|
|
1260
|
+
const l = document.createRange();
|
|
1261
|
+
l.setStart(r, 0), l.setEnd(s, ((i = s.textContent) == null ? void 0 : i.length) || 0), this.savedSelectionRange = l;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Removes any fake background elements from the DOM that are not tracked
|
|
1266
|
+
* This handles cleanup after undo/redo operations that may restore fake background elements
|
|
1267
|
+
* Also provides backwards compatibility with old fake background approach
|
|
1268
|
+
*/
|
|
1269
|
+
removeOrphanedFakeBackgroundElements() {
|
|
1270
|
+
document.querySelectorAll('[data-blok-fake-background="true"]').forEach((e) => {
|
|
1271
|
+
this.unwrapFakeBackground(e);
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Clears all fake background state - both DOM elements and internal flags
|
|
1276
|
+
* This is useful for cleanup after undo/redo operations or when the selection context has been lost
|
|
1277
|
+
*/
|
|
1278
|
+
clearFakeBackground() {
|
|
1279
|
+
this.removeOrphanedFakeBackgroundElements(), this.isFakeBackgroundEnabled = !1;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Sets fake background by wrapping selected text in highlight spans
|
|
1283
|
+
* Uses a gray background color to simulate the "unfocused selection" appearance
|
|
1284
|
+
* similar to how Notion shows selections when focus moves to another element
|
|
1285
|
+
*/
|
|
1286
|
+
setFakeBackground() {
|
|
1287
|
+
this.removeFakeBackground();
|
|
1288
|
+
const t = window.getSelection();
|
|
1289
|
+
if (!t || t.rangeCount === 0)
|
|
1290
|
+
return;
|
|
1291
|
+
const e = t.getRangeAt(0);
|
|
1292
|
+
if (e.collapsed)
|
|
1293
|
+
return;
|
|
1294
|
+
const n = this.collectTextNodes(e);
|
|
1295
|
+
if (n.length === 0)
|
|
1296
|
+
return;
|
|
1297
|
+
const r = e.startContainer, s = e.startOffset, i = e.endContainer, l = e.endOffset, c = [];
|
|
1298
|
+
if (n.forEach((p) => {
|
|
1299
|
+
var S, j;
|
|
1300
|
+
const h = document.createRange(), f = p === r, y = p === i, b = f ? s : 0, k = (j = (S = p.textContent) == null ? void 0 : S.length) != null ? j : 0, w = y ? l : k;
|
|
1301
|
+
if (b === w)
|
|
1302
|
+
return;
|
|
1303
|
+
h.setStart(p, b), h.setEnd(p, w);
|
|
1304
|
+
const C = this.wrapRangeWithHighlight(h);
|
|
1305
|
+
C && c.push(C);
|
|
1306
|
+
}), c.length === 0)
|
|
1307
|
+
return;
|
|
1308
|
+
const a = this.postProcessHighlightWrappers(c);
|
|
1309
|
+
this.applyLineHeightExtensions(a);
|
|
1310
|
+
const d = document.createRange();
|
|
1311
|
+
d.setStartBefore(a[0]), d.setEndAfter(a[a.length - 1]), this.savedSelectionRange = d.cloneRange();
|
|
1312
|
+
const u = window.getSelection();
|
|
1313
|
+
u && (u.removeAllRanges(), u.addRange(d)), this.isFakeBackgroundEnabled = !0;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Collects text nodes that intersect with the passed range
|
|
1317
|
+
* @param range - selection range
|
|
1318
|
+
*/
|
|
1319
|
+
collectTextNodes(t) {
|
|
1320
|
+
const e = [], { commonAncestorContainer: n } = t;
|
|
1321
|
+
if (n.nodeType === Node.TEXT_NODE)
|
|
1322
|
+
return e.push(n), e;
|
|
1323
|
+
const r = document.createTreeWalker(
|
|
1324
|
+
n,
|
|
1325
|
+
NodeFilter.SHOW_TEXT,
|
|
1326
|
+
{
|
|
1327
|
+
acceptNode: (s) => t.intersectsNode(s) && s.textContent && s.textContent.length > 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
|
1328
|
+
}
|
|
1329
|
+
);
|
|
1330
|
+
for (; r.nextNode(); )
|
|
1331
|
+
e.push(r.currentNode);
|
|
1332
|
+
return e;
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* Wraps passed range with a highlight span styled like an unfocused selection (gray)
|
|
1336
|
+
* @param range - range to wrap
|
|
1337
|
+
*/
|
|
1338
|
+
wrapRangeWithHighlight(t) {
|
|
1339
|
+
if (t.collapsed)
|
|
1340
|
+
return null;
|
|
1341
|
+
const e = g.make("span");
|
|
1342
|
+
e.setAttribute("data-blok-testid", "fake-background"), e.setAttribute("data-blok-fake-background", "true"), e.setAttribute("data-blok-mutation-free", "true"), e.style.color = "inherit", e.style.boxDecorationBreak = "clone", e.style["-webkit-box-decoration-break"] = "clone", e.style.whiteSpace = "pre-wrap";
|
|
1343
|
+
const n = t.extractContents();
|
|
1344
|
+
return n.childNodes.length === 0 ? null : (e.appendChild(n), t.insertNode(e), e);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Post-processes highlight wrappers to split multi-line spans and apply proper styling
|
|
1348
|
+
* @param wrappers - array of wrapper elements
|
|
1349
|
+
* @returns array of all wrapper elements (may be more than input if splits occurred)
|
|
1350
|
+
*/
|
|
1351
|
+
postProcessHighlightWrappers(t) {
|
|
1352
|
+
const e = [];
|
|
1353
|
+
return t.forEach((n) => {
|
|
1354
|
+
const r = this.splitMultiLineWrapper(n);
|
|
1355
|
+
e.push(...r);
|
|
1356
|
+
}), e;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Splits a multi-line wrapper into separate spans per line and applies box-shadow to each
|
|
1360
|
+
* This ensures gaps between lines are properly filled
|
|
1361
|
+
* @param wrapper - the highlight wrapper element
|
|
1362
|
+
* @returns array of wrapper elements (original if single line, or new per-line wrappers)
|
|
1363
|
+
*/
|
|
1364
|
+
splitMultiLineWrapper(t) {
|
|
1365
|
+
const e = t.getClientRects();
|
|
1366
|
+
if (e.length <= 1)
|
|
1367
|
+
return this.applyBoxShadowToWrapper(t), [t];
|
|
1368
|
+
const n = t.textContent || "", r = t.parentNode;
|
|
1369
|
+
if (!r || !n)
|
|
1370
|
+
return this.applyBoxShadowToWrapper(t), [t];
|
|
1371
|
+
const s = [], i = t.firstChild;
|
|
1372
|
+
if (!i || i.nodeType !== Node.TEXT_NODE)
|
|
1373
|
+
return this.applyBoxShadowToWrapper(t), [t];
|
|
1374
|
+
const l = this.findLineBreakPositions(i, e.length);
|
|
1375
|
+
if (l.length === 0)
|
|
1376
|
+
return this.applyBoxShadowToWrapper(t), [t];
|
|
1377
|
+
const c = this.splitTextAtPositions(n, l), a = document.createDocumentFragment();
|
|
1378
|
+
return c.forEach((d) => {
|
|
1379
|
+
if (d.length === 0)
|
|
1380
|
+
return;
|
|
1381
|
+
const u = g.make("span");
|
|
1382
|
+
u.setAttribute("data-blok-testid", "fake-background"), u.setAttribute("data-blok-fake-background", "true"), u.setAttribute("data-blok-mutation-free", "true"), u.style.color = "inherit", u.style.boxDecorationBreak = "clone", u.style["-webkit-box-decoration-break"] = "clone", u.style.whiteSpace = "pre-wrap", u.textContent = d, a.appendChild(u), s.push(u);
|
|
1383
|
+
}), r.replaceChild(a, t), s;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Splits text content at given positions
|
|
1387
|
+
*/
|
|
1388
|
+
splitTextAtPositions(t, e) {
|
|
1389
|
+
const n = [0, ...e, t.length];
|
|
1390
|
+
return n.slice(0, -1).map((r, s) => t.substring(r, n[s + 1])).filter((r) => r.length > 0);
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Finds positions in text where line breaks occur
|
|
1394
|
+
* @param textNode - the text node to analyze
|
|
1395
|
+
* @param expectedLines - expected number of lines
|
|
1396
|
+
*/
|
|
1397
|
+
findLineBreakPositions(t, e) {
|
|
1398
|
+
const n = t.textContent || "", r = document.createRange();
|
|
1399
|
+
return Array.from({ length: n.length }, (l, c) => c).reduce(
|
|
1400
|
+
(l, c) => {
|
|
1401
|
+
if (l.positions.length >= e - 1)
|
|
1402
|
+
return l;
|
|
1403
|
+
r.setStart(t, c), r.setEnd(t, c + 1);
|
|
1404
|
+
const a = r.getBoundingClientRect();
|
|
1405
|
+
return l.lastTop !== -1 && Math.abs(a.top - l.lastTop) > 5 && l.positions.push(c), { positions: l.positions, lastTop: a.top };
|
|
1406
|
+
},
|
|
1407
|
+
{ positions: [], lastTop: -1 }
|
|
1408
|
+
).positions;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Applies box-shadow to a wrapper to extend the background to fill line-height
|
|
1412
|
+
* @param wrapper - the wrapper element
|
|
1413
|
+
*/
|
|
1414
|
+
applyBoxShadowToWrapper(t) {
|
|
1415
|
+
const e = t.parentElement;
|
|
1416
|
+
if (!e)
|
|
1417
|
+
return;
|
|
1418
|
+
const n = window.getComputedStyle(e), r = window.getComputedStyle(t), s = parseFloat(n.lineHeight), i = parseFloat(r.fontSize), l = isNaN(s) ? i * 1.2 : s, c = t.getBoundingClientRect(), a = Math.max(0, (l - c.height) / 2);
|
|
1419
|
+
if (a > 0) {
|
|
1420
|
+
const d = "rgba(0, 0, 0, 0.08)";
|
|
1421
|
+
t.style.boxShadow = `0 ${a}px 0 ${d}, 0 -${a}px 0 ${d}`;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Applies additional box-shadow extensions to fill gaps between separate spans
|
|
1426
|
+
* This is only needed when there are multiple spans that may have gaps between them
|
|
1427
|
+
* @param spans - array of highlight span elements
|
|
1428
|
+
*/
|
|
1429
|
+
applyLineHeightExtensions(t) {
|
|
1430
|
+
const e = "rgba(0, 0, 0, 0.08)", n = this.collectAllLineRects(t);
|
|
1431
|
+
if (n.length === 0)
|
|
1432
|
+
return;
|
|
1433
|
+
n.sort((s, i) => s.top - i.top);
|
|
1434
|
+
const r = this.groupRectsByLine(n);
|
|
1435
|
+
t.forEach((s) => {
|
|
1436
|
+
this.applyMultiLineBoxShadow(s, r, e);
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Collects all line rectangles from all spans using getClientRects()
|
|
1441
|
+
*/
|
|
1442
|
+
collectAllLineRects(t) {
|
|
1443
|
+
const e = [];
|
|
1444
|
+
return t.forEach((n) => {
|
|
1445
|
+
const r = n.getClientRects();
|
|
1446
|
+
Array.from(r).forEach((s) => {
|
|
1447
|
+
e.push({
|
|
1448
|
+
top: s.top,
|
|
1449
|
+
bottom: s.bottom,
|
|
1450
|
+
span: n
|
|
1451
|
+
});
|
|
1452
|
+
});
|
|
1453
|
+
}), e;
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Groups rectangles by their visual line
|
|
1457
|
+
*/
|
|
1458
|
+
groupRectsByLine(t) {
|
|
1459
|
+
const e = [];
|
|
1460
|
+
return t.forEach((n) => {
|
|
1461
|
+
const r = e.find((s) => Math.abs(s.top - n.top) < 2);
|
|
1462
|
+
r ? (r.top = Math.min(r.top, n.top), r.bottom = Math.max(r.bottom, n.bottom)) : e.push({ top: n.top, bottom: n.bottom });
|
|
1463
|
+
}), e.sort((n, r) => n.top - r.top), e;
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Applies box-shadow to a span that may span multiple lines
|
|
1467
|
+
* Calculates extensions based on the span's position within the overall selection
|
|
1468
|
+
*/
|
|
1469
|
+
applyMultiLineBoxShadow(t, e, n) {
|
|
1470
|
+
const r = t.getClientRects();
|
|
1471
|
+
if (r.length === 0)
|
|
1472
|
+
return;
|
|
1473
|
+
const s = t.parentElement;
|
|
1474
|
+
if (!s)
|
|
1475
|
+
return;
|
|
1476
|
+
const i = window.getComputedStyle(s), l = parseFloat(i.lineHeight), c = parseFloat(window.getComputedStyle(t).fontSize), a = isNaN(l) ? c * 1.2 : l, d = r[0], u = r[r.length - 1], p = this.findLineIndex(d.top, e), h = this.findLineIndex(u.top, e), f = r.length > 1 && p !== h, y = p === 0, b = h === e.length - 1, k = Math.max(0, (a - d.height) / 2), w = f ? this.calculateLineTopExtension(k, y, e, p) : k, C = f ? this.calculateLineBottomExtension(k, b, e, h) : k, S = this.buildBoxShadow(w, C, n);
|
|
1477
|
+
t.style.boxShadow = S;
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Finds the line index for a given top position
|
|
1481
|
+
*/
|
|
1482
|
+
findLineIndex(t, e) {
|
|
1483
|
+
const n = e.findIndex((r) => Math.abs(r.top - t) < 5);
|
|
1484
|
+
return n >= 0 ? n : 0;
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Calculates top extension for a line
|
|
1488
|
+
* Only uses base extension - gaps are filled by the previous line's bottom extension
|
|
1489
|
+
*/
|
|
1490
|
+
calculateLineTopExtension(t, e, n, r) {
|
|
1491
|
+
return t;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Calculates bottom extension for a line, accounting for gap to next line
|
|
1495
|
+
* The bottom extension fills the gap up to where the next line's top extension begins
|
|
1496
|
+
* This prevents overlap: line N's bottom shadow meets line N+1's top shadow exactly
|
|
1497
|
+
*/
|
|
1498
|
+
calculateLineBottomExtension(t, e, n, r) {
|
|
1499
|
+
if (e)
|
|
1500
|
+
return t;
|
|
1501
|
+
const s = n[r], l = n[r + 1].top - s.bottom, a = Math.max(0, l - t);
|
|
1502
|
+
return t + a;
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Builds box-shadow CSS value from top and bottom extensions
|
|
1506
|
+
* Uses inset shadow for the element's own background (to avoid using background-color)
|
|
1507
|
+
* and regular shadows for vertical extensions
|
|
1508
|
+
*/
|
|
1509
|
+
buildBoxShadow(t, e, n) {
|
|
1510
|
+
const r = [];
|
|
1511
|
+
return r.push(`inset 0 0 0 9999px ${n}`), e > 0 && r.push(`0 ${e}px 0 ${n}`), t > 0 && r.push(`0 -${t}px 0 ${n}`), r.join(", ");
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Removes fake background wrapper (legacy support)
|
|
1515
|
+
* @param element - wrapper element
|
|
1516
|
+
*/
|
|
1517
|
+
unwrapFakeBackground(t) {
|
|
1518
|
+
const e = t.parentNode;
|
|
1519
|
+
if (e) {
|
|
1520
|
+
for (; t.firstChild; )
|
|
1521
|
+
e.insertBefore(t.firstChild, t);
|
|
1522
|
+
e.removeChild(t);
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Save SelectionUtils's range
|
|
1527
|
+
*/
|
|
1528
|
+
save() {
|
|
1529
|
+
this.savedSelectionRange = v.range;
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Restore saved SelectionUtils's range
|
|
1533
|
+
*/
|
|
1534
|
+
restore() {
|
|
1535
|
+
if (!this.savedSelectionRange)
|
|
1536
|
+
return;
|
|
1537
|
+
const t = window.getSelection();
|
|
1538
|
+
t && (t.removeAllRanges(), t.addRange(this.savedSelectionRange));
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Clears saved selection
|
|
1542
|
+
*/
|
|
1543
|
+
clearSaved() {
|
|
1544
|
+
this.savedSelectionRange = null;
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Collapse current selection
|
|
1548
|
+
*/
|
|
1549
|
+
collapseToEnd() {
|
|
1550
|
+
const t = window.getSelection();
|
|
1551
|
+
if (!t || !t.focusNode)
|
|
1552
|
+
return;
|
|
1553
|
+
const e = document.createRange();
|
|
1554
|
+
e.selectNodeContents(t.focusNode), e.collapse(!1), t.removeAllRanges(), t.addRange(e);
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Looks ahead to find passed tag from current selection
|
|
1558
|
+
* @param {string} tagName - tag to found
|
|
1559
|
+
* @param {string} [className] - tag's class name
|
|
1560
|
+
* @param {number} [searchDepth] - count of tags that can be included. For better performance.
|
|
1561
|
+
* @returns {HTMLElement|null}
|
|
1562
|
+
*/
|
|
1563
|
+
findParentTag(t, e, n = 10) {
|
|
1564
|
+
const r = window.getSelection();
|
|
1565
|
+
if (!r || !r.anchorNode || !r.focusNode)
|
|
1566
|
+
return null;
|
|
1567
|
+
const s = [
|
|
1568
|
+
/** the Node in which the selection begins */
|
|
1569
|
+
r.anchorNode,
|
|
1570
|
+
/** the Node in which the selection ends */
|
|
1571
|
+
r.focusNode
|
|
1572
|
+
], i = (l) => {
|
|
1573
|
+
const c = (a, d) => {
|
|
1574
|
+
if (d <= 0 || !a)
|
|
1575
|
+
return null;
|
|
1576
|
+
const u = a.nodeType === Node.ELEMENT_NODE && a.tagName === t, p = !e || a.classList && a.classList.contains(e);
|
|
1577
|
+
if (u && p)
|
|
1578
|
+
return a;
|
|
1579
|
+
if (!a.parentNode)
|
|
1580
|
+
return null;
|
|
1581
|
+
const h = a.parentNode, f = !e || h.classList && h.classList.contains(e);
|
|
1582
|
+
return h.tagName === t && f ? h : c(h, d - 1);
|
|
1583
|
+
};
|
|
1584
|
+
return c(l, n);
|
|
1585
|
+
};
|
|
1586
|
+
for (const l of s) {
|
|
1587
|
+
const c = i(l);
|
|
1588
|
+
if (c)
|
|
1589
|
+
return c;
|
|
1590
|
+
}
|
|
1591
|
+
return null;
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Expands selection range to the passed parent node
|
|
1595
|
+
* @param {HTMLElement} element - element which contents should be selected
|
|
1596
|
+
*/
|
|
1597
|
+
expandToTag(t) {
|
|
1598
|
+
const e = window.getSelection();
|
|
1599
|
+
if (!e)
|
|
1600
|
+
return;
|
|
1601
|
+
e.removeAllRanges();
|
|
1602
|
+
const n = document.createRange();
|
|
1603
|
+
n.selectNodeContents(t), e.addRange(n);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
const A = (o, t) => {
|
|
1607
|
+
if (!o.conversionConfig)
|
|
1608
|
+
return !1;
|
|
1609
|
+
const e = o.conversionConfig[t];
|
|
1610
|
+
return F(e) || x(e);
|
|
1611
|
+
}, T = (o, t) => {
|
|
1612
|
+
const e = t.includes(".") ? t : `toolNames.${t}`;
|
|
1613
|
+
return o.has(e) ? o.t(e) : void 0;
|
|
1614
|
+
}, D = (o, t, e = "") => {
|
|
1615
|
+
const n = t.titleKey ? T(o, t.titleKey) : void 0;
|
|
1616
|
+
if (n !== void 0)
|
|
1617
|
+
return n;
|
|
1618
|
+
const r = t.title ? T(o, t.title) : void 0;
|
|
1619
|
+
if (r !== void 0)
|
|
1620
|
+
return r;
|
|
1621
|
+
if (t.title)
|
|
1622
|
+
return t.title;
|
|
1623
|
+
const s = e ? T(o, e) : void 0;
|
|
1624
|
+
return s != null ? s : e;
|
|
1625
|
+
}, kt = (o, t, e) => {
|
|
1626
|
+
const n = t ? T(o, t) : void 0;
|
|
1627
|
+
if (n !== void 0)
|
|
1628
|
+
return n;
|
|
1629
|
+
const r = T(o, e);
|
|
1630
|
+
return r != null ? r : e;
|
|
1631
|
+
}, _ = (o, t) => A(o.tool, t), bt = (o, t) => Object.entries(o).some((([e, n]) => t[e] && H(t[e], n))), q = async (o, t) => {
|
|
1632
|
+
const n = (await o.save()).data, r = t.find((s) => s.name === o.name);
|
|
1633
|
+
return r !== void 0 && !A(r, "export") ? [] : t.reduce((s, i) => {
|
|
1634
|
+
if (!A(i, "import") || i.toolbox === void 0)
|
|
1635
|
+
return s;
|
|
1636
|
+
const l = i.toolbox.filter((c) => {
|
|
1637
|
+
if (z(c) || c.icon === void 0)
|
|
1638
|
+
return !1;
|
|
1639
|
+
const a = c.data !== void 0;
|
|
1640
|
+
return !(a && bt(c.data, n) || !a && i.name === o.name);
|
|
1641
|
+
});
|
|
1642
|
+
return s.push(O(I({}, i), {
|
|
1643
|
+
toolbox: l
|
|
1644
|
+
})), s;
|
|
1645
|
+
}, []);
|
|
1646
|
+
}, Kt = (o, t) => o.mergeable ? o.name === t.name ? !0 : _(t, "export") && _(o, "import") : !1, Jt = async (o, t) => {
|
|
1647
|
+
if (o.length === 0)
|
|
1648
|
+
return [];
|
|
1649
|
+
if (o.length === 1)
|
|
1650
|
+
return q(o[0], t);
|
|
1651
|
+
for (const n of o) {
|
|
1652
|
+
const r = t.find((s) => s.name === n.name);
|
|
1653
|
+
if (r !== void 0 && !A(r, "export"))
|
|
1654
|
+
return [];
|
|
1655
|
+
}
|
|
1656
|
+
const e = new Set(o.map((n) => n.name));
|
|
1657
|
+
return t.reduce((n, r) => {
|
|
1658
|
+
if (!A(r, "import") || r.toolbox === void 0)
|
|
1659
|
+
return n;
|
|
1660
|
+
const s = r.toolbox.filter((i) => !(z(i) || i.icon === void 0 || !(i.data !== void 0) && e.size === 1 && e.has(r.name)));
|
|
1661
|
+
return s.length > 0 && n.push(O(I({}, r), {
|
|
1662
|
+
toolbox: s
|
|
1663
|
+
})), n;
|
|
1664
|
+
}, []);
|
|
1665
|
+
}, Yt = (o, t) => {
|
|
1666
|
+
const e = t == null ? void 0 : t.export;
|
|
1667
|
+
return F(e) ? e(o) : x(e) ? o[e] : (e !== void 0 && M("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."), "");
|
|
1668
|
+
}, Qt = (o, t, e) => {
|
|
1669
|
+
const n = t == null ? void 0 : t.import;
|
|
1670
|
+
return F(n) ? n(o, e) : x(n) ? {
|
|
1671
|
+
[n]: o
|
|
1672
|
+
} : (n !== void 0 && M("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."), {});
|
|
1673
|
+
};
|
|
1674
|
+
var vt = /* @__PURE__ */ ((o) => (o.Default = "default", o.Separator = "separator", o.Html = "html", o))(vt || {});
|
|
1675
|
+
const te = `
|
|
1676
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1677
|
+
<path d="m4.5 15 11-11m0 11L4.5 4" stroke="currentColor" stroke-linecap="round"/>
|
|
1678
|
+
</svg>
|
|
1679
|
+
`, ee = `
|
|
1680
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1681
|
+
<path
|
|
1682
|
+
d="M5.5 11h4.9231c.6528 0 1.2789-.3161 1.7405-.8787.4617-.56259.721-1.32565.721-2.1213 0-.79565-.2593-1.55871-.721-2.12132C11.702 5.31607 11.0759 5 10.4231 5H5.5v6Zm0 0h5.5385c.6528 0 1.2789.3161 1.7405.8787.4617.5626.721 1.3257.721 2.1213 0 .7956-.2593 1.5587-.721 2.1213-.4616.5626-1.0877.8787-1.7405.8787H5.5v-6Z"
|
|
1683
|
+
stroke="currentColor"
|
|
1684
|
+
stroke-width="1.25"
|
|
1685
|
+
stroke-linecap="round"
|
|
1686
|
+
stroke-linejoin="round"
|
|
1687
|
+
/>
|
|
1688
|
+
</svg>
|
|
1689
|
+
`, ne = `
|
|
1690
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1691
|
+
<path
|
|
1692
|
+
d="M8.5 5h6m-10 12h6m1-12-4 12"
|
|
1693
|
+
stroke="currentColor"
|
|
1694
|
+
stroke-linecap="round"
|
|
1695
|
+
stroke-linejoin="round"
|
|
1696
|
+
/>
|
|
1697
|
+
</svg>
|
|
1698
|
+
`, oe = `
|
|
1699
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1700
|
+
<path
|
|
1701
|
+
d="m9.98288 15.0959-.91628.9157c-.29867.3092-.65593.5559-1.05095.7255-.39502.1697-.81987.259-1.24978.2628-.4299.0037-.85625-.0782-1.25415-.241-.39791-.1628-.75941-.4032-1.06341-.7072-.304-.304-.54441-.6655-.70721-1.0634-.16279-.3979-.24471-.8243-.24098-1.2542.00374-.4299.09306-.8547.26274-1.2497.16969-.3951.41635-.7523.72558-1.051l.91499-.9163m8.24197.9156.9163-.9156c.6028-.60809.9402-1.43021.9383-2.28645-.0019-.85625-.3429-1.67688-.9483-2.28234-.6055-.60546-1.4261-.94643-2.2823-.9483-.8563-.00188-1.6784.3355-2.28652.9383l-.91628.91563M7.258 13.2413l4.5328-4.53278"
|
|
1702
|
+
stroke="currentColor"
|
|
1703
|
+
stroke-width=".784151"
|
|
1704
|
+
stroke-linecap="round"
|
|
1705
|
+
stroke-linejoin="round"
|
|
1706
|
+
/>
|
|
1707
|
+
</svg>
|
|
1708
|
+
`, re = `
|
|
1709
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1710
|
+
<path
|
|
1711
|
+
d="M15.5 14.003h-3v-3.0004m-9-6.00078h3v3.0004m1.55478-3.80901A5.2170862 5.2170862 0 0 1 9.5 4.00014c1.1682.00058 2.3059.37321 3.2481 1.06388.9422.69067 1.64 1.66348 1.9923 2.77744.3523 1.11396.3407 2.31114-.033 3.41814-.3738 1.1069-1.0903 2.0661-2.0457 2.7384m-1.7165.8088c-.4703.1317-.9568.1967-1.4452.1931-1.16819-.0006-2.30585-.3733-3.24807-1.0639-.94222-.6907-1.64004-1.6635-1.99232-2.7775-.35229-1.1139-.34072-2.31114.03302-3.41808.37375-1.10694 1.09024-2.06608 2.04563-2.73841"
|
|
1712
|
+
stroke="currentColor"
|
|
1713
|
+
stroke-miterlimit="10"
|
|
1714
|
+
stroke-linecap="round"
|
|
1715
|
+
/>
|
|
1716
|
+
</svg>
|
|
1717
|
+
`, se = `
|
|
1718
|
+
<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1719
|
+
<path
|
|
1720
|
+
d="M8 6c0-.55228.44772-1 1-1s1 .44772 1 1-.44772 1-1 1-1-.44772-1-1Zm0 6c0-.5523.44772-1 1-1s1 .4477 1 1-.44772 1-1 1-1-.4477-1-1Zm0 6c0-.5523.44772-1 1-1s1 .4477 1 1-.44772 1-1 1-1-.4477-1-1Zm6-12c0-.55228.4477-1 1-1s1 .44772 1 1-.4477 1-1 1-1-.44772-1-1Zm0 6c0-.5523.4477-1 1-1s1 .4477 1 1-.4477 1-1 1-1-.4477-1-1Zm0 6c0-.5523.4477-1 1-1s1 .4477 1 1-.4477 1-1 1-1-.4477-1-1Z"
|
|
1721
|
+
fill="currentColor"
|
|
1722
|
+
/>
|
|
1723
|
+
</svg>
|
|
1724
|
+
`, ie = `
|
|
1725
|
+
<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1726
|
+
<path d="M4.5 11.0711h14.1421m-7.071 7.071V4" stroke="currentColor" stroke-linecap="round"/>
|
|
1727
|
+
</svg>
|
|
1728
|
+
`, ae = `
|
|
1729
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1730
|
+
<path d="m12.5 5-5 5 5 5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1731
|
+
</svg>
|
|
1732
|
+
`, le = `
|
|
1733
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1734
|
+
<path d="m7.5 15 5-5-5-5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1735
|
+
</svg>
|
|
1736
|
+
`, ce = `
|
|
1737
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1738
|
+
<path
|
|
1739
|
+
d="m17.5 17.5-5-5m1.6667-4.16667c0 .76605-.1509 1.52459-.4441 2.23237-.2931.7077-.7228 1.3507-1.2645 1.8924-.5417.5417-1.1847.9714-1.8924 1.2645-.70778.2932-1.46632.4441-2.23237.4441-.76604 0-1.52458-.1509-2.23232-.4441-.70773-.2931-1.35079-.7228-1.89247-1.2645-.54167-.5417-.97135-1.1847-1.2645-1.8924C2.65088 9.85792 2.5 9.09938 2.5 8.33333c0-1.54709.61458-3.03082 1.70854-4.12479C5.30251 3.11458 6.78624 2.5 8.33333 2.5c1.5471 0 3.03087.61458 4.12477 1.70854 1.094 1.09397 1.7086 2.5777 1.7086 4.12479Z"
|
|
1740
|
+
stroke="currentColor"
|
|
1741
|
+
stroke-linecap="round"
|
|
1742
|
+
stroke-linejoin="round"
|
|
1743
|
+
/>
|
|
1744
|
+
</svg>
|
|
1745
|
+
`, de = `
|
|
1746
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1747
|
+
<path
|
|
1748
|
+
d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.1667 5 2.5-1.66667V15"
|
|
1749
|
+
stroke="currentColor"
|
|
1750
|
+
stroke-linecap="round"
|
|
1751
|
+
stroke-linejoin="round"
|
|
1752
|
+
/>
|
|
1753
|
+
</svg>
|
|
1754
|
+
`, ue = `
|
|
1755
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1756
|
+
<path
|
|
1757
|
+
d="M3.33334 10H10m-6.66666 5V5M10 15V5m7.5 10h-3.3333c0-3.3333 3.3333-2.5 3.3333-5 0-1.25-1.6667-2.08333-3.3333-.83333"
|
|
1758
|
+
stroke="currentColor"
|
|
1759
|
+
stroke-linecap="round"
|
|
1760
|
+
stroke-linejoin="round"
|
|
1761
|
+
/>
|
|
1762
|
+
</svg>
|
|
1763
|
+
`, pe = `
|
|
1764
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1765
|
+
<path
|
|
1766
|
+
d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.5833 3.75C16 7.91667 17.5 8.75 17.5 10c0 .442-.1756.866-.4882 1.1785-.3125.3126-.7364.4882-1.1785.4882.4421 0 .866.1756 1.1785.4881.3126.3126.4882.7365.4882 1.1785 0 1.5-1.6667 2.5-3.3333 1.25"
|
|
1767
|
+
stroke="currentColor"
|
|
1768
|
+
stroke-linecap="round"
|
|
1769
|
+
stroke-linejoin="round"
|
|
1770
|
+
/>
|
|
1771
|
+
</svg>
|
|
1772
|
+
`, ge = `
|
|
1773
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1774
|
+
<path
|
|
1775
|
+
d="M10 15V5M14.1667 8.33333V10.8333C14.1667 11.0543 14.2545 11.2663 14.4107 11.4226C14.567 11.5789 14.779 11.6667 15 11.6667H17.5M17.5 8.33333V15M3.33334 10H10M3.33334 15V5"
|
|
1776
|
+
stroke="black"
|
|
1777
|
+
stroke-linecap="round"
|
|
1778
|
+
stroke-linejoin="round"
|
|
1779
|
+
/>
|
|
1780
|
+
</svg>
|
|
1781
|
+
`, he = `
|
|
1782
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1783
|
+
<path
|
|
1784
|
+
d="M3.33334 10H10M3.33334 15V5M10 15V5M17.5 8.33333H14.1667V10.8333H15.25C16.5 10.8333 17.5 11.75 17.5 12.9167C17.5 14.0833 16.5 15 15.25 15C14.8333 15 14.5 14.9167 14.1667 14.75"
|
|
1785
|
+
stroke="black"
|
|
1786
|
+
stroke-linecap="round"
|
|
1787
|
+
stroke-linejoin="round"
|
|
1788
|
+
/>
|
|
1789
|
+
</svg>
|
|
1790
|
+
`, fe = `
|
|
1791
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1792
|
+
<path
|
|
1793
|
+
d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.1667 8.3333c0 .9205.7462 1.6667 1.6666 1.6667.9205 0 1.6667-.7462 1.6667-1.6667 0-.9204-.7462-1.6666-1.6667-1.6666-.9204 0-1.6666.7462-1.6666 1.6666Zm0 0c0-2.0833.8333-3.3333 2.5-4.99997"
|
|
1794
|
+
stroke="currentColor"
|
|
1795
|
+
stroke-linecap="round"
|
|
1796
|
+
stroke-linejoin="round"
|
|
1797
|
+
/>
|
|
1798
|
+
</svg>
|
|
1799
|
+
`, me = `
|
|
1800
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1801
|
+
<path
|
|
1802
|
+
d="M6.5 10h6.6667M6.5 15V5m6.6667 10V5"
|
|
1803
|
+
stroke="currentColor"
|
|
1804
|
+
stroke-linecap="round"
|
|
1805
|
+
stroke-linejoin="round"
|
|
1806
|
+
/>
|
|
1807
|
+
</svg>
|
|
1808
|
+
`, ke = `
|
|
1809
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1810
|
+
<path
|
|
1811
|
+
d="M14.5 7.28571V6h-9v1.28571M10 6v9m0 0H8.71429M10 15h1.2857"
|
|
1812
|
+
stroke="currentColor"
|
|
1813
|
+
stroke-linecap="round"
|
|
1814
|
+
stroke-linejoin="round"
|
|
1815
|
+
/>
|
|
1816
|
+
</svg>
|
|
1817
|
+
`, be = `
|
|
1818
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1819
|
+
<path
|
|
1820
|
+
d="M18.5667 18H1.5l8.5333-16 8.5334 16Z"
|
|
1821
|
+
stroke="currentColor"
|
|
1822
|
+
stroke-width="1.06667"
|
|
1823
|
+
stroke-linecap="round"
|
|
1824
|
+
stroke-linejoin="round"
|
|
1825
|
+
/>
|
|
1826
|
+
<rect x="9.75" y="14.25" width=".5" height=".5" rx=".25" fill="currentColor" stroke="currentColor" stroke-width=".5"/>
|
|
1827
|
+
<rect x="9.75" y="8.25" width=".5" height="4.5" rx=".25" fill="currentColor" stroke="currentColor" stroke-width=".5"/>
|
|
1828
|
+
</svg>
|
|
1829
|
+
`, ve = `
|
|
1830
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1831
|
+
<path
|
|
1832
|
+
d="M8 5h9M8 10h9M8 15h9M4 5h.01M4 10h.01M4 15h.01"
|
|
1833
|
+
stroke="currentColor"
|
|
1834
|
+
stroke-linecap="round"
|
|
1835
|
+
stroke-linejoin="round"
|
|
1836
|
+
/>
|
|
1837
|
+
</svg>
|
|
1838
|
+
`, we = `
|
|
1839
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1840
|
+
<path d="M7.90873 4.60317h9.61907M4.70238 6.20635V3L3.5 4.20238m1.60317 7.61512H3.5l1.52702-2.37514c.02625-.03721.04486-.07925.05477-.12369.0099-.04444.01091-.09039.00295-.13523-.04569-.2068-.20922-.57233-.78315-.57233-.80159 0-.80159.71261-.80159.71261v.17795m0 7.92693h.80159c.21259 0 .41648-.0845.56681-.2348.15032-.1503.23477-.3542.23477-.5668 0-.2126-.08445-.4165-.23477-.5668-.15033-.1503-.35422-.2348-.56681-.2348h-.4008l1.20238-1.6032H3.5m4.40873-4.0079h9.61907m-9.61907 5.6111h9.61907" stroke="#000" stroke-width=".841667" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1841
|
+
</svg>
|
|
1842
|
+
`, Ce = `
|
|
1843
|
+
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1844
|
+
<path
|
|
1845
|
+
d="M10 5h7M10 10h7M10 15h7M3 5l1 1 2-2M3 10l1 1 2-2M3 15l1 1 2-2"
|
|
1846
|
+
stroke="currentColor"
|
|
1847
|
+
stroke-linecap="round"
|
|
1848
|
+
stroke-linejoin="round"
|
|
1849
|
+
/>
|
|
1850
|
+
</svg>
|
|
1851
|
+
`, G = class G {
|
|
1852
|
+
/**
|
|
1853
|
+
* @param api - Blok API
|
|
1854
|
+
*/
|
|
1855
|
+
constructor({ api: t }) {
|
|
1856
|
+
this.i18nAPI = t.i18n, this.blocksAPI = t.blocks, this.selectionAPI = t.selection, this.toolsAPI = t.tools, this.caretAPI = t.caret, this.i18nInstance = {
|
|
1857
|
+
t: (e, n) => this.i18nAPI.t(e),
|
|
1858
|
+
has: (e) => this.i18nAPI.t(e) !== e
|
|
1859
|
+
};
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Returns tool's UI config
|
|
1863
|
+
*/
|
|
1864
|
+
async render() {
|
|
1865
|
+
const t = v.get();
|
|
1866
|
+
if (t === null)
|
|
1867
|
+
return [];
|
|
1868
|
+
const e = this.blocksAPI.getBlockByElement(t.anchorNode);
|
|
1869
|
+
if (e === void 0)
|
|
1870
|
+
return [];
|
|
1871
|
+
const n = this.toolsAPI.getBlockTools(), r = await q(e, n);
|
|
1872
|
+
if (r.length === 0)
|
|
1873
|
+
return [];
|
|
1874
|
+
const s = r.reduce((a, d) => {
|
|
1875
|
+
var u;
|
|
1876
|
+
return (u = d.toolbox) == null || u.forEach((p) => {
|
|
1877
|
+
var h;
|
|
1878
|
+
p.title !== void 0 && a.push({
|
|
1879
|
+
icon: p.icon,
|
|
1880
|
+
title: D(this.i18nInstance, p, d.name),
|
|
1881
|
+
name: (h = p.name) != null ? h : d.name,
|
|
1882
|
+
closeOnActivate: !0,
|
|
1883
|
+
onActivate: async () => {
|
|
1884
|
+
const f = await this.blocksAPI.convert(e.id, d.name, p.data);
|
|
1885
|
+
this.caretAPI.setToBlock(f, "end");
|
|
1886
|
+
}
|
|
1887
|
+
});
|
|
1888
|
+
}), a;
|
|
1889
|
+
}, []), i = await e.getActiveToolboxEntry(), l = i ? D(this.i18nInstance, i, e.name) : kt(this.i18nInstance, e.name, ct(e.name)), c = !ut();
|
|
1890
|
+
return {
|
|
1891
|
+
name: "convert-to",
|
|
1892
|
+
title: l,
|
|
1893
|
+
hint: {
|
|
1894
|
+
title: this.i18nAPI.t("popover.convertTo")
|
|
1895
|
+
},
|
|
1896
|
+
children: {
|
|
1897
|
+
items: s,
|
|
1898
|
+
onOpen: () => {
|
|
1899
|
+
c && (this.selectionAPI.setFakeBackground(), this.selectionAPI.save());
|
|
1900
|
+
},
|
|
1901
|
+
onClose: () => {
|
|
1902
|
+
c && (this.selectionAPI.restore(), this.selectionAPI.removeFakeBackground());
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
};
|
|
1906
|
+
}
|
|
1907
|
+
};
|
|
1908
|
+
G.isInline = !0;
|
|
1909
|
+
let U = G;
|
|
1910
|
+
export {
|
|
1911
|
+
At as $,
|
|
1912
|
+
D as A,
|
|
1913
|
+
re as B,
|
|
1914
|
+
te as C,
|
|
1915
|
+
E as D,
|
|
1916
|
+
Bt as E,
|
|
1917
|
+
ie as F,
|
|
1918
|
+
lt as G,
|
|
1919
|
+
se as H,
|
|
1920
|
+
le as I,
|
|
1921
|
+
zt as J,
|
|
1922
|
+
kt as K,
|
|
1923
|
+
Pt as L,
|
|
1924
|
+
Kt as M,
|
|
1925
|
+
at as N,
|
|
1926
|
+
_ as O,
|
|
1927
|
+
vt as P,
|
|
1928
|
+
Qt as Q,
|
|
1929
|
+
yt as R,
|
|
1930
|
+
v as S,
|
|
1931
|
+
Xt as T,
|
|
1932
|
+
Ut as U,
|
|
1933
|
+
It as V,
|
|
1934
|
+
St as W,
|
|
1935
|
+
qt as X,
|
|
1936
|
+
Mt as Y,
|
|
1937
|
+
rt as Z,
|
|
1938
|
+
be as _,
|
|
1939
|
+
g as a,
|
|
1940
|
+
U as a0,
|
|
1941
|
+
Rt as a1,
|
|
1942
|
+
Zt as a2,
|
|
1943
|
+
Ot as a3,
|
|
1944
|
+
Ft as a4,
|
|
1945
|
+
dt as a5,
|
|
1946
|
+
_t as a6,
|
|
1947
|
+
ot as a7,
|
|
1948
|
+
Et as a8,
|
|
1949
|
+
jt as a9,
|
|
1950
|
+
ke as aa,
|
|
1951
|
+
me as ab,
|
|
1952
|
+
de as ac,
|
|
1953
|
+
ue as ad,
|
|
1954
|
+
pe as ae,
|
|
1955
|
+
ge as af,
|
|
1956
|
+
he as ag,
|
|
1957
|
+
fe as ah,
|
|
1958
|
+
ve as ai,
|
|
1959
|
+
we as aj,
|
|
1960
|
+
Ce as ak,
|
|
1961
|
+
ee as al,
|
|
1962
|
+
ne as am,
|
|
1963
|
+
oe as an,
|
|
1964
|
+
$t as b,
|
|
1965
|
+
F as c,
|
|
1966
|
+
bt as d,
|
|
1967
|
+
Yt as e,
|
|
1968
|
+
R as f,
|
|
1969
|
+
Ht as g,
|
|
1970
|
+
Vt as h,
|
|
1971
|
+
z as i,
|
|
1972
|
+
ct as j,
|
|
1973
|
+
Tt as k,
|
|
1974
|
+
M as l,
|
|
1975
|
+
L as m,
|
|
1976
|
+
Lt as n,
|
|
1977
|
+
x as o,
|
|
1978
|
+
xt as p,
|
|
1979
|
+
Dt as q,
|
|
1980
|
+
Nt as r,
|
|
1981
|
+
Ct as s,
|
|
1982
|
+
Wt as t,
|
|
1983
|
+
ce as u,
|
|
1984
|
+
ut as v,
|
|
1985
|
+
Gt as w,
|
|
1986
|
+
ae as x,
|
|
1987
|
+
Jt as y,
|
|
1988
|
+
q as z
|
|
1989
|
+
};
|