@joyautomation/salt 0.0.14 → 0.0.16

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,22 +1,24 @@
1
1
  <script lang="ts">
2
- import { page } from '$app/stores'
3
- import {
4
- notifications,
5
- type Notification,
6
- addNotification
7
- } from '../state/notifications.svelte.js'
2
+ import { page } from '$app/state'
3
+ import { notifications, addNotification } from '../state/notifications.svelte'
8
4
  import { slide } from 'svelte/transition'
9
5
 
10
- let queue = $derived(notifications.current)
6
+ let lastProcessedTime = 0
7
+
11
8
  $effect(() => {
12
- if ($page.form && $page.form?.message) {
13
- addNotification($page.form)
9
+ const formData = page.form
10
+ const now = Date.now()
11
+ // Only process if we have new form data with a message
12
+ // and enough time has passed since the last notification (e.g., 50ms)
13
+ if (formData?.message && now - lastProcessedTime > 50) {
14
+ lastProcessedTime = now
15
+ addNotification(formData)
14
16
  }
15
17
  })
16
18
  </script>
17
19
 
18
20
  <div class="toast">
19
- {#each queue as notification}
21
+ {#each notifications.current as notification}
20
22
  <div
21
23
  class:toast--success={notification.type === 'success'}
22
24
  class:toast--error={notification.type === 'error'}
@@ -10,4 +10,4 @@ export interface Notification {
10
10
  export declare const notifications: {
11
11
  current: Notification[];
12
12
  };
13
- export declare function addNotification(notification: NotificationInput): void;
13
+ export declare function addNotification(notification: NotificationInput): string;
@@ -16,4 +16,5 @@ export function addNotification(notification) {
16
16
  setTimeout(() => {
17
17
  notifications.current = notifications.current.filter((n) => n.id !== id);
18
18
  }, 5000);
19
+ return id;
19
20
  }
@@ -1,13 +1,13 @@
1
- @import './preflight.scss';
2
- @import './spacing.scss';
3
- @import './colors.scss';
4
- @import './layout.scss';
5
- @import './shadow.scss';
6
- @import './rounded.scss';
7
- @import './text.scss';
8
- @import './buttons.scss';
9
- @import './themes.scss';
10
- @import './form.scss';
1
+ @use './preflight.scss';
2
+ @use './spacing.scss';
3
+ @use './colors.scss';
4
+ @use './layout.scss';
5
+ @use './shadow.scss';
6
+ @use './rounded.scss';
7
+ @use './text.scss';
8
+ @use './buttons.scss';
9
+ @use './themes.scss';
10
+ @use './form.scss';
11
11
 
12
12
  body {
13
13
  font-family: var(--theme-font-basic);
@@ -1,3 +1,5 @@
1
+ @use 'sass:meta';
2
+
1
3
  $themes: (
2
4
  "themeLight": (
3
5
  "theme-font-basic": "'Space Grotesk', sans-serif",
@@ -80,7 +82,7 @@ $themes: (
80
82
  @each $property, $value in $theme-map {
81
83
 
82
84
  // Check if the value is a nested map (like for 'neutral')
83
- @if (type-of($value)=='map') {
85
+ @if (meta.type-of($value)=='map') {
84
86
  @each $nested-key, $nested-value in $value {
85
87
  --#{$property}-#{$nested-key}: #{$nested-value};
86
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joyautomation/salt",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "exports": {
5
5
  ".": [
6
6
  "./dist/index.js",