@roomle/embedding-lib 6.0.0 → 6.1.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 (31) hide show
  1. package/browser-BhHw2H1M.mjs +1 -0
  2. package/browser-CUgD7zyH.mjs +21 -0
  3. package/docs/md/web/embedding/CHANGELOG.md +151 -571
  4. package/{embedding-plugins-CjNos83d.mjs → embedding-plugins-Cm7O1pKC.mjs} +2 -2
  5. package/{embedding-plugins-DePKqSKW.mjs → embedding-plugins-Dzhuj1By.mjs} +1 -1
  6. package/embedding-plugins.js +1 -1
  7. package/embedding-plugins.min.js +1 -1
  8. package/from-custom-view-5SS9UqAH.mjs +197 -0
  9. package/from-custom-view-CfMGS1-t.mjs +1 -0
  10. package/from-website-CFTjWbqp.mjs +230 -0
  11. package/from-website-ExTzmsnv.mjs +1 -0
  12. package/hi.js +52 -49
  13. package/hi.min.js +1 -1
  14. package/package.json +1 -1
  15. package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +3 -1
  16. package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +6 -1
  17. package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +6 -1
  18. package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +1 -0
  19. package/packages/embedding-lib/src/utils.d.ts +1 -0
  20. package/roomle-embedding-lib.js +123 -139
  21. package/roomle-embedding-lib.min.js +1 -1
  22. package/{touch-drag-DWISKgWm.mjs → touch-drag-CfMLD_hM.mjs} +1 -1
  23. package/{touch-drag-BzREygxc.mjs → touch-drag-TGCsdNqP.mjs} +1 -1
  24. package/utils-BqTPLNLs.mjs +1 -0
  25. package/utils-Dav4kGNW.mjs +150 -0
  26. package/from-custom-view-BAiOXktb.mjs +0 -164
  27. package/from-custom-view-Ch3rb-JF.mjs +0 -1
  28. package/from-website-B-Vh-DVX.mjs +0 -1
  29. package/from-website-BicmMNsE.mjs +0 -202
  30. package/utils-D--vltCL.mjs +0 -113
  31. package/utils-uEcN1DUR.mjs +0 -1
@@ -0,0 +1,150 @@
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
+ };
@@ -1,164 +0,0 @@
1
- import { e as D, i as f } from "./utils-D--vltCL.mjs";
2
- import { C as T, T as S, a as v, b as A, c as I } from "./touch-drag-DWISKgWm.mjs";
3
- import { f as O, e as B, d as _ } from "./embedding-plugins-CjNos83d.mjs";
4
- const L = (a) => `[data-rml-custom-view="${a}"]`, c = (a) => {
5
- a.preventDefault(), a.stopPropagation();
6
- }, Y = (a, t, s, e) => {
7
- const r = s - a, i = e - t;
8
- return Math.sqrt(r * r + i * i);
9
- };
10
- class X {
11
- _startX = 0;
12
- _startY = 0;
13
- _lastX = 0;
14
- _lastY = 0;
15
- _epsilon;
16
- _isWaiting = !1;
17
- _onCustomDragStart;
18
- constructor({ onCustomDragStart: t }, s = {}) {
19
- this._epsilon = typeof s.epsilon == "number" ? s.epsilon : T, this._onCustomDragStart = t;
20
- }
21
- onMove(t) {
22
- this._lastX = t.clientX, this._lastY = t.clientY, this._isWaiting && Y(
23
- this._startX,
24
- this._startY,
25
- this._lastX,
26
- this._lastY
27
- ) > this._epsilon && (this._onCustomDragStart(t), this._isWaiting = !1);
28
- }
29
- onStart(t) {
30
- this._startX = t.clientX, this._startY = t.clientY, this.onMove(t), this._isWaiting = !0;
31
- }
32
- onEnd() {
33
- this._reset();
34
- }
35
- _reset() {
36
- this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
37
- }
38
- }
39
- const l = "data-rml-old-draggable", G = void 0, p = (a, t) => {
40
- const s = f(a), e = {
41
- delay: s ? A : I,
42
- epsilon: s ? v : T
43
- };
44
- if (!t)
45
- return e;
46
- if (!s && !(a instanceof MouseEvent))
47
- return console.warn(
48
- "Unsupported event! It is not TouchEvent and also not MouseEvent"
49
- ), e;
50
- const {
51
- delayKey: r,
52
- epsilonKey: i
53
- } = s ? { delayKey: "touchDragDelay", epsilonKey: "touchDragEpsilon" } : { delayKey: "customDragDelay", epsilonKey: "customDragEpsilon" };
54
- return typeof t[r] == "number" && (e.delay = t.touchDragDelay), typeof t[i] == "number" && (e.epsilon = t.touchDragEpsilon), e;
55
- }, w = (a) => {
56
- let t = "", s = B, e = O;
57
- if (!a)
58
- return { url: _, width: s, height: e };
59
- const r = a;
60
- if (r instanceof HTMLElement) {
61
- const i = r.getBoundingClientRect(), n = r.getAttribute("data-rml-ghost-url"), o = r.getAttribute("data-rml-ghost-width"), h = r.getAttribute("data-rml-ghost-height");
62
- n ? t = n : !n && r instanceof HTMLImageElement && r.src && (t = r.src), t ? (s = i.width, e = i.height) : t = _, s = o ? parseInt(o, 10) : s, e = h ? parseInt(h, 10) : e;
63
- }
64
- return { url: t || _, width: s, height: e };
65
- };
66
- class H {
67
- _options = {};
68
- _instance;
69
- _mainDomElement;
70
- _viewName;
71
- _currentCustomDrag = null;
72
- _currentBb = null;
73
- _startTarget = null;
74
- _onBeforeUpdateDrag = () => ({});
75
- isDragging = !1;
76
- constructor(t, s, e, r) {
77
- this._instance = t, this._options = e || {}, this._viewName = r, this._mainDomElement = s, this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
78
- this._instance.cancelDragIn();
79
- });
80
- }
81
- beforeUpdateGhost(t) {
82
- this._onBeforeUpdateDrag = t;
83
- }
84
- async _dragStart(t, s, e = "rml_id") {
85
- this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(
86
- l,
87
- this._startTarget.draggable.toString()
88
- ), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", c), this._startTarget.addEventListener("dragstart", c)), this._currentBb = await this._instance.getBoundingClientRect(
89
- L(this._viewName)
90
- );
91
- const { clientX: r, clientY: i } = D(s), n = this._currentBb.x + r, o = this._currentBb.y + i;
92
- this.isDragging = !0, this._instance.dragInObject(t, n, o, e);
93
- }
94
- _dragUpdate(t) {
95
- if (document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(t), !this._currentBb || !this.isDragging)
96
- return;
97
- const { clientX: s, clientY: e } = D(t), { url: r, width: i, height: n } = w(this._startTarget), o = this._currentBb.x + s, h = this._currentBb.y + e, g = this._options || {}, u = {
98
- ghost: {
99
- visibleIn: {
100
- x: this._currentBb.x - (g.dragInOverlapX || 0),
101
- y: this._currentBb.y + (g.dragInOverlapY || 0),
102
- width: this._currentBb.width + (g.dragInOverlapX || 0),
103
- height: this._currentBb.height + (g.dragInOverlapY || 0)
104
- },
105
- url: r,
106
- width: i,
107
- height: n
108
- },
109
- mode: "custom-view"
110
- }, {
111
- x: d,
112
- y: m,
113
- options: b
114
- } = this._onBeforeUpdateDrag(o, h, u), E = typeof d == "number" ? d : o, y = typeof m == "number" ? m : h, C = b || u;
115
- this._instance.updateDrag(E, y, C);
116
- }
117
- _dragEnd() {
118
- this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._currentBb = null, this._resetStartTarget(), this._instance.enableEvents(), this._instance.dragInObjectEnd();
119
- }
120
- dragStart(t, s, e) {
121
- this._instance.disableEvents(), this._startTarget = s.target;
122
- const r = (i, n) => {
123
- this._dragStart(t, n, e);
124
- };
125
- this._currentCustomDrag = f(s) ? new S(
126
- G,
127
- {
128
- onTouchDragStart: r
129
- },
130
- p(s, this._options)
131
- ) : new X(
132
- {
133
- onCustomDragStart: (i) => this._dragStart(t, i, e)
134
- },
135
- p(s, this._options)
136
- ), this._currentCustomDrag.onStart(s);
137
- }
138
- dragEnd() {
139
- this._dragEnd();
140
- }
141
- dragUpdate(t) {
142
- this._dragUpdate(t);
143
- }
144
- touchStart(t, s, e = "rml_id") {
145
- this.dragStart(t, s, e);
146
- }
147
- touchMove(t) {
148
- this.dragUpdate(t);
149
- }
150
- touchEnd() {
151
- this.dragEnd();
152
- }
153
- dispose() {
154
- }
155
- _resetStartTarget() {
156
- this._startTarget && (this._startTarget.style.pointerEvents = "", this._startTarget.style.userSelect = "", this._startTarget.draggable = this._startTarget.getAttribute(l) === "true", this._startTarget.removeAttribute(l), this._startTarget.removeEventListener("dragstart", c));
157
- }
158
- releaseInput(t) {
159
- this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._resetStartTarget();
160
- }
161
- }
162
- export {
163
- H as DragInFromCustomViewStrategy
164
- };
@@ -1 +0,0 @@
1
- import{e as t,i as e}from"./utils-uEcN1DUR.mjs";import{C as r,T as s,a,b as i,c as n}from"./touch-drag-BzREygxc.mjs";import{f as o,e as h,d as g}from"./embedding-plugins-DePKqSKW.mjs";const _=t=>{t.preventDefault(),t.stopPropagation()};class l{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon="number"==typeof e.epsilon?e.epsilon:r,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const r=this._lastX-t,s=this._lastY-e;return Math.sqrt(r*r+s*s)})(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 u="data-rml-old-draggable",c=(t,s)=>{const o=e(t),h={delay:o?i:n,epsilon:o?a:r};if(!s)return h;if(!(o||t instanceof MouseEvent))return h;const{delayKey:g,epsilonKey:_}=o?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof s[g]&&(h.delay=s.touchDragDelay),"number"==typeof s[_]&&(h.epsilon=s.touchDragEpsilon),h};class d{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,r,s){this._instance=t,this._options=r||{},this._viewName=s,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(e,r,s="rml_id"){var a;this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(u,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",_),this._startTarget.addEventListener("dragstart",_)),this._currentBb=await this._instance.getBoundingClientRect((a=this._viewName,`[data-rml-custom-view="${a}"]`));const{clientX:i,clientY:n}=t(r),o=this._currentBb.x+i,h=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(e,o,h,s)}_dragUpdate(e){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(e),!this._currentBb||!this.isDragging)return;const{clientX:r,clientY:s}=t(e),{url:a,width:i,height:n}=(t=>{let e="",r=h,s=o;if(!t)return{url:g,width:r,height:s};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"),o=a.getAttribute("data-rml-ghost-height");i?e=i:!i&&a instanceof HTMLImageElement&&a.src&&(e=a.src),e?(r=t.width,s=t.height):e=g,r=n?parseInt(n,10):r,s=o?parseInt(o,10):s}return{url:e||g,width:r,height:s}})(this._startTarget),_=this._currentBb.x+r,l=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(_,l,c),D="number"==typeof d?d:_,b="number"==typeof m?m:l,y=p||c;this._instance.updateDrag(D,b,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,r,a){this._instance.disableEvents(),this._startTarget=r.target,this._currentCustomDrag=e(r)?new s(void 0,{onTouchDragStart:(e,r)=>{this._dragStart(t,r,a)}},c(r,this._options)):new l({onCustomDragStart:e=>this._dragStart(t,e,a)},c(r,this._options)),this._currentCustomDrag.onStart(r)}dragEnd(){this._dragEnd()}dragUpdate(t){this._dragUpdate(t)}touchStart(t,e,r="rml_id"){this.dragStart(t,e,r)}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(u),this._startTarget.removeAttribute(u),this._startTarget.removeEventListener("dragstart",_))}releaseInput(t){this._currentCustomDrag&&this._currentCustomDrag.onEnd(),this._resetStartTarget()}}export{d as DragInFromCustomViewStrategy};
@@ -1 +0,0 @@
1
- import{g as t,e,a as n,i as s}from"./utils-uEcN1DUR.mjs";import{T as i}from"./touch-drag-BzREygxc.mjs";import{R as o,a,b as r,c as h,d as g,e as d,f as l,g as m,h as c,i as u,j as _,k as f}from"./embedding-plugins-DePKqSKW.mjs";const p=(t,e,n=0,s=0)=>{const i=e.x+e.width+n,o=e.x-n,a=e.y+e.height+s,r=e.y-s,{x:h,y:g}=t;return h>=o&&h<=i&&g>=r&&g<=a},D=(t,e,n,s=0,i=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?p({x:t,y:e},n.visibleIn,s,i):!!n.hiddenIn&&!p({x:t,y:e},n.hiddenIn,-s,-i)};class y{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,n){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!n.ghost?.external&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(a)){const t=document.createElement("style");t.type="text/css",t.id=a,t.innerHTML=`\n ${r}\n ${h}\n `,document.head.appendChild(t)}})();const s={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)=>{let s=document.getElementById(o);if(!s){if(s=document.createElement("div"),n.ghost?.element)s.appendChild(n.ghost.element);else{const t=document.createElement("img");t.src=n.ghost?.url||g,t.width=n.ghost?.width||d,t.height=n.ghost?.height||l,s.appendChild(t)}s.id=o,s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.willChange="transform",s.style.transform="translate3d(0, 0, 0)",s.style.zIndex="9999",s.style.opacity="0.5",D(t,e,n.ghost||{},n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)||(s.style.display="none"),s.style.pointerEvents="none",document.body.appendChild(s)}})(s,n),(({x:t,y:e},n)=>{const s=document.getElementById(o);if(!s)return;let i=n.ghost?.width,a=n.ghost?.height;typeof i>"u"&&(i=s.getBoundingClientRect().width||d),typeof a>"u"&&(a=s.getBoundingClientRect().height||l);const r=t-i/2,h=e-a/2;s.style.transform=`translate3d(${r}px, ${h}px, 0)`,n.ghost&&(D(t,e,n.ghost,n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)?s.style.animation!=m&&(s.style.animation=m):s.style.animation!=c&&(s.style.animation=c))})(s,n),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(o);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class x{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_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}dragStart(s,i,o="rml_id"){const a=this._mainDomElement.parentNode;if("relative"!==t(a).position)return;this._mainDomElement.style.pointerEvents="none";let r=a.querySelector("."+u);r||(r=document.createElement("div"),r.classList.add(u),a.appendChild(r)),r.classList.remove(_.DISPLAY_NONE),i.target.getAttribute("draggable");const h=a.querySelector("."+f);this._currentDrag.event=i;const g=i.target,d=g.cloneNode(!0),l=g.getBoundingClientRect();d.style.width=`${l.width}px`,d.style.height=`${l.height}px`,this._currentDrag.ghost=new y(d),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:m,clientY:c}=e(i,this._firefoxDragPosition);this._currentDrag.offset.x=m-l.left,this._currentDrag.offset.y=c-l.top,i instanceof DragEvent&&i.dataTransfer&&i.dataTransfer.setDragImage&&i.dataTransfer.setDragImage(h,0,0);const{x:p,y:D}=n(a,this._currentDrag.event||i,this._firefoxDragPosition),x=Math.max(1,p),v=Math.max(1,D);this.isDragging=!0,this._instance.dragInObject(s,x,v,o)}dragUpdate(t){const i=this._mainDomElement.parentNode,{x:o,y:a}=n(i,t,this._firefoxDragPosition);if(0===o&&0===a)return;const r=Math.max(1,o),h=Math.max(1,a);if(1===r&&1===h)return;let g=r,d=h;if(s(t)){const t=this._options.settings?.fingerSize||0;g=Math.max(2,r+t),d=Math.max(2,h-t)}const{x:l,y:m,options:c}=this._onBeforeUpdateDrag(g,d,{}),u=c||{settings:{},ghost:{}};u.ghost||(u.ghost={}),u.ghost.visibleIn&&u.ghost.hiddenIn||(u.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const _="number"==typeof l?l:g,f="number"==typeof m?m:d;if(this._currentDrag.ghost){const{clientX:n,clientY:s}=e(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(n,s,u)}this._instance.updateDrag(_,f,{})}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("."+u);e&&e.classList.add(_.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){e.preventDefault();const s={};"number"==typeof this._options?.settings?.touchDragDelay&&(s.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(s.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new i(void 0,{onTouchDragStart:(e,s)=>{this.dragStart(t,s,n)}},s),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{x as DragInFromWebsiteStrategy};
@@ -1,202 +0,0 @@
1
- import { g as b, e as I, a as A, i as F } from "./utils-D--vltCL.mjs";
2
- import { T as M } from "./touch-drag-DWISKgWm.mjs";
3
- import { R as m, a as E, b as C, c as N, d as O, e as R, f as T, g as G, h as p, i as y, j as x, k as w } from "./embedding-plugins-CjNos83d.mjs";
4
- const S = (r, n, t = 0, e = 0) => {
5
- const s = n.x + n.width + t, i = n.x - t, a = n.y + n.height + e, o = n.y - e, { x: h, y: g } = r;
6
- return h >= i && h <= s && g >= o && g <= a;
7
- }, v = (r, n, t, e = 0, s = 0) => {
8
- if (!(!t || !t.hiddenIn && !t.visibleIn))
9
- return t.visibleIn ? S(
10
- { x: r, y: n },
11
- t.visibleIn,
12
- e,
13
- s
14
- ) : t.hiddenIn ? !S(
15
- { x: r, y: n },
16
- t.hiddenIn,
17
- -e,
18
- -s
19
- ) : !1;
20
- }, B = () => {
21
- if (!!!document.getElementById(E)) {
22
- const n = document.createElement("style");
23
- n.type = "text/css", n.id = E, n.innerHTML = `
24
- ${C}
25
- ${N}
26
- `, document.head.appendChild(n);
27
- }
28
- }, Y = ({ x: r, y: n }, t) => {
29
- let e = document.getElementById(m);
30
- if (!e) {
31
- if (e = document.createElement("div"), t.ghost?.element)
32
- e.appendChild(t.ghost.element);
33
- else {
34
- const s = document.createElement("img");
35
- s.src = t.ghost?.url || O, s.width = t.ghost?.width || R, s.height = t.ghost?.height || T, e.appendChild(s);
36
- }
37
- e.id = m, e.style.position = "fixed", e.style.top = "0", e.style.left = "0", e.style.willChange = "transform", e.style.transform = "translate3d(0, 0, 0)", e.style.zIndex = "9999", e.style.opacity = "0.5", v(
38
- r,
39
- n,
40
- t.ghost || {},
41
- t.settings?.dragInOverlapX,
42
- t.settings?.dragInOverlapY
43
- ) || (e.style.display = "none"), e.style.pointerEvents = "none", document.body.appendChild(e);
44
- }
45
- }, H = ({ x: r, y: n }, t) => {
46
- const e = document.getElementById(m);
47
- if (!e)
48
- return;
49
- let s = t.ghost?.width, i = t.ghost?.height;
50
- typeof s > "u" && (s = e.getBoundingClientRect().width || R), typeof i > "u" && (i = e.getBoundingClientRect().height || T);
51
- const a = r - s / 2, o = n - i / 2;
52
- e.style.transform = `translate3d(${a}px, ${o}px, 0)`, t.ghost && (v(
53
- r,
54
- n,
55
- t.ghost,
56
- t.settings?.dragInOverlapX,
57
- t.settings?.dragInOverlapY
58
- ) ? e.style.animation != G && (e.style.animation = G) : e.style.animation != p && (e.style.animation = p));
59
- };
60
- class U {
61
- _dragGhostAnimationFrameId = null;
62
- _dragGhostRemoveAnimationFrameId = null;
63
- _dragGhostElement = null;
64
- constructor(n = null) {
65
- this._dragGhostElement = n;
66
- }
67
- updateDragGhost(n, t, e) {
68
- this._dragGhostRemoveAnimationFrameId && (cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId), this._dragGhostRemoveAnimationFrameId = null), !e.ghost?.external && e.ghost && (this._dragGhostAnimationFrameId || (this._dragGhostAnimationFrameId = requestAnimationFrame(() => {
69
- B();
70
- const s = { x: n, y: t };
71
- !e.ghost && this._dragGhostElement && (e.ghost = {}), e.ghost && !e.ghost.element && this._dragGhostElement && (e.ghost.element = this._dragGhostElement), Y(s, e), H(s, e), this._dragGhostAnimationFrameId = null;
72
- })));
73
- }
74
- removeDragGhost() {
75
- this._dragGhostAnimationFrameId && (cancelAnimationFrame(this._dragGhostAnimationFrameId), this._dragGhostAnimationFrameId = null), this._dragGhostRemoveAnimationFrameId || (this._dragGhostRemoveAnimationFrameId = requestAnimationFrame(() => {
76
- const n = document.getElementById(m);
77
- n && document.body.removeChild(n), this._dragGhostRemoveAnimationFrameId = null;
78
- }));
79
- }
80
- }
81
- class $ {
82
- _options = {};
83
- _instance;
84
- _mainDomElement;
85
- _currentDrag = {};
86
- _currentTouch = null;
87
- _firefoxDragPosition = { x: 0, y: 0 };
88
- _onBeforeUpdateDrag = () => ({});
89
- isDragging = !1;
90
- _firefoxFallback = (n) => {
91
- if (!this._currentDrag.event)
92
- return;
93
- n.preventDefault();
94
- const t = n || window.event;
95
- this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
96
- };
97
- constructor(n, t, e) {
98
- this._instance = n, this._mainDomElement = t, this._options = e || {}, this._firefoxFallback = this._firefoxFallback.bind(this), document.addEventListener("dragover", this._firefoxFallback), this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
99
- this._instance.cancelDragIn();
100
- });
101
- }
102
- beforeUpdateGhost(n) {
103
- this._onBeforeUpdateDrag = n;
104
- }
105
- dragStart(n, t, e = "rml_id") {
106
- const s = this._mainDomElement.parentNode;
107
- if (b(s).position !== "relative") {
108
- console.warn(
109
- "Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly"
110
- );
111
- return;
112
- }
113
- this._mainDomElement.style.pointerEvents = "none";
114
- let a = s.querySelector(
115
- "." + y
116
- );
117
- a || (a = document.createElement("div"), a.classList.add(y), s.appendChild(a)), a.classList.remove(x.DISPLAY_NONE), t.target.getAttribute("draggable") || console.warn(
118
- `Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`
119
- );
120
- const h = s.querySelector(
121
- "." + w
122
- );
123
- this._currentDrag.event = t;
124
- const g = t.target, c = g.cloneNode(!0), l = g.getBoundingClientRect();
125
- c.style.width = `${l.width}px`, c.style.height = `${l.height}px`, this._currentDrag.ghost = new U(c), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
126
- const { clientX: d, clientY: f } = I(
127
- t,
128
- this._firefoxDragPosition
129
- );
130
- this._currentDrag.offset.x = d - l.left, this._currentDrag.offset.y = f - l.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(h, 0, 0);
131
- const { x: u, y: _ } = A(
132
- s,
133
- this._currentDrag.event || t,
134
- this._firefoxDragPosition
135
- ), D = Math.max(1, u), L = Math.max(1, _);
136
- this.isDragging = !0, this._instance.dragInObject(n, D, L, e);
137
- }
138
- dragUpdate(n) {
139
- const t = this._mainDomElement.parentNode, { x: e, y: s } = A(t, n, this._firefoxDragPosition);
140
- if (e === 0 && s === 0)
141
- return;
142
- const i = Math.max(1, e), a = Math.max(1, s);
143
- if (i === 1 && a === 1)
144
- return;
145
- let o = i, h = a;
146
- if (F(n)) {
147
- const _ = this._options.settings?.fingerSize || 0;
148
- o = Math.max(2, i + _), h = Math.max(2, a - _);
149
- }
150
- const {
151
- x: g,
152
- y: c,
153
- options: l
154
- } = this._onBeforeUpdateDrag(o, h, {}), d = l || { settings: {}, ghost: {} };
155
- d.ghost || (d.ghost = {}), d.ghost.visibleIn && d.ghost.hiddenIn || (d.ghost.hiddenIn = this._mainDomElement.getBoundingClientRect());
156
- const f = typeof g == "number" ? g : o, u = typeof c == "number" ? c : h;
157
- if (this._currentDrag.ghost) {
158
- const { clientX: _, clientY: D } = I(
159
- n,
160
- this._firefoxDragPosition
161
- );
162
- this._currentDrag.ghost.updateDragGhost(_, D, d);
163
- }
164
- this._instance.updateDrag(f, u, {});
165
- }
166
- dragEnd() {
167
- this._mainDomElement.style.pointerEvents = "all";
168
- const n = this._mainDomElement.parentNode;
169
- 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 };
170
- const t = n.querySelector(
171
- "." + y
172
- );
173
- t && t.classList.add(x.DISPLAY_NONE);
174
- }
175
- touchStart(n, t, e = "rml_id") {
176
- t.preventDefault();
177
- const s = (a, o) => {
178
- this.dragStart(n, o, e);
179
- }, i = {};
180
- typeof this._options?.settings?.touchDragDelay == "number" && (i.delay = this._options.settings.touchDragDelay), this._options?.settings?.touchDragEpsilon && (i.epsilon = this._options.settings.touchDragEpsilon), this._currentTouch = new M(
181
- void 0,
182
- {
183
- onTouchDragStart: s
184
- },
185
- i
186
- ), this._currentTouch.onStart(t);
187
- }
188
- touchMove(n) {
189
- this._currentTouch && this._currentTouch.onMove(n), this._currentDrag.event && this.dragUpdate(n);
190
- }
191
- touchEnd() {
192
- this._currentTouch && this._currentTouch.onEnd(), this._currentTouch = null, this.dragEnd();
193
- }
194
- dispose() {
195
- document.removeEventListener("dragover", this._firefoxFallback);
196
- }
197
- releaseInput(n) {
198
- }
199
- }
200
- export {
201
- $ as DragInFromWebsiteStrategy
202
- };
@@ -1,113 +0,0 @@
1
- class g {
2
- _computedStyleCache = /* @__PURE__ */ new Map();
3
- _maxLifetime = 16;
4
- _cacheCleanInterval = null;
5
- constructor(e = 16) {
6
- this._maxLifetime = e;
7
- }
8
- get(e) {
9
- const o = this._computedStyleCache.get(e), n = Date.now();
10
- if (o && n - o.updated < this._maxLifetime)
11
- return o.style;
12
- const i = getComputedStyle(e);
13
- return this._computedStyleCache.set(e, { style: i, updated: n }), this._cacheCleanInterval || (this._cacheCleanInterval = setInterval(
14
- () => this._cleanUpCache,
15
- Math.max(this._maxLifetime * 1e3, 5e3)
16
- )), i;
17
- }
18
- _cleanUpCache() {
19
- const e = Date.now();
20
- for (const [o, { updated: n }] of this._computedStyleCache.entries())
21
- e - n >= this._maxLifetime && this._computedStyleCache.delete(o);
22
- this._computedStyleCache.size === 0 && this._cacheCleanInterval && (clearInterval(this._cacheCleanInterval), this._cacheCleanInterval = null);
23
- }
24
- }
25
- const C = (t) => window.TouchEvent && t instanceof window.TouchEvent;
26
- let a;
27
- const l = (t) => (a || (a = new g()), a.get(t)), d = (t, e, o) => {
28
- const n = parseFloat(t), i = window.devicePixelRatio || 1;
29
- if (e === "px")
30
- return n;
31
- if (e === "%") {
32
- const c = o === document.documentElement ? window.innerWidth : o.offsetWidth;
33
- return n / 100 * c;
34
- }
35
- if (e === "rem") {
36
- const c = parseFloat(
37
- l(document.documentElement).fontSize
38
- );
39
- return n * c;
40
- }
41
- if (e === "em") {
42
- const c = parseFloat(
43
- l(o).fontSize
44
- );
45
- return n * c;
46
- }
47
- if (e === "vh" || e === "vw" || e === "vmin" || e === "vmax") {
48
- const c = {
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 * c[e];
55
- }
56
- const s = {
57
- cm: 37.7952755906,
58
- mm: 3.77952755906,
59
- in: 96
60
- };
61
- return e in s ? n * s[e] * i : (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
- }, _ = (t, e, o = { x: 0, y: 0 }) => {
65
- const n = t.getBoundingClientRect(), s = l(t).transform;
66
- let c = 0, h = 0;
67
- if (s !== "none") {
68
- const p = /translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/, r = s.match(p);
69
- r && (c = d(r[1], r[2], t), h = d(r[3], r[4], t));
70
- }
71
- const { clientX: u, clientY: m } = x(e, o), f = u - n.left - c + t.scrollLeft, w = m - n.top - h + t.scrollTop;
72
- return { x: f, y: w };
73
- }, x = (t, e = null) => {
74
- const { clientX: o, clientY: n } = C(t) ? y(t) : t, i = o > 0 ? o : e ? e.x : o, s = n > 0 ? n : e ? e.y : n;
75
- return { clientX: i, clientY: s };
76
- }, y = (t) => {
77
- if (t.touches.length) {
78
- let { clientX: o, clientY: n } = t.touches[0];
79
- if (t.touches.length > 1) {
80
- const i = t.touches[1], s = i.clientX, c = i.clientY;
81
- o = (o + s) / 2, n = (n + c) / 2;
82
- }
83
- return { clientX: o, clientY: n };
84
- }
85
- const e = t.changedTouches[0];
86
- return { clientX: e.clientX, clientY: e.clientY };
87
- }, S = (t) => {
88
- const e = {
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(o, n, i) {
96
- const s = Reflect.get(o, n, i);
97
- return s !== void 0 ? s : (console.warn(
98
- `[Homag Intelligence Callbacks] Method '${String(
99
- n
100
- )}' is not implemented. Executing a no-op.`
101
- ), (...c) => {
102
- });
103
- }
104
- };
105
- return new Proxy(t, e);
106
- };
107
- export {
108
- _ as a,
109
- S as c,
110
- x as e,
111
- l as g,
112
- C as i
113
- };
@@ -1 +0,0 @@
1
- class e{_computedStyleCache=new Map;_maxLifetime=16;_cacheCleanInterval=null;constructor(e=16){this._maxLifetime=e}get(e){const t=this._computedStyleCache.get(e),n=Date.now();if(t&&n-t.updated<this._maxLifetime)return t.style;const i=getComputedStyle(e);return this._computedStyleCache.set(e,{style:i,updated:n}),this._cacheCleanInterval||(this._cacheCleanInterval=setInterval(()=>this._cleanUpCache,Math.max(1e3*this._maxLifetime,5e3))),i}_cleanUpCache(){const e=Date.now();for(const[t,{updated:n}]of this._computedStyleCache.entries())e-n>=this._maxLifetime&&this._computedStyleCache.delete(t);0===this._computedStyleCache.size&&this._cacheCleanInterval&&(clearInterval(this._cacheCleanInterval),this._cacheCleanInterval=null)}}const t=e=>window.TouchEvent&&e instanceof window.TouchEvent;let n;const i=t=>(n||(n=new e),n.get(t)),c=(e,t,n)=>{const c=parseFloat(e),a=window.devicePixelRatio||1;if("px"===t)return c;if("%"===t)return c/100*(n===document.documentElement?window.innerWidth:n.offsetWidth);if("rem"===t)return c*parseFloat(i(document.documentElement).fontSize);if("em"===t)return c*parseFloat(i(n).fontSize);if("vh"===t||"vw"===t||"vmin"===t||"vmax"===t)return c/100*{vh:window.innerHeight,vw:window.innerWidth,vmin:Math.min(window.innerWidth,window.innerHeight),vmax:Math.max(window.innerWidth,window.innerHeight)}[t];const l={cm:37.7952755906,mm:3.77952755906,in:96};return t in l?c*l[t]*a:0},a=(e,t,n={x:0,y:0})=>{const a=e.getBoundingClientRect(),o=i(e).transform;let s=0,r=0;if("none"!==o){const t=/translate\(\s*([-+]?\d*\.?\d+|\d+)(px|%)?,?\s*([-+]?\d*\.?\d+|\d+)?(px|%)?\s*\)/,n=o.match(t);n&&(s=c(n[1],n[2],e),r=c(n[3],n[4],e))}const{clientX:h,clientY:d}=l(t,n);return{x:h-a.left-s+e.scrollLeft,y:d-a.top-r+e.scrollTop}},l=(e,n=null)=>{const{clientX:i,clientY:c}=t(e)?o(e):e;return{clientX:i>0?i:n?n.x:i,clientY:c>0?c:n?n.y:c}},o=e=>{if(e.touches.length){let{clientX:t,clientY:n}=e.touches[0];if(e.touches.length>1){const i=e.touches[1];t=(t+i.clientX)/2,n=(n+i.clientY)/2}return{clientX:t,clientY:n}}const t=e.changedTouches[0];return{clientX:t.clientX,clientY:t.clientY}},s=e=>new Proxy(e,{get(e,t,n){const i=Reflect.get(e,t,n);return void 0!==i?i:(...e)=>{}}});export{a,s as c,l as e,i as g,t as i};