diff --git a/CLAUDE.md b/CLAUDE.md index 1af4e45..03ecfa9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -105,7 +105,11 @@ Do NOT modify web-base files — they are shared across all projects. ## Documentation - [docs/modular-system.md](docs/modular-system.md) — Modules, general sections, global variables -- [docs/builder-fields.md](docs/builder-fields.md) — Builder field types, c-form, c-if/c-for/c-class, data-field-type +- [docs/builder-fields.md](docs/builder-fields.md) — Builder field types, Acai attributes, c-form, components - [docs/twig-filters.md](docs/twig-filters.md) — Twig filters reference (get, hook, module, queryDB, etc.) -- [docs/hooks-and-api.md](docs/hooks-and-api.md) — PHP hooks, CmsApi, CocoDB, database operations -- [docs/css-js-conventions.md](docs/css-js-conventions.md) — CSS/JS patterns, Tailwind, BEM, Vue 3 integration +- [docs/hooks-and-api.md](docs/hooks-and-api.md) — PHP hooks, CmsApi, CocoDB, record creation +- [docs/css-js-conventions.md](docs/css-js-conventions.md) — CSS/JS/Vue 3, Tailwind, BEM, native components +- [docs/quick-reference.md](docs/quick-reference.md) — Cheat sheet: domain rules, field types, filters +- [docs/production-patterns.md](docs/production-patterns.md) — Real production patterns (header, zigzag, FAQ, forms) +- [docs/vue-builder-rules.md](docs/vue-builder-rules.md) — CMS-VUE rules (tabs, colorpicker, components) +- [docs/vue-builder-examples.md](docs/vue-builder-examples.md) — Vue builder examples (Banner Slideshow, etc.) diff --git a/docs/builder-fields.md b/docs/builder-fields.md index 1ebb724..bd65ed8 100644 --- a/docs/builder-fields.md +++ b/docs/builder-fields.md @@ -1,77 +1,196 @@ # Builder Fields & Acai Attributes +## Nombres de variables + +El atributo `data-field-label` se convierte a variable removiendo espacios y caracteres especiales (minúsculas). + +| Label | Variable | +|-------|----------| +| Categoría Noticia | `categoranoticia` | +| Color Principal | `colorprincipal` | +| Título Producto | `ttuloproducto` | + +--- + ## Field Types (`data-field-type`) -The builder uses `data-field-type` attributes on HTML elements to define editable areas. +| Type | Element | Returns | +|------|---------|---------| +| `textfield` | `
` | String | +| `headfield` | `
+ Elemento editable +
+``` + +### headfield + +Genera 2 variables: la estándar y otra con sufijo `_tag` con la etiqueta elegida por el usuario. + +```html +<{{ title_tag | default('h2') }} data-field-type="headfield" data-field-label="Título Sección" class="text-3xl font-bold"> + Título de la sección {{ title_tag | default('h2') }}> ``` -### upload Example +### textbox ```html - -Texto con estilos editables
+{{ record.descripcion }}
+
+```
+
+### Clases utilitarias de Acai
+
+| Clase | Descripción |
|-------|-------------|
-| `transition3s` | 0.3s smooth transition |
-| `click-a-child` | Makes parent clickable via child `` tag |
-| `line-clamp2` / `line-clamp3` / `line-clamp5` | Text truncation with ellipsis |
-| `filter-white` | CSS filter to make images/icons white |
-| `lazyload` | Lazy loading (use with `data-src`) |
+| `transition3s` | Transición suave 0.3s |
+| `click-a-child` | Hace el padre clickeable via primer `` hijo |
+| `line-clamp2` / `line-clamp3` / `line-clamp5` | Truncar texto a N líneas |
+| `filter-white` | Filtro CSS para hacer imágenes/iconos blancos |
+| `lazyload` | Lazy loading (usar con `data-src`) |
+| `text-shadow` | Sombra de texto para legibilidad sobre imágenes |
+| `wysiwyg` | Wrapper para contenido de texto enriquecido |
+| `bg-main-color` / `bg-main-color-light` / `bg-main-color-dark` | Fondos con color primario |
+| `text-main-color` / `text-main-color-light` / `text-main-color-dark` | Texto con color primario |
+---
## JavaScript
### Module Scripts (`script.js`)
-Keep JavaScript scoped to the module. Use `section_id` for targeting:
+JavaScript scopeado al módulo usando `section_id`:
```js
-// Scope to this module instance
const section = document.getElementById('{{ section_id }}');
if (section) {
const buttons = section.querySelectorAll('.btn');
@@ -68,15 +83,23 @@ if (section) {
### CmsApi (Client-Side)
```js
-// Call a hook
CmsApi.hook('/hooks/module_id/', { action: 'getData', id: 123 }, function(response) {
console.log(response);
});
```
-### Vue 3 Integration
+### Cuándo usar Vue 3
-For complex interactivity, use Vue 3 via CDN with Composition API:
+Usar Vue 3 CDN cuando la lógica requiera:
+- Doble binding / reactividad
+- Solicitudes asíncronas complejas
+- Componentes reutilizables
+- Gestión de estado local
+- Ciclos de vida
+
+Para lógica simple, usar JavaScript vanilla.
+
+### Vue 3 Integration
```html
{{ myVar }} {{ myVar.message }} {{ resultado.message }} Texto Total: ${{ precio.total }} ` | String |
+| `headfield` | `
+
+
+
+```
+
+### Breadcrumb
+
+```html
+
+
+
+
+```
+
+---
+
+## Buenas prácticas
+
+- HTML/Twig semántico
+- Código limpio y organizado
+- Evitar dependencias externas innecesarias
+- Evitar estilos inline salvo casos justificados (colores dinámicos del usuario)
+- No usar clases globales sin prefijo de módulo
diff --git a/docs/hooks-and-api.md b/docs/hooks-and-api.md
index 8e2b32c..21eec92 100644
--- a/docs/hooks-and-api.md
+++ b/docs/hooks-and-api.md
@@ -2,155 +2,210 @@
## Hooks
-Hooks are PHP files in the `hooks/` directory that execute server-side logic. They can also live inside a module at `template/estandar/modulos/
+
{{ record.titulobloque | raw }}
+ ' %}
+{% set gracias = 'apartados' | get('num = 20').0 %}
+
+
+
+```
+
+---
+
+## Patrón 6: Sección General — Detalle de Producto
+
+```html
+{{ 'Productos relacionados' | translate }}
+
+
+
+
+
+
`-`
` | String + var `_tag` |
+| `textbox` | `