@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,258 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- const M = Symbol("Comlink.proxy"), z = Symbol("Comlink.endpoint"), N = Symbol("Comlink.releaseProxy"), x = Symbol("Comlink.finalizer"), w = Symbol("Comlink.thrown"), S = (e) => typeof e == "object" && e !== null || typeof e == "function", H = {
7
- canHandle: (e) => S(e) && e[M],
8
- serialize(e) {
9
- const { port1: t, port2: r } = new MessageChannel();
10
- return R(e, t), [r, [r]];
11
- },
12
- deserialize(e) {
13
- return e.start(), I(e);
14
- }
15
- }, L = {
16
- canHandle: (e) => S(e) && w in e,
17
- serialize({ value: e }) {
18
- let t;
19
- return e instanceof Error ? t = {
20
- isError: !0,
21
- value: {
22
- message: e.message,
23
- name: e.name,
24
- stack: e.stack
25
- }
26
- } : t = { isError: !1, value: e }, [t, []];
27
- },
28
- deserialize(e) {
29
- throw e.isError ? Object.assign(new Error(e.value.message), e.value) : e.value;
30
- }
31
- }, A = /* @__PURE__ */ new Map([
32
- ["proxy", H],
33
- ["throw", L]
34
- ]);
35
- function V(e, t) {
36
- for (const r of e)
37
- if (t === r || r === "*" || r instanceof RegExp && r.test(t))
38
- return !0;
39
- return !1;
40
- }
41
- function R(e, t = globalThis, r = ["*"]) {
42
- t.addEventListener("message", function g(n) {
43
- if (!n || !n.data)
44
- return;
45
- if (!V(r, n.origin)) {
46
- console.warn(`Invalid origin '${n.origin}' for comlink proxy`);
47
- return;
48
- }
49
- const { id: a, type: f, path: c } = Object.assign({ path: [] }, n.data), l = (n.data.argumentList || []).map(y);
50
- let s;
51
- try {
52
- const o = c.slice(0, -1).reduce((i, d) => i[d], e), u = c.reduce((i, d) => i[d], e);
53
- switch (f) {
54
- case "GET":
55
- s = u;
56
- break;
57
- case "SET":
58
- o[c.slice(-1)[0]] = y(n.data.value), s = !0;
59
- break;
60
- case "APPLY":
61
- s = u.apply(o, l);
62
- break;
63
- case "CONSTRUCT":
64
- {
65
- const i = new u(...l);
66
- s = U(i);
67
- }
68
- break;
69
- case "ENDPOINT":
70
- {
71
- const { port1: i, port2: d } = new MessageChannel();
72
- R(e, d), s = F(i, [i]);
73
- }
74
- break;
75
- case "RELEASE":
76
- s = void 0;
77
- break;
78
- default:
79
- return;
80
- }
81
- } catch (o) {
82
- s = { value: o, [w]: 0 };
83
- }
84
- Promise.resolve(s).catch((o) => ({ value: o, [w]: 0 })).then((o) => {
85
- const [u, i] = p(o);
86
- t.postMessage(Object.assign(Object.assign({}, u), { id: a }), i), f === "RELEASE" && (t.removeEventListener("message", g), T(t), x in e && typeof e[x] == "function" && e[x]());
87
- }).catch((o) => {
88
- const [u, i] = p({
89
- value: new TypeError("Unserializable return value"),
90
- [w]: 0
91
- });
92
- t.postMessage(Object.assign(Object.assign({}, u), { id: a }), i);
93
- });
94
- }), t.start && t.start();
95
- }
96
- function _(e) {
97
- return e.constructor.name === "MessagePort";
98
- }
99
- function T(e) {
100
- _(e) && e.close();
101
- }
102
- function I(e, t) {
103
- const r = /* @__PURE__ */ new Map();
104
- return e.addEventListener("message", function(n) {
105
- const { data: a } = n;
106
- if (!a || !a.id)
107
- return;
108
- const f = r.get(a.id);
109
- if (f)
110
- try {
111
- f(a);
112
- } finally {
113
- r.delete(a.id);
114
- }
115
- }), P(e, r, [], t);
116
- }
117
- function h(e) {
118
- if (e)
119
- throw new Error("Proxy has been released and is not useable");
120
- }
121
- function C(e) {
122
- return m(e, /* @__PURE__ */ new Map(), {
123
- type: "RELEASE"
124
- }).then(() => {
125
- T(e);
126
- });
127
- }
128
- const E = /* @__PURE__ */ new WeakMap(), b = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
129
- const t = (E.get(e) || 0) - 1;
130
- E.set(e, t), t === 0 && C(e);
131
- });
132
- function W(e, t) {
133
- const r = (E.get(t) || 0) + 1;
134
- E.set(t, r), b && b.register(e, t, e);
135
- }
136
- function j(e) {
137
- b && b.unregister(e);
138
- }
139
- function P(e, t, r = [], g = function() {
140
- }) {
141
- let n = !1;
142
- const a = new Proxy(g, {
143
- get(f, c) {
144
- if (h(n), c === N)
145
- return () => {
146
- j(a), C(e), t.clear(), n = !0;
147
- };
148
- if (c === "then") {
149
- if (r.length === 0)
150
- return { then: () => a };
151
- const l = m(e, t, {
152
- type: "GET",
153
- path: r.map((s) => s.toString())
154
- }).then(y);
155
- return l.then.bind(l);
156
- }
157
- return P(e, t, [...r, c]);
158
- },
159
- set(f, c, l) {
160
- h(n);
161
- const [s, o] = p(l);
162
- return m(e, t, {
163
- type: "SET",
164
- path: [...r, c].map((u) => u.toString()),
165
- value: s
166
- }, o).then(y);
167
- },
168
- apply(f, c, l) {
169
- h(n);
170
- const s = r[r.length - 1];
171
- if (s === z)
172
- return m(e, t, {
173
- type: "ENDPOINT"
174
- }).then(y);
175
- if (s === "bind")
176
- return P(e, t, r.slice(0, -1));
177
- const [o, u] = k(l);
178
- return m(e, t, {
179
- type: "APPLY",
180
- path: r.map((i) => i.toString()),
181
- argumentList: o
182
- }, u).then(y);
183
- },
184
- construct(f, c) {
185
- h(n);
186
- const [l, s] = k(c);
187
- return m(e, t, {
188
- type: "CONSTRUCT",
189
- path: r.map((o) => o.toString()),
190
- argumentList: l
191
- }, s).then(y);
192
- }
193
- });
194
- return W(a, e), a;
195
- }
196
- function D(e) {
197
- return Array.prototype.concat.apply([], e);
198
- }
199
- function k(e) {
200
- const t = e.map(p);
201
- return [t.map((r) => r[0]), D(t.map((r) => r[1]))];
202
- }
203
- const O = /* @__PURE__ */ new WeakMap();
204
- function F(e, t) {
205
- return O.set(e, t), e;
206
- }
207
- function U(e) {
208
- return Object.assign(e, { [M]: !0 });
209
- }
210
- function p(e) {
211
- for (const [t, r] of A)
212
- if (r.canHandle(e)) {
213
- const [g, n] = r.serialize(e);
214
- return [
215
- {
216
- type: "HANDLER",
217
- name: t,
218
- value: g
219
- },
220
- n
221
- ];
222
- }
223
- return [
224
- {
225
- type: "RAW",
226
- value: e
227
- },
228
- O.get(e) || []
229
- ];
230
- }
231
- function y(e) {
232
- switch (e.type) {
233
- case "HANDLER":
234
- return A.get(e.name).deserialize(e.value);
235
- case "RAW":
236
- return e.value;
237
- }
238
- }
239
- function m(e, t, r, g) {
240
- return new Promise((n) => {
241
- const a = G();
242
- t.set(a, n), e.start && e.start(), e.postMessage(Object.assign({ id: a }, r), g);
243
- });
244
- }
245
- function G() {
246
- return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
247
- }
248
- export {
249
- z as createEndpoint,
250
- R as expose,
251
- x as finalizer,
252
- U as proxy,
253
- M as proxyMarker,
254
- N as releaseProxy,
255
- F as transfer,
256
- A as transferHandlers,
257
- I as wrap
258
- };
@@ -1 +0,0 @@
1
- const e=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:t=>s(t)&&t[e],serialize(e){const{port1:t,port2:n}=new MessageChannel;return i(e,t),[n,[n]]},deserialize:e=>(e.start(),u(e))}],["throw",{canHandle:e=>s(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function i(e,t=globalThis,n=["*"]){t.addEventListener("message",function s(o){if(!o||!o.data)return;if(!function(e,t){for(const n of e)if(t===n||"*"===n||n instanceof RegExp&&n.test(t))return!0;return!1}(n,o.origin))return;const{id:u,type:l,path:p}=Object.assign({path:[]},o.data),f=(o.data.argumentList||[]).map(w);let g;try{const t=p.slice(0,-1).reduce((e,t)=>e[t],e),n=p.reduce((e,t)=>e[t],e);switch(l){case"GET":g=n;break;case"SET":t[p.slice(-1)[0]]=w(o.data.value),g=!0;break;case"APPLY":g=n.apply(t,f);break;case"CONSTRUCT":g=b(new n(...f));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;i(e,n),g=E(t,[t])}break;case"RELEASE":g=void 0;break;default:return}}catch(e){g={value:e,[a]:0}}Promise.resolve(g).catch(e=>({value:e,[a]:0})).then(n=>{const[a,o]=v(n);t.postMessage(Object.assign(Object.assign({},a),{id:u}),o),"RELEASE"===l&&(t.removeEventListener("message",s),c(t),r in e&&"function"==typeof e[r]&&e[r]())}).catch(e=>{const[n,r]=v({value:new TypeError("Unserializable return value"),[a]:0});t.postMessage(Object.assign(Object.assign({},n),{id:u}),r)})}),t.start&&t.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e,t){const n=new Map;return e.addEventListener("message",function(e){const{data:t}=e;if(!t||!t.id)return;const r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),m(e,n,[],t)}function l(e){if(e)throw new Error("Proxy has been released and is not useable")}function p(e){return S(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const f=new WeakMap,g="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(f.get(e)||0)-1;f.set(e,t),0===t&&p(e)});function m(e,r,a=[],s=function(){}){let o=!1;const i=new Proxy(s,{get(t,s){if(l(o),s===n)return()=>{(function(e){g&&g.unregister(e)})(i),p(e),r.clear(),o=!0};if("then"===s){if(0===a.length)return{then:()=>i};const t=S(e,r,{type:"GET",path:a.map(e=>e.toString())}).then(w);return t.then.bind(t)}return m(e,r,[...a,s])},set(t,n,s){l(o);const[i,c]=v(s);return S(e,r,{type:"SET",path:[...a,n].map(e=>e.toString()),value:i},c).then(w)},apply(n,s,i){l(o);const c=a[a.length-1];if(c===t)return S(e,r,{type:"ENDPOINT"}).then(w);if("bind"===c)return m(e,r,a.slice(0,-1));const[u,p]=d(i);return S(e,r,{type:"APPLY",path:a.map(e=>e.toString()),argumentList:u},p).then(w)},construct(t,n){l(o);const[s,i]=d(n);return S(e,r,{type:"CONSTRUCT",path:a.map(e=>e.toString()),argumentList:s},i).then(w)}});return function(e,t){const n=(f.get(t)||0)+1;f.set(t,n),g&&g.register(e,t,e)}(i,e),i}function y(e){return Array.prototype.concat.apply([],e)}function d(e){const t=e.map(v);return[t.map(e=>e[0]),y(t.map(e=>e[1]))]}const h=new WeakMap;function E(e,t){return h.set(e,t),e}function b(t){return Object.assign(t,{[e]:!0})}function v(e){for(const[t,n]of o)if(n.canHandle(e)){const[r,a]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},a]}return[{type:"RAW",value:e},h.get(e)||[]]}function w(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function S(e,t,n,r){return new Promise(a=>{const s=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(s,a),e.start&&e.start(),e.postMessage(Object.assign({id:s},n),r)})}export{t as createEndpoint,i as expose,r as finalizer,b as proxy,e as proxyMarker,n as releaseProxy,E as transfer,o as transferHandlers,u as wrap};
@@ -1 +0,0 @@
1
- import{c as t,d as e,e as n,f as s,g as i,h as o,i as a,j as d,k as m}from"./embedding-plugins-DLVs7ER4.mjs";const h=(t,e,n=0,s=0)=>{const i=e.x+e.width+n,o=e.x-n,a=e.y+e.height+s,d=e.y-s,{x:m,y:h}=t;return m>=o&&m<=i&&h>=d&&h<=a},r=(t,e,n,s=0,i=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?h({x:t,y:e},n.visibleIn,s,i):!!n.hiddenIn&&!h({x:t,y:e},n.hiddenIn,-s,-i)};class l{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(h,l,g){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!g.ghost?.external&&g.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(e)){const t=document.createElement("style");t.type="text/css",t.id=e,t.innerHTML=`\n ${n}\n ${s}\n `,document.head.appendChild(t)}})();const c={x:h,y:l};!g.ghost&&this._dragGhostElement&&(g.ghost={}),g.ghost&&!g.ghost.element&&this._dragGhostElement&&(g.ghost.element=this._dragGhostElement),(({x:e,y:n},s)=>{let d=document.getElementById(t);if(!d){if(d=document.createElement("div"),s.ghost?.element)d.appendChild(s.ghost.element);else{const t=document.createElement("img");t.src=s.ghost?.url||i,t.width=s.ghost?.width||o,t.height=s.ghost?.height||a,d.appendChild(t)}d.id=t,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",r(e,n,s.ghost||{},s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)||(d.style.display="none"),d.style.pointerEvents="none",document.body.appendChild(d)}})(c,g),(({x:e,y:n},s)=>{const i=document.getElementById(t);if(!i)return;let h=s.ghost?.width,l=s.ghost?.height;typeof h>"u"&&(h=i.getBoundingClientRect().width||o),typeof l>"u"&&(l=i.getBoundingClientRect().height||a);const g=e-h/2,c=n-l/2;i.style.transform=`translate3d(${g}px, ${c}px, 0)`,s.ghost&&(r(e,n,s.ghost,s.settings?.dragInOverlapX,s.settings?.dragInOverlapY)?i.style.animation!=d&&(i.style.animation=d):i.style.animation!=m&&(i.style.animation=m))})(c,g),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const e=document.getElementById(t);e&&document.body.removeChild(e),this._dragGhostRemoveAnimationFrameId=null}))}}export{l as E};
@@ -1,81 +0,0 @@
1
- import { c as r, d as o, e as f, f as u, g as y, h as A, i as G, j as g, k as _ } from "./embedding-plugins-DqMSzAJe.mjs";
2
- const c = (i, n, t = 0, e = 0) => {
3
- const s = n.x + n.width + t, a = n.x - t, h = n.y + n.height + e, l = n.y - e, { x: d, y: m } = i;
4
- return d >= a && d <= s && m >= l && m <= h;
5
- }, I = (i, n, t, e = 0, s = 0) => {
6
- if (!(!t || !t.hiddenIn && !t.visibleIn))
7
- return t.visibleIn ? c(
8
- { x: i, y: n },
9
- t.visibleIn,
10
- e,
11
- s
12
- ) : t.hiddenIn ? !c(
13
- { x: i, y: n },
14
- t.hiddenIn,
15
- -e,
16
- -s
17
- ) : !1;
18
- }, R = () => {
19
- if (!!!document.getElementById(o)) {
20
- const n = document.createElement("style");
21
- n.type = "text/css", n.id = o, n.innerHTML = `
22
- ${f}
23
- ${u}
24
- `, document.head.appendChild(n);
25
- }
26
- }, F = ({ x: i, y: n }, t) => {
27
- let e = document.getElementById(r);
28
- if (!e) {
29
- if (e = document.createElement("div"), t.ghost?.element)
30
- e.appendChild(t.ghost.element);
31
- else {
32
- const s = document.createElement("img");
33
- s.src = t.ghost?.url || y, s.width = t.ghost?.width || A, s.height = t.ghost?.height || G, e.appendChild(s);
34
- }
35
- e.id = r, 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", I(
36
- i,
37
- n,
38
- t.ghost || {},
39
- t.settings?.dragInOverlapX,
40
- t.settings?.dragInOverlapY
41
- ) || (e.style.display = "none"), e.style.pointerEvents = "none", document.body.appendChild(e);
42
- }
43
- }, E = ({ x: i, y: n }, t) => {
44
- const e = document.getElementById(r);
45
- if (!e)
46
- return;
47
- let s = t.ghost?.width, a = t.ghost?.height;
48
- typeof s > "u" && (s = e.getBoundingClientRect().width || A), typeof a > "u" && (a = e.getBoundingClientRect().height || G);
49
- const h = i - s / 2, l = n - a / 2;
50
- e.style.transform = `translate3d(${h}px, ${l}px, 0)`, t.ghost && (I(
51
- i,
52
- n,
53
- t.ghost,
54
- t.settings?.dragInOverlapX,
55
- t.settings?.dragInOverlapY
56
- ) ? e.style.animation != g && (e.style.animation = g) : e.style.animation != _ && (e.style.animation = _));
57
- };
58
- class L {
59
- _dragGhostAnimationFrameId = null;
60
- _dragGhostRemoveAnimationFrameId = null;
61
- _dragGhostElement = null;
62
- constructor(n = null) {
63
- this._dragGhostElement = n;
64
- }
65
- updateDragGhost(n, t, e) {
66
- this._dragGhostRemoveAnimationFrameId && (cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId), this._dragGhostRemoveAnimationFrameId = null), !e.ghost?.external && e.ghost && (this._dragGhostAnimationFrameId || (this._dragGhostAnimationFrameId = requestAnimationFrame(() => {
67
- R();
68
- const s = { x: n, y: t };
69
- !e.ghost && this._dragGhostElement && (e.ghost = {}), e.ghost && !e.ghost.element && this._dragGhostElement && (e.ghost.element = this._dragGhostElement), F(s, e), E(s, e), this._dragGhostAnimationFrameId = null;
70
- })));
71
- }
72
- removeDragGhost() {
73
- this._dragGhostAnimationFrameId && (cancelAnimationFrame(this._dragGhostAnimationFrameId), this._dragGhostAnimationFrameId = null), this._dragGhostRemoveAnimationFrameId || (this._dragGhostRemoveAnimationFrameId = requestAnimationFrame(() => {
74
- const n = document.getElementById(r);
75
- n && document.body.removeChild(n), this._dragGhostRemoveAnimationFrameId = null;
76
- }));
77
- }
78
- }
79
- export {
80
- L as E
81
- };
@@ -1 +0,0 @@
1
- const t="rml-drag-in-styles",e="rml-drag-in-drag-element",a="rml-drag-in-overlay",s="rml-drag-in-drag-ghost",r="rml-drag-in-fade-in",i="rml-drag-in-fade-out",n={DISPLAY_NONE:"rml-display-none"},o=.5,d="250ms",g="forwards",m=`@keyframes ${r} {from{opacity: 0;}to {opacity: 0.5;}}`,l=`@keyframes ${i} {from{opacity: 0.5;}to {opacity: 0;}}`,c=`${r} ${d} ${g}`,h=`${i} ${d} ${g}`,p="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",u=112,_=112;class y{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,a,s){this._instance=t,this._mainDomElement=e,this._mode=a,this._viewName=s}async init(){return Promise.resolve()}}class D extends y{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById(t)){const e=document.createElement("style");e.type="text/css",e.id=t,e.innerHTML=`\n .${n.DISPLAY_NONE}{display:none}\n .${a}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${s}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${m}\n ${l}\n `,document.head.appendChild(e)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+s);e||(e=document.createElement("div"),e.classList.add(s),e.innerText=" ",t.appendChild(e))}constructor(t,e,a,s){super(t,e,a,s),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-nKwD78_u.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-CaDOooe4.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,a="rml_id"){this._strategy.dragStart(t,e,a)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,a="rml_id"){this._strategy.touchStart(t,e,a)}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:a,beforeUpdateGhost:s}){s&&this._strategy.beforeUpdateGhost(s);const r=this._customDragSignal.signal,i=t=>{this._strategy.releaseInput(t),this._strategy.isDragging&&e(t)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(t=>{t.draggable=!1,t.style.touchAction="none"}),document.addEventListener("pointerdown",e=>{"true"===e.target.getAttribute("data-rml-draggable")&&(e.target.setPointerCapture&&e.target.setPointerCapture(e.pointerId),t(e))},{signal:r}),document.addEventListener("pointermove",t=>{a(t)},{signal:r}),document.addEventListener("pointerup",i,{signal:r}),document.addEventListener("pointercancel",i,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}const w=Object.freeze(Object.defineProperty({__proto__:null,DragIn:D},Symbol.toStringTag,{value:"Module"}));export{D,a as R,o as T,n as a,s as b,e as c,t as d,m as e,l as f,p as g,u as h,_ as i,c as j,h as k,w as l};
@@ -1,140 +0,0 @@
1
- const _ = "rml-drag-in-styles", N = "rml-drag-in-drag-element", A = "rml-drag-in-overlay", n = "rml-drag-in-drag-ghost", d = "rml-drag-in-fade-in", g = "rml-drag-in-fade-out", D = {
2
- DISPLAY_NONE: "rml-display-none"
3
- }, c = 0.5, l = "250ms", m = "forwards", y = `@keyframes ${d} {from{opacity: 0;}to {opacity: ${c};}}`, S = `@keyframes ${g} {from{opacity: ${c};}to {opacity: 0;}}`, R = `${d} ${l} ${m}`, G = `${g} ${l} ${m}`, T = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg", f = 112, b = 112;
4
- class I {
5
- _mainDomElement;
6
- _instance;
7
- _mode = "website";
8
- _viewName = "main";
9
- constructor(t, e, r, a) {
10
- this._instance = t, this._mainDomElement = e, this._mode = r, this._viewName = a;
11
- }
12
- async init() {
13
- return Promise.resolve();
14
- }
15
- }
16
- class E extends I {
17
- options = {};
18
- _customDragSignal = new AbortController();
19
- _injectStyles() {
20
- if (!!!document.getElementById(_)) {
21
- const e = document.createElement("style");
22
- e.type = "text/css", e.id = _, e.innerHTML = `
23
- .${D.DISPLAY_NONE}{display:none}
24
- .${A}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
25
- .${n}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
26
- ${y}
27
- ${S}
28
- `, document.head.appendChild(e);
29
- }
30
- }
31
- _initializeDragGhost() {
32
- const t = this._mainDomElement.parentNode;
33
- let e = t.querySelector(
34
- "." + n
35
- );
36
- e || (e = document.createElement("div"), e.classList.add(n), e.innerText = " ", t.appendChild(e));
37
- }
38
- constructor(t, e, r, a) {
39
- super(t, e, r, a), this._mainDomElement = e, this._injectStyles(), this._initializeDragGhost();
40
- }
41
- async init() {
42
- if (await super.init(), this._mode === "website")
43
- try {
44
- const { DragInFromWebsiteStrategy: t } = await import("./from-website-Bvd5Pi0i.mjs");
45
- this._strategy = new t(
46
- this._instance,
47
- this._mainDomElement,
48
- { settings: this.options, mode: "website" }
49
- );
50
- } catch (t) {
51
- throw console.error('Could not load Dragin strategy "FromWebsite"'), t;
52
- }
53
- else if (this._mode === "custom-view")
54
- try {
55
- const { DragInFromCustomViewStrategy: t } = await import("./from-custom-view-T67aFIDR.mjs");
56
- this._strategy = new t(
57
- this._instance,
58
- this._mainDomElement,
59
- this.options,
60
- this._viewName
61
- );
62
- } catch (t) {
63
- throw console.error('Could not load Dragin strategy "FromCustomView"'), t;
64
- }
65
- else
66
- throw new Error("Unsupported mode");
67
- }
68
- get isDragging() {
69
- return this._strategy.isDragging;
70
- }
71
- dragStart(t, e, r = "rml_id") {
72
- this._strategy.dragStart(t, e, r);
73
- }
74
- dragUpdate(t) {
75
- this._strategy.dragUpdate(t);
76
- }
77
- dragEnd() {
78
- this._strategy.dragEnd();
79
- }
80
- touchStart(t, e, r = "rml_id") {
81
- this._strategy.touchStart(t, e, r);
82
- }
83
- touchMove(t) {
84
- this._strategy.touchMove(t);
85
- }
86
- touchEnd() {
87
- this._strategy.touchEnd();
88
- }
89
- dispose() {
90
- this._strategy.dispose();
91
- }
92
- beforeUpdateGhost(t) {
93
- this._strategy.beforeUpdateGhost(t);
94
- }
95
- registerCustomDrag({
96
- customDragStart: t,
97
- customDragEnd: e,
98
- customDragUpdate: r,
99
- beforeUpdateGhost: a
100
- }) {
101
- a && this._strategy.beforeUpdateGhost(a);
102
- const o = this._customDragSignal.signal, p = (s) => {
103
- s.target.getAttribute("data-rml-draggable") === "true" && (s.target.setPointerCapture && s.target.setPointerCapture(s.pointerId), t(s));
104
- }, i = (s) => {
105
- this._strategy.releaseInput(s), this._strategy.isDragging && e(s);
106
- }, u = (s) => {
107
- r(s);
108
- };
109
- document.querySelectorAll('[data-rml-draggable="true"]').forEach((s) => {
110
- s.draggable = !1, s.style.touchAction = "none";
111
- }), document.addEventListener("pointerdown", p, { signal: o }), document.addEventListener("pointermove", u, { signal: o }), document.addEventListener("pointerup", i, { signal: o }), document.addEventListener("pointercancel", i, { signal: o });
112
- }
113
- unregisterCustomDrag() {
114
- this._customDragSignal.abort(), this._customDragSignal = new AbortController();
115
- }
116
- releaseInput(t) {
117
- this._strategy.releaseInput(t);
118
- }
119
- }
120
- const C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
121
- __proto__: null,
122
- DragIn: E
123
- }, Symbol.toStringTag, { value: "Module" }));
124
- export {
125
- E as D,
126
- A as R,
127
- c as T,
128
- D as a,
129
- n as b,
130
- N as c,
131
- _ as d,
132
- y as e,
133
- S as f,
134
- T as g,
135
- f as h,
136
- b as i,
137
- R as j,
138
- G as k,
139
- C as l
140
- };
@@ -1 +0,0 @@
1
- import{i as t,e,b as s}from"./utils-BqTPLNLs.mjs";import{i,h as a,g as r}from"./embedding-plugins-DLVs7ER4.mjs";import{E as n}from"./drag-ghost-B7UAYefM.mjs";const h=(e,s=0)=>t(e)?{clientX:e.touches[s].clientX,clientY:e.touches[s].clientY}:{clientX:e.clientX,clientY:e.clientY},o=e=>!e||!t(e)||e.touches.length>0;class _{_touchDragTimeOut;_onTouchDragStart;_payload=null;_delay=500;_firstTouch=null;_lastTouch=null;_epsilon=10;constructor(t,{onTouchDragStart:e},s={}){this._payload=t,this._onTouchDragStart=e,this._delay="number"==typeof s.delay?s.delay:500,this._epsilon="number"==typeof s.epsilon?s.epsilon:10}onStart(e){o(e)&&(this._touchDragTimeOut||(this._firstTouch=h(e,t(e)?e.touches.length-1:0),this._touchDragTimeOut=setTimeout(()=>{this._clearTimeout(),this._lastTouch||(this._lastTouch=h(e)),this._checkXDistance(e)()},this._delay)))}onEnd(){this._resetTouches()}onMove(t){o(t)&&(this._lastTouch=h(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())}}}const l=t=>{t.preventDefault(),t.stopPropagation()};class g{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:t},e={}){this._epsilon="number"==typeof e.epsilon?e.epsilon:15,this._onCustomDragStart=t}onMove(t){this._lastX=t.clientX,this._lastY=t.clientY,this._isWaiting&&((t,e)=>{const s=this._lastX-t,i=this._lastY-e;return Math.sqrt(s*s+i*i)})(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 c="data-rml-old-draggable",u=(e,s)=>{const i=t(e),a={delay:i?500:100,epsilon:i?10:15};if(!s)return a;if(!(i||e instanceof MouseEvent))return a;const{delayKey:r,epsilonKey:n}=i?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof s[r]&&(a.delay=s.touchDragDelay),"number"==typeof s[n]&&(a.epsilon=s.touchDragEpsilon),a};class d{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_dragGhost=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;_hasEnteredIframe=!1;_pendingDragIn=null;_canvasBb=null;_overlayBb=null;_dragGeneration=0;_interactionContainerBb=null;constructor(t,e,s,i){this._instance=t,this._options=s||{},this._viewName=i,this._mainDomElement=e,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,e,s="rml_id"){const i=++this._dragGeneration;if(this._startTarget&&(this._startTarget.style.pointerEvents="none",this._startTarget.style.userSelect="none",this._startTarget.setAttribute(c,this._startTarget.draggable.toString()),this._startTarget.draggable=!1,this._startTarget.removeEventListener("dragstart",l),this._startTarget.addEventListener("dragstart",l)),this._startTarget){const t=this._startTarget.getBoundingClientRect(),e=this._startTarget.cloneNode(!0);e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,this._dragGhost=new n(e)}else this._dragGhost=new n;var a;this._currentBb=await this._instance.getBoundingClientRect((a=this._viewName,`[data-rml-custom-view="${a}"]`)),this._canvasBb=await this._instance.getBoundingClientRect("canvas"),this._overlayBb=(await this._instance.getDrawerBoundingClientRect()).final,this._interactionContainerBb=await this._instance.getBoundingClientRect(".interaction-container"),i===this._dragGeneration&&(this._pendingDragIn={id:t,type:s},this._hasEnteredIframe=!1,this.isDragging=!0)}_dragUpdate(t){document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t);const{clientX:n,clientY:h}=e(t);if(this._dragGhost){const{width:t,height:e}=this._mainDomElement.getBoundingClientRect();this._dragGhost.updateDragGhost(n,h,{ghost:{visibleIn:{x:0,y:0,width:t,height:e}}})}if(!this._currentBb||!this.isDragging)return;const o=this._currentBb.x+n,_=this._currentBb.y+h,l=s(o,_,this._canvasBb,this._overlayBb,this._interactionContainerBb);if(l&&!this._hasEnteredIframe&&this._pendingDragIn&&(this._instance.dragInObject(this._pendingDragIn.id,o,_,this._pendingDragIn.type),this._hasEnteredIframe=!0),!l&&this._hasEnteredIframe&&(this._instance.cancelDragIn(),this._hasEnteredIframe=!1),!this._hasEnteredIframe)return;const{url:g,width:c,height:u}=(t=>{let e="",s=a,n=i;if(!t)return{url:r,width:s,height:n};const h=t;if(h instanceof HTMLElement){const t=h.getBoundingClientRect(),i=h.getAttribute("data-rml-ghost-url"),a=h.getAttribute("data-rml-ghost-width"),o=h.getAttribute("data-rml-ghost-height");i?e=i:!i&&h instanceof HTMLImageElement&&h.src&&(e=h.src),e?(s=t.width,n=t.height):e=r,s=a?parseInt(a,10):s,n=o?parseInt(o,10):n}return{url:e||r,width:s,height:n}})(this._startTarget),d=this._options||{},m={ghost:{visibleIn:{x:this._currentBb.x-(d.dragInOverlapX||0),y:this._currentBb.y+(d.dragInOverlapY||0),width:this._currentBb.width+(d.dragInOverlapX||0),height:this._currentBb.height+(d.dragInOverlapY||0)},url:g,width:c,height:u},mode:"custom-view"},{x:p,y:D,options:T}=this._onBeforeUpdateDrag(o,_,m),y="number"==typeof p?p:o,b="number"==typeof D?D:_,f=T||m;this._instance.updateDrag(y,b,f)}_dragEnd(){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}dragStart(e,s,i){this._instance.disableEvents(),this._startTarget=s.target,this._currentCustomDrag=t(s)?new _(void 0,{onTouchDragStart:(t,s)=>{this._dragStart(e,s,i)}},{...u(s,this._options),delay:0}):new g({onCustomDragStart:t=>this._dragStart(e,t,i)},u(s,this._options)),this._currentCustomDrag.onStart(s)}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(c),this._startTarget.removeAttribute(c),this._startTarget.removeEventListener("dragstart",l))}releaseInput(t){this._dragGeneration++,this._dragEnd()}}export{d as DragInFromCustomViewStrategy};