fiboui 1.0.2 → 2.0.0

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 (169) hide show
  1. package/README.md +138 -92
  2. package/dist/FineGrain-kBxv0WeR.js +29 -0
  3. package/dist/Link-DDzSPY1Q.js +88 -0
  4. package/dist/PluginManager-D5-ApsSN.js +111 -0
  5. package/dist/Router-i6Nc6qVs.js +386 -0
  6. package/dist/builder-DjLYXkXu.js +1842 -0
  7. package/dist/bundle-mjs-wppB-TKB.js +2760 -0
  8. package/dist/cli/bin.js +20 -0
  9. package/dist/cli/commands/generate/component.js +67 -0
  10. package/dist/cli/commands/generate/index.js +10 -0
  11. package/dist/cli/commands/generate/module.js +58 -0
  12. package/dist/cli/commands/generate/plugin.js +67 -0
  13. package/dist/cli/commands/init.js +58 -0
  14. package/dist/content.js +17 -0
  15. package/dist/core.js +33 -0
  16. package/dist/{effects-D16XdB_d.mjs → effects-CnevV566.js} +1 -0
  17. package/dist/index-B1av7e36.js +1102 -0
  18. package/dist/index-BQGRpkzR.js +1024 -0
  19. package/dist/index-CTRZRn9S.js +90 -0
  20. package/dist/index-DKFr-sai.js +33 -0
  21. package/dist/index-Dm4j2mMM.js +1031 -0
  22. package/dist/index-RbfIZuAo.js +119 -0
  23. package/dist/index-yeYkDTAx.js +778 -0
  24. package/dist/index.d.ts +43753 -6
  25. package/dist/index.js +2054 -0
  26. package/dist/interactive.js +12 -0
  27. package/dist/layout.js +18 -0
  28. package/dist/mount-sAVX_FBU.js +95 -0
  29. package/dist/navigation.js +13 -0
  30. package/dist/provider-B0eB-Wy7.js +286 -0
  31. package/dist/structure.js +15 -0
  32. package/dist/style.css +1 -1
  33. package/dist/style.js +1 -0
  34. package/dist/theme.js +9 -0
  35. package/package.json +88 -13
  36. package/dist/content/Alert/index.d.ts +0 -878
  37. package/dist/content/Avatar/index.d.ts +0 -886
  38. package/dist/content/Badge/index.d.ts +0 -887
  39. package/dist/content/Image/index.d.ts +0 -893
  40. package/dist/content/Label/index.d.ts +0 -879
  41. package/dist/content/Progress/index.d.ts +0 -898
  42. package/dist/content/Skeleton/index.d.ts +0 -879
  43. package/dist/content/Spinner/index.d.ts +0 -880
  44. package/dist/content/Text/index.d.ts +0 -878
  45. package/dist/content/index.d.ts +0 -9
  46. package/dist/core/StateWrapper.d.ts +0 -31
  47. package/dist/core/builder.d.ts +0 -58
  48. package/dist/core/component.d.ts +0 -7
  49. package/dist/core/effects.d.ts +0 -4
  50. package/dist/core/hooks.d.ts +0 -5
  51. package/dist/core/icons.d.ts +0 -11
  52. package/dist/core/index.d.ts +0 -6
  53. package/dist/core/state.d.ts +0 -86
  54. package/dist/core/types.d.ts +0 -51
  55. package/dist/demo.d.ts +0 -7
  56. package/dist/index.esm.js +0 -4777
  57. package/dist/index.umd.js +0 -251
  58. package/dist/interactive/Button/index.d.ts +0 -897
  59. package/dist/interactive/Checkbox/index.d.ts +0 -884
  60. package/dist/interactive/Combobox/index.d.ts +0 -898
  61. package/dist/interactive/RadioGroup/index.d.ts +0 -888
  62. package/dist/interactive/Select/index.d.ts +0 -895
  63. package/dist/interactive/Switch/index.d.ts +0 -881
  64. package/dist/interactive/TextField/index.d.ts +0 -893
  65. package/dist/interactive/Textarea/index.d.ts +0 -890
  66. package/dist/interactive/index.d.ts +0 -8
  67. package/dist/layout/Center/index.d.ts +0 -869
  68. package/dist/layout/Column/index.d.ts +0 -881
  69. package/dist/layout/Container/index.d.ts +0 -870
  70. package/dist/layout/DashboardLayout/index.d.ts +0 -870
  71. package/dist/layout/Header/index.d.ts +0 -870
  72. package/dist/layout/Line/index.d.ts +0 -872
  73. package/dist/layout/Row/index.d.ts +0 -879
  74. package/dist/layout/Scaffold/index.d.ts +0 -878
  75. package/dist/layout/ScrollView/index.d.ts +0 -879
  76. package/dist/layout/Sidebar/index.d.ts +0 -870
  77. package/dist/layout/Spacer/index.d.ts +0 -875
  78. package/dist/layout/StakentComponents.d.ts +0 -4
  79. package/dist/layout/index.d.ts +0 -11
  80. package/dist/structure/Banner/index.d.ts +0 -879
  81. package/dist/structure/Box/index.d.ts +0 -869
  82. package/dist/structure/Card/index.d.ts +0 -881
  83. package/dist/structure/Collapse/index.d.ts +0 -884
  84. package/dist/structure/Grid/index.d.ts +0 -1757
  85. package/dist/structure/List/index.d.ts +0 -888
  86. package/dist/structure/Table/index.d.ts +0 -895
  87. package/dist/structure/Tags/index.d.ts +0 -876
  88. package/dist/structure/cards/AssetCard/index.d.ts +0 -884
  89. package/dist/structure/cards/CollectionCard/index.d.ts +0 -880
  90. package/dist/structure/cards/ContentCard/index.d.ts +0 -884
  91. package/dist/structure/cards/ProfileCard/index.d.ts +0 -892
  92. package/dist/structure/cards/index.d.ts +0 -5
  93. package/dist/structure/cards/variants/index.d.ts +0 -3490
  94. package/dist/structure/index.d.ts +0 -9
  95. package/dist/theme/cupertino.d.ts +0 -3
  96. package/dist/theme/index.d.ts +0 -5
  97. package/dist/theme/material.d.ts +0 -3
  98. package/dist/theme/provider.d.ts +0 -16
  99. package/dist/theme/types.d.ts +0 -57
  100. package/dist/theme/web.d.ts +0 -3
  101. package/src/content/Alert/index.ts +0 -110
  102. package/src/content/Avatar/index.ts +0 -116
  103. package/src/content/Badge/index.ts +0 -162
  104. package/src/content/Image/index.ts +0 -137
  105. package/src/content/Label/index.ts +0 -66
  106. package/src/content/Progress/index.ts +0 -378
  107. package/src/content/Skeleton/index.ts +0 -71
  108. package/src/content/Spinner/index.ts +0 -139
  109. package/src/content/Text/index.ts +0 -74
  110. package/src/content/index.ts +0 -9
  111. package/src/core/StateWrapper.tsx +0 -131
  112. package/src/core/builder.ts +0 -301
  113. package/src/core/component.ts +0 -49
  114. package/src/core/effects.ts +0 -27
  115. package/src/core/hooks.ts +0 -48
  116. package/src/core/icons.tsx +0 -57
  117. package/src/core/index.ts +0 -6
  118. package/src/core/state.ts +0 -297
  119. package/src/core/types.ts +0 -62
  120. package/src/demo.tsx +0 -1050
  121. package/src/index.ts +0 -8
  122. package/src/interactive/Button/index.ts +0 -219
  123. package/src/interactive/Checkbox/index.ts +0 -145
  124. package/src/interactive/Combobox/index.ts +0 -278
  125. package/src/interactive/RadioGroup/index.ts +0 -124
  126. package/src/interactive/Select/index.ts +0 -227
  127. package/src/interactive/Switch/index.ts +0 -123
  128. package/src/interactive/TextField/index.ts +0 -223
  129. package/src/interactive/Textarea/index.ts +0 -129
  130. package/src/interactive/index.ts +0 -8
  131. package/src/layout/Center/index.ts +0 -34
  132. package/src/layout/Column/index.ts +0 -101
  133. package/src/layout/Container/index.ts +0 -28
  134. package/src/layout/DashboardLayout/index.ts +0 -106
  135. package/src/layout/Header/index.ts +0 -50
  136. package/src/layout/Line/index.ts +0 -41
  137. package/src/layout/Row/index.ts +0 -93
  138. package/src/layout/Scaffold/index.ts +0 -133
  139. package/src/layout/ScrollView/index.ts +0 -67
  140. package/src/layout/Sidebar/index.ts +0 -56
  141. package/src/layout/Spacer/index.ts +0 -46
  142. package/src/layout/StakentComponents.tsx +0 -57
  143. package/src/layout/index.ts +0 -11
  144. package/src/structure/Banner/index.ts +0 -92
  145. package/src/structure/Box/index.ts +0 -46
  146. package/src/structure/Card/index.ts +0 -113
  147. package/src/structure/Collapse/index.ts +0 -122
  148. package/src/structure/Grid/index.ts +0 -197
  149. package/src/structure/List/index.ts +0 -185
  150. package/src/structure/Table/index.ts +0 -165
  151. package/src/structure/Tags/index.ts +0 -69
  152. package/src/structure/cards/AssetCard/index.ts +0 -158
  153. package/src/structure/cards/CollectionCard/index.ts +0 -95
  154. package/src/structure/cards/ContentCard/index.ts +0 -127
  155. package/src/structure/cards/ProfileCard/index.ts +0 -152
  156. package/src/structure/cards/index.ts +0 -5
  157. package/src/structure/cards/variants/index.ts +0 -301
  158. package/src/structure/index.ts +0 -10
  159. package/src/styles/base.css +0 -186
  160. package/src/styles/core.css +0 -52
  161. package/src/styles/themes/cupertino.css +0 -197
  162. package/src/styles/themes/material.css +0 -322
  163. package/src/styles/themes/web.css +0 -196
  164. package/src/theme/cupertino.ts +0 -85
  165. package/src/theme/index.ts +0 -5
  166. package/src/theme/material.ts +0 -86
  167. package/src/theme/provider.tsx +0 -76
  168. package/src/theme/types.ts +0 -62
  169. package/src/theme/web.ts +0 -82
package/README.md CHANGED
@@ -1,165 +1,211 @@
1
- # 🏗️ FiboUI v1.0.0
1
+ # FiboUI v2.0.0
2
2
 
3
- **A Flutter & SwiftUI-inspired React UI framework featuring a powerful Assembly Pattern and high-fidelity reactivity.**
3
+ **A Flutter & SwiftUI-inspired React UI framework featuring a fluent builder API and fine-grained reactivity.**
4
4
 
5
- FiboUI brings the expressive, chainable syntax of modern mobile frameworks to React. Build complex, beautiful, and highly-performant UIs with **zero boilerplate** and **maximum readability**.
5
+ FiboUI brings chainable builders to React. Compose screens with `Column()`, `Row()`, `Button()`, and `signal()` — builders passed to `.children()` are finalized automatically.
6
6
 
7
7
  ---
8
8
 
9
- ## ✨ Features
9
+ ## Features
10
10
 
11
- - 🏗️ **The Assembly Pattern** - Components return builders for endless chaining.
12
- - ⚡ **Zero-Build Children** - Pass builders directly to `.children()`; they build implicitly.
13
- - 🔬 **Fine-Grained Reactivity** - Native support for Signals, Computed, and Observables.
14
- - 🎭 **Dynamic Multi-Theme** - Material, Cupertino, and Web themes with instant global switching.
15
- - 🎨 **Premium Aesthetics** - Built-in glassmorphism, micro-animations, and sleek dark modes.
16
- - 🔷 **100% Type-Safe** - Built with TypeScript for the best developer experience.
11
+ - **Assembly pattern** — factories return builders for endless chaining.
12
+ - **Zero-build children** — pass builders to `.children()`; they build implicitly. Typed methods (`.onPress`, `.id`, `.spacing`, `.children`) stay assignable as children.
13
+ - **Fine-grained reactivity** — `signal()`, `computed()`, `createStore()`, `.bindSignal()`, `.observer()`.
14
+ - **Multi-theme** — Material, Cupertino, and Web tokens with CSS variables.
15
+ - **Type-safe** — TypeScript builders; `FiboChild` / `FiboChildren` describe child slots.
17
16
 
18
17
  ---
19
18
 
20
- ## 🚀 Installation
19
+ ## Installation
21
20
 
22
21
  ```bash
23
22
  npm install fiboui
24
23
  ```
25
24
 
26
- Import the styles in your main entry file:
25
+ Import the stylesheet once in your entry file:
27
26
 
28
27
  ```tsx
29
- import 'fiboui/dist/style.css';
28
+ import 'fiboui/style.css';
30
29
  ```
31
30
 
31
+ **Required.** The JS entry does not load CSS. ESM-only (`import`, no `require`). See [MIGRATION.md](./MIGRATION.md) if you used 1.x snapshots.
32
+
33
+ Peer dependencies: React 18 or 19.
34
+
35
+ Next.js App Router: files that **call** builders (`Button()`, `Column()`, …) must be Client Components (`'use client'`). FiboUI uses hooks and context; it is not an RSC factory API. Import `'fiboui/style.css'` from a layout or the client entry.
36
+
37
+ ## Releasing
38
+
39
+ Publishing is automated. The owner must add an **`NPM_TOKEN`** automation secret in the GitHub repo settings. Release branch is **`main`**. See [CONTRIBUTING.md](./CONTRIBUTING.md).
40
+
41
+ Do not run `npm publish` locally. The `Publish` workflow runs on GitHub Release and on push to `main`: install, typecheck, test, build, then `npm publish --provenance --access public` only if that version is not already on npm. After a successful `main` publish it opens GitHub Release `vX.Y.Z` with the matching CHANGELOG section as notes.
42
+
32
43
  ---
33
44
 
34
- ## 🏗️ The Assembly Pattern
45
+ ## The assembly pattern
35
46
 
36
- ### 1. Components as Builders
37
- Components return builder instances, allowing customization before rendering.
47
+ ### Components as builders
38
48
 
39
49
  ```tsx
40
- StakentCard()
41
- .className("p-8 hover:border-indigo-500/50")
50
+ import { Card, Text } from 'fiboui';
51
+
52
+ Card()
53
+ .className('p-8')
42
54
  .style({ backgroundColor: '#111' })
43
- .children([ ... ])
44
- .build()
55
+ .children([Text('Hello')])
56
+ .build();
45
57
  ```
46
58
 
47
- ### 2. Implicit Construction
48
- Builders in `.children()` are automatically finalized.
59
+ ### Implicit construction
60
+
61
+ Builders in `.children()` do not need `.build()`. The event API on `Button` is **`.onPress`** (not `onClick`). `FiboBuilder.onClick` still exists for raw DOM handlers on any builder.
49
62
 
50
63
  ```tsx
51
- Column().children([
52
- Text("Title").variant("h1"),
53
- Button("Action").onClick(handlePress)
54
- ]).build()
64
+ import { Button, Column, Text } from 'fiboui';
65
+
66
+ Column()
67
+ .children([
68
+ Text('Title').variant('h1'),
69
+ Button('Action').onPress(() => undefined),
70
+ ])
71
+ .build();
55
72
  ```
56
73
 
57
74
  ---
58
75
 
59
- ## ⚡ Reactivity & State
76
+ ## Reactivity & state
77
+
78
+ ### Signals
79
+
80
+ `.bindSignal(sig)` subscribes the builder and **re-runs `build()`** when the signal changes. Read the signal inside a **function child** (or `Text(() => ...)`) so the new value is picked up. Interpolating `sig.value` into a string at construction time is a one-shot snapshot.
60
81
 
61
- ### Signals (Primitives)
62
82
  ```tsx
83
+ import { Box, Button, Text, signal } from 'fiboui';
84
+
63
85
  const count = signal(0);
64
86
 
65
87
  Box()
66
88
  .bindSignal(count)
67
- .children([
89
+ .children(() => [
68
90
  Text(`Count: ${count.value}`),
69
- Button("+").onPress(() => count.value++)
91
+ Button('+').onPress(() => {
92
+ count.value += 1;
93
+ }),
70
94
  ])
71
- .build()
95
+ .build();
72
96
  ```
73
97
 
74
- ### Global Store
98
+ `useSignal(count)` and `.observer()` with a function child also work. Signal subscriptions unsubscribe on unmount and are Safe for React 18/19 StrictMode (`useSyncExternalStore`). Signals are in-memory and client-only — do not rely on them during SSR.
99
+
100
+ `computed(() => ...)` is lazy: the first `.value` read attaches the internal effect. Read it (or `.bindSignal`) so updates notify.
101
+
102
+ Two store APIs exist: `createStore()` + `useReactiveStore(store)`, and the `@Store()` decorator + `useStore(StoreClass)` (the package-root `useStore`). Builder `.state(key, initial)` is runtime-updatable via `useBuilderState(key)`.
103
+
104
+ ### Global store
105
+
75
106
  ```tsx
107
+ import { Box, Text, createStore } from 'fiboui';
108
+
76
109
  const store = createStore({ theme: 'dark', user: 'John' });
77
110
 
78
- Box().observer().children([
79
- Text(store.getState().user)
80
- ])
111
+ Box()
112
+ .observer()
113
+ .children(() => Text(store.getState().user))
114
+ .build();
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Layout notes
120
+
121
+ ### Column + Row (`spaceBetween`)
122
+
123
+ Flutter `Column` defaults to `CrossAxisAlignment.center`. SwiftUI `VStack` defaults to `.center`. FiboUI **2.0 matches that: `crossAxisAlignment('center')`.**
124
+
125
+ **Row uses `align-self: stretch`** so `spaceBetween` still fills the Column width under a centered cross axis.
126
+
127
+ To stretch every child (Flutter `CrossAxisAlignment.stretch`):
128
+
129
+ ```tsx
130
+ Column().crossAxisAlignment('stretch');
81
131
  ```
82
132
 
83
133
  ---
84
134
 
85
- ## 📱 Scaffold & Layout Shells
135
+ ## Scaffold & layout shells
86
136
 
87
- The `Scaffold` and `DashboardLayout` components provide professional-grade app structures.
137
+ `Scaffold` uses `headerBar`, `footerBar`, `sideBarLeft`, and `sideBarRight`. `DashboardLayout` uses `header` and `sidebar`.
88
138
 
89
139
  ```tsx
90
- import { Scaffold, Sidebar, Header, Text, StakentButton } from 'fiboui';
140
+ import { Header, Scaffold, Sidebar, Text } from 'fiboui';
91
141
 
92
142
  Scaffold()
93
- .header(
94
- Header().height(80).className("px-6 bg-white shadow-sm").children([
95
- Text("App Title").variant("h2"),
96
- StakentButton({ text: "Profile", variant: "outline" })
97
- ])
143
+ .headerBar(
144
+ Header()
145
+ .height(80)
146
+ .className('px-6 bg-white shadow-sm')
147
+ .children([Text('App Title').variant('h2')])
98
148
  )
99
- .sidebar(
100
- Sidebar().width(240).children([
101
- StakentSidebarItem({ label: "Home", active: true, icon: "home" }),
102
- StakentSidebarItem({ label: "Settings", icon: "settings" })
103
- ])
149
+ .sideBarLeft(
150
+ Sidebar().width(240).children([Text('Home'), Text('Settings')])
104
151
  )
105
- .fab(
106
- Button("+").variant("fab").onPress(() => console.log("Added!"))
107
- )
108
- .children([
109
- Text("Welcome to the main content area.")
110
- ])
111
- .build()
152
+ .children([Text('Welcome to the main content area.')])
153
+ .build();
112
154
  ```
113
155
 
114
156
  ---
115
157
 
116
- ## 🛒 Full Example: E-commerce Store
117
-
118
- Combine **Signals**, **Store**, and **Builders** for a complete reactive application.
158
+ ## Example: reactive product grid
119
159
 
120
160
  ```tsx
121
- import { signal, computed, createStore, Scaffold, Box, Text, Button, Badge, Row } from 'fiboui';
161
+ import {
162
+ Badge,
163
+ Box,
164
+ Button,
165
+ Card,
166
+ Grid,
167
+ Row,
168
+ Text,
169
+ computed,
170
+ createStore,
171
+ } from 'fiboui';
122
172
 
123
- // 1. Global Store
124
173
  const appStore = createStore({
125
- cart: [],
174
+ cart: [] as { id: string; name: string; price: number; quantity: number }[],
126
175
  products: [
127
- { id: '1', name: 'MacBook Pro', price: 2499, image: '💻' },
128
- { id: '2', name: 'iPhone 15', price: 999, image: '📱' }
129
- ]
176
+ { id: '1', name: 'MacBook Pro', price: 2499 },
177
+ { id: '2', name: 'iPhone 15', price: 999 },
178
+ ],
130
179
  });
131
180
 
132
- // 2. Reactive Computed Values
133
181
  const cartTotal = computed(() => {
134
182
  const cart = appStore.getState().cart;
135
183
  return cart.reduce((sum, item) => sum + item.price * item.quantity, 0);
136
184
  });
137
185
 
138
- // 3. UI Component
139
- export function EcommerceApp() {
140
- return Scaffold()
141
- .header(
142
- Header().children([
143
- Text('🛒 FiboShop').variant("h2"),
144
- Row().children([
145
- Text(`Total: $${cartTotal.value.toFixed(2)}`).bindSignal(cartTotal),
146
- Badge().text(appStore.getState().cart.length.toString()).observer()
147
- ])
148
- ])
149
- )
150
- .children([
151
- Grid().columns(2).gap("md").children(
152
- appStore.getState().products.map(product =>
153
- Card().children([
154
- Text(product.image).fontSize(40),
155
- Text(product.name).fontWeight("bold"),
156
- Button(`Add $${product.price}`).onPress(() => {
157
- // Update Store & Watch UI React!
158
- appStore.setState(s => ({ cart: [...s.cart, { ...product, quantity: 1 }] }));
159
- })
160
- ])
161
- )
162
- )
186
+ export function ShopHeader() {
187
+ return Box()
188
+ .observer()
189
+ .children(() => [
190
+ Row().children([
191
+ Text(`Total: $${cartTotal.value.toFixed(2)}`).bindSignal(cartTotal),
192
+ Badge().text(String(appStore.getState().cart.length)),
193
+ ]),
194
+ Grid()
195
+ .columns(2)
196
+ .gap('md')
197
+ .children(
198
+ appStore.getState().products.map((product) =>
199
+ Card().children([
200
+ Text(product.name).weight('bold'),
201
+ Button(`Add $${product.price}`).onPress(() => {
202
+ appStore.setState((s) => ({
203
+ cart: [...s.cart, { ...product, quantity: 1 }],
204
+ }));
205
+ }),
206
+ ])
207
+ )
208
+ ),
163
209
  ])
164
210
  .build();
165
211
  }
@@ -167,6 +213,6 @@ export function EcommerceApp() {
167
213
 
168
214
  ---
169
215
 
170
- ## 📄 License
216
+ ## License
171
217
 
172
- MIT © 2025 FiboUI
218
+ MIT © 2025–2026 FiboUI
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import s, { useRef as l, useEffect as p } from "react";
3
+ import { i as x, r as m, E } from "./builder-DjLYXkXu.js";
4
+ function R({
5
+ compute: e,
6
+ as: n = "span",
7
+ className: i,
8
+ style: o,
9
+ ...u
10
+ }) {
11
+ const r = x(), t = l(null), a = e();
12
+ return p(() => m(r, () => {
13
+ const f = new E(() => {
14
+ const c = e();
15
+ t.current && t.current.textContent !== c && (t.current.textContent = c);
16
+ });
17
+ return () => f.dispose();
18
+ }), [e, r]), s.createElement(n, { ref: t, className: i, style: o, ...u }, a);
19
+ }
20
+ function d(e, n) {
21
+ return s.createElement(R, {
22
+ compute: () => String(e.value),
23
+ as: n
24
+ });
25
+ }
26
+ export {
27
+ R as F,
28
+ d as b
29
+ };
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import { jsx as d } from "react/jsx-runtime";
3
+ import { createContext as p, useContext as m } from "react";
4
+ const w = p(null);
5
+ function s() {
6
+ const t = m(w);
7
+ if (!t)
8
+ throw new Error("useRouter must be used within a Router");
9
+ return t;
10
+ }
11
+ function y() {
12
+ return m(w);
13
+ }
14
+ function v() {
15
+ const { navigate: t } = s();
16
+ return t;
17
+ }
18
+ function b() {
19
+ const { params: t } = s();
20
+ return t;
21
+ }
22
+ function k() {
23
+ const { query: t } = s();
24
+ return t;
25
+ }
26
+ function L() {
27
+ const { currentPath: t } = s();
28
+ return {
29
+ pathname: t,
30
+ search: typeof window < "u" ? window.location.search : "",
31
+ hash: typeof window < "u" ? window.location.hash : ""
32
+ };
33
+ }
34
+ const x = ({
35
+ to: t,
36
+ children: u,
37
+ replace: a = !1,
38
+ state: r,
39
+ className: c,
40
+ style: f,
41
+ onClick: o
42
+ }) => {
43
+ const h = v(), e = y(), i = t.startsWith("http") || t.startsWith("//") || t.startsWith("#") ? t : `${(e == null ? void 0 : e.basename) ?? ""}${t}`;
44
+ return /* @__PURE__ */ d(
45
+ "a",
46
+ {
47
+ href: i,
48
+ onClick: (n) => {
49
+ n.ctrlKey || n.metaKey || n.shiftKey || n.button !== 0 || (n.preventDefault(), o && o(n), h(t, { replace: a, state: r }));
50
+ },
51
+ className: c,
52
+ style: f,
53
+ children: u
54
+ }
55
+ );
56
+ }, N = ({
57
+ to: t,
58
+ children: u,
59
+ className: a = "",
60
+ style: r = {},
61
+ activeClassName: c = "active",
62
+ activeStyle: f = {},
63
+ exact: o = !1,
64
+ ...h
65
+ }) => {
66
+ const { currentPath: e } = s(), i = o ? e === t : e.startsWith(t), l = i ? `${a} ${c}`.trim() : a, n = i ? { ...r, ...f } : r;
67
+ return /* @__PURE__ */ d(
68
+ x,
69
+ {
70
+ to: t,
71
+ className: l,
72
+ style: n,
73
+ ...h,
74
+ children: u
75
+ }
76
+ );
77
+ };
78
+ export {
79
+ x as L,
80
+ N,
81
+ w as R,
82
+ v as a,
83
+ b,
84
+ L as c,
85
+ k as d,
86
+ y as e,
87
+ s as u
88
+ };
@@ -0,0 +1,111 @@
1
+ "use client";
2
+ var h = Object.defineProperty;
3
+ var g = (c, t, e) => t in c ? h(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
4
+ var s = (c, t, e) => g(c, typeof t != "symbol" ? t + "" : t, e);
5
+ const n = class n {
6
+ constructor() {
7
+ s(this, "services", /* @__PURE__ */ new Map());
8
+ }
9
+ static getInstance() {
10
+ return n.instance || (n.instance = new n()), n.instance;
11
+ }
12
+ register(t, e, r = {}) {
13
+ if (this.services.has(t) && !r.override)
14
+ return;
15
+ const u = {
16
+ token: t,
17
+ provider: e,
18
+ singleton: r.singleton ?? !1
19
+ };
20
+ this.services.set(t, u);
21
+ }
22
+ registerSingleton(t, e) {
23
+ this.register(t, e, { singleton: !0 });
24
+ }
25
+ resolve(t) {
26
+ const e = this.services.get(t);
27
+ if (!e)
28
+ throw new Error(`Service not found for token: ${String(t)}`);
29
+ if (e.singleton && e.instance)
30
+ return e.instance;
31
+ const r = this.createInstance(e.provider);
32
+ return e.singleton && (e.instance = r), r;
33
+ }
34
+ has(t) {
35
+ return this.services.has(t);
36
+ }
37
+ clear() {
38
+ this.services.clear();
39
+ }
40
+ createInstance(t) {
41
+ return typeof t != "function" ? t : this.isConstructor(t) ? new t() : t();
42
+ }
43
+ isConstructor(t) {
44
+ try {
45
+ return Reflect.construct(String, [], t), !0;
46
+ } catch {
47
+ return !1;
48
+ }
49
+ }
50
+ };
51
+ s(n, "instance");
52
+ let a = n;
53
+ const l = a.getInstance(), i = class i {
54
+ constructor() {
55
+ s(this, "plugins", /* @__PURE__ */ new Map());
56
+ s(this, "routes", []);
57
+ s(this, "sidebarItems", []);
58
+ s(this, "topbarActions", []);
59
+ s(this, "overlays", []);
60
+ s(this, "stores", /* @__PURE__ */ new Map());
61
+ s(this, "storeSeq", 0);
62
+ }
63
+ static getInstance() {
64
+ return i.instance || (i.instance = new i()), i.instance;
65
+ }
66
+ use(t) {
67
+ return this.plugins.has(t.name) ? this : (this.plugins.set(t.name, t), t.setup(this), this);
68
+ }
69
+ registerService(t, e) {
70
+ l.register(t, e);
71
+ }
72
+ registerStore(t, e) {
73
+ const r = e ?? `store-${this.storeSeq++}`;
74
+ this.stores.set(r, t);
75
+ }
76
+ getStore(t) {
77
+ return this.stores.get(t);
78
+ }
79
+ getStores() {
80
+ return this.stores;
81
+ }
82
+ registerRoute(t) {
83
+ this.routes.push(t);
84
+ }
85
+ registerSidebarItem(t) {
86
+ this.sidebarItems.push(t);
87
+ }
88
+ registerTopbarAction(t) {
89
+ this.topbarActions.push(t);
90
+ }
91
+ registerOverlay(t) {
92
+ this.overlays.push(t);
93
+ }
94
+ getRoutes() {
95
+ return this.routes;
96
+ }
97
+ getSidebarItems() {
98
+ return this.sidebarItems.sort((t, e) => (t.order || 0) - (e.order || 0));
99
+ }
100
+ getTopbarActions() {
101
+ return this.topbarActions;
102
+ }
103
+ getOverlays() {
104
+ return this.overlays;
105
+ }
106
+ };
107
+ s(i, "instance");
108
+ let o = i;
109
+ export {
110
+ o as P
111
+ };