dom-render 1.0.73 → 1.0.76
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/Config.d.ts +38 -36
- package/Config.js +2 -2
- package/DomRender.d.ts +28 -4
- package/DomRender.js +90 -39
- package/DomRenderProxy.d.ts +29 -29
- package/DomRenderProxy.js +338 -327
- package/README.MD +638 -511
- package/RawSet.d.ts +140 -117
- package/RawSet.js +765 -882
- package/components/ComponentSet.d.ts +7 -0
- package/components/ComponentSet.js +14 -0
- package/dist/bundle.js +3796 -3133
- package/events/EventManager.d.ts +47 -47
- package/events/EventManager.js +499 -499
- package/iterators/Range.d.ts +22 -22
- package/iterators/Range.js +65 -65
- package/lifecycle/OnBeforeReturnGet.d.ts +3 -3
- package/lifecycle/OnBeforeReturnGet.js +2 -2
- package/lifecycle/OnBeforeReturnSet.d.ts +3 -3
- package/lifecycle/OnBeforeReturnSet.js +2 -2
- package/lifecycle/OnCreateRender.d.ts +3 -3
- package/lifecycle/OnCreateRender.js +2 -2
- package/lifecycle/OnDestroyRender.d.ts +4 -0
- package/lifecycle/OnDestroyRender.js +2 -0
- package/lifecycle/OnInitRender.d.ts +7 -7
- package/lifecycle/OnInitRender.js +2 -2
- package/lifecycle/OnProxyDomRender.d.ts +4 -0
- package/lifecycle/OnProxyDomRender.js +2 -0
- package/managers/RenderManager.d.ts +3 -3
- package/managers/RenderManager.js +18 -18
- package/messenger/DefaultMessenger.d.ts +3 -0
- package/messenger/DefaultMessenger.js +27 -0
- package/messenger/Messenger.d.ts +78 -0
- package/messenger/Messenger.js +201 -0
- package/operators/Appender.d.ts +7 -12
- package/operators/Appender.js +32 -39
- package/operators/AttrExpresion.d.ts +4 -0
- package/operators/AttrExpresion.js +68 -0
- package/operators/Dr.d.ts +4 -0
- package/operators/Dr.js +62 -0
- package/operators/DrAppender.d.ts +4 -0
- package/operators/DrAppender.js +65 -0
- package/operators/DrFor.d.ts +4 -0
- package/operators/DrFor.js +62 -0
- package/operators/DrForOf.d.ts +4 -0
- package/operators/DrForOf.js +65 -0
- package/operators/DrForm.d.ts +4 -0
- package/operators/DrForm.js +100 -0
- package/operators/DrIf.d.ts +4 -0
- package/operators/DrIf.js +72 -0
- package/operators/DrInnerHTML.d.ts +4 -0
- package/operators/DrInnerHTML.js +60 -0
- package/operators/DrInnerText.d.ts +4 -0
- package/operators/DrInnerText.js +58 -0
- package/operators/DrPre.d.ts +4 -0
- package/operators/DrPre.js +30 -0
- package/operators/DrRepeat.d.ts +4 -0
- package/operators/DrRepeat.js +63 -0
- package/operators/DrTargetAttr.d.ts +4 -0
- package/operators/DrTargetAttr.js +55 -0
- package/operators/DrTargetElement.d.ts +4 -0
- package/operators/DrTargetElement.js +65 -0
- package/operators/DrThis.d.ts +4 -0
- package/operators/DrThis.js +59 -0
- package/operators/OperatorRender.d.ts +41 -0
- package/operators/OperatorRender.js +21 -0
- package/package.json +94 -94
- package/routers/HashRouter.d.ts +9 -9
- package/routers/HashRouter.js +53 -53
- package/routers/PathRouter.d.ts +9 -9
- package/routers/PathRouter.js +52 -52
- package/routers/Router.d.ts +25 -22
- package/routers/Router.js +116 -94
- package/types/Types.d.ts +14 -14
- package/types/Types.js +36 -36
- package/utils/clipboard/ClipBoardUtils.d.ts +6 -6
- package/utils/clipboard/ClipBoardUtils.js +25 -25
- package/utils/dom/DomUtils.d.ts +13 -13
- package/utils/dom/DomUtils.js +47 -47
- package/utils/location/LocationUtils.d.ts +16 -16
- package/utils/location/LocationUtils.js +57 -57
- package/utils/node/NodeUtils.d.ts +10 -10
- package/utils/node/NodeUtils.js +27 -27
- package/utils/random/RandomUtils.d.ts +7 -7
- package/utils/random/RandomUtils.js +47 -47
- package/utils/script/ScriptUtils.d.ts +14 -14
- package/utils/script/ScriptUtils.js +89 -89
- package/utils/storage/StorageUtils.d.ts +9 -9
- package/utils/storage/StorageUtils.js +48 -48
- package/utils/string/StringUtils.d.ts +5 -5
- package/utils/string/StringUtils.js +41 -41
- package/utils/valid/ValidUtils.d.ts +10 -10
- package/utils/valid/ValidUtils.js +78 -78
- package/validators/AllCheckedValidatorArray.d.ts +6 -6
- package/validators/AllCheckedValidatorArray.js +32 -32
- package/validators/AllUnCheckedValidatorArray.d.ts +6 -6
- package/validators/AllUnCheckedValidatorArray.js +32 -32
- package/validators/CheckedValidator.d.ts +5 -5
- package/validators/CheckedValidator.js +32 -32
- package/validators/CountEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +34 -34
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountLessThanUnCheckedValidatorArray.js +34 -34
- package/validators/CountUnCheckedValidatorArray.d.ts +7 -7
- package/validators/CountUnCheckedValidatorArray.js +34 -34
- package/validators/EmptyValidator.d.ts +5 -5
- package/validators/EmptyValidator.js +33 -33
- package/validators/ExcludeCheckedValidatorArray.d.ts +8 -8
- package/validators/ExcludeCheckedValidatorArray.js +41 -41
- package/validators/FormValidator.d.ts +7 -7
- package/validators/FormValidator.js +37 -37
- package/validators/IncludeCheckedValidatorArray.d.ts +8 -8
- package/validators/IncludeCheckedValidatorArray.js +41 -41
- package/validators/MultipleValidator.d.ts +8 -8
- package/validators/MultipleValidator.js +48 -48
- package/validators/NonPassValidator.d.ts +5 -5
- package/validators/NonPassValidator.js +31 -31
- package/validators/NotEmptyValidator.d.ts +5 -5
- package/validators/NotEmptyValidator.js +34 -34
- package/validators/NotRegExpTestValidator.d.ts +6 -6
- package/validators/NotRegExpTestValidator.js +42 -42
- package/validators/PassValidator.d.ts +5 -5
- package/validators/PassValidator.js +31 -31
- package/validators/RegExpTestValidator.d.ts +6 -6
- package/validators/RegExpTestValidator.js +43 -43
- package/validators/RequiredValidator.d.ts +5 -5
- package/validators/RequiredValidator.js +33 -33
- package/validators/UnCheckedValidator.d.ts +5 -5
- package/validators/UnCheckedValidator.js +32 -32
- package/validators/ValidMultipleValidator.d.ts +9 -9
- package/validators/ValidMultipleValidator.js +34 -34
- package/validators/ValidValidator.d.ts +6 -6
- package/validators/ValidValidator.js +33 -33
- package/validators/ValidValidatorArray.d.ts +7 -7
- package/validators/ValidValidatorArray.js +33 -33
- package/validators/Validator.d.ts +57 -57
- package/validators/Validator.js +242 -242
- package/validators/ValidatorArray.d.ts +17 -17
- package/validators/ValidatorArray.js +99 -99
- package/validators/ValueEqualsValidator.d.ts +6 -6
- package/validators/ValueEqualsValidator.js +33 -33
- package/validators/ValueNotEqualsValidator.d.ts +6 -6
- package/validators/ValueNotEqualsValidator.js +33 -33
package/package.json
CHANGED
@@ -1,94 +1,94 @@
|
|
1
|
-
{
|
2
|
-
"name": "dom-render",
|
3
|
-
"version": "1.0.
|
4
|
-
"main": "DomRender.js",
|
5
|
-
"license": "MIT",
|
6
|
-
"description": "dom-render",
|
7
|
-
"keywords": [
|
8
|
-
"front",
|
9
|
-
"spa",
|
10
|
-
"SPA",
|
11
|
-
"dom-render",
|
12
|
-
"front-end",
|
13
|
-
"framwork",
|
14
|
-
"node"
|
15
|
-
],
|
16
|
-
"author": "visualkhh <visualkhh@gmail.com> (https://github.com/visualkhh)",
|
17
|
-
"contributors": [
|
18
|
-
"sewoo <sewooimda@nate.com> (https://github.com/sewoo)",
|
19
|
-
"SeoDH <adonis_84@naver.com> (https://github.com/SeoDH)",
|
20
|
-
"tkyung (https://github.com/tkyungDev)",
|
21
|
-
"Hoil-Gang (https://github.com/khl1154)",
|
22
|
-
"hwangsero (https://github.com/hwangsero)"
|
23
|
-
],
|
24
|
-
"homepage": "https://github.com/visualkhh/dom-render",
|
25
|
-
"bugs": {
|
26
|
-
"url": "https://github.com/visualkhh/dom-render",
|
27
|
-
"email": "visualkhh@gmail.com"
|
28
|
-
},
|
29
|
-
"repository": {
|
30
|
-
"type": "git",
|
31
|
-
"url": "https://github.com/visualkhh/dom-render"
|
32
|
-
},
|
33
|
-
"jest": {
|
34
|
-
"transform": {
|
35
|
-
"^.+\\.ts$": "ts-jest"
|
36
|
-
},
|
37
|
-
"testRegex": "\\.test\\.ts$",
|
38
|
-
"moduleFileExtensions": [
|
39
|
-
"ts",
|
40
|
-
"tsx",
|
41
|
-
"js",
|
42
|
-
"json"
|
43
|
-
],
|
44
|
-
"globals": {
|
45
|
-
"ts-jest": {
|
46
|
-
"diagnostics": true
|
47
|
-
}
|
48
|
-
}
|
49
|
-
},
|
50
|
-
"scripts": {
|
51
|
-
"build": "rm -rf dist && mkdir dist && cp package.json dist && tsc --outDir dist --declarationDir dist && rm -rf dist/dist && rollup -c",
|
52
|
-
"build:ts:watch": "rm -rf dist && mkdir dist && cp package.json dist && tsc --watch --outDir dist --declarationDir dist",
|
53
|
-
"bundle": "rollup -c",
|
54
|
-
"bundle:watch": "rollup -c -w",
|
55
|
-
"dev:start": "npm run start --workspace=dev",
|
56
|
-
"dev:serve": "npm run serve --workspace=dev",
|
57
|
-
"npm-build": "npm run build && cp package.json dist && cp .npmignore dist && cp README.MD dist && rm -rf dist/dist/bundle.js.map",
|
58
|
-
"npm-publish": "npm run npm-build && npm publish ./dist",
|
59
|
-
"tsc": "tsc",
|
60
|
-
"tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --outDir dist --declarationDir dist --sourceMap true",
|
61
|
-
"test": "jest --detectOpenHandles --forceExit"
|
62
|
-
},
|
63
|
-
"devDependencies": {
|
64
|
-
"@rollup/plugin-babel": "^5.3.0",
|
65
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
66
|
-
"@rollup/plugin-json": "^4.1.0",
|
67
|
-
"@rollup/plugin-multi-entry": "^4.1.0",
|
68
|
-
"@rollup/plugin-node-resolve": "^13.1.3",
|
69
|
-
"@rollup/plugin-replace": "^2.4.2",
|
70
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
71
|
-
"@types/jest": "^26.0.22",
|
72
|
-
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
73
|
-
"@typescript-eslint/parser": "^4.16.1",
|
74
|
-
"eslint": "^7.32.0",
|
75
|
-
"eslint-config-standard": "^16.0.3",
|
76
|
-
"eslint-plugin-import": "^2.25.3",
|
77
|
-
"eslint-plugin-node": "^11.1.0",
|
78
|
-
"eslint-plugin-promise": "^4.3.1",
|
79
|
-
"jest": "^26.6.3",
|
80
|
-
"mkdirp": "^1.0.4",
|
81
|
-
"rollup": "^2.60.1",
|
82
|
-
"rollup-plugin-copy": "^3.4.0",
|
83
|
-
"rollup-plugin-delete": "^2.0.0",
|
84
|
-
"rollup-plugin-html": "^0.2.1",
|
85
|
-
"rollup-plugin-import-css": "^3.0.2",
|
86
|
-
"rollup-plugin-node-resolve": "^5.2.0",
|
87
|
-
"rollup-plugin-sourcemaps": "^0.6.3",
|
88
|
-
"rollup-watch": "^3.2.2",
|
89
|
-
"supertest": "^6.1.3",
|
90
|
-
"ts-jest": "^26.5.4",
|
91
|
-
"tslib": "^2.3.1",
|
92
|
-
"typescript": "^4.4.3"
|
93
|
-
}
|
94
|
-
}
|
1
|
+
{
|
2
|
+
"name": "dom-render",
|
3
|
+
"version": "1.0.76",
|
4
|
+
"main": "DomRender.js",
|
5
|
+
"license": "MIT",
|
6
|
+
"description": "dom-render",
|
7
|
+
"keywords": [
|
8
|
+
"front",
|
9
|
+
"spa",
|
10
|
+
"SPA",
|
11
|
+
"dom-render",
|
12
|
+
"front-end",
|
13
|
+
"framwork",
|
14
|
+
"node"
|
15
|
+
],
|
16
|
+
"author": "visualkhh <visualkhh@gmail.com> (https://github.com/visualkhh)",
|
17
|
+
"contributors": [
|
18
|
+
"sewoo <sewooimda@nate.com> (https://github.com/sewoo)",
|
19
|
+
"SeoDH <adonis_84@naver.com> (https://github.com/SeoDH)",
|
20
|
+
"tkyung (https://github.com/tkyungDev)",
|
21
|
+
"Hoil-Gang (https://github.com/khl1154)",
|
22
|
+
"hwangsero (https://github.com/hwangsero)"
|
23
|
+
],
|
24
|
+
"homepage": "https://github.com/visualkhh/dom-render",
|
25
|
+
"bugs": {
|
26
|
+
"url": "https://github.com/visualkhh/dom-render",
|
27
|
+
"email": "visualkhh@gmail.com"
|
28
|
+
},
|
29
|
+
"repository": {
|
30
|
+
"type": "git",
|
31
|
+
"url": "https://github.com/visualkhh/dom-render"
|
32
|
+
},
|
33
|
+
"jest": {
|
34
|
+
"transform": {
|
35
|
+
"^.+\\.ts$": "ts-jest"
|
36
|
+
},
|
37
|
+
"testRegex": "\\.test\\.ts$",
|
38
|
+
"moduleFileExtensions": [
|
39
|
+
"ts",
|
40
|
+
"tsx",
|
41
|
+
"js",
|
42
|
+
"json"
|
43
|
+
],
|
44
|
+
"globals": {
|
45
|
+
"ts-jest": {
|
46
|
+
"diagnostics": true
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"scripts": {
|
51
|
+
"build": "rm -rf dist && mkdir dist && cp package.json dist && tsc --outDir dist --declarationDir dist && rm -rf dist/dist && rollup -c",
|
52
|
+
"build:ts:watch": "rm -rf dist && mkdir dist && cp package.json dist && tsc --watch --outDir dist --declarationDir dist",
|
53
|
+
"bundle": "rollup -c",
|
54
|
+
"bundle:watch": "rollup -c -w",
|
55
|
+
"dev:start": "npm run start --workspace=dev",
|
56
|
+
"dev:serve": "npm run serve --workspace=dev",
|
57
|
+
"npm-build": "npm run build && cp package.json dist && cp .npmignore dist && cp README.MD dist && rm -rf dist/dist/bundle.js.map",
|
58
|
+
"npm-publish": "npm run npm-build && npm publish ./dist",
|
59
|
+
"tsc": "tsc",
|
60
|
+
"tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --outDir dist --declarationDir dist --sourceMap true",
|
61
|
+
"test": "jest --detectOpenHandles --forceExit"
|
62
|
+
},
|
63
|
+
"devDependencies": {
|
64
|
+
"@rollup/plugin-babel": "^5.3.0",
|
65
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
66
|
+
"@rollup/plugin-json": "^4.1.0",
|
67
|
+
"@rollup/plugin-multi-entry": "^4.1.0",
|
68
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
69
|
+
"@rollup/plugin-replace": "^2.4.2",
|
70
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
71
|
+
"@types/jest": "^26.0.22",
|
72
|
+
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
73
|
+
"@typescript-eslint/parser": "^4.16.1",
|
74
|
+
"eslint": "^7.32.0",
|
75
|
+
"eslint-config-standard": "^16.0.3",
|
76
|
+
"eslint-plugin-import": "^2.25.3",
|
77
|
+
"eslint-plugin-node": "^11.1.0",
|
78
|
+
"eslint-plugin-promise": "^4.3.1",
|
79
|
+
"jest": "^26.6.3",
|
80
|
+
"mkdirp": "^1.0.4",
|
81
|
+
"rollup": "^2.60.1",
|
82
|
+
"rollup-plugin-copy": "^3.4.0",
|
83
|
+
"rollup-plugin-delete": "^2.0.0",
|
84
|
+
"rollup-plugin-html": "^0.2.1",
|
85
|
+
"rollup-plugin-import-css": "^3.0.2",
|
86
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
87
|
+
"rollup-plugin-sourcemaps": "^0.6.3",
|
88
|
+
"rollup-watch": "^3.2.2",
|
89
|
+
"supertest": "^6.1.3",
|
90
|
+
"ts-jest": "^26.5.4",
|
91
|
+
"tslib": "^2.3.1",
|
92
|
+
"typescript": "^4.4.3"
|
93
|
+
}
|
94
|
+
}
|
package/routers/HashRouter.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Router } from './Router';
|
2
|
-
export declare class HashRouter extends Router {
|
3
|
-
test(urlExpression: string): boolean;
|
4
|
-
getData(): any;
|
5
|
-
getSearchParams(): URLSearchParams;
|
6
|
-
set(path: string, data?: any, title?: string): void;
|
7
|
-
getUrl(): string;
|
8
|
-
getPath(): string;
|
9
|
-
}
|
1
|
+
import { Router } from './Router';
|
2
|
+
export declare class HashRouter extends Router {
|
3
|
+
test(urlExpression: string): boolean;
|
4
|
+
getData(): any;
|
5
|
+
getSearchParams(): URLSearchParams;
|
6
|
+
set(path: string, data?: any, title?: string): void;
|
7
|
+
getUrl(): string;
|
8
|
+
getPath(): string;
|
9
|
+
}
|
package/routers/HashRouter.js
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
3
|
-
var extendStatics = function (d, b) {
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
-
return extendStatics(d, b);
|
8
|
-
};
|
9
|
-
return function (d, b) {
|
10
|
-
if (typeof b !== "function" && b !== null)
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
-
extendStatics(d, b);
|
13
|
-
function __() { this.constructor = d; }
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
-
};
|
16
|
-
})();
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
exports.HashRouter = void 0;
|
19
|
-
var Router_1 = require("./Router");
|
20
|
-
var LocationUtils_1 = require("../utils/location/LocationUtils");
|
21
|
-
var HashRouter = /** @class */ (function (_super) {
|
22
|
-
__extends(HashRouter, _super);
|
23
|
-
function HashRouter() {
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
25
|
-
}
|
26
|
-
HashRouter.prototype.test = function (urlExpression) {
|
27
|
-
if (this.getPathData(urlExpression)) {
|
28
|
-
return true;
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
return false;
|
32
|
-
}
|
33
|
-
};
|
34
|
-
HashRouter.prototype.getData = function () {
|
35
|
-
return this.window.history.state;
|
36
|
-
};
|
37
|
-
HashRouter.prototype.getSearchParams = function () {
|
38
|
-
return new URLSearchParams(LocationUtils_1.LocationUtils.hashSearch(this.window));
|
39
|
-
};
|
40
|
-
HashRouter.prototype.set = function (path, data, title) {
|
41
|
-
if (title === void 0) { title = ''; }
|
42
|
-
path = '#' + path;
|
43
|
-
this.window.history.pushState(data, title, path);
|
44
|
-
};
|
45
|
-
HashRouter.prototype.getUrl = function () {
|
46
|
-
return LocationUtils_1.LocationUtils.hash(this.window) || '/';
|
47
|
-
};
|
48
|
-
HashRouter.prototype.getPath = function () {
|
49
|
-
return LocationUtils_1.LocationUtils.hashPath(this.window) || '/';
|
50
|
-
};
|
51
|
-
return HashRouter;
|
52
|
-
}(Router_1.Router));
|
53
|
-
exports.HashRouter = HashRouter;
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
exports.HashRouter = void 0;
|
19
|
+
var Router_1 = require("./Router");
|
20
|
+
var LocationUtils_1 = require("../utils/location/LocationUtils");
|
21
|
+
var HashRouter = /** @class */ (function (_super) {
|
22
|
+
__extends(HashRouter, _super);
|
23
|
+
function HashRouter() {
|
24
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
25
|
+
}
|
26
|
+
HashRouter.prototype.test = function (urlExpression) {
|
27
|
+
if (this.getPathData(urlExpression)) {
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
return false;
|
32
|
+
}
|
33
|
+
};
|
34
|
+
HashRouter.prototype.getData = function () {
|
35
|
+
return this.window.history.state;
|
36
|
+
};
|
37
|
+
HashRouter.prototype.getSearchParams = function () {
|
38
|
+
return new URLSearchParams(LocationUtils_1.LocationUtils.hashSearch(this.window));
|
39
|
+
};
|
40
|
+
HashRouter.prototype.set = function (path, data, title) {
|
41
|
+
if (title === void 0) { title = ''; }
|
42
|
+
path = '#' + path;
|
43
|
+
this.window.history.pushState(data, title, path);
|
44
|
+
};
|
45
|
+
HashRouter.prototype.getUrl = function () {
|
46
|
+
return LocationUtils_1.LocationUtils.hash(this.window) || '/';
|
47
|
+
};
|
48
|
+
HashRouter.prototype.getPath = function () {
|
49
|
+
return LocationUtils_1.LocationUtils.hashPath(this.window) || '/';
|
50
|
+
};
|
51
|
+
return HashRouter;
|
52
|
+
}(Router_1.Router));
|
53
|
+
exports.HashRouter = HashRouter;
|
package/routers/PathRouter.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Router } from './Router';
|
2
|
-
export declare class PathRouter extends Router {
|
3
|
-
test(urlExpression: string): boolean;
|
4
|
-
getData(): any;
|
5
|
-
getSearchParams(): URLSearchParams;
|
6
|
-
set(path: string, data?: any, title?: string): void;
|
7
|
-
getUrl(): string;
|
8
|
-
getPath(): string;
|
9
|
-
}
|
1
|
+
import { Router } from './Router';
|
2
|
+
export declare class PathRouter extends Router {
|
3
|
+
test(urlExpression: string): boolean;
|
4
|
+
getData(): any;
|
5
|
+
getSearchParams(): URLSearchParams;
|
6
|
+
set(path: string, data?: any, title?: string): void;
|
7
|
+
getUrl(): string;
|
8
|
+
getPath(): string;
|
9
|
+
}
|
package/routers/PathRouter.js
CHANGED
@@ -1,52 +1,52 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
3
|
-
var extendStatics = function (d, b) {
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
-
return extendStatics(d, b);
|
8
|
-
};
|
9
|
-
return function (d, b) {
|
10
|
-
if (typeof b !== "function" && b !== null)
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
-
extendStatics(d, b);
|
13
|
-
function __() { this.constructor = d; }
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
-
};
|
16
|
-
})();
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
exports.PathRouter = void 0;
|
19
|
-
var Router_1 = require("./Router");
|
20
|
-
var PathRouter = /** @class */ (function (_super) {
|
21
|
-
__extends(PathRouter, _super);
|
22
|
-
function PathRouter() {
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
24
|
-
}
|
25
|
-
PathRouter.prototype.test = function (urlExpression) {
|
26
|
-
if (this.getPathData(urlExpression)) {
|
27
|
-
return true;
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
return false;
|
31
|
-
}
|
32
|
-
};
|
33
|
-
PathRouter.prototype.getData = function () {
|
34
|
-
return this.window.history.state;
|
35
|
-
};
|
36
|
-
PathRouter.prototype.getSearchParams = function () {
|
37
|
-
return (new URL(this.window.document.location.href)).searchParams;
|
38
|
-
};
|
39
|
-
PathRouter.prototype.set = function (path, data, title) {
|
40
|
-
if (title === void 0) { title = ''; }
|
41
|
-
this.window.history.pushState(data, title, path);
|
42
|
-
};
|
43
|
-
PathRouter.prototype.getUrl = function () {
|
44
|
-
var url = new URL(this.window.document.location.href);
|
45
|
-
return url.pathname + url.search;
|
46
|
-
};
|
47
|
-
PathRouter.prototype.getPath = function () {
|
48
|
-
return this.window.location.pathname;
|
49
|
-
};
|
50
|
-
return PathRouter;
|
51
|
-
}(Router_1.Router));
|
52
|
-
exports.PathRouter = PathRouter;
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
exports.PathRouter = void 0;
|
19
|
+
var Router_1 = require("./Router");
|
20
|
+
var PathRouter = /** @class */ (function (_super) {
|
21
|
+
__extends(PathRouter, _super);
|
22
|
+
function PathRouter() {
|
23
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
24
|
+
}
|
25
|
+
PathRouter.prototype.test = function (urlExpression) {
|
26
|
+
if (this.getPathData(urlExpression)) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
return false;
|
31
|
+
}
|
32
|
+
};
|
33
|
+
PathRouter.prototype.getData = function () {
|
34
|
+
return this.window.history.state;
|
35
|
+
};
|
36
|
+
PathRouter.prototype.getSearchParams = function () {
|
37
|
+
return (new URL(this.window.document.location.href)).searchParams;
|
38
|
+
};
|
39
|
+
PathRouter.prototype.set = function (path, data, title) {
|
40
|
+
if (title === void 0) { title = ''; }
|
41
|
+
this.window.history.pushState(data, title, path);
|
42
|
+
};
|
43
|
+
PathRouter.prototype.getUrl = function () {
|
44
|
+
var url = new URL(this.window.document.location.href);
|
45
|
+
return url.pathname + url.search;
|
46
|
+
};
|
47
|
+
PathRouter.prototype.getPath = function () {
|
48
|
+
return this.window.location.pathname;
|
49
|
+
};
|
50
|
+
return PathRouter;
|
51
|
+
}(Router_1.Router));
|
52
|
+
exports.PathRouter = PathRouter;
|
package/routers/Router.d.ts
CHANGED
@@ -1,22 +1,25 @@
|
|
1
|
-
export declare type RouteData = {
|
2
|
-
path: string;
|
3
|
-
url: string;
|
4
|
-
data?: any;
|
5
|
-
searchParams: URLSearchParams;
|
6
|
-
pathData?: any;
|
7
|
-
};
|
8
|
-
export declare abstract class Router {
|
9
|
-
rootObj: any;
|
10
|
-
window: Window;
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
abstract
|
18
|
-
|
19
|
-
|
20
|
-
abstract
|
21
|
-
abstract
|
22
|
-
|
1
|
+
export declare type RouteData = {
|
2
|
+
path: string;
|
3
|
+
url: string;
|
4
|
+
data?: any;
|
5
|
+
searchParams: URLSearchParams;
|
6
|
+
pathData?: any;
|
7
|
+
};
|
8
|
+
export declare abstract class Router {
|
9
|
+
rootObj: any;
|
10
|
+
window: Window;
|
11
|
+
private attachCallbacks;
|
12
|
+
constructor(rootObj: any, window: Window);
|
13
|
+
addAttachCallback(callback: (routeData: RouteData) => void): void;
|
14
|
+
attach(): void;
|
15
|
+
testRegexp(regexp: string): boolean;
|
16
|
+
abstract test(urlExpression: string): boolean;
|
17
|
+
abstract set(path: string, data?: any, title?: string): void;
|
18
|
+
getRouteData(urlExpression?: string): RouteData;
|
19
|
+
go(path: string, data?: any, title?: string): void;
|
20
|
+
abstract getSearchParams(): URLSearchParams;
|
21
|
+
abstract getData(): any;
|
22
|
+
getPathData(urlExpression: string, currentUrl?: string): any;
|
23
|
+
abstract getUrl(): string;
|
24
|
+
abstract getPath(): string;
|
25
|
+
}
|