vident-view_component 0.1.0 → 0.3.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.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/lib/vident/view_component/base.rb +1 -7
- data/lib/vident/view_component/core.rb +37 -0
- data/lib/vident/view_component/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b0ed224d67efe9c374ab3a4548e72841aed91f16b260699d73e83638db8c1f
|
4
|
+
data.tar.gz: 8eab3e009e1a926d252b1fda0d0d33c12072ecd811bbc7a9293a2e1a5808e080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e8ce085af82d75440334389970ab16a752bc542c8ee2e1b22ae5f48c027423a99e1e4905633136e0555b112ab473613b36a8488b85c5efde5d7e360b3d5d180
|
7
|
+
data.tar.gz: f9a5b8f36fd2f0bbc7d477dee548ffa6b2521a585443ee8b1f25ad34cc0643336ece401df6408e9ad21bee1eba60c4651f5f56c805a4ae2d485c6e3f84ab4f12
|
data/README.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# Vident::ViewComponent
|
2
|
-
Short description and motivation.
|
3
2
|
|
3
|
+
[ViewComponent](https://viewcomponent.org/) powered [Vident](https://github.com/stevegeek/vident) components.
|
4
4
|
|
5
|
+
```ruby
|
6
|
+
class ApplicationComponent < ::Vident::ViewComponent::Base
|
7
|
+
end
|
8
|
+
```
|
9
|
+
|
10
|
+
For more details see [vident](https://github.com/stevegeek/vident).
|
5
11
|
|
6
12
|
# Examples
|
7
13
|
|
@@ -28,7 +34,7 @@ It is an avatar component that can either be displayed as an image or as initial
|
|
28
34
|
```ruby
|
29
35
|
class AvatarComponent < ::Vident::ViewComponent::Base
|
30
36
|
include ::Vident::Tailwind
|
31
|
-
include ::Vident::
|
37
|
+
include ::Vident::Caching
|
32
38
|
|
33
39
|
no_stimulus_controller
|
34
40
|
with_cache_key :attributes
|
@@ -1,13 +1,7 @@
|
|
1
1
|
module Vident
|
2
2
|
module ViewComponent
|
3
|
-
class Base <
|
3
|
+
class Base < Core
|
4
4
|
include ::Vident::Component
|
5
|
-
|
6
|
-
# Helper to create the main element
|
7
|
-
def parent_element(**options)
|
8
|
-
@parent_element ||= RootComponent.new(**parent_element_attributes(options))
|
9
|
-
end
|
10
|
-
alias_method :root, :parent_element
|
11
5
|
end
|
12
6
|
end
|
13
7
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Vident
|
2
|
+
module ViewComponent
|
3
|
+
class Core < ::ViewComponent::Base
|
4
|
+
class << self
|
5
|
+
def current_component_modified_time
|
6
|
+
sidecar_view_modified_time + rb_component_modified_time
|
7
|
+
end
|
8
|
+
|
9
|
+
def sidecar_view_modified_time
|
10
|
+
::File.exist?(template_path) ? ::File.mtime(template_path).to_i.to_s : ""
|
11
|
+
end
|
12
|
+
|
13
|
+
def rb_component_modified_time
|
14
|
+
::File.exist?(component_path) ? ::File.mtime(component_path).to_i.to_s : ""
|
15
|
+
end
|
16
|
+
|
17
|
+
def template_path
|
18
|
+
File.join components_base_path, "#{virtual_path}.html.erb"
|
19
|
+
end
|
20
|
+
|
21
|
+
def component_path
|
22
|
+
File.join components_base_path, "#{virtual_path}.rb"
|
23
|
+
end
|
24
|
+
|
25
|
+
def components_base_path
|
26
|
+
::Rails.configuration.view_component.view_component_path || "app/components"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Helper to create the main element
|
31
|
+
def parent_element(**options)
|
32
|
+
@parent_element ||= ::Vident::ViewComponent::RootComponent.new(**parent_element_attributes(options))
|
33
|
+
end
|
34
|
+
alias_method :root, :parent_element
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vident-view_component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Ierodiaconou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 0.9.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '1'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.9.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '1'
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- lib/tasks/vident/view_component_tasks.rake
|
83
83
|
- lib/vident/view_component.rb
|
84
84
|
- lib/vident/view_component/base.rb
|
85
|
+
- lib/vident/view_component/core.rb
|
85
86
|
- lib/vident/view_component/engine.rb
|
86
87
|
- lib/vident/view_component/root_component.rb
|
87
88
|
- lib/vident/view_component/version.rb
|
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: '0'
|
109
110
|
requirements: []
|
110
|
-
rubygems_version: 3.4.
|
111
|
+
rubygems_version: 3.4.10
|
111
112
|
signing_key:
|
112
113
|
specification_version: 4
|
113
114
|
summary: Vident with ViewComponent
|