@ncino/web-components 4.3.0-preview.9 → 5.0.0-preview.10
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/dist/_virtual/_commonjsHelpers.js +1 -1
- package/dist/_virtual/index_html.js +1 -1
- package/dist/_virtual/index_react.js +1 -1
- package/dist/_virtual/preload-helper.js +1 -1
- package/dist/assets/node_modules/.pnpm/ckeditor5@45.2.1/node_modules/ckeditor5/dist/ckeditor5.css +1 -1
- package/dist/components/accordion/gator/base/accordion.gator.figma.js +10 -0
- package/dist/components/accordion/gator/base/accordion.gator.js +11 -9
- package/dist/components/accordion/gator/group/accordion-group.gator.figma.js +3 -0
- package/dist/components/accordion/gator/group/accordion-group.gator.js +2 -2
- package/dist/components/alert/gator/base/alert.gator.js +2 -2
- package/dist/components/alert/gator/subtitle/alert-subtitle.gator.js +2 -2
- package/dist/components/alert/gator/title/alert-title.gator.js +2 -2
- package/dist/components/avatar/gator/avatar.gator.js +5 -5
- package/dist/components/badge/gator/badge.gator.js +2 -2
- package/dist/components/banner/gator/banner.gator.figma.js +8 -0
- package/dist/components/banner/gator/banner.gator.js +6 -5
- package/dist/components/boolean/boolean.gator.figma.js +11 -0
- package/dist/components/boolean/boolean.gator.js +6 -6
- package/dist/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.figma.js +3 -0
- package/dist/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.js +2 -2
- package/dist/components/breadcrumbs/gator/container/breadcrumbs.gator.figma.js +5 -0
- package/dist/components/button/gator/button.gator.js +4 -4
- package/dist/components/button-group/gator/button-group.gator.js +2 -2
- package/dist/components/card/gator/footer/card-footer.gator.js +2 -2
- package/dist/components/card/gator/header/card-header.gator.js +2 -2
- package/dist/components/checkbox/checkbox.gator.js +5 -5
- package/dist/components/checkbox-group/checkbox-group.gator.js +8 -8
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/chip/gator/chip.gator.js +15 -5
- package/dist/components/combobox/base/combobox.js +1 -1
- package/dist/components/combobox/base/combobox.slds.js +13 -13
- package/dist/components/date-picker/base/gator/datepicker.gator.js +18 -18
- package/dist/components/date-picker/year-month-selector/year-month-selector.gator.js +2 -2
- package/dist/components/headline-card/gator/headline-card.gator.js +2 -2
- package/dist/components/icon/gator/icon.gator.js +2 -2
- package/dist/components/illustration/gator/illustration.gator.js +2 -2
- package/dist/components/input/base/input-base.gator.js +1 -1
- package/dist/components/input/gator/dropdown/input-dropdown.gator.js +11 -11
- package/dist/components/input/gator/input-currency/input-currency.gator.js +2 -2
- package/dist/components/input/gator/input-date/input-date.gator.js +15 -15
- package/dist/components/input/gator/input-file/input-file.gator.js +3 -3
- package/dist/components/input/gator/input-masked/input-masked.gator.js +1 -1
- package/dist/components/input/gator/input-phone/input-phone.gator.js +2 -2
- package/dist/components/input/gator/input-search/input-search.gator.js +2 -2
- package/dist/components/input/gator/input-text/input-text.gator.js +1 -1
- package/dist/components/input/gator/input-time/input-time.gator.js +2 -2
- package/dist/components/list/gator/list/list.gator.js +2 -2
- package/dist/components/list/gator/list-item/list-item.gator.js +6 -6
- package/dist/components/menu/base/gator/menu.gator.js +3 -3
- package/dist/components/menu/base/slds/menu.slds.js +2 -2
- package/dist/components/menu/menu-item/gator/menu-item.gator.js +2 -2
- package/dist/components/menu/menu-submenu/menu-submenu.js +1 -1
- package/dist/components/modal/gator/modal.gator.js +38 -39
- package/dist/components/page-header/gator/page-header.gator.js +2 -2
- package/dist/components/panel/gator/panel.gator.js +13 -13
- package/dist/components/panel/gator/panel.storybook-test.js +1 -1
- package/dist/components/pill/pill.slds.js +3 -3
- package/dist/components/popover/gator/popover.gator.js +10 -10
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/radio/radio.gator.js +2 -2
- package/dist/components/radio-group/radio-group.gator.js +2 -2
- package/dist/components/selection-box-group/selection-box-group.gator.js +5 -5
- package/dist/components/selector/gator/selector.gator.js +2 -2
- package/dist/components/switch/gator/switch.gator.js +2 -2
- package/dist/components/table/gator/table-bulk-controls/table-bulk-controls.gator.js +16 -0
- package/dist/components/table/gator/table.gator.js +55 -36
- package/dist/components/tabs/gator/tabset/tabset.gator.js +3 -3
- package/dist/components/text-detail/gator/text-detail.gator.figma.js +30 -0
- package/dist/components/text-detail/gator/text-detail.gator.js +17 -18
- package/dist/components/time-picker/gator/time-picker.gator.js +19 -19
- package/dist/components/toast/gator/base/toast.gator.js +8 -9
- package/dist/components/toast/gator/subtitle/toast-subtitle.gator.js +2 -2
- package/dist/components/toast/gator/title/toast-title.gator.js +2 -2
- package/dist/components/toast/toast.js +1 -1
- package/dist/components/toast-container/gator/toast-container.gator.js +18 -0
- package/dist/components/toast-container/index.js +1 -0
- package/dist/components/toaster/gator/toaster.gator.js +5 -0
- package/dist/components/toaster/index.js +1 -0
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/index.gator.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.services.js +1 -0
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-autosave@45.2.1/node_modules/@ckeditor/ckeditor5-autosave/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-basic-styles@45.2.1/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-clipboard@45.2.1/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +10 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-cloud-services@45.2.1/node_modules/@ckeditor/ckeditor5-cloud-services/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-code-block@45.2.1/node_modules/@ckeditor/ckeditor5-code-block/dist/index.js +5 -5
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-editor-classic@45.2.1/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +12 -12
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-find-and-replace@45.2.1/node_modules/@ckeditor/ckeditor5-find-and-replace/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-font@45.2.1/node_modules/@ckeditor/ckeditor5-font/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-heading@45.2.1/node_modules/@ckeditor/ckeditor5-heading/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-embed@45.2.1/node_modules/@ckeditor/ckeditor5-html-embed/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-html-support@45.2.1/node_modules/@ckeditor/ckeditor5-html-support/dist/index.js +6 -6
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-image@45.2.1/node_modules/@ckeditor/ckeditor5-image/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-indent@45.2.1/node_modules/@ckeditor/ckeditor5-indent/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-link@45.2.1/node_modules/@ckeditor/ckeditor5-link/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-list@45.2.1/node_modules/@ckeditor/ckeditor5-list/dist/index.js +5 -5
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-markdown-gfm@45.2.1/node_modules/@ckeditor/ckeditor5-markdown-gfm/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-media-embed@45.2.1/node_modules/@ckeditor/ckeditor5-media-embed/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paragraph@45.2.1/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-paste-from-office@45.2.1/node_modules/@ckeditor/ckeditor5-paste-from-office/dist/index.js +9 -9
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-source-editing@45.2.1/node_modules/@ckeditor/ckeditor5-source-editing/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-special-characters@45.2.1/node_modules/@ckeditor/ckeditor5-special-characters/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-style@45.2.1/node_modules/@ckeditor/ckeditor5-style/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-table@45.2.1/node_modules/@ckeditor/ckeditor5-table/dist/index.js +6 -6
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +4 -4
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +10 -10
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-undo@45.2.1/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-upload@45.2.1/node_modules/@ckeditor/ckeditor5-upload/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +38 -38
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-watchdog@45.2.1/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@deltablot_dropzone@7.3.1/node_modules/@deltablot/dropzone/dist/dropzone.js +1 -1
- package/dist/node_modules/.pnpm/@fastify_busboy@2.1.1/node_modules/@fastify/busboy/lib/main.js +1 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.4/node_modules/@figma/code-connect/dist/common/fetch.js +1 -0
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.4/node_modules/@figma/code-connect/dist/connect/figma_rest_api.js +1 -0
- package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/connect/helpers.js +1 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.4/node_modules/@figma/code-connect/package.json.js +1 -0
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +1 -1
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.4/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +1 -0
- package/dist/node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js +2 -2
- package/dist/node_modules/.pnpm/@storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/core/dist/channels/index.js +9 -9
- package/dist/node_modules/.pnpm/@storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/core/dist/csf/index.js +1 -1
- package/dist/node_modules/.pnpm/@storybook_core@8.6.14_prettier@3.6.2_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/core/dist/preview-api/index.js +22 -22
- package/dist/node_modules/.pnpm/@storybook_instrumenter@8.6.14_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/instrumenter/dist/index.js +36 -36
- package/dist/node_modules/.pnpm/@storybook_test@8.6.14_storybook@8.6.14_prettier@3.6.2_/node_modules/@storybook/test/dist/index.js +111 -111
- package/dist/node_modules/.pnpm/@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.0.10_typescript@5.8.3__playwright@1.53.2_77c47ac19cbe97978028e1e5ac862536/node_modules/@vitest/browser/context.js +1 -0
- package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.js +8 -8
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js +5 -5
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js +12 -12
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/diff.js +21 -21
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.js +2 -2
- package/dist/node_modules/.pnpm/axe-core@4.10.3/node_modules/axe-core/axe.js +4 -4
- package/dist/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.js +3 -3
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/get.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/unset.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/function/debounce.js +1 -1
- package/dist/node_modules/.pnpm/es-toolkit@1.32.0/node_modules/es-toolkit/dist/object/cloneDeepWith.js +1 -1
- package/dist/node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/async-directive.js +1 -1
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directive-helpers.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/class-map.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js +2 -2
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/repeat.js +5 -0
- package/dist/node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js +3 -3
- package/dist/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.js +1 -1
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/cache.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cache/cachestorage.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/cookies/parse.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/constants.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/headers.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/index.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/request.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/response.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/util.js +2 -2
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/fetch/webidl.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/connection.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/events.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/frame.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/receiver.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/util.js +1 -1
- package/dist/node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/websocket/websocket.js +1 -1
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.10_@vitest_browser@3.2.4_@vitest_ui@3_8c34ee540b1f52c214debce201d1e515/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +8 -0
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.10_@vitest_browser@3.2.4_@vitest_ui@3_8c34ee540b1f52c214debce201d1e515/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +12 -0
- package/dist/packages/web-components/src/components/accordion/gator/base/accordion.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/accordion/gator/group/accordion-group.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/banner/gator/banner.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/button/gator/button.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/button-card/gator/button-card.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/card/gator/base/card.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/chip/gator/chip.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/modal/gator/modal.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/switch/gator/switch.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/table/gator/table-bulk-controls/table-bulk-controls.gator.scss.js +1 -0
- package/dist/packages/web-components/src/components/text-detail/gator/text-detail.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/toast/gator/base/toast.gator.scss.js +1 -1
- package/dist/packages/web-components/src/components/toast-container/gator/toast-container.gator.scss.js +1 -0
- package/dist/packages/web-components/src/components/toaster/gator/toaster.gator.scss.js +1 -0
- package/dist/packages/web-components/src/index.slds.scss.js +1 -1
- package/dist/services/toaster-service.js +1 -0
- package/dist/types/components/accordion/gator/base/accordion.gator.d.ts +13 -3
- package/dist/types/components/accordion/gator/base/accordion.gator.figma.d.ts +1 -0
- package/dist/types/components/accordion/gator/group/accordion-group.gator.d.ts +5 -0
- package/dist/types/components/accordion/gator/group/accordion-group.gator.figma.d.ts +1 -0
- package/dist/types/components/avatar/gator/avatar.gator.d.ts +1 -0
- package/dist/types/components/banner/gator/banner.gator.d.ts +5 -0
- package/dist/types/components/banner/gator/banner.gator.figma.d.ts +1 -0
- package/dist/types/components/boolean/boolean.gator.figma.d.ts +1 -0
- package/dist/types/components/breadcrumbs/gator/breadcrumb/breadcrumb.gator.figma.d.ts +1 -0
- package/dist/types/components/breadcrumbs/gator/container/breadcrumbs.gator.figma.d.ts +1 -0
- package/dist/types/components/chip/chip.d.ts +10 -0
- package/dist/types/components/chip/gator/chip.gator.d.ts +1 -0
- package/dist/types/components/modal/gator/modal.gator.d.ts +1 -1
- package/dist/types/components/table/gator/table-bulk-controls/table-bulk-controls.gator.d.ts +29 -0
- package/dist/types/components/table/gator/table-bulk-controls/table-bulk-controls.gator.test.d.ts +0 -0
- package/dist/types/components/table/gator/table.gator.d.ts +9 -0
- package/dist/types/components/text-detail/gator/text-detail.gator.d.ts +4 -2
- package/dist/types/components/text-detail/gator/text-detail.gator.figma.d.ts +1 -0
- package/dist/types/components/toast/toast.d.ts +14 -0
- package/dist/types/components/toast-container/gator/toast-container.gator.d.ts +15 -0
- package/dist/types/components/toast-container/gator/toast-container.gator.test.d.ts +0 -0
- package/dist/types/components/toast-container/index.d.ts +1 -0
- package/dist/types/components/toaster/gator/toaster.gator.d.ts +32 -0
- package/dist/types/components/toaster/gator/toaster.gator.test.d.ts +0 -0
- package/dist/types/components/toaster/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.gator.d.ts +2 -0
- package/dist/types/index.services.d.ts +1 -0
- package/dist/types/services/toaster-service.d.ts +117 -0
- package/dist/types/services/toaster-service.test.d.ts +1 -0
- package/dist/utils/accessibility-utils.js +1 -1
- package/dist/utils/datatestid-utils.js +1 -1
- package/dist/utils/lightdom-utils.js +1 -1
- package/dist/utils/vitest-a11y-utils.js +1 -1
- package/dist/utils/vitest-utils.js +1 -1
- package/package.json +16 -12
- package/web-types.json +293 -114
- package/dist/_virtual/sourcemap-codec.umd.js +0 -1
- package/dist/_virtual/sourcemap-codec.umd2.js +0 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/common/fetch.js +0 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/dist/connect/figma_rest_api.js +0 -1
- package/dist/node_modules/.pnpm/@figma_code-connect@1.3.3/node_modules/@figma/code-connect/package.json.js +0 -1
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +0 -1
- package/dist/node_modules/.pnpm/@vitest_browser@3.2.4_msw@2.7.3_@types_node@24.0.7_typescript@5.8.3__playwright@1.53.1__894c207534f0ba223b8299d9f5ff1049/node_modules/@vitest/browser/context.js +0 -1
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5/node_modules/vitest/dist/chunks/utils.XdZDrNZV.js +0 -8
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.js +0 -12
- package/dist/packages/web-components/src/components/accordion/gator/base/accordion.gator.tokens.scss.js +0 -1
- package/dist/packages/web-components/src/components/accordion/gator/group/accordion-group.gator.tokens.scss.js +0 -1
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/client/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/client/figma_client.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/common/logging.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/common/updates.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/connect/external_types.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/connect/index_common.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/html/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/html/index_html.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/html/template_literal.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/react/external.js +0 -0
- /package/dist/node_modules/.pnpm/{@figma_code-connect@1.3.3 → @figma_code-connect@1.3.4}/node_modules/@figma/code-connect/dist/react/index_react.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.10_@vitest_browser@3.2.4_@vitest_ui@3_8c34ee540b1f52c214debce201d1e515}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.7_@vitest_browser@3.2.4_@vitest_ui@3._93f645c93c51b497c065da8f21fff0a5 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.10_@vitest_browser@3.2.4_@vitest_ui@3_8c34ee540b1f52c214debce201d1e515}/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{NjcToast as p}from"../../toast.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as
|
|
1
|
+
import{NjcToast as p}from"../../toast.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as n}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as f}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import c from"../../../../packages/web-components/src/tokens/primitive.tokens.scss.js";import u from"../../../../packages/web-components/src/components/toast/gator/subtitle/toast-subtitle.gator.scss.js";import{unsafeCSS as l}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/css-tag.js";var v=Object.getOwnPropertyDescriptor,g=(s,e,a,m)=>{for(var t=m>1?void 0:m?v(e,a):e,r=s.length-1,i;r>=0;r--)(i=s[r])&&(t=i(t)||t);return t};let o=class extends p{render(){return n`
|
|
2
2
|
<div class="gator-toast-subtitle">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}};
|
|
5
|
+
`}};o.styles=[l(c),l(u)];o=g([f("ngc-toast-subtitle")],o);export{o as NgcToastSubtitle};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{NjcToast as p}from"../../toast.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as
|
|
1
|
+
import{NjcToast as p}from"../../toast.js";import"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as n}from"../../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import"../../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as f}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import c from"../../../../packages/web-components/src/tokens/primitive.tokens.scss.js";import v from"../../../../packages/web-components/src/components/toast/gator/title/toast-title.gator.scss.js";import{unsafeCSS as l}from"../../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/css-tag.js";var g=Object.getOwnPropertyDescriptor,u=(e,s,a,m)=>{for(var t=m>1?void 0:m?g(s,a):s,r=e.length-1,i;r>=0;r--)(i=e[r])&&(t=i(t)||t);return t};let o=class extends p{render(){return n`
|
|
2
2
|
<div class="gator-toast-title">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}};o.styles=[l(c),l(v)];o=u([
|
|
5
|
+
`}};o.styles=[l(c),l(v)];o=u([f("ngc-toast-title")],o);export{o as NgcToastTitle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import"../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import{LitElement as
|
|
1
|
+
import"../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import"../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import{LitElement as y}from"../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{property as i}from"../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{msg as c}from"../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/install.js";import{localized as m}from"../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/internal/localized-decorator.js";import"../../node_modules/.pnpm/@lit_localize@0.12.2/node_modules/@lit/localize/init/runtime.js";var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,e=(n,r,p,s)=>{for(var o=s>1?void 0:s?f(r,p):r,a=n.length-1,l;a>=0;a--)(l=n[a])&&(o=(s?l(r,p,o):l(o))||o);return s&&o&&b(r,p,o),o};let t=class extends y{constructor(){super(...arguments),this.id="",this.variant="info",this.dismissible=!1,this.sticky=!1,this.exitIconLabel=c("Close Notification"),this.statusIconLabel="",this.title="",this.subtitle=""}};e([i({type:String})],t.prototype,"id",2);e([i()],t.prototype,"variant",2);e([i({type:Boolean})],t.prototype,"dismissible",2);e([i({type:Boolean})],t.prototype,"sticky",2);e([i({type:String,attribute:"exit-icon-label"})],t.prototype,"exitIconLabel",2);e([i({type:String,attribute:"status-icon-label"})],t.prototype,"statusIconLabel",2);e([i({type:String})],t.prototype,"title",2);e([i({type:String})],t.prototype,"subtitle",2);t=e([m()],t);export{t as NjcToast};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as p}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import{LitElement as c}from"../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as f}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as u}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{state as h}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/state.js";import v from"../../../packages/web-components/src/components/toast-container/gator/toast-container.gator.scss.js";import T from"../../../packages/web-components/src/tokens/primitive.tokens.scss.js";import _ from"../../../packages/web-components/src/tokens/semantic.tokens.scss.js";import{repeat as b}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/repeat.js";import{ifDefined as a}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/if-defined.js";import"../../toast/gator/base/toast.gator.js";import{unsafeCSS as m}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/css-tag.js";var $=Object.defineProperty,g=Object.getOwnPropertyDescriptor,l=(t,i,s,r)=>{for(var e=r>1?void 0:r?g(i,s):i,o=t.length-1,d;o>=0;o--)(d=t[o])&&(e=(r?d(i,s,e):d(e))||e);return r&&e&&$(i,s,e),e};let n=class extends c{constructor(){super(...arguments),this.toasts=[],this._renderedToasts=[]}updated(t){if(t.has("toasts")){const i=this.toasts.filter(e=>e.id?!0:(console.warn("[ngc-toast-container] A toast was provided without a required `id` property and will be ignored.",e),!1)),s=[...i],r=new Set(i.map(e=>e.id));this._renderedToasts.forEach((e,o)=>{r.has(e.id)||s.splice(o,0,{...e,initiateRemoval:!0})}),this._renderedToasts=s}}handleAnimationEnd(t){if(t.animationName==="toast-fade-out"){const s=t.target.getAttribute("id");s&&(this._renderedToasts=this._renderedToasts.filter(r=>r.id!==s))}}render(){return p`
|
|
2
|
+
<section class="gator-toast-container" aria-live="polite">
|
|
3
|
+
${b(this._renderedToasts,t=>t.id,t=>p`
|
|
4
|
+
<ngc-toast
|
|
5
|
+
class="${t.initiateRemoval?"toast-fade-out":""}"
|
|
6
|
+
id="${t.id}"
|
|
7
|
+
variant="${a(t.variant)}"
|
|
8
|
+
title="${a(t.title)}"
|
|
9
|
+
subtitle="${a(t.subtitle)}"
|
|
10
|
+
exit-icon-label="${a(t.exitIconLabel)}"
|
|
11
|
+
status-icon-label="${a(t.statusIconLabel)}"
|
|
12
|
+
?sticky="${t.sticky}"
|
|
13
|
+
?dismissible="${t.dismissible}"
|
|
14
|
+
@animationend=${this.handleAnimationEnd}
|
|
15
|
+
></ngc-toast>
|
|
16
|
+
`)}
|
|
17
|
+
</section>
|
|
18
|
+
`}};n.styles=[m(v),m(T),m(_)];l([u({type:Array})],n.prototype,"toasts",2);l([h()],n.prototype,"_renderedToasts",2);n=l([f("ngc-toast-container")],n);export{n as NgcToastContainer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as o from"./gator/toast-container.gator.js";export{o as NgcToastContainer};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/reactive-element.js";import{html as l}from"../../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/lit-html.js";import{LitElement as c}from"../../../node_modules/.pnpm/lit-element@4.2.0/node_modules/lit-element/lit-element.js";import{customElement as d}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/custom-element.js";import{property as f}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{state as u}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/state.js";import h from"../../../packages/web-components/src/components/toaster/gator/toaster.gator.scss.js";import T from"../../../packages/web-components/src/tokens/primitive.tokens.scss.js";import _ from"../../../packages/web-components/src/tokens/semantic.tokens.scss.js";import"../../toast-container/gator/toast-container.gator.js";import{unsafeCSS as m}from"../../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/css-tag.js";var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,a=(s,t,r,e)=>{for(var o=e>1?void 0:e?y(t,r):t,n=s.length-1,p;n>=0;n--)(p=s[n])&&(o=(e?p(t,r,o):p(o))||o);return e&&o&&v(t,r,o),o};let i=class extends c{constructor(){super(...arguments),this.position="top-right",this.defaultToastOptions={},this._toasts=[]}addToast(s){const t=crypto.randomUUID(),r=s.duration??this.defaultToastOptions?.duration??i.defaultDuration,e=!r||r===0,o={...this.defaultToastOptions,...s,id:t,sticky:e};return this._toasts=[o,...this._toasts],e||setTimeout(()=>{this.removeToast(t)},r),t}removeToast(s){this._toasts=this._toasts.filter(t=>t.id!==s)}clearAll(){this._toasts=[]}handleToastDismiss(s){const t=s.detail.id;t&&this.removeToast(t)}render(){return l`
|
|
2
|
+
<div class="gator-toaster ${this.position}">
|
|
3
|
+
<ngc-toast-container .toasts=${this._toasts} @dismiss=${this.handleToastDismiss}></ngc-toast-container>
|
|
4
|
+
</div>
|
|
5
|
+
`}};i.styles=[m(h),m(T),m(_)];i.defaultDuration=5e3;a([f({type:String})],i.prototype,"position",2);a([f({type:Object,attribute:"default-toast-options"})],i.prototype,"defaultToastOptions",2);a([u()],i.prototype,"_toasts",2);i=a([d("ngc-toaster")],i);export{i as NgcToaster};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as o from"./gator/toaster.gator.js";export{o as NgcToaster};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{property as l}from"../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{createRef as u}from"../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js";import{KEY_CONSTANTS as m}from"../../consts/key-constants.js";import{generateRandomId as _}from"../../utils/string-utils.js";import{TestableLitElement as v}from"../../utils/components/testable-lit-element/testable-lit-element.js";import{handleDataTestid as c}from"../../utils/datatestid-utils.js";import{getFirstFocusableElement as y}from"../../utils/accessibility-utils.js";var T=Object.defineProperty,f=(h,e,
|
|
1
|
+
import{property as l}from"../../node_modules/.pnpm/@lit_reactive-element@2.1.0/node_modules/@lit/reactive-element/decorators/property.js";import{createRef as u}from"../../node_modules/.pnpm/lit-html@3.3.0/node_modules/lit-html/directives/ref.js";import{KEY_CONSTANTS as m}from"../../consts/key-constants.js";import{generateRandomId as _}from"../../utils/string-utils.js";import{TestableLitElement as v}from"../../utils/components/testable-lit-element/testable-lit-element.js";import{handleDataTestid as c}from"../../utils/datatestid-utils.js";import{getFirstFocusableElement as y}from"../../utils/accessibility-utils.js";var T=Object.defineProperty,f=(h,e,i,o)=>{for(var t=void 0,s=h.length-1,r;s>=0;s--)(r=h[s])&&(t=r(e,i,t)||t);return t&&T(e,i,t),t};class d extends v{constructor(){super(...arguments),this.referenceId="",this.placement="top-end",this.xOffset=0,this.yOffset=0,this._tooltipRef=u(),this._forceOpen=!1,this._mousedInsideTooltip=!1,this.tooltipId=_()}firstUpdated(){if(this._tooltipRef.value&&(this._tooltipRef.value.style.visibility="hidden",this._tooltipRef.value.style.opacity="0"),!this.referenceId)return;const e=this.referenceElement,i=this._tooltipRef.value;if(e&&i){c(e,this.dataTestid,"trigger"),c(i,this.dataTestid,"tooltip");let o;e.shadowRoot?.delegatesFocus?o=y(e):o=e,o&&(o.ariaDescribedByElements=[this]),e.addEventListener("mouseenter",()=>this.showTooltip()),e.addEventListener("mouseleave",t=>this._handleMouseLeave(t,e,i)),e.addEventListener("focusin",()=>this.showTooltip()),e.addEventListener("focusout",()=>this.hideTooltip()),i.addEventListener("mouseenter",()=>this.showTooltip()),i.addEventListener("mouseleave",t=>{if(this._mousedInsideTooltip){this.hideTooltip();return}this._handleMouseLeave(t,e,i)}),document.addEventListener("keydown",t=>{t.key===m.ESCAPE&&(this._forceOpen=!1,this.hideTooltip())})}}get referenceElement(){let e=document.querySelector(`#${this.referenceId}`);return e||(e=document.querySelector(`[data-id="${this.referenceId}"]`)?.shadowRoot?.querySelector(`#${this.referenceId}`)),e}_handleMouseLeave(e,i,o){const t=i.getBoundingClientRect(),s=o.getBoundingClientRect(),r=this._isMouseInside(e,t,-5),n=this._isMouseInside(e,s,25);!r&&!n&&this.hideTooltip(),n&&(this._mousedInsideTooltip=!0)}_isMouseInside(e,i,o=0){const{left:t,right:s,top:r,bottom:n}=i,a=e.clientX,p=e.clientY;return a>=t-o&&a<=s+o&&p>=r-o&&p<=n+o}toggleTooltip(){this._forceOpen=!this._forceOpen,this._forceOpen?this.showTooltip():this.hideTooltip()}disconnectedCallback(){this._cleanup&&this._cleanup(),super.disconnectedCallback()}showTooltip(){this.assignPosition(),this._tooltipRef.value&&(this._tooltipRef.value.style.visibility="visible",this._tooltipRef.value.style.opacity="1")}hideTooltip(){this._forceOpen||this._tooltipRef.value&&(this._tooltipRef.value.style.visibility="hidden",this._tooltipRef.value.style.opacity="0")}assignPosition(){}}f([l({attribute:"reference-id"})],d.prototype,"referenceId");f([l()],d.prototype,"placement");f([l({type:Number,attribute:"x-offset"})],d.prototype,"xOffset");f([l({type:Number,attribute:"y-offset"})],d.prototype,"yOffset");export{d as NjcTooltip};
|
package/dist/index.gator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"./components/accordion/gator/base/accordion.gator.js";import*as t from"./components/accordion/gator/group/accordion-group.gator.js";import*as r from"./components/alert/gator/base/alert.gator.js";import*as a from"./components/alert/gator/subtitle/alert-subtitle.gator.js";import*as e from"./components/alert/gator/title/alert-title.gator.js";import*as p from"./components/avatar/gator/avatar.gator.js";import"./components/badge/slds/badge.slds.js";import*as n from"./components/badge/gator/badge.gator.js";import*as s from"./components/banner/gator/banner.gator.js";import*as m from"./components/boolean/boolean.gator.js";import*as g from"./components/breadcrumbs/gator/container/breadcrumbs.gator.js";import"./components/button/slds/button.slds.js";import*as c from"./components/button/gator/button.gator.js";import*as
|
|
1
|
+
import*as o from"./components/accordion/gator/base/accordion.gator.js";import*as t from"./components/accordion/gator/group/accordion-group.gator.js";import*as r from"./components/alert/gator/base/alert.gator.js";import*as a from"./components/alert/gator/subtitle/alert-subtitle.gator.js";import*as e from"./components/alert/gator/title/alert-title.gator.js";import*as p from"./components/avatar/gator/avatar.gator.js";import"./components/badge/slds/badge.slds.js";import*as n from"./components/badge/gator/badge.gator.js";import*as s from"./components/banner/gator/banner.gator.js";import*as m from"./components/boolean/boolean.gator.js";import*as g from"./components/breadcrumbs/gator/container/breadcrumbs.gator.js";import"./components/button/slds/button.slds.js";import*as c from"./components/button/gator/button.gator.js";import*as x from"./components/button-card/gator/button-card.gator.js";import*as u from"./components/button-group/gator/button-group.gator.js";import*as l from"./components/card/gator/base/card.gator.js";import*as d from"./components/card/gator/header/card-header.gator.js";import*as f from"./components/card/gator/content/card-content.gator.js";import*as N from"./components/card/gator/footer/card-footer.gator.js";import*as b from"./components/checkbox/checkbox.gator.js";import*as C from"./components/checkbox-group/checkbox-group.gator.js";import*as T from"./components/chip/gator/chip.gator.js";import*as h from"./components/display-card/gator/display-card.gator.js";import*as I from"./components/divider/gator/divider.gator.js";import*as B from"./components/fab/gator/fab.gator.js";import*as P from"./components/headline-card/gator/headline-card.gator.js";import*as k from"./components/input/gator/input-currency/input-currency.gator.js";import*as G from"./components/input/gator/input-date/input-date.gator.js";import*as v from"./components/input/gator/input-label/input-label.gator.js";import*as L from"./components/input/gator/help-text/help-text.gator.js";import*as S from"./components/input/gator/input-text/input-text.gator.js";import*as D from"./components/input/gator/input-textarea/input-textarea.gator.js";import*as w from"./components/input/gator/input-masked/input-masked.gator.js";import*as F from"./components/input/gator/input-percent/input-percent.gator.js";import*as H from"./components/input/gator/input-phone/input-phone.gator.js";import*as y from"./components/input/gator/dropdown/input-dropdown.gator.js";import*as A from"./components/input/gator/input-file/input-file.gator.js";import*as M from"./components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.js";import*as U from"./components/input/gator/input-search/input-search.gator.js";import*as R from"./components/input/gator/input-time/input-time.gator.js";import"./components/icon/slds/icon.slds.js";import*as q from"./components/icon/gator/icon.gator.js";import*as z from"./components/icon-button/gator/icon-button.gator.js";import*as E from"./components/list/gator/list/list.gator.js";import*as J from"./components/list/gator/list-item/list-item.gator.js";import*as K from"./components/loading-spinner/gator/loading-spinner.gator.js";import"./components/menu/base/slds/menu.slds.js";import*as Q from"./components/menu/base/gator/menu.gator.js";import"./components/menu/menu-divider/menu-divider.slds.js";import"./components/menu/menu-item/slds/menu-item.slds.js";import*as X from"./components/menu/menu-item/gator/menu-item.gator.js";import"./components/menu/menu-submenu/menu-submenu.slds.js";import*as Z from"./components/modal/gator/modal.gator.js";import*as $ from"./components/page-header/gator/page-header.gator.js";import*as oo from"./components/panel/gator/panel.gator.js";import*as to from"./components/popover/gator/popover.gator.js";import*as ro from"./components/progress-bar/gator/progress-bar.gator.js";import*as ao from"./components/radio/radio.gator.js";import*as eo from"./components/radio-group/radio-group.gator.js";import*as po from"./components/selection-box/selection-box.gator.js";import*as _o from"./components/selection-box-group/selection-box-group.gator.js";import*as no from"./components/skeleton-loader/gator/skeleton-loader.gator.js";import*as so from"./components/switch/gator/switch.gator.js";import*as mo from"./components/tabs/gator/tabset/tabset.gator.js";import*as go from"./components/tabs/gator/tab/tab.gator.js";import*as io from"./components/text-detail/gator/text-detail.gator.js";import*as co from"./components/text-link/gator/text-link.gator.js";import*as xo from"./components/time-picker/gator/time-picker.gator.js";import*as uo from"./components/toast/gator/base/toast.gator.js";import*as lo from"./components/toast-container/gator/toast-container.gator.js";import*as fo from"./components/toaster/gator/toaster.gator.js";import*as No from"./components/tooltip/gator/tooltip.gator.js";import"./components/tooltip/slds/tooltip.slds.js";import*as Co from"./components/table/gator/table.gator.js";import*as To from"./components/table/gator/table-pagination/table-pagination.gator.js";import*as ho from"./components/table/gator/table-controls/table-controls.gator.js";export{o as NgcAccordion,t as NgcAccordionGroup,r as NgcAlert,a as NgcAlertSubtitle,e as NgcAlertTitle,p as NgcAvatar,n as NgcBadge,s as NgcBanner,m as NgcBoolean,g as NgcBreadcrumbs,c as NgcButton,x as NgcButtonCard,u as NgcButtonGroup,l as NgcCard,f as NgcCardContent,N as NgcCardFooter,d as NgcCardHeader,b as NgcCheckbox,C as NgcCheckboxGroup,T as NgcChip,h as NgcDisplayCard,I as NgcDivider,B as NgcFab,P as NgcHeadlineCard,L as NgcHelpText,q as NgcIcon,z as NgcIconButton,k as NgcInputCurrency,G as NgcInputDate,y as NgcInputDropdown,A as NgcInputFile,M as NgcInputFileUploadedPreview,v as NgcInputLabel,w as NgcInputMasked,F as NgcInputPercent,H as NgcInputPhone,U as NgcInputSearch,S as NgcInputText,D as NgcInputTextarea,R as NgcInputTime,E as NgcList,J as NgcListItem,K as NgcLoadingSpinner,Q as NgcMenu,X as NgcMenuItem,Z as NgcModal,$ as NgcPageHeader,oo as NgcPanel,to as NgcPopover,ro as NgcProgressBar,ao as NgcRadio,eo as NgcRadioGroup,po as NgcSelectionBox,_o as NgcSelectionBoxGroup,no as NgcSkeletonLoader,so as NgcSwitch,go as NgcTab,Co as NgcTable,ho as NgcTableControls,To as NgcTablePagination,mo as NgcTabs,io as NgcTextDetail,co as NgcTextLink,xo as NgcTimePicker,uo as NgcToast,lo as NgcToastContainer,fo as NgcToaster,No as NgcTooltip};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"./components/accordion/gator/base/accordion.gator.js";import*as t from"./components/accordion/gator/group/accordion-group.gator.js";import*as r from"./components/alert/gator/base/alert.gator.js";import*as a from"./components/alert/gator/subtitle/alert-subtitle.gator.js";import*as e from"./components/alert/gator/title/alert-title.gator.js";import*as p from"./components/avatar/gator/avatar.gator.js";import*as s from"./components/badge/slds/badge.slds.js";import*as _ from"./components/badge/gator/badge.gator.js";import*as n from"./components/banner/gator/banner.gator.js";import*as m from"./components/boolean/boolean.gator.js";import*as i from"./components/breadcrumbs/gator/container/breadcrumbs.gator.js";import*as c from"./components/button/slds/button.slds.js";import*as g from"./components/button/gator/button.gator.js";import*as u from"./components/button-card/gator/button-card.gator.js";import*as x from"./components/card/gator/base/card.gator.js";import*as d from"./components/card/gator/header/card-header.gator.js";import*as l from"./components/card/gator/content/card-content.gator.js";import*as f from"./components/card/gator/footer/card-footer.gator.js";import*as N from"./components/checkbox/checkbox.gator.js";import*as b from"./components/checkbox-group/checkbox-group.gator.js";import*as I from"./components/chip/gator/chip.gator.js";import*as T from"./components/combobox/base/index.js";import*as h from"./components/combobox/combobox-item/index.js";import*as C from"./components/display-card/gator/display-card.gator.js";import*as B from"./components/divider/gator/divider.gator.js";import*as k from"./components/fab/gator/fab.gator.js";import*as v from"./components/headline-card/gator/headline-card.gator.js";import*as L from"./components/icon/slds/icon.slds.js";import*as D from"./components/icon/gator/icon.gator.js";import*as S from"./components/icon-button/gator/icon-button.gator.js";import*as P from"./components/input/gator/input-currency/input-currency.gator.js";import*as G from"./components/input/gator/input-date/input-date.gator.js";import*as M from"./components/input/gator/input-label/input-label.gator.js";import*as w from"./components/input/gator/help-text/help-text.gator.js";import*as F from"./components/input/gator/input-text/input-text.gator.js";import*as H from"./components/input/gator/input-textarea/input-textarea.gator.js";import*as y from"./components/input/gator/input-masked/input-masked.gator.js";import*as A from"./components/input/gator/input-percent/input-percent.gator.js";import*as R from"./components/input/gator/input-phone/input-phone.gator.js";import*as E from"./components/input/gator/dropdown/input-dropdown.gator.js";import*as U from"./components/input/gator/input-file/input-file.gator.js";import*as j from"./components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.js";import*as q from"./components/input/gator/input-search/input-search.gator.js";import*as z from"./components/input/gator/input-time/input-time.gator.js";import*as J from"./components/input/slds/input-text/input-text.slds.js";import*as K from"./components/input/slds/input-error/input-error.slds.js";import*as O from"./components/input/slds/input-label/input-label.slds.js";import*as Q from"./components/input-rich-text/input-rich-text.slds.js";import*as V from"./components/list/gator/list/list.gator.js";import*as W from"./components/list/gator/list-item/list-item.gator.js";import*as X from"./components/menu/base/slds/menu.slds.js";import*as Y from"./components/menu/base/gator/menu.gator.js";import*as Z from"./components/menu/menu-divider/menu-divider.slds.js";import*as $ from"./components/menu/menu-item/slds/menu-item.slds.js";import*as oo from"./components/menu/menu-item/gator/menu-item.gator.js";import*as to from"./components/menu/menu-submenu/menu-submenu.slds.js";import*as ro from"./components/modal/gator/modal.gator.js";import*as ao from"./components/page-header/gator/page-header.gator.js";import*as eo from"./components/pill/pill.js";import*as po from"./components/popover/gator/popover.gator.js";import*as so from"./components/radio/radio.gator.js";import*as _o from"./components/radio-group/radio-group.gator.js";import*as no from"./components/scoped-notification/scoped-notification.slds.js";import*as mo from"./components/selection-box/selection-box.gator.js";import*as io from"./components/selection-box-group/selection-box-group.gator.js";import*as co from"./components/skeleton-loader/gator/skeleton-loader.gator.js";import*as go from"./components/switch/gator/switch.gator.js";import*as uo from"./components/tabs/gator/tabset/tabset.gator.js";import*as xo from"./components/tabs/gator/tab/tab.gator.js";import*as lo from"./components/text-detail/gator/text-detail.gator.js";import*as fo from"./components/text-link/gator/text-link.gator.js";import*as No from"./components/toast/gator/base/toast.gator.js";import*as bo from"./components/tooltip/gator/tooltip.gator.js";import*as
|
|
1
|
+
import*as o from"./components/accordion/gator/base/accordion.gator.js";import*as t from"./components/accordion/gator/group/accordion-group.gator.js";import*as r from"./components/alert/gator/base/alert.gator.js";import*as a from"./components/alert/gator/subtitle/alert-subtitle.gator.js";import*as e from"./components/alert/gator/title/alert-title.gator.js";import*as p from"./components/avatar/gator/avatar.gator.js";import*as s from"./components/badge/slds/badge.slds.js";import*as _ from"./components/badge/gator/badge.gator.js";import*as n from"./components/banner/gator/banner.gator.js";import*as m from"./components/boolean/boolean.gator.js";import*as i from"./components/breadcrumbs/gator/container/breadcrumbs.gator.js";import*as c from"./components/button/slds/button.slds.js";import*as g from"./components/button/gator/button.gator.js";import*as u from"./components/button-card/gator/button-card.gator.js";import*as x from"./components/card/gator/base/card.gator.js";import*as d from"./components/card/gator/header/card-header.gator.js";import*as l from"./components/card/gator/content/card-content.gator.js";import*as f from"./components/card/gator/footer/card-footer.gator.js";import*as N from"./components/checkbox/checkbox.gator.js";import*as b from"./components/checkbox-group/checkbox-group.gator.js";import*as I from"./components/chip/gator/chip.gator.js";import*as T from"./components/combobox/base/index.js";import*as h from"./components/combobox/combobox-item/index.js";import*as C from"./components/display-card/gator/display-card.gator.js";import*as B from"./components/divider/gator/divider.gator.js";import*as k from"./components/fab/gator/fab.gator.js";import*as v from"./components/headline-card/gator/headline-card.gator.js";import*as L from"./components/icon/slds/icon.slds.js";import*as D from"./components/icon/gator/icon.gator.js";import*as S from"./components/icon-button/gator/icon-button.gator.js";import*as P from"./components/input/gator/input-currency/input-currency.gator.js";import*as G from"./components/input/gator/input-date/input-date.gator.js";import*as M from"./components/input/gator/input-label/input-label.gator.js";import*as w from"./components/input/gator/help-text/help-text.gator.js";import*as F from"./components/input/gator/input-text/input-text.gator.js";import*as H from"./components/input/gator/input-textarea/input-textarea.gator.js";import*as y from"./components/input/gator/input-masked/input-masked.gator.js";import*as A from"./components/input/gator/input-percent/input-percent.gator.js";import*as R from"./components/input/gator/input-phone/input-phone.gator.js";import*as E from"./components/input/gator/dropdown/input-dropdown.gator.js";import*as U from"./components/input/gator/input-file/input-file.gator.js";import*as j from"./components/input/gator/input-file/file-uploaded-preview/file-upload-preview.gator.js";import*as q from"./components/input/gator/input-search/input-search.gator.js";import*as z from"./components/input/gator/input-time/input-time.gator.js";import*as J from"./components/input/slds/input-text/input-text.slds.js";import*as K from"./components/input/slds/input-error/input-error.slds.js";import*as O from"./components/input/slds/input-label/input-label.slds.js";import*as Q from"./components/input-rich-text/input-rich-text.slds.js";import*as V from"./components/list/gator/list/list.gator.js";import*as W from"./components/list/gator/list-item/list-item.gator.js";import*as X from"./components/menu/base/slds/menu.slds.js";import*as Y from"./components/menu/base/gator/menu.gator.js";import*as Z from"./components/menu/menu-divider/menu-divider.slds.js";import*as $ from"./components/menu/menu-item/slds/menu-item.slds.js";import*as oo from"./components/menu/menu-item/gator/menu-item.gator.js";import*as to from"./components/menu/menu-submenu/menu-submenu.slds.js";import*as ro from"./components/modal/gator/modal.gator.js";import*as ao from"./components/page-header/gator/page-header.gator.js";import*as eo from"./components/pill/pill.js";import*as po from"./components/popover/gator/popover.gator.js";import*as so from"./components/radio/radio.gator.js";import*as _o from"./components/radio-group/radio-group.gator.js";import*as no from"./components/scoped-notification/scoped-notification.slds.js";import*as mo from"./components/selection-box/selection-box.gator.js";import*as io from"./components/selection-box-group/selection-box-group.gator.js";import*as co from"./components/skeleton-loader/gator/skeleton-loader.gator.js";import*as go from"./components/switch/gator/switch.gator.js";import*as uo from"./components/tabs/gator/tabset/tabset.gator.js";import*as xo from"./components/tabs/gator/tab/tab.gator.js";import*as lo from"./components/text-detail/gator/text-detail.gator.js";import*as fo from"./components/text-link/gator/text-link.gator.js";import*as No from"./components/toast/gator/base/toast.gator.js";import*as bo from"./components/toast-container/gator/toast-container.gator.js";import*as Io from"./components/toaster/gator/toaster.gator.js";import*as To from"./components/tooltip/gator/tooltip.gator.js";import*as ho from"./components/tooltip/slds/tooltip.slds.js";export{o as NgcAccordion,t as NgcAccordionGroup,r as NgcAlert,a as NgcAlertSubtitle,e as NgcAlertTitle,p as NgcAvatar,_ as NgcBadge,n as NgcBanner,m as NgcBoolean,i as NgcBreadcrumbs,g as NgcButton,u as NgcButtonCard,x as NgcCard,l as NgcCardContent,f as NgcCardFooter,d as NgcCardHeader,N as NgcCheckbox,b as NgcCheckboxGroup,I as NgcChip,C as NgcDisplayCard,B as NgcDivider,k as NgcFab,v as NgcHeadlineCard,w as NgcHelpText,D as NgcIcon,S as NgcIconButton,P as NgcInputCurrency,G as NgcInputDate,E as NgcInputDropdown,U as NgcInputFile,j as NgcInputFileUploadedPreview,M as NgcInputLabel,y as NgcInputMasked,A as NgcInputPercent,R as NgcInputPhone,q as NgcInputSearch,F as NgcInputText,H as NgcInputTextarea,z as NgcInputTime,V as NgcList,W as NgcListItem,Y as NgcMenu,oo as NgcMenuItem,ro as NgcModal,ao as NgcPageHeader,po as NgcPopover,so as NgcRadio,_o as NgcRadioGroup,mo as NgcSelectionBox,io as NgcSelectionBoxGroup,co as NgcSkeletonLoader,go as NgcSwitch,xo as NgcTab,uo as NgcTabs,lo as NgcTextDetail,fo as NgcTextLink,No as NgcToast,bo as NgcToastContainer,Io as NgcToaster,To as NgcTooltip,s as NscBadge,c as NscButton,T as NscCombobox,h as NscComboboxItem,L as NscIcon,K as NscInputError,O as NscInputLabel,Q as NscInputRichText,J as NscInputText,X as NscMenu,Z as NscMenuDivider,$ as NscMenuItem,to as NscMenuSubmenu,eo as NscPill,no as NscScopedNotification,ho as NscTooltip};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toasterService as o}from"./services/toaster-service.js";export{o as toasterService};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{Plugin as a,PendingActions as n}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{DomEmitterMixin as o}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{debounce as r}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/debounce.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class
|
|
4
|
+
*/class _ extends a{adapter;_debouncedSave;_lastDocumentVersion;_savePromise;_domEmitter;_config;_pendingActions;_makeImmediateSave;_action=null;static get pluginName(){return"Autosave"}static get isOfficialPlugin(){return!0}static get requires(){return[n]}constructor(t){super(t);const e=t.config.get("autosave")||{},i=e.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=r(this._save.bind(this),i),this._lastDocumentVersion=t.model.document.version,this._savePromise=null,this._domEmitter=new(o()),this._config=e,this._pendingActions=t.plugins.get(n),this._makeImmediateSave=!1}init(){const t=this.editor,e=t.model.document;this.listenTo(t,"ready",()=>{this.listenTo(e,"change:data",(i,s)=>{this._saveCallbacks.length&&s.isLocal&&(this.state==="synchronized"&&(this.state="waiting",this._setPendingAction()),this.state==="waiting"&&this._debouncedSave())})}),this.listenTo(t,"destroy",()=>this._flush(),{priority:"highest"});/* istanbul ignore next -- @preserve */this._domEmitter.listenTo(window,"beforeunload",(i,s)=>{this._pendingActions.hasAny&&(s.returnValue=this._pendingActions.first.message)})}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then(()=>Promise.all(this._saveCallbacks.map(t=>t(this.editor)))).finally(()=>{this._savePromise=null}).then(()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)}).catch(t=>{throw this.state="error",this.state="saving",this._debouncedSave(),t}),this._savePromise)}_setPendingAction(){const t=this.editor.t;this._action||(this._action=this._pendingActions.add(t("Saving changes")))}get _saveCallbacks(){const t=[];return this.adapter&&this.adapter.save&&t.push(this.adapter.save),this._config.save&&t.push(this._config.save),t}}export{_ as Autosave};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{Plugin as r,Command as B}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{IconBold as N,IconCode as U,IconItalic as w,IconStrikethrough as F,IconSubscript as R,IconSuperscript as v,IconUnderline as L}from"../../../../../@ckeditor_ckeditor5-icons@45.2.1/node_modules/@ckeditor/ckeditor5-icons/dist/index.js";import{ButtonView as l,MenuBarMenuListItemButtonView as a}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{TwoStepCaretMovement as P,inlineHighlight as K}from"../../../../../@ckeditor_ckeditor5-typing@45.2.1/node_modules/@ckeditor/ckeditor5-typing/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class
|
|
4
|
+
*/class d extends B{attributeKey;constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,o=e.document.selection,c=t.forceValue===void 0?!this.value:t.forceValue;e.change(m=>{if(o.isCollapsed)c?m.setSelectionAttribute(this.attributeKey,!0):m.removeSelectionAttribute(this.attributeKey);else{const I=e.schema.getValidRanges(o.getRanges(),this.attributeKey);for(const n of I)c?m.setAttribute(this.attributeKey,c,n):m.removeAttribute(this.attributeKey,n)}})}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,i=t.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const o of i.getRanges())for(const c of o.getItems())if(e.checkAttribute(c,this.attributeKey))return c.hasAttribute(this.attributeKey);return!1}}const p="bold";class $ extends r{static get pluginName(){return"BoldEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:p}),t.model.schema.setAttributeProperties(p,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:p,view:"strong",upcastAlso:["b",i=>{const o=i.getStyle("font-weight");return o&&(o=="bold"||Number(o)>=600)?{name:!0,styles:["font-weight"]}:null}]}),t.commands.add(p,new d(t,p)),t.keystrokes.set("CTRL+B",p),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Bold text"),keystroke:"CTRL+B"}]})}}function g({editor:s,commandName:t,plugin:e,icon:i,label:o,keystroke:c}){return m=>{const I=s.commands.get(t),n=new m(s.locale);return n.set({label:o,icon:i,keystroke:c,isToggleable:!0}),n.bind("isEnabled").to(I,"isEnabled"),n.bind("isOn").to(I,"value"),n instanceof a?n.set({role:"menuitemcheckbox"}):n.set({tooltip:!0}),e.listenTo(n,"execute",()=>{s.execute(t),s.editing.view.focus()}),n}}const x="bold";class H extends r{static get pluginName(){return"BoldUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=g({editor:t,commandName:x,plugin:this,icon:N,label:e("Bold"),keystroke:"CTRL+B"});t.ui.componentFactory.add(x,()=>i(l)),t.ui.componentFactory.add("menuBar:"+x,()=>i(a))}}class st extends r{static get requires(){return[$,H]}static get pluginName(){return"Bold"}static get isOfficialPlugin(){return!0}}const u="code",q="ck-code_selected";class V extends r{static get pluginName(){return"CodeEditing"}static get isOfficialPlugin(){return!0}static get requires(){return[P]}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:u}),t.model.schema.setAttributeProperties(u,{isFormatting:!0,copyOnEnter:!1}),t.conversion.attributeToElement({model:u,view:"code"}),t.commands.add(u,new d(t,u)),t.plugins.get(P).registerAttribute(u),K(t,u,"code",q),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}const S="code";class D extends r{static get pluginName(){return"CodeUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=g({editor:t,commandName:S,plugin:this,icon:U,label:e("Code")});t.ui.componentFactory.add(S,()=>i(l)),t.ui.componentFactory.add("menuBar:"+S,()=>i(a))}}class rt extends r{static get requires(){return[V,D]}static get pluginName(){return"Code"}static get isOfficialPlugin(){return!0}}const h="italic";class G extends r{static get pluginName(){return"ItalicEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:h}),t.model.schema.setAttributeProperties(h,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:h,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(h,new d(t,h)),t.keystrokes.set("CTRL+I",h),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Italic text"),keystroke:"CTRL+I"}]})}}const E="italic";class M extends r{static get pluginName(){return"ItalicUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=g({editor:t,commandName:E,plugin:this,icon:w,keystroke:"CTRL+I",label:e("Italic")});t.ui.componentFactory.add(E,()=>i(l)),t.ui.componentFactory.add("menuBar:"+E,()=>i(a))}}class nt extends r{static get requires(){return[G,M]}static get pluginName(){return"Italic"}static get isOfficialPlugin(){return!0}}const b="strikethrough";class _ extends r{static get pluginName(){return"StrikethroughEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:b}),t.model.schema.setAttributeProperties(b,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:b,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),t.commands.add(b,new d(t,b)),t.keystrokes.set("CTRL+SHIFT+X","strikethrough"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const T="strikethrough";class X extends r{static get pluginName(){return"StrikethroughUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=g({editor:t,commandName:T,plugin:this,icon:F,keystroke:"CTRL+SHIFT+X",label:e("Strikethrough")});t.ui.componentFactory.add(T,()=>i(l)),t.ui.componentFactory.add("menuBar:"+T,()=>i(a))}}class ot extends r{static get requires(){return[_,X]}static get pluginName(){return"Strikethrough"}static get isOfficialPlugin(){return!0}}const f="subscript";class W extends r{static get pluginName(){return"SubscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:f}),t.model.schema.setAttributeProperties(f,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:f,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),t.commands.add(f,new d(t,f))}}const A="subscript";class j extends r{static get pluginName(){return"SubscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=g({editor:t,commandName:A,plugin:this,icon:R,label:e("Subscript")});t.ui.componentFactory.add(A,()=>i(l)),t.ui.componentFactory.add("menuBar:"+A,()=>i(a))}}class ct extends r{static get requires(){return[W,j]}static get pluginName(){return"Subscript"}static get isOfficialPlugin(){return!0}}const y="superscript";class z extends r{static get pluginName(){return"SuperscriptEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:y}),t.model.schema.setAttributeProperties(y,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:y,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),t.commands.add(y,new d(t,y))}}const C="superscript";class J extends r{static get pluginName(){return"SuperscriptUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=g({editor:t,commandName:C,plugin:this,icon:v,label:e("Superscript")});t.ui.componentFactory.add(C,()=>i(l)),t.ui.componentFactory.add("menuBar:"+C,()=>i(a))}}class at extends r{static get requires(){return[z,J]}static get pluginName(){return"Superscript"}static get isOfficialPlugin(){return!0}}const k="underline";class Q extends r{static get pluginName(){return"UnderlineEditing"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=this.editor.t;t.model.schema.extend("$text",{allowAttributes:k}),t.model.schema.setAttributeProperties(k,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:k,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),t.commands.add(k,new d(t,k)),t.keystrokes.set("CTRL+U","underline"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Underline text"),keystroke:"CTRL+U"}]})}}const O="underline";class Y extends r{static get pluginName(){return"UnderlineUI"}static get isOfficialPlugin(){return!0}init(){const t=this.editor,e=t.locale.t,i=g({editor:t,commandName:O,plugin:this,icon:L,label:e("Underline"),keystroke:"CTRL+U"});t.ui.componentFactory.add(O,()=>i(l)),t.ui.componentFactory.add("menuBar:"+O,()=>i(a))}}class ut extends r{static get requires(){return[Q,Y]}static get pluginName(){return"Underline"}static get isOfficialPlugin(){return!0}}export{d as AttributeCommand,st as Bold,$ as BoldEditing,H as BoldUI,rt as Code,V as CodeEditing,D as CodeUI,nt as Italic,G as ItalicEditing,M as ItalicUI,ot as Strikethrough,_ as StrikethroughEditing,X as StrikethroughUI,ct as Subscript,W as SubscriptEditing,j as SubscriptUI,at as Superscript,z as SuperscriptEditing,J as SuperscriptUI,ut as Underline,Q as UnderlineEditing,Y as UnderlineUI};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import{Plugin as b}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{EventInfo as q,uid as z,delay as j,DomEmitterMixin as A,env as f,global as m,createElement as x,Rect as _,getRangeFromMouseEvent as ee,ResizeObserver as te,toUnit as re}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";import{MouseObserver as ne,LiveRange as T,DomEventObserver as ie,DataTransfer as oe,Range as se}from"../../../../../@ckeditor_ckeditor5-engine@45.2.1/node_modules/@ckeditor/ckeditor5-engine/dist/index.js";import{Widget as ae,isWidget as k}from"../../../../../@ckeditor_ckeditor5-widget@45.2.1/node_modules/@ckeditor/ckeditor5-widget/dist/index.js";import{View as le}from"../../../../../@ckeditor_ckeditor5-ui@45.2.1/node_modules/@ckeditor/ckeditor5-ui/dist/index.js";import{mapValues as ce}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/object/mapValues.js";import{throttle as V}from"../../../../../es-toolkit@1.32.0/node_modules/es-toolkit/dist/compat/function/throttle.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/class
|
|
4
|
+
*/class v extends ie{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;this.listenTo(t,"paste",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",r("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",r("dragging"),{priority:"low"});function r(n){return(s,o)=>{o.preventDefault();const i=o.dropRange?[o.dropRange]:null,l=new q(t,n);t.fire(l,{dataTransfer:o.dataTransfer,method:s.name,targetRanges:i,target:o.target,domEvent:o.domEvent}),l.stop.called&&o.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,r=e.type=="drop"||e.type=="paste",n={dataTransfer:new oe(t,{cacheFiles:r})};if(e.type=="drop"||e.type=="dragover"){const s=ee(e);n.dropRange=s&&this.view.domConverter.domRangeToView(s)}this.fire(e.type,e,n)}}/**
|
|
5
5
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
6
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
7
|
-
*/function
|
|
7
|
+
*/function de(a){return a=a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," "),(a.includes("</p><p>")||a.includes("<br>"))&&(a=`<p>${a}</p>`),a}/**
|
|
8
8
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
9
9
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
10
|
-
*/function
|
|
10
|
+
*/function ge(a){return a.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?" ":t).replace(/<!--[\s\S]*?-->/g,"")}/**
|
|
11
11
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
12
12
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
13
|
-
*/const
|
|
14
|
-
`;let
|
|
15
|
-
`;for(const
|
|
13
|
+
*/const B=["figcaption","li"],L=["ol","ul"];function H(a,e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return`
|
|
14
|
+
`;let t="",r=null;for(const n of e.getChildren())t+=pe(n,r)+H(a,n),r=n;if(e.is("rawElement")){const n=document.createElement("div");e.render(n,a),t+=K(n)}return t}function K(a){let e="";if(a.nodeType===Node.TEXT_NODE)return a.textContent;if(a.tagName==="BR")return`
|
|
15
|
+
`;for(const t of a.childNodes)e+=K(t);return e}function pe(a,e){return e?a.is("element","li")&&!a.isEmpty&&a.getChild(0).is("containerElement")||L.includes(a.name)&&L.includes(e.name)?`
|
|
16
16
|
|
|
17
|
-
`:!
|
|
18
|
-
`:
|
|
17
|
+
`:!a.is("containerElement")&&!e.is("containerElement")?"":B.includes(a.name)||B.includes(e.name)?`
|
|
18
|
+
`:a.is("element")&&a.getCustomProperty("dataPipeline:transparentRendering")||e.is("element")&&e.getCustomProperty("dataPipeline:transparentRendering")?"":`
|
|
19
19
|
|
|
20
|
-
`:""}class Y extends _{constructor(){super(...arguments);m(this,"_markersToCopy",new Map)}static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,n){this._markersToCopy.set(e,n)}_copySelectedFragmentWithMarkers(e,n,t=i=>i.model.getSelectedContent(i.model.document.selection)){return this.editor.model.change(i=>{const o=i.model.document.selection;i.setSelection(n);const r=this._insertFakeMarkersIntoSelection(i,i.model.document.selection,e),s=t(i),c=this._removeFakeMarkersInsideElement(i,s);for(const[d,g]of Object.entries(r)){c[d]||(c[d]=i.createRangeIn(s));for(const p of g)i.remove(p)}s.markers.clear();for(const[d,g]of Object.entries(c))s.markers.set(d,g);return i.setSelection(o),s})}_pasteMarkersIntoTransformedElement(e,n){const t=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(i=>{const o=this._insertFakeMarkersElements(i,t),r=n(i),s=this._removeFakeMarkersInsideElement(i,r);for(const c of Object.values(o).flat())i.remove(c);for(const[c,d]of Object.entries(s))i.model.markers.has(c)||i.addMarker(c,{usingOperation:!0,affectsData:!0,range:d});return r})}_pasteFragmentWithMarkers(e){const n=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const t of n)e.markers.set(t.name,t.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,n,t={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const i=this._markersToCopy.get(e);this._markersToCopy.set(e,t),n(),i?this._markersToCopy.set(e,i):this._markersToCopy.delete(e)}_isMarkerCopyable(e,n){const t=this._getMarkerClipboardConfig(e);if(!t)return!1;if(!n)return!0;const{allowedActions:i}=t;return i==="all"||i.includes(n)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[n]=e.split(":");return this._markersToCopy.get(n)||null}_insertFakeMarkersIntoSelection(e,n,t){const i=this._getCopyableMarkersFromSelection(e,n,t);return this._insertFakeMarkersElements(e,i)}_getCopyableMarkersFromSelection(e,n,t){const i=Array.from(n.getRanges()),o=new Set(i.flatMap(s=>Array.from(e.model.markers.getMarkersIntersectingRange(s)))),r=s=>{if(!this._isMarkerCopyable(s.name,t))return!1;const{copyPartiallySelected:d}=this._getMarkerClipboardConfig(s.name);if(!d){const g=s.getRange();return i.some(p=>p.containsRange(g,!0))}return!0};return Array.from(o).filter(r).map(s=>({name:t==="dragstart"?this._getUniqueMarkerName(s.name):s.name,range:s.getRange()}))}_getPasteMarkersFromRangeMap(e,n=null){const{model:t}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([o,r])=>{if(!this._hasMarkerConfiguration(o))return[{name:o,range:r}];if(this._isMarkerCopyable(o,n)){const s=this._getMarkerClipboardConfig(o),c=t.markers.has(o)&&t.markers.get(o).getRange().root.rootName==="$graveyard";return(s.duplicateOnPaste||c)&&(o=this._getUniqueMarkerName(o)),[{name:o,range:r}]}return[]})}_insertFakeMarkersElements(e,n){const t={},i=n.flatMap(o=>{const{start:r,end:s}=o.range;return[{position:r,marker:o,type:"start"},{position:s,marker:o,type:"end"}]}).sort(({position:o},{position:r})=>o.isBefore(r)?1:-1);for(const{position:o,marker:r,type:s}of i){const c=e.createElement("$marker",{"data-name":r.name,"data-type":s});t[r.name]||(t[r.name]=[]),t[r.name].push(c),e.insert(c,o)}return t}_removeFakeMarkersInsideElement(e,n){const i=this._getAllFakeMarkersFromElement(e,n).reduce((o,r)=>{const s=r.markerElement&&e.createPositionBefore(r.markerElement);let c=o[r.name],d=!1;return c!=null&&c.start&&(c!=null&&c.end)&&(this._getMarkerClipboardConfig(r.name).duplicateOnPaste?o[this._getUniqueMarkerName(r.name)]=o[r.name]:d=!0,c=null),d||(o[r.name]={...c,[r.type]:s}),r.markerElement&&e.remove(r.markerElement),o},{});return me(i,o=>new de(o.start||e.createPositionFromPath(n,[0]),o.end||e.createPositionAt(n,"end")))}_getAllFakeMarkersFromElement(e,n){const t=Array.from(e.createRangeIn(n)).flatMap(({item:r})=>{if(!r.is("element","$marker"))return[];const s=r.getAttribute("data-name"),c=r.getAttribute("data-type");return[{markerElement:r,name:s,type:c}]}),i=[],o=[];for(const r of t)r.type==="end"&&(t.some(c=>c.name===r.name&&c.type==="start")||i.push({markerElement:null,name:r.name,type:"start"})),r.type==="start"&&(t.some(c=>c.name===r.name&&c.type==="end")||o.unshift({markerElement:null,name:r.name,type:"end"}));return[...i,...t,...o]}_getUniqueMarkerName(e){const n=e.split(":"),t=H().substring(1,6);return n.length===3?`${n.slice(0,2).join(":")}:${t}`:`${n.join(":")}:${t}`}}class T extends _{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[Y]}init(){this.editor.editing.view.addObserver(D),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(a,e,n){const t=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:n==="cut"},()=>{const i=t._copySelectedFragmentWithMarkers(n,e);this.fire("outputTransformation",{dataTransfer:a,content:i,method:n})})}_setupPasteDrop(){const a=this.editor,e=a.model,n=a.editing.view,t=n.document,i=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(t,"clipboardInput",(o,r)=>{r.method=="paste"&&!a.model.canEditAt(a.model.document.selection)&&o.stop()},{priority:"highest"}),this.listenTo(t,"clipboardInput",(o,r)=>{const s=r.dataTransfer;let c;if(r.content)c=r.content;else{let p="";s.getData("text/html")?p=he(s.getData("text/html")):s.getData("text/plain")&&(p=ue(s.getData("text/plain"))),c=this.editor.data.htmlProcessor.toView(p)}const d=new j(this,"inputTransformation"),g=s.getData("application/ckeditor5-editor-id")||null;this.fire(d,{content:c,dataTransfer:s,sourceEditorId:g,targetRanges:r.targetRanges,method:r.method}),d.stop.called&&o.stop(),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(o,r)=>{if(r.content.isEmpty)return;const c=this.editor.data.toModel(r.content,"$clipboardHolder");c.childCount!=0&&(o.stop(),e.change(()=>{this.fire("contentInsertion",{content:c,method:r.method,sourceEditorId:r.sourceEditorId,dataTransfer:r.dataTransfer,targetRanges:r.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(o,r)=>{r.resultRange=i._pasteFragmentWithMarkers(r.content)},{priority:"low"})}_setupCopyCut(){const a=this.editor,e=a.model.document,t=a.editing.view.document,i=(o,r)=>{const s=r.dataTransfer;r.preventDefault(),this._fireOutputTransformationEvent(s,e.selection,o.name)};this.listenTo(t,"copy",i,{priority:"low"}),this.listenTo(t,"cut",(o,r)=>{a.model.canEditAt(a.model.document.selection)?i(o,r):r.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(o,r)=>{const s=a.data.toView(r.content,{isClipboardPipeline:!0});t.fire("clipboardOutput",{dataTransfer:r.dataTransfer,content:s,method:r.method})},{priority:"low"}),this.listenTo(t,"clipboardOutput",(o,r)=>{r.content.isEmpty||(r.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(r.content)),r.dataTransfer.setData("text/plain",G(a.data.htmlProcessor.domConverter,r.content)),r.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),r.method=="cut"&&a.model.deleteContent(e.selection)},{priority:"low"})}}const A=se("px");class be extends pe{constructor(){super();const a=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",a.if("isVisible","ck-hidden",e=>!e)],style:{left:a.to("left",e=>A(e)),top:a.to("top",e=>A(e)),width:a.to("width",e=>A(e))}}})}}class C extends _{constructor(){super(...arguments);m(this,"removeDropMarkerDelayed",K(()=>this.removeDropMarker(),40));m(this,"_updateDropMarkerThrottled",L(e=>this._updateDropMarker(e),40));m(this,"_reconvertMarkerThrottled",L(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0));m(this,"_dropTargetLineView",new be);m(this,"_domEmitter",new(S()));m(this,"_scrollables",new Map)}static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,n,t,i,o,r){this.removeDropMarkerDelayed.cancel();const s=N(this.editor,e,n,t,i,o,r);/* istanbul ignore next -- @preserve */if(s){if(r&&r.containsRange(s))return this.removeDropMarker();this._updateDropMarkerThrottled(s)}}getFinalDropRange(e,n,t,i,o,r){const s=N(this.editor,e,n,t,i,o,r);return this.removeDropMarker(),s}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(n=>{n.removeMarker("drop-target")})}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(n,{writer:t})=>{if(e.model.schema.checkChild(n.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(t);n.markerRange.isCollapsed?this._updateDropTargetLine(n.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const n=this.editor,t=n.model.markers;n.model.change(i=>{t.has("drop-target")?t.get("drop-target").getRange().isEqual(e)||i.updateMarker("drop-target",{range:e}):i.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(n){const t=this.toDomElement(n);return t.append("",n.createElement("span"),""),t})}_updateDropTargetLine(e){const n=this.editor.editing,t=e.start.nodeBefore,i=e.start.nodeAfter,o=e.start.parent,r=t?n.mapper.toViewElement(t):null,s=r?n.view.domConverter.mapViewToDom(r):null,c=i?n.mapper.toViewElement(i):null,d=c?n.view.domConverter.mapViewToDom(c):null,g=n.mapper.toViewElement(o);if(!g)return;const p=n.view.domConverter.mapViewToDom(g),h=this._getScrollableRect(g),{scrollX:u,scrollY:v}=f.window,O=s?new k(s):null,I=d?new k(d):null,E=new k(p).excludeScrollbarsAndBorders(),F=O?O.bottom:E.top,R=I?I.top:E.bottom,x=f.window.getComputedStyle(p),P=F<=R?(F+R)/2:R;if(h.top<P&&P<h.bottom){const Z=E.left+parseFloat(x.paddingLeft),ee=E.right-parseFloat(x.paddingRight),V=Math.max(Z+u,h.left),te=Math.min(ee+u,h.right);this._dropTargetLineView.set({isVisible:!0,left:V,top:P+v,width:te-V})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const n=e.root.rootName;let t;if(this._scrollables.has(n))t=this._scrollables.get(n).domElement;else{const i=this.editor.editing.view.domConverter.mapViewToDom(e);t=ke(i),this._domEmitter.listenTo(t,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const o=new oe(t,this._reconvertMarkerThrottled);this._scrollables.set(n,{domElement:t,resizeObserver:o})}return new k(t).excludeScrollbarsAndBorders()}}function N(l,a,e,n,t,i,o){const r=l.model,s=l.editing.mapper;let d=W(l,a);for(;d;){if(!i){if(r.schema.checkChild(d,"$text")){if(e){const g=e[0].start,p=s.toModelPosition(g);if(!o||Array.from(o.getItems({shallow:!0})).every(u=>r.schema.checkChild(p,u))){if(r.schema.checkChild(p,"$text"))return r.createRange(p);if(g)return M(l,W(l,g.parent),n,t)}}}else if(r.schema.isInline(d))return M(l,d,n,t)}if(r.schema.isBlock(d))return M(l,d,n,t);if(r.schema.checkChild(d,"$block")){const g=Array.from(d.getChildren()).filter(u=>u.is("element")&&!_e(l,u));let p=0,h=g.length;if(h==0)return r.createRange(r.createPositionAt(d,"end"));for(;p<h-1;){const u=Math.floor((p+h)/2);J(l,g[u],n,t)=="before"?h=u:p=u}return M(l,g[p],n,t)}d=d.parent}return null}function _e(l,a){const e=l.editing.mapper,n=l.editing.view.domConverter,t=e.toViewElement(a);if(!t)return!0;const i=n.mapViewToDom(t);return f.window.getComputedStyle(i).float!="none"}function M(l,a,e,n){const t=l.model;return t.createRange(t.createPositionAt(a,J(l,a,e,n)))}function J(l,a,e,n){const t=l.editing.mapper,i=l.editing.view.domConverter,o=t.toViewElement(a),r=i.mapViewToDom(o),s=new k(r);return l.model.schema.isInline(a)?e<(s.left+s.right)/2?"before":"after":n<(s.top+s.bottom)/2?"before":"after"}function W(l,a){const e=l.editing.mapper,n=l.editing.view,t=e.toModelElement(a);if(t)return t;const i=n.createPositionBefore(a),o=e.findMappedViewAncestor(i);return e.toModelElement(o)}function ke(l){let a=l;do{a=a.parentElement;const e=f.window.getComputedStyle(a).overflowY;if(e=="auto"||e=="scroll")break}while(a.tagName!="BODY");return a}class ve extends _{constructor(){super(...arguments);m(this,"_isBlockDragging",!1);m(this,"_domEmitter",new(S()))}static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(n,t,i)=>{i?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),b.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",(i,o)=>this._handleBlockDragStart(o)),this._domEmitter.listenTo(f.document,"dragover",(i,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(f.document,"drop",(i,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(f.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",(i,o,r)=>{t.setAttribute("draggable",r?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const n=this.editor.model,t=n.document.selection,i=this.editor.editing.view,o=Array.from(t.getSelectedBlocks()),r=n.createRange(n.createPositionBefore(o[0]),n.createPositionAfter(o[o.length-1]));n.change(s=>s.setSelection(r)),this._isBlockDragging=!0,i.focus(),i.getObserver(D).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const n=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),t=e.clientY,i=document.elementFromPoint(n,t),o=this.editor.editing.view;!i||!i.closest(".ck-editor__editable")||o.getObserver(D).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:i,clientX:n,clientY:t,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class ye extends _{constructor(){super(...arguments);m(this,"_draggedRange");m(this,"_draggingUid");m(this,"_draggableElement");m(this,"_clearDraggableAttributesDelayed",K(()=>this._clearDraggableAttributes(),40));m(this,"_blockMode",!1);m(this,"_domEmitter",new(S()));m(this,"_previewContainer")}static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[T,ge,C,ve]}init(){const e=this.editor,n=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,n.addObserver(D),n.addObserver(ae),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(t,i,o)=>{o?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(t,i,o)=>{o||this._finalizeDragging(!1)}),b.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,n=e.model,t=e.editing.view,i=t.document,o=e.plugins.get(C);this.listenTo(i,"dragstart",(r,s)=>{var v;if((v=s.target)!=null&&v.is("editableElement")){s.preventDefault();return}if(this._prepareDraggedRange(s.target),!this._draggedRange){s.preventDefault();return}this._draggingUid=H(),s.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",s.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const c=n.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(s.dataTransfer,c,"dragstart");const{dataTransfer:g,domTarget:p,domEvent:h}=s,{clientX:u}=h;this._updatePreview({dataTransfer:g,domTarget:p,clientX:u}),s.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(i,"dragend",(r,s)=>{this._finalizeDragging(!s.dataTransfer.isCanceled&&s.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(f.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(i,"dragenter",()=>{this.isEnabled&&t.focus()}),this.listenTo(i,"dragleave",()=>{o.removeDropMarkerDelayed()}),this.listenTo(i,"dragging",(r,s)=>{if(!this.isEnabled){s.dataTransfer.dropEffect="none";return}const{clientX:c,clientY:d}=s.domEvent;o.updateDropMarker(s.target,s.targetRanges,c,d,this._blockMode,this._draggedRange),this._draggedRange||(s.dataTransfer.dropEffect="copy"),b.isGecko||(s.dataTransfer.effectAllowed=="copy"?s.dataTransfer.dropEffect="copy":["all","copyMove"].includes(s.dataTransfer.effectAllowed)&&(s.dataTransfer.dropEffect="move")),r.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get(C);this.listenTo(t,"clipboardInput",(o,r)=>{if(r.method!="drop")return;const{clientX:s,clientY:c}=r.domEvent,d=i.getFinalDropRange(r.target,r.targetRanges,s,c,this._blockMode,this._draggedRange);if(!d){this._finalizeDragging(!1),o.stop();return}if(this._draggedRange&&this._draggingUid!=r.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),q(r.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(d,!0)){this._finalizeDragging(!1),o.stop();return}r.targetRanges=[e.editing.mapper.toViewRange(d)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(T);e.on("contentInsertion",(n,t)=>{if(!this.isEnabled||t.method!=="drop")return;const i=t.targetRanges.map(o=>this.editor.editing.mapper.toModelRange(o));this.editor.model.change(o=>o.setSelection(i))},{priority:"high"}),e.on("contentInsertion",(n,t)=>{if(!this.isEnabled||t.method!=="drop")return;const i=q(t.dataTransfer)=="move",o=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(o&&i)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,n=e.editing.view,t=n.document;this.listenTo(t,"mousedown",(i,o)=>{if(b.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=z(o.target);if(b.isBlink&&!e.isReadOnly&&!r&&!t.selection.isCollapsed){const s=t.selection.getSelectedElement();(!s||!y(s))&&(r=t.selection.editableElement)}r&&(n.change(s=>{s.setAttribute("draggable","true",r)}),this._draggableElement=e.editing.mapper.toModelElement(r))}),this.listenTo(t,"mouseup",()=>{b.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(n=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&n.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const n=this.editor,t=n.model;n.plugins.get(C).removeDropMarker(),this._clearDraggableAttributes(),n.plugins.has("WidgetToolbarRepository")&&n.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&t.change(o=>{const r=t.createSelection(this._draggedRange);t.deleteContent(r,{doNotAutoparagraph:!0});const s=r.getFirstPosition().parent;s.isEmpty&&!t.schema.checkChild(s,"$text")&&t.schema.checkChild(s,"paragraph")&&o.insertElement("paragraph",s,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const n=this.editor,t=n.model,i=t.document.selection,o=e?z(e):null;if(o){const d=n.editing.mapper.toModelElement(o);this._draggedRange=w.fromRange(t.createRangeOn(d)),this._blockMode=t.schema.isBlock(d),n.plugins.has("WidgetToolbarRepository")&&n.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const r=Array.from(i.getSelectedBlocks()),s=i.getFirstRange();if(r.length==0){this._draggedRange=w.fromRange(s);return}const c=Q(t,r);if(r.length>1)this._draggedRange=w.fromRange(c),this._blockMode=!0;else if(r.length==1){const d=s.start.isTouching(c.start)&&s.end.isTouching(c.end);this._draggedRange=w.fromRange(d?c:s),this._blockMode=d}t.change(d=>d.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:n,clientX:t}){const i=this.editor.editing.view,o=i.document.selection.editableElement,r=i.domConverter.mapViewToDom(o),s=f.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=B(f.document,"div",{style:"position: fixed; left: -999999px;"}),f.document.body.appendChild(this._previewContainer));const c=new k(r);if(r.contains(n))return;const d=parseFloat(s.paddingLeft),g=B(f.document,"div");g.className="ck ck-content",g.style.width=s.width,g.style.paddingLeft=`${c.left-t+d}px`,b.isiOS&&(g.style.backgroundColor="white"),i.domConverter.setContentOf(g,e.getData("text/html")),e.setDragImage(g,0,0),this._previewContainer.appendChild(g)}}function q(l){return b.isGecko?l.dropEffect:["all","copyMove"].includes(l.effectAllowed)?"move":"copy"}function z(l){if(l.is("editableElement"))return null;if(l.hasClass("ck-widget__selection-handle"))return l.findAncestor(y);if(y(l))return l;const a=l.findAncestor(e=>y(e)||e.is("editableElement"));return y(a)?a:null}function Q(l,a){const e=a[0],n=a[a.length-1],t=e.getCommonAncestor(n),i=l.createPositionBefore(e),o=l.createPositionAfter(n);if(t&&t.is("element")&&!l.schema.isLimit(t)){const r=l.createRangeOn(t),s=i.isTouching(r.start),c=o.isTouching(r.end);if(s&&c)return Q(l,[t])}return l.createRange(i,o)}class De extends _{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[T]}init(){const a=this.editor,e=a.model,n=a.editing.view,t=e.document.selection;n.addObserver(D),a.plugins.get(T).on("contentInsertion",(i,o)=>{Te(o.content,e)&&e.change(r=>{const s=Array.from(t.getAttributes()).filter(([d])=>e.schema.getAttributeProperties(d).isFormatting);t.isCollapsed||e.deleteContent(t,{doNotAutoparagraph:!0}),s.push(...t.getAttributes());const c=r.createRangeIn(o.content);for(const d of c.getItems())for(const g of s)e.schema.checkAttribute(d,g[0])&&r.setAttribute(g[0],g[1],d)})})}}function Te(l,a){let e=a.createRangeIn(l);if(l.childCount==1){const n=l.getChild(0);n.is("element")&&a.schema.isBlock(n)&&!a.schema.isObject(n)&&!a.schema.isLimit(n)&&(e=a.createRangeIn(n))}for(const n of e.getItems())if(!a.schema.isInline(n)||Array.from(n.getAttributeKeys()).find(i=>a.schema.getAttributeProperties(i).isFormatting))return!1;return!0}class Oe extends _{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[Y,T,ye,De]}init(){const a=this.editor,e=this.editor.t;a.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Copy selected content"),keystroke:"CTRL+C"},{label:e("Paste content"),keystroke:"CTRL+V"},{label:e("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}export{Oe as Clipboard,Y as ClipboardMarkersUtils,D as ClipboardObserver,T as ClipboardPipeline,ye as DragDrop,ve as DragDropBlockToolbar,C as DragDropTarget,De as PastePlainText,ue as plainTextToHtml,G as viewToPlainText};
|
|
20
|
+
`:""}class G extends b{_markersToCopy=new Map;static get pluginName(){return"ClipboardMarkersUtils"}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,r=n=>n.model.getSelectedContent(n.model.document.selection)){return this.editor.model.change(n=>{const s=n.model.document.selection;n.setSelection(t);const o=this._insertFakeMarkersIntoSelection(n,n.model.document.selection,e),i=r(n),l=this._removeFakeMarkersInsideElement(n,i);for(const[c,d]of Object.entries(o)){l[c]||=n.createRangeIn(i);for(const g of d)n.remove(g)}i.markers.clear();for(const[c,d]of Object.entries(l))i.markers.set(c,d);return n.setSelection(s),i})}_pasteMarkersIntoTransformedElement(e,t){const r=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(n=>{const s=this._insertFakeMarkersElements(n,r),o=t(n),i=this._removeFakeMarkersInsideElement(n,o);for(const l of Object.values(s).flat())n.remove(l);for(const[l,c]of Object.entries(i))n.model.markers.has(l)||n.addMarker(l,{usingOperation:!0,affectsData:!0,range:c});return o})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const r of t)e.markers.set(r.name,r.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,r={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const n=this._markersToCopy.get(e);this._markersToCopy.set(e,r),t(),n?this._markersToCopy.set(e,n):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const r=this._getMarkerClipboardConfig(e);if(!r)return!1;if(!t)return!0;const{allowedActions:n}=r;return n==="all"||n.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,r){const n=this._getCopyableMarkersFromSelection(e,t,r);return this._insertFakeMarkersElements(e,n)}_getCopyableMarkersFromSelection(e,t,r){const n=Array.from(t.getRanges()),s=new Set(n.flatMap(i=>Array.from(e.model.markers.getMarkersIntersectingRange(i)))),o=i=>{if(!this._isMarkerCopyable(i.name,r))return!1;const{copyPartiallySelected:c}=this._getMarkerClipboardConfig(i.name);if(!c){const d=i.getRange();return n.some(g=>g.containsRange(d,!0))}return!0};return Array.from(s).filter(o).map(i=>({name:r==="dragstart"?this._getUniqueMarkerName(i.name):i.name,range:i.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:r}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([s,o])=>{if(!this._hasMarkerConfiguration(s))return[{name:s,range:o}];if(this._isMarkerCopyable(s,t)){const i=this._getMarkerClipboardConfig(s),l=r.markers.has(s)&&r.markers.get(s).getRange().root.rootName==="$graveyard";return(i.duplicateOnPaste||l)&&(s=this._getUniqueMarkerName(s)),[{name:s,range:o}]}return[]})}_insertFakeMarkersElements(e,t){const r={},n=t.flatMap(s=>{const{start:o,end:i}=s.range;return[{position:o,marker:s,type:"start"},{position:i,marker:s,type:"end"}]}).sort(({position:s},{position:o})=>s.isBefore(o)?1:-1);for(const{position:s,marker:o,type:i}of n){const l=e.createElement("$marker",{"data-name":o.name,"data-type":i});r[o.name]||(r[o.name]=[]),r[o.name].push(l),e.insert(l,s)}return r}_removeFakeMarkersInsideElement(e,t){const n=this._getAllFakeMarkersFromElement(e,t).reduce((s,o)=>{const i=o.markerElement&&e.createPositionBefore(o.markerElement);let l=s[o.name],c=!1;return l?.start&&l?.end&&(this._getMarkerClipboardConfig(o.name).duplicateOnPaste?s[this._getUniqueMarkerName(o.name)]=s[o.name]:c=!0,l=null),c||(s[o.name]={...l,[o.type]:i}),o.markerElement&&e.remove(o.markerElement),s},{});return ce(n,s=>new se(s.start||e.createPositionFromPath(t,[0]),s.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const r=Array.from(e.createRangeIn(t)).flatMap(({item:o})=>{if(!o.is("element","$marker"))return[];const i=o.getAttribute("data-name"),l=o.getAttribute("data-type");return[{markerElement:o,name:i,type:l}]}),n=[],s=[];for(const o of r)o.type==="end"&&(r.some(l=>l.name===o.name&&l.type==="start")||n.push({markerElement:null,name:o.name,type:"start"})),o.type==="start"&&(r.some(l=>l.name===o.name&&l.type==="end")||s.unshift({markerElement:null,name:o.name,type:"end"}));return[...n,...r,...s]}_getUniqueMarkerName(e){const t=e.split(":"),r=z().substring(1,6);return t.length===3?`${t.slice(0,2).join(":")}:${r}`:`${t.join(":")}:${r}`}}class y extends b{static get pluginName(){return"ClipboardPipeline"}static get isOfficialPlugin(){return!0}static get requires(){return[G]}init(){this.editor.editing.view.addObserver(v),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,r){const n=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:r==="cut"},()=>{const s=n._copySelectedFragmentWithMarkers(r,t);this.fire("outputTransformation",{dataTransfer:e,content:s,method:r})})}_setupPasteDrop(){const e=this.editor,t=e.model,r=e.editing.view,n=r.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(n,"clipboardInput",(o,i)=>{i.method=="paste"&&!e.model.canEditAt(e.model.document.selection)&&o.stop()},{priority:"highest"}),this.listenTo(n,"clipboardInput",(o,i)=>{const l=i.dataTransfer;let c;if(i.content)c=i.content;else{let p="";l.getData("text/html")?p=ge(l.getData("text/html")):l.getData("text/plain")&&(p=de(l.getData("text/plain"))),c=this.editor.data.htmlProcessor.toView(p)}const d=new q(this,"inputTransformation"),g=l.getData("application/ckeditor5-editor-id")||null;this.fire(d,{content:c,dataTransfer:l,sourceEditorId:g,targetRanges:i.targetRanges,method:i.method}),d.stop.called&&o.stop(),r.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(o,i)=>{if(i.content.isEmpty)return;const c=this.editor.data.toModel(i.content,"$clipboardHolder");c.childCount!=0&&(o.stop(),t.change(()=>{this.fire("contentInsertion",{content:c,method:i.method,sourceEditorId:i.sourceEditorId,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(o,i)=>{i.resultRange=s._pasteFragmentWithMarkers(i.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,n=e.editing.view.document,s=(o,i)=>{const l=i.dataTransfer;i.preventDefault(),this._fireOutputTransformationEvent(l,t.selection,o.name)};this.listenTo(n,"copy",s,{priority:"low"}),this.listenTo(n,"cut",(o,i)=>{e.model.canEditAt(e.model.document.selection)?s(o,i):i.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(o,i)=>{const l=e.data.toView(i.content,{isClipboardPipeline:!0});n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:l,method:i.method})},{priority:"low"}),this.listenTo(n,"clipboardOutput",(o,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",H(e.data.htmlProcessor.domConverter,i.content)),i.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),i.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}const P=re("px");class me extends le{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>P(t)),top:e.to("top",t=>P(t)),width:e.to("width",t=>P(t))}}})}}class E extends b{removeDropMarkerDelayed=j(()=>this.removeDropMarker(),40);_updateDropMarkerThrottled=V(e=>this._updateDropMarker(e),40);_reconvertMarkerThrottled=V(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0);_dropTargetLineView=new me;_domEmitter=new(A());_scrollables=new Map;static get pluginName(){return"DragDropTarget"}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,r,n,s,o){this.removeDropMarkerDelayed.cancel();const i=U(this.editor,e,t,r,n,s,o);/* istanbul ignore next -- @preserve */if(i){if(o&&o.containsRange(i))return this.removeDropMarker();this._updateDropMarkerThrottled(i)}}getFinalDropRange(e,t,r,n,s,o){const i=U(this.editor,e,t,r,n,s,o);return this.removeDropMarker(),i}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:r})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(r);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,r=t.model.markers;t.model.change(n=>{r.has("drop-target")?r.get("drop-target").getRange().isEqual(e)||n.updateMarker("drop-target",{range:e}):n.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(t){const r=this.toDomElement(t);return r.append("",t.createElement("span"),""),r})}_updateDropTargetLine(e){const t=this.editor.editing,r=e.start.nodeBefore,n=e.start.nodeAfter,s=e.start.parent,o=r?t.mapper.toViewElement(r):null,i=o?t.view.domConverter.mapViewToDom(o):null,l=n?t.mapper.toViewElement(n):null,c=l?t.view.domConverter.mapViewToDom(l):null,d=t.mapper.toViewElement(s);if(!d)return;const g=t.view.domConverter.mapViewToDom(d),p=this._getScrollableRect(d),{scrollX:u,scrollY:h}=m.window,M=i?new _(i):null,S=c?new _(c):null,D=new _(g).excludeScrollbarsAndBorders(),O=M?M.bottom:D.top,C=S?S.top:D.bottom,I=m.window.getComputedStyle(g),R=O<=C?(O+C)/2:C;if(p.top<R&&R<p.bottom){const J=D.left+parseFloat(I.paddingLeft),Q=D.right-parseFloat(I.paddingRight),F=Math.max(J+u,p.left),Z=Math.min(Q+u,p.right);this._dropTargetLineView.set({isVisible:!0,left:F,top:R+h,width:Z-F})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let r;if(this._scrollables.has(t))r=this._scrollables.get(t).domElement;else{const n=this.editor.editing.view.domConverter.mapViewToDom(e);r=he(n),this._domEmitter.listenTo(r,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const s=new te(r,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:r,resizeObserver:s})}return new _(r).excludeScrollbarsAndBorders()}}function U(a,e,t,r,n,s,o){const i=a.model,l=a.editing.mapper;let d=$(a,e);for(;d;){if(!s){if(i.schema.checkChild(d,"$text")){if(t){const g=t[0].start,p=l.toModelPosition(g);if(!o||Array.from(o.getItems({shallow:!0})).every(h=>i.schema.checkChild(p,h))){if(i.schema.checkChild(p,"$text"))return i.createRange(p);if(g)return w(a,$(a,g.parent),r,n)}}}else if(i.schema.isInline(d))return w(a,d,r,n)}if(i.schema.isBlock(d))return w(a,d,r,n);if(i.schema.checkChild(d,"$block")){const g=Array.from(d.getChildren()).filter(h=>h.is("element")&&!ue(a,h));let p=0,u=g.length;if(u==0)return i.createRange(i.createPositionAt(d,"end"));for(;p<u-1;){const h=Math.floor((p+u)/2);X(a,g[h],r,n)=="before"?u=h:p=h}return w(a,g[p],r,n)}d=d.parent}return null}function ue(a,e){const t=a.editing.mapper,r=a.editing.view.domConverter,n=t.toViewElement(e);if(!n)return!0;const s=r.mapViewToDom(n);return m.window.getComputedStyle(s).float!="none"}function w(a,e,t,r){const n=a.model;return n.createRange(n.createPositionAt(e,X(a,e,t,r)))}function X(a,e,t,r){const n=a.editing.mapper,s=a.editing.view.domConverter,o=n.toViewElement(e),i=s.mapViewToDom(o),l=new _(i);return a.model.schema.isInline(e)?t<(l.left+l.right)/2?"before":"after":r<(l.top+l.bottom)/2?"before":"after"}function $(a,e){const t=a.editing.mapper,r=a.editing.view,n=t.toModelElement(e);if(n)return n;const s=r.createPositionBefore(e),o=t.findMappedViewAncestor(s);return t.toModelElement(o)}function he(a){let e=a;do{e=e.parentElement;const t=m.window.getComputedStyle(e).overflowY;if(t=="auto"||t=="scroll")break}while(e.tagName!="BODY");return e}class fe extends b{_isBlockDragging=!1;_domEmitter=new(A());static get pluginName(){return"DragDropBlockToolbar"}static get isOfficialPlugin(){return!0}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,r,n)=>{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),f.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const r=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(r,"dragstart",(n,s)=>this._handleBlockDragStart(s)),this._domEmitter.listenTo(m.document,"dragover",(n,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(m.document,"drop",(n,s)=>this._handleBlockDragging(s)),this._domEmitter.listenTo(m.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&r.setAttribute("draggable","true"),this.on("change:isEnabled",(n,s,o)=>{r.setAttribute("draggable",o?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,r=t.document.selection,n=this.editor.editing.view,s=Array.from(r.getSelectedBlocks()),o=t.createRange(t.createPositionBefore(s[0]),t.createPositionAfter(s[s.length-1]));t.change(i=>i.setSelection(o)),this._isBlockDragging=!0,n.focus(),n.getObserver(v).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),r=e.clientY,n=document.elementFromPoint(t,r),s=this.editor.editing.view;!n||!n.closest(".ck-editor__editable")||s.getObserver(v).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:n,clientX:t,clientY:r,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class be extends b{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=j(()=>this._clearDraggableAttributes(),40);_blockMode=!1;_domEmitter=new(A());_previewContainer;static get pluginName(){return"DragDrop"}static get isOfficialPlugin(){return!0}static get requires(){return[y,ae,E,fe]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(v),t.addObserver(ne),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(r,n,s)=>{s?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(r,n,s)=>{s||this._finalizeDragging(!1)}),f.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,r=e.editing.view,n=r.document,s=e.plugins.get(E);this.listenTo(n,"dragstart",(o,i)=>{if(i.target?.is("editableElement")){i.preventDefault();return}if(this._prepareDraggedRange(i.target),!this._draggedRange){i.preventDefault();return}this._draggingUid=z(),i.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",i.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(i.dataTransfer,l,"dragstart");const{dataTransfer:d,domTarget:g,domEvent:p}=i,{clientX:u}=p;this._updatePreview({dataTransfer:d,domTarget:g,clientX:u}),i.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(n,"dragend",(o,i)=>{this._finalizeDragging(!i.dataTransfer.isCanceled&&i.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(m.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(n,"dragenter",()=>{this.isEnabled&&r.focus()}),this.listenTo(n,"dragleave",()=>{s.removeDropMarkerDelayed()}),this.listenTo(n,"dragging",(o,i)=>{if(!this.isEnabled){i.dataTransfer.dropEffect="none";return}const{clientX:l,clientY:c}=i.domEvent;s.updateDropMarker(i.target,i.targetRanges,l,c,this._blockMode,this._draggedRange),this._draggedRange||(i.dataTransfer.dropEffect="copy"),f.isGecko||(i.dataTransfer.effectAllowed=="copy"?i.dataTransfer.dropEffect="copy":["all","copyMove"].includes(i.dataTransfer.effectAllowed)&&(i.dataTransfer.dropEffect="move")),o.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,r=e.editing.view.document,n=e.plugins.get(E);this.listenTo(r,"clipboardInput",(s,o)=>{if(o.method!="drop")return;const{clientX:i,clientY:l}=o.domEvent,c=n.getFinalDropRange(o.target,o.targetRanges,i,l,this._blockMode,this._draggedRange);if(!c){this._finalizeDragging(!1),s.stop();return}if(this._draggedRange&&this._draggingUid!=o.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),N(o.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(c,!0)){this._finalizeDragging(!1),s.stop();return}o.targetRanges=[e.editing.mapper.toViewRange(c)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(y);e.on("contentInsertion",(t,r)=>{if(!this.isEnabled||r.method!=="drop")return;const n=r.targetRanges.map(s=>this.editor.editing.mapper.toModelRange(s));this.editor.model.change(s=>s.setSelection(n))},{priority:"high"}),e.on("contentInsertion",(t,r)=>{if(!this.isEnabled||r.method!=="drop")return;const n=N(r.dataTransfer)=="move",s=!r.resultRange||!r.resultRange.isCollapsed;this._finalizeDragging(s&&n)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,r=t.document;this.listenTo(r,"mousedown",(n,s)=>{if(f.isAndroid||!s)return;this._clearDraggableAttributesDelayed.cancel();let o=W(s.target);if(f.isBlink&&!e.isReadOnly&&!o&&!r.selection.isCollapsed){const i=r.selection.getSelectedElement();(!i||!k(i))&&(o=r.selection.editableElement)}o&&(t.change(i=>{i.setAttribute("draggable","true",o)}),this._draggableElement=e.editing.mapper.toModelElement(o))}),this.listenTo(r,"mouseup",()=>{f.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,r=t.model;t.plugins.get(E).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&r.change(s=>{const o=r.createSelection(this._draggedRange);r.deleteContent(o,{doNotAutoparagraph:!0});const i=o.getFirstPosition().parent;i.isEmpty&&!r.schema.checkChild(i,"$text")&&r.schema.checkChild(i,"paragraph")&&s.insertElement("paragraph",i,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,r=t.model,n=r.document.selection,s=e?W(e):null;if(s){const c=t.editing.mapper.toModelElement(s);this._draggedRange=T.fromRange(r.createRangeOn(c)),this._blockMode=r.schema.isBlock(c),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(n.isCollapsed&&!n.getFirstPosition().parent.isEmpty)return;const o=Array.from(n.getSelectedBlocks()),i=n.getFirstRange();if(o.length==0){this._draggedRange=T.fromRange(i);return}const l=Y(r,o);if(o.length>1)this._draggedRange=T.fromRange(l),this._blockMode=!0;else if(o.length==1){const c=i.start.isTouching(l.start)&&i.end.isTouching(l.end);this._draggedRange=T.fromRange(c?l:i),this._blockMode=c}r.change(c=>c.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:r}){const n=this.editor.editing.view,s=n.document.selection.editableElement,o=n.domConverter.mapViewToDom(s),i=m.window.getComputedStyle(o);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=x(m.document,"div",{style:"position: fixed; left: -999999px;"}),m.document.body.appendChild(this._previewContainer));const l=new _(o);if(o.contains(t))return;const c=parseFloat(i.paddingLeft),d=x(m.document,"div");d.className="ck ck-content",d.style.width=i.width,d.style.paddingLeft=`${l.left-r+c}px`,f.isiOS&&(d.style.backgroundColor="white"),n.domConverter.setContentOf(d,e.getData("text/html")),e.setDragImage(d,0,0),this._previewContainer.appendChild(d)}}function N(a){return f.isGecko?a.dropEffect:["all","copyMove"].includes(a.effectAllowed)?"move":"copy"}function W(a){if(a.is("editableElement"))return null;if(a.hasClass("ck-widget__selection-handle"))return a.findAncestor(k);if(k(a))return a;const e=a.findAncestor(t=>k(t)||t.is("editableElement"));return k(e)?e:null}function Y(a,e){const t=e[0],r=e[e.length-1],n=t.getCommonAncestor(r),s=a.createPositionBefore(t),o=a.createPositionAfter(r);if(n&&n.is("element")&&!a.schema.isLimit(n)){const i=a.createRangeOn(n),l=s.isTouching(i.start),c=o.isTouching(i.end);if(l&&c)return Y(a,[n])}return a.createRange(s,o)}class _e extends b{static get pluginName(){return"PastePlainText"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}init(){const e=this.editor,t=e.model,r=e.editing.view,n=t.document.selection;r.addObserver(v),e.plugins.get(y).on("contentInsertion",(s,o)=>{ke(o.content,t)&&t.change(i=>{const l=Array.from(n.getAttributes()).filter(([d])=>t.schema.getAttributeProperties(d).isFormatting);n.isCollapsed||t.deleteContent(n,{doNotAutoparagraph:!0}),l.push(...n.getAttributes());const c=i.createRangeIn(o.content);for(const d of c.getItems())for(const g of l)t.schema.checkAttribute(d,g[0])&&i.setAttribute(g[0],g[1],d)})})}}function ke(a,e){let t=e.createRangeIn(a);if(a.childCount==1){const r=a.getChild(0);r.is("element")&&e.schema.isBlock(r)&&!e.schema.isObject(r)&&!e.schema.isLimit(r)&&(t=e.createRangeIn(r))}for(const r of t.getItems())if(!e.schema.isInline(r)||Array.from(r.getAttributeKeys()).find(s=>e.schema.getAttributeProperties(s).isFormatting))return!1;return!0}class Ce extends b{static get pluginName(){return"Clipboard"}static get isOfficialPlugin(){return!0}static get requires(){return[G,y,be,_e]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}export{Ce as Clipboard,G as ClipboardMarkersUtils,v as ClipboardObserver,y as ClipboardPipeline,be as DragDrop,fe as DragDropBlockToolbar,E as DragDropTarget,_e as PastePlainText,de as plainTextToHtml,H as viewToPlainText};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{ContextPlugin as f}from"../../../../../@ckeditor_ckeditor5-core@45.2.1/node_modules/@ckeditor/ckeditor5-core/dist/index.js";import{CKEditorError as i,ObservableMixin as p,logWarning as _,EmitterMixin as g}from"../../../../../@ckeditor_ckeditor5-utils@45.2.1/node_modules/@ckeditor/ckeditor5-utils/dist/index.js";/**
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/const
|
|
4
|
+
*/const T={autoRefresh:!0},d=36e5,k=5e3;class l extends p(){_refresh;_options;_tokenRefreshTimeout;_isDestroyed=!1;constructor(e,t={}){if(super(),!e)throw new i("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),typeof e=="function"?this._refresh=e:this._refresh=()=>w(e),this._options={...T,...t}}init(){return new Promise((e,t)=>{if(!this.value){this.refreshToken().then(e).catch(t);return}this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)})}refreshToken(){const e=this._options.autoRefresh;return this._refresh().then(t=>(this._validateTokenValue(t),this.set("value",t),e&&this._registerRefreshTokenTimeout(),this)).catch(t=>{throw _("token-refresh-failed",{autoRefresh:e}),e&&this._registerRefreshTokenTimeout(k),t})}destroy(){this._isDestroyed=!0,clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t=typeof e=="string",r=!/^".*"$/.test(e),s=t&&e.split(".").length===3;if(!(r&&s))throw new i("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(e){if(clearTimeout(this._tokenRefreshTimeout),this._isDestroyed)return;const t=e||this._getTokenRefreshTimeoutTime();this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},t)}_getTokenRefreshTimeoutTime(){try{const[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));return t?Math.floor((t*1e3-Date.now())/2):d}catch{return d}}static create(e,t={}){return new l(e,t).init()}}function w(n){return new Promise((e,t)=>{const r=new XMLHttpRequest;r.open("GET",n),r.addEventListener("load",()=>{const s=r.status,o=r.response;return s<200||s>299?t(new i("token-cannot-download-new-token",null)):e(o)}),r.addEventListener("error",()=>t(new Error("Network Error"))),r.addEventListener("abort",()=>t(new Error("Abort"))),r.send()})}const h=/^data:(\S*?);base64,/;class m extends g(){file;xhr;_token;_apiAddress;constructor(e,t,r){if(super(),!e)throw new i("fileuploader-missing-file",null);if(!t)throw new i("fileuploader-missing-token",null);if(!r)throw new i("fileuploader-missing-api-address",null);this.file=R(e)?E(e):e,this._token=t,this._apiAddress=r}onProgress(e){return this.on("progress",(t,r)=>e(r)),this}onError(e){return this.once("error",(t,r)=>e(r)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e}_attachXHRListeners(){const e=this.xhr,t=r=>()=>this.fire("error",r);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort"));/* istanbul ignore else -- @preserve */e.upload&&e.upload.addEventListener("progress",r=>{r.lengthComputable&&this.fire("progress",{total:r.total,uploaded:r.loaded})}),e.addEventListener("load",()=>{const r=e.status,s=e.response;if(r<200||r>299)return this.fire("error",s.message||s.error)})}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((r,s)=>{t.addEventListener("load",()=>{const o=t.status,a=t.response;return o<200||o>299?a.message?s(new i("fileuploader-uploading-data-failed",this,{message:a.message})):s(a.error):r(a)}),t.addEventListener("error",()=>s(new Error("Network Error"))),t.addEventListener("abort",()=>s(new Error("Abort"))),t.send(e)})}}function E(n,e=512){try{const t=n.match(h)[1],r=atob(n.replace(h,"")),s=[];for(let o=0;o<r.length;o+=e){const a=r.slice(o,o+e),c=new Array(a.length);for(let u=0;u<a.length;u++)c[u]=a.charCodeAt(u);s.push(new Uint8Array(c))}return new Blob(s,{type:t})}catch{throw new i("fileuploader-decoding-image-data-error",null)}}function R(n){return typeof n!="string"?!1:!!n.match(h)?.length}class v{_token;_apiAddress;constructor(e,t){if(!e)throw new i("uploadgateway-missing-token",null);if(!t)throw new i("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new m(e,this._token,this._apiAddress)}}class y extends f{static get pluginName(){return"CloudServicesCore"}static get isOfficialPlugin(){return!0}createToken(e,t){return new l(e,t)}createUploadGateway(e,t){return new v(e,t)}}class C extends f{tokenUrl;uploadUrl;webSocketUrl;bundleVersion;token=null;_tokens=new Map;static get pluginName(){return"CloudServices"}static get isOfficialPlugin(){return!0}static get requires(){return[y]}async init(){const t=this.context.config.get("cloudServices")||{};for(const[o,a]of Object.entries(t))this[o]=a;if(!this.tokenUrl){this.token=null;return}const s=this.context.plugins.get("CloudServicesCore").createToken(this.tokenUrl);try{this.token=await s.init(),this._tokens.set(this.tokenUrl,this.token)}catch(o){throw s.destroy(),o}}async registerTokenUrl(e){if(this._tokens.has(e))return this.getTokenFor(e);const r=await this.context.plugins.get("CloudServicesCore").createToken(e).init();return this._tokens.set(e,r),r}getTokenFor(e){const t=this._tokens.get(e);if(!t)throw new i("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(const e of this._tokens.values())e.destroy()}}export{C as CloudServices,y as CloudServicesCore,l as Token};
|