orbital-ds 0.40.0 → 0.44.1
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 +29 -10
- package/components.manifest.json +6469 -3349
- package/dist/auth-form-B1hgbXkI.d.ts +144 -0
- package/dist/hooks/use-ds-messages.d.ts +89 -0
- package/dist/lib/a2ui-catalog.d.ts +42 -0
- package/dist/lib/a2ui-catalog.js +558 -0
- package/dist/lib/a2ui.d.ts +289 -0
- package/dist/lib/a2ui.js +215 -0
- package/dist/lib/ai-events.d.ts +15 -0
- package/dist/lib/ai-events.js +202 -0
- package/dist/lib/auth-flow.d.ts +3 -1
- package/dist/lib/auth-flow.js +24 -3
- package/dist/lib/format.d.ts +57 -0
- package/dist/lib/format.js +177 -0
- package/dist/lib/i18n.d.ts +96 -2
- package/dist/lib/i18n.js +278 -2
- package/dist/lib/locales/de.d.ts +7 -0
- package/dist/lib/locales/de.js +535 -0
- package/dist/lib/locales/fr.d.ts +7 -0
- package/dist/lib/locales/fr.js +535 -0
- package/dist/lib/locales/he.d.ts +7 -0
- package/dist/lib/locales/he.js +535 -0
- package/dist/lib/locales/it.d.ts +7 -0
- package/dist/lib/locales/it.js +535 -0
- package/dist/styles.css +62 -2
- package/dist/ui/a2ui-renderer.d.ts +44 -0
- package/dist/ui/a2ui-renderer.js +793 -0
- package/dist/ui/agent-events.d.ts +49 -0
- package/dist/ui/agent-events.js +108 -0
- package/dist/ui/ai-tag.d.ts +16 -0
- package/dist/ui/alert-dialog.d.ts +37 -0
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/animated-number.d.ts +11 -0
- package/dist/ui/app-bar.d.ts +22 -0
- package/dist/ui/attachment.d.ts +1 -1
- package/dist/ui/auth-backdrop.d.ts +17 -0
- package/dist/ui/auth-form.d.ts +3 -110
- package/dist/ui/auth-form.js +46 -11
- package/dist/ui/auth-layout.d.ts +38 -0
- package/dist/ui/avatar.d.ts +27 -0
- package/dist/ui/ayuda.d.ts +1 -1
- package/dist/ui/ayuda.js +4 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/bottom-nav.d.ts +22 -0
- package/dist/ui/breadcrumb.d.ts +22 -0
- package/dist/ui/breadcrumb.js +1 -1
- package/dist/ui/bubble.d.ts +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/calendar.d.ts +13 -0
- package/dist/ui/calendar.js +3 -0
- package/dist/ui/card-stack.d.ts +27 -0
- package/dist/ui/card.d.ts +33 -0
- package/dist/ui/carousel.d.ts +35 -0
- package/dist/ui/carousel.js +10 -5
- package/dist/ui/chain-of-thought.d.ts +34 -0
- package/dist/ui/chain-of-thought.js +90 -0
- package/dist/ui/chart-card.d.ts +19 -0
- package/dist/ui/chart.d.ts +19 -0
- package/dist/ui/chat-composer.d.ts +58 -0
- package/dist/ui/chat-composer.js +192 -0
- package/dist/ui/choice-card.d.ts +33 -0
- package/dist/ui/code-block.d.ts +15 -0
- package/dist/ui/combobox.d.ts +48 -0
- package/dist/ui/command-palette.d.ts +18 -0
- package/dist/ui/command.d.ts +34 -0
- package/dist/ui/confirm-action.d.ts +30 -0
- package/dist/ui/confirm-dialog.d.ts +23 -0
- package/dist/ui/content-card.d.ts +14 -0
- package/dist/ui/context-menu.d.ts +35 -0
- package/dist/ui/context-menu.js +1 -1
- package/dist/ui/conversation-list.d.ts +44 -0
- package/dist/ui/conversation-list.js +141 -0
- package/dist/ui/copy-button.d.ts +11 -0
- package/dist/ui/date-time.d.ts +40 -0
- package/dist/ui/date-time.js +55 -0
- package/dist/ui/description-list.d.ts +49 -0
- package/dist/ui/description-list.js +86 -0
- package/dist/ui/detail-panel.d.ts +22 -0
- package/dist/ui/dialog.d.ts +35 -0
- package/dist/ui/dock.d.ts +17 -0
- package/dist/ui/drawer.d.ts +41 -0
- package/dist/ui/dropdown-menu.d.ts +32 -0
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/echart.d.ts +15 -0
- package/dist/ui/empty.d.ts +1 -1
- package/dist/ui/entity-list.d.ts +32 -0
- package/dist/ui/form-layout.d.ts +24 -0
- package/dist/ui/gauge.d.ts +26 -0
- package/dist/ui/generated-image.d.ts +33 -0
- package/dist/ui/generated-image.js +65 -0
- package/dist/ui/generated-table.d.ts +29 -0
- package/dist/ui/generated-table.js +59 -0
- package/dist/ui/heatmap-grid.d.ts +20 -0
- package/dist/ui/hero.d.ts +58 -0
- package/dist/ui/hero.js +145 -0
- package/dist/ui/i18n-provider.d.ts +16 -0
- package/dist/ui/icon-tile.d.ts +2 -2
- package/dist/ui/input-group.d.ts +1 -1
- package/dist/ui/input-otp.d.ts +23 -0
- package/dist/ui/input.d.ts +16 -0
- package/dist/ui/instruction-editor.d.ts +17 -0
- package/dist/ui/item.d.ts +3 -3
- package/dist/ui/label.d.ts +17 -0
- package/dist/ui/legend.d.ts +25 -0
- package/dist/ui/level-meter.d.ts +12 -0
- package/dist/ui/load-more.d.ts +17 -0
- package/dist/ui/loading-state.d.ts +12 -0
- package/dist/ui/markdown.d.ts +29 -0
- package/dist/ui/markdown.js +123 -0
- package/dist/ui/media-card.d.ts +16 -0
- package/dist/ui/menubar.d.ts +39 -0
- package/dist/ui/message-actions.d.ts +21 -0
- package/dist/ui/message-actions.js +79 -0
- package/dist/ui/message-scroller.d.ts +30 -0
- package/dist/ui/message.d.ts +33 -0
- package/dist/ui/mfa-challenge.d.ts +3 -32
- package/dist/ui/mfa-challenge.js +1 -1
- package/dist/ui/mfa-setup.d.ts +1 -1
- package/dist/ui/mosaic.d.ts +23 -0
- package/dist/ui/motion-provider.d.ts +17 -0
- package/dist/ui/native-select.d.ts +22 -0
- package/dist/ui/next-step-card.d.ts +55 -0
- package/dist/ui/next-step-card.js +92 -0
- package/dist/ui/notice-review.d.ts +32 -0
- package/dist/ui/oauth-consent.d.ts +1 -1
- package/dist/ui/page-header.d.ts +46 -4
- package/dist/ui/page-header.js +20 -11
- package/dist/ui/page-loader.d.ts +17 -0
- package/dist/ui/page-shell.d.ts +17 -0
- package/dist/ui/pagination.d.ts +20 -0
- package/dist/ui/pagination.js +2 -2
- package/dist/ui/panel.d.ts +1 -1
- package/dist/ui/password-strength.d.ts +14 -0
- package/dist/ui/popover.d.ts +32 -0
- package/dist/ui/proportion-bar.d.ts +25 -0
- package/dist/ui/quantity.d.ts +25 -0
- package/dist/ui/quantity.js +27 -0
- package/dist/ui/questionnaire.d.ts +38 -0
- package/dist/ui/reasoning.d.ts +24 -0
- package/dist/ui/reasoning.js +62 -0
- package/dist/ui/reveal.d.ts +17 -0
- package/dist/ui/sheet.d.ts +39 -2
- package/dist/ui/sheet.js +6 -2
- package/dist/ui/shield.d.ts +14 -0
- package/dist/ui/show-more.d.ts +14 -0
- package/dist/ui/sidebar.d.ts +4 -2
- package/dist/ui/sidebar.js +7 -3
- package/dist/ui/sparkline.d.ts +1 -1
- package/dist/ui/stat-group.d.ts +32 -0
- package/dist/ui/stat.d.ts +1 -1
- package/dist/ui/status-badge.d.ts +3 -3
- package/dist/ui/status-hero.d.ts +18 -0
- package/dist/ui/step-dots.d.ts +12 -0
- package/dist/ui/step-ring.d.ts +14 -0
- package/dist/ui/suggestions.d.ts +17 -0
- package/dist/ui/suggestions.js +39 -0
- package/dist/ui/table.d.ts +26 -0
- package/dist/ui/tag-input.d.ts +21 -0
- package/dist/ui/tag-input.js +169 -0
- package/dist/ui/task-loader.d.ts +15 -0
- package/dist/ui/task-progress.d.ts +14 -0
- package/dist/ui/textarea.d.ts +22 -1
- package/dist/ui/textarea.js +7 -1
- package/dist/ui/timeline.d.ts +26 -0
- package/dist/ui/toggle-group.d.ts +24 -0
- package/dist/ui/tool-call.d.ts +27 -0
- package/dist/ui/tool-call.js +74 -0
- package/dist/ui/usage-meter.d.ts +42 -0
- package/dist/ui/usage-meter.js +116 -0
- package/dist/ui/week-strip.d.ts +11 -0
- package/dist/ui/week-strip.js +2 -2
- package/dist/ui/workflow-run.d.ts +51 -0
- package/dist/ui/workflow-run.js +185 -0
- package/docs/adr/0001-rtl-clases-logicas.md +14 -1
- package/docs/designer/criterio.md +87 -87
- package/docs/designer/flujo.md +1 -1
- package/docs/designer/patrones.md +43 -2
- package/manifest/actions.json +364 -0
- package/manifest/agents.json +399 -0
- package/manifest/ai.json +128 -0
- package/manifest/auth.json +1547 -0
- package/manifest/chat.json +612 -0
- package/manifest/content.json +2298 -0
- package/manifest/data.json +2904 -0
- package/manifest/feedback.json +1005 -0
- package/manifest/forms.json +1954 -0
- package/manifest/motion.json +196 -0
- package/manifest/navigation.json +1792 -0
- package/manifest/overlays.json +931 -0
- package/package.json +35 -21
- package/scripts/cli.mjs +105 -8
- package/scripts/doctor.mjs +126 -1
- package/scripts/eslint-plugin.mjs +93 -0
- package/scripts/i18n.mjs +1 -1
- package/scripts/manifest.mjs +159 -7
- package/skill/SKILL.md +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orbital-ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"description": "Sistema de diseño genérico: estructura común + temas con personalidad (qratia, zyro) + ~60 componentes sobre Base UI y Tailwind v4, con contrato verificable y legible por agentes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -22,12 +22,14 @@
|
|
|
22
22
|
"scripts/doctor.mjs",
|
|
23
23
|
"contract.json",
|
|
24
24
|
"components.manifest.json",
|
|
25
|
+
"manifest",
|
|
25
26
|
"docs",
|
|
26
27
|
"AGENTS.md",
|
|
27
28
|
"README.md",
|
|
28
29
|
"LICENSE",
|
|
29
30
|
"scripts/init.mjs",
|
|
30
31
|
"scripts/cli.mjs",
|
|
32
|
+
"scripts/eslint-plugin.mjs",
|
|
31
33
|
"scripts/skill.mjs",
|
|
32
34
|
"skill",
|
|
33
35
|
"scripts/manifest.mjs",
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"types": "./scripts/brand-core.d.mts",
|
|
61
63
|
"import": "./scripts/brand-core.mjs"
|
|
62
64
|
},
|
|
65
|
+
"./eslint": "./scripts/eslint-plugin.mjs",
|
|
63
66
|
"./package.json": "./package.json",
|
|
64
67
|
"./contract.json": "./contract.json",
|
|
65
68
|
"./components.manifest.json": "./components.manifest.json"
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
"typecheck": "tsc --noEmit",
|
|
71
74
|
"verify": "pnpm check:ds && pnpm check:neutral && pnpm typecheck && pnpm showcase:typecheck && pnpm build && pnpm check:bundle && pnpm check:charts && pnpm check:pack",
|
|
72
75
|
"manifest": "node scripts/manifest.mjs",
|
|
76
|
+
"domains": "node scripts/changed-domains.mjs",
|
|
73
77
|
"check:ds": "node scripts/doctor.mjs",
|
|
74
78
|
"check:bundle": "node scripts/check-bundle.mjs",
|
|
75
79
|
"check:charts": "node scripts/check-charts.mjs",
|
|
@@ -105,75 +109,83 @@
|
|
|
105
109
|
"react": ">=19",
|
|
106
110
|
"react-day-picker": ">=10",
|
|
107
111
|
"react-dom": ">=19",
|
|
112
|
+
"react-markdown": ">=10",
|
|
108
113
|
"react-resizable-panels": ">=4",
|
|
109
114
|
"recharts": ">=3",
|
|
115
|
+
"remark-gfm": ">=4",
|
|
110
116
|
"sonner": ">=2",
|
|
111
117
|
"tailwind-merge": ">=3",
|
|
112
118
|
"tailwindcss": ">=4.1",
|
|
113
119
|
"tw-animate-css": ">=1.3"
|
|
114
120
|
},
|
|
115
121
|
"peerDependenciesMeta": {
|
|
116
|
-
"
|
|
122
|
+
"@shadcn/react": {
|
|
117
123
|
"optional": true
|
|
118
124
|
},
|
|
119
|
-
"
|
|
125
|
+
"@tanstack/react-table": {
|
|
120
126
|
"optional": true
|
|
121
127
|
},
|
|
122
|
-
"
|
|
128
|
+
"@tiptap/core": {
|
|
123
129
|
"optional": true
|
|
124
130
|
},
|
|
125
|
-
"@
|
|
131
|
+
"@tiptap/extension-image": {
|
|
126
132
|
"optional": true
|
|
127
133
|
},
|
|
128
|
-
"
|
|
134
|
+
"@tiptap/extension-placeholder": {
|
|
129
135
|
"optional": true
|
|
130
136
|
},
|
|
131
|
-
"
|
|
137
|
+
"@tiptap/extension-table": {
|
|
132
138
|
"optional": true
|
|
133
139
|
},
|
|
134
|
-
"
|
|
140
|
+
"@tiptap/markdown": {
|
|
135
141
|
"optional": true
|
|
136
142
|
},
|
|
137
|
-
"
|
|
143
|
+
"@tiptap/pm": {
|
|
138
144
|
"optional": true
|
|
139
145
|
},
|
|
140
|
-
"react
|
|
146
|
+
"@tiptap/react": {
|
|
141
147
|
"optional": true
|
|
142
148
|
},
|
|
143
|
-
"
|
|
149
|
+
"@tiptap/starter-kit": {
|
|
144
150
|
"optional": true
|
|
145
151
|
},
|
|
146
|
-
"
|
|
152
|
+
"cmdk": {
|
|
153
|
+
"optional": true
|
|
154
|
+
},
|
|
155
|
+
"date-fns": {
|
|
147
156
|
"optional": true
|
|
148
157
|
},
|
|
149
158
|
"echarts": {
|
|
150
159
|
"optional": true
|
|
151
160
|
},
|
|
152
|
-
"
|
|
161
|
+
"embla-carousel-react": {
|
|
153
162
|
"optional": true
|
|
154
163
|
},
|
|
155
|
-
"
|
|
164
|
+
"input-otp": {
|
|
156
165
|
"optional": true
|
|
157
166
|
},
|
|
158
|
-
"
|
|
167
|
+
"motion": {
|
|
159
168
|
"optional": true
|
|
160
169
|
},
|
|
161
|
-
"
|
|
170
|
+
"next-themes": {
|
|
162
171
|
"optional": true
|
|
163
172
|
},
|
|
164
|
-
"
|
|
173
|
+
"react-day-picker": {
|
|
165
174
|
"optional": true
|
|
166
175
|
},
|
|
167
|
-
"
|
|
176
|
+
"react-markdown": {
|
|
168
177
|
"optional": true
|
|
169
178
|
},
|
|
170
|
-
"
|
|
179
|
+
"react-resizable-panels": {
|
|
171
180
|
"optional": true
|
|
172
181
|
},
|
|
173
|
-
"
|
|
182
|
+
"recharts": {
|
|
174
183
|
"optional": true
|
|
175
184
|
},
|
|
176
|
-
"
|
|
185
|
+
"remark-gfm": {
|
|
186
|
+
"optional": true
|
|
187
|
+
},
|
|
188
|
+
"sonner": {
|
|
177
189
|
"optional": true
|
|
178
190
|
}
|
|
179
191
|
},
|
|
@@ -206,8 +218,10 @@
|
|
|
206
218
|
"react": "^19.2.0",
|
|
207
219
|
"react-day-picker": "^10.0.2",
|
|
208
220
|
"react-dom": "^19.2.0",
|
|
221
|
+
"react-markdown": "^10.1.0",
|
|
209
222
|
"react-resizable-panels": "^4.14.4",
|
|
210
223
|
"recharts": "3.8.0",
|
|
224
|
+
"remark-gfm": "^4.0.1",
|
|
211
225
|
"sonner": "^2.0.8",
|
|
212
226
|
"tailwind-merge": "^3.0.2",
|
|
213
227
|
"tailwindcss": "^4.1.18",
|
package/scripts/cli.mjs
CHANGED
|
@@ -47,8 +47,9 @@ Uso: orbital-ds <orden> [opciones] (sin orden, un menú)
|
|
|
47
47
|
doctor comprobar contrato, contraste, pesos y marca
|
|
48
48
|
i18n textos de orbital-ds en los idiomas de la app
|
|
49
49
|
context resumen de esta app para un agente: tema, marca, componentes y patrones
|
|
50
|
+
components catálogo por dominios: resumen, alternativas, props, notas y ejemplos (--search · --group · <nombre>)
|
|
50
51
|
skill instala o refresca el diseñador de orbital-ds para Claude Code
|
|
51
|
-
help
|
|
52
|
+
help esta ayuda · orbital-ds help <orden> para el detalle
|
|
52
53
|
|
|
53
54
|
Ejemplos
|
|
54
55
|
orbital-ds menú
|
|
@@ -128,6 +129,18 @@ Lo lee el skill «orbital-ds-designer» antes de diseñar, y vale para cualquier
|
|
|
128
129
|
orbital-ds context en texto (markdown)
|
|
129
130
|
orbital-ds context --json en JSON`,
|
|
130
131
|
|
|
132
|
+
components: `orbital-ds components — el catálogo, por páginas de dominio
|
|
133
|
+
|
|
134
|
+
Cada componente pertenece a un dominio (actions, forms, feedback, overlays, navigation, data, content, motion, chat,
|
|
135
|
+
agents, ai, auth). Pide solo lo que necesitas: cada ficha trae resumen (cuándo usarlo), alternativas (cuándo usar
|
|
136
|
+
otro), props tipadas (* = obligatoria), presets, notas de uso y ejemplos mínimos para copiar.
|
|
137
|
+
|
|
138
|
+
orbital-ds components los dominios y sus componentes
|
|
139
|
+
orbital-ds components --group auth todo un dominio
|
|
140
|
+
orbital-ds components --search tabla buscar por intención (nombre, resumen, alternativas y notas)
|
|
141
|
+
orbital-ds components button un componente
|
|
142
|
+
--json en JSON (también en node_modules/orbital-ds/manifest/<dominio>.json)`,
|
|
143
|
+
|
|
131
144
|
skill: `orbital-ds skill — diseñador de orbital-ds para Claude Code
|
|
132
145
|
|
|
133
146
|
Instala (o refresca) el skill «orbital-ds-designer» en la raíz de la app: .claude/skills/orbital-ds-designer/.
|
|
@@ -210,7 +223,7 @@ function contexto(json) {
|
|
|
210
223
|
marca: estado.marca?.activa ? estado.marca : null,
|
|
211
224
|
brandCss: { fichero: existsSync(brand) ? relative(process.cwd(), brand).split(sep).join('/') : null, variables: brandVars, coloresAMano: estado.manual.colores.map((d) => d.name) },
|
|
212
225
|
extras: { animaciones: estado.animaciones, motion: yaInstalado('motion'), echarts: yaInstalado('echarts'), tablas: yaInstalado('@tanstack/react-table') },
|
|
213
|
-
componentes: Object.fromEntries(Object.entries(manifest.components).map(([n, c]) => [n, { import: c.import, exports: c.exports, ...(c.presets ? { presets: c.presets } : {}), ...(c.notes ? { notes: c.notes } : {}) }])),
|
|
226
|
+
componentes: Object.fromEntries(Object.entries(manifest.components).map(([n, c]) => [n, { import: c.import, group: c.group, exports: c.exports, ...(c.summary ? { summary: c.summary } : {}), ...(c.see ? { see: c.see } : {}), ...(c.presets ? { presets: c.presets } : {}), ...(c.notes ? { notes: c.notes } : {}) }])),
|
|
214
227
|
patrones,
|
|
215
228
|
documentacion: {
|
|
216
229
|
reglas: `${docs}/AGENTS.md`,
|
|
@@ -220,6 +233,7 @@ function contexto(json) {
|
|
|
220
233
|
ux: `${docs}/docs/designer/ux.md`,
|
|
221
234
|
revision: `${docs}/docs/designer/revision.md`,
|
|
222
235
|
manifiesto: `${docs}/components.manifest.json`,
|
|
236
|
+
paginas: `${docs}/manifest/<dominio>.json`,
|
|
223
237
|
},
|
|
224
238
|
skill: estadoSkill(raizApp()).estado,
|
|
225
239
|
integracion: avisosIntegracion(estado),
|
|
@@ -245,17 +259,20 @@ function contexto(json) {
|
|
|
245
259
|
if (estado.manual.colores.length) L.push(`- Colores escritos a mano (ganan al tema): ${estado.manual.colores.map((d) => d.name).join(', ')}`);
|
|
246
260
|
const sino = (v) => (v ? 'sí' : 'no');
|
|
247
261
|
L.push('', '## Extras', `- Animaciones del tema: ${sino(datos.extras.animaciones)} · Motion: ${sino(datos.extras.motion)} · ECharts: ${sino(datos.extras.echarts)} · TanStack Table: ${sino(datos.extras.tablas)}`);
|
|
248
|
-
L.push('', `## Componentes (${Object.keys(datos.componentes).length}) · import orbital-ds/ui/<nombre
|
|
262
|
+
L.push('', `## Componentes (${Object.keys(datos.componentes).length}) por dominio · import orbital-ds/ui/<nombre> · ficha: orbital-ds components <nombre>`);
|
|
263
|
+
for (const g of Object.keys(manifest.groups ?? {})) {
|
|
264
|
+
const nombres = Object.entries(datos.componentes).filter(([, c]) => c.group === g).map(([n]) => n);
|
|
265
|
+
if (!nombres.length) continue;
|
|
266
|
+
L.push('', `### ${g}`);
|
|
267
|
+
for (const n of nombres) L.push(`- ${n}: ${datos.componentes[n].summary ?? '—'}`);
|
|
268
|
+
}
|
|
249
269
|
const conPresets = Object.entries(datos.componentes).filter(([, c]) => c.presets);
|
|
250
270
|
if (conPresets.length) {
|
|
251
271
|
L.push('', '### Presets (valor por defecto con *)');
|
|
252
272
|
for (const [n, c] of conPresets) L.push(`- ${n}: ${c.presets.values.map((v) => (v === c.presets.default ? `${v}*` : v)).join(' · ')}`);
|
|
253
273
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
L.push('', '### Notas de uso');
|
|
257
|
-
for (const [n, c] of conNotas) for (const x of c.notes) L.push(`- ${n}: ${x}`);
|
|
258
|
-
}
|
|
274
|
+
// Notas, alternativas y ejemplos de cada uno: en su ficha (orbital-ds components <nombre>), para no cargar las 160 aquí.
|
|
275
|
+
L.push('', 'Antes de usar un componente, lee su ficha: `orbital-ds components <nombre>` (alternativas, props, notas y ejemplos). Buscar por intención: `orbital-ds components --search <texto>`.');
|
|
259
276
|
if (datos.integracion.length) L.push('', '## Avisos de integración', ...datos.integracion.map((a) => `- ${a}`));
|
|
260
277
|
if (patrones.length) L.push('', '## Patrones (docs/designer/patrones.md)', ...patrones.map((p) => `- ${p}`));
|
|
261
278
|
L.push('', '## Documentación', ...Object.entries(datos.documentacion).map(([k, v]) => `- ${k}: ${v}`));
|
|
@@ -269,6 +286,83 @@ function contexto(json) {
|
|
|
269
286
|
console.log(L.join('\n'));
|
|
270
287
|
}
|
|
271
288
|
|
|
289
|
+
/**
|
|
290
|
+
* orbital-ds components [<nombre> | --group <dominio>] [--json]: el catálogo por páginas. Sin argumentos, los dominios;
|
|
291
|
+
* con `--group`, sus componentes con props tipadas, presets y notas; con un nombre, solo ese componente.
|
|
292
|
+
*/
|
|
293
|
+
function ordenComponentes(args) {
|
|
294
|
+
const json = args.includes('--json');
|
|
295
|
+
const gi = args.indexOf('--group');
|
|
296
|
+
const grupo = gi > -1 ? args[gi + 1] : null;
|
|
297
|
+
const nombre = args.includes('--search') ? null : args.find((a, i) => !a.startsWith('--') && args[i - 1] !== '--group');
|
|
298
|
+
const indice = JSON.parse(readFileSync(join(ROOT, 'components.manifest.json'), 'utf8'));
|
|
299
|
+
const salir = (m) => { console.error(m); process.exit(1); };
|
|
300
|
+
const pagina = (g) => {
|
|
301
|
+
const f = join(ROOT, 'manifest', `${g}.json`);
|
|
302
|
+
return existsSync(f) ? JSON.parse(readFileSync(f, 'utf8')) : salir(`No hay página del dominio «${g}». Dominios: ${Object.keys(indice.groups).join(', ')}`);
|
|
303
|
+
};
|
|
304
|
+
const ficha = (n, c) => {
|
|
305
|
+
const L = [`### ${n} · ${c.import}`];
|
|
306
|
+
if (c.summary) L.push(c.summary);
|
|
307
|
+
for (const s of c.see ?? []) L.push(`en su lugar → ${s.component}: ${s.when}`);
|
|
308
|
+
L.push(`exports: ${c.exports.join(', ')}`);
|
|
309
|
+
if (c.presets) L.push(`presets: ${c.presets.values.map((v) => (v === c.presets.default ? `${v}*` : v)).join(' · ')}`);
|
|
310
|
+
for (const [exp, props] of Object.entries(c.props ?? {})) {
|
|
311
|
+
L.push(`props de ${exp}:`);
|
|
312
|
+
for (const [p, d] of Object.entries(props)) L.push(` - ${p}${d.required ? '*' : ''}: ${d.values ? d.values.map((v) => `"${v}"`).join(' | ') : d.type}${d.doc ? ` — ${d.doc}` : ''}`);
|
|
313
|
+
}
|
|
314
|
+
for (const x of c.notes ?? []) L.push(`nota: ${x}`);
|
|
315
|
+
for (const e of c.examples ?? []) L.push(`ejemplo — ${e.title}:`, '```tsx', e.code, '```');
|
|
316
|
+
return L.join('\n');
|
|
317
|
+
};
|
|
318
|
+
// Búsqueda: por nombre, export, resumen, alternativas y notas (sin acentos ni mayúsculas). Para ELEGIR sin leer todo.
|
|
319
|
+
const si = args.indexOf('--search');
|
|
320
|
+
if (si > -1) {
|
|
321
|
+
const llano = (s) => String(s ?? '').normalize('NFD').replace(/\p{M}/gu, '').toLowerCase();
|
|
322
|
+
const terminos = llano(args.slice(si + 1).filter((a) => !a.startsWith('--')).join(' ')).split(/\s+/)
|
|
323
|
+
.filter((t) => t.length > 2 && !/^(?:una?|unos?|las?|los|del|con|para|por|que|toda?s?|the|and|for|with)$/.test(t));
|
|
324
|
+
if (!terminos.length) salir('Uso: orbital-ds components --search <texto>');
|
|
325
|
+
const hits = Object.entries(indice.components)
|
|
326
|
+
.map(([n, c]) => {
|
|
327
|
+
// Raíz de 5 letras al inicio de palabra: «confirmar» encuentra confirm-action y «borrado», «borrar».
|
|
328
|
+
// Sinónimos frecuentes al describir una intención (un agente no sabe qué palabra usa el resumen).
|
|
329
|
+
const SIN = { archivo: 'fichero', fichero: 'archivo', borrar: 'eliminar', eliminar: 'borrar', borrado: 'eliminar', modal: 'dialogo', ventana: 'dialogo', popup: 'dialogo', notificacion: 'aviso', mensaje: 'aviso', grafico: 'chart', grafica: 'chart', desplegable: 'select', cargando: 'carga', spinner: 'carga', kpi: 'cifra' };
|
|
330
|
+
const corta = (t) => t.slice(0, t.length >= 7 ? 5 : t.length >= 5 ? 4 : t.length).replace(/[^a-z0-9]/g, '');
|
|
331
|
+
const raiz = (t) => new RegExp(`(?:^|[^a-z0-9])(?:${[t, SIN[t]].filter(Boolean).map(corta).join('|')})`);
|
|
332
|
+
const nombreExp = llano([n.replace(/-/g, ' '), ...c.exports.map((e) => e.replace(/([a-z])([A-Z])/g, '$1 $2'))].join(' '));
|
|
333
|
+
const resumen = llano(c.summary);
|
|
334
|
+
const resto = llano([...(c.see ?? []).map((s) => s.when), ...(c.notes ?? [])].join(' '));
|
|
335
|
+
let cubiertos = 0;
|
|
336
|
+
const puntos = terminos.reduce((p, t) => {
|
|
337
|
+
const r = raiz(t);
|
|
338
|
+
const q = (r.test(nombreExp) ? 4 : 0) + (r.test(resumen) ? 2 : 0) + (r.test(resto) ? 1 : 0);
|
|
339
|
+
if (q) cubiertos++;
|
|
340
|
+
return p + q;
|
|
341
|
+
}, 0) + (cubiertos > 1 ? cubiertos * 3 : 0);
|
|
342
|
+
return { n, c, puntos };
|
|
343
|
+
})
|
|
344
|
+
.filter((h) => h.puntos > 0)
|
|
345
|
+
.sort((a, b) => b.puntos - a.puntos || a.n.localeCompare(b.n))
|
|
346
|
+
.slice(0, 12);
|
|
347
|
+
if (json) return console.log(JSON.stringify(hits.map(({ n, c }) => ({ name: n, import: c.import, group: c.group, summary: c.summary ?? null })), null, 2));
|
|
348
|
+
if (!hits.length) return console.log('Sin resultados. Prueba otras palabras o `orbital-ds components` para ver los dominios.');
|
|
349
|
+
return console.log([`# Búsqueda: ${terminos.join(' ')} (detalle: orbital-ds components <nombre>)`, '', ...hits.map(({ n, c }) => `- ${n} (${c.group}): ${c.summary ?? '—'}`)].join('\n'));
|
|
350
|
+
}
|
|
351
|
+
if (nombre) {
|
|
352
|
+
const g = indice.components[nombre]?.group ?? salir(`No existe el componente «${nombre}».`);
|
|
353
|
+
const c = pagina(g).components[nombre];
|
|
354
|
+
return json ? console.log(JSON.stringify({ [nombre]: c }, null, 2)) : console.log(ficha(nombre, c));
|
|
355
|
+
}
|
|
356
|
+
if (grupo) {
|
|
357
|
+
const p = pagina(grupo);
|
|
358
|
+
return json ? console.log(JSON.stringify(p, null, 2)) : console.log([`# ${grupo} — ${p.about}`, '', ...Object.entries(p.components).map(([n, c]) => ficha(n, c))].join('\n\n'));
|
|
359
|
+
}
|
|
360
|
+
const cuenta = {};
|
|
361
|
+
for (const c of Object.values(indice.components)) (cuenta[c.group] ??= []).push(c.import.split('/').pop());
|
|
362
|
+
if (json) return console.log(JSON.stringify(Object.fromEntries(Object.entries(indice.groups).map(([g, about]) => [g, { about, components: cuenta[g] ?? [] }])), null, 2));
|
|
363
|
+
console.log(['# Dominios de orbital-ds (orbital-ds components --group <dominio> · orbital-ds components <nombre>)', '', ...Object.entries(indice.groups).map(([g, about]) => `- ${g} (${(cuenta[g] ?? []).length}): ${about}\n ${(cuenta[g] ?? []).join(', ')}`)].join('\n'));
|
|
364
|
+
}
|
|
365
|
+
|
|
272
366
|
/** orbital-ds skill [--check | --print] */
|
|
273
367
|
function ordenSkill(args) {
|
|
274
368
|
if (args.includes('--print')) return console.log(readFileSync(join(ROOT, 'skill', 'SKILL.md'), 'utf8').replaceAll('{{VERSION}}', version));
|
|
@@ -438,6 +532,9 @@ switch (orden) {
|
|
|
438
532
|
case 'context':
|
|
439
533
|
contexto(resto.includes('--json'));
|
|
440
534
|
break;
|
|
535
|
+
case 'components':
|
|
536
|
+
ordenComponentes(resto);
|
|
537
|
+
break;
|
|
441
538
|
case 'skill':
|
|
442
539
|
ordenSkill(resto);
|
|
443
540
|
break;
|
package/scripts/doctor.mjs
CHANGED
|
@@ -535,7 +535,18 @@ const uiDir = join(ROOT, 'src/ui');
|
|
|
535
535
|
if (existsSync(uiDir)) {
|
|
536
536
|
for (const f of readdirSync(uiDir).filter((n) => n.endsWith('.tsx'))) {
|
|
537
537
|
const lines = read(join(uiDir, f)).split(/\r?\n/);
|
|
538
|
+
// La ficha (bloque /** … @summary … */) es documentación: sus @example son JSX de la APP (con sus
|
|
539
|
+
// textos), no código del componente. Se salta entera; la comprobación de fichas la valida aparte.
|
|
540
|
+
const ficha = new Set();
|
|
541
|
+
for (let a = 0; a < lines.length; a++) {
|
|
542
|
+
if (!/^\s*\/\*\*/.test(lines[a])) continue;
|
|
543
|
+
let b = a;
|
|
544
|
+
while (b < lines.length && !lines[b].includes('*/')) b++;
|
|
545
|
+
if (lines.slice(a, b + 1).some((l) => /@summary\b/.test(l))) for (let k = a; k <= b; k++) ficha.add(k);
|
|
546
|
+
a = b;
|
|
547
|
+
}
|
|
538
548
|
lines.forEach((line, i) => {
|
|
549
|
+
if (ficha.has(i)) return;
|
|
539
550
|
const code = line.replace(/\/\/.*$/, '');
|
|
540
551
|
for (const rule of NO_HARDCODE) {
|
|
541
552
|
if (rule.skip?.includes(f)) continue;
|
|
@@ -583,6 +594,80 @@ if (existsSync(uiDir)) {
|
|
|
583
594
|
}
|
|
584
595
|
});
|
|
585
596
|
}
|
|
597
|
+
// Props de los componentes de orbital-ds usados en las vistas, contra las props tipadas del manifiesto por dominio:
|
|
598
|
+
// `asChild` (no existe: es `render`), un valor fuera de la unión (variant="primary") y un nombre casi igual a uno propio.
|
|
599
|
+
const indiceFile = join(ROOT, 'components.manifest.json');
|
|
600
|
+
if (existsSync(indiceFile)) {
|
|
601
|
+
const indice = JSON.parse(read(indiceFile)).components;
|
|
602
|
+
const paginas = {};
|
|
603
|
+
const propsDe = (modulo, exp) => {
|
|
604
|
+
const c = indice[modulo];
|
|
605
|
+
if (!c) return null;
|
|
606
|
+
const f = join(ROOT, 'manifest', `${c.group}.json`);
|
|
607
|
+
if (!(c.group in paginas)) paginas[c.group] = existsSync(f) ? JSON.parse(read(f)).components : null;
|
|
608
|
+
return paginas[c.group]?.[modulo]?.props?.[exp] ?? null;
|
|
609
|
+
};
|
|
610
|
+
const COMUNES = new Set(['className', 'children', 'key', 'ref', 'style', 'id', 'render', 'title', 'role', 'type', 'name', 'value', 'defaultValue', 'disabled', 'hidden', 'tabIndex', 'lang', 'dir', 'slot', 'form', 'href', 'src', 'alt', 'open', 'defaultOpen', 'checked', 'defaultChecked', 'placeholder', 'required', 'readOnly', 'autoFocus', 'autoComplete', 'htmlFor', 'width', 'height', 'target', 'rel']);
|
|
611
|
+
const distancia = (a, b) => {
|
|
612
|
+
const d = Array.from({ length: a.length + 1 }, (_, x) => [x, ...Array(b.length).fill(0)]);
|
|
613
|
+
for (let y = 1; y <= b.length; y++) d[0][y] = y;
|
|
614
|
+
for (let x = 1; x <= a.length; x++) for (let y = 1; y <= b.length; y++) d[x][y] = Math.min(d[x - 1][y] + 1, d[x][y - 1] + 1, d[x - 1][y - 1] + (a[x - 1] === b[y - 1] ? 0 : 1));
|
|
615
|
+
return d[a.length][b.length];
|
|
616
|
+
};
|
|
617
|
+
/** Atributos de una etiqueta JSX a partir de `pos` (tras el nombre): [{nombre, literal}] y la línea. */
|
|
618
|
+
const atributos = (src, pos) => {
|
|
619
|
+
const out = [];
|
|
620
|
+
let k = pos;
|
|
621
|
+
while (k < src.length) {
|
|
622
|
+
const ch = src[k];
|
|
623
|
+
if (ch === '>' || (ch === '/' && src[k + 1] === '>')) break;
|
|
624
|
+
if (ch === '{') { let n = 1; k++; while (k < src.length && n) { if (src[k] === '{') n++; else if (src[k] === '}') n--; k++; } continue; }
|
|
625
|
+
const m = /^[A-Za-z_][\w:-]*/.exec(src.slice(k, k + 80));
|
|
626
|
+
if (!m) { k++; continue; }
|
|
627
|
+
const nombre = m[0];
|
|
628
|
+
k += nombre.length;
|
|
629
|
+
let literal = null;
|
|
630
|
+
if (src[k] === '=') {
|
|
631
|
+
k++;
|
|
632
|
+
if (src[k] === '"' || src[k] === "'") { const q = src[k]; const e = src.indexOf(q, k + 1); literal = src.slice(k + 1, e); k = e + 1; }
|
|
633
|
+
else if (src[k] === '{') { let n = 1, j = k + 1; while (j < src.length && n) { if (src[j] === '{') n++; else if (src[j] === '}') n--; j++; } const lit = /^\{\s*(?:"([^"]*)"|'([^']*)')\s*\}$/.exec(src.slice(k, j)); if (lit) literal = lit[1] ?? lit[2]; k = j; }
|
|
634
|
+
}
|
|
635
|
+
out.push({ nombre, literal, pos: k });
|
|
636
|
+
}
|
|
637
|
+
return out;
|
|
638
|
+
};
|
|
639
|
+
let revisadas = 0;
|
|
640
|
+
for (const f of ficheros) {
|
|
641
|
+
const src = read(f).replace(/\r\n/g, '\n');
|
|
642
|
+
const locales = {};
|
|
643
|
+
for (const m of src.matchAll(/import\s*\{([^}]*)\}\s*from\s*["']orbital-ds\/ui\/([\w-]+)["']/g)) {
|
|
644
|
+
for (const parte of m[1].split(',')) {
|
|
645
|
+
const [orig, alias] = parte.trim().split(/\s+as\s+/);
|
|
646
|
+
if (orig && /^[A-Z]/.test(orig)) locales[alias ?? orig] = { modulo: m[2], exp: orig };
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const donde = (pos) => `${f.replace(process.cwd(), '.').split('\\').join('/')}:${src.slice(0, pos).split('\n').length}`;
|
|
650
|
+
for (const m of src.matchAll(/<([A-Z]\w*)(?=[\s/>])/g)) {
|
|
651
|
+
const def = locales[m[1]];
|
|
652
|
+
if (!def) continue;
|
|
653
|
+
const props = propsDe(def.modulo, def.exp);
|
|
654
|
+
for (const a of atributos(src, m.index + m[0].length)) {
|
|
655
|
+
if (a.nombre === 'asChild') { errors.push(`ui ${donde(a.pos)}: <${m[1]} asChild> no existe en orbital-ds (Base UI usa la prop \`render\`)`); continue; }
|
|
656
|
+
if (!props) continue;
|
|
657
|
+
const d = props[a.nombre];
|
|
658
|
+
if (d) {
|
|
659
|
+
if (a.literal != null && d.values && !d.values.includes(a.literal)) errors.push(`ui ${donde(a.pos)}: <${m[1]} ${a.nombre}="${a.literal}"> no es válido; valores: ${d.values.join(' | ')}`);
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
if (COMUNES.has(a.nombre) || /^(?:data-|aria-|on[A-Z])/.test(a.nombre)) continue;
|
|
663
|
+
const cerca = Object.keys(props).find((p) => distancia(p.toLowerCase(), a.nombre.toLowerCase()) <= 2);
|
|
664
|
+
if (cerca) warnings.push(`ui ${donde(a.pos)}: <${m[1]} ${a.nombre}> no es una prop de orbital-ds; ¿querías decir «${cerca}»? (orbital-ds components ${def.modulo})`);
|
|
665
|
+
}
|
|
666
|
+
revisadas++;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (revisadas) console.log(`ui: ${revisadas} uso(s) de componentes comprobados contra sus props tipadas`);
|
|
670
|
+
}
|
|
586
671
|
if (ficheros.length) console.log(`ui: ${ficheros.length} fichero(s) revisados en ${process.argv[i + 1]}`);
|
|
587
672
|
}
|
|
588
673
|
}
|
|
@@ -590,9 +675,41 @@ if (existsSync(uiDir)) {
|
|
|
590
675
|
// 6) API pública frente a la huella commiteada
|
|
591
676
|
const manifestPath = join(ROOT, 'components.manifest.json');
|
|
592
677
|
if (existsSync(manifestPath) && existsSync(uiDir)) {
|
|
593
|
-
const { buildManifest } = await import('./manifest.mjs');
|
|
678
|
+
const { buildManifest, GROUPS } = await import('./manifest.mjs');
|
|
594
679
|
const before = JSON.parse(read(manifestPath)).components;
|
|
595
680
|
const now = buildManifest().components;
|
|
681
|
+
// Dominio: cada componente declara `/** @group <dominio> */` y su demo vive en la sección homónima del escaparate.
|
|
682
|
+
for (const [name, comp] of Object.entries(now)) {
|
|
683
|
+
if (!comp.group || !GROUPS[comp.group]) {
|
|
684
|
+
errors.push(`Dominio: «${name}» necesita \`/** @group <dominio> */\` con uno de: ${Object.keys(GROUPS).join(', ')}`);
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
687
|
+
const demo = join(ROOT, 'showcase/src/demos', `${name}.tsx`);
|
|
688
|
+
const label = existsSync(demo) ? read(demo).match(/group:\s*"([^"]+)"/)?.[1] : null;
|
|
689
|
+
if (label && label !== GROUPS[comp.group].label) {
|
|
690
|
+
errors.push(`Dominio: «${name}» es «${comp.group}» (${GROUPS[comp.group].label}) pero su demo está en «${label}»`);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
// Ficha para agentes (cabecera JSDoc, ver scripts/manifest.mjs › parseDoc): `@summary` para ELEGIR, `@example` para
|
|
694
|
+
// COPIAR bien y `@see` hacia componentes que existen. Sin ella, un agente adivina entre piezas parecidas.
|
|
695
|
+
for (const [name, comp] of Object.entries(now)) {
|
|
696
|
+
if (!comp.summary) errors.push(`Ficha: «${name}» necesita \`@summary\` (una línea: qué es y cuándo usarlo) en su cabecera`);
|
|
697
|
+
else if (comp.summary.length > 220) warnings.push(`Ficha: el @summary de «${name}» pasa de 220 caracteres; el detalle va en @note`);
|
|
698
|
+
if (!comp.examples?.length) errors.push(`Ficha: «${name}» necesita al menos un \`@example <título>\` con JSX mínimo en su cabecera`);
|
|
699
|
+
const tags = comp.exports.filter((e) => /^[A-Z]/.test(e));
|
|
700
|
+
for (const ex of comp.examples ?? []) {
|
|
701
|
+
if (!ex.title) errors.push(`Ficha: un @example de «${name}» no tiene título (una sola idea: «Acción principal y secundaria»)`);
|
|
702
|
+
if (tags.length && !tags.some((t) => new RegExp(`<${t}[\\s/>.]`).test(ex.code) || ex.code.includes(`${t}(`))) {
|
|
703
|
+
errors.push(`Ficha: el @example «${ex.title}» de «${name}» no usa ninguno de sus exports (${tags.join(', ')})`);
|
|
704
|
+
}
|
|
705
|
+
if (/asChild/.test(ex.code)) errors.push(`Ficha: el @example «${ex.title}» de «${name}» usa asChild (es render)`);
|
|
706
|
+
}
|
|
707
|
+
for (const s of comp.see ?? []) {
|
|
708
|
+
if (!now[s.component]) errors.push(`Ficha: «${name}» remite con @see a «${s.component}», que no existe`);
|
|
709
|
+
else if (s.component === name) errors.push(`Ficha: «${name}» se remite a sí mismo con @see`);
|
|
710
|
+
if (!s.when) warnings.push(`Ficha: el @see ${s.component} de «${name}» no dice cuándo usarlo en su lugar`);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
596
713
|
for (const [name, comp] of Object.entries(before)) {
|
|
597
714
|
if (!now[name]) {
|
|
598
715
|
errors.push(`API pública: desaparece el componente «${name}» (¿versión mayor? regenera con pnpm manifest)`);
|
|
@@ -604,6 +721,14 @@ if (existsSync(manifestPath) && existsSync(uiDir)) {
|
|
|
604
721
|
}
|
|
605
722
|
}
|
|
606
723
|
}
|
|
724
|
+
// Páginas por dominio (`manifest/<dominio>.json`): una por dominio y con los mismos componentes que el código.
|
|
725
|
+
for (const [g, nombres] of Object.entries(Object.groupBy(Object.keys(now), (n) => now[n].group))) {
|
|
726
|
+
const f = join(ROOT, 'manifest', `${g}.json`);
|
|
727
|
+
const pagina = existsSync(f) ? Object.keys(JSON.parse(read(f)).components) : null;
|
|
728
|
+
if (!pagina || pagina.length !== nombres.length || nombres.some((n) => !pagina.includes(n))) {
|
|
729
|
+
errors.push(`Manifiesto: la página «manifest/${g}.json» está ${pagina ? 'desfasada' : 'sin generar'}; ejecuta pnpm manifest`);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
607
732
|
const added = Object.keys(now).filter((n) => !before[n]);
|
|
608
733
|
if (added.length) warnings.push(`API pública: componentes nuevos sin registrar en el manifiesto (${added.join(', ')}); ejecuta pnpm manifest`);
|
|
609
734
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin de ESLint de orbital-ds (config plana, sin dependencias): en la app solo se usan los componentes y las
|
|
3
|
+
* variables del sistema. Es la versión «en el editor» de lo que ya comprueba `orbital-ds doctor --ui`.
|
|
4
|
+
*
|
|
5
|
+
* // eslint.config.js
|
|
6
|
+
* import orbital from "orbital-ds/eslint";
|
|
7
|
+
* export default [orbital.configs.recommended];
|
|
8
|
+
*
|
|
9
|
+
* Reglas:
|
|
10
|
+
* orbital-ds/no-as-child `asChild` no existe (motor Base UI): se usa `render`.
|
|
11
|
+
* orbital-ds/system-styles en `className`, `cn()`, `clsx()` y `cva()`: nada de colores, z-index, duraciones,
|
|
12
|
+
* sombras de la escala Tailwind, paleta Tailwind ni px sueltos; usa tokens (`--ds-*`).
|
|
13
|
+
* orbital-ds/logical-direction clases lógicas (`ms-`, `ps-`, `text-start`…) en lugar de las físicas (RTL).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const STYLE_RULES = [
|
|
17
|
+
[/#[0-9a-fA-F]{3,8}\b/, 'color hexadecimal'],
|
|
18
|
+
[/\b(?:rgb|rgba|hsl|hsla|oklch)\((?!from_)/, 'color literal'],
|
|
19
|
+
[/(?<![\w-])z-(?!0(?![\w-]))\d+(?![\w-])/, 'z-index numérico (usa --ds-z-*)'],
|
|
20
|
+
[/(?<![\w-])duration-(?!0(?![\w-]))\d+(?![\w-])/, 'duración fija (usa --ds-motion-*)'],
|
|
21
|
+
[/(?<![\w-])ease-\[(?:cubic-bezier|steps)\(/, 'curva escrita (usa ease-(--ds-ease-*))'],
|
|
22
|
+
[/(?<![\w-])(?:bg|text|border)-(?:black|white)(?:\/\d+)?(?![\w-])/, 'color fijo (usa un token de color)'],
|
|
23
|
+
[/(?<![\w-])shadow-(?:xs|sm|md|lg|xl|2xl)(?![\w-])/, 'sombra de la escala Tailwind (usa shadow-card/control/raised/overlay/popover)'],
|
|
24
|
+
[/(?<![\w-])text-\[\d+px\]/, 'tamaño de texto en px (usa la escala estándar)'],
|
|
25
|
+
[/@\[\d+px\]/, 'container query en px (usa rem)'],
|
|
26
|
+
[/(?<![\w-])(?:bg|text|border|ring|fill|stroke)-(?:red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone)-\d{2,3}(?![\w-])/, 'color de la paleta Tailwind (usa tokens de color)'],
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const PHYSICAL = /(?<![\w])-?(?:ml|mr|pl|pr)-(?=[\w[(.])|(?<![\w-])text-(?:left|right)(?![\w-])|(?<![\w-])(?:border|rounded)-[lr](?![\w])/;
|
|
30
|
+
|
|
31
|
+
const CLASS_HELPERS = new Set(['cn', 'clsx', 'cva', 'twMerge', 'classNames']);
|
|
32
|
+
|
|
33
|
+
/** ¿Está este literal dentro de un `className` / `class` o de una llamada a `cn()`, `clsx()`…? */
|
|
34
|
+
function inClassContext(node) {
|
|
35
|
+
for (let p = node.parent; p; p = p.parent) {
|
|
36
|
+
if (p.type === 'JSXAttribute') return p.name?.name === 'className' || p.name?.name === 'class';
|
|
37
|
+
if (p.type === 'CallExpression' && p.callee.type === 'Identifier' && CLASS_HELPERS.has(p.callee.name)) return true;
|
|
38
|
+
if (p.type === 'JSXElement' || p.type === 'FunctionDeclaration' || p.type === 'Program') return false;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Regla que busca patrones en los textos de clase. */
|
|
44
|
+
function classRule(patterns, description) {
|
|
45
|
+
return {
|
|
46
|
+
meta: { type: 'problem', docs: { description }, schema: [], messages: { bad: '{{why}}' } },
|
|
47
|
+
create(context) {
|
|
48
|
+
const check = (node, text) => {
|
|
49
|
+
if (!text || !inClassContext(node)) return;
|
|
50
|
+
for (const [re, why] of patterns) if (re.test(text)) context.report({ node, messageId: 'bad', data: { why } });
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
Literal: (n) => typeof n.value === 'string' && check(n, n.value),
|
|
54
|
+
TemplateElement: (n) => check(n, n.value.cooked ?? n.value.raw),
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const rules = {
|
|
61
|
+
'no-as-child': {
|
|
62
|
+
meta: {
|
|
63
|
+
type: 'problem',
|
|
64
|
+
docs: { description: '`asChild` no existe en orbital-ds (Base UI): usa `render`.' },
|
|
65
|
+
schema: [],
|
|
66
|
+
messages: { bad: '`asChild` no existe en orbital-ds: usa la prop `render` (p. ej. render={<a href="…" />}).' },
|
|
67
|
+
},
|
|
68
|
+
create: (context) => ({
|
|
69
|
+
JSXAttribute(n) {
|
|
70
|
+
if (n.name?.name === 'asChild') context.report({ node: n, messageId: 'bad' });
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
'system-styles': classRule(STYLE_RULES, 'Solo variables y utilidades del sistema: sin colores, z-index ni duraciones fijos.'),
|
|
75
|
+
'logical-direction': classRule(
|
|
76
|
+
[[PHYSICAL, 'clase física de dirección (usa ms-/me-/ps-/pe-, text-start/end, border-s/e, rounded-s/e: soporte RTL)']],
|
|
77
|
+
'Clases lógicas de dirección para que la interfaz funcione en RTL.',
|
|
78
|
+
),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const plugin = { meta: { name: 'orbital-ds' }, rules, configs: {} };
|
|
82
|
+
plugin.configs.recommended = {
|
|
83
|
+
files: ['**/*.{jsx,tsx}'],
|
|
84
|
+
plugins: { 'orbital-ds': plugin },
|
|
85
|
+
rules: {
|
|
86
|
+
'orbital-ds/no-as-child': 'error',
|
|
87
|
+
'orbital-ds/system-styles': 'error',
|
|
88
|
+
'orbital-ds/logical-direction': 'warn',
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default plugin;
|
|
93
|
+
export { rules };
|
package/scripts/i18n.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Qué hace, por cada <idioma>.json de la carpeta:
|
|
13
13
|
* - Añade las claves que FALTEN en su espacio «orbital», con el texto de orbital-ds para ese
|
|
14
|
-
* idioma (en, es, pt-BR incluidos; `es-CO` usa `es`). Nunca pisa lo que la app ya tenga.
|
|
14
|
+
* idioma (en, es, pt-BR, fr, it, de y he incluidos; `es-CO` usa `es`). Nunca pisa lo que la app ya tenga.
|
|
15
15
|
* - Si orbital-ds no trae ese idioma (p. ej. `ru`), pone el inglés y lo lista como
|
|
16
16
|
* PENDIENTE DE TRADUCIR: el agente o la persona lo traduce en el JSON.
|
|
17
17
|
* - Avisa de claves que sobran (orbital-ds ya no las usa).
|