aptechka 0.88.13 → 0.88.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/loading-BeSsYMFd.js +25 -0
- package/lib/loading-CLclsL2B.cjs +1 -0
- package/lib/notched/index.cjs +10 -2
- package/lib/notched/index.js +23 -7
- package/lib/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +11 -14
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +10 -29
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
3
|
+
function requestLoadingCallback(event, callback) {
|
|
4
|
+
let idleId, timeoutId;
|
|
5
|
+
const domListener = /* @__PURE__ */ __name(() => {
|
|
6
|
+
window.removeEventListener("DOMContentLoaded", loadListener), callback();
|
|
7
|
+
}, "domListener"), loadListener = /* @__PURE__ */ __name(() => {
|
|
8
|
+
window.removeEventListener("load", loadListener), callback();
|
|
9
|
+
}, "loadListener"), idleListener = /* @__PURE__ */ __name(() => {
|
|
10
|
+
idleId = void 0, callback();
|
|
11
|
+
}, "idleListener"), delayListener = /* @__PURE__ */ __name(() => {
|
|
12
|
+
window.removeEventListener("load", loadListener), timeoutId = setTimeout(() => {
|
|
13
|
+
requestAnimationFrame(() => {
|
|
14
|
+
callback();
|
|
15
|
+
});
|
|
16
|
+
}, 1e3);
|
|
17
|
+
}, "delayListener"), clear = /* @__PURE__ */ __name(() => {
|
|
18
|
+
window.removeEventListener("DOMContentLoaded", domListener), window.removeEventListener("load", loadListener), window.removeEventListener("load", delayListener), idleId && window.cancelIdleCallback && window.cancelIdleCallback(idleId), clearTimeout(timeoutId);
|
|
19
|
+
}, "clear");
|
|
20
|
+
return event === "idle" && window.requestIdleCallback ? idleId = window.requestIdleCallback(idleListener, { timeout: 1e4 }) : event === "load" ? document.readyState === "complete" ? loadListener() : window.addEventListener("load", loadListener) : event === "loadWithDelay" ? document.readyState === "complete" ? delayListener() : window.addEventListener("load", delayListener) : event === "DOMContentLoaded" && window.addEventListener("DOMContentLoaded", domListener), clear;
|
|
21
|
+
}
|
|
22
|
+
__name(requestLoadingCallback, "requestLoadingCallback");
|
|
23
|
+
export {
|
|
24
|
+
requestLoadingCallback as r
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});function requestLoadingCallback(event,callback){let idleId,timeoutId;const domListener=__name(()=>{window.removeEventListener("DOMContentLoaded",loadListener),callback()},"domListener"),loadListener=__name(()=>{window.removeEventListener("load",loadListener),callback()},"loadListener"),idleListener=__name(()=>{idleId=void 0,callback()},"idleListener"),delayListener=__name(()=>{window.removeEventListener("load",loadListener),timeoutId=setTimeout(()=>{requestAnimationFrame(()=>{callback()})},1e3)},"delayListener"),clear=__name(()=>{window.removeEventListener("DOMContentLoaded",domListener),window.removeEventListener("load",loadListener),window.removeEventListener("load",delayListener),idleId&&window.cancelIdleCallback&&window.cancelIdleCallback(idleId),clearTimeout(timeoutId)},"clear");return event==="idle"&&window.requestIdleCallback?idleId=window.requestIdleCallback(idleListener,{timeout:1e4}):event==="load"?document.readyState==="complete"?loadListener():window.addEventListener("load",loadListener):event==="loadWithDelay"?document.readyState==="complete"?delayListener():window.addEventListener("load",delayListener):event==="DOMContentLoaded"&&window.addEventListener("DOMContentLoaded",domListener),clear}__name(requestLoadingCallback,"requestLoadingCallback");exports.requestLoadingCallback=requestLoadingCallback;
|
package/lib/notched/index.cjs
CHANGED
|
@@ -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"});const cssUnitParser_index=require("../css-unit-parser/index.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),
|
|
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"),string=require("../string-Bx5N38JG.cjs");require("construct-style-sheets-polyfill");require("../index-Cz5-98rw.cjs");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
2
|
L${start} 0
|
|
3
3
|
C ${start+slope*.5},0 ${start+slope*.5},${depth} ${start+slope},${depth}
|
|
4
4
|
L${end-slope},${depth}
|
|
@@ -44,4 +44,12 @@
|
|
|
44
44
|
a ${cornerRadius} ${cornerRadius} 0 0 1 ${arcSectionLength} -${arcSectionLength}
|
|
45
45
|
c ${c} ${-d}
|
|
46
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 _clipId,_resizeListener,_NotchedElement_instances,parseCSSNotchValue_fn;const _NotchedElement=class _NotchedElement extends HTMLElement{constructor(){super();__privateAdd(this,_NotchedElement_instances);__privateAdd(this,_clipId);__privateAdd(this,_resizeListener,__name(()=>{const width=this.offsetWidth,height=this.offsetHeight,computed=getComputedStyle(this),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")),path=getSvgPath({cornerRadius,topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,cornerAngleAlpha,topLeftCornerAngleAlpha,topRightCornerAngleAlpha,bottomRightCornerAngleAlpha,bottomLeftCornerAngleAlpha,cornerSmoothing,preserveSmoothing,topNotches,rightNotches,bottomNotches,leftNotches,width,height});this
|
|
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 _imageElement,_clipId,_resizeListener,_NotchedElement_instances,parseCSSNotchValue_fn;const _NotchedElement=class _NotchedElement extends HTMLElement{constructor(){super();__privateAdd(this,_NotchedElement_instances);__privateAdd(this,_imageElement,null);__privateAdd(this,_clipId,null);__privateAdd(this,_resizeListener,__name(()=>{const width=this.offsetWidth,height=this.offsetHeight,computed=getComputedStyle(this),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")),path=getSvgPath({cornerRadius,topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,cornerAngleAlpha,topLeftCornerAngleAlpha,topRightCornerAngleAlpha,bottomRightCornerAngleAlpha,bottomLeftCornerAngleAlpha,cornerSmoothing,preserveSmoothing,topNotches,rightNotches,bottomNotches,leftNotches,width,height});if(__privateGet(this,_clipId)){const svg=`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${this.offsetWidth}' height='${this.offsetHeight}' viewBox='0 0 ${this.offsetWidth} ${this.offsetHeight}'%3E%3Cdefs%3E%3CclipPath id='${__privateGet(this,_clipId)}'%3E%3Cpath fill='%23000' d='${path}'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23${__privateGet(this,_clipId)})' %3E%3Crect width='${this.offsetWidth}' height='${this.offsetHeight}' fill='%23000'/%3E%3C/g%3E%3C/svg%3E`;this.style.maskImage=`url("${svg}")`,this.style.maskPosition="center center",this.style.maskRepeat="no-repeat",this.style.maskSize="contain"}else if(__privateGet(this,_imageElement)){const svg=`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 ${width} ${height}'%3E%3Cpath fill='%23000' d='${path}'/%3E%3C/svg%3E`;__privateGet(this,_imageElement).src=svg}},"#resizeListener"));const clip=this.hasAttribute("clip");__privateSet(this,_clipId,clip?"clip-"+string.generateId(10):null),__privateGet(this,_clipId)||(__privateSet(this,_imageElement,document.createElement("img")),__privateGet(this,_imageElement).style.cssText=`
|
|
48
|
+
position: absolute;
|
|
49
|
+
top: 0;
|
|
50
|
+
left: 0;
|
|
51
|
+
zIndex: -1;
|
|
52
|
+
display: block;
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 100%;
|
|
55
|
+
`,this.prepend(__privateGet(this,_imageElement)))}connectedCallback(){elementResizer_index.elementResizer.subscribe(this,__privateGet(this,_resizeListener))}disconnectedCallback(){elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener))}};_imageElement=new WeakMap,_clipId=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;
|
package/lib/notched/index.js
CHANGED
|
@@ -7,9 +7,9 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
7
7
|
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);
|
|
8
8
|
import { cssUnitParser } from "../css-unit-parser/index.js";
|
|
9
9
|
import { elementResizer } from "../element-resizer/index.js";
|
|
10
|
-
import { t as ticker } from "../index-uJboZXlu.js";
|
|
11
10
|
import { g as generateId } from "../string-Ct-dy_cs.js";
|
|
12
11
|
import "construct-style-sheets-polyfill";
|
|
12
|
+
import "../index-uJboZXlu.js";
|
|
13
13
|
function distributeAndNormalize({
|
|
14
14
|
topLeftCornerRadius,
|
|
15
15
|
topRightCornerRadius,
|
|
@@ -372,12 +372,13 @@ function getSvgPath({
|
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
374
|
__name(getSvgPath, "getSvgPath");
|
|
375
|
-
var _clipId, _resizeListener, _NotchedElement_instances, parseCSSNotchValue_fn;
|
|
375
|
+
var _imageElement, _clipId, _resizeListener, _NotchedElement_instances, parseCSSNotchValue_fn;
|
|
376
376
|
const _NotchedElement = class _NotchedElement extends HTMLElement {
|
|
377
377
|
constructor() {
|
|
378
378
|
super();
|
|
379
379
|
__privateAdd(this, _NotchedElement_instances);
|
|
380
|
-
__privateAdd(this,
|
|
380
|
+
__privateAdd(this, _imageElement, null);
|
|
381
|
+
__privateAdd(this, _clipId, null);
|
|
381
382
|
__privateAdd(this, _resizeListener, /* @__PURE__ */ __name(() => {
|
|
382
383
|
const width = this.offsetWidth, height = this.offsetHeight, computed = getComputedStyle(this), cornerRadius = cssUnitParser.parse(
|
|
383
384
|
computed.getPropertyValue("--notched-corner-radius")
|
|
@@ -417,18 +418,33 @@ const _NotchedElement = class _NotchedElement extends HTMLElement {
|
|
|
417
418
|
width,
|
|
418
419
|
height
|
|
419
420
|
});
|
|
420
|
-
|
|
421
|
+
if (__privateGet(this, _clipId)) {
|
|
422
|
+
const svg = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${this.offsetWidth}' height='${this.offsetHeight}' viewBox='0 0 ${this.offsetWidth} ${this.offsetHeight}'%3E%3Cdefs%3E%3CclipPath id='${__privateGet(this, _clipId)}'%3E%3Cpath fill='%23000' d='${path}'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23${__privateGet(this, _clipId)})' %3E%3Crect width='${this.offsetWidth}' height='${this.offsetHeight}' fill='%23000'/%3E%3C/g%3E%3C/svg%3E`;
|
|
423
|
+
this.style.maskImage = `url("${svg}")`, this.style.maskPosition = "center center", this.style.maskRepeat = "no-repeat", this.style.maskSize = "contain";
|
|
424
|
+
} else if (__privateGet(this, _imageElement)) {
|
|
425
|
+
const svg = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 ${width} ${height}'%3E%3Cpath fill='%23000' d='${path}'/%3E%3C/svg%3E`;
|
|
426
|
+
__privateGet(this, _imageElement).src = svg;
|
|
427
|
+
}
|
|
421
428
|
}, "#resizeListener"));
|
|
422
|
-
|
|
429
|
+
const clip = this.hasAttribute("clip");
|
|
430
|
+
__privateSet(this, _clipId, clip ? "clip-" + generateId(10) : null), __privateGet(this, _clipId) || (__privateSet(this, _imageElement, document.createElement("img")), __privateGet(this, _imageElement).style.cssText = `
|
|
431
|
+
position: absolute;
|
|
432
|
+
top: 0;
|
|
433
|
+
left: 0;
|
|
434
|
+
zIndex: -1;
|
|
435
|
+
display: block;
|
|
436
|
+
width: 100%;
|
|
437
|
+
height: 100%;
|
|
438
|
+
`, this.prepend(__privateGet(this, _imageElement)));
|
|
423
439
|
}
|
|
424
440
|
connectedCallback() {
|
|
425
|
-
elementResizer.subscribe(this, __privateGet(this, _resizeListener))
|
|
441
|
+
elementResizer.subscribe(this, __privateGet(this, _resizeListener));
|
|
426
442
|
}
|
|
427
443
|
disconnectedCallback() {
|
|
428
444
|
elementResizer.unsubscribe(__privateGet(this, _resizeListener));
|
|
429
445
|
}
|
|
430
446
|
};
|
|
431
|
-
_clipId = new WeakMap(), _resizeListener = new WeakMap(), _NotchedElement_instances = new WeakSet(), parseCSSNotchValue_fn = /* @__PURE__ */ __name(function(value) {
|
|
447
|
+
_imageElement = new WeakMap(), _clipId = new WeakMap(), _resizeListener = new WeakMap(), _NotchedElement_instances = new WeakSet(), parseCSSNotchValue_fn = /* @__PURE__ */ __name(function(value) {
|
|
432
448
|
const notchesString = value.split(",").map((v) => v.trim()).filter((v) => !!v), notches = [];
|
|
433
449
|
return notchesString.forEach((notchString) => {
|
|
434
450
|
const valuesStrings = notchString.split(" ").map((v) => v.trim()).filter((v) => !!v);
|
package/lib/scroll-kit/index.cjs
CHANGED
|
@@ -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 intersector_index=require("../index-Cz5-98rw.cjs"),dom=require("../dom-B40i6NXw.cjs"),gestures=require("../gestures-DtYbQr49.cjs");require("construct-style-sheets-polyfill");const order_index=require("../order/index.cjs");require("../Store-BkYJHJp5.cjs");const scroll=require("../scroll-Dv9QcIKd.cjs"),Damped=require("../Damped-CYCcZu-z.cjs"),Tweened=require("../Tweened-BoGo9vz9.cjs"),cssProperty_index=require("../css-property/index.cjs"),Viewport=require("../Viewport-DwPeXyM2.cjs"),scrollEntries_index=require("../scroll-entries/index.cjs"),elementLinkedStore_index=require("../element-linked-store/index.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),events=require("../events-UlGk63iC.cjs"),layout=require("../layout-CnGLl7oe.cjs"),math=require("../math-C-knY2TL.cjs"),windowResizer_index=require("../window-resizer/index.cjs");var _scrollElement,_thumbElement,_thumbScrollSize,_limit,_isHorizontal,_activeTimeoutId,_ScrollbarElement_instances,scrollPosition_get,scrollSize_get,scrollViewportSize_get,_scrollListener,_resizeListener,_grabListener,_tickListener,_intersectionListener;const _ScrollbarElement=class _ScrollbarElement extends HTMLElement{constructor(){super(...arguments);__privateAdd(this,_ScrollbarElement_instances);__privateAdd(this,_scrollElement,null);__privateAdd(this,_thumbElement,null);__privateAdd(this,_thumbScrollSize,0);__privateAdd(this,_limit,0);__privateAdd(this,_isHorizontal,!1);__privateAdd(this,_activeTimeoutId);__privateAdd(this,_scrollListener,__name(()=>{this.classList.add("active"),clearTimeout(__privateGet(this,_activeTimeoutId));const position=__privateGet(this,_ScrollbarElement_instances,scrollPosition_get)/__privateGet(this,_limit)*__privateGet(this,_thumbScrollSize);__privateGet(this,_isHorizontal)?__privateGet(this,_thumbElement).style.transform=`translate3d(${position}px, 0px, 0px)`:__privateGet(this,_thumbElement).style.transform=`translate3d(0px, ${position}px, 0px)`,__privateSet(this,_activeTimeoutId,setTimeout(()=>{this.classList.remove("active")},1e3))},"#scrollListener"));__privateAdd(this,_resizeListener,__name(()=>{const barSize=__privateGet(this,_isHorizontal)?this.offsetWidth:this.offsetHeight,scrollSize=__privateGet(this,_ScrollbarElement_instances,scrollSize_get),viewportSize=__privateGet(this,_ScrollbarElement_instances,scrollViewportSize_get);__privateSet(this,_limit,scrollSize-viewportSize);let thumbSize=barSize*barSize/(__privateGet(this,_limit)+barSize);thumbSize=Math.max(thumbSize,30),__privateGet(this,_isHorizontal)?(__privateGet(this,_thumbElement).style.width=thumbSize+"px",__privateGet(this,_thumbElement).style.height="100%"):(__privateGet(this,_thumbElement).style.width="100%",__privateGet(this,_thumbElement).style.height=thumbSize+"px"),__privateSet(this,_thumbScrollSize,barSize-thumbSize),scrollSize<=viewportSize?this.style.display="none":this.style.display="block"},"#resizeListener"));__privateAdd(this,_grabListener,__name(grabEvent=>{const startValue=__privateGet(this,_ScrollbarElement_instances,scrollPosition_get),grabCursor=__privateGet(this,_isHorizontal)?grabEvent.x:grabEvent.y;gestures.setupDrag(moveEvent=>{const mult=__privateGet(this,_limit)/__privateGet(this,_thumbScrollSize),delta=(__privateGet(this,_isHorizontal)?moveEvent.x-grabCursor:moveEvent.y-grabCursor)*mult;__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scroll({left:startValue+delta,behavior:"instant"}):__privateGet(this,_scrollElement).scroll({top:startValue+delta,behavior:"instant"})})},"#grabListener"));__privateAdd(this,_tickListener,__name(()=>{__privateGet(this,_resizeListener).call(this)},"#tickListener"));__privateAdd(this,_intersectionListener,__name(e=>{e.isIntersecting?(intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{maxFPS:5}),__privateGet(this,_tickListener).call(this)):intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener))},"#intersectionListener"))}connectedCallback(){const scrollSelector=this.getAttribute("data-scroll");let scrollElement=null;scrollSelector&&(scrollSelector==="parent"?scrollElement=this.parentElement:scrollElement=document.querySelector(scrollSelector)),scrollElement||(scrollElement=dom.findScrollParentElement(this),scrollElement===document.body&&(scrollElement=window)),__privateSet(this,_isHorizontal,this.hasAttribute("horisontal"));const thumbElement=this.querySelector("[data-thumb]");scrollElement&&thumbElement&&(__privateSet(this,_scrollElement,scrollElement),__privateSet(this,_thumbElement,thumbElement),__privateGet(this,_scrollElement).addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_thumbElement).addEventListener("pointerdown",__privateGet(this,_grabListener)),intersector_index.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,__privateGet(this,_intersectionListener)))}disconnectedCallback(){var _a,_b;(_a=__privateGet(this,_scrollElement))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),(_b=__privateGet(this,_thumbElement))==null||_b.removeEventListener("pointerdown",__privateGet(this,_grabListener)),clearTimeout(__privateGet(this,_activeTimeoutId)),intersector_index.intersector.unsubscribe(__privateGet(this,_intersectionListener)),intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener))}};_scrollElement=new WeakMap,_thumbElement=new WeakMap,_thumbScrollSize=new WeakMap,_limit=new WeakMap,_isHorizontal=new WeakMap,_activeTimeoutId=new WeakMap,_ScrollbarElement_instances=new WeakSet,scrollPosition_get=__name(function(){return __privateGet(this,_scrollElement)instanceof HTMLElement?__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scrollLeft:__privateGet(this,_scrollElement).scrollTop:__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scrollX:__privateGet(this,_scrollElement).scrollY},"#scrollPosition"),scrollSize_get=__name(function(){return __privateGet(this,_scrollElement)instanceof HTMLElement?__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scrollWidth:__privateGet(this,_scrollElement).scrollHeight:__privateGet(this,_isHorizontal)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},"#scrollSize"),scrollViewportSize_get=__name(function(){return __privateGet(this,_scrollElement)instanceof HTMLElement?__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).offsetWidth:__privateGet(this,_scrollElement).offsetHeight:__privateGet(this,_isHorizontal)?innerWidth:innerHeight},"#scrollViewportSize"),_scrollListener=new WeakMap,_resizeListener=new WeakMap,_grabListener=new WeakMap,_tickListener=new WeakMap,_intersectionListener=new WeakMap,__name(_ScrollbarElement,"ScrollbarElement");let ScrollbarElement=_ScrollbarElement;intersector_index.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",ScrollbarElement);const scrollKeys=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var _cssDisabled,_cssDamping,_value,_currentRoundedValue,_needSync,_tweened,_SmoothScrollElement_instances,checkDisabled_fn,destroyTweened_fn,_wheelListener,_pointerdownListener,_resizeListener2,_keydownListener,_scrollListener2;const _SmoothScrollElement=class _SmoothScrollElement extends HTMLElement{constructor(){super(...arguments);__privateAdd(this,_SmoothScrollElement_instances);__privateAdd(this,_cssDisabled,new cssProperty_index.CSSProperty(this,"--smooth-scroll-disabled",!1));__privateAdd(this,_cssDamping,new cssProperty_index.CSSProperty(this,"--smooth-scroll-damping",10));__privateAdd(this,_value,new Damped.Damped(0));__privateAdd(this,_currentRoundedValue,0);__privateAdd(this,_needSync,!1);__privateAdd(this,_tweened);__privateAdd(this,_wheelListener,__name(e=>{if(!(__privateMethod(this,_SmoothScrollElement_instances,checkDisabled_fn).call(this)||Viewport.device.isMobile)){if(__privateMethod(this,_SmoothScrollElement_instances,destroyTweened_fn).call(this),Math.sign(e.deltaY)<0&&__privateGet(this,_value).target===0&&__privateGet(this,_value).direction<0||Math.sign(e.deltaY)>0&&__privateGet(this,_value).target===__privateGet(this,_value).max&&__privateGet(this,_value).direction>0||e.stopPropagation(),e.target instanceof Element){const preventElement=e.target.closest("[data-prevent-smooth-scroll]");if(preventElement){const attrValue=preventElement.getAttribute("data-prevent-smooth-scroll");if(attrValue){if(matchMedia(attrValue).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}},"#wheelListener"));__privateAdd(this,_pointerdownListener,__name(e=>{if(!(e.button!==0||__privateMethod(this,_SmoothScrollElement_instances,checkDisabled_fn).call(this))&&e.target instanceof Element){const anchorElement=e.target.closest("a");if(anchorElement){this.stop();const url=new URL(anchorElement.href);url.hash&&(e.preventDefault(),scroll.scrollToElement(url.hash,{behavior:anchorElement.getAttribute("data-behavior")||"smooth",center:anchorElement.hasAttribute("data-center"),offset:anchorElement.getAttribute("data-offset")||void 0,scrollElement:this,scrollCallback:__name((top,behaviour)=>{const duration=parseFloat(anchorElement.getAttribute("data-duration")||"0"),easing=anchorElement.getAttribute("data-easing");duration?(__privateGet(this,_tweened)&&__privateGet(this,_tweened).close(),__privateSet(this,_tweened,new Tweened.Tweened(__privateGet(this,_value).current,{duration,easing,order:order_index.TICK_ORDER.SCROLL})),__privateGet(this,_tweened).subscribe(e2=>{this.setPosition(e2.current,{equalize:!0})}),__privateGet(this,_tweened).set(top,{duration,easing})):this.setPosition(top,{equalize:behaviour==="instant"})},"scrollCallback")}))}}},"#pointerdownListener"));__privateAdd(this,_resizeListener2,__name(()=>{this.resize(),this.sync()},"#resizeListener"));__privateAdd(this,_keydownListener,__name(e=>{__privateMethod(this,_SmoothScrollElement_instances,checkDisabled_fn).call(this)||(__privateMethod(this,_SmoothScrollElement_instances,destroyTweened_fn).call(this),scrollKeys.has(e.code)&&this.stop())},"#keydownListener"));__privateAdd(this,_scrollListener2,__name(()=>{Viewport.device.isMobile&&this.sync()},"#scrollListener"))}resize(){__privateGet(this,_value).min=0,__privateGet(this,_value).max=this.scrollHeight-this.offsetHeight}stop(){__privateGet(this,_value).unlistenAnimationFrame(),__privateSet(this,_needSync,!0)}sync(){const currentValue=this.scrollTop;(Viewport.device.isMobile||__privateGet(this,_needSync)||Math.abs(currentValue-__privateGet(this,_value).current)>100)&&(__privateSet(this,_needSync,!1),__privateGet(this,_value).set(currentValue,{equalize:!0}))}shiftPosition(value){this.resize(),this.sync(),__privateGet(this,_value).shift(value)}setPosition(value,options){this.resize(),this.sync(),__privateGet(this,_value).set(value,options)}connectedCallback(){window.addEventListener("resize",__privateGet(this,_resizeListener2)),this.addEventListener("keydown",__privateGet(this,_keydownListener)),document.documentElement.addEventListener("pointerdown",__privateGet(this,_pointerdownListener)),this.addEventListener("wheel",__privateGet(this,_wheelListener),{passive:!1}),this.addEventListener("scroll",__privateGet(this,_scrollListener2)),__privateGet(this,_value).set(this.scrollTop,{equalize:!0}),__privateGet(this,_value).subscribe(e=>{var _a;const roundedCurrent=Math.round(e.current);scrollEntries_index.scrollEntries.update(this,"y",e.current),roundedCurrent!==__privateGet(this,_currentRoundedValue)&&(!Viewport.device.isMobile||(_a=__privateGet(this,_tweened))!=null&&_a.isRunning.current)&&this.scroll({top:roundedCurrent,behavior:"instant"}),__privateSet(this,_currentRoundedValue,roundedCurrent)}),__privateGet(this,_cssDamping).observe(),__privateGet(this,_cssDisabled).observe(),__privateGet(this,_cssDamping).subscribe(e=>{__privateGet(this,_value).damping=e.current}),scrollEntries_index.scrollEntries.register(this),this.resize()}disconnectedCallback(){var _a;__privateGet(this,_value).close(),__privateGet(this,_cssDamping).close(),__privateGet(this,_cssDisabled).close(),(_a=__privateGet(this,_tweened))==null||_a.close(),scrollEntries_index.scrollEntries.unregister(this),window.removeEventListener("resize",__privateGet(this,_resizeListener2)),this.removeEventListener("keydown",__privateGet(this,_keydownListener)),document.documentElement.removeEventListener("pointerdown",__privateGet(this,_pointerdownListener)),this.removeEventListener("wheel",__privateGet(this,_wheelListener)),this.removeEventListener("scroll",__privateGet(this,_scrollListener2))}};_cssDisabled=new WeakMap,_cssDamping=new WeakMap,_value=new WeakMap,_currentRoundedValue=new WeakMap,_needSync=new WeakMap,_tweened=new WeakMap,_SmoothScrollElement_instances=new WeakSet,checkDisabled_fn=__name(function(){return __privateGet(this,_cssDisabled).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},"#checkDisabled"),destroyTweened_fn=__name(function(){var _a;(_a=__privateGet(this,_tweened))==null||_a.close(),__privateSet(this,_tweened,void 0)},"#destroyTweened"),_wheelListener=new WeakMap,_pointerdownListener=new WeakMap,_resizeListener2=new WeakMap,_keydownListener=new WeakMap,_scrollListener2=new WeakMap,__name(_SmoothScrollElement,"SmoothScrollElement");let SmoothScrollElement=_SmoothScrollElement;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",SmoothScrollElement);var _statusHolderElement,_progressHolderElement,_scrollElement2,_statusHolderCSSProperty,_progressHolderCSSProperty,_disabledCSSProperty,_startOffsetCSSProperty,_startOffsetMinCSSProperty,_startExtraOffsetCSSProperty,_distanceCSSProperty,_distanceOffsetCSSProperty,_progressVarCSSProperty,_enterOnceCSSProperty,_status,_initialPosition,_start,_finish,_distance,_scrolled,_progress,_visible,_ScrollRegionElement_instances,addGlobalClasses_fn,removeGlobalClasses_fn,init_fn,_resizeListener3,_tickListener2,enter_fn,exit_fn,cssVar_fn,_readyStateChangeListener;const _ScrollRegionElement=class _ScrollRegionElement extends HTMLElement{constructor(){super(...arguments);__privateAdd(this,_ScrollRegionElement_instances);__privateAdd(this,_statusHolderElement,this);__privateAdd(this,_progressHolderElement,this);__privateAdd(this,_scrollElement2,null);__privateAdd(this,_statusHolderCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-status-holder",!1));__privateAdd(this,_progressHolderCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-progress-holder",!1));__privateAdd(this,_disabledCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-disabled",!1));__privateAdd(this,_startOffsetCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));__privateAdd(this,_startOffsetMinCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));__privateAdd(this,_startExtraOffsetCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));__privateAdd(this,_distanceCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));__privateAdd(this,_distanceOffsetCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));__privateAdd(this,_progressVarCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-progress-var",""));__privateAdd(this,_enterOnceCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-enter-once",!1));__privateAdd(this,_status,new elementLinkedStore_index.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));__privateAdd(this,_initialPosition,0);__privateAdd(this,_start,0);__privateAdd(this,_finish,0);__privateAdd(this,_distance,0);__privateAdd(this,_scrolled,0);__privateAdd(this,_progress,0);__privateAdd(this,_visible,!1);__privateAdd(this,_resizeListener3,__name(()=>{this.resize()},"#resizeListener"));__privateAdd(this,_tickListener2,__name(()=>{this.tick()},"#tickListener"));__privateAdd(this,_readyStateChangeListener,__name(()=>{document.readyState==="complete"&&__privateMethod(this,_ScrollRegionElement_instances,init_fn).call(this)},"#readyStateChangeListener"))}get start(){return __privateGet(this,_start)}get finish(){return __privateGet(this,_finish)}get distance(){return __privateGet(this,_distance)}get scrolled(){return __privateGet(this,_scrolled)}get progress(){return __privateGet(this,_progress)}get status(){return __privateGet(this,_status)}get scrollValue(){return __privateGet(this,_scrollElement2)instanceof HTMLElement?__privateGet(this,_scrollElement2).scrollTop:__privateGet(this,_scrollElement2).scrollY}resize(){__privateGet(this,_disabledCSSProperty).current||(__privateSet(this,_initialPosition,layout.getCumulativeOffsetTop(this)),__privateSet(this,_start,__privateGet(this,_initialPosition)),typeof __privateGet(this,_startOffsetMinCSSProperty).current=="number"?__privateSet(this,_start,__privateGet(this,_start)+Math.max(__privateGet(this,_startOffsetCSSProperty).current,__privateGet(this,_startOffsetMinCSSProperty).current)):__privateSet(this,_start,__privateGet(this,_start)+__privateGet(this,_startOffsetCSSProperty).current),__privateSet(this,_start,__privateGet(this,_start)+__privateGet(this,_startExtraOffsetCSSProperty).current),__privateSet(this,_start,__privateGet(this,_start)-layout.getStickyOffset(this,"top")),__privateSet(this,_finish,__privateGet(this,_start)),__privateGet(this,_distanceCSSProperty).current?__privateSet(this,_finish,__privateGet(this,_finish)+__privateGet(this,_distanceCSSProperty).current):__privateSet(this,_finish,__privateGet(this,_finish)+this.offsetHeight),__privateSet(this,_finish,__privateGet(this,_finish)+__privateGet(this,_distanceOffsetCSSProperty).current),__privateSet(this,_distance,__privateGet(this,_finish)-__privateGet(this,_start)),__privateSet(this,_visible,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(__privateGet(this,_disabledCSSProperty).current)return;const scrollValue=this.scrollValue;__privateSet(this,_scrolled,math.clamp(scrollValue-__privateGet(this,_start),0,__privateGet(this,_distance))),__privateSet(this,_progress,__privateGet(this,_scrolled)/__privateGet(this,_distance)||0),__privateGet(this,_progressVarCSSProperty).current&&__privateGet(this,_progressHolderElement).style.setProperty(__privateMethod(this,_ScrollRegionElement_instances,cssVar_fn).call(this,__privateGet(this,_progressVarCSSProperty).current),__privateGet(this,_progress).toFixed(6)),__privateGet(this,_status).set("activated",scrollValue>=__privateGet(this,_start)),__privateGet(this,_visible)&&__privateGet(this,_status).isFalse("entered")&&scrollValue>=__privateGet(this,_start)&&scrollValue<=__privateGet(this,_finish)?__privateMethod(this,_ScrollRegionElement_instances,enter_fn).call(this):__privateGet(this,_visible)&&!__privateGet(this,_enterOnceCSSProperty).current&&__privateGet(this,_status).isTrue("entered")&&(scrollValue<__privateGet(this,_start)||scrollValue>__privateGet(this,_finish))&&__privateMethod(this,_ScrollRegionElement_instances,exit_fn).call(this),__privateGet(this,_enterOnceCSSProperty).current&&__privateGet(this,_progress)===1&&(__privateGet(this,_status).current.entered||__privateMethod(this,_ScrollRegionElement_instances,enter_fn).call(this),this.destroy()),events.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:__privateGet(this,_progress),scrolled:__privateGet(this,_scrolled)}})}destroy(){document.removeEventListener("readystatechange",__privateGet(this,_readyStateChangeListener)),this.disable(!1),__privateGet(this,_statusHolderCSSProperty).close(),__privateGet(this,_progressHolderCSSProperty).close(),__privateGet(this,_disabledCSSProperty).close(),__privateGet(this,_startOffsetCSSProperty).close(),__privateGet(this,_startOffsetMinCSSProperty).close(),__privateGet(this,_startExtraOffsetCSSProperty).close(),__privateGet(this,_distanceCSSProperty).close(),__privateGet(this,_distanceOffsetCSSProperty).close(),__privateGet(this,_progressVarCSSProperty).close(),__privateGet(this,_enterOnceCSSProperty).close()}enable(){intersector_index.ticker.subscribe(__privateGet(this,_tickListener2),{culling:this}),elementResizer_index.elementResizer.subscribe(this,__privateGet(this,_resizeListener3)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener3)),__privateGet(this,_tickListener2).call(this),__privateGet(this,_status).set("enabled",!0)}disable(resetStatus=!0){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener2)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener3)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener3)),resetStatus&&__privateGet(this,_status).reset(),__privateMethod(this,_ScrollRegionElement_instances,removeGlobalClasses_fn).call(this)}connectedCallback(){const scrollSelector=this.getAttribute("data-scroll")||".page-scroll";__privateSet(this,_scrollElement2,document.querySelector(scrollSelector)),document.readyState==="complete"?__privateGet(this,_readyStateChangeListener).call(this):document.addEventListener("readystatechange",__privateGet(this,_readyStateChangeListener))}disconnectedCallback(){this.destroy()}};_statusHolderElement=new WeakMap,_progressHolderElement=new WeakMap,_scrollElement2=new WeakMap,_statusHolderCSSProperty=new WeakMap,_progressHolderCSSProperty=new WeakMap,_disabledCSSProperty=new WeakMap,_startOffsetCSSProperty=new WeakMap,_startOffsetMinCSSProperty=new WeakMap,_startExtraOffsetCSSProperty=new WeakMap,_distanceCSSProperty=new WeakMap,_distanceOffsetCSSProperty=new WeakMap,_progressVarCSSProperty=new WeakMap,_enterOnceCSSProperty=new WeakMap,_status=new WeakMap,_initialPosition=new WeakMap,_start=new WeakMap,_finish=new WeakMap,_distance=new WeakMap,_scrolled=new WeakMap,_progress=new WeakMap,_visible=new WeakMap,_ScrollRegionElement_instances=new WeakSet,addGlobalClasses_fn=__name(function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},"#addGlobalClasses"),removeGlobalClasses_fn=__name(function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},"#removeGlobalClasses"),init_fn=__name(function(){__privateGet(this,_statusHolderCSSProperty).subscribe(e=>{__privateGet(this,_statusHolderElement)&&__privateGet(this,_status).removeElement(__privateGet(this,_statusHolderElement)),__privateSet(this,_statusHolderElement,e.current?document.querySelector(e.current)||this:this),__privateGet(this,_status).addElement(__privateGet(this,_statusHolderElement))}),__privateGet(this,_progressHolderCSSProperty).subscribe(e=>{__privateGet(this,_progressHolderElement)&&__privateGet(this,_progressHolderElement).style.removeProperty(__privateMethod(this,_ScrollRegionElement_instances,cssVar_fn).call(this,__privateGet(this,_progressVarCSSProperty).current)),__privateSet(this,_progressHolderElement,e.current?document.querySelector(e.current)||this:this)}),__privateGet(this,_disabledCSSProperty).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),__privateGet(this,_progressVarCSSProperty).subscribe(e=>{e.current?__privateGet(this,_tickListener2).call(this):e.previous&&__privateGet(this,_progressHolderElement).style.removeProperty(__privateMethod(this,_ScrollRegionElement_instances,cssVar_fn).call(this,e.previous))}),__privateGet(this,_distanceCSSProperty).subscribe(()=>{__privateGet(this,_resizeListener3).call(this)}),__privateGet(this,_statusHolderCSSProperty).observe(),__privateGet(this,_progressHolderCSSProperty).observe(),__privateGet(this,_disabledCSSProperty).observe(),__privateGet(this,_startOffsetCSSProperty).observe(),__privateGet(this,_startOffsetMinCSSProperty).observe(),__privateGet(this,_startExtraOffsetCSSProperty).observe(),__privateGet(this,_distanceCSSProperty).observe(),__privateGet(this,_distanceOffsetCSSProperty).observe(),__privateGet(this,_progressVarCSSProperty).observe(),__privateGet(this,_enterOnceCSSProperty).observe()},"#init"),_resizeListener3=new WeakMap,_tickListener2=new WeakMap,enter_fn=__name(function(){const scrollValue=this.scrollValue;__privateGet(this,_status).set("entered",!0),scrollValue===0&&__privateGet(this,_status).set("enteredOnLoad",!0),__privateMethod(this,_ScrollRegionElement_instances,addGlobalClasses_fn).call(this),events.dispatchEvent(this,"scrollRegionEnter")},"#enter"),exit_fn=__name(function(){__privateGet(this,_status).set("entered",!1),__privateMethod(this,_ScrollRegionElement_instances,removeGlobalClasses_fn).call(this),events.dispatchEvent(this,"scrollRegionExit")},"#exit"),cssVar_fn=__name(function(value){return`--${value}`},"#cssVar"),_readyStateChangeListener=new WeakMap,__name(_ScrollRegionElement,"ScrollRegionElement");let ScrollRegionElement=_ScrollRegionElement;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",ScrollRegionElement);exports.ScrollRegionElement=ScrollRegionElement;exports.ScrollbarElement=ScrollbarElement;exports.SmoothScrollElement=SmoothScrollElement;
|
|
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 intersector_index=require("../index-Cz5-98rw.cjs"),dom=require("../dom-B40i6NXw.cjs"),gestures=require("../gestures-DtYbQr49.cjs");require("construct-style-sheets-polyfill");const order_index=require("../order/index.cjs");require("../Store-BkYJHJp5.cjs");const scroll=require("../scroll-Dv9QcIKd.cjs"),Damped=require("../Damped-CYCcZu-z.cjs"),Tweened=require("../Tweened-BoGo9vz9.cjs"),cssProperty_index=require("../css-property/index.cjs"),Viewport=require("../Viewport-DwPeXyM2.cjs"),scrollEntries_index=require("../scroll-entries/index.cjs"),elementLinkedStore_index=require("../element-linked-store/index.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),events=require("../events-UlGk63iC.cjs"),layout=require("../layout-CnGLl7oe.cjs"),loading=require("../loading-CLclsL2B.cjs"),math=require("../math-C-knY2TL.cjs"),windowResizer_index=require("../window-resizer/index.cjs");var _scrollElement,_thumbElement,_thumbScrollSize,_limit,_isHorizontal,_activeTimeoutId,_ScrollbarElement_instances,scrollPosition_get,scrollSize_get,scrollViewportSize_get,_scrollListener,_resizeListener,_grabListener,_tickListener,_intersectionListener;const _ScrollbarElement=class _ScrollbarElement extends HTMLElement{constructor(){super(...arguments);__privateAdd(this,_ScrollbarElement_instances);__privateAdd(this,_scrollElement,null);__privateAdd(this,_thumbElement,null);__privateAdd(this,_thumbScrollSize,0);__privateAdd(this,_limit,0);__privateAdd(this,_isHorizontal,!1);__privateAdd(this,_activeTimeoutId);__privateAdd(this,_scrollListener,__name(()=>{this.classList.add("active"),clearTimeout(__privateGet(this,_activeTimeoutId));const position=__privateGet(this,_ScrollbarElement_instances,scrollPosition_get)/__privateGet(this,_limit)*__privateGet(this,_thumbScrollSize);__privateGet(this,_isHorizontal)?__privateGet(this,_thumbElement).style.transform=`translate3d(${position}px, 0px, 0px)`:__privateGet(this,_thumbElement).style.transform=`translate3d(0px, ${position}px, 0px)`,__privateSet(this,_activeTimeoutId,setTimeout(()=>{this.classList.remove("active")},1e3))},"#scrollListener"));__privateAdd(this,_resizeListener,__name(()=>{const barSize=__privateGet(this,_isHorizontal)?this.offsetWidth:this.offsetHeight,scrollSize=__privateGet(this,_ScrollbarElement_instances,scrollSize_get),viewportSize=__privateGet(this,_ScrollbarElement_instances,scrollViewportSize_get);__privateSet(this,_limit,scrollSize-viewportSize);let thumbSize=barSize*barSize/(__privateGet(this,_limit)+barSize);thumbSize=Math.max(thumbSize,30),__privateGet(this,_isHorizontal)?(__privateGet(this,_thumbElement).style.width=thumbSize+"px",__privateGet(this,_thumbElement).style.height="100%"):(__privateGet(this,_thumbElement).style.width="100%",__privateGet(this,_thumbElement).style.height=thumbSize+"px"),__privateSet(this,_thumbScrollSize,barSize-thumbSize),scrollSize<=viewportSize?this.style.display="none":this.style.display="block"},"#resizeListener"));__privateAdd(this,_grabListener,__name(grabEvent=>{const startValue=__privateGet(this,_ScrollbarElement_instances,scrollPosition_get),grabCursor=__privateGet(this,_isHorizontal)?grabEvent.x:grabEvent.y;gestures.setupDrag(moveEvent=>{const mult=__privateGet(this,_limit)/__privateGet(this,_thumbScrollSize),delta=(__privateGet(this,_isHorizontal)?moveEvent.x-grabCursor:moveEvent.y-grabCursor)*mult;__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scroll({left:startValue+delta,behavior:"instant"}):__privateGet(this,_scrollElement).scroll({top:startValue+delta,behavior:"instant"})})},"#grabListener"));__privateAdd(this,_tickListener,__name(()=>{__privateGet(this,_resizeListener).call(this)},"#tickListener"));__privateAdd(this,_intersectionListener,__name(e=>{e.isIntersecting?(intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{maxFPS:5}),__privateGet(this,_tickListener).call(this)):intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener))},"#intersectionListener"))}connectedCallback(){const scrollSelector=this.getAttribute("data-scroll");let scrollElement=null;scrollSelector&&(scrollSelector==="parent"?scrollElement=this.parentElement:scrollElement=document.querySelector(scrollSelector)),scrollElement||(scrollElement=dom.findScrollParentElement(this),scrollElement===document.body&&(scrollElement=window)),__privateSet(this,_isHorizontal,this.hasAttribute("horisontal"));const thumbElement=this.querySelector("[data-thumb]");scrollElement&&thumbElement&&(__privateSet(this,_scrollElement,scrollElement),__privateSet(this,_thumbElement,thumbElement),__privateGet(this,_scrollElement).addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_thumbElement).addEventListener("pointerdown",__privateGet(this,_grabListener)),intersector_index.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,__privateGet(this,_intersectionListener)))}disconnectedCallback(){var _a,_b;(_a=__privateGet(this,_scrollElement))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),(_b=__privateGet(this,_thumbElement))==null||_b.removeEventListener("pointerdown",__privateGet(this,_grabListener)),clearTimeout(__privateGet(this,_activeTimeoutId)),intersector_index.intersector.unsubscribe(__privateGet(this,_intersectionListener)),intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener))}};_scrollElement=new WeakMap,_thumbElement=new WeakMap,_thumbScrollSize=new WeakMap,_limit=new WeakMap,_isHorizontal=new WeakMap,_activeTimeoutId=new WeakMap,_ScrollbarElement_instances=new WeakSet,scrollPosition_get=__name(function(){return __privateGet(this,_scrollElement)instanceof HTMLElement?__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scrollLeft:__privateGet(this,_scrollElement).scrollTop:__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scrollX:__privateGet(this,_scrollElement).scrollY},"#scrollPosition"),scrollSize_get=__name(function(){return __privateGet(this,_scrollElement)instanceof HTMLElement?__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).scrollWidth:__privateGet(this,_scrollElement).scrollHeight:__privateGet(this,_isHorizontal)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},"#scrollSize"),scrollViewportSize_get=__name(function(){return __privateGet(this,_scrollElement)instanceof HTMLElement?__privateGet(this,_isHorizontal)?__privateGet(this,_scrollElement).offsetWidth:__privateGet(this,_scrollElement).offsetHeight:__privateGet(this,_isHorizontal)?innerWidth:innerHeight},"#scrollViewportSize"),_scrollListener=new WeakMap,_resizeListener=new WeakMap,_grabListener=new WeakMap,_tickListener=new WeakMap,_intersectionListener=new WeakMap,__name(_ScrollbarElement,"ScrollbarElement");let ScrollbarElement=_ScrollbarElement;intersector_index.isBrowser&&!customElements.get("e-scrollbar")&&customElements.define("e-scrollbar",ScrollbarElement);const scrollKeys=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","Space"]);var _cssDisabled,_cssDamping,_value,_currentRoundedValue,_needSync,_tweened,_SmoothScrollElement_instances,checkDisabled_fn,destroyTweened_fn,_wheelListener,_pointerdownListener,_resizeListener2,_keydownListener,_scrollListener2;const _SmoothScrollElement=class _SmoothScrollElement extends HTMLElement{constructor(){super(...arguments);__privateAdd(this,_SmoothScrollElement_instances);__privateAdd(this,_cssDisabled,new cssProperty_index.CSSProperty(this,"--smooth-scroll-disabled",!1));__privateAdd(this,_cssDamping,new cssProperty_index.CSSProperty(this,"--smooth-scroll-damping",10));__privateAdd(this,_value,new Damped.Damped(0));__privateAdd(this,_currentRoundedValue,0);__privateAdd(this,_needSync,!1);__privateAdd(this,_tweened);__privateAdd(this,_wheelListener,__name(e=>{if(!(__privateMethod(this,_SmoothScrollElement_instances,checkDisabled_fn).call(this)||Viewport.device.isMobile)){if(__privateMethod(this,_SmoothScrollElement_instances,destroyTweened_fn).call(this),Math.sign(e.deltaY)<0&&__privateGet(this,_value).target===0&&__privateGet(this,_value).direction<0||Math.sign(e.deltaY)>0&&__privateGet(this,_value).target===__privateGet(this,_value).max&&__privateGet(this,_value).direction>0||e.stopPropagation(),e.target instanceof Element){const preventElement=e.target.closest("[data-prevent-smooth-scroll]");if(preventElement){const attrValue=preventElement.getAttribute("data-prevent-smooth-scroll");if(attrValue){if(matchMedia(attrValue).matches)return}else return}}Math.abs(e.deltaX)>Math.abs(e.deltaY)||(e.preventDefault(),this.shiftPosition(e.deltaY))}},"#wheelListener"));__privateAdd(this,_pointerdownListener,__name(e=>{if(!(e.button!==0||__privateMethod(this,_SmoothScrollElement_instances,checkDisabled_fn).call(this))&&e.target instanceof Element){const anchorElement=e.target.closest("a");if(anchorElement){this.stop();const url=new URL(anchorElement.href);url.hash&&(e.preventDefault(),scroll.scrollToElement(url.hash,{behavior:anchorElement.getAttribute("data-behavior")||"smooth",center:anchorElement.hasAttribute("data-center"),offset:anchorElement.getAttribute("data-offset")||void 0,scrollElement:this,scrollCallback:__name((top,behaviour)=>{const duration=parseFloat(anchorElement.getAttribute("data-duration")||"0"),easing=anchorElement.getAttribute("data-easing");duration?(__privateGet(this,_tweened)&&__privateGet(this,_tweened).close(),__privateSet(this,_tweened,new Tweened.Tweened(__privateGet(this,_value).current,{duration,easing,order:order_index.TICK_ORDER.SCROLL})),__privateGet(this,_tweened).subscribe(e2=>{this.setPosition(e2.current,{equalize:!0})}),__privateGet(this,_tweened).set(top,{duration,easing})):this.setPosition(top,{equalize:behaviour==="instant"})},"scrollCallback")}))}}},"#pointerdownListener"));__privateAdd(this,_resizeListener2,__name(()=>{this.resize(),this.sync()},"#resizeListener"));__privateAdd(this,_keydownListener,__name(e=>{__privateMethod(this,_SmoothScrollElement_instances,checkDisabled_fn).call(this)||(__privateMethod(this,_SmoothScrollElement_instances,destroyTweened_fn).call(this),scrollKeys.has(e.code)&&this.stop())},"#keydownListener"));__privateAdd(this,_scrollListener2,__name(()=>{Viewport.device.isMobile&&this.sync()},"#scrollListener"))}resize(){__privateGet(this,_value).min=0,__privateGet(this,_value).max=this.scrollHeight-this.offsetHeight}stop(){__privateGet(this,_value).unlistenAnimationFrame(),__privateSet(this,_needSync,!0)}sync(){const currentValue=this.scrollTop;(Viewport.device.isMobile||__privateGet(this,_needSync)||Math.abs(currentValue-__privateGet(this,_value).current)>100)&&(__privateSet(this,_needSync,!1),__privateGet(this,_value).set(currentValue,{equalize:!0}))}shiftPosition(value){this.resize(),this.sync(),__privateGet(this,_value).shift(value)}setPosition(value,options){this.resize(),this.sync(),__privateGet(this,_value).set(value,options)}connectedCallback(){window.addEventListener("resize",__privateGet(this,_resizeListener2)),this.addEventListener("keydown",__privateGet(this,_keydownListener)),document.documentElement.addEventListener("pointerdown",__privateGet(this,_pointerdownListener)),this.addEventListener("wheel",__privateGet(this,_wheelListener),{passive:!1}),this.addEventListener("scroll",__privateGet(this,_scrollListener2)),__privateGet(this,_value).set(this.scrollTop,{equalize:!0}),__privateGet(this,_value).subscribe(e=>{var _a;const roundedCurrent=Math.round(e.current);scrollEntries_index.scrollEntries.update(this,"y",e.current),roundedCurrent!==__privateGet(this,_currentRoundedValue)&&(!Viewport.device.isMobile||(_a=__privateGet(this,_tweened))!=null&&_a.isRunning.current)&&this.scroll({top:roundedCurrent,behavior:"instant"}),__privateSet(this,_currentRoundedValue,roundedCurrent)}),__privateGet(this,_cssDamping).observe(),__privateGet(this,_cssDisabled).observe(),__privateGet(this,_cssDamping).subscribe(e=>{__privateGet(this,_value).damping=e.current}),scrollEntries_index.scrollEntries.register(this),this.resize()}disconnectedCallback(){var _a;__privateGet(this,_value).close(),__privateGet(this,_cssDamping).close(),__privateGet(this,_cssDisabled).close(),(_a=__privateGet(this,_tweened))==null||_a.close(),scrollEntries_index.scrollEntries.unregister(this),window.removeEventListener("resize",__privateGet(this,_resizeListener2)),this.removeEventListener("keydown",__privateGet(this,_keydownListener)),document.documentElement.removeEventListener("pointerdown",__privateGet(this,_pointerdownListener)),this.removeEventListener("wheel",__privateGet(this,_wheelListener)),this.removeEventListener("scroll",__privateGet(this,_scrollListener2))}};_cssDisabled=new WeakMap,_cssDamping=new WeakMap,_value=new WeakMap,_currentRoundedValue=new WeakMap,_needSync=new WeakMap,_tweened=new WeakMap,_SmoothScrollElement_instances=new WeakSet,checkDisabled_fn=__name(function(){return __privateGet(this,_cssDisabled).current||getComputedStyle(this).getPropertyValue("overflow")==="hidden"},"#checkDisabled"),destroyTweened_fn=__name(function(){var _a;(_a=__privateGet(this,_tweened))==null||_a.close(),__privateSet(this,_tweened,void 0)},"#destroyTweened"),_wheelListener=new WeakMap,_pointerdownListener=new WeakMap,_resizeListener2=new WeakMap,_keydownListener=new WeakMap,_scrollListener2=new WeakMap,__name(_SmoothScrollElement,"SmoothScrollElement");let SmoothScrollElement=_SmoothScrollElement;customElements.get("e-smooth-scroll")||customElements.define("e-smooth-scroll",SmoothScrollElement);var _statusHolderElement,_progressHolderElement,_scrollElement2,_statusHolderCSSProperty,_progressHolderCSSProperty,_disabledCSSProperty,_startOffsetCSSProperty,_startOffsetMinCSSProperty,_startExtraOffsetCSSProperty,_distanceCSSProperty,_distanceOffsetCSSProperty,_progressVarCSSProperty,_enterOnceCSSProperty,_status,_initialPosition,_start,_finish,_distance,_scrolled,_progress,_visible,_loadingUnsub,_ScrollRegionElement_instances,addGlobalClasses_fn,removeGlobalClasses_fn,init_fn,_resizeListener3,_tickListener2,enter_fn,exit_fn,cssVar_fn,_loadingListener;const _ScrollRegionElement=class _ScrollRegionElement extends HTMLElement{constructor(){super(...arguments);__privateAdd(this,_ScrollRegionElement_instances);__privateAdd(this,_statusHolderElement,this);__privateAdd(this,_progressHolderElement,this);__privateAdd(this,_scrollElement2,null);__privateAdd(this,_statusHolderCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-status-holder",!1));__privateAdd(this,_progressHolderCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-progress-holder",!1));__privateAdd(this,_disabledCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-disabled",!1));__privateAdd(this,_startOffsetCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-start-offset",0,{rawValueCheck:!1}));__privateAdd(this,_startOffsetMinCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-start-offset-min",!1,{rawValueCheck:!1}));__privateAdd(this,_startExtraOffsetCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-start-extra-offset",0,{rawValueCheck:!1}));__privateAdd(this,_distanceCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-distance",0,{rawValueCheck:!1}));__privateAdd(this,_distanceOffsetCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-distance-offset",0,{rawValueCheck:!1}));__privateAdd(this,_progressVarCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-progress-var",""));__privateAdd(this,_enterOnceCSSProperty,new cssProperty_index.CSSProperty(this,"--scroll-region-enter-once",!1));__privateAdd(this,_status,new elementLinkedStore_index.ElementLinkedStore(this,{enabled:!1,entered:!1,enteredOnLoad:!1,activated:!1}));__privateAdd(this,_initialPosition,0);__privateAdd(this,_start,0);__privateAdd(this,_finish,0);__privateAdd(this,_distance,0);__privateAdd(this,_scrolled,0);__privateAdd(this,_progress,0);__privateAdd(this,_visible,!1);__privateAdd(this,_loadingUnsub);__privateAdd(this,_resizeListener3,__name(()=>{this.resize()},"#resizeListener"));__privateAdd(this,_tickListener2,__name(()=>{this.tick()},"#tickListener"));__privateAdd(this,_loadingListener,__name(()=>{__privateMethod(this,_ScrollRegionElement_instances,init_fn).call(this)},"#loadingListener"))}get start(){return __privateGet(this,_start)}get finish(){return __privateGet(this,_finish)}get distance(){return __privateGet(this,_distance)}get scrolled(){return __privateGet(this,_scrolled)}get progress(){return __privateGet(this,_progress)}get status(){return __privateGet(this,_status)}get scrollValue(){return __privateGet(this,_scrollElement2)instanceof HTMLElement?__privateGet(this,_scrollElement2).scrollTop:__privateGet(this,_scrollElement2).scrollY}resize(){__privateGet(this,_disabledCSSProperty).current||(__privateSet(this,_initialPosition,layout.getCumulativeOffsetTop(this)),__privateSet(this,_start,__privateGet(this,_initialPosition)),typeof __privateGet(this,_startOffsetMinCSSProperty).current=="number"?__privateSet(this,_start,__privateGet(this,_start)+Math.max(__privateGet(this,_startOffsetCSSProperty).current,__privateGet(this,_startOffsetMinCSSProperty).current)):__privateSet(this,_start,__privateGet(this,_start)+__privateGet(this,_startOffsetCSSProperty).current),__privateSet(this,_start,__privateGet(this,_start)+__privateGet(this,_startExtraOffsetCSSProperty).current),__privateSet(this,_start,__privateGet(this,_start)-layout.getStickyOffset(this,"top")),__privateSet(this,_finish,__privateGet(this,_start)),__privateGet(this,_distanceCSSProperty).current?__privateSet(this,_finish,__privateGet(this,_finish)+__privateGet(this,_distanceCSSProperty).current):__privateSet(this,_finish,__privateGet(this,_finish)+this.offsetHeight),__privateSet(this,_finish,__privateGet(this,_finish)+__privateGet(this,_distanceOffsetCSSProperty).current),__privateSet(this,_distance,__privateGet(this,_finish)-__privateGet(this,_start)),__privateSet(this,_visible,this.offsetWidth!==0&&this.offsetHeight!==0),this.tick())}tick(){if(__privateGet(this,_disabledCSSProperty).current)return;const scrollValue=this.scrollValue;__privateSet(this,_scrolled,math.clamp(scrollValue-__privateGet(this,_start),0,__privateGet(this,_distance))),__privateSet(this,_progress,__privateGet(this,_scrolled)/__privateGet(this,_distance)||0),__privateGet(this,_progressVarCSSProperty).current&&__privateGet(this,_progressHolderElement).style.setProperty(__privateMethod(this,_ScrollRegionElement_instances,cssVar_fn).call(this,__privateGet(this,_progressVarCSSProperty).current),__privateGet(this,_progress).toFixed(6)),__privateGet(this,_status).set("activated",scrollValue>=__privateGet(this,_start)),__privateGet(this,_visible)&&__privateGet(this,_status).isFalse("entered")&&scrollValue>=__privateGet(this,_start)&&scrollValue<=__privateGet(this,_finish)?__privateMethod(this,_ScrollRegionElement_instances,enter_fn).call(this):__privateGet(this,_visible)&&!__privateGet(this,_enterOnceCSSProperty).current&&__privateGet(this,_status).isTrue("entered")&&(scrollValue<__privateGet(this,_start)||scrollValue>__privateGet(this,_finish))&&__privateMethod(this,_ScrollRegionElement_instances,exit_fn).call(this),__privateGet(this,_enterOnceCSSProperty).current&&__privateGet(this,_progress)===1&&(__privateGet(this,_status).current.entered||__privateMethod(this,_ScrollRegionElement_instances,enter_fn).call(this),this.destroy()),events.dispatchEvent(this,"scrollRegionProgress",{detail:{progress:__privateGet(this,_progress),scrolled:__privateGet(this,_scrolled)}})}destroy(){var _a;(_a=__privateGet(this,_loadingUnsub))==null||_a.call(this),this.disable(!1),__privateGet(this,_statusHolderCSSProperty).close(),__privateGet(this,_progressHolderCSSProperty).close(),__privateGet(this,_disabledCSSProperty).close(),__privateGet(this,_startOffsetCSSProperty).close(),__privateGet(this,_startOffsetMinCSSProperty).close(),__privateGet(this,_startExtraOffsetCSSProperty).close(),__privateGet(this,_distanceCSSProperty).close(),__privateGet(this,_distanceOffsetCSSProperty).close(),__privateGet(this,_progressVarCSSProperty).close(),__privateGet(this,_enterOnceCSSProperty).close()}enable(){intersector_index.ticker.subscribe(__privateGet(this,_tickListener2),{culling:this}),elementResizer_index.elementResizer.subscribe(this,__privateGet(this,_resizeListener3)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener3)),__privateGet(this,_tickListener2).call(this),__privateGet(this,_status).set("enabled",!0)}disable(resetStatus=!0){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener2)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener3)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener3)),resetStatus&&__privateGet(this,_status).reset(),__privateMethod(this,_ScrollRegionElement_instances,removeGlobalClasses_fn).call(this)}connectedCallback(){const scrollSelector=this.getAttribute("data-scroll")||".page-scroll";__privateSet(this,_scrollElement2,document.querySelector(scrollSelector)),__privateSet(this,_loadingUnsub,loading.requestLoadingCallback("load",__privateGet(this,_loadingListener)))}disconnectedCallback(){this.destroy()}};_statusHolderElement=new WeakMap,_progressHolderElement=new WeakMap,_scrollElement2=new WeakMap,_statusHolderCSSProperty=new WeakMap,_progressHolderCSSProperty=new WeakMap,_disabledCSSProperty=new WeakMap,_startOffsetCSSProperty=new WeakMap,_startOffsetMinCSSProperty=new WeakMap,_startExtraOffsetCSSProperty=new WeakMap,_distanceCSSProperty=new WeakMap,_distanceOffsetCSSProperty=new WeakMap,_progressVarCSSProperty=new WeakMap,_enterOnceCSSProperty=new WeakMap,_status=new WeakMap,_initialPosition=new WeakMap,_start=new WeakMap,_finish=new WeakMap,_distance=new WeakMap,_scrolled=new WeakMap,_progress=new WeakMap,_visible=new WeakMap,_loadingUnsub=new WeakMap,_ScrollRegionElement_instances=new WeakSet,addGlobalClasses_fn=__name(function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.add(this.getAttribute("data-global-class"))},"#addGlobalClasses"),removeGlobalClasses_fn=__name(function(){this.hasAttribute("data-global-class")&&document.documentElement.classList.remove(this.getAttribute("data-global-class"))},"#removeGlobalClasses"),init_fn=__name(function(){__privateGet(this,_statusHolderCSSProperty).subscribe(e=>{__privateGet(this,_statusHolderElement)&&__privateGet(this,_status).removeElement(__privateGet(this,_statusHolderElement)),__privateSet(this,_statusHolderElement,e.current?document.querySelector(e.current)||this:this),__privateGet(this,_status).addElement(__privateGet(this,_statusHolderElement))}),__privateGet(this,_progressHolderCSSProperty).subscribe(e=>{__privateGet(this,_progressHolderElement)&&__privateGet(this,_progressHolderElement).style.removeProperty(__privateMethod(this,_ScrollRegionElement_instances,cssVar_fn).call(this,__privateGet(this,_progressVarCSSProperty).current)),__privateSet(this,_progressHolderElement,e.current?document.querySelector(e.current)||this:this)}),__privateGet(this,_disabledCSSProperty).subscribe(e=>{e.current&&!e.previous?this.disable():this.enable()}),__privateGet(this,_progressVarCSSProperty).subscribe(e=>{e.current?__privateGet(this,_tickListener2).call(this):e.previous&&__privateGet(this,_progressHolderElement).style.removeProperty(__privateMethod(this,_ScrollRegionElement_instances,cssVar_fn).call(this,e.previous))}),__privateGet(this,_distanceCSSProperty).subscribe(()=>{__privateGet(this,_resizeListener3).call(this)}),__privateGet(this,_statusHolderCSSProperty).observe(),__privateGet(this,_progressHolderCSSProperty).observe(),__privateGet(this,_disabledCSSProperty).observe(),__privateGet(this,_startOffsetCSSProperty).observe(),__privateGet(this,_startOffsetMinCSSProperty).observe(),__privateGet(this,_startExtraOffsetCSSProperty).observe(),__privateGet(this,_distanceCSSProperty).observe(),__privateGet(this,_distanceOffsetCSSProperty).observe(),__privateGet(this,_progressVarCSSProperty).observe(),__privateGet(this,_enterOnceCSSProperty).observe()},"#init"),_resizeListener3=new WeakMap,_tickListener2=new WeakMap,enter_fn=__name(function(){const scrollValue=this.scrollValue;__privateGet(this,_status).set("entered",!0),scrollValue===0&&__privateGet(this,_status).set("enteredOnLoad",!0),__privateMethod(this,_ScrollRegionElement_instances,addGlobalClasses_fn).call(this),events.dispatchEvent(this,"scrollRegionEnter")},"#enter"),exit_fn=__name(function(){__privateGet(this,_status).set("entered",!1),__privateMethod(this,_ScrollRegionElement_instances,removeGlobalClasses_fn).call(this),events.dispatchEvent(this,"scrollRegionExit")},"#exit"),cssVar_fn=__name(function(value){return`--${value}`},"#cssVar"),_loadingListener=new WeakMap,__name(_ScrollRegionElement,"ScrollRegionElement");let ScrollRegionElement=_ScrollRegionElement;customElements.get("e-scroll-region")||customElements.define("e-scroll-region",ScrollRegionElement);exports.ScrollRegionElement=ScrollRegionElement;exports.ScrollbarElement=ScrollbarElement;exports.SmoothScrollElement=SmoothScrollElement;
|
package/lib/scroll-kit/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { ElementLinkedStore } from "../element-linked-store/index.js";
|
|
|
21
21
|
import { elementResizer } from "../element-resizer/index.js";
|
|
22
22
|
import { d as dispatchEvent } from "../events-Ds-TuvYW.js";
|
|
23
23
|
import { b as getCumulativeOffsetTop, g as getStickyOffset } from "../layout-BL6AX9-r.js";
|
|
24
|
+
import { r as requestLoadingCallback } from "../loading-BeSsYMFd.js";
|
|
24
25
|
import { c as clamp } from "../math-r8V23YFe.js";
|
|
25
26
|
import { windowResizer } from "../window-resizer/index.js";
|
|
26
27
|
var _scrollElement, _thumbElement, _thumbScrollSize, _limit, _isHorizontal, _activeTimeoutId, _ScrollbarElement_instances, scrollPosition_get, scrollSize_get, scrollViewportSize_get, _scrollListener, _resizeListener, _grabListener, _tickListener, _intersectionListener;
|
|
@@ -234,7 +235,7 @@ _cssDisabled = new WeakMap(), _cssDamping = new WeakMap(), _value = new WeakMap(
|
|
|
234
235
|
}, "#destroyTweened"), _wheelListener = new WeakMap(), _pointerdownListener = new WeakMap(), _resizeListener2 = new WeakMap(), _keydownListener = new WeakMap(), _scrollListener2 = new WeakMap(), __name(_SmoothScrollElement, "SmoothScrollElement");
|
|
235
236
|
let SmoothScrollElement = _SmoothScrollElement;
|
|
236
237
|
customElements.get("e-smooth-scroll") || customElements.define("e-smooth-scroll", SmoothScrollElement);
|
|
237
|
-
var _statusHolderElement, _progressHolderElement, _scrollElement2, _statusHolderCSSProperty, _progressHolderCSSProperty, _disabledCSSProperty, _startOffsetCSSProperty, _startOffsetMinCSSProperty, _startExtraOffsetCSSProperty, _distanceCSSProperty, _distanceOffsetCSSProperty, _progressVarCSSProperty, _enterOnceCSSProperty, _status, _initialPosition, _start, _finish, _distance, _scrolled, _progress, _visible, _ScrollRegionElement_instances, addGlobalClasses_fn, removeGlobalClasses_fn, init_fn, _resizeListener3, _tickListener2, enter_fn, exit_fn, cssVar_fn,
|
|
238
|
+
var _statusHolderElement, _progressHolderElement, _scrollElement2, _statusHolderCSSProperty, _progressHolderCSSProperty, _disabledCSSProperty, _startOffsetCSSProperty, _startOffsetMinCSSProperty, _startExtraOffsetCSSProperty, _distanceCSSProperty, _distanceOffsetCSSProperty, _progressVarCSSProperty, _enterOnceCSSProperty, _status, _initialPosition, _start, _finish, _distance, _scrolled, _progress, _visible, _loadingUnsub, _ScrollRegionElement_instances, addGlobalClasses_fn, removeGlobalClasses_fn, init_fn, _resizeListener3, _tickListener2, enter_fn, exit_fn, cssVar_fn, _loadingListener;
|
|
238
239
|
const _ScrollRegionElement = class _ScrollRegionElement extends HTMLElement {
|
|
239
240
|
constructor() {
|
|
240
241
|
super(...arguments);
|
|
@@ -320,15 +321,16 @@ const _ScrollRegionElement = class _ScrollRegionElement extends HTMLElement {
|
|
|
320
321
|
__privateAdd(this, _scrolled, 0);
|
|
321
322
|
__privateAdd(this, _progress, 0);
|
|
322
323
|
__privateAdd(this, _visible, !1);
|
|
324
|
+
__privateAdd(this, _loadingUnsub);
|
|
323
325
|
__privateAdd(this, _resizeListener3, /* @__PURE__ */ __name(() => {
|
|
324
326
|
this.resize();
|
|
325
327
|
}, "#resizeListener"));
|
|
326
328
|
__privateAdd(this, _tickListener2, /* @__PURE__ */ __name(() => {
|
|
327
329
|
this.tick();
|
|
328
330
|
}, "#tickListener"));
|
|
329
|
-
__privateAdd(this,
|
|
330
|
-
|
|
331
|
-
}, "#
|
|
331
|
+
__privateAdd(this, _loadingListener, /* @__PURE__ */ __name(() => {
|
|
332
|
+
__privateMethod(this, _ScrollRegionElement_instances, init_fn).call(this);
|
|
333
|
+
}, "#loadingListener"));
|
|
332
334
|
}
|
|
333
335
|
get start() {
|
|
334
336
|
return __privateGet(this, _start);
|
|
@@ -372,10 +374,8 @@ const _ScrollRegionElement = class _ScrollRegionElement extends HTMLElement {
|
|
|
372
374
|
});
|
|
373
375
|
}
|
|
374
376
|
destroy() {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
__privateGet(this, _readyStateChangeListener)
|
|
378
|
-
), this.disable(!1), __privateGet(this, _statusHolderCSSProperty).close(), __privateGet(this, _progressHolderCSSProperty).close(), __privateGet(this, _disabledCSSProperty).close(), __privateGet(this, _startOffsetCSSProperty).close(), __privateGet(this, _startOffsetMinCSSProperty).close(), __privateGet(this, _startExtraOffsetCSSProperty).close(), __privateGet(this, _distanceCSSProperty).close(), __privateGet(this, _distanceOffsetCSSProperty).close(), __privateGet(this, _progressVarCSSProperty).close(), __privateGet(this, _enterOnceCSSProperty).close();
|
|
377
|
+
var _a;
|
|
378
|
+
(_a = __privateGet(this, _loadingUnsub)) == null || _a.call(this), this.disable(!1), __privateGet(this, _statusHolderCSSProperty).close(), __privateGet(this, _progressHolderCSSProperty).close(), __privateGet(this, _disabledCSSProperty).close(), __privateGet(this, _startOffsetCSSProperty).close(), __privateGet(this, _startOffsetMinCSSProperty).close(), __privateGet(this, _startExtraOffsetCSSProperty).close(), __privateGet(this, _distanceCSSProperty).close(), __privateGet(this, _distanceOffsetCSSProperty).close(), __privateGet(this, _progressVarCSSProperty).close(), __privateGet(this, _enterOnceCSSProperty).close();
|
|
379
379
|
}
|
|
380
380
|
enable() {
|
|
381
381
|
ticker.subscribe(__privateGet(this, _tickListener2), { culling: this }), elementResizer.subscribe(this, __privateGet(this, _resizeListener3)), windowResizer.subscribe(__privateGet(this, _resizeListener3)), __privateGet(this, _tickListener2).call(this), __privateGet(this, _status).set("enabled", !0);
|
|
@@ -385,16 +385,13 @@ const _ScrollRegionElement = class _ScrollRegionElement extends HTMLElement {
|
|
|
385
385
|
}
|
|
386
386
|
connectedCallback() {
|
|
387
387
|
const scrollSelector = this.getAttribute("data-scroll") || ".page-scroll";
|
|
388
|
-
__privateSet(this, _scrollElement2, document.querySelector(scrollSelector)),
|
|
389
|
-
"readystatechange",
|
|
390
|
-
__privateGet(this, _readyStateChangeListener)
|
|
391
|
-
);
|
|
388
|
+
__privateSet(this, _scrollElement2, document.querySelector(scrollSelector)), __privateSet(this, _loadingUnsub, requestLoadingCallback("load", __privateGet(this, _loadingListener)));
|
|
392
389
|
}
|
|
393
390
|
disconnectedCallback() {
|
|
394
391
|
this.destroy();
|
|
395
392
|
}
|
|
396
393
|
};
|
|
397
|
-
_statusHolderElement = new WeakMap(), _progressHolderElement = new WeakMap(), _scrollElement2 = new WeakMap(), _statusHolderCSSProperty = new WeakMap(), _progressHolderCSSProperty = new WeakMap(), _disabledCSSProperty = new WeakMap(), _startOffsetCSSProperty = new WeakMap(), _startOffsetMinCSSProperty = new WeakMap(), _startExtraOffsetCSSProperty = new WeakMap(), _distanceCSSProperty = new WeakMap(), _distanceOffsetCSSProperty = new WeakMap(), _progressVarCSSProperty = new WeakMap(), _enterOnceCSSProperty = new WeakMap(), _status = new WeakMap(), _initialPosition = new WeakMap(), _start = new WeakMap(), _finish = new WeakMap(), _distance = new WeakMap(), _scrolled = new WeakMap(), _progress = new WeakMap(), _visible = new WeakMap(), _ScrollRegionElement_instances = new WeakSet(), addGlobalClasses_fn = /* @__PURE__ */ __name(function() {
|
|
394
|
+
_statusHolderElement = new WeakMap(), _progressHolderElement = new WeakMap(), _scrollElement2 = new WeakMap(), _statusHolderCSSProperty = new WeakMap(), _progressHolderCSSProperty = new WeakMap(), _disabledCSSProperty = new WeakMap(), _startOffsetCSSProperty = new WeakMap(), _startOffsetMinCSSProperty = new WeakMap(), _startExtraOffsetCSSProperty = new WeakMap(), _distanceCSSProperty = new WeakMap(), _distanceOffsetCSSProperty = new WeakMap(), _progressVarCSSProperty = new WeakMap(), _enterOnceCSSProperty = new WeakMap(), _status = new WeakMap(), _initialPosition = new WeakMap(), _start = new WeakMap(), _finish = new WeakMap(), _distance = new WeakMap(), _scrolled = new WeakMap(), _progress = new WeakMap(), _visible = new WeakMap(), _loadingUnsub = new WeakMap(), _ScrollRegionElement_instances = new WeakSet(), addGlobalClasses_fn = /* @__PURE__ */ __name(function() {
|
|
398
395
|
this.hasAttribute("data-global-class") && document.documentElement.classList.add(
|
|
399
396
|
this.getAttribute("data-global-class")
|
|
400
397
|
);
|
|
@@ -425,7 +422,7 @@ _statusHolderElement = new WeakMap(), _progressHolderElement = new WeakMap(), _s
|
|
|
425
422
|
__privateGet(this, _status).set("entered", !1), __privateMethod(this, _ScrollRegionElement_instances, removeGlobalClasses_fn).call(this), dispatchEvent(this, "scrollRegionExit");
|
|
426
423
|
}, "#exit"), cssVar_fn = /* @__PURE__ */ __name(function(value) {
|
|
427
424
|
return `--${value}`;
|
|
428
|
-
}, "#cssVar"),
|
|
425
|
+
}, "#cssVar"), _loadingListener = new WeakMap(), __name(_ScrollRegionElement, "ScrollRegionElement");
|
|
429
426
|
let ScrollRegionElement = _ScrollRegionElement;
|
|
430
427
|
customElements.get("e-scroll-region") || customElements.define("e-scroll-region", ScrollRegionElement);
|
|
431
428
|
export {
|
package/lib/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const attributes=require("../attributes-BADnRZpK.cjs"),intersector_index=require("../index-Cz5-98rw.cjs"),canvas=require("../canvas-BP1ceie3.cjs"),coordinates=require("../coordinates-DQ9XV9M1.cjs"),customElements=require("../custom-elements-BfZCJde6.cjs"),dom=require("../dom-B40i6NXw.cjs"),easings=require("../easings-YkfoM7J2.cjs"),element=require("../element-CqD0jqBJ.cjs"),events=require("../events-UlGk63iC.cjs"),file=require("../file-RHfA3OS-.cjs"),_function=require("../function-H4b_gTg6.cjs"),gestures=require("../gestures-DtYbQr49.cjs"),stylesheet=require("../stylesheet-iyJcMTje.cjs"),layout=require("../layout-CnGLl7oe.cjs"),math=require("../math-C-knY2TL.cjs"),metadata=require("../metadata-BrHUfpV9.cjs"),morph=require("../morph-Buhxq-X0.cjs"),number=require("../number-Bu4sGvW7.cjs"),object=require("../object-DTY_W6xG.cjs"),polyfills=require("../polyfills-DZCuDBkA.cjs"),promises=require("../promises-nDm8_iG6.cjs"),scroll=require("../scroll-Dv9QcIKd.cjs"),string=require("../string-Bx5N38JG.cjs"),style=require("../style-IDJ6db6n.cjs"),url=require("../url-CPCO10Sy.cjs");function insert(arr,index,...newItems){return[...arr.slice(0,index),...newItems,...arr.slice(index)]}__name(insert,"insert");function shiftArray(arr,positions){const len=arr.length;positions=positions%len;const result=new Array(len);for(let i=0;i<len;i++){const newPos=(i+positions)%len;result[newPos]=arr[i]}return result}__name(shiftArray,"shiftArray");function formatBytes(bytes,decimals=2){if(!+bytes)return"0 Bytes";const k=1024,dm=decimals<0?0:decimals,sizes=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(bytes)/Math.log(k));return`${parseFloat((bytes/Math.pow(k,i)).toFixed(dm))} ${sizes[i]}`}__name(formatBytes,"formatBytes");function copyTextToClipboard(text){if(navigator.clipboard)navigator.clipboard.writeText(text).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(err=>{console.error("Failed to copy text to clipboard:",err)});else{const textArea=document.createElement("textarea");textArea.value=text,textArea.style.position="fixed",textArea.style.top="0",textArea.style.left="0",document.body.appendChild(textArea),textArea.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(err){console.error("Failed to copy text to clipboard:",err)}document.body.removeChild(textArea)}}__name(copyTextToClipboard,"copyTextToClipboard");function dotRectCollision(dot,rect){return dot.x<rect.x+rect.width&&dot.x>rect.x&&dot.y<rect.y+rect.height&&dot.y>rect.y}__name(dotRectCollision,"dotRectCollision");function dotCircleCollision(dot,circle){return Math.sqrt((dot.x-circle.x)**2+(dot.y-circle.y)**2)<circle.radius}__name(dotCircleCollision,"dotCircleCollision");function dotPolygonCollision(dot,polygon){let inside=!1;const{x,y}=dot;for(let i=0,j=polygon.length-1;i<polygon.length;j=i++){const xi=polygon[i].x,yi=polygon[i].y,xj=polygon[j].x,yj=polygon[j].y;yi>y!=yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi&&(inside=!inside)}return inside}__name(dotPolygonCollision,"dotPolygonCollision");function rgbToHex(r,g,b){const toHex=__name(c=>{const hex=c.toString(16);return hex.length===1?"0"+hex:hex},"toHex");return`#${toHex(r)}${toHex(g)}${toHex(b)}`}__name(rgbToHex,"rgbToHex");function getStyleRuleActualValue(rule,name){const obj=rule.style.getPropertyValue(name);if(obj){const stringValue=obj.toString();return stringValue.startsWith("var")?getStyleRuleActualValue(rule,stringValue.slice(4,-1)):stringValue}}__name(getStyleRuleActualValue,"getStyleRuleActualValue");function getRootVariables(...names){const variables={};return Array.from(document.styleSheets).forEach(stylesheet2=>{Array.from(stylesheet2.cssRules).forEach(rule=>{rule instanceof CSSStyleRule&&rule.selectorText===":root"&&names.forEach(name=>{const value=getStyleRuleActualValue(rule,name);value&&(variables[name]=value)})})}),names.forEach(name=>{variables[name]||console.warn(`variable named ${name} not found`)}),variables}__name(getRootVariables,"getRootVariables");function encode(string2){const decodedStr=window.atob(string2);return decodeURIComponent(window.escape(decodedStr))}__name(encode,"encode");function decode(string2){const encodedStr=window.unescape(encodeURIComponent(string2));return window.btoa(encodedStr)}__name(decode,"decode");const phoneRegex=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,emailRegex=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function tryCreateHrefFromContact(contact){let href,type;return emailRegex.test(contact)?(href=`mailto:${contact.trim()}`,type="email"):phoneRegex.test(contact)&&(href=`tel:${contact.replace(/[^0-9\\.\\+]+/g,"")}`,type="phone"),{href,type,contact}}__name(tryCreateHrefFromContact,"tryCreateHrefFromContact");function transliterate(text,options={}){const{separator="-",lowercase=!0,replaceNumbers=!0,maxLength=60}=options,charMap={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"j",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sh",ъ:"",ы:"y",ь:"",э:"e",ю:"yu",я:"ya"};let result=text.replace(/[а-яё]/gi,char=>{const lowerChar=char.toLowerCase(),replacement=charMap[lowerChar]||"";return char===lowerChar?replacement:replacement.toUpperCase()});if(replaceNumbers){const numberMap={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};result=result.replace(/[0-9]/g,num=>numberMap[num]||num)}return lowercase&&(result=result.toLowerCase()),result=result.replace(/[^\w\-]+/g,separator).replace(new RegExp(`\\${separator}+`,"g"),separator).replace(new RegExp(`(^\\${separator}|\\${separator}$)`,"g"),""),maxLength>0&&result.length>maxLength&&(result=result.substring(0,maxLength).replace(new RegExp(`\\${separator}[^\\${separator}]*$`),"")),result}__name(transliterate,"transliterate");function requestLoadingCallback(event,callback){let idleId,timeoutId;const domListener=__name(()=>{window.removeEventListener("DOMContentLoaded",loadListener),callback()},"domListener"),loadListener=__name(()=>{window.removeEventListener("load",loadListener),callback()},"loadListener"),idleListener=__name(()=>{idleId=void 0,callback()},"idleListener"),delayListener=__name(()=>{window.removeEventListener("load",loadListener),timeoutId=setTimeout(()=>{requestAnimationFrame(()=>{callback()})},1e3)},"delayListener"),clear=__name(()=>{window.removeEventListener("DOMContentLoaded",domListener),window.removeEventListener("load",loadListener),window.removeEventListener("load",delayListener),idleId&&window.cancelIdleCallback&&window.cancelIdleCallback(idleId),clearTimeout(timeoutId)},"clear");return event==="idle"&&window.requestIdleCallback?idleId=window.requestIdleCallback(idleListener,{timeout:1e4}):event==="load"?document.readyState==="complete"?loadListener():window.addEventListener("load",loadListener):event==="loadWithDelay"?document.readyState==="complete"?delayListener():window.addEventListener("load",delayListener):event==="DOMContentLoaded"&&window.addEventListener("DOMContentLoaded",domListener),clear}__name(requestLoadingCallback,"requestLoadingCallback");function splitPropgress(progress,items,initialItemsWithFullProgress=0){const totalItems=items-initialItemsWithFullProgress,splitted=[];for(let item=0;item<items;item++){const offset=item/totalItems-initialItemsWithFullProgress/totalItems,itemProgress=Math.min(1,Math.max(0,(progress-offset)*totalItems));splitted.push(itemProgress)}return splitted}__name(splitPropgress,"splitPropgress");function setElementsProgress(progress,elements,initialItemsWithFullProgress=0){const totalItems=elements.length-initialItemsWithFullProgress;elements.forEach((el,index)=>{const offset=index/totalItems-initialItemsWithFullProgress/totalItems,itemProgress=Math.min(1,Math.max(0,(progress-offset)*totalItems));el.style.setProperty("--item-progress",itemProgress.toString())})}__name(setElementsProgress,"setElementsProgress");function setActiveContentClasses(index,elements){elements.forEach((el,i)=>{i>index?(el.classList.remove("current","previous"),el.classList.add("next")):i<index?(el.classList.remove("current","next"),el.classList.add("previous")):(el.classList.remove("previous","next"),el.classList.add("current"))})}__name(setActiveContentClasses,"setActiveContentClasses");function cloneTemplateContent(templateElement,callback){if(templateElement){const element2=templateElement.content.cloneNode(!0).firstElementChild;return element2&&(callback==null||callback(element2)),element2}return null}__name(cloneTemplateContent,"cloneTemplateContent");function setIntervalOnIntersection(element2,delay,callback,options){let intervalId,isIntersecting=!1,current=0,previous=0,tickerUnsubsribe;const toggleInterval=__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe(),options!=null&&options.restartCounter&&(current=0),isIntersecting&&(callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker(),intervalId=setInterval(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),current++,callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker()},delay))},"toggleInterval"),restartTicker=__name(()=>intersector_index.ticker.subscribe(e=>{const progress=e.timeElapsedSinceSubscription/delay;callback({current,previous,progress})}),"restartTicker"),intersectorUnsubscribe=intersector_index.intersector.subscribe(element2,e=>{isIntersecting=e.isIntersecting,toggleInterval()});return{destroy:__name(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),intersectorUnsubscribe(),clearInterval(intervalId)},"destroy"),restart:__name((currentValue,previousValue)=>{current=currentValue||0,previousValue&&(previous=previousValue),toggleInterval()},"restart"),stop:__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe()},"stop")}}__name(setIntervalOnIntersection,"setIntervalOnIntersection");exports.getElementAttributesAdvanced=attributes.getElementAttributesAdvanced;exports.parseAttribute=attributes.parseAttribute;exports.parseAttributeValue=attributes.parseAttributeValue;exports.parseAttributeValueAdvanced=attributes.parseAttributeValueAdvanced;exports.isBrowser=intersector_index.isBrowser;exports.contain=canvas.contain;exports.cover=canvas.cover;exports.fixPosition=canvas.fixPosition;exports.measureText=canvas.measureText;exports.getPointerPosition=coordinates.getPointerPosition;exports.normalize=coordinates.normalize;exports.screenToCartesian=coordinates.screenToCartesian;exports.whenDefined=customElements.whenDefined;exports.createScriptElement=dom.createScriptElement;exports.deepQuerySelectorAll=dom.deepQuerySelectorAll;exports.excludeElements=dom.excludeElements;exports.findParentElement=dom.findParentElement;exports.findScrollParentElement=dom.findScrollParentElement;exports.getAllParentElements=dom.getAllParentElements;exports.getElement=dom.getElement;exports.intersectElements=dom.intersectElements;exports.traverseNodes=dom.traverseNodes;exports.traverseShadowRoots=dom.traverseShadowRoots;exports.easeInCubic=easings.easeInCubic;exports.easeInExpo=easings.easeInExpo;exports.easeInOutCubic=easings.easeInOutCubic;exports.easeInOutExpo=easings.easeInOutExpo;exports.easeInOutQuad=easings.easeInOutQuad;exports.easeInOutQuart=easings.easeInOutQuart;exports.easeInOutQuint=easings.easeInOutQuint;exports.easeInQuad=easings.easeInQuad;exports.easeInQuart=easings.easeInQuart;exports.easeInQuint=easings.easeInQuint;exports.easeOutCubic=easings.easeOutCubic;exports.easeOutExpo=easings.easeOutExpo;exports.easeOutQuad=easings.easeOutQuad;exports.easeOutQuart=easings.easeOutQuart;exports.easeOutQuint=easings.easeOutQuint;exports.easings=easings.easings;exports.linear=easings.linear;exports.isElementVisible=element.isElementVisible;exports.dispatchEvent=events.dispatchEvent;exports.createJSONAndSave=file.createJSONAndSave;exports.downloadURI=file.downloadURI;exports.debounce=_function.debounce;exports.throttle=_function.throttle;exports.setupDrag=gestures.setupDrag;exports.createStylesheet=stylesheet.createStylesheet;exports.styleToString=stylesheet.styleToString;exports.getCumulativeOffsetLeft=layout.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=layout.getCumulativeOffsetTop;exports.getCumulativePosition=layout.getCumulativePosition;exports.getStickyOffset=layout.getStickyOffset;exports.calculateDistance=math.calculateDistance;exports.calculateDistanceWithRadius=math.calculateDistanceWithRadius;exports.clamp=math.clamp;exports.damp=math.damp;exports.lerp=math.lerp;exports.mapRange=math.mapRange;exports.round=math.round;exports.smootherstep=math.smootherstep;exports.smoothstep=math.smoothstep;exports.step=math.step;exports.formatMediaDuration=metadata.formatMediaDuration;exports.ACTION_CREATE=morph.ACTION_CREATE;exports.ACTION_PRESERVE=morph.ACTION_PRESERVE;exports.ACTION_REMOVE=morph.ACTION_REMOVE;exports.ACTION_REMOVE_ATTR=morph.ACTION_REMOVE_ATTR;exports.ACTION_REPLACE=morph.ACTION_REPLACE;exports.ACTION_SET_ATTR=morph.ACTION_SET_ATTR;exports.ACTION_SKIP=morph.ACTION_SKIP;exports.ACTION_UPDATE=morph.ACTION_UPDATE;exports.NODE_TYPE_COMMENT=morph.NODE_TYPE_COMMENT;exports.NODE_TYPE_DOCUMENT=morph.NODE_TYPE_DOCUMENT;exports.NODE_TYPE_ELEMENT=morph.NODE_TYPE_ELEMENT;exports.NODE_TYPE_TEXT=morph.NODE_TYPE_TEXT;exports.diff=morph.diff;exports.morph=morph.morph;exports.patch=morph.patch;exports.beautifyNumber=number.beautifyNumber;exports.loopNumber=number.loopNumber;exports.preciseNumber=number.preciseNumber;exports.roundNumberTo=number.roundNumberTo;exports.toStep=number.toStep;exports.cloneDeep=object.cloneDeep;exports.compareObjects=object.compareObjects;exports.isESClass=object.isESClass;exports.isNullish=object.isNullish;exports.isObject=object.isObject;exports.mergeDeep=object.mergeDeep;exports.mixin=object.mixin;exports.omit=object.omit;exports.pick=object.pick;exports.nullishCoalescing=polyfills.nullishCoalescing;exports.requestIdleCallback=polyfills.requestIdleCallback;exports.wait=promises.wait;exports.scrollToElement=scroll.scrollToElement;exports.camelToKebab=string.camelToKebab;exports.capitalize=string.capitalize;exports.declension=string.declension;exports.decodeHtmlEntities=string.decodeHtmlEntities;exports.generateId=string.generateId;exports.getRandomChar=string.getRandomChar;exports.isUppercase=string.isUppercase;exports.kebabToCamel=string.kebabToCamel;exports.snakeToDotted=string.snakeToDotted;exports.toPascalCase=string.toPascalCase;exports.uncapitalize=string.uncapitalize;exports.getElementTransitionDurationMS=style.getElementTransitionDurationMS;exports.getElementTransitionDurationS=style.getElementTransitionDurationS;exports.changeHistory=url.changeHistory;exports.isLocalUrl=url.isLocalUrl;exports.normalizeBase=url.normalizeBase;exports.normalizeRelativeURLs=url.normalizeRelativeURLs;exports.normalizeURL=url.normalizeURL;exports.parseSearchParameters=url.parseSearchParameters;exports.searchParamsObjectToString=url.searchParamsObjectToString;exports.searchParamsToObject=url.searchParamsToObject;exports.splitPath=url.splitPath;exports.updateSearchParameter=url.updateSearchParameter;exports.cloneTemplateContent=cloneTemplateContent;exports.copyTextToClipboard=copyTextToClipboard;exports.decode=decode;exports.dotCircleCollision=dotCircleCollision;exports.dotPolygonCollision=dotPolygonCollision;exports.dotRectCollision=dotRectCollision;exports.encode=encode;exports.formatBytes=formatBytes;exports.getRootVariables=getRootVariables;exports.getStyleRuleActualValue=getStyleRuleActualValue;exports.insert=insert;exports.requestLoadingCallback=requestLoadingCallback;exports.rgbToHex=rgbToHex;exports.setActiveContentClasses=setActiveContentClasses;exports.setElementsProgress=setElementsProgress;exports.setIntervalOnIntersection=setIntervalOnIntersection;exports.shiftArray=shiftArray;exports.splitPropgress=splitPropgress;exports.transliterate=transliterate;exports.tryCreateHrefFromContact=tryCreateHrefFromContact;
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const attributes=require("../attributes-BADnRZpK.cjs"),intersector_index=require("../index-Cz5-98rw.cjs"),canvas=require("../canvas-BP1ceie3.cjs"),coordinates=require("../coordinates-DQ9XV9M1.cjs"),customElements=require("../custom-elements-BfZCJde6.cjs"),dom=require("../dom-B40i6NXw.cjs"),easings=require("../easings-YkfoM7J2.cjs"),element=require("../element-CqD0jqBJ.cjs"),events=require("../events-UlGk63iC.cjs"),file=require("../file-RHfA3OS-.cjs"),_function=require("../function-H4b_gTg6.cjs"),gestures=require("../gestures-DtYbQr49.cjs"),stylesheet=require("../stylesheet-iyJcMTje.cjs"),layout=require("../layout-CnGLl7oe.cjs"),loading=require("../loading-CLclsL2B.cjs"),math=require("../math-C-knY2TL.cjs"),metadata=require("../metadata-BrHUfpV9.cjs"),morph=require("../morph-Buhxq-X0.cjs"),number=require("../number-Bu4sGvW7.cjs"),object=require("../object-DTY_W6xG.cjs"),polyfills=require("../polyfills-DZCuDBkA.cjs"),promises=require("../promises-nDm8_iG6.cjs"),scroll=require("../scroll-Dv9QcIKd.cjs"),string=require("../string-Bx5N38JG.cjs"),style=require("../style-IDJ6db6n.cjs"),url=require("../url-CPCO10Sy.cjs");function insert(arr,index,...newItems){return[...arr.slice(0,index),...newItems,...arr.slice(index)]}__name(insert,"insert");function shiftArray(arr,positions){const len=arr.length;positions=positions%len;const result=new Array(len);for(let i=0;i<len;i++){const newPos=(i+positions)%len;result[newPos]=arr[i]}return result}__name(shiftArray,"shiftArray");function formatBytes(bytes,decimals=2){if(!+bytes)return"0 Bytes";const k=1024,dm=decimals<0?0:decimals,sizes=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(bytes)/Math.log(k));return`${parseFloat((bytes/Math.pow(k,i)).toFixed(dm))} ${sizes[i]}`}__name(formatBytes,"formatBytes");function copyTextToClipboard(text){if(navigator.clipboard)navigator.clipboard.writeText(text).then(()=>{console.log("Text copied to clipboard successfully!")}).catch(err=>{console.error("Failed to copy text to clipboard:",err)});else{const textArea=document.createElement("textarea");textArea.value=text,textArea.style.position="fixed",textArea.style.top="0",textArea.style.left="0",document.body.appendChild(textArea),textArea.select();try{document.execCommand("copy")?console.log("Text copied to clipboard successfully!"):console.error("Failed to copy text to clipboard.")}catch(err){console.error("Failed to copy text to clipboard:",err)}document.body.removeChild(textArea)}}__name(copyTextToClipboard,"copyTextToClipboard");function dotRectCollision(dot,rect){return dot.x<rect.x+rect.width&&dot.x>rect.x&&dot.y<rect.y+rect.height&&dot.y>rect.y}__name(dotRectCollision,"dotRectCollision");function dotCircleCollision(dot,circle){return Math.sqrt((dot.x-circle.x)**2+(dot.y-circle.y)**2)<circle.radius}__name(dotCircleCollision,"dotCircleCollision");function dotPolygonCollision(dot,polygon){let inside=!1;const{x,y}=dot;for(let i=0,j=polygon.length-1;i<polygon.length;j=i++){const xi=polygon[i].x,yi=polygon[i].y,xj=polygon[j].x,yj=polygon[j].y;yi>y!=yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi&&(inside=!inside)}return inside}__name(dotPolygonCollision,"dotPolygonCollision");function rgbToHex(r,g,b){const toHex=__name(c=>{const hex=c.toString(16);return hex.length===1?"0"+hex:hex},"toHex");return`#${toHex(r)}${toHex(g)}${toHex(b)}`}__name(rgbToHex,"rgbToHex");function getStyleRuleActualValue(rule,name){const obj=rule.style.getPropertyValue(name);if(obj){const stringValue=obj.toString();return stringValue.startsWith("var")?getStyleRuleActualValue(rule,stringValue.slice(4,-1)):stringValue}}__name(getStyleRuleActualValue,"getStyleRuleActualValue");function getRootVariables(...names){const variables={};return Array.from(document.styleSheets).forEach(stylesheet2=>{Array.from(stylesheet2.cssRules).forEach(rule=>{rule instanceof CSSStyleRule&&rule.selectorText===":root"&&names.forEach(name=>{const value=getStyleRuleActualValue(rule,name);value&&(variables[name]=value)})})}),names.forEach(name=>{variables[name]||console.warn(`variable named ${name} not found`)}),variables}__name(getRootVariables,"getRootVariables");function encode(string2){const decodedStr=window.atob(string2);return decodeURIComponent(window.escape(decodedStr))}__name(encode,"encode");function decode(string2){const encodedStr=window.unescape(encodeURIComponent(string2));return window.btoa(encodedStr)}__name(decode,"decode");const phoneRegex=/^(\+?\d{1,3}[-.\s]?)?(\(?\d{3}\)?[-.\s]?)?\d{1,4}[-.\s]?\d{2,4}[-.\s]?\d{2,4}$/,emailRegex=/^[\w.-]+@[a-zA-Z\d.-]+\.[a-zA-Z]{2,}$/;function tryCreateHrefFromContact(contact){let href,type;return emailRegex.test(contact)?(href=`mailto:${contact.trim()}`,type="email"):phoneRegex.test(contact)&&(href=`tel:${contact.replace(/[^0-9\\.\\+]+/g,"")}`,type="phone"),{href,type,contact}}__name(tryCreateHrefFromContact,"tryCreateHrefFromContact");function transliterate(text,options={}){const{separator="-",lowercase=!0,replaceNumbers=!0,maxLength=60}=options,charMap={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"j",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"h",ц:"c",ч:"ch",ш:"sh",щ:"sh",ъ:"",ы:"y",ь:"",э:"e",ю:"yu",я:"ya"};let result=text.replace(/[а-яё]/gi,char=>{const lowerChar=char.toLowerCase(),replacement=charMap[lowerChar]||"";return char===lowerChar?replacement:replacement.toUpperCase()});if(replaceNumbers){const numberMap={0:"zero",1:"one",2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"};result=result.replace(/[0-9]/g,num=>numberMap[num]||num)}return lowercase&&(result=result.toLowerCase()),result=result.replace(/[^\w\-]+/g,separator).replace(new RegExp(`\\${separator}+`,"g"),separator).replace(new RegExp(`(^\\${separator}|\\${separator}$)`,"g"),""),maxLength>0&&result.length>maxLength&&(result=result.substring(0,maxLength).replace(new RegExp(`\\${separator}[^\\${separator}]*$`),"")),result}__name(transliterate,"transliterate");function splitPropgress(progress,items,initialItemsWithFullProgress=0){const totalItems=items-initialItemsWithFullProgress,splitted=[];for(let item=0;item<items;item++){const offset=item/totalItems-initialItemsWithFullProgress/totalItems,itemProgress=Math.min(1,Math.max(0,(progress-offset)*totalItems));splitted.push(itemProgress)}return splitted}__name(splitPropgress,"splitPropgress");function setElementsProgress(progress,elements,initialItemsWithFullProgress=0){const totalItems=elements.length-initialItemsWithFullProgress;elements.forEach((el,index)=>{const offset=index/totalItems-initialItemsWithFullProgress/totalItems,itemProgress=Math.min(1,Math.max(0,(progress-offset)*totalItems));el.style.setProperty("--item-progress",itemProgress.toString())})}__name(setElementsProgress,"setElementsProgress");function setActiveContentClasses(index,elements){elements.forEach((el,i)=>{i>index?(el.classList.remove("current","previous"),el.classList.add("next")):i<index?(el.classList.remove("current","next"),el.classList.add("previous")):(el.classList.remove("previous","next"),el.classList.add("current"))})}__name(setActiveContentClasses,"setActiveContentClasses");function cloneTemplateContent(templateElement,callback){if(templateElement){const element2=templateElement.content.cloneNode(!0).firstElementChild;return element2&&(callback==null||callback(element2)),element2}return null}__name(cloneTemplateContent,"cloneTemplateContent");function setIntervalOnIntersection(element2,delay,callback,options){let intervalId,isIntersecting=!1,current=0,previous=0,tickerUnsubsribe;const toggleInterval=__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe(),options!=null&&options.restartCounter&&(current=0),isIntersecting&&(callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker(),intervalId=setInterval(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),current++,callback({current,previous,progress:0}),previous=current,tickerUnsubsribe=restartTicker()},delay))},"toggleInterval"),restartTicker=__name(()=>intersector_index.ticker.subscribe(e=>{const progress=e.timeElapsedSinceSubscription/delay;callback({current,previous,progress})}),"restartTicker"),intersectorUnsubscribe=intersector_index.intersector.subscribe(element2,e=>{isIntersecting=e.isIntersecting,toggleInterval()});return{destroy:__name(()=>{tickerUnsubsribe==null||tickerUnsubsribe(),intersectorUnsubscribe(),clearInterval(intervalId)},"destroy"),restart:__name((currentValue,previousValue)=>{current=currentValue||0,previousValue&&(previous=previousValue),toggleInterval()},"restart"),stop:__name(()=>{clearInterval(intervalId),tickerUnsubsribe==null||tickerUnsubsribe()},"stop")}}__name(setIntervalOnIntersection,"setIntervalOnIntersection");exports.getElementAttributesAdvanced=attributes.getElementAttributesAdvanced;exports.parseAttribute=attributes.parseAttribute;exports.parseAttributeValue=attributes.parseAttributeValue;exports.parseAttributeValueAdvanced=attributes.parseAttributeValueAdvanced;exports.isBrowser=intersector_index.isBrowser;exports.contain=canvas.contain;exports.cover=canvas.cover;exports.fixPosition=canvas.fixPosition;exports.measureText=canvas.measureText;exports.getPointerPosition=coordinates.getPointerPosition;exports.normalize=coordinates.normalize;exports.screenToCartesian=coordinates.screenToCartesian;exports.whenDefined=customElements.whenDefined;exports.createScriptElement=dom.createScriptElement;exports.deepQuerySelectorAll=dom.deepQuerySelectorAll;exports.excludeElements=dom.excludeElements;exports.findParentElement=dom.findParentElement;exports.findScrollParentElement=dom.findScrollParentElement;exports.getAllParentElements=dom.getAllParentElements;exports.getElement=dom.getElement;exports.intersectElements=dom.intersectElements;exports.traverseNodes=dom.traverseNodes;exports.traverseShadowRoots=dom.traverseShadowRoots;exports.easeInCubic=easings.easeInCubic;exports.easeInExpo=easings.easeInExpo;exports.easeInOutCubic=easings.easeInOutCubic;exports.easeInOutExpo=easings.easeInOutExpo;exports.easeInOutQuad=easings.easeInOutQuad;exports.easeInOutQuart=easings.easeInOutQuart;exports.easeInOutQuint=easings.easeInOutQuint;exports.easeInQuad=easings.easeInQuad;exports.easeInQuart=easings.easeInQuart;exports.easeInQuint=easings.easeInQuint;exports.easeOutCubic=easings.easeOutCubic;exports.easeOutExpo=easings.easeOutExpo;exports.easeOutQuad=easings.easeOutQuad;exports.easeOutQuart=easings.easeOutQuart;exports.easeOutQuint=easings.easeOutQuint;exports.easings=easings.easings;exports.linear=easings.linear;exports.isElementVisible=element.isElementVisible;exports.dispatchEvent=events.dispatchEvent;exports.createJSONAndSave=file.createJSONAndSave;exports.downloadURI=file.downloadURI;exports.debounce=_function.debounce;exports.throttle=_function.throttle;exports.setupDrag=gestures.setupDrag;exports.createStylesheet=stylesheet.createStylesheet;exports.styleToString=stylesheet.styleToString;exports.getCumulativeOffsetLeft=layout.getCumulativeOffsetLeft;exports.getCumulativeOffsetTop=layout.getCumulativeOffsetTop;exports.getCumulativePosition=layout.getCumulativePosition;exports.getStickyOffset=layout.getStickyOffset;exports.requestLoadingCallback=loading.requestLoadingCallback;exports.calculateDistance=math.calculateDistance;exports.calculateDistanceWithRadius=math.calculateDistanceWithRadius;exports.clamp=math.clamp;exports.damp=math.damp;exports.lerp=math.lerp;exports.mapRange=math.mapRange;exports.round=math.round;exports.smootherstep=math.smootherstep;exports.smoothstep=math.smoothstep;exports.step=math.step;exports.formatMediaDuration=metadata.formatMediaDuration;exports.ACTION_CREATE=morph.ACTION_CREATE;exports.ACTION_PRESERVE=morph.ACTION_PRESERVE;exports.ACTION_REMOVE=morph.ACTION_REMOVE;exports.ACTION_REMOVE_ATTR=morph.ACTION_REMOVE_ATTR;exports.ACTION_REPLACE=morph.ACTION_REPLACE;exports.ACTION_SET_ATTR=morph.ACTION_SET_ATTR;exports.ACTION_SKIP=morph.ACTION_SKIP;exports.ACTION_UPDATE=morph.ACTION_UPDATE;exports.NODE_TYPE_COMMENT=morph.NODE_TYPE_COMMENT;exports.NODE_TYPE_DOCUMENT=morph.NODE_TYPE_DOCUMENT;exports.NODE_TYPE_ELEMENT=morph.NODE_TYPE_ELEMENT;exports.NODE_TYPE_TEXT=morph.NODE_TYPE_TEXT;exports.diff=morph.diff;exports.morph=morph.morph;exports.patch=morph.patch;exports.beautifyNumber=number.beautifyNumber;exports.loopNumber=number.loopNumber;exports.preciseNumber=number.preciseNumber;exports.roundNumberTo=number.roundNumberTo;exports.toStep=number.toStep;exports.cloneDeep=object.cloneDeep;exports.compareObjects=object.compareObjects;exports.isESClass=object.isESClass;exports.isNullish=object.isNullish;exports.isObject=object.isObject;exports.mergeDeep=object.mergeDeep;exports.mixin=object.mixin;exports.omit=object.omit;exports.pick=object.pick;exports.nullishCoalescing=polyfills.nullishCoalescing;exports.requestIdleCallback=polyfills.requestIdleCallback;exports.wait=promises.wait;exports.scrollToElement=scroll.scrollToElement;exports.camelToKebab=string.camelToKebab;exports.capitalize=string.capitalize;exports.declension=string.declension;exports.decodeHtmlEntities=string.decodeHtmlEntities;exports.generateId=string.generateId;exports.getRandomChar=string.getRandomChar;exports.isUppercase=string.isUppercase;exports.kebabToCamel=string.kebabToCamel;exports.snakeToDotted=string.snakeToDotted;exports.toPascalCase=string.toPascalCase;exports.uncapitalize=string.uncapitalize;exports.getElementTransitionDurationMS=style.getElementTransitionDurationMS;exports.getElementTransitionDurationS=style.getElementTransitionDurationS;exports.changeHistory=url.changeHistory;exports.isLocalUrl=url.isLocalUrl;exports.normalizeBase=url.normalizeBase;exports.normalizeRelativeURLs=url.normalizeRelativeURLs;exports.normalizeURL=url.normalizeURL;exports.parseSearchParameters=url.parseSearchParameters;exports.searchParamsObjectToString=url.searchParamsObjectToString;exports.searchParamsToObject=url.searchParamsToObject;exports.splitPath=url.splitPath;exports.updateSearchParameter=url.updateSearchParameter;exports.cloneTemplateContent=cloneTemplateContent;exports.copyTextToClipboard=copyTextToClipboard;exports.decode=decode;exports.dotCircleCollision=dotCircleCollision;exports.dotPolygonCollision=dotPolygonCollision;exports.dotRectCollision=dotRectCollision;exports.encode=encode;exports.formatBytes=formatBytes;exports.getRootVariables=getRootVariables;exports.getStyleRuleActualValue=getStyleRuleActualValue;exports.insert=insert;exports.rgbToHex=rgbToHex;exports.setActiveContentClasses=setActiveContentClasses;exports.setElementsProgress=setElementsProgress;exports.setIntervalOnIntersection=setIntervalOnIntersection;exports.shiftArray=shiftArray;exports.splitPropgress=splitPropgress;exports.transliterate=transliterate;exports.tryCreateHrefFromContact=tryCreateHrefFromContact;
|
package/lib/utils/index.js
CHANGED
|
@@ -15,12 +15,13 @@ import { d as d5, t as t2 } from "../function-UmbPrOHm.js";
|
|
|
15
15
|
import { s as s2 } from "../gestures-DmKKNnh4.js";
|
|
16
16
|
import { c as c5, s as s3 } from "../stylesheet-BvD9P5EO.js";
|
|
17
17
|
import { a as a5, b as b4, c as c6, g as g5 } from "../layout-BL6AX9-r.js";
|
|
18
|
-
import {
|
|
18
|
+
import { r } from "../loading-BeSsYMFd.js";
|
|
19
|
+
import { e as e3, f as f4, c as c7, d as d6, l as l2, m as m3, r as r2, b as b5, a as a6, s as s4 } from "../math-r8V23YFe.js";
|
|
19
20
|
import { f as f5 } from "../metadata-BNdkmeeD.js";
|
|
20
21
|
import { A, k as k2, e as e4, i as i5, f as f6, h as h3, j as j2, g as g6, b as b6, c as c8, N, a as a7, d as d7, m as m4, p as p3 } from "../morph-BByLJAAh.js";
|
|
21
|
-
import { b as b7, l as l3, p as p4, r as
|
|
22
|
+
import { b as b7, l as l3, p as p4, r as r3, t as t3 } from "../number-DiVt2xnh.js";
|
|
22
23
|
import { c as c9, d as d8, i as i6, b as b8, a as a8, m as m5, e as e5, o as o2, p as p5 } from "../object-CiIdEmJx.js";
|
|
23
|
-
import { n as n3, r as
|
|
24
|
+
import { n as n3, r as r4 } from "../polyfills-CG1XJNia.js";
|
|
24
25
|
import { w as w2 } from "../promises-BsIKOEDq.js";
|
|
25
26
|
import { s as s5 } from "../scroll-4Z62EGTm.js";
|
|
26
27
|
import { c as c10, a as a9, b as b9, d as d9, g as g7, e as e6, i as i7, k as k3, s as s6, t as t4, u } from "../string-Ct-dy_cs.js";
|
|
@@ -94,12 +95,12 @@ function dotPolygonCollision(dot, polygon) {
|
|
|
94
95
|
return inside;
|
|
95
96
|
}
|
|
96
97
|
__name(dotPolygonCollision, "dotPolygonCollision");
|
|
97
|
-
function rgbToHex(
|
|
98
|
+
function rgbToHex(r5, g9, b11) {
|
|
98
99
|
const toHex = /* @__PURE__ */ __name((c12) => {
|
|
99
100
|
const hex = c12.toString(16);
|
|
100
101
|
return hex.length === 1 ? "0" + hex : hex;
|
|
101
102
|
}, "toHex");
|
|
102
|
-
return `#${toHex(
|
|
103
|
+
return `#${toHex(r5)}${toHex(g9)}${toHex(b11)}`;
|
|
103
104
|
}
|
|
104
105
|
__name(rgbToHex, "rgbToHex");
|
|
105
106
|
function getStyleRuleActualValue(rule, name) {
|
|
@@ -203,26 +204,6 @@ function transliterate(text, options = {}) {
|
|
|
203
204
|
return lowercase && (result = result.toLowerCase()), result = result.replace(/[^\w\-]+/g, separator).replace(new RegExp(`\\${separator}+`, "g"), separator).replace(new RegExp(`(^\\${separator}|\\${separator}$)`, "g"), ""), maxLength > 0 && result.length > maxLength && (result = result.substring(0, maxLength).replace(new RegExp(`\\${separator}[^\\${separator}]*$`), "")), result;
|
|
204
205
|
}
|
|
205
206
|
__name(transliterate, "transliterate");
|
|
206
|
-
function requestLoadingCallback(event, callback) {
|
|
207
|
-
let idleId, timeoutId;
|
|
208
|
-
const domListener = /* @__PURE__ */ __name(() => {
|
|
209
|
-
window.removeEventListener("DOMContentLoaded", loadListener), callback();
|
|
210
|
-
}, "domListener"), loadListener = /* @__PURE__ */ __name(() => {
|
|
211
|
-
window.removeEventListener("load", loadListener), callback();
|
|
212
|
-
}, "loadListener"), idleListener = /* @__PURE__ */ __name(() => {
|
|
213
|
-
idleId = void 0, callback();
|
|
214
|
-
}, "idleListener"), delayListener = /* @__PURE__ */ __name(() => {
|
|
215
|
-
window.removeEventListener("load", loadListener), timeoutId = setTimeout(() => {
|
|
216
|
-
requestAnimationFrame(() => {
|
|
217
|
-
callback();
|
|
218
|
-
});
|
|
219
|
-
}, 1e3);
|
|
220
|
-
}, "delayListener"), clear = /* @__PURE__ */ __name(() => {
|
|
221
|
-
window.removeEventListener("DOMContentLoaded", domListener), window.removeEventListener("load", loadListener), window.removeEventListener("load", delayListener), idleId && window.cancelIdleCallback && window.cancelIdleCallback(idleId), clearTimeout(timeoutId);
|
|
222
|
-
}, "clear");
|
|
223
|
-
return event === "idle" && window.requestIdleCallback ? idleId = window.requestIdleCallback(idleListener, { timeout: 1e4 }) : event === "load" ? document.readyState === "complete" ? loadListener() : window.addEventListener("load", loadListener) : event === "loadWithDelay" ? document.readyState === "complete" ? delayListener() : window.addEventListener("load", delayListener) : event === "DOMContentLoaded" && window.addEventListener("DOMContentLoaded", domListener), clear;
|
|
224
|
-
}
|
|
225
|
-
__name(requestLoadingCallback, "requestLoadingCallback");
|
|
226
207
|
function splitPropgress(progress, items, initialItemsWithFullProgress = 0) {
|
|
227
208
|
const totalItems = items - initialItemsWithFullProgress, splitted = [];
|
|
228
209
|
for (let item = 0; item < items; item++) {
|
|
@@ -406,11 +387,11 @@ export {
|
|
|
406
387
|
p3 as patch,
|
|
407
388
|
p5 as pick,
|
|
408
389
|
p4 as preciseNumber,
|
|
409
|
-
|
|
410
|
-
requestLoadingCallback,
|
|
390
|
+
r4 as requestIdleCallback,
|
|
391
|
+
r as requestLoadingCallback,
|
|
411
392
|
rgbToHex,
|
|
412
|
-
|
|
413
|
-
|
|
393
|
+
r2 as round,
|
|
394
|
+
r3 as roundNumberTo,
|
|
414
395
|
s as screenToCartesian,
|
|
415
396
|
s5 as scrollToElement,
|
|
416
397
|
s7 as searchParamsObjectToString,
|