isomorfeus-preact 10.6.54 → 10.6.57
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/lucid_app/mixin.rb +1 -1
- data/lib/isomorfeus_preact/lucid_component/api.rb +1 -1
- data/lib/isomorfeus_preact/lucid_component/mixin.rb +1 -1
- data/lib/isomorfeus_preact/lucid_func/mixin.rb +1 -1
- data/lib/isomorfeus_preact/preact/function_component/api.rb +17 -1
- data/lib/preact/component/api.rb +13 -1
- data/lib/preact/version.rb +1 -1
- data/lib/preact.rb +1 -14
- 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: c5031b455f87fd1d741f943fe39a1f839980f46751fc9b895c722f343a3800e1
|
4
|
+
data.tar.gz: 0dcfb17fa803756400b1c745d15c993cfa2a4661df4c2e5247a25f6d3392df85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5afe1ad79cc07dab287a5b4ea66b7770a9073a6d7026b817b27bd017d06c305616fb8f82d0f7c71e1de7b42d55f79f76653de76c7fab1bfb00c5a533a1f72fea
|
7
|
+
data.tar.gz: fd00f32642afdc4737b9ae27cb5e586ad70b3421c2dfd11219551394ec6c54be97a44d82a3b2c0163622e941180afb593c9e3d95f10b0aef25ab60a56e680c35
|
@@ -9,6 +9,6 @@ module LucidApp::Mixin
|
|
9
9
|
base.include(::LucidComponent::Api)
|
10
10
|
base.include(::LucidApp::Api)
|
11
11
|
base.include(::LucidComponent::Initializer)
|
12
|
-
base.include(::LucidI18n::Mixin) if `("lucid_i18n/mixin"
|
12
|
+
base.include(::LucidI18n::Mixin) if `(Opal.modules.hasOwnProperty("lucid_i18n/mixin"))`
|
13
13
|
end
|
14
14
|
end
|
@@ -8,6 +8,6 @@ module LucidComponent::Mixin
|
|
8
8
|
base.include(::Preact::Component::Callbacks)
|
9
9
|
base.include(::LucidComponent::Api)
|
10
10
|
base.include(::LucidComponent::Initializer)
|
11
|
-
base.include(::LucidI18n::Mixin) if `("lucid_i18n/mixin"
|
11
|
+
base.include(::LucidI18n::Mixin) if `(Opal.modules.hasOwnProperty("lucid_i18n/mixin"))`
|
12
12
|
end
|
13
13
|
end
|
@@ -5,6 +5,6 @@ module LucidFunc::Mixin
|
|
5
5
|
base.extend(::LucidFunc::NativeComponentConstructor)
|
6
6
|
base.include(::Preact::Elements)
|
7
7
|
base.include(::LucidComponent::Api)
|
8
|
-
base.include(::LucidI18n::Mixin) if `("lucid_i18n/mixin"
|
8
|
+
base.include(::LucidI18n::Mixin) if `(Opal.modules.hasOwnProperty("lucid_i18n/mixin"))`
|
9
9
|
end
|
10
10
|
end
|
@@ -1,4 +1,12 @@
|
|
1
1
|
module Preact::FunctionComponent::Api
|
2
|
+
def self.included(base)
|
3
|
+
base.instance_exec do
|
4
|
+
def to_js
|
5
|
+
self.JS[:preact_component]
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
2
10
|
def props
|
3
11
|
@native_props
|
4
12
|
end
|
@@ -112,7 +120,15 @@ module Preact::FunctionComponent::Api
|
|
112
120
|
%x{
|
113
121
|
if (#{self}.method_refs?.[#{method_key}]) { return #{self}.method_refs[#{method_key}]; }
|
114
122
|
if (!#{self}.method_refs) { #{self}.method_refs = {}; }
|
115
|
-
#{self}.method_refs[#{method_key}] = { m:
|
123
|
+
#{self}.method_refs[#{method_key}] = { m: null, a: args };
|
124
|
+
let r = #{self}.method_refs[#{method_key}];
|
125
|
+
let dev = #{Isomorfeus.development?};
|
126
|
+
r.preact_event_handler_function = function(event, info) {
|
127
|
+
let ruby_event = Opal.Preact.native_to_ruby_event(event);
|
128
|
+
if (!r.m || dev) { r.m = #{method(method_symbol)} };
|
129
|
+
if (r.a.length > 0) { r.m.$call.apply(r.m, [ruby_event, info].concat(r.a)); }
|
130
|
+
else { r.m.$call(ruby_event, info); }
|
131
|
+
};
|
116
132
|
return #{self}.method_refs[#{method_key}];
|
117
133
|
}
|
118
134
|
end
|
data/lib/preact/component/api.rb
CHANGED
@@ -49,6 +49,10 @@ module Preact::Component::Api
|
|
49
49
|
def should_component_update?(&block)
|
50
50
|
`base.should_component_update_block = block`
|
51
51
|
end
|
52
|
+
|
53
|
+
def to_js
|
54
|
+
self.JS[:preact_component]
|
55
|
+
end
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
@@ -96,7 +100,15 @@ module Preact::Component::Api
|
|
96
100
|
%x{
|
97
101
|
if (#@native.method_refs?.[#{method_key}]) { return #@native.method_refs[#{method_key}]; }
|
98
102
|
if (!#@native.method_refs) { #@native.method_refs = {}; }
|
99
|
-
#@native.method_refs[#{method_key}] = { m:
|
103
|
+
#@native.method_refs[#{method_key}] = { m: null, a: args };
|
104
|
+
let r = #@native.method_refs[#{method_key}];
|
105
|
+
let dev = #{Isomorfeus.development?};
|
106
|
+
r.preact_event_handler_function = function(event, info) {
|
107
|
+
let ruby_event = Opal.Preact.native_to_ruby_event(event);
|
108
|
+
if (!r.m || dev) { r.m = #{method(method_symbol)} };
|
109
|
+
if (r.a.length > 0) { r.m.$call.apply(r.m, [ruby_event, info].concat(r.a)); }
|
110
|
+
else { r.m.$call(ruby_event, info); }
|
111
|
+
};
|
100
112
|
return #@native.method_refs[#{method_key}];
|
101
113
|
}
|
102
114
|
end
|
data/lib/preact/version.rb
CHANGED
data/lib/preact.rb
CHANGED
@@ -130,14 +130,7 @@ module Preact
|
|
130
130
|
let ruby_event = self.native_to_ruby_event(event);
|
131
131
|
#{`active_c.__ruby_instance`.instance_exec(`ruby_event`, `info`, &`value`)};
|
132
132
|
}
|
133
|
-
} else if (
|
134
|
-
if (!value.preact_event_handler_function) {
|
135
|
-
value.preact_event_handler_function = function(event, info) {
|
136
|
-
let ruby_event = self.native_to_ruby_event(event);
|
137
|
-
if (value.a.length > 0) { value.m.$call.apply(value.m, [ruby_event, info].concat(value.a)); }
|
138
|
-
else { value.m.$call(ruby_event, info); }
|
139
|
-
};
|
140
|
-
}
|
133
|
+
} else if (typeof value.preact_event_handler_function === "function") {
|
141
134
|
result[self.lower_camelize(key)] = value.preact_event_handler_function;
|
142
135
|
} else if (type === "string" ) {
|
143
136
|
let active_component = self.active_component();
|
@@ -154,12 +147,6 @@ module Preact
|
|
154
147
|
else { method_ref = active_component.__ruby_instance.$method_ref(value); } // create ref for native
|
155
148
|
}
|
156
149
|
if (method_ref) {
|
157
|
-
if (!method_ref.preact_event_handler_function) {
|
158
|
-
method_ref.preact_event_handler_function = function(event, info) {
|
159
|
-
let ruby_event = self.native_to_ruby_event(event);
|
160
|
-
method_ref.m.$call(ruby_event, info)
|
161
|
-
};
|
162
|
-
}
|
163
150
|
result[self.lower_camelize(key)] = method_ref.preact_event_handler_function;
|
164
151
|
} else {
|
165
152
|
let component_name;
|
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: 10.6.
|
4
|
+
version: 10.6.57
|
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-02-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|