aptechka 0.42.8 → 0.42.9

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.
@@ -9,6 +9,7 @@ export interface SourceManagerParameters {
9
9
  export declare class SourceManager extends Store<Source | undefined> {
10
10
  #private;
11
11
  constructor(parameters: SourceManagerParameters);
12
+ updateSource(parameters: SourceManagerParameters): void;
12
13
  close(): void;
13
14
  connect(): void;
14
15
  disconnect(): void;
@@ -1,5 +1,5 @@
1
- "use strict";var W=h=>{throw TypeError(h)};var G=(h,r,e)=>r.has(h)||W("Cannot "+e);var t=(h,r,e)=>(G(h,r,"read from private field"),e?e.call(h):r.get(h)),i=(h,r,e)=>r.has(h)?W("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(h):r.set(h,e),s=(h,r,e,o)=>(G(h,r,"write to private field"),o?o.call(h,e):r.set(h,e),e),_=(h,r,e)=>(G(h,r,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("../class-linked-status/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),U=require("../events-KVanG9sR.cjs"),et=require("../string-DhgS_iFl.cjs"),K=require("../loading/index.cjs"),st=require("../order/index.cjs"),Z=require("../window-resizer/index.cjs"),it=require("../Store-C2J4Q87x.cjs");var T,E,$,q,u,f,M;class J{constructor(r){i(this,T);i(this,E);i(this,$);i(this,q);i(this,u);i(this,f);i(this,M);s(this,T,r);let e=r.split(".");const o=/\b\d{1,2}x\b/g,d=e.find(p=>p.match(o)&&parseInt(p));s(this,$,d?parseInt(d):1),d&&(e=e.slice(0,-1)),s(this,E,e.length>1?e.slice(0,-1).join("."):e.join("."));const l=/\d+max/g,x=/\d+min/g,B=/\d+mar/g,P=/\d+mir/g,H=e.find(p=>p.match(l)),n=e.find(p=>p.match(x)),b=e.find(p=>p.match(B)),N=e.find(p=>p.match(P));b?(s(this,u,parseInt(b)),s(this,f,"max"),s(this,q,`(max-aspect-ratio: ${t(this,u)})`)):N?(s(this,u,parseInt(N)),s(this,f,"max"),s(this,q,`(min-aspect-ratio: ${t(this,u)})`)):H?(s(this,u,parseInt(H)),s(this,f,"max"),s(this,q,`(max-width: ${t(this,u)}px)`)):n?(s(this,u,parseInt(n)),s(this,q,`(min-width: ${t(this,u)}px)`),s(this,f,"min")):(s(this,u,0),s(this,q,`(min-width: ${t(this,u)}px)`),s(this,f,"min")),s(this,E,t(this,E).replace(`.${t(this,u)}${t(this,f)}`,"")),s(this,M,e[e.length-1]===t(this,E)?"":"."+e[e.length-1]),s(this,M,t(this,M).replace(`.${t(this,u)}${t(this,f)}`,""))}get url(){return t(this,T)}get name(){return t(this,E)}get density(){return t(this,$)}get query(){return t(this,q)}get extension(){return t(this,M)}get queryType(){return t(this,f)}get queryValue(){return t(this,u)}}T=new WeakMap,E=new WeakMap,$=new WeakMap,q=new WeakMap,u=new WeakMap,f=new WeakMap,M=new WeakMap;let rt=0;var m,a,y,w,g,z,R,c,k,v,S,C,A,j,D,O,F;class nt extends HTMLElement{constructor(e){super();i(this,A);i(this,m,null);i(this,a,null);i(this,y,!1);i(this,w,!1);i(this,g,!1);i(this,z,"");i(this,R,"");i(this,c,new Y.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));i(this,k,null);i(this,v);i(this,S,null);i(this,C);i(this,D,e=>{const o=e[0];t(this,g)&&(!t(this,w)||this.hasAttribute("reload-source"))&&o.isIntersecting&&this.triggerLazyLoad(),o.isIntersecting?U.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(_(this,A,j).call(this,void 0),s(this,w,!1)),U.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,O,()=>{t(this,c).set("loaded",!0),t(this,c).set("error",!1),t(this,c).set("loading",!1),!t(this,g)&&!t(this,y)&&K.loading.complete(t(this,R)),U.dispatchEvent(this,"sourceLoaded",{custom:!0});const e=getComputedStyle(this).getPropertyValue("--clear-duration");e?s(this,v,setTimeout(()=>{t(this,c).set("clear",!0)},parseFloat(e)*1e3)):t(this,c).set("clear",!0),s(this,y,!0)});i(this,F,e=>{t(this,c).set("loaded",!1),t(this,c).set("error",!0),t(this,c).set("loading",!1),!t(this,g)&&!t(this,y)&&K.loading.error(t(this,R)),U.dispatchEvent(this,"sourceError",{custom:!0}),s(this,y,!0)});s(this,C,e==null?void 0:e.sourceSetOptions),tt.isBrowser&&window.IntersectionObserver&&s(this,k,new IntersectionObserver(t(this,D)))}get consumerElement(){return t(this,a)}get sourceManager(){return t(this,m)}get status(){return t(this,c)}get isLazy(){return t(this,g)}get currentURL(){return t(this,S)}get isFirstLoadHappened(){return t(this,y)}triggerLazyLoad(){!t(this,w)&&t(this,m).current&&t(this,m).current!==t(this,m).previous&&(s(this,w,!0),_(this,A,j).call(this,t(this,m).current))}connectedCallback(){s(this,z,`source-consumer-${++rt}`);const e=this.getAttribute("srcset")||"",o=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;o&&t(this,c).addElement(o),s(this,a,this.createConsumer()),t(this,a).style.cssText=`
1
+ "use strict";var Z=h=>{throw TypeError(h)};var G=(h,r,e)=>r.has(h)||Z("Cannot "+e);var t=(h,r,e)=>(G(h,r,"read from private field"),e?e.call(h):r.get(h)),i=(h,r,e)=>r.has(h)?Z("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(h):r.set(h,e),s=(h,r,e,o)=>(G(h,r,"write to private field"),o?o.call(h,e):r.set(h,e),e),_=(h,r,e)=>(G(h,r,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("../class-linked-status/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),U=require("../events-KVanG9sR.cjs"),et=require("../string-DhgS_iFl.cjs"),K=require("../loading/index.cjs"),st=require("../order/index.cjs"),J=require("../window-resizer/index.cjs"),it=require("../Store-C2J4Q87x.cjs");var $,q,O,S,u,f,M;class Q{constructor(r){i(this,$);i(this,q);i(this,O);i(this,S);i(this,u);i(this,f);i(this,M);s(this,$,r);let e=r.split(".");const o=/\b\d{1,2}x\b/g,d=e.find(p=>p.match(o)&&parseInt(p));s(this,O,d?parseInt(d):1),d&&(e=e.slice(0,-1)),s(this,q,e.length>1?e.slice(0,-1).join("."):e.join("."));const l=/\d+max/g,x=/\d+min/g,B=/\d+mar/g,P=/\d+mir/g,H=e.find(p=>p.match(l)),n=e.find(p=>p.match(x)),b=e.find(p=>p.match(B)),W=e.find(p=>p.match(P));b?(s(this,u,parseInt(b)),s(this,f,"max"),s(this,S,`(max-aspect-ratio: ${t(this,u)})`)):W?(s(this,u,parseInt(W)),s(this,f,"max"),s(this,S,`(min-aspect-ratio: ${t(this,u)})`)):H?(s(this,u,parseInt(H)),s(this,f,"max"),s(this,S,`(max-width: ${t(this,u)}px)`)):n?(s(this,u,parseInt(n)),s(this,S,`(min-width: ${t(this,u)}px)`),s(this,f,"min")):(s(this,u,0),s(this,S,`(min-width: ${t(this,u)}px)`),s(this,f,"min")),s(this,q,t(this,q).replace(`.${t(this,u)}${t(this,f)}`,"")),s(this,M,e[e.length-1]===t(this,q)?"":"."+e[e.length-1]),s(this,M,t(this,M).replace(`.${t(this,u)}${t(this,f)}`,""))}get url(){return t(this,$)}get name(){return t(this,q)}get density(){return t(this,O)}get query(){return t(this,S)}get extension(){return t(this,M)}get queryType(){return t(this,f)}get queryValue(){return t(this,u)}}$=new WeakMap,q=new WeakMap,O=new WeakMap,S=new WeakMap,u=new WeakMap,f=new WeakMap,M=new WeakMap;let rt=0;var m,a,y,w,g,z,R,c,v,A,E,C,I,j,D,V,F;class nt extends HTMLElement{constructor(e){super();i(this,I);i(this,m,null);i(this,a,null);i(this,y,!1);i(this,w,!1);i(this,g,!1);i(this,z,"");i(this,R,"");i(this,c,new Y.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));i(this,v,null);i(this,A);i(this,E,null);i(this,C);i(this,D,e=>{const o=e[0];t(this,g)&&(!t(this,w)||this.hasAttribute("reload-source"))&&o.isIntersecting&&this.triggerLazyLoad(),o.isIntersecting?U.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(_(this,I,j).call(this,void 0),s(this,w,!1)),U.dispatchEvent(this,"sourceRelease",{custom:!0}))});i(this,V,()=>{t(this,c).set("loaded",!0),t(this,c).set("error",!1),t(this,c).set("loading",!1),!t(this,g)&&!t(this,y)&&K.loading.complete(t(this,R)),U.dispatchEvent(this,"sourceLoaded",{custom:!0});const e=getComputedStyle(this).getPropertyValue("--clear-duration");e?s(this,A,setTimeout(()=>{t(this,c).set("clear",!0)},parseFloat(e)*1e3)):t(this,c).set("clear",!0),s(this,y,!0)});i(this,F,e=>{t(this,c).set("loaded",!1),t(this,c).set("error",!0),t(this,c).set("loading",!1),!t(this,g)&&!t(this,y)&&K.loading.error(t(this,R)),U.dispatchEvent(this,"sourceError",{custom:!0}),s(this,y,!0)});s(this,C,e==null?void 0:e.sourceSetOptions),tt.isBrowser&&window.IntersectionObserver&&s(this,v,new IntersectionObserver(t(this,D)))}get consumerElement(){return t(this,a)}get sourceManager(){return t(this,m)}get status(){return t(this,c)}get isLazy(){return t(this,g)}get currentURL(){return t(this,E)}get isFirstLoadHappened(){return t(this,y)}triggerLazyLoad(){!t(this,w)&&t(this,m).current&&t(this,m).current!==t(this,m).previous&&(s(this,w,!0),_(this,I,j).call(this,t(this,m).current))}connectedCallback(){s(this,z,`source-consumer-${++rt}`);const e=this.getAttribute("srcset")||"",o=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;o&&t(this,c).addElement(o),s(this,a,this.createConsumer()),t(this,a).style.cssText=`
2
2
  display: block;
3
3
  width: 100%;
4
4
  height: 100%;
5
- `,t(this,a).classList.add("source-consumer"),Array.from(this.attributes).forEach(d=>{if(d.name!=="srcset"){const l=d.nodeValue||"",x=et.kebabToCamel(d.name);x in t(this,a)&&(t(this,a)[x]=l||!0)}}),this.appendChild(t(this,a)),s(this,m,new X({srcset:e,sourceSetOptions:t(this,C)})),s(this,g,this.hasAttribute("lazy")),t(this,m).subscribe(d=>{(!t(this,g)||t(this,g)&&t(this,w))&&_(this,A,j).call(this,d.current)}),t(this,m).connect(),t(this,k).observe(this)}disconnectedCallback(){var e;clearTimeout(t(this,v)),t(this,k).disconnect(),(e=t(this,m))==null||e.close(),t(this,a)&&(t(this,a).onloadeddata=null,t(this,a).onload=null,t(this,a).onerror=null,t(this,a).remove()),s(this,y,!1),s(this,w,!1),t(this,c).reset()}}m=new WeakMap,a=new WeakMap,y=new WeakMap,w=new WeakMap,g=new WeakMap,z=new WeakMap,R=new WeakMap,c=new WeakMap,k=new WeakMap,v=new WeakMap,S=new WeakMap,C=new WeakMap,A=new WeakSet,j=function(e){if(clearTimeout(t(this,v)),t(this,a).onloadeddata=null,t(this,a).onload=null,t(this,a).onerror=null,t(this,c).set("loaded",!1),t(this,c).set("error",!1),t(this,c).set("loading",!1),t(this,c).set("clear",!1),e){s(this,R,`${t(this,z)}-${e.url}`);const o=this.hasAttribute("keep-source-parameters");t(this,c).set("loading",!0),s(this,S,o?e.url:e.name+e.extension),this.consumeSource(t(this,S)),!t(this,g)&&!t(this,y)&&K.loading.add(t(this,R)),t(this,a).onloadeddata=()=>{t(this,O).call(this)},t(this,a).onload=()=>{t(this,O).call(this)},t(this,a).onerror=()=>{t(this,F).call(this,t(this,S))}}else s(this,S,null),this.consumeSource(null)},D=new WeakMap,O=new WeakMap,F=new WeakMap;var L;class Q{constructor(r,e){i(this,L);s(this,L,new Map);const o=(e==null?void 0:e.mediaBuckets)!==!1,d=typeof r=="string"?o?r.trim().split(",").map(n=>n.trim()).filter(n=>!!n):[r]:r,l=[];d.forEach(n=>{const b=new J(n);l.push([b.query,b])});const x=l.filter(n=>n[1].queryType.includes("max")).sort((n,b)=>b[1].queryValue-n[1].queryValue),B=l.filter(n=>n[1].queryType.includes("min")&&n[1].queryValue!==0).sort((n,b)=>n[1].queryValue-b[1].queryValue),P=l.filter(n=>n[0]==="(min-width: 0px)");(P?[...P,...x,...B]:[...x,...B]).forEach(n=>{t(this,L).has(n[0])||t(this,L).set(n[0],[]),t(this,L).get(n[0]).push(n[1])})}get mediaBuckets(){return t(this,L)}}L=new WeakMap;var V,I;class X extends it.Store{constructor(e){super(void 0);i(this,V);i(this,I,()=>{let e;t(this,V).mediaBuckets.forEach((l,x)=>{matchMedia(x).matches&&(e=l)});let o,d=0;e==null||e.forEach(l=>{l.density>d&&l.density<=Math.max(devicePixelRatio,1)&&(d=l.density,o=l)}),e!=null&&e.length&&!o&&(o=e[0]),this.current=o});s(this,V,new Q(e.srcset,e.sourceSetOptions))}close(){super.close(),this.disconnect()}connect(){Z.windowResizer.subscribe(t(this,I),st.RESIZE_ORDER.SOURCE_MANAGER),t(this,I).call(this)}disconnect(){Z.windowResizer.unsubscribe(t(this,I))}}V=new WeakMap,I=new WeakMap;exports.Source=J;exports.SourceElement=nt;exports.SourceManager=X;exports.SourceSet=Q;
5
+ `,t(this,a).classList.add("source-consumer"),Array.from(this.attributes).forEach(d=>{if(d.name!=="srcset"){const l=d.nodeValue||"",x=et.kebabToCamel(d.name);x in t(this,a)&&(t(this,a)[x]=l||!0)}}),this.appendChild(t(this,a)),s(this,m,new X({srcset:e,sourceSetOptions:t(this,C)})),s(this,g,this.hasAttribute("lazy")),t(this,m).subscribe(d=>{(!t(this,g)||t(this,g)&&t(this,w))&&_(this,I,j).call(this,d.current)}),t(this,m).connect(),t(this,v).observe(this)}disconnectedCallback(){var e;clearTimeout(t(this,A)),t(this,v).disconnect(),(e=t(this,m))==null||e.close(),t(this,a)&&(t(this,a).onloadeddata=null,t(this,a).onload=null,t(this,a).onerror=null,t(this,a).remove()),s(this,y,!1),s(this,w,!1),t(this,c).reset()}}m=new WeakMap,a=new WeakMap,y=new WeakMap,w=new WeakMap,g=new WeakMap,z=new WeakMap,R=new WeakMap,c=new WeakMap,v=new WeakMap,A=new WeakMap,E=new WeakMap,C=new WeakMap,I=new WeakSet,j=function(e){if(clearTimeout(t(this,A)),t(this,a).onloadeddata=null,t(this,a).onload=null,t(this,a).onerror=null,t(this,c).set("loaded",!1),t(this,c).set("error",!1),t(this,c).set("loading",!1),t(this,c).set("clear",!1),e){s(this,R,`${t(this,z)}-${e.url}`);const o=this.hasAttribute("keep-source-parameters");t(this,c).set("loading",!0),s(this,E,o?e.url:e.name+e.extension),this.consumeSource(t(this,E)),!t(this,g)&&!t(this,y)&&K.loading.add(t(this,R)),t(this,a).onloadeddata=()=>{t(this,V).call(this)},t(this,a).onload=()=>{t(this,V).call(this)},t(this,a).onerror=()=>{t(this,F).call(this,t(this,E))}}else s(this,E,null),this.consumeSource(null)},D=new WeakMap,V=new WeakMap,F=new WeakMap;var L;class N{constructor(r,e){i(this,L);s(this,L,new Map);const o=(e==null?void 0:e.mediaBuckets)!==!1,d=typeof r=="string"?o?r.trim().split(",").map(n=>n.trim()).filter(n=>!!n):[r]:r,l=[];d.forEach(n=>{const b=new Q(n);l.push([b.query,b])});const x=l.filter(n=>n[1].queryType.includes("max")).sort((n,b)=>b[1].queryValue-n[1].queryValue),B=l.filter(n=>n[1].queryType.includes("min")&&n[1].queryValue!==0).sort((n,b)=>n[1].queryValue-b[1].queryValue),P=l.filter(n=>n[0]==="(min-width: 0px)");(P?[...P,...x,...B]:[...x,...B]).forEach(n=>{t(this,L).has(n[0])||t(this,L).set(n[0],[]),t(this,L).get(n[0]).push(n[1])})}get mediaBuckets(){return t(this,L)}}L=new WeakMap;var T,k;class X extends it.Store{constructor(e){super(void 0);i(this,T);i(this,k,()=>{let e;t(this,T).mediaBuckets.forEach((l,x)=>{matchMedia(x).matches&&(e=l)});let o,d=0;e==null||e.forEach(l=>{l.density>d&&l.density<=Math.max(devicePixelRatio,1)&&(d=l.density,o=l)}),e!=null&&e.length&&!o&&(o=e[0]),this.current=o});s(this,T,new N(e.srcset,e.sourceSetOptions))}updateSource(e){s(this,T,new N(e.srcset,e.sourceSetOptions)),t(this,k).call(this)}close(){super.close(),this.disconnect()}connect(){J.windowResizer.subscribe(t(this,k),st.RESIZE_ORDER.SOURCE_MANAGER),t(this,k).call(this)}disconnect(){J.windowResizer.unsubscribe(t(this,k))}}T=new WeakMap,k=new WeakMap;exports.Source=Q;exports.SourceElement=nt;exports.SourceManager=X;exports.SourceSet=N;
@@ -3,45 +3,45 @@ var W = (n) => {
3
3
  };
4
4
  var G = (n, r, e) => r.has(n) || W("Cannot " + e);
5
5
  var t = (n, r, e) => (G(n, r, "read from private field"), e ? e.call(n) : r.get(n)), i = (n, r, e) => r.has(n) ? W("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(n) : r.set(n, e), s = (n, r, e, o) => (G(n, r, "write to private field"), o ? o.call(n, e) : r.set(n, e), e), U = (n, r, e) => (G(n, r, "access private method"), e);
6
- import { ClassLinkedStatus as J } from "../class-linked-status/index.js";
7
- import { i as Q } from "../browser-0zX67oeU.js";
6
+ import { ClassLinkedStatus as Q } from "../class-linked-status/index.js";
7
+ import { i as X } from "../browser-0zX67oeU.js";
8
8
  import { d as D } from "../events-CsVF98U6.js";
9
- import { k as X } from "../string-f0Dnk0L1.js";
9
+ import { k as Y } from "../string-f0Dnk0L1.js";
10
10
  import { loading as K } from "../loading/index.js";
11
- import { RESIZE_ORDER as Y } from "../order/index.js";
11
+ import { RESIZE_ORDER as tt } from "../order/index.js";
12
12
  import { windowResizer as Z } from "../window-resizer/index.js";
13
- import { S as tt } from "../Store-Cm3LPXlx.js";
14
- var T, w, C, L, u, f, k;
15
- class et {
13
+ import { S as et } from "../Store-Cm3LPXlx.js";
14
+ var C, E, O, L, u, f, k;
15
+ class st {
16
16
  constructor(r) {
17
- i(this, T);
18
- i(this, w);
19
17
  i(this, C);
18
+ i(this, E);
19
+ i(this, O);
20
20
  i(this, L);
21
21
  i(this, u);
22
22
  i(this, f);
23
23
  i(this, k);
24
- s(this, T, r);
24
+ s(this, C, r);
25
25
  let e = r.split(".");
26
26
  const o = /\b\d{1,2}x\b/g, d = e.find((g) => g.match(o) && parseInt(g));
27
- s(this, C, d ? parseInt(d) : 1), d && (e = e.slice(0, -1)), s(this, w, e.length > 1 ? e.slice(0, -1).join(".") : e.join("."));
28
- const c = /\d+max/g, x = /\d+min/g, B = /\d+mar/g, P = /\d+mir/g, _ = e.find((g) => g.match(c)), h = e.find((g) => g.match(x)), b = e.find((g) => g.match(B)), N = e.find((g) => g.match(P));
29
- b ? (s(this, u, parseInt(b)), s(this, f, "max"), s(this, L, `(max-aspect-ratio: ${t(this, u)})`)) : N ? (s(this, u, parseInt(N)), s(this, f, "max"), s(this, L, `(min-aspect-ratio: ${t(this, u)})`)) : _ ? (s(this, u, parseInt(_)), s(this, f, "max"), s(this, L, `(max-width: ${t(this, u)}px)`)) : h ? (s(this, u, parseInt(h)), s(this, L, `(min-width: ${t(this, u)}px)`), s(this, f, "min")) : (s(this, u, 0), s(this, L, `(min-width: ${t(this, u)}px)`), s(this, f, "min")), s(this, w, t(this, w).replace(
27
+ s(this, O, d ? parseInt(d) : 1), d && (e = e.slice(0, -1)), s(this, E, e.length > 1 ? e.slice(0, -1).join(".") : e.join("."));
28
+ const l = /\d+max/g, x = /\d+min/g, B = /\d+mar/g, P = /\d+mir/g, _ = e.find((g) => g.match(l)), h = e.find((g) => g.match(x)), b = e.find((g) => g.match(B)), N = e.find((g) => g.match(P));
29
+ b ? (s(this, u, parseInt(b)), s(this, f, "max"), s(this, L, `(max-aspect-ratio: ${t(this, u)})`)) : N ? (s(this, u, parseInt(N)), s(this, f, "max"), s(this, L, `(min-aspect-ratio: ${t(this, u)})`)) : _ ? (s(this, u, parseInt(_)), s(this, f, "max"), s(this, L, `(max-width: ${t(this, u)}px)`)) : h ? (s(this, u, parseInt(h)), s(this, L, `(min-width: ${t(this, u)}px)`), s(this, f, "min")) : (s(this, u, 0), s(this, L, `(min-width: ${t(this, u)}px)`), s(this, f, "min")), s(this, E, t(this, E).replace(
30
30
  `.${t(this, u)}${t(this, f)}`,
31
31
  ""
32
- )), s(this, k, e[e.length - 1] === t(this, w) ? "" : "." + e[e.length - 1]), s(this, k, t(this, k).replace(
32
+ )), s(this, k, e[e.length - 1] === t(this, E) ? "" : "." + e[e.length - 1]), s(this, k, t(this, k).replace(
33
33
  `.${t(this, u)}${t(this, f)}`,
34
34
  ""
35
35
  ));
36
36
  }
37
37
  get url() {
38
- return t(this, T);
38
+ return t(this, C);
39
39
  }
40
40
  get name() {
41
- return t(this, w);
41
+ return t(this, E);
42
42
  }
43
43
  get density() {
44
- return t(this, C);
44
+ return t(this, O);
45
45
  }
46
46
  get query() {
47
47
  return t(this, L);
@@ -56,45 +56,45 @@ class et {
56
56
  return t(this, u);
57
57
  }
58
58
  }
59
- T = new WeakMap(), w = new WeakMap(), C = new WeakMap(), L = new WeakMap(), u = new WeakMap(), f = new WeakMap(), k = new WeakMap();
60
- let st = 0;
61
- var m, a, y, E, p, O, A, l, I, M, q, V, R, F, H, z, j;
59
+ C = new WeakMap(), E = new WeakMap(), O = new WeakMap(), L = new WeakMap(), u = new WeakMap(), f = new WeakMap(), k = new WeakMap();
60
+ let it = 0;
61
+ var m, a, y, w, p, V, A, c, M, R, S, z, $, F, H, v, j;
62
62
  class ft extends HTMLElement {
63
63
  constructor(e) {
64
64
  super();
65
- i(this, R);
65
+ i(this, $);
66
66
  i(this, m, null);
67
67
  i(this, a, null);
68
68
  i(this, y, !1);
69
- i(this, E, !1);
69
+ i(this, w, !1);
70
70
  i(this, p, !1);
71
- i(this, O, "");
71
+ i(this, V, "");
72
72
  i(this, A, "");
73
- i(this, l, new J(this, {
73
+ i(this, c, new Q(this, {
74
74
  loading: !1,
75
75
  loaded: !1,
76
76
  error: !1,
77
77
  clear: !1
78
78
  }));
79
- i(this, I, null);
80
- i(this, M);
81
- i(this, q, null);
82
- i(this, V);
79
+ i(this, M, null);
80
+ i(this, R);
81
+ i(this, S, null);
82
+ i(this, z);
83
83
  i(this, H, (e) => {
84
84
  const o = e[0];
85
- t(this, p) && (!t(this, E) || this.hasAttribute("reload-source")) && o.isIntersecting && this.triggerLazyLoad(), o.isIntersecting ? D(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (U(this, R, F).call(this, void 0), s(this, E, !1)), D(this, "sourceRelease", { custom: !0 }));
85
+ t(this, p) && (!t(this, w) || this.hasAttribute("reload-source")) && o.isIntersecting && this.triggerLazyLoad(), o.isIntersecting ? D(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (U(this, $, F).call(this, void 0), s(this, w, !1)), D(this, "sourceRelease", { custom: !0 }));
86
86
  });
87
- i(this, z, () => {
88
- t(this, l).set("loaded", !0), t(this, l).set("error", !1), t(this, l).set("loading", !1), !t(this, p) && !t(this, y) && K.complete(t(this, A)), D(this, "sourceLoaded", { custom: !0 });
87
+ i(this, v, () => {
88
+ t(this, c).set("loaded", !0), t(this, c).set("error", !1), t(this, c).set("loading", !1), !t(this, p) && !t(this, y) && K.complete(t(this, A)), D(this, "sourceLoaded", { custom: !0 });
89
89
  const e = getComputedStyle(this).getPropertyValue("--clear-duration");
90
- e ? s(this, M, setTimeout(() => {
91
- t(this, l).set("clear", !0);
92
- }, parseFloat(e) * 1e3)) : t(this, l).set("clear", !0), s(this, y, !0);
90
+ e ? s(this, R, setTimeout(() => {
91
+ t(this, c).set("clear", !0);
92
+ }, parseFloat(e) * 1e3)) : t(this, c).set("clear", !0), s(this, y, !0);
93
93
  });
94
94
  i(this, j, (e) => {
95
- t(this, l).set("loaded", !1), t(this, l).set("error", !0), t(this, l).set("loading", !1), !t(this, p) && !t(this, y) && K.error(t(this, A)), D(this, "sourceError", { custom: !0 }), s(this, y, !0);
95
+ t(this, c).set("loaded", !1), t(this, c).set("error", !0), t(this, c).set("loading", !1), !t(this, p) && !t(this, y) && K.error(t(this, A)), D(this, "sourceError", { custom: !0 }), s(this, y, !0);
96
96
  });
97
- s(this, V, e == null ? void 0 : e.sourceSetOptions), Q && window.IntersectionObserver && s(this, I, new IntersectionObserver(
97
+ s(this, z, e == null ? void 0 : e.sourceSetOptions), X && window.IntersectionObserver && s(this, M, new IntersectionObserver(
98
98
  t(this, H)
99
99
  ));
100
100
  }
@@ -105,109 +105,112 @@ class ft extends HTMLElement {
105
105
  return t(this, m);
106
106
  }
107
107
  get status() {
108
- return t(this, l);
108
+ return t(this, c);
109
109
  }
110
110
  get isLazy() {
111
111
  return t(this, p);
112
112
  }
113
113
  get currentURL() {
114
- return t(this, q);
114
+ return t(this, S);
115
115
  }
116
116
  get isFirstLoadHappened() {
117
117
  return t(this, y);
118
118
  }
119
119
  triggerLazyLoad() {
120
- !t(this, E) && t(this, m).current && t(this, m).current !== t(this, m).previous && (s(this, E, !0), U(this, R, F).call(this, t(this, m).current));
120
+ !t(this, w) && t(this, m).current && t(this, m).current !== t(this, m).previous && (s(this, w, !0), U(this, $, F).call(this, t(this, m).current));
121
121
  }
122
122
  connectedCallback() {
123
- s(this, O, `source-consumer-${++st}`);
123
+ s(this, V, `source-consumer-${++it}`);
124
124
  const e = this.getAttribute("srcset") || "", o = this.hasAttribute("notify") ? this.closest(this.getAttribute("notify")) : null;
125
- o && t(this, l).addElement(o), s(this, a, this.createConsumer()), t(this, a).style.cssText = `
125
+ o && t(this, c).addElement(o), s(this, a, this.createConsumer()), t(this, a).style.cssText = `
126
126
  display: block;
127
127
  width: 100%;
128
128
  height: 100%;
129
129
  `, t(this, a).classList.add("source-consumer"), Array.from(this.attributes).forEach((d) => {
130
130
  if (d.name !== "srcset") {
131
- const c = d.nodeValue || "", x = X(d.name);
132
- x in t(this, a) && (t(this, a)[x] = c || !0);
131
+ const l = d.nodeValue || "", x = Y(d.name);
132
+ x in t(this, a) && (t(this, a)[x] = l || !0);
133
133
  }
134
134
  }), this.appendChild(t(this, a)), s(this, m, new rt({
135
135
  srcset: e,
136
- sourceSetOptions: t(this, V)
136
+ sourceSetOptions: t(this, z)
137
137
  })), s(this, p, this.hasAttribute("lazy")), t(this, m).subscribe((d) => {
138
- (!t(this, p) || t(this, p) && t(this, E)) && U(this, R, F).call(this, d.current);
139
- }), t(this, m).connect(), t(this, I).observe(this);
138
+ (!t(this, p) || t(this, p) && t(this, w)) && U(this, $, F).call(this, d.current);
139
+ }), t(this, m).connect(), t(this, M).observe(this);
140
140
  }
141
141
  disconnectedCallback() {
142
142
  var e;
143
- clearTimeout(t(this, M)), t(this, I).disconnect(), (e = t(this, m)) == null || e.close(), t(this, a) && (t(this, a).onloadeddata = null, t(this, a).onload = null, t(this, a).onerror = null, t(this, a).remove()), s(this, y, !1), s(this, E, !1), t(this, l).reset();
143
+ clearTimeout(t(this, R)), t(this, M).disconnect(), (e = t(this, m)) == null || e.close(), t(this, a) && (t(this, a).onloadeddata = null, t(this, a).onload = null, t(this, a).onerror = null, t(this, a).remove()), s(this, y, !1), s(this, w, !1), t(this, c).reset();
144
144
  }
145
145
  }
146
- m = new WeakMap(), a = new WeakMap(), y = new WeakMap(), E = new WeakMap(), p = new WeakMap(), O = new WeakMap(), A = new WeakMap(), l = new WeakMap(), I = new WeakMap(), M = new WeakMap(), q = new WeakMap(), V = new WeakMap(), R = new WeakSet(), F = function(e) {
147
- if (clearTimeout(t(this, M)), t(this, a).onloadeddata = null, t(this, a).onload = null, t(this, a).onerror = null, t(this, l).set("loaded", !1), t(this, l).set("error", !1), t(this, l).set("loading", !1), t(this, l).set("clear", !1), e) {
148
- s(this, A, `${t(this, O)}-${e.url}`);
146
+ m = new WeakMap(), a = new WeakMap(), y = new WeakMap(), w = new WeakMap(), p = new WeakMap(), V = new WeakMap(), A = new WeakMap(), c = new WeakMap(), M = new WeakMap(), R = new WeakMap(), S = new WeakMap(), z = new WeakMap(), $ = new WeakSet(), F = function(e) {
147
+ if (clearTimeout(t(this, R)), t(this, a).onloadeddata = null, t(this, a).onload = null, t(this, a).onerror = null, t(this, c).set("loaded", !1), t(this, c).set("error", !1), t(this, c).set("loading", !1), t(this, c).set("clear", !1), e) {
148
+ s(this, A, `${t(this, V)}-${e.url}`);
149
149
  const o = this.hasAttribute("keep-source-parameters");
150
- t(this, l).set("loading", !0), s(this, q, o ? e.url : e.name + e.extension), this.consumeSource(t(this, q)), !t(this, p) && !t(this, y) && K.add(t(this, A)), t(this, a).onloadeddata = () => {
151
- t(this, z).call(this);
150
+ t(this, c).set("loading", !0), s(this, S, o ? e.url : e.name + e.extension), this.consumeSource(t(this, S)), !t(this, p) && !t(this, y) && K.add(t(this, A)), t(this, a).onloadeddata = () => {
151
+ t(this, v).call(this);
152
152
  }, t(this, a).onload = () => {
153
- t(this, z).call(this);
153
+ t(this, v).call(this);
154
154
  }, t(this, a).onerror = () => {
155
- t(this, j).call(this, t(this, q));
155
+ t(this, j).call(this, t(this, S));
156
156
  };
157
157
  } else
158
- s(this, q, null), this.consumeSource(null);
159
- }, H = new WeakMap(), z = new WeakMap(), j = new WeakMap();
160
- var S;
161
- class it {
158
+ s(this, S, null), this.consumeSource(null);
159
+ }, H = new WeakMap(), v = new WeakMap(), j = new WeakMap();
160
+ var q;
161
+ class J {
162
162
  constructor(r, e) {
163
- i(this, S);
164
- s(this, S, /* @__PURE__ */ new Map());
165
- const o = (e == null ? void 0 : e.mediaBuckets) !== !1, d = typeof r == "string" ? o ? r.trim().split(",").map((h) => h.trim()).filter((h) => !!h) : [r] : r, c = [];
163
+ i(this, q);
164
+ s(this, q, /* @__PURE__ */ new Map());
165
+ const o = (e == null ? void 0 : e.mediaBuckets) !== !1, d = typeof r == "string" ? o ? r.trim().split(",").map((h) => h.trim()).filter((h) => !!h) : [r] : r, l = [];
166
166
  d.forEach((h) => {
167
- const b = new et(h);
168
- c.push([b.query, b]);
167
+ const b = new st(h);
168
+ l.push([b.query, b]);
169
169
  });
170
- const x = c.filter((h) => h[1].queryType.includes("max")).sort((h, b) => b[1].queryValue - h[1].queryValue), B = c.filter((h) => h[1].queryType.includes("min") && h[1].queryValue !== 0).sort((h, b) => h[1].queryValue - b[1].queryValue), P = c.filter((h) => h[0] === "(min-width: 0px)");
170
+ const x = l.filter((h) => h[1].queryType.includes("max")).sort((h, b) => b[1].queryValue - h[1].queryValue), B = l.filter((h) => h[1].queryType.includes("min") && h[1].queryValue !== 0).sort((h, b) => h[1].queryValue - b[1].queryValue), P = l.filter((h) => h[0] === "(min-width: 0px)");
171
171
  (P ? [...P, ...x, ...B] : [...x, ...B]).forEach((h) => {
172
- t(this, S).has(h[0]) || t(this, S).set(h[0], []), t(this, S).get(h[0]).push(h[1]);
172
+ t(this, q).has(h[0]) || t(this, q).set(h[0], []), t(this, q).get(h[0]).push(h[1]);
173
173
  });
174
174
  }
175
175
  get mediaBuckets() {
176
- return t(this, S);
176
+ return t(this, q);
177
177
  }
178
178
  }
179
- S = new WeakMap();
180
- var v, $;
181
- class rt extends tt {
179
+ q = new WeakMap();
180
+ var T, I;
181
+ class rt extends et {
182
182
  constructor(e) {
183
183
  super(void 0);
184
- i(this, v);
185
- i(this, $, () => {
184
+ i(this, T);
185
+ i(this, I, () => {
186
186
  let e;
187
- t(this, v).mediaBuckets.forEach((c, x) => {
188
- matchMedia(x).matches && (e = c);
187
+ t(this, T).mediaBuckets.forEach((l, x) => {
188
+ matchMedia(x).matches && (e = l);
189
189
  });
190
190
  let o, d = 0;
191
- e == null || e.forEach((c) => {
192
- c.density > d && c.density <= Math.max(devicePixelRatio, 1) && (d = c.density, o = c);
191
+ e == null || e.forEach((l) => {
192
+ l.density > d && l.density <= Math.max(devicePixelRatio, 1) && (d = l.density, o = l);
193
193
  }), e != null && e.length && !o && (o = e[0]), this.current = o;
194
194
  });
195
- s(this, v, new it(e.srcset, e.sourceSetOptions));
195
+ s(this, T, new J(e.srcset, e.sourceSetOptions));
196
+ }
197
+ updateSource(e) {
198
+ s(this, T, new J(e.srcset, e.sourceSetOptions)), t(this, I).call(this);
196
199
  }
197
200
  close() {
198
201
  super.close(), this.disconnect();
199
202
  }
200
203
  connect() {
201
- Z.subscribe(t(this, $), Y.SOURCE_MANAGER), t(this, $).call(this);
204
+ Z.subscribe(t(this, I), tt.SOURCE_MANAGER), t(this, I).call(this);
202
205
  }
203
206
  disconnect() {
204
- Z.unsubscribe(t(this, $));
207
+ Z.unsubscribe(t(this, I));
205
208
  }
206
209
  }
207
- v = new WeakMap(), $ = new WeakMap();
210
+ T = new WeakMap(), I = new WeakMap();
208
211
  export {
209
- et as Source,
212
+ st as Source,
210
213
  ft as SourceElement,
211
214
  rt as SourceManager,
212
- it as SourceSet
215
+ J as SourceSet
213
216
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.42.8",
3
+ "version": "0.42.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"