@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,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var chunk_ZGGPD2XJ = require('./chunk.ZGGPD2XJ-
|
|
5
|
-
var chunk_XQ2OKYYA = require('./chunk.XQ2OKYYA-
|
|
6
|
-
var index$1 = require('./index-
|
|
3
|
+
var index = require('./index-Be_lnf0w.js');
|
|
4
|
+
var chunk_ZGGPD2XJ = require('./chunk.ZGGPD2XJ-Cj6xUx2M.js');
|
|
5
|
+
var chunk_XQ2OKYYA = require('./chunk.XQ2OKYYA-D224sdKt.js');
|
|
6
|
+
var index$1 = require('./index-OR1wNkjG.js');
|
|
7
7
|
var index$2 = require('./index-DlHQ3blV.js');
|
|
8
|
-
var chunk_URTPIBTY = require('./chunk.URTPIBTY-
|
|
9
|
-
var classMap = require('./class-map-
|
|
8
|
+
var chunk_URTPIBTY = require('./chunk.URTPIBTY-DcQsb_nW.js');
|
|
9
|
+
var classMap = require('./class-map-Nx8L8ElN.js');
|
|
10
10
|
var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
|
|
11
11
|
var PodOsAware = require('./PodOsAware-_Lsp4KsV.js');
|
|
12
12
|
var usePodOS = require('./usePodOS-BnFzjtlx.js');
|
|
@@ -5350,7 +5350,7 @@ chunk_ZGGPD2XJ.__decorateClass([
|
|
|
5350
5350
|
|
|
5351
5351
|
SlMenuItem.define("sl-menu-item");
|
|
5352
5352
|
|
|
5353
|
-
const posMakeFindableCss = () => `button.main{display:flex;transition:width 200ms
|
|
5353
|
+
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}}`;
|
|
5354
5354
|
|
|
5355
5355
|
const PosMakeFindable = class {
|
|
5356
5356
|
constructor(hostRef) {
|
|
@@ -5580,7 +5580,7 @@ const PosNavigation = class {
|
|
|
5580
5580
|
};
|
|
5581
5581
|
PosNavigation.style = posNavigationCss();
|
|
5582
5582
|
|
|
5583
|
-
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)}
|
|
5583
|
+
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)}}}`;
|
|
5584
5584
|
|
|
5585
5585
|
const PosNavigationBar = class {
|
|
5586
5586
|
constructor(hostRef) {
|
|
@@ -5598,7 +5598,7 @@ const PosNavigationBar = class {
|
|
|
5598
5598
|
}
|
|
5599
5599
|
render() {
|
|
5600
5600
|
const ariaLabel = this.current ? `${this.current.label()} (Click to search or enter URI)` : 'Search or enter URI';
|
|
5601
|
-
return (index.h("section", { key: '5f49aa9dad9d07550ee8ffbee90036cbc1efda55', class: "current" }, this.current && this.searchIndexReady && index.h("pos-make-findable", { key: '85974a4772aaf8cad3a11cdcd49e6df10141bfe3', uri: this.current.uri }), index.h("button", { key: '40660a3455b0f3392c68d7aea0075b102a1762a2', "aria-label": ariaLabel, onClick: () => this.onClick() }, index.h("div", { key: '9ab8922175d701f714f72aefb95745cf5ae4bb95' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon())));
|
|
5601
|
+
return (index.h("section", { key: '5f49aa9dad9d07550ee8ffbee90036cbc1efda55', class: "current" }, this.current && this.searchIndexReady && index.h("pos-make-findable", { key: '85974a4772aaf8cad3a11cdcd49e6df10141bfe3', uri: this.current.uri }), index.h("button", { key: '40660a3455b0f3392c68d7aea0075b102a1762a2', "aria-label": ariaLabel, onClick: () => this.onClick() }, index.h("div", { key: '9ab8922175d701f714f72aefb95745cf5ae4bb95' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon()), this.current && index.h("pos-share", { key: '3b80c1987f9f5138b11b8a106171fc73a236f426', uri: this.current.uri })));
|
|
5602
5602
|
}
|
|
5603
5603
|
icon() {
|
|
5604
5604
|
return (index.h("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor" }, index.h("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" })));
|
|
@@ -5626,7 +5626,7 @@ const PosNewThingForm = class {
|
|
|
5626
5626
|
PodOsAware.subscribePodOs(this);
|
|
5627
5627
|
}
|
|
5628
5628
|
render() {
|
|
5629
|
-
return (index.h("form", { key: '
|
|
5629
|
+
return (index.h("form", { key: '64781cfb0e570d2368325d674c6637c581bb87c2', method: "dialog", onSubmit: e => this.handleSubmit(e) }, index.h("label", { key: '409e04f147430042eb334024fc7061574ab543cf', htmlFor: "type" }, "Type"), index.h("pos-select-term", { key: '8d5d580ee1f1e2e2c60cac0cc06798e94a0d28c3', id: "type", placeholder: "", value: this.selectedTypeUri, "onPod-os:term-selected": e => this.onTermSelected(e) }), index.h("label", { key: 'a45199618751e24b7d4a1bc13ad85c599cc93d1c', htmlFor: "name" }, "Name"), index.h("input", { key: 'bee3be7a680abbffc08caa5c549b68b1e653872d', id: "name", type: "text", value: this.name, onInput: e => this.handleChange(e) }), this.newUri ? (index.h("div", { id: "new-uri", title: "This will be the URI of the new thing" }, this.newUri)) : null, index.h("input", { key: 'e8fab4d442188f7f2f325ff7bde3dce6d3f772f6', id: "create", type: "submit", value: "Create", disabled: !this.canSubmit })));
|
|
5630
5630
|
}
|
|
5631
5631
|
handleChange(event) {
|
|
5632
5632
|
this.name = event.target.value;
|
|
@@ -6213,7 +6213,7 @@ const PosRouter = class {
|
|
|
6213
6213
|
this.routeChanged.emit(this.uri);
|
|
6214
6214
|
}
|
|
6215
6215
|
render() {
|
|
6216
|
-
return index.h("slot", { key: '
|
|
6216
|
+
return index.h("slot", { key: '2775fc2835158ccd8d540e4f27edfd497eafe7a9' });
|
|
6217
6217
|
}
|
|
6218
6218
|
};
|
|
6219
6219
|
PosRouter.style = posRouterCss();
|
|
@@ -6242,7 +6242,7 @@ const PosSelectTerm = class {
|
|
|
6242
6242
|
this.termSelected.emit({ uri: event.target.value });
|
|
6243
6243
|
}
|
|
6244
6244
|
render() {
|
|
6245
|
-
return (index.h(index.Host, { key: '
|
|
6245
|
+
return (index.h(index.Host, { key: 'a4050d72acd62d907f0fd4c3b90c54194700871c' }, index.h("input", { key: '99b35c4a14a2623599ba237bb4af0b79c0761196', part: "input", list: "terms", placeholder: this.placeholder, value: this.value, onChange: ev => this.handleChange(ev) }), index.h("datalist", { key: 'd64ad5ea83200014c6de5cd4720f29922494982c', part: "terms", id: "terms" }, this.terms.map(term => (index.h("option", { value: term.uri }, term.shorthand))))));
|
|
6246
6246
|
}
|
|
6247
6247
|
static get delegatesFocus() { return true; }
|
|
6248
6248
|
static get watchers() { return {
|
|
@@ -6265,7 +6265,104 @@ const PosSettingOfflineCache = class {
|
|
|
6265
6265
|
};
|
|
6266
6266
|
PosSettingOfflineCache.style = posSettingOfflineCacheCss();
|
|
6267
6267
|
|
|
6268
|
-
|
|
6268
|
+
// src/components/divider/divider.styles.ts
|
|
6269
|
+
var divider_styles_default = chunk_ZGGPD2XJ.i`
|
|
6270
|
+
:host {
|
|
6271
|
+
--color: var(--sl-panel-border-color);
|
|
6272
|
+
--width: var(--sl-panel-border-width);
|
|
6273
|
+
--spacing: var(--sl-spacing-medium);
|
|
6274
|
+
}
|
|
6275
|
+
|
|
6276
|
+
:host(:not([vertical])) {
|
|
6277
|
+
display: block;
|
|
6278
|
+
border-top: solid var(--width) var(--color);
|
|
6279
|
+
margin: var(--spacing) 0;
|
|
6280
|
+
}
|
|
6281
|
+
|
|
6282
|
+
:host([vertical]) {
|
|
6283
|
+
display: inline-block;
|
|
6284
|
+
height: 100%;
|
|
6285
|
+
border-left: solid var(--width) var(--color);
|
|
6286
|
+
margin: 0 var(--spacing);
|
|
6287
|
+
}
|
|
6288
|
+
`;
|
|
6289
|
+
|
|
6290
|
+
var SlDivider = class extends chunk_ZGGPD2XJ.ShoelaceElement {
|
|
6291
|
+
constructor() {
|
|
6292
|
+
super(...arguments);
|
|
6293
|
+
this.vertical = false;
|
|
6294
|
+
}
|
|
6295
|
+
connectedCallback() {
|
|
6296
|
+
super.connectedCallback();
|
|
6297
|
+
this.setAttribute("role", "separator");
|
|
6298
|
+
}
|
|
6299
|
+
handleVerticalChange() {
|
|
6300
|
+
this.setAttribute("aria-orientation", this.vertical ? "vertical" : "horizontal");
|
|
6301
|
+
}
|
|
6302
|
+
};
|
|
6303
|
+
SlDivider.styles = [chunk_ZGGPD2XJ.component_styles_default, divider_styles_default];
|
|
6304
|
+
chunk_ZGGPD2XJ.__decorateClass([
|
|
6305
|
+
chunk_ZGGPD2XJ.n({ type: Boolean, reflect: true })
|
|
6306
|
+
], SlDivider.prototype, "vertical", 2);
|
|
6307
|
+
chunk_ZGGPD2XJ.__decorateClass([
|
|
6308
|
+
chunk_ZGGPD2XJ.watch("vertical")
|
|
6309
|
+
], SlDivider.prototype, "handleVerticalChange", 1);
|
|
6310
|
+
|
|
6311
|
+
SlDivider.define("sl-divider");
|
|
6312
|
+
|
|
6313
|
+
function openNewTab(url) {
|
|
6314
|
+
window.open(url.toString(), '_blank');
|
|
6315
|
+
}
|
|
6316
|
+
|
|
6317
|
+
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}}`;
|
|
6318
|
+
|
|
6319
|
+
const PosShare = class {
|
|
6320
|
+
constructor(hostRef) {
|
|
6321
|
+
index.registerInstance(this, hostRef);
|
|
6322
|
+
this.apps = [];
|
|
6323
|
+
}
|
|
6324
|
+
async resourceLoaded(e) {
|
|
6325
|
+
if (e.detail === this.uri) {
|
|
6326
|
+
await this.updateApps();
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6329
|
+
async componentWillLoad() {
|
|
6330
|
+
this.os = await usePodOS.usePodOS(this.el);
|
|
6331
|
+
await this.updateApps();
|
|
6332
|
+
}
|
|
6333
|
+
async updateApps() {
|
|
6334
|
+
const thing = this.os.store.get(this.uri);
|
|
6335
|
+
this.apps = this.os.proposeAppsFor(thing);
|
|
6336
|
+
}
|
|
6337
|
+
onSelect(e) {
|
|
6338
|
+
const { value } = e.detail.item;
|
|
6339
|
+
if (value === 'copy-uri') {
|
|
6340
|
+
navigator.clipboard.writeText(this.uri);
|
|
6341
|
+
}
|
|
6342
|
+
else {
|
|
6343
|
+
openNewTab(value.urlTemplate.expand({ uri: this.uri }));
|
|
6344
|
+
}
|
|
6345
|
+
}
|
|
6346
|
+
render() {
|
|
6347
|
+
return (index.h("sl-dropdown", { key: '67ce5a1f7e5630ff40a6e79eaa9ab7f32b5f1a00' }, index.h("button", { key: '6c946718e7af9f0ef212c3853641f06a24d79474', slot: "trigger", "aria-label": "Share", part: "button" }, index.h("sl-icon", { key: 'effc4e9bdf4236451636f1b4622605c87746d414', name: "share" })), index.h("sl-menu", { key: '2f1c8e707e71a699803c2897fda8f1e79ccd5267' }, index.h("sl-menu-item", { key: '5a59cffe8351c23389620b38b60f8ccd24dce351', value: "copy-uri" }, index.h("sl-icon", { key: 'ab9b9d7f8a2a91e0a4f5ac657b9ff390418948cc', slot: "prefix", name: "copy" }), "Copy URI"), this.apps.length > 0 && index.h(OpenWithApps, { key: '718fbda37b7171df356afe02e6d6f7f1e8e8cd26', apps: this.apps }))));
|
|
6348
|
+
}
|
|
6349
|
+
get el() { return index.getElement(this); }
|
|
6350
|
+
static get watchers() { return {
|
|
6351
|
+
"uri": [{
|
|
6352
|
+
"updateApps": 0
|
|
6353
|
+
}]
|
|
6354
|
+
}; }
|
|
6355
|
+
};
|
|
6356
|
+
function OpenWithApps({ apps }) {
|
|
6357
|
+
return [
|
|
6358
|
+
index.h("sl-divider", null),
|
|
6359
|
+
index.h("sl-menu-item", { disabled: true }, "Open with..."),
|
|
6360
|
+
apps.map(it => index.h("sl-menu-item", { value: it }, it.name)),
|
|
6361
|
+
];
|
|
6362
|
+
}
|
|
6363
|
+
PosShare.style = posShareCss();
|
|
6364
|
+
|
|
6365
|
+
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); } } } } `;
|
|
6269
6366
|
|
|
6270
6367
|
const PosToolSelect = class {
|
|
6271
6368
|
constructor(hostRef) {
|
|
@@ -6288,7 +6385,7 @@ const PosToolSelect = class {
|
|
|
6288
6385
|
};
|
|
6289
6386
|
PosToolSelect.style = posToolSelectCss();
|
|
6290
6387
|
|
|
6291
|
-
const posTypeIndexEntriesCss = () => `dl {
|
|
6388
|
+
const posTypeIndexEntriesCss = () => `dl { > * { display: flex; flex-direction: column; gap: var(--size-1); } display: flex; flex-direction: column; gap: var(--size-4); dd { margin: 0; } } `;
|
|
6292
6389
|
|
|
6293
6390
|
const PosTypeIndexEntries = class {
|
|
6294
6391
|
constructor(hostRef) {
|
|
@@ -10742,7 +10839,7 @@ class ThumbnailGenerator extends UIPlugin {
|
|
|
10742
10839
|
}
|
|
10743
10840
|
}
|
|
10744
10841
|
|
|
10745
|
-
const version$2 = "5.1.
|
|
10842
|
+
const version$2 = "5.1.1";
|
|
10746
10843
|
var packageJson$2 = {
|
|
10747
10844
|
version: version$2};
|
|
10748
10845
|
|
|
@@ -13316,8 +13413,8 @@ class Dashboard extends UIPlugin {
|
|
|
13316
13413
|
this.uppy.off('complete', this.handleComplete);
|
|
13317
13414
|
this.uppy.off('files-added', this.#generateLargeThumbnailIfSingleFile);
|
|
13318
13415
|
this.uppy.off('file-removed', this.#generateLargeThumbnailIfSingleFile);
|
|
13319
|
-
document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently);
|
|
13320
|
-
document.removeEventListener('click', this.recordIfFocusedOnUppyRecently);
|
|
13416
|
+
document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently, true);
|
|
13417
|
+
document.removeEventListener('click', this.recordIfFocusedOnUppyRecently, true);
|
|
13321
13418
|
if (this.opts.inline) {
|
|
13322
13419
|
this.el.removeEventListener('keydown', this.handleKeyDownInInline);
|
|
13323
13420
|
}
|
|
@@ -13634,10 +13731,6 @@ class Dashboard extends UIPlugin {
|
|
|
13634
13731
|
};
|
|
13635
13732
|
}
|
|
13636
13733
|
|
|
13637
|
-
const version$1 = "4.1.0";
|
|
13638
|
-
var packageJson$1 = {
|
|
13639
|
-
version: version$1};
|
|
13640
|
-
|
|
13641
13734
|
var cropper$1 = {exports: {}};
|
|
13642
13735
|
|
|
13643
13736
|
/*!
|
|
@@ -16924,6 +17017,87 @@ function requireCropper () {
|
|
|
16924
17017
|
var cropperExports = requireCropper();
|
|
16925
17018
|
var Cropper = /*@__PURE__*/getDefaultExportFromCjs(cropperExports);
|
|
16926
17019
|
|
|
17020
|
+
const version$1 = "4.2.0";
|
|
17021
|
+
var packageJson$1 = {
|
|
17022
|
+
version: version$1};
|
|
17023
|
+
|
|
17024
|
+
class Editor extends x {
|
|
17025
|
+
imgElement;
|
|
17026
|
+
componentDidMount() {
|
|
17027
|
+
const { initCropper } = this.props;
|
|
17028
|
+
if (this.imgElement) {
|
|
17029
|
+
initCropper(this.imgElement);
|
|
17030
|
+
}
|
|
17031
|
+
}
|
|
17032
|
+
onRotate90Deg = () => {
|
|
17033
|
+
this.props.rotateBy(-90);
|
|
17034
|
+
};
|
|
17035
|
+
onRotateGranular = (ev) => {
|
|
17036
|
+
const newGranularAngle = Number(ev.target.value);
|
|
17037
|
+
this.props.rotateGranular(newGranularAngle);
|
|
17038
|
+
};
|
|
17039
|
+
renderGranularRotate() {
|
|
17040
|
+
const { i18n } = this.props;
|
|
17041
|
+
const { angleGranular } = this.props;
|
|
17042
|
+
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') }) }));
|
|
17043
|
+
}
|
|
17044
|
+
renderRevert() {
|
|
17045
|
+
const { i18n } = this.props;
|
|
17046
|
+
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
|
|
17047
|
+
this.props.reset();
|
|
17048
|
+
}, 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" })] }) }));
|
|
17049
|
+
}
|
|
17050
|
+
renderRotate() {
|
|
17051
|
+
const { i18n } = this.props;
|
|
17052
|
+
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" })] }) }));
|
|
17053
|
+
}
|
|
17054
|
+
renderFlip() {
|
|
17055
|
+
const { i18n } = this.props;
|
|
17056
|
+
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" })] }) }));
|
|
17057
|
+
}
|
|
17058
|
+
renderZoomIn() {
|
|
17059
|
+
const { i18n } = this.props;
|
|
17060
|
+
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" })] }) }));
|
|
17061
|
+
}
|
|
17062
|
+
renderZoomOut() {
|
|
17063
|
+
const { i18n } = this.props;
|
|
17064
|
+
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" })] }) }));
|
|
17065
|
+
}
|
|
17066
|
+
renderCropSquare() {
|
|
17067
|
+
const { i18n } = this.props;
|
|
17068
|
+
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" })] }) }));
|
|
17069
|
+
}
|
|
17070
|
+
renderCropWidescreen() {
|
|
17071
|
+
const { i18n } = this.props;
|
|
17072
|
+
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" })] }) }));
|
|
17073
|
+
}
|
|
17074
|
+
renderCropWidescreenVertical() {
|
|
17075
|
+
const { i18n } = this.props;
|
|
17076
|
+
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" })] }) }));
|
|
17077
|
+
}
|
|
17078
|
+
render() {
|
|
17079
|
+
const { currentImage, objectUrl, opts } = this.props;
|
|
17080
|
+
const { actions } = opts;
|
|
17081
|
+
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) => {
|
|
17082
|
+
this.imgElement = ref;
|
|
17083
|
+
} }) }), 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 &&
|
|
17084
|
+
this.renderCropWidescreenVertical()] })] }));
|
|
17085
|
+
}
|
|
17086
|
+
}
|
|
17087
|
+
|
|
17088
|
+
var locale$1 = {
|
|
17089
|
+
strings: {
|
|
17090
|
+
revert: 'Reset',
|
|
17091
|
+
rotate: 'Rotate 90°',
|
|
17092
|
+
zoomIn: 'Zoom in',
|
|
17093
|
+
zoomOut: 'Zoom out',
|
|
17094
|
+
flipHorizontal: 'Flip horizontally',
|
|
17095
|
+
aspectRatioSquare: 'Crop square',
|
|
17096
|
+
aspectRatioLandscape: 'Crop landscape (16:9)',
|
|
17097
|
+
aspectRatioPortrait: 'Crop portrait (9:16)',
|
|
17098
|
+
},
|
|
17099
|
+
};
|
|
17100
|
+
|
|
16927
17101
|
// See this cropperjs image to understand how container/image/canavas/cropbox relate to each other.
|
|
16928
17102
|
// (https://github.com/fengyuanchen/cropperjs/blob/9b528a8baeaae876dc090085e37992a1683c6f34/docs/images/layers.jpg)
|
|
16929
17103
|
//
|
|
@@ -17018,155 +17192,13 @@ function limitCropboxMovementOnResize(canvas, cropboxData, prevCropbox) {
|
|
|
17018
17192
|
return null;
|
|
17019
17193
|
}
|
|
17020
17194
|
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
angle90Deg: 0,
|
|
17028
|
-
angleGranular: 0,
|
|
17029
|
-
prevCropboxData: null,
|
|
17030
|
-
};
|
|
17031
|
-
this.storePrevCropboxData = this.storePrevCropboxData.bind(this);
|
|
17032
|
-
this.limitCropboxMovement = this.limitCropboxMovement.bind(this);
|
|
17033
|
-
}
|
|
17034
|
-
componentDidMount() {
|
|
17035
|
-
const { opts, storeCropperInstance } = this.props;
|
|
17036
|
-
this.cropper = new Cropper(this.imgElement, opts.cropperOptions);
|
|
17037
|
-
this.imgElement.addEventListener('cropstart', this.storePrevCropboxData);
|
|
17038
|
-
// @ts-expect-error custom cropper event but DOM API does not understand
|
|
17039
|
-
this.imgElement.addEventListener('cropend', this.limitCropboxMovement);
|
|
17040
|
-
storeCropperInstance(this.cropper);
|
|
17041
|
-
}
|
|
17042
|
-
componentWillUnmount() {
|
|
17043
|
-
this.cropper.destroy();
|
|
17044
|
-
this.imgElement.removeEventListener('cropstart', this.storePrevCropboxData);
|
|
17045
|
-
// @ts-expect-error custom cropper event but DOM API does not understand
|
|
17046
|
-
this.imgElement.removeEventListener('cropend', this.limitCropboxMovement);
|
|
17047
|
-
}
|
|
17048
|
-
storePrevCropboxData() {
|
|
17049
|
-
this.setState({ prevCropboxData: this.cropper.getCropBoxData() });
|
|
17050
|
-
}
|
|
17051
|
-
limitCropboxMovement(event) {
|
|
17052
|
-
const canvasData = this.cropper.getCanvasData();
|
|
17053
|
-
const cropboxData = this.cropper.getCropBoxData();
|
|
17054
|
-
const { prevCropboxData } = this.state;
|
|
17055
|
-
// 1. When we grab the cropbox in the middle and move it
|
|
17056
|
-
if (event.detail.action === 'all') {
|
|
17057
|
-
const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, prevCropboxData);
|
|
17058
|
-
if (newCropboxData)
|
|
17059
|
-
this.cropper.setCropBoxData(newCropboxData);
|
|
17060
|
-
// 2. When we stretch the cropbox by one of its sides
|
|
17061
|
-
}
|
|
17062
|
-
else {
|
|
17063
|
-
const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, prevCropboxData);
|
|
17064
|
-
if (newCropboxData)
|
|
17065
|
-
this.cropper.setCropBoxData(newCropboxData);
|
|
17066
|
-
}
|
|
17067
|
-
}
|
|
17068
|
-
onRotate90Deg = () => {
|
|
17069
|
-
// 1. Set state
|
|
17070
|
-
const { angle90Deg } = this.state;
|
|
17071
|
-
const newAngle = angle90Deg - 90;
|
|
17072
|
-
this.setState({
|
|
17073
|
-
angle90Deg: newAngle,
|
|
17074
|
-
angleGranular: 0,
|
|
17075
|
-
});
|
|
17076
|
-
// 2. Rotate the image
|
|
17077
|
-
// Important to reset scale here, or cropper will get confused on further rotations
|
|
17078
|
-
this.cropper.scale(1);
|
|
17079
|
-
this.cropper.rotateTo(newAngle);
|
|
17080
|
-
// 3. Fit the rotated image into the view
|
|
17081
|
-
const canvasData = this.cropper.getCanvasData();
|
|
17082
|
-
const containerData = this.cropper.getContainerData();
|
|
17083
|
-
const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
|
|
17084
|
-
this.cropper.setCanvasData(newCanvasData);
|
|
17085
|
-
// 4. Make cropbox fully wrap the image
|
|
17086
|
-
this.cropper.setCropBoxData(newCanvasData);
|
|
17087
|
-
};
|
|
17088
|
-
onRotateGranular = (ev) => {
|
|
17089
|
-
// 1. Set state
|
|
17090
|
-
const newGranularAngle = Number(ev.target.value);
|
|
17091
|
-
this.setState({ angleGranular: newGranularAngle });
|
|
17092
|
-
// 2. Rotate the image
|
|
17093
|
-
const { angle90Deg } = this.state;
|
|
17094
|
-
const newAngle = angle90Deg + newGranularAngle;
|
|
17095
|
-
this.cropper.rotateTo(newAngle);
|
|
17096
|
-
// 3. Scale the image so that it fits into the cropbox
|
|
17097
|
-
const image = this.cropper.getImageData();
|
|
17098
|
-
const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, newGranularAngle);
|
|
17099
|
-
// Preserve flip
|
|
17100
|
-
const scaleFactorX = this.cropper.getImageData().scaleX < 0 ? -scaleFactor : scaleFactor;
|
|
17101
|
-
this.cropper.scale(scaleFactorX, scaleFactor);
|
|
17102
|
-
};
|
|
17103
|
-
renderGranularRotate() {
|
|
17104
|
-
const { i18n } = this.props;
|
|
17105
|
-
const { angleGranular } = this.state;
|
|
17106
|
-
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') }) }));
|
|
17107
|
-
}
|
|
17108
|
-
renderRevert() {
|
|
17109
|
-
const { i18n, opts } = this.props;
|
|
17110
|
-
return (u$2("button", { "data-microtip-position": "top", type: "button", className: "uppy-u-reset uppy-c-btn", "aria-label": i18n('revert'), onClick: () => {
|
|
17111
|
-
this.cropper.reset();
|
|
17112
|
-
this.cropper.setAspectRatio(opts.cropperOptions.initialAspectRatio);
|
|
17113
|
-
this.setState({ angle90Deg: 0, angleGranular: 0 });
|
|
17114
|
-
}, 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" })] }) }));
|
|
17115
|
-
}
|
|
17116
|
-
renderRotate() {
|
|
17117
|
-
const { i18n } = this.props;
|
|
17118
|
-
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" })] }) }));
|
|
17119
|
-
}
|
|
17120
|
-
renderFlip() {
|
|
17121
|
-
const { i18n } = this.props;
|
|
17122
|
-
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" })] }) }));
|
|
17123
|
-
}
|
|
17124
|
-
renderZoomIn() {
|
|
17125
|
-
const { i18n } = this.props;
|
|
17126
|
-
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" })] }) }));
|
|
17127
|
-
}
|
|
17128
|
-
renderZoomOut() {
|
|
17129
|
-
const { i18n } = this.props;
|
|
17130
|
-
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" })] }) }));
|
|
17131
|
-
}
|
|
17132
|
-
renderCropSquare() {
|
|
17133
|
-
const { i18n } = this.props;
|
|
17134
|
-
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" })] }) }));
|
|
17135
|
-
}
|
|
17136
|
-
renderCropWidescreen() {
|
|
17137
|
-
const { i18n } = this.props;
|
|
17138
|
-
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" })] }) }));
|
|
17139
|
-
}
|
|
17140
|
-
renderCropWidescreenVertical() {
|
|
17141
|
-
const { i18n } = this.props;
|
|
17142
|
-
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" })] }) }));
|
|
17143
|
-
}
|
|
17144
|
-
render() {
|
|
17145
|
-
const { currentImage, opts } = this.props;
|
|
17146
|
-
const { actions } = opts;
|
|
17147
|
-
if (currentImage.data == null)
|
|
17148
|
-
throw new Error('File data is empty');
|
|
17149
|
-
const imageURL = URL.createObjectURL(currentImage.data);
|
|
17150
|
-
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) => {
|
|
17151
|
-
this.imgElement = ref;
|
|
17152
|
-
} }) }), 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 &&
|
|
17153
|
-
this.renderCropWidescreenVertical()] })] }));
|
|
17154
|
-
}
|
|
17155
|
-
}
|
|
17156
|
-
|
|
17157
|
-
var locale$1 = {
|
|
17158
|
-
strings: {
|
|
17159
|
-
revert: 'Reset',
|
|
17160
|
-
rotate: 'Rotate 90°',
|
|
17161
|
-
zoomIn: 'Zoom in',
|
|
17162
|
-
zoomOut: 'Zoom out',
|
|
17163
|
-
flipHorizontal: 'Flip horizontally',
|
|
17164
|
-
aspectRatioSquare: 'Crop square',
|
|
17165
|
-
aspectRatioLandscape: 'Crop landscape (16:9)',
|
|
17166
|
-
aspectRatioPortrait: 'Crop portrait (9:16)',
|
|
17167
|
-
},
|
|
17195
|
+
const defaultEditorState = {
|
|
17196
|
+
angle: 0,
|
|
17197
|
+
angleGranular: 0,
|
|
17198
|
+
isFlippedHorizontally: false,
|
|
17199
|
+
aspectRatio: 'free',
|
|
17200
|
+
cropperReady: false,
|
|
17168
17201
|
};
|
|
17169
|
-
|
|
17170
17202
|
const defaultCropperOptions = {
|
|
17171
17203
|
viewMode: 0,
|
|
17172
17204
|
background: false,
|
|
@@ -17197,7 +17229,13 @@ const defaultOptions$1 = {
|
|
|
17197
17229
|
};
|
|
17198
17230
|
class ImageEditor extends UIPlugin {
|
|
17199
17231
|
static VERSION = packageJson$1.version;
|
|
17200
|
-
cropper;
|
|
17232
|
+
cropper = null;
|
|
17233
|
+
objectUrl = null;
|
|
17234
|
+
prevCropboxData = null;
|
|
17235
|
+
imgElement = null;
|
|
17236
|
+
cropstartHandler = null;
|
|
17237
|
+
cropendHandler = null;
|
|
17238
|
+
cropperReadyHandler = null;
|
|
17201
17239
|
constructor(uppy, opts) {
|
|
17202
17240
|
super(uppy, {
|
|
17203
17241
|
...defaultOptions$1,
|
|
@@ -17228,9 +17266,18 @@ class ImageEditor extends UIPlugin {
|
|
|
17228
17266
|
return false;
|
|
17229
17267
|
}
|
|
17230
17268
|
save = () => {
|
|
17269
|
+
const { currentImage } = this.getPluginState();
|
|
17270
|
+
if (!currentImage)
|
|
17271
|
+
return;
|
|
17272
|
+
if (!this.cropper)
|
|
17273
|
+
return;
|
|
17231
17274
|
const saveBlobCallback = (blob) => {
|
|
17232
|
-
|
|
17233
|
-
|
|
17275
|
+
if (!blob)
|
|
17276
|
+
return;
|
|
17277
|
+
const fileId = currentImage.id;
|
|
17278
|
+
if (!this.uppy.getFile(fileId))
|
|
17279
|
+
return;
|
|
17280
|
+
this.uppy.setFileState(fileId, {
|
|
17234
17281
|
// Reinserting image's name and type, because .toBlob loses both.
|
|
17235
17282
|
data: new File([blob], currentImage.name ?? this.i18n('unnamed'), {
|
|
17236
17283
|
type: blob.type,
|
|
@@ -17238,14 +17285,15 @@ class ImageEditor extends UIPlugin {
|
|
|
17238
17285
|
size: blob.size,
|
|
17239
17286
|
preview: undefined,
|
|
17240
17287
|
});
|
|
17241
|
-
const updatedFile = this.uppy.getFile(
|
|
17288
|
+
const updatedFile = this.uppy.getFile(fileId);
|
|
17289
|
+
if (!updatedFile)
|
|
17290
|
+
return;
|
|
17242
17291
|
this.uppy.emit('thumbnail:request', updatedFile);
|
|
17243
17292
|
this.setPluginState({
|
|
17244
17293
|
currentImage: updatedFile,
|
|
17245
17294
|
});
|
|
17246
17295
|
this.uppy.emit('file-editor:complete', updatedFile);
|
|
17247
17296
|
};
|
|
17248
|
-
const { currentImage } = this.getPluginState();
|
|
17249
17297
|
// Fixes black 1px lines on odd-width images.
|
|
17250
17298
|
// This should be removed when cropperjs fixes this issue.
|
|
17251
17299
|
// (See https://github.com/transloadit/uppy/issues/4305 and https://github.com/fengyuanchen/cropperjs/issues/551).
|
|
@@ -17264,15 +17312,194 @@ class ImageEditor extends UIPlugin {
|
|
|
17264
17312
|
this.cropper = cropper;
|
|
17265
17313
|
};
|
|
17266
17314
|
selectFile = (file) => {
|
|
17267
|
-
this.
|
|
17315
|
+
this.start(file);
|
|
17316
|
+
};
|
|
17317
|
+
resetEditorState = (currentImage = this.getPluginState().currentImage) => {
|
|
17268
17318
|
this.setPluginState({
|
|
17269
|
-
currentImage
|
|
17319
|
+
currentImage,
|
|
17320
|
+
...defaultEditorState,
|
|
17321
|
+
// Preserve cropperReady if cropper instance exists
|
|
17322
|
+
cropperReady: !!this.cropper,
|
|
17270
17323
|
});
|
|
17271
17324
|
};
|
|
17272
|
-
|
|
17325
|
+
rotateBy = (degrees) => {
|
|
17326
|
+
if (!this.cropper)
|
|
17327
|
+
return;
|
|
17328
|
+
const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
|
|
17329
|
+
const base90 = angle - angleGranular;
|
|
17330
|
+
const newAngle = base90 + degrees;
|
|
17331
|
+
this.cropper.scale(isFlippedHorizontally ? -1 : 1);
|
|
17332
|
+
this.cropper.rotateTo(newAngle);
|
|
17333
|
+
const canvasData = this.cropper.getCanvasData();
|
|
17334
|
+
const containerData = this.cropper.getContainerData();
|
|
17335
|
+
const newCanvasData = getCanvasDataThatFitsPerfectlyIntoContainer(containerData, canvasData);
|
|
17336
|
+
this.cropper.setCanvasData(newCanvasData);
|
|
17337
|
+
this.cropper.setCropBoxData(newCanvasData);
|
|
17338
|
+
this.setPluginState({
|
|
17339
|
+
angle: newAngle,
|
|
17340
|
+
angleGranular: 0,
|
|
17341
|
+
});
|
|
17342
|
+
};
|
|
17343
|
+
rotateGranular = (granularAngle) => {
|
|
17344
|
+
if (!this.cropper)
|
|
17345
|
+
return;
|
|
17346
|
+
const { angle, angleGranular, isFlippedHorizontally } = this.getPluginState();
|
|
17347
|
+
const base90 = angle - angleGranular;
|
|
17348
|
+
const newAngle = base90 + granularAngle;
|
|
17349
|
+
this.cropper.rotateTo(newAngle);
|
|
17350
|
+
const image = this.cropper.getImageData();
|
|
17351
|
+
const scaleFactor = getScaleFactorThatRemovesDarkCorners(image.naturalWidth, image.naturalHeight, granularAngle);
|
|
17352
|
+
const scaleFactorX = isFlippedHorizontally ? -scaleFactor : scaleFactor;
|
|
17353
|
+
this.cropper.scale(scaleFactorX, scaleFactor);
|
|
17354
|
+
this.setPluginState({
|
|
17355
|
+
angle: newAngle,
|
|
17356
|
+
angleGranular: granularAngle,
|
|
17357
|
+
});
|
|
17358
|
+
};
|
|
17359
|
+
flipHorizontal = () => {
|
|
17360
|
+
if (!this.cropper)
|
|
17361
|
+
return;
|
|
17362
|
+
const { isFlippedHorizontally } = this.getPluginState();
|
|
17363
|
+
this.cropper.scaleX(-this.cropper.getData().scaleX || -1);
|
|
17364
|
+
this.setPluginState({
|
|
17365
|
+
isFlippedHorizontally: !isFlippedHorizontally,
|
|
17366
|
+
});
|
|
17367
|
+
};
|
|
17368
|
+
zoom = (ratio) => {
|
|
17369
|
+
if (!this.cropper)
|
|
17370
|
+
return;
|
|
17371
|
+
this.cropper.zoom(ratio);
|
|
17372
|
+
};
|
|
17373
|
+
setAspectRatio = (newRatio) => {
|
|
17374
|
+
if (!this.cropper)
|
|
17375
|
+
return;
|
|
17376
|
+
const ratioMap = {
|
|
17377
|
+
free: 0,
|
|
17378
|
+
'1:1': 1,
|
|
17379
|
+
'16:9': 16 / 9,
|
|
17380
|
+
'9:16': 9 / 16,
|
|
17381
|
+
};
|
|
17382
|
+
this.cropper.setAspectRatio(ratioMap[newRatio]);
|
|
17273
17383
|
this.setPluginState({
|
|
17274
|
-
|
|
17384
|
+
aspectRatio: newRatio,
|
|
17275
17385
|
});
|
|
17386
|
+
};
|
|
17387
|
+
reset = () => {
|
|
17388
|
+
if (!this.cropper)
|
|
17389
|
+
return;
|
|
17390
|
+
this.cropper.reset();
|
|
17391
|
+
this.cropper.setAspectRatio(this.opts.cropperOptions.initialAspectRatio || 0);
|
|
17392
|
+
this.resetEditorState();
|
|
17393
|
+
};
|
|
17394
|
+
/**
|
|
17395
|
+
* Start editing a file - creates object URL and prepares state.
|
|
17396
|
+
* Called by hook's start() or when user opens editor.
|
|
17397
|
+
*/
|
|
17398
|
+
start = (file) => {
|
|
17399
|
+
// Clean up any previous editing session
|
|
17400
|
+
if (this.objectUrl) {
|
|
17401
|
+
URL.revokeObjectURL(this.objectUrl);
|
|
17402
|
+
this.objectUrl = null;
|
|
17403
|
+
}
|
|
17404
|
+
// Get file data - first try the passed file, then try fetching from Uppy state
|
|
17405
|
+
let fileData = file.data;
|
|
17406
|
+
if (!(fileData instanceof Blob)) {
|
|
17407
|
+
const uppyFile = this.uppy.getFile(file.id);
|
|
17408
|
+
fileData = uppyFile?.data;
|
|
17409
|
+
}
|
|
17410
|
+
if (fileData instanceof Blob) {
|
|
17411
|
+
this.objectUrl = URL.createObjectURL(fileData);
|
|
17412
|
+
}
|
|
17413
|
+
else {
|
|
17414
|
+
// eslint-disable-next-line no-console
|
|
17415
|
+
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);
|
|
17416
|
+
}
|
|
17417
|
+
this.uppy.emit('file-editor:start', file);
|
|
17418
|
+
this.resetEditorState(file);
|
|
17419
|
+
};
|
|
17420
|
+
/**
|
|
17421
|
+
* Stop editing - destroys cropper, revokes object URL, cleans up listeners.
|
|
17422
|
+
*/
|
|
17423
|
+
stop = () => {
|
|
17424
|
+
this.destroyCropper();
|
|
17425
|
+
if (this.objectUrl) {
|
|
17426
|
+
URL.revokeObjectURL(this.objectUrl);
|
|
17427
|
+
this.objectUrl = null;
|
|
17428
|
+
}
|
|
17429
|
+
this.resetEditorState(null);
|
|
17430
|
+
};
|
|
17431
|
+
/**
|
|
17432
|
+
* Initialize cropper on the image element. Called lazily when first edit action is triggered.
|
|
17433
|
+
* For headless use, the hook provides the image element.
|
|
17434
|
+
*/
|
|
17435
|
+
initCropper = (imgElement) => {
|
|
17436
|
+
if (this.cropper)
|
|
17437
|
+
return; // Already initialized
|
|
17438
|
+
this.imgElement = imgElement;
|
|
17439
|
+
this.cropper = new Cropper(imgElement, this.opts.cropperOptions);
|
|
17440
|
+
// Store handlers so we can remove them later
|
|
17441
|
+
this.cropstartHandler = () => {
|
|
17442
|
+
if (this.cropper) {
|
|
17443
|
+
this.prevCropboxData = this.cropper.getCropBoxData();
|
|
17444
|
+
}
|
|
17445
|
+
};
|
|
17446
|
+
this.cropendHandler = ((event) => {
|
|
17447
|
+
if (!this.cropper || !this.prevCropboxData)
|
|
17448
|
+
return;
|
|
17449
|
+
const canvasData = this.cropper.getCanvasData();
|
|
17450
|
+
const cropboxData = this.cropper.getCropBoxData();
|
|
17451
|
+
if (event.detail.action === 'all') {
|
|
17452
|
+
const newCropboxData = limitCropboxMovementOnMove(canvasData, cropboxData, this.prevCropboxData);
|
|
17453
|
+
if (newCropboxData)
|
|
17454
|
+
this.cropper.setCropBoxData(newCropboxData);
|
|
17455
|
+
}
|
|
17456
|
+
else {
|
|
17457
|
+
const newCropboxData = limitCropboxMovementOnResize(canvasData, cropboxData, this.prevCropboxData);
|
|
17458
|
+
if (newCropboxData)
|
|
17459
|
+
this.cropper.setCropBoxData(newCropboxData);
|
|
17460
|
+
}
|
|
17461
|
+
});
|
|
17462
|
+
this.cropperReadyHandler = () => {
|
|
17463
|
+
this.setPluginState({ cropperReady: true });
|
|
17464
|
+
};
|
|
17465
|
+
imgElement.addEventListener('cropstart', this.cropstartHandler);
|
|
17466
|
+
imgElement.addEventListener('cropend', this.cropendHandler);
|
|
17467
|
+
imgElement.addEventListener('ready', this.cropperReadyHandler, {
|
|
17468
|
+
once: true,
|
|
17469
|
+
});
|
|
17470
|
+
};
|
|
17471
|
+
/**
|
|
17472
|
+
* Destroy cropper and clean up event listeners.
|
|
17473
|
+
*/
|
|
17474
|
+
destroyCropper = () => {
|
|
17475
|
+
if (!this.cropper)
|
|
17476
|
+
return;
|
|
17477
|
+
this.setPluginState({ cropperReady: false });
|
|
17478
|
+
if (this.cropstartHandler && this.imgElement) {
|
|
17479
|
+
this.imgElement.removeEventListener('cropstart', this.cropstartHandler);
|
|
17480
|
+
}
|
|
17481
|
+
if (this.cropendHandler && this.imgElement) {
|
|
17482
|
+
this.imgElement.removeEventListener('cropend', this.cropendHandler);
|
|
17483
|
+
}
|
|
17484
|
+
if (this.cropperReadyHandler && this.imgElement) {
|
|
17485
|
+
this.imgElement.removeEventListener('ready', this.cropperReadyHandler);
|
|
17486
|
+
}
|
|
17487
|
+
this.cropper.destroy();
|
|
17488
|
+
this.cropper = null;
|
|
17489
|
+
this.imgElement = null;
|
|
17490
|
+
this.cropstartHandler = null;
|
|
17491
|
+
this.cropendHandler = null;
|
|
17492
|
+
this.cropperReadyHandler = null;
|
|
17493
|
+
this.prevCropboxData = null;
|
|
17494
|
+
};
|
|
17495
|
+
/**
|
|
17496
|
+
* Get object URL for the current image (used by headless hook).
|
|
17497
|
+
*/
|
|
17498
|
+
getObjectUrl = () => {
|
|
17499
|
+
return this.objectUrl;
|
|
17500
|
+
};
|
|
17501
|
+
install() {
|
|
17502
|
+
this.resetEditorState(null);
|
|
17276
17503
|
const { target } = this.opts;
|
|
17277
17504
|
if (target) {
|
|
17278
17505
|
this.mount(target, this);
|
|
@@ -17284,14 +17511,15 @@ class ImageEditor extends UIPlugin {
|
|
|
17284
17511
|
const file = this.uppy.getFile(currentImage.id);
|
|
17285
17512
|
this.uppy.emit('file-editor:cancel', file);
|
|
17286
17513
|
}
|
|
17514
|
+
this.stop();
|
|
17287
17515
|
this.unmount();
|
|
17288
17516
|
}
|
|
17289
17517
|
render() {
|
|
17290
|
-
const { currentImage } = this.getPluginState();
|
|
17518
|
+
const { currentImage, angleGranular } = this.getPluginState();
|
|
17291
17519
|
if (currentImage === null || currentImage.isRemote) {
|
|
17292
17520
|
return null;
|
|
17293
17521
|
}
|
|
17294
|
-
return (u$2(Editor, { currentImage: currentImage,
|
|
17522
|
+
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 }));
|
|
17295
17523
|
}
|
|
17296
17524
|
}
|
|
17297
17525
|
|
|
@@ -18561,7 +18789,7 @@ const PosUpload = class {
|
|
|
18561
18789
|
}
|
|
18562
18790
|
}
|
|
18563
18791
|
render() {
|
|
18564
|
-
return index.h("div", { key: '
|
|
18792
|
+
return index.h("div", { key: 'bba1889322d2bb688881bcab1797dbc2a325e4e3', class: "container", ref: el => (this.uppy = el) });
|
|
18565
18793
|
}
|
|
18566
18794
|
};
|
|
18567
18795
|
PosUpload.style = posUploadCss();
|
|
@@ -18717,51 +18945,6 @@ chunk_ZGGPD2XJ.__decorateClass([
|
|
|
18717
18945
|
|
|
18718
18946
|
SlAvatar.define("sl-avatar");
|
|
18719
18947
|
|
|
18720
|
-
// src/components/divider/divider.styles.ts
|
|
18721
|
-
var divider_styles_default = chunk_ZGGPD2XJ.i`
|
|
18722
|
-
:host {
|
|
18723
|
-
--color: var(--sl-panel-border-color);
|
|
18724
|
-
--width: var(--sl-panel-border-width);
|
|
18725
|
-
--spacing: var(--sl-spacing-medium);
|
|
18726
|
-
}
|
|
18727
|
-
|
|
18728
|
-
:host(:not([vertical])) {
|
|
18729
|
-
display: block;
|
|
18730
|
-
border-top: solid var(--width) var(--color);
|
|
18731
|
-
margin: var(--spacing) 0;
|
|
18732
|
-
}
|
|
18733
|
-
|
|
18734
|
-
:host([vertical]) {
|
|
18735
|
-
display: inline-block;
|
|
18736
|
-
height: 100%;
|
|
18737
|
-
border-left: solid var(--width) var(--color);
|
|
18738
|
-
margin: 0 var(--spacing);
|
|
18739
|
-
}
|
|
18740
|
-
`;
|
|
18741
|
-
|
|
18742
|
-
var SlDivider = class extends chunk_ZGGPD2XJ.ShoelaceElement {
|
|
18743
|
-
constructor() {
|
|
18744
|
-
super(...arguments);
|
|
18745
|
-
this.vertical = false;
|
|
18746
|
-
}
|
|
18747
|
-
connectedCallback() {
|
|
18748
|
-
super.connectedCallback();
|
|
18749
|
-
this.setAttribute("role", "separator");
|
|
18750
|
-
}
|
|
18751
|
-
handleVerticalChange() {
|
|
18752
|
-
this.setAttribute("aria-orientation", this.vertical ? "vertical" : "horizontal");
|
|
18753
|
-
}
|
|
18754
|
-
};
|
|
18755
|
-
SlDivider.styles = [chunk_ZGGPD2XJ.component_styles_default, divider_styles_default];
|
|
18756
|
-
chunk_ZGGPD2XJ.__decorateClass([
|
|
18757
|
-
chunk_ZGGPD2XJ.n({ type: Boolean, reflect: true })
|
|
18758
|
-
], SlDivider.prototype, "vertical", 2);
|
|
18759
|
-
chunk_ZGGPD2XJ.__decorateClass([
|
|
18760
|
-
chunk_ZGGPD2XJ.watch("vertical")
|
|
18761
|
-
], SlDivider.prototype, "handleVerticalChange", 1);
|
|
18762
|
-
|
|
18763
|
-
SlDivider.define("sl-divider");
|
|
18764
|
-
|
|
18765
18948
|
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}`;
|
|
18766
18949
|
|
|
18767
18950
|
const PosUserMenu = class {
|
|
@@ -18787,7 +18970,7 @@ const PosUserMenu = class {
|
|
|
18787
18970
|
}
|
|
18788
18971
|
render() {
|
|
18789
18972
|
if (!this.webId)
|
|
18790
|
-
return null;
|
|
18973
|
+
return null;
|
|
18791
18974
|
return (index.h("pos-resource", { uri: this.webId }, index.h("sl-dropdown", null, index.h("button", { slot: "trigger", "aria-label": "User menu" }, index.h("pos-picture", { "no-upload": true }, index.h("sl-avatar", null))), index.h("sl-menu", null, index.h("sl-menu-item", { value: "dashboard" }, "Dashboard"), index.h("sl-menu-item", { value: "profile" }, index.h("pos-label", null)), index.h("sl-menu-item", { value: "settings" }, "Settings"), index.h("sl-divider", null), index.h("sl-menu-item", { value: "logout" }, "Logout")))));
|
|
18792
18975
|
}
|
|
18793
18976
|
};
|
|
@@ -18819,6 +19002,7 @@ exports.pos_rich_link = PosRichLink;
|
|
|
18819
19002
|
exports.pos_router = PosRouter;
|
|
18820
19003
|
exports.pos_select_term = PosSelectTerm;
|
|
18821
19004
|
exports.pos_setting_offline_cache = PosSettingOfflineCache;
|
|
19005
|
+
exports.pos_share = PosShare;
|
|
18822
19006
|
exports.pos_tool_select = PosToolSelect;
|
|
18823
19007
|
exports.pos_type_index_entries = PosTypeIndexEntries;
|
|
18824
19008
|
exports.pos_type_router = PosTypeRouter;
|