dom-render 1.0.98 → 1.0.99

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.
Files changed (202) hide show
  1. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  2. package/.idea/dom-render.iml +9 -0
  3. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  4. package/.idea/jpa-buddy.xml +6 -0
  5. package/.idea/misc.xml +8 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/README.MD +6 -793
  9. package/package.json +1 -1
  10. package/DomRender.d.ts +0 -13
  11. package/DomRender.js +0 -72
  12. package/DomRenderProxy.d.ts +0 -30
  13. package/DomRenderProxy.js +0 -515
  14. package/components/ComponentSet.d.ts +0 -10
  15. package/components/ComponentSet.js +0 -13
  16. package/configs/Config.d.ts +0 -34
  17. package/configs/Config.js +0 -2
  18. package/configs/TargetAttr.d.ts +0 -6
  19. package/configs/TargetAttr.js +0 -2
  20. package/configs/TargetElement.d.ts +0 -14
  21. package/configs/TargetElement.js +0 -2
  22. package/css/parse/index.d.ts +0 -1
  23. package/css/parse/index.js +0 -512
  24. package/css/stringify/compiler.d.ts +0 -32
  25. package/css/stringify/compiler.js +0 -40
  26. package/css/stringify/compress.d.ts +0 -75
  27. package/css/stringify/compress.js +0 -156
  28. package/css/stringify/identity.d.ts +0 -85
  29. package/css/stringify/identity.js +0 -194
  30. package/css/stringify/index.d.ts +0 -14
  31. package/css/stringify/index.js +0 -44
  32. package/dist/bundle.js +0 -5442
  33. package/events/EventManager.d.ts +0 -49
  34. package/events/EventManager.js +0 -529
  35. package/iterators/Range.d.ts +0 -23
  36. package/iterators/Range.js +0 -80
  37. package/lifecycle/OnBeforeReturnGet.d.ts +0 -3
  38. package/lifecycle/OnBeforeReturnGet.js +0 -2
  39. package/lifecycle/OnBeforeReturnSet.d.ts +0 -3
  40. package/lifecycle/OnBeforeReturnSet.js +0 -2
  41. package/lifecycle/OnChangeAttrRender.d.ts +0 -3
  42. package/lifecycle/OnChangeAttrRender.js +0 -2
  43. package/lifecycle/OnCreateRender.d.ts +0 -3
  44. package/lifecycle/OnCreateRender.js +0 -2
  45. package/lifecycle/OnDestroyRender.d.ts +0 -4
  46. package/lifecycle/OnDestroyRender.js +0 -2
  47. package/lifecycle/OnInitRender.d.ts +0 -3
  48. package/lifecycle/OnInitRender.js +0 -2
  49. package/lifecycle/OnProxyDomRender.d.ts +0 -4
  50. package/lifecycle/OnProxyDomRender.js +0 -2
  51. package/managers/RenderManager.d.ts +0 -3
  52. package/managers/RenderManager.js +0 -18
  53. package/messenger/DefaultMessenger.d.ts +0 -3
  54. package/messenger/DefaultMessenger.js +0 -27
  55. package/messenger/Messenger.d.ts +0 -78
  56. package/messenger/Messenger.js +0 -201
  57. package/operators/Appender.d.ts +0 -10
  58. package/operators/Appender.js +0 -64
  59. package/operators/AttrExpresion.d.ts +0 -0
  60. package/operators/AttrExpresion.js +0 -44
  61. package/operators/Dr.d.ts +0 -8
  62. package/operators/Dr.js +0 -101
  63. package/operators/DrAppender.d.ts +0 -8
  64. package/operators/DrAppender.js +0 -105
  65. package/operators/DrFor.d.ts +0 -8
  66. package/operators/DrFor.js +0 -102
  67. package/operators/DrForOf.d.ts +0 -8
  68. package/operators/DrForOf.js +0 -105
  69. package/operators/DrForm.d.ts +0 -8
  70. package/operators/DrForm.js +0 -138
  71. package/operators/DrIf.d.ts +0 -8
  72. package/operators/DrIf.js +0 -106
  73. package/operators/DrInnerHTML.d.ts +0 -8
  74. package/operators/DrInnerHTML.js +0 -99
  75. package/operators/DrInnerText.d.ts +0 -8
  76. package/operators/DrInnerText.js +0 -97
  77. package/operators/DrPre.d.ts +0 -7
  78. package/operators/DrPre.js +0 -71
  79. package/operators/DrRepeat.d.ts +0 -8
  80. package/operators/DrRepeat.js +0 -103
  81. package/operators/DrTargetAttr.d.ts +0 -7
  82. package/operators/DrTargetAttr.js +0 -96
  83. package/operators/DrTargetElement.d.ts +0 -7
  84. package/operators/DrTargetElement.js +0 -112
  85. package/operators/DrThis.d.ts +0 -5
  86. package/operators/DrThis.js +0 -108
  87. package/operators/DrThisProperty.d.ts +0 -10
  88. package/operators/DrThisProperty.js +0 -141
  89. package/operators/OperatorExecuter.d.ts +0 -49
  90. package/operators/OperatorExecuter.js +0 -89
  91. package/operators/OperatorExecuterAttrRequire.d.ts +0 -8
  92. package/operators/OperatorExecuterAttrRequire.js +0 -79
  93. package/rawsets/AttrInitCallBack.d.ts +0 -5
  94. package/rawsets/AttrInitCallBack.js +0 -2
  95. package/rawsets/Attrs.d.ts +0 -24
  96. package/rawsets/Attrs.js +0 -2
  97. package/rawsets/CreatorMetaData.d.ts +0 -18
  98. package/rawsets/CreatorMetaData.js +0 -2
  99. package/rawsets/DestroyOptionType.d.ts +0 -4
  100. package/rawsets/DestroyOptionType.js +0 -8
  101. package/rawsets/ElementInitCallBack.d.ts +0 -8
  102. package/rawsets/ElementInitCallBack.js +0 -2
  103. package/rawsets/RawSet.d.ts +0 -118
  104. package/rawsets/RawSet.js +0 -1142
  105. package/rawsets/RawSetOperatorType.d.ts +0 -3
  106. package/rawsets/RawSetOperatorType.js +0 -7
  107. package/rawsets/RawSetType.d.ts +0 -7
  108. package/rawsets/RawSetType.js +0 -11
  109. package/rawsets/Render.d.ts +0 -17
  110. package/rawsets/Render.js +0 -2
  111. package/routers/HashRouter.d.ts +0 -9
  112. package/routers/HashRouter.js +0 -53
  113. package/routers/PathRouter.d.ts +0 -9
  114. package/routers/PathRouter.js +0 -52
  115. package/routers/Router.d.ts +0 -28
  116. package/routers/Router.js +0 -126
  117. package/types/Types.d.ts +0 -14
  118. package/types/Types.js +0 -36
  119. package/utils/clipboard/ClipBoardUtils.d.ts +0 -6
  120. package/utils/clipboard/ClipBoardUtils.js +0 -25
  121. package/utils/dom/DomUtils.d.ts +0 -13
  122. package/utils/dom/DomUtils.js +0 -47
  123. package/utils/location/LocationUtils.d.ts +0 -16
  124. package/utils/location/LocationUtils.js +0 -63
  125. package/utils/node/NodeUtils.d.ts +0 -10
  126. package/utils/node/NodeUtils.js +0 -27
  127. package/utils/random/RandomUtils.d.ts +0 -7
  128. package/utils/random/RandomUtils.js +0 -47
  129. package/utils/script/ScriptUtils.d.ts +0 -14
  130. package/utils/script/ScriptUtils.js +0 -89
  131. package/utils/storage/StorageUtils.d.ts +0 -16
  132. package/utils/storage/StorageUtils.js +0 -87
  133. package/utils/string/StringUtils.d.ts +0 -6
  134. package/utils/string/StringUtils.js +0 -58
  135. package/utils/valid/ValidUtils.d.ts +0 -10
  136. package/utils/valid/ValidUtils.js +0 -78
  137. package/validators/AllCheckedValidatorArray.d.ts +0 -6
  138. package/validators/AllCheckedValidatorArray.js +0 -32
  139. package/validators/AllUnCheckedValidatorArray.d.ts +0 -6
  140. package/validators/AllUnCheckedValidatorArray.js +0 -32
  141. package/validators/CheckedValidator.d.ts +0 -5
  142. package/validators/CheckedValidator.js +0 -32
  143. package/validators/CountEqualsCheckedValidatorArray.d.ts +0 -7
  144. package/validators/CountEqualsCheckedValidatorArray.js +0 -34
  145. package/validators/CountEqualsUnCheckedValidatorArray.d.ts +0 -7
  146. package/validators/CountEqualsUnCheckedValidatorArray.js +0 -34
  147. package/validators/CountGreaterThanCheckedValidatorArray.d.ts +0 -7
  148. package/validators/CountGreaterThanCheckedValidatorArray.js +0 -34
  149. package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +0 -7
  150. package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +0 -34
  151. package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +0 -7
  152. package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +0 -34
  153. package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +0 -7
  154. package/validators/CountGreaterThanUnCheckedValidatorArray.js +0 -34
  155. package/validators/CountLessThanCheckedValidatorArray.d.ts +0 -7
  156. package/validators/CountLessThanCheckedValidatorArray.js +0 -34
  157. package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +0 -7
  158. package/validators/CountLessThanEqualsCheckedValidatorArray.js +0 -34
  159. package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +0 -7
  160. package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +0 -34
  161. package/validators/CountLessThanUnCheckedValidatorArray.d.ts +0 -7
  162. package/validators/CountLessThanUnCheckedValidatorArray.js +0 -34
  163. package/validators/CountUnCheckedValidatorArray.d.ts +0 -7
  164. package/validators/CountUnCheckedValidatorArray.js +0 -34
  165. package/validators/EmptyValidator.d.ts +0 -5
  166. package/validators/EmptyValidator.js +0 -33
  167. package/validators/ExcludeCheckedValidatorArray.d.ts +0 -8
  168. package/validators/ExcludeCheckedValidatorArray.js +0 -41
  169. package/validators/FormValidator.d.ts +0 -7
  170. package/validators/FormValidator.js +0 -37
  171. package/validators/IncludeCheckedValidatorArray.d.ts +0 -8
  172. package/validators/IncludeCheckedValidatorArray.js +0 -41
  173. package/validators/MultipleValidator.d.ts +0 -8
  174. package/validators/MultipleValidator.js +0 -48
  175. package/validators/NonPassValidator.d.ts +0 -5
  176. package/validators/NonPassValidator.js +0 -31
  177. package/validators/NotEmptyValidator.d.ts +0 -5
  178. package/validators/NotEmptyValidator.js +0 -34
  179. package/validators/NotRegExpTestValidator.d.ts +0 -6
  180. package/validators/NotRegExpTestValidator.js +0 -42
  181. package/validators/PassValidator.d.ts +0 -5
  182. package/validators/PassValidator.js +0 -31
  183. package/validators/RegExpTestValidator.d.ts +0 -6
  184. package/validators/RegExpTestValidator.js +0 -43
  185. package/validators/RequiredValidator.d.ts +0 -5
  186. package/validators/RequiredValidator.js +0 -33
  187. package/validators/UnCheckedValidator.d.ts +0 -5
  188. package/validators/UnCheckedValidator.js +0 -32
  189. package/validators/ValidMultipleValidator.d.ts +0 -9
  190. package/validators/ValidMultipleValidator.js +0 -34
  191. package/validators/ValidValidator.d.ts +0 -6
  192. package/validators/ValidValidator.js +0 -33
  193. package/validators/ValidValidatorArray.d.ts +0 -7
  194. package/validators/ValidValidatorArray.js +0 -33
  195. package/validators/Validator.d.ts +0 -57
  196. package/validators/Validator.js +0 -242
  197. package/validators/ValidatorArray.d.ts +0 -17
  198. package/validators/ValidatorArray.js +0 -99
  199. package/validators/ValueEqualsValidator.d.ts +0 -6
  200. package/validators/ValueEqualsValidator.js +0 -33
  201. package/validators/ValueNotEqualsValidator.d.ts +0 -6
  202. package/validators/ValueNotEqualsValidator.js +0 -33
@@ -1,3 +0,0 @@
1
- export declare enum RawSetOperatorType {
2
- DR_THIS_PROPERTY = "this-property"
3
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RawSetOperatorType = void 0;
4
- var RawSetOperatorType;
5
- (function (RawSetOperatorType) {
6
- RawSetOperatorType["DR_THIS_PROPERTY"] = "this-property";
7
- })(RawSetOperatorType = exports.RawSetOperatorType || (exports.RawSetOperatorType = {}));
@@ -1,7 +0,0 @@
1
- export declare enum RawSetType {
2
- TEXT = "TEXT",
3
- STYLE_TEXT = "STYLE_TEXT",
4
- TARGET_ELEMENT = "TARGET_ELEMENT",
5
- TARGET_ATTR = "TARGET_ATTR",
6
- UNKOWN = "UNKOWN"
7
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RawSetType = void 0;
4
- var RawSetType;
5
- (function (RawSetType) {
6
- RawSetType["TEXT"] = "TEXT";
7
- RawSetType["STYLE_TEXT"] = "STYLE_TEXT";
8
- RawSetType["TARGET_ELEMENT"] = "TARGET_ELEMENT";
9
- RawSetType["TARGET_ATTR"] = "TARGET_ATTR";
10
- RawSetType["UNKOWN"] = "UNKOWN";
11
- })(RawSetType = exports.RawSetType || (exports.RawSetType = {}));
@@ -1,17 +0,0 @@
1
- import { CreatorMetaData } from './CreatorMetaData';
2
- import { Router } from '../routers/Router';
3
- import { RawSet } from './RawSet';
4
- export type Render = {
5
- rawset?: RawSet;
6
- scripts?: {
7
- [n: string]: any;
8
- };
9
- bindScript?: string;
10
- element?: any;
11
- attribute?: any;
12
- creatorMetaData?: CreatorMetaData;
13
- router?: Router;
14
- range?: any;
15
- value?: any;
16
- [n: string]: any;
17
- };
package/rawsets/Render.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
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,53 +0,0 @@
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
- _super.prototype.pushState.call(this, 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,9 +0,0 @@
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,52 +0,0 @@
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
- _super.prototype.pushState.call(this, 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,28 +0,0 @@
1
- export 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
- pushState(data: any, title: string, path: string): void;
21
- dispatchPopStateEvent(): void;
22
- reload(): void;
23
- abstract getSearchParams(): URLSearchParams;
24
- abstract getData(): any;
25
- getPathData(urlExpression: string, currentUrl?: string): any;
26
- abstract getUrl(): string;
27
- abstract getPath(): string;
28
- }
package/routers/Router.js DELETED
@@ -1,126 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.Router = void 0;
15
- var EventManager_1 = require("../events/EventManager");
16
- var Router = /** @class */ (function () {
17
- function Router(rootObj, window) {
18
- this.rootObj = rootObj;
19
- this.window = window;
20
- this.attachCallbacks = new Set();
21
- this.go(this.getUrl());
22
- }
23
- Router.prototype.addAttachCallback = function (callback) {
24
- this.attachCallbacks.add(callback);
25
- };
26
- Router.prototype.attach = function () {
27
- var _this = this;
28
- var proxy = this.rootObj._DomRender_proxy;
29
- if (proxy) {
30
- var key = "___".concat(EventManager_1.EventManager.ROUTER_VARNAME);
31
- proxy.render(key);
32
- }
33
- this.attachCallbacks.forEach(function (it) {
34
- it(_this.getRouteData());
35
- });
36
- };
37
- Router.prototype.testRegexp = function (regexp) {
38
- var b = RegExp(regexp).test(this.getPath());
39
- return b;
40
- };
41
- Router.prototype.getRouteData = function (urlExpression) {
42
- var newVar = {
43
- path: this.getPath(),
44
- url: this.getUrl(),
45
- searchParams: this.getSearchParams()
46
- };
47
- var data = this.getData();
48
- if (data) {
49
- newVar.data = data;
50
- }
51
- if (urlExpression) {
52
- var data_1 = this.getPathData(urlExpression);
53
- if (data_1) {
54
- newVar.pathData = data_1;
55
- }
56
- }
57
- return Object.freeze(newVar);
58
- };
59
- // eslint-disable-next-line no-dupe-class-members
60
- Router.prototype.go = function (path, urlExpressionOrData, dataOrTitle, title) {
61
- // console.log('go-->', path, urlExpressionOrData, dataOrTitle, title);
62
- if (typeof urlExpressionOrData === 'string') {
63
- var pathData = this.getPathData(urlExpressionOrData, path);
64
- if (pathData) {
65
- dataOrTitle = dataOrTitle !== null && dataOrTitle !== void 0 ? dataOrTitle : {};
66
- dataOrTitle = __assign(__assign({}, dataOrTitle), pathData);
67
- }
68
- this.set(path, dataOrTitle, title !== null && title !== void 0 ? title : '');
69
- }
70
- else {
71
- this.set(path, urlExpressionOrData, dataOrTitle !== null && dataOrTitle !== void 0 ? dataOrTitle : '');
72
- }
73
- this.attach();
74
- this.dispatchPopStateEvent();
75
- };
76
- Router.prototype.pushState = function (data, title, path) {
77
- this.window.history.pushState(data, title, path);
78
- };
79
- Router.prototype.dispatchPopStateEvent = function () {
80
- this.window.dispatchEvent(new Event('popstate'));
81
- };
82
- Router.prototype.reload = function () {
83
- this.window.dispatchEvent(new Event('popstate'));
84
- };
85
- Router.prototype.getPathData = function (urlExpression, currentUrl) {
86
- // console.log('getPathData-->', urlExpression, currentUrl);
87
- // const regexps = StringUtils.regexExec(/(\{(?:\{??[^{]*?\}))/g, urlExpression);
88
- // const regexpMap = new Map<string, string>()
89
- // regexps.forEach((item, idx) => {
90
- // const key = `{${idx}}`;
91
- // const value = item[0];
92
- // urlExpression = urlExpression.replace(value, key)
93
- // regexpMap.set(key, value)
94
- // })
95
- if (currentUrl === void 0) { currentUrl = this.getPath(); }
96
- var urls = currentUrl.split('?')[0].split('/');
97
- var urlExpressions = urlExpression.split('/');
98
- if (urls.length !== urlExpressions.length) {
99
- return;
100
- }
101
- var data = {};
102
- for (var i = 0; i < urlExpressions.length; i++) {
103
- var it_1 = urlExpressions[i];
104
- // it = regexpMap.get(it) ?? it;
105
- var urlit = urls[i];
106
- // ex) {serialNo:[0-9]+} or {no} ..
107
- var execResult = /^\{(.+)\}$/g.exec(it_1);
108
- if (!execResult) {
109
- if (it_1 !== urlit) {
110
- return;
111
- }
112
- continue;
113
- }
114
- // regex check
115
- var _a = execResult[1].split(':'), name_1 = _a[0], regex = _a[1]; // group1
116
- var regExp = RegExp(regex);
117
- if (regex && !regExp.test(urlit)) {
118
- return;
119
- }
120
- data[name_1] = urlit;
121
- }
122
- return data;
123
- };
124
- return Router;
125
- }());
126
- exports.Router = Router;
package/types/Types.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export interface ConstructorType<T> {
2
- new (...args: any[]): T;
3
- }
4
- export declare class Shield {
5
- [name: string]: any;
6
- }
7
- export declare class DomRenderFinalProxy<T extends object> implements ProxyHandler<T> {
8
- set(target: T, p: string | symbol, value: any, receiver: any): boolean;
9
- get(target: T, p: string | symbol, receiver: any): any;
10
- static final<T = any>(obj: T): T;
11
- static isFinal<T = any>(obj: T): boolean;
12
- static unFinal<T = any>(obj: T): T;
13
- has(target: T, p: string | symbol): boolean;
14
- }
package/types/Types.js DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DomRenderFinalProxy = exports.Shield = void 0;
4
- var Shield = /** @class */ (function () {
5
- function Shield() {
6
- }
7
- return Shield;
8
- }());
9
- exports.Shield = Shield;
10
- var DomRenderFinalProxy = /** @class */ (function () {
11
- function DomRenderFinalProxy() {
12
- }
13
- DomRenderFinalProxy.prototype.set = function (target, p, value, receiver) {
14
- target[p] = value;
15
- return true;
16
- };
17
- DomRenderFinalProxy.prototype.get = function (target, p, receiver) {
18
- return target[p];
19
- };
20
- DomRenderFinalProxy.final = function (obj) {
21
- obj._DomRender_isFinal = true;
22
- return obj;
23
- };
24
- DomRenderFinalProxy.isFinal = function (obj) {
25
- return '_DomRender_isFinal' in obj;
26
- };
27
- DomRenderFinalProxy.unFinal = function (obj) {
28
- delete obj._DomRender_isFinal;
29
- return obj;
30
- };
31
- DomRenderFinalProxy.prototype.has = function (target, p) {
32
- return p === '_DomRender_isFinal' || p in target;
33
- };
34
- return DomRenderFinalProxy;
35
- }());
36
- exports.DomRenderFinalProxy = DomRenderFinalProxy;
@@ -1,6 +0,0 @@
1
- export declare class ClipBoardUtils {
2
- static readText(clipboard?: Clipboard): Promise<string>;
3
- static read(clipboard?: Clipboard): Promise<ClipboardItems>;
4
- static writeText(data: string, clipboard?: Clipboard): Promise<void>;
5
- static write(data: ClipboardItems, clipboard?: Clipboard): Promise<void>;
6
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClipBoardUtils = void 0;
4
- var ClipBoardUtils = /** @class */ (function () {
5
- function ClipBoardUtils() {
6
- }
7
- ClipBoardUtils.readText = function (clipboard) {
8
- if (clipboard === void 0) { clipboard = navigator.clipboard; }
9
- return clipboard.readText();
10
- };
11
- ClipBoardUtils.read = function (clipboard) {
12
- if (clipboard === void 0) { clipboard = navigator.clipboard; }
13
- return clipboard.read();
14
- };
15
- ClipBoardUtils.writeText = function (data, clipboard) {
16
- if (clipboard === void 0) { clipboard = navigator.clipboard; }
17
- return clipboard.writeText(data);
18
- };
19
- ClipBoardUtils.write = function (data, clipboard) {
20
- if (clipboard === void 0) { clipboard = navigator.clipboard; }
21
- return clipboard.write(data);
22
- };
23
- return ClipBoardUtils;
24
- }());
25
- exports.ClipBoardUtils = ClipBoardUtils;
@@ -1,13 +0,0 @@
1
- export type Attr = {
2
- name: string;
3
- value: any;
4
- };
5
- export declare class DomUtils {
6
- static selectorElements(selector: string, element?: Element | Document): Element[];
7
- static selectorNodes(selector: string, element?: Element | Document): NodeListOf<Element>;
8
- static removeAttribute(result: Element, attrs: string[]): void;
9
- static setAttribute(result: Element, attrs: string[]): void;
10
- static setAttributeAttr(result: Element, attrs: Attr[]): void;
11
- static getAttributeToObject(input: Element): any;
12
- static getStyleToObject(input: HTMLElement): any;
13
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DomUtils = void 0;
4
- var DomUtils = /** @class */ (function () {
5
- function DomUtils() {
6
- }
7
- DomUtils.selectorElements = function (selector, element) {
8
- if (element === void 0) { element = document; }
9
- return Array.prototype.slice.call(element.querySelectorAll(selector));
10
- };
11
- DomUtils.selectorNodes = function (selector, element) {
12
- if (element === void 0) { element = document; }
13
- return element.querySelectorAll(selector);
14
- };
15
- DomUtils.removeAttribute = function (result, attrs) {
16
- attrs.forEach(function (it) {
17
- result.removeAttribute(it);
18
- });
19
- };
20
- DomUtils.setAttribute = function (result, attrs) {
21
- attrs.forEach(function (it) {
22
- result.setAttribute(it, '');
23
- });
24
- };
25
- DomUtils.setAttributeAttr = function (result, attrs) {
26
- attrs.forEach(function (it) {
27
- result.setAttribute(it.name, it.value);
28
- });
29
- };
30
- DomUtils.getAttributeToObject = function (input) {
31
- var attribute = {};
32
- input.getAttributeNames().forEach(function (ait) {
33
- attribute[ait] = input.getAttribute(ait);
34
- });
35
- return attribute;
36
- };
37
- DomUtils.getStyleToObject = function (input) {
38
- var style = {};
39
- for (var i = 0; i < input.style.length; i++) {
40
- var key = input.style[i];
41
- style[key] = input.style[key];
42
- }
43
- return style;
44
- };
45
- return DomUtils;
46
- }());
47
- exports.DomUtils = DomUtils;
@@ -1,16 +0,0 @@
1
- export declare class LocationUtils {
2
- static hash(window: Window): string;
3
- static hashPath(window: Window): string;
4
- static hashSearch(window: Window): string;
5
- static hashQueryParams(window: Window): Map<string, string>;
6
- static path(window: Window): string;
7
- static pathQueryParamsObject(window: Window): {
8
- [key: string]: string;
9
- };
10
- static hashQueryParamsObject(window: Window): {
11
- [key: string]: string;
12
- };
13
- static pathQueryParams(window: Window): Map<string, string>;
14
- private static queryStringToMap;
15
- private static queryStringToObject;
16
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocationUtils = void 0;
4
- var LocationUtils = /** @class */ (function () {
5
- function LocationUtils() {
6
- }
7
- LocationUtils.hash = function (window) {
8
- return window.location.hash.replace('#', '');
9
- };
10
- LocationUtils.hashPath = function (window) {
11
- return window.location.hash.replace('#', '').split('?')[0];
12
- };
13
- LocationUtils.hashSearch = function (window) {
14
- return window.location.hash.replace('#', '').split('?')[1];
15
- };
16
- LocationUtils.hashQueryParams = function (window) {
17
- var s = window.location.hash.replace('#', '').split('?')[1] || '';
18
- return this.queryStringToMap(s);
19
- };
20
- LocationUtils.path = function (window) {
21
- return window.location.pathname;
22
- };
23
- LocationUtils.pathQueryParamsObject = function (window) {
24
- return this.queryStringToObject(window.location.search.substring(1));
25
- };
26
- LocationUtils.hashQueryParamsObject = function (window) {
27
- var _a;
28
- var s = (_a = window.location.hash.split('?').pop()) !== null && _a !== void 0 ? _a : '';
29
- if (s.startsWith('#')) {
30
- return {};
31
- }
32
- else {
33
- return this.queryStringToObject(s);
34
- }
35
- };
36
- LocationUtils.pathQueryParams = function (window) {
37
- return this.queryStringToMap(window.location.search.substring(1));
38
- };
39
- LocationUtils.queryStringToMap = function (s) {
40
- var params = new Map();
41
- var vars = s.split('&') || [];
42
- vars.forEach(function (it) {
43
- var kv = it.split('=') || [];
44
- if (kv[0] && kv[0].length > 0) {
45
- params.set(kv[0], kv[1]);
46
- }
47
- });
48
- return params;
49
- };
50
- LocationUtils.queryStringToObject = function (s) {
51
- var params = {};
52
- var vars = s.split('&') || [];
53
- vars.forEach(function (it) {
54
- var kv = it.split('=') || [];
55
- if (kv[0] && kv[0].length > 0) {
56
- params[kv[0]] = kv[1];
57
- }
58
- });
59
- return params;
60
- };
61
- return LocationUtils;
62
- }());
63
- exports.LocationUtils = LocationUtils;
@@ -1,10 +0,0 @@
1
- export type Attr = {
2
- name: string;
3
- value: any;
4
- };
5
- export declare class NodeUtils {
6
- static removeAllChildNode(node: Node): void;
7
- static appendChild(parentNode: Node, childNode: Node): Node;
8
- static replaceNode(targetNode: Node, newNode: Node): Node | undefined;
9
- static addNode(targetNode: Node, newNode: Node): Node | undefined;
10
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeUtils = void 0;
4
- var NodeUtils = /** @class */ (function () {
5
- function NodeUtils() {
6
- }
7
- // https://stackoverflow.com/questions/3955229/remove-all-child-elements-of-a-dom-node-in-javascript
8
- NodeUtils.removeAllChildNode = function (node) {
9
- while (node === null || node === void 0 ? void 0 : node.firstChild) {
10
- node.firstChild.remove();
11
- }
12
- };
13
- NodeUtils.appendChild = function (parentNode, childNode) {
14
- return parentNode.appendChild(childNode);
15
- };
16
- NodeUtils.replaceNode = function (targetNode, newNode) {
17
- var _a;
18
- // console.log('repalceNode', targetNode, newNode, targetNode.parentNode)
19
- return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(newNode, targetNode);
20
- };
21
- NodeUtils.addNode = function (targetNode, newNode) {
22
- var _a;
23
- return (_a = targetNode.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(newNode, targetNode.nextSibling);
24
- };
25
- return NodeUtils;
26
- }());
27
- exports.NodeUtils = NodeUtils;
@@ -1,7 +0,0 @@
1
- export declare class RandomUtils {
2
- static readonly d = "";
3
- static random(min?: number, max?: number): number;
4
- static uuid(format?: string): string;
5
- static getRandomColor(): string;
6
- static getRandomString(len: number): string;
7
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RandomUtils = void 0;
4
- var ValidUtils_1 = require("../valid/ValidUtils");
5
- var RandomUtils = /** @class */ (function () {
6
- function RandomUtils() {
7
- }
8
- RandomUtils.random = function (min, max) {
9
- if (ValidUtils_1.ValidUtils.isNullOrUndefined(min)) {
10
- return Math.random();
11
- }
12
- else if (!ValidUtils_1.ValidUtils.isNullOrUndefined(min) && ValidUtils_1.ValidUtils.isNullOrUndefined(max)) {
13
- return Math.random() * (min || 0);
14
- }
15
- else {
16
- return Math.random() * ((max || 0) - (min || 0)) + (min || 0);
17
- }
18
- };
19
- RandomUtils.uuid = function (format) {
20
- if (format === void 0) { format = 'xxxx-xxxx-xxxx-xxxx'; }
21
- return format.replace(/[xy]/g, function (c) {
22
- var r = Math.random() * 16 | 0;
23
- var v = c === 'x' ? r : (r & 0x3 | 0x8);
24
- return v.toString(16);
25
- });
26
- };
27
- RandomUtils.getRandomColor = function () {
28
- var letters = '0123456789ABCDEF'.split('');
29
- var color = '#';
30
- for (var i = 0; i < 6; i++) {
31
- color += letters[Math.floor(Math.random() * 16)];
32
- }
33
- return color;
34
- };
35
- // (Math.random().toString(36)+'00000000000000000').slice(2, 10) + Date.now()
36
- RandomUtils.getRandomString = function (len) {
37
- var letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
38
- var color = '';
39
- for (var i = 0; i < len; i++) {
40
- color += letters[Math.floor(Math.random() * letters.length)];
41
- }
42
- return color;
43
- };
44
- RandomUtils.d = '';
45
- return RandomUtils;
46
- }());
47
- exports.RandomUtils = RandomUtils;