uzay 0.1.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/core/atom-wrapper.d.ts +38 -0
- package/dist/core/common-types/axes.d.ts +3 -0
- package/dist/core/common-types/colors.d.ts +1 -0
- package/dist/core/common-types/drag-utils.d.ts +4 -0
- package/dist/core/common-types/interaction-events.d.ts +37 -0
- package/dist/core/common-types/item-registry.d.ts +49 -0
- package/dist/core/common-types/overlay.d.ts +3 -0
- package/dist/core/common-types/tags.d.ts +1 -0
- package/dist/core/common-types/vec2.d.ts +17 -0
- package/dist/core/common-types/vec3.d.ts +17 -0
- package/dist/core/item.d.ts +27 -0
- package/dist/core/items/axes3d.d.ts +39 -0
- package/dist/core/items/camera3d.d.ts +43 -0
- package/dist/core/items/grid3d.d.ts +47 -0
- package/dist/core/items/line3d.d.ts +37 -0
- package/dist/core/items/overlay3d.d.ts +51 -0
- package/dist/core/items/parametric-function3d.d.ts +45 -0
- package/dist/core/items/plane3d.d.ts +46 -0
- package/dist/core/items/point3d.d.ts +44 -0
- package/dist/core/items/sphere3d.d.ts +37 -0
- package/dist/core/items/vector3d.d.ts +52 -0
- package/dist/core/renderers/axes3d.d.ts +2 -0
- package/dist/core/renderers/camera3d.d.ts +2 -0
- package/dist/core/renderers/grid3d.d.ts +2 -0
- package/dist/core/renderers/index.d.ts +99 -0
- package/dist/core/renderers/line3d.d.ts +2 -0
- package/dist/core/renderers/overlay3d.d.ts +2 -0
- package/dist/core/renderers/parametric-function3d.d.ts +2 -0
- package/dist/core/renderers/plane3d.d.ts +2 -0
- package/dist/core/renderers/point3d.d.ts +2 -0
- package/dist/core/renderers/sphere3d.d.ts +2 -0
- package/dist/core/renderers/vector3d.d.ts +2 -0
- package/dist/core/scene3d.d.ts +23 -0
- package/dist/core/view3d.d.ts +78 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +27209 -0
- package/package.json +42 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Atom, type PrimitiveAtom, type WritableAtom } from "jotai";
|
|
2
|
+
import { type createStore } from "jotai/vanilla";
|
|
3
|
+
export type Store = ReturnType<typeof createStore>;
|
|
4
|
+
type Getter = <Value>(atom: Atom<Value>) => Value;
|
|
5
|
+
type Setter = <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
6
|
+
type AnyAtom = Atom<unknown>;
|
|
7
|
+
type SetAtom<Args extends unknown[], Result> = <A extends Args>(...args: A) => Result;
|
|
8
|
+
type Read<Value, SetSelf = never> = (get: Getter, options: {
|
|
9
|
+
readonly signal: AbortSignal;
|
|
10
|
+
readonly setSelf: SetSelf;
|
|
11
|
+
}) => Value;
|
|
12
|
+
type Write<Args extends unknown[], Result> = (get: Getter, set: Setter, ...args: Args) => Result;
|
|
13
|
+
type WithInitialValue<Value> = {
|
|
14
|
+
init: Value;
|
|
15
|
+
};
|
|
16
|
+
export type BoundAtom<A extends AnyAtom> = A & {
|
|
17
|
+
get: () => A extends Atom<infer V> ? V : never;
|
|
18
|
+
sub: (listener: () => void) => () => void;
|
|
19
|
+
} & (A extends WritableAtom<any, infer Args, infer Result> ? {
|
|
20
|
+
set: (...args: Args) => Result;
|
|
21
|
+
} : {});
|
|
22
|
+
export declare function createSceneAtom(store: Store): {
|
|
23
|
+
<Value, Args extends unknown[], Result>(read: Read<Value, SetAtom<Args, Result>>, write: Write<Args, Result>): BoundAtom<WritableAtom<Value, Args, Result>>;
|
|
24
|
+
<Value>(read: Read<Value>): BoundAtom<Atom<Value>>;
|
|
25
|
+
<Value, Args extends unknown[], Result>(initialValue: Value, write: Write<Args, Result>): BoundAtom<WritableAtom<Value, Args, Result> & WithInitialValue<Value>>;
|
|
26
|
+
<Value>(): BoundAtom<PrimitiveAtom<Value | undefined> & WithInitialValue<Value | undefined>>;
|
|
27
|
+
<Value>(initialValue: Value): BoundAtom<PrimitiveAtom<Value> & WithInitialValue<Value>>;
|
|
28
|
+
};
|
|
29
|
+
export type SceneAtomFunction = ReturnType<typeof createSceneAtom>;
|
|
30
|
+
export type SceneAtom<T> = BoundAtom<Atom<T>>;
|
|
31
|
+
export type AtomLikeInput<V> = V | BoundAtom<Atom<V>>;
|
|
32
|
+
export type AtomLikeOptions<T extends object> = {
|
|
33
|
+
[K in keyof T]?: AtomLikeInput<T[K]>;
|
|
34
|
+
};
|
|
35
|
+
export type AtomizeResult<V, In> = In extends BoundAtom<infer A> ? BoundAtom<A & Atom<V>> : BoundAtom<PrimitiveAtom<V>>;
|
|
36
|
+
type OptOrDefault<Opts, K extends PropertyKey, D> = K extends keyof Opts ? Opts[K] : D;
|
|
37
|
+
export type Field<T, K extends string, Opts> = AtomizeResult<T, OptOrDefault<Opts, K, T>>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Color = string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PointDraggableDir } from "./axes";
|
|
2
|
+
import type { Vec3 } from "./vec3";
|
|
3
|
+
/** Apply axis/plane constraint to a target position relative to a current position. */
|
|
4
|
+
export declare function applyDragConstraint(current: Vec3, target: Vec3, constraint: PointDraggableDir): Vec3;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ItemId, ItemKind } from "./item-registry";
|
|
2
|
+
import type { Vec3 } from "./vec3";
|
|
3
|
+
import type { Vec2 } from "./vec2";
|
|
4
|
+
type BaseInteractionEvent<K extends ItemKind = ItemKind> = {
|
|
5
|
+
itemId: ItemId;
|
|
6
|
+
itemKind: K;
|
|
7
|
+
worldPosition: Vec3;
|
|
8
|
+
screenPosition: Vec2;
|
|
9
|
+
ray: {
|
|
10
|
+
origin: Vec3;
|
|
11
|
+
direction: Vec3;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type DragEvent<K extends ItemKind = ItemKind> = BaseInteractionEvent<K> & {
|
|
15
|
+
type: "drag";
|
|
16
|
+
phase: "start" | "move" | "end";
|
|
17
|
+
startWorldPosition: Vec3;
|
|
18
|
+
delta: Vec3;
|
|
19
|
+
};
|
|
20
|
+
export type ClickEvent<K extends ItemKind = ItemKind> = BaseInteractionEvent<K> & {
|
|
21
|
+
type: "click";
|
|
22
|
+
};
|
|
23
|
+
export type HoverEvent<K extends ItemKind = ItemKind> = BaseInteractionEvent<K> & {
|
|
24
|
+
type: "hover";
|
|
25
|
+
phase: "enter" | "move" | "leave";
|
|
26
|
+
};
|
|
27
|
+
export type InteractionEvent<K extends ItemKind = ItemKind> = DragEvent<K> | ClickEvent<K> | HoverEvent<K>;
|
|
28
|
+
export type InteractionEventType = "drag" | "click" | "hover";
|
|
29
|
+
export type DragHandler<K extends ItemKind = ItemKind> = (event: DragEvent<K>) => void;
|
|
30
|
+
export type ClickHandler<K extends ItemKind = ItemKind> = (event: ClickEvent<K>) => void;
|
|
31
|
+
export type HoverHandler<K extends ItemKind = ItemKind> = (event: HoverEvent<K>) => void;
|
|
32
|
+
export type InteractionHandler<K extends ItemKind = ItemKind> = {
|
|
33
|
+
drag: DragHandler<K>;
|
|
34
|
+
click: ClickHandler<K>;
|
|
35
|
+
hover: HoverHandler<K>;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Point3DFields, type Point3DOptions, Point3D } from "../items/point3d";
|
|
2
|
+
import { type Line3DFields, type Line3DOptions, Line3D } from "../items/line3d";
|
|
3
|
+
import { type Camera3DFields, type Camera3DOptions, Camera3D } from "../items/camera3d";
|
|
4
|
+
import { type ParametricFunction3DFields, type ParametricFunction3DOptions, ParametricFunction3D } from "../items/parametric-function3d";
|
|
5
|
+
import { type Axes3DFields, type Axes3DOptions, Axes3D } from "../items/axes3d";
|
|
6
|
+
import { type Grid3DFields, type Grid3DOptions, Grid3D } from "../items/grid3d";
|
|
7
|
+
import { type Sphere3DFields, type Sphere3DOptions, Sphere3D } from "../items/sphere3d";
|
|
8
|
+
import { type Vector3DFields, type Vector3DOptions, Vector3D } from "../items/vector3d";
|
|
9
|
+
import { type Overlay3DFields, type Overlay3DOptions, Overlay3D } from "../items/overlay3d";
|
|
10
|
+
import { type Plane3DFields, type Plane3DOptions, Plane3D } from "../items/plane3d";
|
|
11
|
+
import type { Scene3D } from "../scene3d";
|
|
12
|
+
import type { AtomLikeOptions } from "../atom-wrapper";
|
|
13
|
+
export type ItemId = string;
|
|
14
|
+
export type ItemKind = "point3d" | "line3d" | "camera3d" | "parametricfunction3d" | "axes3d" | "grid3d" | "sphere3d" | "vector3d" | "overlay3d" | "plane3d";
|
|
15
|
+
export type ItemFieldsMap = {
|
|
16
|
+
point3d: Point3DFields;
|
|
17
|
+
line3d: Line3DFields;
|
|
18
|
+
camera3d: Camera3DFields;
|
|
19
|
+
parametricfunction3d: ParametricFunction3DFields;
|
|
20
|
+
axes3d: Axes3DFields;
|
|
21
|
+
grid3d: Grid3DFields;
|
|
22
|
+
sphere3d: Sphere3DFields;
|
|
23
|
+
vector3d: Vector3DFields;
|
|
24
|
+
overlay3d: Overlay3DFields;
|
|
25
|
+
plane3d: Plane3DFields;
|
|
26
|
+
};
|
|
27
|
+
export type ItemFields<K extends ItemKind> = ItemFieldsMap[K];
|
|
28
|
+
export type ItemOptions<K extends ItemKind> = AtomLikeOptions<ItemFieldsMap[K]>;
|
|
29
|
+
export type ItemSnapshot<K extends ItemKind = ItemKind> = K extends ItemKind ? {
|
|
30
|
+
id: ItemId;
|
|
31
|
+
kind: K;
|
|
32
|
+
isDirty: boolean;
|
|
33
|
+
} & ItemFields<K> : never;
|
|
34
|
+
export declare const itemFactory: {
|
|
35
|
+
readonly point3d: <Opts extends Point3DOptions>(scene: Scene3D, options: Opts) => Point3D<Opts>;
|
|
36
|
+
readonly line3d: <Opts extends Line3DOptions>(scene: Scene3D, options: Opts) => Line3D<Opts>;
|
|
37
|
+
readonly camera3d: <Opts extends Camera3DOptions>(scene: Scene3D, options: Opts) => Camera3D<Opts>;
|
|
38
|
+
readonly parametricfunction3d: <Opts extends ParametricFunction3DOptions>(scene: Scene3D, options: Opts) => ParametricFunction3D<Opts>;
|
|
39
|
+
readonly axes3d: <Opts extends Axes3DOptions>(scene: Scene3D, options: Opts) => Axes3D<Opts>;
|
|
40
|
+
readonly grid3d: <Opts extends Grid3DOptions>(scene: Scene3D, options: Opts) => Grid3D<Opts>;
|
|
41
|
+
readonly sphere3d: <Opts extends Sphere3DOptions>(scene: Scene3D, options: Opts) => Sphere3D<Opts>;
|
|
42
|
+
readonly vector3d: <Opts extends Vector3DOptions>(scene: Scene3D, options: Opts) => Vector3D<Opts>;
|
|
43
|
+
readonly overlay3d: <Opts extends Overlay3DOptions>(scene: Scene3D, options: Opts) => Overlay3D<Opts>;
|
|
44
|
+
readonly plane3d: <Opts extends Plane3DOptions>(scene: Scene3D, options: Opts) => Plane3D<Opts>;
|
|
45
|
+
};
|
|
46
|
+
export type ItemFactory<K extends ItemKind> = (typeof itemFactory)[K];
|
|
47
|
+
export type ItemInstance<K extends ItemKind, Opts extends ItemOptions<K>> = K extends "point3d" ? Point3D<Opts> : K extends "line3d" ? Line3D<Opts> : K extends "camera3d" ? Camera3D<Opts> : K extends "parametricfunction3d" ? ParametricFunction3D<Opts> : K extends "axes3d" ? Axes3D<Opts> : K extends "grid3d" ? Grid3D<Opts> : K extends "sphere3d" ? Sphere3D<Opts> : K extends "vector3d" ? Vector3D<Opts> : K extends "overlay3d" ? Overlay3D<Opts> : K extends "plane3d" ? Plane3D<Opts> : never;
|
|
48
|
+
export type ItemInstanceOf<K extends ItemKind = ItemKind> = K extends ItemKind ? ItemInstance<K, ItemOptions<K>> : never;
|
|
49
|
+
export type Item = ItemInstanceOf<ItemKind>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ItemTags = Array<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type Vec2 = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export declare function vec2(x: number, y: number): Vec2;
|
|
6
|
+
export declare namespace Vec2 {
|
|
7
|
+
const ZERO: Readonly<Vec2>;
|
|
8
|
+
const ONE: Readonly<Vec2>;
|
|
9
|
+
function add(...vectors: Vec2[]): Vec2;
|
|
10
|
+
function subtract(a: Vec2, b: Vec2): Vec2;
|
|
11
|
+
function normalized(vec: Vec2): Vec2;
|
|
12
|
+
function scaled(vec: Vec2, scalar: number): Vec2;
|
|
13
|
+
function dot(a: Vec2, b: Vec2): number;
|
|
14
|
+
function cross(a: Vec2, b: Vec2): number;
|
|
15
|
+
function distance(a: Vec2, b: Vec2): number;
|
|
16
|
+
function distanceSquared(a: Vec2, b: Vec2): number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type Vec3 = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
z: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function vec3(x: number, y: number, z: number): Vec3;
|
|
7
|
+
export declare namespace Vec3 {
|
|
8
|
+
const ZERO: Readonly<Vec3>;
|
|
9
|
+
const ONE: Readonly<Vec3>;
|
|
10
|
+
function asArray(vec: Vec3): [number, number, number];
|
|
11
|
+
function add(...vectors: Vec3[]): Vec3;
|
|
12
|
+
function subtract(a: Vec3, b: Vec3): Vec3;
|
|
13
|
+
function normalized(vec: Vec3): Vec3;
|
|
14
|
+
function scaled(vec: Vec3, scalar: number): Vec3;
|
|
15
|
+
function dot(a: Vec3, b: Vec3): number;
|
|
16
|
+
function cross(a: Vec3, b: Vec3): Vec3;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Atom } from "jotai";
|
|
2
|
+
import type { Store } from "jotai/vanilla/store";
|
|
3
|
+
import type { BoundAtom } from "./atom-wrapper";
|
|
4
|
+
import type { ItemId, ItemKind, ItemSnapshot } from "./common-types/item-registry";
|
|
5
|
+
import type { InteractionEventType, InteractionHandler, DragHandler, ClickHandler, HoverHandler, DragEvent, ClickEvent, HoverEvent } from "./common-types/interaction-events";
|
|
6
|
+
export declare abstract class BaseItem<T, K extends ItemKind> {
|
|
7
|
+
abstract kind: K;
|
|
8
|
+
id: ItemId;
|
|
9
|
+
isDirty: boolean;
|
|
10
|
+
invalidateScene: () => void;
|
|
11
|
+
store?: Store;
|
|
12
|
+
eventHandlers: Map<InteractionEventType, DragHandler | ClickHandler | HoverHandler>;
|
|
13
|
+
markDirty(): void;
|
|
14
|
+
atomFields: Set<BoundAtom<Atom<any>>>;
|
|
15
|
+
addAtomFields(...fields: BoundAtom<Atom<any>>[]): void;
|
|
16
|
+
atomSceneSubscriptions: Set<() => void>;
|
|
17
|
+
setupAtomInvalidations(invalidateScene: () => void): void;
|
|
18
|
+
removeFromScene(): void;
|
|
19
|
+
on<E extends InteractionEventType>(event: E, handler: InteractionHandler<K>[E]): void;
|
|
20
|
+
off(event: InteractionEventType): void;
|
|
21
|
+
getHandler<E extends InteractionEventType>(event: E): InteractionHandler<K>[E] | undefined;
|
|
22
|
+
getCursorState(): string | null;
|
|
23
|
+
handleDrag?(event: DragEvent<K>): void;
|
|
24
|
+
handleClick?(event: ClickEvent<K>): void;
|
|
25
|
+
handleHover?(event: HoverEvent<K>): void;
|
|
26
|
+
abstract getItemSnapshot(): ItemSnapshot<K>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Color } from "../common-types/colors";
|
|
2
|
+
import type { ItemTags } from "../common-types/tags";
|
|
3
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
4
|
+
import { BaseItem } from "../item";
|
|
5
|
+
import type { Scene3D } from "../scene3d";
|
|
6
|
+
export type PointerEvents = "auto" | "none";
|
|
7
|
+
export type Axes3DFields = {
|
|
8
|
+
tags: ItemTags;
|
|
9
|
+
x: boolean | [number, number];
|
|
10
|
+
y: boolean | [number, number];
|
|
11
|
+
z: boolean | [number, number];
|
|
12
|
+
color: Color;
|
|
13
|
+
thickness: number;
|
|
14
|
+
pointerEvents: PointerEvents;
|
|
15
|
+
};
|
|
16
|
+
export type Axes3DOptions = AtomLikeOptions<Axes3DFields>;
|
|
17
|
+
export declare class Axes3D<Opts extends Axes3DOptions = {}> extends BaseItem<Axes3DFields, "axes3d"> {
|
|
18
|
+
kind: "axes3d";
|
|
19
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
20
|
+
x: Field<boolean | [number, number], "x", Opts>;
|
|
21
|
+
y: Field<boolean | [number, number], "y", Opts>;
|
|
22
|
+
z: Field<boolean | [number, number], "z", Opts>;
|
|
23
|
+
color: Field<Color, "color", Opts>;
|
|
24
|
+
thickness: Field<number, "thickness", Opts>;
|
|
25
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
26
|
+
constructor(scene: Scene3D, options?: Opts & Axes3DOptions);
|
|
27
|
+
getItemSnapshot(): {
|
|
28
|
+
id: string;
|
|
29
|
+
kind: "axes3d";
|
|
30
|
+
isDirty: boolean;
|
|
31
|
+
tags: ItemTags;
|
|
32
|
+
x: boolean | [number, number];
|
|
33
|
+
y: boolean | [number, number];
|
|
34
|
+
z: boolean | [number, number];
|
|
35
|
+
color: string;
|
|
36
|
+
thickness: number;
|
|
37
|
+
pointerEvents: PointerEvents;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
2
|
+
import { type Vec3 } from "../common-types/vec3";
|
|
3
|
+
import type { Scene3D } from "../scene3d";
|
|
4
|
+
import { BaseItem } from "../item";
|
|
5
|
+
type CameraProjection = "perspective" | "orthogonal";
|
|
6
|
+
type CameraControls = "orbit" | "pan";
|
|
7
|
+
export type Camera3DFields = {
|
|
8
|
+
position: Vec3;
|
|
9
|
+
lookAt: Vec3;
|
|
10
|
+
projection: CameraProjection;
|
|
11
|
+
controls: CameraControls;
|
|
12
|
+
fov: number;
|
|
13
|
+
zoom: number;
|
|
14
|
+
near: number;
|
|
15
|
+
far: number;
|
|
16
|
+
};
|
|
17
|
+
export type Camera3DOptions = AtomLikeOptions<Camera3DFields>;
|
|
18
|
+
export declare class Camera3D<Opts extends Camera3DOptions = {}> extends BaseItem<Camera3DFields, "camera3d"> {
|
|
19
|
+
kind: "camera3d";
|
|
20
|
+
position: Field<Vec3, "position", Opts>;
|
|
21
|
+
lookAt: Field<Vec3, "lookAt", Opts>;
|
|
22
|
+
projection: Field<CameraProjection, "projection", Opts>;
|
|
23
|
+
controls: Field<CameraControls, "controls", Opts>;
|
|
24
|
+
fov: Field<number, "fov", Opts>;
|
|
25
|
+
zoom: Field<number, "zoom", Opts>;
|
|
26
|
+
near: Field<number, "near", Opts>;
|
|
27
|
+
far: Field<number, "far", Opts>;
|
|
28
|
+
constructor(scene: Scene3D, options?: Opts & Camera3DOptions);
|
|
29
|
+
getItemSnapshot(): {
|
|
30
|
+
id: string;
|
|
31
|
+
kind: "camera3d";
|
|
32
|
+
isDirty: boolean;
|
|
33
|
+
position: Vec3;
|
|
34
|
+
lookAt: Vec3;
|
|
35
|
+
projection: CameraProjection;
|
|
36
|
+
controls: CameraControls;
|
|
37
|
+
fov: number;
|
|
38
|
+
zoom: number;
|
|
39
|
+
near: number;
|
|
40
|
+
far: number;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
2
|
+
import type { Color } from "../common-types/colors";
|
|
3
|
+
import type { ItemTags } from "../common-types/tags";
|
|
4
|
+
import type { Scene3D } from "../scene3d";
|
|
5
|
+
import { BaseItem } from "../item";
|
|
6
|
+
type PlaneDir = "xy" | "xz" | "yz";
|
|
7
|
+
export type PointerEvents = "auto" | "none";
|
|
8
|
+
export type Grid3DFields = {
|
|
9
|
+
tags: ItemTags;
|
|
10
|
+
plane: PlaneDir;
|
|
11
|
+
range1: boolean | [number, number];
|
|
12
|
+
range2: boolean | [number, number];
|
|
13
|
+
offset: number;
|
|
14
|
+
gap: number;
|
|
15
|
+
color: Color;
|
|
16
|
+
thickness: number;
|
|
17
|
+
pointerEvents: PointerEvents;
|
|
18
|
+
};
|
|
19
|
+
export type Grid3DOptions = AtomLikeOptions<Grid3DFields>;
|
|
20
|
+
export declare class Grid3D<Opts extends Grid3DOptions = {}> extends BaseItem<Grid3DFields, "grid3d"> {
|
|
21
|
+
kind: "grid3d";
|
|
22
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
23
|
+
plane: Field<PlaneDir, "plane", Opts>;
|
|
24
|
+
range1: Field<boolean | [number, number], "range1", Opts>;
|
|
25
|
+
range2: Field<boolean | [number, number], "range2", Opts>;
|
|
26
|
+
gap: Field<number, "gap", Opts>;
|
|
27
|
+
offset: Field<number, "offset", Opts>;
|
|
28
|
+
color: Field<Color, "color", Opts>;
|
|
29
|
+
thickness: Field<number, "thickness", Opts>;
|
|
30
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
31
|
+
constructor(scene: Scene3D, options?: Opts & Grid3DOptions);
|
|
32
|
+
getItemSnapshot(): {
|
|
33
|
+
id: string;
|
|
34
|
+
kind: "grid3d";
|
|
35
|
+
isDirty: boolean;
|
|
36
|
+
tags: ItemTags;
|
|
37
|
+
plane: PlaneDir;
|
|
38
|
+
range1: boolean | [number, number];
|
|
39
|
+
range2: boolean | [number, number];
|
|
40
|
+
offset: number;
|
|
41
|
+
gap: number;
|
|
42
|
+
color: string;
|
|
43
|
+
thickness: number;
|
|
44
|
+
pointerEvents: PointerEvents;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ItemTags } from "../common-types/tags";
|
|
2
|
+
import { type Vec3 } from "../common-types/vec3";
|
|
3
|
+
import type { Color } from "../common-types/colors";
|
|
4
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
5
|
+
import { BaseItem } from "../item";
|
|
6
|
+
import type { Scene3D } from "../scene3d";
|
|
7
|
+
export type PointerEvents = "auto" | "none";
|
|
8
|
+
export type Line3DFields = {
|
|
9
|
+
tags: ItemTags;
|
|
10
|
+
start: Vec3;
|
|
11
|
+
end: Vec3;
|
|
12
|
+
color: Color;
|
|
13
|
+
thickness: number;
|
|
14
|
+
pointerEvents: PointerEvents;
|
|
15
|
+
};
|
|
16
|
+
export type Line3DOptions = AtomLikeOptions<Line3DFields>;
|
|
17
|
+
export declare class Line3D<Opts extends Line3DOptions = {}> extends BaseItem<Line3DFields, "line3d"> {
|
|
18
|
+
kind: "line3d";
|
|
19
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
20
|
+
start: Field<Vec3, "start", Opts>;
|
|
21
|
+
end: Field<Vec3, "end", Opts>;
|
|
22
|
+
color: Field<Color, "color", Opts>;
|
|
23
|
+
thickness: Field<number, "thickness", Opts>;
|
|
24
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
25
|
+
constructor(scene: Scene3D, options?: Opts & Line3DOptions);
|
|
26
|
+
getItemSnapshot(): {
|
|
27
|
+
id: string;
|
|
28
|
+
kind: "line3d";
|
|
29
|
+
isDirty: boolean;
|
|
30
|
+
tags: ItemTags;
|
|
31
|
+
start: Vec3;
|
|
32
|
+
end: Vec3;
|
|
33
|
+
color: string;
|
|
34
|
+
thickness: number;
|
|
35
|
+
pointerEvents: PointerEvents;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ItemTags } from "../common-types/tags";
|
|
2
|
+
import { type Vec3 } from "../common-types/vec3";
|
|
3
|
+
import { type Vec2 } from "../common-types/vec2";
|
|
4
|
+
import type { OverlayAnchor, OverlayFormat } from "../common-types/overlay";
|
|
5
|
+
import type { PointerEvents } from "./point3d";
|
|
6
|
+
import { BaseItem } from "../item";
|
|
7
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
8
|
+
import type { Scene3D } from "../scene3d";
|
|
9
|
+
export type Overlay3DFields = {
|
|
10
|
+
tags: ItemTags;
|
|
11
|
+
position: Vec3;
|
|
12
|
+
content: string;
|
|
13
|
+
format: OverlayFormat;
|
|
14
|
+
offset: Vec2;
|
|
15
|
+
anchor: OverlayAnchor;
|
|
16
|
+
visible: boolean;
|
|
17
|
+
className: string;
|
|
18
|
+
style: string;
|
|
19
|
+
pointerEvents: PointerEvents;
|
|
20
|
+
};
|
|
21
|
+
export type Overlay3DOptions = AtomLikeOptions<Overlay3DFields>;
|
|
22
|
+
export declare class Overlay3D<Opts extends Overlay3DOptions = {}> extends BaseItem<Overlay3DFields, "overlay3d"> {
|
|
23
|
+
kind: "overlay3d";
|
|
24
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
25
|
+
position: Field<Vec3, "position", Opts>;
|
|
26
|
+
content: Field<string, "content", Opts>;
|
|
27
|
+
format: Field<OverlayFormat, "format", Opts>;
|
|
28
|
+
offset: Field<Vec2, "offset", Opts>;
|
|
29
|
+
anchor: Field<OverlayAnchor, "anchor", Opts>;
|
|
30
|
+
visible: Field<boolean, "visible", Opts>;
|
|
31
|
+
className: Field<string, "className", Opts>;
|
|
32
|
+
style: Field<string, "style", Opts>;
|
|
33
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
34
|
+
constructor(scene: Scene3D, options?: Opts & Overlay3DOptions);
|
|
35
|
+
getItemSnapshot(): {
|
|
36
|
+
id: string;
|
|
37
|
+
kind: "overlay3d";
|
|
38
|
+
isDirty: boolean;
|
|
39
|
+
tags: ItemTags;
|
|
40
|
+
position: Vec3;
|
|
41
|
+
content: string;
|
|
42
|
+
format: OverlayFormat;
|
|
43
|
+
offset: Vec2;
|
|
44
|
+
anchor: OverlayAnchor;
|
|
45
|
+
visible: boolean;
|
|
46
|
+
className: string;
|
|
47
|
+
style: string;
|
|
48
|
+
pointerEvents: PointerEvents;
|
|
49
|
+
};
|
|
50
|
+
getCursorState(): null;
|
|
51
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
2
|
+
import type { Color } from "../common-types/colors";
|
|
3
|
+
import type { ItemTags } from "../common-types/tags";
|
|
4
|
+
import type { Vec3 } from "../common-types/vec3";
|
|
5
|
+
import { BaseItem } from "../item";
|
|
6
|
+
import type { Scene3D } from "../scene3d";
|
|
7
|
+
type ParametricFunction3DFunc = (t: number) => Vec3;
|
|
8
|
+
export type PointerEvents = "auto" | "none";
|
|
9
|
+
export type ParametricFunction3DFields = {
|
|
10
|
+
tags: ItemTags;
|
|
11
|
+
f: ParametricFunction3DFunc;
|
|
12
|
+
tStart: number;
|
|
13
|
+
tEnd: number;
|
|
14
|
+
color: Color;
|
|
15
|
+
thickness: number;
|
|
16
|
+
samples: number;
|
|
17
|
+
pointerEvents: PointerEvents;
|
|
18
|
+
};
|
|
19
|
+
export type ParametricFunction3DOptions = AtomLikeOptions<ParametricFunction3DFields>;
|
|
20
|
+
export declare class ParametricFunction3D<Opts extends ParametricFunction3DOptions = {}> extends BaseItem<ParametricFunction3DFields, "parametricfunction3d"> {
|
|
21
|
+
kind: "parametricfunction3d";
|
|
22
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
23
|
+
f: Field<ParametricFunction3DFunc, "f", Opts>;
|
|
24
|
+
tStart: Field<number, "tStart", Opts>;
|
|
25
|
+
tEnd: Field<number, "tEnd", Opts>;
|
|
26
|
+
color: Field<Color, "color", Opts>;
|
|
27
|
+
thickness: Field<number, "thickness", Opts>;
|
|
28
|
+
samples: Field<number, "samples", Opts>;
|
|
29
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
30
|
+
constructor(scene: Scene3D, options?: Opts & ParametricFunction3DOptions);
|
|
31
|
+
getItemSnapshot(): {
|
|
32
|
+
id: string;
|
|
33
|
+
kind: "parametricfunction3d";
|
|
34
|
+
isDirty: boolean;
|
|
35
|
+
tags: ItemTags;
|
|
36
|
+
f: ParametricFunction3DFunc;
|
|
37
|
+
tStart: number;
|
|
38
|
+
tEnd: number;
|
|
39
|
+
color: string;
|
|
40
|
+
thickness: number;
|
|
41
|
+
samples: number;
|
|
42
|
+
pointerEvents: PointerEvents;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Color } from "../common-types/colors";
|
|
2
|
+
import type { ItemTags } from "../common-types/tags";
|
|
3
|
+
import { type Vec3 } from "../common-types/vec3";
|
|
4
|
+
import { BaseItem } from "../item";
|
|
5
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
6
|
+
import type { Scene3D } from "../scene3d";
|
|
7
|
+
export type PointerEvents = "auto" | "none";
|
|
8
|
+
export type Plane3DFields = {
|
|
9
|
+
tags: ItemTags;
|
|
10
|
+
point: Vec3;
|
|
11
|
+
normal: Vec3;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
color: Color;
|
|
15
|
+
opacity: number;
|
|
16
|
+
showEdges: boolean;
|
|
17
|
+
pointerEvents: PointerEvents;
|
|
18
|
+
};
|
|
19
|
+
export type Plane3DOptions = AtomLikeOptions<Plane3DFields>;
|
|
20
|
+
export declare class Plane3D<Opts extends Plane3DOptions = {}> extends BaseItem<Plane3DFields, "plane3d"> {
|
|
21
|
+
kind: "plane3d";
|
|
22
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
23
|
+
point: Field<Vec3, "point", Opts>;
|
|
24
|
+
normal: Field<Vec3, "normal", Opts>;
|
|
25
|
+
width: Field<number, "width", Opts>;
|
|
26
|
+
height: Field<number, "height", Opts>;
|
|
27
|
+
color: Field<Color, "color", Opts>;
|
|
28
|
+
opacity: Field<number, "opacity", Opts>;
|
|
29
|
+
showEdges: Field<boolean, "showEdges", Opts>;
|
|
30
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
31
|
+
constructor(scene: Scene3D, options?: Opts & Plane3DOptions);
|
|
32
|
+
getItemSnapshot(): {
|
|
33
|
+
id: string;
|
|
34
|
+
kind: "plane3d";
|
|
35
|
+
isDirty: boolean;
|
|
36
|
+
tags: ItemTags;
|
|
37
|
+
point: Vec3;
|
|
38
|
+
normal: Vec3;
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
color: string;
|
|
42
|
+
opacity: number;
|
|
43
|
+
showEdges: boolean;
|
|
44
|
+
pointerEvents: PointerEvents;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PointDraggableDir } from "../common-types/axes";
|
|
2
|
+
import type { Color } from "../common-types/colors";
|
|
3
|
+
import type { ItemTags } from "../common-types/tags";
|
|
4
|
+
import { type Vec3 } from "../common-types/vec3";
|
|
5
|
+
import { BaseItem } from "../item";
|
|
6
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
7
|
+
import type { Scene3D } from "../scene3d";
|
|
8
|
+
import type { ClickEvent, DragEvent } from "../common-types/interaction-events";
|
|
9
|
+
export type PointerEvents = "auto" | "none";
|
|
10
|
+
export type Point3DFields = {
|
|
11
|
+
tags: ItemTags;
|
|
12
|
+
coords: Vec3;
|
|
13
|
+
draggable: PointDraggableDir;
|
|
14
|
+
color: Color;
|
|
15
|
+
radius: number;
|
|
16
|
+
pointerEvents: PointerEvents;
|
|
17
|
+
};
|
|
18
|
+
export type Point3DOptions = AtomLikeOptions<Point3DFields>;
|
|
19
|
+
export declare class Point3D<Opts extends Point3DOptions = {}> extends BaseItem<Point3DFields, "point3d"> {
|
|
20
|
+
kind: "point3d";
|
|
21
|
+
warnedReadOnly: boolean;
|
|
22
|
+
private _dragOffset;
|
|
23
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
24
|
+
coords: Field<Vec3, "coords", Opts>;
|
|
25
|
+
draggable: Field<PointDraggableDir, "draggable", Opts>;
|
|
26
|
+
color: Field<Color, "color", Opts>;
|
|
27
|
+
radius: Field<number, "radius", Opts>;
|
|
28
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
29
|
+
constructor(scene: Scene3D, options?: Opts & Point3DOptions);
|
|
30
|
+
getItemSnapshot(): {
|
|
31
|
+
id: string;
|
|
32
|
+
kind: "point3d";
|
|
33
|
+
isDirty: boolean;
|
|
34
|
+
coords: Vec3;
|
|
35
|
+
tags: ItemTags;
|
|
36
|
+
draggable: PointDraggableDir;
|
|
37
|
+
color: string;
|
|
38
|
+
radius: number;
|
|
39
|
+
pointerEvents: PointerEvents;
|
|
40
|
+
};
|
|
41
|
+
getCursorState(): "grab" | null;
|
|
42
|
+
handleClick(event: ClickEvent<"point3d">): void;
|
|
43
|
+
handleDrag(event: DragEvent<"point3d">): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Color } from "../common-types/colors";
|
|
2
|
+
import type { ItemTags } from "../common-types/tags";
|
|
3
|
+
import { type Vec3 } from "../common-types/vec3";
|
|
4
|
+
import { BaseItem } from "../item";
|
|
5
|
+
import type { AtomLikeOptions, Field } from "../atom-wrapper";
|
|
6
|
+
import type { Scene3D } from "../scene3d";
|
|
7
|
+
export type PointerEvents = "auto" | "none";
|
|
8
|
+
export type Sphere3DFields = {
|
|
9
|
+
tags: ItemTags;
|
|
10
|
+
center: Vec3;
|
|
11
|
+
radius: number;
|
|
12
|
+
color: Color;
|
|
13
|
+
opacity: number;
|
|
14
|
+
pointerEvents: PointerEvents;
|
|
15
|
+
};
|
|
16
|
+
export type Sphere3DOptions = AtomLikeOptions<Sphere3DFields>;
|
|
17
|
+
export declare class Sphere3D<Opts extends Sphere3DOptions = {}> extends BaseItem<Sphere3DFields, "sphere3d"> {
|
|
18
|
+
kind: "sphere3d";
|
|
19
|
+
tags: Field<ItemTags, "tags", Opts>;
|
|
20
|
+
center: Field<Vec3, "center", Opts>;
|
|
21
|
+
radius: Field<number, "radius", Opts>;
|
|
22
|
+
color: Field<Color, "color", Opts>;
|
|
23
|
+
opacity: Field<number, "opacity", Opts>;
|
|
24
|
+
pointerEvents: Field<PointerEvents, "pointerEvents", Opts>;
|
|
25
|
+
constructor(scene: Scene3D, options?: Opts & Sphere3DOptions);
|
|
26
|
+
getItemSnapshot(): {
|
|
27
|
+
id: string;
|
|
28
|
+
kind: "sphere3d";
|
|
29
|
+
isDirty: boolean;
|
|
30
|
+
tags: ItemTags;
|
|
31
|
+
center: Vec3;
|
|
32
|
+
radius: number;
|
|
33
|
+
color: string;
|
|
34
|
+
opacity: number;
|
|
35
|
+
pointerEvents: PointerEvents;
|
|
36
|
+
};
|
|
37
|
+
}
|