glimmer-dsl-opal 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +77 -7
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal.rb +4 -0
- data/lib/glimmer/swt/date_time_proxy.rb +5 -4
- data/lib/glimmer/swt/font_proxy.rb +4 -4
- data/lib/glimmer/swt/table_proxy.rb +4 -10
- data/lib/glimmer/swt/widget_proxy.rb +2 -2
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 267d755e70aa2465ba671e499fcdccb7059de89658f381dafee9480a095e9bf5
|
4
|
+
data.tar.gz: 8b5a6ae6d22fef47f7623755810b47dad3b1b25d6ce76bdadde4f89ec8da976c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3a5a6621c062459650d83f707cc76819ca9c8abfe50c59a1d5b657648453fa2187ee0faabad2090593192304eabd2454ef4ab3f8c27d5658bba4ae4b8f07c2d
|
7
|
+
data.tar.gz: f49a05966c477fb1c38886dc772a50b1f8b9e6249741776a82a3ebc836ec879e8906df2e5c8528246e73b9b349401b3548c97db2af6e42545ece54d6fb334c28
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.7.3
|
4
|
+
|
5
|
+
- Refactor to use to_collection gem
|
6
|
+
- Fix issue with breaking `date`/`date_drop_down` data-binding as table editor on focus lost
|
7
|
+
- Fix issue with requiring OS, File, and Display class after they've been extracted out
|
8
|
+
|
3
9
|
## 0.7.2
|
4
10
|
|
5
11
|
- `date_drop_down` `table_column` `editor`
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
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.7.
|
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.7.3 (Pure Ruby Web GUI)
|
2
2
|
[](http://badge.fury.io/rb/glimmer-dsl-opal)
|
3
3
|
[](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
4
|
|
5
5
|
### You can finally live in pure Ruby land on the web!
|
6
6
|
|
7
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Opal](https://opalrb.com/) is an alpha [gem](https://rubygems.org/gems/glimmer-dsl-opal) that enables building web GUI in pure Ruby via [Opal](https://opalrb.com/) on [Rails](https://rubyonrails.org/).
|
7
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [Opal](https://opalrb.com/) is an **alpha** [gem](https://rubygems.org/gems/glimmer-dsl-opal) that enables building web GUI in pure Ruby via [Opal](https://opalrb.com/) on [Rails](https://rubyonrails.org/).
|
8
8
|
|
9
9
|
Use in one of two ways:
|
10
10
|
- **Direct:** build the GUI of web apps with the same friendly desktop GUI Ruby syntax as [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt), thus requiring a lot less code than web technologies that is in pure Ruby and avoiding opaque web concepts like 'render' and 'reactive'. No HTML/JS/CSS skills are even required. Web designers may be involved with CSS styling only if needed.
|
@@ -20,7 +20,7 @@ Add the following require statement to `app/assets/javascripts/application.rb` i
|
|
20
20
|
require 'glimmer-dsl-opal/samples/elaborate/tic_tac_toe'
|
21
21
|
```
|
22
22
|
|
23
|
-
Glimmer GUI code from [glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb](glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb):
|
23
|
+
Glimmer GUI code from [glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb](lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb):
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
# ...
|
@@ -58,7 +58,7 @@ Tic Tac Toe on the desktop with the same exact code (using the [`glimmer-dsl-swt
|
|
58
58
|

|
59
59
|

|
60
60
|
|
61
|
-
NOTE: Alpha Version 0.7.
|
61
|
+
NOTE: **Alpha Version** 0.7.3 only supports bare-minimum capabilities for the following [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) [samples](https://github.com/AndyObtiva/glimmer#samples):
|
62
62
|
|
63
63
|
Hello:
|
64
64
|
|
@@ -155,7 +155,7 @@ Alternatively, web developers may directly use [Glimmer DSL for Opal](https://ru
|
|
155
155
|
|
156
156
|
## Setup
|
157
157
|
|
158
|
-
(NOTE: if you run into issues, keep in mind this is a very early experimental and incomplete alpha
|
158
|
+
(NOTE: if you run into issues, keep in mind this is a very early experimental and incomplete **alpha**. Also, there is a slight chance any issues you encounter are fixed in master or some other branch that you could check out instead)
|
159
159
|
|
160
160
|
The [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem is a Rails Engine gem that includes assets.
|
161
161
|
|
@@ -179,7 +179,7 @@ Add the following to `Gemfile`:
|
|
179
179
|
gem 'opal-rails', '~> 1.1.2'
|
180
180
|
gem 'opal-async', '~> 1.2.0'
|
181
181
|
gem 'opal-jquery', '~> 0.4.4'
|
182
|
-
gem 'glimmer-dsl-opal', '~> 0.7.
|
182
|
+
gem 'glimmer-dsl-opal', '~> 0.7.3'
|
183
183
|
gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
|
184
184
|
gem 'glimmer-dsl-css', '~> 1.1.0', require: false
|
185
185
|
|
@@ -1539,7 +1539,7 @@ You should see "Hello, Date Time!"
|
|
1539
1539
|
|
1540
1540
|
#### Hello, Table!
|
1541
1541
|
|
1542
|
-
Note: This [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) sample has near-complete support, but is missing table context menus
|
1542
|
+
Note: This [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) sample has near-complete support, but is missing table context menus at the moment.
|
1543
1543
|
|
1544
1544
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
1545
1545
|
|
@@ -1738,23 +1738,28 @@ class HelloTable
|
|
1738
1738
|
text 'Game Date'
|
1739
1739
|
width 150
|
1740
1740
|
sort_property :date # ensure sorting by real date value (not `game_date` string specified in items below)
|
1741
|
+
editor :date_drop_down, property: :date_time
|
1741
1742
|
}
|
1742
1743
|
table_column {
|
1743
1744
|
text 'Game Time'
|
1744
1745
|
width 150
|
1745
1746
|
sort_property :time # ensure sorting by real time value (not `game_time` string specified in items below)
|
1747
|
+
editor :time, property: :date_time
|
1746
1748
|
}
|
1747
1749
|
table_column {
|
1748
1750
|
text 'Ballpark'
|
1749
1751
|
width 180
|
1752
|
+
editor :none
|
1750
1753
|
}
|
1751
1754
|
table_column {
|
1752
1755
|
text 'Home Team'
|
1753
1756
|
width 150
|
1757
|
+
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
|
1754
1758
|
}
|
1755
1759
|
table_column {
|
1756
1760
|
text 'Away Team'
|
1757
1761
|
width 150
|
1762
|
+
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
|
1758
1763
|
}
|
1759
1764
|
table_column {
|
1760
1765
|
text 'Promotion'
|
@@ -1803,6 +1808,39 @@ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObt
|
|
1803
1808
|
|
1804
1809
|

|
1805
1810
|
|
1811
|
+
Hello, Table! Editing Game Date
|
1812
|
+
|
1813
|
+

|
1814
|
+
|
1815
|
+
Hello, Table! Editing Game Time
|
1816
|
+
|
1817
|
+

|
1818
|
+
|
1819
|
+
Hello, Table! Editing Home Team
|
1820
|
+
|
1821
|
+

|
1822
|
+
|
1823
|
+
Hello, Table! Sorted Game Date Ascending
|
1824
|
+
|
1825
|
+

|
1826
|
+
|
1827
|
+
Hello, Table! Sorted Game Date Descending
|
1828
|
+
|
1829
|
+

|
1830
|
+
|
1831
|
+
Hello, Table! Playoff Type Combo
|
1832
|
+
|
1833
|
+

|
1834
|
+
|
1835
|
+
Hello, Table! Playoff Type Changed
|
1836
|
+
|
1837
|
+

|
1838
|
+
|
1839
|
+
Hello, Table! Game Booked
|
1840
|
+
|
1841
|
+

|
1842
|
+
|
1843
|
+
|
1806
1844
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
1807
1845
|
|
1808
1846
|
Start the Rails server:
|
@@ -1816,6 +1854,38 @@ You should see "Hello, Date Time!"
|
|
1816
1854
|
|
1817
1855
|

|
1818
1856
|
|
1857
|
+
Hello, Table! Editing Game Date
|
1858
|
+
|
1859
|
+

|
1860
|
+
|
1861
|
+
Hello, Table! Editing Game Time
|
1862
|
+
|
1863
|
+

|
1864
|
+
|
1865
|
+
Hello, Table! Editing Home Team
|
1866
|
+
|
1867
|
+

|
1868
|
+
|
1869
|
+
Hello, Table! Sorted Game Date Ascending
|
1870
|
+
|
1871
|
+

|
1872
|
+
|
1873
|
+
Hello, Table! Sorted Game Date Descending
|
1874
|
+
|
1875
|
+

|
1876
|
+
|
1877
|
+
Hello, Table! Playoff Type Combo
|
1878
|
+
|
1879
|
+

|
1880
|
+
|
1881
|
+
Hello, Table! Playoff Type Changed
|
1882
|
+
|
1883
|
+

|
1884
|
+
|
1885
|
+
Hello, Table! Game Booked
|
1886
|
+
|
1887
|
+

|
1888
|
+
|
1819
1889
|
### Elaborate Samples
|
1820
1890
|
|
1821
1891
|
#### Login
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
data/lib/glimmer-dsl-opal.rb
CHANGED
@@ -38,6 +38,10 @@ if RUBY_ENGINE == 'opal'
|
|
38
38
|
require 'native' # move this to opal-async
|
39
39
|
require 'opal-async'
|
40
40
|
require 'async/ext'
|
41
|
+
require 'to_collection'
|
42
|
+
require 'os'
|
43
|
+
require 'file'
|
44
|
+
require 'display'
|
41
45
|
require 'glimmer-dsl-opal/vendor/jquery'
|
42
46
|
require 'glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min'
|
43
47
|
require 'glimmer-dsl-opal/vendor/jquery-ui-timepicker/jquery.ui.timepicker'
|
@@ -114,8 +114,8 @@ module Glimmer
|
|
114
114
|
event: 'change',
|
115
115
|
event_handler: -> (event_listener) {
|
116
116
|
-> (event) {
|
117
|
-
if @timepicker_done
|
118
|
-
@timepicker_done = false
|
117
|
+
if date? || (time? && @timepicker_done)
|
118
|
+
@timepicker_done = false if time?
|
119
119
|
event_listener.call(event)
|
120
120
|
end
|
121
121
|
}
|
@@ -127,8 +127,9 @@ module Glimmer
|
|
127
127
|
event: 'blur',
|
128
128
|
event_handler: -> (event_listener) {
|
129
129
|
-> (event) {
|
130
|
-
|
131
|
-
|
130
|
+
# TODO support blur event for date?
|
131
|
+
if time? && @timepicker_done
|
132
|
+
@timepicker_done = false if time?
|
132
133
|
event_listener.call(event)
|
133
134
|
end
|
134
135
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2020 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -68,7 +68,7 @@ module Glimmer
|
|
68
68
|
private
|
69
69
|
|
70
70
|
def detect_invalid_font_property(font_properties)
|
71
|
-
|
71
|
+
font_properties[:style].to_collection(false).select do |style|
|
72
72
|
style.is_a?(Symbol) || style.is_a?(String)
|
73
73
|
end.each do |style|
|
74
74
|
raise Error, style.to_s + ERROR_INVALID_FONT_STYLE if !FONT_STYLES.include?(style.to_sym)
|
@@ -128,9 +128,6 @@ module Glimmer
|
|
128
128
|
on_widget_selected {
|
129
129
|
table_proxy.finish_edit!
|
130
130
|
}
|
131
|
-
on_focus_lost {
|
132
|
-
table_proxy.finish_edit!
|
133
|
-
}
|
134
131
|
on_key_pressed { |key_event|
|
135
132
|
if key_event.keyCode == swt(:cr)
|
136
133
|
table_proxy.finish_edit!
|
@@ -153,9 +150,6 @@ module Glimmer
|
|
153
150
|
on_widget_selected {
|
154
151
|
table_proxy.finish_edit!
|
155
152
|
}
|
156
|
-
on_focus_lost {
|
157
|
-
table_proxy.finish_edit!
|
158
|
-
}
|
159
153
|
on_key_pressed { |key_event|
|
160
154
|
if key_event.keyCode == swt(:cr)
|
161
155
|
table_proxy.finish_edit!
|
@@ -362,7 +356,7 @@ module Glimmer
|
|
362
356
|
end
|
363
357
|
|
364
358
|
def sort_property=(new_sort_property)
|
365
|
-
@sort_property =
|
359
|
+
@sort_property = new_sort_property.to_collection
|
366
360
|
end
|
367
361
|
|
368
362
|
def detect_sort_type
|
@@ -383,7 +377,7 @@ module Glimmer
|
|
383
377
|
|
384
378
|
def column_sort_properties
|
385
379
|
column_properties.zip(columns.map(&:sort_property)).map do |pair|
|
386
|
-
|
380
|
+
pair.compact.last.to_collection
|
387
381
|
end
|
388
382
|
end
|
389
383
|
|
@@ -414,7 +408,7 @@ module Glimmer
|
|
414
408
|
end
|
415
409
|
end
|
416
410
|
|
417
|
-
new_sort_property =
|
411
|
+
new_sort_property = new_sort_property.to_collection unless new_sort_property.is_a?(Array)
|
418
412
|
@sort_direction = @sort_direction.nil? || @sort_property.first != new_sort_property.first || @sort_direction == :descending ? :ascending : :descending
|
419
413
|
|
420
414
|
@sort_property = new_sort_property
|
@@ -520,7 +514,7 @@ module Glimmer
|
|
520
514
|
@edit_mode = true
|
521
515
|
|
522
516
|
editor_config = columns[column_index].editor || editor
|
523
|
-
editor_config =
|
517
|
+
editor_config = editor_config.to_collection
|
524
518
|
editor_widget_options = editor_config.last.is_a?(Hash) ? editor_config.last : {}
|
525
519
|
editor_widget_arg_last_index = editor_config.last.is_a?(Hash) ? -2 : -1
|
526
520
|
editor_widget = (editor_config[0] || :text).to_sym
|
@@ -153,7 +153,7 @@ module Glimmer
|
|
153
153
|
|
154
154
|
def remove_all_listeners
|
155
155
|
effective_observation_request_to_event_mapping.keys.each do |keyword|
|
156
|
-
|
156
|
+
effective_observation_request_to_event_mapping[keyword].to_collection.each do |mapping|
|
157
157
|
observation_requests[keyword].to_a.each do |event_listener|
|
158
158
|
event = mapping[:event]
|
159
159
|
event_handler = mapping[:event_handler]
|
@@ -375,7 +375,7 @@ module Glimmer
|
|
375
375
|
return unless effective_observation_request_to_event_mapping.keys.include?(keyword)
|
376
376
|
event = nil
|
377
377
|
delegate = nil
|
378
|
-
|
378
|
+
effective_observation_request_to_event_mapping[keyword].to_collection.each do |mapping|
|
379
379
|
observation_requests[keyword] ||= Set.new
|
380
380
|
observation_requests[keyword] << event_listener
|
381
381
|
event = mapping[:event]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: to_collection
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: puts_debuggerer
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|