@paperless/core 2.22.0-alpha.25 → 2.22.0-alpha.27
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/build/index.esm.js +1 -1
- package/dist/build/{p-0305046c.entry.js → p-0388615e.entry.js} +1 -1
- package/dist/{paperless/p-4d456377.entry.js → build/p-0d6f3aa3.entry.js} +1 -1
- package/dist/{paperless/p-958c8a2c.entry.js → build/p-14223e98.entry.js} +1 -1
- package/dist/build/{p-b37d0053.entry.js → p-166704d6.entry.js} +1 -1
- package/dist/{paperless/p-8bd7c93a.entry.js → build/p-17e598ac.entry.js} +1 -1
- package/dist/build/{p-842a9f3e.entry.js → p-18454ce9.entry.js} +1 -1
- package/dist/build/{p-a4109895.entry.js → p-1cbe78fd.entry.js} +1 -1
- package/dist/build/{p-9b6d9292.entry.js → p-1f15cd98.entry.js} +1 -1
- package/dist/build/{p-14a2caa3.entry.js → p-1f7ab568.entry.js} +1 -1
- package/dist/build/{p-ad468b70.entry.js → p-20077155.entry.js} +1 -1
- package/dist/build/{p-8d0c1f36.entry.js → p-23cc6b6b.entry.js} +1 -1
- package/dist/build/{p-7ae963de.entry.js → p-2e67ae6a.entry.js} +1 -1
- package/dist/build/p-3452b2f5.entry.js +3 -0
- package/dist/build/{p-93bbde98.entry.js → p-44da0b12.entry.js} +1 -1
- package/dist/build/{p-846f47bd.entry.js → p-464fd7c4.entry.js} +1 -1
- package/dist/build/{p-ea311062.entry.js → p-50de21e1.entry.js} +1 -1
- package/dist/build/{p-0eb7a6e4.entry.js → p-524eb1cb.entry.js} +1 -1
- package/dist/build/{p-870a63fb.entry.js → p-561dabe7.entry.js} +1 -1
- package/dist/build/p-5a2d19ec.entry.js +1 -0
- package/dist/{paperless/p-bfb06294.entry.js → build/p-5abcc8d2.entry.js} +1 -1
- package/dist/build/{p-e6222abf.entry.js → p-5c5cdb06.entry.js} +1 -1
- package/dist/{paperless/p-400ae3ad.entry.js → build/p-60a3f1ee.entry.js} +1 -1
- package/dist/build/{p-30a23dba.entry.js → p-6df6a0ba.entry.js} +1 -1
- package/dist/{paperless/p-e9d2bdd6.entry.js → build/p-76f83633.entry.js} +1 -1
- package/dist/{paperless/p-62c4c7d7.entry.js → build/p-78b15121.entry.js} +1 -1
- package/dist/build/{p-df6e3bdf.entry.js → p-7ac9dc1e.entry.js} +1 -1
- package/dist/{paperless/p-0c094c99.entry.js → build/p-7d018d4d.entry.js} +1 -1
- package/dist/build/{p-a23a90d6.entry.js → p-80922205.entry.js} +1 -1
- package/dist/build/{p-1ce28114.entry.js → p-8382e7c2.entry.js} +1 -1
- package/dist/build/p-84c43a3d.entry.js +1 -0
- package/dist/build/{p-1b3ebeb4.entry.js → p-8644a3f1.entry.js} +1 -1
- package/dist/build/{p-8ed529ba.entry.js → p-8824a0ef.entry.js} +1 -1
- package/dist/build/{p-9a49375d.entry.js → p-93ce18e4.entry.js} +1 -1
- package/dist/build/p-98f188a7.css +1 -0
- package/dist/{paperless/p-f3daeb8f.entry.js → build/p-9cdee500.entry.js} +1 -1
- package/dist/build/{p-389f92f8.entry.js → p-9f51b9dc.entry.js} +1 -1
- package/dist/build/p-9fd28756.entry.js +1 -0
- package/dist/build/{p-PW1zQoNr.js → p-BDccsg1s.js} +2 -2
- package/dist/build/p-BErFyukm.js +1 -0
- package/dist/build/p-CEaB2BT0.js +1 -0
- package/dist/build/p-CHZgJJeM.js +1 -0
- package/dist/build/{p-DzdX_Z5B.js → p-Jt5e0RAn.js} +1 -1
- package/dist/build/{p-e30abf73.entry.js → p-a232b345.entry.js} +1 -1
- package/dist/build/{p-4793863e.entry.js → p-a7d200c3.entry.js} +1 -1
- package/dist/build/{p-a91d2d7d.entry.js → p-abe821ce.entry.js} +1 -1
- package/dist/build/{p-f1f160c0.entry.js → p-ade3a57a.entry.js} +1 -1
- package/dist/{paperless/p-b2248597.entry.js → build/p-b090e928.entry.js} +1 -1
- package/dist/build/p-b781e8db.entry.js +1 -0
- package/dist/build/{p-d0d0a314.entry.js → p-bafe9297.entry.js} +1 -1
- package/dist/build/{p-099a4c60.entry.js → p-bbf7b9e7.entry.js} +1 -1
- package/dist/build/{p-0898e57b.entry.js → p-c298abac.entry.js} +1 -1
- package/dist/build/{p-223fdd93.entry.js → p-c577e542.entry.js} +1 -1
- package/dist/{paperless/p-f8d8d142.entry.js → build/p-cbeb58ba.entry.js} +1 -1
- package/dist/{paperless/p-d38642c4.entry.js → build/p-d24f045f.entry.js} +1 -1
- package/dist/build/{p-92bbdecc.entry.js → p-d5d45034.entry.js} +1 -1
- package/dist/build/{p-af320255.entry.js → p-d81c6c9e.entry.js} +1 -1
- package/dist/build/{p-4f068009.entry.js → p-d8681bdc.entry.js} +1 -1
- package/dist/{paperless/p-f9c9004b.entry.js → build/p-d9b3ace4.entry.js} +1 -1
- package/dist/{paperless/p-c7835f10.entry.js → build/p-e51c1cd6.entry.js} +1 -1
- package/dist/build/{p-533b92c5.entry.js → p-fa1a067a.entry.js} +1 -1
- package/dist/build/{p-6115ce1e.js → p-fa519af0.js} +1 -1
- package/dist/build/{p-4ad6dd58.entry.js → p-fff6fa7a.entry.js} +1 -1
- package/dist/build/paperless.css +1 -1
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/{constants-1Wc57Pbb.js → constants-BuWBrjuU.js} +11 -0
- package/dist/cjs/{index-CEv7WAQX.js → index-CcocepA-.js} +1 -1
- package/dist/cjs/index.cjs.js +16 -20
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/p-accordion.cjs.entry.js +3 -3
- package/dist/cjs/p-attachment.cjs.entry.js +1 -1
- package/dist/cjs/p-avatar-group.cjs.entry.js +1 -1
- package/dist/cjs/p-avatar.cjs.entry.js +1 -1
- package/dist/cjs/p-backdrop.cjs.entry.js +3 -3
- package/dist/cjs/p-badge_3.cjs.entry.js +3 -3
- package/dist/cjs/p-button-group.cjs.entry.js +1 -1
- package/dist/cjs/p-button_3.cjs.entry.js +3 -3
- package/dist/cjs/p-calendar.cjs.entry.js +3 -3
- package/dist/cjs/p-card-body.cjs.entry.js +3 -3
- package/dist/cjs/p-card-container.cjs.entry.js +3 -3
- package/dist/cjs/p-card-header.cjs.entry.js +3 -3
- package/dist/cjs/p-checkbox_3.cjs.entry.js +3 -3
- package/dist/cjs/p-content-slider.cjs.entry.js +1 -1
- package/dist/cjs/p-cropper.cjs.entry.js +2804 -5
- package/dist/cjs/p-datepicker.cjs.entry.js +2 -2
- package/dist/cjs/p-divider.cjs.entry.js +3 -3
- package/dist/cjs/p-drawer-body_3.cjs.entry.js +3 -3
- package/dist/cjs/p-drawer.cjs.entry.js +1 -1
- package/dist/cjs/p-dropdown-menu-item_2.cjs.entry.js +3 -3
- package/dist/cjs/p-empty-state_8.cjs.entry.js +5 -5
- package/dist/cjs/p-field_3.cjs.entry.js +3 -3
- package/dist/cjs/p-floating-menu-item.cjs.entry.js +3 -3
- package/dist/cjs/p-iban-icon.cjs.entry.js +13 -3
- package/dist/cjs/p-illustration.cjs.entry.js +1 -1
- package/dist/cjs/p-info-panel.cjs.entry.js +3 -3
- package/dist/cjs/p-label.cjs.entry.js +3 -3
- package/dist/cjs/p-layout.cjs.entry.js +1 -1
- package/dist/cjs/p-listing-item.cjs.entry.js +3 -3
- package/dist/cjs/p-listing-line.cjs.entry.js +3 -3
- package/dist/cjs/p-listing.cjs.entry.js +1 -1
- package/dist/cjs/p-modal-body_4.cjs.entry.js +3 -3
- package/dist/cjs/p-modal.cjs.entry.js +1 -1
- package/dist/cjs/p-navbar.cjs.entry.js +3 -3
- package/dist/cjs/p-navigation-item.cjs.entry.js +3 -3
- package/dist/cjs/p-navigation-section.cjs.entry.js +3 -3
- package/dist/cjs/p-navigation-title.cjs.entry.js +3 -3
- package/dist/cjs/p-pagination_3.cjs.entry.js +4 -4
- package/dist/cjs/p-profile.cjs.entry.js +3 -3
- package/dist/cjs/p-radio.cjs.entry.js +3 -3
- package/dist/cjs/p-range.cjs.entry.js +3 -3
- package/dist/cjs/p-select.cjs.entry.js +4 -4
- package/dist/cjs/p-smile.cjs.entry.js +1 -1
- package/dist/cjs/p-stepper-item_2.cjs.entry.js +3 -3
- package/dist/cjs/p-stepper.cjs.entry.js +1 -1
- package/dist/cjs/p-tab-container.cjs.entry.js +1 -1
- package/dist/cjs/p-tab-item.cjs.entry.js +3 -3
- package/dist/cjs/p-table-column.cjs.entry.js +1 -1
- package/dist/cjs/p-table-extra-header.cjs.entry.js +1 -1
- package/dist/cjs/p-table-row-action.cjs.entry.js +1 -1
- package/dist/cjs/p-table.cjs.entry.js +8 -10
- package/dist/cjs/p-toast-container.cjs.entry.js +1 -1
- package/dist/cjs/p-toast.cjs.entry.js +3 -3
- package/dist/cjs/p-toggle.cjs.entry.js +3 -3
- package/dist/cjs/p-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/paperless.cjs.js +1 -1
- package/dist/cjs/{state-C0PIGTfM.js → state-BseAB3i4.js} +1 -1
- package/dist/cjs/{table-helpers-CWMTGgj6.js → table-helpers-D7cRsAPO.js} +0 -1
- package/dist/cjs/{themed-host.component-3UWKsF6_.js → themed-host.component-BSIZm-L8.js} +2 -2
- package/dist/collection/components/molecules/cropper/cropper.component.js +4 -2
- package/dist/collection/components/organisms/table/table.component.js +6 -8
- package/dist/collection/index.js +2 -2
- package/dist/collection/types/index.js +0 -1
- package/dist/collection/utils/constants.js +10 -0
- package/dist/components/index.d.ts +160 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-25xYytwu.js +1 -0
- package/dist/components/p-4UKRYZET.js +1 -0
- package/dist/components/{p-CZlpdpMV.js → p-B7SbywpL.js} +1 -1
- package/dist/components/p-B9n8mzrj.js +1 -0
- package/dist/components/p-BAIZ48ms.js +1 -0
- package/dist/components/p-BBNOzE00.js +1 -0
- package/dist/components/p-BCAgJ4w6.js +1 -0
- package/dist/components/{p-B1MbDi-e.js → p-BIQLsxW1.js} +1 -1
- package/dist/components/{p-I0RMpdxn.js → p-BMb-TnTI.js} +1 -1
- package/dist/components/p-BV81Joa3.js +1 -0
- package/dist/components/p-BVuxBNP3.js +1 -0
- package/dist/components/{p-D5wfsq08.js → p-BeiMfpUZ.js} +1 -1
- package/dist/components/p-BfJQbKrn.js +1 -0
- package/dist/components/p-BhtaAZAJ.js +1 -0
- package/dist/components/p-Bi6PK1YV.js +1 -0
- package/dist/components/p-Bno5n2sV.js +1 -0
- package/dist/components/{p-DAKk3DP1.js → p-BnzXRlCu.js} +1 -1
- package/dist/components/p-BtuWYjfq.js +1 -0
- package/dist/components/p-BuAyIir2.js +1 -0
- package/dist/components/p-C7Bjyf-i.js +1 -0
- package/dist/components/p-CCOwunss.js +1 -0
- package/dist/components/p-CEaB2BT0.js +1 -0
- package/dist/components/{p-Bylx-B13.js → p-CFu8cH3m.js} +1 -1
- package/dist/components/p-CGJYpylb.js +1 -0
- package/dist/components/p-CPpl-J0y.js +1 -0
- package/dist/components/{p-C9Qej_kA.js → p-C_dax2wr.js} +1 -1
- package/dist/components/p-CgOKCXab.js +1 -0
- package/dist/components/p-ChfXIxTQ.js +1 -0
- package/dist/components/{p-7Qldd8fE.js → p-Ci0JKTmE.js} +1 -1
- package/dist/components/{p-ChrB-4co.js → p-CjI4hMLv.js} +1 -1
- package/dist/components/p-Cs8Ak0MQ.js +1 -0
- package/dist/components/p-CtQJmtcM.js +1 -0
- package/dist/components/{p-CuEKEtbG.js → p-Czs7mxeO.js} +1 -1
- package/dist/components/p-D4KmlZ0u.js +1 -0
- package/dist/components/{p-u1RuzYH-.js → p-D4bALv5t.js} +1 -1
- package/dist/components/p-DNMiuEx4.js +1 -0
- package/dist/components/{p-CLXB3_-L.js → p-DSj0Jf2L.js} +1 -1
- package/dist/components/p-DW-MndqD.js +1 -0
- package/dist/components/p-Dbt4VuQm.js +1 -0
- package/dist/components/p-DeSgaQxj.js +1 -0
- package/dist/components/{p-CUmhErgX.js → p-Ds35QicK.js} +1 -1
- package/dist/components/p-DxW06-IZ.js +1 -0
- package/dist/components/p-DxmwiGc9.js +1 -0
- package/dist/components/p-LfH4pSix.js +1 -0
- package/dist/components/p-PFAC3Kay.js +1 -0
- package/dist/components/p-_3tBkyNJ.js +1 -0
- package/dist/components/p-accordion.js +1 -1
- package/dist/components/p-attachment.js +1 -1
- package/dist/components/p-avatar-group.js +1 -1
- package/dist/components/p-avatar.js +1 -1
- package/dist/components/p-backdrop.js +1 -1
- package/dist/components/p-badge.js +1 -1
- package/dist/components/p-button-group.js +1 -1
- package/dist/components/p-button.js +1 -1
- package/dist/components/p-calendar.js +1 -1
- package/dist/components/p-card-body.js +1 -1
- package/dist/components/p-card-container.js +1 -1
- package/dist/components/p-card-header.js +1 -1
- package/dist/components/p-checkbox.js +1 -1
- package/dist/components/p-content-slider.js +1 -1
- package/dist/components/p-cropper.js +3 -1
- package/dist/components/p-datepicker.js +1 -1
- package/dist/components/p-divider.js +1 -1
- package/dist/components/p-drawer-body.js +1 -1
- package/dist/components/p-drawer-container.js +1 -1
- package/dist/components/p-drawer-header.js +1 -1
- package/dist/components/p-drawer.js +1 -1
- package/dist/components/p-dropdown-menu-container.js +1 -1
- package/dist/components/p-dropdown-menu-item.js +1 -1
- package/dist/components/p-dropdown.js +1 -1
- package/dist/components/p-empty-state.js +1 -1
- package/dist/components/{p-DDcyZGui.js → p-et-2f2Wz.js} +2 -2
- package/dist/components/p-field-container.js +1 -1
- package/dist/components/p-field.js +1 -1
- package/dist/components/p-floating-menu-container.js +1 -1
- package/dist/components/p-floating-menu-item.js +1 -1
- package/dist/components/p-helper.js +1 -1
- package/dist/components/p-iban-icon.js +1 -1
- package/dist/components/p-icon.js +1 -1
- package/dist/components/p-illustration.js +1 -1
- package/dist/components/p-info-panel.js +1 -1
- package/dist/components/p-label.js +1 -1
- package/dist/components/p-layout.js +1 -1
- package/dist/components/p-listing-item.js +1 -1
- package/dist/components/p-listing-line.js +1 -1
- package/dist/components/p-listing.js +1 -1
- package/dist/components/p-loader.js +1 -1
- package/dist/components/p-modal-body.js +1 -1
- package/dist/components/p-modal-container.js +1 -1
- package/dist/components/p-modal-footer.js +1 -1
- package/dist/components/p-modal-header.js +1 -1
- package/dist/components/p-modal.js +1 -1
- package/dist/components/p-navbar.js +1 -1
- package/dist/components/p-navigation-item.js +1 -1
- package/dist/components/p-navigation-section.js +1 -1
- package/dist/components/p-navigation-title.js +1 -1
- package/dist/components/p-pagination-pages-item.js +1 -1
- package/dist/components/p-pagination-pages.js +1 -1
- package/dist/components/p-pagination-size.js +1 -1
- package/dist/components/p-pagination.js +1 -1
- package/dist/components/p-profile.js +1 -1
- package/dist/components/p-qmmFrZxi.js +1 -0
- package/dist/components/p-radio.js +1 -1
- package/dist/components/p-range.js +1 -1
- package/dist/components/p-segment-container.js +1 -1
- package/dist/components/p-segment-item.js +1 -1
- package/dist/components/p-select.js +1 -1
- package/dist/components/p-smile.js +1 -1
- package/dist/components/p-stepper-item.js +1 -1
- package/dist/components/p-stepper-line.js +1 -1
- package/dist/components/p-stepper.js +1 -1
- package/dist/components/p-tab-container.js +1 -1
- package/dist/components/p-tab-item.js +1 -1
- package/dist/components/p-table-cell.js +1 -1
- package/dist/components/p-table-column.js +1 -1
- package/dist/components/p-table-container.js +1 -1
- package/dist/components/p-table-extra-header.js +1 -1
- package/dist/components/p-table-footer.js +1 -1
- package/dist/components/p-table-header.js +1 -1
- package/dist/components/p-table-row-action.js +1 -1
- package/dist/components/p-table-row-actions-container.js +1 -1
- package/dist/components/p-table-row.js +1 -1
- package/dist/components/p-table.js +1 -1
- package/dist/components/p-toast-container.js +1 -1
- package/dist/components/p-toast.js +1 -1
- package/dist/components/p-toggle.js +1 -1
- package/dist/components/p-tooltip.js +1 -1
- package/dist/esm/constants-CEaB2BT0.js +17 -0
- package/dist/esm/{index-PW1zQoNr.js → index-BDccsg1s.js} +1 -1
- package/dist/esm/index.js +4 -6
- package/dist/esm/loader.js +2 -2
- package/dist/esm/p-accordion.entry.js +3 -3
- package/dist/esm/p-attachment.entry.js +1 -1
- package/dist/esm/p-avatar-group.entry.js +1 -1
- package/dist/esm/p-avatar.entry.js +1 -1
- package/dist/esm/p-backdrop.entry.js +3 -3
- package/dist/esm/p-badge_3.entry.js +3 -3
- package/dist/esm/p-button-group.entry.js +1 -1
- package/dist/esm/p-button_3.entry.js +3 -3
- package/dist/esm/p-calendar.entry.js +3 -3
- package/dist/esm/p-card-body.entry.js +3 -3
- package/dist/esm/p-card-container.entry.js +3 -3
- package/dist/esm/p-card-header.entry.js +3 -3
- package/dist/esm/p-checkbox_3.entry.js +3 -3
- package/dist/esm/p-content-slider.entry.js +1 -1
- package/dist/esm/p-cropper.entry.js +2804 -5
- package/dist/esm/p-datepicker.entry.js +2 -2
- package/dist/esm/p-divider.entry.js +3 -3
- package/dist/esm/p-drawer-body_3.entry.js +3 -3
- package/dist/esm/p-drawer.entry.js +1 -1
- package/dist/esm/p-dropdown-menu-item_2.entry.js +3 -3
- package/dist/esm/p-empty-state_8.entry.js +5 -5
- package/dist/esm/p-field_3.entry.js +3 -3
- package/dist/esm/p-floating-menu-item.entry.js +3 -3
- package/dist/esm/p-iban-icon.entry.js +12 -2
- package/dist/esm/p-illustration.entry.js +1 -1
- package/dist/esm/p-info-panel.entry.js +3 -3
- package/dist/esm/p-label.entry.js +3 -3
- package/dist/esm/p-layout.entry.js +1 -1
- package/dist/esm/p-listing-item.entry.js +3 -3
- package/dist/esm/p-listing-line.entry.js +3 -3
- package/dist/esm/p-listing.entry.js +1 -1
- package/dist/esm/p-modal-body_4.entry.js +3 -3
- package/dist/esm/p-modal.entry.js +1 -1
- package/dist/esm/p-navbar.entry.js +3 -3
- package/dist/esm/p-navigation-item.entry.js +3 -3
- package/dist/esm/p-navigation-section.entry.js +3 -3
- package/dist/esm/p-navigation-title.entry.js +3 -3
- package/dist/esm/p-pagination_3.entry.js +4 -4
- package/dist/esm/p-profile.entry.js +3 -3
- package/dist/esm/p-radio.entry.js +3 -3
- package/dist/esm/p-range.entry.js +3 -3
- package/dist/esm/p-select.entry.js +4 -4
- package/dist/esm/p-smile.entry.js +1 -1
- package/dist/esm/p-stepper-item_2.entry.js +3 -3
- package/dist/esm/p-stepper.entry.js +1 -1
- package/dist/esm/p-tab-container.entry.js +1 -1
- package/dist/esm/p-tab-item.entry.js +3 -3
- package/dist/esm/p-table-column.entry.js +1 -1
- package/dist/esm/p-table-extra-header.entry.js +1 -1
- package/dist/esm/p-table-row-action.entry.js +1 -1
- package/dist/esm/p-table.entry.js +8 -10
- package/dist/esm/p-toast-container.entry.js +1 -1
- package/dist/esm/p-toast.entry.js +3 -3
- package/dist/esm/p-toggle.entry.js +3 -3
- package/dist/esm/p-tooltip.entry.js +3 -3
- package/dist/esm/paperless.js +2 -2
- package/dist/esm/{state-DAO0Ru6K.js → state-xB9Jw2TG.js} +1 -1
- package/dist/esm/{table-helpers-CfQnOr9V.js → table-helpers-DA1PfY6l.js} +1 -1
- package/dist/esm/{themed-host.component-Bc5wHkoH.js → themed-host.component-CLTQ6QFZ.js} +2 -2
- package/dist/index.html +1 -1
- package/dist/paperless/index.esm.js +1 -1
- package/dist/paperless/{p-0305046c.entry.js → p-0388615e.entry.js} +1 -1
- package/dist/{build/p-4d456377.entry.js → paperless/p-0d6f3aa3.entry.js} +1 -1
- package/dist/{build/p-958c8a2c.entry.js → paperless/p-14223e98.entry.js} +1 -1
- package/dist/paperless/{p-b37d0053.entry.js → p-166704d6.entry.js} +1 -1
- package/dist/{build/p-8bd7c93a.entry.js → paperless/p-17e598ac.entry.js} +1 -1
- package/dist/paperless/{p-842a9f3e.entry.js → p-18454ce9.entry.js} +1 -1
- package/dist/paperless/{p-a4109895.entry.js → p-1cbe78fd.entry.js} +1 -1
- package/dist/paperless/{p-9b6d9292.entry.js → p-1f15cd98.entry.js} +1 -1
- package/dist/paperless/{p-14a2caa3.entry.js → p-1f7ab568.entry.js} +1 -1
- package/dist/paperless/{p-ad468b70.entry.js → p-20077155.entry.js} +1 -1
- package/dist/paperless/{p-8d0c1f36.entry.js → p-23cc6b6b.entry.js} +1 -1
- package/dist/paperless/{p-7ae963de.entry.js → p-2e67ae6a.entry.js} +1 -1
- package/dist/paperless/p-3452b2f5.entry.js +3 -0
- package/dist/paperless/{p-93bbde98.entry.js → p-44da0b12.entry.js} +1 -1
- package/dist/paperless/{p-846f47bd.entry.js → p-464fd7c4.entry.js} +1 -1
- package/dist/paperless/{p-ea311062.entry.js → p-50de21e1.entry.js} +1 -1
- package/dist/paperless/{p-0eb7a6e4.entry.js → p-524eb1cb.entry.js} +1 -1
- package/dist/paperless/{p-870a63fb.entry.js → p-561dabe7.entry.js} +1 -1
- package/dist/paperless/p-5a2d19ec.entry.js +1 -0
- package/dist/{build/p-bfb06294.entry.js → paperless/p-5abcc8d2.entry.js} +1 -1
- package/dist/paperless/{p-e6222abf.entry.js → p-5c5cdb06.entry.js} +1 -1
- package/dist/{build/p-400ae3ad.entry.js → paperless/p-60a3f1ee.entry.js} +1 -1
- package/dist/paperless/{p-30a23dba.entry.js → p-6df6a0ba.entry.js} +1 -1
- package/dist/{build/p-e9d2bdd6.entry.js → paperless/p-76f83633.entry.js} +1 -1
- package/dist/{build/p-62c4c7d7.entry.js → paperless/p-78b15121.entry.js} +1 -1
- package/dist/paperless/{p-df6e3bdf.entry.js → p-7ac9dc1e.entry.js} +1 -1
- package/dist/{build/p-0c094c99.entry.js → paperless/p-7d018d4d.entry.js} +1 -1
- package/dist/paperless/{p-a23a90d6.entry.js → p-80922205.entry.js} +1 -1
- package/dist/paperless/{p-1ce28114.entry.js → p-8382e7c2.entry.js} +1 -1
- package/dist/paperless/p-84c43a3d.entry.js +1 -0
- package/dist/paperless/{p-1b3ebeb4.entry.js → p-8644a3f1.entry.js} +1 -1
- package/dist/paperless/{p-8ed529ba.entry.js → p-8824a0ef.entry.js} +1 -1
- package/dist/paperless/{p-9a49375d.entry.js → p-93ce18e4.entry.js} +1 -1
- package/dist/{build/p-f3daeb8f.entry.js → paperless/p-9cdee500.entry.js} +1 -1
- package/dist/paperless/{p-389f92f8.entry.js → p-9f51b9dc.entry.js} +1 -1
- package/dist/paperless/p-9fd28756.entry.js +1 -0
- package/dist/paperless/{p-PW1zQoNr.js → p-BDccsg1s.js} +2 -2
- package/dist/paperless/p-BErFyukm.js +1 -0
- package/dist/paperless/p-CEaB2BT0.js +1 -0
- package/dist/paperless/p-CHZgJJeM.js +1 -0
- package/dist/{components/p-Dp60j03z.js → paperless/p-Jt5e0RAn.js} +1 -1
- package/dist/paperless/{p-e30abf73.entry.js → p-a232b345.entry.js} +1 -1
- package/dist/paperless/{p-4793863e.entry.js → p-a7d200c3.entry.js} +1 -1
- package/dist/paperless/{p-a91d2d7d.entry.js → p-abe821ce.entry.js} +1 -1
- package/dist/paperless/{p-f1f160c0.entry.js → p-ade3a57a.entry.js} +1 -1
- package/dist/{build/p-b2248597.entry.js → paperless/p-b090e928.entry.js} +1 -1
- package/dist/paperless/p-b781e8db.entry.js +1 -0
- package/dist/paperless/{p-d0d0a314.entry.js → p-bafe9297.entry.js} +1 -1
- package/dist/paperless/{p-099a4c60.entry.js → p-bbf7b9e7.entry.js} +1 -1
- package/dist/paperless/{p-0898e57b.entry.js → p-c298abac.entry.js} +1 -1
- package/dist/paperless/{p-223fdd93.entry.js → p-c577e542.entry.js} +1 -1
- package/dist/{build/p-f8d8d142.entry.js → paperless/p-cbeb58ba.entry.js} +1 -1
- package/dist/{build/p-d38642c4.entry.js → paperless/p-d24f045f.entry.js} +1 -1
- package/dist/paperless/{p-92bbdecc.entry.js → p-d5d45034.entry.js} +1 -1
- package/dist/paperless/{p-af320255.entry.js → p-d81c6c9e.entry.js} +1 -1
- package/dist/paperless/{p-4f068009.entry.js → p-d8681bdc.entry.js} +1 -1
- package/dist/{build/p-f9c9004b.entry.js → paperless/p-d9b3ace4.entry.js} +1 -1
- package/dist/{build/p-c7835f10.entry.js → paperless/p-e51c1cd6.entry.js} +1 -1
- package/dist/paperless/{p-533b92c5.entry.js → p-fa1a067a.entry.js} +1 -1
- package/dist/paperless/{p-4ad6dd58.entry.js → p-fff6fa7a.entry.js} +1 -1
- package/dist/paperless/paperless.css +1 -1
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/types/components/molecules/cropper/cropper.component.d.ts +1 -0
- package/dist/types/index.d.ts +2 -3
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/utils/constants.d.ts +2 -0
- package/hydrate/index.js +2828 -30
- package/hydrate/index.mjs +2828 -30
- package/package.json +343 -9
- package/dist/build/p-2509308d.entry.js +0 -1
- package/dist/build/p-6ff8d21c.entry.js +0 -1
- package/dist/build/p-988d4000.css +0 -1
- package/dist/build/p-By0EdXx2.js +0 -1
- package/dist/build/p-DE-sstf_.js +0 -1
- package/dist/build/p-DdQ-S2l7.js +0 -1
- package/dist/build/p-V194S7Dm.js +0 -1
- package/dist/build/p-a096e5b9.entry.js +0 -1
- package/dist/build/p-cfe81f27.entry.js +0 -1
- package/dist/build/p-ea4df80c.entry.js +0 -1
- package/dist/build/p-vyRrSf5s.js +0 -1
- package/dist/cjs/constants-DDb_wCc1.js +0 -13
- package/dist/cjs/iban-C5iVD0Ms.js +0 -14
- package/dist/collection/types/constants.js +0 -9
- package/dist/components/p-BB7bmhRo.js +0 -1
- package/dist/components/p-BCBZin6U.js +0 -1
- package/dist/components/p-BDDlblTI.js +0 -1
- package/dist/components/p-BQIf6SbI.js +0 -1
- package/dist/components/p-BdmdNQNa.js +0 -1
- package/dist/components/p-BhnSWAm_.js +0 -1
- package/dist/components/p-BnyCseIX.js +0 -1
- package/dist/components/p-BpnNRSNN.js +0 -1
- package/dist/components/p-BtLNLU5M.js +0 -1
- package/dist/components/p-Bte1XwqA.js +0 -1
- package/dist/components/p-BtiXtaPx.js +0 -1
- package/dist/components/p-By0EdXx2.js +0 -1
- package/dist/components/p-Bzccvp_O.js +0 -1
- package/dist/components/p-C8Vq1N_0.js +0 -1
- package/dist/components/p-CEFaN18s.js +0 -1
- package/dist/components/p-CJKObZ8L.js +0 -1
- package/dist/components/p-CUqoOemU.js +0 -1
- package/dist/components/p-CX1ewbW4.js +0 -1
- package/dist/components/p-CXVK8SLW.js +0 -1
- package/dist/components/p-C_DONK31.js +0 -1
- package/dist/components/p-CdNBlyaj.js +0 -1
- package/dist/components/p-Cop5m_ZM.js +0 -1
- package/dist/components/p-Cq9Ck17A.js +0 -1
- package/dist/components/p-Ctox8Lg6.js +0 -1
- package/dist/components/p-D25uRUSS.js +0 -1
- package/dist/components/p-D29Sbsl9.js +0 -1
- package/dist/components/p-DAb-3URQ.js +0 -1
- package/dist/components/p-DPc49L2n.js +0 -1
- package/dist/components/p-DdQ-S2l7.js +0 -1
- package/dist/components/p-DfnFrfyL.js +0 -1
- package/dist/components/p-DmzXDHw8.js +0 -1
- package/dist/components/p-Dolot2T0.js +0 -1
- package/dist/components/p-Dw6QWvDh.js +0 -1
- package/dist/components/p-LNjvz3Yz.js +0 -1
- package/dist/components/p-TyZ7uPES.js +0 -1
- package/dist/components/p-YBYXO3s0.js +0 -1
- package/dist/components/p-f2XeK6vS.js +0 -1
- package/dist/components/p-jz4pgX_D.js +0 -1
- package/dist/components/p-vyRrSf5s.js +0 -1
- package/dist/components/p-xlO2hePk.js +0 -1
- package/dist/esm/constants-DdQ-S2l7.js +0 -11
- package/dist/esm/constants-vyRrSf5s.js +0 -7
- package/dist/esm/iban-By0EdXx2.js +0 -12
- package/dist/paperless/p-2509308d.entry.js +0 -1
- package/dist/paperless/p-6ff8d21c.entry.js +0 -1
- package/dist/paperless/p-By0EdXx2.js +0 -1
- package/dist/paperless/p-DE-sstf_.js +0 -1
- package/dist/paperless/p-DdQ-S2l7.js +0 -1
- package/dist/paperless/p-DzdX_Z5B.js +0 -1
- package/dist/paperless/p-V194S7Dm.js +0 -1
- package/dist/paperless/p-a096e5b9.entry.js +0 -1
- package/dist/paperless/p-cfe81f27.entry.js +0 -1
- package/dist/paperless/p-ea4df80c.entry.js +0 -1
- package/dist/paperless/p-vyRrSf5s.js +0 -1
- package/dist/types/types/constants.d.ts +0 -2
package/hydrate/index.mjs
CHANGED
|
@@ -129,11 +129,11 @@ function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResu
|
|
|
129
129
|
/*hydrateAppClosure start*/
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
const NAMESPACE = 'paperless';
|
|
132
|
+
const NAMESPACE$1 = 'paperless';
|
|
133
133
|
const BUILD = /* paperless */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, constructableCSS: false, cssAnnotations: true, deserializer: false, devTools: false, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: true, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: true, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propChangeCallback: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, serializer: false, shadowDelegatesFocus: false, shadowDom: true, shadowDomShim: true, shadowSlotAssignmentManual: false, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true };
|
|
134
134
|
const Env = /* paperless */ {};
|
|
135
135
|
|
|
136
|
-
const globalStyles = ".w-full{width:100%}.touch-none{touch-action:none}.font-ambit{font-family:Ambit,sans-serif}.font-geist{font-family:Geist,serif}.text-base{font-size:1rem;line-height:1.5rem}.lining-nums{--tw-numeric-figure:lining-nums}.lining-nums,.tabular-nums{font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.tabular-nums{--tw-numeric-spacing:tabular-nums}.text-inherit{color:inherit}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}*{box-sizing:border-box;font-family:Geist,serif}.w-full{width:100%}.touch-none{touch-action:none}.font-ambit{font-family:Ambit,sans-serif}.font-geist{font-family:Geist,serif}.text-base{font-size:1rem;line-height:1.5rem}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.text-inherit{color:inherit}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter
|
|
136
|
+
const globalStyles = ".w-full{width:100%}.touch-none{touch-action:none}.font-ambit{font-family:Ambit,sans-serif}.font-geist{font-family:Geist,serif}.text-base{font-size:1rem;line-height:1.5rem}.lining-nums{--tw-numeric-figure:lining-nums}.lining-nums,.tabular-nums{font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.tabular-nums{--tw-numeric-spacing:tabular-nums}.text-inherit{color:inherit}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}*{box-sizing:border-box;font-family:Geist,serif}.w-full{width:100%}.touch-none{touch-action:none}.font-ambit{font-family:Ambit,sans-serif}.font-geist{font-family:Geist,serif}.text-base{font-size:1rem;line-height:1.5rem}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.text-inherit{color:inherit}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}@import url(https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap);@import url(https://fonts.cdnfonts.com/css/ambit);*,* button,.font-geist,.font-geist button{font-variant-numeric:lining-nums tabular-nums}body,html{-webkit-font-smoothing:antialiased;max-width:calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));text-rendering:optimizeLegibility;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);width:100%}body[data-theme=dark]{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(35 41 52/var(--tw-bg-opacity,1));color:rgb(163 165 169/var(--tw-text-opacity,1))}body:not([data-theme=dark]){--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1));color:rgb(116 120 127/var(--tw-text-opacity,1))}html{height:-moz-stretch;height:-webkit-stretch;height:-webkit-fill-available;height:-moz-available;height:stretch}body{font-size:1rem;font-weight:500;height:calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));height:-moz-stretch;height:-webkit-stretch;height:-webkit-fill-available;height:-moz-available;height:stretch;line-height:1.5rem}body *{box-sizing:border-box}a,a:visited{color:inherit}h1,h2,h3,h4,h5{font-family:Ambit,sans-serif;font-weight:700}h1{font-size:2rem;line-height:2.5rem}h2{font-size:1.5rem;line-height:2rem}h3{font-size:1.25rem}h3,h4{line-height:1.75rem}h4{font-size:1.125rem}body[data-theme=dark] h1,body[data-theme=dark] h2,body[data-theme=dark] h3,body[data-theme=dark] h4,body[data-theme=dark] h5{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}body:not([data-theme=dark]) h1,body:not([data-theme=dark]) h2,body:not([data-theme=dark]) h3,body:not([data-theme=dark]) h4,body:not([data-theme=dark]) h5{--tw-text-opacity:1;color:rgb(24 30 41/var(--tw-text-opacity,1))}.scroll-lock{-webkit-overflow-scrolling:auto;overflow:hidden;overscroll-behavior:none;touch-action:none}";
|
|
137
137
|
|
|
138
138
|
/*
|
|
139
139
|
Stencil Hydrate Platform v4.41.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -4758,7 +4758,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
4758
4758
|
hostRef.$onRenderResolve$ = void 0;
|
|
4759
4759
|
}
|
|
4760
4760
|
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
4761
|
-
nextTick(() => scheduleUpdate(hostRef, false));
|
|
4761
|
+
nextTick$1(() => scheduleUpdate(hostRef, false));
|
|
4762
4762
|
}
|
|
4763
4763
|
hostRef.$flags$ &= -517;
|
|
4764
4764
|
}
|
|
@@ -4780,14 +4780,14 @@ var appDidLoad = (who) => {
|
|
|
4780
4780
|
if (BUILD.asyncQueue) {
|
|
4781
4781
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
4782
4782
|
}
|
|
4783
|
-
nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
|
|
4783
|
+
nextTick$1(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE$1 } }));
|
|
4784
4784
|
if (BUILD.hydrateClientSide) {
|
|
4785
4785
|
if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
|
|
4786
4786
|
plt.$orgLocNodes$.clear();
|
|
4787
4787
|
}
|
|
4788
4788
|
}
|
|
4789
4789
|
if (BUILD.profile && performance.measure) {
|
|
4790
|
-
performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
|
|
4790
|
+
performance.measure(`[Stencil] ${NAMESPACE$1} initial load (by ${who})`, "st:app:start");
|
|
4791
4791
|
}
|
|
4792
4792
|
};
|
|
4793
4793
|
var safeCall = (instance, method, arg, elm) => {
|
|
@@ -4806,7 +4806,7 @@ var emitLifecycleEvent = (elm, lifecycleName) => {
|
|
|
4806
4806
|
bubbles: true,
|
|
4807
4807
|
composed: true,
|
|
4808
4808
|
detail: {
|
|
4809
|
-
namespace: NAMESPACE
|
|
4809
|
+
namespace: NAMESPACE$1
|
|
4810
4810
|
}
|
|
4811
4811
|
});
|
|
4812
4812
|
}
|
|
@@ -5275,7 +5275,7 @@ var connectedCallback = (elm) => {
|
|
|
5275
5275
|
});
|
|
5276
5276
|
}
|
|
5277
5277
|
if (BUILD.initializeNextTick) {
|
|
5278
|
-
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
5278
|
+
nextTick$1(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
5279
5279
|
} else {
|
|
5280
5280
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
5281
5281
|
}
|
|
@@ -6307,7 +6307,7 @@ var registerComponents = (Cstrs) => {
|
|
|
6307
6307
|
};
|
|
6308
6308
|
var win = window;
|
|
6309
6309
|
var readTask = (cb) => {
|
|
6310
|
-
nextTick(() => {
|
|
6310
|
+
nextTick$1(() => {
|
|
6311
6311
|
try {
|
|
6312
6312
|
cb();
|
|
6313
6313
|
} catch (e) {
|
|
@@ -6316,7 +6316,7 @@ var readTask = (cb) => {
|
|
|
6316
6316
|
});
|
|
6317
6317
|
};
|
|
6318
6318
|
var writeTask = (cb) => {
|
|
6319
|
-
nextTick(() => {
|
|
6319
|
+
nextTick$1(() => {
|
|
6320
6320
|
try {
|
|
6321
6321
|
cb();
|
|
6322
6322
|
} catch (e) {
|
|
@@ -6325,7 +6325,7 @@ var writeTask = (cb) => {
|
|
|
6325
6325
|
});
|
|
6326
6326
|
};
|
|
6327
6327
|
var resolved = /* @__PURE__ */ Promise.resolve();
|
|
6328
|
-
var nextTick = (cb) => resolved.then(cb);
|
|
6328
|
+
var nextTick$1 = (cb) => resolved.then(cb);
|
|
6329
6329
|
var defaultConsoleError = (e) => {
|
|
6330
6330
|
if (e != null) {
|
|
6331
6331
|
console.error(e.stack || e.message || e);
|
|
@@ -6409,7 +6409,7 @@ var StencilCore = /*#__PURE__*/Object.freeze({
|
|
|
6409
6409
|
Fragment: Fragment,
|
|
6410
6410
|
Host: Host,
|
|
6411
6411
|
Mixin: Mixin,
|
|
6412
|
-
NAMESPACE: NAMESPACE,
|
|
6412
|
+
NAMESPACE: NAMESPACE$1,
|
|
6413
6413
|
addHostEventListeners: addHostEventListeners,
|
|
6414
6414
|
bootstrapLazy: bootstrapLazy,
|
|
6415
6415
|
cmpModules: cmpModules,
|
|
@@ -6436,7 +6436,7 @@ var StencilCore = /*#__PURE__*/Object.freeze({
|
|
|
6436
6436
|
loadModule: loadModule,
|
|
6437
6437
|
modeResolutionChain: modeResolutionChain,
|
|
6438
6438
|
needsScopedSSR: needsScopedSSR,
|
|
6439
|
-
nextTick: nextTick,
|
|
6439
|
+
nextTick: nextTick$1,
|
|
6440
6440
|
parsePropertyValue: parsePropertyValue,
|
|
6441
6441
|
plt: plt,
|
|
6442
6442
|
postUpdateComponent: postUpdateComponent,
|
|
@@ -8510,16 +8510,6 @@ function isTableColumnSizesKey(x, k) {
|
|
|
8510
8510
|
return k in x;
|
|
8511
8511
|
}
|
|
8512
8512
|
|
|
8513
|
-
const tableColumSizesOptions = [
|
|
8514
|
-
'default',
|
|
8515
|
-
'tablet',
|
|
8516
|
-
'desktop-xs',
|
|
8517
|
-
'desktop-sm',
|
|
8518
|
-
'desktop',
|
|
8519
|
-
'desktop-lg',
|
|
8520
|
-
'desktop-xl',
|
|
8521
|
-
];
|
|
8522
|
-
|
|
8523
8513
|
const IBAN_ICON_VARIANTS_ARRAY = [
|
|
8524
8514
|
'abna',
|
|
8525
8515
|
'rabo',
|
|
@@ -11769,6 +11759,16 @@ const SELECT_DEFAULT_MAX_DISPLAYED_ITEMS = 10;
|
|
|
11769
11759
|
// Pagination
|
|
11770
11760
|
const PAGINATION_DEFAULT_PAGE_SIZE = 12;
|
|
11771
11761
|
const PAGINATION_DEFAULT_PAGE_SIZE_OPTIONS = [12, 24, 68, 136];
|
|
11762
|
+
// Table column
|
|
11763
|
+
const TABLE_COLUMN_SIZES = [
|
|
11764
|
+
'default',
|
|
11765
|
+
'tablet',
|
|
11766
|
+
'desktop-xs',
|
|
11767
|
+
'desktop-sm',
|
|
11768
|
+
'desktop',
|
|
11769
|
+
'desktop-lg',
|
|
11770
|
+
'desktop-xl',
|
|
11771
|
+
];
|
|
11772
11772
|
|
|
11773
11773
|
const accordionComponentCss = () => `*{box-sizing:border-box}.static{position:static}.my-0{margin-bottom:0;margin-top:0}.mt-4{margin-top:1rem}.flex{display:flex}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.gap-2{gap:.5rem}.whitespace-nowrap{white-space:nowrap}.text-base{font-size:1rem;line-height:1.5rem}.font-medium{font-weight:500}.text-hurricane-200{--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.text-storm-300{--tw-text-opacity:1;color:rgb(116 120 127/var(--tw-text-opacity,1))}.text-storm-500{--tw-text-opacity:1;color:rgb(24 30 41/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}`;
|
|
11774
11774
|
|
|
@@ -19954,6 +19954,2805 @@ class ContentSlider {
|
|
|
19954
19954
|
}; }
|
|
19955
19955
|
}
|
|
19956
19956
|
|
|
19957
|
+
const IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
19958
|
+
const WINDOW = IS_BROWSER ? window : {};
|
|
19959
|
+
const IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false;
|
|
19960
|
+
const HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;
|
|
19961
|
+
const NAMESPACE = 'cropper';
|
|
19962
|
+
const CROPPER_CANVAS = `${NAMESPACE}-canvas`;
|
|
19963
|
+
const CROPPER_CROSSHAIR = `${NAMESPACE}-crosshair`;
|
|
19964
|
+
const CROPPER_GIRD = `${NAMESPACE}-grid`;
|
|
19965
|
+
const CROPPER_HANDLE = `${NAMESPACE}-handle`;
|
|
19966
|
+
const CROPPER_IMAGE = `${NAMESPACE}-image`;
|
|
19967
|
+
const CROPPER_SELECTION = `${NAMESPACE}-selection`;
|
|
19968
|
+
const CROPPER_SHADE = `${NAMESPACE}-shade`;
|
|
19969
|
+
const CROPPER_VIEWER = `${NAMESPACE}-viewer`;
|
|
19970
|
+
// Actions
|
|
19971
|
+
const ACTION_SELECT = 'select';
|
|
19972
|
+
const ACTION_MOVE = 'move';
|
|
19973
|
+
const ACTION_SCALE = 'scale';
|
|
19974
|
+
const ACTION_ROTATE = 'rotate';
|
|
19975
|
+
const ACTION_TRANSFORM = 'transform';
|
|
19976
|
+
const ACTION_NONE = 'none';
|
|
19977
|
+
const ACTION_RESIZE_NORTH = 'n-resize';
|
|
19978
|
+
const ACTION_RESIZE_EAST = 'e-resize';
|
|
19979
|
+
const ACTION_RESIZE_SOUTH = 's-resize';
|
|
19980
|
+
const ACTION_RESIZE_WEST = 'w-resize';
|
|
19981
|
+
const ACTION_RESIZE_NORTHEAST = 'ne-resize';
|
|
19982
|
+
const ACTION_RESIZE_NORTHWEST = 'nw-resize';
|
|
19983
|
+
const ACTION_RESIZE_SOUTHEAST = 'se-resize';
|
|
19984
|
+
const ACTION_RESIZE_SOUTHWEST = 'sw-resize';
|
|
19985
|
+
// Attributes
|
|
19986
|
+
const ATTRIBUTE_ACTION = 'action';
|
|
19987
|
+
// Native events
|
|
19988
|
+
const EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';
|
|
19989
|
+
const EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';
|
|
19990
|
+
const EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';
|
|
19991
|
+
const EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;
|
|
19992
|
+
const EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;
|
|
19993
|
+
const EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;
|
|
19994
|
+
const EVENT_ERROR = 'error';
|
|
19995
|
+
const EVENT_KEYDOWN = 'keydown';
|
|
19996
|
+
const EVENT_LOAD = 'load';
|
|
19997
|
+
const EVENT_WHEEL = 'wheel';
|
|
19998
|
+
// Custom events
|
|
19999
|
+
const EVENT_ACTION = 'action';
|
|
20000
|
+
const EVENT_ACTION_END = 'actionend';
|
|
20001
|
+
const EVENT_ACTION_MOVE = 'actionmove';
|
|
20002
|
+
const EVENT_ACTION_START = 'actionstart';
|
|
20003
|
+
const EVENT_CHANGE = 'change';
|
|
20004
|
+
const EVENT_TRANSFORM = 'transform';
|
|
20005
|
+
|
|
20006
|
+
/**
|
|
20007
|
+
* Check if the given value is a string.
|
|
20008
|
+
* @param {*} value The value to check.
|
|
20009
|
+
* @returns {boolean} Returns `true` if the given value is a string, else `false`.
|
|
20010
|
+
*/
|
|
20011
|
+
function isString(value) {
|
|
20012
|
+
return typeof value === 'string';
|
|
20013
|
+
}
|
|
20014
|
+
/**
|
|
20015
|
+
* Check if the given value is not a number.
|
|
20016
|
+
*/
|
|
20017
|
+
const isNaN$1 = Number.isNaN || WINDOW.isNaN;
|
|
20018
|
+
/**
|
|
20019
|
+
* Check if the given value is a number.
|
|
20020
|
+
* @param {*} value The value to check.
|
|
20021
|
+
* @returns {boolean} Returns `true` if the given value is a number, else `false`.
|
|
20022
|
+
*/
|
|
20023
|
+
function isNumber(value) {
|
|
20024
|
+
return typeof value === 'number' && !isNaN$1(value);
|
|
20025
|
+
}
|
|
20026
|
+
/**
|
|
20027
|
+
* Check if the given value is a positive number.
|
|
20028
|
+
* @param {*} value The value to check.
|
|
20029
|
+
* @returns {boolean} Returns `true` if the given value is a positive number, else `false`.
|
|
20030
|
+
*/
|
|
20031
|
+
function isPositiveNumber(value) {
|
|
20032
|
+
return isNumber(value) && value > 0 && value < Infinity;
|
|
20033
|
+
}
|
|
20034
|
+
/**
|
|
20035
|
+
* Check if the given value is undefined.
|
|
20036
|
+
* @param {*} value The value to check.
|
|
20037
|
+
* @returns {boolean} Returns `true` if the given value is undefined, else `false`.
|
|
20038
|
+
*/
|
|
20039
|
+
function isUndefined(value) {
|
|
20040
|
+
return typeof value === 'undefined';
|
|
20041
|
+
}
|
|
20042
|
+
/**
|
|
20043
|
+
* Check if the given value is an object.
|
|
20044
|
+
* @param {*} value - The value to check.
|
|
20045
|
+
* @returns {boolean} Returns `true` if the given value is an object, else `false`.
|
|
20046
|
+
*/
|
|
20047
|
+
function isObject(value) {
|
|
20048
|
+
return typeof value === 'object' && value !== null;
|
|
20049
|
+
}
|
|
20050
|
+
const { hasOwnProperty } = Object.prototype;
|
|
20051
|
+
/**
|
|
20052
|
+
* Check if the given value is a plain object.
|
|
20053
|
+
* @param {*} value - The value to check.
|
|
20054
|
+
* @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
|
|
20055
|
+
*/
|
|
20056
|
+
function isPlainObject(value) {
|
|
20057
|
+
if (!isObject(value)) {
|
|
20058
|
+
return false;
|
|
20059
|
+
}
|
|
20060
|
+
try {
|
|
20061
|
+
const { constructor } = value;
|
|
20062
|
+
const { prototype } = constructor;
|
|
20063
|
+
return constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
|
|
20064
|
+
}
|
|
20065
|
+
catch (error) {
|
|
20066
|
+
return false;
|
|
20067
|
+
}
|
|
20068
|
+
}
|
|
20069
|
+
/**
|
|
20070
|
+
* Check if the given value is a function.
|
|
20071
|
+
* @param {*} value The value to check.
|
|
20072
|
+
* @returns {boolean} Returns `true` if the given value is a function, else `false`.
|
|
20073
|
+
*/
|
|
20074
|
+
function isFunction$1(value) {
|
|
20075
|
+
return typeof value === 'function';
|
|
20076
|
+
}
|
|
20077
|
+
/**
|
|
20078
|
+
* Check if the given node is an element.
|
|
20079
|
+
* @param {*} node The node to check.
|
|
20080
|
+
* @returns {boolean} Returns `true` if the given node is an element; otherwise, `false`.
|
|
20081
|
+
*/
|
|
20082
|
+
function isElement$1(node) {
|
|
20083
|
+
return typeof node === 'object' && node !== null && node.nodeType === 1;
|
|
20084
|
+
}
|
|
20085
|
+
const REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g;
|
|
20086
|
+
/**
|
|
20087
|
+
* Transform the given string from camelCase to kebab-case.
|
|
20088
|
+
* @param {string} value The value to transform.
|
|
20089
|
+
* @returns {string} Returns the transformed value.
|
|
20090
|
+
*/
|
|
20091
|
+
function toKebabCase(value) {
|
|
20092
|
+
return String(value).replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase();
|
|
20093
|
+
}
|
|
20094
|
+
const REGEXP_KEBAB_CASE = /-[A-z\d]/g;
|
|
20095
|
+
/**
|
|
20096
|
+
* Transform the given string from kebab-case to camelCase.
|
|
20097
|
+
* @param {string} value The value to transform.
|
|
20098
|
+
* @returns {string} Returns the transformed value.
|
|
20099
|
+
*/
|
|
20100
|
+
function toCamelCase(value) {
|
|
20101
|
+
return value.replace(REGEXP_KEBAB_CASE, (substring) => substring.slice(1).toUpperCase());
|
|
20102
|
+
}
|
|
20103
|
+
const REGEXP_SPACES = /\s\s*/;
|
|
20104
|
+
/**
|
|
20105
|
+
* Remove event listener from the event target.
|
|
20106
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener}
|
|
20107
|
+
* @param {EventTarget} target The target of the event.
|
|
20108
|
+
* @param {string} types The types of the event.
|
|
20109
|
+
* @param {EventListenerOrEventListenerObject} listener The listener of the event.
|
|
20110
|
+
* @param {EventListenerOptions} [options] The options specify characteristics about the event listener.
|
|
20111
|
+
*/
|
|
20112
|
+
function off(target, types, listener, options) {
|
|
20113
|
+
types.trim().split(REGEXP_SPACES).forEach((type) => {
|
|
20114
|
+
target.removeEventListener(type, listener, options);
|
|
20115
|
+
});
|
|
20116
|
+
}
|
|
20117
|
+
/**
|
|
20118
|
+
* Add event listener to the event target.
|
|
20119
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener}
|
|
20120
|
+
* @param {EventTarget} target The target of the event.
|
|
20121
|
+
* @param {string} types The types of the event.
|
|
20122
|
+
* @param {EventListenerOrEventListenerObject} listener The listener of the event.
|
|
20123
|
+
* @param {AddEventListenerOptions} [options] The options specify characteristics about the event listener.
|
|
20124
|
+
*/
|
|
20125
|
+
function on(target, types, listener, options) {
|
|
20126
|
+
types.trim().split(REGEXP_SPACES).forEach((type) => {
|
|
20127
|
+
target.addEventListener(type, listener, options);
|
|
20128
|
+
});
|
|
20129
|
+
}
|
|
20130
|
+
/**
|
|
20131
|
+
* Add once event listener to the event target.
|
|
20132
|
+
* @param {EventTarget} target The target of the event.
|
|
20133
|
+
* @param {string} types The types of the event.
|
|
20134
|
+
* @param {EventListenerOrEventListenerObject} listener The listener of the event.
|
|
20135
|
+
* @param {AddEventListenerOptions} [options] The options specify characteristics about the event listener.
|
|
20136
|
+
*/
|
|
20137
|
+
function once(target, types, listener, options) {
|
|
20138
|
+
on(target, types, listener, Object.assign(Object.assign({}, options), { once: true }));
|
|
20139
|
+
}
|
|
20140
|
+
const defaultEventOptions = {
|
|
20141
|
+
bubbles: true,
|
|
20142
|
+
cancelable: true,
|
|
20143
|
+
composed: true,
|
|
20144
|
+
};
|
|
20145
|
+
/**
|
|
20146
|
+
* Dispatch event on the event target.
|
|
20147
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent}
|
|
20148
|
+
* @param {EventTarget} target The target of the event.
|
|
20149
|
+
* @param {string} type The name of the event.
|
|
20150
|
+
* @param {*} [detail] The data passed when initializing the event.
|
|
20151
|
+
* @param {CustomEventInit} [options] The other event options.
|
|
20152
|
+
* @returns {boolean} Returns the result value.
|
|
20153
|
+
*/
|
|
20154
|
+
function emit(target, type, detail, options) {
|
|
20155
|
+
return target.dispatchEvent(new CustomEvent(type, Object.assign(Object.assign(Object.assign({}, defaultEventOptions), { detail }), options)));
|
|
20156
|
+
}
|
|
20157
|
+
const resolvedPromise = Promise.resolve();
|
|
20158
|
+
/**
|
|
20159
|
+
* Defers the callback to be executed after the next DOM update cycle.
|
|
20160
|
+
* @param {*} [context] The `this` context.
|
|
20161
|
+
* @param {Function} [callback] The callback to execute after the next DOM update cycle.
|
|
20162
|
+
* @returns {Promise} A promise that resolves to nothing.
|
|
20163
|
+
*/
|
|
20164
|
+
function nextTick(context, callback) {
|
|
20165
|
+
return callback
|
|
20166
|
+
? resolvedPromise.then(context ? callback.bind(context) : callback)
|
|
20167
|
+
: resolvedPromise;
|
|
20168
|
+
}
|
|
20169
|
+
/**
|
|
20170
|
+
* Get the offset base on the document.
|
|
20171
|
+
* @param {Element} element The target element.
|
|
20172
|
+
* @returns {object} The offset data.
|
|
20173
|
+
*/
|
|
20174
|
+
function getOffset(element) {
|
|
20175
|
+
const { documentElement } = element.ownerDocument;
|
|
20176
|
+
const box = element.getBoundingClientRect();
|
|
20177
|
+
return {
|
|
20178
|
+
left: box.left + (WINDOW.pageXOffset - documentElement.clientLeft),
|
|
20179
|
+
top: box.top + (WINDOW.pageYOffset - documentElement.clientTop),
|
|
20180
|
+
};
|
|
20181
|
+
}
|
|
20182
|
+
const REGEXP_ANGLE_UNIT = /deg|g?rad|turn$/i;
|
|
20183
|
+
/**
|
|
20184
|
+
* Convert an angle to a radian number.
|
|
20185
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/angle}
|
|
20186
|
+
* @param {number|string} angle The angle to convert.
|
|
20187
|
+
* @returns {number} Returns the radian number.
|
|
20188
|
+
*/
|
|
20189
|
+
function toAngleInRadian(angle) {
|
|
20190
|
+
const value = parseFloat(angle) || 0;
|
|
20191
|
+
if (value !== 0) {
|
|
20192
|
+
const [unit = 'rad'] = String(angle).match(REGEXP_ANGLE_UNIT) || [];
|
|
20193
|
+
switch (unit.toLowerCase()) {
|
|
20194
|
+
case 'deg':
|
|
20195
|
+
return (value / 360) * (Math.PI * 2);
|
|
20196
|
+
case 'grad':
|
|
20197
|
+
return (value / 400) * (Math.PI * 2);
|
|
20198
|
+
case 'turn':
|
|
20199
|
+
return value * (Math.PI * 2);
|
|
20200
|
+
}
|
|
20201
|
+
}
|
|
20202
|
+
return value;
|
|
20203
|
+
}
|
|
20204
|
+
const SIZE_ADJUSTMENT_TYPE_CONTAIN = 'contain';
|
|
20205
|
+
const SIZE_ADJUSTMENT_TYPE_COVER = 'cover';
|
|
20206
|
+
/**
|
|
20207
|
+
* Get the max sizes in a rectangle under the given aspect ratio.
|
|
20208
|
+
* @param {object} data The original sizes.
|
|
20209
|
+
* @param {string} [type] The adjust type.
|
|
20210
|
+
* @returns {object} Returns the result sizes.
|
|
20211
|
+
*/
|
|
20212
|
+
function getAdjustedSizes(data, type = SIZE_ADJUSTMENT_TYPE_CONTAIN) {
|
|
20213
|
+
const { aspectRatio } = data;
|
|
20214
|
+
let { width, height } = data;
|
|
20215
|
+
const isValidWidth = isPositiveNumber(width);
|
|
20216
|
+
const isValidHeight = isPositiveNumber(height);
|
|
20217
|
+
if (isValidWidth && isValidHeight) {
|
|
20218
|
+
const adjustedWidth = height * aspectRatio;
|
|
20219
|
+
if ((type === SIZE_ADJUSTMENT_TYPE_CONTAIN && adjustedWidth > width)
|
|
20220
|
+
|| (type === SIZE_ADJUSTMENT_TYPE_COVER && adjustedWidth < width)) {
|
|
20221
|
+
height = width / aspectRatio;
|
|
20222
|
+
}
|
|
20223
|
+
else {
|
|
20224
|
+
width = height * aspectRatio;
|
|
20225
|
+
}
|
|
20226
|
+
}
|
|
20227
|
+
else if (isValidWidth) {
|
|
20228
|
+
height = width / aspectRatio;
|
|
20229
|
+
}
|
|
20230
|
+
else if (isValidHeight) {
|
|
20231
|
+
width = height * aspectRatio;
|
|
20232
|
+
}
|
|
20233
|
+
return {
|
|
20234
|
+
width,
|
|
20235
|
+
height,
|
|
20236
|
+
};
|
|
20237
|
+
}
|
|
20238
|
+
/**
|
|
20239
|
+
* Multiply multiple matrices.
|
|
20240
|
+
* @param {Array} matrix The first matrix.
|
|
20241
|
+
* @param {Array} args The rest matrices.
|
|
20242
|
+
* @returns {Array} Returns the result matrix.
|
|
20243
|
+
*/
|
|
20244
|
+
function multiplyMatrices(matrix, ...args) {
|
|
20245
|
+
if (args.length === 0) {
|
|
20246
|
+
return matrix;
|
|
20247
|
+
}
|
|
20248
|
+
const [a1, b1, c1, d1, e1, f1] = matrix;
|
|
20249
|
+
const [a2, b2, c2, d2, e2, f2] = args[0];
|
|
20250
|
+
// ┌ a1 c1 e1 ┐ ┌ a2 c2 e2 ┐
|
|
20251
|
+
// │ b1 d1 f1 │ × │ b2 d2 f2 │
|
|
20252
|
+
// └ 0 0 1 ┘ └ 0 0 1 ┘
|
|
20253
|
+
matrix = [
|
|
20254
|
+
a1 * a2 + c1 * b2 /* + e1 * 0 */,
|
|
20255
|
+
b1 * a2 + d1 * b2 /* + f1 * 0 */,
|
|
20256
|
+
a1 * c2 + c1 * d2 /* + e1 * 0 */,
|
|
20257
|
+
b1 * c2 + d1 * d2 /* + f1 * 0 */,
|
|
20258
|
+
a1 * e2 + c1 * f2 + e1 /* * 1 */,
|
|
20259
|
+
b1 * e2 + d1 * f2 + f1 /* * 1 */,
|
|
20260
|
+
];
|
|
20261
|
+
return multiplyMatrices(matrix, ...args.slice(1));
|
|
20262
|
+
}
|
|
20263
|
+
|
|
20264
|
+
var style$8 = `:host([hidden]){display:none!important}`;
|
|
20265
|
+
|
|
20266
|
+
const REGEXP_SUFFIX = /left|top|width|height/i;
|
|
20267
|
+
const DEFAULT_SHADOW_ROOT_MODE = 'open';
|
|
20268
|
+
const shadowRoots = new WeakMap();
|
|
20269
|
+
const styleSheets = new WeakMap();
|
|
20270
|
+
const tagNames = new Map();
|
|
20271
|
+
const supportsAdoptedStyleSheets = WINDOW.document && Array.isArray(WINDOW.document.adoptedStyleSheets) && 'replaceSync' in WINDOW.CSSStyleSheet.prototype;
|
|
20272
|
+
class CropperElement extends HTMLElement {
|
|
20273
|
+
get $sharedStyle() {
|
|
20274
|
+
return `${this.themeColor ? `:host{--theme-color: ${this.themeColor};}` : ''}${style$8}`;
|
|
20275
|
+
}
|
|
20276
|
+
constructor() {
|
|
20277
|
+
var _a, _b;
|
|
20278
|
+
super();
|
|
20279
|
+
this.shadowRootMode = DEFAULT_SHADOW_ROOT_MODE;
|
|
20280
|
+
this.slottable = true;
|
|
20281
|
+
const name = (_b = (_a = Object.getPrototypeOf(this)) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.$name;
|
|
20282
|
+
if (name) {
|
|
20283
|
+
tagNames.set(name, this.tagName.toLowerCase());
|
|
20284
|
+
}
|
|
20285
|
+
}
|
|
20286
|
+
static get observedAttributes() {
|
|
20287
|
+
return [
|
|
20288
|
+
'shadow-root-mode',
|
|
20289
|
+
'slottable',
|
|
20290
|
+
'theme-color',
|
|
20291
|
+
];
|
|
20292
|
+
}
|
|
20293
|
+
// Convert attribute to property
|
|
20294
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
20295
|
+
if (Object.is(newValue, oldValue)) {
|
|
20296
|
+
return;
|
|
20297
|
+
}
|
|
20298
|
+
const propertyName = toCamelCase(name);
|
|
20299
|
+
const oldPropertyValue = this[propertyName];
|
|
20300
|
+
let newPropertyValue = newValue;
|
|
20301
|
+
switch (typeof oldPropertyValue) {
|
|
20302
|
+
case 'boolean':
|
|
20303
|
+
newPropertyValue = newValue !== null && newValue !== 'false';
|
|
20304
|
+
break;
|
|
20305
|
+
case 'number':
|
|
20306
|
+
newPropertyValue = Number(newValue);
|
|
20307
|
+
break;
|
|
20308
|
+
}
|
|
20309
|
+
this[propertyName] = newPropertyValue;
|
|
20310
|
+
switch (name) {
|
|
20311
|
+
case 'theme-color': {
|
|
20312
|
+
const styleSheet = styleSheets.get(this);
|
|
20313
|
+
const styles = this.$sharedStyle;
|
|
20314
|
+
if (styleSheet && styles) {
|
|
20315
|
+
if (supportsAdoptedStyleSheets) {
|
|
20316
|
+
styleSheet.replaceSync(styles);
|
|
20317
|
+
}
|
|
20318
|
+
else {
|
|
20319
|
+
styleSheet.textContent = styles;
|
|
20320
|
+
}
|
|
20321
|
+
}
|
|
20322
|
+
break;
|
|
20323
|
+
}
|
|
20324
|
+
}
|
|
20325
|
+
}
|
|
20326
|
+
// Convert property to attribute
|
|
20327
|
+
$propertyChangedCallback(name, oldValue, newValue) {
|
|
20328
|
+
if (Object.is(newValue, oldValue)) {
|
|
20329
|
+
return;
|
|
20330
|
+
}
|
|
20331
|
+
name = toKebabCase(name);
|
|
20332
|
+
switch (typeof newValue) {
|
|
20333
|
+
case 'boolean':
|
|
20334
|
+
if (newValue === true) {
|
|
20335
|
+
if (!this.hasAttribute(name)) {
|
|
20336
|
+
this.setAttribute(name, '');
|
|
20337
|
+
}
|
|
20338
|
+
}
|
|
20339
|
+
else {
|
|
20340
|
+
this.removeAttribute(name);
|
|
20341
|
+
}
|
|
20342
|
+
break;
|
|
20343
|
+
case 'number':
|
|
20344
|
+
if (isNaN$1(newValue)) {
|
|
20345
|
+
newValue = '';
|
|
20346
|
+
}
|
|
20347
|
+
else {
|
|
20348
|
+
newValue = String(newValue);
|
|
20349
|
+
}
|
|
20350
|
+
// Fall through
|
|
20351
|
+
// case 'string':
|
|
20352
|
+
// eslint-disable-next-line no-fallthrough
|
|
20353
|
+
default:
|
|
20354
|
+
if (newValue) {
|
|
20355
|
+
if (this.getAttribute(name) !== newValue) {
|
|
20356
|
+
this.setAttribute(name, newValue);
|
|
20357
|
+
}
|
|
20358
|
+
}
|
|
20359
|
+
else {
|
|
20360
|
+
this.removeAttribute(name);
|
|
20361
|
+
}
|
|
20362
|
+
}
|
|
20363
|
+
}
|
|
20364
|
+
connectedCallback() {
|
|
20365
|
+
// Observe properties after observed attributes
|
|
20366
|
+
Object.getPrototypeOf(this).constructor.observedAttributes.forEach((attribute) => {
|
|
20367
|
+
const property = toCamelCase(attribute);
|
|
20368
|
+
let value = this[property];
|
|
20369
|
+
if (!isUndefined(value)) {
|
|
20370
|
+
this.$propertyChangedCallback(property, undefined, value);
|
|
20371
|
+
}
|
|
20372
|
+
Object.defineProperty(this, property, {
|
|
20373
|
+
enumerable: true,
|
|
20374
|
+
configurable: true,
|
|
20375
|
+
get() {
|
|
20376
|
+
return value;
|
|
20377
|
+
},
|
|
20378
|
+
set(newValue) {
|
|
20379
|
+
const oldValue = value;
|
|
20380
|
+
value = newValue;
|
|
20381
|
+
this.$propertyChangedCallback(property, oldValue, newValue);
|
|
20382
|
+
},
|
|
20383
|
+
});
|
|
20384
|
+
});
|
|
20385
|
+
const shadow = this.attachShadow({
|
|
20386
|
+
mode: this.shadowRootMode || DEFAULT_SHADOW_ROOT_MODE,
|
|
20387
|
+
});
|
|
20388
|
+
if (!this.shadowRoot) {
|
|
20389
|
+
shadowRoots.set(this, shadow);
|
|
20390
|
+
}
|
|
20391
|
+
styleSheets.set(this, this.$addStyles(this.$sharedStyle));
|
|
20392
|
+
if (this.$style) {
|
|
20393
|
+
this.$addStyles(this.$style);
|
|
20394
|
+
}
|
|
20395
|
+
if (this.$template) {
|
|
20396
|
+
const template = document.createElement('template');
|
|
20397
|
+
template.innerHTML = this.$template;
|
|
20398
|
+
shadow.appendChild(template.content);
|
|
20399
|
+
}
|
|
20400
|
+
if (this.slottable) {
|
|
20401
|
+
const slot = document.createElement('slot');
|
|
20402
|
+
shadow.appendChild(slot);
|
|
20403
|
+
}
|
|
20404
|
+
}
|
|
20405
|
+
disconnectedCallback() {
|
|
20406
|
+
if (styleSheets.has(this)) {
|
|
20407
|
+
styleSheets.delete(this);
|
|
20408
|
+
}
|
|
20409
|
+
if (shadowRoots.has(this)) {
|
|
20410
|
+
shadowRoots.delete(this);
|
|
20411
|
+
}
|
|
20412
|
+
}
|
|
20413
|
+
// eslint-disable-next-line class-methods-use-this
|
|
20414
|
+
$getTagNameOf(name) {
|
|
20415
|
+
var _a;
|
|
20416
|
+
return (_a = tagNames.get(name)) !== null && _a !== void 0 ? _a : name;
|
|
20417
|
+
}
|
|
20418
|
+
$setStyles(properties) {
|
|
20419
|
+
Object.keys(properties).forEach((property) => {
|
|
20420
|
+
let value = properties[property];
|
|
20421
|
+
if (isNumber(value)) {
|
|
20422
|
+
if (value !== 0 && REGEXP_SUFFIX.test(property)) {
|
|
20423
|
+
value = `${value}px`;
|
|
20424
|
+
}
|
|
20425
|
+
else {
|
|
20426
|
+
value = String(value);
|
|
20427
|
+
}
|
|
20428
|
+
}
|
|
20429
|
+
this.style[property] = value;
|
|
20430
|
+
});
|
|
20431
|
+
return this;
|
|
20432
|
+
}
|
|
20433
|
+
/**
|
|
20434
|
+
* Outputs the shadow root of the element.
|
|
20435
|
+
* @returns {ShadowRoot} Returns the shadow root.
|
|
20436
|
+
*/
|
|
20437
|
+
$getShadowRoot() {
|
|
20438
|
+
return this.shadowRoot || shadowRoots.get(this);
|
|
20439
|
+
}
|
|
20440
|
+
/**
|
|
20441
|
+
* Adds styles to the shadow root.
|
|
20442
|
+
* @param {string} styles The styles to add.
|
|
20443
|
+
* @returns {CSSStyleSheet|HTMLStyleElement} Returns the generated style sheet.
|
|
20444
|
+
*/
|
|
20445
|
+
$addStyles(styles) {
|
|
20446
|
+
let styleSheet;
|
|
20447
|
+
const shadow = this.$getShadowRoot();
|
|
20448
|
+
if (supportsAdoptedStyleSheets) {
|
|
20449
|
+
styleSheet = new CSSStyleSheet();
|
|
20450
|
+
styleSheet.replaceSync(styles);
|
|
20451
|
+
shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.concat(styleSheet);
|
|
20452
|
+
}
|
|
20453
|
+
else {
|
|
20454
|
+
styleSheet = document.createElement('style');
|
|
20455
|
+
styleSheet.textContent = styles;
|
|
20456
|
+
shadow.appendChild(styleSheet);
|
|
20457
|
+
}
|
|
20458
|
+
return styleSheet;
|
|
20459
|
+
}
|
|
20460
|
+
/**
|
|
20461
|
+
* Dispatches an event at the element.
|
|
20462
|
+
* @param {string} type The name of the event.
|
|
20463
|
+
* @param {*} [detail] The data passed when initializing the event.
|
|
20464
|
+
* @param {CustomEventInit} [options] The other event options.
|
|
20465
|
+
* @returns {boolean} Returns the result value.
|
|
20466
|
+
*/
|
|
20467
|
+
$emit(type, detail, options) {
|
|
20468
|
+
return emit(this, type, detail, options);
|
|
20469
|
+
}
|
|
20470
|
+
/**
|
|
20471
|
+
* Defers the callback to be executed after the next DOM update cycle.
|
|
20472
|
+
* @param {Function} [callback] The callback to execute after the next DOM update cycle.
|
|
20473
|
+
* @returns {Promise} A promise that resolves to nothing.
|
|
20474
|
+
*/
|
|
20475
|
+
$nextTick(callback) {
|
|
20476
|
+
return nextTick(this, callback);
|
|
20477
|
+
}
|
|
20478
|
+
/**
|
|
20479
|
+
* Defines the constructor as a new custom element.
|
|
20480
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define}
|
|
20481
|
+
* @param {string|object} [name] The element name.
|
|
20482
|
+
* @param {object} [options] The element definition options.
|
|
20483
|
+
*/
|
|
20484
|
+
static $define(name, options) {
|
|
20485
|
+
if (isObject(name)) {
|
|
20486
|
+
options = name;
|
|
20487
|
+
name = '';
|
|
20488
|
+
}
|
|
20489
|
+
if (!name) {
|
|
20490
|
+
name = this.$name || this.name;
|
|
20491
|
+
}
|
|
20492
|
+
name = toKebabCase(name);
|
|
20493
|
+
if (IS_BROWSER && WINDOW.customElements && !WINDOW.customElements.get(name)) {
|
|
20494
|
+
customElements.define(name, this, options);
|
|
20495
|
+
}
|
|
20496
|
+
}
|
|
20497
|
+
}
|
|
20498
|
+
CropperElement.$version = '2.0.0';
|
|
20499
|
+
|
|
20500
|
+
var style$7 = `:host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}`;
|
|
20501
|
+
|
|
20502
|
+
class CropperCanvas extends CropperElement {
|
|
20503
|
+
constructor() {
|
|
20504
|
+
super(...arguments);
|
|
20505
|
+
this.$onPointerDown = null;
|
|
20506
|
+
this.$onPointerMove = null;
|
|
20507
|
+
this.$onPointerUp = null;
|
|
20508
|
+
this.$onWheel = null;
|
|
20509
|
+
this.$wheeling = false;
|
|
20510
|
+
this.$pointers = new Map();
|
|
20511
|
+
this.$style = style$7;
|
|
20512
|
+
this.$action = ACTION_NONE;
|
|
20513
|
+
this.background = false;
|
|
20514
|
+
this.disabled = false;
|
|
20515
|
+
this.scaleStep = 0.1;
|
|
20516
|
+
this.themeColor = '#39f';
|
|
20517
|
+
}
|
|
20518
|
+
static get observedAttributes() {
|
|
20519
|
+
return super.observedAttributes.concat([
|
|
20520
|
+
'background',
|
|
20521
|
+
'disabled',
|
|
20522
|
+
'scale-step',
|
|
20523
|
+
]);
|
|
20524
|
+
}
|
|
20525
|
+
connectedCallback() {
|
|
20526
|
+
super.connectedCallback();
|
|
20527
|
+
if (!this.disabled) {
|
|
20528
|
+
this.$bind();
|
|
20529
|
+
}
|
|
20530
|
+
}
|
|
20531
|
+
disconnectedCallback() {
|
|
20532
|
+
if (!this.disabled) {
|
|
20533
|
+
this.$unbind();
|
|
20534
|
+
}
|
|
20535
|
+
super.disconnectedCallback();
|
|
20536
|
+
}
|
|
20537
|
+
$propertyChangedCallback(name, oldValue, newValue) {
|
|
20538
|
+
if (Object.is(newValue, oldValue)) {
|
|
20539
|
+
return;
|
|
20540
|
+
}
|
|
20541
|
+
super.$propertyChangedCallback(name, oldValue, newValue);
|
|
20542
|
+
switch (name) {
|
|
20543
|
+
case 'disabled':
|
|
20544
|
+
if (newValue) {
|
|
20545
|
+
this.$unbind();
|
|
20546
|
+
}
|
|
20547
|
+
else {
|
|
20548
|
+
this.$bind();
|
|
20549
|
+
}
|
|
20550
|
+
break;
|
|
20551
|
+
}
|
|
20552
|
+
}
|
|
20553
|
+
$bind() {
|
|
20554
|
+
if (!this.$onPointerDown) {
|
|
20555
|
+
this.$onPointerDown = this.$handlePointerDown.bind(this);
|
|
20556
|
+
on(this, EVENT_POINTER_DOWN, this.$onPointerDown);
|
|
20557
|
+
}
|
|
20558
|
+
if (!this.$onPointerMove) {
|
|
20559
|
+
this.$onPointerMove = this.$handlePointerMove.bind(this);
|
|
20560
|
+
on(this.ownerDocument, EVENT_POINTER_MOVE, this.$onPointerMove);
|
|
20561
|
+
}
|
|
20562
|
+
if (!this.$onPointerUp) {
|
|
20563
|
+
this.$onPointerUp = this.$handlePointerUp.bind(this);
|
|
20564
|
+
on(this.ownerDocument, EVENT_POINTER_UP, this.$onPointerUp);
|
|
20565
|
+
}
|
|
20566
|
+
if (!this.$onWheel) {
|
|
20567
|
+
this.$onWheel = this.$handleWheel.bind(this);
|
|
20568
|
+
on(this, EVENT_WHEEL, this.$onWheel, {
|
|
20569
|
+
passive: false,
|
|
20570
|
+
capture: true,
|
|
20571
|
+
});
|
|
20572
|
+
}
|
|
20573
|
+
}
|
|
20574
|
+
$unbind() {
|
|
20575
|
+
if (this.$onPointerDown) {
|
|
20576
|
+
off(this, EVENT_POINTER_DOWN, this.$onPointerDown);
|
|
20577
|
+
this.$onPointerDown = null;
|
|
20578
|
+
}
|
|
20579
|
+
if (this.$onPointerMove) {
|
|
20580
|
+
off(this.ownerDocument, EVENT_POINTER_MOVE, this.$onPointerMove);
|
|
20581
|
+
this.$onPointerMove = null;
|
|
20582
|
+
}
|
|
20583
|
+
if (this.$onPointerUp) {
|
|
20584
|
+
off(this.ownerDocument, EVENT_POINTER_UP, this.$onPointerUp);
|
|
20585
|
+
this.$onPointerUp = null;
|
|
20586
|
+
}
|
|
20587
|
+
if (this.$onWheel) {
|
|
20588
|
+
off(this, EVENT_WHEEL, this.$onWheel, {
|
|
20589
|
+
capture: true,
|
|
20590
|
+
});
|
|
20591
|
+
this.$onWheel = null;
|
|
20592
|
+
}
|
|
20593
|
+
}
|
|
20594
|
+
$handlePointerDown(event) {
|
|
20595
|
+
const { buttons, button, type } = event;
|
|
20596
|
+
if (this.disabled || (
|
|
20597
|
+
// Handle pointer or mouse event, and ignore touch event
|
|
20598
|
+
((type === 'pointerdown' && event.pointerType === 'mouse') || type === 'mousedown') && (
|
|
20599
|
+
// No primary button (Usually the left button)
|
|
20600
|
+
(isNumber(buttons) && buttons !== 1) || (isNumber(button) && button !== 0)
|
|
20601
|
+
// Open context menu
|
|
20602
|
+
|| event.ctrlKey))) {
|
|
20603
|
+
return;
|
|
20604
|
+
}
|
|
20605
|
+
const { $pointers } = this;
|
|
20606
|
+
let action = '';
|
|
20607
|
+
if (event.changedTouches) {
|
|
20608
|
+
Array.from(event.changedTouches).forEach(({ identifier, pageX, pageY, }) => {
|
|
20609
|
+
$pointers.set(identifier, {
|
|
20610
|
+
startX: pageX,
|
|
20611
|
+
startY: pageY,
|
|
20612
|
+
endX: pageX,
|
|
20613
|
+
endY: pageY,
|
|
20614
|
+
});
|
|
20615
|
+
});
|
|
20616
|
+
}
|
|
20617
|
+
else {
|
|
20618
|
+
const { pointerId = 0, pageX, pageY } = event;
|
|
20619
|
+
$pointers.set(pointerId, {
|
|
20620
|
+
startX: pageX,
|
|
20621
|
+
startY: pageY,
|
|
20622
|
+
endX: pageX,
|
|
20623
|
+
endY: pageY,
|
|
20624
|
+
});
|
|
20625
|
+
}
|
|
20626
|
+
if ($pointers.size > 1) {
|
|
20627
|
+
action = ACTION_TRANSFORM;
|
|
20628
|
+
}
|
|
20629
|
+
else if (isElement$1(event.target)) {
|
|
20630
|
+
action = event.target.action || event.target.getAttribute(ATTRIBUTE_ACTION) || '';
|
|
20631
|
+
}
|
|
20632
|
+
if (this.$emit(EVENT_ACTION_START, {
|
|
20633
|
+
action,
|
|
20634
|
+
relatedEvent: event,
|
|
20635
|
+
}) === false) {
|
|
20636
|
+
return;
|
|
20637
|
+
}
|
|
20638
|
+
// Prevent page zooming in the browsers for iOS.
|
|
20639
|
+
event.preventDefault();
|
|
20640
|
+
this.$action = action;
|
|
20641
|
+
this.style.willChange = 'transform';
|
|
20642
|
+
}
|
|
20643
|
+
$handlePointerMove(event) {
|
|
20644
|
+
const { $action, $pointers } = this;
|
|
20645
|
+
if (this.disabled || $action === ACTION_NONE || $pointers.size === 0) {
|
|
20646
|
+
return;
|
|
20647
|
+
}
|
|
20648
|
+
if (this.$emit(EVENT_ACTION_MOVE, {
|
|
20649
|
+
action: $action,
|
|
20650
|
+
relatedEvent: event,
|
|
20651
|
+
}) === false) {
|
|
20652
|
+
return;
|
|
20653
|
+
}
|
|
20654
|
+
// Prevent page scrolling.
|
|
20655
|
+
event.preventDefault();
|
|
20656
|
+
if (event.changedTouches) {
|
|
20657
|
+
Array.from(event.changedTouches).forEach(({ identifier, pageX, pageY, }) => {
|
|
20658
|
+
const pointer = $pointers.get(identifier);
|
|
20659
|
+
if (pointer) {
|
|
20660
|
+
Object.assign(pointer, {
|
|
20661
|
+
endX: pageX,
|
|
20662
|
+
endY: pageY,
|
|
20663
|
+
});
|
|
20664
|
+
}
|
|
20665
|
+
});
|
|
20666
|
+
}
|
|
20667
|
+
else {
|
|
20668
|
+
const { pointerId = 0, pageX, pageY } = event;
|
|
20669
|
+
const pointer = $pointers.get(pointerId);
|
|
20670
|
+
if (pointer) {
|
|
20671
|
+
Object.assign(pointer, {
|
|
20672
|
+
endX: pageX,
|
|
20673
|
+
endY: pageY,
|
|
20674
|
+
});
|
|
20675
|
+
}
|
|
20676
|
+
}
|
|
20677
|
+
const detail = {
|
|
20678
|
+
action: $action,
|
|
20679
|
+
relatedEvent: event,
|
|
20680
|
+
};
|
|
20681
|
+
if ($action === ACTION_TRANSFORM) {
|
|
20682
|
+
const pointers2 = new Map($pointers);
|
|
20683
|
+
let maxRotateRate = 0;
|
|
20684
|
+
let maxScaleRate = 0;
|
|
20685
|
+
let rotate = 0;
|
|
20686
|
+
let scale = 0;
|
|
20687
|
+
let centerX = event.pageX;
|
|
20688
|
+
let centerY = event.pageY;
|
|
20689
|
+
$pointers.forEach((pointer, pointerId) => {
|
|
20690
|
+
pointers2.delete(pointerId);
|
|
20691
|
+
pointers2.forEach((pointer2) => {
|
|
20692
|
+
let x1 = pointer2.startX - pointer.startX;
|
|
20693
|
+
let y1 = pointer2.startY - pointer.startY;
|
|
20694
|
+
let x2 = pointer2.endX - pointer.endX;
|
|
20695
|
+
let y2 = pointer2.endY - pointer.endY;
|
|
20696
|
+
let z1 = 0;
|
|
20697
|
+
let z2 = 0;
|
|
20698
|
+
let a1 = 0;
|
|
20699
|
+
let a2 = 0;
|
|
20700
|
+
if (x1 === 0) {
|
|
20701
|
+
if (y1 < 0) {
|
|
20702
|
+
a1 = Math.PI * 2;
|
|
20703
|
+
}
|
|
20704
|
+
else if (y1 > 0) {
|
|
20705
|
+
a1 = Math.PI;
|
|
20706
|
+
}
|
|
20707
|
+
}
|
|
20708
|
+
else if (x1 > 0) {
|
|
20709
|
+
a1 = (Math.PI / 2) + Math.atan(y1 / x1);
|
|
20710
|
+
}
|
|
20711
|
+
else if (x1 < 0) {
|
|
20712
|
+
a1 = (Math.PI * 1.5) + Math.atan(y1 / x1);
|
|
20713
|
+
}
|
|
20714
|
+
if (x2 === 0) {
|
|
20715
|
+
if (y2 < 0) {
|
|
20716
|
+
a2 = Math.PI * 2;
|
|
20717
|
+
}
|
|
20718
|
+
else if (y2 > 0) {
|
|
20719
|
+
a2 = Math.PI;
|
|
20720
|
+
}
|
|
20721
|
+
}
|
|
20722
|
+
else if (x2 > 0) {
|
|
20723
|
+
a2 = (Math.PI / 2) + Math.atan(y2 / x2);
|
|
20724
|
+
}
|
|
20725
|
+
else if (x2 < 0) {
|
|
20726
|
+
a2 = (Math.PI * 1.5) + Math.atan(y2 / x2);
|
|
20727
|
+
}
|
|
20728
|
+
if (a2 > 0 || a1 > 0) {
|
|
20729
|
+
const rotateRate = a2 - a1;
|
|
20730
|
+
const absRotateRate = Math.abs(rotateRate);
|
|
20731
|
+
if (absRotateRate > maxRotateRate) {
|
|
20732
|
+
maxRotateRate = absRotateRate;
|
|
20733
|
+
rotate = rotateRate;
|
|
20734
|
+
centerX = (pointer.startX + pointer2.startX) / 2;
|
|
20735
|
+
centerY = (pointer.startY + pointer2.startY) / 2;
|
|
20736
|
+
}
|
|
20737
|
+
}
|
|
20738
|
+
x1 = Math.abs(x1);
|
|
20739
|
+
y1 = Math.abs(y1);
|
|
20740
|
+
x2 = Math.abs(x2);
|
|
20741
|
+
y2 = Math.abs(y2);
|
|
20742
|
+
if (x1 > 0 && y1 > 0) {
|
|
20743
|
+
z1 = Math.sqrt((x1 * x1) + (y1 * y1));
|
|
20744
|
+
}
|
|
20745
|
+
else if (x1 > 0) {
|
|
20746
|
+
z1 = x1;
|
|
20747
|
+
}
|
|
20748
|
+
else if (y1 > 0) {
|
|
20749
|
+
z1 = y1;
|
|
20750
|
+
}
|
|
20751
|
+
if (x2 > 0 && y2 > 0) {
|
|
20752
|
+
z2 = Math.sqrt((x2 * x2) + (y2 * y2));
|
|
20753
|
+
}
|
|
20754
|
+
else if (x2 > 0) {
|
|
20755
|
+
z2 = x2;
|
|
20756
|
+
}
|
|
20757
|
+
else if (y2 > 0) {
|
|
20758
|
+
z2 = y2;
|
|
20759
|
+
}
|
|
20760
|
+
if (z1 > 0 && z2 > 0) {
|
|
20761
|
+
const scaleRate = (z2 - z1) / z1;
|
|
20762
|
+
const absScaleRate = Math.abs(scaleRate);
|
|
20763
|
+
if (absScaleRate > maxScaleRate) {
|
|
20764
|
+
maxScaleRate = absScaleRate;
|
|
20765
|
+
scale = scaleRate;
|
|
20766
|
+
centerX = (pointer.startX + pointer2.startX) / 2;
|
|
20767
|
+
centerY = (pointer.startY + pointer2.startY) / 2;
|
|
20768
|
+
}
|
|
20769
|
+
}
|
|
20770
|
+
});
|
|
20771
|
+
});
|
|
20772
|
+
const rotatable = maxRotateRate > 0;
|
|
20773
|
+
const scalable = maxScaleRate > 0;
|
|
20774
|
+
if (rotatable && scalable) {
|
|
20775
|
+
detail.rotate = rotate;
|
|
20776
|
+
detail.scale = scale;
|
|
20777
|
+
detail.centerX = centerX;
|
|
20778
|
+
detail.centerY = centerY;
|
|
20779
|
+
}
|
|
20780
|
+
else if (rotatable) {
|
|
20781
|
+
detail.action = ACTION_ROTATE;
|
|
20782
|
+
detail.rotate = rotate;
|
|
20783
|
+
detail.centerX = centerX;
|
|
20784
|
+
detail.centerY = centerY;
|
|
20785
|
+
}
|
|
20786
|
+
else if (scalable) {
|
|
20787
|
+
detail.action = ACTION_SCALE;
|
|
20788
|
+
detail.scale = scale;
|
|
20789
|
+
detail.centerX = centerX;
|
|
20790
|
+
detail.centerY = centerY;
|
|
20791
|
+
}
|
|
20792
|
+
else {
|
|
20793
|
+
detail.action = ACTION_NONE;
|
|
20794
|
+
}
|
|
20795
|
+
}
|
|
20796
|
+
else {
|
|
20797
|
+
const [pointer] = Array.from($pointers.values());
|
|
20798
|
+
Object.assign(detail, pointer);
|
|
20799
|
+
}
|
|
20800
|
+
// Override the starting coordinate
|
|
20801
|
+
$pointers.forEach((pointer) => {
|
|
20802
|
+
pointer.startX = pointer.endX;
|
|
20803
|
+
pointer.startY = pointer.endY;
|
|
20804
|
+
});
|
|
20805
|
+
if (detail.action !== ACTION_NONE) {
|
|
20806
|
+
this.$emit(EVENT_ACTION, detail, {
|
|
20807
|
+
cancelable: false,
|
|
20808
|
+
});
|
|
20809
|
+
}
|
|
20810
|
+
}
|
|
20811
|
+
$handlePointerUp(event) {
|
|
20812
|
+
const { $action, $pointers } = this;
|
|
20813
|
+
if (this.disabled || $action === ACTION_NONE) {
|
|
20814
|
+
return;
|
|
20815
|
+
}
|
|
20816
|
+
if (this.$emit(EVENT_ACTION_END, {
|
|
20817
|
+
action: $action,
|
|
20818
|
+
relatedEvent: event,
|
|
20819
|
+
}) === false) {
|
|
20820
|
+
return;
|
|
20821
|
+
}
|
|
20822
|
+
event.preventDefault();
|
|
20823
|
+
if (event.changedTouches) {
|
|
20824
|
+
Array.from(event.changedTouches).forEach(({ identifier, }) => {
|
|
20825
|
+
$pointers.delete(identifier);
|
|
20826
|
+
});
|
|
20827
|
+
}
|
|
20828
|
+
else {
|
|
20829
|
+
const { pointerId = 0 } = event;
|
|
20830
|
+
$pointers.delete(pointerId);
|
|
20831
|
+
}
|
|
20832
|
+
if ($pointers.size === 0) {
|
|
20833
|
+
this.style.willChange = '';
|
|
20834
|
+
this.$action = ACTION_NONE;
|
|
20835
|
+
}
|
|
20836
|
+
}
|
|
20837
|
+
$handleWheel(event) {
|
|
20838
|
+
if (this.disabled) {
|
|
20839
|
+
return;
|
|
20840
|
+
}
|
|
20841
|
+
event.preventDefault();
|
|
20842
|
+
// Limit wheel speed to prevent zoom too fast (#21)
|
|
20843
|
+
if (this.$wheeling) {
|
|
20844
|
+
return;
|
|
20845
|
+
}
|
|
20846
|
+
this.$wheeling = true;
|
|
20847
|
+
// Debounce by 50ms
|
|
20848
|
+
setTimeout(() => {
|
|
20849
|
+
this.$wheeling = false;
|
|
20850
|
+
}, 50);
|
|
20851
|
+
const delta = event.deltaY > 0 ? -1 : 1;
|
|
20852
|
+
const scale = delta * this.scaleStep;
|
|
20853
|
+
this.$emit(EVENT_ACTION, {
|
|
20854
|
+
action: ACTION_SCALE,
|
|
20855
|
+
scale,
|
|
20856
|
+
relatedEvent: event,
|
|
20857
|
+
}, {
|
|
20858
|
+
cancelable: false,
|
|
20859
|
+
});
|
|
20860
|
+
}
|
|
20861
|
+
/**
|
|
20862
|
+
* Changes the current action to a new one.
|
|
20863
|
+
* @param {string} action The new action.
|
|
20864
|
+
* @returns {CropperCanvas} Returns `this` for chaining.
|
|
20865
|
+
*/
|
|
20866
|
+
$setAction(action) {
|
|
20867
|
+
if (isString(action)) {
|
|
20868
|
+
this.$action = action;
|
|
20869
|
+
}
|
|
20870
|
+
return this;
|
|
20871
|
+
}
|
|
20872
|
+
/**
|
|
20873
|
+
* Generates a real canvas element, with the image draw into if there is one.
|
|
20874
|
+
* @param {object} [options] The available options.
|
|
20875
|
+
* @param {number} [options.width] The width of the canvas.
|
|
20876
|
+
* @param {number} [options.height] The height of the canvas.
|
|
20877
|
+
* @param {Function} [options.beforeDraw] The function called before drawing the image onto the canvas.
|
|
20878
|
+
* @returns {Promise} Returns a promise that resolves to the generated canvas element.
|
|
20879
|
+
*/
|
|
20880
|
+
$toCanvas(options) {
|
|
20881
|
+
return new Promise((resolve, reject) => {
|
|
20882
|
+
if (!this.isConnected) {
|
|
20883
|
+
reject(new Error('The current element is not connected to the DOM.'));
|
|
20884
|
+
return;
|
|
20885
|
+
}
|
|
20886
|
+
const canvas = document.createElement('canvas');
|
|
20887
|
+
let width = this.offsetWidth;
|
|
20888
|
+
let height = this.offsetHeight;
|
|
20889
|
+
let scale = 1;
|
|
20890
|
+
if (isPlainObject(options)
|
|
20891
|
+
&& (isPositiveNumber(options.width) || isPositiveNumber(options.height))) {
|
|
20892
|
+
({ width, height } = getAdjustedSizes({
|
|
20893
|
+
aspectRatio: width / height,
|
|
20894
|
+
width: options.width,
|
|
20895
|
+
height: options.height,
|
|
20896
|
+
}));
|
|
20897
|
+
scale = width / this.offsetWidth;
|
|
20898
|
+
}
|
|
20899
|
+
canvas.width = width;
|
|
20900
|
+
canvas.height = height;
|
|
20901
|
+
const cropperImage = this.querySelector(this.$getTagNameOf(CROPPER_IMAGE));
|
|
20902
|
+
if (!cropperImage) {
|
|
20903
|
+
resolve(canvas);
|
|
20904
|
+
return;
|
|
20905
|
+
}
|
|
20906
|
+
cropperImage.$ready().then((image) => {
|
|
20907
|
+
const context = canvas.getContext('2d');
|
|
20908
|
+
if (context) {
|
|
20909
|
+
const [a, b, c, d, e, f] = cropperImage.$getTransform();
|
|
20910
|
+
let newE = e;
|
|
20911
|
+
let newF = f;
|
|
20912
|
+
let destWidth = image.naturalWidth;
|
|
20913
|
+
let destHeight = image.naturalHeight;
|
|
20914
|
+
if (scale !== 1) {
|
|
20915
|
+
newE *= scale;
|
|
20916
|
+
newF *= scale;
|
|
20917
|
+
destWidth *= scale;
|
|
20918
|
+
destHeight *= scale;
|
|
20919
|
+
}
|
|
20920
|
+
const centerX = destWidth / 2;
|
|
20921
|
+
const centerY = destHeight / 2;
|
|
20922
|
+
context.fillStyle = 'transparent';
|
|
20923
|
+
context.fillRect(0, 0, width, height);
|
|
20924
|
+
if (isPlainObject(options) && isFunction$1(options.beforeDraw)) {
|
|
20925
|
+
options.beforeDraw.call(this, context, canvas);
|
|
20926
|
+
}
|
|
20927
|
+
context.save();
|
|
20928
|
+
// Move the transform origin to the center of the image.
|
|
20929
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin
|
|
20930
|
+
context.translate(centerX, centerY);
|
|
20931
|
+
context.transform(a, b, c, d, newE, newF);
|
|
20932
|
+
// Reset the transform origin to the top-left of the image.
|
|
20933
|
+
context.translate(-centerX, -centerY);
|
|
20934
|
+
context.drawImage(image, 0, 0, destWidth, destHeight);
|
|
20935
|
+
context.restore();
|
|
20936
|
+
}
|
|
20937
|
+
resolve(canvas);
|
|
20938
|
+
}).catch(reject);
|
|
20939
|
+
});
|
|
20940
|
+
}
|
|
20941
|
+
}
|
|
20942
|
+
CropperCanvas.$name = CROPPER_CANVAS;
|
|
20943
|
+
CropperCanvas.$version = '2.0.0';
|
|
20944
|
+
|
|
20945
|
+
var style$6 = `:host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}`;
|
|
20946
|
+
|
|
20947
|
+
const canvasCache$3 = new WeakMap();
|
|
20948
|
+
const NATIVE_ATTRIBUTES = [
|
|
20949
|
+
'alt',
|
|
20950
|
+
'crossorigin',
|
|
20951
|
+
'decoding',
|
|
20952
|
+
'importance',
|
|
20953
|
+
'loading',
|
|
20954
|
+
'referrerpolicy',
|
|
20955
|
+
'sizes',
|
|
20956
|
+
'src',
|
|
20957
|
+
'srcset',
|
|
20958
|
+
];
|
|
20959
|
+
class CropperImage extends CropperElement {
|
|
20960
|
+
constructor() {
|
|
20961
|
+
super(...arguments);
|
|
20962
|
+
this.$matrix = [1, 0, 0, 1, 0, 0];
|
|
20963
|
+
this.$onLoad = null;
|
|
20964
|
+
this.$onCanvasAction = null;
|
|
20965
|
+
this.$onCanvasActionEnd = null;
|
|
20966
|
+
this.$onCanvasActionStart = null;
|
|
20967
|
+
this.$actionStartTarget = null;
|
|
20968
|
+
this.$style = style$6;
|
|
20969
|
+
this.$image = new Image();
|
|
20970
|
+
this.initialCenterSize = 'contain';
|
|
20971
|
+
this.rotatable = false;
|
|
20972
|
+
this.scalable = false;
|
|
20973
|
+
this.skewable = false;
|
|
20974
|
+
this.slottable = false;
|
|
20975
|
+
this.translatable = false;
|
|
20976
|
+
}
|
|
20977
|
+
set $canvas(element) {
|
|
20978
|
+
canvasCache$3.set(this, element);
|
|
20979
|
+
}
|
|
20980
|
+
get $canvas() {
|
|
20981
|
+
return canvasCache$3.get(this);
|
|
20982
|
+
}
|
|
20983
|
+
static get observedAttributes() {
|
|
20984
|
+
return super.observedAttributes.concat(NATIVE_ATTRIBUTES, [
|
|
20985
|
+
'initial-center-size',
|
|
20986
|
+
'rotatable',
|
|
20987
|
+
'scalable',
|
|
20988
|
+
'skewable',
|
|
20989
|
+
'translatable',
|
|
20990
|
+
]);
|
|
20991
|
+
}
|
|
20992
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
20993
|
+
if (Object.is(newValue, oldValue)) {
|
|
20994
|
+
return;
|
|
20995
|
+
}
|
|
20996
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
20997
|
+
// Inherits the native attributes
|
|
20998
|
+
if (NATIVE_ATTRIBUTES.includes(name)) {
|
|
20999
|
+
this.$image.setAttribute(name, newValue);
|
|
21000
|
+
}
|
|
21001
|
+
}
|
|
21002
|
+
$propertyChangedCallback(name, oldValue, newValue) {
|
|
21003
|
+
if (Object.is(newValue, oldValue)) {
|
|
21004
|
+
return;
|
|
21005
|
+
}
|
|
21006
|
+
super.$propertyChangedCallback(name, oldValue, newValue);
|
|
21007
|
+
switch (name) {
|
|
21008
|
+
case 'initialCenterSize':
|
|
21009
|
+
this.$nextTick(() => {
|
|
21010
|
+
this.$center(newValue);
|
|
21011
|
+
});
|
|
21012
|
+
break;
|
|
21013
|
+
}
|
|
21014
|
+
}
|
|
21015
|
+
connectedCallback() {
|
|
21016
|
+
super.connectedCallback();
|
|
21017
|
+
const { $image } = this;
|
|
21018
|
+
const $canvas = this.closest(this.$getTagNameOf(CROPPER_CANVAS));
|
|
21019
|
+
if ($canvas) {
|
|
21020
|
+
this.$canvas = $canvas;
|
|
21021
|
+
this.$setStyles({
|
|
21022
|
+
// Make it a block element to avoid side effects (#1074).
|
|
21023
|
+
display: 'block',
|
|
21024
|
+
position: 'absolute',
|
|
21025
|
+
});
|
|
21026
|
+
this.$onCanvasActionStart = (event) => {
|
|
21027
|
+
var _a, _b;
|
|
21028
|
+
this.$actionStartTarget = (_b = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.relatedEvent) === null || _b === void 0 ? void 0 : _b.target;
|
|
21029
|
+
};
|
|
21030
|
+
this.$onCanvasActionEnd = () => {
|
|
21031
|
+
this.$actionStartTarget = null;
|
|
21032
|
+
};
|
|
21033
|
+
this.$onCanvasAction = this.$handleAction.bind(this);
|
|
21034
|
+
on($canvas, EVENT_ACTION_START, this.$onCanvasActionStart);
|
|
21035
|
+
on($canvas, EVENT_ACTION_END, this.$onCanvasActionEnd);
|
|
21036
|
+
on($canvas, EVENT_ACTION, this.$onCanvasAction);
|
|
21037
|
+
}
|
|
21038
|
+
this.$onLoad = this.$handleLoad.bind(this);
|
|
21039
|
+
on($image, EVENT_LOAD, this.$onLoad);
|
|
21040
|
+
this.$getShadowRoot().appendChild($image);
|
|
21041
|
+
}
|
|
21042
|
+
disconnectedCallback() {
|
|
21043
|
+
const { $image, $canvas } = this;
|
|
21044
|
+
if ($canvas) {
|
|
21045
|
+
if (this.$onCanvasActionStart) {
|
|
21046
|
+
off($canvas, EVENT_ACTION_START, this.$onCanvasActionStart);
|
|
21047
|
+
this.$onCanvasActionStart = null;
|
|
21048
|
+
}
|
|
21049
|
+
if (this.$onCanvasActionEnd) {
|
|
21050
|
+
off($canvas, EVENT_ACTION_END, this.$onCanvasActionEnd);
|
|
21051
|
+
this.$onCanvasActionEnd = null;
|
|
21052
|
+
}
|
|
21053
|
+
if (this.$onCanvasAction) {
|
|
21054
|
+
off($canvas, EVENT_ACTION, this.$onCanvasAction);
|
|
21055
|
+
this.$onCanvasAction = null;
|
|
21056
|
+
}
|
|
21057
|
+
}
|
|
21058
|
+
if ($image && this.$onLoad) {
|
|
21059
|
+
off($image, EVENT_LOAD, this.$onLoad);
|
|
21060
|
+
this.$onLoad = null;
|
|
21061
|
+
}
|
|
21062
|
+
this.$getShadowRoot().removeChild($image);
|
|
21063
|
+
super.disconnectedCallback();
|
|
21064
|
+
}
|
|
21065
|
+
$handleLoad() {
|
|
21066
|
+
const { $image } = this;
|
|
21067
|
+
this.$setStyles({
|
|
21068
|
+
width: $image.naturalWidth,
|
|
21069
|
+
height: $image.naturalHeight,
|
|
21070
|
+
});
|
|
21071
|
+
if (this.$canvas) {
|
|
21072
|
+
this.$center(this.initialCenterSize);
|
|
21073
|
+
}
|
|
21074
|
+
}
|
|
21075
|
+
$handleAction(event) {
|
|
21076
|
+
if (this.hidden || !(this.rotatable || this.scalable || this.translatable)) {
|
|
21077
|
+
return;
|
|
21078
|
+
}
|
|
21079
|
+
const { $canvas } = this;
|
|
21080
|
+
const { detail } = event;
|
|
21081
|
+
if (detail) {
|
|
21082
|
+
const { relatedEvent } = detail;
|
|
21083
|
+
let { action } = detail;
|
|
21084
|
+
if (action === ACTION_TRANSFORM && (!this.rotatable || !this.scalable)) {
|
|
21085
|
+
if (this.rotatable) {
|
|
21086
|
+
action = ACTION_ROTATE;
|
|
21087
|
+
}
|
|
21088
|
+
else if (this.scalable) {
|
|
21089
|
+
action = ACTION_SCALE;
|
|
21090
|
+
}
|
|
21091
|
+
else {
|
|
21092
|
+
action = ACTION_NONE;
|
|
21093
|
+
}
|
|
21094
|
+
}
|
|
21095
|
+
switch (action) {
|
|
21096
|
+
case ACTION_MOVE:
|
|
21097
|
+
if (this.translatable) {
|
|
21098
|
+
let $selection = null;
|
|
21099
|
+
if (relatedEvent) {
|
|
21100
|
+
$selection = relatedEvent.target.closest(this.$getTagNameOf(CROPPER_SELECTION));
|
|
21101
|
+
}
|
|
21102
|
+
if (!$selection) {
|
|
21103
|
+
$selection = $canvas.querySelector(this.$getTagNameOf(CROPPER_SELECTION));
|
|
21104
|
+
}
|
|
21105
|
+
if ($selection && $selection.multiple && !$selection.active) {
|
|
21106
|
+
$selection = $canvas.querySelector(`${this.$getTagNameOf(CROPPER_SELECTION)}[active]`);
|
|
21107
|
+
}
|
|
21108
|
+
if (!$selection || $selection.hidden || !$selection.movable || $selection.dynamic
|
|
21109
|
+
|| !(this.$actionStartTarget && $selection.contains(this.$actionStartTarget))) {
|
|
21110
|
+
this.$move(detail.endX - detail.startX, detail.endY - detail.startY);
|
|
21111
|
+
}
|
|
21112
|
+
}
|
|
21113
|
+
break;
|
|
21114
|
+
case ACTION_ROTATE:
|
|
21115
|
+
if (this.rotatable) {
|
|
21116
|
+
if (relatedEvent) {
|
|
21117
|
+
const { x, y } = this.getBoundingClientRect();
|
|
21118
|
+
this.$rotate(detail.rotate, relatedEvent.clientX - x, relatedEvent.clientY - y);
|
|
21119
|
+
}
|
|
21120
|
+
else {
|
|
21121
|
+
this.$rotate(detail.rotate);
|
|
21122
|
+
}
|
|
21123
|
+
}
|
|
21124
|
+
break;
|
|
21125
|
+
case ACTION_SCALE:
|
|
21126
|
+
if (this.scalable) {
|
|
21127
|
+
if (relatedEvent) {
|
|
21128
|
+
const $selection = relatedEvent.target.closest(this.$getTagNameOf(CROPPER_SELECTION));
|
|
21129
|
+
if (!$selection
|
|
21130
|
+
|| !$selection.zoomable
|
|
21131
|
+
|| ($selection.zoomable && $selection.dynamic)) {
|
|
21132
|
+
const { x, y } = this.getBoundingClientRect();
|
|
21133
|
+
this.$zoom(detail.scale, relatedEvent.clientX - x, relatedEvent.clientY - y);
|
|
21134
|
+
}
|
|
21135
|
+
}
|
|
21136
|
+
else {
|
|
21137
|
+
this.$zoom(detail.scale);
|
|
21138
|
+
}
|
|
21139
|
+
}
|
|
21140
|
+
break;
|
|
21141
|
+
case ACTION_TRANSFORM:
|
|
21142
|
+
if (this.rotatable && this.scalable) {
|
|
21143
|
+
const { rotate } = detail;
|
|
21144
|
+
let { scale } = detail;
|
|
21145
|
+
if (scale < 0) {
|
|
21146
|
+
scale = 1 / (1 - scale);
|
|
21147
|
+
}
|
|
21148
|
+
else {
|
|
21149
|
+
scale += 1;
|
|
21150
|
+
}
|
|
21151
|
+
const cos = Math.cos(rotate);
|
|
21152
|
+
const sin = Math.sin(rotate);
|
|
21153
|
+
const [scaleX, skewY, skewX, scaleY] = [
|
|
21154
|
+
cos * scale,
|
|
21155
|
+
sin * scale,
|
|
21156
|
+
-sin * scale,
|
|
21157
|
+
cos * scale,
|
|
21158
|
+
];
|
|
21159
|
+
if (relatedEvent) {
|
|
21160
|
+
const clientRect = this.getBoundingClientRect();
|
|
21161
|
+
const x = relatedEvent.clientX - clientRect.x;
|
|
21162
|
+
const y = relatedEvent.clientY - clientRect.y;
|
|
21163
|
+
const [a, b, c, d] = this.$matrix;
|
|
21164
|
+
const originX = clientRect.width / 2;
|
|
21165
|
+
const originY = clientRect.height / 2;
|
|
21166
|
+
const moveX = x - originX;
|
|
21167
|
+
const moveY = y - originY;
|
|
21168
|
+
const translateX = ((moveX * d) - (c * moveY)) / ((a * d) - (c * b));
|
|
21169
|
+
const translateY = ((moveY * a) - (b * moveX)) / ((a * d) - (c * b));
|
|
21170
|
+
/**
|
|
21171
|
+
* Equals to
|
|
21172
|
+
* this.$rotate(rotate, x, y);
|
|
21173
|
+
* this.$scale(scale, x, y);
|
|
21174
|
+
*/
|
|
21175
|
+
this.$transform(scaleX, skewY, skewX, scaleY, translateX * (1 - scaleX) + translateY * skewX, translateY * (1 - scaleY) + translateX * skewY);
|
|
21176
|
+
}
|
|
21177
|
+
else {
|
|
21178
|
+
/**
|
|
21179
|
+
* Equals to
|
|
21180
|
+
* this.$rotate(rotate);
|
|
21181
|
+
* this.$scale(scale);
|
|
21182
|
+
*/
|
|
21183
|
+
this.$transform(scaleX, skewY, skewX, scaleY, 0, 0);
|
|
21184
|
+
}
|
|
21185
|
+
}
|
|
21186
|
+
break;
|
|
21187
|
+
}
|
|
21188
|
+
}
|
|
21189
|
+
}
|
|
21190
|
+
/**
|
|
21191
|
+
* Defers the callback to execute after successfully loading the image.
|
|
21192
|
+
* @param {Function} [callback] The callback to execute after successfully loading the image.
|
|
21193
|
+
* @returns {Promise} Returns a promise that resolves to the image element.
|
|
21194
|
+
*/
|
|
21195
|
+
$ready(callback) {
|
|
21196
|
+
const { $image } = this;
|
|
21197
|
+
const promise = new Promise((resolve, reject) => {
|
|
21198
|
+
const error = new Error('Failed to load the image source');
|
|
21199
|
+
if ($image.complete) {
|
|
21200
|
+
if ($image.naturalWidth > 0 && $image.naturalHeight > 0) {
|
|
21201
|
+
resolve($image);
|
|
21202
|
+
}
|
|
21203
|
+
else {
|
|
21204
|
+
reject(error);
|
|
21205
|
+
}
|
|
21206
|
+
}
|
|
21207
|
+
else {
|
|
21208
|
+
const onLoad = () => {
|
|
21209
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
21210
|
+
off($image, EVENT_ERROR, onError);
|
|
21211
|
+
resolve($image);
|
|
21212
|
+
};
|
|
21213
|
+
const onError = () => {
|
|
21214
|
+
off($image, EVENT_LOAD, onLoad);
|
|
21215
|
+
reject(error);
|
|
21216
|
+
};
|
|
21217
|
+
once($image, EVENT_LOAD, onLoad);
|
|
21218
|
+
once($image, EVENT_ERROR, onError);
|
|
21219
|
+
}
|
|
21220
|
+
});
|
|
21221
|
+
if (isFunction$1(callback)) {
|
|
21222
|
+
promise.then((image) => {
|
|
21223
|
+
callback(image);
|
|
21224
|
+
return image;
|
|
21225
|
+
});
|
|
21226
|
+
}
|
|
21227
|
+
return promise;
|
|
21228
|
+
}
|
|
21229
|
+
/**
|
|
21230
|
+
* Aligns the image to the center of its parent element.
|
|
21231
|
+
* @param {string} [size] The size of the image.
|
|
21232
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21233
|
+
*/
|
|
21234
|
+
$center(size) {
|
|
21235
|
+
const { parentElement } = this;
|
|
21236
|
+
if (!parentElement) {
|
|
21237
|
+
return this;
|
|
21238
|
+
}
|
|
21239
|
+
const container = parentElement.getBoundingClientRect();
|
|
21240
|
+
const containerWidth = container.width;
|
|
21241
|
+
const containerHeight = container.height;
|
|
21242
|
+
const { x, y, width, height, } = this.getBoundingClientRect();
|
|
21243
|
+
const startX = x + (width / 2);
|
|
21244
|
+
const startY = y + (height / 2);
|
|
21245
|
+
const endX = container.x + (containerWidth / 2);
|
|
21246
|
+
const endY = container.y + (containerHeight / 2);
|
|
21247
|
+
this.$move(endX - startX, endY - startY);
|
|
21248
|
+
if (size && (width !== containerWidth || height !== containerHeight)) {
|
|
21249
|
+
const scaleX = containerWidth / width;
|
|
21250
|
+
const scaleY = containerHeight / height;
|
|
21251
|
+
switch (size) {
|
|
21252
|
+
case 'cover':
|
|
21253
|
+
this.$scale(Math.max(scaleX, scaleY));
|
|
21254
|
+
break;
|
|
21255
|
+
case 'contain':
|
|
21256
|
+
this.$scale(Math.min(scaleX, scaleY));
|
|
21257
|
+
break;
|
|
21258
|
+
}
|
|
21259
|
+
}
|
|
21260
|
+
return this;
|
|
21261
|
+
}
|
|
21262
|
+
/**
|
|
21263
|
+
* Moves the image.
|
|
21264
|
+
* @param {number} x The moving distance in the horizontal direction.
|
|
21265
|
+
* @param {number} [y] The moving distance in the vertical direction.
|
|
21266
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21267
|
+
*/
|
|
21268
|
+
$move(x, y = x) {
|
|
21269
|
+
if (this.translatable && isNumber(x) && isNumber(y)) {
|
|
21270
|
+
const [a, b, c, d] = this.$matrix;
|
|
21271
|
+
const e = ((x * d) - (c * y)) / ((a * d) - (c * b));
|
|
21272
|
+
const f = ((y * a) - (b * x)) / ((a * d) - (c * b));
|
|
21273
|
+
this.$translate(e, f);
|
|
21274
|
+
}
|
|
21275
|
+
return this;
|
|
21276
|
+
}
|
|
21277
|
+
/**
|
|
21278
|
+
* Moves the image to a specific position.
|
|
21279
|
+
* @param {number} x The new position in the horizontal direction.
|
|
21280
|
+
* @param {number} [y] The new position in the vertical direction.
|
|
21281
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21282
|
+
*/
|
|
21283
|
+
$moveTo(x, y = x) {
|
|
21284
|
+
if (this.translatable && isNumber(x) && isNumber(y)) {
|
|
21285
|
+
const [a, b, c, d] = this.$matrix;
|
|
21286
|
+
const e = ((x * d) - (c * y)) / ((a * d) - (c * b));
|
|
21287
|
+
const f = ((y * a) - (b * x)) / ((a * d) - (c * b));
|
|
21288
|
+
this.$setTransform(a, b, c, d, e, f);
|
|
21289
|
+
}
|
|
21290
|
+
return this;
|
|
21291
|
+
}
|
|
21292
|
+
/**
|
|
21293
|
+
* Rotates the image.
|
|
21294
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate}
|
|
21295
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/rotate}
|
|
21296
|
+
* @param {number|string} angle The rotation angle (in radians).
|
|
21297
|
+
* @param {number} [x] The rotation origin in the horizontal, defaults to the center of the image.
|
|
21298
|
+
* @param {number} [y] The rotation origin in the vertical, defaults to the center of the image.
|
|
21299
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21300
|
+
*/
|
|
21301
|
+
$rotate(angle, x, y) {
|
|
21302
|
+
if (this.rotatable) {
|
|
21303
|
+
const radian = toAngleInRadian(angle);
|
|
21304
|
+
const cos = Math.cos(radian);
|
|
21305
|
+
const sin = Math.sin(radian);
|
|
21306
|
+
const [scaleX, skewY, skewX, scaleY] = [cos, sin, -sin, cos];
|
|
21307
|
+
if (isNumber(x) && isNumber(y)) {
|
|
21308
|
+
const [a, b, c, d] = this.$matrix;
|
|
21309
|
+
const { width, height } = this.getBoundingClientRect();
|
|
21310
|
+
const originX = width / 2;
|
|
21311
|
+
const originY = height / 2;
|
|
21312
|
+
const moveX = x - originX;
|
|
21313
|
+
const moveY = y - originY;
|
|
21314
|
+
const translateX = ((moveX * d) - (c * moveY)) / ((a * d) - (c * b));
|
|
21315
|
+
const translateY = ((moveY * a) - (b * moveX)) / ((a * d) - (c * b));
|
|
21316
|
+
/**
|
|
21317
|
+
* Equals to
|
|
21318
|
+
* this.$translate(translateX, translateX);
|
|
21319
|
+
* this.$rotate(angle);
|
|
21320
|
+
* this.$translate(-translateX, -translateX);
|
|
21321
|
+
*/
|
|
21322
|
+
this.$transform(scaleX, skewY, skewX, scaleY, translateX * (1 - scaleX) - translateY * skewX, translateY * (1 - scaleY) - translateX * skewY);
|
|
21323
|
+
}
|
|
21324
|
+
else {
|
|
21325
|
+
this.$transform(scaleX, skewY, skewX, scaleY, 0, 0);
|
|
21326
|
+
}
|
|
21327
|
+
}
|
|
21328
|
+
return this;
|
|
21329
|
+
}
|
|
21330
|
+
/**
|
|
21331
|
+
* Zooms the image.
|
|
21332
|
+
* @param {number} scale The zoom factor. Positive numbers for zooming in, and negative numbers for zooming out.
|
|
21333
|
+
* @param {number} [x] The zoom origin in the horizontal, defaults to the center of the image.
|
|
21334
|
+
* @param {number} [y] The zoom origin in the vertical, defaults to the center of the image.
|
|
21335
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21336
|
+
*/
|
|
21337
|
+
$zoom(scale, x, y) {
|
|
21338
|
+
if (!this.scalable || scale === 0) {
|
|
21339
|
+
return this;
|
|
21340
|
+
}
|
|
21341
|
+
if (scale < 0) {
|
|
21342
|
+
scale = 1 / (1 - scale);
|
|
21343
|
+
}
|
|
21344
|
+
else {
|
|
21345
|
+
scale += 1;
|
|
21346
|
+
}
|
|
21347
|
+
if (isNumber(x) && isNumber(y)) {
|
|
21348
|
+
const [a, b, c, d] = this.$matrix;
|
|
21349
|
+
const { width, height } = this.getBoundingClientRect();
|
|
21350
|
+
const originX = width / 2;
|
|
21351
|
+
const originY = height / 2;
|
|
21352
|
+
const moveX = x - originX;
|
|
21353
|
+
const moveY = y - originY;
|
|
21354
|
+
const translateX = ((moveX * d) - (c * moveY)) / ((a * d) - (c * b));
|
|
21355
|
+
const translateY = ((moveY * a) - (b * moveX)) / ((a * d) - (c * b));
|
|
21356
|
+
/**
|
|
21357
|
+
* Equals to
|
|
21358
|
+
* this.$translate(translateX, translateX);
|
|
21359
|
+
* this.$scale(scale);
|
|
21360
|
+
* this.$translate(-translateX, -translateX);
|
|
21361
|
+
*/
|
|
21362
|
+
this.$transform(scale, 0, 0, scale, translateX * (1 - scale), translateY * (1 - scale));
|
|
21363
|
+
}
|
|
21364
|
+
else {
|
|
21365
|
+
this.$scale(scale);
|
|
21366
|
+
}
|
|
21367
|
+
return this;
|
|
21368
|
+
}
|
|
21369
|
+
/**
|
|
21370
|
+
* Scales the image.
|
|
21371
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/scale}
|
|
21372
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scale}
|
|
21373
|
+
* @param {number} x The scaling factor in the horizontal direction.
|
|
21374
|
+
* @param {number} [y] The scaling factor in the vertical direction.
|
|
21375
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21376
|
+
*/
|
|
21377
|
+
$scale(x, y = x) {
|
|
21378
|
+
if (this.scalable) {
|
|
21379
|
+
this.$transform(x, 0, 0, y, 0, 0);
|
|
21380
|
+
}
|
|
21381
|
+
return this;
|
|
21382
|
+
}
|
|
21383
|
+
/**
|
|
21384
|
+
* Skews the image.
|
|
21385
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew}
|
|
21386
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform}
|
|
21387
|
+
* @param {number|string} x The skewing angle in the horizontal direction.
|
|
21388
|
+
* @param {number|string} [y] The skewing angle in the vertical direction.
|
|
21389
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21390
|
+
*/
|
|
21391
|
+
$skew(x, y = 0) {
|
|
21392
|
+
if (this.skewable) {
|
|
21393
|
+
const radianX = toAngleInRadian(x);
|
|
21394
|
+
const radianY = toAngleInRadian(y);
|
|
21395
|
+
this.$transform(1, Math.tan(radianY), Math.tan(radianX), 1, 0, 0);
|
|
21396
|
+
}
|
|
21397
|
+
return this;
|
|
21398
|
+
}
|
|
21399
|
+
/**
|
|
21400
|
+
* Translates the image.
|
|
21401
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/translate}
|
|
21402
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/translate}
|
|
21403
|
+
* @param {number} x The translating distance in the horizontal direction.
|
|
21404
|
+
* @param {number} [y] The translating distance in the vertical direction.
|
|
21405
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21406
|
+
*/
|
|
21407
|
+
$translate(x, y = x) {
|
|
21408
|
+
if (this.translatable && isNumber(x) && isNumber(y)) {
|
|
21409
|
+
this.$transform(1, 0, 0, 1, x, y);
|
|
21410
|
+
}
|
|
21411
|
+
return this;
|
|
21412
|
+
}
|
|
21413
|
+
/**
|
|
21414
|
+
* Transforms the image.
|
|
21415
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix}
|
|
21416
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform}
|
|
21417
|
+
* @param {number} a The scaling factor in the horizontal direction.
|
|
21418
|
+
* @param {number} b The skewing angle in the vertical direction.
|
|
21419
|
+
* @param {number} c The skewing angle in the horizontal direction.
|
|
21420
|
+
* @param {number} d The scaling factor in the vertical direction.
|
|
21421
|
+
* @param {number} e The translating distance in the horizontal direction.
|
|
21422
|
+
* @param {number} f The translating distance in the vertical direction.
|
|
21423
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21424
|
+
*/
|
|
21425
|
+
$transform(a, b, c, d, e, f) {
|
|
21426
|
+
if (isNumber(a)
|
|
21427
|
+
&& isNumber(b)
|
|
21428
|
+
&& isNumber(c)
|
|
21429
|
+
&& isNumber(d)
|
|
21430
|
+
&& isNumber(e)
|
|
21431
|
+
&& isNumber(f)) {
|
|
21432
|
+
return this.$setTransform(multiplyMatrices(this.$matrix, [a, b, c, d, e, f]));
|
|
21433
|
+
}
|
|
21434
|
+
return this;
|
|
21435
|
+
}
|
|
21436
|
+
/**
|
|
21437
|
+
* Resets (overrides) the current transform to the specific identity matrix.
|
|
21438
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform}
|
|
21439
|
+
* @param {number|Array} a The scaling factor in the horizontal direction.
|
|
21440
|
+
* @param {number} b The skewing angle in the vertical direction.
|
|
21441
|
+
* @param {number} c The skewing angle in the horizontal direction.
|
|
21442
|
+
* @param {number} d The scaling factor in the vertical direction.
|
|
21443
|
+
* @param {number} e The translating distance in the horizontal direction.
|
|
21444
|
+
* @param {number} f The translating distance in the vertical direction.
|
|
21445
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21446
|
+
*/
|
|
21447
|
+
$setTransform(a, b, c, d, e, f) {
|
|
21448
|
+
if (this.rotatable || this.scalable || this.skewable || this.translatable) {
|
|
21449
|
+
if (Array.isArray(a)) {
|
|
21450
|
+
[a, b, c, d, e, f] = a;
|
|
21451
|
+
}
|
|
21452
|
+
if (isNumber(a)
|
|
21453
|
+
&& isNumber(b)
|
|
21454
|
+
&& isNumber(c)
|
|
21455
|
+
&& isNumber(d)
|
|
21456
|
+
&& isNumber(e)
|
|
21457
|
+
&& isNumber(f)) {
|
|
21458
|
+
const oldMatrix = [...this.$matrix];
|
|
21459
|
+
const newMatrix = [a, b, c, d, e, f];
|
|
21460
|
+
if (this.$emit(EVENT_TRANSFORM, {
|
|
21461
|
+
matrix: newMatrix,
|
|
21462
|
+
oldMatrix,
|
|
21463
|
+
}) === false) {
|
|
21464
|
+
return this;
|
|
21465
|
+
}
|
|
21466
|
+
this.$matrix = newMatrix;
|
|
21467
|
+
this.style.transform = `matrix(${newMatrix.join(', ')})`;
|
|
21468
|
+
}
|
|
21469
|
+
}
|
|
21470
|
+
return this;
|
|
21471
|
+
}
|
|
21472
|
+
/**
|
|
21473
|
+
* Retrieves the current transformation matrix being applied to the element.
|
|
21474
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getTransform}
|
|
21475
|
+
* @returns {Array} Returns the readonly transformation matrix.
|
|
21476
|
+
*/
|
|
21477
|
+
$getTransform() {
|
|
21478
|
+
return this.$matrix.slice();
|
|
21479
|
+
}
|
|
21480
|
+
/**
|
|
21481
|
+
* Resets the current transform to the initial identity matrix.
|
|
21482
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/resetTransform}
|
|
21483
|
+
* @returns {CropperImage} Returns `this` for chaining.
|
|
21484
|
+
*/
|
|
21485
|
+
$resetTransform() {
|
|
21486
|
+
return this.$setTransform([1, 0, 0, 1, 0, 0]);
|
|
21487
|
+
}
|
|
21488
|
+
}
|
|
21489
|
+
CropperImage.$name = CROPPER_IMAGE;
|
|
21490
|
+
CropperImage.$version = '2.0.0';
|
|
21491
|
+
|
|
21492
|
+
var style$5 = `:host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}`;
|
|
21493
|
+
|
|
21494
|
+
const canvasCache$2 = new WeakMap();
|
|
21495
|
+
class CropperShade extends CropperElement {
|
|
21496
|
+
constructor() {
|
|
21497
|
+
super(...arguments);
|
|
21498
|
+
this.$onCanvasChange = null;
|
|
21499
|
+
this.$onCanvasActionEnd = null;
|
|
21500
|
+
this.$onCanvasActionStart = null;
|
|
21501
|
+
this.$style = style$5;
|
|
21502
|
+
this.x = 0;
|
|
21503
|
+
this.y = 0;
|
|
21504
|
+
this.width = 0;
|
|
21505
|
+
this.height = 0;
|
|
21506
|
+
this.slottable = false;
|
|
21507
|
+
this.themeColor = 'rgba(0, 0, 0, 0.65)';
|
|
21508
|
+
}
|
|
21509
|
+
set $canvas(element) {
|
|
21510
|
+
canvasCache$2.set(this, element);
|
|
21511
|
+
}
|
|
21512
|
+
get $canvas() {
|
|
21513
|
+
return canvasCache$2.get(this);
|
|
21514
|
+
}
|
|
21515
|
+
static get observedAttributes() {
|
|
21516
|
+
return super.observedAttributes.concat([
|
|
21517
|
+
'height',
|
|
21518
|
+
'width',
|
|
21519
|
+
'x',
|
|
21520
|
+
'y',
|
|
21521
|
+
]);
|
|
21522
|
+
}
|
|
21523
|
+
connectedCallback() {
|
|
21524
|
+
super.connectedCallback();
|
|
21525
|
+
const $canvas = this.closest(this.$getTagNameOf(CROPPER_CANVAS));
|
|
21526
|
+
if ($canvas) {
|
|
21527
|
+
this.$canvas = $canvas;
|
|
21528
|
+
this.style.position = 'absolute';
|
|
21529
|
+
const $selection = $canvas.querySelector(this.$getTagNameOf(CROPPER_SELECTION));
|
|
21530
|
+
if ($selection) {
|
|
21531
|
+
this.$onCanvasActionStart = (event) => {
|
|
21532
|
+
if ($selection.hidden && event.detail.action === ACTION_SELECT) {
|
|
21533
|
+
this.hidden = false;
|
|
21534
|
+
}
|
|
21535
|
+
};
|
|
21536
|
+
this.$onCanvasActionEnd = (event) => {
|
|
21537
|
+
if ($selection.hidden && event.detail.action === ACTION_SELECT) {
|
|
21538
|
+
this.hidden = true;
|
|
21539
|
+
}
|
|
21540
|
+
};
|
|
21541
|
+
this.$onCanvasChange = (event) => {
|
|
21542
|
+
const { x, y, width, height, } = event.detail;
|
|
21543
|
+
this.$change(x, y, width, height);
|
|
21544
|
+
if ($selection.hidden || (x === 0 && y === 0 && width === 0 && height === 0)) {
|
|
21545
|
+
this.hidden = true;
|
|
21546
|
+
}
|
|
21547
|
+
};
|
|
21548
|
+
on($canvas, EVENT_ACTION_START, this.$onCanvasActionStart);
|
|
21549
|
+
on($canvas, EVENT_ACTION_END, this.$onCanvasActionEnd);
|
|
21550
|
+
on($canvas, EVENT_CHANGE, this.$onCanvasChange);
|
|
21551
|
+
}
|
|
21552
|
+
}
|
|
21553
|
+
this.$render();
|
|
21554
|
+
}
|
|
21555
|
+
disconnectedCallback() {
|
|
21556
|
+
const { $canvas } = this;
|
|
21557
|
+
if ($canvas) {
|
|
21558
|
+
if (this.$onCanvasActionStart) {
|
|
21559
|
+
off($canvas, EVENT_ACTION_START, this.$onCanvasActionStart);
|
|
21560
|
+
this.$onCanvasActionStart = null;
|
|
21561
|
+
}
|
|
21562
|
+
if (this.$onCanvasActionEnd) {
|
|
21563
|
+
off($canvas, EVENT_ACTION_END, this.$onCanvasActionEnd);
|
|
21564
|
+
this.$onCanvasActionEnd = null;
|
|
21565
|
+
}
|
|
21566
|
+
if (this.$onCanvasChange) {
|
|
21567
|
+
off($canvas, EVENT_CHANGE, this.$onCanvasChange);
|
|
21568
|
+
this.$onCanvasChange = null;
|
|
21569
|
+
}
|
|
21570
|
+
}
|
|
21571
|
+
super.disconnectedCallback();
|
|
21572
|
+
}
|
|
21573
|
+
/**
|
|
21574
|
+
* Changes the position and/or size of the shade.
|
|
21575
|
+
* @param {number} x The new position in the horizontal direction.
|
|
21576
|
+
* @param {number} y The new position in the vertical direction.
|
|
21577
|
+
* @param {number} [width] The new width.
|
|
21578
|
+
* @param {number} [height] The new height.
|
|
21579
|
+
* @returns {CropperShade} Returns `this` for chaining.
|
|
21580
|
+
*/
|
|
21581
|
+
$change(x, y, width = this.width, height = this.height) {
|
|
21582
|
+
if (!isNumber(x)
|
|
21583
|
+
|| !isNumber(y)
|
|
21584
|
+
|| !isNumber(width)
|
|
21585
|
+
|| !isNumber(height)
|
|
21586
|
+
|| (x === this.x && y === this.y && width === this.width && height === this.height)) {
|
|
21587
|
+
return this;
|
|
21588
|
+
}
|
|
21589
|
+
if (this.hidden) {
|
|
21590
|
+
this.hidden = false;
|
|
21591
|
+
}
|
|
21592
|
+
this.x = x;
|
|
21593
|
+
this.y = y;
|
|
21594
|
+
this.width = width;
|
|
21595
|
+
this.height = height;
|
|
21596
|
+
return this.$render();
|
|
21597
|
+
}
|
|
21598
|
+
/**
|
|
21599
|
+
* Resets the shade to its initial position and size.
|
|
21600
|
+
* @returns {CropperShade} Returns `this` for chaining.
|
|
21601
|
+
*/
|
|
21602
|
+
$reset() {
|
|
21603
|
+
return this.$change(0, 0, 0, 0);
|
|
21604
|
+
}
|
|
21605
|
+
/**
|
|
21606
|
+
* Refreshes the position or size of the shade.
|
|
21607
|
+
* @returns {CropperShade} Returns `this` for chaining.
|
|
21608
|
+
*/
|
|
21609
|
+
$render() {
|
|
21610
|
+
return this.$setStyles({
|
|
21611
|
+
transform: `translate(${this.x}px, ${this.y}px)`,
|
|
21612
|
+
width: this.width,
|
|
21613
|
+
height: this.height,
|
|
21614
|
+
outlineWidth: WINDOW.innerWidth,
|
|
21615
|
+
});
|
|
21616
|
+
}
|
|
21617
|
+
}
|
|
21618
|
+
CropperShade.$name = CROPPER_SHADE;
|
|
21619
|
+
CropperShade.$version = '2.0.0';
|
|
21620
|
+
|
|
21621
|
+
var style$4 = `:host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}`;
|
|
21622
|
+
|
|
21623
|
+
class CropperHandle extends CropperElement {
|
|
21624
|
+
constructor() {
|
|
21625
|
+
super(...arguments);
|
|
21626
|
+
this.$onCanvasCropEnd = null;
|
|
21627
|
+
this.$onCanvasCropStart = null;
|
|
21628
|
+
this.$style = style$4;
|
|
21629
|
+
this.action = ACTION_NONE;
|
|
21630
|
+
this.plain = false;
|
|
21631
|
+
this.slottable = false;
|
|
21632
|
+
this.themeColor = 'rgba(51, 153, 255, 0.5)';
|
|
21633
|
+
}
|
|
21634
|
+
static get observedAttributes() {
|
|
21635
|
+
return super.observedAttributes.concat([
|
|
21636
|
+
'action',
|
|
21637
|
+
'plain',
|
|
21638
|
+
]);
|
|
21639
|
+
}
|
|
21640
|
+
}
|
|
21641
|
+
CropperHandle.$name = CROPPER_HANDLE;
|
|
21642
|
+
CropperHandle.$version = '2.0.0';
|
|
21643
|
+
|
|
21644
|
+
var style$3 = `:host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}`;
|
|
21645
|
+
|
|
21646
|
+
const canvasCache$1 = new WeakMap();
|
|
21647
|
+
class CropperSelection extends CropperElement {
|
|
21648
|
+
constructor() {
|
|
21649
|
+
super(...arguments);
|
|
21650
|
+
this.$onCanvasAction = null;
|
|
21651
|
+
this.$onCanvasActionStart = null;
|
|
21652
|
+
this.$onCanvasActionEnd = null;
|
|
21653
|
+
this.$onDocumentKeyDown = null;
|
|
21654
|
+
this.$action = '';
|
|
21655
|
+
this.$actionStartTarget = null;
|
|
21656
|
+
this.$changing = false;
|
|
21657
|
+
this.$style = style$3;
|
|
21658
|
+
this.$initialSelection = {
|
|
21659
|
+
x: 0,
|
|
21660
|
+
y: 0,
|
|
21661
|
+
width: 0,
|
|
21662
|
+
height: 0,
|
|
21663
|
+
};
|
|
21664
|
+
this.x = 0;
|
|
21665
|
+
this.y = 0;
|
|
21666
|
+
this.width = 0;
|
|
21667
|
+
this.height = 0;
|
|
21668
|
+
this.aspectRatio = NaN;
|
|
21669
|
+
this.initialAspectRatio = NaN;
|
|
21670
|
+
this.initialCoverage = NaN;
|
|
21671
|
+
this.active = false;
|
|
21672
|
+
// Deprecated as of v2.0.0-rc.0, use `dynamic` instead.
|
|
21673
|
+
this.linked = false;
|
|
21674
|
+
this.dynamic = false;
|
|
21675
|
+
this.movable = false;
|
|
21676
|
+
this.resizable = false;
|
|
21677
|
+
this.zoomable = false;
|
|
21678
|
+
this.multiple = false;
|
|
21679
|
+
this.keyboard = false;
|
|
21680
|
+
this.outlined = false;
|
|
21681
|
+
this.precise = false;
|
|
21682
|
+
}
|
|
21683
|
+
set $canvas(element) {
|
|
21684
|
+
canvasCache$1.set(this, element);
|
|
21685
|
+
}
|
|
21686
|
+
get $canvas() {
|
|
21687
|
+
return canvasCache$1.get(this);
|
|
21688
|
+
}
|
|
21689
|
+
static get observedAttributes() {
|
|
21690
|
+
return super.observedAttributes.concat([
|
|
21691
|
+
'active',
|
|
21692
|
+
'aspect-ratio',
|
|
21693
|
+
'dynamic',
|
|
21694
|
+
'height',
|
|
21695
|
+
'initial-aspect-ratio',
|
|
21696
|
+
'initial-coverage',
|
|
21697
|
+
'keyboard',
|
|
21698
|
+
'linked',
|
|
21699
|
+
'movable',
|
|
21700
|
+
'multiple',
|
|
21701
|
+
'outlined',
|
|
21702
|
+
'precise',
|
|
21703
|
+
'resizable',
|
|
21704
|
+
'width',
|
|
21705
|
+
'x',
|
|
21706
|
+
'y',
|
|
21707
|
+
'zoomable',
|
|
21708
|
+
]);
|
|
21709
|
+
}
|
|
21710
|
+
$propertyChangedCallback(name, oldValue, newValue) {
|
|
21711
|
+
if (Object.is(newValue, oldValue)) {
|
|
21712
|
+
return;
|
|
21713
|
+
}
|
|
21714
|
+
super.$propertyChangedCallback(name, oldValue, newValue);
|
|
21715
|
+
switch (name) {
|
|
21716
|
+
case 'x':
|
|
21717
|
+
case 'y':
|
|
21718
|
+
case 'width':
|
|
21719
|
+
case 'height':
|
|
21720
|
+
if (!this.$changing) {
|
|
21721
|
+
this.$nextTick(() => {
|
|
21722
|
+
this.$change(this.x, this.y, this.width, this.height, this.aspectRatio, true);
|
|
21723
|
+
});
|
|
21724
|
+
}
|
|
21725
|
+
break;
|
|
21726
|
+
case 'aspectRatio':
|
|
21727
|
+
case 'initialAspectRatio':
|
|
21728
|
+
this.$nextTick(() => {
|
|
21729
|
+
this.$initSelection();
|
|
21730
|
+
});
|
|
21731
|
+
break;
|
|
21732
|
+
case 'initialCoverage':
|
|
21733
|
+
this.$nextTick(() => {
|
|
21734
|
+
if (isPositiveNumber(newValue) && newValue <= 1) {
|
|
21735
|
+
this.$initSelection(true, true);
|
|
21736
|
+
}
|
|
21737
|
+
});
|
|
21738
|
+
break;
|
|
21739
|
+
case 'keyboard':
|
|
21740
|
+
this.$nextTick(() => {
|
|
21741
|
+
if (this.$canvas) {
|
|
21742
|
+
if (newValue) {
|
|
21743
|
+
if (!this.$onDocumentKeyDown) {
|
|
21744
|
+
this.$onDocumentKeyDown = this.$handleKeyDown.bind(this);
|
|
21745
|
+
on(this.ownerDocument, EVENT_KEYDOWN, this.$onDocumentKeyDown);
|
|
21746
|
+
}
|
|
21747
|
+
}
|
|
21748
|
+
else if (this.$onDocumentKeyDown) {
|
|
21749
|
+
off(this.ownerDocument, EVENT_KEYDOWN, this.$onDocumentKeyDown);
|
|
21750
|
+
this.$onDocumentKeyDown = null;
|
|
21751
|
+
}
|
|
21752
|
+
}
|
|
21753
|
+
});
|
|
21754
|
+
break;
|
|
21755
|
+
case 'multiple':
|
|
21756
|
+
this.$nextTick(() => {
|
|
21757
|
+
if (this.$canvas) {
|
|
21758
|
+
const selections = this.$getSelections();
|
|
21759
|
+
if (newValue) {
|
|
21760
|
+
selections.forEach((selection) => {
|
|
21761
|
+
selection.active = false;
|
|
21762
|
+
});
|
|
21763
|
+
this.active = true;
|
|
21764
|
+
this.$emit(EVENT_CHANGE, {
|
|
21765
|
+
x: this.x,
|
|
21766
|
+
y: this.y,
|
|
21767
|
+
width: this.width,
|
|
21768
|
+
height: this.height,
|
|
21769
|
+
});
|
|
21770
|
+
}
|
|
21771
|
+
else {
|
|
21772
|
+
this.active = false;
|
|
21773
|
+
selections.slice(1).forEach((selection) => {
|
|
21774
|
+
this.$removeSelection(selection);
|
|
21775
|
+
});
|
|
21776
|
+
}
|
|
21777
|
+
}
|
|
21778
|
+
});
|
|
21779
|
+
break;
|
|
21780
|
+
case 'precise':
|
|
21781
|
+
this.$nextTick(() => {
|
|
21782
|
+
this.$change(this.x, this.y);
|
|
21783
|
+
});
|
|
21784
|
+
break;
|
|
21785
|
+
// Backwards compatible with 2.0.0-rc
|
|
21786
|
+
case 'linked':
|
|
21787
|
+
if (newValue) {
|
|
21788
|
+
this.dynamic = true;
|
|
21789
|
+
}
|
|
21790
|
+
break;
|
|
21791
|
+
}
|
|
21792
|
+
}
|
|
21793
|
+
connectedCallback() {
|
|
21794
|
+
super.connectedCallback();
|
|
21795
|
+
const $canvas = this.closest(this.$getTagNameOf(CROPPER_CANVAS));
|
|
21796
|
+
if ($canvas) {
|
|
21797
|
+
this.$canvas = $canvas;
|
|
21798
|
+
this.$setStyles({
|
|
21799
|
+
position: 'absolute',
|
|
21800
|
+
transform: `translate(${this.x}px, ${this.y}px)`,
|
|
21801
|
+
});
|
|
21802
|
+
if (!this.hidden) {
|
|
21803
|
+
this.$render();
|
|
21804
|
+
}
|
|
21805
|
+
this.$initSelection(true);
|
|
21806
|
+
this.$onCanvasActionStart = this.$handleActionStart.bind(this);
|
|
21807
|
+
this.$onCanvasActionEnd = this.$handleActionEnd.bind(this);
|
|
21808
|
+
this.$onCanvasAction = this.$handleAction.bind(this);
|
|
21809
|
+
on($canvas, EVENT_ACTION_START, this.$onCanvasActionStart);
|
|
21810
|
+
on($canvas, EVENT_ACTION_END, this.$onCanvasActionEnd);
|
|
21811
|
+
on($canvas, EVENT_ACTION, this.$onCanvasAction);
|
|
21812
|
+
}
|
|
21813
|
+
else {
|
|
21814
|
+
this.$render();
|
|
21815
|
+
}
|
|
21816
|
+
}
|
|
21817
|
+
disconnectedCallback() {
|
|
21818
|
+
const { $canvas } = this;
|
|
21819
|
+
if ($canvas) {
|
|
21820
|
+
if (this.$onCanvasActionStart) {
|
|
21821
|
+
off($canvas, EVENT_ACTION_START, this.$onCanvasActionStart);
|
|
21822
|
+
this.$onCanvasActionStart = null;
|
|
21823
|
+
}
|
|
21824
|
+
if (this.$onCanvasActionEnd) {
|
|
21825
|
+
off($canvas, EVENT_ACTION_END, this.$onCanvasActionEnd);
|
|
21826
|
+
this.$onCanvasActionEnd = null;
|
|
21827
|
+
}
|
|
21828
|
+
if (this.$onCanvasAction) {
|
|
21829
|
+
off($canvas, EVENT_ACTION, this.$onCanvasAction);
|
|
21830
|
+
this.$onCanvasAction = null;
|
|
21831
|
+
}
|
|
21832
|
+
}
|
|
21833
|
+
super.disconnectedCallback();
|
|
21834
|
+
}
|
|
21835
|
+
$getSelections() {
|
|
21836
|
+
let selections = [];
|
|
21837
|
+
if (this.parentElement) {
|
|
21838
|
+
selections = Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(CROPPER_SELECTION)));
|
|
21839
|
+
}
|
|
21840
|
+
return selections;
|
|
21841
|
+
}
|
|
21842
|
+
$initSelection(center = false, resize = false) {
|
|
21843
|
+
const { initialCoverage, parentElement } = this;
|
|
21844
|
+
if (isPositiveNumber(initialCoverage) && parentElement) {
|
|
21845
|
+
const aspectRatio = this.aspectRatio || this.initialAspectRatio;
|
|
21846
|
+
let width = (resize ? 0 : this.width) || parentElement.offsetWidth * initialCoverage;
|
|
21847
|
+
let height = (resize ? 0 : this.height) || parentElement.offsetHeight * initialCoverage;
|
|
21848
|
+
if (isPositiveNumber(aspectRatio)) {
|
|
21849
|
+
({ width, height } = getAdjustedSizes({ aspectRatio, width, height }));
|
|
21850
|
+
}
|
|
21851
|
+
this.$change(this.x, this.y, width, height);
|
|
21852
|
+
if (center) {
|
|
21853
|
+
this.$center();
|
|
21854
|
+
}
|
|
21855
|
+
// Overrides the initial position and size
|
|
21856
|
+
this.$initialSelection = {
|
|
21857
|
+
x: this.x,
|
|
21858
|
+
y: this.y,
|
|
21859
|
+
width: this.width,
|
|
21860
|
+
height: this.height,
|
|
21861
|
+
};
|
|
21862
|
+
}
|
|
21863
|
+
}
|
|
21864
|
+
$createSelection() {
|
|
21865
|
+
const newSelection = this.cloneNode(true);
|
|
21866
|
+
if (this.hasAttribute('id')) {
|
|
21867
|
+
newSelection.removeAttribute('id');
|
|
21868
|
+
}
|
|
21869
|
+
newSelection.initialCoverage = NaN;
|
|
21870
|
+
this.active = false;
|
|
21871
|
+
if (this.parentElement) {
|
|
21872
|
+
this.parentElement.insertBefore(newSelection, this.nextSibling);
|
|
21873
|
+
}
|
|
21874
|
+
return newSelection;
|
|
21875
|
+
}
|
|
21876
|
+
$removeSelection(selection = this) {
|
|
21877
|
+
if (this.parentElement) {
|
|
21878
|
+
const selections = this.$getSelections();
|
|
21879
|
+
if (selections.length > 1) {
|
|
21880
|
+
const index = selections.indexOf(selection);
|
|
21881
|
+
const activeSelection = selections[index + 1] || selections[index - 1];
|
|
21882
|
+
if (activeSelection) {
|
|
21883
|
+
selection.active = false;
|
|
21884
|
+
this.parentElement.removeChild(selection);
|
|
21885
|
+
activeSelection.active = true;
|
|
21886
|
+
activeSelection.$emit(EVENT_CHANGE, {
|
|
21887
|
+
x: activeSelection.x,
|
|
21888
|
+
y: activeSelection.y,
|
|
21889
|
+
width: activeSelection.width,
|
|
21890
|
+
height: activeSelection.height,
|
|
21891
|
+
});
|
|
21892
|
+
}
|
|
21893
|
+
}
|
|
21894
|
+
else {
|
|
21895
|
+
this.$clear();
|
|
21896
|
+
}
|
|
21897
|
+
}
|
|
21898
|
+
}
|
|
21899
|
+
$handleActionStart(event) {
|
|
21900
|
+
var _a, _b;
|
|
21901
|
+
const relatedTarget = (_b = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.relatedEvent) === null || _b === void 0 ? void 0 : _b.target;
|
|
21902
|
+
this.$action = '';
|
|
21903
|
+
this.$actionStartTarget = relatedTarget;
|
|
21904
|
+
if (!this.hidden
|
|
21905
|
+
&& this.multiple
|
|
21906
|
+
&& !this.active
|
|
21907
|
+
&& relatedTarget === this
|
|
21908
|
+
&& this.parentElement) {
|
|
21909
|
+
this.$getSelections().forEach((selection) => {
|
|
21910
|
+
selection.active = false;
|
|
21911
|
+
});
|
|
21912
|
+
this.active = true;
|
|
21913
|
+
this.$emit(EVENT_CHANGE, {
|
|
21914
|
+
x: this.x,
|
|
21915
|
+
y: this.y,
|
|
21916
|
+
width: this.width,
|
|
21917
|
+
height: this.height,
|
|
21918
|
+
});
|
|
21919
|
+
}
|
|
21920
|
+
}
|
|
21921
|
+
$handleAction(event) {
|
|
21922
|
+
const { currentTarget, detail } = event;
|
|
21923
|
+
if (!currentTarget || !detail) {
|
|
21924
|
+
return;
|
|
21925
|
+
}
|
|
21926
|
+
const { relatedEvent } = detail;
|
|
21927
|
+
let { action } = detail;
|
|
21928
|
+
// Switching to another selection
|
|
21929
|
+
if (!action && this.multiple) {
|
|
21930
|
+
// Get the `action` property from the focusing in selection
|
|
21931
|
+
action = this.$action || (relatedEvent === null || relatedEvent === void 0 ? void 0 : relatedEvent.target.action);
|
|
21932
|
+
this.$action = action;
|
|
21933
|
+
}
|
|
21934
|
+
if (!action
|
|
21935
|
+
|| (this.hidden && action !== ACTION_SELECT)
|
|
21936
|
+
|| (this.multiple && !this.active && action !== ACTION_SCALE)) {
|
|
21937
|
+
return;
|
|
21938
|
+
}
|
|
21939
|
+
const moveX = detail.endX - detail.startX;
|
|
21940
|
+
const moveY = detail.endY - detail.startY;
|
|
21941
|
+
const { width, height } = this;
|
|
21942
|
+
let { aspectRatio } = this;
|
|
21943
|
+
// Locking aspect ratio by holding shift key
|
|
21944
|
+
if (!isPositiveNumber(aspectRatio) && relatedEvent.shiftKey) {
|
|
21945
|
+
aspectRatio = isPositiveNumber(width) && isPositiveNumber(height) ? width / height : 1;
|
|
21946
|
+
}
|
|
21947
|
+
switch (action) {
|
|
21948
|
+
case ACTION_SELECT:
|
|
21949
|
+
if (moveX !== 0 && moveY !== 0) {
|
|
21950
|
+
const { $canvas } = this;
|
|
21951
|
+
const offset = getOffset(currentTarget);
|
|
21952
|
+
(this.multiple && !this.hidden ? this.$createSelection() : this).$change(detail.startX - offset.left, detail.startY - offset.top, Math.abs(moveX), Math.abs(moveY), aspectRatio);
|
|
21953
|
+
if (moveX < 0) {
|
|
21954
|
+
if (moveY < 0) {
|
|
21955
|
+
// ↖️
|
|
21956
|
+
action = ACTION_RESIZE_NORTHWEST;
|
|
21957
|
+
}
|
|
21958
|
+
else if (moveY > 0) {
|
|
21959
|
+
// ↙️
|
|
21960
|
+
action = ACTION_RESIZE_SOUTHWEST;
|
|
21961
|
+
}
|
|
21962
|
+
}
|
|
21963
|
+
else if (moveX > 0) {
|
|
21964
|
+
if (moveY < 0) {
|
|
21965
|
+
// ↗️
|
|
21966
|
+
action = ACTION_RESIZE_NORTHEAST;
|
|
21967
|
+
}
|
|
21968
|
+
else if (moveY > 0) {
|
|
21969
|
+
// ↘️
|
|
21970
|
+
action = ACTION_RESIZE_SOUTHEAST;
|
|
21971
|
+
}
|
|
21972
|
+
}
|
|
21973
|
+
if ($canvas) {
|
|
21974
|
+
$canvas.$action = action;
|
|
21975
|
+
}
|
|
21976
|
+
}
|
|
21977
|
+
break;
|
|
21978
|
+
case ACTION_MOVE:
|
|
21979
|
+
if (this.movable && (this.dynamic
|
|
21980
|
+
|| (this.$actionStartTarget && this.contains(this.$actionStartTarget)))) {
|
|
21981
|
+
this.$move(moveX, moveY);
|
|
21982
|
+
}
|
|
21983
|
+
break;
|
|
21984
|
+
case ACTION_SCALE:
|
|
21985
|
+
if (relatedEvent && this.zoomable && (this.dynamic
|
|
21986
|
+
|| this.contains(relatedEvent.target))) {
|
|
21987
|
+
const offset = getOffset(currentTarget);
|
|
21988
|
+
this.$zoom(detail.scale, relatedEvent.pageX - offset.left, relatedEvent.pageY - offset.top);
|
|
21989
|
+
}
|
|
21990
|
+
break;
|
|
21991
|
+
default:
|
|
21992
|
+
this.$resize(action, moveX, moveY, aspectRatio);
|
|
21993
|
+
}
|
|
21994
|
+
}
|
|
21995
|
+
$handleActionEnd() {
|
|
21996
|
+
this.$action = '';
|
|
21997
|
+
this.$actionStartTarget = null;
|
|
21998
|
+
}
|
|
21999
|
+
$handleKeyDown(event) {
|
|
22000
|
+
if (this.hidden
|
|
22001
|
+
|| !this.keyboard
|
|
22002
|
+
|| (this.multiple && !this.active)
|
|
22003
|
+
|| event.defaultPrevented) {
|
|
22004
|
+
return;
|
|
22005
|
+
}
|
|
22006
|
+
const { activeElement } = document;
|
|
22007
|
+
// Disable keyboard control when input something
|
|
22008
|
+
if (activeElement && (['INPUT', 'TEXTAREA'].includes(activeElement.tagName)
|
|
22009
|
+
|| ['true', 'plaintext-only'].includes(activeElement.contentEditable))) {
|
|
22010
|
+
return;
|
|
22011
|
+
}
|
|
22012
|
+
switch (event.key) {
|
|
22013
|
+
case 'Backspace':
|
|
22014
|
+
if (event.metaKey) {
|
|
22015
|
+
event.preventDefault();
|
|
22016
|
+
this.$removeSelection();
|
|
22017
|
+
}
|
|
22018
|
+
break;
|
|
22019
|
+
case 'Delete':
|
|
22020
|
+
event.preventDefault();
|
|
22021
|
+
this.$removeSelection();
|
|
22022
|
+
break;
|
|
22023
|
+
// Move to the left
|
|
22024
|
+
case 'ArrowLeft':
|
|
22025
|
+
event.preventDefault();
|
|
22026
|
+
this.$move(-1, 0);
|
|
22027
|
+
break;
|
|
22028
|
+
// Move to the right
|
|
22029
|
+
case 'ArrowRight':
|
|
22030
|
+
event.preventDefault();
|
|
22031
|
+
this.$move(1, 0);
|
|
22032
|
+
break;
|
|
22033
|
+
// Move to the top
|
|
22034
|
+
case 'ArrowUp':
|
|
22035
|
+
event.preventDefault();
|
|
22036
|
+
this.$move(0, -1);
|
|
22037
|
+
break;
|
|
22038
|
+
// Move to the bottom
|
|
22039
|
+
case 'ArrowDown':
|
|
22040
|
+
event.preventDefault();
|
|
22041
|
+
this.$move(0, 1);
|
|
22042
|
+
break;
|
|
22043
|
+
case '+':
|
|
22044
|
+
event.preventDefault();
|
|
22045
|
+
this.$zoom(0.1);
|
|
22046
|
+
break;
|
|
22047
|
+
case '-':
|
|
22048
|
+
event.preventDefault();
|
|
22049
|
+
this.$zoom(-0.1);
|
|
22050
|
+
break;
|
|
22051
|
+
}
|
|
22052
|
+
}
|
|
22053
|
+
/**
|
|
22054
|
+
* Aligns the selection to the center of its parent element.
|
|
22055
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22056
|
+
*/
|
|
22057
|
+
$center() {
|
|
22058
|
+
const { parentElement } = this;
|
|
22059
|
+
if (!parentElement) {
|
|
22060
|
+
return this;
|
|
22061
|
+
}
|
|
22062
|
+
const x = (parentElement.offsetWidth - this.width) / 2;
|
|
22063
|
+
const y = (parentElement.offsetHeight - this.height) / 2;
|
|
22064
|
+
return this.$change(x, y);
|
|
22065
|
+
}
|
|
22066
|
+
/**
|
|
22067
|
+
* Moves the selection.
|
|
22068
|
+
* @param {number} x The moving distance in the horizontal direction.
|
|
22069
|
+
* @param {number} [y] The moving distance in the vertical direction.
|
|
22070
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22071
|
+
*/
|
|
22072
|
+
$move(x, y = x) {
|
|
22073
|
+
return this.$moveTo(this.x + x, this.y + y);
|
|
22074
|
+
}
|
|
22075
|
+
/**
|
|
22076
|
+
* Moves the selection to a specific position.
|
|
22077
|
+
* @param {number} x The new position in the horizontal direction.
|
|
22078
|
+
* @param {number} [y] The new position in the vertical direction.
|
|
22079
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22080
|
+
*/
|
|
22081
|
+
$moveTo(x, y = x) {
|
|
22082
|
+
if (!this.movable) {
|
|
22083
|
+
return this;
|
|
22084
|
+
}
|
|
22085
|
+
return this.$change(x, y);
|
|
22086
|
+
}
|
|
22087
|
+
/**
|
|
22088
|
+
* Adjusts the size the selection on a specific side or corner.
|
|
22089
|
+
* @param {string} action Indicates the side or corner to resize.
|
|
22090
|
+
* @param {number} [offsetX] The horizontal offset of the specific side or corner.
|
|
22091
|
+
* @param {number} [offsetY] The vertical offset of the specific side or corner.
|
|
22092
|
+
* @param {number} [aspectRatio] The aspect ratio for computing the new size if it is necessary.
|
|
22093
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22094
|
+
*/
|
|
22095
|
+
$resize(action, offsetX = 0, offsetY = 0, aspectRatio = this.aspectRatio) {
|
|
22096
|
+
if (!this.resizable) {
|
|
22097
|
+
return this;
|
|
22098
|
+
}
|
|
22099
|
+
const hasValidAspectRatio = isPositiveNumber(aspectRatio);
|
|
22100
|
+
const { $canvas } = this;
|
|
22101
|
+
let { x, y, width, height, } = this;
|
|
22102
|
+
switch (action) {
|
|
22103
|
+
case ACTION_RESIZE_NORTH:
|
|
22104
|
+
y += offsetY;
|
|
22105
|
+
height -= offsetY;
|
|
22106
|
+
if (height < 0) {
|
|
22107
|
+
action = ACTION_RESIZE_SOUTH;
|
|
22108
|
+
height = -height;
|
|
22109
|
+
y -= height;
|
|
22110
|
+
}
|
|
22111
|
+
if (hasValidAspectRatio) {
|
|
22112
|
+
offsetX = offsetY * aspectRatio;
|
|
22113
|
+
x += offsetX / 2;
|
|
22114
|
+
width -= offsetX;
|
|
22115
|
+
if (width < 0) {
|
|
22116
|
+
width = -width;
|
|
22117
|
+
x -= width;
|
|
22118
|
+
}
|
|
22119
|
+
}
|
|
22120
|
+
break;
|
|
22121
|
+
case ACTION_RESIZE_EAST:
|
|
22122
|
+
width += offsetX;
|
|
22123
|
+
if (width < 0) {
|
|
22124
|
+
action = ACTION_RESIZE_WEST;
|
|
22125
|
+
width = -width;
|
|
22126
|
+
x -= width;
|
|
22127
|
+
}
|
|
22128
|
+
if (hasValidAspectRatio) {
|
|
22129
|
+
offsetY = offsetX / aspectRatio;
|
|
22130
|
+
y -= offsetY / 2;
|
|
22131
|
+
height += offsetY;
|
|
22132
|
+
if (height < 0) {
|
|
22133
|
+
height = -height;
|
|
22134
|
+
y -= height;
|
|
22135
|
+
}
|
|
22136
|
+
}
|
|
22137
|
+
break;
|
|
22138
|
+
case ACTION_RESIZE_SOUTH:
|
|
22139
|
+
height += offsetY;
|
|
22140
|
+
if (height < 0) {
|
|
22141
|
+
action = ACTION_RESIZE_NORTH;
|
|
22142
|
+
height = -height;
|
|
22143
|
+
y -= height;
|
|
22144
|
+
}
|
|
22145
|
+
if (hasValidAspectRatio) {
|
|
22146
|
+
offsetX = offsetY * aspectRatio;
|
|
22147
|
+
x -= offsetX / 2;
|
|
22148
|
+
width += offsetX;
|
|
22149
|
+
if (width < 0) {
|
|
22150
|
+
width = -width;
|
|
22151
|
+
x -= width;
|
|
22152
|
+
}
|
|
22153
|
+
}
|
|
22154
|
+
break;
|
|
22155
|
+
case ACTION_RESIZE_WEST:
|
|
22156
|
+
x += offsetX;
|
|
22157
|
+
width -= offsetX;
|
|
22158
|
+
if (width < 0) {
|
|
22159
|
+
action = ACTION_RESIZE_EAST;
|
|
22160
|
+
width = -width;
|
|
22161
|
+
x -= width;
|
|
22162
|
+
}
|
|
22163
|
+
if (hasValidAspectRatio) {
|
|
22164
|
+
offsetY = offsetX / aspectRatio;
|
|
22165
|
+
y += offsetY / 2;
|
|
22166
|
+
height -= offsetY;
|
|
22167
|
+
if (height < 0) {
|
|
22168
|
+
height = -height;
|
|
22169
|
+
y -= height;
|
|
22170
|
+
}
|
|
22171
|
+
}
|
|
22172
|
+
break;
|
|
22173
|
+
case ACTION_RESIZE_NORTHEAST:
|
|
22174
|
+
if (hasValidAspectRatio) {
|
|
22175
|
+
offsetY = -offsetX / aspectRatio;
|
|
22176
|
+
}
|
|
22177
|
+
y += offsetY;
|
|
22178
|
+
height -= offsetY;
|
|
22179
|
+
width += offsetX;
|
|
22180
|
+
if (width < 0 && height < 0) {
|
|
22181
|
+
action = ACTION_RESIZE_SOUTHWEST;
|
|
22182
|
+
width = -width;
|
|
22183
|
+
height = -height;
|
|
22184
|
+
x -= width;
|
|
22185
|
+
y -= height;
|
|
22186
|
+
}
|
|
22187
|
+
else if (width < 0) {
|
|
22188
|
+
action = ACTION_RESIZE_NORTHWEST;
|
|
22189
|
+
width = -width;
|
|
22190
|
+
x -= width;
|
|
22191
|
+
}
|
|
22192
|
+
else if (height < 0) {
|
|
22193
|
+
action = ACTION_RESIZE_SOUTHEAST;
|
|
22194
|
+
height = -height;
|
|
22195
|
+
y -= height;
|
|
22196
|
+
}
|
|
22197
|
+
break;
|
|
22198
|
+
case ACTION_RESIZE_NORTHWEST:
|
|
22199
|
+
if (hasValidAspectRatio) {
|
|
22200
|
+
offsetY = offsetX / aspectRatio;
|
|
22201
|
+
}
|
|
22202
|
+
x += offsetX;
|
|
22203
|
+
y += offsetY;
|
|
22204
|
+
width -= offsetX;
|
|
22205
|
+
height -= offsetY;
|
|
22206
|
+
if (width < 0 && height < 0) {
|
|
22207
|
+
action = ACTION_RESIZE_SOUTHEAST;
|
|
22208
|
+
width = -width;
|
|
22209
|
+
height = -height;
|
|
22210
|
+
x -= width;
|
|
22211
|
+
y -= height;
|
|
22212
|
+
}
|
|
22213
|
+
else if (width < 0) {
|
|
22214
|
+
action = ACTION_RESIZE_NORTHEAST;
|
|
22215
|
+
width = -width;
|
|
22216
|
+
x -= width;
|
|
22217
|
+
}
|
|
22218
|
+
else if (height < 0) {
|
|
22219
|
+
action = ACTION_RESIZE_SOUTHWEST;
|
|
22220
|
+
height = -height;
|
|
22221
|
+
y -= height;
|
|
22222
|
+
}
|
|
22223
|
+
break;
|
|
22224
|
+
case ACTION_RESIZE_SOUTHEAST:
|
|
22225
|
+
if (hasValidAspectRatio) {
|
|
22226
|
+
offsetY = offsetX / aspectRatio;
|
|
22227
|
+
}
|
|
22228
|
+
width += offsetX;
|
|
22229
|
+
height += offsetY;
|
|
22230
|
+
if (width < 0 && height < 0) {
|
|
22231
|
+
action = ACTION_RESIZE_NORTHWEST;
|
|
22232
|
+
width = -width;
|
|
22233
|
+
height = -height;
|
|
22234
|
+
x -= width;
|
|
22235
|
+
y -= height;
|
|
22236
|
+
}
|
|
22237
|
+
else if (width < 0) {
|
|
22238
|
+
action = ACTION_RESIZE_SOUTHWEST;
|
|
22239
|
+
width = -width;
|
|
22240
|
+
x -= width;
|
|
22241
|
+
}
|
|
22242
|
+
else if (height < 0) {
|
|
22243
|
+
action = ACTION_RESIZE_NORTHEAST;
|
|
22244
|
+
height = -height;
|
|
22245
|
+
y -= height;
|
|
22246
|
+
}
|
|
22247
|
+
break;
|
|
22248
|
+
case ACTION_RESIZE_SOUTHWEST:
|
|
22249
|
+
if (hasValidAspectRatio) {
|
|
22250
|
+
offsetY = -offsetX / aspectRatio;
|
|
22251
|
+
}
|
|
22252
|
+
x += offsetX;
|
|
22253
|
+
width -= offsetX;
|
|
22254
|
+
height += offsetY;
|
|
22255
|
+
if (width < 0 && height < 0) {
|
|
22256
|
+
action = ACTION_RESIZE_NORTHEAST;
|
|
22257
|
+
width = -width;
|
|
22258
|
+
height = -height;
|
|
22259
|
+
x -= width;
|
|
22260
|
+
y -= height;
|
|
22261
|
+
}
|
|
22262
|
+
else if (width < 0) {
|
|
22263
|
+
action = ACTION_RESIZE_SOUTHEAST;
|
|
22264
|
+
width = -width;
|
|
22265
|
+
x -= width;
|
|
22266
|
+
}
|
|
22267
|
+
else if (height < 0) {
|
|
22268
|
+
action = ACTION_RESIZE_NORTHWEST;
|
|
22269
|
+
height = -height;
|
|
22270
|
+
y -= height;
|
|
22271
|
+
}
|
|
22272
|
+
break;
|
|
22273
|
+
}
|
|
22274
|
+
if ($canvas) {
|
|
22275
|
+
$canvas.$setAction(action);
|
|
22276
|
+
}
|
|
22277
|
+
return this.$change(x, y, width, height);
|
|
22278
|
+
}
|
|
22279
|
+
/**
|
|
22280
|
+
* Zooms the selection.
|
|
22281
|
+
* @param {number} scale The zoom factor. Positive numbers for zooming in, and negative numbers for zooming out.
|
|
22282
|
+
* @param {number} [x] The zoom origin in the horizontal, defaults to the center of the selection.
|
|
22283
|
+
* @param {number} [y] The zoom origin in the vertical, defaults to the center of the selection.
|
|
22284
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22285
|
+
*/
|
|
22286
|
+
$zoom(scale, x, y) {
|
|
22287
|
+
if (!this.zoomable || scale === 0) {
|
|
22288
|
+
return this;
|
|
22289
|
+
}
|
|
22290
|
+
if (scale < 0) {
|
|
22291
|
+
scale = 1 / (1 - scale);
|
|
22292
|
+
}
|
|
22293
|
+
else {
|
|
22294
|
+
scale += 1;
|
|
22295
|
+
}
|
|
22296
|
+
const { width, height } = this;
|
|
22297
|
+
const newWidth = width * scale;
|
|
22298
|
+
const newHeight = height * scale;
|
|
22299
|
+
let newX = this.x;
|
|
22300
|
+
let newY = this.y;
|
|
22301
|
+
if (isNumber(x) && isNumber(y)) {
|
|
22302
|
+
newX -= (newWidth - width) * ((x - this.x) / width);
|
|
22303
|
+
newY -= (newHeight - height) * ((y - this.y) / height);
|
|
22304
|
+
}
|
|
22305
|
+
else {
|
|
22306
|
+
// Zoom from the center of the selection
|
|
22307
|
+
newX -= (newWidth - width) / 2;
|
|
22308
|
+
newY -= (newHeight - height) / 2;
|
|
22309
|
+
}
|
|
22310
|
+
return this.$change(newX, newY, newWidth, newHeight);
|
|
22311
|
+
}
|
|
22312
|
+
/**
|
|
22313
|
+
* Changes the position and/or size of the selection.
|
|
22314
|
+
* @param {number} x The new position in the horizontal direction.
|
|
22315
|
+
* @param {number} y The new position in the vertical direction.
|
|
22316
|
+
* @param {number} [width] The new width.
|
|
22317
|
+
* @param {number} [height] The new height.
|
|
22318
|
+
* @param {number} [aspectRatio] The new aspect ratio for this change only.
|
|
22319
|
+
* @param {number} [_force] Force change.
|
|
22320
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22321
|
+
*/
|
|
22322
|
+
$change(x, y, width = this.width, height = this.height, aspectRatio = this.aspectRatio, _force = false) {
|
|
22323
|
+
if (this.$changing
|
|
22324
|
+
|| !isNumber(x)
|
|
22325
|
+
|| !isNumber(y)
|
|
22326
|
+
|| !isNumber(width)
|
|
22327
|
+
|| !isNumber(height)
|
|
22328
|
+
|| width < 0
|
|
22329
|
+
|| height < 0) {
|
|
22330
|
+
return this;
|
|
22331
|
+
}
|
|
22332
|
+
if (isPositiveNumber(aspectRatio)) {
|
|
22333
|
+
({ width, height } = getAdjustedSizes({ aspectRatio, width, height }, 'cover'));
|
|
22334
|
+
}
|
|
22335
|
+
if (!this.precise) {
|
|
22336
|
+
x = Math.round(x);
|
|
22337
|
+
y = Math.round(y);
|
|
22338
|
+
width = Math.round(width);
|
|
22339
|
+
height = Math.round(height);
|
|
22340
|
+
}
|
|
22341
|
+
if (x === this.x
|
|
22342
|
+
&& y === this.y
|
|
22343
|
+
&& width === this.width
|
|
22344
|
+
&& height === this.height
|
|
22345
|
+
&& Object.is(aspectRatio, this.aspectRatio)
|
|
22346
|
+
&& !_force) {
|
|
22347
|
+
return this;
|
|
22348
|
+
}
|
|
22349
|
+
if (this.hidden) {
|
|
22350
|
+
this.hidden = false;
|
|
22351
|
+
}
|
|
22352
|
+
if (this.$emit(EVENT_CHANGE, {
|
|
22353
|
+
x,
|
|
22354
|
+
y,
|
|
22355
|
+
width,
|
|
22356
|
+
height,
|
|
22357
|
+
}) === false) {
|
|
22358
|
+
return this;
|
|
22359
|
+
}
|
|
22360
|
+
this.$changing = true;
|
|
22361
|
+
this.x = x;
|
|
22362
|
+
this.y = y;
|
|
22363
|
+
this.width = width;
|
|
22364
|
+
this.height = height;
|
|
22365
|
+
this.$changing = false;
|
|
22366
|
+
return this.$render();
|
|
22367
|
+
}
|
|
22368
|
+
/**
|
|
22369
|
+
* Resets the selection to its initial position and size.
|
|
22370
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22371
|
+
*/
|
|
22372
|
+
$reset() {
|
|
22373
|
+
const { x, y, width, height, } = this.$initialSelection;
|
|
22374
|
+
return this.$change(x, y, width, height);
|
|
22375
|
+
}
|
|
22376
|
+
/**
|
|
22377
|
+
* Clears the selection.
|
|
22378
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22379
|
+
*/
|
|
22380
|
+
$clear() {
|
|
22381
|
+
this.$change(0, 0, 0, 0, NaN, true);
|
|
22382
|
+
this.hidden = true;
|
|
22383
|
+
return this;
|
|
22384
|
+
}
|
|
22385
|
+
/**
|
|
22386
|
+
* Refreshes the position or size of the selection.
|
|
22387
|
+
* @returns {CropperSelection} Returns `this` for chaining.
|
|
22388
|
+
*/
|
|
22389
|
+
$render() {
|
|
22390
|
+
return this.$setStyles({
|
|
22391
|
+
transform: `translate(${this.x}px, ${this.y}px)`,
|
|
22392
|
+
width: this.width,
|
|
22393
|
+
height: this.height,
|
|
22394
|
+
});
|
|
22395
|
+
}
|
|
22396
|
+
/**
|
|
22397
|
+
* Generates a real canvas element, with the image (selected area only) draw into if there is one.
|
|
22398
|
+
* @param {object} [options] The available options.
|
|
22399
|
+
* @param {number} [options.width] The width of the canvas.
|
|
22400
|
+
* @param {number} [options.height] The height of the canvas.
|
|
22401
|
+
* @param {Function} [options.beforeDraw] The function called before drawing the image onto the canvas.
|
|
22402
|
+
* @returns {Promise} Returns a promise that resolves to the generated canvas element.
|
|
22403
|
+
*/
|
|
22404
|
+
$toCanvas(options) {
|
|
22405
|
+
return new Promise((resolve, reject) => {
|
|
22406
|
+
if (!this.isConnected) {
|
|
22407
|
+
reject(new Error('The current element is not connected to the DOM.'));
|
|
22408
|
+
return;
|
|
22409
|
+
}
|
|
22410
|
+
const canvas = document.createElement('canvas');
|
|
22411
|
+
let { width, height } = this;
|
|
22412
|
+
let scale = 1;
|
|
22413
|
+
if (isPlainObject(options)
|
|
22414
|
+
&& (isPositiveNumber(options.width) || isPositiveNumber(options.height))) {
|
|
22415
|
+
({ width, height } = getAdjustedSizes({
|
|
22416
|
+
aspectRatio: width / height,
|
|
22417
|
+
width: options.width,
|
|
22418
|
+
height: options.height,
|
|
22419
|
+
}));
|
|
22420
|
+
scale = width / this.width;
|
|
22421
|
+
}
|
|
22422
|
+
canvas.width = width;
|
|
22423
|
+
canvas.height = height;
|
|
22424
|
+
if (!this.$canvas) {
|
|
22425
|
+
resolve(canvas);
|
|
22426
|
+
return;
|
|
22427
|
+
}
|
|
22428
|
+
const cropperImage = this.$canvas.querySelector(this.$getTagNameOf(CROPPER_IMAGE));
|
|
22429
|
+
if (!cropperImage) {
|
|
22430
|
+
resolve(canvas);
|
|
22431
|
+
return;
|
|
22432
|
+
}
|
|
22433
|
+
cropperImage.$ready().then((image) => {
|
|
22434
|
+
const context = canvas.getContext('2d');
|
|
22435
|
+
if (context) {
|
|
22436
|
+
const [a, b, c, d, e, f] = cropperImage.$getTransform();
|
|
22437
|
+
const offsetX = -this.x;
|
|
22438
|
+
const offsetY = -this.y;
|
|
22439
|
+
const translateX = ((offsetX * d) - (c * offsetY)) / ((a * d) - (c * b));
|
|
22440
|
+
const translateY = ((offsetY * a) - (b * offsetX)) / ((a * d) - (c * b));
|
|
22441
|
+
let newE = a * translateX + c * translateY + e;
|
|
22442
|
+
let newF = b * translateX + d * translateY + f;
|
|
22443
|
+
let destWidth = image.naturalWidth;
|
|
22444
|
+
let destHeight = image.naturalHeight;
|
|
22445
|
+
if (scale !== 1) {
|
|
22446
|
+
newE *= scale;
|
|
22447
|
+
newF *= scale;
|
|
22448
|
+
destWidth *= scale;
|
|
22449
|
+
destHeight *= scale;
|
|
22450
|
+
}
|
|
22451
|
+
const centerX = destWidth / 2;
|
|
22452
|
+
const centerY = destHeight / 2;
|
|
22453
|
+
context.fillStyle = 'transparent';
|
|
22454
|
+
context.fillRect(0, 0, width, height);
|
|
22455
|
+
if (isPlainObject(options) && isFunction$1(options.beforeDraw)) {
|
|
22456
|
+
options.beforeDraw.call(this, context, canvas);
|
|
22457
|
+
}
|
|
22458
|
+
context.save();
|
|
22459
|
+
// Move the transform origin to the center of the image.
|
|
22460
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin
|
|
22461
|
+
context.translate(centerX, centerY);
|
|
22462
|
+
context.transform(a, b, c, d, newE, newF);
|
|
22463
|
+
// Move the transform origin to the top-left of the image.
|
|
22464
|
+
context.translate(-centerX, -centerY);
|
|
22465
|
+
context.drawImage(image, 0, 0, destWidth, destHeight);
|
|
22466
|
+
context.restore();
|
|
22467
|
+
}
|
|
22468
|
+
resolve(canvas);
|
|
22469
|
+
}).catch(reject);
|
|
22470
|
+
});
|
|
22471
|
+
}
|
|
22472
|
+
}
|
|
22473
|
+
CropperSelection.$name = CROPPER_SELECTION;
|
|
22474
|
+
CropperSelection.$version = '2.0.0';
|
|
22475
|
+
|
|
22476
|
+
var style$2 = `:host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}`;
|
|
22477
|
+
|
|
22478
|
+
class CropperGrid extends CropperElement {
|
|
22479
|
+
constructor() {
|
|
22480
|
+
super(...arguments);
|
|
22481
|
+
this.$style = style$2;
|
|
22482
|
+
this.bordered = false;
|
|
22483
|
+
this.columns = 3;
|
|
22484
|
+
this.covered = false;
|
|
22485
|
+
this.rows = 3;
|
|
22486
|
+
this.slottable = false;
|
|
22487
|
+
this.themeColor = 'rgba(238, 238, 238, 0.5)';
|
|
22488
|
+
}
|
|
22489
|
+
static get observedAttributes() {
|
|
22490
|
+
return super.observedAttributes.concat([
|
|
22491
|
+
'bordered',
|
|
22492
|
+
'columns',
|
|
22493
|
+
'covered',
|
|
22494
|
+
'rows',
|
|
22495
|
+
]);
|
|
22496
|
+
}
|
|
22497
|
+
$propertyChangedCallback(name, oldValue, newValue) {
|
|
22498
|
+
if (Object.is(newValue, oldValue)) {
|
|
22499
|
+
return;
|
|
22500
|
+
}
|
|
22501
|
+
super.$propertyChangedCallback(name, oldValue, newValue);
|
|
22502
|
+
if (name === 'rows' || name === 'columns') {
|
|
22503
|
+
this.$nextTick(() => {
|
|
22504
|
+
this.$render();
|
|
22505
|
+
});
|
|
22506
|
+
}
|
|
22507
|
+
}
|
|
22508
|
+
connectedCallback() {
|
|
22509
|
+
super.connectedCallback();
|
|
22510
|
+
this.$render();
|
|
22511
|
+
}
|
|
22512
|
+
$render() {
|
|
22513
|
+
const shadow = this.$getShadowRoot();
|
|
22514
|
+
const fragment = document.createDocumentFragment();
|
|
22515
|
+
for (let i = 0; i < this.rows; i += 1) {
|
|
22516
|
+
const row = document.createElement('span');
|
|
22517
|
+
row.setAttribute('role', 'row');
|
|
22518
|
+
for (let j = 0; j < this.columns; j += 1) {
|
|
22519
|
+
const column = document.createElement('span');
|
|
22520
|
+
column.setAttribute('role', 'gridcell');
|
|
22521
|
+
row.appendChild(column);
|
|
22522
|
+
}
|
|
22523
|
+
fragment.appendChild(row);
|
|
22524
|
+
}
|
|
22525
|
+
if (shadow) {
|
|
22526
|
+
shadow.innerHTML = '';
|
|
22527
|
+
shadow.appendChild(fragment);
|
|
22528
|
+
}
|
|
22529
|
+
}
|
|
22530
|
+
}
|
|
22531
|
+
CropperGrid.$name = CROPPER_GIRD;
|
|
22532
|
+
CropperGrid.$version = '2.0.0';
|
|
22533
|
+
|
|
22534
|
+
var style$1 = `:host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}`;
|
|
22535
|
+
|
|
22536
|
+
class CropperCrosshair extends CropperElement {
|
|
22537
|
+
constructor() {
|
|
22538
|
+
super(...arguments);
|
|
22539
|
+
this.$style = style$1;
|
|
22540
|
+
this.centered = false;
|
|
22541
|
+
this.slottable = false;
|
|
22542
|
+
this.themeColor = 'rgba(238, 238, 238, 0.5)';
|
|
22543
|
+
}
|
|
22544
|
+
static get observedAttributes() {
|
|
22545
|
+
return super.observedAttributes.concat([
|
|
22546
|
+
'centered',
|
|
22547
|
+
]);
|
|
22548
|
+
}
|
|
22549
|
+
}
|
|
22550
|
+
CropperCrosshair.$name = CROPPER_CROSSHAIR;
|
|
22551
|
+
CropperCrosshair.$version = '2.0.0';
|
|
22552
|
+
|
|
22553
|
+
var style = `:host{display:block;height:100%;overflow:hidden;position:relative;width:100%}`;
|
|
22554
|
+
|
|
22555
|
+
const canvasCache = new WeakMap();
|
|
22556
|
+
const imageCache = new WeakMap();
|
|
22557
|
+
const selectionCache = new WeakMap();
|
|
22558
|
+
const sourceImageCache = new WeakMap();
|
|
22559
|
+
const RESIZE_BOTH = 'both';
|
|
22560
|
+
const RESIZE_HORIZONTAL = 'horizontal';
|
|
22561
|
+
const RESIZE_VERTICAL = 'vertical';
|
|
22562
|
+
const RESIZE_NONE = 'none';
|
|
22563
|
+
class CropperViewer extends CropperElement {
|
|
22564
|
+
constructor() {
|
|
22565
|
+
super(...arguments);
|
|
22566
|
+
this.$onSelectionChange = null;
|
|
22567
|
+
this.$onSourceImageLoad = null;
|
|
22568
|
+
this.$onSourceImageTransform = null;
|
|
22569
|
+
this.$scale = 1;
|
|
22570
|
+
this.$style = style;
|
|
22571
|
+
this.resize = RESIZE_VERTICAL;
|
|
22572
|
+
this.selection = '';
|
|
22573
|
+
this.slottable = false;
|
|
22574
|
+
}
|
|
22575
|
+
set $image(element) {
|
|
22576
|
+
imageCache.set(this, element);
|
|
22577
|
+
}
|
|
22578
|
+
get $image() {
|
|
22579
|
+
return imageCache.get(this);
|
|
22580
|
+
}
|
|
22581
|
+
set $sourceImage(element) {
|
|
22582
|
+
sourceImageCache.set(this, element);
|
|
22583
|
+
}
|
|
22584
|
+
get $sourceImage() {
|
|
22585
|
+
return sourceImageCache.get(this);
|
|
22586
|
+
}
|
|
22587
|
+
set $canvas(element) {
|
|
22588
|
+
canvasCache.set(this, element);
|
|
22589
|
+
}
|
|
22590
|
+
get $canvas() {
|
|
22591
|
+
return canvasCache.get(this);
|
|
22592
|
+
}
|
|
22593
|
+
set $selection(element) {
|
|
22594
|
+
selectionCache.set(this, element);
|
|
22595
|
+
}
|
|
22596
|
+
get $selection() {
|
|
22597
|
+
return selectionCache.get(this);
|
|
22598
|
+
}
|
|
22599
|
+
static get observedAttributes() {
|
|
22600
|
+
return super.observedAttributes.concat([
|
|
22601
|
+
'resize',
|
|
22602
|
+
'selection',
|
|
22603
|
+
]);
|
|
22604
|
+
}
|
|
22605
|
+
connectedCallback() {
|
|
22606
|
+
super.connectedCallback();
|
|
22607
|
+
let $selection = null;
|
|
22608
|
+
if (this.selection) {
|
|
22609
|
+
$selection = this.ownerDocument.querySelector(this.selection);
|
|
22610
|
+
}
|
|
22611
|
+
else {
|
|
22612
|
+
$selection = this.closest(this.$getTagNameOf(CROPPER_SELECTION));
|
|
22613
|
+
}
|
|
22614
|
+
if (isElement$1($selection)) {
|
|
22615
|
+
this.$selection = $selection;
|
|
22616
|
+
this.$onSelectionChange = this.$handleSelectionChange.bind(this);
|
|
22617
|
+
on($selection, EVENT_CHANGE, this.$onSelectionChange);
|
|
22618
|
+
const $canvas = $selection.closest(this.$getTagNameOf(CROPPER_CANVAS));
|
|
22619
|
+
if ($canvas) {
|
|
22620
|
+
this.$canvas = $canvas;
|
|
22621
|
+
const $sourceImage = $canvas.querySelector(this.$getTagNameOf(CROPPER_IMAGE));
|
|
22622
|
+
if ($sourceImage) {
|
|
22623
|
+
this.$sourceImage = $sourceImage;
|
|
22624
|
+
this.$image = $sourceImage.cloneNode(true);
|
|
22625
|
+
this.$getShadowRoot().appendChild(this.$image);
|
|
22626
|
+
this.$onSourceImageLoad = this.$handleSourceImageLoad.bind(this);
|
|
22627
|
+
this.$onSourceImageTransform = this.$handleSourceImageTransform.bind(this);
|
|
22628
|
+
on($sourceImage.$image, EVENT_LOAD, this.$onSourceImageLoad);
|
|
22629
|
+
on($sourceImage, EVENT_TRANSFORM, this.$onSourceImageTransform);
|
|
22630
|
+
}
|
|
22631
|
+
}
|
|
22632
|
+
this.$render();
|
|
22633
|
+
}
|
|
22634
|
+
}
|
|
22635
|
+
disconnectedCallback() {
|
|
22636
|
+
const { $selection, $sourceImage } = this;
|
|
22637
|
+
if ($selection && this.$onSelectionChange) {
|
|
22638
|
+
off($selection, EVENT_CHANGE, this.$onSelectionChange);
|
|
22639
|
+
this.$onSelectionChange = null;
|
|
22640
|
+
}
|
|
22641
|
+
if ($sourceImage && this.$onSourceImageLoad) {
|
|
22642
|
+
off($sourceImage.$image, EVENT_LOAD, this.$onSourceImageLoad);
|
|
22643
|
+
this.$onSourceImageLoad = null;
|
|
22644
|
+
}
|
|
22645
|
+
if ($sourceImage && this.$onSourceImageTransform) {
|
|
22646
|
+
off($sourceImage, EVENT_TRANSFORM, this.$onSourceImageTransform);
|
|
22647
|
+
this.$onSourceImageTransform = null;
|
|
22648
|
+
}
|
|
22649
|
+
super.disconnectedCallback();
|
|
22650
|
+
}
|
|
22651
|
+
$handleSelectionChange(event) {
|
|
22652
|
+
this.$render(event.detail);
|
|
22653
|
+
}
|
|
22654
|
+
$handleSourceImageLoad() {
|
|
22655
|
+
const { $image, $sourceImage } = this;
|
|
22656
|
+
const oldSrc = $image.getAttribute('src');
|
|
22657
|
+
const newSrc = $sourceImage.getAttribute('src');
|
|
22658
|
+
if (newSrc && newSrc !== oldSrc) {
|
|
22659
|
+
$image.setAttribute('src', newSrc);
|
|
22660
|
+
$image.$ready(() => {
|
|
22661
|
+
setTimeout(() => {
|
|
22662
|
+
this.$render();
|
|
22663
|
+
}, 50);
|
|
22664
|
+
});
|
|
22665
|
+
}
|
|
22666
|
+
}
|
|
22667
|
+
$handleSourceImageTransform(event) {
|
|
22668
|
+
this.$render(undefined, event.detail.matrix);
|
|
22669
|
+
}
|
|
22670
|
+
$render(selection, matrix) {
|
|
22671
|
+
const { $canvas, $selection } = this;
|
|
22672
|
+
if (!selection && !$selection.hidden) {
|
|
22673
|
+
selection = $selection;
|
|
22674
|
+
}
|
|
22675
|
+
if (!selection || (selection.x === 0
|
|
22676
|
+
&& selection.y === 0
|
|
22677
|
+
&& selection.width === 0
|
|
22678
|
+
&& selection.height === 0)) {
|
|
22679
|
+
selection = {
|
|
22680
|
+
x: 0,
|
|
22681
|
+
y: 0,
|
|
22682
|
+
width: $canvas.offsetWidth,
|
|
22683
|
+
height: $canvas.offsetHeight,
|
|
22684
|
+
};
|
|
22685
|
+
}
|
|
22686
|
+
const { x, y, width, height, } = selection;
|
|
22687
|
+
const styles = {};
|
|
22688
|
+
const { clientWidth, clientHeight } = this;
|
|
22689
|
+
let newWidth = clientWidth;
|
|
22690
|
+
let newHeight = clientHeight;
|
|
22691
|
+
let scale = NaN;
|
|
22692
|
+
switch (this.resize) {
|
|
22693
|
+
case RESIZE_BOTH:
|
|
22694
|
+
scale = 1;
|
|
22695
|
+
newWidth = width;
|
|
22696
|
+
newHeight = height;
|
|
22697
|
+
styles.width = width;
|
|
22698
|
+
styles.height = height;
|
|
22699
|
+
break;
|
|
22700
|
+
case RESIZE_HORIZONTAL:
|
|
22701
|
+
scale = height > 0 ? clientHeight / height : 0;
|
|
22702
|
+
newWidth = width * scale;
|
|
22703
|
+
styles.width = newWidth;
|
|
22704
|
+
break;
|
|
22705
|
+
case RESIZE_VERTICAL:
|
|
22706
|
+
scale = width > 0 ? clientWidth / width : 0;
|
|
22707
|
+
newHeight = height * scale;
|
|
22708
|
+
styles.height = newHeight;
|
|
22709
|
+
break;
|
|
22710
|
+
case RESIZE_NONE:
|
|
22711
|
+
default:
|
|
22712
|
+
if (clientWidth > 0) {
|
|
22713
|
+
scale = width > 0 ? clientWidth / width : 0;
|
|
22714
|
+
}
|
|
22715
|
+
else if (clientHeight > 0) {
|
|
22716
|
+
scale = height > 0 ? clientHeight / height : 0;
|
|
22717
|
+
}
|
|
22718
|
+
}
|
|
22719
|
+
this.$scale = scale;
|
|
22720
|
+
this.$setStyles(styles);
|
|
22721
|
+
if (this.$sourceImage) {
|
|
22722
|
+
this.$transformImageByOffset(matrix !== null && matrix !== void 0 ? matrix : this.$sourceImage.$getTransform(), -x, -y);
|
|
22723
|
+
}
|
|
22724
|
+
}
|
|
22725
|
+
$transformImageByOffset(matrix, x, y) {
|
|
22726
|
+
const { $image, $scale, $sourceImage, } = this;
|
|
22727
|
+
if ($sourceImage && $image && $scale >= 0) {
|
|
22728
|
+
const [a, b, c, d, e, f] = matrix;
|
|
22729
|
+
const translateX = ((x * d) - (c * y)) / ((a * d) - (c * b));
|
|
22730
|
+
const translateY = ((y * a) - (b * x)) / ((a * d) - (c * b));
|
|
22731
|
+
const newE = a * translateX + c * translateY + e;
|
|
22732
|
+
const newF = b * translateX + d * translateY + f;
|
|
22733
|
+
$image.$ready((image) => {
|
|
22734
|
+
this.$setStyles.call($image, {
|
|
22735
|
+
width: image.naturalWidth * $scale,
|
|
22736
|
+
height: image.naturalHeight * $scale,
|
|
22737
|
+
});
|
|
22738
|
+
});
|
|
22739
|
+
$image.$setTransform(a, b, c, d, newE * $scale, newF * $scale);
|
|
22740
|
+
}
|
|
22741
|
+
}
|
|
22742
|
+
}
|
|
22743
|
+
CropperViewer.$name = CROPPER_VIEWER;
|
|
22744
|
+
CropperViewer.$version = '2.0.0';
|
|
22745
|
+
|
|
22746
|
+
/*! Cropper.js v2.0.0 | (c) 2015-present Chen Fengyuan | MIT */
|
|
22747
|
+
CropperCanvas.$define();
|
|
22748
|
+
CropperCrosshair.$define();
|
|
22749
|
+
CropperGrid.$define();
|
|
22750
|
+
CropperHandle.$define();
|
|
22751
|
+
CropperImage.$define();
|
|
22752
|
+
CropperSelection.$define();
|
|
22753
|
+
CropperShade.$define();
|
|
22754
|
+
CropperViewer.$define();
|
|
22755
|
+
|
|
19957
22756
|
const cropperComponentCss = () => `.mb-6{margin-bottom:1.5rem}.flex{display:flex}.w-full{width:100%}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}*{box-sizing:border-box}:host{align-items:center;display:flex;flex-direction:column;gap:1.5rem;justify-content:space-between;margin-bottom:1.5rem;width:100%}.static{position:static}.hidden{display:none}.aspect-branding{aspect-ratio:23/24}.h-\\[17\\.5rem\\]{height:17.5rem}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.rounded-full{border-radius:9999px}.border-0{border-width:0}.border-b{border-bottom-width:1px}.border-solid{border-style:solid}.border-off-white-700{--tw-border-opacity:1;border-color:rgb(222 219 213/var(--tw-border-opacity,1))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.px-14{padding-left:3.5rem;padding-right:3.5rem}@media (min-width:40rem){.tablet\\:max-w-xs{max-width:20rem}.tablet\\:px-1{padding-left:.25rem;padding-right:.25rem}}.dark\\:border-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-border-opacity:1;border-color:rgb(163 165 169/var(--tw-border-opacity,1))}.dark\\:border-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-border-opacity:1;border-color:rgb(163 165 169/var(--tw-border-opacity,1))}`;
|
|
19958
22757
|
|
|
19959
22758
|
class Cropper {
|
|
@@ -19999,10 +22798,10 @@ class Cropper {
|
|
|
19999
22798
|
const themeColor = state.theme === 'dark'
|
|
20000
22799
|
? 'rgba(70, 75, 84, 0.5)'
|
|
20001
22800
|
: 'rgba(255, 255, 255, 0.5)';
|
|
20002
|
-
return (hAsync(ThemedHost, { key: '
|
|
22801
|
+
return (hAsync(ThemedHost, { key: 'dd4ea15cbdfbac6e25202bd1a4871d9635fd33a7' }, this._loaded && (hAsync("cropper-canvas", { key: 'cb359d80b35eae4aa2e58c75bed8ccd5a15b2df2', class: 'h-[17.5rem] w-full border-0 border-b border-solid border-off-white-700 bg-white dark:border-hurricane-200', onAction: () => this._onAction() }, hAsync("cropper-image", { key: '8a96ad1f1f11adc4a8291a1376f329af52c3d920', src: this.value, alt: 'Picture', ref: ref => this._setImageRef(ref), scalable: true, translatable: true, crossorigin: 'anonymous' }), hAsync("cropper-shade", { key: '1b375fe73b98ec31776ba4762e10781a1c33117b', class: 'aspect-branding rounded-full', "theme-color": themeColor, hidden: true }), hAsync("cropper-selection", { key: 'ae41c83bf91f714beb89b79998c2636ffe837f51', "initial-coverage": '0.7', "aspect-ratio": '1', ref: ref => (this._selectionRef = ref) }), hAsync("cropper-handle", { key: '45148a814f6b3d1f04e94c0a8ee756b31d6dc7cb', action: 'move', plain: true }))), hAsync("p-range", { key: 'b215e5dfc3aea8cae98d85dc590436a52c667c28', class: 'w-full px-14 tablet:max-w-xs tablet:px-1', value: this._currentScale, onValueChange: ev => this._onInput(ev.detail) })));
|
|
20003
22802
|
}
|
|
20004
22803
|
_setImageRef(ref) {
|
|
20005
|
-
if (this._imageRef) {
|
|
22804
|
+
if (this._imageRef || !ref) {
|
|
20006
22805
|
return;
|
|
20007
22806
|
}
|
|
20008
22807
|
this._imageRef = ref;
|
|
@@ -27873,7 +30672,7 @@ class Table {
|
|
|
27873
30672
|
this.hasRendered.emit();
|
|
27874
30673
|
}
|
|
27875
30674
|
render() {
|
|
27876
|
-
return (hAsync(Host, { key: '
|
|
30675
|
+
return (hAsync(Host, { key: '7ece1479d7c90b408fa55f045feba734f9e27b28', class: 'z-0 flex flex-col' }, hAsync("p-table-container", { key: '290cf20abdacab6257ebef5479b834df529bccbd' }, this.enableHeader && (hAsync("p-table-header", { key: '9d49ef03a1b0c8b47e8292f36ade24a2eb0b3f7d', class: 'mb-8',
|
|
27877
30676
|
// quick filters
|
|
27878
30677
|
quickFilters: this.quickFilters, activeQuickFilterIdentifier: this.activeQuickFilterIdentifier, onQuickFilter: ({ detail }) => this.quickFilter.emit(detail),
|
|
27879
30678
|
// search
|
|
@@ -27885,7 +30684,7 @@ class Table {
|
|
|
27885
30684
|
//export
|
|
27886
30685
|
enableExport: this.enableExport, onExport: () => this.export.emit(),
|
|
27887
30686
|
//loading
|
|
27888
|
-
loading: this.headerLoading }, this._hasCustomFilterSlot && (hAsync("slot", { key: '
|
|
30687
|
+
loading: this.headerLoading }, this._hasCustomFilterSlot && (hAsync("slot", { key: '555237f446a654201d12321505062d4c4e06210c', name: 'custom-filter', slot: 'custom-filter' })), this._hasCustomActionsSlot && (hAsync("slot", { key: '4e935caf48c9cf1b0516a61ca9076a3755f98546', name: 'custom-actions', slot: 'custom-actions' })))), this._getExtraHeader(), this._getHeader(), hAsync("div", { key: '23816ab229344ba5a7c5cc02a358b277e5ff8da1', class: 'flex flex-1 flex-col' }, this._getRows(), hAsync("slot", { key: 'd3012e94582c06ca536db0ab83d1bd0df4d80c48', name: 'custom-rows' })), this.enableFloatingMenu && this._enableRowSelection ? (hAsync("p-floating-menu-container", { usedInTable: true, class: floatingMenuContainerClass({
|
|
27889
30688
|
hasFooter: this.enableFooter && !this._footerHidden,
|
|
27890
30689
|
active: !!this.selectedRows?.length,
|
|
27891
30690
|
shown: this._floatingMenuShown,
|
|
@@ -27895,7 +30694,7 @@ class Table {
|
|
|
27895
30694
|
!!a.action &&
|
|
27896
30695
|
a.type === 'single'
|
|
27897
30696
|
? a.action(this.selectedRows[0], false)
|
|
27898
|
-
: a.action(this.selectedRows, true) }, a.label))))) : (''), this.enableFooter && (hAsync("p-table-footer", { key: '
|
|
30697
|
+
: a.action(this.selectedRows, true) }, a.label))))) : (''), this.enableFooter && (hAsync("p-table-footer", { key: '3c5138a3af7594642a8e750d40524bc13f138892',
|
|
27899
30698
|
// overall
|
|
27900
30699
|
hideOnSinglePage: this.hideOnSinglePage,
|
|
27901
30700
|
// page size select
|
|
@@ -28257,7 +31056,7 @@ class Table {
|
|
|
28257
31056
|
!['auto', 'hidden', 'full'].includes(definition.sizes)) {
|
|
28258
31057
|
definition.sizes = JSON.parse(definition.sizes);
|
|
28259
31058
|
}
|
|
28260
|
-
for (const [index, size] of
|
|
31059
|
+
for (const [index, size] of TABLE_COLUMN_SIZES.entries()) {
|
|
28261
31060
|
if (definitionAny.sizes === 'auto' ||
|
|
28262
31061
|
definitionAny.sizes === 'hidden' ||
|
|
28263
31062
|
definitionAny.sizes === 'full' ||
|
|
@@ -28267,8 +31066,7 @@ class Table {
|
|
|
28267
31066
|
continue;
|
|
28268
31067
|
}
|
|
28269
31068
|
parsedSizes[size] =
|
|
28270
|
-
definitionAny.sizes[size] ??
|
|
28271
|
-
parsedSizes[tableColumSizesOptions[index - 1]];
|
|
31069
|
+
definitionAny.sizes[size] ?? parsedSizes[TABLE_COLUMN_SIZES[index - 1]];
|
|
28272
31070
|
}
|
|
28273
31071
|
definition.parsedSizes = parsedSizes;
|
|
28274
31072
|
return definition;
|