isomorfeus-preact 22.9.0.rc6 → 22.9.0.rc7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ca8bdcd1a2bca5716034b22c785b72a1a5b41c7b62d54c625c445bbdadc8501
4
- data.tar.gz: 5ad31495ae9a95af445ff563fd1975d297bbc6bf20113cef70b00397100c56e7
3
+ metadata.gz: 1444a364c56453f0e45b901f88316ae4262494206149fb63108d206d84fff870
4
+ data.tar.gz: d22d8944d3001f1be119335ebaf72d2dac3bfb578b7eb83585ae58b1214171dc
5
5
  SHA512:
6
- metadata.gz: f98ff1c4cfc2799c2560870a71b395990459dae4e931c336bdda23ea29cc2f587d9f64cd0541326bbaa5c389ed40e26c5d1add1f198242d46e1e06b6b887e24a
7
- data.tar.gz: 813122cd579f3d5c68086559ac8c462b18e13039d6b4af99f7d6fa30f14e52be2bb25881e73f2d20e70713b5cc9005e85bc1f4f2c9800024a8b0fdf7b2c061ad
6
+ metadata.gz: 01be4daedd99d8ba24d99125878af8032b0289a806e8eb98584f3bb7848d73fb7157770d30853199747a5ca14497cd9f5de90859006bfb4976e23c4247d68a60
7
+ data.tar.gz: 4962e6fb45985477eea0638976e9f600b1f448eedb68a2a9e245e914caefde52c6af0ad1df228b0747a6973bf018582bea1ac62d516c82812cc04d4a3e19abf4
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Preact
3
- VERSION = '22.9.0.rc6'
3
+ VERSION = '22.9.0.rc7'
4
4
  end
5
5
  end
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] if value.key?(:default) && !`newProps`.key?(prop)
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 !props.key?(prop) && value.key?(:default)
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
- return unless 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]
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
- def flatten(children)
12
- if children.is_a?(Array)
13
- children.compact!
14
- children.map! do |child|
15
- if RUBY_ENGINE == 'opal'
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
- else
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.JS[:props][:children])
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.rc6
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-26 00:00:00.000000000 Z
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.rc6
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.rc6
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.rc6
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.rc6
82
+ version: 22.9.0.rc7
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: isomorfeus-puppetmaster
85
85
  requirement: !ruby/object:Gem::Requirement