dr-widget 0.1.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 (126) hide show
  1. dr_widget-0.1.0/PKG-INFO +61 -0
  2. dr_widget-0.1.0/README.md +49 -0
  3. dr_widget-0.1.0/pyproject.toml +25 -0
  4. dr_widget-0.1.0/src/dr_widget/__init__.py +5 -0
  5. dr_widget-0.1.0/src/dr_widget/py.typed +0 -0
  6. dr_widget-0.1.0/src/dr_widget/widgets/__init__.py +5 -0
  7. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/.gitignore +24 -0
  8. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/.vscode/extensions.json +3 -0
  9. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/README.md +43 -0
  10. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/__init__.py +26 -0
  11. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/components.json +16 -0
  12. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/index.html +12 -0
  13. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/jsrepo.json +18 -0
  14. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/package.json +49 -0
  15. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/postcss.config.js +6 -0
  16. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/public/fonts/Inter-roman.var.woff2 +0 -0
  17. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/public/vite.svg +1 -0
  18. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/App.svelte +72 -0
  19. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/FileDropWidget.svelte +461 -0
  20. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/app.css +132 -0
  21. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/index.js +5 -0
  22. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/@test_state.json +16 -0
  23. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/Counter.svelte +10 -0
  24. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/BrowseConfigsPanel.svelte +124 -0
  25. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/ComplexJsonViewer.svelte +94 -0
  26. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/ConfigViewerPanel.svelte +171 -0
  27. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/LoadedConfigPreview.svelte +61 -0
  28. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/SaveConfigPanel.svelte +223 -0
  29. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/SelectedFileRow.svelte +38 -0
  30. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/SelectedFilesList.svelte +30 -0
  31. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/file-drop/SimpleJsonViewer.svelte +195 -0
  32. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/badge/badge.svelte +50 -0
  33. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/badge/index.ts +2 -0
  34. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/button/button.svelte +128 -0
  35. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/button/index.ts +27 -0
  36. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/card-action.svelte +20 -0
  37. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/card-content.svelte +15 -0
  38. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/card-description.svelte +20 -0
  39. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/card-footer.svelte +20 -0
  40. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/card-header.svelte +23 -0
  41. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/card-title.svelte +20 -0
  42. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/card.svelte +23 -0
  43. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/card/index.ts +25 -0
  44. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-close.svelte +11 -0
  45. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-content.svelte +47 -0
  46. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-description.svelte +21 -0
  47. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-footer.svelte +24 -0
  48. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-header.svelte +24 -0
  49. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-overlay.svelte +24 -0
  50. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-title.svelte +21 -0
  51. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/dialog-trigger.svelte +11 -0
  52. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/dialog/index.ts +41 -0
  53. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-close.svelte +11 -0
  54. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-content.svelte +41 -0
  55. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-description.svelte +21 -0
  56. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-footer.svelte +24 -0
  57. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-header.svelte +24 -0
  58. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-nested.svelte +16 -0
  59. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-overlay.svelte +24 -0
  60. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-title.svelte +21 -0
  61. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer-trigger.svelte +11 -0
  62. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/drawer.svelte +16 -0
  63. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/drawer/index.ts +45 -0
  64. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/empty/empty-content.svelte +23 -0
  65. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/empty/empty-description.svelte +23 -0
  66. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/empty/empty-header.svelte +20 -0
  67. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/empty/empty-media.svelte +41 -0
  68. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/empty/empty-title.svelte +20 -0
  69. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/empty/empty.svelte +23 -0
  70. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/empty/index.ts +22 -0
  71. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-content.svelte +20 -0
  72. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-description.svelte +25 -0
  73. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-error.svelte +58 -0
  74. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-group.svelte +23 -0
  75. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-label.svelte +26 -0
  76. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-legend.svelte +29 -0
  77. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-separator.svelte +38 -0
  78. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-set.svelte +24 -0
  79. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field-title.svelte +23 -0
  80. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/field.svelte +53 -0
  81. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/field/index.ts +33 -0
  82. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/file-drop-zone/file-drop-zone.svelte +176 -0
  83. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/file-drop-zone/index.ts +29 -0
  84. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/file-drop-zone/types.ts +51 -0
  85. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/index.ts +34 -0
  86. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-actions.svelte +20 -0
  87. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-content.svelte +20 -0
  88. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-description.svelte +24 -0
  89. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-footer.svelte +20 -0
  90. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-group.svelte +21 -0
  91. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-header.svelte +20 -0
  92. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-media.svelte +42 -0
  93. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-separator.svelte +19 -0
  94. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item-title.svelte +20 -0
  95. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/item/item.svelte +60 -0
  96. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/label/index.ts +7 -0
  97. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/label/label.svelte +20 -0
  98. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/index.ts +13 -0
  99. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal-content.svelte +29 -0
  100. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal-description.svelte +20 -0
  101. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal-footer.svelte +29 -0
  102. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal-header.svelte +29 -0
  103. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal-title.svelte +20 -0
  104. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal-trigger.svelte +24 -0
  105. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal.svelte +24 -0
  106. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/modal/modal.svelte.ts +32 -0
  107. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/separator/index.ts +7 -0
  108. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/separator/separator.svelte +21 -0
  109. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/tabs/index.ts +16 -0
  110. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/tabs/tabs-content.svelte +17 -0
  111. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/tabs/tabs-list.svelte +20 -0
  112. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/tabs/tabs-trigger.svelte +20 -0
  113. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/components/ui/tabs/tabs.svelte +19 -0
  114. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/hooks/use-file-bindings.ts +106 -0
  115. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/react/JsonTreeCanvas.tsx +215 -0
  116. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/utils/utils.ts +21 -0
  117. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/lib/utils.ts +13 -0
  118. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/src/main.js +7 -0
  119. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/static/fonts/Inter-roman.var.woff2 +0 -0
  120. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/static/index.js +84232 -0
  121. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/static/style.css +1 -0
  122. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/static/vite.svg +1 -0
  123. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/svelte.config.js +8 -0
  124. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/tailwind.config.js +12 -0
  125. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/tsconfig.json +28 -0
  126. dr_widget-0.1.0/src/dr_widget/widgets/file_drop/vite.config.js +36 -0
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.3
2
+ Name: dr-widget
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Author: Danielle Rothermel
6
+ Author-email: Danielle Rothermel <danielle.rothermel@gmail.com>
7
+ Requires-Dist: anywidget>=0.9.18
8
+ Requires-Dist: marimo>=0.17.6
9
+ Requires-Dist: traitlets>=5.14.3
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+
13
+ # dr_widget
14
+
15
+ dr_widget is a hybrid Python/Svelte project for building reusable AnyWidget components that can be dropped into Marimo notebooks today and exported to full Svelte apps later. The repository currently ships a file-drop configuration browser, but the layout is designed to host additional widgets.
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ # Install JS dependencies (root + workspace)
21
+ bun install
22
+
23
+ # Live-reload the file-drop widget in a browser
24
+ bun run dev:file-drop
25
+
26
+ # Produce the optimized bundle used by AnyWidget
27
+ bun run build
28
+
29
+ # Build the Python distributions (wheel + sdist)
30
+ uv build
31
+
32
+ # Launch the Marimo demo notebook
33
+ marimo run notebooks/file_widget.py
34
+ ```
35
+
36
+ Prerequisites: Bun ≥ 1.0, Node-compatible environment, Python ≥ 3.11 with `uv`, and Marimo ≥ 0.17.6.
37
+
38
+ ## Repository Layout
39
+
40
+ - `src/dr_widget/` – Python package exposing AnyWidget classes.
41
+ - `widgets/file_drop/` – widget workspace (Svelte source in `src/`, build output in `static/`).
42
+ - `src/FileDropWidget.svelte` – orchestration layer wiring bindings into the panel components.
43
+ - `src/lib/hooks/use-file-bindings.ts` – shared logic for syncing AnyWidget traitlets.
44
+ - `src/lib/components/` – shadcn-style UI primitives and file-drop panels, including a config viewer card with both a tree view and graph view for JSON payloads.
45
+ - `docs/` – additional reference material (architecture, development workflows).
46
+ - `notebooks/file_widget.py` – Marimo notebook that exercises the file-drop widget.
47
+
48
+ ## Documentation
49
+
50
+ - [Architecture Overview](docs/architecture.md) – how Python, AnyWidget, and Svelte fit together.
51
+ - [Development Workflow](docs/development.md) – commands for widget builds, packaging, and notebooks.
52
+ - [Repository Guidelines](AGENTS.md) – coding standards, contracts, and contribution checklist.
53
+
54
+ ## Contributing
55
+
56
+ 1. Work inside a dedicated branch.
57
+ 2. Run `bun run build`, `npx svelte-check`, and `uv build` before opening a PR.
58
+ 3. Update the notebook and docs when you add or change widget behaviour.
59
+ 4. Follow the commit and PR practices outlined in `AGENTS.md`.
60
+
61
+ Please open an issue if you hit build problems or want to discuss new widgets.
@@ -0,0 +1,49 @@
1
+ # dr_widget
2
+
3
+ dr_widget is a hybrid Python/Svelte project for building reusable AnyWidget components that can be dropped into Marimo notebooks today and exported to full Svelte apps later. The repository currently ships a file-drop configuration browser, but the layout is designed to host additional widgets.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Install JS dependencies (root + workspace)
9
+ bun install
10
+
11
+ # Live-reload the file-drop widget in a browser
12
+ bun run dev:file-drop
13
+
14
+ # Produce the optimized bundle used by AnyWidget
15
+ bun run build
16
+
17
+ # Build the Python distributions (wheel + sdist)
18
+ uv build
19
+
20
+ # Launch the Marimo demo notebook
21
+ marimo run notebooks/file_widget.py
22
+ ```
23
+
24
+ Prerequisites: Bun ≥ 1.0, Node-compatible environment, Python ≥ 3.11 with `uv`, and Marimo ≥ 0.17.6.
25
+
26
+ ## Repository Layout
27
+
28
+ - `src/dr_widget/` – Python package exposing AnyWidget classes.
29
+ - `widgets/file_drop/` – widget workspace (Svelte source in `src/`, build output in `static/`).
30
+ - `src/FileDropWidget.svelte` – orchestration layer wiring bindings into the panel components.
31
+ - `src/lib/hooks/use-file-bindings.ts` – shared logic for syncing AnyWidget traitlets.
32
+ - `src/lib/components/` – shadcn-style UI primitives and file-drop panels, including a config viewer card with both a tree view and graph view for JSON payloads.
33
+ - `docs/` – additional reference material (architecture, development workflows).
34
+ - `notebooks/file_widget.py` – Marimo notebook that exercises the file-drop widget.
35
+
36
+ ## Documentation
37
+
38
+ - [Architecture Overview](docs/architecture.md) – how Python, AnyWidget, and Svelte fit together.
39
+ - [Development Workflow](docs/development.md) – commands for widget builds, packaging, and notebooks.
40
+ - [Repository Guidelines](AGENTS.md) – coding standards, contracts, and contribution checklist.
41
+
42
+ ## Contributing
43
+
44
+ 1. Work inside a dedicated branch.
45
+ 2. Run `bun run build`, `npx svelte-check`, and `uv build` before opening a PR.
46
+ 3. Update the notebook and docs when you add or change widget behaviour.
47
+ 4. Follow the commit and PR practices outlined in `AGENTS.md`.
48
+
49
+ Please open an issue if you hit build problems or want to discuss new widgets.
@@ -0,0 +1,25 @@
1
+ [project]
2
+ name = "dr-widget"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Danielle Rothermel", email = "danielle.rothermel@gmail.com" }
8
+ ]
9
+ requires-python = ">=3.11"
10
+ dependencies = [
11
+ "anywidget>=0.9.18",
12
+ "marimo>=0.17.6",
13
+ "traitlets>=5.14.3",
14
+ ]
15
+
16
+ [build-system]
17
+ requires = ["uv_build>=0.9.7,<0.10.0"]
18
+ build-backend = "uv_build"
19
+
20
+ [tool.uv.build-backend]
21
+ source-include = ["src/dr_widget/widgets/file_drop/static/**"]
22
+ source-exclude = [
23
+ "src/dr_widget/widgets/file_drop/node_modules",
24
+ "src/dr_widget/widgets/file_drop/node_modules/**",
25
+ ]
@@ -0,0 +1,5 @@
1
+ """Top-level package for dr_widget."""
2
+
3
+ from .widgets.file_drop import FileDropWidget
4
+
5
+ __all__ = ["FileDropWidget"]
File without changes
@@ -0,0 +1,5 @@
1
+ """Widget exports for dr_widget."""
2
+
3
+ from .file_drop import FileDropWidget
4
+
5
+ __all__ = ["FileDropWidget"]
@@ -0,0 +1,24 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["svelte.svelte-vscode"]
3
+ }
@@ -0,0 +1,43 @@
1
+ # Svelte + Vite
2
+
3
+ This template should help get you started developing with Svelte in Vite.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ [VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
8
+
9
+ ## Need an official Svelte framework?
10
+
11
+ Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
12
+
13
+ ## Technical considerations
14
+
15
+ **Why use this over SvelteKit?**
16
+
17
+ - It brings its own routing solution which might not be preferable for some users.
18
+ - It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
19
+
20
+ This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
21
+
22
+ Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.
23
+
24
+ **Why include `.vscode/extensions.json`?**
25
+
26
+ Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project.
27
+
28
+ **Why enable `checkJs` in the JS template?**
29
+
30
+ It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate. This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of JavaScript, it is trivial to change the configuration.
31
+
32
+ **Why is HMR not preserving my local component state?**
33
+
34
+ HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/sveltejs/svelte-hmr/tree/master/packages/svelte-hmr#preservation-of-local-state).
35
+
36
+ If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR.
37
+
38
+ ```js
39
+ // store.js
40
+ // An extremely simple external store
41
+ import { writable } from 'svelte/store'
42
+ export default writable(0)
43
+ ```
@@ -0,0 +1,26 @@
1
+ """AnyWidget bindings for the file drop widget."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import anywidget
8
+ import traitlets
9
+
10
+ __all__ = ["FileDropWidget"]
11
+
12
+ _STATIC_DIR = Path(__file__).parent / "static"
13
+
14
+
15
+ class FileDropWidget(anywidget.AnyWidget):
16
+ """File drop zone widget for notebooks."""
17
+
18
+ # AnyWidget expects module references pointing at the built assets on disk.
19
+ _esm = _STATIC_DIR / "index.js"
20
+ _css = _STATIC_DIR / "style.css"
21
+
22
+ files = traitlets.Unicode("[]").tag(sync=True)
23
+ file_count = traitlets.Int(0).tag(sync=True)
24
+ error = traitlets.Unicode("").tag(sync=True)
25
+ max_files = traitlets.Int(5, min=1).tag(sync=True)
26
+ selected_config = traitlets.Unicode("").tag(sync=True)
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://shadcn-svelte.com/schema.json",
3
+ "tailwind": {
4
+ "css": "src/app.css",
5
+ "baseColor": "slate"
6
+ },
7
+ "aliases": {
8
+ "components": "$lib/components",
9
+ "utils": "$lib/utils",
10
+ "ui": "$lib/components/ui",
11
+ "hooks": "$lib/hooks",
12
+ "lib": "$lib"
13
+ },
14
+ "typescript": true,
15
+ "registry": "https://shadcn-svelte.com/registry"
16
+ }
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>File Drop Widget - Dev Preview</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.js"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://unpkg.com/jsrepo@2.5.1/schemas/project-config.json",
3
+ "repos": ["@ieedan/shadcn-svelte-extras"],
4
+ "includeTests": false,
5
+ "includeDocs": false,
6
+ "watermark": true,
7
+ "formatter": "prettier",
8
+ "configFiles": {
9
+ "Shadcn Svelte Extras Cursor Rules": "./../../../../.cursor/rules/shadcn-svelte-extras.mdc"
10
+ },
11
+ "paths": {
12
+ "*": "./src/lib",
13
+ "ui": "./src/lib/components/ui",
14
+ "actions": "./src/lib/actions",
15
+ "hooks": "./src/lib/hooks",
16
+ "utils": "./src/lib/utils"
17
+ }
18
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@dr-widget/file_drop",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "vite build",
8
+ "dev": "vite dev",
9
+ "preview": "vite preview",
10
+ "check": "svelte-check --watch --tsconfig ./tsconfig.json"
11
+ },
12
+ "dependencies": {
13
+ "@anywidget/svelte": "^0.1.0",
14
+ "@zerodevx/svelte-json-view": "^1.0.11",
15
+ "elkjs": "^0.11.0",
16
+ "lucide-svelte": "^0.552.0",
17
+ "react": "18.2.0",
18
+ "react-dom": "18.2.0",
19
+ "react-zoom-pan-pinch": "^3.7.0",
20
+ "reaflow": "^5.4.1",
21
+ "svelte": "^5.43.2"
22
+ },
23
+ "devDependencies": {
24
+ "@internationalized/date": "^3.8.1",
25
+ "@lucide/svelte": "^0.544.0",
26
+ "@sveltejs/vite-plugin-svelte": "^4.0.0",
27
+ "@tailwindcss/postcss": "^4.0.9",
28
+ "@types/bun": "latest",
29
+ "@types/react": "18.2.74",
30
+ "@types/react-dom": "18.2.25",
31
+ "@vitejs/plugin-react-swc": "3.7.0",
32
+ "autoprefixer": "^10.4.20",
33
+ "bits-ui": "^2.11.0",
34
+ "clsx": "^2.1.1",
35
+ "postcss": "^8.4.49",
36
+ "prettier": "^3.6.2",
37
+ "runed": "^0.31.1",
38
+ "svelte-check": "^4.3.3",
39
+ "tailwind-merge": "^3.3.1",
40
+ "tailwind-variants": "^3.1.1",
41
+ "tailwindcss": "^4.1.16",
42
+ "tw-animate-css": "^1.4.0",
43
+ "vaul-svelte": "1.0.0-next.7",
44
+ "vite": "^5.4.11"
45
+ },
46
+ "peerDependencies": {
47
+ "typescript": "^5.9.3"
48
+ }
49
+ }
@@ -0,0 +1,6 @@
1
+ import tailwindcss from '@tailwindcss/postcss';
2
+ import autoprefixer from 'autoprefixer';
3
+
4
+ export default {
5
+ plugins: [tailwindcss(), autoprefixer()]
6
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,72 @@
1
+ <script>
2
+ import { Separator } from "./lib/components/ui/separator/";
3
+ import FileDropWidget from "./FileDropWidget.svelte";
4
+
5
+ // Simulate anywidget bindings for testing
6
+ let bindings = $state({
7
+ files: "",
8
+ file_count: 0,
9
+ error: "",
10
+ max_files: 1,
11
+ });
12
+
13
+ // Watch for changes to display them
14
+ $effect(() => {
15
+ console.log("Files updated:", bindings.files);
16
+ console.log("File count:", bindings.file_count);
17
+ if (bindings.error) {
18
+ console.error("Error:", bindings.error);
19
+ }
20
+ });
21
+ </script>
22
+
23
+ <main class="mx-auto max-w-5xl p-8 font-sans">
24
+ <div class="flex flex-col gap-8">
25
+ <div class="space-y-2">
26
+ <h1 class="text-3xl font-semibold text-zinc-900 dark:text-zinc-100">
27
+ Widget
28
+ </h1>
29
+ </div>
30
+
31
+ <FileDropWidget {bindings} max_files={1} />
32
+
33
+ <div
34
+ class="mt-4 rounded-lg border border-zinc-200 bg-zinc-50 p-6 dark:border-zinc-700 dark:bg-zinc-900"
35
+ >
36
+ <h2 class="text-lg font-medium text-zinc-800 dark:text-zinc-100">
37
+ Debug Output
38
+ </h2>
39
+
40
+ <div
41
+ class="mt-4 rounded-md bg-white p-3 text-sm shadow-sm dark:bg-zinc-800"
42
+ >
43
+ <strong class="font-semibold text-zinc-700 dark:text-zinc-200"
44
+ >File Count:</strong
45
+ >
46
+ <span class="ml-2 text-zinc-600 dark:text-zinc-300"
47
+ >{bindings.file_count}</span
48
+ >
49
+ </div>
50
+
51
+ <div
52
+ class="mt-4 rounded-md bg-white p-3 text-sm shadow-sm dark:bg-zinc-800"
53
+ >
54
+ <strong class="font-semibold text-zinc-700 dark:text-zinc-200"
55
+ >Files Data:</strong
56
+ >
57
+ <pre
58
+ class="mt-2 overflow-x-auto rounded-md bg-zinc-900/10 p-2 font-mono text-xs dark:bg-zinc-50/10">
59
+ {bindings.files || "(empty)"}</pre>
60
+ </div>
61
+
62
+ {#if bindings.error}
63
+ <div
64
+ class="mt-4 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-600 dark:border-red-500/40 dark:bg-red-950/40 dark:text-red-300"
65
+ >
66
+ <strong class="font-semibold">Error:</strong>
67
+ <span class="ml-2">{bindings.error}</span>
68
+ </div>
69
+ {/if}
70
+ </div>
71
+ </div>
72
+ </main>