@devwareng/vanilla-ts 1.0.5 → 1.0.7
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/index.d.cts +72 -1
- package/dist/index.d.ts +72 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,75 @@
|
|
|
1
1
|
import { Config } from 'dompurify';
|
|
2
|
+
import * as zustand_vanilla from 'zustand/vanilla';
|
|
3
|
+
import debounce from 'lodash';
|
|
4
|
+
|
|
5
|
+
declare function html(strings: TemplateStringsArray, ...values: any[]): string;
|
|
6
|
+
|
|
7
|
+
type TSPurifier$1 = (input: string | HTMLElement, config?: Config) => string;
|
|
8
|
+
declare const useTSPurifier: TSPurifier$1;
|
|
9
|
+
|
|
10
|
+
type TSEvent$1 = (id: string, eventType: keyof HTMLElementEventMap, handler: (event: HTMLElementEventMap[keyof HTMLElementEventMap]) => void) => void;
|
|
11
|
+
declare const useTSEvent: TSEvent$1;
|
|
12
|
+
|
|
13
|
+
type MustURL$1 = `/${string}`;
|
|
14
|
+
declare function useTSExtractParams(pattern: MustURL$1): {
|
|
15
|
+
[x: string]: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ParamStore = {
|
|
19
|
+
params: Record<string, string>;
|
|
20
|
+
query: Record<string, string>;
|
|
21
|
+
setFromPattern: (pattern: MustURL) => void;
|
|
22
|
+
getParam: (key: string) => string | undefined;
|
|
23
|
+
getQuery: (key: string) => string | undefined;
|
|
24
|
+
};
|
|
25
|
+
type MustURL = `/${string}`;
|
|
26
|
+
declare const useTSParams: zustand_vanilla.StoreApi<ParamStore>;
|
|
27
|
+
|
|
28
|
+
declare const useTSEventAll: <T extends Event>(selector: string, eventType: keyof HTMLElementEventMap, handler: (event: T) => void) => () => void;
|
|
29
|
+
|
|
30
|
+
type TSElements = (htmlElement: HTMLElement, element: string, config?: Config) => void;
|
|
31
|
+
declare const useTSElements: TSElements;
|
|
32
|
+
|
|
33
|
+
type TSInitialDOM$1 = (id: string, mount: (el: HTMLElement) => void) => void;
|
|
34
|
+
declare const useInitialDOM: TSInitialDOM$1;
|
|
35
|
+
|
|
36
|
+
type AnchorSingle$1 = (element: HTMLElement, href: string, ariaLabel: string, className?: string, childElement?: HTMLElement | null) => void;
|
|
37
|
+
declare const useAnchorSingle: AnchorSingle$1;
|
|
38
|
+
|
|
39
|
+
declare const useAnchor: debounce.Function<(anchors: NodeListOf<HTMLAnchorElement>) => void> | (() => void);
|
|
40
|
+
|
|
41
|
+
type TSComponent$1 = (id: string, DOM: HTMLElement, element: Function, params?: any, params2?: any) => void;
|
|
42
|
+
declare const useTSComponent: TSComponent$1;
|
|
43
|
+
|
|
44
|
+
type TSSelect$1 = <T extends Element = HTMLElement>(selector: string) => T | null;
|
|
45
|
+
declare const useTSSelect: TSSelect$1;
|
|
46
|
+
|
|
47
|
+
declare const useTSAuth: (_Component: HTMLElement | void, loginUrl: string) => null;
|
|
48
|
+
|
|
49
|
+
type TSElementEach$1 = (elements: NodeListOf<HTMLElement> | HTMLElement[], events: (keyof HTMLElementEventMap)[], callback: (element: HTMLElement, event: Event) => void) => void;
|
|
50
|
+
declare const useTSElementEach: TSElementEach$1;
|
|
51
|
+
|
|
52
|
+
type RouteCallback = (errorElement?: HTMLElement, params?: Record<string, string>, query?: Record<string, string>) => void;
|
|
53
|
+
interface RouteConfig {
|
|
54
|
+
path: string;
|
|
55
|
+
routeto?: string;
|
|
56
|
+
element: RouteCallback;
|
|
57
|
+
errorElement?: RouteCallback;
|
|
58
|
+
children?: RouteConfig[];
|
|
59
|
+
params?: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
declare class TSRouter {
|
|
62
|
+
private routes;
|
|
63
|
+
private expectedParams;
|
|
64
|
+
constructor(routes: RouteConfig[], expectedParams: string[]);
|
|
65
|
+
private handlePopState;
|
|
66
|
+
private renderChildren;
|
|
67
|
+
private parseQueryParams;
|
|
68
|
+
private findMatchingRoute;
|
|
69
|
+
private filterAndSanitizeParams;
|
|
70
|
+
navigate(path: string): void;
|
|
71
|
+
addRoute(route: RouteConfig): void;
|
|
72
|
+
}
|
|
2
73
|
|
|
3
74
|
// --- Core Types ---
|
|
4
75
|
|
|
@@ -113,4 +184,4 @@ type TSElementEach = (
|
|
|
113
184
|
callback: (element: HTMLElement, event: Event) => void
|
|
114
185
|
) => void;
|
|
115
186
|
|
|
116
|
-
export type
|
|
187
|
+
export { type AnchorSingle, type CSPConfig, type FetchFunction, type FetchResult, type InputElementType, type SEOConfig, type SEOHandler, type SanitizeInput, type TSAuth, type TSCollection, type TSComponent, type TSElementEach, type TSEvent, type TSInitialDOM, type TSInput, type TSPurifier, TSRouter, type TSSelect, type TSURLState, type TSVerify, html, useAnchor, useAnchorSingle, useInitialDOM, useTSAuth, useTSComponent, useTSElementEach, useTSElements, useTSEvent, useTSEventAll, useTSExtractParams, useTSParams, useTSPurifier, useTSSelect };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,75 @@
|
|
|
1
1
|
import { Config } from 'dompurify';
|
|
2
|
+
import * as zustand_vanilla from 'zustand/vanilla';
|
|
3
|
+
import debounce from 'lodash';
|
|
4
|
+
|
|
5
|
+
declare function html(strings: TemplateStringsArray, ...values: any[]): string;
|
|
6
|
+
|
|
7
|
+
type TSPurifier$1 = (input: string | HTMLElement, config?: Config) => string;
|
|
8
|
+
declare const useTSPurifier: TSPurifier$1;
|
|
9
|
+
|
|
10
|
+
type TSEvent$1 = (id: string, eventType: keyof HTMLElementEventMap, handler: (event: HTMLElementEventMap[keyof HTMLElementEventMap]) => void) => void;
|
|
11
|
+
declare const useTSEvent: TSEvent$1;
|
|
12
|
+
|
|
13
|
+
type MustURL$1 = `/${string}`;
|
|
14
|
+
declare function useTSExtractParams(pattern: MustURL$1): {
|
|
15
|
+
[x: string]: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ParamStore = {
|
|
19
|
+
params: Record<string, string>;
|
|
20
|
+
query: Record<string, string>;
|
|
21
|
+
setFromPattern: (pattern: MustURL) => void;
|
|
22
|
+
getParam: (key: string) => string | undefined;
|
|
23
|
+
getQuery: (key: string) => string | undefined;
|
|
24
|
+
};
|
|
25
|
+
type MustURL = `/${string}`;
|
|
26
|
+
declare const useTSParams: zustand_vanilla.StoreApi<ParamStore>;
|
|
27
|
+
|
|
28
|
+
declare const useTSEventAll: <T extends Event>(selector: string, eventType: keyof HTMLElementEventMap, handler: (event: T) => void) => () => void;
|
|
29
|
+
|
|
30
|
+
type TSElements = (htmlElement: HTMLElement, element: string, config?: Config) => void;
|
|
31
|
+
declare const useTSElements: TSElements;
|
|
32
|
+
|
|
33
|
+
type TSInitialDOM$1 = (id: string, mount: (el: HTMLElement) => void) => void;
|
|
34
|
+
declare const useInitialDOM: TSInitialDOM$1;
|
|
35
|
+
|
|
36
|
+
type AnchorSingle$1 = (element: HTMLElement, href: string, ariaLabel: string, className?: string, childElement?: HTMLElement | null) => void;
|
|
37
|
+
declare const useAnchorSingle: AnchorSingle$1;
|
|
38
|
+
|
|
39
|
+
declare const useAnchor: debounce.Function<(anchors: NodeListOf<HTMLAnchorElement>) => void> | (() => void);
|
|
40
|
+
|
|
41
|
+
type TSComponent$1 = (id: string, DOM: HTMLElement, element: Function, params?: any, params2?: any) => void;
|
|
42
|
+
declare const useTSComponent: TSComponent$1;
|
|
43
|
+
|
|
44
|
+
type TSSelect$1 = <T extends Element = HTMLElement>(selector: string) => T | null;
|
|
45
|
+
declare const useTSSelect: TSSelect$1;
|
|
46
|
+
|
|
47
|
+
declare const useTSAuth: (_Component: HTMLElement | void, loginUrl: string) => null;
|
|
48
|
+
|
|
49
|
+
type TSElementEach$1 = (elements: NodeListOf<HTMLElement> | HTMLElement[], events: (keyof HTMLElementEventMap)[], callback: (element: HTMLElement, event: Event) => void) => void;
|
|
50
|
+
declare const useTSElementEach: TSElementEach$1;
|
|
51
|
+
|
|
52
|
+
type RouteCallback = (errorElement?: HTMLElement, params?: Record<string, string>, query?: Record<string, string>) => void;
|
|
53
|
+
interface RouteConfig {
|
|
54
|
+
path: string;
|
|
55
|
+
routeto?: string;
|
|
56
|
+
element: RouteCallback;
|
|
57
|
+
errorElement?: RouteCallback;
|
|
58
|
+
children?: RouteConfig[];
|
|
59
|
+
params?: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
declare class TSRouter {
|
|
62
|
+
private routes;
|
|
63
|
+
private expectedParams;
|
|
64
|
+
constructor(routes: RouteConfig[], expectedParams: string[]);
|
|
65
|
+
private handlePopState;
|
|
66
|
+
private renderChildren;
|
|
67
|
+
private parseQueryParams;
|
|
68
|
+
private findMatchingRoute;
|
|
69
|
+
private filterAndSanitizeParams;
|
|
70
|
+
navigate(path: string): void;
|
|
71
|
+
addRoute(route: RouteConfig): void;
|
|
72
|
+
}
|
|
2
73
|
|
|
3
74
|
// --- Core Types ---
|
|
4
75
|
|
|
@@ -113,4 +184,4 @@ type TSElementEach = (
|
|
|
113
184
|
callback: (element: HTMLElement, event: Event) => void
|
|
114
185
|
) => void;
|
|
115
186
|
|
|
116
|
-
export type
|
|
187
|
+
export { type AnchorSingle, type CSPConfig, type FetchFunction, type FetchResult, type InputElementType, type SEOConfig, type SEOHandler, type SanitizeInput, type TSAuth, type TSCollection, type TSComponent, type TSElementEach, type TSEvent, type TSInitialDOM, type TSInput, type TSPurifier, TSRouter, type TSSelect, type TSURLState, type TSVerify, html, useAnchor, useAnchorSingle, useInitialDOM, useTSAuth, useTSComponent, useTSElementEach, useTSElements, useTSEvent, useTSEventAll, useTSExtractParams, useTSParams, useTSPurifier, useTSSelect };
|