glimmer-dsl-libui 0.11.8 → 0.11.9

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: a57b8761d40fc28195e78f1e86c6f79523b7989b74066e365c3ec8988954e8fb
4
- data.tar.gz: 1fcd57a450862c58f262afb1327d234a8797e8f2b51411efea3aa322b61d7f87
3
+ metadata.gz: fdab64b2358ff1c023582f4a43a9836f40ca6ec416da1c5a2cee53e28292aa4b
4
+ data.tar.gz: ee871301742d88957411aa4dd106b5a8bc27fe3635db6015d3e7a523b4f0348c
5
5
  SHA512:
6
- metadata.gz: e67eadc262f72ce1744acb89aaaa4c97d7ac4a492ddce2792fceec8f6ec12cba46332530f7182c0a751b155fa63dc6598b92ff0e8c8c9b32b7a43c78f630112b
7
- data.tar.gz: 0d42308957235c137d69a9b31b6a000ba99cf08cb1e9efccb77781a06379627c2601a8fcfe2f03c5681e419da78ebf74aad21d1312d249ca80de4a8e6cf5d33d
6
+ metadata.gz: 27c0c11c786b9d0c3cefaff54f1edb7a23ab1dd9e01ff5e2a29a36495aec1948cf6b522150e3b6fe62fa466eaf700d4bd36fac797b942ca3dbab0834aa3f5703
7
+ data.tar.gz: 9ac24bfb2892bc1c1ea2fa895e8718e578ca9b56c06dcf0c8028a11424dc414cf505da6b63fb28bd0a537eb0458996eb3cbfe56b932ce71bca0ea90b1eee6201
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.11.9
4
+
5
+ - Support Content Data-Binding to multiple model attributes via `computed_by` option (e.g. `content(@game, :scale, computed_by: [:width, :height])` or `content(@game, computed_by: [:scale, :width, :height])` will rebuild content on changes to `:scale`, `:width`, or `:height`)
6
+
3
7
  ## 0.11.8
4
8
 
5
9
  - Fix issue with applying a `transform` inside a `Glimmer::LibUI::Application`, `Glimmer::LibUI::CustomControl`, `Glimmer::LibUI::CustomWindow`, or `Glimmer::LibUI::CustomShape` (it otherwise worked when using Glimmer GUI DSL in top-level object)
data/README.md CHANGED
@@ -31,7 +31,7 @@ The main trade-off in using [Glimmer DSL for LibUI](https://rubygems.org/gems/gl
31
31
  - [Custom Component](#custom-components) support (Custom Controls, Custom Windows, and Custom Shapes), including external Ruby gems (e.g. [Graphs and Charts](https://github.com/AndyObtiva/glimmer-libui-cc-graphs_and_charts))
32
32
  - [Bidirectional/Unidirectional Data-Binding](#data-binding) to declaratively wire and automatically synchronize GUI Views with Models
33
33
  - [Scaffolding](#scaffold-application) for new custom windows/controls, apps, and gems
34
- - [Far Future Plan] Native-Executable packaging on Mac, Windows, and Linux.
34
+ - [Far Future Plan] Native-Executable [packaging](#packaging) on Mac, Windows, and Linux.
35
35
 
36
36
  Hello, World!
37
37
 
@@ -431,7 +431,8 @@ Learn more about the differences between various [Glimmer](https://github.com/An
431
431
  - [RubyCrumbler](#rubycrumbler)
432
432
  - [Rubio-Radio](#rubio-radio)
433
433
  - [PMV Calc](#pmv-calc)
434
- - [Process](#process)
434
+ - [Design Principles](#design-principles)
435
+ - [Glimmer Process](#glimmer-process)
435
436
  - [Resources](#resources)
436
437
  - [Help](#help)
437
438
  - [Issues](#issues)
@@ -444,6 +445,8 @@ Learn more about the differences between various [Glimmer](https://github.com/An
444
445
 
445
446
  ## Setup
446
447
 
448
+ Note: the newest Ruby 3.3 is not fully supported yet.
449
+
447
450
  Install [glimmer-dsl-libui](https://rubygems.org/gems/glimmer-dsl-libui) gem directly into a [maintained Ruby version](https://www.ruby-lang.org/en/downloads/):
448
451
 
449
452
  ```
@@ -485,7 +488,7 @@ Afterwards, to access the Glimmer GUI DSL:
485
488
 
486
489
  You may learn more about the different options above with basic examples in the following subsections: [Experimentation Usage](#experimentation-usage), [Prototyping Usage](#prototyping-usage), [Serious Usage](#serious-usage).
487
490
 
488
- If you are new to [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) (beginner), after going through the subsections below, check out the RubyConf 2022 talk ["Building Native GUI Apps in Ruby"](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html), [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts), [Glimmer Style Guide](#glimmer-style-guide), [Glimmer Command](#glimmer-command) (just the basics, how to run an app, and how to run examples to start), [Girb](#girb-glimmer-irb) and [Examples](#examples) to quickly learn through copy/paste. It is very important for beginners to go through all the [Examples](#examples) from the most basic to the most advanced while reading the README topics that relate to the examples. Alternatively, beginners can learn from the RubyConf 2023 workshop ["How To Build Desktop Applications in Ruby"](https://github.com/AndyObtiva/how-to-build-desktop-applications-in-ruby), which includes 27 step-by-step exercises. You may refer to the [API](#api) once you have gotten your feet wet with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) and need a more detailed reference.
491
+ If you are new to [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) (beginner), after going through the subsections below, check out the RubyConf 2022 talk ["Building Native GUI Apps in Ruby"](https://andymaleh.blogspot.com/2023/02/rubyconf-2022-talk-video-for-building.html), [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts), [Glimmer Style Guide](#glimmer-style-guide), [Glimmer Command](#glimmer-command) (just the basics, how to run an app, and how to run examples to start), [Girb](#girb-glimmer-irb) and [Examples](#examples) to quickly learn through copy/paste. It is very important for beginners to go through all the [Examples](#examples) from the most basic to the most advanced while reading the README topics that relate to the examples. Alternatively, beginners can learn from the RubyConf 2023 workshop ["How To Build Desktop Applications in Ruby"](https://github.com/AndyObtiva/how-to-build-desktop-applications-in-ruby), which includes 27 step-by-step exercises. You may refer to the [API](#api) once you have gotten your feet wet with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui) and need a more detailed reference.
489
492
 
490
493
  If you encounter any issues with the documentation, get stuck with code you do not understand, or notice some out-of-date information, you may contact the project maintainers on the [Glimmer Gitter Chat](https://app.gitter.im/#/room/#AndyObtiva_glimmer:gitter.im). Also, this could be your opportunity to be a good steward of Open-Source Software by contributing a documentation fix in a GitHub Pull Request or reporting a GitHub Issue at least.
491
494
 
@@ -660,7 +663,7 @@ Mac | Windows | Linux
660
663
 
661
664
  Application scaffolding enables automatically generating the directories/files of a new desktop GUI application that follows the MVC architecture and can be packaged as a Ruby gem that includes an executable script for running the app conveniently. It also ensures that software engineers follow the recommended Glimmer DSL for LibUI conventions and best practices. Application Scaffolding greatly improves software engineering productivity when building desktop applications with [Glimmer DSL for LibUI](https://rubygems.org/gems/glimmer-dsl-libui).
662
665
 
663
- Application Scaffolding relies on the juwelier Ruby gem, which expects a local Git config of [`user.name`](https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git#setting-your-git-username-for-every-repository-on-your-computer) (git config --global user.name "FirstName LastName") and `github.user` (`git config --global github.user githubusername`).
666
+ Application Scaffolding relies on the juwelier Ruby gem, which expects a local Git config of [`user.name`](https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git#setting-your-git-username-for-every-repository-on-your-computer) (git config --global user.name "FirstName LastName") and `github.user` (`git config --global github.user githubusername`).
664
667
 
665
668
  Scaffold Glimmer DSL for LibUI application with this command:
666
669
 
@@ -1663,7 +1666,51 @@ form {
1663
1666
  }
1664
1667
  ```
1665
1668
 
1666
- The form above will only display fields for a model's customizable attributes, so if they change, the form content will change too. Learn more at the [Dynamic Form](/docs/examples/GLIMMER-DSL-LIBUI-ADVANCED-EXAMPLES.md#dynamic-form) example.
1669
+ The form above will only display fields for a model's customizable attributes, so if they change, the form content will change too.
1670
+
1671
+ If you need to rebuild (re-render) content upon changes to multiple model attributes, you can use the `computed_by` option.
1672
+
1673
+ Example:
1674
+
1675
+ ```ruby
1676
+ form {
1677
+ stretchy false
1678
+
1679
+ content(@user, :address, computed_by: [:street, :city, :zipcode]) {
1680
+ @user.address_attributes.each do |attribute|
1681
+ entry {
1682
+ label attribute.to_s.split('_').map(&:capitalize).join(' ')
1683
+ text <=> [@user, attribute]
1684
+ }
1685
+ end
1686
+ }
1687
+ }
1688
+ ```
1689
+
1690
+ Now, the content block will get called when changes occur to any of `User` `address` ,`street`, `city`, or `zipcode`.
1691
+
1692
+ If you do not have a main attribute that is computed by other attributes, you can leave the main attribute out while using `computed_by`.
1693
+
1694
+ Example:
1695
+
1696
+ ```ruby
1697
+ form {
1698
+ stretchy false
1699
+
1700
+ content(@user, computed_by: [:street, :city, :zipcode]) {
1701
+ @user.address_attributes.each do |attribute|
1702
+ entry {
1703
+ label attribute.to_s.split('_').map(&:capitalize).join(' ')
1704
+ text <=> [@user, attribute]
1705
+ }
1706
+ end
1707
+ }
1708
+ }
1709
+ ```
1710
+
1711
+ Now, the content block will get called (rerendered) when changes occur to any of `User` `street`, `city`, or `zipcode`.
1712
+
1713
+ Learn more about Content Data-Binding at the [Dynamic Form](/docs/examples/GLIMMER-DSL-LIBUI-ADVANCED-EXAMPLES.md#dynamic-form) example.
1667
1714
 
1668
1715
  **Property**: Control properties may be declared inside keyword blocks with lower-case underscored name followed by property value args (e.g. `title "hello world"` inside `group`). Behind the scenes, properties correspond to `LibUI.control_set_property` methods.
1669
1716
 
@@ -3791,17 +3838,20 @@ To learn more about the [LibUI](https://github.com/kojix2/LibUI) API exposed thr
3791
3838
 
3792
3839
  ## Packaging
3793
3840
 
3794
- I am documenting options for packaging, which I have not tried myself, but figured they would still be useful to add to the README.md until I can expand further effort into supporting packaging.
3841
+ If you are building a productivity tool to help with your work, then packaging the app as a Ruby gem would be a good enough solution (already supported via [Application Scaffolding](#scaffold-application)). Otherwise, I am documenting options for native executable packaging, which I have not tried myself, but figured they would still be useful to add to the README.md until I can expand further effort into supporting packaging.
3795
3842
 
3796
- For Windows, the [LibUI](https://github.com/kojix2/LibUI) project recommends [OCRA](https://github.com/larsch/ocra) (One-Click Ruby Application), which builds Windows executables from Ruby source. And, there is a newer fork of the project that supports newer versions of Ruby called [OCRAN](https://github.com/Largo/ocran).
3843
+ For Windows, [OCRAN](https://github.com/Largo/ocran) can build Windows executables from Ruby source code. It is a new maintained alternative version of [OCRA](https://github.com/larsch/ocra) (One-Click Ruby Application).
3797
3844
 
3798
- For Mac, consider [Platypus](https://github.com/sveinbjornt/Platypus) (builds a native Mac app from a Ruby script)
3845
+ For Mac, you can consider [Platypus](https://github.com/sveinbjornt/Platypus) (builds a native Mac app from a Ruby script) by following the tutorial ["Create a MacOS desktop application with pure Ruby"](https://dev.to/josephschito/create-macos-application-desktop-with-pure-ruby-tutorial-36io) by Joseph Schito.
3799
3846
 
3800
3847
  For Linux, simply package your app as a [Ruby Gem](https://guides.rubygems.org/what-is-a-gem/) and [build rpm package from Ruby Gem](https://www.redpill-linpro.com/sysadvent/2015/12/07/building-rpms-from-gems.html) or [build deb package from Ruby Gem](https://openpreservation.org/blogs/building-debian-package-ruby-program/).
3801
3848
 
3802
3849
  Also, there is a promising project called [ruby-packer](https://github.com/pmq20/ruby-packer) that supports all platforms.
3803
3850
 
3804
- Last but not least, Ruby recently supported WASM, including the ability to [package a Ruby application as a WASI application](https://github.com/ruby/ruby.wasm#quick-example-how-to-package-your-ruby-application-as-a-wasi-application).
3851
+ One more thing to note is that Ruby recently supported WASM, including the ability to [package a Ruby application as a WASI application](https://github.com/ruby/ruby.wasm#quick-example-how-to-package-your-ruby-application-as-a-wasi-application). You can explore combining that with [wasm2native](https://github.com/vshymanskyy/wasm2native) to produce cross-platform native executables.
3852
+
3853
+ Otherwise, if you really need comprehensive cross-platform native executable packaging support, consider using [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt), which does offer [cross-platform packaging support](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) for apps as MSI/EXE on Windows, APP/DMG/PKG on Mac, and DEB/RPM on Linux out of the box.
3854
+
3805
3855
 
3806
3856
  ## Glimmer Style Guide
3807
3857
 
@@ -4231,13 +4281,25 @@ This is built as an exploratory software prototype by [Ari Brown](https://github
4231
4281
 
4232
4282
  ### Adamantite
4233
4283
 
4234
- A local password manager written in Ruby (closed source software):
4284
+ A local password manager written in Ruby:
4235
4285
 
4236
4286
  https://rubygems.org/gems/adamantite
4237
4287
 
4238
4288
  ![Adamantite password manager](/images/glimmer-dsl-libui-mac-application-adamantite.png)
4239
4289
 
4240
- ## Process
4290
+ ## Design Principles
4291
+
4292
+ - The Ruby Way (including TIMTOWTDI: There Is More Than One Way To Do It)
4293
+ - Requiring the least amount of syntax possible to build GUI (Graphical User Interface)
4294
+ - Declarative syntax that visually maps to the GUI control hierarchy
4295
+ - Ability to mix declarative and imperative code conveniently without needing awkward & verbose technologies (e.g. no XML, HTML, ERB scriptlets, JSX)
4296
+ - Computers serve Software Engineers (not Software Engineers serve Computers)
4297
+ - Think only about real world concepts directly relevant to the GUI and interacting with it (no weird non-real-world irrelevant concepts like hooks/effects/immutability)
4298
+ - The Rails Way Convention over Configuration via smart defaults and automation of low-level details
4299
+ - Modular Software Design (e.g. support for Components)
4300
+ - No premature optimizations
4301
+
4302
+ ## Glimmer Process
4241
4303
 
4242
4304
  [Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
4243
4305
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.8
1
+ 0.11.9
Binary file
@@ -25,6 +25,7 @@ module Glimmer
25
25
  module DSL
26
26
  module Libui
27
27
  class ContentExpression < Expression
28
+ # TODO rename to ContentDataBindingExpression given it is no longer a static_expression (and update in dsl.rb)
28
29
  def can_interpret?(parent, keyword, *args, &block)
29
30
  keyword == 'content' &&
30
31
  block_given? &&
@@ -42,6 +42,7 @@ module Glimmer
42
42
  def transform(matrix = nil, &transform_body_block)
43
43
  if matrix.nil?
44
44
  if transform_body_block
45
+ # TODO Consider using alternate version of Engine call instead: Glimmer::DSL::Engine.interpret('transform', &transform_body_block) (or delete this comment if not needed)
45
46
  Glimmer::DSL::Engine.interpret_expression(Glimmer::DSL::Libui::ControlExpression.new, 'transform', &transform_body_block)
46
47
  else
47
48
  @transform
@@ -395,8 +395,9 @@ module Glimmer
395
395
  children.dup.each { |child| child.destroy }
396
396
  content(&content_block)
397
397
  end
398
+ model_binding_observer = Glimmer::DataBinding::ModelBinding.new(*binding_args)
398
399
  content_binding_observer = Glimmer::DataBinding::Observer.proc(&content_binding_work)
399
- content_binding_observer.observe(*binding_args)
400
+ content_binding_observer.observe(model_binding_observer)
400
401
  content_binding_work.call # TODO inspect if we need to pass args here (from observed attributes) [but it's simpler not to pass anything at first]
401
402
  end
402
403
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.8
4
+ version: 0.11.9
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-01-01 00:00:00.000000000 Z
11
+ date: 2024-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -640,7 +640,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
640
640
  - !ruby/object:Gem::Version
641
641
  version: '0'
642
642
  requirements: []
643
- rubygems_version: 3.5.3
643
+ rubygems_version: 3.4.10
644
644
  signing_key:
645
645
  specification_version: 4
646
646
  summary: Glimmer DSL for LibUI (Fukuoka Award Winning Prerequisite-Free Ruby Desktop