create-foldkit-app 0.35.1 → 0.35.2

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 (134) hide show
  1. package/dist/templates/base/FOLDKIT.md +2 -2
  2. package/dist/templates/examples/api-cache/package.json +2 -2
  3. package/dist/templates/examples/api-cache/src/main.fixture.ts +4 -4
  4. package/dist/templates/examples/api-cache/src/main.ts +12 -12
  5. package/dist/templates/examples/api-cache/src/story.test.ts +6 -6
  6. package/dist/templates/examples/auth/package.json +2 -2
  7. package/dist/templates/examples/auth/src/page/loggedOut/page/login.scene.test.ts +2 -2
  8. package/dist/templates/examples/auth/src/page/loggedOut/page/login.story.test.ts +2 -2
  9. package/dist/templates/examples/auth/src/page/loggedOut/page/login.ts +5 -5
  10. package/dist/templates/examples/auth/src/page/loggedOut/update.ts +2 -2
  11. package/dist/templates/examples/auth/src/scene.test.ts +2 -2
  12. package/dist/templates/examples/auth/src/update.ts +3 -3
  13. package/dist/templates/examples/canvas-art/package.json +2 -2
  14. package/dist/templates/examples/canvas-art/src/main.ts +6 -6
  15. package/dist/templates/examples/canvas-art/src/scene.test.ts +3 -3
  16. package/dist/templates/examples/canvas-art/src/story.test.ts +3 -3
  17. package/dist/templates/examples/charting/package.json +2 -2
  18. package/dist/templates/examples/charting/src/main.fixture.ts +2 -2
  19. package/dist/templates/examples/charting/src/scene.test.ts +3 -3
  20. package/dist/templates/examples/charting/src/story.test.ts +2 -2
  21. package/dist/templates/examples/charting/src/update.ts +18 -16
  22. package/dist/templates/examples/counter/package.json +2 -2
  23. package/dist/templates/examples/counter/src/main.ts +4 -4
  24. package/dist/templates/examples/counters/package.json +2 -2
  25. package/dist/templates/examples/counters/src/counter.ts +3 -3
  26. package/dist/templates/examples/counters/src/main.ts +7 -5
  27. package/dist/templates/examples/crash-view/package.json +2 -2
  28. package/dist/templates/examples/embedding/package.json +2 -2
  29. package/dist/templates/examples/embedding/src/main.ts +5 -3
  30. package/dist/templates/examples/embedding/src/scene.test.ts +2 -2
  31. package/dist/templates/examples/embedding/src/story.test.ts +2 -2
  32. package/dist/templates/examples/form/package.json +2 -2
  33. package/dist/templates/examples/form/src/main.ts +9 -9
  34. package/dist/templates/examples/form/src/scene.test.ts +5 -5
  35. package/dist/templates/examples/form/src/story.test.ts +4 -4
  36. package/dist/templates/examples/generative-art/package.json +2 -2
  37. package/dist/templates/examples/generative-art/src/scene.test.ts +2 -2
  38. package/dist/templates/examples/generative-art/src/story.test.ts +3 -3
  39. package/dist/templates/examples/generative-art/src/update.ts +11 -11
  40. package/dist/templates/examples/interrupting-commands/package.json +2 -2
  41. package/dist/templates/examples/interrupting-commands/src/main.ts +8 -6
  42. package/dist/templates/examples/job-application/package.json +2 -2
  43. package/dist/templates/examples/job-application/src/main.fixture.ts +9 -9
  44. package/dist/templates/examples/job-application/src/scene.test.ts +13 -13
  45. package/dist/templates/examples/job-application/src/step/attachments/attachments.ts +7 -7
  46. package/dist/templates/examples/job-application/src/step/coverLetter/coverLetter.ts +2 -2
  47. package/dist/templates/examples/job-application/src/step/education/education.ts +6 -6
  48. package/dist/templates/examples/job-application/src/step/education/entry/entry.ts +14 -8
  49. package/dist/templates/examples/job-application/src/step/personalInfo/personalInfo.ts +20 -15
  50. package/dist/templates/examples/job-application/src/step/personalInfo/story.test.ts +2 -2
  51. package/dist/templates/examples/job-application/src/step/skills/entry/entry.ts +7 -5
  52. package/dist/templates/examples/job-application/src/step/skills/skills.ts +6 -6
  53. package/dist/templates/examples/job-application/src/step/workHistory/entry/entry.ts +13 -12
  54. package/dist/templates/examples/job-application/src/step/workHistory/workHistory.ts +6 -6
  55. package/dist/templates/examples/job-application/src/story.test.ts +10 -10
  56. package/dist/templates/examples/job-application/src/update.ts +25 -18
  57. package/dist/templates/examples/kanban/package.json +2 -2
  58. package/dist/templates/examples/kanban/src/domain/column.ts +9 -6
  59. package/dist/templates/examples/kanban/src/update.ts +8 -8
  60. package/dist/templates/examples/managed-resource-layer/package.json +2 -2
  61. package/dist/templates/examples/managed-resource-layer/src/main.ts +11 -7
  62. package/dist/templates/examples/managed-resource-layer/src/story.test.ts +3 -3
  63. package/dist/templates/examples/map/package.json +2 -2
  64. package/dist/templates/examples/map/src/main.fixture.ts +2 -2
  65. package/dist/templates/examples/map/src/main.ts +11 -11
  66. package/dist/templates/examples/map/src/scene.test.ts +4 -4
  67. package/dist/templates/examples/map/src/story.test.ts +4 -4
  68. package/dist/templates/examples/pixel-art/package.json +2 -2
  69. package/dist/templates/examples/pixel-art/src/comparison.bench.test.ts +2 -2
  70. package/dist/templates/examples/pixel-art/src/main.bench.ts +7 -3
  71. package/dist/templates/examples/pixel-art/src/scene.test.ts +5 -5
  72. package/dist/templates/examples/pixel-art/src/story.test.ts +4 -4
  73. package/dist/templates/examples/pixel-art/src/subscription.ts +2 -2
  74. package/dist/templates/examples/pixel-art/src/update.ts +49 -33
  75. package/dist/templates/examples/query-sync/package.json +2 -2
  76. package/dist/templates/examples/query-sync/src/main.ts +4 -4
  77. package/dist/templates/examples/query-sync/src/scene.test.ts +4 -4
  78. package/dist/templates/examples/query-sync/src/story.test.ts +2 -2
  79. package/dist/templates/examples/route-transitions/package.json +2 -2
  80. package/dist/templates/examples/route-transitions/src/main.ts +10 -10
  81. package/dist/templates/examples/route-transitions/src/story.test.ts +10 -6
  82. package/dist/templates/examples/routing/package.json +2 -2
  83. package/dist/templates/examples/routing/src/main.ts +13 -17
  84. package/dist/templates/examples/routing/src/page/people.ts +4 -4
  85. package/dist/templates/examples/shopping-cart/package.json +2 -2
  86. package/dist/templates/examples/shopping-cart/src/domain/cart.ts +4 -4
  87. package/dist/templates/examples/shopping-cart/src/main.ts +12 -12
  88. package/dist/templates/examples/shopping-cart/src/page/products.ts +2 -2
  89. package/dist/templates/examples/shopping-cart/src/scene.test.ts +10 -8
  90. package/dist/templates/examples/shopping-cart/src/story.test.ts +7 -7
  91. package/dist/templates/examples/slow-warnings/package.json +2 -2
  92. package/dist/templates/examples/slow-warnings/src/handleSlow.test.ts +2 -2
  93. package/dist/templates/examples/slow-warnings/src/main.ts +8 -8
  94. package/dist/templates/examples/slow-warnings/src/scene.test.ts +2 -2
  95. package/dist/templates/examples/slow-warnings/src/story.test.ts +2 -2
  96. package/dist/templates/examples/snake/package.json +2 -2
  97. package/dist/templates/examples/snake/src/main.ts +10 -10
  98. package/dist/templates/examples/snake/src/scene.test.ts +10 -5
  99. package/dist/templates/examples/snake/src/story.test.ts +6 -6
  100. package/dist/templates/examples/ssg/package.json +2 -2
  101. package/dist/templates/examples/ssg/src/main.ts +3 -3
  102. package/dist/templates/examples/ssr/package.json +4 -4
  103. package/dist/templates/examples/ssr/src/main.ts +3 -3
  104. package/dist/templates/examples/state-machine/package.json +2 -2
  105. package/dist/templates/examples/state-machine/src/main.ts +14 -10
  106. package/dist/templates/examples/stopwatch/package.json +2 -2
  107. package/dist/templates/examples/stopwatch/src/main.ts +5 -5
  108. package/dist/templates/examples/stopwatch/src/story.test.ts +2 -2
  109. package/dist/templates/examples/todo/package.json +2 -2
  110. package/dist/templates/examples/todo/src/main.ts +17 -17
  111. package/dist/templates/examples/todo/src/scene.test.ts +4 -4
  112. package/dist/templates/examples/todo/src/story.test.ts +22 -16
  113. package/dist/templates/examples/ui-showcase/package.json +2 -2
  114. package/dist/templates/examples/ui-showcase/src/main.ts +8 -5
  115. package/dist/templates/examples/ui-showcase/src/story.test.ts +3 -3
  116. package/dist/templates/examples/ui-showcase/src/ui/init.ts +4 -1
  117. package/dist/templates/examples/ui-showcase/src/ui/subscriptions.ts +10 -0
  118. package/dist/templates/examples/ui-showcase/src/ui/update.ts +119 -91
  119. package/dist/templates/examples/ui-showcase/src/ui/view/toast.ts +20 -3
  120. package/dist/templates/examples/view-transitions/package.json +2 -2
  121. package/dist/templates/examples/view-transitions/src/main.ts +3 -3
  122. package/dist/templates/examples/weather/package.json +2 -2
  123. package/dist/templates/examples/weather/src/main.ts +5 -5
  124. package/dist/templates/examples/web-components/package.json +2 -2
  125. package/dist/templates/examples/web-components/src/main.ts +4 -4
  126. package/dist/templates/examples/websocket-chat/package.json +2 -2
  127. package/dist/templates/examples/websocket-chat/src/main.ts +8 -8
  128. package/dist/templates/examples/websocket-chat/src/scene.test.ts +18 -6
  129. package/dist/templates/examples/websocket-chat/src/story.test.ts +15 -9
  130. package/dist/templates/release.json +13 -13
  131. package/dist/templates/rendering/ssg/src/main.ts +3 -3
  132. package/dist/templates/rendering/ssr/scripts/serve.ts +2 -2
  133. package/dist/templates/rendering/ssr/src/main.ts +3 -3
  134. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  import { Option } from 'effect'
2
2
  import { expect, given, placeholder, role, scene, text } from 'foldkit/scene'
3
- import { evo } from 'foldkit/struct'
3
+ import { modifyFields } from 'foldkit/struct'
4
4
  import { describe, test } from 'vitest'
5
5
 
6
6
  import { Listbox } from '@foldkit/ui'
@@ -40,7 +40,7 @@ describe('view', () => {
40
40
  scene(
41
41
  { update, view },
42
42
  given(
43
- evo(browseModel, {
43
+ modifyFields(browseModel, {
44
44
  route: () =>
45
45
  AppRoute.Browse({
46
46
  search: Option.some('Tyranno'),
@@ -58,7 +58,7 @@ describe('view', () => {
58
58
  scene(
59
59
  { update, view },
60
60
  given(
61
- evo(browseModel, {
61
+ modifyFields(browseModel, {
62
62
  route: () =>
63
63
  AppRoute.Browse({
64
64
  search: Option.some('zzzNoMatch'),
@@ -76,7 +76,7 @@ describe('view', () => {
76
76
  scene(
77
77
  { update, view },
78
78
  given(
79
- evo(browseModel, {
79
+ modifyFields(browseModel, {
80
80
  route: () => AppRoute.NotFound({ path: '/oops' }),
81
81
  }),
82
82
  ),
@@ -1,6 +1,6 @@
1
1
  import { Option } from 'effect'
2
2
  import { Command, given, message, model, story } from 'foldkit/story'
3
- import { evo } from 'foldkit/struct'
3
+ import { modifyFields } from 'foldkit/struct'
4
4
  import { fromString } from 'foldkit/url'
5
5
  import { describe, expect, test } from 'vitest'
6
6
 
@@ -104,7 +104,7 @@ describe('update', () => {
104
104
  story(
105
105
  update,
106
106
  given(
107
- evo(browseModel, {
107
+ modifyFields(browseModel, {
108
108
  route: () =>
109
109
  AppRoute.Browse({
110
110
  search: Option.some('foo'),
@@ -9,8 +9,8 @@
9
9
  "test": "vitest run"
10
10
  },
11
11
  "dependencies": {
12
- "@effect/platform-browser": "4.0.0-rc.115",
13
- "effect": "4.0.0-rc.115",
12
+ "@effect/platform-browser": "4.0.0-rc.116",
13
+ "effect": "4.0.0-rc.116",
14
14
  "foldkit": "workspace:*"
15
15
  },
16
16
  "devDependencies": {
@@ -5,7 +5,7 @@ import { defineMessageUnion } from 'foldkit/message'
5
5
  import { UrlRequest, load, pushUrl } from 'foldkit/navigation'
6
6
  import { Transition } from 'foldkit/route'
7
7
  import { defineTaggedUnion } from 'foldkit/schema'
8
- import { evo } from 'foldkit/struct'
8
+ import { modifyFields } from 'foldkit/struct'
9
9
  import { Url, toString as urlToString } from 'foldkit/url'
10
10
 
11
11
  import { type Painting, findPaintingWithIndex, paintings } from './data'
@@ -128,7 +128,7 @@ const nextSequenceNumber = (
128
128
  const logTransition =
129
129
  (transition: AppTransition): Step =>
130
130
  model => ({
131
- model: evo(model, {
131
+ model: modifyFields(model, {
132
132
  transitionLog: transitionLog =>
133
133
  pipe(
134
134
  transitionLog,
@@ -148,7 +148,7 @@ const loadCatalogOnGalleryEntry =
148
148
  Transition.isEntering(transition, 'Gallery') &&
149
149
  model.catalogStatus !== 'Loading'
150
150
  ? {
151
- model: evo(model, { catalogStatus: () => 'Loading' }),
151
+ model: modifyFields(model, { catalogStatus: () => 'Loading' }),
152
152
  commands: [LoadCatalog()],
153
153
  }
154
154
  : { model }
@@ -159,7 +159,7 @@ const loadPaintingOnEntry =
159
159
  Option.match(Transition.entered(transition, 'Painting'), {
160
160
  onNone: () => ({ model }),
161
161
  onSome: ({ paintingId }) => ({
162
- model: evo(model, {
162
+ model: modifyFields(model, {
163
163
  paintingStatus: () => PaintingStatus.Loading({ paintingId }),
164
164
  }),
165
165
  commands: [LoadPainting({ paintingId })],
@@ -175,7 +175,7 @@ const reloadPaintingOnIdChange =
175
175
  previousRoute.paintingId === nextRoute.paintingId
176
176
  ? { model }
177
177
  : {
178
- model: evo(model, {
178
+ model: modifyFields(model, {
179
179
  paintingStatus: () =>
180
180
  PaintingStatus.Loading({
181
181
  paintingId: nextRoute.paintingId,
@@ -229,31 +229,31 @@ export const update = (model: Model, message: Message) =>
229
229
  const nextRoute = urlToAppRoute(url)
230
230
  const transition = Transition.make(model.route, nextRoute)
231
231
  return handleTransition(
232
- evo(model, { route: () => nextRoute }),
232
+ modifyFields(model, { route: () => nextRoute }),
233
233
  transition,
234
234
  )
235
235
  },
236
236
 
237
237
  SucceededLoadCatalog: () => ({
238
- model: evo(model, { catalogStatus: () => 'Ready' }),
238
+ model: modifyFields(model, { catalogStatus: () => 'Ready' }),
239
239
  }),
240
240
 
241
241
  SucceededLoadPainting: ({ paintingId }) =>
242
242
  model.paintingStatus._tag === 'Loading' &&
243
243
  model.paintingStatus.paintingId === paintingId
244
244
  ? {
245
- model: evo(model, {
245
+ model: modifyFields(model, {
246
246
  paintingStatus: () => PaintingStatus.Ready({ paintingId }),
247
247
  }),
248
248
  }
249
249
  : { model },
250
250
 
251
251
  UpdatedStudioDraft: ({ value }) => ({
252
- model: evo(model, { studioDraft: () => value }),
252
+ model: modifyFields(model, { studioDraft: () => value }),
253
253
  }),
254
254
 
255
255
  SucceededSaveDraft: ({ draft }) => ({
256
- model: evo(model, { maybeSavedDraft: () => Option.some(draft) }),
256
+ model: modifyFields(model, { maybeSavedDraft: () => Option.some(draft) }),
257
257
  }),
258
258
  })
259
259
 
@@ -1,6 +1,6 @@
1
1
  import { Array, Option } from 'effect'
2
2
  import { Command, given, message, model, story } from 'foldkit/story'
3
- import { evo } from 'foldkit/struct'
3
+ import { modifyFields } from 'foldkit/struct'
4
4
  import { fromString } from 'foldkit/url'
5
5
  import { describe, expect, test } from 'vitest'
6
6
 
@@ -81,7 +81,11 @@ describe('update', () => {
81
81
  test('re-entering the gallery while a catalog load is in flight does not fire another', () => {
82
82
  story(
83
83
  update,
84
- given(evo(modelOn(AppRoute.Home()), { catalogStatus: () => 'Loading' })),
84
+ given(
85
+ modifyFields(modelOn(AppRoute.Home()), {
86
+ catalogStatus: () => 'Loading',
87
+ }),
88
+ ),
85
89
  message(
86
90
  Message.ChangedUrl({ url: urlOrThrow('http://localhost/gallery') }),
87
91
  ),
@@ -121,7 +125,7 @@ describe('update', () => {
121
125
  story(
122
126
  update,
123
127
  given(
124
- evo(modelOn(AppRoute.Painting({ paintingId: 1 })), {
128
+ modifyFields(modelOn(AppRoute.Painting({ paintingId: 1 })), {
125
129
  paintingStatus: () => PaintingStatus.Ready({ paintingId: 1 }),
126
130
  }),
127
131
  ),
@@ -153,7 +157,7 @@ describe('update', () => {
153
157
  story(
154
158
  update,
155
159
  given(
156
- evo(modelOn(AppRoute.Painting({ paintingId: 1 })), {
160
+ modifyFields(modelOn(AppRoute.Painting({ paintingId: 1 })), {
157
161
  paintingStatus: () => PaintingStatus.Ready({ paintingId: 1 }),
158
162
  }),
159
163
  ),
@@ -173,7 +177,7 @@ describe('update', () => {
173
177
  story(
174
178
  update,
175
179
  given(
176
- evo(modelOn(AppRoute.Painting({ paintingId: 2 })), {
180
+ modifyFields(modelOn(AppRoute.Painting({ paintingId: 2 })), {
177
181
  paintingStatus: () => PaintingStatus.Loading({ paintingId: 2 }),
178
182
  }),
179
183
  ),
@@ -190,7 +194,7 @@ describe('update', () => {
190
194
  story(
191
195
  update,
192
196
  given(
193
- evo(modelOn(AppRoute.Studio()), {
197
+ modifyFields(modelOn(AppRoute.Studio()), {
194
198
  studioDraft: () => 'half-finished thought',
195
199
  }),
196
200
  ),
@@ -9,9 +9,9 @@
9
9
  "test": "vitest run"
10
10
  },
11
11
  "dependencies": {
12
- "@effect/platform-browser": "4.0.0-rc.115",
12
+ "@effect/platform-browser": "4.0.0-rc.116",
13
13
  "@foldkit/ui": "workspace:*",
14
- "effect": "4.0.0-rc.115",
14
+ "effect": "4.0.0-rc.116",
15
15
  "foldkit": "workspace:*"
16
16
  },
17
17
  "devDependencies": {
@@ -3,7 +3,7 @@ import { Command, Runtime, Subscription, Update } from 'foldkit'
3
3
  import { Document, Html, HtmlBuilder } from 'foldkit/html'
4
4
  import { defineMessageUnion } from 'foldkit/message'
5
5
  import { UrlRequest, load, pushUrl } from 'foldkit/navigation'
6
- import { evo } from 'foldkit/struct'
6
+ import { modifyFields } from 'foldkit/struct'
7
7
  import { Url, toString as urlToString } from 'foldkit/url'
8
8
 
9
9
  import {
@@ -105,7 +105,7 @@ const foldPeopleEntry = <Input>(
105
105
  update,
106
106
  read: model => Option.some(model.peoplePage),
107
107
  write: (model, nextPeoplePage) =>
108
- evo(model, { peoplePage: () => nextPeoplePage }),
108
+ modifyFields(model, { peoplePage: () => nextPeoplePage }),
109
109
  toParentMessage: message => Message.GotPeopleMessage({ message }),
110
110
  })
111
111
 
@@ -115,7 +115,7 @@ const foldPeopleRouteChanged = foldPeopleEntry(People.informRouteChanged)
115
115
 
116
116
  const setRoute =
117
117
  (nextRoute: AppRoute): Update.Step<Model, Message> =>
118
- model => ({ model: evo(model, { route: () => nextRoute }) })
118
+ model => ({ model: modifyFields(model, { route: () => nextRoute }) })
119
119
 
120
120
  export const update = (model: Model, message: Message) =>
121
121
  Message.match<UpdateReturn>(message, {
@@ -160,28 +160,24 @@ export const update = (model: Model, message: Message) =>
160
160
  // SUBSCRIPTION
161
161
 
162
162
  export const subscriptions = Subscription.make<Model, Message>()(() => ({
163
- shortcuts: Subscription.persistent(
164
- Subscription.keyboardShortcuts<Message>({
163
+ keyBindings: Subscription.persistent(
164
+ Subscription.keyBindings<Message>({
165
165
  bindings: [
166
166
  {
167
- shortcut: ['G', 'H'],
168
- toMessage: () =>
169
- Message.EnteredNavigationShortcut({ shortcut: 'GH' }),
167
+ keys: ['G', 'H'],
168
+ mapEvent: () => Message.EnteredNavigationShortcut({ shortcut: 'GH' }),
170
169
  },
171
170
  {
172
- shortcut: ['G', 'P'],
173
- toMessage: () =>
174
- Message.EnteredNavigationShortcut({ shortcut: 'GP' }),
171
+ keys: ['G', 'P'],
172
+ mapEvent: () => Message.EnteredNavigationShortcut({ shortcut: 'GP' }),
175
173
  },
176
174
  {
177
- shortcut: ['G', 'F'],
178
- toMessage: () =>
179
- Message.EnteredNavigationShortcut({ shortcut: 'GF' }),
175
+ keys: ['G', 'F'],
176
+ mapEvent: () => Message.EnteredNavigationShortcut({ shortcut: 'GF' }),
180
177
  },
181
178
  {
182
- shortcut: ['G', 'N'],
183
- toMessage: () =>
184
- Message.EnteredNavigationShortcut({ shortcut: 'GN' }),
179
+ keys: ['G', 'N'],
180
+ mapEvent: () => Message.EnteredNavigationShortcut({ shortcut: 'GN' }),
185
181
  },
186
182
  ],
187
183
  }),
@@ -4,7 +4,7 @@ import { Html, HtmlBuilder } from 'foldkit/html'
4
4
  import { defineMessageUnion } from 'foldkit/message'
5
5
  import { pushUrl } from 'foldkit/navigation'
6
6
  import { defineTaggedUnion } from 'foldkit/schema'
7
- import { evo } from 'foldkit/struct'
7
+ import { modifyFields } from 'foldkit/struct'
8
8
 
9
9
  import { Button, Input } from '@foldkit/ui'
10
10
 
@@ -149,7 +149,7 @@ export type UpdateReturn = Update.Return<Model, Message>
149
149
  export const update = (model: Model, message: Message) =>
150
150
  Message.match<UpdateReturn>(message, {
151
151
  ChangedSearchInput: ({ value }) => ({
152
- model: evo(model, { searchInput: () => value }),
152
+ model: modifyFields(model, { searchInput: () => value }),
153
153
  }),
154
154
 
155
155
  SubmittedSearch: () => ({
@@ -164,7 +164,7 @@ export const update = (model: Model, message: Message) =>
164
164
  ChangedRoute: ({ route }) => {
165
165
  const searchText = routeSearchText(route)
166
166
  return {
167
- model: evo(model, {
167
+ model: modifyFields(model, {
168
168
  searchInput: () => searchText,
169
169
  searchHistory: searchHistory =>
170
170
  addSearchToHistory(searchHistory, searchText),
@@ -175,7 +175,7 @@ export const update = (model: Model, message: Message) =>
175
175
  },
176
176
 
177
177
  SucceededFetchPeople: ({ query, people: fetchedPeople }) => ({
178
- model: evo(model, {
178
+ model: modifyFields(model, {
179
179
  results: () => SearchResults.Loaded({ query, people: fetchedPeople }),
180
180
  }),
181
181
  }),
@@ -9,9 +9,9 @@
9
9
  "test": "vitest run"
10
10
  },
11
11
  "dependencies": {
12
- "@effect/platform-browser": "4.0.0-rc.115",
12
+ "@effect/platform-browser": "4.0.0-rc.116",
13
13
  "@foldkit/ui": "workspace:*",
14
- "effect": "4.0.0-rc.115",
14
+ "effect": "4.0.0-rc.116",
15
15
  "foldkit": "workspace:*"
16
16
  },
17
17
  "devDependencies": {
@@ -1,5 +1,5 @@
1
1
  import { Array, Number, Option, Predicate, Schema, pipe } from 'effect'
2
- import { evo } from 'foldkit/struct'
2
+ import { modifyFields } from 'foldkit/struct'
3
3
 
4
4
  import { CartItem, Item } from './item'
5
5
 
@@ -26,7 +26,7 @@ export const addItem =
26
26
  onSome: () =>
27
27
  mapCartItem(
28
28
  item.id,
29
- evo({
29
+ modifyFields({
30
30
  quantity: Number.increment,
31
31
  }),
32
32
  )(cart),
@@ -43,7 +43,7 @@ export const changeQuantity = (itemId: string, quantity: number) =>
43
43
  ? removeItem(itemId)
44
44
  : mapCartItem(
45
45
  itemId,
46
- evo({
46
+ modifyFields({
47
47
  quantity: () => quantity,
48
48
  }),
49
49
  )
@@ -51,7 +51,7 @@ export const changeQuantity = (itemId: string, quantity: number) =>
51
51
  export const incrementQuantity = (itemId: string) =>
52
52
  mapCartItem(
53
53
  itemId,
54
- evo({
54
+ modifyFields({
55
55
  quantity: Number.increment,
56
56
  }),
57
57
  )
@@ -3,7 +3,7 @@ import { Command, Runtime, Update } from 'foldkit'
3
3
  import { Document, Html, HtmlBuilder } from 'foldkit/html'
4
4
  import { defineMessageUnion } from 'foldkit/message'
5
5
  import { UrlRequest, load, pushUrl } from 'foldkit/navigation'
6
- import { evo } from 'foldkit/struct'
6
+ import { modifyFields } from 'foldkit/struct'
7
7
  import { Url, toString as urlToString } from 'foldkit/url'
8
8
 
9
9
  import { products } from './data/products'
@@ -87,16 +87,16 @@ const foldProductsOutMessage = Products.OutMessage.match<
87
87
  >({
88
88
  AddedToCart:
89
89
  ({ item }) =>
90
- model => ({ model: evo(model, { cart: Cart.addItem(item) }) }),
90
+ model => ({ model: modifyFields(model, { cart: Cart.addItem(item) }) }),
91
91
  IncrementedQuantity:
92
92
  ({ itemId }) =>
93
93
  model => ({
94
- model: evo(model, { cart: Cart.incrementQuantity(itemId) }),
94
+ model: modifyFields(model, { cart: Cart.incrementQuantity(itemId) }),
95
95
  }),
96
96
  DecrementedQuantity:
97
97
  ({ itemId }) =>
98
98
  model => ({
99
- model: evo(model, { cart: Cart.decrementQuantity(itemId) }),
99
+ model: modifyFields(model, { cart: Cart.decrementQuantity(itemId) }),
100
100
  }),
101
101
  })
102
102
 
@@ -104,7 +104,7 @@ const foldProducts = Update.foldChild({
104
104
  update: Products.update,
105
105
  read: (model: Model) => Option.some(model.productsPage),
106
106
  write: (model, nextProductsPage) =>
107
- evo(model, { productsPage: () => nextProductsPage }),
107
+ modifyFields(model, { productsPage: () => nextProductsPage }),
108
108
  toParentMessage: message => Message.GotProductsMessage({ message }),
109
109
  foldOutMessage: foldProductsOutMessage,
110
110
  })
@@ -128,7 +128,7 @@ export const update = (model: Model, message: Message) =>
128
128
  }),
129
129
 
130
130
  ChangedUrl: ({ url }) => ({
131
- model: evo(model, {
131
+ model: modifyFields(model, {
132
132
  route: () => urlToAppRoute(url),
133
133
  }),
134
134
  }),
@@ -136,37 +136,37 @@ export const update = (model: Model, message: Message) =>
136
136
  GotProductsMessage: ({ message }) => foldProducts(model, message),
137
137
 
138
138
  ClickedIncrementQuantity: ({ itemId }) => ({
139
- model: evo(model, {
139
+ model: modifyFields(model, {
140
140
  cart: Cart.incrementQuantity(itemId),
141
141
  }),
142
142
  }),
143
143
 
144
144
  ClickedDecrementQuantity: ({ itemId }) => ({
145
- model: evo(model, {
145
+ model: modifyFields(model, {
146
146
  cart: Cart.decrementQuantity(itemId),
147
147
  }),
148
148
  }),
149
149
 
150
150
  ClickedRemoveCartItem: ({ itemId }) => ({
151
- model: evo(model, {
151
+ model: modifyFields(model, {
152
152
  cart: Cart.removeItem(itemId),
153
153
  }),
154
154
  }),
155
155
 
156
156
  ClickedClearCart: () => ({
157
- model: evo(model, {
157
+ model: modifyFields(model, {
158
158
  cart: () => [],
159
159
  }),
160
160
  }),
161
161
 
162
162
  UpdatedDeliveryInstructions: ({ value }) => ({
163
- model: evo(model, {
163
+ model: modifyFields(model, {
164
164
  deliveryInstructions: () => value,
165
165
  }),
166
166
  }),
167
167
 
168
168
  ClickedPlaceOrder: () => ({
169
- model: evo(model, {
169
+ model: modifyFields(model, {
170
170
  orderPlaced: () => true,
171
171
  cart: () => [],
172
172
  deliveryInstructions: () => '',
@@ -2,7 +2,7 @@ import { Array, Effect, Option, Schema } from 'effect'
2
2
  import { Command, Submodel, type Update } from 'foldkit'
3
3
  import { defineMessageUnion } from 'foldkit/message'
4
4
  import { replaceUrl } from 'foldkit/navigation'
5
- import { evo } from 'foldkit/struct'
5
+ import { modifyFields } from 'foldkit/struct'
6
6
 
7
7
  import { Button, Input } from '@foldkit/ui'
8
8
 
@@ -68,7 +68,7 @@ export const update = (model: Model, message: Message) =>
68
68
  CompletedReplaceSearchUrl: () => ({ model }),
69
69
 
70
70
  ChangedSearchInput: ({ value }) => ({
71
- model: evo(model, { searchText: () => value }),
71
+ model: modifyFields(model, { searchText: () => value }),
72
72
  commands: [
73
73
  ReplaceSearchUrl({
74
74
  url: productsRouter({
@@ -1,6 +1,6 @@
1
1
  import { Option } from 'effect'
2
2
  import { click, expect, given, role, scene, text } from 'foldkit/scene'
3
- import { evo } from 'foldkit/struct'
3
+ import { modifyFields } from 'foldkit/struct'
4
4
  import { describe, test } from 'vitest'
5
5
 
6
6
  import { products } from './data/products'
@@ -34,7 +34,7 @@ describe('view', () => {
34
34
  scene(
35
35
  { update, view },
36
36
  given(
37
- evo(baseModel, {
37
+ modifyFields(baseModel, {
38
38
  cart: () => [
39
39
  { item: apple, quantity: 2 },
40
40
  { item: banana, quantity: 3 },
@@ -56,7 +56,7 @@ describe('view', () => {
56
56
  test('the Cart route shows the empty state when no items have been added', () => {
57
57
  scene(
58
58
  { update, view },
59
- given(evo(baseModel, { route: () => AppRoute.Cart() })),
59
+ given(modifyFields(baseModel, { route: () => AppRoute.Cart() })),
60
60
  expect(role('heading', { name: 'Shopping Cart' })).toExist(),
61
61
  expect(text('Your cart is empty')).toExist(),
62
62
  )
@@ -66,7 +66,7 @@ describe('view', () => {
66
66
  scene(
67
67
  { update, view },
68
68
  given(
69
- evo(baseModel, {
69
+ modifyFields(baseModel, {
70
70
  cart: () => [{ item: apple, quantity: 2 }],
71
71
  route: () => AppRoute.Cart(),
72
72
  }),
@@ -82,7 +82,7 @@ describe('view', () => {
82
82
  test('the Checkout route shows the empty state when the cart is empty', () => {
83
83
  scene(
84
84
  { update, view },
85
- given(evo(baseModel, { route: () => AppRoute.Checkout() })),
85
+ given(modifyFields(baseModel, { route: () => AppRoute.Checkout() })),
86
86
  expect(role('heading', { name: 'Checkout' })).toExist(),
87
87
  expect(text('Your cart is empty')).toExist(),
88
88
  )
@@ -92,7 +92,7 @@ describe('view', () => {
92
92
  scene(
93
93
  { update, view },
94
94
  given(
95
- evo(baseModel, {
95
+ modifyFields(baseModel, {
96
96
  cart: () => [{ item: apple, quantity: 2 }],
97
97
  route: () => AppRoute.Checkout(),
98
98
  }),
@@ -108,7 +108,7 @@ describe('view', () => {
108
108
  scene(
109
109
  { update, view },
110
110
  given(
111
- evo(baseModel, {
111
+ modifyFields(baseModel, {
112
112
  cart: () => [{ item: apple, quantity: 1 }],
113
113
  route: () => AppRoute.Checkout(),
114
114
  }),
@@ -122,7 +122,9 @@ describe('view', () => {
122
122
  scene(
123
123
  { update, view },
124
124
  given(
125
- evo(baseModel, { route: () => AppRoute.NotFound({ path: '/oops' }) }),
125
+ modifyFields(baseModel, {
126
+ route: () => AppRoute.NotFound({ path: '/oops' }),
127
+ }),
126
128
  ),
127
129
  expect(role('heading', { name: '404 - Page Not Found' })).toExist(),
128
130
  expect(text('The path "/oops" was not found.')).toExist(),
@@ -1,6 +1,6 @@
1
1
  import { Option } from 'effect'
2
2
  import { given, message, model, story } from 'foldkit/story'
3
- import { evo } from 'foldkit/struct'
3
+ import { modifyFields } from 'foldkit/struct'
4
4
  import { fromString } from 'foldkit/url'
5
5
  import { describe, expect, test } from 'vitest'
6
6
 
@@ -126,7 +126,7 @@ describe('update', () => {
126
126
  story(
127
127
  update,
128
128
  given(
129
- evo(baseModel, {
129
+ modifyFields(baseModel, {
130
130
  cart: () => [{ item: apple, quantity: 1 }],
131
131
  }),
132
132
  ),
@@ -141,7 +141,7 @@ describe('update', () => {
141
141
  story(
142
142
  update,
143
143
  given(
144
- evo(baseModel, {
144
+ modifyFields(baseModel, {
145
145
  cart: () => [{ item: apple, quantity: 2 }],
146
146
  }),
147
147
  ),
@@ -156,7 +156,7 @@ describe('update', () => {
156
156
  story(
157
157
  update,
158
158
  given(
159
- evo(baseModel, {
159
+ modifyFields(baseModel, {
160
160
  cart: () => [{ item: apple, quantity: 1 }],
161
161
  }),
162
162
  ),
@@ -171,7 +171,7 @@ describe('update', () => {
171
171
  story(
172
172
  update,
173
173
  given(
174
- evo(baseModel, {
174
+ modifyFields(baseModel, {
175
175
  cart: () => [
176
176
  { item: apple, quantity: 2 },
177
177
  { item: banana, quantity: 1 },
@@ -190,7 +190,7 @@ describe('update', () => {
190
190
  story(
191
191
  update,
192
192
  given(
193
- evo(baseModel, {
193
+ modifyFields(baseModel, {
194
194
  cart: () => [{ item: apple, quantity: 2 }],
195
195
  }),
196
196
  ),
@@ -222,7 +222,7 @@ describe('update', () => {
222
222
  story(
223
223
  update,
224
224
  given(
225
- evo(baseModel, {
225
+ modifyFields(baseModel, {
226
226
  cart: () => [{ item: apple, quantity: 2 }],
227
227
  deliveryInstructions: () => 'Knock loudly',
228
228
  }),
@@ -9,8 +9,8 @@
9
9
  "test": "vitest run"
10
10
  },
11
11
  "dependencies": {
12
- "@effect/platform-browser": "4.0.0-rc.115",
13
- "effect": "4.0.0-rc.115",
12
+ "@effect/platform-browser": "4.0.0-rc.116",
13
+ "effect": "4.0.0-rc.116",
14
14
  "foldkit": "workspace:*"
15
15
  },
16
16
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- import { evo } from 'foldkit/struct'
1
+ import { modifyFields } from 'foldkit/struct'
2
2
  import { describe, expect, test, vi } from 'vitest'
3
3
 
4
4
  import { Message, type Model, handleSlow } from './main'
@@ -21,7 +21,7 @@ describe('handleSlow', () => {
21
21
  durationMs: 12,
22
22
  thresholdMs: 4,
23
23
  previousModel: initialModel,
24
- nextModel: evo(initialModel, {
24
+ nextModel: modifyFields(initialModel, {
25
25
  activeWorkload: () => 'Update',
26
26
  }),
27
27
  message: Message.ClickedRunUpdateWork(),