@ryupold/vode 1.6.7 → 1.6.8
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/package.json +1 -1
- package/src/vode.ts +11 -9
package/package.json
CHANGED
package/src/vode.ts
CHANGED
|
@@ -27,11 +27,11 @@ export type Effect<S> =
|
|
|
27
27
|
|
|
28
28
|
export type EventFunction<S> = (state: S, evt: Event) => Patch<S>;
|
|
29
29
|
|
|
30
|
-
export
|
|
30
|
+
export interface Props<S> extends Partial<
|
|
31
31
|
Omit<HTMLElement,
|
|
32
32
|
keyof (DocumentFragment & ElementCSSInlineStyle & GlobalEventHandlers)> &
|
|
33
33
|
{ [K in keyof EventsMap]: EventFunction<S> | Patch<S> } // all on* events
|
|
34
|
-
>
|
|
34
|
+
> {
|
|
35
35
|
[_: string]: unknown,
|
|
36
36
|
xmlns?: string | null,
|
|
37
37
|
class?: ClassProp,
|
|
@@ -60,11 +60,12 @@ export type StyleProp =
|
|
|
60
60
|
| string
|
|
61
61
|
| "" | null | undefined; // no style
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
type EventsMapBase =
|
|
64
|
+
& { [K in keyof HTMLElementEventMap as `on${K}`]: HTMLElementEventMap[K] }
|
|
65
|
+
& { [K in keyof WindowEventMap as `on${K}`]: WindowEventMap[K] }
|
|
66
|
+
& { [K in keyof SVGElementEventMap as `on${K}`]: SVGElementEventMap[K] };
|
|
67
|
+
|
|
68
|
+
export interface EventsMap extends EventsMapBase {}
|
|
68
69
|
|
|
69
70
|
export type PropertyValue<S> =
|
|
70
71
|
| string | boolean | null | undefined | void
|
|
@@ -72,7 +73,8 @@ export type PropertyValue<S> =
|
|
|
72
73
|
| Patch<S>;
|
|
73
74
|
|
|
74
75
|
export type Dispatch<S> = (action: Patch<S>) => void;
|
|
75
|
-
export
|
|
76
|
+
export interface Patchable<S = object> { patch: Dispatch<S>; }
|
|
77
|
+
export type PatchableState<S = object> = S & Patchable<S>;
|
|
76
78
|
|
|
77
79
|
export const globals = {
|
|
78
80
|
currentViewTransition: <ViewTransition | null | undefined>undefined,
|
|
@@ -80,7 +82,7 @@ export const globals = {
|
|
|
80
82
|
startViewTransition: !!document.startViewTransition ? document.startViewTransition.bind(document) : null,
|
|
81
83
|
};
|
|
82
84
|
|
|
83
|
-
export
|
|
85
|
+
export interface ContainerNode<S = PatchableState> extends HTMLElement {
|
|
84
86
|
/** the `_vode` property is added to the container in `app()`.
|
|
85
87
|
* it contains all necessary stuff for the vode app to function.
|
|
86
88
|
* remove the container node to clear vodes resources */
|