fusee-framework 1.7.0 → 1.8.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 (38) hide show
  1. package/README.md +145 -139
  2. package/app/benchmark/benchmark.js +2 -2
  3. package/app/main.js +24 -3
  4. package/app/main.ts +7 -1
  5. package/app/pages/_layout.js +27 -0
  6. package/app/pages/async-work.js +65 -0
  7. package/app/pages/index.js +25 -5
  8. package/app/pages/index.ts +9 -0
  9. package/app/pages/router-example.js +24 -1
  10. package/app/pages/scroll-demo.ts +102 -0
  11. package/app/providers/ChildComponent.js +8 -2
  12. package/app/providers/ChildComponent.ts +47 -47
  13. package/app/providers/GrandchildComponent.js +19 -0
  14. package/app/providers/ParentComponent.js +5 -1
  15. package/app/routes/RouterExample.js +23 -1
  16. package/app/routes/TestResource.js +47 -0
  17. package/app/services.js +15 -0
  18. package/auto-imports.d.ts +8 -0
  19. package/framework/auto-import-preset.js +13 -9
  20. package/framework/core/component.js +27 -13
  21. package/framework/core/di.js +187 -0
  22. package/framework/core/directives.js +40 -96
  23. package/framework/core/evaluator.js +1 -1
  24. package/framework/core/reconcile.js +151 -0
  25. package/framework/core/signal.js +267 -0
  26. package/framework/core/store.js +322 -81
  27. package/framework/index.js +5 -3
  28. package/framework/router/file-router.js +1 -1
  29. package/framework/router/router.js +113 -21
  30. package/framework/types/component.d.ts +89 -88
  31. package/framework/types/di.d.ts +43 -0
  32. package/framework/types/index.d.ts +32 -22
  33. package/framework/types/reconcile.d.ts +7 -0
  34. package/framework/types/router.d.ts +11 -1
  35. package/framework/types/signal.d.ts +147 -79
  36. package/framework/types/store.d.ts +66 -8
  37. package/package.json +1 -1
  38. package/vite.config.js +7 -1
package/README.md CHANGED
@@ -1,139 +1,145 @@
1
- # Fusée Framework 🚀
2
- **v1.7.0 — Signals-First JS Framework | Atomic Reactivity | Peak Performance**
3
-
4
- Fusée is a custom, high-performance fine-grained reactive JavaScript framework built for speed and simplicity. It features a recursive, non-greedy compiler, a signals-based reactivity engine, Dependency Injection for components and a comprehensive CLI for instant application scaffolding.
5
-
6
- ---
7
-
8
- ## ⚡ Quick Start
9
-
10
- The fastest way to get started with Fusée is via the **Go-Powered CLI**:
11
-
12
- ```bash
13
- # 1. Install Fusée CLI globally
14
- npm install -g fusee-framework
15
-
16
- # 2. Scaffold a new high-performance project
17
- create-fusee-app my-awesome-app
18
- # or simply
19
- fusee init my-awesome-app
20
- ```
21
- Follow the interactive prompt to choose your template (**JavaScript** or **TypeScript**) and launch your app instantly!
22
-
23
- ---
24
-
25
- ## 🏗️ File-Based Routing (Nuxt-style)
26
- Fusée now supports automated, file-based routing. No more manual route definitions!
27
-
28
- - **Pages**: Just drop a file in `app/pages/` and it becomes a route.
29
- - **Layouts**: Use `app/pages/_layout.js` to wrap your pages in consistent UI structures.
30
- - **Dynamic Routes**: Support for `[id].js` style dynamic parameters.
31
-
32
- ```bash
33
- # Generate a new page instantly
34
- fusee generate page contact
35
- ```
36
-
37
- ---
38
-
39
- ## 🔥 Key Features
40
-
41
- - **New Go-Powered CLI**: Blazing fast project scaffolding and resource generation.
42
- - **Signals-First Reactivity**: Modern atomic updates that ensure only the modified parts of the DOM are touched.
43
- - **Nuxt-style File Routing**: Automated route discovery with layout support.
44
- - **Recursive Hybrid Compiler**: A robust architectural approach to node traversal.
45
- - **Optimized Directives**: Native support for `f-if`, `f-for`, `f-model`, `f-text`, `f-cloak` and more.
46
- - **Performance Shield (`f-once`)**: Isolate and stabilize static subtrees.
47
- - **Vite Integration**: Full support for the fastest development workflow and HMR.
48
-
49
- ---
50
-
51
- ## 🛠 Project Structure
52
-
53
- A typical Fusée project looks like this:
54
-
55
- - **`framework/`**: The core reactive engine.
56
- - **`app/`**: Your application logic (routes, components).
57
- - **`index.html`**: The entry point of your reactive world.
58
-
59
- ---
60
-
61
- ## 📝 Example Component
62
-
63
- ```javascript
64
- export const Welcome = defineComponent({
65
- setup() {
66
- const name = signal('World');
67
- const count = signal(0);
68
- const double = computed(() => count() * 2);
69
-
70
- return {
71
- name,
72
- count,
73
- double,
74
- inc: () => count(count() + 1),
75
- template: `
76
- <div class="card">
77
- <h2>Hello, {{ name }}!</h2>
78
- <input f-model="name" placeholder="Name" />
79
-
80
- <button @click.debounce.300ms="inc">
81
- Clicked {{ count }} times
82
- </button>
83
-
84
- <p f-if="count() > 0">
85
- Double: <strong>{{ double }}</strong>
86
- </p>
87
- </div>
88
- `
89
- };
90
- }
91
- });
92
- ```
93
-
94
- ---
95
-
96
- ## ✅ Quality Assurance & Testing
97
-
98
- Fusée is built with a test-driven mindset to ensure the reliability of its reactivity engine and component lifecycle.
99
-
100
- - **Total Tests:** `468`
101
- - **Status:** `All Passed`
102
- - **Framework:** [Vitest](https://vitest.dev/)
103
- - **Environment:** JSDOM (Browser simulation)
104
-
105
- ### Running Tests
106
-
107
- ```bash
108
- # Run all tests (easiest)
109
- npm test
110
-
111
- # Run all tests with verbose output
112
- npx vitest --reporter=verbose
113
-
114
- # Run type tests only
115
- npx vitest run --typecheck
116
-
117
- # Run tests in watch mode
118
- npx vitest
119
- ```
120
-
121
- ### Test Coverage includes:
122
- * **Reactivity Engine:** 100% (Signals, Batching, Computed, Watchers).
123
- * **Component System:** Props, Slots, Async Components, and Lifecycle Hooks.
124
- * **Dependency Injection:** Nested Provide/Inject and Shadowing.
125
- * **Directives:** `f-if`, `f-for`, `f-model`, and Event Modifiers.
126
- * **Events:** Event delegation and native event handling.
127
- * **Memory Safety:** Explicit checks for memory leaks and automatic effect disposal.
128
- * **Type Safety:** Comprehensive TypeScript definitions and type tests.
129
- * **Integration Tests:** Advanced module combinations and edge cases.
130
-
131
- ---
132
-
133
- ## 🚀 Future Roadmap
134
-
135
- - [ ] Advanced state management and SSR support
136
- - [ ] Lightweight compiler which transforms declarative HTML into optimized runtime instructions
137
- - [ ] Integrated backend development support
138
-
139
- Built with ❤️ by me, Sebi Somu, a forward-thinking JavaScript Architect.
1
+ # Fusée Framework
2
+
3
+ **v1.8.0 — Signals-First JS Framework | Atomic Reactivity | Peak Performance**
4
+
5
+ Fusée is a custom, high-performance fine-grained reactive JavaScript framework built for speed and simplicity. It features a recursive, non-greedy compiler, a signals-based reactivity engine, Dependency Injection for components and a comprehensive CLI for instant application scaffolding.
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ The fastest way to get started with Fusée is via the **Go-Powered CLI**:
12
+
13
+ ```bash
14
+ # 1. Install Fusée CLI globally
15
+ npm install -g fusee-framework
16
+
17
+ # 2. Scaffold a new high-performance project
18
+ create-fusee-app my-awesome-app
19
+ # or simply
20
+ fusee init my-awesome-app
21
+ ```
22
+
23
+ Follow the interactive prompt to choose your template (**JavaScript** or **TypeScript**) and launch your app instantly!
24
+
25
+ ---
26
+
27
+ ## File-Based Routing (Nuxt-style)
28
+
29
+ Fusée now supports automated, file-based routing!
30
+
31
+ - **Pages**: Just drop a file in `app/pages/` and it becomes a route.
32
+ - **Layouts**: Use `app/pages/_layout.js` to wrap your pages in consistent UI structures.
33
+ - **Dynamic Routes**: Support for `[id].js` style dynamic parameters.
34
+
35
+ ```bash
36
+ # Generate a new page instantly
37
+ fusee generate page contact
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Key Features
43
+
44
+ - **New Go-Powered CLI**: Blazing fast project scaffolding and resource generation.
45
+ - **Signals/Resources-First Reactivity**: Modern atomic updates that ensure only the modified parts of the DOM are touched.
46
+ - **Nuxt-style File Routing**: Automated route discovery with layout support.
47
+ - **Recursive Hybrid Compiler**: A robust architectural approach to node traversal.
48
+ - **Optimized Directives**: Native support for `f-if`, `f-for`, `f-model`, `f-text`, `f-cloak` and more.
49
+ - **Performance Shield (`f-once`)**: Isolate and stabilize static subtrees.
50
+ - **Vite Integration**: Full support for the fastest development workflow and HMR.
51
+ - **Dependency Injection**: Nested Provide/Inject and Shadowing.
52
+ - **Memory Safety**: Explicit checks for memory leaks and automatic effect disposal.
53
+
54
+ ---
55
+
56
+ ## Project Structure
57
+
58
+ A typical Fusée project looks like this:
59
+
60
+ - **`framework/`**: The core reactive engine.
61
+ - **`app/`**: Your application logic (routes, components).
62
+ - **`index.html`**: The entry point of your reactive world.
63
+
64
+ ---
65
+
66
+ ## Example Component
67
+
68
+ ```javascript
69
+ export const Welcome = defineComponent({
70
+ setup() {
71
+ const name = signal("World");
72
+ const count = signal(0);
73
+ const double = computed(() => count() * 2);
74
+
75
+ return {
76
+ name,
77
+ count,
78
+ double,
79
+ inc: () => count(count() + 1),
80
+ template: `
81
+ <div class="card">
82
+ <h2>Hello, {{ name }}!</h2>
83
+ <input f-model="name" placeholder="Name" />
84
+
85
+ <button @click.debounce.300ms="inc">
86
+ Clicked {{ count }} times
87
+ </button>
88
+
89
+ <p f-if="count() > 0">
90
+ Double: <strong>{{ double }}</strong>
91
+ </p>
92
+ </div>
93
+ `,
94
+ };
95
+ },
96
+ });
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Quality Assurance & Testing
102
+
103
+ Fusée is built with a test-driven mindset to ensure the reliability of its reactivity engine and component lifecycle.
104
+
105
+ - **Total Tests:** `527`
106
+ - **Status:** `All Passed`
107
+ - **Framework:** [Vitest](https://vitest.dev/)
108
+ - **Environment:** JSDOM (Browser simulation)
109
+
110
+ ### Running Tests
111
+
112
+ ```bash
113
+ # Run all tests (easiest)
114
+ npm test
115
+
116
+ # Run all tests with verbose output
117
+ npx vitest --reporter=verbose
118
+
119
+ # Run type tests only
120
+ npx vitest run --typecheck
121
+
122
+ # Run tests in watch mode
123
+ npx vitest
124
+ ```
125
+
126
+ ### Test Coverage includes:
127
+
128
+ - **Reactivity Engine:** 100% (Signals, Batching, Computed, Watchers).
129
+ - **Component System:** Props, Slots, Async Components, and Lifecycle Hooks.
130
+ - **Dependency Injection:** Nested Provide/Inject and Shadowing.
131
+ - **Directives:** `f-if`, `f-for`, `f-model`, and Event Modifiers.
132
+ - **Events:** Event delegation and native event handling.
133
+ - **Memory Safety:** Explicit checks for memory leaks and automatic effect disposal.
134
+ - **Type Safety:** Comprehensive TypeScript definitions and type tests.
135
+ - **Integration Tests:** Advanced module combinations and edge cases.
136
+
137
+ ---
138
+
139
+ ## Future Roadmap
140
+
141
+ - [ ] Advanced state management and SSR support
142
+ - [ ] Lightweight compiler which transforms declarative HTML into optimized runtime instructions
143
+ - [ ] Integrated backend development support
144
+
145
+ Built by me, Sebi Somu, a forward-thinking JavaScript Architect.
@@ -96,7 +96,7 @@ function renderTable(rows, container) {
96
96
  </tr>
97
97
  </thead>
98
98
  <tbody>
99
- <tr f-for="row in rows" :class="row.selected() ? 'selected' : ''">
99
+ <tr f-for="row in rows" :key="row.id" :class="row.selected() ? 'selected' : ''">
100
100
  <td>{{ row.id }}</td>
101
101
  <td>{{ row.label() }}</td>
102
102
  <td>
@@ -166,7 +166,7 @@ const benchmarks = {
166
166
  <table>
167
167
  <thead><tr><th>ID</th><th>Label</th></tr></thead>
168
168
  <tbody>
169
- <tr f-for="row in rows" :class="row.selected() ? 'selected' : ''">
169
+ <tr f-for="row in rows" :key="row.id" :class="row.selected() ? 'selected' : ''">
170
170
  <td>{{ row.id }}</td>
171
171
  <td>{{ row.label() }}</td>
172
172
  </tr>
package/app/main.js CHANGED
@@ -1,4 +1,6 @@
1
- import { createRouter, mountOutlet, defineAsyncComponent, generateRoutes } from '../framework/index.js'
1
+ import { createRouter, mountOutlet, generateRoutes, directive, provideGlobal } from '../framework/index.js'
2
+ import { APP_CONFIG, LoggerService } from './services.js'
3
+
2
4
  import { Loading } from './components/Loading.js'
3
5
 
4
6
  directive('focus', {
@@ -17,13 +19,32 @@ directive('highlight', {
17
19
  }
18
20
  })
19
21
 
20
- const pages = import.meta.glob('./pages/**/*.{js,ts}')
22
+ const pages = import.meta.glob('./pages/**/*.js')
23
+
21
24
  const routes = generateRoutes(pages, {
22
25
  loadingComponent: Loading
23
26
  })
24
27
 
25
- createRouter(routes)
28
+ provideGlobal(LoggerService);
29
+
30
+ provideGlobal({
31
+ provide: APP_CONFIG,
32
+ useValue: {
33
+ title: 'Fusee v2 App',
34
+ version: '2.0.0-beta'
35
+ }
36
+ });
37
+
38
+ // Scroll behavior configuration
39
+ createRouter(routes, {
40
+ scrollBehavior: {
41
+ scrollToTop: true,
42
+ scrollToAnchor: true,
43
+ saveScrollPosition: true
44
+ }
45
+ })
26
46
 
27
47
  const outlet = document.getElementById('app')
28
48
  if (!outlet) throw new Error('[app] #app element not found in DOM')
49
+
29
50
  mountOutlet(outlet)
package/app/main.ts CHANGED
@@ -60,7 +60,13 @@ routes.push({
60
60
 
61
61
 
62
62
 
63
- createRouter(routes)
63
+ createRouter(routes, {
64
+ scrollBehavior: {
65
+ scrollToTop: true,
66
+ scrollToAnchor: true,
67
+ saveScrollPosition: true
68
+ }
69
+ })
64
70
 
65
71
 
66
72
 
@@ -1,26 +1,53 @@
1
1
  import { defineComponent } from '../../framework/index.js'
2
2
 
3
+
4
+
3
5
  export const RootLayout = defineComponent({
6
+
4
7
  setup() {
8
+
5
9
  return {
10
+
6
11
  template: `
12
+
7
13
  <div class="root-layout">
14
+
8
15
  <nav>
16
+
9
17
  <a href="/" f-link>Home</a>
18
+
10
19
  <a href="/about" f-link>About</a>
20
+
11
21
  <a href="/test-for" f-link>Loops Test</a>
22
+
12
23
  <a href="/dynamic" f-link style="color: #ec4899;">Dynamic Components</a>
24
+
13
25
  <a href="/composables" f-link style="color: #34d399;">Composables</a>
26
+
14
27
  <a href="/users" f-link style="color: #f59e0b;">👥 Users (Nested)</a>
28
+
15
29
  <a href="/router-example" f-link style="color: #8b8bff;">🔗 Router Example</a>
30
+ <a href="/async-work" f-link style="color: #34d399;">⚡ Async Work</a>
31
+
16
32
  </nav>
33
+
17
34
 
35
+
18
36
  <main class="content-wrap">
37
+
19
38
  <!-- This is where all pages will be rendered -->
39
+
20
40
  <div data-router-view></div>
41
+
21
42
  </main>
43
+
22
44
  </div>
45
+
23
46
  `
47
+
24
48
  }
49
+
25
50
  }
51
+
26
52
  })
53
+
@@ -0,0 +1,65 @@
1
+ import { defineComponent, signal, resource } from '../../framework/index.js'
2
+
3
+ export default defineComponent({
4
+ setup() {
5
+ const userId = signal(1)
6
+
7
+ const [user, { refetch }] = resource(userId, async (id) => {
8
+ const response = await fetch(`https://jsonplaceholder.typicode.com/users/${id}`)
9
+ if (!response.ok) throw new Error('User not found')
10
+ return response.json()
11
+ })
12
+
13
+ return {
14
+ userId,
15
+ user,
16
+ refetch,
17
+ next: () => userId(userId() + 1),
18
+ prev: () => userId() > 1 && userId(userId() - 1),
19
+ template: `
20
+ <div class="page">
21
+ <h1>⚡ Async Work with Resources</h1>
22
+ <p>This page demonstrates the new <code>resource</code> primitive, inspired by SolidJS. It handles async data fetching with reactive loading and error states.</p>
23
+
24
+ <div class="demo-section">
25
+ <div class="flex gap-2 mb-6">
26
+ <button @click="prev" class="cmp-btn minus" :disabled="userId() <= 1">← Previous</button>
27
+ <button @click="next" class="cmp-btn plus">Next User →</button>
28
+ <button @click="refetch" class="cmp-btn reset">🔄 Refetch</button>
29
+ <span class="ml-4 flex items-center">Current ID: <strong>{{ userId }}</strong></span>
30
+ </div>
31
+
32
+ <div f-if="user.loading()">
33
+ <div class="action-btn btn-loading">Fetching data from API...</div>
34
+ </div>
35
+
36
+ <div f-if="user.error()">
37
+ <div class="action-btn btn-error">
38
+ <strong>Error:</strong> {{ user.error().message }}
39
+ </div>
40
+ </div>
41
+
42
+ <div f-if="user() && !user.loading()">
43
+ <div class="theme-box theme-dark">
44
+ <h2 class="text-xl font-bold mb-2">{{ user().name }}</h2>
45
+ <p><strong>Username:</strong> @{{ user().username }}</p>
46
+ <p><strong>Email:</strong> {{ user().email }}</p>
47
+ <p><strong>Website:</strong> <a :href="'https://' + user().website" target="_blank" style="color: #8b8bff">{{ user().website }}</a></p>
48
+ <p><strong>Company:</strong> {{ user().company.name }}</p>
49
+ </div>
50
+ </div>
51
+ </div>
52
+
53
+ <div class="info-section">
54
+ <h2>How it works:</h2>
55
+ <ul>
56
+ <li><strong>Reactive Source:</strong> The fetcher automatically reruns when <code>userId</code> changes.</li>
57
+ <li><strong>State Tracking:</strong> <code>user.loading()</code> and <code>user.error()</code> are signals updated by the framework.</li>
58
+ <li><strong>Batching:</strong> Loading and data states are updated atomically to prevent UI flickers.</li>
59
+ </ul>
60
+ </div>
61
+ </div>
62
+ `
63
+ }
64
+ }
65
+ })
@@ -52,10 +52,21 @@ export const Home = defineComponent({
52
52
  <p>This is an SPA built with my own JavaScript custom framework!</p>
53
53
  <p>Made with passion by Sebastian Șomu</p>
54
54
 
55
+ <!-- Navigation -->
56
+ <div style="display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1.5rem 0; padding: 1rem; background: #2a2a2a; border-radius: 8px;">
57
+ <a href="#classlist" f-link style="color: #f59e0b; text-decoration: none; padding: 0.5rem 1rem; background: #3a3a3a; border-radius: 4px;">🎨 f-classList</a>
58
+ <a href="#userform" f-link style="color: #10b981; text-decoration: none; padding: 0.5rem 1rem; background: #3a3a3a; border-radius: 4px;">📝 User Form</a>
59
+ <a href="#counter" f-link style="color: #3b82f6; text-decoration: none; padding: 0.5rem 1rem; background: #3a3a3a; border-radius: 4px;">🔢 Counter</a>
60
+ <a href="#emit" f-link style="color: #4da6ff; text-decoration: none; padding: 0.5rem 1rem; background: #3a3a3a; border-radius: 4px;">🧪 Emit Events</a>
61
+ <a href="#slots" f-link style="color: #8b5cf6; text-decoration: none; padding: 0.5rem 1rem; background: #3a3a3a; border-radius: 4px;">🎴 Slots</a>
62
+ <a href="#interpolation" f-link style="color: #e83e8c; text-decoration: none; padding: 0.5rem 1rem; background: #3a3a3a; border-radius: 4px;">🔤 Interpolation</a>
63
+ <a href="#provide" f-link style="color: #4CAF50; text-decoration: none; padding: 0.5rem 1rem; background: #3a3a3a; border-radius: 4px;">🔗 Provide/Inject</a>
64
+ </div>
65
+
55
66
  <button @click="changeTitle" class="primary-btn" style="margin-bottom: 20px;">Change App Title</button>
56
67
 
57
68
  <!-- 🎨 f-classList Demo -->
58
- <h3 style="margin-top: 40px; margin-bottom: 20px; color: #f59e0b;">🎨 f-classList Demo</h3>
69
+ <h3 id="classlist" style="margin-top: 40px; margin-bottom: 20px; color: #f59e0b;">🎨 f-classList Demo</h3>
59
70
  <div class="demo-box" f-classList="basicClasses">
60
71
  Demo Box (hover me!)
61
72
  </div>
@@ -71,16 +82,18 @@ export const Home = defineComponent({
71
82
  </button>
72
83
  </div>
73
84
 
85
+ <h3 id="userform" style="margin-top: 40px; margin-bottom: 20px; color: #10b981;">📝 User Form Demo</h3>
74
86
  {{ UserForm }}
75
87
 
88
+ <h3 id="counter" style="margin-top: 40px; margin-bottom: 20px; color: #3b82f6;">🔢 Counter Demo</h3>
76
89
  {{ CounterSection @counter-change="handleCounterChange" @counter-reset="handleCounterReset" @custom-event="handleCustomEvent" :pageTitle="title" }}
77
90
 
78
91
  <!-- 🧪 EMIT TEST - NEW SEPARATE COMPONENT -->
79
- <h3 style="margin-top: 40px; margin-bottom: 20px; color: #4da6ff;">🧪 EMIT EVENTS TEST LAB</h3>
92
+ <h3 id="emit" style="margin-top: 40px; margin-bottom: 20px; color: #4da6ff;">🧪 EMIT EVENTS TEST LAB</h3>
80
93
  {{ EmitTest @simple-click="handleSimpleClick" @click-with-data="handleClickWithData" @object-event="handleObjectEvent" }}
81
94
 
82
95
  <!-- 🧪 Slots Test -->
83
- <h3 style="margin-top: 40px; margin-bottom: 20px;">🎴 Slots Test</h3>
96
+ <h3 id="slots" style="margin-top: 40px; margin-bottom: 20px;">🎴 Slots Test</h3>
84
97
 
85
98
  {{ Card title="Custom Card" }}
86
99
  <template slot="header">
@@ -100,7 +113,7 @@ export const Home = defineComponent({
100
113
  {{ /Card }}
101
114
 
102
115
  <!-- 🧪 INTERPOLATION TEST -->
103
- <h3 style="margin-top: 40px; margin-bottom: 20px; color: #e83e8c;">🔤 INTERPOLATION TEST</h3>
116
+ <h3 id="interpolation" style="margin-top: 40px; margin-bottom: 20px; color: #e83e8c;">🔤 INTERPOLATION TEST</h3>
104
117
  <div style="background: #2a2a2a; padding: 15px; border-radius: 8px; border: 1px solid #444;">
105
118
  <p><strong>Escaped Braces:</strong> \\{{ this is not evaluated }}</p>
106
119
  <p><strong>String Literal with Braces:</strong> {{ "Look, {{ braces }} inside a string!" }}</p>
@@ -108,8 +121,15 @@ export const Home = defineComponent({
108
121
  </div>
109
122
 
110
123
  <!-- 🧪 PROVIDE / INJECT TEST -->
111
- <h3 style="margin-top: 40px; margin-bottom: 20px; color: #4CAF50;">🔗 PROVIDE / INJECT TEST</h3>
124
+ <h3 id="provide" style="margin-top: 40px; margin-bottom: 20px; color: #4CAF50;">🔗 PROVIDE / INJECT TEST</h3>
112
125
  {{ ParentComponent }}
126
+
127
+ <!-- Back to top -->
128
+ <div style="text-align: center; margin-top: 3rem; padding: 2rem;">
129
+ <a href="/" f-link style="color: white; text-decoration: none; padding: 0.75rem 1.5rem; background: #3b82f6; border-radius: 6px; font-weight: bold;">
130
+ ⬆️ Back to Top
131
+ </a>
132
+ </div>
113
133
  </div>
114
134
  `
115
135
  }
@@ -50,6 +50,15 @@ export const Home = defineComponent({
50
50
  <p>This is an SPA built with my own (TypeScript!) custom framework!</p>
51
51
  <p>Made with passion by Sebastian Șomu</p>
52
52
 
53
+ <div style="display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0;">
54
+ <a href="/scroll-demo" f-link class="cmp-btn" style="background: linear-gradient(135deg, #8b8bff, #6b6bff);">
55
+ 🔽 Scroll Behavior Demo
56
+ </a>
57
+ <a href="/users" f-link class="cmp-btn">
58
+ 👥 Router Example
59
+ </a>
60
+ </div>
61
+
53
62
  <button @click="changeTitle" class="primary-btn" style="margin-bottom: 20px;">Change App Title</button>
54
63
 
55
64
  <h3 style="margin-top: 40px; margin-bottom: 20px; color: #f59e0b;">🎨 f-classList Demo</h3>
@@ -1,15 +1,25 @@
1
- import { currentRoute, navigate, routeParams, computed } from '../../framework/index.js'
1
+ import { currentRoute, navigate, routeParams, routeQuery, computed } from '../../framework/index.js'
2
2
 
3
3
  export const RouterExample = defineComponent({
4
4
  setup() {
5
5
  const path = currentRoute
6
6
  const params = routeParams
7
+ const query = routeQuery
7
8
  const paramsJson = computed(() => JSON.stringify(params()))
9
+ const queryJson = computed(() => JSON.stringify(query()))
10
+
11
+ const updateQuery = () => {
12
+ const now = new Date().toLocaleTimeString()
13
+ const basePath = path().split('?')[0]
14
+ navigate(`${basePath}?t=${encodeURIComponent(now)}&user=guest`)
15
+ }
8
16
 
9
17
  return {
10
18
  path,
11
19
  paramsJson,
20
+ queryJson,
12
21
  navigate,
22
+ updateQuery,
13
23
  template: `
14
24
  <div class="page">
15
25
  <h1>🔗 Router API Demo</h1>
@@ -19,6 +29,19 @@ export const RouterExample = defineComponent({
19
29
  <code style="color: #8b8bff; font-size: 1.5rem;">{{ path }}</code>
20
30
  </div>
21
31
 
32
+ <div class="demo-card">
33
+ <h2>routeQuery Signal (Query Params)</h2>
34
+ <div style="display: flex; gap: 10px; margin-bottom: 10px;">
35
+ <a href="/router-example?search=framework&page=1" f-link class="cmp-btn" style="text-decoration: none;">?search=framework&page=1</a>
36
+ <a href="/router-example?filter=active&sort=desc" f-link class="cmp-btn" style="text-decoration: none;">?filter=active&sort=desc</a>
37
+ <button @click="updateQuery" class="cmp-btn">Update Time via Query</button>
38
+ </div>
39
+ <code style="color: #f59e0b; font-size: 1.2rem;">{{ queryJson }}</code>
40
+ <p style="margin-top: 10px; color: #888; font-size: 0.9rem;">
41
+ Query parameters are automatically parsed into the routeQuery signal.
42
+ </p>
43
+ </div>
44
+
22
45
  <div class="demo-card">
23
46
  <h2>routeParams Signal (Dynamic Routes)</h2>
24
47
  <div style="display: flex; gap: 10px; margin-bottom: 10px;">