shinkom 1.0.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.
Files changed (58) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +399 -0
  3. package/dist/bundles/_virtual/_rolldown/runtime.js +14 -0
  4. package/dist/bundles/core/constants.d.ts +16 -0
  5. package/dist/bundles/core/constants.js +20 -0
  6. package/dist/bundles/core/event-bus.d.ts +33 -0
  7. package/dist/bundles/core/event-bus.js +36 -0
  8. package/dist/bundles/core/helpers.js +25 -0
  9. package/dist/bundles/core/index.d.ts +12 -0
  10. package/dist/bundles/core/index.js +12 -0
  11. package/dist/bundles/core/state-service.d.ts +37 -0
  12. package/dist/bundles/core/state-service.js +60 -0
  13. package/dist/bundles/core/ui-component.d.ts +45 -0
  14. package/dist/bundles/core/ui-component.js +52 -0
  15. package/dist/bundles/engine/engine.d.ts +61 -0
  16. package/dist/bundles/engine/engine.js +154 -0
  17. package/dist/bundles/engine/index.js +8 -0
  18. package/dist/bundles/gen/browser-data.js +96 -0
  19. package/dist/bundles/gen/browser-usage-data.js +669 -0
  20. package/dist/bundles/gen/compat-data.js +1 -0
  21. package/dist/bundles/gen/index.js +14 -0
  22. package/dist/bundles/index.d.ts +16 -0
  23. package/dist/bundles/index.js +17 -0
  24. package/dist/bundles/node_modules/@mdn/browser-compat-data/types.d.ts +78 -0
  25. package/dist/bundles/pkg/shinkore.d.ts +51 -0
  26. package/dist/bundles/pkg/shinkore.js +462 -0
  27. package/dist/bundles/pkg/shinkore_bg.wasm +0 -0
  28. package/dist/bundles/shinkom.d.ts +34 -0
  29. package/dist/bundles/shinkom.js +55 -0
  30. package/dist/bundles/types/public.d.ts +73 -0
  31. package/dist/bundles/ui/compat-ui/compat-ui.d.ts +33 -0
  32. package/dist/bundles/ui/compat-ui/compat-ui.js +49 -0
  33. package/dist/bundles/ui/control-panel/control-panel.d.ts +39 -0
  34. package/dist/bundles/ui/control-panel/control-panel.js +409 -0
  35. package/dist/bundles/ui/index.d.ts +11 -0
  36. package/dist/bundles/ui/index.js +11 -0
  37. package/dist/bundles/ui/inspector/inspector.d.ts +44 -0
  38. package/dist/bundles/ui/inspector/inspector.js +314 -0
  39. package/dist/modules/core/constants.cjs +1 -0
  40. package/dist/modules/core/event-bus.cjs +1 -0
  41. package/dist/modules/core/helpers.cjs +1 -0
  42. package/dist/modules/core/index.cjs +1 -0
  43. package/dist/modules/core/state-service.cjs +1 -0
  44. package/dist/modules/core/ui-component.cjs +1 -0
  45. package/dist/modules/engine/engine.cjs +1 -0
  46. package/dist/modules/gen/browser-data.cjs +1 -0
  47. package/dist/modules/gen/browser-usage-data.cjs +1 -0
  48. package/dist/modules/gen/compat-data.cjs +1 -0
  49. package/dist/modules/gen/index.cjs +1 -0
  50. package/dist/modules/index.cjs +1 -0
  51. package/dist/modules/pkg/shinkore.cjs +1 -0
  52. package/dist/modules/pkg/shinkore_bg.wasm +0 -0
  53. package/dist/modules/shinkom.cjs +1 -0
  54. package/dist/modules/ui/compat-ui/compat-ui.cjs +1 -0
  55. package/dist/modules/ui/control-panel/control-panel.cjs +182 -0
  56. package/dist/modules/ui/index.cjs +1 -0
  57. package/dist/modules/ui/inspector/inspector.cjs +1 -0
  58. package/package.json +89 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Shinkom - shinkom
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { ShinkomBus } from "./core/event-bus.js";
9
+ import { ShinkomState } from "./core/state-service.js";
10
+ import { CompatInspector } from "./ui/inspector/inspector.js";
11
+ import { CompatControlPanel } from "./ui/control-panel/control-panel.js";
12
+ import { CompatUI } from "./ui/compat-ui/compat-ui.js";
13
+ import { SKEngine } from "./engine/engine.js";
14
+ import "./engine/index.js";
15
+ //#region src/shinkom.js
16
+ /**@typedef {import("./types/public").ShinkomConfig} ShinkomConfig */
17
+ var Shinkom = class {
18
+ #config;
19
+ /**@type {AbortController | null} */
20
+ #shinkomController = null;
21
+ /**
22
+ * @param {ShinkomConfig | undefined} config
23
+ */
24
+ constructor(config = void 0) {
25
+ this.#config = config;
26
+ const bus = new ShinkomBus();
27
+ const state = new ShinkomState();
28
+ /**@type {SKEngine} */
29
+ this.skEngine = new SKEngine(bus);
30
+ /**@type {CompatUI} */
31
+ this.compatUI = new CompatUI(bus, state, [new CompatInspector(bus, state, this.#config?.inspector), new CompatControlPanel(bus, state)]);
32
+ }
33
+ /**
34
+ * Initialize Shinkom.
35
+ */
36
+ async init() {
37
+ try {
38
+ await this.skEngine.initEngine(this.#config?.engine?.wasmURL);
39
+ this.compatUI.init();
40
+ } catch (error) {
41
+ console.error(`Shinkom initialization error: ${error}`);
42
+ }
43
+ }
44
+ /**
45
+ * Destroy UI components and engine instance.
46
+ */
47
+ destroy() {
48
+ this.skEngine.destroy();
49
+ this.compatUI.destroy();
50
+ if (this.#shinkomController) this.#shinkomController.abort();
51
+ this.#shinkomController = null;
52
+ }
53
+ };
54
+ //#endregion
55
+ export { Shinkom };
@@ -0,0 +1,73 @@
1
+ import { SupportStatement } from '@mdn/browser-compat-data/types'
2
+
3
+ export type ShinkomEventMap = {
4
+ "ci:toggle": CustomEvent<void>;
5
+ "engine:inspect": CustomEvent<CustomEventEngineDetail>;
6
+ "ci:switch": CustomEvent<void>;
7
+ "ci:create": CustomEvent<void>;
8
+ "ci:reset": CustomEvent<void>;
9
+ "ci:destroy": CustomEvent<void>;
10
+ "engine:full": CustomEvent<CustomEventEngineDetail>;
11
+ }
12
+
13
+ export type CustomEventEngineDetail = {
14
+ elem: string;
15
+ depthLevel: number;
16
+ multiElements: boolean;
17
+ }
18
+
19
+ export interface ShinkomEventTarget extends EventTarget {
20
+ addEventListener: <K extends keyof ShinkomEventMap>(type: K | string, listener: ShinkomEventListener<K> | EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
21
+ removeEventListener: <K extends keyof ShinkomEventMap>(type: K | string, callback: ShinkomEventListener<K> | EventListenerOrEventListenerObject | null) => void;
22
+ dispatchEvent: <K extends keyof ShinkomEventMap>(event: ShinkomEventMap[K]) => boolean;
23
+ }
24
+
25
+ export type ShinkomEventListener<K extends keyof ShinkomEventMap> = (this: ShinkomEventTarget, ev: ShinkomEventMap[K]) => void
26
+
27
+ export type ShinkomConfig = {
28
+ inspector?: InspectorConfig
29
+ engine?: EngineConfig
30
+ }
31
+
32
+ export type InspectorConfig = {
33
+ disabled: boolean;
34
+ keyboardShortcuts?: boolean;
35
+ }
36
+
37
+ export type EngineConfig = {
38
+ wasmURL: string
39
+ }
40
+
41
+ export type UISharedState = {
42
+ inspectorExists: boolean;
43
+ inspectorActive: boolean;
44
+ inspectorSwitching: boolean;
45
+ multiElements: boolean;
46
+ depthLevel: number;
47
+ ignorePanelEl: HTMLDivElement | null;
48
+ }
49
+
50
+ export type CompatResult = {
51
+ overall_score: number;
52
+ lookup_results: LookupResult[];
53
+ }
54
+
55
+ export type LookupResult = {
56
+ name: string;
57
+ mdn_url: string;
58
+ compat_score: string;
59
+ browser_score: string;
60
+ status_score: string;
61
+ browsers: BrowserResult[];
62
+ }
63
+
64
+ export type BrowserResult = {
65
+ browser_name: string;
66
+ score: {
67
+ raw_score: string;
68
+ weighted_score: string;
69
+ };
70
+ versions: SupportStatement
71
+ }
72
+
73
+ export type UISharedStateProps = keyof UISharedState
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shinkom - compat-ui
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { ShinkomBus } from "../../core/event-bus.js";
9
+ import { ShinkomState } from "../../core/state-service.js";
10
+ import { UIComponent } from "../../core/ui-component.js";
11
+
12
+ //#region src/ui/compat-ui/compat-ui.d.ts
13
+ declare class CompatUI {
14
+ /**
15
+ * @param {ShinkomBus} _bus
16
+ * @param {ShinkomState} stateService
17
+ * @param {UIComponent[]} components
18
+ */
19
+ constructor(_bus: ShinkomBus, stateService: ShinkomState, components?: UIComponent[]);
20
+ /**@type {UIComponent[]} */
21
+ components: UIComponent[];
22
+ /**
23
+ * Initializes CompatUI components.
24
+ */
25
+ init(): void;
26
+ /**
27
+ * Destroys CompatUI component instances.
28
+ */
29
+ destroy(): void;
30
+ #private;
31
+ }
32
+ //#endregion
33
+ export { CompatUI };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Shinkom - compat-ui
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ //#region src/ui/compat-ui/compat-ui.js
9
+ const internalState = /* @__PURE__ */ new WeakMap();
10
+ var CompatUI = class {
11
+ /**
12
+ * @param {ShinkomBus} _bus
13
+ * @param {ShinkomState} stateService
14
+ * @param {UIComponent[]} components
15
+ */
16
+ constructor(_bus, stateService, components = []) {
17
+ /**@type {UIComponent[]} */
18
+ this.components = components;
19
+ internalState.set(this, stateService.getState());
20
+ }
21
+ /**
22
+ * Bind state proxy to UI components.
23
+ */
24
+ #bindState() {
25
+ const state = internalState.get(this);
26
+ this.components.forEach((comp) => comp.bindState(state));
27
+ }
28
+ /**
29
+ * Initializes CompatUI components.
30
+ */
31
+ init() {
32
+ try {
33
+ this.components.forEach((comp) => comp.mount());
34
+ this.#bindState();
35
+ } catch (error) {
36
+ console.error(`Compat UI initialization error: ${error}`);
37
+ }
38
+ }
39
+ /**
40
+ * Destroys CompatUI component instances.
41
+ */
42
+ destroy() {
43
+ this.components.forEach((comp) => {
44
+ comp.unmount();
45
+ });
46
+ }
47
+ };
48
+ //#endregion
49
+ export { CompatUI };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shinkom - control-panel
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { UIComponent } from "../../core/ui-component.js";
9
+ import { UISharedState as UISharedState$1, UISharedStateProps as UISharedStateProps$1 } from "../../types/public.js";
10
+
11
+ //#region src/ui/control-panel/control-panel.d.ts
12
+ /**@extends {UIComponent} */
13
+ declare class CompatControlPanel extends UIComponent {
14
+ /**@type {HTMLDivElement | null} */
15
+ shadowHost: HTMLDivElement | null;
16
+ /**@type {ShadowRoot | null} */
17
+ shadowRoot: ShadowRoot | null;
18
+ /**@type {HTMLInputElement | null} */
19
+ depthLevelInput: HTMLInputElement | null;
20
+ /**@type {HTMLParagraphElement | null} */
21
+ ciStatusEl: HTMLParagraphElement | null;
22
+ /**@type {HTMLButtonElement | null} */
23
+ toggleSwitchingEl: HTMLButtonElement | null;
24
+ /**@type {HTMLButtonElement | null} */
25
+ toggleInspectorEl: HTMLButtonElement | null;
26
+ /**@type {number} */
27
+ depthLevel: number;
28
+ /**@type {boolean} */
29
+ multiElements: boolean;
30
+ /**
31
+ * Creates the control panel in a shadow root.
32
+ */
33
+ createPanel(): void;
34
+ #private;
35
+ }
36
+ type UISharedState = UISharedState$1;
37
+ type UISharedStateProps = UISharedStateProps$1;
38
+ //#endregion
39
+ export { CompatControlPanel, UISharedState, UISharedStateProps };
@@ -0,0 +1,409 @@
1
+ /**
2
+ * Shinkom - control-panel
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { UIComponent } from "../../core/ui-component.js";
9
+ //#region src/ui/control-panel/control-panel.js
10
+ /**@typedef {import('../../types/public').UISharedState} UISharedState */
11
+ /**@typedef {import('../../types/public').UISharedStateProps} UISharedStateProps */
12
+ /**@extends {UIComponent} */
13
+ var CompatControlPanel = class extends UIComponent {
14
+ /**@type {UISharedState | null} */
15
+ #stateBind = null;
16
+ /**@type {AbortController | null} */
17
+ #panelController = null;
18
+ /**
19
+ * @param {ShinkomBus} bus
20
+ * @param {ShinkomState} stateService
21
+ */
22
+ constructor(bus, stateService) {
23
+ super(bus, stateService);
24
+ /**@type {HTMLDivElement | null} */
25
+ this.shadowHost = null;
26
+ /**@type {ShadowRoot | null} */
27
+ this.shadowRoot = null;
28
+ /**@type {HTMLInputElement | null} */
29
+ this.depthLevelInput = null;
30
+ /**@type {HTMLParagraphElement | null} */
31
+ this.ciStatusEl = null;
32
+ /**@type {HTMLButtonElement | null} */
33
+ this.toggleSwitchingEl = null;
34
+ /**@type {HTMLButtonElement | null} */
35
+ this.toggleInspectorEl = null;
36
+ /**@type {number} */
37
+ this.depthLevel = 0;
38
+ /**@type {boolean} */
39
+ this.multiElements = false;
40
+ stateService.subscribe((prop, val) => {
41
+ this.onStateChange(prop, val);
42
+ });
43
+ }
44
+ /**
45
+ * Applies inline styles to `shadowHost` element.
46
+ */
47
+ #applyHostStyles() {
48
+ if (this.shadowHost) Object.assign(this.shadowHost.style, {
49
+ position: "fixed",
50
+ top: "2rem",
51
+ left: "2rem",
52
+ zIndex: "9999"
53
+ });
54
+ else throw new Error("Shadow host is undefined or null.");
55
+ }
56
+ /**
57
+ * Creates the control panel in a shadow root.
58
+ */
59
+ createPanel() {
60
+ if (this.shadowHost) {
61
+ console.warn("Shadow host already exists.");
62
+ return;
63
+ }
64
+ this.shadowHost = document.createElement("div");
65
+ this.shadowHost.id = "sk-shadow-host";
66
+ try {
67
+ this.#applyHostStyles();
68
+ } catch (error) {
69
+ this.shadowHost = null;
70
+ throw error;
71
+ }
72
+ document.body.appendChild(this.shadowHost);
73
+ this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
74
+ this.shadowRoot.innerHTML = `
75
+ <style>
76
+ .sk-control-panel {
77
+ display: flex;
78
+ flex-direction: column;
79
+ justify-content: space-evenly;
80
+ width: 30rem;
81
+ height: 85lvh;
82
+ padding: 1rem;
83
+ background-color: #0f0c13;
84
+ color: white;
85
+ font-family: Arial, Helvetica, sans-serif;
86
+ border-radius: 2rem;
87
+ z-index: 2;
88
+ }
89
+
90
+ .sk-control-panel * {
91
+ transition-property: color, background-color, border-color;
92
+ transition-duration: 300ms;
93
+ transition-timing-function: ease-in-out;
94
+ }
95
+
96
+ .sk-page-buttons {
97
+ display: flex;
98
+ flex-direction: column;
99
+ justify-content: center;
100
+ align-items: center;
101
+ gap: .75rem;
102
+ flex: 1 1 0%;
103
+ }
104
+
105
+ .sk-button-style {
106
+ font-size: 1.225rem;
107
+ color: white;
108
+ background-color: #201a27;
109
+ border: 1px solid #3c00c7;
110
+ border-radius: .5rem;
111
+ padding-inline: .5rem;
112
+ padding-block: .3rem;
113
+ cursor: pointer;
114
+ }
115
+
116
+ .sk-hr-line {
117
+ width: 100%;
118
+ border: 0px solid transparent;
119
+ border-top: 1px solid #8132ff;
120
+ }
121
+
122
+ .sk-full-page-inspect {
123
+ display: flex;
124
+ align-items: center;
125
+ justify-content: space-evenly;
126
+ font-size: 1.8rem;
127
+ flex: 0.5 1 0%;
128
+ }
129
+
130
+ .sk-options-container {
131
+ display: flex;
132
+ flex-direction: column;
133
+ gap: .5rem;
134
+ padding-top: 1rem;
135
+ padding-inline: 1rem;
136
+ flex: 5 1 0%;
137
+ font-size: 1.25rem;
138
+ }
139
+
140
+ .sk-options-header {
141
+ display: flex;
142
+ align-items: center;
143
+ justify-content: space-between;
144
+ font-size: 1.5rem;
145
+ }
146
+
147
+ .sk-options-header p:last-child {
148
+ font-size: 1rem;
149
+ }
150
+
151
+ .sk-options {
152
+ display: flex;
153
+ flex-direction: column;
154
+ justify-content: space-evenly;
155
+ height: 100%;
156
+ padding-left: .05rem;
157
+ }
158
+
159
+ .sk-options-grid {
160
+ display: grid;
161
+ grid-template-columns: auto auto auto;
162
+ grid-template-rows: auto;
163
+ justify-items: flex-start;
164
+ align-items: center;
165
+ }
166
+
167
+ .sk-options-grid:first-child {
168
+ column-gap: .5rem;
169
+ }
170
+
171
+ .sk-options-grid .sk-button-style {
172
+ justify-self: flex-end;
173
+ }
174
+
175
+ .sk-options-grid .sk-options-input {
176
+ justify-self: flex-end;
177
+ }
178
+
179
+ .sk-options-grid .sk-options-input:disabled {
180
+ opacity: .5;
181
+ }
182
+
183
+ .sk-options-grid:nth-last-of-type(2), .sk-options-grid:nth-last-of-type(1) {
184
+ grid-template-columns: auto auto;
185
+ }
186
+
187
+ .sk-options-input {
188
+ width: 70%;
189
+ padding-block: .2rem;
190
+ padding-inline: .3rem;
191
+ border-radius: .25rem;
192
+ border: none;
193
+ background-color: #232333;
194
+ font-size: 1rem;
195
+ color: white;
196
+ }
197
+ .sk-close {
198
+ display: flex;
199
+ flex-direction: column;
200
+ justify-content: center;
201
+ flex: 1 1 0%;
202
+ }
203
+ .sk-show-panel {
204
+ width: 8rem;
205
+ position: absolute;
206
+ top: 1rem;
207
+ left: 1rem;
208
+ z-index: -1;
209
+ }
210
+ </style>
211
+ <div style="position: relative">
212
+ <button id="sk-show-panel" class="sk-button-style sk-show-panel">Show Panel</button>
213
+ <div id="sk-control-panel" class="sk-control-panel" style="display: none;">
214
+ <div class="sk-page-buttons">
215
+ <button class="sk-button-style">Inspector</button>
216
+ <button class="sk-button-style">Compatibility View</button>
217
+ </div>
218
+ <hr class="sk-hr-line">
219
+ <div class="sk-full-page-inspect">
220
+ <p>Inspect Full Page</p>
221
+ <button id="sk-full-inspect" class="sk-button-style">Inspect</button>
222
+ </div>
223
+ <hr class="sk-hr-line">
224
+ <div class="sk-options-container">
225
+ <div class="sk-options-header">
226
+ <p>Inspector Options</p>
227
+ <p id="sk-inspector-status">Inspector Status: Active</p>
228
+ </div>
229
+ <div class="sk-options">
230
+ <div class="sk-options-grid">
231
+ <p>Inspect multiple elements</p>
232
+ <input id="sk-toggle-elements" class="sk-options-checkbox" type="checkbox">
233
+ <input id="sk-depth-level" class="sk-options-input" type="text" placeholder="depth_level" disabled>
234
+ </div>
235
+ <div class="sk-options-grid">
236
+ <p>Toggle Switching</p>
237
+ <button id="sk-toggle-switching" class="sk-button-style">Disabled</button>
238
+ </div>
239
+ <div class="sk-options-grid">
240
+ <p>Toggle Inspector</p>
241
+ <button id="sk-toggle-inspector" class="sk-button-style">Active</button>
242
+ </div>
243
+ <button id="sk-create-inspector" class="sk-button-style">Create Inspector</button>
244
+ <button id="sk-reset-inspector" class="sk-button-style">Reset Inspector</button>
245
+ <button id="sk-destroy-inspector" class="sk-button-style">Destroy Inspector</button>
246
+ </div>
247
+ </div>
248
+ <hr class="sk-hr-line">
249
+ <div class="sk-close">
250
+ <button id="sk-close-panel" class="sk-button-style">Close</button>
251
+ </div>
252
+ <hr class="sk-hr-line">
253
+ </div>
254
+ </div>
255
+ `;
256
+ }
257
+ /**
258
+ * @param {UISharedState} state
259
+ */
260
+ bindState(state) {
261
+ if (!this.#stateBind) this.#stateBind = state;
262
+ this.#stateBind.ignorePanelEl = this.shadowHost;
263
+ }
264
+ /**
265
+ * @param {UISharedStateProps} prop
266
+ * @param {any} val
267
+ */
268
+ onStateChange(prop, val) {
269
+ switch (prop) {
270
+ case "inspectorSwitching":
271
+ if (this.toggleSwitchingEl) this.toggleSwitchingEl.innerHTML = val ? "Enabled" : "Disabled";
272
+ break;
273
+ case "inspectorActive":
274
+ if (this.toggleInspectorEl) this.toggleInspectorEl.innerHTML = val ? "Active" : "Deactive";
275
+ if (this.ciStatusEl) this.ciStatusEl.innerHTML = val ? "Inspector Status: Active" : "Inspector Status: Deactive";
276
+ break;
277
+ default: break;
278
+ }
279
+ }
280
+ mount() {
281
+ try {
282
+ this.createPanel();
283
+ } catch (error) {
284
+ throw error;
285
+ }
286
+ this.#setupShadowListeners();
287
+ }
288
+ /**
289
+ * Setup event listeners on `shadowRoot` element.
290
+ */
291
+ #setupShadowListeners() {
292
+ this.#panelController = new AbortController();
293
+ const { signal } = this.#panelController;
294
+ const toggleInspector = this.shadowRoot?.getElementById("sk-toggle-inspector");
295
+ const toggleSwitching = this.shadowRoot?.getElementById("sk-toggle-switching");
296
+ const createInspector = this.shadowRoot?.getElementById("sk-create-inspector");
297
+ const resetInspector = this.shadowRoot?.getElementById("sk-reset-inspector");
298
+ const destroyInspector = this.shadowRoot?.getElementById("sk-destroy-inspector");
299
+ const showButton = this.shadowRoot?.getElementById("sk-show-panel");
300
+ const closeButton = this.shadowRoot?.getElementById("sk-close-panel");
301
+ const toggleElements = this.shadowRoot?.getElementById("sk-toggle-elements");
302
+ const depthLevelInput = this.shadowRoot?.getElementById("sk-depth-level");
303
+ const fullInspectButton = this.shadowRoot?.getElementById("sk-full-inspect");
304
+ const ciStatusEl = this.shadowRoot?.getElementById("sk-inspector-status");
305
+ toggleInspector?.addEventListener("click", this.#handleToggleClick, { signal });
306
+ toggleSwitching?.addEventListener("click", this.#handleToggleClick, { signal });
307
+ createInspector?.addEventListener("click", this.#handleToggleClick, { signal });
308
+ resetInspector?.addEventListener("click", this.#handleToggleClick, { signal });
309
+ destroyInspector?.addEventListener("click", this.#handleToggleClick, { signal });
310
+ showButton?.addEventListener("click", this.#handleToggleClick, { signal });
311
+ closeButton?.addEventListener("click", this.#handleToggleClick, { signal });
312
+ toggleElements?.addEventListener("click", this.#handleToggleClick, { signal });
313
+ depthLevelInput?.addEventListener("change", this.#handleDepthLevelValue, { signal });
314
+ fullInspectButton?.addEventListener("click", this.#handleToggleClick, { signal });
315
+ if (depthLevelInput) this.depthLevelInput = depthLevelInput;
316
+ if (toggleInspector) this.toggleInspectorEl = toggleInspector;
317
+ if (toggleSwitching) this.toggleSwitchingEl = toggleSwitching;
318
+ if (ciStatusEl) this.ciStatusEl = ciStatusEl;
319
+ }
320
+ unmount() {
321
+ try {
322
+ if (!this.shadowHost) return;
323
+ this.shadowHost.remove();
324
+ this.shadowHost = null;
325
+ this.#resetInternalState();
326
+ } catch (error) {
327
+ console.error(`Control panel destroy error: ${error}`);
328
+ }
329
+ }
330
+ /**
331
+ * Reset internal state of the instance and any related state
332
+ * in the `stateBind`.
333
+ */
334
+ #resetInternalState() {
335
+ if (this.#panelController) this.#panelController.abort();
336
+ this.#panelController = null;
337
+ this.shadowRoot = null;
338
+ this.depthLevelInput = null;
339
+ this.depthLevel = 0;
340
+ this.multiElements = false;
341
+ if (this.#stateBind) {
342
+ this.#stateBind.depthLevel = 0;
343
+ this.#stateBind.multiElements = false;
344
+ this.#stateBind.ignorePanelEl = null;
345
+ }
346
+ }
347
+ /**
348
+ * Handles click events within the control panel.
349
+ * @param {PointerEvent} e
350
+ */
351
+ #handleToggleClick = (e) => {
352
+ switch (e.target.id) {
353
+ case "sk-show-panel": {
354
+ if (!this.shadowRoot) return;
355
+ const panel = this.shadowRoot.getElementById("sk-control-panel");
356
+ if (panel) panel.style.display = "flex";
357
+ break;
358
+ }
359
+ case "sk-close-panel": {
360
+ if (!this.shadowRoot) return;
361
+ const panel = this.shadowRoot.getElementById("sk-control-panel");
362
+ if (panel) panel.style.display = "none";
363
+ break;
364
+ }
365
+ case "sk-toggle-inspector":
366
+ this.bus.emit("ci:toggle");
367
+ break;
368
+ case "sk-toggle-elements":
369
+ this.multiElements = !this.multiElements;
370
+ if (this.depthLevelInput) if (this.multiElements) this.depthLevelInput.disabled = false;
371
+ else this.depthLevelInput.disabled = true;
372
+ if (this.#stateBind) this.#stateBind.multiElements = this.multiElements;
373
+ break;
374
+ case "sk-toggle-switching":
375
+ if (this.#stateBind) this.#stateBind.inspectorSwitching = !this.#stateBind.inspectorSwitching;
376
+ break;
377
+ case "sk-create-inspector":
378
+ this.bus.emit("ci:create");
379
+ break;
380
+ case "sk-reset-inspector":
381
+ this.bus.emit("ci:reset");
382
+ break;
383
+ case "sk-destroy-inspector":
384
+ this.bus.emit("ci:destroy");
385
+ break;
386
+ case "sk-full-inspect":
387
+ this.bus.emit("engine:full");
388
+ break;
389
+ default:
390
+ console.error(`Could not dispatch an event for element of unknown id: ${e.target.id}`);
391
+ break;
392
+ }
393
+ };
394
+ /**
395
+ * Handles the change event for the `depth_level` input.
396
+ * @param {Event} e
397
+ */
398
+ #handleDepthLevelValue = (e) => {
399
+ const level = parseInt(
400
+ /**@type {HTMLInputElement}*/
401
+ e.target.value,
402
+ 10
403
+ );
404
+ this.depthLevel = level;
405
+ if (this.#stateBind) this.#stateBind.depthLevel = level;
406
+ };
407
+ };
408
+ //#endregion
409
+ export { CompatControlPanel };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Shinkom - ui
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { CompatInspector } from "./inspector/inspector.js";
9
+ import { CompatControlPanel } from "./control-panel/control-panel.js";
10
+ import { CompatUI } from "./compat-ui/compat-ui.js";
11
+ export { CompatControlPanel, CompatInspector, CompatUI };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Shinkom - ui
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { CompatInspector } from "./inspector/inspector.js";
9
+ import { CompatControlPanel } from "./control-panel/control-panel.js";
10
+ import { CompatUI } from "./compat-ui/compat-ui.js";
11
+ export { CompatControlPanel, CompatInspector, CompatUI };