pawajs 2.0.0 → 2.0.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/index.d.ts +48 -2
- package/index.js +2 -1
- package/package.json +1 -1
- package/power.js +26 -0
- package/server.d.ts +13 -0
package/index.d.ts
CHANGED
|
@@ -78,6 +78,52 @@ export interface PawaElement extends HTMLElement {
|
|
|
78
78
|
safeEval(context: any, expr: string, error?: string, element?: boolean): any;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
export interface PawaDev {
|
|
82
|
+
tool: boolean;
|
|
83
|
+
errors: any[];
|
|
84
|
+
totalEffect: number;
|
|
85
|
+
errorState: any;
|
|
86
|
+
components: Set<any>;
|
|
87
|
+
renderCount: number;
|
|
88
|
+
performance: {
|
|
89
|
+
renderTime: number[];
|
|
90
|
+
effectTime: number[];
|
|
91
|
+
componentTime: number[];
|
|
92
|
+
start: number;
|
|
93
|
+
end: number;
|
|
94
|
+
};
|
|
95
|
+
_originalStyles: Map<any, any>;
|
|
96
|
+
listeners: Set<Function>;
|
|
97
|
+
highlightElement(el: HTMLElement): void;
|
|
98
|
+
unhighlightElement(el: HTMLElement): void;
|
|
99
|
+
subscribe(cb: (event: { type: string; data: any }) => void): () => void;
|
|
100
|
+
emit(type: string, data: any): void;
|
|
101
|
+
setError(options?: {
|
|
102
|
+
el?: HTMLElement;
|
|
103
|
+
msg?: string;
|
|
104
|
+
directives?: string;
|
|
105
|
+
stack?: string;
|
|
106
|
+
template?: string;
|
|
107
|
+
warn?: boolean;
|
|
108
|
+
}): void;
|
|
109
|
+
clearErrors(): void;
|
|
110
|
+
getSnapshot(): {
|
|
111
|
+
renderCount: number;
|
|
112
|
+
totalEffect: number;
|
|
113
|
+
performance: any;
|
|
114
|
+
errors: any[];
|
|
115
|
+
componentCount: number;
|
|
116
|
+
};
|
|
117
|
+
logRender(c: any, t: any): void;
|
|
118
|
+
logEffect(e: any, t: any): void;
|
|
119
|
+
logComponent(n: any, t: any): void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare global {
|
|
123
|
+
var __pawaDev: PawaDev;
|
|
124
|
+
var __pawaStream: (element: HTMLElement, context: any, statecontext?: any) => void;
|
|
125
|
+
}
|
|
126
|
+
|
|
81
127
|
export interface PawaComment extends Comment {
|
|
82
128
|
_index: number | null;
|
|
83
129
|
_el: Comment;
|
|
@@ -163,11 +209,11 @@ export function pluginsMap(): {
|
|
|
163
209
|
pawaAttributes: Set<string>;
|
|
164
210
|
allowAsProp: Set<string>;
|
|
165
211
|
};
|
|
166
|
-
export function PawaCustomEvent(eventType:string,handler:(el:PawaElement,modifiers:Set
|
|
212
|
+
export function PawaCustomEvent(eventType:string,handler:(el:PawaElement,modifiers:Set<string>,options:{
|
|
167
213
|
capture: Boolean,
|
|
168
214
|
once: Boolean,
|
|
169
215
|
passive: Boolean
|
|
170
|
-
},execute:(e:EventListener)=>void)=>
|
|
216
|
+
},execute:(e:EventListener)=>void)=>void):void;
|
|
171
217
|
export const escapePawaAttribute: Set<string>;
|
|
172
218
|
export const dependentPawaAttribute: Set<string>;
|
|
173
219
|
|
package/index.js
CHANGED
package/package.json
CHANGED
package/power.js
CHANGED
|
@@ -547,6 +547,32 @@ export const documentEvent = (el, attr) => {
|
|
|
547
547
|
};
|
|
548
548
|
|
|
549
549
|
const target = modifiers.has('window') ? window : document;
|
|
550
|
+
|
|
551
|
+
// Wrapper to ensure custom events respect standard action and "out" modifiers
|
|
552
|
+
const wrappedExecute = (e) => {
|
|
553
|
+
// Apply common modifiers first
|
|
554
|
+
if (!checkCommonModifiers(e, modifiers)) return;
|
|
555
|
+
if (!checkKeyModifiers(e, modifiers, eventType)) return;
|
|
556
|
+
|
|
557
|
+
// ========== TARGET MODIFIERS (OUTSIDE LOGIC) ==========
|
|
558
|
+
// For out- events, 'self' means we ignore the event if it happens inside the element or on the element itself.
|
|
559
|
+
if (modifiers.has('self') && (e.target === el || el.contains(e.target))) return;
|
|
560
|
+
if (modifiers.has('not-self') && e.target === el) return;
|
|
561
|
+
|
|
562
|
+
// ========== ACTION MODIFIERS ==========
|
|
563
|
+
if (modifiers.has('prevent')) e.preventDefault?.();
|
|
564
|
+
if (modifiers.has('stop')) e.stopPropagation?.();
|
|
565
|
+
|
|
566
|
+
// ========== EXECUTION ==========
|
|
567
|
+
processEventExecution(el, attr.name, modifiers, () => executeOutEvent(e), eventType, 'out');
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
if (customEventMap.has(eventType)) {
|
|
571
|
+
const custom = customEventMap.get(eventType);
|
|
572
|
+
custom(el, modifiers, options, wrappedExecute);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
|
|
550
576
|
el._MountFunctions.push(() => target.addEventListener(eventType, handler, options))
|
|
551
577
|
const unMount = () => target.removeEventListener(eventType, handler, options);
|
|
552
578
|
el._setUnMount(unMount)
|
package/server.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const isServer: () => boolean;
|
|
2
|
+
export const getServerInstance: () => {
|
|
3
|
+
useInsert: null;
|
|
4
|
+
useInnerContext: null;
|
|
5
|
+
setContext: null;
|
|
6
|
+
useContext: null;
|
|
7
|
+
$state: null;
|
|
8
|
+
accessChild: null;
|
|
9
|
+
useServer: null;
|
|
10
|
+
useAsync: null;
|
|
11
|
+
forwardPops: null;
|
|
12
|
+
};
|
|
13
|
+
export const setServer: (obj?: {}) => void;
|