wu-framework 1.1.7 → 1.1.9
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/LICENSE +19 -1
- package/README.md +257 -1122
- package/dist/wu-framework.cjs.js +3 -1
- package/dist/wu-framework.cjs.js.map +1 -0
- package/dist/wu-framework.dev.js +9867 -3183
- package/dist/wu-framework.dev.js.map +1 -1
- package/dist/wu-framework.esm.js +3 -0
- package/dist/wu-framework.esm.js.map +1 -0
- package/dist/wu-framework.umd.js +3 -1
- package/dist/wu-framework.umd.js.map +1 -0
- package/integrations/astro/README.md +127 -0
- package/integrations/astro/WuApp.astro +63 -0
- package/integrations/astro/WuShell.astro +39 -0
- package/integrations/astro/index.js +68 -0
- package/integrations/astro/package.json +38 -0
- package/integrations/astro/types.d.ts +53 -0
- package/package.json +96 -72
- package/src/adapters/angular/ai.js +30 -0
- package/src/adapters/angular/index.d.ts +154 -0
- package/src/adapters/angular/index.js +932 -0
- package/src/adapters/angular.d.ts +3 -154
- package/src/adapters/angular.js +3 -813
- package/src/adapters/index.js +35 -24
- package/src/adapters/lit/ai.js +20 -0
- package/src/adapters/lit/index.d.ts +120 -0
- package/src/adapters/lit/index.js +721 -0
- package/src/adapters/lit.d.ts +3 -120
- package/src/adapters/lit.js +3 -726
- package/src/adapters/preact/ai.js +33 -0
- package/src/adapters/preact/index.d.ts +108 -0
- package/src/adapters/preact/index.js +661 -0
- package/src/adapters/preact.d.ts +3 -108
- package/src/adapters/preact.js +3 -665
- package/src/adapters/react/ai.js +135 -0
- package/src/adapters/react/index.d.ts +246 -0
- package/src/adapters/react/index.js +694 -0
- package/src/adapters/react.d.ts +3 -212
- package/src/adapters/react.js +3 -513
- package/src/adapters/shared.js +64 -0
- package/src/adapters/solid/ai.js +32 -0
- package/src/adapters/solid/index.d.ts +101 -0
- package/src/adapters/solid/index.js +586 -0
- package/src/adapters/solid.d.ts +3 -101
- package/src/adapters/solid.js +3 -591
- package/src/adapters/svelte/ai.js +31 -0
- package/src/adapters/svelte/index.d.ts +166 -0
- package/src/adapters/svelte/index.js +798 -0
- package/src/adapters/svelte.d.ts +3 -166
- package/src/adapters/svelte.js +3 -803
- package/src/adapters/vanilla/ai.js +30 -0
- package/src/adapters/vanilla/index.d.ts +179 -0
- package/src/adapters/vanilla/index.js +785 -0
- package/src/adapters/vanilla.d.ts +3 -179
- package/src/adapters/vanilla.js +3 -791
- package/src/adapters/vue/ai.js +52 -0
- package/src/adapters/vue/index.d.ts +299 -0
- package/src/adapters/vue/index.js +608 -0
- package/src/adapters/vue.d.ts +3 -299
- package/src/adapters/vue.js +3 -611
- package/src/ai/wu-ai-actions.js +261 -0
- package/src/ai/wu-ai-agent.js +546 -0
- package/src/ai/wu-ai-browser-primitives.js +354 -0
- package/src/ai/wu-ai-browser.js +380 -0
- package/src/ai/wu-ai-context.js +332 -0
- package/src/ai/wu-ai-conversation.js +613 -0
- package/src/ai/wu-ai-orchestrate.js +1021 -0
- package/src/ai/wu-ai-permissions.js +381 -0
- package/src/ai/wu-ai-provider.js +700 -0
- package/src/ai/wu-ai-schema.js +225 -0
- package/src/ai/wu-ai-triggers.js +396 -0
- package/src/ai/wu-ai.js +804 -0
- package/src/core/wu-app.js +50 -8
- package/src/core/wu-cache.js +2 -3
- package/src/core/wu-core.js +648 -681
- package/src/core/wu-html-parser.js +121 -211
- package/src/core/wu-iframe-sandbox.js +328 -0
- package/src/core/wu-mcp-bridge.js +431 -0
- package/src/core/wu-overrides.js +510 -0
- package/src/core/wu-plugin.js +4 -1
- package/src/core/wu-prefetch.js +414 -0
- package/src/core/wu-proxy-sandbox.js +398 -75
- package/src/core/wu-sandbox.js +86 -268
- package/src/core/wu-script-executor.js +79 -182
- package/src/core/wu-snapshot-sandbox.js +149 -106
- package/src/core/wu-strategies.js +13 -0
- package/src/core/wu-style-bridge.js +23 -23
- package/src/index.js +162 -665
- package/dist/wu-framework.hex.js +0 -23
- package/dist/wu-framework.min.js +0 -1
- package/dist/wu-framework.obf.js +0 -1
- package/scripts/build-protected.js +0 -366
- package/scripts/build.js +0 -212
- package/scripts/rollup-plugin-hex.js +0 -143
- package/src/core/wu-registry.js +0 -60
- package/src/core/wu-sandbox-pool.js +0 -390
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
* - Riesgo de colisiones: NINGUNO
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
import { logger } from './wu-logger.js';
|
|
32
|
+
|
|
31
33
|
export class WuStyleBridge {
|
|
32
34
|
constructor() {
|
|
33
|
-
this.sharedStyles = new Map();
|
|
34
35
|
this.styleObserver = null;
|
|
35
36
|
this.fullyIsolatedApps = new Map(); // Mapa de appName -> appUrl para apps con fully-isolated
|
|
36
37
|
this.config = {
|
|
@@ -57,7 +58,7 @@ export class WuStyleBridge {
|
|
|
57
58
|
cacheEnabled: true
|
|
58
59
|
};
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
logger.debug('[WuStyleBridge] 🎨 Style sharing system initialized');
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
/**
|
|
@@ -67,7 +68,7 @@ export class WuStyleBridge {
|
|
|
67
68
|
*/
|
|
68
69
|
registerFullyIsolatedApp(appName, appUrl) {
|
|
69
70
|
this.fullyIsolatedApps.set(appName, appUrl);
|
|
70
|
-
|
|
71
|
+
logger.debug(`[WuStyleBridge] 🛡️ Registered fully-isolated app: ${appName} (${appUrl})`);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/**
|
|
@@ -165,7 +166,7 @@ export class WuStyleBridge {
|
|
|
165
166
|
|
|
166
167
|
// Filtrar estilos de apps con fully-isolated (después de obtener viteId para mejor detección)
|
|
167
168
|
if (this.isStyleFromFullyIsolatedApp(style) || (viteId && this.isStyleFromFullyIsolatedApp(viteId))) {
|
|
168
|
-
|
|
169
|
+
logger.debug(`[WuStyleBridge] 🛡️ Filtered out style from fully-isolated app: ${viteId || 'unknown'}`);
|
|
169
170
|
return;
|
|
170
171
|
}
|
|
171
172
|
|
|
@@ -193,7 +194,7 @@ export class WuStyleBridge {
|
|
|
193
194
|
});
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
|
|
197
|
+
logger.debug(`[WuStyleBridge] 🔍 Detected ${styles.length} shareable styles`);
|
|
197
198
|
return styles;
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -249,26 +250,26 @@ export class WuStyleBridge {
|
|
|
249
250
|
*/
|
|
250
251
|
async injectStylesIntoShadow(shadowRoot, appName, styleMode) {
|
|
251
252
|
if (!shadowRoot) {
|
|
252
|
-
|
|
253
|
+
logger.warn('[WuStyleBridge] ⚠️ No shadow root provided');
|
|
253
254
|
return 0;
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
// 🛡️ MODO FULLY-ISOLATED: No inyectar ningún estilo compartido
|
|
257
258
|
// Los estilos propios se manejan en wu-sandbox.js con injectOwnStylesToShadow
|
|
258
259
|
if (styleMode === 'fully-isolated') {
|
|
259
|
-
|
|
260
|
+
logger.debug(`[WuStyleBridge] 🛡️ Style mode "fully-isolated" for ${appName}, skipping shared style injection`);
|
|
260
261
|
return 0;
|
|
261
262
|
}
|
|
262
263
|
|
|
263
264
|
// 🔒 MODO ISOLATED: No inyectar estilos externos - usar encapsulamiento nativo de Shadow DOM
|
|
264
265
|
// La app debe manejar sus propios estilos (CSS-in-JS, scoped styles, imports directos)
|
|
265
266
|
if (styleMode === 'isolated') {
|
|
266
|
-
|
|
267
|
+
logger.debug(`[WuStyleBridge] 🔒 Style mode "isolated" for ${appName}, using native Shadow DOM encapsulation (no external styles)`);
|
|
267
268
|
return 0;
|
|
268
269
|
}
|
|
269
270
|
|
|
270
271
|
// 🌐 MODO SHARED (default): Inyectar todos los estilos compartidos del documento
|
|
271
|
-
|
|
272
|
+
logger.debug(`[WuStyleBridge] 🌐 Style mode "shared" for ${appName}, injecting all shared styles...`);
|
|
272
273
|
|
|
273
274
|
// Detectar estilos del documento
|
|
274
275
|
const styles = this.detectDocumentStyles();
|
|
@@ -294,11 +295,11 @@ export class WuStyleBridge {
|
|
|
294
295
|
break;
|
|
295
296
|
}
|
|
296
297
|
} catch (error) {
|
|
297
|
-
|
|
298
|
+
logger.warn(`[WuStyleBridge] ⚠️ Failed to inject style:`, error);
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
301
|
|
|
301
|
-
|
|
302
|
+
logger.debug(`[WuStyleBridge] ✅ Injected ${injectedCount} shared styles into ${appName}`);
|
|
302
303
|
return injectedCount;
|
|
303
304
|
}
|
|
304
305
|
|
|
@@ -311,7 +312,7 @@ export class WuStyleBridge {
|
|
|
311
312
|
// Verificar si ya existe
|
|
312
313
|
const existing = shadowRoot.querySelector(`link[href="${style.href}"]`);
|
|
313
314
|
if (existing) {
|
|
314
|
-
|
|
315
|
+
logger.debug(`[WuStyleBridge] ⏭️ Style already exists: ${style.library || style.href}`);
|
|
315
316
|
return;
|
|
316
317
|
}
|
|
317
318
|
|
|
@@ -325,7 +326,7 @@ export class WuStyleBridge {
|
|
|
325
326
|
// Insertar al principio del shadow root (antes de otros estilos)
|
|
326
327
|
shadowRoot.insertBefore(link, shadowRoot.firstChild);
|
|
327
328
|
|
|
328
|
-
|
|
329
|
+
logger.debug(`[WuStyleBridge] 🔗 Injected link: ${style.library || style.href}`);
|
|
329
330
|
}
|
|
330
331
|
|
|
331
332
|
/**
|
|
@@ -339,7 +340,7 @@ export class WuStyleBridge {
|
|
|
339
340
|
if (viteId) {
|
|
340
341
|
const existing = shadowRoot.querySelector(`style[data-wu-vite-id="${viteId}"]`);
|
|
341
342
|
if (existing) {
|
|
342
|
-
|
|
343
|
+
logger.debug(`[WuStyleBridge] ⏭️ Inline style already exists: ${viteId}`);
|
|
343
344
|
return;
|
|
344
345
|
}
|
|
345
346
|
}
|
|
@@ -356,7 +357,7 @@ export class WuStyleBridge {
|
|
|
356
357
|
// Insertar al principio del shadow root
|
|
357
358
|
shadowRoot.insertBefore(styleTag, shadowRoot.firstChild);
|
|
358
359
|
|
|
359
|
-
|
|
360
|
+
logger.debug(`[WuStyleBridge] 📝 Injected inline style: ${style.library || viteId}`);
|
|
360
361
|
}
|
|
361
362
|
|
|
362
363
|
/**
|
|
@@ -373,7 +374,7 @@ export class WuStyleBridge {
|
|
|
373
374
|
|
|
374
375
|
// Verificar si ya existe
|
|
375
376
|
if (shadowRoot.adoptedStyleSheets.includes(style.sheet)) {
|
|
376
|
-
|
|
377
|
+
logger.debug(`[WuStyleBridge] ⏭️ Adopted stylesheet already exists`);
|
|
377
378
|
return;
|
|
378
379
|
}
|
|
379
380
|
|
|
@@ -382,9 +383,9 @@ export class WuStyleBridge {
|
|
|
382
383
|
style.sheet
|
|
383
384
|
];
|
|
384
385
|
|
|
385
|
-
|
|
386
|
+
logger.debug(`[WuStyleBridge] 📋 Injected adopted stylesheet`);
|
|
386
387
|
} catch (error) {
|
|
387
|
-
|
|
388
|
+
logger.warn(`[WuStyleBridge] ⚠️ Failed to inject adopted stylesheet:`, error);
|
|
388
389
|
}
|
|
389
390
|
}
|
|
390
391
|
|
|
@@ -418,7 +419,7 @@ export class WuStyleBridge {
|
|
|
418
419
|
}
|
|
419
420
|
|
|
420
421
|
if (hasStyleChanges && callback) {
|
|
421
|
-
|
|
422
|
+
logger.debug('[WuStyleBridge] 🔄 Style changes detected');
|
|
422
423
|
callback();
|
|
423
424
|
}
|
|
424
425
|
});
|
|
@@ -429,7 +430,7 @@ export class WuStyleBridge {
|
|
|
429
430
|
subtree: true
|
|
430
431
|
});
|
|
431
432
|
|
|
432
|
-
|
|
433
|
+
logger.debug('[WuStyleBridge] 👀 Observing style changes');
|
|
433
434
|
}
|
|
434
435
|
|
|
435
436
|
/**
|
|
@@ -442,7 +443,7 @@ export class WuStyleBridge {
|
|
|
442
443
|
...config
|
|
443
444
|
};
|
|
444
445
|
|
|
445
|
-
|
|
446
|
+
logger.debug('[WuStyleBridge] ⚙️ Configuration updated:', this.config);
|
|
446
447
|
}
|
|
447
448
|
|
|
448
449
|
/**
|
|
@@ -454,8 +455,7 @@ export class WuStyleBridge {
|
|
|
454
455
|
this.styleObserver = null;
|
|
455
456
|
}
|
|
456
457
|
|
|
457
|
-
|
|
458
|
-
console.log('[WuStyleBridge] 🧹 StyleBridge cleaned up');
|
|
458
|
+
logger.debug('[WuStyleBridge] 🧹 StyleBridge cleaned up');
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
/**
|