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.
- package/dist/commands/create.js +9 -7
- package/dist/templates/base/FOLDKIT.md +22 -6
- package/dist/templates/examples/api-cache/src/data.ts +14 -14
- package/dist/templates/examples/api-cache/src/main.ts +42 -39
- package/dist/templates/examples/auth/src/command.ts +3 -3
- package/dist/templates/examples/auth/src/domain/session.ts +8 -6
- package/dist/templates/examples/auth/src/main.ts +11 -11
- package/dist/templates/examples/auth/src/message.ts +3 -3
- package/dist/templates/examples/auth/src/model.ts +2 -2
- package/dist/templates/examples/auth/src/page/loggedIn/index.ts +1 -1
- package/dist/templates/examples/auth/src/page/loggedIn/view.ts +3 -3
- package/dist/templates/examples/auth/src/page/loggedOut/index.ts +1 -1
- package/dist/templates/examples/auth/src/page/loggedOut/page/login.ts +9 -17
- package/dist/templates/examples/auth/src/page/loggedOut/update.ts +4 -6
- package/dist/templates/examples/auth/src/page/loggedOut/view.ts +3 -3
- package/dist/templates/examples/auth/src/route.ts +2 -2
- package/dist/templates/examples/auth/src/update.ts +37 -40
- package/dist/templates/examples/auth/src/view.ts +6 -6
- package/dist/templates/examples/canvas-art/src/main.ts +22 -30
- package/dist/templates/examples/charting/src/command.ts +3 -3
- package/dist/templates/examples/charting/src/domain.ts +53 -48
- package/dist/templates/examples/charting/src/echarts.ts +6 -6
- package/dist/templates/examples/charting/src/githubApi.ts +33 -34
- package/dist/templates/examples/charting/src/http.ts +7 -7
- package/dist/templates/examples/charting/src/message.ts +6 -6
- package/dist/templates/examples/charting/src/model.ts +6 -6
- package/dist/templates/examples/charting/src/npmApi.ts +19 -15
- package/dist/templates/examples/charting/src/subscription.ts +5 -5
- package/dist/templates/examples/charting/src/telemetry.test.ts +18 -12
- package/dist/templates/examples/charting/src/telemetry.ts +11 -18
- package/dist/templates/examples/charting/src/update.ts +17 -23
- package/dist/templates/examples/charting/src/view/chart.ts +2 -2
- package/dist/templates/examples/counter/src/main.ts +2 -2
- package/dist/templates/examples/counters/src/counter.ts +2 -2
- package/dist/templates/examples/counters/src/main.ts +8 -8
- package/dist/templates/examples/embedding/src/main.ts +10 -7
- package/dist/templates/examples/form/src/main.ts +18 -14
- package/dist/templates/examples/generative-art/src/command.ts +7 -2
- package/dist/templates/examples/generative-art/src/message.ts +14 -14
- package/dist/templates/examples/generative-art/src/model.ts +21 -21
- package/dist/templates/examples/generative-art/src/update.ts +15 -17
- package/dist/templates/examples/interrupting-commands/src/main.ts +30 -27
- package/dist/templates/examples/job-application/src/domain/proficiencyLevel.ts +2 -2
- package/dist/templates/examples/job-application/src/domain/pronounOption.ts +2 -2
- package/dist/templates/examples/job-application/src/domain/step.ts +11 -11
- package/dist/templates/examples/job-application/src/main.ts +5 -5
- package/dist/templates/examples/job-application/src/message.ts +2 -2
- package/dist/templates/examples/job-application/src/model.ts +5 -5
- package/dist/templates/examples/job-application/src/step/attachments.ts +32 -34
- package/dist/templates/examples/job-application/src/step/coverLetter.ts +4 -4
- package/dist/templates/examples/job-application/src/step/education/education.ts +11 -14
- package/dist/templates/examples/job-application/src/step/education/entry.ts +21 -22
- package/dist/templates/examples/job-application/src/step/personalInfo.ts +44 -54
- package/dist/templates/examples/job-application/src/step/skills/entry.ts +12 -14
- package/dist/templates/examples/job-application/src/step/skills/skills.ts +11 -14
- package/dist/templates/examples/job-application/src/step/workHistory/entry.ts +43 -45
- package/dist/templates/examples/job-application/src/step/workHistory/workHistory.ts +11 -14
- package/dist/templates/examples/job-application/src/update.ts +17 -17
- package/dist/templates/examples/job-application/src/view/attachments.ts +5 -5
- package/dist/templates/examples/job-application/src/view/datePicker.ts +3 -3
- package/dist/templates/examples/job-application/src/view/field.ts +5 -5
- package/dist/templates/examples/job-application/src/view/index.ts +28 -22
- package/dist/templates/examples/kanban/src/command.ts +4 -4
- package/dist/templates/examples/kanban/src/domain/card.ts +6 -6
- package/dist/templates/examples/kanban/src/domain/column.ts +9 -9
- package/dist/templates/examples/kanban/src/main.ts +4 -4
- package/dist/templates/examples/kanban/src/message.ts +6 -6
- package/dist/templates/examples/kanban/src/model.ts +11 -9
- package/dist/templates/examples/kanban/src/update.ts +5 -5
- package/dist/templates/examples/managed-resource-layer/src/main.ts +20 -20
- package/dist/templates/examples/map/src/locations.ts +7 -7
- package/dist/templates/examples/map/src/main.ts +83 -44
- package/dist/templates/examples/map/src/mount.test.ts +127 -0
- package/dist/templates/examples/pixel-art/src/command.ts +12 -5
- package/dist/templates/examples/pixel-art/src/main.ts +4 -4
- package/dist/templates/examples/pixel-art/src/message.ts +7 -7
- package/dist/templates/examples/pixel-art/src/model.ts +34 -29
- package/dist/templates/examples/pixel-art/src/subscription.ts +2 -2
- package/dist/templates/examples/pixel-art/src/update.ts +79 -86
- package/dist/templates/examples/query-sync/src/main.ts +106 -102
- package/dist/templates/examples/route-transitions/src/data.ts +6 -6
- package/dist/templates/examples/route-transitions/src/main.ts +23 -29
- package/dist/templates/examples/route-transitions/src/route.ts +3 -3
- package/dist/templates/examples/routing/src/fileTree.ts +10 -8
- package/dist/templates/examples/routing/src/main.ts +23 -21
- package/dist/templates/examples/routing/src/page/people.ts +14 -22
- package/dist/templates/examples/routing/src/route.ts +7 -7
- package/dist/templates/examples/shopping-cart/src/main.ts +30 -31
- package/dist/templates/examples/shopping-cart/src/page/products.ts +10 -10
- package/dist/templates/examples/shopping-cart/src/route.ts +6 -4
- package/dist/templates/examples/slow-warnings/src/main.ts +35 -43
- package/dist/templates/examples/snake/src/domain/snake.ts +2 -2
- package/dist/templates/examples/snake/src/main.ts +39 -47
- package/dist/templates/examples/ssg/src/main.ts +5 -5
- package/dist/templates/examples/ssg/src/route.ts +2 -2
- package/dist/templates/examples/ssr/src/cookie.ts +3 -3
- package/dist/templates/examples/ssr/src/main.ts +10 -10
- package/dist/templates/examples/state-machine/src/main.ts +55 -53
- package/dist/templates/examples/state-machine/src/view.ts +7 -7
- package/dist/templates/examples/stopwatch/src/main.ts +10 -10
- package/dist/templates/examples/todo/src/main.ts +41 -34
- package/dist/templates/examples/ui-showcase/src/main.ts +54 -42
- package/dist/templates/examples/ui-showcase/src/scene.test.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/init.ts +1 -2
- package/dist/templates/examples/ui-showcase/src/ui/message.ts +17 -18
- package/dist/templates/examples/ui-showcase/src/ui/model.ts +47 -44
- package/dist/templates/examples/ui-showcase/src/ui/subscriptions.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/toast.ts +4 -4
- package/dist/templates/examples/ui-showcase/src/ui/update.ts +287 -298
- package/dist/templates/examples/ui-showcase/src/ui/view/animation.ts +2 -2
- package/dist/templates/examples/ui-showcase/src/ui/view/button.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/calendar.ts +4 -4
- package/dist/templates/examples/ui-showcase/src/ui/view/checkbox.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/combobox.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/datePicker.ts +4 -4
- package/dist/templates/examples/ui-showcase/src/ui/view/dialog.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/disclosure.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/dragAndDrop.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/fieldset.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/fileDrop.ts +6 -6
- package/dist/templates/examples/ui-showcase/src/ui/view/hoverIntent.ts +9 -20
- package/dist/templates/examples/ui-showcase/src/ui/view/input.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/listbox.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/menu.ts +15 -15
- package/dist/templates/examples/ui-showcase/src/ui/view/popover.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/radioGroup.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/select.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/slider.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/switch.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/tabs.ts +7 -7
- package/dist/templates/examples/ui-showcase/src/ui/view/textarea.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/toast.ts +8 -8
- package/dist/templates/examples/ui-showcase/src/ui/view/tooltip.ts +1 -1
- package/dist/templates/examples/ui-showcase/src/ui/view/virtualList.ts +7 -7
- package/dist/templates/examples/view-transitions/src/artwork.ts +7 -7
- package/dist/templates/examples/view-transitions/src/main.ts +6 -6
- package/dist/templates/examples/view-transitions/src/route.ts +3 -3
- package/dist/templates/examples/weather/src/main.ts +42 -42
- package/dist/templates/examples/weather/src/story.test.ts +5 -5
- package/dist/templates/examples/web-components/src/main.ts +16 -16
- package/dist/templates/examples/websocket-chat/src/main.ts +30 -30
- package/dist/templates/release.json +13 -13
- package/dist/templates/rendering/ssg/src/main.ts +5 -5
- package/dist/templates/rendering/ssg/src/route.ts +2 -2
- package/dist/templates/rendering/ssr/server/main.ts +15 -15
- package/dist/templates/rendering/ssr/src/cookie.ts +3 -3
- package/dist/templates/rendering/ssr/src/main.ts +10 -10
- package/dist/utils/packages.js +17 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import type { Html } from 'foldkit/html'
|
|
|
3
3
|
|
|
4
4
|
import { Animation } from '@foldkit/ui'
|
|
5
5
|
|
|
6
|
-
import { UiMessage } from '../message'
|
|
6
|
+
import { Message as UiMessage } from '../message'
|
|
7
7
|
import type { UiModel } from '../model'
|
|
8
8
|
|
|
9
9
|
const triggerClassName =
|
|
@@ -26,7 +26,7 @@ export const view = Submodel.defineView<UiModel, UiMessage>(
|
|
|
26
26
|
h.Class(triggerClassName),
|
|
27
27
|
h.OnClick(UiMessage.ToggledAnimationDemo()),
|
|
28
28
|
],
|
|
29
|
-
[model.
|
|
29
|
+
[model.animationDemo.isShowing ? 'Hide Content' : 'Show Content'],
|
|
30
30
|
),
|
|
31
31
|
],
|
|
32
32
|
),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Match
|
|
1
|
+
import { Match } from 'effect'
|
|
2
2
|
import { Submodel } from 'foldkit'
|
|
3
3
|
import type { ChildAttribute, Html, HtmlBuilder } from 'foldkit/html'
|
|
4
4
|
|
|
5
5
|
import { Calendar } from '@foldkit/ui'
|
|
6
6
|
|
|
7
7
|
import * as Icon from '../../icon'
|
|
8
|
-
import { UiMessage } from '../message'
|
|
8
|
+
import { Message as UiMessage } from '../message'
|
|
9
9
|
import type { UiModel } from '../model'
|
|
10
10
|
|
|
11
11
|
const containerClassName =
|
|
@@ -185,8 +185,8 @@ export const view = Submodel.defineView<UiModel, UiMessage>(
|
|
|
185
185
|
view: Calendar.view,
|
|
186
186
|
viewInputs: {
|
|
187
187
|
maybeSelectedDate: model.maybeCalendarBasicDemoSelectedDate,
|
|
188
|
-
toView:
|
|
189
|
-
|
|
188
|
+
toView: Match.type<Calendar.CalendarAttributes>().pipe(
|
|
189
|
+
Match.tagsExhaustive({
|
|
190
190
|
Days: days => daysView(days, h),
|
|
191
191
|
Months: months => monthsView(months, h),
|
|
192
192
|
Years: years => yearsView(years, h),
|
|
@@ -3,7 +3,7 @@ import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
|
3
3
|
|
|
4
4
|
import { Checkbox } from '@foldkit/ui'
|
|
5
5
|
|
|
6
|
-
import { UiMessage } from '../message'
|
|
6
|
+
import { Message as UiMessage } from '../message'
|
|
7
7
|
import type { UiModel } from '../model'
|
|
8
8
|
|
|
9
9
|
const CHECKBOX_BASIC_DEMO_ID = 'checkbox-basic-demo'
|
|
@@ -7,7 +7,7 @@ import { Combobox } from '@foldkit/ui'
|
|
|
7
7
|
import type { AnchorConfig } from '@foldkit/ui/combobox'
|
|
8
8
|
|
|
9
9
|
import * as Icon from '../../icon'
|
|
10
|
-
import { UiMessage } from '../message'
|
|
10
|
+
import { Message as UiMessage } from '../message'
|
|
11
11
|
import type { City, UiModel } from '../model'
|
|
12
12
|
|
|
13
13
|
export const CityCombobox = Combobox.create<City>()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Match
|
|
1
|
+
import { Match, Option } from 'effect'
|
|
2
2
|
import { Submodel } from 'foldkit'
|
|
3
3
|
import type { ChildAttribute, Html, HtmlBuilder } from 'foldkit/html'
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { Calendar, DatePicker } from '@foldkit/ui'
|
|
|
6
6
|
import type { AnchorConfig } from '@foldkit/ui/popover'
|
|
7
7
|
|
|
8
8
|
import * as Icon from '../../icon'
|
|
9
|
-
import { UiMessage } from '../message'
|
|
9
|
+
import { Message as UiMessage } from '../message'
|
|
10
10
|
import type { UiModel } from '../model'
|
|
11
11
|
|
|
12
12
|
const triggerClassName =
|
|
@@ -246,8 +246,8 @@ export const view = Submodel.defineView<UiModel, UiMessage>(
|
|
|
246
246
|
panelClassName,
|
|
247
247
|
backdropClassName,
|
|
248
248
|
className: wrapperClassName,
|
|
249
|
-
toCalendarView:
|
|
250
|
-
|
|
249
|
+
toCalendarView: Match.type<Calendar.CalendarAttributes>().pipe(
|
|
250
|
+
Match.tagsExhaustive({
|
|
251
251
|
Days: days => daysView(days, h),
|
|
252
252
|
Months: months => monthsView(months, h),
|
|
253
253
|
Years: years => yearsView(years, h),
|
|
@@ -4,7 +4,7 @@ import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
|
4
4
|
|
|
5
5
|
import { Combobox, Dialog } from '@foldkit/ui'
|
|
6
6
|
|
|
7
|
-
import { UiMessage } from '../message'
|
|
7
|
+
import { Message as UiMessage } from '../message'
|
|
8
8
|
import type { City, UiModel } from '../model'
|
|
9
9
|
import { CityCombobox, comboboxInputs } from './combobox'
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
|
5
5
|
import { Disclosure } from '@foldkit/ui'
|
|
6
6
|
|
|
7
7
|
import * as Icon from '../../icon'
|
|
8
|
-
import { UiMessage } from '../message'
|
|
8
|
+
import { Message as UiMessage } from '../message'
|
|
9
9
|
import type { UiModel } from '../model'
|
|
10
10
|
|
|
11
11
|
const DISCLOSURE_BASIC_DEMO_ID = 'disclosure-basic-demo'
|
|
@@ -5,7 +5,7 @@ import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
|
5
5
|
|
|
6
6
|
import { DragAndDrop } from '@foldkit/ui'
|
|
7
7
|
|
|
8
|
-
import { UiMessage } from '../message'
|
|
8
|
+
import { Message as UiMessage } from '../message'
|
|
9
9
|
import type { DemoCard, DemoColumn, UiModel } from '../model'
|
|
10
10
|
|
|
11
11
|
const cardClassName =
|
|
@@ -3,7 +3,7 @@ import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
|
3
3
|
|
|
4
4
|
import { Checkbox, Fieldset, Input, Textarea } from '@foldkit/ui'
|
|
5
5
|
|
|
6
|
-
import { UiMessage } from '../message'
|
|
6
|
+
import { Message as UiMessage } from '../message'
|
|
7
7
|
import type { UiModel } from '../model'
|
|
8
8
|
|
|
9
9
|
const FIELDSET_CHECKBOX_DEMO_ID = 'fieldset-checkbox-demo'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Array, Match
|
|
1
|
+
import { Array, Match, Number } from 'effect'
|
|
2
2
|
import { File, Submodel } from 'foldkit'
|
|
3
3
|
import type { Html } from 'foldkit/html'
|
|
4
4
|
|
|
5
5
|
import { FileDrop } from '@foldkit/ui'
|
|
6
6
|
|
|
7
|
-
import { UiMessage } from '../message'
|
|
7
|
+
import { Message as UiMessage } from '../message'
|
|
8
8
|
import type { UiModel } from '../model'
|
|
9
9
|
|
|
10
10
|
const dropZoneClassName =
|
|
@@ -28,13 +28,13 @@ const BYTES_PER_KB = 1024
|
|
|
28
28
|
const BYTES_PER_MB = BYTES_PER_KB * BYTES_PER_KB
|
|
29
29
|
|
|
30
30
|
const formatFileSize = (bytes: number): string =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
Match.value(bytes).pipe(
|
|
32
|
+
Match.when(Number.isLessThan(BYTES_PER_KB), () => `${bytes} B`),
|
|
33
|
+
Match.when(
|
|
34
34
|
Number.isLessThan(BYTES_PER_MB),
|
|
35
35
|
() => `${(bytes / BYTES_PER_KB).toFixed(1)} KB`,
|
|
36
36
|
),
|
|
37
|
-
|
|
37
|
+
Match.orElse(() => `${(bytes / BYTES_PER_MB).toFixed(1)} MB`),
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
const fileKey = (file: File.File): string =>
|
|
@@ -3,11 +3,11 @@ import type { Html } from 'foldkit/html'
|
|
|
3
3
|
|
|
4
4
|
import { HoverIntent } from '@foldkit/ui'
|
|
5
5
|
|
|
6
|
-
import { UiMessage } from '../message'
|
|
6
|
+
import { Message as UiMessage } from '../message'
|
|
7
7
|
import type { UiModel } from '../model'
|
|
8
8
|
|
|
9
9
|
const triggerClassName =
|
|
10
|
-
'
|
|
10
|
+
'inline-flex cursor-pointer items-center rounded-lg bg-accent-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition-colors hover:bg-accent-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-600'
|
|
11
11
|
|
|
12
12
|
const panelClassName =
|
|
13
13
|
'absolute left-0 top-full z-10 mt-2 w-72 rounded-lg border border-gray-200 bg-white p-4 shadow-lg'
|
|
@@ -26,7 +26,7 @@ export const view = Submodel.defineView<UiModel, UiMessage>((model, h): Html =>
|
|
|
26
26
|
h.p(
|
|
27
27
|
[h.Class('mb-4 max-w-xl text-sm text-gray-600')],
|
|
28
28
|
[
|
|
29
|
-
'Hover or focus the trigger, then move into the
|
|
29
|
+
'Hover over or focus the “More information” trigger, then move the pointer into the card. Move the pointer or focus away from both elements, or press Escape, to close it.',
|
|
30
30
|
],
|
|
31
31
|
),
|
|
32
32
|
h.submodel({
|
|
@@ -42,12 +42,13 @@ export const view = Submodel.defineView<UiModel, UiMessage>((model, h): Html =>
|
|
|
42
42
|
h.button(
|
|
43
43
|
[
|
|
44
44
|
...trigger,
|
|
45
|
+
h.Type('button'),
|
|
45
46
|
h.Id(TRIGGER_ID),
|
|
46
47
|
h.AriaControls(PANEL_ID),
|
|
47
48
|
h.AriaExpanded(isVisible),
|
|
48
49
|
h.Class(triggerClassName),
|
|
49
50
|
],
|
|
50
|
-
['
|
|
51
|
+
['More information'],
|
|
51
52
|
),
|
|
52
53
|
...(isVisible
|
|
53
54
|
? [
|
|
@@ -55,24 +56,12 @@ export const view = Submodel.defineView<UiModel, UiMessage>((model, h): Html =>
|
|
|
55
56
|
[...panel, h.Id(PANEL_ID), h.Class(panelClassName)],
|
|
56
57
|
[
|
|
57
58
|
h.h3(
|
|
58
|
-
[
|
|
59
|
-
|
|
60
|
-
h.Class('font-semibold text-gray-900'),
|
|
61
|
-
],
|
|
62
|
-
['Account summary'],
|
|
59
|
+
[h.Class('text-sm font-medium text-gray-900')],
|
|
60
|
+
['Details'],
|
|
63
61
|
),
|
|
64
62
|
h.p(
|
|
65
|
-
[h.Class('mt-
|
|
66
|
-
['
|
|
67
|
-
),
|
|
68
|
-
h.a(
|
|
69
|
-
[
|
|
70
|
-
h.Href('#hover-intent-showcase-details'),
|
|
71
|
-
h.Class(
|
|
72
|
-
'mt-3 inline-block text-sm font-medium text-accent-700 underline underline-offset-4',
|
|
73
|
-
),
|
|
74
|
-
],
|
|
75
|
-
['View account details'],
|
|
63
|
+
[h.Class('mt-1 text-sm leading-5 text-gray-600')],
|
|
64
|
+
['A short description can provide useful context.'],
|
|
76
65
|
),
|
|
77
66
|
],
|
|
78
67
|
),
|
|
@@ -5,7 +5,7 @@ import { type Html, type HtmlBuilder, childAttributes } from 'foldkit/html'
|
|
|
5
5
|
import { Listbox } from '@foldkit/ui'
|
|
6
6
|
|
|
7
7
|
import * as Icon from '../../icon'
|
|
8
|
-
import { UiMessage } from '../message'
|
|
8
|
+
import { Message as UiMessage } from '../message'
|
|
9
9
|
import type { ListboxItem, UiModel } from '../model'
|
|
10
10
|
|
|
11
11
|
const LISTBOX_ITEMS: ReadonlyArray<ListboxItem> = [
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Match
|
|
1
|
+
import { Match } from 'effect'
|
|
2
2
|
import { Submodel } from 'foldkit'
|
|
3
3
|
import { type Html, type HtmlBuilder, childAttributes } from 'foldkit/html'
|
|
4
4
|
|
|
5
5
|
import { Menu } from '@foldkit/ui'
|
|
6
6
|
|
|
7
7
|
import * as Icon from '../../icon'
|
|
8
|
-
import { UiMessage } from '../message'
|
|
8
|
+
import { Message as UiMessage } from '../message'
|
|
9
9
|
import type { UiModel } from '../model'
|
|
10
10
|
|
|
11
11
|
const triggerClassName =
|
|
@@ -42,33 +42,33 @@ const MENU_ITEMS: ReadonlyArray<MenuItem> = [
|
|
|
42
42
|
]
|
|
43
43
|
|
|
44
44
|
const menuItemIcon = (item: MenuItem): Html =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
Match.value(item).pipe(
|
|
46
|
+
Match.when('Edit', () => Icon.pencil(ICON_SIZE)),
|
|
47
|
+
Match.when('Duplicate', () => Icon.documentDuplicate(ICON_SIZE)),
|
|
48
|
+
Match.when('Archive', () => Icon.archiveBox(ICON_SIZE)),
|
|
49
|
+
Match.when('Move', () => Icon.arrowRight(ICON_SIZE)),
|
|
50
|
+
Match.when('Delete', () => Icon.trash(ICON_SIZE)),
|
|
51
|
+
Match.exhaustive,
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
const isItemDisabled = (item: MenuItem): boolean => item === 'Archive'
|
|
55
55
|
|
|
56
56
|
const itemGroupKey = (item: MenuItem): string =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
Match.value(item).pipe(
|
|
58
|
+
Match.when('Delete', () => 'Danger'),
|
|
59
|
+
Match.orElse(() => 'Actions'),
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
const groupToHeading = (
|
|
63
63
|
groupKey: string,
|
|
64
64
|
h: HtmlBuilder<UiMessage>,
|
|
65
65
|
): Menu.GroupHeading | undefined => {
|
|
66
|
-
return
|
|
67
|
-
|
|
66
|
+
return Match.value(groupKey).pipe(
|
|
67
|
+
Match.when('Danger', () => ({
|
|
68
68
|
content: h.span([], ['Danger Zone']),
|
|
69
69
|
className: headingClassName,
|
|
70
70
|
})),
|
|
71
|
-
|
|
71
|
+
Match.orElse(() => undefined),
|
|
72
72
|
)
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -3,7 +3,7 @@ import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
|
3
3
|
|
|
4
4
|
import { RadioGroup } from '@foldkit/ui'
|
|
5
5
|
|
|
6
|
-
import { UiMessage } from '../message'
|
|
6
|
+
import { Message as UiMessage } from '../message'
|
|
7
7
|
import { type Plan, type UiModel } from '../model'
|
|
8
8
|
|
|
9
9
|
export const PlanRadioGroup = RadioGroup.create<Plan>()
|
|
@@ -4,7 +4,7 @@ import type { Html } from 'foldkit/html'
|
|
|
4
4
|
import { Select } from '@foldkit/ui'
|
|
5
5
|
|
|
6
6
|
import * as Icon from '../../icon'
|
|
7
|
-
import { UiMessage } from '../message'
|
|
7
|
+
import { Message as UiMessage } from '../message'
|
|
8
8
|
import type { UiModel } from '../model'
|
|
9
9
|
|
|
10
10
|
const selectClassName =
|
|
@@ -3,7 +3,7 @@ import type { Html } from 'foldkit/html'
|
|
|
3
3
|
|
|
4
4
|
import { Slider } from '@foldkit/ui'
|
|
5
5
|
|
|
6
|
-
import { UiMessage } from '../message'
|
|
6
|
+
import { Message as UiMessage } from '../message'
|
|
7
7
|
import type { UiModel } from '../model'
|
|
8
8
|
|
|
9
9
|
const rowClassName = 'flex flex-col gap-2 w-full max-w-sm'
|
|
@@ -4,7 +4,7 @@ import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
|
4
4
|
|
|
5
5
|
import { Switch } from '@foldkit/ui'
|
|
6
6
|
|
|
7
|
-
import { UiMessage } from '../message'
|
|
7
|
+
import { Message as UiMessage } from '../message'
|
|
8
8
|
import type { UiModel } from '../model'
|
|
9
9
|
|
|
10
10
|
const SWITCH_DEMO_ID = 'switch-demo'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Array, Match
|
|
1
|
+
import { Array, Match } from 'effect'
|
|
2
2
|
import { Submodel } from 'foldkit'
|
|
3
3
|
import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
4
4
|
|
|
5
5
|
import { Tabs } from '@foldkit/ui'
|
|
6
6
|
|
|
7
|
-
import { UiMessage } from '../message'
|
|
7
|
+
import { Message as UiMessage } from '../message'
|
|
8
8
|
import { type DemoTab, type UiModel } from '../model'
|
|
9
9
|
|
|
10
10
|
const demoTabs: ReadonlyArray<DemoTab> = ['Foldkit', 'React', 'Elm']
|
|
@@ -87,11 +87,11 @@ const elmPanel = (h: HtmlBuilder<UiMessage>): Html => {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
const panelFor = (tab: DemoTab, h: HtmlBuilder<UiMessage>): Html =>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
Match.value(tab).pipe(
|
|
91
|
+
Match.when('Foldkit', () => foldkitPanel(h)),
|
|
92
|
+
Match.when('React', () => reactPanel(h)),
|
|
93
|
+
Match.when('Elm', () => elmPanel(h)),
|
|
94
|
+
Match.exhaustive,
|
|
95
95
|
)
|
|
96
96
|
|
|
97
97
|
export const view = Submodel.defineView<UiModel, UiMessage>(
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Match
|
|
1
|
+
import { Match, Option } from 'effect'
|
|
2
2
|
import { Submodel } from 'foldkit'
|
|
3
3
|
import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
4
4
|
|
|
5
5
|
import type { EntryHandlers, Variant } from '@foldkit/ui/toast'
|
|
6
6
|
|
|
7
7
|
import * as Icon from '../../icon'
|
|
8
|
-
import { UiMessage } from '../message'
|
|
8
|
+
import { Message as UiMessage } from '../message'
|
|
9
9
|
import type { UiModel } from '../model'
|
|
10
10
|
import { Toast } from '../toast'
|
|
11
11
|
|
|
12
12
|
type Entry = typeof Toast.Entry.Type
|
|
13
13
|
|
|
14
14
|
const variantClassName = (variant: Variant): string =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
Match.value(variant).pipe(
|
|
16
|
+
Match.when('Info', () => 'border-gray-300 bg-white text-gray-900'),
|
|
17
|
+
Match.when(
|
|
18
18
|
'Success',
|
|
19
19
|
() => 'border-emerald-300 bg-emerald-50 text-emerald-900',
|
|
20
20
|
),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
Match.when('Warning', () => 'border-amber-300 bg-amber-50 text-amber-900'),
|
|
22
|
+
Match.when('Error', () => 'border-red-300 bg-red-50 text-red-900'),
|
|
23
|
+
Match.exhaustive,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
const entryClassName = 'w-80'
|
|
@@ -4,7 +4,7 @@ import type { Html } from 'foldkit/html'
|
|
|
4
4
|
import { Tooltip } from '@foldkit/ui'
|
|
5
5
|
import type { AnchorConfig } from '@foldkit/ui/tooltip'
|
|
6
6
|
|
|
7
|
-
import { UiMessage } from '../message'
|
|
7
|
+
import { Message as UiMessage } from '../message'
|
|
8
8
|
import type { UiModel } from '../model'
|
|
9
9
|
|
|
10
10
|
const triggerClassName =
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Array, Match
|
|
1
|
+
import { Array, Match, Option, pipe } from 'effect'
|
|
2
2
|
import { Submodel } from 'foldkit'
|
|
3
3
|
import type { Html, HtmlBuilder } from 'foldkit/html'
|
|
4
4
|
|
|
5
5
|
import { VirtualList } from '@foldkit/ui'
|
|
6
6
|
|
|
7
|
-
import { UiMessage } from '../message'
|
|
7
|
+
import { Message as UiMessage } from '../message'
|
|
8
8
|
import type { UiModel } from '../model'
|
|
9
9
|
|
|
10
10
|
type Activity = Readonly<{
|
|
@@ -88,11 +88,11 @@ const formatTimeAgo = (hours: number): string => {
|
|
|
88
88
|
|
|
89
89
|
const targetForVerb = (verb: string, index: number): string => {
|
|
90
90
|
const number = ((index * 13) % 9999) + 1
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
return Match.value(verb).pipe(
|
|
92
|
+
Match.withReturnType<string>(),
|
|
93
|
+
Match.when('pushed to', () => cycle(branchNames, index)),
|
|
94
|
+
Match.whenOr('opened', 'closed', 'reopened', () => `issue #${number}`),
|
|
95
|
+
Match.orElse(() => `PR #${number}`),
|
|
96
96
|
)
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Array, Option, Schema
|
|
1
|
+
import { Array, Option, Schema } from 'effect'
|
|
2
2
|
|
|
3
|
-
export const Artwork =
|
|
4
|
-
id:
|
|
5
|
-
title:
|
|
6
|
-
medium:
|
|
7
|
-
description:
|
|
8
|
-
gradientClassName:
|
|
3
|
+
export const Artwork = Schema.Struct({
|
|
4
|
+
id: Schema.Number,
|
|
5
|
+
title: Schema.String,
|
|
6
|
+
medium: Schema.String,
|
|
7
|
+
description: Schema.String,
|
|
8
|
+
gradientClassName: Schema.String,
|
|
9
9
|
})
|
|
10
10
|
export type Artwork = typeof Artwork.Type
|
|
11
11
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Effect, Option, Schema
|
|
1
|
+
import { Array, Effect, Option, Schema, String } from 'effect'
|
|
2
2
|
import { Command, Runtime, type Update } from 'foldkit'
|
|
3
3
|
import { Document, Html, HtmlBuilder } from 'foldkit/html'
|
|
4
4
|
import { defineMessageUnion } from 'foldkit/message'
|
|
@@ -14,9 +14,9 @@ export { AppRoute } from './route'
|
|
|
14
14
|
|
|
15
15
|
// MODEL
|
|
16
16
|
|
|
17
|
-
export const Model =
|
|
17
|
+
export const Model = Schema.Struct({
|
|
18
18
|
route: AppRoute,
|
|
19
|
-
filterText:
|
|
19
|
+
filterText: Schema.String,
|
|
20
20
|
})
|
|
21
21
|
export type Model = typeof Model.Type
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ export const Message = defineMessageUnion({
|
|
|
27
27
|
CompletedLoadExternal: {},
|
|
28
28
|
ClickedLink: { request: UrlRequest },
|
|
29
29
|
ChangedUrl: { url: Url },
|
|
30
|
-
UpdatedFilterText: { filterText:
|
|
30
|
+
UpdatedFilterText: { filterText: Schema.String },
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
export type Message = typeof Message.Type
|
|
@@ -41,14 +41,14 @@ export const init: Runtime.RoutingApplicationInit<Model, Message> = (
|
|
|
41
41
|
// COMMAND
|
|
42
42
|
|
|
43
43
|
const NavigateInternal = Command.define('NavigateInternal', {
|
|
44
|
-
args: { url:
|
|
44
|
+
args: { url: Schema.String },
|
|
45
45
|
messages: [Message.CompletedNavigateInternal],
|
|
46
46
|
execute: ({ url }) =>
|
|
47
47
|
pushUrl(url).pipe(Effect.as(Message.CompletedNavigateInternal())),
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
const LoadExternal = Command.define('LoadExternal', {
|
|
51
|
-
args: { href:
|
|
51
|
+
args: { href: Schema.String },
|
|
52
52
|
messages: [Message.CompletedLoadExternal],
|
|
53
53
|
execute: ({ href }) =>
|
|
54
54
|
load(href).pipe(Effect.as(Message.CompletedLoadExternal())),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Schema
|
|
1
|
+
import { Schema, pipe } from 'effect'
|
|
2
2
|
import { Route } from 'foldkit'
|
|
3
3
|
import { defineRouteUnion, int, literal, slash } from 'foldkit/route'
|
|
4
4
|
|
|
5
5
|
export const AppRoute = defineRouteUnion({
|
|
6
6
|
Gallery: {},
|
|
7
|
-
Artwork: { artworkId:
|
|
8
|
-
NotFound: { path:
|
|
7
|
+
Artwork: { artworkId: Schema.Number },
|
|
8
|
+
NotFound: { path: Schema.String },
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
export type AppRoute = typeof AppRoute.Type
|