aptechka 0.41.3 → 0.41.5
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/source/index.cjs +1 -1
- package/lib/source/index.js +32 -32
- package/package.json +1 -1
package/lib/source/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var I=r=>{throw TypeError(r)};var V=(r,n,t)=>n.has(r)||I("Cannot "+t);var e=(r,n,t)=>(V(r,n,"read from private field"),t?t.call(r):n.get(r)),o=(r,n,t)=>n.has(r)?I("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(r):n.set(r,t),s=(r,n,t,c)=>(V(r,n,"write to private field"),c?c.call(r,t):n.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../order/index.cjs"),k=require("../window-resizer/vanilla/index.cjs"),z=require("../Store-C2J4Q87x.cjs");var w,f,M,d,a,u,y;class B{constructor(n){o(this,w);o(this,f);o(this,M);o(this,d);o(this,a);o(this,u);o(this,y);s(this,w,n);let t=n.split(".");const c=/\b\d{1,2}x\b/g,p=t.find(l=>l.match(c)&&parseInt(l));s(this,M,p?parseInt(p):1),p&&(t=t.slice(0,-1)),s(this,f,t.length>1?t.slice(0,-1).join("."):t.join("."));const h=/\d+max/g,g=/\d+min/g,E=/\d+mar/g,$=/\d+mir/g,b=t.find(l=>l.match(h)),i=t.find(l=>l.match(g)),m=t.find(l=>l.match(E)),S=t.find(l=>l.match($));m?(s(this,a,parseInt(m)),s(this,u,"max"),s(this,d,`(max-aspect-ratio: ${e(this,a)})`)):S?(s(this,a,parseInt(S)),s(this,u,"max"),s(this,d,`(min-aspect-ratio: ${e(this,a)})`)):b?(s(this,a,parseInt(b)),s(this,u,"max"),s(this,d,`(max-width: ${e(this,a)}px)`)):i?(s(this,a,parseInt(i)),s(this,d,`(min-width: ${e(this,a)}px)`),s(this,u,"min")):(s(this,a,0),s(this,d,`(min-width: ${e(this,a)}px)`),s(this,u,"min")),s(this,f,e(this,f).replace(`.${e(this,a)}${e(this,u)}`,"")),s(this,y,t[t.length-1]===e(this,f)?"":"."+t[t.length-1]),s(this,y,e(this,y).replace(`.${e(this,a)}${e(this,u)}`,""))}get url(){return e(this,w)}get name(){return e(this,f)}get density(){return e(this,M)}get query(){return e(this,d)}get extension(){return e(this,y)}get queryType(){return e(this,u)}get queryValue(){return e(this,a)}}w=new WeakMap,f=new WeakMap,M=new WeakMap,d=new WeakMap,a=new WeakMap,u=new WeakMap,y=new WeakMap;var x;class T{constructor(n,t){o(this,x);s(this,x,new Map);const c=(t==null?void 0:t.mediaBuckets)!==!1,p=typeof n=="string"?c?n.trim().split(",").map(i=>i.trim()).filter(i=>!!i):[n]:n,h=[];p.forEach(i=>{const m=new B(i);h.push([m.query,m])});const g=h.filter(i=>i[1].queryType.includes("max")).sort((i,m)=>m[1].queryValue-i[1].queryValue),E=h.filter(i=>i[1].queryType.includes("min")&&i[1].queryValue!==0).sort((i,m)=>i[1].queryValue-m[1].queryValue),$=h.filter(i=>i[0]==="(min-width: 0px)");($?[...$,...g,...E]:[...g,...E]).forEach(i=>{e(this,x).has(i[0])||e(this,x).set(i[0],[]),e(this,x).get(i[0]).push(i[1])})}get mediaBuckets(){return e(this,x)}}x=new WeakMap;var R,q;class A extends z.Store{constructor(t){super(void 0);o(this,R);o(this,q,()=>{let t;e(this,R).mediaBuckets.forEach((h,g)=>{matchMedia(g).matches&&(t=h)});let c,p=0;t==null||t.forEach(h=>{h.density>p&&h.density<=Math.max(devicePixelRatio,1)&&(p=h.density,c=h)}),t!=null&&t.length&&!c&&(c=t[0]),console.log(c==null?void 0:c.name),this.current=c});s(this,R,new T(t.srcset,t.sourceSetOptions))}close(){super.close(),this.disconnect()}connect(){k.windowResizer.subscribe(e(this,q),_.RESIZE_ORDER.SOURCE_MANAGER),e(this,q).call(this)}disconnect(){k.windowResizer.unsubscribe(e(this,q))}}R=new WeakMap,q=new WeakMap;exports.Source=B;exports.SourceManager=A;exports.SourceSet=T;
|
package/lib/source/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b = (r) => {
|
|
2
2
|
throw TypeError(r);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var e = (r, n, t) => (
|
|
4
|
+
var k = (r, n, t) => n.has(r) || b("Cannot " + t);
|
|
5
|
+
var e = (r, n, t) => (k(r, n, "read from private field"), t ? t.call(r) : n.get(r)), m = (r, n, t) => n.has(r) ? b("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, t), i = (r, n, t, h) => (k(r, n, "write to private field"), h ? h.call(r, t) : n.set(r, t), t);
|
|
6
6
|
import { RESIZE_ORDER as A } from "../order/index.js";
|
|
7
|
-
import { windowResizer as
|
|
8
|
-
import { S } from "../Store-Cm3LPXlx.js";
|
|
9
|
-
var w, f, E, d,
|
|
10
|
-
class
|
|
7
|
+
import { windowResizer as B } from "../window-resizer/vanilla/index.js";
|
|
8
|
+
import { S as T } from "../Store-Cm3LPXlx.js";
|
|
9
|
+
var w, f, E, d, a, o, y;
|
|
10
|
+
class O {
|
|
11
11
|
constructor(n) {
|
|
12
12
|
m(this, w);
|
|
13
13
|
m(this, f);
|
|
14
14
|
m(this, E);
|
|
15
15
|
m(this, d);
|
|
16
|
-
m(this,
|
|
16
|
+
m(this, a);
|
|
17
17
|
m(this, o);
|
|
18
18
|
m(this, y);
|
|
19
19
|
i(this, w, n);
|
|
20
20
|
let t = n.split(".");
|
|
21
|
-
const
|
|
21
|
+
const h = /\b\d{1,2}x\b/g, p = t.find((u) => u.match(h) && parseInt(u));
|
|
22
22
|
i(this, E, p ? parseInt(p) : 1), p && (t = t.slice(0, -1)), i(this, f, t.length > 1 ? t.slice(0, -1).join(".") : t.join("."));
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
`.${e(this,
|
|
23
|
+
const c = /\d+max/g, g = /\d+min/g, R = /\d+mar/g, $ = /\d+mir/g, I = t.find((u) => u.match(c)), s = t.find((u) => u.match(g)), l = t.find((u) => u.match(R)), V = t.find((u) => u.match($));
|
|
24
|
+
l ? (i(this, a, parseInt(l)), i(this, o, "max"), i(this, d, `(max-aspect-ratio: ${e(this, a)})`)) : V ? (i(this, a, parseInt(V)), i(this, o, "max"), i(this, d, `(min-aspect-ratio: ${e(this, a)})`)) : I ? (i(this, a, parseInt(I)), i(this, o, "max"), i(this, d, `(max-width: ${e(this, a)}px)`)) : s ? (i(this, a, parseInt(s)), i(this, d, `(min-width: ${e(this, a)}px)`), i(this, o, "min")) : (i(this, a, 0), i(this, d, `(min-width: ${e(this, a)}px)`), i(this, o, "min")), i(this, f, e(this, f).replace(
|
|
25
|
+
`.${e(this, a)}${e(this, o)}`,
|
|
26
26
|
""
|
|
27
27
|
)), i(this, y, t[t.length - 1] === e(this, f) ? "" : "." + t[t.length - 1]), i(this, y, e(this, y).replace(
|
|
28
|
-
`.${e(this,
|
|
28
|
+
`.${e(this, a)}${e(this, o)}`,
|
|
29
29
|
""
|
|
30
30
|
));
|
|
31
31
|
}
|
|
@@ -48,21 +48,21 @@ class T {
|
|
|
48
48
|
return e(this, o);
|
|
49
49
|
}
|
|
50
50
|
get queryValue() {
|
|
51
|
-
return e(this,
|
|
51
|
+
return e(this, a);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
w = new WeakMap(), f = new WeakMap(), E = new WeakMap(), d = new WeakMap(),
|
|
54
|
+
w = new WeakMap(), f = new WeakMap(), E = new WeakMap(), d = new WeakMap(), a = new WeakMap(), o = new WeakMap(), y = new WeakMap();
|
|
55
55
|
var x;
|
|
56
|
-
class
|
|
56
|
+
class P {
|
|
57
57
|
constructor(n, t) {
|
|
58
58
|
m(this, x);
|
|
59
59
|
i(this, x, /* @__PURE__ */ new Map());
|
|
60
|
-
const
|
|
60
|
+
const h = (t == null ? void 0 : t.mediaBuckets) !== !1, p = typeof n == "string" ? h ? n.trim().split(",").map((s) => s.trim()).filter((s) => !!s) : [n] : n, c = [];
|
|
61
61
|
p.forEach((s) => {
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const l = new O(s);
|
|
63
|
+
c.push([l.query, l]);
|
|
64
64
|
});
|
|
65
|
-
const g =
|
|
65
|
+
const g = c.filter((s) => s[1].queryType.includes("max")).sort((s, l) => l[1].queryValue - s[1].queryValue), R = c.filter((s) => s[1].queryType.includes("min") && s[1].queryValue !== 0).sort((s, l) => s[1].queryValue - l[1].queryValue), $ = c.filter((s) => s[0] === "(min-width: 0px)");
|
|
66
66
|
($ ? [...$, ...g, ...R] : [...g, ...R]).forEach((s) => {
|
|
67
67
|
e(this, x).has(s[0]) || e(this, x).set(s[0], []), e(this, x).get(s[0]).push(s[1]);
|
|
68
68
|
});
|
|
@@ -73,35 +73,35 @@ class O {
|
|
|
73
73
|
}
|
|
74
74
|
x = new WeakMap();
|
|
75
75
|
var M, q;
|
|
76
|
-
class _ extends
|
|
76
|
+
class _ extends T {
|
|
77
77
|
constructor(t) {
|
|
78
78
|
super(void 0);
|
|
79
79
|
m(this, M);
|
|
80
80
|
m(this, q, () => {
|
|
81
81
|
let t;
|
|
82
|
-
e(this, M).mediaBuckets.forEach((
|
|
83
|
-
matchMedia(g).matches && (t =
|
|
82
|
+
e(this, M).mediaBuckets.forEach((c, g) => {
|
|
83
|
+
matchMedia(g).matches && (t = c);
|
|
84
84
|
});
|
|
85
|
-
let
|
|
86
|
-
t == null || t.forEach((
|
|
87
|
-
|
|
88
|
-
}), t != null && t.length && !
|
|
85
|
+
let h, p = 0;
|
|
86
|
+
t == null || t.forEach((c) => {
|
|
87
|
+
c.density > p && c.density <= Math.max(devicePixelRatio, 1) && (p = c.density, h = c);
|
|
88
|
+
}), t != null && t.length && !h && (h = t[0]), console.log(h == null ? void 0 : h.name), this.current = h;
|
|
89
89
|
});
|
|
90
|
-
i(this, M, new
|
|
90
|
+
i(this, M, new P(t.srcset, t.sourceSetOptions));
|
|
91
91
|
}
|
|
92
92
|
close() {
|
|
93
93
|
super.close(), this.disconnect();
|
|
94
94
|
}
|
|
95
95
|
connect() {
|
|
96
|
-
|
|
96
|
+
B.subscribe(e(this, q), A.SOURCE_MANAGER), e(this, q).call(this);
|
|
97
97
|
}
|
|
98
98
|
disconnect() {
|
|
99
|
-
|
|
99
|
+
B.unsubscribe(e(this, q));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
M = new WeakMap(), q = new WeakMap();
|
|
103
103
|
export {
|
|
104
|
-
|
|
104
|
+
O as Source,
|
|
105
105
|
_ as SourceManager,
|
|
106
|
-
|
|
106
|
+
P as SourceSet
|
|
107
107
|
};
|