dom-render 1.0.91 → 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 (44) 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 +14 -2
  5. package/configs/TargetElement.d.ts +1 -1
  6. package/dist/bundle.js +1189 -835
  7. package/events/EventManager.js +1 -0
  8. package/operators/Dr.d.ts +1 -1
  9. package/operators/Dr.js +58 -17
  10. package/operators/DrAppender.d.ts +1 -1
  11. package/operators/DrAppender.js +61 -21
  12. package/operators/DrFor.d.ts +1 -1
  13. package/operators/DrFor.js +58 -17
  14. package/operators/DrForOf.d.ts +1 -1
  15. package/operators/DrForOf.js +61 -20
  16. package/operators/DrForm.d.ts +1 -1
  17. package/operators/DrForm.js +87 -46
  18. package/operators/DrIf.d.ts +1 -1
  19. package/operators/DrIf.js +62 -23
  20. package/operators/DrInnerHTML.d.ts +1 -1
  21. package/operators/DrInnerHTML.js +56 -15
  22. package/operators/DrInnerText.d.ts +1 -1
  23. package/operators/DrInnerText.js +54 -13
  24. package/operators/DrPre.d.ts +1 -1
  25. package/operators/DrPre.js +41 -1
  26. package/operators/DrRepeat.d.ts +1 -1
  27. package/operators/DrRepeat.js +58 -17
  28. package/operators/DrTargetAttr.d.ts +1 -1
  29. package/operators/DrTargetAttr.js +64 -23
  30. package/operators/DrTargetElement.d.ts +1 -1
  31. package/operators/DrTargetElement.js +78 -34
  32. package/operators/DrThis.d.ts +1 -1
  33. package/operators/DrThis.js +73 -23
  34. package/operators/OperatorExecuter.d.ts +3 -2
  35. package/operators/OperatorExecuter.js +60 -14
  36. package/operators/OperatorExecuterAttrRequire.d.ts +2 -2
  37. package/operators/OperatorExecuterAttrRequire.js +48 -24
  38. package/package.json +1 -1
  39. package/rawsets/RawSet.d.ts +3 -3
  40. package/rawsets/RawSet.js +458 -315
  41. package/routers/HashRouter.js +1 -1
  42. package/routers/PathRouter.js +1 -1
  43. package/routers/Router.d.ts +3 -0
  44. package/routers/Router.js +10 -0
@@ -14,26 +14,45 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
17
53
  Object.defineProperty(exports, "__esModule", { value: true });
18
54
  exports.OperatorExecuterAttrRequire = void 0;
19
55
  var OperatorExecuter_1 = require("./OperatorExecuter");
20
- // export type OperatorAround = {
21
- // beforeAttr?: (value: string, obj: any) => string,
22
- // before?: (data: any, obj: any) => any,
23
- // after?: (data: any, obj: any) => void,
24
- // }
25
- //
26
- // export enum ExecuteState {
27
- // EXECUTE,
28
- // NO_EXECUTE,
29
- // STOP
30
- // }
31
- //
32
- // export type AfterCallBack = {
33
- // onAttrInitCallBacks: AttrInitCallBack[],
34
- // onElementInitCallBacks: ElementInitCallBack[],
35
- // onThisComponentSetCallBacks: ComponentSet[]
36
- // }
37
56
  var OperatorExecuterAttrRequire = /** @class */ (function (_super) {
38
57
  __extends(OperatorExecuterAttrRequire, _super);
39
58
  function OperatorExecuterAttrRequire(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute) {
@@ -41,14 +60,19 @@ var OperatorExecuterAttrRequire = /** @class */ (function (_super) {
41
60
  return _super.call(this, rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute) || this;
42
61
  }
43
62
  ;
44
- // executes(): ExecuteState {
45
- // return ExecuteState.EXECUTE;
46
- // }
47
63
  OperatorExecuterAttrRequire.prototype.execute = function (data) {
48
- if (!this.elementSource.attr) {
49
- return OperatorExecuter_1.ExecuteState.NO_EXECUTE;
50
- }
51
- return this.executeAttrRequire(data);
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ return __generator(this, function (_a) {
66
+ switch (_a.label) {
67
+ case 0:
68
+ if (!this.elementSource.attr) {
69
+ return [2 /*return*/, OperatorExecuter_1.ExecuteState.NO_EXECUTE];
70
+ }
71
+ return [4 /*yield*/, this.executeAttrRequire(data)];
72
+ case 1: return [2 /*return*/, _a.sent()];
73
+ }
74
+ });
75
+ });
52
76
  };
53
77
  return OperatorExecuterAttrRequire;
54
78
  }(OperatorExecuter_1.OperatorExecuter));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dom-render",
3
- "version": "1.0.91",
3
+ "version": "1.0.92",
4
4
  "main": "DomRender.js",
5
5
  "license": "MIT",
6
6
  "description": "html view template engine",
@@ -20,7 +20,7 @@ export declare class RawSet {
20
20
  action: Function;
21
21
  } | undefined;
22
22
  data?: any;
23
- static readonly DR = "dr";
23
+ static readonly DR_NAME = "dr";
24
24
  static readonly DR_IF_NAME = "dr-if";
25
25
  static readonly DR_FOR_NAME = "dr-for";
26
26
  static readonly DR_FOR_OF_NAME = "dr-for-of";
@@ -60,7 +60,7 @@ export declare class RawSet {
60
60
  } | undefined, data?: any);
61
61
  get isConnected(): boolean;
62
62
  getUsingTriggerVariables(config?: Config): Set<string>;
63
- render(obj: any, config: Config): RawSet[];
63
+ render(obj: any, config: Config): Promise<RawSet[]>;
64
64
  static generateStyleSheetsLocal(): void;
65
65
  static generateCSS(id: string, cssRule: CSSRule): void;
66
66
  static generateStyleTransform(styleBody: string | string[], id: string, styleTagWrap?: boolean): string;
@@ -95,7 +95,7 @@ export declare class RawSet {
95
95
  regex: RegExp;
96
96
  random: string;
97
97
  }[]): void;
98
- static drThisCreate(rawSet: RawSet, element: Element, drThis: string, drVarOption: string, drStripOption: boolean | string | null, obj: any, config: Config, set?: ComponentSet): DocumentFragment;
98
+ static drThisCreate(rawSet: RawSet, element: Element, drThis: string, drVarOption: string, drStripOption: boolean | string | null, obj: any, config: Config, set?: ComponentSet): Promise<DocumentFragment>;
99
99
  static createComponentTargetAttribute(name: string, getThisObj: (element: Element, attrValue: string, obj: any, rawSet: RawSet) => any, factory: (element: Element, attrValue: string, obj: any, rawSet: RawSet) => DocumentFragment): TargetAttr;
100
100
  static createComponentTargetElement(name: string, objFactory: (element: Element, obj: any, rawSet: RawSet, counstructorParam: any[]) => any, template?: string, styles?: string[]): TargetElement;
101
101
  static isExporesion(data: string | null): boolean;