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
@@ -0,0 +1,230 @@
1
+ # ranui Builder — fluent DOM + fine-grained reactivity
2
+
3
+ `ranui/builder` is a framework-free way to build DOM declaratively with
4
+ SwiftUI/Solid-style fine-grained reactivity. No virtual DOM, no re-render of a
5
+ whole tree — a signal change updates only the exact node bound to it.
6
+
7
+ ```ts
8
+ import {
9
+ View,
10
+ Div,
11
+ Span,
12
+ ButtonBuilder, // element factories
13
+ signal,
14
+ computed,
15
+ createEffect,
16
+ batch,
17
+ untrack, // reactivity
18
+ createRoot,
19
+ onCleanup,
20
+ getOwner,
21
+ runWithOwner, // ownership
22
+ EventManager, // lifecycle-scoped events
23
+ } from 'ranui/builder';
24
+ ```
25
+
26
+ The builder does **not** register custom elements. To use `<r-button>` etc.,
27
+ also import the component subpath once: `import 'ranui/button'`.
28
+
29
+ ---
30
+
31
+ ## 1. Elements
32
+
33
+ Factories return an `ElementBuilder` (chainable). `build()` returns the DOM node.
34
+
35
+ ```ts
36
+ const box = Div().class('card').text('hi').build();
37
+
38
+ const submit = View('r-button') // any tag, incl. custom elements
39
+ .attr('type', 'primary')
40
+ .text('Save')
41
+ .on('click', onSave)
42
+ .build();
43
+ ```
44
+
45
+ Factories: `View(tag)`, `Div`, `Span`, `Slot`, `ButtonBuilder`, `InputBuilder`,
46
+ `Label`, `Ul`, `Li`, `Section`, `Article`, `Nav`, `Header`, `Footer`, `Main`,
47
+ `Style`, `DeclarativeShadow`. For anything else use `View('tag')`.
48
+
49
+ ### Chainable API
50
+
51
+ | Group | Methods |
52
+ | -------------- | ----------------------------------------------------------------------------------------------------------- |
53
+ | Identity/class | `id(v)`, `class(v)`, `addClass(...v)`, `removeClass(...v)` |
54
+ | Attributes | `attr(name, v)`, `attrs({...})`, `boolAttr(name, on, enabledValue?)`, `part(v)`, `data(key, v)` |
55
+ | Style | `style(prop, v)` / `style({...})`, `cssVar(name, v)` |
56
+ | A11y | `aria(key, v)`, `role(v)`, `tabIndex(n)`, `label(v)`, `labelledBy(id)`, `describedBy(id)`, `ariaHidden(b?)` |
57
+ | Content | `text(v)`, `children(...nodes)`, `replaceChildren(...nodes)` |
58
+ | Refs/shadow | `ref(holder)`, `shadow(opts?)` → `ShadowBuilder` |
59
+ | Terminal | `build()`, `serialize()` (SSR HTML string) |
60
+
61
+ `children()` accepts elements, strings, other `ElementBuilder`s, arrays, and
62
+ `null`/`undefined` (skipped) — nest freely:
63
+
64
+ ```ts
65
+ Ul()
66
+ .class('list')
67
+ .children(
68
+ items.map((it) => Li().text(it.name)),
69
+ extra && Li().text('extra'),
70
+ )
71
+ .build();
72
+ ```
73
+
74
+ ### Events
75
+
76
+ ```ts
77
+ .on(type, handler, options?) // permanent listener (element lifetime)
78
+ .listen(manager, type, handler) // lifecycle-managed (removed via manager.abort())
79
+ .delegate(manager, selector, type, handler) // event delegation on a container
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 2. Reactivity
85
+
86
+ ```ts
87
+ const [count, setCount] = signal(0);
88
+ count(); // read (tracked inside effects/memos)
89
+ setCount(1); // write; setCount(n => n + 1) also works
90
+ setCount(1); // no-op if unchanged (Object.is; override via signal(v, { equals }))
91
+
92
+ const double = computed(() => count() * 2); // LAZY + memoized: recomputes only
93
+ double(); // when read after a dep changed
94
+ // A memo re-notifies its readers only when its VALUE changes (override the
95
+ // comparison via computed(fn, { equals })), so effects behind a stable memo sleep.
96
+
97
+ const dispose = createEffect(() => {
98
+ // runs now + on every dependency change
99
+ console.log(count());
100
+ return () => {
101
+ /* optional cleanup, runs before re-run and on dispose */
102
+ };
103
+ });
104
+
105
+ batch(() => {
106
+ setCount(1);
107
+ setName('x');
108
+ }); // one flush, effects deduped
109
+ untrack(() => count()); // read without subscribing
110
+ ```
111
+
112
+ - **`computed` is lazy** — an unread memo never recomputes. Diamond dependencies
113
+ run a dependent effect **once** per change, not once per path.
114
+ - **Effects auto-track**: only signals actually read on the latest run are
115
+ subscribed (conditionals never leave stale subscriptions).
116
+ - **Cyclic guard**: an effect that writes a signal it reads throws instead of
117
+ looping forever.
118
+
119
+ ### Reactive bindings
120
+
121
+ Any of `text`, `attr`, `class`, `boolAttr`, `style`, `part`, `data`, `aria`,
122
+ `role`, `label` accepts a **getter** — pass a signal (or `computed`) and the
123
+ attribute/text updates itself, no manual effect:
124
+
125
+ ```ts
126
+ const [label, setLabel] = signal('Connect');
127
+ const btn = View('r-button').text(label).build(); // updates when setLabel(...) runs
128
+
129
+ const [active, setActive] = signal(true);
130
+ Div()
131
+ .class(() => (active() ? 'row active' : 'row')) // recomputes on toggle
132
+ .boolAttr('disabled', () => !active())
133
+ .build();
134
+ ```
135
+
136
+ A getter binding creates an effect **owned by the current scope** (see below), so
137
+ it is cleaned up automatically when that scope is disposed. Reactivity applies to
138
+ the single-value forms — `style(prop, getter)`, not the `style({...})` /
139
+ `attrs({...})` map forms, which apply once. A getter dropped into a map is called
140
+ once and never re-runs.
141
+
142
+ ---
143
+
144
+ ## 3. Ownership — the key to leak-free apps (and MPAs)
145
+
146
+ Every effect/memo (including reactive bindings) is owned by the scope that
147
+ created it. Disposing a scope disposes everything under it — nested effects,
148
+ bindings, and `onCleanup` callbacks.
149
+
150
+ ```ts
151
+ import { createRoot, onCleanup } from 'ranui/builder';
152
+
153
+ const dispose = createRoot((dispose) => {
154
+ const el = Div().text(msg).build(); // this binding is owned by the root
155
+ onCleanup(() => console.log('torn down'));
156
+ mount(el);
157
+ return dispose;
158
+ });
159
+
160
+ // later:
161
+ dispose(); // removes the binding's effect + runs cleanups
162
+ ```
163
+
164
+ Build reactive UI **inside a `createRoot`**. Bindings created with no owner still
165
+ work but won't auto-dispose (dispose them manually).
166
+
167
+ > **Inside a Web Component?** A component's `constructor`/`connectedCallback` are
168
+ > _not_ reactive scopes, so a getter binding or `createEffect` created there is
169
+ > orphaned (never disposed). Don't use getter bindings in component code — build
170
+ > with plain values and drive updates with explicit `createEffect`s whose dispose
171
+ > functions you collect and call in `disconnectedCallback`, re-arming on reconnect.
172
+ > See the ranui component guide (`CLAUDE.md` → "Using reactivity inside a component").
173
+
174
+ ### Multi-page / SPA pattern
175
+
176
+ Give each page/route its own root and dispose it on navigation — every effect,
177
+ binding, timer, and listener that page created is torn down in one call:
178
+
179
+ ```ts
180
+ let disposePage: (() => void) | null = null;
181
+
182
+ function showPage(render: (host: HTMLElement) => void, host: HTMLElement) {
183
+ disposePage?.(); // tear down the previous page
184
+ disposePage = createRoot((dispose) => {
185
+ render(host); // effects/bindings register to this root
186
+ return dispose;
187
+ });
188
+ }
189
+ ```
190
+
191
+ ranui's `<r-route>` has this built in. Two modes:
192
+
193
+ - **Static (default)** — slotted content, shown/hidden by URL; all routes stay in
194
+ the DOM (great for SSG — every page is pre-rendered): `<r-route path="/a">…</r-route>`.
195
+ - **Lazy (`src`)** — code-split, mount on match / unmount on leave:
196
+ `<r-route path="/a" src="/pages/a.js">`. On match the module is dynamically
197
+ imported and its `default: (host) => void | (() => void)` render runs **inside a
198
+ `createRoot`**; on leave that root is disposed — every effect, binding, and
199
+ `onCleanup` the page registered is torn down automatically. The per-page-lifecycle
200
+ mode for larger multi-page apps (client-rendered).
201
+
202
+ `getOwner()` / `runWithOwner()` let a router capture and restore a scope across
203
+ async boundaries.
204
+
205
+ ---
206
+
207
+ ## 4. Web-component listeners — `EventManager`
208
+
209
+ For listeners inside a custom element, use `EventManager` (backed by
210
+ `AbortController`) so `disconnectedCallback` removes them all at once:
211
+
212
+ ```ts
213
+ private events = new EventManager();
214
+ connectedCallback() {
215
+ this.events
216
+ .on(this.input, 'input', this.onInput)
217
+ .delegate(this, '[data-action]', 'click', (e, el) => this.run(el.dataset.action));
218
+ }
219
+ disconnectedCallback() { this.events.abort(); } // resets for the next connect
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Notes
225
+
226
+ - **SSR**: builders work under `defineSSR` / `renderToString`; `build()` returns a
227
+ mock node, `serialize()` returns HTML. Reactive bindings run once during SSR.
228
+ - **Components vs builder**: use registered `<r-*>` elements (see
229
+ [COMPONENTS.md](./COMPONENTS.md)) for rich widgets; use the builder for
230
+ layout/glue and reactive views. Theme tokens: [DESIGN.md](./DESIGN.md).
@@ -6,7 +6,7 @@ shape), slots, and `::part()` names — extracted from source. For CSS variables
6
6
  (theming tokens) see [style-tokens-public.md](./style-tokens-public.md); for
7
7
  design rules see [DESIGN.md](./DESIGN.md).
8
8
 
9
- Generated at: 2026-07-11T05:42:36.629Z
9
+ Generated at: 2026-07-12T08:47:20.080Z
10
10
 
11
11
  30 custom elements.
12
12
 
@@ -110,6 +110,19 @@ Source: `components/icon/index.ts`
110
110
  - **Slots**: —
111
111
  - **Parts**: `ran-icon`
112
112
 
113
+ > **Requires registration.** `<r-icon>` has no built-in icon set — it renders only SVGs
114
+ > registered into its in-memory registry, so `<r-icon name="lock">` is **blank** until `lock`
115
+ > is registered. Register once, in the browser, before the first `<r-icon>` connects:
116
+ >
117
+ > ```ts
118
+ > import { registerBuiltinIcons } from 'ranui'; // or 'ranui/icons'
119
+ > registerBuiltinIcons(); // registers every name in RAN_ICON_NAMES
120
+ > ```
121
+ >
122
+ > For a custom set, call `registerIcon(name, svgString)` / `registerIcons({ … })`, or pass raw
123
+ > SVG markup straight to `name` (rendered as-is when it starts with `<svg`). Valid bundled
124
+ > names are the `RanIconName` union / `RAN_ICON_NAMES` tuple.
125
+
113
126
  ## `<r-img>`
114
127
 
115
128
  Source: `components/image/index.ts`
@@ -251,8 +264,13 @@ Source: `components/radar/index.ts`
251
264
 
252
265
  Source: `components/route/index.ts`
253
266
 
254
- - **Attributes**: `exact: boolean`, `path: string`, `sheet: string`
255
- - **Properties**: `exact: boolean`, `params: Record<string, string>`, `path: string`, `sheet: string`
267
+ - **Attributes**: `exact: boolean`, `path: string`, `sheet: string`, `src: string`
268
+ - **Properties**:
269
+ - `exact: boolean`
270
+ - `params: Record<string, string>`
271
+ - `path: string`
272
+ - `sheet: string`
273
+ - `src: string` — A lazy page module's default export: render into `host`, optionally return a cleanup. */
256
274
  - **Events**: `routematch` → detail `{ params, path }`
257
275
  - **Slots**: `default`
258
276
  - **Parts**: —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ranui",
3
- "version": "0.2.0-alpha.7",
3
+ "version": "0.2.1-alpha.1",
4
4
  "description": "A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -50,6 +50,7 @@
50
50
  "typings.d.ts",
51
51
  "docs/DESIGN.md",
52
52
  "docs/COMPONENTS.md",
53
+ "docs/BUILDER.md",
53
54
  "docs/style-tokens-public.md"
54
55
  ],
55
56
  "keywords": [
@@ -114,6 +115,11 @@
114
115
  "import": "./dist/icon.js",
115
116
  "require": "./dist/index.cjs"
116
117
  },
118
+ "./icons": {
119
+ "types": "./dist/index.d.ts",
120
+ "import": "./dist/icons.js",
121
+ "require": "./dist/index.cjs"
122
+ },
117
123
  "./image": {
118
124
  "types": "./dist/index.d.ts",
119
125
  "import": "./dist/image.js",
@@ -209,6 +215,21 @@
209
215
  "import": "./dist/card.js",
210
216
  "require": "./dist/index.cjs"
211
217
  },
218
+ "./form": {
219
+ "types": "./dist/index.d.ts",
220
+ "import": "./dist/form.js",
221
+ "require": "./dist/index.cjs"
222
+ },
223
+ "./scratch": {
224
+ "types": "./dist/index.d.ts",
225
+ "import": "./dist/scratch.js",
226
+ "require": "./dist/index.cjs"
227
+ },
228
+ "./section": {
229
+ "types": "./dist/index.d.ts",
230
+ "import": "./dist/section.js",
231
+ "require": "./dist/index.cjs"
232
+ },
212
233
  "./router": {
213
234
  "types": "./dist/index.d.ts",
214
235
  "import": "./dist/router.js",
@@ -246,7 +267,7 @@
246
267
  }
247
268
  },
248
269
  "devDependencies": {
249
- "@argos-ci/playwright": "^7.3.0",
270
+ "@argos-ci/playwright": "^7.3.5",
250
271
  "@playwright/test": "^1.61.1",
251
272
  "@types/node": "^26.1.1",
252
273
  "@vitest/coverage-v8": "^4.1.10",
@@ -254,8 +275,9 @@
254
275
  "less": "^4.6.7",
255
276
  "rollup-plugin-visualizer": "^7.0.1",
256
277
  "svgo": "^4.0.1",
278
+ "terser": "^5.49.0",
257
279
  "tsx": "^4.23.0",
258
- "typescript": "^6.0.3",
280
+ "typescript": "^7.0.2",
259
281
  "vite": "^8.1.4",
260
282
  "vitest": "^4.1.10"
261
283
  },
@@ -1,165 +0,0 @@
1
- import { c as l, n as d } from "./mocks-CMGoftIc.js";
2
- var p = () => ({ current: null }), o = class h {
3
- el;
4
- constructor(t) {
5
- this.el = l ? new d(t) : document.createElement(t);
6
- }
7
- id(t) {
8
- return this.el.setAttribute("id", t), this;
9
- }
10
- class(t) {
11
- return l ? this.el.attributes.set("class", t) : this.el.className = t, this;
12
- }
13
- addClass(...t) {
14
- return t.forEach((e) => this.el.classList.add(e)), this;
15
- }
16
- removeClass(...t) {
17
- return t.forEach((e) => this.el.classList.remove(e)), this;
18
- }
19
- attr(t, e) {
20
- return this.el.setAttribute(t, e), this;
21
- }
22
- attrs(t) {
23
- return Object.entries(t).forEach(([e, r]) => {
24
- r != null && this.el.setAttribute(e, String(r));
25
- }), this;
26
- }
27
- boolAttr(t, e, r = "") {
28
- return e ? this.el.setAttribute(t, r) : this.el.removeAttribute(t), this;
29
- }
30
- part(t) {
31
- return this.el.setAttribute("part", t), this;
32
- }
33
- data(t, e) {
34
- return this.attr(`data-${t}`, e);
35
- }
36
- style(t, e) {
37
- return typeof t == "string" ? this.el.style.setProperty(t, e ?? "") : Object.entries(t).forEach(([r, a]) => this.el.style.setProperty(r, a)), this;
38
- }
39
- cssVar(t, e) {
40
- const r = t.startsWith("--") ? t : `--${t}`;
41
- return this.style(r, e);
42
- }
43
- aria(t, e) {
44
- return this.attr(`aria-${t}`, e);
45
- }
46
- role(t) {
47
- return this.attr("role", t);
48
- }
49
- tabIndex(t) {
50
- return this.attr("tabindex", String(t));
51
- }
52
- label(t) {
53
- return this.aria("label", t);
54
- }
55
- labelledBy(t) {
56
- return this.aria("labelledby", t);
57
- }
58
- describedBy(t) {
59
- return this.aria("describedby", t);
60
- }
61
- ariaHidden(t = !0) {
62
- return this.aria("hidden", String(t));
63
- }
64
- on(t, e, r) {
65
- return this.el.addEventListener(t, e, r), this;
66
- }
67
- listen(t, e, r, a) {
68
- return t.on(this.el, e, r, a), this;
69
- }
70
- delegate(t, e, r, a, n) {
71
- return t.delegate(this.el, e, r, a, n), this;
72
- }
73
- children(...t) {
74
- const e = (r) => r.reduce((a, n) => Array.isArray(n) ? a.concat(e(n)) : a.concat(n), []);
75
- return e(t).forEach((r) => {
76
- r != null && (r instanceof h ? this.el.appendChild(r.build()) : typeof r == "string" ? l ? this.el.appendChild(r) : this.el.appendChild(document.createTextNode(r)) : this.el.appendChild(r));
77
- }), this;
78
- }
79
- replaceChildren(...t) {
80
- if (l) {
81
- const e = this.el;
82
- e.childrenList = [];
83
- } else this.el.replaceChildren();
84
- return this.children(...t);
85
- }
86
- text(t) {
87
- return this.el.textContent = t, this;
88
- }
89
- ref(t) {
90
- return t.current = this.el, this;
91
- }
92
- shadow(t = { mode: "closed" }) {
93
- const e = this.el.attachShadow(t);
94
- return new u(this.el, e, t);
95
- }
96
- build() {
97
- return this.el;
98
- }
99
- serialize() {
100
- if (l) return this.el.serialize();
101
- const t = document.createElement("div");
102
- return t.appendChild(this.el.cloneNode(!0)), t.innerHTML;
103
- }
104
- }, u = class {
105
- root;
106
- hostEl;
107
- options;
108
- constructor(i, t, e) {
109
- this.hostEl = i, this.root = t, this.options = e;
110
- }
111
- children(...i) {
112
- const t = (e) => e.reduce((r, a) => Array.isArray(a) ? r.concat(t(a)) : r.concat(a), []);
113
- return t(i).forEach((e) => {
114
- e != null && (e instanceof o ? this.root.appendChild(e.build()) : typeof e == "string" ? l ? this.root.appendChild(e) : this.root.appendChild(document.createTextNode(e)) : this.root.appendChild(e));
115
- }), this;
116
- }
117
- adoptSheet(...i) {
118
- return this.root.adoptedStyleSheets = [...this.root.adoptedStyleSheets, ...i], this;
119
- }
120
- css(i) {
121
- if (l)
122
- return this.root.adoptedStyleSheets.push(i), this;
123
- if (typeof CSSStyleSheet < "u") try {
124
- const e = new CSSStyleSheet();
125
- return e.replaceSync(i), this.root.adoptedStyleSheets = [...this.root.adoptedStyleSheets, e], this;
126
- } catch {
127
- }
128
- const t = document.createElement("style");
129
- return t.textContent = i, this.root.appendChild(t), this;
130
- }
131
- done() {
132
- return {
133
- host: this.hostEl,
134
- shadow: this.root
135
- };
136
- }
137
- serialize() {
138
- return l ? this.root.serialize() : this.root.innerHTML;
139
- }
140
- }, s = (i) => new o(i), f = () => s("div"), S = () => s("span"), y = () => s("slot"), b = () => s("button"), v = () => s("input"), C = () => s("style"), E = () => s("label"), w = () => s("ul"), A = () => s("li"), g = () => s("section"), L = () => s("article"), B = () => s("nav"), m = () => s("header"), x = () => s("footer"), H = () => s("main"), N = (i = "open", t = !1) => {
141
- const e = s("template");
142
- return e.attr("shadowrootmode", i), t && e.attr("shadowrootdelegatesfocus", ""), e;
143
- };
144
- export {
145
- s as _,
146
- x as a,
147
- p as b,
148
- E as c,
149
- B as d,
150
- g as f,
151
- w as g,
152
- C as h,
153
- f as i,
154
- A as l,
155
- S as m,
156
- b as n,
157
- m as o,
158
- y as p,
159
- N as r,
160
- v as s,
161
- L as t,
162
- H as u,
163
- o as v,
164
- u as y
165
- };
@@ -1,88 +0,0 @@
1
- import { a as p, i as o, n as l, r as n, t as d } from "./utils-DBfrRFoE.js";
2
- import { t as m } from "./events-C59wGdni.js";
3
- import { p as f } from "./factory-BdsO0dEW.js";
4
- import { a as _, n as b } from "./ssr-DSGwPtEd.js";
5
- import { getSSGPath as g } from "./utils/router.js";
6
- var v = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{display:block}:host([hidden]){display:none!important}", w = class extends b {
7
- static get observedAttributes() {
8
- return [
9
- "path",
10
- "exact",
11
- "sheet"
12
- ];
13
- }
14
- _events = new m();
15
- _shadowDom;
16
- _params = {};
17
- constructor() {
18
- super(), this._shadowDom = l(this, v), d(this._shadowDom, "slot", () => f().build());
19
- }
20
- get path() {
21
- return n(this, "path", "/");
22
- }
23
- set path(t) {
24
- o(this, "path", t);
25
- }
26
- get exact() {
27
- return this.hasAttribute("exact");
28
- }
29
- get params() {
30
- return { ...this._params };
31
- }
32
- get sheet() {
33
- return n(this, "sheet");
34
- }
35
- set sheet(t) {
36
- o(this, "sheet", t);
37
- }
38
- handlerExternalCss = () => {
39
- p(this, this._shadowDom, "sheet", null, this.sheet);
40
- };
41
- _matchPath(t) {
42
- const a = this.path, e = {}, r = [], h = a.split("/").map((s) => s.startsWith(":") ? (r.push(s.slice(1)), "([^/]+)") : s === "*" ? "(.*)" : s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("/"), c = this.exact ? new RegExp(`^${h}$`) : new RegExp(`^${h}(?:/.*)?$`), i = t.match(c);
43
- return i ? (r.forEach((s, u) => {
44
- e[s] = decodeURIComponent(i[u + 1] ?? "");
45
- }), {
46
- matched: !0,
47
- params: e
48
- }) : {
49
- matched: !1,
50
- params: e
51
- };
52
- }
53
- _update(t) {
54
- const { matched: a, params: e } = this._matchPath(t);
55
- this._params = e, this.hidden = !a, a && this.dispatchEvent(new CustomEvent("routematch", {
56
- detail: {
57
- path: t,
58
- params: e
59
- },
60
- bubbles: !0
61
- }));
62
- }
63
- _preSerialize() {
64
- const t = g();
65
- t !== null && this._update(t);
66
- }
67
- connectedCallback() {
68
- this.handlerExternalCss();
69
- const t = this.closest("r-router");
70
- t && t._currentPath && this._update(t._currentPath);
71
- }
72
- disconnectedCallback() {
73
- this._events.abort();
74
- }
75
- attributeChangedCallback(t, a, e) {
76
- if (a !== e) {
77
- if (t === "path" || t === "exact") {
78
- const r = this.closest("r-router");
79
- r && this._update(r._currentPath);
80
- }
81
- t === "sheet" && this.handlerExternalCss();
82
- }
83
- }
84
- };
85
- _("r-route", w);
86
- export {
87
- w as t
88
- };
@@ -1,57 +0,0 @@
1
- var c = null, u = null, f = null;
2
- function b(r, e) {
3
- const s = e?.equals ?? Object.is;
4
- let t = r;
5
- const n = /* @__PURE__ */ new Set();
6
- return [() => (c && u && (n.add(c), u.add(n)), t), (o) => {
7
- const d = typeof o == "function" ? o(t) : o;
8
- if (!s(t, d))
9
- if (t = d, f) for (const a of n) f.add(a);
10
- else for (const a of [...n]) a();
11
- }];
12
- }
13
- function p(r) {
14
- let e, s = !1;
15
- const t = /* @__PURE__ */ new Set(), n = () => {
16
- if (s) return;
17
- e?.();
18
- for (const o of t) o.delete(n);
19
- t.clear();
20
- const l = c, i = u;
21
- c = n, u = t;
22
- try {
23
- e = r() ?? void 0;
24
- } finally {
25
- c = l, u = i;
26
- }
27
- };
28
- return n(), () => {
29
- s = !0, e?.();
30
- for (const l of t) l.delete(n);
31
- t.clear();
32
- };
33
- }
34
- function v(r) {
35
- const [e, s] = b(void 0);
36
- return p(() => s(r())), e;
37
- }
38
- function S(r) {
39
- if (f) {
40
- r();
41
- return;
42
- }
43
- const e = /* @__PURE__ */ new Set();
44
- f = e;
45
- try {
46
- r();
47
- } finally {
48
- f = null;
49
- for (const s of e) s();
50
- }
51
- }
52
- export {
53
- b as i,
54
- v as n,
55
- p as r,
56
- S as t
57
- };