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