tera-system-ui 0.0.2 → 0.0.5
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/actions/clickOutside.d.ts +6 -0
- package/dist/{components/side-navigation → actions}/clickOutside.js +3 -2
- package/dist/components/button/Button.d.ts +2 -2
- package/dist/components/button/Button.js +5 -5
- package/dist/components/button/Button.svelte +10 -8
- package/dist/components/button/Button.svelte.d.ts +3 -1
- package/dist/components/combobox/Combobox.d.ts +8 -0
- package/dist/components/combobox/Combobox.js +7 -0
- package/dist/components/combobox/Combobox.svelte +8 -0
- package/dist/components/combobox/Combobox.svelte.d.ts +3 -0
- package/dist/components/combobox/index.d.ts +1 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/command/command.d.ts +33 -0
- package/dist/components/command/command.js +512 -0
- package/dist/components/command/command.scss +73 -0
- package/dist/components/command/components/Command.svelte +120 -0
- package/dist/components/command/components/Command.svelte.d.ts +3 -0
- package/dist/components/command/components/CommandEmpty.svelte +30 -0
- package/dist/components/command/components/CommandEmpty.svelte.d.ts +3 -0
- package/dist/components/command/components/CommandGroup.svelte +110 -0
- package/dist/components/command/components/CommandGroup.svelte.d.ts +3 -0
- package/dist/components/command/components/CommandInput.svelte +93 -0
- package/dist/components/command/components/CommandInput.svelte.d.ts +7 -0
- package/dist/components/command/components/CommandItem.svelte +110 -0
- package/dist/components/command/components/CommandItem.svelte.d.ts +3 -0
- package/dist/components/command/components/CommandList.svelte +56 -0
- package/dist/components/command/components/CommandList.svelte.d.ts +5 -0
- package/dist/components/command/components/CommandLoading.svelte +29 -0
- package/dist/components/command/components/CommandLoading.svelte.d.ts +8 -0
- package/dist/components/command/components/CommandSeparator.svelte +21 -0
- package/dist/components/command/components/CommandSeparator.svelte.d.ts +3 -0
- package/dist/components/command/index.d.ts +12 -0
- package/dist/components/command/index.js +19 -0
- package/dist/components/command/types.d.ts +227 -0
- package/dist/components/command/types.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +52 -0
- package/dist/components/dialog/Dialog.js +6 -0
- package/dist/components/dialog/Dialog.svelte +71 -118
- package/dist/components/dialog/Dialog.svelte.d.ts +2 -8
- package/dist/components/dialog/dialog.scss +78 -0
- package/dist/components/icons/IconArrowBigRightFilled.svelte +10 -0
- package/dist/components/icons/IconArrowBigRightFilled.svelte.d.ts +4 -0
- package/dist/components/icons/IconBookmarkPlus.svelte +10 -0
- package/dist/components/icons/IconBookmarkPlus.svelte.d.ts +4 -0
- package/dist/components/icons/IconChevronDown.svelte +10 -0
- package/dist/components/icons/IconChevronDown.svelte.d.ts +4 -0
- package/dist/components/icons/IconCopy.svelte +10 -0
- package/dist/components/icons/IconCopy.svelte.d.ts +4 -0
- package/dist/components/icons/IconCopyCheckFilled.svelte +10 -0
- package/dist/components/icons/IconCopyCheckFilled.svelte.d.ts +4 -0
- package/dist/components/icons/IconLoader2.svelte +10 -0
- package/dist/components/icons/IconLoader2.svelte.d.ts +4 -0
- package/dist/components/icons/IconPointFilled.svelte +10 -0
- package/dist/components/icons/IconPointFilled.svelte.d.ts +4 -0
- package/dist/components/icons/IconSearch.svelte +10 -0
- package/dist/components/icons/IconSearch.svelte.d.ts +4 -0
- package/dist/components/icons/IconSwitchHorizontal.svelte +10 -0
- package/dist/components/icons/IconSwitchHorizontal.svelte.d.ts +4 -0
- package/dist/components/icons/IconSwitchVertical.svelte +10 -0
- package/dist/components/icons/IconSwitchVertical.svelte.d.ts +4 -0
- package/dist/components/icons/index.d.ts +17 -0
- package/dist/components/icons/index.js +17 -0
- package/dist/components/input/Input.d.ts +116 -0
- package/dist/components/input/Input.js +36 -0
- package/dist/components/input/Input.svelte +19 -8
- package/dist/components/input/Input.svelte.d.ts +2 -22
- package/dist/components/language-picker-button/LanguagePickerButton.svelte +13 -10
- package/dist/components/language-picker-button/LanguagePickerButton.svelte.d.ts +0 -2
- package/dist/components/light-dark-toggle/LightDarkToggle.svelte +10 -10
- package/dist/components/popover/Popover.d.ts +15 -0
- package/dist/components/popover/Popover.js +8 -0
- package/dist/components/popover/Popover.svelte +137 -0
- package/dist/components/popover/Popover.svelte.d.ts +3 -0
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/popover-responsive/PopoverResponsive.d.ts +8 -0
- package/dist/components/popover-responsive/PopoverResponsive.js +7 -0
- package/dist/components/popover-responsive/PopoverResponsive.svelte +87 -0
- package/dist/components/popover-responsive/PopoverResponsive.svelte.d.ts +11 -0
- package/dist/components/popover-responsive/index.d.ts +1 -0
- package/dist/components/popover-responsive/index.js +1 -0
- package/dist/components/side-navigation/SideNavigation.d.ts +2 -1
- package/dist/components/side-navigation/SideNavigation.js +8 -6
- package/dist/components/side-navigation/SideNavigation.svelte +44 -24
- package/dist/components/tera-ui-context/TeraUiContext.d.ts +11 -0
- package/dist/components/tera-ui-context/TeraUiContext.js +1 -0
- package/dist/components/tera-ui-context/TeraUiContext.svelte +21 -0
- package/dist/components/tera-ui-context/TeraUiContext.svelte.d.ts +3 -0
- package/dist/components/tera-ui-context/global-context.d.ts +3 -0
- package/dist/components/tera-ui-context/global-context.js +15 -0
- package/dist/components/tera-ui-context/index.d.ts +1 -0
- package/dist/components/tera-ui-context/index.js +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/language.d.ts +2 -0
- package/dist/i18n/language.js +10 -0
- package/dist/i18n.d.ts +1 -0
- package/dist/i18n.js +4 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +14 -2
- package/dist/internal/command-score.d.ts +1 -0
- package/dist/internal/command-score.js +119 -0
- package/dist/internal/helpers/callbacks.d.ts +12 -0
- package/dist/internal/helpers/callbacks.js +15 -0
- package/dist/internal/helpers/event.d.ts +14 -0
- package/dist/internal/helpers/event.js +17 -0
- package/dist/internal/helpers/id.d.ts +1 -0
- package/dist/internal/helpers/id.js +4 -0
- package/dist/internal/helpers/index.d.ts +8 -0
- package/dist/internal/helpers/index.js +8 -0
- package/dist/internal/helpers/is.d.ts +4 -0
- package/dist/internal/helpers/is.js +10 -0
- package/dist/internal/helpers/kbd.d.ts +35 -0
- package/dist/internal/helpers/kbd.js +35 -0
- package/dist/internal/helpers/object.d.ts +2 -0
- package/dist/internal/helpers/object.js +19 -0
- package/dist/internal/helpers/sleep.d.ts +1 -0
- package/dist/internal/helpers/sleep.js +3 -0
- package/dist/internal/helpers/store.d.ts +29 -0
- package/dist/internal/helpers/store.js +80 -0
- package/dist/internal/helpers/style.d.ts +12 -0
- package/dist/internal/helpers/style.js +18 -0
- package/dist/internal/index.d.ts +3 -0
- package/dist/internal/index.js +3 -0
- package/dist/internal/types.d.ts +18 -0
- package/dist/internal/types.js +1 -0
- package/dist/themes/scrollbar.scss +37 -0
- package/dist/themes/tera-ui-base.css +25 -0
- package/package.json +39 -18
- package/scripts/generate-ts-index.js +137 -0
- package/dist/components/input/input.d.ts +0 -49
- package/dist/components/input/input.js +0 -14
- package/dist/components/side-navigation/clickOutside.d.ts +0 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const isBrowser: boolean;
|
|
2
|
+
export declare function isHTMLElement(element: unknown): element is HTMLElement;
|
|
3
|
+
export declare function isHTMLInputElement(element: unknown): element is HTMLInputElement;
|
|
4
|
+
export declare function isUndefined(value: unknown): value is undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const isBrowser = typeof document !== 'undefined';
|
|
2
|
+
export function isHTMLElement(element) {
|
|
3
|
+
return element instanceof HTMLElement;
|
|
4
|
+
}
|
|
5
|
+
export function isHTMLInputElement(element) {
|
|
6
|
+
return element instanceof HTMLInputElement;
|
|
7
|
+
}
|
|
8
|
+
export function isUndefined(value) {
|
|
9
|
+
return value === undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const kbd: {
|
|
2
|
+
ALT: string;
|
|
3
|
+
ARROW_DOWN: string;
|
|
4
|
+
ARROW_LEFT: string;
|
|
5
|
+
ARROW_RIGHT: string;
|
|
6
|
+
ARROW_UP: string;
|
|
7
|
+
BACKSPACE: string;
|
|
8
|
+
CAPS_LOCK: string;
|
|
9
|
+
CONTROL: string;
|
|
10
|
+
DELETE: string;
|
|
11
|
+
END: string;
|
|
12
|
+
ENTER: string;
|
|
13
|
+
ESCAPE: string;
|
|
14
|
+
F1: string;
|
|
15
|
+
F10: string;
|
|
16
|
+
F11: string;
|
|
17
|
+
F12: string;
|
|
18
|
+
F2: string;
|
|
19
|
+
F3: string;
|
|
20
|
+
F4: string;
|
|
21
|
+
F5: string;
|
|
22
|
+
F6: string;
|
|
23
|
+
F7: string;
|
|
24
|
+
F8: string;
|
|
25
|
+
F9: string;
|
|
26
|
+
HOME: string;
|
|
27
|
+
META: string;
|
|
28
|
+
PAGE_DOWN: string;
|
|
29
|
+
PAGE_UP: string;
|
|
30
|
+
SHIFT: string;
|
|
31
|
+
SPACE: string;
|
|
32
|
+
TAB: string;
|
|
33
|
+
CTRL: string;
|
|
34
|
+
ASTERISK: string;
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const kbd = {
|
|
2
|
+
ALT: 'Alt',
|
|
3
|
+
ARROW_DOWN: 'ArrowDown',
|
|
4
|
+
ARROW_LEFT: 'ArrowLeft',
|
|
5
|
+
ARROW_RIGHT: 'ArrowRight',
|
|
6
|
+
ARROW_UP: 'ArrowUp',
|
|
7
|
+
BACKSPACE: 'Backspace',
|
|
8
|
+
CAPS_LOCK: 'CapsLock',
|
|
9
|
+
CONTROL: 'Control',
|
|
10
|
+
DELETE: 'Delete',
|
|
11
|
+
END: 'End',
|
|
12
|
+
ENTER: 'Enter',
|
|
13
|
+
ESCAPE: 'Escape',
|
|
14
|
+
F1: 'F1',
|
|
15
|
+
F10: 'F10',
|
|
16
|
+
F11: 'F11',
|
|
17
|
+
F12: 'F12',
|
|
18
|
+
F2: 'F2',
|
|
19
|
+
F3: 'F3',
|
|
20
|
+
F4: 'F4',
|
|
21
|
+
F5: 'F5',
|
|
22
|
+
F6: 'F6',
|
|
23
|
+
F7: 'F7',
|
|
24
|
+
F8: 'F8',
|
|
25
|
+
F9: 'F9',
|
|
26
|
+
HOME: 'Home',
|
|
27
|
+
META: 'Meta',
|
|
28
|
+
PAGE_DOWN: 'PageDown',
|
|
29
|
+
PAGE_UP: 'PageUp',
|
|
30
|
+
SHIFT: 'Shift',
|
|
31
|
+
SPACE: ' ',
|
|
32
|
+
TAB: 'Tab',
|
|
33
|
+
CTRL: 'Control',
|
|
34
|
+
ASTERISK: '*'
|
|
35
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function omit(obj, ...keys) {
|
|
2
|
+
const result = {};
|
|
3
|
+
for (const key of Object.keys(obj)) {
|
|
4
|
+
if (!keys.includes(key)) {
|
|
5
|
+
result[key] = obj[key];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
export function removeUndefined(obj) {
|
|
11
|
+
const result = {};
|
|
12
|
+
for (const key in obj) {
|
|
13
|
+
const value = obj[key];
|
|
14
|
+
if (value !== undefined) {
|
|
15
|
+
result[key] = value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Writable, type Stores, type StoresValues, type Readable } from 'svelte/store';
|
|
2
|
+
/**
|
|
3
|
+
* Given an object of properties, returns an object of writable stores
|
|
4
|
+
* with the same properties and values.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toWritableStores<T extends Record<string, unknown>>(properties: T): {
|
|
7
|
+
[K in keyof T]: Writable<T[K]>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A utility function that creates an effect from a set of stores and a function.
|
|
11
|
+
* The effect is automatically cleaned up when the component is destroyed.
|
|
12
|
+
*
|
|
13
|
+
* @template S - The type of the stores object
|
|
14
|
+
* @param stores - The stores object to derive from
|
|
15
|
+
* @param fn - The function to run when the stores change
|
|
16
|
+
* @returns A function that can be used to unsubscribe the effect
|
|
17
|
+
*/
|
|
18
|
+
export declare function effect<S extends Stores>(stores: S, fn: (values: StoresValues<S>) => (() => void) | void): () => void;
|
|
19
|
+
/**
|
|
20
|
+
* A utility function that creates a derived store that automatically
|
|
21
|
+
* unsubscribes from its dependencies.
|
|
22
|
+
*
|
|
23
|
+
* @template S - The type of the stores object
|
|
24
|
+
* @template T - The type of the derived store
|
|
25
|
+
* @param stores - The stores object to derive from
|
|
26
|
+
* @param fn - The function to derive the store from
|
|
27
|
+
* @returns A derived store that automatically unsubscribes from its dependencies
|
|
28
|
+
*/
|
|
29
|
+
export declare function derivedWithUnsubscribe<S extends Stores, T>(stores: S, fn: (values: StoresValues<S>, onUnsubscribe: (cb: () => void) => void) => T): Readable<T>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { derived, writable } from 'svelte/store';
|
|
2
|
+
import { onDestroy } from 'svelte';
|
|
3
|
+
/**
|
|
4
|
+
* Given an object of properties, returns an object of writable stores
|
|
5
|
+
* with the same properties and values.
|
|
6
|
+
*/
|
|
7
|
+
export function toWritableStores(properties) {
|
|
8
|
+
const result = {};
|
|
9
|
+
Object.keys(properties).forEach((key) => {
|
|
10
|
+
const propertyKey = key;
|
|
11
|
+
const value = properties[propertyKey];
|
|
12
|
+
result[propertyKey] = writable(value);
|
|
13
|
+
});
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A utility function that creates an effect from a set of stores and a function.
|
|
18
|
+
* The effect is automatically cleaned up when the component is destroyed.
|
|
19
|
+
*
|
|
20
|
+
* @template S - The type of the stores object
|
|
21
|
+
* @param stores - The stores object to derive from
|
|
22
|
+
* @param fn - The function to run when the stores change
|
|
23
|
+
* @returns A function that can be used to unsubscribe the effect
|
|
24
|
+
*/
|
|
25
|
+
export function effect(stores, fn) {
|
|
26
|
+
// Create a derived store that contains the stores object and an onUnsubscribe function
|
|
27
|
+
const unsub = derivedWithUnsubscribe(stores, (stores, onUnsubscribe) => {
|
|
28
|
+
return {
|
|
29
|
+
stores,
|
|
30
|
+
onUnsubscribe
|
|
31
|
+
};
|
|
32
|
+
}).subscribe(({ stores, onUnsubscribe }) => {
|
|
33
|
+
const returned = fn(stores);
|
|
34
|
+
// If the function returns a cleanup function, call it when the effect is unsubscribed
|
|
35
|
+
if (returned) {
|
|
36
|
+
onUnsubscribe(returned);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
// Automatically unsubscribe the effect when the component is destroyed
|
|
40
|
+
onDestroy(unsub);
|
|
41
|
+
return unsub;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A utility function that creates a derived store that automatically
|
|
45
|
+
* unsubscribes from its dependencies.
|
|
46
|
+
*
|
|
47
|
+
* @template S - The type of the stores object
|
|
48
|
+
* @template T - The type of the derived store
|
|
49
|
+
* @param stores - The stores object to derive from
|
|
50
|
+
* @param fn - The function to derive the store from
|
|
51
|
+
* @returns A derived store that automatically unsubscribes from its dependencies
|
|
52
|
+
*/
|
|
53
|
+
export function derivedWithUnsubscribe(stores, fn) {
|
|
54
|
+
let unsubscribers = [];
|
|
55
|
+
const onUnsubscribe = (cb) => {
|
|
56
|
+
unsubscribers.push(cb);
|
|
57
|
+
};
|
|
58
|
+
const unsubscribe = () => {
|
|
59
|
+
// Call all of the unsubscribe functions from the previous run of the function
|
|
60
|
+
unsubscribers.forEach((fn) => fn());
|
|
61
|
+
// Clear the list of unsubscribe functions
|
|
62
|
+
unsubscribers = [];
|
|
63
|
+
};
|
|
64
|
+
const derivedStore = derived(stores, ($storeValues) => {
|
|
65
|
+
unsubscribe();
|
|
66
|
+
return fn($storeValues, onUnsubscribe);
|
|
67
|
+
});
|
|
68
|
+
onDestroy(unsubscribe);
|
|
69
|
+
const subscribe = (...args) => {
|
|
70
|
+
const unsub = derivedStore.subscribe(...args);
|
|
71
|
+
return () => {
|
|
72
|
+
unsub();
|
|
73
|
+
unsubscribe();
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
...derivedStore,
|
|
78
|
+
subscribe
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function styleToString(style: Record<string, number | string | undefined>): string;
|
|
2
|
+
export declare const srOnlyStyles: {
|
|
3
|
+
position: string;
|
|
4
|
+
width: string;
|
|
5
|
+
height: string;
|
|
6
|
+
padding: string;
|
|
7
|
+
margin: string;
|
|
8
|
+
overflow: string;
|
|
9
|
+
clip: string;
|
|
10
|
+
whiteSpace: string;
|
|
11
|
+
borderWidth: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function styleToString(style) {
|
|
2
|
+
return Object.keys(style).reduce((str, key) => {
|
|
3
|
+
if (style[key] === undefined)
|
|
4
|
+
return str;
|
|
5
|
+
return str + `${key}:${style[key]};`;
|
|
6
|
+
}, '');
|
|
7
|
+
}
|
|
8
|
+
export const srOnlyStyles = {
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
width: '1px',
|
|
11
|
+
height: '1px',
|
|
12
|
+
padding: '0',
|
|
13
|
+
margin: '-1px',
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
16
|
+
whiteSpace: 'nowrap',
|
|
17
|
+
borderWidth: '0'
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { TransitionConfig } from 'svelte/transition';
|
|
3
|
+
export type Expand<T> = T extends object ? T extends infer O ? {
|
|
4
|
+
[K in keyof O]: O[K];
|
|
5
|
+
} : never : T;
|
|
6
|
+
export type ValueOf<T> = T[keyof T];
|
|
7
|
+
export type HTMLDivAttributes = HTMLAttributes<HTMLDivElement>;
|
|
8
|
+
export type Prettify<T> = {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
} & {};
|
|
11
|
+
export type RenameProperties<T, NewNames extends Partial<Record<keyof T, string>>> = Expand<{
|
|
12
|
+
[K in keyof T as K extends keyof NewNames ? NewNames[K] extends PropertyKey ? NewNames[K] : K : K]: T[K];
|
|
13
|
+
}>;
|
|
14
|
+
export type PrefixKeys<T, Prefix extends string> = Expand<{
|
|
15
|
+
[K in keyof T as `${Prefix}${Capitalize<string & K>}`]: T[K];
|
|
16
|
+
}>;
|
|
17
|
+
export type Transition = (node: Element, params?: any) => TransitionConfig;
|
|
18
|
+
export type Arrayable<T> = T | T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* Light mode scrollbar styles */
|
|
2
|
+
::-webkit-scrollbar {
|
|
3
|
+
width: 8px;
|
|
4
|
+
height: 8px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
::-webkit-scrollbar-track {
|
|
8
|
+
background: transparent; /* Transparent track */
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
::-webkit-scrollbar-thumb {
|
|
12
|
+
background-color: rgba(0, 0, 0, 0.2); /* Light mode: dark thumb */
|
|
13
|
+
border-radius: 10px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
::-webkit-scrollbar-thumb:hover {
|
|
17
|
+
background-color: rgba(0, 0, 0, 0.4); /* Darker thumb on hover */
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Dark mode scrollbar styles */
|
|
21
|
+
.dark ::-webkit-scrollbar-thumb {
|
|
22
|
+
background-color: rgba(255, 255, 255, 0.2); /* Dark mode: light thumb */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dark ::-webkit-scrollbar-thumb:hover {
|
|
26
|
+
background-color: rgba(255, 255, 255, 0.4); /* Lighter thumb on hover */
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Firefox scrollbar styling */
|
|
30
|
+
* {
|
|
31
|
+
scrollbar-width: thin;
|
|
32
|
+
scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
html.dark, .dark * {
|
|
36
|
+
scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
|
|
37
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
@import "scrollbar.scss";
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
:root {
|
|
2
5
|
--border-radius-base: 0.25rem;
|
|
3
6
|
--border-radius-container: 0.5rem;
|
|
@@ -147,3 +150,25 @@
|
|
|
147
150
|
:root {
|
|
148
151
|
}
|
|
149
152
|
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
.ripple {
|
|
156
|
+
position: absolute;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
transform: scale(0);
|
|
159
|
+
animation: ripple-animation 1s ease-out;
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@keyframes ripple-animation {
|
|
164
|
+
to {
|
|
165
|
+
transform: scale(4);
|
|
166
|
+
opacity: 0;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
body {
|
|
171
|
+
background: theme(colors.neutral.token.1);
|
|
172
|
+
color: theme(colors.neutral.token.13);
|
|
173
|
+
}
|
|
174
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tera-system-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run package",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"build-storybook": "storybook build"
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
|
-
"
|
|
16
|
+
"ui": "./scripts/add-component-template.js",
|
|
17
|
+
"gen": "./scripts/generate-ts-index.js"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"dist",
|
|
@@ -32,13 +33,30 @@
|
|
|
32
33
|
"svelte": "./dist/index.js",
|
|
33
34
|
"default": "./dist/index.js"
|
|
34
35
|
},
|
|
35
|
-
"./
|
|
36
|
+
"./i18n": {
|
|
37
|
+
"types": "./dist/i18n/index.d.ts",
|
|
38
|
+
"svelte": "./dist/i18n/index.js",
|
|
39
|
+
"default": "./dist/i18n/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./icons": {
|
|
42
|
+
"types": "./dist/components/icons/index.d.ts",
|
|
43
|
+
"svelte": "./dist/components/icons/index.js",
|
|
44
|
+
"default": "./dist/components/icons/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./command": {
|
|
47
|
+
"types": "./dist/components/command/index.d.ts",
|
|
48
|
+
"svelte": "./dist/components/command/index.js",
|
|
49
|
+
"default": "./dist/components/command/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./themes/tw-preset": "./dist/themes/tw-preset.cjs",
|
|
52
|
+
"./themes/tera-ui-base": "./dist/themes/tera-ui-base.css"
|
|
36
53
|
},
|
|
37
54
|
"peerDependencies": {
|
|
38
55
|
"svelte": "^5.0.0"
|
|
39
56
|
},
|
|
40
57
|
"devDependencies": {
|
|
41
|
-
"@chromatic-com/storybook": "^
|
|
58
|
+
"@chromatic-com/storybook": "^3.2.1",
|
|
59
|
+
"@inlang/paraglide-js": "1.11.3",
|
|
42
60
|
"@storybook/addon-essentials": "^8.3.6",
|
|
43
61
|
"@storybook/addon-interactions": "^8.3.6",
|
|
44
62
|
"@storybook/addon-links": "^8.3.6",
|
|
@@ -50,24 +68,27 @@
|
|
|
50
68
|
"@storybook/svelte": "^8.3.6",
|
|
51
69
|
"@storybook/sveltekit": "^8.3.6",
|
|
52
70
|
"@storybook/test": "^8.3.6",
|
|
53
|
-
"@sveltejs/adapter-auto": "^3.
|
|
54
|
-
"@sveltejs/kit": "^2.
|
|
55
|
-
"@sveltejs/package": "^2.
|
|
71
|
+
"@sveltejs/adapter-auto": "^3.3.1",
|
|
72
|
+
"@sveltejs/kit": "^2.7.3",
|
|
73
|
+
"@sveltejs/package": "^2.3.7",
|
|
56
74
|
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
|
75
|
+
"@tabler/icons-svelte": "^3.21.0",
|
|
57
76
|
"autoprefixer": "^10.4.20",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
77
|
+
"clsx": "^2.1.1",
|
|
78
|
+
"npx": "^10.2.2",
|
|
79
|
+
"publint": "^0.2.12",
|
|
80
|
+
"sass-embedded": "^1.80.5",
|
|
60
81
|
"storybook": "^8.3.6",
|
|
61
|
-
"svelte": "^5.
|
|
62
|
-
"svelte-check": "^4.0.
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
82
|
+
"svelte": "^5.1.6",
|
|
83
|
+
"svelte-check": "^4.0.5",
|
|
84
|
+
"tailwind-variants": "^0.2.1",
|
|
85
|
+
"tailwindcss": "^3.4.14",
|
|
86
|
+
"typescript": "^5.6.3",
|
|
87
|
+
"vite": "^5.4.10"
|
|
67
88
|
},
|
|
68
89
|
"dependencies": {
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
71
|
-
"
|
|
90
|
+
"@floating-ui/dom": "^1.6.12",
|
|
91
|
+
"@inlang/paraglide-sveltekit": "0.11.5",
|
|
92
|
+
"@tabler/icons-svelte": "^3.21.0"
|
|
72
93
|
}
|
|
73
94
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Recursively finds all "index.ts" files in the given folder path.
|
|
8
|
+
* @param {string} folderPath - The root directory to start the search.
|
|
9
|
+
* @returns {Array} - List of objects containing `filePath` and `content` of each "index.ts" file.
|
|
10
|
+
*/
|
|
11
|
+
function findIndexFiles(folderPath) {
|
|
12
|
+
const result = [];
|
|
13
|
+
|
|
14
|
+
function searchFolder(currentPath) {
|
|
15
|
+
const filesAndDirs = fs.readdirSync(currentPath);
|
|
16
|
+
|
|
17
|
+
for (const item of filesAndDirs) {
|
|
18
|
+
const itemPath = path.join(currentPath, item);
|
|
19
|
+
const stats = fs.statSync(itemPath);
|
|
20
|
+
|
|
21
|
+
if (stats.isDirectory()) {
|
|
22
|
+
// Recursively search in subdirectories
|
|
23
|
+
searchFolder(itemPath);
|
|
24
|
+
} else if (item === "index.ts") {
|
|
25
|
+
// Read file content if the file is "index.ts"
|
|
26
|
+
const content = fs.readFileSync(itemPath, "utf-8");
|
|
27
|
+
result.push({filePath: itemPath, content});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
searchFolder(folderPath);
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Extracts export names from a given JavaScript file content.
|
|
39
|
+
* @param {string} filePath - The path to the JavaScript file.
|
|
40
|
+
* @returns {Array} - An array of export names.
|
|
41
|
+
*/
|
|
42
|
+
function extractExportNames(filePath) {
|
|
43
|
+
const fileContent = fs.readFileSync(filePath, "utf-8");
|
|
44
|
+
const exportNames = [];
|
|
45
|
+
|
|
46
|
+
// Regular expressions to match the export names
|
|
47
|
+
const defaultExportRegex = /export\s*{\s*default\s+as\s+(\w+)/g;
|
|
48
|
+
const namedExportRegex = /export\s*{(\w+)\s*}/g;
|
|
49
|
+
|
|
50
|
+
let match;
|
|
51
|
+
|
|
52
|
+
// Find all matches for `export { default as ... }`
|
|
53
|
+
while ((match = defaultExportRegex.exec(fileContent)) !== null) {
|
|
54
|
+
exportNames.push(match[1]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Find all matches for `export { namedExport }`
|
|
58
|
+
while ((match = namedExportRegex.exec(fileContent)) !== null) {
|
|
59
|
+
exportNames.push(match[1]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return exportNames;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Recursively finds all files in a given folder path that match the name pattern.
|
|
68
|
+
* @param {string} folderPath - The root directory to start the search.
|
|
69
|
+
* @param {RegExp} namePattern - The regular expression pattern to match file names.
|
|
70
|
+
* @returns {Array} - List of file names that match the pattern.
|
|
71
|
+
*/
|
|
72
|
+
function findFilesByPattern(folderPath, namePattern) {
|
|
73
|
+
const result = [];
|
|
74
|
+
|
|
75
|
+
function searchFolder(currentPath) {
|
|
76
|
+
const filesAndDirs = fs.readdirSync(currentPath);
|
|
77
|
+
|
|
78
|
+
for (const item of filesAndDirs) {
|
|
79
|
+
const itemPath = path.join(currentPath, item);
|
|
80
|
+
const stats = fs.statSync(itemPath);
|
|
81
|
+
|
|
82
|
+
if (stats.isDirectory()) {
|
|
83
|
+
// Recursively search in subdirectories
|
|
84
|
+
searchFolder(itemPath);
|
|
85
|
+
} else if (namePattern.test(item)) {
|
|
86
|
+
// If the file name matches the pattern, add to result
|
|
87
|
+
result.push(item);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
searchFolder(folderPath);
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const GLOBAL_INDEX_PATH = "../src/lib/index.ts"
|
|
97
|
+
const COMPONENTS_PATH = "../src/lib/components"
|
|
98
|
+
const ICON_COMPONENTS_PATH = "../src/lib/components/icons"
|
|
99
|
+
|
|
100
|
+
const iconComponentsFileList = findFilesByPattern(ICON_COMPONENTS_PATH, /^Icon\w*\.svelte$/);
|
|
101
|
+
|
|
102
|
+
// generate icon index
|
|
103
|
+
const importSvelteComponentTemplate = `export {default as Component} from './Component.svelte'`;
|
|
104
|
+
const importComponentTemplate = `export {Component} from 'path'`;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
(() => {
|
|
108
|
+
let content = ''
|
|
109
|
+
iconComponentsFileList.forEach(file => {
|
|
110
|
+
let componentName = file.replace('.svelte', '')
|
|
111
|
+
content += importSvelteComponentTemplate.replaceAll('Component', componentName);
|
|
112
|
+
content += `\n`
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
fs.writeFileSync(ICON_COMPONENTS_PATH + '/index.ts', content, 'utf8');
|
|
116
|
+
})();
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
(() => {
|
|
120
|
+
const indexFileList = findIndexFiles(COMPONENTS_PATH);
|
|
121
|
+
let content = ''
|
|
122
|
+
|
|
123
|
+
indexFileList.forEach(file => {
|
|
124
|
+
let components = extractExportNames(file.filePath)
|
|
125
|
+
if (components.length === 0) return
|
|
126
|
+
|
|
127
|
+
let importFromPath = './components/' + file.filePath.split(`\\components\\`)[1].replace('\\index.ts', '');
|
|
128
|
+
|
|
129
|
+
content += importComponentTemplate.replace('path', importFromPath)
|
|
130
|
+
.replace('Component', components.join(', '));
|
|
131
|
+
content += '\n';
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
console.log(content)
|
|
135
|
+
fs.writeFileSync(GLOBAL_INDEX_PATH, content, 'utf8');
|
|
136
|
+
|
|
137
|
+
})()
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type VariantProps } from "tailwind-variants";
|
|
2
|
-
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
3
|
-
size: {
|
|
4
|
-
sm: string;
|
|
5
|
-
md: string;
|
|
6
|
-
lg: string;
|
|
7
|
-
};
|
|
8
|
-
}, undefined, "border rounded focus:outline-none focus:ring-2 transition-shadow", import("tailwind-variants/dist/config").TVConfig<{
|
|
9
|
-
size: {
|
|
10
|
-
sm: string;
|
|
11
|
-
md: string;
|
|
12
|
-
lg: string;
|
|
13
|
-
};
|
|
14
|
-
}, {
|
|
15
|
-
size: {
|
|
16
|
-
sm: string;
|
|
17
|
-
md: string;
|
|
18
|
-
lg: string;
|
|
19
|
-
};
|
|
20
|
-
}>, {
|
|
21
|
-
size: {
|
|
22
|
-
sm: string;
|
|
23
|
-
md: string;
|
|
24
|
-
lg: string;
|
|
25
|
-
};
|
|
26
|
-
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
27
|
-
size: {
|
|
28
|
-
sm: string;
|
|
29
|
-
md: string;
|
|
30
|
-
lg: string;
|
|
31
|
-
};
|
|
32
|
-
}, undefined, "border rounded focus:outline-none focus:ring-2 transition-shadow", import("tailwind-variants/dist/config").TVConfig<{
|
|
33
|
-
size: {
|
|
34
|
-
sm: string;
|
|
35
|
-
md: string;
|
|
36
|
-
lg: string;
|
|
37
|
-
};
|
|
38
|
-
}, {
|
|
39
|
-
size: {
|
|
40
|
-
sm: string;
|
|
41
|
-
md: string;
|
|
42
|
-
lg: string;
|
|
43
|
-
};
|
|
44
|
-
}>, unknown, unknown, undefined>>;
|
|
45
|
-
type InputVariants = VariantProps<typeof styles>;
|
|
46
|
-
export interface InputProps extends InputVariants {
|
|
47
|
-
children: any;
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { tv } from "tailwind-variants";
|
|
2
|
-
export const styles = tv({
|
|
3
|
-
base: 'border rounded focus:outline-none focus:ring-2 transition-shadow', // Base styles
|
|
4
|
-
variants: {
|
|
5
|
-
size: {
|
|
6
|
-
sm: 'px-2 py-1 text-sm', // Small size styles
|
|
7
|
-
md: 'px-3 py-2 text-base', // Medium size styles
|
|
8
|
-
lg: 'px-4 py-3 text-lg', // Large size styles
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
defaultVariants: {
|
|
12
|
-
size: 'md',
|
|
13
|
-
},
|
|
14
|
-
});
|