@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/
|
|
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
|
|
6
|
+
let lastProcessedTime = 0
|
|
7
|
+
|
|
11
8
|
$effect(() => {
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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):
|
|
13
|
+
export declare function addNotification(notification: NotificationInput): string;
|
package/dist/styles/main.scss
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
7
|
-
@
|
|
8
|
-
@
|
|
9
|
-
@
|
|
10
|
-
@
|
|
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);
|
package/dist/styles/themes.scss
CHANGED
|
@@ -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
|
}
|