todosalud-webc-form-citas 1.4.0 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "todosalud-webc-form-citas",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Web Component para formulario de citas médicas TodoSalud",
5
5
  "main": "todosalud-webc-form-citas.js",
6
6
  "scripts": {
@@ -1,10 +1,17 @@
1
1
  // Loader para el Web Component
2
- // Este archivo carga los polyfills y el main en el orden correcto
2
+ // Este archivo carga el CSS, polyfills y el main en el orden correcto
3
3
  (function() {
4
- const scripts = [
5
- './todosalud-webc-form-citas-polyfills.js',
6
- './todosalud-webc-form-citas-main.js'
7
- ];
4
+ // Cargar CSS primero
5
+ function loadCSS(href) {
6
+ return new Promise((resolve, reject) => {
7
+ const link = document.createElement('link');
8
+ link.rel = 'stylesheet';
9
+ link.href = href;
10
+ link.onload = resolve;
11
+ link.onerror = reject;
12
+ document.head.appendChild(link);
13
+ });
14
+ }
8
15
 
9
16
  function loadScript(src) {
10
17
  return new Promise((resolve, reject) => {
@@ -17,8 +24,17 @@
17
24
  }
18
25
 
19
26
  async function loadAll() {
20
- for (const src of scripts) {
21
- await loadScript(src);
27
+ try {
28
+ // 1. Cargar CSS primero
29
+ await loadCSS('./todosalud-webc-form-citas.css');
30
+
31
+ // 2. Luego cargar polyfills
32
+ await loadScript('./todosalud-webc-form-citas-polyfills.js');
33
+
34
+ // 3. Finalmente cargar main
35
+ await loadScript('./todosalud-webc-form-citas-main.js');
36
+ } catch (error) {
37
+ console.error('Error al cargar el Web Component:', error);
22
38
  }
23
39
  }
24
40