@hpcc-js/common 3.7.3 → 3.7.5

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 (54) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +59 -59
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.cjs +1 -1
  6. package/dist/index.umd.cjs.map +1 -1
  7. package/package.json +5 -5
  8. package/src/CanvasWidget.ts +31 -31
  9. package/src/Class.ts +72 -72
  10. package/src/Database.ts +860 -860
  11. package/src/Entity.ts +235 -235
  12. package/src/EntityCard.ts +66 -66
  13. package/src/EntityPin.ts +103 -103
  14. package/src/EntityRect.css +15 -15
  15. package/src/EntityRect.ts +254 -254
  16. package/src/EntityVertex.ts +86 -86
  17. package/src/FAChar.css +2 -2
  18. package/src/FAChar.ts +89 -89
  19. package/src/HTMLWidget.ts +191 -191
  20. package/src/IList.ts +4 -4
  21. package/src/IMenu.ts +5 -5
  22. package/src/Icon.css +9 -9
  23. package/src/Icon.ts +176 -176
  24. package/src/Image.ts +104 -104
  25. package/src/List.css +12 -12
  26. package/src/List.ts +102 -102
  27. package/src/Menu.css +22 -22
  28. package/src/Menu.ts +139 -139
  29. package/src/Palette.ts +341 -341
  30. package/src/Platform.ts +125 -125
  31. package/src/ProgressBar.ts +115 -115
  32. package/src/PropertyExt.ts +770 -770
  33. package/src/ResizeSurface.css +38 -38
  34. package/src/ResizeSurface.ts +225 -225
  35. package/src/SVGWidget.ts +583 -583
  36. package/src/SVGZoomWidget.css +11 -11
  37. package/src/SVGZoomWidget.ts +427 -427
  38. package/src/Shape.css +3 -3
  39. package/src/Shape.ts +186 -186
  40. package/src/Surface.css +39 -39
  41. package/src/Surface.ts +364 -364
  42. package/src/Text.css +3 -3
  43. package/src/Text.ts +131 -131
  44. package/src/TextBox.css +3 -3
  45. package/src/TextBox.ts +183 -183
  46. package/src/TitleBar.css +114 -114
  47. package/src/TitleBar.ts +407 -407
  48. package/src/Transition.ts +45 -45
  49. package/src/Utility.ts +843 -843
  50. package/src/Widget.css +7 -7
  51. package/src/Widget.ts +731 -731
  52. package/src/WidgetArray.ts +15 -15
  53. package/src/__package__.ts +3 -3
  54. package/src/index.ts +55 -55
package/src/Platform.ts CHANGED
@@ -1,125 +1,125 @@
1
- const _version = "1.14.2-dev";
2
- export function version() {
3
- return _version;
4
- }
5
-
6
- export const ieVersion = (function () {
7
- const ua = navigator.userAgent;
8
- let tem;
9
- const M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
10
- if (/trident/i.test(M[1])) {
11
- tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
12
- return parseFloat(tem[1]);
13
- }
14
- if (/msie/i.test(M[1])) {
15
- return parseFloat(M[2]);
16
- }
17
- return null;
18
- })();
19
-
20
- export const isIE = ieVersion !== null;
21
- export const svgMarkerGlitch = isIE && ieVersion <= 12;
22
-
23
- let _scrollBarWidth = null;
24
- export function getScrollbarWidth() {
25
- if (_scrollBarWidth === null) {
26
- const outer = document.createElement("div");
27
- outer.style.visibility = "hidden";
28
- outer.style.width = "100px";
29
- // @ts-ignore
30
- outer.style.msOverflowStyle = "scrollbar";
31
-
32
- document.body.appendChild(outer);
33
-
34
- const widthNoScroll = outer.offsetWidth;
35
- outer.style.overflow = "scroll";
36
-
37
- const inner = document.createElement("div");
38
- inner.style.width = "100%";
39
- outer.appendChild(inner);
40
-
41
- const widthWithScroll = inner.offsetWidth;
42
-
43
- outer.parentNode.removeChild(outer);
44
-
45
- _scrollBarWidth = widthNoScroll - widthWithScroll;
46
- }
47
- return _scrollBarWidth;
48
- }
49
-
50
- // Polyfills ---
51
- (window as any).MutationObserver = (window as any).MutationObserver || (window as any).WebKitMutationObserver || (window as any).MozMutationObserver || function (callback) {
52
- // Just enough for HTMLOverlay and C3 ---
53
- this.callback = callback;
54
- this.listeners = [];
55
-
56
- const MutationListener = function (callback2, domNode, type) {
57
- this.callback = callback2;
58
- this.domNode = domNode;
59
- this.type = type;
60
- };
61
- MutationListener.prototype = {
62
- handleEvent(evt) {
63
- const mutation = {
64
- type: this.type,
65
- target: this.domNode,
66
- addedNodes: [],
67
- removedNodes: [],
68
- previousSibling: evt.target.previousSibling,
69
- nextSibling: evt.target.nextSibling,
70
- attributeName: null,
71
- attributeNamespace: null,
72
- oldValue: null
73
- };
74
- this.callback([mutation]);
75
- }
76
- };
77
-
78
- this.observe = function (domNode, config) {
79
- let listener = null;
80
- if (config.attributes) {
81
- listener = new MutationListener(this.callback, domNode, "attributes");
82
- this.listeners.push(listener);
83
- domNode.addEventListener("DOMAttrModified", listener, true);
84
- }
85
-
86
- if (config.characterData) {
87
- listener = new MutationListener(this.callback, domNode, "characterData");
88
- this.listeners.push(listener);
89
- domNode.addEventListener("DOMCharacterDataModified", listener, true);
90
- }
91
-
92
- if (config.childList) {
93
- listener = new MutationListener(this.callback, domNode, "childList");
94
- this.listeners.push(listener);
95
- domNode.addEventListener("DOMNodeInserted", listener, true);
96
- domNode.addEventListener("DOMNodeRemoved", listener, true);
97
- }
98
- };
99
-
100
- this.disconnect = function () {
101
- this.listeners.forEach(function (item) {
102
- switch (item.type) {
103
- case "attributes":
104
- item.domNode.removeEventListener("DOMAttrModified", item, true);
105
- break;
106
- case "characterData":
107
- item.domNode.removeEventListener("DOMCharacterDataModified", item, true);
108
- break;
109
- case "childList":
110
- item.domNode.removeEventListener("DOMNodeRemoved", item, true);
111
- item.domNode.removeEventListener("DOMNodeInserted", item, true);
112
- break;
113
- }
114
- });
115
- this.listeners = [];
116
- };
117
- };
118
-
119
- (Math as any).sign = (Math as any).sign || function (x) {
120
- x = +x; // convert to a number
121
- if (x === 0 || isNaN(x)) {
122
- return x;
123
- }
124
- return x > 0 ? 1 : -1;
125
- };
1
+ const _version = "1.14.2-dev";
2
+ export function version() {
3
+ return _version;
4
+ }
5
+
6
+ export const ieVersion = (function () {
7
+ const ua = navigator.userAgent;
8
+ let tem;
9
+ const M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
10
+ if (/trident/i.test(M[1])) {
11
+ tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
12
+ return parseFloat(tem[1]);
13
+ }
14
+ if (/msie/i.test(M[1])) {
15
+ return parseFloat(M[2]);
16
+ }
17
+ return null;
18
+ })();
19
+
20
+ export const isIE = ieVersion !== null;
21
+ export const svgMarkerGlitch = isIE && ieVersion <= 12;
22
+
23
+ let _scrollBarWidth = null;
24
+ export function getScrollbarWidth() {
25
+ if (_scrollBarWidth === null) {
26
+ const outer = document.createElement("div");
27
+ outer.style.visibility = "hidden";
28
+ outer.style.width = "100px";
29
+ // @ts-ignore
30
+ outer.style.msOverflowStyle = "scrollbar";
31
+
32
+ document.body.appendChild(outer);
33
+
34
+ const widthNoScroll = outer.offsetWidth;
35
+ outer.style.overflow = "scroll";
36
+
37
+ const inner = document.createElement("div");
38
+ inner.style.width = "100%";
39
+ outer.appendChild(inner);
40
+
41
+ const widthWithScroll = inner.offsetWidth;
42
+
43
+ outer.parentNode.removeChild(outer);
44
+
45
+ _scrollBarWidth = widthNoScroll - widthWithScroll;
46
+ }
47
+ return _scrollBarWidth;
48
+ }
49
+
50
+ // Polyfills ---
51
+ (window as any).MutationObserver = (window as any).MutationObserver || (window as any).WebKitMutationObserver || (window as any).MozMutationObserver || function (callback) {
52
+ // Just enough for HTMLOverlay and C3 ---
53
+ this.callback = callback;
54
+ this.listeners = [];
55
+
56
+ const MutationListener = function (callback2, domNode, type) {
57
+ this.callback = callback2;
58
+ this.domNode = domNode;
59
+ this.type = type;
60
+ };
61
+ MutationListener.prototype = {
62
+ handleEvent(evt) {
63
+ const mutation = {
64
+ type: this.type,
65
+ target: this.domNode,
66
+ addedNodes: [],
67
+ removedNodes: [],
68
+ previousSibling: evt.target.previousSibling,
69
+ nextSibling: evt.target.nextSibling,
70
+ attributeName: null,
71
+ attributeNamespace: null,
72
+ oldValue: null
73
+ };
74
+ this.callback([mutation]);
75
+ }
76
+ };
77
+
78
+ this.observe = function (domNode, config) {
79
+ let listener = null;
80
+ if (config.attributes) {
81
+ listener = new MutationListener(this.callback, domNode, "attributes");
82
+ this.listeners.push(listener);
83
+ domNode.addEventListener("DOMAttrModified", listener, true);
84
+ }
85
+
86
+ if (config.characterData) {
87
+ listener = new MutationListener(this.callback, domNode, "characterData");
88
+ this.listeners.push(listener);
89
+ domNode.addEventListener("DOMCharacterDataModified", listener, true);
90
+ }
91
+
92
+ if (config.childList) {
93
+ listener = new MutationListener(this.callback, domNode, "childList");
94
+ this.listeners.push(listener);
95
+ domNode.addEventListener("DOMNodeInserted", listener, true);
96
+ domNode.addEventListener("DOMNodeRemoved", listener, true);
97
+ }
98
+ };
99
+
100
+ this.disconnect = function () {
101
+ this.listeners.forEach(function (item) {
102
+ switch (item.type) {
103
+ case "attributes":
104
+ item.domNode.removeEventListener("DOMAttrModified", item, true);
105
+ break;
106
+ case "characterData":
107
+ item.domNode.removeEventListener("DOMCharacterDataModified", item, true);
108
+ break;
109
+ case "childList":
110
+ item.domNode.removeEventListener("DOMNodeRemoved", item, true);
111
+ item.domNode.removeEventListener("DOMNodeInserted", item, true);
112
+ break;
113
+ }
114
+ });
115
+ this.listeners = [];
116
+ };
117
+ };
118
+
119
+ (Math as any).sign = (Math as any).sign || function (x) {
120
+ x = +x; // convert to a number
121
+ if (x === 0 || isNaN(x)) {
122
+ return x;
123
+ }
124
+ return x > 0 ? 1 : -1;
125
+ };
@@ -1,115 +1,115 @@
1
- import { PropertyExt } from "./PropertyExt.ts";
2
-
3
- export class ProgressBar extends PropertyExt {
4
-
5
- protected _elementID: string;
6
- protected _running: boolean = false;
7
- protected _style;
8
-
9
- constructor() {
10
- super();
11
- }
12
-
13
- calcCSS(halflife: number, perc: number) {
14
- const bar_size = this.size();
15
- const bar_color = this.color();
16
- const blur_opacity = this.blurOpacity();
17
- const blur_opacity_hex = blur_opacity * 255 >= 16 ? Math.floor(blur_opacity * 255).toString(16).slice(-2) : "00";
18
- const blur_color = this.blurColor() || bar_color;
19
- const blur_size = this.blurSize();
20
- const blur_fx = this.blurBar() ? `background: radial-gradient(ellipse at 50% 50%, ${blur_color}${blur_opacity_hex}, ${blur_color}00, #00000000 ${blur_size}px);` : "";
21
- return `
22
- #${this._elementID}::before{
23
- content:" ";display:block;position:absolute;
24
- height:${bar_size}px;width:${perc}%;
25
- left:0;top:0;
26
- background-color: ${bar_color};
27
- transition: width ${(halflife / 1000)}s;
28
- }
29
- #${this._elementID}::after{
30
- content:" ";display:block;position:absolute;
31
- height:${blur_size}px;width:${blur_size * 2}px;
32
- left:calc(${perc}% - ${blur_size}px);
33
- top:${-((blur_size / 2) - (bar_size / 2))}px;
34
- background-color: ${bar_color};
35
- transition: left ${(halflife / 1000)}s;
36
- transform: rotate(1deg) translate(-${blur_size / 2.5}px,0px) scale(1.5,0.5);
37
- ${blur_fx}
38
- }
39
- `;
40
- }
41
-
42
- start() {
43
- this._running = true;
44
- this.updateProgress(this.halfLife(), 10);
45
- }
46
-
47
- finish() {
48
- this.updateProgress(100, 100);
49
- }
50
-
51
- enter(domNode, element) {
52
- this._elementID = element.attr("id");
53
- if (!this._elementID) throw new Error("Target element requires an id attribute.");
54
- this._style = element.insert("style");
55
- }
56
-
57
- exit(_domNode, _element) {
58
- this._running = false;
59
- if (this._style)
60
- this._style.remove();
61
- delete this._style;
62
- }
63
-
64
- protected updateProgress(halflife: number, perc: number) {
65
- if (!this._running) return;
66
- if (this._style) {
67
- this._style.html(this.calcCSS(halflife, perc));
68
- }
69
-
70
- const percLimit = 95;
71
- halflife *= this.decay();
72
- perc = perc ? perc : 10;
73
- if (perc < percLimit) {
74
- setTimeout(() => {
75
- const _remaining = 100 - perc;
76
- this.updateProgress(halflife, perc + (_remaining / 2));
77
- }, perc === 10 ? 100 : halflife);
78
- } else if (perc === 100) {
79
- setTimeout(() => {
80
- this._running = false;
81
- if (this._style) {
82
- this._style.html("");
83
- }
84
- }, halflife);
85
- }
86
- }
87
- }
88
- ProgressBar.prototype._class += " common_ProgressBar";
89
-
90
- export interface ProgressBar {
91
- halfLife(): number;
92
- halfLife(_: number): this;
93
- decay(): number;
94
- decay(_: number): this;
95
- size(): number;
96
- size(_: number): this;
97
- color(): string;
98
- color(_: string): this;
99
- blurBar(): boolean;
100
- blurBar(_: boolean): this;
101
- blurSize(): number;
102
- blurSize(_: number): this;
103
- blurColor(): string;
104
- blurColor(_: string): this;
105
- blurOpacity(): number;
106
- blurOpacity(_: number): this;
107
- }
108
- ProgressBar.prototype.publish("halfLife", 5000, "number", "Half Life");
109
- ProgressBar.prototype.publish("decay", 1.2, "number", "Decay");
110
- ProgressBar.prototype.publish("size", 2, "number", "Size");
111
- ProgressBar.prototype.publish("color", "#2ed573", "string", "Color");
112
- ProgressBar.prototype.publish("blurBar", true, "boolean", "Bar Blur");
113
- ProgressBar.prototype.publish("blurSize", 50, "number", "Blur Size");
114
- ProgressBar.prototype.publish("blurColor", "#7bed9f", "string", "Blur Color (hex)", null, { optional: true });
115
- ProgressBar.prototype.publish("blurOpacity", 0.35, "number", "Blur Opacity");
1
+ import { PropertyExt } from "./PropertyExt.ts";
2
+
3
+ export class ProgressBar extends PropertyExt {
4
+
5
+ protected _elementID: string;
6
+ protected _running: boolean = false;
7
+ protected _style;
8
+
9
+ constructor() {
10
+ super();
11
+ }
12
+
13
+ calcCSS(halflife: number, perc: number) {
14
+ const bar_size = this.size();
15
+ const bar_color = this.color();
16
+ const blur_opacity = this.blurOpacity();
17
+ const blur_opacity_hex = blur_opacity * 255 >= 16 ? Math.floor(blur_opacity * 255).toString(16).slice(-2) : "00";
18
+ const blur_color = this.blurColor() || bar_color;
19
+ const blur_size = this.blurSize();
20
+ const blur_fx = this.blurBar() ? `background: radial-gradient(ellipse at 50% 50%, ${blur_color}${blur_opacity_hex}, ${blur_color}00, #00000000 ${blur_size}px);` : "";
21
+ return `
22
+ #${this._elementID}::before{
23
+ content:" ";display:block;position:absolute;
24
+ height:${bar_size}px;width:${perc}%;
25
+ left:0;top:0;
26
+ background-color: ${bar_color};
27
+ transition: width ${(halflife / 1000)}s;
28
+ }
29
+ #${this._elementID}::after{
30
+ content:" ";display:block;position:absolute;
31
+ height:${blur_size}px;width:${blur_size * 2}px;
32
+ left:calc(${perc}% - ${blur_size}px);
33
+ top:${-((blur_size / 2) - (bar_size / 2))}px;
34
+ background-color: ${bar_color};
35
+ transition: left ${(halflife / 1000)}s;
36
+ transform: rotate(1deg) translate(-${blur_size / 2.5}px,0px) scale(1.5,0.5);
37
+ ${blur_fx}
38
+ }
39
+ `;
40
+ }
41
+
42
+ start() {
43
+ this._running = true;
44
+ this.updateProgress(this.halfLife(), 10);
45
+ }
46
+
47
+ finish() {
48
+ this.updateProgress(100, 100);
49
+ }
50
+
51
+ enter(domNode, element) {
52
+ this._elementID = element.attr("id");
53
+ if (!this._elementID) throw new Error("Target element requires an id attribute.");
54
+ this._style = element.insert("style");
55
+ }
56
+
57
+ exit(_domNode, _element) {
58
+ this._running = false;
59
+ if (this._style)
60
+ this._style.remove();
61
+ delete this._style;
62
+ }
63
+
64
+ protected updateProgress(halflife: number, perc: number) {
65
+ if (!this._running) return;
66
+ if (this._style) {
67
+ this._style.html(this.calcCSS(halflife, perc));
68
+ }
69
+
70
+ const percLimit = 95;
71
+ halflife *= this.decay();
72
+ perc = perc ? perc : 10;
73
+ if (perc < percLimit) {
74
+ setTimeout(() => {
75
+ const _remaining = 100 - perc;
76
+ this.updateProgress(halflife, perc + (_remaining / 2));
77
+ }, perc === 10 ? 100 : halflife);
78
+ } else if (perc === 100) {
79
+ setTimeout(() => {
80
+ this._running = false;
81
+ if (this._style) {
82
+ this._style.html("");
83
+ }
84
+ }, halflife);
85
+ }
86
+ }
87
+ }
88
+ ProgressBar.prototype._class += " common_ProgressBar";
89
+
90
+ export interface ProgressBar {
91
+ halfLife(): number;
92
+ halfLife(_: number): this;
93
+ decay(): number;
94
+ decay(_: number): this;
95
+ size(): number;
96
+ size(_: number): this;
97
+ color(): string;
98
+ color(_: string): this;
99
+ blurBar(): boolean;
100
+ blurBar(_: boolean): this;
101
+ blurSize(): number;
102
+ blurSize(_: number): this;
103
+ blurColor(): string;
104
+ blurColor(_: string): this;
105
+ blurOpacity(): number;
106
+ blurOpacity(_: number): this;
107
+ }
108
+ ProgressBar.prototype.publish("halfLife", 5000, "number", "Half Life");
109
+ ProgressBar.prototype.publish("decay", 1.2, "number", "Decay");
110
+ ProgressBar.prototype.publish("size", 2, "number", "Size");
111
+ ProgressBar.prototype.publish("color", "#2ed573", "string", "Color");
112
+ ProgressBar.prototype.publish("blurBar", true, "boolean", "Bar Blur");
113
+ ProgressBar.prototype.publish("blurSize", 50, "number", "Blur Size");
114
+ ProgressBar.prototype.publish("blurColor", "#7bed9f", "string", "Blur Color (hex)", null, { optional: true });
115
+ ProgressBar.prototype.publish("blurOpacity", 0.35, "number", "Blur Opacity");