@cyber-harbour/ui 2.2.43 → 3.0.0-fix-button-focus-visible.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -205
- package/bin/switch-ui-lib.js +218 -106
- package/dist/Icons/index.d.mts +468 -0
- package/dist/Icons/index.d.ts +468 -0
- package/dist/Icons/index.js +2 -0
- package/dist/Icons/index.js.map +1 -0
- package/dist/Icons/index.mjs +2 -0
- package/dist/Icons/index.mjs.map +1 -0
- package/dist/PdfDriver-IRXY5HVF.js +2 -0
- package/dist/PdfDriver-IRXY5HVF.js.map +1 -0
- package/dist/PdfDriver-XCFXTEEH.mjs +2 -0
- package/dist/PdfDriver-XCFXTEEH.mjs.map +1 -0
- package/dist/chunk-47BJH42B.mjs +2 -0
- package/dist/chunk-47BJH42B.mjs.map +1 -0
- package/dist/chunk-47O3IYW3.js +3 -0
- package/dist/chunk-47O3IYW3.js.map +1 -0
- package/dist/chunk-4O4WHXDT.mjs +3 -0
- package/dist/chunk-4O4WHXDT.mjs.map +1 -0
- package/dist/chunk-7F6XMY63.mjs +3 -0
- package/dist/chunk-7F6XMY63.mjs.map +1 -0
- package/dist/chunk-7LHQWEWV.mjs +2 -0
- package/dist/chunk-7LHQWEWV.mjs.map +1 -0
- package/dist/chunk-AYDF3IFZ.js +2 -0
- package/dist/chunk-AYDF3IFZ.js.map +1 -0
- package/dist/chunk-HFG4KP6L.js +2 -0
- package/dist/chunk-HFG4KP6L.js.map +1 -0
- package/dist/chunk-JVDLOXO7.js +2 -0
- package/dist/chunk-JVDLOXO7.js.map +1 -0
- package/dist/chunk-NQZUCXJV.js +2 -0
- package/dist/chunk-NQZUCXJV.js.map +1 -0
- package/dist/chunk-QWPVIX2T.mjs +2 -0
- package/dist/chunk-QWPVIX2T.mjs.map +1 -0
- package/dist/chunk-S3RLHUDJ.js +3 -0
- package/dist/chunk-S3RLHUDJ.js.map +1 -0
- package/dist/chunk-XP4PPF7V.mjs +2 -0
- package/dist/chunk-XP4PPF7V.mjs.map +1 -0
- package/dist/index.d.mts +1646 -1871
- package/dist/index.d.ts +1646 -1871
- package/dist/index.js +8 -1690
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1690
- package/dist/index.mjs.map +1 -1
- package/dist/styles/design-tokens.css +839 -0
- package/dist/styles/legacy-token-aliases.css +26 -0
- package/dist/styles/tailwind.css +477 -3
- package/dist/utils/index.d.mts +7 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils-jfCLo6l4.d.mts +26 -0
- package/dist/utils-jfCLo6l4.d.ts +26 -0
- package/package.json +65 -53
- package/dist/PdfDriver-54FN6DBI.js +0 -2
- package/dist/PdfDriver-54FN6DBI.js.map +0 -1
- package/dist/PdfDriver-AVC3OSKE.mjs +0 -2
- package/dist/PdfDriver-AVC3OSKE.mjs.map +0 -1
- package/dist/chunk-EGCG27KL.mjs +0 -3
- package/dist/chunk-EGCG27KL.mjs.map +0 -1
- package/dist/chunk-WRBRJBUL.js +0 -3
- package/dist/chunk-WRBRJBUL.js.map +0 -1
- package/dist/index.css +0 -3
- package/dist/index.css.map +0 -1
- package/dist/styles/tailwind.css.map +0 -1
- package/dist/styles/tailwind.d.mts +0 -2
- package/dist/styles/tailwind.d.ts +0 -2
package/bin/switch-ui-lib.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { execSync } = require('child_process');
|
|
3
|
+
const { execFileSync } = require('child_process');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
const fs = require('fs');
|
|
7
6
|
|
|
@@ -48,19 +47,14 @@ const projectRoot = findProjectRoot();
|
|
|
48
47
|
const localPath = getLocalPath();
|
|
49
48
|
const pkgPath = path.resolve(projectRoot, `node_modules/${packageName}/package.json`);
|
|
50
49
|
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
const realPath = fs.realpathSync(pkgPath);
|
|
54
|
-
return realPath.startsWith(path.resolve(localPath));
|
|
55
|
-
} catch {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
50
|
+
function npm(args, cwd) {
|
|
51
|
+
return execFileSync('npm', args, { stdio: 'inherit', cwd });
|
|
58
52
|
}
|
|
59
53
|
|
|
60
|
-
function
|
|
54
|
+
function isUsingLocalVersion() {
|
|
61
55
|
try {
|
|
62
56
|
const realPath = fs.realpathSync(pkgPath);
|
|
63
|
-
return
|
|
57
|
+
return realPath.startsWith(path.resolve(localPath));
|
|
64
58
|
} catch {
|
|
65
59
|
return false;
|
|
66
60
|
}
|
|
@@ -82,11 +76,134 @@ function checkLocalPathExists() {
|
|
|
82
76
|
return true;
|
|
83
77
|
}
|
|
84
78
|
|
|
85
|
-
|
|
79
|
+
function printHeader() {
|
|
86
80
|
console.log(`🏠 Проект: ${projectRoot}`);
|
|
87
81
|
console.log(`📦 Пакет: ${packageName}`);
|
|
88
82
|
console.log(`🔧 Локальний шлях: ${localPath}`);
|
|
89
83
|
console.log('');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function printStatus() {
|
|
87
|
+
printHeader();
|
|
88
|
+
if (!fs.existsSync(pkgPath)) {
|
|
89
|
+
console.log('📊 Статус: не встановлено');
|
|
90
|
+
return 'missing';
|
|
91
|
+
}
|
|
92
|
+
if (isUsingLocalVersion()) {
|
|
93
|
+
const realPath = fs.realpathSync(pkgPath);
|
|
94
|
+
console.log(`📊 Статус: local → ${path.dirname(realPath)}`);
|
|
95
|
+
return 'local';
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
99
|
+
console.log(`📊 Статус: npm @ ${pkg.version}`);
|
|
100
|
+
} catch {
|
|
101
|
+
console.log('📊 Статус: npm (версію не вдалося прочитати)');
|
|
102
|
+
}
|
|
103
|
+
return 'npm';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function printHelp() {
|
|
107
|
+
console.log(`Usage: switch-ui-lib [command] [options]
|
|
108
|
+
|
|
109
|
+
Commands:
|
|
110
|
+
local Link the local checkout of ${packageName} via npm link
|
|
111
|
+
npm [version|tag] Install from npm (default: latest)
|
|
112
|
+
status Print current mode (local | npm <version>) and exit
|
|
113
|
+
(no command) Run interactive picker
|
|
114
|
+
|
|
115
|
+
Options:
|
|
116
|
+
-h, --help Show this help and exit
|
|
117
|
+
|
|
118
|
+
Environment:
|
|
119
|
+
UI_LIBRARY_PATH Absolute path to the local ui-kit checkout
|
|
120
|
+
(default: ../ui-kit relative to the consuming project)
|
|
121
|
+
|
|
122
|
+
Examples:
|
|
123
|
+
switch-ui-lib local
|
|
124
|
+
switch-ui-lib npm
|
|
125
|
+
switch-ui-lib npm next
|
|
126
|
+
switch-ui-lib npm 0.42.0
|
|
127
|
+
switch-ui-lib status
|
|
128
|
+
`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function switchToLocal() {
|
|
132
|
+
printHeader();
|
|
133
|
+
|
|
134
|
+
if (!checkLocalPathExists()) {
|
|
135
|
+
return 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (isUsingLocalVersion()) {
|
|
139
|
+
console.log('✅ Вже підключено локально.');
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
console.log('🔄 Видаляємо існуючий пакет...');
|
|
145
|
+
try {
|
|
146
|
+
npm(['uninstall', packageName], projectRoot);
|
|
147
|
+
} catch {
|
|
148
|
+
// Ігноруємо помилку якщо пакет не встановлений
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Створюємо глобальний лінк в локальній бібліотеці
|
|
152
|
+
// NB: react/react-dom лінкувати окремо НЕ потрібно — споживач
|
|
153
|
+
// (frontend-svc) має `resolve.dedupe: ['react','react-dom']` у
|
|
154
|
+
// vite.config.ts, що гарантує єдиний інстанс React навіть при
|
|
155
|
+
// symlink-resolution через node_modules/@cyber-harbour/ui.
|
|
156
|
+
console.log('🔄 Створюємо глобальний лінк...');
|
|
157
|
+
npm(['link'], localPath);
|
|
158
|
+
|
|
159
|
+
console.log('🔄 Підключаємо локальну версію...');
|
|
160
|
+
npm(['link', packageName], projectRoot);
|
|
161
|
+
|
|
162
|
+
console.log('✅ Успішно підключено локальну версію через npm link.');
|
|
163
|
+
return 0;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.error('❌ Помилка при підключенні локальної версії:', error.message);
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function switchToNpm(versionOrTag) {
|
|
171
|
+
printHeader();
|
|
172
|
+
|
|
173
|
+
const version = versionOrTag || 'latest';
|
|
174
|
+
const packageToInstall = `${packageName}@${version}`;
|
|
175
|
+
|
|
176
|
+
try {
|
|
177
|
+
console.log('🔄 Видаляємо лінки...');
|
|
178
|
+
try {
|
|
179
|
+
npm(['unlink', packageName], projectRoot);
|
|
180
|
+
} catch {
|
|
181
|
+
// Ігноруємо помилку якщо лінк не існує
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
console.log(`🔄 Встановлюємо ${packageToInstall}...`);
|
|
185
|
+
npm(['install', packageToInstall], projectRoot);
|
|
186
|
+
console.log(`✅ Успішно підключено ${packageToInstall}.`);
|
|
187
|
+
return 0;
|
|
188
|
+
} catch (error) {
|
|
189
|
+
console.error('❌ Помилка при підключенні версії з NPM:', error.message);
|
|
190
|
+
return 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function runInteractive() {
|
|
195
|
+
let prompts;
|
|
196
|
+
try {
|
|
197
|
+
require.resolve('prompts');
|
|
198
|
+
prompts = require('prompts');
|
|
199
|
+
} catch {
|
|
200
|
+
console.error('❌ Помилка: пакет "prompts" не знайдено.');
|
|
201
|
+
console.log('💡 Встановіть prompts: npm install --save-dev prompts');
|
|
202
|
+
console.log('💡 Або викличте з аргументами: switch-ui-lib local | npm [version] | status');
|
|
203
|
+
return 1;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
printHeader();
|
|
90
207
|
|
|
91
208
|
const response = await prompts({
|
|
92
209
|
type: 'select',
|
|
@@ -101,114 +218,109 @@ async function main() {
|
|
|
101
218
|
const { mode } = response;
|
|
102
219
|
|
|
103
220
|
if (mode === 'local') {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (isUsingLocalVersion()) {
|
|
109
|
-
console.log('✅ Вже підключено локально.');
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
221
|
+
return switchToLocal();
|
|
222
|
+
}
|
|
112
223
|
|
|
224
|
+
if (mode === 'npm') {
|
|
225
|
+
let distTags = {};
|
|
113
226
|
try {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// Копіюємо React і React DOM з основного проекту в UI бібліотеку
|
|
123
|
-
console.log('🔄 Копіюємо React в UI бібліотеку...');
|
|
124
|
-
try {
|
|
125
|
-
execSync('npm link react react-dom', {
|
|
126
|
-
stdio: 'inherit',
|
|
127
|
-
cwd: localPath,
|
|
128
|
-
});
|
|
129
|
-
} catch (error) {
|
|
130
|
-
console.log("⚠️ Не вдалося зв'язати React (це може бути нормально)");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Створюємо глобальний лінк в локальній бібліотеці
|
|
134
|
-
console.log('🔄 Створюємо глобальний лінк...');
|
|
135
|
-
execSync('npm link', {
|
|
136
|
-
stdio: 'inherit',
|
|
137
|
-
cwd: localPath,
|
|
138
|
-
});
|
|
227
|
+
const raw = execFileSync('npm', ['view', packageName, 'dist-tags', '--json'], {
|
|
228
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
229
|
+
}).toString();
|
|
230
|
+
distTags = JSON.parse(raw);
|
|
231
|
+
} catch {
|
|
232
|
+
console.log('⚠️ Не вдалося отримати список тегів з npm — буде запропоновано ручний ввід.');
|
|
233
|
+
}
|
|
139
234
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
235
|
+
const PRIMARY_TAGS = ['latest', 'next', 'next-gen', 'beta', 'alpha', 'dev'];
|
|
236
|
+
const tagEntries = Object.entries(distTags).sort(([a], [b]) => {
|
|
237
|
+
const ai = PRIMARY_TAGS.indexOf(a);
|
|
238
|
+
const bi = PRIMARY_TAGS.indexOf(b);
|
|
239
|
+
if (ai !== -1 || bi !== -1) return (ai === -1 ? Infinity : ai) - (bi === -1 ? Infinity : bi);
|
|
240
|
+
return a.localeCompare(b);
|
|
241
|
+
});
|
|
242
|
+
const tagChoices = tagEntries.map(([tag, version]) => ({
|
|
243
|
+
title: `${tag} (${version})`,
|
|
244
|
+
value: tag,
|
|
245
|
+
}));
|
|
143
246
|
|
|
144
|
-
|
|
145
|
-
} catch (error) {
|
|
146
|
-
console.error('❌ Помилка при підключенні локальної версії:', error.message);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
247
|
+
const latestIdx = tagChoices.findIndex(c => c.value === 'latest');
|
|
149
248
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
249
|
+
const { selected } = await prompts({
|
|
250
|
+
type: 'select',
|
|
251
|
+
name: 'selected',
|
|
252
|
+
message: 'Оберіть тег або вкажіть власну версію:',
|
|
253
|
+
choices: [
|
|
254
|
+
...tagChoices,
|
|
255
|
+
{ title: '✏️ Ввести версію або тег вручну', value: '__custom__' },
|
|
256
|
+
],
|
|
257
|
+
initial: latestIdx >= 0 ? latestIdx : 0,
|
|
157
258
|
});
|
|
158
|
-
|
|
159
|
-
if (!
|
|
259
|
+
|
|
260
|
+
if (!selected) {
|
|
160
261
|
console.log('❌ Операція скасована.');
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const version = versionResponse.version.startsWith('@')
|
|
165
|
-
? versionResponse.version.substring(1)
|
|
166
|
-
: versionResponse.version;
|
|
167
|
-
const packageToInstall = `${packageName}@${version}`;
|
|
168
|
-
|
|
169
|
-
if (isUsingNpmVersion()) {
|
|
170
|
-
console.log('✅ Вже використовується версія з NPM.');
|
|
171
|
-
return;
|
|
262
|
+
return 1;
|
|
172
263
|
}
|
|
173
264
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
265
|
+
let version = selected;
|
|
266
|
+
if (selected === '__custom__') {
|
|
267
|
+
const { custom } = await prompts({
|
|
268
|
+
type: 'text',
|
|
269
|
+
name: 'custom',
|
|
270
|
+
message: 'Введіть версію або тег:',
|
|
271
|
+
initial: 'latest',
|
|
272
|
+
validate: value => (value.length > 0 ? true : 'Версія не може бути пустою'),
|
|
273
|
+
});
|
|
182
274
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
execSync('npm unlink react react-dom', {
|
|
188
|
-
stdio: 'inherit',
|
|
189
|
-
cwd: localPath,
|
|
190
|
-
});
|
|
191
|
-
} catch {
|
|
192
|
-
// Ігноруємо помилку якщо лінк не існує
|
|
193
|
-
}
|
|
275
|
+
if (!custom) {
|
|
276
|
+
console.log('❌ Операція скасована.');
|
|
277
|
+
return 1;
|
|
194
278
|
}
|
|
195
279
|
|
|
196
|
-
|
|
197
|
-
console.log(`🔄 Встановлюємо ${packageToInstall}...`);
|
|
198
|
-
execSync(`npm install ${packageToInstall}`, { stdio: 'inherit', cwd: projectRoot });
|
|
199
|
-
console.log(`✅ Успішно підключено ${packageToInstall}.`);
|
|
200
|
-
} catch (error) {
|
|
201
|
-
console.error('❌ Помилка при підключенні версії з NPM:', error.message);
|
|
280
|
+
version = custom.startsWith('@') ? custom.substring(1) : custom;
|
|
202
281
|
}
|
|
282
|
+
|
|
283
|
+
return switchToNpm(version);
|
|
203
284
|
}
|
|
285
|
+
|
|
286
|
+
console.log('❌ Операція скасована.');
|
|
287
|
+
return 1;
|
|
204
288
|
}
|
|
205
289
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
290
|
+
async function main() {
|
|
291
|
+
const args = process.argv.slice(2);
|
|
292
|
+
const [command, ...rest] = args;
|
|
293
|
+
|
|
294
|
+
if (command === '-h' || command === '--help') {
|
|
295
|
+
printHelp();
|
|
296
|
+
return 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (command === 'status') {
|
|
300
|
+
printStatus();
|
|
301
|
+
return 0;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (command === 'local') {
|
|
305
|
+
return switchToLocal();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (command === 'npm') {
|
|
309
|
+
return switchToNpm(rest[0]);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (command !== undefined) {
|
|
313
|
+
console.error(`❌ Невідома команда: ${command}`);
|
|
314
|
+
printHelp();
|
|
315
|
+
return 2;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return runInteractive();
|
|
214
319
|
}
|
|
320
|
+
|
|
321
|
+
main()
|
|
322
|
+
.then(code => process.exit(code ?? 0))
|
|
323
|
+
.catch(error => {
|
|
324
|
+
console.error(error);
|
|
325
|
+
process.exit(1);
|
|
326
|
+
});
|