@hilux/ngx-motion 2.2.0 → 2.3.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 +49 -2
- package/fesm2022/hilux-ngx-motion.mjs +79 -11
- package/fesm2022/hilux-ngx-motion.mjs.map +1 -1
- package/package.json +1 -1
- package/types/hilux-ngx-motion.d.ts +47 -13
package/package.json
CHANGED
|
@@ -1389,18 +1389,28 @@ interface Box {
|
|
|
1389
1389
|
w: number;
|
|
1390
1390
|
h: number;
|
|
1391
1391
|
}
|
|
1392
|
+
/** What the registry needs from a member. @internal */
|
|
1393
|
+
interface Member {
|
|
1394
|
+
/** Become the visible one again and fly in from where the last lead was (viewport box). */
|
|
1395
|
+
resume(from: Box | undefined): void;
|
|
1396
|
+
setHidden(hidden: boolean): void;
|
|
1397
|
+
}
|
|
1392
1398
|
/**
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1399
|
+
* Shared layout ids. For each id: the mounted elements (the newest one, the
|
|
1400
|
+
* lead, is shown and the others are hidden) and where the id was last drawn,
|
|
1401
|
+
* in viewport coordinates so it holds across scroll containers.
|
|
1396
1402
|
* @internal
|
|
1397
1403
|
*/
|
|
1398
1404
|
export declare class MotionLayoutRegistry {
|
|
1399
1405
|
private readonly seen;
|
|
1406
|
+
private readonly stacks;
|
|
1400
1407
|
record(id: string, owner: object, box: Box): void;
|
|
1401
1408
|
/** The box another element left for this id, if any. */
|
|
1402
1409
|
from(id: string, owner: object): Box | undefined;
|
|
1403
|
-
|
|
1410
|
+
/** A new element with this id: it leads, and the one it took over from is hidden. */
|
|
1411
|
+
join(id: string, m: Member): void;
|
|
1412
|
+
/** An element with this id is going: if it led, the one before it comes back from its box. */
|
|
1413
|
+
leave(id: string, m: Member): void;
|
|
1404
1414
|
static ɵfac: i0.ɵɵFactoryDeclaration<MotionLayoutRegistry, never>;
|
|
1405
1415
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1406
1416
|
}
|
|
@@ -1409,7 +1419,7 @@ export declare class MotionLayoutRegistry {
|
|
|
1409
1419
|
*
|
|
1410
1420
|
* <!-- Glides to its new place (and size) whenever the layout changes -->
|
|
1411
1421
|
* <li motionLayout>…</li>
|
|
1412
|
-
* <div motionLayout="position">only moves; size changes jump
|
|
1422
|
+
* <div motionLayout="position">only moves; size changes jump</div>
|
|
1413
1423
|
*
|
|
1414
1424
|
* <!-- Shared element: a new element with the same id starts where the old one was -->
|
|
1415
1425
|
* @for (tab of tabs; track tab) {
|
|
@@ -1421,19 +1431,28 @@ export declare class MotionLayoutRegistry {
|
|
|
1421
1431
|
* After every render it measures the element's layout box (offsets, so
|
|
1422
1432
|
* transforms and scrolling don't count). When the box has changed, it jumps
|
|
1423
1433
|
* back to where it was drawn (FLIP) and springs to the new place: x/y for
|
|
1424
|
-
* position, scaleX/scaleY for size.
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1434
|
+
* position, scaleX/scaleY for size. Every element is measured after every
|
|
1435
|
+
* render, so siblings that weren't re-rendered animate too (no LayoutGroup
|
|
1436
|
+
* needed). Interrupted animations continue from where they are. Resizing the
|
|
1437
|
+
* window re-measures without animating, and with reduced motion it doesn't
|
|
1438
|
+
* animate.
|
|
1439
|
+
*
|
|
1440
|
+
* Shared ids: while two elements with the same id are mounted (a thumbnail
|
|
1441
|
+
* and its open lightbox), the newer one is shown and the older one hidden;
|
|
1442
|
+
* when the newer one is removed, the older one reappears and flies back from
|
|
1443
|
+
* where it was.
|
|
1427
1444
|
*
|
|
1428
|
-
* - Size changes scale the element
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1445
|
+
* - Size changes scale the element. Corner radii are corrected; mark content
|
|
1446
|
+
* with `motionLayoutCorrect` to counter-scale it (it keeps its own size),
|
|
1447
|
+
* or use "position".
|
|
1431
1448
|
* - Uses transform (centre origin); don't give the element a CSS transform
|
|
1432
1449
|
* of its own, wrap it instead.
|
|
1450
|
+
* - Has the class `motion-layout-animating` while it moves (to raise it with
|
|
1451
|
+
* a z-index, for example).
|
|
1433
1452
|
*/
|
|
1434
|
-
export declare class MotionLayoutDirective {
|
|
1453
|
+
export declare class MotionLayoutDirective implements Member {
|
|
1435
1454
|
/** What animates: both (default, also for an empty attribute), 'position' or 'size'. */
|
|
1436
|
-
readonly motionLayout: import("@angular/core").InputSignal<boolean | "" | "position" | "
|
|
1455
|
+
readonly motionLayout: import("@angular/core").InputSignal<boolean | "" | "position" | "both" | "size">;
|
|
1437
1456
|
/** Shared layout id: an element with the same id that appears takes over from this one. */
|
|
1438
1457
|
readonly motionLayoutId: import("@angular/core").InputSignal<string | null | undefined>;
|
|
1439
1458
|
readonly layoutTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
@@ -1449,10 +1468,23 @@ export declare class MotionLayoutDirective {
|
|
|
1449
1468
|
private shift;
|
|
1450
1469
|
private cur;
|
|
1451
1470
|
private controls?;
|
|
1471
|
+
private run?;
|
|
1452
1472
|
/** Measure again without animating (after a window resize). */
|
|
1453
1473
|
private resnap;
|
|
1474
|
+
/** The id this element joined the registry with. */
|
|
1475
|
+
private joined;
|
|
1476
|
+
/** Fly in from here (a viewport box) at the next update: the lead with our id went away. */
|
|
1477
|
+
private resumeFrom;
|
|
1478
|
+
/** Corner radii (px) while scaling; null when there are none to correct. */
|
|
1479
|
+
private radii;
|
|
1480
|
+
/** The element's own inline border-radius, put back afterwards. */
|
|
1481
|
+
private inlineRadius;
|
|
1454
1482
|
private readonly reduced;
|
|
1455
1483
|
constructor();
|
|
1484
|
+
/** @internal */
|
|
1485
|
+
setHidden(hidden: boolean): void;
|
|
1486
|
+
/** @internal */
|
|
1487
|
+
resume(from: Box | undefined): void;
|
|
1456
1488
|
private mode;
|
|
1457
1489
|
/** Layout box from offsets: unaffected by transforms (ours or anyone's) and by scrolling. */
|
|
1458
1490
|
private measure;
|
|
@@ -1462,6 +1494,8 @@ export declare class MotionLayoutDirective {
|
|
|
1462
1494
|
private visual;
|
|
1463
1495
|
private update;
|
|
1464
1496
|
private animateFrom;
|
|
1497
|
+
/** The element's own corner radii in px (percentages scale with the box already, so they're left alone). */
|
|
1498
|
+
private readRadii;
|
|
1465
1499
|
/**
|
|
1466
1500
|
* Set our transform. Written straight to the style (not through Motion's
|
|
1467
1501
|
* next frame), so what's drawn always matches `cur`: measuring and
|