From 301963f06b93d762c7e2ed7ca1ca173dbfd92229 Mon Sep 17 00:00:00 2001 From: Mitchell Hanberg Date: Sat, 22 May 2021 01:13:58 -0400 Subject: [PATCH] Bump v0.6.0 --- CHANGELOG.md | 98 +++++++++++++++++++++ README.md | 3 + integration_test/temple_demo/.tool-versions | 2 +- mix.exs | 5 +- mix.lock | 11 +-- 5 files changed, 110 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0018735..5958719 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,104 @@ Nothing Yet +## 0.6.0 The LiveView compatibility release! + +Temple now is written to be fully compatible with Phoenix LiveView! This comes with substantial internal changes as well as a better component API. + +### Phoenix LiveView + +Temple now outputs LiveView compatible EEx at compile time, which is fed right into the normal LiveView EEx engine (or the traditional HTML Engine if you are not using LiveView). + +### Components + +Temple now has a more complete component API. + +Components work with anywhere, whether you are writing a little plug app, a vanilla Phoenix app, or a Phoenix LiveView app! + +Please see the [documenation](https://hexdocs.pm/temple/Temple.html) for more information. + +To migrate component from the 0.5.0 syntax to the 0.6.0 syntax, you can use the following as a guide + +```elixir +# 0.5.0 + +# definition +defmodule PageView do + defcomponent :flex do + div id: @id, class: "flex" do + @children + end + end +end + +# usage + +require PageView +# or + +import PageView + +temple do + PageView.flex id: "my-flex" do + div "Item 1" + div "Item 2" + div "Item 3" + end + + # with import + flex id: "my-flex" do + div "Item 1" + div "Item 2" + div "Item 3" + end +end +``` + +to + +```elixir +# 0.6.0 + +# definition + +defmodule Flex do + import Temple.Component + + render do + div id: @id, class: "flex" do + slot :default + end + end +end + +# usage + +temple do + c Flex id: "my-flex" do + div do: "Item 1" + div do: "Item 2" + div do: "Item 3" + end +end +``` + +### Other breaking changes + +0.6.0 has been a year in the making and a lot has changed in that time (in many cases, several times over), and I honestly can't really remember everything that is different now, but I will list some things here that I think you'll need to change or look out for. + +- The `partial` macro is removed. + - You can now just call the `render` function like you normally would to render a phoenix partial. +- The `defcomponent` macro is removed. + - You now define components using the API described above. +- The `text` macro is now removed. + - You can just use a string literal or a variable to emit a text node. +- Elements and components no longer can take "content" as the first argument. A do block is now required, but you can still use the keyword list style for a concise style, e.g., `span do: "foobar"` instead of `span "foobar"`. +- The `:compact` reserved keyword option was removed. +- The macros that wrapped `Phoenix.HTML` are removed as they are no longer needed. +- The `temple.convert` task has been removed, but I am working to bring it back. + +There might be some more, so if you run into any problems, please open a [GitHub Discussion](https://github.com/mhanberg/temple/discussions/new). + ## 0.6.0-rc.1 ### Enhancements diff --git a/README.md b/README.md index 3f2945f..76adc4a 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,9 @@ config :phoenix, :template_engines, # you can enable Elixir syntax highlighting in your editor lexs: Temple.LiveViewEngine +# If you're going to be using live_view, make sure to set the `:mode` +config :temple, :mode, :live_view # defaults to normal + # config/dev.exs config :your_app, YourAppWeb.Endpoint, live_reload: [ diff --git a/integration_test/temple_demo/.tool-versions b/integration_test/temple_demo/.tool-versions index ffcf012..8d7a08d 100644 --- a/integration_test/temple_demo/.tool-versions +++ b/integration_test/temple_demo/.tool-versions @@ -1 +1 @@ -elixir 1.8.2 +elixir 1.9.4 diff --git a/mix.exs b/mix.exs index 8f98360..caee56d 100644 --- a/mix.exs +++ b/mix.exs @@ -6,7 +6,7 @@ defmodule Temple.MixProject do app: :temple, name: "Temple", description: "An HTML DSL for Elixir and Phoenix", - version: "0.6.0-rc.1", + version: "0.6.0", package: package(), elixirc_paths: elixirc_paths(Mix.env()), elixir: "~> 1.9", @@ -36,14 +36,13 @@ defmodule Temple.MixProject do maintainers: ["Mitchell Hanberg"], licenses: ["MIT"], links: %{github: "https://github.com/mhanberg/temple"}, - exclude_patterns: ["temple.update_mdn_docs.ex"], files: ~w(lib priv CHANGELOG.md LICENSE mix.exs README.md .formatter.exs) ] end defp deps do [ - {:ex_doc, "~> 0.22.0", only: :dev, runtime: false}, + {:ex_doc, "~> 0.24.0", only: :dev, runtime: false}, {:phoenix, ">= 0.0.0", optional: true}, {:phoenix_html, ">= 0.0.0", only: :test}, {:phoenix_live_view, ">= 0.0.0", only: :test} diff --git a/mix.lock b/mix.lock index b558c00..19664a9 100644 --- a/mix.lock +++ b/mix.lock @@ -1,11 +1,12 @@ %{ "earmark": {:hex, :earmark, "1.4.5", "62ffd3bd7722fb7a7b1ecd2419ea0b458c356e7168c1f5d65caf09b4fbdd13c8", [:mix], [], "hexpm", "b7d0e6263d83dc27141a523467799a685965bf8b13b6743413f19a7079843f4f"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, - "ex_doc": {:hex, :ex_doc, "0.22.6", "0fb1e09a3e8b69af0ae94c8b4e4df36995d8c88d5ec7dbd35617929144b62c00", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "1e0aceda15faf71f1b0983165e6e7313be628a460e22a031e32913b98edbd638"}, - "makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.13", "0c98163e7d04a15feb62000e1a891489feb29f3d10cb57d4f845c405852bbef8", [:mix], [], "hexpm", "d602c26af3a0af43d2f2645613f65841657ad6efc9f0e361c3b6c06b578214ba"}, + "ex_doc": {:hex, :ex_doc, "0.24.2", "e4c26603830c1a2286dae45f4412a4d1980e1e89dc779fcd0181ed1d5a05c8d9", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "e134e1d9e821b8d9e4244687fb2ace58d479b67b282de5158333b0d57c6fb7da"}, + "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm", "6cbe761d6a0ca5a31a0931bf4c63204bceb64538e664a8ecf784a9a6f3b875f1"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, "phoenix": {:hex, :phoenix, "1.5.3", "bfe0404e48ea03dfe17f141eff34e1e058a23f15f109885bbdcf62be303b49ff", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "8e16febeb9640d8b33895a691a56481464b82836d338bb3a23125cd7b6157c25"}, "phoenix_html": {:hex, :phoenix_html, "2.14.2", "b8a3899a72050f3f48a36430da507dd99caf0ac2d06c77529b1646964f3d563e", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "58061c8dfd25da5df1ea0ca47c972f161beb6c875cd293917045b92ffe1bf617"}, "phoenix_live_view": {:hex, :phoenix_live_view, "0.13.3", "2186c55cc7c54ca45b97c6f28cfd267d1c61b5f205f3c83533704cd991bdfdec", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.4.17 or ~> 1.5.2", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14", [hex: :phoenix_html, repo: "hexpm", optional: false]}], "hexpm", "c6309a7da2e779cb9cdf2fb603d75f38f49ef324bedc7a81825998bd1744ff8a"},