alus-ui 0.1.2 → 0.1.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.
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { untrack } from 'svelte';
2
3
  import { getCardContext } from './Card.svelte';
3
4
 
4
5
  interface Props {
@@ -11,8 +12,10 @@
11
12
  const ctx = getCardContext();
12
13
 
13
14
  $effect(() => {
14
- ctx.setHasDescription(true);
15
- return () => ctx.setHasDescription(false);
15
+ return untrack(() => {
16
+ ctx.setHasDescription(true);
17
+ return () => ctx.setHasDescription(false);
18
+ });
16
19
  });
17
20
  </script>
18
21
 
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { untrack } from 'svelte';
2
3
  import { getCardContext } from './Card.svelte';
3
4
 
4
5
  interface Props {
@@ -12,8 +13,10 @@
12
13
  const ctx = getCardContext();
13
14
 
14
15
  $effect(() => {
15
- ctx.setHasTitle(true);
16
- return () => ctx.setHasTitle(false);
16
+ return untrack(() => {
17
+ ctx.setHasTitle(true);
18
+ return () => ctx.setHasTitle(false);
19
+ });
17
20
  });
18
21
  </script>
19
22
 
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { untrack } from 'svelte';
2
3
  import { getCarouselContext } from './Carousel.svelte';
3
4
 
4
5
  interface Props {
@@ -14,8 +15,10 @@
14
15
  const active = $derived(ctx.index() === index);
15
16
 
16
17
  $effect(() => {
17
- const reg = ctx.registerSlide();
18
- return reg.unregister;
18
+ return untrack(() => {
19
+ const reg = ctx.registerSlide();
20
+ return reg.unregister;
21
+ });
19
22
  });
20
23
  </script>
21
24
 
@@ -1,4 +1,6 @@
1
1
  <script lang="ts">
2
+ import { untrack } from 'svelte';
3
+
2
4
  type Mode = 'absolute' | 'relative' | 'both';
3
5
  type Style = 'long' | 'short' | 'narrow';
4
6
 
@@ -30,11 +32,13 @@
30
32
  const date = $derived(value instanceof Date ? value : new Date(value));
31
33
 
32
34
  $effect(() => {
33
- if (mode === 'absolute') return;
34
- const id = setInterval(() => {
35
- now = Date.now();
36
- }, updateInterval);
37
- return () => clearInterval(id);
35
+ return untrack(() => {
36
+ if (mode === 'absolute') return;
37
+ const id = setInterval(() => {
38
+ now = Date.now();
39
+ }, updateInterval);
40
+ return () => clearInterval(id);
41
+ });
38
42
  });
39
43
 
40
44
  const absolute = $derived(new Intl.DateTimeFormat(locale, dateOptions).format(date));
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { untrack } from 'svelte';
2
3
  import { generateCounterId } from '../../../utils/a11y/id.js';
3
4
  import { interactiveStateAttrs } from '../../../utils/a11y/index.js';
4
5
  import { getCommandMenuContext } from './CommandMenu.svelte';
@@ -30,12 +31,14 @@
30
31
  const visible = $derived(ctx.filteredItems().some((i) => i.id === id));
31
32
 
32
33
  $effect(() => {
33
- const unregister = ctx.registerItem({ id, value, keywords, disabled, onSelect });
34
- const untrack = group?.track(() => visible);
35
- return () => {
36
- unregister();
37
- untrack?.();
38
- };
34
+ return untrack(() => {
35
+ const unregister = ctx.registerItem({ id, value, keywords, disabled, onSelect });
36
+ const untrackVis = group?.track(() => visible);
37
+ return () => {
38
+ unregister();
39
+ untrackVis?.();
40
+ };
41
+ });
39
42
  });
40
43
 
41
44
  function onClick() {
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { untrack } from 'svelte';
2
3
  import { getModalContext } from './Modal.svelte';
3
4
 
4
5
  interface Props {
@@ -11,8 +12,10 @@
11
12
  const ctx = getModalContext();
12
13
 
13
14
  $effect(() => {
14
- ctx.setHasDescription(true);
15
- return () => ctx.setHasDescription(false);
15
+ return untrack(() => {
16
+ ctx.setHasDescription(true);
17
+ return () => ctx.setHasDescription(false);
18
+ });
16
19
  });
17
20
  </script>
18
21
 
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { untrack } from 'svelte';
2
3
  import { getModalContext } from './Modal.svelte';
3
4
 
4
5
  interface Props {
@@ -12,8 +13,10 @@
12
13
  const ctx = getModalContext();
13
14
 
14
15
  $effect(() => {
15
- ctx.setHasTitle(true);
16
- return () => ctx.setHasTitle(false);
16
+ return untrack(() => {
17
+ ctx.setHasTitle(true);
18
+ return () => ctx.setHasTitle(false);
19
+ });
17
20
  });
18
21
  </script>
19
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alus-ui",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Unstyled, accessible Svelte 5 components with full keyboard navigation and WCAG 2.1 AA compliance",
5
5
  "license": "MIT",
6
6
  "type": "module",