@roomle/embedding-lib 6.5.0 → 6.6.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/browser-C_Dfiou7.mjs +18 -0
  2. package/browser-DRgK3Fk8.mjs +16 -0
  3. package/comlink-BipJ8Ikr.mjs +237 -0
  4. package/comlink-Dds_bpug.mjs +220 -0
  5. package/docs/md/web/embedding/CHANGELOG.md +32 -150
  6. package/drag-ghost-BGZWgVa7.mjs +60 -0
  7. package/drag-ghost-DGgvJ4Lm.mjs +65 -0
  8. package/drag-in-AFSAsnAN.mjs +102 -0
  9. package/drag-in-BwqVwCBp.mjs +96 -0
  10. package/embedding-plugins.js +2 -14
  11. package/embedding-plugins.min.js +2 -1
  12. package/from-custom-view-B-eXMXF1.mjs +207 -0
  13. package/from-custom-view-tZcYF-zX.mjs +206 -0
  14. package/from-website--UCl1aQs.mjs +113 -0
  15. package/from-website-BesXdvcV.mjs +118 -0
  16. package/hi.js +72 -119
  17. package/hi.min.js +71 -1
  18. package/package.json +1 -1
  19. package/rolldown-runtime-C-QNzSnW.mjs +11 -0
  20. package/rolldown-runtime-C017PlDO.mjs +9 -0
  21. package/roomle-embedding-lib.js +394 -576
  22. package/roomle-embedding-lib.min.js +365 -1
  23. package/utils-BnWKaFPc.mjs +126 -0
  24. package/utils-DfC2ZLUc.mjs +118 -0
  25. package/browser-BhHw2H1M.mjs +0 -1
  26. package/browser-CUgD7zyH.mjs +0 -21
  27. package/comlink-BAiXCcU9.mjs +0 -258
  28. package/comlink-CmT64Qi3.mjs +0 -1
  29. package/drag-ghost-B7UAYefM.mjs +0 -1
  30. package/drag-ghost-DHrf_Evu.mjs +0 -81
  31. package/embedding-plugins-DLVs7ER4.mjs +0 -1
  32. package/embedding-plugins-DqMSzAJe.mjs +0 -140
  33. package/from-custom-view-CaDOooe4.mjs +0 -1
  34. package/from-custom-view-T67aFIDR.mjs +0 -249
  35. package/from-website-Bvd5Pi0i.mjs +0 -134
  36. package/from-website-nKwD78_u.mjs +0 -1
  37. package/utils-BqTPLNLs.mjs +0 -1
  38. package/utils-Dav4kGNW.mjs +0 -150
@@ -1,249 +0,0 @@
1
- import { i as o, e as X, b as A } from "./utils-Dav4kGNW.mjs";
2
- import { i as Y, h as L, g as c } from "./embedding-plugins-DqMSzAJe.mjs";
3
- import { E } from "./drag-ghost-DHrf_Evu.mjs";
4
- const m = 500, f = 10, R = 100, I = 15, g = (i, t = 0) => o(i) ? {
5
- clientX: i.touches[t].clientX,
6
- clientY: i.touches[t].clientY
7
- } : {
8
- clientX: i.clientX,
9
- clientY: i.clientY
10
- }, b = (i) => i && o(i) ? i.touches.length > 0 : !0;
11
- class M {
12
- _touchDragTimeOut;
13
- _onTouchDragStart;
14
- _payload = null;
15
- _delay = m;
16
- _firstTouch = null;
17
- _lastTouch = null;
18
- _epsilon = f;
19
- constructor(t, { onTouchDragStart: s }, e = {}) {
20
- this._payload = t, this._onTouchDragStart = s, this._delay = typeof e.delay == "number" ? e.delay : m, this._epsilon = typeof e.epsilon == "number" ? e.epsilon : f;
21
- }
22
- onStart(t) {
23
- b(t) && (this._touchDragTimeOut || (this._firstTouch = g(
24
- t,
25
- o(t) ? t.touches.length - 1 : 0
26
- ), this._touchDragTimeOut = setTimeout(() => {
27
- this._clearTimeout(), this._lastTouch || (this._lastTouch = g(t)), this._checkXDistance(t)();
28
- }, this._delay)));
29
- }
30
- onEnd() {
31
- this._resetTouches();
32
- }
33
- onMove(t) {
34
- b(t) && (this._lastTouch = g(t));
35
- }
36
- _clearTimeout() {
37
- this._touchDragTimeOut && (clearTimeout(this._touchDragTimeOut), this._touchDragTimeOut = null);
38
- }
39
- _resetTouches() {
40
- this._clearTimeout(), this._lastTouch = null, this._firstTouch = null, this._payload = null;
41
- }
42
- _checkXDistance(t) {
43
- return () => {
44
- if (!this._firstTouch || !this._lastTouch)
45
- return;
46
- let s = !1;
47
- s = Math.abs(
48
- this._firstTouch.clientX - this._lastTouch.clientX
49
- ) < this._epsilon, s && (this._onTouchDragStart(this._payload, t), this._resetTouches());
50
- };
51
- }
52
- }
53
- const U = (i) => `[data-rml-custom-view="${i}"]`, u = (i) => {
54
- i.preventDefault(), i.stopPropagation();
55
- }, x = (i, t, s, e) => {
56
- const a = s - i, r = e - t;
57
- return Math.sqrt(a * a + r * r);
58
- };
59
- class H {
60
- _startX = 0;
61
- _startY = 0;
62
- _lastX = 0;
63
- _lastY = 0;
64
- _epsilon;
65
- _isWaiting = !1;
66
- _onCustomDragStart;
67
- constructor({ onCustomDragStart: t }, s = {}) {
68
- this._epsilon = typeof s.epsilon == "number" ? s.epsilon : I, this._onCustomDragStart = t;
69
- }
70
- onMove(t) {
71
- this._lastX = t.clientX, this._lastY = t.clientY, this._isWaiting && x(
72
- this._startX,
73
- this._startY,
74
- this._lastX,
75
- this._lastY
76
- ) > this._epsilon && (this._onCustomDragStart(t), this._isWaiting = !1);
77
- }
78
- onStart(t) {
79
- this._startX = t.clientX, this._startY = t.clientY, this.onMove(t), this._isWaiting = !0;
80
- }
81
- onEnd() {
82
- this._reset();
83
- }
84
- _reset() {
85
- this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
86
- }
87
- }
88
- const d = "data-rml-old-draggable", K = void 0, y = (i, t) => {
89
- const s = o(i), e = {
90
- delay: s ? m : R,
91
- epsilon: s ? f : I
92
- };
93
- if (!t)
94
- return e;
95
- if (!s && !(i instanceof MouseEvent))
96
- return console.warn(
97
- "Unsupported event! It is not TouchEvent and also not MouseEvent"
98
- ), e;
99
- const {
100
- delayKey: a,
101
- epsilonKey: r
102
- } = s ? { delayKey: "touchDragDelay", epsilonKey: "touchDragEpsilon" } : { delayKey: "customDragDelay", epsilonKey: "customDragEpsilon" };
103
- return typeof t[a] == "number" && (e.delay = t.touchDragDelay), typeof t[r] == "number" && (e.epsilon = t.touchDragEpsilon), e;
104
- }, N = (i) => {
105
- let t = "", s = L, e = Y;
106
- if (!i)
107
- return { url: c, width: s, height: e };
108
- const a = i;
109
- if (a instanceof HTMLElement) {
110
- const r = a.getBoundingClientRect(), n = a.getAttribute("data-rml-ghost-url"), h = a.getAttribute("data-rml-ghost-width"), l = a.getAttribute("data-rml-ghost-height");
111
- n ? t = n : !n && a instanceof HTMLImageElement && a.src && (t = a.src), t ? (s = r.width, e = r.height) : t = c, s = h ? parseInt(h, 10) : s, e = l ? parseInt(l, 10) : e;
112
- }
113
- return { url: t || c, width: s, height: e };
114
- };
115
- class P {
116
- _options = {};
117
- _instance;
118
- _mainDomElement;
119
- _viewName;
120
- _currentCustomDrag = null;
121
- _currentBb = null;
122
- _startTarget = null;
123
- _dragGhost = null;
124
- _onBeforeUpdateDrag = () => ({});
125
- isDragging = !1;
126
- _hasEnteredIframe = !1;
127
- _pendingDragIn = null;
128
- _canvasBb = null;
129
- _overlayBb = null;
130
- _dragGeneration = 0;
131
- _interactionContainerBb = null;
132
- constructor(t, s, e, a) {
133
- this._instance = t, this._options = e || {}, this._viewName = a, this._mainDomElement = s, this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
134
- this._instance.cancelDragIn();
135
- });
136
- }
137
- beforeUpdateGhost(t) {
138
- this._onBeforeUpdateDrag = t;
139
- }
140
- async _dragStart(t, s, e = "rml_id") {
141
- const a = ++this._dragGeneration;
142
- if (this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(
143
- d,
144
- this._startTarget.draggable.toString()
145
- ), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", u), this._startTarget.addEventListener("dragstart", u)), this._startTarget) {
146
- const r = this._startTarget.getBoundingClientRect(), n = this._startTarget.cloneNode(!0);
147
- n.style.width = `${r.width}px`, n.style.height = `${r.height}px`, this._dragGhost = new E(n);
148
- } else
149
- this._dragGhost = new E();
150
- this._currentBb = await this._instance.getBoundingClientRect(
151
- U(this._viewName)
152
- ), this._canvasBb = await this._instance.getBoundingClientRect("canvas"), this._overlayBb = (await this._instance.getDrawerBoundingClientRect()).final, this._interactionContainerBb = await this._instance.getBoundingClientRect(
153
- ".interaction-container"
154
- ), a === this._dragGeneration && (this._pendingDragIn = { id: t, type: e }, this._hasEnteredIframe = !1, this.isDragging = !0);
155
- }
156
- _dragUpdate(t) {
157
- document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(t);
158
- const { clientX: s, clientY: e } = X(t);
159
- if (this._dragGhost) {
160
- const { width: v, height: w } = this._mainDomElement.getBoundingClientRect();
161
- this._dragGhost.updateDragGhost(s, e, {
162
- ghost: { visibleIn: { x: 0, y: 0, width: v, height: w } }
163
- });
164
- }
165
- if (!this._currentBb || !this.isDragging)
166
- return;
167
- const a = this._currentBb.x + s, r = this._currentBb.y + e, n = A(
168
- a,
169
- r,
170
- this._canvasBb,
171
- this._overlayBb,
172
- this._interactionContainerBb
173
- );
174
- if (n && !this._hasEnteredIframe && this._pendingDragIn && (this._instance.dragInObject(
175
- this._pendingDragIn.id,
176
- a,
177
- r,
178
- this._pendingDragIn.type
179
- ), this._hasEnteredIframe = !0), !n && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1), !this._hasEnteredIframe)
180
- return;
181
- const { url: h, width: l, height: C } = N(this._startTarget), _ = this._options || {}, D = {
182
- ghost: {
183
- visibleIn: {
184
- x: this._currentBb.x - (_.dragInOverlapX || 0),
185
- y: this._currentBb.y + (_.dragInOverlapY || 0),
186
- width: this._currentBb.width + (_.dragInOverlapX || 0),
187
- height: this._currentBb.height + (_.dragInOverlapY || 0)
188
- },
189
- url: h,
190
- width: l,
191
- height: C
192
- },
193
- mode: "custom-view"
194
- }, {
195
- x: p,
196
- y: T,
197
- options: B
198
- } = this._onBeforeUpdateDrag(a, r, D), G = typeof p == "number" ? p : a, S = typeof T == "number" ? T : r, O = B || D;
199
- this._instance.updateDrag(G, S, O);
200
- }
201
- _dragEnd() {
202
- this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._currentBb = null, this._canvasBb = null, this._overlayBb = null, this._interactionContainerBb = null, this._resetStartTarget(), this._instance.enableEvents(), this._dragGhost && (this._dragGhost.removeDragGhost(), this._dragGhost = null), this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._hasEnteredIframe = !1, this._pendingDragIn = null;
203
- }
204
- dragStart(t, s, e) {
205
- this._instance.disableEvents(), this._startTarget = s.target;
206
- const a = (r, n) => {
207
- this._dragStart(t, n, e);
208
- };
209
- this._currentCustomDrag = o(s) ? new M(
210
- K,
211
- {
212
- onTouchDragStart: a
213
- },
214
- // No long-press delay for custom-view — drag should start immediately on touch
215
- { ...y(s, this._options), delay: 0 }
216
- ) : new H(
217
- {
218
- onCustomDragStart: (r) => this._dragStart(t, r, e)
219
- },
220
- y(s, this._options)
221
- ), this._currentCustomDrag.onStart(s);
222
- }
223
- dragEnd() {
224
- this._dragEnd();
225
- }
226
- dragUpdate(t) {
227
- this._dragUpdate(t);
228
- }
229
- touchStart(t, s, e = "rml_id") {
230
- this.dragStart(t, s, e);
231
- }
232
- touchMove(t) {
233
- this.dragUpdate(t);
234
- }
235
- touchEnd() {
236
- this.dragEnd();
237
- }
238
- dispose() {
239
- }
240
- _resetStartTarget() {
241
- this._startTarget && (this._startTarget.style.pointerEvents = "", this._startTarget.style.userSelect = "", this._startTarget.draggable = this._startTarget.getAttribute(d) === "true", this._startTarget.removeAttribute(d), this._startTarget.removeEventListener("dragstart", u));
242
- }
243
- releaseInput(t) {
244
- this._dragGeneration++, this._dragEnd();
245
- }
246
- }
247
- export {
248
- P as DragInFromCustomViewStrategy
249
- };
@@ -1,134 +0,0 @@
1
- import { g as C, e as E, a as b, i as v } from "./utils-Dav4kGNW.mjs";
2
- import { R as u, a as x, b as B } from "./embedding-plugins-DqMSzAJe.mjs";
3
- import { E as L } from "./drag-ghost-DHrf_Evu.mjs";
4
- class Y {
5
- _options = {};
6
- _instance;
7
- _mainDomElement;
8
- _currentDrag = {};
9
- _firefoxDragPosition = { x: 0, y: 0 };
10
- _onBeforeUpdateDrag = () => ({});
11
- isDragging = !1;
12
- _hasEnteredIframe = !1;
13
- _pendingDragIn = null;
14
- _canvasBb = null;
15
- _overlayBb = null;
16
- _interactionContainerBb = null;
17
- _currentTouch = null;
18
- _firefoxFallback = (e) => {
19
- if (!this._currentDrag.event)
20
- return;
21
- e.preventDefault();
22
- const t = e || window.event;
23
- this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
24
- };
25
- constructor(e, t, s) {
26
- this._instance = e, this._mainDomElement = t, this._options = s || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
27
- this._instance.cancelDragIn();
28
- });
29
- }
30
- beforeUpdateGhost(e) {
31
- this._onBeforeUpdateDrag = e;
32
- }
33
- async dragStart(e, t, s = "rml_id") {
34
- const o = this._mainDomElement.parentNode;
35
- if (C(o).position !== "relative") {
36
- console.warn(
37
- "Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly"
38
- );
39
- return;
40
- }
41
- this._mainDomElement.style.pointerEvents = "none";
42
- let i = o.querySelector(
43
- "." + u
44
- );
45
- i || (i = document.createElement("div"), i.classList.add(u), o.appendChild(i)), i.classList.remove(x.DISPLAY_NONE), t.target.getAttribute("draggable") || console.warn(
46
- `Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`
47
- );
48
- const a = o.querySelector(
49
- "." + B
50
- );
51
- this._currentDrag.event = t;
52
- const r = t.target, h = r.cloneNode(!0), g = r.getBoundingClientRect();
53
- h.style.width = `${g.width}px`, h.style.height = `${g.height}px`, this._currentDrag.ghost = new L(h), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
54
- const { clientX: _, clientY: d } = E(
55
- t,
56
- this._firefoxDragPosition
57
- );
58
- this._currentDrag.offset.x = _ - g.left, this._currentDrag.offset.y = d - g.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(a, 0, 0), b(o, this._currentDrag.event || t, this._firefoxDragPosition), this._pendingDragIn = { id: e, type: s }, this._hasEnteredIframe = !1, this.isDragging = !0, this._interactionContainerBb = (await this._instance.getDrawerBoundingClientRect()).final;
59
- }
60
- dragUpdate(e) {
61
- const t = this._mainDomElement.parentNode, { x: s, y: o } = b(t, e, this._firefoxDragPosition);
62
- if (s === 0 && o === 0)
63
- return;
64
- const f = Math.max(1, s), i = Math.max(1, o);
65
- if (f === 1 && i === 1)
66
- return;
67
- const n = this._mainDomElement.getBoundingClientRect(), { clientX: a, clientY: r } = E(
68
- e,
69
- this._firefoxDragPosition
70
- ), h = a >= n.left && a <= n.right && r >= n.top && r <= n.bottom, g = () => {
71
- if (!(a >= n.left && a <= n.right && r >= n.top && r <= n.bottom))
72
- return !1;
73
- if (this._interactionContainerBb) {
74
- const m = {
75
- left: this._interactionContainerBb.left + n.left,
76
- top: this._interactionContainerBb.top + n.top,
77
- right: this._interactionContainerBb.right + n.left,
78
- bottom: this._interactionContainerBb.bottom + n.top
79
- };
80
- return !(a >= m.left && a <= m.right && r >= m.top && r <= m.bottom);
81
- }
82
- return !0;
83
- };
84
- if (h && this._pendingDragIn) {
85
- const l = g();
86
- l && !this._hasEnteredIframe ? (this._instance.dragInObject(
87
- this._pendingDragIn.id,
88
- f,
89
- i,
90
- this._pendingDragIn.type
91
- ), this._hasEnteredIframe = !0) : !l && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
92
- } else !h && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
93
- let _ = f, d = i;
94
- if (v(e)) {
95
- const l = this._options.settings?.fingerSize || 0;
96
- _ = Math.max(2, f + l), d = Math.max(2, i - l);
97
- }
98
- const {
99
- x: D,
100
- y: p,
101
- options: I
102
- } = this._onBeforeUpdateDrag(_, d, {}), c = I || { settings: {}, ghost: {} };
103
- if (c.ghost || (c.ghost = {}), c.ghost.visibleIn && c.ghost.hiddenIn || (c.ghost.hiddenIn = n), this._currentDrag.ghost && this._currentDrag.ghost.updateDragGhost(a, r, c), !this._hasEnteredIframe)
104
- return;
105
- const y = typeof D == "number" ? D : _, S = typeof p == "number" ? p : d;
106
- this._instance.updateDrag(y, S, {});
107
- }
108
- dragEnd() {
109
- this._mainDomElement.style.pointerEvents = "all";
110
- const e = this._mainDomElement.parentNode;
111
- this.isDragging = !1, this._hasEnteredIframe && this._instance.dragInObjectEnd(), this._currentDrag.ghost && (this._currentDrag.ghost.removeDragGhost(), this._currentDrag.ghost = null), this._currentDrag = {}, this._firefoxDragPosition = { x: 0, y: 0 }, this._hasEnteredIframe = !1, this._pendingDragIn = null, this._interactionContainerBb = null;
112
- const t = e.querySelector(
113
- "." + u
114
- );
115
- t && t.classList.add(x.DISPLAY_NONE);
116
- }
117
- touchStart(e, t, s = "rml_id") {
118
- t.preventDefault(), this.dragStart(e, t, s);
119
- }
120
- touchMove(e) {
121
- this._currentTouch && this._currentTouch.onMove(e), this._currentDrag.event && this.dragUpdate(e);
122
- }
123
- touchEnd() {
124
- this.dragEnd();
125
- }
126
- dispose() {
127
- document.removeEventListener("dragover", this._firefoxFallback);
128
- }
129
- releaseInput(e) {
130
- }
131
- }
132
- export {
133
- Y as DragInFromWebsiteStrategy
134
- };
@@ -1 +0,0 @@
1
- import{g as t,e,a as n,i}from"./utils-BqTPLNLs.mjs";import{R as r,a,b as s}from"./embedding-plugins-DLVs7ER4.mjs";import{E as o}from"./drag-ghost-B7UAYefM.mjs";class h{_options={};_instance;_mainDomElement;_currentDrag={};_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_hasEnteredIframe=!1;_pendingDragIn=null;_canvasBb=null;_overlayBb=null;_interactionContainerBb=null;_currentTouch=null;_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};constructor(t,e,n){this._instance=t,this._mainDomElement=e,this._options=n||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async dragStart(i,h,g="rml_id"){const c=this._mainDomElement.parentNode;if("relative"!==t(c).position)return;this._mainDomElement.style.pointerEvents="none";let _=c.querySelector("."+r);_||(_=document.createElement("div"),_.classList.add(r),c.appendChild(_)),_.classList.remove(a.DISPLAY_NONE),h.target.getAttribute("draggable");const l=c.querySelector("."+s);this._currentDrag.event=h;const d=h.target,f=d.cloneNode(!0),m=d.getBoundingClientRect();f.style.width=`${m.width}px`,f.style.height=`${m.height}px`,this._currentDrag.ghost=new o(f),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:u,clientY:D}=e(h,this._firefoxDragPosition);this._currentDrag.offset.x=u-m.left,this._currentDrag.offset.y=D-m.top,h instanceof DragEvent&&h.dataTransfer&&h.dataTransfer.setDragImage&&h.dataTransfer.setDragImage(l,0,0),n(c,this._currentDrag.event||h,this._firefoxDragPosition),this._pendingDragIn={id:i,type:g},this._hasEnteredIframe=!1,this.isDragging=!0,this._interactionContainerBb=(await this._instance.getDrawerBoundingClientRect()).final}dragUpdate(t){const r=this._mainDomElement.parentNode,{x:a,y:s}=n(r,t,this._firefoxDragPosition);if(0===a&&0===s)return;const o=Math.max(1,a),h=Math.max(1,s);if(1===o&&1===h)return;const g=this._mainDomElement.getBoundingClientRect(),{clientX:c,clientY:_}=e(t,this._firefoxDragPosition),l=c>=g.left&&c<=g.right&&_>=g.top&&_<=g.bottom,d=()=>{if(!(c>=g.left&&c<=g.right&&_>=g.top&&_<=g.bottom))return!1;if(this._interactionContainerBb){const t={left:this._interactionContainerBb.left+g.left,top:this._interactionContainerBb.top+g.top,right:this._interactionContainerBb.right+g.left,bottom:this._interactionContainerBb.bottom+g.top};return!(c>=t.left&&c<=t.right&&_>=t.top&&_<=t.bottom)}return!0};if(l&&this._pendingDragIn){const t=d();t&&!this._hasEnteredIframe?(this._instance.dragInObject(this._pendingDragIn.id,o,h,this._pendingDragIn.type),this._hasEnteredIframe=!0):!t&&this._hasEnteredIframe&&(this._instance.cancelDragIn(),this._hasEnteredIframe=!1)}else!l&&this._hasEnteredIframe&&(this._instance.cancelDragIn(),this._hasEnteredIframe=!1);let f=o,m=h;if(i(t)){const t=this._options.settings?.fingerSize||0;f=Math.max(2,o+t),m=Math.max(2,h-t)}const{x:u,y:D,options:p}=this._onBeforeUpdateDrag(f,m,{}),E=p||{settings:{},ghost:{}};if(E.ghost||(E.ghost={}),E.ghost.visibleIn&&E.ghost.hiddenIn||(E.ghost.hiddenIn=g),this._currentDrag.ghost&&this._currentDrag.ghost.updateDragGhost(c,_,E),!this._hasEnteredIframe)return;const b="number"==typeof u?u:f,I="number"==typeof D?D:m;this._instance.updateDrag(b,I,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._hasEnteredIframe&&this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0},this._hasEnteredIframe=!1,this._pendingDragIn=null,this._interactionContainerBb=null;const e=t.querySelector("."+r);e&&e.classList.add(a.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){e.preventDefault(),this.dragStart(t,e,n)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}export{h as DragInFromWebsiteStrategy};
@@ -1 +0,0 @@
1
- class t{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(t=16){this._maxLifetime=t}get(t){const e=this._computedStyleCache.get(t),n=Date.now();if(e&&n-e.updated<this._maxLifetime)return e.style;const i=getComputedStyle(t);return this._computedStyleCache.set(t,{style:i,updated:n}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),i}_cleanUpCache(){const t=Date.now();for(const[e,{updated:n}]of this._computedStyleCache.entries())t-n>=this._maxLifetime&&this._computedStyleCache.delete(e);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const e=t=>window.TouchEvent&&t instanceof window.TouchEvent;let n;const i=e=>(n||(n=new t),n.get(e)),c=(t,e,n)=>{const c=parseFloat(t),o=window.devicePixelRatio||1;if("px"===e)return c;if("%"===e)return c/100*(n===document.documentElement?window.innerWidth:n.offsetWidth);if("rem"===e)return c*parseFloat(i(document.documentElement).fontSize);if("em"===e)return c*parseFloat(i(n).fontSize);if("vh"===e||"vw"===e||"vmin"===e||"vmax"===e)return c/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[e];const l={cm:37.7952755906,mm:3.77952755906,in:96};return e in l?c*l[e]*o:0},o=(t,e,n={x:0,y:0})=>{const o=t.getBoundingClientRect(),a=i(t).transform;let h=0,s=0;if("none"!==a){const e=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,n=a.match(e);n&&(h=c(n[1],n[2],t),s=c(n[3],n[4],t))}const{clientX:r,clientY:d}=l(e,n);return{x:r-o.left-h+t.scrollLeft,y:d-o.top-s+t.scrollTop}},l=(t,n=null)=>{const{clientX:i,clientY:c}=e(t)?a(t):t;return{clientX:i>0?i:n?n.x:i,clientY:c>0?c:n?n.y:c}},a=t=>{if(t.touches.length){let{clientX:e,clientY:n}=t.touches[0];if(t.touches.length>1){const i=t.touches[1];e=(e+i.clientX)/2,n=(n+i.clientY)/2}return{clientX:e,clientY:n}}const e=t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}},h=t=>new Proxy(t,{get(t,e,n){const i=Reflect.get(t,e,n);return void 0!==i?i:(...t)=>{}}}),s=(t,e,n)=>t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom,r=(t,e,n,i,c,o)=>{let l=!1;if(n){const i={left:n.x,right:n.x+n.width,top:n.y,bottom:n.y+n.height};l=s(t,e,i)}let a=!1;if(i){const n={left:i.x,right:i.x+i.width,top:i.y,bottom:i.y+i.height};a=s(t,e,n)}let h=!1;if(c){const n={left:c.x,right:c.x+c.width,top:c.y,bottom:c.y+c.height};h=s(t,e,n)}return l&&!a&&!h};export{o as a,r as b,h as c,l as e,i as g,e as i};
@@ -1,150 +0,0 @@
1
- class x {
2
- _computedStyleCache = /* @__PURE__ */ new Map();
3
- _maxLifetime = 16;
4
- _cacheCleanInterval = null;
5
- constructor(t = 16) {
6
- this._maxLifetime = t;
7
- }
8
- get(t) {
9
- const e = this._computedStyleCache.get(t), n = Date.now();
10
- if (e && n - e.updated < this._maxLifetime)
11
- return e.style;
12
- const c = getComputedStyle(t);
13
- return this._computedStyleCache.set(t, { style: c, updated: n }), this._cacheCleanInterval || (this._cacheCleanInterval = setInterval(
14
- () => this._cleanUpCache,
15
- Math.max(this._maxLifetime * 1e3, 5e3)
16
- )), c;
17
- }
18
- _cleanUpCache() {
19
- const t = Date.now();
20
- for (const [e, { updated: n }] of this._computedStyleCache.entries())
21
- t - n >= this._maxLifetime && this._computedStyleCache.delete(e);
22
- this._computedStyleCache.size === 0 && this._cacheCleanInterval && (clearInterval(this._cacheCleanInterval), this._cacheCleanInterval = null);
23
- }
24
- }
25
- const y = (o) => window.TouchEvent && o instanceof window.TouchEvent;
26
- let d;
27
- const f = (o) => (d || (d = new x()), d.get(o)), m = (o, t, e) => {
28
- const n = parseFloat(o), c = window.devicePixelRatio || 1;
29
- if (t === "px")
30
- return n;
31
- if (t === "%") {
32
- const s = e === document.documentElement ? window.innerWidth : e.offsetWidth;
33
- return n / 100 * s;
34
- }
35
- if (t === "rem") {
36
- const s = parseFloat(
37
- f(document.documentElement).fontSize
38
- );
39
- return n * s;
40
- }
41
- if (t === "em") {
42
- const s = parseFloat(
43
- f(e).fontSize
44
- );
45
- return n * s;
46
- }
47
- if (t === "vh" || t === "vw" || t === "vmin" || t === "vmax") {
48
- const s = {
49
- vh: window.innerHeight,
50
- vw: window.innerWidth,
51
- vmin: Math.min(window.innerWidth, window.innerHeight),
52
- vmax: Math.max(window.innerWidth, window.innerHeight)
53
- };
54
- return n / 100 * s[t];
55
- }
56
- const i = {
57
- cm: 37.7952755906,
58
- mm: 3.77952755906,
59
- in: 96
60
- };
61
- return t in i ? n * i[t] * c : (console.warn(
62
- "Unable to determine coordinates for drag-in. Therefore drag-in is not possible. Check the CSS that positions the iframe of Roomle"
63
- ), 0);
64
- }, S = (o, t, e = { x: 0, y: 0 }) => {
65
- const n = o.getBoundingClientRect(), i = f(o).transform;
66
- let s = 0, h = 0;
67
- if (i !== "none") {
68
- const p = /translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/, l = i.match(p);
69
- l && (s = m(l[1], l[2], o), h = m(l[3], l[4], o));
70
- }
71
- const { clientX: a, clientY: r } = C(t, e), w = a - n.left - s + o.scrollLeft, g = r - n.top - h + o.scrollTop;
72
- return { x: w, y: g };
73
- }, C = (o, t = null) => {
74
- const { clientX: e, clientY: n } = y(o) ? _(o) : o, c = e > 0 ? e : t ? t.x : e, i = n > 0 ? n : t ? t.y : n;
75
- return { clientX: c, clientY: i };
76
- }, _ = (o) => {
77
- if (o.touches.length) {
78
- let { clientX: e, clientY: n } = o.touches[0];
79
- if (o.touches.length > 1) {
80
- const c = o.touches[1], i = c.clientX, s = c.clientY;
81
- e = (e + i) / 2, n = (n + s) / 2;
82
- }
83
- return { clientX: e, clientY: n };
84
- }
85
- const t = o.changedTouches[0];
86
- return { clientX: t.clientX, clientY: t.clientY };
87
- }, v = (o) => {
88
- const t = {
89
- /**
90
- * The 'get' trap is fired when a property is accessed on the proxy.
91
- * @param target The original object.
92
- * @param prop The name of the property being accessed.
93
- * @param receiver The proxy or an object that inherits from it.
94
- */
95
- get(e, n, c) {
96
- const i = Reflect.get(e, n, c);
97
- return i !== void 0 ? i : (console.warn(
98
- `[Homag Intelligence Callbacks] Method '${String(
99
- n
100
- )}' is not implemented. Executing a no-op.`
101
- ), (...s) => {
102
- });
103
- }
104
- };
105
- return new Proxy(o, t);
106
- }, u = (o, t, e) => o >= e.left && o <= e.right && t >= e.top && t <= e.bottom, I = (o, t, e, n, c, i) => {
107
- let s = !1;
108
- if (e) {
109
- const r = {
110
- left: e.x,
111
- right: e.x + e.width,
112
- top: e.y,
113
- bottom: e.y + e.height
114
- };
115
- s = u(o, t, r);
116
- }
117
- let h = !1;
118
- if (n) {
119
- const r = {
120
- left: n.x,
121
- right: n.x + n.width,
122
- top: n.y,
123
- bottom: n.y + n.height
124
- };
125
- h = u(o, t, r);
126
- }
127
- let a = !1;
128
- if (c) {
129
- const r = {
130
- left: c.x,
131
- right: c.x + c.width,
132
- top: c.y,
133
- bottom: c.y + c.height
134
- };
135
- a = u(
136
- o,
137
- t,
138
- r
139
- );
140
- }
141
- return s && !h && !a;
142
- };
143
- export {
144
- S as a,
145
- I as b,
146
- v as c,
147
- C as e,
148
- f as g,
149
- y as i
150
- };