glimmer-dsl-opal 0.16.0 → 0.16.1

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: f8072dfb955151aa374817c0f2f175bf9c7adfd115eca1bbd6df6c2c3b0725e4
4
- data.tar.gz: 94304037d23dfe1719087fc93d3dc9056be7701f6fdac1044bfe2719e61e43b0
3
+ metadata.gz: e2ee052273513ff79b9d9ef0f351f30bfa0c4083f589429646b894b132afa4c3
4
+ data.tar.gz: f2a9113b2a92168046d19c3068d9b62df1000fdc1dd6c9ea5f168ffb89123fb4
5
5
  SHA512:
6
- metadata.gz: 7f85477240562b1eb7c3bfb3e147577bf6ac7f265c54b6d5acad7ae295a65b1226ff41798eb2a8d41804d2c56d999992f6e6e98b64bde1bed5708c52c46862f0
7
- data.tar.gz: 847b86e900e53586993c74982b37d68ede27f399982188187de524dec31b1d5ffdf0ffc31694da38510060f3e5224c71acc7ca85d75fdef398a8e42c287ca666
6
+ metadata.gz: 20edcc6d97dbee21a5b8b332bc649fb0f7d77f93e41d02095cdbbed43f0686f8c1dd5bf08972bd21511cb983f77caf247f61136ddde5de859f444ac92f31dbf2
7
+ data.tar.gz: ce7347775105f4b2af132cd68b4a805332b4afe910cb3ff91c0da083bd043e93cf067c693c9e4a54b506c2417d684248d23fa78aecccc264c741c38028b35b6e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.16.1
4
+
5
+ - Support GridLayout make_columns_equal_width, horizontal_spacing, and vertical_spacing attributes
6
+ - Hello, Composite! sample
7
+
3
8
  ## 0.16.0
4
9
 
5
10
  - Support label widget background_image attribute
data/README.md CHANGED
@@ -163,6 +163,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
163
163
  - [Hello Samples](#hello-samples)
164
164
  - [Hello, World!](#hello-world)
165
165
  - [Hello, Combo!](#hello-combo)
166
+ - [Hello, Composite!](#hello-composite)
166
167
  - [Hello, Computed!](#hello-computed)
167
168
  - [Hello, List Single Selection!](#hello-list-single-selection)
168
169
  - [Hello, List Multi Selection!](#hello-list-multi-selection)
@@ -223,7 +224,8 @@ Alternatively, web developers may directly use [Glimmer DSL for Opal](https://ru
223
224
  ## Pre-requisites
224
225
 
225
226
  - Rails 5: [https://github.com/rails/rails/tree/5-2-stable](https://github.com/rails/rails/tree/5-2-stable)
226
- - Opal 1: [https://github.com/opal/opal-rails](https://github.com/opal/opal-rails)
227
+ - Opal 1.0.4: [https://github.com/opal/opal](https://github.com/opal/opal)
228
+ - Opal-Rails 1.1.2: [https://github.com/opal/opal-rails](https://github.com/opal/opal-rails)
227
229
  - jQuery 3: [https://code.jquery.com/](https://code.jquery.com/) (jQuery 3.5.1 is included in the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem)
228
230
  - jQuery-UI 1.12: [https://code.jquery.com/](https://jqueryui.com/) (jQuery-UI 1.12.1 is included in the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem)
229
231
  - jQuery-UI Timepicker 0.3: [https://code.jquery.com/](https://fgelinas.com/code/timepicker/) (jQuery-UI Timepicker 0.3.3 is included in the [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal) gem)
@@ -251,7 +253,8 @@ rails new glimmer_app_server
251
253
  Add the following to `Gemfile`:
252
254
 
253
255
  ```
254
- gem 'opal-rails', '~> 1.1.2'
256
+ gem 'opal', '1.0.4'
257
+ gem 'opal-rails', '1.1.2'
255
258
  gem 'opal-async', '~> 1.2.0'
256
259
  gem 'opal-jquery', '~> 0.4.4'
257
260
  gem 'glimmer-dsl-opal', '~> 0.16.0'
@@ -490,7 +493,7 @@ HelloCombo.launch
490
493
  ```
491
494
  Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
492
495
 
493
- ![Glimmer DSL for SWT Hello Combo](https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-hello-combo.png)
496
+ ![Glimmer DSL for SWT Hello Combo](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/images/glimmer-hello-combo.png)
494
497
 
495
498
  Glimmer app on the web (using `glimmer-dsl-opal` gem):
496
499
 
@@ -505,6 +508,31 @@ You should see "Hello, Combo!"
505
508
 
506
509
  ![Glimmer DSL for Opal Hello Combo](images/glimmer-dsl-opal-hello-combo.png)
507
510
 
511
+ #### Hello, Composite!
512
+
513
+ Add the following require statement to `app/assets/javascripts/application.rb`
514
+
515
+ ```ruby
516
+ require 'glimmer-dsl-opal/samples/hello/hello_composite'
517
+ ```
518
+
519
+ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
520
+
521
+ ![Glimmer DSL for SWT Hello Composite](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/images/glimmer-hello-composite.png)
522
+
523
+ Glimmer app on the web (using `glimmer-dsl-opal` gem):
524
+
525
+ Start the Rails server:
526
+ ```
527
+ rails s
528
+ ```
529
+
530
+ Visit `http://localhost:3000`
531
+
532
+ You should see "Hello, Composite!"
533
+
534
+ ![Glimmer DSL for Opal Hello Composite](images/glimmer-dsl-opal-hello-composite.png)
535
+
508
536
  #### Hello, Computed!
509
537
 
510
538
  Add the following require statement to `app/assets/javascripts/application.rb`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.0
1
+ 0.16.1
@@ -0,0 +1,69 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class HelloComposite
23
+ include Glimmer::UI::CustomShell
24
+
25
+ body {
26
+ shell {
27
+ # shell (which is a composite) has fill_layout(:horizontal) by default with no margins
28
+ # we override below
29
+ fill_layout(:vertical)
30
+ text 'Hello, Composite!'
31
+
32
+ composite { # composite simply contains widgets for visual organization via a layout
33
+ # it has grid_layout(1, false) as its default layout
34
+ label {
35
+ text "Field is above its text widget"
36
+ }
37
+ text {
38
+ layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
39
+ }
40
+ }
41
+
42
+ composite { # composite simply contains widgets for visual organization via a layout
43
+ grid_layout 2, true
44
+
45
+ label {
46
+ text "Field has equal width to its text widget's"
47
+ }
48
+ text {
49
+ layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
50
+ }
51
+ }
52
+
53
+ composite { # composite simply contains widgets for visual organization via a layout
54
+ grid_layout 2, false
55
+
56
+ label {
57
+ text "Field has inequal width"
58
+ }
59
+
60
+ text {
61
+ layout_data :fill, :center, true, false # fill horizontally, align center vertically, grab remaining horizontal space, but not vertical
62
+ }
63
+ }
64
+ }
65
+
66
+ }
67
+ end
68
+
69
+ HelloComposite.launch
@@ -16,44 +16,27 @@ module Glimmer
16
16
 
17
17
  def num_columns=(columns)
18
18
  @num_columns = columns
19
- # TODO do the following instead of reapply
20
- # @parent.add_css_class("num-columns-#{@num_columns}")
21
- # reinitialize # TODO reimplement without using reinitialize
22
- layout_css = <<~CSS
23
- grid-template-columns: #{'auto ' * @num_columns.to_i};
24
- grid-row-gap: #{@vertical_spacing}px;
25
- grid-column-gap: #{@horizontal_spacing}px;
26
- CSS
27
- if @parent.css_classes.include?('grid-layout')
28
- layout_css.split(";").map(&:strip).map {|l| l.split(':').map(&:strip)}.each do |key, value|
29
- @parent.dom_element.css(key, value) unless key.nil?
30
- end
31
- if @parent.is_a?(GroupProxy)
32
- @parent.dom_element.find('legend').css('grid-column-start', "span #{@num_columns.to_i}")
33
- end
34
- else
35
- layout_css.split(";").map(&:strip).map {|l| l.split(':').map(&:strip)}.each do |key, value|
36
- @parent.dom_element.css(key, 'initial') unless key.nil?
37
- end
38
- end
19
+ @parent.dom_element.css('grid-template-columns', 'auto ' * @num_columns.to_i)
20
+ @parent.dom_element.find('legend').css('grid-column-start', "span #{@num_columns.to_i}") if @parent.is_a?(GroupProxy)
39
21
  end
40
22
 
41
23
  def make_columns_equal_width=(equal_width)
42
24
  @make_columns_equal_width = equal_width
43
- # @parent.add_css_class('make_columns_equal_width') if @make_columns_equal_width
44
- # reinitialize # TODO reimplement without using reinitialize
25
+ if @make_columns_equal_width
26
+ @parent.dom_element.css('grid-template-columns', "#{100.0/@num_columns.to_f}% " * @num_columns.to_i)
27
+ else
28
+ @parent.dom_element.css('grid-template-columns', 'auto ' * @num_columns.to_i)
29
+ end
45
30
  end
46
31
 
47
32
  def horizontal_spacing=(spacing)
48
33
  @horizontal_spacing = spacing
49
- # @parent.add_css_class("horizontal-spacing-#{@horizontal_spacing}")
50
- # reinitialize # TODO reimplement without using reinitialize
34
+ @parent.dom_element.css('grid-column-gap', "#{@horizontal_spacing}px")
51
35
  end
52
36
 
53
37
  def vertical_spacing=(spacing)
54
38
  @vertical_spacing = spacing
55
- # @parent.add_css_class("vertical-spacing-#{@vertical_spacing}")
56
- # reinitialize # TODO reimplement without using reinitialize
39
+ @parent.dom_element.css('grid-row-gap', "#{@vertical_spacing}px")
57
40
  end
58
41
 
59
42
  def margin_width=(pixels)
@@ -79,7 +62,8 @@ module Glimmer
79
62
  self.vertical_spacing = 10
80
63
  self.margin_width = 15
81
64
  self.margin_height = 15
82
- self.num_columns = @args.first || 1
65
+ self.num_columns = @args[0] || 1
66
+ self.make_columns_equal_width = @args[1] || false
83
67
  end
84
68
  end
85
69
  end
@@ -92,7 +92,7 @@ module Glimmer
92
92
  def grab_excess_horizontal_space=(grab_excess_horizontal_space)
93
93
  @grab_excess_horizontal_space = grab_excess_horizontal_space
94
94
  @parent.dom_element.css('justify-self', @horizontal_alignment) if @grab_excess_horizontal_space && @horizontal_alignment != 'fill' && width_hint.nil?
95
- @parent.parent.dom_element.css('justify-content', "normal") if @grab_excess_horizontal_space
95
+ @parent.parent.dom_element.css('justify-content', 'stretch') if @grab_excess_horizontal_space
96
96
  # reapply
97
97
  end
98
98
 
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.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-15 00:00:00.000000000 Z
11
+ date: 2021-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0
19
+ version: 2.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0
26
+ version: 2.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: glimmer-dsl-xml
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -288,6 +288,7 @@ files:
288
288
  - lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb
289
289
  - lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb
290
290
  - lib/glimmer-dsl-opal/samples/hello/hello_combo.rb
291
+ - lib/glimmer-dsl-opal/samples/hello/hello_composite.rb
291
292
  - lib/glimmer-dsl-opal/samples/hello/hello_computed.rb
292
293
  - lib/glimmer-dsl-opal/samples/hello/hello_custom_shell.rb
293
294
  - lib/glimmer-dsl-opal/samples/hello/hello_custom_widget.rb
@@ -437,7 +438,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
437
438
  - !ruby/object:Gem::Version
438
439
  version: '0'
439
440
  requirements: []
440
- rubygems_version: 3.2.22
441
+ rubygems_version: 3.2.3
441
442
  signing_key:
442
443
  specification_version: 4
443
444
  summary: Glimmer DSL for Opal