zui 0.0.2 → 0.0.4

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.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/Components/Builtins/Accordion.qml +1 -1
  3. data/Components/Builtins/ActionButton.qml +1 -3
  4. data/Components/Builtins/AlertDialog.qml +2 -1
  5. data/Components/Builtins/AnimatedImage.qml +0 -2
  6. data/Components/Builtins/AreaChart.qml +0 -2
  7. data/Components/Builtins/AspectRatio.qml +0 -2
  8. data/Components/Builtins/Avatar.qml +0 -2
  9. data/Components/Builtins/Badge.qml +0 -2
  10. data/Components/Builtins/Banner.qml +2 -2
  11. data/Components/Builtins/BarChart.qml +0 -2
  12. data/Components/Builtins/BarIconButton.qml +1 -3
  13. data/Components/Builtins/BarIndicator.qml +3 -3
  14. data/Components/Builtins/BorderImage.qml +0 -2
  15. data/Components/Builtins/BorderOverlay.qml +0 -2
  16. data/Components/Builtins/Breadcrumb.qml +2 -2
  17. data/Components/Builtins/Button.qml +1 -2
  18. data/Components/Builtins/ButtonGroup.qml +0 -2
  19. data/Components/Builtins/Card.qml +0 -2
  20. data/Components/Builtins/Center.qml +0 -2
  21. data/Components/Builtins/CheckDelegate.qml +2 -1
  22. data/Components/Builtins/Checkbox.qml +1 -3
  23. data/Components/Builtins/Chip.qml +2 -4
  24. data/Components/Builtins/Column.qml +0 -2
  25. data/Components/Builtins/ColumnLayout.qml +0 -2
  26. data/Components/Builtins/ConfirmDialog.qml +0 -2
  27. data/Components/Builtins/ConstrainedBox.qml +0 -2
  28. data/Components/Builtins/Container.qml +0 -2
  29. data/Components/Builtins/CursorSurface.qml +0 -2
  30. data/Components/Builtins/DelayButton.qml +0 -2
  31. data/Components/Builtins/Dial.qml +0 -2
  32. data/Components/Builtins/Divider.qml +0 -2
  33. data/Components/Builtins/Dropdown.qml +0 -2
  34. data/Components/Builtins/ExpansionPanel.qml +1 -1
  35. data/Components/Builtins/FittedBox.qml +0 -2
  36. data/Components/Builtins/Flickable.qml +0 -2
  37. data/Components/Builtins/Flipable.qml +0 -2
  38. data/Components/Builtins/Flow.qml +0 -2
  39. data/Components/Builtins/FocusScope.qml +0 -2
  40. data/Components/Builtins/FontLoader.qml +0 -2
  41. data/Components/Builtins/Grid.qml +0 -2
  42. data/Components/Builtins/GridLayout.qml +0 -2
  43. data/Components/Builtins/GridView.qml +1 -1
  44. data/Components/Builtins/Icon.qml +1 -3
  45. data/Components/Builtins/Image.qml +0 -2
  46. data/Components/Builtins/ItemDelegate.qml +2 -2
  47. data/Components/Builtins/KeyCatcher.qml +0 -2
  48. data/Components/Builtins/Label.qml +0 -2
  49. data/Components/Builtins/LineChart.qml +0 -2
  50. data/Components/Builtins/ListView.qml +1 -3
  51. data/Components/Builtins/Loader.qml +0 -2
  52. data/Components/Builtins/Markdown.qml +0 -2
  53. data/Components/Builtins/ModalSheet.qml +1 -1
  54. data/Components/Builtins/MultiSelect.qml +0 -2
  55. data/Components/Builtins/NavigationRail.qml +1 -1
  56. data/Components/Builtins/NumberField.qml +0 -2
  57. data/Components/Builtins/OpticalGlyph.qml +1 -3
  58. data/Components/Builtins/PanelHero.qml +0 -2
  59. data/Components/Builtins/PasswordField.qml +1 -3
  60. data/Components/Builtins/Progress.qml +0 -2
  61. data/Components/Builtins/RadioButton.qml +0 -2
  62. data/Components/Builtins/RadioGroup.qml +0 -2
  63. data/Components/Builtins/RangeSlider.qml +0 -2
  64. data/Components/Builtins/Rectangle.qml +0 -2
  65. data/Components/Builtins/RichText.qml +0 -2
  66. data/Components/Builtins/RoundButton.qml +3 -3
  67. data/Components/Builtins/Row.qml +0 -2
  68. data/Components/Builtins/RowLayout.qml +0 -2
  69. data/Components/Builtins/ScreenCapture.qml +1 -1
  70. data/Components/Builtins/Scroll.qml +0 -2
  71. data/Components/Builtins/SearchableDropdown.qml +0 -2
  72. data/Components/Builtins/SectionHeader.qml +0 -2
  73. data/Components/Builtins/SelectableText.qml +0 -2
  74. data/Components/Builtins/Separator.qml +0 -2
  75. data/Components/Builtins/Slider.qml +0 -2
  76. data/Components/Builtins/Spacer.qml +0 -2
  77. data/Components/Builtins/SpinBox.qml +0 -2
  78. data/Components/Builtins/SplitView.qml +0 -2
  79. data/Components/Builtins/Stack.qml +0 -2
  80. data/Components/Builtins/StackLayout.qml +0 -2
  81. data/Components/Builtins/SwipeDelegate.qml +3 -3
  82. data/Components/Builtins/TabButton.qml +1 -1
  83. data/Components/Builtins/Text.qml +0 -2
  84. data/Components/Builtins/TextArea.qml +0 -2
  85. data/Components/Builtins/TextField.qml +0 -2
  86. data/Components/Builtins/TextMetrics.qml +0 -2
  87. data/Components/Builtins/Toast.qml +1 -1
  88. data/Components/Builtins/Toggle.qml +0 -2
  89. data/Components/Builtins/ToggleSwitch.qml +0 -2
  90. data/Components/Builtins/ToolButton.qml +3 -3
  91. data/Components/Builtins/Tooltip.qml +0 -2
  92. data/Components/Builtins/VectorImage.qml +1 -2
  93. data/Components/Builtins/Video.qml +1 -2
  94. data/Components/Builtins/WidgetButton.qml +0 -2
  95. data/Components/Builtins/Wrap.qml +0 -2
  96. data/ControlNode.qml +10 -22
  97. data/Controls/BarIconButton.qml +1 -1
  98. data/Controls/BarIndicator.qml +1 -1
  99. data/Controls/Button.qml +2 -1
  100. data/Controls/OpticalGlyph.qml +1 -1
  101. data/Desktop.qml +7 -3
  102. data/Fonts/FontAwesome-Brands.otf +0 -0
  103. data/Fonts/FontAwesome-Solid.otf +0 -0
  104. data/Fonts/LICENSE-FontAwesome.txt +165 -0
  105. data/Fonts/LICENSE-RobotoMono.txt +93 -0
  106. data/Fonts/RobotoMono-Bold.otf +0 -0
  107. data/Fonts/RobotoMono-Regular.otf +0 -0
  108. data/README.md +19 -9
  109. data/Service.qml +30 -6
  110. data/THIRD_PARTY_NOTICES.md +14 -0
  111. data/Theme/Fonts.qml +32 -0
  112. data/Theme/Style.qml +1 -1
  113. data/Theme/qmldir +1 -0
  114. data/lib/zui/application.rb +28 -3
  115. data/lib/zui/builder.rb +5 -2
  116. data/lib/zui/components.rb +0 -1
  117. data/lib/zui/runtime.rb +1 -1
  118. data/lib/zui.rb +1 -1
  119. metadata +9 -2
  120. data/Components/Builtins/WebView.qml +0 -57
data/Desktop.qml CHANGED
@@ -46,7 +46,7 @@ QQC.ApplicationWindow {
46
46
  id: renderer
47
47
  anchors.fill: parent
48
48
  anchors.margins: Number(window.option("padding", 20))
49
- visible: window.activeSurface !== "" && service.rootId(window.activeSurface) !== ""
49
+ visible: Fonts.ready && window.activeSurface !== "" && service.rootId(window.activeSurface) !== ""
50
50
  bridge: service
51
51
  surfaceName: window.activeSurface
52
52
  controlId: service.rootId(surfaceName)
@@ -58,10 +58,14 @@ QQC.ApplicationWindow {
58
58
  anchors.centerIn: parent
59
59
  spacing: Style.spacing.sm
60
60
  visible: !renderer.visible
61
- QQC.BusyIndicator { anchors.horizontalCenter: parent.horizontalCenter; running: !service.ready && service.lastError === "" }
61
+ QQC.BusyIndicator {
62
+ anchors.horizontalCenter: parent.horizontalCenter
63
+ running: (!service.ready || !Fonts.ready) && service.lastError === "" && !Fonts.failed
64
+ }
62
65
  Text {
63
66
  anchors.horizontalCenter: parent.horizontalCenter
64
- text: service.lastError !== "" ? service.lastError : "Starting Zui…"
67
+ text: service.lastError !== "" ? service.lastError
68
+ : (Fonts.failed ? "Zui could not load its bundled fonts" : "Starting Zui…")
65
69
  color: Color.foreground
66
70
  font.family: Style.font.family
67
71
  font.pixelSize: Style.font.body
Binary file
Binary file
@@ -0,0 +1,165 @@
1
+ Fonticons, Inc. (https://fontawesome.com)
2
+
3
+ --------------------------------------------------------------------------------
4
+
5
+ Font Awesome Free License
6
+
7
+ Font Awesome Free is free, open source, and GPL friendly. You can use it for
8
+ commercial projects, open source projects, or really almost whatever you want.
9
+ Full Font Awesome Free license: https://fontawesome.com/license/free.
10
+
11
+ --------------------------------------------------------------------------------
12
+
13
+ # Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
14
+
15
+ The Font Awesome Free download is licensed under a Creative Commons
16
+ Attribution 4.0 International License and applies to all icons packaged
17
+ as SVG and JS file types.
18
+
19
+ --------------------------------------------------------------------------------
20
+
21
+ # Fonts: SIL OFL 1.1 License
22
+
23
+ In the Font Awesome Free download, the SIL OFL license applies to all icons
24
+ packaged as web and desktop font files.
25
+
26
+ Copyright (c) 2026 Fonticons, Inc. (https://fontawesome.com)
27
+ with Reserved Font Name: "Font Awesome".
28
+
29
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
30
+ This license is copied below, and is also available with a FAQ at:
31
+ http://scripts.sil.org/OFL
32
+
33
+ SIL OPEN FONT LICENSE
34
+ Version 1.1 - 26 February 2007
35
+
36
+ PREAMBLE
37
+ The goals of the Open Font License (OFL) are to stimulate worldwide
38
+ development of collaborative font projects, to support the font creation
39
+ efforts of academic and linguistic communities, and to provide a free and
40
+ open framework in which fonts may be shared and improved in partnership
41
+ with others.
42
+
43
+ The OFL allows the licensed fonts to be used, studied, modified and
44
+ redistributed freely as long as they are not sold by themselves. The
45
+ fonts, including any derivative works, can be bundled, embedded,
46
+ redistributed and/or sold with any software provided that any reserved
47
+ names are not used by derivative works. The fonts and derivatives,
48
+ however, cannot be released under any other type of license. The
49
+ requirement for fonts to remain under this license does not apply
50
+ to any document created using the fonts or their derivatives.
51
+
52
+ DEFINITIONS
53
+ "Font Software" refers to the set of files released by the Copyright
54
+ Holder(s) under this license and clearly marked as such. This may
55
+ include source files, build scripts and documentation.
56
+
57
+ "Reserved Font Name" refers to any names specified as such after the
58
+ copyright statement(s).
59
+
60
+ "Original Version" refers to the collection of Font Software components as
61
+ distributed by the Copyright Holder(s).
62
+
63
+ "Modified Version" refers to any derivative made by adding to, deleting,
64
+ or substituting — in part or in whole — any of the components of the
65
+ Original Version, by changing formats or by porting the Font Software to a
66
+ new environment.
67
+
68
+ "Author" refers to any designer, engineer, programmer, technical
69
+ writer or other person who contributed to the Font Software.
70
+
71
+ PERMISSION & CONDITIONS
72
+ Permission is hereby granted, free of charge, to any person obtaining
73
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
74
+ redistribute, and sell modified and unmodified copies of the Font
75
+ Software, subject to the following conditions:
76
+
77
+ 1) Neither the Font Software nor any of its individual components,
78
+ in Original or Modified Versions, may be sold by itself.
79
+
80
+ 2) Original or Modified Versions of the Font Software may be bundled,
81
+ redistributed and/or sold with any software, provided that each copy
82
+ contains the above copyright notice and this license. These can be
83
+ included either as stand-alone text files, human-readable headers or
84
+ in the appropriate machine-readable metadata fields within text or
85
+ binary files as long as those fields can be easily viewed by the user.
86
+
87
+ 3) No Modified Version of the Font Software may use the Reserved Font
88
+ Name(s) unless explicit written permission is granted by the corresponding
89
+ Copyright Holder. This restriction only applies to the primary font name as
90
+ presented to the users.
91
+
92
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
93
+ Software shall not be used to promote, endorse or advertise any
94
+ Modified Version, except to acknowledge the contribution(s) of the
95
+ Copyright Holder(s) and the Author(s) or with their explicit written
96
+ permission.
97
+
98
+ 5) The Font Software, modified or unmodified, in part or in whole,
99
+ must be distributed entirely under this license, and must not be
100
+ distributed under any other license. The requirement for fonts to
101
+ remain under this license does not apply to any document created
102
+ using the Font Software.
103
+
104
+ TERMINATION
105
+ This license becomes null and void if any of the above conditions are
106
+ not met.
107
+
108
+ DISCLAIMER
109
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
110
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
111
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
112
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
113
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
114
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
115
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
116
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
117
+ OTHER DEALINGS IN THE FONT SOFTWARE.
118
+
119
+ --------------------------------------------------------------------------------
120
+
121
+ # Code: MIT License (https://opensource.org/licenses/MIT)
122
+
123
+ In the Font Awesome Free download, the MIT license applies to all non-font and
124
+ non-icon files.
125
+
126
+ Copyright 2026 Fonticons, Inc.
127
+
128
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
129
+ this software and associated documentation files (the "Software"), to deal in the
130
+ Software without restriction, including without limitation the rights to use, copy,
131
+ modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
132
+ and to permit persons to whom the Software is furnished to do so, subject to the
133
+ following conditions:
134
+
135
+ The above copyright notice and this permission notice shall be included in all
136
+ copies or substantial portions of the Software.
137
+
138
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
139
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
140
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
141
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
142
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
143
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
144
+
145
+ --------------------------------------------------------------------------------
146
+
147
+ # Attribution
148
+
149
+ Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
150
+ Awesome Free files already contain embedded comments with sufficient
151
+ attribution, so you shouldn't need to do anything additional when using these
152
+ files normally.
153
+
154
+ We've kept attribution comments terse, so we ask that you do not actively work
155
+ to remove them from files, especially code. They're a great way for folks to
156
+ learn about Font Awesome.
157
+
158
+ --------------------------------------------------------------------------------
159
+
160
+ # Brand Icons
161
+
162
+ All brand icons are trademarks of their respective owners. The use of these
163
+ trademarks does not indicate endorsement of the trademark holder by Font
164
+ Awesome, nor vice versa. **Please do not use brand logos for any purpose except
165
+ to represent the company, product, or service to which they refer.**
@@ -0,0 +1,93 @@
1
+ Copyright 2015 The Roboto Mono Project Authors (https://github.com/googlefonts/robotomono)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://openfontlicense.org
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
Binary file
data/README.md CHANGED
@@ -4,6 +4,9 @@ Zui builds beautiful native desktop applications in pure Ruby, with first-class
4
4
  events, bindings, animation, media, GPU effects, 3D, and application logic. Applications are
5
5
  Ruby and assets—there is no application UI language to learn alongside Ruby.
6
6
 
7
+ Zui is desktop-only. Its native client intentionally excludes browser-engine payloads while
8
+ retaining the complete desktop component catalog.
9
+
7
10
  This repository is the reusable core. Distribution integrations live at its edges:
8
11
 
9
12
  - Linux and Windows desktop applications use the standalone Qt host.
@@ -20,18 +23,25 @@ Quickshell or an Omarchy installation.
20
23
  ```ruby
21
24
  require "zui"
22
25
 
23
- Zui.app do
24
- state :count, 0
25
-
26
- app :main, title: "Counter", width: 640, height: 420 do
27
- column spacing: 16 do
28
- label { "Count: #{state.count}" }
29
- button "Increment" do
30
- 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
+ column spacing: 16, padding: 24 do
33
+ label "Counter"
34
+ text { "Count: #{state.count}" }
35
+ button "Increment" do
36
+ state.count += 1
37
+ end
38
+ end
31
39
  end
32
40
  end
33
41
  end
34
42
  end
43
+
44
+ Counter.run
35
45
  ```
36
46
 
37
47
  ## Developer workflow
@@ -49,7 +59,7 @@ Build and install the gem directly from a checkout:
49
59
 
50
60
  ```bash
51
61
  gem build zui.gemspec
52
- gem install ./zui-0.0.2.gem
62
+ gem install ./zui-0.0.4.gem
53
63
  ```
54
64
 
55
65
  `zui doctor --fix` is the one-time setup for each Zui version and platform. It downloads the
data/Service.qml CHANGED
@@ -184,7 +184,17 @@ Item {
184
184
 
185
185
  function applyPatch(message) {
186
186
  if (!validId(message.id))
187
- return reject("invalid patch")
187
+ if (message.op !== "batch") return reject("invalid patch")
188
+ if (message.op === "batch") {
189
+ if (!Array.isArray(message.patches) || message.patches.length === 0 || message.patches.length > 256)
190
+ return reject("patch batch rejected")
191
+ for (var batchIndex = 0; batchIndex < message.patches.length; batchIndex++)
192
+ if (!validSetPatch(message.patches[batchIndex])) return reject("patch batch rejected")
193
+ for (var applyIndex = 0; applyIndex < message.patches.length; applyIndex++)
194
+ applySetPatch(message.patches[applyIndex], false)
195
+ revision += 1
196
+ return true
197
+ }
188
198
  var node = nodeIndex[message.id]
189
199
  if (!node) return reject("patch target rejected")
190
200
 
@@ -250,12 +260,25 @@ Item {
250
260
 
251
261
  if (message.op !== "set" || typeof message.property !== "string") return reject("invalid patch")
252
262
  if (!allowedProperties[node.type][message.property]) return reject("patch target rejected")
253
- var value = message.value
254
- if (!boundedValue(value, 0)) return reject("patch value rejected")
263
+ if (!boundedValue(message.value, 0)) return reject("patch value rejected")
264
+ if (message.animation !== undefined && !validAnimation(message.animation))
265
+ return reject("patch animation rejected")
266
+ return applySetPatch(message, true)
267
+ }
255
268
 
256
- var animation = message.animation
257
- if (animation !== undefined && !validAnimation(animation)) return reject("patch animation rejected")
269
+ function validSetPatch(message) {
270
+ if (!plainObject(message) || message.op !== "set" || !validId(message.id)
271
+ || typeof message.property !== "string") return false
272
+ var node = nodeIndex[message.id]
273
+ if (!node || !allowedProperties[node.type][message.property]) return false
274
+ if (!boundedValue(message.value, 0)) return false
275
+ return message.animation === undefined || validAnimation(message.animation)
276
+ }
258
277
 
278
+ function applySetPatch(message, incrementRevision) {
279
+ var node = nodeIndex[message.id]
280
+ var value = message.value
281
+ var animation = message.animation
259
282
  var replacement = ({ type: node.type, id: node.id })
260
283
  var props = ({})
261
284
  var oldProps = node.props || {}
@@ -280,7 +303,8 @@ Item {
280
303
  for (var id in nodeIndex) nextIndex[id] = nodeIndex[id]
281
304
  nextIndex[node.id] = replacement
282
305
  nodeIndex = nextIndex
283
- revision += 1
306
+ if (incrementRevision) revision += 1
307
+ return true
284
308
  }
285
309
 
286
310
  function validAnimation(animation) {
@@ -0,0 +1,14 @@
1
+ # Third-party notices
2
+
3
+ Zui includes the following fonts so applications render consistently on every
4
+ supported desktop platform:
5
+
6
+ - Roboto Mono Regular and Bold, copyright the Roboto Mono Project Authors,
7
+ licensed under the SIL Open Font License 1.1. The license is included at
8
+ `Fonts/LICENSE-RobotoMono.txt`.
9
+ - Font Awesome Free Solid and Brands, copyright Fonticons, Inc., licensed under the SIL
10
+ Open Font License 1.1. The license is included at
11
+ `Fonts/LICENSE-FontAwesome.txt`.
12
+
13
+ The fonts remain subject to their respective licenses. Zui's source code
14
+ remains licensed under the MIT License.
data/Theme/Fonts.qml ADDED
@@ -0,0 +1,32 @@
1
+ pragma Singleton
2
+ import QtQuick
3
+
4
+ QtObject {
5
+ readonly property FontLoader regularLoader: FontLoader {
6
+ source: Qt.resolvedUrl("../Fonts/RobotoMono-Regular.otf")
7
+ }
8
+ readonly property FontLoader boldLoader: FontLoader {
9
+ source: Qt.resolvedUrl("../Fonts/RobotoMono-Bold.otf")
10
+ }
11
+ readonly property FontLoader iconLoader: FontLoader {
12
+ source: Qt.resolvedUrl("../Fonts/FontAwesome-Solid.otf")
13
+ }
14
+ readonly property FontLoader brandIconLoader: FontLoader {
15
+ source: Qt.resolvedUrl("../Fonts/FontAwesome-Brands.otf")
16
+ }
17
+
18
+ readonly property string family: regularLoader.status === FontLoader.Ready
19
+ ? regularLoader.name : ""
20
+ readonly property string iconFamily: iconLoader.status === FontLoader.Ready
21
+ ? iconLoader.name : family
22
+ readonly property string brandIconFamily: brandIconLoader.status === FontLoader.Ready
23
+ ? brandIconLoader.name : iconFamily
24
+ readonly property bool ready: regularLoader.status === FontLoader.Ready
25
+ && boldLoader.status === FontLoader.Ready
26
+ && iconLoader.status === FontLoader.Ready
27
+ && brandIconLoader.status === FontLoader.Ready
28
+ readonly property bool failed: regularLoader.status === FontLoader.Error
29
+ || boldLoader.status === FontLoader.Error
30
+ || iconLoader.status === FontLoader.Error
31
+ || brandIconLoader.status === FontLoader.Error
32
+ }
data/Theme/Style.qml CHANGED
@@ -11,7 +11,7 @@ QtObject {
11
11
  function selectedFillFor(foreground, accent) { return Qt.rgba(accent.r, accent.g, accent.b, 0.22) }
12
12
 
13
13
  readonly property QtObject font: QtObject {
14
- readonly property string family: "Sans Serif"
14
+ readonly property string family: Fonts.family
15
15
  readonly property int caption: 11
16
16
  readonly property int bodySmall: 12
17
17
  readonly property int body: 14
data/Theme/qmldir CHANGED
@@ -1,5 +1,6 @@
1
1
  module Zui.Theme
2
2
  singleton Color 1.0 Color.qml
3
3
  singleton Style 1.0 Style.qml
4
+ singleton Fonts 1.0 Fonts.qml
4
5
  singleton Border 1.0 Border.qml
5
6
  singleton Util 1.0 Util.qml
@@ -19,6 +19,7 @@ module Zui
19
19
  @output = nil
20
20
  @error = $stderr
21
21
  @running = false
22
+ @patch_batch = nil
22
23
  @write_lock = Mutex.new
23
24
  @state_change_lock = Mutex.new
24
25
  @components = components.dup
@@ -174,13 +175,33 @@ module Zui
174
175
 
175
176
  def state_changed(_name, _previous, _value)
176
177
  @state_change_lock.synchronize do
177
- @structures.dup.each do |structure|
178
- reconcile_structure(structure) if @structures.include?(structure)
178
+ @patch_batch = []
179
+ begin
180
+ @structures.dup.each do |structure|
181
+ reconcile_structure(structure) if @structures.include?(structure)
182
+ end
183
+ @bindings.dup.each { |binding| update_binding(binding) }
184
+ ensure
185
+ patches = @patch_batch
186
+ @patch_batch = nil
179
187
  end
180
- @bindings.dup.each { |binding| update_binding(binding) }
188
+ flush_patch_batch(patches)
181
189
  end
182
190
  end
183
191
 
192
+ def flush_patch_batch(patches)
193
+ return if patches.empty?
194
+ return emit(patches.first) if patches.length == 1
195
+
196
+ batch = {
197
+ "v" => PROTOCOL_VERSION, "type" => "patch", "op" => "batch",
198
+ "patches" => patches.map { |patch| patch.reject { |key, _| %w[v type].include?(key) } }
199
+ }
200
+ return emit(batch) if JSON.generate(batch).bytesize <= MAX_MESSAGE_BYTES
201
+
202
+ patches.each { |patch| emit(patch) }
203
+ end
204
+
184
205
  def update_binding(binding)
185
206
  value = normalize_value(evaluate(binding.reader), binding.property)
186
207
  return if value == binding.last_value
@@ -302,6 +323,10 @@ module Zui
302
323
 
303
324
  def emit(message)
304
325
  return unless @running && @output
326
+ if @patch_batch && message["type"] == "patch" && message["op"] == "set"
327
+ @patch_batch << message
328
+ return
329
+ end
305
330
  encoded = JSON.generate(message)
306
331
  raise ProtocolError, "outgoing message exceeds #{MAX_MESSAGE_BYTES} bytes" if encoded.bytesize > MAX_MESSAGE_BYTES
307
332
  @write_lock.synchronize { @output.puts(encoded) }
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)
@@ -113,7 +117,6 @@ module Zui
113
117
  def model_view_3d(source, id: nil, **props) = component(:model_view_3d, id:, source: source.to_s, **props)
114
118
  def font_loader(source, id: nil, **props) = component(:font_loader, id:, source: source.to_s, **props)
115
119
  def text_metrics(value, id: nil, **props) = component(:text_metrics, id:, text: value.to_s, **props)
116
- def web_view(url = "", id: nil, **props) = component(:web_view, id:, url: url.to_s, **props)
117
120
  def animated_image(source, id: nil, **props) = component(:animated_image, id:, source: source.to_s, **props)
118
121
  def video(source, id: nil, **props) = component(:video, id:, source: source.to_s, **props)
119
122
  def audio(source, id: nil, **props) = component(:audio, id:, source: source.to_s, **props)
@@ -50,7 +50,6 @@ module Zui
50
50
  model_view_3d: [%i[source width height background rotation_x rotation_y rotation_z zoom minimum_zoom maximum_zoom interactive auto_rotate auto_rotate_speed reset_revision field_of_view camera_distance fit_size model_scale center_x center_y center_z key_light_color fill_light_color light_brightness antialiasing visible], %i[click double_click rotation_change zoom_change loaded error status], false],
51
51
  font_loader: [%i[source visible], %i[loaded error status], false],
52
52
  text_metrics: [%i[text font_family font_size bold italic letter_spacing word_spacing elide elide_width visible], %i[metrics], false],
53
- web_view: [%i[url html base_url width height zoom_factor background_color active_focus_on_press javascript_enabled local_storage_enabled auto_load_images full_screen_support command command_revision visible], %i[load_start load_progress load_success load_failure url_change title_change navigation full_screen permission new_window error], false],
54
53
  animated_image: [%i[source width height fill_mode playing paused speed asynchronous cache mirror smooth visible], %i[frame loaded error status], false],
55
54
  video: [%i[source width height auto_play loops volume muted playback_rate fill_mode orientation mirrored visible], %i[play pause stop error position duration], false],
56
55
  audio: [%i[source auto_play playback position seek_revision loops volume muted playback_rate visible], %i[play pause stop end loaded status error position duration], false],
data/lib/zui/runtime.rb CHANGED
@@ -7,7 +7,7 @@ module Zui
7
7
  module_function
8
8
 
9
9
  QML_FILES = %w[Desktop.qml Service.qml ControlNode.qml].freeze
10
- QML_DIRECTORIES = %w[Components Controls Theme].freeze
10
+ QML_DIRECTORIES = %w[Components Controls Theme Fonts].freeze
11
11
 
12
12
  def install_qml(destination, framework_root: FRAMEWORK_ROOT)
13
13
  FileUtils.mkdir_p(destination)
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.2"
24
+ VERSION = "0.0.4"
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.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Moussa Ali
@@ -265,7 +265,6 @@ files:
265
265
  - Components/Builtins/VerticalHeaderDelegate.qml
266
266
  - Components/Builtins/Video.qml
267
267
  - Components/Builtins/VideoOutput.qml
268
- - Components/Builtins/WebView.qml
269
268
  - Components/Builtins/WeekNumberColumn.qml
270
269
  - Components/Builtins/WidgetButton.qml
271
270
  - Components/Builtins/Window.qml
@@ -301,11 +300,19 @@ files:
301
300
  - Controls/WidgetButton.qml
302
301
  - Controls/qmldir
303
302
  - Desktop.qml
303
+ - Fonts/FontAwesome-Brands.otf
304
+ - Fonts/FontAwesome-Solid.otf
305
+ - Fonts/LICENSE-FontAwesome.txt
306
+ - Fonts/LICENSE-RobotoMono.txt
307
+ - Fonts/RobotoMono-Bold.otf
308
+ - Fonts/RobotoMono-Regular.otf
304
309
  - LICENSE
305
310
  - README.md
306
311
  - Service.qml
312
+ - THIRD_PARTY_NOTICES.md
307
313
  - Theme/Border.qml
308
314
  - Theme/Color.qml
315
+ - Theme/Fonts.qml
309
316
  - Theme/Style.qml
310
317
  - Theme/Util.qml
311
318
  - Theme/qmldir