pgwidgets-js 0.4.3__tar.gz → 0.5.0__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 (215) hide show
  1. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/PKG-INFO +1 -1
  2. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/WhatsNew.rst +14 -0
  3. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/layout.rst +71 -2
  4. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/package.json +1 -1
  5. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/defs.py +7 -2
  6. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TabWidget.js +255 -33
  7. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js.egg-info/PKG-INFO +1 -1
  8. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js.egg-info/SOURCES.txt +2 -0
  9. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js.egg-info/scm_file_list.json +2 -0
  10. pgwidgets_js-0.5.0/pgwidgets_js.egg-info/scm_version.json +8 -0
  11. pgwidgets_js-0.5.0/tests/tabwidget_dnd.mjs +318 -0
  12. pgwidgets_js-0.5.0/tests/test_tabwidget_dnd.py +26 -0
  13. pgwidgets_js-0.4.3/pgwidgets_js.egg-info/scm_version.json +0 -8
  14. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/.flake8 +0 -0
  15. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/.github/workflows/tests.yml +0 -0
  16. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/.gitignore +0 -0
  17. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/.readthedocs.yaml +0 -0
  18. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/LICENSE.md +0 -0
  19. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/MANIFEST.in +0 -0
  20. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/README.md +0 -0
  21. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/Widgets.css +0 -0
  22. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/Widgets.js +0 -0
  23. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/Makefile +0 -0
  24. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/callbacks.rst +0 -0
  25. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/conf.py +0 -0
  26. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/electron.rst +0 -0
  27. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/external-widgets.rst +0 -0
  28. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/for-developers.rst +0 -0
  29. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/frameworks.rst +0 -0
  30. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/getting-started.rst +0 -0
  31. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/index.rst +0 -0
  32. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/pyodide.rst +0 -0
  33. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/remote.rst +0 -0
  34. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/styling.rst +0 -0
  35. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/controls.rst +0 -0
  36. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/dialogs.rst +0 -0
  37. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/display.rst +0 -0
  38. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/index.rst +0 -0
  39. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/menus.rst +0 -0
  40. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/nonvisual.rst +0 -0
  41. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/docs/widgets/text.rst +0 -0
  42. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/all_widgets.html +0 -0
  43. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/all_widgets_pyodide.html +0 -0
  44. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/all_widgets_pyodide.py +0 -0
  45. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/all_widgets_pyscript.html +0 -0
  46. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/all_widgets_pyscript.py +0 -0
  47. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/box.html +0 -0
  48. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/button.html +0 -0
  49. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/canvas.html +0 -0
  50. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/checkbox.html +0 -0
  51. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/colordialog.html +0 -0
  52. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/combobox.html +0 -0
  53. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/debug_spinbox.html +0 -0
  54. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/dial.html +0 -0
  55. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/dialog.html +0 -0
  56. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/electron/.gitignore +0 -0
  57. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/electron/.npmrc +0 -0
  58. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/electron/index.html +0 -0
  59. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/electron/main.js +0 -0
  60. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/electron/package.json +0 -0
  61. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/expander.html +0 -0
  62. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/external_widgets.html +0 -0
  63. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/fixedlayout.html +0 -0
  64. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/frame.html +0 -0
  65. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/gridbox.html +0 -0
  66. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/htmlview.html +0 -0
  67. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/image.html +0 -0
  68. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/label.html +0 -0
  69. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/mdi_widget.html +0 -0
  70. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/menu.html +0 -0
  71. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/progressbar.html +0 -0
  72. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/pyodide_demo.html +0 -0
  73. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/pyscript.toml +0 -0
  74. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/radiobutton.html +0 -0
  75. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/remote.html +0 -0
  76. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/remote_demo.py +0 -0
  77. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/remote_demo_async.py +0 -0
  78. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/scroll_area.html +0 -0
  79. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/scrollable.html +0 -0
  80. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/scrollbar.html +0 -0
  81. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/slider.html +0 -0
  82. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/spinbox.html +0 -0
  83. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/splitter.html +0 -0
  84. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/tab_widget.html +0 -0
  85. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/tableview.html +0 -0
  86. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/text_entry.html +0 -0
  87. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/textarea.html +0 -0
  88. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/textentryset.html +0 -0
  89. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/textsource.html +0 -0
  90. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/togglebutton.html +0 -0
  91. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/toolbar.html +0 -0
  92. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/treeview.html +0 -0
  93. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/examples/videowidget.html +0 -0
  94. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/__init__.py +0 -0
  95. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/pyodide/__init__.py +0 -0
  96. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/pyodide/log.py +0 -0
  97. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/pyodide/widget.py +0 -0
  98. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/Widgets.css +0 -0
  99. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/Widgets.js +0 -0
  100. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/AbstractScrollArea.css +0 -0
  101. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Box.css +0 -0
  102. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Button.css +0 -0
  103. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/CheckBox.css +0 -0
  104. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ColorDialog.css +0 -0
  105. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ComboBox.css +0 -0
  106. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Dial.css +0 -0
  107. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Dialog.css +0 -0
  108. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Expander.css +0 -0
  109. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ExternalWidget.css +0 -0
  110. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/FixedLayout.css +0 -0
  111. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Frame.css +0 -0
  112. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/GridBox.css +0 -0
  113. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/HtmlView.css +0 -0
  114. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Image.css +0 -0
  115. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Label.css +0 -0
  116. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/MDIWidget.css +0 -0
  117. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Menu.css +0 -0
  118. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ProgressBar.css +0 -0
  119. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/RadioButton.css +0 -0
  120. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ScrollArea.css +0 -0
  121. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ScrollBar.css +0 -0
  122. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Slider.css +0 -0
  123. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/SpinBox.css +0 -0
  124. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Splitter.css +0 -0
  125. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/StatusBar.css +0 -0
  126. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/TabWidget.css +0 -0
  127. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Text.css +0 -0
  128. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/TextArea.css +0 -0
  129. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/TextEntrySet.css +0 -0
  130. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/TextSource.css +0 -0
  131. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ToggleButton.css +0 -0
  132. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/ToolBar.css +0 -0
  133. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/TopLevel.css +0 -0
  134. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/TreeView.css +0 -0
  135. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/VideoWidget.css +0 -0
  136. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/Widget.css +0 -0
  137. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/css/WindowMenu.css +0 -0
  138. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/icons/file.svg +0 -0
  139. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/icons/folder.svg +0 -0
  140. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/icons/hdots.svg +0 -0
  141. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/icons/pgicon.svg +0 -0
  142. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/icons/pgwidgets-logo.png +0 -0
  143. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/icons/pgwidgets-logo.svg +0 -0
  144. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/icons/vdots.svg +0 -0
  145. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/AbstractScrollArea.js +0 -0
  146. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Box.js +0 -0
  147. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Button.js +0 -0
  148. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Callback.js +0 -0
  149. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Canvas.js +0 -0
  150. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/CheckBox.js +0 -0
  151. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ColorDialog.js +0 -0
  152. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ColorWidget.js +0 -0
  153. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ComboBox.js +0 -0
  154. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ComboBoxNative.js +0 -0
  155. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Dial.js +0 -0
  156. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Dialog.js +0 -0
  157. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Expander.js +0 -0
  158. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ExternalWidget.js +0 -0
  159. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/FileDialog.js +0 -0
  160. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/FixedLayout.js +0 -0
  161. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Frame.js +0 -0
  162. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/GridBox.js +0 -0
  163. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/HtmlView.js +0 -0
  164. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Image.js +0 -0
  165. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Label.js +0 -0
  166. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/MDIWidget.js +0 -0
  167. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Menu.js +0 -0
  168. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/MenuAction.js +0 -0
  169. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/MenuBar.js +0 -0
  170. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Page.js +0 -0
  171. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ProgressBar.js +0 -0
  172. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/RadioButton.js +0 -0
  173. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/RemoteInterface.js +0 -0
  174. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ScrollArea.js +0 -0
  175. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ScrollBar.js +0 -0
  176. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Separator.js +0 -0
  177. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Slider.js +0 -0
  178. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/SpinBox.js +0 -0
  179. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Splitter.js +0 -0
  180. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/StatusBar.js +0 -0
  181. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TableView.js +0 -0
  182. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TextArea.js +0 -0
  183. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TextEntry.js +0 -0
  184. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TextEntrySet.js +0 -0
  185. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TextSource.js +0 -0
  186. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TextWidget.js +0 -0
  187. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Timer.js +0 -0
  188. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ToggleButton.js +0 -0
  189. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ToolBar.js +0 -0
  190. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/ToolBarAction.js +0 -0
  191. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TopLevel.js +0 -0
  192. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/TreeView.js +0 -0
  193. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/VideoWidget.js +0 -0
  194. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/Widget.js +0 -0
  195. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/modules/WindowMenu.js +0 -0
  196. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js/static/remote.html +0 -0
  197. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js.egg-info/dependency_links.txt +0 -0
  198. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js.egg-info/requires.txt +0 -0
  199. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pgwidgets_js.egg-info/top_level.txt +0 -0
  200. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/pyproject.toml +0 -0
  201. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/setup.cfg +0 -0
  202. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/setup.py +0 -0
  203. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/__init__.py +0 -0
  204. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_consistency.py +0 -0
  205. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_defs.py +0 -0
  206. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_recent_additions.py +0 -0
  207. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_static_assets.py +0 -0
  208. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_treeview_diff.py +0 -0
  209. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_treeview_resize.py +0 -0
  210. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_treeview_select.py +0 -0
  211. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/test_treeview_sort.py +0 -0
  212. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/treeview_diff.mjs +0 -0
  213. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/treeview_resize.mjs +0 -0
  214. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/treeview_select.mjs +0 -0
  215. {pgwidgets_js-0.4.3 → pgwidgets_js-0.5.0}/tests/treeview_sort.mjs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgwidgets-js
3
- Version: 0.4.3
3
+ Version: 0.5.0
4
4
  Summary: pgwidgets JavaScript widget library — static assets for use with Python servers
5
5
  Author: PGWidgets Developers
6
6
  License-Expression: BSD-3-Clause
@@ -1,6 +1,20 @@
1
1
  What's New
2
2
  ==========
3
3
 
4
+ Recent changes — since ``v0.4.3``
5
+ ---------------------------------
6
+
7
+ * TabWidget: new ``movable``, ``detachable`` and ``group`` options.
8
+ Tabs can be dragged between movable TabWidgets of the same group, and
9
+ dropped on the page background to detach them (``page-detach``); see
10
+ :ref:`tab-dragging`.
11
+ * TabWidget: new ``insert_widget()``, ``move_tab()`` and
12
+ ``move_tab_from()`` methods, and ``page-move``/``page-reorder``
13
+ callbacks reporting tabs the user dragged. A drag-reorder used to go
14
+ unreported.
15
+ * TabWidget: closing a tab that isn't the current one no longer switches
16
+ to another tab, nor fails.
17
+
4
18
  Recent changes — since ``v0.4.2``
5
19
  ---------------------------------
6
20
 
@@ -375,12 +375,18 @@ TabWidget
375
375
 
376
376
  Tabbed container with switchable pages.
377
377
 
378
- **Constructor:** ``new Widgets.TabWidget({closable, reorderable, tab_position})``
378
+ **Constructor:** ``new Widgets.TabWidget({closable, reorderable, movable, detachable, group, tab_position})``
379
379
 
380
380
  **Options:**
381
381
 
382
382
  - ``closable`` -- show close buttons on tabs
383
- - ``reorderable`` -- allow tab drag reordering
383
+ - ``reorderable`` -- a tab can be dragged to another position in the tab bar
384
+ - ``movable`` -- a tab can be dragged to another movable TabWidget of the
385
+ same ``group`` (see :ref:`tab-dragging`)
386
+ - ``detachable`` -- a tab can be dropped on the page background (see
387
+ :ref:`tab-dragging`)
388
+ - ``group`` -- tabs move only between TabWidgets with the same group
389
+ (default ``0``)
384
390
  - ``tab_position`` -- tab bar position (``"top"``, ``"bottom"``, ``"left"``, ``"right"``)
385
391
 
386
392
  **Methods:**
@@ -393,6 +399,13 @@ Tabbed container with switchable pages.
393
399
  - Description
394
400
  * - ``add_widget(child, options)``
395
401
  - Add a tab. *options* can include ``{title: "..."}``
402
+ * - ``insert_widget(index, child, options)``
403
+ - Insert a tab at position *index* (``-1`` appends).
404
+ * - ``move_tab(child, index)``
405
+ - Move the tab of *child* to position *index* and show it.
406
+ * - ``move_tab_from(src, child, index)``
407
+ - Move the tab of *child* from TabWidget *src* to position *index*
408
+ here (``-1`` appends) and show it.
396
409
  * - ``show_widget(child)``
397
410
  - Switch to the tab containing *child*.
398
411
  * - ``close_widget(child)``
@@ -417,6 +430,17 @@ Tabbed container with switchable pages.
417
430
  - ``child-added``, ``child-removed`` -- container child events.
418
431
  - ``page-switch`` -- fired when the active tab changes. Handler receives ``(widget, child, index)``.
419
432
  - ``page-close`` -- fired when a tab close button is clicked.
433
+ - ``page-move`` -- fired on the destination after the user dragged a tab
434
+ here from another TabWidget. Handler receives ``(widget, src, child, index)``.
435
+ - ``page-reorder`` -- fired after the user dragged a tab to a new
436
+ position in the same TabWidget. Handler receives ``(widget, child, index)``.
437
+ - ``page-detach`` -- fired when the user drops a tab on the page
438
+ background. Handler receives ``(widget, child, x, y)``, the page
439
+ position of the drop. The tab is *not* removed: the handler decides
440
+ what to do with it.
441
+
442
+ The ``move_tab*`` methods and ``insert_widget`` fire no ``page-*``
443
+ callbacks; those report what the user did.
420
444
 
421
445
  .. code-block:: javascript
422
446
 
@@ -425,6 +449,51 @@ Tabbed container with switchable pages.
425
449
  tabs.add_widget(page2, {title: "Second"});
426
450
  tabs.add_callback('page-switch', (w) => console.log("switched"));
427
451
 
452
+ .. _tab-dragging:
453
+
454
+ Dragging tabs
455
+ ~~~~~~~~~~~~~
456
+
457
+ Three independent options say what the user can do by dragging a tab:
458
+
459
+ - ``reorderable`` -- drop it elsewhere on its own tab bar to change its
460
+ position (``page-reorder``).
461
+ - ``movable`` -- drop it on another TabWidget with ``movable`` set and the
462
+ same ``group``: on its tab bar, to put it at that position, or on its
463
+ page, to add it at the end (``page-move``). Both TabWidgets must be
464
+ movable. A tab can't be dropped into a TabWidget inside of itself.
465
+ - ``detachable`` -- drop it on the page background, outside of any
466
+ window (``page-detach``). This is the browser's counterpart of
467
+ dragging a tab out of an application onto the desktop. A tab can only
468
+ be dropped there if something has registered for ``page-detach``.
469
+
470
+ A drop anywhere else -- on a TabWidget of another group, on some other
471
+ widget, or outside of the browser window -- cancels the drag. If the
472
+ TabWidget under the pointer won't take the tab, an enclosing TabWidget
473
+ that would is offered it instead.
474
+
475
+ Moves and reorders are made by the TabWidget itself. A detached tab
476
+ has to be given a new home by the ``page-detach`` handler, typically a
477
+ TabWidget (configured like the source) in a new ``TopLevel`` placed at
478
+ the drop position:
479
+
480
+ .. code-block:: javascript
481
+
482
+ let left = new Widgets.TabWidget({movable: true, detachable: true, group: 1});
483
+ let right = new Widgets.TabWidget({movable: true, detachable: true, group: 1});
484
+ // tabs can now be dragged between left and right
485
+
486
+ left.add_callback('page-detach', (w, child, x, y) => {
487
+ let tabs = new Widgets.TabWidget({movable: true, detachable: true,
488
+ group: 1});
489
+ let top = new Widgets.TopLevel({title: "Detached", resizable: true});
490
+ top.set_widget(tabs);
491
+ w.remove(child);
492
+ tabs.add_widget(child, {title: "Detached"});
493
+ top.set_position(x, y);
494
+ top.show();
495
+ });
496
+
428
497
  .. _widget-stackwidget:
429
498
 
430
499
  StackWidget
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgwidgets",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "A native JavaScript widget library with Qt/GTK-style layout and controls",
5
5
  "type": "module",
6
6
  "main": "Widgets.js",
@@ -246,9 +246,13 @@ WIDGETS = {
246
246
  "TabWidget": {
247
247
  "base": "container",
248
248
  "args": [],
249
- "options": ["closable", "reorderable", "tab_position"],
249
+ "options": ["closable", "reorderable", "movable", "detachable",
250
+ "group", "tab_position"],
250
251
  "methods": {
251
252
  "add_widget": ["child", "options"],
253
+ "insert_widget": ["index", "child", "options"],
254
+ "move_tab": ["child", "index"],
255
+ "move_tab_from": ["src", "child", "index"],
252
256
  "show_widget": ["child"],
253
257
  "close_widget": ["child"],
254
258
  "set_index": ["index"],
@@ -260,7 +264,8 @@ WIDGETS = {
260
264
  "highlight_tab": ["child", "bgcolor"],
261
265
  "set_tab_position": ["tabpos"],
262
266
  },
263
- "callbacks": [*CONTAINER_CALLBACKS, "page-switch", "page-close"],
267
+ "callbacks": [*CONTAINER_CALLBACKS, "page-switch", "page-close",
268
+ "page-move", "page-reorder", "page-detach"],
264
269
  },
265
270
 
266
271
  "StackWidget": {
@@ -2,6 +2,54 @@
2
2
 
3
3
  import {ContainerWidget} from "./Widget.js";
4
4
 
5
+ /**
6
+ * MIME type under which a tab drag carries its (JSON) description.
7
+ * Only drags within the same page are acted on; the description leaves
8
+ * room for drags between pages in the future.
9
+ */
10
+ const TAB_MIME_TYPE = 'application/x-pgwidgets-tab';
11
+
12
+ // the tab being dragged, if any: {src, tab_id, child}. The browser
13
+ // hides the dragged data until the drop, so the drop targets look here
14
+ // to decide whether they would accept it.
15
+ let _tabDrag = null;
16
+
17
+ // the drop handlers for the "desktop" (the page background), which
18
+ // take tabs that are detached from their TabWidget
19
+ let _desktopInstalled = false;
20
+
21
+ function _isDesktop(target) {
22
+ return (target === document.body || target === document.documentElement);
23
+ }
24
+
25
+ function _canDetach(drag) {
26
+ const src = drag.src;
27
+ const cbs = src.cb['page-detach'];
28
+ return src.detachable && cbs !== undefined && cbs.length > 0;
29
+ }
30
+
31
+ function _installDesktop() {
32
+ if (_desktopInstalled) return;
33
+ _desktopInstalled = true;
34
+ document.addEventListener('dragover', (event) => {
35
+ if (_tabDrag !== null && _isDesktop(event.target)
36
+ && _canDetach(_tabDrag)) {
37
+ event.preventDefault();
38
+ event.dataTransfer.dropEffect = 'move';
39
+ }
40
+ });
41
+ document.addEventListener('drop', (event) => {
42
+ if (_tabDrag !== null && _isDesktop(event.target)
43
+ && _canDetach(_tabDrag)) {
44
+ event.preventDefault();
45
+ const drag = _tabDrag;
46
+ _tabDrag = null;
47
+ drag.src.make_callback('page-detach', drag.child,
48
+ event.pageX, event.pageY);
49
+ }
50
+ });
51
+ }
52
+
5
53
  /**
6
54
  * A tabbed container widget similar to Qt's QTabWidget.
7
55
  * Displays child widgets as selectable tabs with support for closable tabs,
@@ -11,6 +59,22 @@ import {ContainerWidget} from "./Widget.js";
11
59
  * Callbacks:
12
60
  * - 'page-switch': fired when the active tab changes.
13
61
  * - 'page-close': fired when a tab close button is clicked.
62
+ * - 'page-move' (src, child, index): fired on the destination after a
63
+ * tab has been dragged here from TabWidget `src` and inserted at
64
+ * `index`.
65
+ * - 'page-reorder' (child, index): fired after a tab has been dragged
66
+ * to position `index` within this widget.
67
+ * - 'page-detach' (child, x, y): fired when a tab is dropped on the page
68
+ * background at page position x, y. The tab is NOT removed: it is up
69
+ * to the handler to give it a new home (e.g. a TabWidget in a new
70
+ * TopLevel). A tab can be dropped there only if someone handles this.
71
+ *
72
+ * Dragging tabs:
73
+ * - `reorderable`: a tab can be dragged to another position in the tab bar
74
+ * - `movable`: a tab can be dragged to another movable TabWidget having
75
+ * the same `group`; it can be dropped on that widget's tab bar or page
76
+ * - `detachable`: a tab can be dropped on the page background
77
+ * A drop anywhere else cancels the drag.
14
78
  */
15
79
  class TabWidget extends ContainerWidget {
16
80
 
@@ -19,6 +83,9 @@ class TabWidget extends ContainerWidget {
19
83
  * @param {Object} [options] - Configuration options.
20
84
  * @param {boolean} [options.closable=false] - Whether tabs have close buttons.
21
85
  * @param {boolean} [options.reorderable=false] - Whether tabs can be reordered by dragging.
86
+ * @param {boolean} [options.movable=false] - Whether tabs can be dragged to another TabWidget of the same group.
87
+ * @param {boolean} [options.detachable=false] - Whether tabs can be dropped on the page background.
88
+ * @param {number} [options.group=0] - Tabs move only between TabWidgets of the same group.
22
89
  * @param {string} [options.tab_position='top'] - Position of tabs: 'top', 'bottom', 'left', 'right', or 'none'.
23
90
  * @param {HTMLElement} [options.element=null] - Optional pre-existing DOM element to use.
24
91
  */
@@ -36,6 +103,9 @@ class TabWidget extends ContainerWidget {
36
103
  this.closable = false;
37
104
  this.closable = this.get_option(options, 'closable', false);
38
105
  this.reorderable = this.get_option(options, 'reorderable', false);
106
+ this.movable = this.get_option(options, 'movable', false);
107
+ this.detachable = this.get_option(options, 'detachable', false);
108
+ this.group = this.get_option(options, 'group', 0);
39
109
  this.tabPos = this.get_option(options, 'tab_position', 'top');
40
110
 
41
111
  this.tabContentContainer = document.createElement('div');
@@ -48,9 +118,18 @@ class TabWidget extends ContainerWidget {
48
118
 
49
119
  this.set_tab_position(this.tabPos);
50
120
 
51
- for (let name of ['page-switch', 'page-close']) {
121
+ for (let name of ['page-switch', 'page-close', 'page-move',
122
+ 'page-reorder', 'page-detach']) {
52
123
  this.enable_callback(name);
53
124
  }
125
+
126
+ // tabs dragged from another TabWidget can be dropped anywhere
127
+ // on this one
128
+ this.element.addEventListener('dragover', this._handleDragOver);
129
+ this.element.addEventListener('drop', this._handleDrop);
130
+ if (this.detachable) {
131
+ _installDesktop();
132
+ }
54
133
  }
55
134
 
56
135
  /**
@@ -81,8 +160,10 @@ class TabWidget extends ContainerWidget {
81
160
  return null;
82
161
  }
83
162
 
84
- _addTab(title, child) {
85
- const index = this.tabs.length;
163
+ _addTab(title, child, index = -1) {
164
+ if (index < 0 || index > this.tabs.length) {
165
+ index = this.tabs.length;
166
+ }
86
167
  const tab_id = `tab_${this.tab_id_counter++}`;
87
168
  let tabButton = null;
88
169
  let content = child.get_element();
@@ -106,26 +187,31 @@ class TabWidget extends ContainerWidget {
106
187
  tabButton.appendChild(closeButton);
107
188
  }
108
189
 
109
- if (this.reorderable) {
190
+ if (this.reorderable || this.movable || this.detachable) {
110
191
  tabButton.setAttribute('draggable', true);
111
192
  tabButton.classList.add('draggable');
112
- tabButton.addEventListener('dragstart', (event) => this.handleDragStart(event, tab_id));
113
- tabButton.addEventListener('dragover', (event) => event.preventDefault());
114
- tabButton.addEventListener('drop', this.handleDrop);
193
+ tabButton.addEventListener('dragstart', (event) => this._handleDragStart(event, tab_id));
194
+ tabButton.addEventListener('dragend', this._handleDragEnd);
115
195
  }
116
196
 
117
197
  tabButton.addEventListener('click', () => this._showTab(tab_id));
118
-
119
- this.tabHeader.appendChild(tabButton);
198
+
199
+ if (index < this.tabs.length) {
200
+ const before = this.tab_info.get(this.tabs[index]).tabButton;
201
+ this.tabHeader.insertBefore(tabButton, before);
202
+ } else {
203
+ this.tabHeader.appendChild(tabButton);
204
+ }
120
205
  }
121
206
 
122
207
  let tab_rec = { title, content, tabButton, child };
123
208
  this.tab_info.set(tab_id, tab_rec);
124
- this.tabs.push(tab_id);
209
+ this.tabs.splice(index, 0, tab_id);
125
210
 
126
- if (index === 0) {
211
+ if (this.tabs.length === 1) {
127
212
  this._showTab(tab_id);
128
213
  }
214
+ return tab_id;
129
215
  }
130
216
 
131
217
  _showTab(tab_id) {
@@ -153,7 +239,8 @@ class TabWidget extends ContainerWidget {
153
239
  _closeTab(tab_id) {
154
240
  const tab_rec = this.tab_info.get(tab_id);
155
241
  if (tab_rec) {
156
- if (tab_id === this.current_tab_id) {
242
+ const was_current = (tab_id === this.current_tab_id);
243
+ if (was_current) {
157
244
  this.current_tab_id = -1;
158
245
  }
159
246
 
@@ -163,11 +250,15 @@ class TabWidget extends ContainerWidget {
163
250
  if (tab_rec.tabButton !== null) {
164
251
  this.tabHeader.removeChild(tab_rec.tabButton);
165
252
  }
166
- this.tabContentContainer.removeChild(tab_rec.content);
253
+ // only the current tab's content is in the container
254
+ if (tab_rec.content.parentNode === this.tabContentContainer) {
255
+ this.tabContentContainer.removeChild(tab_rec.content);
256
+ }
167
257
  this.tab_info.delete(tab_id);
168
258
 
169
- // if there are any tabs left to show, show one
170
- if (this.tabs.length > 0) {
259
+ // if the current tab was closed and there are any tabs left
260
+ // to show, show one
261
+ if (was_current && this.tabs.length > 0) {
171
262
  const new_index = Math.min(index, this.tabs.length - 1);
172
263
  let new_tab_id = this.tabs[new_index];
173
264
  this._showTab(new_tab_id);
@@ -175,30 +266,146 @@ class TabWidget extends ContainerWidget {
175
266
  }
176
267
  }
177
268
 
178
- handleDragStart(event, tab_id) {
179
- event.dataTransfer.setData('text/plain', tab_id);
269
+ // --- dragging tabs ---
270
+
271
+ _handleDragStart(event, tab_id) {
272
+ const tab_rec = this.tab_info.get(tab_id);
273
+ if (!tab_rec) return;
274
+ _tabDrag = { src: this, tab_id: tab_id, child: tab_rec.child };
275
+ event.dataTransfer.effectAllowed = 'move';
276
+ event.dataTransfer.setData(TAB_MIME_TYPE, JSON.stringify(
277
+ { group: this.group, title: tab_rec.title,
278
+ index: this.tabs.indexOf(tab_id) }));
180
279
  event.target.classList.add('dragging');
280
+ if (this.detachable) {
281
+ _installDesktop();
282
+ }
283
+ }
284
+
285
+ _handleDragEnd = (event) => {
286
+ event.target.classList.remove('dragging');
287
+ _tabDrag = null;
288
+ }
289
+
290
+ /**
291
+ * True if this widget would take the tab being dragged, if it were
292
+ * dropped on `target` (a DOM element in this widget).
293
+ */
294
+ _acceptsDrag(drag, target) {
295
+ if (drag.src === this) {
296
+ // only a reorder, within the tab bar
297
+ return (this.reorderable && this.tabHeader !== undefined
298
+ && this.tabHeader.contains(target));
299
+ }
300
+ if (!(this.movable && drag.src.movable
301
+ && drag.src.group === this.group)) {
302
+ return false;
303
+ }
304
+ if (drag.src.get_tab_id(drag.child) !== drag.tab_id) {
305
+ return false; // no longer there
306
+ }
307
+ // a tab can't be dropped into a widget inside of itself
308
+ return !drag.child.get_element().contains(this.element);
181
309
  }
182
310
 
183
- handleDrop = (event) => {
311
+ /** The index at which a tab dropped at (x, y) would be inserted. */
312
+ _dropIndex(x, y) {
313
+ const vertical = (this.tabPos === 'left' || this.tabPos === 'right');
314
+ for (let i = 0; i < this.tabs.length; i++) {
315
+ const btn = this.tab_info.get(this.tabs[i]).tabButton;
316
+ if (btn === null) continue;
317
+ const r = btn.getBoundingClientRect();
318
+ if (vertical ? (y < r.top + r.height / 2)
319
+ : (x < r.left + r.width / 2)) {
320
+ return i;
321
+ }
322
+ }
323
+ return this.tabs.length;
324
+ }
325
+
326
+ _handleDragOver = (event) => {
327
+ if (_tabDrag === null || !this._acceptsDrag(_tabDrag, event.target)) {
328
+ // let an enclosing widget, or the desktop, consider it
329
+ return;
330
+ }
184
331
  event.preventDefault();
185
- const tab_id = event.dataTransfer.getData('text/plain');
186
- const draggedIndex = this.tabs.indexOf(tab_id);
187
- const targetIndex = this.tabs.findIndex(tab_id => this.tab_info.get(tab_id).tabButton === event.target.closest('button'));
332
+ event.stopPropagation();
333
+ event.dataTransfer.dropEffect = 'move';
334
+ }
188
335
 
189
- console.log("dragged index == "+draggedIndex+", target_index="+targetIndex)
190
- if (draggedIndex !== -1 && targetIndex !== -1) {
191
- const tabBtnBefore = this.tab_info.get(this.tabs[targetIndex]).tabButton;
192
- const [removed] = this.tabs.splice(draggedIndex, 1);
193
- this.tabs.splice(targetIndex, 0, removed);
336
+ _handleDrop = (event) => {
337
+ if (_tabDrag === null || !this._acceptsDrag(_tabDrag, event.target)) {
338
+ return;
339
+ }
340
+ event.preventDefault();
341
+ event.stopPropagation();
342
+ const drag = _tabDrag;
343
+ _tabDrag = null;
344
+
345
+ let index = this.tabs.length;
346
+ if (this.tabHeader !== undefined
347
+ && this.tabHeader.contains(event.target)) {
348
+ index = this._dropIndex(event.clientX, event.clientY);
349
+ }
350
+ if (drag.src === this) {
351
+ const old_index = this.tabs.indexOf(drag.tab_id);
352
+ if (index > old_index) {
353
+ index -= 1; // allow for the tab leaving its old place
354
+ }
355
+ if (index !== old_index) {
356
+ this.move_tab(drag.child, index);
357
+ this.make_callback('page-reorder', drag.child, index);
358
+ }
359
+ } else {
360
+ this.move_tab_from(drag.src, drag.child, index);
361
+ this.make_callback('page-move', drag.src, drag.child,
362
+ this.index_of(drag.child));
363
+ }
364
+ }
194
365
 
195
- const moved_tab_rec = this.tab_info.get(tab_id);
196
- this.tabHeader.removeChild(moved_tab_rec.tabButton);
197
- this.tabHeader.insertBefore(moved_tab_rec.tabButton, tabBtnBefore.nextSibling)
198
- this.set_index(targetIndex);
366
+ /**
367
+ * Moves the tab holding `child` to position `index` in this widget
368
+ * and makes it the current tab. Fires no callbacks.
369
+ * @param {Widget} child - The child widget whose tab to move.
370
+ * @param {number} index - Its new 0-based position.
371
+ */
372
+ move_tab(child, index) {
373
+ const tab_id = this.get_tab_id(child);
374
+ if (tab_id === null) return;
375
+ const old_index = this.tabs.indexOf(tab_id);
376
+ index = Math.max(0, Math.min(index, this.tabs.length - 1));
377
+ this.tabs.splice(old_index, 1);
378
+ this.tabs.splice(index, 0, tab_id);
379
+ const btn = this.tab_info.get(tab_id).tabButton;
380
+ if (btn !== null) {
381
+ const next = (index + 1 < this.tabs.length)
382
+ ? this.tab_info.get(this.tabs[index + 1]).tabButton : null;
383
+ this.tabHeader.insertBefore(btn, next);
384
+ }
385
+ // keep the children in tab order
386
+ const idx = this.children.indexOf(child);
387
+ if (idx > -1) {
388
+ this.children.splice(idx, 1);
389
+ this.children.splice(index, 0, child);
199
390
  }
391
+ this._showTab(tab_id);
392
+ }
200
393
 
201
- event.target.classList.remove('dragging');
394
+ /**
395
+ * Moves the tab holding `child` from TabWidget `src` to position
396
+ * `index` in this widget (appended if -1) and makes it the current
397
+ * tab. Fires no 'page-move' callback.
398
+ * @param {TabWidget} src - The TabWidget the tab is in.
399
+ * @param {Widget} child - The child widget whose tab to move.
400
+ * @param {number} [index=-1] - Its position in this widget.
401
+ */
402
+ move_tab_from(src, child, index = -1) {
403
+ const tab_id = src.get_tab_id(child);
404
+ if (tab_id === null) return;
405
+ const title = src.tab_info.get(tab_id).title;
406
+ src.remove(child);
407
+ this.insert_widget(index, child, { title: title });
408
+ this.show_widget(child);
202
409
  }
203
410
 
204
411
  /**
@@ -219,8 +426,23 @@ class TabWidget extends ContainerWidget {
219
426
  * @param {string} [options.title=''] - The title shown on the tab header.
220
427
  */
221
428
  add_widget(child, options = { title: "" }) {
222
- let tab = this._addTab(options.title, child);
223
- this.children.push(child);
429
+ this.insert_widget(-1, child, options);
430
+ }
431
+
432
+ /**
433
+ * Inserts a child widget as a new tab at the given position.
434
+ * @param {number} index - The 0-based position; -1 appends.
435
+ * @param {Widget} child - The widget to add.
436
+ * @param {Object} [options] - Tab options.
437
+ * @param {string} [options.title=''] - The title shown on the tab header.
438
+ */
439
+ insert_widget(index, child, options = { title: "" }) {
440
+ if (index < 0 || index > this.tabs.length) {
441
+ index = this.tabs.length;
442
+ }
443
+ const title = (options && options.title) ? options.title : "";
444
+ this._addTab(title, child, index);
445
+ this.children.splice(index, 0, child);
224
446
  this.make_callback('child-added', child);
225
447
  }
226
448
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgwidgets-js
3
- Version: 0.4.3
3
+ Version: 0.5.0
4
4
  Summary: pgwidgets JavaScript widget library — static assets for use with Python servers
5
5
  Author: PGWidgets Developers
6
6
  License-Expression: BSD-3-Clause
@@ -196,10 +196,12 @@ pgwidgets_js/static/modules/VideoWidget.js
196
196
  pgwidgets_js/static/modules/Widget.js
197
197
  pgwidgets_js/static/modules/WindowMenu.js
198
198
  tests/__init__.py
199
+ tests/tabwidget_dnd.mjs
199
200
  tests/test_consistency.py
200
201
  tests/test_defs.py
201
202
  tests/test_recent_additions.py
202
203
  tests/test_static_assets.py
204
+ tests/test_tabwidget_dnd.py
203
205
  tests/test_treeview_diff.py
204
206
  tests/test_treeview_resize.py
205
207
  tests/test_treeview_select.py
@@ -191,10 +191,12 @@
191
191
  "pyproject.toml",
192
192
  "setup.py",
193
193
  "tests/__init__.py",
194
+ "tests/tabwidget_dnd.mjs",
194
195
  "tests/test_consistency.py",
195
196
  "tests/test_defs.py",
196
197
  "tests/test_recent_additions.py",
197
198
  "tests/test_static_assets.py",
199
+ "tests/test_tabwidget_dnd.py",
198
200
  "tests/test_treeview_diff.py",
199
201
  "tests/test_treeview_resize.py",
200
202
  "tests/test_treeview_select.py",
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.5.0",
3
+ "distance": 0,
4
+ "node": "g6b9fe9f5ebd2884dc6b50eca9bdf1fa0a3af332b",
5
+ "dirty": false,
6
+ "branch": "main",
7
+ "node_date": "2026-12-02"
8
+ }