zui 0.0.1

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 (325) hide show
  1. checksums.yaml +7 -0
  2. data/Components/Builtins/Accordion.qml +208 -0
  3. data/Components/Builtins/Action.qml +43 -0
  4. data/Components/Builtins/ActionButton.qml +19 -0
  5. data/Components/Builtins/ActionGroup.qml +81 -0
  6. data/Components/Builtins/AlertDialog.qml +398 -0
  7. data/Components/Builtins/AnchorAnimation.qml +3 -0
  8. data/Components/Builtins/AnchorChanges.qml +11 -0
  9. data/Components/Builtins/AnimatedImage.qml +39 -0
  10. data/Components/Builtins/Animation.qml +3 -0
  11. data/Components/Builtins/AnimationController.qml +11 -0
  12. data/Components/Builtins/ApplicationWindow.qml +103 -0
  13. data/Components/Builtins/AreaChart.qml +70 -0
  14. data/Components/Builtins/AspectRatio.qml +30 -0
  15. data/Components/Builtins/Audio.qml +85 -0
  16. data/Components/Builtins/AudioInput.qml +10 -0
  17. data/Components/Builtins/AudioOutput.qml +10 -0
  18. data/Components/Builtins/Avatar.qml +46 -0
  19. data/Components/Builtins/Badge.qml +38 -0
  20. data/Components/Builtins/Banner.qml +133 -0
  21. data/Components/Builtins/BarChart.qml +67 -0
  22. data/Components/Builtins/BarIconButton.qml +30 -0
  23. data/Components/Builtins/BarIndicator.qml +26 -0
  24. data/Components/Builtins/Behavior.qml +13 -0
  25. data/Components/Builtins/Blur.qml +14 -0
  26. data/Components/Builtins/BorderImage.qml +38 -0
  27. data/Components/Builtins/BorderOverlay.qml +25 -0
  28. data/Components/Builtins/BottomSheet.qml +211 -0
  29. data/Components/Builtins/Breadcrumb.qml +169 -0
  30. data/Components/Builtins/BubbleChart.qml +3 -0
  31. data/Components/Builtins/BusyIndicator.qml +24 -0
  32. data/Components/Builtins/Button.qml +55 -0
  33. data/Components/Builtins/ButtonGroup.qml +18 -0
  34. data/Components/Builtins/Calendar.qml +55 -0
  35. data/Components/Builtins/Camera.qml +18 -0
  36. data/Components/Builtins/CandlestickChart.qml +3 -0
  37. data/Components/Builtins/Canvas.qml +159 -0
  38. data/Components/Builtins/CaptureSession.qml +19 -0
  39. data/Components/Builtins/Card.qml +23 -0
  40. data/Components/Builtins/Carousel.qml +72 -0
  41. data/Components/Builtins/Center.qml +20 -0
  42. data/Components/Builtins/CheckDelegate.qml +132 -0
  43. data/Components/Builtins/Checkbox.qml +62 -0
  44. data/Components/Builtins/Chip.qml +65 -0
  45. data/Components/Builtins/Circle.qml +35 -0
  46. data/Components/Builtins/Clipboard.qml +29 -0
  47. data/Components/Builtins/ColorAnimation.qml +3 -0
  48. data/Components/Builtins/ColorPicker.qml +70 -0
  49. data/Components/Builtins/Colorize.qml +14 -0
  50. data/Components/Builtins/Column.qml +17 -0
  51. data/Components/Builtins/ColumnLayout.qml +13 -0
  52. data/Components/Builtins/ConfirmDialog.qml +20 -0
  53. data/Components/Builtins/ConstrainedBox.qml +28 -0
  54. data/Components/Builtins/Container.qml +30 -0
  55. data/Components/Builtins/ContextMenu.qml +140 -0
  56. data/Components/Builtins/CursorSurface.qml +18 -0
  57. data/Components/Builtins/DataTable.qml +69 -0
  58. data/Components/Builtins/DatePicker.qml +180 -0
  59. data/Components/Builtins/DayOfWeekRow.qml +11 -0
  60. data/Components/Builtins/DelayButton.qml +47 -0
  61. data/Components/Builtins/DelegateModel.qml +10 -0
  62. data/Components/Builtins/DelegateModelGroup.qml +10 -0
  63. data/Components/Builtins/Dial.qml +42 -0
  64. data/Components/Builtins/Dialog.qml +128 -0
  65. data/Components/Builtins/DialogButtonBox.qml +137 -0
  66. data/Components/Builtins/Divider.qml +26 -0
  67. data/Components/Builtins/DonutChart.qml +3 -0
  68. data/Components/Builtins/DoubleSpinBox.qml +58 -0
  69. data/Components/Builtins/DragArea.qml +43 -0
  70. data/Components/Builtins/Drawer.qml +107 -0
  71. data/Components/Builtins/DropArea.qml +19 -0
  72. data/Components/Builtins/DropShadow.qml +16 -0
  73. data/Components/Builtins/Dropdown.qml +19 -0
  74. data/Components/Builtins/ExpansionPanel.qml +157 -0
  75. data/Components/Builtins/FilePicker.qml +140 -0
  76. data/Components/Builtins/FittedBox.qml +40 -0
  77. data/Components/Builtins/Flickable.qml +40 -0
  78. data/Components/Builtins/Flipable.qml +45 -0
  79. data/Components/Builtins/Flow.qml +16 -0
  80. data/Components/Builtins/FocusScope.qml +29 -0
  81. data/Components/Builtins/FolderListModel.qml +9 -0
  82. data/Components/Builtins/FolderPicker.qml +93 -0
  83. data/Components/Builtins/FontLoader.qml +21 -0
  84. data/Components/Builtins/FontPicker.qml +91 -0
  85. data/Components/Builtins/Frame.qml +71 -0
  86. data/Components/Builtins/FrameAnimation.qml +13 -0
  87. data/Components/Builtins/Gauge.qml +3 -0
  88. data/Components/Builtins/Glow.qml +15 -0
  89. data/Components/Builtins/Gradient.qml +93 -0
  90. data/Components/Builtins/Grid.qml +16 -0
  91. data/Components/Builtins/GridLayout.qml +16 -0
  92. data/Components/Builtins/GridView.qml +226 -0
  93. data/Components/Builtins/GroupBox.qml +95 -0
  94. data/Components/Builtins/Heatmap.qml +3 -0
  95. data/Components/Builtins/Histogram.qml +3 -0
  96. data/Components/Builtins/HorizontalHeader.qml +23 -0
  97. data/Components/Builtins/HorizontalHeaderDelegate.qml +39 -0
  98. data/Components/Builtins/HoverArea.qml +19 -0
  99. data/Components/Builtins/Icon.qml +16 -0
  100. data/Components/Builtins/Image.qml +110 -0
  101. data/Components/Builtins/ImageCapture.qml +14 -0
  102. data/Components/Builtins/ItemDelegate.qml +152 -0
  103. data/Components/Builtins/KeyCatcher.qml +25 -0
  104. data/Components/Builtins/Label.qml +43 -0
  105. data/Components/Builtins/LayoutItemProxy.qml +51 -0
  106. data/Components/Builtins/Legend.qml +86 -0
  107. data/Components/Builtins/Line.qml +28 -0
  108. data/Components/Builtins/LineChart.qml +87 -0
  109. data/Components/Builtins/ListModel.qml +8 -0
  110. data/Components/Builtins/ListView.qml +65 -0
  111. data/Components/Builtins/Loader.qml +33 -0
  112. data/Components/Builtins/Markdown.qml +23 -0
  113. data/Components/Builtins/MediaDevices.qml +10 -0
  114. data/Components/Builtins/MediaPlayer.qml +27 -0
  115. data/Components/Builtins/MediaRecorder.qml +16 -0
  116. data/Components/Builtins/Menu.qml +119 -0
  117. data/Components/Builtins/MenuBar.qml +128 -0
  118. data/Components/Builtins/MenuItem.qml +77 -0
  119. data/Components/Builtins/MenuSeparator.qml +30 -0
  120. data/Components/Builtins/MessageDialog.qml +104 -0
  121. data/Components/Builtins/ModalSheet.qml +222 -0
  122. data/Components/Builtins/ModelView3d.qml +50 -0
  123. data/Components/Builtins/MonthGrid.qml +23 -0
  124. data/Components/Builtins/MultiEffect.qml +48 -0
  125. data/Components/Builtins/MultiSelect.qml +23 -0
  126. data/Components/Builtins/NavigationRail.qml +154 -0
  127. data/Components/Builtins/NumberAnimation.qml +3 -0
  128. data/Components/Builtins/NumberField.qml +18 -0
  129. data/Components/Builtins/OpacityAnimator.qml +3 -0
  130. data/Components/Builtins/OpacityMask.qml +21 -0
  131. data/Components/Builtins/OpticalGlyph.qml +16 -0
  132. data/Components/Builtins/Page.qml +111 -0
  133. data/Components/Builtins/PageIndicator.qml +63 -0
  134. data/Components/Builtins/Pagination.qml +158 -0
  135. data/Components/Builtins/Pane.qml +72 -0
  136. data/Components/Builtins/PanelHero.qml +15 -0
  137. data/Components/Builtins/ParallelAnimation.qml +3 -0
  138. data/Components/Builtins/ParentAnimation.qml +3 -0
  139. data/Components/Builtins/ParentChange.qml +10 -0
  140. data/Components/Builtins/ParticleSystem.qml +81 -0
  141. data/Components/Builtins/PasswordField.qml +58 -0
  142. data/Components/Builtins/Path.qml +35 -0
  143. data/Components/Builtins/PathAnimation.qml +3 -0
  144. data/Components/Builtins/PauseAnimation.qml +3 -0
  145. data/Components/Builtins/PieChart.qml +3 -0
  146. data/Components/Builtins/PinchArea.qml +23 -0
  147. data/Components/Builtins/Popup.qml +130 -0
  148. data/Components/Builtins/Progress.qml +15 -0
  149. data/Components/Builtins/ProgressRing.qml +120 -0
  150. data/Components/Builtins/PropertyAction.qml +11 -0
  151. data/Components/Builtins/PropertyAnimation.qml +3 -0
  152. data/Components/Builtins/PropertyChanges.qml +10 -0
  153. data/Components/Builtins/RadarChart.qml +3 -0
  154. data/Components/Builtins/RadialGauge.qml +3 -0
  155. data/Components/Builtins/RadioButton.qml +46 -0
  156. data/Components/Builtins/RadioDelegate.qml +115 -0
  157. data/Components/Builtins/RadioGroup.qml +58 -0
  158. data/Components/Builtins/RangeSlider.qml +39 -0
  159. data/Components/Builtins/Rectangle.qml +23 -0
  160. data/Components/Builtins/RectangularShadow.qml +23 -0
  161. data/Components/Builtins/ReorderableList.qml +204 -0
  162. data/Components/Builtins/RichText.qml +23 -0
  163. data/Components/Builtins/RotationAnimation.qml +3 -0
  164. data/Components/Builtins/RotationAnimator.qml +3 -0
  165. data/Components/Builtins/RoundButton.qml +42 -0
  166. data/Components/Builtins/Row.qml +17 -0
  167. data/Components/Builtins/RowLayout.qml +13 -0
  168. data/Components/Builtins/ScaleAnimator.qml +3 -0
  169. data/Components/Builtins/ScatterChart.qml +3 -0
  170. data/Components/Builtins/ScreenCapture.qml +78 -0
  171. data/Components/Builtins/ScriptAction.qml +15 -0
  172. data/Components/Builtins/Scroll.qml +18 -0
  173. data/Components/Builtins/ScrollBar.qml +18 -0
  174. data/Components/Builtins/ScrollIndicator.qml +15 -0
  175. data/Components/Builtins/SearchField.qml +178 -0
  176. data/Components/Builtins/SearchableDropdown.qml +21 -0
  177. data/Components/Builtins/SectionHeader.qml +14 -0
  178. data/Components/Builtins/SelectableText.qml +33 -0
  179. data/Components/Builtins/SelectionRectangle.qml +17 -0
  180. data/Components/Builtins/Separator.qml +13 -0
  181. data/Components/Builtins/SequentialAnimation.qml +3 -0
  182. data/Components/Builtins/Settings.qml +10 -0
  183. data/Components/Builtins/ShaderEffect.qml +115 -0
  184. data/Components/Builtins/ShaderEffectSource.qml +61 -0
  185. data/Components/Builtins/Shaders/grayscale.frag +14 -0
  186. data/Components/Builtins/Shaders/grayscale.frag.qsb +0 -0
  187. data/Components/Builtins/Shaders/passthrough.frag +11 -0
  188. data/Components/Builtins/Shaders/passthrough.frag.qsb +0 -0
  189. data/Components/Builtins/Shaders/pixelate.frag +16 -0
  190. data/Components/Builtins/Shaders/pixelate.frag.qsb +0 -0
  191. data/Components/Builtins/Shaders/vignette.frag +18 -0
  192. data/Components/Builtins/Shaders/vignette.frag.qsb +0 -0
  193. data/Components/Builtins/Shaders/wave.frag +18 -0
  194. data/Components/Builtins/Shaders/wave.frag.qsb +0 -0
  195. data/Components/Builtins/Shape.qml +53 -0
  196. data/Components/Builtins/Skeleton.qml +78 -0
  197. data/Components/Builtins/Slider.qml +21 -0
  198. data/Components/Builtins/SmoothedAnimation.qml +3 -0
  199. data/Components/Builtins/Snackbar.qml +181 -0
  200. data/Components/Builtins/SortFilterProxyModel.qml +16 -0
  201. data/Components/Builtins/SoundEffect.qml +10 -0
  202. data/Components/Builtins/Spacer.qml +13 -0
  203. data/Components/Builtins/Sparkline.qml +3 -0
  204. data/Components/Builtins/SpinBox.qml +44 -0
  205. data/Components/Builtins/SplitView.qml +31 -0
  206. data/Components/Builtins/SpringAnimation.qml +3 -0
  207. data/Components/Builtins/Stack.qml +14 -0
  208. data/Components/Builtins/StackLayout.qml +19 -0
  209. data/Components/Builtins/StackView.qml +122 -0
  210. data/Components/Builtins/StackedBarChart.qml +3 -0
  211. data/Components/Builtins/StandardPaths.qml +9 -0
  212. data/Components/Builtins/State.qml +13 -0
  213. data/Components/Builtins/StateGroup.qml +11 -0
  214. data/Components/Builtins/Support/AnimationDriver.qml +79 -0
  215. data/Components/Builtins/Support/AnimationGroupDriver.qml +32 -0
  216. data/Components/Builtins/Support/ChartCanvas.qml +629 -0
  217. data/Components/Builtins/Support/ModelView3dScene.qml +292 -0
  218. data/Components/Builtins/Support/OptionalModuleState.js +5 -0
  219. data/Components/Builtins/SwipeDelegate.qml +231 -0
  220. data/Components/Builtins/SwipeView.qml +69 -0
  221. data/Components/Builtins/SwitchDelegate.qml +140 -0
  222. data/Components/Builtins/TabBar.qml +117 -0
  223. data/Components/Builtins/TabButton.qml +105 -0
  224. data/Components/Builtins/TableView.qml +388 -0
  225. data/Components/Builtins/TableViewDelegate.qml +17 -0
  226. data/Components/Builtins/Tabs.qml +138 -0
  227. data/Components/Builtins/Text.qml +24 -0
  228. data/Components/Builtins/TextArea.qml +59 -0
  229. data/Components/Builtins/TextField.qml +21 -0
  230. data/Components/Builtins/TextMetrics.qml +39 -0
  231. data/Components/Builtins/TimePicker.qml +213 -0
  232. data/Components/Builtins/Timer.qml +13 -0
  233. data/Components/Builtins/Toast.qml +213 -0
  234. data/Components/Builtins/Toggle.qml +19 -0
  235. data/Components/Builtins/ToggleSwitch.qml +22 -0
  236. data/Components/Builtins/ToolBar.qml +61 -0
  237. data/Components/Builtins/ToolButton.qml +41 -0
  238. data/Components/Builtins/ToolSeparator.qml +36 -0
  239. data/Components/Builtins/Tooltip.qml +20 -0
  240. data/Components/Builtins/Transition.qml +3 -0
  241. data/Components/Builtins/TreeView.qml +423 -0
  242. data/Components/Builtins/TreeViewDelegate.qml +46 -0
  243. data/Components/Builtins/Tumbler.qml +18 -0
  244. data/Components/Builtins/UniformAnimator.qml +3 -0
  245. data/Components/Builtins/VectorAnimation.qml +3 -0
  246. data/Components/Builtins/VectorImage.qml +62 -0
  247. data/Components/Builtins/VerticalHeader.qml +21 -0
  248. data/Components/Builtins/VerticalHeaderDelegate.qml +35 -0
  249. data/Components/Builtins/Video.qml +54 -0
  250. data/Components/Builtins/VideoOutput.qml +54 -0
  251. data/Components/Builtins/WebView.qml +57 -0
  252. data/Components/Builtins/WeekNumberColumn.qml +13 -0
  253. data/Components/Builtins/WidgetButton.qml +26 -0
  254. data/Components/Builtins/Window.qml +90 -0
  255. data/Components/Builtins/WindowCapture.qml +11 -0
  256. data/Components/Builtins/Wrap.qml +18 -0
  257. data/Components/Builtins/XAnimator.qml +3 -0
  258. data/Components/Builtins/YAnimator.qml +3 -0
  259. data/Components/README.md +45 -0
  260. data/ControlNode.qml +1369 -0
  261. data/Controls/BarIconButton.qml +27 -0
  262. data/Controls/BarIndicator.qml +22 -0
  263. data/Controls/BorderOverlay.qml +10 -0
  264. data/Controls/BorderSurface.qml +10 -0
  265. data/Controls/Button.qml +78 -0
  266. data/Controls/ButtonGroup.qml +19 -0
  267. data/Controls/ConfirmDialog.qml +37 -0
  268. data/Controls/CursorSurface.qml +29 -0
  269. data/Controls/Dropdown.qml +59 -0
  270. data/Controls/MultiSelect.qml +32 -0
  271. data/Controls/NumberField.qml +24 -0
  272. data/Controls/OpticalGlyph.qml +14 -0
  273. data/Controls/PanelActionButton.qml +10 -0
  274. data/Controls/PanelHero.qml +18 -0
  275. data/Controls/PanelKeyCatcher.qml +25 -0
  276. data/Controls/PanelSectionHeader.qml +11 -0
  277. data/Controls/PanelSeparator.qml +10 -0
  278. data/Controls/PanelSlider.qml +36 -0
  279. data/Controls/PanelToolTip.qml +13 -0
  280. data/Controls/SearchableDropdown.qml +11 -0
  281. data/Controls/TextField.qml +25 -0
  282. data/Controls/Toggle.qml +22 -0
  283. data/Controls/ToggleSwitch.qml +26 -0
  284. data/Controls/WidgetButton.qml +35 -0
  285. data/Controls/qmldir +25 -0
  286. data/Desktop.qml +76 -0
  287. data/LICENSE +22 -0
  288. data/README.md +112 -0
  289. data/Service.qml +430 -0
  290. data/Theme/Border.qml +22 -0
  291. data/Theme/Color.qml +22 -0
  292. data/Theme/Style.qml +47 -0
  293. data/Theme/Util.qml +6 -0
  294. data/Theme/qmldir +5 -0
  295. data/bin/zui +7 -0
  296. data/lib/zui/animation.rb +24 -0
  297. data/lib/zui/application.rb +327 -0
  298. data/lib/zui/builder.rb +725 -0
  299. data/lib/zui/cli.rb +91 -0
  300. data/lib/zui/command.rb +101 -0
  301. data/lib/zui/component_registry.rb +91 -0
  302. data/lib/zui/components.rb +262 -0
  303. data/lib/zui/distribution.rb +200 -0
  304. data/lib/zui/generator.rb +84 -0
  305. data/lib/zui/host.rb +123 -0
  306. data/lib/zui/node.rb +30 -0
  307. data/lib/zui/platform.rb +40 -0
  308. data/lib/zui/protocol.rb +29 -0
  309. data/lib/zui/runner.rb +37 -0
  310. data/lib/zui/runtime.rb +23 -0
  311. data/lib/zui/scheduler.rb +136 -0
  312. data/lib/zui/source_bundle.rb +63 -0
  313. data/lib/zui/state_store.rb +100 -0
  314. data/lib/zui/value.rb +44 -0
  315. data/lib/zui.rb +33 -0
  316. data/native/CMakeLists.txt +45 -0
  317. data/native/ZuiClipboard.cpp +16 -0
  318. data/native/ZuiClipboard.h +16 -0
  319. data/native/ZuiProcess.cpp +84 -0
  320. data/native/ZuiProcess.h +34 -0
  321. data/native/main.cpp +64 -0
  322. data/vendor/host/linux-x86_64/PROVENANCE.md +15 -0
  323. data/vendor/host/linux-x86_64/zui-host +0 -0
  324. data/vendor/host/linux-x86_64/zui-host.sha256 +1 -0
  325. metadata +365 -0
data/lib/zui/cli.rb ADDED
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "rbconfig"
5
+
6
+ module Zui
7
+ class CLI
8
+ USAGE = "Usage: zui <new NAME|run FILE|bundle [DIRECTORY]|doctor|version>"
9
+
10
+ def self.run(arguments, out: $stdout, err: $stderr)
11
+ new(out:, err:).run(arguments.dup)
12
+ end
13
+
14
+ def initialize(out:, err:)
15
+ @out = out
16
+ @err = err
17
+ end
18
+
19
+ def run(arguments)
20
+ command = arguments.shift
21
+ case command
22
+ when "new" then new_project(arguments)
23
+ when "run" then run_file(arguments)
24
+ when "bundle" then bundle_project(arguments)
25
+ when "doctor" then doctor(arguments)
26
+ when "version", "--version", "-v" then @out.puts(VERSION); 0
27
+ else
28
+ @err.puts(USAGE)
29
+ command.nil? ? 0 : 64
30
+ end
31
+ rescue Interrupt
32
+ 130
33
+ rescue ArgumentError, SystemCallError, JSON::ParserError => error
34
+ @err.puts("zui: #{error.message}")
35
+ 1
36
+ end
37
+
38
+ private
39
+
40
+ def new_project(arguments)
41
+ name = arguments.shift || raise(ArgumentError, "new requires a project name")
42
+ raise ArgumentError, "new accepts only a project name" unless arguments.empty?
43
+ destination = File.expand_path(slug(name))
44
+ Generator.new(path: destination, name:).create
45
+ @out.puts("Created Zui application in #{destination}")
46
+ 0
47
+ end
48
+
49
+ def run_file(arguments)
50
+ file = File.expand_path(arguments.shift || raise(ArgumentError, "run requires a Ruby file"))
51
+ raise ArgumentError, "run accepts one Ruby file" unless arguments.empty?
52
+ Runner.new.run(file)
53
+ end
54
+
55
+ def bundle_project(arguments)
56
+ name = option_value(arguments, "--name")
57
+ destination = option_value(arguments, "--output")
58
+ source = File.expand_path(arguments.shift || Dir.pwd)
59
+ raise ArgumentError, "bundle accepts one directory" unless arguments.empty?
60
+ path = Distribution.new.bundle(source, name:, destination:)
61
+ @out.puts("Bundled #{Platform.current.os} application in #{path}")
62
+ 0
63
+ end
64
+
65
+ def doctor(arguments)
66
+ raise ArgumentError, "doctor accepts no arguments" unless arguments.empty?
67
+ platform = Platform.current
68
+ host = Host.new(platform:)
69
+ @out.puts("Zui #{VERSION}")
70
+ @out.puts("Platform: #{platform.id}#{platform.supported? ? '' : ' (unsupported)'}")
71
+ @out.puts("Ruby: #{RbConfig.ruby} (#{RUBY_VERSION})")
72
+ @out.puts("Host: #{host.executable(build: false) || 'not built'}") if platform.supported?
73
+ @out.puts("Qt build requirements: #{host.platform_help}") if platform.supported? && !host.available?
74
+ platform.supported? ? 0 : 1
75
+ end
76
+
77
+ def option_value(arguments, name)
78
+ index = arguments.index(name)
79
+ return nil unless index
80
+ raise ArgumentError, "#{name} requires a value" if index == arguments.length - 1
81
+ arguments.delete_at(index)
82
+ arguments.delete_at(index)
83
+ end
84
+
85
+ def slug(value)
86
+ result = value.to_s.downcase.gsub(/[^a-z0-9]+/, "-").gsub(/\A-|-\z/, "")
87
+ raise ArgumentError, "name must contain letters or numbers" if result.empty?
88
+ result
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "open3"
4
+ require "timeout"
5
+
6
+ module Zui
7
+ class CommandTimeout < StandardError; end
8
+ class CommandOutputLimit < StandardError; end
9
+
10
+ CommandResult = Struct.new(:stdout, :stderr, :status, keyword_init: true) do
11
+ def success? = status.success?
12
+ def exitstatus = status.exitstatus
13
+ end
14
+
15
+ module Command
16
+ module_function
17
+
18
+ DEFAULT_MAX_OUTPUT_BYTES = 1_048_576
19
+
20
+ def run(argv, env: {}, chdir: nil, input: "", timeout: nil, max_output_bytes: DEFAULT_MAX_OUTPUT_BYTES)
21
+ arguments = normalize_argv(argv)
22
+ output_limit = Integer(max_output_bytes)
23
+ raise ArgumentError, "max_output_bytes must be positive" unless output_limit.positive?
24
+ options = {}
25
+ options[:chdir] = File.expand_path(chdir) if chdir
26
+ stdin = stdout = stderr = wait_thread = nil
27
+ Open3.popen3(normalize_env(env), *arguments, **options) do |child_stdin, child_stdout, child_stderr, child_wait|
28
+ stdin, stdout, stderr, wait_thread = child_stdin, child_stdout, child_stderr, child_wait
29
+ stdin.write(input.to_s)
30
+ stdin.close
31
+ stdout_reader = Thread.new { bounded_read(stdout, output_limit) }
32
+ stderr_reader = Thread.new { bounded_read(stderr, output_limit) }
33
+ status = timeout ? Timeout.timeout(Float(timeout)) { wait_thread.value } : wait_thread.value
34
+ stdout_value, stdout_limited = stdout_reader.value
35
+ stderr_value, stderr_limited = stderr_reader.value
36
+ if stdout_limited || stderr_limited
37
+ raise CommandOutputLimit, "command output exceeded #{output_limit} bytes: #{arguments.first}"
38
+ end
39
+ return CommandResult.new(stdout: stdout_value, stderr: stderr_value, status:)
40
+ rescue Timeout::Error
41
+ terminate(wait_thread)
42
+ stdout_reader&.join(1)
43
+ stderr_reader&.join(1)
44
+ raise CommandTimeout, "command timed out after #{timeout}s: #{arguments.first}"
45
+ end
46
+ ensure
47
+ [stdin, stdout, stderr].each { |stream| stream&.close unless stream&.closed? }
48
+ end
49
+
50
+ def bounded_read(stream, limit)
51
+ output = +""
52
+ exceeded = false
53
+ loop do
54
+ chunk = stream.readpartial(16_384)
55
+ remaining = limit - output.bytesize
56
+ if remaining.positive?
57
+ output << chunk.byteslice(0, remaining)
58
+ exceeded = true if chunk.bytesize > remaining
59
+ else
60
+ exceeded = true
61
+ end
62
+ end
63
+ rescue EOFError
64
+ [output, exceeded]
65
+ end
66
+ private_class_method :bounded_read
67
+
68
+ def normalize_argv(argv)
69
+ raise ArgumentError, "command must be an argv array" unless argv.is_a?(Array) && !argv.empty?
70
+ argv.map do |argument|
71
+ raise ArgumentError, "command arguments must be strings" unless argument.is_a?(String)
72
+ raise ArgumentError, "command arguments cannot contain NUL" if argument.include?("\0")
73
+ argument
74
+ end
75
+ end
76
+ private_class_method :normalize_argv
77
+
78
+ def normalize_env(env)
79
+ raise ArgumentError, "command environment must be a hash" unless env.is_a?(Hash)
80
+ env.to_h { |key, value| [key.to_s, value.to_s] }
81
+ end
82
+ private_class_method :normalize_env
83
+
84
+ def terminate(wait_thread)
85
+ if RUBY_PLATFORM.match?(/mswin|mingw|cygwin/i)
86
+ Process.kill("KILL", wait_thread.pid)
87
+ wait_thread.value
88
+ return
89
+ end
90
+
91
+ Process.kill("TERM", wait_thread.pid)
92
+ Timeout.timeout(1) { wait_thread.value }
93
+ rescue Errno::ESRCH, Errno::ECHILD
94
+ nil
95
+ rescue Timeout::Error
96
+ Process.kill("KILL", wait_thread.pid)
97
+ wait_thread.value
98
+ end
99
+ private_class_method :terminate
100
+ end
101
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zui
4
+ Component = Struct.new(:name, :qml, :properties, :events, :property_map, :event_map, :container, :auto_bind, keyword_init: true) do
5
+ def to_h
6
+ {
7
+ "qml" => qml,
8
+ "properties" => properties.map(&:to_s),
9
+ "events" => events.map(&:to_s),
10
+ "property_map" => property_map.transform_keys(&:to_s).transform_values(&:to_s),
11
+ "event_map" => event_map.transform_keys(&:to_s).transform_values(&:to_s),
12
+ "container" => container,
13
+ "auto_bind" => auto_bind
14
+ }
15
+ end
16
+ end
17
+
18
+ class ComponentRegistry
19
+ QML_FILE = Object.new
20
+ def QML_FILE.match?(value)
21
+ text = value.to_s
22
+ stem = text.end_with?(".qml") ? text[0...-4] : ""
23
+ !stem.empty? && Zui::UPPER.include?(stem[0]) && stem.each_char.all? do |character|
24
+ (Zui::LOWER + Zui::UPPER + Zui::DIGITS).include?(character)
25
+ end
26
+ end
27
+ NAME = AsciiPattern.new(min: 1, max: 64, first: LOWER, rest: LOWER + DIGITS + "_")
28
+ ITEM_PROPERTIES = %i[
29
+ visible enabled opacity scale rotation z width height
30
+ fill_width fill_height preferred_width preferred_height
31
+ minimum_width minimum_height maximum_width maximum_height layout_alignment
32
+ ].freeze
33
+
34
+ def initialize
35
+ @components = {}
36
+ end
37
+
38
+ def register(name, qml:, properties: [], events: [], property_map: {}, event_map: {}, container: false, auto_bind: true)
39
+ key = name.to_sym
40
+ raise ArgumentError, "component already registered: #{key}" if @components.key?(key)
41
+ raise ArgumentError, "invalid component name: #{name.inspect}" unless NAME.match?(key.to_s)
42
+ raise ArgumentError, "invalid component adapter: #{qml.inspect}" unless QML_FILE.match?(qml.to_s)
43
+ property_names = (properties.map(&:to_sym) + property_map.keys.map(&:to_sym) + ITEM_PROPERTIES).uniq
44
+ event_names = (events.map(&:to_sym) + event_map.keys.map(&:to_sym)).uniq
45
+ normalized_property_map = properties.to_h { |property| [property.to_sym, property.to_sym] }
46
+ normalized_property_map.merge!(property_map.to_h { |key, value| [key.to_sym, value.to_sym] })
47
+ normalized_event_map = events.to_h { |event| [event.to_sym, event.to_sym] }
48
+ normalized_event_map.merge!(event_map.to_h { |key, value| [key.to_sym, value.to_sym] })
49
+ invalid_property = property_names.find { |property| !NAME.match?(property.to_s) }
50
+ invalid_event = event_names.find { |event| !NAME.match?(event.to_s) }
51
+ raise ArgumentError, "invalid property name: #{invalid_property.inspect}" if invalid_property
52
+ raise ArgumentError, "invalid event name: #{invalid_event.inspect}" if invalid_event
53
+ invalid_target = (normalized_property_map.values + normalized_event_map.values).find { |target| !NAME.match?(target.to_s) }
54
+ raise ArgumentError, "invalid QML member name: #{invalid_target.inspect}" if invalid_target
55
+
56
+ @components[key] = Component.new(
57
+ name: key,
58
+ qml: qml.to_s,
59
+ properties: property_names.uniq.freeze,
60
+ events: event_names.uniq.freeze,
61
+ property_map: normalized_property_map.freeze,
62
+ event_map: normalized_event_map.freeze,
63
+ container: !!container,
64
+ auto_bind: !!auto_bind
65
+ )
66
+ end
67
+
68
+ def fetch(name)
69
+ @components.fetch(name.to_sym) { raise ArgumentError, "unknown component: #{name}" }
70
+ end
71
+
72
+ def key?(name)
73
+ @components.key?(name.to_sym)
74
+ end
75
+
76
+ def protocol_schema
77
+ @components.transform_keys(&:to_s).transform_values(&:to_h)
78
+ end
79
+
80
+ def dup
81
+ copy = self.class.new
82
+ @components.each_value do |component|
83
+ copy.register(component.name, qml: component.qml, properties: component.properties,
84
+ events: component.events, property_map: component.property_map,
85
+ event_map: component.event_map, container: component.container,
86
+ auto_bind: component.auto_bind)
87
+ end
88
+ copy
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,262 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Zui
4
+ ICON_NAMES = %i[
5
+ ruby phone plus minus reset refresh house gear search xmark check menu user bell wifi bluetooth
6
+ volume_high volume_low volume_off play pause stop trash edit folder file download upload link lock
7
+ unlock eye eye_slash star heart info warning circle_info circle_check circle_xmark arrow_left
8
+ arrow_right arrow_up arrow_down chevron_left chevron_right chevron_up chevron_down calendar clock
9
+ camera image music terminal code copy save power globe location pin android apple
10
+ ].freeze
11
+
12
+ COMPONENTS = {
13
+ container: [%i[spacing padding bordered visible], %i[click], true],
14
+ row: [%i[spacing alignment visible], %i[click], true],
15
+ column: [%i[spacing alignment visible], %i[click], true],
16
+ grid: [%i[columns rows spacing row_spacing column_spacing visible], %i[click], true],
17
+ row_layout: [%i[spacing alignment visible], %i[click], true],
18
+ column_layout: [%i[spacing alignment visible], %i[click], true],
19
+ grid_layout: [%i[columns rows spacing row_spacing column_spacing alignment visible], %i[click], true],
20
+ flow: [%i[spacing orientation width height visible], %i[click], true],
21
+ center: [%i[padding spacing visible], %i[click], true],
22
+ card: [%i[padding spacing color radius border_color accent visible], %i[click], true],
23
+ stack: [%i[visible], %i[click], true],
24
+ scroll: [%i[width height clip visible], %i[click], true],
25
+ rectangle: [%i[width height color radius border_color border_width padding visible], %i[click], true],
26
+ border_overlay: [%i[color width_spec gradient_colors gradient_angle radius visible], [], false],
27
+ aspect_ratio: [%i[ratio width height clip visible], %i[click], true],
28
+ constrained_box: [%i[width height min_width min_height max_width max_height clip visible], %i[click], true],
29
+ fitted_box: [%i[width height fit alignment clip visible], %i[click], true],
30
+ wrap: [%i[width height spacing orientation layout_direction visible], %i[click], true],
31
+ split_view: [%i[width height orientation visible], %i[click resize], true],
32
+ stack_layout: [%i[current_index width height visible], %i[click change], true],
33
+ layout_item_proxy: [%i[target width height fill_width fill_height preferred_width preferred_height minimum_width minimum_height maximum_width maximum_height alignment margins left_margin top_margin right_margin bottom_margin visible], %i[target_change], false],
34
+ loader: [%i[active asynchronous width height visible], %i[click loaded status error], true],
35
+ flickable: [%i[width height content_width content_height direction bounds_behavior interactive clip visible], %i[click scroll flick_start flick_end], true],
36
+ focus_scope: [%i[focus active_focus width height visible], %i[click focus blur], true],
37
+ flipable: [%i[flipped axis duration easing interactive width height visible], %i[click change], true],
38
+ border_image: [%i[source width height border_left border_top border_right border_bottom horizontal_tile vertical_tile asynchronous cache mirror smooth visible], %i[click loaded error status], true],
39
+ window: [%i[title x y width height minimum_width minimum_height maximum_width maximum_height color visible visibility modality flags opacity content_orientation], %i[close visible_change active_change visibility_change move resize], true],
40
+ application_window: [%i[title x y width height minimum_width minimum_height maximum_width maximum_height color background visible visibility modality flags opacity content_orientation layout_direction font_family font_size], %i[close visible_change active_change visibility_change move resize focus_change], true],
41
+ text: [%i[text style size bold color wrap width visible], [], false],
42
+ label: [%i[text color size bold width wrap elide horizontal_alignment vertical_alignment maximum_lines format visible], %i[link], false],
43
+ rich_text: [%i[text color link_color size bold width wrap maximum_lines visible], %i[link], false],
44
+ markdown: [%i[text color link_color size width wrap maximum_lines base_url visible], %i[link], false],
45
+ selectable_text: [%i[text color selection_color selected_text_color size bold width wrap format visible], %i[selection link], false],
46
+ icon: [%i[name text size color visible], [], false],
47
+ tooltip: [%i[text delay timeout foreground background border font_family font_size visible], [], false],
48
+ image: [%i[source width height source_width source_height fill_mode horizontal_alignment vertical_alignment asynchronous cache smooth mipmap mirror auto_transform retain_while_loading visible], %i[progress status loaded error], false],
49
+ vector_image: [%i[source width height fill_mode renderer trusted asynchronous_shapes animation_loops animation_paused visible], %i[source_change], false],
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
+ font_loader: [%i[source visible], %i[loaded error status], false],
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
+ animated_image: [%i[source width height fill_mode playing paused speed asynchronous cache mirror smooth visible], %i[frame loaded error status], false],
55
+ 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
+ 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],
57
+ avatar: [%i[source name size radius background foreground font_size asynchronous cache visible], %i[click loaded error], false],
58
+ badge: [%i[value maximum dot size minimum_width padding background foreground font_size visible], %i[click], false],
59
+ chip: [%i[text icon selected deletable enabled background selected_background foreground selected_foreground accent height radius horizontal_padding spacing font_size icon_size visible], %i[click change delete], false],
60
+ spacer: [%i[width height visible], [], false],
61
+ button: [%i[text url icon tooltip selected active cursor focusable bordered foreground background accent font_family font_size icon_size icon_rotation icon_spinning horizontal_padding vertical_padding left_align tooltip_background tooltip_foreground tooltip_border], %i[click open error right_click hover], false],
62
+ round_button: [%i[text icon checked checkable enabled diameter foreground background checked_background accent font_family font_size icon_size visible], %i[click change press release hover], false],
63
+ tool_button: [%i[text icon checked checkable enabled width height foreground background checked_background accent font_family font_size icon_size visible], %i[click change press release hover], false],
64
+ delay_button: [%i[text delay enabled width height foreground background progress_background accent font_family font_size visible], %i[activate progress press release cancel], false],
65
+ action_button: [%i[icon tooltip foreground hover_color font_family font_size size focusable cursor bordered], %i[click hover], false],
66
+ bar_icon_button: [%i[icon tooltip active foreground active_color slot_size optical_size font_family font_size text_rotation keep_space dimmed concealed interactive], %i[click right_click middle_click wheel], false],
67
+ bar_indicator: [%i[active active_icon inactive_icon active_tooltip inactive_tooltip indicator_block foreground active_color font_family font_size], %i[click right_click middle_click wheel], false],
68
+ toggle: [%i[label description checked cursor rounded foreground accent font_family title_size description_size], %i[change hover], false],
69
+ checkbox: [%i[label checked foreground accent background font_family font_size indicator_size spacing cursor], %i[change hover], false],
70
+ radio_button: [%i[label value checked enabled foreground accent background font_family font_size indicator_size spacing visible], %i[click change hover], false],
71
+ radio_group: [%i[value options orientation spacing enabled foreground accent background font_family font_size indicator_size item_spacing visible], %i[change hover], false],
72
+ toggle_switch: [%i[checked busy interactive cursor cursor_ring cursor_pad rounded foreground accent track_height track_width knob_size knob_inset], %i[change hover], false],
73
+ text_field: [%i[text placeholder password foreground accent selection_tint horizontal_padding vertical_padding cursor], %i[change submit focus blur input], false],
74
+ text_area: [%i[text placeholder width height wrap read_only maximum_length foreground background accent selection_tint font_family font_size padding visible], %i[input change focus blur selection], false],
75
+ search_field: [%i[text suggestions text_role live current_index width enabled foreground background accent font_family font_size visible], %i[input change search submit activate highlight clear focus blur], false],
76
+ password_field: [%i[text placeholder revealable revealed width foreground accent selection_tint horizontal_padding vertical_padding visible], %i[input change submit focus blur reveal], false],
77
+ number_field: [%i[label value from to step foreground accent font_family font_size field_width cursor], %i[change hover], false],
78
+ slider: [%i[value minimum maximum step integer track_color fill_color knob_color track_height knob_size ticks tick_color], %i[input change right_click], false],
79
+ range_slider: [%i[lower upper minimum maximum step orientation snap live width height foreground background accent visible], %i[input change], false],
80
+ dial: [%i[value minimum maximum step start_angle end_angle snap wrap live input_mode size foreground background accent visible], %i[input change press release], false],
81
+ spin_box: [%i[value minimum maximum step editable wrap prefix suffix width enabled foreground background accent font_family font_size visible], %i[change increase decrease], false],
82
+ double_spin_box: [%i[value minimum maximum step decimals editable wrap prefix suffix width enabled foreground background accent font_family font_size visible], %i[change increase decrease], false],
83
+ color_picker: [%i[color label title opened show_alpha no_buttons native_dialog width height enabled foreground background border_color radius font_family font_size visible], %i[input change accept reject open close], false],
84
+ date_picker: [%i[date label placeholder format minimum maximum opened close_on_select width height popup_width enabled foreground muted background popup_background border_color accent radius font_family font_size visible], %i[input change open close navigate], false],
85
+ time_picker: [%i[time label placeholder use_24_hour show_seconds minute_step second_step opened accept_text cancel_text width height popup_width enabled foreground muted background popup_background border_color accent radius font_family font_size visible], %i[input change accept reject open close], false],
86
+ file_picker: [%i[path paths label placeholder title mode multiple filters current_folder default_suffix opened native_dialog accept_text cancel_text width height enabled foreground muted background border_color accent radius font_family font_size visible], %i[input change accept reject open close folder_change], false],
87
+ folder_picker: [%i[path label placeholder title current_folder opened native_dialog accept_text cancel_text width height enabled foreground muted background border_color accent radius font_family font_size visible], %i[input change accept reject open close folder_change], false],
88
+ font_picker: [%i[family label placeholder title point_size pixel_size weight italic underline strikeout opened native_dialog width height enabled foreground muted background border_color accent radius font_family font_size visible], %i[input change accept reject open close], false],
89
+ dialog_button_box: [%i[buttons custom_buttons orientation alignment position centered spacing width height enabled foreground background accent font_family font_size visible], %i[click accept reject help], false],
90
+ action: [%i[text icon icon_source icon_color icon_width icon_height enabled checkable checked shortcut visible], %i[trigger toggle change], false],
91
+ action_group: [%i[action_ids exclusive enabled checked_action visible], %i[trigger change actions_change], false],
92
+ page: [%i[title header_text footer_text show_header show_footer header_height footer_height layout spacing padding width height enabled background header_background footer_background foreground muted border_color radius font_family font_size title_size footer_size layout_direction visible], %i[click show hide focus blur title_change], true],
93
+ pane: [%i[layout spacing padding left_padding right_padding top_padding bottom_padding width height enabled background foreground border_color border_width radius layout_direction clip visible], %i[click show hide focus blur], true],
94
+ frame: [%i[layout spacing padding left_padding right_padding top_padding bottom_padding width height enabled background foreground border_color border_width radius layout_direction clip visible], %i[click show hide focus blur], true],
95
+ group_box: [%i[title layout spacing padding left_padding right_padding top_padding bottom_padding width height enabled background foreground muted border_color border_width radius font_family font_size title_size title_alignment layout_direction clip visible], %i[click show hide focus blur title_change], true],
96
+ tabs: [%i[labels current_index position tab_width tab_height width height enabled background content_background foreground muted accent border_color radius font_family font_size layout_direction visible], %i[input change tab_click show hide focus blur], true],
97
+ tab_bar: [%i[items current_index position spacing tab_width width height enabled background foreground muted accent border_color radius font_family font_size layout_direction visible], %i[input change tab_click show hide focus blur], false],
98
+ tab_button: [%i[text checked enabled icon icon_source icon_color icon_width icon_height shortcut auto_exclusive width height background checked_background foreground checked_foreground muted accent border_color border_width radius font_family font_size visible], %i[click change toggle press release hover focus blur error], false],
99
+ page_indicator: [%i[count current_index interactive spacing dot_size width height enabled background foreground accent radius visible], %i[input change show hide focus blur], false],
100
+ stack_view: [%i[current_index animated width height enabled background border_color radius clip visible], %i[change push pop depth_change busy_change show hide focus blur], true],
101
+ swipe_view: [%i[current_index orientation interactive width height enabled background border_color radius clip layout_direction visible], %i[input change count_change show hide focus blur], true],
102
+ drawer: [%i[opened edge modal dim interactive drag_margin close_policy layout spacing padding width height enabled background foreground border_color radius visible], %i[open close about_to_show about_to_hide position_change show hide focus blur], true],
103
+ navigation_rail: [%i[items current_index extended alignment spacing padding item_height width height enabled background foreground muted accent selected_background border_color radius font_family font_size icon_size visible], %i[input change select show hide focus blur error], false],
104
+ breadcrumb: [%i[items current_index separator spacing padding item_height width height enabled background foreground muted accent border_color radius font_family font_size icon_size visible], %i[input change select show hide focus blur error], false],
105
+ pagination: [%i[count page sibling_count show_first_last show_previous_next previous_text next_text first_text last_text spacing padding item_size width height enabled background foreground muted accent selected_background border_color radius font_family font_size visible], %i[input change select previous next first last show hide focus blur], false],
106
+ expansion_panel: [%i[title subtitle expanded animated duration easing spacing padding header_height width height enabled background header_background expanded_background foreground muted accent border_color radius font_family font_size title_size subtitle_size indicator_size visible], %i[toggle change expand collapse show hide focus blur], true],
107
+ accordion: [%i[titles subtitles expanded_indices multiple animated duration easing spacing padding header_height width height enabled background header_background expanded_background foreground muted accent border_color radius font_family font_size title_size subtitle_size indicator_size visible], %i[toggle change expand collapse show hide focus blur], true],
108
+ tool_bar: [%i[position layout spacing padding width height enabled background foreground border_color radius layout_direction visible], %i[click position_change show hide focus blur], true],
109
+ tool_separator: [%i[orientation thickness length padding color opacity enabled visible], %i[show hide], false],
110
+ menu: [%i[items title opened x y width modal close_policy enabled background foreground muted accent border_color radius font_family font_size visible], %i[trigger toggle open close about_to_show about_to_hide highlight], false],
111
+ menu_item: [%i[text value icon icon_source icon_color shortcut enabled checkable checked highlighted width height background highlighted_background foreground highlighted_foreground muted accent border_color radius font_family font_size visible], %i[trigger toggle change press release hover highlight focus blur], false],
112
+ menu_separator: [%i[thickness width height padding color opacity enabled visible], %i[show hide], false],
113
+ menu_bar: [%i[menus width height spacing padding enabled background foreground muted accent border_color radius font_family font_size visible], %i[trigger toggle highlight menu_open menu_close show hide focus blur], false],
114
+ context_menu: [%i[items target opened x y activation_width activation_height width modal close_policy enabled background foreground muted accent border_color radius font_family font_size visible], %i[request trigger toggle highlight open close about_to_show about_to_hide], false],
115
+ popup: [%i[opened x y width height modal dim focus close_policy layout spacing padding animated duration easing enabled background foreground border_color radius visible], %i[open close about_to_show about_to_hide show hide focus blur position_change], true],
116
+ dialog: [%i[title opened centered x y width height modal dim focus close_policy standard_buttons layout spacing padding enabled background foreground border_color radius font_family font_size visible], %i[accept reject apply reset discard help open close about_to_show about_to_hide show hide focus blur], true],
117
+ alert_dialog: [%i[title message informative_text detailed_text severity icon icon_size icon_foreground show_icon image image_source image_width image_height image_fill_mode image_radius image_asynchronous image_cache opened centered x y width height header_height footer_height details_height modal dim focus close_policy standard_buttons button_labels button_alignment button_spacing button_background button_foreground button_accent button_horizontal_padding button_vertical_padding spacing padding enabled background header_background footer_background foreground muted accent warning_color error_color success_color border_color radius font_family font_size title_size message_size details_size visible], %i[accept reject apply reset discard help open close about_to_show about_to_hide show hide focus blur error], false],
118
+ message_dialog: [%i[title message informative_text detailed_text opened buttons modality visible], %i[button accept reject open close], false],
119
+ bottom_sheet: [%i[opened modal dim dismissible draggable close_policy layout spacing padding width height max_width margin handle_visible handle_width handle_height dismiss_threshold animated duration easing enabled background foreground muted accent border_color radius visible], %i[open close about_to_show about_to_hide show hide focus blur drag drag_end dismiss], true],
120
+ modal_sheet: [%i[title opened edge modal dim dismissible close_policy show_header show_close width height max_width max_height margin header_height layout spacing padding animated duration easing enabled background header_background foreground muted accent border_color radius font_family font_size title_size visible], %i[open close dismiss about_to_show about_to_hide show hide focus blur], true],
121
+ snackbar: [%i[message action_text opened duration persistent pause_on_hover close_on_action position width max_width margin spacing padding animated animation_duration easing enabled background foreground action_color border_color radius font_family font_size visible], %i[action timeout dismiss open close show hide hover], false],
122
+ banner: [%i[title message severity icon action_text dismissible width height spacing padding enabled background foreground muted accent warning_color error_color success_color action_color border_color radius font_family font_size title_size icon_size visible], %i[action dismiss click show hide hover focus blur], false],
123
+ toast: [%i[title message severity icon opened duration persistent pause_on_hover dismiss_on_click position width max_width margin spacing padding animated animation_duration easing enabled background foreground muted accent warning_color error_color success_color border_color radius font_family font_size title_size icon_size visible], %i[timeout dismiss click open close show hide hover], false],
124
+ busy_indicator: [%i[running width height color opacity enabled accessible_name visible], %i[running_change show hide], false],
125
+ progress_ring: [%i[value minimum maximum indeterminate size width height thickness track_color color foreground start_angle clockwise show_label label label_format animated duration easing enabled opacity font_family font_size accessible_name visible], %i[value_change show hide], false],
126
+ skeleton: [%i[variant width height lines line_height spacing last_line_width radius base_color highlight_color animated duration direction enabled opacity accessible_name visible], %i[animation_change show hide], false],
127
+ item_delegate: [%i[text description value icon icon_source icon_color icon_size trailing_text show_indicator checkable checked auto_exclusive selected highlighted enabled width height padding spacing background selected_background highlighted_background foreground selected_foreground muted accent border_color border_width radius font_family font_size description_size accessible_name visible], %i[activate click change toggle press release hover focus blur show hide error], false],
128
+ check_delegate: [%i[text description value checked tristate check_state selected highlighted enabled width height padding spacing indicator_size background selected_background highlighted_background foreground selected_foreground muted accent indicator_background indicator_border check_color border_color border_width radius font_family font_size description_size accessible_name visible], %i[activate click change toggle press release hover focus blur show hide], false],
129
+ radio_delegate: [%i[text description value checked auto_exclusive selected highlighted enabled width height padding spacing indicator_size dot_size background selected_background highlighted_background foreground selected_foreground muted accent indicator_background indicator_border dot_color border_color border_width radius font_family font_size description_size accessible_name visible], %i[activate click select change toggle press release hover focus blur show hide], false],
130
+ switch_delegate: [%i[text description value checked selected highlighted enabled width height padding spacing indicator_width indicator_height thumb_size animated duration background selected_background highlighted_background foreground selected_foreground muted accent track_color checked_track_color thumb_color checked_thumb_color border_color border_width radius font_family font_size description_size accessible_name visible], %i[activate click change toggle press release hover focus blur show hide], false],
131
+ swipe_delegate: [%i[text description value icon icon_source icon_color icon_size selected highlighted swipe_enabled opened_side left_action left_value left_icon left_color right_action right_value right_icon right_color action_width close_on_action animated duration enabled width height padding spacing background selected_background highlighted_background foreground selected_foreground muted accent border_color border_width radius font_family font_size description_size accessible_name visible], %i[activate click left_action right_action swipe_position swipe_complete swipe_open swipe_close press release hover focus blur show hide error], false],
132
+ grid_view: [%i[items key_field label_field description_field icon_field selected current_index flow layout_direction cell_width cell_height spacing padding width height highlight_move_duration snap_mode bounds_behavior key_navigation_wraps interactive clip empty_text enabled background cell_background selected_background foreground selected_foreground muted accent border_color radius font_family font_size description_size icon_size accessible_name visible], %i[activate change current_change count_change highlight scroll movement_start movement_end show hide focus blur], false],
133
+ table_view: [%i[rows columns selected_row selected_column show_header header_height row_height column_width row_spacing column_spacing selection_behavior selection_mode editable edit_triggers alternating_rows animate reuse_items key_navigation_enabled pointer_navigation_enabled interactive clip padding width height empty_text enabled background header_background cell_background alternate_background selected_background foreground header_foreground selected_foreground muted accent grid_color border_color radius font_family font_size header_size accessible_name visible], %i[cell_click cell_double_click activate selection_change current_change edit row_count_change column_count_change scroll movement_start movement_end show hide focus blur], false],
134
+ tree_view: [%i[rows columns children_field selected_path selected_column expanded_paths expand_depth show_header header_height row_height column_width row_spacing column_spacing indentation left_margin right_margin selection_behavior selection_mode editable edit_triggers alternating_rows animate reuse_items key_navigation_enabled pointer_navigation_enabled interactive clip padding width height empty_text enabled background header_background cell_background alternate_background selected_background foreground header_foreground selected_foreground muted accent grid_color border_color radius font_family font_size header_size accessible_name visible], %i[cell_click cell_double_click activate selection_change current_change edit expand collapse expanded_change row_count_change column_count_change scroll movement_start movement_end show hide focus blur], false],
135
+ data_table: [%i[rows columns selected_row selected_column show_header header_height row_height column_width row_spacing column_spacing selection_behavior selection_mode editable edit_triggers alternating_rows animate reuse_items key_navigation_enabled pointer_navigation_enabled interactive clip padding width height empty_text enabled background header_background cell_background alternate_background selected_background foreground header_foreground selected_foreground muted accent grid_color border_color radius font_family font_size header_size accessible_name sort_column sort_order filter page page_size visible], %i[cell_click cell_double_click activate selection_change current_change edit sort filter_change page_change row_count_change column_count_change scroll movement_start movement_end show hide focus blur], false],
136
+ horizontal_header: [%i[sections current_index section_width height spacing movable clickable sort_index sort_order background selected_background foreground selected_foreground border_color font_family font_size visible], %i[click move sort], false],
137
+ vertical_header: [%i[sections current_index width section_height spacing clickable background selected_background foreground selected_foreground border_color font_family font_size visible], %i[click], false],
138
+ table_view_delegate: [%i[text value row column current selected editing enabled width height background selected_background foreground selected_foreground border_color font_family font_size visible], %i[click double_click activate edit], false],
139
+ tree_view_delegate: [%i[text value row column depth expanded has_children current selected enabled width height indentation background selected_background foreground selected_foreground border_color font_family font_size visible], %i[click double_click activate expand collapse], false],
140
+ horizontal_header_delegate: [%i[text value index selected sort_order enabled width height background selected_background foreground selected_foreground border_color font_family font_size visible], %i[click sort], false],
141
+ vertical_header_delegate: [%i[text value index selected enabled width height background selected_background foreground selected_foreground border_color font_family font_size visible], %i[click], false],
142
+ reorderable_list: [%i[items key_field label_field description_field selected orientation spacing padding item_padding item_height width height handle_position drag_enabled drag_scale drag_opacity drag_transition_duration empty_text background item_background selected_background foreground selected_foreground muted border_color radius font_family font_size visible], %i[reorder activate change drag_start drag_move drag_end], false],
143
+ carousel: [%i[items key_field label_field description_field image_field current_index path_radius item_width item_height width height interactive highlight_range snap_mode background foreground muted accent font_family font_size visible], %i[input change activate movement_start movement_end error], false],
144
+ calendar: [%i[date minimum maximum month year locale show_week_numbers show_navigation width height background header_background selected_background today_background foreground muted accent border_color radius font_family font_size visible], %i[input change navigate], false],
145
+ month_grid: [%i[month year locale selected_date minimum maximum width height background selected_background today_background foreground muted accent font_family font_size visible], %i[click press release change], false],
146
+ week_number_column: [%i[month year locale width height background foreground muted font_family font_size visible], %i[week_click], false],
147
+ day_of_week_row: [%i[locale width height background foreground muted font_family font_size visible], %i[day_click], false],
148
+ tumbler: [%i[items current_index visible_item_count wrap interactive width height background foreground muted accent font_family font_size visible], %i[input change activate], false],
149
+ canvas: [%i[commands width height canvas_width canvas_height tile_width tile_height render_target render_strategy antialiasing smooth background continuous fps visible], %i[paint error click double_click press release hover], false],
150
+ shape: [%i[path width height stroke fill stroke_width cap join fill_rule dash_pattern dash_offset scale preferred_renderer asynchronous contains_mode antialiasing visible], %i[status click hover], false],
151
+ line: [%i[x1 y1 x2 y2 width height stroke stroke_width cap dash_pattern dash_offset antialiasing visible], %i[click hover], false],
152
+ path: [%i[data width height stroke fill stroke_width cap join fill_rule dash_pattern dash_offset scale preferred_renderer asynchronous contains_mode antialiasing visible], %i[status click hover], false],
153
+ circle: [%i[center_x center_y radius start_angle sweep_angle width height stroke fill stroke_width cap dash_pattern dash_offset antialiasing visible], %i[click hover], false],
154
+ gradient: [%i[colors stops type width height start_x start_y end_x end_y center_x center_y focal_x focal_y center_radius focal_radius angle radius stroke stroke_width antialiasing visible], %i[click hover], false],
155
+ shader_effect: [%i[shader fragment_shader vertex_shader width height blending cull_mode mesh_width mesh_height supports_atlas source_rect texture_width texture_height texture_format texture_samples texture_wrap texture_mirroring mipmap live recursive time mouse_x mouse_y intensity amount radius progress frequency amplitude color color2 parameters running fps visible], %i[status frame click hover error], true],
156
+ shader_effect_source: [%i[width height source_rect texture_width texture_height format samples wrap_mode texture_mirroring mipmap live recursive hide_source smooth visible], %i[update], true],
157
+ multi_effect: [%i[width height brightness contrast saturation colorization colorization_color blur_enabled blur blur_max blur_multiplier shadow_enabled shadow_opacity shadow_blur shadow_horizontal_offset shadow_vertical_offset shadow_color shadow_scale mask_enabled mask_source mask_threshold_min mask_spread_at_min mask_threshold_max mask_spread_at_max mask_inverted auto_padding padding_left padding_top padding_right padding_bottom visible], %i[shader_change], true],
158
+ rectangular_shadow: [%i[width height blur spread radius offset_x offset_y color cached antialiasing visible], [], true],
159
+ opacity_mask: [%i[width height mask_source threshold_min spread_min threshold_max spread_max inverted visible], [], true],
160
+ blur: [%i[width height amount maximum multiplier auto_padding visible], [], true],
161
+ drop_shadow: [%i[width height blur maximum multiplier horizontal_offset vertical_offset color opacity scale auto_padding visible], [], true],
162
+ colorize: [%i[width height amount color brightness contrast saturation visible], [], true],
163
+ glow: [%i[width height blur maximum multiplier color opacity scale auto_padding visible], [], true],
164
+ particle_system: [%i[width height running paused emit_rate life_span life_span_variation maximum_emitted size end_size size_variation source color color_variation alpha alpha_variation rotation rotation_variation rotation_velocity rotation_velocity_variation auto_rotation emitter_x emitter_y emitter_width emitter_height velocity_angle velocity velocity_angle_variation velocity_variation acceleration_angle acceleration acceleration_angle_variation acceleration_variation gravity gravity_angle turbulence turbulence_x turbulence_y turbulence_width turbulence_height particle_shape burst_count burst_x burst_y burst_revision visible], %i[start stop pause resume empty burst], false],
165
+ drag_area: [%i[enabled target axis minimum_x maximum_x minimum_y maximum_y snap_x snap_y threshold cursor reset_revision width height visible], %i[click double_click drag_start drag drag_end cancel], true],
166
+ drop_area: [%i[keys enabled width height visible], %i[enter move exit drop], true],
167
+ pinch_area: [%i[enabled target minimum_scale maximum_scale minimum_rotation maximum_rotation minimum_x maximum_x minimum_y maximum_y width height visible], %i[pinch_start pinch pinch_end cancel], true],
168
+ hover_area: [%i[enabled cursor blocking margin width height visible], %i[enter move exit hover], true],
169
+ selection_rectangle: [%i[target mode enabled visible], %i[active_change selection_change], false],
170
+ scroll_bar: [%i[target orientation policy position size active interactive step_size minimum_size width height visible], %i[input change active_change], false],
171
+ scroll_indicator: [%i[target orientation position size active minimum_size width height visible], %i[active_change], false],
172
+ animation: [%i[target property from to duration delay easing loops running paused always_run visible], %i[start stop finish running_change], false],
173
+ number_animation: [%i[target property from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
174
+ color_animation: [%i[target property from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
175
+ rotation_animation: [%i[target property from to duration delay easing direction loops running paused visible], %i[start stop finish running_change], false],
176
+ vector_animation: [%i[target property from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
177
+ path_animation: [%i[target path orientation anchor_x anchor_y duration delay easing loops running paused visible], %i[start stop finish running_change], false],
178
+ property_animation: [%i[target property from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
179
+ pause_animation: [%i[duration running paused visible], %i[start stop finish running_change], false],
180
+ script_action: [%i[action trigger revision visible], %i[trigger finish], false],
181
+ property_action: [%i[target property value revision visible], %i[apply finish], false],
182
+ parallel_animation: [%i[animations loops running paused visible], %i[start stop finish running_change], false],
183
+ sequential_animation: [%i[animations loops running paused visible], %i[start stop finish step running_change], false],
184
+ spring_animation: [%i[target property from to spring damping epsilon mass modulus velocity running paused visible], %i[start stop finish running_change], false],
185
+ smoothed_animation: [%i[target property from to velocity duration reversing_mode running paused visible], %i[start stop finish running_change], false],
186
+ anchor_animation: [%i[target duration easing running paused visible], %i[start stop finish running_change], false],
187
+ parent_animation: [%i[target new_parent via duration easing running paused visible], %i[start stop finish running_change], false],
188
+ opacity_animator: [%i[target from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
189
+ rotation_animator: [%i[target from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
190
+ scale_animator: [%i[target from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
191
+ x_animator: [%i[target from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
192
+ y_animator: [%i[target from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
193
+ uniform_animator: [%i[target uniform from to duration delay easing loops running paused visible], %i[start stop finish running_change], false],
194
+ frame_animation: [%i[running paused visible], %i[frame start stop], false],
195
+ animation_controller: [%i[animation target property from to duration progress reload revision visible], %i[progress_change finish], false],
196
+ behavior: [%i[target property value animation duration easing enabled visible], %i[change finish], false],
197
+ transition: [%i[target from_state to_state animations loops running paused enabled revision visible], %i[start stop finish running_change], false],
198
+ state: [%i[target name when properties restore_entry_values extend revision visible], %i[enter exit change], false],
199
+ state_group: [%i[target current states revision visible], %i[change], false],
200
+ property_changes: [%i[target properties revision visible], %i[apply], false],
201
+ anchor_changes: [%i[target anchors margins revision visible], %i[apply], false],
202
+ parent_change: [%i[target parent x y width height scale rotation revision visible], %i[apply], false],
203
+ timer: [%i[interval repeat running triggered_on_start restart revision visible], %i[trigger start stop], false],
204
+ media_player: [%i[source auto_play playback loops playback_rate position volume muted audio_device command command_revision visible], %i[play pause stop status error position duration media_status buffer progress tracks], false],
205
+ video_output: [%i[source fill_mode orientation mirrored end_of_stream_policy width height visible], %i[source_change frame], false],
206
+ sound_effect: [%i[source loops volume muted playback command command_revision visible], %i[play stop status error loops_remaining], false],
207
+ camera: [%i[active camera_device focus_mode flash_mode torch_mode exposure_mode exposure_compensation iso shutter_speed white_balance_mode color_temperature zoom_factor command command_revision visible], %i[start stop active_change error focus exposure], false],
208
+ capture_session: [%i[camera_active audio_input_device audio_output_device video_output_enabled width height visible], %i[ready error], true],
209
+ image_capture: [%i[session quality format command path command_revision visible], %i[captured saved error ready_change], false],
210
+ media_recorder: [%i[session output_location quality resolution frame_rate video_codec audio_codec media_format audio_bit_rate video_bit_rate command command_revision visible], %i[record pause stop status duration error location], false],
211
+ audio_input: [%i[device muted volume visible], %i[device_change muted_change volume_change error], false],
212
+ audio_output: [%i[device muted volume visible], %i[device_change muted_change volume_change error], false],
213
+ media_devices: [%i[kind refresh_revision visible], %i[video_inputs audio_inputs audio_outputs change], false],
214
+ screen_capture: [%i[active screen command command_revision visible], %i[start stop error], false],
215
+ window_capture: [%i[active window command command_revision visible], %i[start stop error], false],
216
+ list_model: [%i[items revision visible], %i[count_change change], false],
217
+ delegate_model: [%i[items filter_group revision visible], %i[count_change group_change change], false],
218
+ delegate_model_group: [%i[items name include_by_default revision visible], %i[count_change change], false],
219
+ sort_filter_proxy_model: [%i[items filter filter_field filter_case_sensitive sort_field sort_order sort_case_sensitive dynamic recursive auto_accept_children revision visible], %i[count_change change], false],
220
+ folder_list_model: [%i[folder root_folder name_filters show_files show_dirs show_dirs_first show_dot_and_dot_dot show_hidden show_only_readable sort_field sort_reversed case_sensitive revision visible], %i[count_change folder_change status error change], false],
221
+ settings: [%i[category file_name values sync_revision visible], %i[loaded change synced error], false],
222
+ standard_paths: [%i[location locate_file executable refresh_revision visible], %i[resolved error], false],
223
+ clipboard: [%i[text watch revision visible], %i[change copied], false],
224
+ dropdown: [%i[label value options foreground background popup_border accent font_family row_height popup_row_height show_label cursor], %i[change hover], false],
225
+ searchable_dropdown: [%i[label value options placeholder empty_text trigger_label foreground background popup_border accent font_family row_height popup_row_height popup_min_height show_label cursor], %i[change hover], false],
226
+ multi_select: [%i[label values options options_command options_command_cwd placeholder empty_text no_selection_text trigger_label show_label foreground background popup_border accent font_family row_height popup_row_height popup_min_height cursor], %i[change hover], false],
227
+ button_group: [%i[value options foreground background accent font_family font_size focusable cursor_index], %i[change hover], false],
228
+ progress: [%i[value minimum maximum width height color visible], [], false],
229
+ line_chart: [%i[values labels width height color fill_color grid_color line_width minimum maximum show_grid show_points point_size visible], %i[select hover], false],
230
+ area_chart: [%i[values labels width height color fill_color grid_color line_width minimum maximum show_grid visible], %i[select hover], false],
231
+ bar_chart: [%i[values labels width height colors grid_color minimum maximum show_grid bar_spacing visible], %i[select hover], false],
232
+ stacked_bar_chart: [%i[values series labels colors width height grid_color minimum maximum show_grid bar_spacing stack_spacing orientation legend visible], %i[select hover], false],
233
+ pie_chart: [%i[values labels colors width height inner_radius start_angle clockwise pad_angle show_labels label_color font_family font_size visible], %i[select hover], false],
234
+ donut_chart: [%i[values labels colors width height inner_radius start_angle clockwise pad_angle show_labels center_text label_color font_family font_size visible], %i[select hover], false],
235
+ scatter_chart: [%i[values series labels colors width height grid_color minimum_x maximum_x minimum_y maximum_y point_size show_grid connect_lines visible], %i[select hover], false],
236
+ bubble_chart: [%i[values series labels colors width height grid_color minimum_x maximum_x minimum_y maximum_y minimum_size maximum_size show_grid visible], %i[select hover], false],
237
+ radar_chart: [%i[values series labels colors width height grid_color levels fill_opacity line_width point_size visible], %i[select hover], false],
238
+ heatmap: [%i[values x_labels y_labels colors width height minimum maximum cell_spacing show_values value_color font_family font_size visible], %i[select hover], false],
239
+ sparkline: [%i[values width height color fill_color line_width minimum maximum show_points point_size visible], %i[select hover], false],
240
+ gauge: [%i[value values minimum maximum width height color track_color thickness label label_format show_label font_family font_size visible], %i[select hover], false],
241
+ radial_gauge: [%i[value values minimum maximum width height color track_color thickness start_angle end_angle label label_format show_label font_family font_size visible], %i[select hover], false],
242
+ histogram: [%i[values bins labels width height color colors grid_color minimum maximum show_grid bar_spacing normalize cumulative visible], %i[select hover], false],
243
+ candlestick_chart: [%i[values labels width height up_color down_color wick_color grid_color minimum maximum show_grid candle_spacing visible], %i[select hover], false],
244
+ legend: [%i[items orientation spacing marker_size width height background foreground muted font_family font_size interactive selected visible], %i[select hover], false],
245
+ separator: [%i[strength visible], [], false],
246
+ divider: [%i[orientation length thickness indent end_indent color opacity visible], [], false],
247
+ section_header: [%i[text visible], [], false],
248
+ confirm_dialog: [%i[opened message cancel_text confirm_text selected_index background foreground scrim selected_background selected_text font_family corner_radius], %i[cancel confirm], false],
249
+ panel_hero: [%i[title meta detail foreground font_family icon_size icon_opacity meta_opacity], [], false],
250
+ optical_glyph: [%i[text size color debug_bounds visible], [], false],
251
+ cursor_surface: [%i[cursor current outline bordered foreground accent fill current_fill], %i[click], true],
252
+ widget_button: [%i[text font_family font_size foreground active_color active horizontal_margin vertical_padding fixed_width fixed_height text_rotation keep_space dimmed concealed interactive pressable use_active_color maintain_indicator_reveal label_visible has_visual_content tooltip], %i[click right_click middle_click wheel], false],
253
+ list_view: [%i[items key_field label_field description_field icon_field selected orientation spacing width height empty_text visible], %i[activate change scroll], false],
254
+ key_catcher: [%i[blocked visible], %i[move activate return close delete tab text], true]
255
+ }.freeze
256
+
257
+ DEFAULT_COMPONENTS = ComponentRegistry.new
258
+ COMPONENTS.each do |name, (properties, events, container)|
259
+ adapter = name.to_s.split("_").map(&:capitalize).join + ".qml"
260
+ DEFAULT_COMPONENTS.register(name, qml: adapter, properties:, events:, container:)
261
+ end
262
+ end