diff --git a/.gitignore b/.gitignore index fef0b97..0f1875d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,11 @@ build erl_crash.dump node_modules -example/index.html -example/priv + +src/lustre_ui.css + +priv/static/lustre_ui_storybook.* + +#Added automatically by Lustre Dev Tools +/.lustre +/dist diff --git a/README.md b/README.md index 1af794f..1f75d48 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,24 @@ gleam add lustre_ui@1.0.0-rc.1 Ensure the required CSS is rendered in your apps by serving the stylesheet found in the `priv/static` directory of this package! +## Usage + +In order for lustre/ui to work correctly you need to do two things: + +1. Include the lustre/ui stylesheet in your app. This can be found in the + `priv/static` directory for _this package_ and can either be served by your + backend (in case of a full stack application) or copied or otherwise included + from `build/packages/lustre_ui/priv/static` in your frontend application. + +2. Construct a theme from the `lustre/ui/theme` module and render the dynamic + style element by calling `theme.to_style` or wrapping your application's view + function using `theme.inject`. + +**Both** of these steps must be done in order for the components to render +correctly. The base stylesheet includes the necessary CSS rules and classes for +every component, and your theme defines the design tokens and CSS variables used +by those components. + ## Support Lustre is mostly built by just me, [Hayleigh](https://github.com/hayleigh-dot-dev), diff --git a/assets/diagram-alert.svg b/assets/diagram-alert.svg deleted file mode 100644 index b310d57..0000000 --- a/assets/diagram-alert.svg +++ /dev/null @@ -1,505 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Alert - - -   - - - title - - - - - Alert - - -   - - - title - - - - - - - - - - - - - - - - - - - - - - - Alert - - -   - - - description... - - - - - Alert - - -   - - - description... - - - - - - - - - - - - - - - - - - - - - - - alert.indicator - - - - - alert.indicator - - - - - - - alert.title - - - - - alert.title - - - - - - - alert.content - - - - - alert.content - - - - - - - - - - - - - - - - - - - - - - - alert - - - - - alert - - - - diff --git a/birdie_snapshots/tween_in_back.accepted b/birdie_snapshots/tween_in_back.accepted deleted file mode 100644 index 76da680..0000000 --- a/birdie_snapshots/tween_in_back.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in Back ---- - ◍ - - - - - ◍ - - - - ◍ - - - - ◍ - - - ◍ - - - ◍ - - - ◍ - - - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - ◍ -◍◍◍◍ ◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_bounce.accepted b/birdie_snapshots/tween_in_bounce.accepted deleted file mode 100644 index 886643e..0000000 --- a/birdie_snapshots/tween_in_bounce.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in Bounce ---- - ◍◍ - ◍ - ◍ - ◍ - - ◍ - - - ◍ - - - ◍ - - - ◍ - - - - ◍ - - - - ◍ - - - - ◍◍ ◍ - ◍ ◍◍ - ◍ ◍ - - ◍ ◍ - ◍ ◍ - ◍ - ◍◍◍◍ - ◍ ◍ ◍◍ ◍ -◍◍ ◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_circ.accepted b/birdie_snapshots/tween_in_circ.accepted deleted file mode 100644 index 495fb10..0000000 --- a/birdie_snapshots/tween_in_circ.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in Circ ---- - ◍ - - - - - - - - ◍ - - - - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍◍ - ◍ - ◍◍ - ◍◍◍ - ◍◍ - ◍◍◍◍◍ -◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_cubic.accepted b/birdie_snapshots/tween_in_cubic.accepted deleted file mode 100644 index 917ab4e..0000000 --- a/birdie_snapshots/tween_in_cubic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in cubic ---- - ◍ - - - ◍ - - - ◍ - - ◍ - - - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍◍ - ◍◍ - ◍◍◍◍ -◍◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_elastic.accepted b/birdie_snapshots/tween_in_elastic.accepted deleted file mode 100644 index b83474b..0000000 --- a/birdie_snapshots/tween_in_elastic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in Elastic ---- - ◍ - - - - - - - - - - - ◍ - - - - - - - - - - - - - - - ◍ - - - - ◍ - ◍ ◍ - - ◍ - ◍◍ ◍ -◍◍◍◍◍◍◍◍◍◍◍◍◍◍ ◍◍ ◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_expo.accepted b/birdie_snapshots/tween_in_expo.accepted deleted file mode 100644 index 69ea919..0000000 --- a/birdie_snapshots/tween_in_expo.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in Expo ---- - ◍ - - - - - - ◍ - - - - - ◍ - - - - - ◍ - - - ◍ - - - ◍ - - ◍ - - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍◍ - ◍◍ - ◍◍◍◍◍◍ -◍◍◍◍◍◍◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_back.accepted b/birdie_snapshots/tween_in_out_back.accepted deleted file mode 100644 index 58d82ba..0000000 --- a/birdie_snapshots/tween_in_out_back.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out Back ---- - ◍◍◍ - ◍ - - ◍ - - - ◍ - - - - ◍ - - - - - ◍ - - - - - ◍ - - - - - ◍ - - - - ◍ - - - ◍ - - ◍ -◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_bounce.accepted b/birdie_snapshots/tween_in_out_bounce.accepted deleted file mode 100644 index d2620df..0000000 --- a/birdie_snapshots/tween_in_out_bounce.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out Bounce ---- - ◍ ◍◍◍ - ◍◍◍ - - ◍ ◍ - ◍ ◍◍◍ - - - - - ◍ - - - ◍ - - - ◍ - - ◍◍ - ◍◍ - - ◍ - - - ◍ - - - ◍ - - - - - ◍◍◍ ◍ - ◍ ◍ - - ◍◍◍ -◍◍◍ ◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_circ.accepted b/birdie_snapshots/tween_in_out_circ.accepted deleted file mode 100644 index e649469..0000000 --- a/birdie_snapshots/tween_in_out_circ.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out Circ ---- - ◍◍◍◍◍ - ◍◍◍ - ◍◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - - - ◍ - - - - - - - - - ◍ - - - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍◍ - ◍◍◍ -◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_cubic.accepted b/birdie_snapshots/tween_in_out_cubic.accepted deleted file mode 100644 index 608b4d5..0000000 --- a/birdie_snapshots/tween_in_out_cubic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out cubic ---- - ◍◍◍◍◍◍ - ◍◍ - ◍◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - - ◍ - - ◍ - - - ◍ - - - ◍ - - - ◍ - - ◍ - - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍◍ - ◍◍ -◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_elastic.accepted b/birdie_snapshots/tween_in_out_elastic.accepted deleted file mode 100644 index fd1a4c3..0000000 --- a/birdie_snapshots/tween_in_out_elastic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out Elastic ---- - ◍◍◍◍◍◍◍◍◍ - ◍◍◍ - - - ◍ - - - - - - - - - ◍ - - - - - - - - - ◍ - - - - - - - - - ◍ - - - ◍◍◍ -◍◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_expo.accepted b/birdie_snapshots/tween_in_out_expo.accepted deleted file mode 100644 index fb61182..0000000 --- a/birdie_snapshots/tween_in_out_expo.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out Expo ---- - ◍◍◍◍◍◍◍◍◍ - ◍◍◍ - ◍ - ◍ - ◍ - - - ◍ - - - ◍ - - - - ◍ - - - - - - - ◍ - - - - ◍ - - - ◍ - - - ◍ - ◍ - ◍ - ◍◍◍ -◍◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_quadratic.accepted b/birdie_snapshots/tween_in_out_quadratic.accepted deleted file mode 100644 index 55eff74..0000000 --- a/birdie_snapshots/tween_in_out_quadratic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out quadratic ---- - ◍◍◍ - ◍◍◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - - ◍ - - ◍ - ◍ - - ◍ - - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍◍◍ -◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_quartic.accepted b/birdie_snapshots/tween_in_out_quartic.accepted deleted file mode 100644 index f7511c5..0000000 --- a/birdie_snapshots/tween_in_out_quartic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out quartic ---- - ◍◍◍◍◍◍◍◍ - ◍◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - - ◍ - - - ◍ - - - - ◍ - - - ◍ - - - - ◍ - - - ◍ - - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍◍ -◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_quint.accepted b/birdie_snapshots/tween_in_out_quint.accepted deleted file mode 100644 index 04507f1..0000000 --- a/birdie_snapshots/tween_in_out_quint.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out Quint ---- - ◍◍◍◍◍◍◍◍◍ - ◍◍ - ◍ - ◍ - ◍ - - ◍ - - ◍ - - - ◍ - - - - ◍ - - - - - ◍ - - - - ◍ - - - ◍ - - ◍ - - ◍ - ◍ - ◍ - ◍◍ -◍◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_out_sine.accepted b/birdie_snapshots/tween_in_out_sine.accepted deleted file mode 100644 index 39eca9d..0000000 --- a/birdie_snapshots/tween_in_out_sine.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in out sine ---- - ◍◍◍ - ◍◍ - ◍◍ - ◍ - ◍ - ◍ - - ◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍ - - ◍ - ◍ - ◍ - ◍◍ - ◍◍ -◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_quadratic.accepted b/birdie_snapshots/tween_in_quadratic.accepted deleted file mode 100644 index eff832c..0000000 --- a/birdie_snapshots/tween_in_quadratic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in quadratic ---- - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - ◍ - - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍ - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍ - ◍◍ - ◍ - ◍ - ◍◍ - ◍◍ - ◍◍◍ -◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_quartic.accepted b/birdie_snapshots/tween_in_quartic.accepted deleted file mode 100644 index b1be99b..0000000 --- a/birdie_snapshots/tween_in_quartic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in quartic ---- - ◍ - - - - ◍ - - - ◍ - - - - ◍ - - ◍ - - - ◍ - - - ◍ - - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍ - - ◍◍ - ◍ - ◍ - ◍◍◍ - ◍◍◍ -◍◍◍◍◍◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_quint.accepted b/birdie_snapshots/tween_in_quint.accepted deleted file mode 100644 index 85a8124..0000000 --- a/birdie_snapshots/tween_in_quint.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in Quint ---- - ◍ - - - - - ◍ - - - - ◍ - - - - ◍ - - - ◍ - - - ◍ - - ◍ - - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍◍ - ◍◍ - ◍◍◍◍ -◍◍◍◍◍◍◍◍◍◍◍◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_in_sine.accepted b/birdie_snapshots/tween_in_sine.accepted deleted file mode 100644 index 2dc0c66..0000000 --- a/birdie_snapshots/tween_in_sine.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween in sine ---- - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - ◍ - - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍◍ - ◍◍ - ◍◍◍ -◍◍◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_linear.accepted b/birdie_snapshots/tween_linear.accepted deleted file mode 100644 index 0b84098..0000000 --- a/birdie_snapshots/tween_linear.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween linear ---- - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_back.accepted b/birdie_snapshots/tween_out_back.accepted deleted file mode 100644 index a825244..0000000 --- a/birdie_snapshots/tween_out_back.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out Back ---- - ◍ ◍◍◍◍ - ◍ - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - - - ◍ - - - ◍ - - - ◍ - - - ◍ - - - - ◍ - - - - ◍ - - - - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_bounce.accepted b/birdie_snapshots/tween_out_bounce.accepted deleted file mode 100644 index 076ef89..0000000 --- a/birdie_snapshots/tween_out_bounce.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out Bounce ---- - ◍ ◍◍ - ◍ ◍◍ ◍ ◍ - ◍◍◍◍ - ◍ - ◍ ◍ - ◍ ◍ - - ◍ ◍ - ◍◍ ◍ - ◍ ◍◍ - - - - ◍ - - - - ◍ - - - - ◍ - - - ◍ - - - ◍ - - - ◍ - - ◍ - ◍ - ◍ -◍◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_circ.accepted b/birdie_snapshots/tween_out_circ.accepted deleted file mode 100644 index b253d6f..0000000 --- a/birdie_snapshots/tween_out_circ.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out Circ ---- - ◍◍◍◍◍◍ - ◍◍◍◍◍ - ◍◍ - ◍◍◍ - ◍◍ - ◍ - ◍◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - - - - ◍ - - - - - - - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_cubic.accepted b/birdie_snapshots/tween_out_cubic.accepted deleted file mode 100644 index 575984c..0000000 --- a/birdie_snapshots/tween_out_cubic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out cubic ---- - ◍◍◍◍◍◍◍◍◍ - ◍◍◍◍ - ◍◍ - ◍◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - - ◍ - - - ◍ - - ◍ - - - ◍ - - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_elastic.accepted b/birdie_snapshots/tween_out_elastic.accepted deleted file mode 100644 index 46f98cb..0000000 --- a/birdie_snapshots/tween_out_elastic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out Elastic ---- - ◍ ◍◍ ◍◍◍◍◍◍◍◍◍◍◍◍◍◍ - ◍ ◍◍ - ◍ - - ◍ ◍ - ◍ - - - - ◍ - - - - - - - - - - - - - - - ◍ - - - - - - - - - - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_expo.accepted b/birdie_snapshots/tween_out_expo.accepted deleted file mode 100644 index 4100c69..0000000 --- a/birdie_snapshots/tween_out_expo.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out Expo ---- - ◍◍◍◍◍◍◍◍◍◍◍◍◍◍ - ◍◍◍◍◍◍ - ◍◍ - ◍◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - - ◍ - - ◍ - - - ◍ - - - ◍ - - - - - ◍ - - - - - ◍ - - - - - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_quadratic.accepted b/birdie_snapshots/tween_out_quadratic.accepted deleted file mode 100644 index c132092..0000000 --- a/birdie_snapshots/tween_out_quadratic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out quadratic ---- - ◍◍◍◍◍ - ◍◍◍ - ◍◍ - ◍◍ - ◍ - ◍ - ◍◍ - ◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - ◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - - ◍ - ◍ - - ◍ - - ◍ - - ◍ - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_quartic.accepted b/birdie_snapshots/tween_out_quartic.accepted deleted file mode 100644 index 9027755..0000000 --- a/birdie_snapshots/tween_out_quartic.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out quartic ---- - ◍◍◍◍◍◍◍◍◍◍◍◍◍ - ◍◍◍ - ◍◍◍ - ◍ - ◍ - ◍◍ - - ◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - - ◍ - - - ◍ - - - ◍ - - ◍ - - - - ◍ - - - ◍ - - - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_quint.accepted b/birdie_snapshots/tween_out_quint.accepted deleted file mode 100644 index f8f18dd..0000000 --- a/birdie_snapshots/tween_out_quint.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out Quint ---- - ◍◍◍◍◍◍◍◍◍◍◍◍◍◍◍ - ◍◍◍◍ - ◍◍ - ◍◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - - ◍ - - ◍ - - - ◍ - - - ◍ - - - - ◍ - - - - ◍ - - - - -◍ \ No newline at end of file diff --git a/birdie_snapshots/tween_out_sine.accepted b/birdie_snapshots/tween_out_sine.accepted deleted file mode 100644 index 7d6a6f9..0000000 --- a/birdie_snapshots/tween_out_sine.accepted +++ /dev/null @@ -1,40 +0,0 @@ ---- -version: 1.1.6 -title: Tween out sine ---- - ◍◍◍◍ - ◍◍◍ - ◍◍ - ◍◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - ◍ - - ◍ - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - - ◍ - ◍ - -◍ \ No newline at end of file diff --git a/dev/storybook.css b/dev/storybook.css new file mode 100644 index 0000000..f1d8c73 --- /dev/null +++ b/dev/storybook.css @@ -0,0 +1 @@ +@import "tailwindcss"; diff --git a/dev/storybook.gleam b/dev/storybook.gleam new file mode 100644 index 0000000..3d868a2 --- /dev/null +++ b/dev/storybook.gleam @@ -0,0 +1,32 @@ +import lustre/dev/fable +import storybook/lustre/ui/accordion +import storybook/lustre/ui/tabs +import storybook/lustre/ui/toggle +import storybook/lustre/ui/tooltip + +pub fn main() { + let assert Ok(_) = + fable.book("lustre/ui", [ + fable.external_stylesheet("/storybook.css"), + fable.chapter("accordion", [ + accordion.basic_story(), + accordion.default_open_story(), + accordion.playground_story(), + ]), + + fable.chapter("tabs", [ + tabs.basic_story(), + ]), + + fable.chapter("toggle", [ + toggle.basic_story(), + toggle.group_story(), + toggle.form_story(), + ]), + + fable.chapter("tooltip", [ + tooltip.basic_story(), + ]), + ]) + |> fable.start +} diff --git a/dev/storybook/lustre/ui/accordion.gleam b/dev/storybook/lustre/ui/accordion.gleam new file mode 100644 index 0000000..dee07bf --- /dev/null +++ b/dev/storybook/lustre/ui/accordion.gleam @@ -0,0 +1,136 @@ +// IMPORTS --------------------------------------------------------------------- + +import gleam/int +import gleam/list +import lustre/attribute +import lustre/dev/fable +import lustre/element/html +import lustre/ui/accordion + +// CONSTANTS ------------------------------------------------------------------- + +const accordion = "w-lg" + +const accordion_item = "border-b border-gray-100" + +const accordion_trigger = "block w-full bg-gray-50 p-2 text-left + hover:bg-gray-100 + focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-800" + +const accordion_panel = "h-(--accordion-panel-height) overflow-hidden transition-[height] ease-out" + +const items = [ + #( + "What is lustre/ui?", + "Lustre/ui is a collection of unstyled Lustre components developed with a + focus on accessibility and usability.", + ), + #( + "What does accessibility mean?", + "Accessibility means that Lustre components are built to be usable by as many + people as possible. We follow WAI-ARIA guidelines to ensure these components + are accessible to keyboard and screen reader users.", + ), + #( + "How do I use lustre/ui?", + "You can install lustre/ui through Gleam's package manager and import the + components you need in your Lustre application. The package also includes + bundles for each component so they can be used in server-rendered or static + HTML documents.", + ), +] + +// STORIES --------------------------------------------------------------------- + +pub fn basic_story() { + let _ = accordion.register() + + use <- fable.story("accordion/basic") + use _ <- fable.scene + + accordion.view([attribute.class(accordion)], { + use #(question, answer), index <- list.index_map(items) + + accordion.item( + name: "item-" <> int.to_string(index), + attributes: [attribute.class(accordion_item)], + heading: accordion.heading([], { + accordion.trigger([attribute.class(accordion_trigger)], [ + html.text(question), + ]) + }), + panel: accordion.panel([attribute.class(accordion_panel)], [ + html.p([attribute.class("p-2")], [ + html.text(answer), + accordion.close([], [html.text("wibble")]), + ]), + ]), + ) + }) +} + +pub fn default_open_story() { + let _ = accordion.register() + + use <- fable.story("accordion/default-open") + use _ <- fable.scene + + accordion.view([attribute.class(accordion)], { + use #(question, answer), index <- list.index_map(items) + + accordion.item( + name: "item-" <> int.to_string(index), + attributes: [ + attribute.class(accordion_item), + accordion.default_open(index == 1), + ], + heading: accordion.heading( + [], + accordion.trigger([attribute.class(accordion_trigger)], [ + html.text(question), + ]), + ), + panel: accordion.panel([attribute.class(accordion_panel)], [ + html.p([attribute.class("p-2")], [ + html.text(answer), + ]), + ]), + ) + }) +} + +pub fn playground_story() { + let _ = accordion.register() + + use <- fable.story("accordion/playground") + use multiple <- fable.checkbox("multiple") + use loop <- fable.checkbox("loop") + use controls <- fable.scene + + let mode = case fable.get(controls, multiple) { + True -> accordion.multiple() + False -> accordion.single() + } + + let loop = accordion.loop(fable.get(controls, loop)) + + accordion.view([attribute.class(accordion), mode, loop], { + use #(question, answer), index <- list.index_map(items) + + accordion.item( + name: "item-" <> int.to_string(index), + attributes: [attribute.class(accordion_item)], + heading: accordion.heading( + [], + accordion.trigger([attribute.class(accordion_trigger)], [ + html.text(question), + ]), + ), + panel: accordion.panel([attribute.class(accordion_panel)], [ + html.p([attribute.class("p-2")], [ + html.text(answer), + ]), + ]), + ) + }) +} diff --git a/dev/storybook/lustre/ui/tabs.gleam b/dev/storybook/lustre/ui/tabs.gleam new file mode 100644 index 0000000..15ed378 --- /dev/null +++ b/dev/storybook/lustre/ui/tabs.gleam @@ -0,0 +1,61 @@ +// IMPORTS --------------------------------------------------------------------- + +import lustre/attribute +import lustre/dev/fable +import lustre/element/html +import lustre/ui/tabs + +// CONSTANTS ------------------------------------------------------------------- + +const tabs = "rounded-md border border-gray-200" + +const tabs_list = "relative z-0 flex items-center gap-1 p-1 shadow-[inset_0_-1px] shadow-gray-200" + +const tabs_trigger = "flex h-6 items-center justify-center px-2 text-sm text-gray-400 + transition-colors duration-300 + outline-none + hover:text-gray-900 + [:state(active)]:text-blue-700 +" + +const tabs_indicator = "absolute -z-10 left-0 top-0 h-(--indicator-height) w-(--indicator-width) translate-x-(--indicator-x) translate-y-(--indicator-y) + rounded-sm bg-blue-50 transition-[width_height_transform] duration-300 ease-in-out + border-b border-transparent + has-[~lustre-tabs-trigger:focus]:border-blue-800 has-[~lustre-tabs-trigger:focus]:rounded-b-none + + " + +const tabs_content = "h-32" + +const tabs_panel = "relative flex h-full items-center justify-center -outline-offset-1 outline-blue-800 + focus-visible:rounded-b-md focus-visible:outline focus-visible:outline-2" + +// STORIES --------------------------------------------------------------------- + +pub fn basic_story() { + let _ = tabs.register() + + use <- fable.story("tabs/basic") + use _ <- fable.scene + + tabs.view( + [attribute.class(tabs)], + tabs.list([attribute.class(tabs_list)], [ + tabs.indicator([attribute.class(tabs_indicator)], []), + tabs.trigger("wibble", [attribute.class(tabs_trigger)], [ + html.text("Wibble"), + ]), + tabs.trigger("wobble", [attribute.class(tabs_trigger)], [ + html.text("Woooooooobble"), + ]), + ]), + tabs.content([attribute.class(tabs_content)], [ + tabs.panel("wibble", [attribute.class(tabs_panel)], [ + html.text("wibble."), + ]), + tabs.panel("wobble", [attribute.class(tabs_panel)], [ + html.text("wobble."), + ]), + ]), + ) +} diff --git a/dev/storybook/lustre/ui/toggle.gleam b/dev/storybook/lustre/ui/toggle.gleam new file mode 100644 index 0000000..6c960cb --- /dev/null +++ b/dev/storybook/lustre/ui/toggle.gleam @@ -0,0 +1,124 @@ +// IMPORTS --------------------------------------------------------------------- + +import gleam/list +import gleam/string +import lustre/attribute +import lustre/dev/fable +import lustre/element/html +import lustre/element/keyed +import lustre/event +import lustre/ui/toggle + +// CONSTANTS ------------------------------------------------------------------- + +const toggle = " + inline-flex justify-center items-center rounded size-8 + hover:bg-gray-100 + [:state(pressed)]:bg-blue-50 [:state(pressed)]:text-blue-500 + [:state(disabled)]:opacity-50 [:state(disabled)]:cursor-not-allowed + focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-500 +" + +const group = " + flex border border-gray-300 rounded + *:rounded-none *:first:rounded-l *:last:rounded-r *:focus:z-10 +" + +const items = [ + #("B", "bold", False, False), + #("I", "italic", True, False), + #("U", "underline", False, True), +] + +// STORIES --------------------------------------------------------------------- + +pub fn basic_story() { + let _ = toggle.register() + + use <- fable.story("toggle/basic") + use _ <- fable.scene + + keyed.div([attribute.class("flex gap-2 items-center")], { + use #(label, _, pressed, disabled) <- list.map(items) + let html = + toggle.view( + [ + attribute.class(toggle), + toggle.default_pressed(pressed), + toggle.disabled(disabled), + ], + [html.text(label)], + ) + + #(label, html) + }) +} + +pub fn group_story() { + let _ = toggle.register() + + use <- fable.story("toggle/group") + use _ <- fable.scene + + html.div([attribute.class("flex gap-4")], [ + toggle.group([attribute.class(group), toggle.loop(True)], { + use #(label, value, _, _) <- list.map(items) + + toggle.item(value, [attribute.class(toggle)], [ + html.text(label), + ]) + }), + ]) +} + +pub fn form_story() { + let _ = toggle.register() + + use <- fable.story("toggle/form") + use fields <- fable.input("form", "") + use _ <- fable.scene + + let handle_submit = fn(values) { + values + |> string.inspect + |> fable.set(fields, _) + } + + html.form( + [attribute.class("flex gap-4 items-center"), event.on_submit(handle_submit)], + [ + toggle.group([attribute.class(group), attribute.name("wibble")], { + use #(label, value, _, _) <- list.map(items) + + toggle.item(value, [attribute.class(toggle)], [ + html.text(label), + ]) + }), + keyed.div([attribute.class("flex gap-2 items-center")], { + use #(label, name, pressed, disabled) <- list.map(items) + let html = + toggle.view( + [ + attribute.class(toggle), + attribute.name("format"), + toggle.value(name), + toggle.default_pressed(pressed), + toggle.disabled(disabled), + ], + [html.text(label)], + ) + + #(label, html) + }), + html.button( + [ + attribute.type_("submit"), + attribute.class("py-1 px-4 text-white bg-blue-500 rounded"), + ], + [ + html.text("Submit"), + ], + ), + ], + ) +} diff --git a/dev/storybook/lustre/ui/tooltip.gleam b/dev/storybook/lustre/ui/tooltip.gleam new file mode 100644 index 0000000..34e01be --- /dev/null +++ b/dev/storybook/lustre/ui/tooltip.gleam @@ -0,0 +1,84 @@ +// IMPORTS --------------------------------------------------------------------- + +import lustre/attribute +import lustre/dev/fable +import lustre/element/html +import lustre/ui/tooltip +import lustre/ui/tooltip/popover + +// CONSTANTS ------------------------------------------------------------------- + +const button = "inline-flex justify-center items-center rounded size-32 + hover:bg-gray-100 + focus-visible:outline focus-visible:outline-2 focus-visible:outline-blue-500 +" + +const popover = "flex flex-col px-2 py-1 rounded-md bg-black text-white text-xs shadow + opacity-0 scale-99 [:state(open)]:opacity-100 [:state(open)]:scale-100 + + [:state(top)]:left-(--tooltip-popover-x) [:state(top)]:top-[calc(var(--tooltip-popover-y)+10px)] [:state(top)]:transition-[top_opacity_transform] + [:state(top):state(open)]:top-(--tooltip-popover-y) + + [:state(bottom)]:left-(--tooltip-popover-x) [:state(bottom)]:top-[calc(var(--tooltip-popover-y)-10px)] [:state(bottom)]:transition-[top_opacity_transform] + [:state(bottom):state(open)]:top-(--tooltip-popover-y) + + [:state(left)]:top-(--tooltip-popover-y) [:state(left)]:left-[calc(var(--tooltip-popover-x)+10px)] [:state(left)]:transition-[left_opacity_transform] + [:state(left):state(open)]:left-(--tooltip-popover-x) + + [:state(right)]:top-(--tooltip-popover-y) [:state(right)]:left-[calc(var(--tooltip-popover-x)-10px)] [:state(right)]:transition-[left_opacity_transform] + [:state(right):state(open)]:left-(--tooltip-popover-x) +" + +// STORIES --------------------------------------------------------------------- + +pub fn basic_story() { + let _ = tooltip.register() + + use <- fable.story("tooltip/basic") + use side <- fable.select("side", [ + #("top", "top"), + #("right", "right"), + #("bottom", "bottom"), + #("left", "left"), + ]) + + use align <- fable.select("align", [ + #("start", "start"), + #("center", "center"), + #("end", "end"), + ]) + + use props <- fable.scene + + let placement = fable.get(props, side) |> popover.side + let align = fable.get(props, align) |> popover.align + let offset = popover.offset(10.0) + + tooltip.view( + [tooltip.delay(50)], + popover: tooltip.popover( + [attribute.class(popover), placement, offset, align], + [html.text("Bold")], + ), + trigger: tooltip.trigger([], [ + html.button([attribute.class(button)], [html.text("B")]), + ]), + ) +} + +pub fn controlled_story() { + let _ = tooltip.register() + + use <- fable.story("tooltip/controlled") + use _ <- fable.scene + + tooltip.view( + [tooltip.delay(50)], + popover: tooltip.popover([attribute.class(popover), tooltip.open(True)], [ + html.text("Bold"), + ]), + trigger: tooltip.trigger([], [ + html.button([attribute.class(button)], [html.text("B")]), + ]), + ) +} diff --git a/docs/checklist.md b/docs/checklist.md new file mode 100644 index 0000000..af06b9f --- /dev/null +++ b/docs/checklist.md @@ -0,0 +1,20 @@ +# Todo + +- [x] accordion +- [ ] combobox +- [ ] dropdown +- [ ] popover +- [ ] switch +- [x] tabs +- [ ] toast +- [x] toggle +- [ ] toolbar +- [ ] tooltip + +## References + +- [Base UI](https://base-ui.com/react/overview/quick-start) +- [Component Gallrey](https://component.gallery/components/) +- [Radix Primitives](https://www.radix-ui.com/primitives/docs/overview/introduction) +- [React Aria](https://react-aria.adobe.com/getting-started) +- [WAI ARIA Patterns](https://www.w3.org/WAI/ARIA/apg/patterns/) diff --git a/gleam.toml b/gleam.toml index 0d45311..0bd74a7 100644 --- a/gleam.toml +++ b/gleam.toml @@ -10,23 +10,16 @@ links = [ { title = "Sponsor", href = "https://github.com/sponsors/hayleigh-dot-dev" }, ] -internal_modules = [ - "lustre_ui", - "lustre/ui/data/*", - "lustre/ui/internals/*", - "lustre/ui/primitives/*", -] +internal_modules = ["lustre_ui/*", "lustre/ui/*/*"] [dependencies] -gleam_community_colour = ">= 1.4.0 and < 2.0.0" -gleam_community_maths = ">= 1.1.1 and < 2.0.0" -gleam_stdlib = ">= 0.40.0 and < 2.0.0" -lustre = ">= 4.5.0 and < 5.0.0" -decipher = ">= 1.2.1 and < 2.0.0" -gleam_json = ">= 2.0.0 and < 3.0.0" +gleam_json = ">= 3.0.0 and < 4.0.0" +gleam_stdlib = ">= 0.67.0 and < 2.0.0" +lustre = ">= 5.5.1 and < 6.0.0" +lustre_dev_tools = ">= 2.3.4 and < 3.0.0" [dev-dependencies] -birdie = ">= 1.1.6 and < 2.0.0" -gleeunit = "~> 1.0" -globlin = ">= 2.0.2 and < 3.0.0" -simplifile = ">= 2.2.0 and < 3.0.0" +lustre_fable = { git = "https://github.com/lustre-labs/fable.git", ref = "main" } + +[tools.lustre.dev] +watch = ["dev"] diff --git a/manifest.toml b/manifest.toml index 17f3365..530a0f7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,40 +3,53 @@ packages = [ { name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" }, - { name = "birdie", version = "1.2.4", build_tools = ["gleam"], requirements = ["argv", "edit_distance", "filepath", "glance", "gleam_community_ansi", "gleam_erlang", "gleam_stdlib", "justin", "rank", "simplifile", "trie_again"], otp_app = "birdie", source = "hex", outer_checksum = "769AE13AB5B5B84E724E9966037DCCB5BD63B2F43C52EF80B4BF3351F64E469E" }, - { name = "birl", version = "1.7.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "ranger"], otp_app = "birl", source = "hex", outer_checksum = "5C66647D62BCB11FE327E7A6024907C4A17954EF22865FE0940B54A852446D01" }, - { name = "decipher", version = "1.2.1", build_tools = ["gleam"], requirements = ["birl", "gleam_json", "gleam_stdlib", "stoiridh_version"], otp_app = "decipher", source = "hex", outer_checksum = "4F82516A5FF09BD7DF352DE38F1691C2254508066152F5DEA8665B216A9C9909" }, - { name = "edit_distance", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "edit_distance", source = "hex", outer_checksum = "A1E485C69A70210223E46E63985FA1008B8B2DDA9848B7897469171B29020C05" }, - { name = "filepath", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "67A6D15FB39EEB69DD31F8C145BB5A421790581BD6AA14B33D64D5A55DBD6587" }, - { name = "glance", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "glexer"], otp_app = "glance", source = "hex", outer_checksum = "E155BA1A787FD11827048355021C0390D2FE9A518485526F631A9D472858CC6D" }, - { name = "gleam_community_ansi", version = "1.4.1", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "4CD513FC62523053E62ED7BAC2F36136EC17D6A8942728250A9A00A15E340E4B" }, - { name = "gleam_community_colour", version = "1.4.1", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "386CB9B01B33371538672EEA8A6375A0A0ADEF41F17C86DDCB81C92AD00DA610" }, - { name = "gleam_community_maths", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_community_maths", source = "hex", outer_checksum = "6C4ED7BC7E7DF6977719B5F2CFE717EE8280D1CF6EA81D55FD9953758C7FD14E" }, - { name = "gleam_erlang", version = "0.33.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "A1D26B80F01901B59AABEE3475DD4C18D27D58FA5C897D922FCB9B099749C064" }, - { name = "gleam_json", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "0A57FB5666E695FD2BEE74C0428A98B0FC11A395D2C7B4CDF5E22C5DD32C74C6" }, - { name = "gleam_otp", version = "0.15.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "E9ED3DF7E7285DA0C440F46AE8236ADC8475E8CCBEE4899BF09A8468DA3F9187" }, - { name = "gleam_regexp", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "A3655FDD288571E90EE9C4009B719FEF59FA16AFCDF3952A76A125AF23CF1592" }, - { name = "gleam_stdlib", version = "0.46.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "53940A91251A6BE9AEBB959D46E1CB45B510551D81342A52213850947732D4AB" }, - { name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" }, - { name = "glexer", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glexer", source = "hex", outer_checksum = "25E87F25706749E40C3CDC72D2E52AEA12260B23D14FD9E09A1B524EF393485E" }, - { name = "globlin", version = "2.0.3", build_tools = ["gleam"], requirements = ["gleam_regexp", "gleam_stdlib"], otp_app = "globlin", source = "hex", outer_checksum = "923BC16814DF95C4BB28111C266F0B873499480E6E125D5A16DBDF732E62CEB4" }, + { name = "booklet", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "booklet", source = "hex", outer_checksum = "08E0FDB78DC4D8A5D3C80295B021505C7D2A2E7B6C6D5EAB7286C36F4A53C851" }, + { name = "directories", version = "1.2.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_stdlib", "platform", "simplifile"], otp_app = "directories", source = "hex", outer_checksum = "D13090CFCDF6759B87217E8DDD73A75903A700148A82C1D33799F333E249BF9E" }, + { name = "envoy", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "850DA9D29D2E5987735872A2B5C81035146D7FE19EFC486129E44440D03FD832" }, + { name = "exception", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "329D269D5C2A314F7364BD2711372B6F2C58FA6F39981572E5CA68624D291F8C" }, + { name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" }, + { name = "gleam_community_ansi", version = "1.4.4", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "1B3AEA6074AB34D5F0674744F36DDC7290303A03295507E2DEC61EDD6F5777FE" }, + { name = "gleam_community_colour", version = "2.0.4", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "6DB4665555D7D2B27F0EA32EF47E8BEBC4303821765F9C73D483F38EE24894F0" }, + { name = "gleam_crypto", version = "1.5.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "50774BAFFF1144E7872814C566C5D653D83A3EBF23ACC3156B757A1B6819086E" }, + { name = "gleam_erlang", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "1124AD3AA21143E5AF0FC5CF3D9529F6DB8CA03E43A55711B60B6B7B3874375C" }, + { name = "gleam_fetch", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "2CBF9F2E1C71AEBBFB13A9D5720CD8DB4263EB02FE60C5A7A1C6E17B0151C20C" }, + { name = "gleam_http", version = "4.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "82EA6A717C842456188C190AFB372665EA56CE13D8559BF3B1DD9E40F619EE0C" }, + { name = "gleam_httpc", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "C545172618D07811494E97AAA4A0FB34DA6F6D0061FDC8041C2F8E3BE2B2E48F" }, + { name = "gleam_javascript", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "EF6C77A506F026C6FB37941889477CD5E4234FCD4337FF0E9384E297CB8F97EB" }, + { name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" }, + { name = "gleam_otp", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "BA6A294E295E428EC1562DC1C11EA7530DCB981E8359134BEABC8493B7B2258E" }, + { name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" }, + { name = "gleam_stdlib", version = "0.70.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "86949BF5D1F0E4AC0AB5B06F235D8A5CC11A2DFC33BF22F752156ED61CA7D0FF" }, + { name = "gleam_time", version = "1.7.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "56DB0EF9433826D3B99DB0B4AF7A2BFED13D09755EC64B1DAAB46F804A9AD47D" }, + { name = "gleam_yielder", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_yielder", source = "hex", outer_checksum = "8E4E4ECFA7982859F430C57F549200C7749823C106759F4A19A78AEA6687717A" }, + { name = "glint", version = "1.2.1", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "2214C7CEFDE457CEE62140C3D4899B964E05236DA74E4243DFADF4AF29C382BB" }, + { name = "glisten", version = "8.0.3", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "logging", "telemetry"], otp_app = "glisten", source = "hex", outer_checksum = "86B838196592D9EBDE7A1D2369AE3A51E568F7DD2D168706C463C42D17B95312" }, + { name = "gramps", version = "6.0.0", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gramps", source = "hex", outer_checksum = "8B7195978FBFD30B43DF791A8A272041B81E45D245314D7A41FC57237AA882A0" }, + { name = "group_registry", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib"], otp_app = "group_registry", source = "hex", outer_checksum = "BC798A53D6F2406DB94E27CB45C57052CB56B32ACF7CC16EA20F6BAEC7E36B90" }, + { name = "houdini", version = "1.2.0", build_tools = ["gleam"], requirements = [], otp_app = "houdini", source = "hex", outer_checksum = "5DB1053F1AF828049C2B206D4403C18970ABEF5C18671CA3C2D2ED0DD64F6385" }, + { name = "hpack_erl", version = "0.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "hpack", source = "hex", outer_checksum = "D6137D7079169D8C485C6962DFE261AF5B9EF60FBC557344511C1E65E3D95FB0" }, { name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" }, - { name = "lustre", version = "4.6.3", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "BDF833368F6C8F152F948D5B6A79866E9881CB80CB66C0685B3327E7DCBFB12F" }, - { name = "ranger", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "ranger", source = "hex", outer_checksum = "B8F3AFF23A3A5B5D9526B8D18E7C43A7DFD3902B151B97EC65397FE29192B695" }, - { name = "rank", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "rank", source = "hex", outer_checksum = "5660E361F0E49CBB714CC57CC4C89C63415D8986F05B2DA0C719D5642FAD91C9" }, - { name = "simplifile", version = "2.2.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0DFABEF7DC7A9E2FF4BB27B108034E60C81BEBFCB7AB816B9E7E18ED4503ACD8" }, - { name = "stoiridh_version", version = "0.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "stoiridh_version", source = "hex", outer_checksum = "EEF8ADAB9755BD33EB202F169376F1A7797AEF90823FDCA671D8590D04FBF56B" }, - { name = "trie_again", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "trie_again", source = "hex", outer_checksum = "5B19176F52B1BD98831B57FDC97BD1F88C8A403D6D8C63471407E78598E27184" }, + { name = "logging", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "1098FBF10B54B44C2C7FDF0B01C1253CAFACDACABEFB4B0D027803246753E06D" }, + { name = "lustre", version = "5.6.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "EE558CD4DB9F09FCC16417ADF0183A3C2DAC3E4B21ED3AC0CAE859792AB810CA" }, + { name = "lustre_dev_tools", version = "2.3.5", build_tools = ["gleam"], requirements = ["argv", "booklet", "filepath", "gleam_community_ansi", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_httpc", "gleam_json", "gleam_otp", "gleam_regexp", "gleam_stdlib", "glint", "group_registry", "justin", "lustre", "mist", "polly", "simplifile", "tom", "wisp"], otp_app = "lustre_dev_tools", source = "hex", outer_checksum = "0B376F4057AB6E0FB5D48DFED9943D48571968D132EBD67EAED0A21EA29027FE" }, + { name = "lustre_fable", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_regexp", "gleam_stdlib", "justin", "lustre", "lustre_portal", "modem", "rsvp"], source = "git", repo = "https://github.com/lustre-labs/fable.git", commit = "5e1d6bfadcfcb55fa206f1112a678769bdac6474" }, + { name = "lustre_portal", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre"], otp_app = "lustre_portal", source = "hex", outer_checksum = "7531667B9321B644E139F5BE42077932829431BE74BC7239471CEFC68943A661" }, + { name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" }, + { name = "mist", version = "5.0.4", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gleam_yielder", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "7CED4B2D81FD547ADB093D97B9928B9419A7F58B8562A30A6CC17A252B31AD05" }, + { name = "modem", version = "2.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre"], otp_app = "modem", source = "hex", outer_checksum = "3F9682EBCBF4D26045F1038A7507E8C7967E49D43F9CA6BA68EF0C971B195A7F" }, + { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, + { name = "polly", version = "3.1.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_erlang", "gleam_otp", "gleam_stdlib", "simplifile"], otp_app = "polly", source = "hex", outer_checksum = "51FB565D81FF6212FDF3306D44419601F2A7C4EDD1F00FC9DA5C376A00AED4FE" }, + { name = "rsvp", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_fetch", "gleam_http", "gleam_httpc", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "rsvp", source = "hex", outer_checksum = "40F9E0E662FF258E10C7041A9591261FE802D56625FB444B91510969644F7722" }, + { name = "simplifile", version = "2.4.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "7C18AFA4FED0B4CE1FA5B0B4BAC1FA1744427054EA993565F6F3F82E5453170D" }, + { name = "snag", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "274F41D6C3ECF99F7686FDCE54183333E41D2C1CA5A3A673F9A8B2C7A4401077" }, + { name = "telemetry", version = "1.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "2172E05A27531D3D31DD9782841065C50DD5C3C7699D95266B2EDD54C2DAFA1C" }, + { name = "tom", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "90791DA4AACE637E30081FE77049B8DB850FBC8CACC31515376BCC4E59BE1DD2" }, + { name = "wisp", version = "2.2.1", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "6E37308F4F8C45B5D3F2A2DC71BDE4DA6AD2F7978D26A7C8D6790CE275C8614E" }, ] [requirements] -birdie = { version = ">= 1.1.6 and < 2.0.0" } -decipher = { version = ">= 1.2.1 and < 2.0.0" } -gleam_community_colour = { version = ">= 1.4.0 and < 2.0.0" } -gleam_community_maths = { version = ">= 1.1.1 and < 2.0.0" } -gleam_json = { version = ">= 2.0.0 and < 3.0.0" } -gleam_stdlib = { version = ">= 0.40.0 and < 2.0.0" } -gleeunit = { version = "~> 1.0" } -globlin = { version = ">= 2.0.2 and < 3.0.0" } -lustre = { version = ">= 4.5.0 and < 5.0.0" } -simplifile = { version = ">= 2.2.0 and < 3.0.0" } +gleam_json = { version = ">= 3.0.0 and < 4.0.0" } +gleam_stdlib = { version = ">= 0.67.0 and < 2.0.0" } +lustre = { version = ">= 5.5.1 and < 6.0.0" } +lustre_dev_tools = { version = ">= 2.3.4 and < 3.0.0" } +lustre_fable = { git = "https://github.com/lustre-labs/fable.git", ref = "main" } diff --git a/pages/components.md b/pages/components.md deleted file mode 100644 index eef6d5d..0000000 --- a/pages/components.md +++ /dev/null @@ -1,59 +0,0 @@ -# How we use components - -Some parts of Lustre UI use Lustre's component system to hide state and logic -from the rest of your application. This can be an effective way to reduce -boilerplate and manage complexity, but it might also challenge how you're used to -thinking about Lustre applications. - -The rest of this doc will explain how we use components in Lustre UI and what you -need to do to make sure things are working correctly. - -## Knowing when something is a component - -Your view function in a Lustre application always has to return `Element(msg)` so -it can be difficult to work out at a glance when something is a component or not. -In Lustre UI we follow a convention where modules that contain components will -*always* have at least two exports: - -- a `name` constant that is the name of the component, like - `pub const name: String = "lustre-ui-collapse"`. - -- a `register` function that registers the custom element in the browser. More - on that in a moment. - -If a module does _not_ define these two exports, then it is not defining a -component. - -Some modules might _use_ components without defining them directly. In those -cases the module will always return a `register` function to register any of the -components it depends on. This function will behave slightly differently to the -individual register functions, and _will not fail_ if a component has already -been defined. - -## Components must be registered - -If you are using Lustre UI in a browser-based Lustre application, you must -remember to register any components you use _before_ you try to render them. - - -Lustre's components are built on top of the Web Component standards and appear as -real HTML elements in the DOM. - -## Components are always controlled - -Native HTML elements like `` or `