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.
Files changed (95) hide show
  1. package/LICENSE +19 -1
  2. package/README.md +257 -1122
  3. package/dist/wu-framework.cjs.js +3 -1
  4. package/dist/wu-framework.cjs.js.map +1 -0
  5. package/dist/wu-framework.dev.js +9867 -3183
  6. package/dist/wu-framework.dev.js.map +1 -1
  7. package/dist/wu-framework.esm.js +3 -0
  8. package/dist/wu-framework.esm.js.map +1 -0
  9. package/dist/wu-framework.umd.js +3 -1
  10. package/dist/wu-framework.umd.js.map +1 -0
  11. package/integrations/astro/README.md +127 -0
  12. package/integrations/astro/WuApp.astro +63 -0
  13. package/integrations/astro/WuShell.astro +39 -0
  14. package/integrations/astro/index.js +68 -0
  15. package/integrations/astro/package.json +38 -0
  16. package/integrations/astro/types.d.ts +53 -0
  17. package/package.json +96 -72
  18. package/src/adapters/angular/ai.js +30 -0
  19. package/src/adapters/angular/index.d.ts +154 -0
  20. package/src/adapters/angular/index.js +932 -0
  21. package/src/adapters/angular.d.ts +3 -154
  22. package/src/adapters/angular.js +3 -813
  23. package/src/adapters/index.js +35 -24
  24. package/src/adapters/lit/ai.js +20 -0
  25. package/src/adapters/lit/index.d.ts +120 -0
  26. package/src/adapters/lit/index.js +721 -0
  27. package/src/adapters/lit.d.ts +3 -120
  28. package/src/adapters/lit.js +3 -726
  29. package/src/adapters/preact/ai.js +33 -0
  30. package/src/adapters/preact/index.d.ts +108 -0
  31. package/src/adapters/preact/index.js +661 -0
  32. package/src/adapters/preact.d.ts +3 -108
  33. package/src/adapters/preact.js +3 -665
  34. package/src/adapters/react/ai.js +135 -0
  35. package/src/adapters/react/index.d.ts +246 -0
  36. package/src/adapters/react/index.js +694 -0
  37. package/src/adapters/react.d.ts +3 -212
  38. package/src/adapters/react.js +3 -513
  39. package/src/adapters/shared.js +64 -0
  40. package/src/adapters/solid/ai.js +32 -0
  41. package/src/adapters/solid/index.d.ts +101 -0
  42. package/src/adapters/solid/index.js +586 -0
  43. package/src/adapters/solid.d.ts +3 -101
  44. package/src/adapters/solid.js +3 -591
  45. package/src/adapters/svelte/ai.js +31 -0
  46. package/src/adapters/svelte/index.d.ts +166 -0
  47. package/src/adapters/svelte/index.js +798 -0
  48. package/src/adapters/svelte.d.ts +3 -166
  49. package/src/adapters/svelte.js +3 -803
  50. package/src/adapters/vanilla/ai.js +30 -0
  51. package/src/adapters/vanilla/index.d.ts +179 -0
  52. package/src/adapters/vanilla/index.js +785 -0
  53. package/src/adapters/vanilla.d.ts +3 -179
  54. package/src/adapters/vanilla.js +3 -791
  55. package/src/adapters/vue/ai.js +52 -0
  56. package/src/adapters/vue/index.d.ts +299 -0
  57. package/src/adapters/vue/index.js +608 -0
  58. package/src/adapters/vue.d.ts +3 -299
  59. package/src/adapters/vue.js +3 -611
  60. package/src/ai/wu-ai-actions.js +261 -0
  61. package/src/ai/wu-ai-agent.js +546 -0
  62. package/src/ai/wu-ai-browser-primitives.js +354 -0
  63. package/src/ai/wu-ai-browser.js +380 -0
  64. package/src/ai/wu-ai-context.js +332 -0
  65. package/src/ai/wu-ai-conversation.js +613 -0
  66. package/src/ai/wu-ai-orchestrate.js +1021 -0
  67. package/src/ai/wu-ai-permissions.js +381 -0
  68. package/src/ai/wu-ai-provider.js +700 -0
  69. package/src/ai/wu-ai-schema.js +225 -0
  70. package/src/ai/wu-ai-triggers.js +396 -0
  71. package/src/ai/wu-ai.js +804 -0
  72. package/src/core/wu-app.js +50 -8
  73. package/src/core/wu-cache.js +2 -3
  74. package/src/core/wu-core.js +648 -681
  75. package/src/core/wu-html-parser.js +121 -211
  76. package/src/core/wu-iframe-sandbox.js +328 -0
  77. package/src/core/wu-mcp-bridge.js +431 -0
  78. package/src/core/wu-overrides.js +510 -0
  79. package/src/core/wu-plugin.js +4 -1
  80. package/src/core/wu-prefetch.js +414 -0
  81. package/src/core/wu-proxy-sandbox.js +398 -75
  82. package/src/core/wu-sandbox.js +86 -268
  83. package/src/core/wu-script-executor.js +79 -182
  84. package/src/core/wu-snapshot-sandbox.js +149 -106
  85. package/src/core/wu-strategies.js +13 -0
  86. package/src/core/wu-style-bridge.js +23 -23
  87. package/src/index.js +162 -665
  88. package/dist/wu-framework.hex.js +0 -23
  89. package/dist/wu-framework.min.js +0 -1
  90. package/dist/wu-framework.obf.js +0 -1
  91. package/scripts/build-protected.js +0 -366
  92. package/scripts/build.js +0 -212
  93. package/scripts/rollup-plugin-hex.js +0 -143
  94. package/src/core/wu-registry.js +0 -60
  95. package/src/core/wu-sandbox-pool.js +0 -390
@@ -1,299 +1,3 @@
1
- /**
2
- * Wu Framework Vue Adapter - TypeScript Definitions
3
- */
4
-
5
- import { App, Component, Ref, DefineComponent } from 'vue';
6
-
7
- // ============================================================================
8
- // Core Types (shared with React adapter)
9
- // ============================================================================
10
-
11
- export interface WuInstance {
12
- init: (config: WuConfig) => Promise<void>;
13
- mount: (appName: string, container: string) => Promise<void>;
14
- unmount: (appName: string) => Promise<void>;
15
- define: (appName: string, lifecycle: WuLifecycle) => void;
16
- app: (name: string, config: WuAppConfig) => WuApp;
17
- eventBus: WuEventBus;
18
- store: WuStore;
19
- }
20
-
21
- export interface WuConfig {
22
- apps: Array<{
23
- name: string;
24
- url: string;
25
- strategy?: 'lazy' | 'eager' | 'preload' | 'idle';
26
- }>;
27
- }
28
-
29
- export interface WuLifecycle {
30
- mount: (container: HTMLElement) => void | Promise<void>;
31
- unmount: (container?: HTMLElement) => void | Promise<void>;
32
- }
33
-
34
- export interface WuAppConfig {
35
- url: string;
36
- container: string;
37
- autoInit?: boolean;
38
- }
39
-
40
- export interface WuApp {
41
- mount: (container?: string) => Promise<void>;
42
- unmount: () => Promise<void>;
43
- remount: () => Promise<void>;
44
- reload: () => Promise<void>;
45
- destroy: () => Promise<void>;
46
- isMounted: boolean;
47
- info: WuAppInfo;
48
- }
49
-
50
- export interface WuAppInfo {
51
- name: string;
52
- url: string;
53
- mounted: boolean;
54
- status: 'stable' | 'refreshed' | 'unstable';
55
- }
56
-
57
- export interface WuEventBus {
58
- emit: (event: string, data?: any, options?: EmitOptions) => void;
59
- on: (event: string, callback: EventCallback) => () => void;
60
- once: (event: string, callback: EventCallback) => () => void;
61
- off: (event: string, callback?: EventCallback) => void;
62
- }
63
-
64
- export interface WuStore {
65
- get: (path?: string) => any;
66
- set: (path: string, value: any) => number;
67
- on: (pattern: string, callback: StoreCallback) => () => void;
68
- batch: (updates: Record<string, any>) => number[];
69
- clear: () => void;
70
- }
71
-
72
- export type EventCallback = (event: WuEvent) => void;
73
- export type StoreCallback = (change: { path: string; value: any }) => void;
74
-
75
- export interface WuEvent {
76
- name: string;
77
- data: any;
78
- timestamp: number;
79
- source?: string;
80
- }
81
-
82
- export interface EmitOptions {
83
- appName?: string;
84
- timestamp?: number;
85
- meta?: Record<string, any>;
86
- }
87
-
88
- // ============================================================================
89
- // Vue Adapter Types
90
- // ============================================================================
91
-
92
- export interface VueRegisterOptions {
93
- /**
94
- * Function to configure the Vue app (install plugins, add global components, etc.)
95
- * @param app - Vue app instance
96
- */
97
- setup?: (app: App) => void;
98
- /** Initial props for the component */
99
- props?: Record<string, any>;
100
- /** Callback after mounting */
101
- onMount?: (container: HTMLElement, app: App) => void;
102
- /** Callback before unmounting */
103
- onUnmount?: (container: HTMLElement, app: App) => void;
104
- /** Allow standalone execution (default: true) */
105
- standalone?: boolean;
106
- /** Selector for standalone mode (default: '#app') */
107
- standaloneContainer?: string;
108
- }
109
-
110
- /**
111
- * Register a Vue component as a microfrontend
112
- *
113
- * @example
114
- * // Basic
115
- * wuVue.register('my-app', App);
116
- *
117
- * @example
118
- * // With plugins
119
- * wuVue.register('my-app', App, {
120
- * setup: (app) => {
121
- * app.use(createPinia());
122
- * app.use(router);
123
- * }
124
- * });
125
- */
126
- export function register(
127
- appName: string,
128
- RootComponent: Component,
129
- options?: VueRegisterOptions
130
- ): Promise<boolean>;
131
-
132
- // ============================================================================
133
- // WuSlot Component Types
134
- // ============================================================================
135
-
136
- export interface WuSlotProps {
137
- /** Display name for the microfrontend */
138
- name: string;
139
- /** URL where the microfrontend is hosted */
140
- url: string;
141
- /** App name from wu.json (defaults to name if not provided) */
142
- appName?: string;
143
- /** Custom fallback text while loading */
144
- fallbackText?: string;
145
- }
146
-
147
- export interface WuSlotEmits {
148
- /** Emitted when microfrontend loads successfully */
149
- (e: 'load', info: { name: string; url: string }): void;
150
- /** Emitted when loading fails */
151
- (e: 'error', error: Error): void;
152
- /** Emitted when microfrontend mounts */
153
- (e: 'mount', info: { name: string; container: HTMLElement }): void;
154
- /** Emitted when microfrontend unmounts */
155
- (e: 'unmount', info: { name: string }): void;
156
- }
157
-
158
- /**
159
- * Vue component for loading microfrontends
160
- *
161
- * @example
162
- * <WuSlot name="my-app" url="http://localhost:3001" @load="onLoad" />
163
- */
164
- export const WuSlot: DefineComponent<WuSlotProps, {}, {}, {}, {}, {}, {}, WuSlotEmits>;
165
-
166
- // ============================================================================
167
- // Composables Types
168
- // ============================================================================
169
-
170
- export interface UseWuEventsReturn {
171
- /** Emit an event to the event bus */
172
- emit: (event: string, data?: any, options?: EmitOptions) => void;
173
- /** Subscribe to an event */
174
- on: (event: string, callback: EventCallback) => () => void;
175
- /** Subscribe to an event once */
176
- once: (event: string, callback: EventCallback) => () => void;
177
- /** Unsubscribe from an event */
178
- off: (event: string, callback?: EventCallback) => void;
179
- /** Clean up all subscriptions (call in onUnmounted) */
180
- cleanup: () => void;
181
- }
182
-
183
- /**
184
- * Composable for using Wu Framework EventBus
185
- *
186
- * @example
187
- * const { emit, on, cleanup } = useWuEvents();
188
- *
189
- * onMounted(() => {
190
- * on('user:login', handleLogin);
191
- * });
192
- *
193
- * onUnmounted(() => {
194
- * cleanup();
195
- * });
196
- */
197
- export function useWuEvents(): UseWuEventsReturn;
198
-
199
- export interface UseWuStoreReturn<T = any> {
200
- /** Reactive state value */
201
- state: Ref<T | null>;
202
- /** Set a value in the store */
203
- setState: (path: string, value: any) => void;
204
- /** Get a value from the store */
205
- getState: (path?: string) => any;
206
- /** Clean up subscription (call in onUnmounted) */
207
- cleanup: () => void;
208
- }
209
-
210
- /**
211
- * Composable for using Wu Framework Store
212
- *
213
- * @example
214
- * const { state, setState, getState, cleanup } = useWuStore('user');
215
- *
216
- * // state.value is reactive
217
- * watchEffect(() => {
218
- * console.log('User changed:', state.value);
219
- * });
220
- *
221
- * onUnmounted(() => {
222
- * cleanup();
223
- * });
224
- */
225
- export function useWuStore<T = any>(namespace?: string): UseWuStoreReturn<T>;
226
-
227
- // ============================================================================
228
- // Plugin Types
229
- // ============================================================================
230
-
231
- export interface WuVuePluginOptions {
232
- // Reserved for future options
233
- }
234
-
235
- /**
236
- * Vue plugin to install Wu Framework globally
237
- *
238
- * @example
239
- * import { createApp } from 'vue';
240
- * import { wuVuePlugin } from 'wu-framework/adapters/vue';
241
- *
242
- * const app = createApp(App);
243
- * app.use(wuVuePlugin);
244
- *
245
- * // Now you can use:
246
- * // - <WuSlot /> component globally
247
- * // - this.$wu in Options API
248
- * // - inject('wu') in Composition API
249
- */
250
- export const wuVuePlugin: {
251
- install: (app: App, options?: WuVuePluginOptions) => void;
252
- };
253
-
254
- // ============================================================================
255
- // Utility Functions
256
- // ============================================================================
257
-
258
- /**
259
- * Get the Wu Framework instance
260
- */
261
- export function getWuInstance(): WuInstance | null;
262
-
263
- /**
264
- * Wait for Wu Framework to be available
265
- * @param timeout - Maximum time to wait in ms (default: 5000)
266
- */
267
- export function waitForWu(timeout?: number): Promise<WuInstance>;
268
-
269
- // ============================================================================
270
- // Main Export
271
- // ============================================================================
272
-
273
- export interface WuVueAdapter {
274
- register: typeof register;
275
- WuSlot: typeof WuSlot;
276
- useWuEvents: typeof useWuEvents;
277
- useWuStore: typeof useWuStore;
278
- wuVuePlugin: typeof wuVuePlugin;
279
- getWuInstance: typeof getWuInstance;
280
- waitForWu: typeof waitForWu;
281
- }
282
-
283
- export const wuVue: WuVueAdapter;
284
- export default wuVue;
285
-
286
- // ============================================================================
287
- // Global Augmentations
288
- // ============================================================================
289
-
290
- declare module '@vue/runtime-core' {
291
- interface ComponentCustomProperties {
292
- /** Wu Framework instance */
293
- $wu: WuInstance | null;
294
- /** Wu Framework EventBus helpers */
295
- $wuEvents: UseWuEventsReturn;
296
- /** Wu Framework Store factory */
297
- $wuStore: <T = any>(namespace?: string) => UseWuStoreReturn<T>;
298
- }
299
- }
1
+ // Re-export from folder structure — backward compatibility
2
+ export * from './vue/index';
3
+ export { default } from './vue/index';