nicegui 1.2.1__tar.gz → 1.2.2__tar.gz

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 (257) hide show
  1. {nicegui-1.2.1 → nicegui-1.2.2}/PKG-INFO +3 -3
  2. {nicegui-1.2.1 → nicegui-1.2.2}/README.md +2 -2
  3. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/element.py +3 -11
  4. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/color_input.py +7 -1
  5. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/color_picker.py +8 -1
  6. nicegui-1.2.2/nicegui/elements/interactive_image.js +65 -0
  7. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/interactive_image.py +0 -4
  8. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/markdown.js +13 -0
  9. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/markdown.py +14 -1
  10. nicegui-1.2.2/nicegui/elements/mixins/content_element.py +80 -0
  11. nicegui-1.2.2/nicegui/elements/mixins/filter_element.py +78 -0
  12. nicegui-1.2.2/nicegui/elements/mixins/source_element.py +77 -0
  13. nicegui-1.2.2/nicegui/elements/mixins/text_element.py +80 -0
  14. nicegui-1.2.2/nicegui/elements/mixins/value_element.py +102 -0
  15. nicegui-1.2.2/nicegui/elements/mixins/visibility.py +90 -0
  16. nicegui-1.2.2/nicegui/elements/select.js +35 -0
  17. nicegui-1.2.2/nicegui/elements/select.py +54 -0
  18. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/table.py +2 -0
  19. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/functions/notify.py +5 -3
  20. {nicegui-1.2.1 → nicegui-1.2.2}/pyproject.toml +1 -1
  21. {nicegui-1.2.1 → nicegui-1.2.2}/setup.py +2 -2
  22. nicegui-1.2.1/nicegui/elements/interactive_image.js +0 -84
  23. nicegui-1.2.1/nicegui/elements/mixins/content_element.py +0 -36
  24. nicegui-1.2.1/nicegui/elements/mixins/filter_element.py +0 -34
  25. nicegui-1.2.1/nicegui/elements/mixins/source_element.py +0 -33
  26. nicegui-1.2.1/nicegui/elements/mixins/text_element.py +0 -36
  27. nicegui-1.2.1/nicegui/elements/mixins/value_element.py +0 -58
  28. nicegui-1.2.1/nicegui/elements/mixins/visibility.py +0 -43
  29. nicegui-1.2.1/nicegui/elements/select.py +0 -30
  30. {nicegui-1.2.1 → nicegui-1.2.2}/LICENSE +0 -0
  31. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/__init__.py +0 -0
  32. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/app.py +0 -0
  33. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/background_tasks.py +0 -0
  34. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/binding.py +0 -0
  35. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/client.py +0 -0
  36. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/dependencies.py +0 -0
  37. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/deprecation.py +0 -0
  38. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/aggrid.js +0 -0
  39. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/aggrid.py +0 -0
  40. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/audio.js +0 -0
  41. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/audio.py +0 -0
  42. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/avatar.py +0 -0
  43. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/badge.py +0 -0
  44. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/button.py +0 -0
  45. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/card.py +0 -0
  46. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/chart.js +0 -0
  47. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/chart.py +0 -0
  48. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/checkbox.py +0 -0
  49. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/choice_element.py +0 -0
  50. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/colors.js +0 -0
  51. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/colors.py +0 -0
  52. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/column.py +0 -0
  53. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/date.py +0 -0
  54. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/dialog.py +0 -0
  55. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/expansion.py +0 -0
  56. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/html.py +0 -0
  57. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/icon.py +0 -0
  58. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/image.py +0 -0
  59. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/input.py +0 -0
  60. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/joystick.py +0 -0
  61. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/joystick.vue +0 -0
  62. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/keyboard.js +0 -0
  63. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/keyboard.py +0 -0
  64. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/knob.py +0 -0
  65. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/label.py +0 -0
  66. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/CSS2DRenderer.js +0 -0
  67. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/CSS3DRenderer.js +0 -0
  68. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/OrbitControls.js +0 -0
  69. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/STLLoader.js +0 -0
  70. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/ag-grid-community.min.js +0 -0
  71. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts-3d.js +0 -0
  72. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts-more.js +0 -0
  73. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts.js +0 -0
  74. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/accessibility.js +0 -0
  75. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/annotations-advanced.js +0 -0
  76. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/annotations.js +0 -0
  77. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/arc-diagram.js +0 -0
  78. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/arrow-symbols.js +0 -0
  79. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/boost-canvas.js +0 -0
  80. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/boost.js +0 -0
  81. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/broken-axis.js +0 -0
  82. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/bullet.js +0 -0
  83. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/coloraxis.js +0 -0
  84. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/current-date-indicator.js +0 -0
  85. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/cylinder.js +0 -0
  86. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/data.js +0 -0
  87. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/datagrouping.js +0 -0
  88. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/debugger.js +0 -0
  89. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/dependency-wheel.js +0 -0
  90. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/dotplot.js +0 -0
  91. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/drag-panes.js +0 -0
  92. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/draggable-points.js +0 -0
  93. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/drilldown.js +0 -0
  94. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/dumbbell.js +0 -0
  95. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/export-data.js +0 -0
  96. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/exporting.js +0 -0
  97. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/full-screen.js +0 -0
  98. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/funnel.js +0 -0
  99. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/funnel3d.js +0 -0
  100. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/gantt.js +0 -0
  101. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/grid-axis.js +0 -0
  102. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/heatmap.js +0 -0
  103. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/heikinashi.js +0 -0
  104. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/histogram-bellcurve.js +0 -0
  105. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/hollowcandlestick.js +0 -0
  106. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/item-series.js +0 -0
  107. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/lollipop.js +0 -0
  108. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/marker-clusters.js +0 -0
  109. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/networkgraph.js +0 -0
  110. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/no-data-to-display.js +0 -0
  111. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/offline-exporting.js +0 -0
  112. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/oldie-polyfills.js +0 -0
  113. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/oldie.js +0 -0
  114. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/organization.js +0 -0
  115. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/overlapping-datalabels.js +0 -0
  116. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/parallel-coordinates.js +0 -0
  117. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/pareto.js +0 -0
  118. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/pathfinder.js +0 -0
  119. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/pattern-fill.js +0 -0
  120. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/price-indicator.js +0 -0
  121. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/pyramid3d.js +0 -0
  122. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/sankey.js +0 -0
  123. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/series-label.js +0 -0
  124. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/series-on-point.js +0 -0
  125. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/solid-gauge.js +0 -0
  126. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/sonification.js +0 -0
  127. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/static-scale.js +0 -0
  128. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/stock-tools.js +0 -0
  129. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/stock.js +0 -0
  130. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/streamgraph.js +0 -0
  131. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/sunburst.js +0 -0
  132. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/tilemap.js +0 -0
  133. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/timeline.js +0 -0
  134. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/treegraph.js +0 -0
  135. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/treegrid.js +0 -0
  136. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/treemap.js +0 -0
  137. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/variable-pie.js +0 -0
  138. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/variwide.js +0 -0
  139. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/vector.js +0 -0
  140. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/venn.js +0 -0
  141. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/windbarb.js +0 -0
  142. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/wordcloud.js +0 -0
  143. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/highcharts_modules/xrange.js +0 -0
  144. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/mermaid.min.js +0 -0
  145. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/nipplejs.min.js +0 -0
  146. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/plotly.min.js +0 -0
  147. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/three.min.js +0 -0
  148. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/lib/tween.umd.min.js +0 -0
  149. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/line_plot.py +0 -0
  150. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/link.py +0 -0
  151. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/log.js +0 -0
  152. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/log.py +0 -0
  153. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/menu.py +0 -0
  154. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/mermaid.js +0 -0
  155. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/mermaid.py +0 -0
  156. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/number.py +0 -0
  157. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/plotly.py +0 -0
  158. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/plotly.vue +0 -0
  159. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/progress.py +0 -0
  160. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/pyplot.py +0 -0
  161. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/radio.py +0 -0
  162. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/row.py +0 -0
  163. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/scene.js +0 -0
  164. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/scene.py +0 -0
  165. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/scene_object3d.py +0 -0
  166. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/scene_objects.py +0 -0
  167. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/separator.py +0 -0
  168. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/slider.py +0 -0
  169. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/spinner.py +0 -0
  170. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/switch.py +0 -0
  171. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/tabs.py +0 -0
  172. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/textarea.py +0 -0
  173. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/time.py +0 -0
  174. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/toggle.py +0 -0
  175. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/tooltip.py +0 -0
  176. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/tree.py +0 -0
  177. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/upload.py +0 -0
  178. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/video.js +0 -0
  179. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/elements/video.py +0 -0
  180. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/error.py +0 -0
  181. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/event_listener.py +0 -0
  182. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/events.py +0 -0
  183. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/favicon.py +0 -0
  184. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/functions/html.py +0 -0
  185. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/functions/javascript.py +0 -0
  186. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/functions/open.py +0 -0
  187. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/functions/timer.py +0 -0
  188. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/functions/update.py +0 -0
  189. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/globals.py +0 -0
  190. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/helpers.py +0 -0
  191. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/ids.py +0 -0
  192. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/json/__init__.py +0 -0
  193. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/json/builtin_wrapper.py +0 -0
  194. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/json/orjson_wrapper.py +0 -0
  195. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/native_mode.py +0 -0
  196. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/nicegui.py +0 -0
  197. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/outbox.py +0 -0
  198. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/page.py +0 -0
  199. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/page_layout.py +0 -0
  200. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/run.py +0 -0
  201. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/run_with.py +0 -0
  202. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/slot.py +0 -0
  203. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/favicon.ico +0 -0
  204. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOkCnqEu92Fr1MmgVxEIzIXKMnyrYk.woff2 +0 -0
  205. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOkCnqEu92Fr1MmgVxFIzIXKMnyrYk.woff2 +0 -0
  206. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOkCnqEu92Fr1MmgVxGIzIXKMnyrYk.woff2 +0 -0
  207. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOkCnqEu92Fr1MmgVxHIzIXKMnyrYk.woff2 +0 -0
  208. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOkCnqEu92Fr1MmgVxIIzIXKMny.woff2 +0 -0
  209. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOkCnqEu92Fr1MmgVxLIzIXKMnyrYk.woff2 +0 -0
  210. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOkCnqEu92Fr1MmgVxMIzIXKMnyrYk.woff2 +0 -0
  211. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmEU9fABc4AMP6lbBP.woff2 +0 -0
  212. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.woff2 +0 -0
  213. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmEU9fBxc4AMP6lbBP.woff2 +0 -0
  214. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmEU9fCBc4AMP6lbBP.woff2 +0 -0
  215. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmEU9fCRc4AMP6lbBP.woff2 +0 -0
  216. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2 +0 -0
  217. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmEU9fCxc4AMP6lbBP.woff2 +0 -0
  218. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmSU5fABc4AMP6lbBP.woff2 +0 -0
  219. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmSU5fBBc4AMP6lQ.woff2 +0 -0
  220. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmSU5fBxc4AMP6lbBP.woff2 +0 -0
  221. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmSU5fCBc4AMP6lbBP.woff2 +0 -0
  222. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmSU5fCRc4AMP6lbBP.woff2 +0 -0
  223. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmSU5fChc4AMP6lbBP.woff2 +0 -0
  224. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmSU5fCxc4AMP6lbBP.woff2 +0 -0
  225. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmWUlfABc4AMP6lbBP.woff2 +0 -0
  226. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmWUlfBBc4AMP6lQ.woff2 +0 -0
  227. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmWUlfBxc4AMP6lbBP.woff2 +0 -0
  228. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmWUlfCBc4AMP6lbBP.woff2 +0 -0
  229. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmWUlfCRc4AMP6lbBP.woff2 +0 -0
  230. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmWUlfChc4AMP6lbBP.woff2 +0 -0
  231. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmWUlfCxc4AMP6lbBP.woff2 +0 -0
  232. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmYUtfABc4AMP6lbBP.woff2 +0 -0
  233. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmYUtfBBc4AMP6lQ.woff2 +0 -0
  234. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmYUtfBxc4AMP6lbBP.woff2 +0 -0
  235. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmYUtfCBc4AMP6lbBP.woff2 +0 -0
  236. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmYUtfCRc4AMP6lbBP.woff2 +0 -0
  237. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmYUtfChc4AMP6lbBP.woff2 +0 -0
  238. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOlCnqEu92Fr1MmYUtfCxc4AMP6lbBP.woff2 +0 -0
  239. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOmCnqEu92Fr1Mu4WxKKTU1Kvnz.woff2 +0 -0
  240. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2 +0 -0
  241. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOmCnqEu92Fr1Mu5mxKKTU1Kvnz.woff2 +0 -0
  242. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2 +0 -0
  243. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2 +0 -0
  244. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOmCnqEu92Fr1Mu7WxKKTU1Kvnz.woff2 +0 -0
  245. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/KFOmCnqEu92Fr1Mu7mxKKTU1Kvnz.woff2 +0 -0
  246. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2 +0 -0
  247. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/fonts.css +0 -0
  248. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/nicegui.css +0 -0
  249. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/quasar.prod.css +0 -0
  250. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/quasar.umd.prod.js +0 -0
  251. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/sad_face.svg +0 -0
  252. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/socket.io.min.js +0 -0
  253. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/tailwindcss.min.js +0 -0
  254. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/vue.global.prod.js +0 -0
  255. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/static/vue.min.js +0 -0
  256. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/templates/index.html +0 -0
  257. {nicegui-1.2.1 → nicegui-1.2.2}/nicegui/ui.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nicegui
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Web User Interface with Buttons, Dialogs, Markdown, 3D Scences and Plots
5
5
  Home-page: https://github.com/zauberzeug/nicegui
6
6
  License: MIT
@@ -111,10 +111,10 @@ Note: NiceGUI will automatically reload the page when you modify the code.
111
111
 
112
112
  ## Documentation and Examples
113
113
 
114
- The API reference is hosted at [https://nicegui.io/reference](https://nicegui.io/reference) and provides plenty of live examples.
114
+ The documentation is hosted at [https://nicegui.io/documentation](https://nicegui.io/documentation) and provides plenty of live demos.
115
115
  The whole content of [https://nicegui.io](https://nicegui.io) is [implemented with NiceGUI itself](https://github.com/zauberzeug/nicegui/blob/main/main.py).
116
116
 
117
- You may also have a look at [our in-depth demonstrations](https://github.com/zauberzeug/nicegui/tree/main/examples) of what you can do with NiceGUI.
117
+ You may also have a look at our [in-depth examples](https://github.com/zauberzeug/nicegui/tree/main/examples) of what you can do with NiceGUI.
118
118
 
119
119
  ## Why?
120
120
 
@@ -75,10 +75,10 @@ Note: NiceGUI will automatically reload the page when you modify the code.
75
75
 
76
76
  ## Documentation and Examples
77
77
 
78
- The API reference is hosted at [https://nicegui.io/reference](https://nicegui.io/reference) and provides plenty of live examples.
78
+ The documentation is hosted at [https://nicegui.io/documentation](https://nicegui.io/documentation) and provides plenty of live demos.
79
79
  The whole content of [https://nicegui.io](https://nicegui.io) is [implemented with NiceGUI itself](https://github.com/zauberzeug/nicegui/blob/main/main.py).
80
80
 
81
- You may also have a look at [our in-depth demonstrations](https://github.com/zauberzeug/nicegui/tree/main/examples) of what you can do with NiceGUI.
81
+ You may also have a look at our [in-depth examples](https://github.com/zauberzeug/nicegui/tree/main/examples) of what you can do with NiceGUI.
82
82
 
83
83
  ## Why?
84
84
 
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import re
4
- from abc import ABC
5
4
  from copy import deepcopy
6
5
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
7
6
 
@@ -20,12 +19,13 @@ if TYPE_CHECKING:
20
19
  PROPS_PATTERN = re.compile(r'([\w\-]+)(?:=(?:("[^"\\]*(?:\\.[^"\\]*)*")|([\w\-.%:\/]+)))?(?:$|\s)')
21
20
 
22
21
 
23
- class Element(ABC, Visibility):
22
+ class Element(Visibility):
24
23
 
25
24
  def __init__(self, tag: str, *, _client: Optional[Client] = None) -> None:
26
25
  """Generic Element
27
26
 
28
- This class is also the base class for all other elements.
27
+ This class is the base class for all other UI elements.
28
+ But you can use it to create elements with arbitrary HTML tags.
29
29
 
30
30
  :param tag: HTML tag of the element
31
31
  :param _client: client for this element (for internal use only)
@@ -167,10 +167,6 @@ class Element(ABC, Visibility):
167
167
 
168
168
  Removing or replacing styles can be helpful if the predefined style is not desired.
169
169
 
170
- .. codeblock:: python
171
-
172
- ui.button('Click me').style('color: #6E93D6; font-size: 200%', remove='font-weight; background-color')
173
-
174
170
  :param add: semicolon-separated list of styles to add to the element
175
171
  :param remove: semicolon-separated list of styles to remove from the element
176
172
  :param replace: semicolon-separated list of styles to use instead of existing ones
@@ -203,10 +199,6 @@ class Element(ABC, Visibility):
203
199
  This allows modifying the look of the element or its layout using `Quasar <https://quasar.dev/>`_ props.
204
200
  Since props are simply applied as HTML attributes, they can be used with any HTML element.
205
201
 
206
- .. codeblock:: python
207
-
208
- ui.button('Open menu').props('outline icon=menu')
209
-
210
202
  Boolean properties are assumed ``True`` if no value is specified.
211
203
 
212
204
  :param add: whitespace-delimited list of either boolean values or key=value pair to add
@@ -26,5 +26,11 @@ class ColorInput(ValueElement):
26
26
 
27
27
  with self.add_slot('append'):
28
28
  self.picker = ColorPicker(on_pick=lambda e: self.set_value(e.color))
29
- self.button = ui.button(on_click=self.picker.open) \
29
+ self.button = ui.button(on_click=self.open_picker) \
30
30
  .props('icon=colorize flat round', remove='color').classes('cursor-pointer')
31
+
32
+ def open_picker(self) -> None:
33
+ """Open the color picker"""
34
+ if self.value:
35
+ self.picker.set_color(self.value)
36
+ self.picker.open()
@@ -18,4 +18,11 @@ class ColorPicker(Menu):
18
18
  with self:
19
19
  def handle_change(msg: Dict):
20
20
  handle_event(on_pick, ColorPickEventArguments(sender=self, client=self.client, color=msg['args']))
21
- Element('q-color').on('change', handle_change)
21
+ self.q_color = Element('q-color').on('change', handle_change)
22
+
23
+ def set_color(self, color: str) -> None:
24
+ """Set the color of the picker
25
+
26
+ :param color: the color to set
27
+ """
28
+ self.q_color.props(f'model-value="{color}"')
@@ -0,0 +1,65 @@
1
+ export default {
2
+ template: `
3
+ <div style="position:relative">
4
+ <img :src="src" style="width:100%; height:100%;" v-on="onEvents" draggable="false" />
5
+ <svg v-if="cross" style="position:absolute;top:0;left:0;pointer-events:none" :viewBox="viewBox">
6
+ <g :style="{ display: cssDisplay }">
7
+ <line :x1="x" y1="0" :x2="x" y2="100%" stroke="black" />
8
+ <line x1="0" :y1="y" x2="100%" :y2="y" stroke="black" />
9
+ </g>
10
+ <g v-html="content"></g>
11
+ </svg>
12
+ </div>
13
+ `,
14
+ data() {
15
+ return {
16
+ viewBox: "0 0 0 0",
17
+ x: 100,
18
+ y: 100,
19
+ cssDisplay: "none",
20
+ };
21
+ },
22
+ methods: {
23
+ updateCrossHair(e) {
24
+ this.x = (e.offsetX * e.target.naturalWidth) / e.target.clientWidth;
25
+ this.y = (e.offsetY * e.target.naturalHeight) / e.target.clientHeight;
26
+ },
27
+ onImageLoaded(e) {
28
+ this.viewBox = `0 0 ${e.target.naturalWidth} ${e.target.naturalHeight}`;
29
+ },
30
+ onMouseEvent(type, e) {
31
+ this.$emit("mouse", {
32
+ mouse_event_type: type,
33
+ image_x: (e.offsetX * e.target.naturalWidth) / e.target.clientWidth,
34
+ image_y: (e.offsetY * e.target.naturalHeight) / e.target.clientHeight,
35
+ button: e.button,
36
+ buttons: e.buttons,
37
+ altKey: e.altKey,
38
+ ctrlKey: e.ctrlKey,
39
+ metaKey: e.metaKey,
40
+ shiftKey: e.shiftKey,
41
+ });
42
+ },
43
+ },
44
+ computed: {
45
+ onEvents() {
46
+ const allEvents = {};
47
+ for (const type of this.events) {
48
+ allEvents[type] = (event) => this.onMouseEvent(type, event);
49
+ }
50
+ if (this.cross) {
51
+ allEvents["mouseenter"] = () => (this.cssDisplay = "block");
52
+ allEvents["mouseleave"] = () => (this.cssDisplay = "none");
53
+ allEvents["mousemove"] = (event) => this.updateCrossHair(event);
54
+ allEvents["load"] = (event) => this.onImageLoaded(event);
55
+ }
56
+ return allEvents;
57
+ },
58
+ },
59
+ props: {
60
+ src: String,
61
+ content: String,
62
+ events: Array,
63
+ cross: Boolean,
64
+ },
65
+ };
@@ -52,7 +52,3 @@ class InteractiveImage(SourceElement, ContentElement):
52
52
  )
53
53
  return handle_event(on_mouse, arguments)
54
54
  self.on('mouse', handle_mouse)
55
-
56
- def on_source_change(self, source: str) -> None:
57
- super().on_source_change(source)
58
- self.run_method('set_source', source)
@@ -1,6 +1,7 @@
1
1
  export default {
2
2
  template: `<div></div>`,
3
3
  mounted() {
4
+ this.ensure_codehilite_css();
4
5
  this.update(this.$el.innerHTML);
5
6
  },
6
7
  methods: {
@@ -11,6 +12,18 @@ export default {
11
12
  mermaid.render(`mermaid_${this.$el.id}_${i}`, code, (svg) => (pre.innerHTML = svg));
12
13
  });
13
14
  },
15
+ ensure_codehilite_css() {
16
+ if (!document.querySelector(`style[data-codehilite-css]`)) {
17
+ const style = document.createElement("style");
18
+ style.setAttribute("data-codehilite-css", "");
19
+ style.innerHTML = this.codehilite_css;
20
+ console.log(style);
21
+ document.head.appendChild(style);
22
+ }
23
+ },
24
+ },
25
+ props: {
26
+ codehilite_css: String,
14
27
  },
15
28
  };
16
29
 
@@ -4,6 +4,7 @@ from functools import lru_cache
4
4
  from typing import List
5
5
 
6
6
  import markdown2
7
+ from pygments.formatters import HtmlFormatter
7
8
 
8
9
  from ..dependencies import register_component
9
10
  from .mixins.content_element import ContentElement
@@ -23,6 +24,7 @@ class Markdown(ContentElement):
23
24
  """
24
25
  self.extras = extras
25
26
  super().__init__(tag='markdown', content=content)
27
+ self._props['codehilite_css'] = HtmlFormatter(nobackground=True).get_style_defs('.codehilite')
26
28
 
27
29
  def on_content_change(self, content: str) -> None:
28
30
  html = prepare_content(content, extras=' '.join(self.extras))
@@ -33,7 +35,7 @@ class Markdown(ContentElement):
33
35
 
34
36
  @lru_cache(maxsize=int(os.environ.get('MARKDOWN_CONTENT_CACHE_SIZE', '1000')))
35
37
  def prepare_content(content: str, extras: str) -> str:
36
- html = markdown2.markdown(content, extras=extras.split())
38
+ html = markdown2.markdown(remove_indentation(content), extras=extras.split())
37
39
  return apply_tailwind(html) # we need explicit Markdown styling because tailwind CSS removes all default styles
38
40
 
39
41
 
@@ -52,3 +54,14 @@ def apply_tailwind(html: str) -> str:
52
54
  }
53
55
  pattern = re.compile('|'.join(rep.keys()))
54
56
  return pattern.sub(lambda m: rep[re.escape(m.group(0))], html)
57
+
58
+
59
+ def remove_indentation(text: str) -> str:
60
+ """Remove indentation from a multi-line string based on the indentation of the first non-empty line."""
61
+ lines = text.splitlines()
62
+ while lines and not lines[0].strip():
63
+ lines.pop(0)
64
+ if not lines:
65
+ return ''
66
+ indentation = len(lines[0]) - len(lines[0].lstrip())
67
+ return '\n'.join(line[indentation:] for line in lines)
@@ -0,0 +1,80 @@
1
+ from typing import Any, Callable
2
+
3
+ from typing_extensions import Self
4
+
5
+ from ...binding import BindableProperty, bind, bind_from, bind_to
6
+ from ...element import Element
7
+
8
+
9
+ class ContentElement(Element):
10
+ CONTENT_PROP = 'innerHTML'
11
+ content = BindableProperty(on_change=lambda sender, content: sender.on_content_change(content))
12
+
13
+ def __init__(self, *, content: str, **kwargs) -> None:
14
+ super().__init__(**kwargs)
15
+ self.content = content
16
+ self.on_content_change(content)
17
+
18
+ def bind_content_to(self,
19
+ target_object: Any,
20
+ target_name: str = 'content',
21
+ forward: Callable = lambda x: x) -> Self:
22
+ """Bind the content of this element to the target object's target_name property.
23
+
24
+ The binding works one way only, from this element to the target.
25
+
26
+ :param target_object: The object to bind to.
27
+ :param target_name: The name of the property to bind to.
28
+ :param forward: A function to apply to the value before applying it to the target.
29
+ """
30
+ bind_to(self, 'content', target_object, target_name, forward)
31
+ return self
32
+
33
+ def bind_content_from(self,
34
+ target_object: Any,
35
+ target_name: str = 'content',
36
+ backward: Callable = lambda x: x) -> Self:
37
+ """Bind the content of this element from the target object's target_name property.
38
+
39
+ The binding works one way only, from the target to this element.
40
+
41
+ :param target_object: The object to bind from.
42
+ :param target_name: The name of the property to bind from.
43
+ :param backward: A function to apply to the value before applying it to this element.
44
+ """
45
+ bind_from(self, 'content', target_object, target_name, backward)
46
+ return self
47
+
48
+ def bind_content(self,
49
+ target_object: Any,
50
+ target_name: str = 'content', *,
51
+ forward: Callable = lambda x: x,
52
+ backward: Callable = lambda x: x) -> Self:
53
+ """Bind the content of this element to the target object's target_name property.
54
+
55
+ The binding works both ways, from this element to the target and from the target to this element.
56
+
57
+ :param target_object: The object to bind to.
58
+ :param target_name: The name of the property to bind to.
59
+ :param forward: A function to apply to the value before applying it to the target.
60
+ :param backward: A function to apply to the value before applying it to this element.
61
+ """
62
+ bind(self, 'content', target_object, target_name, forward=forward, backward=backward)
63
+ return self
64
+
65
+ def set_content(self, content: str) -> None:
66
+ """Set the content of this element.
67
+
68
+ :param content: The new content.
69
+ """
70
+ self.content = content
71
+
72
+ def on_content_change(self, content: str) -> None:
73
+ """Called when the content of this element changes.
74
+
75
+ :param content: The new content.
76
+ """
77
+ if self.CONTENT_PROP == 'innerHTML' and '</script>' in content:
78
+ raise ValueError('HTML elements must not contain <script> tags. Use ui.add_body_html() instead.')
79
+ self._props[self.CONTENT_PROP] = content
80
+ self.update()
@@ -0,0 +1,78 @@
1
+ from typing import Any, Callable, Optional
2
+
3
+ from typing_extensions import Self
4
+
5
+ from ...binding import BindableProperty, bind, bind_from, bind_to
6
+ from ...element import Element
7
+
8
+
9
+ class FilterElement(Element):
10
+ FILTER_PROP = 'filter'
11
+ filter = BindableProperty(on_change=lambda sender, filter: sender.on_filter_change(filter))
12
+
13
+ def __init__(self, *, filter: Optional[str] = None, **kwargs) -> None:
14
+ super().__init__(**kwargs)
15
+ self.filter = filter
16
+ self._props[self.FILTER_PROP] = filter
17
+
18
+ def bind_filter_to(self,
19
+ target_object: Any,
20
+ target_name: str = 'filter',
21
+ forward: Callable = lambda x: x) -> Self:
22
+ """Bind the filter of this element to the target object's target_name property.
23
+
24
+ The binding works one way only, from this element to the target.
25
+
26
+ :param target_object: The object to bind to.
27
+ :param target_name: The name of the property to bind to.
28
+ :param forward: A function to apply to the value before applying it to the target.
29
+ """
30
+ bind_to(self, 'filter', target_object, target_name, forward)
31
+ return self
32
+
33
+ def bind_filter_from(self,
34
+ target_object: Any,
35
+ target_name: str = 'filter',
36
+ backward: Callable = lambda x: x) -> Self:
37
+ """Bind the filter of this element from the target object's target_name property.
38
+
39
+ The binding works one way only, from the target to this element.
40
+
41
+ :param target_object: The object to bind from.
42
+ :param target_name: The name of the property to bind from.
43
+ :param backward: A function to apply to the value before applying it to this element.
44
+ """
45
+ bind_from(self, 'filter', target_object, target_name, backward)
46
+ return self
47
+
48
+ def bind_filter(self,
49
+ target_object: Any,
50
+ target_name: str = 'filter', *,
51
+ forward: Callable = lambda x: x,
52
+ backward: Callable = lambda x: x) -> Self:
53
+ """Bind the filter of this element to the target object's target_name property.
54
+
55
+ The binding works both ways, from this element to the target and from the target to this element.
56
+
57
+ :param target_object: The object to bind to.
58
+ :param target_name: The name of the property to bind to.
59
+ :param forward: A function to apply to the value before applying it to the target.
60
+ :param backward: A function to apply to the value before applying it to this element.
61
+ """
62
+ bind(self, 'filter', target_object, target_name, forward=forward, backward=backward)
63
+ return self
64
+
65
+ def set_filter(self, filter: str) -> None:
66
+ """Set the filter of this element.
67
+
68
+ :param filter: The new filter.
69
+ """
70
+ self.filter = filter
71
+
72
+ def on_filter_change(self, filter: str) -> None:
73
+ """Called when the filter of this element changes.
74
+
75
+ :param filter: The new filter.
76
+ """
77
+ self._props[self.FILTER_PROP] = filter
78
+ self.update()
@@ -0,0 +1,77 @@
1
+ from typing import Any, Callable
2
+
3
+ from typing_extensions import Self
4
+
5
+ from ...binding import BindableProperty, bind, bind_from, bind_to
6
+ from ...element import Element
7
+
8
+
9
+ class SourceElement(Element):
10
+ source = BindableProperty(on_change=lambda sender, source: sender.on_source_change(source))
11
+
12
+ def __init__(self, *, source: str, **kwargs) -> None:
13
+ super().__init__(**kwargs)
14
+ self.source = source
15
+ self._props['src'] = source
16
+
17
+ def bind_source_to(self,
18
+ target_object: Any,
19
+ target_name: str = 'source',
20
+ forward: Callable = lambda x: x) -> Self:
21
+ """Bind the source of this element to the target object's target_name property.
22
+
23
+ The binding works one way only, from this element to the target.
24
+
25
+ :param target_object: The object to bind to.
26
+ :param target_name: The name of the property to bind to.
27
+ :param forward: A function to apply to the value before applying it to the target.
28
+ """
29
+ bind_to(self, 'source', target_object, target_name, forward)
30
+ return self
31
+
32
+ def bind_source_from(self,
33
+ target_object: Any,
34
+ target_name: str = 'source',
35
+ backward: Callable = lambda x: x) -> Self:
36
+ """Bind the source of this element from the target object's target_name property.
37
+
38
+ The binding works one way only, from the target to this element.
39
+
40
+ :param target_object: The object to bind from.
41
+ :param target_name: The name of the property to bind from.
42
+ :param backward: A function to apply to the value before applying it to this element.
43
+ """
44
+ bind_from(self, 'source', target_object, target_name, backward)
45
+ return self
46
+
47
+ def bind_source(self,
48
+ target_object: Any,
49
+ target_name: str = 'source', *,
50
+ forward: Callable = lambda x: x,
51
+ backward: Callable = lambda x: x) -> Self:
52
+ """Bind the source of this element to the target object's target_name property.
53
+
54
+ The binding works both ways, from this element to the target and from the target to this element.
55
+
56
+ :param target_object: The object to bind to.
57
+ :param target_name: The name of the property to bind to.
58
+ :param forward: A function to apply to the value before applying it to the target.
59
+ :param backward: A function to apply to the value before applying it to this element.
60
+ """
61
+ bind(self, 'source', target_object, target_name, forward=forward, backward=backward)
62
+ return self
63
+
64
+ def set_source(self, source: str) -> None:
65
+ """Set the source of this element.
66
+
67
+ :param source: The new source.
68
+ """
69
+ self.source = source
70
+
71
+ def on_source_change(self, source: str) -> None:
72
+ """Called when the source of this element changes.
73
+
74
+ :param source: The new source.
75
+ """
76
+ self._props['src'] = source
77
+ self.update()
@@ -0,0 +1,80 @@
1
+ from typing import Any, Callable
2
+
3
+ from typing_extensions import Self
4
+
5
+ from ...binding import BindableProperty, bind, bind_from, bind_to
6
+ from ...element import Element
7
+
8
+
9
+ class TextElement(Element):
10
+ text = BindableProperty(on_change=lambda sender, text: sender.on_text_change(text))
11
+
12
+ def __init__(self, *, text: str, **kwargs) -> None:
13
+ super().__init__(**kwargs)
14
+ self.text = text
15
+ self._text_to_model_text(text)
16
+
17
+ def bind_text_to(self,
18
+ target_object: Any,
19
+ target_name: str = 'text',
20
+ forward: Callable = lambda x: x) -> Self:
21
+ """Bind the text of this element to the target object's target_name property.
22
+
23
+ The binding works one way only, from this element to the target.
24
+
25
+ :param target_object: The object to bind to.
26
+ :param target_name: The name of the property to bind to.
27
+ :param forward: A function to apply to the value before applying it to the target.
28
+ """
29
+ bind_to(self, 'text', target_object, target_name, forward)
30
+ return self
31
+
32
+ def bind_text_from(self,
33
+ target_object: Any,
34
+ target_name: str = 'text',
35
+ backward: Callable = lambda x: x) -> Self:
36
+ """Bind the text of this element from the target object's target_name property.
37
+
38
+ The binding works one way only, from the target to this element.
39
+
40
+ :param target_object: The object to bind from.
41
+ :param target_name: The name of the property to bind from.
42
+ :param backward: A function to apply to the value before applying it to this element.
43
+ """
44
+ bind_from(self, 'text', target_object, target_name, backward)
45
+ return self
46
+
47
+ def bind_text(self,
48
+ target_object: Any,
49
+ target_name: str = 'text', *,
50
+ forward: Callable = lambda x: x,
51
+ backward: Callable = lambda x: x) -> Self:
52
+ """Bind the text of this element to the target object's target_name property.
53
+
54
+ The binding works both ways, from this element to the target and from the target to this element.
55
+
56
+ :param target_object: The object to bind to.
57
+ :param target_name: The name of the property to bind to.
58
+ :param forward: A function to apply to the value before applying it to the target.
59
+ :param backward: A function to apply to the value before applying it to this element.
60
+ """
61
+ bind(self, 'text', target_object, target_name, forward=forward, backward=backward)
62
+ return self
63
+
64
+ def set_text(self, text: str) -> None:
65
+ """Set the text of this element.
66
+
67
+ :param text: The new text.
68
+ """
69
+ self.text = text
70
+
71
+ def on_text_change(self, text: str) -> None:
72
+ """Called when the text of this element changes.
73
+
74
+ :param text: The new text.
75
+ """
76
+ self._text_to_model_text(text)
77
+ self.update()
78
+
79
+ def _text_to_model_text(self, text: str) -> None:
80
+ self._text = text
@@ -0,0 +1,102 @@
1
+ from typing import Any, Callable, Dict, Optional
2
+
3
+ from typing_extensions import Self
4
+
5
+ from ...binding import BindableProperty, bind, bind_from, bind_to
6
+ from ...element import Element
7
+ from ...events import ValueChangeEventArguments, handle_event
8
+
9
+
10
+ class ValueElement(Element):
11
+ VALUE_PROP = 'model-value'
12
+ EVENT_ARGS = ['value']
13
+ LOOPBACK = True
14
+ value = BindableProperty(on_change=lambda sender, value: sender.on_value_change(value))
15
+
16
+ def __init__(self, *, value: Any, on_value_change: Optional[Callable], throttle: float = 0, **kwargs) -> None:
17
+ super().__init__(**kwargs)
18
+ self.set_value(value)
19
+ self._props[self.VALUE_PROP] = self._value_to_model_value(value)
20
+ self._props['loopback'] = self.LOOPBACK
21
+ self._send_update_on_value_change = True
22
+ self.change_handler = on_value_change
23
+
24
+ def handle_change(msg: Dict) -> None:
25
+ self._send_update_on_value_change = self.LOOPBACK
26
+ self.set_value(self._msg_to_value(msg))
27
+ self._send_update_on_value_change = True
28
+ self.on(f'update:{self.VALUE_PROP}', handle_change, self.EVENT_ARGS, throttle=throttle)
29
+
30
+ def bind_value_to(self,
31
+ target_object: Any,
32
+ target_name: str = 'value',
33
+ forward: Callable = lambda x: x) -> Self:
34
+ """Bind the value of this element to the target object's target_name property.
35
+
36
+ The binding works one way only, from this element to the target.
37
+
38
+ :param target_object: The object to bind to.
39
+ :param target_name: The name of the property to bind to.
40
+ :param forward: A function to apply to the value before applying it to the target.
41
+ """
42
+ bind_to(self, 'value', target_object, target_name, forward)
43
+ return self
44
+
45
+ def bind_value_from(self,
46
+ target_object: Any,
47
+ target_name: str = 'value',
48
+ backward: Callable = lambda x: x) -> Self:
49
+ """Bind the value of this element from the target object's target_name property.
50
+
51
+ The binding works one way only, from the target to this element.
52
+
53
+ :param target_object: The object to bind from.
54
+ :param target_name: The name of the property to bind from.
55
+ :param backward: A function to apply to the value before applying it to this element.
56
+ """
57
+ bind_from(self, 'value', target_object, target_name, backward)
58
+ return self
59
+
60
+ def bind_value(self,
61
+ target_object: Any,
62
+ target_name: str = 'value', *,
63
+ forward: Callable = lambda x: x,
64
+ backward: Callable = lambda x: x) -> Self:
65
+ """Bind the value of this element to the target object's target_name property.
66
+
67
+ The binding works both ways, from this element to the target and from the target to this element.
68
+
69
+ :param target_object: The object to bind to.
70
+ :param target_name: The name of the property to bind to.
71
+ :param forward: A function to apply to the value before applying it to the target.
72
+ :param backward: A function to apply to the value before applying it to this element.
73
+ """
74
+ bind(self, 'value', target_object, target_name, forward=forward, backward=backward)
75
+ return self
76
+
77
+ def set_value(self, value: Any) -> None:
78
+ """Set the value of this element.
79
+
80
+ :param value: The value to set.
81
+ """
82
+ self.value = value
83
+
84
+ def on_value_change(self, value: Any) -> None:
85
+ """Called when the value of this element changes.
86
+
87
+ :param value: The new value.
88
+ """
89
+ self._props[self.VALUE_PROP] = self._value_to_model_value(value)
90
+ if self._send_update_on_value_change:
91
+ self.update()
92
+ args = ValueChangeEventArguments(sender=self, client=self.client, value=self._value_to_event_value(value))
93
+ handle_event(self.change_handler, args)
94
+
95
+ def _msg_to_value(self, msg: Dict) -> Any:
96
+ return msg['args']
97
+
98
+ def _value_to_model_value(self, value: Any) -> Any:
99
+ return value
100
+
101
+ def _value_to_event_value(self, value: Any) -> Any:
102
+ return value