@hilux/ngx-motion 2.0.1 → 2.1.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.
- package/README.md +155 -1
- package/fesm2022/hilux-ngx-motion.mjs +1776 -5
- package/fesm2022/hilux-ngx-motion.mjs.map +1 -1
- package/package.json +1 -1
- package/types/hilux-ngx-motion.d.ts +603 -0
package/package.json
CHANGED
|
@@ -779,4 +779,607 @@ export declare class MotionPresenceDirective {
|
|
|
779
779
|
};
|
|
780
780
|
}, {}, never, never, true, never>;
|
|
781
781
|
}
|
|
782
|
+
/** Style keyframes spread across scroll progress: `{ y: [0, -120], opacity: [1, 0] }`. */
|
|
783
|
+
export type ScrollKeyframes = Record<string, (string | number)[]>;
|
|
784
|
+
/**
|
|
785
|
+
* Where a scroll range starts and ends, in Motion's offset syntax: pairs of
|
|
786
|
+
* "<target edge> <container edge>", e.g. `['start end', 'end start']` (while the
|
|
787
|
+
* element crosses the viewport) or `['start start', 'end end']` (while a tall
|
|
788
|
+
* section scrolls past a pinned child).
|
|
789
|
+
*/
|
|
790
|
+
export type ScrollOffset = (string | number | [number | string, number | string])[];
|
|
791
|
+
/** While the element crosses the visible area of its scroll container. */
|
|
792
|
+
export declare const SCROLL_WHILE_VISIBLE: ScrollOffset;
|
|
793
|
+
/** While a section taller than the viewport scrolls through it (for pinned/sticky stages). */
|
|
794
|
+
export declare const SCROLL_THROUGH: ScrollOffset;
|
|
795
|
+
/**
|
|
796
|
+
* Scroll-linked values.
|
|
797
|
+
*
|
|
798
|
+
* Maps scroll progress (0 → 1) to styles, and exposes the progress and scroll
|
|
799
|
+
* velocity as signals:
|
|
800
|
+
*
|
|
801
|
+
* <!-- parallax: moves up 120px and fades as it crosses the viewport -->
|
|
802
|
+
* <img [motionScroll]="{ y: [0, -120], opacity: [1, 0] }">
|
|
803
|
+
*
|
|
804
|
+
* <!-- page progress bar -->
|
|
805
|
+
* <div class="bar" [motionScroll]="{ scaleX: [0, 1] }" scrollTarget="container"></div>
|
|
806
|
+
*
|
|
807
|
+
* <!-- pinned stage: read progress from a tall wrapper -->
|
|
808
|
+
* <section motionScroll #story="motionScroll" [scrollOffset]="through" style="height: 300vh">
|
|
809
|
+
* <div class="sticky">{{ story.progress() }}</div>
|
|
810
|
+
* </section>
|
|
811
|
+
*
|
|
812
|
+
* By default it tracks the host element against its nearest scrollable
|
|
813
|
+
* ancestor (or the page). A scrolling ancestor must be positioned
|
|
814
|
+
* (`position: relative` or similar) so offsets are measured from it. The keyframes run as a scroll-driven animation (using
|
|
815
|
+
* the browser's ScrollTimeline when it can), so they never trigger change
|
|
816
|
+
* detection. Reading `progress()` or `velocity()` in a template re-renders that
|
|
817
|
+
* view as you scroll; keep those reads small.
|
|
818
|
+
*
|
|
819
|
+
* With `prefers-reduced-motion: reduce`, keyframes are not applied (the element
|
|
820
|
+
* keeps its normal styles) unless `respectReducedMotion` is false; progress is
|
|
821
|
+
* still tracked.
|
|
822
|
+
*/
|
|
823
|
+
export declare class MotionScrollDirective {
|
|
824
|
+
private readonly el;
|
|
825
|
+
private readonly motion;
|
|
826
|
+
private readonly zone;
|
|
827
|
+
/** Keyframes per style, spread across the scroll range. Empty to only track progress. */
|
|
828
|
+
readonly motionScroll: import("@angular/core").InputSignal<"" | ScrollKeyframes | null | undefined>;
|
|
829
|
+
/**
|
|
830
|
+
* What to track: the host ('self', default), another element, or the whole
|
|
831
|
+
* scroll container ('container', e.g. for a page progress bar).
|
|
832
|
+
*/
|
|
833
|
+
readonly scrollTarget: import("@angular/core").InputSignal<Element | "container" | "self">;
|
|
834
|
+
/** Scroll container: nearest scrollable ancestor ('auto', default), the page ('page') or an element. */
|
|
835
|
+
readonly scrollContainer: import("@angular/core").InputSignal<Element | "page" | "auto">;
|
|
836
|
+
/** Start and end of the range. Defaults to SCROLL_WHILE_VISIBLE for an element target. */
|
|
837
|
+
readonly scrollOffset: import("@angular/core").InputSignal<ScrollOffset | undefined>;
|
|
838
|
+
readonly scrollAxis: import("@angular/core").InputSignal<"x" | "y">;
|
|
839
|
+
/** Extra animation options for the keyframes, e.g. `{ ease: 'easeOut' }` or `{ times: [0, 0.3, 1] }`. */
|
|
840
|
+
readonly scrollTransition: import("@angular/core").InputSignal<Record<string, unknown> | undefined>;
|
|
841
|
+
readonly respectReducedMotion: import("@angular/core").InputSignal<boolean>;
|
|
842
|
+
private readonly _progress;
|
|
843
|
+
private readonly _velocity;
|
|
844
|
+
/** Scroll progress through the range, 0 → 1. */
|
|
845
|
+
readonly progress: import("@angular/core").Signal<number>;
|
|
846
|
+
/** Scroll velocity along the axis, in px/s. */
|
|
847
|
+
readonly velocity: import("@angular/core").Signal<number>;
|
|
848
|
+
constructor();
|
|
849
|
+
private scroll;
|
|
850
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionScrollDirective, never>;
|
|
851
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionScrollDirective, "[motionScroll]", ["motionScroll"], {
|
|
852
|
+
"motionScroll": {
|
|
853
|
+
"alias": "motionScroll";
|
|
854
|
+
"required": false;
|
|
855
|
+
"isSignal": true;
|
|
856
|
+
};
|
|
857
|
+
"scrollTarget": {
|
|
858
|
+
"alias": "scrollTarget";
|
|
859
|
+
"required": false;
|
|
860
|
+
"isSignal": true;
|
|
861
|
+
};
|
|
862
|
+
"scrollContainer": {
|
|
863
|
+
"alias": "scrollContainer";
|
|
864
|
+
"required": false;
|
|
865
|
+
"isSignal": true;
|
|
866
|
+
};
|
|
867
|
+
"scrollOffset": {
|
|
868
|
+
"alias": "scrollOffset";
|
|
869
|
+
"required": false;
|
|
870
|
+
"isSignal": true;
|
|
871
|
+
};
|
|
872
|
+
"scrollAxis": {
|
|
873
|
+
"alias": "scrollAxis";
|
|
874
|
+
"required": false;
|
|
875
|
+
"isSignal": true;
|
|
876
|
+
};
|
|
877
|
+
"scrollTransition": {
|
|
878
|
+
"alias": "scrollTransition";
|
|
879
|
+
"required": false;
|
|
880
|
+
"isSignal": true;
|
|
881
|
+
};
|
|
882
|
+
"respectReducedMotion": {
|
|
883
|
+
"alias": "respectReducedMotion";
|
|
884
|
+
"required": false;
|
|
885
|
+
"isSignal": true;
|
|
886
|
+
};
|
|
887
|
+
}, {}, never, never, true, never>;
|
|
888
|
+
}
|
|
889
|
+
/** Spring used by the pointer directives unless you pass your own. */
|
|
890
|
+
export declare const POINTER_SPRING: {
|
|
891
|
+
type: string;
|
|
892
|
+
stiffness: number;
|
|
893
|
+
damping: number;
|
|
894
|
+
mass: number;
|
|
895
|
+
};
|
|
896
|
+
/**
|
|
897
|
+
* Magnetic pull: while a mouse pointer is over (or near) the element, it leans
|
|
898
|
+
* toward the pointer, then springs back when the pointer leaves.
|
|
899
|
+
*
|
|
900
|
+
* <button motionMagnetic>Get started</button>
|
|
901
|
+
* <a [motionMagnetic]="0.5" [magneticRadius]="60">Strong pull, wide reach</a>
|
|
902
|
+
*
|
|
903
|
+
* Moves the element with `x`/`y`, so it composes with scale or rotate from
|
|
904
|
+
* other ngx-motion directives. Touch input and reduced motion are ignored.
|
|
905
|
+
*/
|
|
906
|
+
export declare class MotionMagneticDirective {
|
|
907
|
+
/** How far it follows: 0 (none) to 1 (centre sits under the pointer). Default 0.3. */
|
|
908
|
+
readonly motionMagnetic: import("@angular/core").InputSignal<number | "">;
|
|
909
|
+
/** Extra reach around the element, in px. */
|
|
910
|
+
readonly magneticRadius: import("@angular/core").InputSignal<number>;
|
|
911
|
+
readonly magneticTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
912
|
+
private readonly _active;
|
|
913
|
+
/** True while the pointer is within reach. */
|
|
914
|
+
readonly active: import("@angular/core").Signal<boolean>;
|
|
915
|
+
constructor();
|
|
916
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionMagneticDirective, never>;
|
|
917
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionMagneticDirective, "[motionMagnetic]", ["motionMagnetic"], {
|
|
918
|
+
"motionMagnetic": {
|
|
919
|
+
"alias": "motionMagnetic";
|
|
920
|
+
"required": false;
|
|
921
|
+
"isSignal": true;
|
|
922
|
+
};
|
|
923
|
+
"magneticRadius": {
|
|
924
|
+
"alias": "magneticRadius";
|
|
925
|
+
"required": false;
|
|
926
|
+
"isSignal": true;
|
|
927
|
+
};
|
|
928
|
+
"magneticTransition": {
|
|
929
|
+
"alias": "magneticTransition";
|
|
930
|
+
"required": false;
|
|
931
|
+
"isSignal": true;
|
|
932
|
+
};
|
|
933
|
+
}, {}, never, never, true, never>;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* 3D tilt toward the pointer, like a card under a light. Also sets
|
|
937
|
+
* `--motion-pointer-x` / `--motion-pointer-y` (0%–100%) on the element for a
|
|
938
|
+
* glare or spotlight in CSS:
|
|
939
|
+
*
|
|
940
|
+
* <article [motionTilt]="12">…</article>
|
|
941
|
+
* .card::after { background: radial-gradient(circle at var(--motion-pointer-x) var(--motion-pointer-y), #fff3, transparent 50%); }
|
|
942
|
+
*
|
|
943
|
+
* Springs back flat when the pointer leaves. With reduced motion it doesn't
|
|
944
|
+
* tilt, but still sets the pointer variables.
|
|
945
|
+
*/
|
|
946
|
+
export declare class MotionTiltDirective {
|
|
947
|
+
/** Maximum tilt in degrees. Default 10. */
|
|
948
|
+
readonly motionTilt: import("@angular/core").InputSignal<number | "">;
|
|
949
|
+
/** Scale while hovered. */
|
|
950
|
+
readonly tiltScale: import("@angular/core").InputSignal<number>;
|
|
951
|
+
/** Perspective in px: lower is more dramatic. */
|
|
952
|
+
readonly tiltPerspective: import("@angular/core").InputSignal<number>;
|
|
953
|
+
readonly tiltTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
954
|
+
private readonly _hovering;
|
|
955
|
+
readonly hovering: import("@angular/core").Signal<boolean>;
|
|
956
|
+
constructor();
|
|
957
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionTiltDirective, never>;
|
|
958
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionTiltDirective, "[motionTilt]", ["motionTilt"], {
|
|
959
|
+
"motionTilt": {
|
|
960
|
+
"alias": "motionTilt";
|
|
961
|
+
"required": false;
|
|
962
|
+
"isSignal": true;
|
|
963
|
+
};
|
|
964
|
+
"tiltScale": {
|
|
965
|
+
"alias": "tiltScale";
|
|
966
|
+
"required": false;
|
|
967
|
+
"isSignal": true;
|
|
968
|
+
};
|
|
969
|
+
"tiltPerspective": {
|
|
970
|
+
"alias": "tiltPerspective";
|
|
971
|
+
"required": false;
|
|
972
|
+
"isSignal": true;
|
|
973
|
+
};
|
|
974
|
+
"tiltTransition": {
|
|
975
|
+
"alias": "tiltTransition";
|
|
976
|
+
"required": false;
|
|
977
|
+
"isSignal": true;
|
|
978
|
+
};
|
|
979
|
+
}, {}, never, never, true, never>;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Follows the pointer around a container on a spring: cursor blobs, "View"
|
|
983
|
+
* bubbles, spotlights. Position it absolutely at the container's top-left; it
|
|
984
|
+
* is centred on the pointer and scales in when the pointer enters the
|
|
985
|
+
* container and out when it leaves.
|
|
986
|
+
*
|
|
987
|
+
* <section style="position: relative">
|
|
988
|
+
* <div class="glow" motionFollowPointer></div>
|
|
989
|
+
* </section>
|
|
990
|
+
*
|
|
991
|
+
* Mouse and pen only. With reduced motion it jumps to the pointer instead of
|
|
992
|
+
* springing.
|
|
993
|
+
*/
|
|
994
|
+
export declare class MotionFollowPointerDirective {
|
|
995
|
+
/** The area it follows within: the parent element (default) or the whole window. */
|
|
996
|
+
readonly motionFollowPointer: import("@angular/core").InputSignal<"" | Element | "parent" | "window">;
|
|
997
|
+
readonly followTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
998
|
+
/** Scale in and out with the pointer entering and leaving. Set false to keep it shown. */
|
|
999
|
+
readonly followHide: import("@angular/core").InputSignal<boolean>;
|
|
1000
|
+
private readonly _active;
|
|
1001
|
+
/** True while the pointer is inside the area. */
|
|
1002
|
+
readonly active: import("@angular/core").Signal<boolean>;
|
|
1003
|
+
constructor();
|
|
1004
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionFollowPointerDirective, never>;
|
|
1005
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionFollowPointerDirective, "[motionFollowPointer]", ["motionFollowPointer"], {
|
|
1006
|
+
"motionFollowPointer": {
|
|
1007
|
+
"alias": "motionFollowPointer";
|
|
1008
|
+
"required": false;
|
|
1009
|
+
"isSignal": true;
|
|
1010
|
+
};
|
|
1011
|
+
"followTransition": {
|
|
1012
|
+
"alias": "followTransition";
|
|
1013
|
+
"required": false;
|
|
1014
|
+
"isSignal": true;
|
|
1015
|
+
};
|
|
1016
|
+
"followHide": {
|
|
1017
|
+
"alias": "followHide";
|
|
1018
|
+
"required": false;
|
|
1019
|
+
"isSignal": true;
|
|
1020
|
+
};
|
|
1021
|
+
}, {}, never, never, true, never>;
|
|
1022
|
+
}
|
|
1023
|
+
/** Limits for the drag offset, in px from where the element rests. */
|
|
1024
|
+
export interface DragBounds {
|
|
1025
|
+
top?: number;
|
|
1026
|
+
right?: number;
|
|
1027
|
+
bottom?: number;
|
|
1028
|
+
left?: number;
|
|
1029
|
+
}
|
|
1030
|
+
/** Offsets the element settles on after a release, per axis. */
|
|
1031
|
+
export interface DragSnap {
|
|
1032
|
+
x?: number[];
|
|
1033
|
+
y?: number[];
|
|
1034
|
+
}
|
|
1035
|
+
export interface DragInfo {
|
|
1036
|
+
/** Current offset from the resting position. */
|
|
1037
|
+
x: number;
|
|
1038
|
+
y: number;
|
|
1039
|
+
/** Offset since the drag started. */
|
|
1040
|
+
offset: {
|
|
1041
|
+
x: number;
|
|
1042
|
+
y: number;
|
|
1043
|
+
};
|
|
1044
|
+
/** Pointer velocity in px/s. */
|
|
1045
|
+
velocity: {
|
|
1046
|
+
x: number;
|
|
1047
|
+
y: number;
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Settings another directive on the same element can impose (e.g. a reorder
|
|
1052
|
+
* item fixes the axis and always settles back to its slot).
|
|
1053
|
+
* @internal
|
|
1054
|
+
*/
|
|
1055
|
+
export interface DragOverrides {
|
|
1056
|
+
axis?: 'x' | 'y' | 'both';
|
|
1057
|
+
constraints?: DragBounds;
|
|
1058
|
+
elastic?: number;
|
|
1059
|
+
momentum?: boolean;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Drag with constraints, elastic edges, momentum and snap points.
|
|
1063
|
+
*
|
|
1064
|
+
* <div motionDrag>free drag</div>
|
|
1065
|
+
* <div motionDrag="x" dragConstraints="parent">a track inside its window</div>
|
|
1066
|
+
* <div motionDrag="x" [dragSnap]="{ x: [0, -320, -640] }" (dragEnd)="onEnd($event)">a snapping carousel</div>
|
|
1067
|
+
*
|
|
1068
|
+
* - Moves the element with `x`/`y`, so it composes with whileTap scale etc.
|
|
1069
|
+
* Don't give the element a CSS transform of its own (wrap it instead).
|
|
1070
|
+
* - Starts after the pointer moves `dragThreshold` px, so clicks on links and
|
|
1071
|
+
* buttons inside still work; the click that ends a drag is swallowed.
|
|
1072
|
+
* - Sets `touch-action` so the other axis keeps scrolling on touch screens.
|
|
1073
|
+
* - On release it glides on (momentum) and settles inside the constraints, or
|
|
1074
|
+
* on the snap point nearest to where it was heading.
|
|
1075
|
+
*/
|
|
1076
|
+
export declare class MotionDragDirective {
|
|
1077
|
+
/** Axis: 'x', 'y', or both (default, also for an empty attribute). */
|
|
1078
|
+
readonly motionDrag: import("@angular/core").InputSignal<"" | "x" | "y" | "both">;
|
|
1079
|
+
/** 'parent' keeps the element within its parent; or pixel bounds from the resting position; or an element. */
|
|
1080
|
+
readonly dragConstraints: import("@angular/core").InputSignal<Element | "parent" | DragBounds | null>;
|
|
1081
|
+
/** How far it stretches past the constraints: 0 (hard stop) to 1 (no resistance). */
|
|
1082
|
+
readonly dragElastic: import("@angular/core").InputSignal<number>;
|
|
1083
|
+
/** Keep moving after release, in the direction it was thrown. */
|
|
1084
|
+
readonly dragMomentum: import("@angular/core").InputSignal<boolean>;
|
|
1085
|
+
readonly dragSnap: import("@angular/core").InputSignal<DragSnap | null>;
|
|
1086
|
+
/** Spring used to settle after release and for moveTo(). */
|
|
1087
|
+
readonly dragTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
1088
|
+
readonly dragThreshold: import("@angular/core").InputSignal<number>;
|
|
1089
|
+
readonly dragDisabled: import("@angular/core").InputSignal<boolean>;
|
|
1090
|
+
readonly dragStart: import("@angular/core").OutputEmitterRef<DragInfo>;
|
|
1091
|
+
readonly dragMove: import("@angular/core").OutputEmitterRef<DragInfo>;
|
|
1092
|
+
readonly dragEnd: import("@angular/core").OutputEmitterRef<DragInfo>;
|
|
1093
|
+
private readonly _x;
|
|
1094
|
+
private readonly _y;
|
|
1095
|
+
private readonly _dragging;
|
|
1096
|
+
/** Offset from the resting position, updated as it moves (also while settling). */
|
|
1097
|
+
readonly x: import("@angular/core").Signal<number>;
|
|
1098
|
+
readonly y: import("@angular/core").Signal<number>;
|
|
1099
|
+
readonly dragging: import("@angular/core").Signal<boolean>;
|
|
1100
|
+
private readonly el;
|
|
1101
|
+
private readonly motion;
|
|
1102
|
+
private readonly zone;
|
|
1103
|
+
private settle?;
|
|
1104
|
+
private raf;
|
|
1105
|
+
/** Offset when the current drag started, and its limits (both in offset space). */
|
|
1106
|
+
private start;
|
|
1107
|
+
private limits;
|
|
1108
|
+
/** @internal Set by directives that build on drag (see DragOverrides). */
|
|
1109
|
+
readonly overrides: import("@angular/core").WritableSignal<DragOverrides>;
|
|
1110
|
+
constructor();
|
|
1111
|
+
touchAction(): "none" | "pan-y" | "pan-x" | null;
|
|
1112
|
+
/** Move to an offset (e.g. from prev/next buttons), on the drag spring unless you pass a transition. */
|
|
1113
|
+
moveTo(x: number, y?: number, transition?: Record<string, unknown>): void;
|
|
1114
|
+
/**
|
|
1115
|
+
* The element's resting place moved by (dx, dy) in the layout (e.g. it was
|
|
1116
|
+
* moved in the DOM mid-drag). Shift the offset the other way so it stays
|
|
1117
|
+
* where it is on screen, under the pointer.
|
|
1118
|
+
*/
|
|
1119
|
+
rebase(dx: number, dy: number): void;
|
|
1120
|
+
private axis;
|
|
1121
|
+
private axisX;
|
|
1122
|
+
private axisY;
|
|
1123
|
+
/** The offset actually on screen (mid-animation included). */
|
|
1124
|
+
private read;
|
|
1125
|
+
/** Animate to an offset, keeping the x/y signals in step each frame. */
|
|
1126
|
+
private glide;
|
|
1127
|
+
private bounds;
|
|
1128
|
+
private elastic;
|
|
1129
|
+
private target;
|
|
1130
|
+
private info;
|
|
1131
|
+
private bind;
|
|
1132
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionDragDirective, never>;
|
|
1133
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionDragDirective, "[motionDrag]", ["motionDrag"], {
|
|
1134
|
+
"motionDrag": {
|
|
1135
|
+
"alias": "motionDrag";
|
|
1136
|
+
"required": false;
|
|
1137
|
+
"isSignal": true;
|
|
1138
|
+
};
|
|
1139
|
+
"dragConstraints": {
|
|
1140
|
+
"alias": "dragConstraints";
|
|
1141
|
+
"required": false;
|
|
1142
|
+
"isSignal": true;
|
|
1143
|
+
};
|
|
1144
|
+
"dragElastic": {
|
|
1145
|
+
"alias": "dragElastic";
|
|
1146
|
+
"required": false;
|
|
1147
|
+
"isSignal": true;
|
|
1148
|
+
};
|
|
1149
|
+
"dragMomentum": {
|
|
1150
|
+
"alias": "dragMomentum";
|
|
1151
|
+
"required": false;
|
|
1152
|
+
"isSignal": true;
|
|
1153
|
+
};
|
|
1154
|
+
"dragSnap": {
|
|
1155
|
+
"alias": "dragSnap";
|
|
1156
|
+
"required": false;
|
|
1157
|
+
"isSignal": true;
|
|
1158
|
+
};
|
|
1159
|
+
"dragTransition": {
|
|
1160
|
+
"alias": "dragTransition";
|
|
1161
|
+
"required": false;
|
|
1162
|
+
"isSignal": true;
|
|
1163
|
+
};
|
|
1164
|
+
"dragThreshold": {
|
|
1165
|
+
"alias": "dragThreshold";
|
|
1166
|
+
"required": false;
|
|
1167
|
+
"isSignal": true;
|
|
1168
|
+
};
|
|
1169
|
+
"dragDisabled": {
|
|
1170
|
+
"alias": "dragDisabled";
|
|
1171
|
+
"required": false;
|
|
1172
|
+
"isSignal": true;
|
|
1173
|
+
};
|
|
1174
|
+
}, {
|
|
1175
|
+
"dragStart": "dragStart";
|
|
1176
|
+
"dragMove": "dragMove";
|
|
1177
|
+
"dragEnd": "dragEnd";
|
|
1178
|
+
}, never, never, true, never>;
|
|
1179
|
+
}
|
|
1180
|
+
type Point = {
|
|
1181
|
+
x: number;
|
|
1182
|
+
y: number;
|
|
1183
|
+
};
|
|
1184
|
+
export interface PanInfo {
|
|
1185
|
+
/** Pointer position, relative to the viewport. */
|
|
1186
|
+
point: Point;
|
|
1187
|
+
/** Movement since the last event. */
|
|
1188
|
+
delta: Point;
|
|
1189
|
+
/** Movement since the pan started (from where the pointer went down). */
|
|
1190
|
+
offset: Point;
|
|
1191
|
+
/** Pointer velocity in px/s. */
|
|
1192
|
+
velocity: Point;
|
|
1193
|
+
}
|
|
1194
|
+
export type SwipeDirection = 'left' | 'right' | 'up' | 'down';
|
|
1195
|
+
export interface SwipeInfo extends PanInfo {
|
|
1196
|
+
direction: SwipeDirection;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Pan and swipe gestures: pointer movement reported as events, without moving
|
|
1200
|
+
* the element (use motionDrag for that).
|
|
1201
|
+
*
|
|
1202
|
+
* <div motionPan (pan)="rotate($event.delta.x)" (swipe)="onSwipe($event.direction)"
|
|
1203
|
+
* [whilePan]="{ scale: 0.97 }">…</div>
|
|
1204
|
+
*
|
|
1205
|
+
* - A pan starts once the pointer has moved `panThreshold` px; clicks still work.
|
|
1206
|
+
* - `swipe` fires on release when the pan went far enough (`swipeDistance`) or
|
|
1207
|
+
* fast enough (`swipeVelocity`) along its main axis.
|
|
1208
|
+
* - `whilePan` styles apply while panning. On release, transforms (x, scale,
|
|
1209
|
+
* rotate…) return to neutral and other styles to what they were before.
|
|
1210
|
+
* - `panAxis` limits panning to one axis and lets the other scroll on touch
|
|
1211
|
+
* screens (sets `touch-action`).
|
|
1212
|
+
*/
|
|
1213
|
+
export declare class MotionPanDirective {
|
|
1214
|
+
/** Axis to pan on: 'x', 'y' or both (default, also for an empty attribute). */
|
|
1215
|
+
readonly motionPan: import("@angular/core").InputSignal<"" | "x" | "y" | "both">;
|
|
1216
|
+
readonly panThreshold: import("@angular/core").InputSignal<number>;
|
|
1217
|
+
readonly swipeDistance: import("@angular/core").InputSignal<number>;
|
|
1218
|
+
readonly swipeVelocity: import("@angular/core").InputSignal<number>;
|
|
1219
|
+
readonly whilePan: import("@angular/core").InputSignal<Record<string, unknown> | null>;
|
|
1220
|
+
readonly panTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
1221
|
+
readonly panDisabled: import("@angular/core").InputSignal<boolean>;
|
|
1222
|
+
readonly panStart: import("@angular/core").OutputEmitterRef<PanInfo>;
|
|
1223
|
+
readonly pan: import("@angular/core").OutputEmitterRef<PanInfo>;
|
|
1224
|
+
readonly panEnd: import("@angular/core").OutputEmitterRef<PanInfo>;
|
|
1225
|
+
readonly swipe: import("@angular/core").OutputEmitterRef<SwipeInfo>;
|
|
1226
|
+
private readonly _panning;
|
|
1227
|
+
readonly panning: import("@angular/core").Signal<boolean>;
|
|
1228
|
+
private readonly el;
|
|
1229
|
+
private readonly motion;
|
|
1230
|
+
private readonly zone;
|
|
1231
|
+
constructor();
|
|
1232
|
+
touchAction(): "none" | "pan-y" | "pan-x" | null;
|
|
1233
|
+
/** The swipe a pan describes, if it went far or fast enough. */
|
|
1234
|
+
static swipeOf(info: PanInfo, distance: number, speed: number, axis?: 'x' | 'y' | 'both' | ''): SwipeDirection | null;
|
|
1235
|
+
private bind;
|
|
1236
|
+
/** What each whilePan style returns to: neutral for transforms, the current value for the rest. */
|
|
1237
|
+
private restingValues;
|
|
1238
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionPanDirective, never>;
|
|
1239
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionPanDirective, "[motionPan]", ["motionPan"], {
|
|
1240
|
+
"motionPan": {
|
|
1241
|
+
"alias": "motionPan";
|
|
1242
|
+
"required": false;
|
|
1243
|
+
"isSignal": true;
|
|
1244
|
+
};
|
|
1245
|
+
"panThreshold": {
|
|
1246
|
+
"alias": "panThreshold";
|
|
1247
|
+
"required": false;
|
|
1248
|
+
"isSignal": true;
|
|
1249
|
+
};
|
|
1250
|
+
"swipeDistance": {
|
|
1251
|
+
"alias": "swipeDistance";
|
|
1252
|
+
"required": false;
|
|
1253
|
+
"isSignal": true;
|
|
1254
|
+
};
|
|
1255
|
+
"swipeVelocity": {
|
|
1256
|
+
"alias": "swipeVelocity";
|
|
1257
|
+
"required": false;
|
|
1258
|
+
"isSignal": true;
|
|
1259
|
+
};
|
|
1260
|
+
"whilePan": {
|
|
1261
|
+
"alias": "whilePan";
|
|
1262
|
+
"required": false;
|
|
1263
|
+
"isSignal": true;
|
|
1264
|
+
};
|
|
1265
|
+
"panTransition": {
|
|
1266
|
+
"alias": "panTransition";
|
|
1267
|
+
"required": false;
|
|
1268
|
+
"isSignal": true;
|
|
1269
|
+
};
|
|
1270
|
+
"panDisabled": {
|
|
1271
|
+
"alias": "panDisabled";
|
|
1272
|
+
"required": false;
|
|
1273
|
+
"isSignal": true;
|
|
1274
|
+
};
|
|
1275
|
+
}, {
|
|
1276
|
+
"panStart": "panStart";
|
|
1277
|
+
"pan": "pan";
|
|
1278
|
+
"panEnd": "panEnd";
|
|
1279
|
+
"swipe": "swipe";
|
|
1280
|
+
}, never, never, true, never>;
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Drag-to-reorder lists, like Framer Motion's Reorder.Group / Reorder.Item.
|
|
1284
|
+
*
|
|
1285
|
+
* <ul [(motionReorderGroup)]="items" reorderAxis="y">
|
|
1286
|
+
* @for (item of items(); track item) {
|
|
1287
|
+
* <li [motionReorderItem]="item" tabindex="0">{{ item }}</li>
|
|
1288
|
+
* }
|
|
1289
|
+
* </ul>
|
|
1290
|
+
*
|
|
1291
|
+
* - Drag an item along the axis; once it passes the middle of its neighbour
|
|
1292
|
+
* the array is reordered (two-way bound, so `items` updates as you drag)
|
|
1293
|
+
* and the other items glide to their new places.
|
|
1294
|
+
* - On release it springs into its new slot and `reorderEnd` fires with the
|
|
1295
|
+
* final order.
|
|
1296
|
+
* - Keyboard: on a focused item, Alt + arrow keys move it one place.
|
|
1297
|
+
* - Track items by identity in `@for` (not `$index`), so the elements move
|
|
1298
|
+
* with their values. Items can have different sizes.
|
|
1299
|
+
*/
|
|
1300
|
+
export declare class MotionReorderGroupDirective<T = unknown> {
|
|
1301
|
+
/** The values, in order. Bind two-way: `[(motionReorderGroup)]="items"`. */
|
|
1302
|
+
readonly motionReorderGroup: import("@angular/core").ModelSignal<T[]>;
|
|
1303
|
+
readonly reorderAxis: import("@angular/core").InputSignal<"x" | "y">;
|
|
1304
|
+
/** Spring the other items move on. */
|
|
1305
|
+
readonly reorderTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
1306
|
+
/** The order after a drag or key move ends. */
|
|
1307
|
+
readonly reorderEnd: import("@angular/core").OutputEmitterRef<T[]>;
|
|
1308
|
+
private readonly items;
|
|
1309
|
+
private readonly motion;
|
|
1310
|
+
private readonly zone;
|
|
1311
|
+
private readonly injector;
|
|
1312
|
+
/** A reorder waiting for the DOM to catch up. */
|
|
1313
|
+
private pending;
|
|
1314
|
+
/** @internal */
|
|
1315
|
+
register(item: MotionReorderItemDirective<T>): () => boolean;
|
|
1316
|
+
/** @internal An item moved by `offset` along the axis while dragged: swap it with a neighbour it has passed. */
|
|
1317
|
+
dragged(item: MotionReorderItemDirective<T>, offset: number, direction: number): void;
|
|
1318
|
+
/** @internal Move an item to a new index, animating the others into place. */
|
|
1319
|
+
move(item: MotionReorderItemDirective<T>, to: number): boolean;
|
|
1320
|
+
/** @internal */
|
|
1321
|
+
ended(): void;
|
|
1322
|
+
private find;
|
|
1323
|
+
private pos;
|
|
1324
|
+
private size;
|
|
1325
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionReorderGroupDirective<any>, never>;
|
|
1326
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionReorderGroupDirective<any>, "[motionReorderGroup]", ["motionReorderGroup"], {
|
|
1327
|
+
"motionReorderGroup": {
|
|
1328
|
+
"alias": "motionReorderGroup";
|
|
1329
|
+
"required": true;
|
|
1330
|
+
"isSignal": true;
|
|
1331
|
+
};
|
|
1332
|
+
"reorderAxis": {
|
|
1333
|
+
"alias": "reorderAxis";
|
|
1334
|
+
"required": false;
|
|
1335
|
+
"isSignal": true;
|
|
1336
|
+
};
|
|
1337
|
+
"reorderTransition": {
|
|
1338
|
+
"alias": "reorderTransition";
|
|
1339
|
+
"required": false;
|
|
1340
|
+
"isSignal": true;
|
|
1341
|
+
};
|
|
1342
|
+
}, {
|
|
1343
|
+
"motionReorderGroup": "motionReorderGroupChange";
|
|
1344
|
+
"reorderEnd": "reorderEnd";
|
|
1345
|
+
}, never, never, true, never>;
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* An item in a `motionReorderGroup`. Draggable along the group's axis; it
|
|
1349
|
+
* springs back into its slot on release. Accepts motionDrag's `dragTransition`
|
|
1350
|
+
* and `dragDisabled`, and emits `dragStart` / `dragMove` / `dragEnd`. Raised
|
|
1351
|
+
* (z-index 1) while it is away from its slot.
|
|
1352
|
+
*/
|
|
1353
|
+
export declare class MotionReorderItemDirective<T = unknown> {
|
|
1354
|
+
readonly motionReorderItem: import("@angular/core").InputSignal<T>;
|
|
1355
|
+
/** @internal */
|
|
1356
|
+
readonly drag: MotionDragDirective;
|
|
1357
|
+
/** @internal */
|
|
1358
|
+
readonly el: HTMLElement;
|
|
1359
|
+
private readonly group;
|
|
1360
|
+
constructor();
|
|
1361
|
+
raised(): boolean;
|
|
1362
|
+
onKey(e: KeyboardEvent): void;
|
|
1363
|
+
private readonly injector;
|
|
1364
|
+
private offset;
|
|
1365
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MotionReorderItemDirective<any>, never>;
|
|
1366
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MotionReorderItemDirective<any>, "[motionReorderItem]", ["motionReorderItem"], {
|
|
1367
|
+
"motionReorderItem": {
|
|
1368
|
+
"alias": "motionReorderItem";
|
|
1369
|
+
"required": true;
|
|
1370
|
+
"isSignal": true;
|
|
1371
|
+
};
|
|
1372
|
+
}, {}, never, never, true, [{
|
|
1373
|
+
directive: typeof MotionDragDirective;
|
|
1374
|
+
inputs: {
|
|
1375
|
+
"dragTransition": "dragTransition";
|
|
1376
|
+
"dragDisabled": "dragDisabled";
|
|
1377
|
+
};
|
|
1378
|
+
outputs: {
|
|
1379
|
+
"dragStart": "dragStart";
|
|
1380
|
+
"dragMove": "dragMove";
|
|
1381
|
+
"dragEnd": "dragEnd";
|
|
1382
|
+
};
|
|
1383
|
+
}]>;
|
|
1384
|
+
}
|
|
782
1385
|
export type { TimelineStep, TransitionOptions, VariantWithTransition };
|