godown 2.1.1 → 2.2.0
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/README.md +43 -35
- package/lib/route-tree.d.ts +28 -0
- package/lib/route-tree.d.ts.map +1 -0
- package/lib/route-tree.js +141 -0
- package/lib/route-tree.js.map +1 -0
- package/package.json +2 -1
- package/view/route-view.d.ts +29 -15
- package/view/route-view.d.ts.map +1 -1
- package/view/route-view.js +83 -146
- package/view/route-view.js.map +1 -1
package/README.md
CHANGED
@@ -1,35 +1,43 @@
|
|
1
|
-
# Godown
|
2
|
-
|
3
|
-
The **simple,
|
4
|
-
|
5
|
-
## Install
|
6
|
-
|
7
|
-
```sh
|
8
|
-
npm i godown
|
9
|
-
```
|
10
|
-
|
11
|
-
##
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
```html
|
16
|
-
<alert-item title="Alert"></alert-item>
|
17
|
-
```
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
```js
|
22
|
-
import { AlertItem } from "godown";
|
23
|
-
|
24
|
-
item
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
1
|
+
# Godown
|
2
|
+
|
3
|
+
The **simple, stylized, semantic components** for standard HTML and other frameworks.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
```sh
|
8
|
+
npm i godown
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usages
|
12
|
+
|
13
|
+
### HTML
|
14
|
+
|
15
|
+
```html
|
16
|
+
<alert-item title="Alert"></alert-item>
|
17
|
+
```
|
18
|
+
|
19
|
+
### JS
|
20
|
+
|
21
|
+
```js
|
22
|
+
import { AlertItem } from "godown";
|
23
|
+
|
24
|
+
const item = new AlertItem();
|
25
|
+
item.title = "Alert";
|
26
|
+
document.body.appendChild(item);
|
27
|
+
```
|
28
|
+
|
29
|
+
deno
|
30
|
+
|
31
|
+
```ts
|
32
|
+
import { AlertItem } from "npm:godown";
|
33
|
+
```
|
34
|
+
|
35
|
+
### React
|
36
|
+
|
37
|
+
```jsx
|
38
|
+
import { AlertItem } from "godown/react";
|
39
|
+
|
40
|
+
export default function () {
|
41
|
+
return <AlertItem title="Alert" />;
|
42
|
+
}
|
43
|
+
```
|
@@ -0,0 +1,28 @@
|
|
1
|
+
export declare class RouteTree {
|
2
|
+
pattern: string;
|
3
|
+
part: string;
|
4
|
+
children: RouteTree[];
|
5
|
+
isWild: boolean;
|
6
|
+
insert(pattern: string, parts?: string[] | undefined, height?: number): void;
|
7
|
+
search(parts: string[], height?: number): RouteTree | null;
|
8
|
+
matchChild(part: string): RouteTree | null;
|
9
|
+
matchChildren(part: string): RouteTree[];
|
10
|
+
static split(s: string): string[];
|
11
|
+
/**
|
12
|
+
*
|
13
|
+
* @param s Pattern, may contains dynamic matching parameters
|
14
|
+
* @returns {object} key, carry, multi
|
15
|
+
* @property {string} key - Dynamic key
|
16
|
+
* @property {number} carry - The length of the modifier symbol for the dynamic prefix
|
17
|
+
* @property {boolean} multi - Ignore after
|
18
|
+
*/
|
19
|
+
static dynamic(s: string): {
|
20
|
+
key: string;
|
21
|
+
carry: number;
|
22
|
+
multi: boolean;
|
23
|
+
};
|
24
|
+
useWhich(s: string): string | null;
|
25
|
+
parseParams(s: string, pattern: string): Record<string, string>;
|
26
|
+
}
|
27
|
+
export default RouteTree;
|
28
|
+
//# sourceMappingURL=route-tree.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"route-tree.d.ts","sourceRoot":"","sources":["../../src/lib/route-tree.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS;IACpB,OAAO,SAAM;IACb,IAAI,SAAM;IACV,QAAQ,EAAE,SAAS,EAAE,CAAM;IAC3B,MAAM,UAAS;IAEf,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,EAAE,GAAG,SAAqB,EAAE,MAAM,SAAI,GAAG,IAAI;IAoBlF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,SAAI,GAAG,SAAS,GAAG,IAAI;IAkBrD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAS1C,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE;IAUxC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;IAIjC;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG;QACzB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,OAAO,CAAC;KAChB;IA4CD,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IASlC,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAgBhE;AACD,eAAe,SAAS,CAAC"}
|
@@ -0,0 +1,141 @@
|
|
1
|
+
export class RouteTree {
|
2
|
+
constructor() {
|
3
|
+
this.pattern = "";
|
4
|
+
this.part = "";
|
5
|
+
this.children = [];
|
6
|
+
this.isWild = false;
|
7
|
+
}
|
8
|
+
insert(pattern, parts = undefined, height = 0) {
|
9
|
+
if (!parts) {
|
10
|
+
parts = RouteTree.split(pattern);
|
11
|
+
}
|
12
|
+
if (parts.length === height) {
|
13
|
+
this.pattern = pattern;
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
const part = parts[height];
|
17
|
+
let child = this.matchChild(part);
|
18
|
+
if (child === null) {
|
19
|
+
child = new RouteTree();
|
20
|
+
child.part = part;
|
21
|
+
const { carry } = RouteTree.dynamic(part);
|
22
|
+
child.isWild = Boolean(carry);
|
23
|
+
this.children.push(child);
|
24
|
+
}
|
25
|
+
child.insert(pattern, parts, height + 1);
|
26
|
+
}
|
27
|
+
search(parts, height = 0) {
|
28
|
+
if (parts.length === height || this.part.startsWith("*")) {
|
29
|
+
if (this.pattern === "") {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
return this;
|
33
|
+
}
|
34
|
+
const part = parts[height];
|
35
|
+
const children = this.matchChildren(part);
|
36
|
+
for (const child of children) {
|
37
|
+
const result = child.search(parts, height + 1);
|
38
|
+
if (result !== null) {
|
39
|
+
return result;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
return null;
|
43
|
+
}
|
44
|
+
matchChild(part) {
|
45
|
+
for (const child of this.children) {
|
46
|
+
if (child.part === part || child.isWild) {
|
47
|
+
return child;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
return null;
|
51
|
+
}
|
52
|
+
matchChildren(part) {
|
53
|
+
const nodes = [];
|
54
|
+
for (const child of this.children) {
|
55
|
+
if (child.part === part || child.isWild) {
|
56
|
+
nodes.push(child);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
return nodes;
|
60
|
+
}
|
61
|
+
static split(s) {
|
62
|
+
return s.split("/").filter((a) => a);
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
*
|
66
|
+
* @param s Pattern, may contains dynamic matching parameters
|
67
|
+
* @returns {object} key, carry, multi
|
68
|
+
* @property {string} key - Dynamic key
|
69
|
+
* @property {number} carry - The length of the modifier symbol for the dynamic prefix
|
70
|
+
* @property {boolean} multi - Ignore after
|
71
|
+
*/
|
72
|
+
static dynamic(s) {
|
73
|
+
if (s[0] === "{" && s[s.length - 1] === "}") {
|
74
|
+
s = s.substring(1, s.length - 1);
|
75
|
+
if (s[0] !== ":" && s[0] !== "*" && s[0] !== ".") {
|
76
|
+
return {
|
77
|
+
key: s,
|
78
|
+
carry: 0,
|
79
|
+
multi: false,
|
80
|
+
};
|
81
|
+
}
|
82
|
+
}
|
83
|
+
if (s[0] === "[" && s[s.length - 1] === "]") {
|
84
|
+
s = s.substring(1, s.length - 1);
|
85
|
+
}
|
86
|
+
const s1 = s.substring(0, 1);
|
87
|
+
if (s1 === ":") {
|
88
|
+
return {
|
89
|
+
key: s,
|
90
|
+
carry: 1,
|
91
|
+
multi: false,
|
92
|
+
};
|
93
|
+
}
|
94
|
+
if (s1 === "*") {
|
95
|
+
return {
|
96
|
+
key: s,
|
97
|
+
carry: 1,
|
98
|
+
multi: true,
|
99
|
+
};
|
100
|
+
}
|
101
|
+
const s3 = s.substring(0, 3);
|
102
|
+
if (s3 === "...") {
|
103
|
+
return {
|
104
|
+
key: s,
|
105
|
+
carry: 3,
|
106
|
+
multi: true,
|
107
|
+
};
|
108
|
+
}
|
109
|
+
return {
|
110
|
+
key: "",
|
111
|
+
carry: 0,
|
112
|
+
multi: false,
|
113
|
+
};
|
114
|
+
}
|
115
|
+
useWhich(s) {
|
116
|
+
const sp = RouteTree.split(s);
|
117
|
+
const t = this.search(sp);
|
118
|
+
if (t) {
|
119
|
+
return t.pattern;
|
120
|
+
}
|
121
|
+
return null;
|
122
|
+
}
|
123
|
+
parseParams(s, pattern) {
|
124
|
+
const sSplit = RouteTree.split(s);
|
125
|
+
const patternSplit = RouteTree.split(pattern);
|
126
|
+
const params = {};
|
127
|
+
for (const index in patternSplit) {
|
128
|
+
const { key, carry, multi } = RouteTree.dynamic(patternSplit[index]);
|
129
|
+
if (!key) {
|
130
|
+
continue;
|
131
|
+
}
|
132
|
+
params[key.substring(carry)] = sSplit[index];
|
133
|
+
if (multi) {
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
return params;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
export default RouteTree;
|
141
|
+
//# sourceMappingURL=route-tree.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"route-tree.js","sourceRoot":"","sources":["../../src/lib/route-tree.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAS;IAAtB;QACE,YAAO,GAAG,EAAE,CAAC;QACb,SAAI,GAAG,EAAE,CAAC;QACV,aAAQ,GAAgB,EAAE,CAAC;QAC3B,WAAM,G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1B,IAAI,CAAC,EAAE;YACL,OAAO,CAAC,CAAC,OAAO,CAAC;SAClB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,CAAS,EAAE,OAAe;QACpC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClC,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;YAChC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,IAAI,CAAC,GAAG,EAAE;gBACR,SAAS;aACV;YACD,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,KAAK,EAAE;gBACT,MAAM;aACP;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AACD,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "godown",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.2.0",
|
4
4
|
"main": "./index.js",
|
5
5
|
"type": "module",
|
6
6
|
"publishConfig": {
|
@@ -47,6 +47,7 @@
|
|
47
47
|
"watch": "tsc --watch",
|
48
48
|
"build": "tsc && node ./scripts/build.js",
|
49
49
|
"roll": "rollup -c",
|
50
|
+
"readme": "node ./scripts/readme.js",
|
50
51
|
"fmt": "prettier --write ./src",
|
51
52
|
"lint": "eslint --ext .ts ./src"
|
52
53
|
}
|
package/view/route-view.d.ts
CHANGED
@@ -1,24 +1,36 @@
|
|
1
1
|
import { GlobalSTD, HtmlTemplate } from "../deps.js";
|
2
2
|
import type { PropertyValueMap } from "lit";
|
3
|
-
|
3
|
+
import RouteTree from "../lib/route-tree.js";
|
4
4
|
export declare class RouteView<T = unknown> extends GlobalSTD {
|
5
5
|
private _routes;
|
6
|
+
private _routeTree;
|
7
|
+
/**
|
8
|
+
* component will render
|
9
|
+
*/
|
6
10
|
component: T | HtmlTemplate;
|
11
|
+
/**
|
12
|
+
* dynamic parameters record
|
13
|
+
*/
|
7
14
|
params: Record<string, string>;
|
15
|
+
/**
|
16
|
+
* value of matched path in routes, or null
|
17
|
+
*/
|
8
18
|
path: string;
|
19
|
+
/**
|
20
|
+
* current pathname (location.pathname)
|
21
|
+
*/
|
9
22
|
pathname: string;
|
23
|
+
baseURL: string;
|
24
|
+
def: import("lit").TemplateResult<1>;
|
25
|
+
type: "united" | "child" | "slotted" | "field";
|
26
|
+
override: boolean;
|
27
|
+
cache: boolean;
|
10
28
|
record: Map<string, {
|
11
29
|
pathname: string;
|
12
30
|
params: Record<string, string>;
|
13
31
|
path: string;
|
14
32
|
component: T | import("lit").TemplateResult<1>;
|
15
33
|
}>;
|
16
|
-
baseURL: string;
|
17
|
-
def: import("lit").TemplateResult<1>;
|
18
|
-
type: "united" | "child" | "slotted" | "field";
|
19
|
-
override: boolean;
|
20
|
-
cache: boolean;
|
21
|
-
static: boolean;
|
22
34
|
set routes(v: (Record<string, any> & Record<"path", string> & {
|
23
35
|
component?: T;
|
24
36
|
})[]);
|
@@ -26,6 +38,7 @@ export declare class RouteView<T = unknown> extends GlobalSTD {
|
|
26
38
|
component?: T;
|
27
39
|
})[];
|
28
40
|
static styles: import("lit").CSSResult;
|
41
|
+
reset(): void;
|
29
42
|
render(): T | import("lit").TemplateResult<1>;
|
30
43
|
useRouter(): {
|
31
44
|
pathname: string;
|
@@ -34,16 +47,17 @@ export declare class RouteView<T = unknown> extends GlobalSTD {
|
|
34
47
|
component: T | import("lit").TemplateResult<1>;
|
35
48
|
};
|
36
49
|
connectedCallback(): void;
|
50
|
+
/**
|
51
|
+
*
|
52
|
+
* @param ur value of useRouter()
|
53
|
+
* @param first whether this path is loaded for the first time
|
54
|
+
*/
|
37
55
|
routeChangeCallback(ur: ReturnType<typeof this.useRouter>, first: boolean): void;
|
38
56
|
protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
slottedComponent(usedRouteTemplate: string, ObjectArrayIncludePath: WithRecord<"path">[]): null | HtmlTemplate;
|
44
|
-
static sortRoutesPaths(ObjectArrayIncludePath: WithRecord<"path">[]): WithRecord<"path">[];
|
45
|
-
static useWhichRoute(ObjectArrayIncludePath: WithRecord<"path">[], path: string, baseURL?: string): string | null;
|
46
|
-
static parseRouterParams(routeTemplate: string, originpath: string): Record<string, string>;
|
57
|
+
fieldComponent(usedRouteTemplate?: string): null | T;
|
58
|
+
slottedComponent(usedRouteTemplate?: string): null | HtmlTemplate;
|
59
|
+
useWhichRoute(path: string, baseURL?: string, appl?: RouteTree): string | null;
|
60
|
+
parseRouterParams(routeTemplate: string, originpath: string, appl?: RouteTree): Record<string, string>;
|
47
61
|
static updateAll(): void;
|
48
62
|
}
|
49
63
|
export default RouteView;
|
package/view/route-view.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"route-view.d.ts","sourceRoot":"","sources":["../../src/view/route-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAE,YAAY,
|
1
|
+
{"version":3,"file":"route-view.d.ts","sourceRoot":"","sources":["../../src/view/route-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAEzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAI7C,qBACa,SAAS,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,SAAS;IACnD,OAAO,CAAC,OAAO,CAAkD;IACjE,OAAO,CAAC,UAAU,CAA8B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AAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
package/view/route-view.js
CHANGED
@@ -4,62 +4,78 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
6
|
};
|
7
|
-
|
8
|
-
import { conf, css, define, GlobalSTD, property } from "../deps.js";
|
7
|
+
import { conf, css, define, GlobalSTD, property, state } from "../deps.js";
|
9
8
|
import { htmlSlot } from "../tmpl.js";
|
10
|
-
|
9
|
+
import RouteTree from "../lib/route-tree.js";
|
10
|
+
let RouteView = class RouteView extends GlobalSTD {
|
11
11
|
constructor() {
|
12
12
|
super(...arguments);
|
13
13
|
this._routes = [];
|
14
|
+
this._routeTree = new RouteTree();
|
15
|
+
/**
|
16
|
+
* component will render
|
17
|
+
*/
|
14
18
|
this.component = null;
|
19
|
+
/**
|
20
|
+
* dynamic parameters record
|
21
|
+
*/
|
15
22
|
this.params = {};
|
16
|
-
|
23
|
+
/**
|
24
|
+
* value of matched path in routes, or null
|
25
|
+
*/
|
26
|
+
this.path = null;
|
27
|
+
/**
|
28
|
+
* current pathname (location.pathname)
|
29
|
+
*/
|
17
30
|
this.pathname = "";
|
18
|
-
this.record = new Map();
|
19
31
|
this.baseURL = "";
|
20
32
|
this.def = htmlSlot();
|
21
33
|
this.type = "united";
|
22
34
|
this.override = true;
|
23
35
|
this.cache = false;
|
24
|
-
this.
|
36
|
+
this.record = new Map();
|
25
37
|
}
|
26
38
|
set routes(v) {
|
27
39
|
if (Object.prototype.toString.call(v) !== "[object Array]") {
|
28
|
-
this._routes = [];
|
29
40
|
return;
|
30
41
|
}
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
this._routes = RouteView_1.sortRoutesPaths(v);
|
42
|
+
this._routes = v;
|
43
|
+
this.reset();
|
44
|
+
for (const route of v) {
|
45
|
+
this._routeTree.insert(route.path);
|
36
46
|
}
|
37
47
|
this.requestUpdate();
|
38
48
|
}
|
39
49
|
get routes() {
|
40
50
|
return this._routes;
|
41
51
|
}
|
52
|
+
reset() {
|
53
|
+
this._routeTree = new RouteTree();
|
54
|
+
this.record.clear();
|
55
|
+
}
|
42
56
|
render() {
|
43
|
-
var _a;
|
57
|
+
var _a, _b;
|
44
58
|
if (this.cache) {
|
45
59
|
const cached = this.record.get(this.pathname);
|
46
60
|
if (cached) {
|
47
|
-
|
61
|
+
Object.assign(this, cached);
|
62
|
+
return this.component;
|
48
63
|
}
|
49
64
|
}
|
65
|
+
this.params = {};
|
50
66
|
switch (this.type) {
|
51
67
|
case "field":
|
52
|
-
this.component = this.
|
68
|
+
this.component = this.fieldComponent();
|
53
69
|
break;
|
54
70
|
case "child":
|
55
71
|
case "slotted":
|
56
|
-
this.component = this.
|
72
|
+
this.component = this.slottedComponent();
|
57
73
|
break;
|
58
74
|
case "united":
|
59
|
-
this.component = this.
|
75
|
+
this.component = (_a = this.fieldComponent()) !== null && _a !== void 0 ? _a : this.slottedComponent();
|
60
76
|
break;
|
61
77
|
}
|
62
|
-
return (
|
78
|
+
return (_b = this.component) !== null && _b !== void 0 ? _b : this.def;
|
63
79
|
}
|
64
80
|
useRouter() {
|
65
81
|
return {
|
@@ -90,11 +106,16 @@ let RouteView = RouteView_1 = class RouteView extends GlobalSTD {
|
|
90
106
|
self.pathname = window.location.pathname;
|
91
107
|
};
|
92
108
|
}
|
109
|
+
/**
|
110
|
+
*
|
111
|
+
* @param ur value of useRouter()
|
112
|
+
* @param first whether this path is loaded for the first time
|
113
|
+
*/
|
93
114
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
94
115
|
routeChangeCallback(ur, first) { }
|
95
116
|
updated(changedProperties) {
|
96
|
-
const
|
97
|
-
if (
|
117
|
+
const shouldDispatch = changedProperties.has("pathname") || changedProperties.has("path");
|
118
|
+
if (shouldDispatch) {
|
98
119
|
const ur = this.useRouter();
|
99
120
|
const noRecord = !this.record.has(this.pathname);
|
100
121
|
if (noRecord) {
|
@@ -104,144 +125,54 @@ let RouteView = RouteView_1 = class RouteView extends GlobalSTD {
|
|
104
125
|
this.dispatchEvent(new CustomEvent("change", { detail: ur }));
|
105
126
|
}
|
106
127
|
}
|
107
|
-
render_united() {
|
108
|
-
const slottedComponent = this.render_slotted();
|
109
|
-
if (slottedComponent) {
|
110
|
-
return slottedComponent;
|
111
|
-
}
|
112
|
-
return this.render_field();
|
113
|
-
}
|
114
|
-
render_slotted() {
|
115
|
-
const childNodes = this.querySelectorAll(":scope > *[slot]");
|
116
|
-
if (!childNodes.length) {
|
117
|
-
return null;
|
118
|
-
}
|
119
|
-
const slots = Array.from(childNodes).map((node) => {
|
120
|
-
const slotname = node.getAttribute("slot");
|
121
|
-
return {
|
122
|
-
path: this.baseURL + slotname,
|
123
|
-
slotname,
|
124
|
-
};
|
125
|
-
});
|
126
|
-
let slotsSort;
|
127
|
-
if (this.static) {
|
128
|
-
slotsSort = slots;
|
129
|
-
}
|
130
|
-
else {
|
131
|
-
slotsSort = RouteView_1.sortRoutesPaths(slots);
|
132
|
-
}
|
133
|
-
this.path = RouteView_1.useWhichRoute(slotsSort, this.pathname);
|
134
|
-
return this.slottedComponent(this.path, slotsSort);
|
135
|
-
}
|
136
|
-
render_field() {
|
137
|
-
this.path = RouteView_1.useWhichRoute(this.routes, this.pathname);
|
138
|
-
this.params = RouteView_1.parseRouterParams(this.path, this.pathname);
|
139
|
-
return this.fieldComponent(this.path);
|
140
|
-
}
|
141
128
|
fieldComponent(usedRouteTemplate) {
|
129
|
+
if (!usedRouteTemplate) {
|
130
|
+
usedRouteTemplate = this.useWhichRoute(this.pathname);
|
131
|
+
}
|
132
|
+
this.path = usedRouteTemplate;
|
142
133
|
if (!usedRouteTemplate) {
|
143
134
|
return null;
|
144
135
|
}
|
136
|
+
this.params = this.parseRouterParams(this.path, this.pathname);
|
145
137
|
const route = this.routes.find((r) => r.path === usedRouteTemplate);
|
146
138
|
if (!route) {
|
147
139
|
return null;
|
148
140
|
}
|
149
141
|
return route.component;
|
150
142
|
}
|
151
|
-
slottedComponent(usedRouteTemplate
|
152
|
-
|
153
|
-
|
154
|
-
}
|
155
|
-
const slotElement = ObjectArrayIncludePath.find((s) => s.path === usedRouteTemplate);
|
156
|
-
if (!slotElement) {
|
143
|
+
slottedComponent(usedRouteTemplate) {
|
144
|
+
const childNodes = this.querySelectorAll(":scope > *[slot]");
|
145
|
+
if (!childNodes.length) {
|
157
146
|
return null;
|
158
147
|
}
|
159
|
-
|
160
|
-
|
161
|
-
}
|
162
|
-
static sortRoutesPaths(ObjectArrayIncludePath) {
|
163
|
-
const all = ObjectArrayIncludePath.map((route) => {
|
164
|
-
const path = route.path;
|
165
|
-
const pathArray = path.split("/");
|
166
|
-
const __dynamicRouteCount = pathArray.filter((p) => p.startsWith(":")).length;
|
148
|
+
const slottedPaths = Array.from(childNodes).map((node) => {
|
149
|
+
const slotname = node.getAttribute("slot");
|
167
150
|
return {
|
168
|
-
|
169
|
-
path,
|
170
|
-
__dynamicRouteCount,
|
151
|
+
path: slotname,
|
171
152
|
};
|
172
153
|
});
|
173
|
-
const
|
174
|
-
const
|
175
|
-
|
176
|
-
const pathArray = path.split("/");
|
177
|
-
const multi_dynamicRouteCount = pathArray.filter((p) => p.startsWith("...") || p.startsWith("*")).length;
|
178
|
-
return multi_dynamicRouteCount > 0;
|
179
|
-
});
|
180
|
-
multi.sort((a, b) => {
|
181
|
-
const aIndex = a.path.split("/").findIndex((template) => template.startsWith("...") || template.startsWith("*"));
|
182
|
-
const bIndex = b.path.split("/").findIndex((template) => template.startsWith("...") || template.startsWith("*"));
|
183
|
-
return aIndex !== -1 && bIndex !== -1 ? bIndex - aIndex : 0;
|
184
|
-
});
|
185
|
-
const sigle = allSort.filter((route) => {
|
186
|
-
const path = route.path;
|
187
|
-
const pathArray = path.split("/");
|
188
|
-
const multi_dynamicRouteCount = pathArray.filter((p) => p.startsWith("...") || p.startsWith("*")).length;
|
189
|
-
return multi_dynamicRouteCount === 0;
|
190
|
-
});
|
191
|
-
return [...sigle, ...multi].map((i) => {
|
192
|
-
delete i.__dynamicRouteCount;
|
193
|
-
return i;
|
194
|
-
});
|
195
|
-
}
|
196
|
-
static useWhichRoute(ObjectArrayIncludePath, path, baseURL = "") {
|
197
|
-
const originpath = baseURL + path;
|
198
|
-
const originsplits = originpath.split("/").slice(1);
|
199
|
-
const routes = ObjectArrayIncludePath;
|
200
|
-
const pathTemplateArray = routes.map((r) => r.path);
|
201
|
-
for (const pathTemplate of pathTemplateArray) {
|
202
|
-
const pathsplits = pathTemplate.split("/").slice(1);
|
203
|
-
const ifmatched = pathsplits.every((pathsplit, index) => {
|
204
|
-
const originsplit = originsplits[index];
|
205
|
-
if (pathsplit.startsWith(":")) {
|
206
|
-
return originsplits.length <= pathsplits.length;
|
207
|
-
}
|
208
|
-
else if (pathsplit.startsWith("...")) {
|
209
|
-
return originsplits.length >= pathsplits.length;
|
210
|
-
}
|
211
|
-
else {
|
212
|
-
return originsplits.length === pathsplits.length && originsplit === pathsplit;
|
213
|
-
}
|
214
|
-
});
|
215
|
-
if (ifmatched) {
|
216
|
-
return pathTemplate;
|
217
|
-
}
|
218
|
-
}
|
219
|
-
return null;
|
220
|
-
}
|
221
|
-
static parseRouterParams(routeTemplate, originpath) {
|
222
|
-
if (!routeTemplate || !originpath) {
|
223
|
-
return;
|
154
|
+
const tempRouteTree = new RouteTree();
|
155
|
+
for (const withPath of slottedPaths) {
|
156
|
+
tempRouteTree.insert(withPath.path);
|
224
157
|
}
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
if (path.startsWith(":")) {
|
230
|
-
params[path.slice(1)] = originpathArray[index];
|
231
|
-
}
|
232
|
-
else if (path.startsWith("*")) {
|
233
|
-
params[path.slice(1)] = originpathArray.slice(index).join("/");
|
234
|
-
}
|
235
|
-
else if (path.startsWith("...")) {
|
236
|
-
params[path.slice(3)] = originpathArray.slice(index).join("/");
|
237
|
-
}
|
238
|
-
else {
|
239
|
-
if (path !== originpathArray[index]) {
|
240
|
-
return;
|
241
|
-
}
|
158
|
+
if (!usedRouteTemplate) {
|
159
|
+
usedRouteTemplate = this.useWhichRoute(this.pathname, undefined, tempRouteTree);
|
160
|
+
if (!usedRouteTemplate) {
|
161
|
+
return null;
|
242
162
|
}
|
243
163
|
}
|
244
|
-
|
164
|
+
const slotElement = slottedPaths.find((s) => s.path === usedRouteTemplate);
|
165
|
+
if (!slotElement) {
|
166
|
+
return null;
|
167
|
+
}
|
168
|
+
this.params = this.parseRouterParams(usedRouteTemplate, this.pathname);
|
169
|
+
return htmlSlot(slotElement.path);
|
170
|
+
}
|
171
|
+
useWhichRoute(path, baseURL = this.baseURL, appl = this._routeTree) {
|
172
|
+
return appl.useWhich(baseURL + path);
|
173
|
+
}
|
174
|
+
parseRouterParams(routeTemplate, originpath, appl = this._routeTree) {
|
175
|
+
return appl.parseParams(originpath, routeTemplate);
|
245
176
|
}
|
246
177
|
static updateAll() {
|
247
178
|
const routeViewTagName = conf.namemap.get("route-view");
|
@@ -261,6 +192,15 @@ RouteView.styles = css `
|
|
261
192
|
display: contents;
|
262
193
|
}
|
263
194
|
`;
|
195
|
+
__decorate([
|
196
|
+
state()
|
197
|
+
], RouteView.prototype, "component", void 0);
|
198
|
+
__decorate([
|
199
|
+
state()
|
200
|
+
], RouteView.prototype, "params", void 0);
|
201
|
+
__decorate([
|
202
|
+
state()
|
203
|
+
], RouteView.prototype, "path", void 0);
|
264
204
|
__decorate([
|
265
205
|
property()
|
266
206
|
], RouteView.prototype, "pathname", void 0);
|
@@ -268,21 +208,18 @@ __decorate([
|
|
268
208
|
property()
|
269
209
|
], RouteView.prototype, "baseURL", void 0);
|
270
210
|
__decorate([
|
271
|
-
|
211
|
+
state()
|
272
212
|
], RouteView.prototype, "def", void 0);
|
273
213
|
__decorate([
|
274
214
|
property()
|
275
215
|
], RouteView.prototype, "type", void 0);
|
276
216
|
__decorate([
|
277
|
-
|
217
|
+
state()
|
278
218
|
], RouteView.prototype, "override", void 0);
|
279
219
|
__decorate([
|
280
220
|
property({ type: Boolean })
|
281
221
|
], RouteView.prototype, "cache", void 0);
|
282
|
-
__decorate([
|
283
|
-
property({ type: Boolean })
|
284
|
-
], RouteView.prototype, "static", void 0);
|
285
|
-
RouteView = RouteView_1 = __decorate([
|
222
|
+
RouteView = __decorate([
|
286
223
|
define("route-view")
|
287
224
|
], RouteView);
|
288
225
|
export { RouteView };
|
package/view/route-view.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"route-view.js","sourceRoot":"","sources":["../../src/view/route-view.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"route-view.js","sourceRoot":"","sources":["../../src/view/route-view.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAgB,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAKtC,IAAM,SAAS,GAAf,MAAM,SAAuB,SAAQ,SAAS;IAA9C;;QACG,YAAO,GAA+C,EAAE,CAAC;QACzD,eAAU,GAAc,IAAI,SAAS,EAAE,CAAC;QAEhD;;WAEG;QACM,cAAS,GAAqB,IAAI,CAAC;QAC5C;;WAEG;QACM,WAAM,GAA2B,EAAE,CAAC;QAC7C;;WAEG;QACM,SAAI,GAAW,IAAI,CAAC;QAC7B;;WAEG;QACS,aAAQ,GAAG,EAAE,CAAC;QAEd,YAAO,GAAG,EAAE,CAAC;QAChB,QAAG,GAAG,QAAQ,EAAE,CAAC;QACd,SAAI,GAA6C,QAAQ,CAAC;QAC7D,aAAQ,GAAG,IAAI,CAAC;QACI,UAAK,GAAG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