@ethlete/core 5.0.0-next.0 → 5.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @ethlete/core
2
2
 
3
+ ## 5.0.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`95e656d`](https://github.com/ethlete-io/ethdk/commit/95e656d036368a48cbd17a399f7c0c61c49ab0fa) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix angular root element discovery failing if its not there during the first check
8
+
9
+ - [`95e656d`](https://github.com/ethlete-io/ethdk/commit/95e656d036368a48cbd17a399f7c0c61c49ab0fa) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix animated lifecycle skipping interrupted transitions
10
+
11
+ - [`95e656d`](https://github.com/ethlete-io/ethdk/commit/95e656d036368a48cbd17a399f7c0c61c49ab0fa) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix scrollbar dimensions signal not returning the actual scrollbar dimensions
12
+
13
+ ## 5.0.0-next.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#2920](https://github.com/ethlete-io/ethdk/pull/2920) [`377bd7a`](https://github.com/ethlete-io/ethdk/commit/377bd7a00b89aef516d312c909e236fcc1ed5077) Thanks [@github-actions](https://github.com/apps/github-actions)! - Change renderer.removeStyle function signature to support style flags
18
+
19
+ - Updated dependencies [[`d99c3f0`](https://github.com/ethlete-io/ethdk/commit/d99c3f0fc3d6b3b0e7105d21d1f7119cde68b561)]:
20
+ - @ethlete/types@2.0.0-next.0
21
+
3
22
  ## 5.0.0-next.0
4
23
 
5
24
  ### Major Changes
@@ -1565,9 +1565,18 @@ const injectScrollbarDimensions = memoizeSignal(() => {
1565
1565
  scrollbarRuler.style.overflow = 'scroll';
1566
1566
  scrollbarRuler.style.position = 'absolute';
1567
1567
  scrollbarRuler.style.top = '-9999px';
1568
+ scrollbarRuler.style.scrollbarWidth = getComputedStyle(document.documentElement).scrollbarWidth;
1568
1569
  renderer.appendChild(document.body, scrollbarRuler);
1569
1570
  const scrollContainerDimensions = signalElementDimensions(scrollbarRuler);
1570
- return scrollContainerDimensions;
1571
+ return computed(() => {
1572
+ const client = scrollContainerDimensions().client;
1573
+ if (!client)
1574
+ return null;
1575
+ return {
1576
+ width: Math.max(0, 100 - client.width),
1577
+ height: Math.max(0, 100 - client.height),
1578
+ };
1579
+ });
1571
1580
  });
1572
1581
 
1573
1582
  let hasWrittenScrollbarSizes = false;
@@ -1588,7 +1597,7 @@ const writeScrollbarSizeToCssVariables = () => {
1588
1597
  const renderer = injectRenderer();
1589
1598
  const scrollbarDimensions = injectScrollbarDimensions();
1590
1599
  effect(() => {
1591
- const dimensions = scrollbarDimensions().rect?.();
1600
+ const dimensions = scrollbarDimensions();
1592
1601
  if (!dimensions)
1593
1602
  return;
1594
1603
  renderer.setCssProperties(document.documentElement, {
@@ -1674,7 +1683,7 @@ const useCursorDragScroll = (el, options) => {
1674
1683
  if (!el)
1675
1684
  return;
1676
1685
  if (!currCanScroll || !isEnabled) {
1677
- renderer.removeStyle(el, 'cursor', 'scrollSnapType', 'scrollBehavior');
1686
+ renderer.removeStyles(el, 'cursor', 'scrollSnapType', 'scrollBehavior');
1678
1687
  renderer.removeStyle(document.documentElement, 'cursor');
1679
1688
  renderer.removeClass(el, CURSOR_DRAG_SCROLLING_CLASS, CURSOR_DRAG_INIT_CLASS);
1680
1689
  return;
@@ -1697,7 +1706,7 @@ const useCursorDragScroll = (el, options) => {
1697
1706
  renderer.setStyle(el, {
1698
1707
  cursor: 'grab',
1699
1708
  });
1700
- renderer.removeStyle(el, 'scrollSnapType', 'scrollBehavior');
1709
+ renderer.removeStyles(el, 'scrollSnapType', 'scrollBehavior');
1701
1710
  renderer.removeClass(el, CURSOR_DRAG_SCROLLING_CLASS, CURSOR_DRAG_INIT_CLASS);
1702
1711
  renderer.removeStyle(document.documentElement, 'cursor');
1703
1712
  }
@@ -2290,12 +2299,16 @@ const scrollToElement = (options) => {
2290
2299
  const [, injectAngularRootElement] = createRootProvider(() => {
2291
2300
  const appRef = inject(ApplicationRef);
2292
2301
  const rootElement = signal(null, ...(ngDevMode ? [{ debugName: "rootElement" }] : []));
2293
- setTimeout(() => {
2302
+ const poll = () => {
2294
2303
  const appComponents = appRef.components;
2295
2304
  if (appComponents.length > 0) {
2296
2305
  rootElement.set(appComponents[0]?.location.nativeElement);
2297
2306
  }
2298
- });
2307
+ else {
2308
+ setTimeout(poll, 25);
2309
+ }
2310
+ };
2311
+ setTimeout(poll);
2299
2312
  return rootElement;
2300
2313
  });
2301
2314
 
@@ -2458,6 +2471,8 @@ const [provideRenderer, injectRenderer] = createRootProvider(() => {
2458
2471
  };
2459
2472
  const setStyle = (element, style, flags) => {
2460
2473
  Object.entries(style).forEach(([key, value]) => {
2474
+ if (!Number.isNaN(Number(key)))
2475
+ return;
2461
2476
  if (value !== null && value !== undefined) {
2462
2477
  renderer.setStyle(element, key, value, flags);
2463
2478
  }
@@ -2466,8 +2481,13 @@ const [provideRenderer, injectRenderer] = createRootProvider(() => {
2466
2481
  }
2467
2482
  });
2468
2483
  };
2469
- const removeStyle = (element, ...styles) => {
2470
- styles.forEach((style) => renderer.removeStyle(element, style));
2484
+ const removeStyle = (element, style, flags) => {
2485
+ if (!Number.isNaN(Number(style)))
2486
+ return;
2487
+ renderer.removeStyle(element, style, flags);
2488
+ };
2489
+ const removeStyles = (element, ...styles) => {
2490
+ styles.forEach((style) => removeStyle(element, style));
2471
2491
  };
2472
2492
  const setCssProperty = (element, name, value) => {
2473
2493
  if (value !== null && value !== undefined) {
@@ -2570,6 +2590,7 @@ const [provideRenderer, injectRenderer] = createRootProvider(() => {
2570
2590
  toggleClass,
2571
2591
  setStyle,
2572
2592
  removeStyle,
2593
+ removeStyles,
2573
2594
  setAttribute,
2574
2595
  removeAttribute,
2575
2596
  setProperty,
@@ -2830,7 +2851,7 @@ class AnimatedLifecycleDirective {
2830
2851
  const { removeClasses, addClasses, expectedState, transitionId, onComplete, cancelSignal } = config;
2831
2852
  this.removeClasses(...removeClasses);
2832
2853
  addClasses.forEach((cls) => this.addClass(cls));
2833
- timer(0)
2854
+ fromNextFrame()
2834
2855
  .pipe(switchMap(() => this.animatable.isAnimating$), take(1), switchMap((isAnimating) => {
2835
2856
  if (!isAnimating && this.state$.value === expectedState) {
2836
2857
  return of({ cancelled: false, transitionId });