@mmstack/primitives 20.0.2 → 20.0.3

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.
@@ -524,11 +524,11 @@ function mapArray(source, map, opt) {
524
524
  * }
525
525
  * ```
526
526
  */
527
- function mediaQuery(query, debugName) {
527
+ function mediaQuery(query, debugName = 'mediaQuery') {
528
528
  if (isPlatformServer(inject(PLATFORM_ID)))
529
529
  return computed(() => false, { debugName });
530
530
  const mediaQueryList = window.matchMedia(query);
531
- const state = signal(mediaQueryList.matches, ...(ngDevMode ? [{ debugName: "state", debugName }] : [{ debugName }]));
531
+ const state = signal(mediaQueryList.matches, { debugName: debugName });
532
532
  const handleChange = (event) => {
533
533
  state.set(event.matches);
534
534
  };
@@ -712,12 +712,12 @@ function mousePosition(opt) {
712
712
  x: 0,
713
713
  y: 0,
714
714
  }), {
715
- debugName: opt?.debugName,
715
+ debugName: opt?.debugName ?? 'mousePosition',
716
716
  });
717
717
  base.unthrottled = base;
718
718
  return base;
719
719
  }
720
- const { target = window, coordinateSpace = 'client', touch = false, debugName, throttle = 100, } = opt ?? {};
720
+ const { target = window, coordinateSpace = 'client', touch = false, debugName = 'mousePosition', throttle = 100, } = opt ?? {};
721
721
  const eventTarget = target instanceof ElementRef ? target.nativeElement : target;
722
722
  if (!eventTarget) {
723
723
  if (isDevMode())
@@ -778,7 +778,7 @@ const serverDate = new Date();
778
778
  * @param debugName Optional debug name for the signal.
779
779
  * @returns A `NetworkStatusSignal` instance.
780
780
  */
781
- function networkStatus(debugName) {
781
+ function networkStatus(debugName = 'networkStatus') {
782
782
  if (isPlatformServer(inject(PLATFORM_ID))) {
783
783
  const sig = computed(() => true, {
784
784
  debugName,
@@ -845,7 +845,7 @@ function networkStatus(debugName) {
845
845
  * }
846
846
  * ```
847
847
  */
848
- function pageVisibility(debugName) {
848
+ function pageVisibility(debugName = 'pageVisibility') {
849
849
  if (isPlatformServer(inject(PLATFORM_ID))) {
850
850
  return computed(() => 'visible', { debugName });
851
851
  }
@@ -907,12 +907,12 @@ function scrollPosition(opt) {
907
907
  x: 0,
908
908
  y: 0,
909
909
  }), {
910
- debugName: opt?.debugName,
910
+ debugName: opt?.debugName ?? 'scrollPosition',
911
911
  });
912
912
  base.unthrottled = base;
913
913
  return base;
914
914
  }
915
- const { target = window, throttle = 100, debugName } = opt || {};
915
+ const { target = window, throttle = 100, debugName = 'scrollPosition', } = opt || {};
916
916
  let element;
917
917
  let getScrollPosition;
918
918
  if (target instanceof Window) {
@@ -998,12 +998,12 @@ function windowSize(opt) {
998
998
  const base = computed(() => ({
999
999
  width: 1024,
1000
1000
  height: 768,
1001
- }), { debugName: opt?.debugName });
1001
+ }), { debugName: opt?.debugName ?? 'windowSize' });
1002
1002
  base.unthrottled = base;
1003
1003
  return base;
1004
1004
  }
1005
1005
  const sizeSignal = throttled({ width: window.innerWidth, height: window.innerHeight }, {
1006
- debugName: opt?.debugName,
1006
+ debugName: opt?.debugName ?? 'windowSize',
1007
1007
  equal: (a, b) => a.width === b.width && a.height === b.height,
1008
1008
  ms: opt?.throttle ?? 100,
1009
1009
  });