glimmer-dsl-opal 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +112 -65
- data/VERSION +1 -1
- data/lib/glimmer-dsl-opal.rb +1 -1
- data/lib/glimmer/swt/latest_shell_proxy.rb +17 -4
- data/lib/glimmer/swt/menu_proxy.rb +2 -2
- data/lib/glimmer/ui/custom_shell.rb +1 -1
- data/lib/net/http.rb +9 -2
- metadata +22 -3
- data/lib/glimmer-dsl-opal/ext/struct.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413c672e156087e669f81c8c73c6dfcc6b29146f058c6c317c80cfa1f10d9e31
|
4
|
+
data.tar.gz: 930793a35af93d316d44652ba386fab64b73bef069feb6a8919136db61879238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 606f6324b4018f8a3dfd4df28c885825cf889d39674a6c80cc835f3035b3e58d64e3b88a18f258cd940ba99ad12b679d381f34cf4c171eb4d5ccb43bf2d91efa
|
7
|
+
data.tar.gz: 79ede1aea3bc7639489eb10feef5f12a89d75150b04a750ad44b3b2934f8a485e97ce71d6061e2500b96b11e42fa501f32ebc467b2a5c647d9bdd2dd6e615ef4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.9.3
|
4
|
+
|
5
|
+
- Extracted pure Ruby Struct to pure-struct gem (since it's also used by YASL)
|
6
|
+
- Alpha experimental incomplete implementation of Net::HTTP.post_form
|
7
|
+
- Fixed issue with not being able to interact with a shell proxy (LatestShellProxy) after opening (made class autoupgradable to attached ShellProxy after document ready)
|
8
|
+
|
3
9
|
## 0.9.2
|
4
10
|
|
5
11
|
- Fixed issue with opening message_box after internalizing the Document.ready? block
|
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.9.
|
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.9.3 (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.9.
|
144
|
+
**Alpha Version** 0.9.3 only supports bare-minimum capabilities for the following [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
|
[Hello samples](#hello-samples):
|
147
147
|
|
@@ -172,7 +172,7 @@ NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contr
|
|
172
172
|
- [Tic Tac Toe](#tic-tac-toe)
|
173
173
|
- [Contact Manager](#contact-manager)
|
174
174
|
|
175
|
-
External:
|
175
|
+
[External samples](#external-samples):
|
176
176
|
|
177
177
|
- [Glimmer Calculator](#glimmer-calculator)
|
178
178
|
|
@@ -182,77 +182,64 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
182
182
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
183
183
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
|
184
184
|
|
185
|
-
##
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
195
|
-
-
|
196
|
-
-
|
197
|
-
-
|
198
|
-
-
|
199
|
-
-
|
200
|
-
-
|
201
|
-
-
|
202
|
-
-
|
203
|
-
-
|
204
|
-
-
|
205
|
-
-
|
206
|
-
-
|
207
|
-
-
|
208
|
-
-
|
209
|
-
-
|
210
|
-
-
|
211
|
-
-
|
212
|
-
-
|
213
|
-
-
|
214
|
-
-
|
215
|
-
-
|
216
|
-
-
|
217
|
-
-
|
218
|
-
|
219
|
-
|
220
|
-
-
|
221
|
-
-
|
222
|
-
-
|
223
|
-
-
|
224
|
-
|
225
|
-
|
226
|
-
-
|
227
|
-
-
|
228
|
-
-
|
229
|
-
-
|
230
|
-
|
231
|
-
Data-Binding/Observers:
|
232
|
-
- `bind`: featured in [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe)
|
233
|
-
- `observe`: featured in [Hello, Table!](#hello-table) / [Tic Tac Toe](#tic-tac-toe)
|
234
|
-
- `on_widget_selected`: featured in [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Message Box!](#hello-message-box) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager) / [Login](#login) / [Tic Tac Toe](#tic-tac-toe)
|
235
|
-
- `on_modify_text`
|
236
|
-
- `on_key_pressed` (and SWT alias `on_swt_keydown`) - featured in [Login](#login) / [Contact Manager](#contact-manager)
|
237
|
-
- `on_key_released` (and SWT alias `on_swt_keyup`)
|
238
|
-
- `on_mouse_down` (and SWT alias `on_swt_mousedown`)
|
239
|
-
- `on_mouse_up` (and SWT alias `on_swt_mouseup`) - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
|
240
|
-
|
241
|
-
Event loop:
|
242
|
-
- `display`: featured in [Tic Tac Toe](#tic-tac-toe)
|
243
|
-
- `async_exec`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell)
|
185
|
+
## Table of Contents
|
186
|
+
|
187
|
+
- [Glimmer DSL for Opal 0.9.2 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-092-pure-ruby-web-gui)
|
188
|
+
- [Principles](#principles)
|
189
|
+
- [Background](#background)
|
190
|
+
- [Pre-requisites](#pre-requisites)
|
191
|
+
- [Setup](#setup)
|
192
|
+
- [Supported Glimmer DSL Keywords](#supported-glimmer-dsl-keywords)
|
193
|
+
- [Samples](#samples)
|
194
|
+
- [Hello Samples](#hello-samples)
|
195
|
+
- [Hello, World!](#hello-world)
|
196
|
+
- [Hello, Combo!](#hello-combo)
|
197
|
+
- [Hello, Computed!](#hello-computed)
|
198
|
+
- [Hello, List Single Selection!](#hello-list-single-selection)
|
199
|
+
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
200
|
+
- [Hello, Browser!](#hello-browser)
|
201
|
+
- [Hello, Tab!](#hello-tab)
|
202
|
+
- [Hello, Custom Widget!](#hello-custom-widget)
|
203
|
+
- [Hello, Custom Shell!](#hello-custom-shell)
|
204
|
+
- [Hello, Radio!](#hello-radio)
|
205
|
+
- [Hello, Radio Group!](#hello-radio-group)
|
206
|
+
- [Hello, Group!](#hello-group)
|
207
|
+
- [Hello, Checkbox!](#hello-checkbox)
|
208
|
+
- [Hello, Checkbox Group!](#hello-checkbox-group)
|
209
|
+
- [Hello, Date Time!](#hello-date-time)
|
210
|
+
- [Hello, Table!](#hello-table)
|
211
|
+
- [Hello, Button!](#hello-button)
|
212
|
+
- [Hello, Message Box!](#hello-message-box)
|
213
|
+
- [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
|
214
|
+
- [Hello, Menu Bar!](#hello-menu-bar)
|
215
|
+
- [Elaborate Samples](#elaborate-samples)
|
216
|
+
- [Login](#login)
|
217
|
+
- [Tic Tac Toe](#tic-tac-toe)
|
218
|
+
- [Contact Manager](#contact-manager)
|
219
|
+
- [External Samples](#external-samples)
|
220
|
+
- [Glimmer Calculator](#glimmer-calculator)
|
221
|
+
- [Glimmer Supporting Libraries](#glimmer-supporting-libraries)
|
222
|
+
- [Glimmer Process](#glimmer-process)
|
223
|
+
- [Help](#help)
|
224
|
+
- [Issues](#issues)
|
225
|
+
- [Chat](#chat)
|
226
|
+
- [Feature Suggestions](#feature-suggestions)
|
227
|
+
- [Change Log](#change-log)
|
228
|
+
- [Contributing](#contributing)
|
229
|
+
- [Contributors](#contributors)
|
230
|
+
- [License](#license)
|
244
231
|
|
245
232
|
## Principles
|
246
233
|
|
247
234
|
- **Live purely in Rubyland via the Glimmer GUI DSL**, completely oblivious to web browser technologies.
|
248
235
|
- **Forget Routers!** Glimmer DSL for Opal supports auto-routing of custom shells (windows), which are opened as separate tabs in a web browser with automatically generated routes and bookmarkable URLs.
|
249
236
|
- **HTML is strictly made for creating documents not interactive applications**. As such, software engineers can avoid it and focus on creating web applications more productively with Glimmer DSL for Opal in pure Ruby instead (just like they do in desktop development) while content creators and web designers can be the ones responsible for creating HTML documents for web content purposes only as HTML was originally intended. That way, Glimmer web GUI is used and embedded in web pages when providing users with applications while the rest of the web pages are maintained by non-engineers as pure HTML. This achieves a correct separation of responsibilities and better productivity and maintainability.
|
250
|
-
- **Approximate styles by developers via the Glimmer GUI DSL. Perfect styles by designers via pure CSS**. Developers can simply build GUI with approximate styling similar to desktop GUI without worrying about pixel-perfect
|
237
|
+
- **Approximate styles by developers via the Glimmer GUI DSL. Perfect styles by designers via pure CSS**. Developers can simply build GUI with approximate styling similar to desktop GUI and mockups without worrying about pixel-perfect aesthetics. Web designers can take styling further with pure CSS since every HTML element auto-generated by Glimmer DSL for Opal has a predictable ID and CSS class. This achieves a proper separation of responsibilities between developers and designers.
|
251
238
|
- **Web servers are used just like servers in traditional client/server architecture**, meaning they simply provide RMI services to enable centralizing some of the application logic and data in the cloud to make available everywhere and enable data-sharing with others.
|
252
239
|
|
253
240
|
## Background
|
254
241
|
|
255
|
-
The original idea behind Glimmer DSL for Opal was that you start by having a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) desktop app that communicates with a Rails API for any web/cloud concerns. The pure Ruby [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is very simple, so it is more productive to build GUI in it since it does not go through a server/client request/response cycle and can be iterated on locally with a much shorter feedback cycle. Once the GUI and the rest of the app is built. You simply embed it in a Rails app as a one line require statement
|
242
|
+
The original idea behind Glimmer DSL for Opal was that you start by having a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) desktop app that communicates with a Rails API for any web/cloud concerns. The pure Ruby [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is very simple, so it is more productive to build GUI in it since it does not go through a server/client request/response cycle and can be iterated on locally with a much shorter feedback cycle. Once the GUI and the rest of the app is built. You simply embed it in a Rails app as a one line require statement, and BOOM, it just works on the web inside a web browser with the same server/client communication you had in the desktop app (I am working on adding minimal support for net/http in Opal so that desktop apps that use it continue to work in a web browser. Until then, just use [Opal-jQuery](https://github.com/opal/opal-jquery) http support). That way, you get two apps for one: desktop and web.
|
256
243
|
|
257
244
|
Part of the idea is that web browsers just render GUI widgets similar to those of a desktop app (after all a web browser is a desktop app), so whether you run your GUI on the desktop or on the web should just be a low-level concern, hopefully automated completely with Glimmer DSL for Opal.
|
258
245
|
|
@@ -294,7 +281,7 @@ Add the following to `Gemfile`:
|
|
294
281
|
gem 'opal-rails', '~> 1.1.2'
|
295
282
|
gem 'opal-async', '~> 1.2.0'
|
296
283
|
gem 'opal-jquery', '~> 0.4.4'
|
297
|
-
gem 'glimmer-dsl-opal', '~> 0.9.
|
284
|
+
gem 'glimmer-dsl-opal', '~> 0.9.3'
|
298
285
|
gem 'glimmer-dsl-xml', '~> 1.1.0', require: false
|
299
286
|
gem 'glimmer-dsl-css', '~> 1.1.0', require: false
|
300
287
|
|
@@ -353,6 +340,66 @@ shell {
|
|
353
340
|
}.open
|
354
341
|
```
|
355
342
|
|
343
|
+
## Supported Glimmer DSL Keywords
|
344
|
+
|
345
|
+
The following keywords from [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) have partial support in Opal:
|
346
|
+
|
347
|
+
Widgets:
|
348
|
+
- `button`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Message Box!](#hello-message-box) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
|
349
|
+
- `browser`: featured in [Hello, Browser!](#hello-browser)
|
350
|
+
- `calendar`: featured in [Hello, Date Time!](#hello-date-time)
|
351
|
+
- `checkbox`: featured in [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox)
|
352
|
+
- `checkbox_group`: featured in [Hello, Checkbox Group!](#hello-checkbox-group)
|
353
|
+
- `combo`: featured in [Hello, Table!](#hello-table) / [Hello, Combo!](#hello-combo)
|
354
|
+
- `composite`: featured in [Hello, Radio!](#hello-radio) / [Hello, Computed!](#hello-computed) / [Hello, Checkbox!](#hello-checkbox) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login) / [Contact Manager](#contact-manager)
|
355
|
+
- `date`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Tic Tac Toe](#tic-tac-toe)
|
356
|
+
- `date_drop_down`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
|
357
|
+
- `group`: featured in [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager)
|
358
|
+
- `label`: featured in [Hello, Computed!](#hello-computed) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, World!](#hello-world) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager) / [Login](#login)
|
359
|
+
- `list` (w/ optional `:multi` SWT style): featured in [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Contact Manager](#contact-manager)
|
360
|
+
- `menu`: featured in [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Table!](#hello-table)
|
361
|
+
- `menu_bar`: featured in [Hello, Menu Bar!](#hello-menu-bar)
|
362
|
+
- `menu_item`: featured in [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar)
|
363
|
+
- `message_box`: featured in [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Message Box!](#hello-message-box) / [Hello, Menu Bar!](#hello-menu-bar)
|
364
|
+
- `radio`: featured in [Hello, Radio!](#hello-radio) / [Hello, Group!](#hello-group)
|
365
|
+
- `radio_group`: featured in [Hello, Radio Group!](#hello-radio-group)
|
366
|
+
- `scrolled_composite`
|
367
|
+
- `shell`: featured in [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Tab!](#hello-tab) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe) / [Login](#login)
|
368
|
+
- `tab_folder`: featured in [Hello, Tab!](#hello-tab)
|
369
|
+
- `tab_item`: featured in [Hello, Tab!](#hello-tab)
|
370
|
+
- `table`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Table!](#hello-table) / [Contact Manager](#contact-manager)
|
371
|
+
- `table_column`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
|
372
|
+
- `text`: featured in [Hello, Computed!](#hello-computed) / [Login](#login) / [Contact Manager](#contact-manager)
|
373
|
+
- `time`: featured in [Hello, Table!](#hello-table) / [Hello, Date Time!](#hello-date-time)
|
374
|
+
- Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](#hello-custom-widget)
|
375
|
+
- Glimmer::UI::CustomShell: ability to define any keyword as a custom shell (aka custom window) that opens in a new browser window (tab) automatically unless there is no shell open in the current browser window (tab) - featured in [Hello, Custom Shell!](#hello-custom-shell)
|
376
|
+
|
377
|
+
Layouts:
|
378
|
+
- `grid_layout`: featured in [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Hello, Table!](#hello-table) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Contact Manager](#contact-manager) / [Login](#login) / [Tic Tac Toe](#tic-tac-toe)
|
379
|
+
- `row_layout`: featured in [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Contact Manager](#contact-manager)
|
380
|
+
- `fill_layout`: featured in [Hello, Custom Widget!](#hello-custom-widget)
|
381
|
+
- `layout_data`: featured in [Hello, Table!](#hello-table) / [Hello, Custom Shell!](#hello-custom-shell) / [Hello, Computed!](#hello-computed) / [Tic Tac Toe](#tic-tac-toe) / [Contact Manager](#contact-manager)
|
382
|
+
|
383
|
+
Graphics/Style:
|
384
|
+
- `color`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Menu Bar!](#hello-menu-bar)
|
385
|
+
- `font`: featured in [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe)
|
386
|
+
- `Point` class used in setting location on widgets
|
387
|
+
- `swt` and `SWT` class to set SWT styles on widgets - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager)
|
388
|
+
|
389
|
+
Data-Binding/Observers:
|
390
|
+
- `bind`: featured in [Hello, Computed!](#hello-computed) / [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Hello, Date Time!](#hello-date-time) / [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell) / [Login](#login) / [Contact Manager](#contact-manager) / [Tic Tac Toe](#tic-tac-toe)
|
391
|
+
- `observe`: featured in [Hello, Table!](#hello-table) / [Tic Tac Toe](#tic-tac-toe)
|
392
|
+
- `on_widget_selected`: featured in [Hello, Combo!](#hello-combo) / [Hello, Checkbox Group!](#hello-checkbox-group) / [Hello, Checkbox!](#hello-checkbox) / [Hello, Button!](#hello-button) / [Hello, Table!](#hello-table) / [Hello, Radio Group!](#hello-radio-group) / [Hello, Radio!](#hello-radio) / [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu) / [Hello, Message Box!](#hello-message-box) / [Hello, Menu Bar!](#hello-menu-bar) / [Hello, List Single Selection!](#hello-list-single-selection) / [Hello, List Multi Selection!](#hello-list-multi-selection) / [Hello, Group!](#hello-group) / [Contact Manager](#contact-manager) / [Login](#login) / [Tic Tac Toe](#tic-tac-toe)
|
393
|
+
- `on_modify_text`
|
394
|
+
- `on_key_pressed` (and SWT alias `on_swt_keydown`) - featured in [Login](#login) / [Contact Manager](#contact-manager)
|
395
|
+
- `on_key_released` (and SWT alias `on_swt_keyup`)
|
396
|
+
- `on_mouse_down` (and SWT alias `on_swt_mousedown`)
|
397
|
+
- `on_mouse_up` (and SWT alias `on_swt_mouseup`) - featured in [Hello, Custom Shell!](#hello-custom-shell) / [Contact Manager](#contact-manager)
|
398
|
+
|
399
|
+
Event loop:
|
400
|
+
- `display`: featured in [Tic Tac Toe](#tic-tac-toe)
|
401
|
+
- `async_exec`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell)
|
402
|
+
|
356
403
|
## Samples
|
357
404
|
|
358
405
|
Follow the instructions below to try out [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) samples webified via [glimmer-dsl-opal](https://rubygems.org/gems/glimmer-dsl-opal)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.3
|
data/lib/glimmer-dsl-opal.rb
CHANGED
@@ -44,6 +44,7 @@ if RUBY_ENGINE == 'opal'
|
|
44
44
|
require 'opal-async'
|
45
45
|
require 'async/ext'
|
46
46
|
require 'to_collection'
|
47
|
+
require 'pure-struct'
|
47
48
|
require 'os'
|
48
49
|
require 'file'
|
49
50
|
require 'display'
|
@@ -59,7 +60,6 @@ if RUBY_ENGINE == 'opal'
|
|
59
60
|
require 'facets/hash/symbolize_keys'
|
60
61
|
require 'glimmer-dsl-opal/ext/class'
|
61
62
|
require 'glimmer-dsl-opal/ext/file'
|
62
|
-
require 'glimmer-dsl-opal/ext/struct'
|
63
63
|
require 'glimmer'
|
64
64
|
require 'glimmer-dsl-opal/ext/exception'
|
65
65
|
require 'glimmer-dsl-opal/ext/date'
|
@@ -22,18 +22,31 @@
|
|
22
22
|
module Glimmer
|
23
23
|
module SWT
|
24
24
|
class LatestShellProxy #< ShellProxy
|
25
|
-
# TODO consider overriding all methods from ShellProxy and proxying to them
|
26
|
-
# TODO consider the idea of promoting this object into the real shell once Document is ready
|
27
|
-
|
28
25
|
def initialize(parent, args, block)
|
29
26
|
# No Op
|
30
27
|
end
|
31
28
|
|
29
|
+
def method_missing(method, *args, &block)
|
30
|
+
if latest_shell.nil?
|
31
|
+
super(method, *args, &block)
|
32
|
+
else
|
33
|
+
latest_shell.send(method, *args, &block)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def respond_to?(method, *args, &block)
|
38
|
+
super || latest_shell&.respond_to?(method, *args, &block)
|
39
|
+
end
|
40
|
+
|
32
41
|
def open
|
33
42
|
Document.ready? do
|
34
|
-
|
43
|
+
latest_shell&.open
|
35
44
|
end
|
36
45
|
end
|
46
|
+
|
47
|
+
def latest_shell
|
48
|
+
@latest_shell ||= DisplayProxy.instance.shells.last
|
49
|
+
end
|
37
50
|
|
38
51
|
end
|
39
52
|
|
@@ -207,11 +207,11 @@ module Glimmer
|
|
207
207
|
the_element.on('mouseover') { |event|
|
208
208
|
if event.page_x.between?(the_element.offset.left, the_element.offset.left + the_element.width) and
|
209
209
|
event.page_y.between?(the_element.offset.top, the_element.offset.top + the_element.height)
|
210
|
-
`$(#{path}).menu('option', 'position', { my: 'left top', at: 'left bottom' })
|
210
|
+
`$(#{path}).menu('option', 'position', { my: 'left top', at: 'left bottom' })`
|
211
211
|
end
|
212
212
|
}
|
213
213
|
the_element.on('menublur') {
|
214
|
-
`$(#{path}).menu('option', 'position', { my: 'left top', at: 'right top' })
|
214
|
+
`$(#{path}).menu('option', 'position', { my: 'left top', at: 'right top' })`
|
215
215
|
}
|
216
216
|
minimum_width = children.to_a.map(&:dom_element).map(&:width).reduce(:+)
|
217
217
|
the_element.css('min-width', minimum_width)
|
@@ -56,7 +56,7 @@ module Glimmer
|
|
56
56
|
|
57
57
|
def initialize(parent, args, options, &content)
|
58
58
|
super(parent, args, options, &content)
|
59
|
-
raise Error, 'Invalid custom shell body root! Must be a shell or another custom shell.' unless body_root.is_a?(Glimmer::SWT::ShellProxy) || body_root.is_a?(Glimmer::UI::CustomShell)
|
59
|
+
raise Error, 'Invalid custom shell body root! Must be a shell or another custom shell.' unless body_root.is_a?(Glimmer::SWT::ShellProxy) || body_root.is_a?(Glimmer::UI::CustomShell) || body_root.is_a?(Glimmer::SWT::LatestShellProxy)
|
60
60
|
end
|
61
61
|
|
62
62
|
# Classes may override
|
data/lib/net/http.rb
CHANGED
@@ -25,10 +25,17 @@ require_relative '../uri'
|
|
25
25
|
|
26
26
|
module Net
|
27
27
|
# TODO Implement HTTP with jQuery for use in Glimmer DSL for Opal
|
28
|
+
# TODO Re-Implement in Fetch in the future
|
28
29
|
# Note: ignore Protocol superclass for now
|
29
30
|
class HTTP
|
30
|
-
|
31
|
-
|
31
|
+
class << self
|
32
|
+
def post_form(uri, params)
|
33
|
+
response_body = nil
|
34
|
+
result = ::HTTP.post(uri, payload: params) do |response|
|
35
|
+
response_body = response.body
|
36
|
+
end
|
37
|
+
response_body
|
38
|
+
end
|
32
39
|
end
|
33
40
|
end
|
34
41
|
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.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -86,6 +86,26 @@ dependencies:
|
|
86
86
|
- - "<"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 3.0.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: pure-struct
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.0.1
|
96
|
+
- - "<"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 2.0.0
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 1.0.1
|
106
|
+
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 2.0.0
|
89
109
|
- !ruby/object:Gem::Dependency
|
90
110
|
name: puts_debuggerer
|
91
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,7 +270,6 @@ files:
|
|
250
270
|
- lib/glimmer-dsl-opal/ext/exception.rb
|
251
271
|
- lib/glimmer-dsl-opal/ext/file.rb
|
252
272
|
- lib/glimmer-dsl-opal/ext/glimmer/dsl/engine.rb
|
253
|
-
- lib/glimmer-dsl-opal/ext/struct.rb
|
254
273
|
- lib/glimmer-dsl-opal/samples/elaborate/contact_manager.rb
|
255
274
|
- lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact.rb
|
256
275
|
- lib/glimmer-dsl-opal/samples/elaborate/contact_manager/contact_manager_presenter.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# Copyright (c) 2020 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 Struct
|
23
|
-
class << self
|
24
|
-
alias new_original new
|
25
|
-
def new(*args, &block)
|
26
|
-
new_original(*args, &block).tap do |struct_class|
|
27
|
-
if args.size >= 2 && args.last.is_a?(Hash) && args.last[:keyword_init]
|
28
|
-
struct_class.define_method(:initialize) do |struct_class_keyword_args|
|
29
|
-
struct_class_keyword_args.each do |attribute, value|
|
30
|
-
send("#{attribute}=", value)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|