isomorfeus-react 16.9.24 → 16.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +3 -85
- data/README.md +0 -64
- data/lib/browser/delegate_native.rb +0 -70
- data/lib/browser/element.rb +0 -176
- data/lib/browser/element/canvas.rb +0 -17
- data/lib/browser/element/media.rb +0 -78
- data/lib/browser/event.rb +0 -92
- data/lib/browser/event_target.rb +0 -39
- data/lib/browser/file_list.rb +0 -125
- data/lib/browser/iterable.rb +0 -15
- data/lib/isomorfeus-react-material-ui.rb +0 -10
- data/lib/isomorfeus-react.rb +0 -145
- data/lib/isomorfeus/config.rb +0 -130
- data/lib/isomorfeus/props/validate_hash_proxy.rb +0 -178
- data/lib/isomorfeus/props/validator.rb +0 -131
- data/lib/isomorfeus/react_view_helper.rb +0 -130
- data/lib/isomorfeus/top_level.rb +0 -86
- data/lib/isomorfeus/top_level_ssr.rb +0 -28
- data/lib/lucid_app/api.rb +0 -30
- data/lib/lucid_app/base.rb +0 -7
- data/lib/lucid_app/context.rb +0 -7
- data/lib/lucid_app/mixin.rb +0 -20
- data/lib/lucid_app/native_component_constructor.rb +0 -105
- data/lib/lucid_component/app_store_defaults.rb +0 -36
- data/lib/lucid_component/app_store_proxy.rb +0 -38
- data/lib/lucid_component/base.rb +0 -7
- data/lib/lucid_component/class_store_proxy.rb +0 -41
- data/lib/lucid_component/component_class_store_defaults.rb +0 -38
- data/lib/lucid_component/component_instance_store_defaults.rb +0 -35
- data/lib/lucid_component/event_handler.rb +0 -17
- data/lib/lucid_component/initializer.rb +0 -12
- data/lib/lucid_component/instance_store_proxy.rb +0 -45
- data/lib/lucid_component/mixin.rb +0 -18
- data/lib/lucid_component/native_component_constructor.rb +0 -116
- data/lib/lucid_component/reducers.rb +0 -48
- data/lib/lucid_component/store_api.rb +0 -38
- data/lib/lucid_component/styles_support.rb +0 -37
- data/lib/lucid_material/app/base.rb +0 -9
- data/lib/lucid_material/app/mixin.rb +0 -22
- data/lib/lucid_material/app/native_component_constructor.rb +0 -107
- data/lib/lucid_material/component/base.rb +0 -9
- data/lib/lucid_material/component/mixin.rb +0 -20
- data/lib/lucid_material/component/native_component_constructor.rb +0 -118
- data/lib/lucid_prop_declaration/mixin.rb +0 -91
- data/lib/react.rb +0 -195
- data/lib/react/active_support_support.rb +0 -13
- data/lib/react/children.rb +0 -35
- data/lib/react/component/api.rb +0 -80
- data/lib/react/component/base.rb +0 -9
- data/lib/react/component/callbacks.rb +0 -106
- data/lib/react/component/elements.rb +0 -60
- data/lib/react/component/event_handler.rb +0 -19
- data/lib/react/component/features.rb +0 -47
- data/lib/react/component/history.rb +0 -36
- data/lib/react/component/initializer.rb +0 -11
- data/lib/react/component/location.rb +0 -15
- data/lib/react/component/match.rb +0 -31
- data/lib/react/component/mixin.rb +0 -19
- data/lib/react/component/native_component_constructor.rb +0 -93
- data/lib/react/component/props.rb +0 -59
- data/lib/react/component/resolution.rb +0 -70
- data/lib/react/component/should_component_update.rb +0 -14
- data/lib/react/component/state.rb +0 -52
- data/lib/react/component/styles.rb +0 -27
- data/lib/react/component/unsafe_api.rb +0 -33
- data/lib/react/context_wrapper.rb +0 -46
- data/lib/react/function_component/api.rb +0 -63
- data/lib/react/function_component/base.rb +0 -9
- data/lib/react/function_component/creator.rb +0 -32
- data/lib/react/function_component/event_handler.rb +0 -13
- data/lib/react/function_component/mixin.rb +0 -14
- data/lib/react/function_component/resolution.rb +0 -62
- data/lib/react/memo_component/base.rb +0 -9
- data/lib/react/memo_component/creator.rb +0 -32
- data/lib/react/memo_component/mixin.rb +0 -14
- data/lib/react/native_constant_wrapper.rb +0 -26
- data/lib/react/pure_component/base.rb +0 -9
- data/lib/react/pure_component/mixin.rb +0 -18
- data/lib/react/ref.rb +0 -13
- data/lib/react/synthetic_event.rb +0 -53
- data/lib/react/version.rb +0 -3
- data/lib/react_dom.rb +0 -47
- data/lib/react_dom_server.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed204f4b128a4296d4020a328a82236818c7903a650b9053f4a874e96d44d10
|
4
|
+
data.tar.gz: 94171afa5509ae6f9aa08c3697d925a997efb9cd2c23b2cf5a5a11a1c06d477b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2570138f724adf2d0c9879dcc0bfd11e54a762b771202ef7391257b5ce138294371885a8423764cb487c23b1b4e814ac193e300204f7a48505d317e4b318fb93
|
7
|
+
data.tar.gz: 21e74ad6c96774fd4205d432b64bcf356ba6023f64f47141b9524abf77a238abc66d53f9cd70d88e3336027d55e2fad3921d4524bab3af5ab7708ef4689bd2f2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.
|
4
|
+
version: 16.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -156,89 +156,7 @@ email:
|
|
156
156
|
executables: []
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
|
-
files:
|
160
|
-
- README.md
|
161
|
-
- lib/browser/delegate_native.rb
|
162
|
-
- lib/browser/element.rb
|
163
|
-
- lib/browser/element/canvas.rb
|
164
|
-
- lib/browser/element/media.rb
|
165
|
-
- lib/browser/event.rb
|
166
|
-
- lib/browser/event_target.rb
|
167
|
-
- lib/browser/file_list.rb
|
168
|
-
- lib/browser/iterable.rb
|
169
|
-
- lib/isomorfeus-react-material-ui.rb
|
170
|
-
- lib/isomorfeus-react.rb
|
171
|
-
- lib/isomorfeus/config.rb
|
172
|
-
- lib/isomorfeus/props/validate_hash_proxy.rb
|
173
|
-
- lib/isomorfeus/props/validator.rb
|
174
|
-
- lib/isomorfeus/react_view_helper.rb
|
175
|
-
- lib/isomorfeus/top_level.rb
|
176
|
-
- lib/isomorfeus/top_level_ssr.rb
|
177
|
-
- lib/lucid_app/api.rb
|
178
|
-
- lib/lucid_app/base.rb
|
179
|
-
- lib/lucid_app/context.rb
|
180
|
-
- lib/lucid_app/mixin.rb
|
181
|
-
- lib/lucid_app/native_component_constructor.rb
|
182
|
-
- lib/lucid_component/app_store_defaults.rb
|
183
|
-
- lib/lucid_component/app_store_proxy.rb
|
184
|
-
- lib/lucid_component/base.rb
|
185
|
-
- lib/lucid_component/class_store_proxy.rb
|
186
|
-
- lib/lucid_component/component_class_store_defaults.rb
|
187
|
-
- lib/lucid_component/component_instance_store_defaults.rb
|
188
|
-
- lib/lucid_component/event_handler.rb
|
189
|
-
- lib/lucid_component/initializer.rb
|
190
|
-
- lib/lucid_component/instance_store_proxy.rb
|
191
|
-
- lib/lucid_component/mixin.rb
|
192
|
-
- lib/lucid_component/native_component_constructor.rb
|
193
|
-
- lib/lucid_component/reducers.rb
|
194
|
-
- lib/lucid_component/store_api.rb
|
195
|
-
- lib/lucid_component/styles_support.rb
|
196
|
-
- lib/lucid_material/app/base.rb
|
197
|
-
- lib/lucid_material/app/mixin.rb
|
198
|
-
- lib/lucid_material/app/native_component_constructor.rb
|
199
|
-
- lib/lucid_material/component/base.rb
|
200
|
-
- lib/lucid_material/component/mixin.rb
|
201
|
-
- lib/lucid_material/component/native_component_constructor.rb
|
202
|
-
- lib/lucid_prop_declaration/mixin.rb
|
203
|
-
- lib/react.rb
|
204
|
-
- lib/react/active_support_support.rb
|
205
|
-
- lib/react/children.rb
|
206
|
-
- lib/react/component/api.rb
|
207
|
-
- lib/react/component/base.rb
|
208
|
-
- lib/react/component/callbacks.rb
|
209
|
-
- lib/react/component/elements.rb
|
210
|
-
- lib/react/component/event_handler.rb
|
211
|
-
- lib/react/component/features.rb
|
212
|
-
- lib/react/component/history.rb
|
213
|
-
- lib/react/component/initializer.rb
|
214
|
-
- lib/react/component/location.rb
|
215
|
-
- lib/react/component/match.rb
|
216
|
-
- lib/react/component/mixin.rb
|
217
|
-
- lib/react/component/native_component_constructor.rb
|
218
|
-
- lib/react/component/props.rb
|
219
|
-
- lib/react/component/resolution.rb
|
220
|
-
- lib/react/component/should_component_update.rb
|
221
|
-
- lib/react/component/state.rb
|
222
|
-
- lib/react/component/styles.rb
|
223
|
-
- lib/react/component/unsafe_api.rb
|
224
|
-
- lib/react/context_wrapper.rb
|
225
|
-
- lib/react/function_component/api.rb
|
226
|
-
- lib/react/function_component/base.rb
|
227
|
-
- lib/react/function_component/creator.rb
|
228
|
-
- lib/react/function_component/event_handler.rb
|
229
|
-
- lib/react/function_component/mixin.rb
|
230
|
-
- lib/react/function_component/resolution.rb
|
231
|
-
- lib/react/memo_component/base.rb
|
232
|
-
- lib/react/memo_component/creator.rb
|
233
|
-
- lib/react/memo_component/mixin.rb
|
234
|
-
- lib/react/native_constant_wrapper.rb
|
235
|
-
- lib/react/pure_component/base.rb
|
236
|
-
- lib/react/pure_component/mixin.rb
|
237
|
-
- lib/react/ref.rb
|
238
|
-
- lib/react/synthetic_event.rb
|
239
|
-
- lib/react/version.rb
|
240
|
-
- lib/react_dom.rb
|
241
|
-
- lib/react_dom_server.rb
|
159
|
+
files: []
|
242
160
|
homepage: http://isomorfeus.com
|
243
161
|
licenses:
|
244
162
|
- MIT
|
data/README.md
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# isomorfeus-react
|
2
|
-
|
3
|
-
Develop React components for Opal Ruby along with very easy to use and advanced React-Redux Components.
|
4
|
-
|
5
|
-
## Community and Support
|
6
|
-
At the [Isomorfeus Framework Project](http://isomorfeus.com)
|
7
|
-
|
8
|
-
## Versioning
|
9
|
-
isomorfeus-react version follows the React version which features and API it implements.
|
10
|
-
Isomorfeus-react 16.8.x implements features and the API of React 16.8 and should be used with React 16.8
|
11
|
-
|
12
|
-
## Documentation
|
13
|
-
|
14
|
-
- [Installation](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/installation.md)
|
15
|
-
|
16
|
-
Because isomorfeus-react follows closely the React principles/implementation/API and Documentation, most things of the official React documentation
|
17
|
-
apply, but in the Ruby way, see:
|
18
|
-
- https://reactjs.org/docs/getting-started.html
|
19
|
-
|
20
|
-
Component Types:
|
21
|
-
- [Class Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/class_component.md)
|
22
|
-
- [Pure Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/pure_component.md)
|
23
|
-
- [Function and Memo Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/function_component.md)
|
24
|
-
- [Lucid App, Lucid Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/lucid_component.md)
|
25
|
-
- [LucidMaterial App, LucidMaterial Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/lucid_material_component.md) - support for [MaterialUI](https://material-ui.com)
|
26
|
-
- [React Javascript Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/javascript_component.md)
|
27
|
-
|
28
|
-
Which component to use?
|
29
|
-
- Usually LucidApp and LucidComponent along with some imported javascript components.
|
30
|
-
|
31
|
-
Specific to Class, Pure, Lucid and LucidMaterial Components:
|
32
|
-
- [Events](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/events.md)
|
33
|
-
- [Lifecycle Callbacks](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/lifecycle_callbacks.md)
|
34
|
-
- [Props](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/props.md)
|
35
|
-
- [State](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/state.md)
|
36
|
-
|
37
|
-
For all Components:
|
38
|
-
- [Accessibility](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/accessibility.md)
|
39
|
-
- [Render Blocks](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/render_blocks.md)
|
40
|
-
- [Rendering HTML or SVG Elements](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/rendering_elements.md)
|
41
|
-
|
42
|
-
Special React Features:
|
43
|
-
- [Context](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/context.md)
|
44
|
-
- [Fragments](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/fragments.md)
|
45
|
-
- [Portals](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/portals.md)
|
46
|
-
- [Refs](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/refs.md)
|
47
|
-
- [StrictMode](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/strict_mode.md)
|
48
|
-
|
49
|
-
Other Features:
|
50
|
-
- [Code Splitting and Lazy Loading](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/code_splitting_lazy_loading.md)
|
51
|
-
- [Hot Module Reloading](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/hot_module_relaoding.md)
|
52
|
-
- [Server Side Rendering](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/server_side_rendering.md)
|
53
|
-
- [Using React Router](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/react_router.md)
|
54
|
-
- [Isomorfeus Helpers](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/isomorfeus_helpers.md)
|
55
|
-
- [Reducing Asset Size](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/reducing_asset_size.md)
|
56
|
-
|
57
|
-
### Development Tools
|
58
|
-
The React Developer Tools allow for analyzing, debugging and profiling components. A very helpful toolset and working very nice with isomorfeus-react:
|
59
|
-
https://github.com/facebook/react-devtools
|
60
|
-
|
61
|
-
### Specs and Benchmarks
|
62
|
-
- clone repo
|
63
|
-
- `bundle install`
|
64
|
-
- `rake`
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module Browser
|
2
|
-
module DelegateNative
|
3
|
-
# Provides a default initializer. This should be overridden in all but the
|
4
|
-
# simplest cases.
|
5
|
-
def initialize native
|
6
|
-
@native = native
|
7
|
-
end
|
8
|
-
|
9
|
-
# Fall back to native properties. If the message sent to this element is not
|
10
|
-
# recognized, it checks to see if it is a property of the native element. It
|
11
|
-
# also checks for variations of the message name, such as:
|
12
|
-
#
|
13
|
-
# :supported? => [:supported, :isSupported]
|
14
|
-
#
|
15
|
-
# If a property with the specified message name is found and it is a
|
16
|
-
# function, that function is invoked with `args`. Otherwise, the property
|
17
|
-
# is returned as is.
|
18
|
-
def method_missing message, *args, &block
|
19
|
-
property_name = property_for_message(message)
|
20
|
-
property = `#@native[#{property_name}]`
|
21
|
-
|
22
|
-
# translate setting a property
|
23
|
-
if message.end_with? '='
|
24
|
-
return `#@native[#{property_name}] = args[0]`
|
25
|
-
end
|
26
|
-
|
27
|
-
# If the native element doesn't have this property, bubble it up
|
28
|
-
super unless `#{property_name} in #@native`
|
29
|
-
|
30
|
-
if `property === false`
|
31
|
-
return false
|
32
|
-
elsif `typeof(property) === 'number' && isNaN(property)`
|
33
|
-
return nil
|
34
|
-
else
|
35
|
-
property = `property == null ? nil : property`
|
36
|
-
end
|
37
|
-
|
38
|
-
# If it's a method, call it. Otherwise, return it.
|
39
|
-
if `typeof(property) === 'function'`
|
40
|
-
`property.apply(#@native, args)`
|
41
|
-
else
|
42
|
-
property
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def respond_to_missing? message, include_all
|
47
|
-
return true if message.end_with? '='
|
48
|
-
return true if property_for_message(message)
|
49
|
-
|
50
|
-
false
|
51
|
-
end
|
52
|
-
|
53
|
-
def property_for_message message
|
54
|
-
camel_cased_message = message
|
55
|
-
.gsub(/_\w/) { |match| `match[1]`.upcase }
|
56
|
-
.sub(/=$/, '')
|
57
|
-
|
58
|
-
# translate `supported?` to `supported` or `isSupported`
|
59
|
-
if message.end_with? '?'
|
60
|
-
camel_cased_message = camel_cased_message.chop
|
61
|
-
property_type = `typeof(#@native[camel_cased_message])`
|
62
|
-
if property_type == 'undefined'
|
63
|
-
camel_cased_message = "is#{camel_cased_message[0].upcase}#{camel_cased_message[1..-1]}"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
camel_cased_message
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
data/lib/browser/element.rb
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
module Browser
|
2
|
-
autoload :FileList, 'browser/file_list'
|
3
|
-
autoload :Iterable, 'browser/iterable'
|
4
|
-
|
5
|
-
# Wrap a native DOM element
|
6
|
-
class Element
|
7
|
-
include EventTarget
|
8
|
-
include DelegateNative
|
9
|
-
|
10
|
-
@tags = Hash.new(self)
|
11
|
-
|
12
|
-
def self.element *tags, &block
|
13
|
-
tags.each do |tag|
|
14
|
-
@tags
|
15
|
-
.fetch(tag) { @tags[tag] = const_set(tag.capitalize, Class.new(self)) }
|
16
|
-
.class_exec(&block)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.new(native)
|
21
|
-
element = @tags[`(#{native}.tagName || '')`.downcase].allocate
|
22
|
-
element.initialize native
|
23
|
-
element
|
24
|
-
end
|
25
|
-
|
26
|
-
# @param native [JS] The native DOM element to wrap
|
27
|
-
def initialize native
|
28
|
-
@native = native
|
29
|
-
end
|
30
|
-
|
31
|
-
# Replace all child elements with the given element
|
32
|
-
#
|
33
|
-
# @param element [Browser::Element] The Browser element with which to replace
|
34
|
-
# this element's contents
|
35
|
-
def inner_dom= element
|
36
|
-
clear
|
37
|
-
append element
|
38
|
-
end
|
39
|
-
|
40
|
-
# The contents of this element as an HTML string
|
41
|
-
#
|
42
|
-
# @return [String] the HTML representation of this element's contents
|
43
|
-
def inner_html
|
44
|
-
`#@native.innerHTML`
|
45
|
-
end
|
46
|
-
|
47
|
-
# Use the supplied HTML string to replace this element's contents
|
48
|
-
#
|
49
|
-
# @param html [String] the HTML with which to replace this elements contents
|
50
|
-
def inner_html= html
|
51
|
-
`#@native.innerHTML = html`
|
52
|
-
end
|
53
|
-
|
54
|
-
# This element's direct child elements
|
55
|
-
#
|
56
|
-
# @return [Array<Browser::Element>] list of this element's children
|
57
|
-
def children
|
58
|
-
elements = []
|
59
|
-
|
60
|
-
%x{
|
61
|
-
var children = #@native.children;
|
62
|
-
for(var i = 0; i < children.length; i++) {
|
63
|
-
elements[i] = #{Element.new(`children[i]`)};
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
elements
|
68
|
-
end
|
69
|
-
|
70
|
-
# Determine whether this element has any contents
|
71
|
-
#
|
72
|
-
# @return [Boolean] true if the element has no children, false otherwise
|
73
|
-
def empty?
|
74
|
-
`#@native.children.length === 0`
|
75
|
-
end
|
76
|
-
|
77
|
-
# Remove all contents from this element. After this call, `empty?` will
|
78
|
-
# return `true`.
|
79
|
-
#
|
80
|
-
# @return [Browser::Element] self
|
81
|
-
def clear
|
82
|
-
if %w(input textarea).include? type
|
83
|
-
`#@native.value = null`
|
84
|
-
else
|
85
|
-
children.each do |child|
|
86
|
-
remove_child child
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
self
|
91
|
-
end
|
92
|
-
|
93
|
-
# Remove the specified child element
|
94
|
-
#
|
95
|
-
# @param child [Browser::Element] the child element to remove
|
96
|
-
def remove_child child
|
97
|
-
`#@native.removeChild(child['native'] ? child['native'] : child)`
|
98
|
-
end
|
99
|
-
|
100
|
-
# This element's type. For example: "div", "span", "p"
|
101
|
-
#
|
102
|
-
# @return [String] the HTML tag name for this element
|
103
|
-
def type
|
104
|
-
`#@native.nodeName`.downcase
|
105
|
-
end
|
106
|
-
|
107
|
-
# Append the specified element as a child element
|
108
|
-
#
|
109
|
-
# @param element [Browser::Element, JS] the element to insert
|
110
|
-
def append node
|
111
|
-
`#@native.appendChild(node['native'] ? node['native'] : node)`
|
112
|
-
self
|
113
|
-
end
|
114
|
-
|
115
|
-
# Methods for <input /> elements
|
116
|
-
|
117
|
-
# A checkbox's checked status
|
118
|
-
#
|
119
|
-
# @return [Boolean] true if the checkbox is checked, false otherwise
|
120
|
-
def checked?
|
121
|
-
`!!#@native.checked`
|
122
|
-
end
|
123
|
-
|
124
|
-
# Get the currently selected file for this input. This is only useful for
|
125
|
-
# file inputs without the `multiple` property set.
|
126
|
-
#
|
127
|
-
# @return [Browser::File] the file selected by the user
|
128
|
-
def file
|
129
|
-
files.first
|
130
|
-
end
|
131
|
-
|
132
|
-
# Get the currently selected files for this input. This is only useful for
|
133
|
-
# file inputs with the `multiple` property set.
|
134
|
-
#
|
135
|
-
# @return [Browser::FileList] the currently selected files for this input
|
136
|
-
def files
|
137
|
-
FileList.new(`#@native.files`)
|
138
|
-
end
|
139
|
-
|
140
|
-
# Determine whether this is the same element
|
141
|
-
#
|
142
|
-
# @return [boolean] true if the element is the same, false otherwise
|
143
|
-
def ==(other)
|
144
|
-
`#@native === #{other.to_n}`
|
145
|
-
end
|
146
|
-
|
147
|
-
# Set the specified attribute to the specified value
|
148
|
-
def []= attribute, value
|
149
|
-
`#@native.setAttribute(#{attribute}, #{value})`
|
150
|
-
end
|
151
|
-
|
152
|
-
# Return the specified attribute
|
153
|
-
#
|
154
|
-
# @return [String] the value for the specified attribute
|
155
|
-
def [] attribute
|
156
|
-
`#@native.getAttribute(#{attribute})`
|
157
|
-
end
|
158
|
-
|
159
|
-
def query_selector selector
|
160
|
-
result = super
|
161
|
-
|
162
|
-
Element.new(result) if result
|
163
|
-
end
|
164
|
-
|
165
|
-
def query_selector_all selector
|
166
|
-
Iterable.new(super).map { |element| Element.new(element) }
|
167
|
-
end
|
168
|
-
|
169
|
-
# The native representation of this element.
|
170
|
-
#
|
171
|
-
# @return [JS] the native element wrapped by this object.
|
172
|
-
def to_n
|
173
|
-
@native
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Browser
|
2
|
-
class Element
|
3
|
-
element :canvas do
|
4
|
-
def context(type='2d')
|
5
|
-
Context.new(`#@native.getContext(#{type})`)
|
6
|
-
end
|
7
|
-
|
8
|
-
class Context
|
9
|
-
include DelegateNative
|
10
|
-
|
11
|
-
def initialize native
|
12
|
-
@native = native
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|