instaui 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl

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 (198) hide show
  1. instaui/arco/__init__.py +191 -0
  2. instaui/arco/_settings.py +25 -0
  3. instaui/arco/_use_tools/locale.py +50 -0
  4. instaui/arco/component_types.py +1019 -0
  5. instaui/arco/components/_utils.py +22 -0
  6. instaui/arco/components/affix.py +29 -0
  7. instaui/arco/components/alert.py +42 -0
  8. instaui/arco/components/anchor.py +42 -0
  9. instaui/arco/components/auto_complete.py +96 -0
  10. instaui/arco/components/avatar.py +55 -0
  11. instaui/arco/components/back_top.py +14 -0
  12. instaui/arco/components/badge.py +14 -0
  13. instaui/arco/components/breadcrumb.py +14 -0
  14. instaui/arco/components/button.py +43 -0
  15. instaui/arco/components/calendar.py +47 -0
  16. instaui/arco/components/card.py +14 -0
  17. instaui/arco/components/carousel.py +33 -0
  18. instaui/arco/components/cascader.py +111 -0
  19. instaui/arco/components/checkbox.py +32 -0
  20. instaui/arco/components/collapse.py +31 -0
  21. instaui/arco/components/color_picker.py +45 -0
  22. instaui/arco/components/comment.py +14 -0
  23. instaui/arco/components/config_provider.py +13 -0
  24. instaui/arco/components/date_picker.py +111 -0
  25. instaui/arco/components/descriptions.py +14 -0
  26. instaui/arco/components/divider.py +13 -0
  27. instaui/arco/components/drawer.py +98 -0
  28. instaui/arco/components/dropdown.py +45 -0
  29. instaui/arco/components/empty.py +14 -0
  30. instaui/arco/components/form.py +55 -0
  31. instaui/arco/components/icon.py +17 -0
  32. instaui/arco/components/image.py +33 -0
  33. instaui/arco/components/input.py +102 -0
  34. instaui/arco/components/input_number.py +97 -0
  35. instaui/arco/components/input_password.py +38 -0
  36. instaui/arco/components/input_search.py +37 -0
  37. instaui/arco/components/input_tag.py +110 -0
  38. instaui/arco/components/layout.py +13 -0
  39. instaui/arco/components/layout_content.py +6 -0
  40. instaui/arco/components/layout_footer.py +6 -0
  41. instaui/arco/components/layout_header.py +6 -0
  42. instaui/arco/components/layout_sider.py +53 -0
  43. instaui/arco/components/link.py +36 -0
  44. instaui/arco/components/list.py +68 -0
  45. instaui/arco/components/mention.py +97 -0
  46. instaui/arco/components/menu.py +88 -0
  47. instaui/arco/components/modal.py +97 -0
  48. instaui/arco/components/overflow_list.py +29 -0
  49. instaui/arco/components/page_header.py +29 -0
  50. instaui/arco/components/pagination.py +45 -0
  51. instaui/arco/components/pop_confirm.py +58 -0
  52. instaui/arco/components/popover.py +32 -0
  53. instaui/arco/components/progress.py +14 -0
  54. instaui/arco/components/radio.py +40 -0
  55. instaui/arco/components/radio_group.py +42 -0
  56. instaui/arco/components/rate.py +45 -0
  57. instaui/arco/components/resize_box.py +62 -0
  58. instaui/arco/components/result.py +14 -0
  59. instaui/arco/components/select.py +179 -0
  60. instaui/arco/components/skeleton.py +14 -0
  61. instaui/arco/components/slider.py +38 -0
  62. instaui/arco/components/space.py +14 -0
  63. instaui/arco/components/spin.py +14 -0
  64. instaui/arco/components/split.py +76 -0
  65. instaui/arco/components/statistic.py +14 -0
  66. instaui/arco/components/steps.py +32 -0
  67. instaui/arco/components/switch.py +57 -0
  68. instaui/arco/components/tab_pane.py +12 -0
  69. instaui/arco/components/table.py +276 -0
  70. instaui/arco/components/tabs.py +101 -0
  71. instaui/arco/components/tag.py +42 -0
  72. instaui/arco/components/textarea.py +84 -0
  73. instaui/arco/components/time_picker.py +76 -0
  74. instaui/arco/components/timeline.py +14 -0
  75. instaui/arco/components/tooltip.py +29 -0
  76. instaui/arco/components/transfer.py +58 -0
  77. instaui/arco/components/tree.py +120 -0
  78. instaui/arco/components/tree_select.py +86 -0
  79. instaui/arco/components/trigger.py +58 -0
  80. instaui/arco/components/typography.py +142 -0
  81. instaui/arco/components/upload.py +71 -0
  82. instaui/arco/components/verification_code.py +58 -0
  83. instaui/arco/components/watermark.py +14 -0
  84. instaui/arco/locales/__init__.py +4 -0
  85. instaui/arco/locales/_index.py +31 -0
  86. instaui/arco/locales/en_us.py +227 -0
  87. instaui/arco/locales/zh_cn.py +224 -0
  88. instaui/arco/setup.py +36 -0
  89. instaui/arco/static/instaui-arco.css +1 -0
  90. instaui/arco/static/instaui-arco.js +55771 -0
  91. instaui/arco/types.py +24 -0
  92. instaui/components/column.py +10 -2
  93. instaui/components/echarts/echarts.js +128 -0
  94. instaui/components/echarts/echarts.py +194 -0
  95. instaui/components/echarts/static/echarts.esm.min.js +45 -0
  96. instaui/components/element.py +50 -6
  97. instaui/components/grid.py +81 -0
  98. instaui/components/html/__init__.py +30 -19
  99. instaui/components/html/_preset.py +4 -0
  100. instaui/components/html/heading.py +51 -0
  101. instaui/components/html/range.py +3 -0
  102. instaui/components/html/select.py +13 -31
  103. instaui/components/html/table.py +36 -0
  104. instaui/components/markdown/static/github-markdown.css +1 -1
  105. instaui/components/markdown/static/marked.esm.js +0 -1
  106. instaui/components/row.py +8 -7
  107. instaui/components/shiki_code/shiki_code.js +126 -0
  108. instaui/components/shiki_code/shiki_code.py +99 -0
  109. instaui/components/shiki_code/static/langs/css.mjs +5 -0
  110. instaui/components/shiki_code/static/langs/markdown.mjs +5 -0
  111. instaui/components/shiki_code/static/langs/python.mjs +5 -0
  112. instaui/components/shiki_code/static/langs/shell.mjs +2 -0
  113. instaui/components/shiki_code/static/langs/shellscript.mjs +5 -0
  114. instaui/components/shiki_code/static/shiki-core.js +5784 -0
  115. instaui/components/shiki_code/static/shiki-style.css +179 -0
  116. instaui/components/shiki_code/static/shiki-transformers.js +461 -0
  117. instaui/components/shiki_code/static/themes/vitesse-dark.mjs +2 -0
  118. instaui/components/shiki_code/static/themes/vitesse-light.mjs +2 -0
  119. instaui/components/value_element.py +7 -3
  120. instaui/consts.py +2 -1
  121. instaui/event/js_event.py +1 -0
  122. instaui/event/web_event.py +6 -7
  123. instaui/experimental/link_sql/__init__.py +3 -0
  124. instaui/experimental/link_sql/_base.py +23 -0
  125. instaui/experimental/link_sql/_duckdb.py +221 -0
  126. instaui/experimental/link_sql/_types.py +15 -0
  127. instaui/experimental/link_sql/data_source.js +50 -0
  128. instaui/fastapi_server/debug_mode_router.py +1 -1
  129. instaui/fastapi_server/server.py +4 -12
  130. instaui/handlers/event_handler.py +3 -1
  131. instaui/handlers/watch_handler.py +4 -0
  132. instaui/html_tools.py +41 -4
  133. instaui/runtime/_app.py +37 -3
  134. instaui/runtime/_link_manager.py +89 -0
  135. instaui/runtime/resource.py +19 -9
  136. instaui/runtime/scope.py +28 -7
  137. instaui/shadcn_classless/_index.py +42 -0
  138. instaui/shadcn_classless/static/shadcn-classless.css +403 -0
  139. instaui/static/insta-ui.css +1 -1
  140. instaui/static/insta-ui.esm-browser.prod.js +3663 -3658
  141. instaui/static/insta-ui.js.map +1 -1
  142. instaui/static/instaui-tools-browser.js +511 -0
  143. instaui/static/templates/debug/sse.html +1 -1
  144. instaui/static/templates/webview.html +78 -0
  145. instaui/tailwind/__init__.py +6 -0
  146. instaui/tailwind/_index.py +24 -0
  147. instaui/{static/tailwindcss.min.js → tailwind/static/tailwindcss-v3.min.js} +62 -62
  148. instaui/tailwind/static/tailwindcss-v4.min.js +8 -0
  149. instaui/template/_utils.py +23 -0
  150. instaui/template/webview_template.py +50 -0
  151. instaui/ui/__init__.py +8 -2
  152. instaui/ui/__init__.pyi +7 -1
  153. instaui/ui_functions/ui_page.py +1 -1
  154. instaui/vars/data.py +7 -7
  155. instaui/vars/element_ref.py +2 -4
  156. instaui/vars/event_context.py +4 -0
  157. instaui/vars/js_computed.py +6 -8
  158. instaui/vars/ref.py +6 -6
  159. instaui/vars/vue_computed.py +6 -7
  160. instaui/vars/web_computed.py +31 -32
  161. instaui/watch/vue_watch.py +23 -7
  162. instaui/watch/web_watch.py +5 -6
  163. instaui/webview/__init__.py +1 -0
  164. instaui/webview/_utils.py +8 -0
  165. instaui/webview/api.py +72 -0
  166. instaui/webview/func.py +114 -0
  167. instaui/webview/index.py +162 -0
  168. instaui/webview/resource.py +172 -0
  169. instaui/zero/func.py +19 -12
  170. instaui/zero/scope.py +29 -28
  171. {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/METADATA +6 -2
  172. instaui-0.1.6.dist-info/RECORD +286 -0
  173. instaui/components/highlight_code/code.js +0 -63
  174. instaui/components/highlight_code/code.py +0 -117
  175. instaui/components/highlight_code/static/core.min.js +0 -307
  176. instaui/components/highlight_code/static/languages/css.min.js +0 -31
  177. instaui/components/highlight_code/static/languages/javascript.min.js +0 -81
  178. instaui/components/highlight_code/static/languages/json.min.js +0 -8
  179. instaui/components/highlight_code/static/languages/python-repl.min.js +0 -5
  180. instaui/components/highlight_code/static/languages/python.min.js +0 -42
  181. instaui/components/highlight_code/static/languages/shell.min.js +0 -5
  182. instaui/components/highlight_code/static/styles/default.min.css +0 -9
  183. instaui/components/highlight_code/static/styles/github-dark-dimmed.min.css +0 -9
  184. instaui/components/highlight_code/static/styles/github-dark.min.css +0 -10
  185. instaui/components/highlight_code/static/styles/github.min.css +0 -10
  186. instaui/daisyui/__init__.py +0 -20
  187. instaui/daisyui/_index.py +0 -15
  188. instaui/daisyui/button.py +0 -38
  189. instaui/daisyui/checkbox.py +0 -17
  190. instaui/daisyui/static/daisyui.css +0 -1
  191. instaui/daisyui/static/themes.css +0 -1
  192. instaui/handlers/computed_handler.py +0 -42
  193. instaui/handlers/config_handler.py +0 -13
  194. instaui/ui/__build_init.py +0 -73
  195. instaui/vars/_utils.py +0 -12
  196. instaui-0.1.4.dist-info/RECORD +0 -179
  197. {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/LICENSE +0 -0
  198. {instaui-0.1.4.dist-info → instaui-0.1.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,2 @@
1
+ /* Theme: vitesse-light */
2
+ export default Object.freeze(JSON.parse("{\"colors\":{\"activityBar.activeBorder\":\"#1c6b48\",\"activityBar.background\":\"#ffffff\",\"activityBar.border\":\"#f0f0f0\",\"activityBar.foreground\":\"#393a34\",\"activityBar.inactiveForeground\":\"#393a3450\",\"activityBarBadge.background\":\"#4e4f47\",\"activityBarBadge.foreground\":\"#ffffff\",\"badge.background\":\"#393a3490\",\"badge.foreground\":\"#ffffff\",\"breadcrumb.activeSelectionForeground\":\"#22222218\",\"breadcrumb.background\":\"#f7f7f7\",\"breadcrumb.focusForeground\":\"#393a34\",\"breadcrumb.foreground\":\"#6a737d\",\"breadcrumbPicker.background\":\"#ffffff\",\"button.background\":\"#1c6b48\",\"button.foreground\":\"#ffffff\",\"button.hoverBackground\":\"#1c6b48\",\"checkbox.background\":\"#f7f7f7\",\"checkbox.border\":\"#d1d5da\",\"debugToolBar.background\":\"#ffffff\",\"descriptionForeground\":\"#393a3490\",\"diffEditor.insertedTextBackground\":\"#1c6b4830\",\"diffEditor.removedTextBackground\":\"#ab595940\",\"dropdown.background\":\"#ffffff\",\"dropdown.border\":\"#f0f0f0\",\"dropdown.foreground\":\"#393a34\",\"dropdown.listBackground\":\"#f7f7f7\",\"editor.background\":\"#ffffff\",\"editor.findMatchBackground\":\"#e6cc7744\",\"editor.findMatchHighlightBackground\":\"#e6cc7766\",\"editor.focusedStackFrameHighlightBackground\":\"#fff5b1\",\"editor.foldBackground\":\"#22222210\",\"editor.foreground\":\"#393a34\",\"editor.inactiveSelectionBackground\":\"#22222210\",\"editor.lineHighlightBackground\":\"#f7f7f7\",\"editor.selectionBackground\":\"#22222218\",\"editor.selectionHighlightBackground\":\"#22222210\",\"editor.stackFrameHighlightBackground\":\"#fffbdd\",\"editor.wordHighlightBackground\":\"#1c6b4805\",\"editor.wordHighlightStrongBackground\":\"#1c6b4810\",\"editorBracketHighlight.foreground1\":\"#2993a3\",\"editorBracketHighlight.foreground2\":\"#1e754f\",\"editorBracketHighlight.foreground3\":\"#a65e2b\",\"editorBracketHighlight.foreground4\":\"#a13865\",\"editorBracketHighlight.foreground5\":\"#bda437\",\"editorBracketHighlight.foreground6\":\"#296aa3\",\"editorBracketMatch.background\":\"#1c6b4820\",\"editorError.foreground\":\"#ab5959\",\"editorGroup.border\":\"#f0f0f0\",\"editorGroupHeader.tabsBackground\":\"#ffffff\",\"editorGroupHeader.tabsBorder\":\"#f0f0f0\",\"editorGutter.addedBackground\":\"#1e754f\",\"editorGutter.commentRangeForeground\":\"#393a3450\",\"editorGutter.deletedBackground\":\"#ab5959\",\"editorGutter.foldingControlForeground\":\"#393a3490\",\"editorGutter.modifiedBackground\":\"#296aa3\",\"editorHint.foreground\":\"#1e754f\",\"editorIndentGuide.activeBackground\":\"#00000030\",\"editorIndentGuide.background\":\"#00000015\",\"editorInfo.foreground\":\"#296aa3\",\"editorInlayHint.background\":\"#f7f7f7\",\"editorInlayHint.foreground\":\"#999999\",\"editorLineNumber.activeForeground\":\"#4e4f47\",\"editorLineNumber.foreground\":\"#393a3450\",\"editorOverviewRuler.border\":\"#fff\",\"editorStickyScroll.background\":\"#f7f7f7\",\"editorStickyScrollHover.background\":\"#f7f7f7\",\"editorWarning.foreground\":\"#a65e2b\",\"editorWhitespace.foreground\":\"#00000015\",\"editorWidget.background\":\"#ffffff\",\"errorForeground\":\"#ab5959\",\"focusBorder\":\"#00000000\",\"foreground\":\"#393a34\",\"gitDecoration.addedResourceForeground\":\"#1e754f\",\"gitDecoration.conflictingResourceForeground\":\"#a65e2b\",\"gitDecoration.deletedResourceForeground\":\"#ab5959\",\"gitDecoration.ignoredResourceForeground\":\"#393a3450\",\"gitDecoration.modifiedResourceForeground\":\"#296aa3\",\"gitDecoration.submoduleResourceForeground\":\"#393a3490\",\"gitDecoration.untrackedResourceForeground\":\"#2993a3\",\"input.background\":\"#f7f7f7\",\"input.border\":\"#f0f0f0\",\"input.foreground\":\"#393a34\",\"input.placeholderForeground\":\"#393a3490\",\"inputOption.activeBackground\":\"#393a3450\",\"list.activeSelectionBackground\":\"#f7f7f7\",\"list.activeSelectionForeground\":\"#393a34\",\"list.focusBackground\":\"#f7f7f7\",\"list.highlightForeground\":\"#1c6b48\",\"list.hoverBackground\":\"#f7f7f7\",\"list.hoverForeground\":\"#393a34\",\"list.inactiveFocusBackground\":\"#ffffff\",\"list.inactiveSelectionBackground\":\"#f7f7f7\",\"list.inactiveSelectionForeground\":\"#393a34\",\"menu.separatorBackground\":\"#f0f0f0\",\"notificationCenterHeader.background\":\"#ffffff\",\"notificationCenterHeader.foreground\":\"#6a737d\",\"notifications.background\":\"#ffffff\",\"notifications.border\":\"#f0f0f0\",\"notifications.foreground\":\"#393a34\",\"notificationsErrorIcon.foreground\":\"#ab5959\",\"notificationsInfoIcon.foreground\":\"#296aa3\",\"notificationsWarningIcon.foreground\":\"#a65e2b\",\"panel.background\":\"#ffffff\",\"panel.border\":\"#f0f0f0\",\"panelInput.border\":\"#e1e4e8\",\"panelTitle.activeBorder\":\"#1c6b48\",\"panelTitle.activeForeground\":\"#393a34\",\"panelTitle.inactiveForeground\":\"#6a737d\",\"peekViewEditor.background\":\"#ffffff\",\"peekViewResult.background\":\"#ffffff\",\"pickerGroup.border\":\"#f0f0f0\",\"pickerGroup.foreground\":\"#393a34\",\"problemsErrorIcon.foreground\":\"#ab5959\",\"problemsInfoIcon.foreground\":\"#296aa3\",\"problemsWarningIcon.foreground\":\"#a65e2b\",\"progressBar.background\":\"#1c6b48\",\"quickInput.background\":\"#ffffff\",\"quickInput.foreground\":\"#393a34\",\"quickInputList.focusBackground\":\"#f7f7f7\",\"scrollbar.shadow\":\"#6a737d33\",\"scrollbarSlider.activeBackground\":\"#393a3450\",\"scrollbarSlider.background\":\"#393a3410\",\"scrollbarSlider.hoverBackground\":\"#393a3450\",\"settings.headerForeground\":\"#393a34\",\"settings.modifiedItemIndicator\":\"#1c6b48\",\"sideBar.background\":\"#ffffff\",\"sideBar.border\":\"#f0f0f0\",\"sideBar.foreground\":\"#4e4f47\",\"sideBarSectionHeader.background\":\"#ffffff\",\"sideBarSectionHeader.border\":\"#f0f0f0\",\"sideBarSectionHeader.foreground\":\"#393a34\",\"sideBarTitle.foreground\":\"#393a34\",\"statusBar.background\":\"#ffffff\",\"statusBar.border\":\"#f0f0f0\",\"statusBar.debuggingBackground\":\"#f7f7f7\",\"statusBar.debuggingForeground\":\"#4e4f47\",\"statusBar.foreground\":\"#4e4f47\",\"statusBar.noFolderBackground\":\"#ffffff\",\"statusBarItem.prominentBackground\":\"#f7f7f7\",\"tab.activeBackground\":\"#ffffff\",\"tab.activeBorder\":\"#f0f0f0\",\"tab.activeBorderTop\":\"#393a3490\",\"tab.activeForeground\":\"#393a34\",\"tab.border\":\"#f0f0f0\",\"tab.hoverBackground\":\"#f7f7f7\",\"tab.inactiveBackground\":\"#ffffff\",\"tab.inactiveForeground\":\"#6a737d\",\"tab.unfocusedActiveBorder\":\"#f0f0f0\",\"tab.unfocusedActiveBorderTop\":\"#f0f0f0\",\"tab.unfocusedHoverBackground\":\"#ffffff\",\"terminal.ansiBlack\":\"#121212\",\"terminal.ansiBlue\":\"#296aa3\",\"terminal.ansiBrightBlack\":\"#aaaaaa\",\"terminal.ansiBrightBlue\":\"#296aa3\",\"terminal.ansiBrightCyan\":\"#2993a3\",\"terminal.ansiBrightGreen\":\"#1e754f\",\"terminal.ansiBrightMagenta\":\"#a13865\",\"terminal.ansiBrightRed\":\"#ab5959\",\"terminal.ansiBrightWhite\":\"#dddddd\",\"terminal.ansiBrightYellow\":\"#bda437\",\"terminal.ansiCyan\":\"#2993a3\",\"terminal.ansiGreen\":\"#1e754f\",\"terminal.ansiMagenta\":\"#a13865\",\"terminal.ansiRed\":\"#ab5959\",\"terminal.ansiWhite\":\"#dbd7ca\",\"terminal.ansiYellow\":\"#bda437\",\"terminal.foreground\":\"#393a34\",\"terminal.selectionBackground\":\"#22222218\",\"textBlockQuote.background\":\"#ffffff\",\"textBlockQuote.border\":\"#f0f0f0\",\"textCodeBlock.background\":\"#ffffff\",\"textLink.activeForeground\":\"#1c6b48\",\"textLink.foreground\":\"#1c6b48\",\"textPreformat.foreground\":\"#586069\",\"textSeparator.foreground\":\"#d1d5da\",\"titleBar.activeBackground\":\"#ffffff\",\"titleBar.activeForeground\":\"#4e4f47\",\"titleBar.border\":\"#f7f7f7\",\"titleBar.inactiveBackground\":\"#ffffff\",\"titleBar.inactiveForeground\":\"#6a737d\",\"tree.indentGuidesStroke\":\"#e1e4e8\",\"welcomePage.buttonBackground\":\"#f6f8fa\",\"welcomePage.buttonHoverBackground\":\"#e1e4e8\"},\"displayName\":\"Vitesse Light\",\"name\":\"vitesse-light\",\"semanticHighlighting\":true,\"semanticTokenColors\":{\"class\":\"#5a6aa6\",\"interface\":\"#2e808f\",\"namespace\":\"#b05a78\",\"property\":\"#998418\",\"type\":\"#2e808f\"},\"tokenColors\":[{\"scope\":[\"comment\",\"punctuation.definition.comment\",\"string.comment\"],\"settings\":{\"foreground\":\"#a0ada0\"}},{\"scope\":[\"delimiter.bracket\",\"delimiter\",\"invalid.illegal.character-not-allowed-here.html\",\"keyword.operator.rest\",\"keyword.operator.spread\",\"keyword.operator.type.annotation\",\"keyword.operator.relational\",\"keyword.operator.assignment\",\"keyword.operator.type\",\"meta.brace\",\"meta.tag.block.any.html\",\"meta.tag.inline.any.html\",\"meta.tag.structure.input.void.html\",\"meta.type.annotation\",\"meta.embedded.block.github-actions-expression\",\"storage.type.function.arrow\",\"meta.objectliteral.ts\",\"punctuation\",\"punctuation.definition.string.begin.html.vue\",\"punctuation.definition.string.end.html.vue\"],\"settings\":{\"foreground\":\"#999999\"}},{\"scope\":[\"constant\",\"entity.name.constant\",\"variable.language\",\"meta.definition.variable\"],\"settings\":{\"foreground\":\"#a65e2b\"}},{\"scope\":[\"entity\",\"entity.name\"],\"settings\":{\"foreground\":\"#59873a\"}},{\"scope\":\"variable.parameter.function\",\"settings\":{\"foreground\":\"#393a34\"}},{\"scope\":[\"entity.name.tag\",\"tag.html\"],\"settings\":{\"foreground\":\"#1e754f\"}},{\"scope\":\"entity.name.function\",\"settings\":{\"foreground\":\"#59873a\"}},{\"scope\":[\"keyword\",\"storage.type.class.jsdoc\",\"punctuation.definition.template-expression\"],\"settings\":{\"foreground\":\"#1e754f\"}},{\"scope\":[\"storage\",\"storage.type\",\"support.type.builtin\",\"constant.language.undefined\",\"constant.language.null\",\"constant.language.import-export-all.ts\"],\"settings\":{\"foreground\":\"#ab5959\"}},{\"scope\":[\"text.html.derivative\",\"storage.modifier.package\",\"storage.modifier.import\",\"storage.type.java\"],\"settings\":{\"foreground\":\"#393a34\"}},{\"scope\":[\"string\",\"string punctuation.section.embedded source\",\"attribute.value\"],\"settings\":{\"foreground\":\"#b56959\"}},{\"scope\":[\"punctuation.definition.string\"],\"settings\":{\"foreground\":\"#b5695977\"}},{\"scope\":[\"punctuation.support.type.property-name\"],\"settings\":{\"foreground\":\"#99841877\"}},{\"scope\":\"support\",\"settings\":{\"foreground\":\"#998418\"}},{\"scope\":[\"property\",\"meta.property-name\",\"meta.object-literal.key\",\"entity.name.tag.yaml\",\"attribute.name\"],\"settings\":{\"foreground\":\"#998418\"}},{\"scope\":[\"entity.other.attribute-name\",\"invalid.deprecated.entity.other.attribute-name.html\"],\"settings\":{\"foreground\":\"#b07d48\"}},{\"scope\":[\"variable\",\"identifier\"],\"settings\":{\"foreground\":\"#b07d48\"}},{\"scope\":[\"support.type.primitive\",\"entity.name.type\"],\"settings\":{\"foreground\":\"#2e8f82\"}},{\"scope\":\"namespace\",\"settings\":{\"foreground\":\"#b05a78\"}},{\"scope\":[\"keyword.operator\",\"keyword.operator.assignment.compound\",\"meta.var.expr.ts\"],\"settings\":{\"foreground\":\"#ab5959\"}},{\"scope\":\"invalid.broken\",\"settings\":{\"fontStyle\":\"italic\",\"foreground\":\"#b31d28\"}},{\"scope\":\"invalid.deprecated\",\"settings\":{\"fontStyle\":\"italic\",\"foreground\":\"#b31d28\"}},{\"scope\":\"invalid.illegal\",\"settings\":{\"fontStyle\":\"italic\",\"foreground\":\"#b31d28\"}},{\"scope\":\"invalid.unimplemented\",\"settings\":{\"fontStyle\":\"italic\",\"foreground\":\"#b31d28\"}},{\"scope\":\"carriage-return\",\"settings\":{\"background\":\"#d73a49\",\"content\":\"^M\",\"fontStyle\":\"italic underline\",\"foreground\":\"#fafbfc\"}},{\"scope\":\"message.error\",\"settings\":{\"foreground\":\"#b31d28\"}},{\"scope\":\"string variable\",\"settings\":{\"foreground\":\"#b56959\"}},{\"scope\":[\"source.regexp\",\"string.regexp\"],\"settings\":{\"foreground\":\"#ab5e3f\"}},{\"scope\":[\"string.regexp.character-class\",\"string.regexp constant.character.escape\",\"string.regexp source.ruby.embedded\",\"string.regexp string.regexp.arbitrary-repitition\"],\"settings\":{\"foreground\":\"#b56959\"}},{\"scope\":\"string.regexp constant.character.escape\",\"settings\":{\"foreground\":\"#bda437\"}},{\"scope\":[\"support.constant\"],\"settings\":{\"foreground\":\"#a65e2b\"}},{\"scope\":[\"keyword.operator.quantifier.regexp\",\"constant.numeric\",\"number\"],\"settings\":{\"foreground\":\"#2f798a\"}},{\"scope\":[\"keyword.other.unit\"],\"settings\":{\"foreground\":\"#ab5959\"}},{\"scope\":[\"constant.language.boolean\",\"constant.language\"],\"settings\":{\"foreground\":\"#1e754f\"}},{\"scope\":\"meta.module-reference\",\"settings\":{\"foreground\":\"#1c6b48\"}},{\"scope\":\"punctuation.definition.list.begin.markdown\",\"settings\":{\"foreground\":\"#a65e2b\"}},{\"scope\":[\"markup.heading\",\"markup.heading entity.name\"],\"settings\":{\"fontStyle\":\"bold\",\"foreground\":\"#1c6b48\"}},{\"scope\":\"markup.quote\",\"settings\":{\"foreground\":\"#2e808f\"}},{\"scope\":\"markup.italic\",\"settings\":{\"fontStyle\":\"italic\",\"foreground\":\"#393a34\"}},{\"scope\":\"markup.bold\",\"settings\":{\"fontStyle\":\"bold\",\"foreground\":\"#393a34\"}},{\"scope\":\"markup.raw\",\"settings\":{\"foreground\":\"#1c6b48\"}},{\"scope\":[\"markup.deleted\",\"meta.diff.header.from-file\",\"punctuation.definition.deleted\"],\"settings\":{\"background\":\"#ffeef0\",\"foreground\":\"#b31d28\"}},{\"scope\":[\"markup.inserted\",\"meta.diff.header.to-file\",\"punctuation.definition.inserted\"],\"settings\":{\"background\":\"#f0fff4\",\"foreground\":\"#22863a\"}},{\"scope\":[\"markup.changed\",\"punctuation.definition.changed\"],\"settings\":{\"background\":\"#ffebda\",\"foreground\":\"#e36209\"}},{\"scope\":[\"markup.ignored\",\"markup.untracked\"],\"settings\":{\"background\":\"#005cc5\",\"foreground\":\"#f6f8fa\"}},{\"scope\":\"meta.diff.range\",\"settings\":{\"fontStyle\":\"bold\",\"foreground\":\"#6f42c1\"}},{\"scope\":\"meta.diff.header\",\"settings\":{\"foreground\":\"#005cc5\"}},{\"scope\":\"meta.separator\",\"settings\":{\"fontStyle\":\"bold\",\"foreground\":\"#005cc5\"}},{\"scope\":\"meta.output\",\"settings\":{\"foreground\":\"#005cc5\"}},{\"scope\":[\"brackethighlighter.tag\",\"brackethighlighter.curly\",\"brackethighlighter.round\",\"brackethighlighter.square\",\"brackethighlighter.angle\",\"brackethighlighter.quote\"],\"settings\":{\"foreground\":\"#586069\"}},{\"scope\":\"brackethighlighter.unmatched\",\"settings\":{\"foreground\":\"#b31d28\"}},{\"scope\":[\"constant.other.reference.link\",\"string.other.link\",\"punctuation.definition.string.begin.markdown\",\"punctuation.definition.string.end.markdown\"],\"settings\":{\"foreground\":\"#b56959\"}},{\"scope\":[\"markup.underline.link.markdown\",\"markup.underline.link.image.markdown\"],\"settings\":{\"fontStyle\":\"underline\",\"foreground\":\"#393a3490\"}},{\"scope\":[\"type.identifier\",\"constant.other.character-class.regexp\"],\"settings\":{\"foreground\":\"#5a6aa6\"}},{\"scope\":[\"entity.other.attribute-name.html.vue\"],\"settings\":{\"foreground\":\"#59873a\"}},{\"scope\":[\"invalid.illegal.unrecognized-tag.html\"],\"settings\":{\"fontStyle\":\"normal\"}}],\"type\":\"light\"}"))
@@ -11,6 +11,7 @@ from instaui import consts
11
11
 
12
12
  from instaui.vars.types import TMaybeRef
13
13
  from instaui.vars.web_computed import WebComputed
14
+ from instaui.ui_functions.ui_types import is_bindable
14
15
 
15
16
 
16
17
  _T = TypeVar("_T")
@@ -28,10 +29,13 @@ class ValueElement(Element, Generic[_T]):
28
29
  self.__is_html_component = is_html_component
29
30
 
30
31
  if value is not None:
31
- if isinstance(value, WebComputed):
32
- self.props({value_name:value})
32
+ if is_bindable(value):
33
+ if isinstance(value, WebComputed):
34
+ self.props({value_name: value})
35
+ else:
36
+ self.vmodel(value, prop_name=value_name)
33
37
  else:
34
- self.vmodel(value, prop_name=value_name)
38
+ self.props({value_name: value})
35
39
 
36
40
  def vmodel(
37
41
  self,
instaui/consts.py CHANGED
@@ -13,8 +13,9 @@ APP_CSS_PATH = _STATIC_DIR.joinpath("insta-ui.css")
13
13
  VUE_IIFE_JS_PATH = _STATIC_DIR.joinpath("vue.global.prod.js")
14
14
  VUE_ES_JS_PATH = _STATIC_DIR.joinpath("vue.esm-browser.prod.js")
15
15
  VUE_ES_RUNTIME_JS_PATH = _STATIC_DIR.joinpath("vue.runtime.esm-browser.prod.js")
16
- TAILWIND_JS_PATH = _STATIC_DIR.joinpath("tailwindcss.min.js")
17
16
  FAVICON_PATH = _STATIC_DIR.joinpath("insta-ui.ico")
17
+ # tools
18
+ TOOLS_BROWSER_JS_PATH = _STATIC_DIR.joinpath("instaui-tools-browser.js")
18
19
 
19
20
  PAGE_TITLE = "insta-ui"
20
21
 
instaui/event/js_event.py CHANGED
@@ -25,6 +25,7 @@ class JsEvent(Jsonable, EventMixin):
25
25
 
26
26
  def _to_json_dict(self):
27
27
  data = super()._to_json_dict()
28
+ data["type"] = self.event_type()
28
29
 
29
30
  if self._inputs:
30
31
  data["inputs"] = self._inputs
@@ -7,6 +7,8 @@ from instaui.vars.mixin_types.py_binding import CanInputMixin, CanOutputMixin
7
7
  from instaui.handlers import event_handler
8
8
  from .event_mixin import EventMixin
9
9
 
10
+ _SYNC_TYPE = "sync"
11
+ _ASYNC_TYPE = "async"
10
12
 
11
13
  P = ParamSpec("P")
12
14
  R = typing.TypeVar("R")
@@ -48,18 +50,15 @@ class WebEvent(Jsonable, EventMixin, typing.Generic[P, R]):
48
50
  page_path=app.page_path, handler=self._fn
49
51
  )
50
52
 
51
- handler_path = (
52
- event_handler.ASYNC_URL
53
- if inspect.iscoroutinefunction(self._fn)
54
- else event_handler.SYNC_URL
55
- )
56
-
57
53
  event_handler.register_event_handler(
58
54
  hkey, self._fn, self._outputs, self._inputs
59
55
  )
60
56
 
61
57
  data = {}
62
- data["url"] = handler_path
58
+ data["type"] = self.event_type()
59
+ data["fType"] = (
60
+ _ASYNC_TYPE if inspect.iscoroutinefunction(self._fn) else _SYNC_TYPE
61
+ )
63
62
  data["hKey"] = hkey
64
63
  data["sid"] = self._sid
65
64
 
@@ -0,0 +1,3 @@
1
+ __all__ = ["duckdb"]
2
+
3
+ from ._duckdb import _facade as duckdb
@@ -0,0 +1,23 @@
1
+ from instaui import ui
2
+ from ._types import TFilters
3
+
4
+
5
+ class DataSourceElement(ui.element, esm="./data_source.js"):
6
+ def __init__(
7
+ self,
8
+ ):
9
+ super().__init__()
10
+
11
+ self._ele_ref = ui.element_ref()
12
+ self.element_ref(self._ele_ref)
13
+
14
+ self.filters: TFilters = ui.state({})
15
+
16
+ self.on(
17
+ "filter-changed",
18
+ ui.js_event(
19
+ inputs=[ui.event_context.e()],
20
+ outputs=[self.filters],
21
+ code="v=> v.filters",
22
+ ),
23
+ )
@@ -0,0 +1,221 @@
1
+ from pathlib import Path
2
+ from typing import Dict, TypeVar
3
+ import itertools
4
+ from instaui import ui, arco
5
+ from ._base import DataSourceElement
6
+ from ._types import TFilters, TQueryStrInfo
7
+
8
+ try:
9
+ import pandas
10
+ import duckdb
11
+ except ImportError as e:
12
+ raise e
13
+
14
+
15
+ TElementClass = TypeVar("TElementClass", bound=ui.element)
16
+
17
+
18
+ class DuckdbDataFrameSource:
19
+ QUERY_ID: int = 0
20
+
21
+ def __init__(
22
+ self,
23
+ table_name: str,
24
+ ):
25
+ super().__init__()
26
+
27
+ self._element = DataSourceElement()
28
+ self._conn = duckdb.connect(":default:", read_only=False)
29
+ self._table_name = table_name
30
+
31
+ def _generate_query_id(self):
32
+ self.QUERY_ID += 1
33
+ return self.QUERY_ID
34
+
35
+ def __getitem__(self, field: str):
36
+ def use_fn(cls: type[TElementClass]) -> TElementClass:
37
+ if issubclass(cls, arco.select):
38
+ return self.__apply_select(field)(cls)
39
+
40
+ if issubclass(cls, arco.input):
41
+ return self.__apply_input(field)(cls)
42
+
43
+ raise NotImplementedError(f"Not supported component:{cls.__name__}")
44
+
45
+ return use_fn
46
+
47
+ def __query_distinct_field_values(
48
+ self, field: str, query_id: int, order_sql: str = ""
49
+ ):
50
+ @ui.computed(inputs=[self.__query_str_info(field, query_id), field, order_sql])
51
+ def query_distinct_field_values_computed(
52
+ with_filters_info: TQueryStrInfo, field: str, order_sql: str
53
+ ):
54
+ sql = f"with cte as ({with_filters_info['sql']}) select distinct {field} from cte {order_sql}"
55
+
56
+ local_con = self._conn.cursor()
57
+
58
+ query = local_con.sql(sql, params=with_filters_info["params"])
59
+ return list(itertools.chain(*query.fetchall()))
60
+
61
+ return query_distinct_field_values_computed
62
+
63
+ def __apply_select(self, field: str):
64
+ def use_fn(cls: type[arco.select]) -> arco.select:
65
+ query_id = self._generate_query_id()
66
+ element = cls(
67
+ self.__query_distinct_field_values(
68
+ field=field, query_id=query_id, order_sql=f"order by {field}"
69
+ )
70
+ )
71
+
72
+ on_change = ui.js_event(
73
+ inputs=[ui.event_context.e(), field, query_id],
74
+ outputs=[self._element._ele_ref],
75
+ code=r"""(value,field,query_id) => {
76
+ if (value) {
77
+ return {method: 'addFilter', args:[{field, expr: `${field}= ?`,value,query_id}]};
78
+ }
79
+
80
+ return {method:'removeFilter', args:[{field,query_id}]};
81
+ }""",
82
+ )
83
+
84
+ element.on_change(on_change)
85
+
86
+ return element
87
+
88
+ return use_fn
89
+
90
+ def __apply_input(self, field: str):
91
+ def use_fn(cls: type[arco.input]) -> arco.input:
92
+ query_id = self._generate_query_id()
93
+ element = cls()
94
+
95
+ on_change = ui.js_event(
96
+ inputs=[ui.event_context.e(), field, query_id],
97
+ outputs=[self._element._ele_ref],
98
+ code=r"""(value,field,query_id) => {
99
+ if (value) {
100
+ value = `%${value.trim()}%`
101
+ return {method: 'addFilter', args:[{field, expr: `${field} like ?`,value,replace:true,query_id}]};
102
+ }
103
+
104
+ return {method:'removeFilter', args:[{field,query_id}]};
105
+ }""",
106
+ )
107
+
108
+ element.on_input(on_change)
109
+
110
+ return element
111
+
112
+ return use_fn
113
+
114
+ def __query_str_info(self, target_field: str = "", query_id: int = -1):
115
+ @ui.computed(inputs=[self._element.filters, target_field, query_id])
116
+ def query_str_computed(filters: TFilters, target_field: str, query_id: int):
117
+ if not filters:
118
+ return {
119
+ "sql": f"select * from {self._table_name}",
120
+ "params": [],
121
+ }
122
+ else:
123
+ filter_exprs = []
124
+
125
+ if target_field:
126
+ target_key = f"{target_field}-{query_id}"
127
+ without_target_exprs = (
128
+ exprs for key, exprs in filters.items() if key != target_key
129
+ )
130
+ filter_exprs = list(itertools.chain(*without_target_exprs))
131
+ else:
132
+ filter_exprs = list(itertools.chain(*filters.values()))
133
+
134
+ where_stem = " and ".join(info["expr"] for info in filter_exprs)
135
+ if where_stem:
136
+ where_stem = f" where {where_stem}"
137
+ return {
138
+ "sql": f"select * from {self._table_name}{where_stem}",
139
+ "params": [info["value"] for info in filter_exprs],
140
+ }
141
+
142
+ return query_str_computed
143
+
144
+ def query_str(self):
145
+ return ui.js_computed(
146
+ inputs=[self.__query_str_info()],
147
+ code=r"""info=>{
148
+ const {sql,params} = info;
149
+ let currentIndex = 0;
150
+ return sql.replace(/\?/g, function () {
151
+ if (currentIndex >= params.length) {
152
+ throw new Error('Not enough parameters provided for the SQL statement.');
153
+ }
154
+ return JSON.stringify(params[currentIndex++]);
155
+ });
156
+ }""",
157
+ )
158
+
159
+ def filters(self):
160
+ return self._element.filters
161
+
162
+ def __apply_table(self, *, sql: str):
163
+ def use_fn(cls: type[arco.table]) -> arco.table:
164
+ @ui.computed(inputs=[self.__query_str_info(), sql])
165
+ def table_query(with_filters_into: TQueryStrInfo, sql: str):
166
+ sql = f"with cte as ({with_filters_into['sql']}) {sql}"
167
+
168
+ local_con = self._conn.cursor()
169
+
170
+ query = local_con.sql(sql, params=with_filters_into["params"])
171
+ columns = query.columns
172
+ values = query.fetchall()
173
+
174
+ real_cols = [{"title": col, "dataIndex": col} for col in columns]
175
+
176
+ real_values = [
177
+ {col: val for col, val in zip(columns, row)} for row in values
178
+ ]
179
+
180
+ return {
181
+ "columns": real_cols,
182
+ "data": real_values,
183
+ }
184
+
185
+ element = cls(
186
+ data=ui.js_computed(inputs=[table_query], code=r"v=> v ? v.data : []"),
187
+ columns=ui.js_computed(
188
+ inputs=[table_query], code=r"v=> v ? v.columns : []"
189
+ ),
190
+ )
191
+
192
+ return element
193
+
194
+ return use_fn
195
+
196
+ def __call__(self, cls: type[arco.table], *, sql: str = "select * from cte"):
197
+ return self.__apply_table(sql=sql)(cls)
198
+
199
+ def query_table(self, *, sql: str):
200
+ return self.__apply_table(sql=sql)
201
+
202
+
203
+ class Facade:
204
+ def __call__(self, db: Path):
205
+ self.db = db
206
+ raise NotImplementedError()
207
+
208
+ @classmethod
209
+ def from_pandas(
210
+ cls, dataframe: "pandas.DataFrame", *, table_name: str = "df"
211
+ ) -> DuckdbDataFrameSource:
212
+ ds = DuckdbDataFrameSource(table_name)
213
+
214
+ cursor = ds._conn.cursor()
215
+ cursor.execute(
216
+ f"create table if not exists {table_name} as select * from dataframe"
217
+ )
218
+ return ds
219
+
220
+
221
+ _facade = Facade()
@@ -0,0 +1,15 @@
1
+ from typing import Any, Dict, List
2
+ from typing_extensions import TypedDict
3
+
4
+
5
+ class TFilterInfo(TypedDict):
6
+ expr: str
7
+ value: Any
8
+
9
+
10
+ TFilters = Dict[str, List[TFilterInfo]]
11
+
12
+
13
+ class TQueryStrInfo(TypedDict):
14
+ sql: str
15
+ params: List[Any]
@@ -0,0 +1,50 @@
1
+
2
+ export default {
3
+ props: [],
4
+
5
+ setup(props, { emit, expose }) {
6
+ const filters = new Map()
7
+
8
+ function addFilter(filter) {
9
+ const { field, expr, value, replace = true, query_id } = filter
10
+ const key = `${field}-${query_id}`
11
+
12
+ if (!filters.has(key)) {
13
+ filters.set(key, [])
14
+ }
15
+
16
+ const info = { expr, value }
17
+
18
+ if (replace) {
19
+ filters.set(key, [info])
20
+ } else {
21
+ filters.get(key).push(info)
22
+ }
23
+ emit("filter-changed", { filters: Object.fromEntries(filters.entries()), target: field, query_id })
24
+ }
25
+
26
+ function removeFilter(info) {
27
+ const { field, query_id } = info
28
+ const key = `${field}-${query_id}`
29
+
30
+ filters.delete(key)
31
+ emit("filter-changed", { filters: Object.fromEntries(filters.entries()), target: field, query_id })
32
+ }
33
+
34
+
35
+
36
+ function test(count) {
37
+ console.log('test', count)
38
+ }
39
+
40
+ expose({
41
+ test,
42
+ addFilter,
43
+ removeFilter,
44
+ })
45
+
46
+
47
+ },
48
+
49
+
50
+ }
@@ -18,7 +18,7 @@ def create_router(app: FastAPI):
18
18
 
19
19
 
20
20
  async def event_generator(
21
- request: Request, connection_id: str, interval_heart_beat_sec: int = 2
21
+ request: Request, connection_id: str, interval_heart_beat_sec: float = 0.8
22
22
  ):
23
23
  logger.debug("debug sse started")
24
24
  task_event = asyncio.Event()
@@ -43,7 +43,6 @@ INSTAUI_STATIC_URL = f"/_instaui_{_INSTA_VERSION}/static"
43
43
  VUE_JS_HASH_LINK = f"{INSTAUI_STATIC_URL}/{consts.VUE_ES_JS_PATH.name}"
44
44
  INSTAUI_JS_HASH_LINK = f"{INSTAUI_STATIC_URL}/{consts.APP_ES_JS_PATH.name}"
45
45
  APP_CSS_LINK = f"{INSTAUI_STATIC_URL}/{consts.APP_CSS_PATH.name}"
46
- TAILWIND_JS_HASH_LINK = f"{INSTAUI_STATIC_URL}/{consts.TAILWIND_JS_PATH.name}"
47
46
  FAVICON_LINK = f"{INSTAUI_STATIC_URL}/{consts.FAVICON_PATH.name}"
48
47
 
49
48
 
@@ -143,13 +142,6 @@ class Server:
143
142
  or consts.PAGE_TITLE,
144
143
  )
145
144
 
146
- if html_resource.use_tailwind is None:
147
- if default_html_resource.use_tailwind:
148
- model.js_links.append(JsLink(TAILWIND_JS_HASH_LINK))
149
- else:
150
- if html_resource.use_tailwind:
151
- model.js_links.append(JsLink(TAILWIND_JS_HASH_LINK))
152
-
153
145
  # register custom components
154
146
  for component in system_slot._component_dependencies:
155
147
  if not component.esm:
@@ -192,8 +184,8 @@ class Server:
192
184
  model.css_links.append(resource.record_resource(css_link))
193
185
 
194
186
  # css file link to web static link
195
- for link, attrs in itertools.chain(
196
- html_resource._css_links.items(), default_html_resource._css_links.items()
187
+ for link in html_resource.get_valid_css_links(
188
+ default_html_resource._css_links_manager
197
189
  ):
198
190
  if isinstance(link, Path):
199
191
  model.css_links.append(resource.record_resource(link))
@@ -201,8 +193,8 @@ class Server:
201
193
  model.css_links.append(link)
202
194
 
203
195
  # js file link to web static link
204
- for info in itertools.chain(
205
- html_resource._js_links, default_html_resource._js_links
196
+ for info in html_resource.get_valid_js_links(
197
+ default_html_resource._js_links_manager
206
198
  ):
207
199
  link = (
208
200
  resource.record_resource(info.link)
@@ -1,15 +1,17 @@
1
1
  from __future__ import annotations
2
2
  import threading
3
3
  from typing import Callable, Dict, Optional, Sequence, TYPE_CHECKING
4
- from . import _utils
5
4
  import ast
5
+ from . import _utils
6
6
  from instaui.vars.event_context import DatasetEventContext
7
+ from instaui.runtime._app import update_web_server_info
7
8
 
8
9
  if TYPE_CHECKING:
9
10
  from instaui.vars.mixin_types.py_binding import CanOutputMixin, CanInputMixin
10
11
 
11
12
  ASYNC_URL = "/instaui/event/async"
12
13
  SYNC_URL = "/instaui/event/sync"
14
+ update_web_server_info(event_url=SYNC_URL, event_async_url=ASYNC_URL)
13
15
  _event_handlers: Dict[str, _utils.HandlerInfo] = {}
14
16
  dict_lock = threading.Lock()
15
17
 
@@ -9,12 +9,16 @@ from typing import (
9
9
  from dataclasses import dataclass
10
10
 
11
11
  from instaui.runtime.context import get_context
12
+ from instaui.runtime._app import update_web_server_info
12
13
  from instaui.systems import func_system
13
14
  from . import _utils
14
15
 
15
16
 
16
17
  ASYNC_URL = "/instaui/watch/async"
17
18
  SYNC_URL = "/instaui/watch/sync"
19
+
20
+ update_web_server_info(watch_url=SYNC_URL, watch_async_url=ASYNC_URL)
21
+
18
22
  _watch_handlers: Dict[str, _utils.HandlerInfo] = {}
19
23
  dict_lock = threading.Lock()
20
24
 
instaui/html_tools.py CHANGED
@@ -3,13 +3,26 @@ from pathlib import Path
3
3
  from typing import Any, Dict, Literal, Optional, Union
4
4
  from instaui.common.jsonable import dumps, dumps2dict
5
5
  from instaui.runtime._app import get_app_slot
6
+ from instaui.tailwind._index import use_tailwind
7
+
8
+ use_tailwind = use_tailwind
6
9
 
7
10
 
8
11
  def add_css_link(href: Union[str, Path]):
12
+ """Add a link to a CSS file to the HTML document.
13
+
14
+ Args:
15
+ href (Union[str, Path]): The path to the CSS file.
16
+ """
9
17
  get_app_slot()._html_resource.add_css_link(href)
10
18
 
11
19
 
12
20
  def remove_css_link(href: Union[str, Path]):
21
+ """Remove a link to a CSS file from the HTML document.
22
+
23
+ Args:
24
+ href (Union[str, Path]): The path to the CSS file.
25
+ """
13
26
  get_app_slot()._html_resource.remove_css_link(href)
14
27
 
15
28
 
@@ -18,6 +31,13 @@ def add_js_link(
18
31
  *,
19
32
  type: Optional[Literal["module"]] = None,
20
33
  ):
34
+ """Add a link to a JavaScript file to the HTML document.
35
+
36
+ Args:
37
+ link (Union[str, Path]): The path to the JavaScript file.
38
+ type (Optional[Literal["module"]], optional): The type of the JavaScript file. Defaults to None.
39
+ """
40
+
21
41
  attrs = {
22
42
  "type": type,
23
43
  }
@@ -26,22 +46,39 @@ def add_js_link(
26
46
 
27
47
 
28
48
  def add_style(content: str):
29
- get_app_slot()._html_resource.add_style_tag(content)
49
+ """Add a style tag to the HTML document.
30
50
 
31
-
32
- def use_tailwind(value=True):
33
- get_app_slot()._html_resource.use_tailwind = value
51
+ Args:
52
+ content (str): The content of the style tag.
53
+ """
54
+ get_app_slot()._html_resource.add_style_tag(content)
34
55
 
35
56
 
36
57
  def use_page_title(title: str):
58
+ """Set the title of the HTML document.
59
+
60
+ Args:
61
+ title (str): The title of the HTML document.
62
+ """
37
63
  get_app_slot()._html_resource.title = title
38
64
 
39
65
 
40
66
  def use_favicon(favicon: Path):
67
+ """Set the favicon of the HTML document.
68
+
69
+ Args:
70
+ favicon (Path): The path to the favicon.
71
+ """
41
72
  get_app_slot()._html_resource.favicon = favicon
42
73
 
43
74
 
44
75
  def add_js_code(code: str, *, script_attrs: Optional[Dict[str, Any]] = None):
76
+ """Add a script tag to the HTML document with the given JavaScript code.
77
+
78
+ Args:
79
+ code (str): The JavaScript code.
80
+ script_attrs (Optional[Dict[str, Any]], optional): The attributes of the script tag. Defaults to None.
81
+ """
45
82
  get_app_slot()._html_resource.add_script_tag(code, script_attrs=script_attrs)
46
83
 
47
84