wu-framework 1.1.14 → 1.1.16

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 (90) hide show
  1. package/LICENSE +39 -39
  2. package/README.md +408 -408
  3. package/dist/wu-framework.cjs.js.map +1 -1
  4. package/dist/wu-framework.dev.js +15151 -15151
  5. package/dist/wu-framework.dev.js.map +1 -1
  6. package/dist/wu-framework.esm.js.map +1 -1
  7. package/dist/wu-framework.umd.js.map +1 -1
  8. package/integrations/astro/README.md +127 -127
  9. package/integrations/astro/WuApp.astro +63 -63
  10. package/integrations/astro/WuShell.astro +39 -39
  11. package/integrations/astro/index.js +68 -68
  12. package/integrations/astro/package.json +38 -38
  13. package/integrations/astro/types.d.ts +53 -53
  14. package/package.json +161 -161
  15. package/src/adapters/angular/ai.js +30 -30
  16. package/src/adapters/angular/index.d.ts +154 -154
  17. package/src/adapters/angular/index.js +932 -932
  18. package/src/adapters/angular.d.ts +3 -3
  19. package/src/adapters/angular.js +3 -3
  20. package/src/adapters/index.js +168 -168
  21. package/src/adapters/lit/ai.js +20 -20
  22. package/src/adapters/lit/index.d.ts +120 -120
  23. package/src/adapters/lit/index.js +721 -721
  24. package/src/adapters/lit.d.ts +3 -3
  25. package/src/adapters/lit.js +3 -3
  26. package/src/adapters/preact/ai.js +33 -33
  27. package/src/adapters/preact/index.d.ts +108 -108
  28. package/src/adapters/preact/index.js +661 -661
  29. package/src/adapters/preact.d.ts +3 -3
  30. package/src/adapters/preact.js +3 -3
  31. package/src/adapters/react/index.js +48 -54
  32. package/src/adapters/react.d.ts +3 -3
  33. package/src/adapters/react.js +3 -3
  34. package/src/adapters/shared.js +64 -64
  35. package/src/adapters/solid/ai.js +32 -32
  36. package/src/adapters/solid/index.d.ts +101 -101
  37. package/src/adapters/solid/index.js +586 -586
  38. package/src/adapters/solid.d.ts +3 -3
  39. package/src/adapters/solid.js +3 -3
  40. package/src/adapters/svelte/ai.js +31 -31
  41. package/src/adapters/svelte/index.d.ts +166 -166
  42. package/src/adapters/svelte/index.js +798 -798
  43. package/src/adapters/svelte.d.ts +3 -3
  44. package/src/adapters/svelte.js +3 -3
  45. package/src/adapters/vanilla/ai.js +30 -30
  46. package/src/adapters/vanilla/index.d.ts +179 -179
  47. package/src/adapters/vanilla/index.js +785 -785
  48. package/src/adapters/vanilla.d.ts +3 -3
  49. package/src/adapters/vanilla.js +3 -3
  50. package/src/adapters/vue/ai.js +52 -52
  51. package/src/adapters/vue/index.d.ts +299 -299
  52. package/src/adapters/vue/index.js +610 -610
  53. package/src/adapters/vue.d.ts +3 -3
  54. package/src/adapters/vue.js +3 -3
  55. package/src/ai/wu-ai-actions.js +261 -261
  56. package/src/ai/wu-ai-agent.js +546 -546
  57. package/src/ai/wu-ai-browser-primitives.js +354 -354
  58. package/src/ai/wu-ai-browser.js +380 -380
  59. package/src/ai/wu-ai-context.js +332 -332
  60. package/src/ai/wu-ai-conversation.js +613 -613
  61. package/src/ai/wu-ai-orchestrate.js +1021 -1021
  62. package/src/ai/wu-ai-permissions.js +381 -381
  63. package/src/ai/wu-ai-provider.js +700 -700
  64. package/src/ai/wu-ai-schema.js +225 -225
  65. package/src/ai/wu-ai-triggers.js +396 -396
  66. package/src/ai/wu-ai.js +804 -804
  67. package/src/core/wu-app.js +236 -236
  68. package/src/core/wu-cache.js +477 -477
  69. package/src/core/wu-core.js +1398 -1398
  70. package/src/core/wu-error-boundary.js +382 -382
  71. package/src/core/wu-event-bus.js +348 -348
  72. package/src/core/wu-hooks.js +350 -350
  73. package/src/core/wu-html-parser.js +190 -190
  74. package/src/core/wu-iframe-sandbox.js +328 -328
  75. package/src/core/wu-loader.js +272 -272
  76. package/src/core/wu-logger.js +134 -134
  77. package/src/core/wu-manifest.js +509 -509
  78. package/src/core/wu-mcp-bridge.js +432 -432
  79. package/src/core/wu-overrides.js +510 -510
  80. package/src/core/wu-performance.js +228 -228
  81. package/src/core/wu-plugin.js +348 -348
  82. package/src/core/wu-prefetch.js +414 -414
  83. package/src/core/wu-proxy-sandbox.js +476 -476
  84. package/src/core/wu-sandbox.js +779 -779
  85. package/src/core/wu-script-executor.js +113 -113
  86. package/src/core/wu-snapshot-sandbox.js +227 -227
  87. package/src/core/wu-strategies.js +256 -256
  88. package/src/core/wu-style-bridge.js +477 -477
  89. package/src/index.js +224 -224
  90. 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;