heartml 1.0.0.beta5 → 1.0.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/heartml/server_effects.rb +22 -26
- data/lib/heartml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c09bc70bc5761750cc99010a62b106ff435e0f0ee9f72a259d62631c8913785c
|
4
|
+
data.tar.gz: 44bb47fca2eb847d2e6636ae99eb8446d32b488702a6c8e5dc57d39d571bf076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3590d652c24107deb627e3f9aa0114411c3077118b38ad54fdf986019ad5b7a4262682ff407b575796085f4a54c2331a7c82a6a95b6941484242ddc838aa17f8
|
7
|
+
data.tar.gz: 4b302508a049f09c1009d126a41f73220e63a3ffe9647f9acb689de3df5e3df0977a05fce48b62683c0e139dcc0ef2136d27ecafe3ca77bcc4cf87a3565b1c2f
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -28,9 +28,9 @@ module Heartml
|
|
28
28
|
Nokolexbor::Element.include JSPropertyAliases unless Nokolexbor::Element.instance_methods.include?(:textContent=)
|
29
29
|
|
30
30
|
module ClassMethods
|
31
|
-
def directive(name,
|
31
|
+
def directive(name, function)
|
32
32
|
@directives ||= {}
|
33
|
-
@directives[name.to_s] =
|
33
|
+
@directives[name.to_s] = function
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -45,19 +45,15 @@ module Heartml
|
|
45
45
|
klass.extend ClassMethods
|
46
46
|
|
47
47
|
klass.class_eval do
|
48
|
-
directive :show
|
49
|
-
element["hidden"] = "" unless value
|
50
|
-
end
|
48
|
+
directive :show, ->(_, node, value) { node["hidden"] = "" unless value }
|
51
49
|
|
52
|
-
directive :hide
|
53
|
-
element["hidden"] = "" if value
|
54
|
-
end
|
50
|
+
directive :hide, ->(_, node, value) { node["hidden"] = "" if value }
|
55
51
|
|
56
|
-
directive :classMap
|
52
|
+
directive :classMap, ->(_, node, obj) {
|
57
53
|
obj.each do |k, v|
|
58
|
-
|
54
|
+
node.add_class k.to_s if v
|
59
55
|
end
|
60
|
-
|
56
|
+
}
|
61
57
|
end
|
62
58
|
end
|
63
59
|
|
@@ -70,7 +66,7 @@ module Heartml
|
|
70
66
|
syntax = attribute.value
|
71
67
|
statements = syntax.split(";").map(&:strip)
|
72
68
|
|
73
|
-
statements.each do |statement|
|
69
|
+
statements.each do |statement|
|
74
70
|
if statement.start_with?("@")
|
75
71
|
# property assignment
|
76
72
|
expression = statement.split("=").map(&:strip)
|
@@ -86,13 +82,7 @@ module Heartml
|
|
86
82
|
arg_strs.unshift("@")
|
87
83
|
|
88
84
|
if self.class.directives[directive_name.strip[1..]]
|
89
|
-
args = arg_strs.map
|
90
|
-
next node if arg_str == "@"
|
91
|
-
|
92
|
-
next arg_str[1...-1] if arg_str.start_with?("'") # string literal
|
93
|
-
|
94
|
-
send(arg_str[1..])
|
95
|
-
end
|
85
|
+
args = arg_strs.map { _convert_effect_arg_to_value _1, node }
|
96
86
|
|
97
87
|
self.class.directives[directive_name.strip[1..]]&.(self, *args)
|
98
88
|
end
|
@@ -102,13 +92,7 @@ module Heartml
|
|
102
92
|
arg_strs = args_str.split(",").map(&:strip)
|
103
93
|
arg_strs.unshift("@")
|
104
94
|
|
105
|
-
args = arg_strs.map
|
106
|
-
next node if arg_str == "@"
|
107
|
-
|
108
|
-
next arg_str[1...-1] if arg_str.start_with?("'") # string literal
|
109
|
-
|
110
|
-
send(arg_str[1..])
|
111
|
-
end
|
95
|
+
args = arg_strs.map { _convert_effect_arg_to_value _1, node }
|
112
96
|
|
113
97
|
send(method_name.strip, *args)
|
114
98
|
end
|
@@ -116,5 +100,17 @@ module Heartml
|
|
116
100
|
attribute.name = "host-effect"
|
117
101
|
end
|
118
102
|
end
|
103
|
+
|
104
|
+
def _convert_effect_arg_to_value(arg_str, node)
|
105
|
+
return node if arg_str == "@"
|
106
|
+
|
107
|
+
return arg_str[1...-1] if arg_str.start_with?("'") # string literal
|
108
|
+
|
109
|
+
if arg_str.match(/^[0-9]/)
|
110
|
+
return arg_str.include?(".") ? arg_str.to_f : arg_str.to_i
|
111
|
+
end
|
112
|
+
|
113
|
+
send(arg_str[1..])
|
114
|
+
end
|
119
115
|
end
|
120
116
|
end
|
data/lib/heartml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heartml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared White
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|