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 './preact/index';
3
- export { default } from './preact/index';
1
+ // Re-export from folder structure — backward compatibility
2
+ export * from './preact/index';
3
+ export { default } from './preact/index';
@@ -1,3 +1,3 @@
1
- // Re-export from folder structure — backward compatibility
2
- export * from './preact/index.js';
3
- export { default } from './preact/index.js';
1
+ // Re-export from folder structure — backward compatibility
2
+ export * from './preact/index.js';
3
+ export { default } from './preact/index.js';
@@ -265,7 +265,7 @@ async function register(appName, Component, options = {}) {
265
265
  * <WuSlot name="my-app" url="http://localhost:3001" />
266
266
  */
267
267
  function createWuSlot(React) {
268
- const { useState, useEffect, useRef, useCallback } = React;
268
+ const { useState, useEffect, useRef } = React;
269
269
 
270
270
  return function WuSlot({
271
271
  name,
@@ -280,57 +280,48 @@ function createWuSlot(React) {
280
280
  style = {},
281
281
  ...props
282
282
  }) {
283
- const containerRef = useRef(null);
284
- const appInstanceRef = useRef(null);
283
+ const actualAppName = appName || name;
284
+
285
+ // ID estable derivado del nombre: el div ya tiene este id desde el primer render.
286
+ // wu.mount(name, '#id') lo encuentra sin necesidad de innerHTML ni appendChild.
287
+ const containerId = `wu-slot-${actualAppName}`;
288
+ const mountedRef = useRef(false);
285
289
  const [loading, setLoading] = useState(true);
286
290
  const [error, setError] = useState(null);
287
291
 
288
- const actualAppName = appName || name;
289
-
290
292
  useEffect(() => {
291
293
  let cancelled = false;
292
- const containerId = `wu-slot-${actualAppName}-${Math.random().toString(36).slice(2, 8)}`;
293
294
 
294
- // Delay de 50ms para compatibilidad con React 18/19 StrictMode.
295
- // En StrictMode el primer efecto se cancela inmediatamente (cancelled = true,
296
- // clearTimeout) y solo el segundo efecto monta; evita doble-mount y
297
- // "[Wu] App not mounted" en primera carga.
295
+ // Delay 50ms + flag cancelled: patrón StrictMode-safe.
296
+ // En StrictMode React monta desmonta monta; el primer ciclo cancela
297
+ // el timeout antes de ejecutarse; solo el segundo ciclo monta el MF.
298
298
  const timer = setTimeout(async () => {
299
- if (cancelled || !containerRef.current) return;
299
+ if (cancelled) return;
300
300
 
301
301
  try {
302
302
  setLoading(true);
303
303
  setError(null);
304
304
 
305
305
  const wu = getWuInstance();
306
- if (!wu) {
307
- throw new Error('Wu Framework not initialized');
308
- }
306
+ if (!wu) throw new Error('Wu Framework not initialized');
309
307
 
310
- // Crear container interno
311
- const innerContainer = document.createElement('div');
312
- innerContainer.id = containerId;
313
- innerContainer.style.width = '100%';
314
- innerContainer.style.height = '100%';
315
- containerRef.current.innerHTML = '';
316
- containerRef.current.appendChild(innerContainer);
317
-
318
- // Montar usando wu.mount() (wu.init() ya se llamó en el shell)
308
+ // El div#containerId ya está en el DOM (renderizado abajo).
309
+ // wu.mount lo usa como target; no tocamos su DOM desde JS imperativo.
319
310
  await wu.mount(actualAppName, `#${containerId}`);
320
311
 
321
312
  if (!cancelled) {
322
- appInstanceRef.current = actualAppName;
313
+ mountedRef.current = true;
323
314
  setLoading(false);
324
315
 
316
+ const container = document.getElementById(containerId);
325
317
  if (onLoad) onLoad({ name: actualAppName, url });
326
- if (onMount) onMount({ name: actualAppName, container: innerContainer });
318
+ if (onMount) onMount({ name: actualAppName, container });
327
319
  }
328
320
  } catch (err) {
329
321
  if (!cancelled) {
330
322
  console.error(`[WuSlot] Error loading ${actualAppName}:`, err);
331
323
  setError(err.message || 'Failed to load microfrontend');
332
324
  setLoading(false);
333
-
334
325
  if (onError) onError(err);
335
326
  }
336
327
  }
@@ -340,19 +331,16 @@ function createWuSlot(React) {
340
331
  cancelled = true;
341
332
  clearTimeout(timer);
342
333
 
343
- if (appInstanceRef.current) {
334
+ if (mountedRef.current) {
344
335
  if (onUnmount) onUnmount({ name: actualAppName });
345
-
346
336
  const wu = getWuInstance();
347
- if (wu) {
348
- wu.unmount(actualAppName).catch(() => {});
349
- }
350
- appInstanceRef.current = null;
337
+ if (wu) wu.unmount(actualAppName).catch(() => {});
338
+ mountedRef.current = false;
351
339
  }
352
340
  };
353
341
  }, [actualAppName, url, onLoad, onError, onMount, onUnmount]);
354
342
 
355
- // Render de error
343
+ // Estado de error
356
344
  if (error) {
357
345
  return React.createElement('div', {
358
346
  className: `wu-slot wu-slot-error ${className}`,
@@ -371,27 +359,33 @@ function createWuSlot(React) {
371
359
  ]);
372
360
  }
373
361
 
374
- // Render principal
375
- return React.createElement('div', {
376
- ref: containerRef,
377
- className: `wu-slot ${loading ? 'wu-slot-loading' : 'wu-slot-loaded'} ${className}`,
378
- style: {
379
- minHeight: '100px',
380
- position: 'relative',
381
- ...style
382
- },
383
- 'data-wu-app': actualAppName,
384
- 'data-wu-url': url,
385
- ...props
386
- }, loading && (fallback || React.createElement('div', {
387
- style: {
388
- display: 'flex',
389
- alignItems: 'center',
390
- justifyContent: 'center',
391
- padding: '2rem',
392
- color: '#666'
393
- }
394
- }, `Loading ${name}...`)));
362
+ // Render principal: Fragment con fallback y div de montaje como HERMANOS.
363
+ //
364
+ // REGLA CRÍTICA: el div#containerId NO debe tener hijos React.
365
+ // wu.mount inyecta el MF (otro createRoot) dentro de ese div. Si React también
366
+ // administra hijos ahí, al desmontar el fallback llama removeChild sobre nodos
367
+ // que el MF ya reemplazó → "The node to be removed is not a child of this node".
368
+ //
369
+ // Solución: fallback y mount-target como hermanos en un Fragment pasados como
370
+ // argumentos separados a createElement (NO como array; el array rompe la
371
+ // reconciliación). React solo gestiona el fallback; el interior del mount-target
372
+ // lo controla exclusivamente el MF.
373
+ const defaultFallback = React.createElement('div', {
374
+ style: { display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '2rem', color: '#666' }
375
+ }, `Loading ${name}...`);
376
+
377
+ return React.createElement(React.Fragment, null,
378
+ loading
379
+ ? React.createElement('div', { className: `wu-slot-fallback ${className}` }, fallback || defaultFallback)
380
+ : null,
381
+ React.createElement('div', Object.assign({
382
+ id: containerId,
383
+ className: `wu-slot ${loading ? 'wu-slot-loading' : 'wu-slot-loaded'}`,
384
+ 'data-wu-app': actualAppName,
385
+ 'data-wu-url': url,
386
+ style: Object.assign({ width: '100%', minHeight: loading ? 0 : '200px' }, style)
387
+ }, props))
388
+ );
395
389
  };
396
390
  }
397
391
 
@@ -1,3 +1,3 @@
1
- // Re-export from folder structure — backward compatibility
2
- export * from './react/index';
3
- export { default } from './react/index';
1
+ // Re-export from folder structure — backward compatibility
2
+ export * from './react/index';
3
+ export { default } from './react/index';
@@ -1,3 +1,3 @@
1
- // Re-export from folder structure — backward compatibility
2
- export * from './react/index.js';
3
- export { default } from './react/index.js';
1
+ // Re-export from folder structure — backward compatibility
2
+ export * from './react/index.js';
3
+ export { default } from './react/index.js';
@@ -1,64 +1,64 @@
1
- /**
2
- * WU-FRAMEWORK ADAPTERS — Shared Utilities
3
- *
4
- * Common functions used across all framework adapters.
5
- * Extracted to avoid duplication.
6
- */
7
-
8
- /**
9
- * Get the Wu Framework instance from window or parent frames.
10
- * @returns {object|null}
11
- */
12
- export function getWuInstance() {
13
- if (typeof window === 'undefined') return null;
14
-
15
- return window.wu
16
- || window.parent?.wu
17
- || window.top?.wu
18
- || null;
19
- }
20
-
21
- /**
22
- * Wait for Wu Framework to become available.
23
- * @param {number} timeout - Timeout in ms (default 5000)
24
- * @returns {Promise<object>}
25
- */
26
- export function waitForWu(timeout = 5000) {
27
- return new Promise((resolve, reject) => {
28
- const wu = getWuInstance();
29
- if (wu) {
30
- resolve(wu);
31
- return;
32
- }
33
-
34
- const startTime = Date.now();
35
-
36
- const handleWuReady = () => {
37
- cleanup();
38
- resolve(getWuInstance());
39
- };
40
-
41
- window.addEventListener('wu:ready', handleWuReady);
42
- window.addEventListener('wu:app:ready', handleWuReady);
43
-
44
- const checkInterval = setInterval(() => {
45
- const wu = getWuInstance();
46
- if (wu) {
47
- cleanup();
48
- resolve(wu);
49
- return;
50
- }
51
-
52
- if (Date.now() - startTime > timeout) {
53
- cleanup();
54
- reject(new Error(`Wu Framework not found after ${timeout}ms`));
55
- }
56
- }, 200);
57
-
58
- function cleanup() {
59
- clearInterval(checkInterval);
60
- window.removeEventListener('wu:ready', handleWuReady);
61
- window.removeEventListener('wu:app:ready', handleWuReady);
62
- }
63
- });
64
- }
1
+ /**
2
+ * WU-FRAMEWORK ADAPTERS — Shared Utilities
3
+ *
4
+ * Common functions used across all framework adapters.
5
+ * Extracted to avoid duplication.
6
+ */
7
+
8
+ /**
9
+ * Get the Wu Framework instance from window or parent frames.
10
+ * @returns {object|null}
11
+ */
12
+ export function getWuInstance() {
13
+ if (typeof window === 'undefined') return null;
14
+
15
+ return window.wu
16
+ || window.parent?.wu
17
+ || window.top?.wu
18
+ || null;
19
+ }
20
+
21
+ /**
22
+ * Wait for Wu Framework to become available.
23
+ * @param {number} timeout - Timeout in ms (default 5000)
24
+ * @returns {Promise<object>}
25
+ */
26
+ export function waitForWu(timeout = 5000) {
27
+ return new Promise((resolve, reject) => {
28
+ const wu = getWuInstance();
29
+ if (wu) {
30
+ resolve(wu);
31
+ return;
32
+ }
33
+
34
+ const startTime = Date.now();
35
+
36
+ const handleWuReady = () => {
37
+ cleanup();
38
+ resolve(getWuInstance());
39
+ };
40
+
41
+ window.addEventListener('wu:ready', handleWuReady);
42
+ window.addEventListener('wu:app:ready', handleWuReady);
43
+
44
+ const checkInterval = setInterval(() => {
45
+ const wu = getWuInstance();
46
+ if (wu) {
47
+ cleanup();
48
+ resolve(wu);
49
+ return;
50
+ }
51
+
52
+ if (Date.now() - startTime > timeout) {
53
+ cleanup();
54
+ reject(new Error(`Wu Framework not found after ${timeout}ms`));
55
+ }
56
+ }, 200);
57
+
58
+ function cleanup() {
59
+ clearInterval(checkInterval);
60
+ window.removeEventListener('wu:ready', handleWuReady);
61
+ window.removeEventListener('wu:app:ready', handleWuReady);
62
+ }
63
+ });
64
+ }
@@ -1,32 +1,32 @@
1
- /**
2
- * WU-FRAMEWORK SOLID 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() {
10
- return function useWuAI(options = {}) {
11
- const { namespace = 'default' } = options;
12
- const state = { messages: [], isStreaming: false, error: null };
13
- return {
14
- messages: () => state.messages,
15
- isStreaming: () => state.isStreaming,
16
- error: () => state.error,
17
- async send(text) {
18
- if (!text?.trim()) return;
19
- const wu = getWuInstance();
20
- if (!wu?.ai) { state.error = 'Wu AI not available'; return; }
21
- state.messages = [...state.messages, { id: `user-${Date.now()}`, role: 'user', content: text, timestamp: Date.now() }];
22
- state.isStreaming = true; state.error = null;
23
- try {
24
- const res = await wu.ai.send(text, { namespace });
25
- state.messages = [...state.messages, { id: `assistant-${Date.now()}`, role: 'assistant', content: res.content, timestamp: Date.now() }];
26
- } catch (err) { state.error = err.message; }
27
- state.isStreaming = false;
28
- },
29
- clear() { state.messages = []; state.error = null; },
30
- };
31
- };
32
- }
1
+ /**
2
+ * WU-FRAMEWORK SOLID 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() {
10
+ return function useWuAI(options = {}) {
11
+ const { namespace = 'default' } = options;
12
+ const state = { messages: [], isStreaming: false, error: null };
13
+ return {
14
+ messages: () => state.messages,
15
+ isStreaming: () => state.isStreaming,
16
+ error: () => state.error,
17
+ async send(text) {
18
+ if (!text?.trim()) return;
19
+ const wu = getWuInstance();
20
+ if (!wu?.ai) { state.error = 'Wu AI not available'; return; }
21
+ state.messages = [...state.messages, { id: `user-${Date.now()}`, role: 'user', content: text, timestamp: Date.now() }];
22
+ state.isStreaming = true; state.error = null;
23
+ try {
24
+ const res = await wu.ai.send(text, { namespace });
25
+ state.messages = [...state.messages, { id: `assistant-${Date.now()}`, role: 'assistant', content: res.content, timestamp: Date.now() }];
26
+ } catch (err) { state.error = err.message; }
27
+ state.isStreaming = false;
28
+ },
29
+ clear() { state.messages = []; state.error = null; },
30
+ };
31
+ };
32
+ }
@@ -1,101 +1,101 @@
1
- /**
2
- * 🚀 WU-FRAMEWORK SOLID.JS ADAPTER - TypeScript Declarations
3
- */
4
-
5
- import type { WuCore } from '../core/wu-core';
6
-
7
- // Solid types (generics to avoid hard dependency)
8
- type Component<P = {}> = (props: P) => any;
9
- type Accessor<T> = () => T;
10
- type Setter<T> = (value: T | ((prev: T) => T)) => T;
11
-
12
- /**
13
- * Opciones de registro Solid
14
- */
15
- export interface SolidRegisterOptions {
16
- /** Props iniciales */
17
- props?: Record<string, any>;
18
- /** Callback después de montar */
19
- onMount?: (container: HTMLElement) => void;
20
- /** Callback antes de desmontar */
21
- onUnmount?: (container: HTMLElement) => void;
22
- /** Permitir ejecución standalone */
23
- standalone?: boolean;
24
- /** Selector para modo standalone */
25
- standaloneContainer?: string;
26
- }
27
-
28
- /**
29
- * Props del componente WuSlot
30
- */
31
- export interface WuSlotProps {
32
- name: string;
33
- url: string;
34
- appName?: string;
35
- fallback?: string;
36
- onLoad?: (data: { name: string; url: string }) => void;
37
- onError?: (error: Error) => void;
38
- class?: string;
39
- style?: Record<string, string | number>;
40
- }
41
-
42
- /**
43
- * Resultado de createWuStore
44
- */
45
- export type WuStoreResult<T = any> = [
46
- Accessor<T>,
47
- (path: string, value: any) => void
48
- ];
49
-
50
- /**
51
- * Helper de eventos Wu para Solid
52
- */
53
- export interface UseWuEventsResult {
54
- emit: (event: string, data?: any, options?: any) => void;
55
- on: (event: string, callback: (data: any) => void) => () => void;
56
- once: (event: string, callback: (data: any) => void) => () => void;
57
- off: (event: string, callback: (data: any) => void) => void;
58
- }
59
-
60
- /**
61
- * Contexto de Wu
62
- */
63
- export interface WuContextResult {
64
- WuProvider: Component<{ children?: any }>;
65
- useWu: () => WuCore | null;
66
- WuContext: any;
67
- }
68
-
69
- export function register(
70
- appName: string,
71
- Component: Component,
72
- options?: SolidRegisterOptions
73
- ): Promise<boolean>;
74
-
75
- export function createWuSlot(): Component<WuSlotProps>;
76
-
77
- export function createWuStore<T = any>(namespace?: string): WuStoreResult<T>;
78
-
79
- export function createWuEvent<T = any>(eventPattern: string): Accessor<T | null>;
80
-
81
- export function useWuEvents(): UseWuEventsResult;
82
-
83
- export function createWuContext(): WuContextResult;
84
-
85
- export function getWuInstance(): WuCore | null;
86
-
87
- export function waitForWu(timeout?: number): Promise<WuCore>;
88
-
89
- export interface WuSolidAdapter {
90
- register: typeof register;
91
- createWuSlot: typeof createWuSlot;
92
- createWuStore: typeof createWuStore;
93
- createWuEvent: typeof createWuEvent;
94
- useWuEvents: typeof useWuEvents;
95
- createWuContext: typeof createWuContext;
96
- getWuInstance: typeof getWuInstance;
97
- waitForWu: typeof waitForWu;
98
- }
99
-
100
- export const wuSolid: WuSolidAdapter;
101
- export default wuSolid;
1
+ /**
2
+ * 🚀 WU-FRAMEWORK SOLID.JS ADAPTER - TypeScript Declarations
3
+ */
4
+
5
+ import type { WuCore } from '../core/wu-core';
6
+
7
+ // Solid types (generics to avoid hard dependency)
8
+ type Component<P = {}> = (props: P) => any;
9
+ type Accessor<T> = () => T;
10
+ type Setter<T> = (value: T | ((prev: T) => T)) => T;
11
+
12
+ /**
13
+ * Opciones de registro Solid
14
+ */
15
+ export interface SolidRegisterOptions {
16
+ /** Props iniciales */
17
+ props?: Record<string, any>;
18
+ /** Callback después de montar */
19
+ onMount?: (container: HTMLElement) => void;
20
+ /** Callback antes de desmontar */
21
+ onUnmount?: (container: HTMLElement) => void;
22
+ /** Permitir ejecución standalone */
23
+ standalone?: boolean;
24
+ /** Selector para modo standalone */
25
+ standaloneContainer?: string;
26
+ }
27
+
28
+ /**
29
+ * Props del componente WuSlot
30
+ */
31
+ export interface WuSlotProps {
32
+ name: string;
33
+ url: string;
34
+ appName?: string;
35
+ fallback?: string;
36
+ onLoad?: (data: { name: string; url: string }) => void;
37
+ onError?: (error: Error) => void;
38
+ class?: string;
39
+ style?: Record<string, string | number>;
40
+ }
41
+
42
+ /**
43
+ * Resultado de createWuStore
44
+ */
45
+ export type WuStoreResult<T = any> = [
46
+ Accessor<T>,
47
+ (path: string, value: any) => void
48
+ ];
49
+
50
+ /**
51
+ * Helper de eventos Wu para Solid
52
+ */
53
+ export interface UseWuEventsResult {
54
+ emit: (event: string, data?: any, options?: any) => void;
55
+ on: (event: string, callback: (data: any) => void) => () => void;
56
+ once: (event: string, callback: (data: any) => void) => () => void;
57
+ off: (event: string, callback: (data: any) => void) => void;
58
+ }
59
+
60
+ /**
61
+ * Contexto de Wu
62
+ */
63
+ export interface WuContextResult {
64
+ WuProvider: Component<{ children?: any }>;
65
+ useWu: () => WuCore | null;
66
+ WuContext: any;
67
+ }
68
+
69
+ export function register(
70
+ appName: string,
71
+ Component: Component,
72
+ options?: SolidRegisterOptions
73
+ ): Promise<boolean>;
74
+
75
+ export function createWuSlot(): Component<WuSlotProps>;
76
+
77
+ export function createWuStore<T = any>(namespace?: string): WuStoreResult<T>;
78
+
79
+ export function createWuEvent<T = any>(eventPattern: string): Accessor<T | null>;
80
+
81
+ export function useWuEvents(): UseWuEventsResult;
82
+
83
+ export function createWuContext(): WuContextResult;
84
+
85
+ export function getWuInstance(): WuCore | null;
86
+
87
+ export function waitForWu(timeout?: number): Promise<WuCore>;
88
+
89
+ export interface WuSolidAdapter {
90
+ register: typeof register;
91
+ createWuSlot: typeof createWuSlot;
92
+ createWuStore: typeof createWuStore;
93
+ createWuEvent: typeof createWuEvent;
94
+ useWuEvents: typeof useWuEvents;
95
+ createWuContext: typeof createWuContext;
96
+ getWuInstance: typeof getWuInstance;
97
+ waitForWu: typeof waitForWu;
98
+ }
99
+
100
+ export const wuSolid: WuSolidAdapter;
101
+ export default wuSolid;