@viji-dev/core 0.4.5 → 0.5.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 +106 -48
- package/dist/artist-global.d.ts +106 -48
- package/dist/artist-jsdoc.d.ts +2 -6
- package/dist/assets/{viji.worker-D1yRmN8m.js → viji.worker-CWKkFyOs.js} +561 -168
- package/dist/assets/viji.worker-CWKkFyOs.js.map +1 -0
- package/dist/docs-api.js +9759 -9704
- package/dist/{essentia-wasm.web-BbdWO0Xs.js → essentia-wasm.web-CmPC-AKu.js} +2 -2
- package/dist/{essentia-wasm.web-BbdWO0Xs.js.map → essentia-wasm.web-CmPC-AKu.js.map} +1 -1
- package/dist/{index-DUg1Foui.js → index-Cp9G0z4E.js} +109 -11
- package/dist/index-Cp9G0z4E.js.map +1 -0
- package/dist/index.d.ts +106 -48
- package/dist/index.js +1 -1
- package/dist/shader-uniforms.js +10 -0
- package/package.json +98 -97
- package/dist/assets/viji.worker-D1yRmN8m.js.map +0 -1
- package/dist/index-DUg1Foui.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1863,14 +1863,16 @@ declare interface TouchPoint {
|
|
|
1863
1863
|
*/
|
|
1864
1864
|
declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
|
|
1865
1865
|
|
|
1866
|
-
export declare const VERSION = "0.
|
|
1866
|
+
export declare const VERSION = "0.5.0";
|
|
1867
1867
|
|
|
1868
1868
|
/**
|
|
1869
|
-
* Real-time video API: drawable frame, dimensions, and
|
|
1870
|
-
*
|
|
1869
|
+
* Real-time video API: drawable frame, dimensions, and the source-side
|
|
1870
|
+
* properties of the connected stream. All computer-vision data and controls
|
|
1871
|
+
* (faces, hands, pose, segmentation, the analysed frame, and feature
|
|
1872
|
+
* enable/disable verbs) live on `viji.video.cv`.
|
|
1871
1873
|
*
|
|
1872
|
-
* When `isConnected` is `false`, `currentFrame` is `null`, all dimensions are
|
|
1873
|
-
* and
|
|
1874
|
+
* When `isConnected` is `false`, `currentFrame` is `null`, all dimensions are
|
|
1875
|
+
* `0`, and every member of `cv` holds its empty default.
|
|
1874
1876
|
*/
|
|
1875
1877
|
export declare interface VideoAPI {
|
|
1876
1878
|
/** `true` when a video stream is connected. When `false`, all other fields hold their default empty values. */
|
|
@@ -1889,6 +1891,70 @@ export declare interface VideoAPI {
|
|
|
1889
1891
|
* use only when you need to read individual pixel values.
|
|
1890
1892
|
*/
|
|
1891
1893
|
getFrameData: () => ImageData | null;
|
|
1894
|
+
/**
|
|
1895
|
+
* Computer-vision surface for this video stream. Holds both the data
|
|
1896
|
+
* outputs (`faces`, `hands`, `pose`, `segmentation`, `analysedFrame`,
|
|
1897
|
+
* `getAnalysedFrameData`) and the verbs that activate them
|
|
1898
|
+
* (`enable*`/`disable*`/`getActiveFeatures`/`isProcessing`).
|
|
1899
|
+
*
|
|
1900
|
+
* Multiple features can be active simultaneously, but each adds CPU/GPU
|
|
1901
|
+
* and WebGL-context cost — toggle only what you need.
|
|
1902
|
+
*
|
|
1903
|
+
* `analysedFrame` and the result fields refresh together once per host
|
|
1904
|
+
* frame (atomic snapshot) — within a single `render()` call they are
|
|
1905
|
+
* always paired.
|
|
1906
|
+
*/
|
|
1907
|
+
cv: VideoCVAPI;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
/**
|
|
1911
|
+
* Computer-vision surface attached to a `VideoAPI`. Combines paired CV data
|
|
1912
|
+
* outputs (the analysed frame and its detection / segmentation results) with
|
|
1913
|
+
* the verbs that activate the underlying MediaPipe pipelines.
|
|
1914
|
+
*
|
|
1915
|
+
* Available only on the main video stream (`viji.video.cv`). Additional
|
|
1916
|
+
* streams (`viji.videoStreams[i].cv`) and device videos
|
|
1917
|
+
* (`viji.devices[i].video.cv`) do not run CV — their `cv` surface exists for
|
|
1918
|
+
* API consistency but the data fields stay at their empty defaults and the
|
|
1919
|
+
* `enable*` verbs are no-ops.
|
|
1920
|
+
*/
|
|
1921
|
+
export declare interface VideoCVAPI {
|
|
1922
|
+
/**
|
|
1923
|
+
* The exact video frame that produced the current `faces` / `hands` /
|
|
1924
|
+
* `pose` / `segmentation` results — the frame MediaPipe actually analysed.
|
|
1925
|
+
* Use this (not `viji.video.currentFrame`) when overlaying pixel-precise
|
|
1926
|
+
* CV-driven effects (face-mesh masks, body-segmentation compositing,
|
|
1927
|
+
* makeup, distortion). `currentFrame` is the just-arrived frame and runs
|
|
1928
|
+
* ~15–40 ms ahead of the analysis; `analysedFrame` is the frame the
|
|
1929
|
+
* landmarks/mask actually correspond to, so the two stay locked under
|
|
1930
|
+
* fast head/body motion.
|
|
1931
|
+
*
|
|
1932
|
+
* Pairing guarantee: within a single `render()` call, `analysedFrame`
|
|
1933
|
+
* is paired with the values of `faces`, `hands`, `pose`, `segmentation`
|
|
1934
|
+
* you read in the same call. They refresh together once per host frame.
|
|
1935
|
+
*
|
|
1936
|
+
* `null` until the first CV inference completes after a feature is
|
|
1937
|
+
* enabled, after the video disconnects, or after a CV-feature toggle
|
|
1938
|
+
* clears state. A common pattern is
|
|
1939
|
+
* `viji.video.cv.analysedFrame ?? viji.video.currentFrame` to fall back
|
|
1940
|
+
* to the live feed during the brief startup window.
|
|
1941
|
+
*
|
|
1942
|
+
* Read-only: this `OffscreenCanvas` is owned by the engine. Do not
|
|
1943
|
+
* mutate it (no `getContext`-and-paint, no `transferToImageBitmap`).
|
|
1944
|
+
* Drawing it as a source (`ctx.drawImage`, `gl.texImage2D`,
|
|
1945
|
+
* `p5.image(...)`) is the only supported usage.
|
|
1946
|
+
*/
|
|
1947
|
+
analysedFrame: OffscreenCanvas | null;
|
|
1948
|
+
/**
|
|
1949
|
+
* Returns `analysedFrame` as raw RGBA `ImageData` for per-pixel CPU
|
|
1950
|
+
* analysis, or `null` when no CV result has landed yet (or the stream is
|
|
1951
|
+
* disconnected). Cached: re-extracted only when a new CV result arrives,
|
|
1952
|
+
* so multiple readers within a render share one allocation. Slow
|
|
1953
|
+
* compared to drawing `analysedFrame` directly — use only when you need
|
|
1954
|
+
* pixel values aligned with CV landmark positions (e.g. sampling skin
|
|
1955
|
+
* colour at a face landmark).
|
|
1956
|
+
*/
|
|
1957
|
+
getAnalysedFrameData: () => ImageData | null;
|
|
1892
1958
|
/** Detected faces (empty array when face detection is off or no faces are visible). */
|
|
1893
1959
|
faces: FaceData[];
|
|
1894
1960
|
/** Detected hands (up to 2; empty array when hand tracking is off or no hands are visible). */
|
|
@@ -1898,50 +1964,42 @@ export declare interface VideoAPI {
|
|
|
1898
1964
|
/** Body segmentation mask, or `null` when segmentation is off. */
|
|
1899
1965
|
segmentation: SegmentationData | null;
|
|
1900
1966
|
/**
|
|
1901
|
-
*
|
|
1902
|
-
*
|
|
1903
|
-
* `segmentation` field on the next available frame. Multiple features can be
|
|
1904
|
-
* active simultaneously, but each adds CPU/GPU and WebGL-context cost.
|
|
1967
|
+
* Toggle face detection (bounding box, center, confidence, id).
|
|
1968
|
+
* @returns Resolves once the underlying pipeline has finished switching.
|
|
1905
1969
|
*/
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
enableBodySegmentation(enabled: boolean): Promise<void>;
|
|
1940
|
-
/** Returns the list of CV features currently enabled on this stream. */
|
|
1941
|
-
getActiveFeatures(): CVFeature[];
|
|
1942
|
-
/** Returns `true` if the CV worker is actively processing frames. */
|
|
1943
|
-
isProcessing(): boolean;
|
|
1944
|
-
};
|
|
1970
|
+
enableFaceDetection(enabled: boolean): Promise<void>;
|
|
1971
|
+
/**
|
|
1972
|
+
* Toggle 468-point face mesh + head pose (`pitch`, `yaw`, `roll`). Implies
|
|
1973
|
+
* face detection.
|
|
1974
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1975
|
+
*/
|
|
1976
|
+
enableFaceMesh(enabled: boolean): Promise<void>;
|
|
1977
|
+
/**
|
|
1978
|
+
* Toggle 7 expressions + 52 ARKit blendshape coefficients on each face.
|
|
1979
|
+
* Implies face mesh.
|
|
1980
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1981
|
+
*/
|
|
1982
|
+
enableEmotionDetection(enabled: boolean): Promise<void>;
|
|
1983
|
+
/**
|
|
1984
|
+
* Toggle 21-point hand landmarks + ML-classified gesture confidences for up
|
|
1985
|
+
* to two hands.
|
|
1986
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1987
|
+
*/
|
|
1988
|
+
enableHandTracking(enabled: boolean): Promise<void>;
|
|
1989
|
+
/**
|
|
1990
|
+
* Toggle 33-point BlazePose body landmarks (face / torso / arms / legs).
|
|
1991
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1992
|
+
*/
|
|
1993
|
+
enablePoseDetection(enabled: boolean): Promise<void>;
|
|
1994
|
+
/**
|
|
1995
|
+
* Toggle per-pixel person/background segmentation mask.
|
|
1996
|
+
* @returns Resolves once the pipeline has finished switching.
|
|
1997
|
+
*/
|
|
1998
|
+
enableBodySegmentation(enabled: boolean): Promise<void>;
|
|
1999
|
+
/** Returns the list of CV features currently enabled on this stream. */
|
|
2000
|
+
getActiveFeatures(): CVFeature[];
|
|
2001
|
+
/** Returns `true` if the CV worker is actively processing frames. */
|
|
2002
|
+
isProcessing(): boolean;
|
|
1945
2003
|
}
|
|
1946
2004
|
|
|
1947
2005
|
/**
|
package/dist/index.js
CHANGED
package/dist/shader-uniforms.js
CHANGED
|
@@ -374,6 +374,16 @@ export const shaderUniforms = {
|
|
|
374
374
|
"category": "Video",
|
|
375
375
|
"description": "Video frame rate in frames per second"
|
|
376
376
|
},
|
|
377
|
+
"u_videoAnalysed": {
|
|
378
|
+
"type": "sampler2D",
|
|
379
|
+
"category": "Video",
|
|
380
|
+
"description": "The exact frame MediaPipe analysed; pair with u_face*/u_hand*/u_pose* uniforms for pixel-precise CV-driven effects (face mesh masks, segmentation overlays). Shares u_videoResolution."
|
|
381
|
+
},
|
|
382
|
+
"u_videoAnalysedAvailable": {
|
|
383
|
+
"type": "bool",
|
|
384
|
+
"category": "Video",
|
|
385
|
+
"description": "True after the first CV result lands; before that, u_videoAnalysed samples a 1x1 black fallback. Use to gate effects that require valid analysed pixels."
|
|
386
|
+
},
|
|
377
387
|
"u_videoStreamCount": {
|
|
378
388
|
"type": "int",
|
|
379
389
|
"category": "Video",
|
package/package.json
CHANGED
|
@@ -1,97 +1,98 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@viji-dev/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Universal execution engine for Viji Creative scenes",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"./artist-global": {
|
|
15
|
-
"types": "./dist/artist-global.d.ts"
|
|
16
|
-
},
|
|
17
|
-
"./artist-dts": {
|
|
18
|
-
"import": "./dist/artist-dts.js",
|
|
19
|
-
"types": "./dist/artist-dts.d.ts"
|
|
20
|
-
},
|
|
21
|
-
"./artist-jsdoc": {
|
|
22
|
-
"types": "./dist/artist-jsdoc.d.ts"
|
|
23
|
-
},
|
|
24
|
-
"./artist-js-ambient": {
|
|
25
|
-
"types": "./dist/artist-js-ambient.d.ts"
|
|
26
|
-
},
|
|
27
|
-
"./artist-dts-p5": {
|
|
28
|
-
"import": "./dist/artist-dts-p5.js",
|
|
29
|
-
"types": "./dist/artist-dts-p5.d.ts"
|
|
30
|
-
},
|
|
31
|
-
"./artist-global-p5": {
|
|
32
|
-
"types": "./dist/artist-global-p5.d.ts"
|
|
33
|
-
},
|
|
34
|
-
"./shader-uniforms": {
|
|
35
|
-
"import": "./dist/shader-uniforms.js",
|
|
36
|
-
"types": "./dist/shader-uniforms.d.ts"
|
|
37
|
-
},
|
|
38
|
-
"./docs-api": {
|
|
39
|
-
"import": "./dist/docs-api.js",
|
|
40
|
-
"types": "./dist/docs-api.d.ts"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"files": [
|
|
44
|
-
"dist/*.js",
|
|
45
|
-
"dist/*.d.ts",
|
|
46
|
-
"dist/*.map",
|
|
47
|
-
"dist/assets",
|
|
48
|
-
"README.md"
|
|
49
|
-
],
|
|
50
|
-
"scripts": {
|
|
51
|
-
"prebuild": "node scripts/prebuild-clean.mjs",
|
|
52
|
-
"build": "vite build && node scripts/copy-tasks-assets.mjs && node scripts/build-artist-types.mjs && node scripts/build-docs-api.mjs",
|
|
53
|
-
"build:docs": "node scripts/build-docs-api.mjs",
|
|
54
|
-
"dev": "vite build --watch",
|
|
55
|
-
"
|
|
56
|
-
"test
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
"@types/
|
|
73
|
-
"@
|
|
74
|
-
"@typescript-eslint/
|
|
75
|
-
"@
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"vite
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@viji-dev/core",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Universal execution engine for Viji Creative scenes",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./artist-global": {
|
|
15
|
+
"types": "./dist/artist-global.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./artist-dts": {
|
|
18
|
+
"import": "./dist/artist-dts.js",
|
|
19
|
+
"types": "./dist/artist-dts.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./artist-jsdoc": {
|
|
22
|
+
"types": "./dist/artist-jsdoc.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./artist-js-ambient": {
|
|
25
|
+
"types": "./dist/artist-js-ambient.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./artist-dts-p5": {
|
|
28
|
+
"import": "./dist/artist-dts-p5.js",
|
|
29
|
+
"types": "./dist/artist-dts-p5.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./artist-global-p5": {
|
|
32
|
+
"types": "./dist/artist-global-p5.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./shader-uniforms": {
|
|
35
|
+
"import": "./dist/shader-uniforms.js",
|
|
36
|
+
"types": "./dist/shader-uniforms.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./docs-api": {
|
|
39
|
+
"import": "./dist/docs-api.js",
|
|
40
|
+
"types": "./dist/docs-api.d.ts"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist/*.js",
|
|
45
|
+
"dist/*.d.ts",
|
|
46
|
+
"dist/*.map",
|
|
47
|
+
"dist/assets",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"prebuild": "node scripts/prebuild-clean.mjs",
|
|
52
|
+
"build": "vite build && node scripts/copy-tasks-assets.mjs && node scripts/build-artist-types.mjs && node scripts/build-docs-api.mjs",
|
|
53
|
+
"build:docs": "node scripts/build-docs-api.mjs",
|
|
54
|
+
"dev": "vite build --watch",
|
|
55
|
+
"integration": "vite --config integration-example/vite.config.ts",
|
|
56
|
+
"test": "vitest",
|
|
57
|
+
"test:coverage": "vitest --coverage",
|
|
58
|
+
"type-check": "tsc --noEmit",
|
|
59
|
+
"lint": "eslint src --ext .ts"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"viji",
|
|
63
|
+
"creative",
|
|
64
|
+
"webgl",
|
|
65
|
+
"audio-reactive",
|
|
66
|
+
"canvas",
|
|
67
|
+
"webworker"
|
|
68
|
+
],
|
|
69
|
+
"author": "Viji Team",
|
|
70
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@types/node": "^20.0.0",
|
|
73
|
+
"@types/p5": "^1.7.6",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
75
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
76
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
77
|
+
"dts-bundle-generator": "^9.5.1",
|
|
78
|
+
"eslint": "^8.0.0",
|
|
79
|
+
"github-slugger": "^2.0.0",
|
|
80
|
+
"happy-dom": "^18.0.1",
|
|
81
|
+
"mdast-util-to-string": "^4.0.0",
|
|
82
|
+
"remark-parse": "^11.0.0",
|
|
83
|
+
"typescript": "^5.0.0",
|
|
84
|
+
"unified": "^11.0.5",
|
|
85
|
+
"vite": "^5.0.0",
|
|
86
|
+
"vite-plugin-dts": "^3.0.0",
|
|
87
|
+
"vitest": "^1.0.0"
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=18.0.0"
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@mediapipe/tasks-vision": "^0.10.20",
|
|
94
|
+
"essentia.js": "^0.1.3",
|
|
95
|
+
"fft.js": "^4.0.4",
|
|
96
|
+
"sucrase": "^3.35.1"
|
|
97
|
+
}
|
|
98
|
+
}
|