@faeyumbrea/lib-camera-api-types 1.14.1 → 1.14.2

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/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { CameraView3D } from './camera-3d.js';
2
- import type { LocalConsumer } from './controller.js';
1
+ import type { Camera3DStatus, CameraView3D } from './camera-3d.js';
2
+ import type { CameraController, LocalConsumer } from './controller.js';
3
3
  import type { CameraBounds, FrameOptions } from './framing.js';
4
4
  import type { CameraPosition } from './movement.js';
5
5
  import type { ConsumerOptions } from './ownership.js';
@@ -11,6 +11,12 @@ export interface ModuleApi {
11
11
  set3DRemote: RemoteCamera['set3D'];
12
12
  observeUser: RemoteCamera['watch'];
13
13
  followUser: RemoteCamera['followUser'];
14
+ /** Observe a user’s native 3D viewport without taking camera ownership. */
15
+ observeUser3D: RemoteCamera['watch3D'];
16
+ /** Copy a user’s native 3D view while holding a libCamera claim. */
17
+ followUser3D: RemoteCamera['followUser3D'];
18
+ /** Fit the current scene using a registered consumer's camera ownership and movement options. */
19
+ fitScene: CameraController['fitScene'];
14
20
  /** Compute views without taking ownership or moving the camera. */
15
21
  frame: (bounds: readonly CameraBounds[], options?: FrameOptions) => CameraPosition | undefined;
16
22
  frameTokens: (tokenIds: readonly string[], options?: FrameOptions) => CameraPosition | undefined;
@@ -20,6 +26,8 @@ export interface ModuleApi {
20
26
  read: () => Readonly<CameraPosition> | undefined;
21
27
  /** Native 3D position and look-at target; absent unless 3D Canvas is active and ready. */
22
28
  read3D: () => Readonly<CameraView3D> | undefined;
29
+ /** Current 3D availability without inspecting the adapter or moving the camera. */
30
+ get3DStatus: () => Camera3DStatus;
23
31
  tokenPosition: (tokenId: string) => Readonly<{
24
32
  x: number;
25
33
  y: number;
package/camera-3d.d.ts CHANGED
@@ -9,6 +9,8 @@ export interface CameraView3D {
9
9
  position: Readonly<Vector3D>;
10
10
  target: Readonly<Vector3D>;
11
11
  }
12
+ /** Availability of native 3D camera control, reported to consuming modules. */
13
+ export type Camera3DStatus = 'inactive' | 'unavailable' | 'unsupported-mode' | 'ready';
12
14
  export type CameraResult3D = {
13
15
  status: 'completed';
14
16
  view: Readonly<CameraView3D>;
@@ -50,6 +52,8 @@ export declare class Camera3D {
50
52
  readonly getCanvas: () => Canvas3D | undefined;
51
53
  constructor(getCanvas: () => Canvas3D | undefined);
52
54
  read(): Readonly<CameraView3D> | undefined;
55
+ /** Reports whether 3D Canvas is inactive, loading, in an unsupported mode or controllable. */
56
+ status(): Camera3DStatus;
53
57
  availability(): 'unavailable' | 'unsupported-mode' | undefined;
54
58
  /**
55
59
  * Immediate write through native orbit controls, which may constrain the result.
package/controller.d.ts CHANGED
@@ -6,6 +6,8 @@ import { CameraCoordinator } from './ownership.js';
6
6
  export interface CameraSession extends CameraClaim {
7
7
  /** Replace this claim's current movement, continuing from the actual view. */
8
8
  retarget: (options: MoveOptions, signal?: AbortSignal) => Promise<MovementResult>;
9
+ /** Fit the full scene through this session, replacing its current movement. */
10
+ fitScene: (options?: Pick<MoveOptions, 'duration' | 'easing' | 'level' | 'bounds' | 'lockInput'>, signal?: AbortSignal) => Promise<MovementResult>;
9
11
  set3D: (view: CameraView3D) => CameraResult3D;
10
12
  move: (options: MoveOptions, signal?: AbortSignal) => Promise<MovementResult>;
11
13
  }
@@ -44,6 +46,8 @@ export declare class CameraController {
44
46
  readonly consumers: Map<string, LocalConsumer>;
45
47
  constructor(adapter: CameraAdapter, getUserId: () => string | undefined, camera3D?: Camera3D | undefined);
46
48
  read(): Readonly<CameraPosition> | undefined;
49
+ /** Fit the current scene through a registered consumer's normal ownership and movement checks. */
50
+ fitScene(consumerId: string, options?: Pick<MoveOptions, 'duration' | 'easing' | 'level' | 'bounds' | 'lockInput'>, signal?: AbortSignal): ReturnType<LocalConsumer['move']>;
47
51
  register(options: ConsumerOptions): LocalConsumer;
48
52
  releaseLocal(): void;
49
53
  panic(): void;
package/movement.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CameraBounds } from './framing.js';
1
+ import type { CameraBounds, FrameOptions } from './framing.js';
2
2
  import type { CameraClaim, ReleaseReason } from './ownership.js';
3
3
  export interface CameraPosition {
4
4
  x: number;
@@ -31,6 +31,8 @@ export type MovementResult = {
31
31
  /** Boundary to Foundry. Adapters must stop writing synchronously when aborted. */
32
32
  export interface CameraAdapter {
33
33
  read: () => Readonly<CameraPosition> | undefined;
34
+ /** Compute the view fitting the current scene without moving the camera. */
35
+ frameScene?: (options?: FrameOptions) => CameraPosition | undefined;
34
36
  pan: (position: CameraPosition) => void;
35
37
  animate: (position: CameraPosition, options: Required<Pick<MoveOptions, 'duration' | 'easing'>>, signal: AbortSignal) => Promise<boolean>;
36
38
  lockInput: () => () => void;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@faeyumbrea/lib-camera-api-types",
3
- "version": "1.14.1",
4
- "description": "Public API declarations for libCamera 1.14.1 on Foundry 14.",
3
+ "version": "1.14.2",
4
+ "description": "Public API declarations for libCamera 1.14.2 on Foundry 14.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/FaeyUmbrea/foundry-lib-camera.git"
9
9
  },
10
- "homepage": "https://docs.void.monster/lib-camera/public/1.14.1/dev/",
10
+ "homepage": "https://docs.void.monster/lib-camera/public/1.14.2/dev/",
11
11
  "types": "./public-api.d.ts",
12
12
  "exports": {
13
13
  ".": {
package/public-api.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export type { ModuleApi } from './api.js';
2
- export type { CameraResult3D, CameraView3D, Vector3D } from './camera-3d.js';
2
+ export type { Camera3DStatus, CameraResult3D, CameraView3D, Vector3D } from './camera-3d.js';
3
3
  export type { CameraSession, LocalConsumer, SessionResult } from './controller.js';
4
4
  export type { CameraFollow } from './follow.js';
5
5
  export type { CameraBounds, FrameOptions, ViewDimensions } from './framing.js';
6
6
  export type { CameraPosition, MovementResult, MoveOptions } from './movement.js';
7
7
  export type { CameraClaim, CameraConsumer, ClaimResult, ClaimSnapshot, ConsumerOptions, ConsumerSnapshot, Diagnostic, PriorityOverride, RejectionReason, ReleaseReason, } from './ownership.js';
8
8
  export type { CameraCoordinator } from './ownership.js';
9
- export type { RemoteOptions, RemoteOutcome, RemoteUserResult, ViewportSample, ViewportSubscription } from './remote.js';
9
+ export type { RemoteOptions, RemoteOutcome, RemoteUserResult, ViewportSample, ViewportSample3D, ViewportSubscription } from './remote.js';
10
10
  export type { TrackingMode } from './viewport-filter.js';
@@ -0,0 +1,5 @@
1
+ import type { CameraSession } from './controller.js';
2
+ import type { CameraFollow } from './follow.js';
3
+ import type { ViewportSample3D, ViewportSubscription } from './remote.js';
4
+ /** Copy native 3D samples from the current scene, releasing the claim and subscription on stop. */
5
+ export declare function followRemote3D(session: CameraSession, subscribe: (callback: (sample: ViewportSample3D) => void) => ViewportSubscription, sceneId: () => string | undefined): CameraFollow;
package/remote.d.ts CHANGED
@@ -21,6 +21,12 @@ export interface ViewportSample {
21
21
  sceneId: string;
22
22
  position: Readonly<CameraPosition>;
23
23
  }
24
+ /** Native 3D view from a responding user on a particular scene. */
25
+ export interface ViewportSample3D {
26
+ userId: string;
27
+ sceneId: string;
28
+ view: Readonly<CameraView3D> | null;
29
+ }
24
30
  export interface ViewportSubscription {
25
31
  stop: () => void;
26
32
  }
@@ -33,6 +39,7 @@ export interface RemoteEnvironment {
33
39
  }[];
34
40
  sceneId: () => string | undefined;
35
41
  read: () => Readonly<CameraPosition> | undefined;
42
+ read3D?: () => Readonly<CameraView3D> | undefined;
36
43
  emit: (packet: object, recipients: string[]) => void;
37
44
  }
38
45
  /** Foundry supplies sender identity as the second socket callback argument. Never read it from payloads. */
@@ -44,8 +51,18 @@ export declare class RemoteCamera {
44
51
  move(consumer: string, targets: string | readonly string[], options: MoveOptions, remote?: RemoteOptions): Promise<RemoteUserResult[]>;
45
52
  set3D(consumer: string, targets: string | readonly string[], view: CameraView3D, remote?: RemoteOptions): Promise<RemoteUserResult[]>;
46
53
  watch(userId: string, callback: (sample: ViewportSample) => void, mode?: TrackingMode): ViewportSubscription;
47
- /** Follow the latest responding session of a user on this scene; all sessions remain addressable together. */
48
- followUser(consumerId: string, userId: string, options?: Pick<MoveOptions, 'duration' | 'easing' | 'bounds' | 'lockInput'>, mode?: TrackingMode): {
54
+ /** Subscribe to native 3D samples; sender identity is checked before delivering each sample. */
55
+ watch3D(userId: string, callback: (sample: ViewportSample3D) => void): ViewportSubscription;
56
+ /** Acquire a camera claim and copy a user's native 3D samples until stopped or preempted. */
57
+ followUser3D(consumerId: string, userId: string): {
58
+ ok: false;
59
+ reason: import("./ownership.js").RejectionReason | "unavailable";
60
+ } | {
61
+ ok: true;
62
+ follow: import("./follow.js").CameraFollow;
63
+ };
64
+ /** Follow the most recently changed viewport among the consumer-selected users on this scene. */
65
+ followUser(consumerId: string, userId: string | readonly string[], options?: Pick<MoveOptions, 'duration' | 'easing' | 'bounds' | 'lockInput'>, mode?: TrackingMode): {
49
66
  ok: true;
50
67
  follow: import("./follow.js").CameraFollow;
51
68
  } | {