dom-render 1.0.95 → 1.0.97

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/DomRender.d.ts +1 -1
  2. package/DomRender.js +3 -3
  3. package/DomRenderProxy.js +24 -30
  4. package/README.MD +41 -0
  5. package/components/ComponentSet.d.ts +1 -1
  6. package/configs/Config.d.ts +1 -1
  7. package/configs/TargetAttr.d.ts +1 -1
  8. package/configs/TargetElement.d.ts +1 -1
  9. package/css/parse/index.d.ts +1 -0
  10. package/css/parse/index.js +512 -0
  11. package/css/stringify/compiler.d.ts +32 -0
  12. package/css/stringify/compiler.js +40 -0
  13. package/css/stringify/compress.d.ts +75 -0
  14. package/css/stringify/compress.js +156 -0
  15. package/css/stringify/identity.d.ts +85 -0
  16. package/css/stringify/identity.js +194 -0
  17. package/css/stringify/index.d.ts +14 -0
  18. package/css/stringify/index.js +44 -0
  19. package/dist/bundle.js +1138 -385
  20. package/events/EventManager.js +27 -27
  21. package/iterators/Range.d.ts +1 -0
  22. package/iterators/Range.js +15 -0
  23. package/messenger/Messenger.d.ts +4 -4
  24. package/operators/Dr.js +2 -2
  25. package/operators/DrAppender.js +5 -3
  26. package/operators/DrFor.js +5 -3
  27. package/operators/DrForOf.js +5 -3
  28. package/operators/DrForm.js +12 -12
  29. package/operators/DrIf.js +5 -3
  30. package/operators/DrInnerHTML.js +2 -2
  31. package/operators/DrInnerText.js +2 -2
  32. package/operators/DrPre.js +4 -2
  33. package/operators/DrRepeat.js +5 -3
  34. package/operators/DrTargetAttr.js +4 -2
  35. package/operators/DrTargetElement.js +5 -3
  36. package/operators/DrThis.js +2 -2
  37. package/operators/{DrDictionary.d.ts → DrThisProperty.d.ts} +1 -2
  38. package/operators/{DrDictionary.js → DrThisProperty.js} +19 -42
  39. package/operators/OperatorExecuter.d.ts +5 -5
  40. package/operators/OperatorExecuter.js +2 -2
  41. package/operators/OperatorExecuterAttrRequire.js +1 -1
  42. package/package.json +3 -3
  43. package/rawsets/AttrInitCallBack.d.ts +1 -1
  44. package/rawsets/Attrs.d.ts +4 -3
  45. package/rawsets/CreatorMetaData.d.ts +1 -1
  46. package/rawsets/ElementInitCallBack.d.ts +1 -1
  47. package/rawsets/RawSet.d.ts +19 -7
  48. package/rawsets/RawSet.js +144 -73
  49. package/rawsets/RawSetOperatorType.d.ts +3 -0
  50. package/rawsets/RawSetOperatorType.js +7 -0
  51. package/rawsets/Render.d.ts +1 -1
  52. package/routers/Router.d.ts +1 -1
  53. package/routers/Router.js +1 -1
  54. package/utils/dom/DomUtils.d.ts +1 -1
  55. package/utils/node/NodeUtils.d.ts +1 -1
  56. package/utils/script/ScriptUtils.js +2 -2
  57. package/utils/storage/StorageUtils.d.ts +7 -0
  58. package/utils/storage/StorageUtils.js +39 -0
  59. package/utils/string/StringUtils.d.ts +1 -0
  60. package/utils/string/StringUtils.js +17 -0
  61. package/validators/EmptyValidator.js +2 -2
  62. package/validators/NotEmptyValidator.js +2 -2
  63. package/validators/ValidMultipleValidator.d.ts +1 -1
  64. package/validators/Validator.d.ts +2 -2
  65. package/validators/ValidatorArray.d.ts +1 -1
@@ -33,7 +33,7 @@ var ScriptUtils = /** @class */ (function () {
33
33
  }, new GetDetectProxy());
34
34
  try {
35
35
  // eslint-disable-next-line no-new-func,no-unused-expressions
36
- Function("\"use strict\"; ".concat(script, "; ")).bind(destUser)();
36
+ Function("\"use strict\"; " + script + "; ").bind(destUser)();
37
37
  }
38
38
  catch (e) {
39
39
  console.error(e);
@@ -49,7 +49,7 @@ var ScriptUtils = /** @class */ (function () {
49
49
  };
50
50
  ScriptUtils.eval = function (script, thisTarget) {
51
51
  // eslint-disable-next-line no-new-func,no-unused-expressions
52
- return Function("\"use strict\"; ".concat(script, " ")).bind(thisTarget)();
52
+ return Function("\"use strict\"; " + script + " ").bind(thisTarget)();
53
53
  };
54
54
  ScriptUtils.loadElement = function (name, attribute, document) {
55
55
  return new Promise(function (resolve, reject) {
@@ -1,9 +1,16 @@
1
1
  export declare class StorageUtils {
2
2
  static setLocalStorageItem(k: string, v: string | any, window: Window): void;
3
+ static setSessionStorageItem(k: string, v: string | any, window: Window): void;
3
4
  static getLocalStorageItem(k: string, window: Window): string | null;
5
+ static getSessionStorageItem(k: string, window: Window): string | null;
4
6
  static cutLocalStorageItem(k: string, window: Window): string | null;
7
+ static cutSessionStorageItem(k: string, window: Window): string | null;
5
8
  static removeLocalStorageItem(k: string, window: Window): void;
9
+ static removeSessionStorageItem(k: string, window: Window): void;
6
10
  static getLocalStorageJsonItem<T>(k: string, window: Window): T | undefined;
11
+ static getSessionStorageJsonItem<T>(k: string, window: Window): T | undefined;
7
12
  static cutLocalStorageJsonItem<T>(k: string, window: Window): T | undefined;
13
+ static cutSessionStorageJsonItem<T>(k: string, window: Window): T | undefined;
8
14
  static clearLocalStorage(window: Window): void;
15
+ static clearSessionStorage(window: Window): void;
9
16
  }
@@ -10,17 +10,34 @@ var StorageUtils = /** @class */ (function () {
10
10
  }
11
11
  window.localStorage.setItem(k, v);
12
12
  };
13
+ StorageUtils.setSessionStorageItem = function (k, v, window) {
14
+ if (typeof v === 'object') {
15
+ v = JSON.stringify(v);
16
+ }
17
+ window.sessionStorage.setItem(k, v);
18
+ };
13
19
  StorageUtils.getLocalStorageItem = function (k, window) {
14
20
  return window.localStorage.getItem(k);
15
21
  };
22
+ StorageUtils.getSessionStorageItem = function (k, window) {
23
+ return window.sessionStorage.getItem(k);
24
+ };
16
25
  StorageUtils.cutLocalStorageItem = function (k, window) {
17
26
  var data = StorageUtils.getLocalStorageItem(k, window);
18
27
  StorageUtils.removeLocalStorageItem(k, window);
19
28
  return data;
20
29
  };
30
+ StorageUtils.cutSessionStorageItem = function (k, window) {
31
+ var data = StorageUtils.getSessionStorageItem(k, window);
32
+ StorageUtils.removeSessionStorageItem(k, window);
33
+ return data;
34
+ };
21
35
  StorageUtils.removeLocalStorageItem = function (k, window) {
22
36
  return window.localStorage.removeItem(k);
23
37
  };
38
+ StorageUtils.removeSessionStorageItem = function (k, window) {
39
+ return window.sessionStorage.removeItem(k);
40
+ };
24
41
  StorageUtils.getLocalStorageJsonItem = function (k, window) {
25
42
  var item = window.localStorage.getItem(k);
26
43
  if (item) {
@@ -35,14 +52,36 @@ var StorageUtils = /** @class */ (function () {
35
52
  return undefined;
36
53
  }
37
54
  };
55
+ StorageUtils.getSessionStorageJsonItem = function (k, window) {
56
+ var item = window.sessionStorage.getItem(k);
57
+ if (item) {
58
+ try {
59
+ return JSON.parse(item);
60
+ }
61
+ catch (e) {
62
+ return undefined;
63
+ }
64
+ }
65
+ else {
66
+ return undefined;
67
+ }
68
+ };
38
69
  StorageUtils.cutLocalStorageJsonItem = function (k, window) {
39
70
  var item = StorageUtils.getLocalStorageJsonItem(k, window);
40
71
  StorageUtils.removeLocalStorageItem(k, window);
41
72
  return item;
42
73
  };
74
+ StorageUtils.cutSessionStorageJsonItem = function (k, window) {
75
+ var item = StorageUtils.getSessionStorageJsonItem(k, window);
76
+ StorageUtils.removeSessionStorageItem(k, window);
77
+ return item;
78
+ };
43
79
  StorageUtils.clearLocalStorage = function (window) {
44
80
  window.localStorage.clear();
45
81
  };
82
+ StorageUtils.clearSessionStorage = function (window) {
83
+ window.sessionStorage.clear();
84
+ };
46
85
  return StorageUtils;
47
86
  }());
48
87
  exports.StorageUtils = StorageUtils;
@@ -1,5 +1,6 @@
1
1
  export declare class StringUtils {
2
2
  static deleteEnter(data: string): string;
3
3
  static regexExec(regex: RegExp, text: string): RegExpExecArray[];
4
+ static regexExecArrayReplace(origin: string, regexpExecArrayOrRegex: RegExpExecArray[] | RegExp, replace: string | ((data: RegExpExecArray) => string)): string;
4
5
  static escapeSpecialCharacterRegExp(data: string): string;
5
6
  }
@@ -16,6 +16,23 @@ var StringUtils = /** @class */ (function () {
16
16
  }
17
17
  return usingVars;
18
18
  };
19
+ StringUtils.regexExecArrayReplace = function (origin, regexpExecArrayOrRegex, replace) {
20
+ var regexpExecArrays = Array.isArray(regexpExecArrayOrRegex) ? regexpExecArrayOrRegex : StringUtils.regexExec(regexpExecArrayOrRegex, origin);
21
+ regexpExecArrays.reverse().forEach(function (it) {
22
+ var r = typeof replace === 'string' ? replace : replace(it);
23
+ origin = origin.substr(0, it.index) + origin.substr(it.index).replace(it[0], r);
24
+ });
25
+ return origin;
26
+ };
27
+ // public static regexGroups(regex: RegExp, text: string) {
28
+ // const usingVars = [];
29
+ // let varExec = regex.exec(text)
30
+ // while (varExec) {
31
+ // usingVars.push(varExec)
32
+ // varExec = regex.exec(varExec.input)
33
+ // }
34
+ // return usingVars;
35
+ // }
19
36
  // public static betweenRegexpStr(start: string, end: string, data: string, flag = 'gm') {
20
37
  // const startEspace = StringUtils.escapeSpecialCharacterRegExp(start);
21
38
  // const reg = RegExp(`(${start}(?:(${start})??[^${startEspace}]*?${end}))`,flag);
@@ -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;
27
+ var _a, _b;
28
28
  var value = this.value;
29
- return value === undefined || value === null || ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) <= 0;
29
+ return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 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;
27
+ var _a, _b;
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 && ((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 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;
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 type ValidMulltiple<T = any, E = Element> = (validators: Validator<T, E>[], value?: T, target?: E, event?: Event) => boolean;
3
+ export declare 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 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;
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;
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 type MakeValidator<T = any, E = Element> = (value: T, target: E, event?: Event) => Validator<T, E>;
2
+ export declare 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);