desy-html 15.0.0-beta.1 → 15.0.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 +173 -18
- package/attached_assets/Pasted--desy-html-starter-Node-Version-https-img-shields-io-ba_1765448923362.txt +431 -0
- package/docs/index.html +125 -17
- package/package.json +3 -3
- package/replit.md +75 -0
- package/src/templates/components/tree/_examples.tree.njk +0 -311
- package/vite.config.js +1 -1
package/README.md
CHANGED
|
@@ -1,30 +1,185 @@
|
|
|
1
|
-
#
|
|
1
|
+
# desy-html
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
[](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
An NPM library for building user interfaces for Government of Aragón web applications. It uses Vite, Tailwind CSS and Nunjucks to render HTML+CSS+JS components. It's useful to create lightweight webapps or HTML mockups.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Overview
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
**desy-html** is the core design system library that provides:
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
- **Vite** - Fast build tool and development server with hot module replacement
|
|
14
|
+
- **Tailwind CSS v4** - Utility-first CSS framework
|
|
15
|
+
- **Nunjucks** - Powerful templating engine for generating HTML
|
|
16
|
+
- **Sharp** - Image optimization for production builds
|
|
17
|
+
- **Accessible Components** - Pre-built UI components following ARIA patterns
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
If you need a more powerful library based on this, use its Angular port instead: [desy-angular](https://bitbucket.org/sdaragon/desy-angular)
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
## Quick Links
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
- **Documentation:** [https://desy.aragon.es/](https://desy.aragon.es/)
|
|
24
|
+
- **Repository:** [https://bitbucket.org/sdaragon/desy-html/](https://bitbucket.org/sdaragon/desy-html/)
|
|
25
|
+
- **Starter Project:** [https://bitbucket.org/sdaragon/desy-html-starter/](https://bitbucket.org/sdaragon/desy-html-starter/)
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
## How do I start a project that uses desy-html components?
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
To start a new project that uses desy-html as dependency, **don't use this repo**, use the **desy-html-starter** repo instead:
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
1. Download the desy-html-starter project from [https://bitbucket.org/sdaragon/desy-html-starter](https://bitbucket.org/sdaragon/desy-html-starter)
|
|
32
|
+
2. Personalize the downloaded project for your needs
|
|
33
|
+
3. You'll be able to use any desy-html component in that project
|
|
30
34
|
|
|
35
|
+
## Prerequisites
|
|
36
|
+
|
|
37
|
+
Before you begin, ensure you have the following installed:
|
|
38
|
+
|
|
39
|
+
- **Node.js** >=20.19.2 <23.0.0
|
|
40
|
+
- **npm** >=10.0.0
|
|
41
|
+
|
|
42
|
+
## Getting Started
|
|
43
|
+
|
|
44
|
+
### 1. Clone the Repository
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
git clone https://bitbucket.org/sdaragon/desy-html.git
|
|
48
|
+
cd desy-html
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Install Dependencies
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
npm install
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Start Development Server
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npm run dev
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This starts the Vite development server with hot module replacement. Open your browser at the URL displayed in the terminal output.
|
|
64
|
+
|
|
65
|
+
### 4. Build for Production
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
npm run build
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This compiles HTML, purges and minifies CSS, and optimizes JavaScript into the `/dist` folder.
|
|
72
|
+
|
|
73
|
+
### 5. Preview Production Build
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
npm run preview
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Project Structure
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
desy-html/
|
|
83
|
+
├── public/
|
|
84
|
+
│ └── images/ # Library images
|
|
85
|
+
├── src/
|
|
86
|
+
│ ├── css/ # Stylesheets
|
|
87
|
+
│ ├── js/ # JavaScript files
|
|
88
|
+
│ └── templates/
|
|
89
|
+
│ ├── components/ # UI component macros
|
|
90
|
+
│ ├── includes/ # Reusable template partials
|
|
91
|
+
│ └── pages/ # Page templates
|
|
92
|
+
├── docs/ # Documentation files
|
|
93
|
+
├── vite.config.js # Vite configuration
|
|
94
|
+
├── package.json
|
|
95
|
+
└── README.md
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Styling
|
|
99
|
+
|
|
100
|
+
### Using Tailwind CSS
|
|
101
|
+
|
|
102
|
+
The project uses Tailwind CSS v4. All Tailwind utility classes are available in your templates:
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<div class="flex items-center gap-4 p-6 bg-white rounded-lg shadow">
|
|
106
|
+
<h1 class="text-2xl font-bold text-gray-900">Hello World</h1>
|
|
107
|
+
</div>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Theme Variables
|
|
111
|
+
|
|
112
|
+
desy-html provides CSS custom properties (variables) for consistent theming. These are included in the main [stylesheet](https://bitbucket.org/sdaragon/desy-html/src/master/src/css/styles.css).
|
|
113
|
+
|
|
114
|
+
## Images
|
|
115
|
+
|
|
116
|
+
### Image Structure
|
|
117
|
+
|
|
118
|
+
Images are stored in `public/images/` and can be referenced in templates using the `/images/` path:
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<img src="/images/my-image.png" alt="Description">
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Image Optimization
|
|
125
|
+
|
|
126
|
+
During production builds, images are automatically optimized using Sharp:
|
|
127
|
+
|
|
128
|
+
- Supported formats: jpg, png, webp, avif
|
|
129
|
+
- File sizes are optimized for production
|
|
130
|
+
|
|
131
|
+
## Development Tips
|
|
132
|
+
|
|
133
|
+
### Hot Module Replacement
|
|
134
|
+
|
|
135
|
+
The development server supports HMR. Changes to CSS, JavaScript, and templates will automatically refresh in the browser.
|
|
136
|
+
|
|
137
|
+
### Debugging
|
|
138
|
+
|
|
139
|
+
- Check the browser console for JavaScript errors
|
|
140
|
+
- Use the Vite terminal output for build errors
|
|
141
|
+
- Inspect generated HTML in browser developer tools
|
|
142
|
+
|
|
143
|
+
## Scripts Reference
|
|
144
|
+
|
|
145
|
+
| Command | Description |
|
|
146
|
+
|---------|-------------|
|
|
147
|
+
| `npm run dev` | Start development server with HMR |
|
|
148
|
+
| `npm run build` | Build for production |
|
|
149
|
+
| `npm run preview` | Preview production build locally |
|
|
150
|
+
|
|
151
|
+
## Accessibility
|
|
152
|
+
|
|
153
|
+
All desy-html components are built with accessibility in mind:
|
|
154
|
+
|
|
155
|
+
- Proper ARIA attributes and roles
|
|
156
|
+
- Keyboard navigation support
|
|
157
|
+
- Screen reader compatibility
|
|
158
|
+
- Focus management
|
|
159
|
+
|
|
160
|
+
## Browser Support
|
|
161
|
+
|
|
162
|
+
The project targets modern browsers. For specific compatibility information, refer to the [desy documentation](https://desy.aragon.es/).
|
|
163
|
+
|
|
164
|
+
## Contributing
|
|
165
|
+
|
|
166
|
+
1. Fork the repository
|
|
167
|
+
2. Create a feature branch
|
|
168
|
+
3. Make your changes
|
|
169
|
+
4. Submit a pull request
|
|
170
|
+
|
|
171
|
+
## Contact the Team
|
|
172
|
+
|
|
173
|
+
desy-html is maintained by a team at SDA Servicios Digitales de Aragón (Spain). If you want to know more about desy-html, please email any of the commiters.
|
|
174
|
+
|
|
175
|
+
## Author
|
|
176
|
+
|
|
177
|
+
**SDA Servicios Digitales de Aragón**
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
This project is licensed under the [EUPL-1.2](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12) license.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
For more information and detailed component documentation, visit [https://desy.aragon.es/](https://desy.aragon.es/)
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
# desy-html-starter
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
[](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)
|
|
6
|
+
|
|
7
|
+
A starter project for building user interfaces for Government of Aragón web applications using the **desy-html** design system library.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
**desy-html-starter** provides a pre-configured environment with all the dependencies needed to build accessible, consistent web applications using the desy-html component library. It includes:
|
|
12
|
+
|
|
13
|
+
- **Vite** - Fast build tool and development server with hot module replacement
|
|
14
|
+
- **Tailwind CSS v4** - Utility-first CSS framework
|
|
15
|
+
- **Nunjucks** - Powerful templating engine for generating HTML
|
|
16
|
+
- **Sharp** - Image optimization for production builds
|
|
17
|
+
- **Accessible Components** - Pre-built UI components following ARIA patterns
|
|
18
|
+
|
|
19
|
+
## Quick Links
|
|
20
|
+
|
|
21
|
+
- **Documentation:** [https://desy.aragon.es/](https://desy.aragon.es/)
|
|
22
|
+
- **Repository:** [https://bitbucket.org/sdaragon/desy-html-starter/](https://bitbucket.org/sdaragon/desy-html-starter/)
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
Before you begin, ensure you have the following installed:
|
|
27
|
+
|
|
28
|
+
- **Node.js** ^22.0.0
|
|
29
|
+
- **npm** ^10.0.0
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
### 1. Clone or Fork the Repository
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
git clone https://bitbucket.org/sdaragon/desy-html-starter.git my-project
|
|
37
|
+
cd my-project
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. Install Dependencies
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Start Development Server
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
npm run dev
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This starts the Vite development server with hot module replacement. Open your browser at the URL displayed in the terminal output.
|
|
53
|
+
|
|
54
|
+
### 4. Build for Production
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm run build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This compiles HTML, purges and minifies CSS, and optimizes JavaScript into the `/dist` folder.
|
|
61
|
+
|
|
62
|
+
### 5. Preview Production Build
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
npm run preview
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Project Structure
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
desy-html-starter/
|
|
72
|
+
├── public/
|
|
73
|
+
│ └── images/ # Project images (override desy-html images here)
|
|
74
|
+
├── src/
|
|
75
|
+
│ ├── css/
|
|
76
|
+
│ │ ├── styles.css # Main stylesheet (imports desy-html styles)
|
|
77
|
+
│ │ └── custom.css # Your custom project styles
|
|
78
|
+
│ ├── js/
|
|
79
|
+
│ │ └── index.js # JavaScript entry point (component initialization)
|
|
80
|
+
│ └── templates/
|
|
81
|
+
│ ├── components/ # Custom project components
|
|
82
|
+
│ ├── includes/ # Reusable template partials
|
|
83
|
+
│ └── pages/ # Page templates
|
|
84
|
+
├── vite.config.js # Vite configuration
|
|
85
|
+
├── package.json
|
|
86
|
+
└── README.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Working with Components
|
|
90
|
+
|
|
91
|
+
### Using desy-html Components
|
|
92
|
+
|
|
93
|
+
Find component examples on [desy.aragon.es](https://desy.aragon.es) such as [this button component](https://desy.aragon.es/componente-botones-codigo.html). Copy the Nunjucks code and paste it into your template's content area.
|
|
94
|
+
|
|
95
|
+
Components are available as Nunjucks macros. Import and use them in your templates:
|
|
96
|
+
|
|
97
|
+
```njk
|
|
98
|
+
{% from "components/button/_macro.button.njk" import componentButton %}
|
|
99
|
+
|
|
100
|
+
{{ componentButton({
|
|
101
|
+
"text": "Transparent",
|
|
102
|
+
"classes": "c-button--transparent"
|
|
103
|
+
}) }}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Available Components
|
|
107
|
+
|
|
108
|
+
The desy-html library includes many [accessible components](https://desy.aragon.es/componentes.html):
|
|
109
|
+
|
|
110
|
+
- **Navigation:** Menu, Menubar, Nav, Tabs
|
|
111
|
+
- **Forms:** Checkbox, Radio Button, Listbox, Datepicker, Toggle
|
|
112
|
+
- **Feedback:** Alert, Notification, Dialog, Tooltip
|
|
113
|
+
- **Layout:** Accordion, Collapsible, Tree, Treegrid
|
|
114
|
+
- **Data:** Table Advanced, Dropdown
|
|
115
|
+
|
|
116
|
+
## Styling
|
|
117
|
+
|
|
118
|
+
### Using Tailwind CSS
|
|
119
|
+
|
|
120
|
+
The project uses Tailwind CSS v4. All Tailwind utility classes are available in your templates:
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<div class="flex items-center gap-4 p-6 bg-white rounded-lg shadow">
|
|
124
|
+
<h1 class="text-2xl font-bold text-gray-900">Hello World</h1>
|
|
125
|
+
</div>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Adding Custom Styles
|
|
129
|
+
|
|
130
|
+
Add your project-specific styles in `src/css/custom.css`:
|
|
131
|
+
|
|
132
|
+
```css
|
|
133
|
+
/* src/css/custom.css */
|
|
134
|
+
.my-custom-class {
|
|
135
|
+
/* Your custom styles */
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Theme Variables
|
|
140
|
+
|
|
141
|
+
desy-html provides CSS custom properties (variables) for consistent theming. These are automatically included when you import the main [stylesheet](https://bitbucket.org/sdaragon/desy-html/src/master/src/css/styles.css).
|
|
142
|
+
|
|
143
|
+
## Templates
|
|
144
|
+
|
|
145
|
+
### Page Templates
|
|
146
|
+
|
|
147
|
+
Create new pages by extending the base layouts. Several templates are provided:
|
|
148
|
+
|
|
149
|
+
| Template | Description |
|
|
150
|
+
|----------|-------------|
|
|
151
|
+
| `plantilla-sin-loguear.html` | Public pages (not logged in) |
|
|
152
|
+
| `plantilla-logueado-con-cabecera-fija.html` | Logged-in pages with fixed header |
|
|
153
|
+
| `plantilla-logueado-con-selector-de-app.html` | Logged-in with app selector |
|
|
154
|
+
| `plantilla-con-header-advanced.html` | Advanced header layout |
|
|
155
|
+
|
|
156
|
+
### Creating Custom Components
|
|
157
|
+
|
|
158
|
+
Custom components follow a consistent file structure. Create a new folder in `src/templates/components/` with the following files:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
src/templates/components/my-component/
|
|
162
|
+
├── _macro.my-component.njk # Exports the macro (entry point)
|
|
163
|
+
├── _template.my-component.njk # HTML template with the component markup
|
|
164
|
+
├── _examples.my-component.njk # Example data for testing/documentation
|
|
165
|
+
└── params.my-component.yaml # Parameter documentation
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Step 1: Create the Macro File
|
|
169
|
+
|
|
170
|
+
The macro file exports your component and includes the template:
|
|
171
|
+
|
|
172
|
+
```njk
|
|
173
|
+
{# _macro.my-component.njk #}
|
|
174
|
+
{% macro componentMyComponent(params) %}
|
|
175
|
+
{% include "./_template.my-component.njk" %}
|
|
176
|
+
{% endmacro %}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Step 2: Create the Template File
|
|
180
|
+
|
|
181
|
+
The template contains the actual HTML markup. Use the `params` object to access component properties:
|
|
182
|
+
|
|
183
|
+
```njk
|
|
184
|
+
{# _template.my-component.njk #}
|
|
185
|
+
<div {%- if params.classes %} class="{{ params.classes }}"{% endif %}
|
|
186
|
+
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
|
|
187
|
+
{{ params.html | safe if params.html else params.text }}
|
|
188
|
+
</div>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Step 3: Define Examples (Optional)
|
|
192
|
+
|
|
193
|
+
Examples help document component usage and can be used for testing:
|
|
194
|
+
|
|
195
|
+
```njk
|
|
196
|
+
{# _examples.my-component.njk #}
|
|
197
|
+
{% set exampleComponent = "my-component" %}
|
|
198
|
+
{% set examples = [
|
|
199
|
+
{
|
|
200
|
+
"name": "default",
|
|
201
|
+
"data": {
|
|
202
|
+
"text": "This is my component"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"name": "with html",
|
|
207
|
+
"data": {
|
|
208
|
+
"html": "This is <strong class=\"font-bold\">my component</strong>"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
] %}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Step 4: Document Parameters (Optional)
|
|
215
|
+
|
|
216
|
+
The YAML file documents available parameters for the component:
|
|
217
|
+
|
|
218
|
+
```yaml
|
|
219
|
+
# params.my-component.yaml
|
|
220
|
+
params:
|
|
221
|
+
- name: text
|
|
222
|
+
type: string
|
|
223
|
+
required: true
|
|
224
|
+
description: Text content for the component. Ignored if `html` is provided.
|
|
225
|
+
- name: html
|
|
226
|
+
type: string
|
|
227
|
+
required: false
|
|
228
|
+
description: HTML content for the component. Takes priority over `text`.
|
|
229
|
+
- name: classes
|
|
230
|
+
type: string
|
|
231
|
+
required: false
|
|
232
|
+
description: CSS classes to add to the component.
|
|
233
|
+
- name: attributes
|
|
234
|
+
type: object
|
|
235
|
+
required: false
|
|
236
|
+
description: HTML attributes (e.g., data attributes) to add to the component.
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### Using Your Component
|
|
240
|
+
|
|
241
|
+
Import and use your component in any template. The project configures Nunjucks to resolve paths from `src/templates/`, so use the `components/` prefix:
|
|
242
|
+
|
|
243
|
+
```njk
|
|
244
|
+
{% from "components/my-component/_macro.my-component.njk" import componentMyComponent %}
|
|
245
|
+
|
|
246
|
+
{{ componentMyComponent({
|
|
247
|
+
text: "Hello world",
|
|
248
|
+
classes: "text-lg text-gray-700"
|
|
249
|
+
}) }}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### Components with Nested Content (Caller)
|
|
253
|
+
|
|
254
|
+
For components that need to accept nested content, use Nunjucks' `call` block pattern:
|
|
255
|
+
|
|
256
|
+
```njk
|
|
257
|
+
{# _template.my-container.njk #}
|
|
258
|
+
<div class="container">
|
|
259
|
+
<p>{{ params.text }}</p>
|
|
260
|
+
{% if caller %}
|
|
261
|
+
{{ caller() }}
|
|
262
|
+
{% elseif params.caller %}
|
|
263
|
+
{{ params.caller | safe }}
|
|
264
|
+
{% endif %}
|
|
265
|
+
</div>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Usage with `call` block:
|
|
269
|
+
|
|
270
|
+
```njk
|
|
271
|
+
{% call componentMyContainer({ text: "Container title" }) %}
|
|
272
|
+
<p>This nested content appears inside the container.</p>
|
|
273
|
+
<button>Click me</button>
|
|
274
|
+
{% endcall %}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Using Includes
|
|
278
|
+
|
|
279
|
+
Includes are reusable template fragments that can be inserted into multiple pages. Unlike components (which receive parameters), includes are static snippets that can import and use components internally.
|
|
280
|
+
|
|
281
|
+
#### Creating an Include
|
|
282
|
+
|
|
283
|
+
Create include files in `src/templates/includes/` with names starting with underscore:
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
src/templates/includes/
|
|
287
|
+
└── _my-include.njk
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Example include file:
|
|
291
|
+
|
|
292
|
+
```njk
|
|
293
|
+
{# _my-include.njk #}
|
|
294
|
+
{% from "components/test-component/_macro.test-component.njk" import componentTestComponent %}
|
|
295
|
+
|
|
296
|
+
<div class="p-base border border-neutral-base">
|
|
297
|
+
<p>This is reusable content</p>
|
|
298
|
+
{{ componentTestComponent({
|
|
299
|
+
"text": "A component inside the include"
|
|
300
|
+
}) }}
|
|
301
|
+
</div>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### Using an Include
|
|
305
|
+
|
|
306
|
+
Insert an include into any page or template with the `{% include %}` tag:
|
|
307
|
+
|
|
308
|
+
```njk
|
|
309
|
+
{% include "includes/_my-include.njk" %}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
#### When to Use Includes vs Components
|
|
313
|
+
|
|
314
|
+
| Use Case | Includes | Components |
|
|
315
|
+
|----------|----------|------------|
|
|
316
|
+
| Static, repeated content | Yes | No |
|
|
317
|
+
| Configurable, reusable UI elements | No | Yes |
|
|
318
|
+
| Content that needs parameters | No | Yes |
|
|
319
|
+
| Quick content reuse without configuration | Yes | No |
|
|
320
|
+
|
|
321
|
+
## Images
|
|
322
|
+
|
|
323
|
+
### Image Inheritance System
|
|
324
|
+
|
|
325
|
+
This project uses an image inheritance system that allows you to use images from the desy-html library while also being able to override them with your own:
|
|
326
|
+
|
|
327
|
+
1. **Base images** come from `node_modules/desy-html/public/images/`
|
|
328
|
+
2. **Project images** in `public/images/` override base images with the same name
|
|
329
|
+
|
|
330
|
+
### Adding Project Images
|
|
331
|
+
|
|
332
|
+
Place your images in `public/images/`. Reference them in templates using the `/images/` path:
|
|
333
|
+
|
|
334
|
+
```html
|
|
335
|
+
<img src="/images/my-image.png" alt="Description">
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Overriding desy-html Images
|
|
339
|
+
|
|
340
|
+
To replace a desy-html image with your own version, simply place a file with the same name in `public/images/`. Your image will take priority.
|
|
341
|
+
|
|
342
|
+
### Using Images in CSS
|
|
343
|
+
|
|
344
|
+
For background images in your custom CSS, use the `/images/` path:
|
|
345
|
+
|
|
346
|
+
```css
|
|
347
|
+
.my-element {
|
|
348
|
+
background-image: url('/images/my-background.png');
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Image Optimization
|
|
353
|
+
|
|
354
|
+
During production builds, images are automatically optimized using Sharp:
|
|
355
|
+
|
|
356
|
+
- Images from both desy-html and your project are processed
|
|
357
|
+
- Supported formats: jpg, png, webp, avif
|
|
358
|
+
- File sizes are optimized for production
|
|
359
|
+
- Paths are automatically adjusted for the dist folder
|
|
360
|
+
|
|
361
|
+
## Development Tips
|
|
362
|
+
|
|
363
|
+
### Hot Module Replacement
|
|
364
|
+
|
|
365
|
+
The development server supports HMR. Changes to CSS, JavaScript, and templates will automatically refresh in the browser.
|
|
366
|
+
|
|
367
|
+
### Nunjucks Template Syntax
|
|
368
|
+
|
|
369
|
+
```njk
|
|
370
|
+
{# Comments #}
|
|
371
|
+
{% set variable = "value" %}
|
|
372
|
+
{{ variable }}
|
|
373
|
+
|
|
374
|
+
{% if condition %}
|
|
375
|
+
...
|
|
376
|
+
{% endif %}
|
|
377
|
+
|
|
378
|
+
{% for item in items %}
|
|
379
|
+
{{ item }}
|
|
380
|
+
{% endfor %}
|
|
381
|
+
|
|
382
|
+
{% include "includes/_partial.njk" %}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Debugging
|
|
386
|
+
|
|
387
|
+
- Check the browser console for JavaScript errors
|
|
388
|
+
- Use the Vite terminal output for build errors
|
|
389
|
+
- Inspect generated HTML in browser developer tools
|
|
390
|
+
|
|
391
|
+
## Scripts Reference
|
|
392
|
+
|
|
393
|
+
| Command | Description |
|
|
394
|
+
|---------|-------------|
|
|
395
|
+
| `npm run dev` | Start development server with HMR |
|
|
396
|
+
| `npm run build` | Build for production |
|
|
397
|
+
| `npm run preview` | Preview production build locally |
|
|
398
|
+
|
|
399
|
+
## Accessibility
|
|
400
|
+
|
|
401
|
+
All desy-html components are built with accessibility in mind:
|
|
402
|
+
|
|
403
|
+
- Proper ARIA attributes and roles
|
|
404
|
+
- Keyboard navigation support
|
|
405
|
+
- Screen reader compatibility
|
|
406
|
+
- Focus management
|
|
407
|
+
|
|
408
|
+
When creating custom components, follow the same accessibility patterns.
|
|
409
|
+
|
|
410
|
+
## Browser Support
|
|
411
|
+
|
|
412
|
+
The project targets modern browsers. For specific compatibility information, refer to the [desy documentation](https://desy.aragon.es/).
|
|
413
|
+
|
|
414
|
+
## Contributing
|
|
415
|
+
|
|
416
|
+
1. Fork the repository
|
|
417
|
+
2. Create a feature branch
|
|
418
|
+
3. Make your changes
|
|
419
|
+
4. Submit a pull request
|
|
420
|
+
|
|
421
|
+
## Author
|
|
422
|
+
|
|
423
|
+
**SDA Servicios Digitales de Aragón**
|
|
424
|
+
|
|
425
|
+
## License
|
|
426
|
+
|
|
427
|
+
This project is licensed under the [EUPL-1.2](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12) license.
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
For more information and detailed component documentation, visit [https://desy.aragon.es/](https://desy.aragon.es/)
|
package/docs/index.html
CHANGED
|
@@ -5,37 +5,145 @@
|
|
|
5
5
|
{% block contentBlock %}
|
|
6
6
|
|
|
7
7
|
<div class="prose pb-xl">
|
|
8
|
-
<div class="pb-lg"
|
|
8
|
+
<div class="pb-lg"> </div>
|
|
9
9
|
<h1>desy-html</h1>
|
|
10
10
|
<p>Versión: {{ '' | filterversion }}</p>
|
|
11
|
-
<p>
|
|
12
|
-
<p>Si necesitas una librería con más potencia para construir tu aplicación web, te recomendamos mejor, que uses su versión traducida a Angular: <a href="https://bitbucket.org/sdaragon/desy-angular">desy-angular librería NPM</a>, <a href="https://desy.aragon.es/desy-angular">Ejemplos de desy-angular</a></p>
|
|
13
|
-
<p>Mira ejemplos de componentes y plantillas de página en la documentación: <a href="https://desy.aragon.es/">https://desy.aragon.es/</a></p>
|
|
11
|
+
<p>Una librería NPM para construir interfaces de usuario para aplicaciones web del Gobierno de Aragón. Utiliza <a href="https://vite.dev/">Vite</a>, <a href="https://tailwindcss.com/">Tailwind CSS</a> y <a href="https://mozilla.github.io/nunjucks/">Nunjucks</a> para renderizar componentes HTML+CSS+JS. Es útil para crear aplicaciones web ligeras o maquetas HTML.</p>
|
|
14
12
|
|
|
15
|
-
<h2
|
|
13
|
+
<h2>Descripción general</h2>
|
|
14
|
+
<p><strong>desy-html</strong> es la librería del sistema de diseño principal que proporciona:</p>
|
|
16
15
|
<ul>
|
|
17
|
-
<li>
|
|
18
|
-
<li>
|
|
19
|
-
<li>
|
|
20
|
-
<li>
|
|
16
|
+
<li><strong>Vite</strong> - Herramienta de compilación rápida y servidor de desarrollo con reemplazo de módulo en caliente</li>
|
|
17
|
+
<li><strong>Tailwind CSS v4</strong> - Framework CSS basado en utilidades</li>
|
|
18
|
+
<li><strong>Nunjucks</strong> - Motor de plantillas potente para generar HTML</li>
|
|
19
|
+
<li><strong>Sharp</strong> - Optimización de imágenes para compilaciones de producción</li>
|
|
20
|
+
<li><strong>Componentes Accesibles</strong> - Componentes UI preconstruidos siguiendo patrones ARIA</li>
|
|
21
|
+
</ul>
|
|
22
|
+
<p>Si necesitas una librería más potente basada en esta, usa su versión de Angular en su lugar: <a href="https://bitbucket.org/sdaragon/desy-angular">desy-angular</a></p>
|
|
23
|
+
|
|
24
|
+
<h2>Enlaces rápidos</h2>
|
|
25
|
+
<ul>
|
|
26
|
+
<li><strong>Documentación:</strong> <a href="https://desy.aragon.es/">https://desy.aragon.es/</a></li>
|
|
27
|
+
<li><strong>Repositorio:</strong> <a href="https://bitbucket.org/sdaragon/desy-html/">https://bitbucket.org/sdaragon/desy-html/</a></li>
|
|
28
|
+
<li><strong>Proyecto Starter:</strong> <a href="https://bitbucket.org/sdaragon/desy-html-starter/">https://bitbucket.org/sdaragon/desy-html-starter/</a></li>
|
|
21
29
|
</ul>
|
|
22
30
|
|
|
23
31
|
<h2>¿Cómo comienzo un proyecto que usa los componentes de desy-html?</h2>
|
|
24
|
-
<p>Para comenzar un nuevo proyecto que usa desy-html como dependencia, no uses este repositorio
|
|
32
|
+
<p>Para comenzar un nuevo proyecto que usa desy-html como dependencia, <strong>no uses este repositorio</strong>, usa el repositorio <strong>desy-html-starter</strong> en su lugar:</p>
|
|
33
|
+
<ol>
|
|
34
|
+
<li>Descarga el proyecto desy-html-starter desde <a href="https://bitbucket.org/sdaragon/desy-html-starter">https://bitbucket.org/sdaragon/desy-html-starter</a></li>
|
|
35
|
+
<li>Personaliza el proyecto descargado según tus necesidades</li>
|
|
36
|
+
<li>Podrás usar cualquier componente de desy-html en ese proyecto</li>
|
|
37
|
+
</ol>
|
|
38
|
+
|
|
39
|
+
<h2>Requisitos previos</h2>
|
|
40
|
+
<p>Antes de comenzar, asegúrate de tener instalado lo siguiente:</p>
|
|
25
41
|
<ul>
|
|
26
|
-
<li>
|
|
27
|
-
<li>
|
|
28
|
-
<li>Podrás usar cualquier componente de desy-html en ese proyecto. Copia cualquier ejemplo de macro desde la <a href="https://desy.aragon.es/desy-html">documentación de desy-html</a> y pégalo dentro de tu página, include o componente del nuevo proyecto.</li>
|
|
42
|
+
<li><strong>Node.js</strong> >=20.19.2 <23.0.0</li>
|
|
43
|
+
<li><strong>npm</strong> >=10.0.0</li>
|
|
29
44
|
</ul>
|
|
30
45
|
|
|
46
|
+
<h2>Primeros pasos</h2>
|
|
47
|
+
<h3>1. Clonar el repositorio</h3>
|
|
48
|
+
<pre><code>git clone https://bitbucket.org/sdaragon/desy-html.git
|
|
49
|
+
cd desy-html</code></pre>
|
|
50
|
+
|
|
51
|
+
<h3>2. Instalar dependencias</h3>
|
|
52
|
+
<pre><code>npm install</code></pre>
|
|
53
|
+
|
|
54
|
+
<h3>3. Iniciar el servidor de desarrollo</h3>
|
|
55
|
+
<pre><code>npm run dev</code></pre>
|
|
56
|
+
<p>Esto inicia el servidor de desarrollo de Vite con reemplazo de módulo en caliente. Abre tu navegador en la URL mostrada en la salida del terminal.</p>
|
|
57
|
+
|
|
58
|
+
<h3>4. Compilar para producción</h3>
|
|
59
|
+
<pre><code>npm run build</code></pre>
|
|
60
|
+
<p>Esto compila HTML, purga y minifica CSS, y optimiza JavaScript en la carpeta `/dist`.</p>
|
|
61
|
+
|
|
62
|
+
<h3>5. Previsualizar la compilación de producción</h3>
|
|
63
|
+
<pre><code>npm run preview</code></pre>
|
|
64
|
+
|
|
65
|
+
<h2>Estilos</h2>
|
|
66
|
+
<h3>Usando Tailwind CSS</h3>
|
|
67
|
+
<p>El proyecto utiliza Tailwind CSS v4. Todas las clases de utilidad de Tailwind están disponibles en tus plantillas.</p>
|
|
68
|
+
|
|
69
|
+
<h3>Variables de tema</h3>
|
|
70
|
+
<p>desy-html proporciona propiedades CSS personalizadas (variables) para una temática consistente. Estos se incluyen en la <a href="https://bitbucket.org/sdaragon/desy-html/src/master/src/css/styles.css">hoja de estilos principal</a>.</p>
|
|
71
|
+
|
|
72
|
+
<h2>Imágenes</h2>
|
|
73
|
+
<h3>Estructura de imágenes</h3>
|
|
74
|
+
<p>Las imágenes se almacenan en `public/images/` y se pueden referenciar en plantillas usando la ruta `/images/`:</p>
|
|
75
|
+
<pre><code><img src="/images/my-image.png" alt="Description"></code></pre>
|
|
76
|
+
|
|
77
|
+
<h3>Optimización de imágenes</h3>
|
|
78
|
+
<p>Durante las compilaciones de producción, las imágenes se optimizan automáticamente usando Sharp:</p>
|
|
79
|
+
<ul>
|
|
80
|
+
<li>Formatos compatibles: jpg, png, webp, avif</li>
|
|
81
|
+
<li>Los tamaños de archivo se optimizan para producción</li>
|
|
82
|
+
</ul>
|
|
83
|
+
|
|
84
|
+
<h2>Consejos de desarrollo</h2>
|
|
85
|
+
<h3>Reemplazo de módulo en caliente</h3>
|
|
86
|
+
<p>El servidor de desarrollo admite HMR. Los cambios en CSS, JavaScript y plantillas se actualizarán automáticamente en el navegador.</p>
|
|
87
|
+
|
|
88
|
+
<h3>Depuración</h3>
|
|
89
|
+
<ul>
|
|
90
|
+
<li>Comprueba la consola del navegador para ver errores de JavaScript</li>
|
|
91
|
+
<li>Usa la salida del terminal de Vite para errores de compilación</li>
|
|
92
|
+
<li>Inspecciona el HTML generado en las herramientas de desarrollo del navegador</li>
|
|
93
|
+
</ul>
|
|
94
|
+
|
|
95
|
+
<h2>Referencia de scripts</h2>
|
|
96
|
+
<table>
|
|
97
|
+
<thead>
|
|
98
|
+
<tr>
|
|
99
|
+
<th>Comando</th>
|
|
100
|
+
<th>Descripción</th>
|
|
101
|
+
</tr>
|
|
102
|
+
</thead>
|
|
103
|
+
<tbody>
|
|
104
|
+
<tr>
|
|
105
|
+
<td><code>npm run dev</code></td>
|
|
106
|
+
<td>Inicia el servidor de desarrollo con HMR</td>
|
|
107
|
+
</tr>
|
|
108
|
+
<tr>
|
|
109
|
+
<td><code>npm run build</code></td>
|
|
110
|
+
<td>Compila para producción</td>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<td><code>npm run preview</code></td>
|
|
114
|
+
<td>Previsualiza la compilación de producción localmente</td>
|
|
115
|
+
</tr>
|
|
116
|
+
</tbody>
|
|
117
|
+
</table>
|
|
118
|
+
|
|
119
|
+
<h2>Accesibilidad</h2>
|
|
120
|
+
<p>Todos los componentes de desy-html están construidos teniendo en cuenta la accesibilidad:</p>
|
|
121
|
+
<ul>
|
|
122
|
+
<li>Atributos y roles ARIA adecuados</li>
|
|
123
|
+
<li>Soporte de navegación por teclado</li>
|
|
124
|
+
<li>Compatibilidad con lectores de pantalla</li>
|
|
125
|
+
<li>Gestión del enfoque</li>
|
|
126
|
+
</ul>
|
|
127
|
+
|
|
128
|
+
<h2>Soporte de navegadores</h2>
|
|
129
|
+
<p>El proyecto está dirigido a navegadores modernos. Para obtener información específica sobre compatibilidad, consulta la <a href="https://desy.aragon.es/">documentación de desy</a>.</p>
|
|
130
|
+
|
|
131
|
+
<h2>Contribuciones</h2>
|
|
132
|
+
<ol>
|
|
133
|
+
<li>Haz un fork del repositorio</li>
|
|
134
|
+
<li>Crea una rama de características</li>
|
|
135
|
+
<li>Realiza tus cambios</li>
|
|
136
|
+
<li>Envía una solicitud de extracción</li>
|
|
137
|
+
</ol>
|
|
138
|
+
|
|
31
139
|
<h2>Contacta con el equipo</h2>
|
|
32
140
|
<p>desy-html está mantenido por un equipo de SDA Servicios Digitales de Aragón (España). Si quieres saber más acerca de desy-html, puedes escribir por email a alguno de los commiters.</p>
|
|
33
141
|
|
|
34
|
-
<h2>
|
|
35
|
-
<p>
|
|
142
|
+
<h2>Autor</h2>
|
|
143
|
+
<p><strong>SDA Servicios Digitales de Aragón</strong></p>
|
|
36
144
|
|
|
37
|
-
<h2>
|
|
38
|
-
<p>
|
|
145
|
+
<h2>Licencia del software</h2>
|
|
146
|
+
<p>Este proyecto está licenciado bajo la licencia <a href="https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12">EUPL-1.2</a>. <a href="EUPL-1.2.txt">Lee la licencia</a>.</p>
|
|
39
147
|
|
|
40
148
|
<h2>Changelog (English)</h2>
|
|
41
149
|
<p>What's new in the latest version of desy-html</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desy-html",
|
|
3
|
-
"version": "15.0.0
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "desy-html contains the code you need to start building a user interface for Gobierno de Aragón government webapps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://desy.aragon.es/",
|
|
23
23
|
"engines": {
|
|
24
|
-
"node": "
|
|
25
|
-
"npm": "
|
|
24
|
+
"node": ">=20.19.2 <23.0.0",
|
|
25
|
+
"npm": ">=10.0.0"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"dev": "vite",
|
package/replit.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# desy-html
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
desy-html is an NPM library that provides a design system for building user interfaces for Government of Aragón (Spain) web applications. It delivers pre-built, accessible UI components using Vite as the build tool, Tailwind CSS v4 for styling, and Nunjucks as the templating engine. The library is designed to be consumed as a dependency through a separate starter project (desy-html-starter) rather than used directly.
|
|
6
|
+
|
|
7
|
+
The project serves as the core component library and documentation site, providing reusable HTML+CSS+JS components that follow ARIA accessibility patterns for government web applications.
|
|
8
|
+
|
|
9
|
+
## User Preferences
|
|
10
|
+
|
|
11
|
+
Preferred communication style: Simple, everyday language.
|
|
12
|
+
|
|
13
|
+
## System Architecture
|
|
14
|
+
|
|
15
|
+
### Build System
|
|
16
|
+
- **Vite** serves as the primary build tool and development server, providing fast hot module replacement during development
|
|
17
|
+
- Build configuration in `vite.config.js` includes custom Nunjucks environment setup, HTML beautification with js-beautify, YAML parsing for component parameters, and image optimization with Sharp
|
|
18
|
+
- Three npm scripts: `dev` (development server), `build` (production build), `preview` (preview production build)
|
|
19
|
+
|
|
20
|
+
### Templating Architecture
|
|
21
|
+
- **Nunjucks** templating engine generates HTML components with a macro-based component system
|
|
22
|
+
- Components follow a consistent file structure pattern: `src/templates/components/{component-name}/` containing macros, examples, and YAML parameter definitions
|
|
23
|
+
- Page templates use inheritance with base templates in `src/templates/pages/` for different layout configurations (logged-in, logged-out, with sidebar, fixed header, etc.)
|
|
24
|
+
- Documentation pages in `docs/` directory extend templates and import component examples
|
|
25
|
+
|
|
26
|
+
### Styling System
|
|
27
|
+
- **Tailwind CSS v4** with `@tailwindcss/vite` plugin integration
|
|
28
|
+
- Custom theme configuration in `src/css/styles.css` defining colors, breakpoints, and spacing tokens aligned with government branding
|
|
29
|
+
- Component-specific CSS files using Tailwind's `@layer components` directive (e.g., `component.text.css`, `component.form-group.css`)
|
|
30
|
+
- Typography plugin (`@tailwindcss/typography`) and forms plugin (`@tailwindcss/forms`) for enhanced styling
|
|
31
|
+
|
|
32
|
+
### JavaScript Architecture
|
|
33
|
+
- ES modules architecture with component-specific ARIA implementations in `src/js/aria/`
|
|
34
|
+
- Central initialization in `src/js/index.js` that imports and initializes all interactive components
|
|
35
|
+
- Components implement W3C ARIA Authoring Practices for accessibility (accordion, dialog, listbox, menubar, tabs, tree, etc.)
|
|
36
|
+
- Uses `@floating-ui/dom` for tooltip and dropdown positioning
|
|
37
|
+
- Includes `cally` library for calendar/datepicker functionality
|
|
38
|
+
- Optional `headroom.js` integration for auto-hiding headers on scroll
|
|
39
|
+
|
|
40
|
+
### Component Library
|
|
41
|
+
- 50+ pre-built accessible components including: accordion, alert, button, card, checkboxes, datepicker, dialog, dropdown, fieldset, file-upload, header/footer, input variants, menus, modal, notification, pagination, select, tabs, table, tooltip, tree, and more
|
|
42
|
+
- Each component has a Nunjucks macro for rendering, YAML file for parameter documentation, and example file
|
|
43
|
+
- Components are designed to be copied from documentation and used in projects via the starter template
|
|
44
|
+
|
|
45
|
+
## External Dependencies
|
|
46
|
+
|
|
47
|
+
### Runtime Dependencies
|
|
48
|
+
- `@floating-ui/dom` - Positioning library for tooltips and dropdowns
|
|
49
|
+
- `@tailwindcss/vite` - Vite plugin for Tailwind CSS v4
|
|
50
|
+
- `tailwindcss` - Utility-first CSS framework (v4)
|
|
51
|
+
- `autoprefixer` - CSS vendor prefixing
|
|
52
|
+
- `cally` - Calendar/datepicker web component
|
|
53
|
+
- `chokidar` - File watching for development
|
|
54
|
+
- `hex-rgb` - Color conversion utility
|
|
55
|
+
- `js-yaml` - YAML parsing for component parameters
|
|
56
|
+
|
|
57
|
+
### Development Dependencies
|
|
58
|
+
- `vite` - Build tool and dev server
|
|
59
|
+
- `nunjucks` - Templating engine
|
|
60
|
+
- `sharp` - Image optimization for production builds
|
|
61
|
+
- `highlight.js` - Code syntax highlighting in documentation
|
|
62
|
+
- `js-beautify` - HTML formatting for documentation examples
|
|
63
|
+
- `glob` - File pattern matching
|
|
64
|
+
- `outdent` - Template literal dedenting
|
|
65
|
+
- `@tailwindcss/forms` - Form element styling plugin
|
|
66
|
+
- `@tailwindcss/typography` - Prose content styling plugin
|
|
67
|
+
|
|
68
|
+
### External Resources
|
|
69
|
+
- Documentation hosted at https://desy.aragon.es/
|
|
70
|
+
- Starter project available at https://bitbucket.org/sdaragon/desy-html-starter/
|
|
71
|
+
- Angular port available at https://bitbucket.org/sdaragon/desy-angular
|
|
72
|
+
|
|
73
|
+
### System Requirements
|
|
74
|
+
- Node.js ^22.0.0
|
|
75
|
+
- npm ^10.0.0
|
|
@@ -981,93 +981,6 @@
|
|
|
981
981
|
]
|
|
982
982
|
}
|
|
983
983
|
},
|
|
984
|
-
{
|
|
985
|
-
"name": "con un texto de item muy largo",
|
|
986
|
-
"data": {
|
|
987
|
-
"name": "with-very-long-option-text",
|
|
988
|
-
"classes": "mt-base",
|
|
989
|
-
"fieldset": {
|
|
990
|
-
"legend": {
|
|
991
|
-
"text": "Selecciona organismo"
|
|
992
|
-
}
|
|
993
|
-
},
|
|
994
|
-
"hint": {
|
|
995
|
-
"text": "Selecciona el organismo al que perteneces."
|
|
996
|
-
},
|
|
997
|
-
"idPrefix": "with-very-long-option-text",
|
|
998
|
-
"items": [
|
|
999
|
-
{
|
|
1000
|
-
"text": "Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus.",
|
|
1001
|
-
"id": "with-very-long-option-text-example-item-1",
|
|
1002
|
-
"sub": {
|
|
1003
|
-
"items": [
|
|
1004
|
-
{
|
|
1005
|
-
"text": "Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus.",
|
|
1006
|
-
"value": "subitem-1"
|
|
1007
|
-
},
|
|
1008
|
-
{
|
|
1009
|
-
"text": "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum.",
|
|
1010
|
-
"value": "subitem-2"
|
|
1011
|
-
},
|
|
1012
|
-
{
|
|
1013
|
-
"text": "Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis.",
|
|
1014
|
-
"value": "subitem-3"
|
|
1015
|
-
}
|
|
1016
|
-
],
|
|
1017
|
-
"attributes": {
|
|
1018
|
-
"aria-labelledby": "with-very-long-option-text-example-item-1"
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
},
|
|
1022
|
-
{
|
|
1023
|
-
"text": "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum.",
|
|
1024
|
-
"id": "with-very-long-option-text-example-item-2",
|
|
1025
|
-
"sub": {
|
|
1026
|
-
"items": [
|
|
1027
|
-
{
|
|
1028
|
-
"text": "Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus.",
|
|
1029
|
-
"value": "subitem-1"
|
|
1030
|
-
},
|
|
1031
|
-
{
|
|
1032
|
-
"text": "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum.",
|
|
1033
|
-
"value": "subitem-2"
|
|
1034
|
-
},
|
|
1035
|
-
{
|
|
1036
|
-
"text": "Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis.",
|
|
1037
|
-
"value": "subitem-3"
|
|
1038
|
-
}
|
|
1039
|
-
],
|
|
1040
|
-
"attributes": {
|
|
1041
|
-
"aria-labelledby": "with-very-long-option-text-example-item-2"
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
"text": "Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis.",
|
|
1047
|
-
"id": "with-very-long-option-text-example-item-3",
|
|
1048
|
-
"sub": {
|
|
1049
|
-
"items": [
|
|
1050
|
-
{
|
|
1051
|
-
"text": "Nullam id dolor id nibh ultricies vehicula ut id elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas faucibus mollis interdum. Donec id elit non mi porta gravida at eget metus.",
|
|
1052
|
-
"value": "subitem-1"
|
|
1053
|
-
},
|
|
1054
|
-
{
|
|
1055
|
-
"text": "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum.",
|
|
1056
|
-
"value": "subitem-2"
|
|
1057
|
-
},
|
|
1058
|
-
{
|
|
1059
|
-
"text": "Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Sed posuere consectetur est at lobortis.",
|
|
1060
|
-
"value": "subitem-3"
|
|
1061
|
-
}
|
|
1062
|
-
],
|
|
1063
|
-
"attributes": {
|
|
1064
|
-
"aria-labelledby": "with-very-long-option-text-example-item-3"
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
]
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
984
|
{
|
|
1072
985
|
"name": "con un legend como encabezado",
|
|
1073
986
|
"data": {
|
|
@@ -1232,94 +1145,6 @@
|
|
|
1232
1145
|
]
|
|
1233
1146
|
}
|
|
1234
1147
|
},
|
|
1235
|
-
{
|
|
1236
|
-
"name": "con todo items padres",
|
|
1237
|
-
"data": {
|
|
1238
|
-
"name": "with-all-parent-items",
|
|
1239
|
-
"classes": "mt-base",
|
|
1240
|
-
"type": "checkbox",
|
|
1241
|
-
"fieldset": {
|
|
1242
|
-
"legend": {
|
|
1243
|
-
"text": "Selecciona organismo"
|
|
1244
|
-
}
|
|
1245
|
-
},
|
|
1246
|
-
"hint": {
|
|
1247
|
-
"text": "Selecciona el organismo al que perteneces."
|
|
1248
|
-
},
|
|
1249
|
-
"idPrefix": "parent-example",
|
|
1250
|
-
"items": [
|
|
1251
|
-
{
|
|
1252
|
-
"text": "Item 1",
|
|
1253
|
-
"id": "parent-example-item-1",
|
|
1254
|
-
"sub": {
|
|
1255
|
-
"items": [
|
|
1256
|
-
{
|
|
1257
|
-
"text": "Subitem 1",
|
|
1258
|
-
"value": "subitem-1"
|
|
1259
|
-
},
|
|
1260
|
-
{
|
|
1261
|
-
"text": "Subitem 2",
|
|
1262
|
-
"value": "subitem-2"
|
|
1263
|
-
},
|
|
1264
|
-
{
|
|
1265
|
-
"text": "Subitem 3",
|
|
1266
|
-
"value": "subitem-3"
|
|
1267
|
-
}
|
|
1268
|
-
],
|
|
1269
|
-
"attributes": {
|
|
1270
|
-
"aria-labelledby": "parent-example-item-1"
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
},
|
|
1274
|
-
{
|
|
1275
|
-
"text": "Item 2",
|
|
1276
|
-
"id": "parent-example-item-2",
|
|
1277
|
-
"sub": {
|
|
1278
|
-
"items": [
|
|
1279
|
-
{
|
|
1280
|
-
"text": "Subitem 1",
|
|
1281
|
-
"value": "subitem-1"
|
|
1282
|
-
},
|
|
1283
|
-
{
|
|
1284
|
-
"text": "Subitem 2",
|
|
1285
|
-
"value": "subitem-2"
|
|
1286
|
-
},
|
|
1287
|
-
{
|
|
1288
|
-
"text": "Subitem 3",
|
|
1289
|
-
"value": "subitem-3"
|
|
1290
|
-
}
|
|
1291
|
-
],
|
|
1292
|
-
"attributes": {
|
|
1293
|
-
"aria-labelledby": "parent-example-item-2"
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
},
|
|
1297
|
-
{
|
|
1298
|
-
"text": "Item 3",
|
|
1299
|
-
"id": "parent-example-item-3",
|
|
1300
|
-
"sub": {
|
|
1301
|
-
"items": [
|
|
1302
|
-
{
|
|
1303
|
-
"text": "Subitem 1",
|
|
1304
|
-
"value": "subitem-1"
|
|
1305
|
-
},
|
|
1306
|
-
{
|
|
1307
|
-
"text": "Subitem 2",
|
|
1308
|
-
"value": "subitem-2"
|
|
1309
|
-
},
|
|
1310
|
-
{
|
|
1311
|
-
"text": "Subitem 3",
|
|
1312
|
-
"value": "subitem-3"
|
|
1313
|
-
}
|
|
1314
|
-
],
|
|
1315
|
-
"attributes": {
|
|
1316
|
-
"aria-labelledby": "parent-example-item-3"
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
]
|
|
1321
|
-
}
|
|
1322
|
-
},
|
|
1323
1148
|
{
|
|
1324
1149
|
"name": "con un item padre abierto",
|
|
1325
1150
|
"description": "Usa <code>'expanded': true</code>",
|
|
@@ -2099,142 +1924,6 @@
|
|
|
2099
1924
|
]
|
|
2100
1925
|
}
|
|
2101
1926
|
},
|
|
2102
|
-
{
|
|
2103
|
-
"name": "con ids individuales",
|
|
2104
|
-
"description": "Mostrar código para ver los <code>id</code> aplicados",
|
|
2105
|
-
"data": {
|
|
2106
|
-
"name": "with-individual-ids",
|
|
2107
|
-
"classes": "mt-base",
|
|
2108
|
-
"fieldset": {
|
|
2109
|
-
"legend": {
|
|
2110
|
-
"text": "Selecciona organismo"
|
|
2111
|
-
}
|
|
2112
|
-
},
|
|
2113
|
-
"hint": {
|
|
2114
|
-
"text": "Selecciona el organismo al que perteneces."
|
|
2115
|
-
},
|
|
2116
|
-
"items": [
|
|
2117
|
-
{
|
|
2118
|
-
"text": "Opción 1",
|
|
2119
|
-
"value": "option-1",
|
|
2120
|
-
"id": "option-A"
|
|
2121
|
-
},
|
|
2122
|
-
{
|
|
2123
|
-
"text": "Opción 2",
|
|
2124
|
-
"value": "option-2",
|
|
2125
|
-
"id": "option-B"
|
|
2126
|
-
},
|
|
2127
|
-
{
|
|
2128
|
-
"text": "Opción 3",
|
|
2129
|
-
"value": "option-3",
|
|
2130
|
-
"id": "option-C"
|
|
2131
|
-
},
|
|
2132
|
-
{
|
|
2133
|
-
"text": "Opción 4",
|
|
2134
|
-
"value": "option-4",
|
|
2135
|
-
"id": "option-D"
|
|
2136
|
-
},
|
|
2137
|
-
{
|
|
2138
|
-
"text": "Opción 5",
|
|
2139
|
-
"value": "option-5",
|
|
2140
|
-
"id": "option-E"
|
|
2141
|
-
}
|
|
2142
|
-
]
|
|
2143
|
-
}
|
|
2144
|
-
},
|
|
2145
|
-
{
|
|
2146
|
-
"name": "con atributos",
|
|
2147
|
-
"description": "Muestra el código para ver cómo se aplican los atributos",
|
|
2148
|
-
"data": {
|
|
2149
|
-
"name": "with-attributes",
|
|
2150
|
-
"classes": "mt-base",
|
|
2151
|
-
"fieldset": {
|
|
2152
|
-
"legend": {
|
|
2153
|
-
"text": "Selecciona organismo"
|
|
2154
|
-
}
|
|
2155
|
-
},
|
|
2156
|
-
"hint": {
|
|
2157
|
-
"text": "Selecciona el organismo al que perteneces."
|
|
2158
|
-
},
|
|
2159
|
-
"attributes": {
|
|
2160
|
-
"data-attribute-1": "tree-id-example-attribute"
|
|
2161
|
-
},
|
|
2162
|
-
"items": [
|
|
2163
|
-
{
|
|
2164
|
-
"text": "Opción 1",
|
|
2165
|
-
"value": "option-1",
|
|
2166
|
-
"attributes": {
|
|
2167
|
-
"data-attribute-1": "value-A",
|
|
2168
|
-
"data-attribute-2": "value-B",
|
|
2169
|
-
"data-attribute-3": "value-C"
|
|
2170
|
-
}
|
|
2171
|
-
},
|
|
2172
|
-
{
|
|
2173
|
-
"text": "Opción 2",
|
|
2174
|
-
"value": "option-2",
|
|
2175
|
-
"attributes": {
|
|
2176
|
-
"data-attribute-1": "value-A",
|
|
2177
|
-
"data-attribute-2": "value-B",
|
|
2178
|
-
"data-attribute-3": "value-C"
|
|
2179
|
-
}
|
|
2180
|
-
},
|
|
2181
|
-
{
|
|
2182
|
-
"text": "Opción 3",
|
|
2183
|
-
"value": "option-3",
|
|
2184
|
-
"attributes": {
|
|
2185
|
-
"data-attribute-1": "value-A",
|
|
2186
|
-
"data-attribute-2": "value-B",
|
|
2187
|
-
"data-attribute-3": "value-C"
|
|
2188
|
-
},
|
|
2189
|
-
"expanded": true,
|
|
2190
|
-
"sub": {
|
|
2191
|
-
"attributes": {
|
|
2192
|
-
"data-sub-attribute-1": "sub-value-A",
|
|
2193
|
-
"data-sub-attribute-2": "sub-value-B",
|
|
2194
|
-
"data-sub-attribute-3": "sub-value-C"
|
|
2195
|
-
},
|
|
2196
|
-
"items": [
|
|
2197
|
-
{
|
|
2198
|
-
"text": "Item",
|
|
2199
|
-
"value": "item",
|
|
2200
|
-
"attributes": {
|
|
2201
|
-
"data-item-attribute-1": "item-value-A",
|
|
2202
|
-
"data-item-attribute-2": "item-value-B",
|
|
2203
|
-
"data-item-attribute-3": "item-value-C"
|
|
2204
|
-
}
|
|
2205
|
-
},
|
|
2206
|
-
{
|
|
2207
|
-
"text": "Item",
|
|
2208
|
-
"value": "item"
|
|
2209
|
-
},
|
|
2210
|
-
{
|
|
2211
|
-
"text": "Item",
|
|
2212
|
-
"value": "item"
|
|
2213
|
-
}
|
|
2214
|
-
]
|
|
2215
|
-
}
|
|
2216
|
-
},
|
|
2217
|
-
{
|
|
2218
|
-
"text": "Opción 4",
|
|
2219
|
-
"value": "option-4",
|
|
2220
|
-
"attributes": {
|
|
2221
|
-
"data-attribute-1": "value-A",
|
|
2222
|
-
"data-attribute-2": "value-B",
|
|
2223
|
-
"data-attribute-3": "value-C"
|
|
2224
|
-
}
|
|
2225
|
-
},
|
|
2226
|
-
{
|
|
2227
|
-
"text": "Opción 5",
|
|
2228
|
-
"value": "option-5",
|
|
2229
|
-
"attributes": {
|
|
2230
|
-
"data-attribute-1": "value-A",
|
|
2231
|
-
"data-attribute-2": "value-B",
|
|
2232
|
-
"data-attribute-3": "value-C"
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
]
|
|
2236
|
-
}
|
|
2237
|
-
},
|
|
2238
1927
|
{
|
|
2239
1928
|
"name": "Mostrar u ocultar un item con JavaScript",
|
|
2240
1929
|
"description": "Puedes usar con javascript la función global <code>activateItemsTree(tree, element, show)</code>, para mostrar u ocultar todos los items, usando el id del elemento, el parámetro <code>show</code> admite <code>true</code> o <code>false</code>, si le pasamos true se se mostrará el item expandido, y si le pasamos false se mostrará cerrado. Ej: Abre la consola del navegador y escribe <code>activateItemsTree('tree-item-js', 'tree-item-js-example-item-1', true)</code> para mostrar todos los items expandidos.",
|
package/vite.config.js
CHANGED
|
@@ -719,7 +719,7 @@ export default defineConfig({
|
|
|
719
719
|
},
|
|
720
720
|
host: '0.0.0.0',
|
|
721
721
|
allowedHosts: [
|
|
722
|
-
'
|
|
722
|
+
'82c7d68c-1131-4db5-bf36-165d8f8b1d98-00-2b55tnaqky432.worf.replit.dev',
|
|
723
723
|
'localhost'
|
|
724
724
|
]
|
|
725
725
|
},
|