@pod-os/contacts 0.2.0 → 0.3.0-rc.4b2b787.0
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/cjs/{chunk.5JY5FUCG-DBOKVhYw.js → chunk.5JY5FUCG-BJJbNIiG.js} +2 -2
- package/dist/cjs/{chunk.HVTXQL7M-CkreIIRp.js → chunk.HVTXQL7M-C6x_EQ24.js} +4 -4
- package/dist/cjs/{chunk.URTPIBTY-CR-txaLF.js → chunk.URTPIBTY-BiNv2Ckb.js} +3 -3
- package/dist/cjs/{chunk.XQ2OKYYA-DwhvXyP9.js → chunk.XQ2OKYYA-CDJtWcvs.js} +4 -4
- package/dist/cjs/{chunk.YHLNUJ7P-BQOX8L9A.js → chunk.YHLNUJ7P-CoQhYOM2.js} +1 -1
- package/dist/cjs/chunk.ZGGPD2XJ-C--tZiyf.js +5 -0
- package/dist/cjs/{class-map-Bp6RgbSP.js → class-map-CyEFRZYn.js} +1 -1
- package/dist/cjs/contacts.cjs.js +2 -2
- package/dist/cjs/{if-defined-C9hF9oNL.js → if-defined-TQmAS6tz.js} +1 -1
- package/dist/cjs/{index-CYTjugvn.js → index-CpATWk39.js} +1 -1
- package/dist/cjs/{index-FUnpyb19.js → index-D1Wk2cIF.js} +2 -2
- package/dist/cjs/{index-BicjKg3I.js → index-DdRXU5II.js} +547 -2001
- package/dist/cjs/{jsonld-V2RB47OZ-BerQ9IRa.js → jsonld-V2RB47OZ-DDsC42qL.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pos-add-literal-value_3.cjs.entry.js +8 -8
- package/dist/cjs/pos-add-new-thing_7.cjs.entry.js +9 -9
- package/dist/cjs/pos-app-browser.cjs.entry.js +2 -2
- package/dist/cjs/pos-app-dashboard_6.cjs.entry.js +5 -5
- package/dist/cjs/pos-app-document-viewer.cjs.entry.js +1 -1
- package/dist/cjs/pos-app-generic.cjs.entry.js +1 -1
- package/dist/cjs/pos-app-image-viewer.cjs.entry.js +1 -1
- package/dist/cjs/pos-app-ldp-container.cjs.entry.js +1 -1
- package/dist/cjs/pos-app-rdf-document.cjs.entry.js +1 -1
- package/dist/cjs/pos-app_24.cjs.entry.js +309 -178
- package/dist/cjs/pos-attachments.cjs.entry.js +2 -2
- package/dist/cjs/pos-container-contents.cjs.entry.js +2 -2
- package/dist/cjs/pos-container-item_3.cjs.entry.js +6 -6
- package/dist/cjs/pos-description_2.cjs.entry.js +1 -1
- package/dist/cjs/pos-document.cjs.entry.js +6 -6
- package/dist/cjs/pos-list.cjs.entry.js +1 -1
- package/dist/cjs/pos-make-findable_2.cjs.entry.js +9 -9
- package/dist/cjs/pos-markdown-document.cjs.entry.js +443 -2328
- package/dist/cjs/pos-new-thing-form.cjs.entry.js +1 -1
- package/dist/cjs/pos-predicate.cjs.entry.js +6 -6
- package/dist/cjs/pos-relations_2.cjs.entry.js +1 -1
- package/dist/cjs/pos-select-term.cjs.entry.js +1 -1
- package/dist/cjs/pos-subjects.cjs.entry.js +2 -2
- package/dist/cjs/pos-tool-attachments.cjs.entry.js +1 -1
- package/dist/cjs/pos-tool-select.cjs.entry.js +4 -4
- package/dist/cjs/pos-value.cjs.entry.js +1 -1
- package/dist/cjs/{session-DkRUfe3C.js → session-kBhmup9r.js} +1 -1
- package/dist/cjs/{settings-C4KFmugv.js → settings-CpwCCkhx.js} +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/contact-details/email-addresses/email-addresses.js +2 -1
- package/dist/collection/components/contact-details/phone-numbers/phone-numbers.js +2 -1
- package/dist/collection/components/contact-list/contact-list.js +4 -2
- package/dist/collection/components/create-new-contact-form/create-new-contact-form.js +2 -1
- package/dist/collection/components/group-list/group-list.js +4 -2
- package/dist/collection/components/open-address-book/open-address-book.js +2 -2
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -1
- package/dist/components/open-address-book.js +1 -1
- package/dist/components/pos-add-literal-value2.js +1 -1
- package/dist/components/pos-attachments2.js +1 -1
- package/dist/components/pos-make-findable2.js +1 -1
- package/dist/components/pos-markdown-document2.js +1 -1
- package/dist/components/pos-tool-select2.js +1 -1
- package/dist/components/pos-type-index-entries2.js +1 -1
- package/dist/components/pos-upload2.js +12 -3
- package/dist/contacts/contacts.esm.js +1 -1
- package/dist/contacts/{p-728d6af6.entry.js → p-26248da8.entry.js} +1 -1
- package/dist/contacts/p-40b2d792.entry.js +1 -0
- package/dist/contacts/{p-2f71dc3f.entry.js → p-46f8861e.entry.js} +1 -1
- package/dist/contacts/{p-a1eccbb3.entry.js → p-4ef3891c.entry.js} +1 -1
- package/dist/contacts/{p-Doy_38_j.js → p-5LNPeQkx.js} +1 -1
- package/dist/contacts/p-5e11ce90.entry.js +1 -0
- package/dist/contacts/{p-f5733446.entry.js → p-649e7365.entry.js} +1 -1
- package/dist/contacts/{p-ZMx7-r-Z.js → p-68gi0rt1.js} +2 -2
- package/dist/contacts/p-6d4ec7e5.entry.js +1 -0
- package/dist/contacts/{p-2838a706.entry.js → p-76382e6a.entry.js} +1 -1
- package/dist/contacts/{p-a4ce6940.entry.js → p-78715d17.entry.js} +1 -1
- package/dist/contacts/p-7a01c820.entry.js +1 -0
- package/dist/contacts/{p-1a3db10b.entry.js → p-7d796ba8.entry.js} +12 -12
- package/dist/contacts/{p-274a058e.entry.js → p-7f565d49.entry.js} +1 -1
- package/dist/contacts/{p-a2fd47c3.entry.js → p-84fdbc1a.entry.js} +1 -1
- package/dist/contacts/p-8bc26fd9.entry.js +1 -0
- package/dist/contacts/{p-d84a0a69.entry.js → p-92fcdd59.entry.js} +1 -1
- package/dist/contacts/p-B0L5m2PZ.js +67 -0
- package/dist/contacts/{p-1xUnBGk9.js → p-B0_xZCeV.js} +3 -3
- package/dist/contacts/{p-GY-EgIvC.js → p-BXcFVJku.js} +2 -2
- package/dist/contacts/{p-B9Os6GUk.js → p-BXdS2klL.js} +4 -4
- package/dist/contacts/p-Bk6kpzHk.js +1 -0
- package/dist/contacts/{p-C_2ssh--.js → p-BkeypvMo.js} +7 -7
- package/dist/contacts/{p-sjhA5ZF-.js → p-Bug_w-vi.js} +1 -1
- package/dist/contacts/p-C1XsyD29.js +1 -0
- package/dist/contacts/{p-DAeBhDur.js → p-C8LPXtIR.js} +8 -8
- package/dist/contacts/p-DScSUBy-.js +2 -0
- package/dist/contacts/p-D_nUMgR-.js +11 -0
- package/dist/contacts/{p-CXax1-ne.js → p-SrdKoY3I.js} +1 -1
- package/dist/contacts/p-a3082900.entry.js +1 -0
- package/dist/contacts/{p-1d26260f.entry.js → p-a629ae72.entry.js} +1 -1
- package/dist/contacts/{p-67acd5f1.entry.js → p-a9d03996.entry.js} +1 -1
- package/dist/contacts/{p-a98a5bbc.entry.js → p-ae43e046.entry.js} +1 -1
- package/dist/contacts/{p-a7162c9d.entry.js → p-c306d8ca.entry.js} +1 -1
- package/dist/contacts/{p-1c438065.entry.js → p-c4a1c42a.entry.js} +1 -1
- package/dist/contacts/{p-fe469d93.entry.js → p-c89722f1.entry.js} +1 -1
- package/dist/contacts/{p-04958ea3.entry.js → p-ce6b4a9a.entry.js} +1 -1
- package/dist/contacts/{p-8bfd4d17.entry.js → p-d510fa6c.entry.js} +12 -3
- package/dist/contacts/{p-be6f3b82.entry.js → p-ecf8719a.entry.js} +1 -1
- package/dist/contacts/{p-934f49b1.entry.js → p-f8517ff2.entry.js} +1 -1
- package/dist/esm/{chunk.5JY5FUCG-BOo64hgz.js → chunk.5JY5FUCG-B58l5Mdn.js} +2 -2
- package/dist/esm/{chunk.HVTXQL7M-D4GE2ek9.js → chunk.HVTXQL7M-DXJDg6h_.js} +4 -4
- package/dist/esm/{chunk.URTPIBTY-DtWmW4Pb.js → chunk.URTPIBTY-C1YI_wtI.js} +3 -3
- package/dist/esm/{chunk.XQ2OKYYA-Cgug_yvW.js → chunk.XQ2OKYYA-B0surOUs.js} +4 -4
- package/dist/esm/{chunk.YHLNUJ7P-CGClYowr.js → chunk.YHLNUJ7P-B10Qbx9i.js} +1 -1
- package/dist/esm/chunk.ZGGPD2XJ-CxH68zCl.js +3 -0
- package/dist/esm/{class-map-CuxcTjQ5.js → class-map-DcKoKhP0.js} +1 -1
- package/dist/esm/contacts.js +3 -3
- package/dist/esm/{if-defined-1V1UljxT.js → if-defined-TtuUo8or.js} +1 -1
- package/dist/esm/{index-DFqG64hG.js → index-D-Cg1uHv.js} +2 -2
- package/dist/esm/{index-DlhTPhZx.js → index-D4tjvI9D.js} +1 -1
- package/dist/esm/{index-_4aU9NfA.js → index-DScSUBy-.js} +546 -2000
- package/dist/esm/{jsonld-V2RB47OZ-CaIJ08AA.js → jsonld-V2RB47OZ-BA1jAPl4.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/pos-add-literal-value_3.entry.js +8 -8
- package/dist/esm/pos-add-new-thing_7.entry.js +9 -9
- package/dist/esm/pos-app-browser.entry.js +2 -2
- package/dist/esm/pos-app-dashboard_6.entry.js +5 -5
- package/dist/esm/pos-app-document-viewer.entry.js +1 -1
- package/dist/esm/pos-app-generic.entry.js +1 -1
- package/dist/esm/pos-app-image-viewer.entry.js +1 -1
- package/dist/esm/pos-app-ldp-container.entry.js +1 -1
- package/dist/esm/pos-app-rdf-document.entry.js +1 -1
- package/dist/esm/pos-app_24.entry.js +309 -178
- package/dist/esm/pos-attachments.entry.js +2 -2
- package/dist/esm/pos-container-contents.entry.js +2 -2
- package/dist/esm/pos-container-item_3.entry.js +6 -6
- package/dist/esm/pos-description_2.entry.js +1 -1
- package/dist/esm/pos-document.entry.js +6 -6
- package/dist/esm/pos-list.entry.js +1 -1
- package/dist/esm/pos-make-findable_2.entry.js +9 -9
- package/dist/esm/pos-markdown-document.entry.js +443 -2328
- package/dist/esm/pos-new-thing-form.entry.js +1 -1
- package/dist/esm/pos-predicate.entry.js +6 -6
- package/dist/esm/pos-relations_2.entry.js +1 -1
- package/dist/esm/pos-select-term.entry.js +1 -1
- package/dist/esm/pos-subjects.entry.js +2 -2
- package/dist/esm/pos-tool-attachments.entry.js +1 -1
- package/dist/esm/pos-tool-select.entry.js +4 -4
- package/dist/esm/pos-value.entry.js +1 -1
- package/dist/esm/{session-dNJIwSOx.js → session-CtUoUtdF.js} +1 -1
- package/dist/esm/{settings-B396TU1j.js → settings-Cnw1mSJw.js} +1 -1
- package/dist/types/components.d.ts +47 -22
- package/dist/types/stencil-public-runtime.d.ts +52 -2
- package/package.json +1 -1
- package/dist/cjs/chunk.ZGGPD2XJ-D0JTxaR_.js +0 -5
- package/dist/contacts/p-34745d30.entry.js +0 -1
- package/dist/contacts/p-40c74195.entry.js +0 -1
- package/dist/contacts/p-4b083d14.entry.js +0 -1
- package/dist/contacts/p-734b1a7b.entry.js +0 -1
- package/dist/contacts/p-CbjulEge.js +0 -1
- package/dist/contacts/p-D6s4RlTY.js +0 -1
- package/dist/contacts/p-LoCE14bN.js +0 -67
- package/dist/contacts/p-_4aU9NfA.js +0 -2
- package/dist/contacts/p-c5e66c2d.entry.js +0 -1
- package/dist/contacts/p-c614a152.entry.js +0 -1
- package/dist/contacts/p-ffZsjcF5.js +0 -11
- package/dist/esm/chunk.ZGGPD2XJ-BfEMOYfC.js +0 -3
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$2 = require('./index-
|
|
4
|
-
var session = require('./session-
|
|
5
|
-
var settings = require('./settings-
|
|
6
|
-
var index = require('./index-
|
|
3
|
+
var index$2 = require('./index-DdRXU5II.js');
|
|
4
|
+
var session = require('./session-kBhmup9r.js');
|
|
5
|
+
var settings = require('./settings-CpwCCkhx.js');
|
|
6
|
+
var index = require('./index-D1Wk2cIF.js');
|
|
7
7
|
var index$1 = require('./index-DlHQ3blV.js');
|
|
8
|
-
var chunk_YHLNUJ7P = require('./chunk.YHLNUJ7P-
|
|
8
|
+
var chunk_YHLNUJ7P = require('./chunk.YHLNUJ7P-CoQhYOM2.js');
|
|
9
9
|
var chunk_6CTB5ZDJ = require('./chunk.6CTB5ZDJ-CC8k6o5T.js');
|
|
10
|
-
var classMap = require('./class-map-
|
|
11
|
-
var ifDefined = require('./if-defined-
|
|
12
|
-
require('./chunk.ZGGPD2XJ-
|
|
13
|
-
var index$3 = require('./index-
|
|
14
|
-
var chunk_XQ2OKYYA = require('./chunk.XQ2OKYYA-
|
|
10
|
+
var classMap = require('./class-map-CyEFRZYn.js');
|
|
11
|
+
var ifDefined = require('./if-defined-TQmAS6tz.js');
|
|
12
|
+
require('./chunk.ZGGPD2XJ-C--tZiyf.js');
|
|
13
|
+
var index$3 = require('./index-CpATWk39.js');
|
|
14
|
+
var chunk_XQ2OKYYA = require('./chunk.XQ2OKYYA-CDJtWcvs.js');
|
|
15
15
|
var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
|
|
16
16
|
var usePodOS$1 = require('./usePodOS-BnFzjtlx.js');
|
|
17
17
|
var PodOsAware = require('./PodOsAware-_Lsp4KsV.js');
|
|
@@ -3386,7 +3386,7 @@ const OpenAddressBook = class {
|
|
|
3386
3386
|
}
|
|
3387
3387
|
disconnectedCallback() {
|
|
3388
3388
|
this.disconnected$.next();
|
|
3389
|
-
this.disconnected$.
|
|
3389
|
+
this.disconnected$.complete();
|
|
3390
3390
|
}
|
|
3391
3391
|
openFromLink(event) {
|
|
3392
3392
|
this.openAddressBook.emit(event.detail);
|
|
@@ -3399,7 +3399,7 @@ const OpenAddressBook = class {
|
|
|
3399
3399
|
}
|
|
3400
3400
|
render() {
|
|
3401
3401
|
var _a;
|
|
3402
|
-
return (index$2.h("div", { key: '
|
|
3402
|
+
return (index$2.h("div", { key: 'ae7b01a87f8df061fc45a525b9555059d6268f6d', id: "container" }, ((_a = this.sessionInfo) === null || _a === void 0 ? void 0 : _a.isLoggedIn) ? (index$2.h("pos-contacts-list-address-books", { webId: this.sessionInfo.webId })) : (index$2.h("div", { id: "sign-in" }, index$2.h("pos-login", null), "Sign in to list your address books.")), index$2.h("button", { key: '075716e48f7cf098ee5e118ab8ebe4dce3cbaec2', title: "open any other address book by it's URI", class: "open", onClick: () => this.promptAndOpen() }, index$2.h("sl-icon", { key: '34bdda19c00947faf3beb46da700127152d18286', name: "folder2-open" }), "open other")));
|
|
3403
3403
|
}
|
|
3404
3404
|
get el() { return index$2.getElement(this); }
|
|
3405
3405
|
};
|
|
@@ -8086,7 +8086,7 @@ class ThumbnailGenerator extends UIPlugin {
|
|
|
8086
8086
|
}
|
|
8087
8087
|
}
|
|
8088
8088
|
|
|
8089
|
-
const version$2 = "5.1.
|
|
8089
|
+
const version$2 = "5.1.1";
|
|
8090
8090
|
var packageJson$2 = {
|
|
8091
8091
|
version: version$2};
|
|
8092
8092
|
|
|
@@ -10660,8 +10660,8 @@ class Dashboard extends UIPlugin {
|
|
|
10660
10660
|
this.uppy.off('complete', this.handleComplete);
|
|
10661
10661
|
this.uppy.off('files-added', this.#generateLargeThumbnailIfSingleFile);
|
|
10662
10662
|
this.uppy.off('file-removed', this.#generateLargeThumbnailIfSingleFile);
|
|
10663
|
-
document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently);
|
|
10664
|
-
document.removeEventListener('click', this.recordIfFocusedOnUppyRecently);
|
|
10663
|
+
document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently, true);
|
|
10664
|
+
document.removeEventListener('click', this.recordIfFocusedOnUppyRecently, true);
|
|
10665
10665
|
if (this.opts.inline) {
|
|
10666
10666
|
this.el.removeEventListener('keydown', this.handleKeyDownInInline);
|
|
10667
10667
|
}
|
|
@@ -10978,10 +10978,6 @@ class Dashboard extends UIPlugin {
|
|
|
10978
10978
|
};
|
|
10979
10979
|
}
|
|
10980
10980
|
|
|
10981
|
-
const version$1 = "4.1.0";
|
|
10982
|
-
var packageJson$1 = {
|
|
10983
|
-
version: version$1};
|
|
10984
|
-
|
|
10985
10981
|
var cropper$1 = {exports: {}};
|
|
10986
10982
|
|
|
10987
10983
|
/*!
|
|
@@ -14268,6 +14264,87 @@ function requireCropper () {
|
|
|
14268
14264
|
var cropperExports = requireCropper();
|
|
14269
14265
|
var Cropper = /*@__PURE__*/getDefaultExportFromCjs(cropperExports);
|
|
14270
14266
|
|
|
14267
|
+
const version$1 = "4.2.0";
|
|
14268
|
+
var packageJson$1 = {
|
|
14269
|
+
version: version$1};
|
|
14270
|
+
|
|
14271
|
+
class Editor extends x {
|
|
14272
|
+
imgElement;
|
|
14273
|
+
componentDidMount() {
|
|
14274
|
+
const { initCropper } = this.props;
|
|
14275
|
+
if (this.imgElement) {
|
|
14276
|
+
initCropper(this.imgElement);
|
|
14277
|
+
}
|
|
14278
|
+
}
|
|
14279
|
+
onRotate90Deg = () => {
|
|
14280
|
+
this.props.rotateBy(-90);
|
|
14281
|
+
};
|
|
14282
|
+
onRotateGranular = (ev) => {
|
|
14283
|
+
const newGranularAngle = Number(ev.target.value);
|
|
14284
|
+
this.props.rotateGranular(newGranularAngle);
|
|
14285
|
+
};
|
|
14286
|
+
renderGranularRotate() {
|
|
14287
|
+
const { i18n } = this.props;
|
|
14288
|
+
const { angleGranular } = this.props;
|
|
14289
|
+
return (u$2("label", { role: "tooltip", "aria-label": `${angleGranular}º`, "data-microtip-position": "top", className: "uppy-ImageCropper-rangeWrapper", children: u$2("input", { className: "uppy-ImageCropper-range uppy-u-reset", type: "range", onInput: this.onRotateGranular, onChange: this.onRotateGranular, value: angleGranular, min: "-45", max: "45", "aria-label": i18n('rotate') }) }));
|
|
14290
|
+
}
|
|
14291
|
+
renderRevert() {
|
|
14292
|
+
const { i18n } = this.props;
|
|
14293
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
|
|
14294
|
+
this.props.reset();
|
|
14295
|
+
}, children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0z", fill: "none" }), u$2("path", { d: "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z" })] }) }));
|
|
14296
|
+
}
|
|
14297
|
+
renderRotate() {
|
|
14298
|
+
const { i18n } = this.props;
|
|
14299
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('rotate'), onClick: this.onRotate90Deg, children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0V0zm0 0h24v24H0V0z", fill: "none" }), u$2("path", { d: "M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z" })] }) }));
|
|
14300
|
+
}
|
|
14301
|
+
renderFlip() {
|
|
14302
|
+
const { i18n } = this.props;
|
|
14303
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('flipHorizontal'), onClick: () => this.props.flipHorizontal(), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0z", fill: "none" }), u$2("path", { d: "M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z" })] }) }));
|
|
14304
|
+
}
|
|
14305
|
+
renderZoomIn() {
|
|
14306
|
+
const { i18n } = this.props;
|
|
14307
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('zoomIn'), onClick: () => this.props.zoom(0.1), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", height: "24", viewBox: "0 0 24 24", width: "24", children: [u$2("path", { d: "M0 0h24v24H0V0z", fill: "none" }), u$2("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" }), u$2("path", { d: "M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z" })] }) }));
|
|
14308
|
+
}
|
|
14309
|
+
renderZoomOut() {
|
|
14310
|
+
const { i18n } = this.props;
|
|
14311
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('zoomOut'), onClick: () => this.props.zoom(-0.1), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0V0z", fill: "none" }), u$2("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z" })] }) }));
|
|
14312
|
+
}
|
|
14313
|
+
renderCropSquare() {
|
|
14314
|
+
const { i18n } = this.props;
|
|
14315
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('aspectRatioSquare'), onClick: () => this.props.setAspectRatio('1:1'), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0z", fill: "none" }), u$2("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })] }) }));
|
|
14316
|
+
}
|
|
14317
|
+
renderCropWidescreen() {
|
|
14318
|
+
const { i18n } = this.props;
|
|
14319
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('aspectRatioLandscape'), onClick: () => this.props.setAspectRatio('16:9'), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z" }), u$2("path", { fill: "none", d: "M0 0h24v24H0z" })] }) }));
|
|
14320
|
+
}
|
|
14321
|
+
renderCropWidescreenVertical() {
|
|
14322
|
+
const { i18n } = this.props;
|
|
14323
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", "aria-label": i18n('aspectRatioPortrait'), className: "uppy-u-reset uppy-c-btn", onClick: () => this.props.setAspectRatio('9:16'), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z" }), u$2("path", { d: "M0 0h24v24H0z", fill: "none" })] }) }));
|
|
14324
|
+
}
|
|
14325
|
+
render() {
|
|
14326
|
+
const { currentImage, objectUrl, opts } = this.props;
|
|
14327
|
+
const { actions } = opts;
|
|
14328
|
+
return (u$2("div", { className: "uppy-ImageCropper", children: [u$2("div", { className: "uppy-ImageCropper-container", children: u$2("img", { className: "uppy-ImageCropper-image", alt: currentImage.name, src: objectUrl, ref: (ref) => {
|
|
14329
|
+
this.imgElement = ref;
|
|
14330
|
+
} }) }), u$2("div", { className: "uppy-ImageCropper-controls", children: [actions.revert && this.renderRevert(), actions.rotate && this.renderRotate(), actions.granularRotate && this.renderGranularRotate(), actions.flip && this.renderFlip(), actions.zoomIn && this.renderZoomIn(), actions.zoomOut && this.renderZoomOut(), actions.cropSquare && this.renderCropSquare(), actions.cropWidescreen && this.renderCropWidescreen(), actions.cropWidescreenVertical &&
|
|
14331
|
+
this.renderCropWidescreenVertical()] })] }));
|
|
14332
|
+
}
|
|
14333
|
+
}
|
|
14334
|
+
|
|
14335
|
+
var locale$1 = {
|
|
14336
|
+
strings: {
|
|
14337
|
+
revert: 'Reset',
|
|
14338
|
+
rotate: 'Rotate 90°',
|
|
14339
|
+
zoomIn: 'Zoom in',
|
|
14340
|
+
zoomOut: 'Zoom out',
|
|
14341
|
+
flipHorizontal: 'Flip horizontally',
|
|
14342
|
+
aspectRatioSquare: 'Crop square',
|
|
14343
|
+
aspectRatioLandscape: 'Crop landscape (16:9)',
|
|
14344
|
+
aspectRatioPortrait: 'Crop portrait (9:16)',
|
|
14345
|
+
},
|
|
14346
|
+
};
|
|
14347
|
+
|
|
14271
14348
|
// See this cropperjs image to understand how container/image/canavas/cropbox relate to each other.
|
|
14272
14349
|
// (https://github.com/fengyuanchen/cropperjs/blob/9b528a8baeaae876dc090085e37992a1683c6f34/docs/images/layers.jpg)
|
|
14273
14350
|
//
|
|
@@ -14362,155 +14439,13 @@ function limitCropboxMovementOnResize(canvas, cropboxData, prevCropbox) {
|
|
|
14362
14439
|
return null;
|
|
14363
14440
|
}
|
|
14364
14441
|
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
|
|
14370
|
-
|
|
14371
|
-
angle90Deg: 0,
|
|
14372
|
-
angleGranular: 0,
|
|
14373
|
-
prevCropboxData: null,
|
|
14374
|
-
};
|
|
14375
|
-
this.storePrevCropboxData = this.storePrevCropboxData.bind(this);
|
|
14376
|
-
this.limitCropboxMovement = this.limitCropboxMovement.bind(this);
|
|
14377
|
-
}
|
|
14378
|
-
componentDidMount() {
|
|
14379
|
-
const { opts, storeCropperInstance } = this.props;
|
|
14380
|
-
this.cropper = new Cropper(this.imgElement, opts.cropperOptions);
|
|
14381
|
-
this.imgElement.addEventListener('cropstart', this.storePrevCropboxData);
|
|
14382
|
-
// @ts-expect-error custom cropper event but DOM API does not understand
|
|
14383
|
-
this.imgElement.addEventListener('cropend', this.limitCropboxMovement);
|
|
14384
|
-
storeCropperInstance(this.cropper);
|
|
14385
|
-
}
|
|
14386
|
-
componentWillUnmount() {
|
|
14387
|
-
this.cropper.destroy();
|
|
14388
|
-
this.imgElement.removeEventListener('cropstart', this.storePrevCropboxData);
|
|
14389
|
-
// @ts-expect-error custom cropper event but DOM API does not understand
|
|
14390
|
-
this.imgElement.removeEventListener('cropend', this.limitCropboxMovement);
|
|
14391
|
-
}
|
|
14392
|
-
storePrevCropboxData() {
|
|
14393
|
-
this.setState({ prevCropboxData: this.cropper.getCropBoxData() });
|
|
14394
|
-
}
|
|
14395
|
-
limitCropboxMovement(event) {
|
|
14396
|
-
const canvasData = this.cropper.getCanvasData();
|
|
14397
|
-
const cropboxData = this.cropper.getCropBoxData();
|
|
14398
|
-
const { prevCropboxData } = this.state;
|
|
14399
|
-
// 1. When we grab the cropbox in the middle and move it
|
|
14400
|
-
if (event.detail.action === 'all') {
|
|
14401
|
-
const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, prevCropboxData);
|
|
14402
|
-
if (newCropboxData)
|
|
14403
|
-
this.cropper.setCropBoxData(newCropboxData);
|
|
14404
|
-
// 2. When we stretch the cropbox by one of its sides
|
|
14405
|
-
}
|
|
14406
|
-
else {
|
|
14407
|
-
const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, prevCropboxData);
|
|
14408
|
-
if (newCropboxData)
|
|
14409
|
-
this.cropper.setCropBoxData(newCropboxData);
|
|
14410
|
-
}
|
|
14411
|
-
}
|
|
14412
|
-
onRotate90Deg = () => {
|
|
14413
|
-
// 1. Set state
|
|
14414
|
-
const { angle90Deg } = this.state;
|
|
14415
|
-
const newAngle = angle90Deg - 90;
|
|
14416
|
-
this.setState({
|
|
14417
|
-
angle90Deg: newAngle,
|
|
14418
|
-
angleGranular: 0,
|
|
14419
|
-
});
|
|
14420
|
-
// 2. Rotate the image
|
|
14421
|
-
// Important to reset scale here, or cropper will get confused on further rotations
|
|
14422
|
-
this.cropper.scale(1);
|
|
14423
|
-
this.cropper.rotateTo(newAngle);
|
|
14424
|
-
// 3. Fit the rotated image into the view
|
|
14425
|
-
const canvasData = this.cropper.getCanvasData();
|
|
14426
|
-
const containerData = this.cropper.getContainerData();
|
|
14427
|
-
const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
|
|
14428
|
-
this.cropper.setCanvasData(newCanvasData);
|
|
14429
|
-
// 4. Make cropbox fully wrap the image
|
|
14430
|
-
this.cropper.setCropBoxData(newCanvasData);
|
|
14431
|
-
};
|
|
14432
|
-
onRotateGranular = (ev) => {
|
|
14433
|
-
// 1. Set state
|
|
14434
|
-
const newGranularAngle = Number(ev.target.value);
|
|
14435
|
-
this.setState({ angleGranular: newGranularAngle });
|
|
14436
|
-
// 2. Rotate the image
|
|
14437
|
-
const { angle90Deg } = this.state;
|
|
14438
|
-
const newAngle = angle90Deg + newGranularAngle;
|
|
14439
|
-
this.cropper.rotateTo(newAngle);
|
|
14440
|
-
// 3. Scale the image so that it fits into the cropbox
|
|
14441
|
-
const image = this.cropper.getImageData();
|
|
14442
|
-
const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, newGranularAngle);
|
|
14443
|
-
// Preserve flip
|
|
14444
|
-
const scaleFactorX = this.cropper.getImageData().scaleX < 0 ? -scaleFactor : scaleFactor;
|
|
14445
|
-
this.cropper.scale(scaleFactorX, scaleFactor);
|
|
14446
|
-
};
|
|
14447
|
-
renderGranularRotate() {
|
|
14448
|
-
const { i18n } = this.props;
|
|
14449
|
-
const { angleGranular } = this.state;
|
|
14450
|
-
return (u$2("label", { role: "tooltip", "aria-label": `${angleGranular}º`, "data-microtip-position": "top", className: "uppy-ImageCropper-rangeWrapper", children: u$2("input", { className: "uppy-ImageCropper-range uppy-u-reset", type: "range", onInput: this.onRotateGranular, onChange: this.onRotateGranular, value: angleGranular, min: "-45", max: "45", "aria-label": i18n('rotate') }) }));
|
|
14451
|
-
}
|
|
14452
|
-
renderRevert() {
|
|
14453
|
-
const { i18n, opts } = this.props;
|
|
14454
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
|
|
14455
|
-
this.cropper.reset();
|
|
14456
|
-
this.cropper.setAspectRatio(opts.cropperOptions.initialAspectRatio);
|
|
14457
|
-
this.setState({ angle90Deg: 0, angleGranular: 0 });
|
|
14458
|
-
}, children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0z", fill: "none" }), u$2("path", { d: "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z" })] }) }));
|
|
14459
|
-
}
|
|
14460
|
-
renderRotate() {
|
|
14461
|
-
const { i18n } = this.props;
|
|
14462
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('rotate'), onClick: this.onRotate90Deg, children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0V0zm0 0h24v24H0V0z", fill: "none" }), u$2("path", { d: "M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z" })] }) }));
|
|
14463
|
-
}
|
|
14464
|
-
renderFlip() {
|
|
14465
|
-
const { i18n } = this.props;
|
|
14466
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('flipHorizontal'), onClick: () => this.cropper.scaleX(-this.cropper.getData().scaleX || -1), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0z", fill: "none" }), u$2("path", { d: "M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z" })] }) }));
|
|
14467
|
-
}
|
|
14468
|
-
renderZoomIn() {
|
|
14469
|
-
const { i18n } = this.props;
|
|
14470
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('zoomIn'), onClick: () => this.cropper.zoom(0.1), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", height: "24", viewBox: "0 0 24 24", width: "24", children: [u$2("path", { d: "M0 0h24v24H0V0z", fill: "none" }), u$2("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" }), u$2("path", { d: "M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z" })] }) }));
|
|
14471
|
-
}
|
|
14472
|
-
renderZoomOut() {
|
|
14473
|
-
const { i18n } = this.props;
|
|
14474
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('zoomOut'), onClick: () => this.cropper.zoom(-0.1), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0V0z", fill: "none" }), u$2("path", { d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z" })] }) }));
|
|
14475
|
-
}
|
|
14476
|
-
renderCropSquare() {
|
|
14477
|
-
const { i18n } = this.props;
|
|
14478
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('aspectRatioSquare'), onClick: () => this.cropper.setAspectRatio(1), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M0 0h24v24H0z", fill: "none" }), u$2("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })] }) }));
|
|
14479
|
-
}
|
|
14480
|
-
renderCropWidescreen() {
|
|
14481
|
-
const { i18n } = this.props;
|
|
14482
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('aspectRatioLandscape'), onClick: () => this.cropper.setAspectRatio(16 / 9), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z" }), u$2("path", { fill: "none", d: "M0 0h24v24H0z" })] }) }));
|
|
14483
|
-
}
|
|
14484
|
-
renderCropWidescreenVertical() {
|
|
14485
|
-
const { i18n } = this.props;
|
|
14486
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", "aria-label": i18n('aspectRatioPortrait'), className: "uppy-u-reset uppy-c-btn", onClick: () => this.cropper.setAspectRatio(9 / 16), children: u$2("svg", { "aria-hidden": "true", className: "uppy-c-icon", width: "24", height: "24", viewBox: "0 0 24 24", children: [u$2("path", { d: "M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z" }), u$2("path", { d: "M0 0h24v24H0z", fill: "none" })] }) }));
|
|
14487
|
-
}
|
|
14488
|
-
render() {
|
|
14489
|
-
const { currentImage, opts } = this.props;
|
|
14490
|
-
const { actions } = opts;
|
|
14491
|
-
if (currentImage.data == null)
|
|
14492
|
-
throw new Error('File data is empty');
|
|
14493
|
-
const imageURL = URL.createObjectURL(currentImage.data);
|
|
14494
|
-
return (u$2("div", { className: "uppy-ImageCropper", children: [u$2("div", { className: "uppy-ImageCropper-container", children: u$2("img", { className: "uppy-ImageCropper-image", alt: currentImage.name, src: imageURL, ref: (ref) => {
|
|
14495
|
-
this.imgElement = ref;
|
|
14496
|
-
} }) }), u$2("div", { className: "uppy-ImageCropper-controls", children: [actions.revert && this.renderRevert(), actions.rotate && this.renderRotate(), actions.granularRotate && this.renderGranularRotate(), actions.flip && this.renderFlip(), actions.zoomIn && this.renderZoomIn(), actions.zoomOut && this.renderZoomOut(), actions.cropSquare && this.renderCropSquare(), actions.cropWidescreen && this.renderCropWidescreen(), actions.cropWidescreenVertical &&
|
|
14497
|
-
this.renderCropWidescreenVertical()] })] }));
|
|
14498
|
-
}
|
|
14499
|
-
}
|
|
14500
|
-
|
|
14501
|
-
var locale$1 = {
|
|
14502
|
-
strings: {
|
|
14503
|
-
revert: 'Reset',
|
|
14504
|
-
rotate: 'Rotate 90°',
|
|
14505
|
-
zoomIn: 'Zoom in',
|
|
14506
|
-
zoomOut: 'Zoom out',
|
|
14507
|
-
flipHorizontal: 'Flip horizontally',
|
|
14508
|
-
aspectRatioSquare: 'Crop square',
|
|
14509
|
-
aspectRatioLandscape: 'Crop landscape (16:9)',
|
|
14510
|
-
aspectRatioPortrait: 'Crop portrait (9:16)',
|
|
14511
|
-
},
|
|
14442
|
+
const defaultEditorState = {
|
|
14443
|
+
angle: 0,
|
|
14444
|
+
angleGranular: 0,
|
|
14445
|
+
isFlippedHorizontally: false,
|
|
14446
|
+
aspectRatio: 'free',
|
|
14447
|
+
cropperReady: false,
|
|
14512
14448
|
};
|
|
14513
|
-
|
|
14514
14449
|
const defaultCropperOptions = {
|
|
14515
14450
|
viewMode: 0,
|
|
14516
14451
|
background: false,
|
|
@@ -14541,7 +14476,13 @@ const defaultOptions$1 = {
|
|
|
14541
14476
|
};
|
|
14542
14477
|
class ImageEditor extends UIPlugin {
|
|
14543
14478
|
static VERSION = packageJson$1.version;
|
|
14544
|
-
cropper;
|
|
14479
|
+
cropper = null;
|
|
14480
|
+
objectUrl = null;
|
|
14481
|
+
prevCropboxData = null;
|
|
14482
|
+
imgElement = null;
|
|
14483
|
+
cropstartHandler = null;
|
|
14484
|
+
cropendHandler = null;
|
|
14485
|
+
cropperReadyHandler = null;
|
|
14545
14486
|
constructor(uppy, opts) {
|
|
14546
14487
|
super(uppy, {
|
|
14547
14488
|
...defaultOptions$1,
|
|
@@ -14572,9 +14513,18 @@ class ImageEditor extends UIPlugin {
|
|
|
14572
14513
|
return false;
|
|
14573
14514
|
}
|
|
14574
14515
|
save = () => {
|
|
14516
|
+
const { currentImage } = this.getPluginState();
|
|
14517
|
+
if (!currentImage)
|
|
14518
|
+
return;
|
|
14519
|
+
if (!this.cropper)
|
|
14520
|
+
return;
|
|
14575
14521
|
const saveBlobCallback = (blob) => {
|
|
14576
|
-
|
|
14577
|
-
|
|
14522
|
+
if (!blob)
|
|
14523
|
+
return;
|
|
14524
|
+
const fileId = currentImage.id;
|
|
14525
|
+
if (!this.uppy.getFile(fileId))
|
|
14526
|
+
return;
|
|
14527
|
+
this.uppy.setFileState(fileId, {
|
|
14578
14528
|
// Reinserting image's name and type, because .toBlob loses both.
|
|
14579
14529
|
data: new File([blob], currentImage.name ?? this.i18n('unnamed'), {
|
|
14580
14530
|
type: blob.type,
|
|
@@ -14582,14 +14532,15 @@ class ImageEditor extends UIPlugin {
|
|
|
14582
14532
|
size: blob.size,
|
|
14583
14533
|
preview: undefined,
|
|
14584
14534
|
});
|
|
14585
|
-
const updatedFile = this.uppy.getFile(
|
|
14535
|
+
const updatedFile = this.uppy.getFile(fileId);
|
|
14536
|
+
if (!updatedFile)
|
|
14537
|
+
return;
|
|
14586
14538
|
this.uppy.emit('thumbnail:request', updatedFile);
|
|
14587
14539
|
this.setPluginState({
|
|
14588
14540
|
currentImage: updatedFile,
|
|
14589
14541
|
});
|
|
14590
14542
|
this.uppy.emit('file-editor:complete', updatedFile);
|
|
14591
14543
|
};
|
|
14592
|
-
const { currentImage } = this.getPluginState();
|
|
14593
14544
|
// Fixes black 1px lines on odd-width images.
|
|
14594
14545
|
// This should be removed when cropperjs fixes this issue.
|
|
14595
14546
|
// (See https://github.com/transloadit/uppy/issues/4305 and https://github.com/fengyuanchen/cropperjs/issues/551).
|
|
@@ -14608,15 +14559,194 @@ class ImageEditor extends UIPlugin {
|
|
|
14608
14559
|
this.cropper = cropper;
|
|
14609
14560
|
};
|
|
14610
14561
|
selectFile = (file) => {
|
|
14611
|
-
this.
|
|
14562
|
+
this.start(file);
|
|
14563
|
+
};
|
|
14564
|
+
resetEditorState = (currentImage = this.getPluginState().currentImage) => {
|
|
14612
14565
|
this.setPluginState({
|
|
14613
|
-
currentImage
|
|
14566
|
+
currentImage,
|
|
14567
|
+
...defaultEditorState,
|
|
14568
|
+
// Preserve cropperReady if cropper instance exists
|
|
14569
|
+
cropperReady: !!this.cropper,
|
|
14614
14570
|
});
|
|
14615
14571
|
};
|
|
14616
|
-
|
|
14572
|
+
rotateBy = (degrees) => {
|
|
14573
|
+
if (!this.cropper)
|
|
14574
|
+
return;
|
|
14575
|
+
const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
|
|
14576
|
+
const base90 = angle - angleGranular;
|
|
14577
|
+
const newAngle = base90 + degrees;
|
|
14578
|
+
this.cropper.scale(isFlippedHorizontally ? -1 : 1);
|
|
14579
|
+
this.cropper.rotateTo(newAngle);
|
|
14580
|
+
const canvasData = this.cropper.getCanvasData();
|
|
14581
|
+
const containerData = this.cropper.getContainerData();
|
|
14582
|
+
const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
|
|
14583
|
+
this.cropper.setCanvasData(newCanvasData);
|
|
14584
|
+
this.cropper.setCropBoxData(newCanvasData);
|
|
14585
|
+
this.setPluginState({
|
|
14586
|
+
angle: newAngle,
|
|
14587
|
+
angleGranular: 0,
|
|
14588
|
+
});
|
|
14589
|
+
};
|
|
14590
|
+
rotateGranular = (granularAngle) => {
|
|
14591
|
+
if (!this.cropper)
|
|
14592
|
+
return;
|
|
14593
|
+
const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
|
|
14594
|
+
const base90 = angle - angleGranular;
|
|
14595
|
+
const newAngle = base90 + granularAngle;
|
|
14596
|
+
this.cropper.rotateTo(newAngle);
|
|
14597
|
+
const image = this.cropper.getImageData();
|
|
14598
|
+
const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, granularAngle);
|
|
14599
|
+
const scaleFactorX = isFlippedHorizontally ? -scaleFactor : scaleFactor;
|
|
14600
|
+
this.cropper.scale(scaleFactorX, scaleFactor);
|
|
14617
14601
|
this.setPluginState({
|
|
14618
|
-
|
|
14602
|
+
angle: newAngle,
|
|
14603
|
+
angleGranular: granularAngle,
|
|
14604
|
+
});
|
|
14605
|
+
};
|
|
14606
|
+
flipHorizontal = () => {
|
|
14607
|
+
if (!this.cropper)
|
|
14608
|
+
return;
|
|
14609
|
+
const { isFlippedHorizontally } = this.getPluginState();
|
|
14610
|
+
this.cropper.scaleX(-this.cropper.getData().scaleX || -1);
|
|
14611
|
+
this.setPluginState({
|
|
14612
|
+
isFlippedHorizontally: !isFlippedHorizontally,
|
|
14613
|
+
});
|
|
14614
|
+
};
|
|
14615
|
+
zoom = (ratio) => {
|
|
14616
|
+
if (!this.cropper)
|
|
14617
|
+
return;
|
|
14618
|
+
this.cropper.zoom(ratio);
|
|
14619
|
+
};
|
|
14620
|
+
setAspectRatio = (newRatio) => {
|
|
14621
|
+
if (!this.cropper)
|
|
14622
|
+
return;
|
|
14623
|
+
const ratioMap = {
|
|
14624
|
+
free: 0,
|
|
14625
|
+
'1:1': 1,
|
|
14626
|
+
'16:9': 16 / 9,
|
|
14627
|
+
'9:16': 9 / 16,
|
|
14628
|
+
};
|
|
14629
|
+
this.cropper.setAspectRatio(ratioMap[newRatio]);
|
|
14630
|
+
this.setPluginState({
|
|
14631
|
+
aspectRatio: newRatio,
|
|
14632
|
+
});
|
|
14633
|
+
};
|
|
14634
|
+
reset = () => {
|
|
14635
|
+
if (!this.cropper)
|
|
14636
|
+
return;
|
|
14637
|
+
this.cropper.reset();
|
|
14638
|
+
this.cropper.setAspectRatio(this.opts.cropperOptions.initialAspectRatio || 0);
|
|
14639
|
+
this.resetEditorState();
|
|
14640
|
+
};
|
|
14641
|
+
/**
|
|
14642
|
+
* Start editing a file - creates object URL and prepares state.
|
|
14643
|
+
* Called by hook's start() or when user opens editor.
|
|
14644
|
+
*/
|
|
14645
|
+
start = (file) => {
|
|
14646
|
+
// Clean up any previous editing session
|
|
14647
|
+
if (this.objectUrl) {
|
|
14648
|
+
URL.revokeObjectURL(this.objectUrl);
|
|
14649
|
+
this.objectUrl = null;
|
|
14650
|
+
}
|
|
14651
|
+
// Get file data - first try the passed file, then try fetching from Uppy state
|
|
14652
|
+
let fileData = file.data;
|
|
14653
|
+
if (!(fileData instanceof Blob)) {
|
|
14654
|
+
const uppyFile = this.uppy.getFile(file.id);
|
|
14655
|
+
fileData = uppyFile?.data;
|
|
14656
|
+
}
|
|
14657
|
+
if (fileData instanceof Blob) {
|
|
14658
|
+
this.objectUrl = URL.createObjectURL(fileData);
|
|
14659
|
+
}
|
|
14660
|
+
else {
|
|
14661
|
+
// eslint-disable-next-line no-console
|
|
14662
|
+
console.warn('[Uppy ImageEditor] Cannot edit file: file.data is not a Blob.', 'File:', file, 'file.data:', file.data, 'typeof file.data:', typeof file.data);
|
|
14663
|
+
}
|
|
14664
|
+
this.uppy.emit('file-editor:start', file);
|
|
14665
|
+
this.resetEditorState(file);
|
|
14666
|
+
};
|
|
14667
|
+
/**
|
|
14668
|
+
* Stop editing - destroys cropper, revokes object URL, cleans up listeners.
|
|
14669
|
+
*/
|
|
14670
|
+
stop = () => {
|
|
14671
|
+
this.destroyCropper();
|
|
14672
|
+
if (this.objectUrl) {
|
|
14673
|
+
URL.revokeObjectURL(this.objectUrl);
|
|
14674
|
+
this.objectUrl = null;
|
|
14675
|
+
}
|
|
14676
|
+
this.resetEditorState(null);
|
|
14677
|
+
};
|
|
14678
|
+
/**
|
|
14679
|
+
* Initialize cropper on the image element. Called lazily when first edit action is triggered.
|
|
14680
|
+
* For headless use, the hook provides the image element.
|
|
14681
|
+
*/
|
|
14682
|
+
initCropper = (imgElement) => {
|
|
14683
|
+
if (this.cropper)
|
|
14684
|
+
return; // Already initialized
|
|
14685
|
+
this.imgElement = imgElement;
|
|
14686
|
+
this.cropper = new Cropper(imgElement, this.opts.cropperOptions);
|
|
14687
|
+
// Store handlers so we can remove them later
|
|
14688
|
+
this.cropstartHandler = () => {
|
|
14689
|
+
if (this.cropper) {
|
|
14690
|
+
this.prevCropboxData = this.cropper.getCropBoxData();
|
|
14691
|
+
}
|
|
14692
|
+
};
|
|
14693
|
+
this.cropendHandler = ((event) => {
|
|
14694
|
+
if (!this.cropper || !this.prevCropboxData)
|
|
14695
|
+
return;
|
|
14696
|
+
const canvasData = this.cropper.getCanvasData();
|
|
14697
|
+
const cropboxData = this.cropper.getCropBoxData();
|
|
14698
|
+
if (event.detail.action === 'all') {
|
|
14699
|
+
const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, this.prevCropboxData);
|
|
14700
|
+
if (newCropboxData)
|
|
14701
|
+
this.cropper.setCropBoxData(newCropboxData);
|
|
14702
|
+
}
|
|
14703
|
+
else {
|
|
14704
|
+
const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, this.prevCropboxData);
|
|
14705
|
+
if (newCropboxData)
|
|
14706
|
+
this.cropper.setCropBoxData(newCropboxData);
|
|
14707
|
+
}
|
|
14619
14708
|
});
|
|
14709
|
+
this.cropperReadyHandler = () => {
|
|
14710
|
+
this.setPluginState({ cropperReady: true });
|
|
14711
|
+
};
|
|
14712
|
+
imgElement.addEventListener('cropstart', this.cropstartHandler);
|
|
14713
|
+
imgElement.addEventListener('cropend', this.cropendHandler);
|
|
14714
|
+
imgElement.addEventListener('ready', this.cropperReadyHandler, {
|
|
14715
|
+
once: true,
|
|
14716
|
+
});
|
|
14717
|
+
};
|
|
14718
|
+
/**
|
|
14719
|
+
* Destroy cropper and clean up event listeners.
|
|
14720
|
+
*/
|
|
14721
|
+
destroyCropper = () => {
|
|
14722
|
+
if (!this.cropper)
|
|
14723
|
+
return;
|
|
14724
|
+
this.setPluginState({ cropperReady: false });
|
|
14725
|
+
if (this.cropstartHandler && this.imgElement) {
|
|
14726
|
+
this.imgElement.removeEventListener('cropstart', this.cropstartHandler);
|
|
14727
|
+
}
|
|
14728
|
+
if (this.cropendHandler && this.imgElement) {
|
|
14729
|
+
this.imgElement.removeEventListener('cropend', this.cropendHandler);
|
|
14730
|
+
}
|
|
14731
|
+
if (this.cropperReadyHandler && this.imgElement) {
|
|
14732
|
+
this.imgElement.removeEventListener('ready', this.cropperReadyHandler);
|
|
14733
|
+
}
|
|
14734
|
+
this.cropper.destroy();
|
|
14735
|
+
this.cropper = null;
|
|
14736
|
+
this.imgElement = null;
|
|
14737
|
+
this.cropstartHandler = null;
|
|
14738
|
+
this.cropendHandler = null;
|
|
14739
|
+
this.cropperReadyHandler = null;
|
|
14740
|
+
this.prevCropboxData = null;
|
|
14741
|
+
};
|
|
14742
|
+
/**
|
|
14743
|
+
* Get object URL for the current image (used by headless hook).
|
|
14744
|
+
*/
|
|
14745
|
+
getObjectUrl = () => {
|
|
14746
|
+
return this.objectUrl;
|
|
14747
|
+
};
|
|
14748
|
+
install() {
|
|
14749
|
+
this.resetEditorState(null);
|
|
14620
14750
|
const { target } = this.opts;
|
|
14621
14751
|
if (target) {
|
|
14622
14752
|
this.mount(target, this);
|
|
@@ -14628,14 +14758,15 @@ class ImageEditor extends UIPlugin {
|
|
|
14628
14758
|
const file = this.uppy.getFile(currentImage.id);
|
|
14629
14759
|
this.uppy.emit('file-editor:cancel', file);
|
|
14630
14760
|
}
|
|
14761
|
+
this.stop();
|
|
14631
14762
|
this.unmount();
|
|
14632
14763
|
}
|
|
14633
14764
|
render() {
|
|
14634
|
-
const { currentImage } = this.getPluginState();
|
|
14765
|
+
const { currentImage, angleGranular } = this.getPluginState();
|
|
14635
14766
|
if (currentImage === null || currentImage.isRemote) {
|
|
14636
14767
|
return null;
|
|
14637
14768
|
}
|
|
14638
|
-
return (u$2(Editor, { currentImage: currentImage,
|
|
14769
|
+
return (u$2(Editor, { currentImage: currentImage, objectUrl: this.objectUrl ?? '', initCropper: this.initCropper, save: this.save, opts: this.opts, i18n: this.i18n, angleGranular: angleGranular, rotateBy: this.rotateBy, rotateGranular: this.rotateGranular, flipHorizontal: this.flipHorizontal, zoom: this.zoom, setAspectRatio: this.setAspectRatio, reset: this.reset }));
|
|
14639
14770
|
}
|
|
14640
14771
|
}
|
|
14641
14772
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DdRXU5II.js');
|
|
4
4
|
var useResource = require('./useResource-IN7KmaP3.js');
|
|
5
5
|
|
|
6
|
-
const posAttachmentsCss = () => `:host{--background-base-color:color-mix(in srgb, var(--pos-background-color), var(--color-grey-800) 10%);--background-color-even:hsl(from var(--background-base-color) h s calc(l + 7));--background-color-odd:hsl(from var(--background-base-color) h s calc(l + 10));--border-color:var(--background-base-color);ul{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:var(--size-1);li{padding:var(--size-1);&:nth-child(even){background-color:var(--background-color-even)}&:nth-child(odd){background-color:var(--background-color-odd)}&.new{animation:newItemBounce 0.8s ease-out
|
|
6
|
+
const posAttachmentsCss = () => `:host{--background-base-color:color-mix(in srgb, var(--pos-background-color), var(--color-grey-800) 10%);--background-color-even:hsl(from var(--background-base-color) h s calc(l + 7));--background-color-odd:hsl(from var(--background-base-color) h s calc(l + 10));--border-color:var(--background-base-color);ul{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:var(--size-1);li{padding:var(--size-1);&:nth-child(even){background-color:var(--background-color-even)}&:nth-child(odd){background-color:var(--background-color-odd)}&.new{animation:newItemBounce 0.8s ease-out, highlightFlash 2.5s ease-in-out}}}}@keyframes newItemBounce{0%{transform:scale(0.95);opacity:0}60%{transform:scale(1.02)}100%{transform:scale(1);opacity:1}}@keyframes highlightFlash{0%{box-shadow:0 0 20px var(--pos-primary-color)}100%{box-shadow:0 0 0 transparent}}`;
|
|
7
7
|
|
|
8
8
|
const PosAttachments = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var index$1 = require('./index-
|
|
3
|
+
var index = require('./index-DdRXU5II.js');
|
|
4
|
+
var index$1 = require('./index-D1Wk2cIF.js');
|
|
5
5
|
var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
|
|
6
6
|
|
|
7
7
|
const posContainerContentsCss = () => `ul{list-style:none;padding:0;margin:0}li{padding:0;margin:0}`;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DdRXU5II.js');
|
|
4
4
|
var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
|
|
5
|
-
require('./chunk.ZGGPD2XJ-
|
|
6
|
-
require('./chunk.YHLNUJ7P-
|
|
7
|
-
require('./chunk.URTPIBTY-
|
|
8
|
-
require('./chunk.5JY5FUCG-
|
|
5
|
+
require('./chunk.ZGGPD2XJ-C--tZiyf.js');
|
|
6
|
+
require('./chunk.YHLNUJ7P-CoQhYOM2.js');
|
|
7
|
+
require('./chunk.URTPIBTY-BiNv2Ckb.js');
|
|
8
|
+
require('./chunk.5JY5FUCG-BJJbNIiG.js');
|
|
9
9
|
require('./chunk.6CTB5ZDJ-CC8k6o5T.js');
|
|
10
10
|
var usePodOS = require('./usePodOS-BnFzjtlx.js');
|
|
11
|
-
require('./class-map-
|
|
11
|
+
require('./class-map-CyEFRZYn.js');
|
|
12
12
|
|
|
13
13
|
function selectIconForTypes(types) {
|
|
14
14
|
if (containsType(types, 'http://www.w3.org/ns/ldp#Container')) {
|