@spectrum-web-components/dropzone 0.10.0-devmode.0 → 0.10.1
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/package.json +3 -4
- package/sp-dropzone.dev.js +1 -0
- package/sp-dropzone.dev.js.map +1 -1
- package/sp-dropzone.js +1 -2
- package/sp-dropzone.js.map +2 -2
- package/src/Dropzone.dev.js +1 -0
- package/src/Dropzone.dev.js.map +1 -1
- package/src/Dropzone.js +2 -110
- package/src/Dropzone.js.map +2 -2
- package/src/dropzone.css.dev.js +1 -0
- package/src/dropzone.css.dev.js.map +1 -1
- package/src/dropzone.css.js +2 -4
- package/src/dropzone.css.js.map +2 -2
- package/src/index.dev.js +1 -0
- package/src/index.dev.js.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/spectrum-dropzone.css.dev.js +1 -0
- package/src/spectrum-dropzone.css.dev.js.map +1 -1
- package/src/spectrum-dropzone.css.js +2 -4
- package/src/spectrum-dropzone.css.js.map +2 -2
- package/stories/dropzone.stories.js +1 -0
- package/stories/dropzone.stories.js.map +1 -1
- package/test/benchmark/test-basic.js +1 -0
- package/test/benchmark/test-basic.js.map +1 -1
- package/test/dropzone.test-vrt.js +1 -0
- package/test/dropzone.test-vrt.js.map +2 -2
- package/test/dropzone.test.js +25 -12
- package/test/dropzone.test.js.map +1 -1
- package/test/test-svg.js +1 -0
- package/test/test-svg.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/dropzone",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,8 +57,7 @@
|
|
|
57
57
|
"lit-html"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@spectrum-web-components/base": "^0.
|
|
61
|
-
"tslib": "^2.0.0"
|
|
60
|
+
"@spectrum-web-components/base": "^0.7.1"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
63
|
"@spectrum-css/dropzone": "^3.0.25"
|
|
@@ -69,5 +68,5 @@
|
|
|
69
68
|
"./sp-*.js",
|
|
70
69
|
"./**/*.dev.js"
|
|
71
70
|
],
|
|
72
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "8bd87724e91e23df83dbf63a434bbbe10b8daaa6"
|
|
73
72
|
}
|
package/sp-dropzone.dev.js
CHANGED
package/sp-dropzone.dev.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-dropzone.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Dropzone } from './src/Dropzone.dev.js'\n\ncustomElements.define('sp-dropzone', Dropzone);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dropzone': Dropzone;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,SAAS,gBAAgB;AAEzB,eAAe,OAAO,eAAe,QAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/sp-dropzone.js
CHANGED
package/sp-dropzone.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-dropzone.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Dropzone } from './src/Dropzone.js';\n\ncustomElements.define('sp-dropzone', Dropzone);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-dropzone': Dropzone;\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "aAWA,OAAS,YAAAA,MAAgB,oBAEzB,eAAe,OAAO,cAAeA,CAAQ",
|
|
6
|
+
"names": ["Dropzone"]
|
|
7
7
|
}
|
package/src/Dropzone.dev.js
CHANGED
package/src/Dropzone.dev.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Dropzone.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport dropzoneStyles from './dropzone.css.js';\n\nexport type DropzoneEventDetail = DragEvent;\n\nexport type DropEffects = 'copy' | 'move' | 'link' | 'none';\n\n/**\n * @element sp-dropzone\n *\n * @slot - The default slot on an `sp-dropzone` is a great place to place upload instructions\n * built with an `sp-illustrated-message` or other information, possibly even built from data\n * provided by the upload, to support users successfully interacting with the drag and drop\n * based features of your application\n *\n * @fires sp-dropzone-should-accept - A cancellable event that confirms whether or not\n * a file dropped on the UI should be accepted.\n * @fires sp-dropzone-dragover - Announces when files have been dragged over the UI, but not yet dropped.\n * @fires sp-dropzone-dragleave - Announces when dragged files have been moved out of the UI without having been dropped.\n * @fires sp-dropzone-drop - Announces when dragged files have been dropped on the UI.\n */\nexport class Dropzone extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [dropzoneStyles];\n }\n\n /**\n * Controls the feedback (typically visual) the user is given during a drag and drop operation\n * @attr\n * @type {'copy' | 'move' | 'link' | 'none'}\n */\n public get dropEffect(): DropEffects {\n return this._dropEffect;\n }\n public set dropEffect(value: DropEffects) {\n if (['copy', 'move', 'link', 'none'].includes(value)) {\n this._dropEffect = value;\n }\n }\n private _dropEffect: DropEffects = 'copy';\n\n @property({ type: Boolean, reflect: true, attribute: 'dragged' })\n public isDragged = false;\n\n private debouncedDragLeave: number | null = null;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n\n this.addEventListener('drop', this.onDrop);\n this.addEventListener('dragover', this.onDragOver);\n this.addEventListener('dragleave', this.onDragLeave);\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this.removeEventListener('drop', this.onDrop);\n this.removeEventListener('dragover', this.onDragOver);\n this.removeEventListener('dragleave', this.onDragLeave);\n }\n\n public onDragOver(event: DragEvent): void {\n const shouldAcceptEvent = new CustomEvent('sp-dropzone-should-accept', {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: event,\n });\n const shouldAccept = this.dispatchEvent(shouldAcceptEvent);\n if (!event.dataTransfer) {\n return;\n }\n if (!shouldAccept) {\n event.dataTransfer.dropEffect = 'none';\n return;\n }\n\n event.preventDefault();\n\n this.clearDebouncedDragLeave();\n\n this.isDragged = true;\n\n event.dataTransfer.dropEffect = this.dropEffect;\n const dragOverEvent = new CustomEvent('sp-dropzone-dragover', {\n bubbles: true,\n composed: true,\n detail: event,\n });\n this.dispatchEvent(dragOverEvent);\n }\n\n public onDragLeave(event: DragEvent): void {\n this.clearDebouncedDragLeave();\n\n this.debouncedDragLeave = window.setTimeout(() => {\n this.isDragged = false;\n\n const dragLeave = new CustomEvent('sp-dropzone-dragleave', {\n bubbles: true,\n composed: true,\n detail: event,\n });\n this.dispatchEvent(dragLeave);\n }, 100);\n }\n\n public onDrop(event: DragEvent): void {\n event.preventDefault();\n\n this.clearDebouncedDragLeave();\n\n this.isDragged = false;\n const dropEvent = new CustomEvent('sp-dropzone-drop', {\n bubbles: true,\n composed: true,\n detail: event,\n });\n this.dispatchEvent(dropEvent);\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected clearDebouncedDragLeave(): void {\n if (this.debouncedDragLeave) {\n clearTimeout(this.debouncedDragLeave);\n this.debouncedDragLeave = null;\n }\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-dropzone:should-accept': CustomEvent<DragEvent>;\n 'sp-dropzone:dragover': CustomEvent<DragEvent>;\n 'sp-dropzone:dragleave': CustomEvent<DragEvent>;\n 'sp-dropzone:drop': CustomEvent<DragEvent>;\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO,oBAAoB;AAoBpB,aAAM,iBAAiB,gBAAgB;AAAA,EAAvC;AAAA;AAkBH,SAAQ,cAA2B;AAGnC,SAAO,YAAY;AAEnB,SAAQ,qBAAoC;AAAA;AAAA,EAtB5C,WAA2B,SAAyB;AAChD,WAAO,CAAC,cAAc;AAAA,EAC1B;AAAA,EAOA,IAAW,aAA0B;AACjC,WAAO,KAAK;AAAA,EAChB;AAAA,EACA,IAAW,WAAW,OAAoB;AACtC,QAAI,CAAC,QAAQ,QAAQ,QAAQ,MAAM,EAAE,SAAS,KAAK,GAAG;AAClD,WAAK,cAAc;AAAA,IACvB;AAAA,EACJ;AAAA,EAQgB,oBAA0B;AACtC,UAAM,kBAAkB;AAExB,SAAK,iBAAiB,QAAQ,KAAK,MAAM;AACzC,SAAK,iBAAiB,YAAY,KAAK,UAAU;AACjD,SAAK,iBAAiB,aAAa,KAAK,WAAW;AAAA,EACvD;AAAA,EAEgB,uBAA6B;AACzC,UAAM,qBAAqB;AAE3B,SAAK,oBAAoB,QAAQ,KAAK,MAAM;AAC5C,SAAK,oBAAoB,YAAY,KAAK,UAAU;AACpD,SAAK,oBAAoB,aAAa,KAAK,WAAW;AAAA,EAC1D;AAAA,EAEO,WAAW,OAAwB;AACtC,UAAM,oBAAoB,IAAI,YAAY,6BAA6B;AAAA,MACnE,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,QAAQ;AAAA,IACZ,CAAC;AACD,UAAM,eAAe,KAAK,cAAc,iBAAiB;AACzD,QAAI,CAAC,MAAM,cAAc;AACrB;AAAA,IACJ;AACA,QAAI,CAAC,cAAc;AACf,YAAM,aAAa,aAAa;AAChC;AAAA,IACJ;AAEA,UAAM,eAAe;AAErB,SAAK,wBAAwB;AAE7B,SAAK,YAAY;AAEjB,UAAM,aAAa,aAAa,KAAK;AACrC,UAAM,gBAAgB,IAAI,YAAY,wBAAwB;AAAA,MAC1D,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA,IACZ,CAAC;AACD,SAAK,cAAc,aAAa;AAAA,EACpC;AAAA,EAEO,YAAY,OAAwB;AACvC,SAAK,wBAAwB;AAE7B,SAAK,qBAAqB,OAAO,WAAW,MAAM;AAC9C,WAAK,YAAY;AAEjB,YAAM,YAAY,IAAI,YAAY,yBAAyB;AAAA,QACvD,SAAS;AAAA,QACT,UAAU;AAAA,QACV,QAAQ;AAAA,MACZ,CAAC;AACD,WAAK,cAAc,SAAS;AAAA,IAChC,GAAG,GAAG;AAAA,EACV;AAAA,EAEO,OAAO,OAAwB;AAClC,UAAM,eAAe;AAErB,SAAK,wBAAwB;AAE7B,SAAK,YAAY;AACjB,UAAM,YAAY,IAAI,YAAY,oBAAoB;AAAA,MAClD,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA,IACZ,CAAC;AACD,SAAK,cAAc,SAAS;AAAA,EAChC;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA;AAAA,EAGX;AAAA,EAEU,0BAAgC;AACtC,QAAI,KAAK,oBAAoB;AACzB,mBAAa,KAAK,kBAAkB;AACpC,WAAK,qBAAqB;AAAA,IAC9B;AAAA,EACJ;AACJ;AA5FW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,UAAU,CAAC;AAAA,GApBvD,SAqBF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Dropzone.js
CHANGED
|
@@ -1,112 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
-
if (decorator = decorators[i])
|
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
10
|
-
return result;
|
|
11
|
-
};
|
|
12
|
-
import {
|
|
13
|
-
html,
|
|
14
|
-
SpectrumElement
|
|
15
|
-
} from "@spectrum-web-components/base";
|
|
16
|
-
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
17
|
-
import dropzoneStyles from "./dropzone.css.js";
|
|
18
|
-
export class Dropzone extends SpectrumElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this._dropEffect = "copy";
|
|
22
|
-
this.isDragged = false;
|
|
23
|
-
this.debouncedDragLeave = null;
|
|
24
|
-
}
|
|
25
|
-
static get styles() {
|
|
26
|
-
return [dropzoneStyles];
|
|
27
|
-
}
|
|
28
|
-
get dropEffect() {
|
|
29
|
-
return this._dropEffect;
|
|
30
|
-
}
|
|
31
|
-
set dropEffect(value) {
|
|
32
|
-
if (["copy", "move", "link", "none"].includes(value)) {
|
|
33
|
-
this._dropEffect = value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
connectedCallback() {
|
|
37
|
-
super.connectedCallback();
|
|
38
|
-
this.addEventListener("drop", this.onDrop);
|
|
39
|
-
this.addEventListener("dragover", this.onDragOver);
|
|
40
|
-
this.addEventListener("dragleave", this.onDragLeave);
|
|
41
|
-
}
|
|
42
|
-
disconnectedCallback() {
|
|
43
|
-
super.disconnectedCallback();
|
|
44
|
-
this.removeEventListener("drop", this.onDrop);
|
|
45
|
-
this.removeEventListener("dragover", this.onDragOver);
|
|
46
|
-
this.removeEventListener("dragleave", this.onDragLeave);
|
|
47
|
-
}
|
|
48
|
-
onDragOver(event) {
|
|
49
|
-
const shouldAcceptEvent = new CustomEvent("sp-dropzone-should-accept", {
|
|
50
|
-
bubbles: true,
|
|
51
|
-
cancelable: true,
|
|
52
|
-
composed: true,
|
|
53
|
-
detail: event
|
|
54
|
-
});
|
|
55
|
-
const shouldAccept = this.dispatchEvent(shouldAcceptEvent);
|
|
56
|
-
if (!event.dataTransfer) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (!shouldAccept) {
|
|
60
|
-
event.dataTransfer.dropEffect = "none";
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
event.preventDefault();
|
|
64
|
-
this.clearDebouncedDragLeave();
|
|
65
|
-
this.isDragged = true;
|
|
66
|
-
event.dataTransfer.dropEffect = this.dropEffect;
|
|
67
|
-
const dragOverEvent = new CustomEvent("sp-dropzone-dragover", {
|
|
68
|
-
bubbles: true,
|
|
69
|
-
composed: true,
|
|
70
|
-
detail: event
|
|
71
|
-
});
|
|
72
|
-
this.dispatchEvent(dragOverEvent);
|
|
73
|
-
}
|
|
74
|
-
onDragLeave(event) {
|
|
75
|
-
this.clearDebouncedDragLeave();
|
|
76
|
-
this.debouncedDragLeave = window.setTimeout(() => {
|
|
77
|
-
this.isDragged = false;
|
|
78
|
-
const dragLeave = new CustomEvent("sp-dropzone-dragleave", {
|
|
79
|
-
bubbles: true,
|
|
80
|
-
composed: true,
|
|
81
|
-
detail: event
|
|
82
|
-
});
|
|
83
|
-
this.dispatchEvent(dragLeave);
|
|
84
|
-
}, 100);
|
|
85
|
-
}
|
|
86
|
-
onDrop(event) {
|
|
87
|
-
event.preventDefault();
|
|
88
|
-
this.clearDebouncedDragLeave();
|
|
89
|
-
this.isDragged = false;
|
|
90
|
-
const dropEvent = new CustomEvent("sp-dropzone-drop", {
|
|
91
|
-
bubbles: true,
|
|
92
|
-
composed: true,
|
|
93
|
-
detail: event
|
|
94
|
-
});
|
|
95
|
-
this.dispatchEvent(dropEvent);
|
|
96
|
-
}
|
|
97
|
-
render() {
|
|
98
|
-
return html`
|
|
1
|
+
"use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var d=(n,o,e,t)=>{for(var r=t>1?void 0:t?p(o,e):o,a=n.length-1,s;a>=0;a--)(s=n[a])&&(r=(t?s(o,e,r):s(r))||r);return t&&r&&i(o,e,r),r};import{html as c,SpectrumElement as l}from"@spectrum-web-components/base";import{property as v}from"@spectrum-web-components/base/src/decorators.js";import u from"./dropzone.css.js";export class Dropzone extends l{constructor(){super(...arguments);this._dropEffect="copy";this.isDragged=!1;this.debouncedDragLeave=null}static get styles(){return[u]}get dropEffect(){return this._dropEffect}set dropEffect(e){["copy","move","link","none"].includes(e)&&(this._dropEffect=e)}connectedCallback(){super.connectedCallback(),this.addEventListener("drop",this.onDrop),this.addEventListener("dragover",this.onDragOver),this.addEventListener("dragleave",this.onDragLeave)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("drop",this.onDrop),this.removeEventListener("dragover",this.onDragOver),this.removeEventListener("dragleave",this.onDragLeave)}onDragOver(e){const t=new CustomEvent("sp-dropzone-should-accept",{bubbles:!0,cancelable:!0,composed:!0,detail:e}),r=this.dispatchEvent(t);if(!e.dataTransfer)return;if(!r){e.dataTransfer.dropEffect="none";return}e.preventDefault(),this.clearDebouncedDragLeave(),this.isDragged=!0,e.dataTransfer.dropEffect=this.dropEffect;const a=new CustomEvent("sp-dropzone-dragover",{bubbles:!0,composed:!0,detail:e});this.dispatchEvent(a)}onDragLeave(e){this.clearDebouncedDragLeave(),this.debouncedDragLeave=window.setTimeout(()=>{this.isDragged=!1;const t=new CustomEvent("sp-dropzone-dragleave",{bubbles:!0,composed:!0,detail:e});this.dispatchEvent(t)},100)}onDrop(e){e.preventDefault(),this.clearDebouncedDragLeave(),this.isDragged=!1;const t=new CustomEvent("sp-dropzone-drop",{bubbles:!0,composed:!0,detail:e});this.dispatchEvent(t)}render(){return c`
|
|
99
2
|
<slot></slot>
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
clearDebouncedDragLeave() {
|
|
103
|
-
if (this.debouncedDragLeave) {
|
|
104
|
-
clearTimeout(this.debouncedDragLeave);
|
|
105
|
-
this.debouncedDragLeave = null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
__decorateClass([
|
|
110
|
-
property({ type: Boolean, reflect: true, attribute: "dragged" })
|
|
111
|
-
], Dropzone.prototype, "isDragged", 2);
|
|
3
|
+
`}clearDebouncedDragLeave(){this.debouncedDragLeave&&(clearTimeout(this.debouncedDragLeave),this.debouncedDragLeave=null)}}d([v({type:Boolean,reflect:!0,attribute:"dragged"})],Dropzone.prototype,"isDragged",2);
|
|
112
4
|
//# sourceMappingURL=Dropzone.js.map
|
package/src/Dropzone.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Dropzone.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport dropzoneStyles from './dropzone.css.js';\n\nexport type DropzoneEventDetail = DragEvent;\n\nexport type DropEffects = 'copy' | 'move' | 'link' | 'none';\n\n/**\n * @element sp-dropzone\n *\n * @slot - The default slot on an `sp-dropzone` is a great place to place upload instructions\n * built with an `sp-illustrated-message` or other information, possibly even built from data\n * provided by the upload, to support users successfully interacting with the drag and drop\n * based features of your application\n *\n * @fires sp-dropzone-should-accept - A cancellable event that confirms whether or not\n * a file dropped on the UI should be accepted.\n * @fires sp-dropzone-dragover - Announces when files have been dragged over the UI, but not yet dropped.\n * @fires sp-dropzone-dragleave - Announces when dragged files have been moved out of the UI without having been dropped.\n * @fires sp-dropzone-drop - Announces when dragged files have been dropped on the UI.\n */\nexport class Dropzone extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [dropzoneStyles];\n }\n\n /**\n * Controls the feedback (typically visual) the user is given during a drag and drop operation\n * @attr\n * @type {'copy' | 'move' | 'link' | 'none'}\n */\n public get dropEffect(): DropEffects {\n return this._dropEffect;\n }\n public set dropEffect(value: DropEffects) {\n if (['copy', 'move', 'link', 'none'].includes(value)) {\n this._dropEffect = value;\n }\n }\n private _dropEffect: DropEffects = 'copy';\n\n @property({ type: Boolean, reflect: true, attribute: 'dragged' })\n public isDragged = false;\n\n private debouncedDragLeave: number | null = null;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n\n this.addEventListener('drop', this.onDrop);\n this.addEventListener('dragover', this.onDragOver);\n this.addEventListener('dragleave', this.onDragLeave);\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this.removeEventListener('drop', this.onDrop);\n this.removeEventListener('dragover', this.onDragOver);\n this.removeEventListener('dragleave', this.onDragLeave);\n }\n\n public onDragOver(event: DragEvent): void {\n const shouldAcceptEvent = new CustomEvent('sp-dropzone-should-accept', {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: event,\n });\n const shouldAccept = this.dispatchEvent(shouldAcceptEvent);\n if (!event.dataTransfer) {\n return;\n }\n if (!shouldAccept) {\n event.dataTransfer.dropEffect = 'none';\n return;\n }\n\n event.preventDefault();\n\n this.clearDebouncedDragLeave();\n\n this.isDragged = true;\n\n event.dataTransfer.dropEffect = this.dropEffect;\n const dragOverEvent = new CustomEvent('sp-dropzone-dragover', {\n bubbles: true,\n composed: true,\n detail: event,\n });\n this.dispatchEvent(dragOverEvent);\n }\n\n public onDragLeave(event: DragEvent): void {\n this.clearDebouncedDragLeave();\n\n this.debouncedDragLeave = window.setTimeout(() => {\n this.isDragged = false;\n\n const dragLeave = new CustomEvent('sp-dropzone-dragleave', {\n bubbles: true,\n composed: true,\n detail: event,\n });\n this.dispatchEvent(dragLeave);\n }, 100);\n }\n\n public onDrop(event: DragEvent): void {\n event.preventDefault();\n\n this.clearDebouncedDragLeave();\n\n this.isDragged = false;\n const dropEvent = new CustomEvent('sp-dropzone-drop', {\n bubbles: true,\n composed: true,\n detail: event,\n });\n this.dispatchEvent(dropEvent);\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n\n protected clearDebouncedDragLeave(): void {\n if (this.debouncedDragLeave) {\n clearTimeout(this.debouncedDragLeave);\n this.debouncedDragLeave = null;\n }\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'sp-dropzone:should-accept': CustomEvent<DragEvent>;\n 'sp-dropzone:dragover': CustomEvent<DragEvent>;\n 'sp-dropzone:dragleave': CustomEvent<DragEvent>;\n 'sp-dropzone:drop': CustomEvent<DragEvent>;\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAoB,oBAoBpB,aAAM,iBAAiBF,CAAgB,CAAvC,kCAkBH,KAAQ,YAA2B,OAGnC,KAAO,UAAY,GAEnB,KAAQ,mBAAoC,KAtB5C,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAc,CAC1B,CAOA,IAAW,YAA0B,CACjC,OAAO,KAAK,WAChB,CACA,IAAW,WAAWC,EAAoB,CAClC,CAAC,OAAQ,OAAQ,OAAQ,MAAM,EAAE,SAASA,CAAK,IAC/C,KAAK,YAAcA,EAE3B,CAQgB,mBAA0B,CACtC,MAAM,kBAAkB,EAExB,KAAK,iBAAiB,OAAQ,KAAK,MAAM,EACzC,KAAK,iBAAiB,WAAY,KAAK,UAAU,EACjD,KAAK,iBAAiB,YAAa,KAAK,WAAW,CACvD,CAEgB,sBAA6B,CACzC,MAAM,qBAAqB,EAE3B,KAAK,oBAAoB,OAAQ,KAAK,MAAM,EAC5C,KAAK,oBAAoB,WAAY,KAAK,UAAU,EACpD,KAAK,oBAAoB,YAAa,KAAK,WAAW,CAC1D,CAEO,WAAWC,EAAwB,CACtC,MAAMC,EAAoB,IAAI,YAAY,4BAA6B,CACnE,QAAS,GACT,WAAY,GACZ,SAAU,GACV,OAAQD,CACZ,CAAC,EACKE,EAAe,KAAK,cAAcD,CAAiB,EACzD,GAAI,CAACD,EAAM,aACP,OAEJ,GAAI,CAACE,EAAc,CACfF,EAAM,aAAa,WAAa,OAChC,MACJ,CAEAA,EAAM,eAAe,EAErB,KAAK,wBAAwB,EAE7B,KAAK,UAAY,GAEjBA,EAAM,aAAa,WAAa,KAAK,WACrC,MAAMG,EAAgB,IAAI,YAAY,uBAAwB,CAC1D,QAAS,GACT,SAAU,GACV,OAAQH,CACZ,CAAC,EACD,KAAK,cAAcG,CAAa,CACpC,CAEO,YAAYH,EAAwB,CACvC,KAAK,wBAAwB,EAE7B,KAAK,mBAAqB,OAAO,WAAW,IAAM,CAC9C,KAAK,UAAY,GAEjB,MAAMI,EAAY,IAAI,YAAY,wBAAyB,CACvD,QAAS,GACT,SAAU,GACV,OAAQJ,CACZ,CAAC,EACD,KAAK,cAAcI,CAAS,CAChC,EAAG,GAAG,CACV,CAEO,OAAOJ,EAAwB,CAClCA,EAAM,eAAe,EAErB,KAAK,wBAAwB,EAE7B,KAAK,UAAY,GACjB,MAAMK,EAAY,IAAI,YAAY,mBAAoB,CAClD,QAAS,GACT,SAAU,GACV,OAAQL,CACZ,CAAC,EACD,KAAK,cAAcK,CAAS,CAChC,CAEmB,QAAyB,CACxC,OAAOV;AAAA;AAAA,SAGX,CAEU,yBAAgC,CAClC,KAAK,qBACL,aAAa,KAAK,kBAAkB,EACpC,KAAK,mBAAqB,KAElC,CACJ,CA5FWW,EAAA,CADNT,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,SAAU,CAAC,GApBvD,SAqBF",
|
|
6
|
+
"names": ["html", "SpectrumElement", "property", "dropzoneStyles", "value", "event", "shouldAcceptEvent", "shouldAccept", "dragOverEvent", "dragLeave", "dropEvent", "__decorateClass"]
|
|
7
7
|
}
|
package/src/dropzone.css.dev.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dropzone.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{border-radius:var(\n--spectrum-dropzone-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:dashed;border-width:var(\n--spectrum-dropzone-border-width,var(--spectrum-alias-border-size-thick)\n);padding:var(\n--spectrum-dropzone-padding,var(--spectrum-global-dimension-size-900)\n);text-align:center}:host([dragged]){border-style:solid}:host(:focus){border-style:dashed;outline:0}:host(:focus.focus-visible){border-style:solid}:host(:focus:focus-visible){border-style:solid}:host{border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host([dragged]){background-color:var(\n--spectrum-dropzone-background-color-selected-hover,var(--spectrum-alias-highlight-selected)\n);border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host([dragged]) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus){border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host(:focus) ::slotted(*){color:var(\n--spectrum-global-color-static-gray-500,rgb(var(--spectrum-global-color-static-gray-500-rgb))\n)}:host(:focus.focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus:focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus[dragged].focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus[dragged]:focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host{--spectrum-dropzone-illustration-color:var(\n--spectrum-global-color-static-blue-400\n);display:block}::slotted(*){font-family:var(\n--spectrum-body-m-text-font-family,var(--spectrum-alias-body-text-font-family)\n);font-size:var(\n--spectrum-body-s-text-size,var(--spectrum-alias-font-size-default)\n);font-style:var(\n--spectrum-body-s-text-font-style,var(--spectrum-global-font-style-regular)\n);font-weight:var(\n--spectrum-body-s-text-font-weight,var(--spectrum-alias-body-text-font-weight)\n);letter-spacing:var(\n--spectrum-body-s-text-letter-spacing,var(--spectrum-global-font-letter-spacing-none)\n);line-height:var(\n--spectrum-body-s-text-line-height,var(--spectrum-alias-body-text-line-height)\n);margin-bottom:0;margin-top:0;text-transform:var(--spectrum-body-s-text-transform,none)}:host([dragged]) ::slotted(*){--spectrum-global-color-gray-500:var(\n--spectrum-dropzone-illustration-color\n)}\n`;\nexport default styles;"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6Cf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/dropzone.css.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const styles = css`
|
|
1
|
+
"use strict";import{css as o}from"@spectrum-web-components/base";const r=o`
|
|
3
2
|
:host{border-radius:var(
|
|
4
3
|
--spectrum-dropzone-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
5
4
|
);border-style:dashed;border-width:var(
|
|
@@ -43,6 +42,5 @@ const styles = css`
|
|
|
43
42
|
);margin-bottom:0;margin-top:0;text-transform:var(--spectrum-body-s-text-transform,none)}:host([dragged]) ::slotted(*){--spectrum-global-color-gray-500:var(
|
|
44
43
|
--spectrum-dropzone-illustration-color
|
|
45
44
|
)}
|
|
46
|
-
`;
|
|
47
|
-
export default styles;
|
|
45
|
+
`;export default r;
|
|
48
46
|
//# sourceMappingURL=dropzone.css.js.map
|
package/src/dropzone.css.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dropzone.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{border-radius:var(\n--spectrum-dropzone-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:dashed;border-width:var(\n--spectrum-dropzone-border-width,var(--spectrum-alias-border-size-thick)\n);padding:var(\n--spectrum-dropzone-padding,var(--spectrum-global-dimension-size-900)\n);text-align:center}:host([dragged]){border-style:solid}:host(:focus){border-style:dashed;outline:0}:host(:focus.focus-visible){border-style:solid}:host(:focus:focus-visible){border-style:solid}:host{border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host([dragged]){background-color:var(\n--spectrum-dropzone-background-color-selected-hover,var(--spectrum-alias-highlight-selected)\n);border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host([dragged]) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus){border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host(:focus) ::slotted(*){color:var(\n--spectrum-global-color-static-gray-500,rgb(var(--spectrum-global-color-static-gray-500-rgb))\n)}:host(:focus.focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus:focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus[dragged].focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus[dragged]:focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host{--spectrum-dropzone-illustration-color:var(\n--spectrum-global-color-static-blue-400\n);display:block}::slotted(*){font-family:var(\n--spectrum-body-m-text-font-family,var(--spectrum-alias-body-text-font-family)\n);font-size:var(\n--spectrum-body-s-text-size,var(--spectrum-alias-font-size-default)\n);font-style:var(\n--spectrum-body-s-text-font-style,var(--spectrum-global-font-style-regular)\n);font-weight:var(\n--spectrum-body-s-text-font-weight,var(--spectrum-alias-body-text-font-weight)\n);letter-spacing:var(\n--spectrum-body-s-text-letter-spacing,var(--spectrum-global-font-letter-spacing-none)\n);line-height:var(\n--spectrum-body-s-text-line-height,var(--spectrum-alias-body-text-line-height)\n);margin-bottom:0;margin-top:0;text-transform:var(--spectrum-body-s-text-transform,none)}:host([dragged]) ::slotted(*){--spectrum-global-color-gray-500:var(\n--spectrum-dropzone-illustration-color\n)}\n`;\nexport default styles;"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6Cf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
7
|
}
|
package/src/index.dev.js
CHANGED
package/src/index.dev.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Dropzone.dev.js'\n"],
|
|
5
|
-
"mappings": "AAWA;",
|
|
5
|
+
"mappings": ";AAWA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
"use strict";export*from"./Dropzone.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Dropzone.js';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "aAWA,WAAc",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-dropzone.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{border-radius:var(\n--spectrum-dropzone-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:dashed;border-width:var(\n--spectrum-dropzone-border-width,var(--spectrum-alias-border-size-thick)\n);padding:var(\n--spectrum-dropzone-padding,var(--spectrum-global-dimension-size-900)\n);text-align:center}:host([dragged]){border-style:solid}:host(:focus){border-style:dashed;outline:0}:host(:focus.focus-visible){border-style:solid}:host(:focus:focus-visible){border-style:solid}:host{border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host([dragged]){background-color:var(\n--spectrum-dropzone-background-color-selected-hover,var(--spectrum-alias-highlight-selected)\n);border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host([dragged]) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus){border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host(:focus) ::slotted(*){color:var(\n--spectrum-global-color-static-gray-500,rgb(var(--spectrum-global-color-static-gray-500-rgb))\n)}:host(:focus.focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus:focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus[dragged].focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus[dragged]:focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}\n`;\nexport default styles;"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6Bf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const styles = css`
|
|
1
|
+
"use strict";import{css as o}from"@spectrum-web-components/base";const r=o`
|
|
3
2
|
:host{border-radius:var(
|
|
4
3
|
--spectrum-dropzone-border-radius,var(--spectrum-alias-border-radius-regular)
|
|
5
4
|
);border-style:dashed;border-width:var(
|
|
@@ -27,6 +26,5 @@ const styles = css`
|
|
|
27
26
|
)}:host(:focus[dragged]:focus-visible) ::slotted(*){color:var(
|
|
28
27
|
--spectrum-global-color-blue-400
|
|
29
28
|
)}
|
|
30
|
-
`;
|
|
31
|
-
export default styles;
|
|
29
|
+
`;export default r;
|
|
32
30
|
//# sourceMappingURL=spectrum-dropzone.css.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-dropzone.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{border-radius:var(\n--spectrum-dropzone-border-radius,var(--spectrum-alias-border-radius-regular)\n);border-style:dashed;border-width:var(\n--spectrum-dropzone-border-width,var(--spectrum-alias-border-size-thick)\n);padding:var(\n--spectrum-dropzone-padding,var(--spectrum-global-dimension-size-900)\n);text-align:center}:host([dragged]){border-style:solid}:host(:focus){border-style:dashed;outline:0}:host(:focus.focus-visible){border-style:solid}:host(:focus:focus-visible){border-style:solid}:host{border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host([dragged]){background-color:var(\n--spectrum-dropzone-background-color-selected-hover,var(--spectrum-alias-highlight-selected)\n);border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host([dragged]) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus){border-color:var(\n--spectrum-dropzone-border-color,var(--spectrum-global-color-gray-300)\n)}:host(:focus) ::slotted(*){color:var(\n--spectrum-global-color-static-gray-500,rgb(var(--spectrum-global-color-static-gray-500-rgb))\n)}:host(:focus.focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus:focus-visible){border-color:var(\n--spectrum-dropzone-border-color-selected-hover,var(--spectrum-global-color-blue-400)\n)}:host(:focus[dragged].focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}:host(:focus[dragged]:focus-visible) ::slotted(*){color:var(\n--spectrum-global-color-blue-400\n)}\n`;\nexport default styles;"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6Bf,eAAeC",
|
|
6
|
+
"names": ["css", "styles"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dropzone.stories.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/dropzone/sp-dropzone.js';\nimport { illustration } from '../test/test-svg';\nimport '@spectrum-web-components/illustrated-message/sp-illustrated-message.js';\nimport '@spectrum-web-components/link/sp-link.js';\n\nexport default {\n component: 'sp-dropzone',\n title: 'Dropzone',\n args: {\n isDragged: false,\n },\n argTypes: {\n isDragged: {\n name: 'isDragged',\n type: { name: 'boolean', required: false },\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n },\n};\n\ntype StoryArgs = {\n isDragged?: boolean;\n};\n\nexport const Default = (args: StoryArgs): TemplateResult => {\n return html`\n <sp-dropzone id=\"dropzone\" tabindex=\"0\" ?dragged=${args.isDragged}>\n <sp-illustrated-message heading=\"Drag and Drop Your File\" cta>\n ${illustration}\n <div slot=\"description\">\n <label for=\"file-input\">\n <sp-link>Select a File</sp-link>\n from your computer\n </label>\n <input type=\"file\" id=\"file-input\" style=\"display: none\" />\n </div>\n <div slot=\"description\">\n or\n <sp-link href=\"http://stock.adobe.com\" target=\"blank\">\n Search Adobe Stock\n </sp-link>\n </div>\n </sp-illustrated-message>\n </sp-dropzone>\n `;\n};\n\nexport const Dragged = (args: StoryArgs): TemplateResult => {\n return html`\n <sp-dropzone id=\"dropzone\" tabindex=\"0\" ?dragged=${args.isDragged}>\n <sp-illustrated-message heading=\"Drag and Drop Your File\" cta>\n ${illustration}\n <div slot=\"description\">\n <label for=\"file-input\">\n <sp-link>Select a File</sp-link>\n from your computer\n </label>\n <input type=\"file\" id=\"file-input\" style=\"display: none\" />\n </div>\n <div slot=\"description\">\n or\n <sp-link href=\"http://stock.adobe.com\" target=\"blank\">\n Search Adobe Stock\n </sp-link>\n </div>\n </sp-illustrated-message>\n </sp-dropzone>\n `;\n};\nDragged.args = {\n isDragged: true,\n};\n"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAA4B;AAErC,OAAO;AACP,SAAS,oBAAoB;AAC7B,OAAO;AACP,OAAO;AAEP,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;AAAA,IACF,WAAW;AAAA,EACf;AAAA,EACA,UAAU;AAAA,IACN,WAAW;AAAA,MACP,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,WAAW,UAAU,MAAM;AAAA,MACzC,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,UAAU;AAAA,QAC3B,cAAc,EAAE,SAAS,MAAM;AAAA,MACnC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AACJ;AAMO,aAAM,UAAU,CAAC,SAAoC;AACxD,SAAO;AAAA,2DACgD,KAAK;AAAA;AAAA,kBAE9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBlB;AAEO,aAAM,UAAU,CAAC,SAAoC;AACxD,SAAO;AAAA,2DACgD,KAAK;AAAA;AAAA,kBAE9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBlB;AACA,QAAQ,OAAO;AAAA,EACX,WAAW;AACf;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["test-basic.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/dropzone/sp-dropzone.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-dropzone id=\"dropzone\">\n <sp-illustrated-message heading=\"Drag and Drop Your File\">\n <svg>\n <use xlink:href=\"geometry.svg#upload_geometry\" />\n </svg>\n </sp-illustrated-message>\n\n <div style=\"color: grey\">\n <div>\n <label for=\"file-input\">\n <sp-link>Select a File</sp-link>\n from your computer\n </label>\n <input type=\"file\" id=\"file-input\" style=\"display: none\" />\n </div>\n <div>\n or\n <sp-link href=\"http://stock.adobe.com\" target=\"blank\">\n Search Adobe Stock\n </sp-link>\n </div>\n </div>\n </sp-dropzone>\n`);\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
5
|
+
"mappings": ";AAYA,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAwBtB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dropzone.test-vrt.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/dropzone.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('DropzoneStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/dropzone.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\nimport type { TestsType } from '../../../test/visual/test.js';\n\nregressVisuals('DropzoneStories', stories as unknown as TestsType);\n"],
|
|
5
|
+
"mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAG/B,eAAe,mBAAmB,OAA+B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/dropzone.test.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
import "@spectrum-web-components/dropzone/sp-dropzone.js";
|
|
2
3
|
import { illustration } from "./test-svg.js";
|
|
3
4
|
import { waitForPredicate } from "../../../test/testing-helpers.js";
|
|
4
5
|
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
5
6
|
describe("Dropzone", () => {
|
|
6
7
|
it("loads", async () => {
|
|
7
|
-
const el = await fixture(
|
|
8
|
+
const el = await fixture(
|
|
9
|
+
html`
|
|
8
10
|
<sp-dropzone id="dropzone">
|
|
9
11
|
<sp-illustrated-message heading="Drag and Drop Your File">
|
|
10
12
|
${illustration}
|
|
@@ -33,7 +35,8 @@ describe("Dropzone", () => {
|
|
|
33
35
|
</div>
|
|
34
36
|
</div>
|
|
35
37
|
</sp-dropzone>
|
|
36
|
-
`
|
|
38
|
+
`
|
|
39
|
+
);
|
|
37
40
|
expect(el).to.not.equal(void 0);
|
|
38
41
|
if (!el.shadowRoot)
|
|
39
42
|
throw new Error("No shadowRoot");
|
|
@@ -42,9 +45,11 @@ describe("Dropzone", () => {
|
|
|
42
45
|
return true;
|
|
43
46
|
});
|
|
44
47
|
it("manages `dropEffects`", async () => {
|
|
45
|
-
const el = await fixture(
|
|
48
|
+
const el = await fixture(
|
|
49
|
+
html`
|
|
46
50
|
<sp-dropzone id="dropzone"></sp-dropzone>
|
|
47
|
-
`
|
|
51
|
+
`
|
|
52
|
+
);
|
|
48
53
|
await elementUpdated(el);
|
|
49
54
|
expect(el.dropEffect).to.equal("copy");
|
|
50
55
|
el.dropEffect = "move";
|
|
@@ -52,9 +57,11 @@ describe("Dropzone", () => {
|
|
|
52
57
|
expect(el.dropEffect).to.equal("move");
|
|
53
58
|
});
|
|
54
59
|
it("manages `dragover` events", async () => {
|
|
55
|
-
const el = await fixture(
|
|
60
|
+
const el = await fixture(
|
|
61
|
+
html`
|
|
56
62
|
<sp-dropzone id="dropzone"></sp-dropzone>
|
|
57
|
-
`
|
|
63
|
+
`
|
|
64
|
+
);
|
|
58
65
|
await elementUpdated(el);
|
|
59
66
|
expect(el.isDragged).to.be.false;
|
|
60
67
|
el.dispatchEvent(new DragEvent("dragover"));
|
|
@@ -76,12 +83,14 @@ describe("Dropzone", () => {
|
|
|
76
83
|
const canceledDrag = (event) => {
|
|
77
84
|
event.preventDefault();
|
|
78
85
|
};
|
|
79
|
-
const el = await fixture(
|
|
86
|
+
const el = await fixture(
|
|
87
|
+
html`
|
|
80
88
|
<sp-dropzone
|
|
81
89
|
id="dropzone"
|
|
82
90
|
@sp-dropzone-should-accept=${canceledDrag}
|
|
83
91
|
></sp-dropzone>
|
|
84
|
-
`
|
|
92
|
+
`
|
|
93
|
+
);
|
|
85
94
|
await elementUpdated(el);
|
|
86
95
|
expect(el.isDragged).to.be.false;
|
|
87
96
|
let dataTransfer = false;
|
|
@@ -104,12 +113,14 @@ describe("Dropzone", () => {
|
|
|
104
113
|
const onDragLeave = () => {
|
|
105
114
|
dragLeftCount += 1;
|
|
106
115
|
};
|
|
107
|
-
const el = await fixture(
|
|
116
|
+
const el = await fixture(
|
|
117
|
+
html`
|
|
108
118
|
<sp-dropzone
|
|
109
119
|
id="dropzone"
|
|
110
120
|
@sp-dropzone-dragleave=${onDragLeave}
|
|
111
121
|
></sp-dropzone>
|
|
112
|
-
`
|
|
122
|
+
`
|
|
123
|
+
);
|
|
113
124
|
await elementUpdated(el);
|
|
114
125
|
expect(dragLeftCount).to.equal(0);
|
|
115
126
|
el.dispatchEvent(new DragEvent("dragleave"));
|
|
@@ -122,12 +133,14 @@ describe("Dropzone", () => {
|
|
|
122
133
|
const onDrop = () => {
|
|
123
134
|
dropped = true;
|
|
124
135
|
};
|
|
125
|
-
const el = await fixture(
|
|
136
|
+
const el = await fixture(
|
|
137
|
+
html`
|
|
126
138
|
<sp-dropzone
|
|
127
139
|
id="dropzone"
|
|
128
140
|
@sp-dropzone-drop=${onDrop}
|
|
129
141
|
></sp-dropzone>
|
|
130
|
-
`
|
|
142
|
+
`
|
|
143
|
+
);
|
|
131
144
|
await elementUpdated(el);
|
|
132
145
|
expect(dropped).to.be.false;
|
|
133
146
|
el.dispatchEvent(new DragEvent("drop"));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["dropzone.test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/dropzone/sp-dropzone.js';\nimport { Dropzone } from '@spectrum-web-components/dropzone';\nimport { illustration } from './test-svg.js';\nimport { waitForPredicate } from '../../../test/testing-helpers.js';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\ndescribe('Dropzone', () => {\n it('loads', async () => {\n const el = await fixture<Dropzone>(\n html`\n <sp-dropzone id=\"dropzone\">\n <sp-illustrated-message heading=\"Drag and Drop Your File\">\n ${illustration}\n </sp-illustrated-message>\n\n <div style=\"color: grey\">\n <div>\n <label for=\"file-input\">\n <sp-link>Select a File</sp-link>\n from your computer\n </label>\n <input\n type=\"file\"\n id=\"file-input\"\n style=\"display: none\"\n />\n </div>\n <div>\n or\n <sp-link\n href=\"http://stock.adobe.com\"\n target=\"blank\"\n >\n Search Adobe Stock\n </sp-link>\n </div>\n </div>\n </sp-dropzone>\n `\n );\n expect(el).to.not.equal(undefined);\n if (!el.shadowRoot) throw new Error('No shadowRoot');\n const slot = el.shadowRoot.querySelector('slot') as HTMLSlotElement;\n expect(slot).to.not.equal(undefined);\n return true;\n });\n it('manages `dropEffects`', async () => {\n const el = await fixture<Dropzone>(\n html`\n <sp-dropzone id=\"dropzone\"></sp-dropzone>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.dropEffect).to.equal('copy');\n\n el.dropEffect = 'move';\n\n await elementUpdated(el);\n\n expect(el.dropEffect).to.equal('move');\n });\n it('manages `dragover` events', async () => {\n const el = await fixture<Dropzone>(\n html`\n <sp-dropzone id=\"dropzone\"></sp-dropzone>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.isDragged).to.be.false;\n\n el.dispatchEvent(new DragEvent('dragover'));\n\n expect(el.isDragged).to.be.false;\n\n let dataTransfer: DataTransfer | boolean = false;\n try {\n // Safari doesn't like this...\n dataTransfer = new DataTransfer();\n } catch (error) {}\n if (dataTransfer) {\n const dragOverEvent = new DragEvent('dragover', {\n dataTransfer,\n });\n\n el.dispatchEvent(dragOverEvent);\n\n expect(el.isDragged).to.be.true;\n // We should be able to make the following test here:\n // expect(dataTransfer.dropEffect).to.equal(el.dropEffect);\n // However, Chrome doesn't like it in the context of a test...\n }\n });\n it('allows `dragover` events to be canceled', async () => {\n const canceledDrag = (event: DragEvent): void => {\n event.preventDefault();\n };\n const el = await fixture<Dropzone>(\n html`\n <sp-dropzone\n id=\"dropzone\"\n @sp-dropzone-should-accept=${canceledDrag}\n ></sp-dropzone>\n `\n );\n\n await elementUpdated(el);\n\n expect(el.isDragged).to.be.false;\n\n let dataTransfer: DataTransfer | boolean = false;\n try {\n // Safari doesn't like this...\n dataTransfer = new DataTransfer();\n } catch (error) {}\n if (dataTransfer) {\n const dragOverEvent = new DragEvent('dragover', {\n dataTransfer,\n });\n\n el.dispatchEvent(dragOverEvent);\n\n expect(el.isDragged).to.be.false;\n expect(dataTransfer.dropEffect).to.not.equal(el.dropEffect);\n expect(dataTransfer.dropEffect).to.equal('none');\n }\n });\n it('manages `dragleave` events via debounce', async () => {\n let dragLeftCount = 0;\n const onDragLeave = (): void => {\n dragLeftCount += 1;\n };\n const el = await fixture<Dropzone>(\n html`\n <sp-dropzone\n id=\"dropzone\"\n @sp-dropzone-dragleave=${onDragLeave}\n ></sp-dropzone>\n `\n );\n\n await elementUpdated(el);\n\n expect(dragLeftCount).to.equal(0);\n\n el.dispatchEvent(new DragEvent('dragleave'));\n el.dispatchEvent(new DragEvent('dragleave'));\n\n await waitForPredicate(() => dragLeftCount === 1);\n\n expect(dragLeftCount).to.equal(1);\n });\n\n it('manages `dragleave` events', async () => {\n let dropped = false;\n const onDrop = (): void => {\n dropped = true;\n };\n const el = await fixture<Dropzone>(\n html`\n <sp-dropzone\n id=\"dropzone\"\n @sp-dropzone-drop=${onDrop}\n ></sp-dropzone>\n `\n );\n\n await elementUpdated(el);\n\n expect(dropped).to.be.false;\n\n el.dispatchEvent(new DragEvent('drop'));\n\n expect(dropped).to.be.true;\n });\n});\n"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,OAAO;AAEP,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AAEtD,SAAS,YAAY,MAAM;AACvB,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,0BAGc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA2BlB;AACA,WAAO,EAAE,EAAE,GAAG,IAAI,MAAM,MAAS;AACjC,QAAI,CAAC,GAAG;AAAY,YAAM,IAAI,MAAM,eAAe;AACnD,UAAM,OAAO,GAAG,WAAW,cAAc,MAAM;AAC/C,WAAO,IAAI,EAAE,GAAG,IAAI,MAAM,MAAS;AACnC,WAAO;AAAA,EACX,CAAC;AACD,KAAG,yBAAyB,YAAY;AACpC,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,UAAU,EAAE,GAAG,MAAM,MAAM;AAErC,OAAG,aAAa;AAEhB,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,UAAU,EAAE,GAAG,MAAM,MAAM;AAAA,EACzC,CAAC;AACD,KAAG,6BAA6B,YAAY;AACxC,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,SAAS,EAAE,GAAG,GAAG;AAE3B,OAAG,cAAc,IAAI,UAAU,UAAU,CAAC;AAE1C,WAAO,GAAG,SAAS,EAAE,GAAG,GAAG;AAE3B,QAAI,eAAuC;AAC3C,QAAI;AAEA,qBAAe,IAAI,aAAa;AAAA,IACpC,SAAS,OAAP;AAAA,IAAe;AACjB,QAAI,cAAc;AACd,YAAM,gBAAgB,IAAI,UAAU,YAAY;AAAA,QAC5C;AAAA,MACJ,CAAC;AAED,SAAG,cAAc,aAAa;AAE9B,aAAO,GAAG,SAAS,EAAE,GAAG,GAAG;AAAA,IAI/B;AAAA,EACJ,CAAC;AACD,KAAG,2CAA2C,YAAY;AACtD,UAAM,eAAe,CAAC,UAA2B;AAC7C,YAAM,eAAe;AAAA,IACzB;AACA,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,iDAGqC;AAAA;AAAA;AAAA,IAGzC;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,SAAS,EAAE,GAAG,GAAG;AAE3B,QAAI,eAAuC;AAC3C,QAAI;AAEA,qBAAe,IAAI,aAAa;AAAA,IACpC,SAAS,OAAP;AAAA,IAAe;AACjB,QAAI,cAAc;AACd,YAAM,gBAAgB,IAAI,UAAU,YAAY;AAAA,QAC5C;AAAA,MACJ,CAAC;AAED,SAAG,cAAc,aAAa;AAE9B,aAAO,GAAG,SAAS,EAAE,GAAG,GAAG;AAC3B,aAAO,aAAa,UAAU,EAAE,GAAG,IAAI,MAAM,GAAG,UAAU;AAC1D,aAAO,aAAa,UAAU,EAAE,GAAG,MAAM,MAAM;AAAA,IACnD;AAAA,EACJ,CAAC;AACD,KAAG,2CAA2C,YAAY;AACtD,QAAI,gBAAgB;AACpB,UAAM,cAAc,MAAY;AAC5B,uBAAiB;AAAA,IACrB;AACA,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,6CAGiC;AAAA;AAAA;AAAA,IAGrC;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,aAAa,EAAE,GAAG,MAAM,CAAC;AAEhC,OAAG,cAAc,IAAI,UAAU,WAAW,CAAC;AAC3C,OAAG,cAAc,IAAI,UAAU,WAAW,CAAC;AAE3C,UAAM,iBAAiB,MAAM,kBAAkB,CAAC;AAEhD,WAAO,aAAa,EAAE,GAAG,MAAM,CAAC;AAAA,EACpC,CAAC;AAED,KAAG,8BAA8B,YAAY;AACzC,QAAI,UAAU;AACd,UAAM,SAAS,MAAY;AACvB,gBAAU;AAAA,IACd;AACA,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,wCAG4B;AAAA;AAAA;AAAA,IAGhC;AAEA,UAAM,eAAe,EAAE;AAEvB,WAAO,OAAO,EAAE,GAAG,GAAG;AAEtB,OAAG,cAAc,IAAI,UAAU,MAAM,CAAC;AAEtC,WAAO,OAAO,EAAE,GAAG,GAAG;AAAA,EAC1B,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/test-svg.js
CHANGED
package/test/test-svg.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["test-svg.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html } from '@spectrum-web-components/base';\n\nexport const illustration = html`\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 100\"\n width=\"200\"\n height=\"100\"\n >\n <defs>\n <style>\n .cls-1,\n .cls-2 {\n fill: none;\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n .cls-1 {\n stroke-width: 3px;\n }\n .cls-2 {\n stroke-width: 2px;\n }\n </style>\n </defs>\n <path\n class=\"cls-1\"\n d=\"M110.53,85.66,100.26,95.89a1.09,1.09,0,0,1-1.52,0L88.47,85.66\"\n ></path>\n <line class=\"cls-1\" x1=\"99.5\" y1=\"95.5\" x2=\"99.5\" y2=\"58.5\"></line>\n <path class=\"cls-1\" d=\"M105.5,73.5h19a2,2,0,0,0,2-2v-43\"></path>\n <path\n class=\"cls-1\"\n d=\"M126.5,22.5h-19a2,2,0,0,1-2-2V1.5h-31a2,2,0,0,0-2,2v68a2,2,0,0,0,2,2h19\"\n ></path>\n <line class=\"cls-1\" x1=\"105.5\" y1=\"1.5\" x2=\"126.5\" y2=\"22.5\"></line>\n <path\n class=\"cls-2\"\n d=\"M47.93,50.49a5,5,0,1,0-4.83-5A4.93,4.93,0,0,0,47.93,50.49Z\"\n ></path>\n <path\n class=\"cls-2\"\n d=\"M36.6,65.93,42.05,60A2.06,2.06,0,0,1,45,60l12.68,13.2\"\n ></path>\n <path\n class=\"cls-2\"\n d=\"M3.14,73.23,22.42,53.76a1.65,1.65,0,0,1,2.38,0l19.05,19.7\"\n ></path>\n <path\n class=\"cls-1\"\n d=\"M139.5,36.5H196A1.49,1.49,0,0,1,197.5,38V72A1.49,1.49,0,0,1,196,73.5H141A1.49,1.49,0,0,1,139.5,72V32A1.49,1.49,0,0,1,141,30.5H154a2.43,2.43,0,0,1,1.67.66l6,5.66\"\n ></path>\n <rect\n class=\"cls-1\"\n x=\"1.5\"\n y=\"34.5\"\n width=\"58\"\n height=\"39\"\n rx=\"2\"\n ry=\"2\"\n ></rect>\n </svg>\n`;\n"],
|
|
5
|
-
"mappings": "AAWA;
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAAY;AAEd,aAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|