zui 0.0.3 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b437cb2eee1501deabbc6853a83301f78b34e54d05f1ad2914fc48fb9b561ad8
4
- data.tar.gz: 75c126ee0544f501ed5f2d3bcfe4fd81f2b58b515f291c9b2418b7c3ce315d8f
3
+ metadata.gz: '0999bab5076e4e21bf90ec3640b66299b922f06b5b1365f77a3e2c8535c4b483'
4
+ data.tar.gz: fdd3778327cc3fac59b2b3017e2b181bff8e6965cd88a34248b4204e2954b6d1
5
5
  SHA512:
6
- metadata.gz: '0804131d69ad1ad781bd0cd9281bfa643ca0b4671cea4561df1e66dae381d8c93e378430ea6023f81fc608e68f4a13adcde8607bcafa14727ac0ff9a4d026848'
7
- data.tar.gz: 89bb09706b1f9eda94de8c4c6fca5e8c63925eb796567dbbf00fd034ad472b26eb335008d31d1901bef0758fff1517a2cdda7825059c76ea8b4f62219171ad75
6
+ metadata.gz: 6742f765a1b83dd292971a800e84b4e83ddd0d7c69c9ec8b42dc921850a8f73a095c436118fa403d1dc90400535b7191bd61e844c8950e74e1c2ef98bf695cd3
7
+ data.tar.gz: 4d39a113ac0d61a0a2373101b79e5807c19642b657965675f77871f54cfcbf744dbb14f7b2501a9af3940d6c6d28bbd1f39cf7daa0bf07653780789e98dcc642
@@ -6,6 +6,13 @@ Item {
6
6
 
7
7
  required property var renderer
8
8
  required property string chartType
9
+ readonly property string requestedFontFamily: String(renderer.prop("font_family", renderer.fontFamily))
10
+
11
+ Text {
12
+ id: fontResolver
13
+ visible: false
14
+ font.family: chartRoot.requestedFontFamily
15
+ }
9
16
 
10
17
  function colors() {
11
18
  var result = renderer.prop("colors", []);
@@ -52,7 +59,8 @@ Item {
52
59
 
53
60
  function textStyle(ctx, color) {
54
61
  ctx.fillStyle = color || renderer.prop("label_color", renderer.foreground);
55
- ctx.font = Number(renderer.prop("font_size", 12)) + "px " + String(renderer.prop("font_family", renderer.fontFamily));
62
+ var resolvedFamily = String(fontResolver.fontInfo.family || chartRoot.requestedFontFamily);
63
+ ctx.font = Number(renderer.prop("font_size", 12)) + "px " + JSON.stringify(resolvedFamily);
56
64
  ctx.textAlign = "center";
57
65
  ctx.textBaseline = "middle";
58
66
  }
data/README.md CHANGED
@@ -23,18 +23,27 @@ Quickshell or an Omarchy installation.
23
23
  ```ruby
24
24
  require "zui"
25
25
 
26
- Zui.app do
27
- state :count, 0
28
-
29
- app :main, title: "Counter", width: 640, height: 420 do
30
- column spacing: 16 do
31
- label { "Count: #{state.count}" }
32
- button "Increment" do
33
- state.count += 1
26
+ module Counter
27
+ def self.run
28
+ Zui.app do
29
+ state :count, 0
30
+
31
+ app :main, title: "Counter", width: 640, height: 420 do
32
+ container padding: 24 do
33
+ column spacing: 16 do
34
+ label "Counter"
35
+ text { "Count: #{state.count}" }
36
+ button "Increment" do
37
+ state.count += 1
38
+ end
39
+ end
40
+ end
34
41
  end
35
42
  end
36
43
  end
37
44
  end
45
+
46
+ Counter.run
38
47
  ```
39
48
 
40
49
  ## Developer workflow
@@ -52,7 +61,7 @@ Build and install the gem directly from a checkout:
52
61
 
53
62
  ```bash
54
63
  gem build zui.gemspec
55
- gem install ./zui-0.0.3.gem
64
+ gem install ./zui-0.0.5.gem
56
65
  ```
57
66
 
58
67
  `zui doctor --fix` is the one-time setup for each Zui version and platform. It downloads the
data/lib/zui/builder.rb CHANGED
@@ -101,7 +101,11 @@ module Zui
101
101
  node
102
102
  end
103
103
 
104
- def label(value, id: nil, **props) = component(:label, id:, text: value.to_s, **props)
104
+ def label(value = UNSET, id: nil, **props, &reader)
105
+ node = component(:label, id:, **props)
106
+ bind_or_set(node, "text", value, reader)
107
+ node
108
+ end
105
109
  def rich_text(markup, id: nil, **props) = component(:rich_text, id:, text: markup.to_s, **props)
106
110
  def markdown(source, id: nil, **props) = component(:markdown, id:, text: source.to_s, **props)
107
111
  def selectable_text(value, id: nil, **props) = component(:selectable_text, id:, text: value.to_s, **props)
data/lib/zui.rb CHANGED
@@ -21,7 +21,7 @@ require_relative "zui/generator"
21
21
  require_relative "zui/distribution"
22
22
 
23
23
  module Zui
24
- VERSION = "0.0.3"
24
+ VERSION = "0.0.5"
25
25
  FRAMEWORK_ROOT = File.expand_path("..", __dir__)
26
26
 
27
27
  def self.app(&definition)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Moussa Ali