libreria-astro-lefebvre 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/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # libreria-astro-lefebvre
2
+
3
+ Instrucciones:
4
+
5
+ - La libreria en npm está en: https://www.npmjs.com/package/libreria-astro-lefebvre
6
+ - Para instalar:
7
+ ```
8
+ npm i libreria-astro-lefebvre
9
+ ```
10
+
11
+
12
+ Hacer un link en librería local:
13
+ ``` npm link ```
14
+
15
+ Usar librería local:
16
+ ``` npm link nombre-librería ```
17
+
18
+ Dejar de usar librería local:
19
+ ```npm unlink --no-save nombre-librería```
20
+
21
+ Login en npm:
22
+ ```npm login --auth-type=legacy```
23
+
24
+ Publicar en npm:
25
+ ```npm publish --access public```
26
+
27
+ Cuenta nodejs:
28
+ dretamal
29
+ P...a
30
+
31
+ Hay que hacer npm install y reiniciar server
32
+
33
+ Correr aplicación node:
34
+ ``` npm run dev ```
35
+
36
+ Compilar:
37
+ ```npm run build```
38
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libreria-astro-lefebvre",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Librería de componentes Astro, React y Vue para Lefebvre",
5
5
  "author": "Equipo web desarrollo Lefebvre",
6
6
  "type": "module",
@@ -19,5 +19,8 @@
19
19
  ],
20
20
  "peerDependencies": {
21
21
  "astro": "^5.11.0"
22
+ },
23
+ "scripts": {
24
+ "generate:registry": "node scripts/generateRegistry.js"
22
25
  }
23
26
  }
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { ComponentMetadata } from '../interfaces/types';
3
+
4
+ export const metadata: ComponentMetadata = {
5
+ component_name: 'Button',
6
+ name: 'Botón en Astro',
7
+ description: 'Botón de prueba en Astro',
8
+ framework: 'Astro',
9
+ priority: 1,
10
+ tags: ['boton', 'interactivo', 'ejemplo'],
11
+ };
@@ -0,0 +1,10 @@
1
+ ---
2
+ import type { ComponentMetadata } from '../interfaces/types';
3
+
4
+ export const metadata: ComponentMetadata = {
5
+ component_name: 'ReactButton',
6
+ name: 'Botón en React',
7
+ description: 'Botón de prueba en React',
8
+ framework: 'React',
9
+ tags: ['boton', 'interactivo', 'ejemplo'],
10
+ };
@@ -0,0 +1,11 @@
1
+ ---
2
+ import type { ComponentMetadata } from '../interfaces/types';
3
+
4
+ export const metadata: ComponentMetadata = {
5
+ component_name: 'VueButton',
6
+ name: 'Botón en Vue',
7
+ description: 'Botón de prueba en Vue',
8
+ framework: 'Vue',
9
+ priority: 2,
10
+ tags: ['boton', 'interactivo', 'ejemplo'],
11
+ };
@@ -0,0 +1,6 @@
1
+ ---
2
+
3
+ const { label } = Astro.props;
4
+
5
+ ---
6
+ <button class="btn bg-cyan-600 text-gray-200 p-2 rounded-lg font-bold m-4 cursor-pointer transition-colors duration-300 hover:bg-red-600">{label}</button>
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+
3
+ const ReactButton = ({ label, onClick, type = 'button', disabled = false }) => (
4
+ <button className="bg-yellow-400 text-black p-2 rounded-lg font-bold m-4 cursor-pointer transition-colors duration-300 hover:bg-orange-600" type={type} onClick={onClick} disabled={disabled}>
5
+ {label}
6
+ </button>
7
+ );
8
+
9
+ export default ReactButton;
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <button class="bg-green-400 text-black p-2 rounded-lg font-bold m-4 cursor-pointer transition-colors duration-300 hover:bg-yellow-300">
3
+ <slot>{{ label }}</slot>
4
+ </button>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'VueButton',
10
+ props: {
11
+ label: {
12
+ type: String,
13
+ required: false,
14
+ default: ''
15
+ }
16
+ }
17
+ }
18
+ </script>
@@ -0,0 +1,10 @@
1
+ // FICHERO GENERADO AUTOMÁTICAMENTE usando esto: "npm run generate:registry" ==> NO TOCAR ESTO A MANO (o sus crujo) !!
2
+ import * as AstroButton from '../carbins/AstroButton.astro';
3
+ import * as ReactButton from '../carbins/ReactButton.astro';
4
+ import * as VueButton from '../carbins/VueButton.astro';
5
+
6
+ export const components = [
7
+ {component: AstroButton},
8
+ {component: ReactButton},
9
+ {component: VueButton},
10
+ ];
package/src/index.ts CHANGED
@@ -1,2 +1,4 @@
1
- export { default as Button } from './components/Button.astro';
2
- // export { default as Card } from './components/Card.astro';
1
+ export { default as Button } from './components/Astro/Button.astro';
2
+ export { default as Button2 } from './components/React/ReactButton.jsx';
3
+ export { default as Button3 } from './components/Vue/VueButton.vue';
4
+ export { listComponents } from './lib/functions.js';
@@ -0,0 +1,10 @@
1
+ export interface ComponentMetadata {
2
+ name: string;
3
+ description: string;
4
+ framework: 'Astro' | 'Vue' | 'React';
5
+ component_name: string,
6
+ priority?: number;
7
+ tags?: string[];
8
+ /* dependencies?: Record<string, string>; */
9
+ [key: string]: any; // para extensibilidad
10
+ }
@@ -0,0 +1,15 @@
1
+ import { components } from '../generated/componentRegistry.ts';
2
+
3
+ export function listComponents() {
4
+ const metadatas = components
5
+ .map(c => c.component.metadata)
6
+ .sort((a, b) => {
7
+ const priorityA = a.priority ?? 0;
8
+ const priorityB = b.priority ?? 0;
9
+ if (priorityA !== priorityB) {
10
+ return priorityB - priorityA; // Higher priority first
11
+ }
12
+ return (a.name || '').localeCompare(b.name || ''); // Alphabetically by name
13
+ });
14
+ return metadatas;
15
+ }
@@ -1,14 +0,0 @@
1
- ---
2
- const { label } = Astro.props;
3
- ---
4
- <button class="btn">{label}</button>
5
-
6
- <style>
7
- .btn {
8
- padding: 0.5em 1em;
9
- background-color: pink;
10
- color: white;
11
- border: none;
12
- border-radius: 4px;
13
- }
14
- </style>