@viji-dev/core 0.14.0 → 0.15.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.
- package/dist/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global-p5.d.ts +3447 -1
- package/dist/artist-global.d.ts +3447 -1
- package/dist/artist-jsdoc.d.ts +2 -0
- package/dist/assets/viji.worker-A8uAea-6.js +608 -0
- package/dist/docs-api.js +44 -19
- package/dist/{essentia-wasm.web-0tQ5KtU1.js → essentia-wasm.web-BE_39Nld.js} +1 -1
- package/dist/{index-BYp7SdOD.js → index-CuQT5y06.js} +916 -519
- package/dist/index.d.ts +51 -3
- package/dist/index.js +1 -1
- package/package.json +117 -116
- package/dist/assets/viji.worker-ByIbGiBL.js +0 -587
package/dist/index.d.ts
CHANGED
|
@@ -249,7 +249,7 @@ declare interface ButtonParameter {
|
|
|
249
249
|
* The canvas rendering context a scene actually locked. Detected at runtime
|
|
250
250
|
* (authoritative) once the context is acquired. See {@link SceneData.contextType}.
|
|
251
251
|
*/
|
|
252
|
-
export declare type CanvasContextType = '2d' | 'webgl' | 'webgl2';
|
|
252
|
+
export declare type CanvasContextType = '2d' | 'webgl' | 'webgl2' | 'webgpu';
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
255
|
* An immediate edge in a capability's consumed-meaningfully state, delivered
|
|
@@ -1317,6 +1317,12 @@ export declare interface PerformanceStats {
|
|
|
1317
1317
|
resolution: Resolution;
|
|
1318
1318
|
scale: number;
|
|
1319
1319
|
frameRate: FrameRateInfo;
|
|
1320
|
+
/**
|
|
1321
|
+
* Worker spawn scheme the sandbox selected (see {@link WorkerSpawnScheme});
|
|
1322
|
+
* `undefined` until the worker is up. Mirrors `getSceneData().workerSpawn`
|
|
1323
|
+
* so support can read it from a stats snapshot alone.
|
|
1324
|
+
*/
|
|
1325
|
+
workerSpawn?: WorkerSpawnScheme;
|
|
1320
1326
|
cv?: {
|
|
1321
1327
|
activeFeatures: CVFeature[];
|
|
1322
1328
|
processingTime: number;
|
|
@@ -1593,11 +1599,17 @@ export declare interface SceneData {
|
|
|
1593
1599
|
p5CanvasMode?: P5CanvasMode;
|
|
1594
1600
|
/**
|
|
1595
1601
|
* The canvas context the scene actually locked (`'2d'` / `'webgl'` /
|
|
1596
|
-
* `'webgl2'`), detected at runtime. Present once the context locks (first
|
|
1602
|
+
* `'webgl2'` / `'webgpu'`), detected at runtime. Present once the context locks (first
|
|
1597
1603
|
* render); `undefined` before that. Authoritative — Core locks the context,
|
|
1598
1604
|
* so this is exact even for native scenes with dynamic `useContext`.
|
|
1599
1605
|
*/
|
|
1600
1606
|
contextType?: CanvasContextType;
|
|
1607
|
+
/**
|
|
1608
|
+
* Worker spawn scheme the sandbox selected for this core (see
|
|
1609
|
+
* {@link WorkerSpawnScheme}). Present once the worker is up; `undefined`
|
|
1610
|
+
* before initialization completes.
|
|
1611
|
+
*/
|
|
1612
|
+
workerSpawn?: WorkerSpawnScheme;
|
|
1601
1613
|
/** Capabilities the scene's code declares it uses (inclusive-biased). */
|
|
1602
1614
|
capabilities: SceneCapabilities;
|
|
1603
1615
|
/** Total number of parameters the scene defines. */
|
|
@@ -2308,7 +2320,7 @@ declare interface TouchPoint {
|
|
|
2308
2320
|
/** Returned by `on*` listener registration calls; invoke to unsubscribe. */
|
|
2309
2321
|
export declare type Unsubscribe = () => void;
|
|
2310
2322
|
|
|
2311
|
-
export declare const VERSION = "0.
|
|
2323
|
+
export declare const VERSION = "0.15.0";
|
|
2312
2324
|
|
|
2313
2325
|
/**
|
|
2314
2326
|
* Real-time video API: drawable frame, dimensions, and the source-side
|
|
@@ -2506,6 +2518,8 @@ export declare interface VijiAPI {
|
|
|
2506
2518
|
ctx?: OffscreenCanvasRenderingContext2D;
|
|
2507
2519
|
/** WebGL rendering context. `undefined` until `viji.useContext('webgl')` or `'webgl2'` is called; afterwards equals the cached context. */
|
|
2508
2520
|
gl?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
2521
|
+
/** WebGPU canvas context. `undefined` until `viji.useContext('webgpu')` (or a direct `viji.canvas.getContext('webgpu')`) succeeds; afterwards equals the acquired context. Stays `undefined` on browsers without WebGPU support. */
|
|
2522
|
+
gpu?: GPUCanvasContext;
|
|
2509
2523
|
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
2510
2524
|
width: number;
|
|
2511
2525
|
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
@@ -2646,6 +2660,28 @@ export declare interface VijiAPI {
|
|
|
2646
2660
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
2647
2661
|
*/
|
|
2648
2662
|
useContext(type: 'webgl2'): WebGL2RenderingContext | null;
|
|
2663
|
+
/**
|
|
2664
|
+
* Selects a WebGPU canvas context. Returns the raw `GPUCanvasContext` and
|
|
2665
|
+
* also stores it on `viji.gpu`. Adapter and device acquisition stay in scene
|
|
2666
|
+
* code (`navigator.gpu` is available; top-level `await` works), and the
|
|
2667
|
+
* scene must call `configure()` on the context before rendering. A canvas
|
|
2668
|
+
* only supports one context type. Returns `null` when a different context
|
|
2669
|
+
* type was already requested OR when the browser has no WebGPU support,
|
|
2670
|
+
* so always guard and provide a fallback. Choose ONE type and use it for
|
|
2671
|
+
* the entire scene.
|
|
2672
|
+
*
|
|
2673
|
+
* @example
|
|
2674
|
+
* const gctx = viji.useContext('webgpu');
|
|
2675
|
+
* if (!navigator.gpu || !gctx) {
|
|
2676
|
+
* // fall back, e.g. render a message via a 2d scene variant
|
|
2677
|
+
* } else {
|
|
2678
|
+
* const adapter = await navigator.gpu.requestAdapter();
|
|
2679
|
+
* const device = await adapter.requestDevice();
|
|
2680
|
+
* const format = navigator.gpu.getPreferredCanvasFormat();
|
|
2681
|
+
* gctx.configure({ device, format, alphaMode: 'opaque' });
|
|
2682
|
+
* }
|
|
2683
|
+
*/
|
|
2684
|
+
useContext(type: 'webgpu'): GPUCanvasContext | null;
|
|
2649
2685
|
}
|
|
2650
2686
|
|
|
2651
2687
|
/**
|
|
@@ -2690,6 +2726,8 @@ export declare class VijiCore {
|
|
|
2690
2726
|
private sceneP5CanvasMode?;
|
|
2691
2727
|
private sceneConsumesAnalysedFrame;
|
|
2692
2728
|
private sceneContextType?;
|
|
2729
|
+
/** Worker spawn scheme the sandbox selected; set once the worker is up. */
|
|
2730
|
+
private sceneWorkerSpawn?;
|
|
2693
2731
|
private parametersInitialized;
|
|
2694
2732
|
private isAwaitingSceneAnalysis;
|
|
2695
2733
|
private analysisWindowSceneError;
|
|
@@ -3940,4 +3978,14 @@ export declare class VijiCoreError extends Error {
|
|
|
3940
3978
|
constructor(message: string, code: string, context?: any | undefined);
|
|
3941
3979
|
}
|
|
3942
3980
|
|
|
3981
|
+
/**
|
|
3982
|
+
* Worker spawn scheme selected by the iframe's capability probe: `'blob'`
|
|
3983
|
+
* where a blob worker inside the sandbox is already a secure context
|
|
3984
|
+
* (Firefox, Safari), `'data'` where it is not (Chromium), in which case the
|
|
3985
|
+
* worker is spawned from a data: stub so scene code gains `[SecureContext]`
|
|
3986
|
+
* APIs such as WebGPU. Diagnostic; surfaced in `getSceneData()` and
|
|
3987
|
+
* `getStats()`.
|
|
3988
|
+
*/
|
|
3989
|
+
export declare type WorkerSpawnScheme = 'blob' | 'data';
|
|
3990
|
+
|
|
3943
3991
|
export { }
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,116 +1,117 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@viji-dev/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Universal execution engine for Viji Creative scenes",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"main": "./dist/index.js",
|
|
8
|
-
"module": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"import": "./dist/index.js",
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
14
|
-
},
|
|
15
|
-
"./scene-analysis": {
|
|
16
|
-
"import": "./dist/scene-analysis.js",
|
|
17
|
-
"types": "./dist/scene-analysis.d.ts"
|
|
18
|
-
},
|
|
19
|
-
"./param-inference": {
|
|
20
|
-
"import": "./dist/param-inference.js",
|
|
21
|
-
"types": "./dist/param-inference.d.ts"
|
|
22
|
-
},
|
|
23
|
-
"./package.json": "./package.json",
|
|
24
|
-
"./artist-global": {
|
|
25
|
-
"types": "./dist/artist-global.d.ts"
|
|
26
|
-
},
|
|
27
|
-
"./artist-dts": {
|
|
28
|
-
"import": "./dist/artist-dts.js",
|
|
29
|
-
"types": "./dist/artist-dts.d.ts"
|
|
30
|
-
},
|
|
31
|
-
"./artist-jsdoc": {
|
|
32
|
-
"types": "./dist/artist-jsdoc.d.ts"
|
|
33
|
-
},
|
|
34
|
-
"./artist-js-ambient": {
|
|
35
|
-
"types": "./dist/artist-js-ambient.d.ts"
|
|
36
|
-
},
|
|
37
|
-
"./artist-dts-p5": {
|
|
38
|
-
"import": "./dist/artist-dts-p5.js",
|
|
39
|
-
"types": "./dist/artist-dts-p5.d.ts"
|
|
40
|
-
},
|
|
41
|
-
"./artist-global-p5": {
|
|
42
|
-
"types": "./dist/artist-global-p5.d.ts"
|
|
43
|
-
},
|
|
44
|
-
"./shader-uniforms": {
|
|
45
|
-
"import": "./dist/shader-uniforms.js",
|
|
46
|
-
"types": "./dist/shader-uniforms.d.ts"
|
|
47
|
-
},
|
|
48
|
-
"./docs-api": {
|
|
49
|
-
"import": "./dist/docs-api.js",
|
|
50
|
-
"types": "./dist/docs-api.d.ts"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"files": [
|
|
54
|
-
"dist/*.js",
|
|
55
|
-
"dist/*.d.ts",
|
|
56
|
-
"dist/assets",
|
|
57
|
-
"!dist/**/*.map",
|
|
58
|
-
"README.md"
|
|
59
|
-
],
|
|
60
|
-
"scripts": {
|
|
61
|
-
"audio-lab": "vite --config audio-lab/vite.config.mjs",
|
|
62
|
-
"prebuild": "node scripts/prebuild-clean.mjs && node scripts/sync-version.mjs",
|
|
63
|
-
"version": "npm run build && git add -A",
|
|
64
|
-
"build": "vite build && node scripts/copy-tasks-assets.mjs && node scripts/minify-dist.mjs && node scripts/build-artist-types.mjs && node scripts/lint-artist-types-drift.mjs && node scripts/build-docs-api.mjs",
|
|
65
|
-
"build:docs": "node scripts/build-docs-api.mjs",
|
|
66
|
-
"lint:ai-prompts-drift": "node scripts/lint-ai-prompts-drift.mjs",
|
|
67
|
-
"dev": "node scripts/sync-version.mjs && vite build --watch",
|
|
68
|
-
"integration": "vite --config integration-example/vite.config.ts",
|
|
69
|
-
"test": "vitest",
|
|
70
|
-
"test:run": "vitest run",
|
|
71
|
-
"test:coverage": "vitest --coverage",
|
|
72
|
-
"type-check": "tsc --noEmit",
|
|
73
|
-
"lint": "eslint src --ext .ts"
|
|
74
|
-
},
|
|
75
|
-
"keywords": [
|
|
76
|
-
"viji",
|
|
77
|
-
"creative",
|
|
78
|
-
"webgl",
|
|
79
|
-
"audio-reactive",
|
|
80
|
-
"canvas",
|
|
81
|
-
"webworker"
|
|
82
|
-
],
|
|
83
|
-
"author": "Viji Team",
|
|
84
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
85
|
-
"devDependencies": {
|
|
86
|
-
"@types/node": "^20.0.0",
|
|
87
|
-
"@types/p5": "^1.7.6",
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
89
|
-
"@typescript-eslint/parser": "^6.0.0",
|
|
90
|
-
"@vitest/coverage-v8": "^1.0.0",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"vite
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"@
|
|
109
|
-
"@noble/
|
|
110
|
-
"@noble/
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@viji-dev/core",
|
|
3
|
+
"version": "0.15.0",
|
|
4
|
+
"description": "Universal execution engine for Viji Creative scenes",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./scene-analysis": {
|
|
16
|
+
"import": "./dist/scene-analysis.js",
|
|
17
|
+
"types": "./dist/scene-analysis.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./param-inference": {
|
|
20
|
+
"import": "./dist/param-inference.js",
|
|
21
|
+
"types": "./dist/param-inference.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
"./artist-global": {
|
|
25
|
+
"types": "./dist/artist-global.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./artist-dts": {
|
|
28
|
+
"import": "./dist/artist-dts.js",
|
|
29
|
+
"types": "./dist/artist-dts.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./artist-jsdoc": {
|
|
32
|
+
"types": "./dist/artist-jsdoc.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./artist-js-ambient": {
|
|
35
|
+
"types": "./dist/artist-js-ambient.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./artist-dts-p5": {
|
|
38
|
+
"import": "./dist/artist-dts-p5.js",
|
|
39
|
+
"types": "./dist/artist-dts-p5.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./artist-global-p5": {
|
|
42
|
+
"types": "./dist/artist-global-p5.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./shader-uniforms": {
|
|
45
|
+
"import": "./dist/shader-uniforms.js",
|
|
46
|
+
"types": "./dist/shader-uniforms.d.ts"
|
|
47
|
+
},
|
|
48
|
+
"./docs-api": {
|
|
49
|
+
"import": "./dist/docs-api.js",
|
|
50
|
+
"types": "./dist/docs-api.d.ts"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist/*.js",
|
|
55
|
+
"dist/*.d.ts",
|
|
56
|
+
"dist/assets",
|
|
57
|
+
"!dist/**/*.map",
|
|
58
|
+
"README.md"
|
|
59
|
+
],
|
|
60
|
+
"scripts": {
|
|
61
|
+
"audio-lab": "vite --config audio-lab/vite.config.mjs",
|
|
62
|
+
"prebuild": "node scripts/prebuild-clean.mjs && node scripts/sync-version.mjs",
|
|
63
|
+
"version": "npm run build && git add -A",
|
|
64
|
+
"build": "vite build && node scripts/copy-tasks-assets.mjs && node scripts/minify-dist.mjs && node scripts/build-artist-types.mjs && node scripts/lint-artist-types-drift.mjs && node scripts/build-docs-api.mjs",
|
|
65
|
+
"build:docs": "node scripts/build-docs-api.mjs",
|
|
66
|
+
"lint:ai-prompts-drift": "node scripts/lint-ai-prompts-drift.mjs",
|
|
67
|
+
"dev": "node scripts/sync-version.mjs && vite build --watch",
|
|
68
|
+
"integration": "vite --config integration-example/vite.config.ts",
|
|
69
|
+
"test": "vitest",
|
|
70
|
+
"test:run": "vitest run",
|
|
71
|
+
"test:coverage": "vitest --coverage",
|
|
72
|
+
"type-check": "tsc --noEmit",
|
|
73
|
+
"lint": "eslint src --ext .ts"
|
|
74
|
+
},
|
|
75
|
+
"keywords": [
|
|
76
|
+
"viji",
|
|
77
|
+
"creative",
|
|
78
|
+
"webgl",
|
|
79
|
+
"audio-reactive",
|
|
80
|
+
"canvas",
|
|
81
|
+
"webworker"
|
|
82
|
+
],
|
|
83
|
+
"author": "Viji Team",
|
|
84
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@types/node": "^20.0.0",
|
|
87
|
+
"@types/p5": "^1.7.6",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
89
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
90
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
91
|
+
"@webgpu/types": "0.1.72",
|
|
92
|
+
"dts-bundle-generator": "^9.5.1",
|
|
93
|
+
"eslint": "^8.0.0",
|
|
94
|
+
"github-slugger": "^2.0.0",
|
|
95
|
+
"happy-dom": "^18.0.1",
|
|
96
|
+
"mdast-util-to-string": "^4.0.0",
|
|
97
|
+
"remark-parse": "^11.0.0",
|
|
98
|
+
"typescript": "^5.0.0",
|
|
99
|
+
"unified": "^11.0.5",
|
|
100
|
+
"vite": "^5.0.0",
|
|
101
|
+
"vite-plugin-dts": "^3.0.0",
|
|
102
|
+
"vitest": "^1.0.0"
|
|
103
|
+
},
|
|
104
|
+
"engines": {
|
|
105
|
+
"node": ">=18.0.0"
|
|
106
|
+
},
|
|
107
|
+
"dependencies": {
|
|
108
|
+
"@mediapipe/tasks-vision": "^0.10.20",
|
|
109
|
+
"@noble/ciphers": "2.3.0",
|
|
110
|
+
"@noble/curves": "^2.2.0",
|
|
111
|
+
"@noble/hashes": "2.2.0",
|
|
112
|
+
"acorn": "8.15.0",
|
|
113
|
+
"essentia.js": "^0.1.3",
|
|
114
|
+
"fft.js": "^4.0.4",
|
|
115
|
+
"sucrase": "^3.35.1"
|
|
116
|
+
}
|
|
117
|
+
}
|