aptechka 0.10.0 → 0.10.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.
@@ -0,0 +1 @@
1
+ "use strict";var p=(e,r,s)=>{if(!r.has(e))throw TypeError("Cannot "+s)};var a=(e,r,s)=>(p(e,r,"read from private field"),s?s.call(e):r.get(e)),h=(e,r,s)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,s)},v=(e,r,s,c)=>(p(e,r,"write to private field"),c?c.call(e,s):r.set(e,s),s);var D=(e,r,s)=>new Promise((c,i)=>{var n=t=>{try{u(s.next(t))}catch(d){i(d)}},b=t=>{try{u(s.throw(t))}catch(d){i(d)}},u=t=>t.done?c(t.value):Promise.resolve(t.value).then(n,b);u((s=s.apply(e,r)).next())});const y=require("./Store-Cr3VaD9G.cjs");var o;class S extends y.Store{constructor(s,c,i){super(null,i);h(this,o,void 0);v(this,o,s.subscribe(n=>{this.current=c(n.current)}))}close(){super.close(),a(this,o).call(this)}}o=new WeakMap;var l;class x extends y.Store{constructor(s,c,i){super(null,i);h(this,l,void 0);let n=0;v(this,l,s.subscribe(b=>D(this,null,function*(){const u=++n,t=yield c(b.current);n===u&&(this.current=t)})))}close(){super.close(),a(this,l).call(this)}}l=new WeakMap;exports.AsyncDerived=x;exports.Derived=S;
@@ -0,0 +1,60 @@
1
+ var v = (e, r, s) => {
2
+ if (!r.has(e))
3
+ throw TypeError("Cannot " + s);
4
+ };
5
+ var h = (e, r, s) => (v(e, r, "read from private field"), s ? s.call(e) : r.get(e)), p = (e, r, s) => {
6
+ if (r.has(e))
7
+ throw TypeError("Cannot add the same private member more than once");
8
+ r instanceof WeakSet ? r.add(e) : r.set(e, s);
9
+ }, d = (e, r, s, c) => (v(e, r, "write to private field"), c ? c.call(e, s) : r.set(e, s), s);
10
+ var x = (e, r, s) => new Promise((c, n) => {
11
+ var u = (t) => {
12
+ try {
13
+ i(s.next(t));
14
+ } catch (b) {
15
+ n(b);
16
+ }
17
+ }, a = (t) => {
18
+ try {
19
+ i(s.throw(t));
20
+ } catch (b) {
21
+ n(b);
22
+ }
23
+ }, i = (t) => t.done ? c(t.value) : Promise.resolve(t.value).then(u, a);
24
+ i((s = s.apply(e, r)).next());
25
+ });
26
+ import { S as D } from "./Store-Qr3SNOSf.js";
27
+ var o;
28
+ class y extends D {
29
+ constructor(s, c, n) {
30
+ super(null, n);
31
+ p(this, o, void 0);
32
+ d(this, o, s.subscribe((u) => {
33
+ this.current = c(u.current);
34
+ }));
35
+ }
36
+ close() {
37
+ super.close(), h(this, o).call(this);
38
+ }
39
+ }
40
+ o = new WeakMap();
41
+ var l;
42
+ class A extends D {
43
+ constructor(s, c, n) {
44
+ super(null, n);
45
+ p(this, l, void 0);
46
+ let u = 0;
47
+ d(this, l, s.subscribe((a) => x(this, null, function* () {
48
+ const i = ++u, t = yield c(a.current);
49
+ u === i && (this.current = t);
50
+ })));
51
+ }
52
+ close() {
53
+ super.close(), h(this, l).call(this);
54
+ }
55
+ }
56
+ l = new WeakMap();
57
+ export {
58
+ A,
59
+ y as D
60
+ };
@@ -34,9 +34,10 @@ export type ElementConstructorCustomAttributes = {
34
34
  export type ElementConstructorAttributes<T extends ElementConstructorTagNames | Node = ElementConstructorTagNames> = ElementConstructorNativeAttributes<T> | ElementConstructorCustomAttributes;
35
35
  export type ElementConstructorParent = Node | ElementConstructor;
36
36
  export type ElementConstructorRefCallback<T extends ElementConstructorTagNames | Node = ElementConstructorTagNames> = (element: T extends ElementConstructorTagNames ? ElementConstructorTagNameMap[T] : Node) => void;
37
- export type ElementConstructorRef<T extends ElementConstructorTagNames | Node = ElementConstructorTagNames> = {
37
+ export type ElementConstructorObjectRef<T extends ElementConstructorTagNames | Node = ElementConstructorTagNames> = {
38
38
  current: T extends ElementConstructorTagNames ? ElementConstructorTagNameMap[T] : Node;
39
39
  };
40
+ export type ElementConstructorRef<T extends ElementConstructorTagNames | Node = ElementConstructorTagNames> = ElementConstructorRefCallback<T> | ElementConstructorObjectRef<T>;
40
41
  export type ElementConstructorEventValue<E extends Event> = {
41
42
  callback: (event: E) => void;
42
43
  options?: AddEventListenerOptions;
@@ -49,7 +50,7 @@ export type ElementConstructorTagObject<T extends ElementConstructorTagNames | N
49
50
  class?: ElementConstructorClass;
50
51
  style?: T extends 'style' ? ElementConstructorJSS : ElementConstructorStyle;
51
52
  children?: any;
52
- ref?: ElementConstructorRefCallback<T> | ElementConstructorRef<T>;
53
+ ref?: ElementConstructorRef<T>;
53
54
  forceSvg?: boolean;
54
55
  lightChildren?: any;
55
56
  onDisconnect?: ConnectorDisconnectCallback;
@@ -2,14 +2,14 @@ var _ = Object.defineProperty, F = Object.defineProperties;
2
2
  var M = Object.getOwnPropertyDescriptors;
3
3
  var A = Object.getOwnPropertySymbols;
4
4
  var R = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
5
- var L = (n, e, l) => e in n ? _(n, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : n[e] = l, h = (n, e) => {
5
+ var L = (n, e, l) => e in n ? _(n, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : n[e] = l, r = (n, e) => {
6
6
  for (var l in e || (e = {}))
7
7
  R.call(e, l) && L(n, l, e[l]);
8
8
  if (A)
9
9
  for (var l of A(e))
10
10
  D.call(e, l) && L(n, l, e[l]);
11
11
  return n;
12
- }, x = (n, e) => F(n, M(e));
12
+ }, p = (n, e) => F(n, M(e));
13
13
  var H = (n, e, l) => {
14
14
  if (!e.has(n))
15
15
  throw TypeError("Cannot " + l);
@@ -19,16 +19,16 @@ var o = (n, e, l) => (H(n, e, "read from private field"), l ? l.call(n) : e.get(
19
19
  throw TypeError("Cannot add the same private member more than once");
20
20
  e instanceof WeakSet ? e.add(n) : e.set(n, l);
21
21
  };
22
- import { E as w } from "./ElementConstructor-rValMo8f.js";
22
+ import { E as k } from "./ElementConstructor-rValMo8f.js";
23
23
  import { i as I } from "./object-D6MVWB4l.js";
24
24
  import { c as K } from "./string-f0Dnk0L1.js";
25
- import { c as u, n as p, a as y } from "./globals-DMjysUXI.js";
25
+ import { c as u, n as w, a as y } from "./globals-DMjysUXI.js";
26
26
  import "./Store-Qr3SNOSf.js";
27
27
  import "./ticker/index.js";
28
28
  var v, t, d, m, f;
29
29
  class $ extends HTMLElement {
30
30
  constructor(l) {
31
- var r;
31
+ var h;
32
32
  super();
33
33
  i(this, v, /* @__PURE__ */ new Set());
34
34
  i(this, t, /* @__PURE__ */ new Set());
@@ -43,10 +43,12 @@ class $ extends HTMLElement {
43
43
  });
44
44
  const s = u.value;
45
45
  u.value = this, o(this, m).call(this);
46
- const C = l == null ? void 0 : l.tag(h({}, l.attributes)), E = (r = p.value) != null && r.lightChildren ? "lightChildren" : "children";
47
- new w(this, x(h({}, p.value), {
46
+ const C = l == null ? void 0 : l.tag(p(r({}, l.attributes), {
47
+ this: this
48
+ })), E = (h = w.value) != null && h.lightChildren ? "lightChildren" : "children";
49
+ new k(this, p(r({}, w.value), {
48
50
  [E]: C
49
- })), u.value = s, p.value = null, o(this, f).call(this);
51
+ })), u.value = s, w.value = null, o(this, f).call(this);
50
52
  }
51
53
  addConnectCallback(l) {
52
54
  o(this, v).add(l);
@@ -71,7 +73,7 @@ class $ extends HTMLElement {
71
73
  }
72
74
  v = new WeakMap(), t = new WeakMap(), d = new WeakMap(), m = new WeakMap(), f = new WeakMap();
73
75
  function j(n, e, ...l) {
74
- var r;
76
+ var h;
75
77
  l = l.flat().filter((c) => c != null);
76
78
  const s = [], C = [];
77
79
  e = e || {}, s.push(...l.reverse());
@@ -79,7 +81,7 @@ function j(n, e, ...l) {
79
81
  if (E && e.from && (n = e.from, e == null || delete e.from), typeof n == "function")
80
82
  if (E) {
81
83
  let c = null;
82
- return I(n) ? c = new n() : c = n(), delete e.children, () => new w(c, e).node;
84
+ return I(n) ? c = new n() : c = n(), delete e.children, () => new k(c, e).node;
83
85
  } else {
84
86
  if (e.children = s.reverse(), n === g)
85
87
  return g(e.children);
@@ -88,12 +90,12 @@ function j(n, e, ...l) {
88
90
  onlyRegister: e.__register
89
91
  };
90
92
  if (e == null || delete e.__register, c.noCustomElement) {
91
- const T = n(h({}, e));
93
+ const T = n(r({}, e));
92
94
  return () => T;
93
95
  }
94
- const k = `e-${K(n.name)}`;
95
- let a = customElements.get(k);
96
- return a || (a = (r = class extends $ {
96
+ const x = `e-${K(n.name)}`;
97
+ let a = customElements.get(x);
98
+ return a || (a = (h = class extends $ {
97
99
  constructor(S) {
98
100
  super(
99
101
  c.onlyRegister ? {
@@ -102,7 +104,7 @@ function j(n, e, ...l) {
102
104
  } : S
103
105
  );
104
106
  }
105
- }, r.formAssociated = n.formAssociated, r), customElements.define(k, a)), () => c.onlyRegister ? a : new a({ tag: n, attributes: e });
107
+ }, h.formAssociated = n.formAssociated, h), customElements.define(x, a)), () => c.onlyRegister ? a : new a({ tag: n, attributes: e });
106
108
  }
107
109
  for (; s.length; ) {
108
110
  const c = s.pop();
@@ -110,22 +112,22 @@ function j(n, e, ...l) {
110
112
  }
111
113
  if (n === "component") {
112
114
  const c = g(C);
113
- return p.value = e, c.node;
115
+ return w.value = e, c.node;
114
116
  } else {
115
117
  const c = e != null && e.lightChildren ? "lightChildren" : "children";
116
- return e == null || delete e.children, n ? new w(n, x(h({}, e), {
118
+ return e == null || delete e.children, n ? new k(n, p(r({}, e), {
117
119
  [c]: C
118
120
  })) : null;
119
121
  }
120
122
  }
121
123
  function g(n) {
122
- return new w(document.createDocumentFragment(), {
124
+ return new k(document.createDocumentFragment(), {
123
125
  children: n
124
126
  });
125
127
  }
126
128
  function P(n, e) {
127
129
  const l = e == null ? void 0 : e.children, s = e == null ? void 0 : e.attributes;
128
- return (/* @__PURE__ */ j(n, h({}, s), l))();
130
+ return (/* @__PURE__ */ j(n, r({}, s), l))();
129
131
  }
130
132
  export {
131
133
  g as F,
@@ -0,0 +1 @@
1
+ "use strict";var L=Object.defineProperty,T=Object.defineProperties;var _=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var y=(n,e,l)=>e in n?L(n,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[e]=l,i=(n,e)=>{for(var l in e||(e={}))F.call(e,l)&&y(n,l,e[l]);if(g)for(var l of g(e))M.call(e,l)&&y(n,l,e[l]);return n},x=(n,e)=>T(n,_(e));var R=(n,e,l)=>{if(!e.has(n))throw TypeError("Cannot "+l)};var c=(n,e,l)=>(R(n,e,"read from private field"),l?l.call(n):e.get(n)),h=(n,e,l)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,l)};const p=require("./ElementConstructor-OK-6OPjh.cjs"),D=require("./object-CCiXnER2.cjs"),j=require("./string-DhgS_iFl.cjs"),r=require("./globals-bYKki-b9.cjs");require("./Store-Cr3VaD9G.cjs");require("./ticker/index.cjs");var a,d,m,C,u;class H extends HTMLElement{constructor(l){var s;super();h(this,a,new Set);h(this,d,new Set);h(this,m,new Map);h(this,C,()=>{r.contextStack.value.unshift(c(this,m))});h(this,u,()=>{r.contextStack.value=r.contextStack.value.filter(l=>l!==c(this,m))});const o=r.currentComponentElement.value;r.currentComponentElement.value=this,c(this,C).call(this);const f=l==null?void 0:l.tag(x(i({},l.attributes),{this:this})),v=(s=r.nextComponentAttributes.value)!=null&&s.lightChildren?"lightChildren":"children";new p.ElementConstructor(this,x(i({},r.nextComponentAttributes.value),{[v]:f})),r.currentComponentElement.value=o,r.nextComponentAttributes.value=null,c(this,u).call(this)}addConnectCallback(l){c(this,a).add(l)}addDisconnectCallback(l){c(this,d).add(l)}createContext(l,o){c(this,m).set(l,o)}connectedCallback(){r.currentComponentElement.value=this,c(this,a).forEach(l=>{const o=l(this);o&&c(this,d).add(o)}),r.currentComponentElement.value=null,this.addEventListener("beforeChildrenChange",c(this,C)),this.addEventListener("afterChildrenChange",c(this,u))}disconnectedCallback(){c(this,d).forEach(l=>{l(this)}),this.removeEventListener("beforeChildrenChange",c(this,C)),this.removeEventListener("afterChildrenChange",c(this,u))}}a=new WeakMap,d=new WeakMap,m=new WeakMap,C=new WeakMap,u=new WeakMap;function A(n,e,...l){var s;l=l.flat().filter(t=>t!=null);const o=[],f=[];e=e||{},o.push(...l.reverse());const v=n==="instance";if(v&&e.from&&(n=e.from,e==null||delete e.from),typeof n=="function")if(v){let t=null;return D.isESClass(n)?t=new n:t=n(),delete e.children,()=>new p.ElementConstructor(t,e).node}else{if(e.children=o.reverse(),n===k)return k(e.children);const t={noCustomElement:n.noCustomElement,onlyRegister:e.__register};if(e==null||delete e.__register,t.noCustomElement){const q=n(i({},e));return()=>q}const w=`e-${j.camelToKebab(n.name)}`;let E=customElements.get(w);return E||(E=(s=class extends H{constructor(S){super(t.onlyRegister?{tag:n,attributes:e}:S)}},s.formAssociated=n.formAssociated,s),customElements.define(w,E)),()=>t.onlyRegister?E:new E({tag:n,attributes:e})}for(;o.length;){const t=o.pop();Array.isArray(t)?o.push(...t):t!=null&&f.push(t)}if(n==="component"){const t=k(f);return r.nextComponentAttributes.value=e,t.node}else{const t=e!=null&&e.lightChildren?"lightChildren":"children";return e==null||delete e.children,n?new p.ElementConstructor(n,x(i({},e),{[t]:f})):null}}function k(n){return new p.ElementConstructor(document.createDocumentFragment(),{children:n})}function I(n,e){const l=e==null?void 0:e.children,o=e==null?void 0:e.attributes;return A(n,i({},o),l)()}exports.Fragment=k;exports.h=A;exports.instantiate=I;
@@ -1,3 +1,4 @@
1
- import { Cached, CachedSource } from '../../../store';
1
+ import { AsyncCached, Cached, CachedSource } from '../../../store';
2
2
 
3
3
  export declare function createCached<Type, SourceType extends Array<CachedSource> = Array<CachedSource>>(...parameters: ConstructorParameters<typeof Cached<Type, SourceType>>): Cached<Type, SourceType>;
4
+ export declare function createAsyncCached<Type, SourceType extends Array<CachedSource> = Array<CachedSource>>(...parameters: ConstructorParameters<typeof AsyncCached<Type, SourceType>>): AsyncCached<Type, SourceType>;
@@ -1,3 +1,4 @@
1
- import { Derived } from '../../../store';
1
+ import { Derived, AsyncDerived } from '../../../store';
2
2
 
3
3
  export declare function createDerived<Type, SourceType>(...parameters: ConstructorParameters<typeof Derived<Type, SourceType>>): Derived<Type, SourceType>;
4
+ export declare function createAsyncDerived<Type, SourceType>(...parameters: ConstructorParameters<typeof AsyncDerived<Type, SourceType>>): AsyncDerived<Type, SourceType>;
@@ -1,3 +1,4 @@
1
- import { DerivedArray } from '../../../store';
1
+ import { AsyncDerivedArray, DerivedArray } from '../../../store';
2
2
 
3
3
  export declare function createDerivedArray<DerivedType, StoreType extends Array<any> = Array<any>>(...parameters: ConstructorParameters<typeof DerivedArray<DerivedType, StoreType>>): DerivedArray<DerivedType, StoreType>;
4
+ export declare function createAsyncDerivedArray<DerivedType, StoreType extends Array<any> = Array<any>>(...parameters: ConstructorParameters<typeof AsyncDerivedArray<DerivedType, StoreType>>): AsyncDerivedArray<DerivedType, StoreType>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../Store-Cr3VaD9G.cjs"),o=require("../../../Composed-Iihn8fT4.cjs"),r=require("../../../_createStore-C75y9luu.cjs"),n=require("../../../Derived-D9VrDuf9.cjs"),t=require("../../../store/index.cjs");function a(...e){return r._createStore(new o.Composed(...e))}function u(...e){return r._createStore(new n.Derived(...e))}function i(...e){return r._createStore(new t.DerivedArray(...e))}function d(...e){return r._createStore(new t.Cached(...e))}function s(...e){return r._createStore(new t.Resource(...e))}function S(...e){return r._createStore(new c.Store(...e))}exports.createCached=d;exports.createComposed=a;exports.createDerived=u;exports.createDerivedArray=i;exports.createResource=s;exports.createStore=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../Store-Cr3VaD9G.cjs"),o=require("../../../Composed-Iihn8fT4.cjs"),r=require("../../../_createStore-C75y9luu.cjs"),c=require("../../../Derived-CNbsNMn_.cjs"),t=require("../../../store/index.cjs");function a(...e){return r._createStore(new o.Composed(...e))}function i(...e){return r._createStore(new c.Derived(...e))}function u(...e){return r._createStore(new c.AsyncDerived(...e))}function d(...e){return r._createStore(new t.DerivedArray(...e))}function s(...e){return r._createStore(new t.AsyncDerivedArray(...e))}function y(...e){return r._createStore(new t.Cached(...e))}function S(...e){return r._createStore(new t.AsyncCached(...e))}function A(...e){return r._createStore(new t.Resource(...e))}function v(...e){return r._createStore(new n.Store(...e))}exports.createAsyncCached=S;exports.createAsyncDerived=u;exports.createAsyncDerivedArray=s;exports.createCached=y;exports.createComposed=a;exports.createDerived=i;exports.createDerivedArray=d;exports.createResource=A;exports.createStore=v;
@@ -1,6 +1,6 @@
1
1
  export { createComposed } from './createComposed';
2
- export { createDerived } from './createDerived';
3
- export { createDerivedArray } from './createDerivedArray';
4
- export { createCached } from './createCached';
2
+ export { createDerived, createAsyncDerived } from './createDerived';
3
+ export { createDerivedArray, createAsyncDerivedArray, } from './createDerivedArray';
4
+ export { createCached, createAsyncCached } from './createCached';
5
5
  export { createResource } from './createResource';
6
6
  export { createStore } from './createStore';
@@ -1,31 +1,45 @@
1
- import { S as t } from "../../../Store-Qr3SNOSf.js";
2
- import { C as o } from "../../../Composed-Fa7owymK.js";
1
+ import { S as n } from "../../../Store-Qr3SNOSf.js";
2
+ import { C as t } from "../../../Composed-Fa7owymK.js";
3
3
  import { _ as r } from "../../../_createStore-D3qHYaSz.js";
4
- import { D as n } from "../../../Derived-DIWinC7Y.js";
5
- import { DerivedArray as c, Cached as a, Resource as i } from "../../../store/index.js";
6
- function s(...e) {
7
- return r(new o(...e));
8
- }
9
- function w(...e) {
10
- return r(new n(...e));
4
+ import { D as c, A as o } from "../../../Derived-rInkx3e4.js";
5
+ import { DerivedArray as a, AsyncDerivedArray as i, Cached as u, AsyncCached as s, Resource as d } from "../../../store/index.js";
6
+ function D(...e) {
7
+ return r(new t(...e));
11
8
  }
12
- function C(...e) {
9
+ function p(...e) {
13
10
  return r(new c(...e));
14
11
  }
15
- function D(...e) {
12
+ function v(...e) {
13
+ return r(new o(...e));
14
+ }
15
+ function C(...e) {
16
16
  return r(new a(...e));
17
17
  }
18
- function v(...e) {
19
- return r(new i(...e));
18
+ function h(...e) {
19
+ return r(
20
+ new i(...e)
21
+ );
20
22
  }
21
23
  function S(...e) {
22
- return r(new t(...e));
24
+ return r(new u(...e));
25
+ }
26
+ function R(...e) {
27
+ return r(new s(...e));
28
+ }
29
+ function _(...e) {
30
+ return r(new d(...e));
31
+ }
32
+ function x(...e) {
33
+ return r(new n(...e));
23
34
  }
24
35
  export {
25
- D as createCached,
26
- s as createComposed,
27
- w as createDerived,
36
+ R as createAsyncCached,
37
+ v as createAsyncDerived,
38
+ h as createAsyncDerivedArray,
39
+ S as createCached,
40
+ D as createComposed,
41
+ p as createDerived,
28
42
  C as createDerivedArray,
29
- v as createResource,
30
- S as createStore
43
+ _ as createResource,
44
+ x as createStore
31
45
  };
package/lib/jsx/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty,R=Object.defineProperties;var p=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var f=(t,e,n)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,i=(t,e)=>{for(var n in e||(e={}))E.call(e,n)&&f(t,n,e[n]);if(h)for(var n of h(e))x.call(e,n)&&f(t,n,e[n]);return t},m=(t,e)=>R(t,p(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../instantiate-BuVJ8pIJ.cjs"),o=require("../globals-bYKki-b9.cjs");require("../Store-Cr3VaD9G.cjs");require("../ticker/index.cjs");const d=require("../_createStore-C75y9luu.cjs"),w=require("../tags-BosXYPYv.cjs"),C=require("../createStylesheet-9nksoWW0.cjs"),S=require("../onConnect-DGP866cj.cjs");function q(t,e){((e==null?void 0:e.containerElement)||document.body).appendChild(a.instantiate(t,e))}function v(t,e=null,...n){return a.h(t,m(i({},e),{__register:!0}),...n)}function T(){return o.currentComponentElement.value.attachInternals()}function b(t){return o.currentComponentElement.value.attachShadow(i({mode:"open"},t))}function _(t){o.currentComponentElement.value.shadowRoot&&o.currentComponentElement.value.shadowRoot.adoptedStyleSheets.push(C.createStylesheet(t)),S.onConnect(e=>{if(e.shadowRoot)return;const n=e.getRootNode();if(n===document){const c=w.style(t).node;if(![...document.head.querySelectorAll("style")].find(r=>r.outerHTML===c.outerHTML))return document.head.appendChild(c),()=>{c.remove()}}else if(n instanceof ShadowRoot){const c=C.createStylesheet(t),s=[];return n.adoptedStyleSheets.filter(r=>{const y=Array.from(r.cssRules);Array.from(c.cssRules).filter(u=>!y.find(l=>l.cssText===u.cssText)).forEach(u=>{const l=r.insertRule(u.cssText);s.push(()=>{r.deleteRule(l)})})}),()=>{s.forEach(r=>r())}}})}function M(t){const e=o.contextStack.value.find(n=>n.has(t));if(e)return e.get(t)}function A(t,e){o.currentComponentElement.value.createContext(t,e)}function D(t){return{current:t}}function I(t,e){const n=t.subscribe(e);d.onDisconnect(()=>{n()})}exports.Fragment=a.Fragment;exports.h=a.h;exports.instantiate=a.instantiate;exports.currentComponentElement=o.currentComponentElement;exports._createStore=d._createStore;exports.onDisconnect=d.onDisconnect;exports.onConnect=S.onConnect;exports.attachInternals=T;exports.attachShadow=b;exports.attachStylesheet=_;exports.createContext=A;exports.createRef=D;exports.getContext=M;exports.onStoreChange=I;exports.register=v;exports.render=q;
1
+ "use strict";var g=Object.defineProperty,R=Object.defineProperties;var p=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var f=(t,e,n)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,i=(t,e)=>{for(var n in e||(e={}))E.call(e,n)&&f(t,n,e[n]);if(h)for(var n of h(e))x.call(e,n)&&f(t,n,e[n]);return t},m=(t,e)=>R(t,p(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../instantiate-DF1bIAXR.cjs"),o=require("../globals-bYKki-b9.cjs");require("../Store-Cr3VaD9G.cjs");require("../ticker/index.cjs");const d=require("../_createStore-C75y9luu.cjs"),w=require("../tags-BosXYPYv.cjs"),C=require("../createStylesheet-9nksoWW0.cjs"),S=require("../onConnect-DGP866cj.cjs");function q(t,e){((e==null?void 0:e.containerElement)||document.body).appendChild(a.instantiate(t,e))}function v(t,e=null,...n){return a.h(t,m(i({},e),{__register:!0}),...n)}function T(){return o.currentComponentElement.value.attachInternals()}function b(t){return o.currentComponentElement.value.attachShadow(i({mode:"open"},t))}function _(t){o.currentComponentElement.value.shadowRoot&&o.currentComponentElement.value.shadowRoot.adoptedStyleSheets.push(C.createStylesheet(t)),S.onConnect(e=>{if(e.shadowRoot)return;const n=e.getRootNode();if(n===document){const c=w.style(t).node;if(![...document.head.querySelectorAll("style")].find(r=>r.outerHTML===c.outerHTML))return document.head.appendChild(c),()=>{c.remove()}}else if(n instanceof ShadowRoot){const c=C.createStylesheet(t),s=[];return n.adoptedStyleSheets.filter(r=>{const y=Array.from(r.cssRules);Array.from(c.cssRules).filter(u=>!y.find(l=>l.cssText===u.cssText)).forEach(u=>{const l=r.insertRule(u.cssText);s.push(()=>{r.deleteRule(l)})})}),()=>{s.forEach(r=>r())}}})}function M(t){const e=o.contextStack.value.find(n=>n.has(t));if(e)return e.get(t)}function A(t,e){o.currentComponentElement.value.createContext(t,e)}function D(t){return{current:t}}function I(t,e){const n=t.subscribe(e);d.onDisconnect(()=>{n()})}exports.Fragment=a.Fragment;exports.h=a.h;exports.instantiate=a.instantiate;exports.currentComponentElement=o.currentComponentElement;exports._createStore=d._createStore;exports.onDisconnect=d.onDisconnect;exports.onConnect=S.onConnect;exports.attachInternals=T;exports.attachShadow=b;exports.attachStylesheet=_;exports.createContext=A;exports.createRef=D;exports.getContext=M;exports.onStoreChange=I;exports.register=v;exports.render=q;
package/lib/jsx/index.js CHANGED
@@ -10,8 +10,8 @@ var f = (t, e, n) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writab
10
10
  S.call(e, n) && f(t, n, e[n]);
11
11
  return t;
12
12
  }, d = (t, e) => y(t, R(e));
13
- import { i as C, h as g } from "../instantiate-TYteKsII.js";
14
- import { F as V } from "../instantiate-TYteKsII.js";
13
+ import { i as C, h as g } from "../instantiate-D19vO5Ku.js";
14
+ import { F as V } from "../instantiate-D19vO5Ku.js";
15
15
  import { c as a, a as w } from "../globals-DMjysUXI.js";
16
16
  import "../Store-Qr3SNOSf.js";
17
17
  import "../ticker/index.js";
package/lib/jsx/type.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConnectorConnectCallback, ConnectorDisconnectCallback } from '../connector';
2
- import { ElementConstructor, ElementConstructorClass, ElementConstructorEventMap, ElementConstructorStyle, ElementConstructorTagNames } from '../element-constructor';
2
+ import { ElementConstructor, ElementConstructorClass, ElementConstructorEventMap, ElementConstructorRef, ElementConstructorStyle, ElementConstructorTagNames } from '../element-constructor';
3
3
  import { Store } from '../store';
4
4
  import { Split } from '../utils';
5
5
 
@@ -10,6 +10,7 @@ declare global {
10
10
  type ComponentChildren = Array<ComponentChild>;
11
11
  interface BaseProps {
12
12
  children?: Array<ComponentChild>;
13
+ this?: HTMLElement;
13
14
  }
14
15
  type Component<TProps extends object = object> = {
15
16
  formAssociated?: boolean;
@@ -23,12 +24,7 @@ declare global {
23
24
  onConnect?: ConnectorConnectCallback;
24
25
  onDisconnect?: ConnectorDisconnectCallback;
25
26
  };
26
- interface DOMAttributes {
27
- ref?: {
28
- current: any;
29
- };
30
- }
31
- interface HTMLAttributes extends DOMAttributes {
27
+ interface HTMLAttributes<TKey extends ElementConstructorTagNames = any> {
32
28
  accept?: StoreOr<string>;
33
29
  acceptCharset?: StoreOr<string>;
34
30
  accessKey?: StoreOr<string>;
@@ -157,7 +153,7 @@ declare global {
157
153
  title?: StoreOr<string>;
158
154
  type?: StoreOr<string>;
159
155
  useMap?: StoreOr<string>;
160
- value?: StoreOr<string | string[] | number>;
156
+ value?: StoreOr<string | string[] | number | boolean>;
161
157
  volume?: StoreOr<string | number>;
162
158
  width?: StoreOr<number | string>;
163
159
  wmode?: StoreOr<string>;
@@ -178,11 +174,12 @@ declare global {
178
174
  shadow?: boolean;
179
175
  forceSvg?: boolean;
180
176
  lightChildren?: boolean;
177
+ ref?: ElementConstructorRef<TKey>;
181
178
  }
182
179
  type UnknownAttributes = {
183
180
  [key: string]: any;
184
181
  };
185
- type AllAttributes = UnknownAttributes & HTMLAttributes & HTMLOrSVGEvents & SpecialEvents;
182
+ type AllAttributes<TKey extends ElementConstructorTagNames = any> = UnknownAttributes & HTMLAttributes<TKey> & HTMLOrSVGEvents & SpecialEvents;
186
183
  type SpecialTags = {
187
184
  component: AllAttributes;
188
185
  instance: AllAttributes & {
@@ -190,7 +187,7 @@ declare global {
190
187
  };
191
188
  };
192
189
  type IntrinsicElementsHTML = {
193
- [TKey in ElementConstructorTagNames]?: AllAttributes;
190
+ [TKey in ElementConstructorTagNames]?: AllAttributes<TKey>;
194
191
  } & SpecialTags;
195
192
  type IntrinsicElements = IntrinsicElementsHTML;
196
193
  }
@@ -1 +1 @@
1
- "use strict";var Z=(a,e)=>(e=Symbol[a])?e:Symbol.for("Symbol."+a);var K=(a,e,s)=>{if(!e.has(a))throw TypeError("Cannot "+s)};var t=(a,e,s)=>(K(a,e,"read from private field"),s?s.call(a):e.get(a)),r=(a,e,s)=>{if(e.has(a))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(a):e.set(a,s)},n=(a,e,s,i)=>(K(a,e,"write to private field"),i?i.call(a,s):e.set(a,s),s);var W=(a,e,s)=>(K(a,e,"access private method"),s);var M=(a,e,s)=>new Promise((i,h)=>{var o=u=>{try{f(s.next(u))}catch(w){h(w)}},c=u=>{try{f(s.throw(u))}catch(w){h(w)}},f=u=>u.done?i(u.value):Promise.resolve(u.value).then(o,c);f((s=s.apply(a,e)).next())});var Y=(a,e,s)=>(e=a[Z("asyncIterator")])?e.call(a):(a=a[Z("iterator")](),e={},s=(i,h)=>(h=a[i])&&(e[i]=o=>new Promise((c,f,u)=>(o=h.call(a,o),u=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:u}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-C3dWnJQg.cjs"),ot=require("../instantiate-BuVJ8pIJ.cjs"),$=require("../object-CCiXnER2.cjs");var R,O,A,p,d,v,S,L,b,E,x,et;class ct{constructor(e,s){r(this,x);r(this,R,void 0);r(this,O,void 0);r(this,A,void 0);r(this,p,void 0);r(this,d,void 0);r(this,v,void 0);r(this,S,void 0);r(this,L,null);r(this,b,[]);r(this,E,[]);n(this,R,e),n(this,O,s),n(this,A,new URLPattern({pathname:t(this,R)})),n(this,p,null),n(this,d,null),n(this,v,!1),n(this,S,null),tt.isBrowser&&n(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,v)}get element(){return t(this,d)}get nest(){return t(this,S)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return M(this,null,function*(){var i,h;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(n(this,E,[...t(this,b)]),typeof o.default=="function"&&(n(this,p,o.default),$.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield W(this,x,et).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),u={pathnameParams:c,searchParams:f};$.isESClass(t(this,p))?n(this,d,new(t(this,p))(u)):n(this,d,ot.instantiate(t(this,p),{attributes:u})),e.appendChild(t(this,d)),n(this,S,t(this,d).querySelector("[data-nest]")||((h=t(this,d).shadowRoot)==null?void 0:h.querySelector("[data-nest]"))||t(this,d).shadowRoot||t(this,d)),n(this,v,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,d))==null||e.remove(),n(this,v,!1),t(this,E).forEach(s=>document.head.removeChild(s)),n(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,d)&&(e=[...t(this,d).querySelectorAll("a")]),(s=t(this,d))!=null&&s.shadowRoot&&(e=[...e,...t(this,d).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,d=new WeakMap,v=new WeakMap,S=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,x=new WeakSet,et=function(){return M(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=Y(e),i,h,o;i=!(h=yield s.next()).done;i=!1){const c=h.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(h){o=[h]}finally{try{i&&(h=s.return)&&(yield h.call(s))}finally{if(o)throw o[0]}}})};var k,m,P,U,q,j;class lt{constructor(e,s){r(this,k,void 0);r(this,m,void 0);r(this,P,void 0);r(this,U,void 0);r(this,q,void 0);r(this,j,e=>{e.preventDefault(),t(this,k).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,m).classList.add("clicked"):t(s,m).classList.remove("clicked")}),t(this,k).navigate(t(this,P),t(this,U))});var o,c;n(this,k,e),n(this,m,s),n(this,P,t(this,m).getAttribute("href")||"/"),n(this,U,t(this,m).getAttribute("data-history-action")||"push"),t(this,m).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),h=e.normalizePath(location.pathname);n(this,q,(o=t(this,m).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,m).hasAttribute("data-include")?h.pathname.includes(i.pathname)&&t(this,m).classList.add("current"):i.pathname===h.pathname||(c=t(this,q))!=null&&c.includes(h.pathname)?(t(this,m).classList.add("current"),t(this,m).classList.add("clicked")):t(this,m).classList.remove("clicked")}destroy(){t(this,m).removeEventListener("click",t(this,j)),t(this,m).classList.remove("current")}}k=new WeakMap,m=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=at.URLPattern;var C,N,g,z,T,y,H,B,I,_,st,D;class ut{constructor(e){r(this,_);r(this,C,null);r(this,N,null);r(this,g,[]);r(this,z,null);r(this,T,[]);r(this,y,void 0);r(this,H,null);r(this,B,new rt.Notifier);r(this,I,ht.debounce(()=>{const e=s=>s.split("/").length;n(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));r(this,D,e=>{e.state&&this.navigate(e.state,"none")});tt.isBrowser&&(e!=null&&e.base?n(this,N,F.normalizeBase(e.base)):n(this,N,"/"),n(this,C,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,D)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,B).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,I).call(this)}navigate(e,s="push"){return M(this,null,function*(){var Q,V;const i=this.normalizePath(e);let{pathname:h,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===h||t(this,H)===h)return;n(this,y,h);const u=t(this,g).filter(l=>l.isActive),w=t(this,g).filter(l=>!u.includes(l)&&l.testPathname(f)),it=u.filter(l=>!l.testPathname(f)),G=u.filter(l=>l.testPathname(f));let J=!0;if(this.preprocessor)try{yield new Promise((l,nt)=>{var X;(X=this.preprocessor)==null||X.call(this,{path:i,resolve:l,reject:nt})})}catch(l){l?console.error(l):console.log("Route change canceled"),J=!1}if(J&&t(this,y)===h){n(this,z,G[G.length-1]),it.forEach(l=>{l.close()}),n(this,H,h),F.changeHistory(s,h,c,o);try{for(var ft=Y(w),pt,gt,Pt;pt=!(gt=yield ft.next()).done;pt=!1){const l=gt.value;yield l.render(((Q=t(this,z))==null?void 0:Q.nest)||t(this,C),h),n(this,z,l)}}catch(gt){Pt=[gt]}finally{try{pt&&(gt=ft.return)&&(yield gt.call(ft))}finally{if(Pt)throw Pt[0]}}W(this,_,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,B).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,t(this,N))}}C=new WeakMap,N=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,B=new WeakMap,I=new WeakMap,_=new WeakSet,st=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,C).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var h;return(h=i.getAttribute("href"))==null?void 0:h.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),n(this,T,s.map(i=>new lt(this,i)))},D=new WeakMap;exports.Router=ut;
1
+ "use strict";var Z=(a,e)=>(e=Symbol[a])?e:Symbol.for("Symbol."+a);var K=(a,e,s)=>{if(!e.has(a))throw TypeError("Cannot "+s)};var t=(a,e,s)=>(K(a,e,"read from private field"),s?s.call(a):e.get(a)),r=(a,e,s)=>{if(e.has(a))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(a):e.set(a,s)},n=(a,e,s,i)=>(K(a,e,"write to private field"),i?i.call(a,s):e.set(a,s),s);var W=(a,e,s)=>(K(a,e,"access private method"),s);var M=(a,e,s)=>new Promise((i,h)=>{var o=u=>{try{f(s.next(u))}catch(w){h(w)}},c=u=>{try{f(s.throw(u))}catch(w){h(w)}},f=u=>u.done?i(u.value):Promise.resolve(u.value).then(o,c);f((s=s.apply(a,e)).next())});var Y=(a,e,s)=>(e=a[Z("asyncIterator")])?e.call(a):(a=a[Z("iterator")](),e={},s=(i,h)=>(h=a[i])&&(e[i]=o=>new Promise((c,f,u)=>(o=h.call(a,o),u=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:u}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-C3dWnJQg.cjs"),ot=require("../instantiate-DF1bIAXR.cjs"),$=require("../object-CCiXnER2.cjs");var R,O,A,p,d,v,S,L,b,E,x,et;class ct{constructor(e,s){r(this,x);r(this,R,void 0);r(this,O,void 0);r(this,A,void 0);r(this,p,void 0);r(this,d,void 0);r(this,v,void 0);r(this,S,void 0);r(this,L,null);r(this,b,[]);r(this,E,[]);n(this,R,e),n(this,O,s),n(this,A,new URLPattern({pathname:t(this,R)})),n(this,p,null),n(this,d,null),n(this,v,!1),n(this,S,null),tt.isBrowser&&n(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,v)}get element(){return t(this,d)}get nest(){return t(this,S)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return M(this,null,function*(){var i,h;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(n(this,E,[...t(this,b)]),typeof o.default=="function"&&(n(this,p,o.default),$.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield W(this,x,et).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),u={pathnameParams:c,searchParams:f};$.isESClass(t(this,p))?n(this,d,new(t(this,p))(u)):n(this,d,ot.instantiate(t(this,p),{attributes:u})),e.appendChild(t(this,d)),n(this,S,t(this,d).querySelector("[data-nest]")||((h=t(this,d).shadowRoot)==null?void 0:h.querySelector("[data-nest]"))||t(this,d).shadowRoot||t(this,d)),n(this,v,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,d))==null||e.remove(),n(this,v,!1),t(this,E).forEach(s=>document.head.removeChild(s)),n(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,d)&&(e=[...t(this,d).querySelectorAll("a")]),(s=t(this,d))!=null&&s.shadowRoot&&(e=[...e,...t(this,d).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,d=new WeakMap,v=new WeakMap,S=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,x=new WeakSet,et=function(){return M(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=Y(e),i,h,o;i=!(h=yield s.next()).done;i=!1){const c=h.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(h){o=[h]}finally{try{i&&(h=s.return)&&(yield h.call(s))}finally{if(o)throw o[0]}}})};var k,m,P,U,q,j;class lt{constructor(e,s){r(this,k,void 0);r(this,m,void 0);r(this,P,void 0);r(this,U,void 0);r(this,q,void 0);r(this,j,e=>{e.preventDefault(),t(this,k).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,m).classList.add("clicked"):t(s,m).classList.remove("clicked")}),t(this,k).navigate(t(this,P),t(this,U))});var o,c;n(this,k,e),n(this,m,s),n(this,P,t(this,m).getAttribute("href")||"/"),n(this,U,t(this,m).getAttribute("data-history-action")||"push"),t(this,m).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),h=e.normalizePath(location.pathname);n(this,q,(o=t(this,m).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,m).hasAttribute("data-include")?h.pathname.includes(i.pathname)&&t(this,m).classList.add("current"):i.pathname===h.pathname||(c=t(this,q))!=null&&c.includes(h.pathname)?(t(this,m).classList.add("current"),t(this,m).classList.add("clicked")):t(this,m).classList.remove("clicked")}destroy(){t(this,m).removeEventListener("click",t(this,j)),t(this,m).classList.remove("current")}}k=new WeakMap,m=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=at.URLPattern;var C,N,g,z,T,y,H,B,I,_,st,D;class ut{constructor(e){r(this,_);r(this,C,null);r(this,N,null);r(this,g,[]);r(this,z,null);r(this,T,[]);r(this,y,void 0);r(this,H,null);r(this,B,new rt.Notifier);r(this,I,ht.debounce(()=>{const e=s=>s.split("/").length;n(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));r(this,D,e=>{e.state&&this.navigate(e.state,"none")});tt.isBrowser&&(e!=null&&e.base?n(this,N,F.normalizeBase(e.base)):n(this,N,"/"),n(this,C,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,D)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,B).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,I).call(this)}navigate(e,s="push"){return M(this,null,function*(){var Q,V;const i=this.normalizePath(e);let{pathname:h,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===h||t(this,H)===h)return;n(this,y,h);const u=t(this,g).filter(l=>l.isActive),w=t(this,g).filter(l=>!u.includes(l)&&l.testPathname(f)),it=u.filter(l=>!l.testPathname(f)),G=u.filter(l=>l.testPathname(f));let J=!0;if(this.preprocessor)try{yield new Promise((l,nt)=>{var X;(X=this.preprocessor)==null||X.call(this,{path:i,resolve:l,reject:nt})})}catch(l){l?console.error(l):console.log("Route change canceled"),J=!1}if(J&&t(this,y)===h){n(this,z,G[G.length-1]),it.forEach(l=>{l.close()}),n(this,H,h),F.changeHistory(s,h,c,o);try{for(var ft=Y(w),pt,gt,Pt;pt=!(gt=yield ft.next()).done;pt=!1){const l=gt.value;yield l.render(((Q=t(this,z))==null?void 0:Q.nest)||t(this,C),h),n(this,z,l)}}catch(gt){Pt=[gt]}finally{try{pt&&(gt=ft.return)&&(yield gt.call(ft))}finally{if(Pt)throw Pt[0]}}W(this,_,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,B).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,t(this,N))}}C=new WeakMap,N=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,B=new WeakMap,I=new WeakMap,_=new WeakSet,st=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,C).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var h;return(h=i.getAttribute("href"))==null?void 0:h.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),n(this,T,s.map(i=>new lt(this,i)))},D=new WeakMap;exports.Router=ut;
@@ -31,7 +31,7 @@ import { Notifier as nt } from "../notifier/index.js";
31
31
  import { i as _ } from "../browser-0zX67oeU.js";
32
32
  import { d as ht } from "../function-C10DGppn.js";
33
33
  import { n as rt, c as ot, s as ct } from "../url-DMNfW7uN.js";
34
- import { i as lt } from "../instantiate-TYteKsII.js";
34
+ import { i as lt } from "../instantiate-D19vO5Ku.js";
35
35
  import { i as Z } from "../object-D6MVWB4l.js";
36
36
  var y, U, A, p, m, L, k, v, E, R, M, tt;
37
37
  class ut {