aptechka 0.4.11 → 0.4.13
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/{Damped-Ceg1a3X8.js → Damped-BZujMwuv.js} +11 -10
- package/lib/Damped-DK3CSBXb.cjs +1 -0
- package/lib/{Derived-B-g8dYgh.cjs → Derived-BZtlW0bB.cjs} +1 -1
- package/lib/{Derived-kPJs5JC5.js → Derived-DH-ouLBq.js} +1 -1
- package/lib/DragControls-CV1YozSr.cjs +1 -0
- package/lib/{DragControls-CZhJHO0_.js → DragControls-Ch_JO2ML.js} +23 -22
- package/lib/SourceManager-Bl_uduSS.cjs +1 -0
- package/lib/{SourceManager-4OHacQoQ.js → SourceManager-D_8MZ3bR.js} +21 -20
- package/lib/Store-BQGNOHlY.cjs +1 -0
- package/lib/{Store-BQXXikps.js → Store-Cd-E5W1z.js} +8 -7
- package/lib/{Viewport-wlgZaIn7.js → Viewport-Bx-VImCe.js} +6 -5
- package/lib/Viewport-_WllZTJ0.cjs +1 -0
- package/lib/accordion/index.cjs +1 -1
- package/lib/accordion/index.js +1 -0
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +6 -5
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +16 -15
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +4 -3
- package/lib/checkbox/index.cjs +1 -1
- package/lib/checkbox/index.js +4 -3
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +2 -2
- package/lib/{createStylesheet-CqHU9_qv.cjs → createStylesheet-C8aQQ4hd.cjs} +1 -1
- package/lib/{createStylesheet-DBCEbDjI.js → createStylesheet-KMRQhSa-.js} +1 -1
- package/lib/createTheme-BSreUYge.cjs +1 -0
- package/lib/createTheme-u3NsrEV6.js +16 -0
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.js +4 -3
- package/lib/custom-element/index.cjs +1 -1
- package/lib/custom-element/index.js +3 -2
- package/lib/dev/index.cjs +1 -1
- package/lib/dev/index.js +7 -6
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +1 -1
- package/lib/element-constructor/index.cjs +1 -1
- package/lib/element-constructor/index.js +3 -3
- package/lib/element-resizer/index.cjs +1 -1
- package/lib/element-resizer/index.js +23 -22
- package/lib/en3/index.cjs +1 -1
- package/lib/en3/index.js +23 -22
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +8 -7
- package/lib/{index-BUOBDenR.js → index-Fasue6kv.js} +20 -19
- package/lib/index-nxoux28n.cjs +9 -0
- package/lib/intersector/index.cjs +1 -1
- package/lib/intersector/index.js +3 -2
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.js +11 -10
- package/lib/layout-box/index.cjs +1 -1
- package/lib/layout-box/index.js +148 -139
- package/lib/libs/path-data-polyfill.d.ts +1 -0
- package/lib/loading/index.cjs +1 -1
- package/lib/loading/index.js +16 -15
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +6 -5
- package/lib/modal/index.cjs +1 -1
- package/lib/modal/index.js +4 -3
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +21 -20
- package/lib/path-data-polyfill-CXsOR7Oc.cjs +3 -0
- package/lib/path-data-polyfill-DgeDWYeI.js +454 -0
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +14 -13
- package/lib/resized/index.cjs +1 -1
- package/lib/resized/index.js +8 -7
- package/lib/router/index.cjs +1 -1
- package/lib/router/index.js +8 -7
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +307 -298
- package/lib/scroll-entries/index.cjs +1 -1
- package/lib/scroll-entries/index.d.ts +3 -0
- package/lib/scroll-entries/index.js +18 -13
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/slicer/index.cjs +2 -2
- package/lib/slicer/index.js +4 -3
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +2 -2
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +13 -12
- package/lib/{tags-CMPg9ETZ.js → tags-BoPv9fDr.js} +234 -233
- package/lib/tags-CueX-JLX.cjs +1 -0
- package/lib/theme/index.cjs +1 -1
- package/lib/theme/index.js +7 -6
- package/lib/ticker/index.cjs +1 -1
- package/lib/ticker/index.js +3 -2
- package/lib/tweaker/index.cjs +1 -1
- package/lib/tweaker/index.js +6 -5
- package/lib/utils/index.cjs +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +164 -127
- package/lib/utils/svg.d.ts +15 -0
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +6 -5
- package/lib/window-resizer/index.cjs +1 -1
- package/lib/window-resizer/index.js +7 -6
- package/package.json +1 -1
- package/lib/Damped-BdnkNOcb.cjs +0 -1
- package/lib/DragControls-C7P6P5HO.cjs +0 -1
- package/lib/SourceManager-Bc68GDrb.cjs +0 -1
- package/lib/Store-C-1ruEIm.cjs +0 -1
- package/lib/Viewport-DAjFJF5V.cjs +0 -1
- package/lib/createTheme-CHnsCgAr.js +0 -15
- package/lib/createTheme-Cfaw9UmV.cjs +0 -1
- package/lib/index-Bv5vIuF-.cjs +0 -9
- package/lib/tags-Djb6mb1o.cjs +0 -1
package/lib/morph/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var T = (s, t, e) => new Promise((o, c) => {
|
|
|
28
28
|
var Z = (s, t, e) => (t = s[X("asyncIterator")]) ? t.call(s) : (s = s[X("iterator")](), t = {}, e = (o, c) => (c = s[o]) && (t[o] = (l) => new Promise((y, g, f) => (l = c.call(s, l), f = l.done, Promise.resolve(l.value).then((L) => y({ value: L, done: f }), g)))), e("next"), e("return"), t);
|
|
29
29
|
import { Notifier as _ } from "../notifier/index.js";
|
|
30
30
|
import { i as st } from "../browser-0zX67oeU.js";
|
|
31
|
+
import "../path-data-polyfill-DgeDWYeI.js";
|
|
31
32
|
var H, u, E, N, P, S;
|
|
32
33
|
class nt {
|
|
33
34
|
constructor(t, e) {
|
|
@@ -50,12 +51,12 @@ class nt {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
H = new WeakMap(), u = new WeakMap(), E = new WeakMap(), N = new WeakMap(), P = new WeakMap(), S = new WeakMap();
|
|
53
|
-
var a, k, A, C, x, O, w, v, M, D,
|
|
54
|
-
class
|
|
54
|
+
var a, k, A, C, x, O, w, v, M, D, m, R, G, B, $, W, J, F, Q, K, p, q, U, Y;
|
|
55
|
+
class lt {
|
|
55
56
|
constructor(t) {
|
|
56
|
-
n(this,
|
|
57
|
+
n(this, R);
|
|
57
58
|
n(this, B);
|
|
58
|
-
n(this,
|
|
59
|
+
n(this, W);
|
|
59
60
|
n(this, F);
|
|
60
61
|
n(this, K);
|
|
61
62
|
n(this, q);
|
|
@@ -69,21 +70,21 @@ class ct {
|
|
|
69
70
|
n(this, v, void 0);
|
|
70
71
|
n(this, M, null);
|
|
71
72
|
n(this, D, new _());
|
|
72
|
-
n(this,
|
|
73
|
+
n(this, m, new _());
|
|
73
74
|
n(this, Y, (t) => {
|
|
74
75
|
t.state && this.navigate(t.state, "none");
|
|
75
76
|
});
|
|
76
|
-
st && (r(this, a, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (r(this, a, t.base), t.base.endsWith("/") || r(this, a, i(this, a) + "/")) : r(this, a, "/"), r(this, k, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), r(this, A, (t == null ? void 0 : t.cachePages) !== !1), r(this, C, d(this, F, Q).call(this, document)), r(this, M, location.pathname), d(this,
|
|
77
|
+
st && (r(this, a, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (r(this, a, t.base), t.base.endsWith("/") || r(this, a, i(this, a) + "/")) : r(this, a, "/"), r(this, k, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), r(this, A, (t == null ? void 0 : t.cachePages) !== !1), r(this, C, d(this, F, Q).call(this, document)), r(this, M, location.pathname), d(this, W, J).call(this), addEventListener("popstate", i(this, Y)));
|
|
77
78
|
}
|
|
78
79
|
beforeNavigationEvent(t) {
|
|
79
80
|
return i(this, D).subscribe(t);
|
|
80
81
|
}
|
|
81
82
|
afterNavigationEvent(t) {
|
|
82
|
-
return i(this,
|
|
83
|
+
return i(this, m).subscribe(t);
|
|
83
84
|
}
|
|
84
85
|
prefetch(t) {
|
|
85
86
|
return T(this, null, function* () {
|
|
86
|
-
return d(this,
|
|
87
|
+
return d(this, R, G).call(this, t);
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
navigate(t, e = "push") {
|
|
@@ -109,7 +110,7 @@ class ct {
|
|
|
109
110
|
isCached: o
|
|
110
111
|
}), !l || i(this, v) !== t)
|
|
111
112
|
return;
|
|
112
|
-
const y = i(this, w).get(t) || (yield d(this,
|
|
113
|
+
const y = i(this, w).get(t) || (yield d(this, R, G).call(this, t));
|
|
113
114
|
if (i(this, v) !== t)
|
|
114
115
|
return;
|
|
115
116
|
const g = Array.from(document.head.children), f = Array.from(
|
|
@@ -122,20 +123,20 @@ class ct {
|
|
|
122
123
|
i(this, k) && j.length && (yield new Promise((h) => T(this, null, function* () {
|
|
123
124
|
let b = 0;
|
|
124
125
|
try {
|
|
125
|
-
for (var I = Z(j),
|
|
126
|
-
const it =
|
|
126
|
+
for (var I = Z(j), dt, at, gt; dt = !(at = yield I.next()).done; dt = !1) {
|
|
127
|
+
const it = at.value;
|
|
127
128
|
it.onload = () => {
|
|
128
129
|
b++, b === j.length && h();
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
|
-
} catch (
|
|
132
|
-
|
|
132
|
+
} catch (at) {
|
|
133
|
+
gt = [at];
|
|
133
134
|
} finally {
|
|
134
135
|
try {
|
|
135
|
-
|
|
136
|
+
dt && (at = I.return) && (yield at.call(I));
|
|
136
137
|
} finally {
|
|
137
|
-
if (
|
|
138
|
-
throw
|
|
138
|
+
if (gt)
|
|
139
|
+
throw gt[0];
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
})));
|
|
@@ -143,7 +144,7 @@ class ct {
|
|
|
143
144
|
i(this, C).forEach((h, b) => {
|
|
144
145
|
const I = et[b];
|
|
145
146
|
h.innerHTML = I.innerHTML;
|
|
146
|
-
}), r(this, M, t), e === "push" ? history.pushState(t, "", t + location.search) : e === "replace" && history.replaceState(t, "", t + location.search), d(this,
|
|
147
|
+
}), r(this, M, t), e === "push" ? history.pushState(t, "", t + location.search) : e === "replace" && history.replaceState(t, "", t + location.search), d(this, W, J).call(this), (c = this.postprocessor) == null || c.call(this, { pathname: t, isCached: o }), i(this, m).notify({ pathname: t, isCached: o });
|
|
147
148
|
} catch (l) {
|
|
148
149
|
console.error(l);
|
|
149
150
|
}
|
|
@@ -151,7 +152,7 @@ class ct {
|
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
a = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), x = new WeakMap(), O = new WeakMap(), w = new WeakMap(), v = new WeakMap(), M = new WeakMap(), D = new WeakMap(),
|
|
155
|
+
a = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), x = new WeakMap(), O = new WeakMap(), w = new WeakMap(), v = new WeakMap(), M = new WeakMap(), D = new WeakMap(), m = new WeakMap(), R = new WeakSet(), G = function(t) {
|
|
155
156
|
return T(this, null, function* () {
|
|
156
157
|
const e = i(this, w).get(t);
|
|
157
158
|
if (e)
|
|
@@ -161,7 +162,7 @@ a = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), x =
|
|
|
161
162
|
});
|
|
162
163
|
}, B = new WeakSet(), $ = function(t) {
|
|
163
164
|
return t = t.replace(i(this, a), ""), t.startsWith("/") && (t = t.slice(1)), i(this, a) + t;
|
|
164
|
-
},
|
|
165
|
+
}, W = new WeakSet(), J = function() {
|
|
165
166
|
const t = [
|
|
166
167
|
...document.documentElement.querySelectorAll("a")
|
|
167
168
|
].filter((e) => {
|
|
@@ -186,5 +187,5 @@ a = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), x =
|
|
|
186
187
|
);
|
|
187
188
|
}, Y = new WeakMap();
|
|
188
189
|
export {
|
|
189
|
-
|
|
190
|
+
lt as Morph
|
|
190
191
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";// @license
|
|
2
|
+
(!SVGPathElement.prototype.getPathData||!SVGPathElement.prototype.setPathData)&&function(){var w={Z:"Z",M:"M",L:"L",C:"C",Q:"Q",A:"A",H:"H",V:"V",S:"S",T:"T",z:"Z",m:"m",l:"l",c:"c",q:"q",a:"a",h:"h",v:"v",s:"s",t:"t"},k=function(u){this._string=u,this._currentIndex=0,this._endIndex=this._string.length,this._prevCommand=null,this._skipOptionalSpaces()},K=window.navigator.userAgent.indexOf("MSIE ")!==-1;k.prototype={parseSegment:function(){var u=this._string[this._currentIndex],t=w[u]?w[u]:null;if(t===null){if(this._prevCommand===null||((u==="+"||u==="-"||u==="."||u>="0"&&u<="9")&&this._prevCommand!=="Z"?this._prevCommand==="M"?t="L":this._prevCommand==="m"?t="l":t=this._prevCommand:t=null,t===null))return null}else this._currentIndex+=1;this._prevCommand=t;var e=null,s=t.toUpperCase();return s==="H"||s==="V"?e=[this._parseNumber()]:s==="M"||s==="L"||s==="T"?e=[this._parseNumber(),this._parseNumber()]:s==="S"||s==="Q"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:s==="C"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:s==="A"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseArcFlag(),this._parseArcFlag(),this._parseNumber(),this._parseNumber()]:s==="Z"&&(this._skipOptionalSpaces(),e=[]),e===null||e.indexOf(null)>=0?null:{type:t,values:e}},hasMoreData:function(){return this._currentIndex<this._endIndex},peekSegmentType:function(){var u=this._string[this._currentIndex];return w[u]?w[u]:null},initialCommandIsMoveTo:function(){if(!this.hasMoreData())return!0;var u=this.peekSegmentType();return u==="M"||u==="m"},_isCurrentSpace:function(){var u=this._string[this._currentIndex];return u<=" "&&(u===" "||u===`
|
|
3
|
+
`||u===" "||u==="\r"||u==="\f")},_skipOptionalSpaces:function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex+=1;return this._currentIndex<this._endIndex},_skipOptionalSpacesOrDelimiter:function(){return this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&this._string[this._currentIndex]!==","?!1:(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&this._string[this._currentIndex]===","&&(this._currentIndex+=1,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)},_parseNumber:function(){var u=0,t=0,e=1,s=0,l=1,n=1,a=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&this._string[this._currentIndex]==="+"?this._currentIndex+=1:this._currentIndex<this._endIndex&&this._string[this._currentIndex]==="-"&&(this._currentIndex+=1,l=-1),this._currentIndex===this._endIndex||(this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")&&this._string[this._currentIndex]!==".")return null;for(var p=this._currentIndex;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>="0"&&this._string[this._currentIndex]<="9";)this._currentIndex+=1;if(this._currentIndex!==p)for(var i=this._currentIndex-1,r=1;i>=p;)t+=r*(this._string[i]-"0"),i-=1,r*=10;if(this._currentIndex<this._endIndex&&this._string[this._currentIndex]==="."){if(this._currentIndex+=1,this._currentIndex>=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>="0"&&this._string[this._currentIndex]<="9";)e*=10,s+=(this._string.charAt(this._currentIndex)-"0")/e,this._currentIndex+=1}if(this._currentIndex!==a&&this._currentIndex+1<this._endIndex&&(this._string[this._currentIndex]==="e"||this._string[this._currentIndex]==="E")&&this._string[this._currentIndex+1]!=="x"&&this._string[this._currentIndex+1]!=="m"){if(this._currentIndex+=1,this._string[this._currentIndex]==="+"?this._currentIndex+=1:this._string[this._currentIndex]==="-"&&(this._currentIndex+=1,n=-1),this._currentIndex>=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>="0"&&this._string[this._currentIndex]<="9";)u*=10,u+=this._string[this._currentIndex]-"0",this._currentIndex+=1}var v=t+s;return v*=l,u&&(v*=Math.pow(10,n*u)),a===this._currentIndex?null:(this._skipOptionalSpacesOrDelimiter(),v)},_parseArcFlag:function(){if(this._currentIndex>=this._endIndex)return null;var u=null,t=this._string[this._currentIndex];if(this._currentIndex+=1,t==="0")u=0;else if(t==="1")u=1;else return null;return this._skipOptionalSpacesOrDelimiter(),u}};var z=function(u){if(!u||u.length===0)return[];var t=new k(u),e=[];if(t.initialCommandIsMoveTo())for(;t.hasMoreData();){var s=t.parseSegment();if(s===null)break;e.push(s)}return e},W=SVGPathElement.prototype.setAttribute,U=SVGPathElement.prototype.setAttributeNS,R=SVGPathElement.prototype.removeAttribute,g=SVGPathElement.prototype.removeAttributeNS,x=window.Symbol?Symbol():"__cachedPathData",S=window.Symbol?Symbol():"__cachedNormalizedPathData",H=function(u,t,e,s,l,n,a,p,i,r){var v=function(L){return Math.PI*L/180},h=function(L,J,T){var ht=L*Math.cos(T)-J*Math.sin(T),pt=L*Math.sin(T)+J*Math.cos(T);return{x:ht,y:pt}},o=v(a),c=[],_,f,d,y;if(r)_=r[0],f=r[1],d=r[2],y=r[3];else{var A=h(u,t,-o);u=A.x,t=A.y;var P=h(e,s,-o);e=P.x,s=P.y;var m=(u-e)/2,I=(t-s)/2,M=m*m/(l*l)+I*I/(n*n);M>1&&(M=Math.sqrt(M),l=M*l,n=M*n);var D;p===i?D=-1:D=1;var E=l*l,N=n*n,et=E*N-E*I*I-N*m*m,at=E*I*I+N*m*m,O=D*Math.sqrt(Math.abs(et/at));d=O*l*I/n+(u+e)/2,y=O*-n*m/l+(t+s)/2,_=Math.asin(parseFloat(((t-y)/n).toFixed(9))),f=Math.asin(parseFloat(((s-y)/n).toFixed(9))),u<d&&(_=Math.PI-_),e<d&&(f=Math.PI-f),_<0&&(_=Math.PI*2+_),f<0&&(f=Math.PI*2+f),i&&_>f&&(_=_-Math.PI*2),!i&&f>_&&(f=f-Math.PI*2)}var Z=f-_;if(Math.abs(Z)>Math.PI*120/180){var rt=f,st=e,ut=s;i&&f>_?f=_+Math.PI*120/180*1:f=_+Math.PI*120/180*-1,e=d+l*Math.cos(f),s=y+n*Math.sin(f),c=H(e,s,st,ut,l,n,a,0,i,[f,rt,d,y])}Z=f-_;var it=Math.cos(_),nt=Math.sin(_),lt=Math.cos(f),vt=Math.sin(f),Q=Math.tan(Z/4),X=4/3*l*Q,Y=4/3*n*Q,q=[u,t],C=[u+X*nt,t-Y*it],$=[e+X*vt,s-Y*lt],F=[e,s];if(C[0]=2*q[0]-C[0],C[1]=2*q[1]-C[1],r)return[C,$,F].concat(c);c=[C,$,F].concat(c);for(var j=[],b=0;b<c.length;b+=3){var l=h(c[b][0],c[b][1],o),n=h(c[b+1][0],c[b+1][1],o),B=h(c[b+2][0],c[b+2][1],o);j.push([l.x,l.y,n.x,n.y,B.x,B.y])}return j},V=function(u){return u.map(function(t){return{type:t.type,values:Array.prototype.slice.call(t.values)}})},tt=function(u){var t=[],e=null,s=null,l=null,n=null;return u.forEach(function(a){var p=a.type;if(p==="M"){var i=a.values[0],r=a.values[1];t.push({type:"M",values:[i,r]}),l=i,n=r,e=i,s=r}else if(p==="m"){var i=e+a.values[0],r=s+a.values[1];t.push({type:"M",values:[i,r]}),l=i,n=r,e=i,s=r}else if(p==="L"){var i=a.values[0],r=a.values[1];t.push({type:"L",values:[i,r]}),e=i,s=r}else if(p==="l"){var i=e+a.values[0],r=s+a.values[1];t.push({type:"L",values:[i,r]}),e=i,s=r}else if(p==="C"){var v=a.values[0],h=a.values[1],o=a.values[2],c=a.values[3],i=a.values[4],r=a.values[5];t.push({type:"C",values:[v,h,o,c,i,r]}),e=i,s=r}else if(p==="c"){var v=e+a.values[0],h=s+a.values[1],o=e+a.values[2],c=s+a.values[3],i=e+a.values[4],r=s+a.values[5];t.push({type:"C",values:[v,h,o,c,i,r]}),e=i,s=r}else if(p==="Q"){var v=a.values[0],h=a.values[1],i=a.values[2],r=a.values[3];t.push({type:"Q",values:[v,h,i,r]}),e=i,s=r}else if(p==="q"){var v=e+a.values[0],h=s+a.values[1],i=e+a.values[2],r=s+a.values[3];t.push({type:"Q",values:[v,h,i,r]}),e=i,s=r}else if(p==="A"){var i=a.values[5],r=a.values[6];t.push({type:"A",values:[a.values[0],a.values[1],a.values[2],a.values[3],a.values[4],i,r]}),e=i,s=r}else if(p==="a"){var i=e+a.values[5],r=s+a.values[6];t.push({type:"A",values:[a.values[0],a.values[1],a.values[2],a.values[3],a.values[4],i,r]}),e=i,s=r}else if(p==="H"){var i=a.values[0];t.push({type:"H",values:[i]}),e=i}else if(p==="h"){var i=e+a.values[0];t.push({type:"H",values:[i]}),e=i}else if(p==="V"){var r=a.values[0];t.push({type:"V",values:[r]}),s=r}else if(p==="v"){var r=s+a.values[0];t.push({type:"V",values:[r]}),s=r}else if(p==="S"){var o=a.values[0],c=a.values[1],i=a.values[2],r=a.values[3];t.push({type:"S",values:[o,c,i,r]}),e=i,s=r}else if(p==="s"){var o=e+a.values[0],c=s+a.values[1],i=e+a.values[2],r=s+a.values[3];t.push({type:"S",values:[o,c,i,r]}),e=i,s=r}else if(p==="T"){var i=a.values[0],r=a.values[1];t.push({type:"T",values:[i,r]}),e=i,s=r}else if(p==="t"){var i=e+a.values[0],r=s+a.values[1];t.push({type:"T",values:[i,r]}),e=i,s=r}else(p==="Z"||p==="z")&&(t.push({type:"Z",values:[]}),e=l,s=n)}),t},G=function(u){var t=[],e=null,s=null,l=null,n=null,a=null,p=null,i=null;return u.forEach(function(r){if(r.type==="M"){var v=r.values[0],h=r.values[1];t.push({type:"M",values:[v,h]}),p=v,i=h,n=v,a=h}else if(r.type==="C"){var o=r.values[0],c=r.values[1],_=r.values[2],f=r.values[3],v=r.values[4],h=r.values[5];t.push({type:"C",values:[o,c,_,f,v,h]}),s=_,l=f,n=v,a=h}else if(r.type==="L"){var v=r.values[0],h=r.values[1];t.push({type:"L",values:[v,h]}),n=v,a=h}else if(r.type==="H"){var v=r.values[0];t.push({type:"L",values:[v,a]}),n=v}else if(r.type==="V"){var h=r.values[0];t.push({type:"L",values:[n,h]}),a=h}else if(r.type==="S"){var _=r.values[0],f=r.values[1],v=r.values[2],h=r.values[3],d,y;e==="C"||e==="S"?(d=n+(n-s),y=a+(a-l)):(d=n,y=a),t.push({type:"C",values:[d,y,_,f,v,h]}),s=_,l=f,n=v,a=h}else if(r.type==="T"){var v=r.values[0],h=r.values[1],o,c;e==="Q"||e==="T"?(o=n+(n-s),c=a+(a-l)):(o=n,c=a);var d=n+2*(o-n)/3,y=a+2*(c-a)/3,A=v+2*(o-v)/3,P=h+2*(c-h)/3;t.push({type:"C",values:[d,y,A,P,v,h]}),s=o,l=c,n=v,a=h}else if(r.type==="Q"){var o=r.values[0],c=r.values[1],v=r.values[2],h=r.values[3],d=n+2*(o-n)/3,y=a+2*(c-a)/3,A=v+2*(o-v)/3,P=h+2*(c-h)/3;t.push({type:"C",values:[d,y,A,P,v,h]}),s=o,l=c,n=v,a=h}else if(r.type==="A"){var m=Math.abs(r.values[0]),I=Math.abs(r.values[1]),M=r.values[2],D=r.values[3],E=r.values[4],v=r.values[5],h=r.values[6];if(m===0||I===0)t.push({type:"C",values:[n,a,v,h,v,h]}),n=v,a=h;else if(n!==v||a!==h){var N=H(n,a,v,h,m,I,M,D,E);N.forEach(function(O){t.push({type:"C",values:O})}),n=v,a=h}}else r.type==="Z"&&(t.push(r),n=p,a=i);e=r.type}),t};SVGPathElement.prototype.setAttribute=function(u,t){u==="d"&&(this[x]=null,this[S]=null),W.call(this,u,t)},SVGPathElement.prototype.setAttributeNS=function(u,t,e){if(t==="d"){var s="http://www.w3.org/2000/svg";if(u)for(var l of this.ownerSVGElement.attributes)l.name===`xmlns:${u}`&&(s=l.value);s==="http://www.w3.org/2000/svg"&&(this[x]=null,this[S]=null)}U.call(this,u,t,e)},SVGPathElement.prototype.removeAttribute=function(u,t){u==="d"&&(this[x]=null,this[S]=null),R.call(this,u)},SVGPathElement.prototype.removeAttributeNS=function(u,t){if(t==="d"){var e="http://www.w3.org/2000/svg";if(u)for(var s of this.ownerSVGElement.attributes)s.name===`xmlns:${u}`&&(e=s.value);e==="http://www.w3.org/2000/svg"&&(this[x]=null,this[S]=null)}g.call(this,u,t)},SVGPathElement.prototype.getPathData=function(u){if(u&&u.normalize){if(this[S])return V(this[S]);var t;this[x]?t=V(this[x]):(t=z(this.getAttribute("d")||""),this[x]=V(t));var e=G(tt(t));return this[S]=V(e),e}else{if(this[x])return V(this[x]);var t=z(this.getAttribute("d")||"");return this[x]=V(t),t}},SVGPathElement.prototype.setPathData=function(u){if(u.length===0)K?this.setAttribute("d",""):this.removeAttribute("d");else{for(var t="",e=0,s=u.length;e<s;e+=1){var l=u[e];e>0&&(t+=" "),t+=l.type,l.values&&l.values.length>0&&(t+=" "+l.values.join(" "))}this.setAttribute("d",t)}},SVGRectElement.prototype.getPathData=function(u){var t=this.x.baseVal.value,e=this.y.baseVal.value,s=this.width.baseVal.value,l=this.height.baseVal.value,n=this.hasAttribute("rx")?this.rx.baseVal.value:this.ry.baseVal.value,a=this.hasAttribute("ry")?this.ry.baseVal.value:this.rx.baseVal.value;n>s/2&&(n=s/2),a>l/2&&(a=l/2);var p=[{type:"M",values:[t+n,e]},{type:"H",values:[t+s-n]},{type:"A",values:[n,a,0,0,1,t+s,e+a]},{type:"V",values:[e+l-a]},{type:"A",values:[n,a,0,0,1,t+s-n,e+l]},{type:"H",values:[t+n]},{type:"A",values:[n,a,0,0,1,t,e+l-a]},{type:"V",values:[e+a]},{type:"A",values:[n,a,0,0,1,t+n,e]},{type:"Z",values:[]}];return p=p.filter(function(i){return!(i.type==="A"&&(i.values[0]===0||i.values[1]===0))}),u&&u.normalize===!0&&(p=G(p)),p},SVGCircleElement.prototype.getPathData=function(u){var t=this.cx.baseVal.value,e=this.cy.baseVal.value,s=this.r.baseVal.value,l=[{type:"M",values:[t+s,e]},{type:"A",values:[s,s,0,0,1,t,e+s]},{type:"A",values:[s,s,0,0,1,t-s,e]},{type:"A",values:[s,s,0,0,1,t,e-s]},{type:"A",values:[s,s,0,0,1,t+s,e]},{type:"Z",values:[]}];return u&&u.normalize===!0&&(l=G(l)),l},SVGEllipseElement.prototype.getPathData=function(u){var t=this.cx.baseVal.value,e=this.cy.baseVal.value,s=this.rx.baseVal.value,l=this.ry.baseVal.value,n=[{type:"M",values:[t+s,e]},{type:"A",values:[s,l,0,0,1,t,e+l]},{type:"A",values:[s,l,0,0,1,t-s,e]},{type:"A",values:[s,l,0,0,1,t,e-l]},{type:"A",values:[s,l,0,0,1,t+s,e]},{type:"Z",values:[]}];return u&&u.normalize===!0&&(n=G(n)),n},SVGLineElement.prototype.getPathData=function(){return[{type:"M",values:[this.x1.baseVal.value,this.y1.baseVal.value]},{type:"L",values:[this.x2.baseVal.value,this.y2.baseVal.value]}]},SVGPolylineElement.prototype.getPathData=function(){for(var u=[],t=0;t<this.points.numberOfItems;t+=1){var e=this.points.getItem(t);u.push({type:t===0?"M":"L",values:[e.x,e.y]})}return u},SVGPolygonElement.prototype.getPathData=function(){for(var u=[],t=0;t<this.points.numberOfItems;t+=1){var e=this.points.getItem(t);u.push({type:t===0?"M":"L",values:[e.x,e.y]})}return u.push({type:"Z",values:[]}),u}}();
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
// @license
|
|
2
|
+
(!SVGPathElement.prototype.getPathData || !SVGPathElement.prototype.setPathData) && function() {
|
|
3
|
+
var w = {
|
|
4
|
+
Z: "Z",
|
|
5
|
+
M: "M",
|
|
6
|
+
L: "L",
|
|
7
|
+
C: "C",
|
|
8
|
+
Q: "Q",
|
|
9
|
+
A: "A",
|
|
10
|
+
H: "H",
|
|
11
|
+
V: "V",
|
|
12
|
+
S: "S",
|
|
13
|
+
T: "T",
|
|
14
|
+
z: "Z",
|
|
15
|
+
m: "m",
|
|
16
|
+
l: "l",
|
|
17
|
+
c: "c",
|
|
18
|
+
q: "q",
|
|
19
|
+
a: "a",
|
|
20
|
+
h: "h",
|
|
21
|
+
v: "v",
|
|
22
|
+
s: "s",
|
|
23
|
+
t: "t"
|
|
24
|
+
}, k = function(u) {
|
|
25
|
+
this._string = u, this._currentIndex = 0, this._endIndex = this._string.length, this._prevCommand = null, this._skipOptionalSpaces();
|
|
26
|
+
}, K = window.navigator.userAgent.indexOf("MSIE ") !== -1;
|
|
27
|
+
k.prototype = {
|
|
28
|
+
parseSegment: function() {
|
|
29
|
+
var u = this._string[this._currentIndex], t = w[u] ? w[u] : null;
|
|
30
|
+
if (t === null) {
|
|
31
|
+
if (this._prevCommand === null || ((u === "+" || u === "-" || u === "." || u >= "0" && u <= "9") && this._prevCommand !== "Z" ? this._prevCommand === "M" ? t = "L" : this._prevCommand === "m" ? t = "l" : t = this._prevCommand : t = null, t === null))
|
|
32
|
+
return null;
|
|
33
|
+
} else
|
|
34
|
+
this._currentIndex += 1;
|
|
35
|
+
this._prevCommand = t;
|
|
36
|
+
var e = null, s = t.toUpperCase();
|
|
37
|
+
return s === "H" || s === "V" ? e = [this._parseNumber()] : s === "M" || s === "L" || s === "T" ? e = [this._parseNumber(), this._parseNumber()] : s === "S" || s === "Q" ? e = [
|
|
38
|
+
this._parseNumber(),
|
|
39
|
+
this._parseNumber(),
|
|
40
|
+
this._parseNumber(),
|
|
41
|
+
this._parseNumber()
|
|
42
|
+
] : s === "C" ? e = [
|
|
43
|
+
this._parseNumber(),
|
|
44
|
+
this._parseNumber(),
|
|
45
|
+
this._parseNumber(),
|
|
46
|
+
this._parseNumber(),
|
|
47
|
+
this._parseNumber(),
|
|
48
|
+
this._parseNumber()
|
|
49
|
+
] : s === "A" ? e = [
|
|
50
|
+
this._parseNumber(),
|
|
51
|
+
this._parseNumber(),
|
|
52
|
+
this._parseNumber(),
|
|
53
|
+
this._parseArcFlag(),
|
|
54
|
+
this._parseArcFlag(),
|
|
55
|
+
this._parseNumber(),
|
|
56
|
+
this._parseNumber()
|
|
57
|
+
] : s === "Z" && (this._skipOptionalSpaces(), e = []), e === null || e.indexOf(null) >= 0 ? null : { type: t, values: e };
|
|
58
|
+
},
|
|
59
|
+
hasMoreData: function() {
|
|
60
|
+
return this._currentIndex < this._endIndex;
|
|
61
|
+
},
|
|
62
|
+
peekSegmentType: function() {
|
|
63
|
+
var u = this._string[this._currentIndex];
|
|
64
|
+
return w[u] ? w[u] : null;
|
|
65
|
+
},
|
|
66
|
+
initialCommandIsMoveTo: function() {
|
|
67
|
+
if (!this.hasMoreData())
|
|
68
|
+
return !0;
|
|
69
|
+
var u = this.peekSegmentType();
|
|
70
|
+
return u === "M" || u === "m";
|
|
71
|
+
},
|
|
72
|
+
_isCurrentSpace: function() {
|
|
73
|
+
var u = this._string[this._currentIndex];
|
|
74
|
+
return u <= " " && (u === " " || u === `
|
|
75
|
+
` || u === " " || u === "\r" || u === "\f");
|
|
76
|
+
},
|
|
77
|
+
_skipOptionalSpaces: function() {
|
|
78
|
+
for (; this._currentIndex < this._endIndex && this._isCurrentSpace(); )
|
|
79
|
+
this._currentIndex += 1;
|
|
80
|
+
return this._currentIndex < this._endIndex;
|
|
81
|
+
},
|
|
82
|
+
_skipOptionalSpacesOrDelimiter: function() {
|
|
83
|
+
return this._currentIndex < this._endIndex && !this._isCurrentSpace() && this._string[this._currentIndex] !== "," ? !1 : (this._skipOptionalSpaces() && this._currentIndex < this._endIndex && this._string[this._currentIndex] === "," && (this._currentIndex += 1, this._skipOptionalSpaces()), this._currentIndex < this._endIndex);
|
|
84
|
+
},
|
|
85
|
+
// Parse a number from an SVG path. This very closely follows genericParseNumber(...) from
|
|
86
|
+
// Source/core/svg/SVGParserUtilities.cpp.
|
|
87
|
+
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-PathDataBNF
|
|
88
|
+
_parseNumber: function() {
|
|
89
|
+
var u = 0, t = 0, e = 1, s = 0, l = 1, n = 1, a = this._currentIndex;
|
|
90
|
+
if (this._skipOptionalSpaces(), this._currentIndex < this._endIndex && this._string[this._currentIndex] === "+" ? this._currentIndex += 1 : this._currentIndex < this._endIndex && this._string[this._currentIndex] === "-" && (this._currentIndex += 1, l = -1), this._currentIndex === this._endIndex || (this._string[this._currentIndex] < "0" || this._string[this._currentIndex] > "9") && this._string[this._currentIndex] !== ".")
|
|
91
|
+
return null;
|
|
92
|
+
for (var p = this._currentIndex; this._currentIndex < this._endIndex && this._string[this._currentIndex] >= "0" && this._string[this._currentIndex] <= "9"; )
|
|
93
|
+
this._currentIndex += 1;
|
|
94
|
+
if (this._currentIndex !== p)
|
|
95
|
+
for (var i = this._currentIndex - 1, r = 1; i >= p; )
|
|
96
|
+
t += r * (this._string[i] - "0"), i -= 1, r *= 10;
|
|
97
|
+
if (this._currentIndex < this._endIndex && this._string[this._currentIndex] === ".") {
|
|
98
|
+
if (this._currentIndex += 1, this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || this._string[this._currentIndex] > "9")
|
|
99
|
+
return null;
|
|
100
|
+
for (; this._currentIndex < this._endIndex && this._string[this._currentIndex] >= "0" && this._string[this._currentIndex] <= "9"; )
|
|
101
|
+
e *= 10, s += (this._string.charAt(this._currentIndex) - "0") / e, this._currentIndex += 1;
|
|
102
|
+
}
|
|
103
|
+
if (this._currentIndex !== a && this._currentIndex + 1 < this._endIndex && (this._string[this._currentIndex] === "e" || this._string[this._currentIndex] === "E") && this._string[this._currentIndex + 1] !== "x" && this._string[this._currentIndex + 1] !== "m") {
|
|
104
|
+
if (this._currentIndex += 1, this._string[this._currentIndex] === "+" ? this._currentIndex += 1 : this._string[this._currentIndex] === "-" && (this._currentIndex += 1, n = -1), this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || this._string[this._currentIndex] > "9")
|
|
105
|
+
return null;
|
|
106
|
+
for (; this._currentIndex < this._endIndex && this._string[this._currentIndex] >= "0" && this._string[this._currentIndex] <= "9"; )
|
|
107
|
+
u *= 10, u += this._string[this._currentIndex] - "0", this._currentIndex += 1;
|
|
108
|
+
}
|
|
109
|
+
var v = t + s;
|
|
110
|
+
return v *= l, u && (v *= Math.pow(10, n * u)), a === this._currentIndex ? null : (this._skipOptionalSpacesOrDelimiter(), v);
|
|
111
|
+
},
|
|
112
|
+
_parseArcFlag: function() {
|
|
113
|
+
if (this._currentIndex >= this._endIndex)
|
|
114
|
+
return null;
|
|
115
|
+
var u = null, t = this._string[this._currentIndex];
|
|
116
|
+
if (this._currentIndex += 1, t === "0")
|
|
117
|
+
u = 0;
|
|
118
|
+
else if (t === "1")
|
|
119
|
+
u = 1;
|
|
120
|
+
else
|
|
121
|
+
return null;
|
|
122
|
+
return this._skipOptionalSpacesOrDelimiter(), u;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var z = function(u) {
|
|
126
|
+
if (!u || u.length === 0)
|
|
127
|
+
return [];
|
|
128
|
+
var t = new k(u), e = [];
|
|
129
|
+
if (t.initialCommandIsMoveTo())
|
|
130
|
+
for (; t.hasMoreData(); ) {
|
|
131
|
+
var s = t.parseSegment();
|
|
132
|
+
if (s === null)
|
|
133
|
+
break;
|
|
134
|
+
e.push(s);
|
|
135
|
+
}
|
|
136
|
+
return e;
|
|
137
|
+
}, W = SVGPathElement.prototype.setAttribute, U = SVGPathElement.prototype.setAttributeNS, R = SVGPathElement.prototype.removeAttribute, g = SVGPathElement.prototype.removeAttributeNS, x = window.Symbol ? Symbol() : "__cachedPathData", S = window.Symbol ? Symbol() : "__cachedNormalizedPathData", H = function(u, t, e, s, l, n, a, p, i, r) {
|
|
138
|
+
var v = function(L) {
|
|
139
|
+
return Math.PI * L / 180;
|
|
140
|
+
}, h = function(L, J, T) {
|
|
141
|
+
var ht = L * Math.cos(T) - J * Math.sin(T), pt = L * Math.sin(T) + J * Math.cos(T);
|
|
142
|
+
return { x: ht, y: pt };
|
|
143
|
+
}, o = v(a), c = [], _, f, d, y;
|
|
144
|
+
if (r)
|
|
145
|
+
_ = r[0], f = r[1], d = r[2], y = r[3];
|
|
146
|
+
else {
|
|
147
|
+
var A = h(u, t, -o);
|
|
148
|
+
u = A.x, t = A.y;
|
|
149
|
+
var P = h(e, s, -o);
|
|
150
|
+
e = P.x, s = P.y;
|
|
151
|
+
var m = (u - e) / 2, I = (t - s) / 2, M = m * m / (l * l) + I * I / (n * n);
|
|
152
|
+
M > 1 && (M = Math.sqrt(M), l = M * l, n = M * n);
|
|
153
|
+
var D;
|
|
154
|
+
p === i ? D = -1 : D = 1;
|
|
155
|
+
var E = l * l, N = n * n, et = E * N - E * I * I - N * m * m, at = E * I * I + N * m * m, O = D * Math.sqrt(Math.abs(et / at));
|
|
156
|
+
d = O * l * I / n + (u + e) / 2, y = O * -n * m / l + (t + s) / 2, _ = Math.asin(parseFloat(((t - y) / n).toFixed(9))), f = Math.asin(parseFloat(((s - y) / n).toFixed(9))), u < d && (_ = Math.PI - _), e < d && (f = Math.PI - f), _ < 0 && (_ = Math.PI * 2 + _), f < 0 && (f = Math.PI * 2 + f), i && _ > f && (_ = _ - Math.PI * 2), !i && f > _ && (f = f - Math.PI * 2);
|
|
157
|
+
}
|
|
158
|
+
var Z = f - _;
|
|
159
|
+
if (Math.abs(Z) > Math.PI * 120 / 180) {
|
|
160
|
+
var rt = f, st = e, ut = s;
|
|
161
|
+
i && f > _ ? f = _ + Math.PI * 120 / 180 * 1 : f = _ + Math.PI * 120 / 180 * -1, e = d + l * Math.cos(f), s = y + n * Math.sin(f), c = H(
|
|
162
|
+
e,
|
|
163
|
+
s,
|
|
164
|
+
st,
|
|
165
|
+
ut,
|
|
166
|
+
l,
|
|
167
|
+
n,
|
|
168
|
+
a,
|
|
169
|
+
0,
|
|
170
|
+
i,
|
|
171
|
+
[f, rt, d, y]
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
Z = f - _;
|
|
175
|
+
var it = Math.cos(_), nt = Math.sin(_), lt = Math.cos(f), vt = Math.sin(f), Q = Math.tan(Z / 4), X = 4 / 3 * l * Q, Y = 4 / 3 * n * Q, q = [u, t], C = [u + X * nt, t - Y * it], $ = [e + X * vt, s - Y * lt], F = [e, s];
|
|
176
|
+
if (C[0] = 2 * q[0] - C[0], C[1] = 2 * q[1] - C[1], r)
|
|
177
|
+
return [C, $, F].concat(c);
|
|
178
|
+
c = [C, $, F].concat(c);
|
|
179
|
+
for (var j = [], b = 0; b < c.length; b += 3) {
|
|
180
|
+
var l = h(c[b][0], c[b][1], o), n = h(c[b + 1][0], c[b + 1][1], o), B = h(c[b + 2][0], c[b + 2][1], o);
|
|
181
|
+
j.push([l.x, l.y, n.x, n.y, B.x, B.y]);
|
|
182
|
+
}
|
|
183
|
+
return j;
|
|
184
|
+
}, V = function(u) {
|
|
185
|
+
return u.map(function(t) {
|
|
186
|
+
return {
|
|
187
|
+
type: t.type,
|
|
188
|
+
values: Array.prototype.slice.call(t.values)
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
}, tt = function(u) {
|
|
192
|
+
var t = [], e = null, s = null, l = null, n = null;
|
|
193
|
+
return u.forEach(function(a) {
|
|
194
|
+
var p = a.type;
|
|
195
|
+
if (p === "M") {
|
|
196
|
+
var i = a.values[0], r = a.values[1];
|
|
197
|
+
t.push({ type: "M", values: [i, r] }), l = i, n = r, e = i, s = r;
|
|
198
|
+
} else if (p === "m") {
|
|
199
|
+
var i = e + a.values[0], r = s + a.values[1];
|
|
200
|
+
t.push({ type: "M", values: [i, r] }), l = i, n = r, e = i, s = r;
|
|
201
|
+
} else if (p === "L") {
|
|
202
|
+
var i = a.values[0], r = a.values[1];
|
|
203
|
+
t.push({ type: "L", values: [i, r] }), e = i, s = r;
|
|
204
|
+
} else if (p === "l") {
|
|
205
|
+
var i = e + a.values[0], r = s + a.values[1];
|
|
206
|
+
t.push({ type: "L", values: [i, r] }), e = i, s = r;
|
|
207
|
+
} else if (p === "C") {
|
|
208
|
+
var v = a.values[0], h = a.values[1], o = a.values[2], c = a.values[3], i = a.values[4], r = a.values[5];
|
|
209
|
+
t.push({
|
|
210
|
+
type: "C",
|
|
211
|
+
values: [v, h, o, c, i, r]
|
|
212
|
+
}), e = i, s = r;
|
|
213
|
+
} else if (p === "c") {
|
|
214
|
+
var v = e + a.values[0], h = s + a.values[1], o = e + a.values[2], c = s + a.values[3], i = e + a.values[4], r = s + a.values[5];
|
|
215
|
+
t.push({
|
|
216
|
+
type: "C",
|
|
217
|
+
values: [v, h, o, c, i, r]
|
|
218
|
+
}), e = i, s = r;
|
|
219
|
+
} else if (p === "Q") {
|
|
220
|
+
var v = a.values[0], h = a.values[1], i = a.values[2], r = a.values[3];
|
|
221
|
+
t.push({ type: "Q", values: [v, h, i, r] }), e = i, s = r;
|
|
222
|
+
} else if (p === "q") {
|
|
223
|
+
var v = e + a.values[0], h = s + a.values[1], i = e + a.values[2], r = s + a.values[3];
|
|
224
|
+
t.push({ type: "Q", values: [v, h, i, r] }), e = i, s = r;
|
|
225
|
+
} else if (p === "A") {
|
|
226
|
+
var i = a.values[5], r = a.values[6];
|
|
227
|
+
t.push({
|
|
228
|
+
type: "A",
|
|
229
|
+
values: [
|
|
230
|
+
a.values[0],
|
|
231
|
+
a.values[1],
|
|
232
|
+
a.values[2],
|
|
233
|
+
a.values[3],
|
|
234
|
+
a.values[4],
|
|
235
|
+
i,
|
|
236
|
+
r
|
|
237
|
+
]
|
|
238
|
+
}), e = i, s = r;
|
|
239
|
+
} else if (p === "a") {
|
|
240
|
+
var i = e + a.values[5], r = s + a.values[6];
|
|
241
|
+
t.push({
|
|
242
|
+
type: "A",
|
|
243
|
+
values: [
|
|
244
|
+
a.values[0],
|
|
245
|
+
a.values[1],
|
|
246
|
+
a.values[2],
|
|
247
|
+
a.values[3],
|
|
248
|
+
a.values[4],
|
|
249
|
+
i,
|
|
250
|
+
r
|
|
251
|
+
]
|
|
252
|
+
}), e = i, s = r;
|
|
253
|
+
} else if (p === "H") {
|
|
254
|
+
var i = a.values[0];
|
|
255
|
+
t.push({ type: "H", values: [i] }), e = i;
|
|
256
|
+
} else if (p === "h") {
|
|
257
|
+
var i = e + a.values[0];
|
|
258
|
+
t.push({ type: "H", values: [i] }), e = i;
|
|
259
|
+
} else if (p === "V") {
|
|
260
|
+
var r = a.values[0];
|
|
261
|
+
t.push({ type: "V", values: [r] }), s = r;
|
|
262
|
+
} else if (p === "v") {
|
|
263
|
+
var r = s + a.values[0];
|
|
264
|
+
t.push({ type: "V", values: [r] }), s = r;
|
|
265
|
+
} else if (p === "S") {
|
|
266
|
+
var o = a.values[0], c = a.values[1], i = a.values[2], r = a.values[3];
|
|
267
|
+
t.push({ type: "S", values: [o, c, i, r] }), e = i, s = r;
|
|
268
|
+
} else if (p === "s") {
|
|
269
|
+
var o = e + a.values[0], c = s + a.values[1], i = e + a.values[2], r = s + a.values[3];
|
|
270
|
+
t.push({ type: "S", values: [o, c, i, r] }), e = i, s = r;
|
|
271
|
+
} else if (p === "T") {
|
|
272
|
+
var i = a.values[0], r = a.values[1];
|
|
273
|
+
t.push({ type: "T", values: [i, r] }), e = i, s = r;
|
|
274
|
+
} else if (p === "t") {
|
|
275
|
+
var i = e + a.values[0], r = s + a.values[1];
|
|
276
|
+
t.push({ type: "T", values: [i, r] }), e = i, s = r;
|
|
277
|
+
} else
|
|
278
|
+
(p === "Z" || p === "z") && (t.push({ type: "Z", values: [] }), e = l, s = n);
|
|
279
|
+
}), t;
|
|
280
|
+
}, G = function(u) {
|
|
281
|
+
var t = [], e = null, s = null, l = null, n = null, a = null, p = null, i = null;
|
|
282
|
+
return u.forEach(function(r) {
|
|
283
|
+
if (r.type === "M") {
|
|
284
|
+
var v = r.values[0], h = r.values[1];
|
|
285
|
+
t.push({ type: "M", values: [v, h] }), p = v, i = h, n = v, a = h;
|
|
286
|
+
} else if (r.type === "C") {
|
|
287
|
+
var o = r.values[0], c = r.values[1], _ = r.values[2], f = r.values[3], v = r.values[4], h = r.values[5];
|
|
288
|
+
t.push({ type: "C", values: [o, c, _, f, v, h] }), s = _, l = f, n = v, a = h;
|
|
289
|
+
} else if (r.type === "L") {
|
|
290
|
+
var v = r.values[0], h = r.values[1];
|
|
291
|
+
t.push({ type: "L", values: [v, h] }), n = v, a = h;
|
|
292
|
+
} else if (r.type === "H") {
|
|
293
|
+
var v = r.values[0];
|
|
294
|
+
t.push({ type: "L", values: [v, a] }), n = v;
|
|
295
|
+
} else if (r.type === "V") {
|
|
296
|
+
var h = r.values[0];
|
|
297
|
+
t.push({ type: "L", values: [n, h] }), a = h;
|
|
298
|
+
} else if (r.type === "S") {
|
|
299
|
+
var _ = r.values[0], f = r.values[1], v = r.values[2], h = r.values[3], d, y;
|
|
300
|
+
e === "C" || e === "S" ? (d = n + (n - s), y = a + (a - l)) : (d = n, y = a), t.push({ type: "C", values: [d, y, _, f, v, h] }), s = _, l = f, n = v, a = h;
|
|
301
|
+
} else if (r.type === "T") {
|
|
302
|
+
var v = r.values[0], h = r.values[1], o, c;
|
|
303
|
+
e === "Q" || e === "T" ? (o = n + (n - s), c = a + (a - l)) : (o = n, c = a);
|
|
304
|
+
var d = n + 2 * (o - n) / 3, y = a + 2 * (c - a) / 3, A = v + 2 * (o - v) / 3, P = h + 2 * (c - h) / 3;
|
|
305
|
+
t.push({
|
|
306
|
+
type: "C",
|
|
307
|
+
values: [d, y, A, P, v, h]
|
|
308
|
+
}), s = o, l = c, n = v, a = h;
|
|
309
|
+
} else if (r.type === "Q") {
|
|
310
|
+
var o = r.values[0], c = r.values[1], v = r.values[2], h = r.values[3], d = n + 2 * (o - n) / 3, y = a + 2 * (c - a) / 3, A = v + 2 * (o - v) / 3, P = h + 2 * (c - h) / 3;
|
|
311
|
+
t.push({
|
|
312
|
+
type: "C",
|
|
313
|
+
values: [d, y, A, P, v, h]
|
|
314
|
+
}), s = o, l = c, n = v, a = h;
|
|
315
|
+
} else if (r.type === "A") {
|
|
316
|
+
var m = Math.abs(r.values[0]), I = Math.abs(r.values[1]), M = r.values[2], D = r.values[3], E = r.values[4], v = r.values[5], h = r.values[6];
|
|
317
|
+
if (m === 0 || I === 0)
|
|
318
|
+
t.push({
|
|
319
|
+
type: "C",
|
|
320
|
+
values: [n, a, v, h, v, h]
|
|
321
|
+
}), n = v, a = h;
|
|
322
|
+
else if (n !== v || a !== h) {
|
|
323
|
+
var N = H(
|
|
324
|
+
n,
|
|
325
|
+
a,
|
|
326
|
+
v,
|
|
327
|
+
h,
|
|
328
|
+
m,
|
|
329
|
+
I,
|
|
330
|
+
M,
|
|
331
|
+
D,
|
|
332
|
+
E
|
|
333
|
+
);
|
|
334
|
+
N.forEach(function(O) {
|
|
335
|
+
t.push({ type: "C", values: O });
|
|
336
|
+
}), n = v, a = h;
|
|
337
|
+
}
|
|
338
|
+
} else
|
|
339
|
+
r.type === "Z" && (t.push(r), n = p, a = i);
|
|
340
|
+
e = r.type;
|
|
341
|
+
}), t;
|
|
342
|
+
};
|
|
343
|
+
SVGPathElement.prototype.setAttribute = function(u, t) {
|
|
344
|
+
u === "d" && (this[x] = null, this[S] = null), W.call(this, u, t);
|
|
345
|
+
}, SVGPathElement.prototype.setAttributeNS = function(u, t, e) {
|
|
346
|
+
if (t === "d") {
|
|
347
|
+
var s = "http://www.w3.org/2000/svg";
|
|
348
|
+
if (u)
|
|
349
|
+
for (var l of this.ownerSVGElement.attributes)
|
|
350
|
+
l.name === `xmlns:${u}` && (s = l.value);
|
|
351
|
+
s === "http://www.w3.org/2000/svg" && (this[x] = null, this[S] = null);
|
|
352
|
+
}
|
|
353
|
+
U.call(this, u, t, e);
|
|
354
|
+
}, SVGPathElement.prototype.removeAttribute = function(u, t) {
|
|
355
|
+
u === "d" && (this[x] = null, this[S] = null), R.call(this, u);
|
|
356
|
+
}, SVGPathElement.prototype.removeAttributeNS = function(u, t) {
|
|
357
|
+
if (t === "d") {
|
|
358
|
+
var e = "http://www.w3.org/2000/svg";
|
|
359
|
+
if (u)
|
|
360
|
+
for (var s of this.ownerSVGElement.attributes)
|
|
361
|
+
s.name === `xmlns:${u}` && (e = s.value);
|
|
362
|
+
e === "http://www.w3.org/2000/svg" && (this[x] = null, this[S] = null);
|
|
363
|
+
}
|
|
364
|
+
g.call(this, u, t);
|
|
365
|
+
}, SVGPathElement.prototype.getPathData = function(u) {
|
|
366
|
+
if (u && u.normalize) {
|
|
367
|
+
if (this[S])
|
|
368
|
+
return V(this[S]);
|
|
369
|
+
var t;
|
|
370
|
+
this[x] ? t = V(this[x]) : (t = z(this.getAttribute("d") || ""), this[x] = V(t));
|
|
371
|
+
var e = G(tt(t));
|
|
372
|
+
return this[S] = V(e), e;
|
|
373
|
+
} else {
|
|
374
|
+
if (this[x])
|
|
375
|
+
return V(this[x]);
|
|
376
|
+
var t = z(this.getAttribute("d") || "");
|
|
377
|
+
return this[x] = V(t), t;
|
|
378
|
+
}
|
|
379
|
+
}, SVGPathElement.prototype.setPathData = function(u) {
|
|
380
|
+
if (u.length === 0)
|
|
381
|
+
K ? this.setAttribute("d", "") : this.removeAttribute("d");
|
|
382
|
+
else {
|
|
383
|
+
for (var t = "", e = 0, s = u.length; e < s; e += 1) {
|
|
384
|
+
var l = u[e];
|
|
385
|
+
e > 0 && (t += " "), t += l.type, l.values && l.values.length > 0 && (t += " " + l.values.join(" "));
|
|
386
|
+
}
|
|
387
|
+
this.setAttribute("d", t);
|
|
388
|
+
}
|
|
389
|
+
}, SVGRectElement.prototype.getPathData = function(u) {
|
|
390
|
+
var t = this.x.baseVal.value, e = this.y.baseVal.value, s = this.width.baseVal.value, l = this.height.baseVal.value, n = this.hasAttribute("rx") ? this.rx.baseVal.value : this.ry.baseVal.value, a = this.hasAttribute("ry") ? this.ry.baseVal.value : this.rx.baseVal.value;
|
|
391
|
+
n > s / 2 && (n = s / 2), a > l / 2 && (a = l / 2);
|
|
392
|
+
var p = [
|
|
393
|
+
{ type: "M", values: [t + n, e] },
|
|
394
|
+
{ type: "H", values: [t + s - n] },
|
|
395
|
+
{ type: "A", values: [n, a, 0, 0, 1, t + s, e + a] },
|
|
396
|
+
{ type: "V", values: [e + l - a] },
|
|
397
|
+
{ type: "A", values: [n, a, 0, 0, 1, t + s - n, e + l] },
|
|
398
|
+
{ type: "H", values: [t + n] },
|
|
399
|
+
{ type: "A", values: [n, a, 0, 0, 1, t, e + l - a] },
|
|
400
|
+
{ type: "V", values: [e + a] },
|
|
401
|
+
{ type: "A", values: [n, a, 0, 0, 1, t + n, e] },
|
|
402
|
+
{ type: "Z", values: [] }
|
|
403
|
+
];
|
|
404
|
+
return p = p.filter(function(i) {
|
|
405
|
+
return !(i.type === "A" && (i.values[0] === 0 || i.values[1] === 0));
|
|
406
|
+
}), u && u.normalize === !0 && (p = G(p)), p;
|
|
407
|
+
}, SVGCircleElement.prototype.getPathData = function(u) {
|
|
408
|
+
var t = this.cx.baseVal.value, e = this.cy.baseVal.value, s = this.r.baseVal.value, l = [
|
|
409
|
+
{ type: "M", values: [t + s, e] },
|
|
410
|
+
{ type: "A", values: [s, s, 0, 0, 1, t, e + s] },
|
|
411
|
+
{ type: "A", values: [s, s, 0, 0, 1, t - s, e] },
|
|
412
|
+
{ type: "A", values: [s, s, 0, 0, 1, t, e - s] },
|
|
413
|
+
{ type: "A", values: [s, s, 0, 0, 1, t + s, e] },
|
|
414
|
+
{ type: "Z", values: [] }
|
|
415
|
+
];
|
|
416
|
+
return u && u.normalize === !0 && (l = G(l)), l;
|
|
417
|
+
}, SVGEllipseElement.prototype.getPathData = function(u) {
|
|
418
|
+
var t = this.cx.baseVal.value, e = this.cy.baseVal.value, s = this.rx.baseVal.value, l = this.ry.baseVal.value, n = [
|
|
419
|
+
{ type: "M", values: [t + s, e] },
|
|
420
|
+
{ type: "A", values: [s, l, 0, 0, 1, t, e + l] },
|
|
421
|
+
{ type: "A", values: [s, l, 0, 0, 1, t - s, e] },
|
|
422
|
+
{ type: "A", values: [s, l, 0, 0, 1, t, e - l] },
|
|
423
|
+
{ type: "A", values: [s, l, 0, 0, 1, t + s, e] },
|
|
424
|
+
{ type: "Z", values: [] }
|
|
425
|
+
];
|
|
426
|
+
return u && u.normalize === !0 && (n = G(n)), n;
|
|
427
|
+
}, SVGLineElement.prototype.getPathData = function() {
|
|
428
|
+
return [
|
|
429
|
+
{ type: "M", values: [this.x1.baseVal.value, this.y1.baseVal.value] },
|
|
430
|
+
{ type: "L", values: [this.x2.baseVal.value, this.y2.baseVal.value] }
|
|
431
|
+
];
|
|
432
|
+
}, SVGPolylineElement.prototype.getPathData = function() {
|
|
433
|
+
for (var u = [], t = 0; t < this.points.numberOfItems; t += 1) {
|
|
434
|
+
var e = this.points.getItem(t);
|
|
435
|
+
u.push({
|
|
436
|
+
type: t === 0 ? "M" : "L",
|
|
437
|
+
values: [e.x, e.y]
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
return u;
|
|
441
|
+
}, SVGPolygonElement.prototype.getPathData = function() {
|
|
442
|
+
for (var u = [], t = 0; t < this.points.numberOfItems; t += 1) {
|
|
443
|
+
var e = this.points.getItem(t);
|
|
444
|
+
u.push({
|
|
445
|
+
type: t === 0 ? "M" : "L",
|
|
446
|
+
values: [e.x, e.y]
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
return u.push({
|
|
450
|
+
type: "Z",
|
|
451
|
+
values: []
|
|
452
|
+
}), u;
|
|
453
|
+
};
|
|
454
|
+
}();
|
package/lib/popover/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../attribute/index.cjs"),S=require("../custom-element/index.cjs"),A=require("../Store-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../attribute/index.cjs"),S=require("../custom-element/index.cjs"),A=require("../Store-BQGNOHlY.cjs"),b=require("../style-At6aDoqG.cjs");require("../path-data-polyfill-CXsOR7Oc.cjs");const x=require("../browser-CpzFX2xg.cjs"),k=require("../tags-CueX-JLX.cjs"),B=require("../createStylesheet-C8aQQ4hd.cjs");var D=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=(t,e,s,i)=>{for(var n=i>1?void 0:i?I(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&D(e,s,n),n},C=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},r=(t,e,s)=>(C(t,e,"read from private field"),s?s.call(t):e.get(t)),o=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},L=(t,e,s,i)=>(C(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),$=(t,e,s)=>(C(t,e,"access private method"),s),P,a,E,h,u,_,M,O,v,m,w,y,g,W,f;exports.PopoverElement=class extends S.CustomElement{constructor(){super(...arguments),o(this,M),o(this,v),o(this,g),o(this,P,-1),o(this,a,new A.Store(!1)),o(this,E,void 0),o(this,h,new T.Attribute(this,"history",!1)),o(this,u,new T.Attribute(this,"single",!1)),o(this,_,!1),this.open=()=>{r(this,a).current||(r(this,a).current=!0,r(this,u).current&&(exports.PopoverElement.__opened.forEach(e=>e.close()),exports.PopoverElement.__opened=[]),exports.PopoverElement.__opened.push(this),L(this,P,exports.PopoverElement.__opened.length-1),r(this,h).current&&r(this,_)&&history.pushState("","",r(this,M,O)),clearTimeout(r(this,E)),this.classList.add("triggered"),this.style.display="block",setTimeout(()=>{addEventListener("click",r(this,w)),addEventListener("keydown",r(this,y)),this.style.opacity="1",this.classList.add("opened")}))},this.close=()=>{if(r(this,a).current){if(r(this,a).current=!1,exports.PopoverElement.__opened=exports.PopoverElement.__opened.filter(e=>e!==this),r(this,h).current){const e=new URL(location.href);e.searchParams.delete(r(this,v,m)),history.replaceState(null,"",e.href)}this.classList.remove("opened"),this.style.opacity="0",removeEventListener("click",r(this,w)),removeEventListener("keydown",r(this,y)),setTimeout(()=>{this.classList.remove("triggered"),this.style.display="none"},b.getElementTransitionDurationMS(this))}},o(this,w,e=>{$(this,g,W).call(this,()=>{const s=e.composedPath();(!s.find(i=>i===this)&&!s.find(i=>i instanceof HTMLElement&&i.closest("e-popover-button"))||s[0]instanceof HTMLElement&&s[0].hasAttribute("outside"))&&this.close()})}),o(this,y,e=>{$(this,g,W).call(this,()=>{e.code==="Escape"&&this.close()})}),o(this,f,()=>{L(this,_,!1),r(this,a).current&&r(this,h).current&&!location.search.includes(r(this,v,m))?this.close():!r(this,a).current&&r(this,h).current&&location.search.includes(r(this,v,m))&&this.open(),L(this,_,!0)})}get history(){return r(this,h)}get single(){return r(this,u)}get opened(){return r(this,a)}connectedCallback(){r(this,h).observe(),r(this,u).observe(),this.style.opacity="0",this.style.display="none",addEventListener("popstate",r(this,f)),setTimeout(()=>{r(this,f).call(this)},0)}disconnectedCallback(){r(this,h).unobserve(),r(this,u).unobserve(),clearTimeout(r(this,E)),removeEventListener("popstate",r(this,f))}};P=new WeakMap;a=new WeakMap;E=new WeakMap;h=new WeakMap;u=new WeakMap;_=new WeakMap;M=new WeakSet;O=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${r(this,v,m)}`};v=new WeakSet;m=function(){return`modal-${this.id}`};w=new WeakMap;y=new WeakMap;g=new WeakSet;W=function(t){(exports.PopoverElement.__opened[r(this,P)-1]||exports.PopoverElement.__opened.length===1)&&t()};f=new WeakMap;exports.PopoverElement.__opened=[];exports.PopoverElement=N([S.define("e-popover")],exports.PopoverElement);var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,R=(t,e,s,i)=>{for(var n=i>1?void 0:i?H(e,s):e,c=t.length-1,p;c>=0;c--)(p=t[c])&&(n=(i?p(e,s,n):p(n))||n);return i&&n&&G(e,s,n),n},q=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},d=(t,e,s)=>(q(t,e,"read from private field"),s?s.call(t):e.get(t)),U=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},z=(t,e,s,i)=>(q(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),l;const F=B.createStylesheet({button:{all:"inherit"}});exports.PopoverButtonElement=class extends S.CustomElement{constructor(){super(),U(this,l,void 0),this.openShadow(F),x.isBrowser&&k.element(this,{children:[k.button({onClick:()=>{if(d(this,l)){const e=this.getAttribute("type")||"open";e==="open"||e==="toggle"&&!d(this,l).opened.current?d(this,l).open():(e==="close"||e==="toggle"&&d(this,l).opened.current)&&d(this,l).close()}},children:[k.slot()]})]})}get popoverElement(){return d(this,l)}connectedCallback(){const e=this.getAttribute("target");if(e){const s=document.querySelector(`#${e}`)||this.getRootNode().querySelector(`#${e}`);s?z(this,l,s):console.warn(this,`target ${e} not found`)}}};l=new WeakMap;exports.PopoverButtonElement=R([S.define("e-popover-button")],exports.PopoverButtonElement);
|