@mantou/gem 1.6.4 → 1.6.10
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/README.md +6 -38
- package/dist/gem.es.js +3260 -0
- package/dist/gem.umd.js +229 -0
- package/elements/{dialog-base.d.ts → base/dialog.d.ts} +4 -4
- package/elements/base/dialog.d.ts.map +1 -0
- package/elements/{dialog-base.js → base/dialog.js} +26 -28
- package/elements/base/dialog.js.map +1 -0
- package/elements/base/gesture.d.ts +66 -0
- package/elements/base/gesture.d.ts.map +1 -0
- package/elements/base/gesture.js +214 -0
- package/elements/base/gesture.js.map +1 -0
- package/elements/base/link.d.ts +44 -0
- package/elements/base/link.d.ts.map +1 -0
- package/elements/base/link.js +206 -0
- package/elements/base/link.js.map +1 -0
- package/elements/{modal-base.d.ts → base/modal-factory.d.ts} +20 -20
- package/elements/base/modal-factory.d.ts.map +1 -0
- package/elements/{modal-base.js → base/modal-factory.js} +10 -7
- package/elements/base/modal-factory.js.map +1 -0
- package/elements/base/reflect.d.ts +6 -0
- package/elements/base/reflect.d.ts.map +1 -0
- package/elements/base/reflect.js +33 -0
- package/elements/base/reflect.js.map +1 -0
- package/elements/base/route.d.ts +78 -0
- package/elements/base/route.d.ts.map +1 -0
- package/elements/base/route.js +220 -0
- package/elements/base/route.js.map +1 -0
- package/elements/base/title.d.ts +30 -0
- package/elements/base/title.d.ts.map +1 -0
- package/elements/base/title.js +74 -0
- package/elements/base/title.js.map +1 -0
- package/elements/base/unsafe.d.ts +14 -0
- package/elements/base/unsafe.d.ts.map +1 -0
- package/elements/base/unsafe.js +42 -0
- package/elements/base/unsafe.js.map +1 -0
- package/elements/base/use.d.ts +19 -0
- package/elements/base/use.d.ts.map +1 -0
- package/elements/base/use.js +70 -0
- package/elements/base/use.js.map +1 -0
- package/elements/gesture.d.ts +1 -67
- package/elements/gesture.d.ts.map +1 -1
- package/elements/gesture.js +3 -219
- package/elements/gesture.js.map +1 -1
- package/elements/link.d.ts +1 -45
- package/elements/link.d.ts.map +1 -1
- package/elements/link.js +4 -215
- package/elements/link.js.map +1 -1
- package/elements/reflect.d.ts +1 -8
- package/elements/reflect.d.ts.map +1 -1
- package/elements/reflect.js +3 -39
- package/elements/reflect.js.map +1 -1
- package/elements/route.d.ts +1 -81
- package/elements/route.d.ts.map +1 -1
- package/elements/route.js +4 -225
- package/elements/route.js.map +1 -1
- package/elements/title.d.ts +1 -30
- package/elements/title.d.ts.map +1 -1
- package/elements/title.js +3 -75
- package/elements/title.js.map +1 -1
- package/elements/unsafe.d.ts +1 -14
- package/elements/unsafe.d.ts.map +1 -1
- package/elements/unsafe.js +3 -46
- package/elements/unsafe.js.map +1 -1
- package/elements/use.d.ts +1 -19
- package/elements/use.d.ts.map +1 -1
- package/elements/use.js +3 -74
- package/elements/use.js.map +1 -1
- package/helper/i18n.js +47 -58
- package/helper/i18n.js.map +1 -1
- package/helper/request.js +11 -19
- package/helper/request.js.map +1 -1
- package/index.d.ts +5 -4
- package/index.d.ts.map +1 -1
- package/index.js +4 -2
- package/index.js.map +1 -1
- package/lib/element.d.ts.map +1 -1
- package/lib/element.js +1 -1
- package/lib/element.js.map +1 -1
- package/lib/history.d.ts +28 -16
- package/lib/history.d.ts.map +1 -1
- package/lib/history.js +179 -169
- package/lib/history.js.map +1 -1
- package/lib/utils.d.ts +3 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +7 -5
- package/lib/utils.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +25 -53
- package/src/{umd.ts → dist.ts} +4 -5
- package/src/elements/{dialog-base.ts → base/dialog.ts} +6 -7
- package/src/elements/base/gesture.ts +256 -0
- package/src/elements/base/link.ts +178 -0
- package/src/elements/{modal-base.ts → base/modal-factory.ts} +3 -3
- package/src/elements/base/reflect.ts +29 -0
- package/src/elements/base/route.ts +244 -0
- package/src/elements/base/title.ts +68 -0
- package/src/elements/base/unsafe.ts +37 -0
- package/src/elements/base/use.ts +57 -0
- package/src/elements/gesture.ts +3 -257
- package/src/elements/link.ts +4 -179
- package/src/elements/reflect.ts +3 -31
- package/src/elements/route.ts +4 -248
- package/src/elements/title.ts +3 -68
- package/src/elements/unsafe.ts +3 -37
- package/src/elements/use.ts +3 -57
- package/src/index.ts +4 -6
- package/src/lib/element.ts +2 -1
- package/src/lib/history.ts +183 -195
- package/src/lib/utils.ts +11 -5
- package/src/lib/version.ts +1 -1
- package/src/test/gem-element/advance.test.ts +1 -0
- package/src/test/gem-element/basic.test.ts +1 -0
- package/src/test/gem-element/decorators.test.ts +1 -0
- package/src/test/gem-element/multi.test.ts +1 -0
- package/src/test/history.test.ts +16 -10
- package/src/test/store.test.ts +1 -0
- package/src/test/utils.test.ts +1 -0
- package/elements/dialog-base.d.ts.map +0 -1
- package/elements/dialog-base.js.map +0 -1
- package/elements/modal-base.d.ts.map +0 -1
- package/elements/modal-base.js.map +0 -1
- package/src/examples/base-path/index.ts +0 -44
- package/src/examples/controlled/index.ts +0 -75
- package/src/examples/decorator/chidren.ts +0 -77
- package/src/examples/decorator/index.ts +0 -110
- package/src/examples/dialog/index.ts +0 -148
- package/src/examples/effect/index.ts +0 -45
- package/src/examples/elements/env.ts +0 -7
- package/src/examples/elements/layout.ts +0 -53
- package/src/examples/elements/nav.ts +0 -71
- package/src/examples/elements/source.ts +0 -68
- package/src/examples/gesture/canvas.ts +0 -69
- package/src/examples/gesture/index.ts +0 -97
- package/src/examples/gesture/manifest.json +0 -3
- package/src/examples/hash/index.ts +0 -55
- package/src/examples/i18n/index.ts +0 -63
- package/src/examples/index/index.ts +0 -33
- package/src/examples/index/manifest.json +0 -5
- package/src/examples/light-dom/index.ts +0 -31
- package/src/examples/multi-page/api.ts +0 -9
- package/src/examples/multi-page/index.ts +0 -78
- package/src/examples/multi-page/page-a.ts +0 -16
- package/src/examples/multi-page/page-b.ts +0 -12
- package/src/examples/multi-page/page-c.ts +0 -40
- package/src/examples/multi-page/store.ts +0 -10
- package/src/examples/perf-demo/index.ts +0 -136
- package/src/examples/ref-route/index.ts +0 -109
- package/src/examples/reflect/index.ts +0 -61
- package/src/examples/styled/index.ts +0 -39
- package/src/examples/svg-icon/index.ts +0 -31
- package/src/examples/theme/index.ts +0 -56
- package/src/examples/unsafe/index.ts +0 -29
- package/umd.d.ts +0 -18
- package/umd.d.ts.map +0 -1
- package/umd.js +0 -54
- package/umd.js.LICENSE.txt +0 -13
- package/umd.js.map +0 -1
package/dist/gem.umd.js
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
var ii=Object.defineProperty,ri=Object.defineProperties;var ai=Object.getOwnPropertyDescriptors;var ls=Object.getOwnPropertySymbols;var oi=Object.prototype.hasOwnProperty,ci=Object.prototype.propertyIsEnumerable;var hs=(a,f,y)=>f in a?ii(a,f,{enumerable:!0,configurable:!0,writable:!0,value:y}):a[f]=y,T=(a,f)=>{for(var y in f||(f={}))oi.call(f,y)&&hs(a,y,f[y]);if(ls)for(var y of ls(f))ci.call(f,y)&&hs(a,y,f[y]);return a},je=(a,f)=>ri(a,ai(f));var Zt=(a,f,y)=>{if(!f.has(a))throw TypeError("Cannot "+y)};var g=(a,f,y)=>(Zt(a,f,"read from private field"),y?y.call(a):f.get(a)),N=(a,f,y)=>{if(f.has(a))throw TypeError("Cannot add the same private member more than once");f instanceof WeakSet?f.add(a):f.set(a,y)},G=(a,f,y,J)=>(Zt(a,f,"write to private field"),J?J.call(a,y):f.set(a,y),y);var dt=(a,f,y)=>(Zt(a,f,"access private method"),y);(function(a,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(a=typeof globalThis!="undefined"?globalThis:a||self,f(a.Gem={}))})(this,function(a){var ee,te,le,Ee,Xt,Se,lt,_e,ve,he,cs,be,en,ht,li,ut,hi,ue,ft,Pe,tn;"use strict";var f=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",get StoreListenerMap(){return ne},get createStore(){return z},get createStoreSet(){return Pn},get updateStore(){return P},get connect(){return se},get disconnect(){return Tt},get history(){return S},get titleStore(){return oe},get basePathStore(){return xt},get html(){return M},get svg(){return gn},get render(){return qe},get directive(){return J},get TemplateResult(){return ke},get SVGTemplateResult(){return gt},get repeat(){return $n},get guard(){return Nn},get ifDefined(){return Mt},get GemElement(){return A},get defineAttribute(){return Xe},get defineProperty(){return ye},get defineRef(){return et},get defineCSSState(){return tt},get nativeDefineElement(){return nt},get refobject(){return An},get attribute(){return k},get boolattribute(){return Gn},get numattribute(){return Hn},get property(){return q},get state(){return Ae},get slot(){return In},get part(){return Dt},get emitter(){return Ge},get globalemitter(){return Vn},get adoptedStyle(){return Dn},get connectStore(){return ae},get rootElement(){return jn},get customElement(){return qn},get addMicrotask(){return H},get addMicrotaskToStack(){return yn},get absoluteLocation(){return xe},get LinkedList(){return St},get PropProxyMap(){return _t},get QueryString(){return fe},get raw(){return me},get css(){return wn},get SheetToken(){return Ue},get useNativeCSSStyleSheet(){return a.useNativeCSSStyleSheet},get createCSSSheet(){return En},get randomStr(){return Ne},get styled(){return _n},get camelToKebabCase(){return I},get kebabToCamelCase(){return pe},get cleanObject(){return Me},get GemError(){return K},get isArrayChange(){return bt},get removeItems(){return Pt},get styleMap(){return vn},get classMap(){return Ct},get partMap(){return bn},get version(){return os}});/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
4
|
+
* This code may only be used under the BSD style license found at
|
|
5
|
+
* http://polymer.github.io/LICENSE.txt
|
|
6
|
+
* The complete set of authors may be found at
|
|
7
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
8
|
+
* The complete set of contributors may be found at
|
|
9
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
10
|
+
* Code distributed by Google as part of the polymer project is also
|
|
11
|
+
* subject to an additional IP rights grant found at
|
|
12
|
+
* http://polymer.github.io/PATENTS.txt
|
|
13
|
+
*/const y=new WeakMap,J=n=>(...e)=>{const t=n(...e);return y.set(t,!0),t},Ce=n=>typeof n=="function"&&y.has(n);/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
16
|
+
* This code may only be used under the BSD style license found at
|
|
17
|
+
* http://polymer.github.io/LICENSE.txt
|
|
18
|
+
* The complete set of authors may be found at
|
|
19
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
20
|
+
* The complete set of contributors may be found at
|
|
21
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
22
|
+
* Code distributed by Google as part of the polymer project is also
|
|
23
|
+
* subject to an additional IP rights grant found at
|
|
24
|
+
* http://polymer.github.io/PATENTS.txt
|
|
25
|
+
*/const nn=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,sn=(n,e,t=null,s=null)=>{for(;e!==t;){const i=e.nextSibling;n.insertBefore(e,s),e=i}},mt=(n,e,t=null)=>{for(;e!==t;){const s=e.nextSibling;n.removeChild(e),e=s}};/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
|
28
|
+
* This code may only be used under the BSD style license found at
|
|
29
|
+
* http://polymer.github.io/LICENSE.txt
|
|
30
|
+
* The complete set of authors may be found at
|
|
31
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
32
|
+
* The complete set of contributors may be found at
|
|
33
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
34
|
+
* Code distributed by Google as part of the polymer project is also
|
|
35
|
+
* subject to an additional IP rights grant found at
|
|
36
|
+
* http://polymer.github.io/PATENTS.txt
|
|
37
|
+
*/const D={},rn={};/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
40
|
+
* This code may only be used under the BSD style license found at
|
|
41
|
+
* http://polymer.github.io/LICENSE.txt
|
|
42
|
+
* The complete set of authors may be found at
|
|
43
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
44
|
+
* The complete set of contributors may be found at
|
|
45
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
46
|
+
* Code distributed by Google as part of the polymer project is also
|
|
47
|
+
* subject to an additional IP rights grant found at
|
|
48
|
+
* http://polymer.github.io/PATENTS.txt
|
|
49
|
+
*/const Q=`{{lit-${String(Math.random()).slice(2)}}}`,an=`<!--${Q}-->`,on=new RegExp(`${Q}|${an}`),Te="$lit$";class us{constructor(e,t){this.parts=[],this.element=t;const s=[],i=[],r=document.createTreeWalker(t.content,133,null,!1);let o=0,c=-1,l=0;const{strings:h,values:{length:m}}=e;for(;l<m;){const u=r.nextNode();if(u===null){r.currentNode=i.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){const $=u.attributes,{length:w}=$;let E=0;for(let p=0;p<w;p++)cn($[p].name,Te)&&E++;for(;E-- >0;){const p=h[l],_=pt.exec(p)[2],b=_.toLowerCase()+Te,U=u.getAttribute(b);u.removeAttribute(b);const W=U.split(on);this.parts.push({type:"attribute",index:c,name:_,strings:W}),l+=W.length-1}}u.tagName==="TEMPLATE"&&(i.push(u),r.currentNode=u.content)}else if(u.nodeType===3){const $=u.data;if($.indexOf(Q)>=0){const w=u.parentNode,E=$.split(on),p=E.length-1;for(let _=0;_<p;_++){let b,U=E[_];if(U==="")b=B();else{const W=pt.exec(U);W!==null&&cn(W[2],Te)&&(U=U.slice(0,W.index)+W[1]+W[2].slice(0,-Te.length)+W[3]),b=document.createTextNode(U)}w.insertBefore(b,u),this.parts.push({type:"node",index:++c})}E[p]===""?(w.insertBefore(B(),u),s.push(u)):u.data=E[p],l+=p}}else if(u.nodeType===8)if(u.data===Q){const $=u.parentNode;(u.previousSibling===null||c===o)&&(c++,$.insertBefore(B(),u)),o=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(s.push(u),c--),l++}else{let $=-1;for(;($=u.data.indexOf(Q,$+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(const u of s)u.parentNode.removeChild(u)}}const cn=(n,e)=>{const t=n.length-e.length;return t>=0&&n.slice(t)===e},ds=n=>n.index!==-1,B=()=>document.createComment(""),pt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;/**
|
|
50
|
+
* @license
|
|
51
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
52
|
+
* This code may only be used under the BSD style license found at
|
|
53
|
+
* http://polymer.github.io/LICENSE.txt
|
|
54
|
+
* The complete set of authors may be found at
|
|
55
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
56
|
+
* The complete set of contributors may be found at
|
|
57
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
58
|
+
* Code distributed by Google as part of the polymer project is also
|
|
59
|
+
* subject to an additional IP rights grant found at
|
|
60
|
+
* http://polymer.github.io/PATENTS.txt
|
|
61
|
+
*/class ln{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this.options=s}update(e){let t=0;for(const s of this.__parts)s!==void 0&&s.setValue(e[t]),t++;for(const s of this.__parts)s!==void 0&&s.commit()}_clone(){const e=nn?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],s=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let r=0,o=0,c,l=i.nextNode();for(;r<s.length;){if(c=s[r],!ds(c)){this.__parts.push(void 0),r++;continue}for(;o<c.index;)o++,l.nodeName==="TEMPLATE"&&(t.push(l),i.currentNode=l.content),(l=i.nextNode())===null&&(i.currentNode=t.pop(),l=i.nextNode());if(c.type==="node"){const h=this.processor.handleTextExpression(this.options);h.insertAfterNode(l.previousSibling),this.__parts.push(h)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));r++}return nn&&(document.adoptNode(e),customElements.upgrade(e)),e}}/**
|
|
62
|
+
* @license
|
|
63
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
64
|
+
* This code may only be used under the BSD style license found at
|
|
65
|
+
* http://polymer.github.io/LICENSE.txt
|
|
66
|
+
* The complete set of authors may be found at
|
|
67
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
68
|
+
* The complete set of contributors may be found at
|
|
69
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
70
|
+
* Code distributed by Google as part of the polymer project is also
|
|
71
|
+
* subject to an additional IP rights grant found at
|
|
72
|
+
* http://polymer.github.io/PATENTS.txt
|
|
73
|
+
*/const hn=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:n=>n}),fs=` ${Q} `;class ke{constructor(e,t,s,i){this.strings=e,this.values=t,this.type=s,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",s=!1;for(let i=0;i<e;i++){const r=this.strings[i],o=r.lastIndexOf("<!--");s=(o>-1||s)&&r.indexOf("-->",o+1)===-1;const c=pt.exec(r);c===null?t+=r+(s?fs:an):t+=r.substr(0,c.index)+c[1]+c[2]+Te+c[3]+Q}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return hn!==void 0&&(t=hn.createHTML(t)),e.innerHTML=t,e}}class gt extends ke{getHTML(){return`<svg>${super.getHTML()}</svg>`}getTemplateElement(){const e=super.getTemplateElement(),t=e.content,s=t.firstChild;return t.removeChild(s),sn(t,s.firstChild),e}}/**
|
|
74
|
+
* @license
|
|
75
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
76
|
+
* This code may only be used under the BSD style license found at
|
|
77
|
+
* http://polymer.github.io/LICENSE.txt
|
|
78
|
+
* The complete set of authors may be found at
|
|
79
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
80
|
+
* The complete set of contributors may be found at
|
|
81
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
82
|
+
* Code distributed by Google as part of the polymer project is also
|
|
83
|
+
* subject to an additional IP rights grant found at
|
|
84
|
+
* http://polymer.github.io/PATENTS.txt
|
|
85
|
+
*/const yt=n=>n===null||!(typeof n=="object"||typeof n=="function"),wt=n=>Array.isArray(n)||!!(n&&n[Symbol.iterator]);class un{constructor(e,t,s){this.dirty=!0,this.element=e,this.name=t,this.strings=s,this.parts=[];for(let i=0;i<s.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new Et(this)}_getValue(){const e=this.strings,t=e.length-1,s=this.parts;if(t===1&&e[0]===""&&e[1]===""){const r=s[0].value;if(typeof r=="symbol")return String(r);if(typeof r=="string"||!wt(r))return r}let i="";for(let r=0;r<t;r++){i+=e[r];const o=s[r];if(o!==void 0){const c=o.value;if(yt(c)||!wt(c))i+=typeof c=="string"?c:String(c);else for(const l of c)i+=typeof l=="string"?l:String(l)}}return i+=e[t],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class Et{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==D&&(!yt(e)||e!==this.value)&&(this.value=e,Ce(e)||(this.committer.dirty=!0))}commit(){for(;Ce(this.value);){const e=this.value;this.value=D,e(this)}this.value!==D&&this.committer.commit()}}class de{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(B()),this.endNode=e.appendChild(B())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=B()),e.__insert(this.endNode=B())}insertAfterPart(e){e.__insert(this.startNode=B()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ce(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=D,t(this)}const e=this.__pendingValue;e!==D&&(yt(e)?e!==this.value&&this.__commitText(e):e instanceof ke?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):wt(e)?this.__commitIterable(e):e===rn?(this.value=rn,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling;e=e==null?"":e;const s=typeof e=="string"?e:String(e);t===this.endNode.previousSibling&&t.nodeType===3?t.data=s:this.__commitNode(document.createTextNode(s)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof ln&&this.value.template===t)this.value.update(e.values);else{const s=new ln(t,e.processor,this.options),i=s._clone();s.update(e.values),this.__commitNode(i),this.value=s}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let s=0,i;for(const r of e)i=t[s],i===void 0&&(i=new de(this.options),t.push(i),s===0?i.appendIntoPart(this):i.insertAfterPart(t[s-1])),i.setValue(r),i.commit(),s++;s<t.length&&(t.length=s,this.clear(i&&i.endNode))}clear(e=this.startNode){mt(this.startNode.parentNode,e.nextSibling,this.endNode)}}class ms{constructor(e,t,s){if(this.value=void 0,this.__pendingValue=void 0,s.length!==2||s[0]!==""||s[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=s}setValue(e){this.__pendingValue=e}commit(){for(;Ce(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=D,t(this)}if(this.__pendingValue===D)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=D}}class ps extends un{constructor(e,t,s){super(e,t,s);this.single=s.length===2&&s[0]===""&&s[1]===""}_createPart(){return new gs(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class gs extends Et{}let dn=!1;(()=>{try{const n={get capture(){return dn=!0,!1}};window.addEventListener("test",n,n),window.removeEventListener("test",n,n)}catch{}})();class ys{constructor(e,t,s){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=s,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Ce(this.__pendingValue);){const r=this.__pendingValue;this.__pendingValue=D,r(this)}if(this.__pendingValue===D)return;const e=this.__pendingValue,t=this.value,s=e==null||t!=null&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=e!=null&&(t==null||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=ws(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=D}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const ws=n=>n&&(dn?{capture:n.capture,passive:n.passive,once:n.once}:n.capture);/**
|
|
86
|
+
* @license
|
|
87
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
88
|
+
* This code may only be used under the BSD style license found at
|
|
89
|
+
* http://polymer.github.io/LICENSE.txt
|
|
90
|
+
* The complete set of authors may be found at
|
|
91
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
92
|
+
* The complete set of contributors may be found at
|
|
93
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
94
|
+
* Code distributed by Google as part of the polymer project is also
|
|
95
|
+
* subject to an additional IP rights grant found at
|
|
96
|
+
* http://polymer.github.io/PATENTS.txt
|
|
97
|
+
*/class Es{handleAttributeExpressions(e,t,s,i){const r=t[0];return r==="."?new ps(e,t.slice(1),s).parts:r==="@"?[new ys(e,t.slice(1),i.eventContext)]:r==="?"?[new ms(e,t.slice(1),s)]:new un(e,t,s).parts}handleTextExpression(e){return new de(e)}}const fn=new Es;/**
|
|
98
|
+
* @license
|
|
99
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
100
|
+
* This code may only be used under the BSD style license found at
|
|
101
|
+
* http://polymer.github.io/LICENSE.txt
|
|
102
|
+
* The complete set of authors may be found at
|
|
103
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
104
|
+
* The complete set of contributors may be found at
|
|
105
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
106
|
+
* Code distributed by Google as part of the polymer project is also
|
|
107
|
+
* subject to an additional IP rights grant found at
|
|
108
|
+
* http://polymer.github.io/PATENTS.txt
|
|
109
|
+
*/function Ss(n){let e=mn.get(n.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},mn.set(n.type,e));let t=e.stringsArray.get(n.strings);if(t!==void 0)return t;const s=n.strings.join(Q);return t=e.keyString.get(s),t===void 0&&(t=new us(n,n.getTemplateElement()),e.keyString.set(s,t)),e.stringsArray.set(n.strings,t),t}const mn=new Map;/**
|
|
110
|
+
* @license
|
|
111
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
112
|
+
* This code may only be used under the BSD style license found at
|
|
113
|
+
* http://polymer.github.io/LICENSE.txt
|
|
114
|
+
* The complete set of authors may be found at
|
|
115
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
116
|
+
* The complete set of contributors may be found at
|
|
117
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
118
|
+
* Code distributed by Google as part of the polymer project is also
|
|
119
|
+
* subject to an additional IP rights grant found at
|
|
120
|
+
* http://polymer.github.io/PATENTS.txt
|
|
121
|
+
*/const pn=new WeakMap,qe=(n,e,t)=>{let s=pn.get(e);s===void 0&&(mt(e,e.firstChild),pn.set(e,s=new de(Object.assign({templateFactory:Ss},t))),s.appendInto(e)),s.setValue(n),s.commit()};/**
|
|
122
|
+
* @license
|
|
123
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
124
|
+
* This code may only be used under the BSD style license found at
|
|
125
|
+
* http://polymer.github.io/LICENSE.txt
|
|
126
|
+
* The complete set of authors may be found at
|
|
127
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
128
|
+
* The complete set of contributors may be found at
|
|
129
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
130
|
+
* Code distributed by Google as part of the polymer project is also
|
|
131
|
+
* subject to an additional IP rights grant found at
|
|
132
|
+
* http://polymer.github.io/PATENTS.txt
|
|
133
|
+
*/typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const M=(n,...e)=>new ke(n,e,"html",fn),gn=(n,...e)=>new gt(n,e,"svg",fn),Le=new Set;function H(n){typeof n=="function"&&(Le.size||globalThis.queueMicrotask(()=>{Le.forEach(e=>e()),Le.clear()}),Le.delete(n),Le.add(n))}const $e=[];function _s(){for(let n=$e.length-1;n>=0;n--)$e[n]();$e.length=0}function yn(n){$e.length||H(_s),$e.push(n)}function xe(n="",e=""){const{pathname:t,search:s,hash:i}=new URL(e,location.origin+n);return t+s+i}class St extends(globalThis.EventTarget||Object){constructor(){super(...arguments);N(this,Ee);N(this,ee,void 0);N(this,te,void 0);N(this,le,void 0);G(this,ee,new Map)}get size(){return g(this,ee).size}add(e){g(this,le)||this.dispatchEvent(new CustomEvent("start"));const t=dt(this,Ee,Xt).call(this,e)||{value:e};t.prev=g(this,le),t.prev&&(t.prev.next=t),t.next=void 0,G(this,le,t),g(this,te)||G(this,te,t),g(this,ee).set(e,t)}delete(e){const t=dt(this,Ee,Xt).call(this,e);return g(this,te)||this.dispatchEvent(new CustomEvent("end")),t}get(){const e=g(this,te);if(!!e)return dt(this,Ee,Xt).call(this,e.value),e.value}}ee=new WeakMap,te=new WeakMap,le=new WeakMap,Ee=new WeakSet,Xt=function(e){const t=g(this,ee).get(e);return t&&(t.prev?t.prev.next=t.next:G(this,te,t.next),t.next?t.next.prev=t.prev:G(this,le,t.prev),g(this,ee).delete(e)),t};class _t extends WeakMap{get(e){let t=super.get(e);return t||(t={},this.set(e,t)),t}}class fe extends URLSearchParams{constructor(e){super(e);N(this,Se,e=>typeof e=="string"?e:JSON.stringify(e));N(this,lt,e=>{if(!e)return null;try{return JSON.parse(e)}catch{return null}})}concat(e){let t;typeof e=="string"?t=Object.fromEntries(new URLSearchParams(e).entries()):t=e,Object.entries(t).forEach(([s,i])=>{this.append(s,g(this,Se).call(this,i))})}setAny(e,t){if(Array.isArray(t))this.delete(e),t.forEach(s=>this.append(e,g(this,Se).call(this,s)));else{const s=g(this,Se).call(this,t);s?this.set(e,s):this.delete(e)}}getAny(e){return this.getAnyAll(e)[0]}getAnyAll(e){return this.getAll(e).filter(t=>t!=="").map(t=>g(this,lt).call(this,t))}toString(){const e=super.toString();return e?`?${e}`:""}toJSON(){return this.toString()}}Se=new WeakMap,lt=new WeakMap;function me(n,...e){return n.reduce((t,s,i)=>{var r;return t+((r=e[i-1])!=null?r:"")+s})}function wn(n,...e){return me(n,...e)}const Ue=Symbol.for("gem@sheetToken");a.useNativeCSSStyleSheet=!0;let vt=window.CSSStyleSheet;try{new vt}catch{a.useNativeCSSStyleSheet=!1,vt=class{constructor(){this.media={mediaText:""},this.style="",this.replaceSync=n=>this.style=n}}}function En(n,e=""){const t=new vt,s={};t.media.mediaText=e;let i="";return typeof n=="string"?i=n:Object.keys(n).forEach(r=>{s[r]=`${r}-${Ne()}`,i+=n[r].styledContent.replace(/&/g,s[r])}),t.replaceSync(i),s[Ue]=t,s}function Ne(n=5,e="0123456789abcdefghijklmnopqrstuvwxyz"){const t=e.length;let s="";for(let i=0;i<n;i++)s+=e[Math.floor(Math.random()*t)];return s}const vs=new RegExp(`&.*{((.|
|
|
134
|
+
)*)}`,"g");function Sn(n,e){const t=[];let s=`& {${n.replace(vs,i=>(t.push(i),""))}}`+t.join("");return s=s.replace(/&/g,e==="class"?".&":"#&"),{styledContent:s,type:e}}const _n={class:(n,...e)=>{const t=me(n,...e);return Sn(t,"class")},id:(n,...e)=>{const t=me(n,...e);return Sn(t,"id")},keyframes:(n,...e)=>({styledContent:`@keyframes & {${me(n,...e)}}`,type:"keyframes"})};function I(n){return n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function pe(n){return n.replace(/-(.)/g,(e,t)=>t.toUpperCase())}function Me(n){return Object.keys(n).forEach(e=>{const t=e;delete n[t]}),n}class K extends Error{constructor(e){super(e);this.message=`gem: ${this.message}`}}function bt(n,e){const t=n.length;if(e.length!==t)return!0;for(let s=0;s<t;s++)if(n[s]!==e[s])return!0;return!1}function Pt(n,e){const t=new Set(e);return n.filter(s=>t.has(s)?(t.delete(s),!1):!0)}function vn(n){let e="";for(const t in n)n[t]!==void 0&&(e+=`${I(t)}:${n[t]};`);return e}function Ct(n){let e=" ";for(const t in n)n[t]&&(e+=`${t} `);return e}const bn=Ct,ne=new WeakMap;function z(n){if(ne.has(n))throw new K("argument error");return ne.set(n,new Set),n}function Pn(n){return Object.keys(n).forEach(t=>{z(n[t])}),n}function P(n,e){Object.assign(n,e);const t=ne.get(n);t==null||t.forEach(s=>{H(s)})}function se(n,e){const t=ne.get(n);t==null||t.add(e)}function Tt(n,e){const t=ne.get(n);t==null||t.delete(e)}/**
|
|
135
|
+
* @license
|
|
136
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
137
|
+
* This code may only be used under the BSD style license found at
|
|
138
|
+
* http://polymer.github.io/LICENSE.txt
|
|
139
|
+
* The complete set of authors may be found at
|
|
140
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
141
|
+
* The complete set of contributors may be found at
|
|
142
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
143
|
+
* Code distributed by Google as part of the polymer project is also
|
|
144
|
+
* subject to an additional IP rights grant found at
|
|
145
|
+
* http://polymer.github.io/PATENTS.txt
|
|
146
|
+
*/const Cn=(n,e)=>{const t=n.startNode.parentNode,s=e===void 0?n.endNode:e.startNode,i=t.insertBefore(B(),s);t.insertBefore(B(),s);const r=new de(n.options);return r.insertAfterNode(i),r},ie=(n,e)=>(n.setValue(e),n.commit(),n),kt=(n,e,t)=>{const s=n.startNode.parentNode,i=t?t.startNode:n.endNode,r=e.endNode.nextSibling;r!==i&&sn(s,e.startNode,r,i)},Lt=n=>{mt(n.startNode.parentNode,n.startNode,n.endNode.nextSibling)},Tn=(n,e,t)=>{const s=new Map;for(let i=e;i<=t;i++)s.set(n[i],i);return s},kn=new WeakMap,Ln=new WeakMap,$n=J((n,e,t)=>{let s;return t===void 0?t=e:e!==void 0&&(s=e),i=>{if(!(i instanceof de))throw new Error("repeat can only be used in text bindings");const r=kn.get(i)||[],o=Ln.get(i)||[],c=[],l=[],h=[];let m=0;for(const b of n)h[m]=s?s(b,m):m,l[m]=t(b,m),m++;let u,$,w=0,E=r.length-1,p=0,_=l.length-1;for(;w<=E&&p<=_;)if(r[w]===null)w++;else if(r[E]===null)E--;else if(o[w]===h[p])c[p]=ie(r[w],l[p]),w++,p++;else if(o[E]===h[_])c[_]=ie(r[E],l[_]),E--,_--;else if(o[w]===h[_])c[_]=ie(r[w],l[_]),kt(i,r[w],c[_+1]),w++,_--;else if(o[E]===h[p])c[p]=ie(r[E],l[p]),kt(i,r[E],r[w]),E--,p++;else if(u===void 0&&(u=Tn(h,p,_),$=Tn(o,w,E)),!u.has(o[w]))Lt(r[w]),w++;else if(!u.has(o[E]))Lt(r[E]),E--;else{const b=$.get(h[p]),U=b!==void 0?r[b]:null;if(U===null){const W=Cn(i,r[w]);ie(W,l[p]),c[p]=W}else c[p]=ie(U,l[p]),kt(i,U,r[w]),r[b]=null;p++}for(;p<=_;){const b=Cn(i,c[_+1]);ie(b,l[p]),c[p++]=b}for(;w<=E;){const b=r[w++];b!==null&&Lt(b)}kn.set(i,c),Ln.set(i,h)}});/**
|
|
147
|
+
* @license
|
|
148
|
+
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
|
149
|
+
* This code may only be used under the BSD style license found at
|
|
150
|
+
* http://polymer.github.io/LICENSE.txt
|
|
151
|
+
* The complete set of authors may be found at
|
|
152
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
153
|
+
* The complete set of contributors may be found at
|
|
154
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
155
|
+
* Code distributed by Google as part of the polymer project is also
|
|
156
|
+
* subject to an additional IP rights grant found at
|
|
157
|
+
* http://polymer.github.io/PATENTS.txt
|
|
158
|
+
*/const $t=new WeakMap,Nn=J((n,e)=>t=>{const s=$t.get(t);if(Array.isArray(n)){if(Array.isArray(s)&&s.length===n.length&&n.every((i,r)=>i===s[r]))return}else if(s===n&&(n!==void 0||$t.has(t)))return;t.setValue(e()),$t.set(t,Array.isArray(n)?Array.from(n):n)});/**
|
|
159
|
+
* @license
|
|
160
|
+
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
|
161
|
+
* This code may only be used under the BSD style license found at
|
|
162
|
+
* http://polymer.github.io/LICENSE.txt
|
|
163
|
+
* The complete set of authors may be found at
|
|
164
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
165
|
+
* The complete set of contributors may be found at
|
|
166
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
167
|
+
* Code distributed by Google as part of the polymer project is also
|
|
168
|
+
* subject to an additional IP rights grant found at
|
|
169
|
+
* http://polymer.github.io/PATENTS.txt
|
|
170
|
+
*/const Nt=new WeakMap,Mt=J(n=>e=>{const t=Nt.get(e);if(n===void 0&&e instanceof Et){if(t!==void 0||!Nt.has(e)){const s=e.committer.name;e.committer.element.removeAttribute(s)}}else n!==t&&e.setValue(n);Nt.set(e,n)});var Mn=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},d=(n,e,t)=>(Mn(n,e,"read from private field"),t?t.call(n):e.get(n)),C=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},F=(n,e,t,s)=>(Mn(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),ge,re,Oe,Re,Y,Z,Be,Ke,Ot,Rt,At,ze,Gt,Fe,X,Ht,Je;function bs(){}function It(n){typeof n=="function"&&n()}const Qe=new St,Vt=(n=performance.now())=>{if(performance.now()>n+16)return requestAnimationFrame(Vt);const e=Qe.get();e&&(e(),Vt(n))};Qe.addEventListener("start",()=>H(Vt));const Ye=Symbol("init"),On=Symbol("update");class A extends HTMLElement{constructor({isAsync:e,isLight:t,delegatesFocus:s}={}){super();C(this,ge,void 0),C(this,re,void 0),C(this,Oe,void 0),C(this,Re,void 0),C(this,Y,void 0),C(this,Z,void 0),C(this,Be,void 0),this.setState=r=>{if(!this.state)throw new K("`state` not initialized");Object.assign(this.state,r),H(d(this,X))},C(this,Ke,r=>{r==null||r.forEach(o=>{const{callback:c,getDep:l,values:h,preCallback:m}=o,u=l==null?void 0:l();(!l||!h||bt(h,u))&&(It(m),o.preCallback=c(u,h),o.values=u)})}),C(this,Ot,()=>{d(this,Ke).call(this,d(this,Y))}),C(this,Rt,()=>{d(this,Ke).call(this,d(this,Z))}),this.effect=(r,o)=>{d(this,Y)||F(this,Y,[]);const c={callback:r,getDep:o,values:void 0,initialized:!!this.isConnected};this.isConnected&&(c.values=o==null?void 0:o(),c.preCallback=r(c.values)),d(this,Y).push(c)},this.memo=(r,o)=>{d(this,Z)||F(this,Z,[]),d(this,Z).push({callback:r,getDep:o,values:[Symbol()],initialized:this.isConnected})},C(this,At,()=>{var r;(r=d(this,Y))==null||r.forEach(o=>{const{callback:c,getDep:l,initialized:h}=o;h||(o.values=l==null?void 0:l(),o.preCallback=c(o.values),o.initialized=!0)})}),C(this,ze,()=>{var o,c;d(this,Rt).call(this);const r=a.useNativeCSSStyleSheet?"":M`${(c=(o=this.shadowRoot)==null?void 0:o.adoptedStyleSheets)==null?void 0:c.map(l=>M`
|
|
171
|
+
<style media=${l.media.mediaText}>
|
|
172
|
+
${l.style}
|
|
173
|
+
</style>
|
|
174
|
+
`)}`;return this.render?M`${this.render()}${r}`:d(this,ge)===this?void 0:M`<slot></slot>${r}`}),C(this,Gt,()=>this.shouldUpdate?this.shouldUpdate():!0),C(this,Fe,()=>{if(this.isConnected&&d(this,Gt).call(this)){const r=d(this,ze).call(this);r!==void 0&&qe(r,d(this,ge)),H(d(this,Ht)),H(d(this,Ot))}}),C(this,X,()=>{d(this,Re)?Qe.add(d(this,Fe)):d(this,Fe).call(this)}),this.update=()=>{H(d(this,X))},C(this,Ht,()=>{var r;(r=this.updated)==null||r.call(this)}),C(this,Je,()=>{var l,h,m;if(d(this,Oe)){F(this,Oe,!1);return}(l=this.willMount)==null||l.call(this);const{observedStores:r,rootElement:o}=this.constructor;r==null||r.forEach(u=>{se(u,d(this,X))});const c=d(this,ze).call(this);if(c!==void 0&&qe(c,d(this,ge)),F(this,Be,(h=this.mounted)==null?void 0:h.call(this)),d(this,At).call(this),o&&((m=this.getRootNode().host)==null?void 0:m.tagName)!==o.toUpperCase())throw new K("not allow current root type")}),H(()=>this[Ye]=!1),this[Ye]=!0,this[On]=()=>{this.isConnected&&H(d(this,X))},F(this,Re,e),F(this,ge,t?this:this.attachShadow({mode:"open",delegatesFocus:s}));const{adoptedStyleSheets:i}=new.target;if(i){const r=i.map(o=>o[Ue]||o);this.shadowRoot?this.shadowRoot.adoptedStyleSheets=r:this.effect(()=>{const o=this.getRootNode();if(a.useNativeCSSStyleSheet)return o.adoptedStyleSheets=[...o.adoptedStyleSheets,...r],()=>{o.adoptedStyleSheets=Pt(o.adoptedStyleSheets,r)};{const c=o===document?document.body:o;return c._sheets=c._sheets||{},r.forEach(({style:l,media:h})=>{if(c._sheets[l])c._sheets[l].count++;else{const m=document.createElement("style");m.innerHTML=l,m.media=h.mediaText,c.append(m),c._sheets[l]={ele:m,count:1}}}),()=>{r.forEach(({style:l})=>{c._sheets[l].count--,c._sheets[l].count||delete c._sheets[l]})}}},()=>[])}}get internals(){if(!d(this,re)){const e=()=>{const t=s=>s.replace(/-/g,"");return{has:s=>t(s)in this.dataset,add:s=>{this.dataset[t(s)]=""},delete:s=>delete this.dataset[t(s)]}};this.attachInternals||(this.attachInternals=()=>({states:e()})),F(this,re,this.attachInternals()),d(this,re).states||(d(this,re).states=e())}return d(this,re)}attributeChangedCallback(){this.isConnected&&H(d(this,X))}closestElement(e){const t=typeof e=="function",s=typeof e=="string"&&e.toUpperCase(),i=r=>{const o=r.parentElement||r.getRootNode().host;if(!o)return null;if(t){if(o.constructor===e)return o}else if(o.tagName===s)return o;return i(o)};return i(this)}connectedCallback(){d(this,Re)?Qe.add(d(this,Je)):d(this,Je).call(this)}disconnectedCallback(){var t,s,i;if(this.isConnected){F(this,Oe,!0);return}const{observedStores:e}=this.constructor;e==null||e.forEach(r=>{Tt(r,d(this,X))}),It(d(this,Be)),(t=this.unmounted)==null||t.call(this),(s=d(this,Y))==null||s.forEach(r=>{It(r.preCallback)}),F(this,Z,(i=d(this,Z))==null?void 0:i.filter(({initialized:r})=>!r))}}ge=new WeakMap,re=new WeakMap,Oe=new WeakMap,Re=new WeakMap,Y=new WeakMap,Z=new WeakMap,Be=new WeakMap,Ke=new WeakMap,Ot=new WeakMap,Rt=new WeakMap,At=new WeakMap,ze=new WeakMap,Gt=new WeakMap,Fe=new WeakMap,X=new WeakMap,Ht=new WeakMap,Je=new WeakMap;const Ze=new _t;function Xe(n,e,t){const{booleanAttributes:s,numberAttributes:i}=n.constructor;Object.defineProperty(n,e,{configurable:!0,get(){if(!(Ye in this))return;const o=this.getAttribute(t);return(s==null?void 0:s.has(t))?o!==null:(i==null?void 0:i.has(t))?Number(o):o||""},set(r){const o=this,c=Ze.get(this),l=c[e],h=o.getAttribute(t);if(this[Ye]&&h!==null&&!l)return;c[e]=!0;const m=s==null?void 0:s.has(t);r==null?o.removeAttribute(t):m?o.toggleAttribute(t,!!r):h!==String(r)&&o.setAttribute(t,String(r))}})}const Rn=Symbol("event handle");function ye(n,e,t,s){Object.defineProperty(n,e,{configurable:!0,get(){const i=Ze.get(this)[e];return i||!t?i:(this[e]=bs,this[e])},set(i){const r=this,o=Ze.get(r);i!==o[e]&&(t?(o[e]=(i==null?void 0:i[Rn])?i:(c,l)=>{const h=new CustomEvent(t,je(T(T({},l),s),{detail:c}));r.dispatchEvent(h),i(c,l)},o[e][Rn]=!0):(o[e]=i,this[On]()))}})}function et(n,e,t){Object.defineProperty(n,e,{configurable:!0,get(){const s=Ze.get(this);let i=s[e];if(!i){const r=this,o=r.shadowRoot||r;i={get ref(){return t},get element(){const c=[...o.querySelectorAll("gem-reflect")].map(l=>l.target);for(const l of[o,...c]){const h=l.querySelector(`[ref=${t}]`);if(h)return h}}},s[e]=i}return i}})}function tt(n,e,t){Object.defineProperty(n,e,{configurable:!0,get(){var r;const s=this,{states:i}=s.internals;return(r=i.has)==null?void 0:r.call(i,t)},set(s){const i=this,{states:r}=i.internals;s?r.add(t):r.delete(t)}})}const nt=customElements.define.bind(customElements);customElements.define=(n,e,t)=>{if(e.prototype instanceof A){const{observedAttributes:s,observedPropertys:i,defineEvents:r,defineCSSStates:o,defineRefs:c}=e;s==null||s.forEach(l=>Xe(e.prototype,pe(l),l)),i==null||i.forEach(l=>ye(e.prototype,l)),r==null||r.forEach(l=>ye(e.prototype,pe(l),l)),o==null||o.forEach(l=>tt(e.prototype,pe(l),`--${l}`)),c==null||c.forEach(l=>et(e.prototype,pe(l),l))}nt(n,e,t)};function j(n,e,t,s=!1){const i=n.constructor,r=i[e];i.hasOwnProperty(e)||Object.defineProperty(i,e,{value:s?new Set(r):r?Array.from(r):[]}),i[e][s?"add":"push"](t)}function An(n,e){const t=`${I(e)}-${Ne()}`;j(n,"defineRefs",t),et(n,e,t)}function Wt(n,e,t){j(n,"observedAttributes",t),Xe(n,e,t)}function k(n,e){Wt(n,e,I(e))}function Gn(n,e){const t=I(e);j(n,"booleanAttributes",t,!0),Wt(n,e,t)}function Hn(n,e){const t=I(e);j(n,"numberAttributes",t,!0),Wt(n,e,t)}function q(n,e){j(n,"observedPropertys",e),ye(n,e)}function Ae(n,e){const t=I(e);j(n,"defineCSSStates",t),tt(n,e,`--${t}`)}function In(n,e){const t=I(n[e]||e);n[e]=t,j(n instanceof A?n:n.prototype,"defineSlots",t)}function Dt(n,e){const t=I(n[e]||e);n[e]=t,j(n instanceof A?n:n.prototype,"defineParts",t)}function Ge(n,e){Wn(n,e)}function Vn(n,e){Wn(n,e,{bubbles:!0,composed:!0})}function Wn(n,e,t){const s=I(e);j(n,"defineEvents",s),ye(n,e,s,t)}function Dn(n){return function(e){j(e.prototype,"adoptedStyleSheets",n)}}function ae(n){return function(e){j(e.prototype,"observedStores",n)}}function jn(n){return function(e){const t=e;t.rootElement=n}}function qn(n){return function(e){nt(n,e)}}const V=window.history,xn=V.pushState.bind(V),Un=V.replaceState.bind(V);let Ps=0;const jt=()=>`${performance.now()}-${++Ps}`,v=z({$hasCloseHandle:!1,$hasOpenHandle:!1,$hasShouldCloseHandle:!1,$key:""}),O=new Map;function Bn({$key:n,$hasCloseHandle:e,$hasOpenHandle:t,$hasShouldCloseHandle:s}={}){if(v.$key!==n){if(n)throw new K("`$key` is not allowed");if(e)throw new K("`$hasCloseHandle` is not allowed");if(t)throw new K("`$hasOpenHandle` is not allowed");if(s)throw new K("`$hasShouldCloseHandle` is not allowed")}}function Kn(n){return x.basePath?x.basePath+n:n}function zn(n){return n===x.basePath?"/":n.replace(new RegExp(`^${x.basePath}/`),"/")}function st(n){const e=O.get(v.$key)||{},t=n.path?xe(e.path,n.path):zn(location.pathname),s=new fe(n.query||(n.path?"":location.search)),i=n.path&&n.path!==e.path||n.query&&String(n.query)!==String(e.query),r=n.title||(i?"":document.title),o=n.close||n.data||n.open||n.shouldClose,c=n.hash||(!i&&o?decodeURIComponent(location.hash):"");return je(T({},n),{title:r,path:t,query:s,hash:c})}function Fn(n,e){Bn(n.data);const t=st(n),{title:s,path:i,query:r,hash:o,close:c,open:l,shouldClose:h,data:m}=t,u=T({$hasCloseHandle:!!c,$hasOpenHandle:!!l,$hasShouldCloseHandle:!!h,$key:jt()},m);O.set(u.$key,t),P(Me(v),u);const $=Kn(i)+new fe(r)+o,w=decodeURIComponent(location.hash);e(u,s,$),w!==o&&window.dispatchEvent(new CustomEvent("hashchange"))}function Jn(n,e,t,s){Bn(n);const i=T({$key:jt()},n||{}),{pathname:r,search:o,hash:c}=new URL(t,location.origin+location.pathname),l=st({path:r,query:new fe(o),hash:c,title:e,data:n});O.set(i.$key,l),P(Me(v),i);const h=Kn(r)+l.query+c,m=location.hash;s(i,e,h),m!==c&&window.dispatchEvent(new CustomEvent("hashchange"))}const qt=z({basePath:""});class Cs{get store(){return v}get basePath(){return qt.basePath}set basePath(e){P(qt,{basePath:e}),Object.assign(O.get(v.$key),{path:zn(location.pathname)})}getParams(){return O.get(v.$key)}updateParams(e){Object.assign(O.get(v.$key),e),P(v,{})}push(e){Fn(e,xn)}replace(e){Fn(e,Un)}pushIgnoreCloseHandle(e){var t,s;v.$hasCloseHandle?((s=(t=O.get(v.$key))==null?void 0:t.close)==null||s.call(t),this.replace(e)):this.push(e)}forward(){V.forward()}back(){V.back()}}const x=new Cs,He=z({title:""}),Ts={history:x,titleStore:He,basePathStore:qt};if(!window._GEMHISTORY){if(window._GEMHISTORY=Ts,V.pushState=function(e,t,s){Jn(e,t,s,xn)},V.replaceState=function(e,t,s){Jn(e,t,s,Un)},window.addEventListener("hashchange",({isTrusted:e})=>{e&&x.replace({hash:decodeURIComponent(location.hash)})}),V.state)if(V.state.$hasCloseHandle){P(v,V.state);const e=st({title:document.title});O.set(v.$key,e),x.back()}else{const e=st({title:document.title,hash:location.hash});P(v,T({$key:jt()},V.state||{})),O.set(v.$key,e)}else{const{pathname:e,search:t,hash:s}=location;x.replace({path:e,query:t,hash:s})}se(He,()=>{const e=O.get(v.$key);e&&(e.title=He.title)}),se(v,()=>{const{title:e}=x.getParams();e!==He.title&&P(He,{title:e})});let n=!1;window.addEventListener("popstate",e=>{var i,r;const t=e.state;if(!(t==null?void 0:t.$key))return;if(n){n=!1;return}if(!O.has(t.$key)){const{pathname:o,search:c,hash:l}=location;O.set(t.$key,{path:o,query:new fe(c),hash:l,title:document.title,data:t})}const s=v;if(parseFloat(t.$key)>parseFloat(s.$key)&&t.$hasOpenHandle)(r=(i=O.get(t.$key))==null?void 0:i.open)==null||r.call(i);else if(s.$hasCloseHandle){const o=O.get(s.$key),c=o==null?void 0:o.close,l=o==null?void 0:o.shouldClose;if(l&&!l()){n=!0,x.forward();return}else c?c():t.$hasCloseHandle&&(n=!0,x.back())}P(Me(v),t)})}const{history:S,titleStore:oe,basePathStore:xt}=window._GEMHISTORY;var ks=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,ce=(n,e,t,s)=>{for(var i=s>1?void 0:s?Ls(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&ks(e,t,i),i},Qn=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Ie=(n,e,t)=>(Qn(n,e,"read from private field"),t?t.call(n):e.get(n)),Ut=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Yn=(n,e,t,s)=>(Qn(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t),Ve,it,rt;class $s extends RegExp{constructor(e){const t={};let s=0;super(`^${e.replace(/:([^/$]+)/g,(i,r)=>(t[r]=s++,"([^/]+)")).replace("*",".*")}$`,"i");this.namePosition=t}}function Bt(n,e){const t=new $s(n),s=e.match(t)||`${e}/`.match(t);if(!s)return null;const i={};return s&&Object.keys(t.namePosition).forEach(r=>{i[r]=s[t.namePosition[r]+1]}),i}function Kt(n,e){let t=n.pattern;const s=e==null?void 0:e.params;return s&&Object.keys(s).forEach(i=>{t=t.replace(new RegExp(`:${i}`,"g"),s[i])}),t}function Zn(n,e){const t=Kt(n,e);return T({path:t},e)}a.GemRouteElement=class extends A{constructor({isLight:n,routes:e}={}){super({isLight:n});this.currentParams={},Ut(this,Ve,void 0),this.state={content:void 0},Ut(this,it,()=>{if(this.locationStore){const{path:t,query:s,data:i}=S.getParams();P(this.locationStore,{path:t,params:this.currentParams,query:s,data:i})}}),Ut(this,rt,(t,s,i)=>{Yn(this,Ve,void 0),this.currentRoute=t,this.currentParams=s,this.setState({content:i}),this.routechange(this.currentRoute),Ie(this,it).call(this)}),this.routes=e}mounted(){this.effect(([n,e],t)=>{if(t&&n===t[0]&&e===t[1]){Ie(this,it).call(this);return}const{route:s,params:i={}}=a.GemRouteElement.findRoute(this.routes,e),{redirect:r,content:o,getContent:c}=s||{};if(r){S.replace({path:r});return}const l=s==null?void 0:s.title;l&&P(oe,{title:l});const h=o||(c==null?void 0:c(i));if(h instanceof Promise){this.loading(s),Yn(this,Ve,h);const m=()=>Ie(this,Ve)===h;h.then(u=>{m()&&Ie(this,rt).call(this,s,i,u)}).catch(u=>{m()&&this.error(u)});return}Ie(this,rt).call(this,s,i,h)},()=>{const{path:n}=S.getParams();return[this.key,n,location.search]})}shouldUpdate(){return!this.inert}render(){const{content:n}=this.state;return this.shadowRoot?M`
|
|
175
|
+
<style>
|
|
176
|
+
:host,
|
|
177
|
+
:not(:defined) {
|
|
178
|
+
display: contents;
|
|
179
|
+
}
|
|
180
|
+
</style>
|
|
181
|
+
${n!=null?n:M`<slot></slot>`}
|
|
182
|
+
`:M`${n}`}},Ve=new WeakMap,it=new WeakMap,rt=new WeakMap,a.GemRouteElement.createLocationStore=()=>{const{path:n,query:e,data:t}=S.getParams();return z({path:n,query:e,data:t,params:{}})},a.GemRouteElement.findRoute=(n=[],e)=>{let t=null,s;n instanceof Array?s=n:s=Object.values(n);for(const i of s)if(i.pattern==="*")t=i;else{const r=Bt(i.pattern,e);if(r)return{route:i,params:r}}return{route:t}},ce([q],a.GemRouteElement.prototype,"routes",2),ce([q],a.GemRouteElement.prototype,"locationStore",2),ce([q],a.GemRouteElement.prototype,"key",2),ce([Ge],a.GemRouteElement.prototype,"routechange",2),ce([Ge],a.GemRouteElement.prototype,"loading",2),ce([Ge],a.GemRouteElement.prototype,"error",2),a.GemRouteElement=ce([ae(S.store)],a.GemRouteElement);class Xn extends a.GemRouteElement{constructor(e={}){super(je(T({},e),{isLight:!0}))}}var Ns=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,L=(n,e,t,s)=>{for(var i=s>1?void 0:s?Ms(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&Ns(e,t,i),i};a.GemLinkElement=class extends A{constructor(){super();this.clickHandle=async n=>{var r;const e=this.getPathInfo();if(!e)return;if(this.isExternal(e))switch(this.target){case"_self":window.location.href=e;return;case"_parent":window.parent.location.href=e;return;case"_top":window.top.location.href=e;return;default:window.open(e);return}const{path:t,query:s,hash:i}=S.getParams();if(t+s+i!==e)if(n.stopPropagation(),await((r=this.prepare)==null?void 0:r.call(this)),this.route)S.pushIgnoreCloseHandle(je(T({},Zn(this.route,this.options)),{title:this.route.title||this.docTitle}));else if(this.href){const{pathname:o,search:c,hash:l}=new URL(e,location.origin);S.pushIgnoreCloseHandle({path:o,query:c,hash:l,title:this.docTitle})}else S.pushIgnoreCloseHandle({path:this.path,query:this.query,hash:this.hash,title:this.docTitle})},this.preventDefault=n=>{n.preventDefault()},this.tabIndex=0,this.addEventListener("click",this.clickHandle)}getPathInfo(){var n,e;if(this.route){const t=((n=this.options)==null?void 0:n.query)||"",s=((e=this.options)==null?void 0:e.hash)||"";return Kt(this.route,this.options)+t+s}else{const t=this.href||this.path+this.query+this.hash,{path:s,query:i}=S.getParams();return t.startsWith("#")?`${s}${i}${t}`:t.startsWith("?")?`${s}${t}`:t.startsWith(".")?xe(s,t):t}}isExternal(n){return!n.startsWith("/")}render(n=this.getPathInfo()){return M`
|
|
183
|
+
<style>
|
|
184
|
+
:host {
|
|
185
|
+
/* link default style */
|
|
186
|
+
cursor: pointer;
|
|
187
|
+
color: blue;
|
|
188
|
+
text-decoration: underline;
|
|
189
|
+
}
|
|
190
|
+
a {
|
|
191
|
+
all: unset;
|
|
192
|
+
display: contents;
|
|
193
|
+
}
|
|
194
|
+
a:visited {
|
|
195
|
+
color: unset;
|
|
196
|
+
}
|
|
197
|
+
</style>
|
|
198
|
+
<a
|
|
199
|
+
part=${this.link}
|
|
200
|
+
@click=${this.preventDefault}
|
|
201
|
+
href=${Mt(this.hint==="off"?void 0:this.isExternal(n)?n:new URL(S.basePath+n,location.origin).toString())}
|
|
202
|
+
>
|
|
203
|
+
<slot></slot>
|
|
204
|
+
</a>
|
|
205
|
+
`}},L([k],a.GemLinkElement.prototype,"href",2),L([k],a.GemLinkElement.prototype,"target",2),L([k],a.GemLinkElement.prototype,"path",2),L([k],a.GemLinkElement.prototype,"query",2),L([k],a.GemLinkElement.prototype,"hash",2),L([k],a.GemLinkElement.prototype,"docTitle",2),L([k],a.GemLinkElement.prototype,"hint",2),L([q],a.GemLinkElement.prototype,"route",2),L([q],a.GemLinkElement.prototype,"options",2),L([q],a.GemLinkElement.prototype,"prepare",2),L([Dt],a.GemLinkElement.prototype,"link",2),a.GemLinkElement=L([ae(xt)],a.GemLinkElement),a.GemActiveLinkElement=class extends a.GemLinkElement{render(){const{path:n,query:e,hash:t}=S.getParams(),s=this.pattern&&Bt(this.pattern,n),i=this.getPathInfo();return s||n+e+t===i?this.active=!0:this.active=!1,super.render(i)}},L([k],a.GemActiveLinkElement.prototype,"pattern",2),L([Ae],a.GemActiveLinkElement.prototype,"active",2),a.GemActiveLinkElement=L([ae(S.store)],a.GemActiveLinkElement),customElements.define("gem-link",a.GemLinkElement),customElements.define("gem-active-link",a.GemActiveLinkElement),customElements.define("gem-route",a.GemRouteElement),customElements.define("gem-light-route",Xn);var Os=Object.defineProperty,Rs=Object.getOwnPropertyDescriptor,es=(n,e,t,s)=>{for(var i=s>1?void 0:s?Rs(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&Os(e,t,i),i};a.GemTitleElement=class extends A{static setTitle(n){P(oe,{title:n})}static updateTitle(n="",e=""){const{title:t}=oe;t&&t!==a.GemTitleElement.defaultTitle?(a.GemTitleElement.title=t,document.title=a.GemTitleElement.title+e):n?(a.GemTitleElement.title=n,document.title=a.GemTitleElement.title+e):(a.GemTitleElement.title=a.GemTitleElement.defaultTitle,document.title=a.GemTitleElement.title)}constructor(){super();new MutationObserver(()=>this.update()).observe(this,{childList:!0,characterData:!0,subtree:!0})}render(){return a.GemTitleElement.updateTitle(this.textContent||"",this.suffix),this.hidden?M``:M`${a.GemTitleElement.title}`}},a.GemTitleElement.title=document.title,a.GemTitleElement.defaultTitle=document.title,a.GemTitleElement.defaultSuffix=` - ${document.title}`,es([k],a.GemTitleElement.prototype,"suffix",2),a.GemTitleElement=es([ae(oe)],a.GemTitleElement),se(oe,a.GemTitleElement.updateTitle),customElements.define("gem-title",a.GemTitleElement);var As=Object.defineProperty,Gs=Object.getOwnPropertyDescriptor,at=(n,e,t,s)=>{for(var i=s>1?void 0:s?Gs(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&As(e,t,i),i};const ts=new Map;class we extends A{getContent(){const e=this.element||(this.selector?(this.root||document).querySelector(this.selector):null);if(typeof e=="string"){let t=ts.get(e);return t||(t=document.createElement("template"),t.innerHTML=e,ts.set(e,t)),t.content.cloneNode(!0)}else return e instanceof HTMLTemplateElement?e.content.cloneNode(!0):e==null?void 0:e.cloneNode(!0)}render(){return M`
|
|
206
|
+
<style>
|
|
207
|
+
:host {
|
|
208
|
+
position: relative;
|
|
209
|
+
}
|
|
210
|
+
:host(:not([hidden])) {
|
|
211
|
+
display: inline-flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
}
|
|
214
|
+
svg {
|
|
215
|
+
width: 100%;
|
|
216
|
+
height: 100%;
|
|
217
|
+
}
|
|
218
|
+
</style>
|
|
219
|
+
${this.getContent()}
|
|
220
|
+
<slot></slot>
|
|
221
|
+
`}}at([k],we.prototype,"selector",2),at([q],we.prototype,"root",2),at([q],we.prototype,"element",2),at([Ae],we.prototype,"active",2),customElements.define("gem-use",we);var Hs=Object.defineProperty,Is=Object.getOwnPropertyDescriptor,ns=(n,e,t,s)=>{for(var i=s>1?void 0:s?Is(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&Hs(e,t,i),i};class ot extends A{constructor(){super();this.effect(()=>{this.shadowRoot&&(this.shadowRoot.innerHTML=`
|
|
222
|
+
<style>
|
|
223
|
+
:host {
|
|
224
|
+
display: contents;
|
|
225
|
+
}
|
|
226
|
+
${this.contentcss}
|
|
227
|
+
</style>
|
|
228
|
+
${this.content}
|
|
229
|
+
`)},()=>[this.content,this.contentcss])}render(){}}ns([k],ot.prototype,"content",2),ns([k],ot.prototype,"contentcss",2),customElements.define("gem-unsafe",ot);var Vs=Object.defineProperty,Ws=Object.getOwnPropertyDescriptor,Ds=(n,e,t,s)=>{for(var i=s>1?void 0:s?Ws(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&Vs(e,t,i),i};document.querySelectorAll("[data-reflect]").forEach(n=>n.remove());class zt extends A{constructor(){super({isLight:!0});this.target=document.head,this.hidden=!0,this.effect(()=>{const e=[...this.childNodes];return e.forEach(t=>{t instanceof HTMLElement&&(t.dataset.reflect=""),this.target.append(t)}),()=>{e.forEach(t=>t.remove())}},()=>[this.target])}}Ds([q],zt.prototype,"target",2),customElements.define("gem-reflect",zt);const ct=Symbol("open mark");function js(n){var e;return e=class extends A{constructor(){super();this.label="",this.internals.role="alertdialog",this.internals.ariaModal="true"}static get isOpen(){return this.store[ct]}static get observedStores(){return[S.store,this.store]}static open(t){const s=new this;this.instance=s,this.inertStore=[...document.body.children].filter(r=>!r.inert),this.inertStore.forEach(r=>r.inert=!0),document.body.append(s);const i=()=>P(this.store,T({[ct]:!0},t));setTimeout(()=>{i(),S.push({title:s.label,open:i,close:this.closeHandle.bind(this),shouldClose:this.shouldClose.bind(this)})},100)}static close(){S.back()}static closeHandle(){var t;this.inertStore.forEach(s=>s.inert=!1),(t=this.instance)==null||t.remove(),P(this.store,T({[ct]:!1},n))}static shouldClose(){return!0}},e.inertStore=[],e.instance=null,e.store=z(T({[ct]:!1},n)),e}var qs=Object.defineProperty,xs=Object.getOwnPropertyDescriptor,Ft=(n,e,t,s)=>{for(var i=s>1?void 0:s?xs(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(e,t,i):o(i))||i);return s&&i&&qs(e,t,i),i};a.GemDialogBaseElement=(cs=class extends A{constructor(){super();N(this,_e,void 0);N(this,ve,void 0);N(this,he,void 0);this.inert=!0,G(this,he,[]),this.closeHandle=()=>{var n;this.inert=!0,g(this,he).forEach(e=>e.inert=!1),g(this,_e)?g(this,_e).before(this):g(this,ve)&&((n=g(this,ve))==null||n.appendChild(this)),this.dispatchEvent(new CustomEvent("close")),this.opened=!1},this.openHandle=()=>{this.hidden=!1,this.inert=!1,G(this,_e,this.nextSibling),G(this,ve,this.parentElement||this.getRootNode()),G(this,he,[...document.body.children].filter(n=>!n.inert)),g(this,he).forEach(n=>n.inert=!0),document.body.append(this),this.dispatchEvent(new CustomEvent("open")),this.opened=!0},this.open=()=>{this.opened||(this.openHandle(),S.push({title:this.label,open:this.openHandle,close:this.closeHandle,shouldClose:this.shouldClose}))},this.close=()=>{S.back()},this.forceClose=()=>{this.opened=!1,setTimeout(this.close,100)},this.internals.role="dialog",this.internals.ariaModal="true"}shouldClose(){return!0}},_e=new WeakMap,ve=new WeakMap,he=new WeakMap,cs),Ft([k],a.GemDialogBaseElement.prototype,"label",2),Ft([Ae],a.GemDialogBaseElement.prototype,"opened",2),a.GemDialogBaseElement=Ft([ae(S.store)],a.GemDialogBaseElement);const Jt=new WeakMap;function ss(n){return Jt.get(n)}const Qt=new WeakMap;function Us(n){return Qt.get(n)}function Bs(n,e){const t=Jt.get(e),s=Qt.get(e),i=Object.keys(t).reduce((r,o)=>t[o]?r+`${s[o]}:${t[o]};`:r,"");n.textContent=`:root, :host {${i}}`}function Ks(n){const e=Ne(),t=document.createElement("style"),s=z(n),i={},r={};Qt.set(i,r),Jt.set(i,s),Object.keys(s).forEach(c=>{r[c]=`--${I(c)}-${e}`,i[c]=`var(${r[c]})`});const o=()=>Bs(t,i);return se(s,o),o(),(document.head||document.documentElement).append(t),i}function zs(n,e){const t=ss(n);P(t,e)}const Fs=/\$\d(?:<[^>]*>)?/,Js=/\$(\d)(<([^>]*)>)?/g,Qs=3;function is(n,...e){const t=n.split(Fs),s=[];let i;for(;i=Js.exec(n);){const r=i[Qs],o=Number(i[1])-1,c=e[o];s.push(typeof c=="string"?c:c(r))}return M(t,...s)}const We=new Set,Yt=class{constructor(e){N(this,be);N(this,ht);N(this,ut);N(this,ue);N(this,Pe);if(this.cachePrefix="gem-i18n",!e.resources[e.fallbackLanguage])throw new K("i18n: fallbackLanguage invalid");this.store=z(this),Object.assign(this,e);let t=g(this,ht,li)||this.currentLanguage||g(this,ut,hi);const s=document.querySelector(`[type*=${this.cachePrefix}]`);if(s)try{const i=JSON.parse(s.textContent||"");t=i.currentLanguage,this.resources[i.currentLanguage]=i.currentLanguagePack}catch{}t?(G(this,Pe,t,tn),this.setLanguage(t)):this.resetLanguage()}get(e,...t){const s=this.resources[this.currentLanguage],i=this.resources[this.fallbackLanguage],r=s[e]||i[e],o=(r==null?void 0:r.message)||r||`[${e}]`;return t.length?is(o,...t):o}detectLanguage(){const e=Object.keys(this.resources),t=navigator.languages.map(s=>s.replace(/-(.*)/,i=>i.toUpperCase()));for(const s of t){const i=e.find(r=>r===s||s.startsWith(`${r}-`));if(i)return i}return this.fallbackLanguage}async setLanguage(e){g(this,ue,ft)&&We.forEach(async i=>await i.setLanguage(e));let t;const s=this.resources[e];if(!s)return console.warn(`${this.cachePrefix}: not found \`${e}\``),this.resetLanguage();if(typeof s=="string"){const i=`${this.cachePrefix}:`,r=`${i}${s}`,o=localStorage.getItem(r),c=async()=>{const l=await(await fetch(s)).json();if(this.cache){for(let h=0;h<localStorage.length;h++){const m=localStorage.key(h);m.startsWith(i)&&localStorage.removeItem(m)}localStorage.setItem(r,JSON.stringify(l))}return l};if(o)try{t=JSON.parse(o)}catch{t=await c()}else t=await c()}else t=s;return this.resources[e]=t,P(this.store,{}),e!==this.currentLanguage&&G(this,Pe,e,tn),this.cache===!0&&this.setCache(),e}resetLanguage(){return g(this,ue,ft)&&We.forEach(e=>e.resetLanguage()),G(this,Pe,this.fallbackLanguage,tn),this.cache&&localStorage.removeItem(g(this,be,en)),this.setLanguage(this.detectLanguage())}setCache(){g(this,ue,ft)&&We.forEach(e=>e.setCache()),localStorage.setItem(g(this,be,en),this.currentLanguage)}createSubModule(e,t){const s=new Yt({resources:t,cachePrefix:`${this.cachePrefix}-${e}`,currentLanguage:this.currentLanguage,fallbackLanguage:this.fallbackLanguage,cache:this.cache});return We.add(s),s}toJSON(){return{currentLanguage:this.currentLanguage,currentLanguagePack:this.resources[this.currentLanguage]}}};let rs=Yt;be=new WeakSet,en=function(){return`${this.cachePrefix}:current`},ht=new WeakSet,li=function(){const{hostname:e,pathname:t,search:s}=location,i=e.split(".");switch(this.urlParamsType){case"ccTLD":return i.pop();case"gTLD":return i.shift();case"path":return t.split("/")[1];default:const r=this.urlParamsName&&new URLSearchParams(s).get(this.urlParamsName)||"";return r in this.resources?r:""}},ut=new WeakSet,hi=function(){return this.cache&&localStorage.getItem(g(this,be,en))||""},ue=new WeakSet,ft=function(){return!We.has(this)},Pe=new WeakSet,tn=function(e){var t;g(this,ue,ft)&&(document.documentElement.lang=e),this.currentLanguage=e,(t=this.onChange)==null||t.call(this,e)};const Ys={credentials:"include",mode:"cors"};async function De(n,e={}){const t=await fetch(n,T(T({},Ys),e));if(t.status===0)throw new Error("Request fail");if(t.status>=500)throw new Error(t.statusText);if(t.status>=400)throw new Error(await t.text()||t.statusText);return await t.json()}const Zs=Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array));function as(n){return n instanceof FormData||n instanceof Blob||n instanceof Zs||n instanceof URLSearchParams||n instanceof ReadableStream||n instanceof ArrayBuffer?n:typeof n=="object"?JSON.stringify(n):n}function Xs(n,e){const{origin:t,pathname:s,search:i}=new URL(n,location.origin),r=new URLSearchParams(e).toString();return De(`${t}${s}${i?`${i}&`:r?"?":""}${r}`,{method:"GET"})}function ei(n){return De(n,{method:"DELETE"})}function ti(n,e){return De(n,{method:"PUT",body:as(e)})}function ni(n,e){return De(n,{method:"POST",body:as(e)})}const R=n=>window.matchMedia(n).matches,si={PRINT:"print",get isPrint(){return R(this.PRINT)},HOVER:"(hover: hover)",get isHover(){return R(this.HOVER)},PHONE:"(min-width: 319px) and (max-width: 480px)",get isPhone(){return R(this.PHONE)},LAPTOP:"(min-width: 1023px) and (max-width: 1280px) and (orientation: landscape)",get isLaptop(){return R(this.LAPTOP)},DESKTOP:"(min-width: 1279px) and (orientation: landscape)",get isDesktop(){return R(this.DESKTOP)},WIDTHSCREEN:"(min-width: 1919px) and (orientation: landscape)",get isWidthScreen(){return R(this.WIDTHSCREEN)},PHONE_LANDSCAPE:"(min-width: 479px) and (max-width: 767px) and (orientation: landscape)",get isPhoneLandscape(){return R(this.PHONE_LANDSCAPE)},TABLET:"(min-width: 768px) and (max-width: 1024px)",get isTablet(){return R(this.TABLET)},SMALL_PHONE:"(min-width: 319px) and (max-width: 480px) and (max-height: 640px)",get isSmallPhone(){return R(this.SMALL_PHONE)},WATCH:"(max-width: 319px)",get isWatch(){return R(this.WATCH)},SHORT:"(min-width: 479px) and (max-height: 320px)",get isShort(){return R(this.SHORT)},PWA:"(display-mode: standalone)",get isPWA(){return R(this.PWA)},MOTION_REDUCE:"(prefers-reduced-motion: reduce)",get isMotionReduce(){return R(this.MOTION_REDUCE)},DATA_REDUCE:"(prefers-reduced-data: reduce)",get isDataReduce(){return R(this.DATA_REDUCE)}},os="1.6.5";window.__GEM_DEVTOOLS__HOOK__&&Object.assign(window.__GEM_DEVTOOLS__HOOK__,T({},f)),a.GemElement=A,a.GemError=K,a.GemLightRouteElement=Xn,a.GemReflectElement=zt,a.GemUnsafeElement=ot,a.GemUseElement=we,a.I18n=rs,a.LinkedList=St,a.PropProxyMap=_t,a.QueryString=fe,a.SVGTemplateResult=gt,a.SheetToken=Ue,a.StoreListenerMap=ne,a.TemplateResult=ke,a.absoluteLocation=xe,a.addMicrotask=H,a.addMicrotaskToStack=yn,a.adoptedStyle=Dn,a.attribute=k,a.basePathStore=xt,a.boolattribute=Gn,a.camelToKebabCase=I,a.classMap=Ct,a.cleanObject=Me,a.connect=se,a.connectStore=ae,a.createCSSSheet=En,a.createHistoryParams=Zn,a.createModalClass=js,a.createPath=Kt,a.createStore=z,a.createStoreSet=Pn,a.createTheme=Ks,a.css=wn,a.customElement=qn,a.defineAttribute=Xe,a.defineCSSState=tt,a.defineProperty=ye,a.defineRef=et,a.del=ei,a.directive=J,a.disconnect=Tt,a.emitter=Ge,a.get=Xs,a.getThemeProp=Us,a.getThemeStore=ss,a.globalemitter=Vn,a.guard=Nn,a.history=S,a.html=M,a.ifDefined=Mt,a.isArrayChange=bt,a.kebabToCamelCase=pe,a.matchPath=Bt,a.mediaQuery=si,a.nativeDefineElement=nt,a.numattribute=Hn,a.part=Dt,a.partMap=bn,a.post=ni,a.property=q,a.put=ti,a.randomStr=Ne,a.raw=me,a.refobject=An,a.removeItems=Pt,a.render=qe,a.repeat=$n,a.request=De,a.rootElement=jn,a.slot=In,a.splice=is,a.state=Ae,a.styleMap=vn,a.styled=_n,a.svg=gn,a.titleStore=oe,a.updateStore=P,a.updateTheme=zs,a.version=os,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GemElement } from '
|
|
1
|
+
import { GemElement } from '../../lib/element';
|
|
2
2
|
/**
|
|
3
3
|
* 在模版中声明的 dialog,使用 `open` 方法 打开;
|
|
4
4
|
* 如果要应用关闭动画,可以在动画执行完后设置 `hidden` 属性;
|
|
@@ -6,11 +6,11 @@ import { GemElement } from '../lib/element';
|
|
|
6
6
|
*
|
|
7
7
|
* @attr label
|
|
8
8
|
*/
|
|
9
|
-
export declare abstract class
|
|
9
|
+
export declare abstract class GemDialogBaseElement extends GemElement {
|
|
10
10
|
#private;
|
|
11
|
+
label: string;
|
|
11
12
|
opened: boolean;
|
|
12
13
|
inert: boolean;
|
|
13
|
-
label: string;
|
|
14
14
|
constructor();
|
|
15
15
|
/**
|
|
16
16
|
* @final
|
|
@@ -35,4 +35,4 @@ export declare abstract class DialogBaseElement extends GemElement {
|
|
|
35
35
|
*/
|
|
36
36
|
forceClose: () => void;
|
|
37
37
|
}
|
|
38
|
-
//# sourceMappingURL=dialog
|
|
38
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/elements/base/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C;;;;;;GAMG;AACH,8BACsB,oBAAqB,SAAQ,UAAU;;IAChD,KAAK,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAEvB,KAAK,UAAQ;;IAYb;;;OAGG;IACH,WAAW,aAUT;IAEF;;;OAGG;IACH,UAAU,aAUR;IAEF,YAAY;IACZ,IAAI,aASF;IAEF,WAAW;IAIX,YAAY;IACZ,KAAK,aAEH;IAEF;;;;;OAKG;IACH,UAAU,aAGR;CACH"}
|
|
@@ -15,10 +15,10 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
15
15
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
16
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
17
|
};
|
|
18
|
-
var
|
|
19
|
-
import { GemElement } from '
|
|
20
|
-
import { attribute, state, connectStore } from '
|
|
21
|
-
import { history } from '
|
|
18
|
+
var _GemDialogBaseElement_nextSibling, _GemDialogBaseElement_parentElement, _GemDialogBaseElement_inertStore;
|
|
19
|
+
import { GemElement } from '../../lib/element';
|
|
20
|
+
import { attribute, state, connectStore } from '../../lib/decorators';
|
|
21
|
+
import { history } from '../../lib/history';
|
|
22
22
|
/**
|
|
23
23
|
* 在模版中声明的 dialog,使用 `open` 方法 打开;
|
|
24
24
|
* 如果要应用关闭动画,可以在动画执行完后设置 `hidden` 属性;
|
|
@@ -26,15 +26,13 @@ import { history } from '../lib/history';
|
|
|
26
26
|
*
|
|
27
27
|
* @attr label
|
|
28
28
|
*/
|
|
29
|
-
let
|
|
29
|
+
let GemDialogBaseElement = class GemDialogBaseElement extends GemElement {
|
|
30
30
|
constructor() {
|
|
31
31
|
super();
|
|
32
|
-
this.opened = false;
|
|
33
32
|
this.inert = true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.label = '';
|
|
33
|
+
_GemDialogBaseElement_nextSibling.set(this, void 0);
|
|
34
|
+
_GemDialogBaseElement_parentElement.set(this, void 0);
|
|
35
|
+
_GemDialogBaseElement_inertStore.set(this, []);
|
|
38
36
|
/**
|
|
39
37
|
* @final
|
|
40
38
|
* 进入关闭状态
|
|
@@ -42,12 +40,12 @@ let DialogBaseElement = class DialogBaseElement extends GemElement {
|
|
|
42
40
|
this.closeHandle = () => {
|
|
43
41
|
var _a;
|
|
44
42
|
this.inert = true;
|
|
45
|
-
__classPrivateFieldGet(this,
|
|
46
|
-
if (__classPrivateFieldGet(this,
|
|
47
|
-
__classPrivateFieldGet(this,
|
|
43
|
+
__classPrivateFieldGet(this, _GemDialogBaseElement_inertStore, "f").forEach((e) => (e.inert = false));
|
|
44
|
+
if (__classPrivateFieldGet(this, _GemDialogBaseElement_nextSibling, "f")) {
|
|
45
|
+
__classPrivateFieldGet(this, _GemDialogBaseElement_nextSibling, "f").before(this);
|
|
48
46
|
}
|
|
49
|
-
else if (__classPrivateFieldGet(this,
|
|
50
|
-
(_a = __classPrivateFieldGet(this,
|
|
47
|
+
else if (__classPrivateFieldGet(this, _GemDialogBaseElement_parentElement, "f")) {
|
|
48
|
+
(_a = __classPrivateFieldGet(this, _GemDialogBaseElement_parentElement, "f")) === null || _a === void 0 ? void 0 : _a.appendChild(this);
|
|
51
49
|
}
|
|
52
50
|
this.dispatchEvent(new CustomEvent('close'));
|
|
53
51
|
this.opened = false;
|
|
@@ -59,10 +57,10 @@ let DialogBaseElement = class DialogBaseElement extends GemElement {
|
|
|
59
57
|
this.openHandle = () => {
|
|
60
58
|
this.hidden = false;
|
|
61
59
|
this.inert = false;
|
|
62
|
-
__classPrivateFieldSet(this,
|
|
63
|
-
__classPrivateFieldSet(this,
|
|
64
|
-
__classPrivateFieldSet(this,
|
|
65
|
-
__classPrivateFieldGet(this,
|
|
60
|
+
__classPrivateFieldSet(this, _GemDialogBaseElement_nextSibling, this.nextSibling, "f");
|
|
61
|
+
__classPrivateFieldSet(this, _GemDialogBaseElement_parentElement, this.parentElement || this.getRootNode(), "f");
|
|
62
|
+
__classPrivateFieldSet(this, _GemDialogBaseElement_inertStore, [...document.body.children].filter((e) => !e.inert), "f");
|
|
63
|
+
__classPrivateFieldGet(this, _GemDialogBaseElement_inertStore, "f").forEach((e) => (e.inert = true));
|
|
66
64
|
document.body.append(this);
|
|
67
65
|
this.dispatchEvent(new CustomEvent('open'));
|
|
68
66
|
this.opened = true;
|
|
@@ -100,15 +98,15 @@ let DialogBaseElement = class DialogBaseElement extends GemElement {
|
|
|
100
98
|
return true;
|
|
101
99
|
}
|
|
102
100
|
};
|
|
103
|
-
|
|
104
|
-
__decorate([
|
|
105
|
-
state
|
|
106
|
-
], DialogBaseElement.prototype, "opened", void 0);
|
|
101
|
+
_GemDialogBaseElement_nextSibling = new WeakMap(), _GemDialogBaseElement_parentElement = new WeakMap(), _GemDialogBaseElement_inertStore = new WeakMap();
|
|
107
102
|
__decorate([
|
|
108
103
|
attribute
|
|
109
|
-
],
|
|
110
|
-
|
|
104
|
+
], GemDialogBaseElement.prototype, "label", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
state
|
|
107
|
+
], GemDialogBaseElement.prototype, "opened", void 0);
|
|
108
|
+
GemDialogBaseElement = __decorate([
|
|
111
109
|
connectStore(history.store)
|
|
112
|
-
],
|
|
113
|
-
export {
|
|
114
|
-
//# sourceMappingURL=dialog
|
|
110
|
+
], GemDialogBaseElement);
|
|
111
|
+
export { GemDialogBaseElement };
|
|
112
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/elements/base/dialog.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;GAMG;AAEH,IAAsB,oBAAoB,GAA1C,MAAsB,oBAAqB,SAAQ,UAAU;IAU3D;QACE,KAAK,EAAE,CAAC;QAPV,UAAK,GAAG,IAAI,CAAC;QAEb,oDAA+B;QAC/B,sDAA4B;QAC5B,2CAA6B,EAAE,EAAC;QAQhC;;;WAGG;QACH,gBAAW,GAAG,GAAG,EAAE;;YACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,uBAAA,IAAI,wCAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;YACnD,IAAI,uBAAA,IAAI,yCAAa,EAAE;gBACrB,uBAAA,IAAI,yCAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAChC;iBAAM,IAAI,uBAAA,IAAI,2CAAe,EAAE;gBAC9B,MAAA,uBAAA,IAAI,2CAAe,0CAAE,WAAW,CAAC,IAAI,CAAC,CAAC;aACxC;YACD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;YAC7C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC;QAEF;;;WAGG;QACH,eAAU,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,uBAAA,IAAI,qCAAgB,IAAI,CAAC,WAAW,MAAA,CAAC;YACrC,uBAAA,IAAI,uCAAkB,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,EAAE,MAAA,CAAC;YAC/D,uBAAA,IAAI,oCAAgB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAA,CAAC;YAC1F,uBAAA,IAAI,wCAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;YAClD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC;QAEF,YAAY;QACZ,SAAI,GAAG,GAAG,EAAE;YACV,IAAI,IAAI,CAAC,MAAM;gBAAE,OAAO;YACxB,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,UAAU;gBACrB,KAAK,EAAE,IAAI,CAAC,WAAW;gBACvB,WAAW,EAAE,IAAI,CAAC,WAAW;aAC9B,CAAC,CAAC;QACL,CAAC,CAAC;QAMF,YAAY;QACZ,UAAK,GAAG,GAAG,EAAE;YACX,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC,CAAC;QAEF;;;;;WAKG;QACH,eAAU,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC;QAlEA,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,MAAM,CAAC;IACpC,CAAC;IA8CD,WAAW;QACT,OAAO,IAAI,CAAC;IACd,CAAC;CAiBF,CAAA;;AA9EY;IAAV,SAAS;mDAAe;AAClB;IAAN,KAAK;oDAAiB;AAFH,oBAAoB;IADzC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC;GACN,oBAAoB,CA+EzC;SA/EqB,oBAAoB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { GemElement } from '../../lib/element';
|
|
2
|
+
import { Emitter } from '../../lib/decorators';
|
|
3
|
+
export declare type PanEventDetail = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
clientX: number;
|
|
7
|
+
clientY: number;
|
|
8
|
+
timeStamp: number;
|
|
9
|
+
isPrimary: boolean;
|
|
10
|
+
pointerId: number;
|
|
11
|
+
};
|
|
12
|
+
export interface SwipeEventDetail {
|
|
13
|
+
direction: 'top' | 'right' | 'bottom' | 'left';
|
|
14
|
+
speed: number;
|
|
15
|
+
}
|
|
16
|
+
export interface PinchEventDetail {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
scale: number;
|
|
20
|
+
}
|
|
21
|
+
export interface RotateEventDetail {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
rotate: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 块级元素,如果要设置成 `contents`,则内容块要设置 `touch-action: none`
|
|
28
|
+
* https://javascript.info/pointer-events#event-pointercancel
|
|
29
|
+
*
|
|
30
|
+
* 在移动端上,必须设置 `touch-action` 以允许滚动等原生动作
|
|
31
|
+
*
|
|
32
|
+
* 为什么空白区域会自动触发 `pointercancel`?
|
|
33
|
+
*
|
|
34
|
+
* @event pan
|
|
35
|
+
* @event pinch
|
|
36
|
+
* @event rotate
|
|
37
|
+
* @event swipe
|
|
38
|
+
* @event press
|
|
39
|
+
* @event end
|
|
40
|
+
*
|
|
41
|
+
* @attr touch-action
|
|
42
|
+
*/
|
|
43
|
+
export declare class GemGestureElement extends GemElement {
|
|
44
|
+
pan: Emitter<PanEventDetail>;
|
|
45
|
+
pinch: Emitter<PinchEventDetail>;
|
|
46
|
+
rotate: Emitter<RotateEventDetail>;
|
|
47
|
+
swipe: Emitter<SwipeEventDetail>;
|
|
48
|
+
press: Emitter<null>;
|
|
49
|
+
end: Emitter<null>;
|
|
50
|
+
touchAction: string;
|
|
51
|
+
pressed: boolean;
|
|
52
|
+
pressTimer: number;
|
|
53
|
+
startEventMap: Map<number, PointerEvent>;
|
|
54
|
+
movesMap: Map<number, PanEventDetail[]>;
|
|
55
|
+
constructor();
|
|
56
|
+
getMoves(pointerId: number): PanEventDetail[];
|
|
57
|
+
getStartEvent(pointerId: number): PointerEvent;
|
|
58
|
+
getOtherLastmove(pointerId: number): PanEventDetail | undefined;
|
|
59
|
+
getMovementX(x: number, y: number): number;
|
|
60
|
+
getMovementY(x: number, y: number): number;
|
|
61
|
+
onStart(evt: PointerEvent): void;
|
|
62
|
+
onMove(evt: PointerEvent): void;
|
|
63
|
+
onEnd(evt: PointerEvent): void;
|
|
64
|
+
render(): import("lit-html/lib/template-result").TemplateResult;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=gesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gesture.d.ts","sourceRoot":"","sources":["../../src/elements/base/gesture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAsB,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEnE,oBAAY,cAAc,GAAG;IAE3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,gBAAgB;IAE/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,iBAAiB;IAEhC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;CAChB;AAiBD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IACtC,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjC,MAAM,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACnC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,WAAW,EAAE,MAAM,CAAC;IAE/B,OAAO,UAAS;IAChB,UAAU,SAAK;IAEf,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAa;IACrD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAa;;IAWpD,QAAQ,CAAC,SAAS,EAAE,MAAM;IAI1B,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,gBAAgB,CAAC,SAAS,EAAE,MAAM;IASlC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAgBjC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAgBjC,OAAO,CAAC,GAAG,EAAE,YAAY;IAczB,MAAM,CAAC,GAAG,EAAE,YAAY;IAkDxB,KAAK,CAAC,GAAG,EAAE,YAAY;IA2CvB,MAAM;CAYP"}
|