ranui 0.2.0-alpha.7 → 0.2.1-alpha.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.
Files changed (111) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/arrow-down-Bi5kqUrX.js +12 -0
  4. package/dist/builder.d.ts +2 -2
  5. package/dist/builder.js +32 -28
  6. package/dist/builtin-D9djWkCE.js +409 -0
  7. package/dist/{button-Be_uHDZG.js → button-BfYw0fes.js} +1 -1
  8. package/dist/button.js +1 -1
  9. package/dist/{card-BVvXX6KM.js → card-CqJa4Q_v.js} +1 -1
  10. package/dist/card.js +1 -1
  11. package/dist/{checkbox-BtoX9X2Z.js → checkbox-CThC9-vy.js} +1 -1
  12. package/dist/checkbox.js +1 -1
  13. package/dist/{colorpicker-Dukms7ET.js → colorpicker-XNxDRcQ-.js} +5 -6
  14. package/dist/colorpicker.js +1 -1
  15. package/dist/components/colorpicker/index.d.ts +3 -3
  16. package/dist/components/icon/builtin.d.ts +9 -0
  17. package/dist/components/icon/index.d.ts +8 -0
  18. package/dist/components/route/index.d.ts +10 -4
  19. package/dist/components/router/index.d.ts +3 -0
  20. package/dist/{dropdown-BYS1Trdu.js → dropdown-CCvsambb.js} +1 -1
  21. package/dist/dropdown.js +1 -1
  22. package/dist/factory-DCrO37si.js +334 -0
  23. package/dist/{form-BsB5JhS4.js → form-Ceq3uJzz.js} +1 -1
  24. package/dist/form.js +1 -1
  25. package/dist/{icon-pfolda2m.js → icon-C_ENrJ3F.js} +50 -13
  26. package/dist/icon.js +4 -3
  27. package/dist/icons.js +5 -0
  28. package/dist/iife/button.iife.js +1 -1
  29. package/dist/iife/card.iife.js +1 -1
  30. package/dist/iife/checkbox.iife.js +1 -1
  31. package/dist/iife/colorpicker.iife.js +2 -2
  32. package/dist/iife/dropdown.iife.js +1 -1
  33. package/dist/iife/form.iife.js +1 -1
  34. package/dist/iife/icon.iife.js +1 -1
  35. package/dist/iife/image.iife.js +1 -1
  36. package/dist/iife/input.iife.js +1 -1
  37. package/dist/iife/loading.iife.js +1 -1
  38. package/dist/iife/math.iife.js +14 -14
  39. package/dist/iife/message.iife.js +1 -1
  40. package/dist/iife/modal.iife.js +1 -1
  41. package/dist/iife/player.iife.js +8 -8
  42. package/dist/iife/popover.iife.js +1 -1
  43. package/dist/iife/progress.iife.js +1 -1
  44. package/dist/iife/radar.iife.js +1 -1
  45. package/dist/iife/route.iife.js +1 -1
  46. package/dist/iife/router.iife.js +1 -1
  47. package/dist/iife/scratch.iife.js +1 -1
  48. package/dist/iife/section.iife.js +1 -1
  49. package/dist/iife/select.iife.js +2 -2
  50. package/dist/iife/skeleton.iife.js +1 -1
  51. package/dist/iife/tab.iife.js +1 -1
  52. package/dist/iife/tabpane.iife.js +1 -1
  53. package/dist/{image-BXpKQ9sU.js → image-B7MBI5n_.js} +1 -1
  54. package/dist/image.js +1 -1
  55. package/dist/index.cjs +256 -23
  56. package/dist/index.d.ts +3 -1
  57. package/dist/index.iife.js +266 -33
  58. package/dist/index.js +69 -65
  59. package/dist/{input-BMMM60e6.js → input-RNqdEHPf.js} +2 -2
  60. package/dist/input.js +1 -1
  61. package/dist/{loading-BScjyeVm.js → loading-B9MFI03l.js} +1 -1
  62. package/dist/loading.js +1 -1
  63. package/dist/{math-IjzOAwnA.js → math-CudIwEXZ.js} +1 -1
  64. package/dist/math.js +1 -1
  65. package/dist/{message-CLpuP8HY.js → message-DW7qWpEm.js} +34 -49
  66. package/dist/message.js +1 -1
  67. package/dist/{modal-DOTpABRe.js → modal-CrvGKL2B.js} +1 -1
  68. package/dist/modal.js +1 -1
  69. package/dist/{player-5olrw-qB.js → player-BKQaaT7o.js} +2 -2
  70. package/dist/player.js +1 -1
  71. package/dist/{popover-DRUQjdPs.js → popover-CvYIVgUS.js} +2 -2
  72. package/dist/popover.js +1 -1
  73. package/dist/{progress-BIEXYYd2.js → progress-C6jctsFH.js} +1 -1
  74. package/dist/progress.js +1 -1
  75. package/dist/{radar-DAF95_Mj.js → radar-BUb4EzmG.js} +1 -1
  76. package/dist/radar.js +1 -1
  77. package/dist/route-Djrf9UR_.js +116 -0
  78. package/dist/route.js +1 -1
  79. package/dist/{router-B9rCrWXm.js → router-BU2KhtxV.js} +22 -17
  80. package/dist/router.js +1 -1
  81. package/dist/{scratch-QlPyy1f4.js → scratch-CO4I2dIa.js} +1 -1
  82. package/dist/scratch.js +1 -1
  83. package/dist/{section-D0qMm9KM.js → section-CsUkp8bv.js} +1 -1
  84. package/dist/section.js +1 -1
  85. package/dist/{select-aAaWoveE.js → select-Dn26ajJZ.js} +8 -15
  86. package/dist/select.js +1 -1
  87. package/dist/{skeleton-CFqQmKyt.js → skeleton-BuMLhvzQ.js} +1 -1
  88. package/dist/skeleton.js +1 -1
  89. package/dist/{tab-CiF2YPck.js → tab-40fDkuox.js} +1 -1
  90. package/dist/tab.js +1 -1
  91. package/dist/{tabpane-B-m3xwqu.js → tabpane-F4Pd7JtC.js} +1 -1
  92. package/dist/tabpane.js +1 -1
  93. package/dist/test/unit/icon.builtin.test.d.ts +1 -0
  94. package/dist/test/unit/utils.colorpicker.reconnect.test.d.ts +1 -0
  95. package/dist/test/unit/utils.route.lazy.test.d.ts +1 -0
  96. package/dist/test/unit/utils.router.match.test.d.ts +1 -0
  97. package/dist/test/unit/utils.signal.owner.test.d.ts +1 -0
  98. package/dist/utils/builder/core.d.ts +20 -13
  99. package/dist/utils/builder/factory.d.ts +1 -1
  100. package/dist/utils/builder/index.d.ts +2 -2
  101. package/dist/utils/builder/signal.d.ts +93 -64
  102. package/dist/utils/router/index.d.ts +13 -3
  103. package/dist/utils/router.js +95 -54
  104. package/dist/utils/theme.d.ts +1 -1
  105. package/dist/warning-circle-fill-Cz0qu7AH.js +23 -0
  106. package/docs/BUILDER.md +230 -0
  107. package/docs/COMPONENTS.md +21 -3
  108. package/package.json +25 -3
  109. package/dist/factory-BdsO0dEW.js +0 -165
  110. package/dist/route-MQZpn2BP.js +0 -88
  111. package/dist/signal-CSSZxlK5.js +0 -57
@@ -1,87 +1,116 @@
1
1
  /**
2
- * Reactive primitives — signal / createEffect / computed / batch
3
- *
4
- * Design reference: SwiftUI @Observable + Solid.js fine-grained reactivity
5
- *
6
- * SwiftUI's core model: View = f(State)
7
- * @State / @Observable — reactive source (≈ signal)
8
- * body pure function of state, auto-tracks reads (≈ createEffect)
9
- * computed property — derived, cached ( computed)
10
- *
11
- * Two improvements over a naive signal implementation, both borrowed from Solid.js:
12
- *
13
- * 1. Stale subscription cleanup
14
- * Before each re-run, an effect removes itself from every signal it previously
15
- * subscribed to, then re-subscribes only to signals read in this run.
16
- * Without this, conditional reads leave permanent ghost subscriptions that
17
- * trigger effects for signals they no longer care about.
18
- *
19
- * 2. Batching
20
- * batch(fn) defers all effect executions until fn returns, then flushes once.
21
- * Mirrors SwiftUI's automatic coalescing of mutations in the same event handler.
22
- * Without this, setting two signals triggers each dependent effect twice.
2
+ * Reactive primitives — signal / computed / createEffect / batch, plus an
3
+ * ownership layer (createRoot / onCleanup / getOwner / runWithOwner) and untrack.
4
+ *
5
+ * Design reference: SwiftUI @Observable + Solid.js fine-grained reactivity.
6
+ *
7
+ * View = f(State)
8
+ * signal reactive source (@State)
9
+ * computed — derived, LAZY + memoized (SwiftUI computed property / Solid memo)
10
+ * createEffect— side effect that re-runs when its reads change (≈ body)
11
+ * ownership — effects/memos form an owner tree; disposing a scope disposes
12
+ * everything created under it (critical for MPA: tear down a page
13
+ * and every effect it spawned is cleaned up in one call).
14
+ *
15
+ * Model (push-pull scheduling + lazy memos):
16
+ * - Reading a source inside a computation links them both ways.
17
+ * - Writing a signal marks direct observers DIRTY and their transitive memo
18
+ * observers CHECK ("maybe dirty"), scheduling any dependent effects. Effects
19
+ * flush once (deduped — diamond dependencies run an effect a single time).
20
+ * - Memos recompute lazily on read, and only re-notify their observers when
21
+ * their derived value actually changes (via `equals`). A CHECK computation
22
+ * first pulls its sources up to date; if none changed value, it is skipped —
23
+ * so a memo whose output is stable never wakes the effects behind it.
24
+ * - Every computation is owned; re-running or disposing it first disposes its
25
+ * owned children and runs its cleanups (no leaked nested effects).
23
26
  */
24
27
  export type Getter<T> = () => T;
25
28
  export type Setter<T> = (value: T | ((prev: T) => T)) => void;
26
29
  export interface SignalOptions<T> {
27
- /** Custom equality check. Defaults to Object.is. Return true to skip update. */
30
+ /** Custom equality. Defaults to Object.is. Return true to skip the update. */
28
31
  equals?: (prev: T, next: T) => boolean;
29
32
  }
33
+ /** Anything a computation can subscribe to (a signal, or a memo). */
34
+ interface SourceLike {
35
+ observers: Set<Computation>;
36
+ }
37
+ /** Staleness of a computation. CLEAN → up to date; CHECK → a memo source may
38
+ * have changed (verify before recomputing); DIRTY → definitely recompute. */
39
+ declare const CLEAN = 0;
40
+ declare const CHECK = 1;
41
+ declare const DIRTY = 2;
42
+ type State = typeof CLEAN | typeof CHECK | typeof DIRTY;
43
+ /** An effect or a memo — a node that runs a function and tracks its reads. */
44
+ interface Computation extends Owner {
45
+ fn: () => unknown;
46
+ /** Sources (signals / memos) read during the last run. */
47
+ sources: Set<SourceLike>;
48
+ isEffect: boolean;
49
+ running: boolean;
50
+ disposed: boolean;
51
+ state: State;
52
+ observers: Set<Computation>;
53
+ value: unknown;
54
+ equals: (a: unknown, b: unknown) => boolean;
55
+ }
56
+ /** A node that can own child computations + cleanups (effect, memo, or root). */
57
+ export interface Owner {
58
+ owned: Computation[];
59
+ cleanups: Array<() => void>;
60
+ owner: Owner | null;
61
+ }
30
62
  /**
31
- * Create a reactive value. Returns a [getter, setter] tuple.
63
+ * Create a reactive value. Returns a `[getter, setter]` tuple.
32
64
  *
33
65
  * const [count, setCount] = signal(0);
34
- * count() // read — auto-tracks inside createEffect / computed
35
- * setCount(1) // write — notifies dependents; skips if value unchanged
36
- * setCount(n => n + 1) // updater function form
66
+ * count(); // read — auto-tracked inside computed / createEffect
67
+ * setCount(1); // write — notifies dependents; skipped if unchanged
68
+ * setCount((n) => n + 1) // updater form
37
69
  */
38
70
  export declare function signal<T>(initial: T, options?: SignalOptions<T>): [Getter<T>, Setter<T>];
39
71
  /**
40
- * Run fn immediately and re-run it whenever any signal read inside it changes.
41
- * Returns a dispose function that stops the effect and cleans up subscriptions.
42
- *
43
- * Before each re-run, the effect removes itself from every signal it previously
44
- * subscribed to (stale-subscription cleanup), then re-subscribes only to signals
45
- * read in the new run.
46
- *
47
- * fn may return a cleanup function called before each re-run and on dispose.
72
+ * Derived, read-only, LAZY + memoized value. Recomputes only when read after a
73
+ * dependency changed; unread memos never recompute. When a recompute produces an
74
+ * equal value (default `Object.is`, override via `options.equals`) the memo does
75
+ * NOT notify its observers so effects behind a value-stable memo stay asleep.
76
+ * Owned by the current scope, so it is disposed when that scope is.
77
+ *
78
+ * const fullName = computed(() => `${first()} ${last()}`);
79
+ * fullName(); // computes on first read, caches until a dep's value changes
80
+ */
81
+ export declare function computed<T>(fn: () => T, options?: SignalOptions<T>): Getter<T>;
82
+ /**
83
+ * Run `fn` immediately, then re-run it whenever a signal/memo it read changes.
84
+ * Owned by the current scope. `fn` may return a cleanup, called before each
85
+ * re-run and on dispose. Returns a dispose function.
48
86
  *
49
87
  * const dispose = createEffect(() => {
50
- * document.title = `Count: ${count()}`;
51
- * return () => { document.title = ''; }; // optional cleanup
88
+ * el.textContent = `Count: ${count()}`;
89
+ * return () => {}; // optional cleanup
52
90
  * });
53
- *
54
- * dispose(); // stop tracking, remove from all signals
55
91
  */
56
92
  export declare function createEffect(fn: () => void | (() => void)): () => void;
57
93
  /**
58
- * Derived read-only signal. Recomputes when its dependencies change.
59
- *
60
- * const [firstName, setFirstName] = signal('Jane');
61
- * const [lastName, setLastName] = signal('Doe');
62
- * const fullName = computed(() => `${firstName()} ${lastName()}`);
63
- *
64
- * fullName() // 'Jane Doe'
65
- * setFirstName('John');
66
- * fullName() // 'John Doe'
94
+ * Coalesce multiple writes into one flush. Effects run once after `fn` returns,
95
+ * deduplicated. Nested batches are absorbed by the outermost one.
67
96
  */
68
- export declare function computed<T>(fn: () => T): Getter<T>;
97
+ export declare function batch(fn: () => void): void;
98
+ /** Read signals without subscribing the current computation to them. */
99
+ export declare function untrack<T>(fn: () => T): T;
69
100
  /**
70
- * Run multiple signal writes as a single atomic update.
71
- * All effects are deferred until fn returns, then flushed once (deduplicated).
101
+ * Create a disposable reactive scope. Effects/memos created inside are owned by
102
+ * it; calling the passed `dispose` tears them all down. Use one per page/route
103
+ * in an MPA/SPA so navigating away cleans up every effect that page spawned.
72
104
  *
73
- * Mirrors SwiftUI's automatic coalescing of mutations within the same event handler.
74
- *
75
- * // Without batch: each setter triggers effects independently (2 runs)
76
- * setFirstName('John');
77
- * setLastName('Smith');
78
- *
79
- * // With batch: one flush after both writes (1 run)
80
- * batch(() => {
81
- * setFirstName('John');
82
- * setLastName('Smith');
83
- * });
84
- *
85
- * Nested batch() calls are safe — inner calls are absorbed by the outer batch.
105
+ * const dispose = createRoot((dispose) => { renderPage(); return dispose; });
106
+ * // ...later, on navigation:
107
+ * dispose();
86
108
  */
87
- export declare function batch(fn: () => void): void;
109
+ export declare function createRoot<T>(fn: (dispose: () => void) => T): T;
110
+ /** Register a cleanup on the current scope, run when it re-runs or is disposed. */
111
+ export declare function onCleanup(fn: () => void): void;
112
+ /** The current owner scope (for advanced integrations, e.g. a router). */
113
+ export declare function getOwner(): Owner | null;
114
+ /** Run `fn` under a specific owner scope (pairs with getOwner). */
115
+ export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
116
+ export {};
@@ -55,10 +55,19 @@ export interface RouterComponentElement extends HTMLElement {
55
55
  export declare function getSSGPath(): string | null;
56
56
  export declare function setSSGPath(path: string): void;
57
57
  export declare function clearSSGPath(): void;
58
+ /**
59
+ * Match a route pattern (with `:param` and `*` segments) against a path.
60
+ * Single source of truth shared by RouterCore and the `<r-route>` element.
61
+ */
62
+ export declare function matchPath(routePath: string, exact: boolean, path: string): {
63
+ matched: boolean;
64
+ params: Record<string, string>;
65
+ };
58
66
  export declare class RouterCore {
59
67
  private readonly _mode;
60
68
  private readonly _base;
61
69
  private readonly _routes;
70
+ private readonly _flatRoutes;
62
71
  private readonly _vtMode;
63
72
  private readonly _beforeGuards;
64
73
  private readonly _afterGuards;
@@ -73,10 +82,11 @@ export declare class RouterCore {
73
82
  get base(): string;
74
83
  get routes(): RouteConfig[];
75
84
  get currentRoute(): RouteLocation | null;
76
- private _matchConfigPath;
77
- /** Return the first RouteConfig whose path matches the given URL path, or null. */
85
+ /** Return the first matching route (absolute path, nested-aware), or null. */
78
86
  matchRoute(path: string): RouteConfig | null;
79
- /** Return all route paths declared in the router config used to enumerate SSG pages. */
87
+ /** Extract `:param` values for the first matching route ({} if none). */
88
+ matchParams(path: string): Record<string, string>;
89
+ /** All declared route paths (nested flattened) — used to enumerate SSG pages. */
80
90
  getStaticPaths(): string[];
81
91
  private _enableMpa;
82
92
  private _disableMpa;
@@ -1,41 +1,71 @@
1
- var o = null, r = null, u = null;
2
- function m() {
3
- return u;
1
+ var c = null, r = null, h = null;
2
+ function P() {
3
+ return h;
4
4
  }
5
- function v(e) {
6
- u = e;
5
+ function x(e) {
6
+ h = e;
7
7
  }
8
- function b() {
9
- u = null;
8
+ function E() {
9
+ h = null;
10
10
  }
11
- function f(e) {
11
+ function m(e) {
12
12
  const t = {};
13
- return e && new URLSearchParams(e.startsWith("?") ? e.slice(1) : e).forEach((i, n) => {
14
- t[n] = i;
13
+ return e && new URLSearchParams(e.startsWith("?") ? e.slice(1) : e).forEach((n, a) => {
14
+ t[a] = n;
15
15
  }), t;
16
16
  }
17
- function l() {
17
+ function f(e, t, n) {
18
+ const a = [], s = e.split("/").map((i) => i.startsWith(":") ? (a.push(i.slice(1)), "([^/]+)") : i === "*" ? "(.*)" : i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("/"), o = t ? new RegExp(`^${s}$`) : new RegExp(`^${s}(?:/.*)?$`), u = n.match(o);
19
+ if (!u) return {
20
+ matched: !1,
21
+ params: {}
22
+ };
23
+ const d = {};
24
+ return a.forEach((i, w) => {
25
+ d[i] = decodeURIComponent(u[w + 1] ?? "");
26
+ }), {
27
+ matched: !0,
28
+ params: d
29
+ };
30
+ }
31
+ function g(e, t) {
32
+ return e ? `${e.replace(/\/$/, "")}/${t.replace(/^\//, "")}` : t;
33
+ }
34
+ function l(e, t = "") {
35
+ const n = [];
36
+ for (const a of e) {
37
+ const s = g(t, a.path);
38
+ n.push({
39
+ path: s,
40
+ exact: a.exact ?? !1,
41
+ meta: a.meta
42
+ }), a.children?.length && n.push(...l(a.children, s));
43
+ }
44
+ return n;
45
+ }
46
+ function v() {
18
47
  return typeof document < "u" && "startViewTransition" in document;
19
48
  }
20
- function _(e) {
21
- l() ? document.startViewTransition(e) : e();
49
+ function b(e) {
50
+ v() ? document.startViewTransition(e) : e();
22
51
  }
23
- function h() {
52
+ function p() {
24
53
  typeof document > "u" || r && document.head.contains(r) || (r = document.createElement("style"), r.textContent = "@view-transition { navigation: auto; }", document.head.appendChild(r));
25
54
  }
26
- function d() {
55
+ function _() {
27
56
  r?.remove(), r = null;
28
57
  }
29
- function p(e) {
58
+ function y(e) {
30
59
  return e === !0 || e === "spa" || e === "both";
31
60
  }
32
- function w(e) {
61
+ function S(e) {
33
62
  return e === "mpa" || e === "both";
34
63
  }
35
- var g = class {
64
+ var R = class {
36
65
  _mode;
37
66
  _base;
38
67
  _routes;
68
+ _flatRoutes;
39
69
  _vtMode;
40
70
  _beforeGuards = [];
41
71
  _afterGuards = [];
@@ -46,7 +76,7 @@ var g = class {
46
76
  _current = null;
47
77
  _mpaActive = !1;
48
78
  constructor(e = {}) {
49
- this._mode = e.mode ?? "history", this._base = e.base ?? "", this._routes = e.routes ?? [], this._vtMode = e.viewTransition, w(this._vtMode) && this._enableMpa();
79
+ this._mode = e.mode ?? "history", this._base = e.base ?? "", this._routes = e.routes ?? [], this._flatRoutes = l(this._routes), this._vtMode = e.viewTransition, S(this._vtMode) && this._enableMpa();
50
80
  }
51
81
  get mode() {
52
82
  return this._mode;
@@ -60,21 +90,29 @@ var g = class {
60
90
  get currentRoute() {
61
91
  return this._current;
62
92
  }
63
- _matchConfigPath(e, t) {
64
- const i = [], n = t.path.split("/").map((s) => s.startsWith(":") ? (i.push(s.slice(1)), "([^/]+)") : s === "*" ? "(.*)" : s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("/");
65
- return (t.exact ? new RegExp(`^${n}$`) : new RegExp(`^${n}(?:/.*)?$`)).test(e);
66
- }
67
93
  matchRoute(e) {
68
- return this._routes.find((t) => this._matchConfigPath(e, t)) ?? null;
94
+ const t = this._flatRoutes.find((n) => f(n.path, n.exact, e).matched);
95
+ return t ? {
96
+ path: t.path,
97
+ exact: t.exact,
98
+ meta: t.meta
99
+ } : null;
100
+ }
101
+ matchParams(e) {
102
+ for (const t of this._flatRoutes) {
103
+ const n = f(t.path, t.exact, e);
104
+ if (n.matched) return n.params;
105
+ }
106
+ return {};
69
107
  }
70
108
  getStaticPaths() {
71
- return this._routes.map((e) => e.path);
109
+ return this._flatRoutes.map((e) => e.path);
72
110
  }
73
111
  _enableMpa() {
74
- this._mpaActive || (this._mpaActive = !0, h(), typeof window < "u" && (window.addEventListener("pageswap", this._onPageSwap), window.addEventListener("pagereveal", this._onPageReveal)));
112
+ this._mpaActive || (this._mpaActive = !0, p(), typeof window < "u" && (window.addEventListener("pageswap", this._onPageSwap), window.addEventListener("pagereveal", this._onPageReveal)));
75
113
  }
76
114
  _disableMpa() {
77
- this._mpaActive && (this._mpaActive = !1, d(), typeof window < "u" && (window.removeEventListener("pageswap", this._onPageSwap), window.removeEventListener("pagereveal", this._onPageReveal)));
115
+ this._mpaActive && (this._mpaActive = !1, _(), typeof window < "u" && (window.removeEventListener("pageswap", this._onPageSwap), window.removeEventListener("pagereveal", this._onPageReveal)));
78
116
  }
79
117
  _onPageSwap = (e) => {
80
118
  this._pageSwapHandlers.forEach((t) => t(e));
@@ -89,11 +127,11 @@ var g = class {
89
127
  this._components.delete(e);
90
128
  }
91
129
  _buildLocation(e) {
92
- const t = e.indexOf("?"), i = t === -1 ? e : e.slice(0, t), n = t === -1 ? "" : e.slice(t + 1);
130
+ const t = e.indexOf("?"), n = t === -1 ? e : e.slice(0, t), a = t === -1 ? "" : e.slice(t + 1);
93
131
  return {
94
- path: i || "/",
132
+ path: n || "/",
95
133
  params: {},
96
- query: f(n),
134
+ query: m(a),
97
135
  fullPath: e || "/"
98
136
  };
99
137
  }
@@ -104,21 +142,23 @@ var g = class {
104
142
  return (t && e.startsWith(t) ? e.slice(t.length) || "/" : e) + (window.location.search || "");
105
143
  }
106
144
  _notify() {
107
- const e = this._buildLocation(this._getCurrentPath()), t = this._current;
145
+ const e = this._buildLocation(this._getCurrentPath());
146
+ e.params = this.matchParams(e.path);
147
+ const t = this._current;
108
148
  this._current = e;
109
- const i = () => {
110
- this._components.forEach((n) => n._syncRoutes());
149
+ const n = () => {
150
+ this._components.forEach((a) => a._syncRoutes());
111
151
  };
112
- p(this._vtMode) ? _(i) : i(), this._afterGuards.forEach((n) => n(e, t)), this._changeHandlers.forEach((n) => n(e, t));
152
+ y(this._vtMode) ? b(n) : n(), this._afterGuards.forEach((a) => a(e, t)), this._changeHandlers.forEach((a) => a(e, t));
113
153
  }
114
154
  async _navigate(e, t) {
115
- const i = this._buildLocation(e), n = this._current;
155
+ const n = this._buildLocation(e), a = this._current;
116
156
  for (const s of this._beforeGuards) {
117
- const a = await new Promise((c) => {
118
- s(i, n, c);
157
+ const o = await new Promise((u) => {
158
+ s(n, a, u);
119
159
  });
120
- if (a === !1) return;
121
- if (typeof a == "string") return this._navigate(a, t);
160
+ if (o === !1) return;
161
+ if (typeof o == "string") return this._navigate(o, t);
122
162
  }
123
163
  if (typeof window < "u") {
124
164
  const s = this._mode === "hash" ? `#${e}` : this._base + e;
@@ -175,23 +215,24 @@ var g = class {
175
215
  };
176
216
  }
177
217
  };
178
- function y(e) {
179
- o?.destroy();
180
- const t = new g(e);
181
- return o = t, t;
218
+ function H(e) {
219
+ c?.destroy();
220
+ const t = new R(e);
221
+ return c = t, t;
182
222
  }
183
- function S() {
184
- return o;
223
+ function M() {
224
+ return c;
185
225
  }
186
- function P() {
187
- return h(), () => d();
226
+ function G() {
227
+ return p(), () => _();
188
228
  }
189
229
  export {
190
- g as RouterCore,
191
- b as clearSSGPath,
192
- y as createRouter,
193
- P as enableMpaViewTransitions,
194
- m as getSSGPath,
195
- v as setSSGPath,
196
- S as useRouter
230
+ R as RouterCore,
231
+ E as clearSSGPath,
232
+ H as createRouter,
233
+ G as enableMpaViewTransitions,
234
+ P as getSSGPath,
235
+ f as matchPath,
236
+ x as setSSGPath,
237
+ M as useRouter
197
238
  };
@@ -2,7 +2,7 @@ export type RanThemeName = 'light' | 'dark' | 'system';
2
2
  export type ThemeTarget = HTMLElement | Document;
3
3
  export type ThemeTokenMap = Record<string, string | number | null | undefined>;
4
4
  export declare const setTheme: (name: RanThemeName, target?: ThemeTarget) => void;
5
- export declare const getTheme: (target?: ThemeTarget) => RanThemeName | "";
5
+ export declare const getTheme: (target?: ThemeTarget) => RanThemeName | '';
6
6
  export declare const setThemeToken: (name: string, value: string | number, target?: HTMLElement) => void;
7
7
  export declare const clearThemeToken: (name: string, target?: HTMLElement) => void;
8
8
  export declare const setThemeTokens: (tokens: ThemeTokenMap, target?: HTMLElement) => void;
@@ -0,0 +1,23 @@
1
+ var i = {
2
+ success: !0,
3
+ _identification: !0,
4
+ data: '<svg t="1667965185400" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8572" width="200" height="200"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64z m193.5 301.7l-210.6 292c-12.7 17.7-39 17.7-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" p-id="8573"></path></svg>'
5
+ }, t = {
6
+ success: !0,
7
+ _identification: !0,
8
+ data: '<svg t="1667965220951" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8711" width="200" height="200"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64z m165.4 618.2l-66-0.3L512 563.4l-99.3 118.4-66.1 0.3c-4.4 0-8-3.5-8-8 0-1.9 0.7-3.7 1.9-5.2l130.1-155L340.5 359c-1.2-1.5-1.9-3.3-1.9-5.2 0-4.4 3.6-8 8-8l66.1 0.3L512 464.6l99.3-118.4 66-0.3c4.4 0 8 3.5 8 8 0 1.9-0.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z" p-id="8712"></path></svg>'
9
+ }, s = {
10
+ success: !0,
11
+ _identification: !0,
12
+ data: '<svg t="1667965239916" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8850" width="200" height="200"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64z m32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272z m-32-344c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48z" p-id="8851"></path></svg>'
13
+ }, c = {
14
+ success: !0,
15
+ _identification: !0,
16
+ data: '<svg t="1667965273540" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8989" width="200" height="200"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64z m-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296z m32 440c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48z" p-id="8990"></path></svg>'
17
+ };
18
+ export {
19
+ i,
20
+ s as n,
21
+ t as r,
22
+ c as t
23
+ };