Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/js/phoenix_live_view/live_socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_component/macro_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/colocated_js.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix_live_view/diff.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix_live_view/html_algebra.ex
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ defmodule Phoenix.LiveView.HTMLAlgebra do
# <div label="application programming interface">API</div>
# ).
#
# 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])
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/live_stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/route.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/tag_engine.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/tag_engine/compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix_live_view/tag_engine/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
#
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/tag_engine/tokenizer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
6 changes: 3 additions & 3 deletions lib/phoenix_live_view/test/live_view_test.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"})

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix_live_view/upload.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix_live_view/upload_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
6 changes: 3 additions & 3 deletions lib/phoenix_live_view/upload_writer.ex
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/phoenix_live_view/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/support/issues/issue_3681.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Phoenix.LiveViewTest.E2E.Issue3681Live do

def render(assigns) do
~H"""
<h3>A LiveView that does nothing but render it's layout.</h3>
<h3>A LiveView that does nothing but render its layout.</h3>
<.link navigate="/issues/3681/away">Go to a different LV with a (funcky) stream</.link>
"""
end
Expand Down
2 changes: 1 addition & 1 deletion test/phoenix_live_view/html_engine_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down
Loading