@roomle/embedding-lib 5.25.0-alpha.4 → 5.25.0-alpha.5
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/docs/md/web/embedding/CHANGELOG.md +6 -22
- package/drag-in-DTA1FCDc.mjs +1 -0
- package/drag-in-DuufO5eB.mjs +138 -0
- package/from-custom-view-BdnViEhf.mjs +163 -0
- package/from-custom-view-DIYHP31u.mjs +1 -0
- package/from-website-CcDHgCCy.mjs +1 -0
- package/from-website-CktA6Icy.mjs +201 -0
- package/package.json +1 -1
- package/packages/web-sdk/packages/common-core/src/static-files/environment-maps.d.ts +6 -4
- package/packages/web-sdk/packages/common-core/src/static-files/libs.d.ts +3 -1
- package/packages/web-sdk/packages/common-core/src/static-files/light-settings.d.ts +8 -6
- package/packages/web-sdk/packages/common-core/src/static-files/luts.d.ts +11 -9
- package/packages/web-sdk/packages/common-core/src/static-files/roomle-core.d.ts +8 -6
- package/packages/web-sdk/packages/configurator-core/src/static-files/fonts.d.ts +4 -2
- package/packages/web-sdk/packages/configurator-core/src/static-files/geometries.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/static-files/settings.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/static-files/textures.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/utils/component-dimensioning-helper.d.ts +1 -1
- package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +4 -0
- package/packages/web-sdk/packages/workers/src/static-files/workers.d.ts +4 -2
- package/roomle-embedding-lib.es.js +306 -316
- package/roomle-embedding-lib.es.min.js +1 -1
- package/roomle-embedding-lib.umd.js +17 -17
- package/roomle-embedding-lib.umd.min.js +1 -1
- package/touch-drag-B5zCf87J.mjs +1 -0
- package/touch-drag-DXJTOrk5.mjs +146 -0
- package/drag-in-CqBNfbIX.mjs +0 -142
- package/drag-in-ltdVSMsI.mjs +0 -1
- package/from-custom-view-Bg3_d6Sp.mjs +0 -1
- package/from-custom-view-V503ai3X.mjs +0 -167
- package/from-website-BAX9bdN9.mjs +0 -210
- package/from-website-DsBWpkdv.mjs +0 -1
- package/packages/web-sdk/packages/vite-plugins/vite-plugin-auto-workers.d.ts +0 -8
- package/packages/web-sdk/packages/vite-plugins/vite-plugin-bundle-sw.d.ts +0 -10
- package/touch-drag-BEct6jbW.mjs +0 -1
- package/touch-drag-DNDPwZ-_.mjs +0 -149
package/drag-in-CqBNfbIX.mjs
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
var p = Object.defineProperty;
|
|
2
|
-
var S = (o, s, t) => s in o ? p(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
|
-
var i = (o, s, t) => S(o, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
class I {
|
|
5
|
-
constructor(s, t, e, a) {
|
|
6
|
-
i(this, "_mainDomElement");
|
|
7
|
-
i(this, "_instance");
|
|
8
|
-
i(this, "_mode", "website");
|
|
9
|
-
i(this, "_viewName", "main");
|
|
10
|
-
this._instance = s, this._mainDomElement = t, this._mode = e, this._viewName = a;
|
|
11
|
-
}
|
|
12
|
-
async init() {
|
|
13
|
-
return Promise.resolve();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
const m = "rml-drag-in-styles", f = "rml-drag-in-drag-element", E = "rml-drag-in-overlay", g = "rml-drag-in-drag-ghost", h = "rml-drag-in-fade-in", u = "rml-drag-in-fade-out", L = {
|
|
17
|
-
DISPLAY_NONE: "rml-display-none"
|
|
18
|
-
}, A = 0.5, D = "250ms", y = "forwards", N = `@keyframes ${h} {from{opacity: 0;}to {opacity: ${A};}}`, R = `@keyframes ${u} {from{opacity: ${A};}to {opacity: 0;}}`, M = `${h} ${D} ${y}`, O = `${u} ${D} ${y}`, w = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg", C = 112, v = 112;
|
|
19
|
-
class G extends I {
|
|
20
|
-
constructor(t, e, a, _) {
|
|
21
|
-
super(t, e, a, _);
|
|
22
|
-
i(this, "options", {});
|
|
23
|
-
i(this, "_customDragSignal", new AbortController());
|
|
24
|
-
this._mainDomElement = e, this._injectStyles(), this._initializeDragGhost();
|
|
25
|
-
}
|
|
26
|
-
_injectStyles() {
|
|
27
|
-
if (!!!document.getElementById(m)) {
|
|
28
|
-
const e = document.createElement("style");
|
|
29
|
-
e.type = "text/css", e.id = m, e.innerHTML = `
|
|
30
|
-
.${L.DISPLAY_NONE}{display:none}
|
|
31
|
-
.${E}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
|
|
32
|
-
.${g}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
|
|
33
|
-
${N}
|
|
34
|
-
${R}
|
|
35
|
-
`, document.head.appendChild(e);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
_initializeDragGhost() {
|
|
39
|
-
const t = this._mainDomElement.parentNode;
|
|
40
|
-
let e = t.querySelector(
|
|
41
|
-
"." + g
|
|
42
|
-
);
|
|
43
|
-
e || (e = document.createElement("div"), e.classList.add(g), e.innerText = " ", t.appendChild(e));
|
|
44
|
-
}
|
|
45
|
-
async init() {
|
|
46
|
-
if (await super.init(), this._mode === "website")
|
|
47
|
-
try {
|
|
48
|
-
const { DragInFromWebsiteStrategy: t } = await import("./from-website-BAX9bdN9.mjs");
|
|
49
|
-
this._strategy = new t(
|
|
50
|
-
this._instance,
|
|
51
|
-
this._mainDomElement,
|
|
52
|
-
{ settings: this.options, mode: "website" }
|
|
53
|
-
);
|
|
54
|
-
} catch (t) {
|
|
55
|
-
throw console.error('Could not load Dragin strategy "FromWebsite"'), t;
|
|
56
|
-
}
|
|
57
|
-
else if (this._mode === "custom-view")
|
|
58
|
-
try {
|
|
59
|
-
const { DragInFromCustomViewStrategy: t } = await import("./from-custom-view-V503ai3X.mjs");
|
|
60
|
-
this._strategy = new t(
|
|
61
|
-
this._instance,
|
|
62
|
-
this._mainDomElement,
|
|
63
|
-
this.options,
|
|
64
|
-
this._viewName
|
|
65
|
-
);
|
|
66
|
-
} catch (t) {
|
|
67
|
-
throw console.error('Could not load Dragin strategy "FromCustomView"'), t;
|
|
68
|
-
}
|
|
69
|
-
else
|
|
70
|
-
throw new Error("Unsupported mode");
|
|
71
|
-
}
|
|
72
|
-
get isDragging() {
|
|
73
|
-
return this._strategy.isDragging;
|
|
74
|
-
}
|
|
75
|
-
dragStart(t, e, a = "rml_id") {
|
|
76
|
-
this._strategy.dragStart(t, e, a);
|
|
77
|
-
}
|
|
78
|
-
dragUpdate(t) {
|
|
79
|
-
this._strategy.dragUpdate(t);
|
|
80
|
-
}
|
|
81
|
-
dragEnd() {
|
|
82
|
-
this._strategy.dragEnd();
|
|
83
|
-
}
|
|
84
|
-
touchStart(t, e, a = "rml_id") {
|
|
85
|
-
this._strategy.touchStart(t, e, a);
|
|
86
|
-
}
|
|
87
|
-
touchMove(t) {
|
|
88
|
-
this._strategy.touchMove(t);
|
|
89
|
-
}
|
|
90
|
-
touchEnd() {
|
|
91
|
-
this._strategy.touchEnd();
|
|
92
|
-
}
|
|
93
|
-
dispose() {
|
|
94
|
-
this._strategy.dispose();
|
|
95
|
-
}
|
|
96
|
-
beforeUpdateGhost(t) {
|
|
97
|
-
this._strategy.beforeUpdateGhost(t);
|
|
98
|
-
}
|
|
99
|
-
registerCustomDrag({
|
|
100
|
-
customDragStart: t,
|
|
101
|
-
customDragEnd: e,
|
|
102
|
-
customDragUpdate: a,
|
|
103
|
-
beforeUpdateGhost: _
|
|
104
|
-
}) {
|
|
105
|
-
_ && this._strategy.beforeUpdateGhost(_);
|
|
106
|
-
const n = this._customDragSignal.signal, c = (r) => {
|
|
107
|
-
r.target.getAttribute("data-rml-draggable") === "true" && t(r);
|
|
108
|
-
}, d = (r) => {
|
|
109
|
-
this._strategy.releaseInput(r), this._strategy.isDragging && e(r);
|
|
110
|
-
}, l = (r) => {
|
|
111
|
-
a(r);
|
|
112
|
-
};
|
|
113
|
-
document.querySelectorAll('[data-rml-draggable="true"]').forEach((r) => {
|
|
114
|
-
r.draggable = !1;
|
|
115
|
-
}), document.addEventListener("mousedown", c, { signal: n }), document.addEventListener("mouseup", d, { signal: n }), document.addEventListener("mousemove", l, { signal: n }), document.addEventListener("mouseleave", d, { signal: n }), document.addEventListener("touchstart", c, { signal: n }), document.addEventListener("touchend", d, { signal: n }), document.addEventListener("touchmove", l, { signal: n });
|
|
116
|
-
}
|
|
117
|
-
unregisterCustomDrag() {
|
|
118
|
-
this._customDragSignal.abort(), this._customDragSignal = new AbortController();
|
|
119
|
-
}
|
|
120
|
-
releaseInput(t) {
|
|
121
|
-
this._strategy.releaseInput(t);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
125
|
-
__proto__: null,
|
|
126
|
-
DragIn: G
|
|
127
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
128
|
-
export {
|
|
129
|
-
f as R,
|
|
130
|
-
m as a,
|
|
131
|
-
N as b,
|
|
132
|
-
R as c,
|
|
133
|
-
w as d,
|
|
134
|
-
C as e,
|
|
135
|
-
v as f,
|
|
136
|
-
M as g,
|
|
137
|
-
O as h,
|
|
138
|
-
E as i,
|
|
139
|
-
L as j,
|
|
140
|
-
g as k,
|
|
141
|
-
$ as l
|
|
142
|
-
};
|
package/drag-in-ltdVSMsI.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,s,a)=>((e,s,a)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[s]=a)(e,"symbol"!=typeof s?s+"":s,a);class s{constructor(t,s,a,i){e(this,"_mainDomElement"),e(this,"_instance"),e(this,"_mode","website"),e(this,"_viewName","main"),this._instance=t,this._mainDomElement=s,this._mode=a,this._viewName=i}async init(){return Promise.resolve()}}const a="rml-drag-in-styles",i="rml-drag-in-drag-element",r="rml-drag-in-overlay",n="rml-drag-in-drag-ghost",o="rml-drag-in-fade-in",d="rml-drag-in-fade-out",m={DISPLAY_NONE:"rml-display-none"},g="250ms",l="forwards",c=`@keyframes ${o} {from{opacity: 0;}to {opacity: 0.5;}}`,h=`@keyframes ${d} {from{opacity: 0.5;}to {opacity: 0;}}`,u=`${o} ${g} ${l}`,p=`${d} ${g} ${l}`,_="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",y=112,b=112,f=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends s{constructor(t,s,a,i){super(t,s,a,i),e(this,"options",{}),e(this,"_customDragSignal",new AbortController),this._mainDomElement=s,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!document.getElementById(a)){const t=document.createElement("style");t.type="text/css",t.id=a,t.innerHTML=`\n .${m.DISPLAY_NONE}{display:none}\n .${r}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${n}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${c}\n ${h}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+n);e||(e=document.createElement("div"),e.classList.add(n),e.innerText=" ",t.appendChild(e))}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-DsBWpkdv.mjs");this._strategy=new t(this._instance,this._mainDomElement,{settings:this.options,mode:"website"})}catch(t){throw t}else{if("custom-view"!==this._mode)throw new Error("Unsupported mode");try{const{DragInFromCustomViewStrategy:t}=await import("./from-custom-view-Bg3_d6Sp.mjs");this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw t}}}get isDragging(){return this._strategy.isDragging}dragStart(t,e,s="rml_id"){this._strategy.dragStart(t,e,s)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,s="rml_id"){this._strategy.touchStart(t,e,s)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:s,beforeUpdateGhost:a}){a&&this._strategy.beforeUpdateGhost(a);const i=this._customDragSignal.signal,r=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},n=t=>{this._strategy.releaseInput(t),this._strategy.isDragging&&e(t)},o=t=>{s(t)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(t=>{t.draggable=!1}),document.addEventListener("mousedown",r,{signal:i}),document.addEventListener("mouseup",n,{signal:i}),document.addEventListener("mousemove",o,{signal:i}),document.addEventListener("mouseleave",n,{signal:i}),document.addEventListener("touchstart",r,{signal:i}),document.addEventListener("touchend",n,{signal:i}),document.addEventListener("touchmove",o,{signal:i})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));export{i as R,a,c as b,h as c,_ as d,y as e,b as f,u as g,p as h,r as i,m as j,n as k,f as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,s,r)=>((e,s,r)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r)(e,"symbol"!=typeof s?s+"":s,r);import{C as s,e as r,i as a,T as i,b as n,c as h,d as o}from"./touch-drag-BEct6jbW.mjs";import{d as g,e as _,f as l}from"./drag-in-ltdVSMsI.mjs";const u=t=>{t.preventDefault(),t.stopPropagation()};class c{constructor({onCustomDragStart:t},r={}){e(this,"_startX",0),e(this,"_startY",0),e(this,"_lastX",0),e(this,"_lastY",0),e(this,"_epsilon"),e(this,"_isWaiting",!1),e(this,"_onCustomDragStart"),this._epsilon="number"==typeof r.epsilon?r.epsilon:s,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,r=this._lastY-e;return Math.sqrt(s*s+r*r)})(this._startX,this._startY)>this._epsilon&&(this._onCustomDragStart(t),this._isWaiting=!1)}onStart(t){this._startX=t.clientX,this._startY=t.clientY,this.onMove(t),this._isWaiting=!0}onEnd(){this._reset()}_reset(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._isWaiting=!1}}const d="data-rml-old-draggable",m=(t,e)=>{const r=a(t),i={delay:r?n:h,epsilon:r?o:s};if(!e)return i;if(!(r||t instanceof MouseEvent))return i;const{delayKey:g,epsilonKey:_}=r?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof e[g]&&(i.delay=e.touchDragDelay),"number"==typeof e[_]&&(i.epsilon=e.touchDragEpsilon),i};class p{constructor(t,s,r){var a;e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_viewName"),e(this,"_currentCustomDrag",null),e(this,"_currentBb",null),e(this,"_startTarget",null),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),this._instance=t,this._options=s||{},this._viewName=r,this._mainDomElement=mainDomElement,null==(a=this._mainDomElement.parentElement)||a.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){var a;this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(d,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",u),this._startTarget.addEventListener("dragstart",u)),this._currentBb=await this._instance.getBoundingClientRect((a=this._viewName,`[data-rml-custom-view="${a}"]`));const{clientX:i,clientY:n}=r(e),h=this._currentBb.x+i,o=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(t,h,o,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:e,clientY:s}=r(t),{url:a,width:i,height:n}=(t=>{let e="",s=_,r=l;if(!t)return{url:g,width:s,height:r};const a=t;if(a instanceof HTMLElement){const t=a.getBoundingClientRect(),i=a.getAttribute("data-rml-ghost-url"),n=a.getAttribute("data-rml-ghost-width"),h=a.getAttribute("data-rml-ghost-height");i?e=i:!i&&a instanceof HTMLImageElement&&a.src&&(e=a.src),e?(s=t.width,r=t.height):e=g,s=n?parseInt(n,10):s,r=h?parseInt(h,10):r}return{url:e||g,width:s,height:r}})(this._startTarget),h=this._currentBb.x+e,o=this._currentBb.y+s,u=this._options||{},c={ghost:{visibleIn:{x:this._currentBb.x-(u.dragInOverlapX||0),y:this._currentBb.y+(u.dragInOverlapY||0),width:this._currentBb.width+(u.dragInOverlapX||0),height:this._currentBb.height+(u.dragInOverlapY||0)},url:a,width:i,height:n},mode:"custom-view"},{x:d,y:m,options:p}=this._onBeforeUpdateDrag(h,o,c),b="number"==typeof d?d:h,D="number"==typeof m?m:o,y=p||c;this._instance.updateDrag(b,D,y)}_dragEnd(){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._currentCustomDrag=null,this.isDragging=!1,this._currentBb=null,this._resetStartTarget(),this._instance.enableEvents(),this._instance.dragInObjectEnd()}dragStart(t,e,s){this._instance.disableEvents(),this._startTarget=e.target,this._currentCustomDrag=a(e)?new i(void 0,{onTouchDragStart:(e,r)=>{this._dragStart(t,r,s)}},m(e,this._options)):new c({onCustomDragStart:e=>this._dragStart(t,e,s)},m(e,this._options)),this._currentCustomDrag.onStart(e)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,s="rml_id"){this.dragStart(t,e,s)}touchMove(t){this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){}_resetStartTarget(){this._startTarget&&(this._startTarget.style.pointerEvents="",this._startTarget.style.userSelect="",this._startTarget.draggable="true"===this._startTarget.getAttribute(d),this._startTarget.removeAttribute(d),this._startTarget.removeEventListener("dragstart",u))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}export{p as DragInFromCustomViewStrategy};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
var v = Object.defineProperty;
|
|
2
|
-
var A = (a, t, s) => t in a ? v(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
|
|
3
|
-
var i = (a, t, s) => A(a, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
-
import { C as T, e as p, i as b, T as I, b as O, c as B, d as L } from "./touch-drag-DNDPwZ-_.mjs";
|
|
5
|
-
import { d as c, e as Y, f as X } from "./drag-in-CqBNfbIX.mjs";
|
|
6
|
-
const G = (a) => `[data-rml-custom-view="${a}"]`, l = (a) => {
|
|
7
|
-
a.preventDefault(), a.stopPropagation();
|
|
8
|
-
}, w = (a, t, s, e) => {
|
|
9
|
-
const r = s - a, n = e - t;
|
|
10
|
-
return Math.sqrt(r * r + n * n);
|
|
11
|
-
};
|
|
12
|
-
class U {
|
|
13
|
-
constructor({ onCustomDragStart: t }, s = {}) {
|
|
14
|
-
i(this, "_startX", 0);
|
|
15
|
-
i(this, "_startY", 0);
|
|
16
|
-
i(this, "_lastX", 0);
|
|
17
|
-
i(this, "_lastY", 0);
|
|
18
|
-
i(this, "_epsilon");
|
|
19
|
-
i(this, "_isWaiting", !1);
|
|
20
|
-
i(this, "_onCustomDragStart");
|
|
21
|
-
this._epsilon = typeof s.epsilon == "number" ? s.epsilon : T, this._onCustomDragStart = t;
|
|
22
|
-
}
|
|
23
|
-
onMove(t) {
|
|
24
|
-
this._lastX = t.clientX, this._lastY = t.clientY, this._isWaiting && w(
|
|
25
|
-
this._startX,
|
|
26
|
-
this._startY,
|
|
27
|
-
this._lastX,
|
|
28
|
-
this._lastY
|
|
29
|
-
) > this._epsilon && (this._onCustomDragStart(t), this._isWaiting = !1);
|
|
30
|
-
}
|
|
31
|
-
onStart(t) {
|
|
32
|
-
this._startX = t.clientX, this._startY = t.clientY, this.onMove(t), this._isWaiting = !0;
|
|
33
|
-
}
|
|
34
|
-
onEnd() {
|
|
35
|
-
this._reset();
|
|
36
|
-
}
|
|
37
|
-
_reset() {
|
|
38
|
-
this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const u = "data-rml-old-draggable", R = void 0, f = (a, t) => {
|
|
42
|
-
const s = b(a), e = {
|
|
43
|
-
delay: s ? O : B,
|
|
44
|
-
epsilon: s ? L : T
|
|
45
|
-
};
|
|
46
|
-
if (!t)
|
|
47
|
-
return e;
|
|
48
|
-
if (!s && !(a instanceof MouseEvent))
|
|
49
|
-
return console.warn(
|
|
50
|
-
"Unsupported event! It is not TouchEvent and also not MouseEvent"
|
|
51
|
-
), e;
|
|
52
|
-
const {
|
|
53
|
-
delayKey: r,
|
|
54
|
-
epsilonKey: n
|
|
55
|
-
} = s ? { delayKey: "touchDragDelay", epsilonKey: "touchDragEpsilon" } : { delayKey: "customDragDelay", epsilonKey: "customDragEpsilon" };
|
|
56
|
-
return typeof t[r] == "number" && (e.delay = t.touchDragDelay), typeof t[n] == "number" && (e.epsilon = t.touchDragEpsilon), e;
|
|
57
|
-
}, M = (a) => {
|
|
58
|
-
let t = "", s = Y, e = X;
|
|
59
|
-
if (!a)
|
|
60
|
-
return { url: c, width: s, height: e };
|
|
61
|
-
const r = a;
|
|
62
|
-
if (r instanceof HTMLElement) {
|
|
63
|
-
const n = r.getBoundingClientRect(), o = r.getAttribute("data-rml-ghost-url"), h = r.getAttribute("data-rml-ghost-width"), g = r.getAttribute("data-rml-ghost-height");
|
|
64
|
-
o ? t = o : !o && r instanceof HTMLImageElement && r.src && (t = r.src), t ? (s = n.width, e = n.height) : t = c, s = h ? parseInt(h, 10) : s, e = g ? parseInt(g, 10) : e;
|
|
65
|
-
}
|
|
66
|
-
return { url: t || c, width: s, height: e };
|
|
67
|
-
};
|
|
68
|
-
class N {
|
|
69
|
-
constructor(t, s, e) {
|
|
70
|
-
i(this, "_options", {});
|
|
71
|
-
i(this, "_instance");
|
|
72
|
-
i(this, "_mainDomElement");
|
|
73
|
-
i(this, "_viewName");
|
|
74
|
-
i(this, "_currentCustomDrag", null);
|
|
75
|
-
i(this, "_currentBb", null);
|
|
76
|
-
i(this, "_startTarget", null);
|
|
77
|
-
i(this, "_onBeforeUpdateDrag", () => ({}));
|
|
78
|
-
i(this, "isDragging", !1);
|
|
79
|
-
var r;
|
|
80
|
-
this._instance = t, this._options = s || {}, this._viewName = e, this._mainDomElement = mainDomElement, (r = this._mainDomElement.parentElement) == null || r.addEventListener("dragleave", () => {
|
|
81
|
-
this._instance.cancelDragIn();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
beforeUpdateGhost(t) {
|
|
85
|
-
this._onBeforeUpdateDrag = t;
|
|
86
|
-
}
|
|
87
|
-
async _dragStart(t, s, e = "rml_id") {
|
|
88
|
-
this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(
|
|
89
|
-
u,
|
|
90
|
-
this._startTarget.draggable.toString()
|
|
91
|
-
), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", l), this._startTarget.addEventListener("dragstart", l)), this._currentBb = await this._instance.getBoundingClientRect(
|
|
92
|
-
G(this._viewName)
|
|
93
|
-
);
|
|
94
|
-
const { clientX: r, clientY: n } = p(s), o = this._currentBb.x + r, h = this._currentBb.y + n;
|
|
95
|
-
this.isDragging = !0, this._instance.dragInObject(t, o, h, e);
|
|
96
|
-
}
|
|
97
|
-
_dragUpdate(t) {
|
|
98
|
-
if (document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(t), !this._currentBb || !this.isDragging)
|
|
99
|
-
return;
|
|
100
|
-
const { clientX: s, clientY: e } = p(t), { url: r, width: n, height: o } = M(this._startTarget), h = this._currentBb.x + s, g = this._currentBb.y + e, _ = this._options || {}, d = {
|
|
101
|
-
ghost: {
|
|
102
|
-
visibleIn: {
|
|
103
|
-
x: this._currentBb.x - (_.dragInOverlapX || 0),
|
|
104
|
-
y: this._currentBb.y + (_.dragInOverlapY || 0),
|
|
105
|
-
width: this._currentBb.width + (_.dragInOverlapX || 0),
|
|
106
|
-
height: this._currentBb.height + (_.dragInOverlapY || 0)
|
|
107
|
-
},
|
|
108
|
-
url: r,
|
|
109
|
-
width: n,
|
|
110
|
-
height: o
|
|
111
|
-
},
|
|
112
|
-
mode: "custom-view"
|
|
113
|
-
}, {
|
|
114
|
-
x: m,
|
|
115
|
-
y: D,
|
|
116
|
-
options: E
|
|
117
|
-
} = this._onBeforeUpdateDrag(h, g, d), y = typeof m == "number" ? m : h, C = typeof D == "number" ? D : g, S = E || d;
|
|
118
|
-
this._instance.updateDrag(y, C, S);
|
|
119
|
-
}
|
|
120
|
-
_dragEnd() {
|
|
121
|
-
this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._currentBb = null, this._resetStartTarget(), this._instance.enableEvents(), this._instance.dragInObjectEnd();
|
|
122
|
-
}
|
|
123
|
-
dragStart(t, s, e) {
|
|
124
|
-
this._instance.disableEvents(), this._startTarget = s.target;
|
|
125
|
-
const r = (n, o) => {
|
|
126
|
-
this._dragStart(t, o, e);
|
|
127
|
-
};
|
|
128
|
-
this._currentCustomDrag = b(s) ? new I(
|
|
129
|
-
R,
|
|
130
|
-
{
|
|
131
|
-
onTouchDragStart: r
|
|
132
|
-
},
|
|
133
|
-
f(s, this._options)
|
|
134
|
-
) : new U(
|
|
135
|
-
{
|
|
136
|
-
onCustomDragStart: (n) => this._dragStart(t, n, e)
|
|
137
|
-
},
|
|
138
|
-
f(s, this._options)
|
|
139
|
-
), this._currentCustomDrag.onStart(s);
|
|
140
|
-
}
|
|
141
|
-
dragEnd() {
|
|
142
|
-
this._dragEnd();
|
|
143
|
-
}
|
|
144
|
-
dragUpdate(t) {
|
|
145
|
-
this._dragUpdate(t);
|
|
146
|
-
}
|
|
147
|
-
touchStart(t, s, e = "rml_id") {
|
|
148
|
-
this.dragStart(t, s, e);
|
|
149
|
-
}
|
|
150
|
-
touchMove(t) {
|
|
151
|
-
this.dragUpdate(t);
|
|
152
|
-
}
|
|
153
|
-
touchEnd() {
|
|
154
|
-
this.dragEnd();
|
|
155
|
-
}
|
|
156
|
-
dispose() {
|
|
157
|
-
}
|
|
158
|
-
_resetStartTarget() {
|
|
159
|
-
this._startTarget && (this._startTarget.style.pointerEvents = "", this._startTarget.style.userSelect = "", this._startTarget.draggable = this._startTarget.getAttribute(u) === "true", this._startTarget.removeAttribute(u), this._startTarget.removeEventListener("dragstart", l));
|
|
160
|
-
}
|
|
161
|
-
releaseInput(t) {
|
|
162
|
-
this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._resetStartTarget();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
export {
|
|
166
|
-
N as DragInFromCustomViewStrategy
|
|
167
|
-
};
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
var F = Object.defineProperty;
|
|
2
|
-
var M = (r, e, t) => e in r ? F(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
-
var l = (r, e, t) => M(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { g as C, e as E, a as G, i as N, T as O } from "./touch-drag-DNDPwZ-_.mjs";
|
|
5
|
-
import { R as f, a as p, b as w, c as B, d as Y, e as v, f as L, g as x, h as S, i as A, j as R, k as H } from "./drag-in-CqBNfbIX.mjs";
|
|
6
|
-
const T = (r, e, t = 0, n = 0) => {
|
|
7
|
-
const s = e.x + e.width + t, i = e.x - t, a = e.y + e.height + n, d = e.y - n, { x: o, y: h } = r;
|
|
8
|
-
return o >= i && o <= s && h >= d && h <= a;
|
|
9
|
-
}, b = (r, e, t, n = 0, s = 0) => {
|
|
10
|
-
if (!(!t || !t.hiddenIn && !t.visibleIn))
|
|
11
|
-
return t.visibleIn ? T(
|
|
12
|
-
{ x: r, y: e },
|
|
13
|
-
t.visibleIn,
|
|
14
|
-
n,
|
|
15
|
-
s
|
|
16
|
-
) : t.hiddenIn ? !T(
|
|
17
|
-
{ x: r, y: e },
|
|
18
|
-
t.hiddenIn,
|
|
19
|
-
-n,
|
|
20
|
-
-s
|
|
21
|
-
) : !1;
|
|
22
|
-
}, U = () => {
|
|
23
|
-
if (!!!document.getElementById(p)) {
|
|
24
|
-
const e = document.createElement("style");
|
|
25
|
-
e.type = "text/css", e.id = p, e.innerHTML = `
|
|
26
|
-
${w}
|
|
27
|
-
${B}
|
|
28
|
-
`, document.head.appendChild(e);
|
|
29
|
-
}
|
|
30
|
-
}, P = ({ x: r, y: e }, t) => {
|
|
31
|
-
var s, i, a, d, o, h;
|
|
32
|
-
let n = document.getElementById(f);
|
|
33
|
-
if (!n) {
|
|
34
|
-
if (n = document.createElement("div"), (s = t.ghost) != null && s.element)
|
|
35
|
-
n.appendChild(t.ghost.element);
|
|
36
|
-
else {
|
|
37
|
-
const g = document.createElement("img");
|
|
38
|
-
g.src = ((i = t.ghost) == null ? void 0 : i.url) || Y, g.width = ((a = t.ghost) == null ? void 0 : a.width) || v, g.height = ((d = t.ghost) == null ? void 0 : d.height) || L, n.appendChild(g);
|
|
39
|
-
}
|
|
40
|
-
n.id = f, n.style.position = "fixed", n.style.top = "0", n.style.left = "0", n.style.willChange = "transform", n.style.transform = "translate3d(0, 0, 0)", n.style.zIndex = "9999", n.style.opacity = "0.5", b(
|
|
41
|
-
r,
|
|
42
|
-
e,
|
|
43
|
-
t.ghost || {},
|
|
44
|
-
(o = t.settings) == null ? void 0 : o.dragInOverlapX,
|
|
45
|
-
(h = t.settings) == null ? void 0 : h.dragInOverlapY
|
|
46
|
-
) || (n.style.display = "none"), n.style.pointerEvents = "none", document.body.appendChild(n);
|
|
47
|
-
}
|
|
48
|
-
}, X = ({ x: r, y: e }, t) => {
|
|
49
|
-
var o, h, g, c;
|
|
50
|
-
const n = document.getElementById(f);
|
|
51
|
-
if (!n)
|
|
52
|
-
return;
|
|
53
|
-
let s = (o = t.ghost) == null ? void 0 : o.width, i = (h = t.ghost) == null ? void 0 : h.height;
|
|
54
|
-
typeof s > "u" && (s = n.getBoundingClientRect().width || v), typeof i > "u" && (i = n.getBoundingClientRect().height || L);
|
|
55
|
-
const a = r - s / 2, d = e - i / 2;
|
|
56
|
-
n.style.transform = `translate3d(${a}px, ${d}px, 0)`, t.ghost && (b(
|
|
57
|
-
r,
|
|
58
|
-
e,
|
|
59
|
-
t.ghost,
|
|
60
|
-
(g = t.settings) == null ? void 0 : g.dragInOverlapX,
|
|
61
|
-
(c = t.settings) == null ? void 0 : c.dragInOverlapY
|
|
62
|
-
) ? n.style.animation != x && (n.style.animation = x) : n.style.animation != S && (n.style.animation = S));
|
|
63
|
-
};
|
|
64
|
-
class k {
|
|
65
|
-
constructor(e = null) {
|
|
66
|
-
l(this, "_dragGhostAnimationFrameId", null);
|
|
67
|
-
l(this, "_dragGhostRemoveAnimationFrameId", null);
|
|
68
|
-
l(this, "_dragGhostElement", null);
|
|
69
|
-
this._dragGhostElement = e;
|
|
70
|
-
}
|
|
71
|
-
updateDragGhost(e, t, n) {
|
|
72
|
-
var s;
|
|
73
|
-
this._dragGhostRemoveAnimationFrameId && (cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId), this._dragGhostRemoveAnimationFrameId = null), !((s = n.ghost) != null && s.external) && n.ghost && (this._dragGhostAnimationFrameId || (this._dragGhostAnimationFrameId = requestAnimationFrame(() => {
|
|
74
|
-
U();
|
|
75
|
-
const i = { x: e, y: t };
|
|
76
|
-
!n.ghost && this._dragGhostElement && (n.ghost = {}), n.ghost && !n.ghost.element && this._dragGhostElement && (n.ghost.element = this._dragGhostElement), P(i, n), X(i, n), this._dragGhostAnimationFrameId = null;
|
|
77
|
-
})));
|
|
78
|
-
}
|
|
79
|
-
removeDragGhost() {
|
|
80
|
-
this._dragGhostAnimationFrameId && (cancelAnimationFrame(this._dragGhostAnimationFrameId), this._dragGhostAnimationFrameId = null), this._dragGhostRemoveAnimationFrameId || (this._dragGhostRemoveAnimationFrameId = requestAnimationFrame(() => {
|
|
81
|
-
const e = document.getElementById(f);
|
|
82
|
-
e && document.body.removeChild(e), this._dragGhostRemoveAnimationFrameId = null;
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
class z {
|
|
87
|
-
constructor(e, t, n) {
|
|
88
|
-
l(this, "_options", {});
|
|
89
|
-
l(this, "_instance");
|
|
90
|
-
l(this, "_mainDomElement");
|
|
91
|
-
l(this, "_currentDrag", {});
|
|
92
|
-
l(this, "_currentTouch", null);
|
|
93
|
-
l(this, "_firefoxDragPosition", { x: 0, y: 0 });
|
|
94
|
-
l(this, "_onBeforeUpdateDrag", () => ({}));
|
|
95
|
-
l(this, "isDragging", !1);
|
|
96
|
-
l(this, "_firefoxFallback", (e) => {
|
|
97
|
-
if (!this._currentDrag.event)
|
|
98
|
-
return;
|
|
99
|
-
e.preventDefault();
|
|
100
|
-
const t = e || window.event;
|
|
101
|
-
this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
|
|
102
|
-
});
|
|
103
|
-
var s;
|
|
104
|
-
this._instance = e, this._mainDomElement = t, this._options = n || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), (s = this._mainDomElement.parentElement) == null || s.addEventListener("dragleave", () => {
|
|
105
|
-
this._instance.cancelDragIn();
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
beforeUpdateGhost(e) {
|
|
109
|
-
this._onBeforeUpdateDrag = e;
|
|
110
|
-
}
|
|
111
|
-
dragStart(e, t, n = "rml_id") {
|
|
112
|
-
const s = this._mainDomElement.parentNode;
|
|
113
|
-
if (C(s).position !== "relative") {
|
|
114
|
-
console.warn(
|
|
115
|
-
"Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly"
|
|
116
|
-
);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
this._mainDomElement.style.pointerEvents = "none";
|
|
120
|
-
let a = s.querySelector(
|
|
121
|
-
"." + A
|
|
122
|
-
);
|
|
123
|
-
a || (a = document.createElement("div"), a.classList.add(A), s.appendChild(a)), a.classList.remove(R.DISPLAY_NONE), t.target.getAttribute("draggable") || console.warn(
|
|
124
|
-
`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`
|
|
125
|
-
);
|
|
126
|
-
const o = s.querySelector(
|
|
127
|
-
"." + H
|
|
128
|
-
);
|
|
129
|
-
this._currentDrag.event = t;
|
|
130
|
-
const h = t.target, g = h.cloneNode(!0), c = h.getBoundingClientRect();
|
|
131
|
-
g.style.width = `${c.width}px`, g.style.height = `${c.height}px`, this._currentDrag.ghost = new k(g), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
|
|
132
|
-
const { clientX: _, clientY: D } = E(
|
|
133
|
-
t,
|
|
134
|
-
this._firefoxDragPosition
|
|
135
|
-
);
|
|
136
|
-
this._currentDrag.offset.x = _ - c.left, this._currentDrag.offset.y = D - c.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(o, 0, 0);
|
|
137
|
-
const { x: y, y: u } = G(
|
|
138
|
-
s,
|
|
139
|
-
this._currentDrag.event || t,
|
|
140
|
-
this._firefoxDragPosition
|
|
141
|
-
), m = Math.max(1, y), I = Math.max(1, u);
|
|
142
|
-
this.isDragging = !0, this._instance.dragInObject(e, m, I, n);
|
|
143
|
-
}
|
|
144
|
-
dragUpdate(e) {
|
|
145
|
-
var u;
|
|
146
|
-
const t = this._mainDomElement.parentNode, { x: n, y: s } = G(t, e, this._firefoxDragPosition);
|
|
147
|
-
if (n === 0 && s === 0)
|
|
148
|
-
return;
|
|
149
|
-
const i = Math.max(1, n), a = Math.max(1, s);
|
|
150
|
-
if (i === 1 && a === 1)
|
|
151
|
-
return;
|
|
152
|
-
let d = i, o = a;
|
|
153
|
-
if (N(e)) {
|
|
154
|
-
const m = ((u = this._options.settings) == null ? void 0 : u.fingerSize) || 0;
|
|
155
|
-
d = Math.max(2, i + m), o = Math.max(2, a - m);
|
|
156
|
-
}
|
|
157
|
-
const {
|
|
158
|
-
x: h,
|
|
159
|
-
y: g,
|
|
160
|
-
options: c
|
|
161
|
-
} = this._onBeforeUpdateDrag(d, o, {}), _ = c || { settings: {}, ghost: {} };
|
|
162
|
-
_.ghost || (_.ghost = {}), _.ghost.visibleIn && _.ghost.hiddenIn || (_.ghost.hiddenIn = this._mainDomElement.getBoundingClientRect());
|
|
163
|
-
const D = typeof h == "number" ? h : d, y = typeof g == "number" ? g : o;
|
|
164
|
-
if (this._currentDrag.ghost) {
|
|
165
|
-
const { clientX: m, clientY: I } = E(
|
|
166
|
-
e,
|
|
167
|
-
this._firefoxDragPosition
|
|
168
|
-
);
|
|
169
|
-
this._currentDrag.ghost.updateDragGhost(m, I, _);
|
|
170
|
-
}
|
|
171
|
-
this._instance.updateDrag(D, y, {});
|
|
172
|
-
}
|
|
173
|
-
dragEnd() {
|
|
174
|
-
this._mainDomElement.style.pointerEvents = "all";
|
|
175
|
-
const e = this._mainDomElement.parentNode;
|
|
176
|
-
this.isDragging = !1, this._instance.dragInObjectEnd(), this._currentDrag.ghost && (this._currentDrag.ghost.removeDragGhost(), this._currentDrag.ghost = null), this._currentDrag = {}, this._firefoxDragPosition = { x: 0, y: 0 };
|
|
177
|
-
const t = e.querySelector(
|
|
178
|
-
"." + A
|
|
179
|
-
);
|
|
180
|
-
t && t.classList.add(R.DISPLAY_NONE);
|
|
181
|
-
}
|
|
182
|
-
touchStart(e, t, n = "rml_id") {
|
|
183
|
-
var a, d, o, h;
|
|
184
|
-
t.preventDefault();
|
|
185
|
-
const s = (g, c) => {
|
|
186
|
-
this.dragStart(e, c, n);
|
|
187
|
-
}, i = {};
|
|
188
|
-
typeof ((d = (a = this._options) == null ? void 0 : a.settings) == null ? void 0 : d.touchDragDelay) == "number" && (i.delay = this._options.settings.touchDragDelay), (h = (o = this._options) == null ? void 0 : o.settings) != null && h.touchDragEpsilon && (i.epsilon = this._options.settings.touchDragEpsilon), this._currentTouch = new O(
|
|
189
|
-
void 0,
|
|
190
|
-
{
|
|
191
|
-
onTouchDragStart: s
|
|
192
|
-
},
|
|
193
|
-
i
|
|
194
|
-
), this._currentTouch.onStart(t);
|
|
195
|
-
}
|
|
196
|
-
touchMove(e) {
|
|
197
|
-
this._currentTouch && this._currentTouch.onMove(e), this._currentDrag.event && this.dragUpdate(e);
|
|
198
|
-
}
|
|
199
|
-
touchEnd() {
|
|
200
|
-
this._currentTouch && this._currentTouch.onEnd(), this._currentTouch = null, this.dragEnd();
|
|
201
|
-
}
|
|
202
|
-
dispose() {
|
|
203
|
-
document.removeEventListener("dragover", this._firefoxFallback);
|
|
204
|
-
}
|
|
205
|
-
releaseInput(e) {
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
export {
|
|
209
|
-
z as DragInFromWebsiteStrategy
|
|
210
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,n,i)=>((e,n,i)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i)(e,"symbol"!=typeof n?n+"":n,i);import{g as n,e as i,a as s,i as o,T as a}from"./touch-drag-BEct6jbW.mjs";import{R as r,a as h,b as l,c as d,d as g,e as m,f as c,g as u,h as _,i as f,j as p,k as v}from"./drag-in-ltdVSMsI.mjs";const D=(t,e,n=0,i=0)=>{const s=e.x+e.width+n,o=e.x-n,a=e.y+e.height+i,r=e.y-i,{x:h,y:l}=t;return h>=o&&h<=s&&l>=r&&l<=a},y=(t,e,n,i=0,s=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?D({x:t,y:e},n.visibleIn,i,s):!!n.hiddenIn&&!D({x:t,y:e},n.hiddenIn,-i,-s)};class x{constructor(t=null){e(this,"_dragGhostAnimationFrameId",null),e(this,"_dragGhostRemoveAnimationFrameId",null),e(this,"_dragGhostElement",null),this._dragGhostElement=t}updateDragGhost(t,e,n){var i;this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),(null==(i=n.ghost)||!i.external)&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(h)){const t=document.createElement("style");t.type="text/css",t.id=h,t.innerHTML=`\n ${l}\n ${d}\n `,document.head.appendChild(t)}})();const i={x:t,y:e};!n.ghost&&this._dragGhostElement&&(n.ghost={}),n.ghost&&!n.ghost.element&&this._dragGhostElement&&(n.ghost.element=this._dragGhostElement),(({x:t,y:e},n)=>{var i,s,o,a,h,l;let d=document.getElementById(r);if(!d){if(d=document.createElement("div"),null!=(i=n.ghost)&&i.element)d.appendChild(n.ghost.element);else{const t=document.createElement("img");t.src=(null==(s=n.ghost)?void 0:s.url)||g,t.width=(null==(o=n.ghost)?void 0:o.width)||m,t.height=(null==(a=n.ghost)?void 0:a.height)||c,d.appendChild(t)}d.id=r,d.style.position="fixed",d.style.top="0",d.style.left="0",d.style.willChange="transform",d.style.transform="translate3d(0, 0, 0)",d.style.zIndex="9999",d.style.opacity="0.5",y(t,e,n.ghost||{},null==(h=n.settings)?void 0:h.dragInOverlapX,null==(l=n.settings)?void 0:l.dragInOverlapY)||(d.style.display="none"),d.style.pointerEvents="none",document.body.appendChild(d)}})(i,n),(({x:t,y:e},n)=>{var i,s,o,a;const h=document.getElementById(r);if(!h)return;let l=null==(i=n.ghost)?void 0:i.width,d=null==(s=n.ghost)?void 0:s.height;typeof l>"u"&&(l=h.getBoundingClientRect().width||m),typeof d>"u"&&(d=h.getBoundingClientRect().height||c);const g=t-l/2,f=e-d/2;h.style.transform=`translate3d(${g}px, ${f}px, 0)`,n.ghost&&(y(t,e,n.ghost,null==(o=n.settings)?void 0:o.dragInOverlapX,null==(a=n.settings)?void 0:a.dragInOverlapY)?h.style.animation!=u&&(h.style.animation=u):h.style.animation!=_&&(h.style.animation=_))})(i,n),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(r);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class I{constructor(t,n,i){var s;e(this,"_options",{}),e(this,"_instance"),e(this,"_mainDomElement"),e(this,"_currentDrag",{}),e(this,"_currentTouch",null),e(this,"_firefoxDragPosition",{x:0,y:0}),e(this,"_onBeforeUpdateDrag",()=>({})),e(this,"isDragging",!1),e(this,"_firefoxFallback",t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0}),this._instance=t,this._mainDomElement=n,this._options=i||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),null==(s=this._mainDomElement.parentElement)||s.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(t,e,o="rml_id"){const a=this._mainDomElement.parentNode;if("relative"!==n(a).position)return;this._mainDomElement.style.pointerEvents="none";let r=a.querySelector("."+f);r||(r=document.createElement("div"),r.classList.add(f),a.appendChild(r)),r.classList.remove(p.DISPLAY_NONE),e.target.getAttribute("draggable");const h=a.querySelector("."+v);this._currentDrag.event=e;const l=e.target,d=l.cloneNode(!0),g=l.getBoundingClientRect();d.style.width=`${g.width}px`,d.style.height=`${g.height}px`,this._currentDrag.ghost=new x(d),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:m,clientY:c}=i(e,this._firefoxDragPosition);this._currentDrag.offset.x=m-g.left,this._currentDrag.offset.y=c-g.top,e instanceof DragEvent&&e.dataTransfer&&e.dataTransfer.setDragImage&&e.dataTransfer.setDragImage(h,0,0);const{x:u,y:_}=s(a,this._currentDrag.event||e,this._firefoxDragPosition),D=Math.max(1,u),y=Math.max(1,_);this.isDragging=!0,this._instance.dragInObject(t,D,y,o)}dragUpdate(t){var e;const n=this._mainDomElement.parentNode,{x:a,y:r}=s(n,t,this._firefoxDragPosition);if(0===a&&0===r)return;const h=Math.max(1,a),l=Math.max(1,r);if(1===h&&1===l)return;let d=h,g=l;if(o(t)){const t=(null==(e=this._options.settings)?void 0:e.fingerSize)||0;d=Math.max(2,h+t),g=Math.max(2,l-t)}const{x:m,y:c,options:u}=this._onBeforeUpdateDrag(d,g,{}),_=u||{settings:{},ghost:{}};_.ghost||(_.ghost={}),_.ghost.visibleIn&&_.ghost.hiddenIn||(_.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const f="number"==typeof m?m:d,p="number"==typeof c?c:g;if(this._currentDrag.ghost){const{clientX:e,clientY:n}=i(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(e,n,_)}this._instance.updateDrag(f,p,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+f);e&&e.classList.add(p.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){var i,s,o,r;e.preventDefault();const h={};"number"==typeof(null==(s=null==(i=this._options)?void 0:i.settings)?void 0:s.touchDragDelay)&&(h.delay=this._options.settings.touchDragDelay),null!=(r=null==(o=this._options)?void 0:o.settings)&&r.touchDragEpsilon&&(h.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new a(void 0,{onTouchDragStart:(e,i)=>{this.dragStart(t,i,n)}},h),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}export{I as DragInFromWebsiteStrategy};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface ServiceWorkerHmrPluginConfig {
|
|
2
|
-
inputFile: string;
|
|
3
|
-
outputFile: string;
|
|
4
|
-
}
|
|
5
|
-
declare const bundleSwPlugin: (config: ServiceWorkerHmrPluginConfig[]) => {
|
|
6
|
-
apply: string;
|
|
7
|
-
enforce: string;
|
|
8
|
-
configResolved(): void;
|
|
9
|
-
};
|
|
10
|
-
export default bundleSwPlugin;
|
package/touch-drag-BEct6jbW.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,i,n)=>((e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n)(e,"symbol"!=typeof i?i+"":i,n);class i{constructor(t=16){e(this,"_computedStyleCache",new Map),e(this,"_maxLifetime",16),e(this,"_cacheCleanInterval",null),this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),i=Date.now();if(e&&i-e.updated<this._maxLifetime)return e.style;const n=getComputedStyle(t);return this._computedStyleCache.set(t,{style:n,updated:i}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),n}_cleanUpCache(){const t=Date.now();for(const[e,{updated:i}]of this._computedStyleCache.entries())t-i>=this._maxLifetime&&this._computedStyleCache.delete(e);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const n=t=>window.TouchEvent&&t instanceof window.TouchEvent;let s;const c=t=>(s||(s=new i),s.get(t)),h=(t,e,i)=>{const n=parseFloat(t),s=window.devicePixelRatio||1;if("px"===e)return n;if("%"===e)return n/100*(i===document.documentElement?window.innerWidth:i.offsetWidth);if("rem"===e)return n*parseFloat(c(document.documentElement).fontSize);if("em"===e)return n*parseFloat(c(i).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return n/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const h={cm:37.7952755906,mm:3.77952755906,in:96};return e in h?n*h[e]*s:0},l=(t,e,i={x:0,y:0})=>{const n=t.getBoundingClientRect(),s=c(t).transform;let l=0,a=0;if("none"!==s){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,i=s.match(e);i&&(l=h(i[1],i[2],t),a=h(i[3],i[4],t))}const{clientX:r,clientY:u}=o(e,i);return{x:r-n.left-l+t.scrollLeft,y:u-n.top-a+t.scrollTop}},o=(t,e=null)=>{const{clientX:i,clientY:s}=n(t)?a(t):t;return{clientX:i>0?i:e?e.x:i,clientY:s>0?s:e?e.y:s}},a=t=>{if(t.touches.length){let{clientX:e,clientY:i}=t.touches[0];if(t.touches.length>1){const n=t.touches[1];e=(e+n.clientX)/2,i=(i+n.clientY)/2}return{clientX:e,clientY:i}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},r=500,u=10,_=100,d=15,m=(t,e=0)=>n(t)?{clientX:t.touches[e].clientX,clientY:t.touches[e].clientY}:{clientX:t.clientX,clientY:t.clientY},f=t=>!t||!n(t)||t.touches.length>0;class p{constructor(t,{onTouchDragStart:i},n={}){e(this,"_touchDragTimeOut"),e(this,"_onTouchDragStart"),e(this,"_payload",null),e(this,"_delay",500),e(this,"_firstTouch",null),e(this,"_lastTouch",null),e(this,"_epsilon",10),this._payload=t,this._onTouchDragStart=i,this._delay="number"==typeof n.delay?n.delay:500,this._epsilon="number"==typeof n.epsilon?n.epsilon:10}onStart(t){f(t)&&(this._touchDragTimeOut||(this._firstTouch=m(t,n(t)?t.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=m(t)),this._checkXDistance(t)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){f(t)&&(this._lastTouch=m(t))}_clearTimeout(){this._touchDragTimeOut&&(clearTimeout(this._touchDragTimeOut),this._touchDragTimeOut=null)}_resetTouches(){this._clearTimeout(),this._lastTouch=null,this._firstTouch=null,this._payload=null}_checkXDistance(t){return()=>{if(!this._firstTouch||!this._lastTouch)return;let e=!1;e=Math.abs(this._firstTouch.clientX-this._lastTouch.clientX)<this._epsilon,e&&(this._onTouchDragStart(this._payload,t),this._resetTouches())}}}export{d as C,p as T,l as a,r as b,_ as c,u as d,o as e,c as g,n as i};
|