mates 0.0.17 → 0.0.20
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 +29 -2
- package/dist/examples/src/Counter/Counter.d.ts +2 -0
- package/dist/examples/src/Counter/Counter.d.ts.map +1 -0
- package/dist/examples/src/Counter/CounterWithAtoms.d.ts +2 -0
- package/dist/examples/src/Counter/CounterWithAtoms.d.ts.map +1 -0
- package/dist/examples/src/Counter/index.d.ts +3 -0
- package/dist/examples/src/Counter/index.d.ts.map +1 -0
- package/dist/examples/src/Scope Examples/MultiScopeDemo.d.ts +2 -0
- package/dist/examples/src/Scope Examples/MultiScopeDemo.d.ts.map +1 -0
- package/dist/examples/src/Scope Examples/ScopeDemo.d.ts +2 -0
- package/dist/examples/src/Scope Examples/ScopeDemo.d.ts.map +1 -0
- package/dist/examples/src/Scope Examples/SimpleScopeExample.d.ts +2 -0
- package/dist/examples/src/Scope Examples/SimpleScopeExample.d.ts.map +1 -0
- package/dist/examples/src/Scope Examples/index.d.ts +4 -0
- package/dist/examples/src/Scope Examples/index.d.ts.map +1 -0
- package/dist/examples/src/Scopes Test/A.d.ts +3 -0
- package/dist/examples/src/Scopes Test/A.d.ts.map +1 -0
- package/dist/examples/src/ThemeContext.ts/ThemeDemo.d.ts +4 -0
- package/dist/examples/src/ThemeContext.ts/ThemeDemo.d.ts.map +1 -0
- package/dist/examples/src/Todo/Todo.d.ts +2 -0
- package/dist/examples/src/Todo/Todo.d.ts.map +1 -0
- package/dist/examples/src/Todo/TodoWithAtoms.d.ts +2 -0
- package/dist/examples/src/Todo/TodoWithAtoms.d.ts.map +1 -0
- package/dist/examples/src/Todo/index.d.ts +3 -0
- package/dist/examples/src/Todo/index.d.ts.map +1 -0
- package/dist/examples/src/main.d.ts +3 -0
- package/dist/examples/src/main.d.ts.map +1 -0
- package/dist/examples/vite.config.d.ts +3 -0
- package/dist/examples/vite.config.d.ts.map +1 -0
- package/dist/index.esm.js +7 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/Context.d.ts +6 -0
- package/dist/lib/Context.d.ts.map +1 -0
- package/dist/{atom.d.ts → lib/atom.d.ts} +3 -3
- package/dist/lib/atom.d.ts.map +1 -0
- package/dist/lib/bubbles.d.ts.map +1 -0
- package/dist/lib/compute.d.ts.map +1 -0
- package/dist/{index.d.ts → lib/index.d.ts} +4 -1
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/molecule.d.ts.map +1 -0
- package/dist/{pathResolver.d.ts → lib/pathResolver.d.ts} +1 -1
- package/dist/lib/pathResolver.d.ts.map +1 -0
- package/dist/lib/scope.d.ts +14 -0
- package/dist/lib/scope.d.ts.map +1 -0
- package/dist/lib/store.d.ts +2 -0
- package/dist/lib/store.d.ts.map +1 -0
- package/dist/{styleDirectives.d.ts → lib/styleDirectives.d.ts} +6 -0
- package/dist/lib/styleDirectives.d.ts.map +1 -0
- package/dist/{units.d.ts → lib/units.d.ts} +2 -0
- package/dist/lib/units.d.ts.map +1 -0
- package/dist/lib/useRefEffect.d.ts.map +1 -0
- package/dist/{useStore.d.ts → lib/useStore.d.ts} +2 -1
- package/dist/lib/useStore.d.ts.map +1 -0
- package/dist/{view.d.ts → lib/view.d.ts} +2 -1
- package/dist/lib/view.d.ts.map +1 -0
- package/dist/{x-view.d.ts → lib/x-view.d.ts} +3 -1
- package/dist/lib/x-view.d.ts.map +1 -0
- package/dist/lib/xProvider.d.ts +2 -0
- package/dist/lib/xProvider.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/atom.d.ts.map +0 -1
- package/dist/bubbles.d.ts.map +0 -1
- package/dist/compute.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/molecule.d.ts.map +0 -1
- package/dist/pathResolver.d.ts.map +0 -1
- package/dist/store.d.ts +0 -2
- package/dist/store.d.ts.map +0 -1
- package/dist/styleDirectives.d.ts.map +0 -1
- package/dist/units.d.ts.map +0 -1
- package/dist/useRefEffect.d.ts.map +0 -1
- package/dist/useStore.d.ts.map +0 -1
- package/dist/view.d.ts.map +0 -1
- package/dist/x-view.d.ts.map +0 -1
- package/dist/xProvider.d.ts +0 -13
- package/dist/xProvider.d.ts.map +0 -1
- /package/dist/{bubbles.d.ts → lib/bubbles.d.ts} +0 -0
- /package/dist/{compute.d.ts → lib/compute.d.ts} +0 -0
- /package/dist/{molecule.d.ts → lib/molecule.d.ts} +0 -0
- /package/dist/{useRefEffect.d.ts → lib/useRefEffect.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -47,10 +47,37 @@ const CounterView = (props) => {
|
|
|
47
47
|
renderView(CounterView, "app");
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
**count** is a **local let variable** that holds value. which can only be changed froma setter function.
|
|
51
|
+
**incr** is a **setter** function, that when called, updates the view. it has to be non-async.
|
|
52
|
+
|
|
53
|
+
### Scopes
|
|
54
|
+
|
|
55
|
+
Mates introduces a new feature called Scopes. an amazing way to share state with child views (components). using Scopes, child components can access parent's state directly without using props.
|
|
56
|
+
|
|
50
57
|
#### Formatting Support:
|
|
51
58
|
|
|
52
59
|
you can install lit-html plugin on your IDE like vs code or cursor for proper formatting for your template strings.
|
|
53
60
|
|
|
61
|
+
### props()
|
|
62
|
+
|
|
63
|
+
In Mates, props can be passed to child views as object. props is a funciton and not an object but it's passed as object to child component. the view will have to call props() to get the projects object.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const CounterView = () => {
|
|
67
|
+
let count = 0;
|
|
68
|
+
let incr = setter(() => count++);
|
|
69
|
+
return () => html`
|
|
70
|
+
<div>count is: ${count}</div>
|
|
71
|
+
<div>${view(ChildView, { count })}</div>
|
|
72
|
+
`;
|
|
73
|
+
};
|
|
74
|
+
const ChildView = (props: Props<{ count: number }>) => {
|
|
75
|
+
return html`parent count is : ${props().count}`;
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**note** please don't destructure props into local variables in the outer function, as it breaks connection from the parent object. but you can do this in the inner function as inner function gets executed everytime the parent view is updated. so you will have always the latest value.
|
|
80
|
+
|
|
54
81
|
### ⚛️ Atoms: Simple Reactive State
|
|
55
82
|
|
|
56
83
|
Atoms hold mutable values. they can hold any Javascript value like primitive or objects or maps or sets.etc They store a single value that can be read, set (replaced with new value), or updated (if it's an object). They support typescript fully.
|
|
@@ -137,9 +164,9 @@ const todoList = unit({
|
|
|
137
164
|
this._setUsers(await fetch("/users").then((d) => d.json()));
|
|
138
165
|
this._setIsLoading(false);
|
|
139
166
|
},
|
|
140
|
-
getUsersCount(){
|
|
167
|
+
getUsersCount() {
|
|
141
168
|
return this.users.length;
|
|
142
|
-
}
|
|
169
|
+
},
|
|
143
170
|
});
|
|
144
171
|
```
|
|
145
172
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Counter.d.ts","sourceRoot":"","sources":["../../../../examples/src/Counter/Counter.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,wEAQnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CounterWithAtoms.d.ts","sourceRoot":"","sources":["../../../../examples/src/Counter/CounterWithAtoms.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,wEAQ5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../examples/src/Counter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiScopeDemo.d.ts","sourceRoot":"","sources":["../../../../examples/src/Scope Examples/MultiScopeDemo.ts"],"names":[],"mappings":"AAwPA,eAAO,MAAM,cAAc,wEAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopeDemo.d.ts","sourceRoot":"","sources":["../../../../examples/src/Scope Examples/ScopeDemo.ts"],"names":[],"mappings":"AA4IA,eAAO,MAAM,SAAS,wEAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleScopeExample.d.ts","sourceRoot":"","sources":["../../../../examples/src/Scope Examples/SimpleScopeExample.ts"],"names":[],"mappings":"AA8DA,eAAO,MAAM,kBAAkB,wEAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../examples/src/Scope Examples/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A.d.ts","sourceRoot":"","sources":["../../../../examples/src/Scopes Test/A.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,CAAC,wEAKb,CAAC;AAEF,eAAO,MAAM,CAAC,wEAIb,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const ThemeDemo: () => () => import("../../../lib/lit-html/lit-html").TemplateResult<1>;
|
|
2
|
+
export declare const ThemeDemo2: () => () => import("../../../lib/lit-html/lit-html").TemplateResult<1>;
|
|
3
|
+
export declare const ThemeDemo3: () => () => import("../../../lib/lit-html/lit-html").TemplateResult<1>;
|
|
4
|
+
//# sourceMappingURL=ThemeDemo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeDemo.d.ts","sourceRoot":"","sources":["../../../../examples/src/ThemeContext.ts/ThemeDemo.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,wEAWrB,CAAC;AAEF,eAAO,MAAM,UAAU,wEAatB,CAAC;AAEF,eAAO,MAAM,UAAU,wEAGtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Todo.d.ts","sourceRoot":"","sources":["../../../../examples/src/Todo/Todo.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,wEAyIhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TodoWithAtoms.d.ts","sourceRoot":"","sources":["../../../../examples/src/Todo/TodoWithAtoms.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,wEAoJzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../examples/src/Todo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../examples/src/main.ts"],"names":[],"mappings":"AAKA,OAAO,mBAAmB,CAAC;AAI3B,eAAO,MAAM,GAAG,qEAgGf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["../../examples/vite.config.ts"],"names":[],"mappings":";AAGA,wBASE"}
|
package/dist/index.esm.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,n="$lit$",o=`lit$${Math.random().toFixed(9).slice(2)}$`,i="?"+o,r=`<${i}>`,c=document,l=()=>c.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,h=Array.isArray,u=t=>h(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",p=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,f=/-->/g,_=/>/g,$=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),y=/'/g,A=/"/g,v=/^(?:script|style|textarea|title)$/i,g=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),m=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),b=new WeakMap,C=c.createTreeWalker(c,129);function E(t,e){if(!h(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(e):e}const x=(t,e)=>{const s=t.length-1,i=[];let c,l=2===e?"<svg>":3===e?"<math>":"",a=p;for(let e=0;e<s;e++){const s=t[e];let h,u,d=-1,g=0;for(;g<s.length&&(a.lastIndex=g,u=a.exec(s),null!==u);)g=a.lastIndex,a===p?"!--"===u[1]?a=f:void 0!==u[1]?a=_:void 0!==u[2]?(v.test(u[2])&&(c=RegExp("</"+u[2],"g")),a=$):void 0!==u[3]&&(a=$):a===$?">"===u[0]?(a=c??p,d=-1):void 0===u[1]?d=-2:(d=a.lastIndex-u[2].length,h=u[1],a=void 0===u[3]?$:'"'===u[3]?A:y):a===A||a===y?a=$:a===f||a===_?a=p:(a=$,c=void 0);const m=a===$&&t[e+1].startsWith("/>")?" ":"";l+=a===p?s+r:d>=0?(i.push(h),s.slice(0,d)+n+s.slice(d)+o+m):s+o+(-2===d?e:m)}return[E(t,l+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class S{constructor({strings:t,_$litType$:s},r){let c;this.parts=[];let a=0,h=0;const u=t.length-1,d=this.parts,[p,f]=x(t,s);if(this.el=S.createElement(p,r),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(c=C.nextNode())&&d.length<u;){if(1===c.nodeType){if(c.hasAttributes())for(const t of c.getAttributeNames())if(t.endsWith(n)){const e=f[h++],s=c.getAttribute(t).split(o),n=/([.?@])?(.*)/.exec(e);d.push({type:1,index:a,name:n[2],strings:s,ctor:"."===n[1]?H:"?"===n[1]?j:"@"===n[1]?k:O}),c.removeAttribute(t)}else t.startsWith(o)&&(d.push({type:6,index:a}),c.removeAttribute(t));if(v.test(c.tagName)){const t=c.textContent.split(o),s=t.length-1;if(s>0){c.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)c.append(t[e],l()),C.nextNode(),d.push({type:2,index:++a});c.append(t[s],l())}}}else if(8===c.nodeType)if(c.data===i)d.push({type:2,index:a});else{let t=-1;for(;-1!==(t=c.data.indexOf(o,t+1));)d.push({type:7,index:a}),t+=o.length-1}a++}}static createElement(t,e){const s=c.createElement("template");return s.innerHTML=t,s}}function M(t,e,s=t,n){if(e===m)return e;let o=void 0!==n?s._$Co?.[n]:s._$Cl;const i=a(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),void 0===i?o=void 0:(o=new i(t),o._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=o:s._$Cl=o),void 0!==o&&(e=M(t,o._$AS(t,e.values),o,n)),e}let T=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??c).importNode(e,!0);C.currentNode=n;let o=C.nextNode(),i=0,r=0,l=s[0];for(;void 0!==l;){if(i===l.index){let e;2===l.type?e=new N(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new P(o,this,t)),this._$AV.push(e),l=s[++r]}i!==l?.index&&(o=C.nextNode(),i++)}return C.currentNode=c,n}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}};class N{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=M(this,t,e),a(t)?t===w||null==t||""===t?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==m&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==w&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(c.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(E(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new T(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=b.get(t.strings);return void 0===e&&b.set(t.strings,e=new S(t)),e}k(t){h(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const o of t)n===e.length?e.push(s=new N(this.O(l()),this.O(l()),this,this.options)):s=e[n],s._$AI(o),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class O{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=w}_$AI(t,e=this,s,n){const o=this.strings;let i=!1;if(void 0===o)t=M(this,t,e,0),i=!a(t)||t!==this._$AH&&t!==m,i&&(this._$AH=t);else{const n=t;let r,c;for(t=o[0],r=0;r<o.length-1;r++)c=M(this,n[s+r],e,r),c===m&&(c=this._$AH[r]),i||=!a(c)||c!==this._$AH[r],c===w?t=w:t!==w&&(t+=(c??"")+o[r+1]),this._$AH[r]=c}i&&!n&&this.j(t)}j(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class H extends O{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===w?void 0:t}}class j extends O{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==w)}}class k extends O{constructor(t,e,s,n,o){super(t,e,s,n,o),this.type=5}_$AI(t,e=this){if((t=M(this,t,e,0)??w)===m)return;const s=this._$AH,n=t===w&&s!==w||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==w&&(s===w||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class P{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const U={M:n,P:o,A:i,C:1,L:x,R:T,D:u,V:M,I:N,H:O,N:j,U:k,B:H,F:P},V=t.litHtmlPolyfillSupport;V?.(S,N),(t.litHtmlVersions??=[]).push("3.3.1");const B=(t,e,s)=>{const n=s?.renderBefore??e;let o=n._$litPart$;if(void 0===o){const t=s?.renderBefore??null;n._$litPart$=o=new N(e.insertBefore(l(),t),t,void 0,s??{})}return o._$AI(t),o};let D=!1;const R=()=>D;const L=new class{constructor(){this.pendingComponents=new Set,this.isScheduled=!1}schedule(t){this.pendingComponents.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>{this.pendingComponents.forEach(t=>t._render()),this.pendingComponents.clear(),this.isScheduled=!1}))}};class F extends HTMLElement{onEachUpdate(t){this.onEachUpdateCallbacks.push(t)}constructor(){super(),this.lastVersion=-1,this.onEachUpdateCallbacks=[],this._isViewLoading=!1,this._props={},this._propsFn=()=>this._props,this._view=null,this._componentFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{}}setter(t){const e=this;return(...s)=>(ft(),L.schedule(e),t(...s))}set props(t){"function"==typeof t?this._propsFn=t:(this._props=t,this._propsFn=()=>this._props),L.schedule(this)}get props(){return this._props}set view(t){if("AsyncFunction"===t.constructor.name||t instanceof Promise)return this._isViewLoading=!0,void("function"==typeof t?t():t).then(t=>{this._isViewLoading=!1,this.view=t.default||t});this.oldView!==t&&(this.oldView=t,this._view=t,this._hasMounted&&(this.cleanups.forEach(t=>t()),this.cleanups.clear(),this._hasMounted=!1),L.schedule(this))}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}disconnectedCallback(){this.cleanups.forEach(t=>t()),this.cleanups.clear()}addToCleanUps(t,e){this.cleanups.set(t,e)}_render(){if(this._view&&!this._isViewLoading&&!this._renderScheduled){if(!this._hasMounted){const t=this._view;return this._componentFn=W(this,()=>t(this._propsFn,this.setter.bind(this))),void("function"==typeof this._componentFn&&(this._xviewRender=()=>{D=!0;try{if(this.lastVersion===pt)return;const t=W(this,this._componentFn);B(t,this)}catch(t){console.error(t)}finally{D=!1,this.lastVersion=pt}},this.callOnEachUpdate(),this._xviewRender(),this._hasMounted=!0))}this._xviewRender&&(this.callOnEachUpdate(),this._xviewRender())}}}customElements.define("x-view",F);const I=[];function W(t,e){I.push(t);let s=null;try{s=e()}finally{I.pop()}return s}function q(t=!0){const e=I[I.length-1];if(!e){if(t)throw new Error("getCurrentHost(): No active host context");return null}return e}function K(t,e=!0,s){const n=q(e);if(n&&t&&!n.cleanups.has(t)){const e=(s||t.subscribe)?.(()=>{L.schedule(n)});n.addToCleanUps(t,e)}}function z(t){return K(t,!0),t}function X(t){const e=t,s=q();if(!s)throw new Error("useStore must be called inside a component");if("object"!=typeof e||null===e)throw new Error("state must be an object");return[e,t=>{t(e),ft(),L.schedule(s)}]}function Z(t,e){at();const s=q();e.map(e=>e.subscribe(t)).forEach(t=>s.addToCleanUps(e,t))}function J(t){at();const e=q();queueMicrotask(()=>{try{const s=t();e&&s&&e.addToCleanUps(t,s)}catch(t){console.error(t)}})}function Y(t){let e=null;const s=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{contextClass:t,resolve(t){e=t}}});return q().dispatchEvent(s),e}const G=t=>{at();q().addToCleanUps(t,t)},Q=t=>{if(ot)return nt;at();const e=new Set;try{const s=q(),n=(...n)=>{const o=t(...n);return ft(),e.forEach(t=>t()),s&&L.schedule(s),o};return n.subscribe=t=>(e.add(t),()=>e.delete(t)),n}catch(t){throw new Error("You can only use setter or _ inside a view or component.")}},tt=Q,et=t=>{if(at(),"object"!=typeof t||null===t)throw new Error("state must be an object");const e=q();if(!e)throw new Error("useState must be called inside a component");return[t,t=>(ft(),L.schedule(e),t?.())]},st=()=>{at();const t=q();return e=>{e?.(),ft(),L.schedule(t)}};let nt,ot=!1;const it=t=>{ot=t},rt=t=>{nt=t},ct=()=>ot,lt=()=>nt,at=()=>{if(R())throw Error("atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")};let ht=!1,ut=new Set;function dt(t){let e=null,s=1;at();const n=()=>{if(e)try{let t=!1;for(const[s,n]of e.storeDeps){if(s.__version__!==n){t=!0;break}}if(!t)for(const[s,n]of e.getterDeps){if(s.areVersionsChanged(n)){t=!0;break}}if(!t)return ht&&ut.add(o),e.value}catch(t){console.error(t)}const n=ut,i=ht;let r;ut=new Set,ht=!0;let c=new Map,l=new Map;try{r=t(),ut.forEach(t=>{"function"==typeof t&&"function"==typeof t.areVersionsChanged?l.set(t,t.version):t&&"number"==typeof t.__version__&&c.set(t,t.__version__)}),e={value:r,storeDeps:new Map(c),getterDeps:new Map(l)},s++}catch(t){throw e=null,s++,ut=n,ht=i,t}finally{ut=n,ht=i,i&&ut.add(o)}return r},o=()=>n();return Object.defineProperty(o,"val",{get:()=>n()}),Object.defineProperty(o,"version",{get:()=>s}),Object.defineProperty(o,"areVersionsChanged",{value:t=>{if(!e)return!0;if(void 0!==t){let n=!1;for(const[t,s]of e.storeDeps){if(t.__version__!==s){n=!0;break}}if(!n)for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s)){n=!0;break}}return!!n||s!==t}for(const[t,s]of e.storeDeps){if(t.__version__!==s)return!0}for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s))return!0}return!1}}),o}let pt=0;const ft=()=>{pt++};function _t(t,e=!1){at();let s=t;e&&yt(s);let n=!1,o=new Set,i=!1,r=1;const c=()=>{r++,n||(n=!0,queueMicrotask(()=>{console.log("notify",o.size),[...o].forEach(t=>{try{t?.()}catch(t){console.error(t)}}),n=!1}))},l=()=>(K(a,!1),ht&&ut.add(a),s),a=()=>l();return a.get=()=>l(),a.set=t=>{if(i)return;const n="function"==typeof t?t(s):t;s=n,e&&yt(s),ft(),c()},a.update=t=>{if(!i&&"object"==typeof s&&null!==s){if(e)throw new Error("update() is not supported for iAtoms or iAtom with deepFreeze enabled");t(s),ft(),c()}},a.subscribe=t=>(o.add(t),()=>o.delete(t)),a.lock=()=>{i=!0},a.unlock=()=>{i=!1},Object.defineProperty(a,"__isAtom___",{value:!0,writable:!1}),Object.defineProperty(a,"val",{get:()=>a.get()}),Object.defineProperty(a,"__version__",{get:()=>(K(a,!1),r)}),Object.defineProperty(a,"toJSON",{value:()=>JSON.stringify(s)}),Object.defineProperty(a,"__id__",{value:Math.random().toString(36).substring(2,15),writable:!1}),a.select=(t,n=void 0)=>{if(!e)throw Error("select() can only be used with iAtoms");let o=n;try{o=t(s)}catch(t){o=n}const i=()=>o,r=q(),c=a.subscribe(()=>{const e=o;try{o=t(s)}catch(t){o=n}e!==o&&r&&L.schedule(r)});return r&&!r?.cleanups?.has?.(i)&&r?.addToCleanUps?.(i,c),i},a}function $t(t){return _t(t,!0)}function yt(t){try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||yt(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function At(t,e){let s=t,n=null,o=null,i="init",r=!1,c=null;const l=new Set,a=()=>{l.forEach(t=>{try{t()}catch(t){console.error(t)}})},h=()=>{c&&(c.abort(),c=null),r=!1,i="init",a()},u=t=>{K(d,!1),ht&&ut.add(t)},d={getData:()=>(u(d),n),getError:()=>(u(d),o),getStatus:()=>(u(d),i),isLoading:()=>(u(d),r),set(t){s=t},cancel:h,run:async(...t)=>{h(),r=!0,i="loading",c=new AbortController;const l=c;a();try{const h=await s.call(e,...t,l);if(l.signal.aborted||c!==l)return;n=h,o=null,i="success",r=!1,a()}catch(t){if(l.signal.aborted||c!==l)return;n=null,o=t,i="error",r=!1,a()}finally{c===l&&(c=null)}},subscribe:t=>(l.add(t),()=>l.delete(t))};return d}function vt(t,e){let s=t;const n=new Set;let o=null,i=null,r=null,c=null,l=null,a=null,h=null,u=0,d=null,p=null;const f=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})},_=(t,e)=>{if(o){return o((...e)=>{const n=s.call(t,...e);return f(n),n},...e)}const n=s.call(t,...e);return f(n),n};function $(...t){const s=this;return e?.debounce?((t,s)=>(i&&clearTimeout(i),r||(r=new Promise(n=>{c=n,i=setTimeout(()=>{const e=_(t,s);n(e),i=null,r=null,c=null},e?.debounce||0)}),r)))(s,t):e?.throttle?((t,s)=>{const n=Date.now(),o=n-u,i=e?.throttle||0;return o>=i?(u=n,_(t,s)):(d=s,p=t,a||(a=new Promise(t=>{h=t,l=setTimeout(()=>{if(d&&p){u=Date.now();const e=_(p,d);t(e),d=null,p=null}l=null,a=null,h=null},i-o)}),a))})(s,t):_(s,t)}return $.subscribe=t=>(n.add(t),()=>n.delete(t)),$.set=t=>{s=t},$.intercept=t=>{o=t},$.cancel=()=>{i&&(clearTimeout(i),i=null),r&&c&&(c(void 0),r=null,c=null),l&&(clearTimeout(l),l=null,u=0,d=null,p=null),a&&h&&(h(void 0),a=null,h=null)},$}const gt=t=>{if(ct())throw new Error("you can't create a bubble in another bubble.");at(),it(!0);let e=!1,s=1;const n=t=>(...n)=>{const o=t(...n);return e||(e=!0,queueMicrotask(()=>{e=!1,ft(),s++,i.forEach(t=>t())})),o};rt(n);let o=t(n);const i=new Set,r=()=>(K(r,!1),ht&&ut.add(r),o());return r.__isBubble___=!0,r.__id__=Math.random().toString(36).substring(2,15),Object.defineProperty(r,"__version__",{get:()=>(K(r,!1),s)}),r.reset=()=>{o=t(n)},r.subscribe=t=>(i.add(t),()=>i.delete(t)),it(!1),rt(null),r},mt={get path(){return this.pathAtom.get()},pathAtom:_t(window.location.pathname),navigateTo(t,e){e?window.history.replaceState({},"",t):window.history.pushState({},"",t),this.pathAtom.set(t)},matchPath:t=>wt(t)};window.addEventListener("popstate",()=>{mt.pathAtom.set(window.location.pathname)}),window.addEventListener("hashchange",()=>{mt.pathAtom.set(window.location.pathname)}),window.addEventListener("navigate",()=>{mt.pathAtom.set(window.location.pathname)});const wt=t=>{const e=window.location.pathname;if(e===t)return!0;const s=t.split("/").filter(Boolean),n=e.split("/").filter(Boolean);if(s.length!==n.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],o=n[t];if(e.startsWith(":")){if(!o)return!1}else if(e!==o)return!1}return!0};function bt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const Ct=function(t){if("function"!=typeof t)throw Error("molecule must be a class");let e=new t;bt(e).forEach(t=>{if("function"==typeof e[t]){const s=e[t];e[t]=vt((...t)=>s.apply(e,t))}});const s=()=>e;return s.reset=()=>{const s=new t;bt(s).forEach(t=>{const n=s[t];n.__isAtom___||n.__isUnit___?e[t].set(n()):n.__isBubble___?e[t].reset():e[t]=n})},s},Et=(t,e)=>{const s=q();if(!s)throw new Error("refEffect must be called inside a component");let n=[];t(),n=e(),s.onEachUpdate(()=>{const s=e();n.some((t,e)=>t!==s[e])&&(t(),n=s)})};function xt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const St=function(t){if(null===t||"object"!=typeof t)throw Error("unit must be an object");at();const e=xt(t),s=()=>(K(s,!1),ht&&ut.add(s),t),n=new Set;s.__isUnit___=!0,Object.defineProperty(s,"__version__",{get:()=>(K(s,!1),1)}),s.subscribe=t=>(n.add(t),()=>{n.delete(t)});let o=!1;return e.forEach(e=>{const s=Object.getOwnPropertyDescriptor(t,e);if(s&&s.get&&"function"==typeof s.get){const n=s.get,o=dt(()=>n.call(t));Object.defineProperty(t,e,{get:function(){return o()},enumerable:s.enumerable,configurable:s.configurable})}if("function"==typeof t[e]&&e.toString().startsWith("_")){const s=t[e];if("AsyncFunction"===s.constructor.name)throw new Error("Async method's name can't start with _. you can use "+e.toString().replace(/^_/,"")+" instead and move set operations to a setter function");t[e]=function(...e){const i=s.apply(t,e);return function(){try{o||(o=!0,queueMicrotask(()=>{ft(),n.forEach(t=>t())}),o=!1)}catch(t){"production"!==process?.env?.NODE_ENV&&console.error(t)}}(),i}}}),Object.preventExtensions(t),s};class Mt extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,s=e.detail?.contextClass;if(!s||null==this._value)return;this._value.constructor===s&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}customElements.define("x-provider",Mt);const Tt=(t,e={})=>g`<x-view .view=${t} .props=${()=>e}></x-view>`,Nt=(t,e)=>{const s=document.getElementById(e);if(!s)throw new Error(`Element with id ${e} not found`);return B(Tt(t,{}),s)},Ot=1,Ht=2,jt=3,kt=4,Pt=t=>(...e)=>({_$litDirective$:t,values:e});let Ut=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
|
6
|
+
const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,n="$lit$",o=`lit$${Math.random().toFixed(9).slice(2)}$`,r="?"+o,i=`<${r}>`,c=document,l=()=>c.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,h=Array.isArray,u=t=>h(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",p=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,f=/-->/g,_=/>/g,y=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,A=/"/g,g=/^(?:script|style|textarea|title)$/i,m=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),v=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),b=new WeakMap,C=c.createTreeWalker(c,129);function E(t,e){if(!h(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(e):e}const x=(t,e)=>{const s=t.length-1,r=[];let c,l=2===e?"<svg>":3===e?"<math>":"",a=p;for(let e=0;e<s;e++){const s=t[e];let h,u,d=-1,m=0;for(;m<s.length&&(a.lastIndex=m,u=a.exec(s),null!==u);)m=a.lastIndex,a===p?"!--"===u[1]?a=f:void 0!==u[1]?a=_:void 0!==u[2]?(g.test(u[2])&&(c=RegExp("</"+u[2],"g")),a=y):void 0!==u[3]&&(a=y):a===y?">"===u[0]?(a=c??p,d=-1):void 0===u[1]?d=-2:(d=a.lastIndex-u[2].length,h=u[1],a=void 0===u[3]?y:'"'===u[3]?A:$):a===A||a===$?a=y:a===f||a===_?a=p:(a=y,c=void 0);const v=a===y&&t[e+1].startsWith("/>")?" ":"";l+=a===p?s+i:d>=0?(r.push(h),s.slice(0,d)+n+s.slice(d)+o+v):s+o+(-2===d?e:v)}return[E(t,l+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class S{constructor({strings:t,_$litType$:s},i){let c;this.parts=[];let a=0,h=0;const u=t.length-1,d=this.parts,[p,f]=x(t,s);if(this.el=S.createElement(p,i),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(c=C.nextNode())&&d.length<u;){if(1===c.nodeType){if(c.hasAttributes())for(const t of c.getAttributeNames())if(t.endsWith(n)){const e=f[h++],s=c.getAttribute(t).split(o),n=/([.?@])?(.*)/.exec(e);d.push({type:1,index:a,name:n[2],strings:s,ctor:"."===n[1]?T:"?"===n[1]?k:"@"===n[1]?H:j}),c.removeAttribute(t)}else t.startsWith(o)&&(d.push({type:6,index:a}),c.removeAttribute(t));if(g.test(c.tagName)){const t=c.textContent.split(o),s=t.length-1;if(s>0){c.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)c.append(t[e],l()),C.nextNode(),d.push({type:2,index:++a});c.append(t[s],l())}}}else if(8===c.nodeType)if(c.data===r)d.push({type:2,index:a});else{let t=-1;for(;-1!==(t=c.data.indexOf(o,t+1));)d.push({type:7,index:a}),t+=o.length-1}a++}}static createElement(t,e){const s=c.createElement("template");return s.innerHTML=t,s}}function M(t,e,s=t,n){if(e===v)return e;let o=void 0!==n?s._$Co?.[n]:s._$Cl;const r=a(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=o:s._$Cl=o),void 0!==o&&(e=M(t,o._$AS(t,e.values),o,n)),e}let O=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??c).importNode(e,!0);C.currentNode=n;let o=C.nextNode(),r=0,i=0,l=s[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new N(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new P(o,this,t)),this._$AV.push(e),l=s[++i]}r!==l?.index&&(o=C.nextNode(),r++)}return C.currentNode=c,n}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}};class N{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=M(this,t,e),a(t)?t===w||null==t||""===t?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==v&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==w&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(c.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(E(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new O(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=b.get(t.strings);return void 0===e&&b.set(t.strings,e=new S(t)),e}k(t){h(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const o of t)n===e.length?e.push(s=new N(this.O(l()),this.O(l()),this,this.options)):s=e[n],s._$AI(o),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class j{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=w}_$AI(t,e=this,s,n){const o=this.strings;let r=!1;if(void 0===o)t=M(this,t,e,0),r=!a(t)||t!==this._$AH&&t!==v,r&&(this._$AH=t);else{const n=t;let i,c;for(t=o[0],i=0;i<o.length-1;i++)c=M(this,n[s+i],e,i),c===v&&(c=this._$AH[i]),r||=!a(c)||c!==this._$AH[i],c===w?t=w:t!==w&&(t+=(c??"")+o[i+1]),this._$AH[i]=c}r&&!n&&this.j(t)}j(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class T extends j{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===w?void 0:t}}class k extends j{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==w)}}class H extends j{constructor(t,e,s,n,o){super(t,e,s,n,o),this.type=5}_$AI(t,e=this){if((t=M(this,t,e,0)??w)===v)return;const s=this._$AH,n=t===w&&s!==w||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==w&&(s===w||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class P{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const U={M:n,P:o,A:r,C:1,L:x,R:O,D:u,V:M,I:N,H:j,N:k,U:H,B:T,F:P},R=t.litHtmlPolyfillSupport;R?.(S,N),(t.litHtmlVersions??=[]).push("3.3.1");const V=(t,e,s)=>{const n=s?.renderBefore??e;let o=n._$litPart$;if(void 0===o){const t=s?.renderBefore??null;n._$litPart$=o=new N(e.insertBefore(l(),t),t,void 0,s??{})}return o._$AI(t),o};let D=!1;const B=()=>D;const L=new class{constructor(){this.pendingComponents=new Set,this.isScheduled=!1}schedule(t){this.pendingComponents.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>{this.pendingComponents.forEach(t=>t._render()),this.pendingComponents.clear(),this.isScheduled=!1}))}};class F extends HTMLElement{addScope(t,e){this.scopes.set(t,e)}onEachUpdate(t){this.onEachUpdateCallbacks.push(t)}constructor(){super(),this.scopes=new Map,this.lastVersion=-1,this.onEachUpdateCallbacks=[],this._isViewLoading=!1,this._props={},this._propsFn=()=>this._props,this._view=null,this._componentFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{}}setter(t){const e=this;return(...s)=>(ft(),L.schedule(e),t(...s))}set props(t){"function"==typeof t?this._propsFn=t:(this._props=t,this._propsFn=()=>this._props),L.schedule(this)}get props(){return this._props}set view(t){if("AsyncFunction"===t.constructor.name||t instanceof Promise)return this._isViewLoading=!0,void("function"==typeof t?t():t).then(t=>{this._isViewLoading=!1,this.view=t.default||t});this.oldView!==t&&(this.oldView=t,this._view=t,this._hasMounted&&(this.cleanups.forEach(t=>t()),this.cleanups.clear(),this._hasMounted=!1),L.schedule(this))}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}disconnectedCallback(){this.cleanups.forEach(t=>t()),this.cleanups.clear(),this.scopes=new Map}addToCleanUps(t,e){this.cleanups.set(t,e)}_render(){if(this._view&&!this._isViewLoading&&!this._renderScheduled){if(!this._hasMounted){const t=this._view;return this._componentFn=W(this,()=>t(this._propsFn,this.setter.bind(this))),void("function"==typeof this._componentFn&&(this._xviewRender=()=>{D=!0;try{if(this.lastVersion===pt)return;const t=W(this,this._componentFn);V(t,this)}catch(t){console.error(t)}finally{D=!1,this.lastVersion=pt}},this.callOnEachUpdate(),this._xviewRender(),this._hasMounted=!0))}this._xviewRender&&(this.callOnEachUpdate(),this._xviewRender())}}}customElements.define("x-view",F);const I=[];function W(t,e){I.push(t);let s=null;try{s=e()}finally{I.pop()}return s}function q(t=!0){const e=I[I.length-1];if(!e){if(t)throw new Error("getCurrentHost(): No active host context");return null}return e}function K(t,e=!0,s){const n=q(e);if(n&&t&&!n.cleanups.has(t)){const e=(s||t.subscribe)?.(()=>{L.schedule(n)});n.addToCleanUps(t,e)}}function z(t){return K(t,!0),t}function X(t){const e=t,s=q();if(!s)throw new Error("useStore must be called inside a component");if("object"!=typeof e||null===e)throw new Error("state must be an object");return[e,t=>{t(e),ft(),L.schedule(s)}]}function Z(t,e){at();const s=q();e.map(e=>e.subscribe(t)).forEach(t=>s.addToCleanUps(e,t))}function J(t){at();const e=q();queueMicrotask(()=>{try{const s=t();e&&s&&e.addToCleanUps(t,s)}catch(t){console.error(t)}})}function Y(t){let e=null;const s=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{context:t,resolve(t=null){e=t}}});return q().dispatchEvent(s),e}const G=t=>{at();q().addToCleanUps(t,t)},Q=t=>{if(ot)return nt;at();const e=new Set;try{const s=q(),n=(...n)=>{const o=t(...n);return ft(),e.forEach(t=>t()),s&&L.schedule(s),o};return n.subscribe=t=>(e.add(t),()=>e.delete(t)),n}catch(t){throw new Error("You can only use setter or _ inside a view or component.")}},tt=Q,et=t=>{if(at(),"object"!=typeof t||null===t)throw new Error("state must be an object");const e=q();if(!e)throw new Error("useState must be called inside a component");return[t,t=>(ft(),L.schedule(e),t?.())]},st=()=>{at();const t=q();return e=>{e?.(),ft(),L.schedule(t)}};let nt,ot=!1;const rt=t=>{ot=t},it=t=>{nt=t},ct=()=>ot,lt=()=>nt,at=()=>{if(B())throw Error("atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")};let ht=!1,ut=new Set;function dt(t){let e=null,s=1;at();const n=()=>{if(e)try{let t=!1;for(const[s,n]of e.storeDeps){if(s.__version__!==n){t=!0;break}}if(!t)for(const[s,n]of e.getterDeps){if(s.areVersionsChanged(n)){t=!0;break}}if(!t)return ht&&ut.add(o),e.value}catch(t){console.error(t)}const n=ut,r=ht;let i;ut=new Set,ht=!0;let c=new Map,l=new Map;try{i=t(),ut.forEach(t=>{"function"==typeof t&&"function"==typeof t.areVersionsChanged?l.set(t,t.version):t&&"number"==typeof t.__version__&&c.set(t,t.__version__)}),e={value:i,storeDeps:new Map(c),getterDeps:new Map(l)},s++}catch(t){throw e=null,s++,ut=n,ht=r,t}finally{ut=n,ht=r,r&&ut.add(o)}return i},o=()=>n();return Object.defineProperty(o,"val",{get:()=>n()}),Object.defineProperty(o,"version",{get:()=>s}),Object.defineProperty(o,"areVersionsChanged",{value:t=>{if(!e)return!0;if(void 0!==t){let n=!1;for(const[t,s]of e.storeDeps){if(t.__version__!==s){n=!0;break}}if(!n)for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s)){n=!0;break}}return!!n||s!==t}for(const[t,s]of e.storeDeps){if(t.__version__!==s)return!0}for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s))return!0}return!1}}),o}let pt=0;const ft=()=>{pt++};function _t(t,e=!1){at();let s=t;e&&$t(s);let n=!1,o=new Set,r=!1,i=1;const c=()=>{i++,n||(n=!0,queueMicrotask(()=>{console.log("notify",o.size),[...o].forEach(t=>{try{t?.()}catch(t){console.error(t)}}),n=!1}))},l=()=>(K(a,!1),ht&&ut.add(a),s),a=()=>l();return a.get=()=>l(),a.set=t=>{if(r)return;const n="function"==typeof t?t(s):t;s=n,e&&$t(s),ft(),c()},a.update=t=>{if(!r&&"object"==typeof s&&null!==s){if(e)throw new Error("update() is not supported for iAtoms or iAtom with deepFreeze enabled");t(s),ft(),c()}},a.subscribe=t=>(o.add(t),()=>o.delete(t)),a.lock=()=>{r=!0},a.unlock=()=>{r=!1},Object.defineProperty(a,"__isAtom___",{value:!0,writable:!1}),Object.defineProperty(a,"val",{get:()=>a.get()}),Object.defineProperty(a,"__version__",{get:()=>(K(a,!1),i)}),Object.defineProperty(a,"toJSON",{value:()=>JSON.stringify(s)}),Object.defineProperty(a,"__id__",{value:Math.random().toString(36).substring(2,15),writable:!1}),a.select=(t,n=void 0)=>{if(!e)throw Error("select() can only be used with iAtoms");let o=n;try{o=t(s)}catch(t){o=n}const r=()=>o,i=q(),c=a.subscribe(()=>{const e=o;try{o=t(s)}catch(t){o=n}e!==o&&i&&L.schedule(i)});return i&&!i?.cleanups?.has?.(r)&&i?.addToCleanUps?.(r,c),r},a}function yt(t){return _t(t,!0)}function $t(t){try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||$t(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function At(t,e){let s=t,n=null,o=null,r="init",i=!1,c=null;const l=new Set,a=()=>{l.forEach(t=>{try{t()}catch(t){console.error(t)}})},h=()=>{c&&(c.abort(),c=null),i=!1,r="init",a()},u=t=>{K(d,!1),ht&&ut.add(t)},d={getData:()=>(u(d),n),getError:()=>(u(d),o),getStatus:()=>(u(d),r),isLoading:()=>(u(d),i),set(t){s=t},cancel:h,run:async(...t)=>{h(),i=!0,r="loading",c=new AbortController;const l=c;a();try{const h=await s.call(e,...t,l);if(l.signal.aborted||c!==l)return;n=h,o=null,r="success",i=!1,a()}catch(t){if(l.signal.aborted||c!==l)return;n=null,o=t,r="error",i=!1,a()}finally{c===l&&(c=null)}},subscribe:t=>(l.add(t),()=>l.delete(t))};return d}function gt(t,e){let s=t;const n=new Set;let o=null,r=null,i=null,c=null,l=null,a=null,h=null,u=0,d=null,p=null;const f=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})},_=(t,e)=>{if(o){return o((...e)=>{const n=s.call(t,...e);return f(n),n},...e)}const n=s.call(t,...e);return f(n),n};function y(...t){const s=this;return e?.debounce?((t,s)=>(r&&clearTimeout(r),i||(i=new Promise(n=>{c=n,r=setTimeout(()=>{const e=_(t,s);n(e),r=null,i=null,c=null},e?.debounce||0)}),i)))(s,t):e?.throttle?((t,s)=>{const n=Date.now(),o=n-u,r=e?.throttle||0;return o>=r?(u=n,_(t,s)):(d=s,p=t,a||(a=new Promise(t=>{h=t,l=setTimeout(()=>{if(d&&p){u=Date.now();const e=_(p,d);t(e),d=null,p=null}l=null,a=null,h=null},r-o)}),a))})(s,t):_(s,t)}return y.subscribe=t=>(n.add(t),()=>n.delete(t)),y.set=t=>{s=t},y.intercept=t=>{o=t},y.cancel=()=>{r&&(clearTimeout(r),r=null),i&&c&&(c(void 0),i=null,c=null),l&&(clearTimeout(l),l=null,u=0,d=null,p=null),a&&h&&(h(void 0),a=null,h=null)},y}const mt=t=>{if(ct())throw new Error("you can't create a bubble in another bubble.");at(),rt(!0);let e=!1,s=1;const n=t=>(...n)=>{const o=t(...n);return e||(e=!0,queueMicrotask(()=>{e=!1,ft(),s++,r.forEach(t=>t())})),o};it(n);let o=t(n);const r=new Set,i=()=>(K(i,!1),ht&&ut.add(i),o());return i.__isBubble___=!0,i.__id__=Math.random().toString(36).substring(2,15),Object.defineProperty(i,"__version__",{get:()=>(K(i,!1),s)}),i.reset=()=>{o=t(n)},i.subscribe=t=>(r.add(t),()=>r.delete(t)),rt(!1),it(null),i},vt={get path(){return this.pathAtom.get()},pathAtom:_t(window.location.pathname),navigateTo(t,e){e?window.history.replaceState({},"",t):window.history.pushState({},"",t),this.pathAtom.set(t)},matchPath:t=>wt(t)};window.addEventListener("popstate",()=>{vt.pathAtom.set(window.location.pathname)}),window.addEventListener("hashchange",()=>{vt.pathAtom.set(window.location.pathname)}),window.addEventListener("navigate",()=>{vt.pathAtom.set(window.location.pathname)});const wt=t=>{const e=window.location.pathname;if(e===t)return!0;const s=t.split("/").filter(Boolean),n=e.split("/").filter(Boolean);if(s.length!==n.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],o=n[t];if(e.startsWith(":")){if(!o)return!1}else if(e!==o)return!1}return!0};function bt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const Ct=function(t){if("function"!=typeof t)throw Error("molecule must be a class");let e=new t;bt(e).forEach(t=>{if("function"==typeof e[t]){const s=e[t];e[t]=gt((...t)=>s.apply(e,t))}});const s=()=>e;return s.reset=()=>{const s=new t;bt(s).forEach(t=>{const n=s[t];n.__isAtom___||n.__isUnit___?e[t].set(n()):n.__isBubble___?e[t].reset():e[t]=n})},s},Et=(t,e)=>{const s=q();if(!s)throw new Error("refEffect must be called inside a component");let n=[];t(),n=e(),s.onEachUpdate(()=>{const s=e();n.some((t,e)=>t!==s[e])&&(t(),n=s)})};function xt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const St=function(t){if(null===t||"object"!=typeof t)throw Error("unit must be an object");const e=_t(new Set);at();const s=xt(t),n=()=>(K(n,!1),ht&&ut.add(n),t),o=new Set;n.__isUnit___=!0,n.isLoading=t=>t?e().has(t):e().size>0,Object.defineProperty(n,"__version__",{get:()=>(K(n,!1),1)}),n.subscribe=t=>(o.add(t),()=>{o.delete(t)});let r=!1;function i(){try{r||(r=!0,queueMicrotask(()=>{ft(),o.forEach(t=>t())}),r=!1)}catch(t){"production"!==process?.env?.NODE_ENV&&console.error(t)}}return s.forEach(s=>{const n=Object.getOwnPropertyDescriptor(t,s);if(n&&n.get&&"function"==typeof n.get){const e=n.get,o=dt(()=>e.call(t));Object.defineProperty(t,s,{get:function(){return o()},enumerable:n.enumerable,configurable:n.configurable})}if("function"==typeof t[s]){const n=t[s];if("AsyncFunction"===n.constructor.name){if(s.toString().startsWith("_"))throw new Error("Async method's name can't start with _. you can use "+s.toString().replace(/^_/,"")+" instead and move set operations to a setter functions");t[s]=async function(...o){try{e().add(t[s]);const r=await n.apply(t,o);return i(),r}catch(t){console.error(t)}finally{i(),e().delete(t[s])}}}s.toString().startsWith("_")&&(t[s]=function(...e){const s=n.apply(t,e);return i(),s})}}),Object.preventExtensions(t),n};class Mt extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,s=e.detail?.context.id;s&&null!=this.id&&s===this.id&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}set context(t){this.id=t.id}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}customElements.define("x-provider",Mt);const Ot=(t,e={})=>m`<x-view .view=${t} .props=${()=>e}></x-view>`,Nt=(t,e)=>V(Ot(t,{}),e),jt=1,Tt=2,kt=3,Ht=4,Pt=t=>(...e)=>({_$litDirective$:t,values:e});let Ut=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2020 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/const{I:
|
|
11
|
+
*/const{I:Rt}=U,Vt=(t,e)=>void 0===e?void 0!==t?._$litType$:t?._$litType$===e,Dt=t=>void 0===t.strings,Bt=()=>document.createComment(""),Lt=(t,e,s)=>{const n=t._$AA.parentNode,o=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=n.insertBefore(Bt(),o),r=n.insertBefore(Bt(),o);s=new Rt(e,r,t,t.options)}else{const e=s._$AB.nextSibling,r=s._$AM,i=r!==t;if(i){let e;s._$AQ?.(t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==r._$AU&&s._$AP(e)}if(e!==o||i){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;n.insertBefore(t,o),t=e}}}return s},Ft=(t,e,s=t)=>(t._$AI(e,s),t),It={},Wt=(t,e=It)=>t._$AH=e,qt=t=>t._$AH,Kt=t=>{t._$AR(),t._$AA.remove()},zt=t=>{t._$AR()},Xt=(t,e,s)=>{const n=new Map;for(let o=e;o<=s;o++)n.set(t[o],o);return n},Zt=Pt(class extends Ut{constructor(t){if(super(t),t.type!==Tt)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let n;void 0===s?s=e:void 0!==e&&(n=e);const o=[],r=[];let i=0;for(const e of t)o[i]=n?n(e,i):i,r[i]=s(e,i),i++;return{values:r,keys:o}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,n]){const o=qt(t),{values:r,keys:i}=this.dt(e,s,n);if(!Array.isArray(o))return this.ut=i,r;const c=this.ut??=[],l=[];let a,h,u=0,d=o.length-1,p=0,f=r.length-1;for(;u<=d&&p<=f;)if(null===o[u])u++;else if(null===o[d])d--;else if(c[u]===i[p])l[p]=Ft(o[u],r[p]),u++,p++;else if(c[d]===i[f])l[f]=Ft(o[d],r[f]),d--,f--;else if(c[u]===i[f])l[f]=Ft(o[u],r[f]),Lt(t,l[f+1],o[u]),u++,f--;else if(c[d]===i[p])l[p]=Ft(o[d],r[p]),Lt(t,o[u],o[d]),d--,p++;else if(void 0===a&&(a=Xt(i,p,f),h=Xt(c,u,d)),a.has(c[u]))if(a.has(c[d])){const e=h.get(i[p]),s=void 0!==e?o[e]:null;if(null===s){const e=Lt(t,o[u]);Ft(e,r[p]),l[p]=e}else l[p]=Ft(s,r[p]),Lt(t,o[u],s),o[e]=null;p++}else Kt(o[d]),d--;else Kt(o[u]),u++;for(;p<=f;){const e=Lt(t,l[f+1]);Ft(e,r[p]),l[p++]=e}for(;u<=d;){const t=o[u++];null!==t&&Kt(t)}return this.ut=i,Wt(t,l),v}}),Jt={},Yt=Pt(class extends Ut{constructor(){super(...arguments),this.ot=Jt}render(t,e){return e()}update(t,[e,s]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every((t,e)=>t===this.ot[e]))return v}else if(this.ot===e)return v;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),Gt="important",Qt=" !"+Gt,te=Pt(class extends Ut{constructor(t){if(super(t),t.type!==jt||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const n=e[t];if(null!=n){this.ft.add(t);const e="string"==typeof n&&n.endsWith(Qt);t.includes("-")||e?s.setProperty(t,e?n.slice(0,-11):n,e?Gt:""):s[t]=n}}return v}}),ee=Pt(class extends Ut{constructor(t){if(super(t),t.type!==jt||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const s=t.element.classList;for(const t of this.st)t in e||(s.remove(t),this.st.delete(t));for(const t in e){const n=!!e[t];n===this.st.has(t)||this.nt?.has(t)||(n?(s.add(t),this.st.add(t)):(s.remove(t),this.st.delete(t)))}return v}});
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
@@ -24,12 +24,12 @@ function se(t,e,s){return t?e(t):s?.(t)}
|
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2018 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const ne=t=>t??w,oe=Pt(class extends Ut{constructor(t){if(super(t),t.type!==
|
|
27
|
+
*/const ne=t=>t??w,oe=Pt(class extends Ut{constructor(t){if(super(t),t.type!==kt&&t.type!==jt&&t.type!==Ht)throw Error("The `live` directive is not allowed on child or event bindings");if(!Dt(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===v||e===w)return e;const s=t.element,n=t.name;if(t.type===kt){if(e===s[n])return v}else if(t.type===Ht){if(!!e===s.hasAttribute(n))return v}else if(t.type===jt&&s.getAttribute(n)===e+"")return v;return Wt(t),e}}),re=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),re(t,e);return!0},ie=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},ce=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),he(e)}};
|
|
28
28
|
/**
|
|
29
29
|
* @license
|
|
30
30
|
* Copyright 2020 Google LLC
|
|
31
31
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
-
*/function le(t){void 0!==this._$AN?(
|
|
32
|
+
*/function le(t){void 0!==this._$AN?(ie(this),this._$AM=t,ce(this)):this._$AM=t}function ae(t,e=!1,s=0){const n=this._$AH,o=this._$AN;if(void 0!==o&&0!==o.size)if(e)if(Array.isArray(n))for(let t=s;t<n.length;t++)re(n[t],!1),ie(n[t]);else null!=n&&(re(n,!1),ie(n));else re(this,t)}const he=t=>{t.type==Tt&&(t._$AP??=ae,t._$AQ??=le)};class ue extends Ut{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),ce(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(re(this,t),ie(this))}setValue(t){if(Dt(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}
|
|
33
33
|
/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2021 Google LLC
|
|
@@ -39,7 +39,7 @@ function se(t,e,s){return t?e(t):s?.(t)}
|
|
|
39
39
|
* @license
|
|
40
40
|
* Copyright 2017 Google LLC
|
|
41
41
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
42
|
-
*/const fe=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then,_e=1073741823;const
|
|
42
|
+
*/const fe=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then,_e=1073741823;const ye=Pt(class extends ue{constructor(){super(...arguments),this._$Cwt=_e,this._$Cbt=[],this._$CK=new de(this),this._$CX=new pe}render(...t){return t.find(t=>!fe(t))??v}update(t,e){const s=this._$Cbt;let n=s.length;this._$Cbt=e;const o=this._$CK,r=this._$CX;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cwt);t++){const i=e[t];if(!fe(i))return this._$Cwt=t,i;t<n&&i===s[t]||(this._$Cwt=_e,n=0,Promise.resolve(i).then(async t=>{for(;r.get();)await r.get();const e=o.deref();if(void 0!==e){const s=e._$Cbt.indexOf(i);s>-1&&s<e._$Cwt&&(e._$Cwt=s,e.setValue(t))}}))}return v}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}),$e=Pt(class extends Ut{constructor(){super(...arguments),this.key=w}render(t,e){return this.key=t,e}update(t,[e,s]){return e!==this.key&&(Wt(t),this.key=e),s}}),Ae=t=>(t=>null!=t?._$litType$?.h)(t)?t._$litType$.h:t.strings,ge=Pt(class extends Ut{constructor(t){super(t),this.et=new WeakMap}render(t){return[t]}update(t,[e]){const s=Vt(this.it)?Ae(this.it):null,n=Vt(e)?Ae(e):null;if(null!==s&&(null===n||s!==n)){const e=qt(t).pop();let n=this.et.get(s);if(void 0===n){const t=document.createDocumentFragment();n=V(w,t),n.setConnected(!1),this.et.set(s,n)}Wt(n,[e]),Lt(n,void 0,e)}if(null!==n){if(null===s||s!==n){const e=this.et.get(n);if(void 0!==e){const s=qt(e).pop();zt(t),Lt(t,void 0,s),Wt(t,[s])}}this.it=e}else this.it=void 0;return this.render(e)}});
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2021 Google LLC
|
|
@@ -50,7 +50,7 @@ function se(t,e,s){return t?e(t):s?.(t)}
|
|
|
50
50
|
* Copyright 2017 Google LLC
|
|
51
51
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
52
52
|
*/
|
|
53
|
-
let
|
|
53
|
+
let me=class extends ue{constructor(){super(...arguments),this._$CK=new de(this),this._$CX=new pe}render(t,e){return v}update(t,[e,s]){if(this.isConnected||this.disconnected(),e===this._$CJ)return v;this._$CJ=e;let n=0;const{_$CK:o,_$CX:r}=this;return(async(t,e)=>{for await(const s of t)if(!1===await e(s))return})(e,async t=>{for(;r.get();)await r.get();const i=o.deref();if(void 0!==i){if(i._$CJ!==e)return!1;void 0!==s&&(t=s(t,n)),i.commitValue(t,n),n++}return!0}),v}commitValue(t,e){this.setValue(t)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}};const ve=Pt(me);
|
|
54
54
|
/**
|
|
55
55
|
* @license
|
|
56
56
|
* Copyright 2021 Google LLC
|
|
@@ -65,5 +65,5 @@ let ge=class extends ue{constructor(){super(...arguments),this._$CK=new de(this)
|
|
|
65
65
|
* @license
|
|
66
66
|
* Copyright 2017 Google LLC
|
|
67
67
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
68
|
-
*/const Ce=Pt(class extends
|
|
68
|
+
*/const Ce=Pt(class extends me{constructor(t){if(super(t),t.type!==Tt)throw Error("asyncAppend can only be used in child expressions")}update(t,e){return this._$Ctt=t,super.update(t,e)}commitValue(t,e){0===e&&zt(this._$Ctt);const s=Lt(this._$Ctt);Ft(s,t)}});class Ee{constructor(){this.id=Math.random().toString(36).substring(2,15),this.context=null}}const xe=t=>{let e,s=1;function n(){e=new t;return function(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];let n=t;for(;n&&!s.includes(n);){for(const t of Reflect.ownKeys(n))"constructor"!==t&&e.add(t);n=Object.getPrototypeOf(n)}return Array.from(e)}(e).forEach(t=>{const n=Reflect.get(e,t);if("function"==typeof n){const o=n.constructor?.name;if("AsyncFunction"===o)throw new Error("Async methods are not allowed in scope classes. Use an action/asyncAtom instead.");const r=n,i=tt((...t)=>(s++,ft(),r.apply(e,t))).bind(e);Reflect.set(e,t,i)}}),e}n();const o=Object.assign(()=>(ht&&ut.add(o),e),{reset:()=>n(),__isScope___:!0,get __version__(){return s}}),r=[o,()=>(n(),s++,ft(),o())],i=q();if(i){if(i.scopes.has(t))throw new Error(`View has already has a scope ${t.name}`);i.addScope(t,e),i.addEventListener("request-parent-scope",s=>{const n=s,o=n.detail?.ScopeClass;o===t&&n.detail.resolve(e)})}return r},Se=t=>{let e=null;const s=new CustomEvent("request-parent-scope",{bubbles:!0,composed:!0,detail:{ScopeClass:t,resolve:t=>{e=t}}});if(q().dispatchEvent(s),e)return e;throw new Error(`No parent scope found for ${t.name}`)};export{Ee as Context,Q as _,gt as action,Ce as asyncAppend,At as asyncAtom,ve as asyncReplace,_t as atom,mt as bubble,ge as cache,ee as classMap,$t as df,q as getCurrentHost,Se as getParentScope,xt as getStoreProps,B as getTemplateIsRunning,ct as getbubbleInProgress,lt as getbubblesSetter,dt as getter,L as globalScheduler,pt as globalVersion,Yt as guard,m as html,yt as iAtom,ne as ifDefined,ft as incrGlobalVersion,wt as isPathMatching,we as join,$e as keyed,oe as live,vt as location,Ct as molecule,be as range,V as render,Nt as renderView,Zt as repeat,at as safetyCheck,rt as setBubbleInProgress,it as setBubblesSetter,tt as setter,te as styleMap,K as subscribe,St as unit,ye as until,Y as useContext,st as useForceUpdate,X as useMutable,J as useOnMount,G as useOnUnmount,Et as useRefEffect,xe as useScope,et as useState,z as useStore,Z as useSubscribe,st as useUpdate,Ot as view,se as when,W as withHost};
|
|
69
69
|
//# sourceMappingURL=index.esm.js.map
|