dom-render 1.0.91 → 1.0.93

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/DomRender.js +5 -1
  2. package/DomRenderProxy.d.ts +1 -1
  3. package/DomRenderProxy.js +126 -68
  4. package/README.MD +14 -2
  5. package/components/ComponentSet.d.ts +1 -1
  6. package/configs/Config.d.ts +4 -1
  7. package/configs/TargetAttr.d.ts +1 -1
  8. package/configs/TargetElement.d.ts +2 -2
  9. package/dist/bundle.js +1226 -941
  10. package/events/EventManager.d.ts +1 -0
  11. package/events/EventManager.js +43 -54
  12. package/messenger/Messenger.d.ts +4 -4
  13. package/operators/Dr.d.ts +1 -1
  14. package/operators/Dr.js +58 -17
  15. package/operators/DrAppender.d.ts +1 -1
  16. package/operators/DrAppender.js +62 -24
  17. package/operators/DrFor.d.ts +1 -1
  18. package/operators/DrFor.js +59 -20
  19. package/operators/DrForOf.d.ts +1 -1
  20. package/operators/DrForOf.js +62 -23
  21. package/operators/DrForm.d.ts +1 -1
  22. package/operators/DrForm.js +87 -46
  23. package/operators/DrIf.d.ts +1 -1
  24. package/operators/DrIf.js +63 -26
  25. package/operators/DrInnerHTML.d.ts +1 -1
  26. package/operators/DrInnerHTML.js +56 -15
  27. package/operators/DrInnerText.d.ts +1 -1
  28. package/operators/DrInnerText.js +54 -13
  29. package/operators/DrPre.d.ts +1 -1
  30. package/operators/DrPre.js +42 -4
  31. package/operators/DrRepeat.d.ts +1 -1
  32. package/operators/DrRepeat.js +59 -20
  33. package/operators/DrTargetAttr.d.ts +1 -1
  34. package/operators/DrTargetAttr.js +65 -26
  35. package/operators/DrTargetElement.d.ts +1 -1
  36. package/operators/DrTargetElement.js +79 -37
  37. package/operators/DrThis.d.ts +1 -1
  38. package/operators/DrThis.js +73 -23
  39. package/operators/OperatorExecuter.d.ts +8 -7
  40. package/operators/OperatorExecuter.js +60 -14
  41. package/operators/OperatorExecuterAttrRequire.d.ts +2 -2
  42. package/operators/OperatorExecuterAttrRequire.js +48 -24
  43. package/package.json +1 -1
  44. package/rawsets/AttrInitCallBack.d.ts +1 -1
  45. package/rawsets/Attrs.d.ts +1 -1
  46. package/rawsets/CreatorMetaData.d.ts +1 -1
  47. package/rawsets/ElementInitCallBack.d.ts +1 -1
  48. package/rawsets/RawSet.d.ts +3 -3
  49. package/rawsets/RawSet.js +458 -315
  50. package/rawsets/Render.d.ts +1 -1
  51. package/routers/HashRouter.js +1 -1
  52. package/routers/PathRouter.js +1 -1
  53. package/routers/Router.d.ts +4 -1
  54. package/routers/Router.js +10 -0
  55. package/utils/dom/DomUtils.d.ts +1 -1
  56. package/utils/node/NodeUtils.d.ts +1 -1
  57. package/validators/EmptyValidator.js +2 -2
  58. package/validators/NotEmptyValidator.js +2 -2
  59. package/validators/ValidMultipleValidator.d.ts +1 -1
  60. package/validators/Validator.d.ts +2 -2
  61. package/validators/ValidatorArray.d.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  import { CreatorMetaData } from './CreatorMetaData';
2
2
  import { Router } from '../routers/Router';
3
3
  import { RawSet } from './RawSet';
4
- export declare type Render = {
4
+ export type Render = {
5
5
  rawset?: RawSet;
6
6
  scripts?: {
7
7
  [n: string]: any;
@@ -40,7 +40,7 @@ var HashRouter = /** @class */ (function (_super) {
40
40
  HashRouter.prototype.set = function (path, data, title) {
41
41
  if (title === void 0) { title = ''; }
42
42
  path = '#' + path;
43
- this.window.history.pushState(data, title, path);
43
+ _super.prototype.pushState.call(this, data, title, path);
44
44
  };
45
45
  HashRouter.prototype.getUrl = function () {
46
46
  return LocationUtils_1.LocationUtils.hash(this.window) || '/';
@@ -38,7 +38,7 @@ var PathRouter = /** @class */ (function (_super) {
38
38
  };
39
39
  PathRouter.prototype.set = function (path, data, title) {
40
40
  if (title === void 0) { title = ''; }
41
- this.window.history.pushState(data, title, path);
41
+ _super.prototype.pushState.call(this, data, title, path);
42
42
  };
43
43
  PathRouter.prototype.getUrl = function () {
44
44
  var url = new URL(this.window.document.location.href);
@@ -1,4 +1,4 @@
1
- export declare type RouteData = {
1
+ export type RouteData = {
2
2
  path: string;
3
3
  url: string;
4
4
  data?: any;
@@ -17,6 +17,9 @@ export declare abstract class Router {
17
17
  abstract set(path: string, data?: any, title?: string): void;
18
18
  getRouteData(urlExpression?: string): RouteData;
19
19
  go(path: string, data?: any, title?: string): void;
20
+ pushState(data: any, title: string, path: string): void;
21
+ dispatchPopStateEvent(): void;
22
+ reload(): void;
20
23
  abstract getSearchParams(): URLSearchParams;
21
24
  abstract getData(): any;
22
25
  getPathData(urlExpression: string, currentUrl?: string): any;
package/routers/Router.js CHANGED
@@ -71,6 +71,16 @@ var Router = /** @class */ (function () {
71
71
  this.set(path, urlExpressionOrData, dataOrTitle !== null && dataOrTitle !== void 0 ? dataOrTitle : '');
72
72
  }
73
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'));
74
84
  };
75
85
  Router.prototype.getPathData = function (urlExpression, currentUrl) {
76
86
  // console.log('getPathData-->', urlExpression, currentUrl);
@@ -1,4 +1,4 @@
1
- export declare type Attr = {
1
+ export type Attr = {
2
2
  name: string;
3
3
  value: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type Attr = {
1
+ export type Attr = {
2
2
  name: string;
3
3
  value: any;
4
4
  };
@@ -24,9 +24,9 @@ var EmptyValidator = /** @class */ (function (_super) {
24
24
  return _super.call(this, value, target, event, autoValid) || this;
25
25
  }
26
26
  EmptyValidator.prototype.valid = function () {
27
- var _a, _b;
27
+ var _a;
28
28
  var value = this.value;
29
- return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
29
+ return value === undefined || value === null || ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) <= 0;
30
30
  };
31
31
  return EmptyValidator;
32
32
  }(Validator_1.Validator));
@@ -24,10 +24,10 @@ var NotEmptyValidator = /** @class */ (function (_super) {
24
24
  return _super.call(this, value, target, event, autoValid) || this;
25
25
  }
26
26
  NotEmptyValidator.prototype.valid = function () {
27
- var _a, _b;
27
+ var _a;
28
28
  var value = this.value;
29
29
  // console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
30
- return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
30
+ return value !== undefined && value !== null && ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) > 0;
31
31
  };
32
32
  return NotEmptyValidator;
33
33
  }(Validator_1.Validator));
@@ -1,6 +1,6 @@
1
1
  import { Validator } from './Validator';
2
2
  import { MultipleValidator } from './MultipleValidator';
3
- export declare type ValidMulltiple<T = any, E = Element> = (validators: Validator<T, E>[], value?: T, target?: E, event?: Event) => boolean;
3
+ export type ValidMulltiple<T = any, E = Element> = (validators: Validator<T, E>[], value?: T, target?: E, event?: Event) => boolean;
4
4
  export declare class ValidMultipleValidator<T = any, E = Element> extends MultipleValidator<T, E> {
5
5
  validMultipleCallback: ValidMulltiple<T, E>;
6
6
  validators: Validator<T, E>[];
@@ -1,5 +1,5 @@
1
- export declare type Valid<T = any, E = Element> = (value?: T, target?: E, event?: Event) => boolean;
2
- export declare type ValidAction<T = any, E = Element> = (valid: boolean, value?: T, target?: E, event?: Event) => void;
1
+ export type Valid<T = any, E = Element> = (value?: T, target?: E, event?: Event) => boolean;
2
+ export type ValidAction<T = any, E = Element> = (valid: boolean, value?: T, target?: E, event?: Event) => void;
3
3
  export declare abstract class Validator<T = any, E = Element> {
4
4
  protected _value?: T | undefined;
5
5
  private _target?;
@@ -1,5 +1,5 @@
1
1
  import { Validator } from './Validator';
2
- export declare type MakeValidator<T = any, E = Element> = (value: T, target: E, event?: Event) => Validator<T, E>;
2
+ export type MakeValidator<T = any, E = Element> = (value: T, target: E, event?: Event) => Validator<T, E>;
3
3
  export declare abstract class ValidatorArray<T = any, E = Element> extends Validator<Validator<T, E>[], E> {
4
4
  private _makeValidatorFactory;
5
5
  constructor(value?: Validator<T, E>[], target?: E, event?: Event, autoValid?: boolean);