vident-phlex 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 731f9c7918cc00ef43f05fc30ad246d168c2a5484d1ed2e56be7133b38ef5898
4
- data.tar.gz: fe49bbf87d991a04eca3f7796d8a8fdb1fc1b6ed04ba69e03d7ae2f8fe8274b0
3
+ metadata.gz: 01fdc288b02728f29b9cb62d423991a69571d8b65cb7c60a06fa884f6515cf52
4
+ data.tar.gz: 7b0852b10647e0ad7e83ed025118d8fbe2487ff89f6b18420fdc5ef7ee01ffa4
5
5
  SHA512:
6
- metadata.gz: d439e0ba255d7fd23f06669906ca1abdc482dfbc1e097178709760575c129e9ba37e6cafaf1140f4977e19484b9e59a2ca07441555f7467e420a2007378d1f08
7
- data.tar.gz: 6ed48a31f50e9ccb3f19df915c4720cbfc0eb37d47ba3f5c503c41604e64c9038d024e2268cc76a3015e79198668723d9bdc47e74fb864c7ede101cc97f246a8
6
+ metadata.gz: '089ed6bb5951a0732656353a2debf807b28ae869a0d175b4443c8245bd9545236e63e7aa209b13a01e6f93cccabeeba96f812c07150cfe5e629b73541acd8c94'
7
+ data.tar.gz: 4ebc7801536958604147ef70869421b35158641032238e84e1927b8de923ab964fd8b12e4e2bbe7af07558a901a8ece54e289f2f079cce158cd3598afeb8d027
data/README.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Vident::Phlex
2
- Short description and motivation.
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
@@ -2,15 +2,10 @@
2
2
 
3
3
  module Vident
4
4
  module Phlex
5
- class HTML < ::Phlex::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
@@ -1,5 +1,5 @@
1
1
  module Vident
2
2
  module Phlex
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
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.2.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 00:00:00.000000000 Z
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