Skip to content

Commit

Permalink
Update all documentation and gleam.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
ghivert committed Jan 12, 2025
1 parent cb7bbb2 commit 30819e8
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 51 deletions.
2 changes: 1 addition & 1 deletion sketch/gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ path = "sketch"
[dependencies]
gleam_erlang = ">= 0.25.0 and < 1.0.0"
gleam_otp = ">= 0.10.0 and < 1.0.0"
gleam_stdlib = ">= 0.34.0 and < 1.0.0"
gleam_stdlib = ">= 0.42.0 and < 1.0.0"

[dev-dependencies]
birdie = ">= 1.2.5 and < 2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion sketch/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ packages = [
birdie = { version = ">= 1.2.5 and < 2.0.0" }
gleam_erlang = { version = ">= 0.25.0 and < 1.0.0" }
gleam_otp = { version = ">= 0.10.0 and < 1.0.0" }
gleam_stdlib = { version = ">= 0.34.0 and < 1.0.0" }
gleam_stdlib = { version = ">= 0.42.0 and < 1.0.0" }
startest = { version = ">= 0.6.0 and < 1.0.0" }
4 changes: 3 additions & 1 deletion sketch/src/sketch.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn render(cache: StyleSheet) -> String {
}

@target(javascript)
/// Convert a `Class` to its class name, to use it anywhere in your application.
/// Converts a `Class` to its class name, to use it anywhere in your application.
/// It always returns the StyleSheet, because the class can have been pushed
/// in the StyleSheet itself.
pub fn class_name(class: Class, stylesheet: StyleSheet) -> #(StyleSheet, String) {
Expand All @@ -45,6 +45,8 @@ pub fn class_name(class: Class, stylesheet: StyleSheet) -> #(StyleSheet, String)
}

@target(javascript)
/// Pushes an `@rule` in the StyleSheet, to get it bundled in the outputted CSS.
/// It returns the StyleSheet with the rule added.
pub fn at_rule(rule: AtRule, stylesheet: StyleSheet) -> StyleSheet {
let cache = cache.at_rule(rule, stylesheet.cache)
StyleSheet(..stylesheet, cache:)
Expand Down
20 changes: 10 additions & 10 deletions sketch/src/sketch/css.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub type Style =
pub type Class =
style.Class

/// Represents an at-rule.
/// Represents an [at-rule](https://developer.mozilla.org/docs/Web/CSS/At-rule).
pub type AtRule =
style.AtRule

Expand Down Expand Up @@ -137,15 +137,15 @@ pub fn all(value: String) -> Style {
/// ---
///
/// This property is a shorthand for the following CSS properties:
/// [`animation-delay`](https://developer.mozilla.org/docs/Web/CSS/animation-delay)
/// [`animation-direction`](https://developer.mozilla.org/docs/Web/CSS/animation-direction)
/// [`animation-duration`](https://developer.mozilla.org/docs/Web/CSS/animation-duration)
/// [`animation-fill-mode`](https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode)
/// [`animation-iteration-count`](https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count)
/// [`animation-name`](https://developer.mozilla.org/docs/Web/CSS/animation-name)
/// [`animation-play-state`](https://developer.mozilla.org/docs/Web/CSS/animation-play-state)
/// [`animation-timeline`](https://developer.mozilla.org/docs/Web/CSS/animation-timeline)
/// [`animation-timing-function`](https://developer.mozilla.org/docs/Web/CSS/animation-timing-function)
/// - [`animation-delay`](https://developer.mozilla.org/docs/Web/CSS/animation-delay)
/// - [`animation-direction`](https://developer.mozilla.org/docs/Web/CSS/animation-direction)
/// - [`animation-duration`](https://developer.mozilla.org/docs/Web/CSS/animation-duration)
/// - [`animation-fill-mode`](https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode)
/// - [`animation-iteration-count`](https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count)
/// - [`animation-name`](https://developer.mozilla.org/docs/Web/CSS/animation-name)
/// - [`animation-play-state`](https://developer.mozilla.org/docs/Web/CSS/animation-play-state)
/// - [`animation-timeline`](https://developer.mozilla.org/docs/Web/CSS/animation-timeline)
/// - [`animation-timing-function`](https://developer.mozilla.org/docs/Web/CSS/animation-timing-function)
///
/// ---
///
Expand Down
8 changes: 8 additions & 0 deletions sketch/src/sketch/css/font_face.gleam
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
//// The `@font-face` CSS at-rule specifies a custom font with which to display
//// text; the font can be loaded from either a remote server or a
//// locally-installed font on the user's own computer.
////
//// ---
////
//// [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/@font-face)

import gleam/float

/// A `FontFace` is a part of a `@font-face` rule.
Expand Down
10 changes: 10 additions & 0 deletions sketch/src/sketch/css/keyframe.gleam
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
//// The `@keyframes` CSS [at-rule](https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule)
//// controls the intermediate steps in a CSS animation sequence by defining
//// styles for keyframes (or waypoints) along the animation sequence. This
//// gives more control over the intermediate steps of the animation sequence
//// than [transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_transitions).
////
//// ---
////
//// [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/@keyframes)

import gleam/int
import sketch/internals/cache/cache as style

Expand Down
2 changes: 1 addition & 1 deletion sketch_css/gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ path = "sketch_css"
argv = ">= 1.0.2 and < 2.0.0"
glance = ">= 2.0.0 and < 3.0.0"
gleam_erlang = ">= 0.25.0 and < 1.0.0"
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_stdlib = ">= 0.42.0 and < 2.0.0"
glint = ">= 1.2.0 and < 2.0.0"
simplifile = ">= 2.0.1 and < 3.0.0"
sketch = {path = "../sketch"}
Expand Down
2 changes: 1 addition & 1 deletion sketch_css/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ argv = { version = ">= 1.0.2 and < 2.0.0" }
birdie = { version = ">= 1.2.5 and < 2.0.0" }
glance = { version = ">= 2.0.0 and < 3.0.0" }
gleam_erlang = { version = ">= 0.25.0 and < 1.0.0" }
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleam_stdlib = { version = ">= 0.42.0 and < 2.0.0" }
glint = { version = ">= 1.2.0 and < 2.0.0" }
pprint = { version = ">= 1.0.4 and < 2.0.0" }
simplifile = { version = ">= 2.0.1 and < 3.0.0" }
Expand Down
2 changes: 1 addition & 1 deletion sketch_lustre/gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repo = "sketch"
path = "sketch_lustre"

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_stdlib = ">= 0.42.0 and < 2.0.0"
lustre = ">= 4.6.0 and < 5.0.0"
sketch = {path = "../sketch"}

Expand Down
2 changes: 1 addition & 1 deletion sketch_lustre/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packages = [
]

[requirements]
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleam_stdlib = { version = ">= 0.42.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
lustre = { version = ">= 4.6.0 and < 5.0.0" }
sketch = { path = "../sketch" }
20 changes: 10 additions & 10 deletions sketch_lustre/src/sketch/lustre/element.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import sketch/css

/// 1:1 representation of a `lustre/element.Element`.
///
/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#Element)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#Element)
pub opaque type Element(msg) {
Nothing
Text(content: String)
Expand All @@ -27,17 +27,17 @@ pub opaque type Element(msg) {
)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#none)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#none)
pub fn none() -> Element(a) {
Nothing
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#text)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#text)
pub fn text(content: String) -> Element(a) {
Text(content)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
pub fn element(
tag tag: String,
class class: css.Class,
Expand All @@ -48,7 +48,7 @@ pub fn element(
Element("", "", tag, class, attributes, children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
pub fn element_(
tag tag: String,
attributes attributes: List(Attribute(msg)),
Expand All @@ -57,7 +57,7 @@ pub fn element_(
Element("", "", tag, option.None, attributes, children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
pub fn namespaced(
namespace namespace: String,
tag tag: String,
Expand All @@ -69,7 +69,7 @@ pub fn namespaced(
Element("", namespace, tag, class, attributes, children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
pub fn namespaced_(
namespace namespace: String,
tag tag: String,
Expand All @@ -79,13 +79,13 @@ pub fn namespaced_(
Element("", namespace, tag, option.None, attributes, children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#fragment)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#fragment)
pub fn fragment(children: List(Element(msg))) -> Element(msg) {
let attrs = [attribute.style([#("display", "contents")])]
Element("", "", "lustre-fragment", option.None, attrs, children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#keyed)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#keyed)
pub fn keyed(
element: fn(List(Element(msg))) -> Element(msg),
children: List(#(String, Element(msg))),
Expand All @@ -106,7 +106,7 @@ fn do_keyed(element: Element(msg), key: String) -> Element(msg) {
}
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#map)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#map)
pub fn map(element: Element(a), mapper: fn(a) -> b) -> Element(b) {
case element {
Nothing -> Nothing
Expand Down
23 changes: 12 additions & 11 deletions sketch_lustre_experimental/gleam.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name = "sketch_lustre_experimental"
version = "0.1.0"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
#
# description = ""
# licences = ["Apache-2.0"]
# repository = { type = "github", user = "", repo = "" }
# links = [{ title = "Website", href = "" }]
#
# For a full reference of all the available options, you can have a look at
# https://gleam.run/writing-gleam/gleam-toml/.
description = "An experimental Sketch runtime package, made to work with Lustre!"
internal_modules = ["sketch/lustre/expermental/internals", "sketch/lustre/experimental/internals/*"]
licences = ["MIT"]
links = [{title = "Sponsor", href = "https://github.com/sponsors/ghivert"}]
gleam = ">= 1.6.0"

[repository]
type = "github"
user = "ghivert"
repo = "sketch"
path = "sketch_lustre_experimental"

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_stdlib = ">= 0.42.0 and < 2.0.0"
lustre = ">= 4.6.1 and < 5.0.0"
sketch = {path = "../sketch"}

Expand Down
2 changes: 1 addition & 1 deletion sketch_lustre_experimental/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packages = [
]

[requirements]
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleam_stdlib = { version = ">= 0.42.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
lustre = { version = ">= 4.6.1 and < 5.0.0" }
sketch = { path = "../sketch" }
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ import sketch/css
import sketch/lustre/experimental/internals/global

/// Alias for `lustre/element.Element`. \
/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#Element)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#Element)
pub type Element(msg) =
el.Element(msg)

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#keyed)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#keyed)
pub const keyed = el.keyed

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#fragment)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#fragment)
pub const fragment = el.fragment

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#none)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#none)
pub const none = el.none

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#text)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#text)
pub const text = el.text

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#map)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#map)
pub const map = el.map

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
pub fn element(
tag tag: String,
class class: css.Class,
Expand All @@ -38,7 +38,7 @@ pub fn element(
el.element(tag, [attribute.class(class_name), ..attributes], children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#element)
pub fn element_(
tag tag: String,
attributes attributes: List(Attribute(msg)),
Expand All @@ -47,7 +47,7 @@ pub fn element_(
el.element(tag, attributes, children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
pub fn namespaced(
tag tag: String,
namespace namespace: String,
Expand All @@ -60,7 +60,7 @@ pub fn namespaced(
el.namespaced(tag, namespace, attributes, children)
}

/// [Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
/// [Lustre Documentation](https://hexdocs.pm/lustre/lustre/element.html#namespaced)
pub fn namespaced_(
tag tag: String,
namespace namespace: String,
Expand Down
2 changes: 1 addition & 1 deletion sketch_redraw/gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repo = "sketch"
path = "sketch_redraw"

[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_stdlib = ">= 0.42.0 and < 2.0.0"
redraw = ">= 2.0.0 and < 3.0.0"
sketch = {path = "../sketch"}
redraw_dom = ">= 2.0.0 and < 3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion sketch_redraw/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ packages = [
]

[requirements]
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleam_stdlib = { version = ">= 0.42.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
redraw = { version = ">= 2.0.0 and < 3.0.0" }
redraw_dom = { version = ">= 2.0.0 and < 3.0.0" }
Expand Down

0 comments on commit 30819e8

Please sign in to comment.