vident-phlex 0.2.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 +9 -1
- data/lib/vident/phlex/core.rb +29 -0
- data/lib/vident/phlex/html.rb +1 -21
- data/lib/vident/phlex/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01fdc288b02728f29b9cb62d423991a69571d8b65cb7c60a06fa884f6515cf52
|
4
|
+
data.tar.gz: 7b0852b10647e0ad7e83ed025118d8fbe2487ff89f6b18420fdc5ef7ee01ffa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '089ed6bb5951a0732656353a2debf807b28ae869a0d175b4443c8245bd9545236e63e7aa209b13a01e6f93cccabeeba96f812c07150cfe5e629b73541acd8c94'
|
7
|
+
data.tar.gz: 4ebc7801536958604147ef70869421b35158641032238e84e1927b8de923ab964fd8b12e4e2bbe7af07558a901a8ece54e289f2f079cce158cd3598afeb8d027
|
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Vident::Phlex
|
2
|
-
|
2
|
+
|
3
|
+
[Phlex](https://phlex.fun/) powered [Vident](https://github.com/stevegeek/vident) components.
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
class ApplicationComponent < ::Vident::Phlex::HTML
|
7
|
+
end
|
8
|
+
```
|
9
|
+
|
10
|
+
For more details see [vident](https://github.com/stevegeek/vident).
|
3
11
|
|
4
12
|
## Usage
|
5
13
|
How to use my plugin.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vident
|
4
|
+
module Phlex
|
5
|
+
class Core < ::Phlex::HTML
|
6
|
+
class << self
|
7
|
+
def inherited(subclass)
|
8
|
+
subclass.component_source_file_path = caller_locations(1, 10).reject { |l| l.label == "inherited" }[0].path
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :component_source_file_path
|
13
|
+
|
14
|
+
# Caching support
|
15
|
+
def current_component_modified_time
|
16
|
+
path = component_source_file_path
|
17
|
+
raise StandardError, "No component source file exists #{path}" unless path && ::File.exist?(path)
|
18
|
+
::File.mtime(path).to_i.to_s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Helper to create the main element
|
23
|
+
def parent_element(**options)
|
24
|
+
@parent_element ||= ::Vident::Phlex::RootComponent.new(**parent_element_attributes(options))
|
25
|
+
end
|
26
|
+
alias_method :root, :parent_element
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/vident/phlex/html.rb
CHANGED
@@ -2,15 +2,10 @@
|
|
2
2
|
|
3
3
|
module Vident
|
4
4
|
module Phlex
|
5
|
-
class HTML <
|
5
|
+
class HTML < Core
|
6
6
|
include ::Vident::Component
|
7
7
|
|
8
8
|
class << self
|
9
|
-
def inherited(subclass)
|
10
|
-
subclass.component_source_file_path = caller_locations(1, 10).reject { |l| l.label == "inherited" }[0].path
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
9
|
# Phlex uses a DSL to define the document, and those methods could easily clash with our attribute
|
15
10
|
# accessors. Therefore in Phlex components we do not create attribute accessors, and instead use instance
|
16
11
|
# variables directly.
|
@@ -18,22 +13,7 @@ module Vident
|
|
18
13
|
options[:delegates] = false
|
19
14
|
super
|
20
15
|
end
|
21
|
-
|
22
|
-
attr_accessor :component_source_file_path
|
23
|
-
|
24
|
-
# Caching support
|
25
|
-
def current_component_modified_time
|
26
|
-
path = component_source_file_path
|
27
|
-
raise StandardError, "No component source file exists #{path}" unless path && ::File.exist?(path)
|
28
|
-
::File.mtime(path).to_i.to_s
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Helper to create the main element
|
33
|
-
def parent_element(**options)
|
34
|
-
@parent_element ||= RootComponent.new(**parent_element_attributes(options))
|
35
16
|
end
|
36
|
-
alias_method :root, :parent_element
|
37
17
|
end
|
38
18
|
end
|
39
19
|
end
|
data/lib/vident/phlex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vident-phlex
|
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-08-
|
11
|
+
date: 2023-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- Rakefile
|
102
102
|
- lib/tasks/vident/phlex_tasks.rake
|
103
103
|
- lib/vident/phlex.rb
|
104
|
+
- lib/vident/phlex/core.rb
|
104
105
|
- lib/vident/phlex/engine.rb
|
105
106
|
- lib/vident/phlex/html.rb
|
106
107
|
- lib/vident/phlex/root_component.rb
|