glimmer-dsl-web 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +70 -59
- data/VERSION +1 -1
- data/glimmer-dsl-web.gemspec +21 -20
- data/lib/glimmer/web/component.rb +9 -4
- data/lib/glimmer-dsl-web/ext/kernel.rb +42 -0
- data/lib/glimmer-dsl-web/samples/hello/hello_component.rb +2 -2
- data/lib/glimmer-dsl-web.rb +1 -0
- metadata +19 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 212cee9f2c87b145cca85b47395f541a749d0a472560a946c1f3b0061ec7b801
|
4
|
+
data.tar.gz: f7cccb64081e75018c6e043e021b071d70c7b2696057a32e25b191fb2c3dd4f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e590b30b6f3d54f859e168bd7220cfa51e8d3f2354836fb851ab20c21114518ddd2a502a74a262b704148561e64b65a07cbd2ed61593914a274fa7542da8e1c9
|
7
|
+
data.tar.gz: 1a334ce05e730c2eef25005d5a1a9d16683b639fac910e83ba0ceff88c380230df884486f994140bce11a68e10210ff1a28266604560ecaa134859b621402cf2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.2.4
|
4
|
+
|
5
|
+
- Enhance `Kernel#puts` & `Kernel#p` to enable printing any native JS object with `console.log` (without having to manually wrap with `Native`)
|
6
|
+
- Support Content Data-Binding from inside a `Glimmer::Web::Component`
|
7
|
+
|
3
8
|
## 0.2.3
|
4
9
|
|
5
10
|
- Ensure that setting `element.class_name=classnameval` does not override its Glimmer built-in CSS classes
|
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
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 Web 0.2.
|
2
|
-
## Ruby in the Browser Web
|
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 Web 0.2.4 (Beta)
|
2
|
+
## Ruby in the Browser Web Frontend Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-web.svg)](http://badge.fury.io/rb/glimmer-dsl-web)
|
4
4
|
[![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)
|
5
5
|
|
6
6
|
**(Based on Original [Glimmer](https://github.com/AndyObtiva/glimmer) Library Handling World’s Ruby GUI Needs Since 2007. Beware of Imitators!)**
|
7
7
|
|
8
|
-
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for Web enables building Web
|
8
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for Web enables building Web Frontends using [Ruby in the Browser](https://www.youtube.com/watch?v=4AdcfbI6A4c), as per [Matz's recommendation in his RubyConf 2022 keynote speech to replace JavaScript with Ruby](https://youtu.be/knutsgHTrfQ?t=789). It aims at providing the simplest, most intuitive, most straight-forward, and most productive frontend framework in existence. The framework follows the Ruby way (with [DSLs](https://martinfowler.com/books/dsl.html) and [TIMTOWTDI](https://en.wiktionary.org/wiki/TMTOWTDI#English)) and the Rails way ([Convention over Configuration](https://rubyonrails.org/doctrine)) in building Isomorphic Ruby on Rails Applications. It provides a Ruby [HTML DSL](#usage), which uniquely enables writing both structure code and logic code in one language. It supports both Unidirectional (One-Way) [Data-Binding](#hello-data-binding) (using `<=`) and Bidirectional (Two-Way) [Data-Binding](#hello-data-binding) (using `<=>`). Dynamic rendering (and re-rendering) of HTML content is also supported via [Content Data-Binding](#hello-content-data-binding). And, modular design is supported with [Glimmer Web Components](#hello-component). Many [samples](#samples) are demonstrated in the [Rails sample app](https://github.com/AndyObtiva/sample-glimmer-dsl-web-rails7-app) (there is a very minimal [Standalone [No Rails] sample app](https://github.com/Largo/glimmer-dsl-web-standalone-demo) too). You can finally live in pure Rubyland on the Web in both the frontend and backend with [Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web)!
|
9
9
|
|
10
10
|
**Hello, World! Sample**
|
11
11
|
|
12
|
-
Glimmer
|
12
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
require 'glimmer-dsl-web'
|
@@ -39,7 +39,7 @@ You can also mount the `div` elsewhere by passing the `parent: parent_css_select
|
|
39
39
|
|
40
40
|
Event listeners can be setup on any element using the same event names used in HTML (e.g. `onclick`) while passing in a standard Ruby block to handle behavior. `$$` gives access to JS global scope from Ruby to invoke functions like `alert`.
|
41
41
|
|
42
|
-
Glimmer
|
42
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
43
43
|
|
44
44
|
```ruby
|
45
45
|
require 'glimmer-dsl-web'
|
@@ -71,9 +71,9 @@ Screenshot:
|
|
71
71
|
|
72
72
|
**Hello, Form!**
|
73
73
|
|
74
|
-
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) gives access to all Web Browser built-in features like HTML form validations, input focus, events, and element functions from a very terse and productive Ruby
|
74
|
+
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) gives access to all Web Browser built-in features like HTML form validations, input focus, events, and element functions from a very terse and productive Ruby HTML DSL. Also, you can apply CSS styles by including directly in Ruby code as a string, using [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css), or managing CSS completely separately using something like [SCSS](https://sass-lang.com/). The CSS techniques could be combined as well, like by managing common reusable CSS styles separately in SCSS, but adding component specific CSS styles in Ruby when it is more convenient.
|
75
75
|
|
76
|
-
Glimmer
|
76
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
77
77
|
|
78
78
|
```ruby
|
79
79
|
require 'glimmer-dsl-web'
|
@@ -229,7 +229,7 @@ Screenshot:
|
|
229
229
|
|
230
230
|
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) intuitively supports both Unidirectional (One-Way) Data-Binding via the `<=` operator and Bidirectional (Two-Way) Data-Binding via the `<=>` operator, incredibly simplifying how to sync View properties with Model attributes with the simplest code to reason about.
|
231
231
|
|
232
|
-
Glimmer
|
232
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
233
233
|
|
234
234
|
```ruby
|
235
235
|
require 'glimmer-dsl-web'
|
@@ -348,7 +348,7 @@ If you need to regenerate HTML element content dynamically, you can use Content
|
|
348
348
|
rebuild HTML elements based on changes in a Model attribute that provides the source data.
|
349
349
|
In this example, we generate multiple address forms based on the number of addresses the user has.
|
350
350
|
|
351
|
-
Glimmer
|
351
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
352
352
|
|
353
353
|
```ruby
|
354
354
|
require 'glimmer-dsl-web'
|
@@ -479,15 +479,15 @@ Screenshot:
|
|
479
479
|
|
480
480
|
You can define Glimmer web components (View components) to reuse visual concepts to your heart's content,
|
481
481
|
by simply defining a class with `include Glimmer::Web::Component` and encasing the reusable markup inside
|
482
|
-
a `markup {...}` block. Glimmer web components automatically extend the Glimmer
|
482
|
+
a `markup {...}` block. Glimmer web components automatically extend the Glimmer HTML DSL with new keywords
|
483
483
|
that match the underscored versions of the component class names (e.g. an `OrderSummary` class yields
|
484
|
-
the `order_summary` keyword for reusing that component within the Glimmer
|
485
|
-
You may insert a Glimmer component anywhere into a Rails View using `glimmer_component(component_path, *args)`
|
484
|
+
the `order_summary` keyword for reusing that component within the Glimmer HTML DSL).
|
485
|
+
You may insert a Glimmer component anywhere into a Rails View using `glimmer_component(component_path, *args)`
|
486
486
|
Rails helper (more about it in [Hello, glimmer_component Rails Helper!](#hello-glimmer_component-rails-helper)).
|
487
487
|
Below, we define an `AddressForm` component that generates an `address_form` keyword, and then we
|
488
488
|
reuse it twice inside an `AddressPage` component displaying a Shipping Address and a Billing Address.
|
489
489
|
|
490
|
-
Glimmer
|
490
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
491
491
|
|
492
492
|
```ruby
|
493
493
|
require 'glimmer-dsl-web'
|
@@ -567,9 +567,9 @@ end
|
|
567
567
|
# AddressForm Glimmer Web Component (View component)
|
568
568
|
#
|
569
569
|
# Including Glimmer::Web::Component makes this class a View component and automatically
|
570
|
-
# generates a new Glimmer
|
570
|
+
# generates a new Glimmer HTML DSL keyword that matches the lowercase underscored version
|
571
571
|
# of the name of the class. AddressForm generates address_form keyword, which can be used
|
572
|
-
# elsewhere in Glimmer
|
572
|
+
# elsewhere in Glimmer HTML DSL code as done inside AddressPage below.
|
573
573
|
class AddressForm
|
574
574
|
include Glimmer::Web::Component
|
575
575
|
|
@@ -736,7 +736,7 @@ Rails View code:
|
|
736
736
|
</div>
|
737
737
|
```
|
738
738
|
|
739
|
-
Glimmer
|
739
|
+
Glimmer HTML DSL Ruby code in the frontend (`app/assets/opal/address_form.rb`):
|
740
740
|
|
741
741
|
```ruby
|
742
742
|
require 'glimmer-dsl-web'
|
@@ -901,9 +901,9 @@ Screenshot:
|
|
901
901
|
|
902
902
|
**Hello, Paragraph!**
|
903
903
|
|
904
|
-
To facilitate building formatted textual paragraphs in Ruby, thanks to [Glimmer](https://github.com/AndyObtiva/glimmer#dsl-engine), the most advanced DSL engine in Ruby, the Glimmer
|
904
|
+
To facilitate building formatted textual paragraphs in Ruby, thanks to [Glimmer](https://github.com/AndyObtiva/glimmer#dsl-engine), the most advanced DSL engine in Ruby, the Glimmer HTML DSL is advanced enough to intelligently behave differently under different situations, like when using HTML formatting elements: `<br>`, `<strong>`, `<em>`, `<br>`, `<i>`, `<sub>`, `<sup>`, `<del>`, `<ins>`, `<small>`, `<mark>`
|
905
905
|
|
906
|
-
Instead of returning Ruby objects that are nested as children within their parent, the Glimmer
|
906
|
+
Instead of returning Ruby objects that are nested as children within their parent, the Glimmer HTML DSL returns `String` objects directly that can be concatenated to or embedded within other `String` objects via interpolation.
|
907
907
|
|
908
908
|
This enables writing code like:
|
909
909
|
|
@@ -931,9 +931,9 @@ it returns a `String` to enable code like this:
|
|
931
931
|
|
932
932
|
`p {"#{span('Yesterday, ', style: 'text-decoration: underline;')}Robert suggested adding a new #{em('feature', class: 'very-emphasized')} to our software product.#{br}}`
|
933
933
|
|
934
|
-
In any case, below is a full example leveraging the Glimmer
|
934
|
+
In any case, below is a full example leveraging the Glimmer HTML DSL alternative approach when utilizing formatting elements underneath a paragraph.
|
935
935
|
|
936
|
-
Glimmer
|
936
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
937
937
|
|
938
938
|
```ruby
|
939
939
|
require 'glimmer-dsl-web'
|
@@ -994,7 +994,7 @@ Screenshot:
|
|
994
994
|
|
995
995
|
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) provides the `observe(model, attribute) { ... }` keyword to employ the [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) as per [MVC](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) (Model View Controller), enabling Views to observe Models and update themselves in response to changes. If the `observe` keyword is used from inside a [Component](#hello-component), when the Component is removed or its top-level element is removed, the observer is automatically cleaned up. The need for such explicit observers is significantly diminished by the availablility of the more advanced Unidirectional [Data-Binding](#hello-data-binding) Support and Bidirectional [Data-Binding](#hello-data-binding) Support.
|
996
996
|
|
997
|
-
Glimmer
|
997
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
998
998
|
|
999
999
|
```ruby
|
1000
1000
|
require 'glimmer-dsl-web'
|
@@ -1074,7 +1074,7 @@ Screenshot:
|
|
1074
1074
|
|
1075
1075
|
![Hello, Observer!](/images/glimmer-dsl-web-samples-hello-hello-observer.gif)
|
1076
1076
|
|
1077
|
-
To get started, [Setup](#setup) Ruby gem, read [Usage](#usage) instructions, and check out more [Samples](#samples).
|
1077
|
+
To get started, [Setup](#setup) Ruby gem, read [Usage](#usage) instructions, and check out more [Samples](#samples) (including playing around with a [Rails sample app](https://github.com/AndyObtiva/sample-glimmer-dsl-web-rails7-app)).
|
1078
1078
|
|
1079
1079
|
--
|
1080
1080
|
|
@@ -1089,6 +1089,9 @@ Learn more about the differences between various [Glimmer](https://github.com/An
|
|
1089
1089
|
- [Glimmer DSL for Web](#)
|
1090
1090
|
- [Prerequisites](#prerequisites)
|
1091
1091
|
- [Setup](#setup)
|
1092
|
+
- [Rails 7](#rails-7)
|
1093
|
+
- [Rails 6](#rails-6)
|
1094
|
+
- [Standalone (No Rails)](#standalone-no-rails)
|
1092
1095
|
- [Usage](#usage)
|
1093
1096
|
- [Supported Glimmer DSL Keywords](#supported-glimmer-dsl-keywords)
|
1094
1097
|
- [Coming from Glimmer DSL for Opal](#coming-from-glimmer-dsl-for-opal)
|
@@ -1126,11 +1129,13 @@ Learn more about the differences between various [Glimmer](https://github.com/An
|
|
1126
1129
|
|
1127
1130
|
## Setup
|
1128
1131
|
|
1132
|
+
You can setup Glimmer DSL for Web in [Rails 7](#rails-7), [Rails 6](#rails-6), or [Standalone (No Rails)](#standalone-no-rails).
|
1133
|
+
|
1129
1134
|
(NOTE: Keep in mind this is a Beta. If you run into issues, try to go back to a [previous revision](https://rubygems.org/gems/glimmer-dsl-web/versions). Also, there is a slight chance any issues you encounter are fixed in master or some other branch that you could check out instead)
|
1130
1135
|
|
1131
1136
|
### Rails 7
|
1132
1137
|
|
1133
|
-
Please follow
|
1138
|
+
Please follow these steps to setup.
|
1134
1139
|
|
1135
1140
|
Install a Rails 7 gem:
|
1136
1141
|
|
@@ -1147,7 +1152,7 @@ rails new glimmer_app_server
|
|
1147
1152
|
Add the following to `Gemfile`:
|
1148
1153
|
|
1149
1154
|
```
|
1150
|
-
gem 'glimmer-dsl-web', '~> 0.2.
|
1155
|
+
gem 'glimmer-dsl-web', '~> 0.2.4'
|
1151
1156
|
```
|
1152
1157
|
|
1153
1158
|
Run:
|
@@ -1164,7 +1169,7 @@ Follow [opal-rails](https://github.com/opal/opal-rails) instructions, basically
|
|
1164
1169
|
bin/rails g opal:install
|
1165
1170
|
```
|
1166
1171
|
|
1167
|
-
To enable the `glimmer-dsl-web`
|
1172
|
+
To enable the `glimmer-dsl-web` gem in the frontend, edit `config/initializers/assets.rb` and add the following at the bottom:
|
1168
1173
|
|
1169
1174
|
```ruby
|
1170
1175
|
Opal.use_gem 'glimmer-dsl-web'
|
@@ -1220,7 +1225,7 @@ Edit and replace `app/assets/opal/opal_application.rb` content with code below (
|
|
1220
1225
|
```ruby
|
1221
1226
|
require 'glimmer-dsl-web' # brings opal and other dependencies automatically
|
1222
1227
|
|
1223
|
-
# Add more require-statements or Glimmer
|
1228
|
+
# Add more require-statements or Glimmer HTML DSL code
|
1224
1229
|
```
|
1225
1230
|
|
1226
1231
|
```ruby
|
@@ -1229,7 +1234,7 @@ require 'glimmer-dsl-web'
|
|
1229
1234
|
require 'glimmer-dsl-web/samples/hello/hello_world.rb'
|
1230
1235
|
```
|
1231
1236
|
|
1232
|
-
If the `<body></body>` element (where the Glimmer
|
1237
|
+
If the `<body></body>` element (where the Glimmer HTML DSL adds elements by default) is not available when the JS file is loading, you need to put the code inside a `Document.ready? do; end` (but, it is recommended that you load the JS file after the parent element like `<body></body>` is in the page already for faster performance, which is guaranteed automatically by using `glimmer_component`, mentioned in details below):
|
1233
1238
|
|
1234
1239
|
```ruby
|
1235
1240
|
require 'glimmer-dsl-web'
|
@@ -1241,7 +1246,7 @@ end
|
|
1241
1246
|
|
1242
1247
|
Example to confirm setup is working:
|
1243
1248
|
|
1244
|
-
Glimmer
|
1249
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1245
1250
|
|
1246
1251
|
```ruby
|
1247
1252
|
require 'glimmer-dsl-web'
|
@@ -1292,7 +1297,7 @@ HTML:
|
|
1292
1297
|
...
|
1293
1298
|
```
|
1294
1299
|
|
1295
|
-
Glimmer
|
1300
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1296
1301
|
|
1297
1302
|
```ruby
|
1298
1303
|
require 'glimmer-dsl-web'
|
@@ -1349,7 +1354,7 @@ Next, read [Usage](#usage) instructions, and check out [Samples](#samples).
|
|
1349
1354
|
|
1350
1355
|
### Rails 6
|
1351
1356
|
|
1352
|
-
Please follow
|
1357
|
+
Please follow these steps to setup.
|
1353
1358
|
|
1354
1359
|
Install a Rails 6 gem:
|
1355
1360
|
|
@@ -1372,7 +1377,7 @@ Disable the `webpacker` gem line in `Gemfile`:
|
|
1372
1377
|
Add the following to `Gemfile`:
|
1373
1378
|
|
1374
1379
|
```ruby
|
1375
|
-
gem 'glimmer-dsl-web', '~> 0.2.
|
1380
|
+
gem 'glimmer-dsl-web', '~> 0.2.4'
|
1376
1381
|
```
|
1377
1382
|
|
1378
1383
|
Run:
|
@@ -1389,7 +1394,7 @@ Follow [opal-rails](https://github.com/opal/opal-rails) instructions, basically
|
|
1389
1394
|
bin/rails g opal:install
|
1390
1395
|
```
|
1391
1396
|
|
1392
|
-
To enable the `glimmer-dsl-web`
|
1397
|
+
To enable the `glimmer-dsl-web` gem in the frontend, edit `config/initializers/assets.rb` and add the following at the bottom:
|
1393
1398
|
|
1394
1399
|
```ruby
|
1395
1400
|
Opal.use_gem 'glimmer-dsl-web'
|
@@ -1451,7 +1456,7 @@ Edit and replace `app/assets/opal/opal_application.rb` content with code below (
|
|
1451
1456
|
```ruby
|
1452
1457
|
require 'glimmer-dsl-web' # brings opal and other dependencies automatically
|
1453
1458
|
|
1454
|
-
# Add more require-statements or Glimmer
|
1459
|
+
# Add more require-statements or Glimmer HTML DSL code
|
1455
1460
|
```
|
1456
1461
|
|
1457
1462
|
Example to confirm setup is working:
|
@@ -1465,7 +1470,7 @@ Initial HTML Markup:
|
|
1465
1470
|
...
|
1466
1471
|
```
|
1467
1472
|
|
1468
|
-
Glimmer
|
1473
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1469
1474
|
|
1470
1475
|
```ruby
|
1471
1476
|
require 'glimmer-dsl-web'
|
@@ -1533,9 +1538,15 @@ Otherwise, if you still cannot setup successfully (even with the help of the sam
|
|
1533
1538
|
|
1534
1539
|
Next, read [Usage](#usage) instructions, and check out [Samples](#samples).
|
1535
1540
|
|
1541
|
+
### Standalone (No Rails)
|
1542
|
+
|
1543
|
+
Andreas Idogawa-Wildi ([@Largo](https://github.com/Largo)) created a project that demonstrates how to use Glimmer DSL for Web standalone (without Rails):
|
1544
|
+
|
1545
|
+
[https://github.com/Largo/glimmer-dsl-web-standalone-demo](https://github.com/Largo/glimmer-dsl-web-standalone-demo)
|
1546
|
+
|
1536
1547
|
## Usage
|
1537
1548
|
|
1538
|
-
Glimmer DSL for Web offers a
|
1549
|
+
Glimmer DSL for Web offers a HTML DSL ([Graphical User Interface](https://en.wikipedia.org/wiki/Graphical_user_interface) [Domain Specific Language](https://en.wikipedia.org/wiki/Domain-specific_language)) for building HTML Web User Interfaces declaratively in Ruby.
|
1539
1550
|
|
1540
1551
|
1- **Keywords (HTML Elements)**
|
1541
1552
|
|
@@ -1551,7 +1562,7 @@ Also, if the element has a little bit of text content that can fit in one line,
|
|
1551
1562
|
|
1552
1563
|
3- **Content Block (Properties + Listeners + Nested Elements + Text Content)**
|
1553
1564
|
|
1554
|
-
Element methods can accept a Ruby content block. It intentionally has a `{...}` style even as a multi-line block to indicate that the code is declarative
|
1565
|
+
Element methods can accept a Ruby content block. It intentionally has a `{...}` style even as a multi-line block to indicate that the code is declarative HTML DSL structure code (intentionally breaking away from Ruby imperative code conventions given this is a declarative HTML DSL ([Domain Specific Language](https://en.wikipedia.org/wiki/Domain-specific_language)), meaning a different language that has its own conventions, embedded within Ruby).
|
1555
1566
|
|
1556
1567
|
You can nest HTML element properties under an element like:
|
1557
1568
|
|
@@ -1571,7 +1582,7 @@ button('Add') {
|
|
1571
1582
|
}
|
1572
1583
|
```
|
1573
1584
|
|
1574
|
-
Given that listener code is imperative, it uses a `do; end` style for Ruby blocks to separate it from declarative
|
1585
|
+
Given that listener code is imperative, it uses a `do; end` style for Ruby blocks to separate it from declarative HTML DSL structure code and enable quicker readability of the code.
|
1575
1586
|
|
1576
1587
|
You can nest other HTML elements under an HTML element the same way you do so in HTML, like:
|
1577
1588
|
|
@@ -1617,7 +1628,7 @@ Next, check out [Samples](#samples).
|
|
1617
1628
|
|
1618
1629
|
## Coming from Glimmer DSL for Opal
|
1619
1630
|
|
1620
|
-
This project is inspired by [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) and is similar in enabling
|
1631
|
+
This project is inspired by [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) and is similar in enabling Web Frontend development with Ruby. [Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) mainly differs from Glimmer DSL for Opal by adopting a DSL that follows web-like HTML syntax in Ruby to facilitate leveraging existing HTML/CSS/JS skills instead of adopting a desktop HTML DSL that is webified. As a result, applications written in Glimmer DSL for Opal are not compatible with Glimmer DSL for Web.
|
1621
1632
|
|
1622
1633
|
## Samples
|
1623
1634
|
|
@@ -1629,7 +1640,7 @@ https://github.com/AndyObtiva/sample-glimmer-dsl-web-rails7-app
|
|
1629
1640
|
|
1630
1641
|
#### Hello, World!
|
1631
1642
|
|
1632
|
-
Glimmer
|
1643
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1633
1644
|
|
1634
1645
|
```ruby
|
1635
1646
|
require 'glimmer-dsl-web'
|
@@ -1681,7 +1692,7 @@ You can also mount the `div` elsewhere by passing the `parent: parent_css_select
|
|
1681
1692
|
|
1682
1693
|
Event listeners can be setup on any element using the same event names used in HTML (e.g. `onclick`) while passing in a standard Ruby block to handle behavior. `$$` gives access to JS global scope from Ruby to invoke functions like `alert`.
|
1683
1694
|
|
1684
|
-
Glimmer
|
1695
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1685
1696
|
|
1686
1697
|
```ruby
|
1687
1698
|
require 'glimmer-dsl-web'
|
@@ -1713,9 +1724,9 @@ Screenshot:
|
|
1713
1724
|
|
1714
1725
|
#### Hello, Form!
|
1715
1726
|
|
1716
|
-
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) gives access to all Web Browser built-in features like HTML form validations, input focus, events, and element functions from a very terse and productive Ruby
|
1727
|
+
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) gives access to all Web Browser built-in features like HTML form validations, input focus, events, and element functions from a very terse and productive Ruby HTML DSL. Also, you can apply CSS styles by including directly in Ruby code as a string, using [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css), or managing CSS completely separately using something like [SCSS](https://sass-lang.com/). The CSS techniques could be combined as well, like by managing common reusable CSS styles separately in SCSS, but adding component specific CSS styles in Ruby when it is more convenient.
|
1717
1728
|
|
1718
|
-
Glimmer
|
1729
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1719
1730
|
|
1720
1731
|
```ruby
|
1721
1732
|
require 'glimmer-dsl-web'
|
@@ -1871,7 +1882,7 @@ Screenshot:
|
|
1871
1882
|
|
1872
1883
|
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) provides the `observe(model, attribute) { ... }` keyword to employ the [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) as per [MVC](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) (Model View Controller), enabling Views to observe Models and update themselves in response to changes. If the `observe` keyword is used from inside a [Component](#hello-component), when the Component is removed or its top-level element is removed, the observer is automatically cleaned up. The need for such explicit observers is significantly diminished by the availablility of the more advanced Unidirectional [Data-Binding](#hello-data-binding) Support and Bidirectional [Data-Binding](#hello-data-binding) Support.
|
1873
1884
|
|
1874
|
-
Glimmer
|
1885
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1875
1886
|
|
1876
1887
|
```ruby
|
1877
1888
|
require 'glimmer-dsl-web'
|
@@ -1955,7 +1966,7 @@ Screenshot:
|
|
1955
1966
|
|
1956
1967
|
[Glimmer DSL for Web](https://rubygems.org/gems/glimmer-dsl-web) intuitively supports both Unidirectional (One-Way) Data-Binding via the `<=` operator and Bidirectional (Two-Way) Data-Binding via the `<=>` operator, incredibly simplifying how to sync View properties with Model attributes with the simplest code to reason about.
|
1957
1968
|
|
1958
|
-
Glimmer
|
1969
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
1959
1970
|
|
1960
1971
|
```ruby
|
1961
1972
|
require 'glimmer-dsl-web'
|
@@ -2128,7 +2139,7 @@ If you need to regenerate HTML element content dynamically, you can use Content
|
|
2128
2139
|
rebuild HTML elements based on changes in a Model attribute that provides the source data.
|
2129
2140
|
In this example, we generate multiple address forms based on the number of addresses the user has.
|
2130
2141
|
|
2131
|
-
Glimmer
|
2142
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
2132
2143
|
|
2133
2144
|
```ruby
|
2134
2145
|
require 'glimmer-dsl-web'
|
@@ -2259,15 +2270,15 @@ Screenshot:
|
|
2259
2270
|
|
2260
2271
|
You can define Glimmer web components (View components) to reuse visual concepts to your heart's content,
|
2261
2272
|
by simply defining a class with `include Glimmer::Web::Component` and encasing the reusable markup inside
|
2262
|
-
a `markup {...}` block. Glimmer web components automatically extend the Glimmer
|
2273
|
+
a `markup {...}` block. Glimmer web components automatically extend the Glimmer HTML DSL with new keywords
|
2263
2274
|
that match the underscored versions of the component class names (e.g. an `OrderSummary` class yields
|
2264
|
-
the `order_summary` keyword for reusing that component within the Glimmer
|
2265
|
-
You may insert a Glimmer component anywhere into a Rails View using `glimmer_component(component_path, *args)`
|
2275
|
+
the `order_summary` keyword for reusing that component within the Glimmer HTML DSL).
|
2276
|
+
You may insert a Glimmer component anywhere into a Rails View using `glimmer_component(component_path, *args)`
|
2266
2277
|
Rails helper (more about it in [Hello, glimmer_component Rails Helper!](#hello-glimmer_component-rails-helper)).
|
2267
2278
|
Below, we define an `AddressForm` component that generates an `address_form` keyword, and then we
|
2268
2279
|
reuse it twice inside an `AddressPage` component displaying a Shipping Address and a Billing Address.
|
2269
2280
|
|
2270
|
-
Glimmer
|
2281
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
2271
2282
|
|
2272
2283
|
```ruby
|
2273
2284
|
require 'glimmer-dsl-web'
|
@@ -2347,9 +2358,9 @@ end
|
|
2347
2358
|
# AddressForm Glimmer Web Component (View component)
|
2348
2359
|
#
|
2349
2360
|
# Including Glimmer::Web::Component makes this class a View component and automatically
|
2350
|
-
# generates a new Glimmer
|
2361
|
+
# generates a new Glimmer HTML DSL keyword that matches the lowercase underscored version
|
2351
2362
|
# of the name of the class. AddressForm generates address_form keyword, which can be used
|
2352
|
-
# elsewhere in Glimmer
|
2363
|
+
# elsewhere in Glimmer HTML DSL code as done inside AddressPage below.
|
2353
2364
|
class AddressForm
|
2354
2365
|
include Glimmer::Web::Component
|
2355
2366
|
|
@@ -2516,7 +2527,7 @@ Rails View code:
|
|
2516
2527
|
</div>
|
2517
2528
|
```
|
2518
2529
|
|
2519
|
-
Glimmer
|
2530
|
+
Glimmer HTML DSL Ruby code in the frontend (`app/assets/opal/address_form.rb`):
|
2520
2531
|
|
2521
2532
|
```ruby
|
2522
2533
|
require 'glimmer-dsl-web'
|
@@ -2681,9 +2692,9 @@ Screenshot:
|
|
2681
2692
|
|
2682
2693
|
#### Hello, Paragraph!
|
2683
2694
|
|
2684
|
-
To facilitate building formatted textual paragraphs in Ruby, thanks to [Glimmer](https://github.com/AndyObtiva/glimmer#dsl-engine), the most advanced DSL engine in Ruby, the Glimmer
|
2695
|
+
To facilitate building formatted textual paragraphs in Ruby, thanks to [Glimmer](https://github.com/AndyObtiva/glimmer#dsl-engine), the most advanced DSL engine in Ruby, the Glimmer HTML DSL is advanced enough to intelligently behave differently under different situations, like when using HTML formatting elements: `<br>`, `<strong>`, `<em>`, `<br>`, `<i>`, `<sub>`, `<sup>`, `<del>`, `<ins>`, `<small>`, `<mark>`
|
2685
2696
|
|
2686
|
-
Instead of returning Ruby objects that are nested as children within their parent, the Glimmer
|
2697
|
+
Instead of returning Ruby objects that are nested as children within their parent, the Glimmer HTML DSL returns `String` objects directly that can be concatenated to or embedded within other `String` objects via interpolation.
|
2687
2698
|
|
2688
2699
|
This enables writing code like:
|
2689
2700
|
|
@@ -2711,9 +2722,9 @@ it returns a `String` to enable code like this:
|
|
2711
2722
|
|
2712
2723
|
`p {"#{span('Yesterday, ', style: 'text-decoration: underline;')}Robert suggested adding a new #{em('feature', class: 'very-emphasized')} to our software product.#{br}}`
|
2713
2724
|
|
2714
|
-
In any case, below is a full example leveraging the Glimmer
|
2725
|
+
In any case, below is a full example leveraging the Glimmer HTML DSL alternative approach when utilizing formatting elements underneath a paragraph.
|
2715
2726
|
|
2716
|
-
Glimmer
|
2727
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
2717
2728
|
|
2718
2729
|
```ruby
|
2719
2730
|
require 'glimmer-dsl-web'
|
@@ -2774,7 +2785,7 @@ Screenshot:
|
|
2774
2785
|
|
2775
2786
|
#### Hello, Input (Date/Time)!
|
2776
2787
|
|
2777
|
-
Glimmer
|
2788
|
+
Glimmer HTML DSL Ruby code in the frontend:
|
2778
2789
|
|
2779
2790
|
```ruby
|
2780
2791
|
require 'glimmer-dsl-web'
|
@@ -2879,7 +2890,7 @@ Screenshot:
|
|
2879
2890
|
|
2880
2891
|
#### Button Counter
|
2881
2892
|
|
2882
|
-
Glimmer
|
2893
|
+
Glimmer HTML DSL Ruby code in the frontend demonstrating MVC + Glimmer Web Components (Views) + Data-Binding:
|
2883
2894
|
|
2884
2895
|
```ruby
|
2885
2896
|
require 'glimmer-dsl-web'
|
@@ -2958,7 +2969,7 @@ Screenshot:
|
|
2958
2969
|
|
2959
2970
|
- The Ruby Way (including TIMTOWTDI: There Is More Than One Way To Do It)
|
2960
2971
|
- The Rails Way Convention over Configuration via smart defaults and automation of low-level details
|
2961
|
-
- Requiring the least amount of
|
2972
|
+
- Requiring the least amount of code possible to build highly interactive web pages
|
2962
2973
|
- Declarative syntax that visually maps to the DOM (Document Object Model) hierarchy
|
2963
2974
|
- Ability to mix declarative and imperative code conveniently in one language
|
2964
2975
|
- Computers serve Software Engineers (not Software Engineers serve Computers)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/glimmer-dsl-web.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer-dsl-web 0.2.
|
5
|
+
# stub: glimmer-dsl-web 0.2.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-web".freeze
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Andy Maleh".freeze]
|
14
|
-
s.date = "2024-
|
15
|
-
s.description = "Glimmer DSL for Web (Ruby in the Browser Web
|
14
|
+
s.date = "2024-02-04"
|
15
|
+
s.description = "Glimmer DSL for Web (Ruby in the Browser Web Frontend Framework) enables building Web Frontends using Ruby in the Browser, as per Matz's recommendation in his RubyConf 2022 keynote speech to replace JavaScript with Ruby. It aims at providing the simplest, most intuitive, most straight-forward, and most productive frontend framework in existence. The framework follows the Ruby way (with DSLs and TIMTOWTDI) and the Rails way (Convention over Configuration) in building Isomorphic Ruby on Rails Applications. It provides a Ruby HTML DSL, which uniquely enables writing both structure code and logic code in one language. It supports both Unidirectional (One-Way) Data-Binding (using <=) and Bidirectional (Two-Way) Data-Binding (using <=>). Dynamic rendering (and re-rendering) of HTML content is also supported via Content Data-Binding. And, modular design is supported with Glimmer Web Components. Many samples are demonstrated in the Rails sample app (there is a very minimal Standalone [No Rails] sample app too). You can finally live in pure Rubyland on the Web in both the frontend and backend with Glimmer DSL for Web! This gem relies on Opal Ruby.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"CHANGELOG.md",
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/glimmer-dsl-web/ext/class.rb",
|
31
31
|
"lib/glimmer-dsl-web/ext/date.rb",
|
32
32
|
"lib/glimmer-dsl-web/ext/exception.rb",
|
33
|
+
"lib/glimmer-dsl-web/ext/kernel.rb",
|
33
34
|
"lib/glimmer-dsl-web/samples/hello/hello_button.rb",
|
34
35
|
"lib/glimmer-dsl-web/samples/hello/hello_component.rb",
|
35
36
|
"lib/glimmer-dsl-web/samples/hello/hello_content_data_binding.rb",
|
@@ -69,24 +70,24 @@ Gem::Specification.new do |s|
|
|
69
70
|
]
|
70
71
|
s.homepage = "http://github.com/AndyObtiva/glimmer-dsl-web".freeze
|
71
72
|
s.licenses = ["MIT".freeze]
|
72
|
-
s.rubygems_version = "3.
|
73
|
-
s.summary = "Glimmer DSL for Web (Ruby in the Browser Web
|
73
|
+
s.rubygems_version = "3.4.10".freeze
|
74
|
+
s.summary = "Glimmer DSL for Web (Ruby in the Browser Web Frontend Framework)".freeze
|
74
75
|
|
75
76
|
s.specification_version = 4
|
76
77
|
|
77
|
-
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 2.7.6"
|
78
|
-
s.add_runtime_dependency(%q<glimmer-dsl-xml>.freeze, ["~> 1.3.2"
|
79
|
-
s.add_runtime_dependency(%q<glimmer-dsl-css>.freeze, ["~> 1.2.3"
|
80
|
-
s.add_runtime_dependency(%q<opal>.freeze, ["= 1.8.2"
|
81
|
-
s.add_runtime_dependency(%q<opal-rails>.freeze, ["= 2.0.3"
|
82
|
-
s.add_runtime_dependency(%q<opal-async>.freeze, ["~> 1.4.1"
|
83
|
-
s.add_runtime_dependency(%q<opal-jquery>.freeze, ["~> 0.5.1"
|
84
|
-
s.add_runtime_dependency(%q<to_collection>.freeze, [">= 2.0.1"
|
85
|
-
s.add_development_dependency(%q<puts_debuggerer>.freeze, [">= 0"
|
86
|
-
s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0"
|
87
|
-
s.add_development_dependency(%q<rake-tui>.freeze, [">= 0"
|
88
|
-
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.3.9"
|
89
|
-
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1"
|
90
|
-
s.add_development_dependency(%q<opal-rspec>.freeze, ["~> 0.8.0.alpha2"
|
78
|
+
s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 2.7.6"])
|
79
|
+
s.add_runtime_dependency(%q<glimmer-dsl-xml>.freeze, ["~> 1.3.2"])
|
80
|
+
s.add_runtime_dependency(%q<glimmer-dsl-css>.freeze, ["~> 1.2.3"])
|
81
|
+
s.add_runtime_dependency(%q<opal>.freeze, ["= 1.8.2"])
|
82
|
+
s.add_runtime_dependency(%q<opal-rails>.freeze, ["= 2.0.3"])
|
83
|
+
s.add_runtime_dependency(%q<opal-async>.freeze, ["~> 1.4.1"])
|
84
|
+
s.add_runtime_dependency(%q<opal-jquery>.freeze, ["~> 0.5.1"])
|
85
|
+
s.add_runtime_dependency(%q<to_collection>.freeze, [">= 2.0.1", "< 3.0.0"])
|
86
|
+
s.add_development_dependency(%q<puts_debuggerer>.freeze, [">= 0"])
|
87
|
+
s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
88
|
+
s.add_development_dependency(%q<rake-tui>.freeze, [">= 0"])
|
89
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.3.9", "< 3.0.0"])
|
90
|
+
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
91
|
+
s.add_development_dependency(%q<opal-rspec>.freeze, ["~> 0.8.0.alpha2"])
|
91
92
|
end
|
92
93
|
|
@@ -316,11 +316,16 @@ module Glimmer
|
|
316
316
|
|
317
317
|
# Returns content block if used as an attribute reader (no args)
|
318
318
|
# Otherwise, if a block is passed, it adds it as content to this Glimmer web component
|
319
|
-
def content(&block)
|
320
|
-
if
|
321
|
-
|
319
|
+
def content(*args, &block)
|
320
|
+
if args.empty?
|
321
|
+
if block_given?
|
322
|
+
Glimmer::DSL::Engine.add_content(self, Glimmer::DSL::Web::ComponentExpression.new, self.class.keyword, &block)
|
323
|
+
else
|
324
|
+
@content
|
325
|
+
end
|
322
326
|
else
|
323
|
-
|
327
|
+
# delegate to GUI DSL ContentExpression
|
328
|
+
super
|
324
329
|
end
|
325
330
|
end
|
326
331
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# backtick_javascript: true
|
2
|
+
|
3
|
+
# Copyright (c) 2023-2024 Andy Maleh
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
module ::Kernel
|
25
|
+
alias puts_without_glimmer puts
|
26
|
+
def puts(*strs)
|
27
|
+
puts_without_glimmer(*strs)
|
28
|
+
rescue Exception
|
29
|
+
strs.each do |str|
|
30
|
+
`console.log(#{str})`
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
alias p_without_glimmer p
|
35
|
+
def p(*args)
|
36
|
+
p_without_glimmer(*args)
|
37
|
+
rescue Exception
|
38
|
+
args.each do |arg|
|
39
|
+
`console.log(#{arg})`
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -96,9 +96,9 @@ end
|
|
96
96
|
# AddressForm Glimmer Web Component (View component)
|
97
97
|
#
|
98
98
|
# Including Glimmer::Web::Component makes this class a View component and automatically
|
99
|
-
# generates a new Glimmer
|
99
|
+
# generates a new Glimmer HTML DSL keyword that matches the lowercase underscored version
|
100
100
|
# of the name of the class. AddressForm generates address_form keyword, which can be used
|
101
|
-
# elsewhere in Glimmer
|
101
|
+
# elsewhere in Glimmer HTML DSL code as done inside AddressPage below.
|
102
102
|
class AddressForm
|
103
103
|
include Glimmer::Web::Component
|
104
104
|
|
data/lib/glimmer-dsl-web.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -230,18 +230,21 @@ dependencies:
|
|
230
230
|
- - "~>"
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: 0.8.0.alpha2
|
233
|
-
description: Glimmer DSL for Web (Ruby in the Browser Web
|
234
|
-
building Web
|
235
|
-
|
236
|
-
|
237
|
-
|
233
|
+
description: Glimmer DSL for Web (Ruby in the Browser Web Frontend Framework) enables
|
234
|
+
building Web Frontends using Ruby in the Browser, as per Matz's recommendation in
|
235
|
+
his RubyConf 2022 keynote speech to replace JavaScript with Ruby. It aims at providing
|
236
|
+
the simplest, most intuitive, most straight-forward, and most productive frontend
|
237
|
+
framework in existence. The framework follows the Ruby way (with DSLs and TIMTOWTDI)
|
238
238
|
and the Rails way (Convention over Configuration) in building Isomorphic Ruby on
|
239
|
-
Rails Applications. It
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
239
|
+
Rails Applications. It provides a Ruby HTML DSL, which uniquely enables writing
|
240
|
+
both structure code and logic code in one language. It supports both Unidirectional
|
241
|
+
(One-Way) Data-Binding (using <=) and Bidirectional (Two-Way) Data-Binding (using
|
242
|
+
<=>). Dynamic rendering (and re-rendering) of HTML content is also supported via
|
243
|
+
Content Data-Binding. And, modular design is supported with Glimmer Web Components.
|
244
|
+
Many samples are demonstrated in the Rails sample app (there is a very minimal Standalone
|
245
|
+
[No Rails] sample app too). You can finally live in pure Rubyland on the Web in
|
246
|
+
both the frontend and backend with Glimmer DSL for Web! This gem relies on Opal
|
247
|
+
Ruby.
|
245
248
|
email: andy.am@gmail.com
|
246
249
|
executables: []
|
247
250
|
extensions: []
|
@@ -260,6 +263,7 @@ files:
|
|
260
263
|
- lib/glimmer-dsl-web/ext/class.rb
|
261
264
|
- lib/glimmer-dsl-web/ext/date.rb
|
262
265
|
- lib/glimmer-dsl-web/ext/exception.rb
|
266
|
+
- lib/glimmer-dsl-web/ext/kernel.rb
|
263
267
|
- lib/glimmer-dsl-web/samples/hello/hello_button.rb
|
264
268
|
- lib/glimmer-dsl-web/samples/hello/hello_component.rb
|
265
269
|
- lib/glimmer-dsl-web/samples/hello/hello_content_data_binding.rb
|
@@ -315,8 +319,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
319
|
- !ruby/object:Gem::Version
|
316
320
|
version: '0'
|
317
321
|
requirements: []
|
318
|
-
rubygems_version: 3.
|
322
|
+
rubygems_version: 3.4.10
|
319
323
|
signing_key:
|
320
324
|
specification_version: 4
|
321
|
-
summary: Glimmer DSL for Web (Ruby in the Browser Web
|
325
|
+
summary: Glimmer DSL for Web (Ruby in the Browser Web Frontend Framework)
|
322
326
|
test_files: []
|