fusee-framework 1.0.0 → 1.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.
@@ -6,12 +6,15 @@ const DANGEROUS_SCHEMES = /^(javascript|data|vbscript|file):/i
6
6
  export function evaluateExpression(expr, context, extraContext = {}, unwrapSignals = true) {
7
7
  const keys = []
8
8
  const values = []
9
+ const identifiers = new Set(expr.match(/[a-zA-Z_$][a-zA-Z0-9_$]*/g) || [])
9
10
 
10
- // Map global context
11
+ // Map global context (only what is used in expression)
11
12
  for (const k in context) {
12
- keys.push(k)
13
- const val = context[k]
14
- values.push(unwrapSignals && typeof val === 'function' && val.isSignal ? val() : val)
13
+ if (identifiers.has(k)) {
14
+ keys.push(k)
15
+ const val = context[k]
16
+ values.push(unwrapSignals && typeof val === 'function' && val.isSignal ? val() : val)
17
+ }
15
18
  }
16
19
 
17
20
  // Map extra context (like $event)
@@ -9,9 +9,11 @@ export function createRouter(routes) {
9
9
  window.addEventListener('hashchange', handler)
10
10
 
11
11
  if (document.readyState === 'loading') {
12
- window.addEventListener('DOMContentLoaded', handler)
12
+ window.addEventListener('DOMContentLoaded', handler, { once: true })
13
13
  } else {
14
- _resolve()
14
+ setTimeout(() => {
15
+ if (!_currentInstance) _resolve()
16
+ }, 0)
15
17
  }
16
18
 
17
19
  return {
@@ -41,7 +43,7 @@ export function mountOutlet(el) {
41
43
  }
42
44
 
43
45
  function _resolve() {
44
- if (!_outlet) {
46
+ if (!_outlet || _routes.length === 0) {
45
47
  return
46
48
  }
47
49
 
@@ -13,13 +13,3 @@ export function compileNode(
13
13
  components: Record<string, ComponentFactory>,
14
14
  effects: (() => void)[]
15
15
  ): void
16
-
17
- function processTextNodes(root: HTMLElement, context: ComponentResult, effects: (() => void)[]): void
18
- function processAttrBindings(root: HTMLElement, context: ComponentResult, effects: (() => void)[]): void
19
-
20
- function bindComponents(
21
- container: HTMLElement,
22
- components: Record<string, ComponentFactory>,
23
- context: ComponentResult,
24
- effects: (() => void)[]
25
- ): void
package/index.html CHANGED
@@ -30,14 +30,23 @@
30
30
  }
31
31
 
32
32
  nav a {
33
- color: #ff3333; /* Link-urile sunt acum roșii */
33
+ color: #ff3333;
34
+ /* Link-urile sunt acum roșii */
34
35
  text-decoration: none;
35
36
  font-weight: 500;
36
37
  }
37
38
 
38
39
  /* Temă Red Fusée */
39
- #app h1 { color: #ff3333; text-shadow: 0 0 20px rgba(255, 51, 51, 0.4); margin-bottom: 1rem; }
40
- #app p { color: #ff9999; opacity: 0.9; }
40
+ #app h1 {
41
+ color: #ff3333;
42
+ text-shadow: 0 0 20px rgba(255, 51, 51, 0.4);
43
+ margin-bottom: 1rem;
44
+ }
45
+
46
+ #app p {
47
+ color: #ff9999;
48
+ opacity: 0.9;
49
+ }
41
50
 
42
51
  nav a:hover {
43
52
  color: #fff;
@@ -159,6 +168,7 @@
159
168
  <nav>
160
169
  <a href="#/">Home</a>
161
170
  <a href="#/about">About</a>
171
+ <a href="#/test-for">Test f-for</a>
162
172
  </nav>
163
173
  <div id="app"></div>
164
174
  <script type="module" src="./app/main.js"></script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fusee-framework",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Fusée - Signals-first JS Framework | Peak Performance",
5
5
  "main": "framework/index.js",
6
6
  "types": "framework/types/index.d.ts",
@@ -26,6 +26,7 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^6.0.2",
29
+ "unplugin-auto-import": "^21.0.0",
29
30
  "vite": "^5.0.0"
30
31
  }
31
32
  }
package/tsconfig.json CHANGED
@@ -23,11 +23,16 @@
23
23
  "declaration": true,
24
24
  "declarationDir": "./dist/types",
25
25
 
26
- "resolveJsonModule": true
26
+ "resolveJsonModule": true,
27
+ "paths": {
28
+ "fusee-framework": ["./framework/types/index.d.ts"],
29
+ "fusee-framework/*": ["./framework/*"]
30
+ }
27
31
  },
28
32
  "include": [
29
33
  "app/**/*",
30
- "framework/**/*"
34
+ "framework/**/*",
35
+ "auto-imports.d.ts"
31
36
  ],
32
37
  "exclude": [
33
38
  "node_modules",
package/vite.config.js CHANGED
@@ -1,27 +1,30 @@
1
1
  import { defineConfig } from 'vite'
2
2
  import path from 'path'
3
+ import AutoImport from 'unplugin-auto-import/vite'
4
+ import { FuseePreset } from './framework/auto-import-preset.js'
3
5
 
4
6
  export default defineConfig({
5
- // Directorul rădăcină al proiectului
6
7
  root: '.',
8
+ plugins: [
9
+ AutoImport({
10
+ imports: [FuseePreset],
11
+ dts: true,
12
+ })
13
+ ],
7
14
 
8
- // Alias-uri pentru import-uri mai curate
9
- // În loc de '../../framework/index.js' poți scrie '@fusee'
10
15
  resolve: {
11
16
  alias: {
12
- '@fusee': path.resolve(__dirname, './framework'),
17
+ 'fusee-framework': path.resolve(__dirname, './framework'),
13
18
  '@app': path.resolve(__dirname, './app'),
14
19
  }
15
20
  },
16
21
 
17
- // Config pentru server-ul de development
18
22
  server: {
19
23
  port: 3000,
20
- open: true, // Deschide browserul automat
21
- hmr: true, // Hot Module Replacement
24
+ open: true,
25
+ hmr: true,
22
26
  },
23
27
 
24
- // Config pentru build de producție
25
28
  build: {
26
29
  outDir: 'dist',
27
30
  emptyOutDir: true,