aptechka 0.86.0 → 0.87.1

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.
@@ -1,4 +1,4 @@
1
- "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var _dummyElement,_CSSUnitParser_instances,createDummy_fn;const _CSSUnitParser=class _CSSUnitParser{constructor(){__privateAdd(this,_CSSUnitParser_instances);__privateAdd(this,_dummyElement,null)}parse(value){__privateMethod(this,_CSSUnitParser_instances,createDummy_fn).call(this),__privateGet(this,_dummyElement).style.left=value;const computedWidth=getComputedStyle(__privateGet(this,_dummyElement)).getPropertyValue("left");return parseFloat(computedWidth)}};_dummyElement=new WeakMap,_CSSUnitParser_instances=new WeakSet,createDummy_fn=__name(function(){__privateGet(this,_dummyElement)||(__privateSet(this,_dummyElement,document.createElement("div")),__privateGet(this,_dummyElement).style.cssText=`
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var _dummyElement,_CSSUnitParser_instances,createDummy_fn;const _CSSUnitParser=class _CSSUnitParser{constructor(){__privateAdd(this,_CSSUnitParser_instances);__privateAdd(this,_dummyElement,null)}parse(value){if(!value)return;__privateMethod(this,_CSSUnitParser_instances,createDummy_fn).call(this),__privateGet(this,_dummyElement).style.left=value;const computedWidth=getComputedStyle(__privateGet(this,_dummyElement)).getPropertyValue("left");return parseFloat(computedWidth)}};_dummyElement=new WeakMap,_CSSUnitParser_instances=new WeakSet,createDummy_fn=__name(function(){__privateGet(this,_dummyElement)||(__privateSet(this,_dummyElement,document.createElement("div")),__privateGet(this,_dummyElement).style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -1,6 +1,6 @@
1
1
  declare class CSSUnitParser {
2
2
  #private;
3
- parse(value: string): number;
3
+ parse(value?: string): number | undefined;
4
4
  }
5
5
  export declare const cssUnitParser: CSSUnitParser;
6
6
  export {};
@@ -12,8 +12,12 @@ const _CSSUnitParser = class _CSSUnitParser {
12
12
  __privateAdd(this, _dummyElement, null);
13
13
  }
14
14
  parse(value) {
15
+ if (!value)
16
+ return;
15
17
  __privateMethod(this, _CSSUnitParser_instances, createDummy_fn).call(this), __privateGet(this, _dummyElement).style.left = value;
16
- const computedWidth = getComputedStyle(__privateGet(this, _dummyElement)).getPropertyValue("left");
18
+ const computedWidth = getComputedStyle(__privateGet(this, _dummyElement)).getPropertyValue(
19
+ "left"
20
+ );
17
21
  return parseFloat(computedWidth);
18
22
  }
19
23
  };
package/lib/en3/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const order_index=require("../order/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs");require("construct-style-sheets-polyfill");const windowResizer_index=require("../window-resizer/index.cjs"),three=require("three"),layoutBox_index=require("../layout-box/index.cjs"),_function=require("../function-H4b_gTg6.cjs");var _layoutBox,_planes,_tickListener;const _En3Clip=class _En3Clip{constructor(material,elementOrSelector){__privateAdd(this,_layoutBox,null);__privateAdd(this,_planes,[]);__privateAdd(this,_tickListener,__name(()=>{const scrollValueX=__privateGet(this,_layoutBox).position.x-__privateGet(this,_layoutBox).left,scrollValueY=__privateGet(this,_layoutBox).position.y-__privateGet(this,_layoutBox).top;__privateGet(this,_planes)[0].constant=__privateGet(this,_layoutBox).scale.y/2+scrollValueY*-1,__privateGet(this,_planes)[1].constant=__privateGet(this,_layoutBox).scale.y/2+scrollValueY,__privateGet(this,_planes)[2].constant=__privateGet(this,_layoutBox).scale.x/2+scrollValueX,__privateGet(this,_planes)[3].constant=__privateGet(this,_layoutBox).scale.x/2+scrollValueX*-1},"#tickListener"));__privateSet(this,_layoutBox,new layoutBox_index.LayoutBox(elementOrSelector,{cartesian:!1})),__privateSet(this,_planes,[new three.Plane(new three.Vector3(0,-1,0)),new three.Plane(new three.Vector3(0,1,0)),new three.Plane(new three.Vector3(-1,0,0)),new three.Plane(new three.Vector3(1,0,0))]),material.clippingPlanes=__privateGet(this,_planes),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX})}get planes(){return __privateGet(this,_planes)}get layoutBox(){return __privateGet(this,_layoutBox)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),__privateGet(this,_layoutBox).destroy()}};_layoutBox=new WeakMap,_planes=new WeakMap,_tickListener=new WeakMap,__name(_En3Clip,"En3Clip");let En3Clip=_En3Clip;function dispose(object3d){const cleanMaterial=__name(material=>{material.dispose();for(const key of Object.keys(material)){const value=material[key];value&&typeof value=="object"&&"minFilter"in value&&value.dispose()}},"cleanMaterial");object3d.traverse(object=>{if(object instanceof three.Mesh){if(object.geometry.dispose(),!Array.isArray(object.material)&&object.material.isMaterial)cleanMaterial(object.material);else if(Array.isArray(object.material))for(const material of object.material)cleanMaterial(material)}})}__name(dispose,"dispose");var _en3,_name,_camera,_scene,_attachedObjects,_cameraDistance,_cameraFov,_sizeElement,_box,_debouncedResize;const _En3View=class _En3View{constructor(en3,name,options){__privateAdd(this,_en3);__privateAdd(this,_name);__privateAdd(this,_camera);__privateAdd(this,_scene);__privateAdd(this,_attachedObjects);__privateAdd(this,_cameraDistance);__privateAdd(this,_cameraFov);__privateAdd(this,_sizeElement);__privateAdd(this,_box);__privateAdd(this,_debouncedResize,_function.debounce(()=>{this.resize()},0));__privateSet(this,_en3,en3),__privateSet(this,_name,name),__privateSet(this,_camera,(options==null?void 0:options.cameraType)==="orthographic"?new three.OrthographicCamera:new three.PerspectiveCamera),__privateSet(this,_scene,new three.Scene),__privateSet(this,_attachedObjects,[]),__privateSet(this,_cameraDistance,(options==null?void 0:options.cameraDistance)||1e3),__privateGet(this,_camera).near=(options==null?void 0:options.cameraNear)||1,__privateGet(this,_camera).far=(options==null?void 0:options.cameraFar)||11e3,__privateSet(this,_cameraFov,(options==null?void 0:options.cameraFov)||"auto"),__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance),__privateGet(this,_camera).name=`Cameras.${__privateGet(this,_name)}`,__privateSet(this,_sizeElement,dom.getElement(options==null?void 0:options.sizeElement)||document.documentElement),this.beforeRenderCallback=options==null?void 0:options.beforeRender,__privateSet(this,_box,new layoutBox_index.LayoutBox(__privateGet(this,_sizeElement))),__privateGet(this,_box).onResize(()=>{this.resize()})}get name(){return __privateGet(this,_name)}get camera(){return __privateGet(this,_camera)}get scene(){return __privateGet(this,_scene)}get box(){return __privateGet(this,_box)}get cameraDistance(){return __privateGet(this,_cameraDistance)}set cameraDistance(value){__privateSet(this,_cameraDistance,value),__privateGet(this,_debouncedResize).call(this)}set fov(value){__privateSet(this,_cameraFov,value),__privateGet(this,_debouncedResize).call(this)}get fov(){return __privateGet(this,_cameraFov)}set near(value){__privateGet(this,_camera).near=value,__privateGet(this,_debouncedResize).call(this)}get near(){return __privateGet(this,_camera).near}set far(value){__privateGet(this,_camera).far=value,__privateGet(this,_debouncedResize).call(this)}get far(){return __privateGet(this,_camera).far}get sizeElement(){return __privateGet(this,_sizeElement)}get isClipped(){return __privateGet(this,_sizeElement)!==__privateGet(this,_en3).containerElement}resize(){const{width,height}=__privateGet(this,_box);__privateGet(this,_camera).userData.controlled||(__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance)),__privateGet(this,_camera)instanceof three.PerspectiveCamera?(__privateGet(this,_camera).aspect=width/height,__privateGet(this,_camera).fov=__privateGet(this,_cameraFov)==="auto"?2*Math.atan(height/2/__privateGet(this,_cameraDistance))*(180/Math.PI):__privateGet(this,_camera).userData.controlled?__privateGet(this,_camera).fov:__privateGet(this,_cameraFov)):__privateGet(this,_camera)instanceof three.OrthographicCamera&&(__privateGet(this,_camera).left=width/-2,__privateGet(this,_camera).right=width/2,__privateGet(this,_camera).top=height/2,__privateGet(this,_camera).bottom=height/-2),__privateGet(this,_camera).updateProjectionMatrix()}destroy(){__privateGet(this,_attachedObjects).forEach(object=>{object.userData.box.destroy()}),__privateGet(this,_scene).clear(),dispose(__privateGet(this,_scene)),__privateGet(this,_en3).destroyView(this.name),__privateGet(this,_box).destroy()}attachToHTMLElement(element,object,options){const box=new layoutBox_index.LayoutBox(element,__spreadProps(__spreadValues({},options),{containerElement:__privateGet(this,_sizeElement),cartesian:!0,scrollStep:!this.isClipped}));if(box.bindObject(object),object.userData.box=box,options!=null&&options.clip&&"material"in object){const clip=new En3Clip(object.material,element);object.userData.clip=clip}return __privateGet(this,_attachedObjects).push(object),object}detachFromHTMLElement(object){__privateSet(this,_attachedObjects,__privateGet(this,_attachedObjects).filter(o=>{if(o===object){const{box,clip}=object.userData;return box.destroy(),clip==null||clip.destroy(),!1}return!0}))}add(...args){const object=args[0],element=args[1],options=args[2];return element&&this.attachToHTMLElement(element,object,options),this.scene.add(object),object}remove(object,detach){this.scene.remove(object),detach&&this.detachFromHTMLElement(object)}};_en3=new WeakMap,_name=new WeakMap,_camera=new WeakMap,_scene=new WeakMap,_attachedObjects=new WeakMap,_cameraDistance=new WeakMap,_cameraFov=new WeakMap,_sizeElement=new WeakMap,_box=new WeakMap,_debouncedResize=new WeakMap,__name(_En3View,"En3View");let En3View=_En3View;var _CDNVersion,_containerElement,_webglRenderer,_views,_width,_height,_pixelRatio,_maxPixelRatio,_isCreated,_composer,_resizeListener,_tickListener2;const _En3=class _En3{constructor(){__privateAdd(this,_CDNVersion,`https://unpkg.com/three@0.${three.REVISION}.x`);__privateAdd(this,_containerElement,null);__privateAdd(this,_webglRenderer,null);__privateAdd(this,_views,new Map);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_pixelRatio,0);__privateAdd(this,_maxPixelRatio,2);__privateAdd(this,_isCreated,!1);__privateAdd(this,_composer,null);__privateAdd(this,_resizeListener,__name(e=>{e instanceof CustomEvent||(__privateSet(this,_width,__privateGet(this,_containerElement).clientWidth),__privateSet(this,_height,__privateGet(this,_containerElement).clientHeight),__privateSet(this,_pixelRatio,Math.min(__privateGet(this,_maxPixelRatio),devicePixelRatio||1)),__privateGet(this,_webglRenderer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_webglRenderer).setSize(__privateGet(this,_width),__privateGet(this,_height)),__privateGet(this,_composer)&&(__privateGet(this,_composer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_composer).setSize(__privateGet(this,_width),__privateGet(this,_height))))},"#resizeListener"));__privateAdd(this,_tickListener2,__name(()=>{__privateGet(this,_webglRenderer).setRenderTarget(null),__privateGet(this,_views).forEach(view=>{this.render(view)})},"#tickListener"))}get CDNVersion(){return __privateGet(this,_CDNVersion)}get containerElement(){return __privateGet(this,_containerElement)}get webglRenderer(){return __privateGet(this,_webglRenderer)}get views(){return __privateGet(this,_views)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get pixelRatio(){return __privateGet(this,_pixelRatio)}get composer(){return __privateGet(this,_composer)}setup(options){if(__privateGet(this,_isCreated))return;__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_maxPixelRatio,(options==null?void 0:options.maxPixelRatio)||2),__privateSet(this,_webglRenderer,new three.WebGLRenderer(options==null?void 0:options.webGLRendererParameters)),__privateGet(this,_webglRenderer).domElement.style.cssText=`
1
+ "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const order_index=require("../order/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs");require("construct-style-sheets-polyfill");const windowResizer_index=require("../window-resizer/index.cjs"),three=require("three"),layoutBox_index=require("../layout-box/index.cjs"),_function=require("../function-H4b_gTg6.cjs");var _layoutBox,_planes,_tickListener;const _En3Clip=class _En3Clip{constructor(material,elementOrSelector){__privateAdd(this,_layoutBox,null);__privateAdd(this,_planes,[]);__privateAdd(this,_tickListener,__name(()=>{const scrollValueX=__privateGet(this,_layoutBox).position.x,scrollValueY=__privateGet(this,_layoutBox).position.y;__privateGet(this,_planes)[0].constant=-scrollValueY+__privateGet(this,_layoutBox).scale.y/2,__privateGet(this,_planes)[1].constant=scrollValueY+__privateGet(this,_layoutBox).scale.y/2,__privateGet(this,_planes)[2].constant=scrollValueX+__privateGet(this,_layoutBox).scale.x/2,__privateGet(this,_planes)[3].constant=-scrollValueX+__privateGet(this,_layoutBox).scale.x/2},"#tickListener"));__privateSet(this,_layoutBox,new layoutBox_index.LayoutBox(elementOrSelector,{cartesian:!0})),__privateSet(this,_planes,[new three.Plane(new three.Vector3(0,1,0)),new three.Plane(new three.Vector3(0,-1,0)),new three.Plane(new three.Vector3(-1,0,0)),new three.Plane(new three.Vector3(1,0,0))]),material.clippingPlanes=__privateGet(this,_planes),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX})}get planes(){return __privateGet(this,_planes)}get layoutBox(){return __privateGet(this,_layoutBox)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),__privateGet(this,_layoutBox).destroy()}};_layoutBox=new WeakMap,_planes=new WeakMap,_tickListener=new WeakMap,__name(_En3Clip,"En3Clip");let En3Clip=_En3Clip;function dispose(object3d){const cleanMaterial=__name(material=>{material.dispose();for(const key of Object.keys(material)){const value=material[key];value&&typeof value=="object"&&"minFilter"in value&&value.dispose()}},"cleanMaterial");object3d.traverse(object=>{if(object instanceof three.Mesh){if(object.geometry.dispose(),!Array.isArray(object.material)&&object.material.isMaterial)cleanMaterial(object.material);else if(Array.isArray(object.material))for(const material of object.material)cleanMaterial(material)}})}__name(dispose,"dispose");var _en3,_name,_camera,_scene,_attachedObjects,_cameraDistance,_cameraFov,_sizeElement,_box,_debouncedResize;const _En3View=class _En3View{constructor(en3,name,options){__privateAdd(this,_en3);__privateAdd(this,_name);__privateAdd(this,_camera);__privateAdd(this,_scene);__privateAdd(this,_attachedObjects);__privateAdd(this,_cameraDistance);__privateAdd(this,_cameraFov);__privateAdd(this,_sizeElement);__privateAdd(this,_box);__privateAdd(this,_debouncedResize,_function.debounce(()=>{this.resize()},0));__privateSet(this,_en3,en3),__privateSet(this,_name,name),__privateSet(this,_camera,(options==null?void 0:options.cameraType)==="orthographic"?new three.OrthographicCamera:new three.PerspectiveCamera),__privateSet(this,_scene,new three.Scene),__privateSet(this,_attachedObjects,[]),__privateSet(this,_cameraDistance,(options==null?void 0:options.cameraDistance)||1e3),__privateGet(this,_camera).near=(options==null?void 0:options.cameraNear)||1,__privateGet(this,_camera).far=(options==null?void 0:options.cameraFar)||11e3,__privateSet(this,_cameraFov,(options==null?void 0:options.cameraFov)||"auto"),__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance),__privateGet(this,_camera).name=`Cameras.${__privateGet(this,_name)}`,__privateSet(this,_sizeElement,dom.getElement(options==null?void 0:options.sizeElement)||document.documentElement),this.beforeRenderCallback=options==null?void 0:options.beforeRender,__privateSet(this,_box,new layoutBox_index.LayoutBox(__privateGet(this,_sizeElement))),__privateGet(this,_box).onResize(()=>{this.resize()})}get name(){return __privateGet(this,_name)}get camera(){return __privateGet(this,_camera)}get scene(){return __privateGet(this,_scene)}get box(){return __privateGet(this,_box)}get cameraDistance(){return __privateGet(this,_cameraDistance)}set cameraDistance(value){__privateSet(this,_cameraDistance,value),__privateGet(this,_debouncedResize).call(this)}set fov(value){__privateSet(this,_cameraFov,value),__privateGet(this,_debouncedResize).call(this)}get fov(){return __privateGet(this,_cameraFov)}set near(value){__privateGet(this,_camera).near=value,__privateGet(this,_debouncedResize).call(this)}get near(){return __privateGet(this,_camera).near}set far(value){__privateGet(this,_camera).far=value,__privateGet(this,_debouncedResize).call(this)}get far(){return __privateGet(this,_camera).far}get sizeElement(){return __privateGet(this,_sizeElement)}get isClipped(){return __privateGet(this,_sizeElement)!==__privateGet(this,_en3).containerElement}resize(){const{width,height}=__privateGet(this,_box);__privateGet(this,_camera).userData.controlled||(__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance)),__privateGet(this,_camera)instanceof three.PerspectiveCamera?(__privateGet(this,_camera).aspect=width/height,__privateGet(this,_camera).fov=__privateGet(this,_cameraFov)==="auto"?2*Math.atan(height/2/__privateGet(this,_cameraDistance))*(180/Math.PI):__privateGet(this,_camera).userData.controlled?__privateGet(this,_camera).fov:__privateGet(this,_cameraFov)):__privateGet(this,_camera)instanceof three.OrthographicCamera&&(__privateGet(this,_camera).left=width/-2,__privateGet(this,_camera).right=width/2,__privateGet(this,_camera).top=height/2,__privateGet(this,_camera).bottom=height/-2),__privateGet(this,_camera).updateProjectionMatrix()}destroy(){__privateGet(this,_attachedObjects).forEach(object=>{object.userData.box.destroy()}),__privateGet(this,_scene).clear(),dispose(__privateGet(this,_scene)),__privateGet(this,_en3).destroyView(this.name),__privateGet(this,_box).destroy()}attachToHTMLElement(element,object,options){const box=new layoutBox_index.LayoutBox(element,__spreadProps(__spreadValues({},options),{containerElement:__privateGet(this,_sizeElement),cartesian:!0,scrollStep:!this.isClipped}));if(box.bindObject(object),object.userData.box=box,options!=null&&options.clip&&"material"in object){const clip=new En3Clip(object.material,element);object.userData.clip=clip}return __privateGet(this,_attachedObjects).push(object),object}detachFromHTMLElement(object){__privateSet(this,_attachedObjects,__privateGet(this,_attachedObjects).filter(o=>{if(o===object){const{box,clip}=object.userData;return box.destroy(),clip==null||clip.destroy(),!1}return!0}))}add(...args){const object=args[0],element=args[1],options=args[2];return element&&this.attachToHTMLElement(element,object,options),this.scene.add(object),object}remove(object,detach){this.scene.remove(object),detach&&this.detachFromHTMLElement(object)}};_en3=new WeakMap,_name=new WeakMap,_camera=new WeakMap,_scene=new WeakMap,_attachedObjects=new WeakMap,_cameraDistance=new WeakMap,_cameraFov=new WeakMap,_sizeElement=new WeakMap,_box=new WeakMap,_debouncedResize=new WeakMap,__name(_En3View,"En3View");let En3View=_En3View;var _CDNVersion,_containerElement,_webglRenderer,_views,_width,_height,_pixelRatio,_maxPixelRatio,_isCreated,_composer,_resizeListener,_tickListener2;const _En3=class _En3{constructor(){__privateAdd(this,_CDNVersion,`https://unpkg.com/three@0.${three.REVISION}.x`);__privateAdd(this,_containerElement,null);__privateAdd(this,_webglRenderer,null);__privateAdd(this,_views,new Map);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_pixelRatio,0);__privateAdd(this,_maxPixelRatio,2);__privateAdd(this,_isCreated,!1);__privateAdd(this,_composer,null);__privateAdd(this,_resizeListener,__name(e=>{e instanceof CustomEvent||(__privateSet(this,_width,__privateGet(this,_containerElement).clientWidth),__privateSet(this,_height,__privateGet(this,_containerElement).clientHeight),__privateSet(this,_pixelRatio,Math.min(__privateGet(this,_maxPixelRatio),devicePixelRatio||1)),__privateGet(this,_webglRenderer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_webglRenderer).setSize(__privateGet(this,_width),__privateGet(this,_height)),__privateGet(this,_composer)&&(__privateGet(this,_composer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_composer).setSize(__privateGet(this,_width),__privateGet(this,_height))))},"#resizeListener"));__privateAdd(this,_tickListener2,__name(()=>{__privateGet(this,_webglRenderer).setRenderTarget(null),__privateGet(this,_views).forEach(view=>{this.render(view)})},"#tickListener"))}get CDNVersion(){return __privateGet(this,_CDNVersion)}get containerElement(){return __privateGet(this,_containerElement)}get webglRenderer(){return __privateGet(this,_webglRenderer)}get views(){return __privateGet(this,_views)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get pixelRatio(){return __privateGet(this,_pixelRatio)}get composer(){return __privateGet(this,_composer)}setup(options){if(__privateGet(this,_isCreated))return;__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_maxPixelRatio,(options==null?void 0:options.maxPixelRatio)||2),__privateSet(this,_webglRenderer,new three.WebGLRenderer(options==null?void 0:options.webGLRendererParameters)),__privateGet(this,_webglRenderer).domElement.style.cssText=`
2
2
  position: ${(options==null?void 0:options.position)||"fixed"};
3
3
  left: 0;
4
4
  top: 0;
5
5
  width: 100%;
6
6
  height: 100%;
7
7
  z-index: ${(options==null?void 0:options.zIndex)||0};
8
- `,(__privateGet(this,_containerElement).shadowRoot||__privateGet(this,_containerElement)).append(__privateGet(this,_webglRenderer).domElement),__privateGet(this,_views).set("default",new En3View(this,"default",__spreadValues({sizeElement:__privateGet(this,_containerElement)},options==null?void 0:options.view))),options!=null&&options.composer&&(__privateSet(this,_composer,new options.composer(__privateGet(this,_webglRenderer))),this.render=()=>{__privateGet(this,_composer).render()}),__privateSet(this,_isCreated,!0),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.CANVAS),intersector_index.ticker.subscribe(__privateGet(this,_tickListener2),{order:order_index.TICK_ORDER.CANVAS,culling:__privateGet(this,_containerElement)})}destroy(){var _a;__privateGet(this,_isCreated)&&(windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener2)),__privateGet(this,_views).forEach(view=>{view.destroy()}),__privateGet(this,_views).clear(),__privateGet(this,_webglRenderer).dispose(),__privateGet(this,_webglRenderer).domElement.remove(),__privateSet(this,_webglRenderer,null),(_a=__privateGet(this,_composer))==null||_a.dispose(),__privateSet(this,_composer,null),__privateSet(this,_isCreated,!1))}createView(viewName,viewOptions){const size=__privateGet(this,_views).size,view=new En3View(this,viewName,viewOptions);return __privateGet(this,_views).set(viewName,view),size===1&&__privateGet(this,_webglRenderer).setScissorTest(!0),view}getView(viewName){return __privateGet(this,_views).get(viewName)}destroyView(viewName){const view=__privateGet(this,_views).get(viewName);view&&(__privateGet(this,_views).delete(viewName),view.destroy(),__privateGet(this,_views).size<=1&&__privateGet(this,_webglRenderer).setScissorTest(!1))}render(view){var _a;if(__privateGet(this,_views).size>1||this.view.isClipped){const left=view.box.left+view.box.CSSTranslation.x+view.box.scrollValue.x,top=this.height-view.box.height-view.box.top+view.box.CSSTranslation.y+view.box.scrollValue.y*-1;__privateGet(this,_webglRenderer).setScissor(left,top,view.box.width,view.box.height),__privateGet(this,_webglRenderer).setViewport(left,top,view.box.width,view.box.height)}(_a=view.beforeRenderCallback)==null||_a.call(view),__privateGet(this,_webglRenderer).render(view.scene,view.camera)}};_CDNVersion=new WeakMap,_containerElement=new WeakMap,_webglRenderer=new WeakMap,_views=new WeakMap,_width=new WeakMap,_height=new WeakMap,_pixelRatio=new WeakMap,_maxPixelRatio=new WeakMap,_isCreated=new WeakMap,_composer=new WeakMap,_resizeListener=new WeakMap,_tickListener2=new WeakMap,__name(_En3,"En3");let En3=_En3;function coverTexture(texture,planeSize,aspect){const width=planeSize.x,height=planeSize.y,_aspect=aspect||texture.image.width/texture.image.height;let sx=0,sy=0,tx=texture.offset.x,ty=texture.offset.y,r=texture.rotation,cx=texture.center.x,cy=texture.center.y;width/height>_aspect?(sx=1,sy=height/width*_aspect):(sy=1,sx=width/height/_aspect),texture.matrix.setUvTransform(tx,ty,sx,sy,r,cx,cy)}__name(coverTexture,"coverTexture");const tempTarget=new three.Vector3,position=new three.Vector3;function getCurrentViewport(en3,target,viewName="default"){const view=en3.getView(viewName),{width,height}=en3,aspect=width/height;target instanceof three.Vector3?tempTarget.copy(target):tempTarget.set(...target);const distance=view.camera.getWorldPosition(position).distanceTo(tempTarget);if(view.camera instanceof three.OrthographicCamera)return{width:width/view.camera.zoom,height:height/view.camera.zoom,factor:1,distance,aspect};{const fov=view.camera.fov*Math.PI/180,h=2*Math.tan(fov/2)*distance,w=h*(width/height);return{width:w,height:h,factor:width/w,distance,aspect}}}__name(getCurrentViewport,"getCurrentViewport");function traverseMaterials(object,callback){object.traverse(node=>{node instanceof three.Mesh&&node.material&&(Array.isArray(node.material)?node.material:[node.material]).forEach(callback)})}__name(traverseMaterials,"traverseMaterials");function traverseMeshes(object,callback){object.traverse(node=>{node instanceof three.Mesh&&callback(node)})}__name(traverseMeshes,"traverseMeshes");exports.En3=En3;exports.En3Clip=En3Clip;exports.En3View=En3View;exports.coverTexture=coverTexture;exports.dispose=dispose;exports.getCurrentViewport=getCurrentViewport;exports.traverseMaterials=traverseMaterials;exports.traverseMeshes=traverseMeshes;
8
+ `,(__privateGet(this,_containerElement).shadowRoot||__privateGet(this,_containerElement)).append(__privateGet(this,_webglRenderer).domElement),__privateGet(this,_views).set("default",new En3View(this,"default",__spreadValues({sizeElement:__privateGet(this,_containerElement)},options==null?void 0:options.view))),options!=null&&options.composer&&(__privateSet(this,_composer,new options.composer(__privateGet(this,_webglRenderer))),this.render=()=>{__privateGet(this,_composer).render()}),__privateSet(this,_isCreated,!0),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.CANVAS),intersector_index.ticker.subscribe(__privateGet(this,_tickListener2),{order:order_index.TICK_ORDER.CANVAS,culling:__privateGet(this,_containerElement)})}destroy(){var _a;__privateGet(this,_isCreated)&&(windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener2)),__privateGet(this,_views).forEach(view=>{view.destroy()}),__privateGet(this,_views).clear(),__privateGet(this,_webglRenderer).dispose(),__privateGet(this,_webglRenderer).domElement.remove(),__privateSet(this,_webglRenderer,null),(_a=__privateGet(this,_composer))==null||_a.dispose(),__privateSet(this,_composer,null),__privateSet(this,_isCreated,!1))}createView(viewName,viewOptions){const size=__privateGet(this,_views).size,view=new En3View(this,viewName,viewOptions);return __privateGet(this,_views).set(viewName,view),size===1&&__privateGet(this,_webglRenderer).setScissorTest(!0),view}getView(viewName){return __privateGet(this,_views).get(viewName)}destroyView(viewName){const view=__privateGet(this,_views).get(viewName);view&&(__privateGet(this,_views).delete(viewName),view.destroy(),__privateGet(this,_views).size<=1&&__privateGet(this,_webglRenderer).setScissorTest(!1))}render(view){var _a;if(__privateGet(this,_views).size>1||this.view.isClipped){const left=view.box.left+view.box.CSSTranslation.x+view.box.scrollValue.x,top=this.height-view.box.height-view.box.top+view.box.CSSTranslation.y+view.box.scrollValue.y*-1;__privateGet(this,_webglRenderer).setScissor(left,top,view.box.width,view.box.height),__privateGet(this,_webglRenderer).setViewport(left,top,view.box.width,view.box.height)}(_a=view.beforeRenderCallback)==null||_a.call(view),__privateGet(this,_webglRenderer).render(view.scene,view.camera)}};_CDNVersion=new WeakMap,_containerElement=new WeakMap,_webglRenderer=new WeakMap,_views=new WeakMap,_width=new WeakMap,_height=new WeakMap,_pixelRatio=new WeakMap,_maxPixelRatio=new WeakMap,_isCreated=new WeakMap,_composer=new WeakMap,_resizeListener=new WeakMap,_tickListener2=new WeakMap,__name(_En3,"En3");let En3=_En3;const _En3ClipHelpers=class _En3ClipHelpers extends three.Group{constructor(clip,size=500){super(),this.add(new three.PlaneHelper(clip.planes[0],size,16711680)),this.add(new three.PlaneHelper(clip.planes[1],size,16711680)),this.add(new three.PlaneHelper(clip.planes[2],size,16711680)),this.add(new three.PlaneHelper(clip.planes[3],size,16711680))}};__name(_En3ClipHelpers,"En3ClipHelpers");let En3ClipHelpers=_En3ClipHelpers;function coverTexture(texture,planeSize,aspect){const width=planeSize.x,height=planeSize.y,_aspect=aspect||texture.image.width/texture.image.height;let sx=0,sy=0,tx=texture.offset.x,ty=texture.offset.y,r=texture.rotation,cx=texture.center.x,cy=texture.center.y;width/height>_aspect?(sx=1,sy=height/width*_aspect):(sy=1,sx=width/height/_aspect),texture.matrix.setUvTransform(tx,ty,sx,sy,r,cx,cy)}__name(coverTexture,"coverTexture");const tempTarget=new three.Vector3,position=new three.Vector3;function getCurrentViewport(en3,target,viewName="default"){const view=en3.getView(viewName),{width,height}=en3,aspect=width/height;target instanceof three.Vector3?tempTarget.copy(target):tempTarget.set(...target);const distance=view.camera.getWorldPosition(position).distanceTo(tempTarget);if(view.camera instanceof three.OrthographicCamera)return{width:width/view.camera.zoom,height:height/view.camera.zoom,factor:1,distance,aspect};{const fov=view.camera.fov*Math.PI/180,h=2*Math.tan(fov/2)*distance,w=h*(width/height);return{width:w,height:h,factor:width/w,distance,aspect}}}__name(getCurrentViewport,"getCurrentViewport");function traverseMaterials(object,callback){object.traverse(node=>{node instanceof three.Mesh&&node.material&&(Array.isArray(node.material)?node.material:[node.material]).forEach(callback)})}__name(traverseMaterials,"traverseMaterials");function traverseMeshes(object,callback){object.traverse(node=>{node instanceof three.Mesh&&callback(node)})}__name(traverseMeshes,"traverseMeshes");exports.En3=En3;exports.En3Clip=En3Clip;exports.En3ClipHelpers=En3ClipHelpers;exports.En3View=En3View;exports.coverTexture=coverTexture;exports.dispose=dispose;exports.getCurrentViewport=getCurrentViewport;exports.traverseMaterials=traverseMaterials;exports.traverseMeshes=traverseMeshes;
@@ -1,6 +1,7 @@
1
1
  export { En3, type En3Options } from './En3';
2
2
  export { En3View, type En3AttachOptions, type En3AttachedObject3D, type En3ViewBeforeRenderCallback, type En3ViewOptions, } from './En3View';
3
3
  export { En3Clip } from './objects/En3Clip';
4
+ export { En3ClipHelpers } from './objects/En3ClipHelpers';
4
5
  export { coverTexture } from './utils/coverTexture';
5
6
  export { dispose } from './utils/dispose';
6
7
  export { getCurrentViewport } from './utils/getCurrentViewport';
package/lib/en3/index.js CHANGED
@@ -20,7 +20,7 @@ import { t as ticker } from "../index-ClTMVKJp.js";
20
20
  import { g as getElement } from "../dom-D8D-_9ty.js";
21
21
  import "construct-style-sheets-polyfill";
22
22
  import { windowResizer } from "../window-resizer/index.js";
23
- import { Plane, Vector3, Mesh, OrthographicCamera, PerspectiveCamera, Scene, REVISION, WebGLRenderer } from "three";
23
+ import { Plane, Vector3, Mesh, OrthographicCamera, PerspectiveCamera, Scene, REVISION, WebGLRenderer, Group, PlaneHelper } from "three";
24
24
  import { LayoutBox } from "../layout-box/index.js";
25
25
  import { d as debounce } from "../function-UmbPrOHm.js";
26
26
  var _layoutBox, _planes, _tickListener;
@@ -29,12 +29,12 @@ const _En3Clip = class _En3Clip {
29
29
  __privateAdd(this, _layoutBox, null);
30
30
  __privateAdd(this, _planes, []);
31
31
  __privateAdd(this, _tickListener, /* @__PURE__ */ __name(() => {
32
- const scrollValueX = __privateGet(this, _layoutBox).position.x - __privateGet(this, _layoutBox).left, scrollValueY = __privateGet(this, _layoutBox).position.y - __privateGet(this, _layoutBox).top;
33
- __privateGet(this, _planes)[0].constant = __privateGet(this, _layoutBox).scale.y / 2 + scrollValueY * -1, __privateGet(this, _planes)[1].constant = __privateGet(this, _layoutBox).scale.y / 2 + scrollValueY, __privateGet(this, _planes)[2].constant = __privateGet(this, _layoutBox).scale.x / 2 + scrollValueX, __privateGet(this, _planes)[3].constant = __privateGet(this, _layoutBox).scale.x / 2 + scrollValueX * -1;
32
+ const scrollValueX = __privateGet(this, _layoutBox).position.x, scrollValueY = __privateGet(this, _layoutBox).position.y;
33
+ __privateGet(this, _planes)[0].constant = -scrollValueY + __privateGet(this, _layoutBox).scale.y / 2, __privateGet(this, _planes)[1].constant = scrollValueY + __privateGet(this, _layoutBox).scale.y / 2, __privateGet(this, _planes)[2].constant = scrollValueX + __privateGet(this, _layoutBox).scale.x / 2, __privateGet(this, _planes)[3].constant = -scrollValueX + __privateGet(this, _layoutBox).scale.x / 2;
34
34
  }, "#tickListener"));
35
- __privateSet(this, _layoutBox, new LayoutBox(elementOrSelector, { cartesian: !1 })), __privateSet(this, _planes, [
36
- new Plane(new Vector3(0, -1, 0)),
35
+ __privateSet(this, _layoutBox, new LayoutBox(elementOrSelector, { cartesian: !0 })), __privateSet(this, _planes, [
37
36
  new Plane(new Vector3(0, 1, 0)),
37
+ new Plane(new Vector3(0, -1, 0)),
38
38
  new Plane(new Vector3(-1, 0, 0)),
39
39
  new Plane(new Vector3(1, 0, 0))
40
40
  ]), material.clippingPlanes = __privateGet(this, _planes), ticker.subscribe(__privateGet(this, _tickListener), { order: TICK_ORDER.LAYOUT_BOX });
@@ -280,6 +280,13 @@ const _En3 = class _En3 {
280
280
  };
281
281
  _CDNVersion = new WeakMap(), _containerElement = new WeakMap(), _webglRenderer = new WeakMap(), _views = new WeakMap(), _width = new WeakMap(), _height = new WeakMap(), _pixelRatio = new WeakMap(), _maxPixelRatio = new WeakMap(), _isCreated = new WeakMap(), _composer = new WeakMap(), _resizeListener = new WeakMap(), _tickListener2 = new WeakMap(), __name(_En3, "En3");
282
282
  let En3 = _En3;
283
+ const _En3ClipHelpers = class _En3ClipHelpers extends Group {
284
+ constructor(clip, size = 500) {
285
+ super(), this.add(new PlaneHelper(clip.planes[0], size, 16711680)), this.add(new PlaneHelper(clip.planes[1], size, 16711680)), this.add(new PlaneHelper(clip.planes[2], size, 16711680)), this.add(new PlaneHelper(clip.planes[3], size, 16711680));
286
+ }
287
+ };
288
+ __name(_En3ClipHelpers, "En3ClipHelpers");
289
+ let En3ClipHelpers = _En3ClipHelpers;
283
290
  function coverTexture(texture, planeSize, aspect) {
284
291
  const width = planeSize.x, height = planeSize.y, _aspect = aspect || texture.image.width / texture.image.height;
285
292
  let sx = 0, sy = 0, tx = texture.offset.x, ty = texture.offset.y, r = texture.rotation, cx = texture.center.x, cy = texture.center.y;
@@ -320,6 +327,7 @@ __name(traverseMeshes, "traverseMeshes");
320
327
  export {
321
328
  En3,
322
329
  En3Clip,
330
+ En3ClipHelpers,
323
331
  En3View,
324
332
  coverTexture,
325
333
  dispose,
@@ -0,0 +1,5 @@
1
+ import { Group } from 'three';
2
+ import { En3Clip } from './En3Clip';
3
+ export declare class En3ClipHelpers extends Group {
4
+ constructor(clip: En3Clip, size?: number);
5
+ }
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cssUnitParser_index=require("../css-unit-parser/index.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),ladder_index=require("../ladder/index.cjs"),notifier_index=require("../notifier/index.cjs"),order_index=require("../order/index.cjs"),scrollEntries_index=require("../scroll-entries/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs"),layout=require("../layout-CnGLl7oe.cjs");require("construct-style-sheets-polyfill");const windowResizer_index=require("../window-resizer/index.cjs");function decomposeCSSMatrix(matrix){const scaleX=Math.sqrt(matrix.m11*matrix.m11+matrix.m12*matrix.m12+matrix.m13*matrix.m13),scaleY=Math.sqrt(matrix.m21*matrix.m21+matrix.m22*matrix.m22+matrix.m23*matrix.m23),scaleZ=Math.sqrt(matrix.m31*matrix.m31+matrix.m32*matrix.m32+matrix.m33*matrix.m33),rotationX=Math.atan2(matrix.m32,matrix.m33),rotationY=Math.atan2(-matrix.m31,Math.sqrt(matrix.m32*matrix.m32+matrix.m33*matrix.m33)),rotationZ=Math.atan2(matrix.m21,matrix.m11),translationX=matrix.m41,translationY=matrix.m42*-1,translationZ=matrix.m43;return{scaleX,scaleY,scaleZ,rotationX,rotationY,rotationZ,translationX,translationY,translationZ}}__name(decomposeCSSMatrix,"decomposeCSSMatrix");var _element,_containerElement,_scrollStepSetterCallbacks,_scrollAxis,_frontSide,_isCartesian,_isSizeStep,_isPositionStep,_isTransformStep,_isScrollStep,_width,_height,_depth,_top,_left,_front,_x,_y,_z,_CSSTranslation,_CSSRotation,_CSSScale,_rotation,_position,_scale,_scrollValue,_scrollEntries,_resizeNotifier,_LayoutBox_instances,recalculate_fn,composeSteps_fn,updateDimensions_fn,updateScrollPosition_fn,_resizeListener,_tickListener,_scrollEntriesListener;const _LayoutBox=class _LayoutBox{constructor(element,options){__privateAdd(this,_LayoutBox_instances);__privateAdd(this,_element,null);__privateAdd(this,_containerElement,null);__privateAdd(this,_scrollStepSetterCallbacks,[]);__privateAdd(this,_scrollAxis,"auto");__privateAdd(this,_frontSide,"top");__privateAdd(this,_isCartesian,!1);__privateAdd(this,_isSizeStep,!0);__privateAdd(this,_isPositionStep,!0);__privateAdd(this,_isTransformStep,!0);__privateAdd(this,_isScrollStep,!0);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_depth,0);__privateAdd(this,_top,0);__privateAdd(this,_left,0);__privateAdd(this,_front,0);__privateAdd(this,_x,0);__privateAdd(this,_y,0);__privateAdd(this,_z,0);__privateAdd(this,_CSSTranslation,{x:0,y:0,z:0});__privateAdd(this,_CSSRotation,{x:0,y:0,z:0});__privateAdd(this,_CSSScale,{x:1,y:1,z:1});__privateAdd(this,_rotation,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_position,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scale,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scrollValue,{x:0,y:0,z:0});__privateAdd(this,_scrollEntries,new Map);__privateAdd(this,_resizeNotifier,new notifier_index.Notifier);__privateAdd(this,_resizeListener,__name(()=>{intersector_index.isBrowser&&__privateMethod(this,_LayoutBox_instances,updateDimensions_fn).call(this)},"#resizeListener"));__privateAdd(this,_tickListener,__name(()=>{__privateMethod(this,_LayoutBox_instances,updateScrollPosition_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this)},"#tickListener"));__privateAdd(this,_scrollEntriesListener,__name(()=>{const allEntries=scrollEntries_index.scrollEntries.getAll(this.element);__privateGet(this,_scrollEntries).forEach((value,key)=>{allEntries.includes(key)||(this.deleteScrollStep(value),__privateGet(this,_scrollEntries).delete(key))}),allEntries.forEach(entry=>{if(!__privateGet(this,_scrollEntries).has(entry)){const callback=__name(()=>entry,"callback");__privateGet(this,_scrollEntries).set(entry,callback),this.setScrollStep(callback)}})},"#scrollEntriesListener"));intersector_index.isBrowser&&(__privateSet(this,_element,dom.getElement(element)||document.body),__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_scrollAxis,(options==null?void 0:options.scrollAxis)||"auto"),__privateSet(this,_frontSide,(options==null?void 0:options.frontSide)||"top"),__privateSet(this,_isCartesian,(options==null?void 0:options.cartesian)||!1),__privateSet(this,_isSizeStep,(options==null?void 0:options.sizeStep)!==void 0?options.sizeStep:!0),__privateSet(this,_isPositionStep,(options==null?void 0:options.positionStep)!==void 0?options.positionStep:!0),__privateSet(this,_isTransformStep,(options==null?void 0:options.transformStep)!==void 0?options.transformStep:!0),__privateSet(this,_isScrollStep,(options==null?void 0:options.scrollStep)!==void 0?options.scrollStep:!0),__privateGet(this,_scale).setStep("_size","+",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_position","+",{x:0,y:0,z:0}),__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}),__privateGet(this,_isScrollStep)&&(scrollEntries_index.scrollEntries.notifier.subscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntriesListener).call(this),this.setScrollStep(()=>({axis:"y",value:layout.getStickyOffset(this.element,"top")*-1})),this.setScrollStep(()=>({axis:"x",value:layout.getStickyOffset(this.element,"left")*-1}))),elementResizer_index.elementResizer.subscribe(this.element,__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.LAYOUT_BOX),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX,culling:options!=null&&options.culling?this.element:void 0}))}get element(){return __privateGet(this,_element)}get containerElement(){return __privateGet(this,_containerElement)}get position(){return __privateGet(this,_position).current}get rotation(){return __privateGet(this,_rotation).current}get scale(){return __privateGet(this,_scale).current}get scrollValue(){return __privateGet(this,_scrollValue)}get left(){return __privateGet(this,_left)}get top(){return __privateGet(this,_top)}get CSSTranslation(){return __privateGet(this,_CSSTranslation)}get CSSRotation(){return __privateGet(this,_CSSRotation)}get CSSScale(){return __privateGet(this,_CSSScale)}get front(){return __privateGet(this,_front)}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get depth(){return __privateGet(this,_depth)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),scrollEntries_index.scrollEntries.notifier.unsubscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntries).clear(),__privateGet(this,_position).close(),__privateGet(this,_rotation).close(),__privateGet(this,_scale).close()}bindObject(object){object.position&&__privateGet(this,_position).bind(object.position),object.rotation&&__privateGet(this,_rotation).bind(object.rotation),object.scale&&__privateGet(this,_scale).bind(object.scale)}unbindObject(object){object.position&&__privateGet(this,_position).unbind(object.position),object.rotation&&__privateGet(this,_rotation).unbind(object.rotation),object.scale&&__privateGet(this,_scale).unbind(object.scale)}setScrollStep(callback){return __privateGet(this,_scrollStepSetterCallbacks).includes(callback)||__privateGet(this,_scrollStepSetterCallbacks).push(callback),()=>this.deleteScrollStep(callback)}deleteScrollStep(callback){__privateSet(this,_scrollStepSetterCallbacks,__privateGet(this,_scrollStepSetterCallbacks).filter(s=>s!==callback))}setPositionStep(...args){__privateGet(this,_position).setStep(...args)}getPositionStep(...args){return __privateGet(this,_position).getStepValue(...args)}setRotationStep(...args){__privateGet(this,_rotation).setStep(...args)}getRotationStep(...args){return __privateGet(this,_rotation).getStepValue(...args)}getExcludedRotationSteps(...args){return __privateGet(this,_rotation).getExcludedStepsValue(...args)}getIncludedRotationSteps(...args){return __privateGet(this,_rotation).getIncludedStepsValue(...args)}setScaleStep(...args){__privateGet(this,_scale).setStep(...args)}getScaleStep(...args){return __privateGet(this,_scale).getStepValue(...args)}getExcludedScaleSteps(...args){return __privateGet(this,_scale).getExcludedStepsValue(...args)}getIncludedScaleSteps(...args){return __privateGet(this,_scale).getIncludedStepsValue(...args)}deletePositionStep(...args){__privateGet(this,_position).deleteStep(...args)}getExcludedPositionSteps(...args){return __privateGet(this,_position).getExcludedStepsValue(...args)}getIncludedPositionSteps(...args){return __privateGet(this,_position).getIncludedStepsValue(...args)}deleteRotationStep(...args){__privateGet(this,_rotation).deleteStep(...args)}deleteScaleStep(...args){__privateGet(this,_scale).deleteStep(...args)}onPosition(...args){return __privateGet(this,_position).subscribe(...args)}offPosition(...args){__privateGet(this,_position).unsubscribe(...args)}onScale(...args){return __privateGet(this,_scale).subscribe(...args)}offScale(...args){__privateGet(this,_scale).unsubscribe(...args)}onRotation(...args){return __privateGet(this,_rotation).subscribe(...args)}offRotation(...args){__privateGet(this,_rotation).unsubscribe(...args)}onResize(...args){return __privateGet(this,_resizeNotifier).subscribe(...args)}offResize(...args){return __privateGet(this,_resizeNotifier).unsubscribe(...args)}};_element=new WeakMap,_containerElement=new WeakMap,_scrollStepSetterCallbacks=new WeakMap,_scrollAxis=new WeakMap,_frontSide=new WeakMap,_isCartesian=new WeakMap,_isSizeStep=new WeakMap,_isPositionStep=new WeakMap,_isTransformStep=new WeakMap,_isScrollStep=new WeakMap,_width=new WeakMap,_height=new WeakMap,_depth=new WeakMap,_top=new WeakMap,_left=new WeakMap,_front=new WeakMap,_x=new WeakMap,_y=new WeakMap,_z=new WeakMap,_CSSTranslation=new WeakMap,_CSSRotation=new WeakMap,_CSSScale=new WeakMap,_rotation=new WeakMap,_position=new WeakMap,_scale=new WeakMap,_scrollValue=new WeakMap,_scrollEntries=new WeakMap,_resizeNotifier=new WeakMap,_LayoutBox_instances=new WeakSet,recalculate_fn=__name(function(){__privateGet(this,_scale).calculate(),__privateGet(this,_position).calculate(),__privateGet(this,_rotation).calculate()},"#recalculate"),composeSteps_fn=__name(function(){__privateGet(this,_scale).setStep("_size","+",{x:__privateGet(this,_isSizeStep)?__privateGet(this,_width):1,y:__privateGet(this,_isSizeStep)?__privateGet(this,_height):1,z:__privateGet(this,_isSizeStep)?__privateGet(this,_depth):1});const xPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_x):0,yPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_y):0,zPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_z):0;__privateGet(this,_position).setStep("_position","+",{x:xPosition,y:yPosition,z:zPosition}),__privateGet(this,_isTransformStep)?(__privateGet(this,_scale).setStep("_scale","*",{x:__privateGet(this,_CSSScale).x,y:__privateGet(this,_CSSScale).y,z:__privateGet(this,_CSSScale).z}),__privateGet(this,_position).setStep("_translation","+",{x:__privateGet(this,_CSSTranslation).x,y:__privateGet(this,_CSSTranslation).y,z:__privateGet(this,_CSSTranslation).z}),__privateGet(this,_rotation).setStep("_rotation","+",{x:__privateGet(this,_CSSRotation).x,y:__privateGet(this,_CSSRotation).y,z:__privateGet(this,_CSSRotation).z})):(__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}))},"#composeSteps"),updateDimensions_fn=__name(function(){const computed=getComputedStyle(__privateGet(this,_element));__privateSet(this,_width,Math.max(__privateGet(this,_element).clientWidth,1)),__privateSet(this,_height,Math.max(__privateGet(this,_element).clientHeight,1)),__privateSet(this,_depth,Math.max(cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--depth")||"0px"),1));const vl=layout.getCumulativeOffsetLeft(__privateGet(this,_containerElement)),vt=layout.getCumulativeOffsetTop(__privateGet(this,_containerElement)),vw=__privateGet(this,_containerElement).clientWidth,vh=__privateGet(this,_containerElement).clientHeight;if(__privateSet(this,_left,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl),__privateSet(this,_top,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt),__privateGet(this,_scrollAxis)==="z"){const nl=__privateGet(this,_left)/vw,nt=__privateGet(this,_top)/vh;__privateSet(this,_left,(nl-Math.floor(nl))*vw),__privateSet(this,_top,(nt-Math.floor(nt))*vh),__privateGet(this,_frontSide)==="left"?__privateSet(this,_front,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl-__privateGet(this,_left)):__privateSet(this,_front,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt-__privateGet(this,_top))}if(__privateSet(this,_left,__privateGet(this,_left)+__privateGet(this,_element).clientLeft),__privateSet(this,_top,__privateGet(this,_top)+__privateGet(this,_element).clientTop),__privateSet(this,_left,__privateGet(this,_left)+layout.getStickyOffset(this.element,"left")*-1),__privateSet(this,_top,__privateGet(this,_top)+layout.getStickyOffset(this.element,"top")*-1),__privateGet(this,_isCartesian)){const viewHalfWidth=Math.round(vw/2),viewHalfHeight=Math.round(vh/2),thisHalfWidth=__privateGet(this,_width)?Math.round(__privateGet(this,_width)/2):0,thisHalfHeight=__privateGet(this,_height)?Math.round(__privateGet(this,_height)/2):0,positionX=__privateGet(this,_left)-viewHalfWidth+thisHalfWidth,positionY=(__privateGet(this,_top)-viewHalfHeight+thisHalfHeight)*-1;__privateSet(this,_x,positionX),__privateSet(this,_y,positionY)}else __privateSet(this,_x,__privateGet(this,_left)),__privateSet(this,_y,__privateGet(this,_top));__privateSet(this,_z,__privateGet(this,_front)*-1);const cssMatrix=new WebKitCSSMatrix(computed.transform),decomposedMatrix=decomposeCSSMatrix(cssMatrix);__privateGet(this,_CSSTranslation).x=decomposedMatrix.translationX,__privateGet(this,_CSSTranslation).y=decomposedMatrix.translationY,__privateGet(this,_CSSTranslation).z=decomposedMatrix.translationZ,__privateGet(this,_CSSScale).x=decomposedMatrix.scaleX,__privateGet(this,_CSSScale).y=decomposedMatrix.scaleY,__privateGet(this,_CSSScale).z=decomposedMatrix.scaleZ,__privateGet(this,_CSSRotation).x=decomposedMatrix.rotationX,__privateGet(this,_CSSRotation).y=decomposedMatrix.rotationY,__privateGet(this,_CSSRotation).z=decomposedMatrix.rotationZ,__privateMethod(this,_LayoutBox_instances,composeSteps_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this),__privateGet(this,_resizeNotifier).notify()},"#updateDimensions"),updateScrollPosition_fn=__name(function(){__privateGet(this,_scrollValue).x=0,__privateGet(this,_scrollValue).y=0,__privateGet(this,_scrollValue).z=0;for(let index=0;index<__privateGet(this,_scrollStepSetterCallbacks).length;index++){const callbackReturn=__privateGet(this,_scrollStepSetterCallbacks)[index]();let axis=callbackReturn.axis;__privateGet(this,_scrollAxis)!=="auto"&&(axis=__privateGet(this,_scrollAxis));const value=callbackReturn.value*(axis==="x"?-1:__privateGet(this,_isCartesian)?1:-1);__privateGet(this,_scrollValue)[axis]+=value,__privateGet(this,_position).setStep(`_scroll_${index}`,"+",{[axis]:value})}},"#updateScrollPosition"),_resizeListener=new WeakMap,_tickListener=new WeakMap,_scrollEntriesListener=new WeakMap,__name(_LayoutBox,"LayoutBox");let LayoutBox=_LayoutBox;exports.LayoutBox=LayoutBox;exports.decomposeCSSMatrix=decomposeCSSMatrix;
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cssUnitParser_index=require("../css-unit-parser/index.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),ladder_index=require("../ladder/index.cjs"),notifier_index=require("../notifier/index.cjs"),order_index=require("../order/index.cjs"),scrollEntries_index=require("../scroll-entries/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs"),layout=require("../layout-CnGLl7oe.cjs");require("construct-style-sheets-polyfill");const windowResizer_index=require("../window-resizer/index.cjs");function decomposeCSSMatrix(matrix){const scaleX=Math.sqrt(matrix.m11*matrix.m11+matrix.m12*matrix.m12+matrix.m13*matrix.m13),scaleY=Math.sqrt(matrix.m21*matrix.m21+matrix.m22*matrix.m22+matrix.m23*matrix.m23),scaleZ=Math.sqrt(matrix.m31*matrix.m31+matrix.m32*matrix.m32+matrix.m33*matrix.m33),rotationX=Math.atan2(matrix.m32,matrix.m33),rotationY=Math.atan2(-matrix.m31,Math.sqrt(matrix.m32*matrix.m32+matrix.m33*matrix.m33)),rotationZ=Math.atan2(matrix.m21,matrix.m11),translationX=matrix.m41,translationY=matrix.m42*-1,translationZ=matrix.m43;return{scaleX,scaleY,scaleZ,rotationX,rotationY,rotationZ,translationX,translationY,translationZ}}__name(decomposeCSSMatrix,"decomposeCSSMatrix");var _element,_containerElement,_scrollStepSetterCallbacks,_scrollAxis,_frontSide,_isCartesian,_isSizeStep,_isPositionStep,_isTransformStep,_isScrollStep,_width,_height,_depth,_top,_left,_front,_x,_y,_z,_CSSTranslation,_CSSRotation,_CSSScale,_rotation,_position,_scale,_scrollValue,_scrollEntries,_resizeNotifier,_LayoutBox_instances,recalculate_fn,composeSteps_fn,updateDimensions_fn,updateScrollPosition_fn,_resizeListener,_tickListener,_scrollEntriesListener;const _LayoutBox=class _LayoutBox{constructor(element,options){__privateAdd(this,_LayoutBox_instances);__privateAdd(this,_element,null);__privateAdd(this,_containerElement,null);__privateAdd(this,_scrollStepSetterCallbacks,[]);__privateAdd(this,_scrollAxis,"auto");__privateAdd(this,_frontSide,"top");__privateAdd(this,_isCartesian,!1);__privateAdd(this,_isSizeStep,!0);__privateAdd(this,_isPositionStep,!0);__privateAdd(this,_isTransformStep,!0);__privateAdd(this,_isScrollStep,!0);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_depth,0);__privateAdd(this,_top,0);__privateAdd(this,_left,0);__privateAdd(this,_front,0);__privateAdd(this,_x,0);__privateAdd(this,_y,0);__privateAdd(this,_z,0);__privateAdd(this,_CSSTranslation,{x:0,y:0,z:0});__privateAdd(this,_CSSRotation,{x:0,y:0,z:0});__privateAdd(this,_CSSScale,{x:1,y:1,z:1});__privateAdd(this,_rotation,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_position,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scale,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scrollValue,{x:0,y:0,z:0});__privateAdd(this,_scrollEntries,new Map);__privateAdd(this,_resizeNotifier,new notifier_index.Notifier);__privateAdd(this,_resizeListener,__name(()=>{intersector_index.isBrowser&&__privateMethod(this,_LayoutBox_instances,updateDimensions_fn).call(this)},"#resizeListener"));__privateAdd(this,_tickListener,__name(()=>{__privateMethod(this,_LayoutBox_instances,updateScrollPosition_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this)},"#tickListener"));__privateAdd(this,_scrollEntriesListener,__name(()=>{const allEntries=scrollEntries_index.scrollEntries.getAll(this.element);__privateGet(this,_scrollEntries).forEach((value,key)=>{allEntries.includes(key)||(this.deleteScrollStep(value),__privateGet(this,_scrollEntries).delete(key))}),allEntries.forEach(entry=>{if(!__privateGet(this,_scrollEntries).has(entry)){const callback=__name(()=>entry,"callback");__privateGet(this,_scrollEntries).set(entry,callback),this.setScrollStep(callback)}})},"#scrollEntriesListener"));intersector_index.isBrowser&&(__privateSet(this,_element,dom.getElement(element)||document.body),__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_scrollAxis,(options==null?void 0:options.scrollAxis)||"auto"),__privateSet(this,_frontSide,(options==null?void 0:options.frontSide)||"top"),__privateSet(this,_isCartesian,(options==null?void 0:options.cartesian)||!1),__privateSet(this,_isSizeStep,(options==null?void 0:options.sizeStep)!==void 0?options.sizeStep:!0),__privateSet(this,_isPositionStep,(options==null?void 0:options.positionStep)!==void 0?options.positionStep:!0),__privateSet(this,_isTransformStep,(options==null?void 0:options.transformStep)!==void 0?options.transformStep:!0),__privateSet(this,_isScrollStep,(options==null?void 0:options.scrollStep)!==void 0?options.scrollStep:!0),__privateGet(this,_scale).setStep("_size","+",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_position","+",{x:0,y:0,z:0}),__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}),__privateGet(this,_isScrollStep)&&(scrollEntries_index.scrollEntries.notifier.subscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntriesListener).call(this),this.setScrollStep(()=>({axis:"y",value:layout.getStickyOffset(this.element,"top")*-1})),this.setScrollStep(()=>({axis:"x",value:layout.getStickyOffset(this.element,"left")*-1}))),elementResizer_index.elementResizer.subscribe(this.element,__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.LAYOUT_BOX),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX,culling:options!=null&&options.culling?this.element:void 0}))}get element(){return __privateGet(this,_element)}get containerElement(){return __privateGet(this,_containerElement)}get position(){return __privateGet(this,_position).current}get rotation(){return __privateGet(this,_rotation).current}get scale(){return __privateGet(this,_scale).current}get scrollValue(){return __privateGet(this,_scrollValue)}get left(){return __privateGet(this,_left)}get top(){return __privateGet(this,_top)}get CSSTranslation(){return __privateGet(this,_CSSTranslation)}get CSSRotation(){return __privateGet(this,_CSSRotation)}get CSSScale(){return __privateGet(this,_CSSScale)}get front(){return __privateGet(this,_front)}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get depth(){return __privateGet(this,_depth)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),scrollEntries_index.scrollEntries.notifier.unsubscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntries).clear(),__privateGet(this,_position).close(),__privateGet(this,_rotation).close(),__privateGet(this,_scale).close()}bindObject(object){object.position&&__privateGet(this,_position).bind(object.position),object.rotation&&__privateGet(this,_rotation).bind(object.rotation),object.scale&&__privateGet(this,_scale).bind(object.scale)}unbindObject(object){object.position&&__privateGet(this,_position).unbind(object.position),object.rotation&&__privateGet(this,_rotation).unbind(object.rotation),object.scale&&__privateGet(this,_scale).unbind(object.scale)}setScrollStep(callback){return __privateGet(this,_scrollStepSetterCallbacks).includes(callback)||__privateGet(this,_scrollStepSetterCallbacks).push(callback),()=>this.deleteScrollStep(callback)}deleteScrollStep(callback){__privateSet(this,_scrollStepSetterCallbacks,__privateGet(this,_scrollStepSetterCallbacks).filter(s=>s!==callback))}setPositionStep(...args){__privateGet(this,_position).setStep(...args)}getPositionStep(...args){return __privateGet(this,_position).getStepValue(...args)}setRotationStep(...args){__privateGet(this,_rotation).setStep(...args)}getRotationStep(...args){return __privateGet(this,_rotation).getStepValue(...args)}getExcludedRotationSteps(...args){return __privateGet(this,_rotation).getExcludedStepsValue(...args)}getIncludedRotationSteps(...args){return __privateGet(this,_rotation).getIncludedStepsValue(...args)}setScaleStep(...args){__privateGet(this,_scale).setStep(...args)}getScaleStep(...args){return __privateGet(this,_scale).getStepValue(...args)}getExcludedScaleSteps(...args){return __privateGet(this,_scale).getExcludedStepsValue(...args)}getIncludedScaleSteps(...args){return __privateGet(this,_scale).getIncludedStepsValue(...args)}deletePositionStep(...args){__privateGet(this,_position).deleteStep(...args)}getExcludedPositionSteps(...args){return __privateGet(this,_position).getExcludedStepsValue(...args)}getIncludedPositionSteps(...args){return __privateGet(this,_position).getIncludedStepsValue(...args)}deleteRotationStep(...args){__privateGet(this,_rotation).deleteStep(...args)}deleteScaleStep(...args){__privateGet(this,_scale).deleteStep(...args)}onPosition(...args){return __privateGet(this,_position).subscribe(...args)}offPosition(...args){__privateGet(this,_position).unsubscribe(...args)}onScale(...args){return __privateGet(this,_scale).subscribe(...args)}offScale(...args){__privateGet(this,_scale).unsubscribe(...args)}onRotation(...args){return __privateGet(this,_rotation).subscribe(...args)}offRotation(...args){__privateGet(this,_rotation).unsubscribe(...args)}onResize(...args){return __privateGet(this,_resizeNotifier).subscribe(...args)}offResize(...args){return __privateGet(this,_resizeNotifier).unsubscribe(...args)}};_element=new WeakMap,_containerElement=new WeakMap,_scrollStepSetterCallbacks=new WeakMap,_scrollAxis=new WeakMap,_frontSide=new WeakMap,_isCartesian=new WeakMap,_isSizeStep=new WeakMap,_isPositionStep=new WeakMap,_isTransformStep=new WeakMap,_isScrollStep=new WeakMap,_width=new WeakMap,_height=new WeakMap,_depth=new WeakMap,_top=new WeakMap,_left=new WeakMap,_front=new WeakMap,_x=new WeakMap,_y=new WeakMap,_z=new WeakMap,_CSSTranslation=new WeakMap,_CSSRotation=new WeakMap,_CSSScale=new WeakMap,_rotation=new WeakMap,_position=new WeakMap,_scale=new WeakMap,_scrollValue=new WeakMap,_scrollEntries=new WeakMap,_resizeNotifier=new WeakMap,_LayoutBox_instances=new WeakSet,recalculate_fn=__name(function(){__privateGet(this,_scale).calculate(),__privateGet(this,_position).calculate(),__privateGet(this,_rotation).calculate()},"#recalculate"),composeSteps_fn=__name(function(){__privateGet(this,_scale).setStep("_size","+",{x:__privateGet(this,_isSizeStep)?__privateGet(this,_width):1,y:__privateGet(this,_isSizeStep)?__privateGet(this,_height):1,z:__privateGet(this,_isSizeStep)?__privateGet(this,_depth):1});const xPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_x):0,yPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_y):0,zPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_z):0;__privateGet(this,_position).setStep("_position","+",{x:xPosition,y:yPosition,z:zPosition}),__privateGet(this,_isTransformStep)?(__privateGet(this,_scale).setStep("_scale","*",{x:__privateGet(this,_CSSScale).x,y:__privateGet(this,_CSSScale).y,z:__privateGet(this,_CSSScale).z}),__privateGet(this,_position).setStep("_translation","+",{x:__privateGet(this,_CSSTranslation).x,y:__privateGet(this,_CSSTranslation).y,z:__privateGet(this,_CSSTranslation).z}),__privateGet(this,_rotation).setStep("_rotation","+",{x:__privateGet(this,_CSSRotation).x,y:__privateGet(this,_CSSRotation).y,z:__privateGet(this,_CSSRotation).z})):(__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}))},"#composeSteps"),updateDimensions_fn=__name(function(){const computed=getComputedStyle(__privateGet(this,_element));__privateSet(this,_width,Math.max(__privateGet(this,_element).clientWidth,1)),__privateSet(this,_height,Math.max(__privateGet(this,_element).clientHeight,1)),__privateSet(this,_depth,Math.max(cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--depth")||"0px")||0,1));const vl=layout.getCumulativeOffsetLeft(__privateGet(this,_containerElement)),vt=layout.getCumulativeOffsetTop(__privateGet(this,_containerElement)),vw=__privateGet(this,_containerElement).clientWidth,vh=__privateGet(this,_containerElement).clientHeight;if(__privateSet(this,_left,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl),__privateSet(this,_top,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt),__privateGet(this,_scrollAxis)==="z"){const nl=__privateGet(this,_left)/vw,nt=__privateGet(this,_top)/vh;__privateSet(this,_left,(nl-Math.floor(nl))*vw),__privateSet(this,_top,(nt-Math.floor(nt))*vh),__privateGet(this,_frontSide)==="left"?__privateSet(this,_front,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl-__privateGet(this,_left)):__privateSet(this,_front,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt-__privateGet(this,_top))}if(__privateSet(this,_left,__privateGet(this,_left)+__privateGet(this,_element).clientLeft),__privateSet(this,_top,__privateGet(this,_top)+__privateGet(this,_element).clientTop),__privateSet(this,_left,__privateGet(this,_left)+layout.getStickyOffset(this.element,"left")*-1),__privateSet(this,_top,__privateGet(this,_top)+layout.getStickyOffset(this.element,"top")*-1),__privateGet(this,_isCartesian)){const viewHalfWidth=Math.round(vw/2),viewHalfHeight=Math.round(vh/2),thisHalfWidth=__privateGet(this,_width)?Math.round(__privateGet(this,_width)/2):0,thisHalfHeight=__privateGet(this,_height)?Math.round(__privateGet(this,_height)/2):0,positionX=__privateGet(this,_left)-viewHalfWidth+thisHalfWidth,positionY=(__privateGet(this,_top)-viewHalfHeight+thisHalfHeight)*-1;__privateSet(this,_x,positionX),__privateSet(this,_y,positionY)}else __privateSet(this,_x,__privateGet(this,_left)),__privateSet(this,_y,__privateGet(this,_top));__privateSet(this,_z,__privateGet(this,_front)*-1);const cssMatrix=new WebKitCSSMatrix(computed.transform),decomposedMatrix=decomposeCSSMatrix(cssMatrix);__privateGet(this,_CSSTranslation).x=decomposedMatrix.translationX,__privateGet(this,_CSSTranslation).y=decomposedMatrix.translationY,__privateGet(this,_CSSTranslation).z=decomposedMatrix.translationZ,__privateGet(this,_CSSScale).x=decomposedMatrix.scaleX,__privateGet(this,_CSSScale).y=decomposedMatrix.scaleY,__privateGet(this,_CSSScale).z=decomposedMatrix.scaleZ,__privateGet(this,_CSSRotation).x=decomposedMatrix.rotationX,__privateGet(this,_CSSRotation).y=decomposedMatrix.rotationY,__privateGet(this,_CSSRotation).z=decomposedMatrix.rotationZ,__privateMethod(this,_LayoutBox_instances,composeSteps_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this),__privateGet(this,_resizeNotifier).notify()},"#updateDimensions"),updateScrollPosition_fn=__name(function(){__privateGet(this,_scrollValue).x=0,__privateGet(this,_scrollValue).y=0,__privateGet(this,_scrollValue).z=0;for(let index=0;index<__privateGet(this,_scrollStepSetterCallbacks).length;index++){const callbackReturn=__privateGet(this,_scrollStepSetterCallbacks)[index]();let axis=callbackReturn.axis;__privateGet(this,_scrollAxis)!=="auto"&&(axis=__privateGet(this,_scrollAxis));const value=callbackReturn.value*(axis==="x"?-1:__privateGet(this,_isCartesian)?1:-1);__privateGet(this,_scrollValue)[axis]+=value,__privateGet(this,_position).setStep(`_scroll_${index}`,"+",{[axis]:value})}},"#updateScrollPosition"),_resizeListener=new WeakMap,_tickListener=new WeakMap,_scrollEntriesListener=new WeakMap,__name(_LayoutBox,"LayoutBox");let LayoutBox=_LayoutBox;exports.LayoutBox=LayoutBox;exports.decomposeCSSMatrix=decomposeCSSMatrix;
@@ -293,7 +293,7 @@ _element = new WeakMap(), _containerElement = new WeakMap(), _scrollStepSetterCa
293
293
  }, "#composeSteps"), updateDimensions_fn = /* @__PURE__ */ __name(function() {
294
294
  const computed = getComputedStyle(__privateGet(this, _element));
295
295
  __privateSet(this, _width, Math.max(__privateGet(this, _element).clientWidth, 1)), __privateSet(this, _height, Math.max(__privateGet(this, _element).clientHeight, 1)), __privateSet(this, _depth, Math.max(
296
- cssUnitParser.parse(computed.getPropertyValue("--depth") || "0px"),
296
+ cssUnitParser.parse(computed.getPropertyValue("--depth") || "0px") || 0,
297
297
  1
298
298
  ));
299
299
  const vl = getCumulativeOffsetLeft(__privateGet(this, _containerElement)), vt = getCumulativeOffsetTop(__privateGet(this, _containerElement)), vw = __privateGet(this, _containerElement).clientWidth, vh = __privateGet(this, _containerElement).clientHeight;
@@ -0,0 +1,11 @@
1
+ export declare class NotchedElement extends HTMLElement {
2
+ #private;
3
+ constructor();
4
+ protected connectedCallback(): void;
5
+ protected disconnectedCallback(): void;
6
+ }
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ 'e-notched': NotchedElement;
10
+ }
11
+ }
@@ -0,0 +1,77 @@
1
+ interface RoundedRectangle {
2
+ topLeftCornerRadius: number;
3
+ topRightCornerRadius: number;
4
+ bottomRightCornerRadius: number;
5
+ bottomLeftCornerRadius: number;
6
+ width: number;
7
+ height: number;
8
+ }
9
+ interface NormalizedCorner {
10
+ radius: number;
11
+ roundingAndSmoothingBudget: number;
12
+ }
13
+ interface NormalizedCorners {
14
+ topLeft: NormalizedCorner;
15
+ topRight: NormalizedCorner;
16
+ bottomLeft: NormalizedCorner;
17
+ bottomRight: NormalizedCorner;
18
+ }
19
+ export declare function distributeAndNormalize({ topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius, width, height, }: RoundedRectangle): NormalizedCorners;
20
+ export interface CornerPathParams {
21
+ a: number;
22
+ b: number;
23
+ c: number;
24
+ d: number;
25
+ p: number;
26
+ cornerRadius: number;
27
+ arcSectionLength: number;
28
+ }
29
+ export interface CornerParams {
30
+ cornerAngleAlpha?: number;
31
+ cornerRadius: number;
32
+ cornerSmoothing: number;
33
+ preserveSmoothing: boolean;
34
+ roundingAndSmoothingBudget: number;
35
+ }
36
+ export interface NotchParams {
37
+ start: number;
38
+ length: number;
39
+ slope: number;
40
+ depth: number;
41
+ }
42
+ export declare function getPathParamsForCorner({ cornerRadius, cornerSmoothing, preserveSmoothing, roundingAndSmoothingBudget, cornerAngleAlpha, }: CornerParams): CornerPathParams;
43
+ interface SVGPathInput {
44
+ width: number;
45
+ height: number;
46
+ topRightPathParams: CornerPathParams;
47
+ bottomRightPathParams: CornerPathParams;
48
+ bottomLeftPathParams: CornerPathParams;
49
+ topLeftPathParams: CornerPathParams;
50
+ topNotches?: Array<NotchParams>;
51
+ rightNotches?: Array<NotchParams>;
52
+ bottomNotches?: Array<NotchParams>;
53
+ leftNotches?: Array<NotchParams>;
54
+ }
55
+ export declare function getSVGPathFromPathParams({ width, height, topLeftPathParams, topRightPathParams, bottomLeftPathParams, bottomRightPathParams, topNotches, rightNotches, bottomNotches, leftNotches, }: SVGPathInput): string;
56
+ export interface GetSvgPathParams {
57
+ cornerSmoothing: number;
58
+ preserveSmoothing?: boolean;
59
+ topNotches?: Array<NotchParams>;
60
+ rightNotches?: Array<NotchParams>;
61
+ bottomNotches?: Array<NotchParams>;
62
+ leftNotches?: Array<NotchParams>;
63
+ cornerRadius?: number;
64
+ topLeftCornerRadius?: number;
65
+ topRightCornerRadius?: number;
66
+ bottomRightCornerRadius?: number;
67
+ bottomLeftCornerRadius?: number;
68
+ cornerAngleAlpha?: number;
69
+ topLeftCornerAngleAlpha?: number;
70
+ topRightCornerAngleAlpha?: number;
71
+ bottomRightCornerAngleAlpha?: number;
72
+ bottomLeftCornerAngleAlpha?: number;
73
+ width: number;
74
+ height: number;
75
+ }
76
+ export declare function getSvgPath({ cornerRadius, topLeftCornerRadius, topRightCornerRadius, bottomRightCornerRadius, bottomLeftCornerRadius, cornerAngleAlpha, topLeftCornerAngleAlpha, topRightCornerAngleAlpha, bottomRightCornerAngleAlpha, bottomLeftCornerAngleAlpha, cornerSmoothing, preserveSmoothing, topNotches, rightNotches, bottomNotches, leftNotches, width, height, }: GetSvgPathParams): string;
77
+ export {};
@@ -0,0 +1 @@
1
+ export { NotchedElement } from './NotchedElement';
@@ -0,0 +1,62 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cssUnitParser_index=require("./css-unit-parser/index.cjs"),elementResizer_index=require("./element-resizer/index.cjs"),intersector_index=require("./index-DZ44osDT.cjs"),string=require("./string-CbRNzmd9.cjs");require("construct-style-sheets-polyfill");function distributeAndNormalize({topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,width,height}){const roundingAndSmoothingBudgetMap={topLeft:-1,topRight:-1,bottomLeft:-1,bottomRight:-1},cornerRadiusMap={topLeft:topLeftCornerRadius,topRight:topRightCornerRadius,bottomLeft:bottomLeftCornerRadius,bottomRight:bottomRightCornerRadius};return Object.entries(cornerRadiusMap).sort(([,radius1],[,radius2])=>radius2-radius1).forEach(([cornerName,radius])=>{const corner=cornerName,adjacents=adjacentsByCorner[corner],budget=Math.min(...adjacents.map(adjacent=>{const adjacentCornerRadius=cornerRadiusMap[adjacent.corner];if(radius===0&&adjacentCornerRadius===0)return 0;const adjacentCornerBudget=roundingAndSmoothingBudgetMap[adjacent.corner],sideLength=adjacent.side==="top"||adjacent.side==="bottom"?width:height;return adjacentCornerBudget>=0?sideLength-roundingAndSmoothingBudgetMap[adjacent.corner]:radius/(radius+adjacentCornerRadius)*sideLength}));roundingAndSmoothingBudgetMap[corner]=budget,cornerRadiusMap[corner]=Math.min(radius,budget)}),{topLeft:{radius:cornerRadiusMap.topLeft,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.topLeft},topRight:{radius:cornerRadiusMap.topRight,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.topRight},bottomLeft:{radius:cornerRadiusMap.bottomLeft,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.bottomLeft},bottomRight:{radius:cornerRadiusMap.bottomRight,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.bottomRight}}}__name(distributeAndNormalize,"distributeAndNormalize");const adjacentsByCorner={topLeft:[{corner:"topRight",side:"top"},{corner:"bottomLeft",side:"left"}],topRight:[{corner:"topLeft",side:"top"},{corner:"bottomRight",side:"right"}],bottomLeft:[{corner:"bottomRight",side:"bottom"},{corner:"topLeft",side:"left"}],bottomRight:[{corner:"bottomLeft",side:"bottom"},{corner:"topRight",side:"right"}]};function getPathParamsForCorner({cornerRadius,cornerSmoothing,preserveSmoothing,roundingAndSmoothingBudget,cornerAngleAlpha=90}){let p=(1+cornerSmoothing)*cornerRadius;if(!preserveSmoothing){const maxCornerSmoothing=roundingAndSmoothingBudget/cornerRadius-1;cornerSmoothing=Math.min(cornerSmoothing,maxCornerSmoothing),p=Math.min(p,roundingAndSmoothingBudget)}const arcMeasure=90*(1-cornerSmoothing),arcSectionLength=Math.sin(toRadians(arcMeasure/2))*cornerRadius*Math.sqrt(2),angleAlpha=(cornerAngleAlpha-arcMeasure)/2,p3ToP4Distance=cornerRadius*Math.tan(toRadians(angleAlpha/2)),angleBeta=45*cornerSmoothing,c=p3ToP4Distance*Math.cos(toRadians(angleBeta)),d=c*Math.tan(toRadians(angleBeta));let b=(p-arcSectionLength-c-d)/3,a=2*b;if(preserveSmoothing&&p>roundingAndSmoothingBudget){const p1ToP3MaxDistance=roundingAndSmoothingBudget-d-arcSectionLength-c,minA=p1ToP3MaxDistance/6,maxB=p1ToP3MaxDistance-minA;b=Math.min(b,maxB),a=p1ToP3MaxDistance-b,p=Math.min(p,roundingAndSmoothingBudget)}return{a,b,c,d,p,arcSectionLength,cornerRadius}}__name(getPathParamsForCorner,"getPathParamsForCorner");function getSVGPathFromPathParams({width,height,topLeftPathParams,topRightPathParams,bottomLeftPathParams,bottomRightPathParams,topNotches=[],rightNotches=[],bottomNotches=[],leftNotches=[]}){let d=`M ${topLeftPathParams.p} 0`;return topNotches.forEach(n=>{d+=drawTopNotch(n)}),d+=`L ${width-topRightPathParams.p} 0`,d+=drawTopRightPath(topRightPathParams),rightNotches.forEach(n=>{d+=drawRightNotch(n,width)}),d+=`L ${width} ${height-bottomRightPathParams.p}`,d+=drawBottomRightPath(bottomRightPathParams),bottomNotches.forEach(n=>{d+=drawBottomNotch(n,height)}),d+=`L ${bottomLeftPathParams.p} ${height}`,d+=drawBottomLeftPath(bottomLeftPathParams),leftNotches.forEach(n=>{d+=drawLeftNotch(n)}),d+=`L 0 ${topLeftPathParams.p}`,d+=drawTopLeftPath(topLeftPathParams),d+="Z",d.replace(/[\t\s\n]+/g," ").trim()}__name(getSVGPathFromPathParams,"getSVGPathFromPathParams");function drawTopNotch({start,length,slope,depth}){const end=start+length;return`
2
+ L${start} 0
3
+ C ${start+slope*.5},0 ${start+slope*.5},${depth} ${start+slope},${depth}
4
+ L${end-slope},${depth}
5
+ C ${end-slope*.5},${depth} ${end-slope*.5},0 ${end},0
6
+ `}__name(drawTopNotch,"drawTopNotch");function drawBottomNotch({start,length,slope,depth},height){const end=start+length;return`
7
+ L${end},${height}
8
+ C ${end-slope*.5},${height} ${end-slope*.5},${height-depth} ${end-slope},${height-depth}
9
+ L${start+slope},${height-depth}
10
+ C ${start+slope*.5},${height-depth} ${start+slope*.5},${height} ${start},${height}
11
+ `}__name(drawBottomNotch,"drawBottomNotch");function drawLeftNotch({start,length,slope,depth}){const end=start+length;return`
12
+ L0,${end}
13
+ C 0,${end-slope*.5} ${depth},${end-slope*.5} ${depth},${end-slope}
14
+ L${depth},${start+slope}
15
+ C ${depth},${start+slope*.5} 0,${start+slope*.5} 0,${start}
16
+ `}__name(drawLeftNotch,"drawLeftNotch");function drawRightNotch({start,length,slope,depth},width){const end=start+length;return`
17
+ L${width},${start}
18
+ C ${width},${start+slope*.5} ${width-depth},${start+slope*.5} ${width-depth},${start+slope}
19
+ L${width-depth},${end-slope}
20
+ C ${width-depth},${end-slope*.5} ${width},${end-slope*.5} ${width},${end}
21
+ `}__name(drawRightNotch,"drawRightNotch");function drawTopRightPath({cornerRadius,a,b,c,d,p,arcSectionLength}){return cornerRadius?rounded`
22
+ c ${a} 0 ${a+b} 0 ${a+b+c} ${d}
23
+ a ${cornerRadius} ${cornerRadius} 0 0 1 ${arcSectionLength} ${arcSectionLength}
24
+ c ${d} ${c}
25
+ ${d} ${b+c}
26
+ ${d} ${a+b+c}`:rounded`l ${p} 0`}__name(drawTopRightPath,"drawTopRightPath");function drawBottomRightPath({cornerRadius,a,b,c,d,p,arcSectionLength}){return cornerRadius?rounded`
27
+ c 0 ${a}
28
+ 0 ${a+b}
29
+ ${-d} ${a+b+c}
30
+ a ${cornerRadius} ${cornerRadius} 0 0 1 -${arcSectionLength} ${arcSectionLength}
31
+ c ${-c} ${d}
32
+ ${-(b+c)} ${d}
33
+ ${-(a+b+c)} ${d}`:rounded`l 0 ${p}`}__name(drawBottomRightPath,"drawBottomRightPath");function drawBottomLeftPath({cornerRadius,a,b,c,d,p,arcSectionLength}){return cornerRadius?rounded`
34
+ c ${-a} 0
35
+ ${-(a+b)} 0
36
+ ${-(a+b+c)} ${-d}
37
+ a ${cornerRadius} ${cornerRadius} 0 0 1 -${arcSectionLength} -${arcSectionLength}
38
+ c ${-d} ${-c}
39
+ ${-d} ${-(b+c)}
40
+ ${-d} ${-(a+b+c)}`:rounded`l ${-p} 0`}__name(drawBottomLeftPath,"drawBottomLeftPath");function drawTopLeftPath({cornerRadius,a,b,c,d,p,arcSectionLength}){return cornerRadius?rounded`
41
+ c 0 ${-a}
42
+ 0 ${-(a+b)}
43
+ ${d} ${-(a+b+c)}
44
+ a ${cornerRadius} ${cornerRadius} 0 0 1 ${arcSectionLength} -${arcSectionLength}
45
+ c ${c} ${-d}
46
+ ${b+c} ${-d}
47
+ ${a+b+c} ${-d}`:rounded`l 0 ${-p}`}__name(drawTopLeftPath,"drawTopLeftPath");function toRadians(degrees){return degrees*Math.PI/180}__name(toRadians,"toRadians");function rounded(strings,...values){return strings.reduce((acc,str,i)=>{const value=values[i];return typeof value=="number"?acc+str+value.toFixed(4):acc+str+(value!=null?value:"")},"")}__name(rounded,"rounded");function getSvgPath({cornerRadius=0,topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,cornerAngleAlpha=90,topLeftCornerAngleAlpha,topRightCornerAngleAlpha,bottomRightCornerAngleAlpha,bottomLeftCornerAngleAlpha,cornerSmoothing,preserveSmoothing=!1,topNotches,rightNotches,bottomNotches,leftNotches,width,height}){if(topLeftCornerRadius=topLeftCornerRadius!=null?topLeftCornerRadius:cornerRadius,topRightCornerRadius=topRightCornerRadius!=null?topRightCornerRadius:cornerRadius,bottomLeftCornerRadius=bottomLeftCornerRadius!=null?bottomLeftCornerRadius:cornerRadius,bottomRightCornerRadius=bottomRightCornerRadius!=null?bottomRightCornerRadius:cornerRadius,topLeftCornerAngleAlpha=topLeftCornerAngleAlpha!=null?topLeftCornerAngleAlpha:cornerAngleAlpha,topRightCornerAngleAlpha=topRightCornerAngleAlpha!=null?topRightCornerAngleAlpha:cornerAngleAlpha,bottomLeftCornerAngleAlpha=bottomLeftCornerAngleAlpha!=null?bottomLeftCornerAngleAlpha:cornerAngleAlpha,bottomRightCornerAngleAlpha=bottomRightCornerAngleAlpha!=null?bottomRightCornerAngleAlpha:cornerAngleAlpha,topLeftCornerRadius===topRightCornerRadius&&topRightCornerRadius===bottomRightCornerRadius&&bottomRightCornerRadius===bottomLeftCornerRadius&&bottomLeftCornerRadius===topLeftCornerRadius&&topLeftCornerAngleAlpha===topRightCornerAngleAlpha&&topRightCornerAngleAlpha===bottomRightCornerAngleAlpha&&bottomRightCornerAngleAlpha===bottomLeftCornerAngleAlpha&&bottomLeftCornerAngleAlpha===topLeftCornerAngleAlpha){const roundingAndSmoothingBudget=Math.min(width,height)/2,cornerRadius2=Math.min(topLeftCornerRadius,roundingAndSmoothingBudget),pathParams=getPathParamsForCorner({cornerRadius:cornerRadius2,cornerSmoothing,cornerAngleAlpha,preserveSmoothing,roundingAndSmoothingBudget});return getSVGPathFromPathParams({width,height,topLeftPathParams:pathParams,topRightPathParams:pathParams,bottomLeftPathParams:pathParams,bottomRightPathParams:pathParams,topNotches,rightNotches,bottomNotches,leftNotches})}const{topLeft,topRight,bottomLeft,bottomRight}=distributeAndNormalize({topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,width,height});return getSVGPathFromPathParams({width,height,topLeftPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:topLeft.radius,roundingAndSmoothingBudget:topLeft.roundingAndSmoothingBudget,cornerAngleAlpha:topLeftCornerAngleAlpha}),topRightPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:topRight.radius,roundingAndSmoothingBudget:topRight.roundingAndSmoothingBudget,cornerAngleAlpha:topRightCornerAngleAlpha}),bottomRightPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:bottomRight.radius,roundingAndSmoothingBudget:bottomRight.roundingAndSmoothingBudget,cornerAngleAlpha:bottomRightCornerAngleAlpha}),bottomLeftPathParams:getPathParamsForCorner({cornerSmoothing,preserveSmoothing,cornerRadius:bottomLeft.radius,roundingAndSmoothingBudget:bottomLeft.roundingAndSmoothingBudget,cornerAngleAlpha:bottomLeftCornerAngleAlpha}),topNotches,rightNotches,bottomNotches,leftNotches})}__name(getSvgPath,"getSvgPath");var _svgElement,_pathElement,_resizeListener,_NotchedElement_instances,parseCSSNotchValue_fn;const _NotchedElement=class _NotchedElement extends HTMLElement{constructor(){super();__privateAdd(this,_NotchedElement_instances);__privateAdd(this,_svgElement);__privateAdd(this,_pathElement);__privateAdd(this,_resizeListener,__name(()=>{const width=this.offsetWidth,height=this.offsetHeight,computed=getComputedStyle(this);__privateGet(this,_svgElement).setAttributeNS("http://www.w3.org/2000/svg","viewBox",`0 0 ${width} ${height}`);const cornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-corner-radius")),topLeftCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-top-left-corner-radius")),topRightCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-top-right-corner-radius")),bottomRightCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-bottom-right-corner-radius")),bottomLeftCornerRadius=cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--notched-bottom-left-corner-radius")),cornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-corner-angle-alpha"))||void 0,topLeftCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-top-left-corner-angle-alpha"))||void 0,topRightCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-top-right-corner-angle-alpha"))||void 0,bottomRightCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-bottom-right-corner-angle-alpha"))||void 0,bottomLeftCornerAngleAlpha=parseFloat(computed.getPropertyValue("--notched-bottom-left-corner-angle-alpha"))||void 0,cornerSmoothing=parseFloat(computed.getPropertyValue("--notched-corner-smoothing"))||0,preserveSmoothing=computed.getPropertyValue("--notched-preserve-smoothing")!=="false",topNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-top-notches")),rightNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-right-notches")),bottomNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-bottom-notches")),leftNotches=__privateMethod(this,_NotchedElement_instances,parseCSSNotchValue_fn).call(this,computed.getPropertyValue("--notched-left-notches")),color=computed.getPropertyValue("--notched-color"),path=getSvgPath({cornerRadius,topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,cornerAngleAlpha,topLeftCornerAngleAlpha,topRightCornerAngleAlpha,bottomRightCornerAngleAlpha,bottomLeftCornerAngleAlpha,cornerSmoothing,preserveSmoothing,topNotches,rightNotches,bottomNotches,leftNotches,width,height});__privateGet(this,_pathElement).setAttribute("d",path),color&&__privateGet(this,_pathElement).setAttribute("fill",color)},"#resizeListener"));const clipId=this.hasAttribute("clip")?"clip-"+string.generateId(10):null,tmpElement=document.createElement("div");tmpElement.innerHTML=`
48
+ <svg xmlns="http://www.w3.org/2000/svg">
49
+ ${clipId?`<clipPath id="${clipId}">`:""}
50
+ <path></path>
51
+ ${clipId?"</clipPath>":""}
52
+ </svg>
53
+ <slot></slot>
54
+ `,clipId&&(this.style.clipPath=`url(#${clipId})`),this.style.position="relative",__privateSet(this,_svgElement,tmpElement.querySelector("svg")),__privateGet(this,_svgElement).style.cssText=`
55
+ position: absolute;
56
+ top: 0;
57
+ left: 0;
58
+ zIndex: -1;
59
+ display: block;
60
+ width: 100%;
61
+ height: 100%;
62
+ `,__privateSet(this,_pathElement,tmpElement.querySelector("path")),this.prepend(tmpElement.firstElementChild)}connectedCallback(){elementResizer_index.elementResizer.subscribe(this,__privateGet(this,_resizeListener)),intersector_index.ticker.subscribe(__privateGet(this,_resizeListener))}disconnectedCallback(){elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener))}};_svgElement=new WeakMap,_pathElement=new WeakMap,_resizeListener=new WeakMap,_NotchedElement_instances=new WeakSet,parseCSSNotchValue_fn=__name(function(value){const notchesString=value.split(",").map(v=>v.trim()).filter(v=>!!v),notches=[];return notchesString.forEach(notchString=>{const valuesStrings=notchString.split(" ").map(v=>v.trim()).filter(v=>!!v);notches.push({start:cssUnitParser_index.cssUnitParser.parse(valuesStrings[0])||0,length:cssUnitParser_index.cssUnitParser.parse(valuesStrings[1])||0,slope:cssUnitParser_index.cssUnitParser.parse(valuesStrings[2])||0,depth:cssUnitParser_index.cssUnitParser.parse(valuesStrings[3])||0})}),notches},"#parseCSSNotchValue"),__name(_NotchedElement,"NotchedElement");let NotchedElement=_NotchedElement;customElements.get("e-notched")||customElements.define("e-notched",NotchedElement);exports.NotchedElement=NotchedElement;