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,13 +1,13 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
  import { AsyncData } from 'foldkit'
3
3
 
4
4
  import { RadioGroup } from '@foldkit/ui'
5
5
 
6
6
  import { ChartMode, PackageId, Period, Telemetry } from './domain'
7
7
 
8
- export const TelemetryAsyncData = AsyncData.Schema(Telemetry, S.String)
8
+ export const TelemetryAsyncData = AsyncData.Schema(Telemetry, Schema.String)
9
9
 
10
- export const Model = S.Struct({
10
+ export const Model = Schema.Struct({
11
11
  telemetry: TelemetryAsyncData.schema,
12
12
  chartMode: ChartMode,
13
13
  chartModeRadioGroup: RadioGroup.Model,
@@ -15,8 +15,8 @@ export const Model = S.Struct({
15
15
  packageRadioGroup: RadioGroup.Model,
16
16
  period: Period,
17
17
  periodRadioGroup: RadioGroup.Model,
18
- maybeChartHostId: S.Option(S.String),
19
- maybeChartError: S.Option(S.String),
20
- maybeSelectedDatumId: S.Option(S.String),
18
+ maybeChartHostId: Schema.Option(Schema.String),
19
+ maybeChartError: Schema.Option(Schema.String),
20
+ maybeSelectedDatumId: Schema.Option(Schema.String),
21
21
  })
22
22
  export type Model = typeof Model.Type
@@ -1,4 +1,4 @@
1
- import { Context, Effect, Layer, Schema as S } from 'effect'
1
+ import { Context, Effect, Layer, Schema } from 'effect'
2
2
  import { HttpClient } from 'effect/unstable/http'
3
3
 
4
4
  import type { PackageSpec } from './domain'
@@ -11,27 +11,31 @@ const NPM_REGISTRY_API = 'https://registry.npmjs.org'
11
11
 
12
12
  // SCHEMA
13
13
 
14
- export const NpmDownloadDay = S.Struct({
15
- day: S.String,
16
- downloads: S.Number,
14
+ export const NpmDownloadDay = Schema.Struct({
15
+ day: Schema.String,
16
+ downloads: Schema.Number,
17
17
  })
18
18
 
19
- export const NpmDownloadsResponse = S.Struct({
20
- downloads: S.Array(NpmDownloadDay),
19
+ export const NpmDownloadsResponse = Schema.Struct({
20
+ downloads: Schema.Array(NpmDownloadDay),
21
21
  })
22
22
 
23
- export const NpmVersionMetadata = S.Struct({
24
- dependencies: S.OptionFromOptional(S.Record(S.String, S.String)),
25
- peerDependencies: S.OptionFromOptional(S.Record(S.String, S.String)),
23
+ export const NpmVersionMetadata = Schema.Struct({
24
+ dependencies: Schema.OptionFromOptional(
25
+ Schema.Record(Schema.String, Schema.String),
26
+ ),
27
+ peerDependencies: Schema.OptionFromOptional(
28
+ Schema.Record(Schema.String, Schema.String),
29
+ ),
26
30
  })
27
31
  export type NpmVersionMetadata = typeof NpmVersionMetadata.Type
28
32
 
29
- export const NpmPackument = S.Struct({
30
- name: S.String,
31
- time: S.Record(S.String, S.String),
32
- versions: S.Record(S.String, NpmVersionMetadata),
33
- 'dist-tags': S.Struct({
34
- latest: S.String,
33
+ export const NpmPackument = Schema.Struct({
34
+ name: Schema.String,
35
+ time: Schema.Record(Schema.String, Schema.String),
36
+ versions: Schema.Record(Schema.String, NpmVersionMetadata),
37
+ 'dist-tags': Schema.Struct({
38
+ latest: Schema.String,
35
39
  }),
36
40
  })
37
41
 
@@ -1,18 +1,18 @@
1
- import { Effect, Option, Queue, Schema as S, Stream, pipe } from 'effect'
1
+ import { Effect, Option, Queue, Schema, Stream, pipe } from 'effect'
2
2
  import { Subscription } from 'foldkit'
3
3
 
4
4
  import { getChart } from './chartHost'
5
5
  import { Message } from './message'
6
6
  import type { Model } from './model'
7
7
 
8
- const ChartClickPayload = S.Struct({
9
- data: S.OptionFromOptional(S.Struct({ id: S.String })),
8
+ const ChartClickPayload = Schema.Struct({
9
+ data: Schema.OptionFromOptional(Schema.Struct({ id: Schema.String })),
10
10
  })
11
11
 
12
12
  const chartClickToDatumId = (event: unknown): Option.Option<string> =>
13
13
  pipe(
14
14
  event,
15
- S.decodeUnknownOption(ChartClickPayload),
15
+ Schema.decodeUnknownOption(ChartClickPayload),
16
16
  Option.flatMap(({ data }) => data),
17
17
  Option.map(({ id }) => id),
18
18
  )
@@ -55,7 +55,7 @@ const chartEvents = (hostId: string): Stream.Stream<Message> =>
55
55
 
56
56
  export const subscriptions = Subscription.make<Model, Message>()(entry => ({
57
57
  chartEvents: entry(
58
- { maybeChartHostId: S.Option(S.String) },
58
+ { maybeChartHostId: Schema.Option(Schema.String) },
59
59
  {
60
60
  modelToDependencies: model => ({
61
61
  maybeChartHostId: model.maybeChartHostId,
@@ -1,4 +1,4 @@
1
- import { Array, Effect, Layer, Match as M, String } from 'effect'
1
+ import { Array, Effect, Layer, Match, String } from 'effect'
2
2
  import { HttpClient, HttpClientResponse } from 'effect/unstable/http'
3
3
  import { expect, test } from 'vitest'
4
4
 
@@ -14,13 +14,16 @@ import { fetchRawTelemetry, transformTelemetry } from './telemetry'
14
14
  test('folds public API responses into a Telemetry value', async () => {
15
15
  const mockClient = HttpClient.make(request =>
16
16
  Effect.sync(() => {
17
- const body = M.value(request.url).pipe(
18
- M.when(String.includes('/contributors'), () => [
17
+ const body = Match.value(request.url).pipe(
18
+ Match.when(String.includes('/contributors'), () => [
19
19
  { login: 'devin', contributions: 42 },
20
20
  ]),
21
- M.when(String.includes('/issues'), () => [{}, { pull_request: {} }]),
22
- M.when(String.includes('/pulls'), () => [{ id: 1 }]),
23
- M.when(String.includes('/releases'), () => [
21
+ Match.when(String.includes('/issues'), () => [
22
+ {},
23
+ { pull_request: {} },
24
+ ]),
25
+ Match.when(String.includes('/pulls'), () => [{ id: 1 }]),
26
+ Match.when(String.includes('/releases'), () => [
24
27
  {
25
28
  tag_name: 'v0.115.0',
26
29
  published_at: '2026-06-20T12:00:00Z',
@@ -28,18 +31,21 @@ test('folds public API responses into a Telemetry value', async () => {
28
31
  draft: false,
29
32
  },
30
33
  ]),
31
- M.when(String.includes('/stargazers'), () => [
34
+ Match.when(String.includes('/stargazers'), () => [
32
35
  { starred_at: '2026-06-15T12:00:00Z' },
33
36
  ]),
34
- M.when(String.includes('/stats/commit_activity'), () => [
37
+ Match.when(String.includes('/stats/commit_activity'), () => [
35
38
  { week: 1781481600, total: 5 },
36
39
  ]),
37
- M.when(String.includes('/stats/code_frequency'), () => [
40
+ Match.when(String.includes('/stats/code_frequency'), () => [
38
41
  [1781481600, 120, -35],
39
42
  ]),
40
- M.when(String.includes('api.npmjs.org'), () => mockNpmDownloads),
41
- M.when(String.includes('registry.npmjs.org'), () => mockNpmPackument),
42
- M.orElse(() => mockGitHubRepository),
43
+ Match.when(String.includes('api.npmjs.org'), () => mockNpmDownloads),
44
+ Match.when(
45
+ String.includes('registry.npmjs.org'),
46
+ () => mockNpmPackument,
47
+ ),
48
+ Match.orElse(() => mockGitHubRepository),
43
49
  )
44
50
 
45
51
  return HttpClientResponse.fromWeb(
@@ -1,12 +1,4 @@
1
- import {
2
- Array,
3
- Clock,
4
- Effect,
5
- Option,
6
- Order,
7
- Record as Record_,
8
- pipe,
9
- } from 'effect'
1
+ import { Array, Clock, Effect, Option, Order, Record, pipe } from 'effect'
10
2
 
11
3
  import {
12
4
  ContributorSummary,
@@ -109,19 +101,20 @@ const lastWeekDownloads = (
109
101
  }),
110
102
  )
111
103
 
112
- const recordSize = (record: Readonly<Record<string, string>>): number =>
113
- Array.length(Record_.keys(record))
104
+ const recordSize = (
105
+ record: Readonly<globalThis.Record<string, string>>,
106
+ ): number => Array.length(Record.keys(record))
114
107
 
115
108
  const dependenciesOrEmpty = (
116
- maybeDependencies: Option.Option<Readonly<Record<string, string>>>,
117
- ): Readonly<Record<string, string>> =>
118
- Option.getOrElse(maybeDependencies, Record_.empty<string, string>)
109
+ maybeDependencies: Option.Option<Readonly<globalThis.Record<string, string>>>,
110
+ ): Readonly<globalThis.Record<string, string>> =>
111
+ Option.getOrElse(maybeDependencies, Record.empty<string, string>)
119
112
 
120
113
  const latestMetadata = (
121
114
  packument: typeof NpmPackument.Type,
122
115
  ): NpmVersionMetadata =>
123
116
  Option.getOrElse(
124
- Record_.get(packument.versions, packument['dist-tags'].latest),
117
+ Record.get(packument.versions, packument['dist-tags'].latest),
125
118
  () => ({
126
119
  dependencies: Option.none(),
127
120
  peerDependencies: Option.none(),
@@ -137,7 +130,7 @@ export const dependencyEdgesForPackage = (
137
130
 
138
131
  const dependencyEdges = Array.map(
139
132
  Array.filter(packageSpecs, spec =>
140
- Array.contains(Record_.keys(dependencies), spec.npmName),
133
+ Array.contains(Record.keys(dependencies), spec.npmName),
141
134
  ),
142
135
  spec =>
143
136
  DependencyEdge.make({
@@ -149,7 +142,7 @@ export const dependencyEdgesForPackage = (
149
142
 
150
143
  const peerDependencyEdges = Array.map(
151
144
  Array.filter(packageSpecs, spec =>
152
- Array.contains(Record_.keys(peerDependencies), spec.npmName),
145
+ Array.contains(Record.keys(peerDependencies), spec.npmName),
153
146
  ),
154
147
  spec =>
155
148
  DependencyEdge.make({
@@ -178,7 +171,7 @@ export const packageSnapshotFromResponses = (
178
171
  const downloadsByWeek = weeklyDownloads(downloads, weekStarts)
179
172
 
180
173
  const publishedAt = Option.getOrElse(
181
- Record_.get(packument.time, distTags.latest),
174
+ Record.get(packument.time, distTags.latest),
182
175
  () => 'unknown',
183
176
  )
184
177
  const totalDownloads = Array.reduce(
@@ -1,4 +1,4 @@
1
- import { Array, Match as M, Option, Result, pipe } from 'effect'
1
+ import { Array, Option, Result, pipe } from 'effect'
2
2
  import { AsyncData, Command, Update } from 'foldkit'
3
3
  import { evo } from 'foldkit/struct'
4
4
 
@@ -70,14 +70,12 @@ const selectedControl =
70
70
  }
71
71
  }
72
72
 
73
- const foldChartModeRadioGroupOutMessage = M.type<
73
+ const foldChartModeRadioGroupOutMessage = RadioGroup.OutMessage.match<
74
+ Update.Step<Model, Message>,
74
75
  RadioGroup.OutMessage<ChartMode>
75
- >().pipe(
76
- M.withReturnType<Update.Step<Model, Message>>(),
77
- M.tagsExhaustive({
78
- Selected: ({ value }) => selectedControl(evo({ chartMode: () => value })),
79
- }),
80
- )
76
+ >({
77
+ Selected: ({ value }) => selectedControl(evo({ chartMode: () => value })),
78
+ })
81
79
 
82
80
  const foldChartModeRadioGroup = Update.foldChild({
83
81
  update: ChartModeRadioGroup.update,
@@ -89,14 +87,12 @@ const foldChartModeRadioGroup = Update.foldChild({
89
87
  foldOutMessage: foldChartModeRadioGroupOutMessage,
90
88
  })
91
89
 
92
- const foldPeriodRadioGroupOutMessage = M.type<
90
+ const foldPeriodRadioGroupOutMessage = RadioGroup.OutMessage.match<
91
+ Update.Step<Model, Message>,
93
92
  RadioGroup.OutMessage<Period>
94
- >().pipe(
95
- M.withReturnType<Update.Step<Model, Message>>(),
96
- M.tagsExhaustive({
97
- Selected: ({ value }) => selectedControl(evo({ period: () => value })),
98
- }),
99
- )
93
+ >({
94
+ Selected: ({ value }) => selectedControl(evo({ period: () => value })),
95
+ })
100
96
 
101
97
  const foldPeriodRadioGroup = Update.foldChild({
102
98
  update: PeriodRadioGroup.update,
@@ -107,15 +103,13 @@ const foldPeriodRadioGroup = Update.foldChild({
107
103
  foldOutMessage: foldPeriodRadioGroupOutMessage,
108
104
  })
109
105
 
110
- const foldPackageRadioGroupOutMessage = M.type<
106
+ const foldPackageRadioGroupOutMessage = RadioGroup.OutMessage.match<
107
+ Update.Step<Model, Message>,
111
108
  RadioGroup.OutMessage<PackageId>
112
- >().pipe(
113
- M.withReturnType<Update.Step<Model, Message>>(),
114
- M.tagsExhaustive({
115
- Selected: ({ value }) =>
116
- selectedControl(evo({ selectedPackageId: () => value })),
117
- }),
118
- )
109
+ >({
110
+ Selected: ({ value }) =>
111
+ selectedControl(evo({ selectedPackageId: () => value })),
112
+ })
119
113
 
120
114
  const foldPackageRadioGroup = Update.foldChild({
121
115
  update: PackageRadioGroup.update,
@@ -1,5 +1,5 @@
1
1
  import * as echarts from 'echarts/core'
2
- import { Effect, Option, Schema as S } from 'effect'
2
+ import { Effect, Option, Schema } from 'effect'
3
3
  import { Mount } from 'foldkit'
4
4
  import type { Html } from 'foldkit/html'
5
5
  import { HtmlBuilder } from 'foldkit/html'
@@ -54,7 +54,7 @@ const mountChart = (element: Element, hostId: string) =>
54
54
  })
55
55
 
56
56
  export const MountChart = Mount.define('MountChart', {
57
- args: { hostId: S.String },
57
+ args: { hostId: Schema.String },
58
58
  messages: [Message.SucceededMountChart, Message.FailedMountChart],
59
59
  execute: ({ element, hostId }) => mountChart(element, hostId),
60
60
  })
@@ -1,4 +1,4 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
  import { Runtime, type Update } from 'foldkit'
3
3
  import { Document, HtmlBuilder } from 'foldkit/html'
4
4
  import { defineMessageUnion } from 'foldkit/message'
@@ -8,7 +8,7 @@ import { Button } from '@foldkit/ui'
8
8
 
9
9
  // MODEL
10
10
 
11
- export const Model = S.Struct({ count: S.Number })
11
+ export const Model = Schema.Struct({ count: Schema.Number })
12
12
  export type Model = typeof Model.Type
13
13
 
14
14
  // MESSAGE
@@ -1,4 +1,4 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
  import { Submodel, type Update } from 'foldkit'
3
3
  import { defineMessageUnion } from 'foldkit/message'
4
4
  import { evo } from 'foldkit/struct'
@@ -7,7 +7,7 @@ import { Button } from '@foldkit/ui'
7
7
 
8
8
  // MODEL
9
9
 
10
- export const Model = S.Struct({ count: S.Number })
10
+ export const Model = Schema.Struct({ count: Schema.Number })
11
11
  export type Model = typeof Model.Type
12
12
 
13
13
  export const init: Model = { count: 0 }
@@ -1,4 +1,4 @@
1
- import { Array, Option, Schema as S, pipe } from 'effect'
1
+ import { Array, Option, Schema, pipe } from 'effect'
2
2
  import { Runtime, Update } from 'foldkit'
3
3
  import { Document, Html, HtmlBuilder } from 'foldkit/html'
4
4
  import { defineMessageUnion } from 'foldkit/message'
@@ -10,15 +10,15 @@ import * as Counter from './counter'
10
10
 
11
11
  // MODEL
12
12
 
13
- const Row = S.Struct({
14
- id: S.String,
13
+ const Row = Schema.Struct({
14
+ id: Schema.String,
15
15
  counter: Counter.Model,
16
16
  })
17
17
  type Row = typeof Row.Type
18
18
 
19
- export const Model = S.Struct({
20
- rows: S.Array(Row),
21
- nextRowId: S.Number,
19
+ export const Model = Schema.Struct({
20
+ rows: Schema.Array(Row),
21
+ nextRowId: Schema.Number,
22
22
  })
23
23
  export type Model = typeof Model.Type
24
24
 
@@ -26,9 +26,9 @@ export type Model = typeof Model.Type
26
26
 
27
27
  export const Message = defineMessageUnion({
28
28
  ClickedAddRow: {},
29
- ClickedRemoveRow: { id: S.String },
29
+ ClickedRemoveRow: { id: Schema.String },
30
30
  GotCounterMessage: {
31
- id: S.String,
31
+ id: Schema.String,
32
32
  message: Counter.Message,
33
33
  },
34
34
  })
@@ -1,4 +1,4 @@
1
- import { Duration, Effect, Schema as S, Stream } from 'effect'
1
+ import { Duration, Effect, Schema, Stream } from 'effect'
2
2
  import { Command, Port, Runtime, Subscription, type Update } from 'foldkit'
3
3
  import { Html, HtmlBuilder } from 'foldkit/html'
4
4
  import { defineMessageUnion } from 'foldkit/message'
@@ -8,7 +8,10 @@ import { Button } from '@foldkit/ui'
8
8
 
9
9
  // MODEL
10
10
 
11
- export const Model = S.Struct({ count: S.Number, step: S.Number })
11
+ export const Model = Schema.Struct({
12
+ count: Schema.Number,
13
+ step: Schema.Number,
14
+ })
12
15
  export type Model = typeof Model.Type
13
16
 
14
17
  // MESSAGE
@@ -16,7 +19,7 @@ export type Model = typeof Model.Type
16
19
  export const Message = defineMessageUnion({
17
20
  Ticked: {},
18
21
  ClickedAdvance: {},
19
- ChangedStep: { step: S.Number },
22
+ ChangedStep: { step: Schema.Number },
20
23
  CompletedReportCount: {},
21
24
  })
22
25
 
@@ -25,13 +28,13 @@ export type Message = typeof Message.Type
25
28
  // PORT
26
29
 
27
30
  export const ports = {
28
- inbound: { stepChanged: Port.inbound(S.Number) },
29
- outbound: { countChanged: Port.outbound(S.Number) },
31
+ inbound: { stepChanged: Port.inbound(Schema.Number) },
32
+ outbound: { countChanged: Port.outbound(Schema.Number) },
30
33
  }
31
34
 
32
35
  // INIT
33
36
 
34
- export const Flags = S.Struct({ initialCount: S.Number })
37
+ export const Flags = Schema.Struct({ initialCount: Schema.Number })
35
38
  export type Flags = typeof Flags.Type
36
39
 
37
40
  export const init: Runtime.ElementInit<Model, Message, Flags> = flags => ({
@@ -41,7 +44,7 @@ export const init: Runtime.ElementInit<Model, Message, Flags> = flags => ({
41
44
  // COMMAND
42
45
 
43
46
  export const ReportCount = Command.define('ReportCount', {
44
- args: { count: S.Number },
47
+ args: { count: Schema.Number },
45
48
  messages: [Message.CompletedReportCount],
46
49
  execute: ({ count }) =>
47
50
  Port.emit(ports.outbound.countChanged, count).pipe(
@@ -1,5 +1,5 @@
1
1
  import clsx from 'clsx'
2
- import { Array, Duration, Effect, Random, Schema as S } from 'effect'
2
+ import { Array, Duration, Effect, Random, Schema } from 'effect'
3
3
  import { Command, FieldValidation, Runtime, type Update } from 'foldkit'
4
4
  import {
5
5
  Field,
@@ -33,16 +33,16 @@ const emailRules = makeRules({
33
33
  const Submission = defineTaggedUnion({
34
34
  NotSubmitted: {},
35
35
  Submitting: {},
36
- SubmitSuccess: { confirmationText: S.String },
37
- SubmitError: { error: S.String },
36
+ SubmitSuccess: { confirmationText: Schema.String },
37
+ SubmitError: { error: Schema.String },
38
38
  })
39
39
 
40
40
  type Submission = typeof Submission.Type
41
41
 
42
- export const Model = S.Struct({
43
- name: Field(S.String),
44
- email: Field(S.String),
45
- messageText: Field(S.String),
42
+ export const Model = Schema.Struct({
43
+ name: Field(Schema.String),
44
+ email: Field(Schema.String),
45
+ messageText: Field(Schema.String),
46
46
  submission: Submission,
47
47
  })
48
48
  export type Model = typeof Model.Type
@@ -50,12 +50,12 @@ export type Model = typeof Model.Type
50
50
  // MESSAGE
51
51
 
52
52
  export const Message = defineMessageUnion({
53
- UpdatedName: { value: S.String },
54
- UpdatedEmail: { value: S.String },
55
- CompletedValidateEmail: { field: Field(S.String) },
56
- UpdatedMessageText: { value: S.String },
53
+ UpdatedName: { value: Schema.String },
54
+ UpdatedEmail: { value: Schema.String },
55
+ CompletedValidateEmail: { field: Field(Schema.String) },
56
+ UpdatedMessageText: { value: Schema.String },
57
57
  ClickedFormSubmit: {},
58
- SucceededSubmitForm: { name: S.String },
58
+ SucceededSubmitForm: { name: Schema.String },
59
59
  FailedSubmitForm: {},
60
60
  })
61
61
 
@@ -89,7 +89,7 @@ const isEmailOnWaitlist = (email: string): Effect.Effect<boolean> =>
89
89
  })
90
90
 
91
91
  export const ValidateEmail = Command.define('ValidateEmail', {
92
- args: { email: S.String },
92
+ args: { email: Schema.String },
93
93
  messages: [Message.CompletedValidateEmail],
94
94
  execute: ({ email }) =>
95
95
  Effect.gen(function* () {
@@ -212,7 +212,11 @@ export const update = (model: Model, message: Message) =>
212
212
  const FAKE_API_DELAY_MS = 500
213
213
 
214
214
  export const SubmitForm = Command.define('SubmitForm', {
215
- args: { name: S.String, email: S.String, messageText: S.String },
215
+ args: {
216
+ name: Schema.String,
217
+ email: Schema.String,
218
+ messageText: Schema.String,
219
+ },
216
220
  messages: [Message.SucceededSubmitForm, Message.FailedSubmitForm],
217
221
  execute: ({ name }) =>
218
222
  Effect.gen(function* () {
@@ -1,4 +1,4 @@
1
- import { Effect, Option, Random, Schema as S } from 'effect'
1
+ import { Effect, Option, Random, Schema } from 'effect'
2
2
  import { Command } from 'foldkit'
3
3
 
4
4
  import {
@@ -63,7 +63,12 @@ const BURST_INITIAL_SPEED_SCALE_MAX = 2.2
63
63
  const BURST_HUE_JITTER_DEGREES = 30
64
64
 
65
65
  export const GenerateBurstParticle = Command.define('GenerateBurstParticle', {
66
- args: { x: S.Number, y: S.Number, angle: S.Number, hueAnchor: S.Number },
66
+ args: {
67
+ x: Schema.Number,
68
+ y: Schema.Number,
69
+ angle: Schema.Number,
70
+ hueAnchor: Schema.Number,
71
+ },
67
72
  messages: [Message.CompletedGenerateBurstParticle],
68
73
  execute: ({ x, y, angle, hueAnchor }) =>
69
74
  Effect.gen(function* () {
@@ -1,30 +1,30 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
  import { defineMessageUnion } from 'foldkit/message'
3
3
 
4
4
  import { Slider } from '@foldkit/ui'
5
5
 
6
6
  const generatedParticleFields = {
7
- x: S.Number,
8
- y: S.Number,
9
- baseHue: S.Number,
10
- hueDriftPerSecond: S.Number,
11
- lifespanMs: S.Number,
12
- speed: S.Number,
13
- initialAngle: S.Option(S.Number),
14
- initialSpeedScale: S.Number,
7
+ x: Schema.Number,
8
+ y: Schema.Number,
9
+ baseHue: Schema.Number,
10
+ hueDriftPerSecond: Schema.Number,
11
+ lifespanMs: Schema.Number,
12
+ speed: Schema.Number,
13
+ initialAngle: Schema.Option(Schema.Number),
14
+ initialSpeedScale: Schema.Number,
15
15
  }
16
16
 
17
17
  export const Message = defineMessageUnion({
18
- TickedFrame: { deltaTimeMs: S.Number },
18
+ TickedFrame: { deltaTimeMs: Schema.Number },
19
19
  CompletedGenerateAmbientParticle: generatedParticleFields,
20
20
  CompletedGenerateBurstParticle: generatedParticleFields,
21
21
  PressedCanvas: {
22
- x: S.Number,
23
- y: S.Number,
22
+ x: Schema.Number,
23
+ y: Schema.Number,
24
24
  },
25
25
  MovedPointer: {
26
- x: S.Number,
27
- y: S.Number,
26
+ x: Schema.Number,
27
+ y: Schema.Number,
28
28
  },
29
29
  ClickedTogglePlay: {},
30
30
  ClickedReset: {},
@@ -1,33 +1,33 @@
1
- import { Schema as S } from 'effect'
1
+ import { Schema } from 'effect'
2
2
 
3
3
  import { Slider } from '@foldkit/ui'
4
4
 
5
- export const Point = S.Struct({ x: S.Number, y: S.Number })
5
+ export const Point = Schema.Struct({ x: Schema.Number, y: Schema.Number })
6
6
  export type Point = typeof Point.Type
7
7
 
8
- export const Particle = S.Struct({
9
- id: S.Number,
10
- trail: S.Array(Point),
11
- baseHue: S.Number,
12
- hueDriftPerSecond: S.Number,
13
- ageMs: S.Number,
14
- lifespanMs: S.Number,
15
- speed: S.Number,
16
- bornAtSeconds: S.Number,
17
- initialAngle: S.Option(S.Number),
18
- initialSpeedScale: S.Number,
8
+ export const Particle = Schema.Struct({
9
+ id: Schema.Number,
10
+ trail: Schema.Array(Point),
11
+ baseHue: Schema.Number,
12
+ hueDriftPerSecond: Schema.Number,
13
+ ageMs: Schema.Number,
14
+ lifespanMs: Schema.Number,
15
+ speed: Schema.Number,
16
+ bornAtSeconds: Schema.Number,
17
+ initialAngle: Schema.Option(Schema.Number),
18
+ initialSpeedScale: Schema.Number,
19
19
  })
20
20
  export type Particle = typeof Particle.Type
21
21
 
22
- export const Model = S.Struct({
23
- particles: S.Array(Particle),
24
- nextId: S.Number,
25
- elapsedSeconds: S.Number,
26
- maybeMousePosition: S.Option(Point),
27
- isRunning: S.Boolean,
28
- flowStrength: S.Number,
22
+ export const Model = Schema.Struct({
23
+ particles: Schema.Array(Particle),
24
+ nextId: Schema.Number,
25
+ elapsedSeconds: Schema.Number,
26
+ maybeMousePosition: Schema.Option(Point),
27
+ isRunning: Schema.Boolean,
28
+ flowStrength: Schema.Number,
29
29
  flowStrengthSlider: Slider.Model,
30
- noiseScale: S.Number,
30
+ noiseScale: Schema.Number,
31
31
  noiseScaleSlider: Slider.Model,
32
32
  })
33
33
  export type Model = typeof Model.Type