Skip to main content

src/sparklinekit.erl

-module(sparklinekit).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/sparklinekit.gleam").
-export([package_version/0]).

-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.

?MODULEDOC(
    " sparklinekit — sparkline generator for Gleam.\n"
    "\n"
    " Renderers live in dedicated modules:\n"
    "\n"
    " - [`sparklinekit/unicode`](./sparklinekit/unicode.html) for\n"
    "   terminal output using the eight Unicode block characters\n"
    "   `▁▂▃▄▅▆▇█`.\n"
    " - [`sparklinekit/line`](./sparklinekit/line.html) for SVG and PNG\n"
    "   line sparklines (`to_svg` / `to_png`).\n"
    " - [`sparklinekit/bar`](./sparklinekit/bar.html) for SVG and PNG\n"
    "   bar sparklines (`to_svg` / `to_png`).\n"
    " - [`sparklinekit/theme`](./sparklinekit/theme.html) for the\n"
    "   bundled colour schemes (`ocean`, `forest`, `sunset`, `mono`,\n"
    "   `neon`, `pastel`).\n"
    "\n"
    " ```gleam\n"
    " import sparklinekit/bar\n"
    " import sparklinekit/line\n"
    " import sparklinekit/theme\n"
    " import sparklinekit/unicode\n"
    "\n"
    " pub fn examples() -> #(String, String, String, BitArray) {\n"
    "   let u = unicode.render_ints([1, 5, 22, 13, 5, 2, 7])\n"
    "   let l =\n"
    "     line.new_ints([1, 5, 3, 8, 4])\n"
    "     |> line.with_theme(theme.ocean())\n"
    "     |> line.with_area_fill(True)\n"
    "     |> line.to_svg\n"
    "   let b =\n"
    "     bar.new_ints([3, 7, 2, 9, 5])\n"
    "     |> bar.with_theme(theme.sunset())\n"
    "     |> bar.with_corner_radius(2.0)\n"
    "     |> bar.to_svg\n"
    "   let p =\n"
    "     line.new_ints([1, 5, 3, 8, 4])\n"
    "     |> line.with_theme(theme.ocean())\n"
    "     |> line.with_area_fill(True)\n"
    "     |> line.to_png\n"
    "   #(u, l, b, p)\n"
    " }\n"
    " ```\n"
).

-file("src/sparklinekit.gleam", 47).
?DOC(
    " The package version, kept in sync with `gleam.toml`.\n"
    "\n"
    " Releases that bump `gleam.toml` without bumping this constant (or\n"
    " vice versa) are caught by `package_version_test`.\n"
).
-spec package_version() -> binary().
package_version() ->
    <<"0.1.0"/utf8>>.