yvee 0.0.10 → 0.1.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Mark Yalung
3
+ Copyright (c) 2026 Marky <markjotep@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # Yvee
2
+
3
+ Yvee is a TypeScript UI framework with reactive state, a TSX renderer, browser
4
+ element helpers, client-side routing and guards, server-side rendering, and
5
+ browser storage and network helpers. It ships as one dependency-free package,
6
+ `yvee@0.1.0`.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ bun add yvee
12
+ ```
13
+
14
+ For local development with Bun, link this repository into a consuming project:
15
+
16
+ ```sh
17
+ # In the Yvee repository
18
+ bun link
19
+
20
+ # In the consuming project
21
+ bun link yvee
22
+ ```
23
+
24
+ After changing Yvee source, rebuild the package so consumers that import the
25
+ build see the new code and declarations. Restart the consumer's dev server when
26
+ its bundler caches linked dependencies.
27
+
28
+ The package exposes only its root entry through the `exports` map. Import from
29
+ `yvee`; source folders are not stable package subpaths.
30
+
31
+ ## TypeScript and TSX setup
32
+
33
+ Yvee's TSX elements use its `dom` factory and `frag` fragment factory. Add a
34
+ `.tsx` extension and configure TypeScript accordingly:
35
+
36
+ ```json
37
+ {
38
+ "compilerOptions": {
39
+ "jsx": "react",
40
+ "jsxFactory": "dom",
41
+ "jsxFragmentFactory": "frag",
42
+ "moduleResolution": "bundler",
43
+ "module": "esnext",
44
+ "target": "esnext",
45
+ "strict": true
46
+ }
47
+ }
48
+ ```
49
+
50
+ Import `dom` and `frag` in TSX modules where JSX is used. A consuming bundler
51
+ must compile TypeScript/TSX and include Yvee's browser code in its client
52
+ bundle. Yvee does not currently ship a framework-specific CLI or bundler plugin.
53
+
54
+ ## Quick start
55
+
56
+ Pages are classes decorated with a route path. Register them on an app and
57
+ mount it into an element that already exists in the host HTML:
58
+
59
+ ```tsx
60
+ import { Page, Yvee, dom, route } from "yvee";
61
+
62
+ @route("/")
63
+ class HomePage extends Page {
64
+ override head() {
65
+ return { title: "Home" };
66
+ }
67
+
68
+ override body() {
69
+ return <main><h1>Hello from Yvee</h1><a href="/about">About</a></main>;
70
+ }
71
+ }
72
+
73
+ @route("/about")
74
+ class AboutPage extends Page {
75
+ override body() {
76
+ return <main><h1>About</h1><a href="/">Home</a></main>;
77
+ }
78
+ }
79
+
80
+ const app = new Yvee({ id: "app-root", history: true });
81
+ app.register(HomePage, AboutPage);
82
+ app.Main((content) => <div class="app-shell">{content}</div>);
83
+
84
+ // The host HTML must contain this element. Keep the returned cleanup if needed.
85
+ const unmount = await app.render({ id: "app-root" });
86
+ ```
87
+
88
+ State values can be read directly by DOM children and supported attributes:
89
+
90
+ ```tsx
91
+ import { State, dom } from "yvee";
92
+
93
+ const count = State(0);
94
+ const button = (
95
+ <button on={{ click: () => count.value++ }}>Clicks: {count}</button>
96
+ );
97
+ ```
98
+
99
+ By default the app references a module script at `./index.js` relative to its
100
+ base. Set `client` to a directory or explicit JavaScript file to change it:
101
+
102
+ ```ts
103
+ new Yvee({ base: "/my-project/", client: "/my-project/client.js" });
104
+ ```
105
+
106
+ ## Documentation
107
+
108
+ | Guide | What it covers |
109
+ | --- | --- |
110
+ | [Getting started](docs/getting-started.md) | Install, TSX setup, package structure and the smallest routed app. |
111
+ | [State](docs/state.md) | `State`, `RecState`, `SetState`, `Derived`, batching, hooks and resource ownership. |
112
+ | [Scopes](docs/scopes.md) | Shared application objects, `Field` injection and request-owned containers. |
113
+ | [Routing](docs/routing.md) | Pages, route parameters, guards, error pages and SPA focus. |
114
+ | [Rendering](docs/rendering.md) | TSX and DOM, `$` helpers, document head, SSR, static HTML export, trust and CSP. |
115
+ | [Data](docs/data.md) | Browser storage, IndexedDB, validated JSON requests, WebSockets and event streams. |
116
+ | [API reference](docs/api-reference.md) | Every public export, signatures and deprecation notes. |
117
+
118
+ Additional design and example material:
119
+
120
+ - [Guard design notes](docs/guard-design.md) — proposed departure/leave guards
121
+ and the boundary of the current guard API.
122
+ - [Authentication example](examples/README.md) — request-owned identity with
123
+ `requireGuard`.
124
+ - [Bun SSR/client demo](test/yvee-bun/README.md) — a runnable app with lazy
125
+ views, hydration and reactive head content.
126
+ - [IndexedDB guide](src/core/indexeddb/README.md) — schema, upgrade and cleanup
127
+ details.
128
+
129
+ ## License
130
+
131
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,290 @@
1
+ // Asset imports are strings (file URLs/paths, or text when configured by the loader).
2
+ // These declarations only provide types; configure the bundler to load each format.
3
+ // Keep this file free of top-level imports/exports so these stay ambient modules.
4
+ // JSON is intentionally omitted: use compilerOptions.resolveJsonModule for inferred types.
5
+
6
+ // Stylesheets
7
+ declare module "*.css" {
8
+ const asset: string;
9
+ export default asset;
10
+ }
11
+
12
+ declare module "*.scss" {
13
+ const asset: string;
14
+ export default asset;
15
+ }
16
+
17
+ declare module "*.sass" {
18
+ const asset: string;
19
+ export default asset;
20
+ }
21
+
22
+ declare module "*.less" {
23
+ const asset: string;
24
+ export default asset;
25
+ }
26
+
27
+ declare module "*.styl" {
28
+ const asset: string;
29
+ export default asset;
30
+ }
31
+
32
+ // Images
33
+ declare module "*.png" {
34
+ const asset: string;
35
+ export default asset;
36
+ }
37
+
38
+ declare module "*.jpg" {
39
+ const asset: string;
40
+ export default asset;
41
+ }
42
+
43
+ declare module "*.jpeg" {
44
+ const asset: string;
45
+ export default asset;
46
+ }
47
+
48
+ declare module "*.jfif" {
49
+ const asset: string;
50
+ export default asset;
51
+ }
52
+
53
+ declare module "*.pjpeg" {
54
+ const asset: string;
55
+ export default asset;
56
+ }
57
+
58
+ declare module "*.pjp" {
59
+ const asset: string;
60
+ export default asset;
61
+ }
62
+
63
+ declare module "*.gif" {
64
+ const asset: string;
65
+ export default asset;
66
+ }
67
+
68
+ declare module "*.svg" {
69
+ const asset: string;
70
+ export default asset;
71
+ }
72
+
73
+ declare module "*.ico" {
74
+ const asset: string;
75
+ export default asset;
76
+ }
77
+
78
+ declare module "*.webp" {
79
+ const asset: string;
80
+ export default asset;
81
+ }
82
+
83
+ declare module "*.avif" {
84
+ const asset: string;
85
+ export default asset;
86
+ }
87
+
88
+ declare module "*.apng" {
89
+ const asset: string;
90
+ export default asset;
91
+ }
92
+
93
+ declare module "*.bmp" {
94
+ const asset: string;
95
+ export default asset;
96
+ }
97
+
98
+ declare module "*.tif" {
99
+ const asset: string;
100
+ export default asset;
101
+ }
102
+
103
+ declare module "*.tiff" {
104
+ const asset: string;
105
+ export default asset;
106
+ }
107
+
108
+ // Fonts
109
+ declare module "*.woff" {
110
+ const asset: string;
111
+ export default asset;
112
+ }
113
+
114
+ declare module "*.woff2" {
115
+ const asset: string;
116
+ export default asset;
117
+ }
118
+
119
+ declare module "*.ttf" {
120
+ const asset: string;
121
+ export default asset;
122
+ }
123
+
124
+ declare module "*.otf" {
125
+ const asset: string;
126
+ export default asset;
127
+ }
128
+
129
+ declare module "*.eot" {
130
+ const asset: string;
131
+ export default asset;
132
+ }
133
+
134
+ // Audio
135
+ declare module "*.mp3" {
136
+ const asset: string;
137
+ export default asset;
138
+ }
139
+
140
+ declare module "*.wav" {
141
+ const asset: string;
142
+ export default asset;
143
+ }
144
+
145
+ declare module "*.ogg" {
146
+ const asset: string;
147
+ export default asset;
148
+ }
149
+
150
+ declare module "*.oga" {
151
+ const asset: string;
152
+ export default asset;
153
+ }
154
+
155
+ declare module "*.opus" {
156
+ const asset: string;
157
+ export default asset;
158
+ }
159
+
160
+ declare module "*.aac" {
161
+ const asset: string;
162
+ export default asset;
163
+ }
164
+
165
+ declare module "*.flac" {
166
+ const asset: string;
167
+ export default asset;
168
+ }
169
+
170
+ declare module "*.m4a" {
171
+ const asset: string;
172
+ export default asset;
173
+ }
174
+
175
+ declare module "*.aiff" {
176
+ const asset: string;
177
+ export default asset;
178
+ }
179
+
180
+ // Video
181
+ declare module "*.mp4" {
182
+ const asset: string;
183
+ export default asset;
184
+ }
185
+
186
+ declare module "*.webm" {
187
+ const asset: string;
188
+ export default asset;
189
+ }
190
+
191
+ declare module "*.ogv" {
192
+ const asset: string;
193
+ export default asset;
194
+ }
195
+
196
+ declare module "*.mov" {
197
+ const asset: string;
198
+ export default asset;
199
+ }
200
+
201
+ declare module "*.m4v" {
202
+ const asset: string;
203
+ export default asset;
204
+ }
205
+
206
+ declare module "*.avi" {
207
+ const asset: string;
208
+ export default asset;
209
+ }
210
+
211
+ // Other file assets
212
+ declare module "*.webmanifest" {
213
+ const asset: string;
214
+ export default asset;
215
+ }
216
+
217
+ declare module "*.pdf" {
218
+ const asset: string;
219
+ export default asset;
220
+ }
221
+
222
+ declare module "*.wasm" {
223
+ const asset: string;
224
+ export default asset;
225
+ }
226
+
227
+ declare module "*.txt" {
228
+ const asset: string;
229
+ export default asset;
230
+ }
231
+
232
+ declare module "*.csv" {
233
+ const asset: string;
234
+ export default asset;
235
+ }
236
+
237
+ declare module "*.tsv" {
238
+ const asset: string;
239
+ export default asset;
240
+ }
241
+
242
+ declare module "*.xml" {
243
+ const asset: string;
244
+ export default asset;
245
+ }
246
+
247
+ declare module "*.yaml" {
248
+ const asset: string;
249
+ export default asset;
250
+ }
251
+
252
+ declare module "*.yml" {
253
+ const asset: string;
254
+ export default asset;
255
+ }
256
+
257
+ declare module "*.glsl" {
258
+ const asset: string;
259
+ export default asset;
260
+ }
261
+
262
+ declare module "*.vert" {
263
+ const asset: string;
264
+ export default asset;
265
+ }
266
+
267
+ declare module "*.frag" {
268
+ const asset: string;
269
+ export default asset;
270
+ }
271
+
272
+ declare module "*.gltf" {
273
+ const asset: string;
274
+ export default asset;
275
+ }
276
+
277
+ declare module "*.glb" {
278
+ const asset: string;
279
+ export default asset;
280
+ }
281
+
282
+ declare module "*.obj" {
283
+ const asset: string;
284
+ export default asset;
285
+ }
286
+
287
+ declare module "*.mtl" {
288
+ const asset: string;
289
+ export default asset;
290
+ }