wu-framework 1.0.6 → 1.1.1
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 +948 -358
- package/package.json +34 -9
- package/src/adapters/angular.d.ts +154 -0
- package/src/adapters/angular.js +642 -0
- package/src/adapters/index.js +157 -0
- package/src/adapters/lit.d.ts +120 -0
- package/src/adapters/lit.js +726 -0
- package/src/adapters/preact.d.ts +108 -0
- package/src/adapters/preact.js +665 -0
- package/src/adapters/react.d.ts +212 -0
- package/src/adapters/react.js +513 -0
- package/src/adapters/solid.d.ts +101 -0
- package/src/adapters/solid.js +591 -0
- package/src/adapters/svelte.d.ts +166 -0
- package/src/adapters/svelte.js +803 -0
- package/src/adapters/vanilla.d.ts +179 -0
- package/src/adapters/vanilla.js +791 -0
- package/src/adapters/vue.d.ts +299 -0
- package/src/adapters/vue.js +570 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚀 WU-FRAMEWORK ADAPTERS
|
|
3
|
+
*
|
|
4
|
+
* Adapters oficiales para integrar Wu Framework con frameworks populares.
|
|
5
|
+
* Soporta: React, Vue, Angular, Svelte, Preact, Solid.js, Lit, Vanilla JS
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Importar adapter específico
|
|
9
|
+
* import { wuReact } from 'wu-framework/adapters/react';
|
|
10
|
+
* import { wuVue } from 'wu-framework/adapters/vue';
|
|
11
|
+
* import { wuAngular } from 'wu-framework/adapters/angular';
|
|
12
|
+
* import { wuSvelte } from 'wu-framework/adapters/svelte';
|
|
13
|
+
* import { wuPreact } from 'wu-framework/adapters/preact';
|
|
14
|
+
* import { wuSolid } from 'wu-framework/adapters/solid';
|
|
15
|
+
* import { wuLit } from 'wu-framework/adapters/lit';
|
|
16
|
+
* import { wuVanilla } from 'wu-framework/adapters/vanilla';
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Importar todo
|
|
20
|
+
* import {
|
|
21
|
+
* wuReact, wuVue, wuAngular, wuSvelte,
|
|
22
|
+
* wuPreact, wuSolid, wuLit, wuVanilla
|
|
23
|
+
* } from 'wu-framework/adapters';
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// ============================================
|
|
27
|
+
// REACT ADAPTER
|
|
28
|
+
// ============================================
|
|
29
|
+
export {
|
|
30
|
+
wuReact,
|
|
31
|
+
register as registerReact,
|
|
32
|
+
createWuSlot,
|
|
33
|
+
createUseWuEvents,
|
|
34
|
+
createUseWuStore
|
|
35
|
+
} from './react.js';
|
|
36
|
+
|
|
37
|
+
// ============================================
|
|
38
|
+
// VUE ADAPTER
|
|
39
|
+
// ============================================
|
|
40
|
+
export {
|
|
41
|
+
wuVue,
|
|
42
|
+
register as registerVue,
|
|
43
|
+
WuSlot,
|
|
44
|
+
useWuEvents,
|
|
45
|
+
useWuStore,
|
|
46
|
+
wuVuePlugin
|
|
47
|
+
} from './vue.js';
|
|
48
|
+
|
|
49
|
+
// ============================================
|
|
50
|
+
// ANGULAR ADAPTER
|
|
51
|
+
// ============================================
|
|
52
|
+
export {
|
|
53
|
+
wuAngular,
|
|
54
|
+
register as registerAngular,
|
|
55
|
+
registerStandalone as registerAngularStandalone,
|
|
56
|
+
createWuService,
|
|
57
|
+
createWuSlotComponent,
|
|
58
|
+
getWuSlotModuleConfig
|
|
59
|
+
} from './angular.js';
|
|
60
|
+
|
|
61
|
+
// ============================================
|
|
62
|
+
// SVELTE ADAPTER
|
|
63
|
+
// ============================================
|
|
64
|
+
export {
|
|
65
|
+
wuSvelte,
|
|
66
|
+
register as registerSvelte,
|
|
67
|
+
registerSvelte5,
|
|
68
|
+
createWuStore as createSvelteWuStore,
|
|
69
|
+
createWuEventStore,
|
|
70
|
+
useWuEvents as useSvelteWuEvents,
|
|
71
|
+
createWuSlotConfig
|
|
72
|
+
} from './svelte.js';
|
|
73
|
+
|
|
74
|
+
// ============================================
|
|
75
|
+
// PREACT ADAPTER
|
|
76
|
+
// ============================================
|
|
77
|
+
export {
|
|
78
|
+
wuPreact,
|
|
79
|
+
register as registerPreact,
|
|
80
|
+
registerCompat as registerPreactCompat,
|
|
81
|
+
createWuSlot as createPreactWuSlot,
|
|
82
|
+
createUseWuEvents as createPreactUseWuEvents,
|
|
83
|
+
createUseWuStore as createPreactUseWuStore
|
|
84
|
+
} from './preact.js';
|
|
85
|
+
|
|
86
|
+
// ============================================
|
|
87
|
+
// SOLID.JS ADAPTER
|
|
88
|
+
// ============================================
|
|
89
|
+
export {
|
|
90
|
+
wuSolid,
|
|
91
|
+
register as registerSolid,
|
|
92
|
+
createWuSlot as createSolidWuSlot,
|
|
93
|
+
createWuStore as createSolidWuStore,
|
|
94
|
+
createWuEvent,
|
|
95
|
+
useWuEvents as useSolidWuEvents,
|
|
96
|
+
createWuContext
|
|
97
|
+
} from './solid.js';
|
|
98
|
+
|
|
99
|
+
// ============================================
|
|
100
|
+
// LIT (WEB COMPONENTS) ADAPTER
|
|
101
|
+
// ============================================
|
|
102
|
+
export {
|
|
103
|
+
wuLit,
|
|
104
|
+
register as registerLit,
|
|
105
|
+
registerWebComponent,
|
|
106
|
+
createWuSlotElement,
|
|
107
|
+
WuMixin,
|
|
108
|
+
wuProperty,
|
|
109
|
+
createSimpleElement
|
|
110
|
+
} from './lit.js';
|
|
111
|
+
|
|
112
|
+
// ============================================
|
|
113
|
+
// VANILLA JS ADAPTER
|
|
114
|
+
// ============================================
|
|
115
|
+
export {
|
|
116
|
+
wuVanilla,
|
|
117
|
+
register as registerVanilla,
|
|
118
|
+
registerClass,
|
|
119
|
+
registerTemplate,
|
|
120
|
+
createComponent,
|
|
121
|
+
createWuSlot as createVanillaWuSlot,
|
|
122
|
+
useWuEvents as useVanillaWuEvents,
|
|
123
|
+
useWuStore as useVanillaWuStore
|
|
124
|
+
} from './vanilla.js';
|
|
125
|
+
|
|
126
|
+
// ============================================
|
|
127
|
+
// SHARED UTILITIES
|
|
128
|
+
// ============================================
|
|
129
|
+
export { getWuInstance, waitForWu } from './react.js';
|
|
130
|
+
|
|
131
|
+
// ============================================
|
|
132
|
+
// ALL ADAPTERS OBJECT
|
|
133
|
+
// ============================================
|
|
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';
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Objeto con todos los adapters disponibles
|
|
145
|
+
*/
|
|
146
|
+
export const adapters = {
|
|
147
|
+
react: wuReact,
|
|
148
|
+
vue: wuVue,
|
|
149
|
+
angular: wuAngular,
|
|
150
|
+
svelte: wuSvelte,
|
|
151
|
+
preact: wuPreact,
|
|
152
|
+
solid: wuSolid,
|
|
153
|
+
lit: wuLit,
|
|
154
|
+
vanilla: wuVanilla
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export default adapters;
|
|
@@ -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;
|