aptechka 0.88.6 → 0.88.8
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/{Animation-CSofkIFz.js → Animation-BRQcZXsv.js} +2 -2
- package/lib/{Animation-BGpgWWgS.cjs → Animation-CEZp9MAK.cjs} +1 -1
- package/lib/{Composed-DO9sJgZQ.cjs → Composed-CYzVav_b.cjs} +1 -1
- package/lib/{Composed-Uq5ADyUF.js → Composed-DSDIwKsX.js} +2 -2
- package/lib/{Damped-CInILmq-.js → Damped-BjPLo7EW.js} +2 -2
- package/lib/{Damped-C3R5LGcL.cjs → Damped-CYCcZu-z.cjs} +1 -1
- package/lib/{DerivedArray-DTrXDt04.cjs → DerivedArray-C2V7Fl_H.cjs} +1 -1
- package/lib/{DerivedArray-CcS3cOIY.js → DerivedArray-XXkMPpKW.js} +1 -1
- package/lib/{DragControls-WuHf9pRX.cjs → DragControls-B9LNXQrB.cjs} +1 -1
- package/lib/{DragControls-DL5Iteu5.js → DragControls-DceCNYLA.js} +3 -3
- package/lib/{LocalLinks-CI-vxMaR.js → LocalLinks-BlFQ8IJs.js} +1 -1
- package/lib/{LocalLinks-D1mYcA-B.cjs → LocalLinks-tFNtZ8BL.cjs} +1 -1
- package/lib/{PageAnnouncerElement-CJ-MfwJ8.cjs → PageAnnouncerElement-B0iXrO6l.cjs} +1 -1
- package/lib/{PageAnnouncerElement-HcphPbXZ.js → PageAnnouncerElement-C04t1rJ-.js} +1 -1
- package/lib/{PageScroll-CrfCwDA4.js → PageScroll-BihuaqrK.js} +1 -1
- package/lib/{PageScroll-IlOCUUte.cjs → PageScroll-vCyjlFDP.cjs} +1 -1
- package/lib/{SourceElement-C5Yo94tp.js → SourceElement-BDWn81gs.js} +2 -2
- package/lib/{SourceElement-Bsp3SG7N.cjs → SourceElement-CKXnMFuT.cjs} +1 -1
- package/lib/{Store-ClBpeYgL.cjs → Store-BkYJHJp5.cjs} +1 -1
- package/lib/{Store-B2Y_0Tw9.js → Store-DhT9WSHd.js} +1 -1
- package/lib/{Tweened--qNhMQ8U.cjs → Tweened-BoGo9vz9.cjs} +1 -1
- package/lib/{Tweened-CSPu3mVO.js → Tweened-bOmXLCjc.js} +2 -2
- package/lib/{Viewport-D5edy_zd.js → Viewport-9ZphaP_o.js} +2 -2
- package/lib/{Viewport-BXCUex5k.cjs → Viewport-DwPeXyM2.cjs} +1 -1
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +1 -1
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +3 -3
- package/lib/api-fetcher/index.cjs +1 -1
- package/lib/api-fetcher/index.js +1 -1
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +2 -2
- package/lib/billboard/index.cjs +1 -1
- package/lib/billboard/index.js +1 -1
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +2 -2
- package/lib/connector/index.cjs +1 -1
- package/lib/connector/index.js +1 -1
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +1 -1
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.js +2 -2
- package/lib/css-value-parser/index.cjs +1 -1
- package/lib/css-value-parser/index.js +1 -1
- package/lib/dev/index.cjs +1 -1
- package/lib/dev/index.js +2 -2
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +1 -1
- package/lib/element-linked-store/index.cjs +1 -1
- package/lib/element-linked-store/index.js +2 -2
- package/lib/element-resizer/index.cjs +1 -1
- package/lib/element-resizer/index.js +1 -1
- package/lib/en3/index.cjs +1 -1
- package/lib/en3/index.js +1 -1
- package/lib/iframe/index.cjs +1 -1
- package/lib/iframe/index.js +3 -3
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +4 -4
- package/lib/index-Cz5-98rw.cjs +1 -0
- package/lib/{index-ClTMVKJp.js → index-uJboZXlu.js} +28 -5
- package/lib/intersector/index.cjs +1 -1
- package/lib/intersector/index.js +1 -1
- package/lib/jsx/index.cjs +1 -1
- package/lib/jsx/index.js +6 -6
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.js +2 -2
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.js +1 -1
- package/lib/loading/index.cjs +1 -1
- package/lib/loading/index.js +1 -1
- package/lib/local-links/index.cjs +1 -1
- package/lib/local-links/index.js +1 -1
- package/lib/masonry-layout/index.cjs +1 -1
- package/lib/masonry-layout/index.js +2 -2
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +2 -2
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +2 -2
- package/lib/need_redo_tweaker/index.cjs +1 -1
- package/lib/need_redo_tweaker/index.js +3 -3
- package/lib/notched/index.cjs +1 -1
- package/lib/notched/index.js +1 -1
- package/lib/page-announcer/index.cjs +1 -1
- package/lib/page-announcer/index.js +1 -1
- package/lib/page-scroll/index.cjs +1 -1
- package/lib/page-scroll/index.js +1 -1
- package/lib/pixel-perfect/index.cjs +1 -1
- package/lib/pixel-perfect/index.js +2 -2
- package/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +3 -3
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +2 -2
- package/lib/radio/index.cjs +1 -1
- package/lib/radio/index.js +1 -1
- package/lib/{render-CS4sSmHy.cjs → render-C5TfyEKx.cjs} +1 -1
- package/lib/{render-DMAVQ_JX.js → render-DKL72N3t.js} +3 -3
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +5 -5
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +7 -7
- package/lib/{scroll-CB2aFkff.js → scroll-4Z62EGTm.js} +1 -1
- package/lib/{scroll-Cut0Rc1_.cjs → scroll-Dv9QcIKd.cjs} +1 -1
- package/lib/scroll-kit/index.cjs +1 -1
- package/lib/scroll-kit/index.js +12 -18
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +3 -3
- package/lib/size-element/index.cjs +1 -1
- package/lib/size-element/index.js +1 -1
- package/lib/slicer/index.cjs +1 -1
- package/lib/slicer/index.js +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +1 -1
- package/lib/spa/index.cjs +1 -1
- package/lib/spa/index.js +4 -4
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +3 -3
- package/lib/{stylesheet-Dlk4dsJR.js → stylesheet-BvD9P5EO.js} +1 -1
- package/lib/{stylesheet-C0qxw7Dj.cjs → stylesheet-iyJcMTje.cjs} +1 -1
- package/lib/ticker/index.cjs +1 -1
- package/lib/ticker/index.d.ts +1 -0
- package/lib/ticker/index.js +1 -1
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.js +4 -4
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +3 -3
- package/lib/window-resizer/index.cjs +1 -1
- package/lib/window-resizer/index.js +1 -1
- package/lib/youtube/index.cjs +1 -1
- package/lib/youtube/index.js +3 -3
- package/package.json +1 -1
- package/lib/index-DZ44osDT.cjs +0 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __knownSymbol=(name,symbol)=>(symbol=Symbol[name])?symbol:Symbol.for("Symbol."+name),__typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});var __forAwait=(obj,it,method)=>(it=obj[__knownSymbol("asyncIterator")])?it.call(obj):(obj=obj[__knownSymbol("iterator")](),it={},method=(key,fn)=>(fn=obj[key])&&(it[key]=arg=>new Promise((yes,no,done)=>(arg=fn.call(obj,arg),done=arg.done,Promise.resolve(arg.value).then(value=>yes({value,done}),no)))),method("next"),method("return"),it);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs"),events=require("../events-UlGk63iC.cjs"),promises=require("../promises-nDm8_iG6.cjs"),scroll=require("../scroll-Cut0Rc1_.cjs");require("construct-style-sheets-polyfill");const url=require("../url-CPCO10Sy.cjs"),cssValueParser_index=require("../css-value-parser/index.cjs"),string=require("../string-Bx5N38JG.cjs"),_MorphAnnouncer=class _MorphAnnouncer extends HTMLElement{connectedCallback(){const attrs={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[key,value]of Object.entries(attrs))this.setAttribute(key,value)}};__name(_MorphAnnouncer,"MorphAnnouncer");let MorphAnnouncer=_MorphAnnouncer;intersector_index.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",MorphAnnouncer);var _morph,_element,_MorphLink_instances,path_get,click_fn,_clickListener,_pointerListener;const _MorphLink=class _MorphLink{constructor(element,morph){__privateAdd(this,_MorphLink_instances);__privateAdd(this,_morph);__privateAdd(this,_element);__privateAdd(this,_clickListener,__name(e=>{e.preventDefault(),__privateMethod(this,_MorphLink_instances,click_fn).call(this)},"#clickListener"));__privateAdd(this,_pointerListener,__name(()=>{const revalidate=__privateGet(this,_element).hasAttribute("data-revalidate");__privateGet(this,_morph).prefetch(__privateGet(this,_MorphLink_instances,path_get),revalidate),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener))},"#pointerListener"));__privateSet(this,_morph,morph),__privateSet(this,_element,element),__privateGet(this,_element).addEventListener("click",__privateGet(this,_clickListener)),this.checkCurrent(location.href.replace(location.origin,"")),__privateGet(this,_element).hasAttribute("data-prefetch")&&__privateGet(this,_element).addEventListener("pointerenter",__privateGet(this,_pointerListener))}get element(){return __privateGet(this,_element)}checkCurrent(path){var _a,_b;const locationUrl=__privateGet(this,_morph).normalizePath(path),linkUrl=__privateGet(this,_morph).normalizePath(__privateGet(this,_MorphLink_instances,path_get));__privateGet(this,_element).hasAttribute("data-include")&&locationUrl.pathname.includes(linkUrl.pathname)?__privateGet(this,_element).classList.add("current"):linkUrl.pathname===locationUrl.pathname?__privateGet(this,_element).classList.add("current"):(_a=__privateGet(this,_element).getAttribute("data-associated-paths"))!=null&&_a.split(",").find(path2=>locationUrl.pathname.includes(path2))?__privateGet(this,_element).classList.add("current"):__privateGet(this,_element).classList.remove("current"),locationUrl.path===linkUrl.path?__privateGet(this,_element).classList.add("exact"):__privateGet(this,_element).classList.remove("exact");const[pathWithoutParams,pathParamsStr]=(_b=__privateGet(this,_MorphLink_instances,path_get).split("#")[0])==null?void 0:_b.split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search);let matchCounter=0;for(const[key]of locationParams)pathParams.has(key)&&locationParams.get(key)===pathParams.get(key)&&matchCounter++;matchCounter?(__privateGet(this,_element).classList.toggle("all-params-matched",locationParams.size===matchCounter),__privateGet(this,_element).classList.toggle("some-params-matched",locationParams.size!==matchCounter)):!locationParams.size&&__privateGet(this,_element).hasAttribute("data-match-no-params")?__privateGet(this,_element).classList.add("all-params-matched"):(__privateGet(this,_element).classList.remove("all-params-matched"),__privateGet(this,_element).classList.remove("some-params-matched"));for(const key in __privateGet(this,_element).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("match-param-")){const name=kebabKey.split("match-param-")[1],value=__privateGet(this,_element).dataset[key],className=`param-${name}-matched`;locationParams.has(name)&&locationParams.get(name)===value||!locationParams.has(name)&&(value===""||value==="*"||value==="all"||value==="any"||value==="vse")?__privateGet(this,_element).classList.add(className):__privateGet(this,_element).classList.remove(className)}}}destroy(){__privateGet(this,_element).removeEventListener("click",__privateGet(this,_clickListener)),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener)),__privateGet(this,_element).classList.remove("current","exact")}};_morph=new WeakMap,_element=new WeakMap,_MorphLink_instances=new WeakSet,path_get=__name(function(){const url2=new URL(__privateGet(this,_element).href);return __privateGet(this,_morph).normalizePath(url2.pathname+url2.search+url2.hash).path},"#path"),click_fn=__name(function(){var _a;if(document.documentElement.classList.contains("click-disabled"))return;if(__privateGet(this,_element).hasAttribute("data-back")&&__privateGet(this,_morph).previousURL)history.back();else{const historyAction=__privateGet(this,_element).getAttribute("data-history-action")||"push",centerScroll=__privateGet(this,_element).hasAttribute("data-center-scroll"),offsetScrollRawValue=getComputedStyle(__privateGet(this,_element)).getPropertyValue("--offset-scroll").trim(),offsetScroll=offsetScrollRawValue?cssValueParser_index.cssValueParser.parse(offsetScrollRawValue):void 0,revalidate=__privateGet(this,_element).hasAttribute("data-revalidate")||__privateGet(this,_element).hasAttribute("data-pagination-more-link")||__privateGet(this,_element).hasAttribute("data-pagination-set-link")||__privateGet(this,_element).hasAttribute("data-pagination-next-link")||__privateGet(this,_element).hasAttribute("data-pagination-prev-link"),keepSearchParameters=__privateGet(this,_element).hasAttribute("data-keep-search-parameters"),keepScrollPosition=__privateGet(this,_element).hasAttribute("data-keep-scroll-position")||__privateGet(this,_element).hasAttribute("data-pagination-more-link"),scrollBehaviour=__privateGet(this,_element).getAttribute("data-scroll-behaviour"),submorph=(_a=__privateGet(this,_element).getAttribute("data-submorph")||__privateGet(this,_element).getAttribute("data-submorph-append"))==null?void 0:_a.split(",").map(v=>v.trim()),clearState=__privateGet(this,_element).hasAttribute("data-clear-state");let path=__privateGet(this,_MorphLink_instances,path_get);if(__privateGet(this,_element).hasAttribute("data-toggle-params")){const[pathWithoutParams,pathParamsStr]=__privateGet(this,_MorphLink_instances,path_get).split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search),resultParams=new URLSearchParams;for(const[key]of pathParams)(!locationParams.has(key)||locationParams.has(key)&&locationParams.get(key)!==pathParams.get(key))&&resultParams.append(key,pathParams.get(key));if(__privateGet(this,_element).hasAttribute("data-merge-params"))for(const[key]of locationParams)pathParams.has(key)||resultParams.append(key,locationParams.get(key));path=`${pathWithoutParams}?${resultParams.toString()}`}__privateGet(this,_morph).navigate(path,{historyAction,centerScroll,offsetScroll,revalidate,keepSearchParameters,submorph,clearState,keepScrollPosition,scrollBehaviour,submorphAppend:__privateGet(this,_element).hasAttribute("data-submorph-append"),mergeParams:__privateGet(this,_element).hasAttribute("data-merge-params")&&!__privateGet(this,_element).hasAttribute("data-toggle-params"),detail:__privateGet(this,_element).getAttribute("data-detail"),removeParams:__privateGet(this,_element).getAttribute("data-remove-params")||void 0,scrollTo:__privateGet(this,_element).getAttribute("data-scroll-to")||void 0})}},"#click"),_clickListener=new WeakMap,_pointerListener=new WeakMap,__name(_MorphLink,"MorphLink");let MorphLink=_MorphLink;var _element2,_params,_MorphParamsDependent_instances,update_fn,_urlChangeListener;const _MorphParamsDependent=class _MorphParamsDependent{constructor(element){__privateAdd(this,_MorphParamsDependent_instances);__privateAdd(this,_element2);__privateAdd(this,_params,[]);__privateAdd(this,_urlChangeListener,__name(()=>{__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)},"#urlChangeListener"));__privateSet(this,_element2,element);for(const key in __privateGet(this,_element2).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("param-")){const name=kebabKey.split("param-")[1],value=__privateGet(this,_element2).dataset[key];__privateGet(this,_params).push({name,value})}}document.addEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener)),__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener))}};_element2=new WeakMap,_params=new WeakMap,_MorphParamsDependent_instances=new WeakSet,update_fn=__name(function(){const locationParams=new URLSearchParams(location.search);let matched=!!__privateGet(this,_params).find(param=>locationParams.has(param.name)&&(locationParams.get(param.name)===param.value||param.value==="*"||param.value==="all"||param.value==="any"||param.value==="vse"||locationParams.get(param.name)==="*"||locationParams.get(param.name)==="all"||locationParams.get(param.name)==="any"||locationParams.get(param.name)==="vse"));!matched&&__privateGet(this,_element2).hasAttribute("data-match-no-params")&&(matched=!__privateGet(this,_params).filter(param=>locationParams.has(param.name)).length);const hideClass=__privateGet(this,_element2).getAttribute("data-hide-class");matched?hideClass?__privateGet(this,_element2).classList.remove(hideClass):__privateGet(this,_element2).style.display="":hideClass?__privateGet(this,_element2).classList.add(hideClass):__privateGet(this,_element2).style.display="none",requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("resize"))})},"#update"),_urlChangeListener=new WeakMap,__name(_MorphParamsDependent,"MorphParamsDependent");let MorphParamsDependent=_MorphParamsDependent;const domParser=new DOMParser;var _morph2,_pathname,_scrollState,_initialDocument,_modifiedDocument,_currentDocument,_savedState,_abortController,_fetching,_headers,_needRavalidation;const _MorphRoute=class _MorphRoute{constructor(morph,pathname){__privateAdd(this,_morph2);__privateAdd(this,_pathname);__privateAdd(this,_scrollState,{x:0,y:0});__privateAdd(this,_initialDocument,null);__privateAdd(this,_modifiedDocument,null);__privateAdd(this,_currentDocument,null);__privateAdd(this,_savedState,null);__privateAdd(this,_abortController,null);__privateAdd(this,_fetching,null);__privateAdd(this,_headers);__privateAdd(this,_needRavalidation,!1);__privateSet(this,_morph2,morph),__privateSet(this,_pathname,pathname)}get pathname(){return __privateGet(this,_pathname)}get scrollState(){return __privateGet(this,_scrollState)}get document(){return __privateGet(this,_currentDocument)}needRavalidation(){__privateSet(this,_needRavalidation,!0)}setHeaders(headers){__privateSet(this,_headers,headers)}setInitialDocument(document2){__privateSet(this,_initialDocument,document2.cloneNode(!0))}abort(){var _a;return(_a=__privateGet(this,_abortController))==null?void 0:_a.abort(`[${__privateGet(this,_pathname)}] page loading cancelled`)}fetch(path,currentPath,revalidate){return __async(this,null,function*(){var _a;if(!revalidate&&!__privateGet(this,_needRavalidation)){const shouldUseCache=((_a=__privateGet(this,_initialDocument))==null?void 0:_a.documentElement.getAttribute("data-cache"))&¤tPath!==path,isPopstateNavigation=__privateGet(this,_initialDocument)&&__privateGet(this,_morph2).isPopstateNavigation;if(__privateGet(this,_fetching)||shouldUseCache||isPopstateNavigation)return __privateGet(this,_fetching)}return __privateSet(this,_fetching,new Promise(res=>__async(this,null,function*(){try{__privateSet(this,_abortController,new AbortController);const text=yield(yield fetch(path,{signal:__privateGet(this,_abortController).signal,headers:__spreadValues({"X-MORPH":"true","X-MORPH-REVALIDATE":revalidate?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(currentPath),"X-MORPH-NEW-PATH":encodeURIComponent(path)},__privateGet(this,_headers))})).text(),document2=domParser.parseFromString(text,"text/html");this.setInitialDocument(document2),__privateSet(this,_needRavalidation,!1)}catch(e){console.warn(e)}finally{__privateSet(this,_abortController,null),__privateSet(this,_fetching,null),res()}}))),__privateGet(this,_fetching)})}cloneDocument(){__privateSet(this,_currentDocument,(__privateGet(this,_modifiedDocument)||__privateGet(this,_initialDocument)).cloneNode(!0))}get title(){let title="";if(__privateGet(this,_currentDocument).title)title=__privateGet(this,_currentDocument).title;else{const h1=__privateGet(this,_currentDocument).querySelector("h1");title=(h1==null?void 0:h1.innerText)||(h1==null?void 0:h1.textContent)||__privateGet(this,_pathname)}return title}clearScrollState(){__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0}clearDocumentState(){__privateSet(this,_modifiedDocument,null)}saveScrollState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-scroll-restoration")?(__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0):(__privateGet(this,_scrollState).x=__privateGet(this,_morph2).scrollValue.left,__privateGet(this,_scrollState).y=__privateGet(this,_morph2).scrollValue.top)}restoreScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:__privateGet(this,_scrollState).y,left:__privateGet(this,_scrollState).x,behavior:"instant"})}saveDocumentState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-page-restoration")?__privateSet(this,_modifiedDocument,null):__privateSet(this,_modifiedDocument,document.cloneNode(!0))}renewScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(state){__privateSet(this,_savedState,state)}clearState(){const state=__privateGet(this,_savedState);return __privateSet(this,_savedState,null),state}};_morph2=new WeakMap,_pathname=new WeakMap,_scrollState=new WeakMap,_initialDocument=new WeakMap,_modifiedDocument=new WeakMap,_currentDocument=new WeakMap,_savedState=new WeakMap,_abortController=new WeakMap,_fetching=new WeakMap,_headers=new WeakMap,_needRavalidation=new WeakMap,__name(_MorphRoute,"MorphRoute");let MorphRoute=_MorphRoute;var _options,_morphElements,_links,_candidateURL,_currentURL,_previousURL,_promises,_isPopstateNavigation,_currentScrollElement,_isWindowScroll,_routes,_paramDependent,_announcer,_currentScrollX,_currentScrollY,_lastSubmorph,_lastRevalidate,_lastKeepScrollPosition,_checkLink,_Morph_instances,getRoute_fn,getMorphElements_fn,isElementEmitsLoadEvent_fn,updateCurrentScrollElement_fn,tryScrollToElement_fn,_popStateListener,_scrollListener;const _Morph=class _Morph{constructor(parameters){__privateAdd(this,_Morph_instances);__privateAdd(this,_options,null);__privateAdd(this,_morphElements,null);__privateAdd(this,_links,[]);__privateAdd(this,_candidateURL);__privateAdd(this,_currentURL,null);__privateAdd(this,_previousURL);__privateAdd(this,_promises,[]);__privateAdd(this,_isPopstateNavigation,!1);__privateAdd(this,_currentScrollElement,null);__privateAdd(this,_isWindowScroll,!1);__privateAdd(this,_routes,new Map);__privateAdd(this,_paramDependent,[]);__privateAdd(this,_announcer,null);__privateAdd(this,_currentScrollX,0);__privateAdd(this,_currentScrollY,0);__privateAdd(this,_lastSubmorph);__privateAdd(this,_lastRevalidate);__privateAdd(this,_lastKeepScrollPosition);__privateAdd(this,_checkLink,__name(element=>{var _a,_b;return(((_a=element.getAttribute("href"))==null?void 0:_a.startsWith("/"))||((_b=element.getAttribute("href"))==null?void 0:_b.startsWith("?")))&&!element.hasAttribute("download")&&!element.hasAttribute("data-morph-skip")&&!element.closest("[data-morph-skip]")&&element.getAttribute("target")!=="_blank"},"#checkLink"));__privateAdd(this,_popStateListener,__name(event=>__async(this,null,function*(){event.preventDefault(),__privateSet(this,_isPopstateNavigation,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:__privateGet(this,_lastRevalidate)?void 0:__privateGet(this,_lastSubmorph),revalidate:__privateGet(this,_lastRevalidate),keepScrollPosition:__privateGet(this,_lastKeepScrollPosition)}),__privateSet(this,_isPopstateNavigation,!1)}),"#popStateListener"));__privateAdd(this,_scrollListener,__name(()=>{const{left,top}=this.scrollValue,directionY=top-__privateGet(this,_currentScrollY),directionX=left-__privateGet(this,_currentScrollX);__privateSet(this,_currentScrollY,top),__privateSet(this,_currentScrollX,left),document.documentElement.classList.toggle("scroll-y",top>0),document.documentElement.classList.toggle("scroll-x",left>0),document.documentElement.classList.toggle("scroll-y-forward",directionY>0),document.documentElement.classList.toggle("scroll-y-backward",directionY<0),document.documentElement.classList.toggle("scroll-x-forward",directionX>0),document.documentElement.classList.toggle("scroll-x-backward",directionX<0),events.dispatchEvent(document,"morphScroll",{detail:{left,top}})},"#scrollListener"));if(intersector_index.isBrowser&&!_Morph.instance){_Morph.instance=this,__privateSet(this,_options,{base:url.normalizeBase(parameters==null?void 0:parameters.base),waitForHeadToLoad:(parameters==null?void 0:parameters.waitForHeadToLoad)!==!1,trailingSlash:(parameters==null?void 0:parameters.trailingSlash)||!1,scrollSelector:parameters==null?void 0:parameters.scrollSelector,morphInsideScrollContainer:(parameters==null?void 0:parameters.morphInsideScrollContainer)||!1}),__privateSet(this,_morphElements,__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,document.body));const normalizedURL=this.normalizePath(location.pathname+location.search+location.hash);__privateSet(this,_currentURL,normalizedURL);const initialRoute=new MorphRoute(this,__privateGet(this,_currentURL).pathname);initialRoute.setInitialDocument(document),__privateGet(this,_routes).set(__privateGet(this,_currentURL).pathname,initialRoute),document.documentElement.setAttribute("data-current-pathname",__privateGet(this,_currentURL).pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",__privateGet(this,_popStateListener)),url.changeHistory({action:"replace",pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),__privateSet(this,_announcer,new MorphAnnouncer),__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,document)}}get currentURL(){return __privateGet(this,_currentURL)}get previousURL(){return __privateGet(this,_previousURL)}get links(){return __privateGet(this,_links)}get scrollElement(){return __privateGet(this,_currentScrollElement)}get isPopstateNavigation(){return __privateGet(this,_isPopstateNavigation)}get scrollValue(){let top=0,left=0;return __privateGet(this,_isWindowScroll)?(top=window.scrollY,left=window.scrollX):(top=__privateGet(this,_currentScrollElement).scrollTop,left=__privateGet(this,_currentScrollElement).scrollLeft),{top,left}}get isNavigating(){return!!__privateGet(this,_promises).length}saveState(state){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);route&&route.saveState(state)}getState(){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);return route==null?void 0:route.clearState()}normalizePath(path,options){return url.splitPath(path,{base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash,mergeParams:options!=null&&options.mergeParams?location.search:"",removeParams:options==null?void 0:options.removeParams})}prefetch(path,revalidate){return __async(this,null,function*(){var _a;if(__privateGet(this,_promises).length)return;path=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path;const route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,path);route==null||route.fetch(path,__privateGet(this,_currentURL).path,revalidate)})}excludeHeadChild(child){return!1}setHeaders(path){}needRavalidation(path){const normalizedURL=this.normalizePath(path),route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.path);route==null||route.needRavalidation()}navigate(_0){return __async(this,arguments,function*(path,{historyAction="push",centerScroll,offsetScroll,scrollBehaviour,revalidate,keepSearchParameters,submorph,submorphAppend,clearState,keepScrollPosition,mergeParams,removeParams,detail,scrollTo}={}){var _a,_b,_c,_d;if(__privateGet(this,_promises).length)return;__privateSet(this,_lastSubmorph,submorph),__privateSet(this,_lastRevalidate,revalidate),__privateSet(this,_lastKeepScrollPosition,keepScrollPosition);const modifiedPath=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path,normalizedURL=this.normalizePath(modifiedPath,{mergeParams,removeParams});if(!revalidate&&(((_b=__privateGet(this,_candidateURL))==null?void 0:_b.pathname)===normalizedURL.pathname||__privateGet(this,_currentURL).pathname===normalizedURL.pathname)){keepScrollPosition||__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo||normalizedURL.hash||0,{centerScroll,offsetScroll,behavior:"smooth"}),events.dispatchEvent(document,"morphSamePath",{detail:{detail}}),((_c=__privateGet(this,_currentURL))==null?void 0:_c.parameters)!==normalizedURL.parameters&&(__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL),url.changeHistory({action:((_d=__privateGet(this,_currentURL))==null?void 0:_d.hash)!==normalizedURL.hash?"replace":historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),events.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:__privateGet(this,_currentURL),previousURL:__privateGet(this,_previousURL),detail}})),__privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});return}else __privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});__privateSet(this,_candidateURL,normalizedURL);try{let preprocessedSuccesfully=!0;if(this.preprocessor)try{yield new Promise((resolve,reject)=>{var _a2;(_a2=this.preprocessor)==null||_a2.call(this,{url:normalizedURL,resolve,reject,submorph,detail})})}catch(e){e?console.error(e):console.log("Route change canceled"),preprocessedSuccesfully=!1}if(!preprocessedSuccesfully||__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}const navigationEntry={url:normalizedURL,submorph,detail};submorph?submorphAppend||submorph.forEach(sel=>{document.querySelectorAll(sel).forEach(el=>{el.classList.add("out"),el.setAttribute("data-morph-out","")})}):__privateGet(this,_morphElements).forEach(el=>{var _a2,_b2;(_a2=el.firstElementChild)==null||_a2.classList.add("out"),(_b2=el.firstElementChild)==null||_b2.setAttribute("data-morph-out","")}),events.dispatchEvent(document,"morphNavigation",{detail:navigationEntry});const currentRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,__privateGet(this,_currentURL).pathname),nextRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.pathname);if(__privateGet(this,_routes).forEach(el=>{el.pathname!==normalizedURL.pathname&&el.abort()}),yield nextRoute==null?void 0:nextRoute.fetch(modifiedPath,__privateGet(this,_currentURL).path,revalidate),__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}currentRoute.clearState(),currentRoute.saveScrollState(),currentRoute.saveDocumentState(),(!__privateGet(this,_isPopstateNavigation)||revalidate)&&(nextRoute.clearScrollState(),nextRoute.clearDocumentState()),clearState&&nextRoute.clearState(),nextRoute.cloneDocument(),__privateGet(this,_announcer).textContent=nextRoute.title,document.body.appendChild(__privateGet(this,_announcer));const documentFetchedEntry=__spreadProps(__spreadValues({},navigationEntry),{document:nextRoute.document});submorphAppend||documentFetchedEntry.document.querySelectorAll("[data-morph-out]").forEach(el=>{el.classList.remove("out")}),events.dispatchEvent(document,"morphStart",{detail:documentFetchedEntry});const currentHeadChildren=Array.from(document.head.children),newHeadChildren=Array.from(nextRoute.document.head.children),identicalHeadChildren=dom.intersectElements(currentHeadChildren,newHeadChildren),removeHeadChildren=dom.excludeElements(currentHeadChildren,identicalHeadChildren),addHeadChildren=dom.excludeElements(newHeadChildren,identicalHeadChildren).filter(child=>!this.excludeHeadChild(child));addHeadChildren.forEach((child,index)=>{child.tagName==="SCRIPT"&&(addHeadChildren[index]=dom.createScriptElement(child))}),addHeadChildren.forEach(child=>{document.head.appendChild(child)});const elementsWithLoad=addHeadChildren.filter(child=>{if(child.hasAttribute("data-no-waiting"))return!1;if(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child))return!0});__privateGet(this,_options).waitForHeadToLoad&&elementsWithLoad.length&&(yield new Promise(res=>__async(this,null,function*(){let counter=0;try{for(var iter=__forAwait(elementsWithLoad),more,temp,error;more=!(temp=yield iter.next()).done;more=!1){const element=temp.value;element.onload=()=>{counter++,counter===elementsWithLoad.length&&res()}}}catch(temp){error=[temp]}finally{try{more&&(temp=iter.return)&&(yield temp.call(iter))}finally{if(error)throw error[0]}}}))),yield promises.wait(10);const oldElementsWithLoadEvent=[];submorphAppend||removeHeadChildren.forEach(child=>{child.hasAttribute("data-permanent")||(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child)?oldElementsWithLoadEvent.push(child):child.remove())});const newMorphElements=__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,nextRoute.document.body);!__privateGet(this,_options).morphInsideScrollContainer&&!submorph&&__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,nextRoute.document),document.documentElement.setAttribute("data-current-pathname",normalizedURL.pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),url.changeHistory({action:historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters||(keepSearchParameters?location.search:""),hash:normalizedURL.hash}),__privateGet(this,_announcer).remove(),__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL);const morphedElements=[];__privateGet(this,_morphElements).forEach((morphElement,i)=>{const newMorphElement=newMorphElements[i],duration=getComputedStyle(morphElement).getPropertyValue("--morph-duration");let newMorphElementChildNodes=[],currentMorphElementChildNodes=[];submorph?(submorph.forEach(selector=>{const curSubMorphElement=morphElement.querySelector(selector),newSubMorphElement=newMorphElement.querySelector(selector);curSubMorphElement&&newSubMorphElement&&(currentMorphElementChildNodes.push(curSubMorphElement),newMorphElementChildNodes.push(newSubMorphElement))}),currentMorphElementChildNodes.forEach(el=>{el.parentElement&&morphedElements.push(el.parentElement)})):(newMorphElementChildNodes.push(...newMorphElement.childNodes),currentMorphElementChildNodes.push(...morphElement.childNodes),morphedElements.push(morphElement));const transfer=[];submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(this.destroyOldLinks(element),element.classList.add("old"),element.querySelectorAll("[data-morph-transfer]").forEach(el=>{const selector=el.getAttribute("data-morph-transfer");transfer.push({element:el,selector})}))}),newMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(transfer.forEach(item=>{const nestlement=element.querySelector(item.selector);nestlement&&nestlement.replaceWith(nextRoute.document.importNode(item.element,!0))}),this.findNewLinks(element),element.classList.add("new"))}),submorph?submorphAppend?newMorphElementChildNodes.forEach((el,i2)=>{currentMorphElementChildNodes[i2]instanceof HTMLElement&¤tMorphElementChildNodes[i2].append(...el.childNodes)}):newMorphElementChildNodes.forEach((el,i2)=>{var _a2;(_a2=currentMorphElementChildNodes[i2].parentElement)==null||_a2.insertBefore(el,currentMorphElementChildNodes[i2])}):morphElement.prepend(...newMorphElementChildNodes),setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&element.classList.add("old-idle")}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.setProperty("--new-content-height",element.offsetHeight+"px"),element.classList.add("new-idle"))})},0);const detail2=__spreadProps(__spreadValues({},documentFetchedEntry),{morphElement});events.dispatchEvent(document,"morphNewChildrenAdded",{detail:detail2});const promise=new Promise(res=>{setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(el=>{el.remove()}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.removeProperty("--new-content-height"),element.classList.remove("new-idle","new"))}),submorphAppend||events.dispatchEvent(document,"morphOldChildrenRemoved",{detail:detail2}),res()},(parseFloat(duration)||0)*1e3+10)});__privateGet(this,_promises).push(promise)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-nextRoute.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),events.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:nextRoute.scrollState}),scrollTo?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo,{centerScroll,offsetScroll,behavior:scrollBehaviour})):normalizedURL.hash?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,normalizedURL.hash,{centerScroll,offsetScroll,behavior:scrollBehaviour})):__privateGet(this,_isPopstateNavigation)?nextRoute.restoreScrollPosition():keepScrollPosition||nextRoute.renewScrollPosition(),yield Promise.all(__privateGet(this,_promises)),submorphAppend||oldElementsWithLoadEvent.forEach(child=>child.remove()),__privateSet(this,_promises,[]),morphedElements.forEach(el=>{el.querySelectorAll("script").forEach(element=>{element.replaceWith(dom.createScriptElement(element))})}),__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)}),this.findParamsDependent(),events.dispatchEvent(document,"morphComplete",{detail:documentFetchedEntry}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(e){console.error(e)}__privateSet(this,_candidateURL,void 0)})}addLink(element){__privateGet(this,_links).push(new MorphLink(element,this))}addLinks(elements){elements.forEach(element=>{this.addLink(element)})}removeLink(element){__privateSet(this,_links,__privateGet(this,_links).filter(link=>link.element===element?(link.destroy(),!1):!0))}destroyOldLinks(morphElement){__privateSet(this,_links,__privateGet(this,_links).filter(link=>morphElement.contains(link.element)?(link.destroy(),!1):!0))}findNewLinks(morphElement){const linkElements=[...morphElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).push(...linkElements.map(element=>new MorphLink(element,this)))}findLinks(){const linkElements=[...document.documentElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).forEach(link=>link.destroy()),__privateSet(this,_links,linkElements.map(element=>new MorphLink(element,this)))}findParamsDependent(){const elements=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];__privateGet(this,_paramDependent).forEach(link=>link.destroy()),__privateSet(this,_paramDependent,elements.map(element=>new MorphParamsDependent(element)))}};_options=new WeakMap,_morphElements=new WeakMap,_links=new WeakMap,_candidateURL=new WeakMap,_currentURL=new WeakMap,_previousURL=new WeakMap,_promises=new WeakMap,_isPopstateNavigation=new WeakMap,_currentScrollElement=new WeakMap,_isWindowScroll=new WeakMap,_routes=new WeakMap,_paramDependent=new WeakMap,_announcer=new WeakMap,_currentScrollX=new WeakMap,_currentScrollY=new WeakMap,_lastSubmorph=new WeakMap,_lastRevalidate=new WeakMap,_lastKeepScrollPosition=new WeakMap,_checkLink=new WeakMap,_Morph_instances=new WeakSet,getRoute_fn=__name(function(path){const normalizedURL=this.normalizePath(path);let route=__privateGet(this,_routes).get(normalizedURL.pathname);return route||(route=new MorphRoute(this,normalizedURL.pathname),__privateGet(this,_routes).set(normalizedURL.pathname,route)),route},"#getRoute"),getMorphElements_fn=__name(function(el){const morphElements=[...el.querySelectorAll("[data-morph]")];return morphElements.length?morphElements:[el]},"#getMorphElements"),isElementEmitsLoadEvent_fn=__name(function(element){return element.tagName==="SCRIPT"||element.tagName==="STYLE"||element.tagName==="LINK"&&element.getAttribute("rel")==="stylesheet"},"#isElementEmitsLoadEvent"),updateCurrentScrollElement_fn=__name(function(document2){var _a,_b;(_a=__privateGet(this,_currentScrollElement))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),__privateSet(this,_currentScrollY,0),__privateSet(this,_currentScrollX,0),__privateSet(this,_currentScrollElement,__privateGet(this,_options).scrollSelector&&document2.querySelector(__privateGet(this,_options).scrollSelector)||window),__privateSet(this,_isWindowScroll,__privateGet(this,_currentScrollElement)===window),(_b=__privateGet(this,_currentScrollElement))==null||_b.addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_scrollListener).call(this)},"#updateCurrentScrollElement"),tryScrollToElement_fn=__name(function(id,options){const value=typeof id=="string"?document.querySelector(id):id;(typeof value=="number"||value)&&scroll.scrollToElement(value,{scrollElement:__privateGet(this,_currentScrollElement),behavior:(options==null?void 0:options.behavior)||"instant",center:options==null?void 0:options.centerScroll,offset:options==null?void 0:options.offsetScroll})},"#tryScrollToElement"),_popStateListener=new WeakMap,_scrollListener=new WeakMap,__name(_Morph,"Morph"),_Morph.instance=null;let Morph=_Morph;exports.Morph=Morph;
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __knownSymbol=(name,symbol)=>(symbol=Symbol[name])?symbol:Symbol.for("Symbol."+name),__typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});var __forAwait=(obj,it,method)=>(it=obj[__knownSymbol("asyncIterator")])?it.call(obj):(obj=obj[__knownSymbol("iterator")](),it={},method=(key,fn)=>(fn=obj[key])&&(it[key]=arg=>new Promise((yes,no,done)=>(arg=fn.call(obj,arg),done=arg.done,Promise.resolve(arg.value).then(value=>yes({value,done}),no)))),method("next"),method("return"),it);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const intersector_index=require("../index-Cz5-98rw.cjs"),dom=require("../dom-B40i6NXw.cjs"),events=require("../events-UlGk63iC.cjs"),promises=require("../promises-nDm8_iG6.cjs"),scroll=require("../scroll-Dv9QcIKd.cjs");require("construct-style-sheets-polyfill");const url=require("../url-CPCO10Sy.cjs"),cssValueParser_index=require("../css-value-parser/index.cjs"),string=require("../string-Bx5N38JG.cjs"),_MorphAnnouncer=class _MorphAnnouncer extends HTMLElement{connectedCallback(){const attrs={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[key,value]of Object.entries(attrs))this.setAttribute(key,value)}};__name(_MorphAnnouncer,"MorphAnnouncer");let MorphAnnouncer=_MorphAnnouncer;intersector_index.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",MorphAnnouncer);var _morph,_element,_MorphLink_instances,path_get,click_fn,_clickListener,_pointerListener;const _MorphLink=class _MorphLink{constructor(element,morph){__privateAdd(this,_MorphLink_instances);__privateAdd(this,_morph);__privateAdd(this,_element);__privateAdd(this,_clickListener,__name(e=>{e.preventDefault(),__privateMethod(this,_MorphLink_instances,click_fn).call(this)},"#clickListener"));__privateAdd(this,_pointerListener,__name(()=>{const revalidate=__privateGet(this,_element).hasAttribute("data-revalidate");__privateGet(this,_morph).prefetch(__privateGet(this,_MorphLink_instances,path_get),revalidate),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener))},"#pointerListener"));__privateSet(this,_morph,morph),__privateSet(this,_element,element),__privateGet(this,_element).addEventListener("click",__privateGet(this,_clickListener)),this.checkCurrent(location.href.replace(location.origin,"")),__privateGet(this,_element).hasAttribute("data-prefetch")&&__privateGet(this,_element).addEventListener("pointerenter",__privateGet(this,_pointerListener))}get element(){return __privateGet(this,_element)}checkCurrent(path){var _a,_b;const locationUrl=__privateGet(this,_morph).normalizePath(path),linkUrl=__privateGet(this,_morph).normalizePath(__privateGet(this,_MorphLink_instances,path_get));__privateGet(this,_element).hasAttribute("data-include")&&locationUrl.pathname.includes(linkUrl.pathname)?__privateGet(this,_element).classList.add("current"):linkUrl.pathname===locationUrl.pathname?__privateGet(this,_element).classList.add("current"):(_a=__privateGet(this,_element).getAttribute("data-associated-paths"))!=null&&_a.split(",").find(path2=>locationUrl.pathname.includes(path2))?__privateGet(this,_element).classList.add("current"):__privateGet(this,_element).classList.remove("current"),locationUrl.path===linkUrl.path?__privateGet(this,_element).classList.add("exact"):__privateGet(this,_element).classList.remove("exact");const[pathWithoutParams,pathParamsStr]=(_b=__privateGet(this,_MorphLink_instances,path_get).split("#")[0])==null?void 0:_b.split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search);let matchCounter=0;for(const[key]of locationParams)pathParams.has(key)&&locationParams.get(key)===pathParams.get(key)&&matchCounter++;matchCounter?(__privateGet(this,_element).classList.toggle("all-params-matched",locationParams.size===matchCounter),__privateGet(this,_element).classList.toggle("some-params-matched",locationParams.size!==matchCounter)):!locationParams.size&&__privateGet(this,_element).hasAttribute("data-match-no-params")?__privateGet(this,_element).classList.add("all-params-matched"):(__privateGet(this,_element).classList.remove("all-params-matched"),__privateGet(this,_element).classList.remove("some-params-matched"));for(const key in __privateGet(this,_element).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("match-param-")){const name=kebabKey.split("match-param-")[1],value=__privateGet(this,_element).dataset[key],className=`param-${name}-matched`;locationParams.has(name)&&locationParams.get(name)===value||!locationParams.has(name)&&(value===""||value==="*"||value==="all"||value==="any"||value==="vse")?__privateGet(this,_element).classList.add(className):__privateGet(this,_element).classList.remove(className)}}}destroy(){__privateGet(this,_element).removeEventListener("click",__privateGet(this,_clickListener)),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener)),__privateGet(this,_element).classList.remove("current","exact")}};_morph=new WeakMap,_element=new WeakMap,_MorphLink_instances=new WeakSet,path_get=__name(function(){const url2=new URL(__privateGet(this,_element).href);return __privateGet(this,_morph).normalizePath(url2.pathname+url2.search+url2.hash).path},"#path"),click_fn=__name(function(){var _a;if(document.documentElement.classList.contains("click-disabled"))return;if(__privateGet(this,_element).hasAttribute("data-back")&&__privateGet(this,_morph).previousURL)history.back();else{const historyAction=__privateGet(this,_element).getAttribute("data-history-action")||"push",centerScroll=__privateGet(this,_element).hasAttribute("data-center-scroll"),offsetScrollRawValue=getComputedStyle(__privateGet(this,_element)).getPropertyValue("--offset-scroll").trim(),offsetScroll=offsetScrollRawValue?cssValueParser_index.cssValueParser.parse(offsetScrollRawValue):void 0,revalidate=__privateGet(this,_element).hasAttribute("data-revalidate")||__privateGet(this,_element).hasAttribute("data-pagination-more-link")||__privateGet(this,_element).hasAttribute("data-pagination-set-link")||__privateGet(this,_element).hasAttribute("data-pagination-next-link")||__privateGet(this,_element).hasAttribute("data-pagination-prev-link"),keepSearchParameters=__privateGet(this,_element).hasAttribute("data-keep-search-parameters"),keepScrollPosition=__privateGet(this,_element).hasAttribute("data-keep-scroll-position")||__privateGet(this,_element).hasAttribute("data-pagination-more-link"),scrollBehaviour=__privateGet(this,_element).getAttribute("data-scroll-behaviour"),submorph=(_a=__privateGet(this,_element).getAttribute("data-submorph")||__privateGet(this,_element).getAttribute("data-submorph-append"))==null?void 0:_a.split(",").map(v=>v.trim()),clearState=__privateGet(this,_element).hasAttribute("data-clear-state");let path=__privateGet(this,_MorphLink_instances,path_get);if(__privateGet(this,_element).hasAttribute("data-toggle-params")){const[pathWithoutParams,pathParamsStr]=__privateGet(this,_MorphLink_instances,path_get).split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search),resultParams=new URLSearchParams;for(const[key]of pathParams)(!locationParams.has(key)||locationParams.has(key)&&locationParams.get(key)!==pathParams.get(key))&&resultParams.append(key,pathParams.get(key));if(__privateGet(this,_element).hasAttribute("data-merge-params"))for(const[key]of locationParams)pathParams.has(key)||resultParams.append(key,locationParams.get(key));path=`${pathWithoutParams}?${resultParams.toString()}`}__privateGet(this,_morph).navigate(path,{historyAction,centerScroll,offsetScroll,revalidate,keepSearchParameters,submorph,clearState,keepScrollPosition,scrollBehaviour,submorphAppend:__privateGet(this,_element).hasAttribute("data-submorph-append"),mergeParams:__privateGet(this,_element).hasAttribute("data-merge-params")&&!__privateGet(this,_element).hasAttribute("data-toggle-params"),detail:__privateGet(this,_element).getAttribute("data-detail"),removeParams:__privateGet(this,_element).getAttribute("data-remove-params")||void 0,scrollTo:__privateGet(this,_element).getAttribute("data-scroll-to")||void 0})}},"#click"),_clickListener=new WeakMap,_pointerListener=new WeakMap,__name(_MorphLink,"MorphLink");let MorphLink=_MorphLink;var _element2,_params,_MorphParamsDependent_instances,update_fn,_urlChangeListener;const _MorphParamsDependent=class _MorphParamsDependent{constructor(element){__privateAdd(this,_MorphParamsDependent_instances);__privateAdd(this,_element2);__privateAdd(this,_params,[]);__privateAdd(this,_urlChangeListener,__name(()=>{__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)},"#urlChangeListener"));__privateSet(this,_element2,element);for(const key in __privateGet(this,_element2).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("param-")){const name=kebabKey.split("param-")[1],value=__privateGet(this,_element2).dataset[key];__privateGet(this,_params).push({name,value})}}document.addEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener)),__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener))}};_element2=new WeakMap,_params=new WeakMap,_MorphParamsDependent_instances=new WeakSet,update_fn=__name(function(){const locationParams=new URLSearchParams(location.search);let matched=!!__privateGet(this,_params).find(param=>locationParams.has(param.name)&&(locationParams.get(param.name)===param.value||param.value==="*"||param.value==="all"||param.value==="any"||param.value==="vse"||locationParams.get(param.name)==="*"||locationParams.get(param.name)==="all"||locationParams.get(param.name)==="any"||locationParams.get(param.name)==="vse"));!matched&&__privateGet(this,_element2).hasAttribute("data-match-no-params")&&(matched=!__privateGet(this,_params).filter(param=>locationParams.has(param.name)).length);const hideClass=__privateGet(this,_element2).getAttribute("data-hide-class");matched?hideClass?__privateGet(this,_element2).classList.remove(hideClass):__privateGet(this,_element2).style.display="":hideClass?__privateGet(this,_element2).classList.add(hideClass):__privateGet(this,_element2).style.display="none",requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("resize"))})},"#update"),_urlChangeListener=new WeakMap,__name(_MorphParamsDependent,"MorphParamsDependent");let MorphParamsDependent=_MorphParamsDependent;const domParser=new DOMParser;var _morph2,_pathname,_scrollState,_initialDocument,_modifiedDocument,_currentDocument,_savedState,_abortController,_fetching,_headers,_needRavalidation;const _MorphRoute=class _MorphRoute{constructor(morph,pathname){__privateAdd(this,_morph2);__privateAdd(this,_pathname);__privateAdd(this,_scrollState,{x:0,y:0});__privateAdd(this,_initialDocument,null);__privateAdd(this,_modifiedDocument,null);__privateAdd(this,_currentDocument,null);__privateAdd(this,_savedState,null);__privateAdd(this,_abortController,null);__privateAdd(this,_fetching,null);__privateAdd(this,_headers);__privateAdd(this,_needRavalidation,!1);__privateSet(this,_morph2,morph),__privateSet(this,_pathname,pathname)}get pathname(){return __privateGet(this,_pathname)}get scrollState(){return __privateGet(this,_scrollState)}get document(){return __privateGet(this,_currentDocument)}needRavalidation(){__privateSet(this,_needRavalidation,!0)}setHeaders(headers){__privateSet(this,_headers,headers)}setInitialDocument(document2){__privateSet(this,_initialDocument,document2.cloneNode(!0))}abort(){var _a;return(_a=__privateGet(this,_abortController))==null?void 0:_a.abort(`[${__privateGet(this,_pathname)}] page loading cancelled`)}fetch(path,currentPath,revalidate){return __async(this,null,function*(){var _a;if(!revalidate&&!__privateGet(this,_needRavalidation)){const shouldUseCache=((_a=__privateGet(this,_initialDocument))==null?void 0:_a.documentElement.getAttribute("data-cache"))&¤tPath!==path,isPopstateNavigation=__privateGet(this,_initialDocument)&&__privateGet(this,_morph2).isPopstateNavigation;if(__privateGet(this,_fetching)||shouldUseCache||isPopstateNavigation)return __privateGet(this,_fetching)}return __privateSet(this,_fetching,new Promise(res=>__async(this,null,function*(){try{__privateSet(this,_abortController,new AbortController);const text=yield(yield fetch(path,{signal:__privateGet(this,_abortController).signal,headers:__spreadValues({"X-MORPH":"true","X-MORPH-REVALIDATE":revalidate?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(currentPath),"X-MORPH-NEW-PATH":encodeURIComponent(path)},__privateGet(this,_headers))})).text(),document2=domParser.parseFromString(text,"text/html");this.setInitialDocument(document2),__privateSet(this,_needRavalidation,!1)}catch(e){console.warn(e)}finally{__privateSet(this,_abortController,null),__privateSet(this,_fetching,null),res()}}))),__privateGet(this,_fetching)})}cloneDocument(){__privateSet(this,_currentDocument,(__privateGet(this,_modifiedDocument)||__privateGet(this,_initialDocument)).cloneNode(!0))}get title(){let title="";if(__privateGet(this,_currentDocument).title)title=__privateGet(this,_currentDocument).title;else{const h1=__privateGet(this,_currentDocument).querySelector("h1");title=(h1==null?void 0:h1.innerText)||(h1==null?void 0:h1.textContent)||__privateGet(this,_pathname)}return title}clearScrollState(){__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0}clearDocumentState(){__privateSet(this,_modifiedDocument,null)}saveScrollState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-scroll-restoration")?(__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0):(__privateGet(this,_scrollState).x=__privateGet(this,_morph2).scrollValue.left,__privateGet(this,_scrollState).y=__privateGet(this,_morph2).scrollValue.top)}restoreScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:__privateGet(this,_scrollState).y,left:__privateGet(this,_scrollState).x,behavior:"instant"})}saveDocumentState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-page-restoration")?__privateSet(this,_modifiedDocument,null):__privateSet(this,_modifiedDocument,document.cloneNode(!0))}renewScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(state){__privateSet(this,_savedState,state)}clearState(){const state=__privateGet(this,_savedState);return __privateSet(this,_savedState,null),state}};_morph2=new WeakMap,_pathname=new WeakMap,_scrollState=new WeakMap,_initialDocument=new WeakMap,_modifiedDocument=new WeakMap,_currentDocument=new WeakMap,_savedState=new WeakMap,_abortController=new WeakMap,_fetching=new WeakMap,_headers=new WeakMap,_needRavalidation=new WeakMap,__name(_MorphRoute,"MorphRoute");let MorphRoute=_MorphRoute;var _options,_morphElements,_links,_candidateURL,_currentURL,_previousURL,_promises,_isPopstateNavigation,_currentScrollElement,_isWindowScroll,_routes,_paramDependent,_announcer,_currentScrollX,_currentScrollY,_lastSubmorph,_lastRevalidate,_lastKeepScrollPosition,_checkLink,_Morph_instances,getRoute_fn,getMorphElements_fn,isElementEmitsLoadEvent_fn,updateCurrentScrollElement_fn,tryScrollToElement_fn,_popStateListener,_scrollListener;const _Morph=class _Morph{constructor(parameters){__privateAdd(this,_Morph_instances);__privateAdd(this,_options,null);__privateAdd(this,_morphElements,null);__privateAdd(this,_links,[]);__privateAdd(this,_candidateURL);__privateAdd(this,_currentURL,null);__privateAdd(this,_previousURL);__privateAdd(this,_promises,[]);__privateAdd(this,_isPopstateNavigation,!1);__privateAdd(this,_currentScrollElement,null);__privateAdd(this,_isWindowScroll,!1);__privateAdd(this,_routes,new Map);__privateAdd(this,_paramDependent,[]);__privateAdd(this,_announcer,null);__privateAdd(this,_currentScrollX,0);__privateAdd(this,_currentScrollY,0);__privateAdd(this,_lastSubmorph);__privateAdd(this,_lastRevalidate);__privateAdd(this,_lastKeepScrollPosition);__privateAdd(this,_checkLink,__name(element=>{var _a,_b;return(((_a=element.getAttribute("href"))==null?void 0:_a.startsWith("/"))||((_b=element.getAttribute("href"))==null?void 0:_b.startsWith("?")))&&!element.hasAttribute("download")&&!element.hasAttribute("data-morph-skip")&&!element.closest("[data-morph-skip]")&&element.getAttribute("target")!=="_blank"},"#checkLink"));__privateAdd(this,_popStateListener,__name(event=>__async(this,null,function*(){event.preventDefault(),__privateSet(this,_isPopstateNavigation,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:__privateGet(this,_lastRevalidate)?void 0:__privateGet(this,_lastSubmorph),revalidate:__privateGet(this,_lastRevalidate),keepScrollPosition:__privateGet(this,_lastKeepScrollPosition)}),__privateSet(this,_isPopstateNavigation,!1)}),"#popStateListener"));__privateAdd(this,_scrollListener,__name(()=>{const{left,top}=this.scrollValue,directionY=top-__privateGet(this,_currentScrollY),directionX=left-__privateGet(this,_currentScrollX);__privateSet(this,_currentScrollY,top),__privateSet(this,_currentScrollX,left),document.documentElement.classList.toggle("scroll-y",top>0),document.documentElement.classList.toggle("scroll-x",left>0),document.documentElement.classList.toggle("scroll-y-forward",directionY>0),document.documentElement.classList.toggle("scroll-y-backward",directionY<0),document.documentElement.classList.toggle("scroll-x-forward",directionX>0),document.documentElement.classList.toggle("scroll-x-backward",directionX<0),events.dispatchEvent(document,"morphScroll",{detail:{left,top}})},"#scrollListener"));if(intersector_index.isBrowser&&!_Morph.instance){_Morph.instance=this,__privateSet(this,_options,{base:url.normalizeBase(parameters==null?void 0:parameters.base),waitForHeadToLoad:(parameters==null?void 0:parameters.waitForHeadToLoad)!==!1,trailingSlash:(parameters==null?void 0:parameters.trailingSlash)||!1,scrollSelector:parameters==null?void 0:parameters.scrollSelector,morphInsideScrollContainer:(parameters==null?void 0:parameters.morphInsideScrollContainer)||!1}),__privateSet(this,_morphElements,__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,document.body));const normalizedURL=this.normalizePath(location.pathname+location.search+location.hash);__privateSet(this,_currentURL,normalizedURL);const initialRoute=new MorphRoute(this,__privateGet(this,_currentURL).pathname);initialRoute.setInitialDocument(document),__privateGet(this,_routes).set(__privateGet(this,_currentURL).pathname,initialRoute),document.documentElement.setAttribute("data-current-pathname",__privateGet(this,_currentURL).pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",__privateGet(this,_popStateListener)),url.changeHistory({action:"replace",pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),__privateSet(this,_announcer,new MorphAnnouncer),__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,document)}}get currentURL(){return __privateGet(this,_currentURL)}get previousURL(){return __privateGet(this,_previousURL)}get links(){return __privateGet(this,_links)}get scrollElement(){return __privateGet(this,_currentScrollElement)}get isPopstateNavigation(){return __privateGet(this,_isPopstateNavigation)}get scrollValue(){let top=0,left=0;return __privateGet(this,_isWindowScroll)?(top=window.scrollY,left=window.scrollX):(top=__privateGet(this,_currentScrollElement).scrollTop,left=__privateGet(this,_currentScrollElement).scrollLeft),{top,left}}get isNavigating(){return!!__privateGet(this,_promises).length}saveState(state){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);route&&route.saveState(state)}getState(){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);return route==null?void 0:route.clearState()}normalizePath(path,options){return url.splitPath(path,{base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash,mergeParams:options!=null&&options.mergeParams?location.search:"",removeParams:options==null?void 0:options.removeParams})}prefetch(path,revalidate){return __async(this,null,function*(){var _a;if(__privateGet(this,_promises).length)return;path=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path;const route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,path);route==null||route.fetch(path,__privateGet(this,_currentURL).path,revalidate)})}excludeHeadChild(child){return!1}setHeaders(path){}needRavalidation(path){const normalizedURL=this.normalizePath(path),route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.path);route==null||route.needRavalidation()}navigate(_0){return __async(this,arguments,function*(path,{historyAction="push",centerScroll,offsetScroll,scrollBehaviour,revalidate,keepSearchParameters,submorph,submorphAppend,clearState,keepScrollPosition,mergeParams,removeParams,detail,scrollTo}={}){var _a,_b,_c,_d;if(__privateGet(this,_promises).length)return;__privateSet(this,_lastSubmorph,submorph),__privateSet(this,_lastRevalidate,revalidate),__privateSet(this,_lastKeepScrollPosition,keepScrollPosition);const modifiedPath=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path,normalizedURL=this.normalizePath(modifiedPath,{mergeParams,removeParams});if(!revalidate&&(((_b=__privateGet(this,_candidateURL))==null?void 0:_b.pathname)===normalizedURL.pathname||__privateGet(this,_currentURL).pathname===normalizedURL.pathname)){keepScrollPosition||__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo||normalizedURL.hash||0,{centerScroll,offsetScroll,behavior:"smooth"}),events.dispatchEvent(document,"morphSamePath",{detail:{detail}}),((_c=__privateGet(this,_currentURL))==null?void 0:_c.parameters)!==normalizedURL.parameters&&(__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL),url.changeHistory({action:((_d=__privateGet(this,_currentURL))==null?void 0:_d.hash)!==normalizedURL.hash?"replace":historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),events.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:__privateGet(this,_currentURL),previousURL:__privateGet(this,_previousURL),detail}})),__privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});return}else __privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});__privateSet(this,_candidateURL,normalizedURL);try{let preprocessedSuccesfully=!0;if(this.preprocessor)try{yield new Promise((resolve,reject)=>{var _a2;(_a2=this.preprocessor)==null||_a2.call(this,{url:normalizedURL,resolve,reject,submorph,detail})})}catch(e){e?console.error(e):console.log("Route change canceled"),preprocessedSuccesfully=!1}if(!preprocessedSuccesfully||__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}const navigationEntry={url:normalizedURL,submorph,detail};submorph?submorphAppend||submorph.forEach(sel=>{document.querySelectorAll(sel).forEach(el=>{el.classList.add("out"),el.setAttribute("data-morph-out","")})}):__privateGet(this,_morphElements).forEach(el=>{var _a2,_b2;(_a2=el.firstElementChild)==null||_a2.classList.add("out"),(_b2=el.firstElementChild)==null||_b2.setAttribute("data-morph-out","")}),events.dispatchEvent(document,"morphNavigation",{detail:navigationEntry});const currentRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,__privateGet(this,_currentURL).pathname),nextRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.pathname);if(__privateGet(this,_routes).forEach(el=>{el.pathname!==normalizedURL.pathname&&el.abort()}),yield nextRoute==null?void 0:nextRoute.fetch(modifiedPath,__privateGet(this,_currentURL).path,revalidate),__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}currentRoute.clearState(),currentRoute.saveScrollState(),currentRoute.saveDocumentState(),(!__privateGet(this,_isPopstateNavigation)||revalidate)&&(nextRoute.clearScrollState(),nextRoute.clearDocumentState()),clearState&&nextRoute.clearState(),nextRoute.cloneDocument(),__privateGet(this,_announcer).textContent=nextRoute.title,document.body.appendChild(__privateGet(this,_announcer));const documentFetchedEntry=__spreadProps(__spreadValues({},navigationEntry),{document:nextRoute.document});submorphAppend||documentFetchedEntry.document.querySelectorAll("[data-morph-out]").forEach(el=>{el.classList.remove("out")}),events.dispatchEvent(document,"morphStart",{detail:documentFetchedEntry});const currentHeadChildren=Array.from(document.head.children),newHeadChildren=Array.from(nextRoute.document.head.children),identicalHeadChildren=dom.intersectElements(currentHeadChildren,newHeadChildren),removeHeadChildren=dom.excludeElements(currentHeadChildren,identicalHeadChildren),addHeadChildren=dom.excludeElements(newHeadChildren,identicalHeadChildren).filter(child=>!this.excludeHeadChild(child));addHeadChildren.forEach((child,index)=>{child.tagName==="SCRIPT"&&(addHeadChildren[index]=dom.createScriptElement(child))}),addHeadChildren.forEach(child=>{document.head.appendChild(child)});const elementsWithLoad=addHeadChildren.filter(child=>{if(child.hasAttribute("data-no-waiting"))return!1;if(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child))return!0});__privateGet(this,_options).waitForHeadToLoad&&elementsWithLoad.length&&(yield new Promise(res=>__async(this,null,function*(){let counter=0;try{for(var iter=__forAwait(elementsWithLoad),more,temp,error;more=!(temp=yield iter.next()).done;more=!1){const element=temp.value;element.onload=()=>{counter++,counter===elementsWithLoad.length&&res()}}}catch(temp){error=[temp]}finally{try{more&&(temp=iter.return)&&(yield temp.call(iter))}finally{if(error)throw error[0]}}}))),yield promises.wait(10);const oldElementsWithLoadEvent=[];submorphAppend||removeHeadChildren.forEach(child=>{child.hasAttribute("data-permanent")||(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child)?oldElementsWithLoadEvent.push(child):child.remove())});const newMorphElements=__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,nextRoute.document.body);!__privateGet(this,_options).morphInsideScrollContainer&&!submorph&&__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,nextRoute.document),document.documentElement.setAttribute("data-current-pathname",normalizedURL.pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),url.changeHistory({action:historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters||(keepSearchParameters?location.search:""),hash:normalizedURL.hash}),__privateGet(this,_announcer).remove(),__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL);const morphedElements=[];__privateGet(this,_morphElements).forEach((morphElement,i)=>{const newMorphElement=newMorphElements[i],duration=getComputedStyle(morphElement).getPropertyValue("--morph-duration");let newMorphElementChildNodes=[],currentMorphElementChildNodes=[];submorph?(submorph.forEach(selector=>{const curSubMorphElement=morphElement.querySelector(selector),newSubMorphElement=newMorphElement.querySelector(selector);curSubMorphElement&&newSubMorphElement&&(currentMorphElementChildNodes.push(curSubMorphElement),newMorphElementChildNodes.push(newSubMorphElement))}),currentMorphElementChildNodes.forEach(el=>{el.parentElement&&morphedElements.push(el.parentElement)})):(newMorphElementChildNodes.push(...newMorphElement.childNodes),currentMorphElementChildNodes.push(...morphElement.childNodes),morphedElements.push(morphElement));const transfer=[];submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(this.destroyOldLinks(element),element.classList.add("old"),element.querySelectorAll("[data-morph-transfer]").forEach(el=>{const selector=el.getAttribute("data-morph-transfer");transfer.push({element:el,selector})}))}),newMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(transfer.forEach(item=>{const nestlement=element.querySelector(item.selector);nestlement&&nestlement.replaceWith(nextRoute.document.importNode(item.element,!0))}),this.findNewLinks(element),element.classList.add("new"))}),submorph?submorphAppend?newMorphElementChildNodes.forEach((el,i2)=>{currentMorphElementChildNodes[i2]instanceof HTMLElement&¤tMorphElementChildNodes[i2].append(...el.childNodes)}):newMorphElementChildNodes.forEach((el,i2)=>{var _a2;(_a2=currentMorphElementChildNodes[i2].parentElement)==null||_a2.insertBefore(el,currentMorphElementChildNodes[i2])}):morphElement.prepend(...newMorphElementChildNodes),setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&element.classList.add("old-idle")}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.setProperty("--new-content-height",element.offsetHeight+"px"),element.classList.add("new-idle"))})},0);const detail2=__spreadProps(__spreadValues({},documentFetchedEntry),{morphElement});events.dispatchEvent(document,"morphNewChildrenAdded",{detail:detail2});const promise=new Promise(res=>{setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(el=>{el.remove()}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.removeProperty("--new-content-height"),element.classList.remove("new-idle","new"))}),submorphAppend||events.dispatchEvent(document,"morphOldChildrenRemoved",{detail:detail2}),res()},(parseFloat(duration)||0)*1e3+10)});__privateGet(this,_promises).push(promise)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-nextRoute.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),events.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:nextRoute.scrollState}),scrollTo?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo,{centerScroll,offsetScroll,behavior:scrollBehaviour})):normalizedURL.hash?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,normalizedURL.hash,{centerScroll,offsetScroll,behavior:scrollBehaviour})):__privateGet(this,_isPopstateNavigation)?nextRoute.restoreScrollPosition():keepScrollPosition||nextRoute.renewScrollPosition(),yield Promise.all(__privateGet(this,_promises)),submorphAppend||oldElementsWithLoadEvent.forEach(child=>child.remove()),__privateSet(this,_promises,[]),morphedElements.forEach(el=>{el.querySelectorAll("script").forEach(element=>{element.replaceWith(dom.createScriptElement(element))})}),__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)}),this.findParamsDependent(),events.dispatchEvent(document,"morphComplete",{detail:documentFetchedEntry}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(e){console.error(e)}__privateSet(this,_candidateURL,void 0)})}addLink(element){__privateGet(this,_links).push(new MorphLink(element,this))}addLinks(elements){elements.forEach(element=>{this.addLink(element)})}removeLink(element){__privateSet(this,_links,__privateGet(this,_links).filter(link=>link.element===element?(link.destroy(),!1):!0))}destroyOldLinks(morphElement){__privateSet(this,_links,__privateGet(this,_links).filter(link=>morphElement.contains(link.element)?(link.destroy(),!1):!0))}findNewLinks(morphElement){const linkElements=[...morphElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).push(...linkElements.map(element=>new MorphLink(element,this)))}findLinks(){const linkElements=[...document.documentElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).forEach(link=>link.destroy()),__privateSet(this,_links,linkElements.map(element=>new MorphLink(element,this)))}findParamsDependent(){const elements=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];__privateGet(this,_paramDependent).forEach(link=>link.destroy()),__privateSet(this,_paramDependent,elements.map(element=>new MorphParamsDependent(element)))}};_options=new WeakMap,_morphElements=new WeakMap,_links=new WeakMap,_candidateURL=new WeakMap,_currentURL=new WeakMap,_previousURL=new WeakMap,_promises=new WeakMap,_isPopstateNavigation=new WeakMap,_currentScrollElement=new WeakMap,_isWindowScroll=new WeakMap,_routes=new WeakMap,_paramDependent=new WeakMap,_announcer=new WeakMap,_currentScrollX=new WeakMap,_currentScrollY=new WeakMap,_lastSubmorph=new WeakMap,_lastRevalidate=new WeakMap,_lastKeepScrollPosition=new WeakMap,_checkLink=new WeakMap,_Morph_instances=new WeakSet,getRoute_fn=__name(function(path){const normalizedURL=this.normalizePath(path);let route=__privateGet(this,_routes).get(normalizedURL.pathname);return route||(route=new MorphRoute(this,normalizedURL.pathname),__privateGet(this,_routes).set(normalizedURL.pathname,route)),route},"#getRoute"),getMorphElements_fn=__name(function(el){const morphElements=[...el.querySelectorAll("[data-morph]")];return morphElements.length?morphElements:[el]},"#getMorphElements"),isElementEmitsLoadEvent_fn=__name(function(element){return element.tagName==="SCRIPT"||element.tagName==="STYLE"||element.tagName==="LINK"&&element.getAttribute("rel")==="stylesheet"},"#isElementEmitsLoadEvent"),updateCurrentScrollElement_fn=__name(function(document2){var _a,_b;(_a=__privateGet(this,_currentScrollElement))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),__privateSet(this,_currentScrollY,0),__privateSet(this,_currentScrollX,0),__privateSet(this,_currentScrollElement,__privateGet(this,_options).scrollSelector&&document2.querySelector(__privateGet(this,_options).scrollSelector)||window),__privateSet(this,_isWindowScroll,__privateGet(this,_currentScrollElement)===window),(_b=__privateGet(this,_currentScrollElement))==null||_b.addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_scrollListener).call(this)},"#updateCurrentScrollElement"),tryScrollToElement_fn=__name(function(id,options){const value=typeof id=="string"?document.querySelector(id):id;(typeof value=="number"||value)&&scroll.scrollToElement(value,{scrollElement:__privateGet(this,_currentScrollElement),behavior:(options==null?void 0:options.behavior)||"instant",center:options==null?void 0:options.centerScroll,offset:options==null?void 0:options.offsetScroll})},"#tryScrollToElement"),_popStateListener=new WeakMap,_scrollListener=new WeakMap,__name(_Morph,"Morph"),_Morph.instance=null;let Morph=_Morph;exports.Morph=Morph;
|
package/lib/morph/index.js
CHANGED
|
@@ -32,11 +32,11 @@ var __async = (__this, __arguments, generator) => new Promise((resolve, reject)
|
|
|
32
32
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
33
33
|
});
|
|
34
34
|
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
|
|
35
|
-
import { i as isBrowser } from "../index-
|
|
35
|
+
import { i as isBrowser } from "../index-uJboZXlu.js";
|
|
36
36
|
import { i as intersectElements, e as excludeElements, c as createScriptElement } from "../dom-D8D-_9ty.js";
|
|
37
37
|
import { d as dispatchEvent } from "../events-Ds-TuvYW.js";
|
|
38
38
|
import { w as wait } from "../promises-BsIKOEDq.js";
|
|
39
|
-
import { s as scrollToElement } from "../scroll-
|
|
39
|
+
import { s as scrollToElement } from "../scroll-4Z62EGTm.js";
|
|
40
40
|
import "construct-style-sheets-polyfill";
|
|
41
41
|
import { a as normalizeBase, c as changeHistory, d as splitPath } from "../url-CWCY_qe_.js";
|
|
42
42
|
import { cssValueParser } from "../css-value-parser/index.js";
|
|
@@ -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);const intersector_index=require("../index-DZ44osDT.cjs");require("construct-style-sheets-polyfill");const Store=require("../Store-ClBpeYgL.cjs"),file=require("../file-RHfA3OS-.cjs"),_function=require("../function-H4b_gTg6.cjs"),gestures=require("../gestures-DtYbQr49.cjs"),connector_index=require("../connector/index.cjs"),string=require("../string-Bx5N38JG.cjs"),object=require("../object-DTY_W6xG.cjs"),Viewport=require("../Viewport-BXCUex5k.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),math=require("../math-C-knY2TL.cjs"),number=require("../number-Bu4sGvW7.cjs"),polyfills=require("../polyfills-DZCuDBkA.cjs"),style$1=require("../style-IDJ6db6n.cjs"),knownSvgTags=new Set(["animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","listener","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","solidColor","stop","svg","switch","symbol","text","textPath","title","tspan","view","use"]);var _node,_connectCallbacks,_disconnectCallbacks,_connectorUnsubscribeCallback,_storeRootElements,_events,_ElementConstructor_instances,createNode_fn,isSvgOrHtmlElement_fn,applyProperties_fn,watchNode_fn,createClassList_fn,manageStringStoreClass_fn,manageBooleanStoreClass_fn,createStyle_fn,createAttributeStyle_fn,createJSSStyle_fn,setStyleProperty_fn,createEvents_fn,attachEvents_fn,detachEvents_fn,createAttributes_fn,setAttribute_fn,createChildren_fn,appendChild_fn,getNode_fn,getOrCreateNode_fn,_connect,_disconnect;const _ElementConstructor=class _ElementConstructor{constructor(...args){__privateAdd(this,_ElementConstructor_instances);__privateAdd(this,_node,null);__privateAdd(this,_connectCallbacks,new Set);__privateAdd(this,_disconnectCallbacks,new Set);__privateAdd(this,_connectorUnsubscribeCallback);__privateAdd(this,_storeRootElements);__privateAdd(this,_events);__privateAdd(this,_connect,__name(node=>{__privateGet(this,_connectCallbacks).forEach(callback=>{callback(node)}),__privateGet(this,_connectCallbacks).clear()},"#connect"));__privateAdd(this,_disconnect,__name((node,expired)=>{__privateGet(this,_disconnectCallbacks).forEach(callback=>{callback(node,expired)}),__privateGet(this,_disconnectCallbacks).clear(),__privateMethod(this,_ElementConstructor_instances,detachEvents_fn).call(this)},"#disconnect"));if(intersector_index.isBrowser){const p1=args[0],p2=args[1];__privateSet(this,_node,__privateMethod(this,_ElementConstructor_instances,createNode_fn).call(this,p1,p2==null?void 0:p2.forceSvg)),__privateMethod(this,_ElementConstructor_instances,applyProperties_fn).call(this,p2)}}get node(){return __privateGet(this,_node)}set node(v){var _a;__privateMethod(this,_ElementConstructor_instances,detachEvents_fn).call(this),__privateSet(this,_node,v),(_a=__privateGet(this,_connectorUnsubscribeCallback))==null||_a.call(this),__privateGet(this,_node)instanceof Element&&__privateSet(this,_storeRootElements,[...__privateGet(this,_node).querySelectorAll("store-root")]),__privateMethod(this,_ElementConstructor_instances,attachEvents_fn).call(this),__privateMethod(this,_ElementConstructor_instances,watchNode_fn).call(this)}};_node=new WeakMap,_connectCallbacks=new WeakMap,_disconnectCallbacks=new WeakMap,_connectorUnsubscribeCallback=new WeakMap,_storeRootElements=new WeakMap,_events=new WeakMap,_ElementConstructor_instances=new WeakSet,createNode_fn=__name(function(value,forceSvg){let node=null;if(value instanceof Node)node=value;else if(typeof value=="string")if(!value.includes("<")&&value.includes("-"))node=new(customElements.get(value));else if(value.includes("<")){const wrapper=document.createElement("div");wrapper.innerHTML=value,node=wrapper.firstElementChild}else knownSvgTags.has(value)||forceSvg?node=document.createElementNS("http://www.w3.org/2000/svg",value):node=document.createElement(value);else node=document.createElement("div");return node},"#createNode"),isSvgOrHtmlElement_fn=__name(function(node){return node instanceof HTMLElement||node instanceof SVGElement},"#isSvgOrHtmlElement"),applyProperties_fn=__name(function(properties){if(!properties)return;const isSvgOrHtml=__privateMethod(this,_ElementConstructor_instances,isSvgOrHtmlElement_fn).call(this,__privateGet(this,_node)),ref=properties.ref;delete properties.ref,properties!=null&&properties.onConnect&&(__privateGet(this,_connectCallbacks).add(properties.onConnect),delete properties.onConnect),properties!=null&&properties.onDisconnect&&(__privateGet(this,_disconnectCallbacks).add(properties.onDisconnect),delete properties.onDisconnect);let attributes,events;for(const propertyName in properties){const value=properties[propertyName];propertyName==="class"&&isSvgOrHtml?__privateMethod(this,_ElementConstructor_instances,createClassList_fn).call(this,value):propertyName==="style"&&isSvgOrHtml?__privateMethod(this,_ElementConstructor_instances,createStyle_fn).call(this,value):propertyName==="lightChildren"?__privateMethod(this,_ElementConstructor_instances,createChildren_fn).call(this,__privateGet(this,_node),value):propertyName==="children"?__privateMethod(this,_ElementConstructor_instances,createChildren_fn).call(this,__privateGet(this,_node)instanceof Element?__privateGet(this,_node).shadowRoot||__privateGet(this,_node):__privateGet(this,_node),value):propertyName==="connectedClass"?__privateGet(this,_connectCallbacks).add(()=>{requestAnimationFrame(()=>{__privateGet(this,_node).classList.add(typeof value=="boolean"?"connected":value)})}):propertyName.startsWith("on")?(events||(events={}),events[propertyName]=value):(attributes||(attributes={}),attributes[propertyName]=value)}__privateMethod(this,_ElementConstructor_instances,createAttributes_fn).call(this,attributes),__privateMethod(this,_ElementConstructor_instances,createEvents_fn).call(this,events),ref&&(typeof ref=="function"?ref(__privateGet(this,_node)):ref.current=__privateGet(this,_node)),__privateMethod(this,_ElementConstructor_instances,watchNode_fn).call(this)},"#applyProperties"),watchNode_fn=__name(function(){if(intersector_index.isBrowser&&(__privateGet(this,_disconnectCallbacks).size||__privateGet(this,_connectCallbacks).size)){const watchNode=__privateGet(this,_node)instanceof DocumentFragment?__privateGet(this,_node).firstChild:__privateGet(this,_node);__privateSet(this,_connectorUnsubscribeCallback,connector_index.connector.subscribe(watchNode,{connectCallback:__privateGet(this,_connect),disconnectCallback:__privateGet(this,_disconnect),unsubscribeAfterDisconnect:!0,maxWaitSec:20}))}},"#watchNode"),createClassList_fn=__name(function(classObject){if(classObject){if(typeof classObject=="string")__privateGet(this,_node).classList.add(classObject);else if(Array.isArray(classObject))classObject.forEach(v=>{v&&__privateMethod(this,_ElementConstructor_instances,createClassList_fn).call(this,v)});else if(typeof classObject=="object")if(classObject instanceof Store.Store)__privateMethod(this,_ElementConstructor_instances,manageStringStoreClass_fn).call(this,classObject);else for(const className in classObject){const isActive=classObject[className];isActive instanceof Store.Store?__privateMethod(this,_ElementConstructor_instances,manageBooleanStoreClass_fn).call(this,className,isActive):isActive?__privateGet(this,_node).classList.add(className):__privateGet(this,_node).classList.remove(className)}}else return},"#createClassList"),manageStringStoreClass_fn=__name(function(store){__privateGet(this,_disconnectCallbacks).add(store.subscribe(({current,previous})=>{previous&&[previous].flat().forEach(v=>{v&&__privateGet(this,_node).classList.remove(v)}),current&&[current].flat().forEach(v=>{v&&__privateGet(this,_node).classList.add(v)})}))},"#manageStringStoreClass"),manageBooleanStoreClass_fn=__name(function(className,store){__privateGet(this,_disconnectCallbacks).add(store.subscribe(({current})=>{current?__privateGet(this,_node).classList.add(className):__privateGet(this,_node).classList.remove(className)}))},"#manageBooleanStoreClass"),createStyle_fn=__name(function(object2){if(!object2)return;__privateGet(this,_node).tagName==="style"||__privateGet(this,_node).tagName==="STYLE"?__privateMethod(this,_ElementConstructor_instances,createJSSStyle_fn).call(this,object2):__privateMethod(this,_ElementConstructor_instances,createAttributeStyle_fn).call(this,object2)},"#createStyle"),createAttributeStyle_fn=__name(function(object2){for(const k in object2){const token=k,value=object2[token];value instanceof Store.Store?__privateGet(this,_disconnectCallbacks).add(value.subscribe(({current})=>{__privateMethod(this,_ElementConstructor_instances,setStyleProperty_fn).call(this,token,current)})):__privateMethod(this,_ElementConstructor_instances,setStyleProperty_fn).call(this,token,value)}},"#createAttributeStyle"),createJSSStyle_fn=__name(function(object2){for(const key in object2){const value=object2[key];if(typeof value=="object"&&!(value instanceof Store.Store))__privateGet(this,_node).appendChild(document.createTextNode(`${key} {`)),__privateMethod(this,_ElementConstructor_instances,createJSSStyle_fn).call(this,value),__privateGet(this,_node).appendChild(document.createTextNode("}"));else if(value instanceof Store.Store){const text=document.createTextNode("");__privateGet(this,_disconnectCallbacks).add(value.subscribe(e=>{e.current?text.nodeValue=`${string.camelToKebab(key)}: ${e.current};`:text.nodeValue=""})),__privateGet(this,_node).appendChild(text)}else __privateGet(this,_node).appendChild(document.createTextNode(`${string.camelToKebab(key)}: ${value};`))}},"#createJSSStyle"),setStyleProperty_fn=__name(function(token,value){token.includes("--")?value?__privateGet(this,_node).style.setProperty(token,value.toString()):__privateGet(this,_node).style.removeProperty(token):value?__privateGet(this,_node).style[token]=value.toString():__privateGet(this,_node).style[token]=""},"#setStyleProperty"),createEvents_fn=__name(function(events){if(events){__privateGet(this,_events)||__privateSet(this,_events,[]);for(const k in events){const eventName=k,readyEventName=string.uncapitalize(eventName.split("on").slice(1).join("on")),listener=events[eventName];typeof listener=="object"?__privateGet(this,_events).push({name:readyEventName,callback:listener.callback,options:listener.options}):typeof listener=="function"&&__privateGet(this,_events).push({name:readyEventName,callback:listener})}__privateMethod(this,_ElementConstructor_instances,attachEvents_fn).call(this)}},"#createEvents"),attachEvents_fn=__name(function(){var _a;(_a=__privateGet(this,_events))==null||_a.forEach(event=>{__privateGet(this,_node).addEventListener(event.name,event.callback,event.options)})},"#attachEvents"),detachEvents_fn=__name(function(){var _a;(_a=__privateGet(this,_events))==null||_a.forEach(event=>{__privateGet(this,_node).removeEventListener(event.name,event.callback,event.options)})},"#detachEvents"),createAttributes_fn=__name(function(attributes){for(const attributeName in attributes){const value=attributes[attributeName];value instanceof Store.Store?__privateGet(this,_disconnectCallbacks).add(value.subscribe(({current})=>{__privateMethod(this,_ElementConstructor_instances,setAttribute_fn).call(this,attributeName,current)})):__privateMethod(this,_ElementConstructor_instances,setAttribute_fn).call(this,attributeName,value)}},"#createAttributes"),setAttribute_fn=__name(function(name,value){var _a,_b;const element2=__privateGet(this,_node);if(name in element2&&!((_b=(_a=element2.constructor)==null?void 0:_a.observedAttributes)!=null&&_b.includes(name)))value!=null&&(element2[name]=value.toString());else if(value!=null){const str=value.toString();name.includes("xlink")?element2.setAttributeNS("http://www.w3.org/1999/xlink",name,str):element2.setAttribute(name,str)}},"#setAttribute"),createChildren_fn=__name(function(root,children){children&&(children=[children].flat(),children.forEach(child=>{if(child instanceof Store.Store){const storeRootElement=document.createElement("div");storeRootElement.style.display="contents",root.appendChild(storeRootElement),__privateGet(this,_storeRootElements)||__privateSet(this,_storeRootElements,[]);const storeRootElementIndex=__privateGet(this,_storeRootElements).length;storeRootElement.setAttribute("store-root",""),__privateGet(this,_storeRootElements).push(storeRootElement),__privateGet(this,_disconnectCallbacks).add(child.subscribe(({current,previous})=>{const rootElement=__privateGet(this,_storeRootElements)[storeRootElementIndex];rootElement.dispatchEvent(new CustomEvent("beforeChildrenChange",{bubbles:!0,composed:!0}));const currentNodes=Array.from(rootElement.childNodes),currentItems=Array.isArray(current)?current:[current],previousItems=Array.isArray(previous)?previous:[previous],nodesToDelete=[],similarPreviousItems=[];currentNodes.length&&previousItems.forEach((previousItem,index)=>{currentItems.includes(previousItem)?similarPreviousItems.push(previousItem):nodesToDelete.push(currentNodes[index])}),currentItems.forEach((currentItem,index)=>{if(similarPreviousItems[index]!=null){if(currentItem!==similarPreviousItems[index]){const newNode=__privateMethod(this,_ElementConstructor_instances,getNode_fn).call(this,currentItem),currentNode=currentNodes[index];newNode instanceof Node&&!currentNode.isEqualNode(newNode)?rootElement.replaceChild(newNode,currentNode):rootElement.removeChild(currentNode)}}else{const newNode=__privateMethod(this,_ElementConstructor_instances,getNode_fn).call(this,currentItem);newNode instanceof Node&&storeRootElement.appendChild(newNode)}}),nodesToDelete.forEach(node=>{rootElement.removeChild(node)}),rootElement.dispatchEvent(new CustomEvent("afterChildrenChange",{bubbles:!0,composed:!0}))}))}else if(child instanceof _ElementConstructor)__privateMethod(this,_ElementConstructor_instances,appendChild_fn).call(this,root,child.node);else if(child instanceof Function)__privateMethod(this,_ElementConstructor_instances,createChildren_fn).call(this,root,object.isESClass(child)?new child:child());else{const childNodeOrUndefined=__privateMethod(this,_ElementConstructor_instances,getOrCreateNode_fn).call(this,child);childNodeOrUndefined instanceof Node&&__privateMethod(this,_ElementConstructor_instances,appendChild_fn).call(this,root,childNodeOrUndefined)}}))},"#createChildren"),appendChild_fn=__name(function(root,node){!(root instanceof ShadowRoot)&&node instanceof HTMLElement&&node.tagName==="STYLE"?(__privateGet(this,_connectCallbacks).add(()=>{[...document.head.querySelectorAll("style")].find(s=>s.outerHTML===node.outerHTML)||document.head.appendChild(node)}),__privateGet(this,_disconnectCallbacks).add(()=>{node.remove()})):root.appendChild(node)},"#appendChild"),getNode_fn=__name(function(child){return child instanceof _ElementConstructor?child.node:typeof child=="function"?object.isESClass(child)?new child:child():__privateMethod(this,_ElementConstructor_instances,getOrCreateNode_fn).call(this,child)},"#getNode"),getOrCreateNode_fn=__name(function(child){if(child instanceof Node)return child;if(child!=null){const str=String(child);if(str.trim().startsWith("<")&&str.trim().endsWith(">")){const wrapper=document.createElement("div");return wrapper.innerHTML=str,wrapper.firstElementChild}else return document.createTextNode(str)}else return},"#getOrCreateNode"),_connect=new WeakMap,_disconnect=new WeakMap,__name(_ElementConstructor,"ElementConstructor");let ElementConstructor=_ElementConstructor;function element(...args){return new ElementConstructor(...args)}__name(element,"element");function a(object2){return new ElementConstructor("a",object2)}__name(a,"a");function button(object2){return new ElementConstructor("button",object2)}__name(button,"button");function div(object2){return new ElementConstructor("div",object2)}__name(div,"div");function input(object2){return new ElementConstructor("input",object2)}__name(input,"input");function label(object2){return new ElementConstructor("label",object2)}__name(label,"label");function slot(object2){return new ElementConstructor("slot",object2)}__name(slot,"slot");function span(object2){return new ElementConstructor("span",object2)}__name(span,"span");function style(object2){return new ElementConstructor("style",{style:object2})}__name(style,"style");function createStylesheet(object2){const sheet=new CSSStyleSheet;return sheet.replaceSync(style(object2).node.innerHTML),sheet}__name(createStylesheet,"createStylesheet");function createTheme(object2,options){const prefix=options==null?void 0:options.prefix,result={style:{}};for(const key in object2)result[key]={var:`var(--${prefix}${string.camelToKebab(key)})`,value:object2[key]},result.style[`--${prefix}${string.camelToKebab(key)}`]=object2[key];return result}__name(createTheme,"createTheme");const aptechkaTheme=createTheme({colorMain:"#1c1c1c",colorMainAux:"#282828",colorFont:"#ffffff",colorActive:"#00E5B0",borderRadius:"12px",borderRadiusSmall:"4px"},{prefix:"aptechka-"});if(intersector_index.isBrowser){const styleNode=style({":root":aptechkaTheme.style}).node;styleNode.setAttribute("data-permanent",""),document.head.appendChild(styleNode)}const resetIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M20.536 3.464C19.07 2 16.714 2 12 2C7.286 2 4.929 2 3.464 3.464C2 4.93 2 7.286 2 12c0 4.714 0 7.071 1.464 8.535C4.93 22 7.286 22 12 22c4.714 0 7.071 0 8.535-1.465C22 19.072 22 16.714 22 12s0-7.071-1.465-8.536M16.75 12a.75.75 0 0 1-.75.75H9.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 1 1 1.06 1.06l-1.72 1.72H16a.75.75 0 0 1 .75.75" clip-rule="evenodd"/></svg>',copyIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path d="M15.24 2h-3.894c-1.764 0-3.162 0-4.255.148c-1.126.152-2.037.472-2.755 1.193c-.719.721-1.038 1.636-1.189 2.766C3 7.205 3 8.608 3 10.379v5.838c0 1.508.92 2.8 2.227 3.342c-.067-.91-.067-2.185-.067-3.247v-5.01c0-1.281 0-2.386.118-3.27c.127-.948.413-1.856 1.147-2.593c.734-.737 1.639-1.024 2.583-1.152c.88-.118 1.98-.118 3.257-.118h3.07c1.276 0 2.374 0 3.255.118A3.601 3.601 0 0 0 15.24 2Z"/><path d="M6.6 11.397c0-2.726 0-4.089.844-4.936c.843-.847 2.2-.847 4.916-.847h2.88c2.715 0 4.073 0 4.917.847c.843.847.843 2.21.843 4.936v4.82c0 2.726 0 4.089-.843 4.936c-.844.847-2.202.847-4.917.847h-2.88c-2.715 0-4.073 0-4.916-.847c-.844-.847-.844-2.21-.844-4.936v-4.82Z"/></svg>',downloadIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2c4.714 0 7.071 0 8.535 1.464C22 4.93 22 7.286 22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Zm10-5.75a.75.75 0 0 1 .75.75v5.19l1.72-1.72a.75.75 0 1 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 1 1 1.06-1.06l1.72 1.72V7a.75.75 0 0 1 .75-.75Zm-4 10a.75.75 0 0 0 0 1.5h8a.75.75 0 0 0 0-1.5H8Z" clip-rule="evenodd"/></svg>',uploadIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2c4.714 0 7.071 0 8.535 1.464C22 4.93 22 7.286 22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Zm10 5.75a.75.75 0 0 0 .75-.75v-5.19l1.72 1.72a.75.75 0 1 0 1.06-1.06l-3-3a.75.75 0 0 0-1.06 0l-3 3a.75.75 0 1 0 1.06 1.06l1.72-1.72V17c0 .414.336.75.75.75Zm-4-10a.75.75 0 0 1 0-1.5h8a.75.75 0 0 1 0 1.5H8Z" clip-rule="evenodd"/></svg>',arrowIcon=`<svg
|
|
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);const intersector_index=require("../index-Cz5-98rw.cjs");require("construct-style-sheets-polyfill");const Store=require("../Store-BkYJHJp5.cjs"),file=require("../file-RHfA3OS-.cjs"),_function=require("../function-H4b_gTg6.cjs"),gestures=require("../gestures-DtYbQr49.cjs"),connector_index=require("../connector/index.cjs"),string=require("../string-Bx5N38JG.cjs"),object=require("../object-DTY_W6xG.cjs"),Viewport=require("../Viewport-DwPeXyM2.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),math=require("../math-C-knY2TL.cjs"),number=require("../number-Bu4sGvW7.cjs"),polyfills=require("../polyfills-DZCuDBkA.cjs"),style$1=require("../style-IDJ6db6n.cjs"),knownSvgTags=new Set(["animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","listener","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","solidColor","stop","svg","switch","symbol","text","textPath","title","tspan","view","use"]);var _node,_connectCallbacks,_disconnectCallbacks,_connectorUnsubscribeCallback,_storeRootElements,_events,_ElementConstructor_instances,createNode_fn,isSvgOrHtmlElement_fn,applyProperties_fn,watchNode_fn,createClassList_fn,manageStringStoreClass_fn,manageBooleanStoreClass_fn,createStyle_fn,createAttributeStyle_fn,createJSSStyle_fn,setStyleProperty_fn,createEvents_fn,attachEvents_fn,detachEvents_fn,createAttributes_fn,setAttribute_fn,createChildren_fn,appendChild_fn,getNode_fn,getOrCreateNode_fn,_connect,_disconnect;const _ElementConstructor=class _ElementConstructor{constructor(...args){__privateAdd(this,_ElementConstructor_instances);__privateAdd(this,_node,null);__privateAdd(this,_connectCallbacks,new Set);__privateAdd(this,_disconnectCallbacks,new Set);__privateAdd(this,_connectorUnsubscribeCallback);__privateAdd(this,_storeRootElements);__privateAdd(this,_events);__privateAdd(this,_connect,__name(node=>{__privateGet(this,_connectCallbacks).forEach(callback=>{callback(node)}),__privateGet(this,_connectCallbacks).clear()},"#connect"));__privateAdd(this,_disconnect,__name((node,expired)=>{__privateGet(this,_disconnectCallbacks).forEach(callback=>{callback(node,expired)}),__privateGet(this,_disconnectCallbacks).clear(),__privateMethod(this,_ElementConstructor_instances,detachEvents_fn).call(this)},"#disconnect"));if(intersector_index.isBrowser){const p1=args[0],p2=args[1];__privateSet(this,_node,__privateMethod(this,_ElementConstructor_instances,createNode_fn).call(this,p1,p2==null?void 0:p2.forceSvg)),__privateMethod(this,_ElementConstructor_instances,applyProperties_fn).call(this,p2)}}get node(){return __privateGet(this,_node)}set node(v){var _a;__privateMethod(this,_ElementConstructor_instances,detachEvents_fn).call(this),__privateSet(this,_node,v),(_a=__privateGet(this,_connectorUnsubscribeCallback))==null||_a.call(this),__privateGet(this,_node)instanceof Element&&__privateSet(this,_storeRootElements,[...__privateGet(this,_node).querySelectorAll("store-root")]),__privateMethod(this,_ElementConstructor_instances,attachEvents_fn).call(this),__privateMethod(this,_ElementConstructor_instances,watchNode_fn).call(this)}};_node=new WeakMap,_connectCallbacks=new WeakMap,_disconnectCallbacks=new WeakMap,_connectorUnsubscribeCallback=new WeakMap,_storeRootElements=new WeakMap,_events=new WeakMap,_ElementConstructor_instances=new WeakSet,createNode_fn=__name(function(value,forceSvg){let node=null;if(value instanceof Node)node=value;else if(typeof value=="string")if(!value.includes("<")&&value.includes("-"))node=new(customElements.get(value));else if(value.includes("<")){const wrapper=document.createElement("div");wrapper.innerHTML=value,node=wrapper.firstElementChild}else knownSvgTags.has(value)||forceSvg?node=document.createElementNS("http://www.w3.org/2000/svg",value):node=document.createElement(value);else node=document.createElement("div");return node},"#createNode"),isSvgOrHtmlElement_fn=__name(function(node){return node instanceof HTMLElement||node instanceof SVGElement},"#isSvgOrHtmlElement"),applyProperties_fn=__name(function(properties){if(!properties)return;const isSvgOrHtml=__privateMethod(this,_ElementConstructor_instances,isSvgOrHtmlElement_fn).call(this,__privateGet(this,_node)),ref=properties.ref;delete properties.ref,properties!=null&&properties.onConnect&&(__privateGet(this,_connectCallbacks).add(properties.onConnect),delete properties.onConnect),properties!=null&&properties.onDisconnect&&(__privateGet(this,_disconnectCallbacks).add(properties.onDisconnect),delete properties.onDisconnect);let attributes,events;for(const propertyName in properties){const value=properties[propertyName];propertyName==="class"&&isSvgOrHtml?__privateMethod(this,_ElementConstructor_instances,createClassList_fn).call(this,value):propertyName==="style"&&isSvgOrHtml?__privateMethod(this,_ElementConstructor_instances,createStyle_fn).call(this,value):propertyName==="lightChildren"?__privateMethod(this,_ElementConstructor_instances,createChildren_fn).call(this,__privateGet(this,_node),value):propertyName==="children"?__privateMethod(this,_ElementConstructor_instances,createChildren_fn).call(this,__privateGet(this,_node)instanceof Element?__privateGet(this,_node).shadowRoot||__privateGet(this,_node):__privateGet(this,_node),value):propertyName==="connectedClass"?__privateGet(this,_connectCallbacks).add(()=>{requestAnimationFrame(()=>{__privateGet(this,_node).classList.add(typeof value=="boolean"?"connected":value)})}):propertyName.startsWith("on")?(events||(events={}),events[propertyName]=value):(attributes||(attributes={}),attributes[propertyName]=value)}__privateMethod(this,_ElementConstructor_instances,createAttributes_fn).call(this,attributes),__privateMethod(this,_ElementConstructor_instances,createEvents_fn).call(this,events),ref&&(typeof ref=="function"?ref(__privateGet(this,_node)):ref.current=__privateGet(this,_node)),__privateMethod(this,_ElementConstructor_instances,watchNode_fn).call(this)},"#applyProperties"),watchNode_fn=__name(function(){if(intersector_index.isBrowser&&(__privateGet(this,_disconnectCallbacks).size||__privateGet(this,_connectCallbacks).size)){const watchNode=__privateGet(this,_node)instanceof DocumentFragment?__privateGet(this,_node).firstChild:__privateGet(this,_node);__privateSet(this,_connectorUnsubscribeCallback,connector_index.connector.subscribe(watchNode,{connectCallback:__privateGet(this,_connect),disconnectCallback:__privateGet(this,_disconnect),unsubscribeAfterDisconnect:!0,maxWaitSec:20}))}},"#watchNode"),createClassList_fn=__name(function(classObject){if(classObject){if(typeof classObject=="string")__privateGet(this,_node).classList.add(classObject);else if(Array.isArray(classObject))classObject.forEach(v=>{v&&__privateMethod(this,_ElementConstructor_instances,createClassList_fn).call(this,v)});else if(typeof classObject=="object")if(classObject instanceof Store.Store)__privateMethod(this,_ElementConstructor_instances,manageStringStoreClass_fn).call(this,classObject);else for(const className in classObject){const isActive=classObject[className];isActive instanceof Store.Store?__privateMethod(this,_ElementConstructor_instances,manageBooleanStoreClass_fn).call(this,className,isActive):isActive?__privateGet(this,_node).classList.add(className):__privateGet(this,_node).classList.remove(className)}}else return},"#createClassList"),manageStringStoreClass_fn=__name(function(store){__privateGet(this,_disconnectCallbacks).add(store.subscribe(({current,previous})=>{previous&&[previous].flat().forEach(v=>{v&&__privateGet(this,_node).classList.remove(v)}),current&&[current].flat().forEach(v=>{v&&__privateGet(this,_node).classList.add(v)})}))},"#manageStringStoreClass"),manageBooleanStoreClass_fn=__name(function(className,store){__privateGet(this,_disconnectCallbacks).add(store.subscribe(({current})=>{current?__privateGet(this,_node).classList.add(className):__privateGet(this,_node).classList.remove(className)}))},"#manageBooleanStoreClass"),createStyle_fn=__name(function(object2){if(!object2)return;__privateGet(this,_node).tagName==="style"||__privateGet(this,_node).tagName==="STYLE"?__privateMethod(this,_ElementConstructor_instances,createJSSStyle_fn).call(this,object2):__privateMethod(this,_ElementConstructor_instances,createAttributeStyle_fn).call(this,object2)},"#createStyle"),createAttributeStyle_fn=__name(function(object2){for(const k in object2){const token=k,value=object2[token];value instanceof Store.Store?__privateGet(this,_disconnectCallbacks).add(value.subscribe(({current})=>{__privateMethod(this,_ElementConstructor_instances,setStyleProperty_fn).call(this,token,current)})):__privateMethod(this,_ElementConstructor_instances,setStyleProperty_fn).call(this,token,value)}},"#createAttributeStyle"),createJSSStyle_fn=__name(function(object2){for(const key in object2){const value=object2[key];if(typeof value=="object"&&!(value instanceof Store.Store))__privateGet(this,_node).appendChild(document.createTextNode(`${key} {`)),__privateMethod(this,_ElementConstructor_instances,createJSSStyle_fn).call(this,value),__privateGet(this,_node).appendChild(document.createTextNode("}"));else if(value instanceof Store.Store){const text=document.createTextNode("");__privateGet(this,_disconnectCallbacks).add(value.subscribe(e=>{e.current?text.nodeValue=`${string.camelToKebab(key)}: ${e.current};`:text.nodeValue=""})),__privateGet(this,_node).appendChild(text)}else __privateGet(this,_node).appendChild(document.createTextNode(`${string.camelToKebab(key)}: ${value};`))}},"#createJSSStyle"),setStyleProperty_fn=__name(function(token,value){token.includes("--")?value?__privateGet(this,_node).style.setProperty(token,value.toString()):__privateGet(this,_node).style.removeProperty(token):value?__privateGet(this,_node).style[token]=value.toString():__privateGet(this,_node).style[token]=""},"#setStyleProperty"),createEvents_fn=__name(function(events){if(events){__privateGet(this,_events)||__privateSet(this,_events,[]);for(const k in events){const eventName=k,readyEventName=string.uncapitalize(eventName.split("on").slice(1).join("on")),listener=events[eventName];typeof listener=="object"?__privateGet(this,_events).push({name:readyEventName,callback:listener.callback,options:listener.options}):typeof listener=="function"&&__privateGet(this,_events).push({name:readyEventName,callback:listener})}__privateMethod(this,_ElementConstructor_instances,attachEvents_fn).call(this)}},"#createEvents"),attachEvents_fn=__name(function(){var _a;(_a=__privateGet(this,_events))==null||_a.forEach(event=>{__privateGet(this,_node).addEventListener(event.name,event.callback,event.options)})},"#attachEvents"),detachEvents_fn=__name(function(){var _a;(_a=__privateGet(this,_events))==null||_a.forEach(event=>{__privateGet(this,_node).removeEventListener(event.name,event.callback,event.options)})},"#detachEvents"),createAttributes_fn=__name(function(attributes){for(const attributeName in attributes){const value=attributes[attributeName];value instanceof Store.Store?__privateGet(this,_disconnectCallbacks).add(value.subscribe(({current})=>{__privateMethod(this,_ElementConstructor_instances,setAttribute_fn).call(this,attributeName,current)})):__privateMethod(this,_ElementConstructor_instances,setAttribute_fn).call(this,attributeName,value)}},"#createAttributes"),setAttribute_fn=__name(function(name,value){var _a,_b;const element2=__privateGet(this,_node);if(name in element2&&!((_b=(_a=element2.constructor)==null?void 0:_a.observedAttributes)!=null&&_b.includes(name)))value!=null&&(element2[name]=value.toString());else if(value!=null){const str=value.toString();name.includes("xlink")?element2.setAttributeNS("http://www.w3.org/1999/xlink",name,str):element2.setAttribute(name,str)}},"#setAttribute"),createChildren_fn=__name(function(root,children){children&&(children=[children].flat(),children.forEach(child=>{if(child instanceof Store.Store){const storeRootElement=document.createElement("div");storeRootElement.style.display="contents",root.appendChild(storeRootElement),__privateGet(this,_storeRootElements)||__privateSet(this,_storeRootElements,[]);const storeRootElementIndex=__privateGet(this,_storeRootElements).length;storeRootElement.setAttribute("store-root",""),__privateGet(this,_storeRootElements).push(storeRootElement),__privateGet(this,_disconnectCallbacks).add(child.subscribe(({current,previous})=>{const rootElement=__privateGet(this,_storeRootElements)[storeRootElementIndex];rootElement.dispatchEvent(new CustomEvent("beforeChildrenChange",{bubbles:!0,composed:!0}));const currentNodes=Array.from(rootElement.childNodes),currentItems=Array.isArray(current)?current:[current],previousItems=Array.isArray(previous)?previous:[previous],nodesToDelete=[],similarPreviousItems=[];currentNodes.length&&previousItems.forEach((previousItem,index)=>{currentItems.includes(previousItem)?similarPreviousItems.push(previousItem):nodesToDelete.push(currentNodes[index])}),currentItems.forEach((currentItem,index)=>{if(similarPreviousItems[index]!=null){if(currentItem!==similarPreviousItems[index]){const newNode=__privateMethod(this,_ElementConstructor_instances,getNode_fn).call(this,currentItem),currentNode=currentNodes[index];newNode instanceof Node&&!currentNode.isEqualNode(newNode)?rootElement.replaceChild(newNode,currentNode):rootElement.removeChild(currentNode)}}else{const newNode=__privateMethod(this,_ElementConstructor_instances,getNode_fn).call(this,currentItem);newNode instanceof Node&&storeRootElement.appendChild(newNode)}}),nodesToDelete.forEach(node=>{rootElement.removeChild(node)}),rootElement.dispatchEvent(new CustomEvent("afterChildrenChange",{bubbles:!0,composed:!0}))}))}else if(child instanceof _ElementConstructor)__privateMethod(this,_ElementConstructor_instances,appendChild_fn).call(this,root,child.node);else if(child instanceof Function)__privateMethod(this,_ElementConstructor_instances,createChildren_fn).call(this,root,object.isESClass(child)?new child:child());else{const childNodeOrUndefined=__privateMethod(this,_ElementConstructor_instances,getOrCreateNode_fn).call(this,child);childNodeOrUndefined instanceof Node&&__privateMethod(this,_ElementConstructor_instances,appendChild_fn).call(this,root,childNodeOrUndefined)}}))},"#createChildren"),appendChild_fn=__name(function(root,node){!(root instanceof ShadowRoot)&&node instanceof HTMLElement&&node.tagName==="STYLE"?(__privateGet(this,_connectCallbacks).add(()=>{[...document.head.querySelectorAll("style")].find(s=>s.outerHTML===node.outerHTML)||document.head.appendChild(node)}),__privateGet(this,_disconnectCallbacks).add(()=>{node.remove()})):root.appendChild(node)},"#appendChild"),getNode_fn=__name(function(child){return child instanceof _ElementConstructor?child.node:typeof child=="function"?object.isESClass(child)?new child:child():__privateMethod(this,_ElementConstructor_instances,getOrCreateNode_fn).call(this,child)},"#getNode"),getOrCreateNode_fn=__name(function(child){if(child instanceof Node)return child;if(child!=null){const str=String(child);if(str.trim().startsWith("<")&&str.trim().endsWith(">")){const wrapper=document.createElement("div");return wrapper.innerHTML=str,wrapper.firstElementChild}else return document.createTextNode(str)}else return},"#getOrCreateNode"),_connect=new WeakMap,_disconnect=new WeakMap,__name(_ElementConstructor,"ElementConstructor");let ElementConstructor=_ElementConstructor;function element(...args){return new ElementConstructor(...args)}__name(element,"element");function a(object2){return new ElementConstructor("a",object2)}__name(a,"a");function button(object2){return new ElementConstructor("button",object2)}__name(button,"button");function div(object2){return new ElementConstructor("div",object2)}__name(div,"div");function input(object2){return new ElementConstructor("input",object2)}__name(input,"input");function label(object2){return new ElementConstructor("label",object2)}__name(label,"label");function slot(object2){return new ElementConstructor("slot",object2)}__name(slot,"slot");function span(object2){return new ElementConstructor("span",object2)}__name(span,"span");function style(object2){return new ElementConstructor("style",{style:object2})}__name(style,"style");function createStylesheet(object2){const sheet=new CSSStyleSheet;return sheet.replaceSync(style(object2).node.innerHTML),sheet}__name(createStylesheet,"createStylesheet");function createTheme(object2,options){const prefix=options==null?void 0:options.prefix,result={style:{}};for(const key in object2)result[key]={var:`var(--${prefix}${string.camelToKebab(key)})`,value:object2[key]},result.style[`--${prefix}${string.camelToKebab(key)}`]=object2[key];return result}__name(createTheme,"createTheme");const aptechkaTheme=createTheme({colorMain:"#1c1c1c",colorMainAux:"#282828",colorFont:"#ffffff",colorActive:"#00E5B0",borderRadius:"12px",borderRadiusSmall:"4px"},{prefix:"aptechka-"});if(intersector_index.isBrowser){const styleNode=style({":root":aptechkaTheme.style}).node;styleNode.setAttribute("data-permanent",""),document.head.appendChild(styleNode)}const resetIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M20.536 3.464C19.07 2 16.714 2 12 2C7.286 2 4.929 2 3.464 3.464C2 4.93 2 7.286 2 12c0 4.714 0 7.071 1.464 8.535C4.93 22 7.286 22 12 22c4.714 0 7.071 0 8.535-1.465C22 19.072 22 16.714 22 12s0-7.071-1.465-8.536M16.75 12a.75.75 0 0 1-.75.75H9.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 1 1 1.06 1.06l-1.72 1.72H16a.75.75 0 0 1 .75.75" clip-rule="evenodd"/></svg>',copyIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path d="M15.24 2h-3.894c-1.764 0-3.162 0-4.255.148c-1.126.152-2.037.472-2.755 1.193c-.719.721-1.038 1.636-1.189 2.766C3 7.205 3 8.608 3 10.379v5.838c0 1.508.92 2.8 2.227 3.342c-.067-.91-.067-2.185-.067-3.247v-5.01c0-1.281 0-2.386.118-3.27c.127-.948.413-1.856 1.147-2.593c.734-.737 1.639-1.024 2.583-1.152c.88-.118 1.98-.118 3.257-.118h3.07c1.276 0 2.374 0 3.255.118A3.601 3.601 0 0 0 15.24 2Z"/><path d="M6.6 11.397c0-2.726 0-4.089.844-4.936c.843-.847 2.2-.847 4.916-.847h2.88c2.715 0 4.073 0 4.917.847c.843.847.843 2.21.843 4.936v4.82c0 2.726 0 4.089-.843 4.936c-.844.847-2.202.847-4.917.847h-2.88c-2.715 0-4.073 0-4.916-.847c-.844-.847-.844-2.21-.844-4.936v-4.82Z"/></svg>',downloadIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2c4.714 0 7.071 0 8.535 1.464C22 4.93 22 7.286 22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Zm10-5.75a.75.75 0 0 1 .75.75v5.19l1.72-1.72a.75.75 0 1 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 1 1 1.06-1.06l1.72 1.72V7a.75.75 0 0 1 .75-.75Zm-4 10a.75.75 0 0 0 0 1.5h8a.75.75 0 0 0 0-1.5H8Z" clip-rule="evenodd"/></svg>',uploadIcon='<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2c4.714 0 7.071 0 8.535 1.464C22 4.93 22 7.286 22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Zm10 5.75a.75.75 0 0 0 .75-.75v-5.19l1.72 1.72a.75.75 0 1 0 1.06-1.06l-3-3a.75.75 0 0 0-1.06 0l-3 3a.75.75 0 1 0 1.06 1.06l1.72-1.72V17c0 .414.336.75.75.75Zm-4-10a.75.75 0 0 1 0-1.5h8a.75.75 0 0 1 0 1.5H8Z" clip-rule="evenodd"/></svg>',arrowIcon=`<svg
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg"
|
|
3
3
|
width="32"
|
|
4
4
|
height="32"
|
|
@@ -5,16 +5,16 @@ var __typeError = (msg) => {
|
|
|
5
5
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
6
6
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
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
|
-
import { i as isBrowser } from "../index-
|
|
8
|
+
import { i as isBrowser } from "../index-uJboZXlu.js";
|
|
9
9
|
import "construct-style-sheets-polyfill";
|
|
10
|
-
import { S as Store, s as storeRegistry, a as activeStores } from "../Store-
|
|
10
|
+
import { S as Store, s as storeRegistry, a as activeStores } from "../Store-DhT9WSHd.js";
|
|
11
11
|
import { c as createJSONAndSave } from "../file-DwQs6bB6.js";
|
|
12
12
|
import { d as debounce } from "../function-UmbPrOHm.js";
|
|
13
13
|
import { s as setupDrag } from "../gestures-DmKKNnh4.js";
|
|
14
14
|
import { connector } from "../connector/index.js";
|
|
15
15
|
import { c as camelToKebab, u as uncapitalize } from "../string-Ct-dy_cs.js";
|
|
16
16
|
import { i as isESClass } from "../object-CiIdEmJx.js";
|
|
17
|
-
import { a as ViewportMediaRules } from "../Viewport-
|
|
17
|
+
import { a as ViewportMediaRules } from "../Viewport-9ZphaP_o.js";
|
|
18
18
|
import { elementResizer } from "../element-resizer/index.js";
|
|
19
19
|
import { c as clamp } from "../math-r8V23YFe.js";
|
|
20
20
|
import { t as toStep } from "../number-DiVt2xnh.js";
|
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"),intersector_index=require("../index-
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cssUnitParser_index=require("../css-unit-parser/index.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),intersector_index=require("../index-Cz5-98rw.cjs"),string=require("../string-Bx5N38JG.cjs");require("construct-style-sheets-polyfill");function distributeAndNormalize({topLeftCornerRadius,topRightCornerRadius,bottomRightCornerRadius,bottomLeftCornerRadius,width,height}){const roundingAndSmoothingBudgetMap={topLeft:-1,topRight:-1,bottomLeft:-1,bottomRight:-1},cornerRadiusMap={topLeft:topLeftCornerRadius,topRight:topRightCornerRadius,bottomLeft:bottomLeftCornerRadius,bottomRight:bottomRightCornerRadius};return Object.entries(cornerRadiusMap).sort(([,radius1],[,radius2])=>radius2-radius1).forEach(([cornerName,radius])=>{const corner=cornerName,adjacents=adjacentsByCorner[corner],budget=Math.min(...adjacents.map(adjacent=>{const adjacentCornerRadius=cornerRadiusMap[adjacent.corner];if(radius===0&&adjacentCornerRadius===0)return 0;const adjacentCornerBudget=roundingAndSmoothingBudgetMap[adjacent.corner],sideLength=adjacent.side==="top"||adjacent.side==="bottom"?width:height;return adjacentCornerBudget>=0?sideLength-roundingAndSmoothingBudgetMap[adjacent.corner]:radius/(radius+adjacentCornerRadius)*sideLength}));roundingAndSmoothingBudgetMap[corner]=budget,cornerRadiusMap[corner]=Math.min(radius,budget)}),{topLeft:{radius:cornerRadiusMap.topLeft,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.topLeft},topRight:{radius:cornerRadiusMap.topRight,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.topRight},bottomLeft:{radius:cornerRadiusMap.bottomLeft,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.bottomLeft},bottomRight:{radius:cornerRadiusMap.bottomRight,roundingAndSmoothingBudget:roundingAndSmoothingBudgetMap.bottomRight}}}__name(distributeAndNormalize,"distributeAndNormalize");const adjacentsByCorner={topLeft:[{corner:"topRight",side:"top"},{corner:"bottomLeft",side:"left"}],topRight:[{corner:"topLeft",side:"top"},{corner:"bottomRight",side:"right"}],bottomLeft:[{corner:"bottomRight",side:"bottom"},{corner:"topLeft",side:"left"}],bottomRight:[{corner:"bottomLeft",side:"bottom"},{corner:"topRight",side:"right"}]};function getPathParamsForCorner({cornerRadius,cornerSmoothing,preserveSmoothing,roundingAndSmoothingBudget,cornerAngleAlpha=90}){let p=(1+cornerSmoothing)*cornerRadius;if(!preserveSmoothing){const maxCornerSmoothing=roundingAndSmoothingBudget/cornerRadius-1;cornerSmoothing=Math.min(cornerSmoothing,maxCornerSmoothing),p=Math.min(p,roundingAndSmoothingBudget)}const arcMeasure=90*(1-cornerSmoothing),arcSectionLength=Math.sin(toRadians(arcMeasure/2))*cornerRadius*Math.sqrt(2),angleAlpha=(cornerAngleAlpha-arcMeasure)/2,p3ToP4Distance=cornerRadius*Math.tan(toRadians(angleAlpha/2)),angleBeta=45*cornerSmoothing,c=p3ToP4Distance*Math.cos(toRadians(angleBeta)),d=c*Math.tan(toRadians(angleBeta));let b=(p-arcSectionLength-c-d)/3,a=2*b;if(preserveSmoothing&&p>roundingAndSmoothingBudget){const p1ToP3MaxDistance=roundingAndSmoothingBudget-d-arcSectionLength-c,minA=p1ToP3MaxDistance/6,maxB=p1ToP3MaxDistance-minA;b=Math.min(b,maxB),a=p1ToP3MaxDistance-b,p=Math.min(p,roundingAndSmoothingBudget)}return{a,b,c,d,p,arcSectionLength,cornerRadius}}__name(getPathParamsForCorner,"getPathParamsForCorner");function getSVGPathFromPathParams({width,height,topLeftPathParams,topRightPathParams,bottomLeftPathParams,bottomRightPathParams,topNotches=[],rightNotches=[],bottomNotches=[],leftNotches=[]}){let d=`M ${topLeftPathParams.p} 0`;return topNotches.forEach(n=>{d+=drawTopNotch(n)}),d+=`L ${width-topRightPathParams.p} 0`,d+=drawTopRightPath(topRightPathParams),rightNotches.forEach(n=>{d+=drawRightNotch(n,width)}),d+=`L ${width} ${height-bottomRightPathParams.p}`,d+=drawBottomRightPath(bottomRightPathParams),bottomNotches.forEach(n=>{d+=drawBottomNotch(n,height)}),d+=`L ${bottomLeftPathParams.p} ${height}`,d+=drawBottomLeftPath(bottomLeftPathParams),leftNotches.forEach(n=>{d+=drawLeftNotch(n)}),d+=`L 0 ${topLeftPathParams.p}`,d+=drawTopLeftPath(topLeftPathParams),d+="Z",d.replace(/[\t\s\n]+/g," ").trim()}__name(getSVGPathFromPathParams,"getSVGPathFromPathParams");function drawTopNotch({start,length,slope,depth}){const end=start+length;return`
|
|
2
2
|
L${start} 0
|
|
3
3
|
C ${start+slope*.5},0 ${start+slope*.5},${depth} ${start+slope},${depth}
|
|
4
4
|
L${end-slope},${depth}
|
package/lib/notched/index.js
CHANGED
|
@@ -7,7 +7,7 @@ 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-
|
|
10
|
+
import { t as ticker } from "../index-uJboZXlu.js";
|
|
11
11
|
import { g as generateId } from "../string-Ct-dy_cs.js";
|
|
12
12
|
import "construct-style-sheets-polyfill";
|
|
13
13
|
function distributeAndNormalize({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const PageAnnouncerElement=require("../PageAnnouncerElement-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const PageAnnouncerElement=require("../PageAnnouncerElement-B0iXrO6l.cjs");exports.PageAnnouncerElement=PageAnnouncerElement.PageAnnouncerElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const PageScroll=require("../PageScroll-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const PageScroll=require("../PageScroll-vCyjlFDP.cjs");exports.PageScroll=PageScroll.PageScroll;
|
package/lib/page-scroll/index.js
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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const dom=require("../dom-B40i6NXw.cjs"),stylesheet$1=require("../stylesheet-
|
|
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);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const dom=require("../dom-B40i6NXw.cjs"),stylesheet$1=require("../stylesheet-iyJcMTje.cjs");require("../index-Cz5-98rw.cjs");const stylesheet=stylesheet$1.createStylesheet(`
|
|
2
2
|
:host {
|
|
3
3
|
position: fixed;
|
|
4
4
|
top: 0;
|
|
@@ -6,8 +6,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
6
6
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
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);
|
|
8
8
|
import { f as findScrollParentElement } from "../dom-D8D-_9ty.js";
|
|
9
|
-
import { c as createStylesheet } from "../stylesheet-
|
|
10
|
-
import "../index-
|
|
9
|
+
import { c as createStylesheet } from "../stylesheet-BvD9P5EO.js";
|
|
10
|
+
import "../index-uJboZXlu.js";
|
|
11
11
|
const stylesheet = createStylesheet(
|
|
12
12
|
/*css*/
|
|
13
13
|
`
|
package/lib/pointer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __defProp=Object.defineProperty;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a};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"});require("../Store-ClBpeYgL.cjs");const coordinates=require("../coordinates-DQ9XV9M1.cjs"),dom=require("../dom-B40i6NXw.cjs"),math=require("../math-C-knY2TL.cjs");require("construct-style-sheets-polyfill");const intersector_index=require("../index-DZ44osDT.cjs"),Damped=require("../Damped-C3R5LGcL.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),windowResizer_index=require("../window-resizer/index.cjs"),cssProperty_index=require("../css-property/index.cjs");var _element,_x,_y,_z,_cartesian,_normalize,_fullScreen,_width,_height,_entered,_pointerEnterListener,_pointerLeaveListener,_pointerMoveListener,_resizeListener,_Pointer_instances,getPointerCoords_fn;const _Pointer=class _Pointer{constructor(parameters){__privateAdd(this,_Pointer_instances);__privateAdd(this,_element);__privateAdd(this,_x);__privateAdd(this,_y);__privateAdd(this,_z);__privateAdd(this,_cartesian);__privateAdd(this,_normalize);__privateAdd(this,_fullScreen,!1);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_entered,!1);__privateAdd(this,_pointerEnterListener,__name(e=>{__privateSet(this,_entered,!0);const pointer=__privateMethod(this,_Pointer_instances,getPointerCoords_fn).call(this,e);__privateGet(this,_x).set(pointer.x,{equalize:!0}),__privateGet(this,_y).set(pointer.y,{equalize:!0}),__privateGet(this,_z).set(1)},"#pointerEnterListener"));__privateAdd(this,_pointerLeaveListener,__name(e=>{__privateSet(this,_entered,!1),__privateGet(this,_z).set(0)},"#pointerLeaveListener"));__privateAdd(this,_pointerMoveListener,__name(e=>{__privateGet(this,_entered)||__privateGet(this,_pointerEnterListener).call(this,e);const pointer=__privateMethod(this,_Pointer_instances,getPointerCoords_fn).call(this,e);__privateGet(this,_x).set(pointer.x),__privateGet(this,_y).set(pointer.y)},"#pointerMoveListener"));__privateAdd(this,_resizeListener,__name(()=>{__privateGet(this,_fullScreen)?(__privateSet(this,_width,document.documentElement.clientWidth),__privateSet(this,_height,innerHeight)):(__privateSet(this,_width,this.element.clientWidth),__privateSet(this,_height,this.element.clientHeight));let xmin=0,xmax=0,ymin=0,ymax=0;__privateGet(this,_cartesian)?__privateGet(this,_normalize)?(xmin=-1,xmax=1,ymin=-1,ymax=1):(xmin=__privateGet(this,_width)/2*-1,xmax=__privateGet(this,_width)/2*1,ymin=__privateGet(this,_height)/2*-1,ymax=__privateGet(this,_height)/2*1):__privateGet(this,_normalize)?(xmin=0,xmax=1,ymin=0,ymax=1):(xmin=0,xmax=__privateGet(this,_width),ymin=0,ymax=__privateGet(this,_height)),__privateGet(this,_x).min=xmin,__privateGet(this,_x).max=xmax,__privateGet(this,_y).min=ymin,__privateGet(this,_y).max=ymax},"#resizeListener"));__privateSet(this,_element,dom.getElement(parameters.element)),__privateSet(this,_x,new Damped.Damped(0,parameters.damped)),__privateSet(this,_y,new Damped.Damped(0,parameters.damped)),__privateSet(this,_z,new Damped.Damped(0,__spreadValues({min:0,max:1},parameters.damped))),__privateSet(this,_cartesian,parameters.cartesian||!1),__privateSet(this,_normalize,parameters.normalize||!1),__privateSet(this,_fullScreen,parameters.fullScreen||!1)}get element(){return __privateGet(this,_element)}get x(){return __privateGet(this,_x)}get y(){return __privateGet(this,_y)}get z(){return __privateGet(this,_z)}get cartesian(){return __privateGet(this,_cartesian)}set cartesian(value){__privateSet(this,_cartesian,value),__privateGet(this,_resizeListener).call(this)}get normalize(){return __privateGet(this,_normalize)}set normalize(value){__privateSet(this,_normalize,value),__privateGet(this,_resizeListener).call(this)}connect(){__privateGet(this,_element).addEventListener("pointerenter",__privateGet(this,_pointerEnterListener)),__privateGet(this,_element).addEventListener("pointerleave",__privateGet(this,_pointerLeaveListener)),__privateGet(this,_element).addEventListener("pointermove",__privateGet(this,_pointerMoveListener)),elementResizer_index.elementResizer.subscribe(__privateGet(this,_element),__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener))}disconnect(){__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerEnterListener)),__privateGet(this,_element).removeEventListener("pointerleave",__privateGet(this,_pointerLeaveListener)),__privateGet(this,_element).removeEventListener("pointermove",__privateGet(this,_pointerMoveListener)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),__privateGet(this,_x).reset(),__privateGet(this,_y).reset(),__privateGet(this,_z).reset()}};_element=new WeakMap,_x=new WeakMap,_y=new WeakMap,_z=new WeakMap,_cartesian=new WeakMap,_normalize=new WeakMap,_fullScreen=new WeakMap,_width=new WeakMap,_height=new WeakMap,_entered=new WeakMap,_pointerEnterListener=new WeakMap,_pointerLeaveListener=new WeakMap,_pointerMoveListener=new WeakMap,_resizeListener=new WeakMap,_Pointer_instances=new WeakSet,getPointerCoords_fn=__name(function(event){let pos=null;__privateGet(this,_fullScreen)?pos={x:event.clientX,y:event.clientY}:pos=coordinates.getPointerPosition(event,__privateGet(this,_element).getBoundingClientRect());const size={width:__privateGet(this,_width),height:__privateGet(this,_height)},pointer={x:pos.x,y:pos.y};if(__privateGet(this,_cartesian)){const res=coordinates.screenToCartesian(pointer,size);pointer.x=res.x,pointer.y=res.y}if(__privateGet(this,_normalize)){const res=coordinates.normalize(pointer,size);__privateGet(this,_cartesian)?(pointer.x=math.clamp(res.x*2,-1,1),pointer.y=math.clamp(res.y*2,-1,1)):(pointer.x=res.x,pointer.y=res.y)}return pointer},"#getPointerCoords"),__name(_Pointer,"Pointer");let Pointer=_Pointer;var _pointer,_dampingCSSProperty,_massCSSProperty,_stiffnessCSSProperty,_cartesianCSSProperty,_normalizeCSSProperty;const _PointerElement=class _PointerElement extends HTMLElement{constructor(){super();__privateAdd(this,_pointer);__privateAdd(this,_dampingCSSProperty,new cssProperty_index.CSSProperty(this,"--damping",20));__privateAdd(this,_massCSSProperty,new cssProperty_index.CSSProperty(this,"--mass",0));__privateAdd(this,_stiffnessCSSProperty,new cssProperty_index.CSSProperty(this,"--stiffness",0));__privateAdd(this,_cartesianCSSProperty,new cssProperty_index.CSSProperty(this,"--cartesian",!1));__privateAdd(this,_normalizeCSSProperty,new cssProperty_index.CSSProperty(this,"--normalize",!1));__privateSet(this,_pointer,new Pointer({element:this})),__privateGet(this,_dampingCSSProperty).subscribe(e=>{__privateGet(this,_pointer).x.damping=e.current,__privateGet(this,_pointer).y.damping=e.current,__privateGet(this,_pointer).z.damping=e.current}),__privateGet(this,_cartesianCSSProperty).subscribe(e=>{__privateGet(this,_pointer).cartesian=e.current}),__privateGet(this,_normalizeCSSProperty).subscribe(e=>{__privateGet(this,_pointer).normalize=e.current}),__privateGet(this,_massCSSProperty).subscribe(e=>{__privateGet(this,_pointer).x.mass=e.current,__privateGet(this,_pointer).y.mass=e.current,__privateGet(this,_pointer).z.mass=e.current}),__privateGet(this,_stiffnessCSSProperty).subscribe(e=>{__privateGet(this,_pointer).x.stiffness=e.current,__privateGet(this,_pointer).y.stiffness=e.current,__privateGet(this,_pointer).z.stiffness=e.current}),__privateGet(this,_pointer).x.subscribe(e=>{this.style.setProperty("--x",e.current.toString())}),__privateGet(this,_pointer).y.subscribe(e=>{this.style.setProperty("--y",e.current.toString())}),__privateGet(this,_pointer).z.subscribe(e=>{this.style.setProperty("--z",e.current.toString())})}get pointer(){return __privateGet(this,_pointer)}connectedCallback(){__privateGet(this,_pointer).connect(),__privateGet(this,_dampingCSSProperty).observe(),__privateGet(this,_massCSSProperty).observe(),__privateGet(this,_stiffnessCSSProperty).observe()}disconnectedCallback(){__privateGet(this,_pointer).disconnect(),__privateGet(this,_dampingCSSProperty).unobserve(),__privateGet(this,_massCSSProperty).unobserve(),__privateGet(this,_stiffnessCSSProperty).unobserve(),this.style.removeProperty("--x"),this.style.removeProperty("--y"),this.style.removeProperty("--z")}};_pointer=new WeakMap,_dampingCSSProperty=new WeakMap,_massCSSProperty=new WeakMap,_stiffnessCSSProperty=new WeakMap,_cartesianCSSProperty=new WeakMap,_normalizeCSSProperty=new WeakMap,__name(_PointerElement,"PointerElement");let PointerElement=_PointerElement;intersector_index.isBrowser&&!customElements.get("e-pointer")&&customElements.define("e-pointer",PointerElement);exports.Pointer=Pointer;exports.PointerElement=PointerElement;
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a};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"});require("../Store-BkYJHJp5.cjs");const coordinates=require("../coordinates-DQ9XV9M1.cjs"),dom=require("../dom-B40i6NXw.cjs"),math=require("../math-C-knY2TL.cjs");require("construct-style-sheets-polyfill");const intersector_index=require("../index-Cz5-98rw.cjs"),Damped=require("../Damped-CYCcZu-z.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),windowResizer_index=require("../window-resizer/index.cjs"),cssProperty_index=require("../css-property/index.cjs");var _element,_x,_y,_z,_cartesian,_normalize,_fullScreen,_width,_height,_entered,_pointerEnterListener,_pointerLeaveListener,_pointerMoveListener,_resizeListener,_Pointer_instances,getPointerCoords_fn;const _Pointer=class _Pointer{constructor(parameters){__privateAdd(this,_Pointer_instances);__privateAdd(this,_element);__privateAdd(this,_x);__privateAdd(this,_y);__privateAdd(this,_z);__privateAdd(this,_cartesian);__privateAdd(this,_normalize);__privateAdd(this,_fullScreen,!1);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_entered,!1);__privateAdd(this,_pointerEnterListener,__name(e=>{__privateSet(this,_entered,!0);const pointer=__privateMethod(this,_Pointer_instances,getPointerCoords_fn).call(this,e);__privateGet(this,_x).set(pointer.x,{equalize:!0}),__privateGet(this,_y).set(pointer.y,{equalize:!0}),__privateGet(this,_z).set(1)},"#pointerEnterListener"));__privateAdd(this,_pointerLeaveListener,__name(e=>{__privateSet(this,_entered,!1),__privateGet(this,_z).set(0)},"#pointerLeaveListener"));__privateAdd(this,_pointerMoveListener,__name(e=>{__privateGet(this,_entered)||__privateGet(this,_pointerEnterListener).call(this,e);const pointer=__privateMethod(this,_Pointer_instances,getPointerCoords_fn).call(this,e);__privateGet(this,_x).set(pointer.x),__privateGet(this,_y).set(pointer.y)},"#pointerMoveListener"));__privateAdd(this,_resizeListener,__name(()=>{__privateGet(this,_fullScreen)?(__privateSet(this,_width,document.documentElement.clientWidth),__privateSet(this,_height,innerHeight)):(__privateSet(this,_width,this.element.clientWidth),__privateSet(this,_height,this.element.clientHeight));let xmin=0,xmax=0,ymin=0,ymax=0;__privateGet(this,_cartesian)?__privateGet(this,_normalize)?(xmin=-1,xmax=1,ymin=-1,ymax=1):(xmin=__privateGet(this,_width)/2*-1,xmax=__privateGet(this,_width)/2*1,ymin=__privateGet(this,_height)/2*-1,ymax=__privateGet(this,_height)/2*1):__privateGet(this,_normalize)?(xmin=0,xmax=1,ymin=0,ymax=1):(xmin=0,xmax=__privateGet(this,_width),ymin=0,ymax=__privateGet(this,_height)),__privateGet(this,_x).min=xmin,__privateGet(this,_x).max=xmax,__privateGet(this,_y).min=ymin,__privateGet(this,_y).max=ymax},"#resizeListener"));__privateSet(this,_element,dom.getElement(parameters.element)),__privateSet(this,_x,new Damped.Damped(0,parameters.damped)),__privateSet(this,_y,new Damped.Damped(0,parameters.damped)),__privateSet(this,_z,new Damped.Damped(0,__spreadValues({min:0,max:1},parameters.damped))),__privateSet(this,_cartesian,parameters.cartesian||!1),__privateSet(this,_normalize,parameters.normalize||!1),__privateSet(this,_fullScreen,parameters.fullScreen||!1)}get element(){return __privateGet(this,_element)}get x(){return __privateGet(this,_x)}get y(){return __privateGet(this,_y)}get z(){return __privateGet(this,_z)}get cartesian(){return __privateGet(this,_cartesian)}set cartesian(value){__privateSet(this,_cartesian,value),__privateGet(this,_resizeListener).call(this)}get normalize(){return __privateGet(this,_normalize)}set normalize(value){__privateSet(this,_normalize,value),__privateGet(this,_resizeListener).call(this)}connect(){__privateGet(this,_element).addEventListener("pointerenter",__privateGet(this,_pointerEnterListener)),__privateGet(this,_element).addEventListener("pointerleave",__privateGet(this,_pointerLeaveListener)),__privateGet(this,_element).addEventListener("pointermove",__privateGet(this,_pointerMoveListener)),elementResizer_index.elementResizer.subscribe(__privateGet(this,_element),__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener))}disconnect(){__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerEnterListener)),__privateGet(this,_element).removeEventListener("pointerleave",__privateGet(this,_pointerLeaveListener)),__privateGet(this,_element).removeEventListener("pointermove",__privateGet(this,_pointerMoveListener)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),__privateGet(this,_x).reset(),__privateGet(this,_y).reset(),__privateGet(this,_z).reset()}};_element=new WeakMap,_x=new WeakMap,_y=new WeakMap,_z=new WeakMap,_cartesian=new WeakMap,_normalize=new WeakMap,_fullScreen=new WeakMap,_width=new WeakMap,_height=new WeakMap,_entered=new WeakMap,_pointerEnterListener=new WeakMap,_pointerLeaveListener=new WeakMap,_pointerMoveListener=new WeakMap,_resizeListener=new WeakMap,_Pointer_instances=new WeakSet,getPointerCoords_fn=__name(function(event){let pos=null;__privateGet(this,_fullScreen)?pos={x:event.clientX,y:event.clientY}:pos=coordinates.getPointerPosition(event,__privateGet(this,_element).getBoundingClientRect());const size={width:__privateGet(this,_width),height:__privateGet(this,_height)},pointer={x:pos.x,y:pos.y};if(__privateGet(this,_cartesian)){const res=coordinates.screenToCartesian(pointer,size);pointer.x=res.x,pointer.y=res.y}if(__privateGet(this,_normalize)){const res=coordinates.normalize(pointer,size);__privateGet(this,_cartesian)?(pointer.x=math.clamp(res.x*2,-1,1),pointer.y=math.clamp(res.y*2,-1,1)):(pointer.x=res.x,pointer.y=res.y)}return pointer},"#getPointerCoords"),__name(_Pointer,"Pointer");let Pointer=_Pointer;var _pointer,_dampingCSSProperty,_massCSSProperty,_stiffnessCSSProperty,_cartesianCSSProperty,_normalizeCSSProperty;const _PointerElement=class _PointerElement extends HTMLElement{constructor(){super();__privateAdd(this,_pointer);__privateAdd(this,_dampingCSSProperty,new cssProperty_index.CSSProperty(this,"--damping",20));__privateAdd(this,_massCSSProperty,new cssProperty_index.CSSProperty(this,"--mass",0));__privateAdd(this,_stiffnessCSSProperty,new cssProperty_index.CSSProperty(this,"--stiffness",0));__privateAdd(this,_cartesianCSSProperty,new cssProperty_index.CSSProperty(this,"--cartesian",!1));__privateAdd(this,_normalizeCSSProperty,new cssProperty_index.CSSProperty(this,"--normalize",!1));__privateSet(this,_pointer,new Pointer({element:this})),__privateGet(this,_dampingCSSProperty).subscribe(e=>{__privateGet(this,_pointer).x.damping=e.current,__privateGet(this,_pointer).y.damping=e.current,__privateGet(this,_pointer).z.damping=e.current}),__privateGet(this,_cartesianCSSProperty).subscribe(e=>{__privateGet(this,_pointer).cartesian=e.current}),__privateGet(this,_normalizeCSSProperty).subscribe(e=>{__privateGet(this,_pointer).normalize=e.current}),__privateGet(this,_massCSSProperty).subscribe(e=>{__privateGet(this,_pointer).x.mass=e.current,__privateGet(this,_pointer).y.mass=e.current,__privateGet(this,_pointer).z.mass=e.current}),__privateGet(this,_stiffnessCSSProperty).subscribe(e=>{__privateGet(this,_pointer).x.stiffness=e.current,__privateGet(this,_pointer).y.stiffness=e.current,__privateGet(this,_pointer).z.stiffness=e.current}),__privateGet(this,_pointer).x.subscribe(e=>{this.style.setProperty("--x",e.current.toString())}),__privateGet(this,_pointer).y.subscribe(e=>{this.style.setProperty("--y",e.current.toString())}),__privateGet(this,_pointer).z.subscribe(e=>{this.style.setProperty("--z",e.current.toString())})}get pointer(){return __privateGet(this,_pointer)}connectedCallback(){__privateGet(this,_pointer).connect(),__privateGet(this,_dampingCSSProperty).observe(),__privateGet(this,_massCSSProperty).observe(),__privateGet(this,_stiffnessCSSProperty).observe()}disconnectedCallback(){__privateGet(this,_pointer).disconnect(),__privateGet(this,_dampingCSSProperty).unobserve(),__privateGet(this,_massCSSProperty).unobserve(),__privateGet(this,_stiffnessCSSProperty).unobserve(),this.style.removeProperty("--x"),this.style.removeProperty("--y"),this.style.removeProperty("--z")}};_pointer=new WeakMap,_dampingCSSProperty=new WeakMap,_massCSSProperty=new WeakMap,_stiffnessCSSProperty=new WeakMap,_cartesianCSSProperty=new WeakMap,_normalizeCSSProperty=new WeakMap,__name(_PointerElement,"PointerElement");let PointerElement=_PointerElement;intersector_index.isBrowser&&!customElements.get("e-pointer")&&customElements.define("e-pointer",PointerElement);exports.Pointer=Pointer;exports.PointerElement=PointerElement;
|
package/lib/pointer/index.js
CHANGED
|
@@ -15,13 +15,13 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
15
15
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
16
16
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
17
17
|
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);
|
|
18
|
-
import "../Store-
|
|
18
|
+
import "../Store-DhT9WSHd.js";
|
|
19
19
|
import { g as getPointerPosition, s as screenToCartesian, n as normalize } from "../coordinates--JG1U6kQ.js";
|
|
20
20
|
import { g as getElement } from "../dom-D8D-_9ty.js";
|
|
21
21
|
import { c as clamp } from "../math-r8V23YFe.js";
|
|
22
22
|
import "construct-style-sheets-polyfill";
|
|
23
|
-
import { i as isBrowser } from "../index-
|
|
24
|
-
import { D as Damped } from "../Damped-
|
|
23
|
+
import { i as isBrowser } from "../index-uJboZXlu.js";
|
|
24
|
+
import { D as Damped } from "../Damped-BjPLo7EW.js";
|
|
25
25
|
import { elementResizer } from "../element-resizer/index.js";
|
|
26
26
|
import { windowResizer } from "../window-resizer/index.js";
|
|
27
27
|
import { CSSProperty } from "../css-property/index.js";
|