foldkit 0.13.0-canary.0 → 0.13.0-canary.2

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/README.md CHANGED
@@ -1,11 +1,23 @@
1
1
  # Foldkit
2
2
 
3
- > ⚠️ **Experimental**: Foldkit is in canary release for early adopters and experimenters. APIs are incomplete and may change rapidly.
3
+ > ⚠️ Foldkit is in canary release for early adopters and experimenters. APIs are incomplete and may change rapidly.
4
4
 
5
- **Foldkit** is an [Elm](https://elm-lang.org/)-inspired UI framework powered by [Effect](https://effect.website/).
5
+ **Foldkit** is an [Elm](https://elm-lang.org/)-inspired framework for building web applications powered by [Effect](https://effect.website/).
6
6
 
7
7
  > Like origami: simple parts become intricate when folded together.
8
8
 
9
+ ---
10
+
11
+ ## Philosophy
12
+
13
+ Foldkit applies functional programming principles to web application development.
14
+
15
+ - **Pure updates** — State transitions are deterministic functions: `(model: Model, message: Message): Model` is the only way to change state.
16
+ - **Controlled side effects** — Side effects are described as `Command<Message>` values and executed by the runtime, not performed directly in update functions.
17
+ - **Explicit state transitions** — Every state change is modeled as a specific message type and is captured in the update function.
18
+
19
+ ---
20
+
9
21
  ## Installation
10
22
 
11
23
  The best way to get started with Foldkit is to use `create-foldkit-app`. This
@@ -16,12 +28,16 @@ package manager and example template.
16
28
  npx create-foldkit-app@latest --wizard
17
29
  ```
18
30
 
19
- ## Counter Example
31
+ ---
32
+
33
+ ### Simple Counter Example
34
+
35
+ See the full example at [examples/counter/src/main.ts](examples/counter/src/main.ts)
20
36
 
21
37
  ```ts
22
38
  import { Match as M, Schema } from 'effect'
23
39
  import { Runtime } from 'foldkit'
24
- import { Class, Html, OnClick, button, div } from 'foldkit/html'
40
+ import { Html, html } from 'foldkit/html'
25
41
  import { ts } from 'foldkit/schema'
26
42
 
27
43
  // MODEL
@@ -41,13 +57,13 @@ type Decrement = typeof Decrement.Type
41
57
  type Increment = typeof Increment.Type
42
58
  type Reset = typeof Reset.Type
43
59
 
44
- type Message = typeof Message.Type
60
+ export type Message = typeof Message.Type
45
61
 
46
62
  // UPDATE
47
63
 
48
- const update = (count: Model, message: Message): [Model, Runtime.Command<Message>[]] =>
64
+ const update = (count: Model, message: Message): [Model, ReadonlyArray<Runtime.Command<Message>>] =>
49
65
  M.value(message).pipe(
50
- M.withReturnType<[Model, Runtime.Command<Message>[]]>(),
66
+ M.withReturnType<[Model, ReadonlyArray<Runtime.Command<Message>>]>(),
51
67
  M.tagsExhaustive({
52
68
  Decrement: () => [count - 1, []],
53
69
  Increment: () => [count + 1, []],
@@ -61,6 +77,8 @@ const init: Runtime.ElementInit<Model, Message> = () => [0, []]
61
77
 
62
78
  // VIEW
63
79
 
80
+ const { div, button, Class, OnClick } = html<Message>()
81
+
64
82
  const view = (count: Model): Html =>
65
83
  div(
66
84
  [Class('min-h-screen bg-white flex flex-col items-center justify-center gap-6 p-6')],
@@ -96,4 +114,40 @@ Runtime.run(element)
96
114
 
97
115
  ---
98
116
 
99
- **📚 Full documentation and examples**: https://github.com/devinjameson/foldkit
117
+ ## Development
118
+
119
+ Explore the examples locally:
120
+
121
+ ```bash
122
+ git clone https://github.com/devinjameson/foldkit.git
123
+ cd foldkit
124
+ pnpm install
125
+
126
+ # In one terminal - build Foldkit in watch mode
127
+ pnpm dev:core
128
+
129
+ # In another terminal - run the counter example
130
+ pnpm dev:example:counter
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Status
136
+
137
+ We're building in the open. Feedback, issues, and contributions are welcome.
138
+
139
+ ---
140
+
141
+ ## Roadmap
142
+
143
+ - [x] Core program loop with ADT-based update
144
+ - [x] DOM rendering
145
+ - [x] Optimized DOM rendering (minimal diffs, efficient updates)
146
+ - [x] Router integration
147
+ - [ ] Devtools + tracing
148
+
149
+ ---
150
+
151
+ ## License
152
+
153
+ MIT