revojs 0.0.19 → 0.0.21
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/dist/html/index.d.ts +4 -2
- package/dist/index.js +7 -3
- package/dist/jsx/index.d.ts +123 -123
- package/package.json +1 -1
package/dist/html/index.d.ts
CHANGED
|
@@ -5,18 +5,19 @@ export type TypeOf<T> = {
|
|
|
5
5
|
};
|
|
6
6
|
export type Infer<T> = T extends TypeOf<infer U> ? U : unknown;
|
|
7
7
|
export type Slot = unknown | Template | Array<Slot> | (() => Slot);
|
|
8
|
+
export type EventListener<T extends Event> = ((event: T) => void) | Array<(event: T) => void>;
|
|
8
9
|
export type Template = {
|
|
9
10
|
tag: string;
|
|
10
11
|
attributes: Record<string, unknown>;
|
|
11
12
|
children: Array<Slot>;
|
|
12
13
|
};
|
|
13
14
|
export type EventInput<T extends Events> = {
|
|
14
|
-
[K in keyof T]?:
|
|
15
|
+
[K in keyof T]?: EventListener<Infer<T[K]["type"]> extends Event ? Infer<T[K]["type"]> : CustomEvent<Infer<T[K]["type"]>>>;
|
|
15
16
|
};
|
|
16
17
|
export type AttributeInput<T extends Attributes> = {
|
|
17
18
|
[K in keyof T]?: Value<Infer<T[K]["type"]> | undefined>;
|
|
18
19
|
};
|
|
19
|
-
export type Input<TEvents extends Events, TAttributes extends Attributes> = EventInput<TEvents>
|
|
20
|
+
export type Input<TEvents extends Events, TAttributes extends Attributes> = EventInput<TEvents> | AttributeInput<TAttributes> | HtmlAttributes;
|
|
20
21
|
export type EventOutput<T extends Events> = {
|
|
21
22
|
[K in keyof T]?: (event: Infer<T[K]["type"]>) => void;
|
|
22
23
|
};
|
|
@@ -78,6 +79,7 @@ export declare const toCustomElement: <TEvents extends Events = {}, TAttributes
|
|
|
78
79
|
export declare const registerComponent: <TEvents extends Events = {}, TAttributes extends Attributes = {}>(component: ComponentConstructor<TEvents, TAttributes>) => ComponentConstructor<TEvents, TAttributes>;
|
|
79
80
|
export declare const getGlobalStyles: () => CSSStyleSheet[];
|
|
80
81
|
export declare const getCustomElement: (node: Node | null) => CustomElement<Events, Attributes> | undefined;
|
|
82
|
+
export declare const eventListener: <T extends Event>(event: T, invoke?: EventListener<T>) => void;
|
|
81
83
|
export declare const isClient: () => boolean;
|
|
82
84
|
export declare const isServer: () => boolean;
|
|
83
85
|
export declare const preventDefault: (event: Event) => void;
|
package/dist/index.js
CHANGED
|
@@ -324,8 +324,8 @@ const renderToNode = async (scope, slot) => {
|
|
|
324
324
|
if (name.startsWith("on")) {
|
|
325
325
|
const event = name.substring(2).toLowerCase();
|
|
326
326
|
const controller = new AbortController();
|
|
327
|
-
element.addEventListener(event, (event$1) =>
|
|
328
|
-
scope.dispose.push(
|
|
327
|
+
element.addEventListener(event, (event$1) => eventListener(event$1, value), { signal: controller.signal });
|
|
328
|
+
scope.dispose.push(controller.abort);
|
|
329
329
|
} else createCompute(scope, () => {
|
|
330
330
|
const set = toString(value);
|
|
331
331
|
if (set === "" || set === "false") return element.removeAttribute(name);
|
|
@@ -453,6 +453,10 @@ const getCustomElement = (node) => {
|
|
|
453
453
|
return getCustomElement(node.parentNode);
|
|
454
454
|
}
|
|
455
455
|
};
|
|
456
|
+
const eventListener = (event, invoke) => {
|
|
457
|
+
if (Array.isArray(invoke)) for (const target of invoke) target?.(event);
|
|
458
|
+
else invoke?.(event);
|
|
459
|
+
};
|
|
456
460
|
const isClient = () => typeof window !== "undefined";
|
|
457
461
|
const isServer = () => typeof window === "undefined";
|
|
458
462
|
const preventDefault = (event) => event.preventDefault();
|
|
@@ -785,4 +789,4 @@ const anchorNavigate = (event) => {
|
|
|
785
789
|
};
|
|
786
790
|
|
|
787
791
|
//#endregion
|
|
788
|
-
export { $fetch, Compute, Handler, Hooks, MOUNTED_HOOK, Outlet, RUNTIME_CONTEXT, Radix, Scope, activeCompute, anchorNavigate, components, createApp, createCompute, createElement, createEvent, createMemo, createRuntime, createState, defineComponent, defineContext, defineHook, defineRoute, fileName, fromValue, getAssets, getCookies, getCustomElement, getGlobalStyles, getMimeType, getRequestUrl, getRoutes, getSetCookies, getVariables, isClient, isServer, isTemplate, markdownToSlot, navigate, preventDefault, registerComponent, renderToNode, renderToString, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, stopImmediatePropagation, stopPropagation, targets, toCustomElement, toFragment, toPath, toString };
|
|
792
|
+
export { $fetch, Compute, Handler, Hooks, MOUNTED_HOOK, Outlet, RUNTIME_CONTEXT, Radix, Scope, activeCompute, anchorNavigate, components, createApp, createCompute, createElement, createEvent, createMemo, createRuntime, createState, defineComponent, defineContext, defineHook, defineRoute, eventListener, fileName, fromValue, getAssets, getCookies, getCustomElement, getGlobalStyles, getMimeType, getRequestUrl, getRoutes, getSetCookies, getVariables, isClient, isServer, isTemplate, markdownToSlot, navigate, preventDefault, registerComponent, renderToNode, renderToString, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, stopImmediatePropagation, stopPropagation, targets, toCustomElement, toFragment, toPath, toString };
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import { type Slot } from "../html";
|
|
1
|
+
import { type EventListener, type Slot } from "../html";
|
|
2
2
|
export type EventAttributes = {
|
|
3
|
-
onScroll?:
|
|
4
|
-
onScrollCapture?:
|
|
5
|
-
onScrollEnd?:
|
|
6
|
-
onScrollEndCapture?:
|
|
7
|
-
onWheel?:
|
|
8
|
-
onWheelCapture?:
|
|
9
|
-
onAnimationCancel?:
|
|
10
|
-
onAnimationCancelCapture?:
|
|
11
|
-
onAnimationEnd?:
|
|
12
|
-
onAnimationEndCapture?:
|
|
13
|
-
onAnimationIteration?:
|
|
14
|
-
onAnimationIterationCapture?:
|
|
15
|
-
onAnimationStart?:
|
|
16
|
-
onAnimationStartCapture?:
|
|
17
|
-
onCopy?:
|
|
18
|
-
onCopyCapture?:
|
|
19
|
-
onCut?:
|
|
20
|
-
onCutCapture?:
|
|
21
|
-
onPaste?:
|
|
22
|
-
onPasteCapture?:
|
|
23
|
-
onCompositionEnd?:
|
|
24
|
-
onCompositionEndCapture?:
|
|
25
|
-
onCompositionStart?:
|
|
26
|
-
onCompositionStartCapture?:
|
|
27
|
-
onCompositionUpdate?:
|
|
28
|
-
onCompositionUpdateCapture?:
|
|
29
|
-
onBlur?:
|
|
30
|
-
onBlurCapture?:
|
|
31
|
-
onFocus?:
|
|
32
|
-
onFocusCapture?:
|
|
33
|
-
onFocusIn?:
|
|
34
|
-
onFocusInCapture?:
|
|
35
|
-
onFocusOut?:
|
|
36
|
-
onFocusOutCapture?:
|
|
37
|
-
onFullscreenChange?:
|
|
38
|
-
onFullscreenChangeCapture?:
|
|
39
|
-
onFullscreenError?:
|
|
40
|
-
onFullscreenErrorCapture?:
|
|
41
|
-
onKeyDown?:
|
|
42
|
-
onKeyDownCapture?:
|
|
43
|
-
onKeyPress?:
|
|
44
|
-
onKeyPressCapture?:
|
|
45
|
-
onKeyUp?:
|
|
46
|
-
onKeyUpCapture?:
|
|
47
|
-
onAuxClick?:
|
|
48
|
-
onAuxClickCapture?:
|
|
49
|
-
onClick?:
|
|
50
|
-
onClickCapture?:
|
|
51
|
-
onContextMenu?:
|
|
52
|
-
onContextMenuCapture?:
|
|
53
|
-
onDoubleClick?:
|
|
54
|
-
onDoubleClickCapture?:
|
|
55
|
-
onMouseDown?:
|
|
56
|
-
onMouseDownCapture?:
|
|
57
|
-
onMouseEnter?:
|
|
58
|
-
onMouseEnterCapture?:
|
|
59
|
-
onMouseLeave?:
|
|
60
|
-
onMouseLeaveCapture?:
|
|
61
|
-
onMouseMove?:
|
|
62
|
-
onMouseMoveCapture?:
|
|
63
|
-
onMouseOut?:
|
|
64
|
-
onMouseOutCapture?:
|
|
65
|
-
onMouseOver?:
|
|
66
|
-
onMouseOverCapture?:
|
|
67
|
-
onMouseUp?:
|
|
68
|
-
onMouseUpCapture?:
|
|
69
|
-
onMouseWheel?:
|
|
70
|
-
onMouseWheelCapture?:
|
|
71
|
-
onGotPointerCapture?:
|
|
72
|
-
onGotPointerCaptureCapture?:
|
|
73
|
-
onLostPointerCapture?:
|
|
74
|
-
onLostPointerCaptureCapture?:
|
|
75
|
-
onPointerCancel?:
|
|
76
|
-
onPointerCancelCapture?:
|
|
77
|
-
onPointerDown?:
|
|
78
|
-
onPointerDownCapture?:
|
|
79
|
-
onPointerEnter?:
|
|
80
|
-
onPointerEnterCapture?:
|
|
81
|
-
onPointerLeave?:
|
|
82
|
-
onPointerLeaveCapture?:
|
|
83
|
-
onPointerMove?:
|
|
84
|
-
onPointerMoveCapture?:
|
|
85
|
-
onPointerOut?:
|
|
86
|
-
onPointerOutCapture?:
|
|
87
|
-
onPointerOver?:
|
|
88
|
-
onPointerOverCapture?:
|
|
89
|
-
onPointerUp?:
|
|
90
|
-
onPointerUpCapture?:
|
|
91
|
-
onTouchCancel?:
|
|
92
|
-
onTouchCancelCapture?:
|
|
93
|
-
onTouchEnd?:
|
|
94
|
-
onTouchEndCapture?:
|
|
95
|
-
onTouchMove?:
|
|
96
|
-
onTouchMoveCapture?:
|
|
97
|
-
onTouchStart?:
|
|
98
|
-
onTouchStartCapture?:
|
|
99
|
-
onTransitionCancel?:
|
|
100
|
-
onTransitionCancelCapture?:
|
|
101
|
-
onTransitionEnd?:
|
|
102
|
-
onTransitionEndCapture?:
|
|
103
|
-
onTransitionRun?:
|
|
104
|
-
onTransitionRunCapture?:
|
|
105
|
-
onTransitionStart?:
|
|
106
|
-
onTransitionStartCapture?:
|
|
107
|
-
onFormData?:
|
|
108
|
-
onFormDataCapture?:
|
|
109
|
-
onReset?:
|
|
110
|
-
onResetCapture?:
|
|
111
|
-
onSubmit?:
|
|
112
|
-
onSubmitCapture?:
|
|
113
|
-
onInvalid?:
|
|
114
|
-
onInvalidCapture?:
|
|
115
|
-
onSelect?:
|
|
116
|
-
onSelectCapture?:
|
|
117
|
-
onSelectChange?:
|
|
118
|
-
onSelectChangeCapture?:
|
|
119
|
-
onInput?:
|
|
120
|
-
onInputCapture?:
|
|
121
|
-
onBeforeInput?:
|
|
122
|
-
onBeforeInputCapture?:
|
|
123
|
-
onChange?:
|
|
124
|
-
onChangeCapture?:
|
|
3
|
+
onScroll?: EventListener<Event>;
|
|
4
|
+
onScrollCapture?: EventListener<Event>;
|
|
5
|
+
onScrollEnd?: EventListener<Event>;
|
|
6
|
+
onScrollEndCapture?: EventListener<Event>;
|
|
7
|
+
onWheel?: EventListener<WheelEvent>;
|
|
8
|
+
onWheelCapture?: EventListener<WheelEvent>;
|
|
9
|
+
onAnimationCancel?: EventListener<AnimationEvent>;
|
|
10
|
+
onAnimationCancelCapture?: EventListener<AnimationEvent>;
|
|
11
|
+
onAnimationEnd?: EventListener<AnimationEvent>;
|
|
12
|
+
onAnimationEndCapture?: EventListener<AnimationEvent>;
|
|
13
|
+
onAnimationIteration?: EventListener<AnimationEvent>;
|
|
14
|
+
onAnimationIterationCapture?: EventListener<AnimationEvent>;
|
|
15
|
+
onAnimationStart?: EventListener<AnimationEvent>;
|
|
16
|
+
onAnimationStartCapture?: EventListener<AnimationEvent>;
|
|
17
|
+
onCopy?: EventListener<ClipboardEvent>;
|
|
18
|
+
onCopyCapture?: EventListener<ClipboardEvent>;
|
|
19
|
+
onCut?: EventListener<ClipboardEvent>;
|
|
20
|
+
onCutCapture?: EventListener<ClipboardEvent>;
|
|
21
|
+
onPaste?: EventListener<ClipboardEvent>;
|
|
22
|
+
onPasteCapture?: EventListener<ClipboardEvent>;
|
|
23
|
+
onCompositionEnd?: EventListener<CompositionEvent>;
|
|
24
|
+
onCompositionEndCapture?: EventListener<CompositionEvent>;
|
|
25
|
+
onCompositionStart?: EventListener<CompositionEvent>;
|
|
26
|
+
onCompositionStartCapture?: EventListener<CompositionEvent>;
|
|
27
|
+
onCompositionUpdate?: EventListener<CompositionEvent>;
|
|
28
|
+
onCompositionUpdateCapture?: EventListener<CompositionEvent>;
|
|
29
|
+
onBlur?: EventListener<FocusEvent>;
|
|
30
|
+
onBlurCapture?: EventListener<FocusEvent>;
|
|
31
|
+
onFocus?: EventListener<FocusEvent>;
|
|
32
|
+
onFocusCapture?: EventListener<FocusEvent>;
|
|
33
|
+
onFocusIn?: EventListener<FocusEvent>;
|
|
34
|
+
onFocusInCapture?: EventListener<FocusEvent>;
|
|
35
|
+
onFocusOut?: EventListener<FocusEvent>;
|
|
36
|
+
onFocusOutCapture?: EventListener<FocusEvent>;
|
|
37
|
+
onFullscreenChange?: EventListener<Event>;
|
|
38
|
+
onFullscreenChangeCapture?: EventListener<Event>;
|
|
39
|
+
onFullscreenError?: EventListener<Event>;
|
|
40
|
+
onFullscreenErrorCapture?: EventListener<Event>;
|
|
41
|
+
onKeyDown?: EventListener<KeyboardEvent>;
|
|
42
|
+
onKeyDownCapture?: EventListener<KeyboardEvent>;
|
|
43
|
+
onKeyPress?: EventListener<KeyboardEvent>;
|
|
44
|
+
onKeyPressCapture?: EventListener<KeyboardEvent>;
|
|
45
|
+
onKeyUp?: EventListener<KeyboardEvent>;
|
|
46
|
+
onKeyUpCapture?: EventListener<KeyboardEvent>;
|
|
47
|
+
onAuxClick?: EventListener<MouseEvent>;
|
|
48
|
+
onAuxClickCapture?: EventListener<MouseEvent>;
|
|
49
|
+
onClick?: EventListener<MouseEvent>;
|
|
50
|
+
onClickCapture?: EventListener<MouseEvent>;
|
|
51
|
+
onContextMenu?: EventListener<MouseEvent>;
|
|
52
|
+
onContextMenuCapture?: EventListener<MouseEvent>;
|
|
53
|
+
onDoubleClick?: EventListener<MouseEvent>;
|
|
54
|
+
onDoubleClickCapture?: EventListener<MouseEvent>;
|
|
55
|
+
onMouseDown?: EventListener<MouseEvent>;
|
|
56
|
+
onMouseDownCapture?: EventListener<MouseEvent>;
|
|
57
|
+
onMouseEnter?: EventListener<MouseEvent>;
|
|
58
|
+
onMouseEnterCapture?: EventListener<MouseEvent>;
|
|
59
|
+
onMouseLeave?: EventListener<MouseEvent>;
|
|
60
|
+
onMouseLeaveCapture?: EventListener<MouseEvent>;
|
|
61
|
+
onMouseMove?: EventListener<MouseEvent>;
|
|
62
|
+
onMouseMoveCapture?: EventListener<MouseEvent>;
|
|
63
|
+
onMouseOut?: EventListener<MouseEvent>;
|
|
64
|
+
onMouseOutCapture?: EventListener<MouseEvent>;
|
|
65
|
+
onMouseOver?: EventListener<MouseEvent>;
|
|
66
|
+
onMouseOverCapture?: EventListener<MouseEvent>;
|
|
67
|
+
onMouseUp?: EventListener<MouseEvent>;
|
|
68
|
+
onMouseUpCapture?: EventListener<MouseEvent>;
|
|
69
|
+
onMouseWheel?: EventListener<WheelEvent>;
|
|
70
|
+
onMouseWheelCapture?: EventListener<WheelEvent>;
|
|
71
|
+
onGotPointerCapture?: EventListener<PointerEvent>;
|
|
72
|
+
onGotPointerCaptureCapture?: EventListener<PointerEvent>;
|
|
73
|
+
onLostPointerCapture?: EventListener<PointerEvent>;
|
|
74
|
+
onLostPointerCaptureCapture?: EventListener<PointerEvent>;
|
|
75
|
+
onPointerCancel?: EventListener<PointerEvent>;
|
|
76
|
+
onPointerCancelCapture?: EventListener<PointerEvent>;
|
|
77
|
+
onPointerDown?: EventListener<PointerEvent>;
|
|
78
|
+
onPointerDownCapture?: EventListener<PointerEvent>;
|
|
79
|
+
onPointerEnter?: EventListener<PointerEvent>;
|
|
80
|
+
onPointerEnterCapture?: EventListener<PointerEvent>;
|
|
81
|
+
onPointerLeave?: EventListener<PointerEvent>;
|
|
82
|
+
onPointerLeaveCapture?: EventListener<PointerEvent>;
|
|
83
|
+
onPointerMove?: EventListener<PointerEvent>;
|
|
84
|
+
onPointerMoveCapture?: EventListener<PointerEvent>;
|
|
85
|
+
onPointerOut?: EventListener<PointerEvent>;
|
|
86
|
+
onPointerOutCapture?: EventListener<PointerEvent>;
|
|
87
|
+
onPointerOver?: EventListener<PointerEvent>;
|
|
88
|
+
onPointerOverCapture?: EventListener<PointerEvent>;
|
|
89
|
+
onPointerUp?: EventListener<PointerEvent>;
|
|
90
|
+
onPointerUpCapture?: EventListener<PointerEvent>;
|
|
91
|
+
onTouchCancel?: EventListener<TouchEvent>;
|
|
92
|
+
onTouchCancelCapture?: EventListener<TouchEvent>;
|
|
93
|
+
onTouchEnd?: EventListener<TouchEvent>;
|
|
94
|
+
onTouchEndCapture?: EventListener<TouchEvent>;
|
|
95
|
+
onTouchMove?: EventListener<TouchEvent>;
|
|
96
|
+
onTouchMoveCapture?: EventListener<TouchEvent>;
|
|
97
|
+
onTouchStart?: EventListener<TouchEvent>;
|
|
98
|
+
onTouchStartCapture?: EventListener<TouchEvent>;
|
|
99
|
+
onTransitionCancel?: EventListener<TransitionEvent>;
|
|
100
|
+
onTransitionCancelCapture?: EventListener<TransitionEvent>;
|
|
101
|
+
onTransitionEnd?: EventListener<TransitionEvent>;
|
|
102
|
+
onTransitionEndCapture?: EventListener<TransitionEvent>;
|
|
103
|
+
onTransitionRun?: EventListener<TransitionEvent>;
|
|
104
|
+
onTransitionRunCapture?: EventListener<TransitionEvent>;
|
|
105
|
+
onTransitionStart?: EventListener<TransitionEvent>;
|
|
106
|
+
onTransitionStartCapture?: EventListener<TransitionEvent>;
|
|
107
|
+
onFormData?: EventListener<FormDataEvent>;
|
|
108
|
+
onFormDataCapture?: EventListener<FormDataEvent>;
|
|
109
|
+
onReset?: EventListener<Event>;
|
|
110
|
+
onResetCapture?: EventListener<Event>;
|
|
111
|
+
onSubmit?: EventListener<Event>;
|
|
112
|
+
onSubmitCapture?: EventListener<Event>;
|
|
113
|
+
onInvalid?: EventListener<Event>;
|
|
114
|
+
onInvalidCapture?: EventListener<Event>;
|
|
115
|
+
onSelect?: EventListener<Event>;
|
|
116
|
+
onSelectCapture?: EventListener<Event>;
|
|
117
|
+
onSelectChange?: EventListener<Event>;
|
|
118
|
+
onSelectChangeCapture?: EventListener<Event>;
|
|
119
|
+
onInput?: EventListener<InputEvent>;
|
|
120
|
+
onInputCapture?: EventListener<InputEvent>;
|
|
121
|
+
onBeforeInput?: EventListener<InputEvent>;
|
|
122
|
+
onBeforeInputCapture?: EventListener<InputEvent>;
|
|
123
|
+
onChange?: EventListener<Event>;
|
|
124
|
+
onChangeCapture?: EventListener<Event>;
|
|
125
125
|
};
|
|
126
126
|
export type HtmlTags = Record<string, HtmlAttributes & EventAttributes>;
|
|
127
127
|
export type HtmlAttributes = Record<string, unknown>;
|