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 +35 -23
- package/dist/cli/check.d.ts +3 -0
- package/dist/cli/check.js +902 -0
- package/dist/cli/index.js +53 -11
- package/dist/cli/routes-generator.d.ts +25 -0
- package/dist/cli/routes-generator.js +28 -7
- package/dist/router/route-tables.d.ts +28 -7
- package/dist/router/route-tables.js +19 -0
- package/dist/router/router.js +87 -3
- package/dist/routes.generated.d.ts +2 -0
- package/dist/routes.generated.js +76 -0
- package/dist/routes.generated.manifest.d.ts +4 -0
- package/dist/routes.generated.manifest.js +32 -0
- package/dist/routes.generated.types.d.ts +11 -0
- package/dist/routes.generated.types.js +37 -0
- package/dist/runtime/bind.d.ts +47 -2
- package/dist/runtime/bind.js +702 -26
- package/dist/runtime/component.d.ts +74 -0
- package/dist/runtime/component.js +40 -0
- package/dist/runtime/fromHtml.d.ts +3 -2
- package/dist/runtime/fromHtml.js +0 -15
- package/dist/runtime/index.d.ts +4 -2
- package/dist/runtime/index.js +2 -1
- package/package.json +2 -2
- package/scripts/dev-server.cjs +47 -7
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()
|
|
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 {
|
|
134
|
+
import { configure, mount } from 'dalila/runtime';
|
|
135
|
+
|
|
136
|
+
// Global component registry and options
|
|
137
|
+
configure({ components: [MyComponent] });
|
|
133
138
|
|
|
134
|
-
//
|
|
135
|
-
const dispose =
|
|
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
|
-
|
|
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
|
-
|
|
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="
|
|
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>
|
|
321
|
+
<d-dialog-title>{status}</d-dialog-title>
|
|
322
|
+
<d-dialog-close d-on-click="closeModal">×</d-dialog-close>
|
|
311
323
|
</d-dialog-header>
|
|
312
324
|
<d-dialog-body>
|
|
313
|
-
<
|
|
325
|
+
<p>Modal controlled by the official route + UI pattern.</p>
|
|
314
326
|
</d-dialog-body>
|
|
315
327
|
</d-dialog>
|
|
316
328
|
```
|