isomorfeus-preact 22.10.0.rc1 → 22.10.0.rc2
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/isomorfeus/preact/version.rb +1 -1
- data/lib/lucid_app.rb +18 -15
- data/lib/preact/component_resolution.rb +8 -1
- data/lib/preact/module_component_resolution.rb +8 -1
- data/lib/preact.rb +9 -12
- 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: ed19ddda76f48b8c66af26970d4f7b4e1927b9061bf6ec9080dc40d5e51ff1cd
|
4
|
+
data.tar.gz: 97cc9fc63e4a06bb9a7d8dd6f7b2d90737f681935bc21f274870658c26e77e5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e39ee8b131d18503cb85f83b0a3750b32163661aa46d368933f06bf4d09b873c5d1a36a03b2c54c352956c49c785be245530fa65d4eeee2526c583ce6a2f33f2
|
7
|
+
data.tar.gz: 53961fada45da80ce23e4ef9f1ebbb5bbda85358e410c5cb70f00b5457f4ffff88d1605943bdbaba88c37aed574e1ea3d513f57e69347065b59c60f347104d4c
|
data/lib/lucid_app.rb
CHANGED
@@ -78,31 +78,34 @@ class LucidApp < LucidComponent
|
|
78
78
|
super(props, context)
|
79
79
|
|
80
80
|
# theme
|
81
|
-
@class_name_sym = @class_name.to_sym
|
82
81
|
@theme = @self_class.css_theme
|
83
82
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
@state.merge!({ _app_ctx: { value: { iso_location: props[:location],
|
89
|
-
iso_store: store_state,
|
90
|
-
iso_theme: @theme }}})
|
83
|
+
@state.merge!({ _app_ctx: { value: {
|
84
|
+
iso_location: props[:location],
|
85
|
+
iso_store: Isomorfeus.store.get_state,
|
86
|
+
iso_theme: @theme }}})
|
91
87
|
|
92
|
-
lai = self
|
93
88
|
if RUBY_ENGINE == 'opal'
|
89
|
+
lai = self
|
94
90
|
@unsubscriber = Isomorfeus.store.subscribe do
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
99
|
-
lai.set_state({ _app_ctx: { value: { iso_location: lai.props[:location],
|
100
|
-
iso_store: store_state,
|
91
|
+
lai.set_state({ _app_ctx: { value: {
|
92
|
+
iso_location: lai.props[:location],
|
93
|
+
iso_store: Isomorfeus.store.get_state,
|
101
94
|
iso_theme: lai.theme }}})
|
102
95
|
end
|
103
96
|
end
|
104
97
|
end
|
105
98
|
|
99
|
+
def app_state
|
100
|
+
@state.dig(:_app_ctx, :value, :iso_store, :application_state)
|
101
|
+
end
|
102
|
+
|
103
|
+
def class_state
|
104
|
+
res = @state.dig(:_app_ctx, :value, :iso_store, :class_state, @class_name)
|
105
|
+
return res if res
|
106
|
+
{}
|
107
|
+
end
|
108
|
+
|
106
109
|
def should_component_update?(next_props, next_state, _next_context)
|
107
110
|
return true if @props != next_props || @state != next_state
|
108
111
|
false
|
@@ -11,10 +11,15 @@ module Preact::ComponentResolution
|
|
11
11
|
%x{
|
12
12
|
let constant;
|
13
13
|
let sc = self.$class();
|
14
|
+
// disable stack traces here for improved performance
|
15
|
+
// if const cannot be found, the orignal method_mising will throw with stacktrace
|
16
|
+
Opal.config.enable_stack_trace = false
|
14
17
|
try {
|
15
18
|
constant = sc.$const_get(component_name);
|
16
19
|
} catch(err) {
|
17
|
-
let module_names
|
20
|
+
let module_names;
|
21
|
+
if (sc.$$full_name) { module_names = sc.$$full_name.split("::"); }
|
22
|
+
else { module_names = sc.$to_s().split("::"); }
|
18
23
|
let module_name;
|
19
24
|
for (let i = module_names.length - 1; i > 0; i--) {
|
20
25
|
module_name = module_names.slice(0, i).join('::');
|
@@ -23,6 +28,8 @@ module Preact::ComponentResolution
|
|
23
28
|
break;
|
24
29
|
} catch(err) { }
|
25
30
|
}
|
31
|
+
} finally {
|
32
|
+
Opal.config.enable_stack_trace = true
|
26
33
|
}
|
27
34
|
if (constant) {
|
28
35
|
let last = args[args.length-1];
|
@@ -13,9 +13,16 @@ class Module
|
|
13
13
|
let constant = null;
|
14
14
|
let c = component_name[0];
|
15
15
|
if (c == c.toUpperCase()) {
|
16
|
+
// disable stack traces here for improved performance
|
17
|
+
// if const cannot be found, the orignal method_mising will throw with stacktrace
|
18
|
+
Opal.config.enable_stack_trace = false;
|
16
19
|
try {
|
17
20
|
constant = self.$const_get(component_name);
|
18
|
-
} catch(err) {
|
21
|
+
} catch(err) {
|
22
|
+
// nothing
|
23
|
+
} finally {
|
24
|
+
Opal.config.enable_stack_trace = true;
|
25
|
+
}
|
19
26
|
if (constant) {
|
20
27
|
let last = args[args.length-1];
|
21
28
|
#{`Opal.Preact`._render_element(`constant`, `(last === undefined || last === null) ? nil : last`, &block)};
|
data/lib/preact.rb
CHANGED
@@ -971,6 +971,13 @@ module Preact
|
|
971
971
|
|
972
972
|
function is_a_vnode(type) { return type === vnode_class; }
|
973
973
|
function is_nil() { return false; }
|
974
|
+
function vnode_eql(me, other) {
|
975
|
+
for(let prop in me) {
|
976
|
+
if (prop === 'props') { continue; }
|
977
|
+
else if (me[prop] != other[prop]) { return false; }
|
978
|
+
}
|
979
|
+
return me.props["$=="](other.props);
|
980
|
+
}
|
974
981
|
|
975
982
|
self.createVNode = function(type, props, key, ref, original) {
|
976
983
|
// V8 seems to be better at detecting type shapes if the object is allocated from the same call site
|
@@ -993,19 +1000,9 @@ module Preact
|
|
993
1000
|
_component: null,
|
994
1001
|
_hydrating: null,
|
995
1002
|
constructor: undefined,
|
996
|
-
_original: original == null ? ++vnodeId : original,
|
1003
|
+
_original: (original == null) ? ++vnodeId : original,
|
997
1004
|
"$is_a?": is_a_vnode,
|
998
|
-
"$==": eql = function(other) {
|
999
|
-
for(let prop in vnode) {
|
1000
|
-
if (prop === 'props') {
|
1001
|
-
let res = vnode[prop]["$=="](other[prop]);
|
1002
|
-
if (!res) return false;
|
1003
|
-
} else if (vnode[prop] != other[prop]) {
|
1004
|
-
return false;
|
1005
|
-
}
|
1006
|
-
}
|
1007
|
-
return true;
|
1008
|
-
},
|
1005
|
+
"$==": eql = function(other) { return vnode_eql(vnode, other); },
|
1009
1006
|
"$eql?": eql,
|
1010
1007
|
"$nil?": is_nil,
|
1011
1008
|
"$$is_vnode": true
|
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.10.0.
|
4
|
+
version: 22.10.0.rc2
|
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-10-
|
11
|
+
date: 2022-10-07 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.10.0.
|
61
|
+
version: 22.10.0.rc2
|
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.10.0.
|
68
|
+
version: 22.10.0.rc2
|
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.10.0.
|
75
|
+
version: 22.10.0.rc2
|
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.10.0.
|
82
|
+
version: 22.10.0.rc2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: isomorfeus-puppetmaster
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|