orbital-ds 0.8.0 → 0.9.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/AGENTS.md +145 -80
- package/components.manifest.json +1326 -1267
- package/contract.json +226 -168
- package/dist/hooks/use-ds-messages.d.ts +36 -0
- package/dist/hooks/use-ds-messages.js +12 -0
- package/dist/hooks/use-ds-motion.d.ts +17 -0
- package/dist/hooks/use-ds-motion.js +50 -0
- package/dist/lib/i18n.d.ts +46 -0
- package/dist/lib/i18n.js +109 -0
- package/dist/lib/motion.d.ts +74 -0
- package/dist/lib/motion.js +97 -0
- package/dist/styles.css +876 -528
- package/dist/themes/friendly.css +362 -318
- package/dist/themes/friendly.meta.json +75 -14
- package/dist/themes/friendly.scoped.css +362 -318
- package/dist/themes/qratia.meta.json +42 -12
- package/dist/themes/tactile.css +575 -430
- package/dist/themes/tactile.fonts.css +3 -2
- package/dist/themes/tactile.guide.md +82 -49
- package/dist/themes/tactile.meta.json +175 -82
- package/dist/themes/tactile.scoped.css +575 -430
- package/dist/themes/twitter.css +354 -298
- package/dist/themes/twitter.meta.json +83 -61
- package/dist/themes/twitter.scoped.css +354 -298
- package/dist/themes/zyro.css +443 -389
- package/dist/themes/zyro.meta.json +67 -14
- package/dist/themes/zyro.scoped.css +443 -389
- package/dist/ui/accordion.js +5 -5
- package/dist/ui/alert-dialog.js +3 -3
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/alert.js +9 -3
- package/dist/ui/attachment.d.ts +1 -1
- package/dist/ui/attachment.js +4 -4
- package/dist/ui/avatar.js +6 -6
- package/dist/ui/ayuda.js +3 -2
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.js +9 -3
- package/dist/ui/banner.d.ts +14 -0
- package/dist/ui/banner.js +88 -0
- package/dist/ui/breadcrumb.js +7 -3
- package/dist/ui/bubble.js +6 -6
- package/dist/ui/button-group.js +4 -4
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.js +5 -5
- package/dist/ui/calendar.js +33 -6
- package/dist/ui/card.js +4 -4
- package/dist/ui/carousel.js +15 -8
- package/dist/ui/chart.js +7 -3
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/combobox.js +7 -7
- package/dist/ui/command.js +13 -11
- package/dist/ui/context-menu.js +8 -8
- package/dist/ui/dialog.js +10 -6
- package/dist/ui/drawer.js +9 -9
- package/dist/ui/dropdown-menu.js +8 -8
- package/dist/ui/empty.js +3 -3
- package/dist/ui/field.js +2 -2
- package/dist/ui/hover-card.js +1 -1
- package/dist/ui/i18n-provider.d.ts +11 -0
- package/dist/ui/i18n-provider.js +18 -0
- package/dist/ui/icon-tile.d.ts +1 -1
- package/dist/ui/input-group.d.ts +1 -1
- package/dist/ui/input-group.js +11 -9
- package/dist/ui/input-otp.js +3 -3
- package/dist/ui/input.js +1 -1
- package/dist/ui/item.d.ts +1 -1
- package/dist/ui/item.js +3 -3
- package/dist/ui/kbd.js +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/marker.d.ts +1 -1
- package/dist/ui/marker.js +2 -2
- package/dist/ui/menubar.js +9 -9
- package/dist/ui/message-scroller.js +5 -2
- package/dist/ui/message.js +2 -2
- package/dist/ui/motion-provider.d.ts +11 -0
- package/dist/ui/motion-provider.js +16 -0
- package/dist/ui/native-select.js +4 -4
- package/dist/ui/navigation-menu.js +7 -6
- package/dist/ui/pagination.js +19 -11
- package/dist/ui/popover.js +2 -2
- package/dist/ui/progress.js +2 -2
- package/dist/ui/questionnaire.js +20 -15
- package/dist/ui/radio-group.js +2 -2
- package/dist/ui/resizable.js +2 -2
- package/dist/ui/scroll-area.js +3 -3
- package/dist/ui/select.js +6 -6
- package/dist/ui/separator.js +1 -1
- package/dist/ui/sheet.js +6 -4
- package/dist/ui/sidebar.js +42 -30
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/slider.js +6 -6
- package/dist/ui/sonner.js +25 -8
- package/dist/ui/spinner.js +4 -1
- package/dist/ui/switch.js +2 -2
- package/dist/ui/table.js +3 -3
- package/dist/ui/tabs.js +5 -5
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/toast.js +15 -12
- package/dist/ui/toggle-group.js +2 -2
- package/dist/ui/toggle.js +6 -4
- package/dist/ui/tooltip.js +2 -2
- package/docs/CONTRACT.md +183 -153
- package/package.json +160 -142
- package/scripts/brand-core.mjs +153 -0
- package/scripts/doctor.mjs +128 -7
- package/scripts/i18n.mjs +111 -0
- package/scripts/init.mjs +326 -351
- package/scripts/setup.mjs +99 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* orbital-ds · CONEXIÓN de una app: localizar su CSS principal, poner los @import en
|
|
3
|
+
* el orden correcto (como bloque delimitado, sin tocar lo demás) e instalar paquetes
|
|
4
|
+
* con el gestor de la app. Lo usa `orbital-ds-init`.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { dirname, relative, resolve, sep } from 'node:path';
|
|
8
|
+
import { spawnSync } from 'node:child_process';
|
|
9
|
+
|
|
10
|
+
export const IMPORTS_INI = '/* orbital-ds:imports:start */';
|
|
11
|
+
export const IMPORTS_FIN = '/* orbital-ds:imports:end */';
|
|
12
|
+
|
|
13
|
+
/** CSS principal de la app (el que importa Tailwind), o null. */
|
|
14
|
+
export function detectarCssApp(cwd = process.cwd()) {
|
|
15
|
+
const candidatos = [
|
|
16
|
+
'src/index.css', 'src/styles.css', 'src/globals.css', 'src/app.css', 'src/main.css',
|
|
17
|
+
'app/globals.css', 'app/app.css', 'src/app/globals.css', 'styles/globals.css',
|
|
18
|
+
];
|
|
19
|
+
const existentes = candidatos.map((c) => resolve(cwd, c)).filter((f) => existsSync(f));
|
|
20
|
+
return existentes.find((f) => /@import\s+['"]tailwindcss['"]/.test(readFileSync(f, 'utf8'))) ?? existentes[0] ?? null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const rel = (desde, hasta) => {
|
|
24
|
+
const r = relative(dirname(desde), hasta).split(sep).join('/');
|
|
25
|
+
return r.startsWith('.') ? r : `./${r}`;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Pone (o actualiza) el bloque de imports de orbital-ds al PRINCIPIO del CSS de la app.
|
|
30
|
+
* Quita solo las líneas que el bloque ya contiene (tailwindcss, tw-animate-css, orbital-ds
|
|
31
|
+
* y el brand.css); el resto del fichero queda igual. Devuelve el nuevo contenido.
|
|
32
|
+
*/
|
|
33
|
+
export function bloqueImports(cssFile, { tema, brandFile, cwd = process.cwd() }) {
|
|
34
|
+
const nm = resolve(cwd, 'node_modules/orbital-ds/dist');
|
|
35
|
+
const lineas = [
|
|
36
|
+
IMPORTS_INI,
|
|
37
|
+
`@import 'orbital-ds/themes/${tema}.fonts.css'; /* fuentes del tema: lo primero */`,
|
|
38
|
+
`@import 'tailwindcss';`,
|
|
39
|
+
`@import 'tw-animate-css';`,
|
|
40
|
+
`@import 'orbital-ds/styles.css'; /* estructura */`,
|
|
41
|
+
`@import 'orbital-ds/themes/${tema}.css'; /* tema */`,
|
|
42
|
+
`@import '${rel(cssFile, brandFile)}'; /* tu marca: gana al tema */`,
|
|
43
|
+
`@source '${rel(cssFile, nm)}';`,
|
|
44
|
+
IMPORTS_FIN,
|
|
45
|
+
];
|
|
46
|
+
return lineas.join('\n');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function conectarCss(cssFile, opciones) {
|
|
50
|
+
const actual = existsSync(cssFile) ? readFileSync(cssFile, 'utf8') : '';
|
|
51
|
+
const bloque = bloqueImports(cssFile, opciones);
|
|
52
|
+
let resto = actual;
|
|
53
|
+
if (resto.includes(IMPORTS_INI) && resto.includes(IMPORTS_FIN)) {
|
|
54
|
+
resto = resto.slice(0, resto.indexOf(IMPORTS_INI)) + resto.slice(resto.indexOf(IMPORTS_FIN) + IMPORTS_FIN.length);
|
|
55
|
+
}
|
|
56
|
+
const brandBase = opciones.brandFile.split(/[\\/]/).pop();
|
|
57
|
+
resto = resto
|
|
58
|
+
.split(/\r?\n/)
|
|
59
|
+
.filter((l) => {
|
|
60
|
+
const t = l.trim();
|
|
61
|
+
if (/^@import\s+['"](tailwindcss|tw-animate-css)['"]\s*;?$/.test(t)) return false;
|
|
62
|
+
if (/^@import\s+['"]orbital-ds\/[^'"]+['"]\s*;?/.test(t)) return false;
|
|
63
|
+
if (new RegExp(`^@import\\s+['"][^'"]*${brandBase.replace('.', '\\.')}['"]`).test(t)) return false;
|
|
64
|
+
if (/^@source\s+['"][^'"]*orbital-ds[^'"]*['"]\s*;?$/.test(t)) return false;
|
|
65
|
+
return true;
|
|
66
|
+
})
|
|
67
|
+
.join('\n')
|
|
68
|
+
.replace(/^\s+/, '');
|
|
69
|
+
const nuevo = `${bloque}\n${resto ? `\n${resto}` : ''}`.replace(/\s*$/, '\n');
|
|
70
|
+
const cambia = nuevo !== actual;
|
|
71
|
+
if (cambia) writeFileSync(cssFile, nuevo);
|
|
72
|
+
return cambia ? (actual ? 'actualizado' : 'creado') : 'igual';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Gestor de paquetes de la app según su lockfile. */
|
|
76
|
+
export function gestorPaquetes(cwd = process.cwd()) {
|
|
77
|
+
if (existsSync(resolve(cwd, 'pnpm-lock.yaml'))) return 'pnpm';
|
|
78
|
+
if (existsSync(resolve(cwd, 'yarn.lock'))) return 'yarn';
|
|
79
|
+
if (existsSync(resolve(cwd, 'bun.lockb')) || existsSync(resolve(cwd, 'bun.lock'))) return 'bun';
|
|
80
|
+
return 'npm';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function comandoInstalar(gestor, paquetes) {
|
|
84
|
+
return gestor === 'npm' ? `npm install ${paquetes.join(' ')}` : `${gestor} add ${paquetes.join(' ')}`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function instalar(gestor, paquetes, cwd = process.cwd()) {
|
|
88
|
+
const r = spawnSync(comandoInstalar(gestor, paquetes), { cwd, shell: true, stdio: 'pipe', encoding: 'utf8' });
|
|
89
|
+
return { ok: r.status === 0, salida: `${r.stdout ?? ''}${r.stderr ?? ''}`.trim() };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function yaInstalado(paquete, cwd = process.cwd()) {
|
|
93
|
+
try {
|
|
94
|
+
const p = JSON.parse(readFileSync(resolve(cwd, 'package.json'), 'utf8'));
|
|
95
|
+
return Boolean(p.dependencies?.[paquete] ?? p.devDependencies?.[paquete]);
|
|
96
|
+
} catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|