proscenium 0.19.0.beta11 → 0.19.0.beta12
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.
- checksums.yaml +4 -4
- data/README.md +0 -44
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/monkey.rb +2 -9
- data/lib/proscenium/react_componentable.rb +1 -1
- data/lib/proscenium/version.rb +1 -1
- data/lib/proscenium.rb +1 -0
- metadata +1 -5
- data/lib/proscenium/view_component/css_modules.rb +0 -11
- data/lib/proscenium/view_component/react_component.rb +0 -22
- data/lib/proscenium/view_component/sideload.rb +0 -4
- data/lib/proscenium/view_component.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ab4894474fb2b337bf404a48aaf36165837913f0f14941c7d59ad69126bfae
|
4
|
+
data.tar.gz: 782de5aced77f22d07f47f1cbcaf638dbf1efbd5a7a3042187a010131dc3d541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 513e9589567f52718a8e3869ceb69b74bf6b31eecc7994b7b5a8d2aac576ff77c87ec2c28f060f90f1f03f04969ec287ade55da7d07895f25edafbe1d4fd5c2d
|
7
|
+
data.tar.gz: da62b2f6ce3d36a0412f479e04f834fe472b87a4d89792e165904cd6c989bd197472baa9c09110370fb75ce6d5de632b465e40d89b11e2664e6a8c5cb1cbec73
|
data/README.md
CHANGED
@@ -49,7 +49,6 @@
|
|
49
49
|
- [JSX](#jsx)
|
50
50
|
- [JSON](#json)
|
51
51
|
- [Phlex Support](#phlex-support)
|
52
|
-
- [ViewComponent Support](#viewcomponent-support)
|
53
52
|
- [Cache Busting](#cache-busting)
|
54
53
|
- [rjs is back!](#rjs-is-back)
|
55
54
|
- [Resolution](#resolution)
|
@@ -769,49 +768,6 @@ end
|
|
769
768
|
<h1 class="user_name-ABCD1234 title">Joel Moss</h1>
|
770
769
|
```
|
771
770
|
|
772
|
-
## ViewComponent Support
|
773
|
-
|
774
|
-
[ViewComponent](https://viewcomponent.org/) iA framework for creating reusable, testable & encapsulated view components, built to integrate seamlessly with Ruby on Rails. Proscenium works perfectly with ViewComponent, with support for side-loading, CSS modules, and more. Simply write your ViewComponent classes and inherit from `Proscenium::ViewComponent`.
|
775
|
-
|
776
|
-
```ruby
|
777
|
-
class MyView < Proscenium::ViewComponent
|
778
|
-
def call
|
779
|
-
tag.h1 'Hello World'
|
780
|
-
end
|
781
|
-
end
|
782
|
-
```
|
783
|
-
|
784
|
-
### Side-loading
|
785
|
-
|
786
|
-
Any ViewComponent class that inherits `Proscenium::ViewComponent` will automatically be [side-loaded](#side-loading).
|
787
|
-
|
788
|
-
### CSS Modules
|
789
|
-
|
790
|
-
[CSS Modules](#css-modules) are fully supported in ViewComponent classes, with access to the [`css_module` helper](#in-your-views) if you need it.
|
791
|
-
|
792
|
-
```ruby
|
793
|
-
# /app/components/user_component.rb
|
794
|
-
class UserComponent < Proscenium::ViewComponent
|
795
|
-
def view_template
|
796
|
-
div.h1 @user.name, class: css_module(:user_name)
|
797
|
-
end
|
798
|
-
end
|
799
|
-
```
|
800
|
-
|
801
|
-
```css
|
802
|
-
/* # /app/components/user_component.module.css */
|
803
|
-
.userName {
|
804
|
-
color: red;
|
805
|
-
font-size: 50px;
|
806
|
-
}
|
807
|
-
```
|
808
|
-
|
809
|
-
The view above will be rendered something like this:
|
810
|
-
|
811
|
-
```html
|
812
|
-
<h1 class="user_name-ABCD1234">Joel Moss</h1>
|
813
|
-
```
|
814
|
-
|
815
771
|
## Cache Busting
|
816
772
|
|
817
773
|
> _COMING SOON_
|
Binary file
|
data/lib/proscenium/monkey.rb
CHANGED
@@ -9,15 +9,8 @@ module Proscenium
|
|
9
9
|
result = super
|
10
10
|
return result if !view.controller || !Proscenium.config.side_load
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
to_sideload = if Object.const_defined?(:ViewComponent) &&
|
15
|
-
template.is_a?(ActionView::Template::Renderable) &&
|
16
|
-
renderable.class < ::ViewComponent::Base &&
|
17
|
-
renderable.class.format == :html
|
18
|
-
renderable
|
19
|
-
elsif template.respond_to?(:virtual_path) &&
|
20
|
-
template.respond_to?(:type) && template.type == :html
|
12
|
+
to_sideload = if template.respond_to?(:virtual_path) &&
|
13
|
+
template.respond_to?(:type) && template.type == :html
|
21
14
|
template
|
22
15
|
end
|
23
16
|
if to_sideload
|
@@ -11,7 +11,7 @@ module Proscenium
|
|
11
11
|
# The HTML tag to use as the wrapping element for the component. You can reassign this in your
|
12
12
|
# component class to use a different tag:
|
13
13
|
#
|
14
|
-
# class MyComponent < Proscenium::
|
14
|
+
# class MyComponent < Proscenium::Phlex::ReactComponent
|
15
15
|
# self.root_tag = :span
|
16
16
|
# end
|
17
17
|
#
|
data/lib/proscenium/version.rb
CHANGED
data/lib/proscenium.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proscenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.0.
|
4
|
+
version: 0.19.0.beta12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
@@ -129,10 +129,6 @@ files:
|
|
129
129
|
- lib/proscenium/templates/rescues/build_error.html.erb
|
130
130
|
- lib/proscenium/utils.rb
|
131
131
|
- lib/proscenium/version.rb
|
132
|
-
- lib/proscenium/view_component.rb
|
133
|
-
- lib/proscenium/view_component/css_modules.rb
|
134
|
-
- lib/proscenium/view_component/react_component.rb
|
135
|
-
- lib/proscenium/view_component/sideload.rb
|
136
132
|
homepage: https://github.com/joelmoss/proscenium
|
137
133
|
licenses:
|
138
134
|
- MIT
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Proscenium
|
4
|
-
# Renders a <div> for use with React components, with data attributes specifying the component
|
5
|
-
# path and props.
|
6
|
-
#
|
7
|
-
# If a content block is given, that content will be rendered inside the component, allowing for a
|
8
|
-
# "loading" UI. If no block is given, then a "loading..." text will be rendered. It is intended
|
9
|
-
# that the component is mounted to this div, and the loading UI will then be replaced with the
|
10
|
-
# component's rendered output.
|
11
|
-
class ViewComponent::ReactComponent < ViewComponent
|
12
|
-
self.abstract_class = true
|
13
|
-
|
14
|
-
include ReactComponentable
|
15
|
-
|
16
|
-
def call
|
17
|
-
tag.send root_tag, data: data_attributes do
|
18
|
-
tag.div content || 'loading...'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Proscenium::ViewComponent < ViewComponent::Base
|
4
|
-
include Proscenium::SourcePath
|
5
|
-
include CssModules
|
6
|
-
|
7
|
-
module Sideload
|
8
|
-
def before_render
|
9
|
-
Proscenium::SideLoad.sideload_inheritance_chain self, controller.sideload_assets_options
|
10
|
-
|
11
|
-
super
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class_attribute :sideload_assets_options
|
16
|
-
|
17
|
-
class << self
|
18
|
-
attr_accessor :abstract_class
|
19
|
-
|
20
|
-
def inherited(child)
|
21
|
-
child.prepend Sideload
|
22
|
-
|
23
|
-
super
|
24
|
-
end
|
25
|
-
|
26
|
-
def sideload_assets(value)
|
27
|
-
self.sideload_assets_options = value
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|