tera-system-ui 0.0.2 → 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.
- 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 +90 -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.svelte +1 -67
- package/dist/components/dialog/Dialog.svelte.d.ts +1 -0
- package/dist/components/dialog/dialog.scss +58 -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/popover/Popover.d.ts +14 -0
- package/dist/components/popover/Popover.js +8 -0
- package/dist/components/popover/Popover.svelte +129 -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/side-navigation/SideNavigation.js +0 -1
- package/dist/components/side-navigation/SideNavigation.svelte +40 -20
- 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 +13 -1
- package/dist/index.js +13 -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 +38 -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tera-system-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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,26 @@
|
|
|
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
|
-
"clsx": "^2.1.1"
|
|
90
|
+
"@floating-ui/dom": "^1.6.12",
|
|
91
|
+
"@inlang/paraglide-sveltekit": "0.11.5"
|
|
72
92
|
}
|
|
73
93
|
}
|
|
@@ -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
|
-
});
|