aptechka 0.41.2 → 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 +61 -62
- 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,108 +1,107 @@
|
|
|
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
|
|
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
|
-
|
|
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, a);
|
|
17
|
+
m(this, o);
|
|
18
|
+
m(this, y);
|
|
19
|
+
i(this, w, n);
|
|
20
|
+
let t = n.split(".");
|
|
21
|
+
const h = /\b\d{1,2}x\b/g, p = t.find((u) => u.match(h) && parseInt(u));
|
|
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 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)}`,
|
|
27
26
|
""
|
|
28
|
-
)),
|
|
29
|
-
`.${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, a)}${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
|
-
return e(this,
|
|
51
|
+
return e(this, a);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
class
|
|
54
|
+
w = new WeakMap(), f = new WeakMap(), E = new WeakMap(), d = new WeakMap(), a = new WeakMap(), o = new WeakMap(), y = new WeakMap();
|
|
55
|
+
var x;
|
|
56
|
+
class P {
|
|
58
57
|
constructor(n, t) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
58
|
+
m(this, x);
|
|
59
|
+
i(this, x, /* @__PURE__ */ new Map());
|
|
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
|
+
p.forEach((s) => {
|
|
62
|
+
const l = new O(s);
|
|
63
|
+
c.push([l.query, l]);
|
|
65
64
|
});
|
|
66
|
-
const g =
|
|
67
|
-
(
|
|
68
|
-
e(this,
|
|
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
|
+
($ ? [...$, ...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
|
|
77
|
-
class _ extends
|
|
74
|
+
x = new WeakMap();
|
|
75
|
+
var M, q;
|
|
76
|
+
class _ extends T {
|
|
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,
|
|
84
|
-
matchMedia(g).matches && (t =
|
|
82
|
+
e(this, M).mediaBuckets.forEach((c, g) => {
|
|
83
|
+
matchMedia(g).matches && (t = c);
|
|
85
84
|
});
|
|
86
|
-
let
|
|
87
|
-
t == null || t.forEach((
|
|
88
|
-
|
|
89
|
-
}), 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;
|
|
90
89
|
});
|
|
91
|
-
|
|
90
|
+
i(this, M, new P(t.srcset, t.sourceSetOptions));
|
|
92
91
|
}
|
|
93
92
|
close() {
|
|
94
93
|
super.close(), this.disconnect();
|
|
95
94
|
}
|
|
96
95
|
connect() {
|
|
97
|
-
|
|
96
|
+
B.subscribe(e(this, q), A.SOURCE_MANAGER), e(this, q).call(this);
|
|
98
97
|
}
|
|
99
98
|
disconnect() {
|
|
100
|
-
|
|
99
|
+
B.unsubscribe(e(this, q));
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
|
|
102
|
+
M = new WeakMap(), q = new WeakMap();
|
|
104
103
|
export {
|
|
105
|
-
|
|
104
|
+
O as Source,
|
|
106
105
|
_ as SourceManager,
|
|
107
|
-
|
|
106
|
+
P as SourceSet
|
|
108
107
|
};
|