dars-framework 1.9.2__tar.gz → 1.9.5__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 (183) hide show
  1. {dars_framework-1.9.2/dars_framework.egg-info → dars_framework-1.9.5}/PKG-INFO +40 -32
  2. {dars_framework-1.9.2 → dars_framework-1.9.5}/README.md +39 -31
  3. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/all.py +5 -2
  4. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/main.py +11 -1
  5. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/markdown.py +2 -0
  6. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/page.py +67 -0
  7. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/config.py +1 -0
  8. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/app.py +143 -15
  9. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/exporters/web/html_css_js.py +51 -88
  10. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/scripts/animations.py +16 -4
  11. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/scripts/dscript.py +0 -8
  12. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/scripts/script.py +3 -0
  13. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/scripts/utils_ds.py +434 -1
  14. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/security.py +1 -1
  15. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/version.py +2 -2
  16. {dars_framework-1.9.2 → dars_framework-1.9.5/dars_framework.egg-info}/PKG-INFO +40 -32
  17. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars_framework.egg-info/SOURCES.txt +0 -1
  18. {dars_framework-1.9.2 → dars_framework-1.9.5}/pyproject.toml +1 -1
  19. dars_framework-1.9.2/dars/js_lib.py +0 -2049
  20. {dars_framework-1.9.2 → dars_framework-1.9.5}/Dars-logo.png +0 -0
  21. {dars_framework-1.9.2 → dars_framework-1.9.5}/LICENSE +0 -0
  22. {dars_framework-1.9.2 → dars_framework-1.9.5}/MANIFEST.in +0 -0
  23. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/__init__.py +0 -0
  24. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/actionProtocol.py +0 -0
  25. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/backend/__init__.py +0 -0
  26. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/backend/components.py +0 -0
  27. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/backend/data.py +0 -0
  28. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/backend/http.py +0 -0
  29. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/backend/json_utils.py +0 -0
  30. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/backend/route_loader.py +0 -0
  31. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/backend/ssr.py +0 -0
  32. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/__init__.py +0 -0
  33. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/doctor/__init__.py +0 -0
  34. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/doctor/detect.py +0 -0
  35. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/doctor/doctor.py +0 -0
  36. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/doctor/installers.py +0 -0
  37. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/doctor/persist.py +0 -0
  38. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/doctor/preflight.py +0 -0
  39. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/doctor/ui.py +0 -0
  40. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/dpm.py +0 -0
  41. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/hot_reload.py +0 -0
  42. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/preview.py +0 -0
  43. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/cli/translations.py +0 -0
  44. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/__init__.py +0 -0
  45. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/__init__.py +0 -0
  46. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/accordion.py +0 -0
  47. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/card.py +0 -0
  48. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/file_upload.py +0 -0
  49. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/head.py +0 -0
  50. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/modal.py +0 -0
  51. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/navbar.py +0 -0
  52. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/outlet.py +0 -0
  53. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/table.py +0 -0
  54. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/advanced/tabs.py +0 -0
  55. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/__init__.py +0 -0
  56. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/audio.py +0 -0
  57. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/button.py +0 -0
  58. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/checkbox.py +0 -0
  59. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/container.py +0 -0
  60. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/datepicker.py +0 -0
  61. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/image.py +0 -0
  62. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/input.py +0 -0
  63. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/link.py +0 -0
  64. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/progressbar.py +0 -0
  65. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/radiobutton.py +0 -0
  66. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/section.py +0 -0
  67. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/select.py +0 -0
  68. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/slider.py +0 -0
  69. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/spinner.py +0 -0
  70. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/text.py +0 -0
  71. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/textarea.py +0 -0
  72. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/tooltip.py +0 -0
  73. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/basic/video.py +0 -0
  74. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/layout/__init__.py +0 -0
  75. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/layout/anchor.py +0 -0
  76. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/layout/flex.py +0 -0
  77. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/layout/grid.py +0 -0
  78. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/visualization/__init__.py +0 -0
  79. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/visualization/chart.py +0 -0
  80. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/components/visualization/table.py +0 -0
  81. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/__init__.py +0 -0
  82. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/component.py +0 -0
  83. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/events.py +0 -0
  84. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/js_bridge.py +0 -0
  85. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/properties.py +0 -0
  86. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/route_types.py +0 -0
  87. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/routing.py +0 -0
  88. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/state.py +0 -0
  89. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/state_v2.py +0 -0
  90. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/core/utilities.py +0 -0
  91. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/dars_tests/apps_test/health_check.py +0 -0
  92. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/dars_tests/run_tests.py +0 -0
  93. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/dars_tests/tests/test_advanced_components.py +0 -0
  94. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/dars_tests/tests/test_basic_components.py +0 -0
  95. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/dars_tests/tests/test_core_and_cli.py +0 -0
  96. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/dars_tests/tests/test_layout_components.py +0 -0
  97. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/dars_tests/tests/test_version_check.py +0 -0
  98. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/desktop/__init__.py +0 -0
  99. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/desktop/api.py +0 -0
  100. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/desktop/js_generator.py +0 -0
  101. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/INSTALL.md +0 -0
  102. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/KeyEvents.md +0 -0
  103. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/__init__.py +0 -0
  104. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/animations.md +0 -0
  105. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/app.md +0 -0
  106. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/backend_api.md +0 -0
  107. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/cli.md +0 -0
  108. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/components.md +0 -0
  109. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/config.md +0 -0
  110. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/custom_components.md +0 -0
  111. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/env.md +0 -0
  112. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/events.md +0 -0
  113. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/exporters.md +0 -0
  114. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/getting_started.md +0 -0
  115. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/hooks.md +0 -0
  116. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/index.md +0 -0
  117. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/operations.md +0 -0
  118. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/routing.md +0 -0
  119. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/scripts.md +0 -0
  120. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/ssr.md +0 -0
  121. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/state_management.md +0 -0
  122. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/docs/styling.md +0 -0
  123. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/env.py +0 -0
  124. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/exporters/__init__.py +0 -0
  125. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/exporters/base.py +0 -0
  126. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/exporters/desktop/electron.py +0 -0
  127. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/exporters/web/__init__.py +0 -0
  128. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/exporters/web/vdom.py +0 -0
  129. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/__init__.py +0 -0
  130. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/form_helpers.py +0 -0
  131. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/set_vref.py +0 -0
  132. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/update_vref.py +0 -0
  133. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/use_dynamic.py +0 -0
  134. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/use_value.py +0 -0
  135. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/use_vref.py +0 -0
  136. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/use_watch.py +0 -0
  137. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/hooks/value_helpers.py +0 -0
  138. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/scripts/__init__.py +0 -0
  139. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/scripts/keycode.py +0 -0
  140. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/__init__.py +0 -0
  141. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/icon.png +0 -0
  142. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/backend/icons/icon.png +0 -0
  143. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/backend/main.js +0 -0
  144. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/backend/package.json +0 -0
  145. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/backend/preload.js +0 -0
  146. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/dars.config.json +0 -0
  147. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/icons/icon.png +0 -0
  148. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/main.py +0 -0
  149. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/public/electron-icon.png +0 -0
  150. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/desktop/template/public/icon.png +0 -0
  151. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/README.md +0 -0
  152. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/CustomComp/main.py +0 -0
  153. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/Modal_Demo/advanced_modal_demo.py +0 -0
  154. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/StateV2/README.md +0 -0
  155. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/StateV2/animation_component.py +0 -0
  156. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/StateV2/counter_component.py +0 -0
  157. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/StateV2/hero_component.py +0 -0
  158. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/StateV2/main.py +0 -0
  159. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/StateV2/styles.css +0 -0
  160. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/StateV2/timer_component.py +0 -0
  161. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/VariousComponents/all_components_demo.py +0 -0
  162. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/__init__.py +0 -0
  163. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/dState/state_mods_demo.py +0 -0
  164. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/hooks/useDynamic.py +0 -0
  165. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/hooks/useValue.py +0 -0
  166. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/advanced/hooks/useWatch.py +0 -0
  167. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/HelloWorld/hello_world.py +0 -0
  168. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/Layouts/flex_layout_responsive.py +0 -0
  169. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/Layouts/grid_layout_responsive.py +0 -0
  170. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/Layouts/layout_multipage_demo.py +0 -0
  171. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/PWA/icon-192x192.png +0 -0
  172. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/PWA/icon-512x512.png +0 -0
  173. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/PWA/pwa_custom_icons.py +0 -0
  174. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/basic/__init__.py +0 -0
  175. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/markdown/MarkdownTemplate/README.md +0 -0
  176. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/markdown/MarkdownTemplate/markdown_template.py +0 -0
  177. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/markdown/MarkdownTemplate/other_docs.md +0 -0
  178. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars/templates/examples/markdown/__init__.py +0 -0
  179. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars_framework.egg-info/dependency_links.txt +0 -0
  180. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars_framework.egg-info/entry_points.txt +0 -0
  181. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars_framework.egg-info/requires.txt +0 -0
  182. {dars_framework-1.9.2 → dars_framework-1.9.5}/dars_framework.egg-info/top_level.txt +0 -0
  183. {dars_framework-1.9.2 → dars_framework-1.9.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dars-framework
3
- Version: 1.9.2
3
+ Version: 1.9.5
4
4
  Summary: Dars is a Full-Stack multiplatform Python UI framework for building modern, interactive web and desktop apps with Python code. Seamlessly integrated with FastAPI, it allows you to build complete applications with Server-Side Rendering (SSR) and reactive SPA capabilities also classic multipage html and desktop apps in a single codebase.
5
5
  Author-email: ztamdev <ztadevs@gmail.com>
6
6
  Maintainer-email: ztamdev <ztadevs@gmail.com>
@@ -52,7 +52,6 @@ Dynamic: license-file
52
52
  <a href="https://deepwiki.com/ZtaMDev/Dars-Framework"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
53
53
  </p>
54
54
 
55
-
56
55
  <p align="center">
57
56
  <em>Dars is a Full-Stack multiplatform Python UI framework for building modern, interactive web and desktop apps with Python code. Seamlessly integrated with FastAPI, it allows you to build complete applications with Server-Side Rendering (SSR) and reactive SPA capabilities also classic multipage html and desktop apps in a single codebase.</em>
58
57
 
@@ -60,8 +59,9 @@ Dynamic: license-file
60
59
 
61
60
  <div align="center">
62
61
 
63
- Official [Website](https://ztamdev.github.io/Dars-Framework/) |
64
- Documentation [Docs](https://ztamdev.github.io/Dars-Framework/docs.html) |
62
+ Official [Website](https://ztamdev.github.io/Dars-Framework/) |
63
+ Documentation [Docs](https://ztamdev.github.io/Dars-Framework/docs.html) |
64
+ Official [Roadmap](https://ztamdev.github.io/Dars-Framework/roadmap.html) |
65
65
  Extension for VSCode [here](https://marketplace.visualstudio.com/items?itemName=ZtaMDev.dars-framework) and OpenVSX version [here](https://open-vsx.org/extension/ztamdev/dars-framework)
66
66
 
67
67
  </div>
@@ -73,6 +73,7 @@ pip install dars-framework
73
73
  Try dars without installing nothing just visit the [Dars Playground](https://dars-playground.vercel.app/)
74
74
 
75
75
  ## How It Works
76
+
76
77
  - Build your UI using Python classes and components (like Text, Button, Container, Page, etc).
77
78
  - Preview instantly with hot-reload using `app.rTimeCompile()`.
78
79
  - Export your app to static/dynamic/ssr web files with a single CLI command.
@@ -81,6 +82,7 @@ Try dars without installing nothing just visit the [Dars Playground](https://dar
81
82
  - For more information visit the [Documentation](https://ztamdev.github.io/Dars-Framework/docs.html)
82
83
 
83
84
  ## Quick Example: Your First App
85
+
84
86
  ```python
85
87
  from dars.all import *
86
88
 
@@ -91,7 +93,7 @@ state = State("app", title_val="Simple Counter", count=0)
91
93
 
92
94
  # 2. Define Route
93
95
  @route("/")
94
- def index():
96
+ def index():
95
97
  return Page(
96
98
  # 3. Use useValue for app text
97
99
  Text(
@@ -131,7 +133,7 @@ def index():
131
133
  ),
132
134
  style="flex flex-col items-center justify-center h-[100vh] ffam-[Arial] bg-[#f0f2f5]",
133
135
 
134
- )
136
+ )
135
137
 
136
138
  # 8. Add page
137
139
  app.add_page("index", index(), title="index")
@@ -148,9 +150,11 @@ if __name__ == "__main__":
148
150
  Dars Framework features **powerful state management system**, designed for different use cases.
149
151
 
150
152
  ### State V2
153
+
151
154
  Modern, Pythonic state management for reactive updates. Best for counters, timers, and component interactions using hooks.
152
155
 
153
156
  **Hooks System:**
157
+
154
158
  - `useDynamic()`: Reactive state binding for automatic UI updates.
155
159
  - `useValue()`: Set initial values from state (non-reactive).
156
160
  - `useWatch()`: Monitor state changes and trigger side effects.
@@ -168,7 +172,7 @@ def index():
168
172
  return Page(
169
173
  # Bind to state with useDynamic
170
174
  Text(text=useDynamic("counter.count"), style={"font-size": "24px"}),
171
-
175
+
172
176
  # Update state on click
173
177
  Button("Increment", on_click=state.count.increment(1)),
174
178
  Button("Decrement", on_click=state.count.decrement(1)),
@@ -181,7 +185,7 @@ if __name__ == "__main__":
181
185
  app.rTimeCompile()
182
186
  ```
183
187
 
184
- **String ID Support:** `State()` can accept a string ID (e.g., `State("my-state", ...)`).
188
+ **String ID Support:** `State()` can accept a string ID (e.g., `State("my-state", ...)`).
185
189
 
186
190
  > [!WARNING]
187
191
  > **Important:** When using hooks, the State ID is used for binding. **Do not use an ID that belongs to another unrelated component**, as hooks use this ID as the State ID. Using a conflicting ID may cause unexpected behavior or state collisions.
@@ -215,6 +219,7 @@ button.on_click = sequence(
215
219
  ```
216
220
 
217
221
  **Available Animations:**
222
+
218
223
  - **Opacity:** `fadeIn`, `fadeOut`
219
224
  - **Movement:** `slideIn`, `slideOut` (up, down, left, right)
220
225
  - **Scaling:** `scaleIn`, `scaleOut`, `pulse`
@@ -257,7 +262,6 @@ button.on_click = sequence(
257
262
 
258
263
  ---
259
264
 
260
-
261
265
  ## Routing System (SPA & SSR)
262
266
 
263
267
  Dars Framework offers a flexible routing system that supports both Client-Side Routing (SPA) and Server-Side Rendering (SSR).
@@ -321,7 +325,7 @@ def dashboard():
321
325
  Link("Settings", href="/dashboard/settings"),
322
326
  Link("Profile", href="/dashboard/profile"),
323
327
  id="nav",
324
-
328
+
325
329
  ),
326
330
  Outlet(), # Child routes render here
327
331
  style={"padding": "20px"}
@@ -356,6 +360,7 @@ app.set_404_page(custom_404)
356
360
  ### Hot Reload for SPAs
357
361
 
358
362
  The development preview server includes intelligent hot reload:
363
+
359
364
  - Detects changes and reloads automatically
360
365
  - Stops polling after 10 errors to prevent browser lag
361
366
  - Clean console output without spam
@@ -458,10 +463,10 @@ callback=(
458
463
 
459
464
  ### Available HTTP Methods
460
465
 
461
- - **`get(id, url, **options)`** - GET request
462
- - **`post(id, url, body, **options)`** - POST request
463
- - **`put(id, url, body, **options)`** - PUT request
464
- - **`delete(id, url, **options)`** - DELETE request
466
+ - **`get(id, url, **options)`\*\* - GET request
467
+ - **`post(id, url, body, **options)`\*\* - POST request
468
+ - **`put(id, url, body, **options)`\*\* - PUT request
469
+ - **`delete(id, url, **options)`\*\* - DELETE request
465
470
 
466
471
  For complete documentation, see the [Backend API Guide](https://ztamdev.github.io/Dars-Framework/docs.html#backend-http-utilities).
467
472
 
@@ -469,22 +474,23 @@ For complete documentation, see the [Backend API Guide](https://ztamdev.github.i
469
474
 
470
475
  ## CLI Usage
471
476
 
472
- | Command | What it does |
473
- |-------------------------------------------|----------------------------------------------|
474
- | `dars export my_app.py --format html` | Export app to HTML/CSS/JS in `./my_app_web` |
475
- | `dars init --type desktop` | Scaffold desktop-capable project (BETA) |
476
- | `dars init --type ssr` | Scaffold full-stack SSR project (SSR + API) |
477
- | `dars build` (desktop config) | Build desktop app artifacts (BETA) |
478
- | `dars preview ./my_app_web` | Preview exported app locally |
479
- | `dars init my_project` | Create a new Dars project (also creates dars.config.json) |
480
- | `dars init --update` | Create/Update dars.config.json in current dir |
481
- | `dars build` | Build using dars.config.json (entry/outdir/format) |
482
- | `dars config validate` | Validate dars.config.json and print report |
483
- | `dars info my_app.py` | Show info about your app |
484
- | `dars formats` | List supported export formats |
485
- | `dars dev` | Run the configured entry file with hot preview (app.rTimeCompile) |
486
- | `dars dev --backend` | Run only the configured backendEntry (FastAPI/SSR backend) |
487
- | `dars --help` | Show help and all CLI options |
477
+ | Command | What it does |
478
+ | ------------------------------------- | ----------------------------------------------------------------- |
479
+ | `dars export my_app.py --format html` | Export app to HTML/CSS/JS in `./my_app_web` |
480
+ | `dars init --type desktop` | Scaffold desktop-capable project (BETA) |
481
+ | `dars init --type ssr` | Scaffold full-stack SSR project (SSR + API) |
482
+ | `dars build` (desktop config) | Build desktop app artifacts (BETA) |
483
+ | `dars preview ./my_app_web` | Preview exported app locally |
484
+ | `dars init my_project` | Create a new Dars project (also creates dars.config.json) |
485
+ | `dars init --update` | Create/Update dars.config.json in current dir |
486
+ | `dars build` | Build using dars.config.json (entry/outdir/format) |
487
+ | `dars config validate` | Validate dars.config.json and print report |
488
+ | `dars info my_app.py` | Show info about your app |
489
+ | `dars formats` | List supported export formats |
490
+ | `dars dev` | Run the configured entry file with hot preview (app.rTimeCompile) |
491
+ | `dars dev --port 9000` | Run dev server on a custom port (overrides config) |
492
+ | `dars dev --backend` | Run only the configured backendEntry (FastAPI/SSR backend) |
493
+ | `dars --help` | Show help and all CLI options |
488
494
 
489
495
  Tip: use `dars doctor` to review optional tooling that can enhance bundling/minification.
490
496
 
@@ -516,7 +522,7 @@ Then run your file directly:
516
522
  python my_app.py
517
523
  ```
518
524
 
519
- This will start a local server at http://localhost:8000 so you can view your app in the browser—no manual export needed. You can change the port with:
525
+ This will start a local server at the port specified in your `dars.config.json` (defaults to http://localhost:8000) so you can view your app in the browser—no manual export needed. You can override the port with:
520
526
 
521
527
  ```bash
522
528
  python my_app.py --port 8088
@@ -554,6 +560,7 @@ Example default:
554
560
  "utility_styles": {},
555
561
  "markdownHighlight": true,
556
562
  "markdownHighlightTheme": "auto",
563
+ "port": 8000,
557
564
  "backendEntry": "backend.api:app"
558
565
  }
559
566
  ```
@@ -568,7 +575,8 @@ Example default:
568
575
  - `viteMinify`: Toggle the Vite/esbuild minifier for JS/CSS. Default `true`.
569
576
  - `utility_styles`: Dictionary defining custom utility classes. Keys are class names, values are lists of utility strings or raw CSS properties.
570
577
  - `markdownHighlight`: Auto-inject a client-side syntax highlighter for fenced code blocks in Markdown. Default `true`.
571
- - `backendEntry`: Python import path for your SSR/backend app (e.g. `"backend.api:app"`). Required when your app uses `RouteType.SSR` routes. Used by `dars dev --backend`.
578
+ - `backendEntry`: Python import path for your SSR/backend app (e.g. `"backend.api:app"`). Required when your app uses `RouteType.SSR` routes. Used by `dars dev --backend`.
579
+ - `port`: The port for the development preview server. Default `8000`.
572
580
 
573
581
  Validate your config:
574
582
 
@@ -11,7 +11,6 @@
11
11
  <a href="https://deepwiki.com/ZtaMDev/Dars-Framework"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
12
12
  </p>
13
13
 
14
-
15
14
  <p align="center">
16
15
  <em>Dars is a Full-Stack multiplatform Python UI framework for building modern, interactive web and desktop apps with Python code. Seamlessly integrated with FastAPI, it allows you to build complete applications with Server-Side Rendering (SSR) and reactive SPA capabilities also classic multipage html and desktop apps in a single codebase.</em>
17
16
 
@@ -19,8 +18,9 @@
19
18
 
20
19
  <div align="center">
21
20
 
22
- Official [Website](https://ztamdev.github.io/Dars-Framework/) |
23
- Documentation [Docs](https://ztamdev.github.io/Dars-Framework/docs.html) |
21
+ Official [Website](https://ztamdev.github.io/Dars-Framework/) |
22
+ Documentation [Docs](https://ztamdev.github.io/Dars-Framework/docs.html) |
23
+ Official [Roadmap](https://ztamdev.github.io/Dars-Framework/roadmap.html) |
24
24
  Extension for VSCode [here](https://marketplace.visualstudio.com/items?itemName=ZtaMDev.dars-framework) and OpenVSX version [here](https://open-vsx.org/extension/ztamdev/dars-framework)
25
25
 
26
26
  </div>
@@ -32,6 +32,7 @@ pip install dars-framework
32
32
  Try dars without installing nothing just visit the [Dars Playground](https://dars-playground.vercel.app/)
33
33
 
34
34
  ## How It Works
35
+
35
36
  - Build your UI using Python classes and components (like Text, Button, Container, Page, etc).
36
37
  - Preview instantly with hot-reload using `app.rTimeCompile()`.
37
38
  - Export your app to static/dynamic/ssr web files with a single CLI command.
@@ -40,6 +41,7 @@ Try dars without installing nothing just visit the [Dars Playground](https://dar
40
41
  - For more information visit the [Documentation](https://ztamdev.github.io/Dars-Framework/docs.html)
41
42
 
42
43
  ## Quick Example: Your First App
44
+
43
45
  ```python
44
46
  from dars.all import *
45
47
 
@@ -50,7 +52,7 @@ state = State("app", title_val="Simple Counter", count=0)
50
52
 
51
53
  # 2. Define Route
52
54
  @route("/")
53
- def index():
55
+ def index():
54
56
  return Page(
55
57
  # 3. Use useValue for app text
56
58
  Text(
@@ -90,7 +92,7 @@ def index():
90
92
  ),
91
93
  style="flex flex-col items-center justify-center h-[100vh] ffam-[Arial] bg-[#f0f2f5]",
92
94
 
93
- )
95
+ )
94
96
 
95
97
  # 8. Add page
96
98
  app.add_page("index", index(), title="index")
@@ -107,9 +109,11 @@ if __name__ == "__main__":
107
109
  Dars Framework features **powerful state management system**, designed for different use cases.
108
110
 
109
111
  ### State V2
112
+
110
113
  Modern, Pythonic state management for reactive updates. Best for counters, timers, and component interactions using hooks.
111
114
 
112
115
  **Hooks System:**
116
+
113
117
  - `useDynamic()`: Reactive state binding for automatic UI updates.
114
118
  - `useValue()`: Set initial values from state (non-reactive).
115
119
  - `useWatch()`: Monitor state changes and trigger side effects.
@@ -127,7 +131,7 @@ def index():
127
131
  return Page(
128
132
  # Bind to state with useDynamic
129
133
  Text(text=useDynamic("counter.count"), style={"font-size": "24px"}),
130
-
134
+
131
135
  # Update state on click
132
136
  Button("Increment", on_click=state.count.increment(1)),
133
137
  Button("Decrement", on_click=state.count.decrement(1)),
@@ -140,7 +144,7 @@ if __name__ == "__main__":
140
144
  app.rTimeCompile()
141
145
  ```
142
146
 
143
- **String ID Support:** `State()` can accept a string ID (e.g., `State("my-state", ...)`).
147
+ **String ID Support:** `State()` can accept a string ID (e.g., `State("my-state", ...)`).
144
148
 
145
149
  > [!WARNING]
146
150
  > **Important:** When using hooks, the State ID is used for binding. **Do not use an ID that belongs to another unrelated component**, as hooks use this ID as the State ID. Using a conflicting ID may cause unexpected behavior or state collisions.
@@ -174,6 +178,7 @@ button.on_click = sequence(
174
178
  ```
175
179
 
176
180
  **Available Animations:**
181
+
177
182
  - **Opacity:** `fadeIn`, `fadeOut`
178
183
  - **Movement:** `slideIn`, `slideOut` (up, down, left, right)
179
184
  - **Scaling:** `scaleIn`, `scaleOut`, `pulse`
@@ -216,7 +221,6 @@ button.on_click = sequence(
216
221
 
217
222
  ---
218
223
 
219
-
220
224
  ## Routing System (SPA & SSR)
221
225
 
222
226
  Dars Framework offers a flexible routing system that supports both Client-Side Routing (SPA) and Server-Side Rendering (SSR).
@@ -280,7 +284,7 @@ def dashboard():
280
284
  Link("Settings", href="/dashboard/settings"),
281
285
  Link("Profile", href="/dashboard/profile"),
282
286
  id="nav",
283
-
287
+
284
288
  ),
285
289
  Outlet(), # Child routes render here
286
290
  style={"padding": "20px"}
@@ -315,6 +319,7 @@ app.set_404_page(custom_404)
315
319
  ### Hot Reload for SPAs
316
320
 
317
321
  The development preview server includes intelligent hot reload:
322
+
318
323
  - Detects changes and reloads automatically
319
324
  - Stops polling after 10 errors to prevent browser lag
320
325
  - Clean console output without spam
@@ -417,10 +422,10 @@ callback=(
417
422
 
418
423
  ### Available HTTP Methods
419
424
 
420
- - **`get(id, url, **options)`** - GET request
421
- - **`post(id, url, body, **options)`** - POST request
422
- - **`put(id, url, body, **options)`** - PUT request
423
- - **`delete(id, url, **options)`** - DELETE request
425
+ - **`get(id, url, **options)`\*\* - GET request
426
+ - **`post(id, url, body, **options)`\*\* - POST request
427
+ - **`put(id, url, body, **options)`\*\* - PUT request
428
+ - **`delete(id, url, **options)`\*\* - DELETE request
424
429
 
425
430
  For complete documentation, see the [Backend API Guide](https://ztamdev.github.io/Dars-Framework/docs.html#backend-http-utilities).
426
431
 
@@ -428,22 +433,23 @@ For complete documentation, see the [Backend API Guide](https://ztamdev.github.i
428
433
 
429
434
  ## CLI Usage
430
435
 
431
- | Command | What it does |
432
- |-------------------------------------------|----------------------------------------------|
433
- | `dars export my_app.py --format html` | Export app to HTML/CSS/JS in `./my_app_web` |
434
- | `dars init --type desktop` | Scaffold desktop-capable project (BETA) |
435
- | `dars init --type ssr` | Scaffold full-stack SSR project (SSR + API) |
436
- | `dars build` (desktop config) | Build desktop app artifacts (BETA) |
437
- | `dars preview ./my_app_web` | Preview exported app locally |
438
- | `dars init my_project` | Create a new Dars project (also creates dars.config.json) |
439
- | `dars init --update` | Create/Update dars.config.json in current dir |
440
- | `dars build` | Build using dars.config.json (entry/outdir/format) |
441
- | `dars config validate` | Validate dars.config.json and print report |
442
- | `dars info my_app.py` | Show info about your app |
443
- | `dars formats` | List supported export formats |
444
- | `dars dev` | Run the configured entry file with hot preview (app.rTimeCompile) |
445
- | `dars dev --backend` | Run only the configured backendEntry (FastAPI/SSR backend) |
446
- | `dars --help` | Show help and all CLI options |
436
+ | Command | What it does |
437
+ | ------------------------------------- | ----------------------------------------------------------------- |
438
+ | `dars export my_app.py --format html` | Export app to HTML/CSS/JS in `./my_app_web` |
439
+ | `dars init --type desktop` | Scaffold desktop-capable project (BETA) |
440
+ | `dars init --type ssr` | Scaffold full-stack SSR project (SSR + API) |
441
+ | `dars build` (desktop config) | Build desktop app artifacts (BETA) |
442
+ | `dars preview ./my_app_web` | Preview exported app locally |
443
+ | `dars init my_project` | Create a new Dars project (also creates dars.config.json) |
444
+ | `dars init --update` | Create/Update dars.config.json in current dir |
445
+ | `dars build` | Build using dars.config.json (entry/outdir/format) |
446
+ | `dars config validate` | Validate dars.config.json and print report |
447
+ | `dars info my_app.py` | Show info about your app |
448
+ | `dars formats` | List supported export formats |
449
+ | `dars dev` | Run the configured entry file with hot preview (app.rTimeCompile) |
450
+ | `dars dev --port 9000` | Run dev server on a custom port (overrides config) |
451
+ | `dars dev --backend` | Run only the configured backendEntry (FastAPI/SSR backend) |
452
+ | `dars --help` | Show help and all CLI options |
447
453
 
448
454
  Tip: use `dars doctor` to review optional tooling that can enhance bundling/minification.
449
455
 
@@ -475,7 +481,7 @@ Then run your file directly:
475
481
  python my_app.py
476
482
  ```
477
483
 
478
- This will start a local server at http://localhost:8000 so you can view your app in the browser—no manual export needed. You can change the port with:
484
+ This will start a local server at the port specified in your `dars.config.json` (defaults to http://localhost:8000) so you can view your app in the browser—no manual export needed. You can override the port with:
479
485
 
480
486
  ```bash
481
487
  python my_app.py --port 8088
@@ -513,6 +519,7 @@ Example default:
513
519
  "utility_styles": {},
514
520
  "markdownHighlight": true,
515
521
  "markdownHighlightTheme": "auto",
522
+ "port": 8000,
516
523
  "backendEntry": "backend.api:app"
517
524
  }
518
525
  ```
@@ -527,7 +534,8 @@ Example default:
527
534
  - `viteMinify`: Toggle the Vite/esbuild minifier for JS/CSS. Default `true`.
528
535
  - `utility_styles`: Dictionary defining custom utility classes. Keys are class names, values are lists of utility strings or raw CSS properties.
529
536
  - `markdownHighlight`: Auto-inject a client-side syntax highlighter for fenced code blocks in Markdown. Default `true`.
530
- - `backendEntry`: Python import path for your SSR/backend app (e.g. `"backend.api:app"`). Required when your app uses `RouteType.SSR` routes. Used by `dars dev --backend`.
537
+ - `backendEntry`: Python import path for your SSR/backend app (e.g. `"backend.api:app"`). Required when your app uses `RouteType.SSR` routes. Used by `dars dev --backend`.
538
+ - `port`: The port for the development preview server. Default `8000`.
531
539
 
532
540
  Validate your config:
533
541
 
@@ -65,6 +65,7 @@ from dars.exporters.web.html_css_js import HTMLCSSJSExporter
65
65
  # Script utilities
66
66
  from dars.scripts.dscript import dScript, RawJS, Arg
67
67
  from dars.scripts.utils_ds import showModal, hideModal, goTo, goToNew, reload, goBack, goForward, alert, confirm, log, getDateTime, show, hide, toggle, addClass, removeClass, toggleClass, scrollTo, scrollToTop, scrollToBottom, scrollToElement, submitForm, resetForm, getValue, clearInput, saveToLocal, loadFromLocal, removeFromLocal, clearLocalStorage, copyToClipboard, copyElementText, focus, blur, setText, setTimeout, getInputValue, switch
68
+ from dars.scripts.utils_ds import onViewport, classOnView, runOnView, animateOnView, staggerOnView, scrollProgress, animate, timeline, stagger # Viewport & Scroll Animation Utilities
68
69
  from dars.scripts.animations import fadeIn, fadeOut, slideIn, slideOut, scaleIn, scaleOut, shake, bounce, pulse, rotate, flip, colorChange, morphSize, popIn, popOut, sequence # Animation System
69
70
  from dars.scripts.script import *
70
71
  # Hooks
@@ -128,8 +129,7 @@ __all__ = [
128
129
  # Storage utilities
129
130
  'saveToLocal', 'loadFromLocal', 'removeFromLocal', 'clearLocalStorage',
130
131
  # Clipboard utilities
131
- 'copyToClipboard', 'copyElementText',
132
- # Focus utilities
132
+ 'copyToClipboard', 'copyElementText', # Focus utilities
133
133
  'focus', 'blur',
134
134
  # Timer utilities
135
135
  'setTimeout',
@@ -137,6 +137,9 @@ __all__ = [
137
137
  'fadeIn', 'fadeOut', 'slideIn', 'slideOut', 'scaleIn', 'scaleOut',
138
138
  'shake', 'bounce', 'pulse', 'rotate', 'flip',
139
139
  'colorChange', 'morphSize', 'popIn', 'popOut', 'sequence',
140
+ # Viewport & Scroll Animation Engine
141
+ 'onViewport', 'classOnView', 'runOnView', 'animateOnView',
142
+ 'staggerOnView', 'scrollProgress', 'animate', 'timeline', 'stagger',
140
143
  # Input utilities
141
144
  'getInputValue',
142
145
  # Hooks
@@ -1206,6 +1206,7 @@ def create_parser(include_hidden: bool = True) -> argparse.ArgumentParser:
1206
1206
  # Dev command (run entry in dev mode)
1207
1207
  dev_parser = subparsers.add_parser('dev', help='Run the configured entry file in development mode')
1208
1208
  dev_parser.add_argument('--project', '-p', default='.', help='Project root where dars.config.json resides (default: .)')
1209
+ dev_parser.add_argument('--port', '-P', type=int, help='Port to run the dev server on (overrides config)')
1209
1210
  dev_parser.add_argument('--backend', action='store_true', help='Run only the configured backendEntry (SSR/API) instead of the frontend entry')
1210
1211
  # English-only: no language option on subparsers
1211
1212
 
@@ -2296,7 +2297,16 @@ def main():
2296
2297
  # Backend/SSR server can be started in a separate terminal with `dars dev --backend` if needed.
2297
2298
  process = None
2298
2299
  try:
2299
- process = subprocess.Popen([sys.executable, entry], cwd=os.path.dirname(entry))
2300
+ cmd = [sys.executable, entry]
2301
+ # Prioritize CLI arg, then config, then fallback to 8000
2302
+ port_to_pass = getattr(args, 'port', None)
2303
+ if port_to_pass is None and found and "port" in cfg:
2304
+ port_to_pass = cfg["port"]
2305
+
2306
+ if port_to_pass:
2307
+ cmd.extend(['--port', str(port_to_pass)])
2308
+
2309
+ process = subprocess.Popen(cmd, cwd=os.path.dirname(entry))
2300
2310
  process.wait()
2301
2311
  sys.exit(process.returncode or 0)
2302
2312
  except KeyboardInterrupt:
@@ -18,12 +18,14 @@ class Markdown(Component):
18
18
  - **Events**: Handlers like `on_click`, `on_mouse_enter`, etc.
19
19
 
20
20
  Example:
21
+
21
22
  ```python
22
23
  Markdown(
23
24
  content="# Hello Dars\nThis is **markdown** content.",
24
25
  class_name="p-6 bg-white rounded-xl shadow-sm border border-slate-200"
25
26
  )
26
27
  ```
28
+
27
29
  """
28
30
  def __init__(
29
31
  self,
@@ -39,6 +39,73 @@ class Page(Component):
39
39
  self.add_child(child)
40
40
 
41
41
  def add_script(self, script):
42
+ """
43
+ Adds a script to this page.
44
+
45
+ Supports multiple script types:
46
+
47
+ - **DScript**: Direct Python function compilation to JavaScript
48
+ - **String**: Inline JavaScript code
49
+ - **Dictionary**: Raw script object (fallback)
50
+ - **Utility Chains**: DAP utility functions with promise-based chaining
51
+
52
+ **Script Types:**
53
+
54
+ 1. **DScript** - Compile Python to JavaScript:
55
+ ```python
56
+ page.add_script(dScript(file_path="script.js"))
57
+ ```
58
+
59
+ 2. **Inline JavaScript**:
60
+ ```python
61
+ page.add_script("console.log('Page loaded');")
62
+ ```
63
+
64
+ 3. **Utility Functions** - Chain DAP commands:
65
+ ```python
66
+ from dars.scripts.utils_ds import setTimeout, addClass, log
67
+
68
+ # Sequential animations with promise chaining
69
+ page.add_script(
70
+ setTimeout(5, addClass("logo", "show"))
71
+ .then(setTimeout(350, addClass("title", "show")))
72
+ .then(setTimeout(650, addClass("description", "show")))
73
+ )
74
+ ```
75
+
76
+ 4. **useWatch** - React to state changes:
77
+ ```python
78
+ page.add_script(
79
+ useWatch("user.name", log("Name changed!"))
80
+ )
81
+ ```
82
+
83
+ **Common Utilities:**
84
+
85
+ - **setTimeout(ms, action)**: Execute action after delay (returns Promise)
86
+ - **addClass(id, class)**: Add CSS class to element
87
+ - **removeClass(id, class)**: Remove CSS class
88
+ - **toggleClass(id, class)**: Toggle CSS class
89
+ - **log(msg)**: Log to console
90
+ - **navigate(url)**: Navigate to URL
91
+ - **createComp(target, root)**: Dynamically create components
92
+ - **updateComp(id, props)**: Update component properties
93
+ - **deleteComp(id)**: Remove component from DOM
94
+
95
+ **Promise Chaining:**
96
+
97
+ All timeout/async utilities return Promises, allowing sequential execution:
98
+
99
+ ```python
100
+ page.add_script(
101
+ setTimeout(100, log("Step 1"))
102
+ .then(setTimeout(200, log("Step 2")))
103
+ .then(setTimeout(300, log("Step 3")))
104
+ )
105
+ ```
106
+
107
+ Returns self to allow method chaining.
108
+ """
42
109
  self.scripts.append(script)
43
110
 
44
111
  def useWatch(self, state_path: str, *js_helpers):
@@ -22,6 +22,7 @@ DEFAULT_CONFIG = {
22
22
  "markdownHighlight": True,
23
23
  "markdownHighlightTheme": "auto",
24
24
  "targetPlatform": "auto", # Desktop-only option: platform target for Electron build (auto|windows|linux|macos)
25
+ "port": 8000,
25
26
  # Optional: backend entry for SSR projects (module or file path). Disabled by default.
26
27
  "backendEntry": None,
27
28
  # Optional: custom utility styles map consumed by register_custom_utilities