@viji-dev/core 0.16.1 → 0.18.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 +154 -8
- package/dist/artist-global.d.ts +154 -8
- package/dist/artist-jsdoc.d.ts +45 -4
- package/dist/assets/viji.worker-CwvLwn6O.js +616 -0
- package/dist/docs-api.js +244 -35
- package/dist/{essentia-wasm.web-CFCpr-c2.js → essentia-wasm.web-DclksH__.js} +1 -1
- package/dist/{index-BElGM0ub.js → index-BFSuPQzu.js} +1263 -1071
- package/dist/index.d.ts +199 -24
- package/dist/index.js +1 -1
- package/dist/param-inference.js +2 -1
- package/dist/{scene-analysis-CEQRlNUL.js → scene-analysis-2Ov0HS52.js} +1 -1
- package/dist/scene-analysis.js +1 -1
- package/package.json +117 -117
- package/dist/assets/viji.worker-Dm3yyu15.js +0 -612
package/dist/index.d.ts
CHANGED
|
@@ -332,16 +332,28 @@ declare interface ColorConfig {
|
|
|
332
332
|
group?: string;
|
|
333
333
|
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
334
334
|
category?: ParameterCategory;
|
|
335
|
+
/**
|
|
336
|
+
* Enable a transparency channel. When `true` the canonical value is always an
|
|
337
|
+
* 8-digit `#rrggbbaa` (opaque inputs are padded `ff`), the picker shows an alpha
|
|
338
|
+
* slider, and the shader uniform is a `vec4`. When `false` (default) the value is
|
|
339
|
+
* `#rrggbb` and any alpha-bearing input is rejected. Default: `false`.
|
|
340
|
+
*/
|
|
341
|
+
alpha?: boolean;
|
|
335
342
|
}
|
|
336
343
|
|
|
337
344
|
/**
|
|
338
345
|
* Accepted input forms for color parameters. Internally normalized to canonical
|
|
339
|
-
* lowercase
|
|
346
|
+
* lowercase hex: `#rrggbb` for an opaque parameter, `#rrggbbaa` for a parameter
|
|
347
|
+
* declared with `alpha: true`. See `viji.color()` for full documentation.
|
|
340
348
|
*
|
|
341
349
|
* - `string`: hex (`#rrggbb`, `#rgb`), CSS `rgb(r, g, b)`, CSS `hsl(h, s%, l%)`,
|
|
342
350
|
* GLSL-style `vec3(r, g, b)` (0..1), or P5-style `hsb(h, s, b)` (0..360 / 0..100 / 0..100)
|
|
343
351
|
* - `{ r, g, b }`: RGB object with components in 0..255
|
|
344
352
|
* - `{ h, s, b }`: HSB object with `h` in 0..360, `s` and `b` in 0..100
|
|
353
|
+
*
|
|
354
|
+
* Alpha-bearing forms (`#rrggbbaa`, `#rgba`, `rgba()`, `hsla()`, `vec4()`, and the
|
|
355
|
+
* objects with an `a` field in 0..1) are accepted ONLY by a parameter declared with
|
|
356
|
+
* `alpha: true`; an opaque parameter rejects them even when the alpha is `1`.
|
|
345
357
|
*/
|
|
346
358
|
declare type ColorInput = string | {
|
|
347
359
|
/** Red component in 0..255. */
|
|
@@ -350,6 +362,8 @@ declare type ColorInput = string | {
|
|
|
350
362
|
g: number;
|
|
351
363
|
/** Blue component in 0..255. */
|
|
352
364
|
b: number;
|
|
365
|
+
/** Alpha in 0..1. Only valid on a parameter declared with `alpha: true`. */
|
|
366
|
+
a?: number;
|
|
353
367
|
} | {
|
|
354
368
|
/** Hue in 0..360. */
|
|
355
369
|
h: number;
|
|
@@ -357,16 +371,22 @@ declare type ColorInput = string | {
|
|
|
357
371
|
s: number;
|
|
358
372
|
/** Brightness in 0..100. */
|
|
359
373
|
b: number;
|
|
374
|
+
/** Alpha in 0..1. Only valid on a parameter declared with `alpha: true`. */
|
|
375
|
+
a?: number;
|
|
360
376
|
};
|
|
361
377
|
|
|
362
378
|
/**
|
|
363
379
|
* Reactive object returned by `viji.color()`. `value` is always a canonical
|
|
364
|
-
* lowercase
|
|
365
|
-
*
|
|
380
|
+
* lowercase hex string whose width is fixed by the parameter's mode (`#rrggbb`,
|
|
381
|
+
* or `#rrggbbaa` when declared with `alpha: true`); `rgb`, `hsb` and `alpha` are
|
|
382
|
+
* derived accessors that are recomputed (and frozen) every time the user changes
|
|
383
|
+
* the color.
|
|
366
384
|
*/
|
|
367
385
|
declare interface ColorParameter {
|
|
368
|
-
/** Canonical hex color string `#rrggbb`
|
|
386
|
+
/** Canonical lowercase hex color string: `#rrggbb`, or `#rrggbbaa` when `alpha: true`. Updates in real-time. */
|
|
369
387
|
value: string;
|
|
388
|
+
/** Alpha in 0..1. Always present: `1` on an opaque parameter, the live alpha when `alpha: true`. */
|
|
389
|
+
alpha: number;
|
|
370
390
|
/** RGB components as integers in 0..255 (frozen, recomputed when value changes). */
|
|
371
391
|
rgb: {
|
|
372
392
|
/** Red component, integer in 0..255. */
|
|
@@ -908,6 +928,101 @@ export declare interface FrequencyBand {
|
|
|
908
928
|
max: number;
|
|
909
929
|
}
|
|
910
930
|
|
|
931
|
+
/**
|
|
932
|
+
* Configuration object passed to `viji.gradient()`. Defines the ramp editor's
|
|
933
|
+
* stop bounds, transparency mode, label and UI grouping/visibility.
|
|
934
|
+
*/
|
|
935
|
+
declare interface GradientConfig {
|
|
936
|
+
/**
|
|
937
|
+
* Advanced: explicit parameter identity. Normally you do NOT set this —
|
|
938
|
+
* the parameter's name is inferred from the variable or object key you
|
|
939
|
+
* assign it to (`const ramp = viji.gradient(...)` → `ramp`). Set `name`
|
|
940
|
+
* only for parameters not assigned to a variable or key (created in an
|
|
941
|
+
* array, loop, or factory). Must be a valid identifier and scene-globally
|
|
942
|
+
* unique. When set, it overrides the inferred name.
|
|
943
|
+
*/
|
|
944
|
+
name?: string;
|
|
945
|
+
/** Minimum number of stops the editor allows. Integer in `2..32`. Default: `2`. */
|
|
946
|
+
minStops?: number;
|
|
947
|
+
/** Maximum number of stops the editor allows. Integer in `2..32`; sizes the shader uniform arrays. Default: `8`. */
|
|
948
|
+
maxStops?: number;
|
|
949
|
+
/** Display name shown next to the ramp in the parameter UI. Optional — defaults to the parameter's name. */
|
|
950
|
+
label?: string;
|
|
951
|
+
/** Optional tooltip / help text shown next to the control. */
|
|
952
|
+
description?: string;
|
|
953
|
+
/** Group name for organizing related parameters under a shared heading. Default: `'general'`. */
|
|
954
|
+
group?: string;
|
|
955
|
+
/** Visibility category. The control hides when its capability is unavailable. Default: `'general'`. */
|
|
956
|
+
category?: ParameterCategory;
|
|
957
|
+
/**
|
|
958
|
+
* Enable per-stop transparency. When `true` every stop color is `#rrggbbaa`
|
|
959
|
+
* (opaque inputs padded `ff`) and the shader sampler returns a `vec4`. When
|
|
960
|
+
* `false` (default) stops are `#rrggbb` and alpha-bearing stop colors are rejected.
|
|
961
|
+
*/
|
|
962
|
+
alpha?: boolean;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Stop list accepted by `viji.gradient()` and `setParameter()`. Any order;
|
|
967
|
+
* normalized to a sorted, canonical {@link GradientValue}.
|
|
968
|
+
*/
|
|
969
|
+
export declare type GradientInput = ReadonlyArray<GradientStopInput>;
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Reactive object returned by `viji.gradient()`. `value` is the live, frozen,
|
|
973
|
+
* sorted stop list; `at(t)` samples the ramp with CSS `linear-gradient`
|
|
974
|
+
* semantics (premultiplied sRGB between stops, hard edges on duplicate
|
|
975
|
+
* positions) and returns a canonical hex string in the same width as the stops.
|
|
976
|
+
*/
|
|
977
|
+
declare interface GradientParameter {
|
|
978
|
+
/** Current stops, frozen and sorted ascending by position. Updates in real-time. */
|
|
979
|
+
value: GradientValue;
|
|
980
|
+
/**
|
|
981
|
+
* Sample the ramp at `t` (clamped to `0..1`). Returns canonical hex in the
|
|
982
|
+
* gradient's width. The shader renderer exposes the same function as
|
|
983
|
+
* `<name>(float t)` in GLSL.
|
|
984
|
+
*/
|
|
985
|
+
at(t: number): string;
|
|
986
|
+
/** Display name shown next to the ramp in the parameter UI. */
|
|
987
|
+
label?: string;
|
|
988
|
+
/** Tooltip / help text for the control (empty string when not configured). */
|
|
989
|
+
description?: string;
|
|
990
|
+
/** Group name under which the control appears in the UI. */
|
|
991
|
+
group: string;
|
|
992
|
+
/** Visibility category that controls when the parameter is shown. */
|
|
993
|
+
category: ParameterCategory;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* One stop of a gradient value. `color` is canonical lowercase hex in the
|
|
998
|
+
* gradient's mode (`#rrggbb`, or `#rrggbbaa` when declared with `alpha: true`).
|
|
999
|
+
*/
|
|
1000
|
+
export declare interface GradientStop {
|
|
1001
|
+
/** Canonical hex color of this stop. */
|
|
1002
|
+
color: string;
|
|
1003
|
+
/** Position along the ramp in `0..1`. */
|
|
1004
|
+
position: number;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* One artist- or host-supplied gradient stop. `color` accepts every form a
|
|
1009
|
+
* color parameter accepts, normalized per the gradient's `alpha` mode.
|
|
1010
|
+
*/
|
|
1011
|
+
export declare interface GradientStopInput {
|
|
1012
|
+
/** Any accepted color form (hex, CSS functions, RGB / HSB objects). */
|
|
1013
|
+
color: ColorInput;
|
|
1014
|
+
/** Position along the ramp in `0..1`. */
|
|
1015
|
+
position: number;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Value of a gradient parameter: a frozen list of stops sorted ascending by
|
|
1020
|
+
* position. Duplicate positions are allowed and form a hard edge. The length is
|
|
1021
|
+
* within the parameter's `minStops..maxStops`. No wrapper: geometry (linear,
|
|
1022
|
+
* radial, angle) is the scene's concern.
|
|
1023
|
+
*/
|
|
1024
|
+
export declare type GradientValue = readonly GradientStop[];
|
|
1025
|
+
|
|
911
1026
|
/**
|
|
912
1027
|
* One detected hand produced by the video CV pipeline. Carries 21 landmarks,
|
|
913
1028
|
* a palm shortcut, and ML-classified gesture confidence scores. Up to two
|
|
@@ -1002,7 +1117,12 @@ declare interface ImageConfig {
|
|
|
1002
1117
|
* the image works directly with `image()`, `texture()`, etc.
|
|
1003
1118
|
*/
|
|
1004
1119
|
declare interface ImageParameter {
|
|
1005
|
-
/**
|
|
1120
|
+
/**
|
|
1121
|
+
* Uploaded image as an `ImageBitmap`, or `null` until the user provides one.
|
|
1122
|
+
* Read it where you use it (inside `render()`): when the host replaces or
|
|
1123
|
+
* clears the image, the previous bitmap is closed, so a reference kept from
|
|
1124
|
+
* an earlier frame becomes unusable.
|
|
1125
|
+
*/
|
|
1006
1126
|
value: ImageBitmap | null;
|
|
1007
1127
|
/** P5-compatible image wrapper. Only available in the P5 renderer; added at runtime by the P5 adapter. */
|
|
1008
1128
|
readonly p5?: any;
|
|
@@ -1273,6 +1393,16 @@ export declare interface ParameterConfig {
|
|
|
1273
1393
|
step?: number;
|
|
1274
1394
|
options?: string[] | number[];
|
|
1275
1395
|
maxLength?: number;
|
|
1396
|
+
/**
|
|
1397
|
+
* For color and gradient types: the value carries a transparency channel
|
|
1398
|
+
* (`#rrggbbaa` canonical form). Always present on color / gradient
|
|
1399
|
+
* definitions so validators can branch on it. Default `false`.
|
|
1400
|
+
*/
|
|
1401
|
+
alpha?: boolean;
|
|
1402
|
+
/** For gradient type: minimum number of stops the control allows (integer, 2..32). */
|
|
1403
|
+
minStops?: number;
|
|
1404
|
+
/** For gradient type: maximum number of stops the control allows (integer, 2..32). Sizes the shader uniform arrays. */
|
|
1405
|
+
maxStops?: number;
|
|
1276
1406
|
label?: string;
|
|
1277
1407
|
description?: string;
|
|
1278
1408
|
hidden?: boolean;
|
|
@@ -1314,9 +1444,9 @@ export declare interface ParameterGroup {
|
|
|
1314
1444
|
* The kind of UI control a parameter renders as. Used for the per-type
|
|
1315
1445
|
* breakdown in {@link SceneData.parameterCounts}.
|
|
1316
1446
|
*/
|
|
1317
|
-
export declare type ParameterType = 'slider' | 'color' | 'toggle' | 'select' | 'text' | 'number' | 'image' | 'button' | 'coordinate';
|
|
1447
|
+
export declare type ParameterType = 'slider' | 'color' | 'toggle' | 'select' | 'text' | 'number' | 'image' | 'button' | 'coordinate' | 'gradient';
|
|
1318
1448
|
|
|
1319
|
-
export declare type ParameterValue = string | number | boolean | ImageBitmap | CoordinateValue | null;
|
|
1449
|
+
export declare type ParameterValue = string | number | boolean | ImageBitmap | CoordinateValue | GradientValue | null;
|
|
1320
1450
|
|
|
1321
1451
|
export declare interface PerformanceStats {
|
|
1322
1452
|
resolution: Resolution;
|
|
@@ -1634,7 +1764,10 @@ export declare interface SceneData {
|
|
|
1634
1764
|
* - `RENDER_ERROR`: synchronous throw inside the artist's `render()` function.
|
|
1635
1765
|
* - `UNCAUGHT_ERROR`: caught by the worker's `self.onerror` (async / RAF / setTimeout).
|
|
1636
1766
|
* - `UNHANDLED_REJECTION`: caught by the worker's `unhandledrejection` handler.
|
|
1637
|
-
* - `SHADER_COMPILE_ERROR`: GLSL compile failure (
|
|
1767
|
+
* - `SHADER_COMPILE_ERROR`: GLSL compile / link failure, or (since 0.17.0) an invalid
|
|
1768
|
+
* `// @viji-*` directive (bad default, alpha default without `alpha:true`, gradient
|
|
1769
|
+
* stop or bounds errors, reserved-name collisions). `sourceLocation.line` is the
|
|
1770
|
+
* artist line of the failing GLSL or of the first offending directive.
|
|
1638
1771
|
* - `P5_INIT_ERROR`: failure during P5 mode initialization (e.g. missing `render`).
|
|
1639
1772
|
* - `SCENE_PARSE_ERROR`: the script scene could not be parsed by the load-time
|
|
1640
1773
|
* parameter name-inference pass (a genuine syntax error — the scene would not
|
|
@@ -2325,7 +2458,7 @@ declare interface TouchPoint {
|
|
|
2325
2458
|
/** Returned by `on*` listener registration calls; invoke to unsubscribe. */
|
|
2326
2459
|
export declare type Unsubscribe = () => void;
|
|
2327
2460
|
|
|
2328
|
-
export declare const VERSION = "0.
|
|
2461
|
+
export declare const VERSION = "0.18.0";
|
|
2329
2462
|
|
|
2330
2463
|
/**
|
|
2331
2464
|
* Real-time video API: drawable frame, dimensions, and the source-side
|
|
@@ -2569,12 +2702,17 @@ export declare interface VijiAPI {
|
|
|
2569
2702
|
slider: (defaultValue: number, config: SliderConfig) => SliderParameter;
|
|
2570
2703
|
/**
|
|
2571
2704
|
* Declares a color parameter. Accepts hex strings, CSS color functions, or RGB / HSB objects;
|
|
2572
|
-
* the value is always normalized to a canonical lowercase hex string and exposes derived
|
|
2705
|
+
* the value is always normalized to a canonical lowercase hex string and exposes derived
|
|
2706
|
+
* `.rgb` / `.hsb` / `.alpha` accessors. Pass `alpha: true` to enable transparency: the value
|
|
2707
|
+
* becomes `#rrggbbaa` and alpha-bearing inputs (`rgba()`, `#rrggbbaa`, ...) are accepted.
|
|
2708
|
+
* Without it, alpha-bearing inputs are rejected.
|
|
2573
2709
|
* Must be called at the top level of the scene, never inside `render()`.
|
|
2574
2710
|
*
|
|
2575
2711
|
* @example
|
|
2576
2712
|
* const tint = viji.color('#ff6600', { label: 'Tint' });
|
|
2577
|
-
* // tint.value -> '#ff6600', tint.rgb -> { r: 255, g: 102, b: 0 }, tint.hsb -> { h: 24, s: 100, b: 100 }
|
|
2713
|
+
* // tint.value -> '#ff6600', tint.rgb -> { r: 255, g: 102, b: 0 }, tint.hsb -> { h: 24, s: 100, b: 100 }, tint.alpha -> 1
|
|
2714
|
+
* const glow = viji.color('#ffffff80', { label: 'Glow', alpha: true });
|
|
2715
|
+
* // glow.value -> '#ffffff80', glow.alpha -> 0.5
|
|
2578
2716
|
*/
|
|
2579
2717
|
color: (defaultValue: ColorInput, config: ColorConfig) => ColorParameter;
|
|
2580
2718
|
/**
|
|
@@ -2640,6 +2778,27 @@ export declare interface VijiAPI {
|
|
|
2640
2778
|
* const cx = viji.width / 2 + origin.value.x * viji.width * 0.4;
|
|
2641
2779
|
*/
|
|
2642
2780
|
coordinate: (defaultValue: CoordinateValue, config: CoordinateConfig) => CoordinateParameter;
|
|
2781
|
+
/**
|
|
2782
|
+
* Declares a gradient parameter. The host renders a ramp editor; `value` is the live,
|
|
2783
|
+
* sorted stop list and `at(t)` samples the ramp (CSS `linear-gradient` semantics).
|
|
2784
|
+
* Stop colors accept every color form; pass `alpha: true` for per-stop transparency.
|
|
2785
|
+
* `default` is required (no evenly-spaced shorthand). Must be called at the top level
|
|
2786
|
+
* of the scene, never inside `render()`.
|
|
2787
|
+
*
|
|
2788
|
+
* @example
|
|
2789
|
+
* const ramp = viji.gradient(
|
|
2790
|
+
* [{ color: '#ff6b6b', position: 0 }, { color: '#4ecdc4', position: 1 }],
|
|
2791
|
+
* { label: 'Ramp' }
|
|
2792
|
+
* );
|
|
2793
|
+
* function render(viji) {
|
|
2794
|
+
* const fill = viji.ctx.createLinearGradient(0, 0, viji.width, 0);
|
|
2795
|
+
* for (const stop of ramp.value) fill.addColorStop(stop.position, stop.color);
|
|
2796
|
+
* viji.ctx.fillStyle = fill;
|
|
2797
|
+
* viji.ctx.fillRect(0, 0, viji.width, viji.height);
|
|
2798
|
+
* viji.ctx.fillStyle = ramp.at(0.5); // per-element color, same math as the fill
|
|
2799
|
+
* }
|
|
2800
|
+
*/
|
|
2801
|
+
gradient: (defaultValue: GradientInput, config: GradientConfig) => GradientParameter;
|
|
2643
2802
|
/**
|
|
2644
2803
|
* Selects the 2D canvas rendering context. Returns the same instance on
|
|
2645
2804
|
* subsequent calls and also stores it on `viji.ctx`. A canvas only supports
|
|
@@ -2713,6 +2872,13 @@ export declare class VijiCore {
|
|
|
2713
2872
|
*/
|
|
2714
2873
|
private debugLog;
|
|
2715
2874
|
private config;
|
|
2875
|
+
/**
|
|
2876
|
+
* `config.initialParameters` after `sanitizeInitialParameters` (set in
|
|
2877
|
+
* `initialize()`, cleared in `destroy()`). Overlaid onto `parameterValues`
|
|
2878
|
+
* when the worker reports its definitions, so the host table matches what
|
|
2879
|
+
* the worker seeded before frame 1. `null` when no seed was supplied.
|
|
2880
|
+
*/
|
|
2881
|
+
private initialSeed;
|
|
2716
2882
|
private isHeadless;
|
|
2717
2883
|
private static readonly DIRECT_FRAME_BASE;
|
|
2718
2884
|
private engineGroup;
|
|
@@ -2910,18 +3076,20 @@ export declare class VijiCore {
|
|
|
2910
3076
|
private getParameterDefinition;
|
|
2911
3077
|
/**
|
|
2912
3078
|
* For color parameters, accept rich input forms (hex, RGB/HSB objects, CSS / GLSL strings)
|
|
2913
|
-
* and normalize them to canonical lowercase hex `#rrggbb
|
|
2914
|
-
*
|
|
2915
|
-
*
|
|
3079
|
+
* and normalize them to canonical lowercase hex (`#rrggbb`, or `#rrggbbaa` when the
|
|
3080
|
+
* definition declares `alpha`) before they go on the wire. For gradient parameters,
|
|
3081
|
+
* accept any stop list (stop colors in any color form, any order) and normalize it to
|
|
3082
|
+
* the sorted, frozen canonical stop array. This keeps the host<->worker contract simple
|
|
3083
|
+
* while letting external callers use whichever form is most convenient.
|
|
2916
3084
|
*
|
|
2917
|
-
*
|
|
3085
|
+
* Other values are returned unchanged.
|
|
2918
3086
|
*/
|
|
2919
|
-
private
|
|
3087
|
+
private normalizeParameterInput;
|
|
2920
3088
|
/**
|
|
2921
3089
|
* Set a single parameter value
|
|
2922
3090
|
* Handles all parameter types including images intelligently
|
|
2923
3091
|
*/
|
|
2924
|
-
setParameter(name: string, value: ParameterValue | ColorInput | File | Blob): Promise<void>;
|
|
3092
|
+
setParameter(name: string, value: ParameterValue | ColorInput | GradientInput | File | Blob): Promise<void>;
|
|
2925
3093
|
/**
|
|
2926
3094
|
* Internal method to handle image parameter loading and transfer
|
|
2927
3095
|
* Loads the image on the host side and creates TWO ImageBitmaps:
|
|
@@ -2935,7 +3103,7 @@ export declare class VijiCore {
|
|
|
2935
3103
|
* For color parameters, accepts the same rich input forms as `setParameter`
|
|
2936
3104
|
* (hex, RGB/HSB objects, CSS / GLSL strings); they are normalized to canonical hex.
|
|
2937
3105
|
*/
|
|
2938
|
-
setParameters(values: Record<string, ParameterValue | ColorInput>): Promise<void>;
|
|
3106
|
+
setParameters(values: Record<string, ParameterValue | ColorInput | GradientInput>): Promise<void>;
|
|
2939
3107
|
/**
|
|
2940
3108
|
* Get current parameter value
|
|
2941
3109
|
*/
|
|
@@ -3047,10 +3215,6 @@ export declare class VijiCore {
|
|
|
3047
3215
|
* Check if parameters have been initialized
|
|
3048
3216
|
*/
|
|
3049
3217
|
get parametersReady(): boolean;
|
|
3050
|
-
/**
|
|
3051
|
-
* Send all current parameter values to worker (used for initial sync)
|
|
3052
|
-
*/
|
|
3053
|
-
private syncAllParametersToWorker;
|
|
3054
3218
|
/**
|
|
3055
3219
|
* Add listener for when the scene's parameters are defined. Fires exactly once
|
|
3056
3220
|
* per scene load, after the scene registers its parameters — including scenes
|
|
@@ -3889,8 +4053,19 @@ export declare interface VijiCoreConfig {
|
|
|
3889
4053
|
* default) and before the first render, so the scene paints frame 1 with these
|
|
3890
4054
|
* values instead of popping from defaults a round-trip later. Names the scene
|
|
3891
4055
|
* does not define are silently ignored; values are validated against each
|
|
3892
|
-
* parameter's definition exactly like {@link VijiCore.setParameter}.
|
|
3893
|
-
*
|
|
4056
|
+
* parameter's definition exactly like {@link VijiCore.setParameter}. The host
|
|
4057
|
+
* table mirrors the seed once the scene reports its parameters, so
|
|
4058
|
+
* {@link VijiCore.getParameterValues} inside `onParametersDefined` returns the
|
|
4059
|
+
* seeded values. Seeds are the initial state, not a change: no
|
|
4060
|
+
* `onParameterChange` notification is emitted for them.
|
|
4061
|
+
*
|
|
4062
|
+
* Image parameters accept an `ImageBitmap` (or `null`). The bitmap is
|
|
4063
|
+
* structured-cloned to the scene and the object you pass becomes core's host
|
|
4064
|
+
* copy (returned by `getParameter` / `getParameterValues`, handed to
|
|
4065
|
+
* listeners): do not close it while the core lives. A bitmap that is already
|
|
4066
|
+
* closed is dropped from the seed with a console warning. URL strings are
|
|
4067
|
+
* not resolved and `File` / `Blob` values are not seedable; use
|
|
4068
|
+
* {@link VijiCore.setParameter} after `onParametersDefined` for those.
|
|
3894
4069
|
*/
|
|
3895
4070
|
initialParameters?: Record<string, ParameterValue>;
|
|
3896
4071
|
/** Frame rate mode - render every frame (`'full'`), every 2nd (`'half'`), every 4th (`'quarter'`), or every 8th (`'eighth'`). */
|
package/dist/index.js
CHANGED
package/dist/param-inference.js
CHANGED
|
@@ -125,7 +125,7 @@ class a {
|
|
|
125
125
|
* signal — a scene must enable a feature to receive its data).
|
|
126
126
|
*/
|
|
127
127
|
static detectScriptCapabilities(e, t) {
|
|
128
|
-
/\bviji\.audio/.test(e) && (t.audio = !0), /\bviji\.video/.test(e) && (t.video = !0), /\bviji\.mouse/.test(e) && (t.mouse = !0), /\bviji\.keyboard/.test(e) && (t.keyboard = !0), /\bviji\.touches/.test(e) && (t.touch = !0), /\bviji\.pointer/.test(e) && (t.pointer = !0), /\bviji\.device\b/.test(e) && (t.sensors = !0), /\bviji\.devices/.test(e) && (t.devices = !0), /\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate)\s*\(/.test(e) && (t.parameters = !0), /\benableFaceDetection\b/.test(e) && (t.cv.faceDetection = !0), /\benableFaceMesh\b/.test(e) && (t.cv.faceMesh = !0), /\benableEmotionDetection\b/.test(e) && (t.cv.emotion = !0), /\benableHandTracking\b/.test(e) && (t.cv.handTracking = !0), /\benablePoseDetection\b/.test(e) && (t.cv.poseDetection = !0), /\benableBodySegmentation\b/.test(e) && (t.cv.segmentation = !0);
|
|
128
|
+
/\bviji\.audio/.test(e) && (t.audio = !0), /\bviji\.video/.test(e) && (t.video = !0), /\bviji\.mouse/.test(e) && (t.mouse = !0), /\bviji\.keyboard/.test(e) && (t.keyboard = !0), /\bviji\.touches/.test(e) && (t.touch = !0), /\bviji\.pointer/.test(e) && (t.pointer = !0), /\bviji\.device\b/.test(e) && (t.sensors = !0), /\bviji\.devices/.test(e) && (t.devices = !0), /\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate|gradient)\s*\(/.test(e) && (t.parameters = !0), /\benableFaceDetection\b/.test(e) && (t.cv.faceDetection = !0), /\benableFaceMesh\b/.test(e) && (t.cv.faceMesh = !0), /\benableEmotionDetection\b/.test(e) && (t.cv.emotion = !0), /\benableHandTracking\b/.test(e) && (t.cv.handTracking = !0), /\benablePoseDetection\b/.test(e) && (t.cv.poseDetection = !0), /\benableBodySegmentation\b/.test(e) && (t.cv.segmentation = !0);
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
131
|
* Detects which specific interaction inputs a scene reads (positions and
|
package/dist/scene-analysis.js
CHANGED
package/package.json
CHANGED
|
@@ -1,117 +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
|
-
"@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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@viji-dev/core",
|
|
3
|
+
"version": "0.18.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
|
+
}
|