@intechstudio/grid-uikit 1.20260922.1223 → 1.20260923.1330
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/dist/LogMessage.svelte +9 -10
- package/dist/LogStream.svelte +71 -0
- package/dist/LogStream.svelte.d.ts +4 -0
- package/dist/MoltenTooltip.svelte +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/logStream.d.ts +35 -0
- package/dist/logStream.js +52 -0
- package/package.json +1 -1
package/dist/LogMessage.svelte
CHANGED
|
@@ -53,7 +53,9 @@
|
|
|
53
53
|
display: flex;
|
|
54
54
|
align-items: center;
|
|
55
55
|
width: 30rem;
|
|
56
|
-
|
|
56
|
+
padding: 0;
|
|
57
|
+
margin: 0;
|
|
58
|
+
border: none;
|
|
57
59
|
background: none;
|
|
58
60
|
cursor: pointer;
|
|
59
61
|
}
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
justify-content: center;
|
|
67
69
|
width: 2.5rem;
|
|
68
70
|
height: 2rem;
|
|
69
|
-
border-radius:
|
|
71
|
+
border-radius: var(--radius-full);
|
|
70
72
|
background: var(--background-muted);
|
|
71
73
|
border: 1px solid var(--background-soft);
|
|
72
74
|
font-size: 0.875rem;
|
|
@@ -79,21 +81,18 @@
|
|
|
79
81
|
width: 100%;
|
|
80
82
|
padding: 0.5rem;
|
|
81
83
|
margin: 0.25rem 0;
|
|
82
|
-
border
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
transition:
|
|
86
|
-
opacity 0.1s ease,
|
|
87
|
-
background-color 0.1s ease;
|
|
84
|
+
border: solid 1px var(--border);
|
|
85
|
+
border-radius: var(--radius-medium);
|
|
86
|
+
background: var(--popover-background);
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
.notification-card:hover {
|
|
91
|
-
|
|
90
|
+
background: var(--popover-selection);
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
.notification-icon {
|
|
95
94
|
padding: 0.5rem;
|
|
96
|
-
border-radius:
|
|
95
|
+
border-radius: var(--radius-medium);
|
|
97
96
|
background: var(--background-muted);
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { fly } from "svelte/transition";
|
|
4
|
+
import LogMessage from "./LogMessage.svelte";
|
|
5
|
+
import { logStreamStore as defaultLogStreamStore } from "./logStream";
|
|
6
|
+
import type { LogStream } from "./logStream";
|
|
7
|
+
|
|
8
|
+
const dispatch = createEventDispatcher();
|
|
9
|
+
|
|
10
|
+
export let store: LogStream = defaultLogStreamStore;
|
|
11
|
+
export let bottom: string = "5rem";
|
|
12
|
+
|
|
13
|
+
function handleClick(index: number) {
|
|
14
|
+
store.dismissLog({ index });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function handleMouseEnter() {
|
|
18
|
+
store.enableTimeout(false);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function handleMouseLeave() {
|
|
22
|
+
store.enableTimeout(true);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function handleCreation() {
|
|
26
|
+
dispatch("content-change", { count: $store.length });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function handleDestroy() {
|
|
30
|
+
store.enableTimeout(true);
|
|
31
|
+
dispatch("content-change", { count: $store.length });
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
36
|
+
<div class="log-stream" style="bottom: {bottom};">
|
|
37
|
+
{#each $store as log, i (log)}
|
|
38
|
+
<div
|
|
39
|
+
class="log-stream-item"
|
|
40
|
+
on:mouseenter={handleMouseEnter}
|
|
41
|
+
on:mouseleave={handleMouseLeave}
|
|
42
|
+
in:fly|global={{ x: -10, delay: 100 + 400 * i, duration: 500 }}
|
|
43
|
+
out:fly|global={{ x: 10, delay: 400 * i, duration: 500 }}
|
|
44
|
+
>
|
|
45
|
+
<LogMessage
|
|
46
|
+
count={log.count}
|
|
47
|
+
type={log.data.type}
|
|
48
|
+
text={log.data.message}
|
|
49
|
+
on:destroy={handleDestroy}
|
|
50
|
+
on:creation={handleCreation}
|
|
51
|
+
on:click={() => handleClick(i)}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
{/each}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.log-stream {
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: 50%;
|
|
61
|
+
transform: translateX(-50%);
|
|
62
|
+
z-index: 2;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.log-stream-item {
|
|
69
|
+
pointer-events: auto;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
$effect(() => {
|
|
192
192
|
if (tooltipElement) {
|
|
193
193
|
previousFocusedElement = document.activeElement as HTMLElement | null;
|
|
194
|
-
tooltipElement.focus();
|
|
194
|
+
tooltipElement.focus({ preventScroll: true });
|
|
195
195
|
const handleFocusOut = (e: FocusEvent) => {
|
|
196
196
|
const relatedTarget = e.relatedTarget as Node | null;
|
|
197
197
|
if (relatedTarget && tooltipElement?.contains(relatedTarget)) {
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
showbuttons = false;
|
|
268
268
|
if (restoreFocus && previousFocusedElement) {
|
|
269
269
|
isRestoringFocus = true;
|
|
270
|
-
previousFocusedElement.focus();
|
|
270
|
+
previousFocusedElement.focus({ preventScroll: true });
|
|
271
271
|
previousFocusedElement = null;
|
|
272
272
|
requestAnimationFrame(() => {
|
|
273
273
|
isRestoringFocus = false;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,3 +26,5 @@ export { Color } from "./color";
|
|
|
26
26
|
export { default as ColorLayerSelector, type LayerClickDetail, } from "./ColorLayerSelector.svelte";
|
|
27
27
|
export { default as LogMessage } from "./LogMessage.svelte";
|
|
28
28
|
export { LogMessageType } from "./LogMessageType";
|
|
29
|
+
export { default as LogStream } from "./LogStream.svelte";
|
|
30
|
+
export { createLogStream, logStreamStore, type LogStreamMessage, type LogStreamOptions, } from "./logStream";
|
package/dist/index.js
CHANGED
|
@@ -26,3 +26,5 @@ export { Color } from "./color";
|
|
|
26
26
|
export { default as ColorLayerSelector, } from "./ColorLayerSelector.svelte";
|
|
27
27
|
export { default as LogMessage } from "./LogMessage.svelte";
|
|
28
28
|
export { LogMessageType } from "./LogMessageType";
|
|
29
|
+
export { default as LogStream } from "./LogStream.svelte";
|
|
30
|
+
export { createLogStream, logStreamStore, } from "./logStream";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LogMessageType } from "./LogMessageType";
|
|
2
|
+
export type LogStreamMessage = {
|
|
3
|
+
type: LogMessageType;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
type LogStreamEntry = {
|
|
7
|
+
data: LogStreamMessage;
|
|
8
|
+
count: number;
|
|
9
|
+
};
|
|
10
|
+
export type LogStreamOptions = {
|
|
11
|
+
/** Max number of entries kept on screen at once; oldest is dropped first. */
|
|
12
|
+
maxVisible?: number;
|
|
13
|
+
/** How long an entry stays before auto-clearing, in ms. */
|
|
14
|
+
autoDismissMs?: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function createLogStream(options?: LogStreamOptions): {
|
|
17
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<LogStreamEntry[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
18
|
+
push: (entry: LogStreamMessage) => void;
|
|
19
|
+
dismissLog: ({ index }: {
|
|
20
|
+
index: number;
|
|
21
|
+
}) => void;
|
|
22
|
+
enableTimeout: (value: boolean) => void;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
};
|
|
25
|
+
export type LogStream = ReturnType<typeof createLogStream>;
|
|
26
|
+
export declare const logStreamStore: {
|
|
27
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<LogStreamEntry[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
28
|
+
push: (entry: LogStreamMessage) => void;
|
|
29
|
+
dismissLog: ({ index }: {
|
|
30
|
+
index: number;
|
|
31
|
+
}) => void;
|
|
32
|
+
enableTimeout: (value: boolean) => void;
|
|
33
|
+
reset: () => void;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { writable } from "svelte/store";
|
|
2
|
+
export function createLogStream(options = {}) {
|
|
3
|
+
const { maxVisible = 3, autoDismissMs = 5000 } = options;
|
|
4
|
+
const store = writable([]);
|
|
5
|
+
let isTimeoutEnabled = true;
|
|
6
|
+
let clearHandle;
|
|
7
|
+
function clearLogs(force = false) {
|
|
8
|
+
if (isTimeoutEnabled || force) {
|
|
9
|
+
store.set([]);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
clearHandle = setTimeout(() => clearLogs(), 500);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function push(entry) {
|
|
16
|
+
clearTimeout(clearHandle);
|
|
17
|
+
store.update((entries) => {
|
|
18
|
+
const last = entries.at(-1);
|
|
19
|
+
if (last && last.data.message === entry.message) {
|
|
20
|
+
last.count++;
|
|
21
|
+
return entries;
|
|
22
|
+
}
|
|
23
|
+
const next = [...entries, { data: entry, count: 1 }];
|
|
24
|
+
if (next.length > maxVisible) {
|
|
25
|
+
next.shift();
|
|
26
|
+
}
|
|
27
|
+
return next;
|
|
28
|
+
});
|
|
29
|
+
clearHandle = setTimeout(() => clearLogs(), autoDismissMs);
|
|
30
|
+
}
|
|
31
|
+
function dismissLog({ index }) {
|
|
32
|
+
store.update((entries) => {
|
|
33
|
+
entries.splice(index, 1);
|
|
34
|
+
return entries;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function enableTimeout(value) {
|
|
38
|
+
isTimeoutEnabled = value;
|
|
39
|
+
}
|
|
40
|
+
function reset() {
|
|
41
|
+
clearTimeout(clearHandle);
|
|
42
|
+
clearLogs(true);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
subscribe: store.subscribe,
|
|
46
|
+
push,
|
|
47
|
+
dismissLog,
|
|
48
|
+
enableTimeout,
|
|
49
|
+
reset,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export const logStreamStore = createLogStream();
|