@viji-dev/sdk 1.0.0 → 1.0.2

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 (77) hide show
  1. package/README.md +70 -63
  2. package/bin/viji.js +9 -29
  3. package/dist/assets/artist-dts-BHUsvSI6.js +613 -0
  4. package/dist/assets/artist-dts-p5-Cyw8vmy_.js +736 -0
  5. package/dist/assets/core-CiQx3w0t.js +12 -0
  6. package/dist/assets/dark-plus-C3mMm8J8.js +1 -0
  7. package/dist/assets/docs-api-PBLtY4Ni.js +12381 -0
  8. package/dist/assets/engine-javascript-CXyY7cc8.js +141 -0
  9. package/dist/assets/essentia-wasm.web-0S-sW98u-CYV1l1zv.js +38 -0
  10. package/dist/assets/essentia.js-core.es-DnrJE0uR-DOSrF5_G.js +32 -0
  11. package/dist/assets/glsl-DMyvO4G4.js +1 -0
  12. package/dist/assets/index-BhFxsauQ.js +215 -0
  13. package/dist/assets/index-BqhVeA7U.css +1 -0
  14. package/dist/assets/index-T4TOjvD0.js +1 -0
  15. package/dist/assets/index-Wz9WqGqz.js +52 -0
  16. package/dist/assets/index-t24aGwla.js +1 -0
  17. package/dist/assets/javascript-wDzz0qaB.js +1 -0
  18. package/dist/assets/shader-uniforms-GdaUkQPK.js +1 -0
  19. package/dist/assets/typescript-BPQ3VLAy.js +1 -0
  20. package/dist/assets/viji.worker-CQSJ0SiO-ljtBlcNZ.js +27018 -0
  21. package/{index.html → dist/index.html} +2 -1
  22. package/package.json +31 -35
  23. package/src/cli/commands/build.js +50 -99
  24. package/src/cli/commands/create.js +49 -46
  25. package/src/cli/commands/dev.js +30 -97
  26. package/src/cli/server/dev-server.js +233 -0
  27. package/src/cli/server/scene-scanner.js +93 -0
  28. package/src/cli/server/vite-scene-plugin.d.ts +2 -0
  29. package/src/cli/server/vite-scene-plugin.js +134 -0
  30. package/src/cli/utils/cli-utils.js +29 -139
  31. package/src/cli/utils/scene-compiler.js +10 -17
  32. package/src/templates/scene-templates.js +85 -0
  33. package/.gitignore +0 -29
  34. package/eslint.config.js +0 -37
  35. package/postcss.config.js +0 -6
  36. package/scenes/audio-visualizer/main.js +0 -287
  37. package/scenes/core-demo/main.js +0 -532
  38. package/scenes/demo-scene/main.js +0 -619
  39. package/scenes/global.d.ts +0 -15
  40. package/scenes/particle-system/main.js +0 -349
  41. package/scenes/tsconfig.json +0 -12
  42. package/scenes/video-mirror/main.ts +0 -436
  43. package/src/App.css +0 -42
  44. package/src/App.tsx +0 -279
  45. package/src/cli/commands/init.js +0 -262
  46. package/src/components/SDKPage.tsx +0 -337
  47. package/src/components/core/CoreContainer.tsx +0 -126
  48. package/src/components/ui/DeviceSelectionList.tsx +0 -137
  49. package/src/components/ui/FPSCounter.tsx +0 -78
  50. package/src/components/ui/FileDropzonePanel.tsx +0 -120
  51. package/src/components/ui/FileListPanel.tsx +0 -285
  52. package/src/components/ui/InputExpansionPanel.tsx +0 -31
  53. package/src/components/ui/MediaPlayerControls.tsx +0 -191
  54. package/src/components/ui/MenuContainer.tsx +0 -71
  55. package/src/components/ui/ParametersMenu.tsx +0 -797
  56. package/src/components/ui/ProjectSwitcherMenu.tsx +0 -192
  57. package/src/components/ui/QuickInputControls.tsx +0 -542
  58. package/src/components/ui/SDKMenuSystem.tsx +0 -96
  59. package/src/components/ui/SettingsMenu.tsx +0 -346
  60. package/src/components/ui/SimpleInputControls.tsx +0 -137
  61. package/src/index.css +0 -68
  62. package/src/main.tsx +0 -10
  63. package/src/scenes-hmr.ts +0 -158
  64. package/src/services/project-filesystem.ts +0 -436
  65. package/src/stores/scene-player/index.ts +0 -3
  66. package/src/stores/scene-player/input-manager.store.ts +0 -1045
  67. package/src/stores/scene-player/scene-session.store.ts +0 -659
  68. package/src/styles/globals.css +0 -111
  69. package/src/templates/minimal-template.js +0 -11
  70. package/src/utils/debounce.js +0 -34
  71. package/src/vite-env.d.ts +0 -1
  72. package/tailwind.config.js +0 -18
  73. package/tsconfig.app.json +0 -27
  74. package/tsconfig.json +0 -27
  75. package/tsconfig.node.json +0 -27
  76. package/vite.config.ts +0 -54
  77. /package/{public → dist}/favicon.png +0 -0
package/README.md CHANGED
@@ -1,103 +1,110 @@
1
1
  # Viji SDK
2
2
 
3
- Professional toolkit for creating interactive Viji scenes. Includes a CLI, workspace management, local development UI (Vite-based), and a production build pipeline that outputs a single deployable `scene.js`. Uses `@viji-dev/core` under the hood.
3
+ Development environment for [Viji Creative](https://viji.art) scenes. Write scene code in your IDE, preview it live in the browser with real-time parameter controls, audio analysis, video input, and interaction handling the same execution environment as the Viji platform. Supports Canvas 2D, WebGL, P5.js, and GLSL shaders.
4
4
 
5
5
  ## Installation
6
6
 
7
+ Requires [Node.js](https://nodejs.org/) v18 or later.
8
+
7
9
  ```bash
8
10
  npm install -g @viji-dev/sdk
9
11
  ```
10
12
 
13
+ To update to the latest version:
14
+
15
+ ```bash
16
+ npm update -g @viji-dev/sdk
17
+ ```
18
+
11
19
  ## Quick Start
12
20
 
13
21
  ```bash
14
- # Create a new workspace
15
- mkdir my-viji-workspace
16
- cd my-viji-workspace
17
- viji init .
22
+ # Create a workspace folder (any name works)
23
+ mkdir my-viji-scenes && cd my-viji-scenes
18
24
 
19
- # Create your first scene
20
- viji create my-scene --lang=ts
25
+ # Create your first scene (native renderer is the default)
26
+ viji create my-scene
21
27
 
22
- # Start development server
28
+ # Start the development server
23
29
  viji dev
24
30
  ```
25
31
 
26
- ## CLI Commands
32
+ Open `http://localhost:3000` in your browser to see the SDK UI. Edit `scenes/my-scene/main.js` in your IDE — changes appear in real time.
27
33
 
28
- ### `viji init [workspace-name]`
29
- Initialize a new Viji workspace with complete development environment.
30
- - Use `viji init .` to initialize in current directory
31
- - Use `viji init my-workspace` to create new directory
34
+ ## CLI Commands
32
35
 
33
- ### `viji create <scene-name> [--lang=js|ts]`
34
- Create a new scene in the current workspace.
35
- - Must be run inside a Viji workspace
36
- - Creates scene in `scenes/<scene-name>/` folder
36
+ ### `viji create <scene-name> [--renderer <type>]`
37
37
 
38
- ### `viji dev [--port=5173] [--host=localhost] [--open]`
39
- Start development server with hot reload.
40
- - Must be run inside a Viji workspace
41
- - Opens browser-based development UI
38
+ Create a new scene in the `scenes/` folder.
42
39
 
43
- ### `viji build <scene-name> [--output=dist/scene.js]`
44
- Build a scene for platform deployment.
45
- - Compiles multi-file project to single JS file
46
- - Ready for copy-paste to Viji platform
40
+ - `viji create my-scene` — native renderer (Canvas 2D / WebGL), the default
41
+ - `viji create my-scene --renderer p5` — P5.js renderer
42
+ - `viji create my-scene --renderer shader` GLSL fragment shader
47
43
 
48
- ## Workspace Structure
44
+ Creates the following structure:
49
45
 
50
46
  ```
51
- my-workspace/
52
- ├── src/ # Development UI (React + Vite)
53
- ├── scenes/ # Your scenes
54
- │ ├── my-scene/
55
- │ │ └── main.ts # Scene entry point
56
- │ └── another-scene/
57
- ├── vite.config.ts # Vite configuration
58
- ├── package.json # Dependencies
59
- └── ... # TypeScript configs, etc.
47
+ scenes/
48
+ └── my-scene/
49
+ └── main.js # or main.glsl for shader scenes
50
+ global.d.ts # generated once for IDE type support
60
51
  ```
61
52
 
62
- ## Scene Development
53
+ ### `viji dev [--port <port>] [--host <host>] [--open]`
54
+
55
+ Start the development server with live reload.
56
+
57
+ | Option | Default | Description |
58
+ |--------|---------|-------------|
59
+ | `--port` | `3000` | Server port |
60
+ | `--host` | `localhost` | Server host |
61
+ | `--open` | `false` | Open browser automatically |
63
62
 
64
- Each scene is a folder in `scenes/` with a `main.js` or `main.ts` entry point:
63
+ The server watches the `scenes/` directory for changes and pushes updates to the browser UI in real time via WebSocket.
65
64
 
66
- ```typescript
67
- // scenes/my-scene/main.ts
68
- export const parameters = [
69
- // Parameter definitions
70
- ];
65
+ ### `viji build <scene-name> [-o <file>]`
71
66
 
72
- export function init(canvas: HTMLCanvasElement, audioContext: AudioContext) {
73
- // Initialization code
74
- }
67
+ Bundle a scene into a single file for deployment to the Viji platform.
75
68
 
76
- export function render(state: any, inputs: any, params: any) {
77
- // Main render loop
78
- }
69
+ ```bash
70
+ viji build my-scene # outputs dist/my-scene.js
71
+ viji build my-scene -o bundle/output.js # custom output path
79
72
  ```
80
73
 
81
- ## Features
74
+ Multi-file scenes (with local imports) are resolved and concatenated automatically.
75
+
76
+ ## Writing Scenes
77
+
78
+ The SDK includes built-in documentation for the Viji scene API, parameter system, renderers, audio/video analysis, and interaction handling.
79
+
80
+ Start the development server and open the docs panel from the toolbar, or navigate directly to `http://localhost:3000/docs`.
82
81
 
83
- - **🎨 Complete Development Environment**: Full React UI for scene development
84
- - **🔥 Hot Reload**: Instant updates when you save scene files
85
- - **📁 Workspace Management**: Organize multiple scenes in one project
86
- - **🛠️ TypeScript Support**: Full type safety and IDE integration
87
- - **📦 Single-File Build**: Compile to platform-ready scene.js
88
- - **🎯 Platform Compatible**: Uses same Core runtime as Viji platform
82
+ The documentation includes live code playgrounds where you can experiment with the API directly in the browser.
89
83
 
90
- ## Documentation
84
+ ## Project Structure
85
+
86
+ After creating a few scenes, your workspace looks like this:
87
+
88
+ ```
89
+ my-viji-scenes/
90
+ ├── scenes/
91
+ │ ├── my-scene/
92
+ │ │ └── main.js
93
+ │ ├── shader-demo/
94
+ │ │ └── main.glsl
95
+ │ └── p5-sketch/
96
+ │ └── main.js
97
+ └── global.d.ts # IDE type support (auto-generated)
98
+ ```
91
99
 
92
- - SDK package: `docs/02-sdk-package.md`
93
- - Implementation guide: `docs/06-cursor-implementation-guide.md`
100
+ No configuration files, no `node_modules`, no build tools in your workspace. Everything is handled by the globally installed SDK.
94
101
 
95
- ## 📄 License
102
+ ## License
96
103
 
97
- Copyright (c) 2025 Artem Verkhovskiy and Dmitry Manoilenko.
98
- All rights reserved - see the LICENSE file for details.
104
+ Copyright (c) 2025 Artem Verkhovskiy and Dmitry Manoilenko.
105
+ All rights reserved see the LICENSE file for details.
99
106
 
100
107
  ## Contributor License Agreement
101
108
 
102
- By contributing, you agree to the [CLA](./CLA.md).
103
- Please also confirm your agreement by filling out this short [form](https://forms.gle/A49WTz8nj5b99Yev7).
109
+ By contributing, you agree to the [CLA](./CLA.md).
110
+ Please also confirm your agreement by filling out this short [form](https://forms.gle/A49WTz8nj5b99Yev7).
package/bin/viji.js CHANGED
@@ -1,22 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- /**
4
- * Viji SDK Command Line Interface
5
- * Professional toolkit for creating interactive Viji scenes
6
- */
7
-
8
3
  import { createRequire } from 'module';
9
4
  const require = createRequire(import.meta.url);
10
5
  const { program } = require('commander');
11
6
  import { createCommand } from '../src/cli/commands/create.js';
12
7
  import { devCommand } from '../src/cli/commands/dev.js';
13
8
  import { buildCommand } from '../src/cli/commands/build.js';
14
- import { initCommand } from '../src/cli/commands/init.js';
15
9
  import { fileURLToPath } from 'url';
16
10
  import { dirname, join } from 'path';
17
11
  import { readFileSync } from 'fs';
18
12
 
19
- // Get package.json version
20
13
  const __filename = fileURLToPath(import.meta.url);
21
14
  const __dirname = dirname(__filename);
22
15
  const packagePath = join(__dirname, '..', 'package.json');
@@ -24,52 +17,39 @@ const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
24
17
 
25
18
  program
26
19
  .name('viji')
27
- .description('🎨 Viji SDK - Professional toolkit for creating interactive scenes')
20
+ .description('Viji SDK - Professional toolkit for creating interactive scenes')
28
21
  .version(packageJson.version);
29
22
 
30
- // Command: Initialize new workspace
31
- program
32
- .command('init')
33
- .argument('[workspace-name]', 'Name of the workspace (use "." for current directory)', '.')
34
- .description('Initialize a new Viji workspace')
35
- .action(initCommand);
36
-
37
- // Command: Create new scene
38
23
  program
39
24
  .command('create')
40
25
  .argument('<scene-name>', 'Name of the new scene')
41
- .option('--lang <lang>', 'Scene language (js|ts)', 'js')
26
+ .option('--renderer <type>', 'Renderer type (native|p5|shader)', 'native')
42
27
  .description('Create a new scene in the current workspace')
43
28
  .action(createCommand);
44
29
 
45
- // Command: Start development server
46
30
  program
47
31
  .command('dev')
48
- .option('-p, --port <port>', 'Development server port', '5173')
49
- .option('-h, --host <host>', 'Development server host', 'localhost')
32
+ .option('-p, --port <port>', 'Development server port', '3000')
33
+ .option('--host <host>', 'Development server host', 'localhost')
50
34
  .option('--open', 'Open browser automatically', false)
51
- .description('Start development server with hot reload')
35
+ .description('Start development server with live reload')
52
36
  .action(devCommand);
53
37
 
54
- // Command: Build for production
55
38
  program
56
39
  .command('build')
57
40
  .argument('<scene-name>', 'Name of the scene to build')
58
- .option('-o, --output <file>', 'Output file path', 'dist/scene.js')
59
- .description('Build scene: bundle multi-file projects into one, no minify')
41
+ .option('-o, --output <file>', 'Output file path')
42
+ .description('Build scene: bundle multi-file projects into one')
60
43
  .action(buildCommand);
61
44
 
62
-
63
- // Global error handling
64
45
  process.on('uncaughtException', (error) => {
65
- console.error('💥 Unexpected error:', error.message);
46
+ console.error('Unexpected error:', error.message);
66
47
  process.exit(1);
67
48
  });
68
49
 
69
50
  process.on('unhandledRejection', (reason) => {
70
- console.error('💥 Unhandled promise rejection:', reason);
51
+ console.error('Unhandled promise rejection:', reason);
71
52
  process.exit(1);
72
53
  });
73
54
 
74
- // Parse and execute
75
55
  program.parse();