js.foresight-devtools 1.0.4 → 1.0.6

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement, TemplateResult, PropertyValues } from 'lit';
3
- import { ForesightEvent, ForesightElementData, ForesightManagerSettings as ForesightManagerSettings$2 } from 'js.foresight';
4
- import { ForesightEvent as ForesightEvent$1, HitSlop as HitSlop$1, UpdatedDataPropertyNames, CallbackHitType, Point, ScrollDirection, ForesightManagerSettings as ForesightManagerSettings$1 } from 'js.foresight/types/types';
3
+ import { ForesightEvent, ForesightElementData, ForesightManagerSettings as ForesightManagerSettings$1 } from 'js.foresight';
4
+ import { ForesightEvent as ForesightEvent$1, HitSlop, UpdatedDataPropertyNames, CallbackHitType, Point, ScrollDirection, ForesightManagerSettings, UpdatedManagerSetting, CallbackHits, ForesightElementData as ForesightElementData$1 } from 'js.foresight/types/types';
5
5
 
6
6
  type DeepPartial<T> = T extends object ? {
7
7
  [P in keyof T]?: DeepPartial<T[P]>;
@@ -236,100 +236,7 @@ declare global {
236
236
  }
237
237
  }
238
238
 
239
- type Rect = {
240
- top: number;
241
- left: number;
242
- right: number;
243
- bottom: number;
244
- };
245
- type BaseForesightManagerSettings = {
246
- /**
247
- * Number of mouse positions to keep in history for trajectory calculation.
248
- * A higher number might lead to smoother but slightly delayed predictions.
249
- *
250
- *
251
- * @link https://foresightjs.com/docs/getting_started/config#available-global-settings
252
- *
253
- *
254
- * **This value is clamped between 2 and 30.**
255
- * @default 8
256
- */
257
- positionHistorySize: number;
258
- /**
259
- *
260
- * @deprecated will be removed from v4.0
261
- * ForesightJS now have its stand-alone devtools library with the debugger built-in
262
- * @link https://github.com/spaansba/ForesightJS-DevTools
263
- */
264
- debug: boolean;
265
- /**
266
- * How far ahead (in milliseconds) to predict the mouse trajectory.
267
- * A larger value means the prediction extends further into the future. (meaning it will trigger callbacks sooner)
268
- *
269
- * @link https://foresightjs.com/docs/getting_started/config#available-global-settings
270
- *
271
- * **This value is clamped between 10 and 200.**
272
- * @default 120
273
- */
274
- trajectoryPredictionTime: number;
275
- /**
276
- * Whether to enable mouse trajectory prediction.
277
- * If false, only direct hover/interaction is considered.
278
- * @link https://foresightjs.com/docs/getting_started/config#available-global-settings
279
- * @default true
280
- */
281
- enableMousePrediction: boolean;
282
- /**
283
- * Toggles whether keyboard prediction is on
284
- *
285
- * @link https://foresightjs.com/docs/getting_started/config#available-global-settings
286
- * @default true
287
- */
288
- enableTabPrediction: boolean;
289
- /**
290
- * Sets the pixel distance to check from the mouse position in the scroll direction.
291
- *
292
- * @link https://foresightjs.com/docs/getting_started/config#available-global-settings
293
- *
294
- * **This value is clamped between 30 and 300.**
295
- * @default 150
296
- */
297
- scrollMargin: number;
298
- /**
299
- * Toggles whether scroll prediction is on
300
- * @link https://foresightjs.com/docs/getting_started/config#available-global-settings
301
- * @default true
302
- */
303
- enableScrollPrediction: boolean;
304
- /**
305
- * Tab stops away from an element to trigger callback. Only works when @argument enableTabPrediction is true
306
- *
307
- * **This value is clamped between 0 and 20.**
308
- * @default 2
309
- */
310
- tabOffset: number;
311
- };
312
- /**
313
- * Configuration options for the ForesightManager
314
- * @link https://foresightjs.com/docs/getting_started/config#available-global-settings
315
- */
316
- type ForesightManagerSettings = BaseForesightManagerSettings & {
317
- defaultHitSlop: Exclude<HitSlop, number>;
318
- };
319
- /**
320
- * Fully invisible "slop" around the element.
321
- * Basically increases the hover hitbox
322
- */
323
- type HitSlop = Rect | number;
324
- type UpdatedManagerSetting = {
325
- [K in keyof ForesightManagerSettings]: {
326
- setting: K;
327
- newValue: ForesightManagerSettings[K];
328
- oldValue: ForesightManagerSettings[K];
329
- };
330
- }[keyof ForesightManagerSettings];
331
-
332
- type SerializedEventType = ForesightEvent$1 | "serializationError";
239
+ type SerializedEventType = ForesightEvent$1 | "serializationError" | "managerDataPayload";
333
240
  interface PayloadBase {
334
241
  type: SerializedEventType;
335
242
  localizedTimestamp: string;
@@ -341,7 +248,8 @@ interface ElementRegisteredPayload extends PayloadBase {
341
248
  name: string;
342
249
  id: string;
343
250
  registerCount: number;
344
- hitslop: HitSlop$1;
251
+ hitslop: HitSlop;
252
+ meta: Record<string, unknown>;
345
253
  }
346
254
  interface ElementUnregisteredPayload extends PayloadBase {
347
255
  type: "elementUnregistered";
@@ -350,17 +258,20 @@ interface ElementUnregisteredPayload extends PayloadBase {
350
258
  registerCount: number;
351
259
  unregisterReason: string;
352
260
  wasLastElement: boolean;
261
+ meta: Record<string, unknown>;
353
262
  }
354
263
  interface ElementDataUpdatedPayload extends PayloadBase {
355
264
  type: "elementDataUpdated";
356
265
  name: string;
357
266
  updatedProps: UpdatedDataPropertyNames[];
358
267
  isIntersecting: boolean;
268
+ meta: Record<string, unknown>;
359
269
  }
360
270
  interface CallbackInvokedPayload extends PayloadBase {
361
271
  type: "callbackInvoked";
362
272
  name: string;
363
273
  hitType: CallbackHitType;
274
+ meta: Record<string, unknown>;
364
275
  }
365
276
  interface CallbackCompletedBasePayload extends PayloadBase {
366
277
  type: "callbackCompleted";
@@ -369,6 +280,7 @@ interface CallbackCompletedBasePayload extends PayloadBase {
369
280
  callbackRunTimeRaw: number;
370
281
  hitType: CallbackHitType;
371
282
  status: "success" | "error";
283
+ meta: Record<string, unknown>;
372
284
  }
373
285
  type CallbackCompletedPayload = CallbackCompletedBasePayload & ({
374
286
  status: "success";
@@ -391,7 +303,7 @@ interface ScrollTrajectoryUpdatePayload extends PayloadBase {
391
303
  }
392
304
  interface ManagerSettingsChangedPayload extends PayloadBase {
393
305
  type: "managerSettingsChanged";
394
- globalSettings: ForesightManagerSettings$1;
306
+ globalSettings: ForesightManagerSettings;
395
307
  settingsChanged: UpdatedManagerSetting[];
396
308
  }
397
309
  interface SerializationErrorPayload extends PayloadBase {
@@ -399,7 +311,17 @@ interface SerializationErrorPayload extends PayloadBase {
399
311
  error: "Failed to serialize event data";
400
312
  errorMessage: string;
401
313
  }
402
- type SerializedEventData = ElementRegisteredPayload | ElementUnregisteredPayload | ElementDataUpdatedPayload | CallbackInvokedPayload | CallbackCompletedPayload | MouseTrajectoryUpdatePayload | ScrollTrajectoryUpdatePayload | ManagerSettingsChangedPayload | SerializationErrorPayload;
314
+ interface ManagerDataPayload extends PayloadBase {
315
+ type: "managerDataPayload";
316
+ warning: string;
317
+ globalCallbackHits: CallbackHits;
318
+ eventListenerCount: Record<string, number>;
319
+ managerSettings: ForesightManagerSettings;
320
+ registeredElements: Array<Omit<ForesightElementData$1, "element"> & {
321
+ elementInfo: string;
322
+ }>;
323
+ }
324
+ type SerializedEventData = ElementRegisteredPayload | ElementUnregisteredPayload | ElementDataUpdatedPayload | CallbackInvokedPayload | CallbackCompletedPayload | MouseTrajectoryUpdatePayload | ScrollTrajectoryUpdatePayload | ManagerSettingsChangedPayload | ManagerDataPayload | SerializationErrorPayload;
403
325
 
404
326
  declare class SingleLog extends LitElement {
405
327
  static styles: lit.CSSResult[];
@@ -449,6 +371,9 @@ declare class LogTab extends LitElement {
449
371
  private removeAllEventListeners;
450
372
  private getEventColor;
451
373
  private handleEvent;
374
+ private addLog;
375
+ private logManagerData;
376
+ private addManagerLog;
452
377
  private addEventLog;
453
378
  render(): lit.TemplateResult<1>;
454
379
  }
@@ -475,7 +400,7 @@ declare class SettingItemCheckbox extends LitElement {
475
400
  isChecked: boolean;
476
401
  header: string;
477
402
  description: string;
478
- setting: keyof ForesightManagerSettings$2 | keyof DevtoolsSettings;
403
+ setting: keyof ForesightManagerSettings$1 | keyof DevtoolsSettings;
479
404
  private handleCheckboxChange;
480
405
  render(): lit.TemplateResult<1>;
481
406
  }
@@ -493,7 +418,7 @@ declare class SettingItemRange extends LitElement {
493
418
  unit: string;
494
419
  header: string;
495
420
  description: string;
496
- setting: keyof ForesightManagerSettings$2;
421
+ setting: keyof ForesightManagerSettings$1;
497
422
  private displayValue;
498
423
  private handleRangeInput;
499
424
  private handleRangeChange;
@@ -575,6 +500,7 @@ declare class ForesightDevtools extends LitElement {
575
500
  static get instance(): ForesightDevtools;
576
501
  disconnectedCallback(): void;
577
502
  private shouldUpdateSetting;
503
+ private updateLoggingSetting;
578
504
  alterDevtoolsSettings(props?: DeepPartial<DevtoolsSettings>): void;
579
505
  private cleanup;
580
506
  render(): lit.TemplateResult<1>;