glimmer-dsl-opal 0.10.1 → 0.10.2

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: a69a60c500b662de0e458896e7da698a769ed5823c924d591825d3bfd5845605
4
- data.tar.gz: 223e76c5d758d5caecfa9843a491acb23302f9c1f1b3cf592af830bfefa4c114
3
+ metadata.gz: 7e5d23c66c0aec896d96111427221f61325f4239f1f45f4b5115e3a99c922c2c
4
+ data.tar.gz: cc9205606ad7d07b24bc8755190de7a763ae5aff5380d59a6280ff291e0d0d6f
5
5
  SHA512:
6
- metadata.gz: 79b96f5af0774f9bf5e508af1a67aa6a80cb061f818b295b178dd01e65561003fb573b394f5c21fc03440cfb2f834f95260ae03e5558fb1c24ac9261520fa275
7
- data.tar.gz: c9c643cd2043e1a62db4f7487f2c2a7a447b09ebc7f33d8d255c1cb6daf2ed78b19aab3be25f1efef7408df02ca61f757f455b69552b9ec4f8ac9c7e35b97291
6
+ metadata.gz: 7c21c30a8f1c2b2601fa974bb241d1228de285429ea25df542adbb58d94100d27f953925610e21cff6629ffdd821a4084ca3fc6f1528592d0568df51d944abe7
7
+ data.tar.gz: '091ec964115f9672ef746ff7c3a5689df3a5b578acce8d32754c02c8fe193368e41e8113651452b678eb5d0d7d2d688872e79b0a35477219df61ebcf18fc3fd2'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.10.1 (Pure Ruby Web GUI)
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.10.2 (Pure Ruby Web GUI)
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-opal.svg)](http://badge.fury.io/rb/glimmer-dsl-opal)
3
3
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
 
@@ -141,7 +141,7 @@ Hello, Table! Game Booked
141
141
 
142
142
  NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
143
143
 
144
- **Alpha Version** 0.10.1 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
144
+ **Alpha Version** 0.10.2 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
145
145
 
146
146
  Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
147
147
  - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
@@ -151,7 +151,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
151
151
 
152
152
  ## Table of Contents
153
153
 
154
- - [Glimmer DSL for Opal 0.10.1 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0101-pure-ruby-web-gui)
154
+ - [Glimmer DSL for Opal 0.10.2 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0101-pure-ruby-web-gui)
155
155
  - [Principles](#principles)
156
156
  - [Background](#background)
157
157
  - [Pre-requisites](#pre-requisites)
@@ -249,7 +249,7 @@ Add the following to `Gemfile`:
249
249
  gem 'opal-rails', '~> 1.1.2'
250
250
  gem 'opal-async', '~> 1.2.0'
251
251
  gem 'opal-jquery', '~> 0.4.4'
252
- gem 'glimmer-dsl-opal', '~> 0.10.1'
252
+ gem 'glimmer-dsl-opal', '~> 0.10.2'
253
253
  gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
254
254
  gem 'glimmer-dsl-css', '~> 1.1.0', require: false
255
255
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.1
1
+ 0.10.2
@@ -84,7 +84,7 @@ if RUBY_ENGINE == 'opal'
84
84
  Element.alias_native :select
85
85
  Element.alias_native :dialog
86
86
 
87
- # Glimmer::Config.loop_max_count = 20 # TODO disable
87
+ Glimmer::Config.loop_max_count = 10 # TODO disable
88
88
 
89
89
  original_logger_level = Glimmer::Config.logger.level
90
90
  Glimmer::Config.logger = Glimmer::Config::OpalLogger.new(STDOUT)
@@ -68,9 +68,6 @@ module Glimmer
68
68
  @block = block
69
69
  @children = Set.new
70
70
  @enabled = true
71
- # on_widget_selected {
72
- # hide
73
- # }
74
71
  DisplayProxy.instance.opened_dialogs.last&.suspend_event_handling
75
72
  DisplayProxy.instance.dialogs << self
76
73
  @parent.post_initialize_child(self)
@@ -90,7 +87,7 @@ module Glimmer
90
87
  end
91
88
 
92
89
  def open
93
- owned_proc = Glimmer::Util::ProcTracker.new(owner: self) {
90
+ owned_proc = Glimmer::Util::ProcTracker.new(owner: self, invoked_from: :open) {
94
91
  shell.open(async: false) unless shell.open?
95
92
  unless @init
96
93
  dom_element.remove_class('hide')
@@ -64,17 +64,15 @@ module Glimmer
64
64
 
65
65
  def async_exec(proc_tracker = nil, &block)
66
66
  block = proc_tracker unless proc_tracker.nil?
67
- can_open_modal = !modal_open?
68
- return block.call if !can_open_modal && dialog_open? && block.respond_to?(:owner) && !block.owner.nil? && block.owner.is_a?(DialogProxy) && opened_dialogs.last == WidgetProxy.widget_handling_listener&.dialog_ancestor
69
- return block.call if !can_open_modal && block.respond_to?(:owner) && !block.owner.nil? && block.owner.is_a?(MessageBoxProxy)
70
- executer = lambda do
71
- if !modal_open?
72
- block.call
73
- else
74
- Async::Task.new(delay: 100, &executer)
75
- end
67
+ queue = nil # general queue
68
+ if !proc_tracker.nil? && proc_tracker.invoked_from.to_s == 'open' && modal_open? &&
69
+ (
70
+ proc_tracker.owner.is_a?(MessageBoxProxy) ||
71
+ (dialog_open? && proc_tracker.owner.is_a?(DialogProxy) && opened_dialogs.last == WidgetProxy.widget_handling_listener&.dialog_ancestor)
72
+ )
73
+ queue = WidgetProxy.widget_handling_listener
76
74
  end
77
- Async::Task.new(delay: 1, &executer)
75
+ schedule_async_exec(block, queue)
78
76
  end
79
77
  # sync_exec kept for API compatibility reasons
80
78
  alias sync_exec async_exec
@@ -107,6 +105,40 @@ module Glimmer
107
105
  ]
108
106
  }
109
107
  end
108
+
109
+ private
110
+
111
+ def async_exec_queues
112
+ @async_exec_queues ||= {}
113
+ end
114
+
115
+ def async_exec_queue(widget_handling_listener = nil)
116
+ async_exec_queues[widget_handling_listener] ||= []
117
+ end
118
+
119
+ def no_widget_handling_listener_work?
120
+ async_exec_queues.reject {|key, value| key.nil?}.values.reduce(:+).to_a.empty?
121
+ end
122
+
123
+ def schedule_async_exec(block, queue)
124
+ async_exec_queue(queue).unshift(block)
125
+
126
+ # TODO consider the need for locking to avoid race conditions (rare or impossible case)
127
+ if async_exec_queue(queue).size == 1
128
+ executer = lambda do
129
+ # queue could be a widget handling listener queue
130
+ # TODO see if there are more intricate cases of opening a dialog from a widget listener handler
131
+ if !message_box_open? && (!dialog_open? || queue&.dialog_ancestor == opened_dialogs.last) && ((!queue.nil? && async_exec_queues.keys.last == queue) || no_widget_handling_listener_work?)
132
+ block = async_exec_queue(queue).pop
133
+ block.call
134
+ Async::Task.new(delay: 1, &executer) if async_exec_queue(queue).any?
135
+ else
136
+ Async::Task.new(delay: 100, &executer)
137
+ end
138
+ end
139
+ Async::Task.new(delay: 1, &executer)
140
+ end
141
+ end
110
142
  end
111
143
  end
112
144
  end
@@ -74,14 +74,13 @@ module Glimmer
74
74
  i = 0
75
75
  @parent = parent
76
76
  @parent = nil if parent.is_a?(LatestShellProxy)
77
- @parent ||= DisplayProxy.instance.shells.last || ShellProxy.new([])
77
+ @parent ||= DisplayProxy.instance.shells.detect(&:open?) || ShellProxy.new([])
78
78
  @args = args
79
79
  @block = block
80
80
  @children = Set.new
81
81
  @enabled = true
82
82
  on_widget_selected {
83
83
  hide
84
- @open = false
85
84
  }
86
85
  DisplayProxy.instance.message_boxes << self
87
86
  end
@@ -106,7 +105,7 @@ module Glimmer
106
105
 
107
106
  def open
108
107
  shell.open(async: false) unless shell.open?
109
- owned_proc = Glimmer::Util::ProcTracker.new(owner: self) {
108
+ owned_proc = Glimmer::Util::ProcTracker.new(owner: self, invoked_from: :open) {
110
109
  parent.post_initialize_child(self)
111
110
  @open = true
112
111
  }
@@ -115,6 +114,7 @@ module Glimmer
115
114
 
116
115
  def hide
117
116
  dom_element.remove
117
+ @open = false
118
118
  end
119
119
 
120
120
  def content(&block)
@@ -23,12 +23,14 @@ require 'delegate'
23
23
 
24
24
  module Glimmer
25
25
  module Util
26
+ # Decorator that provides tracking facilities for Ruby procs, tracking owner (string), invoked_form method name (symbol/string), and called? (boolean)
26
27
  class ProcTracker < DelegateClass(Proc)
27
- attr_reader :owner
28
+ attr_reader :owner, :invoked_from
28
29
 
29
- def initialize(proc = nil, owner: nil, &block)
30
+ def initialize(proc = nil, owner: nil, invoked_from: nil, &block)
30
31
  super(proc || block)
31
32
  @owner = owner
33
+ @invoked_from = invoked_from
32
34
  end
33
35
 
34
36
  def call(*args)
@@ -41,7 +43,7 @@ module Glimmer
41
43
  end
42
44
 
43
45
  def respond_to?(method, *args, &block)
44
- %w[owner called?].include?(method.to_s) || super(method, *args, &block)
46
+ %w[owner invoked_from called?].include?(method.to_s) || super(method, *args, &block)
45
47
  end
46
48
  end
47
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-15 00:00:00.000000000 Z
11
+ date: 2021-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -242,11 +242,9 @@ email: andy.am@gmail.com
242
242
  executables: []
243
243
  extensions: []
244
244
  extra_rdoc_files:
245
- - CHANGELOG.md
246
245
  - LICENSE.txt
247
246
  - README.md
248
247
  files:
249
- - CHANGELOG.md
250
248
  - LICENSE.txt
251
249
  - README.md
252
250
  - VERSION
@@ -1,217 +0,0 @@
1
- # Change Log
2
-
3
- ## 0.10.1
4
-
5
- - Delaying shell rendering till `#open` method is called as per the right expectation
6
- - When nesting dialogs on top of each other, disable all previously opened ones leaving only the top-most dialog active
7
-
8
- ## 0.10.0
9
-
10
- - Hello, Dialog! Sample
11
- - Support `dialog` widget
12
- - Support `width` and `height` on `layout_data` for `row_layout`
13
- - Support `center` for `row_layout`
14
-
15
- ## 0.9.3
16
-
17
- - Extracted pure Ruby Struct to pure-struct gem (since it's also used by YASL)
18
- - Alpha experimental incomplete implementation of Net::HTTP.post_form
19
- - Fixed issue with not being able to interact with a shell proxy (LatestShellProxy) after opening (made class autoupgradable to attached ShellProxy after document ready)
20
-
21
- ## 0.9.2
22
-
23
- - Fixed issue with opening message_box after internalizing the Document.ready? block
24
- - Fixed issue with replacing newlines with HTML newlines in `label` and `message_box` text
25
-
26
- ## 0.9.1
27
-
28
- - Log errors to error stream ($stderr) instead of standard out (STDOUT)
29
- - Fixed issue with opening shell caused by internalizing the Document.ready? block
30
-
31
- ## 0.9.0
32
-
33
- - Support `menu_bar`
34
- - Hello, Menu Bar! Sample
35
- - Remove the need to call Document.ready? before opening a Glimmer shell
36
- - Support opening a message_box before creating a shell
37
-
38
- ## 0.8.0
39
-
40
- - Hello, Pop Up Context Menu! Sample
41
- - Hello Message Box!
42
- - Update hello list samples
43
- - Support context menus `menu`/`menu_item` directly under a widget (using jQuery UI)
44
- - Support generating new lines when entering `label` `text` with \n (auto-converting to <br />)
45
- - Support generating new lines when entering `message_box` `message` with \n (auto-converting to <br />)
46
- - Support having any widget contribute static CSS to ShellProxy
47
- - Add Kernel#include_package shim to allow running JRuby include_package from Glimmer DSL for SWT without failing
48
- - Add WidgetProxy#swt_widget to allow running include_package from Glimmer DSL for SWT without failing
49
-
50
- ## 0.7.5
51
-
52
- - Update login sample from Glimmer DSL for SWT's latest changes
53
- - Update contact_manager sample from Glimmer DSL for SWT's latest changes
54
- - Fixed issue regarding unavailable localStorage data when accessed by custom_widget_expression in hello_checkbox_group, hello_radio_group, and hello_custom_widget
55
-
56
- ## 0.7.4
57
-
58
- - Hello, Button! Sample
59
- - Fix issue with aligning label as :left, :center, or :right via style style when fill_layout is used
60
- - Fix Hello, Browser sample by accessing https ssl website
61
- - Fix issue with filling space horizontally when using grid layout
62
- - Fix broken embedded `calendar` widget data-binding for hello_date_time.rb sample
63
- - Fix broken message_box after opening multiple shells
64
- - Fix issue with opening custom shells in new tabs/windows when CustomShell subclass is required conditionally
65
-
66
- ## 0.7.3
67
-
68
- - Refactor to use to_collection gem
69
- - Fix issue with breaking `date`/`date_drop_down` data-binding as table editor on focus lost
70
- - Fix issue with requiring OS, File, and Display class after they've been extracted out
71
-
72
- ## 0.7.2
73
-
74
- - `date_drop_down` `table_column` `editor`
75
- - `date` `table_column` `editor`
76
- - `time` `table_column` `editor`
77
- - Implement `on_focus_gained`, `on_focus_lost` universally on all widgets
78
- - Add support for Struct keyword_init to Opal
79
- - Fix issue with hello_table button/combo not being centered (yet stretched)
80
- - Fix issue with table item selection for booking not working after editing has been added
81
- - Fix escape keyboard event handling for combo table editor
82
-
83
- ## 0.7.1
84
-
85
- - Combo table editor (enabled in Hello, Table! sample)
86
- - Fix issue with table cell selection for editing not working
87
- - Remove widget from parent upon dispose
88
- - Remove listeners upon widget dispose
89
-
90
- ## 0.7.0
91
-
92
- - Hello, Table! Sample
93
- - `table` :editable style to enable auto-editing
94
- - `table` `header_visible` property to hide header when false
95
- - `table` `item_count` property to set minimum item count (fill empty rows when below in table items)
96
- - `table` selection data-binding
97
- - `table` built-in sorting support
98
- - `table_column` left text alignment and padding of 5px by default
99
- - `table` sort property and direction in GUI
100
- - `table_column` sort_property
101
- - `table_column` sort_by block
102
- - `table_column` sort block
103
- - `table` default sort via property, compare block, and property block
104
- - `table` additional sort properties
105
- - Prevent `table` unnecessary updates by comparing data to previous data and not updating when it's the same
106
- - Contact Manager sample support for on_key_pressed in text widgets upon hitting ENTER
107
- - Fix issue with edit table item error on sorting table
108
-
109
- ## 0.6.1
110
-
111
- - Fix issue with rendering date_time without a block
112
- - Made listener event handling async to improve performance when triggering multiple events
113
- - Brought Tic Tac Toe sample up-to-date with changes in Glimmer DSL for SWT
114
- - Fixed silent error encountered in rendering custom widgets
115
-
116
- ## 0.6.0
117
-
118
- - Hello, Date Time! Sample
119
- - Support `date_time`, `date`, `date_drop_down`, `time`, `calendar` keywords
120
- - Format Date/Time correctly as per SWT implementation by default
121
- - Make glimmer-dsl-opal gem into a Rails engine to support importing default static assets like CSS styles and images
122
- - Show drop down icon next to `date_drop_down` and `time`
123
-
124
- ## 0.5.1
125
-
126
- - Fixed issue with Hello, Combo!, Hello, List...! samples
127
-
128
- ## 0.5.0
129
-
130
- - Add `margin_top`, `margin_right`, `margin_bottom`, and `margin_left` to RowLayoutProxy
131
- - `radio`
132
- - Hello, Radio! Sample
133
- - `radio_group`
134
- - Hello, Radio Group! Sample
135
- - `checkbox`
136
- - Hello, Checkbox! Sample
137
- - `checkbox_group`
138
- - Fix issue with `label` `alignment` property
139
- - Fix issues with default `composite` `grid_layout` not getting its styles removed when setting `row_layout`
140
- - `button(:radio)` alias for `radio`
141
- - `check` alias for `checkbox`
142
- - `button(:check)` alias for `checkbox`
143
- - Hello, Group! Sample
144
- - Group widget
145
-
146
- ## 0.4.0
147
-
148
- - Support `display` keyword representing an SWT Display
149
- - Support display `on_swt_keydown` event listener (display-wide widget observer)
150
- - Support `DisplayProxy#shells` method keeping track of open shell
151
- - Make a custom shell open in the same window if there is no shell open already
152
- - Support `sync_exec` keyword as just an alias to `async_exec`
153
- - Provide a makeshift require for 'glimmer-dsl-swt' that requires 'glimmer-dsl-opal' instead
154
- - Fake APIs on the web for OS.os?, File.read, Display.setAppName, Display.setAppVersion
155
- - Provide a minimal URI class that supports URI::encode_www_form_component and URI::decode_www_form_component from Ruby
156
-
157
- ## 0.3.0
158
-
159
- - Support opening a custom shell in a browser tab/window by passing in query parameters to URL (e.g. ?custom_shell=keyword+option1=value1 etc...)
160
- - Make custom shells automatically open in a new tab/window (while standard shells continue to open in the same window by replacing its content)
161
- - Hello, Custom Shell! Sample
162
-
163
- ## 0.2.0
164
-
165
- - Color support
166
- - Font support
167
- - Custom Widget Support
168
- - Hello, Custom Widget! sample
169
- - Updated Hello, Combo! sample to match the latest changes in Glimmer DSL for SWT
170
- - `SWT` full re-implementation in Opal as `Glimmer::SWT` with all the `SWT` style constants
171
-
172
- ## 0.1.0
173
-
174
- - Code redesign to better match the glimmer-dsl-swt APIs
175
- - opal-jquery refactoring
176
- - opal-rspec test coverage
177
-
178
- ## 0.0.9
179
-
180
- - Upgraded to glimmer gem v0.9.3
181
- - Fixed issue with missing Glimmer::Opal::ElementProxy#id=(value) method breaking Contact Manager sample Find feature
182
-
183
- ## 0.0.8
184
-
185
- - Contact Manager sample support
186
-
187
- ## 0.0.7
188
-
189
- - Tic Tac Toe sample support
190
- - Login sample support
191
-
192
- ## 0.0.6
193
-
194
- - Hello, Tab! sample support
195
-
196
- ## 0.0.5
197
-
198
- - Hello, Browser! sample support
199
-
200
- ## 0.0.4
201
-
202
- - Hello, List Single Selection! sample support
203
- - Hello, List Multi Selection! sample support
204
-
205
- ## 0.0.3
206
-
207
- - Hello, Computed! sample support
208
-
209
- ## 0.0.2
210
-
211
- - Hello, Combo! sample support
212
-
213
- ## 0.0.1
214
-
215
- - Initial support for webifying Glimmer SWT apps
216
- - Support for Shell and Label widgets (text property only).
217
- - Hello, World! sample support