@opentui/core 0.1.107 → 0.2.1

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.
@@ -1,124 +0,0 @@
1
- import * as THREE from "three";
2
- import { NodeMaterial } from "three/webgpu";
3
- import type { Scene } from "three";
4
- import { type SpriteResource, InstanceManager } from "../SpriteResourceManager.js";
5
- export interface AnimationStateConfig {
6
- imagePath: string;
7
- sheetNumFrames: number;
8
- animNumFrames: number;
9
- animFrameOffset: number;
10
- frameDuration?: number;
11
- loop?: boolean;
12
- initialFrame?: number;
13
- flipX?: boolean;
14
- flipY?: boolean;
15
- }
16
- export type ResolvedAnimationState = Required<AnimationStateConfig> & {
17
- sheetTilesetWidth: number;
18
- sheetTilesetHeight: number;
19
- texture: THREE.DataTexture;
20
- };
21
- export interface AnimationDefinition {
22
- resource: SpriteResource;
23
- animNumFrames?: number;
24
- animFrameOffset?: number;
25
- frameDuration?: number;
26
- loop?: boolean;
27
- initialFrame?: number;
28
- flipX?: boolean;
29
- flipY?: boolean;
30
- }
31
- export interface SpriteDefinition {
32
- id?: string;
33
- renderOrder?: number;
34
- depthWrite?: boolean;
35
- maxInstances?: number;
36
- scale?: number;
37
- initialAnimation: string;
38
- animations: Record<string, AnimationDefinition>;
39
- }
40
- declare class Animation {
41
- readonly name: string;
42
- state: ResolvedAnimationState;
43
- private resource;
44
- instanceIndex: number;
45
- private instanceManager;
46
- private frameAttribute;
47
- private flipAttribute;
48
- currentLocalFrame: number;
49
- timeAccumulator: number;
50
- isPlaying: boolean;
51
- private _isActive;
52
- constructor(name: string, state: ResolvedAnimationState, resource: SpriteResource, instanceIndex: number, instanceManager: InstanceManager, frameAttribute: THREE.InstancedBufferAttribute, flipAttribute: THREE.InstancedBufferAttribute);
53
- activate(worldTransform: THREE.Matrix4): void;
54
- deactivate(): void;
55
- updateVisuals(worldTransform: THREE.Matrix4): void;
56
- updateTime(deltaTimeMs: number): boolean;
57
- play(): void;
58
- stop(): void;
59
- goToFrame(localFrame: number): void;
60
- setFrameDuration(newFrameDuration: number): void;
61
- getResource(): SpriteResource;
62
- releaseInstanceSlot(): void;
63
- }
64
- export declare class TiledSprite {
65
- readonly id: string;
66
- private animator;
67
- private _animations;
68
- private _currentAnimation;
69
- private _transformObject;
70
- private _reusableMatrix;
71
- private _reusableAnimGeomScale;
72
- private _isVisibleState;
73
- private originalDefinition;
74
- constructor(id: string, userSpriteDefinition: SpriteDefinition, animator: SpriteAnimator, animationInstanceParams: Array<{
75
- name: string;
76
- state: ResolvedAnimationState;
77
- resource: SpriteResource;
78
- index: number;
79
- instanceManager: InstanceManager;
80
- frameAttribute: THREE.InstancedBufferAttribute;
81
- flipAttribute: THREE.InstancedBufferAttribute;
82
- }>);
83
- private _calculateAnimationWorldMatrix;
84
- get currentAnimation(): Animation;
85
- private updateCurrentAnimationVisuals;
86
- setPosition(position: THREE.Vector3): void;
87
- setRotation(rotation: THREE.Quaternion): void;
88
- setScale(scale: THREE.Vector3): void;
89
- getScale(): THREE.Vector3;
90
- setTransform(position: THREE.Vector3, rotation: THREE.Quaternion, newScale: THREE.Vector3): void;
91
- play(): void;
92
- stop(): void;
93
- goToFrame(frame: number): void;
94
- setFrameDuration(newFrameDuration: number): void;
95
- isPlaying(): boolean;
96
- setAnimation(animationName: string): Promise<void>;
97
- update(deltaTime: number): void;
98
- destroy(): void;
99
- getCurrentAnimationName(): string;
100
- getWorldTransform(): THREE.Matrix4;
101
- getWorldPlaneSize(): THREE.Vector2;
102
- get visible(): boolean;
103
- set visible(value: boolean);
104
- get definition(): SpriteDefinition;
105
- get currentTransform(): {
106
- position: THREE.Vector3;
107
- quaternion: THREE.Quaternion;
108
- scale: THREE.Vector3;
109
- };
110
- }
111
- export declare class SpriteAnimator {
112
- private scene;
113
- private instances;
114
- private _idCounter;
115
- private instanceManagers;
116
- constructor(scene: Scene);
117
- private createSpriteAnimationMaterial;
118
- private getOrCreateInstanceManager;
119
- createSprite(userSpriteDefinition: SpriteDefinition, materialFactory?: () => NodeMaterial): Promise<TiledSprite>;
120
- update(deltaTime: number): void;
121
- removeSprite(id: string): void;
122
- removeAllSprites(): void;
123
- }
124
- export {};
@@ -1,62 +0,0 @@
1
- import * as THREE from "three";
2
- import { NodeMaterial } from "three/webgpu";
3
- import type { SpriteResource } from "../SpriteResourceManager.js";
4
- export interface ParticleEffectParameters {
5
- resource: SpriteResource;
6
- animNumFrames?: number;
7
- animFrameOffset?: number;
8
- frameDuration?: number;
9
- loop?: boolean;
10
- scale?: number;
11
- renderOrder?: number;
12
- depthWrite?: boolean;
13
- maxParticles: number;
14
- lifetimeMsMin: number;
15
- lifetimeMsMax: number;
16
- origins: THREE.Vector3[];
17
- spawnRadius: number | THREE.Vector3;
18
- initialVelocityMin: THREE.Vector3;
19
- initialVelocityMax: THREE.Vector3;
20
- angularVelocityMin: THREE.Vector3;
21
- angularVelocityMax: THREE.Vector3;
22
- gravity?: THREE.Vector3;
23
- randomGravityFactorMinMax?: THREE.Vector2;
24
- scaleOverLifeMinMax?: THREE.Vector2;
25
- fadeOut?: boolean;
26
- materialFactory?: () => NodeMaterial;
27
- }
28
- export declare class SpriteParticleGenerator {
29
- private scene;
30
- private baseConfig;
31
- private autoSpawnConfig;
32
- private _currentOriginIndex;
33
- private instanceManager;
34
- private material;
35
- private texture;
36
- private particleDataAttribute;
37
- private velocityAttribute;
38
- private angularVelAttribute;
39
- private scaleDataAttribute;
40
- private timeUniform;
41
- private gravityUniform;
42
- private animationUniform;
43
- private sheetNumFramesUniform;
44
- private particleSlots;
45
- private currentTime;
46
- private maxParticles;
47
- private isInitialized;
48
- constructor(scene: THREE.Scene, initialBaseConfig: ParticleEffectParameters);
49
- private _ensureInitialized;
50
- private _initializeGPUParticleSystem;
51
- private _createGPUMaterial;
52
- private _resolveCurrentOrigin;
53
- getActiveParticleCount(): number;
54
- private _resolveSpawnRadius;
55
- private _spawnParticle;
56
- spawnParticles(count: number, overrides?: Partial<ParticleEffectParameters>): Promise<void>;
57
- setAutoSpawn(ratePerSecond: number, autoSpawnParamOverrides?: Partial<ParticleEffectParameters>): void;
58
- hasAutoSpawn(): boolean;
59
- stopAutoSpawn(): void;
60
- update(deltaTimeMs: number): Promise<void>;
61
- dispose(): void;
62
- }
package/3d/canvas.d.ts DELETED
@@ -1,44 +0,0 @@
1
- import { GPUCanvasContextMock } from "bun-webgpu";
2
- import { SuperSampleType } from "./WGPURenderer.js";
3
- import type { OptimizedBuffer } from "../buffer.js";
4
- export declare enum SuperSampleAlgorithm {
5
- STANDARD = 0,
6
- PRE_SQUEEZED = 1
7
- }
8
- export declare class CLICanvas {
9
- private device;
10
- private readbackBuffer;
11
- private width;
12
- private height;
13
- private gpuCanvasContext;
14
- superSampleDrawTimeMs: number;
15
- mapAsyncTimeMs: number;
16
- superSample: SuperSampleType;
17
- private computePipeline;
18
- private computeBindGroupLayout;
19
- private computeOutputBuffer;
20
- private computeParamsBuffer;
21
- private computeReadbackBuffer;
22
- private updateScheduled;
23
- private screenshotGPUBuffer;
24
- private superSampleAlgorithm;
25
- private destroyed;
26
- constructor(device: GPUDevice, width: number, height: number, superSample: SuperSampleType, sampleAlgo?: SuperSampleAlgorithm);
27
- destroy(): void;
28
- setSuperSampleAlgorithm(superSampleAlgorithm: SuperSampleAlgorithm): void;
29
- getSuperSampleAlgorithm(): SuperSampleAlgorithm;
30
- getContext(type: string, attrs?: WebGLContextAttributes): GPUCanvasContextMock;
31
- setSize(width: number, height: number): void;
32
- addEventListener(event: string, listener: any, options?: any): void;
33
- removeEventListener(event: string, listener: any, options?: any): void;
34
- dispatchEvent(event: Event): void;
35
- setSuperSample(superSample: SuperSampleType): void;
36
- saveToFile(filePath: string): Promise<void>;
37
- private initComputePipeline;
38
- private updateComputeParams;
39
- private scheduleUpdateComputeBuffers;
40
- private updateComputeBuffers;
41
- private runComputeShaderSuperSampling;
42
- private updateReadbackBuffer;
43
- readPixelsIntoBuffer(buffer: OptimizedBuffer): Promise<void>;
44
- }
package/3d/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- export * from "./WGPURenderer.js";
2
- export * from "./ThreeRenderable.js";
3
- export * from "./TextureUtils.js";
4
- export * from "./canvas.js";
5
- export * from "./SpriteUtils.js";
6
- export * from "./animation/SpriteAnimator.js";
7
- export * from "./animation/ExplodingSpriteEffect.js";
8
- export * from "./animation/SpriteParticleGenerator.js";
9
- export * from "./animation/PhysicsExplodingSpriteEffect.js";
10
- export * from "./physics/RapierPhysicsAdapter.js";
11
- export * from "./physics/PlanckPhysicsAdapter.js";
12
- export * from "./SpriteResourceManager.js";
@@ -1,19 +0,0 @@
1
- import * as planck from "planck";
2
- import type { PhysicsVector2, PhysicsRigidBodyDesc, PhysicsColliderDesc, PhysicsRigidBody, PhysicsWorld } from "./physics-interface.js";
3
- export declare class PlanckRigidBody implements PhysicsRigidBody {
4
- private planckBody;
5
- constructor(planckBody: planck.Body);
6
- applyImpulse(force: PhysicsVector2): void;
7
- applyTorqueImpulse(torque: number): void;
8
- getTranslation(): PhysicsVector2;
9
- getRotation(): number;
10
- get nativeBody(): planck.Body;
11
- }
12
- export declare class PlanckPhysicsWorld implements PhysicsWorld {
13
- private planckWorld;
14
- constructor(planckWorld: planck.World);
15
- createRigidBody(desc: PhysicsRigidBodyDesc): PhysicsRigidBody;
16
- createCollider(colliderDesc: PhysicsColliderDesc, rigidBody: PhysicsRigidBody): void;
17
- removeRigidBody(rigidBody: PhysicsRigidBody): void;
18
- static createFromPlanckWorld(planckWorld: planck.World): PlanckPhysicsWorld;
19
- }
@@ -1,19 +0,0 @@
1
- import RAPIER from "@dimforge/rapier2d-simd-compat";
2
- import type { PhysicsVector2, PhysicsRigidBodyDesc, PhysicsColliderDesc, PhysicsRigidBody, PhysicsWorld } from "./physics-interface.js";
3
- export declare class RapierRigidBody implements PhysicsRigidBody {
4
- private rapierBody;
5
- constructor(rapierBody: RAPIER.RigidBody);
6
- applyImpulse(force: PhysicsVector2): void;
7
- applyTorqueImpulse(torque: number): void;
8
- getTranslation(): PhysicsVector2;
9
- getRotation(): number;
10
- get nativeBody(): RAPIER.RigidBody;
11
- }
12
- export declare class RapierPhysicsWorld implements PhysicsWorld {
13
- private rapierWorld;
14
- constructor(rapierWorld: RAPIER.World);
15
- createRigidBody(desc: PhysicsRigidBodyDesc): PhysicsRigidBody;
16
- createCollider(colliderDesc: PhysicsColliderDesc, rigidBody: PhysicsRigidBody): void;
17
- removeRigidBody(rigidBody: PhysicsRigidBody): void;
18
- static createFromRapierWorld(rapierWorld: RAPIER.World): RapierPhysicsWorld;
19
- }
@@ -1,27 +0,0 @@
1
- export interface PhysicsVector2 {
2
- x: number;
3
- y: number;
4
- }
5
- export interface PhysicsRigidBodyDesc {
6
- translation: PhysicsVector2;
7
- linearDamping: number;
8
- angularDamping: number;
9
- }
10
- export interface PhysicsColliderDesc {
11
- width: number;
12
- height: number;
13
- restitution: number;
14
- friction: number;
15
- density: number;
16
- }
17
- export interface PhysicsRigidBody {
18
- applyImpulse(force: PhysicsVector2): void;
19
- applyTorqueImpulse(torque: number): void;
20
- getTranslation(): PhysicsVector2;
21
- getRotation(): number;
22
- }
23
- export interface PhysicsWorld {
24
- createRigidBody(desc: PhysicsRigidBodyDesc): PhysicsRigidBody;
25
- createCollider(colliderDesc: PhysicsColliderDesc, rigidBody: PhysicsRigidBody): void;
26
- removeRigidBody(rigidBody: PhysicsRigidBody): void;
27
- }
package/3d.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./3d/index.js";
2
- export * as THREE from "three";