@madojs/mado 0.10.1 → 0.11.1

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 (219) hide show
  1. package/AGENTS.md +24 -26
  2. package/CHANGELOG.md +95 -0
  3. package/README.md +22 -47
  4. package/TODO.md +52 -48
  5. package/dist/src/component.d.ts +2 -1
  6. package/dist/src/component.js +5 -2
  7. package/dist/src/component.js.map +1 -1
  8. package/dist/src/each.d.ts +1 -1
  9. package/dist/src/each.js +1 -1
  10. package/dist/src/each.js.map +1 -1
  11. package/dist/src/html/bindings.js +3 -3
  12. package/dist/src/html/bindings.js.map +1 -1
  13. package/dist/src/index.d.ts +11 -6
  14. package/dist/src/index.js +5 -3
  15. package/dist/src/index.js.map +1 -1
  16. package/dist/src/lazy.d.ts +1 -1
  17. package/dist/src/lazy.js +1 -1
  18. package/dist/src/lazy.js.map +1 -1
  19. package/dist/src/page.d.ts +17 -21
  20. package/dist/src/page.js +7 -12
  21. package/dist/src/page.js.map +1 -1
  22. package/dist/src/router/manifest.d.ts +1 -1
  23. package/dist/src/router/manifest.js +21 -13
  24. package/dist/src/router/manifest.js.map +1 -1
  25. package/dist/src/router/match.d.ts +2 -2
  26. package/dist/src/router/match.js +3 -3
  27. package/dist/src/router/match.js.map +1 -1
  28. package/dist/src/router/navigation.js +1 -1
  29. package/dist/src/router/navigation.js.map +1 -1
  30. package/dist/src/vite/index.d.ts +10 -0
  31. package/dist/src/vite/index.js +33 -0
  32. package/dist/src/vite/index.js.map +1 -0
  33. package/docs/en/00-the-mado-way.md +25 -12
  34. package/docs/en/01-routing.md +90 -142
  35. package/docs/en/02-project-layout.md +59 -53
  36. package/docs/en/03-static-bake.md +5 -6
  37. package/docs/en/05-why-mado.md +6 -6
  38. package/docs/en/06-for-backenders.md +18 -22
  39. package/docs/en/08-llm-zero-history-test.md +9 -14
  40. package/docs/en/09-shadow-vs-light-dom.md +28 -36
  41. package/docs/en/10-app-architecture.md +158 -96
  42. package/docs/en/11-layouts.md +22 -24
  43. package/docs/en/12-auth-and-api.md +89 -182
  44. package/docs/en/13-deployment.md +18 -22
  45. package/docs/en/14-testing.md +4 -4
  46. package/docs/en/16-bake-cookbook.md +11 -12
  47. package/docs/en/18-api-freeze-map.md +6 -4
  48. package/docs/en/20-v1-stability.md +1 -1
  49. package/docs/fr/00-the-mado-way.md +55 -90
  50. package/docs/fr/01-routing.md +70 -152
  51. package/docs/fr/02-project-layout.md +61 -42
  52. package/docs/fr/03-static-bake.md +1 -1
  53. package/docs/fr/05-why-mado.md +6 -6
  54. package/docs/fr/06-for-backenders.md +7 -7
  55. package/docs/fr/08-llm-zero-history-test.md +21 -48
  56. package/docs/fr/09-shadow-vs-light-dom.md +43 -162
  57. package/docs/fr/10-app-architecture.md +110 -33
  58. package/docs/fr/11-layouts.md +24 -12
  59. package/docs/fr/12-auth-and-api.md +63 -22
  60. package/docs/fr/13-deployment.md +7 -10
  61. package/docs/fr/14-testing.md +1 -1
  62. package/docs/fr/16-bake-cookbook.md +2 -2
  63. package/docs/fr/18-api-freeze-map.md +1 -1
  64. package/docs/fr/20-v1-stability.md +1 -1
  65. package/docs/recipes/nginx/README.md +13 -0
  66. package/docs/ru/00-the-mado-way.md +53 -75
  67. package/docs/ru/01-routing.md +68 -143
  68. package/docs/ru/02-project-layout.md +61 -41
  69. package/docs/ru/03-static-bake.md +2 -2
  70. package/docs/ru/05-why-mado.md +6 -6
  71. package/docs/ru/06-for-backenders.md +7 -7
  72. package/docs/ru/08-llm-zero-history-test.md +9 -14
  73. package/docs/ru/09-shadow-vs-light-dom.md +43 -178
  74. package/docs/ru/10-app-architecture.md +115 -63
  75. package/docs/ru/11-layouts.md +24 -24
  76. package/docs/ru/12-auth-and-api.md +57 -35
  77. package/docs/ru/13-deployment.md +7 -11
  78. package/docs/ru/14-testing.md +1 -1
  79. package/docs/ru/16-bake-cookbook.md +12 -6
  80. package/docs/ru/18-api-freeze-map.md +5 -3
  81. package/docs/ru/20-v1-stability.md +1 -1
  82. package/docs/uk/00-the-mado-way.md +70 -44
  83. package/docs/uk/01-routing.md +41 -47
  84. package/docs/uk/02-project-layout.md +68 -41
  85. package/docs/uk/03-static-bake.md +1 -2
  86. package/docs/uk/06-for-backenders.md +3 -3
  87. package/docs/uk/08-llm-zero-history-test.md +22 -24
  88. package/docs/uk/09-shadow-vs-light-dom.md +37 -86
  89. package/docs/uk/10-app-architecture.md +72 -31
  90. package/docs/uk/11-layouts.md +25 -12
  91. package/docs/uk/12-auth-and-api.md +58 -22
  92. package/docs/uk/13-deployment.md +4 -3
  93. package/docs/uk/14-testing.md +1 -1
  94. package/docs/uk/18-api-freeze-map.md +1 -1
  95. package/docs/uk/20-v1-stability.md +1 -1
  96. package/llms.txt +14 -15
  97. package/package.json +18 -11
  98. package/scripts/_config.mjs +15 -161
  99. package/scripts/bake.mjs +74 -63
  100. package/scripts/cli/generate.mjs +348 -0
  101. package/scripts/cli/help.mjs +27 -0
  102. package/scripts/cli/index.mjs +79 -0
  103. package/scripts/cli/init.mjs +153 -0
  104. package/scripts/cli/release.mjs +152 -0
  105. package/scripts/cli/run.mjs +96 -0
  106. package/scripts/cli.mjs +2 -621
  107. package/scripts/package-smoke.mjs +4 -1
  108. package/scripts/preview.mjs +13 -37
  109. package/scripts/size-budget.mjs +5 -2
  110. package/scripts/vite.default.mjs +11 -0
  111. package/starters/default/.editorconfig +12 -0
  112. package/starters/default/README.md +74 -0
  113. package/starters/default/eslint.config.mjs +256 -0
  114. package/starters/default/index.html +13 -0
  115. package/starters/default/package.json +30 -0
  116. package/starters/default/public/favicon.svg +4 -0
  117. package/starters/default/src/app.routes.ts +39 -0
  118. package/starters/default/src/layouts/app-shell.layout.ts +35 -0
  119. package/starters/default/src/layouts/auth-shell.layout.ts +17 -0
  120. package/starters/default/src/main.ts +16 -0
  121. package/starters/default/src/modules/auth/_contracts/auth-api.types.ts +17 -0
  122. package/starters/default/src/modules/auth/auth.connector.ts +45 -0
  123. package/starters/default/src/modules/auth/auth.guard.ts +22 -0
  124. package/starters/default/src/modules/auth/auth.public.ts +9 -0
  125. package/starters/default/src/modules/auth/auth.routes.ts +8 -0
  126. package/starters/default/src/modules/auth/auth.service.ts +71 -0
  127. package/starters/default/src/modules/auth/auth.types.ts +15 -0
  128. package/starters/default/src/modules/auth/login.page.ts +62 -0
  129. package/starters/default/src/modules/billing/_contracts/stripe.types.ts +17 -0
  130. package/starters/default/src/modules/billing/api/stripe.connector.ts +71 -0
  131. package/starters/default/src/modules/billing/billing.public.ts +5 -0
  132. package/starters/default/src/modules/billing/billing.routes.ts +9 -0
  133. package/starters/default/src/modules/billing/billing.types.ts +15 -0
  134. package/starters/default/src/modules/billing/components/invoice-status-badge.component.ts +43 -0
  135. package/starters/default/src/modules/billing/data/invoices.resource.ts +35 -0
  136. package/starters/default/src/modules/billing/pages/invoice-detail.page.ts +70 -0
  137. package/starters/default/src/modules/billing/pages/invoices-list.page.ts +73 -0
  138. package/starters/default/src/modules/home/home.page.ts +34 -0
  139. package/starters/default/src/modules/home/not-found.page.ts +11 -0
  140. package/starters/default/src/shared/http/http-client.ts +86 -0
  141. package/starters/default/src/shared/http/http-error.ts +37 -0
  142. package/starters/default/src/shared/http/interceptors.ts +59 -0
  143. package/starters/default/src/shared/lib/format-date.ts +19 -0
  144. package/starters/default/src/shared/styles/content.css +70 -0
  145. package/starters/default/src/shared/styles/reset.css +32 -0
  146. package/starters/default/src/shared/styles/shell.css +57 -0
  147. package/starters/default/src/shared/styles/tokens.css +44 -0
  148. package/starters/default/src/shared/ui/x-button.component.ts +49 -0
  149. package/starters/default/src/shared/ui/x-spinner.component.ts +22 -0
  150. package/starters/default/src/styles.d.ts +1 -0
  151. package/starters/default/src/vite-env.d.ts +1 -0
  152. package/starters/default/tsconfig.json +24 -0
  153. package/starters/default/vite.config.ts +9 -0
  154. package/MADO_V1_PLAN.md +0 -179
  155. package/ROADMAP.md +0 -178
  156. package/dist/src/html.d.ts +0 -18
  157. package/dist/src/html.js +0 -17
  158. package/dist/src/html.js.map +0 -1
  159. package/dist/src/router.d.ts +0 -13
  160. package/dist/src/router.js +0 -13
  161. package/dist/src/router.js.map +0 -1
  162. package/scripts/bundle.mjs +0 -212
  163. package/scripts/llm-zero-history-smoke.mjs +0 -93
  164. package/scripts/new.mjs +0 -80
  165. package/scripts/showcase-regression.mjs +0 -392
  166. package/server/serve.mjs +0 -455
  167. package/starters/admin/README.md +0 -63
  168. package/starters/admin/index.html +0 -28
  169. package/starters/admin/mado.config.json +0 -22
  170. package/starters/admin/package.json +0 -24
  171. package/starters/admin/public/favicon.svg +0 -4
  172. package/starters/admin/src/components/x-button.ts +0 -82
  173. package/starters/admin/src/components/x-input.ts +0 -105
  174. package/starters/admin/src/layouts/app.ts +0 -101
  175. package/starters/admin/src/layouts/auth.ts +0 -41
  176. package/starters/admin/src/lib/api.ts +0 -184
  177. package/starters/admin/src/lib/auth.ts +0 -83
  178. package/starters/admin/src/main.ts +0 -15
  179. package/starters/admin/src/pages/admin/dashboard.ts +0 -48
  180. package/starters/admin/src/pages/admin/order-detail.ts +0 -80
  181. package/starters/admin/src/pages/admin/orders.ts +0 -117
  182. package/starters/admin/src/pages/home.ts +0 -34
  183. package/starters/admin/src/pages/login.ts +0 -70
  184. package/starters/admin/src/pages/not-found.ts +0 -12
  185. package/starters/admin/src/routes.ts +0 -40
  186. package/starters/admin/src/styles/global.ts +0 -86
  187. package/starters/admin/tsconfig.json +0 -15
  188. package/starters/crud/README.md +0 -33
  189. package/starters/crud/index.html +0 -28
  190. package/starters/crud/mado.config.json +0 -20
  191. package/starters/crud/package.json +0 -24
  192. package/starters/crud/src/components/app-shell.ts +0 -56
  193. package/starters/crud/src/components/ticket-detail.ts +0 -33
  194. package/starters/crud/src/components/ticket-form.ts +0 -69
  195. package/starters/crud/src/components/ticket-list.ts +0 -66
  196. package/starters/crud/src/lib/api.ts +0 -76
  197. package/starters/crud/src/main.ts +0 -9
  198. package/starters/crud/src/pages/home.ts +0 -34
  199. package/starters/crud/src/pages/not-found.ts +0 -12
  200. package/starters/crud/src/pages/ticket-detail.ts +0 -7
  201. package/starters/crud/src/pages/ticket-new.ts +0 -7
  202. package/starters/crud/src/pages/tickets.ts +0 -7
  203. package/starters/crud/src/routes.ts +0 -11
  204. package/starters/crud/src/styles/global.ts +0 -155
  205. package/starters/crud/tsconfig.json +0 -15
  206. package/starters/minimal/README.md +0 -21
  207. package/starters/minimal/index.html +0 -28
  208. package/starters/minimal/mado.config.json +0 -20
  209. package/starters/minimal/package.json +0 -24
  210. package/starters/minimal/src/components/app-counter.ts +0 -31
  211. package/starters/minimal/src/main.ts +0 -9
  212. package/starters/minimal/src/pages/home.ts +0 -35
  213. package/starters/minimal/src/pages/not-found.ts +0 -14
  214. package/starters/minimal/src/routes.ts +0 -8
  215. package/starters/minimal/src/styles/global.ts +0 -60
  216. package/starters/minimal/tsconfig.json +0 -15
  217. package/templates/page-detail.ts +0 -63
  218. package/templates/page-form.ts +0 -94
  219. package/templates/page-list.ts +0 -79
@@ -1,56 +1,97 @@
1
1
  # Архітектура застосунку
2
2
 
3
- Production-застосунок на Mado має бути простим: один manifest маршрутів, один
4
- shell, один API-клієнт, один auth-модуль і сторінки, які імпортують власні
5
- компоненти.
3
+ Офіційний starter канонічна production-форма Mado-застосунку. Це не
4
+ framework всередині framework: лише files, imports, Mado primitives та ESLint
5
+ boundaries.
6
6
 
7
7
  ```txt
8
8
  src/
9
9
  ├── main.ts
10
- ├── routes.ts
10
+ ├── app.routes.ts
11
11
  ├── layouts/
12
- ├── pages/
13
- ├── components/
14
- ├── lib/
15
- └── styles/
12
+ ├── app-shell.layout.ts
13
+ │ └── auth-shell.layout.ts
14
+ ├── shared/
15
+ │ ├── http/
16
+ │ ├── lib/
17
+ │ ├── styles/
18
+ │ └── ui/
19
+ └── modules/
20
+ ├── auth/
21
+ │ ├── auth.routes.ts
22
+ │ ├── auth.public.ts
23
+ │ ├── auth.service.ts
24
+ │ ├── auth.connector.ts
25
+ │ ├── auth.guard.ts
26
+ │ ├── login.page.ts
27
+ │ └── _contracts/
28
+ └── billing/
29
+ ├── billing.routes.ts
30
+ ├── billing.public.ts
31
+ ├── billing.types.ts
32
+ ├── api/
33
+ ├── data/
34
+ ├── pages/
35
+ ├── components/
36
+ └── _contracts/
16
37
  ```
17
38
 
18
- `lib/` бізнес-логіка, `layouts/` обгортки груп маршрутів, `components/`
19
- повторні UI-теги, `pages/` один файл на сторінку.
20
-
21
- ```ts
22
- import { html, render } from "@madojs/mado";
23
- import "./styles/global.js";
24
- import routesApi from "./routes.js";
25
-
26
- render(html`${routesApi.view}`, document.getElementById("app")!);
27
- ```
28
-
29
- Feature-компоненти імпортує сторінка, яка їх рендерить.
39
+ `src/app.routes.ts` is the app map. Modules export plain route maps; app routes
40
+ decide which shell and guard wrap each zone.
30
41
 
31
42
  ```ts
32
43
  import { layout, routes } from "@madojs/mado";
33
- import { requireAuth } from "./lib/auth.js";
44
+ import { requireAuth } from "./modules/auth/auth.public";
45
+ import { authRoutes } from "./modules/auth/auth.routes";
46
+ import { billingRoutes } from "./modules/billing/billing.routes";
34
47
 
35
48
  export const manifest = {
36
- "/": () => import("./pages/home.js"),
37
- "/admin": layout({
38
- layout: () => import("./layouts/app.js"),
49
+ "/": () => import("./modules/home/home.page"),
50
+ "/login": layout({
51
+ layout: () => import("./layouts/auth-shell.layout"),
52
+ routes: authRoutes,
53
+ }),
54
+ "/billing": layout({
55
+ layout: () => import("./layouts/app-shell.layout"),
39
56
  guard: requireAuth,
40
- routes: { "/": () => import("./pages/admin/dashboard.js") },
57
+ routes: billingRoutes,
41
58
  }),
42
- "*": () => import("./pages/not-found.js"),
59
+ "*": () => import("./modules/home/not-found.page"),
43
60
  };
44
61
 
45
62
  export default routes(manifest);
46
63
  ```
47
64
 
48
- `manifest` потрібен для `mado bake`. Для читання використовуй `resource()`, для
49
- запису `mutation(..., { invalidates })`, для форм `useForm()`.
65
+ Page-local signals, resources and forms live inside `view()`. Module-wide state
66
+ lives in `*.service.ts`.
67
+
68
+ ## Styles
69
+
70
+ | File | Role |
71
+ | --- | --- |
72
+ | `src/shared/styles/tokens.css` | design tokens as CSS custom properties |
73
+ | `src/shared/styles/reset.css` | document/light DOM reset |
74
+ | `src/shared/styles/shell.css` | app-zone layouts from `src/layouts/` |
75
+ | `src/shared/styles/content.css` | page-level forms, tables, prose and states |
76
+
77
+ Leaf components keep their own styles in ``css`...` `` inside `component()`
78
+ options and depend on tokens, not global classes.
79
+
80
+ `vite.config.ts` uses Vite's Lightning CSS transformer. Mado does not own
81
+ prefixing, CSS lowering or minification.
82
+
83
+ ## CLI
50
84
 
51
85
  ```bash
52
- mado dev
53
- mado release
86
+ mado new module billing
87
+ mado new page billing/pages/invoices-list
88
+ mado new connector billing/api/stripe
89
+ mado new resource billing/data/invoices
90
+ mado new service billing/cart
91
+ mado new form billing/invoice
92
+ mado new component billing/components/invoice-status-badge
93
+ mado new guard billing/billing
94
+ mado new layout app-shell
54
95
  ```
55
96
 
56
- Деплоїться `out/`, а не `dist/`.
97
+ The generator writes files only and does not edit `app.routes.ts`.
@@ -1,34 +1,47 @@
1
1
  # Layouts
2
2
 
3
- Рекомендований спосіб layout у Mado вкладена група маршрутів у `routes.ts`.
3
+ The blessed layout recipe in Mado is a route group in `src/app.routes.ts`.
4
+ Do not put a single global shell in `main.ts` when the app has multiple zones:
5
+ public, auth, app, embed.
4
6
 
5
7
  ```ts
6
8
  import { layout, routes } from "@madojs/mado";
7
- import { requireAuth } from "./lib/auth.js";
9
+ import { requireAuth } from "./modules/auth/auth.public";
10
+ import { authRoutes } from "./modules/auth/auth.routes";
11
+ import { billingRoutes } from "./modules/billing/billing.routes";
8
12
 
9
13
  export const manifest = {
10
- "/": () => import("./pages/home.js"),
14
+ "/": () => import("./modules/home/home.page.js"),
11
15
  "/login": layout({
12
- layout: () => import("./layouts/auth.js"),
13
- routes: { "/": () => import("./pages/login.js") },
16
+ layout: () => import("./layouts/auth-shell.layout.js"),
17
+ routes: authRoutes,
14
18
  }),
15
- "/admin": layout({
16
- layout: () => import("./layouts/app.js"),
19
+ "/billing": layout({
20
+ layout: () => import("./layouts/app-shell.layout.js"),
17
21
  guard: requireAuth,
18
- routes: { "/": () => import("./pages/admin/dashboard.js") },
22
+ routes: billingRoutes,
19
23
  }),
24
+ "*": () => import("./modules/home/not-found.page.js"),
20
25
  };
21
26
 
22
27
  export default routes(manifest);
23
28
  ```
24
29
 
25
- Layout це `page({ view })`, яка рендерить `child`:
30
+ A layout is a normal `page({ view })` that renders `child`:
26
31
 
27
32
  ```ts
28
33
  export default page({
29
- view: ({ child }) => html`<x-app-shell>${child}</x-app-shell>`,
34
+ view: ({ child }) => html`
35
+ <div class="layout layout--app">
36
+ <main class="app-main">${child}</main>
37
+ </div>
38
+ `,
30
39
  });
31
40
  ```
32
41
 
33
- Один shell на групу, не на кожну сторінку. Guard на групі захищає все
34
- піддерево.
42
+ Rules:
43
+
44
+ - one shell per route group, not per page;
45
+ - modules export plain route maps and do not call `layout()`;
46
+ - guard on a group protects the whole subtree;
47
+ - layout view stays stateless; page-local state lives in pages/components/resources.
@@ -1,34 +1,70 @@
1
- # Auth та API
1
+ # Auth and API
2
2
 
3
- Starter `admin` містить рекомендований рецепт:
3
+ The default starter is the blessed recipe. HTTP mechanics live in
4
+ `src/shared/http/`, auth state lives in `src/modules/auth/`.
4
5
 
5
- - `src/lib/api.ts` — один HTTP-клієнт, `ApiError`, refresh після 401;
6
- - `src/lib/auth.ts` — `accessToken`, `restoreSession()`, `login()`,
7
- `logout()`, `requireAuth`.
6
+ ```txt
7
+ src/shared/http/
8
+ http-client.ts
9
+ http-error.ts
10
+ interceptors.ts
8
11
 
9
- Модель:
12
+ src/modules/auth/
13
+ auth.connector.ts
14
+ auth.service.ts
15
+ auth.guard.ts
16
+ auth.routes.ts
17
+ auth.public.ts
18
+ _contracts/
19
+ ```
20
+
21
+ Business module flow:
22
+
23
+ ```txt
24
+ connector -> resource/mutation -> page
25
+ ```
10
26
 
11
- - access token у пам'яті через `signal`, не в `localStorage`;
12
- - HttpOnly refresh cookie відновлює сесію;
13
- - усі запити проходять через API-клієнт;
14
- - захищені routes використовують group guard.
27
+ Pages do not import DTOs and do not call `fetch()` directly. Connectors do not
28
+ import Mado reactivity or UI.
29
+
30
+ ## Auth Service
15
31
 
16
32
  ```ts
17
- export const requireAuth: Guard = async ({ path }) => {
18
- if (accessToken()) return;
19
- if (await restoreSession()) return;
20
- return { redirect: `/login?return=${encodeURIComponent(path)}`, replace: true };
21
- };
33
+ const _user = signal<User | null>(null);
34
+ const _token = signal<string | null>(null);
35
+
36
+ export const user = () => _user();
37
+ export const isAuthed = computed(() => _user() !== null);
22
38
  ```
23
39
 
24
- Dev proxy:
40
+ Expose only what other modules need through `auth.public.ts`.
25
41
 
26
- ```jsonc
27
- {
28
- "dev": {
29
- "proxy": { "/api": "http://localhost:3000" }
30
- }
42
+ ## Guards
43
+
44
+ ```ts
45
+ export function requireAuth(): boolean | string {
46
+ if (isAuthed()) return true;
47
+ return "/login";
31
48
  }
32
49
  ```
33
50
 
34
- Якщо backend має іншу auth-схему, змінюй `api.ts`/`auth.ts`, а не сторінки.
51
+ Use in `src/app.routes.ts`:
52
+
53
+ ```ts
54
+ "/billing": layout({
55
+ layout: () => import("./layouts/app-shell.layout"),
56
+ guard: requireAuth,
57
+ routes: billingRoutes,
58
+ }),
59
+ ```
60
+
61
+ ## Dev Proxy
62
+
63
+ ```ts
64
+ export default defineConfig({
65
+ plugins: [mado()],
66
+ server: {
67
+ proxy: { "/api": "http://localhost:3000" },
68
+ },
69
+ });
70
+ ```
@@ -12,7 +12,8 @@ mado release
12
12
  out/
13
13
  ├── index.html
14
14
  ├── assets/
15
- ├── baked/
15
+ ├── <route>/index.html
16
+ ├── sitemap.xml
16
17
  ├── _redirects
17
18
  └── _headers
18
19
  ```
@@ -35,5 +36,5 @@ mado release
35
36
  rsync -avz --delete out/ user@server:/var/www/myapp/
36
37
  ```
37
38
 
38
- Наданий `nginx.conf` налаштовує immutable cache для hash bundles, no-cache для
39
- HTML та fallback для deep links.
39
+ Опційний nginx recipe живе в `docs/recipes/nginx/`: immutable cache для
40
+ `/assets/*`, no-cache для HTML та fallback для deep links.
@@ -20,7 +20,7 @@ const { window } = parseHTML("<!doctype html><html><body></body></html>");
20
20
  globalThis.window = window;
21
21
  globalThis.document = window.document;
22
22
 
23
- const { html, render } = await import("../dist/src/html.js");
23
+ const { html, render } = await import("../dist/src/html/template.js");
24
24
 
25
25
  test("renders", () => {
26
26
  const root = document.createElement("div");
@@ -27,7 +27,7 @@ import "@madojs/mado/devtools.js";
27
27
  - Templates і directives: `html`, `render`, `each`, `list`, `unsafeHTML`,
28
28
  `ref`, `classMap`, `styleMap`.
29
29
  - Components і CSS: `component`, `css`, `cssVars`.
30
- - Routing і pages: `routes`, `router`, `page`, `layout`, `nested`,
30
+ - Routing і pages: `routes`, `router`, `page`, `layout`,
31
31
  `navigate`, `queryParam`, `prefetchPath`.
32
32
  - Data: `resource`, `mutation`, `invalidate`, `jsonFetcher`, `HttpError`.
33
33
  - Forms: `useForm`.
@@ -25,7 +25,7 @@ starter copy або diagnostic string заморожені назавжди.
25
25
  deferred teardown для same-tick moves, cleanup через `ctx.onDispose`.
26
26
  - Router/page/resource/form contracts, описані в English docs.
27
27
  - Імена CLI commands і широкий сенс команд (`build`, `dev`, `release`, `bake`,
28
- `bundle`, `preview`, `init`, `new`).
28
+ `preview`, `init`, `new`).
29
29
 
30
30
  Ламати це можна тільки в major version.
31
31
 
package/llms.txt CHANGED
@@ -79,7 +79,7 @@ import {
79
79
  component,
80
80
  css, cssVars,
81
81
  routes, router, navigate, queryParam, prefetchPath,
82
- page, nested,
82
+ page, layout,
83
83
  resource, mutation, invalidate, jsonFetcher,
84
84
  useForm,
85
85
  createContext, provide, inject,
@@ -147,8 +147,9 @@ Use `jsonFetcher()` for public endpoints, `apiFetcher()` for anything behind aut
147
147
 
148
148
  ## Layouts and bake
149
149
 
150
- Use `layout()` in `routes.ts` for shared shells. A layout view should be a pure
151
- wrapper around `${child}` and shared chrome:
150
+ Use `layout()` in `src/app.routes.ts` for shared shells. Modules export plain
151
+ route maps; app routes decide which layout and guard wrap each zone. A layout
152
+ view should be a pure wrapper around `${child}` and shared chrome:
152
153
 
153
154
  ```ts
154
155
  export default page({
@@ -169,17 +170,18 @@ relative `fetch`, and runtime directives like keyed `each()` during bake.
169
170
  ```ts
170
171
  // src/main.ts
171
172
  import { html, render } from "@madojs/mado";
172
- import routesApi from "./routes.js";
173
+ import routesApi from "./app.routes.js";
173
174
  render(html`${routesApi.view}`, document.getElementById("app")!);
174
175
 
175
- // src/routes.ts
176
+ // src/app.routes.ts
176
177
  import { routes } from "@madojs/mado";
177
- export default routes({
178
- "/": () => import("./pages/home.js"),
179
- "*": () => import("./pages/not-found.js"),
180
- });
178
+ export const manifest = {
179
+ "/": () => import("./modules/home/home.page.js"),
180
+ "*": () => import("./modules/home/not-found.page.js"),
181
+ };
182
+ export default routes(manifest);
181
183
 
182
- // src/pages/home.ts
184
+ // src/modules/home/home.page.ts
183
185
  import { page, component, html, css, signal } from "@madojs/mado";
184
186
 
185
187
  component("x-counter", () => {
@@ -254,10 +256,7 @@ export default page({
254
256
  - docs/en/18-api-freeze-map.md — stable public API vs internal implementation details
255
257
  - docs/en/19-reactivity-ordering.md — signal ordering, batching and teardown guarantees
256
258
  - docs/en/20-v1-stability.md — v1 SemVer contract and what remains internal
257
- - examples/basic/ — minimal API tour
258
- - examples/tickets/ — LLM zero-history CRUD validation
259
- - examples/showcase/ — flagship CRM pressure app (auth, nested routes, forms, mutations)
260
- - examples/cloudflare/ — Edge prerender PoC on Cloudflare Workers
259
+ - starters/default/ — canonical generated app shape
261
260
 
262
261
  ## What Mado does NOT do (intentionally)
263
262
 
@@ -265,7 +264,7 @@ export default page({
265
264
  - ❌ Virtual DOM → fine-grained signal updates
266
265
  - ❌ SSR with hydration → `bake` static meta-shell or edge-prerender for SEO
267
266
  - ❌ Hooks and rules of hooks → signals
268
- - ❌ Mandatory Webpack/Viteonly `tsc`
267
+ - ❌ Runtime framework dependencies generated apps use Vite as dev/build tooling
269
268
  - ❌ React-Router / TanStack → built-in 500-line `routes()`
270
269
  - ❌ React-Query / SWR → built-in `resource()`
271
270
  - ❌ Formik / RHF → built-in `useForm()` (HTML5 validation)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madojs/mado",
3
- "version": "0.10.1",
3
+ "version": "0.11.1",
4
4
  "description": "Mado — a calm browser-native SPA framework for internal tools, admin panels and business apps. Routing, forms, state and data fetching without frontend infrastructure overhead.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -11,7 +11,7 @@
11
11
  "signals",
12
12
  "tagged-templates",
13
13
  "router",
14
- "no-build",
14
+ "vite",
15
15
  "tsc",
16
16
  "minimal",
17
17
  "lit-alternative",
@@ -39,19 +39,20 @@
39
39
  "./devtools.js": {
40
40
  "types": "./dist/src/devtools.d.ts",
41
41
  "import": "./dist/src/devtools.js"
42
+ },
43
+ "./vite": {
44
+ "types": "./dist/src/vite/index.d.ts",
45
+ "import": "./dist/src/vite/index.js"
42
46
  }
43
47
  },
44
48
  "files": [
45
49
  "dist/src",
46
50
  "scripts",
47
- "server",
48
51
  "templates",
49
52
  "starters",
50
53
  "README.md",
51
54
  "LICENSE",
52
55
  "CHANGELOG.md",
53
- "MADO_V1_PLAN.md",
54
- "ROADMAP.md",
55
56
  "TODO.md",
56
57
  "AGENTS.md",
57
58
  "llms.txt",
@@ -60,27 +61,33 @@
60
61
  "scripts": {
61
62
  "build": "node scripts/cli.mjs build",
62
63
  "watch": "node scripts/cli.mjs watch",
63
- "serve": "node scripts/cli.mjs serve",
64
64
  "dev": "node scripts/cli.mjs dev",
65
- "bundle": "node scripts/cli.mjs bundle",
66
65
  "bake": "node scripts/cli.mjs bake",
67
66
  "preview": "node scripts/cli.mjs preview",
68
- "test:browser": "node scripts/cli.mjs test browser",
69
67
  "new": "node scripts/cli.mjs new",
70
- "examples": "node scripts/cli.mjs examples",
71
68
  "size": "node scripts/size-budget.mjs",
72
69
  "package:smoke": "node scripts/package-smoke.mjs",
73
- "llm:smoke": "node scripts/llm-zero-history-smoke.mjs",
74
70
  "test": "node scripts/cli.mjs test",
75
71
  "typecheck": "node scripts/cli.mjs typecheck",
76
72
  "clean": "rm -rf dist out",
77
73
  "prepublishOnly": "npm run clean && npm run build && npm test"
78
74
  },
79
75
  "devDependencies": {
76
+ "@types/node": "^20.19.0",
80
77
  "esbuild": "^0.28.0",
78
+ "lightningcss": "^1.32.0",
81
79
  "linkedom": "^0.18.12",
82
80
  "playwright-core": "^1.47.0",
83
- "typescript": "^6.0.3"
81
+ "typescript": "^6.0.3",
82
+ "vite": "^8.0.16"
83
+ },
84
+ "peerDependencies": {
85
+ "vite": "^8.0.0"
86
+ },
87
+ "peerDependenciesMeta": {
88
+ "vite": {
89
+ "optional": true
90
+ }
84
91
  },
85
92
  "engines": {
86
93
  "node": ">=20"