shinkom 1.0.3 → 1.1.0
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.
- package/README.md +3 -2
- package/dist/bundles/_virtual/_rolldown/runtime.js +1 -1
- package/dist/bundles/core/constants.d.ts +1 -1
- package/dist/bundles/core/constants.js +5 -2
- package/dist/bundles/core/elements/compat-view-element.d.ts +100 -0
- package/dist/bundles/core/elements/compat-view-element.js +440 -0
- package/dist/bundles/core/elements/control-panel-element.d.ts +45 -0
- package/dist/bundles/core/elements/control-panel-element.js +99 -0
- package/dist/bundles/core/elements/index.d.ts +13 -0
- package/dist/bundles/core/elements/index.js +13 -0
- package/dist/bundles/core/elements/inspector-element.d.ts +27 -0
- package/dist/bundles/core/elements/inspector-element.js +58 -0
- package/dist/bundles/core/elements/recent-result-item.js +46 -0
- package/dist/bundles/core/elements/results-history-item.js +46 -0
- package/dist/bundles/core/elements/templates/compat-view.templates.js +462 -0
- package/dist/bundles/core/elements/templates/control-panel.templates.js +335 -0
- package/dist/bundles/core/elements/templates/root-styles.template.js +40 -0
- package/dist/bundles/core/event-bus.d.ts +19 -5
- package/dist/bundles/core/event-bus.js +21 -8
- package/dist/bundles/core/helpers.js +24 -2
- package/dist/bundles/core/index.d.ts +5 -2
- package/dist/bundles/core/index.js +6 -2
- package/dist/bundles/core/state-service.d.ts +24 -4
- package/dist/bundles/core/state-service.js +25 -5
- package/dist/bundles/core/ui-component.d.ts +25 -6
- package/dist/bundles/core/ui-component.js +31 -12
- package/dist/bundles/engine/engine.d.ts +57 -9
- package/dist/bundles/engine/engine.js +115 -31
- package/dist/bundles/engine/index.js +1 -1
- package/dist/bundles/gen/browser-data.js +96 -96
- package/dist/bundles/gen/browser-usage-data.js +671 -671
- package/dist/bundles/gen/index.js +1 -1
- package/dist/bundles/index.d.ts +6 -2
- package/dist/bundles/index.js +8 -2
- package/dist/bundles/pkg/shinkore.d.ts +1 -1
- package/dist/bundles/pkg/shinkore.js +1 -1
- package/dist/bundles/shinkom.d.ts +9 -1
- package/dist/bundles/shinkom.js +31 -6
- package/dist/bundles/types/public.d.ts +13 -29
- package/dist/bundles/types/types.d.ts +99 -0
- package/dist/bundles/ui/compat-ui/compat-ui.d.ts +12 -2
- package/dist/bundles/ui/compat-ui/compat-ui.js +12 -2
- package/dist/bundles/ui/compat-ui/index.js +8 -0
- package/dist/bundles/ui/compatibility-view/compatibility-view.d.ts +42 -0
- package/dist/bundles/ui/compatibility-view/compatibility-view.js +229 -0
- package/dist/bundles/ui/compatibility-view/index.js +8 -0
- package/dist/bundles/ui/control-panel/control-panel.d.ts +30 -16
- package/dist/bundles/ui/control-panel/control-panel.js +188 -277
- package/dist/bundles/ui/control-panel/index.js +8 -0
- package/dist/bundles/ui/index.d.ts +3 -2
- package/dist/bundles/ui/index.js +7 -2
- package/dist/bundles/ui/inspector/index.js +8 -0
- package/dist/bundles/ui/inspector/inspector.d.ts +60 -6
- package/dist/bundles/ui/inspector/inspector.js +149 -69
- package/dist/modules/core/constants.cjs +17 -1
- package/dist/modules/core/elements/compat-view-element.cjs +434 -0
- package/dist/modules/core/elements/control-panel-element.cjs +93 -0
- package/dist/modules/core/elements/index.cjs +11 -0
- package/dist/modules/core/elements/inspector-element.cjs +52 -0
- package/dist/modules/core/elements/recent-result-item.cjs +39 -0
- package/dist/modules/core/elements/results-history-item.cjs +39 -0
- package/dist/modules/core/elements/templates/compat-view.templates.cjs +458 -0
- package/dist/modules/core/elements/templates/control-panel.templates.cjs +332 -0
- package/dist/modules/core/elements/templates/root-styles.template.cjs +33 -0
- package/dist/modules/core/event-bus.cjs +43 -1
- package/dist/modules/core/helpers.cjs +41 -1
- package/dist/modules/core/index.cjs +16 -1
- package/dist/modules/core/state-service.cjs +74 -1
- package/dist/modules/core/ui-component.cjs +65 -1
- package/dist/modules/engine/engine.cjs +232 -1
- package/dist/modules/gen/browser-data.cjs +100 -1
- package/dist/modules/gen/browser-usage-data.cjs +675 -1
- package/dist/modules/gen/compat-data.cjs +31015 -1
- package/dist/modules/gen/index.cjs +7 -1
- package/dist/modules/index.cjs +27 -1
- package/dist/modules/pkg/shinkore.cjs +459 -1
- package/dist/modules/shinkom.cjs +73 -1
- package/dist/modules/ui/compat-ui/compat-ui.cjs +53 -1
- package/dist/modules/ui/compat-ui/index.cjs +1 -0
- package/dist/modules/ui/compatibility-view/compatibility-view.cjs +223 -0
- package/dist/modules/ui/compatibility-view/index.cjs +1 -0
- package/dist/modules/ui/control-panel/control-panel.cjs +314 -182
- package/dist/modules/ui/control-panel/index.cjs +1 -0
- package/dist/modules/ui/index.cjs +13 -1
- package/dist/modules/ui/inspector/index.cjs +1 -0
- package/dist/modules/ui/inspector/inspector.cjs +388 -1
- package/package.json +13 -6
- package/dist/bundles/node_modules/@mdn/browser-compat-data/types.d.ts +0 -78
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shinkom - inspector
|
|
3
|
-
* @version 1.0
|
|
3
|
+
* @version 1.1.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - OneilNvM
|
|
6
6
|
*/
|
|
@@ -8,12 +8,46 @@
|
|
|
8
8
|
import { ShinkomBus } from "../../core/event-bus.js";
|
|
9
9
|
import { ShinkomState } from "../../core/state-service.js";
|
|
10
10
|
import { UIComponent } from "../../core/ui-component.js";
|
|
11
|
+
import { CompatInspectorElement } from "../../core/elements/inspector-element.js";
|
|
11
12
|
import { InspectorConfig as InspectorConfig$1, UISharedState as UISharedState$1, UISharedStateProps as UISharedStateProps$1 } from "../../types/public.js";
|
|
12
13
|
|
|
13
14
|
//#region src/ui/inspector/inspector.d.ts
|
|
14
|
-
|
|
15
|
+
/**
|
|
16
|
+
* CompatInspector manages the interactive compatibility inspector overlay.
|
|
17
|
+
*
|
|
18
|
+
* It mounts the custom element `<sk-compat-inspector>`, synchronizes
|
|
19
|
+
* the overlay state with the shared UI state, and emits inspection
|
|
20
|
+
* requests through the Shinkom event bus.
|
|
21
|
+
*
|
|
22
|
+
* The inspector supports pointer tracking, element freezing, optional
|
|
23
|
+
* keyboard shortcuts, and soft mount/unmount flows that preserve or
|
|
24
|
+
* skip event bus bindings.
|
|
25
|
+
*
|
|
26
|
+
* @extends {UIComponent}
|
|
27
|
+
*/
|
|
15
28
|
declare class CompatInspector extends UIComponent {
|
|
16
29
|
/**
|
|
30
|
+
* Register custom elements to the CustomElementRegistry.
|
|
31
|
+
*/
|
|
32
|
+
static register(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Initializes the compatibility inspector.
|
|
35
|
+
*
|
|
36
|
+
* It requires an instance of the `ShinkomBus` and `ShinkomState` to listen
|
|
37
|
+
* for event bus emits and state service notifications.
|
|
38
|
+
*
|
|
39
|
+
* It also registers the `<sk-compat-inspector>` custom element.
|
|
40
|
+
*
|
|
41
|
+
* It has an optional configuration object for disabling the inspector
|
|
42
|
+
* and toggling keyboard shortcuts.
|
|
43
|
+
*
|
|
44
|
+
* ### Keyboard Shortcuts
|
|
45
|
+
*
|
|
46
|
+
* - Create inspector: Ctrl + Alt + c
|
|
47
|
+
* - Reset inspector: Ctrl + Shift + |
|
|
48
|
+
* - Destroy inspector: Ctrl + Alt + \
|
|
49
|
+
* - Toggle element switching: Ctrl + \
|
|
50
|
+
*
|
|
17
51
|
* @param {ShinkomBus} bus
|
|
18
52
|
* @param {ShinkomState} stateService
|
|
19
53
|
* @param {InspectorConfig | undefined} config
|
|
@@ -23,18 +57,38 @@ declare class CompatInspector extends UIComponent {
|
|
|
23
57
|
config: InspectorConfig | undefined;
|
|
24
58
|
/**@type {boolean} */
|
|
25
59
|
enableSwitching: boolean;
|
|
26
|
-
/**@type {
|
|
27
|
-
inspectorEl:
|
|
60
|
+
/**@type {CompatInspectorElement | null} */
|
|
61
|
+
inspectorEl: CompatInspectorElement | null;
|
|
28
62
|
/**@type {HTMLElement | null} */
|
|
29
63
|
frozenTarget: HTMLElement | null;
|
|
64
|
+
/**@type {(() => void)[]} */
|
|
65
|
+
unsubEvents: (() => void)[];
|
|
30
66
|
/**
|
|
31
|
-
*
|
|
67
|
+
* Mounts the inspector without setting up event bus listeners or state listeners.
|
|
68
|
+
*
|
|
69
|
+
* This is useful when the inspector should be rendered and tracked visually,
|
|
70
|
+
* but the surrounding application already manages bus events separately.
|
|
71
|
+
*
|
|
72
|
+
* **Only use this if you do not need to setup listeners.**
|
|
32
73
|
*/
|
|
33
|
-
|
|
74
|
+
mountSoft(): void;
|
|
34
75
|
/**
|
|
35
76
|
* Resets the inspector.
|
|
36
77
|
*/
|
|
37
78
|
reset(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Resets the inspector using soft operations.
|
|
81
|
+
*/
|
|
82
|
+
resetSoft(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Unmounts the inspector without cleaning up event bus listeners or state listeners.
|
|
85
|
+
*
|
|
86
|
+
* This preserves any active bus subscriptions when the visual overlay is
|
|
87
|
+
* temporarily removed.
|
|
88
|
+
*
|
|
89
|
+
* **Only use this if you still need the listeners after unmounting.**
|
|
90
|
+
*/
|
|
91
|
+
unmountSoft(): void;
|
|
38
92
|
#private;
|
|
39
93
|
}
|
|
40
94
|
type UISharedState = UISharedState$1;
|
|
@@ -1,52 +1,105 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shinkom - inspector
|
|
3
|
-
* @version 1.0
|
|
3
|
+
* @version 1.1.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 - OneilNvM
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { UIComponent } from "../../core/ui-component.js";
|
|
9
|
+
import { CompatInspectorElement } from "../../core/elements/inspector-element.js";
|
|
10
|
+
import "../../core/elements/index.js";
|
|
11
|
+
import "../../core/index.js";
|
|
9
12
|
//#region src/ui/inspector/inspector.js
|
|
10
13
|
/**@typedef {import('../../types/public').UISharedState} UISharedState */
|
|
11
14
|
/**@typedef {import('../../types/public').InspectorConfig} InspectorConfig */
|
|
12
15
|
/**@typedef {import('../../types/public').UISharedStateProps} UISharedStateProps */
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
* CompatInspector manages the interactive compatibility inspector overlay.
|
|
18
|
+
*
|
|
19
|
+
* It mounts the custom element `<sk-compat-inspector>`, synchronizes
|
|
20
|
+
* the overlay state with the shared UI state, and emits inspection
|
|
21
|
+
* requests through the Shinkom event bus.
|
|
22
|
+
*
|
|
23
|
+
* The inspector supports pointer tracking, element freezing, optional
|
|
24
|
+
* keyboard shortcuts, and soft mount/unmount flows that preserve or
|
|
25
|
+
* skip event bus bindings.
|
|
26
|
+
*
|
|
27
|
+
* @extends {UIComponent}
|
|
28
|
+
*/
|
|
29
|
+
var CompatInspector = class CompatInspector extends UIComponent {
|
|
15
30
|
/**@type {UISharedState | null} */
|
|
16
31
|
#stateBind = null;
|
|
17
32
|
#freezeInspector = false;
|
|
18
33
|
/**@type {AbortController | null} */
|
|
19
34
|
#inspectorController = null;
|
|
20
|
-
/**@type {HTMLDivElement | null} */
|
|
21
|
-
#ignorePanelEl = null;
|
|
22
35
|
/**
|
|
36
|
+
* Initializes the compatibility inspector.
|
|
37
|
+
*
|
|
38
|
+
* It requires an instance of the `ShinkomBus` and `ShinkomState` to listen
|
|
39
|
+
* for event bus emits and state service notifications.
|
|
40
|
+
*
|
|
41
|
+
* It also registers the `<sk-compat-inspector>` custom element.
|
|
42
|
+
*
|
|
43
|
+
* It has an optional configuration object for disabling the inspector
|
|
44
|
+
* and toggling keyboard shortcuts.
|
|
45
|
+
*
|
|
46
|
+
* ### Keyboard Shortcuts
|
|
47
|
+
*
|
|
48
|
+
* - Create inspector: Ctrl + Alt + c
|
|
49
|
+
* - Reset inspector: Ctrl + Shift + |
|
|
50
|
+
* - Destroy inspector: Ctrl + Alt + \
|
|
51
|
+
* - Toggle element switching: Ctrl + \
|
|
52
|
+
*
|
|
23
53
|
* @param {ShinkomBus} bus
|
|
24
54
|
* @param {ShinkomState} stateService
|
|
25
55
|
* @param {InspectorConfig | undefined} config
|
|
26
56
|
*/
|
|
27
57
|
constructor(bus, stateService, config = void 0) {
|
|
28
58
|
super(bus, stateService);
|
|
59
|
+
CompatInspector.register();
|
|
29
60
|
/**@type {InspectorConfig | undefined} */
|
|
30
61
|
this.config = config;
|
|
31
62
|
/**@type {boolean} */
|
|
32
63
|
this.enableSwitching = false;
|
|
33
|
-
/**@type {
|
|
64
|
+
/**@type {CompatInspectorElement | null} */
|
|
34
65
|
this.inspectorEl = null;
|
|
35
66
|
/**@type {HTMLElement | null} */
|
|
36
67
|
this.frozenTarget = null;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
/**@type {(() => void)[]} */
|
|
69
|
+
this.unsubEvents = [];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Register custom elements to the CustomElementRegistry.
|
|
73
|
+
*/
|
|
74
|
+
static register() {
|
|
75
|
+
if ("customElements" in globalThis && !globalThis.customElements.get("sk-compat-inspector")) globalThis.customElements.define("sk-compat-inspector", CompatInspectorElement);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Registers event bus listeners for the inspector.
|
|
79
|
+
*/
|
|
80
|
+
#setupEventBusListeners() {
|
|
81
|
+
this.unsubEvents = [
|
|
82
|
+
this.bus.on("ci:toggle", () => {
|
|
83
|
+
if (this.#stateBind?.inspectorActive) this.#removeGlobalListeners();
|
|
84
|
+
else this.#setupGlobalListeners();
|
|
85
|
+
}),
|
|
86
|
+
this.bus.on("ci:create", () => {
|
|
87
|
+
this.mountSoft();
|
|
88
|
+
}),
|
|
89
|
+
this.bus.on("ci:reset", () => {
|
|
90
|
+
this.resetSoft();
|
|
91
|
+
}),
|
|
92
|
+
this.bus.on("ci:destroy", () => {
|
|
93
|
+
this.unmountSoft();
|
|
94
|
+
})
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Removes event bus listeners for the inspector.
|
|
99
|
+
*/
|
|
100
|
+
#cleanupEventBusListeners() {
|
|
101
|
+
this.unsubEvents.forEach((cleanup) => cleanup());
|
|
102
|
+
this.unsubEvents = [];
|
|
50
103
|
}
|
|
51
104
|
/**
|
|
52
105
|
* Handler responds to keyboard shortcuts.
|
|
@@ -57,20 +110,19 @@ var CompatInspector = class extends UIComponent {
|
|
|
57
110
|
const shiftDown = e.shiftKey;
|
|
58
111
|
const altDown = e.altKey;
|
|
59
112
|
if (!this.inspectorEl && ctrlDown && altDown && e.key === "c") {
|
|
60
|
-
this.
|
|
113
|
+
this.mountSoft();
|
|
61
114
|
return;
|
|
62
115
|
}
|
|
63
116
|
if (this.inspectorEl && ctrlDown && shiftDown && e.key === "|") {
|
|
64
|
-
this.
|
|
117
|
+
this.resetSoft();
|
|
65
118
|
return;
|
|
66
119
|
}
|
|
67
120
|
if (this.inspectorEl && ctrlDown && altDown && e.key === "\\") {
|
|
68
|
-
this.
|
|
121
|
+
this.unmountSoft();
|
|
69
122
|
return;
|
|
70
123
|
}
|
|
71
124
|
if (ctrlDown && e.key === "\\") {
|
|
72
125
|
this.enableSwitching = !this.enableSwitching;
|
|
73
|
-
console.log(`Switching is ${this.enableSwitching ? "enabled" : "disabled"}`);
|
|
74
126
|
if (this.#stateBind) this.#stateBind.inspectorSwitching = this.enableSwitching;
|
|
75
127
|
}
|
|
76
128
|
};
|
|
@@ -79,7 +131,7 @@ var CompatInspector = class extends UIComponent {
|
|
|
79
131
|
* @param {PointerEvent} e
|
|
80
132
|
*/
|
|
81
133
|
#handleToggleFreeze = (e) => {
|
|
82
|
-
if (e.composedPath().includes(this.#ignorePanelEl)) return;
|
|
134
|
+
if (e.composedPath().includes(this.#stateBind?.ignorePanelEl) || e.composedPath().includes(this.#stateBind?.ignoreCompatViewEl)) return;
|
|
83
135
|
e.preventDefault();
|
|
84
136
|
e.stopPropagation();
|
|
85
137
|
if (!this.#freezeInspector) {
|
|
@@ -97,10 +149,16 @@ var CompatInspector = class extends UIComponent {
|
|
|
97
149
|
*/
|
|
98
150
|
#freeze(target) {
|
|
99
151
|
if (!this.inspectorEl) return;
|
|
152
|
+
const { width, height, top, left } = target.getBoundingClientRect();
|
|
153
|
+
const scrollTop = window.scrollY;
|
|
154
|
+
const scrollLeft = window.scrollX;
|
|
100
155
|
this.#freezeInspector = true;
|
|
101
156
|
this.frozenTarget = target;
|
|
102
157
|
this.#inspect(this.frozenTarget.outerHTML);
|
|
103
|
-
Object.assign(this.inspectorEl.style, {
|
|
158
|
+
Object.assign(this.inspectorEl.shadowHost.style, {
|
|
159
|
+
width: `${width}px`,
|
|
160
|
+
height: `${height}px`,
|
|
161
|
+
transform: `translateX(${left + scrollLeft}px) translateY(${top + scrollTop}px)`,
|
|
104
162
|
backgroundColor: "rgba(255,0,0,.3)",
|
|
105
163
|
outlineColor: "rgb(255,0,0)"
|
|
106
164
|
});
|
|
@@ -120,7 +178,7 @@ var CompatInspector = class extends UIComponent {
|
|
|
120
178
|
if (!this.inspectorEl) return;
|
|
121
179
|
this.#freezeInspector = false;
|
|
122
180
|
this.frozenTarget = null;
|
|
123
|
-
Object.assign(this.inspectorEl.style, {
|
|
181
|
+
Object.assign(this.inspectorEl.shadowHost.style, {
|
|
124
182
|
backgroundColor: "rgba(0,255,0,.3)",
|
|
125
183
|
outlineColor: "rgb(0,255,0)"
|
|
126
184
|
});
|
|
@@ -162,48 +220,13 @@ var CompatInspector = class extends UIComponent {
|
|
|
162
220
|
const { width, height, top, left } = target.getBoundingClientRect();
|
|
163
221
|
const scrollTop = window.scrollY;
|
|
164
222
|
const scrollLeft = window.scrollX;
|
|
165
|
-
Object.assign(this.inspectorEl.style, {
|
|
223
|
+
Object.assign(this.inspectorEl.shadowHost.style, {
|
|
166
224
|
width: `${width}px`,
|
|
167
225
|
height: `${height}px`,
|
|
168
226
|
transform: `translateX(${left + scrollLeft}px) translateY(${top + scrollTop}px)`
|
|
169
227
|
});
|
|
170
228
|
}
|
|
171
229
|
/**
|
|
172
|
-
* Creates the inspector element.
|
|
173
|
-
*/
|
|
174
|
-
createInspector() {
|
|
175
|
-
if (this.inspectorEl) {
|
|
176
|
-
console.warn("Inspector element already exists.");
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
this.inspectorEl = document.createElement("div");
|
|
180
|
-
this.inspectorEl.id = "compat-inspector";
|
|
181
|
-
Object.assign(this.inspectorEl.style, {
|
|
182
|
-
position: "absolute",
|
|
183
|
-
top: "0",
|
|
184
|
-
backgroundColor: "rgba(0, 255, 0, .3)",
|
|
185
|
-
outlineWidth: "1px",
|
|
186
|
-
outlineStyle: "dashed",
|
|
187
|
-
outlineColor: "rgb(0, 255, 0)",
|
|
188
|
-
outlineOffset: "4px",
|
|
189
|
-
zIndex: "9998",
|
|
190
|
-
transitionProperty: "width, height, transform",
|
|
191
|
-
transitionDuration: "300ms",
|
|
192
|
-
transitionTimingFunction: "ease-out",
|
|
193
|
-
willChange: "width, height, transform",
|
|
194
|
-
pointerEvents: "none"
|
|
195
|
-
});
|
|
196
|
-
document.body.appendChild(this.inspectorEl);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Set inspector to ignore control panel div.
|
|
200
|
-
* @param {HTMLDivElement | null} el
|
|
201
|
-
*/
|
|
202
|
-
#setIgnorePanel(el) {
|
|
203
|
-
if (!(el instanceof HTMLDivElement) && el !== null) throw new Error("el must be of type HTMLDivElement or null");
|
|
204
|
-
this.#ignorePanelEl = el;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
230
|
* @param {UISharedState} state
|
|
208
231
|
*/
|
|
209
232
|
bindState(state) {
|
|
@@ -220,18 +243,40 @@ var CompatInspector = class extends UIComponent {
|
|
|
220
243
|
case "inspectorSwitching":
|
|
221
244
|
this.enableSwitching = val;
|
|
222
245
|
break;
|
|
223
|
-
case "ignorePanelEl":
|
|
224
|
-
this.#setIgnorePanel(val);
|
|
225
|
-
break;
|
|
226
246
|
default: break;
|
|
227
247
|
}
|
|
228
248
|
}
|
|
229
249
|
mount() {
|
|
230
|
-
if (this.inspectorEl || this.config?.disabled) {
|
|
250
|
+
if (this.inspectorEl || this.config?.disabled || document.querySelector("sk-compat-inspector")) {
|
|
251
|
+
console.warn("Inspector is either disabled or already exists");
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
console.log("Creating inspector");
|
|
255
|
+
this.inspectorEl = document.createElement("sk-compat-inspector");
|
|
256
|
+
document.body.appendChild(this.inspectorEl);
|
|
257
|
+
this.#setupGlobalListeners();
|
|
258
|
+
this.#setupEventBusListeners();
|
|
259
|
+
if (this.#stateBind) {
|
|
260
|
+
this.#stateBind.inspectorActive = this.inspectorEl !== null;
|
|
261
|
+
this.#stateBind.inspectorExists = this.inspectorEl !== null;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Mounts the inspector without setting up event bus listeners or state listeners.
|
|
266
|
+
*
|
|
267
|
+
* This is useful when the inspector should be rendered and tracked visually,
|
|
268
|
+
* but the surrounding application already manages bus events separately.
|
|
269
|
+
*
|
|
270
|
+
* **Only use this if you do not need to setup listeners.**
|
|
271
|
+
*/
|
|
272
|
+
mountSoft() {
|
|
273
|
+
if (this.inspectorEl || this.config?.disabled || document.querySelector("sk-compat-inspector")) {
|
|
231
274
|
console.warn("Inspector is either disabled or already exists");
|
|
232
275
|
return;
|
|
233
276
|
}
|
|
234
|
-
|
|
277
|
+
console.log("Soft creating inspector");
|
|
278
|
+
this.inspectorEl = document.createElement("sk-compat-inspector");
|
|
279
|
+
document.body.appendChild(this.inspectorEl);
|
|
235
280
|
this.#setupGlobalListeners();
|
|
236
281
|
if (this.#stateBind) {
|
|
237
282
|
this.#stateBind.inspectorActive = this.inspectorEl !== null;
|
|
@@ -272,7 +317,7 @@ var CompatInspector = class extends UIComponent {
|
|
|
272
317
|
* Resets the inspector.
|
|
273
318
|
*/
|
|
274
319
|
reset() {
|
|
275
|
-
if (!this.inspectorEl) {
|
|
320
|
+
if (!this.inspectorEl || document.querySelector("sk-compat-inspector")) {
|
|
276
321
|
console.warn("Cannot reset inspector as it does not exist.");
|
|
277
322
|
return;
|
|
278
323
|
}
|
|
@@ -280,14 +325,49 @@ var CompatInspector = class extends UIComponent {
|
|
|
280
325
|
this.unmount();
|
|
281
326
|
this.mount();
|
|
282
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Resets the inspector using soft operations.
|
|
330
|
+
*/
|
|
331
|
+
resetSoft() {
|
|
332
|
+
if (!this.inspectorEl) {
|
|
333
|
+
console.warn("Cannot reset inspector as it does not exist.");
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
console.log("Soft resetting inspector");
|
|
337
|
+
this.unmountSoft();
|
|
338
|
+
this.mountSoft();
|
|
339
|
+
}
|
|
283
340
|
unmount() {
|
|
284
341
|
try {
|
|
285
|
-
if (!this.inspectorEl) {
|
|
342
|
+
if (!this.inspectorEl && this.unsubEvents.length === 0) {
|
|
286
343
|
console.warn("Cannot destroy inspector as it does not exist.");
|
|
287
344
|
return;
|
|
288
345
|
}
|
|
289
346
|
console.log("Destroying inspector");
|
|
290
347
|
this.#resetInternalState();
|
|
348
|
+
this.inspectorEl?.remove();
|
|
349
|
+
this.inspectorEl = null;
|
|
350
|
+
this.#cleanupEventBusListeners();
|
|
351
|
+
} catch (error) {
|
|
352
|
+
console.error(`Inspector destroy error: ${error}`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Unmounts the inspector without cleaning up event bus listeners or state listeners.
|
|
357
|
+
*
|
|
358
|
+
* This preserves any active bus subscriptions when the visual overlay is
|
|
359
|
+
* temporarily removed.
|
|
360
|
+
*
|
|
361
|
+
* **Only use this if you still need the listeners after unmounting.**
|
|
362
|
+
*/
|
|
363
|
+
unmountSoft() {
|
|
364
|
+
try {
|
|
365
|
+
if (!this.inspectorEl) {
|
|
366
|
+
console.warn("Cannot destroy inspector as it does not exist.");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
console.log("Soft destroying inspector");
|
|
370
|
+
this.#resetInternalState();
|
|
291
371
|
this.inspectorEl.remove();
|
|
292
372
|
this.inspectorEl = null;
|
|
293
373
|
} catch (error) {
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/constants.js
|
|
3
|
+
/**@typedef {import('../types/public').UISharedState} UISharedState */
|
|
4
|
+
/**@type {UISharedState} */
|
|
5
|
+
const DEFAULT_STATE = {
|
|
6
|
+
inspectorExists: false,
|
|
7
|
+
inspectorActive: false,
|
|
8
|
+
inspectorSwitching: false,
|
|
9
|
+
ignorePanelEl: null,
|
|
10
|
+
ignoreCompatViewEl: null,
|
|
11
|
+
multiElements: false,
|
|
12
|
+
depthLevel: 0,
|
|
13
|
+
compatViewTab: "overview",
|
|
14
|
+
maxResultsHistory: 10
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.DEFAULT_STATE = DEFAULT_STATE;
|