dom-render 1.0.90 → 1.0.92

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 (49) hide show
  1. package/DomRender.js +5 -1
  2. package/DomRenderProxy.d.ts +1 -1
  3. package/DomRenderProxy.js +121 -63
  4. package/README.MD +15 -3
  5. package/components/ComponentSet.d.ts +5 -2
  6. package/components/ComponentSet.js +2 -3
  7. package/configs/Config.d.ts +5 -0
  8. package/configs/TargetElement.d.ts +1 -1
  9. package/dist/bundle.js +1337 -968
  10. package/events/EventManager.js +1 -0
  11. package/operators/Dr.d.ts +7 -3
  12. package/operators/Dr.js +64 -25
  13. package/operators/DrAppender.d.ts +7 -3
  14. package/operators/DrAppender.js +70 -28
  15. package/operators/DrFor.d.ts +7 -3
  16. package/operators/DrFor.js +67 -25
  17. package/operators/DrForOf.d.ts +7 -3
  18. package/operators/DrForOf.js +70 -28
  19. package/operators/DrForm.d.ts +7 -3
  20. package/operators/DrForm.js +93 -55
  21. package/operators/DrIf.d.ts +7 -3
  22. package/operators/DrIf.js +71 -35
  23. package/operators/DrInnerHTML.d.ts +7 -3
  24. package/operators/DrInnerHTML.js +62 -23
  25. package/operators/DrInnerText.d.ts +7 -3
  26. package/operators/DrInnerText.js +60 -21
  27. package/operators/DrPre.d.ts +6 -3
  28. package/operators/DrPre.js +49 -6
  29. package/operators/DrRepeat.d.ts +7 -3
  30. package/operators/DrRepeat.js +67 -25
  31. package/operators/DrTargetAttr.d.ts +6 -3
  32. package/operators/DrTargetAttr.js +72 -29
  33. package/operators/DrTargetElement.d.ts +6 -3
  34. package/operators/DrTargetElement.js +86 -64
  35. package/operators/DrThis.d.ts +4 -3
  36. package/operators/DrThis.js +77 -33
  37. package/operators/OperatorExecuter.d.ts +49 -0
  38. package/operators/OperatorExecuter.js +89 -0
  39. package/operators/OperatorExecuterAttrRequire.d.ts +8 -0
  40. package/operators/OperatorExecuterAttrRequire.js +79 -0
  41. package/package.json +1 -1
  42. package/rawsets/RawSet.d.ts +4 -4
  43. package/rawsets/RawSet.js +460 -317
  44. package/routers/HashRouter.js +1 -1
  45. package/routers/PathRouter.js +1 -1
  46. package/routers/Router.d.ts +3 -0
  47. package/routers/Router.js +10 -0
  48. package/operators/OperatorRender.d.ts +0 -45
  49. package/operators/OperatorRender.js +0 -21
@@ -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);
@@ -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,45 +0,0 @@
1
- import { RawSet } from '../rawsets/RawSet';
2
- import { ComponentSet } from '../components/ComponentSet';
3
- import { Config } from '../configs/Config';
4
- import { Attrs } from '../rawsets/Attrs';
5
- import { AttrInitCallBack } from '../rawsets/AttrInitCallBack';
6
- import { ElementInitCallBack } from '../rawsets/ElementInitCallBack';
7
- import { Render } from '../rawsets/Render';
8
- export declare enum ExecuteState {
9
- EXECUTE = 0,
10
- NO_EXECUTE = 1,
11
- STOP = 2
12
- }
13
- export declare type AfterCallBack = {
14
- onAttrInitCallBacks: AttrInitCallBack[];
15
- onElementInitCallBacks: ElementInitCallBack[];
16
- onThisComponentSetCallBacks: ComponentSet[];
17
- };
18
- export declare abstract class OperatorRender {
19
- rawSet: RawSet;
20
- render: Render;
21
- returnContainer: {
22
- raws: RawSet[];
23
- fag: DocumentFragment;
24
- };
25
- elementSource: {
26
- element: Element;
27
- attrs: Attrs;
28
- };
29
- source: {
30
- config: Config;
31
- obj: any;
32
- };
33
- afterCallBack: AfterCallBack;
34
- constructor(rawSet: RawSet, render: Render, returnContainer: {
35
- raws: RawSet[];
36
- fag: DocumentFragment;
37
- }, elementSource: {
38
- element: Element;
39
- attrs: Attrs;
40
- }, source: {
41
- config: Config;
42
- obj: any;
43
- }, afterCallBack: AfterCallBack);
44
- abstract execRender(): ExecuteState;
45
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OperatorRender = exports.ExecuteState = void 0;
4
- var ExecuteState;
5
- (function (ExecuteState) {
6
- ExecuteState[ExecuteState["EXECUTE"] = 0] = "EXECUTE";
7
- ExecuteState[ExecuteState["NO_EXECUTE"] = 1] = "NO_EXECUTE";
8
- ExecuteState[ExecuteState["STOP"] = 2] = "STOP";
9
- })(ExecuteState = exports.ExecuteState || (exports.ExecuteState = {}));
10
- var OperatorRender = /** @class */ (function () {
11
- function OperatorRender(rawSet, render, returnContainer, elementSource, source, afterCallBack) {
12
- this.rawSet = rawSet;
13
- this.render = render;
14
- this.returnContainer = returnContainer;
15
- this.elementSource = elementSource;
16
- this.source = source;
17
- this.afterCallBack = afterCallBack;
18
- }
19
- return OperatorRender;
20
- }());
21
- exports.OperatorRender = OperatorRender;