isomorfeus-preact 22.9.0.rc3 → 22.9.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d21e147a89cb2cf3634e110df0fe606184d6b87d4069bdd1c20a6b8242cf11d7
4
- data.tar.gz: e6bc52cb3de1d9058c5a7c260c103f1d09552fefa8508424cf04d4a9721a2227
3
+ metadata.gz: 3bba88069414d8ed45e76c087c9f6bb20006fdea62ac0b4769a7a0838d32a037
4
+ data.tar.gz: 9336d12827cea1fad40fdb178cfe8323758bb4fee4d88c767d7f2249a1e52e13
5
5
  SHA512:
6
- metadata.gz: fcfd20cd641399287821454d0d09c600ed51a660dd0efc949a5d585166c3c9a29794a4fb7e88271fb03d48aabb33109144e7c6912526b7bf49f302e5aa6b63a6
7
- data.tar.gz: a4f55aae16d757584903b3114b77092b8509d759887596681c5935e178f2d1fa2bda97c1ecb8b719adde179bc3a3bebf27916381dce51e85f4b26a0837a10ce1
6
+ metadata.gz: d05800ff4b025c00ea0db26a8e0d463eadcf5811fa95b088b0485f18b311c97c6bdc8483d8af8163404c8326de2a24083b11d9b89cf4692c9d35bb103f4133c3
7
+ data.tar.gz: f58cc4c176ead2e90b7ab0cdfc3af7080a55266b07fb128c796187ccb06b7000aa5be2fdb64d428fe3357d264ff987204616aaf8f368abe91319bc4efd0b7c1d
@@ -28,11 +28,4 @@ module Browser
28
28
  end
29
29
  end
30
30
  end
31
-
32
- module_function
33
-
34
- # @return [Document] the browser's document object
35
- def document
36
- Document
37
- end
38
- end
31
+ end
@@ -1,17 +1,17 @@
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
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
@@ -1,78 +1,78 @@
1
- module Browser
2
- class Element
3
- element :video, :audio do
4
- def buffered
5
- TimeRanges.new(`#@native.buffered`)
6
- end
7
-
8
- def played
9
- TimeRanges.new(`#@native.played`)
10
- end
11
-
12
- def seekable
13
- TimeRanges.new(`#@native.seekable`)
14
- end
15
-
16
- def network_state
17
- case `#@native.networkState`
18
- when `HTMLMediaElement.NETWORK_EMPTY` then :no_data
19
- when `HTMLMediaElement.NETWORK_IDLE` then :idle
20
- when `HTMLMediaElement.NETWORK_LOADING` then :loading
21
- when `HTMLMediaElement.NETWORK_NO_SOURCE` then :no_source
22
- end
23
- end
24
- end
25
-
26
- element :video do
27
- def fullscreen
28
- fullscreen = %w(
29
- requestFullScreen
30
- requestFullscreen
31
- webkitRequestFullScreen
32
- webkitRequestFullscreen
33
- mozRequestFullScreen
34
- msRequestFullscreen
35
- ).find { |prop| `!!#@native[prop]` }
36
-
37
- if fullscreen
38
- `#@native[fullscreen]()`
39
- else
40
- warn "[#{self.class}] Cannot determine the method to full-screen a video"
41
- super
42
- end
43
- end
44
- alias request_fullscreen fullscreen
45
- end
46
-
47
- class TimeRanges
48
- include Enumerable
49
-
50
- def initialize native
51
- @native = native
52
- end
53
-
54
- def to_n
55
- @native
56
- end
57
-
58
- def each
59
- `#@native.length`.times do |i|
60
- yield TimeRange.new(`#@native.start(i)`, `#@native.end(i)`)
61
- end
62
-
63
- self
64
- end
65
- end
66
-
67
- class TimeRange
68
- attr_reader :start, :end
69
-
70
- def initialize start, _end
71
- @start = start
72
- @end = _end
73
- end
74
-
75
- alias begin start
76
- end
77
- end
78
- end
1
+ module Browser
2
+ class Element
3
+ element :video, :audio do
4
+ def buffered
5
+ TimeRanges.new(`#@native.buffered`)
6
+ end
7
+
8
+ def played
9
+ TimeRanges.new(`#@native.played`)
10
+ end
11
+
12
+ def seekable
13
+ TimeRanges.new(`#@native.seekable`)
14
+ end
15
+
16
+ def network_state
17
+ case `#@native.networkState`
18
+ when `HTMLMediaElement.NETWORK_EMPTY` then :no_data
19
+ when `HTMLMediaElement.NETWORK_IDLE` then :idle
20
+ when `HTMLMediaElement.NETWORK_LOADING` then :loading
21
+ when `HTMLMediaElement.NETWORK_NO_SOURCE` then :no_source
22
+ end
23
+ end
24
+ end
25
+
26
+ element :video do
27
+ def fullscreen
28
+ fullscreen = %w(
29
+ requestFullScreen
30
+ requestFullscreen
31
+ webkitRequestFullScreen
32
+ webkitRequestFullscreen
33
+ mozRequestFullScreen
34
+ msRequestFullscreen
35
+ ).find { |prop| `!!#@native[prop]` }
36
+
37
+ if fullscreen
38
+ `#@native[fullscreen]()`
39
+ else
40
+ warn "[#{self.class}] Cannot determine the method to full-screen a video"
41
+ super
42
+ end
43
+ end
44
+ alias request_fullscreen fullscreen
45
+ end
46
+
47
+ class TimeRanges
48
+ include Enumerable
49
+
50
+ def initialize native
51
+ @native = native
52
+ end
53
+
54
+ def to_n
55
+ @native
56
+ end
57
+
58
+ def each
59
+ `#@native.length`.times do |i|
60
+ yield TimeRange.new(`#@native.start(i)`, `#@native.end(i)`)
61
+ end
62
+
63
+ self
64
+ end
65
+ end
66
+
67
+ class TimeRange
68
+ attr_reader :start, :end
69
+
70
+ def initialize start, _end
71
+ @start = start
72
+ @end = _end
73
+ end
74
+
75
+ alias begin start
76
+ end
77
+ end
78
+ end
@@ -1,6 +1,5 @@
1
1
  module Browser
2
2
  autoload :FileList, 'browser/file_list'
3
- autoload :Iterable, 'browser/iterable'
4
3
 
5
4
  # Wrap a native DOM element
6
5
  class Element
@@ -1,39 +1,39 @@
1
- module Browser
2
- module EventTarget
3
- # Add the block as a handler for the specified event name. Will use either
4
- # `addEventListener` or `addListener` if they exist.
5
- #
6
- # @param event_name [String] the name of the event
7
- # @return [Proc] the block to pass to `off` to remove this handler
8
- # @yieldparam event [Browser::Event] the event object
9
- def on event_name, &block
10
- wrapper = proc { |event| block.call Event.new(event) }
11
-
12
- if `#@native.addEventListener !== undefined`
13
- `#@native.addEventListener(event_name, wrapper)`
14
- elsif `#@native.addListener !== undefined`
15
- `#@native.addListener(event_name, wrapper)`
16
- else
17
- warn "[Browser] Not entirely sure how to add an event listener to #{self}"
18
- end
19
-
20
- wrapper
21
- end
22
-
23
- # Remove an event handler
24
- #
25
- # @param event_name [String] the name of the event
26
- # @block the handler to remove, as returned from `on`
27
- def off event_name, &block
28
- if `#@native.removeEventListener !== undefined`
29
- `#@native.removeEventListener(event_name, block)`
30
- elsif `#@native.removeListener !== undefined`
31
- `#@native.removeListener(event_name, block)`
32
- else
33
- warn "[Browser] Not entirely sure how to remove an event listener from #{self}"
34
- end
35
-
36
- nil
37
- end
38
- end
39
- end
1
+ module Browser
2
+ module EventTarget
3
+ # Add the block as a handler for the specified event name. Will use either
4
+ # `addEventListener` or `addListener` if they exist.
5
+ #
6
+ # @param event_name [String] the name of the event
7
+ # @return [Proc] the block to pass to `off` to remove this handler
8
+ # @yieldparam event [Browser::Event] the event object
9
+ def on event_name, &block
10
+ wrapper = proc { |event| block.call Event.new(event) }
11
+
12
+ if `#@native.addEventListener !== undefined`
13
+ `#@native.addEventListener(event_name, wrapper)`
14
+ elsif `#@native.addListener !== undefined`
15
+ `#@native.addListener(event_name, wrapper)`
16
+ else
17
+ warn "[Browser] Not entirely sure how to add an event listener to #{self}"
18
+ end
19
+
20
+ wrapper
21
+ end
22
+
23
+ # Remove an event handler
24
+ #
25
+ # @param event_name [String] the name of the event
26
+ # @block the handler to remove, as returned from `on`
27
+ def off event_name, &block
28
+ if `#@native.removeEventListener !== undefined`
29
+ `#@native.removeEventListener(event_name, block)`
30
+ elsif `#@native.removeListener !== undefined`
31
+ `#@native.removeListener(event_name, block)`
32
+ else
33
+ warn "[Browser] Not entirely sure how to remove an event listener from #{self}"
34
+ end
35
+
36
+ nil
37
+ end
38
+ end
39
+ end
@@ -1,125 +1,125 @@
1
- module Browser
2
- class FileList
3
- include Enumerable
4
-
5
- # @param native [JS] the native FileList object to wrap
6
- def initialize native
7
- @native = `#{native} || []`
8
- @files = length.times.each_with_object([]) { |index, array|
9
- array[index] = File.new(`#@native[index]`)
10
- }
11
- end
12
-
13
- # @param index [Integer] the index of the file in the list
14
- # @return [Browser::FileList::File] the file at the specified index
15
- def [] index
16
- @files[index]
17
- end
18
-
19
- # @return [Integer] the number of files in this list
20
- def length
21
- `#@native.length`
22
- end
23
- alias size length
24
-
25
- # Call the given block for each file in the list
26
- #
27
- # @yieldparam file [Browser::FileList::File]
28
- def each &block
29
- @files.each do |file|
30
- block.call file
31
- end
32
- end
33
-
34
- # Convert this FileList into an array
35
- def to_a
36
- @files.dup # Don't return a value that can mutate our internal state
37
- end
38
- alias to_ary to_a
39
-
40
- # @return [String] a string representation of this FileList
41
- def to_s
42
- @files.to_s
43
- end
44
-
45
- # An individual item in a FileList
46
- class File
47
- attr_reader :data
48
-
49
- # @param native [JS] the native File object to wrap
50
- def initialize native
51
- @native = native
52
- @data = nil
53
- end
54
-
55
- # @return [String] the filename
56
- def name
57
- `#@native.name`
58
- end
59
-
60
- # @return [Integer] the size of this file on disk
61
- def size
62
- `#@native.size`
63
- end
64
-
65
- # @return [String] the MIME type of the file, detected by the browser
66
- def type
67
- `#@native.type`
68
- end
69
-
70
- # @return [Time] the timestamp of the file
71
- def last_modified
72
- `#@native.lastModifiedDate`
73
- end
74
-
75
- # Read the file from disk into memory
76
- #
77
- # @return [Promise] a promise that resolves when finished loading and
78
- # rejects if an error occurs while loading.
79
- def read
80
- promise = Promise.new
81
- reader = FileReader.new
82
- reader.on :load do
83
- result = reader.result
84
-
85
- @data = result
86
- promise.resolve result
87
- end
88
-
89
- reader.on :error do
90
- promise.reject reader.result
91
- end
92
-
93
- reader.read_as_binary_string self
94
-
95
- promise
96
- end
97
-
98
- # Convert to the native object
99
- #
100
- # @return [JS.HTMLElement] the underlying native element
101
- def to_n
102
- @native
103
- end
104
-
105
- # The object that reads the file from disk.
106
- #
107
- # @api private
108
- class FileReader
109
- include EventTarget
110
-
111
- def initialize
112
- @native = `new FileReader()`
113
- end
114
-
115
- def result
116
- `#@native.result`
117
- end
118
-
119
- def read_as_binary_string file
120
- `#@native.readAsBinaryString(#{file.to_n})`
121
- end
122
- end
123
- end
124
- end
125
- end
1
+ module Browser
2
+ class FileList
3
+ include Enumerable
4
+
5
+ # @param native [JS] the native FileList object to wrap
6
+ def initialize native
7
+ @native = `#{native} || []`
8
+ @files = length.times.each_with_object([]) { |index, array|
9
+ array[index] = File.new(`#@native[index]`)
10
+ }
11
+ end
12
+
13
+ # @param index [Integer] the index of the file in the list
14
+ # @return [Browser::FileList::File] the file at the specified index
15
+ def [] index
16
+ @files[index]
17
+ end
18
+
19
+ # @return [Integer] the number of files in this list
20
+ def length
21
+ `#@native.length`
22
+ end
23
+ alias size length
24
+
25
+ # Call the given block for each file in the list
26
+ #
27
+ # @yieldparam file [Browser::FileList::File]
28
+ def each &block
29
+ @files.each do |file|
30
+ block.call file
31
+ end
32
+ end
33
+
34
+ # Convert this FileList into an array
35
+ def to_a
36
+ @files.dup # Don't return a value that can mutate our internal state
37
+ end
38
+ alias to_ary to_a
39
+
40
+ # @return [String] a string representation of this FileList
41
+ def to_s
42
+ @files.to_s
43
+ end
44
+
45
+ # An individual item in a FileList
46
+ class File
47
+ attr_reader :data
48
+
49
+ # @param native [JS] the native File object to wrap
50
+ def initialize native
51
+ @native = native
52
+ @data = nil
53
+ end
54
+
55
+ # @return [String] the filename
56
+ def name
57
+ `#@native.name`
58
+ end
59
+
60
+ # @return [Integer] the size of this file on disk
61
+ def size
62
+ `#@native.size`
63
+ end
64
+
65
+ # @return [String] the MIME type of the file, detected by the browser
66
+ def type
67
+ `#@native.type`
68
+ end
69
+
70
+ # @return [Time] the timestamp of the file
71
+ def last_modified
72
+ `#@native.lastModifiedDate`
73
+ end
74
+
75
+ # Read the file from disk into memory
76
+ #
77
+ # @return [Promise] a promise that resolves when finished loading and
78
+ # rejects if an error occurs while loading.
79
+ def read
80
+ promise = Promise.new
81
+ reader = FileReader.new
82
+ reader.on :load do
83
+ result = reader.result
84
+
85
+ @data = result
86
+ promise.resolve result
87
+ end
88
+
89
+ reader.on :error do
90
+ promise.reject reader.result
91
+ end
92
+
93
+ reader.read_as_binary_string self
94
+
95
+ promise
96
+ end
97
+
98
+ # Convert to the native object
99
+ #
100
+ # @return [JS.HTMLElement] the underlying native element
101
+ def to_n
102
+ @native
103
+ end
104
+
105
+ # The object that reads the file from disk.
106
+ #
107
+ # @api private
108
+ class FileReader
109
+ include EventTarget
110
+
111
+ def initialize
112
+ @native = `new FileReader()`
113
+ end
114
+
115
+ def result
116
+ `#@native.result`
117
+ end
118
+
119
+ def read_as_binary_string file
120
+ `#@native.readAsBinaryString(#{file.to_n})`
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
@@ -56,4 +56,4 @@ module Browser
56
56
  end
57
57
  end
58
58
  end
59
- end
59
+ end
@@ -48,11 +48,4 @@ module Browser
48
48
  `window.scrollTo(x, y)`
49
49
  end
50
50
  end
51
-
52
- module_function
53
-
54
- # return [Window] the browser's Window object
55
- def window
56
- Window
57
- end
58
51
  end
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Preact
3
- VERSION = '22.9.0.rc3'
3
+ VERSION = '22.9.0.rc4'
4
4
  end
5
5
  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: 22.9.0.rc3
4
+ version: 22.9.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: 2022-09-24 00:00:00.000000000 Z
11
+ date: 2022-09-25 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.rc3
61
+ version: 22.9.0.rc4
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.rc3
68
+ version: 22.9.0.rc4
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.rc3
75
+ version: 22.9.0.rc4
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.rc3
82
+ version: 22.9.0.rc4
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: isomorfeus-puppetmaster
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +140,6 @@ files:
140
140
  - lib/browser/event_target.rb
141
141
  - lib/browser/file_list.rb
142
142
  - lib/browser/history.rb
143
- - lib/browser/iterable.rb
144
143
  - lib/browser/location.rb
145
144
  - lib/browser/window.rb
146
145
  - lib/data_uri.rb
@@ -1,15 +0,0 @@
1
- module Browser
2
- class Iterable
3
- include Enumerable
4
-
5
- def initialize js_iterable
6
- @js_iterable = js_iterable
7
- end
8
-
9
- def each
10
- `#@js_iterable.length`.times do |i|
11
- yield `#@js_iterable[i]`
12
- end
13
- end
14
- end
15
- end