cx 24.10.2 → 24.10.4

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 (70) hide show
  1. package/dist/charts.js +24 -27
  2. package/dist/data.js +26 -29
  3. package/dist/manifest.js +434 -434
  4. package/dist/svg.js +59 -56
  5. package/dist/ui.js +51 -52
  6. package/dist/widgets.css +8 -8
  7. package/dist/widgets.js +40 -44
  8. package/package.json +32 -32
  9. package/src/charts/PieChart.js +2 -2
  10. package/src/charts/PieLabel.js +71 -71
  11. package/src/charts/axis/Axis.js +260 -260
  12. package/src/charts/axis/NumericAxis.js +347 -347
  13. package/src/charts/axis/Stack.js +55 -55
  14. package/src/charts/axis/TimeAxis.js +510 -510
  15. package/src/charts/helpers/PointReducer.js +43 -43
  16. package/src/charts/helpers/SnapPointFinder.js +69 -69
  17. package/src/data/Binding.spec.js +69 -69
  18. package/src/data/Expression.js +221 -221
  19. package/src/data/Expression.spec.js +184 -184
  20. package/src/data/StringTemplate.spec.js +105 -105
  21. package/src/data/getAccessor.spec.js +11 -11
  22. package/src/index.scss +6 -6
  23. package/src/svg/Text.d.ts +40 -40
  24. package/src/ui/Culture.d.ts +55 -55
  25. package/src/ui/Culture.js +139 -139
  26. package/src/ui/FocusManager.js +171 -171
  27. package/src/ui/Instance.d.ts +72 -72
  28. package/src/ui/VDOM.d.ts +12 -12
  29. package/src/ui/app/startAppLoop.js +58 -58
  30. package/src/ui/index.d.ts +42 -42
  31. package/src/ui/layout/LabelsTopLayout.js +134 -134
  32. package/src/util/Console.d.ts +4 -4
  33. package/src/util/index.d.ts +51 -51
  34. package/src/util/index.js +54 -54
  35. package/src/util/isValidIdentifierName.d.ts +1 -1
  36. package/src/util/isValidIdentifierName.js +5 -5
  37. package/src/util/isValidIdentifierName.spec.js +33 -33
  38. package/src/util/scss/add-rules.scss +38 -38
  39. package/src/widgets/CxCredit.scss +37 -37
  40. package/src/widgets/HighlightedSearchText.js +36 -36
  41. package/src/widgets/HighlightedSearchText.scss +18 -18
  42. package/src/widgets/List.scss +91 -91
  43. package/src/widgets/drag-drop/DropZone.js +214 -214
  44. package/src/widgets/form/Calendar.scss +196 -196
  45. package/src/widgets/form/ColorField.js +397 -397
  46. package/src/widgets/form/ColorPicker.scss +283 -283
  47. package/src/widgets/form/DateTimeField.js +573 -573
  48. package/src/widgets/form/LookupField.d.ts +179 -179
  49. package/src/widgets/form/MonthField.js +516 -516
  50. package/src/widgets/form/MonthPicker.scss +118 -118
  51. package/src/widgets/form/NumberField.js +459 -459
  52. package/src/widgets/form/NumberField.scss +61 -61
  53. package/src/widgets/form/Select.scss +99 -99
  54. package/src/widgets/form/Slider.scss +118 -118
  55. package/src/widgets/form/Switch.scss +140 -140
  56. package/src/widgets/form/TextArea.scss +43 -43
  57. package/src/widgets/form/TextField.js +290 -290
  58. package/src/widgets/form/TextField.scss +55 -55
  59. package/src/widgets/form/UploadButton.d.ts +34 -34
  60. package/src/widgets/form/variables.scss +353 -353
  61. package/src/widgets/grid/Grid.scss +2 -2
  62. package/src/widgets/grid/TreeNode.scss +88 -88
  63. package/src/widgets/nav/Menu.scss +74 -74
  64. package/src/widgets/overlay/Dropdown.js +612 -612
  65. package/src/widgets/overlay/FlyweightTooltipTracker.js +39 -39
  66. package/src/widgets/overlay/Tooltip.js +300 -300
  67. package/src/widgets/overlay/Window.js +196 -196
  68. package/src/widgets/overlay/captureMouse.js +124 -124
  69. package/src/widgets/overlay/variables.scss +83 -83
  70. package/src/widgets/variables.scss +144 -144
@@ -1,171 +1,171 @@
1
- import { isSelfOrDescendant, findFirst, findFirstChild, isFocusable, closestParent } from "../util/DOM";
2
- import { batchUpdates } from "./batchUpdates";
3
- import { SubscriberList } from "../util/SubscriberList";
4
- import { isTouchEvent } from "../util/isTouchEvent";
5
- import { getActiveElement } from "../util/getActiveElement";
6
-
7
- /*
8
- * Purpose of FocusManager is to provide focusout notifications.
9
- * IE and Firefox do not provide relatedTarget info in blur events which makes it impossible
10
- * to determine if focus went outside or stayed inside the component.
11
- */
12
-
13
- let subscribers = new SubscriberList(),
14
- timerInterval = 300,
15
- timerId = null;
16
-
17
- let lastActiveElement = null;
18
- let pending = false;
19
-
20
- export class FocusManager {
21
- static subscribe(callback) {
22
- let unsubscribe = subscribers.subscribe(callback);
23
- checkTimer();
24
- return unsubscribe;
25
- }
26
-
27
- static onFocusOut(el, callback) {
28
- let active = isSelfOrDescendant(el, getActiveElement());
29
- return this.subscribe((focusedEl) => {
30
- if (!active) active = isSelfOrDescendant(el, getActiveElement());
31
- else if (!isSelfOrDescendant(el, focusedEl)) {
32
- active = false;
33
- callback(focusedEl);
34
- }
35
- });
36
- }
37
-
38
- static oneFocusOut(el, callback) {
39
- this.nudge();
40
- let off = this.subscribe((focusedEl) => {
41
- if (!isSelfOrDescendant(el, focusedEl)) {
42
- callback(focusedEl);
43
- off();
44
- }
45
- });
46
- return off;
47
- }
48
-
49
- static nudge() {
50
- if (typeof document !== "undefined" && getActiveElement() !== lastActiveElement) {
51
- if (!pending) {
52
- pending = true;
53
- setTimeout(function () {
54
- pending = false;
55
- if (getActiveElement() !== lastActiveElement) {
56
- lastActiveElement = getActiveElement();
57
- batchUpdates(() => {
58
- subscribers.notify(lastActiveElement);
59
- });
60
- checkTimer();
61
- }
62
- }, 0);
63
- }
64
- }
65
- }
66
-
67
- static focus(el) {
68
- el.focus();
69
- this.nudge();
70
- }
71
-
72
- static focusFirst(el) {
73
- let focusable = findFirst(el, isFocusable);
74
- if (focusable) this.focus(focusable);
75
- return focusable;
76
- }
77
-
78
- static focusFirstChild(el) {
79
- let focusable = findFirstChild(el, isFocusable);
80
- if (focusable) this.focus(focusable);
81
- return focusable;
82
- }
83
-
84
- static focusNext(el) {
85
- let next = el,
86
- skip = true;
87
- do {
88
- if (!skip) {
89
- let focusable = this.focusFirst(next);
90
- if (focusable) return focusable;
91
- }
92
-
93
- if (next.nextSibling) {
94
- next = next.nextSibling;
95
- skip = false;
96
- } else {
97
- next = next.parentNode;
98
- skip = true;
99
- }
100
- } while (next);
101
- }
102
-
103
- static setInterval(interval) {
104
- timerInterval = interval;
105
- checkTimer();
106
- }
107
- }
108
-
109
- export function oneFocusOut(component, el, callback) {
110
- if (!component.oneFocusOut)
111
- component.oneFocusOut = FocusManager.oneFocusOut(el, (focus) => {
112
- delete component.oneFocusOut;
113
- callback(focus);
114
- });
115
- }
116
-
117
- export function offFocusOut(component) {
118
- if (component.oneFocusOut) {
119
- component.oneFocusOut();
120
- delete component.oneFocusOut;
121
- }
122
- }
123
-
124
- export function preventFocus(e) {
125
- //Focus can be prevented only on mousedown event. On touchstart this will not work
126
- //preventDefault cannot be used as it prevents scrolling
127
- if (e.type !== "mousedown") return;
128
-
129
- e.preventDefault();
130
-
131
- unfocusElement(e.currentTarget, false);
132
- }
133
-
134
- function checkTimer() {
135
- let shouldRun = !subscribers.isEmpty();
136
-
137
- if (shouldRun && !timerId)
138
- timerId = setInterval(() => {
139
- FocusManager.nudge();
140
- }, timerInterval);
141
-
142
- if (!shouldRun && timerId) {
143
- clearInterval(timerId);
144
- timerId = null;
145
- }
146
- }
147
-
148
- export function preventFocusOnTouch(e, force = false) {
149
- if (force || isTouchEvent()) preventFocus(e);
150
- }
151
-
152
- export function unfocusElement(target = null, unfocusParentOverlay = true) {
153
- const activeElement = getActiveElement();
154
- if (!target) target = activeElement;
155
-
156
- if (unfocusParentOverlay) {
157
- let focusableOverlayContainer = closestParent(target, (el) => el.dataset?.focusableOverlayContainer);
158
- if (focusableOverlayContainer) target = focusableOverlayContainer;
159
- }
160
-
161
- //find the closest focusable parent of the target element and focus it instead
162
- let focusableParent = closestParent(
163
- target,
164
- (el) => isFocusable(el) && (!unfocusParentOverlay || el.dataset?.focusableOverlayContainer)
165
- );
166
-
167
- if (focusableParent && focusableParent !== document.body) focusableParent.focus();
168
- else activeElement.blur();
169
-
170
- FocusManager.nudge();
171
- }
1
+ import { isSelfOrDescendant, findFirst, findFirstChild, isFocusable, closestParent } from "../util/DOM";
2
+ import { batchUpdates } from "./batchUpdates";
3
+ import { SubscriberList } from "../util/SubscriberList";
4
+ import { isTouchEvent } from "../util/isTouchEvent";
5
+ import { getActiveElement } from "../util/getActiveElement";
6
+
7
+ /*
8
+ * Purpose of FocusManager is to provide focusout notifications.
9
+ * IE and Firefox do not provide relatedTarget info in blur events which makes it impossible
10
+ * to determine if focus went outside or stayed inside the component.
11
+ */
12
+
13
+ let subscribers = new SubscriberList(),
14
+ timerInterval = 300,
15
+ timerId = null;
16
+
17
+ let lastActiveElement = null;
18
+ let pending = false;
19
+
20
+ export class FocusManager {
21
+ static subscribe(callback) {
22
+ let unsubscribe = subscribers.subscribe(callback);
23
+ checkTimer();
24
+ return unsubscribe;
25
+ }
26
+
27
+ static onFocusOut(el, callback) {
28
+ let active = isSelfOrDescendant(el, getActiveElement());
29
+ return this.subscribe((focusedEl) => {
30
+ if (!active) active = isSelfOrDescendant(el, getActiveElement());
31
+ else if (!isSelfOrDescendant(el, focusedEl)) {
32
+ active = false;
33
+ callback(focusedEl);
34
+ }
35
+ });
36
+ }
37
+
38
+ static oneFocusOut(el, callback) {
39
+ this.nudge();
40
+ let off = this.subscribe((focusedEl) => {
41
+ if (!isSelfOrDescendant(el, focusedEl)) {
42
+ callback(focusedEl);
43
+ off();
44
+ }
45
+ });
46
+ return off;
47
+ }
48
+
49
+ static nudge() {
50
+ if (typeof document !== "undefined" && getActiveElement() !== lastActiveElement) {
51
+ if (!pending) {
52
+ pending = true;
53
+ setTimeout(function () {
54
+ pending = false;
55
+ if (getActiveElement() !== lastActiveElement) {
56
+ lastActiveElement = getActiveElement();
57
+ batchUpdates(() => {
58
+ subscribers.notify(lastActiveElement);
59
+ });
60
+ checkTimer();
61
+ }
62
+ }, 0);
63
+ }
64
+ }
65
+ }
66
+
67
+ static focus(el) {
68
+ el.focus();
69
+ this.nudge();
70
+ }
71
+
72
+ static focusFirst(el) {
73
+ let focusable = findFirst(el, isFocusable);
74
+ if (focusable) this.focus(focusable);
75
+ return focusable;
76
+ }
77
+
78
+ static focusFirstChild(el) {
79
+ let focusable = findFirstChild(el, isFocusable);
80
+ if (focusable) this.focus(focusable);
81
+ return focusable;
82
+ }
83
+
84
+ static focusNext(el) {
85
+ let next = el,
86
+ skip = true;
87
+ do {
88
+ if (!skip) {
89
+ let focusable = this.focusFirst(next);
90
+ if (focusable) return focusable;
91
+ }
92
+
93
+ if (next.nextSibling) {
94
+ next = next.nextSibling;
95
+ skip = false;
96
+ } else {
97
+ next = next.parentNode;
98
+ skip = true;
99
+ }
100
+ } while (next);
101
+ }
102
+
103
+ static setInterval(interval) {
104
+ timerInterval = interval;
105
+ checkTimer();
106
+ }
107
+ }
108
+
109
+ export function oneFocusOut(component, el, callback) {
110
+ if (!component.oneFocusOut)
111
+ component.oneFocusOut = FocusManager.oneFocusOut(el, (focus) => {
112
+ delete component.oneFocusOut;
113
+ callback(focus);
114
+ });
115
+ }
116
+
117
+ export function offFocusOut(component) {
118
+ if (component.oneFocusOut) {
119
+ component.oneFocusOut();
120
+ delete component.oneFocusOut;
121
+ }
122
+ }
123
+
124
+ export function preventFocus(e) {
125
+ //Focus can be prevented only on mousedown event. On touchstart this will not work
126
+ //preventDefault cannot be used as it prevents scrolling
127
+ if (e.type !== "mousedown") return;
128
+
129
+ e.preventDefault();
130
+
131
+ unfocusElement(e.currentTarget, false);
132
+ }
133
+
134
+ function checkTimer() {
135
+ let shouldRun = !subscribers.isEmpty();
136
+
137
+ if (shouldRun && !timerId)
138
+ timerId = setInterval(() => {
139
+ FocusManager.nudge();
140
+ }, timerInterval);
141
+
142
+ if (!shouldRun && timerId) {
143
+ clearInterval(timerId);
144
+ timerId = null;
145
+ }
146
+ }
147
+
148
+ export function preventFocusOnTouch(e, force = false) {
149
+ if (force || isTouchEvent()) preventFocus(e);
150
+ }
151
+
152
+ export function unfocusElement(target = null, unfocusParentOverlay = true) {
153
+ const activeElement = getActiveElement();
154
+ if (!target) target = activeElement;
155
+
156
+ if (unfocusParentOverlay) {
157
+ let focusableOverlayContainer = closestParent(target, (el) => el.dataset?.focusableOverlayContainer);
158
+ if (focusableOverlayContainer) target = focusableOverlayContainer;
159
+ }
160
+
161
+ //find the closest focusable parent of the target element and focus it instead
162
+ let focusableParent = closestParent(
163
+ target,
164
+ (el) => isFocusable(el) && (!unfocusParentOverlay || el.dataset?.focusableOverlayContainer)
165
+ );
166
+
167
+ if (focusableParent && focusableParent !== document.body) focusableParent.focus();
168
+ else activeElement.blur();
169
+
170
+ FocusManager.nudge();
171
+ }
@@ -1,72 +1,72 @@
1
- import { Record } from "../core";
2
- import { RenderingContext } from "./RenderingContext";
3
- import { View } from "../data/View";
4
- import { Widget } from "./Widget";
5
-
6
- export class Instance<ViewModel = any, Controller = any> {
7
- store: View<ViewModel>;
8
- data: Record;
9
- widget: Widget;
10
- key: number;
11
- id: string;
12
- controller: Controller;
13
- parentOptions: any;
14
- children?: Instance[];
15
-
16
- constructor(widget: Widget, key: string | number, parent?: Instance, store?: View);
17
-
18
- setStore(store: View): void;
19
-
20
- init(context: RenderingContext): void;
21
-
22
- explore(context: RenderingContext): boolean;
23
-
24
- prepare(context: RenderingContext): void;
25
-
26
- cleanup(context: RenderingContext): void;
27
-
28
- render(context: RenderingContext, keyPrefix?: string): JSX.Element | void;
29
-
30
- setState(state: Cx.Record): void;
31
-
32
- set(prop: string, value: any, internal?: boolean);
33
-
34
- definePropertySetter(prop: string, setter: (value: any) => void): boolean;
35
-
36
- /**
37
- * @protected
38
- * @param prop
39
- * @param value
40
- * @returns {boolean}
41
- */
42
- protected doSet(prop: string, value: any): boolean;
43
-
44
- replaceState(state: Cx.Config);
45
-
46
- getInstanceCache(): InstanceCache;
47
-
48
- clearChildrenCache();
49
-
50
- getChild(context: RenderingContext | null, widget: Widget, keyPrefix?: string, store?: View): Instance;
51
-
52
- getDetachedChild(widget: Widget, key: number | string, store?: View): Instance;
53
-
54
- // TODO: check return type
55
- prepareRenderCleanupChild(widget: Widget, store?: View, keyPrefix?: string, options?: object): JSX.Element | void;
56
-
57
- getJsxEventProps(): Cx.Config;
58
-
59
- nestedDataSet(key: string, value: any, dataConfig: Cx.Config): boolean;
60
-
61
- invokeControllerMethod(methodName: string, ...args: any[]);
62
- }
63
-
64
- export class InstanceCache {
65
- constructor(parent: Instance);
66
-
67
- getChild(widget: Widget, store: View, keyPrefix?: string): Instance;
68
-
69
- mark();
70
-
71
- sweep();
72
- }
1
+ import { Record } from "../core";
2
+ import { RenderingContext } from "./RenderingContext";
3
+ import { View } from "../data/View";
4
+ import { Widget } from "./Widget";
5
+
6
+ export class Instance<ViewModel = any, Controller = any> {
7
+ store: View<ViewModel>;
8
+ data: Record;
9
+ widget: Widget;
10
+ key: number;
11
+ id: string;
12
+ controller: Controller;
13
+ parentOptions: any;
14
+ children?: Instance[];
15
+
16
+ constructor(widget: Widget, key: string | number, parent?: Instance, store?: View);
17
+
18
+ setStore(store: View): void;
19
+
20
+ init(context: RenderingContext): void;
21
+
22
+ explore(context: RenderingContext): boolean;
23
+
24
+ prepare(context: RenderingContext): void;
25
+
26
+ cleanup(context: RenderingContext): void;
27
+
28
+ render(context: RenderingContext, keyPrefix?: string): JSX.Element | void;
29
+
30
+ setState(state: Cx.Record): void;
31
+
32
+ set(prop: string, value: any, internal?: boolean);
33
+
34
+ definePropertySetter(prop: string, setter: (value: any) => void): boolean;
35
+
36
+ /**
37
+ * @protected
38
+ * @param prop
39
+ * @param value
40
+ * @returns {boolean}
41
+ */
42
+ protected doSet(prop: string, value: any): boolean;
43
+
44
+ replaceState(state: Cx.Config);
45
+
46
+ getInstanceCache(): InstanceCache;
47
+
48
+ clearChildrenCache();
49
+
50
+ getChild(context: RenderingContext | null, widget: Widget, keyPrefix?: string, store?: View): Instance;
51
+
52
+ getDetachedChild(widget: Widget, key: number | string, store?: View): Instance;
53
+
54
+ // TODO: check return type
55
+ prepareRenderCleanupChild(widget: Widget, store?: View, keyPrefix?: string, options?: object): JSX.Element | void;
56
+
57
+ getJsxEventProps(): Cx.Config;
58
+
59
+ nestedDataSet(key: string, value: any, dataConfig: Cx.Config): boolean;
60
+
61
+ invokeControllerMethod(methodName: string, ...args: any[]);
62
+ }
63
+
64
+ export class InstanceCache {
65
+ constructor(parent: Instance);
66
+
67
+ getChild(widget: Widget, store: View, keyPrefix?: string): Instance;
68
+
69
+ mark();
70
+
71
+ sweep();
72
+ }
package/src/ui/VDOM.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { HtmlElement, react } from "cx/widgets";
2
- import { ReactElement } from "react";
3
- export interface VDOM {
4
- createElement(type, props, ...children);
5
- allowRenderOutputCaching?: boolean;
6
-
7
- DOM: {
8
- render(reactElement: ReactElement, container: HtmlElement): void;
9
- unmountComponentAtNode(container: HtmlElement): void;
10
- createRoot?(container: HtmlElement): any;
11
- };
12
- }
1
+ import { HtmlElement, react } from "cx/widgets";
2
+ import { ReactElement } from "react";
3
+ export interface VDOM {
4
+ createElement(type, props, ...children);
5
+ allowRenderOutputCaching?: boolean;
6
+
7
+ DOM: {
8
+ render(reactElement: ReactElement, container: HtmlElement): void;
9
+ unmountComponentAtNode(container: HtmlElement): void;
10
+ createRoot?(container: HtmlElement): any;
11
+ };
12
+ }
@@ -1,58 +1,58 @@
1
- import { Widget, VDOM } from "../Widget";
2
- import { Store } from "../../data/Store";
3
- import { Cx } from "../Cx";
4
-
5
- export function startAppLoop(parentDOMElement, storeOrInstance, widget, options = {}) {
6
- if (!parentDOMElement || parentDOMElement.nodeType !== 1)
7
- throw new Error("First argument to startAppLoop should be a valid DOM element.");
8
-
9
- let store, instance, parentInstance;
10
-
11
- if (!storeOrInstance) storeOrInstance = new Store();
12
-
13
- if (storeOrInstance.notify) store = storeOrInstance;
14
- else if (storeOrInstance.getChild) {
15
- if (storeOrInstance.widget === widget) instance = storeOrInstance;
16
- else parentInstance = storeOrInstance;
17
- } else throw new Error("Second argument to startAppLoop should be either of type Store or Instance");
18
-
19
- let content = (
20
- <Cx
21
- store={store}
22
- widget={widget}
23
- instance={instance}
24
- parentInstance={parentInstance}
25
- options={options}
26
- subscribe
27
- />
28
- );
29
-
30
- let root = null;
31
- if (VDOM.DOM.createRoot) {
32
- root = VDOM.DOM.createRoot(parentDOMElement);
33
- root.render(content);
34
- } else VDOM.DOM.render(content, parentDOMElement);
35
-
36
- let stopped = false;
37
-
38
- return function () {
39
- if (stopped) return;
40
-
41
- stopped = true;
42
-
43
- if (!options.destroyDelay) destroy(parentDOMElement, options, root);
44
- else {
45
- setTimeout(() => {
46
- destroy(parentDOMElement, options, root);
47
- }, options.destroyDelay);
48
- }
49
- };
50
- }
51
-
52
- function destroy(parentDOMElement, options, root) {
53
- if (root) root.unmount();
54
- else VDOM.DOM.unmountComponentAtNode(parentDOMElement);
55
-
56
- if (options.removeParentDOMElement && parentDOMElement.parentNode)
57
- parentDOMElement.parentNode.removeChild(parentDOMElement);
58
- }
1
+ import { Widget, VDOM } from "../Widget";
2
+ import { Store } from "../../data/Store";
3
+ import { Cx } from "../Cx";
4
+
5
+ export function startAppLoop(parentDOMElement, storeOrInstance, widget, options = {}) {
6
+ if (!parentDOMElement || parentDOMElement.nodeType !== 1)
7
+ throw new Error("First argument to startAppLoop should be a valid DOM element.");
8
+
9
+ let store, instance, parentInstance;
10
+
11
+ if (!storeOrInstance) storeOrInstance = new Store();
12
+
13
+ if (storeOrInstance.notify) store = storeOrInstance;
14
+ else if (storeOrInstance.getChild) {
15
+ if (storeOrInstance.widget === widget) instance = storeOrInstance;
16
+ else parentInstance = storeOrInstance;
17
+ } else throw new Error("Second argument to startAppLoop should be either of type Store or Instance");
18
+
19
+ let content = (
20
+ <Cx
21
+ store={store}
22
+ widget={widget}
23
+ instance={instance}
24
+ parentInstance={parentInstance}
25
+ options={options}
26
+ subscribe
27
+ />
28
+ );
29
+
30
+ let root = null;
31
+ if (VDOM.DOM.createRoot) {
32
+ root = VDOM.DOM.createRoot(parentDOMElement);
33
+ root.render(content);
34
+ } else VDOM.DOM.render(content, parentDOMElement);
35
+
36
+ let stopped = false;
37
+
38
+ return function () {
39
+ if (stopped) return;
40
+
41
+ stopped = true;
42
+
43
+ if (!options.destroyDelay) destroy(parentDOMElement, options, root);
44
+ else {
45
+ setTimeout(() => {
46
+ destroy(parentDOMElement, options, root);
47
+ }, options.destroyDelay);
48
+ }
49
+ };
50
+ }
51
+
52
+ function destroy(parentDOMElement, options, root) {
53
+ if (root) root.unmount();
54
+ else VDOM.DOM.unmountComponentAtNode(parentDOMElement);
55
+
56
+ if (options.removeParentDOMElement && parentDOMElement.parentNode)
57
+ parentDOMElement.parentNode.removeChild(parentDOMElement);
58
+ }