wu-framework 1.1.15 → 1.1.17

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.
Files changed (88) hide show
  1. package/README.md +52 -20
  2. package/dist/wu-framework.cjs.js +1 -1
  3. package/dist/wu-framework.cjs.js.map +1 -1
  4. package/dist/wu-framework.dev.js +15511 -15146
  5. package/dist/wu-framework.dev.js.map +1 -1
  6. package/dist/wu-framework.esm.js +1 -1
  7. package/dist/wu-framework.esm.js.map +1 -1
  8. package/dist/wu-framework.umd.js +1 -1
  9. package/dist/wu-framework.umd.js.map +1 -1
  10. package/package.json +166 -161
  11. package/src/adapters/angular/ai.js +30 -30
  12. package/src/adapters/angular/index.d.ts +154 -154
  13. package/src/adapters/angular/index.js +932 -932
  14. package/src/adapters/angular.d.ts +3 -3
  15. package/src/adapters/angular.js +3 -3
  16. package/src/adapters/index.js +168 -168
  17. package/src/adapters/lit/ai.js +20 -20
  18. package/src/adapters/lit/index.d.ts +120 -120
  19. package/src/adapters/lit/index.js +721 -721
  20. package/src/adapters/lit.d.ts +3 -3
  21. package/src/adapters/lit.js +3 -3
  22. package/src/adapters/preact/ai.js +33 -33
  23. package/src/adapters/preact/index.d.ts +108 -108
  24. package/src/adapters/preact/index.js +661 -661
  25. package/src/adapters/preact.d.ts +3 -3
  26. package/src/adapters/preact.js +3 -3
  27. package/src/adapters/react/index.js +48 -54
  28. package/src/adapters/react.d.ts +3 -3
  29. package/src/adapters/react.js +3 -3
  30. package/src/adapters/shared.js +64 -64
  31. package/src/adapters/solid/ai.js +32 -32
  32. package/src/adapters/solid/index.d.ts +101 -101
  33. package/src/adapters/solid/index.js +586 -586
  34. package/src/adapters/solid.d.ts +3 -3
  35. package/src/adapters/solid.js +3 -3
  36. package/src/adapters/svelte/ai.js +31 -31
  37. package/src/adapters/svelte/index.d.ts +166 -166
  38. package/src/adapters/svelte/index.js +798 -798
  39. package/src/adapters/svelte.d.ts +3 -3
  40. package/src/adapters/svelte.js +3 -3
  41. package/src/adapters/vanilla/ai.js +30 -30
  42. package/src/adapters/vanilla/index.d.ts +179 -179
  43. package/src/adapters/vanilla/index.js +785 -785
  44. package/src/adapters/vanilla.d.ts +3 -3
  45. package/src/adapters/vanilla.js +3 -3
  46. package/src/adapters/vue/ai.js +52 -52
  47. package/src/adapters/vue/index.d.ts +299 -299
  48. package/src/adapters/vue/index.js +610 -610
  49. package/src/adapters/vue.d.ts +3 -3
  50. package/src/adapters/vue.js +3 -3
  51. package/src/ai/wu-ai-actions.js +261 -261
  52. package/src/ai/wu-ai-agent.js +546 -546
  53. package/src/ai/wu-ai-browser-primitives.js +354 -354
  54. package/src/ai/wu-ai-browser.js +380 -380
  55. package/src/ai/wu-ai-context.js +332 -332
  56. package/src/ai/wu-ai-conversation.js +613 -613
  57. package/src/ai/wu-ai-orchestrate.js +1021 -1021
  58. package/src/ai/wu-ai-permissions.js +381 -381
  59. package/src/ai/wu-ai-provider.js +700 -700
  60. package/src/ai/wu-ai-schema.js +225 -225
  61. package/src/ai/wu-ai-triggers.js +396 -396
  62. package/src/ai/wu-ai.js +804 -804
  63. package/src/core/wu-app.js +236 -236
  64. package/src/core/wu-cache.js +498 -477
  65. package/src/core/wu-core.js +1412 -1398
  66. package/src/core/wu-error-boundary.js +396 -382
  67. package/src/core/wu-event-bus.js +390 -348
  68. package/src/core/wu-hooks.js +350 -350
  69. package/src/core/wu-html-parser.js +199 -190
  70. package/src/core/wu-iframe-sandbox.js +328 -328
  71. package/src/core/wu-loader.js +385 -273
  72. package/src/core/wu-logger.js +142 -134
  73. package/src/core/wu-manifest.js +532 -509
  74. package/src/core/wu-mcp-bridge.js +432 -432
  75. package/src/core/wu-overrides.js +510 -510
  76. package/src/core/wu-performance.js +228 -228
  77. package/src/core/wu-plugin.js +401 -348
  78. package/src/core/wu-prefetch.js +414 -414
  79. package/src/core/wu-proxy-sandbox.js +477 -476
  80. package/src/core/wu-sandbox.js +779 -779
  81. package/src/core/wu-script-executor.js +161 -113
  82. package/src/core/wu-snapshot-sandbox.js +227 -227
  83. package/src/core/wu-store.js +13 -3
  84. package/src/core/wu-strategies.js +256 -256
  85. package/src/core/wu-style-bridge.js +477 -477
  86. package/src/index.d.ts +317 -0
  87. package/src/index.js +234 -224
  88. package/src/utils/dependency-resolver.js +327 -327
@@ -1,3 +1,3 @@
1
- // Re-export from folder structure — backward compatibility
2
- export * from './lit/index';
3
- export { default } from './lit/index';
1
+ // Re-export from folder structure — backward compatibility
2
+ export * from './lit/index';
3
+ export { default } from './lit/index';
@@ -1,3 +1,3 @@
1
- // Re-export from folder structure — backward compatibility
2
- export * from './lit/index.js';
3
- export { default } from './lit/index.js';
1
+ // Re-export from folder structure — backward compatibility
2
+ export * from './lit/index.js';
3
+ export { default } from './lit/index.js';
@@ -1,33 +1,33 @@
1
- /**
2
- * WU-FRAMEWORK PREACT 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 createUseWuAI(hooks) {
10
- const { useState, useCallback } = hooks;
11
- return function useWuAI(options = {}) {
12
- const { namespace = 'default' } = options;
13
- const [messages, setMessages] = useState([]);
14
- const [isStreaming, setIsStreaming] = useState(false);
15
- const [error, setError] = useState(null);
16
-
17
- const send = useCallback(async (text) => {
18
- if (!text?.trim()) return;
19
- const wu = getWuInstance();
20
- if (!wu?.ai) { setError('Wu AI not available'); return; }
21
- setMessages(prev => [...prev, { id: `user-${Date.now()}`, role: 'user', content: text, timestamp: Date.now() }]);
22
- setIsStreaming(true); setError(null);
23
- try {
24
- const res = await wu.ai.send(text, { namespace });
25
- setMessages(prev => [...prev, { id: `assistant-${Date.now()}`, role: 'assistant', content: res.content, timestamp: Date.now() }]);
26
- } catch (err) { setError(err.message || 'AI request failed'); }
27
- setIsStreaming(false);
28
- }, [namespace]);
29
-
30
- const clear = useCallback(() => { setMessages([]); setError(null); }, []);
31
- return { messages, isStreaming, error, send, clear };
32
- };
33
- }
1
+ /**
2
+ * WU-FRAMEWORK PREACT 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 createUseWuAI(hooks) {
10
+ const { useState, useCallback } = hooks;
11
+ return function useWuAI(options = {}) {
12
+ const { namespace = 'default' } = options;
13
+ const [messages, setMessages] = useState([]);
14
+ const [isStreaming, setIsStreaming] = useState(false);
15
+ const [error, setError] = useState(null);
16
+
17
+ const send = useCallback(async (text) => {
18
+ if (!text?.trim()) return;
19
+ const wu = getWuInstance();
20
+ if (!wu?.ai) { setError('Wu AI not available'); return; }
21
+ setMessages(prev => [...prev, { id: `user-${Date.now()}`, role: 'user', content: text, timestamp: Date.now() }]);
22
+ setIsStreaming(true); setError(null);
23
+ try {
24
+ const res = await wu.ai.send(text, { namespace });
25
+ setMessages(prev => [...prev, { id: `assistant-${Date.now()}`, role: 'assistant', content: res.content, timestamp: Date.now() }]);
26
+ } catch (err) { setError(err.message || 'AI request failed'); }
27
+ setIsStreaming(false);
28
+ }, [namespace]);
29
+
30
+ const clear = useCallback(() => { setMessages([]); setError(null); }, []);
31
+ return { messages, isStreaming, error, send, clear };
32
+ };
33
+ }
@@ -1,108 +1,108 @@
1
- /**
2
- * 🚀 WU-FRAMEWORK PREACT ADAPTER - TypeScript Declarations
3
- */
4
-
5
- import type { WuCore } from '../core/wu-core';
6
-
7
- // Preact types (generics to avoid hard dependency)
8
- type ComponentType<P = {}> = (props: P) => any;
9
- type VNode = any;
10
-
11
- /**
12
- * Opciones de registro Preact
13
- */
14
- export interface PreactRegisterOptions {
15
- /** Props iniciales */
16
- props?: Record<string, any>;
17
- /** Callback después de montar */
18
- onMount?: (container: HTMLElement) => void;
19
- /** Callback antes de desmontar */
20
- onUnmount?: (container: HTMLElement) => void;
21
- /** Permitir ejecución standalone */
22
- standalone?: boolean;
23
- /** Selector para modo standalone */
24
- standaloneContainer?: string;
25
- }
26
-
27
- /**
28
- * Props del componente WuSlot
29
- */
30
- export interface WuSlotProps {
31
- name: string;
32
- url: string;
33
- appName?: string;
34
- fallback?: VNode;
35
- onLoad?: (data: { name: string; url: string }) => void;
36
- onError?: (error: Error) => void;
37
- className?: string;
38
- style?: Record<string, string | number>;
39
- }
40
-
41
- /**
42
- * Hooks de Preact necesarios para createUseWuEvents
43
- */
44
- export interface PreactHooks {
45
- useCallback: <T extends (...args: any[]) => any>(callback: T, deps: any[]) => T;
46
- useEffect: (effect: () => void | (() => void), deps?: any[]) => void;
47
- useRef: <T>(initialValue: T) => { current: T };
48
- }
49
-
50
- /**
51
- * Hooks para createUseWuStore
52
- */
53
- export interface PreactStoreHooks extends PreactHooks {
54
- useState: <T>(initialValue: T | (() => T)) => [T, (value: T) => void];
55
- }
56
-
57
- /**
58
- * Helper de eventos Wu para Preact
59
- */
60
- export interface UseWuEventsResult {
61
- emit: (event: string, data?: any, options?: any) => void;
62
- on: (event: string, callback: (data: any) => void) => () => void;
63
- once: (event: string, callback: (data: any) => void) => () => void;
64
- }
65
-
66
- /**
67
- * Helper de store Wu para Preact
68
- */
69
- export interface UseWuStoreResult {
70
- state: any;
71
- setState: (path: string, value: any) => void;
72
- getState: (path?: string) => any;
73
- }
74
-
75
- export function register(
76
- appName: string,
77
- Component: ComponentType,
78
- options?: PreactRegisterOptions
79
- ): Promise<boolean>;
80
-
81
- export function registerCompat(
82
- appName: string,
83
- Component: ComponentType,
84
- options?: PreactRegisterOptions
85
- ): Promise<boolean>;
86
-
87
- export function createWuSlot(h: (type: any, props: any, ...children: any[]) => VNode): ComponentType<WuSlotProps>;
88
-
89
- export function createUseWuEvents(hooks: PreactHooks): () => UseWuEventsResult;
90
-
91
- export function createUseWuStore(hooks: PreactStoreHooks): (namespace?: string) => UseWuStoreResult;
92
-
93
- export function getWuInstance(): WuCore | null;
94
-
95
- export function waitForWu(timeout?: number): Promise<WuCore>;
96
-
97
- export interface WuPreactAdapter {
98
- register: typeof register;
99
- registerCompat: typeof registerCompat;
100
- createWuSlot: typeof createWuSlot;
101
- createUseWuEvents: typeof createUseWuEvents;
102
- createUseWuStore: typeof createUseWuStore;
103
- getWuInstance: typeof getWuInstance;
104
- waitForWu: typeof waitForWu;
105
- }
106
-
107
- export const wuPreact: WuPreactAdapter;
108
- export default wuPreact;
1
+ /**
2
+ * 🚀 WU-FRAMEWORK PREACT ADAPTER - TypeScript Declarations
3
+ */
4
+
5
+ import type { WuCore } from '../core/wu-core';
6
+
7
+ // Preact types (generics to avoid hard dependency)
8
+ type ComponentType<P = {}> = (props: P) => any;
9
+ type VNode = any;
10
+
11
+ /**
12
+ * Opciones de registro Preact
13
+ */
14
+ export interface PreactRegisterOptions {
15
+ /** Props iniciales */
16
+ props?: Record<string, any>;
17
+ /** Callback después de montar */
18
+ onMount?: (container: HTMLElement) => void;
19
+ /** Callback antes de desmontar */
20
+ onUnmount?: (container: HTMLElement) => void;
21
+ /** Permitir ejecución standalone */
22
+ standalone?: boolean;
23
+ /** Selector para modo standalone */
24
+ standaloneContainer?: string;
25
+ }
26
+
27
+ /**
28
+ * Props del componente WuSlot
29
+ */
30
+ export interface WuSlotProps {
31
+ name: string;
32
+ url: string;
33
+ appName?: string;
34
+ fallback?: VNode;
35
+ onLoad?: (data: { name: string; url: string }) => void;
36
+ onError?: (error: Error) => void;
37
+ className?: string;
38
+ style?: Record<string, string | number>;
39
+ }
40
+
41
+ /**
42
+ * Hooks de Preact necesarios para createUseWuEvents
43
+ */
44
+ export interface PreactHooks {
45
+ useCallback: <T extends (...args: any[]) => any>(callback: T, deps: any[]) => T;
46
+ useEffect: (effect: () => void | (() => void), deps?: any[]) => void;
47
+ useRef: <T>(initialValue: T) => { current: T };
48
+ }
49
+
50
+ /**
51
+ * Hooks para createUseWuStore
52
+ */
53
+ export interface PreactStoreHooks extends PreactHooks {
54
+ useState: <T>(initialValue: T | (() => T)) => [T, (value: T) => void];
55
+ }
56
+
57
+ /**
58
+ * Helper de eventos Wu para Preact
59
+ */
60
+ export interface UseWuEventsResult {
61
+ emit: (event: string, data?: any, options?: any) => void;
62
+ on: (event: string, callback: (data: any) => void) => () => void;
63
+ once: (event: string, callback: (data: any) => void) => () => void;
64
+ }
65
+
66
+ /**
67
+ * Helper de store Wu para Preact
68
+ */
69
+ export interface UseWuStoreResult {
70
+ state: any;
71
+ setState: (path: string, value: any) => void;
72
+ getState: (path?: string) => any;
73
+ }
74
+
75
+ export function register(
76
+ appName: string,
77
+ Component: ComponentType,
78
+ options?: PreactRegisterOptions
79
+ ): Promise<boolean>;
80
+
81
+ export function registerCompat(
82
+ appName: string,
83
+ Component: ComponentType,
84
+ options?: PreactRegisterOptions
85
+ ): Promise<boolean>;
86
+
87
+ export function createWuSlot(h: (type: any, props: any, ...children: any[]) => VNode): ComponentType<WuSlotProps>;
88
+
89
+ export function createUseWuEvents(hooks: PreactHooks): () => UseWuEventsResult;
90
+
91
+ export function createUseWuStore(hooks: PreactStoreHooks): (namespace?: string) => UseWuStoreResult;
92
+
93
+ export function getWuInstance(): WuCore | null;
94
+
95
+ export function waitForWu(timeout?: number): Promise<WuCore>;
96
+
97
+ export interface WuPreactAdapter {
98
+ register: typeof register;
99
+ registerCompat: typeof registerCompat;
100
+ createWuSlot: typeof createWuSlot;
101
+ createUseWuEvents: typeof createUseWuEvents;
102
+ createUseWuStore: typeof createUseWuStore;
103
+ getWuInstance: typeof getWuInstance;
104
+ waitForWu: typeof waitForWu;
105
+ }
106
+
107
+ export const wuPreact: WuPreactAdapter;
108
+ export default wuPreact;