create-foldkit-app 0.32.0 → 0.32.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 (149) hide show
  1. package/dist/commands/create.js +9 -7
  2. package/dist/templates/base/FOLDKIT.md +22 -6
  3. package/dist/templates/examples/api-cache/src/data.ts +14 -14
  4. package/dist/templates/examples/api-cache/src/main.ts +42 -39
  5. package/dist/templates/examples/auth/src/command.ts +3 -3
  6. package/dist/templates/examples/auth/src/domain/session.ts +8 -6
  7. package/dist/templates/examples/auth/src/main.ts +11 -11
  8. package/dist/templates/examples/auth/src/message.ts +3 -3
  9. package/dist/templates/examples/auth/src/model.ts +2 -2
  10. package/dist/templates/examples/auth/src/page/loggedIn/index.ts +1 -1
  11. package/dist/templates/examples/auth/src/page/loggedIn/view.ts +3 -3
  12. package/dist/templates/examples/auth/src/page/loggedOut/index.ts +1 -1
  13. package/dist/templates/examples/auth/src/page/loggedOut/page/login.ts +9 -17
  14. package/dist/templates/examples/auth/src/page/loggedOut/update.ts +4 -6
  15. package/dist/templates/examples/auth/src/page/loggedOut/view.ts +3 -3
  16. package/dist/templates/examples/auth/src/route.ts +2 -2
  17. package/dist/templates/examples/auth/src/update.ts +37 -40
  18. package/dist/templates/examples/auth/src/view.ts +6 -6
  19. package/dist/templates/examples/canvas-art/src/main.ts +22 -30
  20. package/dist/templates/examples/charting/src/command.ts +3 -3
  21. package/dist/templates/examples/charting/src/domain.ts +53 -48
  22. package/dist/templates/examples/charting/src/echarts.ts +6 -6
  23. package/dist/templates/examples/charting/src/githubApi.ts +33 -34
  24. package/dist/templates/examples/charting/src/http.ts +7 -7
  25. package/dist/templates/examples/charting/src/message.ts +6 -6
  26. package/dist/templates/examples/charting/src/model.ts +6 -6
  27. package/dist/templates/examples/charting/src/npmApi.ts +19 -15
  28. package/dist/templates/examples/charting/src/subscription.ts +5 -5
  29. package/dist/templates/examples/charting/src/telemetry.test.ts +18 -12
  30. package/dist/templates/examples/charting/src/telemetry.ts +11 -18
  31. package/dist/templates/examples/charting/src/update.ts +17 -23
  32. package/dist/templates/examples/charting/src/view/chart.ts +2 -2
  33. package/dist/templates/examples/counter/src/main.ts +2 -2
  34. package/dist/templates/examples/counters/src/counter.ts +2 -2
  35. package/dist/templates/examples/counters/src/main.ts +8 -8
  36. package/dist/templates/examples/embedding/src/main.ts +10 -7
  37. package/dist/templates/examples/form/src/main.ts +18 -14
  38. package/dist/templates/examples/generative-art/src/command.ts +7 -2
  39. package/dist/templates/examples/generative-art/src/message.ts +14 -14
  40. package/dist/templates/examples/generative-art/src/model.ts +21 -21
  41. package/dist/templates/examples/generative-art/src/update.ts +15 -17
  42. package/dist/templates/examples/interrupting-commands/src/main.ts +30 -27
  43. package/dist/templates/examples/job-application/src/domain/proficiencyLevel.ts +2 -2
  44. package/dist/templates/examples/job-application/src/domain/pronounOption.ts +2 -2
  45. package/dist/templates/examples/job-application/src/domain/step.ts +11 -11
  46. package/dist/templates/examples/job-application/src/main.ts +5 -5
  47. package/dist/templates/examples/job-application/src/message.ts +2 -2
  48. package/dist/templates/examples/job-application/src/model.ts +5 -5
  49. package/dist/templates/examples/job-application/src/step/attachments.ts +32 -34
  50. package/dist/templates/examples/job-application/src/step/coverLetter.ts +4 -4
  51. package/dist/templates/examples/job-application/src/step/education/education.ts +11 -14
  52. package/dist/templates/examples/job-application/src/step/education/entry.ts +21 -22
  53. package/dist/templates/examples/job-application/src/step/personalInfo.ts +44 -54
  54. package/dist/templates/examples/job-application/src/step/skills/entry.ts +12 -14
  55. package/dist/templates/examples/job-application/src/step/skills/skills.ts +11 -14
  56. package/dist/templates/examples/job-application/src/step/workHistory/entry.ts +43 -45
  57. package/dist/templates/examples/job-application/src/step/workHistory/workHistory.ts +11 -14
  58. package/dist/templates/examples/job-application/src/update.ts +17 -17
  59. package/dist/templates/examples/job-application/src/view/attachments.ts +5 -5
  60. package/dist/templates/examples/job-application/src/view/datePicker.ts +3 -3
  61. package/dist/templates/examples/job-application/src/view/field.ts +5 -5
  62. package/dist/templates/examples/job-application/src/view/index.ts +28 -22
  63. package/dist/templates/examples/kanban/src/command.ts +4 -4
  64. package/dist/templates/examples/kanban/src/domain/card.ts +6 -6
  65. package/dist/templates/examples/kanban/src/domain/column.ts +9 -9
  66. package/dist/templates/examples/kanban/src/main.ts +4 -4
  67. package/dist/templates/examples/kanban/src/message.ts +6 -6
  68. package/dist/templates/examples/kanban/src/model.ts +11 -9
  69. package/dist/templates/examples/kanban/src/update.ts +5 -5
  70. package/dist/templates/examples/managed-resource-layer/src/main.ts +20 -20
  71. package/dist/templates/examples/map/src/locations.ts +7 -7
  72. package/dist/templates/examples/map/src/main.ts +83 -44
  73. package/dist/templates/examples/map/src/mount.test.ts +127 -0
  74. package/dist/templates/examples/pixel-art/src/command.ts +12 -5
  75. package/dist/templates/examples/pixel-art/src/main.ts +4 -4
  76. package/dist/templates/examples/pixel-art/src/message.ts +7 -7
  77. package/dist/templates/examples/pixel-art/src/model.ts +34 -29
  78. package/dist/templates/examples/pixel-art/src/subscription.ts +2 -2
  79. package/dist/templates/examples/pixel-art/src/update.ts +79 -86
  80. package/dist/templates/examples/query-sync/src/main.ts +106 -102
  81. package/dist/templates/examples/route-transitions/src/data.ts +6 -6
  82. package/dist/templates/examples/route-transitions/src/main.ts +23 -29
  83. package/dist/templates/examples/route-transitions/src/route.ts +3 -3
  84. package/dist/templates/examples/routing/src/fileTree.ts +10 -8
  85. package/dist/templates/examples/routing/src/main.ts +23 -21
  86. package/dist/templates/examples/routing/src/page/people.ts +14 -22
  87. package/dist/templates/examples/routing/src/route.ts +7 -7
  88. package/dist/templates/examples/shopping-cart/src/main.ts +30 -31
  89. package/dist/templates/examples/shopping-cart/src/page/products.ts +10 -10
  90. package/dist/templates/examples/shopping-cart/src/route.ts +6 -4
  91. package/dist/templates/examples/slow-warnings/src/main.ts +35 -43
  92. package/dist/templates/examples/snake/src/domain/snake.ts +2 -2
  93. package/dist/templates/examples/snake/src/main.ts +39 -47
  94. package/dist/templates/examples/ssg/src/main.ts +5 -5
  95. package/dist/templates/examples/ssg/src/route.ts +2 -2
  96. package/dist/templates/examples/ssr/src/cookie.ts +3 -3
  97. package/dist/templates/examples/ssr/src/main.ts +10 -10
  98. package/dist/templates/examples/state-machine/src/main.ts +55 -53
  99. package/dist/templates/examples/state-machine/src/view.ts +7 -7
  100. package/dist/templates/examples/stopwatch/src/main.ts +10 -10
  101. package/dist/templates/examples/todo/src/main.ts +41 -34
  102. package/dist/templates/examples/ui-showcase/src/main.ts +54 -42
  103. package/dist/templates/examples/ui-showcase/src/scene.test.ts +1 -1
  104. package/dist/templates/examples/ui-showcase/src/ui/init.ts +1 -2
  105. package/dist/templates/examples/ui-showcase/src/ui/message.ts +17 -18
  106. package/dist/templates/examples/ui-showcase/src/ui/model.ts +47 -44
  107. package/dist/templates/examples/ui-showcase/src/ui/subscriptions.ts +1 -1
  108. package/dist/templates/examples/ui-showcase/src/ui/toast.ts +4 -4
  109. package/dist/templates/examples/ui-showcase/src/ui/update.ts +287 -298
  110. package/dist/templates/examples/ui-showcase/src/ui/view/animation.ts +2 -2
  111. package/dist/templates/examples/ui-showcase/src/ui/view/button.ts +1 -1
  112. package/dist/templates/examples/ui-showcase/src/ui/view/calendar.ts +4 -4
  113. package/dist/templates/examples/ui-showcase/src/ui/view/checkbox.ts +1 -1
  114. package/dist/templates/examples/ui-showcase/src/ui/view/combobox.ts +1 -1
  115. package/dist/templates/examples/ui-showcase/src/ui/view/datePicker.ts +4 -4
  116. package/dist/templates/examples/ui-showcase/src/ui/view/dialog.ts +1 -1
  117. package/dist/templates/examples/ui-showcase/src/ui/view/disclosure.ts +1 -1
  118. package/dist/templates/examples/ui-showcase/src/ui/view/dragAndDrop.ts +1 -1
  119. package/dist/templates/examples/ui-showcase/src/ui/view/fieldset.ts +1 -1
  120. package/dist/templates/examples/ui-showcase/src/ui/view/fileDrop.ts +6 -6
  121. package/dist/templates/examples/ui-showcase/src/ui/view/hoverIntent.ts +9 -20
  122. package/dist/templates/examples/ui-showcase/src/ui/view/input.ts +1 -1
  123. package/dist/templates/examples/ui-showcase/src/ui/view/listbox.ts +1 -1
  124. package/dist/templates/examples/ui-showcase/src/ui/view/menu.ts +15 -15
  125. package/dist/templates/examples/ui-showcase/src/ui/view/popover.ts +1 -1
  126. package/dist/templates/examples/ui-showcase/src/ui/view/radioGroup.ts +1 -1
  127. package/dist/templates/examples/ui-showcase/src/ui/view/select.ts +1 -1
  128. package/dist/templates/examples/ui-showcase/src/ui/view/slider.ts +1 -1
  129. package/dist/templates/examples/ui-showcase/src/ui/view/switch.ts +1 -1
  130. package/dist/templates/examples/ui-showcase/src/ui/view/tabs.ts +7 -7
  131. package/dist/templates/examples/ui-showcase/src/ui/view/textarea.ts +1 -1
  132. package/dist/templates/examples/ui-showcase/src/ui/view/toast.ts +8 -8
  133. package/dist/templates/examples/ui-showcase/src/ui/view/tooltip.ts +1 -1
  134. package/dist/templates/examples/ui-showcase/src/ui/view/virtualList.ts +7 -7
  135. package/dist/templates/examples/view-transitions/src/artwork.ts +7 -7
  136. package/dist/templates/examples/view-transitions/src/main.ts +6 -6
  137. package/dist/templates/examples/view-transitions/src/route.ts +3 -3
  138. package/dist/templates/examples/weather/src/main.ts +42 -42
  139. package/dist/templates/examples/weather/src/story.test.ts +5 -5
  140. package/dist/templates/examples/web-components/src/main.ts +16 -16
  141. package/dist/templates/examples/websocket-chat/src/main.ts +30 -30
  142. package/dist/templates/release.json +13 -13
  143. package/dist/templates/rendering/ssg/src/main.ts +5 -5
  144. package/dist/templates/rendering/ssg/src/route.ts +2 -2
  145. package/dist/templates/rendering/ssr/server/main.ts +15 -15
  146. package/dist/templates/rendering/ssr/src/cookie.ts +3 -3
  147. package/dist/templates/rendering/ssr/src/main.ts +10 -10
  148. package/dist/utils/packages.js +17 -0
  149. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { Array, Match as M, Number, Option, Result } from 'effect'
1
+ import { Array, Number, Option, Result } from 'effect'
2
2
  import { Command, Update } from 'foldkit'
3
3
  import { evo } from 'foldkit/struct'
4
4
 
@@ -223,14 +223,13 @@ const appendGeneratedParticle =
223
223
  }
224
224
  }
225
225
 
226
- const foldFlowStrengthSliderOutMessage = M.type<Slider.OutMessage>().pipe(
227
- M.withReturnType<Update.Step<Model, Message>>(),
228
- M.tagsExhaustive({
229
- ChangedValue:
230
- ({ value }) =>
231
- model => ({ model: evo(model, { flowStrength: () => value }) }),
232
- }),
233
- )
226
+ const foldFlowStrengthSliderOutMessage = Slider.OutMessage.match<
227
+ Update.Step<Model, Message>
228
+ >({
229
+ ChangedValue:
230
+ ({ value }) =>
231
+ model => ({ model: evo(model, { flowStrength: () => value }) }),
232
+ })
234
233
 
235
234
  const foldFlowStrengthSlider = Update.foldChild({
236
235
  update: Slider.update,
@@ -241,14 +240,13 @@ const foldFlowStrengthSlider = Update.foldChild({
241
240
  foldOutMessage: foldFlowStrengthSliderOutMessage,
242
241
  })
243
242
 
244
- const foldNoiseScaleSliderOutMessage = M.type<Slider.OutMessage>().pipe(
245
- M.withReturnType<Update.Step<Model, Message>>(),
246
- M.tagsExhaustive({
247
- ChangedValue:
248
- ({ value }) =>
249
- model => ({ model: evo(model, { noiseScale: () => value }) }),
250
- }),
251
- )
243
+ const foldNoiseScaleSliderOutMessage = Slider.OutMessage.match<
244
+ Update.Step<Model, Message>
245
+ >({
246
+ ChangedValue:
247
+ ({ value }) =>
248
+ model => ({ model: evo(model, { noiseScale: () => value }) }),
249
+ })
252
250
 
253
251
  const foldNoiseScaleSlider = Update.foldChild({
254
252
  update: Slider.update,
@@ -3,10 +3,10 @@ import {
3
3
  Array,
4
4
  Duration,
5
5
  Effect,
6
- Match as M,
6
+ Match,
7
7
  Number,
8
8
  Option,
9
- Schema as S,
9
+ Schema,
10
10
  pipe,
11
11
  } from 'effect'
12
12
  import { Command, Runtime, type Update } from 'foldkit'
@@ -16,20 +16,20 @@ import { evo } from 'foldkit/struct'
16
16
 
17
17
  // MODEL
18
18
 
19
- export const UploadStatus = S.Literals(['Uploading', 'Done', 'Cancelled'])
19
+ export const UploadStatus = Schema.Literals(['Uploading', 'Done', 'Cancelled'])
20
20
  export type UploadStatus = typeof UploadStatus.Type
21
21
 
22
- export const Upload = S.Struct({
23
- id: S.Number,
24
- fileName: S.String,
25
- sizeMegabytes: S.Number,
22
+ export const Upload = Schema.Struct({
23
+ id: Schema.Number,
24
+ fileName: Schema.String,
25
+ sizeMegabytes: Schema.Number,
26
26
  status: UploadStatus,
27
27
  })
28
28
  export type Upload = typeof Upload.Type
29
29
 
30
- export const Model = S.Struct({
31
- uploadId: S.Number,
32
- uploads: S.Array(Upload),
30
+ export const Model = Schema.Struct({
31
+ uploadId: Schema.Number,
32
+ uploads: Schema.Array(Upload),
33
33
  })
34
34
  export type Model = typeof Model.Type
35
35
 
@@ -37,12 +37,12 @@ export type Model = typeof Model.Type
37
37
 
38
38
  export const Message = defineMessageUnion({
39
39
  ClickedStartUpload: {},
40
- ClickedCancelUpload: { uploadId: S.Number },
40
+ ClickedCancelUpload: { uploadId: Schema.Number },
41
41
  ClickedCancelAllUploads: {},
42
- ClickedRestartUpload: { uploadId: S.Number },
43
- SucceededUploadFile: { uploadId: S.Number },
42
+ ClickedRestartUpload: { uploadId: Schema.Number },
43
+ SucceededUploadFile: { uploadId: Schema.Number },
44
44
  CompletedCancelUploadFile: {
45
- uploadId: S.Number,
45
+ uploadId: Schema.Number,
46
46
  outcome: Command.Interruptible.Outcome,
47
47
  },
48
48
  })
@@ -62,7 +62,10 @@ export const init: Runtime.ApplicationInit<Model, Message> = () => ({
62
62
 
63
63
  // FAKE FILES
64
64
 
65
- export const FakeFile = S.Struct({ name: S.String, sizeMegabytes: S.Number })
65
+ export const FakeFile = Schema.Struct({
66
+ name: Schema.String,
67
+ sizeMegabytes: Schema.Number,
68
+ })
66
69
  export type FakeFile = typeof FakeFile.Type
67
70
 
68
71
  export const FAKE_FILES: Array.NonEmptyReadonlyArray<FakeFile> = [
@@ -84,11 +87,11 @@ const fakeFileForUpload = (uploadId: number): FakeFile =>
84
87
 
85
88
  const MILLISECONDS_PER_MEGABYTE = 100
86
89
 
87
- export const UploadKey = S.Struct({ uploadId: S.Number })
90
+ export const UploadKey = Schema.Struct({ uploadId: Schema.Number })
88
91
  export type UploadKey = typeof UploadKey.Type
89
92
 
90
93
  export const UploadFile = Command.define('UploadFile', {
91
- args: { ...UploadKey.fields, sizeMegabytes: S.Number },
94
+ args: { ...UploadKey.fields, sizeMegabytes: Schema.Number },
92
95
  messages: [Message.SucceededUploadFile],
93
96
  interrupt: {
94
97
  keyFields: ['uploadId'],
@@ -194,19 +197,19 @@ export const update = (model: Model, message: Message) =>
194
197
  // VIEW
195
198
 
196
199
  const badgeClass = (status: UploadStatus): string =>
197
- M.value(status).pipe(
198
- M.when('Uploading', () => 'bg-blue-100 text-blue-700'),
199
- M.when('Done', () => 'bg-green-100 text-green-700'),
200
- M.when('Cancelled', () => 'bg-gray-200 text-gray-600'),
201
- M.exhaustive,
200
+ Match.value(status).pipe(
201
+ Match.when('Uploading', () => 'bg-blue-100 text-blue-700'),
202
+ Match.when('Done', () => 'bg-green-100 text-green-700'),
203
+ Match.when('Cancelled', () => 'bg-gray-200 text-gray-600'),
204
+ Match.exhaustive,
202
205
  )
203
206
 
204
207
  const ACTION_BUTTON_CLASS =
205
208
  'px-3 py-1 text-sm font-medium rounded-md border transition'
206
209
 
207
210
  const uploadActionView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
208
- M.value(upload.status).pipe(
209
- M.when('Uploading', () =>
211
+ Match.value(upload.status).pipe(
212
+ Match.when('Uploading', () =>
210
213
  h.keyed('button')(
211
214
  'Uploading',
212
215
  [
@@ -222,7 +225,7 @@ const uploadActionView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
222
225
  ['Cancel'],
223
226
  ),
224
227
  ),
225
- M.when('Cancelled', () =>
228
+ Match.when('Cancelled', () =>
226
229
  h.keyed('button')(
227
230
  'Cancelled',
228
231
  [
@@ -238,8 +241,8 @@ const uploadActionView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
238
241
  ['Restart'],
239
242
  ),
240
243
  ),
241
- M.when('Done', () => h.empty),
242
- M.exhaustive,
244
+ Match.when('Done', () => h.empty),
245
+ Match.exhaustive,
243
246
  )
244
247
 
245
248
  const uploadView = (upload: Upload, h: HtmlBuilder<Message>): Html =>
@@ -1,6 +1,6 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
 
3
- export const ProficiencyLevel = S.Literals([
3
+ export const ProficiencyLevel = Schema.Literals([
4
4
  'Beginner',
5
5
  'Intermediate',
6
6
  'Advanced',
@@ -1,6 +1,6 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
 
3
- export const PronounOption = S.Literals([
3
+ export const PronounOption = Schema.Literals([
4
4
  'He/Him',
5
5
  'She/Her',
6
6
  'They/Them',
@@ -1,6 +1,6 @@
1
- import { Match as M, Schema as S } from 'effect'
1
+ import { Match, Schema } from 'effect'
2
2
 
3
- export const Step = S.Literals([
3
+ export const Step = Schema.Literals([
4
4
  'PersonalInfo',
5
5
  'WorkHistory',
6
6
  'Education',
@@ -16,13 +16,13 @@ export const all = Step.literals
16
16
  export const indexOf = (step: Step): number => all.indexOf(step)
17
17
 
18
18
  export const show = (step: Step): string =>
19
- M.value(step).pipe(
20
- M.when('PersonalInfo', () => 'Personal Info'),
21
- M.when('WorkHistory', () => 'Work History'),
22
- M.when('Education', () => 'Education'),
23
- M.when('Skills', () => 'Skills'),
24
- M.when('CoverLetter', () => 'Cover Letter'),
25
- M.when('Attachments', () => 'Attachments'),
26
- M.when('Review', () => 'Review'),
27
- M.exhaustive,
19
+ Match.value(step).pipe(
20
+ Match.when('PersonalInfo', () => 'Personal Info'),
21
+ Match.when('WorkHistory', () => 'Work History'),
22
+ Match.when('Education', () => 'Education'),
23
+ Match.when('Skills', () => 'Skills'),
24
+ Match.when('CoverLetter', () => 'Cover Letter'),
25
+ Match.when('Attachments', () => 'Attachments'),
26
+ Match.when('Review', () => 'Review'),
27
+ Match.exhaustive,
28
28
  )
@@ -1,4 +1,4 @@
1
- import { Crypto, Effect, Schema as S } from 'effect'
1
+ import { Crypto, Effect, Schema } from 'effect'
2
2
  import { Calendar, Runtime } from 'foldkit'
3
3
 
4
4
  import { BrowserCrypto } from '@effect/platform-browser'
@@ -19,11 +19,11 @@ import { view } from './view'
19
19
 
20
20
  // FLAGS
21
21
 
22
- export const Flags = S.Struct({
22
+ export const Flags = Schema.Struct({
23
23
  today: Calendar.CalendarDate,
24
- initialWorkHistoryEntryId: S.String,
25
- initialEducationEntryId: S.String,
26
- initialSkillsEntryId: S.String,
24
+ initialWorkHistoryEntryId: Schema.String,
25
+ initialEducationEntryId: Schema.String,
26
+ initialSkillsEntryId: Schema.String,
27
27
  })
28
28
  export type Flags = typeof Flags.Type
29
29
 
@@ -1,4 +1,4 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
  import { defineMessageUnion } from 'foldkit/message'
3
3
 
4
4
  import { Menu, Tabs } from '@foldkit/ui'
@@ -38,7 +38,7 @@ export const Message = defineMessageUnion({
38
38
  ToggledPreview: {},
39
39
  ClickedSubmit: {},
40
40
  SucceededSubmitApplication: {},
41
- FailedSubmitApplication: { error: S.String },
41
+ FailedSubmitApplication: { error: Schema.String },
42
42
  })
43
43
 
44
44
  export type Message = typeof Message.Type
@@ -1,4 +1,4 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
  import { defineTaggedUnion } from 'foldkit/schema'
3
3
 
4
4
  import { Menu, Tabs } from '@foldkit/ui'
@@ -19,13 +19,13 @@ export const Submission = defineTaggedUnion({
19
19
  NotSubmitted: {},
20
20
  Submitting: {},
21
21
  SubmitSuccess: {},
22
- SubmitError: { error: S.String },
22
+ SubmitError: { error: Schema.String },
23
23
  })
24
24
  export type Submission = typeof Submission.Type
25
25
 
26
26
  // MODEL
27
27
 
28
- export const Model = S.Struct({
28
+ export const Model = Schema.Struct({
29
29
  currentStep: Step.Step,
30
30
  personalInfo: PersonalInfo.Model,
31
31
  workHistory: WorkHistory.Model,
@@ -33,10 +33,10 @@ export const Model = S.Struct({
33
33
  skills: Skills.Model,
34
34
  coverLetter: CoverLetter.Model,
35
35
  attachments: Attachments.Model,
36
- isPreviewVisible: S.Boolean,
36
+ isPreviewVisible: Schema.Boolean,
37
37
  submission: Submission,
38
38
  stepMenu: Menu.Model,
39
39
  stepTabs: Tabs.Model,
40
- isSubmitAttempted: S.Boolean,
40
+ isSubmitAttempted: Schema.Boolean,
41
41
  })
42
42
  export type Model = typeof Model.Type
@@ -1,4 +1,4 @@
1
- import { Array, Match as M, Option, Schema as S, pipe } from 'effect'
1
+ import { Array, Option, Schema, pipe } from 'effect'
2
2
  import { File, Update } from 'foldkit'
3
3
  import { defineMessageUnion } from 'foldkit/message'
4
4
  import { evo } from 'foldkit/struct'
@@ -7,11 +7,11 @@ import { FileDrop } from '@foldkit/ui'
7
7
 
8
8
  // MODEL
9
9
 
10
- export const Model = S.Struct({
10
+ export const Model = Schema.Struct({
11
11
  resumeDrop: FileDrop.Model,
12
- maybeResume: S.Option(File.File),
12
+ maybeResume: Schema.Option(File.File),
13
13
  additionalFilesDrop: FileDrop.Model,
14
- additionalFiles: S.Array(File.File),
14
+ additionalFiles: Schema.Array(File.File),
15
15
  })
16
16
  export type Model = typeof Model.Type
17
17
 
@@ -21,7 +21,7 @@ export const Message = defineMessageUnion({
21
21
  GotResumeDropMessage: { message: FileDrop.Message },
22
22
  GotAdditionalFilesDropMessage: { message: FileDrop.Message },
23
23
  RemovedResume: {},
24
- RemovedAdditionalFile: { fileIndex: S.Number },
24
+ RemovedAdditionalFile: { fileIndex: Schema.Number },
25
25
  })
26
26
 
27
27
  export type Message = typeof Message.Type
@@ -37,24 +37,23 @@ export const init = (): Model => ({
37
37
 
38
38
  // UPDATE
39
39
 
40
- const foldResumeDropOutMessage = M.type<FileDrop.OutMessage>().pipe(
41
- M.withReturnType<Update.Step<Model, Message>>(),
42
- M.tagsExhaustive({
43
- ReceivedFiles:
44
- ({ files }) =>
45
- model => ({
46
- model: evo(model, {
47
- maybeResume: () =>
48
- pipe(
49
- files,
50
- Array.head,
51
- Option.orElse(() => model.maybeResume),
52
- ),
53
- }),
40
+ const foldResumeDropOutMessage = FileDrop.OutMessage.match<
41
+ Update.Step<Model, Message>
42
+ >({
43
+ ReceivedFiles:
44
+ ({ files }) =>
45
+ model => ({
46
+ model: evo(model, {
47
+ maybeResume: () =>
48
+ pipe(
49
+ files,
50
+ Array.head,
51
+ Option.orElse(() => model.maybeResume),
52
+ ),
54
53
  }),
55
- RejectedNonFiles: () => model => ({ model }),
56
- }),
57
- )
54
+ }),
55
+ RejectedNonFiles: () => model => ({ model }),
56
+ })
58
57
 
59
58
  const foldResumeDrop = Update.foldChild({
60
59
  update: FileDrop.update,
@@ -65,19 +64,18 @@ const foldResumeDrop = Update.foldChild({
65
64
  foldOutMessage: foldResumeDropOutMessage,
66
65
  })
67
66
 
68
- const foldAdditionalFilesDropOutMessage = M.type<FileDrop.OutMessage>().pipe(
69
- M.withReturnType<Update.Step<Model, Message>>(),
70
- M.tagsExhaustive({
71
- ReceivedFiles:
72
- ({ files }) =>
73
- model => ({
74
- model: evo(model, {
75
- additionalFiles: Array.appendAll(files),
76
- }),
67
+ const foldAdditionalFilesDropOutMessage = FileDrop.OutMessage.match<
68
+ Update.Step<Model, Message>
69
+ >({
70
+ ReceivedFiles:
71
+ ({ files }) =>
72
+ model => ({
73
+ model: evo(model, {
74
+ additionalFiles: Array.appendAll(files),
77
75
  }),
78
- RejectedNonFiles: () => model => ({ model }),
79
- }),
80
- )
76
+ }),
77
+ RejectedNonFiles: () => model => ({ model }),
78
+ })
81
79
 
82
80
  const foldAdditionalFilesDrop = Update.foldChild({
83
81
  update: FileDrop.update,
@@ -1,19 +1,19 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
  import { type Update } from 'foldkit'
3
3
  import { defineMessageUnion } from 'foldkit/message'
4
4
  import { evo } from 'foldkit/struct'
5
5
 
6
6
  // MODEL
7
7
 
8
- export const Model = S.Struct({
9
- content: S.String,
8
+ export const Model = Schema.Struct({
9
+ content: Schema.String,
10
10
  })
11
11
  export type Model = typeof Model.Type
12
12
 
13
13
  // MESSAGE
14
14
 
15
15
  export const Message = defineMessageUnion({
16
- UpdatedContent: { value: S.String },
16
+ UpdatedContent: { value: Schema.String },
17
17
  })
18
18
 
19
19
  export type Message = typeof Message.Type
@@ -1,4 +1,4 @@
1
- import { Array, Crypto, Effect, Match as M, Schema as S } from 'effect'
1
+ import { Array, Crypto, Effect, Schema } from 'effect'
2
2
  import { Calendar, Command, Update } from 'foldkit'
3
3
  import { type CalendarDate } from 'foldkit/calendar'
4
4
  import { defineMessageUnion } from 'foldkit/message'
@@ -10,8 +10,8 @@ import * as Entry from './entry'
10
10
 
11
11
  // MODEL
12
12
 
13
- export const Model = S.Struct({
14
- entries: S.Array(Entry.Model),
13
+ export const Model = Schema.Struct({
14
+ entries: Schema.Array(Entry.Model),
15
15
  today: Calendar.CalendarDate,
16
16
  })
17
17
  export type Model = typeof Model.Type
@@ -20,11 +20,11 @@ export type Model = typeof Model.Type
20
20
 
21
21
  export const Message = defineMessageUnion({
22
22
  ClickedAddEntry: {},
23
- SucceededGenerateEntryId: { entryId: S.String },
23
+ SucceededGenerateEntryId: { entryId: Schema.String },
24
24
  FailedGenerateEntryId: {},
25
- RemovedEntry: { entryId: S.String },
25
+ RemovedEntry: { entryId: Schema.String },
26
26
  GotEntryMessage: {
27
- entryId: S.String,
27
+ entryId: Schema.String,
28
28
  message: Entry.Message,
29
29
  },
30
30
  })
@@ -57,16 +57,13 @@ export const GenerateEntryId = Command.define('GenerateEntryId', {
57
57
  const foldEntryOutMessage: (
58
58
  entryId: string,
59
59
  ) => (outMessage: Entry.OutMessage) => Update.Step<Model, Message> = entryId =>
60
- M.type<Entry.OutMessage>().pipe(
61
- M.withReturnType<Update.Step<Model, Message>>(),
62
- M.tagsExhaustive({
63
- Removed: () => model => ({
64
- model: evo(model, {
65
- entries: Array.filter(entry => entry.id !== entryId),
66
- }),
60
+ Entry.OutMessage.match<Update.Step<Model, Message>>({
61
+ Removed: () => model => ({
62
+ model: evo(model, {
63
+ entries: Array.filter(entry => entry.id !== entryId),
67
64
  }),
68
65
  }),
69
- )
66
+ })
70
67
 
71
68
  const foldEntry = (entryId: string) =>
72
69
  Update.foldChild({
@@ -1,4 +1,4 @@
1
- import { Match as M, Option, Schema as S } from 'effect'
1
+ import { Option, Schema } from 'effect'
2
2
  import { Update } from 'foldkit'
3
3
  import {
4
4
  Field,
@@ -35,14 +35,14 @@ const validateFieldOfStudy = validate(fieldOfStudyRules)
35
35
 
36
36
  // MODEL
37
37
 
38
- export const Model = S.Struct({
39
- id: S.String,
40
- school: Field(S.String),
41
- degree: Field(S.String),
42
- fieldOfStudy: Field(S.String),
43
- maybeGraduationYear: S.Option(S.String),
38
+ export const Model = Schema.Struct({
39
+ id: Schema.String,
40
+ school: Field(Schema.String),
41
+ degree: Field(Schema.String),
42
+ fieldOfStudy: Field(Schema.String),
43
+ maybeGraduationYear: Schema.Option(Schema.String),
44
44
  graduationYearListbox: Listbox.Model,
45
- isCurrentlyEnrolled: S.Boolean,
45
+ isCurrentlyEnrolled: Schema.Boolean,
46
46
  })
47
47
  export type Model = typeof Model.Type
48
48
 
@@ -51,11 +51,11 @@ const GraduationYearListbox = Listbox.create<string>()
51
51
  // MESSAGE
52
52
 
53
53
  export const Message = defineMessageUnion({
54
- UpdatedSchool: { value: S.String },
55
- UpdatedDegree: { value: S.String },
56
- UpdatedFieldOfStudy: { value: S.String },
54
+ UpdatedSchool: { value: Schema.String },
55
+ UpdatedDegree: { value: Schema.String },
56
+ UpdatedFieldOfStudy: { value: Schema.String },
57
57
  GotGraduationYearListboxMessage: { message: Listbox.Message },
58
- ToggledCurrentlyEnrolled: { isChecked: S.Boolean },
58
+ ToggledCurrentlyEnrolled: { isChecked: Schema.Boolean },
59
59
  ClickedRemoveSelf: {},
60
60
  })
61
61
 
@@ -87,16 +87,15 @@ export const init = (entryId: string): Model => ({
87
87
 
88
88
  // UPDATE
89
89
 
90
- const foldGraduationYearListboxOutMessage = M.type<Listbox.OutMessage>().pipe(
91
- M.withReturnType<Update.Step<Model, Message>>(),
92
- M.tagsExhaustive({
93
- Selected:
94
- ({ value }) =>
95
- model => ({
96
- model: evo(model, { maybeGraduationYear: () => Option.some(value) }),
97
- }),
98
- }),
99
- )
90
+ const foldGraduationYearListboxOutMessage = Listbox.OutMessage.match<
91
+ Update.Step<Model, Message>
92
+ >({
93
+ Selected:
94
+ ({ value }) =>
95
+ model => ({
96
+ model: evo(model, { maybeGraduationYear: () => Option.some(value) }),
97
+ }),
98
+ })
100
99
 
101
100
  const foldGraduationYearListbox = Update.foldChild({
102
101
  update: GraduationYearListbox.update,