isomorfeus-preact 22.9.0.rc6 → 22.9.0.rc7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/preact/version.rb +1 -1
- data/lib/preact.rb +3 -2
- data/lib/route.rb +9 -8
- data/lib/switch.rb +18 -9
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1444a364c56453f0e45b901f88316ae4262494206149fb63108d206d84fff870
|
4
|
+
data.tar.gz: d22d8944d3001f1be119335ebaf72d2dac3bfb578b7eb83585ae58b1214171dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01be4daedd99d8ba24d99125878af8032b0289a806e8eb98584f3bb7848d73fb7157770d30853199747a5ca14497cd9f5de90859006bfb4976e23c4247d68a60
|
7
|
+
data.tar.gz: 4962e6fb45985477eea0638976e9f600b1f448eedb68a2a9e245e914caefde52c6af0ad1df228b0747a6973bf018582bea1ac62d516c82812cc04d4a3e19abf4
|
data/lib/preact.rb
CHANGED
@@ -770,7 +770,8 @@ module Preact
|
|
770
770
|
if (newType.declared_props && newType.declared_props !== nil) {
|
771
771
|
#{
|
772
772
|
`newType.declared_props`.each do |prop, value|
|
773
|
-
`newProps`[prop] = value[:default]
|
773
|
+
`if (Object.hasOwnProperty.call(value.$$smap, "default") && !Object.hasOwnProperty.call(newProps.$$smap, prop)) { #{`newProps`[prop] = value[:default]} }`
|
774
|
+
nil
|
774
775
|
end
|
775
776
|
}
|
776
777
|
if (Opal.Isomorfeus.development) { #{`newType`.validate_props(`newProps`)} }
|
@@ -1426,7 +1427,7 @@ module Preact
|
|
1426
1427
|
declared_props = node_name.instance_variable_get(:@declared_props)
|
1427
1428
|
if declared_props
|
1428
1429
|
declared_props.each do |prop, value|
|
1429
|
-
props[prop] = value[:default] if
|
1430
|
+
props[prop] = value[:default] if value.key?(:default) && !props.key?(prop)
|
1430
1431
|
end
|
1431
1432
|
node_name.validate_props(props) if Isomorfeus.development?
|
1432
1433
|
end
|
data/lib/route.rb
CHANGED
@@ -2,14 +2,15 @@ class Route < Preact::Component
|
|
2
2
|
render do
|
3
3
|
route_match = @context[:router][:matcher].call(props[:path], @context[:location])
|
4
4
|
matches, params = props[:match] || route_match
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
if matches
|
6
|
+
component = props[:component]
|
7
|
+
component_props = props[:component_props] || {}
|
8
|
+
if component
|
9
|
+
component = component.constantize if component.is_a?(String)
|
10
|
+
Preact.create_element(component, component_props.merge!({ params: params }))
|
11
|
+
else
|
12
|
+
props[:children]
|
13
|
+
end
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
data/lib/switch.rb
CHANGED
@@ -8,11 +8,11 @@ class Switch < Preact::Component
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
children.
|
14
|
-
|
15
|
-
|
11
|
+
if RUBY_ENGINE == 'opal'
|
12
|
+
def flatten(children)
|
13
|
+
if children.is_a?(Array)
|
14
|
+
children.compact!
|
15
|
+
children.map! do |child|
|
16
16
|
if child.is_a?(Array)
|
17
17
|
flatten(child)
|
18
18
|
elsif `child.type === Opal.Fragment`
|
@@ -20,18 +20,27 @@ class Switch < Preact::Component
|
|
20
20
|
else
|
21
21
|
child
|
22
22
|
end
|
23
|
-
|
23
|
+
end
|
24
|
+
else
|
25
|
+
[children]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
def flatten(children)
|
30
|
+
if children.is_a?(Array)
|
31
|
+
children.compact!
|
32
|
+
children.map! do |child|
|
24
33
|
if child.is_a?(Array)
|
25
34
|
flatten(child)
|
26
35
|
elsif child.type == ::Fragment
|
27
|
-
flatten(child
|
36
|
+
flatten(child[:props][:children])
|
28
37
|
else
|
29
38
|
child
|
30
39
|
end
|
31
40
|
end
|
41
|
+
else
|
42
|
+
[children]
|
32
43
|
end
|
33
|
-
else
|
34
|
-
[children]
|
35
44
|
end
|
36
45
|
end
|
37
46
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-preact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 22.9.0.
|
4
|
+
version: 22.9.0.rc7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 22.9.0.
|
61
|
+
version: 22.9.0.rc7
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 22.9.0.
|
68
|
+
version: 22.9.0.rc7
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: isomorfeus-redux
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 22.9.0.
|
75
|
+
version: 22.9.0.rc7
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 22.9.0.
|
82
|
+
version: 22.9.0.rc7
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: isomorfeus-puppetmaster
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|