wu-framework 1.1.6 → 1.1.8
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 +511 -977
- package/dist/wu-framework.cjs.js +3 -1
- package/dist/wu-framework.cjs.js.map +1 -0
- package/dist/wu-framework.dev.js +7533 -2761
- 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 +94 -74
- 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 +689 -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-browser.js +663 -0
- package/src/ai/wu-ai-context.js +332 -0
- package/src/ai/wu-ai-conversation.js +554 -0
- package/src/ai/wu-ai-permissions.js +381 -0
- package/src/ai/wu-ai-provider.js +605 -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 +474 -0
- package/src/core/wu-app.js +50 -8
- package/src/core/wu-cache.js +1 -1
- package/src/core/wu-core.js +645 -677
- 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 +647 -0
- package/src/core/wu-overrides.js +510 -0
- 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 +0 -2
- package/src/index.js +139 -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/adapters/index.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Adapters oficiales para integrar Wu Framework con frameworks populares.
|
|
5
5
|
* Soporta: React, Vue, Angular, Svelte, Preact, Solid.js, Lit, Vanilla JS
|
|
6
6
|
*
|
|
7
|
+
* Cada adapter incluye integración AI (Paradigma C: IA como Director de Orquesta).
|
|
8
|
+
*
|
|
7
9
|
* @example
|
|
8
10
|
* // Importar adapter específico
|
|
9
11
|
* import { wuReact } from 'wu-framework/adapters/react';
|
|
@@ -31,8 +33,9 @@ export {
|
|
|
31
33
|
register as registerReact,
|
|
32
34
|
createWuSlot,
|
|
33
35
|
createUseWuEvents,
|
|
34
|
-
createUseWuStore
|
|
35
|
-
|
|
36
|
+
createUseWuStore,
|
|
37
|
+
createUseWuAI
|
|
38
|
+
} from './react/index.js';
|
|
36
39
|
|
|
37
40
|
// ============================================
|
|
38
41
|
// VUE ADAPTER
|
|
@@ -43,8 +46,10 @@ export {
|
|
|
43
46
|
WuSlot,
|
|
44
47
|
useWuEvents,
|
|
45
48
|
useWuStore,
|
|
46
|
-
wuVuePlugin
|
|
47
|
-
|
|
49
|
+
wuVuePlugin,
|
|
50
|
+
createUseWuAI as createVueUseWuAI,
|
|
51
|
+
useWuAI as useVueWuAI
|
|
52
|
+
} from './vue/index.js';
|
|
48
53
|
|
|
49
54
|
// ============================================
|
|
50
55
|
// ANGULAR ADAPTER
|
|
@@ -55,8 +60,9 @@ export {
|
|
|
55
60
|
registerStandalone as registerAngularStandalone,
|
|
56
61
|
createWuService,
|
|
57
62
|
createWuSlotComponent,
|
|
58
|
-
getWuSlotModuleConfig
|
|
59
|
-
|
|
63
|
+
getWuSlotModuleConfig,
|
|
64
|
+
createWuAIService
|
|
65
|
+
} from './angular/index.js';
|
|
60
66
|
|
|
61
67
|
// ============================================
|
|
62
68
|
// SVELTE ADAPTER
|
|
@@ -68,8 +74,9 @@ export {
|
|
|
68
74
|
createWuStore as createSvelteWuStore,
|
|
69
75
|
createWuEventStore,
|
|
70
76
|
useWuEvents as useSvelteWuEvents,
|
|
71
|
-
createWuSlotConfig
|
|
72
|
-
|
|
77
|
+
createWuSlotConfig,
|
|
78
|
+
createWuAIStore
|
|
79
|
+
} from './svelte/index.js';
|
|
73
80
|
|
|
74
81
|
// ============================================
|
|
75
82
|
// PREACT ADAPTER
|
|
@@ -80,8 +87,9 @@ export {
|
|
|
80
87
|
registerCompat as registerPreactCompat,
|
|
81
88
|
createWuSlot as createPreactWuSlot,
|
|
82
89
|
createUseWuEvents as createPreactUseWuEvents,
|
|
83
|
-
createUseWuStore as createPreactUseWuStore
|
|
84
|
-
|
|
90
|
+
createUseWuStore as createPreactUseWuStore,
|
|
91
|
+
createUseWuAI as createPreactUseWuAI
|
|
92
|
+
} from './preact/index.js';
|
|
85
93
|
|
|
86
94
|
// ============================================
|
|
87
95
|
// SOLID.JS ADAPTER
|
|
@@ -93,8 +101,9 @@ export {
|
|
|
93
101
|
createWuStore as createSolidWuStore,
|
|
94
102
|
createWuEvent,
|
|
95
103
|
useWuEvents as useSolidWuEvents,
|
|
96
|
-
createWuContext
|
|
97
|
-
|
|
104
|
+
createWuContext,
|
|
105
|
+
createUseWuAI as createSolidUseWuAI
|
|
106
|
+
} from './solid/index.js';
|
|
98
107
|
|
|
99
108
|
// ============================================
|
|
100
109
|
// LIT (WEB COMPONENTS) ADAPTER
|
|
@@ -105,9 +114,10 @@ export {
|
|
|
105
114
|
registerWebComponent,
|
|
106
115
|
createWuSlotElement,
|
|
107
116
|
WuMixin,
|
|
117
|
+
WuAIMixin,
|
|
108
118
|
wuProperty,
|
|
109
119
|
createSimpleElement
|
|
110
|
-
} from './lit.js';
|
|
120
|
+
} from './lit/index.js';
|
|
111
121
|
|
|
112
122
|
// ============================================
|
|
113
123
|
// VANILLA JS ADAPTER
|
|
@@ -120,25 +130,26 @@ export {
|
|
|
120
130
|
createComponent,
|
|
121
131
|
createWuSlot as createVanillaWuSlot,
|
|
122
132
|
useWuEvents as useVanillaWuEvents,
|
|
123
|
-
useWuStore as useVanillaWuStore
|
|
124
|
-
|
|
133
|
+
useWuStore as useVanillaWuStore,
|
|
134
|
+
useWuAI as useVanillaWuAI
|
|
135
|
+
} from './vanilla/index.js';
|
|
125
136
|
|
|
126
137
|
// ============================================
|
|
127
138
|
// SHARED UTILITIES
|
|
128
139
|
// ============================================
|
|
129
|
-
export { getWuInstance, waitForWu } from './
|
|
140
|
+
export { getWuInstance, waitForWu } from './shared.js';
|
|
130
141
|
|
|
131
142
|
// ============================================
|
|
132
143
|
// ALL ADAPTERS OBJECT
|
|
133
144
|
// ============================================
|
|
134
|
-
import { wuReact } from './react.js';
|
|
135
|
-
import { wuVue } from './vue.js';
|
|
136
|
-
import { wuAngular } from './angular.js';
|
|
137
|
-
import { wuSvelte } from './svelte.js';
|
|
138
|
-
import { wuPreact } from './preact.js';
|
|
139
|
-
import { wuSolid } from './solid.js';
|
|
140
|
-
import { wuLit } from './lit.js';
|
|
141
|
-
import { wuVanilla } from './vanilla.js';
|
|
145
|
+
import { wuReact } from './react/index.js';
|
|
146
|
+
import { wuVue } from './vue/index.js';
|
|
147
|
+
import { wuAngular } from './angular/index.js';
|
|
148
|
+
import { wuSvelte } from './svelte/index.js';
|
|
149
|
+
import { wuPreact } from './preact/index.js';
|
|
150
|
+
import { wuSolid } from './solid/index.js';
|
|
151
|
+
import { wuLit } from './lit/index.js';
|
|
152
|
+
import { wuVanilla } from './vanilla/index.js';
|
|
142
153
|
|
|
143
154
|
/**
|
|
144
155
|
* Objeto con todos los adapters disponibles
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WU-FRAMEWORK LIT AI INTEGRATION
|
|
3
|
+
*/
|
|
4
|
+
function getWuInstance() {
|
|
5
|
+
if (typeof window === 'undefined') return null;
|
|
6
|
+
return window.wu || window.parent?.wu || window.top?.wu || null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function WuAIMixin(Base) {
|
|
10
|
+
return class extends Base {
|
|
11
|
+
constructor() { super(); this._wuAINamespace = 'default'; }
|
|
12
|
+
get wuAI() { return getWuInstance()?.ai || null; }
|
|
13
|
+
async wuAISend(text, options = {}) {
|
|
14
|
+
const ai = this.wuAI;
|
|
15
|
+
if (!ai) { console.warn('[WuAIMixin] wu.ai not available'); return null; }
|
|
16
|
+
return ai.send(text, { namespace: this._wuAINamespace, ...options });
|
|
17
|
+
}
|
|
18
|
+
wuAISetNamespace(ns) { this._wuAINamespace = ns; }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚀 WU-FRAMEWORK LIT ADAPTER - TypeScript Declarations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { WuCore } from '../core/wu-core';
|
|
6
|
+
|
|
7
|
+
// Lit types (generics to avoid hard dependency)
|
|
8
|
+
type LitElement = any;
|
|
9
|
+
type TemplateResult = any;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Opciones de registro Lit
|
|
13
|
+
*/
|
|
14
|
+
export interface LitRegisterOptions {
|
|
15
|
+
/** Nombre del custom element (auto-generado si no se provee) */
|
|
16
|
+
tagName?: string;
|
|
17
|
+
/** Propiedades iniciales */
|
|
18
|
+
properties?: Record<string, any>;
|
|
19
|
+
/** Callback después de montar */
|
|
20
|
+
onMount?: (container: HTMLElement, element: HTMLElement) => void;
|
|
21
|
+
/** Callback antes de desmontar */
|
|
22
|
+
onUnmount?: (container: HTMLElement, element: HTMLElement) => void;
|
|
23
|
+
/** Permitir ejecución standalone */
|
|
24
|
+
standalone?: boolean;
|
|
25
|
+
/** Selector para modo standalone */
|
|
26
|
+
standaloneContainer?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Configuración para crear elemento simple
|
|
31
|
+
*/
|
|
32
|
+
export interface SimpleElementConfig {
|
|
33
|
+
/** Nombre del custom element */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Template HTML */
|
|
36
|
+
template: string | ((element: HTMLElement) => string);
|
|
37
|
+
/** Estilos CSS */
|
|
38
|
+
styles?: string;
|
|
39
|
+
/** Usar Shadow DOM */
|
|
40
|
+
shadow?: boolean;
|
|
41
|
+
/** Atributos observados */
|
|
42
|
+
observedAttributes?: string[];
|
|
43
|
+
/** Callback cuando se conecta */
|
|
44
|
+
connectedCallback?: (this: HTMLElement) => void;
|
|
45
|
+
/** Callback cuando se desconecta */
|
|
46
|
+
disconnectedCallback?: (this: HTMLElement) => void;
|
|
47
|
+
/** Callback cuando cambia un atributo */
|
|
48
|
+
attributeChangedCallback?: (this: HTMLElement, name: string, oldVal: string, newVal: string) => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Clase WuSlot Element
|
|
53
|
+
*/
|
|
54
|
+
export interface WuSlotElementClass {
|
|
55
|
+
new(): HTMLElement & {
|
|
56
|
+
name: string;
|
|
57
|
+
url: string;
|
|
58
|
+
appName: string | null;
|
|
59
|
+
fallbackText: string | null;
|
|
60
|
+
loading: boolean;
|
|
61
|
+
error: string | null;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Tipo para el Mixin de Wu
|
|
67
|
+
*/
|
|
68
|
+
export type WuMixinResult<T extends new (...args: any[]) => any> = T & {
|
|
69
|
+
new (...args: any[]): InstanceType<T> & {
|
|
70
|
+
readonly wu: WuCore | null;
|
|
71
|
+
wuEmit(event: string, data?: any, options?: any): void;
|
|
72
|
+
wuOn(event: string, callback: (data: any) => void): () => void;
|
|
73
|
+
wuOnce(event: string, callback: (data: any) => void): () => void;
|
|
74
|
+
wuGetState(path?: string): any;
|
|
75
|
+
wuSetState(path: string, value: any): void;
|
|
76
|
+
wuOnStateChange(pattern: string, callback: (value: any) => void): () => void;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export function register(
|
|
81
|
+
appName: string,
|
|
82
|
+
ElementClass: CustomElementConstructor,
|
|
83
|
+
options?: LitRegisterOptions
|
|
84
|
+
): Promise<boolean>;
|
|
85
|
+
|
|
86
|
+
export function registerWebComponent(
|
|
87
|
+
appName: string,
|
|
88
|
+
ElementClass: CustomElementConstructor,
|
|
89
|
+
options?: LitRegisterOptions
|
|
90
|
+
): Promise<boolean>;
|
|
91
|
+
|
|
92
|
+
export function createWuSlotElement(
|
|
93
|
+
LitElement: any,
|
|
94
|
+
html: (strings: TemplateStringsArray, ...values: any[]) => TemplateResult,
|
|
95
|
+
css?: (strings: TemplateStringsArray, ...values: any[]) => any
|
|
96
|
+
): WuSlotElementClass;
|
|
97
|
+
|
|
98
|
+
export function WuMixin<T extends new (...args: any[]) => any>(Base: T): WuMixinResult<T>;
|
|
99
|
+
|
|
100
|
+
export function wuProperty(storePath: string): PropertyDecorator;
|
|
101
|
+
|
|
102
|
+
export function createSimpleElement(config: SimpleElementConfig): CustomElementConstructor;
|
|
103
|
+
|
|
104
|
+
export function getWuInstance(): WuCore | null;
|
|
105
|
+
|
|
106
|
+
export function waitForWu(timeout?: number): Promise<WuCore>;
|
|
107
|
+
|
|
108
|
+
export interface WuLitAdapter {
|
|
109
|
+
register: typeof register;
|
|
110
|
+
registerWebComponent: typeof registerWebComponent;
|
|
111
|
+
createWuSlotElement: typeof createWuSlotElement;
|
|
112
|
+
WuMixin: typeof WuMixin;
|
|
113
|
+
wuProperty: typeof wuProperty;
|
|
114
|
+
createSimpleElement: typeof createSimpleElement;
|
|
115
|
+
getWuInstance: typeof getWuInstance;
|
|
116
|
+
waitForWu: typeof waitForWu;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const wuLit: WuLitAdapter;
|
|
120
|
+
export default wuLit;
|