angular-movement 0.0.1 → 0.0.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/README.md +115 -33
- package/fesm2022/angular-movement.mjs +223 -98
- package/fesm2022/angular-movement.mjs.map +1 -1
- package/package.json +1 -1
- package/types/angular-movement.d.ts +64 -15
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ interface MoveKeyframes {
|
|
|
20
20
|
rotateX?: MoveValuePair;
|
|
21
21
|
rotateY?: MoveValuePair;
|
|
22
22
|
blur?: MoveValuePair;
|
|
23
|
+
[key: string]: MoveValuePair | undefined;
|
|
23
24
|
}
|
|
24
25
|
type MoveVariant = MoveKeyframes & {
|
|
25
26
|
spring?: MoveSpring;
|
|
@@ -30,6 +31,7 @@ type MoveVariant = MoveKeyframes & {
|
|
|
30
31
|
interface MovePresetDefinition {
|
|
31
32
|
enter: MoveKeyframes;
|
|
32
33
|
leave: MoveKeyframes;
|
|
34
|
+
loop?: MoveKeyframes;
|
|
33
35
|
}
|
|
34
36
|
interface MoveKeyframeState {
|
|
35
37
|
opacity?: number;
|
|
@@ -42,6 +44,7 @@ interface MoveKeyframeState {
|
|
|
42
44
|
rotateX?: number;
|
|
43
45
|
rotateY?: number;
|
|
44
46
|
blur?: number;
|
|
47
|
+
[key: string]: number | undefined;
|
|
45
48
|
}
|
|
46
49
|
interface MoveAnimationConfig {
|
|
47
50
|
initial?: MoveKeyframeState;
|
|
@@ -348,6 +351,59 @@ declare class MoveParallaxDirective implements OnInit, OnDestroy {
|
|
|
348
351
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MoveParallaxDirective, "[moveParallax]", ["moveParallax"], { "moveParallax": { "alias": "moveParallax"; "required": false; "isSignal": true; }; "moveParallaxAxis": { "alias": "moveParallaxAxis"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
349
352
|
}
|
|
350
353
|
|
|
354
|
+
declare class MoveLoopDirective implements OnDestroy, OnInit {
|
|
355
|
+
#private;
|
|
356
|
+
readonly moveLoop: _angular_core.InputSignal<MovePreset | MoveKeyframes>;
|
|
357
|
+
readonly moveDuration: _angular_core.InputSignal<number | undefined>;
|
|
358
|
+
readonly moveEasing: _angular_core.InputSignal<string | undefined>;
|
|
359
|
+
readonly moveDelay: _angular_core.InputSignal<number | undefined>;
|
|
360
|
+
readonly moveDisabled: _angular_core.InputSignal<boolean | undefined>;
|
|
361
|
+
readonly moveSpring: _angular_core.InputSignal<MoveSpring | undefined>;
|
|
362
|
+
ngOnInit(): void;
|
|
363
|
+
ngOnDestroy(): void;
|
|
364
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MoveLoopDirective, never>;
|
|
365
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MoveLoopDirective, "[moveLoop]", never, { "moveLoop": { "alias": "moveLoop"; "required": false; "isSignal": true; }; "moveDuration": { "alias": "moveDuration"; "required": false; "isSignal": true; }; "moveEasing": { "alias": "moveEasing"; "required": false; "isSignal": true; }; "moveDelay": { "alias": "moveDelay"; "required": false; "isSignal": true; }; "moveDisabled": { "alias": "moveDisabled"; "required": false; "isSignal": true; }; "moveSpring": { "alias": "moveSpring"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
interface MovementConfig {
|
|
369
|
+
duration: number;
|
|
370
|
+
easing: string;
|
|
371
|
+
delay: number;
|
|
372
|
+
disabled: boolean;
|
|
373
|
+
iterations?: number;
|
|
374
|
+
}
|
|
375
|
+
declare const MOVEMENT_DEFAULTS: MovementConfig;
|
|
376
|
+
declare const MOVEMENT_CONFIG: InjectionToken<MovementConfig>;
|
|
377
|
+
|
|
378
|
+
type MovePhase = 'enter' | 'leave' | 'loop';
|
|
379
|
+
type MoveDirectiveInput = MovePreset | MoveKeyframes;
|
|
380
|
+
interface MoveInputOverrides {
|
|
381
|
+
duration?: number;
|
|
382
|
+
easing?: string;
|
|
383
|
+
delay?: number;
|
|
384
|
+
disabled?: boolean;
|
|
385
|
+
iterations?: number;
|
|
386
|
+
}
|
|
387
|
+
declare function resolveMovementConfig(defaults: MovementConfig, overrides: MoveInputOverrides, reducedMotion: boolean): MovementConfig;
|
|
388
|
+
declare function resolveMoveFrames(value: MoveDirectiveInput, phase: MovePhase): MoveKeyframes;
|
|
389
|
+
declare function prefersReducedMotion(documentRef: Document): boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Reverses all keyframe value arrays in a MoveKeyframes object.
|
|
392
|
+
* Used by hover and tap directives to animate back to the original state.
|
|
393
|
+
*/
|
|
394
|
+
declare function reverseFrames(frames: MoveKeyframes): MoveKeyframes;
|
|
395
|
+
/**
|
|
396
|
+
* Applies the first keyframe values as inline styles to an element.
|
|
397
|
+
* Used by in-view and text directives to set the initial (hidden) state
|
|
398
|
+
* before the IntersectionObserver triggers the animation.
|
|
399
|
+
*/
|
|
400
|
+
declare function applyInitialStyles(el: HTMLElement, frames: MoveKeyframes): void;
|
|
401
|
+
/**
|
|
402
|
+
* Clears all inline styles set by `applyInitialStyles`.
|
|
403
|
+
* Called just before WAAPI animates so it can take full control.
|
|
404
|
+
*/
|
|
405
|
+
declare function clearInitialStyles(el: HTMLElement): void;
|
|
406
|
+
|
|
351
407
|
/**
|
|
352
408
|
* SmoothScrollService — Lenis-inspired smooth scroll for Angular.
|
|
353
409
|
*
|
|
@@ -395,25 +451,17 @@ interface AnimationControls {
|
|
|
395
451
|
readonly finished: Promise<void>;
|
|
396
452
|
}
|
|
397
453
|
|
|
398
|
-
interface MovementConfig {
|
|
399
|
-
duration: number;
|
|
400
|
-
easing: string;
|
|
401
|
-
delay: number;
|
|
402
|
-
disabled: boolean;
|
|
403
|
-
}
|
|
404
|
-
declare const MOVEMENT_DEFAULTS: MovementConfig;
|
|
405
|
-
declare const MOVEMENT_CONFIG: InjectionToken<MovementConfig>;
|
|
406
|
-
|
|
407
454
|
interface PlayAnimationOptions {
|
|
408
455
|
config?: MovementConfig;
|
|
409
456
|
spring?: MoveSpring;
|
|
410
457
|
delay?: number;
|
|
411
458
|
disabled?: boolean;
|
|
459
|
+
iterations?: number;
|
|
412
460
|
onDone?: () => void;
|
|
413
461
|
}
|
|
414
462
|
declare class AnimationEngine {
|
|
415
463
|
#private;
|
|
416
|
-
play(host:
|
|
464
|
+
play(host: Element, frames: MoveKeyframes, options?: PlayAnimationOptions): AnimationControls | null;
|
|
417
465
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AnimationEngine, never>;
|
|
418
466
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AnimationEngine>;
|
|
419
467
|
}
|
|
@@ -423,9 +471,10 @@ declare class SpringPlayer implements AnimationControls {
|
|
|
423
471
|
private readonly host;
|
|
424
472
|
private readonly frames;
|
|
425
473
|
private readonly delay;
|
|
474
|
+
private readonly iterations;
|
|
426
475
|
private readonly onDone?;
|
|
427
476
|
readonly finished: Promise<void>;
|
|
428
|
-
constructor(host:
|
|
477
|
+
constructor(host: Element, frames: MoveKeyframes, userConfig: MoveSpring, delay: number, iterations?: number, onDone?: (() => void) | undefined);
|
|
429
478
|
play(): void;
|
|
430
479
|
pause(): void;
|
|
431
480
|
cancel(): void;
|
|
@@ -436,7 +485,7 @@ declare class SpringPlayer implements AnimationControls {
|
|
|
436
485
|
declare class WaapiPlayer implements AnimationControls {
|
|
437
486
|
#private;
|
|
438
487
|
readonly finished: Promise<void>;
|
|
439
|
-
constructor(host:
|
|
488
|
+
constructor(host: Element, frames: MoveKeyframes, config: MovementConfig, onDone?: () => void);
|
|
440
489
|
play(): void;
|
|
441
490
|
pause(): void;
|
|
442
491
|
cancel(): void;
|
|
@@ -449,7 +498,7 @@ declare const MOVE_PRESETS: Record<MovePreset, MovePresetDefinition>;
|
|
|
449
498
|
type MovementConfigInput = Partial<MovementConfig>;
|
|
450
499
|
declare function provideMovement(config?: MovementConfigInput): EnvironmentProviders;
|
|
451
500
|
|
|
452
|
-
declare const MOVEMENT_DIRECTIVES: readonly [typeof MoveEnterDirective, typeof MoveLeaveDirective, typeof MoveAnimateDirective, typeof MoveHoverDirective, typeof MoveTapDirective, typeof MoveVariantsDirective, typeof MoveStaggerDirective, typeof MoveLayoutDirective, typeof MoveScrollDirective, typeof MovePresenceDirective, typeof MoveDragDirective, typeof MoveInViewDirective, typeof MoveTextDirective, typeof MoveSmoothScrollDirective, typeof MoveFocusDirective, typeof MoveParallaxDirective, typeof MoveAnimationDirective];
|
|
501
|
+
declare const MOVEMENT_DIRECTIVES: readonly [typeof MoveEnterDirective, typeof MoveLeaveDirective, typeof MoveAnimateDirective, typeof MoveHoverDirective, typeof MoveTapDirective, typeof MoveVariantsDirective, typeof MoveStaggerDirective, typeof MoveLayoutDirective, typeof MoveScrollDirective, typeof MovePresenceDirective, typeof MoveDragDirective, typeof MoveInViewDirective, typeof MoveTextDirective, typeof MoveSmoothScrollDirective, typeof MoveFocusDirective, typeof MoveParallaxDirective, typeof MoveAnimationDirective, typeof MoveLoopDirective];
|
|
453
502
|
|
|
454
|
-
export { AnimationEngine, MOVEMENT_CONFIG, MOVEMENT_DEFAULTS, MOVEMENT_DIRECTIVES, MOVE_PRESENCE_PARENT, MOVE_PRESETS, MOVE_STAGGER_PARENT, MOVE_VARIANTS_PARENT, MoveAnimateDirective, MoveAnimationDirective, MoveDragDirective, MoveEnterDirective, MoveFocusDirective, MoveHoverDirective, MoveInViewDirective, MoveLayoutDirective, MoveLeaveDirective, MoveParallaxDirective, MovePresenceDirective, MoveScrollDirective, MoveSmoothScrollDirective, MoveStaggerDirective, MoveTapDirective, MoveTextDirective, MoveVariantsDirective, SmoothScrollService, SpringPlayer, WaapiPlayer, provideMovement };
|
|
455
|
-
export type { AnimationControls, MoveAnimationConfig, MoveDragConstraints, MoveKeyframeState, MoveKeyframes, MovePresenceChild, MovePresenceProvider, MovePreset, MovePresetDefinition, MoveSpring, MoveStaggerDirection, MoveStaggerProvider, MoveValuePair, MoveVariant, MoveVariantsProvider, MovementConfig, MovementConfigInput, PlayAnimationOptions };
|
|
503
|
+
export { AnimationEngine, MOVEMENT_CONFIG, MOVEMENT_DEFAULTS, MOVEMENT_DIRECTIVES, MOVE_PRESENCE_PARENT, MOVE_PRESETS, MOVE_STAGGER_PARENT, MOVE_VARIANTS_PARENT, MoveAnimateDirective, MoveAnimationDirective, MoveDragDirective, MoveEnterDirective, MoveFocusDirective, MoveHoverDirective, MoveInViewDirective, MoveLayoutDirective, MoveLeaveDirective, MoveLoopDirective, MoveParallaxDirective, MovePresenceDirective, MoveScrollDirective, MoveSmoothScrollDirective, MoveStaggerDirective, MoveTapDirective, MoveTextDirective, MoveVariantsDirective, SmoothScrollService, SpringPlayer, WaapiPlayer, applyInitialStyles, clearInitialStyles, prefersReducedMotion, provideMovement, resolveMoveFrames, resolveMovementConfig, reverseFrames };
|
|
504
|
+
export type { AnimationControls, MoveAnimationConfig, MoveDirectiveInput, MoveDragConstraints, MoveInputOverrides, MoveKeyframeState, MoveKeyframes, MovePhase, MovePresenceChild, MovePresenceProvider, MovePreset, MovePresetDefinition, MoveSpring, MoveStaggerDirection, MoveStaggerProvider, MoveValuePair, MoveVariant, MoveVariantsProvider, MovementConfig, MovementConfigInput, PlayAnimationOptions };
|