@xmaxai/sdk 0.1.0 → 1.0.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.
@@ -1,2 +1,2 @@
1
- export { D as DragTrackController, a as DragTrackControllerOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, y as syncDragSurfaceToVideo } from '../index-Dai62Sos.cjs';
1
+ export { D as DragTrackController, a as DragTrackControllerOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, y as syncDragSurfaceToVideo } from '../index-BEgtCLkJ.cjs';
2
2
  import '../rtc-manager-gYDkADGw.cjs';
@@ -1,2 +1,2 @@
1
- export { D as DragTrackController, a as DragTrackControllerOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, y as syncDragSurfaceToVideo } from '../index-BIUk_kvb.js';
1
+ export { D as DragTrackController, a as DragTrackControllerOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, y as syncDragSurfaceToVideo } from '../index-D9wwNTfP.js';
2
2
  import '../rtc-manager-gYDkADGw.js';
@@ -1,5 +1,5 @@
1
- export { RealtimePrewarmHandle, RealtimeSession, createRemoteViewHost, createXmaxClient, observeDragSurfaceVideoSync, syncDragSurfaceToVideo } from '../chunk-74ZZWUPI.js';
2
- export { createDragTrackController, getContentRect, mapTargetPointToCanvas, mapViewportPointToCoordinateSpace, models } from '../chunk-67XSD3QJ.js';
1
+ export { RealtimePrewarmHandle, RealtimeSession, createRemoteViewHost, createXmaxClient, observeDragSurfaceVideoSync, syncDragSurfaceToVideo } from '../chunk-7X7QCO3O.js';
2
+ export { createDragTrackController, getContentRect, mapTargetPointToCanvas, mapViewportPointToCoordinateSpace, models } from '../chunk-M5QA6LWS.js';
3
3
  import '../chunk-PLU2YVAS.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -259,8 +259,6 @@ type DragTrackControllerOptions = {
259
259
  fitMode?: 'contain' | 'cover';
260
260
  mirrored?: boolean;
261
261
  enabled?: boolean;
262
- /** When idle (no active pointers), still emit `onTracks([])` on each sample tick. */
263
- emitEmptyTracksWhenIdle?: boolean;
264
262
  onTracks: (tracks: Array<[number, number]>) => void | Promise<void>;
265
263
  };
266
264
  declare class DragTrackController {
@@ -271,7 +269,6 @@ declare class DragTrackController {
271
269
  private fitMode;
272
270
  private mirrored;
273
271
  private enabled;
274
- private emitEmptyTracksWhenIdle;
275
272
  private readonly activePointers;
276
273
  private readonly lastTargetPoints;
277
274
  private readonly segQueue;
@@ -286,7 +283,6 @@ declare class DragTrackController {
286
283
  private readonly onPointerCancel;
287
284
  constructor(container: HTMLElement, options: DragTrackControllerOptions);
288
285
  setEnabled(enabled: boolean): void;
289
- setEmitEmptyTracksWhenIdle(emitEmptyTracksWhenIdle: boolean): void;
290
286
  setTargetSize(targetSize: [number, number]): void;
291
287
  setFitMode(fitMode: 'contain' | 'cover'): void;
292
288
  setMirrored(mirrored: boolean): void;
@@ -259,8 +259,6 @@ type DragTrackControllerOptions = {
259
259
  fitMode?: 'contain' | 'cover';
260
260
  mirrored?: boolean;
261
261
  enabled?: boolean;
262
- /** When idle (no active pointers), still emit `onTracks([])` on each sample tick. */
263
- emitEmptyTracksWhenIdle?: boolean;
264
262
  onTracks: (tracks: Array<[number, number]>) => void | Promise<void>;
265
263
  };
266
264
  declare class DragTrackController {
@@ -271,7 +269,6 @@ declare class DragTrackController {
271
269
  private fitMode;
272
270
  private mirrored;
273
271
  private enabled;
274
- private emitEmptyTracksWhenIdle;
275
272
  private readonly activePointers;
276
273
  private readonly lastTargetPoints;
277
274
  private readonly segQueue;
@@ -286,7 +283,6 @@ declare class DragTrackController {
286
283
  private readonly onPointerCancel;
287
284
  constructor(container: HTMLElement, options: DragTrackControllerOptions);
288
285
  setEnabled(enabled: boolean): void;
289
- setEmitEmptyTracksWhenIdle(emitEmptyTracksWhenIdle: boolean): void;
290
286
  setTargetSize(targetSize: [number, number]): void;
291
287
  setFitMode(fitMode: 'contain' | 'cover'): void;
292
288
  setMirrored(mirrored: boolean): void;
package/dist/index.cjs CHANGED
@@ -3789,7 +3789,6 @@ var DragTrackController = class {
3789
3789
  this.fitMode = options.fitMode ?? "cover";
3790
3790
  this.mirrored = options.mirrored ?? false;
3791
3791
  this.enabled = options.enabled ?? true;
3792
- this.emitEmptyTracksWhenIdle = options.emitEmptyTracksWhenIdle ?? false;
3793
3792
  this.canvas = document.createElement("canvas");
3794
3793
  this.canvas.className = "Xmax-drag-track-canvas";
3795
3794
  this.canvas.style.cssText = "position:absolute;inset:0;z-index:21;width:100%;height:100%;pointer-events:none;";
@@ -3803,32 +3802,12 @@ var DragTrackController = class {
3803
3802
  this.bindResizeObserver();
3804
3803
  this.bindPointerEvents();
3805
3804
  this.applyInteractionStyle();
3806
- if (this.enabled && this.emitEmptyTracksWhenIdle) {
3807
- this.startSampling();
3808
- }
3809
3805
  }
3810
3806
  setEnabled(enabled) {
3811
3807
  this.enabled = enabled;
3812
3808
  this.applyInteractionStyle();
3813
3809
  if (!enabled) {
3814
- this.finishStroke({ stopIdleSampling: true });
3815
- return;
3816
- }
3817
- if (this.emitEmptyTracksWhenIdle && this.activePointers.size === 0) {
3818
- this.startSampling();
3819
- }
3820
- }
3821
- setEmitEmptyTracksWhenIdle(emitEmptyTracksWhenIdle) {
3822
- if (this.emitEmptyTracksWhenIdle === emitEmptyTracksWhenIdle) {
3823
- return;
3824
- }
3825
- this.emitEmptyTracksWhenIdle = emitEmptyTracksWhenIdle;
3826
- if (emitEmptyTracksWhenIdle && this.enabled && this.activePointers.size === 0) {
3827
- this.startSampling();
3828
- return;
3829
- }
3830
- if (!emitEmptyTracksWhenIdle && this.activePointers.size === 0) {
3831
- this.stopSampling();
3810
+ this.finishStroke();
3832
3811
  }
3833
3812
  }
3834
3813
  setTargetSize(targetSize) {
@@ -3841,7 +3820,7 @@ var DragTrackController = class {
3841
3820
  this.mirrored = mirrored;
3842
3821
  }
3843
3822
  destroy() {
3844
- this.finishStroke({ stopIdleSampling: true });
3823
+ this.finishStroke();
3845
3824
  this.unbindPointerEvents();
3846
3825
  this.unbindResizeObserver();
3847
3826
  this.canvas.remove();
@@ -3958,7 +3937,7 @@ var DragTrackController = class {
3958
3937
  return;
3959
3938
  }
3960
3939
  const tracks = this.collectCurrentTracks();
3961
- if (!tracks.length && !this.emitEmptyTracksWhenIdle) {
3940
+ if (!tracks.length) {
3962
3941
  return;
3963
3942
  }
3964
3943
  this.sampleInFlight = true;
@@ -3976,11 +3955,8 @@ var DragTrackController = class {
3976
3955
  this.flushTracks();
3977
3956
  }, 30);
3978
3957
  }
3979
- finishStroke(options) {
3980
- const stopIdleSampling = options?.stopIdleSampling ?? !this.emitEmptyTracksWhenIdle;
3981
- if (stopIdleSampling) {
3982
- this.stopSampling();
3983
- }
3958
+ finishStroke() {
3959
+ this.stopSampling();
3984
3960
  this.stopDrawLoop();
3985
3961
  this.segQueue.length = 0;
3986
3962
  this.clearCanvas();