@roomle/embedding-lib 5.25.0-alpha.1 → 5.25.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/md/web/embedding/CHANGELOG.md +2 -28
- package/drag-in-DTA1FCDc.mjs +1 -0
- package/drag-in-DuufO5eB.mjs +138 -0
- package/from-custom-view-BdnViEhf.mjs +163 -0
- package/from-custom-view-DIYHP31u.mjs +1 -0
- package/from-website-CcDHgCCy.mjs +1 -0
- package/from-website-CktA6Icy.mjs +201 -0
- package/package.json +1 -1
- package/packages/embedding-lib/src/examples/homag-intelligence-example.d.ts +9 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/create-catalog.d.ts +1 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/default-api-options.d.ts +43 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/dom-helper.d.ts +13 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/drag-in.d.ts +3 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/overlay.d.ts +2 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/state.d.ts +14 -0
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/util.d.ts +19 -0
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +1 -0
- package/packages/web-sdk/packages/common-core/src/input/input-manager.d.ts +1 -0
- package/packages/web-sdk/packages/common-core/src/main.d.ts +2 -2
- package/packages/web-sdk/packages/common-core/src/static-files/environment-maps.d.ts +6 -7
- package/packages/web-sdk/packages/common-core/src/static-files/libs.d.ts +3 -1
- package/packages/web-sdk/packages/common-core/src/static-files/light-settings.d.ts +8 -6
- package/packages/web-sdk/packages/common-core/src/static-files/luts.d.ts +11 -9
- package/packages/web-sdk/packages/common-core/src/static-files/roomle-core.d.ts +8 -6
- package/packages/web-sdk/packages/common-core/src/utils/common-utils.d.ts +0 -1
- package/packages/web-sdk/packages/common-core/src/utils/init-data.d.ts +2 -0
- package/packages/web-sdk/packages/common-core/src/utils/shims.d.ts +6 -0
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/gbuffer-render-pass.d.ts +1 -1
- package/packages/web-sdk/packages/configurator-core/src/configurator.d.ts +1 -1
- package/packages/web-sdk/packages/configurator-core/src/roomle-configurator.d.ts +13 -0
- package/packages/web-sdk/packages/configurator-core/src/static-files/fonts.d.ts +4 -2
- package/packages/web-sdk/packages/configurator-core/src/static-files/geometries.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/static-files/settings.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/static-files/textures.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/utils/animation/animation-value-map.d.ts +1 -0
- package/packages/web-sdk/packages/configurator-core/src/utils/component-dimensioning-helper.d.ts +3 -3
- package/packages/web-sdk/packages/configurator-core/src/utils/component-raycast-helper.d.ts +1 -1
- package/packages/web-sdk/packages/configurator-core/src/utils/dimensioning-helper.d.ts +1 -0
- package/packages/web-sdk/packages/configurator-core/src/utils/test-helpers/utils.d.ts +2 -2
- package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +4 -0
- package/packages/web-sdk/packages/glb-viewer-core/src/glb-viewer.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/api.d.ts +22 -0
- package/packages/web-sdk/packages/homag-intelligence/src/callbacks.d.ts +37 -0
- package/packages/web-sdk/packages/homag-intelligence/src/emulator.d.ts +101 -0
- package/packages/web-sdk/packages/homag-intelligence/src/homag-intelligence.d.ts +28 -0
- package/packages/web-sdk/packages/homag-intelligence/src/loader.d.ts +24 -0
- package/packages/web-sdk/packages/homag-intelligence/src/model/oc-scripts-domain.model.d.ts +312 -0
- package/packages/web-sdk/packages/homag-intelligence/src/orders.d.ts +39 -0
- package/packages/web-sdk/packages/homag-intelligence/src/rml-plugin.d.ts +3 -0
- package/packages/web-sdk/packages/homag-intelligence/src/util.d.ts +5 -0
- package/packages/web-sdk/packages/material-viewer/src/material-viewer.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/planner.d.ts +1 -1
- package/packages/web-sdk/packages/planner-core/src/roomle-planner.d.ts +13 -1
- package/packages/web-sdk/packages/planner-core/src/webgl/planner-scene-manager.d.ts +1 -0
- package/packages/web-sdk/packages/test-helpers/unit/global-setup.d.ts +1 -1
- package/packages/web-sdk/packages/tools-core/src/tools-core.d.ts +1 -1
- package/packages/web-sdk/packages/typings/external-objects.d.ts +8 -0
- package/packages/web-sdk/packages/typings/planner.d.ts +1 -1
- package/packages/web-sdk/packages/workers/src/static-files/workers.d.ts +4 -2
- package/roomle-embedding-lib.es.js +306 -316
- package/roomle-embedding-lib.es.min.js +1 -1
- package/roomle-embedding-lib.umd.js +17 -17
- package/roomle-embedding-lib.umd.min.js +1 -1
- package/src/common/components/collection-view/-utils/collection-view-dynamic-components.d.ts +1 -1
- package/src/common/composables/use-configurator-api.d.ts +1 -1
- package/src/common/composables/use-core-instances.d.ts +1 -1
- package/src/common/composables/use-static-item-parameters.d.ts +1 -1
- package/src/common/utils/helper.d.ts +1 -1
- package/src/common/utils/parameters.d.ts +0 -1
- package/src/common/utils/types.d.ts +0 -7
- package/src/configurator/business-logic/roomle-sdk-wrapper.d.ts +2 -1
- package/src/configurator/embedding/exposed-api.d.ts +7 -1
- package/src/planner/components/overlays/ProductSettings.vue.d.ts +2 -2
- package/src/planner/components/overlays/product-settings/ProductPositions.vue.d.ts +2 -2
- package/src/planner/components/overlays/product-settings/ProductRotation.vue.d.ts +2 -2
- package/src/planner/components/overlays/product-settings/ProductSettingsInfos.vue.d.ts +2 -2
- package/src/planner/components/overlays/product-settings/ProductSize.vue.d.ts +2 -2
- package/src/planner/components/overlays/product-settings/ProductXYZChanger.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/ConstructionVariants.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/DoorParametersSetting.vue.d.ts +7 -7
- package/src/planner/components/overlays/rooms/ElementLengthScaling.vue.d.ts +1 -1
- package/src/planner/components/overlays/rooms/WindowParametersSetting.vue.d.ts +2 -2
- package/src/planner/components/utils/AssureConfiguratorHandlers.vue.d.ts +1 -1
- package/src/planner/components/utils/AssureSdkHandlers.vue.d.ts +1 -1
- package/src/planner/utils/planner-sidebar.d.ts +1 -1
- package/touch-drag-B5zCf87J.mjs +1 -0
- package/touch-drag-DXJTOrk5.mjs +146 -0
- package/drag-in-BWioG4OL.mjs +0 -1
- package/drag-in-D5QSQ86J.mjs +0 -141
- package/from-custom-view-BcXfK7VI.mjs +0 -163
- package/from-custom-view-DRAqJ-yY.mjs +0 -1
- package/from-website-B3kPg18n.mjs +0 -207
- package/from-website-DR93OSJD.mjs +0 -1
- package/packages/web-sdk/packages/acceptance-tests/src/utils/async-acceptance-test.d.ts +0 -3
- package/packages/web-sdk/packages/configurator-core/__acceptance__/boot.d.ts +0 -1
- package/packages/web-sdk/packages/vite-plugins/vite-plugin-auto-workers.d.ts +0 -8
- package/packages/web-sdk/packages/vite-plugins/vite-plugin-bundle-sw.d.ts +0 -10
- package/touch-drag-BEct6jbW.mjs +0 -1
- package/touch-drag-DNDPwZ-_.mjs +0 -149
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
## [5.25.0-alpha.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Features
|
|
5
|
-
|
|
6
|
-
* collection of light sources in component ([39d0c6d](https://github.com/roomle-dev/roomle-ui/commit/39d0c6d4457c7e36a6ab24146d4b6b2381145a7c))
|
|
7
|
-
* COLOR parameter type ([5b5a656](https://github.com/roomle-dev/roomle-ui/commit/5b5a6564faa9a1cddb556979f2f6ac3f42066b7b))
|
|
8
|
-
* component area light ([6ca94ab](https://github.com/roomle-dev/roomle-ui/commit/6ca94ab66f30d793b7a3e37be912388ac611e355))
|
|
9
|
-
* component point light ([2d8ed76](https://github.com/roomle-dev/roomle-ui/commit/2d8ed76db76a313263df448934e55c278f4cc878))
|
|
10
|
-
* core api - Editor3dChangedLightSource ([f83bb0c](https://github.com/roomle-dev/roomle-ui/commit/f83bb0ccb12dd5acc27d095743b21a5900958299))
|
|
11
|
-
* core api - Editor3dChangedLightSource ([3cc6a47](https://github.com/roomle-dev/roomle-ui/commit/3cc6a47daa49626d3f22f2612e3bfd1762d22c9b))
|
|
12
|
-
* core upgrade to version 2.57.0-alpha.1 ([7894089](https://github.com/roomle-dev/roomle-ui/commit/7894089e552d63d700deb44791d31bdcb1ea3772))
|
|
13
|
-
* core upgrade to version 2.57.0-alpha.2 ([8ef08a9](https://github.com/roomle-dev/roomle-ui/commit/8ef08a90dda72f5d30d445badd97f4a77e2c27c1))
|
|
14
|
-
* core upgrade to version 2.57.0-alpha.3 ([f6f1459](https://github.com/roomle-dev/roomle-ui/commit/f6f14594242c9c0d6a28bf27a0f7dfe1e3fa9583))
|
|
15
|
-
* drag insert object animation ([180b17b](https://github.com/roomle-dev/roomle-ui/commit/180b17b640ae40a0c64f4ccb1815f576bd210b77))
|
|
16
|
-
* migration of the light source implementation from innovation day ([c9b554b](https://github.com/roomle-dev/roomle-ui/commit/c9b554bc7cfa929affdb5f065237aa71a6b0813a))
|
|
17
|
-
* update light source attributes ([b4f080c](https://github.com/roomle-dev/roomle-ui/commit/b4f080c059acfb21cedaf6e770b4301887770ad5))
|
|
18
|
-
* **SDK:** upgrade to version 2.105.0 ([#1758](https://github.com/roomle-dev/roomle-ui/issues/1758)) ([d259718](https://github.com/roomle-dev/roomle-ui/commit/d2597182081e18dccaba8c8309c6ac371b317e1b))
|
|
19
|
-
* **core:** upgrade to version 2.57.0-alpha.4 ([55d0d2e](https://github.com/roomle-dev/roomle-ui/commit/55d0d2edab851fe2da418907663ecf347272201b))
|
|
20
|
-
* **core:** upgrade to version 2.57.0-alpha.5 ([7729b50](https://github.com/roomle-dev/roomle-ui/commit/7729b50ad6ebcb8265dd6f66f005206acb2b457c))
|
|
21
|
-
* **core:** upgrade to version 2.57.0-alpha.5 ([b5f4127](https://github.com/roomle-dev/roomle-ui/commit/b5f412743d68be2640ecfebdeba27bbc4ecdd18b))
|
|
1
|
+
## [5.25.0-alpha.10](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.25.0-alpha.9...embedding-lib-v5.25.0-alpha.10) (2025-08-07)
|
|
22
2
|
|
|
23
3
|
|
|
24
4
|
### Bug Fixes
|
|
25
5
|
|
|
26
|
-
*
|
|
27
|
-
* Build workers in sdk folder when running npm run dev ([8f717d6](https://github.com/roomle-dev/roomle-ui/commit/8f717d6b6fd01bac863873f8f2f9001ce55c8603))
|
|
28
|
-
* lamp light intensity ([da960a0](https://github.com/roomle-dev/roomle-ui/commit/da960a0dbb8a6d0272a3172aff839d0e32ee7a20))
|
|
29
|
-
* parse font json instead of loading it from url ([940e57e](https://github.com/roomle-dev/roomle-ui/commit/940e57e2ca86b73131de7578f4433065c40c81fc))
|
|
30
|
-
* remove duplicate member (resolve merge conflict) ([4973406](https://github.com/roomle-dev/roomle-ui/commit/4973406c472f2572b9292cef13956ba267d64317))
|
|
31
|
-
* remove tween object after completing or stopping the animation ([5e87d17](https://github.com/roomle-dev/roomle-ui/commit/5e87d17d26a9635ee60818fec67c26d0be2e68f9))
|
|
32
|
-
* use import for tween.js instead of script loader ([c248fc3](https://github.com/roomle-dev/roomle-ui/commit/c248fc34c293f130cdd9b19d382c46eb66765b43))
|
|
6
|
+
* release ([42400e9](https://github.com/roomle-dev/roomle-ui/commit/42400e95a2da8f299b8611c949897e9f28b7a798))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class t{_mainDomElement;_instance;_mode="website";_viewName="main";constructor(t,e,s,a){this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=a}async init(){return Promise.resolve()}}const e="rml-drag-in-styles",s="rml-drag-in-drag-element",a="rml-drag-in-overlay",r="rml-drag-in-drag-ghost",i="rml-drag-in-fade-in",n="rml-drag-in-fade-out",o={DISPLAY_NONE:"rml-display-none"},d="250ms",m="forwards",g=`@keyframes ${i} {from{opacity: 0;}to {opacity: 0.5;}}`,l=`@keyframes ${n} {from{opacity: 0.5;}to {opacity: 0;}}`,c=`${i} ${d} ${m}`,h=`${n} ${d} ${m}`,u="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",p=112,_=112,y=Object.freeze(Object.defineProperty({__proto__:null,DragIn:class extends t{options={};_customDragSignal=new AbortController;_injectStyles(){if(!document.getElementById(e)){const t=document.createElement("style");t.type="text/css",t.id=e,t.innerHTML=`\n .${o.DISPLAY_NONE}{display:none}\n .${a}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}\n .${r}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}\n ${g}\n ${l}\n `,document.head.appendChild(t)}}_initializeDragGhost(){const t=this._mainDomElement.parentNode;let e=t.querySelector("."+r);e||(e=document.createElement("div"),e.classList.add(r),e.innerText=" ",t.appendChild(e))}constructor(t,e,s,a){super(t,e,s,a),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}async init(){if(await super.init(),"website"===this._mode)try{const{DragInFromWebsiteStrategy:t}=await import("./from-website-CcDHgCCy.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-DIYHP31u.mjs");this._strategy=new t(this._instance,this._mainDomElement,this.options,this._viewName)}catch(t){throw t}}}get isDragging(){return this._strategy.isDragging}dragStart(t,e,s="rml_id"){this._strategy.dragStart(t,e,s)}dragUpdate(t){this._strategy.dragUpdate(t)}dragEnd(){this._strategy.dragEnd()}touchStart(t,e,s="rml_id"){this._strategy.touchStart(t,e,s)}touchMove(t){this._strategy.touchMove(t)}touchEnd(){this._strategy.touchEnd()}dispose(){this._strategy.dispose()}beforeUpdateGhost(t){this._strategy.beforeUpdateGhost(t)}registerCustomDrag({customDragStart:t,customDragEnd:e,customDragUpdate:s,beforeUpdateGhost:a}){a&&this._strategy.beforeUpdateGhost(a);const r=this._customDragSignal.signal,i=e=>{"true"===e.target.getAttribute("data-rml-draggable")&&t(e)},n=t=>{this._strategy.releaseInput(t),this._strategy.isDragging&&e(t)},o=t=>{s(t)};document.querySelectorAll('[data-rml-draggable="true"]').forEach(t=>{t.draggable=!1}),document.addEventListener("mousedown",i,{signal:r}),document.addEventListener("mouseup",n,{signal:r}),document.addEventListener("mousemove",o,{signal:r}),document.addEventListener("mouseleave",n,{signal:r}),document.addEventListener("touchstart",i,{signal:r}),document.addEventListener("touchend",n,{signal:r}),document.addEventListener("touchmove",o,{signal:r})}unregisterCustomDrag(){this._customDragSignal.abort(),this._customDragSignal=new AbortController}releaseInput(t){this._strategy.releaseInput(t)}}},Symbol.toStringTag,{value:"Module"}));export{s as R,e as a,g as b,l as c,u as d,p as e,_ as f,c as g,h,a as i,o as j,r as k,y as l};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
class D {
|
|
2
|
+
_mainDomElement;
|
|
3
|
+
_instance;
|
|
4
|
+
_mode = "website";
|
|
5
|
+
_viewName = "main";
|
|
6
|
+
constructor(t, e, s, o) {
|
|
7
|
+
this._instance = t, this._mainDomElement = e, this._mode = s, this._viewName = o;
|
|
8
|
+
}
|
|
9
|
+
async init() {
|
|
10
|
+
return Promise.resolve();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const g = "rml-drag-in-styles", N = "rml-drag-in-drag-element", y = "rml-drag-in-overlay", i = "rml-drag-in-drag-ghost", c = "rml-drag-in-fade-in", l = "rml-drag-in-fade-out", p = {
|
|
14
|
+
DISPLAY_NONE: "rml-display-none"
|
|
15
|
+
}, m = 0.5, h = "250ms", u = "forwards", S = `@keyframes ${c} {from{opacity: 0;}to {opacity: ${m};}}`, I = `@keyframes ${l} {from{opacity: ${m};}to {opacity: 0;}}`, R = `${c} ${h} ${u}`, G = `${l} ${h} ${u}`, T = "https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg", b = 112, f = 112;
|
|
16
|
+
class E extends D {
|
|
17
|
+
options = {};
|
|
18
|
+
_customDragSignal = new AbortController();
|
|
19
|
+
_injectStyles() {
|
|
20
|
+
if (!!!document.getElementById(g)) {
|
|
21
|
+
const e = document.createElement("style");
|
|
22
|
+
e.type = "text/css", e.id = g, e.innerHTML = `
|
|
23
|
+
.${p.DISPLAY_NONE}{display:none}
|
|
24
|
+
.${y}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
|
|
25
|
+
.${i}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
|
|
26
|
+
${S}
|
|
27
|
+
${I}
|
|
28
|
+
`, document.head.appendChild(e);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
_initializeDragGhost() {
|
|
32
|
+
const t = this._mainDomElement.parentNode;
|
|
33
|
+
let e = t.querySelector(
|
|
34
|
+
"." + i
|
|
35
|
+
);
|
|
36
|
+
e || (e = document.createElement("div"), e.classList.add(i), e.innerText = " ", t.appendChild(e));
|
|
37
|
+
}
|
|
38
|
+
constructor(t, e, s, o) {
|
|
39
|
+
super(t, e, s, o), 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-CktA6Icy.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-BdnViEhf.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, s = "rml_id") {
|
|
72
|
+
this._strategy.dragStart(t, e, s);
|
|
73
|
+
}
|
|
74
|
+
dragUpdate(t) {
|
|
75
|
+
this._strategy.dragUpdate(t);
|
|
76
|
+
}
|
|
77
|
+
dragEnd() {
|
|
78
|
+
this._strategy.dragEnd();
|
|
79
|
+
}
|
|
80
|
+
touchStart(t, e, s = "rml_id") {
|
|
81
|
+
this._strategy.touchStart(t, e, s);
|
|
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: s,
|
|
99
|
+
beforeUpdateGhost: o
|
|
100
|
+
}) {
|
|
101
|
+
o && this._strategy.beforeUpdateGhost(o);
|
|
102
|
+
const r = this._customDragSignal.signal, _ = (a) => {
|
|
103
|
+
a.target.getAttribute("data-rml-draggable") === "true" && t(a);
|
|
104
|
+
}, n = (a) => {
|
|
105
|
+
this._strategy.releaseInput(a), this._strategy.isDragging && e(a);
|
|
106
|
+
}, d = (a) => {
|
|
107
|
+
s(a);
|
|
108
|
+
};
|
|
109
|
+
document.querySelectorAll('[data-rml-draggable="true"]').forEach((a) => {
|
|
110
|
+
a.draggable = !1;
|
|
111
|
+
}), document.addEventListener("mousedown", _, { signal: r }), document.addEventListener("mouseup", n, { signal: r }), document.addEventListener("mousemove", d, { signal: r }), document.addEventListener("mouseleave", n, { signal: r }), document.addEventListener("touchstart", _, { signal: r }), document.addEventListener("touchend", n, { signal: r }), document.addEventListener("touchmove", d, { signal: r });
|
|
112
|
+
}
|
|
113
|
+
unregisterCustomDrag() {
|
|
114
|
+
this._customDragSignal.abort(), this._customDragSignal = new AbortController();
|
|
115
|
+
}
|
|
116
|
+
releaseInput(t) {
|
|
117
|
+
this._strategy.releaseInput(t);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
121
|
+
__proto__: null,
|
|
122
|
+
DragIn: E
|
|
123
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
124
|
+
export {
|
|
125
|
+
N as R,
|
|
126
|
+
g as a,
|
|
127
|
+
S as b,
|
|
128
|
+
I as c,
|
|
129
|
+
T as d,
|
|
130
|
+
b as e,
|
|
131
|
+
f,
|
|
132
|
+
R as g,
|
|
133
|
+
G as h,
|
|
134
|
+
y as i,
|
|
135
|
+
p as j,
|
|
136
|
+
i as k,
|
|
137
|
+
M as l
|
|
138
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { C as f, e as D, T as S, i as T, b as v, c as A, d as I } from "./touch-drag-DXJTOrk5.mjs";
|
|
2
|
+
import { f as O, e as B, d as _ } from "./drag-in-DuufO5eB.mjs";
|
|
3
|
+
const L = (a) => `[data-rml-custom-view="${a}"]`, c = (a) => {
|
|
4
|
+
a.preventDefault(), a.stopPropagation();
|
|
5
|
+
}, Y = (a, t, s, e) => {
|
|
6
|
+
const r = s - a, i = e - t;
|
|
7
|
+
return Math.sqrt(r * r + i * i);
|
|
8
|
+
};
|
|
9
|
+
class X {
|
|
10
|
+
_startX = 0;
|
|
11
|
+
_startY = 0;
|
|
12
|
+
_lastX = 0;
|
|
13
|
+
_lastY = 0;
|
|
14
|
+
_epsilon;
|
|
15
|
+
_isWaiting = !1;
|
|
16
|
+
_onCustomDragStart;
|
|
17
|
+
constructor({ onCustomDragStart: t }, s = {}) {
|
|
18
|
+
this._epsilon = typeof s.epsilon == "number" ? s.epsilon : f, this._onCustomDragStart = t;
|
|
19
|
+
}
|
|
20
|
+
onMove(t) {
|
|
21
|
+
this._lastX = t.clientX, this._lastY = t.clientY, this._isWaiting && Y(
|
|
22
|
+
this._startX,
|
|
23
|
+
this._startY,
|
|
24
|
+
this._lastX,
|
|
25
|
+
this._lastY
|
|
26
|
+
) > this._epsilon && (this._onCustomDragStart(t), this._isWaiting = !1);
|
|
27
|
+
}
|
|
28
|
+
onStart(t) {
|
|
29
|
+
this._startX = t.clientX, this._startY = t.clientY, this.onMove(t), this._isWaiting = !0;
|
|
30
|
+
}
|
|
31
|
+
onEnd() {
|
|
32
|
+
this._reset();
|
|
33
|
+
}
|
|
34
|
+
_reset() {
|
|
35
|
+
this._startX = 0, this._startY = 0, this._lastX = 0, this._lastY = 0, this._isWaiting = !1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const l = "data-rml-old-draggable", G = void 0, p = (a, t) => {
|
|
39
|
+
const s = T(a), e = {
|
|
40
|
+
delay: s ? A : I,
|
|
41
|
+
epsilon: s ? v : f
|
|
42
|
+
};
|
|
43
|
+
if (!t)
|
|
44
|
+
return e;
|
|
45
|
+
if (!s && !(a instanceof MouseEvent))
|
|
46
|
+
return console.warn(
|
|
47
|
+
"Unsupported event! It is not TouchEvent and also not MouseEvent"
|
|
48
|
+
), e;
|
|
49
|
+
const {
|
|
50
|
+
delayKey: r,
|
|
51
|
+
epsilonKey: i
|
|
52
|
+
} = s ? { delayKey: "touchDragDelay", epsilonKey: "touchDragEpsilon" } : { delayKey: "customDragDelay", epsilonKey: "customDragEpsilon" };
|
|
53
|
+
return typeof t[r] == "number" && (e.delay = t.touchDragDelay), typeof t[i] == "number" && (e.epsilon = t.touchDragEpsilon), e;
|
|
54
|
+
}, w = (a) => {
|
|
55
|
+
let t = "", s = B, e = O;
|
|
56
|
+
if (!a)
|
|
57
|
+
return { url: _, width: s, height: e };
|
|
58
|
+
const r = a;
|
|
59
|
+
if (r instanceof HTMLElement) {
|
|
60
|
+
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");
|
|
61
|
+
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;
|
|
62
|
+
}
|
|
63
|
+
return { url: t || _, width: s, height: e };
|
|
64
|
+
};
|
|
65
|
+
class M {
|
|
66
|
+
_options = {};
|
|
67
|
+
_instance;
|
|
68
|
+
_mainDomElement;
|
|
69
|
+
_viewName;
|
|
70
|
+
_currentCustomDrag = null;
|
|
71
|
+
_currentBb = null;
|
|
72
|
+
_startTarget = null;
|
|
73
|
+
_onBeforeUpdateDrag = () => ({});
|
|
74
|
+
isDragging = !1;
|
|
75
|
+
constructor(t, s, e) {
|
|
76
|
+
this._instance = t, this._options = s || {}, this._viewName = e, this._mainDomElement = mainDomElement, this._mainDomElement.parentElement?.addEventListener("dragleave", () => {
|
|
77
|
+
this._instance.cancelDragIn();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
beforeUpdateGhost(t) {
|
|
81
|
+
this._onBeforeUpdateDrag = t;
|
|
82
|
+
}
|
|
83
|
+
async _dragStart(t, s, e = "rml_id") {
|
|
84
|
+
this._startTarget && (this._startTarget.style.pointerEvents = "none", this._startTarget.style.userSelect = "none", this._startTarget.setAttribute(
|
|
85
|
+
l,
|
|
86
|
+
this._startTarget.draggable.toString()
|
|
87
|
+
), this._startTarget.draggable = !1, this._startTarget.removeEventListener("dragstart", c), this._startTarget.addEventListener("dragstart", c)), this._currentBb = await this._instance.getBoundingClientRect(
|
|
88
|
+
L(this._viewName)
|
|
89
|
+
);
|
|
90
|
+
const { clientX: r, clientY: i } = D(s), n = this._currentBb.x + r, o = this._currentBb.y + i;
|
|
91
|
+
this.isDragging = !0, this._instance.dragInObject(t, n, o, e);
|
|
92
|
+
}
|
|
93
|
+
_dragUpdate(t) {
|
|
94
|
+
if (document.body.focus(), this._currentCustomDrag && this._currentCustomDrag.onMove(t), !this._currentBb || !this.isDragging)
|
|
95
|
+
return;
|
|
96
|
+
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 = {
|
|
97
|
+
ghost: {
|
|
98
|
+
visibleIn: {
|
|
99
|
+
x: this._currentBb.x - (g.dragInOverlapX || 0),
|
|
100
|
+
y: this._currentBb.y + (g.dragInOverlapY || 0),
|
|
101
|
+
width: this._currentBb.width + (g.dragInOverlapX || 0),
|
|
102
|
+
height: this._currentBb.height + (g.dragInOverlapY || 0)
|
|
103
|
+
},
|
|
104
|
+
url: r,
|
|
105
|
+
width: i,
|
|
106
|
+
height: n
|
|
107
|
+
},
|
|
108
|
+
mode: "custom-view"
|
|
109
|
+
}, {
|
|
110
|
+
x: d,
|
|
111
|
+
y: m,
|
|
112
|
+
options: b
|
|
113
|
+
} = this._onBeforeUpdateDrag(o, h, u), E = typeof d == "number" ? d : o, y = typeof m == "number" ? m : h, C = b || u;
|
|
114
|
+
this._instance.updateDrag(E, y, C);
|
|
115
|
+
}
|
|
116
|
+
_dragEnd() {
|
|
117
|
+
this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._currentCustomDrag = null, this.isDragging = !1, this._currentBb = null, this._resetStartTarget(), this._instance.enableEvents(), this._instance.dragInObjectEnd();
|
|
118
|
+
}
|
|
119
|
+
dragStart(t, s, e) {
|
|
120
|
+
this._instance.disableEvents(), this._startTarget = s.target;
|
|
121
|
+
const r = (i, n) => {
|
|
122
|
+
this._dragStart(t, n, e);
|
|
123
|
+
};
|
|
124
|
+
this._currentCustomDrag = T(s) ? new S(
|
|
125
|
+
G,
|
|
126
|
+
{
|
|
127
|
+
onTouchDragStart: r
|
|
128
|
+
},
|
|
129
|
+
p(s, this._options)
|
|
130
|
+
) : new X(
|
|
131
|
+
{
|
|
132
|
+
onCustomDragStart: (i) => this._dragStart(t, i, e)
|
|
133
|
+
},
|
|
134
|
+
p(s, this._options)
|
|
135
|
+
), this._currentCustomDrag.onStart(s);
|
|
136
|
+
}
|
|
137
|
+
dragEnd() {
|
|
138
|
+
this._dragEnd();
|
|
139
|
+
}
|
|
140
|
+
dragUpdate(t) {
|
|
141
|
+
this._dragUpdate(t);
|
|
142
|
+
}
|
|
143
|
+
touchStart(t, s, e = "rml_id") {
|
|
144
|
+
this.dragStart(t, s, e);
|
|
145
|
+
}
|
|
146
|
+
touchMove(t) {
|
|
147
|
+
this.dragUpdate(t);
|
|
148
|
+
}
|
|
149
|
+
touchEnd() {
|
|
150
|
+
this.dragEnd();
|
|
151
|
+
}
|
|
152
|
+
dispose() {
|
|
153
|
+
}
|
|
154
|
+
_resetStartTarget() {
|
|
155
|
+
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));
|
|
156
|
+
}
|
|
157
|
+
releaseInput(t) {
|
|
158
|
+
this._currentCustomDrag && this._currentCustomDrag.onEnd(), this._resetStartTarget();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
M as DragInFromCustomViewStrategy
|
|
163
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as t,e,T as r,i as s,b as a,c as i,d as n}from"./touch-drag-B5zCf87J.mjs";import{f as o,e as h,d as g}from"./drag-in-DTA1FCDc.mjs";const _=t=>{t.preventDefault(),t.stopPropagation()};class l{_startX=0;_startY=0;_lastX=0;_lastY=0;_epsilon;_isWaiting=!1;_onCustomDragStart;constructor({onCustomDragStart:e},r={}){this._epsilon="number"==typeof r.epsilon?r.epsilon:t,this._onCustomDragStart=e}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=(e,r)=>{const o=s(e),h={delay:o?i:n,epsilon:o?a:t};if(!r)return h;if(!(o||e instanceof MouseEvent))return h;const{delayKey:g,epsilonKey:_}=o?{delayKey:"touchDragDelay",epsilonKey:"touchDragEpsilon"}:{delayKey:"customDragDelay",epsilonKey:"customDragEpsilon"};return"number"==typeof r[g]&&(h.delay=r.touchDragDelay),"number"==typeof r[_]&&(h.epsilon=r.touchDragEpsilon),h};class d{_options={};_instance;_mainDomElement;_viewName;_currentCustomDrag=null;_currentBb=null;_startTarget=null;_onBeforeUpdateDrag=()=>({});isDragging=!1;constructor(t,e,r){this._instance=t,this._options=e||{},this._viewName=r,this._mainDomElement=mainDomElement,this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}async _dragStart(t,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}=e(r),o=this._currentBb.x+i,h=this._currentBb.y+n;this.isDragging=!0,this._instance.dragInObject(t,o,h,s)}_dragUpdate(t){if(document.body.focus(),this._currentCustomDrag&&this._currentCustomDrag.onMove(t),!this._currentBb||!this.isDragging)return;const{clientX:r,clientY:s}=e(t),{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,e,a){this._instance.disableEvents(),this._startTarget=e.target,this._currentCustomDrag=s(e)?new r(void 0,{onTouchDragStart:(e,r)=>{this._dragStart(t,r,a)}},c(e,this._options)):new l({onCustomDragStart:e=>this._dragStart(t,e,a)},c(e,this._options)),this._currentCustomDrag.onStart(e)}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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as t,e,a as n,i as s,T as i}from"./touch-drag-B5zCf87J.mjs";import{R as a,a as o,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"./drag-in-DTA1FCDc.mjs";const p=(t,e,n=0,s=0)=>{const i=e.x+e.width+n,a=e.x-n,o=e.y+e.height+s,r=e.y-s,{x:h,y:g}=t;return h>=a&&h<=i&&g>=r&&g<=o},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(o)){const t=document.createElement("style");t.type="text/css",t.id=o,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(a);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=a,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(a);if(!s)return;let i=n.ghost?.width,o=n.ghost?.height;typeof i>"u"&&(i=s.getBoundingClientRect().width||d),typeof o>"u"&&(o=s.getBoundingClientRect().height||l);const r=t-i/2,h=e-o/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(a);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,a="rml_id"){const o=this._mainDomElement.parentNode;if("relative"!==t(o).position)return;this._mainDomElement.style.pointerEvents="none";let r=o.querySelector("."+u);r||(r=document.createElement("div"),r.classList.add(u),o.appendChild(r)),r.classList.remove(_.DISPLAY_NONE),i.target.getAttribute("draggable");const h=o.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(o,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,a)}dragUpdate(t){const i=this._mainDomElement.parentNode,{x:a,y:o}=n(i,t,this._firefoxDragPosition);if(0===a&&0===o)return;const r=Math.max(1,a),h=Math.max(1,o);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};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { g as b, e as I, a as A, i as F, T as M } from "./touch-drag-DXJTOrk5.mjs";
|
|
2
|
+
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 "./drag-in-DuufO5eB.mjs";
|
|
3
|
+
const S = (r, n, t = 0, e = 0) => {
|
|
4
|
+
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;
|
|
5
|
+
return h >= i && h <= s && g >= o && g <= a;
|
|
6
|
+
}, v = (r, n, t, e = 0, s = 0) => {
|
|
7
|
+
if (!(!t || !t.hiddenIn && !t.visibleIn))
|
|
8
|
+
return t.visibleIn ? S(
|
|
9
|
+
{ x: r, y: n },
|
|
10
|
+
t.visibleIn,
|
|
11
|
+
e,
|
|
12
|
+
s
|
|
13
|
+
) : t.hiddenIn ? !S(
|
|
14
|
+
{ x: r, y: n },
|
|
15
|
+
t.hiddenIn,
|
|
16
|
+
-e,
|
|
17
|
+
-s
|
|
18
|
+
) : !1;
|
|
19
|
+
}, B = () => {
|
|
20
|
+
if (!!!document.getElementById(E)) {
|
|
21
|
+
const n = document.createElement("style");
|
|
22
|
+
n.type = "text/css", n.id = E, n.innerHTML = `
|
|
23
|
+
${C}
|
|
24
|
+
${N}
|
|
25
|
+
`, document.head.appendChild(n);
|
|
26
|
+
}
|
|
27
|
+
}, Y = ({ x: r, y: n }, t) => {
|
|
28
|
+
let e = document.getElementById(m);
|
|
29
|
+
if (!e) {
|
|
30
|
+
if (e = document.createElement("div"), t.ghost?.element)
|
|
31
|
+
e.appendChild(t.ghost.element);
|
|
32
|
+
else {
|
|
33
|
+
const s = document.createElement("img");
|
|
34
|
+
s.src = t.ghost?.url || O, s.width = t.ghost?.width || R, s.height = t.ghost?.height || T, e.appendChild(s);
|
|
35
|
+
}
|
|
36
|
+
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(
|
|
37
|
+
r,
|
|
38
|
+
n,
|
|
39
|
+
t.ghost || {},
|
|
40
|
+
t.settings?.dragInOverlapX,
|
|
41
|
+
t.settings?.dragInOverlapY
|
|
42
|
+
) || (e.style.display = "none"), e.style.pointerEvents = "none", document.body.appendChild(e);
|
|
43
|
+
}
|
|
44
|
+
}, H = ({ x: r, y: n }, t) => {
|
|
45
|
+
const e = document.getElementById(m);
|
|
46
|
+
if (!e)
|
|
47
|
+
return;
|
|
48
|
+
let s = t.ghost?.width, i = t.ghost?.height;
|
|
49
|
+
typeof s > "u" && (s = e.getBoundingClientRect().width || R), typeof i > "u" && (i = e.getBoundingClientRect().height || T);
|
|
50
|
+
const a = r - s / 2, o = n - i / 2;
|
|
51
|
+
e.style.transform = `translate3d(${a}px, ${o}px, 0)`, t.ghost && (v(
|
|
52
|
+
r,
|
|
53
|
+
n,
|
|
54
|
+
t.ghost,
|
|
55
|
+
t.settings?.dragInOverlapX,
|
|
56
|
+
t.settings?.dragInOverlapY
|
|
57
|
+
) ? e.style.animation != G && (e.style.animation = G) : e.style.animation != p && (e.style.animation = p));
|
|
58
|
+
};
|
|
59
|
+
class U {
|
|
60
|
+
_dragGhostAnimationFrameId = null;
|
|
61
|
+
_dragGhostRemoveAnimationFrameId = null;
|
|
62
|
+
_dragGhostElement = null;
|
|
63
|
+
constructor(n = null) {
|
|
64
|
+
this._dragGhostElement = n;
|
|
65
|
+
}
|
|
66
|
+
updateDragGhost(n, t, e) {
|
|
67
|
+
this._dragGhostRemoveAnimationFrameId && (cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId), this._dragGhostRemoveAnimationFrameId = null), !e.ghost?.external && e.ghost && (this._dragGhostAnimationFrameId || (this._dragGhostAnimationFrameId = requestAnimationFrame(() => {
|
|
68
|
+
B();
|
|
69
|
+
const s = { x: n, y: t };
|
|
70
|
+
!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;
|
|
71
|
+
})));
|
|
72
|
+
}
|
|
73
|
+
removeDragGhost() {
|
|
74
|
+
this._dragGhostAnimationFrameId && (cancelAnimationFrame(this._dragGhostAnimationFrameId), this._dragGhostAnimationFrameId = null), this._dragGhostRemoveAnimationFrameId || (this._dragGhostRemoveAnimationFrameId = requestAnimationFrame(() => {
|
|
75
|
+
const n = document.getElementById(m);
|
|
76
|
+
n && document.body.removeChild(n), this._dragGhostRemoveAnimationFrameId = null;
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
class k {
|
|
81
|
+
_options = {};
|
|
82
|
+
_instance;
|
|
83
|
+
_mainDomElement;
|
|
84
|
+
_currentDrag = {};
|
|
85
|
+
_currentTouch = null;
|
|
86
|
+
_firefoxDragPosition = { x: 0, y: 0 };
|
|
87
|
+
_onBeforeUpdateDrag = () => ({});
|
|
88
|
+
isDragging = !1;
|
|
89
|
+
_firefoxFallback = (n) => {
|
|
90
|
+
if (!this._currentDrag.event)
|
|
91
|
+
return;
|
|
92
|
+
n.preventDefault();
|
|
93
|
+
const t = n || window.event;
|
|
94
|
+
this._firefoxDragPosition.x = t.pageX || 0, this._firefoxDragPosition.y = t.pageY || 0;
|
|
95
|
+
};
|
|
96
|
+
constructor(n, t, e) {
|
|
97
|
+
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", () => {
|
|
98
|
+
this._instance.cancelDragIn();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
beforeUpdateGhost(n) {
|
|
102
|
+
this._onBeforeUpdateDrag = n;
|
|
103
|
+
}
|
|
104
|
+
dragStart(n, t, e = "rml_id") {
|
|
105
|
+
const s = this._mainDomElement.parentNode;
|
|
106
|
+
if (b(s).position !== "relative") {
|
|
107
|
+
console.warn(
|
|
108
|
+
"Parent of iframe should have position relative, otherwise drag-in can not detect the x/y coordinates correctly"
|
|
109
|
+
);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this._mainDomElement.style.pointerEvents = "none";
|
|
113
|
+
let a = s.querySelector(
|
|
114
|
+
"." + y
|
|
115
|
+
);
|
|
116
|
+
a || (a = document.createElement("div"), a.classList.add(y), s.appendChild(a)), a.classList.remove(x.DISPLAY_NONE), t.target.getAttribute("draggable") || console.warn(
|
|
117
|
+
`Draggable not detected correctly! Did you add draggable="true" to the element? In Sarafi only 'draggable' is too less`
|
|
118
|
+
);
|
|
119
|
+
const h = s.querySelector(
|
|
120
|
+
"." + w
|
|
121
|
+
);
|
|
122
|
+
this._currentDrag.event = t;
|
|
123
|
+
const g = t.target, c = g.cloneNode(!0), l = g.getBoundingClientRect();
|
|
124
|
+
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 });
|
|
125
|
+
const { clientX: d, clientY: u } = I(
|
|
126
|
+
t,
|
|
127
|
+
this._firefoxDragPosition
|
|
128
|
+
);
|
|
129
|
+
this._currentDrag.offset.x = d - l.left, this._currentDrag.offset.y = u - l.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(h, 0, 0);
|
|
130
|
+
const { x: f, y: _ } = A(
|
|
131
|
+
s,
|
|
132
|
+
this._currentDrag.event || t,
|
|
133
|
+
this._firefoxDragPosition
|
|
134
|
+
), D = Math.max(1, f), L = Math.max(1, _);
|
|
135
|
+
this.isDragging = !0, this._instance.dragInObject(n, D, L, e);
|
|
136
|
+
}
|
|
137
|
+
dragUpdate(n) {
|
|
138
|
+
const t = this._mainDomElement.parentNode, { x: e, y: s } = A(t, n, this._firefoxDragPosition);
|
|
139
|
+
if (e === 0 && s === 0)
|
|
140
|
+
return;
|
|
141
|
+
const i = Math.max(1, e), a = Math.max(1, s);
|
|
142
|
+
if (i === 1 && a === 1)
|
|
143
|
+
return;
|
|
144
|
+
let o = i, h = a;
|
|
145
|
+
if (F(n)) {
|
|
146
|
+
const _ = this._options.settings?.fingerSize || 0;
|
|
147
|
+
o = Math.max(2, i + _), h = Math.max(2, a - _);
|
|
148
|
+
}
|
|
149
|
+
const {
|
|
150
|
+
x: g,
|
|
151
|
+
y: c,
|
|
152
|
+
options: l
|
|
153
|
+
} = this._onBeforeUpdateDrag(o, h, {}), d = l || { settings: {}, ghost: {} };
|
|
154
|
+
d.ghost || (d.ghost = {}), d.ghost.visibleIn && d.ghost.hiddenIn || (d.ghost.hiddenIn = this._mainDomElement.getBoundingClientRect());
|
|
155
|
+
const u = typeof g == "number" ? g : o, f = typeof c == "number" ? c : h;
|
|
156
|
+
if (this._currentDrag.ghost) {
|
|
157
|
+
const { clientX: _, clientY: D } = I(
|
|
158
|
+
n,
|
|
159
|
+
this._firefoxDragPosition
|
|
160
|
+
);
|
|
161
|
+
this._currentDrag.ghost.updateDragGhost(_, D, d);
|
|
162
|
+
}
|
|
163
|
+
this._instance.updateDrag(u, f, {});
|
|
164
|
+
}
|
|
165
|
+
dragEnd() {
|
|
166
|
+
this._mainDomElement.style.pointerEvents = "all";
|
|
167
|
+
const n = this._mainDomElement.parentNode;
|
|
168
|
+
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 };
|
|
169
|
+
const t = n.querySelector(
|
|
170
|
+
"." + y
|
|
171
|
+
);
|
|
172
|
+
t && t.classList.add(x.DISPLAY_NONE);
|
|
173
|
+
}
|
|
174
|
+
touchStart(n, t, e = "rml_id") {
|
|
175
|
+
t.preventDefault();
|
|
176
|
+
const s = (a, o) => {
|
|
177
|
+
this.dragStart(n, o, e);
|
|
178
|
+
}, i = {};
|
|
179
|
+
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(
|
|
180
|
+
void 0,
|
|
181
|
+
{
|
|
182
|
+
onTouchDragStart: s
|
|
183
|
+
},
|
|
184
|
+
i
|
|
185
|
+
), this._currentTouch.onStart(t);
|
|
186
|
+
}
|
|
187
|
+
touchMove(n) {
|
|
188
|
+
this._currentTouch && this._currentTouch.onMove(n), this._currentDrag.event && this.dragUpdate(n);
|
|
189
|
+
}
|
|
190
|
+
touchEnd() {
|
|
191
|
+
this._currentTouch && this._currentTouch.onEnd(), this._currentTouch = null, this.dragEnd();
|
|
192
|
+
}
|
|
193
|
+
dispose() {
|
|
194
|
+
document.removeEventListener("dragover", this._firefoxFallback);
|
|
195
|
+
}
|
|
196
|
+
releaseInput(n) {
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
export {
|
|
200
|
+
k as DragInFromWebsiteStrategy
|
|
201
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "5.25.0-alpha.
|
|
3
|
+
"version": "5.25.0-alpha.10",
|
|
4
4
|
"description": "This is a small library which can be used to communicate with the Roomle Configurator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./roomle-embedding-lib.umd.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createCatalog: (articleCatalog: HTMLElement, draggable?: boolean) => Promise<void>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
enableArrangementCorrection: boolean;
|
|
3
|
+
uiConfiguration: {
|
|
4
|
+
userRight: string;
|
|
5
|
+
materialAttributes: string[];
|
|
6
|
+
attributesVisibleInPlanner: string[];
|
|
7
|
+
attributeGroupsVisibleInPlanner: any[];
|
|
8
|
+
showPossibleSubModules: boolean;
|
|
9
|
+
animatedOpenClose: boolean;
|
|
10
|
+
showThumbnails: boolean;
|
|
11
|
+
};
|
|
12
|
+
materialConfiguration: {
|
|
13
|
+
defaultMaterial: string;
|
|
14
|
+
replaceUnmappedMaterialsWithDefault: boolean;
|
|
15
|
+
materialMapping: {
|
|
16
|
+
materialName: string;
|
|
17
|
+
materialId: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
debugConfiguration: {
|
|
21
|
+
createDebugGeometry: boolean;
|
|
22
|
+
};
|
|
23
|
+
tecConfigInfo: {
|
|
24
|
+
baseUrlDebug: string;
|
|
25
|
+
/**
|
|
26
|
+
* If you do not want to use the proxy provided by Roomle
|
|
27
|
+
* uncomment the next three lines and comment the line
|
|
28
|
+
* which has the Roomle proxy URL in it.
|
|
29
|
+
* BE AWARE: That the example url dfteccdeveu01-app.azurewebsites.net
|
|
30
|
+
* only works if you requesting from localhost:3100 otherwise you
|
|
31
|
+
* will have CORS issues
|
|
32
|
+
*/
|
|
33
|
+
/** comment this line if you do not want to use the Roomle proxy */
|
|
34
|
+
baseUrl: string;
|
|
35
|
+
om: {
|
|
36
|
+
subscriptionId: string;
|
|
37
|
+
key: string;
|
|
38
|
+
importBaseUrl: string;
|
|
39
|
+
};
|
|
40
|
+
libraryId: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RoomDesignerApiType } from './overlay';
|
|
2
|
+
|
|
3
|
+
export declare const GROUP_SELECTION_STR = "Group selection";
|
|
4
|
+
export declare const getOverlayDomElement: () => HTMLElement;
|
|
5
|
+
export declare const positionOverlay: (roomDesignerApi: RoomDesignerApiType) => Promise<void>;
|
|
6
|
+
export declare const showOverlay: () => void;
|
|
7
|
+
export declare const hideOverlay: () => void;
|
|
8
|
+
export declare const addShadow: (roomDesignerApi: RoomDesignerApiType) => Promise<void>;
|
|
9
|
+
export declare const removeShadow: () => void;
|
|
10
|
+
export declare const currentSelectionType: (selectionPayload: any) => "Group selection" | "Unknown selection type" | "Root module selection" | "Sub module selection";
|
|
11
|
+
export declare const showItemSelectionWarning: (roomDesignerApi: RoomDesignerApiType) => Promise<void>;
|
|
12
|
+
export declare const showCustomItemSelectionView: (state: any, roomDesignerApi: RoomDesignerApiType) => Promise<void>;
|
|
13
|
+
export declare const showCustomCatalogView: (roomDesignerApi: RoomDesignerApiType) => Promise<void>;
|