create-foldkit-app 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/templates/base/FOLDKIT.md +3 -1
  2. package/dist/templates/examples/canvas-art/src/main.ts +1 -1
  3. package/dist/templates/examples/charting/src/chartHost.ts +3 -4
  4. package/dist/templates/examples/charting/src/entry.ts +0 -2
  5. package/dist/templates/examples/charting/src/view/chart.ts +101 -36
  6. package/dist/templates/examples/embedding/src/main.ts +3 -3
  7. package/dist/templates/examples/generative-art/src/subscription.ts +1 -1
  8. package/dist/templates/examples/job-application/src/step/education/education.ts +14 -16
  9. package/dist/templates/examples/job-application/src/step/skills/skills.ts +14 -16
  10. package/dist/templates/examples/job-application/src/step/workHistory/workHistory.ts +14 -16
  11. package/dist/templates/examples/map/src/entry.ts +1 -2
  12. package/dist/templates/examples/map/src/main.ts +123 -145
  13. package/dist/templates/examples/map/src/mapHost.ts +10 -12
  14. package/dist/templates/examples/map/src/mount.test.ts +93 -68
  15. package/dist/templates/examples/pixel-art/src/subscription.ts +5 -5
  16. package/dist/templates/examples/routing/src/main.ts +3 -3
  17. package/dist/templates/examples/slow-warnings/src/main.ts +4 -4
  18. package/dist/templates/examples/snake/src/main.ts +4 -3
  19. package/dist/templates/examples/ssg/src/entry.server.ts +2 -0
  20. package/dist/templates/examples/ssg/src/entry.ts +1 -0
  21. package/dist/templates/examples/ssr/package.json +1 -1
  22. package/dist/templates/examples/ssr/src/entry.server.ts +2 -0
  23. package/dist/templates/examples/ssr/src/entry.ts +1 -0
  24. package/dist/templates/examples/stopwatch/src/main.ts +1 -0
  25. package/dist/templates/examples/ui-showcase/src/main.ts +49 -37
  26. package/dist/templates/examples/ui-showcase/src/ui/subscriptions.ts +1 -18
  27. package/dist/templates/examples/ui-showcase/src/ui/update.ts +2 -12
  28. package/dist/templates/examples/ui-showcase/src/ui/view/calendar.ts +9 -7
  29. package/dist/templates/examples/ui-showcase/src/ui/view/checkbox.ts +80 -65
  30. package/dist/templates/examples/ui-showcase/src/ui/view/dialog.ts +102 -123
  31. package/dist/templates/examples/ui-showcase/src/ui/view/disclosure.ts +128 -120
  32. package/dist/templates/examples/ui-showcase/src/ui/view/fieldset.ts +173 -144
  33. package/dist/templates/examples/ui-showcase/src/ui/view/fileDrop.ts +17 -15
  34. package/dist/templates/examples/ui-showcase/src/ui/view/hoverIntent.ts +64 -56
  35. package/dist/templates/examples/ui-showcase/src/ui/view/input.ts +32 -33
  36. package/dist/templates/examples/ui-showcase/src/ui/view/meter.ts +82 -73
  37. package/dist/templates/examples/ui-showcase/src/ui/view/popover.ts +100 -81
  38. package/dist/templates/examples/ui-showcase/src/ui/view/progress.ts +83 -68
  39. package/dist/templates/examples/ui-showcase/src/ui/view/radioGroup.ts +79 -85
  40. package/dist/templates/examples/ui-showcase/src/ui/view/select.ts +63 -67
  41. package/dist/templates/examples/ui-showcase/src/ui/view/slider.ts +72 -72
  42. package/dist/templates/examples/ui-showcase/src/ui/view/switch.ts +25 -26
  43. package/dist/templates/examples/ui-showcase/src/ui/view/tabs.ts +58 -46
  44. package/dist/templates/examples/ui-showcase/src/ui/view/textarea.ts +32 -39
  45. package/dist/templates/examples/ui-showcase/src/ui/view/tooltip.ts +48 -36
  46. package/dist/templates/examples/websocket-chat/src/main.ts +44 -18
  47. package/dist/templates/examples/websocket-chat/src/story.test.ts +33 -6
  48. package/dist/templates/release.json +12 -11
  49. package/dist/templates/rendering/ssg/src/entry.server.ts +2 -0
  50. package/dist/templates/rendering/ssg/src/entry.ts +1 -0
  51. package/dist/templates/rendering/ssg/vite.config.ts +1 -0
  52. package/dist/templates/rendering/ssr/scripts/serve.ts +4 -145
  53. package/dist/templates/rendering/ssr/src/entry.server.ts +2 -0
  54. package/dist/templates/rendering/ssr/src/entry.ts +1 -0
  55. package/dist/templates/rendering/ssr/vite.config.ts +1 -0
  56. package/dist/utils/files.js +2 -0
  57. package/package.json +1 -1
  58. package/dist/templates/examples/charting/src/subscription.ts +0 -70
@@ -1,70 +0,0 @@
1
- import { Effect, Option, Queue, Schema, Stream, pipe } from 'effect'
2
- import { Subscription } from 'foldkit'
3
-
4
- import { getChart } from './chartHost'
5
- import { Message } from './message'
6
- import type { Model } from './model'
7
-
8
- const ChartClickPayload = Schema.Struct({
9
- data: Schema.OptionFromOptional(Schema.Struct({ id: Schema.String })),
10
- })
11
-
12
- const chartClickToDatumId = (event: unknown): Option.Option<string> =>
13
- pipe(
14
- event,
15
- Schema.decodeUnknownOption(ChartClickPayload),
16
- Option.flatMap(({ data }) => data),
17
- Option.map(({ id }) => id),
18
- )
19
-
20
- const chartEvents = (hostId: string): Stream.Stream<Message> =>
21
- Stream.callback<Message>(queue =>
22
- Effect.acquireRelease(
23
- Effect.sync(() => {
24
- const maybeChart = getChart(hostId)
25
-
26
- if (Option.isSome(maybeChart)) {
27
- const chart = maybeChart.value
28
-
29
- const onClick = (event: unknown) => {
30
- const maybeDatumId = chartClickToDatumId(event)
31
-
32
- if (Option.isSome(maybeDatumId)) {
33
- Queue.offerUnsafe(
34
- queue,
35
- Message.ClickedChartDatum({ datumId: maybeDatumId.value }),
36
- )
37
- }
38
- }
39
-
40
- chart.on('click', onClick)
41
-
42
- return Option.some({ chart, onClick })
43
- }
44
-
45
- return Option.none()
46
- }),
47
- maybeHandle =>
48
- Effect.sync(() => {
49
- if (Option.isSome(maybeHandle)) {
50
- maybeHandle.value.chart.off('click', maybeHandle.value.onClick)
51
- }
52
- }),
53
- ).pipe(Effect.flatMap(() => Effect.never)),
54
- )
55
-
56
- export const subscriptions = Subscription.make<Model, Message>()(entry => ({
57
- chartEvents: entry(
58
- { maybeChartHostId: Schema.Option(Schema.String) },
59
- {
60
- modelToDependencies: model => ({
61
- maybeChartHostId: model.maybeChartHostId,
62
- }),
63
- dependenciesToStream: ({ maybeChartHostId }) =>
64
- Option.match(maybeChartHostId, {
65
- onNone: () => Stream.empty,
66
- onSome: chartEvents,
67
- }),
68
- },
69
- ),
70
- }))