dom-render 1.0.37 → 1.0.41

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ import { Config } from '../Config';
2
+ export declare const eventManager: {
3
+ readonly attrPrefix: "dr-";
4
+ readonly eventNames: string[];
5
+ readonly attrNames: string[];
6
+ findAttrElements(fragment: DocumentFragment | Element, config?: Config | undefined): Set<Element>;
7
+ applyEvent(obj: any, childNodes: Set<ChildNode> | Set<Element>, config?: Config | undefined): void;
8
+ changeVar(obj: any, elements: Set<Element> | Set<ChildNode>, varName?: string | undefined): void;
9
+ addDrEvent(obj: any, eventName: string, elements: Set<Element> | Set<ChildNode>): void;
10
+ procAttr<T extends Element = Element>(elements: Set<Element> | Set<ChildNode> | undefined, attrName: string, callBack: (h: T, value: string) => void): void;
11
+ getValue<T_1 = any>(obj: any, name: string, value?: any): T_1;
12
+ setValue(obj: any, name: string, value?: any): void;
13
+ isUsingThisVar(raws: string | null | undefined, varName: string | null | undefined): boolean;
14
+ };
@@ -0,0 +1,3 @@
1
+ export interface ConstructorType<T> {
2
+ new (...args: any[]): T;
3
+ }
@@ -0,0 +1,13 @@
1
+ export declare 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: HTMLElement, attrs: string[]): void;
9
+ static setAttribute(result: HTMLElement, attrs: string[]): void;
10
+ static setAttributeAttr(result: HTMLElement, attrs: Attr[]): void;
11
+ static getAttributeToObject(input: HTMLElement): any;
12
+ static getStyleToObject(input: HTMLElement): any;
13
+ }
@@ -0,0 +1,10 @@
1
+ export declare 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
+ }
@@ -0,0 +1,7 @@
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
+ }
@@ -0,0 +1,14 @@
1
+ export declare class ScriptUtils {
2
+ static getVariablePaths(script: string): Set<string>;
3
+ static evalReturn(script: string, thisTarget: any): any;
4
+ static eval(script: string, thisTarget: any): any;
5
+ static loadElement(name: string, attribute: {
6
+ [key: string]: string;
7
+ }, target?: Element): Promise<unknown>;
8
+ static loadStyleSheet(href: string, attribute?: {
9
+ [key: string]: string;
10
+ }): Promise<unknown>;
11
+ static loadScript(src: string, attribute?: {
12
+ [key: string]: string;
13
+ }): Promise<unknown>;
14
+ }
@@ -0,0 +1,4 @@
1
+ export declare class StringUtils {
2
+ static deleteEnter(data: string): string;
3
+ static regexExec(regex: RegExp, text: string): RegExpExecArray[];
4
+ }
@@ -0,0 +1,10 @@
1
+ export declare class ValidUtils {
2
+ static isNullOrUndefined(data: any): boolean;
3
+ static isNull(data: any): boolean;
4
+ static isArray(object_o: any): boolean;
5
+ static isNumber(object_o: any): boolean;
6
+ static isString(object_o: any): boolean;
7
+ static isFunction(object_o: any): boolean;
8
+ static isObject(object_o: any): boolean;
9
+ static isMap(object_o: any): boolean;
10
+ }
@@ -1,4 +1,4 @@
1
- import { Config } from 'Config';
1
+ import { Config } from '../Config';
2
2
  export declare const eventManager: {
3
3
  readonly attrPrefix: "dr-";
4
4
  readonly eventNames: string[];
@@ -1,12 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eventManager = void 0;
4
- var ScriptUtils_1 = require("../utils/script/ScriptUtils");
5
- exports.eventManager = new (function () {
1
+ import { ScriptUtils } from '../utils/script/ScriptUtils';
2
+ export var eventManager = new (function () {
6
3
  function class_1() {
7
4
  var _this = this;
8
5
  this.attrPrefix = 'dr-';
9
- this.eventNames = ['click', 'change', 'keyup', 'keydown', 'input', 'submit'];
6
+ this.eventNames = [
7
+ 'click', 'mousedown', 'mouseup', 'dblclick', 'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'contextmenu',
8
+ 'keyup', 'keydown', 'keypress',
9
+ 'change', 'input', 'submit', 'resize'
10
+ ];
10
11
  this.attrNames = [
11
12
  this.attrPrefix + 'value',
12
13
  this.attrPrefix + 'value-link',
@@ -48,7 +49,7 @@ exports.eventManager = new (function () {
48
49
  this.procAttr(childNodes, this.attrPrefix + 'value', function (it, attribute) {
49
50
  var script = attribute;
50
51
  if (script) {
51
- var data = ScriptUtils_1.ScriptUtils.evalReturn(script, obj);
52
+ var data = ScriptUtils.evalReturn(script, obj);
52
53
  if (it.value !== data) {
53
54
  it.value = data;
54
55
  }
@@ -194,14 +195,14 @@ exports.eventManager = new (function () {
194
195
  });
195
196
  };
196
197
  class_1.prototype.getValue = function (obj, name, value) {
197
- var r = ScriptUtils_1.ScriptUtils.evalReturn(name, obj);
198
+ var r = ScriptUtils.evalReturn(name, obj);
198
199
  if (typeof r === 'function') {
199
200
  r = r.bind(obj);
200
201
  }
201
202
  return r;
202
203
  };
203
204
  class_1.prototype.setValue = function (obj, name, value) {
204
- ScriptUtils_1.ScriptUtils.eval("this." + name + " = this.value", {
205
+ ScriptUtils.eval("this." + name + " = this.value", {
205
206
  this: obj,
206
207
  value: value
207
208
  });
@@ -211,7 +212,7 @@ exports.eventManager = new (function () {
211
212
  if (varName.startsWith('this.')) {
212
213
  varName = varName.replace(/this\./, '');
213
214
  }
214
- var variablePaths = ScriptUtils_1.ScriptUtils.getVariablePaths(raws !== null && raws !== void 0 ? raws : '');
215
+ var variablePaths = ScriptUtils.getVariablePaths(raws !== null && raws !== void 0 ? raws : '');
215
216
  return variablePaths.has(varName);
216
217
  }
217
218
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dom-render",
3
- "version": "1.0.37",
3
+ "version": "1.0.41",
4
4
  "main": "DomRender.js",
5
5
  "license": "MIT",
6
6
  "description": "dom-render",
@@ -30,10 +30,6 @@
30
30
  "type": "git",
31
31
  "url": "https://github.com/visualkhh/dom-render"
32
32
  },
33
- "workspaces": [
34
- "./",
35
- "example"
36
- ],
37
33
  "jest": {
38
34
  "transform": {
39
35
  "^.+\\.ts$": "ts-jest"
@@ -62,13 +58,14 @@
62
58
  "npm-build": "npm run build && cp package.json dist && cp README.MD dist",
63
59
  "npm-publish": "npm run npm-build && npm publish ./dist",
64
60
  "tsc": "tsc",
61
+ "tsc:watch": "rm -rf ./dist && mkdir dist && cp package.json dist && tsc --watch --sourceMap true",
65
62
  "test": "jest --detectOpenHandles --forceExit"
66
63
  },
67
64
  "devDependencies": {
65
+ "@rollup/plugin-babel": "^5.3.0",
66
+ "@rollup/plugin-node-resolve": "^13.0.5",
68
67
  "@rollup/plugin-replace": "^2.4.2",
69
- "@rollup/plugin-typescript": "^8.2.1",
70
68
  "@types/jest": "^26.0.22",
71
- "@types/node": "^16.4.6",
72
69
  "@typescript-eslint/eslint-plugin": "^4.16.1",
73
70
  "@typescript-eslint/parser": "^4.16.1",
74
71
  "eslint": "^7.21.0",
@@ -77,12 +74,20 @@
77
74
  "eslint-plugin-node": "^11.1.0",
78
75
  "eslint-plugin-promise": "^4.3.1",
79
76
  "jest": "^26.6.3",
80
- "parcel-bundler": "^1.12.5",
81
- "parcel-plugin-css-to-string": "^2.5.2",
82
77
  "rollup": "^2.52.8",
83
- "rollup-watch": "^4.3.1",
78
+ "rollup-plugin-babel": "^4.4.0",
79
+ "rollup-plugin-commonjs": "^10.1.0",
80
+ "rollup-plugin-copy": "^3.4.0",
81
+ "rollup-plugin-delete": "^2.0.0",
82
+ "rollup-plugin-html": "^0.2.1",
83
+ "rollup-plugin-import-css": "^3.0.2",
84
+ "rollup-plugin-node-resolve": "^5.2.0",
85
+ "rollup-plugin-sourcemaps": "^0.6.3",
86
+ "rollup-plugin-typescript2": "^0.30.0",
87
+ "rollup-watch": "^3.2.2",
84
88
  "supertest": "^6.1.3",
85
89
  "ts-jest": "^26.5.4",
86
- "typescript": "^4.3.5"
90
+ "tslib": "^2.3.1",
91
+ "typescript": "^4.4.3"
87
92
  }
88
93
  }
package/types/Types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DomUtils = void 0;
4
1
  var DomUtils = (function () {
5
2
  function DomUtils() {
6
3
  }
@@ -42,4 +39,4 @@ var DomUtils = (function () {
42
39
  };
43
40
  return DomUtils;
44
41
  }());
45
- exports.DomUtils = DomUtils;
42
+ export { DomUtils };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeUtils = void 0;
4
1
  var NodeUtils = (function () {
5
2
  function NodeUtils() {
6
3
  }
@@ -22,4 +19,4 @@ var NodeUtils = (function () {
22
19
  };
23
20
  return NodeUtils;
24
21
  }());
25
- exports.NodeUtils = NodeUtils;
22
+ export { NodeUtils };
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RandomUtils = void 0;
4
- var ValidUtils_1 = require("../valid/ValidUtils");
1
+ import { ValidUtils } from '../valid/ValidUtils';
5
2
  var RandomUtils = (function () {
6
3
  function RandomUtils() {
7
4
  }
8
5
  RandomUtils.random = function (min, max) {
9
- if (ValidUtils_1.ValidUtils.isNullOrUndefined(min)) {
6
+ if (ValidUtils.isNullOrUndefined(min)) {
10
7
  return Math.random();
11
8
  }
12
- else if (!ValidUtils_1.ValidUtils.isNullOrUndefined(min) && ValidUtils_1.ValidUtils.isNullOrUndefined(max)) {
9
+ else if (!ValidUtils.isNullOrUndefined(min) && ValidUtils.isNullOrUndefined(max)) {
13
10
  return Math.random() * (min || 0);
14
11
  }
15
12
  else {
@@ -43,4 +40,4 @@ var RandomUtils = (function () {
43
40
  RandomUtils.d = '';
44
41
  return RandomUtils;
45
42
  }());
46
- exports.RandomUtils = RandomUtils;
43
+ export { RandomUtils };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScriptUtils = void 0;
4
1
  var ScriptUtils = (function () {
5
2
  function ScriptUtils() {
6
3
  }
@@ -69,4 +66,4 @@ var ScriptUtils = (function () {
69
66
  };
70
67
  return ScriptUtils;
71
68
  }());
72
- exports.ScriptUtils = ScriptUtils;
69
+ export { ScriptUtils };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StringUtils = void 0;
4
1
  var StringUtils = (function () {
5
2
  function StringUtils() {
6
3
  }
@@ -18,4 +15,4 @@ var StringUtils = (function () {
18
15
  };
19
16
  return StringUtils;
20
17
  }());
21
- exports.StringUtils = StringUtils;
18
+ export { StringUtils };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValidUtils = void 0;
4
1
  var ValidUtils = (function () {
5
2
  function ValidUtils() {
6
3
  }
@@ -70,4 +67,4 @@ var ValidUtils = (function () {
70
67
  };
71
68
  return ValidUtils;
72
69
  }());
73
- exports.ValidUtils = ValidUtils;
70
+ export { ValidUtils };