@hilux/ngx-motion 2.1.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/package.json CHANGED
@@ -52,5 +52,5 @@
52
52
  "default": "./package.json"
53
53
  }
54
54
  },
55
- "version": "2.1.0"
55
+ "version": "2.3.0"
56
56
  }
@@ -1382,4 +1382,146 @@ export declare class MotionReorderItemDirective<T = unknown> {
1382
1382
  };
1383
1383
  }]>;
1384
1384
  }
1385
+ /** A layout box: centre and size, in layout coordinates (transforms and scrolling ignored). */
1386
+ interface Box {
1387
+ cx: number;
1388
+ cy: number;
1389
+ w: number;
1390
+ h: number;
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
+ }
1398
+ /**
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.
1402
+ * @internal
1403
+ */
1404
+ export declare class MotionLayoutRegistry {
1405
+ private readonly seen;
1406
+ private readonly stacks;
1407
+ record(id: string, owner: object, box: Box): void;
1408
+ /** The box another element left for this id, if any. */
1409
+ from(id: string, owner: object): Box | undefined;
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;
1414
+ static ɵfac: i0.ɵɵFactoryDeclaration<MotionLayoutRegistry, never>;
1415
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1416
+ }
1417
+ /**
1418
+ * Layout animations, like Framer Motion's `layout` and `layoutId`.
1419
+ *
1420
+ * <!-- Glides to its new place (and size) whenever the layout changes -->
1421
+ * <li motionLayout>…</li>
1422
+ * <div motionLayout="position">only moves; size changes jump</div>
1423
+ *
1424
+ * <!-- Shared element: a new element with the same id starts where the old one was -->
1425
+ * @for (tab of tabs; track tab) {
1426
+ * <button (click)="active = tab">{{ tab }}
1427
+ * @if (active === tab) { <span class="underline" motionLayoutId="underline"></span> }
1428
+ * </button>
1429
+ * }
1430
+ *
1431
+ * After every render it measures the element's layout box (offsets, so
1432
+ * transforms and scrolling don't count). When the box has changed, it jumps
1433
+ * back to where it was drawn (FLIP) and springs to the new place: x/y for
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.
1444
+ *
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".
1448
+ * - Uses transform (centre origin); don't give the element a CSS transform
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).
1452
+ */
1453
+ export declare class MotionLayoutDirective implements Member {
1454
+ /** What animates: both (default, also for an empty attribute), 'position' or 'size'. */
1455
+ readonly motionLayout: import("@angular/core").InputSignal<boolean | "" | "position" | "both" | "size">;
1456
+ /** Shared layout id: an element with the same id that appears takes over from this one. */
1457
+ readonly motionLayoutId: import("@angular/core").InputSignal<string | null | undefined>;
1458
+ readonly layoutTransition: import("@angular/core").InputSignal<Record<string, unknown>>;
1459
+ readonly layoutAnimationStart: import("@angular/core").OutputEmitterRef<void>;
1460
+ readonly layoutAnimationComplete: import("@angular/core").OutputEmitterRef<void>;
1461
+ private readonly _animating;
1462
+ readonly animating: import("@angular/core").Signal<boolean>;
1463
+ private readonly el;
1464
+ private readonly motion;
1465
+ private readonly registry;
1466
+ private prev;
1467
+ /** Layout box to viewport offset (scrolling), measured for shared ids only. */
1468
+ private shift;
1469
+ private cur;
1470
+ private controls?;
1471
+ private run?;
1472
+ /** Measure again without animating (after a window resize). */
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;
1482
+ private readonly reduced;
1483
+ constructor();
1484
+ /** @internal */
1485
+ setHidden(hidden: boolean): void;
1486
+ /** @internal */
1487
+ resume(from: Box | undefined): void;
1488
+ private mode;
1489
+ /** Layout box from offsets: unaffected by transforms (ours or anyone's) and by scrolling. */
1490
+ private measure;
1491
+ /** A box in layout coordinates moved to (or, with -1, from) viewport coordinates. */
1492
+ private shifted;
1493
+ /** Where the element is drawn: its layout box moved and scaled by our transform. */
1494
+ private visual;
1495
+ private update;
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;
1499
+ /**
1500
+ * Set our transform. Written straight to the style (not through Motion's
1501
+ * next frame), so what's drawn always matches `cur`: measuring and
1502
+ * interrupting read the same position the user sees.
1503
+ */
1504
+ private apply;
1505
+ static ɵfac: i0.ɵɵFactoryDeclaration<MotionLayoutDirective, never>;
1506
+ static ɵdir: i0.ɵɵDirectiveDeclaration<MotionLayoutDirective, "[motionLayout], [motionLayoutId]", ["motionLayout"], {
1507
+ "motionLayout": {
1508
+ "alias": "motionLayout";
1509
+ "required": false;
1510
+ "isSignal": true;
1511
+ };
1512
+ "motionLayoutId": {
1513
+ "alias": "motionLayoutId";
1514
+ "required": false;
1515
+ "isSignal": true;
1516
+ };
1517
+ "layoutTransition": {
1518
+ "alias": "layoutTransition";
1519
+ "required": false;
1520
+ "isSignal": true;
1521
+ };
1522
+ }, {
1523
+ "layoutAnimationStart": "layoutAnimationStart";
1524
+ "layoutAnimationComplete": "layoutAnimationComplete";
1525
+ }, never, never, true, never>;
1526
+ }
1385
1527
  export type { TimelineStep, TransitionOptions, VariantWithTransition };