@marianmeres/stuic 2.3.2 → 2.5.0
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/README.md +0 -1
- package/dist/README.md +17 -11
- package/dist/actions/autogrow.svelte.js +4 -4
- package/dist/actions/autoscroll.d.ts +2 -2
- package/dist/actions/autoscroll.js +17 -8
- package/dist/actions/file-dropzone.svelte.d.ts +1 -1
- package/dist/actions/file-dropzone.svelte.js +1 -1
- package/dist/actions/focus-trap.js +33 -24
- package/dist/actions/highlight-dragover.svelte.js +6 -5
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/on-submit-validity-check.svelte.js +2 -2
- package/dist/actions/popover/PopoverContent.svelte +15 -0
- package/dist/actions/popover/PopoverContent.svelte.d.ts +7 -0
- package/dist/actions/popover/index.css +78 -0
- package/dist/actions/popover/index.d.ts +1 -0
- package/dist/actions/popover/index.js +1 -0
- package/dist/actions/popover/popover.svelte.d.ts +112 -0
- package/dist/actions/popover/popover.svelte.js +449 -0
- package/dist/actions/resizable-width.svelte.d.ts +1 -1
- package/dist/actions/resizable-width.svelte.js +7 -5
- package/dist/actions/tooltip/index.css +2 -7
- package/dist/actions/tooltip/tooltip.svelte.js +5 -4
- package/dist/actions/trim.svelte.d.ts +1 -1
- package/dist/actions/trim.svelte.js +2 -2
- package/dist/actions/validate.svelte.d.ts +4 -4
- package/dist/actions/validate.svelte.js +9 -9
- package/dist/components/AlertConfirmPrompt/alert-confirm-prompt-stack.svelte.d.ts +7 -6
- package/dist/components/AlertConfirmPrompt/alert-confirm-prompt-stack.svelte.js +1 -2
- package/dist/components/AlertConfirmPrompt/index.d.ts +1 -1
- package/dist/components/AlertConfirmPrompt/index.js +1 -1
- package/dist/components/AnimatedElipsis/index.d.ts +1 -1
- package/dist/components/AnimatedElipsis/index.js +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte +4 -1
- package/dist/components/ButtonGroupRadio/index.d.ts +1 -1
- package/dist/components/ButtonGroupRadio/index.js +1 -1
- package/dist/components/ColorScheme/index.d.ts +2 -2
- package/dist/components/ColorScheme/index.js +2 -2
- package/dist/components/CommandMenu/CommandMenu.svelte +1 -1
- package/dist/components/CommandMenu/index.d.ts +1 -1
- package/dist/components/CommandMenu/index.js +1 -1
- package/dist/components/DismissibleMessage/index.d.ts +1 -1
- package/dist/components/DismissibleMessage/index.js +1 -1
- package/dist/components/HoverExpandableWidth/index.d.ts +1 -1
- package/dist/components/HoverExpandableWidth/index.js +1 -1
- package/dist/components/Input/FieldAssets.svelte +7 -3
- package/dist/components/Input/FieldLikeButton.svelte +1 -1
- package/dist/components/Input/FieldOptions.svelte +1 -1
- package/dist/components/Input/index.d.ts +7 -7
- package/dist/components/Input/index.js +7 -7
- package/dist/components/KbdShortcut/index.d.ts +1 -1
- package/dist/components/KbdShortcut/index.js +1 -1
- package/dist/components/ModalDialog/index.d.ts +1 -1
- package/dist/components/ModalDialog/index.js +1 -1
- package/dist/components/Notifications/index.d.ts +1 -1
- package/dist/components/Notifications/index.js +1 -1
- package/dist/components/Notifications/notifications-stack.svelte.d.ts +5 -5
- package/dist/components/Notifications/notifications-stack.svelte.js +8 -7
- package/dist/components/SlidingPanels/index.d.ts +1 -1
- package/dist/components/SlidingPanels/index.js +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/Spinner/index.js +1 -1
- package/dist/components/Switch/Switch.svelte +5 -2
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/TypeaheadInput/index.d.ts +1 -1
- package/dist/components/TypeaheadInput/index.js +1 -1
- package/dist/utils/body-scroll-locker.js +4 -3
- package/dist/utils/breakpoint.svelte.js +0 -2
- package/dist/utils/colors.js +3 -3
- package/dist/utils/debounce.d.ts +1 -1
- package/dist/utils/debounce.js +1 -2
- package/dist/utils/escape-regex.js +1 -1
- package/dist/utils/event-emitter.d.ts +2 -3
- package/dist/utils/event-emitter.js +1 -2
- package/dist/utils/event-modifiers.d.ts +4 -4
- package/dist/utils/event-modifiers.js +4 -6
- package/dist/utils/get-file-type-label.js +1 -1
- package/dist/utils/is-image.js +2 -2
- package/dist/utils/is-nullish.d.ts +1 -1
- package/dist/utils/is-plain-object.d.ts +1 -1
- package/dist/utils/is-plain-object.js +4 -1
- package/dist/utils/maybe-json-parse.d.ts +1 -1
- package/dist/utils/maybe-json-parse.js +1 -1
- package/dist/utils/maybe-json-stringify.d.ts +1 -1
- package/dist/utils/move-array-item.d.ts +1 -1
- package/dist/utils/preload-img.js +2 -1
- package/dist/utils/sleep.d.ts +1 -1
- package/dist/utils/storage-abstraction.d.ts +13 -13
- package/dist/utils/storage-abstraction.js +2 -0
- package/dist/utils/svg-circle.js +2 -1
- package/dist/utils/switch.svelte.d.ts +1 -1
- package/dist/utils/switch.svelte.js +1 -1
- package/dist/utils/throttle.d.ts +1 -1
- package/dist/utils/throttle.js +7 -8
- package/dist/utils/to-integer.d.ts +1 -1
- package/package.json +6 -2
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* maybeJsonStringify(null); // null (unchanged)
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare function maybeJsonStringify(val:
|
|
19
|
+
export declare function maybeJsonStringify(val: unknown, prettyIndent?: number | string): string | null | number | boolean | undefined;
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* moveArrayItem(['a', 'b', 'c'], 1, 1); // ['a', 'b', 'c'] (clone)
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export declare function moveArrayItem(array:
|
|
19
|
+
export declare function moveArrayItem<T>(array: T[], fromIndex: number, toIndex: number): T[];
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export function preloadImg(url, debug = false) {
|
|
15
|
-
|
|
15
|
+
if (debug)
|
|
16
|
+
console.debug(`preloading: ${url}`);
|
|
16
17
|
return new Promise((resolve, reject) => {
|
|
17
18
|
const img = new Image();
|
|
18
19
|
img.onload = () => resolve(img);
|
package/dist/utils/sleep.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class MemoryStorage {
|
|
7
7
|
#private;
|
|
8
|
-
setItem(key: string, value:
|
|
8
|
+
setItem(key: string, value: unknown): void;
|
|
9
9
|
getItem(key: string): any;
|
|
10
10
|
removeItem(key: string): void;
|
|
11
11
|
clear(): void;
|
|
@@ -27,9 +27,9 @@ export declare class MemoryStorage {
|
|
|
27
27
|
*/
|
|
28
28
|
export declare class StorageAbstraction {
|
|
29
29
|
#private;
|
|
30
|
-
constructor(storageType?: "local" | "session" | "memory", serializer?: (v:
|
|
31
|
-
set(key: string, value:
|
|
32
|
-
get(key: string):
|
|
30
|
+
constructor(storageType?: "local" | "session" | "memory", serializer?: (v: unknown) => string, deserializer?: (v: string) => unknown);
|
|
31
|
+
set(key: string, value: unknown): this;
|
|
32
|
+
get(key: string): unknown;
|
|
33
33
|
remove(key: string): boolean;
|
|
34
34
|
clear(): boolean;
|
|
35
35
|
has(key: string): boolean;
|
|
@@ -50,9 +50,9 @@ export declare class StorageAbstraction {
|
|
|
50
50
|
* theme.set('dark'); // Persists to localStorage
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
export declare function localStorageValue(key: string, initial:
|
|
54
|
-
get():
|
|
55
|
-
set(v:
|
|
53
|
+
export declare function localStorageValue<T>(key: string, initial: T): {
|
|
54
|
+
get(): T;
|
|
55
|
+
set(v: T): StorageAbstraction;
|
|
56
56
|
remove(): void;
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
@@ -68,9 +68,9 @@ export declare function localStorageValue(key: string, initial: any): {
|
|
|
68
68
|
* token.set('abc123');
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
export declare function sessionStorageValue(key: string, initial:
|
|
72
|
-
get():
|
|
73
|
-
set(v:
|
|
71
|
+
export declare function sessionStorageValue<T>(key: string, initial: T): {
|
|
72
|
+
get(): T;
|
|
73
|
+
set(v: T): StorageAbstraction;
|
|
74
74
|
remove(): void;
|
|
75
75
|
};
|
|
76
76
|
/**
|
|
@@ -82,8 +82,8 @@ export declare function sessionStorageValue(key: string, initial: any): {
|
|
|
82
82
|
* @param initial - Initial value if key doesn't exist
|
|
83
83
|
* @returns An object with `get()`, `set()`, and `remove()` methods
|
|
84
84
|
*/
|
|
85
|
-
export declare function memoryStorageValue(key: string, initial:
|
|
86
|
-
get():
|
|
87
|
-
set(v:
|
|
85
|
+
export declare function memoryStorageValue<T>(key: string, initial: T): {
|
|
86
|
+
get(): T;
|
|
87
|
+
set(v: T): StorageAbstraction;
|
|
88
88
|
remove(): void;
|
|
89
89
|
};
|
package/dist/utils/svg-circle.js
CHANGED
|
@@ -46,7 +46,8 @@ function _normalize_cls(v) {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
export function svgCircle(options = {}) {
|
|
49
|
-
|
|
49
|
+
const { strokeWidth = 10, completeness: completenessInput = 1, bgStrokeColor = "", class: classProp = "", roundedEdges = true, rotate = 0, strokeWidthRatio = 0, circleStyle, } = options ?? {};
|
|
50
|
+
let completeness = completenessInput;
|
|
50
51
|
completeness = _normalize_completness(completeness);
|
|
51
52
|
// calculate radius based on viewBox, leaving room for stroke
|
|
52
53
|
let actualStrokeWidth = strokeWidth;
|
|
@@ -34,7 +34,7 @@ export declare class SwitchState<T> {
|
|
|
34
34
|
readonly key: string;
|
|
35
35
|
readonly storageType: "memory" | "local" | "session";
|
|
36
36
|
onOff: ((data: T, self: SwitchState<T>) => void) | undefined | null;
|
|
37
|
-
constructor(key: string, initial?: boolean | null, storageType?: "memory" | "local" | "session", initialData?:
|
|
37
|
+
constructor(key: string, initial?: boolean | null, storageType?: "memory" | "local" | "session", initialData?: T | null);
|
|
38
38
|
__set(value: boolean | null, data?: T | null | undefined): void;
|
|
39
39
|
on(data?: T | null | undefined): void;
|
|
40
40
|
off(data?: T | null | undefined): void;
|
|
@@ -68,7 +68,7 @@ export class SwitchState {
|
|
|
68
68
|
if (data !== undefined)
|
|
69
69
|
this.#data = data;
|
|
70
70
|
// mirror to storage
|
|
71
|
-
this.#storage?.set({ value, data });
|
|
71
|
+
this.#storage?.set({ value, data: data ?? null });
|
|
72
72
|
// if we're closing fire (once) onOff if exists
|
|
73
73
|
if (!value) {
|
|
74
74
|
this.onOff?.(this.data, this);
|
package/dist/utils/throttle.d.ts
CHANGED
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
* // handleScroll will be called at most once every 300ms
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
export declare function throttle<T extends (...args:
|
|
20
|
+
export declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, limit: number): (...args: Parameters<T>) => void;
|
package/dist/utils/throttle.js
CHANGED
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
export function throttle(func, limit) {
|
|
21
21
|
let lastCall = 0;
|
|
22
22
|
let timeout = null;
|
|
23
|
-
let
|
|
23
|
+
let pendingCall = null;
|
|
24
24
|
return function (...args) {
|
|
25
|
-
const context = this;
|
|
26
25
|
const now = Date.now();
|
|
27
26
|
// If enough time has passed since the last call
|
|
28
27
|
if (now - lastCall >= limit) {
|
|
@@ -31,19 +30,19 @@ export function throttle(func, limit) {
|
|
|
31
30
|
timeout = null;
|
|
32
31
|
}
|
|
33
32
|
lastCall = now;
|
|
34
|
-
func.apply(
|
|
33
|
+
func.apply(this, args);
|
|
35
34
|
}
|
|
36
35
|
else {
|
|
37
|
-
// Save the latest arguments
|
|
38
|
-
|
|
36
|
+
// Save the latest arguments and context
|
|
37
|
+
pendingCall = { args, context: this };
|
|
39
38
|
// If there's no pending execution scheduled
|
|
40
39
|
if (timeout === null) {
|
|
41
40
|
timeout = setTimeout(() => {
|
|
42
41
|
lastCall = Date.now();
|
|
43
42
|
timeout = null;
|
|
44
|
-
if (
|
|
45
|
-
func.apply(context,
|
|
46
|
-
|
|
43
|
+
if (pendingCall !== null) {
|
|
44
|
+
func.apply(pendingCall.context, pendingCall.args);
|
|
45
|
+
pendingCall = null;
|
|
47
46
|
}
|
|
48
47
|
}, limit - (now - lastCall));
|
|
49
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marianmeres/stuic",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"!dist/**/*.test.*",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"svelte": "^5.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@eslint/js": "^9.39.2",
|
|
25
26
|
"@marianmeres/icons-fns": "^4.4.0",
|
|
26
27
|
"@marianmeres/random-human-readable": "^1.6.1",
|
|
27
28
|
"@sveltejs/adapter-auto": "^4.0.0",
|
|
@@ -34,6 +35,8 @@
|
|
|
34
35
|
"@tailwindcss/vite": "^4.1.18",
|
|
35
36
|
"@types/node": "^25.0.3",
|
|
36
37
|
"dotenv": "^16.6.1",
|
|
38
|
+
"eslint": "^9.39.2",
|
|
39
|
+
"globals": "^16.5.0",
|
|
37
40
|
"prettier": "^3.7.4",
|
|
38
41
|
"prettier-plugin-svelte": "^3.4.1",
|
|
39
42
|
"publint": "^0.3.16",
|
|
@@ -41,6 +44,7 @@
|
|
|
41
44
|
"svelte-check": "^4.3.5",
|
|
42
45
|
"tailwindcss": "^4.1.18",
|
|
43
46
|
"typescript": "^5.9.3",
|
|
47
|
+
"typescript-eslint": "^8.51.0",
|
|
44
48
|
"vite": "^6.4.1",
|
|
45
49
|
"vitest": "^3.2.4"
|
|
46
50
|
},
|
|
@@ -62,7 +66,7 @@
|
|
|
62
66
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
63
67
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
64
68
|
"format": "prettier --write .",
|
|
65
|
-
"lint": "prettier --check .",
|
|
69
|
+
"lint": "eslint . && prettier --check .",
|
|
66
70
|
"test": "vitest --dir src/",
|
|
67
71
|
"svelte-check": "svelte-check",
|
|
68
72
|
"svelte-package": "svelte-package"
|