create-foldkit-app 0.31.1 → 0.32.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 (77) hide show
  1. package/dist/templates/base/FOLDKIT.md +1 -1
  2. package/dist/templates/examples/api-cache/package.json +7 -7
  3. package/dist/templates/examples/auth/package.json +7 -7
  4. package/dist/templates/examples/auth/src/page/loggedOut/page/login.ts +28 -35
  5. package/dist/templates/examples/auth/src/update.ts +10 -13
  6. package/dist/templates/examples/canvas-art/package.json +7 -7
  7. package/dist/templates/examples/charting/package.json +7 -7
  8. package/dist/templates/examples/charting/src/view/chart.ts +43 -45
  9. package/dist/templates/examples/counter/package.json +7 -7
  10. package/dist/templates/examples/counters/package.json +7 -7
  11. package/dist/templates/examples/crash-view/package.json +7 -7
  12. package/dist/templates/examples/embedding/package.json +7 -7
  13. package/dist/templates/examples/form/package.json +7 -7
  14. package/dist/templates/examples/form/src/main.ts +59 -74
  15. package/dist/templates/examples/generative-art/package.json +7 -7
  16. package/dist/templates/examples/interrupting-commands/package.json +7 -7
  17. package/dist/templates/examples/interrupting-commands/src/main.ts +6 -9
  18. package/dist/templates/examples/job-application/package.json +7 -7
  19. package/dist/templates/examples/job-application/src/view/education.ts +31 -32
  20. package/dist/templates/examples/job-application/src/view/field.ts +7 -8
  21. package/dist/templates/examples/job-application/src/view/workHistory.ts +40 -41
  22. package/dist/templates/examples/kanban/package.json +8 -8
  23. package/dist/templates/examples/managed-resource-layer/package.json +7 -7
  24. package/dist/templates/examples/managed-resource-layer/src/main.ts +10 -11
  25. package/dist/templates/examples/map/package.json +8 -8
  26. package/dist/templates/examples/map/src/main.ts +59 -63
  27. package/dist/templates/examples/map/src/vite-env.d.ts +1 -0
  28. package/dist/templates/examples/pixel-art/package.json +7 -7
  29. package/dist/templates/examples/pixel-art/src/scene.test.ts +3 -3
  30. package/dist/templates/examples/pixel-art/src/story.test.ts +3 -3
  31. package/dist/templates/examples/query-sync/package.json +7 -7
  32. package/dist/templates/examples/query-sync/src/main.ts +25 -37
  33. package/dist/templates/examples/route-transitions/package.json +7 -7
  34. package/dist/templates/examples/route-transitions/src/main.ts +24 -32
  35. package/dist/templates/examples/routing/package.json +7 -7
  36. package/dist/templates/examples/routing/src/main.ts +24 -30
  37. package/dist/templates/examples/routing/src/page/people.ts +80 -86
  38. package/dist/templates/examples/shopping-cart/package.json +7 -7
  39. package/dist/templates/examples/shopping-cart/src/main.ts +16 -22
  40. package/dist/templates/examples/slow-warnings/package.json +7 -7
  41. package/dist/templates/examples/snake/package.json +7 -7
  42. package/dist/templates/examples/ssg/package.json +6 -8
  43. package/dist/templates/examples/ssg/src/main.ts +65 -75
  44. package/dist/templates/examples/ssr/package.json +8 -9
  45. package/dist/templates/examples/state-machine/package.json +7 -7
  46. package/dist/templates/examples/state-machine/src/view.ts +50 -59
  47. package/dist/templates/examples/stopwatch/package.json +7 -7
  48. package/dist/templates/examples/todo/package.json +7 -7
  49. package/dist/templates/examples/todo/src/main.ts +29 -37
  50. package/dist/templates/examples/ui-showcase/package.json +7 -7
  51. package/dist/templates/examples/ui-showcase/src/main.ts +49 -42
  52. package/dist/templates/examples/ui-showcase/src/scene.test.ts +11 -0
  53. package/dist/templates/examples/ui-showcase/src/ui/init.ts +2 -0
  54. package/dist/templates/examples/ui-showcase/src/ui/message.ts +2 -0
  55. package/dist/templates/examples/ui-showcase/src/ui/model.ts +2 -0
  56. package/dist/templates/examples/ui-showcase/src/ui/update.ts +21 -0
  57. package/dist/templates/examples/ui-showcase/src/ui/view/hoverIntent.ts +89 -0
  58. package/dist/templates/examples/ui-showcase/src/ui/view/index.ts +1 -0
  59. package/dist/templates/examples/view-transitions/package.json +7 -7
  60. package/dist/templates/examples/view-transitions/src/main.ts +29 -40
  61. package/dist/templates/examples/weather/package.json +7 -7
  62. package/dist/templates/examples/web-components/package.json +7 -7
  63. package/dist/templates/examples/websocket-chat/package.json +7 -7
  64. package/dist/templates/examples/websocket-chat/src/main.ts +22 -32
  65. package/dist/templates/release.json +18 -18
  66. package/dist/templates/rendering/ssg/README.md +8 -7
  67. package/dist/templates/rendering/ssg/package.json +2 -2
  68. package/dist/templates/rendering/ssg/src/main.ts +61 -70
  69. package/dist/templates/rendering/ssg/tsconfig.json +1 -1
  70. package/dist/templates/rendering/ssg/vite.config.ts +22 -1
  71. package/dist/templates/rendering/ssr/README.md +10 -7
  72. package/dist/templates/rendering/ssr/package.json +2 -2
  73. package/dist/templates/rendering/ssr/vite.config.ts +22 -1
  74. package/package.json +5 -5
  75. package/dist/templates/rendering/ssg/scripts/build.mjs +0 -27
  76. package/dist/templates/rendering/ssg/scripts/prerender.ts +0 -120
  77. package/dist/templates/rendering/ssr/scripts/build.mjs +0 -23
@@ -1,4 +1,4 @@
1
- import { Effect, Match as M, Schema as S } from 'effect'
1
+ import { Effect, Schema as S } from 'effect'
2
2
  import { Command, Runtime, type Update } from 'foldkit'
3
3
  import { type Document, type Html, type HtmlBuilder } from 'foldkit/html'
4
4
  import { defineMessageUnion } from 'foldkit/message'
@@ -53,7 +53,6 @@ const LoadExternal = Command.define('LoadExternal', {
53
53
  // UPDATE
54
54
 
55
55
  type UpdateReturn = Update.Return<Model, Message>
56
- const withUpdateReturn = M.withReturnType<UpdateReturn>()
57
56
 
58
57
  export const update = (model: Model, message: Message) =>
59
58
  Message.match<UpdateReturn>(message, {
@@ -61,19 +60,16 @@ export const update = (model: Model, message: Message) =>
61
60
  model: evo(model, { count: count => count + 1 }),
62
61
  }),
63
62
  ClickedLink: ({ request }) =>
64
- M.value(request).pipe(
65
- withUpdateReturn,
66
- M.tagsExhaustive({
67
- Internal: ({ url }) => ({
68
- model,
69
- commands: [NavigateInternal({ url: urlToString(url) })],
70
- }),
71
- External: ({ href }) => ({
72
- model,
73
- commands: [LoadExternal({ href })],
74
- }),
63
+ UrlRequest.match<UpdateReturn>(request, {
64
+ Internal: ({ url }) => ({
65
+ model,
66
+ commands: [NavigateInternal({ url: urlToString(url) })],
75
67
  }),
76
- ),
68
+ External: ({ href }) => ({
69
+ model,
70
+ commands: [LoadExternal({ href })],
71
+ }),
72
+ }),
77
73
  ChangedUrl: ({ url }) => ({
78
74
  model: evo(model, { route: () => urlToAppRoute(url) }),
79
75
  }),
@@ -84,13 +80,11 @@ export const update = (model: Model, message: Message) =>
84
80
  // VIEW
85
81
 
86
82
  const routeTitle = (route: AppRoute): string =>
87
- M.value(route).pipe(
88
- M.tagsExhaustive({
89
- Home: () => 'Home | Static Generation | Foldkit',
90
- About: () => 'About | Static Generation | Foldkit',
91
- NotFound: () => 'Not Found | Static Generation | Foldkit',
92
- }),
93
- )
83
+ AppRoute.match(route, {
84
+ Home: () => 'Home | Static Generation | Foldkit',
85
+ About: () => 'About | Static Generation | Foldkit',
86
+ NotFound: () => 'Not Found | Static Generation | Foldkit',
87
+ })
94
88
 
95
89
  const navigationView = (h: HtmlBuilder<Message>): Html =>
96
90
  h.nav(
@@ -102,60 +96,56 @@ const navigationView = (h: HtmlBuilder<Message>): Html =>
102
96
  )
103
97
 
104
98
  const pageView = (model: Model, h: HtmlBuilder<Message>): Html =>
105
- M.value(model.route).pipe(
106
- M.tagsExhaustive({
107
- Home: () =>
108
- h.section(
109
- [h.Class('grid gap-4')],
110
- [
111
- h.h1(
112
- [h.Id('page-title'), h.Class('text-4xl font-bold')],
113
- ['Statically generated home'],
114
- ),
115
- h.p(
116
- [],
117
- [
118
- 'This route was rendered during the build and hydrated in place.',
119
- ],
120
- ),
121
- h.button(
122
- [
123
- h.OnClick(Message.ClickedIncrement()),
124
- h.Class('w-fit bg-black px-4 py-2 text-white'),
125
- ],
126
- [`Count: ${model.count}`],
127
- ),
128
- ],
129
- ),
130
- About: () =>
131
- h.section(
132
- [h.Class('grid gap-4')],
133
- [
134
- h.h1(
135
- [h.Id('page-title'), h.Class('text-4xl font-bold')],
136
- ['Statically generated about page'],
137
- ),
138
- h.p(
139
- [],
140
- [
141
- 'The same renderPage function produced this route in the same build.',
142
- ],
143
- ),
144
- ],
145
- ),
146
- NotFound: ({ path }) =>
147
- h.section(
148
- [h.Class('grid gap-4')],
149
- [
150
- h.h1(
151
- [h.Id('page-title'), h.Class('text-4xl font-bold')],
152
- ['Not found'],
153
- ),
154
- h.p([], [`No statically generated page exists for ${path}.`]),
155
- ],
156
- ),
157
- }),
158
- )
99
+ AppRoute.match(model.route, {
100
+ Home: () =>
101
+ h.section(
102
+ [h.Class('grid gap-4')],
103
+ [
104
+ h.h1(
105
+ [h.Id('page-title'), h.Class('text-4xl font-bold')],
106
+ ['Statically generated home'],
107
+ ),
108
+ h.p(
109
+ [],
110
+ ['This route was rendered during the build and hydrated in place.'],
111
+ ),
112
+ h.button(
113
+ [
114
+ h.OnClick(Message.ClickedIncrement()),
115
+ h.Class('w-fit bg-black px-4 py-2 text-white'),
116
+ ],
117
+ [`Count: ${model.count}`],
118
+ ),
119
+ ],
120
+ ),
121
+ About: () =>
122
+ h.section(
123
+ [h.Class('grid gap-4')],
124
+ [
125
+ h.h1(
126
+ [h.Id('page-title'), h.Class('text-4xl font-bold')],
127
+ ['Statically generated about page'],
128
+ ),
129
+ h.p(
130
+ [],
131
+ [
132
+ 'The same renderPage function produced this route in the same build.',
133
+ ],
134
+ ),
135
+ ],
136
+ ),
137
+ NotFound: ({ path }) =>
138
+ h.section(
139
+ [h.Class('grid gap-4')],
140
+ [
141
+ h.h1(
142
+ [h.Id('page-title'), h.Class('text-4xl font-bold')],
143
+ ['Not found'],
144
+ ),
145
+ h.p([], [`No statically generated page exists for ${path}.`]),
146
+ ],
147
+ ),
148
+ })
159
149
 
160
150
  export const view = (model: Model, h: HtmlBuilder<Message>): Document => ({
161
151
  title: routeTitle(model.route),
@@ -5,7 +5,7 @@
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
- "build": "node scripts/build.mjs",
8
+ "build": "vite build",
9
9
  "start": "node dist/server/main.js",
10
10
  "typecheck": "tsc --noEmit",
11
11
  "test": "vitest run"
@@ -20,14 +20,13 @@
20
20
  "devDependencies": {
21
21
  "@foldkit/devtools": "workspace:*",
22
22
  "@foldkit/vite-plugin": "workspace:*",
23
- "@tailwindcss/vite": "^4.3.1",
23
+ "@tailwindcss/vite": "^4.3.3",
24
24
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
25
- "happy-dom": "^20.10.4",
26
- "prettier": "^3.8.4",
27
- "tailwindcss": "^4.3.1",
28
- "tsx": "^4.22.4",
29
- "typescript": "^6.0.3",
30
- "vite": "^8.0.16",
31
- "vitest": "^4.1.9"
25
+ "happy-dom": "^20.11.13",
26
+ "prettier": "^3.9.6",
27
+ "tailwindcss": "^4.3.3",
28
+ "typescript": "^7.0.2",
29
+ "vite": "^8.2.2",
30
+ "vitest": "^4.1.11"
32
31
  }
33
32
  }
@@ -18,13 +18,13 @@
18
18
  "devDependencies": {
19
19
  "@foldkit/devtools": "workspace:*",
20
20
  "@foldkit/vite-plugin": "workspace:*",
21
- "@tailwindcss/vite": "^4.3.1",
21
+ "@tailwindcss/vite": "^4.3.3",
22
22
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
23
- "happy-dom": "^20.10.4",
24
- "prettier": "^3.8.4",
25
- "tailwindcss": "^4.3.1",
26
- "typescript": "^6.0.3",
27
- "vite": "^8.0.16",
28
- "vitest": "^4.1.9"
23
+ "happy-dom": "^20.11.13",
24
+ "prettier": "^3.9.6",
25
+ "tailwindcss": "^4.3.3",
26
+ "typescript": "^7.0.2",
27
+ "vite": "^8.2.2",
28
+ "vitest": "^4.1.11"
29
29
  }
30
30
  }
@@ -12,6 +12,7 @@ import {
12
12
  EditionRadioGroup,
13
13
  Message,
14
14
  type Model,
15
+ Promo,
15
16
  checkoutMachine,
16
17
  editionName,
17
18
  isReviewReady,
@@ -37,43 +38,37 @@ const cancelButtonClassName =
37
38
  'cursor-pointer text-sm font-medium text-stone-600 underline decoration-stone-400 underline-offset-4 transition-colors hover:text-orange-800 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-stone-900'
38
39
 
39
40
  const stateEyebrow = (state: typeof CheckoutState.Type): string =>
40
- M.value(state).pipe(
41
- M.tagsExhaustive({
42
- Cart: () => 'Bag',
43
- Shipping: () => 'Delivery',
44
- Payment: () => 'Payment',
45
- Review: () => 'Review',
46
- Placing: () => 'Order',
47
- Confirmed: () => 'Order',
48
- Cancelled: () => 'Checkout',
49
- }),
50
- )
41
+ CheckoutState.match(state, {
42
+ Cart: () => 'Bag',
43
+ Shipping: () => 'Delivery',
44
+ Payment: () => 'Payment',
45
+ Review: () => 'Review',
46
+ Placing: () => 'Order',
47
+ Confirmed: () => 'Order',
48
+ Cancelled: () => 'Checkout',
49
+ })
51
50
 
52
51
  const stateTitle = (state: typeof CheckoutState.Type): string =>
53
- M.value(state).pipe(
54
- M.tagsExhaustive({
55
- Cart: () => 'Your order',
56
- Shipping: () => 'Delivery details',
57
- Payment: () => 'Payment',
58
- Review: () => 'Review and place order',
59
- Placing: () => 'Processing your order',
60
- Confirmed: () => 'Thank you',
61
- Cancelled: () => 'Checkout cancelled',
62
- }),
63
- )
52
+ CheckoutState.match(state, {
53
+ Cart: () => 'Your order',
54
+ Shipping: () => 'Delivery details',
55
+ Payment: () => 'Payment',
56
+ Review: () => 'Review and place order',
57
+ Placing: () => 'Processing your order',
58
+ Confirmed: () => 'Thank you',
59
+ Cancelled: () => 'Checkout cancelled',
60
+ })
64
61
 
65
62
  const stateDescription = (state: typeof CheckoutState.Type): string =>
66
- M.value(state).pipe(
67
- M.tagsExhaustive({
68
- Cart: () => 'Choose your edition before continuing to checkout.',
69
- Shipping: () => 'Confirm where we should send your hardcover.',
70
- Payment: () => 'Select a saved payment method for this order.',
71
- Review: () => 'Check the details below before placing your order.',
72
- Placing: () => 'Please keep this page open for a moment.',
73
- Confirmed: () => 'Your order is confirmed and a receipt is on its way.',
74
- Cancelled: () => 'Nothing was charged. Your selection has been saved.',
75
- }),
76
- )
63
+ CheckoutState.match(state, {
64
+ Cart: () => 'Choose your edition before continuing to checkout.',
65
+ Shipping: () => 'Confirm where we should send your hardcover.',
66
+ Payment: () => 'Select a saved payment method for this order.',
67
+ Review: () => 'Check the details below before placing your order.',
68
+ Placing: () => 'Please keep this page open for a moment.',
69
+ Confirmed: () => 'Your order is confirmed and a receipt is on its way.',
70
+ Cancelled: () => 'Nothing was charged. Your selection has been saved.',
71
+ })
77
72
 
78
73
  const progressSteps: ReadonlyArray<string> = [
79
74
  'Bag',
@@ -1039,21 +1034,19 @@ const reviewView = (
1039
1034
  ),
1040
1035
  ],
1041
1036
  ),
1042
- M.value(state.promo).pipe(
1043
- M.tagsExhaustive({
1044
- NoPromo: () => h.p([h.Class(promoFeedbackClassName)], ['']),
1045
- AppliedPromo: ({ discount }) =>
1046
- h.p(
1047
- [h.Class(clsx(promoFeedbackClassName, 'text-orange-800'))],
1048
- [`${discount.code} applied · ${discount.percentOff}% off`],
1049
- ),
1050
- RejectedPromo: () =>
1051
- h.p(
1052
- [h.Class(clsx(promoFeedbackClassName, 'text-red-700'))],
1053
- ["That code isn't recognized."],
1054
- ),
1055
- }),
1056
- ),
1037
+ Promo.match(state.promo, {
1038
+ NoPromo: () => h.p([h.Class(promoFeedbackClassName)], ['']),
1039
+ AppliedPromo: ({ discount }) =>
1040
+ h.p(
1041
+ [h.Class(clsx(promoFeedbackClassName, 'text-orange-800'))],
1042
+ [`${discount.code} applied · ${discount.percentOff}% off`],
1043
+ ),
1044
+ RejectedPromo: () =>
1045
+ h.p(
1046
+ [h.Class(clsx(promoFeedbackClassName, 'text-red-700'))],
1047
+ ["That code isn't recognized."],
1048
+ ),
1049
+ }),
1057
1050
  ],
1058
1051
  ),
1059
1052
  Checkbox.view(
@@ -1288,17 +1281,15 @@ const checkoutContentView = (
1288
1281
  editionRadioGroup: RadioGroup.Model,
1289
1282
  h: HtmlBuilder<Message>,
1290
1283
  ): Html =>
1291
- M.value(state).pipe(
1292
- M.tagsExhaustive({
1293
- Cart: cartState => cartView(cartState, editionRadioGroup, h),
1294
- Shipping: () => shippingView(h),
1295
- Payment: paymentState => paymentView(paymentState, h),
1296
- Review: reviewState => reviewView(reviewState, h),
1297
- Placing: () => placingView(h),
1298
- Confirmed: confirmedState => confirmedView(confirmedState, h),
1299
- Cancelled: () => cancelledView(h),
1300
- }),
1301
- )
1284
+ CheckoutState.match(state, {
1285
+ Cart: cartState => cartView(cartState, editionRadioGroup, h),
1286
+ Shipping: () => shippingView(h),
1287
+ Payment: paymentState => paymentView(paymentState, h),
1288
+ Review: reviewState => reviewView(reviewState, h),
1289
+ Placing: () => placingView(h),
1290
+ Confirmed: confirmedState => confirmedView(confirmedState, h),
1291
+ Cancelled: () => cancelledView(h),
1292
+ })
1302
1293
 
1303
1294
  const checkoutPanelView = (
1304
1295
  state: typeof CheckoutState.Type,
@@ -17,13 +17,13 @@
17
17
  "devDependencies": {
18
18
  "@foldkit/devtools": "workspace:*",
19
19
  "@foldkit/vite-plugin": "workspace:*",
20
- "@tailwindcss/vite": "^4.3.1",
20
+ "@tailwindcss/vite": "^4.3.3",
21
21
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
22
- "happy-dom": "^20.10.4",
23
- "prettier": "^3.8.4",
24
- "tailwindcss": "^4.3.1",
25
- "typescript": "^6.0.3",
26
- "vite": "^8.0.16",
27
- "vitest": "^4.1.9"
22
+ "happy-dom": "^20.11.13",
23
+ "prettier": "^3.9.6",
24
+ "tailwindcss": "^4.3.3",
25
+ "typescript": "^7.0.2",
26
+ "vite": "^8.2.2",
27
+ "vitest": "^4.1.11"
28
28
  }
29
29
  }
@@ -18,13 +18,13 @@
18
18
  "devDependencies": {
19
19
  "@foldkit/devtools": "workspace:*",
20
20
  "@foldkit/vite-plugin": "workspace:*",
21
- "@tailwindcss/vite": "^4.3.1",
21
+ "@tailwindcss/vite": "^4.3.3",
22
22
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
23
- "happy-dom": "^20.10.4",
24
- "prettier": "^3.8.4",
25
- "tailwindcss": "^4.3.1",
26
- "typescript": "^6.0.3",
27
- "vite": "^8.0.16",
28
- "vitest": "^4.1.9"
23
+ "happy-dom": "^20.11.13",
24
+ "prettier": "^3.9.6",
25
+ "tailwindcss": "^4.3.3",
26
+ "typescript": "^7.0.2",
27
+ "vite": "^8.2.2",
28
+ "vitest": "^4.1.11"
29
29
  }
30
30
  }
@@ -108,12 +108,10 @@ export const update = (model: Model, message: Message) =>
108
108
  UpdatedEditingTodo: ({ text }) => ({
109
109
  model: evo(model, {
110
110
  editing: () =>
111
- M.value(model.editing).pipe(
112
- M.tagsExhaustive({
113
- NotEditing: () => model.editing,
114
- Editing: ({ id }) => EditingState.Editing({ id, text }),
115
- }),
116
- ),
111
+ EditingState.match(model.editing, {
112
+ NotEditing: () => model.editing,
113
+ Editing: ({ id }) => EditingState.Editing({ id, text }),
114
+ }),
117
115
  }),
118
116
  }),
119
117
 
@@ -190,36 +188,33 @@ export const update = (model: Model, message: Message) =>
190
188
  },
191
189
 
192
190
  SavedEdit: () =>
193
- M.value(model.editing).pipe(
194
- M.withReturnType<UpdateReturn>(),
195
- M.tagsExhaustive({
196
- NotEditing: () => ({ model }),
197
-
198
- Editing: ({ id, text }) => {
199
- if (String.isEmpty(String.trim(text))) {
200
- return {
201
- model: evo(model, {
202
- editing: () => EditingState.NotEditing(),
203
- }),
204
- }
205
- }
206
-
207
- const updatedTodos = Array.map(model.todos, todo =>
208
- todo.id === id
209
- ? evo(todo, { text: () => String.trim(text) })
210
- : todo,
211
- )
191
+ EditingState.match<UpdateReturn>(model.editing, {
192
+ NotEditing: () => ({ model }),
212
193
 
194
+ Editing: ({ id, text }) => {
195
+ if (String.isEmpty(String.trim(text))) {
213
196
  return {
214
197
  model: evo(model, {
215
- todos: () => updatedTodos,
216
198
  editing: () => EditingState.NotEditing(),
217
199
  }),
218
- commands: [SaveTodos({ todos: updatedTodos })],
219
200
  }
220
- },
221
- }),
222
- ),
201
+ }
202
+
203
+ const updatedTodos = Array.map(model.todos, todo =>
204
+ todo.id === id
205
+ ? evo(todo, { text: () => String.trim(text) })
206
+ : todo,
207
+ )
208
+
209
+ return {
210
+ model: evo(model, {
211
+ todos: () => updatedTodos,
212
+ editing: () => EditingState.NotEditing(),
213
+ }),
214
+ commands: [SaveTodos({ todos: updatedTodos })],
215
+ }
216
+ },
217
+ }),
223
218
 
224
219
  CancelledEdit: () => ({
225
220
  model: evo(model, {
@@ -304,13 +299,10 @@ const editingTextFor = (
304
299
  editing: EditingState,
305
300
  todoId: string,
306
301
  ): Option.Option<string> =>
307
- M.value(editing).pipe(
308
- M.tagsExhaustive({
309
- NotEditing: () => Option.none(),
310
- Editing: ({ id, text }) =>
311
- Option.liftPredicate(text, () => id === todoId),
312
- }),
313
- )
302
+ EditingState.match(editing, {
303
+ NotEditing: () => Option.none(),
304
+ Editing: ({ id, text }) => Option.liftPredicate(text, () => id === todoId),
305
+ })
314
306
 
315
307
  const todoItemView = (
316
308
  todo: Todo,
@@ -18,13 +18,13 @@
18
18
  "devDependencies": {
19
19
  "@foldkit/devtools": "workspace:*",
20
20
  "@foldkit/vite-plugin": "workspace:*",
21
- "@tailwindcss/vite": "^4.3.1",
21
+ "@tailwindcss/vite": "^4.3.3",
22
22
  "@trivago/prettier-plugin-sort-imports": "^6.0.2",
23
- "happy-dom": "^20.10.4",
24
- "prettier": "^3.8.4",
25
- "tailwindcss": "^4.3.1",
26
- "typescript": "^6.0.3",
27
- "vite": "^8.0.16",
28
- "vitest": "^4.1.9"
23
+ "happy-dom": "^20.11.13",
24
+ "prettier": "^3.9.6",
25
+ "tailwindcss": "^4.3.3",
26
+ "typescript": "^7.0.2",
27
+ "vite": "^8.2.2",
28
+ "vitest": "^4.1.11"
29
29
  }
30
30
  }