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
package/src/core/wu-app.js
CHANGED
|
@@ -17,6 +17,7 @@ export class WuApp {
|
|
|
17
17
|
this.name = name
|
|
18
18
|
this.url = config.url
|
|
19
19
|
this.container = config.container
|
|
20
|
+
this.keepAlive = config.keepAlive || false
|
|
20
21
|
this._wu = wu
|
|
21
22
|
this._mounted = false
|
|
22
23
|
this._autoInit = config.autoInit !== false // Default true
|
|
@@ -33,10 +34,10 @@ export class WuApp {
|
|
|
33
34
|
*/
|
|
34
35
|
_registerApp() {
|
|
35
36
|
if (!this._wu.apps.has(this.name)) {
|
|
36
|
-
// Usar el método interno de wu-framework para registrar
|
|
37
37
|
this._wu.apps.set(this.name, {
|
|
38
38
|
name: this.name,
|
|
39
39
|
url: this.url,
|
|
40
|
+
keepAlive: this.keepAlive,
|
|
40
41
|
status: 'registered'
|
|
41
42
|
})
|
|
42
43
|
console.log(`📦 App registered: ${this.name} at ${this.url}`)
|
|
@@ -56,7 +57,7 @@ export class WuApp {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
// Asegurar que wu-framework está inicializado
|
|
59
|
-
if (!this._wu.
|
|
60
|
+
if (!this._wu.isInitialized) {
|
|
60
61
|
await this._wu.init({
|
|
61
62
|
apps: [{ name: this.name, url: this.url }]
|
|
62
63
|
})
|
|
@@ -70,18 +71,51 @@ export class WuApp {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
|
-
* Desmontar la app
|
|
74
|
-
*
|
|
74
|
+
* Desmontar la app.
|
|
75
|
+
* If keepAlive is configured, hides instead of destroying.
|
|
76
|
+
*
|
|
77
|
+
* @param {Object} [options] - { keepAlive, force }
|
|
78
|
+
* @returns {Promise<WuApp>}
|
|
75
79
|
*/
|
|
76
|
-
async unmount() {
|
|
80
|
+
async unmount(options = {}) {
|
|
81
|
+
if (!this._mounted && !this._wu.isHidden(this.name)) {
|
|
82
|
+
console.warn(`⚠️ App ${this.name} is not mounted`)
|
|
83
|
+
return this
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
await this._wu.unmount(this.name, options)
|
|
87
|
+
this._mounted = !this._wu.isHidden(this.name)
|
|
88
|
+
|
|
89
|
+
return this
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Hide the app (keep-alive). Preserves all state for instant re-show.
|
|
94
|
+
* @returns {Promise<WuApp>}
|
|
95
|
+
*/
|
|
96
|
+
async hide() {
|
|
77
97
|
if (!this._mounted) {
|
|
78
98
|
console.warn(`⚠️ App ${this.name} is not mounted`)
|
|
79
99
|
return this
|
|
80
100
|
}
|
|
81
101
|
|
|
82
|
-
await this._wu.
|
|
102
|
+
await this._wu.hide(this.name)
|
|
83
103
|
this._mounted = false
|
|
104
|
+
return this
|
|
105
|
+
}
|
|
84
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Show a hidden (keep-alive) app instantly.
|
|
109
|
+
* @returns {Promise<WuApp>}
|
|
110
|
+
*/
|
|
111
|
+
async show() {
|
|
112
|
+
if (!this._wu.isHidden(this.name)) {
|
|
113
|
+
console.warn(`⚠️ App ${this.name} is not in keep-alive state`)
|
|
114
|
+
return this
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
await this._wu.show(this.name)
|
|
118
|
+
this._mounted = true
|
|
85
119
|
return this
|
|
86
120
|
}
|
|
87
121
|
|
|
@@ -91,7 +125,7 @@ export class WuApp {
|
|
|
91
125
|
* @returns {Promise<void>}
|
|
92
126
|
*/
|
|
93
127
|
async remount(container) {
|
|
94
|
-
await this.unmount()
|
|
128
|
+
await this.unmount({ force: true })
|
|
95
129
|
await this.mount(container)
|
|
96
130
|
return this
|
|
97
131
|
}
|
|
@@ -104,6 +138,14 @@ export class WuApp {
|
|
|
104
138
|
return this._mounted && this._wu.mounted?.has(this.name)
|
|
105
139
|
}
|
|
106
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Check if the app is in keep-alive (hidden) state
|
|
143
|
+
* @returns {boolean}
|
|
144
|
+
*/
|
|
145
|
+
get isHidden() {
|
|
146
|
+
return this._wu.isHidden(this.name)
|
|
147
|
+
}
|
|
148
|
+
|
|
107
149
|
/**
|
|
108
150
|
* Obtener información de la app
|
|
109
151
|
* @returns {Object}
|
|
@@ -184,7 +226,7 @@ export class WuApp {
|
|
|
184
226
|
* Destruir la app completamente
|
|
185
227
|
*/
|
|
186
228
|
async destroy() {
|
|
187
|
-
await this.unmount()
|
|
229
|
+
await this.unmount({ force: true })
|
|
188
230
|
this._wu.apps.delete(this.name)
|
|
189
231
|
this._mounted = false
|
|
190
232
|
console.log(`🗑️ App destroyed: ${this.name}`)
|
package/src/core/wu-cache.js
CHANGED
|
@@ -16,8 +16,7 @@ export class WuCache {
|
|
|
16
16
|
maxItems: options.maxItems || 100,
|
|
17
17
|
defaultTTL: options.defaultTTL || 3600000, // 1 hour
|
|
18
18
|
persistent: options.persistent !== false,
|
|
19
|
-
storage: options.storage || 'memory'
|
|
20
|
-
compression: options.compression || false
|
|
19
|
+
storage: options.storage || 'memory'
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
// 🔐 Rate limiting configuration
|
|
@@ -346,8 +345,8 @@ export class WuCache {
|
|
|
346
345
|
* @param {Object} entry - Entrada
|
|
347
346
|
*/
|
|
348
347
|
saveToStorage(key, entry) {
|
|
348
|
+
const storage = this.getStorage();
|
|
349
349
|
try {
|
|
350
|
-
const storage = this.getStorage();
|
|
351
350
|
storage.setItem(`wu_cache_${key}`, JSON.stringify(entry));
|
|
352
351
|
} catch (error) {
|
|
353
352
|
// Storage lleno, limpiar entradas antiguas
|