@ngutil/style 0.0.115 → 0.0.118

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, NgZone, Injectable, DOCUMENT } from '@angular/core';
3
- import { Observable, distinctUntilChanged, shareReplay, map, of, combineLatest } from 'rxjs';
4
- import { coerceElement, isPlainObject, __zone_symbol__, rawRequestAnimationFrame, rawCancelAnimationFrame, NumberWithUnit } from '@ngutil/common';
3
+ import { finalize, shareReplay, Observable, distinctUntilChanged, map, of, combineLatest } from 'rxjs';
4
+ import { coerceElement, isEqual as isEqual$1, isPlainObject, __zone_symbol__, rawRequestAnimationFrame, rawCancelAnimationFrame, NumberWithUnit } from '@ngutil/common';
5
5
  import { isEqual, clamp } from 'es-toolkit';
6
6
 
7
7
  class MediaWatcher {
@@ -13,7 +13,7 @@ class MediaWatcher {
13
13
  watch(query) {
14
14
  let watcher = this.#watches[query];
15
15
  if (!watcher) {
16
- watcher = this.#newWatcher(query);
16
+ watcher = this.#newWatcher(query).pipe(finalize(() => delete this.#watches[query]), shareReplay({ refCount: true, bufferSize: 1 }));
17
17
  this.#watches[query] = watcher;
18
18
  }
19
19
  return watcher;
@@ -30,7 +30,7 @@ class MediaWatcher {
30
30
  queryWatcher.removeEventListener("change", listener);
31
31
  delete this.#watches[query];
32
32
  };
33
- }).pipe(distinctUntilChanged(), shareReplay(1)));
33
+ }).pipe(distinctUntilChanged()));
34
34
  }
35
35
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: MediaWatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
36
36
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: MediaWatcher, providedIn: "root" }); }
@@ -108,7 +108,7 @@ class DimensionWatcher {
108
108
  watcher = this.#createResizeWatcher(watches, element, box);
109
109
  }
110
110
  }
111
- watches.set(element, watcher);
111
+ watches.set(element, watcher.pipe(finalize(() => watches.delete(element)), shareReplay({ refCount: true, bufferSize: 1 })));
112
112
  }
113
113
  return watcher;
114
114
  }
@@ -141,7 +141,7 @@ class DimensionWatcher {
141
141
  observer.disconnect();
142
142
  watches.delete(el);
143
143
  };
144
- }).pipe(distinctUntilChanged(dimensionIsEq), shareReplay(1)));
144
+ }).pipe(distinctUntilChanged(dimensionIsEq)));
145
145
  }
146
146
  #createScollWatcher(watches, el) {
147
147
  const borderBox = this.watch(el, "border-box");
@@ -171,7 +171,7 @@ class DimensionWatcher {
171
171
  mutation.disconnect();
172
172
  watches.delete(el);
173
173
  };
174
- }).pipe(distinctUntilChanged(dimensionIsEq), shareReplay(1)));
174
+ }).pipe(distinctUntilChanged(dimensionIsEq)));
175
175
  }
176
176
  #createWindowResizeWatcher() {
177
177
  return this.#zone.runOutsideAngular(() => new Observable((sub) => {
@@ -186,7 +186,7 @@ class DimensionWatcher {
186
186
  return () => {
187
187
  window.removeEventListener("resize", onResize);
188
188
  };
189
- }).pipe(distinctUntilChanged(dimensionIsEq), shareReplay(1)));
189
+ }).pipe(distinctUntilChanged(dimensionIsEq)));
190
190
  }
191
191
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DimensionWatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
192
192
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: DimensionWatcher, providedIn: "root" }); }
@@ -210,7 +210,7 @@ class PositionWatcher {
210
210
  element = coerceElement(element);
211
211
  let watcher = this.#watches.get(element);
212
212
  if (watcher == null) {
213
- watcher = this.#createWatcher(element);
213
+ watcher = this.#createWatcher(element).pipe(finalize(() => this.#watches.delete(element)), shareReplay({ refCount: true, bufferSize: 1 }));
214
214
  this.#watches.set(element, watcher);
215
215
  }
216
216
  return watcher;
@@ -231,7 +231,7 @@ class PositionWatcher {
231
231
  return () => {
232
232
  rafId && cancelAnimationFrame(rafId);
233
233
  };
234
- }).pipe(distinctUntilChanged(isEqual), shareReplay(1)));
234
+ }).pipe(distinctUntilChanged(isEqual)));
235
235
  }
236
236
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: PositionWatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
237
237
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: PositionWatcher, providedIn: "root" }); }
@@ -262,6 +262,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImpo
262
262
  args: [{ providedIn: "root" }]
263
263
  }] });
264
264
 
265
+ class ScrollOffsetWatcher {
266
+ #zone = inject(NgZone);
267
+ #watches = new Map();
268
+ watch(element) {
269
+ element = coerceElement(element);
270
+ let watcher = this.#watches.get(element);
271
+ if (watcher == null) {
272
+ watcher = this.#createWatcher(element).pipe(finalize(() => this.#watches.delete(element)), shareReplay({ refCount: true, bufferSize: 1 }));
273
+ this.#watches.set(element, watcher);
274
+ }
275
+ return watcher;
276
+ }
277
+ #createWatcher(element) {
278
+ if (element instanceof Window) {
279
+ return this.#createElementWatcher(element);
280
+ }
281
+ const watchers = [];
282
+ let el = coerceElement(element);
283
+ while (el) {
284
+ if (el.tagName === "BODY") {
285
+ watchers.push(this.#createElementWatcher(window));
286
+ break;
287
+ }
288
+ watchers.push(this.#createElementWatcher(el));
289
+ el = el.parentElement;
290
+ }
291
+ return combineLatest(watchers).pipe(map(positions => positions.reduce((acc, pos) => ({ x: acc.x + pos.x, y: acc.y + pos.y }), { x: 0, y: 0 })), distinctUntilChanged(isEqual$1));
292
+ }
293
+ #createElementWatcher(element) {
294
+ console.log("create scroll watcher for", element);
295
+ return this.#zone.runOutsideAngular(() => new Observable(dst => {
296
+ const handler = element instanceof Window
297
+ ? () => dst.next({ x: element.scrollX, y: element.scrollY })
298
+ : () => dst.next({ x: element.scrollLeft, y: element.scrollTop });
299
+ handler();
300
+ element.addEventListener("scroll", handler, { capture: true, passive: true });
301
+ return () => element.removeEventListener("scroll", handler, { capture: true });
302
+ }).pipe(distinctUntilChanged(isEqual$1)));
303
+ }
304
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: ScrollOffsetWatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
305
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: ScrollOffsetWatcher, providedIn: "root" }); }
306
+ }
307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: ScrollOffsetWatcher, decorators: [{
308
+ type: Injectable,
309
+ args: [{ providedIn: "root" }]
310
+ }] });
311
+
265
312
  class NodeRemovedWatcher {
266
313
  #zone = inject(NgZone);
267
314
  #watches = new Map();
@@ -269,7 +316,7 @@ class NodeRemovedWatcher {
269
316
  element = coerceElement(element);
270
317
  let watcher = this.#watches.get(element);
271
318
  if (watcher == null) {
272
- watcher = this.#createWatcher(element);
319
+ watcher = this.#createWatcher(element).pipe(finalize(() => this.#watches.delete(element)));
273
320
  this.#watches.set(element, watcher);
274
321
  }
275
322
  return watcher;
@@ -535,6 +582,9 @@ function rectContract(rect, padding) {
535
582
  function rectContainsPoint(rect, point) {
536
583
  return point.x >= rect.x && point.x < rect.x + rect.width && point.y >= rect.y && point.y < rect.y + rect.height;
537
584
  }
585
+ function rectIntersect(a, b) {
586
+ return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y;
587
+ }
538
588
 
539
589
  const ZERO_PADDING = sidesNormalize(0);
540
590
  const ZERO_CONNECTION = { x: 0, y: 0 };
@@ -548,14 +598,15 @@ function floatingPosition({ dims, options }) {
548
598
  };
549
599
  const anchor = {
550
600
  rect: options.anchor.margin ? rectExpand(dims.anchor, options.anchor.margin) : dims.anchor,
551
- link: alignmentNormalize(options.anchor.link)
601
+ link: alignmentNormalize(options.anchor.link),
602
+ visible: false
552
603
  };
553
- const minWidth = dims.constraints?.minWidth || 0;
554
- const minHeight = dims.constraints?.minHeight || 0;
555
- const maxWidth = dims.constraints?.maxWidth || Infinity;
556
- const maxHeight = dims.constraints?.maxHeight || Infinity;
604
+ const minWidth = dims.sizeConstraints?.minWidth || 0;
605
+ const minHeight = dims.sizeConstraints?.minHeight || 0;
606
+ const maxWidth = dims.sizeConstraints?.maxWidth || Infinity;
607
+ const maxHeight = dims.sizeConstraints?.maxHeight || Infinity;
557
608
  const content = {
558
- rect: { x: 0, y: 0, ...dims.content },
609
+ rect: { ...dims.content, x: 0, y: 0 },
559
610
  link: alignmentNormalize(options.content.link),
560
611
  constrained: {
561
612
  width: clamp(dims.content.width, minWidth, maxWidth),
@@ -567,7 +618,7 @@ function floatingPosition({ dims, options }) {
567
618
  anchor,
568
619
  content,
569
620
  connection: ZERO_CONNECTION,
570
- constrains: dims.constraints,
621
+ sizeConstraints: dims.sizeConstraints,
571
622
  direction: "down" /* FloatingPositionDirection.Down */
572
623
  };
573
624
  const area = placementArea(position, anchor.link, content.link);
@@ -579,72 +630,56 @@ function floatingPosition({ dims, options }) {
579
630
  applyAlts(position, "V" /* FloatingPositionAltAxis.Vertical */, options.verticalAlt);
580
631
  }
581
632
  position.direction = floatingPositionDirection(position);
633
+ position.anchor.visible = rectIntersect(position.placement.rectWithPadding, position.anchor.rect);
582
634
  return position;
583
635
  }
584
636
  function placementArea(pos, anchorLink, contentLink) {
585
637
  const connection = rectOrigin(pos.anchor.rect, anchorLink);
586
638
  let { x, y } = connection;
587
639
  const placement = pos.placement.rect;
640
+ const constraint = pos.placement.rectWithPadding;
588
641
  const placementPad = pos.placement.padding;
589
- let width = 0;
590
- let height = 0;
642
+ let { width, height } = placement;
591
643
  switch (contentLink.horizontal) {
592
644
  case "left":
593
645
  case "start":
594
- width = placement.width - x;
595
646
  break;
596
647
  case "center":
597
648
  if (anchorLink.horizontal === "center") {
598
- width = placement.width;
599
649
  x = placement.x;
600
650
  }
601
651
  else {
602
- const leftSize = x - placementPad.left.value;
603
- const rightSize = placement.width - x - placementPad.right.value;
604
- const mw = Math.max(0, Math.min(leftSize, rightSize));
605
- width = mw * 2;
606
- x -= mw;
652
+ x -= pos.content.constrained.width / 2;
607
653
  }
608
654
  break;
609
655
  case "end":
610
656
  case "right":
611
- width = x - placement.x;
612
- x = placement.x;
657
+ width = x - placementPad.left.value;
658
+ if (anchorLink.horizontal === "center") {
659
+ x = placement.x;
660
+ }
661
+ else {
662
+ x -= pos.content.constrained.width;
663
+ }
613
664
  break;
614
665
  }
615
666
  switch (contentLink.vertical) {
616
667
  case "top":
617
- height = placement.height - y;
618
668
  break;
619
669
  case "middle":
620
670
  if (anchorLink.vertical === "middle") {
621
- height = placement.height;
622
671
  y = placement.y;
623
672
  }
624
673
  else {
625
- const topSize = y - placementPad.top.value;
626
- const bottomSize = placement.height - y - placementPad.bottom.value;
627
- const mh = Math.max(0, Math.min(topSize, bottomSize));
628
- height = mh * 2;
629
- y -= mh;
674
+ y -= pos.content.constrained.height / 2;
630
675
  }
631
676
  break;
632
677
  case "bottom":
633
- height = y - placement.y;
678
+ height = y - placementPad.top.value;
634
679
  y = placement.y;
635
680
  break;
636
681
  }
637
- const constraint = pos.placement.rectWithPadding;
638
- const newX = Math.max(x, constraint.x);
639
- const newY = Math.max(y, constraint.y);
640
- const diffX = newX - x;
641
- const diffY = newY - y;
642
- const area = {
643
- x: newX,
644
- y: newY,
645
- width: Math.min(newX + width - diffX, constraint.x + constraint.width) - newX,
646
- height: Math.min(newY + height - diffY, constraint.y + constraint.height) - newY
647
- };
682
+ const area = rectConstraint({ x, y, width, height }, constraint);
648
683
  return { area, contentLink, anchorLink, connection };
649
684
  }
650
685
  function setPlacement(position, { area, anchorLink, contentLink, connection }) {
@@ -747,11 +782,15 @@ function oppositeLink(axis, link) {
747
782
  return { horizontal: link.horizontal, vertical: AlignVerticalOpposite[link.vertical] };
748
783
  }
749
784
  }
750
- function floatingPositionToStyle(pos) {
785
+ function floatingPositionToStyle(pos, display = "inline-flex") {
786
+ if (pos.anchor.visible === false) {
787
+ return { "display": "none", "pointerEvents": "none" };
788
+ }
751
789
  const contentRect = pos.content.rect;
752
790
  const placementRect = pos.placement.rect;
753
791
  // const { width: maxWidth, height: maxHeight } = pos.placement.area
754
- const style = {};
792
+ const style = { display: display, pointerEvents: "" };
793
+ // TODO: translate3d
755
794
  if (pos.content.link.horizontal === "right") {
756
795
  style["right"] = `${placementRect.width - (contentRect.x + contentRect.width)}px`;
757
796
  style["left"] = "auto";
@@ -811,5 +850,5 @@ function floatingPositionDirection(pos) {
811
850
  * Generated bundle index. Do not edit.
812
851
  */
813
852
 
814
- export { ColorSchemeService, DimensionWatcher, Duration, Ease, MediaWatcher, NodeRemovedWatcher, PositionWatcher, RectWatcher, alignmentNormalize, alignmentToTransformOrigin, floatingPosition, floatingPositionDirection, floatingPositionToStyle, inAnimation, inTransition, isAnimating, positionAltNormalize, rectConstraint, rectContainsPoint, rectContract, rectExpand, rectMoveOrigin, rectOrigin, sidesNormalize };
853
+ export { ColorSchemeService, DimensionWatcher, Duration, Ease, MediaWatcher, NodeRemovedWatcher, PositionWatcher, RectWatcher, ScrollOffsetWatcher, alignmentNormalize, alignmentToTransformOrigin, floatingPosition, floatingPositionDirection, floatingPositionToStyle, inAnimation, inTransition, isAnimating, positionAltNormalize, rectConstraint, rectContainsPoint, rectContract, rectExpand, rectIntersect, rectMoveOrigin, rectOrigin, sidesNormalize };
815
854
  //# sourceMappingURL=ngutil-style.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngutil-style.mjs","sources":["../../../../packages/style/src/services/media-watcher.service.ts","../../../../packages/style/src/services/color-scheme.service.ts","../../../../packages/style/src/sass/animation/vars/index.ts","../../../../packages/style/src/services/dimension-watcher.service.ts","../../../../packages/style/src/services/position-watcher.service.ts","../../../../packages/style/src/services/rect-watcher.service.ts","../../../../packages/style/src/services/node-removed-watcher.service.ts","../../../../packages/style/src/util/alignment.ts","../../../../packages/style/src/util/in-animation.ts","../../../../packages/style/src/util/sides.ts","../../../../packages/style/src/util/rect.ts","../../../../packages/style/src/util/floating-position.ts","../../../../packages/style/src/ngutil-style.ts"],"sourcesContent":["import { inject, Injectable, NgZone } from \"@angular/core\"\n\nimport { distinctUntilChanged, Observable, shareReplay, Subscriber } from \"rxjs\"\n\n@Injectable({ providedIn: \"root\" })\nexport class MediaWatcher {\n readonly #zone = inject(NgZone)\n #watches: { [key: string]: Observable<boolean> } = {}\n\n /**\n * svc.watch(\"(display-mode: standalone)\").subscribe(match => {})\n */\n watch(query: string): Observable<boolean> {\n let watcher = this.#watches[query]\n if (!watcher) {\n watcher = this.#newWatcher(query)\n this.#watches[query] = watcher\n }\n return watcher\n }\n\n #newWatcher(query: string): Observable<boolean> {\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<boolean>) => {\n const queryWatcher = window.matchMedia(query)\n const listener = (event: MediaQueryListEvent) => {\n sub.next(event.matches)\n }\n queryWatcher.addEventListener(\"change\", listener)\n sub.next(queryWatcher.matches)\n return () => {\n queryWatcher.removeEventListener(\"change\", listener)\n delete this.#watches[query]\n }\n }).pipe(distinctUntilChanged(), shareReplay(1))\n )\n }\n}\n","import { inject, Injectable } from \"@angular/core\"\n\nimport { map, Observable, shareReplay } from \"rxjs\"\n\nimport { MediaWatcher } from \"./media-watcher.service\"\n\n@Injectable({ providedIn: \"root\" })\nexport class ColorSchemeService {\n readonly #mq = inject(MediaWatcher)\n readonly isDark: Observable<boolean> = this.#mq.watch(\"(prefers-color-scheme: dark)\")\n readonly isLight = this.isDark.pipe(\n map(v => !v),\n shareReplay(1)\n )\n\n // TODO: set preferred color scheme (dark/light)\n}\n","/* eslint-disable */\n/* eslint-disable prettier/prettier */\n/* ! AUTO GENERATED DO NOT EDIT ! */\n\nexport class Ease {\n static readonly Deceleration = \"cubic-bezier(0, 0, 0.2, 1)\" as const\n static readonly Standard = \"cubic-bezier(0.4, 0, 0.2, 1)\" as const\n static readonly Acceleration = \"cubic-bezier(0.4, 0, 1, 1)\" as const\n static readonly Sharp = \"cubic-bezier(0.4, 0, 0.6, 1)\" as const\n /**\n * Reach nearly end position fast, and slowly move to final position\n */\n static readonly Emphasized = \"cubic-bezier(0.12, 0.9, 0.12, 0.9)\" as const\n}\n\nexport class Duration {\n static readonly Fast = \"200ms\" as const\n static readonly FastMs = 200 as const\n static readonly Medium = \"300ms\" as const\n static readonly MediumMs = 300 as const\n static readonly Slow = \"400ms\" as const\n static readonly SlowMs = 400 as const\n static readonly Snail = \"600ms\" as const\n static readonly SnailMs = 600 as const\n}\n","\nimport { inject, Injectable, NgZone, DOCUMENT } from \"@angular/core\"\n\nimport { distinctUntilChanged, Observable, shareReplay, Subscriber } from \"rxjs\"\n\nimport { coerceElement, ElementInput } from \"@ngutil/common\"\n\nimport { Dimension } from \"../util/rect\"\n\nexport type WatchBox = ResizeObserverBoxOptions | \"scroll-box\"\nexport type Watches = Map<HTMLElement | Window, Observable<Dimension>>\n\n@Injectable({ providedIn: \"root\" })\nexport class DimensionWatcher {\n readonly #zone = inject(NgZone)\n readonly #document = inject(DOCUMENT)\n readonly #watches: { [key in WatchBox]?: Watches } = {}\n\n watch(element: ElementInput | Window, box: WatchBox): Observable<Dimension> {\n element = coerceElement(element)\n\n let watches = this.#watches[box]\n if (watches == null) {\n watches = new Map()\n this.#watches[box] = watches\n }\n\n let watcher = watches.get(element)\n if (watcher == null) {\n if (element instanceof Window) {\n if (box === \"scroll-box\") {\n watcher = this.#createScollWatcher(watches, this.#document.documentElement)\n } else {\n watcher = this.#createWindowResizeWatcher()\n }\n } else {\n if (box === \"scroll-box\") {\n watcher = this.#createScollWatcher(watches, element)\n } else {\n watcher = this.#createResizeWatcher(watches, element, box)\n }\n }\n\n watches.set(element, watcher)\n }\n\n return watcher\n }\n\n #createResizeWatcher(watches: Watches, el: HTMLElement, box: WatchBox): Observable<Dimension> {\n if (box !== \"border-box\") {\n throw new Error(`Currently not implemented box mode: ${box}`)\n }\n\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<Dimension>) => {\n const observer = new ResizeObserver(entries => {\n if (!this.#document.contains(el)) {\n return\n }\n\n for (const entry of entries) {\n if (entry.borderBoxSize) {\n sub.next({\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize\n })\n } else {\n sub.next({\n width: el.offsetWidth,\n height: el.offsetHeight\n })\n }\n }\n })\n observer.observe(el, { box: box as ResizeObserverBoxOptions })\n\n return () => {\n observer.disconnect()\n watches.delete(el)\n }\n }).pipe(distinctUntilChanged(dimensionIsEq), shareReplay(1))\n )\n }\n\n #createScollWatcher(watches: Watches, el: HTMLElement): Observable<Dimension> {\n const borderBox = this.watch(el, \"border-box\")\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<Dimension>) => {\n let lastSw: number = NaN\n let lastSh: number = NaN\n\n const emit = () => {\n const sw = el.scrollWidth\n const sh = el.scrollHeight\n if (lastSw !== sw || lastSh !== sh) {\n lastSw = sw\n lastSh = sh\n sub.next({ width: lastSw, height: lastSh })\n }\n }\n\n const dimSum = borderBox.subscribe(emit)\n const mutation = new MutationObserver(emit)\n mutation.observe(el, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true\n })\n emit()\n\n return () => {\n dimSum.unsubscribe()\n mutation.disconnect()\n watches.delete(el)\n }\n }).pipe(distinctUntilChanged(dimensionIsEq), shareReplay(1))\n )\n }\n\n #createWindowResizeWatcher(): Observable<Dimension> {\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<Dimension>) => {\n const onResize = () => {\n sub.next({\n width: window.innerWidth,\n height: window.innerHeight\n })\n }\n onResize()\n window.addEventListener(\"resize\", onResize)\n return () => {\n window.removeEventListener(\"resize\", onResize)\n }\n }).pipe(distinctUntilChanged(dimensionIsEq), shareReplay(1))\n )\n }\n}\n\nfunction dimensionIsEq(a: Dimension, b: Dimension) {\n return a && b && a.width === b.width && a.height === b.height\n}\n","\nimport { inject, Injectable, NgZone, DOCUMENT } from \"@angular/core\"\n\nimport { distinctUntilChanged, Observable, of, shareReplay, Subscriber } from \"rxjs\"\n\nimport { isEqual } from \"es-toolkit\"\n\nimport { coerceElement, ElementInput } from \"@ngutil/common\"\n\nimport { Position } from \"../util/rect\"\n\n@Injectable({ providedIn: \"root\" })\nexport class PositionWatcher {\n readonly #zone = inject(NgZone)\n readonly #document = inject(DOCUMENT)\n readonly #watches: Map<HTMLElement, Observable<Position>> = new Map()\n\n watch(element: ElementInput | Window): Observable<Position> {\n if (element instanceof Window) {\n return of({ x: 0, y: 0 })\n }\n\n element = coerceElement(element)\n\n let watcher = this.#watches.get(element)\n if (watcher == null) {\n watcher = this.#createWatcher(element)\n this.#watches.set(element, watcher)\n }\n\n return watcher\n }\n\n #createWatcher(element: HTMLElement): Observable<Position> {\n return this.#zone.runOutsideAngular(() =>\n new Observable((dest: Subscriber<Position>) => {\n let rafId: number | undefined = undefined\n const emit = () => {\n if (this.#document.contains(element)) {\n const {x, y} = element.getBoundingClientRect()\n dest.next({x, y})\n }\n\n if (!dest.closed) {\n rafId = requestAnimationFrame(emit)\n }\n }\n emit()\n return () => {\n rafId && cancelAnimationFrame(rafId)\n }\n }).pipe(distinctUntilChanged(isEqual), shareReplay(1))\n )\n }\n}\n","import { inject, Injectable } from \"@angular/core\"\n\nimport { combineLatest, map, Observable, Subscriber } from \"rxjs\"\n\nimport { ElementInput } from \"@ngutil/common\"\n\nimport { Rect } from \"../util/rect\"\nimport { DimensionWatcher, WatchBox } from \"./dimension-watcher.service\"\nimport { PositionWatcher } from \"./position-watcher.service\"\n\n@Injectable({ providedIn: \"root\" })\nexport class RectWatcher {\n readonly #dimWatcher = inject(DimensionWatcher)\n readonly #posWatcher = inject(PositionWatcher)\n\n watch(element: ElementInput | Window, watchBox: WatchBox): Observable<Rect> {\n return new Observable((dest: Subscriber<Rect>) =>\n combineLatest({\n dim: this.#dimWatcher.watch(element, watchBox),\n pos: this.#posWatcher.watch(element)\n })\n .pipe(\n map(({ dim, pos }) => {\n return { ...dim, ...pos }\n })\n )\n .subscribe(dest)\n )\n }\n}\n","import { inject, Injectable, NgZone } from \"@angular/core\"\n\nimport { Observable } from \"rxjs\"\n\nimport { coerceElement, type ElementInput } from \"@ngutil/common\"\n\n@Injectable({ providedIn: \"root\" })\nexport class NodeRemovedWatcher {\n readonly #zone = inject(NgZone)\n #watches = new Map<HTMLElement, Observable<void>>()\n\n watch(element: ElementInput): Observable<void> {\n element = coerceElement(element)\n let watcher = this.#watches.get(element)\n if (watcher == null) {\n watcher = this.#createWatcher(element)\n this.#watches.set(element, watcher)\n }\n return watcher\n }\n\n #createWatcher(element: HTMLElement): Observable<void> {\n return this.#zone.runOutsideAngular(\n () =>\n new Observable<void>(dst => {\n this.#zone.runOutsideAngular(() => {\n const observer = new MutationObserver(mutations => {\n for (const mutation of mutations) {\n if (Array.from(mutation.removedNodes).includes(element)) {\n dst.next()\n dst.complete()\n return\n }\n }\n })\n\n observer.observe(element.parentNode!, { childList: true })\n\n return () => {\n observer.disconnect()\n }\n })\n })\n )\n }\n}\n","import { isPlainObject } from \"@ngutil/common\"\n\nconst HORIZONTAL = [\"start\", \"left\", \"center\", \"end\", \"right\"] as const\nexport type AlignHorizontal = (typeof HORIZONTAL)[number]\n\nexport const AlignHorizontalOpposite: Record<AlignHorizontal, AlignHorizontal> = {\n start: \"end\",\n left: \"right\",\n center: \"center\",\n end: \"start\",\n right: \"left\"\n}\n\nconst VERTICAL = [\"top\", \"middle\", \"bottom\"] as const\nexport type AlignVertical = (typeof VERTICAL)[number]\n\nexport const AlignVerticalOpposite: Record<AlignVertical, AlignVertical> = {\n top: \"bottom\",\n middle: \"middle\",\n bottom: \"top\"\n}\n\nexport type AlignmentInput =\n | `${AlignHorizontal} ${AlignVertical}`\n | `${AlignVertical} ${AlignHorizontal}`\n | AlignVertical\n | AlignHorizontal\n | Alignment\n\nexport interface Alignment {\n horizontal: AlignHorizontal\n vertical: AlignVertical\n}\n\nconst DEFAULT: Alignment = { horizontal: \"center\", vertical: \"middle\" }\n\nexport function alignmentNormalize(value?: AlignmentInput): Alignment {\n if (value == null) {\n return DEFAULT\n }\n\n if (isPlainObject(value)) {\n if (\"horizontal\" in value && \"vertical\" in value) {\n return value\n } else {\n throw new Error(`Invalid alignment: ${value}`)\n }\n }\n\n if (typeof value !== \"string\") {\n throw new Error(`Invalid alignment: ${value}`)\n }\n\n const entries = Array.from(new Set(value.split(/\\s+/g))) as [string, string]\n if (entries.length > 2) {\n throw new Error(`Cannot parse: ${value}`)\n }\n\n const horizontal = HORIZONTAL.find(v => entries[0] === v || entries[1] === v) || \"center\"\n const vertical = VERTICAL.find(v => entries[0] === v || entries[1] === v) || \"middle\"\n\n return { horizontal, vertical }\n}\n\nconst HorizontalOrigin: Record<AlignHorizontal, \"left\" | \"center\" | \"right\"> = {\n start: \"left\",\n left: \"left\",\n center: \"center\",\n right: \"right\",\n end: \"right\"\n}\n\nconst VerticalOrigin: Record<AlignVertical, \"top\" | \"center\" | \"bottom\"> = {\n top: \"top\",\n middle: \"center\",\n bottom: \"bottom\"\n}\n\nexport function alignmentToTransformOrigin(alignment: Alignment): string {\n return `${HorizontalOrigin[alignment.horizontal] || \"center\"} ${VerticalOrigin[alignment.vertical] || \"center\"}`\n}\n","import { combineLatest, distinctUntilChanged, map, Observable, Subscriber } from \"rxjs\"\n\nimport { __zone_symbol__, rawCancelAnimationFrame, rawRequestAnimationFrame } from \"@ngutil/common\"\n\nconst addEventListener = __zone_symbol__(\"addEventListener\")\nconst removeEventListener = __zone_symbol__(\"removeEventListener\")\n\nexport function inAnimation<T extends HTMLElement>(el: T, animations?: string[]) {\n return _in(\n el,\n \"animationName\",\n \"animationstart\",\n \"animationiteration\",\n \"animationend\",\n \"animationcancel\",\n animations\n )\n}\n\nexport function inTransition<T extends HTMLElement>(el: T, properties?: string[]) {\n return _in(el, \"propertyName\", \"transitionstart\", \"transitionrun\", \"transitionend\", \"transitioncancel\", properties)\n}\n\nexport function isAnimating<T extends HTMLElement>(el: T) {\n return combineLatest([inAnimation(el), inTransition(el)]).pipe(\n map(values => !!(values[0] || values[1])),\n distinctUntilChanged()\n )\n}\n\nfunction _in<T extends HTMLElement>(\n el: T,\n keyName: string,\n beginName: string,\n doingName: string,\n endName: string,\n cancelName: string,\n keys?: string[]\n) {\n return new Observable((dest: Subscriber<string[] | null>) => {\n const state: { [key: string]: number } = {}\n\n const start = (event: any) => {\n const key = event[keyName]\n if (keys && keys.length > 0 && !keys.includes(key)) {\n return\n }\n\n if (key in state) {\n state[key]++\n } else {\n state[key] = 1\n }\n dest.next(Object.keys(state))\n }\n\n const doing = (event: any) => {\n const key = event[keyName]\n if (keys && keys.length > 0 && !keys.includes(key)) {\n return\n }\n\n if (!(key in state)) {\n state[key] = 1\n dest.next(Object.keys(state))\n }\n }\n\n const end = (event: any) => {\n if (event[keyName] in state) {\n const key = event[keyName]\n state[key]--\n if (state[key] <= 0) {\n delete state[key]\n }\n }\n\n if (Object.keys(state).length === 0) {\n dest.next(null)\n }\n }\n\n el[addEventListener](beginName, start)\n el[addEventListener](doingName, doing)\n el[addEventListener](endName, end)\n el[addEventListener](cancelName, end)\n\n const raf = rawRequestAnimationFrame(() => {\n if (Object.keys(state).length === 0) {\n dest.next(null)\n }\n })\n\n return () => {\n rawCancelAnimationFrame(raf)\n el[removeEventListener](beginName, start)\n el[removeEventListener](doingName, doing)\n el[removeEventListener](endName, end)\n el[removeEventListener](cancelName, end)\n }\n }).pipe(distinctUntilChanged())\n}\n","import { isPlainObject, NumberWithUnit } from \"@ngutil/common\"\n\nexport interface Sides {\n top: NumberWithUnit\n right: NumberWithUnit\n bottom: NumberWithUnit\n left: NumberWithUnit\n}\n\nexport type SidesUnit = \"px\" | \"%\"\nexport type SidesNumber = `${number}${SidesUnit}` | number\nexport type SidesInputObj = { top?: SidesNumber; right?: SidesNumber; bottom?: SidesNumber; left?: SidesNumber }\nexport type SidesInput =\n | Sides\n | SidesNumber\n | SidesInputObj\n | `${SidesNumber} ${SidesNumber}`\n | `${SidesNumber} ${SidesNumber} ${SidesNumber}`\n | `${SidesNumber} ${SidesNumber} ${SidesNumber} ${SidesNumber}`\n\nexport function sidesNormalize(value: SidesInput): Sides {\n if (isPlainObject(value)) {\n return {\n top: NumberWithUnit.coerce(value.top || 0, \"px\"),\n right: NumberWithUnit.coerce(value.right || 0, \"px\"),\n bottom: NumberWithUnit.coerce(value.bottom || 0, \"px\"),\n left: NumberWithUnit.coerce(value.left || 0, \"px\")\n }\n } else if (typeof value === \"number\") {\n return sidesNormalize(`${value}px`)\n } else if (typeof value !== \"string\") {\n throw new Error(`Invalid sides: ${value}`)\n }\n\n const entries = value.split(/\\s+/g).map(v => NumberWithUnit.coerce(v, \"px\")) as [NumberWithUnit]\n\n if (entries.length < 0 || entries.length > 4) {\n throw new Error(`Cannot parse: ${value}`)\n }\n\n return compose(...entries)\n}\n\nfunction compose(\n top: NumberWithUnit,\n right: NumberWithUnit = top,\n bottom: NumberWithUnit = top,\n left: NumberWithUnit = right\n): Sides {\n return { top, right, bottom, left }\n}\n","import { AlignHorizontal, AlignmentInput, alignmentNormalize, AlignVertical } from \"./alignment\"\nimport { SidesInput, sidesNormalize } from \"./sides\"\n\nexport interface Dimension {\n width: number\n height: number\n}\n\nexport interface Position {\n x: number\n y: number\n}\n\nexport interface Rect extends Dimension, Position {}\n\nexport function rectOrigin(rect: Rect, origin: AlignmentInput): Position {\n const originNorm = alignmentNormalize(origin)\n return { x: rectHorizontalOrigin(rect, originNorm.horizontal), y: rectVerticalOrigin(rect, originNorm.vertical) }\n}\n\nfunction rectHorizontalOrigin(rect: Rect, horizontal: AlignHorizontal): number {\n switch (horizontal) {\n case \"start\":\n case \"left\":\n return rect.x\n\n case \"center\":\n return rect.x + rect.width / 2\n\n case \"end\":\n case \"right\":\n return rect.x + rect.width\n }\n}\n\nfunction rectVerticalOrigin(rect: Rect, vertical: AlignVertical): number {\n switch (vertical) {\n case \"top\":\n return rect.y\n\n case \"middle\":\n return rect.y + rect.height / 2\n\n case \"bottom\":\n return rect.y + rect.height\n }\n}\n\nexport function rectMoveOrigin(rect: Rect | Dimension, origin: AlignmentInput, position: Position): Rect {\n const originNorm = alignmentNormalize(origin)\n return {\n ...rect,\n x: rectMoveHorizontal(rect, originNorm.horizontal, position),\n y: rectMoveVertical(rect, originNorm.vertical, position)\n }\n}\n\nfunction rectMoveHorizontal(rect: Dimension, horizontal: AlignHorizontal, position: Position): number {\n switch (horizontal) {\n case \"start\":\n case \"left\":\n return position.x\n\n case \"center\":\n return position.x - rect.width / 2\n\n case \"end\":\n case \"right\":\n return position.x - rect.width\n }\n}\n\nfunction rectMoveVertical(rect: Dimension, vertical: AlignVertical, position: Position): number {\n switch (vertical) {\n case \"top\":\n return position.y\n\n case \"middle\":\n return position.y - rect.height / 2\n\n case \"bottom\":\n return position.y - rect.height\n }\n}\n\nexport function rectConstraint(rect: Rect, constraint: Rect): Rect {\n const x = Math.max(rect.x, constraint.x)\n const y = Math.max(rect.y, constraint.y)\n return {\n x: x,\n y: y,\n width: Math.min(x + rect.width, constraint.x + constraint.width) - x,\n height: Math.min(y + rect.height, constraint.y + constraint.height) - y\n }\n}\nexport function rectExpand(rect: Rect, margin: SidesInput): Rect {\n const marginNorm = sidesNormalize(margin)\n return {\n x: rect.x - marginNorm.left.value,\n y: rect.y - marginNorm.top.value,\n width: rect.width + marginNorm.left.value + marginNorm.right.value,\n height: rect.height + marginNorm.top.value + marginNorm.bottom.value\n }\n}\n\nexport function rectContract(rect: Rect, padding: SidesInput): Rect {\n const normMargin = sidesNormalize(padding)\n return {\n x: rect.x + normMargin.left.value,\n y: rect.y + normMargin.top.value,\n width: rect.width - normMargin.left.value - normMargin.right.value,\n height: rect.height - normMargin.top.value - normMargin.bottom.value\n }\n}\n\nexport function rectContainsPoint(rect: Rect, point: Position): boolean {\n return point.x >= rect.x && point.x < rect.x + rect.width && point.y >= rect.y && point.y < rect.y + rect.height\n}\n","import { clamp } from \"es-toolkit\"\n\nimport {\n AlignHorizontalOpposite,\n Alignment,\n AlignmentInput,\n alignmentNormalize,\n AlignVerticalOpposite\n} from \"./alignment\"\n// import type { FloatingPositionOptionsNormalized } from \"./position\"\nimport { Dimension, Position, Rect, rectContract, rectExpand, rectMoveOrigin, rectOrigin } from \"./rect\"\nimport { Sides, SidesInput, sidesNormalize } from \"./sides\"\n\nexport interface FloatingPositionInput {\n dims: FloatingPositionDims\n options: FloatingPositionOptions\n}\n\nexport interface FloatingPositionDims {\n content: Dimension\n anchor: Rect\n placement: Rect\n constraints?: FloatingPositionConstraintsInput\n}\n\nexport interface FloatingPositionOptions {\n content: FloatingPositionContentOptions\n anchor: FloatingPositionAnchorOptions\n placement: FloatingPositionPlacementOptions\n horizontalAlt?: FloatingPositionAltInput\n verticalAlt?: FloatingPositionAltInput\n}\n\nexport interface FloatingPositionContentOptions {\n link: AlignmentInput\n}\n\nexport interface FloatingPositionConstraintsInput {\n minWidth?: number\n maxWidth?: number\n minHeight?: number\n maxHeight?: number\n}\n\nexport interface FloatingPositionAnchorOptions {\n link: AlignmentInput\n margin?: SidesInput\n}\n\nexport interface FloatingPositionPlacementOptions {\n padding?: SidesInput\n}\n\nexport interface FloatingPosition {\n content: {\n rect: Position & Readonly<Dimension>\n link: Alignment\n readonly constrained: Readonly<Dimension>\n }\n anchor: {\n readonly rect: Readonly<Rect>\n link: Alignment\n }\n placement: {\n readonly rect: Readonly<Rect>\n readonly padding: Readonly<Sides>\n readonly rectWithPadding: Readonly<Rect>\n area: Readonly<Rect>\n }\n connection: Position\n direction: FloatingPositionDirection\n constraints?: FloatingPositionConstraintsInput\n}\n\ninterface PlacementArea {\n anchorLink: Alignment\n contentLink: Alignment\n area: FloatingPosition[\"placement\"][\"area\"]\n connection: Position\n}\n\ntype FloatingPositionAltConst =\n | \"none\"\n | \"flip\"\n | \"shift\"\n | \"flip-shift\"\n | \"greatest\"\n | \"greatest-shift\"\n | \"smallest\"\n | \"smallest-shift\"\nexport type FloatingPositionAltInput = FloatingPositionAltConst | FloatingPositionAltFunc\nexport type FloatingPositionAltFunc = (pos: FloatingPosition, axis: FloatingPositionAltAxis) => void\nexport type FloatingPositionAltNorm = Array<FloatingPositionAltFunc>\n\nexport const enum FloatingPositionAltAxis {\n Horizontal = \"H\",\n Vertical = \"V\"\n}\n\nconst ZERO_PADDING = sidesNormalize(0)\nconst ZERO_CONNECTION = { x: 0, y: 0 }\n\nexport function floatingPosition({ dims, options }: FloatingPositionInput): FloatingPosition {\n const padding = options.placement.padding ? sidesNormalize(options.placement.padding) : ZERO_PADDING\n const placement: FloatingPosition[\"placement\"] = {\n rect: dims.placement,\n padding: padding,\n rectWithPadding: rectContract(dims.placement, padding),\n area: { ...dims.placement }\n }\n\n const anchor: FloatingPosition[\"anchor\"] = {\n rect: options.anchor.margin ? rectExpand(dims.anchor, options.anchor.margin) : dims.anchor,\n link: alignmentNormalize(options.anchor.link)\n }\n\n const minWidth = dims.constraints?.minWidth || 0\n const minHeight = dims.constraints?.minHeight || 0\n const maxWidth = dims.constraints?.maxWidth || Infinity\n const maxHeight = dims.constraints?.maxHeight || Infinity\n const content: FloatingPosition[\"content\"] = {\n rect: { x: 0, y: 0, ...dims.content },\n link: alignmentNormalize(options.content.link),\n constrained: {\n width: clamp(dims.content.width, minWidth, maxWidth),\n height: clamp(dims.content.height, minHeight, maxHeight)\n }\n }\n\n const position = {\n placement,\n anchor,\n content,\n connection: ZERO_CONNECTION,\n constrains: dims.constraints,\n direction: FloatingPositionDirection.Down\n }\n const area = placementArea(position, anchor.link, content.link)\n setPlacement(position, area)\n\n if (options.horizontalAlt) {\n applyAlts(position, FloatingPositionAltAxis.Horizontal, options.horizontalAlt)\n }\n\n if (options.verticalAlt) {\n applyAlts(position, FloatingPositionAltAxis.Vertical, options.verticalAlt)\n }\n\n position.direction = floatingPositionDirection(position)\n return position\n}\n\nfunction placementArea(pos: FloatingPosition, anchorLink: Alignment, contentLink: Alignment): PlacementArea {\n const connection = rectOrigin(pos.anchor.rect, anchorLink)\n let { x, y } = connection\n const placement = pos.placement.rect\n const placementPad = pos.placement.padding\n let width = 0\n let height = 0\n\n switch (contentLink.horizontal) {\n case \"left\":\n case \"start\":\n width = placement.width - x\n break\n case \"center\":\n if (anchorLink.horizontal === \"center\") {\n width = placement.width\n x = placement.x\n } else {\n const leftSize = x - placementPad.left.value\n const rightSize = placement.width - x - placementPad.right.value\n const mw = Math.max(0, Math.min(leftSize, rightSize))\n width = mw * 2\n x -= mw\n }\n break\n case \"end\":\n case \"right\":\n width = x - placement.x\n x = placement.x\n break\n }\n\n switch (contentLink.vertical) {\n case \"top\":\n height = placement.height - y\n break\n case \"middle\":\n if (anchorLink.vertical === \"middle\") {\n height = placement.height\n y = placement.y\n } else {\n const topSize = y - placementPad.top.value\n const bottomSize = placement.height - y - placementPad.bottom.value\n const mh = Math.max(0, Math.min(topSize, bottomSize))\n height = mh * 2\n y -= mh\n }\n\n break\n case \"bottom\":\n height = y - placement.y\n y = placement.y\n break\n }\n\n const constraint = pos.placement.rectWithPadding\n const newX = Math.max(x, constraint.x)\n const newY = Math.max(y, constraint.y)\n const diffX = newX - x\n const diffY = newY - y\n\n const area = {\n x: newX,\n y: newY,\n width: Math.min(newX + width - diffX, constraint.x + constraint.width) - newX,\n height: Math.min(newY + height - diffY, constraint.y + constraint.height) - newY\n }\n\n return { area, contentLink, anchorLink, connection }\n}\n\nfunction setPlacement(position: FloatingPosition, { area, anchorLink, contentLink, connection }: PlacementArea): void {\n position.placement.area = area\n position.anchor.link = anchorLink\n position.content.link = contentLink\n\n const plannedContentRect = rectMoveOrigin(position.content.rect, contentLink, connection)\n position.connection = adjustConnection(area, plannedContentRect, connection)\n position.content.rect = rectMoveOrigin(position.content.rect, contentLink, connection)\n}\n\nfunction adjustConnection(\n placement: FloatingPosition[\"placement\"][\"area\"],\n content: FloatingPosition[\"content\"][\"rect\"],\n connection: FloatingPosition[\"connection\"]\n) {\n const x = Math.max(placement.x, content.x)\n const y = Math.max(placement.y, content.y)\n const leftDiff = x - content.x\n const topDiff = y - content.y\n const widthDiff = placement.x + placement.width - (x + content.width)\n const heightDiff = placement.y + placement.height - (y + content.height)\n\n const result = { ...connection }\n connection.x += leftDiff\n connection.y += topDiff\n\n if (widthDiff < 0) {\n connection.x += widthDiff\n }\n\n if (heightDiff < 0) {\n connection.y += heightDiff\n }\n return result\n}\n\nfunction applyAlts(pos: FloatingPosition, axis: FloatingPositionAltAxis, alts: FloatingPositionAltInput) {\n const norm = positionAltNormalize(alts)\n for (const alt of norm) {\n alt(pos, axis)\n }\n}\n\nexport function positionAltNormalize(\n input: FloatingPositionAltInput | FloatingPositionAltNorm\n): FloatingPositionAltNorm {\n if (Array.isArray(input)) {\n return input\n } else if (typeof input === \"function\") {\n return [input]\n } else if (typeof input === \"string\") {\n return altStringToFns(input)\n } else {\n throw new Error(`Invalid alt position: ${input}`)\n }\n}\n\nfunction altStringToFns(input: FloatingPositionAltConst): FloatingPositionAltNorm {\n switch (input) {\n case \"none\":\n return [none]\n case \"flip\":\n return [flip]\n case \"shift\":\n return [shift]\n case \"flip-shift\":\n return [flip, shift]\n case \"greatest\":\n return [greatest]\n case \"greatest-shift\":\n return [greatest, shift]\n case \"smallest\":\n return [smallest]\n case \"smallest-shift\":\n return [smallest, shift]\n }\n}\n\nfunction none(pos: FloatingPosition, axis: FloatingPositionAltAxis): void { }\n\nfunction flip(pos: FloatingPosition, axis: FloatingPositionAltAxis): void {\n const wh: \"width\" | \"height\" = axis === FloatingPositionAltAxis.Horizontal ? \"width\" : \"height\"\n if (pos.placement.area[wh] >= pos.content.constrained[wh]) {\n return\n }\n return greatest(pos, axis)\n}\n\nfunction shift(pos: FloatingPosition, axis: FloatingPositionAltAxis): void { }\n\nfunction greatest(pos: FloatingPosition, axis: FloatingPositionAltAxis): void {\n _bySize(pos, axis, (a, b) => a >= b)\n}\n\nfunction smallest(pos: FloatingPosition, axis: FloatingPositionAltAxis): void {\n _bySize(pos, axis, (a, b) => a <= b)\n}\n\nfunction _bySize(pos: FloatingPosition, axis: FloatingPositionAltAxis, cmp: (a: number, b: number) => boolean): void {\n const wh: \"width\" | \"height\" = axis === FloatingPositionAltAxis.Horizontal ? \"width\" : \"height\"\n\n const current = pos.placement.area[wh]\n const anchorLink = oppositeLink(axis, pos.anchor.link)\n const contentLink = oppositeLink(axis, pos.content.link)\n const oppositePlacement = placementArea(pos, anchorLink, contentLink)\n\n if (cmp(current, oppositePlacement.area[wh])) {\n return\n }\n\n setPlacement(pos, oppositePlacement)\n}\n\nfunction oppositeLink(axis: FloatingPositionAltAxis, link: Alignment): Alignment {\n if (axis === FloatingPositionAltAxis.Horizontal) {\n return { horizontal: AlignHorizontalOpposite[link.horizontal], vertical: link.vertical }\n } else {\n return { horizontal: link.horizontal, vertical: AlignVerticalOpposite[link.vertical] }\n }\n}\n\nexport function floatingPositionToStyle(pos: Readonly<FloatingPosition>): Partial<CSSStyleDeclaration> {\n const contentRect = pos.content.rect\n const placementRect = pos.placement.rect\n // const { width: maxWidth, height: maxHeight } = pos.placement.area\n const style: Partial<CSSStyleDeclaration> = {}\n\n if (pos.content.link.horizontal === \"right\") {\n style[\"right\"] = `${placementRect.width - (contentRect.x + contentRect.width)}px`\n style[\"left\"] = \"auto\"\n } else {\n style[\"left\"] = `${contentRect.x}px`\n style[\"right\"] = \"auto\"\n }\n\n if (pos.content.link.vertical === \"bottom\") {\n style[\"bottom\"] = `${placementRect.height - (contentRect.y + contentRect.height)}px`\n style[\"top\"] = \"auto\"\n } else {\n style[\"top\"] = `${contentRect.y}px`\n style[\"bottom\"] = \"auto\"\n }\n\n // style[\"maxWidth\"] = `${maxWidth}px`\n // style[\"maxHeight\"] = `${maxHeight}px`\n\n return style\n}\n\nexport const enum FloatingPositionDirection {\n Up = \"up\",\n Down = \"down\",\n Left = \"left\",\n Right = \"right\",\n Center = \"center\"\n}\n\nexport function floatingPositionDirection(pos: Readonly<FloatingPosition>): FloatingPositionDirection {\n const { x: ax, y: ay, width: aw, height: ah } = pos.anchor.rect\n const { x: bx, y: by, width: bw, height: bh } = pos.content.rect\n const contentLink = pos.content.link\n const anchorLink = pos.anchor.link\n\n if (anchorLink.horizontal === \"center\" && anchorLink.vertical === \"middle\") {\n if (contentLink.horizontal === \"center\" && contentLink.vertical === \"middle\") {\n return FloatingPositionDirection.Center\n }\n\n const cx = pos.connection.x\n if (cx <= bx) {\n return FloatingPositionDirection.Right\n } else if (cx >= bx + bw) {\n return FloatingPositionDirection.Left\n }\n }\n\n const widthOverlapPx = Math.min(ax + aw, bx + bw) - Math.max(ax, bx)\n const widthOverlapPercent = widthOverlapPx / Math.max(aw, bw)\n const heightOverlapPx = Math.min(ay + ah, by + bh) - Math.max(ay, by)\n const heightOverlapPercent = heightOverlapPx / Math.max(ah, bh)\n\n if (widthOverlapPercent >= heightOverlapPercent) {\n if (contentLink.vertical === \"bottom\") {\n return FloatingPositionDirection.Up\n }\n\n return FloatingPositionDirection.Down\n } else {\n if (contentLink.horizontal === \"right\") {\n return FloatingPositionDirection.Left\n }\n\n return FloatingPositionDirection.Right\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAKa,YAAY,CAAA;AACZ,IAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B,QAAQ,GAA2C,EAAE;AAErD;;AAEG;AACH,IAAA,KAAK,CAAC,KAAa,EAAA;QACf,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,OAAO,EAAE;AACV,YAAA,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AACjC,YAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,OAAO;QAClC;AACA,QAAA,OAAO,OAA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E,OAAA,QAAA;QACJ;AAEA,QAAA,MAAM,EAAE,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;AAC3B,QAAA,IAAI,EAAE,IAAI,EAAE,EAAE;YACV,OAAA,OAAA;QACJ;AAAO,aAAA,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YACtB,OAAA,MAAA;QACJ;IACJ;IAEA,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;AACpE,IAAA,MAAM,mBAAmB,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;IAC7D,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;AACrE,IAAA,MAAM,oBAAoB,GAAG,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;AAE/D,IAAA,IAAI,mBAAmB,IAAI,oBAAoB,EAAE;AAC7C,QAAA,IAAI,WAAW,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACnC,OAAA,IAAA;QACJ;QAEA,OAAA,MAAA;IACJ;SAAO;AACH,QAAA,IAAI,WAAW,CAAC,UAAU,KAAK,OAAO,EAAE;YACpC,OAAA,MAAA;QACJ;QAEA,OAAA,OAAA;IACJ;AACJ;;ACjaA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngutil-style.mjs","sources":["../../../../packages/style/src/services/media-watcher.service.ts","../../../../packages/style/src/services/color-scheme.service.ts","../../../../packages/style/src/sass/animation/vars/index.ts","../../../../packages/style/src/services/dimension-watcher.service.ts","../../../../packages/style/src/services/position-watcher.service.ts","../../../../packages/style/src/services/rect-watcher.service.ts","../../../../packages/style/src/services/scroll-offset-watcher.service.ts","../../../../packages/style/src/services/node-removed-watcher.service.ts","../../../../packages/style/src/util/alignment.ts","../../../../packages/style/src/util/in-animation.ts","../../../../packages/style/src/util/sides.ts","../../../../packages/style/src/util/rect.ts","../../../../packages/style/src/util/floating-position.ts","../../../../packages/style/src/ngutil-style.ts"],"sourcesContent":["import { inject, Injectable, NgZone } from \"@angular/core\"\n\nimport { distinctUntilChanged, finalize, Observable, shareReplay, Subscriber } from \"rxjs\"\n\n@Injectable({ providedIn: \"root\" })\nexport class MediaWatcher {\n readonly #zone = inject(NgZone)\n #watches: { [key: string]: Observable<boolean> } = {}\n\n /**\n * svc.watch(\"(display-mode: standalone)\").subscribe(match => {})\n */\n watch(query: string): Observable<boolean> {\n let watcher = this.#watches[query]\n if (!watcher) {\n watcher = this.#newWatcher(query).pipe(\n finalize(() => delete this.#watches[query]),\n shareReplay({ refCount: true, bufferSize: 1 })\n )\n this.#watches[query] = watcher\n }\n return watcher\n }\n\n #newWatcher(query: string): Observable<boolean> {\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<boolean>) => {\n const queryWatcher = window.matchMedia(query)\n const listener = (event: MediaQueryListEvent) => {\n sub.next(event.matches)\n }\n queryWatcher.addEventListener(\"change\", listener)\n sub.next(queryWatcher.matches)\n return () => {\n queryWatcher.removeEventListener(\"change\", listener)\n delete this.#watches[query]\n }\n }).pipe(distinctUntilChanged())\n )\n }\n}\n","import { inject, Injectable } from \"@angular/core\"\n\nimport { map, Observable, shareReplay } from \"rxjs\"\n\nimport { MediaWatcher } from \"./media-watcher.service\"\n\n@Injectable({ providedIn: \"root\" })\nexport class ColorSchemeService {\n readonly #mq = inject(MediaWatcher)\n readonly isDark: Observable<boolean> = this.#mq.watch(\"(prefers-color-scheme: dark)\")\n readonly isLight = this.isDark.pipe(\n map(v => !v),\n shareReplay(1)\n )\n\n // TODO: set preferred color scheme (dark/light)\n}\n","/* eslint-disable */\n/* eslint-disable prettier/prettier */\n/* ! AUTO GENERATED DO NOT EDIT ! */\n\nexport class Ease {\n static readonly Deceleration = \"cubic-bezier(0, 0, 0.2, 1)\" as const\n static readonly Standard = \"cubic-bezier(0.4, 0, 0.2, 1)\" as const\n static readonly Acceleration = \"cubic-bezier(0.4, 0, 1, 1)\" as const\n static readonly Sharp = \"cubic-bezier(0.4, 0, 0.6, 1)\" as const\n /**\n * Reach nearly end position fast, and slowly move to final position\n */\n static readonly Emphasized = \"cubic-bezier(0.12, 0.9, 0.12, 0.9)\" as const\n}\n\nexport class Duration {\n static readonly Fast = \"200ms\" as const\n static readonly FastMs = 200 as const\n static readonly Medium = \"300ms\" as const\n static readonly MediumMs = 300 as const\n static readonly Slow = \"400ms\" as const\n static readonly SlowMs = 400 as const\n static readonly Snail = \"600ms\" as const\n static readonly SnailMs = 600 as const\n}\n","\nimport { inject, Injectable, NgZone, DOCUMENT } from \"@angular/core\"\n\nimport { distinctUntilChanged, finalize, Observable, shareReplay, Subscriber } from \"rxjs\"\n\nimport { coerceElement, ElementInput } from \"@ngutil/common\"\n\nimport { Dimension } from \"../util/rect\"\n\nexport type WatchBox = ResizeObserverBoxOptions | \"scroll-box\"\nexport type Watches = Map<HTMLElement | Window, Observable<Dimension>>\n\n@Injectable({ providedIn: \"root\" })\nexport class DimensionWatcher {\n readonly #zone = inject(NgZone)\n readonly #document = inject(DOCUMENT)\n readonly #watches: { [key in WatchBox]?: Watches } = {}\n\n watch(element: ElementInput | Window, box: WatchBox): Observable<Dimension> {\n element = coerceElement(element)\n\n let watches = this.#watches[box]\n if (watches == null) {\n watches = new Map()\n this.#watches[box] = watches\n }\n\n let watcher = watches.get(element)\n if (watcher == null) {\n if (element instanceof Window) {\n if (box === \"scroll-box\") {\n watcher = this.#createScollWatcher(watches, this.#document.documentElement)\n } else {\n watcher = this.#createWindowResizeWatcher()\n }\n } else {\n if (box === \"scroll-box\") {\n watcher = this.#createScollWatcher(watches, element)\n } else {\n watcher = this.#createResizeWatcher(watches, element, box)\n }\n }\n\n watches.set(element, watcher.pipe(\n finalize(() => watches.delete(element)),\n shareReplay({ refCount: true, bufferSize: 1 })\n ))\n }\n\n return watcher\n }\n\n #createResizeWatcher(watches: Watches, el: HTMLElement, box: WatchBox): Observable<Dimension> {\n if (box !== \"border-box\") {\n throw new Error(`Currently not implemented box mode: ${box}`)\n }\n\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<Dimension>) => {\n const observer = new ResizeObserver(entries => {\n if (!this.#document.contains(el)) {\n return\n }\n\n for (const entry of entries) {\n if (entry.borderBoxSize) {\n sub.next({\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize\n })\n } else {\n sub.next({\n width: el.offsetWidth,\n height: el.offsetHeight\n })\n }\n }\n })\n observer.observe(el, { box: box as ResizeObserverBoxOptions })\n\n return () => {\n observer.disconnect()\n watches.delete(el)\n }\n }).pipe(distinctUntilChanged(dimensionIsEq))\n )\n }\n\n #createScollWatcher(watches: Watches, el: HTMLElement): Observable<Dimension> {\n const borderBox = this.watch(el, \"border-box\")\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<Dimension>) => {\n let lastSw: number = NaN\n let lastSh: number = NaN\n\n const emit = () => {\n const sw = el.scrollWidth\n const sh = el.scrollHeight\n if (lastSw !== sw || lastSh !== sh) {\n lastSw = sw\n lastSh = sh\n sub.next({ width: lastSw, height: lastSh })\n }\n }\n\n const dimSum = borderBox.subscribe(emit)\n const mutation = new MutationObserver(emit)\n mutation.observe(el, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true\n })\n emit()\n\n return () => {\n dimSum.unsubscribe()\n mutation.disconnect()\n watches.delete(el)\n }\n }).pipe(distinctUntilChanged(dimensionIsEq))\n )\n }\n\n #createWindowResizeWatcher(): Observable<Dimension> {\n return this.#zone.runOutsideAngular(() =>\n new Observable((sub: Subscriber<Dimension>) => {\n const onResize = () => {\n sub.next({\n width: window.innerWidth,\n height: window.innerHeight\n })\n }\n onResize()\n window.addEventListener(\"resize\", onResize)\n return () => {\n window.removeEventListener(\"resize\", onResize)\n }\n }).pipe(distinctUntilChanged(dimensionIsEq))\n )\n }\n}\n\nfunction dimensionIsEq(a: Dimension, b: Dimension) {\n return a && b && a.width === b.width && a.height === b.height\n}\n","\nimport { inject, Injectable, NgZone, DOCUMENT } from \"@angular/core\"\n\nimport { combineLatest, distinctUntilChanged, finalize, map, Observable, of, shareReplay, Subscriber } from \"rxjs\"\n\nimport { isEqual } from \"es-toolkit\"\n\nimport { coerceElement, ElementInput } from \"@ngutil/common\"\n\nimport { Position } from \"../util/rect\"\nimport { ScrollOffsetWatcher } from \"./scroll-offset-watcher.service\"\n\nexport type Watches = Map<HTMLElement | Window, Observable<Position>>\n\n@Injectable({ providedIn: \"root\" })\nexport class PositionWatcher {\n readonly #zone = inject(NgZone)\n readonly #document = inject(DOCUMENT)\n readonly #watches: Watches = new Map()\n\n watch(element: ElementInput | Window): Observable<Position> {\n if (element instanceof Window) {\n return of({ x: 0, y: 0 })\n }\n\n element = coerceElement(element)\n\n let watcher = this.#watches.get(element)\n if (watcher == null) {\n watcher = this.#createWatcher(element).pipe(\n finalize(() => this.#watches.delete(element)),\n shareReplay({ refCount: true, bufferSize: 1 })\n )\n this.#watches.set(element, watcher)\n }\n\n return watcher\n }\n\n #createWatcher(element: HTMLElement): Observable<Position> {\n return this.#zone.runOutsideAngular(() =>\n new Observable((dest: Subscriber<Position>) => {\n let rafId: number | undefined = undefined\n const emit = () => {\n if (this.#document.contains(element)) {\n const {x, y} = element.getBoundingClientRect()\n dest.next({x, y})\n }\n\n if (!dest.closed) {\n rafId = requestAnimationFrame(emit)\n }\n }\n emit()\n return () => {\n rafId && cancelAnimationFrame(rafId)\n }\n }).pipe(distinctUntilChanged(isEqual))\n )\n }\n}\n","import { inject, Injectable } from \"@angular/core\"\n\nimport { combineLatest, map, Observable, Subscriber } from \"rxjs\"\n\nimport { ElementInput } from \"@ngutil/common\"\n\nimport { Rect } from \"../util/rect\"\nimport { DimensionWatcher, WatchBox } from \"./dimension-watcher.service\"\nimport { PositionWatcher } from \"./position-watcher.service\"\n\n@Injectable({ providedIn: \"root\" })\nexport class RectWatcher {\n readonly #dimWatcher = inject(DimensionWatcher)\n readonly #posWatcher = inject(PositionWatcher)\n\n watch(element: ElementInput | Window, watchBox: WatchBox): Observable<Rect> {\n return new Observable((dest: Subscriber<Rect>) =>\n combineLatest({\n dim: this.#dimWatcher.watch(element, watchBox),\n pos: this.#posWatcher.watch(element)\n })\n .pipe(\n map(({ dim, pos }) => {\n return { ...dim, ...pos }\n })\n )\n .subscribe(dest)\n )\n }\n}\n","import { DOCUMENT, inject, Inject, Injectable, NgZone } from \"@angular/core\"\nimport type { Position } from \"../util/rect\"\nimport { combineLatest, distinctUntilChanged, finalize, map, Observable, shareReplay, tap } from \"rxjs\"\n\nimport { coerceElement, ElementInput, isEqual } from \"@ngutil/common\"\n\nexport type Watches = Map<HTMLElement | Window, Observable<Position>>\n\n@Injectable({providedIn: \"root\"})\nexport class ScrollOffsetWatcher {\n readonly #zone = inject(NgZone)\n readonly #watches: Watches = new Map()\n\n watch(element: ElementInput | Window, ): Observable<Position> {\n element = coerceElement(element)\n let watcher = this.#watches.get(element)\n if (watcher == null) {\n watcher = this.#createWatcher(element).pipe(\n finalize(() => this.#watches.delete(element)),\n shareReplay({refCount: true, bufferSize: 1})\n )\n this.#watches.set(element, watcher)\n }\n return watcher\n }\n\n #createWatcher(element: HTMLElement | Window): Observable<Position> {\n if (element instanceof Window) {\n return this.#createElementWatcher(element)\n }\n\n const watchers = []\n let el: HTMLElement | null = coerceElement(element)\n while (el) {\n if (el.tagName === \"BODY\") {\n watchers.push(this.#createElementWatcher(window))\n break\n }\n watchers.push(this.#createElementWatcher(el))\n el = el.parentElement\n }\n\n return combineLatest(watchers).pipe(\n map(positions => positions.reduce((acc, pos) => ({x: acc.x + pos.x, y: acc.y + pos.y}), {x: 0, y: 0})),\n distinctUntilChanged(isEqual)\n )\n }\n\n #createElementWatcher(element: HTMLElement | Window): Observable<Position> {\n console.log(\"create scroll watcher for\", element)\n return this.#zone.runOutsideAngular(() =>\n new Observable<Position>(dst => {\n const handler = element instanceof Window\n ? () => dst.next({x: element.scrollX, y: element.scrollY})\n : () => dst.next({x: element.scrollLeft, y: element.scrollTop})\n handler()\n element.addEventListener(\"scroll\", handler, {capture: true, passive: true})\n return () => element.removeEventListener(\"scroll\", handler, {capture: true})\n\n }).pipe(distinctUntilChanged(isEqual))\n )\n }\n}\n","import { inject, Injectable, NgZone } from \"@angular/core\"\n\nimport { finalize, Observable } from \"rxjs\"\n\nimport { coerceElement, type ElementInput } from \"@ngutil/common\"\n\n@Injectable({ providedIn: \"root\" })\nexport class NodeRemovedWatcher {\n readonly #zone = inject(NgZone)\n #watches = new Map<HTMLElement, Observable<void>>()\n\n watch(element: ElementInput): Observable<void> {\n element = coerceElement(element)\n let watcher = this.#watches.get(element)\n if (watcher == null) {\n watcher = this.#createWatcher(element).pipe(\n finalize(() => this.#watches.delete(element))\n )\n this.#watches.set(element, watcher)\n }\n return watcher\n }\n\n #createWatcher(element: HTMLElement): Observable<void> {\n return this.#zone.runOutsideAngular(\n () =>\n new Observable<void>(dst => {\n this.#zone.runOutsideAngular(() => {\n const observer = new MutationObserver(mutations => {\n for (const mutation of mutations) {\n if (Array.from(mutation.removedNodes).includes(element)) {\n dst.next()\n dst.complete()\n return\n }\n }\n })\n\n observer.observe(element.parentNode!, { childList: true })\n\n return () => {\n observer.disconnect()\n }\n })\n })\n )\n }\n}\n","import { isPlainObject } from \"@ngutil/common\"\n\nconst HORIZONTAL = [\"start\", \"left\", \"center\", \"end\", \"right\"] as const\nexport type AlignHorizontal = (typeof HORIZONTAL)[number]\n\nexport const AlignHorizontalOpposite: Record<AlignHorizontal, AlignHorizontal> = {\n start: \"end\",\n left: \"right\",\n center: \"center\",\n end: \"start\",\n right: \"left\"\n}\n\nconst VERTICAL = [\"top\", \"middle\", \"bottom\"] as const\nexport type AlignVertical = (typeof VERTICAL)[number]\n\nexport const AlignVerticalOpposite: Record<AlignVertical, AlignVertical> = {\n top: \"bottom\",\n middle: \"middle\",\n bottom: \"top\"\n}\n\nexport type AlignmentInput =\n | `${AlignHorizontal} ${AlignVertical}`\n | `${AlignVertical} ${AlignHorizontal}`\n | AlignVertical\n | AlignHorizontal\n | Alignment\n\nexport interface Alignment {\n horizontal: AlignHorizontal\n vertical: AlignVertical\n}\n\nconst DEFAULT: Alignment = { horizontal: \"center\", vertical: \"middle\" }\n\nexport function alignmentNormalize(value?: AlignmentInput): Alignment {\n if (value == null) {\n return DEFAULT\n }\n\n if (isPlainObject(value)) {\n if (\"horizontal\" in value && \"vertical\" in value) {\n return value\n } else {\n throw new Error(`Invalid alignment: ${value}`)\n }\n }\n\n if (typeof value !== \"string\") {\n throw new Error(`Invalid alignment: ${value}`)\n }\n\n const entries = Array.from(new Set(value.split(/\\s+/g))) as [string, string]\n if (entries.length > 2) {\n throw new Error(`Cannot parse: ${value}`)\n }\n\n const horizontal = HORIZONTAL.find(v => entries[0] === v || entries[1] === v) || \"center\"\n const vertical = VERTICAL.find(v => entries[0] === v || entries[1] === v) || \"middle\"\n\n return { horizontal, vertical }\n}\n\nconst HorizontalOrigin: Record<AlignHorizontal, \"left\" | \"center\" | \"right\"> = {\n start: \"left\",\n left: \"left\",\n center: \"center\",\n right: \"right\",\n end: \"right\"\n}\n\nconst VerticalOrigin: Record<AlignVertical, \"top\" | \"center\" | \"bottom\"> = {\n top: \"top\",\n middle: \"center\",\n bottom: \"bottom\"\n}\n\nexport function alignmentToTransformOrigin(alignment: Alignment): string {\n return `${HorizontalOrigin[alignment.horizontal] || \"center\"} ${VerticalOrigin[alignment.vertical] || \"center\"}`\n}\n","import { combineLatest, distinctUntilChanged, map, Observable, Subscriber } from \"rxjs\"\n\nimport { __zone_symbol__, rawCancelAnimationFrame, rawRequestAnimationFrame } from \"@ngutil/common\"\n\nconst addEventListener = __zone_symbol__(\"addEventListener\")\nconst removeEventListener = __zone_symbol__(\"removeEventListener\")\n\nexport function inAnimation<T extends HTMLElement>(el: T, animations?: string[]) {\n return _in(\n el,\n \"animationName\",\n \"animationstart\",\n \"animationiteration\",\n \"animationend\",\n \"animationcancel\",\n animations\n )\n}\n\nexport function inTransition<T extends HTMLElement>(el: T, properties?: string[]) {\n return _in(el, \"propertyName\", \"transitionstart\", \"transitionrun\", \"transitionend\", \"transitioncancel\", properties)\n}\n\nexport function isAnimating<T extends HTMLElement>(el: T) {\n return combineLatest([inAnimation(el), inTransition(el)]).pipe(\n map(values => !!(values[0] || values[1])),\n distinctUntilChanged()\n )\n}\n\nfunction _in<T extends HTMLElement>(\n el: T,\n keyName: string,\n beginName: string,\n doingName: string,\n endName: string,\n cancelName: string,\n keys?: string[]\n) {\n return new Observable((dest: Subscriber<string[] | null>) => {\n const state: { [key: string]: number } = {}\n\n const start = (event: any) => {\n const key = event[keyName]\n if (keys && keys.length > 0 && !keys.includes(key)) {\n return\n }\n\n if (key in state) {\n state[key]++\n } else {\n state[key] = 1\n }\n dest.next(Object.keys(state))\n }\n\n const doing = (event: any) => {\n const key = event[keyName]\n if (keys && keys.length > 0 && !keys.includes(key)) {\n return\n }\n\n if (!(key in state)) {\n state[key] = 1\n dest.next(Object.keys(state))\n }\n }\n\n const end = (event: any) => {\n if (event[keyName] in state) {\n const key = event[keyName]\n state[key]--\n if (state[key] <= 0) {\n delete state[key]\n }\n }\n\n if (Object.keys(state).length === 0) {\n dest.next(null)\n }\n }\n\n el[addEventListener](beginName, start)\n el[addEventListener](doingName, doing)\n el[addEventListener](endName, end)\n el[addEventListener](cancelName, end)\n\n const raf = rawRequestAnimationFrame(() => {\n if (Object.keys(state).length === 0) {\n dest.next(null)\n }\n })\n\n return () => {\n rawCancelAnimationFrame(raf)\n el[removeEventListener](beginName, start)\n el[removeEventListener](doingName, doing)\n el[removeEventListener](endName, end)\n el[removeEventListener](cancelName, end)\n }\n }).pipe(distinctUntilChanged())\n}\n","import { isPlainObject, NumberWithUnit } from \"@ngutil/common\"\n\nexport interface Sides {\n top: NumberWithUnit\n right: NumberWithUnit\n bottom: NumberWithUnit\n left: NumberWithUnit\n}\n\nexport type SidesUnit = \"px\" | \"%\"\nexport type SidesNumber = `${number}${SidesUnit}` | number\nexport type SidesInputObj = { top?: SidesNumber; right?: SidesNumber; bottom?: SidesNumber; left?: SidesNumber }\nexport type SidesInput =\n | Sides\n | SidesNumber\n | SidesInputObj\n | `${SidesNumber} ${SidesNumber}`\n | `${SidesNumber} ${SidesNumber} ${SidesNumber}`\n | `${SidesNumber} ${SidesNumber} ${SidesNumber} ${SidesNumber}`\n\nexport function sidesNormalize(value: SidesInput): Sides {\n if (isPlainObject(value)) {\n return {\n top: NumberWithUnit.coerce(value.top || 0, \"px\"),\n right: NumberWithUnit.coerce(value.right || 0, \"px\"),\n bottom: NumberWithUnit.coerce(value.bottom || 0, \"px\"),\n left: NumberWithUnit.coerce(value.left || 0, \"px\")\n }\n } else if (typeof value === \"number\") {\n return sidesNormalize(`${value}px`)\n } else if (typeof value !== \"string\") {\n throw new Error(`Invalid sides: ${value}`)\n }\n\n const entries = value.split(/\\s+/g).map(v => NumberWithUnit.coerce(v, \"px\")) as [NumberWithUnit]\n\n if (entries.length < 0 || entries.length > 4) {\n throw new Error(`Cannot parse: ${value}`)\n }\n\n return compose(...entries)\n}\n\nfunction compose(\n top: NumberWithUnit,\n right: NumberWithUnit = top,\n bottom: NumberWithUnit = top,\n left: NumberWithUnit = right\n): Sides {\n return { top, right, bottom, left }\n}\n","import { AlignHorizontal, AlignmentInput, alignmentNormalize, AlignVertical } from \"./alignment\"\nimport { SidesInput, sidesNormalize } from \"./sides\"\n\nexport interface Dimension {\n width: number\n height: number\n}\n\nexport interface Position {\n x: number\n y: number\n}\n\nexport interface Rect extends Dimension, Position {}\n\nexport function rectOrigin(rect: Rect, origin: AlignmentInput): Position {\n const originNorm = alignmentNormalize(origin)\n return { x: rectHorizontalOrigin(rect, originNorm.horizontal), y: rectVerticalOrigin(rect, originNorm.vertical) }\n}\n\nfunction rectHorizontalOrigin(rect: Rect, horizontal: AlignHorizontal): number {\n switch (horizontal) {\n case \"start\":\n case \"left\":\n return rect.x\n\n case \"center\":\n return rect.x + rect.width / 2\n\n case \"end\":\n case \"right\":\n return rect.x + rect.width\n }\n}\n\nfunction rectVerticalOrigin(rect: Rect, vertical: AlignVertical): number {\n switch (vertical) {\n case \"top\":\n return rect.y\n\n case \"middle\":\n return rect.y + rect.height / 2\n\n case \"bottom\":\n return rect.y + rect.height\n }\n}\n\nexport function rectMoveOrigin(rect: Rect | Dimension, origin: AlignmentInput, position: Position): Rect {\n const originNorm = alignmentNormalize(origin)\n return {\n ...rect,\n x: rectMoveHorizontal(rect, originNorm.horizontal, position),\n y: rectMoveVertical(rect, originNorm.vertical, position)\n }\n}\n\nfunction rectMoveHorizontal(rect: Dimension, horizontal: AlignHorizontal, position: Position): number {\n switch (horizontal) {\n case \"start\":\n case \"left\":\n return position.x\n\n case \"center\":\n return position.x - rect.width / 2\n\n case \"end\":\n case \"right\":\n return position.x - rect.width\n }\n}\n\nfunction rectMoveVertical(rect: Dimension, vertical: AlignVertical, position: Position): number {\n switch (vertical) {\n case \"top\":\n return position.y\n\n case \"middle\":\n return position.y - rect.height / 2\n\n case \"bottom\":\n return position.y - rect.height\n }\n}\n\nexport function rectConstraint(rect: Rect, constraint: Rect): Rect {\n const x = Math.max(rect.x, constraint.x)\n const y = Math.max(rect.y, constraint.y)\n return {\n x: x,\n y: y,\n width: Math.min(x + rect.width, constraint.x + constraint.width) - x,\n height: Math.min(y + rect.height, constraint.y + constraint.height) - y\n }\n}\nexport function rectExpand(rect: Rect, margin: SidesInput): Rect {\n const marginNorm = sidesNormalize(margin)\n return {\n x: rect.x - marginNorm.left.value,\n y: rect.y - marginNorm.top.value,\n width: rect.width + marginNorm.left.value + marginNorm.right.value,\n height: rect.height + marginNorm.top.value + marginNorm.bottom.value\n }\n}\n\nexport function rectContract(rect: Rect, padding: SidesInput): Rect {\n const normMargin = sidesNormalize(padding)\n return {\n x: rect.x + normMargin.left.value,\n y: rect.y + normMargin.top.value,\n width: rect.width - normMargin.left.value - normMargin.right.value,\n height: rect.height - normMargin.top.value - normMargin.bottom.value\n }\n}\n\nexport function rectContainsPoint(rect: Rect, point: Position): boolean {\n return point.x >= rect.x && point.x < rect.x + rect.width && point.y >= rect.y && point.y < rect.y + rect.height\n}\n\nexport function rectIntersect(a: Rect, b: Rect): boolean {\n return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y\n}\n\n","import { clamp } from \"es-toolkit\"\n\nimport {\n AlignHorizontalOpposite,\n Alignment,\n AlignmentInput,\n alignmentNormalize,\n AlignVerticalOpposite\n} from \"./alignment\"\n// import type { FloatingPositionOptionsNormalized } from \"./position\"\nimport { Dimension, Position, Rect, rectConstraint, rectContract, rectExpand, rectIntersect, rectMoveOrigin, rectOrigin } from \"./rect\"\nimport { Sides, SidesInput, sidesNormalize } from \"./sides\"\n\nexport interface FloatingPositionInput {\n dims: FloatingPositionDims\n options: FloatingPositionOptions\n}\n\nexport interface FloatingPositionDims {\n content: Dimension\n anchor: Rect\n placement: Rect\n sizeConstraints?: FloatingSizeConstraintsInput\n}\n\nexport interface FloatingPositionOptions {\n content: FloatingPositionContentOptions\n anchor: FloatingPositionAnchorOptions\n placement: FloatingPositionPlacementOptions\n horizontalAlt?: FloatingPositionAltInput\n verticalAlt?: FloatingPositionAltInput\n}\n\nexport interface FloatingPositionContentOptions {\n link: AlignmentInput\n}\n\nexport interface FloatingSizeConstraintsInput {\n minWidth?: number\n maxWidth?: number\n minHeight?: number\n maxHeight?: number\n}\n\nexport interface FloatingPositionAnchorOptions {\n link: AlignmentInput\n margin?: SidesInput\n}\n\nexport interface FloatingPositionPlacementOptions {\n padding?: SidesInput\n}\n\nexport interface FloatingPosition {\n content: {\n rect: Position & Readonly<Dimension>\n link: Alignment\n readonly constrained: Readonly<Dimension>\n }\n anchor: {\n readonly rect: Readonly<Rect>\n link: Alignment\n visible: boolean\n }\n placement: {\n readonly rect: Readonly<Rect>\n readonly padding: Readonly<Sides>\n readonly rectWithPadding: Readonly<Rect>\n area: Readonly<Rect>\n }\n connection: Position\n direction: FloatingPositionDirection\n sizeConstraints?: FloatingSizeConstraintsInput\n}\n\ninterface PlacementArea {\n anchorLink: Alignment\n contentLink: Alignment\n area: FloatingPosition[\"placement\"][\"area\"]\n connection: Position\n}\n\ntype FloatingPositionAltConst =\n | \"none\"\n | \"flip\"\n | \"shift\"\n | \"flip-shift\"\n | \"greatest\"\n | \"greatest-shift\"\n | \"smallest\"\n | \"smallest-shift\"\nexport type FloatingPositionAltInput = FloatingPositionAltConst | FloatingPositionAltFunc\nexport type FloatingPositionAltFunc = (pos: FloatingPosition, axis: FloatingPositionAltAxis) => void\nexport type FloatingPositionAltNorm = Array<FloatingPositionAltFunc>\n\nexport const enum FloatingPositionAltAxis {\n Horizontal = \"H\",\n Vertical = \"V\"\n}\n\nconst ZERO_PADDING = sidesNormalize(0)\nconst ZERO_CONNECTION = { x: 0, y: 0 }\n\nexport function floatingPosition({ dims, options }: FloatingPositionInput): FloatingPosition {\n const padding = options.placement.padding ? sidesNormalize(options.placement.padding) : ZERO_PADDING\n const placement: FloatingPosition[\"placement\"] = {\n rect: dims.placement,\n padding: padding,\n rectWithPadding: rectContract(dims.placement, padding),\n area: { ...dims.placement }\n }\n\n const anchor: FloatingPosition[\"anchor\"] = {\n rect: options.anchor.margin ? rectExpand(dims.anchor, options.anchor.margin) : dims.anchor,\n link: alignmentNormalize(options.anchor.link),\n visible: false\n }\n\n const minWidth = dims.sizeConstraints?.minWidth || 0\n const minHeight = dims.sizeConstraints?.minHeight || 0\n const maxWidth = dims.sizeConstraints?.maxWidth || Infinity\n const maxHeight = dims.sizeConstraints?.maxHeight || Infinity\n const content: FloatingPosition[\"content\"] = {\n rect: { ...dims.content, x: 0, y: 0 },\n link: alignmentNormalize(options.content.link),\n constrained: {\n width: clamp(dims.content.width, minWidth, maxWidth),\n height: clamp(dims.content.height, minHeight, maxHeight)\n }\n }\n\n const position = {\n placement,\n anchor,\n content,\n connection: ZERO_CONNECTION,\n sizeConstraints: dims.sizeConstraints,\n direction: FloatingPositionDirection.Down\n }\n const area = placementArea(position, anchor.link, content.link)\n setPlacement(position, area)\n\n if (options.horizontalAlt) {\n applyAlts(position, FloatingPositionAltAxis.Horizontal, options.horizontalAlt)\n }\n\n if (options.verticalAlt) {\n applyAlts(position, FloatingPositionAltAxis.Vertical, options.verticalAlt)\n }\n\n position.direction = floatingPositionDirection(position)\n position.anchor.visible = rectIntersect(position.placement.rectWithPadding, position.anchor.rect)\n return position\n}\n\nfunction placementArea(pos: FloatingPosition, anchorLink: Alignment, contentLink: Alignment): PlacementArea {\n const connection = rectOrigin(pos.anchor.rect, anchorLink)\n let { x, y } = connection\n const placement = pos.placement.rect\n const constraint = pos.placement.rectWithPadding\n const placementPad = pos.placement.padding\n let { width, height } = placement\n\n switch (contentLink.horizontal) {\n case \"left\":\n case \"start\":\n break\n case \"center\":\n if (anchorLink.horizontal === \"center\") {\n x = placement.x\n } else {\n x -= pos.content.constrained.width / 2\n }\n break\n case \"end\":\n case \"right\":\n width = x - placementPad.left.value\n if (anchorLink.horizontal === \"center\") {\n x = placement.x\n } else {\n x -= pos.content.constrained.width\n }\n break\n }\n\n switch (contentLink.vertical) {\n case \"top\":\n break\n case \"middle\":\n if (anchorLink.vertical === \"middle\") {\n y = placement.y\n } else {\n y -= pos.content.constrained.height / 2\n }\n break\n case \"bottom\":\n height = y - placementPad.top.value\n y = placement.y\n break\n }\n\n const area = rectConstraint({ x, y, width, height }, constraint)\n return { area, contentLink, anchorLink, connection }\n}\n\nfunction setPlacement(position: FloatingPosition, { area, anchorLink, contentLink, connection }: PlacementArea): void {\n position.placement.area = area\n position.anchor.link = anchorLink\n position.content.link = contentLink\n\n const plannedContentRect = rectMoveOrigin(position.content.rect, contentLink, connection)\n position.connection = adjustConnection(area, plannedContentRect, connection)\n position.content.rect = rectMoveOrigin(position.content.rect, contentLink, connection)\n}\n\nfunction adjustConnection(\n placement: FloatingPosition[\"placement\"][\"area\"],\n content: FloatingPosition[\"content\"][\"rect\"],\n connection: FloatingPosition[\"connection\"]\n) {\n const x = Math.max(placement.x, content.x)\n const y = Math.max(placement.y, content.y)\n const leftDiff = x - content.x\n const topDiff = y - content.y\n const widthDiff = placement.x + placement.width - (x + content.width)\n const heightDiff = placement.y + placement.height - (y + content.height)\n\n const result = { ...connection }\n connection.x += leftDiff\n connection.y += topDiff\n\n if (widthDiff < 0) {\n connection.x += widthDiff\n }\n\n if (heightDiff < 0) {\n connection.y += heightDiff\n }\n return result\n}\n\nfunction applyAlts(pos: FloatingPosition, axis: FloatingPositionAltAxis, alts: FloatingPositionAltInput) {\n const norm = positionAltNormalize(alts)\n for (const alt of norm) {\n alt(pos, axis)\n }\n}\n\nexport function positionAltNormalize(\n input: FloatingPositionAltInput | FloatingPositionAltNorm\n): FloatingPositionAltNorm {\n if (Array.isArray(input)) {\n return input\n } else if (typeof input === \"function\") {\n return [input]\n } else if (typeof input === \"string\") {\n return altStringToFns(input)\n } else {\n throw new Error(`Invalid alt position: ${input}`)\n }\n}\n\nfunction altStringToFns(input: FloatingPositionAltConst): FloatingPositionAltNorm {\n switch (input) {\n case \"none\":\n return [none]\n case \"flip\":\n return [flip]\n case \"shift\":\n return [shift]\n case \"flip-shift\":\n return [flip, shift]\n case \"greatest\":\n return [greatest]\n case \"greatest-shift\":\n return [greatest, shift]\n case \"smallest\":\n return [smallest]\n case \"smallest-shift\":\n return [smallest, shift]\n }\n}\n\nfunction none(pos: FloatingPosition, axis: FloatingPositionAltAxis): void { }\n\nfunction flip(pos: FloatingPosition, axis: FloatingPositionAltAxis): void {\n const wh: \"width\" | \"height\" = axis === FloatingPositionAltAxis.Horizontal ? \"width\" : \"height\"\n if (pos.placement.area[wh] >= pos.content.constrained[wh]) {\n return\n }\n return greatest(pos, axis)\n}\n\nfunction shift(pos: FloatingPosition, axis: FloatingPositionAltAxis): void { }\n\nfunction greatest(pos: FloatingPosition, axis: FloatingPositionAltAxis): void {\n _bySize(pos, axis, (a, b) => a >= b)\n}\n\nfunction smallest(pos: FloatingPosition, axis: FloatingPositionAltAxis): void {\n _bySize(pos, axis, (a, b) => a <= b)\n}\n\nfunction _bySize(pos: FloatingPosition, axis: FloatingPositionAltAxis, cmp: (a: number, b: number) => boolean): void {\n const wh: \"width\" | \"height\" = axis === FloatingPositionAltAxis.Horizontal ? \"width\" : \"height\"\n\n const current = pos.placement.area[wh]\n const anchorLink = oppositeLink(axis, pos.anchor.link)\n const contentLink = oppositeLink(axis, pos.content.link)\n const oppositePlacement = placementArea(pos, anchorLink, contentLink)\n\n if (cmp(current, oppositePlacement.area[wh])) {\n return\n }\n\n setPlacement(pos, oppositePlacement)\n}\n\nfunction oppositeLink(axis: FloatingPositionAltAxis, link: Alignment): Alignment {\n if (axis === FloatingPositionAltAxis.Horizontal) {\n return { horizontal: AlignHorizontalOpposite[link.horizontal], vertical: link.vertical }\n } else {\n return { horizontal: link.horizontal, vertical: AlignVerticalOpposite[link.vertical] }\n }\n}\n\nexport function floatingPositionToStyle(pos: Readonly<FloatingPosition>, display: CSSStyleDeclaration[\"display\"] = \"inline-flex\"): Partial<CSSStyleDeclaration> {\n if (pos.anchor.visible === false) {\n return {\"display\": \"none\", \"pointerEvents\": \"none\"}\n }\n\n const contentRect = pos.content.rect\n const placementRect = pos.placement.rect\n // const { width: maxWidth, height: maxHeight } = pos.placement.area\n const style: Partial<CSSStyleDeclaration> = { display: display, pointerEvents: \"\" }\n\n // TODO: translate3d\n if (pos.content.link.horizontal === \"right\") {\n style[\"right\"] = `${placementRect.width - (contentRect.x + contentRect.width)}px`\n style[\"left\"] = \"auto\"\n } else {\n style[\"left\"] = `${contentRect.x}px`\n style[\"right\"] = \"auto\"\n }\n\n if (pos.content.link.vertical === \"bottom\") {\n style[\"bottom\"] = `${placementRect.height - (contentRect.y + contentRect.height)}px`\n style[\"top\"] = \"auto\"\n } else {\n style[\"top\"] = `${contentRect.y}px`\n style[\"bottom\"] = \"auto\"\n }\n\n // style[\"maxWidth\"] = `${maxWidth}px`\n // style[\"maxHeight\"] = `${maxHeight}px`\n\n return style\n}\n\nexport const enum FloatingPositionDirection {\n Up = \"up\",\n Down = \"down\",\n Left = \"left\",\n Right = \"right\",\n Center = \"center\"\n}\n\nexport function floatingPositionDirection(pos: Readonly<FloatingPosition>): FloatingPositionDirection {\n const { x: ax, y: ay, width: aw, height: ah } = pos.anchor.rect\n const { x: bx, y: by, width: bw, height: bh } = pos.content.rect\n const contentLink = pos.content.link\n const anchorLink = pos.anchor.link\n\n if (anchorLink.horizontal === \"center\" && anchorLink.vertical === \"middle\") {\n if (contentLink.horizontal === \"center\" && contentLink.vertical === \"middle\") {\n return FloatingPositionDirection.Center\n }\n\n const cx = pos.connection.x\n if (cx <= bx) {\n return FloatingPositionDirection.Right\n } else if (cx >= bx + bw) {\n return FloatingPositionDirection.Left\n }\n }\n\n const widthOverlapPx = Math.min(ax + aw, bx + bw) - Math.max(ax, bx)\n const widthOverlapPercent = widthOverlapPx / Math.max(aw, bw)\n const heightOverlapPx = Math.min(ay + ah, by + bh) - Math.max(ay, by)\n const heightOverlapPercent = heightOverlapPx / Math.max(ah, bh)\n\n if (widthOverlapPercent >= heightOverlapPercent) {\n if (contentLink.vertical === \"bottom\") {\n return FloatingPositionDirection.Up\n }\n\n return FloatingPositionDirection.Down\n } else {\n if (contentLink.horizontal === \"right\") {\n return FloatingPositionDirection.Left\n }\n\n return FloatingPositionDirection.Right\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["isEqual"],"mappings":";;;;;;MAKa,YAAY,CAAA;AACZ,IAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/B,QAAQ,GAA2C,EAAE;AAErD;;AAEG;AACH,IAAA,KAAK,CAAC,KAAa,EAAA;QACf,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,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/D,IAAA,IAAI,mBAAmB,IAAI,oBAAoB,EAAE;AAC7C,QAAA,IAAI,WAAW,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACnC,OAAA,IAAA;QACJ;QAEA,OAAA,MAAA;IACJ;SAAO;AACH,QAAA,IAAI,WAAW,CAAC,UAAU,KAAK,OAAO,EAAE;YACpC,OAAA,MAAA;QACJ;QAEA,OAAA,OAAA;IACJ;AACJ;;ACpZA;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -86,6 +86,7 @@ declare function rectConstraint(rect: Rect, constraint: Rect): Rect;
86
86
  declare function rectExpand(rect: Rect, margin: SidesInput): Rect;
87
87
  declare function rectContract(rect: Rect, padding: SidesInput): Rect;
88
88
  declare function rectContainsPoint(rect: Rect, point: Position): boolean;
89
+ declare function rectIntersect(a: Rect, b: Rect): boolean;
89
90
 
90
91
  type WatchBox = ResizeObserverBoxOptions | "scroll-box";
91
92
  declare class DimensionWatcher {
@@ -109,6 +110,13 @@ declare class RectWatcher {
109
110
  static ɵprov: i0.ɵɵInjectableDeclaration<RectWatcher>;
110
111
  }
111
112
 
113
+ declare class ScrollOffsetWatcher {
114
+ #private;
115
+ watch(element: ElementInput | Window): Observable<Position>;
116
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollOffsetWatcher, never>;
117
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScrollOffsetWatcher>;
118
+ }
119
+
112
120
  declare class NodeRemovedWatcher {
113
121
  #private;
114
122
  watch(element: ElementInput): Observable<void>;
@@ -128,7 +136,7 @@ interface FloatingPositionDims {
128
136
  content: Dimension;
129
137
  anchor: Rect;
130
138
  placement: Rect;
131
- constraints?: FloatingPositionConstraintsInput;
139
+ sizeConstraints?: FloatingSizeConstraintsInput;
132
140
  }
133
141
  interface FloatingPositionOptions {
134
142
  content: FloatingPositionContentOptions;
@@ -140,7 +148,7 @@ interface FloatingPositionOptions {
140
148
  interface FloatingPositionContentOptions {
141
149
  link: AlignmentInput;
142
150
  }
143
- interface FloatingPositionConstraintsInput {
151
+ interface FloatingSizeConstraintsInput {
144
152
  minWidth?: number;
145
153
  maxWidth?: number;
146
154
  minHeight?: number;
@@ -162,6 +170,7 @@ interface FloatingPosition {
162
170
  anchor: {
163
171
  readonly rect: Readonly<Rect>;
164
172
  link: Alignment;
173
+ visible: boolean;
165
174
  };
166
175
  placement: {
167
176
  readonly rect: Readonly<Rect>;
@@ -171,7 +180,7 @@ interface FloatingPosition {
171
180
  };
172
181
  connection: Position;
173
182
  direction: FloatingPositionDirection;
174
- constraints?: FloatingPositionConstraintsInput;
183
+ sizeConstraints?: FloatingSizeConstraintsInput;
175
184
  }
176
185
  type FloatingPositionAltConst = "none" | "flip" | "shift" | "flip-shift" | "greatest" | "greatest-shift" | "smallest" | "smallest-shift";
177
186
  type FloatingPositionAltInput = FloatingPositionAltConst | FloatingPositionAltFunc;
@@ -183,7 +192,7 @@ declare const enum FloatingPositionAltAxis {
183
192
  }
184
193
  declare function floatingPosition({ dims, options }: FloatingPositionInput): FloatingPosition;
185
194
  declare function positionAltNormalize(input: FloatingPositionAltInput | FloatingPositionAltNorm): FloatingPositionAltNorm;
186
- declare function floatingPositionToStyle(pos: Readonly<FloatingPosition>): Partial<CSSStyleDeclaration>;
195
+ declare function floatingPositionToStyle(pos: Readonly<FloatingPosition>, display?: CSSStyleDeclaration["display"]): Partial<CSSStyleDeclaration>;
187
196
  declare const enum FloatingPositionDirection {
188
197
  Up = "up",
189
198
  Down = "down",
@@ -193,5 +202,5 @@ declare const enum FloatingPositionDirection {
193
202
  }
194
203
  declare function floatingPositionDirection(pos: Readonly<FloatingPosition>): FloatingPositionDirection;
195
204
 
196
- export { ColorSchemeService, DimensionWatcher, Duration, Ease, FloatingPositionAltAxis, FloatingPositionDirection, MediaWatcher, NodeRemovedWatcher, PositionWatcher, RectWatcher, alignmentNormalize, alignmentToTransformOrigin, floatingPosition, floatingPositionDirection, floatingPositionToStyle, inAnimation, inTransition, isAnimating, positionAltNormalize, rectConstraint, rectContainsPoint, rectContract, rectExpand, rectMoveOrigin, rectOrigin, sidesNormalize };
197
- export type { AlignHorizontal, AlignVertical, Alignment, AlignmentInput, Dimension, FloatingPosition, FloatingPositionAltFunc, FloatingPositionAltInput, FloatingPositionAltNorm, FloatingPositionAnchorOptions, FloatingPositionConstraintsInput, FloatingPositionContentOptions, FloatingPositionDims, FloatingPositionInput, FloatingPositionOptions, FloatingPositionPlacementOptions, Position, Rect, Sides, SidesInput, WatchBox };
205
+ export { ColorSchemeService, DimensionWatcher, Duration, Ease, FloatingPositionAltAxis, FloatingPositionDirection, MediaWatcher, NodeRemovedWatcher, PositionWatcher, RectWatcher, ScrollOffsetWatcher, alignmentNormalize, alignmentToTransformOrigin, floatingPosition, floatingPositionDirection, floatingPositionToStyle, inAnimation, inTransition, isAnimating, positionAltNormalize, rectConstraint, rectContainsPoint, rectContract, rectExpand, rectIntersect, rectMoveOrigin, rectOrigin, sidesNormalize };
206
+ export type { AlignHorizontal, AlignVertical, Alignment, AlignmentInput, Dimension, FloatingPosition, FloatingPositionAltFunc, FloatingPositionAltInput, FloatingPositionAltNorm, FloatingPositionAnchorOptions, FloatingPositionContentOptions, FloatingPositionDims, FloatingPositionInput, FloatingPositionOptions, FloatingPositionPlacementOptions, FloatingSizeConstraintsInput, Position, Rect, Sides, SidesInput, WatchBox };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngutil/style",
3
- "version": "0.0.115",
3
+ "version": "0.0.118",
4
4
  "exports": {
5
5
  ".": {
6
6
  "sass": "./index.scss",
@@ -17,7 +17,7 @@
17
17
  "@angular/core": "20.3.13",
18
18
  "es-toolkit": "^1.35.0",
19
19
  "rxjs": "^7.8.1",
20
- "@ngutil/common": "0.0.115"
20
+ "@ngutil/common": "0.0.118"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public",