@fiddle-digital/string-tune 0.0.49 → 0.0.51

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.
@@ -17,9 +17,9 @@ export interface IStringModule {
17
17
  onChangeScrollDirection(): void;
18
18
  onMutationObserver(added: NodeList, removed: NodeList): void;
19
19
  onChangeScrollParams(): void;
20
- initObject(object: StringObject, el: HTMLElement): void;
20
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
21
21
  tryConnect(object: StringObject): boolean;
22
22
  connect(object: StringObject): void;
23
- addObject(id: string, object: StringObject): void;
24
- removeObject(id: string): void;
23
+ enterObject(id: string, object: StringObject): void;
24
+ leaveObject(id: string): void;
25
25
  }
@@ -1,6 +1,6 @@
1
+ import { StringBase } from '../../Objects/StringBase';
1
2
  import { StringObject } from '../../Objects/StringObject';
2
- import { StringModule } from '../../StringModule';
3
- export declare class StringLazy extends StringModule {
3
+ export declare class StringLazy extends StringBase {
4
4
  private isStartLoaded;
5
5
  private imageLoadingCount;
6
6
  constructor(visitor: any);
@@ -1,7 +1,7 @@
1
+ import { StringBase } from '../../Objects/StringBase';
1
2
  import { StringObject } from '../../Objects/StringObject';
2
- import { StringModule } from '../../StringModule';
3
3
  import { StringData } from '../../Utils/StringData';
4
- export declare class StringCursor extends StringModule {
4
+ export declare class StringCursor extends StringBase {
5
5
  private oldX;
6
6
  private oldY;
7
7
  protected enterObjectsMap: Map<string, StringObject>;
@@ -11,7 +11,7 @@ export declare class StringCursor extends StringModule {
11
11
  overCount: number;
12
12
  constructor(visitor: any, settings?: any);
13
13
  onStart(): void;
14
- initObject(object: StringObject, el: HTMLElement): void;
14
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
15
15
  onUpdate(data: StringData): void;
16
16
  onConnect(object: StringObject): void;
17
17
  private setMouseCoordinates;
@@ -1,8 +1,9 @@
1
+ import { StringBase } from '../../Objects/StringBase';
1
2
  import { StringObject } from '../../Objects/StringObject';
2
- import { StringModule } from '../../StringModule';
3
3
  import { StringData } from '../../Utils/StringData';
4
- export declare class StringMagnetic extends StringModule {
4
+ export declare class StringMagnetic extends StringBase {
5
5
  constructor(visitor: any);
6
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
6
7
  onConnect(object: StringObject): void;
7
8
  onMouseMove(e: MouseEvent): void;
8
9
  onUpdate(data: StringData): void;
@@ -0,0 +1,7 @@
1
+ import { StringModule } from "../StringModule";
2
+ import { StringObject } from "./StringObject";
3
+ export declare class StringBase extends StringModule {
4
+ private oldLerp;
5
+ constructor(visitor: any, settings?: any);
6
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
7
+ }
@@ -2,74 +2,19 @@ import { IStringModule } from '../IStringModule';
2
2
  export declare class StringObject {
3
3
  el: HTMLElement;
4
4
  id: string;
5
+ key: string;
5
6
  keys: string;
6
- oStart: number;
7
- oEnd: number;
8
- size: number;
9
- startPos: number;
10
- endPos: number;
11
- differencePos: number;
12
- factor: number;
13
- inviewTop: number;
14
- inviewBottom: number;
15
- sElPos: string;
16
- sScrPos: string;
17
- eElPos: string;
18
- eScrPos: string;
19
- halfWidth: number;
20
- halfHeight: number;
21
- start: number;
22
- end: number;
23
- mouseX: number;
24
- mouseY: number;
25
- magneticTargetX: number;
26
- magneticTargetY: number;
27
- magneticX: number;
28
- magneticY: number;
29
- lerp: number;
30
- mousePixelFloatX: number;
31
- mousePixelFloatY: number;
32
- glide: number;
33
- strength: number;
34
- weight: number;
35
- radius: number;
36
- parallaxPositionStart: number;
37
- parallaxPositionEnd: number;
38
- progress: number;
39
7
  connects: Array<HTMLElement>;
40
- cursorTargetClass: string;
41
- key: string;
42
- alignment: string;
43
- showObserver: IntersectionObserver | null;
44
- progressObserver: IntersectionObserver | null;
45
- inviewObserver: IntersectionObserver | null;
46
- repeat: boolean;
47
- selfDisable: boolean;
48
- active: boolean;
49
- abs: boolean;
50
- started: boolean;
51
- isMagneting: boolean;
52
- cursorTargetDisabled: boolean;
53
- cursorTargetStyleDisabled: boolean;
54
- isMouseOver: boolean;
55
- isMouseMove: boolean;
8
+ private properties;
9
+ private modules;
56
10
  onEnter: () => void;
57
11
  onLeave: () => void;
58
- private modules;
59
- anchor: string;
60
- intensity3D: number;
61
- distance3D: number;
62
- decay3D: number;
63
- type3D: string;
64
- material3D: string;
65
- color3D: string;
66
- model3D: string;
67
- animations3D: Array<any>;
12
+ setProperty<T>(key: string, value: T): void;
13
+ getProperty<T>(key: string): T;
68
14
  constructor(element: HTMLElement);
69
15
  enter(): void;
70
16
  leave(): void;
71
17
  show(): void;
72
18
  hide(): void;
73
19
  connect(module: IStringModule): void;
74
- calculatePositions(windowSize: number): void;
75
20
  }
@@ -0,0 +1,6 @@
1
+ import { StringBase } from "../Objects/StringBase";
2
+ import { StringObject } from "../Objects/StringObject";
3
+ export declare class StringInview extends StringBase {
4
+ constructor(visitor: any);
5
+ tryConnect(object: StringObject): boolean;
6
+ }
@@ -1,9 +1,8 @@
1
+ import { StringBase } from '../../Objects/StringBase';
1
2
  import { StringObject } from '../../Objects/StringObject';
2
- import { StringModule } from '../../StringModule';
3
- export declare class StringAnchor extends StringModule {
4
- oldLerp: number;
3
+ export declare class StringAnchor extends StringBase {
5
4
  constructor(visitor: any);
6
- initObject(object: StringObject, el: any): void;
5
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
7
6
  onConnect(object: StringObject): void;
8
7
  private parseOrig;
9
8
  }
@@ -1,6 +1,7 @@
1
- import { StringModule } from '../../StringModule';
1
+ import { StringBase } from '../../Objects/StringBase';
2
+ import { StringObject } from '../../Objects/StringObject';
2
3
  import { StringData } from '../../Utils/StringData';
3
- export declare class StringGlide extends StringModule {
4
+ export declare class StringGlide extends StringBase {
4
5
  private previousLerp;
5
6
  private displacement;
6
7
  private acceleration;
@@ -15,11 +16,12 @@ export declare class StringGlide extends StringModule {
15
16
  private readonly MIN_VELOCITY;
16
17
  private readonly MAX_VELOCITY;
17
18
  private maxDisplacementValue;
19
+ constructor(visitor: any, settings?: any);
20
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
18
21
  private setupItem;
19
22
  private onUpdateDesktopEvent;
20
23
  private onUpdateMobileEvent;
21
24
  private onUpdateEvent;
22
- constructor(visitor: any, settings?: any);
23
25
  private calcExpanderFactor;
24
26
  onStart(): void;
25
27
  onResize(): void;
@@ -1,7 +1,6 @@
1
- import { StringModule } from '../../StringModule';
1
+ import { StringBase } from '../../Objects/StringBase';
2
2
  import { StringData } from '../../Utils/StringData';
3
- export declare class StringLerp extends StringModule {
4
- oldLerp: number;
3
+ export declare class StringLerp extends StringBase {
5
4
  constructor(visitor: any);
6
5
  onScrollStop(): void;
7
6
  onScroll(data: StringData): void;
@@ -1,14 +1,13 @@
1
1
  import { StringObject } from '../../Objects/StringObject';
2
- import { StringModule } from '../../StringModule';
3
2
  import { StringData } from '../../Utils/StringData';
4
- export declare class StringParallax extends StringModule {
3
+ import { StringProgress } from './StringProgress';
4
+ export declare class StringParallax extends StringProgress {
5
+ constructor(visitor: any);
6
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
5
7
  private setupParallax;
6
8
  private onScrollDesktopEvent;
7
9
  private onScrollMobileEvent;
8
10
  private onScrollEvent;
9
- constructor(visitor: any);
10
- onConnect(object: StringObject): void;
11
11
  onScroll(data: StringData): void;
12
- onChangeScrollDirection(): void;
13
12
  onResize(): void;
14
13
  }
@@ -1,11 +1,12 @@
1
+ import { StringBase } from '../../Objects/StringBase';
1
2
  import { StringObject } from '../../Objects/StringObject';
2
- import { StringModule } from '../../StringModule';
3
3
  import { StringData } from '../../Utils/StringData';
4
- export declare class StringProgress extends StringModule {
5
- private oldLerp;
4
+ export declare class StringProgress extends StringBase {
6
5
  constructor(visitor: any);
6
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
7
7
  onScroll(data: StringData): void;
8
8
  onConnect(object: StringObject): void;
9
9
  private setUpObject;
10
10
  private applyProgress;
11
+ private calculatePositions;
11
12
  }
@@ -6,10 +6,12 @@ export declare class StringScrollSmooth extends StringScroll {
6
6
  private isScrollbarManipulation;
7
7
  private isBottomScrollDirection;
8
8
  private readonly velocityThreshold;
9
+ private plusDelta;
9
10
  private previousCurrent;
10
11
  constructor(document: any, settings: StringTypeSettings, data: StringData);
11
12
  private updateScrollDirection;
12
13
  stopScroll(): void;
14
+ private delta;
13
15
  onUpdate(): void;
14
16
  onWheel(e: WheelEvent): void;
15
17
  onScroll(e: Event): void;
@@ -1,5 +1,5 @@
1
+ import { StringBase } from '../../Objects/StringBase';
1
2
  import { StringObject } from '../../Objects/StringObject';
2
- import { StringModule } from '../../StringModule';
3
3
  interface ISplitOptions {
4
4
  line?: Array<{
5
5
  align: string;
@@ -50,7 +50,7 @@ interface ISplitOptions {
50
50
  abs?: boolean;
51
51
  }>;
52
52
  }
53
- export declare class StringSplit extends StringModule {
53
+ export declare class StringSplit extends StringBase {
54
54
  constructor(visitor: any);
55
55
  onStart(): void;
56
56
  onResize(): void;
@@ -5,8 +5,10 @@ import { StringFPS } from './StringFPS';
5
5
  import { StringAttribute } from './Utils/StringAttribute';
6
6
  import { StringBoundingClientRect } from './Utils/StringBoundingClientRect';
7
7
  import { StringData } from './Utils/StringData';
8
+ import { StringDefaultSettings } from './Utils/StringDefaultSettings';
8
9
  import { StringEvent } from './Utils/StringEvent';
9
10
  import { StringLerpCalc } from './Utils/StringLerpCalc';
11
+ import { StringParser } from './Utils/StringParser';
10
12
  import { StringPosition } from './Utils/StringPosition';
11
13
  export declare class StringModule implements IStringModule {
12
14
  lerp: StringLerpCalc;
@@ -18,13 +20,15 @@ export declare class StringModule implements IStringModule {
18
20
  virtualCursor: StringVirtualCursor;
19
21
  loop: StringFPS;
20
22
  settings: any;
23
+ parser: StringParser;
24
+ protected defaultSettings: StringDefaultSettings;
21
25
  protected objectsMap: Map<string, StringObject>;
22
26
  protected objects: Array<StringObject>;
23
27
  protected htmlKey: string;
24
28
  protected _type: number;
25
29
  get type(): number;
26
30
  constructor(visitor: any, settings?: any);
27
- initObject(object: StringObject, el: HTMLElement): void;
31
+ initObject(globalId: number, object: StringObject, el: HTMLElement, attributes: Record<string, any>): void;
28
32
  onScrollStart(): void;
29
33
  onScrollStop(): void;
30
34
  onChangeDirection(): void;
@@ -32,8 +36,8 @@ export declare class StringModule implements IStringModule {
32
36
  onChangeScrollParams(): void;
33
37
  tryConnect(object: StringObject): boolean;
34
38
  connect(object: StringObject): void;
35
- addObject(id: string, object: StringObject): void;
36
- removeObject(id: string): void;
39
+ enterObject(id: string, object: StringObject): void;
40
+ leaveObject(id: string): void;
37
41
  onStart(): void;
38
42
  onUpdate(data: StringData): void;
39
43
  onResize(): void;
@@ -2,12 +2,10 @@ import { StringModule } from '../StringModule';
2
2
  import { StringData } from '../Utils/StringData';
3
3
  export declare class StringFPSTracker extends StringModule {
4
4
  private callCount;
5
- private rafId;
5
+ private intervalId;
6
6
  private displayElement;
7
- private lastUpdateTime;
8
7
  constructor(visitor: any);
9
8
  private createDisplayElement;
10
- private updateLoop;
11
9
  onStart(): void;
12
10
  onUpdate(data: StringData): void;
13
11
  destructor(): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface Handler<Request = string, Result = string | null> {
2
+ setNext(handler: Handler<Request, Result>): Handler<Request, Result>;
3
+ handle(request: Request): Result;
4
+ }
@@ -0,0 +1,16 @@
1
+ export declare class StringDefaultSettings {
2
+ stringOffsetStart: string;
3
+ stringOffsetEnd: string;
4
+ stringEnterEl: string;
5
+ stringExitEl: string;
6
+ stringEnterVp: string;
7
+ stringExitVp: string;
8
+ stringInviewTop: string;
9
+ stringInviewBottom: string;
10
+ stringKey: string;
11
+ stringStrength: number;
12
+ stringRadius: number;
13
+ stringLerp: number;
14
+ stringParallaxBias: number;
15
+ stringParallax: number;
16
+ }
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ declare class StringTune {
36
36
  private _attribute;
37
37
  private _boundingClientRect;
38
38
  private _position;
39
+ private _defaultSettings;
39
40
  private sEn;
40
41
  private sEnSmooth;
41
42
  private sEnDefault;
@@ -47,6 +48,7 @@ declare class StringTune {
47
48
  private globalId;
48
49
  private _parser;
49
50
  private isStarted;
51
+ private fps;
50
52
  get scrollDirection(): 'vertical' | 'horizontal';
51
53
  set scrollDirection(scrollDirection: 'vertical' | 'horizontal');
52
54
  get speedAccelerate(): number;
@@ -73,7 +75,6 @@ declare class StringTune {
73
75
  private eventMap;
74
76
  on(key: keyof typeof this.eventMap, event: any, id?: string): void;
75
77
  off(key: keyof typeof this.eventMap, event: any, id?: string): void;
76
- private defaultSettings;
77
78
  setupSettings(settings: any): void;
78
79
  protected setupObject(el: HTMLElement, object: StringObject): void;
79
80
  private getAllAttributes;