aptechka 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/lib/Composed-C2Vv1xxR.cjs +1 -0
  2. package/lib/Composed-DhtYBEmo.js +79 -0
  3. package/lib/abstract-elements/index.cjs +1 -1
  4. package/lib/abstract-elements/index.js +1 -1
  5. package/lib/canvas/index.cjs +1 -1
  6. package/lib/canvas/index.js +2 -2
  7. package/lib/component/Component.d.ts +29 -0
  8. package/lib/component/hooks/animation.d.ts +9 -0
  9. package/lib/component/hooks/context.d.ts +2 -0
  10. package/lib/component/hooks/intersection.d.ts +4 -0
  11. package/lib/component/hooks/resize.d.ts +6 -0
  12. package/lib/component/hooks/shadow.d.ts +1 -0
  13. package/lib/component/hooks/stores.d.ts +6 -0
  14. package/lib/component/hooks/style.d.ts +2 -0
  15. package/lib/component/index.cjs +1 -0
  16. package/lib/component/index.d.ts +7 -0
  17. package/lib/component/index.js +187 -0
  18. package/lib/connector/index.cjs +1 -1
  19. package/lib/connector/index.d.ts +4 -3
  20. package/lib/connector/index.js +24 -22
  21. package/lib/{createStylesheet-BsVHqHhr.cjs → createStylesheet-BoJwXvjE.cjs} +1 -1
  22. package/lib/{createStylesheet-ITfBHk7A.js → createStylesheet-DSgkNlUZ.js} +1 -1
  23. package/lib/element-constructor/ElementConstructor.d.ts +4 -3
  24. package/lib/element-constructor/index.cjs +1 -1
  25. package/lib/element-constructor/index.js +2 -2
  26. package/lib/element-constructor/tags.d.ts +2 -3
  27. package/lib/element-resizer/index.cjs +1 -1
  28. package/lib/element-resizer/index.d.ts +1 -1
  29. package/lib/element-resizer/index.js +2 -1
  30. package/lib/en3/core/en3.d.ts +2 -2
  31. package/lib/en3/objects/En3Clip.d.ts +1 -1
  32. package/lib/{index-COirQu7j.js → index-228VqUsZ.js} +2 -2
  33. package/lib/{index-Bt91QUTY.cjs → index-Cv4y7_7y.cjs} +1 -1
  34. package/lib/intersector/index.cjs +1 -1
  35. package/lib/intersector/index.d.ts +1 -1
  36. package/lib/intersector/index.js +2 -1
  37. package/lib/layout-box/index.cjs +1 -1
  38. package/lib/layout-box/index.d.ts +2 -2
  39. package/lib/layout-box/index.js +70 -72
  40. package/lib/modal/index.cjs +1 -1
  41. package/lib/modal/index.js +2 -2
  42. package/lib/object-C1ph624j.cjs +1 -0
  43. package/lib/object-DIPjdukP.js +73 -0
  44. package/lib/popover/index.cjs +1 -1
  45. package/lib/popover/index.js +79 -71
  46. package/lib/router/Route.d.ts +8 -2
  47. package/lib/router/index.cjs +1 -1
  48. package/lib/router/index.d.ts +1 -2
  49. package/lib/router/index.js +139 -140
  50. package/lib/scroll/index.cjs +1 -1
  51. package/lib/scroll/index.js +2 -2
  52. package/lib/select/index.cjs +1 -1
  53. package/lib/select/index.js +1 -1
  54. package/lib/store/index.cjs +1 -1
  55. package/lib/store/index.js +48 -111
  56. package/lib/studio/index.cjs +1 -1
  57. package/lib/studio/index.js +3 -3
  58. package/lib/tags-920hsh9U.cjs +1 -0
  59. package/lib/tags-kZqsS_nJ.js +793 -0
  60. package/lib/theme/index.cjs +1 -1
  61. package/lib/theme/index.js +1 -1
  62. package/lib/ticker/index.cjs +1 -1
  63. package/lib/ticker/index.d.ts +1 -1
  64. package/lib/ticker/index.js +42 -36
  65. package/lib/utils/dom.d.ts +2 -2
  66. package/lib/utils/index.cjs +1 -1
  67. package/lib/utils/index.d.ts +1 -1
  68. package/lib/utils/index.js +113 -168
  69. package/lib/utils/object.d.ts +1 -0
  70. package/package.json +10 -2
  71. package/lib/router/RouteElement.d.ts +0 -14
  72. package/lib/tags-8Y7LSTwg.js +0 -779
  73. package/lib/tags-pcim-Cws.cjs +0 -1
@@ -1,122 +1,130 @@
1
- import { Attribute as T } from "../attribute/index.js";
2
- import { CustomElement as x, define as P } from "../custom-element/index.js";
3
- import { S as I } from "../Store-JOKrNVEr.js";
4
- import { g as q } from "../style-j2TwriJ_.js";
5
- import { AbstractButtonElement as B } from "../abstract-elements/index.js";
6
- var O = Object.defineProperty, G = Object.getOwnPropertyDescriptor, H = (e, t, i) => t in e ? O(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, N = (e, t, i, r) => {
7
- for (var n = r > 1 ? void 0 : r ? G(t, i) : t, c = e.length - 1, l; c >= 0; c--)
8
- (l = e[c]) && (n = (r ? l(t, i, n) : l(n)) || n);
9
- return r && n && O(t, i, n), n;
10
- }, W = (e, t, i) => (H(e, typeof t != "symbol" ? t + "" : t, i), i), k = (e, t, i) => {
1
+ import { Attribute as C } from "../attribute/index.js";
2
+ import { CustomElement as I, define as A } from "../custom-element/index.js";
3
+ import { S as q } from "../Store-JOKrNVEr.js";
4
+ import { g as B } from "../style-j2TwriJ_.js";
5
+ import { AbstractButtonElement as G } from "../abstract-elements/index.js";
6
+ var x = Object.defineProperty, H = Object.getOwnPropertyDescriptor, R = (e, t, s) => t in e ? x(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, F = (e, t, s, r) => {
7
+ for (var n = r > 1 ? void 0 : r ? H(t, s) : t, p = e.length - 1, l; p >= 0; p--)
8
+ (l = e[p]) && (n = (r ? l(t, s, n) : l(n)) || n);
9
+ return r && n && x(t, s, n), n;
10
+ }, $ = (e, t, s) => (R(e, typeof t != "symbol" ? t + "" : t, s), s), T = (e, t, s) => {
11
11
  if (!t.has(e))
12
- throw TypeError("Cannot " + i);
13
- }, s = (e, t, i) => (k(e, t, "read from private field"), i ? i.call(e) : t.get(e)), o = (e, t, i) => {
12
+ throw TypeError("Cannot " + s);
13
+ }, i = (e, t, s) => (T(e, t, "read from private field"), s ? s.call(e) : t.get(e)), o = (e, t, s) => {
14
14
  if (t.has(e))
15
15
  throw TypeError("Cannot add the same private member more than once");
16
- t instanceof WeakSet ? t.add(e) : t.set(e, i);
17
- }, L = (e, t, i, r) => (k(e, t, "write to private field"), r ? r.call(e, i) : t.set(e, i), i), $ = (e, t, i) => (k(e, t, "access private method"), i), E, h, v, d, m, _, M, A, w, g, y, S, f;
18
- let a = class extends x {
16
+ t instanceof WeakSet ? t.add(e) : t.set(e, s);
17
+ }, W = (e, t, s, r) => (T(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), P = (e, t, s) => (T(e, t, "access private method"), s), S, h, m, d, g, f, k, D, _, w, y, E, L, M, v;
18
+ let a = class extends I {
19
19
  constructor() {
20
- super(...arguments), o(this, M), o(this, y), o(this, E, -1), o(this, h, new I(!1)), o(this, v, void 0), o(this, d, new T(this, "history", !1)), o(this, m, new T(this, "single", !1)), o(this, _, !1), W(this, "open", () => {
21
- s(this, h).current || (s(this, h).current = !0, s(this, m).current && (a.__opened.forEach((e) => e.close()), a.__opened = []), a.__opened.push(this), L(this, E, a.__opened.length - 1), s(this, d).current && s(this, _) && history.pushState("", "", s(this, M, A)), clearTimeout(s(this, v)), this.classList.add("triggered"), this.style.display = "block", setTimeout(() => {
22
- addEventListener("click", s(this, w)), addEventListener("keydown", s(this, g)), this.style.opacity = "1", this.classList.add("opened");
20
+ super(...arguments), o(this, k), o(this, _), o(this, L), o(this, S, -1), o(this, h, new q(!1)), o(this, m, void 0), o(this, d, new C(this, "history", !1)), o(this, g, new C(this, "single", !1)), o(this, f, !1), $(this, "open", () => {
21
+ i(this, h).current || (i(this, h).current = !0, i(this, g).current && (a.__opened.forEach((e) => e.close()), a.__opened = []), a.__opened.push(this), W(this, S, a.__opened.length - 1), i(this, d).current && i(this, f) && history.pushState("", "", i(this, k, D)), clearTimeout(i(this, m)), this.classList.add("triggered"), this.style.display = "block", setTimeout(() => {
22
+ addEventListener("click", i(this, y)), addEventListener("keydown", i(this, E)), this.style.opacity = "1", this.classList.add("opened");
23
23
  }));
24
- }), W(this, "close", () => {
25
- s(this, h).current && (s(this, h).current = !1, a.__opened = a.__opened.filter((e) => e !== this), s(this, d).current && history.replaceState("", "", location.pathname.replace(this.id, "")), this.classList.remove("opened"), this.style.opacity = "0", removeEventListener("click", s(this, w)), removeEventListener("keydown", s(this, g)), setTimeout(() => {
24
+ }), $(this, "close", () => {
25
+ i(this, h).current && (i(this, h).current = !1, a.__opened = a.__opened.filter((e) => e !== this), i(this, d).current && history.replaceState(
26
+ "",
27
+ "",
28
+ location.href.replace(new RegExp(`[&?]${i(this, _, w)}`, "g"), "")
29
+ ), this.classList.remove("opened"), this.style.opacity = "0", removeEventListener("click", i(this, y)), removeEventListener("keydown", i(this, E)), setTimeout(() => {
26
30
  this.classList.remove("triggered"), this.style.display = "none";
27
- }, q(this)));
28
- }), o(this, w, (e) => {
29
- $(this, y, S).call(this, () => {
31
+ }, B(this)));
32
+ }), o(this, y, (e) => {
33
+ P(this, L, M).call(this, () => {
30
34
  const t = e.composedPath();
31
- (!t.find((i) => i === this) && !t.find(
32
- (i) => i instanceof HTMLElement && i.closest("e-popover-button")
35
+ (!t.find((s) => s === this) && !t.find(
36
+ (s) => s instanceof HTMLElement && s.closest("e-popover-button")
33
37
  ) || t[0] instanceof HTMLElement && t[0].hasAttribute("outside")) && this.close();
34
38
  });
35
- }), o(this, g, (e) => {
36
- $(this, y, S).call(this, () => {
39
+ }), o(this, E, (e) => {
40
+ P(this, L, M).call(this, () => {
37
41
  e.code === "Escape" && this.close();
38
42
  });
39
- }), o(this, f, () => {
40
- L(this, _, !1), s(this, h).current && s(this, d).current && !location.pathname.includes(this.id) ? this.close() : !s(this, h).current && s(this, d).current && location.pathname.includes(this.id) && this.open(), L(this, _, !0);
43
+ }), o(this, v, () => {
44
+ W(this, f, !1), i(this, h).current && i(this, d).current && !location.search.includes(i(this, _, w)) ? this.close() : !i(this, h).current && i(this, d).current && location.search.includes(i(this, _, w)) && this.open(), W(this, f, !0);
41
45
  });
42
46
  }
43
47
  get history() {
44
- return s(this, d);
48
+ return i(this, d);
45
49
  }
46
50
  get single() {
47
- return s(this, m);
51
+ return i(this, g);
48
52
  }
49
53
  get opened() {
50
- return s(this, h);
54
+ return i(this, h);
51
55
  }
52
56
  connectedCallback() {
53
- this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", s(this, f)), setTimeout(() => {
54
- s(this, f).call(this);
57
+ this.style.opacity = "0", this.style.display = "none", addEventListener("popstate", i(this, v)), setTimeout(() => {
58
+ i(this, v).call(this);
55
59
  }, 0);
56
60
  }
57
61
  disconnectedCallback() {
58
- clearTimeout(s(this, v)), removeEventListener("popstate", s(this, f));
62
+ clearTimeout(i(this, m)), removeEventListener("popstate", i(this, v));
59
63
  }
60
64
  };
61
- E = /* @__PURE__ */ new WeakMap();
65
+ S = /* @__PURE__ */ new WeakMap();
62
66
  h = /* @__PURE__ */ new WeakMap();
63
- v = /* @__PURE__ */ new WeakMap();
64
- d = /* @__PURE__ */ new WeakMap();
65
67
  m = /* @__PURE__ */ new WeakMap();
66
- _ = /* @__PURE__ */ new WeakMap();
67
- M = /* @__PURE__ */ new WeakSet();
68
- A = function() {
69
- return `${location.pathname}${location.pathname.endsWith("/") ? "" : "/"}${this.id}`;
70
- };
71
- w = /* @__PURE__ */ new WeakMap();
68
+ d = /* @__PURE__ */ new WeakMap();
72
69
  g = /* @__PURE__ */ new WeakMap();
73
- y = /* @__PURE__ */ new WeakSet();
74
- S = function(e) {
75
- (a.__opened[s(this, E) - 1] || a.__opened.length === 1) && e();
76
- };
77
70
  f = /* @__PURE__ */ new WeakMap();
78
- W(a, "__opened", []);
79
- a = N([
80
- P("e-popover")
71
+ k = /* @__PURE__ */ new WeakSet();
72
+ D = function() {
73
+ return `${location.pathname}${location.search ? location.search + "&" : "?"}${i(this, _, w)}`;
74
+ };
75
+ _ = /* @__PURE__ */ new WeakSet();
76
+ w = function() {
77
+ return `modal-${this.id}`;
78
+ };
79
+ y = /* @__PURE__ */ new WeakMap();
80
+ E = /* @__PURE__ */ new WeakMap();
81
+ L = /* @__PURE__ */ new WeakSet();
82
+ M = function(e) {
83
+ (a.__opened[i(this, S) - 1] || a.__opened.length === 1) && e();
84
+ };
85
+ v = /* @__PURE__ */ new WeakMap();
86
+ $(a, "__opened", []);
87
+ a = F([
88
+ A("e-popover")
81
89
  ], a);
82
- var F = Object.defineProperty, R = Object.getOwnPropertyDescriptor, z = (e, t, i, r) => {
83
- for (var n = r > 1 ? void 0 : r ? R(t, i) : t, c = e.length - 1, l; c >= 0; c--)
84
- (l = e[c]) && (n = (r ? l(t, i, n) : l(n)) || n);
85
- return r && n && F(t, i, n), n;
86
- }, D = (e, t, i) => {
90
+ var z = Object.defineProperty, J = Object.getOwnPropertyDescriptor, K = (e, t, s, r) => {
91
+ for (var n = r > 1 ? void 0 : r ? J(t, s) : t, p = e.length - 1, l; p >= 0; p--)
92
+ (l = e[p]) && (n = (r ? l(t, s, n) : l(n)) || n);
93
+ return r && n && z(t, s, n), n;
94
+ }, N = (e, t, s) => {
87
95
  if (!t.has(e))
88
- throw TypeError("Cannot " + i);
89
- }, u = (e, t, i) => (D(e, t, "read from private field"), i ? i.call(e) : t.get(e)), J = (e, t, i) => {
96
+ throw TypeError("Cannot " + s);
97
+ }, u = (e, t, s) => (N(e, t, "read from private field"), s ? s.call(e) : t.get(e)), Q = (e, t, s) => {
90
98
  if (t.has(e))
91
99
  throw TypeError("Cannot add the same private member more than once");
92
- t instanceof WeakSet ? t.add(e) : t.set(e, i);
93
- }, K = (e, t, i, r) => (D(e, t, "write to private field"), r ? r.call(e, i) : t.set(e, i), i), p;
94
- let C = class extends B {
100
+ t instanceof WeakSet ? t.add(e) : t.set(e, s);
101
+ }, U = (e, t, s, r) => (N(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), c;
102
+ let O = class extends G {
95
103
  constructor() {
96
- super(...arguments), J(this, p, void 0);
104
+ super(...arguments), Q(this, c, void 0);
97
105
  }
98
106
  get popoverElement() {
99
- return u(this, p);
107
+ return u(this, c);
100
108
  }
101
109
  click() {
102
- if (u(this, p)) {
110
+ if (u(this, c)) {
103
111
  const e = this.getAttribute("type") || "open";
104
- e === "open" || e === "toggle" && !u(this, p).opened.current ? u(this, p).open() : (e === "close" || e === "toggle" && u(this, p).opened.current) && u(this, p).close();
112
+ e === "open" || e === "toggle" && !u(this, c).opened.current ? u(this, c).open() : (e === "close" || e === "toggle" && u(this, c).opened.current) && u(this, c).close();
105
113
  }
106
114
  }
107
115
  connectedCallback() {
108
116
  const e = this.getAttribute("target");
109
117
  if (e) {
110
118
  const t = document.querySelector(`#${e}`) || this.getRootNode().querySelector(`#${e}`);
111
- t ? K(this, p, t) : console.warn(this, `target ${e} not found`);
119
+ t ? U(this, c, t) : console.warn(this, `target ${e} not found`);
112
120
  }
113
121
  }
114
122
  };
115
- p = /* @__PURE__ */ new WeakMap();
116
- C = z([
117
- P("e-popover-button")
118
- ], C);
123
+ c = /* @__PURE__ */ new WeakMap();
124
+ O = K([
125
+ A("e-popover-button")
126
+ ], O);
119
127
  export {
120
- C as PopoverButtonElement,
128
+ O as PopoverButtonElement,
121
129
  a as PopoverElement
122
130
  };
@@ -1,12 +1,18 @@
1
- import { RouteElement } from './RouteElement';
2
1
  export type RouteModule = () => Promise<any>;
2
+ export type RouteURLParams<T extends string = string> = Partial<{
3
+ [key in T]: string;
4
+ }>;
5
+ export type RouteParameters<PathnameParams extends string = string, SearchParams extends string = string> = {
6
+ pathnameParams: RouteURLParams<PathnameParams>;
7
+ searchParams: RouteURLParams<SearchParams>;
8
+ };
3
9
  export declare class Route {
4
10
  #private;
5
11
  constructor(pattern: string, module: RouteModule);
6
12
  get pattern(): string;
7
13
  get urlPattern(): URLPattern;
8
14
  get isActive(): boolean;
9
- get element(): RouteElement<string, string> | null;
15
+ get element(): HTMLElement | null;
10
16
  get outlet(): HTMLElement | ShadowRoot | null;
11
17
  testPathname(pathname: string): boolean;
12
18
  render(containerElement: HTMLElement | ShadowRoot, pathname: string): Promise<void>;
@@ -1 +1 @@
1
- "use strict";var it=Object.defineProperty;var $=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i);var rt=(i,t,s)=>t in i?it(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var K=(i,t,s)=>(rt(i,typeof t!="symbol"?t+"":t,s),s),J=(i,t,s)=>{if(!t.has(i))throw TypeError("Cannot "+s)};var e=(i,t,s)=>(J(i,t,"read from private field"),s?s.call(i):t.get(i)),n=(i,t,s)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,s)},o=(i,t,s,r)=>(J(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s);var Q=(i,t,s)=>(J(i,t,"access private method"),s);var W=(i,t,s)=>new Promise((r,l)=>{var a=d=>{try{f(s.next(d))}catch(T){l(T)}},u=d=>{try{f(s.throw(d))}catch(T){l(T)}},f=d=>d.done?r(d.value):Promise.resolve(d.value).then(a,u);f((s=s.apply(i,t)).next())});var V=(i,t,s)=>(t=i[$("asyncIterator")])?t.call(i):(i=i[$("iterator")](),t={},s=(r,l)=>(l=i[r])&&(t[r]=a=>new Promise((u,f,d)=>(a=l.call(i,a),d=a.done,Promise.resolve(a.value).then(T=>u({value:T,done:d}),f)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const nt=require("urlpattern-polyfill"),ot=require("../notifier/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),at=require("../function-MthRj-GJ.cjs"),ht=require("../custom-element/index.cjs");var R,x,b,m,c,P,S,w,v,E,Y,et;class ct{constructor(t,s){n(this,Y);n(this,R,void 0);n(this,x,void 0);n(this,b,void 0);n(this,m,void 0);n(this,c,void 0);n(this,P,void 0);n(this,S,void 0);n(this,w,null);n(this,v,[]);n(this,E,[]);o(this,R,t),o(this,x,s),o(this,b,new URLPattern({pathname:e(this,R)})),o(this,m,null),o(this,c,null),o(this,P,!1),o(this,S,null),tt.isBrowser&&o(this,w,new MutationObserver(r=>{r[0].addedNodes.forEach(a=>{e(this,m)?e(this,E).push(a):e(this,v).push(a)})}))}get pattern(){return e(this,R)}get urlPattern(){return e(this,b)}get isActive(){return e(this,P)}get element(){return e(this,c)}get outlet(){return e(this,S)}testPathname(t){return this.urlPattern.test({pathname:t})}render(t,s){return W(this,null,function*(){var r,l;if(e(this,w).observe(document.head,{childList:!0,subtree:!0}),e(this,m))e(this,v).forEach(a=>{document.head.appendChild(a)});else{const a=yield e(this,x).call(this);o(this,E,[...e(this,v)]),typeof a.default=="function"&&(o(this,m,a.default),customElements.define("e-"+((r=e(this,m))==null?void 0:r.name.toLowerCase()),a.default))}if(yield Q(this,Y,et).call(this),e(this,m)){const a=e(this,b).exec({pathname:s}),u=(a==null?void 0:a.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),d={pathnameParams:u,searchParams:f};o(this,c,new(e(this,m))(d)),t.appendChild(e(this,c)),o(this,S,e(this,c).querySelector("[data-outlet]")||((l=e(this,c).shadowRoot)==null?void 0:l.querySelector("[data-outlet]"))||e(this,c).shadowRoot||e(this,c)),o(this,P,!0)}e(this,w).disconnect()})}close(){var t;e(this,w).disconnect(),(t=e(this,c))==null||t.remove(),o(this,P,!1),e(this,E).forEach(s=>document.head.removeChild(s)),o(this,E,[])}getAnchorElements(){var s;let t=[];return e(this,c)&&(t=[...e(this,c).querySelectorAll("a")]),(s=e(this,c))!=null&&s.shadowRoot&&(t=[...t,...e(this,c).shadowRoot.querySelectorAll("a")]),t}}R=new WeakMap,x=new WeakMap,b=new WeakMap,m=new WeakMap,c=new WeakMap,P=new WeakMap,S=new WeakMap,w=new WeakMap,v=new WeakMap,E=new WeakMap,Y=new WeakSet,et=function(){return W(this,null,function*(){const t=e(this,v).filter(u=>u instanceof HTMLElement?u.tagName==="STYLE"||u.tagName==="SCRIPT"||u.tagName==="LINK":!1);try{for(var s=V(t),r,l,a;r=!(l=yield s.next()).done;r=!1){const u=l.value;yield new Promise(f=>{u.onload=()=>{f()}})}}catch(l){a=[l]}finally{try{r&&(l=s.return)&&(yield l.call(s))}finally{if(a)throw a[0]}}})};var H,g,A,U,M;class lt{constructor(t,s){n(this,H,void 0);n(this,g,void 0);n(this,A,void 0);n(this,U,void 0);n(this,M,t=>{t.preventDefault(),e(this,H).navigate(e(this,A),e(this,U))});o(this,H,t),o(this,g,s),o(this,A,e(this,g).getAttribute("href")||"/"),o(this,U,e(this,g).getAttribute("data-history-action")||"push"),e(this,g).addEventListener("click",e(this,M)),location.pathname===e(this,A)&&e(this,g).classList.add("current")}destroy(){e(this,g).removeEventListener("click",e(this,M)),e(this,g).classList.remove("current")}}H=new WeakMap,g=new WeakMap,A=new WeakMap,U=new WeakMap,M=new WeakMap;globalThis.URLPattern=nt.URLPattern;var k,q,p,N,j,y,C,B,z,F,st,G;const O=class O{constructor(t){n(this,F);n(this,k,null);n(this,q,void 0);n(this,p,[]);n(this,N,null);n(this,j,[]);n(this,y,void 0);n(this,C,null);n(this,B,new ot.Notifier);K(this,"preprocessor");K(this,"postprocessor");n(this,z,at.debounce(()=>{const t=s=>s.split("/").length;o(this,p,e(this,p).sort((s,r)=>t(s.pattern)-t(r.pattern))),this.navigate(location.pathname.replace(e(this,q),""))},0));n(this,G,t=>{t.state&&this.navigate(t.state,"none")});o(this,q,(t==null?void 0:t.base)||""),O.active=this,tt.isBrowser&&(o(this,k,(t==null?void 0:t.rootElement)||document.body),addEventListener("popstate",e(this,G)))}get currentPathname(){return e(this,C)}get candidatePathname(){return e(this,y)}get routes(){return e(this,p)}navigationEvent(t){return e(this,B).subscribe(t)}defineRoute(t,s){const r=new ct(t,s);e(this,p).push(r),e(this,z).call(this)}navigate(t,s="push"){return W(this,null,function*(){var d,Z;if(e(this,y)===t||e(this,C)===t)return;O.active=this,o(this,y,t);const r=e(this,p).filter(h=>h.isActive),l=e(this,p).filter(h=>!r.includes(h)&&h.testPathname(t)),a=r.filter(h=>!h.testPathname(t)),u=r.filter(h=>h.testPathname(t));let f=!0;if(this.preprocessor)try{yield new Promise((h,L)=>{var _;(_=this.preprocessor)==null||_.call(this,{pathname:t,resolve:h,reject:L})})}catch(h){h?console.error(h):console.log("Route change canceled"),f=!1}if(f&&e(this,y)===t){o(this,N,u[u.length-1]),a.forEach(L=>{L.close()}),o(this,C,t);try{for(var T=V(l),mt,gt,pt;mt=!(gt=yield T.next()).done;mt=!1){const L=gt.value;yield L.render(((d=e(this,N))==null?void 0:d.outlet)||e(this,k),t),o(this,N,L)}}catch(gt){pt=[gt]}finally{try{mt&&(gt=T.return)&&(yield gt.call(T))}finally{if(pt)throw pt[0]}}const h=e(this,q)+t+location.search;s==="push"?history.pushState(h,"",h):s==="replace"&&history.replaceState(h,"",h),Q(this,F,st).call(this),(Z=this.postprocessor)==null||Z.call(this,{pathname:t}),e(this,B).notify({pathname:t})}})}};k=new WeakMap,q=new WeakMap,p=new WeakMap,N=new WeakMap,j=new WeakMap,y=new WeakMap,C=new WeakMap,B=new WeakMap,z=new WeakMap,F=new WeakSet,st=function(){const t=e(this,p).filter(r=>r.isActive),s=Array.from(new Set([...e(this,k).querySelectorAll("a"),...t.map(r=>r.getAnchorElements()).flat()].filter(r=>{var l;return(l=r.getAttribute("href"))==null?void 0:l.startsWith("/")})));e(this,j).forEach(r=>{r.destroy()}),o(this,j,s.map(r=>new lt(this,r)))},G=new WeakMap,K(O,"active");let X=O;var I,D;class ut extends ht.CustomElement{constructor(s){super();n(this,I,void 0);n(this,D,void 0);o(this,I,s.pathnameParams),o(this,D,s.searchParams)}get pathnameParams(){return e(this,I)}get searchParams(){return e(this,D)}}I=new WeakMap,D=new WeakMap;exports.RouteElement=ut;exports.Router=X;
1
+ "use strict";var st=Object.defineProperty;var Z=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i);var it=(i,t,s)=>t in i?st(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var I=(i,t,s)=>(it(i,typeof t!="symbol"?t+"":t,s),s),F=(i,t,s)=>{if(!t.has(i))throw TypeError("Cannot "+s)};var e=(i,t,s)=>(F(i,t,"read from private field"),s?s.call(i):t.get(i)),n=(i,t,s)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,s)},o=(i,t,s,r)=>(F(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s);var G=(i,t,s)=>(F(i,t,"access private method"),s);var D=(i,t,s)=>new Promise((r,f)=>{var h=u=>{try{d(s.next(u))}catch(T){f(T)}},a=u=>{try{d(s.throw(u))}catch(T){f(T)}},d=u=>u.done?r(u.value):Promise.resolve(u.value).then(h,a);d((s=s.apply(i,t)).next())});var J=(i,t,s)=>(t=i[Z("asyncIterator")])?t.call(i):(i=i[Z("iterator")](),t={},s=(r,f)=>(f=i[r])&&(t[r]=h=>new Promise((a,d,u)=>(h=f.call(i,h),u=h.done,Promise.resolve(h.value).then(T=>a({value:T,done:u}),d)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const rt=require("urlpattern-polyfill"),ot=require("../notifier/index.cjs"),_=require("../browser-CpzFX2xg.cjs"),nt=require("../function-MthRj-GJ.cjs"),$=require("../object-C1ph624j.cjs");var b,H,R,m,l,w,S,v,P,y,K,tt;class ht{constructor(t,s){n(this,K);n(this,b,void 0);n(this,H,void 0);n(this,R,void 0);n(this,m,void 0);n(this,l,void 0);n(this,w,void 0);n(this,S,void 0);n(this,v,null);n(this,P,[]);n(this,y,[]);o(this,b,t),o(this,H,s),o(this,R,new URLPattern({pathname:e(this,b)})),o(this,m,null),o(this,l,null),o(this,w,!1),o(this,S,null),_.isBrowser&&o(this,v,new MutationObserver(r=>{r[0].addedNodes.forEach(h=>{e(this,m)?e(this,y).push(h):e(this,P).push(h)})}))}get pattern(){return e(this,b)}get urlPattern(){return e(this,R)}get isActive(){return e(this,w)}get element(){return e(this,l)}get outlet(){return e(this,S)}testPathname(t){return this.urlPattern.test({pathname:t})}render(t,s){return D(this,null,function*(){var r,f;if(e(this,v).observe(document.head,{childList:!0,subtree:!0}),e(this,m))e(this,P).forEach(h=>{document.head.appendChild(h)});else{const h=yield e(this,H).call(this);if(o(this,y,[...e(this,P)]),typeof h.default=="function"&&(o(this,m,h.default),$.isESClass(h.default))){const a="e-"+((r=e(this,m))==null?void 0:r.name.toLowerCase());customElements.get(a)||customElements.define(a,h.default)}}if(yield G(this,K,tt).call(this),e(this,m)){const h=e(this,R).exec({pathname:s}),a=(h==null?void 0:h.pathname.groups)||{},d=Object.fromEntries(new URLSearchParams(location.search)),u={pathnameParams:a,searchParams:d};$.isESClass(e(this,m))?o(this,l,new(e(this,m))(u)):o(this,l,e(this,m).call(this,u)),t.appendChild(e(this,l)),o(this,S,e(this,l).querySelector("[data-outlet]")||((f=e(this,l).shadowRoot)==null?void 0:f.querySelector("[data-outlet]"))||e(this,l).shadowRoot||e(this,l)),o(this,w,!0)}e(this,v).disconnect()})}close(){var t;e(this,v).disconnect(),(t=e(this,l))==null||t.remove(),o(this,w,!1),e(this,y).forEach(s=>document.head.removeChild(s)),o(this,y,[])}getAnchorElements(){var s;let t=[];return e(this,l)&&(t=[...e(this,l).querySelectorAll("a")]),(s=e(this,l))!=null&&s.shadowRoot&&(t=[...t,...e(this,l).shadowRoot.querySelectorAll("a")]),t}}b=new WeakMap,H=new WeakMap,R=new WeakMap,m=new WeakMap,l=new WeakMap,w=new WeakMap,S=new WeakMap,v=new WeakMap,P=new WeakMap,y=new WeakMap,K=new WeakSet,tt=function(){return D(this,null,function*(){const t=e(this,P).filter(a=>a instanceof HTMLElement?a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK":!1);try{for(var s=J(t),r,f,h;r=!(f=yield s.next()).done;r=!1){const a=f.value;yield new Promise(d=>{a.onload=()=>{d()}})}}catch(f){h=[f]}finally{try{r&&(f=s.return)&&(yield f.call(s))}finally{if(h)throw h[0]}}})};var U,g,A,j,M;class at{constructor(t,s){n(this,U,void 0);n(this,g,void 0);n(this,A,void 0);n(this,j,void 0);n(this,M,t=>{t.preventDefault(),e(this,U).navigate(e(this,A),e(this,j))});o(this,U,t),o(this,g,s),o(this,A,e(this,g).getAttribute("href")||"/"),o(this,j,e(this,g).getAttribute("data-history-action")||"push"),e(this,g).addEventListener("click",e(this,M)),location.pathname===e(this,A)&&e(this,g).classList.add("current")}destroy(){e(this,g).removeEventListener("click",e(this,M)),e(this,g).classList.remove("current")}}U=new WeakMap,g=new WeakMap,A=new WeakMap,j=new WeakMap,M=new WeakMap;globalThis.URLPattern=rt.URLPattern;var k,q,p,C,x,E,N,B,W,Y,et,z;const O=class O{constructor(t){n(this,Y);n(this,k,null);n(this,q,void 0);n(this,p,[]);n(this,C,null);n(this,x,[]);n(this,E,void 0);n(this,N,null);n(this,B,new ot.Notifier);I(this,"preprocessor");I(this,"postprocessor");n(this,W,nt.debounce(()=>{const t=s=>s.split("/").length;o(this,p,e(this,p).sort((s,r)=>t(s.pattern)-t(r.pattern))),this.navigate(location.pathname.replace(e(this,q),""))},0));n(this,z,t=>{t.state&&this.navigate(t.state,"none")});o(this,q,(t==null?void 0:t.base)||""),O.active=this,_.isBrowser&&(o(this,k,(t==null?void 0:t.rootElement)||document.body),addEventListener("popstate",e(this,z)))}get currentPathname(){return e(this,N)}get candidatePathname(){return e(this,E)}get routes(){return e(this,p)}navigationEvent(t){return e(this,B).subscribe(t)}defineRoute(t,s){const r=new ht(t,s);e(this,p).push(r),e(this,W).call(this)}navigate(t,s="push"){return D(this,null,function*(){var u,V;if(e(this,E)===t||e(this,N)===t)return;O.active=this,o(this,E,t);const r=e(this,p).filter(c=>c.isActive),f=e(this,p).filter(c=>!r.includes(c)&&c.testPathname(t)),h=r.filter(c=>!c.testPathname(t)),a=r.filter(c=>c.testPathname(t));let d=!0;if(this.preprocessor)try{yield new Promise((c,L)=>{var X;(X=this.preprocessor)==null||X.call(this,{pathname:t,resolve:c,reject:L})})}catch(c){c?console.error(c):console.log("Route change canceled"),d=!1}if(d&&e(this,E)===t){o(this,C,a[a.length-1]),h.forEach(L=>{L.close()}),o(this,N,t);try{for(var T=J(f),ut,ft,dt;ut=!(ft=yield T.next()).done;ut=!1){const L=ft.value;yield L.render(((u=e(this,C))==null?void 0:u.outlet)||e(this,k),t),o(this,C,L)}}catch(ft){dt=[ft]}finally{try{ut&&(ft=T.return)&&(yield ft.call(T))}finally{if(dt)throw dt[0]}}const c=e(this,q)+t+location.search;s==="push"?history.pushState(c,"",c):s==="replace"&&history.replaceState(c,"",c),G(this,Y,et).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:t}),e(this,B).notify({pathname:t})}})}};k=new WeakMap,q=new WeakMap,p=new WeakMap,C=new WeakMap,x=new WeakMap,E=new WeakMap,N=new WeakMap,B=new WeakMap,W=new WeakMap,Y=new WeakSet,et=function(){const t=e(this,p).filter(r=>r.isActive),s=Array.from(new Set([...e(this,k).querySelectorAll("a"),...t.map(r=>r.getAnchorElements()).flat()].filter(r=>{var f;return(f=r.getAttribute("href"))==null?void 0:f.startsWith("/")})));e(this,x).forEach(r=>{r.destroy()}),o(this,x,s.map(r=>new at(this,r)))},z=new WeakMap,I(O,"active");let Q=O;exports.Router=Q;
@@ -1,3 +1,2 @@
1
1
  export { Router, type RouterPreprocessorEntry, type RouterPreprocessor, type RouterPostprocessor, type RouterAfterNavigationCallback, type RouterHistoryAction, type RouterParameters, } from './Router';
2
- export { RouteElement, type RouteParameters, type RouteURLParams } from './RouteElement';
3
- export { type RouteModule } from './Route';
2
+ export { type RouteModule, type RouteParameters, type RouteURLParams, } from './Route';