@ethlete/core 4.14.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostBinding, InjectionToken, assertInInjectionContext, DestroyRef, ElementRef, TemplateRef, Injectable, isSignal, signal, QueryList, Injector, effect, untracked, runInInjectionContext, afterNextRender, NgZone, isDevMode, computed, Directive, model, EventEmitter, booleanAttribute, numberAttribute, Output, ViewContainerRef, Pipe, AfterRenderPhase, input } from '@angular/core';
2
+ import { inject, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostBinding, InjectionToken, assertInInjectionContext, DestroyRef, ElementRef, TemplateRef, Injectable, isSignal, signal, QueryList, Injector, effect, untracked, runInInjectionContext, afterNextRender, Renderer2, RendererStyleFlags2, NgZone, isDevMode, computed, Directive, model, EventEmitter, booleanAttribute, numberAttribute, Output, ViewContainerRef, Pipe, AfterRenderPhase, input } from '@angular/core';
3
3
  import { DomSanitizer, Meta, Title } from '@angular/platform-browser';
4
4
  import { Subject, BehaviorSubject, takeUntil, switchMap, of, tap, map, startWith, Observable, combineLatest, timer, distinctUntilChanged, shareReplay, filter, take, fromEvent, pairwise, debounceTime, finalize, merge, skip, takeWhile } from 'rxjs';
5
5
  import { END, HOME, PAGE_DOWN, PAGE_UP, UP_ARROW, DOWN_ARROW } from '@angular/cdk/keycodes';
@@ -1031,16 +1031,24 @@ const isElementVisible = (options) => {
1031
1031
  element,
1032
1032
  };
1033
1033
  };
1034
- const scrollToElement = (options) => {
1034
+ const getElementScrollCoordinates = (options) => {
1035
1035
  let { container } = options;
1036
1036
  const { element, direction, behavior = 'smooth', origin = 'nearest', scrollBlockMargin = 0, scrollInlineMargin = 0, } = options;
1037
1037
  if (!element || container === null) {
1038
- return;
1038
+ return {
1039
+ behavior,
1040
+ left: undefined,
1041
+ top: undefined,
1042
+ };
1039
1043
  }
1040
1044
  container ||= document.documentElement;
1041
1045
  const canScroll = elementCanScroll(container);
1042
1046
  if (!canScroll) {
1043
- return;
1047
+ return {
1048
+ behavior,
1049
+ left: undefined,
1050
+ top: undefined,
1051
+ };
1044
1052
  }
1045
1053
  const elementRect = element.getBoundingClientRect();
1046
1054
  const containerRect = container.getBoundingClientRect();
@@ -1111,11 +1119,14 @@ const scrollToElement = (options) => {
1111
1119
  scrollToElementNearest();
1112
1120
  break;
1113
1121
  }
1114
- container.scrollTo({
1122
+ return {
1115
1123
  behavior,
1116
1124
  left: shouldScrollLeft ? scrollLeftTo : undefined,
1117
1125
  top: shouldScrollTop ? scrollTopTo : undefined,
1118
- });
1126
+ };
1127
+ };
1128
+ const scrollToElement = (options) => {
1129
+ options.container?.scrollTo(getElementScrollCoordinates(options));
1119
1130
  };
1120
1131
  const getElementVisibleStates = (options) => {
1121
1132
  let { container } = options;
@@ -2377,15 +2388,16 @@ const signalIsRendered = () => {
2377
2388
  return isRendered.asReadonly();
2378
2389
  };
2379
2390
  const signalClasses = (el, classMap) => {
2391
+ const renderer = inject(Renderer2);
2380
2392
  return buildSignalEffects(el, {
2381
2393
  tokenMap: classMap,
2382
- cleanupFn: (el, tokens) => el.classList.remove(...tokens),
2394
+ cleanupFn: (el, tokens) => tokens.forEach((token) => renderer.removeClass(el, token)),
2383
2395
  updateFn: (el, tokens, condition) => {
2384
2396
  if (!condition) {
2385
- el.classList.remove(...tokens);
2397
+ tokens.forEach((token) => renderer.removeClass(el, token));
2386
2398
  }
2387
2399
  else {
2388
- el.classList.add(...tokens);
2400
+ tokens.forEach((token) => renderer.addClass(el, token));
2389
2401
  }
2390
2402
  },
2391
2403
  });
@@ -2393,6 +2405,7 @@ const signalClasses = (el, classMap) => {
2393
2405
  const signalHostClasses = (classMap) => signalClasses(inject(ElementRef), classMap);
2394
2406
  const ALWAYS_TRUE_ATTRIBUTE_KEYS = ['disabled', 'readonly', 'required', 'checked', 'selected', 'hidden', 'inert'];
2395
2407
  const signalAttributes = (el, attributeMap) => {
2408
+ const renderer = inject(Renderer2);
2396
2409
  return buildSignalEffects(el, {
2397
2410
  tokenMap: attributeMap,
2398
2411
  cleanupFn: (el, tokens) => tokens.forEach((token) => el.removeAttribute(token)),
@@ -2400,18 +2413,18 @@ const signalAttributes = (el, attributeMap) => {
2400
2413
  for (const token of tokens) {
2401
2414
  if (ALWAYS_TRUE_ATTRIBUTE_KEYS.includes(token)) {
2402
2415
  if (condition) {
2403
- el.setAttribute(token, '');
2416
+ renderer.setAttribute(el, token, '');
2404
2417
  }
2405
2418
  else {
2406
- el.removeAttribute(token);
2419
+ renderer.removeAttribute(el, token);
2407
2420
  }
2408
2421
  continue;
2409
2422
  }
2410
2423
  if (condition === null || condition === undefined) {
2411
- el.removeAttribute(token);
2424
+ renderer.removeAttribute(el, token);
2412
2425
  }
2413
2426
  else {
2414
- el.setAttribute(token, `${condition}`);
2427
+ renderer.setAttribute(el, token, `${condition}`);
2415
2428
  }
2416
2429
  }
2417
2430
  },
@@ -2419,16 +2432,17 @@ const signalAttributes = (el, attributeMap) => {
2419
2432
  };
2420
2433
  const signalHostAttributes = (attributeMap) => signalAttributes(inject(ElementRef), attributeMap);
2421
2434
  const signalStyles = (el, styleMap) => {
2435
+ const renderer = inject(Renderer2);
2422
2436
  return buildSignalEffects(el, {
2423
2437
  tokenMap: styleMap,
2424
- cleanupFn: (el, tokens) => tokens.forEach((token) => el.style.removeProperty(token)),
2438
+ cleanupFn: (el, tokens) => tokens.forEach((token) => renderer.removeStyle(el, token)),
2425
2439
  updateFn: (el, tokens, condition) => {
2426
2440
  for (const token of tokens) {
2427
2441
  if (condition === null || condition === undefined) {
2428
- el.style.removeProperty(token);
2442
+ renderer.removeStyle(el, token);
2429
2443
  }
2430
2444
  else {
2431
- el.style.setProperty(token, `${condition}`);
2445
+ renderer.setStyle(el, token, `${condition}`, RendererStyleFlags2.DashCase);
2432
2446
  }
2433
2447
  }
2434
2448
  },
@@ -2529,8 +2543,10 @@ const signalElementScrollState = (el, options) => {
2529
2543
  const scrollPosition = initialScrollPosition();
2530
2544
  const element = elements().currentElement;
2531
2545
  if (scrollPosition && element) {
2532
- element.scrollLeft = scrollPosition.x;
2533
- element.scrollTop = scrollPosition.y;
2546
+ if (scrollPosition.left !== undefined)
2547
+ element.scrollLeft = scrollPosition.left;
2548
+ if (scrollPosition.top !== undefined)
2549
+ element.scrollTop = scrollPosition.top;
2534
2550
  ref.destroy();
2535
2551
  }
2536
2552
  });
@@ -5462,5 +5478,5 @@ const Validators = {
5462
5478
  * Generated bundle index. Do not edit.
5463
5479
  */
5464
5480
 
5465
- export { ANIMATABLE_TOKEN, ANIMATED_IF_TOKEN, ANIMATED_LIFECYCLE_TOKEN, AT_LEAST_ONE_REQUIRED, ActiveSelectionModel, AnimatableDirective, AnimatedIfDirective, AnimatedLifecycleDirective, AnimatedOverlayDirective, CURSOR_DRAG_SCROLLING_CLASS, CURSOR_DRAG_SCROLLING_PREPARED_CLASS, ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEBUG_TOKEN, DEFAULT_VIEWPORT_CONFIG, DELAYABLE_TOKEN, DebugDirective, DelayableDirective, ET_PROPERTY_REMOVED, FocusVisibleService, IS_ACTIVE_ELEMENT, IS_ARRAY_NOT_EMPTY, IS_ELEMENT, IS_EMAIL, InferMimeTypePipe, IntersectionObserverFactory, IntersectionObserverService, IsActiveElementDirective, IsArrayNotEmpty, IsElementDirective, IsEmail, KeyPressManager, LetContext, LetDirective, MUST_MATCH, Memo, MustMatch, MutationObserverFactory, NormalizeGameResultTypePipe, NormalizeMatchParticipantsPipe, NormalizeMatchScorePipe, NormalizeMatchStatePipe, NormalizeMatchTypePipe, OBSERVE_SCROLL_STATE, OBSERVE_VISIBILITY_TOKEN, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, ObserveVisibilityDirective, PropsDirective, ROOT_BOUNDARY_TOKEN, RUNTIME_ERROR_NO_DATA, RepeatDirective, ResizeObserverFactory, ResizeObserverService, RootBoundaryDirective, RouterStateService, RuntimeError, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SCROLL_OBSERVER_OBSERVING_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_OBSERVING_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SelectionModel, SeoDirective, SmartBlockScrollStrategy, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, ValidateAtLeastOneRequired, Validators, ViewportService, bindProps, buildSignalEffects, clamp, clone, cloneFormGroup, controlValueSignal, controlValueSignalWithPrevious, createCanAnimateSignal, createComponentId, createDependencyStash, createDestroy, createElementDictionary, createFlipAnimation, createFlipAnimationGroup, createHostProps, createIsRenderedSignal, createMediaQueryObservable, createMutationObservable, createPropHandlers, createProps, createReactiveBindings, createResizeObservable, createSetup, debouncedControlValueSignal, deleteCookie, elementCanScroll, equal, forceReflow, formatRuntimeError, fromNextFrame, getCookie, getDomain, getElementVisibleStates, getFormGroupValue, getGroupMatchPoints, getGroupMatchScore, getIntersectionInfo, getKnockoutMatchScore, getMatchScoreSubLine, getObjectProperty, hasCookie, inferMimeType, injectFragment, injectHostElement, injectOrRunInContext, injectPathParam, injectPathParams, injectQueryParam, injectQueryParams, injectRouteData, injectRouteDataItem, injectRouteTitle, injectTemplateRef, isArray, isElementVisible, isEmptyArray, isGroupMatch, isKnockoutMatch, isObject, isObjectArray, isPrimitiveArray, mergeSeoConfig, nextFrame, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, previousSignalValue, provideViewportConfig, round, routerDisableScrollTop, scrollToElement, setCookie, signalAttributes, signalClasses, signalElementChildren, signalElementDimensions, signalElementIntersection, signalElementMutations, signalElementScrollState, signalHostAttributes, signalHostClasses, signalHostElementDimensions, signalHostElementIntersection, signalHostElementMutations, signalHostElementScrollState, signalHostStyles, signalIsRendered, signalStyles, signalVisibilityChangeClasses, switchQueryListChanges, syncSignal, templateComputed, toArray, toArrayTrackByFn, transformOrReturn, unbindProps };
5481
+ export { ANIMATABLE_TOKEN, ANIMATED_IF_TOKEN, ANIMATED_LIFECYCLE_TOKEN, AT_LEAST_ONE_REQUIRED, ActiveSelectionModel, AnimatableDirective, AnimatedIfDirective, AnimatedLifecycleDirective, AnimatedOverlayDirective, CURSOR_DRAG_SCROLLING_CLASS, CURSOR_DRAG_SCROLLING_PREPARED_CLASS, ClickObserverFactory, ClickObserverService, ClickOutsideDirective, ContentObserverService, CursorDragScrollDirective, DEBUG_TOKEN, DEFAULT_VIEWPORT_CONFIG, DELAYABLE_TOKEN, DebugDirective, DelayableDirective, ET_PROPERTY_REMOVED, FocusVisibleService, IS_ACTIVE_ELEMENT, IS_ARRAY_NOT_EMPTY, IS_ELEMENT, IS_EMAIL, InferMimeTypePipe, IntersectionObserverFactory, IntersectionObserverService, IsActiveElementDirective, IsArrayNotEmpty, IsElementDirective, IsEmail, KeyPressManager, LetContext, LetDirective, MUST_MATCH, Memo, MustMatch, MutationObserverFactory, NormalizeGameResultTypePipe, NormalizeMatchParticipantsPipe, NormalizeMatchScorePipe, NormalizeMatchStatePipe, NormalizeMatchTypePipe, OBSERVE_SCROLL_STATE, OBSERVE_VISIBILITY_TOKEN, ObserveContentDirective, ObserveResizeDirective, ObserveScrollStateDirective, ObserveVisibilityDirective, PropsDirective, ROOT_BOUNDARY_TOKEN, RUNTIME_ERROR_NO_DATA, RepeatDirective, ResizeObserverFactory, ResizeObserverService, RootBoundaryDirective, RouterStateService, RuntimeError, SCROLL_OBSERVER_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_IGNORE_TARGET_CLASS, SCROLL_OBSERVER_LAST_ELEMENT_CLASS, SCROLL_OBSERVER_OBSERVING_FIRST_ELEMENT_CLASS, SCROLL_OBSERVER_OBSERVING_LAST_ELEMENT_CLASS, SEO_DIRECTIVE_TOKEN, ScrollObserverFirstElementDirective, ScrollObserverIgnoreTargetDirective, ScrollObserverLastElementDirective, SelectionModel, SeoDirective, SmartBlockScrollStrategy, StructuredDataComponent, ToArrayPipe, TypedQueryList, VIEWPORT_CONFIG, ValidateAtLeastOneRequired, Validators, ViewportService, bindProps, buildSignalEffects, clamp, clone, cloneFormGroup, controlValueSignal, controlValueSignalWithPrevious, createCanAnimateSignal, createComponentId, createDependencyStash, createDestroy, createElementDictionary, createFlipAnimation, createFlipAnimationGroup, createHostProps, createIsRenderedSignal, createMediaQueryObservable, createMutationObservable, createPropHandlers, createProps, createReactiveBindings, createResizeObservable, createSetup, debouncedControlValueSignal, deleteCookie, elementCanScroll, equal, forceReflow, formatRuntimeError, fromNextFrame, getCookie, getDomain, getElementScrollCoordinates, getElementVisibleStates, getFormGroupValue, getGroupMatchPoints, getGroupMatchScore, getIntersectionInfo, getKnockoutMatchScore, getMatchScoreSubLine, getObjectProperty, hasCookie, inferMimeType, injectFragment, injectHostElement, injectOrRunInContext, injectPathParam, injectPathParams, injectQueryParam, injectQueryParams, injectRouteData, injectRouteDataItem, injectRouteTitle, injectTemplateRef, isArray, isElementVisible, isEmptyArray, isGroupMatch, isKnockoutMatch, isObject, isObjectArray, isPrimitiveArray, mergeSeoConfig, nextFrame, normalizeGameResultType, normalizeMatchParticipant, normalizeMatchParticipants, normalizeMatchScore, normalizeMatchState, normalizeMatchType, previousSignalValue, provideViewportConfig, round, routerDisableScrollTop, scrollToElement, setCookie, signalAttributes, signalClasses, signalElementChildren, signalElementDimensions, signalElementIntersection, signalElementMutations, signalElementScrollState, signalHostAttributes, signalHostClasses, signalHostElementDimensions, signalHostElementIntersection, signalHostElementMutations, signalHostElementScrollState, signalHostStyles, signalIsRendered, signalStyles, signalVisibilityChangeClasses, switchQueryListChanges, syncSignal, templateComputed, toArray, toArrayTrackByFn, transformOrReturn, unbindProps };
5466
5482
  //# sourceMappingURL=ethlete-core.mjs.map