diff --git a/assets/js/phoenix_live_view/live_socket.ts b/assets/js/phoenix_live_view/live_socket.ts index 07b3d557b7..96426ab3fe 100644 --- a/assets/js/phoenix_live_view/live_socket.ts +++ b/assets/js/phoenix_live_view/live_socket.ts @@ -859,7 +859,7 @@ export default class LiveSocket { } this.execJS(el, el.getAttribute(removeAttr), "remove"); }); - // remove the silenced listeners when transitions are done incase the element is re-used + // remove the silenced listeners when transitions are done in case the element is re-used // and call caller's callback as soon as we are done with transitions this.requestDOMUpdate(() => { elements.forEach((el) => { diff --git a/lib/phoenix_component.ex b/lib/phoenix_component.ex index 3840742307..e454adb213 100644 --- a/lib/phoenix_component.ex +++ b/lib/phoenix_component.ex @@ -2009,7 +2009,7 @@ defmodule Phoenix.Component do end @doc ~S''' - Declares attributes for a HEEx function components. + Declares attributes for a HEEx function component. ## Arguments diff --git a/lib/phoenix_component/macro_component.ex b/lib/phoenix_component/macro_component.ex index 4955cbd6f4..0e675b2a02 100644 --- a/lib/phoenix_component/macro_component.ex +++ b/lib/phoenix_component/macro_component.ex @@ -44,7 +44,7 @@ defmodule Phoenix.Component.MacroComponent do # This module provides some utilities to work with the AST, which uses # standard Elixir data structures: # - # 1. A HTML tag is represented as `{tag, attributes, children, meta}` + # 1. An HTML tag is represented as `{tag, attributes, children, meta}` # 2. Text is represented as a plain binary # 3. Attributes are represented as a list of `{key, value}` tuples where # the value is an Elixir AST (which can be a plain binary for simple attributes) diff --git a/lib/phoenix_live_view.ex b/lib/phoenix_live_view.ex index c294ee794f..3d68573224 100644 --- a/lib/phoenix_live_view.ex +++ b/lib/phoenix_live_view.ex @@ -464,7 +464,7 @@ defmodule Phoenix.LiveView do * `:log` - configures the log level for the LiveView, either `false` or a log level - * `:on_mount` - a list of tuples with module names and argument to be invoked + * `:on_mount` - a list of tuples with module names and arguments to be invoked as `on_mount` hooks """ diff --git a/lib/phoenix_live_view/colocated_js.ex b/lib/phoenix_live_view/colocated_js.ex index 23ac62eba5..845307440a 100644 --- a/lib/phoenix_live_view/colocated_js.ex +++ b/lib/phoenix_live_view/colocated_js.ex @@ -36,7 +36,7 @@ defmodule Phoenix.LiveView.ColocatedJS do > #### A note on dependencies and umbrella projects {: .info} > > For each application that uses colocated JavaScript, a separate directory is created - > inside the `phoenix-colocated` folder. This allows to have clear separation between + > inside the `phoenix-colocated` folder. This allows for clear separation between > hooks and code of dependencies, but also applications inside umbrella projects. > > While dependencies would typically still bundle their own hooks and colocated JavaScript diff --git a/lib/phoenix_live_view/diff.ex b/lib/phoenix_live_view/diff.ex index 9739425283..77192df89d 100644 --- a/lib/phoenix_live_view/diff.ex +++ b/lib/phoenix_live_view/diff.ex @@ -270,8 +270,8 @@ defmodule Phoenix.LiveView.Diff do @doc """ Sends an update to a component. - Like `write_component/5`, it will store the result under the `cid - key in the `component_diffs` map. + Like `write_component/5`, it will store the result under the `cid` + key in the `component_diffs` map. If the component exists, a `{diff, new_components}` tuple is returned. Otherwise, `:noop` is returned. diff --git a/lib/phoenix_live_view/html_algebra.ex b/lib/phoenix_live_view/html_algebra.ex index c7688f59fd..feaf866312 100644 --- a/lib/phoenix_live_view/html_algebra.ex +++ b/lib/phoenix_live_view/html_algebra.ex @@ -128,8 +128,8 @@ defmodule Phoenix.LiveView.HTMLAlgebra do #
API
# ). # - # Therefore, this check if the previous or next token is not a text - # and, if it is a text, check if that contains whitespace. + # Therefore, this checks whether the previous or next token is not text + # and, if it is text, whether it contains whitespace. cond do text_ends_with_space?(prev_node) or text_starts_with_space?(next_node) -> concat([prev_doc, break(""), next_doc]) diff --git a/lib/phoenix_live_view/live_stream.ex b/lib/phoenix_live_view/live_stream.ex index 197f4fd9a2..3c779f18fe 100644 --- a/lib/phoenix_live_view/live_stream.ex +++ b/lib/phoenix_live_view/live_stream.ex @@ -44,7 +44,7 @@ defmodule Phoenix.LiveView.LiveStream do raise ArgumentError, """ expected stream :#{dom_prefix} to be a struct or map with :id key, got: #{inspect(other)} - If you would like to generate custom DOM id's based on other keys, use `Phoenix.LiveView.stream_configure/3` with the :dom_id option beforehand. + If you would like to generate custom DOM IDs based on other keys, use `Phoenix.LiveView.stream_configure/3` with the :dom_id option beforehand. """ end diff --git a/lib/phoenix_live_view/route.ex b/lib/phoenix_live_view/route.ex index 5c80d9290e..329e5b6485 100644 --- a/lib/phoenix_live_view/route.ex +++ b/lib/phoenix_live_view/route.ex @@ -12,7 +12,7 @@ defmodule Phoenix.LiveView.Route do uri: nil @doc """ - Computes the container from the route options and falls backs to use options. + Computes the container from the route options and falls back to view options. """ def container(%Route{} = route) do route.opts[:container] || route.view.__live__()[:container] diff --git a/lib/phoenix_live_view/router.ex b/lib/phoenix_live_view/router.ex index 723ff73ef1..920e62efd2 100644 --- a/lib/phoenix_live_view/router.ex +++ b/lib/phoenix_live_view/router.ex @@ -68,7 +68,7 @@ defmodule Phoenix.LiveView.Router do using a LiveView without actions or defaults to the LiveView name when using actions. - * `:metadata` - a map to optional feed metadata used on telemetry events and route info, + * `:metadata` - a map of optional metadata to feed telemetry events and route info, for example: `%{route_name: :foo, access: :user}`. This data can be retrieved by calling `Phoenix.Router.route_info/4` with the `uri` from the `handle_params` callback. This can be used to customize a LiveView which may be invoked from diff --git a/lib/phoenix_live_view/tag_engine.ex b/lib/phoenix_live_view/tag_engine.ex index d336438fc2..47a4f84216 100644 --- a/lib/phoenix_live_view/tag_engine.ex +++ b/lib/phoenix_live_view/tag_engine.ex @@ -160,7 +160,7 @@ defmodule Phoenix.LiveView.TagEngine do end @doc """ - Define a inner block, generally used by slots. + Define an inner block, generally used by slots. This macro is mostly used by custom HTML engines that provide a `slot` implementation and rarely called directly. The diff --git a/lib/phoenix_live_view/tag_engine/compiler.ex b/lib/phoenix_live_view/tag_engine/compiler.ex index 3c478a3f83..cd7d2b5ac1 100644 --- a/lib/phoenix_live_view/tag_engine/compiler.ex +++ b/lib/phoenix_live_view/tag_engine/compiler.ex @@ -814,7 +814,7 @@ defmodule Phoenix.LiveView.TagEngine.Compiler do # # _ -> ast # - # If a component is defined as as <.my_component :let={%{foo: foo, bar: bar}}, we get: + # If a component is defined as <.my_component :let={%{foo: foo, bar: bar}}, we get: # # %{foo: foo, bar: bar} -> ast # other -> Phoenix.LiveView.TagEngine.__unmatched_let__!("%{foo: foo, bar: bar}", other) diff --git a/lib/phoenix_live_view/tag_engine/parser.ex b/lib/phoenix_live_view/tag_engine/parser.ex index fb692899e9..237c3247bd 100644 --- a/lib/phoenix_live_view/tag_engine/parser.ex +++ b/lib/phoenix_live_view/tag_engine/parser.ex @@ -223,7 +223,7 @@ defmodule Phoenix.LiveView.TagEngine.Parser do # end # ``` # - # Then, we start to populate the buffer again until a `{:close, :tag, ...} arrives: + # Then, we start to populate the buffer again until a `{:close, :tag, ...}` arrives: # # ``` # defp to_tree([{:close, type, name, close_meta} | tokens], buffer, [{type, name, attrs, open_meta, upper_buffer} | stack], state) do @@ -236,7 +236,7 @@ defmodule Phoenix.LiveView.TagEngine.Parser do # # We apply the same logic for `eex` expressions but, instead of `tag_open` and # `tag_close`, eex expressions use `start_expr`, `middle_expr` and `end_expr`. - # The only real difference is that also need to handle `middle_buffer`. + # The only real difference is that we also need to handle `middle_buffer`. # # So given this eex input: # diff --git a/lib/phoenix_live_view/tag_engine/tokenizer.ex b/lib/phoenix_live_view/tag_engine/tokenizer.ex index 642ab87924..5caf97eecc 100644 --- a/lib/phoenix_live_view/tag_engine/tokenizer.ex +++ b/lib/phoenix_live_view/tag_engine/tokenizer.ex @@ -68,7 +68,7 @@ defmodule Phoenix.LiveView.TagEngine.Tokenizer do * `indentation` - An integer that indicates the current indentation. * `file` - Can be either a file or a string "nofile". - * `source` - The contents of the file as binary used to be tokenized. + * `source` - The contents of the file as binary to be tokenized. * `tag_handler` - Tag handler to classify the tags. See `Phoenix.LiveView.TagEngine` behaviour. """ diff --git a/lib/phoenix_live_view/test/live_view_test.ex b/lib/phoenix_live_view/test/live_view_test.ex index 236c3675a7..745307fec8 100644 --- a/lib/phoenix_live_view/test/live_view_test.ex +++ b/lib/phoenix_live_view/test/live_view_test.ex @@ -139,7 +139,7 @@ defmodule Phoenix.LiveViewTest do assert render_click(view, :inc, %{}) =~ "The temperature is: 31℉" The `element` style is preferred as much as possible, as it helps LiveView - perform validations and ensure the events in the HTML actually matches the + perform validations and ensure the events in the HTML actually match the event names on the server. ### Testing regular messages @@ -2011,7 +2011,7 @@ defmodule Phoenix.LiveViewTest do a controller via the normal form `action` attribute. This is especially useful in scenarios where the result of a form submit needs to write to the plug session. - You can follow submit the form with the `%Plug.Conn{}`, like this: + You can submit the form with the `%Plug.Conn{}`, like this: form = form(live_view, selector, %{"form" => "data"}) @@ -2105,7 +2105,7 @@ defmodule Phoenix.LiveViewTest do assert render_upload(avatar, "myfile.jpeg", 49) =~ "49%" assert render_upload(avatar, "myfile.jpeg", 51) =~ "100%" - Before making assertions about the how the upload is consumed server-side, + Before making assertions about how the upload is consumed server-side, you will need to call `render_submit/1`. In the case where an upload progress callback issues a navigate, patch, or diff --git a/lib/phoenix_live_view/upload.ex b/lib/phoenix_live_view/upload.ex index c4a2d47c55..92fdc699e6 100644 --- a/lib/phoenix_live_view/upload.ex +++ b/lib/phoenix_live_view/upload.ex @@ -154,7 +154,7 @@ defmodule Phoenix.LiveView.Upload do end @doc """ - Unregisters a completed entry from an `Phoenix.LiveView.UploadChannel` process. + Unregisters a completed entry from a `Phoenix.LiveView.UploadChannel` process. """ def unregister_completed_entry_upload(%Socket{} = socket, %UploadConfig{} = conf, entry_ref) do conf @@ -163,7 +163,7 @@ defmodule Phoenix.LiveView.Upload do end @doc """ - Registers a new entry upload for an `Phoenix.LiveView.UploadChannel` process. + Registers a new entry upload for a `Phoenix.LiveView.UploadChannel` process. """ def register_entry_upload(%Socket{} = socket, %UploadConfig{} = conf, pid, entry_ref) when is_pid(pid) do diff --git a/lib/phoenix_live_view/upload_config.ex b/lib/phoenix_live_view/upload_config.ex index c1667261d2..baa4a158bb 100644 --- a/lib/phoenix_live_view/upload_config.ex +++ b/lib/phoenix_live_view/upload_config.ex @@ -481,7 +481,7 @@ defmodule Phoenix.LiveView.UploadConfig do new_entries = Enum.map(conf.entries, fn %UploadEntry{ref: ^entry_ref} = entry -> func.(entry) - %UploadEntry{ref: _ef} = entry -> entry + %UploadEntry{ref: _ref} = entry -> entry end) recalculate_computed_fields(%{conf | entries: new_entries}) diff --git a/lib/phoenix_live_view/upload_writer.ex b/lib/phoenix_live_view/upload_writer.ex index a18af596df..a0f38c6f47 100644 --- a/lib/phoenix_live_view/upload_writer.ex +++ b/lib/phoenix_live_view/upload_writer.ex @@ -1,16 +1,16 @@ defmodule Phoenix.LiveView.UploadWriter do @moduledoc ~S""" - Provide a behavior for writing uploaded chunks to a final destination. + Provides a behavior for writing uploaded chunks to a final destination. By default, uploads are written to a temporary file on the server and consumed by the LiveView by reading the temporary file or copying it to - durable location. Some usecases require custom handling of the uploaded + a durable location. Some use cases require custom handling of the uploaded chunks, such as streaming a user's upload to another server. In these cases, we don't want the chunks to be written to disk since we only need to forward them on. **Note**: Upload writers run inside the channel uploader process, so - any blocking work will block the channel errors will crash the channel process. + any blocking work will block the channel, and errors will crash the channel process. Custom implementations of `Phoenix.LiveView.UploadWriter` can be passed to `allow_upload/3`. To initialize the writer with options, define a 3-arity function diff --git a/lib/phoenix_live_view/utils.ex b/lib/phoenix_live_view/utils.ex index aec88e74d6..596845defc 100644 --- a/lib/phoenix_live_view/utils.ex +++ b/lib/phoenix_live_view/utils.ex @@ -196,7 +196,7 @@ defmodule Phoenix.LiveView.Utils do end @doc """ - Validate and normalizes the layout. + Validates and normalizes the layout. """ def normalize_layout(false), do: false @@ -428,7 +428,7 @@ defmodule Phoenix.LiveView.Utils do defp handle_mount_option(%Socket{} = socket, :temporary_assigns, temp_assigns) do if not Keyword.keyword?(temp_assigns) do - raise "the :temporary_assigns mount option must be keyword list" + raise "the :temporary_assigns mount option must be a keyword list" end temp_assigns = Map.new(temp_assigns) @@ -482,7 +482,7 @@ defmodule Phoenix.LiveView.Utils do end @doc """ - Calls the optional `update/2` or `update_many/1` callback, otherwise update the socket(s) directly. + Calls the optional `update/2` or `update_many/1` callback, otherwise updates the socket(s) directly. """ def maybe_call_update!(socket, component, assigns) do cond do diff --git a/test/e2e/support/issues/issue_3681.ex b/test/e2e/support/issues/issue_3681.ex index 5e96c4e2a5..03ec03d704 100644 --- a/test/e2e/support/issues/issue_3681.ex +++ b/test/e2e/support/issues/issue_3681.ex @@ -29,7 +29,7 @@ defmodule Phoenix.LiveViewTest.E2E.Issue3681Live do def render(assigns) do ~H""" -

A LiveView that does nothing but render it's layout.

+

A LiveView that does nothing but render its layout.

<.link navigate="/issues/3681/away">Go to a different LV with a (funcky) stream """ end diff --git a/test/phoenix_live_view/html_engine_test.exs b/test/phoenix_live_view/html_engine_test.exs index 2409748d17..61b10db2a8 100644 --- a/test/phoenix_live_view/html_engine_test.exs +++ b/test/phoenix_live_view/html_engine_test.exs @@ -986,7 +986,7 @@ defmodule Phoenix.LiveView.HTMLEngineTest do end) end - test "multiple slot entries randered by a single rende_slot/2 call" do + test "multiple slot entries rendered by a single render_slot/2 call" do assigns = %{} expected = """