revojs 0.0.18 → 0.0.20
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 +5 -5
- package/dist/index.js +23 -15
- package/dist/jsx/index.d.ts +123 -122
- package/dist/jsx/index.js +3 -3
- package/dist/signals/index.d.ts +6 -6
- package/package.json +1 -1
package/dist/html/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HtmlAttributes } from "../jsx";
|
|
1
|
+
import { type EventListener, type HtmlAttributes } from "../jsx";
|
|
2
2
|
import { type Descriptor, Hooks, Scope, type State, type Value } from "../signals";
|
|
3
3
|
export type TypeOf<T> = {
|
|
4
4
|
(): T;
|
|
@@ -11,7 +11,7 @@ export type Template = {
|
|
|
11
11
|
children: Array<Slot>;
|
|
12
12
|
};
|
|
13
13
|
export type EventInput<T extends Events> = {
|
|
14
|
-
[K in keyof T]?:
|
|
14
|
+
[K in keyof T]?: EventListener<Infer<T[K]["type"]> extends Event ? Infer<T[K]["type"]> : CustomEvent<Infer<T[K]["type"]>>>;
|
|
15
15
|
};
|
|
16
16
|
export type AttributeInput<T extends Attributes> = {
|
|
17
17
|
[K in keyof T]?: Value<Infer<T[K]["type"]> | undefined>;
|
|
@@ -45,7 +45,7 @@ export interface ComponentOptions<TEvents extends Events, TAttributes extends At
|
|
|
45
45
|
export interface Component<TEvents extends Events, TAttributes extends Attributes> {
|
|
46
46
|
readonly scope: Scope;
|
|
47
47
|
readonly hooks: Hooks;
|
|
48
|
-
readonly context: Map<
|
|
48
|
+
readonly context: Map<string, unknown>;
|
|
49
49
|
readonly events: EventOutput<TEvents>;
|
|
50
50
|
readonly attributes: State<AttributeOutput<TAttributes>>;
|
|
51
51
|
readonly shadowRoot: false | ShadowRootInit;
|
|
@@ -59,7 +59,7 @@ export interface ComponentConstructor<TEvents extends Events, TAttributes extend
|
|
|
59
59
|
$name: string;
|
|
60
60
|
$events: TEvents;
|
|
61
61
|
$attributes: TAttributes;
|
|
62
|
-
new (input?: Input<TEvents, TAttributes>, context?: Map<
|
|
62
|
+
new (input?: Input<TEvents, TAttributes>, context?: Map<string, unknown>, host?: CustomElement<TEvents, TAttributes>): Component<TEvents, TAttributes>;
|
|
63
63
|
}
|
|
64
64
|
export interface CustomElement<TEvents extends Events, TAttributes extends Attributes> extends HTMLElement {
|
|
65
65
|
readonly component: Component<TEvents, TAttributes>;
|
|
@@ -71,7 +71,7 @@ export declare const isTemplate: (value: object) => value is Template;
|
|
|
71
71
|
export declare const createElement: <TEvents extends Events, TAttributes extends Attributes>(input: string | Template | ComponentConstructor<TEvents, TAttributes>, attributes?: AttributeInput<TAttributes>, ...children: Array<Slot>) => Slot;
|
|
72
72
|
export declare const toString: (slot: Slot) => string;
|
|
73
73
|
export declare const toFragment: (nodes: Array<Node>) => DocumentFragment;
|
|
74
|
-
export declare const renderToString: (slot: Slot, context: Map<
|
|
74
|
+
export declare const renderToString: (slot: Slot, context: Map<string, unknown>) => Promise<string>;
|
|
75
75
|
export declare const renderToNode: (scope: Scope, slot: Slot) => Promise<Node>;
|
|
76
76
|
export declare const defineComponent: <TEvents extends Events = {}, TAttributes extends Attributes = {}>(options: ComponentOptions<TEvents, TAttributes>) => ComponentConstructor<TEvents, TAttributes>;
|
|
77
77
|
export declare const toCustomElement: <TEvents extends Events = {}, TAttributes extends Attributes = {}>(component: ComponentConstructor<TEvents, TAttributes>) => CustomElementConstructor<TEvents, TAttributes>;
|
package/dist/index.js
CHANGED
|
@@ -112,16 +112,16 @@ var Hooks = class {
|
|
|
112
112
|
constructor() {
|
|
113
113
|
this.hooks = new Map();
|
|
114
114
|
}
|
|
115
|
-
on
|
|
115
|
+
on(scope, input, invoke) {
|
|
116
116
|
const invokes = this.hooks.get(input) ?? new Set();
|
|
117
117
|
invokes.add(invoke);
|
|
118
118
|
this.hooks.set(input, invokes);
|
|
119
119
|
return scope.dispose.push(() => invokes.delete(invoke));
|
|
120
|
-
}
|
|
121
|
-
dispatch
|
|
120
|
+
}
|
|
121
|
+
dispatch(input, value) {
|
|
122
122
|
const invokes = this.hooks.get(input);
|
|
123
123
|
if (invokes) for (const invoke of invokes) invoke(value);
|
|
124
|
-
}
|
|
124
|
+
}
|
|
125
125
|
};
|
|
126
126
|
var Scope = class {
|
|
127
127
|
dispose;
|
|
@@ -197,11 +197,11 @@ function fromValue(value) {
|
|
|
197
197
|
if (value instanceof Function) return fromValue(value());
|
|
198
198
|
return value;
|
|
199
199
|
}
|
|
200
|
-
function defineHook() {
|
|
201
|
-
return
|
|
200
|
+
function defineHook(key) {
|
|
201
|
+
return key;
|
|
202
202
|
}
|
|
203
|
-
function defineContext() {
|
|
204
|
-
return
|
|
203
|
+
function defineContext(key) {
|
|
204
|
+
return key;
|
|
205
205
|
}
|
|
206
206
|
let activeCompute;
|
|
207
207
|
const targets = new WeakMap();
|
|
@@ -321,12 +321,20 @@ const renderToNode = async (scope, slot) => {
|
|
|
321
321
|
const element = document.createElementNS(namespace(slot.tag), slot.tag);
|
|
322
322
|
for (const name in slot.attributes) {
|
|
323
323
|
const value = slot.attributes[name];
|
|
324
|
-
if (
|
|
324
|
+
if (name.startsWith("on")) {
|
|
325
325
|
const event = name.substring(2).toLowerCase();
|
|
326
326
|
const controller = new AbortController();
|
|
327
|
-
element.addEventListener(event,
|
|
327
|
+
element.addEventListener(event, (event$1) => {
|
|
328
|
+
const invoke = value;
|
|
329
|
+
if (Array.isArray(invoke)) for (const target of invoke) target?.(event$1);
|
|
330
|
+
else invoke?.(event$1);
|
|
331
|
+
}, { signal: controller.signal });
|
|
328
332
|
scope.dispose.push(() => controller.abort());
|
|
329
|
-
} else createCompute(scope, () =>
|
|
333
|
+
} else createCompute(scope, () => {
|
|
334
|
+
const set = toString(value);
|
|
335
|
+
if (set === "" || set === "false") return element.removeAttribute(name);
|
|
336
|
+
return element.setAttribute(name, set);
|
|
337
|
+
});
|
|
330
338
|
}
|
|
331
339
|
element.replaceChildren(await renderToNode(scope, slot.children));
|
|
332
340
|
return element;
|
|
@@ -384,7 +392,7 @@ const toCustomElement = (component) => {
|
|
|
384
392
|
this.component = new component(void 0, void 0, this);
|
|
385
393
|
}
|
|
386
394
|
async connectedCallback() {
|
|
387
|
-
const
|
|
395
|
+
const rootNode = this.component.shadowRoot ? this.attachShadow(this.component.shadowRoot) : this;
|
|
388
396
|
const parentNode = getCustomElement(this.parentNode);
|
|
389
397
|
for (const [name, event] of Object.entries(component.$events)) Reflect.set(this.component.events, name, (value) => {
|
|
390
398
|
if (value instanceof Event) return;
|
|
@@ -394,7 +402,7 @@ const toCustomElement = (component) => {
|
|
|
394
402
|
}));
|
|
395
403
|
}, this.component.events);
|
|
396
404
|
if (parentNode) for (const [name, value] of parentNode.component.context) this.component.context.set(name, value);
|
|
397
|
-
|
|
405
|
+
rootNode.replaceChildren(await renderToNode(this.component.scope, await this.component.setup()));
|
|
398
406
|
this.component.hooks.dispatch(MOUNTED_HOOK, this);
|
|
399
407
|
}
|
|
400
408
|
attributeChangedCallback(name, oldValue, value) {
|
|
@@ -454,7 +462,7 @@ const isServer = () => typeof window === "undefined";
|
|
|
454
462
|
const preventDefault = (event) => event.preventDefault();
|
|
455
463
|
const stopPropagation = (event) => event.stopPropagation();
|
|
456
464
|
const stopImmediatePropagation = (event) => event.stopImmediatePropagation();
|
|
457
|
-
const MOUNTED_HOOK = defineHook();
|
|
465
|
+
const MOUNTED_HOOK = defineHook("MOUNTED_HOOK");
|
|
458
466
|
const components = new Map();
|
|
459
467
|
|
|
460
468
|
//#endregion
|
|
@@ -740,7 +748,7 @@ const createRuntime = async () => {
|
|
|
740
748
|
}
|
|
741
749
|
};
|
|
742
750
|
};
|
|
743
|
-
const RUNTIME_CONTEXT = defineContext();
|
|
751
|
+
const RUNTIME_CONTEXT = defineContext("RUNTIME_CONTEXT");
|
|
744
752
|
|
|
745
753
|
//#endregion
|
|
746
754
|
//#region src/router/index.tsx
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -1,127 +1,128 @@
|
|
|
1
1
|
import { type Slot } from "../html";
|
|
2
|
+
export type EventListener<T extends Event> = ((event: T) => void) | Array<(event: T) => void>;
|
|
2
3
|
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?:
|
|
4
|
+
onScroll?: EventListener<Event>;
|
|
5
|
+
onScrollCapture?: EventListener<Event>;
|
|
6
|
+
onScrollEnd?: EventListener<Event>;
|
|
7
|
+
onScrollEndCapture?: EventListener<Event>;
|
|
8
|
+
onWheel?: EventListener<WheelEvent>;
|
|
9
|
+
onWheelCapture?: EventListener<WheelEvent>;
|
|
10
|
+
onAnimationCancel?: EventListener<AnimationEvent>;
|
|
11
|
+
onAnimationCancelCapture?: EventListener<AnimationEvent>;
|
|
12
|
+
onAnimationEnd?: EventListener<AnimationEvent>;
|
|
13
|
+
onAnimationEndCapture?: EventListener<AnimationEvent>;
|
|
14
|
+
onAnimationIteration?: EventListener<AnimationEvent>;
|
|
15
|
+
onAnimationIterationCapture?: EventListener<AnimationEvent>;
|
|
16
|
+
onAnimationStart?: EventListener<AnimationEvent>;
|
|
17
|
+
onAnimationStartCapture?: EventListener<AnimationEvent>;
|
|
18
|
+
onCopy?: EventListener<ClipboardEvent>;
|
|
19
|
+
onCopyCapture?: EventListener<ClipboardEvent>;
|
|
20
|
+
onCut?: EventListener<ClipboardEvent>;
|
|
21
|
+
onCutCapture?: EventListener<ClipboardEvent>;
|
|
22
|
+
onPaste?: EventListener<ClipboardEvent>;
|
|
23
|
+
onPasteCapture?: EventListener<ClipboardEvent>;
|
|
24
|
+
onCompositionEnd?: EventListener<CompositionEvent>;
|
|
25
|
+
onCompositionEndCapture?: EventListener<CompositionEvent>;
|
|
26
|
+
onCompositionStart?: EventListener<CompositionEvent>;
|
|
27
|
+
onCompositionStartCapture?: EventListener<CompositionEvent>;
|
|
28
|
+
onCompositionUpdate?: EventListener<CompositionEvent>;
|
|
29
|
+
onCompositionUpdateCapture?: EventListener<CompositionEvent>;
|
|
30
|
+
onBlur?: EventListener<FocusEvent>;
|
|
31
|
+
onBlurCapture?: EventListener<FocusEvent>;
|
|
32
|
+
onFocus?: EventListener<FocusEvent>;
|
|
33
|
+
onFocusCapture?: EventListener<FocusEvent>;
|
|
34
|
+
onFocusIn?: EventListener<FocusEvent>;
|
|
35
|
+
onFocusInCapture?: EventListener<FocusEvent>;
|
|
36
|
+
onFocusOut?: EventListener<FocusEvent>;
|
|
37
|
+
onFocusOutCapture?: EventListener<FocusEvent>;
|
|
38
|
+
onFullscreenChange?: EventListener<Event>;
|
|
39
|
+
onFullscreenChangeCapture?: EventListener<Event>;
|
|
40
|
+
onFullscreenError?: EventListener<Event>;
|
|
41
|
+
onFullscreenErrorCapture?: EventListener<Event>;
|
|
42
|
+
onKeyDown?: EventListener<KeyboardEvent>;
|
|
43
|
+
onKeyDownCapture?: EventListener<KeyboardEvent>;
|
|
44
|
+
onKeyPress?: EventListener<KeyboardEvent>;
|
|
45
|
+
onKeyPressCapture?: EventListener<KeyboardEvent>;
|
|
46
|
+
onKeyUp?: EventListener<KeyboardEvent>;
|
|
47
|
+
onKeyUpCapture?: EventListener<KeyboardEvent>;
|
|
48
|
+
onAuxClick?: EventListener<MouseEvent>;
|
|
49
|
+
onAuxClickCapture?: EventListener<MouseEvent>;
|
|
50
|
+
onClick?: EventListener<MouseEvent>;
|
|
51
|
+
onClickCapture?: EventListener<MouseEvent>;
|
|
52
|
+
onContextMenu?: EventListener<MouseEvent>;
|
|
53
|
+
onContextMenuCapture?: EventListener<MouseEvent>;
|
|
54
|
+
onDoubleClick?: EventListener<MouseEvent>;
|
|
55
|
+
onDoubleClickCapture?: EventListener<MouseEvent>;
|
|
56
|
+
onMouseDown?: EventListener<MouseEvent>;
|
|
57
|
+
onMouseDownCapture?: EventListener<MouseEvent>;
|
|
58
|
+
onMouseEnter?: EventListener<MouseEvent>;
|
|
59
|
+
onMouseEnterCapture?: EventListener<MouseEvent>;
|
|
60
|
+
onMouseLeave?: EventListener<MouseEvent>;
|
|
61
|
+
onMouseLeaveCapture?: EventListener<MouseEvent>;
|
|
62
|
+
onMouseMove?: EventListener<MouseEvent>;
|
|
63
|
+
onMouseMoveCapture?: EventListener<MouseEvent>;
|
|
64
|
+
onMouseOut?: EventListener<MouseEvent>;
|
|
65
|
+
onMouseOutCapture?: EventListener<MouseEvent>;
|
|
66
|
+
onMouseOver?: EventListener<MouseEvent>;
|
|
67
|
+
onMouseOverCapture?: EventListener<MouseEvent>;
|
|
68
|
+
onMouseUp?: EventListener<MouseEvent>;
|
|
69
|
+
onMouseUpCapture?: EventListener<MouseEvent>;
|
|
70
|
+
onMouseWheel?: EventListener<WheelEvent>;
|
|
71
|
+
onMouseWheelCapture?: EventListener<WheelEvent>;
|
|
72
|
+
onGotPointerCapture?: EventListener<PointerEvent>;
|
|
73
|
+
onGotPointerCaptureCapture?: EventListener<PointerEvent>;
|
|
74
|
+
onLostPointerCapture?: EventListener<PointerEvent>;
|
|
75
|
+
onLostPointerCaptureCapture?: EventListener<PointerEvent>;
|
|
76
|
+
onPointerCancel?: EventListener<PointerEvent>;
|
|
77
|
+
onPointerCancelCapture?: EventListener<PointerEvent>;
|
|
78
|
+
onPointerDown?: EventListener<PointerEvent>;
|
|
79
|
+
onPointerDownCapture?: EventListener<PointerEvent>;
|
|
80
|
+
onPointerEnter?: EventListener<PointerEvent>;
|
|
81
|
+
onPointerEnterCapture?: EventListener<PointerEvent>;
|
|
82
|
+
onPointerLeave?: EventListener<PointerEvent>;
|
|
83
|
+
onPointerLeaveCapture?: EventListener<PointerEvent>;
|
|
84
|
+
onPointerMove?: EventListener<PointerEvent>;
|
|
85
|
+
onPointerMoveCapture?: EventListener<PointerEvent>;
|
|
86
|
+
onPointerOut?: EventListener<PointerEvent>;
|
|
87
|
+
onPointerOutCapture?: EventListener<PointerEvent>;
|
|
88
|
+
onPointerOver?: EventListener<PointerEvent>;
|
|
89
|
+
onPointerOverCapture?: EventListener<PointerEvent>;
|
|
90
|
+
onPointerUp?: EventListener<PointerEvent>;
|
|
91
|
+
onPointerUpCapture?: EventListener<PointerEvent>;
|
|
92
|
+
onTouchCancel?: EventListener<TouchEvent>;
|
|
93
|
+
onTouchCancelCapture?: EventListener<TouchEvent>;
|
|
94
|
+
onTouchEnd?: EventListener<TouchEvent>;
|
|
95
|
+
onTouchEndCapture?: EventListener<TouchEvent>;
|
|
96
|
+
onTouchMove?: EventListener<TouchEvent>;
|
|
97
|
+
onTouchMoveCapture?: EventListener<TouchEvent>;
|
|
98
|
+
onTouchStart?: EventListener<TouchEvent>;
|
|
99
|
+
onTouchStartCapture?: EventListener<TouchEvent>;
|
|
100
|
+
onTransitionCancel?: EventListener<TransitionEvent>;
|
|
101
|
+
onTransitionCancelCapture?: EventListener<TransitionEvent>;
|
|
102
|
+
onTransitionEnd?: EventListener<TransitionEvent>;
|
|
103
|
+
onTransitionEndCapture?: EventListener<TransitionEvent>;
|
|
104
|
+
onTransitionRun?: EventListener<TransitionEvent>;
|
|
105
|
+
onTransitionRunCapture?: EventListener<TransitionEvent>;
|
|
106
|
+
onTransitionStart?: EventListener<TransitionEvent>;
|
|
107
|
+
onTransitionStartCapture?: EventListener<TransitionEvent>;
|
|
108
|
+
onFormData?: EventListener<FormDataEvent>;
|
|
109
|
+
onFormDataCapture?: EventListener<FormDataEvent>;
|
|
110
|
+
onReset?: EventListener<Event>;
|
|
111
|
+
onResetCapture?: EventListener<Event>;
|
|
112
|
+
onSubmit?: EventListener<Event>;
|
|
113
|
+
onSubmitCapture?: EventListener<Event>;
|
|
114
|
+
onInvalid?: EventListener<Event>;
|
|
115
|
+
onInvalidCapture?: EventListener<Event>;
|
|
116
|
+
onSelect?: EventListener<Event>;
|
|
117
|
+
onSelectCapture?: EventListener<Event>;
|
|
118
|
+
onSelectChange?: EventListener<Event>;
|
|
119
|
+
onSelectChangeCapture?: EventListener<Event>;
|
|
120
|
+
onInput?: EventListener<InputEvent>;
|
|
121
|
+
onInputCapture?: EventListener<InputEvent>;
|
|
122
|
+
onBeforeInput?: EventListener<InputEvent>;
|
|
123
|
+
onBeforeInputCapture?: EventListener<InputEvent>;
|
|
124
|
+
onChange?: EventListener<Event>;
|
|
125
|
+
onChangeCapture?: EventListener<Event>;
|
|
125
126
|
};
|
|
126
127
|
export type HtmlTags = Record<string, HtmlAttributes & EventAttributes>;
|
|
127
128
|
export type HtmlAttributes = Record<string, unknown>;
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/signals/index.ts
|
|
3
|
-
function defineHook() {
|
|
4
|
-
return
|
|
3
|
+
function defineHook(key) {
|
|
4
|
+
return key;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
@@ -14,7 +14,7 @@ const createElement = (input, attributes, ...children) => {
|
|
|
14
14
|
children
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
const MOUNTED_HOOK = defineHook();
|
|
17
|
+
const MOUNTED_HOOK = defineHook("MOUNTED_HOOK");
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/jsx/index.ts
|
package/dist/signals/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
declare const descriptor: unique symbol;
|
|
2
2
|
export type Value<T> = T | (() => Value<T>);
|
|
3
|
-
export type Descriptor<T> =
|
|
3
|
+
export type Descriptor<T> = string & {
|
|
4
4
|
[descriptor]: T;
|
|
5
5
|
};
|
|
6
6
|
export interface State<T> {
|
|
7
7
|
value: T;
|
|
8
8
|
}
|
|
9
9
|
export declare class Hooks {
|
|
10
|
-
readonly hooks: Map<
|
|
10
|
+
readonly hooks: Map<string, Set<(value: any) => unknown>>;
|
|
11
11
|
constructor();
|
|
12
|
-
on
|
|
13
|
-
dispatch
|
|
12
|
+
on<T>(scope: Scope, input: Descriptor<T>, invoke: (value: T) => unknown): number;
|
|
13
|
+
dispatch<T>(input: Descriptor<T>, value: T): void;
|
|
14
14
|
}
|
|
15
15
|
export declare class Scope {
|
|
16
16
|
readonly dispose: Array<(scope: Scope) => void>;
|
|
@@ -32,8 +32,8 @@ export declare function createState<T>(value: T): State<T>;
|
|
|
32
32
|
export declare function createCompute<T>(scope: Scope, invoke: (scope: Scope) => T): T;
|
|
33
33
|
export declare function createMemo<T>(scope: Scope, invoke: () => T): State<T>;
|
|
34
34
|
export declare function fromValue<T>(value: Value<T>): T;
|
|
35
|
-
export declare function defineHook<T>(): Descriptor<T>;
|
|
36
|
-
export declare function defineContext<T>(): Descriptor<T>;
|
|
35
|
+
export declare function defineHook<T>(key: string): Descriptor<T>;
|
|
36
|
+
export declare function defineContext<T>(key: string): Descriptor<T>;
|
|
37
37
|
export declare let activeCompute: Compute | undefined;
|
|
38
38
|
export declare const targets: WeakMap<object, Map<string | symbol, Set<Compute<void>>>>;
|
|
39
39
|
export {};
|