@pixui-dev/pxw 0.1.19 → 0.1.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.
@@ -0,0 +1,85 @@
1
+ import * as preact from 'preact';
2
+
3
+ export function route(url: string, replace?: boolean): boolean;
4
+ export function route(options: { url: string; replace?: boolean }): boolean;
5
+
6
+ export function getCurrentUrl(): string;
7
+
8
+ export interface Location {
9
+ pathname: string;
10
+ search: string;
11
+ }
12
+
13
+ export interface CustomHistory {
14
+ listen(callback: (location: Location) => void): () => void;
15
+ location: Location;
16
+ push(path: string): void;
17
+ replace(path: string): void;
18
+ }
19
+
20
+ export interface RoutableProps {
21
+ path?: string;
22
+ default?: boolean;
23
+ }
24
+
25
+ export interface RouterOnChangeArgs {
26
+ router: Router;
27
+ url: string;
28
+ previous?: string;
29
+ active: preact.VNode[];
30
+ current: preact.VNode;
31
+ }
32
+
33
+ export interface RouterProps extends RoutableProps {
34
+ history?: CustomHistory;
35
+ static?: boolean;
36
+ url?: string;
37
+ onChange?: (args: RouterOnChangeArgs) => void;
38
+ }
39
+
40
+ export class Router extends preact.Component<RouterProps, {}> {
41
+ canRoute(url: string): boolean;
42
+ getMatchingChildren(
43
+ children: preact.VNode[],
44
+ url: string,
45
+ invoke: boolean
46
+ ): preact.VNode[];
47
+ routeTo(url: string): boolean;
48
+ render(props: RouterProps, {}): preact.VNode;
49
+ }
50
+
51
+ export const subscribers: Array<(url: string) => void>
52
+
53
+ type AnyComponent<Props> =
54
+ | preact.FunctionalComponent<Props>
55
+ | preact.ComponentConstructor<Props, any>;
56
+
57
+ export interface RouteProps<Props> extends RoutableProps {
58
+ component: AnyComponent<Props>;
59
+ }
60
+
61
+ export function Route<Props>(
62
+ props: RouteProps<Props> & Partial<Props>
63
+ ): preact.VNode;
64
+
65
+ export function Link(props: {activeClassName?: string} & preact.JSX.HTMLAttributes): preact.VNode;
66
+
67
+ export class Match extends preact.Component<RoutableProps, {}> {
68
+ render(): preact.VNode;
69
+ }
70
+
71
+ export interface LinkProps extends preact.JSX.HTMLAttributes {
72
+ activeClassName?: string;
73
+ children?: preact.ComponentChildren;
74
+ }
75
+
76
+ export function Link(props: LinkProps): preact.VNode;
77
+
78
+ declare module 'preact' {
79
+ export interface Attributes extends RoutableProps {}
80
+ }
81
+
82
+ export{
83
+ Router,
84
+ Match
85
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixui-dev/pxw",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "private": false,
5
5
  "directories": {
6
6
  "lib": "lib"
File without changes
File without changes
File without changes