hyalite 0.3.0 → 0.3.1
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/lib/hyalite/component.rb +6 -0
- data/lib/hyalite/dom/collection.rb +8 -0
- data/lib/hyalite/dom_property_operations.rb +3 -3
- data/lib/hyalite/mount.rb +36 -2
- data/lib/hyalite/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: 0ad8e3484bfee29ea87d6760ec24d8a44d2feb3e265b6b108f486f20f6541fb4
|
4
|
+
data.tar.gz: 479d8f128bd334c868f2777aa9089e772011742b8c04ccc076b293e73d7cac17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 735fee94be929da9fe0c6a7b1a6af2f6eb9b2c97cef04e63c94957c8eb20e9b4643056624b9d7248afaa85635472f9cfa1cf49fdb001908639a4fee10c24cb95
|
7
|
+
data.tar.gz: 956841120bcdcf20581d93a9abfcfb0c15ae34e3b137c9dd2b3c128fa2621083d96e758b34b44b49b924c01b215b512f5c65f296c9fba8ed871f6da22637234d
|
data/lib/hyalite/component.rb
CHANGED
@@ -109,6 +109,12 @@ module Hyalite
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
+
TAGS.each do |tag|
|
113
|
+
define_method(tag) do |props, *children, &block|
|
114
|
+
@component.send(tag, props, *children, &block)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
112
118
|
def method_missing(method_name, *args, &block)
|
113
119
|
if @component.respond_to?(method_name, true)
|
114
120
|
@component.send(method_name, *args, &block)
|
@@ -17,6 +17,14 @@ module Hyalite::DOM
|
|
17
17
|
Element.new(`self.native.item(index)`)
|
18
18
|
end
|
19
19
|
|
20
|
+
def first
|
21
|
+
Element.new(`self.native.item(0)`)
|
22
|
+
end
|
23
|
+
|
24
|
+
def last
|
25
|
+
Element.new(`self.native.item(self.native.length - 1)`)
|
26
|
+
end
|
27
|
+
|
20
28
|
def length
|
21
29
|
`self.native.length`
|
22
30
|
end
|
@@ -17,11 +17,11 @@ module Hyalite
|
|
17
17
|
return
|
18
18
|
end
|
19
19
|
|
20
|
-
element.attributes[attribute_name]=Hyalite.escape_text_content_for_browser(value)
|
20
|
+
element.attributes[attribute_name] = Hyalite.escape_text_content_for_browser(value.to_s)
|
21
21
|
elsif DOMProperty.is_custom_attribute(name)
|
22
22
|
return if value.nil?
|
23
23
|
|
24
|
-
element.attributes[name]=Hyalite.escape_text_content_for_browser(value)
|
24
|
+
element.attributes[name] = Hyalite.escape_text_content_for_browser(value.to_s)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -32,7 +32,7 @@ module Hyalite
|
|
32
32
|
def create_markup_for_custom_attribute(element, name, value)
|
33
33
|
return if (!is_attribute_name_safe(name) || value == null)
|
34
34
|
|
35
|
-
element.attributes[name]=Hyalite.escape_text_content_for_browser(value)
|
35
|
+
element.attributes[name] = Hyalite.escape_text_content_for_browser(value.to_s)
|
36
36
|
end
|
37
37
|
|
38
38
|
def is_attribute_name_safe(attribute_name)
|
data/lib/hyalite/mount.rb
CHANGED
@@ -60,7 +60,7 @@ module Hyalite
|
|
60
60
|
return false unless node.element?
|
61
61
|
|
62
62
|
id = node_id(node)
|
63
|
-
id ? id[0] == SEPARATOR : false
|
63
|
+
id ? id[0] == Hyalite::Reconciler::SEPARATOR : false
|
64
64
|
end
|
65
65
|
|
66
66
|
def render_new_root_component(next_element, container, should_reuse_markup)
|
@@ -74,6 +74,40 @@ module Hyalite
|
|
74
74
|
component_instance
|
75
75
|
end
|
76
76
|
|
77
|
+
def unmount_component_at_node(container)
|
78
|
+
root_id = root_id(container)
|
79
|
+
component = @instances_by_root_id[root_id]
|
80
|
+
unless component
|
81
|
+
container_has_non_root_child = has_non_root_child(container)
|
82
|
+
|
83
|
+
container_id = internal_id(container)
|
84
|
+
container_id &&
|
85
|
+
container_id == InstanceHandles.root_id_from_node_id(container_id)
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
|
89
|
+
Hyalite.updates.batched_updates do
|
90
|
+
unmount_component_from_node(component, container)
|
91
|
+
end
|
92
|
+
|
93
|
+
@instances_by_root_id.delete(root_id)
|
94
|
+
@containers_by_root_id.delete(root_id)
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
def has_non_root_child(node)
|
99
|
+
root_id = root_id(container)
|
100
|
+
root_id ? root_id != InstanceHandles.root_id_from_node_id(root_id) : false
|
101
|
+
end
|
102
|
+
|
103
|
+
def unmount_component_from_node(instance, container)
|
104
|
+
Reconciler.unmount_component(instance)
|
105
|
+
|
106
|
+
while container.children.length > 0
|
107
|
+
container.children.last.remove
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
77
111
|
def register_component(next_component, container)
|
78
112
|
#ReactBrowserEventEmitter.ensureScrollValueMonitoring();
|
79
113
|
|
@@ -122,7 +156,7 @@ module Hyalite
|
|
122
156
|
|
123
157
|
def root_element_in_container(container)
|
124
158
|
if container.document?
|
125
|
-
|
159
|
+
container
|
126
160
|
else
|
127
161
|
container.children.first
|
128
162
|
end
|
data/lib/hyalite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyalite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|