@jseeio/jsee 0.4.2 → 0.8.0

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 (65) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/LICENSE +21 -0
  3. package/README.md +583 -55
  4. package/dist/2b3e1faf89f94a483539.png +0 -0
  5. package/dist/416d91365b44e4b4f477.png +0 -0
  6. package/dist/8f2c4d11474275fbc161.png +0 -0
  7. package/dist/jsee.core.js +1 -0
  8. package/dist/jsee.full.js +1 -0
  9. package/dist/jsee.runtime.js +2 -1
  10. package/package.json +84 -18
  11. package/src/app.js +127 -32
  12. package/src/cli.js +474 -64
  13. package/src/extended-imports.js +11 -0
  14. package/src/main.js +232 -44
  15. package/src/overlay.js +26 -1
  16. package/src/utils.js +386 -16
  17. package/templates/common-inputs.js +88 -0
  18. package/templates/common-outputs.js +340 -4
  19. package/templates/minimal-app.vue +367 -0
  20. package/templates/minimal-input.vue +573 -0
  21. package/templates/minimal-output.vue +426 -0
  22. package/templates/virtual-table.vue +194 -0
  23. package/.claude/settings.local.json +0 -15
  24. package/.eslintrc.js +0 -38
  25. package/AGENTS.md +0 -65
  26. package/CLAUDE.md +0 -5
  27. package/CNAME +0 -1
  28. package/_config.yml +0 -26
  29. package/dist/jsee.js +0 -1
  30. package/dump.sh +0 -23
  31. package/jest-puppeteer.config.js +0 -14
  32. package/jest.config.js +0 -8
  33. package/jest.unit.config.js +0 -8
  34. package/jsee.dump.txt +0 -5459
  35. package/load/index.html +0 -52
  36. package/templates/bulma-app.vue +0 -242
  37. package/templates/bulma-input.vue +0 -125
  38. package/templates/bulma-output.vue +0 -101
  39. package/test/arrow-main.html +0 -18
  40. package/test/arrow-worker.html +0 -18
  41. package/test/class.html +0 -22
  42. package/test/code.html +0 -25
  43. package/test/codew.html +0 -25
  44. package/test/example-class.js +0 -8
  45. package/test/example-sum.js +0 -3
  46. package/test/fixtures/lodash-like.js +0 -15
  47. package/test/fixtures/upload-sample.csv +0 -3
  48. package/test/importw.html +0 -28
  49. package/test/minimal.html +0 -14
  50. package/test/minimal1.html +0 -13
  51. package/test/minimal2.html +0 -15
  52. package/test/minimal3.html +0 -10
  53. package/test/minimal4.html +0 -22
  54. package/test/pipeline.html +0 -52
  55. package/test/python.html +0 -41
  56. package/test/runtime-arrow.html +0 -18
  57. package/test/string.html +0 -26
  58. package/test/stringw.html +0 -29
  59. package/test/sum.schema.json +0 -17
  60. package/test/sumw.schema.json +0 -15
  61. package/test/test-basic.test.js +0 -630
  62. package/test/test-python.test.js +0 -23
  63. package/test/unit/cli-fetch.test.js +0 -229
  64. package/test/unit/utils.test.js +0 -908
  65. package/webpack.config.js +0 -101
package/CHANGELOG.md CHANGED
@@ -1,5 +1,95 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0
4
+ ### Features:
5
+ - Full bundle: new build target `jsee.full.js` that includes Observable Plot, Three.js, and Leaflet for rich output types out of the box. The CLI and Python server auto-select `jsee.full.js` vs `jsee.core.js` based on schema output types. Build with `npm run build-full`
6
+ - Bundle rename: `jsee.runtime.js` → `jsee.core.js`, new `jsee.full.js` (was `jsee.runtime.extended.js`). `dist/jsee.runtime.js` is still produced as a backward-compatible copy of `jsee.core.js`
7
+ - `chart` output type: SVG charts via Observable Plot — supports line, dot, bar, area, and more. Model returns array of objects, column-oriented data `{x: [...], y: [...]}`, or a full Plot config `{marks: [...]}`. Schema props: `mark`, `x`, `y`, `color`, `width`, `height`
8
+ - `3d` output type: 3D model viewer via Three.js — renders programmatic geometry `{vertices, faces}` or GLTF/GLB URLs. Auto-creates scene with lighting and camera
9
+ - `map` output type: interactive maps via Leaflet — supports markers `[{lat, lng, popup}]`, GeoJSON, and `{center, markers, zoom}` objects. Auto-fits bounds. Schema props: `height`, `zoom`, `center`, `tiles`
10
+ - `pdf` output type: browser-native PDF viewer — renders from URL, data URL, Blob, ArrayBuffer, or Uint8Array. Included in the core bundle. Schema prop: `height`
11
+ - Dependency cleanup: remove PDF.js/canvas and Showdown/KaTeX from runtime dependencies; Markdown rendering now uses `markdown-it`
12
+ - `gallery` output type (zero-cost, core bundle): CSS grid of images with click-to-expand lightbox. Model returns array of URLs. Schema props: `columns`, `gap`
13
+ - `highlight` output type (zero-cost, core bundle): colored text spans with label badges. Model returns `[{text, label, color}]` segments
14
+ - `gauge` output type (zero-cost, core bundle): SVG semicircle gauge. Model returns number or `{value, label}`. Schema props: `min`, `max`, `label`, `color`
15
+ - `number` output type (zero-cost, core bundle): large KPI number with optional delta indicator (green up-arrow / red down-arrow). Model returns number or `{value, delta, label}`. Schema props: `label`, `prefix`, `suffix`, `precision`
16
+ - `alert` output type (zero-cost, core bundle): colored status banner with 4 variants (info/success/warning/error). Model returns string or `{message, type}`. Schema prop: `alertType`
17
+ - Graceful degradation: library-dependent output types show a helpful message with link when the library is not loaded, instead of crashing
18
+ - `columnsToRows()` utility for converting column-oriented to row-oriented data
19
+ - Schema-driven theming: `design.primary`, `design.secondary`, `design.bg`, `design.fg`, `design.font`, `design.radius` — set accent colors, background, text, font family, and border radius directly from the schema without custom CSS
20
+ - `jsee init` command: scaffold new projects with `jsee init` (minimal) or `jsee init chat` templates. Node generates `schema.json` + `model.js` + `README.md` (or `--html` for a single `index.html`). Python generates `schema.json` + `model.py` + `README.md`
21
+ - Server-side execution by default: when serving local `.js` models (no `-o` flag), JSEE now auto-enables server-side execution. Use `--client` to force browser execution
22
+ - Serve bar: a top bar shown only when serving (not in `-o` output) with server address, Browser/Server execution toggle, and Save HTML button. Consistent across Node and Python servers. Stripped when saving bundled HTML via Save or `download()`
23
+ - Python `create_app()`: WSGI factory function for production deployment with gunicorn, uWSGI, etc. Same target resolution as `serve()`. Routes: GET /, GET /api, GET /api/openapi.json, GET /static/jsee.js, static files, POST model endpoints
24
+ - CLI data inputs: pass data from the command line as positional args (`jsee schema.json 42 hello`) or named args (`jsee schema.json --a=100`). Values are auto-detected (numbers, JSON, file paths, strings). CLI-set inputs are locked in the GUI. Works in both Node and Python CLIs
25
+ - `folder` input type: directory browser with optional file selection checkboxes. In CLI, reads from a path; in browser, uses `<input webkitdirectory>` or drag-drop. Returns array of file objects. Schema props: `select`, `reactive`
26
+ - File/folder serving: `jsee report.pdf` or `jsee data/` serves files without a schema or model. Auto-detects output type from extension. Folders get a file browser with stats and preview
27
+ - Smart output auto-detection: model results are now type-inferred — image URLs render as `<img>`, PDF URLs as PDF viewer, arrays of objects as tables, etc. Works for both explicit outputs and auto-created outputs
28
+ - No-model identity: schemas with inputs but no model use an identity pipeline (pass inputs to outputs). Useful for file viewing and data inspection
29
+
30
+ ### Breaking changes:
31
+ - Drop `jsee.js` build (Vue template compiler). Only two bundles now: `jsee.core.js` and `jsee.full.js`. The `design.template` schema option is no longer supported — use the default render function instead
32
+ - All HTML files should update `<script src="/dist/jsee.js">` to `<script src="/dist/jsee.core.js">`
33
+
34
+ ## 0.7.1
35
+ ### Features:
36
+ - Per-input validation: `validate` (filtrex expression) and `required: true` with `error` message display; invalid inputs show red border + error text and block model execution
37
+ - Textarea autosize: `text` inputs auto-grow to fit content (up to 400px max-height), with manual resize still available
38
+ - `audio` output type: HTML5 `<audio>` player from URL or data URL
39
+ - `video` output type: HTML5 `<video>` player from URL or data URL
40
+
41
+ ## 0.7.0
42
+ ### Features:
43
+ - Input persistence: save/restore input values to `localStorage` across page refreshes (priority: URL params > localStorage > defaults; opt-out with `persist: false`; Reset clears storage)
44
+ - Notifications: `schema.notify: true` fires browser `Notification` when a run completes while the tab is hidden (permission requested on init)
45
+ - Streaming outputs (SSE): `model.stream: true` enables Server-Sent Events; POST handler reads `text/event-stream` responses with incremental `output()` calls per `data:` line
46
+ - Python SSE support: generator functions are auto-detected and served as `text/event-stream` with `data: {json}\n\n` framing; `stream=True` kwarg in `generate_schema()`/`serve()`
47
+ - Efficient binary outputs: large base64 image data URLs (>50KB) in `image` outputs are auto-converted to `URL.createObjectURL()` blob URLs (33% memory saving); previous blob URLs are revoked on update
48
+ - Typed array passing for WASM: `arrayBuffer: true` on inputs converts JS arrays to typed arrays (`dtype`: `float32`, `float64`, `uint8`, etc.) before worker/WASM dispatch; uses `postMessage` transferables for zero-copy transfer
49
+ - `collectTransferables()` utility for extracting `ArrayBuffer` references from nested payloads
50
+
51
+ ## 0.6.0
52
+ ### Features:
53
+ - Python: richer type introspection — `Literal` → select, `Enum` → select, `Annotated[T, jsee.Slider()]` → slider, `Optional` unwrapping, `datetime.date` → date picker, plus `Text`, `Radio`, `Select`, `MultiSelect`, `Range`, `Color` annotation descriptors
54
+ - Python: `serve()` keyword args — `title`, `description`, `examples`, `reactive`; auto-parses docstring for description
55
+ - Python: result serialization — tuple → list, bytes/PIL Image → base64 data URL, list-of-dicts → `{columns, rows}` table format, per-value serialization in dict results
56
+ - Python: output type declarations — `Annotated[str, jsee.Markdown()]` return types, `outputs` kwarg for `serve()`/`generate_schema()`, auto-detect `list` → table and `bytes` → image; output descriptors: `Markdown`, `Html`, `Code`, `Image`, `Table`, `Svg`, `File`
57
+ - Python: multipart/form-data file upload support in POST handler
58
+ - Node.js: result serialization parity — `serializeResult()` wraps primitives, converts Buffer/Uint8Array to base64 image
59
+ - Node.js: multipart/form-data POST support via `parseMultipart()` (zero new dependencies)
60
+ - Node.js: JSON 404 error for unknown model POST (was falling through to Express HTML 404)
61
+ - Chat interface: new `chat` output type with message accumulation, history injection, Markdown-rendered bubbles, auto-scroll, Enter-to-send; Python `serve(fn, chat=True)` shorthand for `fn(message, history) → str` pattern
62
+
63
+ ## 0.5.2
64
+ ### Features:
65
+ - Add `design.layout: 'sidebar'` option — fixed-width (280px) sticky input panel that stays visible while scrolling outputs, collapses to single column on mobile
66
+ - Add server API endpoints: `GET /api` (schema discovery), `GET /api/openapi.json` (auto-generated OpenAPI 3.1 spec), CORS support
67
+ - Fix async model execution in server-side mode (`--execute`)
68
+ - Move Python package into monorepo (`py/`): zero-dependency stdlib server with offline runtime, unified API surface matching Node.js
69
+
70
+ ## 0.5.1
71
+ ### Features:
72
+ - Add `style` property to `group` input type: `blocks` (default flat list), `accordion` (collapsible), `tabs` (tabbed view)
73
+ - Add `group` output type with `tabs` and `blocks` display styles for organizing outputs
74
+ - Unnamed top-level input groups now flatten child values into the top-level input object
75
+ ### Bug fixes:
76
+ - Fix crash when a top-level input has no `name` (e.g. layout-only group) — `getUrlParam` now guards against undefined names
77
+
78
+ ## 0.5.0
79
+ ### Breaking:
80
+ - Remove Bulma dependency — the minimal (framework-free) theme is now the default. `design.framework: 'bulma'` still works as a backward-compatible alias for `'minimal'`. Bundle size reduced by ~50% (224 KB removed)
81
+ ### Features:
82
+ - Add new input types: `slider`, `radio`, `toggle`, `date`, `multi-select`, `range` (dual-handle)
83
+ - Add `group` input type with collapsible accordion support (`collapsed: true`)
84
+ - Add `markdown` output type (renders Markdown via showdown, including tables)
85
+ - Add `image` output type (renders `<img>` from data URL or URL)
86
+ - Add `table` output type with virtualized scrolling
87
+ - Add CSS variable theming — all components use `--jsee-*` custom properties, overridable via `design.theme: 'dark'` or custom CSS
88
+ - Add progress bar to loading overlay (determinate and indeterminate modes)
89
+ ### Testing:
90
+ - Switch E2E tests from Puppeteer/Jest to Playwright
91
+ - Add E2E tests for all new input/output types, accordion groups, and dark theme
92
+
3
93
  ## 0.4.1
4
94
  ### Bug fixes:
5
95
  - Fix relative import URLs (e.g. `dist/core.js`) resolving against CDN instead of page URL — now resolves against `window.location.href` so blob workers can load them correctly
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-2026 Anton Zemlyansky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.