isomorfeus-preact 23.6.0.rc2 → 23.6.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/isomorfeus_preact_ext/preact.c +2 -1
- data/lib/isomorfeus/preact/ssr.rb +3 -9
- data/lib/isomorfeus/preact/thread_local_component_cache.rb +2 -2
- data/lib/isomorfeus/preact/version.rb +1 -1
- data/lib/isomorfeus/preact/view_helper.rb +5 -5
- data/lib/isomorfeus/props/validator.rb +29 -21
- data/lib/isomorfeus/top_level.rb +2 -2
- data/lib/lucid_app.rb +3 -3
- data/lib/lucid_component.rb +5 -5
- data/lib/preact/component_resolution.rb +2 -2
- data/lib/preact/html_elements.rb +3 -3
- data/lib/preact/math_ml_elements.rb +1 -1
- data/lib/preact/module_component_resolution.rb +3 -3
- data/lib/preact/prop_declaration_mixin.rb +7 -7
- data/lib/preact/svg_elements.rb +1 -1
- data/lib/preact.rb +5 -5
- 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: a61c039116e8673a78c483fb45f3bba079776954239f57dc89fa5db3516195f0
|
4
|
+
data.tar.gz: 05b67f5869ccf260b9ad83c26b15edab17a348187ce8b5dc63c9e366d340f169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1906e4349c520ad6537b355c63a095f8013ff41cfaab2cd4cfa900a5f2eb279558e02ee9b25f570d92ac54f0e998ce5806ad4b1d72bb94dd049dce53220da9f5
|
7
|
+
data.tar.gz: bb7885589bed6db17d446051893d9f1b6f7c64678fbe50647537331963ddbc282f3325802c48c1cca92567401d8628ad2e471c9b6419a9bce4d1cf40d9c652ac
|
@@ -277,6 +277,7 @@ void internal_render_to_string(VALUE vnode, VALUE context, VALUE is_svg_mode,
|
|
277
277
|
|
278
278
|
VALUE orig_name_id = name_id;
|
279
279
|
VALUE name_s = rb_id2str(name_id);
|
280
|
+
|
280
281
|
if (rb_reg_match(rUnsafe, name_s) == Qtrue)
|
281
282
|
continue;
|
282
283
|
|
@@ -292,7 +293,7 @@ void internal_render_to_string(VALUE vnode, VALUE context, VALUE is_svg_mode,
|
|
292
293
|
// <textarea value="a&b"> --> <textarea>a&b</textarea>
|
293
294
|
children = value;
|
294
295
|
} else if (value != Qnil && value != Qfalse &&
|
295
|
-
rb_obj_is_proc(value) != Qtrue) {
|
296
|
+
rb_obj_is_proc(value) != Qtrue && rb_obj_is_method(value) != Qtrue) {
|
296
297
|
if (value == Qtrue ||
|
297
298
|
((TYPE(value) == T_STRING) && (RSTRING_PTR(value)[0] == 0))) {
|
298
299
|
// if (name_id == id_class || name_id == id_style) { continue; }
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Isomorfeus
|
2
2
|
class PreactSSR
|
3
|
-
def initialize(component_name, props,
|
4
|
-
@
|
5
|
-
@component_name = component_name
|
3
|
+
def initialize(component_name, props, location, locale)
|
4
|
+
@component = component_name.is_a?(String) ? self.class.const_get(component_name) : component_name
|
6
5
|
@props = props
|
7
6
|
@location = location
|
8
7
|
@locale = locale
|
@@ -25,12 +24,7 @@ module Isomorfeus
|
|
25
24
|
Thread.current[:isomorfeus_user] = c
|
26
25
|
end
|
27
26
|
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def render_component_to_string(component_name, props)
|
32
|
-
component = component_name.is_a?(String) ? self.class.const_get(component_name) : component_name
|
33
|
-
::Preact.render_to_string(::Preact.create_element(component, props))
|
27
|
+
::Preact.render_to_string(::Preact.create_element(@component, @props))
|
34
28
|
end
|
35
29
|
end
|
36
30
|
end
|
@@ -8,8 +8,8 @@ module Isomorfeus
|
|
8
8
|
Thread.current[:local_cache][key]
|
9
9
|
end
|
10
10
|
|
11
|
-
def store(key, rendered_tree, styles,
|
12
|
-
Thread.current[:local_cache][key] = [rendered_tree, styles,
|
11
|
+
def store(key, rendered_tree, styles, status)
|
12
|
+
Thread.current[:local_cache][key] = [rendered_tree, styles, status]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -9,11 +9,11 @@ module Preact
|
|
9
9
|
if !Isomorfeus.development? && !refresh
|
10
10
|
render_result, @_ssr_styles, status = component_cache.fetch(key)
|
11
11
|
Isomorfeus.ssr_response_status = status
|
12
|
-
return render_result
|
12
|
+
return render_result
|
13
13
|
end
|
14
|
-
render_result = mount_component(component_name, props,
|
15
|
-
status = ssr_response_status
|
16
|
-
component_cache.store(key, render_result, ssr_styles,
|
14
|
+
render_result = mount_component(component_name, props, skip_ssr: skip_ssr)
|
15
|
+
status = Isomorfeus.ssr_response_status || 200
|
16
|
+
component_cache.store(key, render_result, ssr_styles, status) if status >= 200 && status < 300
|
17
17
|
render_result
|
18
18
|
end
|
19
19
|
|
@@ -23,7 +23,7 @@ module Preact
|
|
23
23
|
location_host = props[:location_host] ? props[:location_host] : 'localhost'
|
24
24
|
location = "#{props[:location_scheme] || 'http:'}//#{location_host}#{props[:location]}"
|
25
25
|
|
26
|
-
rendered_tree, application_state, @_ssr_styles = Isomorfeus::TopLevel.mount_component(component_name, props,
|
26
|
+
rendered_tree, application_state, @_ssr_styles = Isomorfeus::TopLevel.mount_component(component_name, props, location, locale, skip_ssr)
|
27
27
|
component_name = component_name.to_s unless component_name.is_a?(String)
|
28
28
|
usids = if Isomorfeus.respond_to?(:current_user) && Isomorfeus.current_user && !Isomorfeus.current_user.anonymous?
|
29
29
|
Isomorfeus.current_user.sid.to_s
|
@@ -9,6 +9,7 @@ module Isomorfeus
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def validate!
|
12
|
+
return @v unless @o
|
12
13
|
ensured = ensure!
|
13
14
|
unless ensured
|
14
15
|
set_default_value
|
@@ -24,6 +25,13 @@ module Isomorfeus
|
|
24
25
|
@v
|
25
26
|
end
|
26
27
|
|
28
|
+
def valid_value?
|
29
|
+
validate!
|
30
|
+
true
|
31
|
+
rescue
|
32
|
+
false
|
33
|
+
end
|
34
|
+
|
27
35
|
private
|
28
36
|
|
29
37
|
# basic tests
|
@@ -50,10 +58,10 @@ module Isomorfeus
|
|
50
58
|
when 'Array' then @v.to_a
|
51
59
|
when 'Hash' then @v.to_h
|
52
60
|
else
|
53
|
-
Isomorfeus.raise_error(message: "#{@c}: Dont know how to cast #{@p} to #{cl}!")
|
61
|
+
Isomorfeus.raise_error(error_class: TypeError, message: "#{@c}: Dont know how to cast #{@p} to #{cl}!")
|
54
62
|
end
|
55
63
|
rescue
|
56
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} cast to #{cl} failed!")
|
64
|
+
Isomorfeus.raise_error(error_class: TypeError, message: "#{@c}: #{@p} cast to #{cl} failed!")
|
57
65
|
end
|
58
66
|
end
|
59
67
|
end
|
@@ -75,13 +83,13 @@ module Isomorfeus
|
|
75
83
|
def type!
|
76
84
|
return if @o[:allow_nil] && @v.nil?
|
77
85
|
if @o.key?(:class)
|
78
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} class is not #{@o[:class]}") unless @v.class == @o[:class]
|
86
|
+
Isomorfeus.raise_error(error_class: TypeError, message: "#{@c}: #{@p} class is not #{@o[:class]}") unless @v.class == @o[:class]
|
79
87
|
elsif @o.key?(:is_a)
|
80
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is not a #{@o[:is_a]}") unless @v.is_a?(@o[:is_a])
|
88
|
+
Isomorfeus.raise_error(error_class: TypeError, message: "#{@c}: #{@p} is not a #{@o[:is_a]}") unless @v.is_a?(@o[:is_a])
|
81
89
|
elsif @o.key?(:type)
|
82
90
|
case @o[:type]
|
83
91
|
when :boolean
|
84
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is not a boolean") unless @v.class == TrueClass || @v.class == FalseClass
|
92
|
+
Isomorfeus.raise_error(error_class: TypeError, message: "#{@c}: #{@p} is not a boolean") unless @v.class == TrueClass || @v.class == FalseClass
|
85
93
|
else
|
86
94
|
c_string_sub_types
|
87
95
|
end
|
@@ -101,66 +109,66 @@ module Isomorfeus
|
|
101
109
|
|
102
110
|
# specific validations
|
103
111
|
def c_gt(v)
|
104
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} not greater than #{v}!") unless @v > v
|
112
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} not greater than #{v}!") unless @v > v
|
105
113
|
end
|
106
114
|
|
107
115
|
def c_lt(v)
|
108
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} not less than #{v}!") unless @v < v
|
116
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} not less than #{v}!") unless @v < v
|
109
117
|
end
|
110
118
|
|
111
119
|
def c_keys(v)
|
112
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} keys dont
|
120
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} keys dont match!") unless @v.keys.sort == v.sort
|
113
121
|
end
|
114
122
|
|
115
123
|
def c_size(v)
|
116
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} length/size is not #{v}") unless @v.length == v
|
124
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} length/size is not #{v}") unless @v.length == v
|
117
125
|
end
|
118
126
|
|
119
127
|
def c_matches(v)
|
120
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} does not match #{v}") unless v.match?(@v)
|
128
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} does not match #{v}") unless v.match?(@v)
|
121
129
|
end
|
122
130
|
|
123
131
|
def c_max(v)
|
124
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is larger than #{v}") unless @v <= v
|
132
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is larger than #{v}") unless @v <= v
|
125
133
|
end
|
126
134
|
|
127
135
|
def c_min(v)
|
128
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is smaller than #{v}") unless @v >= v
|
136
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is smaller than #{v}") unless @v >= v
|
129
137
|
end
|
130
138
|
|
131
139
|
def c_max_size(v)
|
132
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is larger than #{v}") unless @v.length <= v
|
140
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is larger than #{v}") unless @v.length <= v
|
133
141
|
end
|
134
142
|
|
135
143
|
def c_min_size(v)
|
136
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is smaller than #{v}") unless @v.length >= v
|
144
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is smaller than #{v}") unless @v.length >= v
|
137
145
|
end
|
138
146
|
|
139
147
|
def c_direction(v)
|
140
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is positive") if v == :negative && @v >= 0
|
141
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is negative") if v == :positive && @v < 0
|
148
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is positive") if v == :negative && @v >= 0
|
149
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is negative") if v == :positive && @v < 0
|
142
150
|
end
|
143
151
|
|
144
152
|
def c_test
|
145
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} test condition check failed") unless @o[:test].call(@v)
|
153
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} test condition check failed") unless @o[:test].call(@v)
|
146
154
|
end
|
147
155
|
|
148
156
|
def c_string_sub_types
|
149
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} must be a String") unless @v.class == String
|
157
|
+
Isomorfeus.raise_error(error_class: TypeError, message: "#{@c}: #{@p} must be a String") unless @v.class == String
|
150
158
|
case @o[:type]
|
151
159
|
when :email
|
152
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is not a valid email address") unless @v.match?(/\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/)
|
160
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is not a valid email address") unless @v.match?(/\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/)
|
153
161
|
when :uri
|
154
162
|
if RUBY_ENGINE == 'opal'
|
155
163
|
%x{
|
156
164
|
try {
|
157
165
|
new URL(#@v);
|
158
166
|
} catch {
|
159
|
-
#{Isomorfeus.raise_error(message: "#{@c}: #{@p} is not a valid uri")}
|
167
|
+
#{Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is not a valid uri")}
|
160
168
|
}
|
161
169
|
}
|
162
170
|
else
|
163
|
-
Isomorfeus.raise_error(message: "#{@c}: #{@p} is not a valid uri") unless @v.match?(/\A#{URI.regexp}\z/)
|
171
|
+
Isomorfeus.raise_error(error_class: ArgumentError, message: "#{@c}: #{@p} is not a valid uri") unless @v.match?(/\A#{URI.regexp}\z/)
|
164
172
|
end
|
165
173
|
end
|
166
174
|
end
|
data/lib/isomorfeus/top_level.rb
CHANGED
@@ -114,8 +114,8 @@ module Isomorfeus
|
|
114
114
|
Isomorfeus.top_component = top
|
115
115
|
end
|
116
116
|
else
|
117
|
-
def mount_component(component, props,
|
118
|
-
rendered_tree = Isomorfeus::PreactSSR.new(component, props,
|
117
|
+
def mount_component(component, props, location, locale, skip_ssr = false)
|
118
|
+
rendered_tree = Isomorfeus::PreactSSR.new(component, props, location, locale).render(skip_ssr)
|
119
119
|
[rendered_tree, Isomorfeus.store.get_state, NanoCSS.instance.renderer[:raw]]
|
120
120
|
end
|
121
121
|
end
|
data/lib/lucid_app.rb
CHANGED
@@ -6,13 +6,13 @@ class LucidApp < LucidComponent
|
|
6
6
|
|
7
7
|
def render(&block)
|
8
8
|
define_method(:render) do
|
9
|
-
pr = Preact.render_buffer
|
9
|
+
pr = ::Preact.render_buffer
|
10
10
|
block_result = _internal_render(pr, &block)
|
11
11
|
children = pr.pop
|
12
|
-
if Preact.is_renderable?(block_result)
|
12
|
+
if ::Preact.is_renderable?(block_result)
|
13
13
|
children << block_result
|
14
14
|
end
|
15
|
-
Preact.create_element(LucidApplicationContext.Provider, state[:_app_ctx], children)
|
15
|
+
::Preact.create_element(::LucidApplicationContext.Provider, state[:_app_ctx], children)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/lib/lucid_component.rb
CHANGED
@@ -82,21 +82,21 @@ class LucidComponent < Preact::Component
|
|
82
82
|
|
83
83
|
def _internal_render(pr, &block)
|
84
84
|
pr << []
|
85
|
-
outer_loading = Isomorfeus.something_loading?
|
85
|
+
outer_loading = ::Isomorfeus.something_loading?
|
86
86
|
ex = nil
|
87
87
|
begin
|
88
88
|
block_result = instance_exec(&block)
|
89
89
|
rescue => e
|
90
90
|
ex = e
|
91
91
|
end
|
92
|
-
if Isomorfeus.something_loading?
|
93
|
-
STDERR.puts "#{@class_name} component still loading ...\n#{ex.message}\n#{ex.backtrace&.join("\n")}" if ex && Isomorfeus.development?
|
92
|
+
if ::Isomorfeus.something_loading?
|
93
|
+
STDERR.puts "#{@class_name} component still loading ...\n#{ex.message}\n#{ex.backtrace&.join("\n")}" if ex && ::Isomorfeus.development?
|
94
94
|
pr[pr.length-1].clear
|
95
|
-
block_result = @while_loading_block ? instance_exec(&@while_loading_block) : Preact.create_element('div')
|
95
|
+
block_result = @while_loading_block ? instance_exec(&@while_loading_block) : ::Preact.create_element('div')
|
96
96
|
elsif ex
|
97
97
|
raise ex
|
98
98
|
end
|
99
|
-
Isomorfeus.something_loading! if outer_loading
|
99
|
+
::Isomorfeus.something_loading! if outer_loading
|
100
100
|
block_result
|
101
101
|
end
|
102
102
|
|
@@ -59,7 +59,7 @@ module Preact::ComponentResolution
|
|
59
59
|
# the full nesting into account
|
60
60
|
constant = nil
|
61
61
|
begin
|
62
|
-
if
|
62
|
+
if !::Isomorfeus.development?
|
63
63
|
@iso_preact_const_cache = {} unless @iso_preact_const_cache
|
64
64
|
constant = @iso_preact_const_cache[component_name]
|
65
65
|
end
|
@@ -74,7 +74,7 @@ module Preact::ComponentResolution
|
|
74
74
|
end
|
75
75
|
|
76
76
|
if constant
|
77
|
-
if
|
77
|
+
if !::Isomorfeus.development? && @iso_preact_const_cache.key?(component_name)
|
78
78
|
@iso_preact_const_cache[component_name] = constant
|
79
79
|
end
|
80
80
|
Preact._render_element(constant, args.last, &block)
|
data/lib/preact/html_elements.rb
CHANGED
@@ -38,7 +38,7 @@ module Preact::HtmlElements
|
|
38
38
|
else
|
39
39
|
SUPPORTED_HTML_ELEMENTS.each do |element|
|
40
40
|
define_method(element.to_s.underscore.upcase.to_sym) do |props = nil, &block|
|
41
|
-
Preact._render_element(element, props, &block)
|
41
|
+
::Preact._render_element(element, props, &block)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -48,11 +48,11 @@ module Preact::HtmlElements
|
|
48
48
|
el = block.call
|
49
49
|
return el if el
|
50
50
|
end
|
51
|
-
Preact.render_buffer.last.pop
|
51
|
+
::Preact.render_buffer.last.pop
|
52
52
|
end
|
53
53
|
|
54
54
|
def RPE(el)
|
55
|
-
Preact.render_buffer.last << el
|
55
|
+
::Preact.render_buffer.last << el
|
56
56
|
nil
|
57
57
|
end
|
58
58
|
end
|
@@ -46,7 +46,7 @@ module Preact::MathMlElements
|
|
46
46
|
else
|
47
47
|
SUPPORTED_MATH_ML_ELEMENTS.each do |element|
|
48
48
|
define_method(element.to_s.underscore.upcase.to_sym) do |props = nil, &block|
|
49
|
-
Preact._render_element(element, props, &block)
|
49
|
+
::Preact._render_element(element, props, &block)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -53,15 +53,15 @@ class Module
|
|
53
53
|
# otherwise pass on method missing
|
54
54
|
c = component_name.to_s[0]
|
55
55
|
if c == c.upcase
|
56
|
-
if
|
56
|
+
if !::Isomorfeus.development?
|
57
57
|
@iso_preact_const_cache = {} unless @iso_preact_const_cache
|
58
58
|
constant = @iso_preact_const_cache[component_name]
|
59
59
|
end
|
60
60
|
unless constant
|
61
61
|
constant = const_get(component_name) rescue nil
|
62
62
|
end
|
63
|
-
if constant && constant.ancestors.include?(Preact::Component)
|
64
|
-
if
|
63
|
+
if constant && constant.respond_to?(:ancestors) && constant.ancestors.include?(::Preact::Component)
|
64
|
+
if !::Isomorfeus.development? && @iso_preact_const_cache.key?(component_name)
|
65
65
|
@iso_preact_const_cache[component_name] = constant
|
66
66
|
end
|
67
67
|
Preact._render_element(constant, args.last, &block)
|
@@ -5,7 +5,7 @@ module Preact
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def prop(prop_name, validate_hash = { required: true })
|
8
|
-
validate_hash = validate_hash.to_h if validate_hash.class == Isomorfeus::Props::ValidateHashProxy
|
8
|
+
validate_hash = validate_hash.to_h if validate_hash.class == ::Isomorfeus::Props::ValidateHashProxy
|
9
9
|
declared_props[prop_name.to_sym] = validate_hash
|
10
10
|
end
|
11
11
|
|
@@ -22,12 +22,12 @@ module Preact
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def validate
|
25
|
-
Isomorfeus::Props::ValidateHashProxy.new
|
25
|
+
::Isomorfeus::Props::ValidateHashProxy.new
|
26
26
|
end
|
27
27
|
|
28
28
|
def validate_prop(prop, value)
|
29
29
|
return false unless declared_props.key?(prop)
|
30
|
-
validator = Isomorfeus::Props::Validator.new(self, prop, value, declared_props[prop])
|
30
|
+
validator = ::Isomorfeus::Props::Validator.new(self, prop, value, declared_props[prop])
|
31
31
|
validator.validate!
|
32
32
|
true
|
33
33
|
end
|
@@ -36,7 +36,7 @@ module Preact
|
|
36
36
|
props = {} unless props
|
37
37
|
declared_props.each_key do |prop|
|
38
38
|
if declared_props[prop].key?(:required) && declared_props[prop][:required] && !props.key?(prop)
|
39
|
-
Isomorfeus.raise_error(message: "Required prop '#{prop}' not given!")
|
39
|
+
::Isomorfeus.raise_error(message: "Required prop '#{prop}' not given!")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
result = true
|
@@ -48,8 +48,8 @@ module Preact
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def validated_prop(prop, value)
|
51
|
-
Isomorfeus.raise_error(message: "No such prop '#{prop}' declared!") unless declared_props.key?(prop)
|
52
|
-
validator = Isomorfeus::Props::Validator.new(self, prop, value, declared_props[prop])
|
51
|
+
::Isomorfeus.raise_error(message: "No such prop '#{prop}' declared!") unless declared_props.key?(prop)
|
52
|
+
validator = ::Isomorfeus::Props::Validator.new(self, prop, value, declared_props[prop])
|
53
53
|
validator.validated_value
|
54
54
|
end
|
55
55
|
|
@@ -58,7 +58,7 @@ module Preact
|
|
58
58
|
|
59
59
|
declared_props.each_key do |prop|
|
60
60
|
if declared_props[prop].key?(:required) && declared_props[prop][:required] && !props.key?(prop)
|
61
|
-
Isomorfeus.raise_error(message: "Required prop '#{prop}' not given!")
|
61
|
+
::Isomorfeus.raise_error(message: "Required prop '#{prop}' not given!")
|
62
62
|
end
|
63
63
|
props[prop] = nil unless props.key?(prop) # let validator handle value
|
64
64
|
end
|
data/lib/preact/svg_elements.rb
CHANGED
@@ -58,7 +58,7 @@ module Preact::SvgElements
|
|
58
58
|
else
|
59
59
|
SUPPORTED_SVG_ELEMENTS.each do |element|
|
60
60
|
define_method(element.to_s.underscore.upcase.to_sym) do |props = nil, &block|
|
61
|
-
Preact._render_element(element, props, &block)
|
61
|
+
::Preact._render_element(element, props, &block)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
data/lib/preact.rb
CHANGED
@@ -1205,11 +1205,10 @@ module Preact
|
|
1205
1205
|
end
|
1206
1206
|
|
1207
1207
|
if block_given?
|
1208
|
-
|
1209
|
-
pr.JS.push([])
|
1208
|
+
`self.render_buffer.push([])`
|
1210
1209
|
block_result = yield
|
1211
|
-
c = pr.JS.pop()
|
1212
1210
|
%x{
|
1211
|
+
const c = self.render_buffer.pop();
|
1213
1212
|
if (self["$is_renderable?"](block_result)) { c.push(block_result); }
|
1214
1213
|
if (c.length > 0) { children = c; }
|
1215
1214
|
}
|
@@ -1229,8 +1228,9 @@ module Preact
|
|
1229
1228
|
|
1230
1229
|
def _render_element(component, props, &block)
|
1231
1230
|
%x{
|
1232
|
-
|
1233
|
-
|
1231
|
+
const opr = self.render_buffer;
|
1232
|
+
if (typeof block === 'function') self.$create_element.$$p = block.$to_proc();
|
1233
|
+
opr[opr.length-1].push(self.$create_element(component, props, nil));
|
1234
1234
|
}
|
1235
1235
|
nil
|
1236
1236
|
end
|
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: 23.6.0.
|
4
|
+
version: 23.6.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -78,28 +78,28 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - '='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 23.6.0.
|
81
|
+
version: 23.6.0.rc4
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - '='
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 23.6.0.
|
88
|
+
version: 23.6.0.rc4
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: isomorfeus-redux
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - '='
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 23.6.0.
|
95
|
+
version: 23.6.0.rc4
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 23.6.0.
|
102
|
+
version: 23.6.0.rc4
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: benchmark-ips
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|