@viji-dev/core 0.14.0 → 0.16.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 +3453 -2
- package/dist/artist-global.d.ts +3453 -2
- package/dist/artist-jsdoc.d.ts +2 -0
- package/dist/assets/viji.worker-Dm3yyu15.js +612 -0
- package/dist/docs-api.js +51 -21
- package/dist/{essentia-wasm.web-0tQ5KtU1.js → essentia-wasm.web-0ZL6uVXZ.js} +1 -1
- package/dist/{index-BYp7SdOD.js → index-dImdtnwN.js} +920 -520
- package/dist/index.d.ts +63 -4
- 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
|
|
@@ -277,7 +277,12 @@ export declare interface CapabilityTransition {
|
|
|
277
277
|
export declare interface CaptureFrameOptions {
|
|
278
278
|
/** Output format: `'blob'` for an encoded image, `'bitmap'` for a GPU-friendly `ImageBitmap`. Default: `'blob'`. */
|
|
279
279
|
format?: 'blob' | 'bitmap';
|
|
280
|
-
/**
|
|
280
|
+
/**
|
|
281
|
+
* MIME type for `'blob'` output (ignored for `'bitmap'`). Examples:
|
|
282
|
+
* `'image/png'`, `'image/jpeg'`, `'image/webp'`. Default: `'image/png'`
|
|
283
|
+
* (lossless, preserves alpha). Pass a lossy type for smaller files when
|
|
284
|
+
* transparency does not matter.
|
|
285
|
+
*/
|
|
281
286
|
type?: string;
|
|
282
287
|
/**
|
|
283
288
|
* Encoding quality for lossy `'blob'` formats (`'image/jpeg'`, `'image/webp'`),
|
|
@@ -1317,6 +1322,12 @@ export declare interface PerformanceStats {
|
|
|
1317
1322
|
resolution: Resolution;
|
|
1318
1323
|
scale: number;
|
|
1319
1324
|
frameRate: FrameRateInfo;
|
|
1325
|
+
/**
|
|
1326
|
+
* Worker spawn scheme the sandbox selected (see {@link WorkerSpawnScheme});
|
|
1327
|
+
* `undefined` until the worker is up. Mirrors `getSceneData().workerSpawn`
|
|
1328
|
+
* so support can read it from a stats snapshot alone.
|
|
1329
|
+
*/
|
|
1330
|
+
workerSpawn?: WorkerSpawnScheme;
|
|
1320
1331
|
cv?: {
|
|
1321
1332
|
activeFeatures: CVFeature[];
|
|
1322
1333
|
processingTime: number;
|
|
@@ -1593,11 +1604,17 @@ export declare interface SceneData {
|
|
|
1593
1604
|
p5CanvasMode?: P5CanvasMode;
|
|
1594
1605
|
/**
|
|
1595
1606
|
* The canvas context the scene actually locked (`'2d'` / `'webgl'` /
|
|
1596
|
-
* `'webgl2'`), detected at runtime. Present once the context locks (first
|
|
1607
|
+
* `'webgl2'` / `'webgpu'`), detected at runtime. Present once the context locks (first
|
|
1597
1608
|
* render); `undefined` before that. Authoritative — Core locks the context,
|
|
1598
1609
|
* so this is exact even for native scenes with dynamic `useContext`.
|
|
1599
1610
|
*/
|
|
1600
1611
|
contextType?: CanvasContextType;
|
|
1612
|
+
/**
|
|
1613
|
+
* Worker spawn scheme the sandbox selected for this core (see
|
|
1614
|
+
* {@link WorkerSpawnScheme}). Present once the worker is up; `undefined`
|
|
1615
|
+
* before initialization completes.
|
|
1616
|
+
*/
|
|
1617
|
+
workerSpawn?: WorkerSpawnScheme;
|
|
1601
1618
|
/** Capabilities the scene's code declares it uses (inclusive-biased). */
|
|
1602
1619
|
capabilities: SceneCapabilities;
|
|
1603
1620
|
/** Total number of parameters the scene defines. */
|
|
@@ -2308,7 +2325,7 @@ declare interface TouchPoint {
|
|
|
2308
2325
|
/** Returned by `on*` listener registration calls; invoke to unsubscribe. */
|
|
2309
2326
|
export declare type Unsubscribe = () => void;
|
|
2310
2327
|
|
|
2311
|
-
export declare const VERSION = "0.
|
|
2328
|
+
export declare const VERSION = "0.16.0";
|
|
2312
2329
|
|
|
2313
2330
|
/**
|
|
2314
2331
|
* Real-time video API: drawable frame, dimensions, and the source-side
|
|
@@ -2506,6 +2523,8 @@ export declare interface VijiAPI {
|
|
|
2506
2523
|
ctx?: OffscreenCanvasRenderingContext2D;
|
|
2507
2524
|
/** WebGL rendering context. `undefined` until `viji.useContext('webgl')` or `'webgl2'` is called; afterwards equals the cached context. */
|
|
2508
2525
|
gl?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
2526
|
+
/** 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. */
|
|
2527
|
+
gpu?: GPUCanvasContext;
|
|
2509
2528
|
/** Current canvas width in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
2510
2529
|
width: number;
|
|
2511
2530
|
/** Current canvas height in pixels. Updates automatically when the host resizes the canvas; read every frame. */
|
|
@@ -2646,6 +2665,28 @@ export declare interface VijiAPI {
|
|
|
2646
2665
|
* `null`. Choose ONE type and use it for the entire scene.
|
|
2647
2666
|
*/
|
|
2648
2667
|
useContext(type: 'webgl2'): WebGL2RenderingContext | null;
|
|
2668
|
+
/**
|
|
2669
|
+
* Selects a WebGPU canvas context. Returns the raw `GPUCanvasContext` and
|
|
2670
|
+
* also stores it on `viji.gpu`. Adapter and device acquisition stay in scene
|
|
2671
|
+
* code (`navigator.gpu` is available; top-level `await` works), and the
|
|
2672
|
+
* scene must call `configure()` on the context before rendering. A canvas
|
|
2673
|
+
* only supports one context type. Returns `null` when a different context
|
|
2674
|
+
* type was already requested OR when the browser has no WebGPU support,
|
|
2675
|
+
* so always guard and provide a fallback. Choose ONE type and use it for
|
|
2676
|
+
* the entire scene.
|
|
2677
|
+
*
|
|
2678
|
+
* @example
|
|
2679
|
+
* const gctx = viji.useContext('webgpu');
|
|
2680
|
+
* if (!navigator.gpu || !gctx) {
|
|
2681
|
+
* // fall back, e.g. render a message via a 2d scene variant
|
|
2682
|
+
* } else {
|
|
2683
|
+
* const adapter = await navigator.gpu.requestAdapter();
|
|
2684
|
+
* const device = await adapter.requestDevice();
|
|
2685
|
+
* const format = navigator.gpu.getPreferredCanvasFormat();
|
|
2686
|
+
* gctx.configure({ device, format, alphaMode: 'opaque' });
|
|
2687
|
+
* }
|
|
2688
|
+
*/
|
|
2689
|
+
useContext(type: 'webgpu'): GPUCanvasContext | null;
|
|
2649
2690
|
}
|
|
2650
2691
|
|
|
2651
2692
|
/**
|
|
@@ -2690,6 +2731,8 @@ export declare class VijiCore {
|
|
|
2690
2731
|
private sceneP5CanvasMode?;
|
|
2691
2732
|
private sceneConsumesAnalysedFrame;
|
|
2692
2733
|
private sceneContextType?;
|
|
2734
|
+
/** Worker spawn scheme the sandbox selected; set once the worker is up. */
|
|
2735
|
+
private sceneWorkerSpawn?;
|
|
2693
2736
|
private parametersInitialized;
|
|
2694
2737
|
private isAwaitingSceneAnalysis;
|
|
2695
2738
|
private analysisWindowSceneError;
|
|
@@ -2711,6 +2754,12 @@ export declare class VijiCore {
|
|
|
2711
2754
|
* Capture current scene frame
|
|
2712
2755
|
* @param options.format 'blob' = encoded image, 'bitmap' = GPU-friendly ImageBitmap
|
|
2713
2756
|
*
|
|
2757
|
+
* Blob captures default to `'image/png'` (lossless, preserves alpha);
|
|
2758
|
+
* pass a lossy `type` for smaller files. Alpha survives end to end on
|
|
2759
|
+
* both formats, and bitmap captures always carry PREMULTIPLIED alpha
|
|
2760
|
+
* regardless of renderer — dropping the alpha channel downstream always
|
|
2761
|
+
* equals compositing the scene on black.
|
|
2762
|
+
*
|
|
2714
2763
|
* Readiness: the request queues in the worker and drains in the
|
|
2715
2764
|
* post-render slot of the first tick where artist drawing code dispatched
|
|
2716
2765
|
* cleanly against a canvas with a rendering context. Ticks where the scene
|
|
@@ -3940,4 +3989,14 @@ export declare class VijiCoreError extends Error {
|
|
|
3940
3989
|
constructor(message: string, code: string, context?: any | undefined);
|
|
3941
3990
|
}
|
|
3942
3991
|
|
|
3992
|
+
/**
|
|
3993
|
+
* Worker spawn scheme selected by the iframe's capability probe: `'blob'`
|
|
3994
|
+
* where a blob worker inside the sandbox is already a secure context
|
|
3995
|
+
* (Firefox, Safari), `'data'` where it is not (Chromium), in which case the
|
|
3996
|
+
* worker is spawned from a data: stub so scene code gains `[SecureContext]`
|
|
3997
|
+
* APIs such as WebGPU. Diagnostic; surfaced in `getSceneData()` and
|
|
3998
|
+
* `getStats()`.
|
|
3999
|
+
*/
|
|
4000
|
+
export declare type WorkerSpawnScheme = 'blob' | 'data';
|
|
4001
|
+
|
|
3943
4002
|
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.16.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
|
+
}
|