tera-system-ui 0.0.1 → 0.0.3

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.
Files changed (127) hide show
  1. package/dist/actions/clickOutside.d.ts +6 -0
  2. package/dist/{components/side-navigation → actions}/clickOutside.js +3 -2
  3. package/dist/components/button/Button.d.ts +2 -2
  4. package/dist/components/button/Button.js +5 -5
  5. package/dist/components/button/Button.svelte +10 -8
  6. package/dist/components/button/Button.svelte.d.ts +3 -1
  7. package/dist/components/combobox/Combobox.d.ts +8 -0
  8. package/dist/components/combobox/Combobox.js +7 -0
  9. package/dist/components/combobox/Combobox.svelte +8 -0
  10. package/dist/components/combobox/Combobox.svelte.d.ts +3 -0
  11. package/dist/components/combobox/index.d.ts +1 -0
  12. package/dist/components/combobox/index.js +1 -0
  13. package/dist/components/command/command.d.ts +33 -0
  14. package/dist/components/command/command.js +512 -0
  15. package/dist/components/command/command.scss +73 -0
  16. package/dist/components/command/components/Command.svelte +120 -0
  17. package/dist/components/command/components/Command.svelte.d.ts +3 -0
  18. package/dist/components/command/components/CommandEmpty.svelte +30 -0
  19. package/dist/components/command/components/CommandEmpty.svelte.d.ts +3 -0
  20. package/dist/components/command/components/CommandGroup.svelte +110 -0
  21. package/dist/components/command/components/CommandGroup.svelte.d.ts +3 -0
  22. package/dist/components/command/components/CommandInput.svelte +90 -0
  23. package/dist/components/command/components/CommandInput.svelte.d.ts +7 -0
  24. package/dist/components/command/components/CommandItem.svelte +110 -0
  25. package/dist/components/command/components/CommandItem.svelte.d.ts +3 -0
  26. package/dist/components/command/components/CommandList.svelte +56 -0
  27. package/dist/components/command/components/CommandList.svelte.d.ts +5 -0
  28. package/dist/components/command/components/CommandLoading.svelte +29 -0
  29. package/dist/components/command/components/CommandLoading.svelte.d.ts +8 -0
  30. package/dist/components/command/components/CommandSeparator.svelte +21 -0
  31. package/dist/components/command/components/CommandSeparator.svelte.d.ts +3 -0
  32. package/dist/components/command/index.d.ts +12 -0
  33. package/dist/components/command/index.js +19 -0
  34. package/dist/components/command/types.d.ts +227 -0
  35. package/dist/components/command/types.js +1 -0
  36. package/dist/components/dialog/Dialog.svelte +1 -67
  37. package/dist/components/dialog/Dialog.svelte.d.ts +1 -0
  38. package/dist/components/dialog/dialog.scss +58 -0
  39. package/dist/components/icons/IconArrowBigRightFilled.svelte +10 -0
  40. package/dist/components/icons/IconArrowBigRightFilled.svelte.d.ts +4 -0
  41. package/dist/components/icons/IconBookmarkPlus.svelte +10 -0
  42. package/dist/components/icons/IconBookmarkPlus.svelte.d.ts +4 -0
  43. package/dist/components/icons/IconChevronDown.svelte +10 -0
  44. package/dist/components/icons/IconChevronDown.svelte.d.ts +4 -0
  45. package/dist/components/icons/IconCopy.svelte +10 -0
  46. package/dist/components/icons/IconCopy.svelte.d.ts +4 -0
  47. package/dist/components/icons/IconCopyCheckFilled.svelte +10 -0
  48. package/dist/components/icons/IconCopyCheckFilled.svelte.d.ts +4 -0
  49. package/dist/components/icons/IconLoader2.svelte +10 -0
  50. package/dist/components/icons/IconLoader2.svelte.d.ts +4 -0
  51. package/dist/components/icons/IconPointFilled.svelte +10 -0
  52. package/dist/components/icons/IconPointFilled.svelte.d.ts +4 -0
  53. package/dist/components/icons/IconSearch.svelte +10 -0
  54. package/dist/components/icons/IconSearch.svelte.d.ts +4 -0
  55. package/dist/components/icons/IconSwitchHorizontal.svelte +10 -0
  56. package/dist/components/icons/IconSwitchHorizontal.svelte.d.ts +4 -0
  57. package/dist/components/icons/IconSwitchVertical.svelte +10 -0
  58. package/dist/components/icons/IconSwitchVertical.svelte.d.ts +4 -0
  59. package/dist/components/icons/index.d.ts +17 -0
  60. package/dist/components/icons/index.js +17 -0
  61. package/dist/components/input/Input.d.ts +116 -0
  62. package/dist/components/input/Input.js +36 -0
  63. package/dist/components/input/Input.svelte +19 -8
  64. package/dist/components/input/Input.svelte.d.ts +2 -22
  65. package/dist/components/language-picker-button/LanguagePickerButton.svelte +13 -10
  66. package/dist/components/language-picker-button/LanguagePickerButton.svelte.d.ts +0 -2
  67. package/dist/components/popover/Popover.d.ts +14 -0
  68. package/dist/components/popover/Popover.js +8 -0
  69. package/dist/components/popover/Popover.svelte +129 -0
  70. package/dist/components/popover/Popover.svelte.d.ts +3 -0
  71. package/dist/components/popover/index.d.ts +1 -0
  72. package/dist/components/popover/index.js +1 -0
  73. package/dist/components/side-navigation/SideNavigation.js +0 -1
  74. package/dist/components/side-navigation/SideNavigation.svelte +40 -20
  75. package/dist/components/tera-ui-context/TeraUiContext.d.ts +11 -0
  76. package/dist/components/tera-ui-context/TeraUiContext.js +1 -0
  77. package/dist/components/tera-ui-context/TeraUiContext.svelte +21 -0
  78. package/dist/components/tera-ui-context/TeraUiContext.svelte.d.ts +3 -0
  79. package/dist/components/tera-ui-context/global-context.d.ts +3 -0
  80. package/dist/components/tera-ui-context/global-context.js +15 -0
  81. package/dist/components/tera-ui-context/index.d.ts +1 -0
  82. package/dist/components/tera-ui-context/index.js +1 -0
  83. package/dist/i18n/index.d.ts +1 -0
  84. package/dist/i18n/index.js +1 -0
  85. package/dist/i18n/language.d.ts +2 -0
  86. package/dist/i18n/language.js +10 -0
  87. package/dist/i18n.d.ts +1 -0
  88. package/dist/i18n.js +4 -0
  89. package/dist/index.d.ts +13 -1
  90. package/dist/index.js +13 -2
  91. package/dist/internal/command-score.d.ts +1 -0
  92. package/dist/internal/command-score.js +119 -0
  93. package/dist/internal/helpers/callbacks.d.ts +12 -0
  94. package/dist/internal/helpers/callbacks.js +15 -0
  95. package/dist/internal/helpers/event.d.ts +14 -0
  96. package/dist/internal/helpers/event.js +17 -0
  97. package/dist/internal/helpers/id.d.ts +1 -0
  98. package/dist/internal/helpers/id.js +4 -0
  99. package/dist/internal/helpers/index.d.ts +8 -0
  100. package/dist/internal/helpers/index.js +8 -0
  101. package/dist/internal/helpers/is.d.ts +4 -0
  102. package/dist/internal/helpers/is.js +10 -0
  103. package/dist/internal/helpers/kbd.d.ts +35 -0
  104. package/dist/internal/helpers/kbd.js +35 -0
  105. package/dist/internal/helpers/object.d.ts +2 -0
  106. package/dist/internal/helpers/object.js +19 -0
  107. package/dist/internal/helpers/sleep.d.ts +1 -0
  108. package/dist/internal/helpers/sleep.js +3 -0
  109. package/dist/internal/helpers/store.d.ts +29 -0
  110. package/dist/internal/helpers/store.js +80 -0
  111. package/dist/internal/helpers/style.d.ts +12 -0
  112. package/dist/internal/helpers/style.js +18 -0
  113. package/dist/internal/index.d.ts +3 -0
  114. package/dist/internal/index.js +3 -0
  115. package/dist/internal/types.d.ts +18 -0
  116. package/dist/internal/types.js +1 -0
  117. package/dist/themes/index.d.ts +1 -0
  118. package/dist/themes/index.js +1 -0
  119. package/dist/themes/scrollbar.scss +37 -0
  120. package/dist/themes/tera-ui-base.css +174 -0
  121. package/dist/themes/tw-preset.cjs +151 -0
  122. package/dist/themes/tw-preset.d.cts +149 -0
  123. package/package.json +41 -19
  124. package/scripts/generate-ts-index.js +137 -0
  125. package/dist/components/input/input.d.ts +0 -49
  126. package/dist/components/input/input.js +0 -14
  127. package/dist/components/side-navigation/clickOutside.d.ts +0 -4
package/dist/index.js CHANGED
@@ -1,2 +1,13 @@
1
- "use strict";
2
- // Reexport your entry components here
1
+ export { BrandLogo } from './components/brand-logo';
2
+ export { Button } from './components/button';
3
+ export { Combobox } from './components/combobox';
4
+ export { Command } from './components/command';
5
+ export { Dialog } from './components/dialog';
6
+ export { Header } from './components/header';
7
+ export { IconArrowBigRightFilled, IconBook, IconBookmarkPlus, IconCalculator, IconCheck, IconChevronDown, IconCopy, IconCopyCheckFilled, IconHamburger, IconLanguage, IconLoader2, IconMoon, IconPointFilled, IconSearch, IconSun, IconSwitchHorizontal, IconSwitchVertical, IconTransform, IconX } from './components/icons';
8
+ export { Input } from './components/input';
9
+ export { LanguagePickerButton } from './components/language-picker-button';
10
+ export { LightDarkToggle } from './components/light-dark-toggle';
11
+ export { Popover } from './components/popover';
12
+ export { SideNavigation, SideNavigationLayout, toggleSideNavigation } from './components/side-navigation';
13
+ export { TeraUiContext } from './components/tera-ui-context';
@@ -0,0 +1 @@
1
+ export declare function commandScore(string: string, abbreviation: string): number;
@@ -0,0 +1,119 @@
1
+ // The scores are arranged so that a continuous match of characters will
2
+ // result in a total score of 1.
3
+ //
4
+ // The best case, this character is a match, and either this is the start
5
+ // of the string, or the previous character was also a match.
6
+ const SCORE_CONTINUE_MATCH = 1,
7
+ // A new match at the start of a word scores better than a new match
8
+ // elsewhere as it's more likely that the user will type the starts
9
+ // of fragments.
10
+ // NOTE: We score word jumps between spaces slightly higher than slashes, brackets
11
+ // hyphens, etc.
12
+ SCORE_SPACE_WORD_JUMP = 0.9, SCORE_NON_SPACE_WORD_JUMP = 0.8,
13
+ // Any other match isn't ideal, but we include it for completeness.
14
+ SCORE_CHARACTER_JUMP = 0.17,
15
+ // If the user transposed two letters, it should be significantly penalized.
16
+ //
17
+ // i.e. "ouch" is more likely than "curtain" when "uc" is typed.
18
+ SCORE_TRANSPOSITION = 0.1,
19
+ // The goodness of a match should decay slightly with each missing
20
+ // character.
21
+ //
22
+ // i.e. "bad" is more likely than "bard" when "bd" is typed.
23
+ //
24
+ // This will not change the order of suggestions based on SCORE_* until
25
+ // 100 characters are inserted between matches.
26
+ PENALTY_SKIPPED = 0.999,
27
+ // The goodness of an exact-case match should be higher than a
28
+ // case-insensitive match by a small amount.
29
+ //
30
+ // i.e. "HTML" is more likely than "haml" when "HM" is typed.
31
+ //
32
+ // This will not change the order of suggestions based on SCORE_* until
33
+ // 1000 characters are inserted between matches.
34
+ PENALTY_CASE_MISMATCH = 0.9999,
35
+ // If the word has more characters than the user typed, it should
36
+ // be penalised slightly.
37
+ //
38
+ // i.e. "html" is more likely than "html5" if I type "html".
39
+ //
40
+ // However, it may well be the case that there's a sensible secondary
41
+ // ordering (like alphabetical) that it makes sense to rely on when
42
+ // there are many prefix matches, so we don't make the penalty increase
43
+ // with the number of tokens.
44
+ PENALTY_NOT_COMPLETE = 0.99;
45
+ const IS_GAP_REGEXP = /[\\/_+.#"@[({&]/, COUNT_GAPS_REGEXP = /[\\/_+.#"@[({&]/g, IS_SPACE_REGEXP = /[\s-]/, COUNT_SPACE_REGEXP = /[\s-]/g;
46
+ function commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, stringIndex, abbreviationIndex, memoizedResults) {
47
+ if (abbreviationIndex === abbreviation.length) {
48
+ if (stringIndex === string.length) {
49
+ return SCORE_CONTINUE_MATCH;
50
+ }
51
+ return PENALTY_NOT_COMPLETE;
52
+ }
53
+ const memoizeKey = `${stringIndex},${abbreviationIndex}`;
54
+ if (memoizedResults[memoizeKey] !== undefined) {
55
+ return memoizedResults[memoizeKey];
56
+ }
57
+ const abbreviationChar = lowerAbbreviation.charAt(abbreviationIndex);
58
+ let index = lowerString.indexOf(abbreviationChar, stringIndex);
59
+ let highScore = 0;
60
+ let score, transposedScore, wordBreaks, spaceBreaks;
61
+ while (index >= 0) {
62
+ score = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 1, memoizedResults);
63
+ if (score > highScore) {
64
+ if (index === stringIndex) {
65
+ score *= SCORE_CONTINUE_MATCH;
66
+ }
67
+ else if (IS_GAP_REGEXP.test(string.charAt(index - 1))) {
68
+ score *= SCORE_NON_SPACE_WORD_JUMP;
69
+ wordBreaks = string.slice(stringIndex, index - 1).match(COUNT_GAPS_REGEXP);
70
+ if (wordBreaks && stringIndex > 0) {
71
+ score *= Math.pow(PENALTY_SKIPPED, wordBreaks.length);
72
+ }
73
+ }
74
+ else if (IS_SPACE_REGEXP.test(string.charAt(index - 1))) {
75
+ score *= SCORE_SPACE_WORD_JUMP;
76
+ spaceBreaks = string.slice(stringIndex, index - 1).match(COUNT_SPACE_REGEXP);
77
+ if (spaceBreaks && stringIndex > 0) {
78
+ score *= Math.pow(PENALTY_SKIPPED, spaceBreaks.length);
79
+ }
80
+ }
81
+ else {
82
+ score *= SCORE_CHARACTER_JUMP;
83
+ if (stringIndex > 0) {
84
+ score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
85
+ }
86
+ }
87
+ if (string.charAt(index) !== abbreviation.charAt(abbreviationIndex)) {
88
+ score *= PENALTY_CASE_MISMATCH;
89
+ }
90
+ }
91
+ if ((score < SCORE_TRANSPOSITION &&
92
+ lowerString.charAt(index - 1) === lowerAbbreviation.charAt(abbreviationIndex + 1)) ||
93
+ (lowerAbbreviation.charAt(abbreviationIndex + 1) ===
94
+ lowerAbbreviation.charAt(abbreviationIndex) && // allow duplicate letters. Ref #7428
95
+ lowerString.charAt(index - 1) !== lowerAbbreviation.charAt(abbreviationIndex))) {
96
+ transposedScore = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 2, memoizedResults);
97
+ if (transposedScore * SCORE_TRANSPOSITION > score) {
98
+ score = transposedScore * SCORE_TRANSPOSITION;
99
+ }
100
+ }
101
+ if (score > highScore) {
102
+ highScore = score;
103
+ }
104
+ index = lowerString.indexOf(abbreviationChar, index + 1);
105
+ }
106
+ memoizedResults[memoizeKey] = highScore;
107
+ return highScore;
108
+ }
109
+ function formatInput(string) {
110
+ // convert all valid space characters to space so they match each other
111
+ return string.toLowerCase().replace(COUNT_SPACE_REGEXP, ' ');
112
+ }
113
+ export function commandScore(string, abbreviation) {
114
+ /* NOTE:
115
+ * in the original, we used to do the lower-casing on each recursive call, but this meant that toLowerCase()
116
+ * was the dominating cost in the algorithm, passing both is a little ugly, but considerably faster.
117
+ */
118
+ return commandScoreInner(string, abbreviation, formatInput(string), formatInput(abbreviation), 0, 0, {});
119
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A callback function that takes an array of arguments of type `T` and returns `void`.
3
+ * @template T The types of the arguments that the callback function takes.
4
+ */
5
+ export type Callback<T extends unknown[] = unknown[]> = (...args: T) => void;
6
+ /**
7
+ * Executes an array of callback functions with the same arguments.
8
+ * @template T The types of the arguments that the callback functions take.
9
+ * @param n array of callback functions to execute.
10
+ * @returns A new function that executes all of the original callback functions with the same arguments.
11
+ */
12
+ export declare function executeCallbacks<T extends unknown[]>(...callbacks: Array<Callback<T>>): (...args: T) => void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Executes an array of callback functions with the same arguments.
3
+ * @template T The types of the arguments that the callback functions take.
4
+ * @param n array of callback functions to execute.
5
+ * @returns A new function that executes all of the original callback functions with the same arguments.
6
+ */
7
+ export function executeCallbacks(...callbacks) {
8
+ return (...args) => {
9
+ for (const callback of callbacks) {
10
+ if (typeof callback === 'function') {
11
+ callback(...args);
12
+ }
13
+ }
14
+ };
15
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A type alias for a general event listener function.
3
+ *
4
+ * @template E - The type of event to listen for
5
+ * @param evt - The event object
6
+ * @returns The return value of the event listener function
7
+ */
8
+ export type GeneralEventListener<E = Event> = (evt: E) => unknown;
9
+ /**
10
+ * Overloaded function signatures for addEventListener
11
+ */
12
+ export declare function addEventListener<E extends keyof HTMLElementEventMap>(target: Window, event: E, handler: (this: Window, ev: HTMLElementEventMap[E]) => unknown, options?: boolean | AddEventListenerOptions): VoidFunction;
13
+ export declare function addEventListener<E extends keyof HTMLElementEventMap>(target: Document, event: E, handler: (this: Document, ev: HTMLElementEventMap[E]) => unknown, options?: boolean | AddEventListenerOptions): VoidFunction;
14
+ export declare function addEventListener<E extends keyof HTMLElementEventMap>(target: EventTarget, event: E, handler: GeneralEventListener<HTMLElementEventMap[E]>, options?: boolean | AddEventListenerOptions): VoidFunction;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Adds an event listener to the specified target element(s) for the given event(s), and returns a function to remove it.
3
+ * @param target The target element(s) to add the event listener to.
4
+ * @param event The event(s) to listen for.
5
+ * @param handler The function to be called when the event is triggered.
6
+ * @param options An optional object that specifies characteristics about the event listener.
7
+ * @returns A function that removes the event listener from the target element(s).
8
+ */
9
+ export function addEventListener(target, event, handler, options) {
10
+ const events = Array.isArray(event) ? event : [event];
11
+ // Add the event listener to each specified event for the target element(s).
12
+ events.forEach((_event) => target.addEventListener(_event, handler, options));
13
+ // Return a function that removes the event listener from the target element(s).
14
+ return () => {
15
+ events.forEach((_event) => target.removeEventListener(_event, handler, options));
16
+ };
17
+ }
@@ -0,0 +1 @@
1
+ export declare function generateId(): string;
@@ -0,0 +1,4 @@
1
+ import { nanoid } from 'nanoid/non-secure';
2
+ export function generateId() {
3
+ return nanoid(10);
4
+ }
@@ -0,0 +1,8 @@
1
+ export * from './is.js';
2
+ export * from './id.js';
3
+ export * from './kbd.js';
4
+ export * from './object.js';
5
+ export * from './store.js';
6
+ export * from './style.js';
7
+ export * from './event.js';
8
+ export * from './callbacks.js';
@@ -0,0 +1,8 @@
1
+ export * from './is.js';
2
+ export * from './id.js';
3
+ export * from './kbd.js';
4
+ export * from './object.js';
5
+ export * from './store.js';
6
+ export * from './style.js';
7
+ export * from './event.js';
8
+ export * from './callbacks.js';
@@ -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,2 @@
1
+ export declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
2
+ export declare function removeUndefined<T extends object>(obj: T): T;
@@ -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,3 @@
1
+ export function sleep(ms) {
2
+ return new Promise((resolve) => setTimeout(resolve, ms));
3
+ }
@@ -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,3 @@
1
+ export * from './command-score.js';
2
+ export * from './helpers/index.js';
3
+ export * from './types.js';
@@ -0,0 +1,3 @@
1
+ export * from './command-score.js';
2
+ export * from './helpers/index.js';
3
+ export * from './types.js';
@@ -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 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";
@@ -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
+ }