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