@pod-os/contacts 0.3.0-rc.56dcc33.0 → 0.3.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.
Files changed (140) hide show
  1. package/dist/cjs/{chunk.5JY5FUCG-CFIgnv-x.js → chunk.5JY5FUCG-BJJbNIiG.js} +2 -2
  2. package/dist/cjs/{chunk.HVTXQL7M-B2hdsTMl.js → chunk.HVTXQL7M-C6x_EQ24.js} +4 -4
  3. package/dist/cjs/{chunk.URTPIBTY-CPXM3gIp.js → chunk.URTPIBTY-BiNv2Ckb.js} +3 -3
  4. package/dist/cjs/{chunk.XQ2OKYYA-CKucQDxS.js → chunk.XQ2OKYYA-CDJtWcvs.js} +4 -4
  5. package/dist/cjs/{chunk.YHLNUJ7P-BGyxk38j.js → chunk.YHLNUJ7P-CoQhYOM2.js} +1 -1
  6. package/dist/cjs/chunk.ZGGPD2XJ-C--tZiyf.js +5 -0
  7. package/dist/cjs/{class-map-C14RM4yW.js → class-map-CyEFRZYn.js} +1 -1
  8. package/dist/cjs/contacts.cjs.js +2 -2
  9. package/dist/cjs/{if-defined-CVUFZlGQ.js → if-defined-TQmAS6tz.js} +1 -1
  10. package/dist/cjs/{index-B1s9BObP.js → index-CpATWk39.js} +1 -1
  11. package/dist/cjs/{index-FUnpyb19.js → index-D1Wk2cIF.js} +2 -2
  12. package/dist/cjs/{index-DxlhmANy.js → index-DdRXU5II.js} +24 -15
  13. package/dist/cjs/{jsonld-V2RB47OZ-BerQ9IRa.js → jsonld-V2RB47OZ-DDsC42qL.js} +1 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/pos-add-literal-value_3.cjs.entry.js +7 -7
  16. package/dist/cjs/pos-add-new-thing_7.cjs.entry.js +9 -9
  17. package/dist/cjs/pos-app-browser.cjs.entry.js +2 -2
  18. package/dist/cjs/pos-app-dashboard_6.cjs.entry.js +4 -4
  19. package/dist/cjs/pos-app-document-viewer.cjs.entry.js +1 -1
  20. package/dist/cjs/pos-app-generic.cjs.entry.js +1 -1
  21. package/dist/cjs/pos-app-image-viewer.cjs.entry.js +1 -1
  22. package/dist/cjs/pos-app-ldp-container.cjs.entry.js +1 -1
  23. package/dist/cjs/pos-app-rdf-document.cjs.entry.js +1 -1
  24. package/dist/cjs/pos-app_24.cjs.entry.js +309 -178
  25. package/dist/cjs/pos-attachments.cjs.entry.js +1 -1
  26. package/dist/cjs/pos-container-contents.cjs.entry.js +2 -2
  27. package/dist/cjs/pos-container-item_3.cjs.entry.js +6 -6
  28. package/dist/cjs/pos-description_2.cjs.entry.js +1 -1
  29. package/dist/cjs/pos-document.cjs.entry.js +6 -6
  30. package/dist/cjs/pos-list.cjs.entry.js +1 -1
  31. package/dist/cjs/pos-make-findable_2.cjs.entry.js +8 -8
  32. package/dist/cjs/pos-markdown-document.cjs.entry.js +443 -2328
  33. package/dist/cjs/pos-new-thing-form.cjs.entry.js +1 -1
  34. package/dist/cjs/pos-predicate.cjs.entry.js +6 -6
  35. package/dist/cjs/pos-relations_2.cjs.entry.js +1 -1
  36. package/dist/cjs/pos-select-term.cjs.entry.js +1 -1
  37. package/dist/cjs/pos-subjects.cjs.entry.js +2 -2
  38. package/dist/cjs/pos-tool-attachments.cjs.entry.js +1 -1
  39. package/dist/cjs/pos-tool-select.cjs.entry.js +3 -3
  40. package/dist/cjs/pos-value.cjs.entry.js +1 -1
  41. package/dist/cjs/{session-BayaHLZG.js → session-kBhmup9r.js} +1 -1
  42. package/dist/cjs/{settings--hJ8vEsE.js → settings-CpwCCkhx.js} +1 -1
  43. package/dist/collection/collection-manifest.json +2 -1
  44. package/dist/collection/components/open-address-book/open-address-book.js +2 -2
  45. package/dist/components/index2.js +1 -1
  46. package/dist/components/open-address-book.js +1 -1
  47. package/dist/components/pos-markdown-document2.js +1 -1
  48. package/dist/components/pos-upload2.js +12 -3
  49. package/dist/contacts/contacts.esm.js +1 -1
  50. package/dist/contacts/{p-23a9e3f7.entry.js → p-26248da8.entry.js} +1 -1
  51. package/dist/contacts/{p-8c22dd58.entry.js → p-40b2d792.entry.js} +1 -1
  52. package/dist/contacts/{p-9cc08d5d.entry.js → p-46f8861e.entry.js} +1 -1
  53. package/dist/contacts/{p-f2069948.entry.js → p-4ef3891c.entry.js} +1 -1
  54. package/dist/contacts/{p-Doy_38_j.js → p-5LNPeQkx.js} +1 -1
  55. package/dist/contacts/p-5e11ce90.entry.js +1 -0
  56. package/dist/contacts/{p-3db3697c.entry.js → p-649e7365.entry.js} +1 -1
  57. package/dist/contacts/{p-D5yyEaQc.js → p-68gi0rt1.js} +2 -2
  58. package/dist/contacts/{p-a912b0c5.entry.js → p-6d4ec7e5.entry.js} +1 -1
  59. package/dist/contacts/{p-e7d3c1ec.entry.js → p-76382e6a.entry.js} +1 -1
  60. package/dist/contacts/{p-2cba9598.entry.js → p-78715d17.entry.js} +1 -1
  61. package/dist/contacts/{p-b191df94.entry.js → p-7a01c820.entry.js} +1 -1
  62. package/dist/contacts/{p-c688c2a7.entry.js → p-7d796ba8.entry.js} +12 -12
  63. package/dist/contacts/{p-28e5a0f3.entry.js → p-7f565d49.entry.js} +1 -1
  64. package/dist/contacts/{p-ed50effa.entry.js → p-84fdbc1a.entry.js} +1 -1
  65. package/dist/contacts/{p-9953edcd.entry.js → p-8bc26fd9.entry.js} +1 -1
  66. package/dist/contacts/{p-9a2ac1bb.entry.js → p-92fcdd59.entry.js} +1 -1
  67. package/dist/contacts/p-B0L5m2PZ.js +67 -0
  68. package/dist/contacts/{p-BXKgr5Gu.js → p-B0_xZCeV.js} +3 -3
  69. package/dist/contacts/{p-QQ9ip321.js → p-BXcFVJku.js} +2 -2
  70. package/dist/contacts/{p-DABKSnsL.js → p-BXdS2klL.js} +2 -2
  71. package/dist/contacts/p-Bk6kpzHk.js +1 -0
  72. package/dist/contacts/{p-ME8pvwBs.js → p-BkeypvMo.js} +9 -9
  73. package/dist/contacts/{p-ClvXnhwM.js → p-Bug_w-vi.js} +1 -1
  74. package/dist/contacts/{p-GC4mMmic.js → p-C1XsyD29.js} +1 -1
  75. package/dist/contacts/{p-CgKErROC.js → p-C8LPXtIR.js} +2 -2
  76. package/dist/contacts/{p-C0nMaA5M.js → p-DScSUBy-.js} +2 -2
  77. package/dist/contacts/p-D_nUMgR-.js +11 -0
  78. package/dist/contacts/{p-BipFV89J.js → p-SrdKoY3I.js} +1 -1
  79. package/dist/contacts/{p-f6f09502.entry.js → p-a3082900.entry.js} +1 -1
  80. package/dist/contacts/{p-4130d85e.entry.js → p-a629ae72.entry.js} +1 -1
  81. package/dist/contacts/{p-32a0edb2.entry.js → p-a9d03996.entry.js} +1 -1
  82. package/dist/contacts/{p-77de4a33.entry.js → p-ae43e046.entry.js} +1 -1
  83. package/dist/contacts/{p-da5393cd.entry.js → p-c306d8ca.entry.js} +1 -1
  84. package/dist/contacts/{p-b5511f50.entry.js → p-c4a1c42a.entry.js} +1 -1
  85. package/dist/contacts/{p-5084bf63.entry.js → p-c89722f1.entry.js} +1 -1
  86. package/dist/contacts/{p-8df7b579.entry.js → p-ce6b4a9a.entry.js} +1 -1
  87. package/dist/contacts/p-d510fa6c.entry.js +127 -0
  88. package/dist/contacts/{p-eec9bbc3.entry.js → p-ecf8719a.entry.js} +1 -1
  89. package/dist/contacts/{p-e65c6072.entry.js → p-f8517ff2.entry.js} +1 -1
  90. package/dist/esm/{chunk.5JY5FUCG-B52nDptl.js → chunk.5JY5FUCG-B58l5Mdn.js} +2 -2
  91. package/dist/esm/{chunk.HVTXQL7M-BNA8hmQ6.js → chunk.HVTXQL7M-DXJDg6h_.js} +4 -4
  92. package/dist/esm/{chunk.URTPIBTY-CgZBKlLz.js → chunk.URTPIBTY-C1YI_wtI.js} +3 -3
  93. package/dist/esm/{chunk.XQ2OKYYA-U9jWa1BO.js → chunk.XQ2OKYYA-B0surOUs.js} +4 -4
  94. package/dist/esm/{chunk.YHLNUJ7P-Ci86SrOv.js → chunk.YHLNUJ7P-B10Qbx9i.js} +1 -1
  95. package/dist/esm/chunk.ZGGPD2XJ-CxH68zCl.js +3 -0
  96. package/dist/esm/{class-map-CEX3Xp6h.js → class-map-DcKoKhP0.js} +1 -1
  97. package/dist/esm/contacts.js +3 -3
  98. package/dist/esm/{if-defined-DwqmnOlO.js → if-defined-TtuUo8or.js} +1 -1
  99. package/dist/esm/{index-DFqG64hG.js → index-D-Cg1uHv.js} +2 -2
  100. package/dist/esm/{index-DrN7LBTM.js → index-D4tjvI9D.js} +1 -1
  101. package/dist/esm/{index-C0nMaA5M.js → index-DScSUBy-.js} +23 -14
  102. package/dist/esm/{jsonld-V2RB47OZ-CaIJ08AA.js → jsonld-V2RB47OZ-BA1jAPl4.js} +1 -1
  103. package/dist/esm/loader.js +2 -2
  104. package/dist/esm/pos-add-literal-value_3.entry.js +7 -7
  105. package/dist/esm/pos-add-new-thing_7.entry.js +9 -9
  106. package/dist/esm/pos-app-browser.entry.js +2 -2
  107. package/dist/esm/pos-app-dashboard_6.entry.js +4 -4
  108. package/dist/esm/pos-app-document-viewer.entry.js +1 -1
  109. package/dist/esm/pos-app-generic.entry.js +1 -1
  110. package/dist/esm/pos-app-image-viewer.entry.js +1 -1
  111. package/dist/esm/pos-app-ldp-container.entry.js +1 -1
  112. package/dist/esm/pos-app-rdf-document.entry.js +1 -1
  113. package/dist/esm/pos-app_24.entry.js +309 -178
  114. package/dist/esm/pos-attachments.entry.js +1 -1
  115. package/dist/esm/pos-container-contents.entry.js +2 -2
  116. package/dist/esm/pos-container-item_3.entry.js +6 -6
  117. package/dist/esm/pos-description_2.entry.js +1 -1
  118. package/dist/esm/pos-document.entry.js +6 -6
  119. package/dist/esm/pos-list.entry.js +1 -1
  120. package/dist/esm/pos-make-findable_2.entry.js +8 -8
  121. package/dist/esm/pos-markdown-document.entry.js +443 -2328
  122. package/dist/esm/pos-new-thing-form.entry.js +1 -1
  123. package/dist/esm/pos-predicate.entry.js +6 -6
  124. package/dist/esm/pos-relations_2.entry.js +1 -1
  125. package/dist/esm/pos-select-term.entry.js +1 -1
  126. package/dist/esm/pos-subjects.entry.js +2 -2
  127. package/dist/esm/pos-tool-attachments.entry.js +1 -1
  128. package/dist/esm/pos-tool-select.entry.js +3 -3
  129. package/dist/esm/pos-value.entry.js +1 -1
  130. package/dist/esm/{session-D6pii58K.js → session-CtUoUtdF.js} +1 -1
  131. package/dist/esm/{settings-WH1FmNcN.js → settings-Cnw1mSJw.js} +1 -1
  132. package/dist/types/stencil-public-runtime.d.ts +3 -1
  133. package/package.json +2 -2
  134. package/dist/cjs/chunk.ZGGPD2XJ-Dbqm_hZB.js +0 -5
  135. package/dist/contacts/p-9500c1b4.entry.js +0 -118
  136. package/dist/contacts/p-DHzCjlyY.js +0 -11
  137. package/dist/contacts/p-DjDNFMT3.js +0 -1
  138. package/dist/contacts/p-LoCE14bN.js +0 -67
  139. package/dist/contacts/p-bb96c175.entry.js +0 -1
  140. package/dist/esm/chunk.ZGGPD2XJ-CBFc8fGl.js +0 -3
@@ -1,15 +1,15 @@
1
- import { r as registerInstance, c as createEvent, h as h$2, e as Host, a as getElement } from './index-C0nMaA5M.js';
2
- import { s as store } from './session-D6pii58K.js';
3
- import { l as localSettings } from './settings-WH1FmNcN.js';
4
- import { P as PodOS, N as NoOfflineCache } from './index-DFqG64hG.js';
1
+ import { r as registerInstance, c as createEvent, h as h$2, e as Host, a as getElement } from './index-DScSUBy-.js';
2
+ import { s as store } from './session-CtUoUtdF.js';
3
+ import { l as localSettings } from './settings-Cnw1mSJw.js';
4
+ import { P as PodOS, N as NoOfflineCache } from './index-D-Cg1uHv.js';
5
5
  import { c as cjsExports } from './index-vFMstSdt.js';
6
- import { i as i$4, T as T$3, c as component_styles_default, _ as __decorateClass, n as n$3, a as ShoelaceElement, x as x$1 } from './chunk.YHLNUJ7P-Ci86SrOv.js';
6
+ import { i as i$4, T as T$3, c as component_styles_default, _ as __decorateClass, n as n$3, a as ShoelaceElement, x as x$1 } from './chunk.YHLNUJ7P-B10Qbx9i.js';
7
7
  import { L as LocalizeController } from './chunk.6CTB5ZDJ-BnGEOH37.js';
8
- import { a as e$3, i as i$5, t as t$2, e as e$4 } from './class-map-CEX3Xp6h.js';
9
- import { o as o$4 } from './if-defined-DwqmnOlO.js';
10
- import './chunk.ZGGPD2XJ-CBFc8fGl.js';
11
- import { c as createRouter, R as Route, m as match$1 } from './index-DrN7LBTM.js';
12
- import { B as BrokenFile } from './chunk.XQ2OKYYA-U9jWa1BO.js';
8
+ import { a as e$3, i as i$5, t as t$2, e as e$4 } from './class-map-DcKoKhP0.js';
9
+ import { o as o$4 } from './if-defined-TtuUo8or.js';
10
+ import './chunk.ZGGPD2XJ-CxH68zCl.js';
11
+ import { c as createRouter, R as Route, m as match$1 } from './index-D4tjvI9D.js';
12
+ import { B as BrokenFile } from './chunk.XQ2OKYYA-B0surOUs.js';
13
13
  import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
14
14
  import { u as usePodOS$1 } from './usePodOS-D0uCfr1-.js';
15
15
  import { s as subscribePodOs } from './PodOsAware-jlzl8vRd.js';
@@ -3384,7 +3384,7 @@ const OpenAddressBook = class {
3384
3384
  }
3385
3385
  disconnectedCallback() {
3386
3386
  this.disconnected$.next();
3387
- this.disconnected$.unsubscribe();
3387
+ this.disconnected$.complete();
3388
3388
  }
3389
3389
  openFromLink(event) {
3390
3390
  this.openAddressBook.emit(event.detail);
@@ -3397,7 +3397,7 @@ const OpenAddressBook = class {
3397
3397
  }
3398
3398
  render() {
3399
3399
  var _a;
3400
- return (h$2("div", { key: '511fb766939b4a89b50ba224d91f1a626c095197', id: "container" }, ((_a = this.sessionInfo) === null || _a === void 0 ? void 0 : _a.isLoggedIn) ? (h$2("pos-contacts-list-address-books", { webId: this.sessionInfo.webId })) : (h$2("div", { id: "sign-in" }, h$2("pos-login", null), "Sign in to list your address books.")), h$2("button", { key: '64cb74a95874d6bd2308df5f39bf12f8e578938b', title: "open any other address book by it's URI", class: "open", onClick: () => this.promptAndOpen() }, h$2("sl-icon", { key: '63648511e2884669c857bb2c531d3aa82fea314c', name: "folder2-open" }), "open other")));
3400
+ return (h$2("div", { key: 'ae7b01a87f8df061fc45a525b9555059d6268f6d', id: "container" }, ((_a = this.sessionInfo) === null || _a === void 0 ? void 0 : _a.isLoggedIn) ? (h$2("pos-contacts-list-address-books", { webId: this.sessionInfo.webId })) : (h$2("div", { id: "sign-in" }, h$2("pos-login", null), "Sign in to list your address books.")), h$2("button", { key: '075716e48f7cf098ee5e118ab8ebe4dce3cbaec2', title: "open any other address book by it's URI", class: "open", onClick: () => this.promptAndOpen() }, h$2("sl-icon", { key: '34bdda19c00947faf3beb46da700127152d18286', name: "folder2-open" }), "open other")));
3401
3401
  }
3402
3402
  get el() { return getElement(this); }
3403
3403
  };
@@ -8084,7 +8084,7 @@ class ThumbnailGenerator extends UIPlugin {
8084
8084
  }
8085
8085
  }
8086
8086
 
8087
- const version$2 = "5.1.0";
8087
+ const version$2 = "5.1.1";
8088
8088
  var packageJson$2 = {
8089
8089
  version: version$2};
8090
8090
 
@@ -10658,8 +10658,8 @@ class Dashboard extends UIPlugin {
10658
10658
  this.uppy.off('complete', this.handleComplete);
10659
10659
  this.uppy.off('files-added', this.#generateLargeThumbnailIfSingleFile);
10660
10660
  this.uppy.off('file-removed', this.#generateLargeThumbnailIfSingleFile);
10661
- document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently);
10662
- document.removeEventListener('click', this.recordIfFocusedOnUppyRecently);
10661
+ document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently, true);
10662
+ document.removeEventListener('click', this.recordIfFocusedOnUppyRecently, true);
10663
10663
  if (this.opts.inline) {
10664
10664
  this.el.removeEventListener('keydown', this.handleKeyDownInInline);
10665
10665
  }
@@ -10976,10 +10976,6 @@ class Dashboard extends UIPlugin {
10976
10976
  };
10977
10977
  }
10978
10978
 
10979
- const version$1 = "4.1.0";
10980
- var packageJson$1 = {
10981
- version: version$1};
10982
-
10983
10979
  var cropper$1 = {exports: {}};
10984
10980
 
10985
10981
  /*!
@@ -14266,6 +14262,87 @@ function requireCropper () {
14266
14262
  var cropperExports = requireCropper();
14267
14263
  var Cropper = /*@__PURE__*/getDefaultExportFromCjs(cropperExports);
14268
14264
 
14265
+ const version$1 = "4.2.0";
14266
+ var packageJson$1 = {
14267
+ version: version$1};
14268
+
14269
+ class Editor extends x {
14270
+ imgElement;
14271
+ componentDidMount() {
14272
+ const { initCropper } = this.props;
14273
+ if (this.imgElement) {
14274
+ initCropper(this.imgElement);
14275
+ }
14276
+ }
14277
+ onRotate90Deg = () => {
14278
+ this.props.rotateBy(-90);
14279
+ };
14280
+ onRotateGranular = (ev) => {
14281
+ const newGranularAngle = Number(ev.target.value);
14282
+ this.props.rotateGranular(newGranularAngle);
14283
+ };
14284
+ renderGranularRotate() {
14285
+ const { i18n } = this.props;
14286
+ const { angleGranular } = this.props;
14287
+ 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') }) }));
14288
+ }
14289
+ renderRevert() {
14290
+ const { i18n } = this.props;
14291
+ return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
14292
+ this.props.reset();
14293
+ }, 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" })] }) }));
14294
+ }
14295
+ renderRotate() {
14296
+ const { i18n } = this.props;
14297
+ 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" })] }) }));
14298
+ }
14299
+ renderFlip() {
14300
+ const { i18n } = this.props;
14301
+ 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" })] }) }));
14302
+ }
14303
+ renderZoomIn() {
14304
+ const { i18n } = this.props;
14305
+ 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" })] }) }));
14306
+ }
14307
+ renderZoomOut() {
14308
+ const { i18n } = this.props;
14309
+ 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" })] }) }));
14310
+ }
14311
+ renderCropSquare() {
14312
+ const { i18n } = this.props;
14313
+ 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" })] }) }));
14314
+ }
14315
+ renderCropWidescreen() {
14316
+ const { i18n } = this.props;
14317
+ 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" })] }) }));
14318
+ }
14319
+ renderCropWidescreenVertical() {
14320
+ const { i18n } = this.props;
14321
+ 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" })] }) }));
14322
+ }
14323
+ render() {
14324
+ const { currentImage, objectUrl, opts } = this.props;
14325
+ const { actions } = opts;
14326
+ 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) => {
14327
+ this.imgElement = ref;
14328
+ } }) }), 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 &&
14329
+ this.renderCropWidescreenVertical()] })] }));
14330
+ }
14331
+ }
14332
+
14333
+ var locale$1 = {
14334
+ strings: {
14335
+ revert: 'Reset',
14336
+ rotate: 'Rotate 90°',
14337
+ zoomIn: 'Zoom in',
14338
+ zoomOut: 'Zoom out',
14339
+ flipHorizontal: 'Flip horizontally',
14340
+ aspectRatioSquare: 'Crop square',
14341
+ aspectRatioLandscape: 'Crop landscape (16:9)',
14342
+ aspectRatioPortrait: 'Crop portrait (9:16)',
14343
+ },
14344
+ };
14345
+
14269
14346
  // See this cropperjs image to understand how container/image/canavas/cropbox relate to each other.
14270
14347
  // (https://github.com/fengyuanchen/cropperjs/blob/9b528a8baeaae876dc090085e37992a1683c6f34/docs/images/layers.jpg)
14271
14348
  //
@@ -14360,155 +14437,13 @@ function limitCropboxMovementOnResize(canvas, cropboxData, prevCropbox) {
14360
14437
  return null;
14361
14438
  }
14362
14439
 
14363
- class Editor extends x {
14364
- imgElement;
14365
- cropper;
14366
- constructor(props) {
14367
- super(props);
14368
- this.state = {
14369
- angle90Deg: 0,
14370
- angleGranular: 0,
14371
- prevCropboxData: null,
14372
- };
14373
- this.storePrevCropboxData = this.storePrevCropboxData.bind(this);
14374
- this.limitCropboxMovement = this.limitCropboxMovement.bind(this);
14375
- }
14376
- componentDidMount() {
14377
- const { opts, storeCropperInstance } = this.props;
14378
- this.cropper = new Cropper(this.imgElement, opts.cropperOptions);
14379
- this.imgElement.addEventListener('cropstart', this.storePrevCropboxData);
14380
- // @ts-expect-error custom cropper event but DOM API does not understand
14381
- this.imgElement.addEventListener('cropend', this.limitCropboxMovement);
14382
- storeCropperInstance(this.cropper);
14383
- }
14384
- componentWillUnmount() {
14385
- this.cropper.destroy();
14386
- this.imgElement.removeEventListener('cropstart', this.storePrevCropboxData);
14387
- // @ts-expect-error custom cropper event but DOM API does not understand
14388
- this.imgElement.removeEventListener('cropend', this.limitCropboxMovement);
14389
- }
14390
- storePrevCropboxData() {
14391
- this.setState({ prevCropboxData: this.cropper.getCropBoxData() });
14392
- }
14393
- limitCropboxMovement(event) {
14394
- const canvasData = this.cropper.getCanvasData();
14395
- const cropboxData = this.cropper.getCropBoxData();
14396
- const { prevCropboxData } = this.state;
14397
- // 1. When we grab the cropbox in the middle and move it
14398
- if (event.detail.action === 'all') {
14399
- const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, prevCropboxData);
14400
- if (newCropboxData)
14401
- this.cropper.setCropBoxData(newCropboxData);
14402
- // 2. When we stretch the cropbox by one of its sides
14403
- }
14404
- else {
14405
- const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, prevCropboxData);
14406
- if (newCropboxData)
14407
- this.cropper.setCropBoxData(newCropboxData);
14408
- }
14409
- }
14410
- onRotate90Deg = () => {
14411
- // 1. Set state
14412
- const { angle90Deg } = this.state;
14413
- const newAngle = angle90Deg - 90;
14414
- this.setState({
14415
- angle90Deg: newAngle,
14416
- angleGranular: 0,
14417
- });
14418
- // 2. Rotate the image
14419
- // Important to reset scale here, or cropper will get confused on further rotations
14420
- this.cropper.scale(1);
14421
- this.cropper.rotateTo(newAngle);
14422
- // 3. Fit the rotated image into the view
14423
- const canvasData = this.cropper.getCanvasData();
14424
- const containerData = this.cropper.getContainerData();
14425
- const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
14426
- this.cropper.setCanvasData(newCanvasData);
14427
- // 4. Make cropbox fully wrap the image
14428
- this.cropper.setCropBoxData(newCanvasData);
14429
- };
14430
- onRotateGranular = (ev) => {
14431
- // 1. Set state
14432
- const newGranularAngle = Number(ev.target.value);
14433
- this.setState({ angleGranular: newGranularAngle });
14434
- // 2. Rotate the image
14435
- const { angle90Deg } = this.state;
14436
- const newAngle = angle90Deg + newGranularAngle;
14437
- this.cropper.rotateTo(newAngle);
14438
- // 3. Scale the image so that it fits into the cropbox
14439
- const image = this.cropper.getImageData();
14440
- const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, newGranularAngle);
14441
- // Preserve flip
14442
- const scaleFactorX = this.cropper.getImageData().scaleX < 0 ? -scaleFactor : scaleFactor;
14443
- this.cropper.scale(scaleFactorX, scaleFactor);
14444
- };
14445
- renderGranularRotate() {
14446
- const { i18n } = this.props;
14447
- const { angleGranular } = this.state;
14448
- 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') }) }));
14449
- }
14450
- renderRevert() {
14451
- const { i18n, opts } = this.props;
14452
- return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
14453
- this.cropper.reset();
14454
- this.cropper.setAspectRatio(opts.cropperOptions.initialAspectRatio);
14455
- this.setState({ angle90Deg: 0, angleGranular: 0 });
14456
- }, 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" })] }) }));
14457
- }
14458
- renderRotate() {
14459
- const { i18n } = this.props;
14460
- 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" })] }) }));
14461
- }
14462
- renderFlip() {
14463
- const { i18n } = this.props;
14464
- 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" })] }) }));
14465
- }
14466
- renderZoomIn() {
14467
- const { i18n } = this.props;
14468
- 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" })] }) }));
14469
- }
14470
- renderZoomOut() {
14471
- const { i18n } = this.props;
14472
- 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" })] }) }));
14473
- }
14474
- renderCropSquare() {
14475
- const { i18n } = this.props;
14476
- 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" })] }) }));
14477
- }
14478
- renderCropWidescreen() {
14479
- const { i18n } = this.props;
14480
- 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" })] }) }));
14481
- }
14482
- renderCropWidescreenVertical() {
14483
- const { i18n } = this.props;
14484
- 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" })] }) }));
14485
- }
14486
- render() {
14487
- const { currentImage, opts } = this.props;
14488
- const { actions } = opts;
14489
- if (currentImage.data == null)
14490
- throw new Error('File data is empty');
14491
- const imageURL = URL.createObjectURL(currentImage.data);
14492
- 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) => {
14493
- this.imgElement = ref;
14494
- } }) }), 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 &&
14495
- this.renderCropWidescreenVertical()] })] }));
14496
- }
14497
- }
14498
-
14499
- var locale$1 = {
14500
- strings: {
14501
- revert: 'Reset',
14502
- rotate: 'Rotate 90°',
14503
- zoomIn: 'Zoom in',
14504
- zoomOut: 'Zoom out',
14505
- flipHorizontal: 'Flip horizontally',
14506
- aspectRatioSquare: 'Crop square',
14507
- aspectRatioLandscape: 'Crop landscape (16:9)',
14508
- aspectRatioPortrait: 'Crop portrait (9:16)',
14509
- },
14440
+ const defaultEditorState = {
14441
+ angle: 0,
14442
+ angleGranular: 0,
14443
+ isFlippedHorizontally: false,
14444
+ aspectRatio: 'free',
14445
+ cropperReady: false,
14510
14446
  };
14511
-
14512
14447
  const defaultCropperOptions = {
14513
14448
  viewMode: 0,
14514
14449
  background: false,
@@ -14539,7 +14474,13 @@ const defaultOptions$1 = {
14539
14474
  };
14540
14475
  class ImageEditor extends UIPlugin {
14541
14476
  static VERSION = packageJson$1.version;
14542
- cropper;
14477
+ cropper = null;
14478
+ objectUrl = null;
14479
+ prevCropboxData = null;
14480
+ imgElement = null;
14481
+ cropstartHandler = null;
14482
+ cropendHandler = null;
14483
+ cropperReadyHandler = null;
14543
14484
  constructor(uppy, opts) {
14544
14485
  super(uppy, {
14545
14486
  ...defaultOptions$1,
@@ -14570,9 +14511,18 @@ class ImageEditor extends UIPlugin {
14570
14511
  return false;
14571
14512
  }
14572
14513
  save = () => {
14514
+ const { currentImage } = this.getPluginState();
14515
+ if (!currentImage)
14516
+ return;
14517
+ if (!this.cropper)
14518
+ return;
14573
14519
  const saveBlobCallback = (blob) => {
14574
- const { currentImage } = this.getPluginState();
14575
- this.uppy.setFileState(currentImage.id, {
14520
+ if (!blob)
14521
+ return;
14522
+ const fileId = currentImage.id;
14523
+ if (!this.uppy.getFile(fileId))
14524
+ return;
14525
+ this.uppy.setFileState(fileId, {
14576
14526
  // Reinserting image's name and type, because .toBlob loses both.
14577
14527
  data: new File([blob], currentImage.name ?? this.i18n('unnamed'), {
14578
14528
  type: blob.type,
@@ -14580,14 +14530,15 @@ class ImageEditor extends UIPlugin {
14580
14530
  size: blob.size,
14581
14531
  preview: undefined,
14582
14532
  });
14583
- const updatedFile = this.uppy.getFile(currentImage.id);
14533
+ const updatedFile = this.uppy.getFile(fileId);
14534
+ if (!updatedFile)
14535
+ return;
14584
14536
  this.uppy.emit('thumbnail:request', updatedFile);
14585
14537
  this.setPluginState({
14586
14538
  currentImage: updatedFile,
14587
14539
  });
14588
14540
  this.uppy.emit('file-editor:complete', updatedFile);
14589
14541
  };
14590
- const { currentImage } = this.getPluginState();
14591
14542
  // Fixes black 1px lines on odd-width images.
14592
14543
  // This should be removed when cropperjs fixes this issue.
14593
14544
  // (See https://github.com/transloadit/uppy/issues/4305 and https://github.com/fengyuanchen/cropperjs/issues/551).
@@ -14606,15 +14557,194 @@ class ImageEditor extends UIPlugin {
14606
14557
  this.cropper = cropper;
14607
14558
  };
14608
14559
  selectFile = (file) => {
14609
- this.uppy.emit('file-editor:start', file);
14560
+ this.start(file);
14561
+ };
14562
+ resetEditorState = (currentImage = this.getPluginState().currentImage) => {
14610
14563
  this.setPluginState({
14611
- currentImage: file,
14564
+ currentImage,
14565
+ ...defaultEditorState,
14566
+ // Preserve cropperReady if cropper instance exists
14567
+ cropperReady: !!this.cropper,
14612
14568
  });
14613
14569
  };
14614
- install() {
14570
+ rotateBy = (degrees) => {
14571
+ if (!this.cropper)
14572
+ return;
14573
+ const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
14574
+ const base90 = angle - angleGranular;
14575
+ const newAngle = base90 + degrees;
14576
+ this.cropper.scale(isFlippedHorizontally ? -1 : 1);
14577
+ this.cropper.rotateTo(newAngle);
14578
+ const canvasData = this.cropper.getCanvasData();
14579
+ const containerData = this.cropper.getContainerData();
14580
+ const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
14581
+ this.cropper.setCanvasData(newCanvasData);
14582
+ this.cropper.setCropBoxData(newCanvasData);
14583
+ this.setPluginState({
14584
+ angle: newAngle,
14585
+ angleGranular: 0,
14586
+ });
14587
+ };
14588
+ rotateGranular = (granularAngle) => {
14589
+ if (!this.cropper)
14590
+ return;
14591
+ const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
14592
+ const base90 = angle - angleGranular;
14593
+ const newAngle = base90 + granularAngle;
14594
+ this.cropper.rotateTo(newAngle);
14595
+ const image = this.cropper.getImageData();
14596
+ const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, granularAngle);
14597
+ const scaleFactorX = isFlippedHorizontally ? -scaleFactor : scaleFactor;
14598
+ this.cropper.scale(scaleFactorX, scaleFactor);
14615
14599
  this.setPluginState({
14616
- currentImage: null,
14600
+ angle: newAngle,
14601
+ angleGranular: granularAngle,
14602
+ });
14603
+ };
14604
+ flipHorizontal = () => {
14605
+ if (!this.cropper)
14606
+ return;
14607
+ const { isFlippedHorizontally } = this.getPluginState();
14608
+ this.cropper.scaleX(-this.cropper.getData().scaleX || -1);
14609
+ this.setPluginState({
14610
+ isFlippedHorizontally: !isFlippedHorizontally,
14611
+ });
14612
+ };
14613
+ zoom = (ratio) => {
14614
+ if (!this.cropper)
14615
+ return;
14616
+ this.cropper.zoom(ratio);
14617
+ };
14618
+ setAspectRatio = (newRatio) => {
14619
+ if (!this.cropper)
14620
+ return;
14621
+ const ratioMap = {
14622
+ free: 0,
14623
+ '1:1': 1,
14624
+ '16:9': 16 / 9,
14625
+ '9:16': 9 / 16,
14626
+ };
14627
+ this.cropper.setAspectRatio(ratioMap[newRatio]);
14628
+ this.setPluginState({
14629
+ aspectRatio: newRatio,
14630
+ });
14631
+ };
14632
+ reset = () => {
14633
+ if (!this.cropper)
14634
+ return;
14635
+ this.cropper.reset();
14636
+ this.cropper.setAspectRatio(this.opts.cropperOptions.initialAspectRatio || 0);
14637
+ this.resetEditorState();
14638
+ };
14639
+ /**
14640
+ * Start editing a file - creates object URL and prepares state.
14641
+ * Called by hook's start() or when user opens editor.
14642
+ */
14643
+ start = (file) => {
14644
+ // Clean up any previous editing session
14645
+ if (this.objectUrl) {
14646
+ URL.revokeObjectURL(this.objectUrl);
14647
+ this.objectUrl = null;
14648
+ }
14649
+ // Get file data - first try the passed file, then try fetching from Uppy state
14650
+ let fileData = file.data;
14651
+ if (!(fileData instanceof Blob)) {
14652
+ const uppyFile = this.uppy.getFile(file.id);
14653
+ fileData = uppyFile?.data;
14654
+ }
14655
+ if (fileData instanceof Blob) {
14656
+ this.objectUrl = URL.createObjectURL(fileData);
14657
+ }
14658
+ else {
14659
+ // eslint-disable-next-line no-console
14660
+ 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);
14661
+ }
14662
+ this.uppy.emit('file-editor:start', file);
14663
+ this.resetEditorState(file);
14664
+ };
14665
+ /**
14666
+ * Stop editing - destroys cropper, revokes object URL, cleans up listeners.
14667
+ */
14668
+ stop = () => {
14669
+ this.destroyCropper();
14670
+ if (this.objectUrl) {
14671
+ URL.revokeObjectURL(this.objectUrl);
14672
+ this.objectUrl = null;
14673
+ }
14674
+ this.resetEditorState(null);
14675
+ };
14676
+ /**
14677
+ * Initialize cropper on the image element. Called lazily when first edit action is triggered.
14678
+ * For headless use, the hook provides the image element.
14679
+ */
14680
+ initCropper = (imgElement) => {
14681
+ if (this.cropper)
14682
+ return; // Already initialized
14683
+ this.imgElement = imgElement;
14684
+ this.cropper = new Cropper(imgElement, this.opts.cropperOptions);
14685
+ // Store handlers so we can remove them later
14686
+ this.cropstartHandler = () => {
14687
+ if (this.cropper) {
14688
+ this.prevCropboxData = this.cropper.getCropBoxData();
14689
+ }
14690
+ };
14691
+ this.cropendHandler = ((event) => {
14692
+ if (!this.cropper || !this.prevCropboxData)
14693
+ return;
14694
+ const canvasData = this.cropper.getCanvasData();
14695
+ const cropboxData = this.cropper.getCropBoxData();
14696
+ if (event.detail.action === 'all') {
14697
+ const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, this.prevCropboxData);
14698
+ if (newCropboxData)
14699
+ this.cropper.setCropBoxData(newCropboxData);
14700
+ }
14701
+ else {
14702
+ const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, this.prevCropboxData);
14703
+ if (newCropboxData)
14704
+ this.cropper.setCropBoxData(newCropboxData);
14705
+ }
14617
14706
  });
14707
+ this.cropperReadyHandler = () => {
14708
+ this.setPluginState({ cropperReady: true });
14709
+ };
14710
+ imgElement.addEventListener('cropstart', this.cropstartHandler);
14711
+ imgElement.addEventListener('cropend', this.cropendHandler);
14712
+ imgElement.addEventListener('ready', this.cropperReadyHandler, {
14713
+ once: true,
14714
+ });
14715
+ };
14716
+ /**
14717
+ * Destroy cropper and clean up event listeners.
14718
+ */
14719
+ destroyCropper = () => {
14720
+ if (!this.cropper)
14721
+ return;
14722
+ this.setPluginState({ cropperReady: false });
14723
+ if (this.cropstartHandler && this.imgElement) {
14724
+ this.imgElement.removeEventListener('cropstart', this.cropstartHandler);
14725
+ }
14726
+ if (this.cropendHandler && this.imgElement) {
14727
+ this.imgElement.removeEventListener('cropend', this.cropendHandler);
14728
+ }
14729
+ if (this.cropperReadyHandler && this.imgElement) {
14730
+ this.imgElement.removeEventListener('ready', this.cropperReadyHandler);
14731
+ }
14732
+ this.cropper.destroy();
14733
+ this.cropper = null;
14734
+ this.imgElement = null;
14735
+ this.cropstartHandler = null;
14736
+ this.cropendHandler = null;
14737
+ this.cropperReadyHandler = null;
14738
+ this.prevCropboxData = null;
14739
+ };
14740
+ /**
14741
+ * Get object URL for the current image (used by headless hook).
14742
+ */
14743
+ getObjectUrl = () => {
14744
+ return this.objectUrl;
14745
+ };
14746
+ install() {
14747
+ this.resetEditorState(null);
14618
14748
  const { target } = this.opts;
14619
14749
  if (target) {
14620
14750
  this.mount(target, this);
@@ -14626,14 +14756,15 @@ class ImageEditor extends UIPlugin {
14626
14756
  const file = this.uppy.getFile(currentImage.id);
14627
14757
  this.uppy.emit('file-editor:cancel', file);
14628
14758
  }
14759
+ this.stop();
14629
14760
  this.unmount();
14630
14761
  }
14631
14762
  render() {
14632
- const { currentImage } = this.getPluginState();
14763
+ const { currentImage, angleGranular } = this.getPluginState();
14633
14764
  if (currentImage === null || currentImage.isRemote) {
14634
14765
  return null;
14635
14766
  }
14636
- return (u$2(Editor, { currentImage: currentImage, storeCropperInstance: this.storeCropperInstance, save: this.save, opts: this.opts, i18n: this.i18n }));
14767
+ 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 }));
14637
14768
  }
14638
14769
  }
14639
14770
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, e as Host, a as getElement } from './index-C0nMaA5M.js';
1
+ import { r as registerInstance, h, e as Host, a as getElement } from './index-DScSUBy-.js';
2
2
  import { u as useResource } from './useResource-yVO4JQ9P.js';
3
3
 
4
4
  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}}`;
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, c as createEvent, h, e as Host } from './index-C0nMaA5M.js';
2
- import { L as LdpContainer } from './index-DFqG64hG.js';
1
+ import { r as registerInstance, c as createEvent, h, e as Host } from './index-DScSUBy-.js';
2
+ import { L as LdpContainer } from './index-D-Cg1uHv.js';
3
3
  import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
4
4
 
5
5
  const posContainerContentsCss = () => `ul{list-style:none;padding:0;margin:0}li{padding:0;margin:0}`;
@@ -1,12 +1,12 @@
1
- import { r as registerInstance, c as createEvent, h, e as Host, a as getElement } from './index-C0nMaA5M.js';
1
+ import { r as registerInstance, c as createEvent, h, e as Host, a as getElement } from './index-DScSUBy-.js';
2
2
  import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
3
- import './chunk.ZGGPD2XJ-CBFc8fGl.js';
4
- import './chunk.YHLNUJ7P-Ci86SrOv.js';
5
- import './chunk.URTPIBTY-CgZBKlLz.js';
6
- import './chunk.5JY5FUCG-B52nDptl.js';
3
+ import './chunk.ZGGPD2XJ-CxH68zCl.js';
4
+ import './chunk.YHLNUJ7P-B10Qbx9i.js';
5
+ import './chunk.URTPIBTY-C1YI_wtI.js';
6
+ import './chunk.5JY5FUCG-B58l5Mdn.js';
7
7
  import './chunk.6CTB5ZDJ-BnGEOH37.js';
8
8
  import { u as usePodOS } from './usePodOS-D0uCfr1-.js';
9
- import './class-map-CEX3Xp6h.js';
9
+ import './class-map-DcKoKhP0.js';
10
10
 
11
11
  function selectIconForTypes(types) {
12
12
  if (containsType(types, 'http://www.w3.org/ns/ldp#Container')) {
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, a as getElement } from './index-C0nMaA5M.js';
1
+ import { r as registerInstance, c as createEvent, h, a as getElement } from './index-DScSUBy-.js';
2
2
  import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
3
3
 
4
4
  const PosDescription = class {