@mantou/gem 1.6.0 → 1.6.1
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/element.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/element.ts +1 -1
- package/src/lib/version.ts +1 -1
- package/umd.js +1 -1
- package/umd.js.map +1 -1
package/lib/element.js
CHANGED
|
@@ -248,7 +248,7 @@ export class GemElement extends HTMLElement {
|
|
|
248
248
|
if (!__classPrivateFieldGet(this, _GemElement_internals, "f")) {
|
|
249
249
|
const getCustomStateSet = () => {
|
|
250
250
|
// https://wicg.github.io/custom-state-pseudo-class/
|
|
251
|
-
const getV = (v) => v.replace(
|
|
251
|
+
const getV = (v) => v.replace(/-/g, '');
|
|
252
252
|
return {
|
|
253
253
|
has: (v) => getV(v) in this.dataset,
|
|
254
254
|
add: (v) => {
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.6.
|
|
1
|
+
export declare const version = "1.6.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
package/src/lib/element.ts
CHANGED
|
@@ -149,7 +149,7 @@ export abstract class GemElement<T = Record<string, unknown>> extends HTMLElemen
|
|
|
149
149
|
if (!this.#internals) {
|
|
150
150
|
const getCustomStateSet = () => {
|
|
151
151
|
// https://wicg.github.io/custom-state-pseudo-class/
|
|
152
|
-
const getV = (v: string) => v.replace(
|
|
152
|
+
const getV = (v: string) => v.replace(/-/g, '');
|
|
153
153
|
return {
|
|
154
154
|
has: (v) => getV(v) in this.dataset,
|
|
155
155
|
add: (v) => {
|
package/src/lib/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Do not modify manually
|
|
2
|
-
export const version = '1.6.
|
|
2
|
+
export const version = '1.6.1';
|
package/umd.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<style media=${t.media.mediaText}>
|
|
4
4
|
${t.style}
|
|
5
5
|
</style>
|
|
6
|
-
`))}`;return this.render?Ft`${this.render()}${n}`:xe(this,re,"f")===this?void 0:Ft`<slot></slot>${n}`})),ye.set(this,(()=>!this.shouldUpdate||this.shouldUpdate())),we.set(this,(()=>{if(this.isConnected&&xe(this,ye,"f").call(this)){const t=xe(this,ve,"f").call(this);void 0!==t&&Bt(t,xe(this,re,"f")),p(xe(this,Se,"f")),p(xe(this,fe,"f"))}})),be.set(this,(()=>{xe(this,ce,"f")?Te.add(xe(this,we,"f")):xe(this,we,"f").call(this)})),this.update=()=>{p(xe(this,be,"f"))},Se.set(this,(()=>{var t;null===(t=this.updated)||void 0===t||t.call(this)})),Ee.set(this,(()=>{var t,e,n;if(xe(this,le,"f"))return void Pe(this,le,!1,"f");null===(t=this.willMount)||void 0===t||t.call(this);const{observedStores:s,rootElement:i}=this.constructor;null==s||s.forEach((t=>{U(t,xe(this,be,"f"))}));const o=xe(this,ve,"f").call(this);if(void 0!==o&&Bt(o,xe(this,re,"f")),Pe(this,de,null===(e=this.mounted)||void 0===e?void 0:e.call(this),"f"),xe(this,me,"f").call(this),i&&(null===(n=this.getRootNode().host)||void 0===n?void 0:n.tagName)!==i.toUpperCase())throw new j("not allow current root type")})),p((()=>this[Oe]=!1)),this[Oe]=!0,this[$e]=()=>{this.isConnected&&p(xe(this,be,"f"))},Pe(this,ce,t,"f"),Pe(this,re,e?this:this.attachShadow({mode:"open",delegatesFocus:n}),"f");const{adoptedStyleSheets:s}=new.target;if(s){const t=s.map((t=>t[x]||t));this.shadowRoot?this.shadowRoot.adoptedStyleSheets=t:this.effect((()=>{const e=this.getRootNode();return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...t],()=>{e.adoptedStyleSheets=R(e.adoptedStyleSheets,t)}}),(()=>[]))}}get internals(){if(!xe(this,ae,"f")){const t=()=>{const t=t=>t.replace(
|
|
6
|
+
`))}`;return this.render?Ft`${this.render()}${n}`:xe(this,re,"f")===this?void 0:Ft`<slot></slot>${n}`})),ye.set(this,(()=>!this.shouldUpdate||this.shouldUpdate())),we.set(this,(()=>{if(this.isConnected&&xe(this,ye,"f").call(this)){const t=xe(this,ve,"f").call(this);void 0!==t&&Bt(t,xe(this,re,"f")),p(xe(this,Se,"f")),p(xe(this,fe,"f"))}})),be.set(this,(()=>{xe(this,ce,"f")?Te.add(xe(this,we,"f")):xe(this,we,"f").call(this)})),this.update=()=>{p(xe(this,be,"f"))},Se.set(this,(()=>{var t;null===(t=this.updated)||void 0===t||t.call(this)})),Ee.set(this,(()=>{var t,e,n;if(xe(this,le,"f"))return void Pe(this,le,!1,"f");null===(t=this.willMount)||void 0===t||t.call(this);const{observedStores:s,rootElement:i}=this.constructor;null==s||s.forEach((t=>{U(t,xe(this,be,"f"))}));const o=xe(this,ve,"f").call(this);if(void 0!==o&&Bt(o,xe(this,re,"f")),Pe(this,de,null===(e=this.mounted)||void 0===e?void 0:e.call(this),"f"),xe(this,me,"f").call(this),i&&(null===(n=this.getRootNode().host)||void 0===n?void 0:n.tagName)!==i.toUpperCase())throw new j("not allow current root type")})),p((()=>this[Oe]=!1)),this[Oe]=!0,this[$e]=()=>{this.isConnected&&p(xe(this,be,"f"))},Pe(this,ce,t,"f"),Pe(this,re,e?this:this.attachShadow({mode:"open",delegatesFocus:n}),"f");const{adoptedStyleSheets:s}=new.target;if(s){const t=s.map((t=>t[x]||t));this.shadowRoot?this.shadowRoot.adoptedStyleSheets=t:this.effect((()=>{const e=this.getRootNode();return e.adoptedStyleSheets=[...e.adoptedStyleSheets,...t],()=>{e.adoptedStyleSheets=R(e.adoptedStyleSheets,t)}}),(()=>[]))}}get internals(){if(!xe(this,ae,"f")){const t=()=>{const t=t=>t.replace(/-/g,"");return{has:e=>t(e)in this.dataset,add:e=>{this.dataset[t(e)]=""},delete:e=>delete this.dataset[t(e)]}};this.attachInternals||(this.attachInternals=()=>({states:t()})),Pe(this,ae,this.attachInternals(),"f"),xe(this,ae,"f").states||(xe(this,ae,"f").states=t())}return xe(this,ae,"f")}attributeChangedCallback(){this.isConnected&&p(xe(this,be,"f"))}closestElement(t){const e="function"==typeof t,n="string"==typeof t&&t.toUpperCase(),s=i=>{const o=i.parentElement||i.getRootNode().host;if(!o)return null;if(e){if(o.constructor===t)return o}else if(o.tagName===n)return o;return s(o)};return s(this)}connectedCallback(){xe(this,ce,"f")?Te.add(xe(this,Ee,"f")):xe(this,Ee,"f").call(this)}disconnectedCallback(){var t,e,n;if(this.isConnected)return void Pe(this,le,!0,"f");const{observedStores:s}=this.constructor;null==s||s.forEach((t=>{G(t,xe(this,be,"f"))})),_e(xe(this,de,"f")),null===(t=this.unmounted)||void 0===t||t.call(this),null===(e=xe(this,he,"f"))||void 0===e||e.forEach((t=>{_e(t.preCallback)})),Pe(this,ue,null===(n=xe(this,ue,"f"))||void 0===n?void 0:n.filter((({initialized:t})=>!t)),"f")}}re=new WeakMap,ae=new WeakMap,le=new WeakMap,ce=new WeakMap,he=new WeakMap,ue=new WeakMap,de=new WeakMap,pe=new WeakMap,fe=new WeakMap,ge=new WeakMap,me=new WeakMap,ve=new WeakMap,ye=new WeakMap,we=new WeakMap,be=new WeakMap,Se=new WeakMap,Ee=new WeakMap;const Le=new w;function je(t,e,n){const{booleanAttributes:s,numberAttributes:i}=t.constructor;Object.defineProperty(t,e,{configurable:!0,get(){if(!(Oe in this))return;const t=this.getAttribute(n);return(null==s?void 0:s.has(n))?null!==t:(null==i?void 0:i.has(n))?Number(t):t||""},set(t){const i=this,o=Le.get(this),r=o[e],a=i.getAttribute(n);if(this[Oe]&&null!==a&&!r)return;o[e]=!0;const l=null==s?void 0:s.has(n);null==t?i.removeAttribute(n):l?i.toggleAttribute(n,!!t):a!==String(t)&&i.setAttribute(n,String(t))}})}const Me=Symbol("event handle");function Re(t,e,n,s){Object.defineProperty(t,e,{configurable:!0,get(){const t=Le.get(this)[e];return t||!n?t:(this[e]=ke,this[e])},set(t){const i=this,o=Le.get(i);t!==o[e]&&(n?(o[e]=(null==t?void 0:t[Me])?t:(e,o)=>{const r=new CustomEvent(n,Object.assign(Object.assign(Object.assign({},o),s),{detail:e}));i.dispatchEvent(r),t(e,o)},o[e][Me]=!0):(o[e]=t,this[$e]()))}})}function Ae(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){const t=Le.get(this);let s=t[e];if(!s){const i=this,o=i.shadowRoot||i;s={get ref(){return n},get element(){const t=[...o.querySelectorAll("gem-reflect")].map((t=>t.target));for(const e of[o,...t]){const t=e.querySelector(`[ref=${n}]`);if(t)return t}}},t[e]=s}return s}})}function He(t,e,n){Object.defineProperty(t,e,{configurable:!0,get(){var t;const{states:e}=this.internals;return null===(t=e.has)||void 0===t?void 0:t.call(e,n)},set(t){const{states:e}=this.internals;t?e.add(n):e.delete(n)}})}const We=customElements.define.bind(customElements);function Ve(t,e,n,s=!1){const i=t.constructor,o=i[e];i.hasOwnProperty(e)||Object.defineProperty(i,e,{value:s?new Set(o):o?Array.from(o):[]}),i[e][s?"add":"push"](n)}function De(t,e){const n=`${$(e)}-${_()}`;Ve(t,"defineRefs",n),Ae(t,e,n)}function Ie(t,e,n){Ve(t,"observedAttributes",n),je(t,e,n)}function qe(t,e){Ie(t,e,$(e))}function Ue(t,e){const n=$(e);Ve(t,"booleanAttributes",n,!0),Ie(t,e,n)}function Ge(t,e){const n=$(e);Ve(t,"numberAttributes",n,!0),Ie(t,e,n)}function Be(t,e){Ve(t,"observedPropertys",e),Re(t,e)}function Fe(t,e){const n=$(e);Ve(t,"defineCSSStates",n),He(t,e,`--${n}`)}function ze(t,e){const n=$(t[e]||e);t[e]=n,Ve(t instanceof Ne?t:t.prototype,"defineSlots",n)}function Je(t,e){const n=$(t[e]||e);t[e]=n,Ve(t instanceof Ne?t:t.prototype,"defineParts",n)}function Ke(t,e){Ze(t,e)}function Qe(t,e){Ze(t,e,{bubbles:!0,composed:!0})}function Ze(t,e,n){const s=$(e);Ve(t,"defineEvents",s),Re(t,e,s,n)}function Xe(t){return function(e){Ve(e.prototype,"adoptedStyleSheets",t)}}function Ye(t){return function(e){Ve(e.prototype,"observedStores",t)}}function tn(t){return function(e){e.rootElement=t}}function en(t){return function(e){We(t,e)}}customElements.define=(t,e,n)=>{if(e.prototype instanceof Ne){const{observedAttributes:t,observedPropertys:n,defineEvents:s,defineCSSStates:i,defineRefs:o}=e;null==t||t.forEach((t=>je(e.prototype,N(t),t))),null==n||n.forEach((t=>Re(e.prototype,t))),null==s||s.forEach((t=>Re(e.prototype,N(t),t))),null==i||i.forEach((t=>He(e.prototype,N(t),`--${t}`))),null==o||o.forEach((t=>Ae(e.prototype,N(t),t)))}We(t,e,n)};const nn="1.6.1";window.__GEM_DEVTOOLS__HOOK__&&Object.assign(window.__GEM_DEVTOOLS__HOOK__,Object.assign({},n));var sn,on,rn,an,ln=function(t,e,n,s){var i,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(o<3?i(r):o>3?i(e,n,r):i(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},cn=function(t,e,n,s,i){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?i.call(t,n):i?i.value=n:e.set(t,n),n},hn=function(t,e,n,s){if("a"===n&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?s:"a"===n?s.call(t):s?s.value:e.get(t)};class un extends RegExp{constructor(t){const e={};let n=0;super(`^${t.replace(/:([^/$]+)/g,((t,s)=>(e[s]=n++,"([^/]+)"))).replace("*",".*")}$`,"i"),this.namePosition=e}}function dn(t,e){const n=new un(t),s=e.match(n)||`${e}/`.match(n);if(!s)return null;const i={};return s&&Object.keys(n.namePosition).forEach((t=>{i[t]=s[n.namePosition[t]+1]})),i}function pn(t,e){let n=t.pattern;const s=null==e?void 0:e.params;return s&&Object.keys(s).forEach((t=>{n=n.replace(new RegExp(`:${t}`,"g"),s[t])})),n}function fn(t,e){const n=pn(t,e);return Object.assign({path:n},e)}let gn=an=class extends Ne{constructor({isLight:t,routes:e}={}){super({isLight:t}),this.currentParams={},sn.set(this,void 0),this.state={content:void 0},on.set(this,(()=>{if(this.locationStore){const{path:t,query:e,data:n}=B.getParams();q(this.locationStore,{path:t,params:this.currentParams,query:e,data:n})}})),rn.set(this,((t,e,n)=>{cn(this,sn,void 0,"f"),this.currentRoute=t,this.currentParams=e,this.setState({content:n}),this.routeChange(this.currentRoute);const s=null==t?void 0:t.title;s&&q(rt,{title:s}),hn(this,on,"f").call(this)})),this.routes=e}mounted(){this.effect((([t,e],n)=>{if(n&&t===n[0]&&e===n[1])return void hn(this,on,"f").call(this);const{route:s,params:i={}}=an.findRoute(this.routes,e),{redirect:o,content:r,getContent:a}=s||{};if(o)return void B.replace({path:o});const l=r||(null==a?void 0:a(i));if(l instanceof Promise){this.loading(s),cn(this,sn,l,"f");const t=()=>hn(this,sn,"f")===l;l.then((e=>{t()&&hn(this,rn,"f").call(this,s,i,e)})).catch((e=>{t()&&this.error(e)}))}else hn(this,rn,"f").call(this,s,i,l)}),(()=>{const{path:t}=B.getParams();return[this.key,t,location.search]}))}shouldUpdate(){return!this.inert}render(){const{content:t}=this.state;return this.shadowRoot?Ft`
|
|
7
7
|
<style>
|
|
8
8
|
:host,
|
|
9
9
|
:not(:defined) {
|