vim-web 0.5.0-dev.5 → 0.5.0-dev.7
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/types/core-viewers/ultra/colorManager.d.ts +4 -4
- package/dist/types/core-viewers/ultra/element3d.d.ts +4 -4
- package/dist/types/core-viewers/ultra/index.d.ts +1 -1
- package/dist/types/core-viewers/ultra/remoteColor.d.ts +3 -23
- package/dist/types/core-viewers/ultra/renderer.d.ts +14 -11
- package/dist/types/core-viewers/ultra/rpcTypes.d.ts +3 -0
- package/dist/types/core-viewers/ultra/rpcUtils.d.ts +8 -0
- package/dist/types/core-viewers/ultra/vim.d.ts +4 -5
- package/dist/types/utils/validation.d.ts +4 -4
- package/dist/vim-web.iife.js +235 -245
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +235 -245
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpcSafeClient } from './rpcSafeClient';
|
|
2
2
|
import { RemoteColor } from './remoteColor';
|
|
3
|
-
import
|
|
3
|
+
import * as THREE from 'three';
|
|
4
4
|
/**
|
|
5
5
|
* Manages the creation, caching, and deletion of color instances.
|
|
6
6
|
* Handles batched deletion of colors to optimize RPC calls.
|
|
@@ -21,14 +21,14 @@ export declare class ColorManager {
|
|
|
21
21
|
* @param hex - The RGBA32 color value
|
|
22
22
|
* @returns Promise resolving to a ColorHandle, or undefined if creation fails
|
|
23
23
|
*/
|
|
24
|
-
getColor(
|
|
24
|
+
getColor(color: THREE.Color): Promise<RemoteColor | undefined>;
|
|
25
25
|
/**
|
|
26
26
|
* Creates or retrieves cached color instances for multiple hex values.
|
|
27
|
-
* @param
|
|
27
|
+
* @param colors - Array of RGBA32 color values
|
|
28
28
|
* @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
|
|
29
29
|
* @remarks Duplicate hex values will be mapped to the same color instance for efficiency
|
|
30
30
|
*/
|
|
31
|
-
getColors(
|
|
31
|
+
getColors(colors: THREE.Color[]): Promise<RemoteColor[]>;
|
|
32
32
|
/**
|
|
33
33
|
* Retrieves a color instance by its unique identifier.
|
|
34
34
|
* @param id - The unique identifier of the color
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IVimElement } from "../shared/vim";
|
|
2
2
|
import { VisibilityState } from "./visibility";
|
|
3
|
-
import { Box3, RGBA32 } from "./rpcTypes";
|
|
4
3
|
import { Vim } from "./vim";
|
|
4
|
+
import * as THREE from "three";
|
|
5
5
|
/**
|
|
6
6
|
* Represents a single 3D element within a `Vim` model.
|
|
7
7
|
* Provides access to per-instance state, color, and bounding box.
|
|
@@ -33,12 +33,12 @@ export declare class Element3D implements IVimElement {
|
|
|
33
33
|
/**
|
|
34
34
|
* Gets or sets the color override of the element.
|
|
35
35
|
*/
|
|
36
|
-
get color():
|
|
37
|
-
set color(color:
|
|
36
|
+
get color(): THREE.Color | undefined;
|
|
37
|
+
set color(color: THREE.Color | undefined);
|
|
38
38
|
/**
|
|
39
39
|
* Computes and returns the bounding box of the element.
|
|
40
40
|
* Returns undefined if the element is abstract.
|
|
41
41
|
* @returns A promise resolving to the element's bounding box.
|
|
42
42
|
*/
|
|
43
|
-
getBoundingBox(): Promise<Box3 | undefined>;
|
|
43
|
+
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
44
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
2
|
export * from './viewer';
|
|
3
|
-
export {
|
|
3
|
+
export { Segment, type SectionBoxState, type HitCheckResult, type VimStatus } from './rpcTypes';
|
|
4
4
|
export { materialHandles, MaterialHandles, type MaterialHandle, } from './rpcClient';
|
|
5
5
|
export { InputMode, VimLoadingStatus } from './rpcSafeClient';
|
|
6
6
|
export { VisibilityState } from './visibility';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RGBA32 } from './rpcTypes';
|
|
2
1
|
import { ColorManager } from './colorManager';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a handle to a color in the color management system.
|
|
5
5
|
* This class provides access to color components and manages the lifecycle of color instances.
|
|
@@ -9,7 +9,7 @@ export declare class RemoteColor {
|
|
|
9
9
|
/** Unique identifier for the color instance */
|
|
10
10
|
readonly id: number;
|
|
11
11
|
/** The RGBA color value */
|
|
12
|
-
readonly color:
|
|
12
|
+
readonly color: THREE.Color;
|
|
13
13
|
private _disposed;
|
|
14
14
|
/**
|
|
15
15
|
* Indicates whether the color handle has been disposed.
|
|
@@ -21,33 +21,13 @@ export declare class RemoteColor {
|
|
|
21
21
|
* @returns {number} The color value as a hexadecimal number.
|
|
22
22
|
*/
|
|
23
23
|
get hex(): number;
|
|
24
|
-
/**
|
|
25
|
-
* Gets the red component of the color.
|
|
26
|
-
* @returns {number} The red component value in the range [0-255].
|
|
27
|
-
*/
|
|
28
|
-
get r(): number;
|
|
29
|
-
/**
|
|
30
|
-
* Gets the green component of the color.
|
|
31
|
-
* @returns {number} The green component value in the range [0-255].
|
|
32
|
-
*/
|
|
33
|
-
get g(): number;
|
|
34
|
-
/**
|
|
35
|
-
* Gets the blue component of the color.
|
|
36
|
-
* @returns {number} The blue component value in the range [0-255].
|
|
37
|
-
*/
|
|
38
|
-
get b(): number;
|
|
39
|
-
/**
|
|
40
|
-
* Gets the alpha (opacity) component of the color.
|
|
41
|
-
* @returns {number} The alpha component value in the range [0-255].
|
|
42
|
-
*/
|
|
43
|
-
get a(): number;
|
|
44
24
|
/**
|
|
45
25
|
* Creates a new ColorHandle instance.
|
|
46
26
|
* @param {RGBA32} color - The RGBA color value.
|
|
47
27
|
* @param {number} serverId - The unique identifier assigned by the server.
|
|
48
28
|
* @param {ColorManager} manager - The color manager instance that manages this color handle.
|
|
49
29
|
*/
|
|
50
|
-
constructor(color:
|
|
30
|
+
constructor(color: THREE.Color, serverId: number, manager: ColorManager);
|
|
51
31
|
/**
|
|
52
32
|
* Disposes of the color handle and releases associated resources.
|
|
53
33
|
* Once disposed, the color handle cannot be used anymore.
|
|
@@ -2,14 +2,14 @@ import { ISignal } from "ste-signals";
|
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import { ILogger } from "./logger";
|
|
4
4
|
import { RpcSafeClient, SceneSettings } from "./rpcSafeClient";
|
|
5
|
-
import { RGBA } from "./rpcTypes";
|
|
6
5
|
import { ClientStreamError } from "./socketClient";
|
|
7
6
|
/**
|
|
8
7
|
* Render settings that extend SceneSettings with additional rendering-specific properties
|
|
9
8
|
*/
|
|
10
9
|
export type RenderSettings = SceneSettings & {
|
|
11
10
|
/** Color used for ghost/transparent rendering */
|
|
12
|
-
ghostColor:
|
|
11
|
+
ghostColor: THREE.Color;
|
|
12
|
+
ghostOpacity: number;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Default rendering settings
|
|
@@ -20,13 +20,14 @@ export declare const defaultRenderSettings: RenderSettings;
|
|
|
20
20
|
*/
|
|
21
21
|
export interface IRenderer {
|
|
22
22
|
onSceneUpdated: ISignal;
|
|
23
|
-
ghostColor:
|
|
23
|
+
ghostColor: THREE.Color;
|
|
24
|
+
ghostOpacity: number;
|
|
24
25
|
hdrScale: number;
|
|
25
26
|
toneMappingWhitePoint: number;
|
|
26
27
|
hdrBackgroundScale: number;
|
|
27
28
|
hdrBackgroundSaturation: number;
|
|
28
29
|
backgroundBlur: number;
|
|
29
|
-
backgroundColor:
|
|
30
|
+
backgroundColor: THREE.Color;
|
|
30
31
|
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
@@ -60,9 +61,10 @@ export declare class Renderer implements IRenderer {
|
|
|
60
61
|
notifySceneUpdated(): void;
|
|
61
62
|
/**
|
|
62
63
|
* Gets the ghost color used for transparent rendering
|
|
63
|
-
* @returns Current ghost color as
|
|
64
|
+
* @returns Current ghost color as a THREE.Color
|
|
64
65
|
*/
|
|
65
|
-
get ghostColor():
|
|
66
|
+
get ghostColor(): THREE.Color;
|
|
67
|
+
get ghostOpacity(): number;
|
|
66
68
|
/**
|
|
67
69
|
* Gets the tone mapping white point value
|
|
68
70
|
* @returns Current tone mapping white point
|
|
@@ -92,12 +94,13 @@ export declare class Renderer implements IRenderer {
|
|
|
92
94
|
* Gets the background color
|
|
93
95
|
* @returns Current background color as RGBA
|
|
94
96
|
*/
|
|
95
|
-
get backgroundColor():
|
|
97
|
+
get backgroundColor(): THREE.Color;
|
|
96
98
|
/**
|
|
97
99
|
* Updates the ghost color used for transparent rendering
|
|
98
|
-
* @param value - New ghost color as
|
|
100
|
+
* @param value - New ghost color as THREE.Color
|
|
99
101
|
*/
|
|
100
|
-
set ghostColor(value:
|
|
102
|
+
set ghostColor(value: THREE.Color);
|
|
103
|
+
set ghostOpacity(value: number);
|
|
101
104
|
/**
|
|
102
105
|
* Sets the tone mapping white point value
|
|
103
106
|
* @param value - New tone mapping white point value
|
|
@@ -125,9 +128,9 @@ export declare class Renderer implements IRenderer {
|
|
|
125
128
|
set backgroundBlur(value: number);
|
|
126
129
|
/**
|
|
127
130
|
* Sets the background color
|
|
128
|
-
* @param value - New background color as
|
|
131
|
+
* @param value - New background color as THREE.Color
|
|
129
132
|
*/
|
|
130
|
-
set backgroundColor(value:
|
|
133
|
+
set backgroundColor(value: THREE.Color);
|
|
131
134
|
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
132
135
|
/**
|
|
133
136
|
* Requests an update to be performed on the next animation frame.
|
|
@@ -15,6 +15,8 @@ export declare class RGBA {
|
|
|
15
15
|
b: number;
|
|
16
16
|
a: number;
|
|
17
17
|
constructor(r: number, g: number, b: number, a?: number);
|
|
18
|
+
static fromThree(color: THREE.Color, opacity?: number): RGBA;
|
|
19
|
+
toThree(): THREE.Color;
|
|
18
20
|
clone(): RGBA;
|
|
19
21
|
isValid(): boolean;
|
|
20
22
|
equals(color: RGBA): boolean;
|
|
@@ -29,6 +31,7 @@ export declare class RGB {
|
|
|
29
31
|
export declare class RGBA32 {
|
|
30
32
|
readonly hex: number;
|
|
31
33
|
constructor(hex: number);
|
|
34
|
+
static fromThree(color: THREE.Color, opacity?: number): RGBA32;
|
|
32
35
|
static fromInts(r: number, g: number, b: number, a?: number): RGBA32;
|
|
33
36
|
static fromFloats(r: number, g: number, b: number, a?: number): RGBA32;
|
|
34
37
|
static fromString(str: string): RGBA32;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as rpcTypes from "./rpcTypes";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
export declare function RGBToThree(color: rpcTypes.RGB): THREE.Color;
|
|
4
|
+
export declare function RGBAToThree(color: rpcTypes.RGBA): THREE.Color;
|
|
5
|
+
export declare function RGBA32ToThree(color: rpcTypes.RGBA32): THREE.Color;
|
|
6
|
+
export declare function RGBfromThree(color: THREE.Color): rpcTypes.RGB;
|
|
7
|
+
export declare function RGBAfromThree(color: THREE.Color, opacity?: number): rpcTypes.RGBA;
|
|
8
|
+
export declare function RGBA32fromThree(color: THREE.Color, opacity?: number): rpcTypes.RGBA32;
|
|
@@ -7,7 +7,6 @@ import { VisibilitySynchronizer } from './visibility';
|
|
|
7
7
|
import { Renderer } from './renderer';
|
|
8
8
|
import { RpcSafeClient, VimSource } from './rpcSafeClient';
|
|
9
9
|
import * as THREE from 'three';
|
|
10
|
-
import { RGBA32 } from './rpcTypes';
|
|
11
10
|
export declare class Vim implements IVim<Element3D> {
|
|
12
11
|
readonly source: VimSource;
|
|
13
12
|
private _handle;
|
|
@@ -17,7 +16,7 @@ export declare class Vim implements IVim<Element3D> {
|
|
|
17
16
|
private _renderer;
|
|
18
17
|
private _logger;
|
|
19
18
|
readonly visibility: VisibilitySynchronizer;
|
|
20
|
-
private
|
|
19
|
+
private _elementColors;
|
|
21
20
|
private _updatedColors;
|
|
22
21
|
private _updateScheduled;
|
|
23
22
|
private _elementCount;
|
|
@@ -37,9 +36,9 @@ export declare class Vim implements IVim<Element3D> {
|
|
|
37
36
|
private _getHandle;
|
|
38
37
|
getBoundingBoxNodes(nodes: number[] | 'all'): Promise<THREE.Box3 | undefined>;
|
|
39
38
|
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
40
|
-
getColor(
|
|
41
|
-
setColor(
|
|
42
|
-
setColors(nodes: number[], color: (
|
|
39
|
+
getColor(elementIndex: number): THREE.Color | undefined;
|
|
40
|
+
setColor(elementIndex: number[], color: THREE.Color | undefined): Promise<void>;
|
|
41
|
+
setColors(nodes: number[], color: (THREE.Color | undefined)[]): Promise<void>;
|
|
43
42
|
private applyColor;
|
|
44
43
|
clearColor(elements: number[] | 'all'): void;
|
|
45
44
|
reapplyColors(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as Core from '../core-viewers';
|
|
3
|
+
import { RGBA } from '../core-viewers/ultra/rpcTypes';
|
|
3
4
|
export declare class Validation {
|
|
4
5
|
static isNumber(value: number): boolean;
|
|
5
6
|
static isPositiveNumber(value: number): boolean;
|
|
@@ -15,8 +16,6 @@ export declare class Validation {
|
|
|
15
16
|
static isValidVector3(value: THREE.Vector3): boolean;
|
|
16
17
|
static isValidBox(box: THREE.Box3): boolean;
|
|
17
18
|
static isValidSegment(segment: Core.Ultra.Segment): boolean;
|
|
18
|
-
static isRelativeRGBA(color: Core.Ultra.RGBA): boolean;
|
|
19
|
-
static isRelativeRGB(color: Core.Ultra.RGB): boolean;
|
|
20
19
|
static isNonEmptyString(value: string): boolean;
|
|
21
20
|
static isURL(value: string): boolean;
|
|
22
21
|
static areSameLength<T1, T2>(array: T1[], array2: T2[]): boolean;
|
|
@@ -24,6 +23,7 @@ export declare class Validation {
|
|
|
24
23
|
static clamp(min: number, max: number, value: number): number;
|
|
25
24
|
static clamp01(value: number): number;
|
|
26
25
|
static min0(value: number): number;
|
|
27
|
-
static
|
|
28
|
-
static
|
|
26
|
+
static clampColor01(value: THREE.Color): THREE.Color;
|
|
27
|
+
static clampRGBA01(value: RGBA): RGBA;
|
|
28
|
+
static clampRGB01(value: RGBA): RGBA;
|
|
29
29
|
}
|