fiboui 1.0.1 → 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.
- package/README.md +138 -92
- package/dist/FineGrain-kBxv0WeR.js +29 -0
- package/dist/Link-DDzSPY1Q.js +88 -0
- package/dist/PluginManager-D5-ApsSN.js +111 -0
- package/dist/Router-i6Nc6qVs.js +386 -0
- package/dist/builder-DjLYXkXu.js +1842 -0
- package/dist/bundle-mjs-wppB-TKB.js +2760 -0
- package/dist/cli/bin.js +20 -0
- package/dist/cli/commands/generate/component.js +67 -0
- package/dist/cli/commands/generate/index.js +10 -0
- package/dist/cli/commands/generate/module.js +58 -0
- package/dist/cli/commands/generate/plugin.js +67 -0
- package/dist/cli/commands/init.js +58 -0
- package/dist/content.js +17 -0
- package/dist/core.js +33 -0
- package/dist/{effects-D16XdB_d.mjs → effects-CnevV566.js} +1 -0
- package/dist/index-B1av7e36.js +1102 -0
- package/dist/index-BQGRpkzR.js +1024 -0
- package/dist/index-CTRZRn9S.js +90 -0
- package/dist/index-DKFr-sai.js +33 -0
- package/dist/index-Dm4j2mMM.js +1031 -0
- package/dist/index-RbfIZuAo.js +119 -0
- package/dist/index-yeYkDTAx.js +778 -0
- package/dist/index.d.ts +43753 -6
- package/dist/index.js +2054 -0
- package/dist/interactive.js +12 -0
- package/dist/layout.js +18 -0
- package/dist/mount-sAVX_FBU.js +95 -0
- package/dist/navigation.js +13 -0
- package/dist/provider-B0eB-Wy7.js +286 -0
- package/dist/structure.js +15 -0
- package/dist/style.css +1 -1
- package/dist/style.js +1 -0
- package/dist/theme.js +9 -0
- package/package.json +88 -13
- package/dist/content/Alert/index.d.ts +0 -878
- package/dist/content/Avatar/index.d.ts +0 -886
- package/dist/content/Badge/index.d.ts +0 -887
- package/dist/content/Image/index.d.ts +0 -893
- package/dist/content/Label/index.d.ts +0 -879
- package/dist/content/Progress/index.d.ts +0 -898
- package/dist/content/Skeleton/index.d.ts +0 -879
- package/dist/content/Spinner/index.d.ts +0 -880
- package/dist/content/Text/index.d.ts +0 -878
- package/dist/content/index.d.ts +0 -9
- package/dist/core/StateWrapper.d.ts +0 -31
- package/dist/core/builder.d.ts +0 -53
- package/dist/core/component.d.ts +0 -7
- package/dist/core/effects.d.ts +0 -4
- package/dist/core/hooks.d.ts +0 -5
- package/dist/core/icons.d.ts +0 -11
- package/dist/core/index.d.ts +0 -6
- package/dist/core/state.d.ts +0 -86
- package/dist/core/types.d.ts +0 -51
- package/dist/demo.d.ts +0 -7
- package/dist/index.esm.js +0 -4777
- package/dist/index.umd.js +0 -251
- package/dist/interactive/Button/index.d.ts +0 -897
- package/dist/interactive/Checkbox/index.d.ts +0 -884
- package/dist/interactive/Combobox/index.d.ts +0 -898
- package/dist/interactive/RadioGroup/index.d.ts +0 -888
- package/dist/interactive/Select/index.d.ts +0 -895
- package/dist/interactive/Switch/index.d.ts +0 -881
- package/dist/interactive/TextField/index.d.ts +0 -893
- package/dist/interactive/Textarea/index.d.ts +0 -890
- package/dist/interactive/index.d.ts +0 -8
- package/dist/layout/Center/index.d.ts +0 -869
- package/dist/layout/Column/index.d.ts +0 -881
- package/dist/layout/Container/index.d.ts +0 -870
- package/dist/layout/DashboardLayout/index.d.ts +0 -870
- package/dist/layout/Header/index.d.ts +0 -870
- package/dist/layout/Line/index.d.ts +0 -872
- package/dist/layout/Row/index.d.ts +0 -879
- package/dist/layout/Scaffold/index.d.ts +0 -878
- package/dist/layout/ScrollView/index.d.ts +0 -879
- package/dist/layout/Sidebar/index.d.ts +0 -870
- package/dist/layout/Spacer/index.d.ts +0 -875
- package/dist/layout/StakentComponents.d.ts +0 -4
- package/dist/layout/index.d.ts +0 -11
- package/dist/structure/Banner/index.d.ts +0 -879
- package/dist/structure/Box/index.d.ts +0 -869
- package/dist/structure/Card/index.d.ts +0 -881
- package/dist/structure/Collapse/index.d.ts +0 -884
- package/dist/structure/Grid/index.d.ts +0 -1757
- package/dist/structure/List/index.d.ts +0 -888
- package/dist/structure/Table/index.d.ts +0 -895
- package/dist/structure/Tags/index.d.ts +0 -876
- package/dist/structure/cards/AssetCard/index.d.ts +0 -884
- package/dist/structure/cards/CollectionCard/index.d.ts +0 -880
- package/dist/structure/cards/ContentCard/index.d.ts +0 -884
- package/dist/structure/cards/ProfileCard/index.d.ts +0 -892
- package/dist/structure/cards/index.d.ts +0 -5
- package/dist/structure/cards/variants/index.d.ts +0 -3490
- package/dist/structure/index.d.ts +0 -9
- package/dist/theme/cupertino.d.ts +0 -3
- package/dist/theme/index.d.ts +0 -5
- package/dist/theme/material.d.ts +0 -3
- package/dist/theme/provider.d.ts +0 -16
- package/dist/theme/types.d.ts +0 -57
- package/dist/theme/web.d.ts +0 -3
- package/src/content/Alert/index.ts +0 -110
- package/src/content/Avatar/index.ts +0 -116
- package/src/content/Badge/index.ts +0 -162
- package/src/content/Image/index.ts +0 -137
- package/src/content/Label/index.ts +0 -66
- package/src/content/Progress/index.ts +0 -378
- package/src/content/Skeleton/index.ts +0 -71
- package/src/content/Spinner/index.ts +0 -139
- package/src/content/Text/index.ts +0 -74
- package/src/content/index.ts +0 -9
- package/src/core/StateWrapper.tsx +0 -131
- package/src/core/builder.ts +0 -297
- package/src/core/component.ts +0 -49
- package/src/core/effects.ts +0 -27
- package/src/core/hooks.ts +0 -48
- package/src/core/icons.tsx +0 -57
- package/src/core/index.ts +0 -6
- package/src/core/state.ts +0 -297
- package/src/core/types.ts +0 -62
- package/src/demo.tsx +0 -1050
- package/src/index.ts +0 -8
- package/src/interactive/Button/index.ts +0 -219
- package/src/interactive/Checkbox/index.ts +0 -145
- package/src/interactive/Combobox/index.ts +0 -278
- package/src/interactive/RadioGroup/index.ts +0 -124
- package/src/interactive/Select/index.ts +0 -227
- package/src/interactive/Switch/index.ts +0 -123
- package/src/interactive/TextField/index.ts +0 -223
- package/src/interactive/Textarea/index.ts +0 -129
- package/src/interactive/index.ts +0 -8
- package/src/layout/Center/index.ts +0 -34
- package/src/layout/Column/index.ts +0 -101
- package/src/layout/Container/index.ts +0 -28
- package/src/layout/DashboardLayout/index.ts +0 -106
- package/src/layout/Header/index.ts +0 -50
- package/src/layout/Line/index.ts +0 -41
- package/src/layout/Row/index.ts +0 -93
- package/src/layout/Scaffold/index.ts +0 -133
- package/src/layout/ScrollView/index.ts +0 -67
- package/src/layout/Sidebar/index.ts +0 -56
- package/src/layout/Spacer/index.ts +0 -46
- package/src/layout/StakentComponents.tsx +0 -57
- package/src/layout/index.ts +0 -11
- package/src/structure/Banner/index.ts +0 -92
- package/src/structure/Box/index.ts +0 -46
- package/src/structure/Card/index.ts +0 -113
- package/src/structure/Collapse/index.ts +0 -122
- package/src/structure/Grid/index.ts +0 -197
- package/src/structure/List/index.ts +0 -185
- package/src/structure/Table/index.ts +0 -165
- package/src/structure/Tags/index.ts +0 -69
- package/src/structure/cards/AssetCard/index.ts +0 -158
- package/src/structure/cards/CollectionCard/index.ts +0 -95
- package/src/structure/cards/ContentCard/index.ts +0 -127
- package/src/structure/cards/ProfileCard/index.ts +0 -152
- package/src/structure/cards/index.ts +0 -5
- package/src/structure/cards/variants/index.ts +0 -301
- package/src/structure/index.ts +0 -10
- package/src/styles/base.css +0 -186
- package/src/styles/core.css +0 -52
- package/src/styles/themes/cupertino.css +0 -197
- package/src/styles/themes/material.css +0 -322
- package/src/styles/themes/web.css +0 -196
- package/src/theme/cupertino.ts +0 -85
- package/src/theme/index.ts +0 -5
- package/src/theme/material.ts +0 -86
- package/src/theme/provider.tsx +0 -76
- package/src/theme/types.ts +0 -62
- package/src/theme/web.ts +0 -82
package/README.md
CHANGED
|
@@ -1,165 +1,211 @@
|
|
|
1
|
-
#
|
|
1
|
+
# FiboUI v2.0.0
|
|
2
2
|
|
|
3
|
-
**A Flutter & SwiftUI-inspired React UI framework featuring a
|
|
3
|
+
**A Flutter & SwiftUI-inspired React UI framework featuring a fluent builder API and fine-grained reactivity.**
|
|
4
4
|
|
|
5
|
-
FiboUI brings
|
|
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
|
-
##
|
|
9
|
+
## Features
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
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
|
-
##
|
|
19
|
+
## Installation
|
|
21
20
|
|
|
22
21
|
```bash
|
|
23
22
|
npm install fiboui
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
Import the
|
|
25
|
+
Import the stylesheet once in your entry file:
|
|
27
26
|
|
|
28
27
|
```tsx
|
|
29
|
-
import 'fiboui/
|
|
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
|
-
##
|
|
45
|
+
## The assembly pattern
|
|
35
46
|
|
|
36
|
-
###
|
|
37
|
-
Components return builder instances, allowing customization before rendering.
|
|
47
|
+
### Components as builders
|
|
38
48
|
|
|
39
49
|
```tsx
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
###
|
|
48
|
-
|
|
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
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
##
|
|
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(
|
|
91
|
+
Button('+').onPress(() => {
|
|
92
|
+
count.value += 1;
|
|
93
|
+
}),
|
|
70
94
|
])
|
|
71
|
-
.build()
|
|
95
|
+
.build();
|
|
72
96
|
```
|
|
73
97
|
|
|
74
|
-
|
|
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()
|
|
79
|
-
|
|
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
|
-
##
|
|
135
|
+
## Scaffold & layout shells
|
|
86
136
|
|
|
87
|
-
|
|
137
|
+
`Scaffold` uses `headerBar`, `footerBar`, `sideBarLeft`, and `sideBarRight`. `DashboardLayout` uses `header` and `sidebar`.
|
|
88
138
|
|
|
89
139
|
```tsx
|
|
90
|
-
import { Scaffold, Sidebar,
|
|
140
|
+
import { Header, Scaffold, Sidebar, Text } from 'fiboui';
|
|
91
141
|
|
|
92
142
|
Scaffold()
|
|
93
|
-
.
|
|
94
|
-
Header()
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
.
|
|
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
|
-
.
|
|
106
|
-
|
|
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
|
-
##
|
|
117
|
-
|
|
118
|
-
Combine **Signals**, **Store**, and **Builders** for a complete reactive application.
|
|
158
|
+
## Example: reactive product grid
|
|
119
159
|
|
|
120
160
|
```tsx
|
|
121
|
-
import {
|
|
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
|
|
128
|
-
{ id: '2', name: 'iPhone 15', price: 999
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.
|
|
142
|
-
|
|
143
|
-
Text(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
##
|
|
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
|
+
};
|