@pod-os/elements 0.37.0-rc.c8b54d1.0 → 0.37.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.URTPIBTY-DdK9pL5v.js → chunk.URTPIBTY-DcQsb_nW.js} +2 -2
- package/dist/cjs/{chunk.XQ2OKYYA-DEkhm1i7.js → chunk.XQ2OKYYA-D224sdKt.js} +3 -3
- package/dist/cjs/{chunk.ZGGPD2XJ-uKZZdqOH.js → chunk.ZGGPD2XJ-Cj6xUx2M.js} +1 -1
- package/dist/cjs/{class-map-DAZXfKKA.js → class-map-Nx8L8ElN.js} +1 -1
- package/dist/cjs/elements.cjs.js +3 -3
- package/dist/cjs/{index-DCpu_nnH.js → index-Be_lnf0w.js} +547 -2001
- package/dist/cjs/{index-FUnpyb19.js → index-OR1wNkjG.js} +1052 -489
- package/dist/cjs/{jsonld-V2RB47OZ-BerQ9IRa.js → jsonld-V2RB47OZ-B82QNsYZ.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/pos-add-literal-value_3.cjs.entry.js +6 -6
- package/dist/cjs/{pos-add-new-thing_31.cjs.entry.js → pos-add-new-thing_32.cjs.entry.js} +411 -227
- 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-attachments.cjs.entry.js +2 -2
- package/dist/cjs/pos-case.cjs.entry.js +24 -0
- package/dist/cjs/pos-container-contents.cjs.entry.js +13 -4
- package/dist/cjs/pos-container-item_3.cjs.entry.js +4 -4
- package/dist/cjs/pos-document.cjs.entry.js +4 -4
- package/dist/cjs/pos-list.cjs.entry.js +1 -1
- package/dist/cjs/pos-markdown-document.cjs.entry.js +442 -2327
- package/dist/cjs/pos-relations_2.cjs.entry.js +1 -1
- package/dist/cjs/pos-subjects.cjs.entry.js +2 -2
- package/dist/cjs/pos-switch.cjs.entry.js +64 -0
- package/dist/cjs/pos-tool-attachments.cjs.entry.js +2 -2
- package/dist/cjs/pos-value.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/pos-app/pos-app.js +2 -1
- package/dist/collection/components/pos-attachments/pos-attachments.js +2 -1
- package/dist/collection/components/pos-container-contents/pos-container-contents.js +10 -1
- package/dist/collection/components/pos-container-contents/pos-create-new-container-item/pos-create-new-container-item.js +4 -2
- package/dist/collection/components/pos-markdown-document/pos-markdown-document.js +2 -1
- package/dist/collection/components/pos-navigation/bar/pos-navigation-bar.css +42 -22
- package/dist/collection/components/pos-navigation/bar/pos-navigation-bar.js +3 -2
- package/dist/collection/components/pos-new-thing-form/pos-new-thing-form.js +1 -1
- package/dist/collection/components/pos-router/pos-router.js +1 -1
- package/dist/collection/components/pos-select-term/pos-select-term.js +1 -1
- package/dist/collection/components/pos-share/openNewTab.js +3 -0
- package/dist/collection/components/pos-share/pos-share.css +36 -0
- package/dist/collection/components/pos-share/pos-share.js +111 -0
- package/dist/collection/components/pos-switch/pos-case/pos-case.js +88 -0
- package/dist/collection/components/pos-switch/pos-switch.js +89 -0
- package/dist/collection/components/pos-tool-select/pos-tool-select.js +6 -3
- package/dist/collection/components/pos-upload/pos-upload.js +7 -4
- package/dist/collection/components/pos-user-menu/pos-user-menu.js +1 -1
- package/dist/collection/tools/pos-tool-attachments/pos-tool-attachments.js +1 -1
- package/dist/components/chunk.IVVHNXMC.js +20 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/pos-add-literal-value2.js +1 -1
- package/dist/components/pos-app-browser.js +1 -1
- package/dist/components/pos-attachments2.js +1 -1
- package/dist/components/pos-case.d.ts +11 -0
- package/dist/components/pos-case.js +1 -0
- package/dist/components/pos-container-contents2.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-navigation-bar2.js +1 -1
- package/dist/components/pos-navigation2.js +1 -1
- package/dist/components/pos-new-thing-form2.js +1 -1
- package/dist/components/pos-router2.js +1 -1
- package/dist/components/pos-select-term2.js +1 -1
- package/dist/components/pos-share.d.ts +11 -0
- package/dist/components/pos-share.js +1 -0
- package/dist/components/pos-share2.js +1 -0
- package/dist/components/pos-switch.d.ts +11 -0
- package/dist/components/pos-switch.js +1 -0
- package/dist/components/pos-tool-attachments.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/components/pos-user-menu2.js +6 -25
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/{p-6561f1b7.entry.js → p-03464a71.entry.js} +1 -1
- package/dist/elements/{p-52a612ed.entry.js → p-272209e3.entry.js} +1 -1
- package/dist/elements/{p-a9a18aa8.entry.js → p-38aa17bc.entry.js} +1 -1
- package/dist/elements/p-3a890f5f.entry.js +1 -0
- package/dist/elements/{p-9ad80b52.entry.js → p-4cd2f9da.entry.js} +1 -1
- package/dist/elements/{p-0e7413e6.entry.js → p-5126fb6e.entry.js} +1 -1
- package/dist/elements/p-53610ccd.entry.js +1 -0
- package/dist/elements/{p-b5d64c6f.entry.js → p-631976a8.entry.js} +1 -1
- package/dist/elements/{p-fe628201.entry.js → p-6d628d74.entry.js} +1 -1
- package/dist/elements/{p-b363349c.entry.js → p-7c3785d8.entry.js} +1 -1
- package/dist/elements/p-8934c5ea.entry.js +1 -0
- package/dist/elements/p-8e76e9dc.entry.js +1 -0
- package/dist/elements/{p-3e18b5dd.entry.js → p-9bf6c310.entry.js} +1 -1
- package/dist/elements/{p-Doy_38_j.js → p-BLUiM5OK.js} +1 -1
- package/dist/elements/{p-BkAnMOpW.js → p-CSTMd_cW.js} +2 -2
- package/dist/elements/{p-CrxYqX8r.js → p-CVwgVrbO.js} +7 -7
- package/dist/elements/{p-8ggjG2YF.js → p-CnIOZlf7.js} +1 -1
- package/dist/elements/p-DHl0QGLf.js +67 -0
- package/dist/elements/p-DzbCx-pP.js +2 -0
- package/dist/elements/{p-c8ee910c.entry.js → p-a1dd6b42.entry.js} +1 -1
- package/dist/elements/p-ab4eba43.entry.js +859 -0
- package/dist/elements/{p-dff14248.entry.js → p-c7032012.entry.js} +1 -1
- package/dist/elements/{p-a20b72d8.entry.js → p-d396cc56.entry.js} +1 -1
- package/dist/elements/p-dc4c38c8.entry.js +1 -0
- package/dist/elements/{p-0a087865.entry.js → p-e0660718.entry.js} +1 -1
- package/dist/elements/{p-8q-RA2Uq.js → p-mIPOXLnA.js} +3 -3
- package/dist/esm/{chunk.URTPIBTY-CNA3-SLq.js → chunk.URTPIBTY-yxgfEQ1K.js} +2 -2
- package/dist/esm/{chunk.XQ2OKYYA-CXNlpYUG.js → chunk.XQ2OKYYA-Cr3bMzqn.js} +3 -3
- package/dist/esm/{chunk.ZGGPD2XJ-BjT6fS1o.js → chunk.ZGGPD2XJ-SJISSXOc.js} +1 -1
- package/dist/esm/{class-map-CUYFUkXU.js → class-map-DEweE_Cr.js} +1 -1
- package/dist/esm/elements.js +4 -4
- package/dist/esm/{index-DFqG64hG.js → index-CXK32bJz.js} +1052 -489
- package/dist/esm/{index-VMHzF3uY.js → index-DzbCx-pP.js} +547 -2001
- package/dist/esm/{jsonld-V2RB47OZ-CaIJ08AA.js → jsonld-V2RB47OZ-BbN7F0s8.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/pos-add-literal-value_3.entry.js +6 -6
- package/dist/esm/{pos-add-new-thing_31.entry.js → pos-add-new-thing_32.entry.js} +411 -228
- 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-attachments.entry.js +2 -2
- package/dist/esm/pos-case.entry.js +22 -0
- package/dist/esm/pos-container-contents.entry.js +12 -3
- package/dist/esm/pos-container-item_3.entry.js +4 -4
- package/dist/esm/pos-document.entry.js +4 -4
- package/dist/esm/pos-list.entry.js +1 -1
- package/dist/esm/pos-markdown-document.entry.js +442 -2327
- package/dist/esm/pos-relations_2.entry.js +1 -1
- package/dist/esm/pos-subjects.entry.js +2 -2
- package/dist/esm/pos-switch.entry.js +62 -0
- package/dist/esm/pos-tool-attachments.entry.js +2 -2
- package/dist/esm/pos-value.entry.js +1 -1
- package/dist/jest-setup.js +4 -0
- package/dist/types/components/pos-container-contents/pos-container-contents.d.ts +2 -0
- package/dist/types/components/pos-share/openNewTab.d.ts +1 -0
- package/dist/types/components/pos-share/pos-share.d.ts +28 -0
- package/dist/types/components/pos-switch/pos-case/pos-case.d.ts +22 -0
- package/dist/types/components/pos-switch/pos-switch.d.ts +19 -0
- package/dist/types/components.d.ts +300 -74
- package/dist/types/stencil-public-runtime.d.ts +52 -2
- package/package.json +13 -12
- package/dist/elements/p-637a38d9.entry.js +0 -1
- package/dist/elements/p-701f2c84.entry.js +0 -850
- package/dist/elements/p-9b74c400.entry.js +0 -1
- package/dist/elements/p-LoCE14bN.js +0 -67
- package/dist/elements/p-VMHzF3uY.js +0 -2
- package/dist/elements/p-ac17ed6a.entry.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as registerInstance, h as h$4,
|
|
2
|
-
import { i as i$5, E as E$2, T as T$3, c as component_styles_default, _ as __decorateClass, n as n$6, S as ShoelaceElement, x as x$1, d as SlIcon, r as r$4, w as watch, e as __yieldStar, f as f$5 } from './chunk.ZGGPD2XJ-
|
|
3
|
-
import { c as createStore$1, s as store, B as BrokenFile } from './chunk.XQ2OKYYA-
|
|
4
|
-
import { P as PodOS, N as NoOfflineCache, a as LabelIndex, T as TypeIndex2 } from './index-
|
|
1
|
+
import { r as registerInstance, h as h$4, H as Host, c as createEvent, a as getElement, i as getRenderingRef, j as forceUpdate } from './index-DzbCx-pP.js';
|
|
2
|
+
import { i as i$5, E as E$2, T as T$3, c as component_styles_default, _ as __decorateClass, n as n$6, S as ShoelaceElement, x as x$1, d as SlIcon, r as r$4, w as watch, e as __yieldStar, f as f$5 } from './chunk.ZGGPD2XJ-SJISSXOc.js';
|
|
3
|
+
import { c as createStore$1, s as store, B as BrokenFile } from './chunk.XQ2OKYYA-Cr3bMzqn.js';
|
|
4
|
+
import { P as PodOS, N as NoOfflineCache, a as LabelIndex, T as TypeIndex2 } from './index-CXK32bJz.js';
|
|
5
5
|
import { c as cjsExports } from './index-vFMstSdt.js';
|
|
6
|
-
import { L as LocalizeController, e as e$6, s as setDefaultAnimation, a as stopAnimations, g as getAnimation, b as animateTo, w as waitForEvent, S as SlPopup } from './chunk.URTPIBTY-
|
|
7
|
-
import { a as e$4, i as i$6, t as t$2, e as e$5 } from './class-map-
|
|
6
|
+
import { L as LocalizeController, e as e$6, s as setDefaultAnimation, a as stopAnimations, g as getAnimation, b as animateTo, w as waitForEvent, S as SlPopup } from './chunk.URTPIBTY-yxgfEQ1K.js';
|
|
7
|
+
import { a as e$4, i as i$6, t as t$2, e as e$5 } from './class-map-DEweE_Cr.js';
|
|
8
8
|
import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
|
|
9
9
|
import { s as subscribePodOs } from './PodOsAware-jlzl8vRd.js';
|
|
10
10
|
import { u as usePodOS } from './usePodOS-D0uCfr1-.js';
|
|
@@ -5348,7 +5348,7 @@ __decorateClass([
|
|
|
5348
5348
|
|
|
5349
5349
|
SlMenuItem.define("sl-menu-item");
|
|
5350
5350
|
|
|
5351
|
-
const posMakeFindableCss = () => `button.main{display:flex;transition:width 200ms
|
|
5351
|
+
const posMakeFindableCss = () => `button.main{display:flex;transition:width 200ms, background-color 500ms, color 500ms, border-color 500ms;max-width:var(--size-40);flex-direction:row;overflow:hidden;height:var(--pos-navigation-bar-height);width:var(--pos-navigation-bar-height);align-items:center;justify-content:center;border-radius:var(--radius-md);color:var(--pos-subtle-text-color);border:var(--size-px) dashed var(--pos-subtle-text-color);background-color:var(--pos-background-color);p{padding:0;margin:0;display:none;white-space:nowrap}&.success{color:var(--color-green-700);border-color:var(--color-green-700);border-style:solid;background-color:var(--color-green-100)}&:active{transform:scale(0.99);filter:brightness(90%)}&:focus{outline:var(--pos-input-focus-outline)}}svg{display:inline-block;height:var(--size-6);flex-shrink:0;flex-grow:0;width:var(--size-6)}button.main:hover,sl-dropdown[open] button{width:var(--size-full);height:var(--pos-navigation-bar-height);background:var(--pos-background-color);color:var(--pos-normal-text-color);&.success{background:var(--color-green-200);color:var(--color-green-700)}p{display:inline-block}}`;
|
|
5352
5352
|
|
|
5353
5353
|
const PosMakeFindable = class {
|
|
5354
5354
|
constructor(hostRef) {
|
|
@@ -5578,7 +5578,7 @@ const PosNavigation = class {
|
|
|
5578
5578
|
};
|
|
5579
5579
|
PosNavigation.style = posNavigationCss();
|
|
5580
5580
|
|
|
5581
|
-
const posNavigationBarCss = () => `section.current{display:flex;height:var(--pos-navigation-bar-height);flex-grow:1;gap:0;background-color:var(--pos-input-background-color);border-radius:var(--radius-md);width:100%;&:focus-within{outline:var(--pos-input-focus-outline)}
|
|
5581
|
+
const posNavigationBarCss = () => `section.current{display:flex;align-items:center;box-sizing:border-box;padding:0 var(--size-2) 0 0;height:var(--pos-navigation-bar-height);flex-grow:1;gap:0;background-color:var(--pos-input-background-color);border-radius:var(--radius-md);width:100%;&:focus-within{outline:var(--pos-input-focus-outline)}button{cursor:pointer;font-size:var(--scale-1);display:flex;align-items:center;justify-content:center;flex-grow:1;background:none;color:var(--pos-normal-text-color);outline:none;border:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;&:focus{text-decoration:underline}:first-child{flex-grow:1}svg{width:var(--size-6);color:var(--pos-subtle-text-color)}}pos-share{height:80%;&:hover{&::part(button){color:var(--pos-primary-color);background-color:var(--pos-border-color);border-radius:var(--radius-full)}}&::part(button){font-size:var(--size-4);background:none;outline:none;border:none;color:var(--pos-subtle-text-color)}}}`;
|
|
5582
5582
|
|
|
5583
5583
|
const PosNavigationBar = class {
|
|
5584
5584
|
constructor(hostRef) {
|
|
@@ -5596,7 +5596,7 @@ const PosNavigationBar = class {
|
|
|
5596
5596
|
}
|
|
5597
5597
|
render() {
|
|
5598
5598
|
const ariaLabel = this.current ? `${this.current.label()} (Click to search or enter URI)` : 'Search or enter URI';
|
|
5599
|
-
return (h$4("section", { key: '5f49aa9dad9d07550ee8ffbee90036cbc1efda55', class: "current" }, this.current && this.searchIndexReady && h$4("pos-make-findable", { key: '85974a4772aaf8cad3a11cdcd49e6df10141bfe3', uri: this.current.uri }), h$4("button", { key: '40660a3455b0f3392c68d7aea0075b102a1762a2', "aria-label": ariaLabel, onClick: () => this.onClick() }, h$4("div", { key: '9ab8922175d701f714f72aefb95745cf5ae4bb95' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon())));
|
|
5599
|
+
return (h$4("section", { key: '5f49aa9dad9d07550ee8ffbee90036cbc1efda55', class: "current" }, this.current && this.searchIndexReady && h$4("pos-make-findable", { key: '85974a4772aaf8cad3a11cdcd49e6df10141bfe3', uri: this.current.uri }), h$4("button", { key: '40660a3455b0f3392c68d7aea0075b102a1762a2', "aria-label": ariaLabel, onClick: () => this.onClick() }, h$4("div", { key: '9ab8922175d701f714f72aefb95745cf5ae4bb95' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon()), this.current && h$4("pos-share", { key: '3b80c1987f9f5138b11b8a106171fc73a236f426', uri: this.current.uri })));
|
|
5600
5600
|
}
|
|
5601
5601
|
icon() {
|
|
5602
5602
|
return (h$4("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor" }, h$4("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" })));
|
|
@@ -5624,7 +5624,7 @@ const PosNewThingForm = class {
|
|
|
5624
5624
|
subscribePodOs(this);
|
|
5625
5625
|
}
|
|
5626
5626
|
render() {
|
|
5627
|
-
return (h$4("form", { key: '
|
|
5627
|
+
return (h$4("form", { key: '64781cfb0e570d2368325d674c6637c581bb87c2', method: "dialog", onSubmit: e => this.handleSubmit(e) }, h$4("label", { key: '409e04f147430042eb334024fc7061574ab543cf', htmlFor: "type" }, "Type"), h$4("pos-select-term", { key: '8d5d580ee1f1e2e2c60cac0cc06798e94a0d28c3', id: "type", placeholder: "", value: this.selectedTypeUri, "onPod-os:term-selected": e => this.onTermSelected(e) }), h$4("label", { key: 'a45199618751e24b7d4a1bc13ad85c599cc93d1c', htmlFor: "name" }, "Name"), h$4("input", { key: 'bee3be7a680abbffc08caa5c549b68b1e653872d', id: "name", type: "text", value: this.name, onInput: e => this.handleChange(e) }), this.newUri ? (h$4("div", { id: "new-uri", title: "This will be the URI of the new thing" }, this.newUri)) : null, h$4("input", { key: 'e8fab4d442188f7f2f325ff7bde3dce6d3f772f6', id: "create", type: "submit", value: "Create", disabled: !this.canSubmit })));
|
|
5628
5628
|
}
|
|
5629
5629
|
handleChange(event) {
|
|
5630
5630
|
this.name = event.target.value;
|
|
@@ -6211,7 +6211,7 @@ const PosRouter = class {
|
|
|
6211
6211
|
this.routeChanged.emit(this.uri);
|
|
6212
6212
|
}
|
|
6213
6213
|
render() {
|
|
6214
|
-
return h$4("slot", { key: '
|
|
6214
|
+
return h$4("slot", { key: '2775fc2835158ccd8d540e4f27edfd497eafe7a9' });
|
|
6215
6215
|
}
|
|
6216
6216
|
};
|
|
6217
6217
|
PosRouter.style = posRouterCss();
|
|
@@ -6240,7 +6240,7 @@ const PosSelectTerm = class {
|
|
|
6240
6240
|
this.termSelected.emit({ uri: event.target.value });
|
|
6241
6241
|
}
|
|
6242
6242
|
render() {
|
|
6243
|
-
return (h$4(Host, { key: '
|
|
6243
|
+
return (h$4(Host, { key: 'a4050d72acd62d907f0fd4c3b90c54194700871c' }, h$4("input", { key: '99b35c4a14a2623599ba237bb4af0b79c0761196', part: "input", list: "terms", placeholder: this.placeholder, value: this.value, onChange: ev => this.handleChange(ev) }), h$4("datalist", { key: 'd64ad5ea83200014c6de5cd4720f29922494982c', part: "terms", id: "terms" }, this.terms.map(term => (h$4("option", { value: term.uri }, term.shorthand))))));
|
|
6244
6244
|
}
|
|
6245
6245
|
static get delegatesFocus() { return true; }
|
|
6246
6246
|
static get watchers() { return {
|
|
@@ -6263,7 +6263,104 @@ const PosSettingOfflineCache = class {
|
|
|
6263
6263
|
};
|
|
6264
6264
|
PosSettingOfflineCache.style = posSettingOfflineCacheCss();
|
|
6265
6265
|
|
|
6266
|
-
|
|
6266
|
+
// src/components/divider/divider.styles.ts
|
|
6267
|
+
var divider_styles_default = i$5`
|
|
6268
|
+
:host {
|
|
6269
|
+
--color: var(--sl-panel-border-color);
|
|
6270
|
+
--width: var(--sl-panel-border-width);
|
|
6271
|
+
--spacing: var(--sl-spacing-medium);
|
|
6272
|
+
}
|
|
6273
|
+
|
|
6274
|
+
:host(:not([vertical])) {
|
|
6275
|
+
display: block;
|
|
6276
|
+
border-top: solid var(--width) var(--color);
|
|
6277
|
+
margin: var(--spacing) 0;
|
|
6278
|
+
}
|
|
6279
|
+
|
|
6280
|
+
:host([vertical]) {
|
|
6281
|
+
display: inline-block;
|
|
6282
|
+
height: 100%;
|
|
6283
|
+
border-left: solid var(--width) var(--color);
|
|
6284
|
+
margin: 0 var(--spacing);
|
|
6285
|
+
}
|
|
6286
|
+
`;
|
|
6287
|
+
|
|
6288
|
+
var SlDivider = class extends ShoelaceElement {
|
|
6289
|
+
constructor() {
|
|
6290
|
+
super(...arguments);
|
|
6291
|
+
this.vertical = false;
|
|
6292
|
+
}
|
|
6293
|
+
connectedCallback() {
|
|
6294
|
+
super.connectedCallback();
|
|
6295
|
+
this.setAttribute("role", "separator");
|
|
6296
|
+
}
|
|
6297
|
+
handleVerticalChange() {
|
|
6298
|
+
this.setAttribute("aria-orientation", this.vertical ? "vertical" : "horizontal");
|
|
6299
|
+
}
|
|
6300
|
+
};
|
|
6301
|
+
SlDivider.styles = [component_styles_default, divider_styles_default];
|
|
6302
|
+
__decorateClass([
|
|
6303
|
+
n$6({ type: Boolean, reflect: true })
|
|
6304
|
+
], SlDivider.prototype, "vertical", 2);
|
|
6305
|
+
__decorateClass([
|
|
6306
|
+
watch("vertical")
|
|
6307
|
+
], SlDivider.prototype, "handleVerticalChange", 1);
|
|
6308
|
+
|
|
6309
|
+
SlDivider.define("sl-divider");
|
|
6310
|
+
|
|
6311
|
+
function openNewTab(url) {
|
|
6312
|
+
window.open(url.toString(), '_blank');
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
const posShareCss = () => `:host{display:flex;aspect-ratio:1/1;height:var(--size-8);align-items:center;justify-content:center}sl-dropdown{height:100%;width:100%;display:flex;align-items:center;justify-content:center;&::part(trigger){height:100%;width:100%}button{display:flex;align-items:center;justify-content:center;height:100%;width:100%;cursor:pointer;padding:0;margin:0}}sl-menu-item[disabled]{&::part(base){cursor:default;opacity:1}}`;
|
|
6316
|
+
|
|
6317
|
+
const PosShare = class {
|
|
6318
|
+
constructor(hostRef) {
|
|
6319
|
+
registerInstance(this, hostRef);
|
|
6320
|
+
this.apps = [];
|
|
6321
|
+
}
|
|
6322
|
+
async resourceLoaded(e) {
|
|
6323
|
+
if (e.detail === this.uri) {
|
|
6324
|
+
await this.updateApps();
|
|
6325
|
+
}
|
|
6326
|
+
}
|
|
6327
|
+
async componentWillLoad() {
|
|
6328
|
+
this.os = await usePodOS(this.el);
|
|
6329
|
+
await this.updateApps();
|
|
6330
|
+
}
|
|
6331
|
+
async updateApps() {
|
|
6332
|
+
const thing = this.os.store.get(this.uri);
|
|
6333
|
+
this.apps = this.os.proposeAppsFor(thing);
|
|
6334
|
+
}
|
|
6335
|
+
onSelect(e) {
|
|
6336
|
+
const { value } = e.detail.item;
|
|
6337
|
+
if (value === 'copy-uri') {
|
|
6338
|
+
navigator.clipboard.writeText(this.uri);
|
|
6339
|
+
}
|
|
6340
|
+
else {
|
|
6341
|
+
openNewTab(value.urlTemplate.expand({ uri: this.uri }));
|
|
6342
|
+
}
|
|
6343
|
+
}
|
|
6344
|
+
render() {
|
|
6345
|
+
return (h$4("sl-dropdown", { key: '67ce5a1f7e5630ff40a6e79eaa9ab7f32b5f1a00' }, h$4("button", { key: '6c946718e7af9f0ef212c3853641f06a24d79474', slot: "trigger", "aria-label": "Share", part: "button" }, h$4("sl-icon", { key: 'effc4e9bdf4236451636f1b4622605c87746d414', name: "share" })), h$4("sl-menu", { key: '2f1c8e707e71a699803c2897fda8f1e79ccd5267' }, h$4("sl-menu-item", { key: '5a59cffe8351c23389620b38b60f8ccd24dce351', value: "copy-uri" }, h$4("sl-icon", { key: 'ab9b9d7f8a2a91e0a4f5ac657b9ff390418948cc', slot: "prefix", name: "copy" }), "Copy URI"), this.apps.length > 0 && h$4(OpenWithApps, { key: '718fbda37b7171df356afe02e6d6f7f1e8e8cd26', apps: this.apps }))));
|
|
6346
|
+
}
|
|
6347
|
+
get el() { return getElement(this); }
|
|
6348
|
+
static get watchers() { return {
|
|
6349
|
+
"uri": [{
|
|
6350
|
+
"updateApps": 0
|
|
6351
|
+
}]
|
|
6352
|
+
}; }
|
|
6353
|
+
};
|
|
6354
|
+
function OpenWithApps({ apps }) {
|
|
6355
|
+
return [
|
|
6356
|
+
h$4("sl-divider", null),
|
|
6357
|
+
h$4("sl-menu-item", { disabled: true }, "Open with..."),
|
|
6358
|
+
apps.map(it => h$4("sl-menu-item", { value: it }, it.name)),
|
|
6359
|
+
];
|
|
6360
|
+
}
|
|
6361
|
+
PosShare.style = posShareCss();
|
|
6362
|
+
|
|
6363
|
+
const posToolSelectCss = () => `:host { --button-size: var(--size-16); display: block; position: sticky; align-self: flex-start; top: 0; overflow: auto; min-width: var(--button-size); z-index: var(--layer-1); } [role='tablist'] { display: flex; flex-direction: column; justify-content: center; border-right: var(--size-px) solid var(--pos-border-color); button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: var(--size-6); position: relative; overflow: hidden; outline: none; border: none; width: var(--button-size); min-width: var(--button-size); height: var(--button-size); min-height: var(--button-size); color: var(--pos-normal-text-color); background-color: var(--pos-background-color); &::after { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 100%; background: color-mix(in srgb, var(--pos-primary-color), transparent 50%); transform: translate(-50%, -50%); opacity: 1; } &:active::after, &:focus::after { width: calc(var(--button-size) * 1.5); height: calc(var(--button-size) * 1.5); opacity: 0; transition: width 0.5s ease-out, height 0.5s ease-out, opacity 1s ease-out; } &:focus-visible { border: var(--size-px) solid var(--pos-primary-color); } @media (min-width: 640px) { &[aria-selected] { border-right: var(--size-1) solid var(--pos-primary-color); } } .text { font-size: var(--size-3); white-space: nowrap; text-overflow: ellipsis; width: 100%; overflow: hidden; } } } @media (max-width: 640px) { :host { position: fixed; top: unset; bottom: 0; width: 100dvw; } [role='tablist'] { flex-direction: row; background-color: var(--pos-background-color); border-top: var(--size-px) solid var(--pos-border-color); button { &[aria-selected] { border-top: var(--size-1) solid var(--pos-primary-color); } } } } `;
|
|
6267
6364
|
|
|
6268
6365
|
const PosToolSelect = class {
|
|
6269
6366
|
constructor(hostRef) {
|
|
@@ -6286,7 +6383,7 @@ const PosToolSelect = class {
|
|
|
6286
6383
|
};
|
|
6287
6384
|
PosToolSelect.style = posToolSelectCss();
|
|
6288
6385
|
|
|
6289
|
-
const posTypeIndexEntriesCss = () => `dl {
|
|
6386
|
+
const posTypeIndexEntriesCss = () => `dl { > * { display: flex; flex-direction: column; gap: var(--size-1); } display: flex; flex-direction: column; gap: var(--size-4); dd { margin: 0; } } `;
|
|
6290
6387
|
|
|
6291
6388
|
const PosTypeIndexEntries = class {
|
|
6292
6389
|
constructor(hostRef) {
|
|
@@ -10740,7 +10837,7 @@ class ThumbnailGenerator extends UIPlugin {
|
|
|
10740
10837
|
}
|
|
10741
10838
|
}
|
|
10742
10839
|
|
|
10743
|
-
const version$2 = "5.1.
|
|
10840
|
+
const version$2 = "5.1.1";
|
|
10744
10841
|
var packageJson$2 = {
|
|
10745
10842
|
version: version$2};
|
|
10746
10843
|
|
|
@@ -13314,8 +13411,8 @@ class Dashboard extends UIPlugin {
|
|
|
13314
13411
|
this.uppy.off('complete', this.handleComplete);
|
|
13315
13412
|
this.uppy.off('files-added', this.#generateLargeThumbnailIfSingleFile);
|
|
13316
13413
|
this.uppy.off('file-removed', this.#generateLargeThumbnailIfSingleFile);
|
|
13317
|
-
document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently);
|
|
13318
|
-
document.removeEventListener('click', this.recordIfFocusedOnUppyRecently);
|
|
13414
|
+
document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently, true);
|
|
13415
|
+
document.removeEventListener('click', this.recordIfFocusedOnUppyRecently, true);
|
|
13319
13416
|
if (this.opts.inline) {
|
|
13320
13417
|
this.el.removeEventListener('keydown', this.handleKeyDownInInline);
|
|
13321
13418
|
}
|
|
@@ -13632,10 +13729,6 @@ class Dashboard extends UIPlugin {
|
|
|
13632
13729
|
};
|
|
13633
13730
|
}
|
|
13634
13731
|
|
|
13635
|
-
const version$1 = "4.1.0";
|
|
13636
|
-
var packageJson$1 = {
|
|
13637
|
-
version: version$1};
|
|
13638
|
-
|
|
13639
13732
|
var cropper$1 = {exports: {}};
|
|
13640
13733
|
|
|
13641
13734
|
/*!
|
|
@@ -16922,6 +17015,87 @@ function requireCropper () {
|
|
|
16922
17015
|
var cropperExports = requireCropper();
|
|
16923
17016
|
var Cropper = /*@__PURE__*/getDefaultExportFromCjs(cropperExports);
|
|
16924
17017
|
|
|
17018
|
+
const version$1 = "4.2.0";
|
|
17019
|
+
var packageJson$1 = {
|
|
17020
|
+
version: version$1};
|
|
17021
|
+
|
|
17022
|
+
class Editor extends x {
|
|
17023
|
+
imgElement;
|
|
17024
|
+
componentDidMount() {
|
|
17025
|
+
const { initCropper } = this.props;
|
|
17026
|
+
if (this.imgElement) {
|
|
17027
|
+
initCropper(this.imgElement);
|
|
17028
|
+
}
|
|
17029
|
+
}
|
|
17030
|
+
onRotate90Deg = () => {
|
|
17031
|
+
this.props.rotateBy(-90);
|
|
17032
|
+
};
|
|
17033
|
+
onRotateGranular = (ev) => {
|
|
17034
|
+
const newGranularAngle = Number(ev.target.value);
|
|
17035
|
+
this.props.rotateGranular(newGranularAngle);
|
|
17036
|
+
};
|
|
17037
|
+
renderGranularRotate() {
|
|
17038
|
+
const { i18n } = this.props;
|
|
17039
|
+
const { angleGranular } = this.props;
|
|
17040
|
+
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') }) }));
|
|
17041
|
+
}
|
|
17042
|
+
renderRevert() {
|
|
17043
|
+
const { i18n } = this.props;
|
|
17044
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
|
|
17045
|
+
this.props.reset();
|
|
17046
|
+
}, 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" })] }) }));
|
|
17047
|
+
}
|
|
17048
|
+
renderRotate() {
|
|
17049
|
+
const { i18n } = this.props;
|
|
17050
|
+
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" })] }) }));
|
|
17051
|
+
}
|
|
17052
|
+
renderFlip() {
|
|
17053
|
+
const { i18n } = this.props;
|
|
17054
|
+
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" })] }) }));
|
|
17055
|
+
}
|
|
17056
|
+
renderZoomIn() {
|
|
17057
|
+
const { i18n } = this.props;
|
|
17058
|
+
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" })] }) }));
|
|
17059
|
+
}
|
|
17060
|
+
renderZoomOut() {
|
|
17061
|
+
const { i18n } = this.props;
|
|
17062
|
+
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" })] }) }));
|
|
17063
|
+
}
|
|
17064
|
+
renderCropSquare() {
|
|
17065
|
+
const { i18n } = this.props;
|
|
17066
|
+
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" })] }) }));
|
|
17067
|
+
}
|
|
17068
|
+
renderCropWidescreen() {
|
|
17069
|
+
const { i18n } = this.props;
|
|
17070
|
+
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" })] }) }));
|
|
17071
|
+
}
|
|
17072
|
+
renderCropWidescreenVertical() {
|
|
17073
|
+
const { i18n } = this.props;
|
|
17074
|
+
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" })] }) }));
|
|
17075
|
+
}
|
|
17076
|
+
render() {
|
|
17077
|
+
const { currentImage, objectUrl, opts } = this.props;
|
|
17078
|
+
const { actions } = opts;
|
|
17079
|
+
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) => {
|
|
17080
|
+
this.imgElement = ref;
|
|
17081
|
+
} }) }), 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 &&
|
|
17082
|
+
this.renderCropWidescreenVertical()] })] }));
|
|
17083
|
+
}
|
|
17084
|
+
}
|
|
17085
|
+
|
|
17086
|
+
var locale$1 = {
|
|
17087
|
+
strings: {
|
|
17088
|
+
revert: 'Reset',
|
|
17089
|
+
rotate: 'Rotate 90°',
|
|
17090
|
+
zoomIn: 'Zoom in',
|
|
17091
|
+
zoomOut: 'Zoom out',
|
|
17092
|
+
flipHorizontal: 'Flip horizontally',
|
|
17093
|
+
aspectRatioSquare: 'Crop square',
|
|
17094
|
+
aspectRatioLandscape: 'Crop landscape (16:9)',
|
|
17095
|
+
aspectRatioPortrait: 'Crop portrait (9:16)',
|
|
17096
|
+
},
|
|
17097
|
+
};
|
|
17098
|
+
|
|
16925
17099
|
// See this cropperjs image to understand how container/image/canavas/cropbox relate to each other.
|
|
16926
17100
|
// (https://github.com/fengyuanchen/cropperjs/blob/9b528a8baeaae876dc090085e37992a1683c6f34/docs/images/layers.jpg)
|
|
16927
17101
|
//
|
|
@@ -17016,155 +17190,13 @@ function limitCropboxMovementOnResize(canvas, cropboxData, prevCropbox) {
|
|
|
17016
17190
|
return null;
|
|
17017
17191
|
}
|
|
17018
17192
|
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
angle90Deg: 0,
|
|
17026
|
-
angleGranular: 0,
|
|
17027
|
-
prevCropboxData: null,
|
|
17028
|
-
};
|
|
17029
|
-
this.storePrevCropboxData = this.storePrevCropboxData.bind(this);
|
|
17030
|
-
this.limitCropboxMovement = this.limitCropboxMovement.bind(this);
|
|
17031
|
-
}
|
|
17032
|
-
componentDidMount() {
|
|
17033
|
-
const { opts, storeCropperInstance } = this.props;
|
|
17034
|
-
this.cropper = new Cropper(this.imgElement, opts.cropperOptions);
|
|
17035
|
-
this.imgElement.addEventListener('cropstart', this.storePrevCropboxData);
|
|
17036
|
-
// @ts-expect-error custom cropper event but DOM API does not understand
|
|
17037
|
-
this.imgElement.addEventListener('cropend', this.limitCropboxMovement);
|
|
17038
|
-
storeCropperInstance(this.cropper);
|
|
17039
|
-
}
|
|
17040
|
-
componentWillUnmount() {
|
|
17041
|
-
this.cropper.destroy();
|
|
17042
|
-
this.imgElement.removeEventListener('cropstart', this.storePrevCropboxData);
|
|
17043
|
-
// @ts-expect-error custom cropper event but DOM API does not understand
|
|
17044
|
-
this.imgElement.removeEventListener('cropend', this.limitCropboxMovement);
|
|
17045
|
-
}
|
|
17046
|
-
storePrevCropboxData() {
|
|
17047
|
-
this.setState({ prevCropboxData: this.cropper.getCropBoxData() });
|
|
17048
|
-
}
|
|
17049
|
-
limitCropboxMovement(event) {
|
|
17050
|
-
const canvasData = this.cropper.getCanvasData();
|
|
17051
|
-
const cropboxData = this.cropper.getCropBoxData();
|
|
17052
|
-
const { prevCropboxData } = this.state;
|
|
17053
|
-
// 1. When we grab the cropbox in the middle and move it
|
|
17054
|
-
if (event.detail.action === 'all') {
|
|
17055
|
-
const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, prevCropboxData);
|
|
17056
|
-
if (newCropboxData)
|
|
17057
|
-
this.cropper.setCropBoxData(newCropboxData);
|
|
17058
|
-
// 2. When we stretch the cropbox by one of its sides
|
|
17059
|
-
}
|
|
17060
|
-
else {
|
|
17061
|
-
const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, prevCropboxData);
|
|
17062
|
-
if (newCropboxData)
|
|
17063
|
-
this.cropper.setCropBoxData(newCropboxData);
|
|
17064
|
-
}
|
|
17065
|
-
}
|
|
17066
|
-
onRotate90Deg = () => {
|
|
17067
|
-
// 1. Set state
|
|
17068
|
-
const { angle90Deg } = this.state;
|
|
17069
|
-
const newAngle = angle90Deg - 90;
|
|
17070
|
-
this.setState({
|
|
17071
|
-
angle90Deg: newAngle,
|
|
17072
|
-
angleGranular: 0,
|
|
17073
|
-
});
|
|
17074
|
-
// 2. Rotate the image
|
|
17075
|
-
// Important to reset scale here, or cropper will get confused on further rotations
|
|
17076
|
-
this.cropper.scale(1);
|
|
17077
|
-
this.cropper.rotateTo(newAngle);
|
|
17078
|
-
// 3. Fit the rotated image into the view
|
|
17079
|
-
const canvasData = this.cropper.getCanvasData();
|
|
17080
|
-
const containerData = this.cropper.getContainerData();
|
|
17081
|
-
const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
|
|
17082
|
-
this.cropper.setCanvasData(newCanvasData);
|
|
17083
|
-
// 4. Make cropbox fully wrap the image
|
|
17084
|
-
this.cropper.setCropBoxData(newCanvasData);
|
|
17085
|
-
};
|
|
17086
|
-
onRotateGranular = (ev) => {
|
|
17087
|
-
// 1. Set state
|
|
17088
|
-
const newGranularAngle = Number(ev.target.value);
|
|
17089
|
-
this.setState({ angleGranular: newGranularAngle });
|
|
17090
|
-
// 2. Rotate the image
|
|
17091
|
-
const { angle90Deg } = this.state;
|
|
17092
|
-
const newAngle = angle90Deg + newGranularAngle;
|
|
17093
|
-
this.cropper.rotateTo(newAngle);
|
|
17094
|
-
// 3. Scale the image so that it fits into the cropbox
|
|
17095
|
-
const image = this.cropper.getImageData();
|
|
17096
|
-
const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, newGranularAngle);
|
|
17097
|
-
// Preserve flip
|
|
17098
|
-
const scaleFactorX = this.cropper.getImageData().scaleX < 0 ? -scaleFactor : scaleFactor;
|
|
17099
|
-
this.cropper.scale(scaleFactorX, scaleFactor);
|
|
17100
|
-
};
|
|
17101
|
-
renderGranularRotate() {
|
|
17102
|
-
const { i18n } = this.props;
|
|
17103
|
-
const { angleGranular } = this.state;
|
|
17104
|
-
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') }) }));
|
|
17105
|
-
}
|
|
17106
|
-
renderRevert() {
|
|
17107
|
-
const { i18n, opts } = this.props;
|
|
17108
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
|
|
17109
|
-
this.cropper.reset();
|
|
17110
|
-
this.cropper.setAspectRatio(opts.cropperOptions.initialAspectRatio);
|
|
17111
|
-
this.setState({ angle90Deg: 0, angleGranular: 0 });
|
|
17112
|
-
}, 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" })] }) }));
|
|
17113
|
-
}
|
|
17114
|
-
renderRotate() {
|
|
17115
|
-
const { i18n } = this.props;
|
|
17116
|
-
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" })] }) }));
|
|
17117
|
-
}
|
|
17118
|
-
renderFlip() {
|
|
17119
|
-
const { i18n } = this.props;
|
|
17120
|
-
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" })] }) }));
|
|
17121
|
-
}
|
|
17122
|
-
renderZoomIn() {
|
|
17123
|
-
const { i18n } = this.props;
|
|
17124
|
-
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" })] }) }));
|
|
17125
|
-
}
|
|
17126
|
-
renderZoomOut() {
|
|
17127
|
-
const { i18n } = this.props;
|
|
17128
|
-
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" })] }) }));
|
|
17129
|
-
}
|
|
17130
|
-
renderCropSquare() {
|
|
17131
|
-
const { i18n } = this.props;
|
|
17132
|
-
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" })] }) }));
|
|
17133
|
-
}
|
|
17134
|
-
renderCropWidescreen() {
|
|
17135
|
-
const { i18n } = this.props;
|
|
17136
|
-
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" })] }) }));
|
|
17137
|
-
}
|
|
17138
|
-
renderCropWidescreenVertical() {
|
|
17139
|
-
const { i18n } = this.props;
|
|
17140
|
-
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" })] }) }));
|
|
17141
|
-
}
|
|
17142
|
-
render() {
|
|
17143
|
-
const { currentImage, opts } = this.props;
|
|
17144
|
-
const { actions } = opts;
|
|
17145
|
-
if (currentImage.data == null)
|
|
17146
|
-
throw new Error('File data is empty');
|
|
17147
|
-
const imageURL = URL.createObjectURL(currentImage.data);
|
|
17148
|
-
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) => {
|
|
17149
|
-
this.imgElement = ref;
|
|
17150
|
-
} }) }), 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 &&
|
|
17151
|
-
this.renderCropWidescreenVertical()] })] }));
|
|
17152
|
-
}
|
|
17153
|
-
}
|
|
17154
|
-
|
|
17155
|
-
var locale$1 = {
|
|
17156
|
-
strings: {
|
|
17157
|
-
revert: 'Reset',
|
|
17158
|
-
rotate: 'Rotate 90°',
|
|
17159
|
-
zoomIn: 'Zoom in',
|
|
17160
|
-
zoomOut: 'Zoom out',
|
|
17161
|
-
flipHorizontal: 'Flip horizontally',
|
|
17162
|
-
aspectRatioSquare: 'Crop square',
|
|
17163
|
-
aspectRatioLandscape: 'Crop landscape (16:9)',
|
|
17164
|
-
aspectRatioPortrait: 'Crop portrait (9:16)',
|
|
17165
|
-
},
|
|
17193
|
+
const defaultEditorState = {
|
|
17194
|
+
angle: 0,
|
|
17195
|
+
angleGranular: 0,
|
|
17196
|
+
isFlippedHorizontally: false,
|
|
17197
|
+
aspectRatio: 'free',
|
|
17198
|
+
cropperReady: false,
|
|
17166
17199
|
};
|
|
17167
|
-
|
|
17168
17200
|
const defaultCropperOptions = {
|
|
17169
17201
|
viewMode: 0,
|
|
17170
17202
|
background: false,
|
|
@@ -17195,7 +17227,13 @@ const defaultOptions$1 = {
|
|
|
17195
17227
|
};
|
|
17196
17228
|
class ImageEditor extends UIPlugin {
|
|
17197
17229
|
static VERSION = packageJson$1.version;
|
|
17198
|
-
cropper;
|
|
17230
|
+
cropper = null;
|
|
17231
|
+
objectUrl = null;
|
|
17232
|
+
prevCropboxData = null;
|
|
17233
|
+
imgElement = null;
|
|
17234
|
+
cropstartHandler = null;
|
|
17235
|
+
cropendHandler = null;
|
|
17236
|
+
cropperReadyHandler = null;
|
|
17199
17237
|
constructor(uppy, opts) {
|
|
17200
17238
|
super(uppy, {
|
|
17201
17239
|
...defaultOptions$1,
|
|
@@ -17226,9 +17264,18 @@ class ImageEditor extends UIPlugin {
|
|
|
17226
17264
|
return false;
|
|
17227
17265
|
}
|
|
17228
17266
|
save = () => {
|
|
17267
|
+
const { currentImage } = this.getPluginState();
|
|
17268
|
+
if (!currentImage)
|
|
17269
|
+
return;
|
|
17270
|
+
if (!this.cropper)
|
|
17271
|
+
return;
|
|
17229
17272
|
const saveBlobCallback = (blob) => {
|
|
17230
|
-
|
|
17231
|
-
|
|
17273
|
+
if (!blob)
|
|
17274
|
+
return;
|
|
17275
|
+
const fileId = currentImage.id;
|
|
17276
|
+
if (!this.uppy.getFile(fileId))
|
|
17277
|
+
return;
|
|
17278
|
+
this.uppy.setFileState(fileId, {
|
|
17232
17279
|
// Reinserting image's name and type, because .toBlob loses both.
|
|
17233
17280
|
data: new File([blob], currentImage.name ?? this.i18n('unnamed'), {
|
|
17234
17281
|
type: blob.type,
|
|
@@ -17236,14 +17283,15 @@ class ImageEditor extends UIPlugin {
|
|
|
17236
17283
|
size: blob.size,
|
|
17237
17284
|
preview: undefined,
|
|
17238
17285
|
});
|
|
17239
|
-
const updatedFile = this.uppy.getFile(
|
|
17286
|
+
const updatedFile = this.uppy.getFile(fileId);
|
|
17287
|
+
if (!updatedFile)
|
|
17288
|
+
return;
|
|
17240
17289
|
this.uppy.emit('thumbnail:request', updatedFile);
|
|
17241
17290
|
this.setPluginState({
|
|
17242
17291
|
currentImage: updatedFile,
|
|
17243
17292
|
});
|
|
17244
17293
|
this.uppy.emit('file-editor:complete', updatedFile);
|
|
17245
17294
|
};
|
|
17246
|
-
const { currentImage } = this.getPluginState();
|
|
17247
17295
|
// Fixes black 1px lines on odd-width images.
|
|
17248
17296
|
// This should be removed when cropperjs fixes this issue.
|
|
17249
17297
|
// (See https://github.com/transloadit/uppy/issues/4305 and https://github.com/fengyuanchen/cropperjs/issues/551).
|
|
@@ -17262,15 +17310,194 @@ class ImageEditor extends UIPlugin {
|
|
|
17262
17310
|
this.cropper = cropper;
|
|
17263
17311
|
};
|
|
17264
17312
|
selectFile = (file) => {
|
|
17265
|
-
this.
|
|
17313
|
+
this.start(file);
|
|
17314
|
+
};
|
|
17315
|
+
resetEditorState = (currentImage = this.getPluginState().currentImage) => {
|
|
17266
17316
|
this.setPluginState({
|
|
17267
|
-
currentImage
|
|
17317
|
+
currentImage,
|
|
17318
|
+
...defaultEditorState,
|
|
17319
|
+
// Preserve cropperReady if cropper instance exists
|
|
17320
|
+
cropperReady: !!this.cropper,
|
|
17268
17321
|
});
|
|
17269
17322
|
};
|
|
17270
|
-
|
|
17323
|
+
rotateBy = (degrees) => {
|
|
17324
|
+
if (!this.cropper)
|
|
17325
|
+
return;
|
|
17326
|
+
const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
|
|
17327
|
+
const base90 = angle - angleGranular;
|
|
17328
|
+
const newAngle = base90 + degrees;
|
|
17329
|
+
this.cropper.scale(isFlippedHorizontally ? -1 : 1);
|
|
17330
|
+
this.cropper.rotateTo(newAngle);
|
|
17331
|
+
const canvasData = this.cropper.getCanvasData();
|
|
17332
|
+
const containerData = this.cropper.getContainerData();
|
|
17333
|
+
const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
|
|
17334
|
+
this.cropper.setCanvasData(newCanvasData);
|
|
17335
|
+
this.cropper.setCropBoxData(newCanvasData);
|
|
17336
|
+
this.setPluginState({
|
|
17337
|
+
angle: newAngle,
|
|
17338
|
+
angleGranular: 0,
|
|
17339
|
+
});
|
|
17340
|
+
};
|
|
17341
|
+
rotateGranular = (granularAngle) => {
|
|
17342
|
+
if (!this.cropper)
|
|
17343
|
+
return;
|
|
17344
|
+
const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
|
|
17345
|
+
const base90 = angle - angleGranular;
|
|
17346
|
+
const newAngle = base90 + granularAngle;
|
|
17347
|
+
this.cropper.rotateTo(newAngle);
|
|
17348
|
+
const image = this.cropper.getImageData();
|
|
17349
|
+
const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, granularAngle);
|
|
17350
|
+
const scaleFactorX = isFlippedHorizontally ? -scaleFactor : scaleFactor;
|
|
17351
|
+
this.cropper.scale(scaleFactorX, scaleFactor);
|
|
17352
|
+
this.setPluginState({
|
|
17353
|
+
angle: newAngle,
|
|
17354
|
+
angleGranular: granularAngle,
|
|
17355
|
+
});
|
|
17356
|
+
};
|
|
17357
|
+
flipHorizontal = () => {
|
|
17358
|
+
if (!this.cropper)
|
|
17359
|
+
return;
|
|
17360
|
+
const { isFlippedHorizontally } = this.getPluginState();
|
|
17361
|
+
this.cropper.scaleX(-this.cropper.getData().scaleX || -1);
|
|
17362
|
+
this.setPluginState({
|
|
17363
|
+
isFlippedHorizontally: !isFlippedHorizontally,
|
|
17364
|
+
});
|
|
17365
|
+
};
|
|
17366
|
+
zoom = (ratio) => {
|
|
17367
|
+
if (!this.cropper)
|
|
17368
|
+
return;
|
|
17369
|
+
this.cropper.zoom(ratio);
|
|
17370
|
+
};
|
|
17371
|
+
setAspectRatio = (newRatio) => {
|
|
17372
|
+
if (!this.cropper)
|
|
17373
|
+
return;
|
|
17374
|
+
const ratioMap = {
|
|
17375
|
+
free: 0,
|
|
17376
|
+
'1:1': 1,
|
|
17377
|
+
'16:9': 16 / 9,
|
|
17378
|
+
'9:16': 9 / 16,
|
|
17379
|
+
};
|
|
17380
|
+
this.cropper.setAspectRatio(ratioMap[newRatio]);
|
|
17271
17381
|
this.setPluginState({
|
|
17272
|
-
|
|
17382
|
+
aspectRatio: newRatio,
|
|
17273
17383
|
});
|
|
17384
|
+
};
|
|
17385
|
+
reset = () => {
|
|
17386
|
+
if (!this.cropper)
|
|
17387
|
+
return;
|
|
17388
|
+
this.cropper.reset();
|
|
17389
|
+
this.cropper.setAspectRatio(this.opts.cropperOptions.initialAspectRatio || 0);
|
|
17390
|
+
this.resetEditorState();
|
|
17391
|
+
};
|
|
17392
|
+
/**
|
|
17393
|
+
* Start editing a file - creates object URL and prepares state.
|
|
17394
|
+
* Called by hook's start() or when user opens editor.
|
|
17395
|
+
*/
|
|
17396
|
+
start = (file) => {
|
|
17397
|
+
// Clean up any previous editing session
|
|
17398
|
+
if (this.objectUrl) {
|
|
17399
|
+
URL.revokeObjectURL(this.objectUrl);
|
|
17400
|
+
this.objectUrl = null;
|
|
17401
|
+
}
|
|
17402
|
+
// Get file data - first try the passed file, then try fetching from Uppy state
|
|
17403
|
+
let fileData = file.data;
|
|
17404
|
+
if (!(fileData instanceof Blob)) {
|
|
17405
|
+
const uppyFile = this.uppy.getFile(file.id);
|
|
17406
|
+
fileData = uppyFile?.data;
|
|
17407
|
+
}
|
|
17408
|
+
if (fileData instanceof Blob) {
|
|
17409
|
+
this.objectUrl = URL.createObjectURL(fileData);
|
|
17410
|
+
}
|
|
17411
|
+
else {
|
|
17412
|
+
// eslint-disable-next-line no-console
|
|
17413
|
+
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);
|
|
17414
|
+
}
|
|
17415
|
+
this.uppy.emit('file-editor:start', file);
|
|
17416
|
+
this.resetEditorState(file);
|
|
17417
|
+
};
|
|
17418
|
+
/**
|
|
17419
|
+
* Stop editing - destroys cropper, revokes object URL, cleans up listeners.
|
|
17420
|
+
*/
|
|
17421
|
+
stop = () => {
|
|
17422
|
+
this.destroyCropper();
|
|
17423
|
+
if (this.objectUrl) {
|
|
17424
|
+
URL.revokeObjectURL(this.objectUrl);
|
|
17425
|
+
this.objectUrl = null;
|
|
17426
|
+
}
|
|
17427
|
+
this.resetEditorState(null);
|
|
17428
|
+
};
|
|
17429
|
+
/**
|
|
17430
|
+
* Initialize cropper on the image element. Called lazily when first edit action is triggered.
|
|
17431
|
+
* For headless use, the hook provides the image element.
|
|
17432
|
+
*/
|
|
17433
|
+
initCropper = (imgElement) => {
|
|
17434
|
+
if (this.cropper)
|
|
17435
|
+
return; // Already initialized
|
|
17436
|
+
this.imgElement = imgElement;
|
|
17437
|
+
this.cropper = new Cropper(imgElement, this.opts.cropperOptions);
|
|
17438
|
+
// Store handlers so we can remove them later
|
|
17439
|
+
this.cropstartHandler = () => {
|
|
17440
|
+
if (this.cropper) {
|
|
17441
|
+
this.prevCropboxData = this.cropper.getCropBoxData();
|
|
17442
|
+
}
|
|
17443
|
+
};
|
|
17444
|
+
this.cropendHandler = ((event) => {
|
|
17445
|
+
if (!this.cropper || !this.prevCropboxData)
|
|
17446
|
+
return;
|
|
17447
|
+
const canvasData = this.cropper.getCanvasData();
|
|
17448
|
+
const cropboxData = this.cropper.getCropBoxData();
|
|
17449
|
+
if (event.detail.action === 'all') {
|
|
17450
|
+
const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, this.prevCropboxData);
|
|
17451
|
+
if (newCropboxData)
|
|
17452
|
+
this.cropper.setCropBoxData(newCropboxData);
|
|
17453
|
+
}
|
|
17454
|
+
else {
|
|
17455
|
+
const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, this.prevCropboxData);
|
|
17456
|
+
if (newCropboxData)
|
|
17457
|
+
this.cropper.setCropBoxData(newCropboxData);
|
|
17458
|
+
}
|
|
17459
|
+
});
|
|
17460
|
+
this.cropperReadyHandler = () => {
|
|
17461
|
+
this.setPluginState({ cropperReady: true });
|
|
17462
|
+
};
|
|
17463
|
+
imgElement.addEventListener('cropstart', this.cropstartHandler);
|
|
17464
|
+
imgElement.addEventListener('cropend', this.cropendHandler);
|
|
17465
|
+
imgElement.addEventListener('ready', this.cropperReadyHandler, {
|
|
17466
|
+
once: true,
|
|
17467
|
+
});
|
|
17468
|
+
};
|
|
17469
|
+
/**
|
|
17470
|
+
* Destroy cropper and clean up event listeners.
|
|
17471
|
+
*/
|
|
17472
|
+
destroyCropper = () => {
|
|
17473
|
+
if (!this.cropper)
|
|
17474
|
+
return;
|
|
17475
|
+
this.setPluginState({ cropperReady: false });
|
|
17476
|
+
if (this.cropstartHandler && this.imgElement) {
|
|
17477
|
+
this.imgElement.removeEventListener('cropstart', this.cropstartHandler);
|
|
17478
|
+
}
|
|
17479
|
+
if (this.cropendHandler && this.imgElement) {
|
|
17480
|
+
this.imgElement.removeEventListener('cropend', this.cropendHandler);
|
|
17481
|
+
}
|
|
17482
|
+
if (this.cropperReadyHandler && this.imgElement) {
|
|
17483
|
+
this.imgElement.removeEventListener('ready', this.cropperReadyHandler);
|
|
17484
|
+
}
|
|
17485
|
+
this.cropper.destroy();
|
|
17486
|
+
this.cropper = null;
|
|
17487
|
+
this.imgElement = null;
|
|
17488
|
+
this.cropstartHandler = null;
|
|
17489
|
+
this.cropendHandler = null;
|
|
17490
|
+
this.cropperReadyHandler = null;
|
|
17491
|
+
this.prevCropboxData = null;
|
|
17492
|
+
};
|
|
17493
|
+
/**
|
|
17494
|
+
* Get object URL for the current image (used by headless hook).
|
|
17495
|
+
*/
|
|
17496
|
+
getObjectUrl = () => {
|
|
17497
|
+
return this.objectUrl;
|
|
17498
|
+
};
|
|
17499
|
+
install() {
|
|
17500
|
+
this.resetEditorState(null);
|
|
17274
17501
|
const { target } = this.opts;
|
|
17275
17502
|
if (target) {
|
|
17276
17503
|
this.mount(target, this);
|
|
@@ -17282,14 +17509,15 @@ class ImageEditor extends UIPlugin {
|
|
|
17282
17509
|
const file = this.uppy.getFile(currentImage.id);
|
|
17283
17510
|
this.uppy.emit('file-editor:cancel', file);
|
|
17284
17511
|
}
|
|
17512
|
+
this.stop();
|
|
17285
17513
|
this.unmount();
|
|
17286
17514
|
}
|
|
17287
17515
|
render() {
|
|
17288
|
-
const { currentImage } = this.getPluginState();
|
|
17516
|
+
const { currentImage, angleGranular } = this.getPluginState();
|
|
17289
17517
|
if (currentImage === null || currentImage.isRemote) {
|
|
17290
17518
|
return null;
|
|
17291
17519
|
}
|
|
17292
|
-
return (u$2(Editor, { currentImage: currentImage,
|
|
17520
|
+
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 }));
|
|
17293
17521
|
}
|
|
17294
17522
|
}
|
|
17295
17523
|
|
|
@@ -18559,7 +18787,7 @@ const PosUpload = class {
|
|
|
18559
18787
|
}
|
|
18560
18788
|
}
|
|
18561
18789
|
render() {
|
|
18562
|
-
return h$4("div", { key: '
|
|
18790
|
+
return h$4("div", { key: 'bba1889322d2bb688881bcab1797dbc2a325e4e3', class: "container", ref: el => (this.uppy = el) });
|
|
18563
18791
|
}
|
|
18564
18792
|
};
|
|
18565
18793
|
PosUpload.style = posUploadCss();
|
|
@@ -18715,51 +18943,6 @@ __decorateClass([
|
|
|
18715
18943
|
|
|
18716
18944
|
SlAvatar.define("sl-avatar");
|
|
18717
18945
|
|
|
18718
|
-
// src/components/divider/divider.styles.ts
|
|
18719
|
-
var divider_styles_default = i$5`
|
|
18720
|
-
:host {
|
|
18721
|
-
--color: var(--sl-panel-border-color);
|
|
18722
|
-
--width: var(--sl-panel-border-width);
|
|
18723
|
-
--spacing: var(--sl-spacing-medium);
|
|
18724
|
-
}
|
|
18725
|
-
|
|
18726
|
-
:host(:not([vertical])) {
|
|
18727
|
-
display: block;
|
|
18728
|
-
border-top: solid var(--width) var(--color);
|
|
18729
|
-
margin: var(--spacing) 0;
|
|
18730
|
-
}
|
|
18731
|
-
|
|
18732
|
-
:host([vertical]) {
|
|
18733
|
-
display: inline-block;
|
|
18734
|
-
height: 100%;
|
|
18735
|
-
border-left: solid var(--width) var(--color);
|
|
18736
|
-
margin: 0 var(--spacing);
|
|
18737
|
-
}
|
|
18738
|
-
`;
|
|
18739
|
-
|
|
18740
|
-
var SlDivider = class extends ShoelaceElement {
|
|
18741
|
-
constructor() {
|
|
18742
|
-
super(...arguments);
|
|
18743
|
-
this.vertical = false;
|
|
18744
|
-
}
|
|
18745
|
-
connectedCallback() {
|
|
18746
|
-
super.connectedCallback();
|
|
18747
|
-
this.setAttribute("role", "separator");
|
|
18748
|
-
}
|
|
18749
|
-
handleVerticalChange() {
|
|
18750
|
-
this.setAttribute("aria-orientation", this.vertical ? "vertical" : "horizontal");
|
|
18751
|
-
}
|
|
18752
|
-
};
|
|
18753
|
-
SlDivider.styles = [component_styles_default, divider_styles_default];
|
|
18754
|
-
__decorateClass([
|
|
18755
|
-
n$6({ type: Boolean, reflect: true })
|
|
18756
|
-
], SlDivider.prototype, "vertical", 2);
|
|
18757
|
-
__decorateClass([
|
|
18758
|
-
watch("vertical")
|
|
18759
|
-
], SlDivider.prototype, "handleVerticalChange", 1);
|
|
18760
|
-
|
|
18761
|
-
SlDivider.define("sl-divider");
|
|
18762
|
-
|
|
18763
18946
|
const posUserMenuCss = () => `button{display:flex;align-items:center;justify-content:center;padding:0;margin:0;border:none;background:none;cursor:pointer;border-radius:50%;pos-picture{--width:40px;--height:40px;--border-radius:50%}sl-avatar{--size:40px}}sl-dropdown{display:block}`;
|
|
18764
18947
|
|
|
18765
18948
|
const PosUserMenu = class {
|
|
@@ -18785,10 +18968,10 @@ const PosUserMenu = class {
|
|
|
18785
18968
|
}
|
|
18786
18969
|
render() {
|
|
18787
18970
|
if (!this.webId)
|
|
18788
|
-
return null;
|
|
18971
|
+
return null;
|
|
18789
18972
|
return (h$4("pos-resource", { uri: this.webId }, h$4("sl-dropdown", null, h$4("button", { slot: "trigger", "aria-label": "User menu" }, h$4("pos-picture", { "no-upload": true }, h$4("sl-avatar", null))), h$4("sl-menu", null, h$4("sl-menu-item", { value: "dashboard" }, "Dashboard"), h$4("sl-menu-item", { value: "profile" }, h$4("pos-label", null)), h$4("sl-menu-item", { value: "settings" }, "Settings"), h$4("sl-divider", null), h$4("sl-menu-item", { value: "logout" }, "Logout")))));
|
|
18790
18973
|
}
|
|
18791
18974
|
};
|
|
18792
18975
|
PosUserMenu.style = posUserMenuCss();
|
|
18793
18976
|
|
|
18794
|
-
export { PosAddNewThing as pos_add_new_thing, PosApp as pos_app, PosAppBrowser as pos_app_browser, PosAppDashboard as pos_app_dashboard, PosAppSettings as pos_app_settings, PosDescription as pos_description, PosDialog as pos_dialog, PosErrorToast as pos_error_toast, PosExampleResources as pos_example_resources, PosGettingStarted as pos_getting_started, PosImage as pos_image, PosInternalRouter as pos_internal_router, PosLabel as pos_label, PosLogin as pos_login, PosLoginForm as pos_login_form, PosMakeFindable as pos_make_findable, PosNavigation as pos_navigation, PosNavigationBar as pos_navigation_bar, PosNewThingForm as pos_new_thing_form, PosPicture as pos_picture, PosPredicate as pos_predicate, PosResource as pos_resource, PosRichLink as pos_rich_link, PosRouter as pos_router, PosSelectTerm as pos_select_term, PosSettingOfflineCache as pos_setting_offline_cache, PosToolSelect as pos_tool_select, PosTypeIndexEntries as pos_type_index_entries, PosTypeRouter as pos_type_router, PosUpload as pos_upload, PosUserMenu as pos_user_menu };
|
|
18977
|
+
export { PosAddNewThing as pos_add_new_thing, PosApp as pos_app, PosAppBrowser as pos_app_browser, PosAppDashboard as pos_app_dashboard, PosAppSettings as pos_app_settings, PosDescription as pos_description, PosDialog as pos_dialog, PosErrorToast as pos_error_toast, PosExampleResources as pos_example_resources, PosGettingStarted as pos_getting_started, PosImage as pos_image, PosInternalRouter as pos_internal_router, PosLabel as pos_label, PosLogin as pos_login, PosLoginForm as pos_login_form, PosMakeFindable as pos_make_findable, PosNavigation as pos_navigation, PosNavigationBar as pos_navigation_bar, PosNewThingForm as pos_new_thing_form, PosPicture as pos_picture, PosPredicate as pos_predicate, PosResource as pos_resource, PosRichLink as pos_rich_link, PosRouter as pos_router, PosSelectTerm as pos_select_term, PosSettingOfflineCache as pos_setting_offline_cache, PosShare as pos_share, PosToolSelect as pos_tool_select, PosTypeIndexEntries as pos_type_index_entries, PosTypeRouter as pos_type_router, PosUpload as pos_upload, PosUserMenu as pos_user_menu };
|