create-foldkit-app 0.32.1 → 0.33.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 (117) hide show
  1. package/dist/templates/base/.oxfmtrc.json +28 -0
  2. package/dist/templates/base/.oxlintrc.json +4 -0
  3. package/dist/templates/base/FOLDKIT.md +1 -1
  4. package/dist/templates/base/package.json +1 -1
  5. package/dist/templates/examples/api-cache/package.json +0 -2
  6. package/dist/templates/examples/api-cache/src/scene.test.ts +1 -2
  7. package/dist/templates/examples/api-cache/src/story.test.ts +3 -4
  8. package/dist/templates/examples/auth/package.json +0 -2
  9. package/dist/templates/examples/canvas-art/package.json +0 -2
  10. package/dist/templates/examples/charting/package.json +0 -2
  11. package/dist/templates/examples/charting/src/scene.test.ts +1 -2
  12. package/dist/templates/examples/charting/src/story.test.ts +3 -4
  13. package/dist/templates/examples/counter/package.json +0 -2
  14. package/dist/templates/examples/counters/package.json +0 -2
  15. package/dist/templates/examples/crash-view/package.json +0 -2
  16. package/dist/templates/examples/embedding/package.json +0 -2
  17. package/dist/templates/examples/form/package.json +0 -2
  18. package/dist/templates/examples/generative-art/package.json +0 -2
  19. package/dist/templates/examples/interrupting-commands/package.json +0 -2
  20. package/dist/templates/examples/job-application/package.json +0 -2
  21. package/dist/templates/examples/job-application/src/main.fixture.ts +69 -0
  22. package/dist/templates/examples/job-application/src/main.ts +1 -1
  23. package/dist/templates/examples/job-application/src/scene.test.ts +6 -66
  24. package/dist/templates/examples/job-application/src/step/attachments/index.ts +2 -0
  25. package/dist/templates/examples/job-application/src/step/attachments/scene.test.ts +19 -0
  26. package/dist/templates/examples/job-application/src/step/attachments/story.test.ts +46 -0
  27. package/dist/templates/examples/job-application/src/{view/attachments.ts → step/attachments/view.ts} +4 -11
  28. package/dist/templates/examples/job-application/src/{view → step/coverLetter}/coverLetter.ts +36 -7
  29. package/dist/templates/examples/job-application/src/step/coverLetter/index.ts +1 -0
  30. package/dist/templates/examples/job-application/src/step/coverLetter/scene.test.ts +24 -0
  31. package/dist/templates/examples/job-application/src/step/coverLetter/story.test.ts +19 -0
  32. package/dist/templates/examples/job-application/src/step/education/{entry.ts → entry/entry.ts} +2 -2
  33. package/dist/templates/examples/job-application/src/step/education/entry/index.ts +11 -0
  34. package/dist/templates/examples/job-application/src/step/education/entry/story.test.ts +39 -0
  35. package/dist/templates/examples/job-application/src/step/education/entry/view.ts +160 -0
  36. package/dist/templates/examples/job-application/src/step/education/index.ts +11 -1
  37. package/dist/templates/examples/job-application/src/step/education/scene.test.ts +20 -0
  38. package/dist/templates/examples/job-application/src/step/education/story.test.ts +87 -0
  39. package/dist/templates/examples/job-application/src/{view/education.ts → step/education/view.ts} +6 -10
  40. package/dist/templates/examples/job-application/src/step/personalInfo/index.ts +11 -0
  41. package/dist/templates/examples/job-application/src/step/{personalInfo.ts → personalInfo/personalInfo.ts} +2 -2
  42. package/dist/templates/examples/job-application/src/step/personalInfo/scene.test.ts +38 -0
  43. package/dist/templates/examples/job-application/src/step/personalInfo/story.test.ts +87 -0
  44. package/dist/templates/examples/job-application/src/{view/personalInfo.ts → step/personalInfo/view.ts} +24 -34
  45. package/dist/templates/examples/job-application/src/step/skills/{entry.ts → entry/entry.ts} +2 -2
  46. package/dist/templates/examples/job-application/src/step/skills/entry/index.ts +11 -0
  47. package/dist/templates/examples/job-application/src/step/skills/entry/story.test.ts +27 -0
  48. package/dist/templates/examples/job-application/src/{view/skillEntry.ts → step/skills/entry/view.ts} +9 -12
  49. package/dist/templates/examples/job-application/src/step/skills/index.ts +11 -1
  50. package/dist/templates/examples/job-application/src/step/skills/scene.test.ts +16 -0
  51. package/dist/templates/examples/job-application/src/step/skills/story.test.ts +85 -0
  52. package/dist/templates/examples/job-application/src/step/skills/view.ts +47 -0
  53. package/dist/templates/examples/job-application/src/step/workHistory/{entry.ts → entry/entry.ts} +1 -1
  54. package/dist/templates/examples/job-application/src/step/workHistory/entry/index.ts +11 -0
  55. package/dist/templates/examples/job-application/src/step/workHistory/entry/story.test.ts +42 -0
  56. package/dist/templates/examples/job-application/src/{view/workEntry.ts → step/workHistory/entry/view.ts} +27 -42
  57. package/dist/templates/examples/job-application/src/step/workHistory/index.ts +11 -1
  58. package/dist/templates/examples/job-application/src/step/workHistory/scene.test.ts +20 -0
  59. package/dist/templates/examples/job-application/src/step/workHistory/story.test.ts +87 -0
  60. package/dist/templates/examples/job-application/src/{view/workHistory.ts → step/workHistory/view.ts} +4 -8
  61. package/dist/templates/examples/job-application/src/story.test.ts +28 -419
  62. package/dist/templates/examples/job-application/src/view/datePicker.ts +4 -4
  63. package/dist/templates/examples/job-application/src/view/field.ts +3 -3
  64. package/dist/templates/examples/job-application/src/view/index.ts +3 -358
  65. package/dist/templates/examples/job-application/src/view/stepNav.ts +2 -2
  66. package/dist/templates/examples/job-application/src/view/view.ts +359 -0
  67. package/dist/templates/examples/kanban/package.json +0 -2
  68. package/dist/templates/examples/kanban/src/scene.test.ts +1 -1
  69. package/dist/templates/examples/kanban/src/story.test.ts +22 -23
  70. package/dist/templates/examples/kanban/src/view/index.ts +1 -71
  71. package/dist/templates/examples/kanban/src/view/view.ts +71 -0
  72. package/dist/templates/examples/managed-resource-layer/package.json +0 -2
  73. package/dist/templates/examples/map/package.json +0 -2
  74. package/dist/templates/examples/pixel-art/package.json +0 -2
  75. package/dist/templates/examples/pixel-art/src/scene.test.ts +16 -9
  76. package/dist/templates/examples/pixel-art/src/story.test.ts +12 -7
  77. package/dist/templates/examples/query-sync/package.json +0 -2
  78. package/dist/templates/examples/query-sync/src/story.test.ts +4 -5
  79. package/dist/templates/examples/route-transitions/package.json +0 -2
  80. package/dist/templates/examples/routing/package.json +0 -2
  81. package/dist/templates/examples/routing/src/page/people.scene.test.ts +41 -0
  82. package/dist/templates/examples/routing/src/page/people.story.test.ts +73 -0
  83. package/dist/templates/examples/routing/src/scene.test.ts +2 -17
  84. package/dist/templates/examples/routing/src/story.test.ts +4 -34
  85. package/dist/templates/examples/shopping-cart/package.json +0 -2
  86. package/dist/templates/examples/shopping-cart/src/page/products.scene.test.ts +20 -0
  87. package/dist/templates/examples/shopping-cart/src/page/products.story.test.ts +56 -0
  88. package/dist/templates/examples/shopping-cart/src/page/products.ts +1 -1
  89. package/dist/templates/examples/shopping-cart/src/scene.test.ts +1 -4
  90. package/dist/templates/examples/shopping-cart/src/story.test.ts +3 -4
  91. package/dist/templates/examples/slow-warnings/package.json +0 -2
  92. package/dist/templates/examples/snake/package.json +0 -2
  93. package/dist/templates/examples/ssg/package.json +0 -2
  94. package/dist/templates/examples/ssr/package.json +0 -2
  95. package/dist/templates/examples/state-machine/package.json +0 -2
  96. package/dist/templates/examples/state-machine/src/main.ts +79 -87
  97. package/dist/templates/examples/state-machine/src/scene.test.ts +1 -2
  98. package/dist/templates/examples/stopwatch/package.json +0 -2
  99. package/dist/templates/examples/todo/package.json +0 -2
  100. package/dist/templates/examples/ui-showcase/package.json +0 -2
  101. package/dist/templates/examples/ui-showcase/src/story.test.ts +1 -2
  102. package/dist/templates/examples/view-transitions/package.json +0 -2
  103. package/dist/templates/examples/view-transitions/src/styles.css +3 -3
  104. package/dist/templates/examples/weather/package.json +0 -2
  105. package/dist/templates/examples/web-components/package.json +0 -2
  106. package/dist/templates/examples/websocket-chat/package.json +0 -2
  107. package/dist/templates/release.json +9 -10
  108. package/dist/templates/rendering/ssg/package.json +1 -1
  109. package/dist/templates/rendering/ssr/package.json +1 -1
  110. package/dist/utils/packages.js +1 -2
  111. package/package.json +3 -3
  112. package/dist/templates/base/.prettierignore +0 -5
  113. package/dist/templates/base/.prettierrc +0 -13
  114. package/dist/templates/examples/job-application/src/step/coverLetter.ts +0 -34
  115. package/dist/templates/examples/job-application/src/view/educationEntry.ts +0 -165
  116. package/dist/templates/examples/job-application/src/view/skills.ts +0 -49
  117. /package/dist/templates/examples/job-application/src/step/{attachments.ts → attachments/attachments.ts} +0 -0
@@ -1,165 +0,0 @@
1
- import clsx from 'clsx'
2
- import { Array, Option } from 'effect'
3
- import { Submodel } from 'foldkit'
4
- import { type CalendarDate } from 'foldkit/calendar'
5
- import type { Html } from 'foldkit/html'
6
-
7
- import { Button, Listbox } from '@foldkit/ui'
8
-
9
- import { Education } from '../step'
10
- import { checkboxField, inputField } from './field'
11
- import { chevronDown } from './icon'
12
-
13
- const GRADUATION_YEAR_WINDOW_SIZE = 30
14
- const GRADUATION_YEAR_FORWARD_OFFSET = 6
15
-
16
- const GraduationYearListbox = Listbox.create<string>()
17
-
18
- const graduationYears = (today: CalendarDate): ReadonlyArray<string> =>
19
- Array.makeBy(GRADUATION_YEAR_WINDOW_SIZE, index =>
20
- String(today.year + GRADUATION_YEAR_FORWARD_OFFSET - index),
21
- )
22
-
23
- export type ViewInputs = Readonly<{
24
- today: CalendarDate
25
- }>
26
-
27
- export const educationEntryView = Submodel.defineView<
28
- Education.Entry.Model,
29
- Education.Entry.Message,
30
- ViewInputs
31
- >((model, viewInputs, h): Html => {
32
- const { today } = viewInputs
33
-
34
- const showGraduationYear = !model.isCurrentlyEnrolled
35
-
36
- const graduationYearField = h.keyed('div')(
37
- `${model.id}-graduation-year`,
38
- [h.Class('space-y-1')],
39
- [
40
- h.label(
41
- [h.Class('block text-sm font-medium text-gray-700')],
42
- ['Graduation Year'],
43
- ),
44
- h.submodel({
45
- slotId: model.graduationYearListbox.id,
46
- model: model.graduationYearListbox,
47
- view: GraduationYearListbox.view,
48
- viewInputs: {
49
- items: graduationYears(today),
50
- maybeSelectedValue: model.maybeGraduationYear,
51
- buttonContent: h.div(
52
- [h.Class('flex w-full items-center justify-between gap-2')],
53
- [
54
- Option.match(model.maybeGraduationYear, {
55
- onNone: () =>
56
- h.span([h.Class('text-gray-400')], ['Select year']),
57
- onSome: graduationYear => h.span([], [graduationYear]),
58
- }),
59
- h.span([h.Class('text-gray-400 shrink-0')], [chevronDown()]),
60
- ],
61
- ),
62
- buttonClassName:
63
- 'w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-left cursor-pointer focus:outline-none focus:ring-2 focus:ring-indigo-500',
64
- itemsClassName:
65
- 'rounded-lg border border-gray-200 bg-white shadow-lg py-1 max-h-64 overflow-y-auto w-(--button-width)',
66
- itemToConfig: (year, { isActive, isSelected }) => ({
67
- className: clsx(
68
- 'flex items-center gap-2 px-4 py-2 text-sm cursor-pointer',
69
- isActive && 'bg-gray-50',
70
- isSelected && 'text-indigo-700 font-semibold',
71
- ),
72
- content: h.div(
73
- [h.Class('flex items-center gap-2 w-full')],
74
- [
75
- isSelected ? h.span([], ['✓']) : h.span([h.Class('w-4')]),
76
- h.span([], [year]),
77
- ],
78
- ),
79
- }),
80
- backdropClassName: 'fixed inset-0',
81
- anchor: { placement: 'bottom-start', gap: 4, padding: 8 },
82
- },
83
- toParentMessage: message =>
84
- Education.Entry.Message.GotGraduationYearListboxMessage({ message }),
85
- }),
86
- ],
87
- )
88
-
89
- return h.keyed('div')(
90
- model.id,
91
- [h.Class('py-6 space-y-4 first:pt-0')],
92
- [
93
- h.div(
94
- [h.Class('grid grid-cols-2 gap-3')],
95
- [
96
- inputField(
97
- {
98
- id: `${model.id}-school`,
99
- label: 'School',
100
- field: model.school,
101
- onInput: value =>
102
- Education.Entry.Message.UpdatedSchool({ value }),
103
- placeholder: 'e.g. MIT',
104
- },
105
- h,
106
- ),
107
- inputField(
108
- {
109
- id: `${model.id}-degree`,
110
- label: 'Degree',
111
- field: model.degree,
112
- onInput: value =>
113
- Education.Entry.Message.UpdatedDegree({ value }),
114
- placeholder: "e.g. Bachelor's, Master's",
115
- },
116
- h,
117
- ),
118
- ],
119
- ),
120
- inputField(
121
- {
122
- id: `${model.id}-field`,
123
- label: 'Field of Study',
124
- field: model.fieldOfStudy,
125
- onInput: value =>
126
- Education.Entry.Message.UpdatedFieldOfStudy({ value }),
127
- placeholder: 'e.g. Computer Science',
128
- },
129
- h,
130
- ),
131
- checkboxField(
132
- {
133
- id: `${model.id}-enrolled`,
134
- label: 'I’m currently enrolled',
135
- isChecked: model.isCurrentlyEnrolled,
136
- onToggle: isChecked =>
137
- Education.Entry.Message.ToggledCurrentlyEnrolled({ isChecked }),
138
- },
139
- h,
140
- ),
141
- ...(showGraduationYear ? [graduationYearField] : []),
142
- h.div(
143
- [h.Class('flex justify-end')],
144
- [
145
- Button.view(
146
- {
147
- onClick: Education.Entry.Message.ClickedRemoveSelf(),
148
- toView: attributes =>
149
- h.button(
150
- [
151
- ...attributes.button,
152
- h.Class(
153
- 'text-sm text-gray-400 hover:text-red-500 transition cursor-pointer',
154
- ),
155
- ],
156
- ['Remove education'],
157
- ),
158
- },
159
- h,
160
- ),
161
- ],
162
- ),
163
- ],
164
- )
165
- })
@@ -1,49 +0,0 @@
1
- import { Submodel } from 'foldkit'
2
- import type { Html } from 'foldkit/html'
3
-
4
- import { Button } from '@foldkit/ui'
5
-
6
- import { Skills } from '../step'
7
- import { Message } from '../step/skills'
8
- import { skillEntryView } from './skillEntry'
9
-
10
- export const skillsView = Submodel.defineView<Skills.Model, Skills.Message>(
11
- (model, h): Html =>
12
- h.div(
13
- [h.Class('space-y-6')],
14
- [
15
- h.p(
16
- [h.Class('text-sm text-gray-500')],
17
- ['Add your technical and professional skills.'],
18
- ),
19
- h.div(
20
- [h.Class('divide-y divide-gray-200')],
21
- model.entries.map(entry =>
22
- h.submodel({
23
- slotId: entry.id,
24
- model: entry,
25
- view: skillEntryView,
26
- toParentMessage: message =>
27
- Message.GotEntryMessage({ entryId: entry.id, message }),
28
- }),
29
- ),
30
- ),
31
- Button.view(
32
- {
33
- onClick: Message.ClickedAddEntry(),
34
- toView: attributes =>
35
- h.button(
36
- [
37
- ...attributes.button,
38
- h.Class(
39
- 'w-full rounded-lg border-2 border-dashed border-gray-300 px-4 py-3 text-sm font-medium text-gray-600 hover:border-indigo-400 hover:text-indigo-600 transition cursor-pointer',
40
- ),
41
- ],
42
- ['+ Add Skill'],
43
- ),
44
- },
45
- h,
46
- ),
47
- ],
48
- ),
49
- )