fusee-framework 1.6.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 (129) hide show
  1. package/README.md +145 -123
  2. package/app/benchmark/benchmark.js +633 -0
  3. package/app/benchmark/index.html +102 -0
  4. package/app/benchmark/styles.css +249 -0
  5. package/app/components/Counter.js +17 -7
  6. package/app/components/CounterSection.js +3 -4
  7. package/app/main.js +50 -62
  8. package/app/main.ts +78 -63
  9. package/app/pages/404.js +16 -0
  10. package/app/pages/[...all].js +35 -0
  11. package/app/pages/[...all].ts +35 -0
  12. package/app/pages/_layout.js +53 -0
  13. package/app/pages/_layout.ts +26 -0
  14. package/app/pages/about.js +23 -0
  15. package/app/pages/about.ts +29 -0
  16. package/app/pages/async-work.js +65 -0
  17. package/app/pages/composables.js +158 -0
  18. package/app/pages/composables.ts +158 -0
  19. package/app/pages/dynamic.js +40 -0
  20. package/app/pages/dynamic.ts +40 -0
  21. package/app/pages/index.js +137 -0
  22. package/app/pages/index.ts +87 -0
  23. package/app/pages/login.ts +21 -0
  24. package/app/pages/objects/[id].js +56 -0
  25. package/app/pages/objects/[id].ts +56 -0
  26. package/app/pages/posts/[category]/[slug].js +56 -0
  27. package/app/pages/posts/[category]/[slug].ts +56 -0
  28. package/app/pages/router-example.js +79 -0
  29. package/app/pages/router-example.ts +56 -0
  30. package/app/pages/scroll-demo.ts +102 -0
  31. package/app/pages/test-for.js +65 -0
  32. package/app/pages/test-for.ts +80 -0
  33. package/app/pages/users/[id].js +24 -0
  34. package/app/pages/users/[id].ts +46 -0
  35. package/app/pages/users/index.js +22 -0
  36. package/app/pages/users/index.ts +29 -0
  37. package/app/pages/users.js +43 -0
  38. package/app/pages/users.ts +78 -0
  39. package/app/providers/ChildComponent.js +8 -2
  40. package/app/providers/ChildComponent.ts +47 -47
  41. package/app/providers/GrandchildComponent.js +19 -0
  42. package/app/providers/ParentComponent.js +5 -1
  43. package/app/routes/About.js +1 -1
  44. package/app/routes/About.ts +1 -1
  45. package/app/routes/AuthRoutes.ts +41 -0
  46. package/app/routes/Home.js +9 -0
  47. package/app/routes/NotFound.js +16 -0
  48. package/app/routes/NotFound.ts +16 -0
  49. package/app/routes/RouterExample.js +78 -0
  50. package/app/routes/RouterExample.ts +56 -0
  51. package/app/routes/TestResource.js +47 -0
  52. package/app/routes/WildcardDemo.js +35 -0
  53. package/app/routes/WildcardDemo.ts +35 -0
  54. package/app/services.js +15 -0
  55. package/auto-imports.d.ts +9 -0
  56. package/bin/create-fusee-linux +0 -0
  57. package/bin/create-fusee-mac-arm64 +0 -0
  58. package/bin/create-fusee-mac-intel +0 -0
  59. package/bin/create-fusee-win.exe +0 -0
  60. package/bin/create-fusee.exe +0 -0
  61. package/bin/index.js +38 -0
  62. package/create-fusee-go/cmd/generate.go +72 -0
  63. package/create-fusee-go/cmd/init.go +38 -0
  64. package/create-fusee-go/cmd/root.go +121 -0
  65. package/create-fusee-go/go.mod +10 -0
  66. package/create-fusee-go/go.sum +10 -0
  67. package/create-fusee-go/internal/assets/assets.go +78 -0
  68. package/create-fusee-go/internal/assets/embed/framework/auto-import-preset.js +9 -0
  69. package/create-fusee-go/internal/assets/embed/framework/core/compiler.js +253 -0
  70. package/create-fusee-go/internal/assets/embed/framework/core/component.js +266 -0
  71. package/create-fusee-go/internal/assets/embed/framework/core/composable.js +27 -0
  72. package/create-fusee-go/internal/assets/embed/framework/core/directives.js +875 -0
  73. package/create-fusee-go/internal/assets/embed/framework/core/evaluator.js +153 -0
  74. package/create-fusee-go/internal/assets/embed/framework/core/event-delegation.js +191 -0
  75. package/create-fusee-go/internal/assets/embed/framework/core/signal.js +412 -0
  76. package/create-fusee-go/internal/assets/embed/framework/core/store.js +81 -0
  77. package/create-fusee-go/internal/assets/embed/framework/index.d.ts +3 -0
  78. package/create-fusee-go/internal/assets/embed/framework/index.js +10 -0
  79. package/create-fusee-go/internal/assets/embed/framework/router/file-router.js +177 -0
  80. package/create-fusee-go/internal/assets/embed/framework/router/router.js +462 -0
  81. package/create-fusee-go/internal/assets/embed/framework/types/compiler.d.ts +15 -0
  82. package/create-fusee-go/internal/assets/embed/framework/types/component.d.ts +88 -0
  83. package/create-fusee-go/internal/assets/embed/framework/types/composable.d.ts +14 -0
  84. package/create-fusee-go/internal/assets/embed/framework/types/directives.d.ts +55 -0
  85. package/create-fusee-go/internal/assets/embed/framework/types/evaluator.d.ts +13 -0
  86. package/create-fusee-go/internal/assets/embed/framework/types/event-delegation.d.ts +32 -0
  87. package/create-fusee-go/internal/assets/embed/framework/types/index.d.ts +22 -0
  88. package/create-fusee-go/internal/assets/embed/framework/types/router.d.ts +32 -0
  89. package/create-fusee-go/internal/assets/embed/framework/types/signal.d.ts +79 -0
  90. package/create-fusee-go/internal/assets/embed/framework/types/store.d.ts +8 -0
  91. package/create-fusee-go/internal/assets/templates/Counter.tmpl +26 -0
  92. package/create-fusee-go/internal/assets/templates/component.tmpl +11 -0
  93. package/create-fusee-go/internal/assets/templates/components/Loading.tmpl +24 -0
  94. package/create-fusee-go/internal/assets/templates/index.html.tmpl +15 -0
  95. package/create-fusee-go/internal/assets/templates/main.tmpl +14 -0
  96. package/create-fusee-go/internal/assets/templates/package.json.tmpl +14 -0
  97. package/create-fusee-go/internal/assets/templates/page.tmpl +12 -0
  98. package/create-fusee-go/internal/assets/templates/pages/about.tmpl +20 -0
  99. package/create-fusee-go/internal/assets/templates/pages/index.tmpl +22 -0
  100. package/create-fusee-go/internal/assets/templates/pages/layout.tmpl +18 -0
  101. package/create-fusee-go/internal/assets/templates/tsconfig.json.tmpl +14 -0
  102. package/create-fusee-go/internal/assets/templates/vite.config.js.tmpl +18 -0
  103. package/create-fusee-go/main.go +7 -0
  104. package/framework/auto-import-preset.js +13 -9
  105. package/framework/core/compiler.js +252 -249
  106. package/framework/core/component.js +279 -260
  107. package/framework/core/di.js +187 -0
  108. package/framework/core/directives.js +819 -786
  109. package/framework/core/evaluator.js +153 -70
  110. package/framework/core/event-delegation.js +33 -14
  111. package/framework/core/reconcile.js +151 -0
  112. package/framework/core/signal.js +679 -403
  113. package/framework/core/store.js +322 -81
  114. package/framework/index.js +12 -11
  115. package/framework/router/file-router.js +177 -0
  116. package/framework/router/router.js +554 -80
  117. package/framework/types/component.d.ts +89 -88
  118. package/framework/types/di.d.ts +43 -0
  119. package/framework/types/event-delegation.d.ts +0 -58
  120. package/framework/types/index.d.ts +32 -22
  121. package/framework/types/reconcile.d.ts +7 -0
  122. package/framework/types/router.d.ts +42 -15
  123. package/framework/types/signal.d.ts +147 -78
  124. package/framework/types/store.d.ts +66 -8
  125. package/index.html +638 -626
  126. package/package.json +5 -3
  127. package/tsconfig.json +1 -0
  128. package/vite.config.js +7 -1
  129. /package/{framework → create-fusee-go/internal/assets/embed/framework}/bin/create-fusee.js +0 -0
package/README.md CHANGED
@@ -1,123 +1,145 @@
1
- # Fusée Framework 🚀
2
- **v1.6.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 CLI:
11
-
12
- ```bash
13
- # 1. Install Fusée globally
14
- npm install -g fusee-framework
15
-
16
- # 2. Scaffold your first project
17
- create-fusee-app .
18
- ```
19
- Follow the interactive prompt to choose your template (**JavaScript** or **TypeScript**) and launch your app with `npm run dev`!
20
-
21
- ---
22
-
23
- ## 🔥 Key Features
24
-
25
- - **Signals-First Reactivity**: Modern atomic updates that ensure only the modified parts of the DOM are touched.
26
- - **Recursive Hybrid Compiler**: A robust architectural approach to node traversal, eliminating rendering bugs while maintaining "greedy" directive processing for speed.
27
- - **Strict Component System**: Use `defineComponent` for prop validation, lifecycle hooks (`onMount`, `onUnmount`), and automated cleanup.
28
- - **Optimized Directives**: Native support for `f-if`, `f-for`, `f-model`, `f-text`, `f-cloak` and more.
29
- - **Performance Shield (`f-once`)**: Isolate and stabilize static subtrees to prevent unnecessary reactivity.
30
- - **Vite Integration**: Full support for the fastest development workflow and Hot Module Replacement (HMR).
31
-
32
- ---
33
-
34
- ## 🛠 Project Structure
35
-
36
- A typical Fusée project looks like this:
37
-
38
- - **`framework/`**: The core reactive engine.
39
- - **`app/`**: Your application logic (routes, components).
40
- - **`index.html`**: The entry point of your reactive world.
41
-
42
- ---
43
-
44
- ## 📝 Example Component
45
-
46
- ```javascript
47
- export const Welcome = defineComponent({
48
- setup() {
49
- const name = signal('World');
50
- const count = signal(0);
51
- const double = computed(() => count() * 2);
52
-
53
- return {
54
- name,
55
- count,
56
- double,
57
- inc: () => count(count() + 1),
58
- template: `
59
- <div class="card">
60
- <h2>Hello, {{ name }}!</h2>
61
- <input f-model="name" placeholder="Name" />
62
-
63
- <button @click.debounce.300ms="inc">
64
- Clicked {{ count }} times
65
- </button>
66
-
67
- <p f-if="count() > 0">
68
- Double: <strong>{{ double }}</strong>
69
- </p>
70
- </div>
71
- `
72
- };
73
- }
74
- });
75
- ```
76
-
77
- ---
78
-
79
- ## ✅ Quality Assurance & Testing
80
-
81
- Fusée is built with a test-driven mindset to ensure the reliability of its reactivity engine and component lifecycle.
82
-
83
- - **Total Tests:** `385`
84
- - **Status:** `All Passed`
85
- - **Framework:** [Vitest](https://vitest.dev/)
86
- - **Environment:** JSDOM (Browser simulation)
87
-
88
- ### Running Tests
89
-
90
- ```bash
91
- # Run all tests (easiest)
92
- npm test
93
-
94
- # Run all tests with verbose output
95
- npx vitest --reporter=verbose
96
-
97
- # Run type tests only
98
- npx vitest run --typecheck
99
-
100
- # Run tests in watch mode
101
- npx vitest
102
- ```
103
-
104
- ### Test Coverage includes:
105
- * **Reactivity Engine:** 100% (Signals, Batching, Computed, Watchers).
106
- * **Component System:** Props, Slots, Async Components, and Lifecycle Hooks.
107
- * **Dependency Injection:** Nested Provide/Inject and Shadowing.
108
- * **Directives:** `f-if`, `f-for`, `f-model`, and Event Modifiers.
109
- * **Events:** Event delegation and native event handling.
110
- * **Memory Safety:** Explicit checks for memory leaks and automatic effect disposal.
111
- * **Type Safety:** Comprehensive TypeScript definitions and type tests.
112
- * **Integration Tests:** Advanced module combinations and edge cases.
113
-
114
- ---
115
-
116
- ## 🚀 Future Roadmap
117
-
118
- - [ ] Advanced file-based routing support and state management
119
- - [ ] SSR support
120
- - [ ] Lightweight compiler which transforms declarative HTML into optimized runtime instructions
121
- - [ ] Integrated backend development support
122
-
123
- 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.