chispa 0.1.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 +108 -0
- package/dist/html-compiler/cli.d.ts +1 -0
- package/dist/html-compiler/cli.js +300 -0
- package/dist/html-compiler/cli.js.map +1 -0
- package/dist/html-compiler/vite-plugin.d.ts +14 -0
- package/dist/html-compiler/vite-plugin.js +335 -0
- package/dist/html-compiler/vite-plugin.js.map +1 -0
- package/dist/index.d.ts +150 -0
- package/dist/index.js +551 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# chispa
|
|
2
|
+
|
|
3
|
+
**Chispa** es un framework de interfaz de usuario (UI) totalmente declarativo y reactivo para construir aplicaciones web modernas. Se centra en la simplicidad, el rendimiento y una gestión del estado intuitiva mediante señales (signals).
|
|
4
|
+
|
|
5
|
+
## Características
|
|
6
|
+
|
|
7
|
+
- ⚡ **Reactividad Fina**: Basado en Signals para actualizaciones precisas y eficientes del DOM.
|
|
8
|
+
- 🧩 **Componentes Funcionales**: Crea componentes reutilizables con funciones simples.
|
|
9
|
+
- 📄 **Plantillas HTML**: Separa la lógica de la vista importando archivos HTML directamente.
|
|
10
|
+
- 🛠️ **Integración con Vite**: Incluye un plugin de Vite para una experiencia de desarrollo fluida.
|
|
11
|
+
- 📦 **Ligero**: Sin dependencias pesadas en tiempo de ejecución.
|
|
12
|
+
|
|
13
|
+
## Instalación
|
|
14
|
+
|
|
15
|
+
Instala `chispa` en tu proyecto:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install chispa
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Configuración (Vite)
|
|
22
|
+
|
|
23
|
+
Para usar las plantillas HTML, necesitas configurar el plugin de Chispa en tu `vite.config.ts`:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { defineConfig } from 'vite';
|
|
27
|
+
import { chispaHtmlPlugin } from 'chispa';
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
plugins: [chispaHtmlPlugin()],
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Uso Básico
|
|
35
|
+
|
|
36
|
+
### 1. Crear un Componente
|
|
37
|
+
|
|
38
|
+
Chispa permite definir la estructura de tu componente en un archivo HTML y la lógica en TypeScript.
|
|
39
|
+
|
|
40
|
+
**my-component.html**
|
|
41
|
+
Usa el atributo `data-cb` para marcar elementos que serán controlados por tu código.
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<div class="my-app">
|
|
45
|
+
<h1>Contador: <span data-cb="countDisplay">0</span></h1>
|
|
46
|
+
<button data-cb="incrementBtn">Incrementar</button>
|
|
47
|
+
</div>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**my-component.ts**
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { component, signal } from 'chispa';
|
|
54
|
+
import tpl from './my-component.html'; // Importa el HTML procesado
|
|
55
|
+
|
|
56
|
+
export const MyComponent = component(() => {
|
|
57
|
+
// Estado reactivo
|
|
58
|
+
const count = signal(0);
|
|
59
|
+
|
|
60
|
+
// Retorna el fragmento enlazando los elementos del HTML
|
|
61
|
+
return tpl.fragment({
|
|
62
|
+
// Enlaza el contenido del span con la señal
|
|
63
|
+
countDisplay: { inner: count },
|
|
64
|
+
|
|
65
|
+
// Enlaza el evento click del botón
|
|
66
|
+
incrementBtn: {
|
|
67
|
+
onclick: () => count.update((v) => v + 1),
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2. Montar la Aplicación
|
|
74
|
+
|
|
75
|
+
**main.ts**
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { appendChild } from 'chispa';
|
|
79
|
+
import { MyComponent } from './my-component';
|
|
80
|
+
|
|
81
|
+
appendChild(document.body, MyComponent());
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## API Principal
|
|
85
|
+
|
|
86
|
+
### Reactividad
|
|
87
|
+
|
|
88
|
+
- **`signal(initialValue)`**: Crea una señal reactiva.
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
const count = signal(0);
|
|
92
|
+
console.log(count.get()); // Leer valor
|
|
93
|
+
count.set(5); // Establecer valor
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- **`computed(() => ...)`**: Crea una señal derivada que se actualiza automáticamente cuando sus dependencias cambian.
|
|
97
|
+
```typescript
|
|
98
|
+
const double = computed(() => count.get() * 2);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Componentes
|
|
102
|
+
|
|
103
|
+
- **`component<Props>((props) => ...)`**: Define un nuevo componente.
|
|
104
|
+
- **`appendChild(parent, child)`**: Función auxiliar para montar componentes en el DOM.
|
|
105
|
+
|
|
106
|
+
## Licencia
|
|
107
|
+
|
|
108
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/html-compiler/generator.ts
|
|
4
|
+
import * as fs from "fs";
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
|
|
7
|
+
// src/html-compiler/html-compiler.ts
|
|
8
|
+
import { JSDOM } from "jsdom";
|
|
9
|
+
var VOID_ELEMENTS = ["area", "base", "br", "hr", "img", "input", "link", "meta", "param", "keygen", "source"];
|
|
10
|
+
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
11
|
+
var HtmlCompiler = class _HtmlCompiler {
|
|
12
|
+
constructor(htmlContent) {
|
|
13
|
+
this.components = {};
|
|
14
|
+
this.stack = ["fragment"];
|
|
15
|
+
this.componentsItems = {};
|
|
16
|
+
this.componentsTags = {};
|
|
17
|
+
this.isSvg = {};
|
|
18
|
+
this.inSvgContext = 0;
|
|
19
|
+
const dom = new JSDOM(htmlContent);
|
|
20
|
+
this.htmlDocument = dom.window.document;
|
|
21
|
+
}
|
|
22
|
+
static camelize(str) {
|
|
23
|
+
if (str.startsWith("--")) {
|
|
24
|
+
return str;
|
|
25
|
+
}
|
|
26
|
+
const arr = str.split("-");
|
|
27
|
+
let camelized = "";
|
|
28
|
+
arr.forEach((v, i) => {
|
|
29
|
+
camelized += i === 0 ? v : v.charAt(0).toUpperCase() + v.slice(1);
|
|
30
|
+
});
|
|
31
|
+
return camelized;
|
|
32
|
+
}
|
|
33
|
+
static parseStyle(cssCode) {
|
|
34
|
+
let out = "{";
|
|
35
|
+
const styles = cssCode.split(";");
|
|
36
|
+
styles.forEach((line) => {
|
|
37
|
+
const parts = line.split(":");
|
|
38
|
+
if (parts.length !== 2) return;
|
|
39
|
+
const prop = _HtmlCompiler.camelize(parts[0].trim());
|
|
40
|
+
out += ` ${prop}: '${parts[1].trim()}',`;
|
|
41
|
+
});
|
|
42
|
+
out += "}";
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
makeClassAttr(classAttr, isComponent) {
|
|
46
|
+
const tplClasses = (classAttr || "").split(" ");
|
|
47
|
+
let finalClass = "";
|
|
48
|
+
tplClasses.forEach((tplClass) => {
|
|
49
|
+
if (!tplClass.startsWith("-tpl--")) {
|
|
50
|
+
finalClass += tplClass + " ";
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
finalClass = finalClass.trim();
|
|
54
|
+
if (isComponent) {
|
|
55
|
+
finalClass = `buildClass('${finalClass}', props.addClass, props.classes)`;
|
|
56
|
+
return ` 'class': ${finalClass}, `;
|
|
57
|
+
} else {
|
|
58
|
+
return ` 'class': "${finalClass}", `;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
getHtmlNodeAttrs(domNode, isComponent) {
|
|
62
|
+
let attrsHtml = "{";
|
|
63
|
+
attrsHtml += this.makeClassAttr(domNode.getAttribute("class"), isComponent);
|
|
64
|
+
Array.from(domNode.attributes).forEach((attr) => {
|
|
65
|
+
const attrName = attr.name;
|
|
66
|
+
let attrValue = attr.value;
|
|
67
|
+
if (attrName === "data-cb") return;
|
|
68
|
+
if (attrName === "class") return;
|
|
69
|
+
attrValue = attrValue.replace(/\n/g, " ").replace(/"/g, '\\"');
|
|
70
|
+
if (attrName === "style") {
|
|
71
|
+
attrsHtml += ` '${attrName}': "${attrValue}", `;
|
|
72
|
+
} else {
|
|
73
|
+
attrsHtml += ` '${attrName}': "${attrValue}", `;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
attrsHtml += "}";
|
|
77
|
+
return attrsHtml;
|
|
78
|
+
}
|
|
79
|
+
buildTsForNode(domNode, isComponent = false) {
|
|
80
|
+
let htmlNodeCode = "";
|
|
81
|
+
if (domNode.nodeType === 1) {
|
|
82
|
+
const element = domNode;
|
|
83
|
+
let tagName = element.tagName;
|
|
84
|
+
if (tagName === "svg") {
|
|
85
|
+
this.inSvgContext++;
|
|
86
|
+
}
|
|
87
|
+
let cbid = element.getAttribute("data-cb");
|
|
88
|
+
if (cbid) {
|
|
89
|
+
const currComp = this.stack[0];
|
|
90
|
+
element.removeAttribute("data-cb");
|
|
91
|
+
cbid = _HtmlCompiler.camelize(cbid);
|
|
92
|
+
if (!this.componentsItems[currComp]) {
|
|
93
|
+
this.componentsItems[currComp] = [];
|
|
94
|
+
}
|
|
95
|
+
this.componentsItems[currComp].push(cbid);
|
|
96
|
+
this.stack.unshift(cbid);
|
|
97
|
+
this.components[cbid] = this.buildTsForNode(element, true);
|
|
98
|
+
this.componentsTags[cbid] = element.tagName;
|
|
99
|
+
this.isSvg[cbid] = this.inSvgContext > 0;
|
|
100
|
+
this.stack.shift();
|
|
101
|
+
if (currComp === "fragment") {
|
|
102
|
+
htmlNodeCode += `getItem(Components, props, '${cbid}')`;
|
|
103
|
+
} else {
|
|
104
|
+
htmlNodeCode += `getItem(Components, props.items, '${cbid}')`;
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
const attrs = this.getHtmlNodeAttrs(element, isComponent);
|
|
108
|
+
if (!this.inSvgContext) {
|
|
109
|
+
tagName = tagName.toLowerCase();
|
|
110
|
+
htmlNodeCode += `(() => { const node = document.createElement('${tagName}');
|
|
111
|
+
`;
|
|
112
|
+
} else {
|
|
113
|
+
htmlNodeCode += `(() => { const node = document.createElementNS('${SVG_NAMESPACE}', '${tagName}');
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
htmlNodeCode += `setAttributes(node, ${attrs});
|
|
117
|
+
`;
|
|
118
|
+
if (isComponent) {
|
|
119
|
+
htmlNodeCode += `setProps(node, getValidProps(props));
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
let subTs = "";
|
|
123
|
+
element.childNodes.forEach((child) => {
|
|
124
|
+
const chCode = this.buildTsForNode(child);
|
|
125
|
+
if (chCode) {
|
|
126
|
+
subTs += `appendChild(node, ${chCode});
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
if (!VOID_ELEMENTS.includes(tagName.toLowerCase())) {
|
|
131
|
+
if (isComponent) {
|
|
132
|
+
htmlNodeCode += `
|
|
133
|
+
if (props.inner === null) {
|
|
134
|
+
node.innerHTML = '';
|
|
135
|
+
} else if (props.inner !== undefined) {
|
|
136
|
+
node.innerHTML = '';
|
|
137
|
+
appendChild(node, props.inner);
|
|
138
|
+
} else {
|
|
139
|
+
${subTs}
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
} else {
|
|
143
|
+
htmlNodeCode += subTs;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (isComponent) {
|
|
147
|
+
htmlNodeCode += `if (typeof props._ref === 'function') props._ref(node);
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
htmlNodeCode += `return node;})()`;
|
|
151
|
+
if (tagName === "svg") {
|
|
152
|
+
this.inSvgContext--;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} else if (domNode.nodeType === 3) {
|
|
156
|
+
const textNode = domNode;
|
|
157
|
+
const parent = textNode.parentNode;
|
|
158
|
+
const parentTag = parent ? parent.tagName.toLowerCase() : "";
|
|
159
|
+
const mustOmit = ["table", "thead", "tbody", "tfoot", "tr"].includes(parentTag);
|
|
160
|
+
if (!mustOmit && textNode.textContent) {
|
|
161
|
+
if (textNode.textContent.trim() === "") {
|
|
162
|
+
if (textNode.textContent.length > 0) {
|
|
163
|
+
htmlNodeCode += `document.createTextNode(' ')`;
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
htmlNodeCode = `document.createTextNode(${JSON.stringify(textNode.textContent)})`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return htmlNodeCode.trim();
|
|
171
|
+
}
|
|
172
|
+
static getPropsTypename(cbid) {
|
|
173
|
+
return "T" + cbid.charAt(0).toUpperCase() + cbid.slice(1) + "Props";
|
|
174
|
+
}
|
|
175
|
+
wrapFnComponent(cbid, jsx) {
|
|
176
|
+
const typename = _HtmlCompiler.getPropsTypename(cbid);
|
|
177
|
+
return `(props: ${typename}) => {
|
|
178
|
+
return(${jsx});
|
|
179
|
+
}`;
|
|
180
|
+
}
|
|
181
|
+
createAllComponents() {
|
|
182
|
+
const body = this.htmlDocument.querySelector("body");
|
|
183
|
+
if (!body) throw new Error("Not valid HTML");
|
|
184
|
+
let rendererJsx = "(() => { const fragment = document.createDocumentFragment();\n";
|
|
185
|
+
body.childNodes.forEach((child) => {
|
|
186
|
+
const chCode = this.buildTsForNode(child);
|
|
187
|
+
if (chCode) {
|
|
188
|
+
rendererJsx += `appendChild(fragment, ${chCode});
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
rendererJsx += "return fragment;\n";
|
|
193
|
+
rendererJsx += "})()";
|
|
194
|
+
this.components["fragment"] = rendererJsx;
|
|
195
|
+
}
|
|
196
|
+
getTypedef(cbid) {
|
|
197
|
+
const items = this.componentsItems[cbid] || [];
|
|
198
|
+
let itemsType = "{\n";
|
|
199
|
+
items.forEach((itemCbid) => {
|
|
200
|
+
const itemTypename = _HtmlCompiler.getPropsTypename(itemCbid);
|
|
201
|
+
itemsType += `${itemCbid}?: ${itemTypename} | TContent;
|
|
202
|
+
`;
|
|
203
|
+
});
|
|
204
|
+
itemsType += "}\n";
|
|
205
|
+
const typename = _HtmlCompiler.getPropsTypename(cbid);
|
|
206
|
+
if (cbid === "fragment") {
|
|
207
|
+
return `interface ${typename} ${itemsType}`;
|
|
208
|
+
} else {
|
|
209
|
+
const tagname = this.componentsTags[cbid];
|
|
210
|
+
if (this.isSvg[cbid]) {
|
|
211
|
+
return `type ${typename} = TItemBuilderProps<SVGElementTagNameMap['${tagname}'], ${itemsType}>;`;
|
|
212
|
+
} else {
|
|
213
|
+
return `type ${typename} = TItemBuilderProps<HTMLElementTagNameMap['${tagname.toLowerCase()}'], ${itemsType}>;`;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
compile() {
|
|
218
|
+
this.createAllComponents();
|
|
219
|
+
let componentsClasses = "";
|
|
220
|
+
let typedefs = "";
|
|
221
|
+
for (const [cbid, compJsx] of Object.entries(this.components)) {
|
|
222
|
+
typedefs += this.getTypedef(cbid) + "\n";
|
|
223
|
+
componentsClasses += `${cbid}: ${this.wrapFnComponent(cbid, compJsx)},
|
|
224
|
+
`;
|
|
225
|
+
}
|
|
226
|
+
const jsOutput = `
|
|
227
|
+
import { appendChild, getItem, getValidProps, buildClass, setAttributes, setProps, TContent, TItemBuilderProps } from 'chispa';
|
|
228
|
+
|
|
229
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
230
|
+
|
|
231
|
+
const Components = {
|
|
232
|
+
${componentsClasses}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export default Components;
|
|
236
|
+
`;
|
|
237
|
+
const dtsOutput = `
|
|
238
|
+
import { TContent, TItemBuilderProps } from 'chispa';
|
|
239
|
+
|
|
240
|
+
${typedefs}
|
|
241
|
+
|
|
242
|
+
declare const Components: {
|
|
243
|
+
${Object.keys(this.components).map((cbid) => {
|
|
244
|
+
const typename = _HtmlCompiler.getPropsTypename(cbid);
|
|
245
|
+
return `${cbid}: (props: ${typename}) => Node | DocumentFragment;`;
|
|
246
|
+
}).join("\n")}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export default Components;
|
|
250
|
+
`;
|
|
251
|
+
return { js: jsOutput, dts: dtsOutput };
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
// src/html-compiler/generator.ts
|
|
256
|
+
function generateTypes(filePath, content, rootDir) {
|
|
257
|
+
try {
|
|
258
|
+
const compiler = new HtmlCompiler(content);
|
|
259
|
+
const { dts } = compiler.compile();
|
|
260
|
+
const outDir = path.join(rootDir, ".chispa/types");
|
|
261
|
+
const relativePath = path.relative(rootDir, filePath);
|
|
262
|
+
const targetPath = path.join(outDir, relativePath + ".d.ts");
|
|
263
|
+
const targetDir = path.dirname(targetPath);
|
|
264
|
+
if (!fs.existsSync(targetDir)) {
|
|
265
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
266
|
+
}
|
|
267
|
+
fs.writeFileSync(targetPath, dts);
|
|
268
|
+
} catch (e) {
|
|
269
|
+
console.error(`[chispa] Error generating types for ${filePath}`, e);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function findAndCompileHtmlFiles(dir, rootDir) {
|
|
273
|
+
if (!fs.existsSync(dir)) return;
|
|
274
|
+
const files = fs.readdirSync(dir);
|
|
275
|
+
files.forEach((file) => {
|
|
276
|
+
const fullPath = path.join(dir, file);
|
|
277
|
+
if (fullPath === path.join(rootDir, "index.html")) return;
|
|
278
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
279
|
+
if (file !== "node_modules" && file !== ".git" && file !== "dist" && file !== ".chispa") {
|
|
280
|
+
findAndCompileHtmlFiles(fullPath, rootDir);
|
|
281
|
+
}
|
|
282
|
+
} else if (file.endsWith(".html")) {
|
|
283
|
+
console.log("Generating types for", fullPath);
|
|
284
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
285
|
+
generateTypes(fullPath, content, rootDir);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// src/html-compiler/cli.ts
|
|
291
|
+
var args = process.argv.slice(2);
|
|
292
|
+
if (args.includes("--compile-html")) {
|
|
293
|
+
const rootDir = process.cwd();
|
|
294
|
+
console.log("Scanning for HTML files...");
|
|
295
|
+
findAndCompileHtmlFiles(rootDir, rootDir);
|
|
296
|
+
console.log("HTML compilation completed.");
|
|
297
|
+
} else {
|
|
298
|
+
console.log("Usage: chispa-cli --compile-html");
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/html-compiler/generator.ts","../../src/html-compiler/html-compiler.ts","../../src/html-compiler/cli.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { HtmlCompiler } from './html-compiler';\n\nexport function generateTypes(filePath: string, content: string, rootDir: string) {\n\ttry {\n\t\tconst compiler = new HtmlCompiler(content);\n\t\tconst { dts } = compiler.compile();\n\n\t\tconst outDir = path.join(rootDir, '.chispa/types');\n\t\tconst relativePath = path.relative(rootDir, filePath);\n\t\tconst targetPath = path.join(outDir, relativePath + '.d.ts');\n\t\tconst targetDir = path.dirname(targetPath);\n\n\t\tif (!fs.existsSync(targetDir)) {\n\t\t\tfs.mkdirSync(targetDir, { recursive: true });\n\t\t}\n\t\tfs.writeFileSync(targetPath, dts);\n\t} catch (e) {\n\t\tconsole.error(`[chispa] Error generating types for ${filePath}`, e);\n\t}\n}\n\nexport function findAndCompileHtmlFiles(dir: string, rootDir: string) {\n\tif (!fs.existsSync(dir)) return;\n\tconst files = fs.readdirSync(dir);\n\tfiles.forEach((file) => {\n\t\tconst fullPath = path.join(dir, file);\n\t\tif (fullPath === path.join(rootDir, 'index.html')) return;\n\t\tif (fs.statSync(fullPath).isDirectory()) {\n\t\t\tif (file !== 'node_modules' && file !== '.git' && file !== 'dist' && file !== '.chispa') {\n\t\t\t\tfindAndCompileHtmlFiles(fullPath, rootDir);\n\t\t\t}\n\t\t} else if (file.endsWith('.html')) {\n\t\t\tconsole.log('Generating types for', fullPath);\n\t\t\tconst content = fs.readFileSync(fullPath, 'utf-8');\n\t\t\tgenerateTypes(fullPath, content, rootDir);\n\t\t}\n\t});\n}\n","import { JSDOM } from 'jsdom';\n\nconst VOID_ELEMENTS = ['area', 'base', 'br', 'hr', 'img', 'input', 'link', 'meta', 'param', 'keygen', 'source'];\n\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\nexport class HtmlCompiler {\n\tprivate components: Record<string, string> = {};\n\tprivate stack: string[] = ['fragment'];\n\tprivate componentsItems: Record<string, string[]> = {};\n\tprivate componentsTags: Record<string, string> = {};\n\tprivate isSvg: Record<string, boolean> = {};\n\tprivate inSvgContext = 0;\n\tprivate htmlDocument: Document;\n\n\tconstructor(htmlContent: string) {\n\t\tconst dom = new JSDOM(htmlContent);\n\t\tthis.htmlDocument = dom.window.document;\n\t}\n\n\tprivate static camelize(str: string): string {\n\t\tif (str.startsWith('--')) {\n\t\t\treturn str;\n\t\t}\n\t\tconst arr = str.split('-');\n\t\tlet camelized = '';\n\t\tarr.forEach((v, i) => {\n\t\t\tcamelized += i === 0 ? v : v.charAt(0).toUpperCase() + v.slice(1);\n\t\t});\n\t\treturn camelized;\n\t}\n\n\tprivate static parseStyle(cssCode: string): string {\n\t\tlet out = '{';\n\t\tconst styles = cssCode.split(';');\n\t\tstyles.forEach((line) => {\n\t\t\tconst parts = line.split(':');\n\t\t\tif (parts.length !== 2) return;\n\t\t\tconst prop = HtmlCompiler.camelize(parts[0].trim());\n\t\t\tout += ` ${prop}: '${parts[1].trim()}',`;\n\t\t});\n\t\tout += '}';\n\t\treturn out;\n\t}\n\n\tprivate makeClassAttr(classAttr: string | null, isComponent: boolean): string {\n\t\tconst tplClasses = (classAttr || '').split(' ');\n\t\tlet finalClass = '';\n\n\t\ttplClasses.forEach((tplClass) => {\n\t\t\tif (!tplClass.startsWith('-tpl--')) {\n\t\t\t\tfinalClass += tplClass + ' ';\n\t\t\t}\n\t\t});\n\n\t\tfinalClass = finalClass.trim();\n\n\t\tif (isComponent) {\n\t\t\tfinalClass = `buildClass('${finalClass}', props.addClass, props.classes)`;\n\t\t\treturn ` 'class': ${finalClass}, `;\n\t\t} else {\n\t\t\treturn ` 'class': \"${finalClass}\", `;\n\t\t}\n\t}\n\n\tprivate getHtmlNodeAttrs(domNode: Element, isComponent: boolean): string {\n\t\tlet attrsHtml = '{';\n\t\tattrsHtml += this.makeClassAttr(domNode.getAttribute('class'), isComponent);\n\n\t\tArray.from(domNode.attributes).forEach((attr) => {\n\t\t\tconst attrName = attr.name;\n\t\t\tlet attrValue = attr.value;\n\n\t\t\tif (attrName === 'data-cb') return;\n\t\t\tif (attrName === 'class') return;\n\n\t\t\tattrValue = attrValue.replace(/\\n/g, ' ').replace(/\"/g, '\\\\\"');\n\n\t\t\t// Simplified logic compared to PHP which had cbt.prefixize... calls\n\t\t\t// Assuming we just output the value for now as I don't see cbt implementation here\n\t\t\t// The PHP code imported CoreBuilderTools but here we might not have it.\n\t\t\t// The user's example output imports from 'chispa'.\n\t\t\t// I will stick to simple string values for now unless I see cbt in chispa.\n\n\t\t\tif (attrName === 'style') {\n\t\t\t\t// PHP called cbt.prefixizeStyle, but also had parse_style static method.\n\t\t\t\t// Wait, the PHP code used cbt.prefixizeStyle inside get_html_node_attrs.\n\t\t\t\t// But parse_style was defined but not used in the snippet I read?\n\t\t\t\t// Ah, I should check if I should use parseStyle or just output string.\n\t\t\t\t// The PHP code: $attrs_html .= \" '$attr_name': cbt.prefixizeStyle('$attr_value'), \";\n\t\t\t\t// If cbt is a runtime helper, I should output the call.\n\t\t\t\t// But wait, the generated code imports CoreBuilderTools.\n\t\t\t\t// Does 'chispa' export CoreBuilderTools?\n\t\t\t\t// src/index.ts does NOT export CoreBuilderTools.\n\t\t\t\t// It exports appendChild, getItem, etc.\n\t\t\t\t// Maybe I should just output the string for now.\n\t\t\t\tattrsHtml += ` '${attrName}': \"${attrValue}\", `;\n\t\t\t} else {\n\t\t\t\tattrsHtml += ` '${attrName}': \"${attrValue}\", `;\n\t\t\t}\n\t\t});\n\n\t\tattrsHtml += '}';\n\t\treturn attrsHtml;\n\t}\n\n\tprivate buildTsForNode(domNode: Node, isComponent = false): string {\n\t\tlet htmlNodeCode = '';\n\n\t\tif (domNode.nodeType === 1) {\n\t\t\t// Element\n\t\t\tconst element = domNode as Element;\n\t\t\tlet tagName = element.tagName;\n\n\t\t\tif (tagName === 'svg') {\n\t\t\t\tthis.inSvgContext++;\n\t\t\t}\n\n\t\t\tlet cbid = element.getAttribute('data-cb');\n\n\t\t\tif (cbid) {\n\t\t\t\tconst currComp = this.stack[0];\n\t\t\t\telement.removeAttribute('data-cb');\n\t\t\t\tcbid = HtmlCompiler.camelize(cbid);\n\n\t\t\t\tif (!this.componentsItems[currComp]) {\n\t\t\t\t\tthis.componentsItems[currComp] = [];\n\t\t\t\t}\n\n\t\t\t\tthis.componentsItems[currComp].push(cbid);\n\t\t\t\tthis.stack.unshift(cbid);\n\t\t\t\tthis.components[cbid] = this.buildTsForNode(element, true);\n\t\t\t\tthis.componentsTags[cbid] = element.tagName;\n\t\t\t\tthis.isSvg[cbid] = this.inSvgContext > 0;\n\t\t\t\tthis.stack.shift();\n\n\t\t\t\tif (currComp === 'fragment') {\n\t\t\t\t\thtmlNodeCode += `getItem(Components, props, '${cbid}')`;\n\t\t\t\t} else {\n\t\t\t\t\thtmlNodeCode += `getItem(Components, props.items, '${cbid}')`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst attrs = this.getHtmlNodeAttrs(element, isComponent);\n\n\t\t\t\tif (!this.inSvgContext) {\n\t\t\t\t\ttagName = tagName.toLowerCase();\n\t\t\t\t\thtmlNodeCode += `(() => { const node = document.createElement('${tagName}');\\n`;\n\t\t\t\t} else {\n\t\t\t\t\thtmlNodeCode += `(() => { const node = document.createElementNS('${SVG_NAMESPACE}', '${tagName}');\\n`;\n\t\t\t\t}\n\n\t\t\t\thtmlNodeCode += `setAttributes(node, ${attrs});\\n`;\n\t\t\t\tif (isComponent) {\n\t\t\t\t\thtmlNodeCode += `setProps(node, getValidProps(props));\\n`;\n\t\t\t\t}\n\n\t\t\t\tlet subTs = '';\n\t\t\t\telement.childNodes.forEach((child) => {\n\t\t\t\t\tconst chCode = this.buildTsForNode(child);\n\t\t\t\t\tif (chCode) {\n\t\t\t\t\t\tsubTs += `appendChild(node, ${chCode});\\n`;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (!VOID_ELEMENTS.includes(tagName.toLowerCase())) {\n\t\t\t\t\tif (isComponent) {\n\t\t\t\t\t\thtmlNodeCode += `\n if (props.inner === null) {\n node.innerHTML = '';\n } else if (props.inner !== undefined) {\n node.innerHTML = '';\n appendChild(node, props.inner);\n } else {\n ${subTs}\n }\n `;\n\t\t\t\t\t} else {\n\t\t\t\t\t\thtmlNodeCode += subTs;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (isComponent) {\n\t\t\t\t\thtmlNodeCode += `if (typeof props._ref === 'function') props._ref(node);\\n`;\n\t\t\t\t}\n\n\t\t\t\thtmlNodeCode += `return node;})()`;\n\n\t\t\t\tif (tagName === 'svg') {\n\t\t\t\t\tthis.inSvgContext--;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (domNode.nodeType === 3) {\n\t\t\t// Text\n\t\t\tconst textNode = domNode as Text;\n\t\t\tconst parent = textNode.parentNode as Element;\n\t\t\tconst parentTag = parent ? parent.tagName.toLowerCase() : '';\n\n\t\t\tconst mustOmit = ['table', 'thead', 'tbody', 'tfoot', 'tr'].includes(parentTag);\n\n\t\t\tif (!mustOmit && textNode.textContent) {\n\t\t\t\tif (textNode.textContent.trim() === '') {\n\t\t\t\t\tif (textNode.textContent.length > 0) {\n\t\t\t\t\t\thtmlNodeCode += `document.createTextNode(' ')`;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\thtmlNodeCode = `document.createTextNode(${JSON.stringify(textNode.textContent)})`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn htmlNodeCode.trim();\n\t}\n\n\tprivate static getPropsTypename(cbid: string): string {\n\t\treturn 'T' + cbid.charAt(0).toUpperCase() + cbid.slice(1) + 'Props';\n\t}\n\n\tprivate wrapFnComponent(cbid: string, jsx: string): string {\n\t\tconst typename = HtmlCompiler.getPropsTypename(cbid);\n\t\treturn `(props: ${typename}) => { \\n return(${jsx}); \\n }`;\n\t}\n\n\tprivate createAllComponents() {\n\t\tconst body = this.htmlDocument.querySelector('body');\n\t\tif (!body) throw new Error('Not valid HTML');\n\n\t\tlet rendererJsx = '(() => { const fragment = document.createDocumentFragment();\\n';\n\n\t\tbody.childNodes.forEach((child) => {\n\t\t\tconst chCode = this.buildTsForNode(child);\n\t\t\tif (chCode) {\n\t\t\t\trendererJsx += `appendChild(fragment, ${chCode});\\n`;\n\t\t\t}\n\t\t});\n\n\t\trendererJsx += 'return fragment;\\n';\n\t\trendererJsx += '})()';\n\n\t\tthis.components['fragment'] = rendererJsx;\n\t}\n\n\tprivate getTypedef(cbid: string): string {\n\t\tconst items = this.componentsItems[cbid] || [];\n\t\tlet itemsType = '{\\n';\n\t\titems.forEach((itemCbid) => {\n\t\t\tconst itemTypename = HtmlCompiler.getPropsTypename(itemCbid);\n\t\t\titemsType += `${itemCbid}?: ${itemTypename} | TContent;\\n`;\n\t\t});\n\t\titemsType += '}\\n';\n\n\t\tconst typename = HtmlCompiler.getPropsTypename(cbid);\n\n\t\tif (cbid === 'fragment') {\n\t\t\treturn `interface ${typename} ${itemsType}`;\n\t\t} else {\n\t\t\tconst tagname = this.componentsTags[cbid];\n\t\t\tif (this.isSvg[cbid]) {\n\t\t\t\treturn `type ${typename} = TItemBuilderProps<SVGElementTagNameMap['${tagname}'], ${itemsType}>;`;\n\t\t\t} else {\n\t\t\t\treturn `type ${typename} = TItemBuilderProps<HTMLElementTagNameMap['${tagname.toLowerCase()}'], ${itemsType}>;`;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic compile(): { js: string; dts: string } {\n\t\tthis.createAllComponents();\n\n\t\tlet componentsClasses = '';\n\t\tlet typedefs = '';\n\n\t\tfor (const [cbid, compJsx] of Object.entries(this.components)) {\n\t\t\ttypedefs += this.getTypedef(cbid) + '\\n';\n\t\t\tcomponentsClasses += `${cbid}: ${this.wrapFnComponent(cbid, compJsx)},\\n`;\n\t\t}\n\n\t\tconst jsOutput = `\n import { appendChild, getItem, getValidProps, buildClass, setAttributes, setProps, TContent, TItemBuilderProps } from 'chispa';\n\n const SVG_NS = 'http://www.w3.org/2000/svg';\n \n const Components = {\n ${componentsClasses}\n };\n \n export default Components;\n `;\n\n\t\tconst dtsOutput = `\n import { TContent, TItemBuilderProps } from 'chispa';\n \n ${typedefs}\n \n declare const Components: {\n ${Object.keys(this.components)\n\t\t\t\t\t.map((cbid) => {\n\t\t\t\t\t\tconst typename = HtmlCompiler.getPropsTypename(cbid);\n\t\t\t\t\t\treturn `${cbid}: (props: ${typename}) => Node | DocumentFragment;`;\n\t\t\t\t\t})\n\t\t\t\t\t.join('\\n')}\n };\n \n export default Components;\n `;\n\n\t\treturn { js: jsOutput, dts: dtsOutput };\n\t}\n}\n","#!/usr/bin/env node\nimport { findAndCompileHtmlFiles } from './generator';\n\nconst args = process.argv.slice(2);\n\nif (args.includes('--compile-html')) {\n\tconst rootDir = process.cwd();\n\tconsole.log('Scanning for HTML files...');\n\tfindAndCompileHtmlFiles(rootDir, rootDir);\n\tconsole.log('HTML compilation completed.');\n} else {\n\tconsole.log('Usage: chispa-cli --compile-html');\n}\n"],"mappings":";;;AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;;;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ce: "pre";
|
|
4
|
+
configResolved(config: any): void;
|
|
5
|
+
buildStart(): void;
|
|
6
|
+
handleHotUpdate(ctx: {
|
|
7
|
+
file: string;
|
|
8
|
+
read: () => string | Promise<string>;
|
|
9
|
+
}): void;
|
|
10
|
+
resolveId(source: string, importer: string, options: any): Promise<string>;
|
|
11
|
+
load(id: string): string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { chispaHtmlPlugin };
|