dalila 1.9.2 → 1.9.4

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Dalila
1
+ # 🐰 ✂️ Dalila
2
2
 
3
3
  **DOM-first reactivity without the re-renders.**
4
4
 
@@ -7,7 +7,7 @@ Dalila is a reactive framework built on signals. No virtual DOM, no JSX required
7
7
  ## Quick Start
8
8
 
9
9
  ```bash
10
- npm create dalila my-app
10
+ npm create dalila@latest my-app
11
11
  cd my-app
12
12
  npm install
13
13
  npm run dev
@@ -58,12 +58,14 @@ bind(document.getElementById('app')!, ctx);
58
58
 
59
59
  ### Runtime
60
60
 
61
- - [Template Binding](./docs/runtime/bind.md) — `bind()`, text interpolation, events
61
+ - [Template Binding](./docs/runtime/bind.md) — `bind()`, `mount()`, `configure()`, text interpolation, events
62
+ - [Components](./docs/runtime/component.md) — `defineComponent`, typed props/emits/refs, slots
62
63
  - [FOUC Prevention](./docs/runtime/fouc-prevention.md) — Automatic token hiding
63
64
 
64
65
  ### Routing
65
66
 
66
67
  - [Router](./docs/router.md) — Client-side routing with nested layouts, preloading, and file-based route generation
68
+ - [Template Check CLI](./docs/cli/check.md) — `dalila check` static analysis for template/context consistency
67
69
 
68
70
  ### UI Components
69
71
 
@@ -106,7 +108,7 @@ Firefox extension workflows:
106
108
 
107
109
  ```
108
110
  dalila → signal, computed, effect, batch, ...
109
- dalila/runtime → bind() for HTML templates
111
+ dalila/runtime → bind(), mount(), configure(), defineComponent()
110
112
  dalila/context → createContext, provide, inject
111
113
  dalila/http → createHttpClient with XSRF protection
112
114
  ```
@@ -129,10 +131,13 @@ count.set(5); // logs: Count is 5
129
131
  ### Template Binding
130
132
 
131
133
  ```ts
132
- import { bind } from 'dalila/runtime';
134
+ import { configure, mount } from 'dalila/runtime';
135
+
136
+ // Global component registry and options
137
+ configure({ components: [MyComponent] });
133
138
 
134
- // Binds {tokens}, d-on-*, d-when, d-match to the DOM
135
- const dispose = bind(rootElement, ctx);
139
+ // Bind a selector to a reactive view-model
140
+ const dispose = mount('.app', { count: signal(0) });
136
141
 
137
142
  // Cleanup when done
138
143
  dispose();
@@ -214,7 +219,7 @@ src/app/
214
219
  ```
215
220
 
216
221
  ```bash
217
- dalila routes generate
222
+ npx dalila routes generate
218
223
  ```
219
224
 
220
225
  ```ts
@@ -278,39 +283,46 @@ async function handleSubmit(data, { signal }) {
278
283
 
279
284
  ```ts
280
285
  // page.ts
281
- import { signal } from 'dalila';
286
+ import { computed, signal } from 'dalila';
282
287
  import { createDialog, mountUI } from 'dalila/components/ui';
283
288
 
284
- const dialog = createDialog();
289
+ class HomePageVM {
290
+ count = signal(0);
291
+ status = computed(() => `Count: ${this.count()}`);
292
+ dialog = createDialog({ closeOnBackdrop: true, closeOnEscape: true });
293
+ increment = () => this.count.update(n => n + 1);
294
+ openModal = () => this.dialog.show();
295
+ closeModal = () => this.dialog.close();
296
+ }
285
297
 
286
298
  export function loader() {
287
- const count = signal(0);
288
-
289
- return {
290
- count,
291
- increment: () => count.update(n => n + 1),
292
- openDialog: () => dialog.show(),
293
- };
299
+ return new HomePageVM();
294
300
  }
295
301
 
296
302
  // Called after view is mounted
297
- export function onMount(root: HTMLElement) {
298
- mountUI(root, {
299
- dialogs: { dialog }
303
+ export function onMount(root: HTMLElement, data: HomePageVM) {
304
+ return mountUI(root, {
305
+ dialogs: { dialog: data.dialog },
306
+ events: []
300
307
  });
301
308
  }
309
+
310
+ // Optional extra hook on route leave
311
+ export function onUnmount(_root: HTMLElement) {}
302
312
  ```
303
313
 
304
314
  ```html
305
315
  <!-- page.html -->
306
- <d-button d-on-click="openDialog">Open Dialog</d-button>
316
+ <d-button d-on-click="increment">Increment</d-button>
317
+ <d-button d-on-click="openModal">Open Dialog</d-button>
307
318
 
308
319
  <d-dialog d-ui="dialog">
309
320
  <d-dialog-header>
310
- <d-dialog-title>Count: {count}</d-dialog-title>
321
+ <d-dialog-title>{status}</d-dialog-title>
322
+ <d-dialog-close d-on-click="closeModal">&times;</d-dialog-close>
311
323
  </d-dialog-header>
312
324
  <d-dialog-body>
313
- <d-button d-on-click="increment">Increment</d-button>
325
+ <p>Modal controlled by the official route + UI pattern.</p>
314
326
  </d-dialog-body>
315
327
  </d-dialog>
316
328
  ```
@@ -0,0 +1,3 @@
1
+ export declare function runCheck(appDir: string, options?: {
2
+ strict?: boolean;
3
+ }): Promise<number>;