rxn-ui 0.4.2 → 0.4.4

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/cli/index.mjs CHANGED
@@ -1,119 +1,91 @@
1
- #!/usr/bin/env node // Указывает системе запускать файл через Node.js (CLI-скрипт)
2
-
3
- import fs from 'node:fs'
4
- import path from 'node:path'
5
- import process from 'node:process'
6
- import { fileURLToPath } from 'node:url'
7
-
8
- const __filename = fileURLToPath(import.meta.url) // Получаем абсолютный путь к текущему файлу (аналог __filename)
9
- const __dirname = path.dirname(__filename) // Получаем директорию текущего файла (аналог __dirname)
10
-
11
- const COMPONENTS_DIR = path.join(__dirname, '..', 'src', 'components') // Путь к компонентам внутри пакета
12
- const STYLES_DIR = path.join(__dirname, '..', 'src', 'styles') // Путь к стилям внутри пакета
13
- const REGISTRY_JSON = path.join(__dirname, 'registry.json') // Путь к файлу registry.json
14
-
15
- const cwd = process.env.INIT_CWD || process.cwd() // Текущая директория, где пользователь запустил CLI
16
-
17
- function readRegistry() {
18
- if (!fs.existsSync(REGISTRY_JSON)) {
19
- // Проверяем, существует ли registry.json
20
- console.error('Registry not found')
21
- process.exit(1)
22
- }
23
- return JSON.parse(fs.readFileSync(REGISTRY_JSON, 'utf8'))
24
- }
25
-
26
- function detectProject() {
27
- // Функция для автоопределения структуры проекта
28
- const hasSrc = fs.existsSync(path.join(cwd, 'src')) // Проверяем, есть ли папка src
29
- return {
30
- components: hasSrc ? 'src/components/ui' : 'components/ui',
31
- styles: hasSrc ? 'src/styles' : 'styles',
32
- }
33
- }
34
-
35
- function copyDir(src, dest) {
36
- // Рекурсивная функция копирования папки
37
- fs.mkdirSync(dest, { recursive: true }) // Создаём папку назначения (если её нет)
38
- for (const file of fs.readdirSync(src)) {
39
- // Перебираем все файлы и папки в исходной директории
40
- const s = path.join(src, file) // Формируем полный путь к исходному файлу
41
- const d = path.join(dest, file) // Формируем полный путь к файлу назначения
42
- if (fs.statSync(s).isDirectory()) {
43
- // Если это папка
44
- copyDir(s, d) // Рекурсивно копируем её содержимое
45
- } else {
46
- // Если это файл
47
- if (!fs.existsSync(d)) {
48
- // Проверяем, не существует ли файл уже
49
- fs.copyFileSync(s, d) // Копируем файл
50
- console.log('add', path.relative(cwd, d)) // Выводим относительный путь добавленного файла
51
- }
52
- }
53
- }
54
- }
55
-
56
- function init() {
57
- const configPath = path.join(cwd, 'rxn-ui.json') // Путь к конфигурационному файлу
58
- if (fs.existsSync(configPath)) {
59
- console.log('✔ already initialized')
60
- return
61
- }
62
-
63
- const config = detectProject()
64
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2)) // Сохраняем конфиг в файл
65
-
66
- if (fs.existsSync(STYLES_DIR)) {
67
- copyDir(STYLES_DIR, path.join(cwd, config.styles)) // Копируем стили в проект пользователя
68
- }
69
-
70
- console.log('✔ rxn-ui initialized')
71
- }
72
-
73
- function add(name) {
74
- const registry = readRegistry() // Читаем registry.json
75
- const entry = registry[name] // Получаем запись компонента по имени
76
-
77
- if (!entry) {
78
- // Если компонент не найден
79
- console.error('Component not found:', name)
80
- process.exit(1)
81
- }
82
-
83
- const configPath = path.join(cwd, 'rxn-ui.json') // Путь к конфигу
84
- if (!fs.existsSync(configPath)) {
85
- console.log('Initializing...\n') // Сообщаем, что запускается инициализация
86
- init() // Выполняем init автоматически
87
- }
88
-
89
- const config = JSON.parse(fs.readFileSync(configPath, 'utf8')) // Загружаем конфигурацию
90
-
91
- const src = path.join(COMPONENTS_DIR, name) // Путь к компоненту в пакете
92
- const dest = path.join(cwd, config.components, name) // Путь установки компонента в проекте
93
-
94
- fs.mkdirSync(dest, { recursive: true })
95
- for (const file of entry.files) {
96
- const s = path.join(src, file)
97
- const d = path.join(dest, file)
98
- if (fs.existsSync(s)) {
99
- fs.copyFileSync(s, d)
100
- console.log('add', path.relative(cwd, d))
101
- }
102
- }
103
-
104
- console.log(`\n✔ ${name} added`)
105
- }
106
-
107
- const [cmd, arg] = process.argv.slice(2) // Получаем аргументы командной строки
108
-
109
- if (cmd === 'init') init()
110
- else if (cmd === 'add') add(arg)
111
- else {
112
- console.log(`
113
- rxn-ui
114
-
115
- Usage:
116
- npx rxn-ui init
117
- npx rxn-ui add button
118
- `)
119
- }
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'node:fs'
4
+ import path from 'node:path'
5
+ import process from 'node:process'
6
+ import { fileURLToPath } from 'node:url'
7
+
8
+ const __filename = fileURLToPath(import.meta.url) // Получаем абсолютный путь к текущему файлу (аналог __filename)
9
+ const __dirname = path.dirname(__filename) // Получаем директорию текущего файла (аналог __dirname)
10
+
11
+ const COMPONENTS_DIR = path.join(__dirname, '..', 'src', 'components') // Путь к компонентам внутри пакета
12
+ const REGISTRY_JSON = path.join(__dirname, 'registry.json') // Путь к файлу registry.json
13
+
14
+ const cwd = process.env.INIT_CWD || process.cwd() // Текущая директория, где пользователь запустил CLI
15
+
16
+ function readRegistry() {
17
+ if (!fs.existsSync(REGISTRY_JSON)) {
18
+ // Проверяем, существует ли registry.json
19
+ console.error('Registry not found')
20
+ process.exit(1)
21
+ }
22
+ return JSON.parse(fs.readFileSync(REGISTRY_JSON, 'utf8'))
23
+ }
24
+
25
+ function detectProject() {
26
+ // Функция для автоопределения структуры проекта
27
+ const hasSrc = fs.existsSync(path.join(cwd, 'src')) // Проверяем, есть ли папка src
28
+ return {
29
+ components: hasSrc ? 'src/shared/components' : 'components',
30
+ styles: hasSrc ? 'src/app/styles' : 'styles',
31
+ }
32
+ }
33
+
34
+ function init() {
35
+ const configPath = path.join(cwd, 'rxn-ui.json') // Путь к конфигурационному файлу
36
+ if (fs.existsSync(configPath)) {
37
+ console.log('✔ already initialized')
38
+ return
39
+ }
40
+ const config = detectProject()
41
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2)) // Сохраняем конфиг в файл
42
+ console.log('✔ rxn-ui initialized')
43
+ }
44
+
45
+ function add(name) {
46
+ const registry = readRegistry() // Читаем registry.json
47
+ const entry = registry[name] // Получаем запись компонента по имени
48
+
49
+ if (!entry) {
50
+ // Если компонент не найден
51
+ console.error('Component not found:', name)
52
+ process.exit(1)
53
+ }
54
+
55
+ const configPath = path.join(cwd, 'rxn-ui.json') // Путь к конфигу
56
+ if (!fs.existsSync(configPath)) {
57
+ console.log('You should initialize...\n npx rxn-ui init')
58
+ process.exit(1)
59
+ }
60
+
61
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8')) // Загружаем конфигурацию
62
+
63
+ const src = path.join(COMPONENTS_DIR, name) // Путь к компоненту в пакете
64
+ const dest = path.join(cwd, config.components, name) // Путь установки компонента в проекте
65
+
66
+ fs.mkdirSync(dest, { recursive: true })
67
+ for (const file of entry.files) {
68
+ const s = path.join(src, file)
69
+ const d = path.join(dest, file)
70
+ if (fs.existsSync(s)) {
71
+ fs.copyFileSync(s, d)
72
+ console.log('add', path.relative(cwd, d))
73
+ }
74
+ }
75
+
76
+ console.log(`\n✔ ${name} added`)
77
+ }
78
+
79
+ const [cmd, arg] = process.argv.slice(2) // Получаем аргументы командной строки
80
+
81
+ if (cmd === 'init') init()
82
+ else if (cmd === 'add') add(arg)
83
+ else {
84
+ console.log(`
85
+ rxn-ui
86
+
87
+ Usage:
88
+ npx rxn-ui init
89
+ npx rxn-ui add button-base
90
+ `)
91
+ }
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "rxn-ui",
3
- "description": "Vue 3 UI component library",
4
- "version": "0.4.2",
5
- "license": "MIT",
6
- "private": false,
7
- "type": "module",
8
- "author": "Artur Hareksian <artharexian@gmail.com> (https://github.com/r2-h)",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/r2-h/artharexian-ui.git"
12
- },
13
- "bin": {
14
- "rxn-ui": "./cli/index.mjs"
15
- },
16
- "files": [
17
- "cli",
18
- "src/components",
19
- "src/styles"
20
- ],
21
- "engines": {
22
- "node": ">=18"
23
- },
24
- "scripts": {
25
- "dev": "vite",
26
- "format": "prettier --write .",
27
- "storybook": "storybook dev -p 6006",
28
- "build-storybook": "storybook build"
29
- },
30
- "peerDependencies": {
31
- "vue": "^3.5.0"
32
- },
33
- "devDependencies": {
34
- "@chromatic-com/storybook": "^5.0.1",
35
- "@storybook/addon-a11y": "^10.2.10",
36
- "@storybook/addon-docs": "^10.2.10",
37
- "@storybook/addon-vitest": "^10.2.10",
38
- "@storybook/vue3-vite": "^10.2.10",
39
- "@trivago/prettier-plugin-sort-imports": "^6.0.2",
40
- "@types/node": "^24.10.1",
41
- "@vitejs/plugin-vue": "^6.0.2",
42
- "@vitest/browser-playwright": "^4.0.18",
43
- "@vitest/coverage-v8": "^4.0.18",
44
- "@vue/tsconfig": "^0.8.1",
45
- "eslint": "^10.0.0",
46
- "eslint-plugin-storybook": "^10.2.10",
47
- "playwright": "^1.58.2",
48
- "prettier": "^3.8.1",
49
- "storybook": "^10.2.10",
50
- "typescript": "~5.9.3",
51
- "vite": "^7.3.1",
52
- "vitest": "^4.0.18",
53
- "vue": "^3.5.25",
54
- "vue-tsc": "^3.1.5"
55
- },
56
- "eslintConfig": {
57
- "extends": [
58
- "plugin:storybook/recommended"
59
- ]
60
- }
61
- }
1
+ {
2
+ "name": "rxn-ui",
3
+ "description": "Vue 3 UI component library",
4
+ "version": "0.4.4",
5
+ "license": "MIT",
6
+ "private": false,
7
+ "type": "module",
8
+ "author": "Artur Hareksian <artharexian@gmail.com> (https://github.com/r2-h)",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/r2-h/artharexian-ui.git"
12
+ },
13
+ "bin": {
14
+ "rxn-ui": "./cli/index.mjs"
15
+ },
16
+ "files": [
17
+ "cli",
18
+ "src/components",
19
+ "src/styles"
20
+ ],
21
+ "engines": {
22
+ "node": ">=18"
23
+ },
24
+ "scripts": {
25
+ "dev": "vite",
26
+ "format": "prettier --write .",
27
+ "storybook": "storybook dev -p 6006",
28
+ "build-storybook": "storybook build"
29
+ },
30
+ "peerDependencies": {
31
+ "vue": "^3.5.0"
32
+ },
33
+ "devDependencies": {
34
+ "@chromatic-com/storybook": "^5.0.1",
35
+ "@storybook/addon-a11y": "^10.2.10",
36
+ "@storybook/addon-docs": "^10.2.10",
37
+ "@storybook/addon-vitest": "^10.2.10",
38
+ "@storybook/vue3-vite": "^10.2.10",
39
+ "@trivago/prettier-plugin-sort-imports": "^6.0.2",
40
+ "@types/node": "^24.10.1",
41
+ "@vitejs/plugin-vue": "^6.0.2",
42
+ "@vitest/browser-playwright": "^4.0.18",
43
+ "@vitest/coverage-v8": "^4.0.18",
44
+ "@vue/tsconfig": "^0.8.1",
45
+ "eslint": "^10.0.0",
46
+ "eslint-plugin-storybook": "^10.2.10",
47
+ "playwright": "^1.58.2",
48
+ "prettier": "^3.8.1",
49
+ "storybook": "^10.2.10",
50
+ "typescript": "~5.9.3",
51
+ "vite": "^7.3.1",
52
+ "vitest": "^4.0.18",
53
+ "vue": "^3.5.25",
54
+ "vue-tsc": "^3.1.5"
55
+ },
56
+ "eslintConfig": {
57
+ "extends": [
58
+ "plugin:storybook/recommended"
59
+ ]
60
+ }
61
+ }
@@ -1,136 +1,136 @@
1
- @import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@14..36,300;14..36,400;14..36,500;14..36,600;14..36,700&display=swap');
2
- @import 'variables.css';
3
- @layer theme, base, components, utilities;
4
-
5
- @layer base {
6
- :root {
7
- &[data-theme='light'] {
8
- color-scheme: light;
9
- }
10
- &[data-theme='dark'] {
11
- color-scheme: dark;
12
- }
13
-
14
- color-scheme: light dark;
15
- scroll-behavior: smooth;
16
- font-size: 10px;
17
- font-family: 'DM Sans', sans-serif;
18
- }
19
-
20
- body {
21
- background: var(--background);
22
- color: var(--foreground);
23
- -webkit-font-smoothing: antialiased;
24
- font-size: 1.6rem;
25
- }
26
-
27
- *,
28
- *::before,
29
- *::after {
30
- box-sizing: border-box;
31
- margin: 0;
32
- padding: 0;
33
- border: 0 solid;
34
- }
35
-
36
- :disabled,
37
- [aria-busy='true'],
38
- .is-disabled {
39
- pointer-events: none;
40
- color: var(--color-neutral-500);
41
- opacity: 0.45;
42
- }
43
-
44
- h1,
45
- h2,
46
- h3,
47
- h4,
48
- h5,
49
- h6 {
50
- text-wrap: balance;
51
- font-size: inherit;
52
- font-weight: inherit;
53
- }
54
-
55
- textarea {
56
- resize: vertical;
57
- }
58
-
59
- img,
60
- picture,
61
- svg,
62
- video {
63
- display: block;
64
- max-width: 100%;
65
- height: auto;
66
- }
67
-
68
- input,
69
- button,
70
- textarea,
71
- select {
72
- font: inherit;
73
- }
74
-
75
- a {
76
- text-decoration: none;
77
- color: inherit;
78
- &:hover {
79
- text-decoration: underline;
80
- }
81
- }
82
-
83
- ol,
84
- ul,
85
- menu {
86
- list-style: none;
87
- }
88
- }
89
-
90
- @layer components {
91
- h1 {
92
- font-size: var(--text-2xl);
93
- }
94
- h2 {
95
- font-size: var(--text-xl);
96
- }
97
- h3 {
98
- font-size: var(--text-lg);
99
- }
100
- ::placeholder {
101
- color: var(--muted-foreground);
102
- }
103
-
104
- .font-xs {
105
- font-size: var(--text-xs);
106
- /* line-height: var(--leading-relaxed); */
107
- }
108
- .font-sm {
109
- font-size: var(--text-sm);
110
- /* line-height: var(--leading-normal); */
111
- }
112
- .font-base {
113
- font-size: var(--text-base);
114
- /* line-height: var(--leading-normal); */
115
- }
116
- .font-lg {
117
- font-size: var(--text-lg);
118
- /* line-height: var(--leading-normal); */
119
- }
120
- .font-xl {
121
- font-size: var(--text-xl);
122
- /* line-height: var(--leading-snug); */
123
- }
124
- .font-2xl {
125
- font-size: var(--text-2xl);
126
- /* line-height: var(--leading-tight); */
127
- }
128
- .font-3xl {
129
- font-size: var(--text-3xl);
130
- /* line-height: 1; */
131
- }
132
- .font-4xl {
133
- font-size: var(--text-4xl);
134
- /* line-height: 1; */
135
- }
136
- }
1
+ @import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@14..36,300;14..36,400;14..36,500;14..36,600;14..36,700&display=swap');
2
+ @import 'variables.css';
3
+ @layer theme, base, components, utilities;
4
+
5
+ @layer base {
6
+ :root {
7
+ &[data-theme='light'] {
8
+ color-scheme: light;
9
+ }
10
+ &[data-theme='dark'] {
11
+ color-scheme: dark;
12
+ }
13
+
14
+ color-scheme: light dark;
15
+ scroll-behavior: smooth;
16
+ font-size: 10px;
17
+ font-family: 'DM Sans', sans-serif;
18
+ }
19
+
20
+ body {
21
+ background: var(--background);
22
+ color: var(--foreground);
23
+ -webkit-font-smoothing: antialiased;
24
+ font-size: 1.6rem;
25
+ }
26
+
27
+ *,
28
+ *::before,
29
+ *::after {
30
+ box-sizing: border-box;
31
+ margin: 0;
32
+ padding: 0;
33
+ border: 0 solid;
34
+ }
35
+
36
+ :disabled,
37
+ [aria-busy='true'],
38
+ .is-disabled {
39
+ pointer-events: none;
40
+ color: var(--color-neutral-500);
41
+ opacity: 0.45;
42
+ }
43
+
44
+ h1,
45
+ h2,
46
+ h3,
47
+ h4,
48
+ h5,
49
+ h6 {
50
+ text-wrap: balance;
51
+ font-size: inherit;
52
+ font-weight: inherit;
53
+ }
54
+
55
+ textarea {
56
+ resize: vertical;
57
+ }
58
+
59
+ img,
60
+ picture,
61
+ svg,
62
+ video {
63
+ display: block;
64
+ max-width: 100%;
65
+ height: auto;
66
+ }
67
+
68
+ input,
69
+ button,
70
+ textarea,
71
+ select {
72
+ font: inherit;
73
+ }
74
+
75
+ a {
76
+ text-decoration: none;
77
+ color: inherit;
78
+ &:hover {
79
+ text-decoration: underline;
80
+ }
81
+ }
82
+
83
+ ol,
84
+ ul,
85
+ menu {
86
+ list-style: none;
87
+ }
88
+ }
89
+
90
+ @layer components {
91
+ h1 {
92
+ font-size: var(--text-2xl);
93
+ }
94
+ h2 {
95
+ font-size: var(--text-xl);
96
+ }
97
+ h3 {
98
+ font-size: var(--text-lg);
99
+ }
100
+ ::placeholder {
101
+ color: var(--muted-foreground);
102
+ }
103
+
104
+ .font-xs {
105
+ font-size: var(--text-xs);
106
+ /* line-height: var(--leading-relaxed); */
107
+ }
108
+ .font-sm {
109
+ font-size: var(--text-sm);
110
+ /* line-height: var(--leading-normal); */
111
+ }
112
+ .font-base {
113
+ font-size: var(--text-base);
114
+ /* line-height: var(--leading-normal); */
115
+ }
116
+ .font-lg {
117
+ font-size: var(--text-lg);
118
+ /* line-height: var(--leading-normal); */
119
+ }
120
+ .font-xl {
121
+ font-size: var(--text-xl);
122
+ /* line-height: var(--leading-snug); */
123
+ }
124
+ .font-2xl {
125
+ font-size: var(--text-2xl);
126
+ /* line-height: var(--leading-tight); */
127
+ }
128
+ .font-3xl {
129
+ font-size: var(--text-3xl);
130
+ /* line-height: 1; */
131
+ }
132
+ .font-4xl {
133
+ font-size: var(--text-4xl);
134
+ /* line-height: 1; */
135
+ }
136
+ }