proscenium-phlex 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Proscenium::Phlex
4
- # Renders a <div> for use with React components, with data attributes specifying the component
5
- # path and props.
6
- #
7
- # If a block is given, it will be yielded within the div, allowing for a custom "loading" UI. If
8
- # no block is given, then a "loading..." text will be rendered. It is intended that the component
9
- # is mounted to this div, and the loading UI will then be replaced with the component's rendered
10
- # output.
11
- #
12
- # You can pass props to the component in the `:props` keyword argument.
13
- module React
14
- extend ActiveSupport::Concern
15
- include Sideload
16
- include Proscenium::ReactComponentable
17
-
18
- # Override this to provide your own loading UI.
19
- #
20
- # @example
21
- # def view_template(**attributes, &block)
22
- # super do
23
- # 'Look at me! I am loading now...'
24
- # end
25
- # end
26
- #
27
- # @yield the given block to a `div` within the top level component div.
28
- def view_template(**attributes, &)
29
- send(root_tag, **{ data: data_attributes }.deep_merge(attributes), &)
30
- end
31
- end
32
- end