Skip to content

Commit 1e86b56

Browse files
committed
Update README homomorphic -> isomorphic and documentation
1 parent db27065 commit 1e86b56

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ components that just works.
1616
> launching into Redraw, you should take a look at Lustre, it provides a
1717
> user-friendly, awesome experience right out-of-the-box for every gleamlins!
1818
>
19-
> As a bonus, Lustre is homomorphic, i.e. it can be used as well on client and
20-
> on server with the same codebase!
19+
> As a bonus, Lustre is isomorphic, i.e. it can be used as well on client and on
20+
> server with the same codebase!
2121
>
2222
> Redraw assumes you have minimal knowledge on frontend development, and will
2323
> neither try to ease your learning curve nor simplify and hide the frontend
@@ -125,8 +125,8 @@ difference: wrap the component in `use <- redraw.component()`!
125125

126126
```gleam
127127
import redraw
128-
import redraw/attribute
129-
import redraw/html
128+
import redraw/dom/attribute
129+
import redraw/dom/html
130130
131131
pub fn gleam_is_awesome() {
132132
use <- redraw.component__("GleamIsAwesome")
@@ -142,14 +142,14 @@ component_.
142142

143143
```gleam
144144
import redraw
145-
import redraw/attribute
146-
import redraw/html
147-
import redraw_dom/client
145+
import redraw/dom/attribute
146+
import redraw/dom/client
147+
import redraw/dom/html
148148
149149
pub fn main() {
150150
let root = root()
151-
client.create_root("root")
152-
|> client.render(redraw.strict_mode([root()]))
151+
let assert Ok(root) = client.create_root("root")
152+
client.render(root, redraw.strict_mode([root()]))
153153
}
154154
155155
fn root() {
@@ -190,7 +190,7 @@ pub type CounterProps {
190190
pub fn counter() {
191191
use props: CounterProps <- react.component_("Counter")
192192
html.button(
193-
[h.on_click(fn(_) { props.set_count(fn(count) { count + 1 }) })],
193+
[events.on_click(fn(_) { props.set_count(fn(count) { count + 1 }) })],
194194
[html.text("count is " <> int.to_string(props.count))],
195195
)
196196
}
@@ -204,7 +204,7 @@ pub type CounterProps = #(Int, fn(fn(Int) -> Int) -> Nil)
204204
pub fn counter() {
205205
use #(count, set_count): CounterProps <- react.component_("Counter")
206206
html.button(
207-
[h.on_click(fn(_) { set_count(fn(count) { count + 1 }) })],
207+
[events.on_click(fn(_) { set_count(fn(count) { count + 1 }) })],
208208
[html.text("count is " <> int.to_string(count))],
209209
)
210210
}
@@ -281,7 +281,7 @@ of optionals.
281281
```gleam
282282
import gleam/option.{type Option}
283283
import redraw
284-
import redraw/html
284+
import redraw/dom/html
285285
286286
// This type will be converted to correct JS props.
287287
pub type ExternalComponentProps {

redraw/src/redraw/event.gleam

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
//// known as a “synthetic event”.
33
////
44
//// ```gleam
5-
//// import redraw/element/html
6-
//// import redraw/handler
5+
//// import redraw/dom/events
6+
//// import redraw/dom/html
77
////
88
//// pub fn render() {
99
//// html.button(
1010
//// [
11-
//// handler.on_click(fn (event) {
11+
//// events.on_click(fn (event) {
1212
//// io.debug(event) // React Event
1313
//// })
1414
//// ],
@@ -27,7 +27,7 @@
2727
//// future. If you need the underlying browser event for some reason, read it
2828
//// from `event.native_event(event)`.
2929
////
30-
//// Every events have their implementation as `redraw/event/[event_name]`, and
30+
//// Every events have their implementation as `redraw/dom/event/[event_name]`, and
3131
//// their corresponding functions are implemented in those. Every time you need
3232
//// to use one of the functions defined here, use `to_event` from the
3333
//// corresponding module.

redraw_dom/manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ packages = [
55
{ name = "gleam_javascript", version = "0.13.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "F98328FCF573DA6F3A35D7F6CB3F9FF19FD5224CCBA9151FCBEAA0B983AF2F58" },
66
{ name = "gleam_stdlib", version = "0.51.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "14AFA8D3DDD7045203D422715DBB822D1725992A31DF35A08D97389014B74B68" },
77
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
8-
{ name = "redraw", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], otp_app = "redraw", source = "hex", outer_checksum = "56FE81C2AA3B230A3401F464719BD6DAEB5DB4AC7DC3070132D727D4382EA790" },
8+
{ name = "redraw", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], otp_app = "redraw", source = "hex", outer_checksum = "FF52D8626E1E6DC92EB8BC9DC8C70BC6F0E25824524A7C0658222EA406B5BE23" },
99
]
1010

1111
[requirements]

redraw_dom/src/redraw/dom.gleam

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import redraw.{type Component}
99
///
1010
/// ```gleam
1111
/// import redraw
12-
/// import redraw/html
1312
/// import redraw/dom/client
13+
/// import redraw/dom/html
1414
///
1515
/// pub fn main() {
1616
/// let assert Ok(root) = client.create_root("app")
@@ -43,6 +43,7 @@ pub fn create_portal(
4343
/// ```gleam
4444
/// import redraw
4545
/// import redraw/dom
46+
/// import redraw/dom/events
4647
///
4748
/// type Action {
4849
/// Increment
@@ -53,7 +54,7 @@ pub fn create_portal(
5354
/// use <- redraw.component__()
5455
/// let #(state, set_state) = redraw.set_state(0)
5556
/// let on_click = fn(type_: Action) {
56-
/// handler.on_click(fn (event) {
57+
/// events.on_click(fn (event) {
5758
/// // Calling flush_sync forces the DOM to refresh.
5859
/// dom.flush_sync(fn () {
5960
/// set_state(case type_ {

0 commit comments

Comments
 (0)