glimmer-dsl-web 0.6.10 → 0.6.12
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 +9 -0
- data/README.md +4 -2
- data/VERSION +1 -1
- data/glimmer-dsl-web.gemspec +3 -3
- data/lib/glimmer/dsl/web/property_expression.rb +8 -1
- data/lib/glimmer/web/component.rb +25 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b8b62aab96fe0a15612d6592d6690e23cc0bbd4f0fe12b8dbaa409e80d5487f
|
4
|
+
data.tar.gz: 997e128f4c1df55175287f7ae0509d668dd9fdac19a49f9f2323ce38c4f9dd98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c5bad9052a782a4d5d8b98f8ad2a9a99e5c368e8d3d54acdf1edcca49c34bcdef92df0d45f41f850767690a53546a8762797faa3eae1a0bae04af6cbf997196
|
7
|
+
data.tar.gz: c2a5e569726554e96eef3415be870a5198c8e19d958e1a87a64583066a6ccdb29199a4c6256ad759a54ba6dfc6c54b92f841295949fad2465e9af3a5f7d790b3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.6.12
|
4
|
+
|
5
|
+
- Fix issue with Glimmer Web Component Attribute Data-Binding crashing the Contact Manager sample
|
6
|
+
|
7
|
+
## 0.6.11
|
8
|
+
|
9
|
+
- Set component attribute as a property in the Glimmer DSL by nesting 'propname value' inside component in consuming code
|
10
|
+
- Glimmer Web Component Attribute Data-Binding (by nesting data-binding declarations within consumed components)
|
11
|
+
|
3
12
|
## 0.6.10
|
4
13
|
|
5
14
|
- Support Component Attribute Listeners including non-option attributes (like method-based attributes not generated by `option :someoption` like `attr_accessor :someattr`)
|
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 Web 0.6.
|
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.6.12 (Beta)
|
2
2
|
## Ruby-in-the-Browser Web Frontend Framework
|
3
3
|
### The "Rails" of Frontend Frameworks!!! ([Fukuoka Award Winning](https://andymaleh.blogspot.com/2025/01/glimmer-dsl-for-web-wins-in-fukuoka.html))
|
4
4
|
#### Finally, Ruby Developer Productivity, Happiness, and Fun in the Frontend!!!
|
@@ -1408,7 +1408,7 @@ rails new glimmer_app_server
|
|
1408
1408
|
Add the following to `Gemfile`:
|
1409
1409
|
|
1410
1410
|
```
|
1411
|
-
gem 'glimmer-dsl-web', '~> 0.6.
|
1411
|
+
gem 'glimmer-dsl-web', '~> 0.6.12'
|
1412
1412
|
```
|
1413
1413
|
|
1414
1414
|
Run:
|
@@ -2977,6 +2977,8 @@ Component listeners enable consumers of components to listen to any custom event
|
|
2977
2977
|
|
2978
2978
|
For example, an `AccordionSection` component might generate events `:expanded` and `:collapsed` when a user clicks on the section title to expand it or collapse it. Consumers can then use `on_expanded` and `on_collapsed` to listen to those events.
|
2979
2979
|
|
2980
|
+
Also, it is possible to listen to any component attribute by nesting `on_some_attribute_update`. And, it is possible to set component attributes by nesting `some_attribute value` or data-binding to them by nesting `some_attribute <=> [model, :attribute]`.
|
2981
|
+
|
2980
2982
|
[lib/glimmer-dsl-web/samples/hello/hello_component_listeners.rb](/lib/glimmer-dsl-web/samples/hello/hello_component_listeners.rb)
|
2981
2983
|
|
2982
2984
|
Glimmer HTML DSL Ruby code in the frontend:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.12
|
data/glimmer-dsl-web.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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.6.
|
5
|
+
# stub: glimmer-dsl-web 0.6.12 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer-dsl-web".freeze
|
9
|
-
s.version = "0.6.
|
9
|
+
s.version = "0.6.12"
|
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 = "2025-
|
14
|
+
s.date = "2025-03-01"
|
15
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. Modular design is supported with Glimmer Web Components, Component Slots, and Component Custom Event Listeners. And, a Ruby CSS DSL is supported with the included Glimmer DSL for CSS. 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 = [
|
@@ -7,7 +7,14 @@ module Glimmer
|
|
7
7
|
module Web
|
8
8
|
class PropertyExpression < Expression
|
9
9
|
def can_interpret?(parent, keyword, *args, &block)
|
10
|
-
|
10
|
+
# TODO add this condition once formatting elements become normal elements
|
11
|
+
# or delete this line if no longer needed:
|
12
|
+
# parent.is_a?(Glimmer::Web::FormattingElementProxy) ||
|
13
|
+
# Also, consider removing type check altogether (to generalize if good idea)
|
14
|
+
(
|
15
|
+
parent.is_a?(Glimmer::Web::ElementProxy) ||
|
16
|
+
parent.is_a?(Glimmer::Web::Component)
|
17
|
+
) and
|
11
18
|
(!args.empty?) and
|
12
19
|
parent.respond_to?("#{keyword}=") and
|
13
20
|
block.nil?
|
@@ -406,6 +406,7 @@ module Glimmer
|
|
406
406
|
end
|
407
407
|
|
408
408
|
def remove_observer(observer, attribute_or_event, options = {})
|
409
|
+
# TODO should we removing attribute observers? when removing component?
|
409
410
|
if can_add_attribute_observer?(attribute_or_event)
|
410
411
|
super(observer, attribute_or_event)
|
411
412
|
elsif can_add_custom_event_listener?(attribute_or_event)
|
@@ -476,11 +477,24 @@ module Glimmer
|
|
476
477
|
end
|
477
478
|
|
478
479
|
def remove
|
480
|
+
remove_all_listeners
|
479
481
|
@markup_root&.remove
|
480
482
|
end
|
481
483
|
|
482
484
|
def data_bind(property, model_binding)
|
483
|
-
|
485
|
+
if has_option?(property) || (has_read_write_attribute?(property) && !@markup_root.respond_to?(property) && !@markup_root.respond_to?("#{property}="))
|
486
|
+
option_binding = Glimmer::DataBinding::ModelBinding.new(self, property)
|
487
|
+
#TODO make this options observer dependent and all similar observers in element specific data binding handlers
|
488
|
+
option_binding.observe(model_binding)
|
489
|
+
option_binding.call(model_binding.evaluate_property)
|
490
|
+
data_bindings[option_binding] = model_binding
|
491
|
+
if !model_binding.binding_options[:read_only]
|
492
|
+
model_binding.observe(option_binding)
|
493
|
+
model_binding.call(option_binding.evaluate_property)
|
494
|
+
end
|
495
|
+
else
|
496
|
+
@markup_root&.data_bind(property, model_binding)
|
497
|
+
end
|
484
498
|
end
|
485
499
|
|
486
500
|
def bind_content(*binding_args, &content_block)
|
@@ -508,6 +522,12 @@ module Glimmer
|
|
508
522
|
end
|
509
523
|
end
|
510
524
|
end
|
525
|
+
|
526
|
+
def remove_all_listeners
|
527
|
+
data_bindings.each do |option_binding, model_binding|
|
528
|
+
option_binding.unregister_all_observables
|
529
|
+
end
|
530
|
+
end
|
511
531
|
|
512
532
|
def method_missing(method_name, *args, &block)
|
513
533
|
if can_handle_observation_request?(method_name)
|
@@ -556,6 +576,10 @@ module Glimmer
|
|
556
576
|
def remove_style_block
|
557
577
|
Glimmer::Web::Component.remove_component_style(self)
|
558
578
|
end
|
579
|
+
|
580
|
+
def data_bindings
|
581
|
+
@data_bindings ||= {}
|
582
|
+
end
|
559
583
|
end
|
560
584
|
end
|
561
585
|
end
|
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.6.
|
4
|
+
version: 0.6.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|