proscenium 0.2.1-arm64-darwin → 0.3.0-arm64-darwin
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/bin/esbuild +0 -0
- data/lib/proscenium/phlex/component.rb +9 -0
- data/lib/proscenium/phlex/react_component.rb +25 -0
- data/lib/proscenium/phlex.rb +24 -0
- data/lib/proscenium/version.rb +1 -1
- data/{app/components → lib/proscenium/view_component}/react_component.rb +2 -2
- data/lib/proscenium/view_component.rb +5 -2
- metadata +19 -4
- data/app/components/application_component.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da2d8edab5c738829713ba0a7e133f87bdfc2e196678e81e13b659d1885a038b
|
4
|
+
data.tar.gz: 73e62eff4f0d739216ef68fb2b4e55b7536bdd54f47996e1083a08d688ab9b99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f2a27138e41d25203105361d256ae1bf1fba302a389e0880e78d70957c14b166314996ae59e3d62b56845e0c903d1d01e105834c0dbe20e3cc4c5a0d6632719
|
7
|
+
data.tar.gz: 7d4a178f8b015049afb8bf1e71c0d41f945cc7a31d745c6a75c67e9ec88982e4ea3c146f6e2b9d8234beb6dd54479a23efdb124fbe4e5827d61b18ac3654b3e2
|
data/bin/esbuild
CHANGED
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Renders a div for use with component-manager.
|
5
|
+
#
|
6
|
+
class Proscenium::Phlex::ReactComponent < Proscenium::Phlex::Component
|
7
|
+
attr_accessor :props, :lazy
|
8
|
+
|
9
|
+
# @param props: [Hash]
|
10
|
+
# @param lazy: [Boolean] Lazy load the component using IntersectionObserver. Default: true.
|
11
|
+
def initialize(props: {}, lazy: true) # rubocop:disable Lint/MissingSuper
|
12
|
+
@props = props
|
13
|
+
@lazy = lazy
|
14
|
+
end
|
15
|
+
|
16
|
+
# @yield the given block to a `div` within the top level component div. If not given,
|
17
|
+
# `<div>loading...</div>` will be rendered. Use this to display a loading UI while the component
|
18
|
+
# is loading and rendered.
|
19
|
+
def template(&block)
|
20
|
+
div class: ['componentManagedByProscenium', '@component'],
|
21
|
+
data: { component: { path: virtual_path, props: props, lazy: lazy }.to_json } do
|
22
|
+
block ? div(&block) : div { 'loading...' }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/proscenium/phlex.rb
CHANGED
@@ -1,7 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'phlex'
|
4
|
+
|
3
5
|
module Proscenium
|
4
6
|
class Phlex < ::Phlex::View
|
7
|
+
extend ActiveSupport::Autoload
|
8
|
+
|
9
|
+
autoload :Component
|
10
|
+
autoload :ReactComponent
|
11
|
+
|
12
|
+
module Helpers
|
13
|
+
def side_load_javascripts(...)
|
14
|
+
if (output = @_view_context.side_load_javascripts(...))
|
15
|
+
@_target << output
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
%i[side_load_stylesheets proscenium_dev].each do |name|
|
20
|
+
define_method name do
|
21
|
+
if (output = @_view_context.send(name))
|
22
|
+
@_target << output
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
5
28
|
module Sideload
|
6
29
|
def template(...)
|
7
30
|
Proscenium::SideLoad.append self.class.path if Rails.application.config.proscenium.side_load
|
@@ -18,6 +41,7 @@ module Proscenium
|
|
18
41
|
child.path = path.delete_prefix(::Rails.root.to_s).delete_suffix('.rb')[1..]
|
19
42
|
|
20
43
|
child.prepend Sideload
|
44
|
+
child.include Helpers
|
21
45
|
|
22
46
|
super
|
23
47
|
end
|
data/lib/proscenium/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class ReactComponent <
|
3
|
+
class Proscenium::ViewComponent::ReactComponent < Proscenium::ViewComponent
|
4
4
|
attr_accessor :props, :lazy
|
5
5
|
|
6
6
|
# @param props: [Hash]
|
@@ -15,7 +15,7 @@ class ReactComponent < ApplicationComponent
|
|
15
15
|
def call
|
16
16
|
tag.div class: ['componentManagedByProscenium', css_module(:component)],
|
17
17
|
data: { component: { path: virtual_path, props: props, lazy: lazy } } do
|
18
|
-
tag.div content
|
18
|
+
tag.div content || 'loading...'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require 'view_component'
|
4
|
+
|
5
|
+
class Proscenium::ViewComponent < ViewComponent::Base
|
4
6
|
extend ActiveSupport::Autoload
|
5
7
|
|
6
8
|
autoload :TagBuilder
|
9
|
+
autoload :ReactComponent
|
7
10
|
|
8
11
|
def render_in(...)
|
9
|
-
cssm.compile_class_names(super)
|
12
|
+
cssm.compile_class_names(super(...))
|
10
13
|
end
|
11
14
|
|
12
15
|
def before_render
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proscenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actioncable
|
@@ -92,6 +92,20 @@ dependencies:
|
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '3.13'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: phlex
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.4.0
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 0.4.0
|
95
109
|
- !ruby/object:Gem::Dependency
|
96
110
|
name: railties
|
97
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,8 +154,6 @@ files:
|
|
140
154
|
- README.md
|
141
155
|
- app/channels/proscenium/connection.rb
|
142
156
|
- app/channels/proscenium/reload_channel.rb
|
143
|
-
- app/components/application_component.rb
|
144
|
-
- app/components/react_component.rb
|
145
157
|
- bin/esbuild
|
146
158
|
- bin/lightningcss
|
147
159
|
- config/routes.rb
|
@@ -171,6 +183,8 @@ files:
|
|
171
183
|
- lib/proscenium/middleware/runtime.rb
|
172
184
|
- lib/proscenium/middleware/static.rb
|
173
185
|
- lib/proscenium/phlex.rb
|
186
|
+
- lib/proscenium/phlex/component.rb
|
187
|
+
- lib/proscenium/phlex/react_component.rb
|
174
188
|
- lib/proscenium/precompile.rb
|
175
189
|
- lib/proscenium/railtie.rb
|
176
190
|
- lib/proscenium/runtime/auto_reload.js
|
@@ -180,6 +194,7 @@ files:
|
|
180
194
|
- lib/proscenium/utils.js
|
181
195
|
- lib/proscenium/version.rb
|
182
196
|
- lib/proscenium/view_component.rb
|
197
|
+
- lib/proscenium/view_component/react_component.rb
|
183
198
|
- lib/proscenium/view_component/tag_builder.rb
|
184
199
|
- lib/tasks/assets.rake
|
185
200
|
homepage: https://github.com/joelmoss/proscenium
|