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.
Files changed (88) hide show
  1. package/README.md +3 -2
  2. package/dist/bundles/_virtual/_rolldown/runtime.js +1 -1
  3. package/dist/bundles/core/constants.d.ts +1 -1
  4. package/dist/bundles/core/constants.js +5 -2
  5. package/dist/bundles/core/elements/compat-view-element.d.ts +100 -0
  6. package/dist/bundles/core/elements/compat-view-element.js +440 -0
  7. package/dist/bundles/core/elements/control-panel-element.d.ts +45 -0
  8. package/dist/bundles/core/elements/control-panel-element.js +99 -0
  9. package/dist/bundles/core/elements/index.d.ts +13 -0
  10. package/dist/bundles/core/elements/index.js +13 -0
  11. package/dist/bundles/core/elements/inspector-element.d.ts +27 -0
  12. package/dist/bundles/core/elements/inspector-element.js +58 -0
  13. package/dist/bundles/core/elements/recent-result-item.js +46 -0
  14. package/dist/bundles/core/elements/results-history-item.js +46 -0
  15. package/dist/bundles/core/elements/templates/compat-view.templates.js +462 -0
  16. package/dist/bundles/core/elements/templates/control-panel.templates.js +335 -0
  17. package/dist/bundles/core/elements/templates/root-styles.template.js +40 -0
  18. package/dist/bundles/core/event-bus.d.ts +19 -5
  19. package/dist/bundles/core/event-bus.js +21 -8
  20. package/dist/bundles/core/helpers.js +24 -2
  21. package/dist/bundles/core/index.d.ts +5 -2
  22. package/dist/bundles/core/index.js +6 -2
  23. package/dist/bundles/core/state-service.d.ts +24 -4
  24. package/dist/bundles/core/state-service.js +25 -5
  25. package/dist/bundles/core/ui-component.d.ts +25 -6
  26. package/dist/bundles/core/ui-component.js +31 -12
  27. package/dist/bundles/engine/engine.d.ts +57 -9
  28. package/dist/bundles/engine/engine.js +115 -31
  29. package/dist/bundles/engine/index.js +1 -1
  30. package/dist/bundles/gen/browser-data.js +96 -96
  31. package/dist/bundles/gen/browser-usage-data.js +671 -671
  32. package/dist/bundles/gen/index.js +1 -1
  33. package/dist/bundles/index.d.ts +6 -2
  34. package/dist/bundles/index.js +8 -2
  35. package/dist/bundles/pkg/shinkore.d.ts +1 -1
  36. package/dist/bundles/pkg/shinkore.js +1 -1
  37. package/dist/bundles/shinkom.d.ts +9 -1
  38. package/dist/bundles/shinkom.js +31 -6
  39. package/dist/bundles/types/public.d.ts +13 -29
  40. package/dist/bundles/types/types.d.ts +99 -0
  41. package/dist/bundles/ui/compat-ui/compat-ui.d.ts +12 -2
  42. package/dist/bundles/ui/compat-ui/compat-ui.js +12 -2
  43. package/dist/bundles/ui/compat-ui/index.js +8 -0
  44. package/dist/bundles/ui/compatibility-view/compatibility-view.d.ts +42 -0
  45. package/dist/bundles/ui/compatibility-view/compatibility-view.js +229 -0
  46. package/dist/bundles/ui/compatibility-view/index.js +8 -0
  47. package/dist/bundles/ui/control-panel/control-panel.d.ts +30 -16
  48. package/dist/bundles/ui/control-panel/control-panel.js +188 -277
  49. package/dist/bundles/ui/control-panel/index.js +8 -0
  50. package/dist/bundles/ui/index.d.ts +3 -2
  51. package/dist/bundles/ui/index.js +7 -2
  52. package/dist/bundles/ui/inspector/index.js +8 -0
  53. package/dist/bundles/ui/inspector/inspector.d.ts +60 -6
  54. package/dist/bundles/ui/inspector/inspector.js +149 -69
  55. package/dist/modules/core/constants.cjs +17 -1
  56. package/dist/modules/core/elements/compat-view-element.cjs +434 -0
  57. package/dist/modules/core/elements/control-panel-element.cjs +93 -0
  58. package/dist/modules/core/elements/index.cjs +11 -0
  59. package/dist/modules/core/elements/inspector-element.cjs +52 -0
  60. package/dist/modules/core/elements/recent-result-item.cjs +39 -0
  61. package/dist/modules/core/elements/results-history-item.cjs +39 -0
  62. package/dist/modules/core/elements/templates/compat-view.templates.cjs +458 -0
  63. package/dist/modules/core/elements/templates/control-panel.templates.cjs +332 -0
  64. package/dist/modules/core/elements/templates/root-styles.template.cjs +33 -0
  65. package/dist/modules/core/event-bus.cjs +43 -1
  66. package/dist/modules/core/helpers.cjs +41 -1
  67. package/dist/modules/core/index.cjs +16 -1
  68. package/dist/modules/core/state-service.cjs +74 -1
  69. package/dist/modules/core/ui-component.cjs +65 -1
  70. package/dist/modules/engine/engine.cjs +232 -1
  71. package/dist/modules/gen/browser-data.cjs +100 -1
  72. package/dist/modules/gen/browser-usage-data.cjs +675 -1
  73. package/dist/modules/gen/compat-data.cjs +31015 -1
  74. package/dist/modules/gen/index.cjs +7 -1
  75. package/dist/modules/index.cjs +27 -1
  76. package/dist/modules/pkg/shinkore.cjs +459 -1
  77. package/dist/modules/shinkom.cjs +73 -1
  78. package/dist/modules/ui/compat-ui/compat-ui.cjs +53 -1
  79. package/dist/modules/ui/compat-ui/index.cjs +1 -0
  80. package/dist/modules/ui/compatibility-view/compatibility-view.cjs +223 -0
  81. package/dist/modules/ui/compatibility-view/index.cjs +1 -0
  82. package/dist/modules/ui/control-panel/control-panel.cjs +314 -182
  83. package/dist/modules/ui/control-panel/index.cjs +1 -0
  84. package/dist/modules/ui/index.cjs +13 -1
  85. package/dist/modules/ui/inspector/index.cjs +1 -0
  86. package/dist/modules/ui/inspector/inspector.cjs +388 -1
  87. package/package.json +13 -6
  88. package/dist/bundles/node_modules/@mdn/browser-compat-data/types.d.ts +0 -78
@@ -1,265 +1,96 @@
1
1
  /**
2
2
  * Shinkom - control-panel
3
- * @version 1.0.3
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 { CompatControlPanelElement } from "../../core/elements/control-panel-element.js";
10
+ import "../../core/elements/index.js";
11
+ import "../../core/index.js";
9
12
  //#region src/ui/control-panel/control-panel.js
10
13
  /**@typedef {import('../../types/public').UISharedState} UISharedState */
11
14
  /**@typedef {import('../../types/public').UISharedStateProps} UISharedStateProps */
12
- /**@extends {UIComponent} */
13
- var CompatControlPanel = class extends UIComponent {
15
+ /**
16
+ * CompatControlPanel manages the visibility, tabs, and input controls of
17
+ * the compatibility control panel overlay.
18
+ *
19
+ * It mounts the `<sk-control-panel>` custom element, binds control values
20
+ * to shared UI state, and dispatches user-driven commands over the Shinkom
21
+ * event bus.
22
+ *
23
+ * The panel supports inspector controls, compatibility view settings,
24
+ * tab switching, and display transitions with or without view transition
25
+ * support.
26
+ *
27
+ * @extends {UIComponent}
28
+ */
29
+ var CompatControlPanel = class CompatControlPanel extends UIComponent {
14
30
  /**@type {UISharedState | null} */
15
31
  #stateBind = null;
16
32
  /**@type {AbortController | null} */
17
33
  #panelController = null;
18
34
  /**
35
+ * Initializes the compatibility control panel.
36
+ *
37
+ * It requires an instance of the `ShinkomBus` and `ShinkomState` to listen
38
+ * for event bus emits and state service notifications.
39
+ *
40
+ * It also registers the `<sk-control-panel>` custom element.
41
+ *
19
42
  * @param {ShinkomBus} bus
20
43
  * @param {ShinkomState} stateService
21
44
  */
22
45
  constructor(bus, stateService) {
23
46
  super(bus, stateService);
24
- /**@type {HTMLDivElement | null} */
25
- this.shadowHost = null;
26
- /**@type {ShadowRoot | null} */
27
- this.shadowRoot = null;
47
+ CompatControlPanel.register();
48
+ /**@type {CompatControlPanelElement | null} */
49
+ this.controlPanelEl = null;
28
50
  /**@type {HTMLInputElement | null} */
29
51
  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;
52
+ /**@type {HTMLInputElement | null} */
53
+ this.maxResultsHistoryInput = null;
54
+ /**@type {number} */
55
+ this.maxResultsHistory = 10;
36
56
  /**@type {number} */
37
57
  this.depthLevel = 0;
38
58
  /**@type {boolean} */
39
59
  this.multiElements = false;
40
- stateService.subscribe((prop, val) => {
41
- this.onStateChange(prop, val);
42
- });
60
+ /**@type {"inspector" | "compatView"} */
61
+ this.currentTab = "inspector";
62
+ /**@type {() => void} */
63
+ this.unsubState = () => {};
64
+ }
65
+ /**
66
+ * Register custom elements to the CustomElementRegistry.
67
+ */
68
+ static register() {
69
+ if (typeof window !== "undefined" && "customElements" in globalThis && !globalThis.customElements.get("sk-control-panel")) globalThis.customElements.define("sk-control-panel", CompatControlPanelElement);
43
70
  }
44
71
  /**
45
- * Applies inline styles to `shadowHost` element.
72
+ * Subscribes to shared UI state changes from the Shinkom state service.
73
+ *
74
+ * When the state service emits updates, the control panel updates the
75
+ * relevant button labels and input state accordingly.
46
76
  */
47
- #applyHostStyles() {
48
- if (this.shadowHost) Object.assign(this.shadowHost.style, {
49
- position: "fixed",
50
- top: "2rem",
51
- left: "2rem",
52
- zIndex: "9999"
77
+ #setupStateServiceListener() {
78
+ this.unsubState = this.stateService.subscribe((prop, val) => {
79
+ this.onStateChange(prop, val);
53
80
  });
54
- else throw new Error("Shadow host is undefined or null.");
55
81
  }
56
82
  /**
57
- * Creates the control panel in a shadow root.
83
+ * Unsubscribes from the shared UI state service.
58
84
  */
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
- `;
85
+ #cleanupStateServiceListener() {
86
+ this.unsubState();
256
87
  }
257
88
  /**
258
89
  * @param {UISharedState} state
259
90
  */
260
91
  bindState(state) {
261
92
  if (!this.#stateBind) this.#stateBind = state;
262
- this.#stateBind.ignorePanelEl = this.shadowHost;
93
+ this.#stateBind.ignorePanelEl = this.controlPanelEl;
263
94
  }
264
95
  /**
265
96
  * @param {UISharedStateProps} prop
@@ -268,73 +99,59 @@ var CompatControlPanel = class extends UIComponent {
268
99
  onStateChange(prop, val) {
269
100
  switch (prop) {
270
101
  case "inspectorSwitching":
271
- if (this.toggleSwitchingEl) this.toggleSwitchingEl.innerHTML = val ? "Enabled" : "Disabled";
102
+ if (this.controlPanelEl) {
103
+ const toggleSwitchingButton = this.controlPanelEl.shadowRootRef.getElementById("sk-toggle-switching");
104
+ if (toggleSwitchingButton) toggleSwitchingButton.textContent = val ? "Enabled" : "Disabled";
105
+ }
272
106
  break;
273
107
  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";
108
+ if (this.controlPanelEl) {
109
+ const toggleInspectorButton = this.controlPanelEl.shadowRootRef.getElementById("sk-toggle-inspector");
110
+ if (toggleInspectorButton) toggleInspectorButton.textContent = val ? "Enabled" : "Disabled";
111
+ }
276
112
  break;
277
113
  default: break;
278
114
  }
279
115
  }
280
116
  mount() {
281
- try {
282
- this.createPanel();
283
- } catch (error) {
284
- throw error;
285
- }
117
+ if (this.controlPanelEl || document.querySelector("sk-control-panel")) return;
118
+ this.controlPanelEl = document.createElement("sk-control-panel");
119
+ document.body.appendChild(this.controlPanelEl);
286
120
  this.#setupShadowListeners();
121
+ this.#setupStateServiceListener();
287
122
  }
288
123
  /**
289
- * Setup event listeners on `shadowRoot` element.
124
+ * Sets up event listeners within the `ShadowDOM`.
290
125
  */
291
126
  #setupShadowListeners() {
127
+ if (!this.controlPanelEl) return;
292
128
  this.#panelController = new AbortController();
293
129
  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 });
130
+ const depthLevelInput = this.controlPanelEl.shadowRootRef.getElementById("sk-depth-level");
131
+ this.controlPanelEl.shadowHost.addEventListener("click", this.#handleToggleClick, { signal });
313
132
  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;
133
+ if (depthLevelInput) {
134
+ this.depthLevelInput = depthLevelInput;
135
+ this.depthLevelInput.disabled = !this.#stateBind?.multiElements;
136
+ }
319
137
  }
320
138
  unmount() {
321
139
  try {
322
- if (!this.shadowHost) return;
323
- this.shadowHost.remove();
324
- this.shadowHost = null;
140
+ if (!this.controlPanelEl) return;
141
+ this.controlPanelEl.remove();
142
+ this.controlPanelEl = null;
325
143
  this.#resetInternalState();
144
+ this.#cleanupStateServiceListener();
326
145
  } catch (error) {
327
146
  console.error(`Control panel destroy error: ${error}`);
328
147
  }
329
148
  }
330
149
  /**
331
- * Reset internal state of the instance and any related state
332
- * in the `stateBind`.
150
+ * Resets any internal state and event listeners.
333
151
  */
334
152
  #resetInternalState() {
335
153
  if (this.#panelController) this.#panelController.abort();
336
154
  this.#panelController = null;
337
- this.shadowRoot = null;
338
155
  this.depthLevelInput = null;
339
156
  this.depthLevel = 0;
340
157
  this.multiElements = false;
@@ -350,18 +167,32 @@ var CompatControlPanel = class extends UIComponent {
350
167
  */
351
168
  #handleToggleClick = (e) => {
352
169
  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";
170
+ case "sk-show-panel":
171
+ if (!this.controlPanelEl) return;
172
+ if (!document.startViewTransition) this.controlPanelEl.renderDisplayTransition("show");
173
+ else this.#handleDisplayTransition("show");
357
174
  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";
175
+ case "sk-close-panel":
176
+ if (!this.controlPanelEl) return;
177
+ if (!document.startViewTransition) this.controlPanelEl.renderDisplayTransition("hide");
178
+ else this.#handleDisplayTransition("hide");
179
+ break;
180
+ case "sk-inspector-tab":
181
+ if (!this.controlPanelEl || this.currentTab === "inspector") return;
182
+ if (!document.startViewTransition) {
183
+ this.controlPanelEl.renderTabContent("inspector");
184
+ this.#handleInspectorTabState();
185
+ this.currentTab = "inspector";
186
+ } else this.#handleTabChange("inspector");
187
+ break;
188
+ case "sk-compat-view-tab":
189
+ if (!this.controlPanelEl || this.currentTab === "compatView") return;
190
+ if (!document.startViewTransition) {
191
+ this.controlPanelEl.renderTabContent("compatView");
192
+ this.#handleCompatViewTabState();
193
+ this.currentTab = "compatView";
194
+ } else this.#handleTabChange("compatView");
363
195
  break;
364
- }
365
196
  case "sk-toggle-inspector":
366
197
  this.bus.emit("ci:toggle");
367
198
  break;
@@ -383,13 +214,93 @@ var CompatControlPanel = class extends UIComponent {
383
214
  case "sk-destroy-inspector":
384
215
  this.bus.emit("ci:destroy");
385
216
  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}`);
217
+ case "sk-clear-history":
218
+ this.bus.emit("clear:history");
391
219
  break;
220
+ default: break;
221
+ }
222
+ };
223
+ /**
224
+ * Handles the transition between tab changes.
225
+ * @param {"inspector" | "compatView"} tab
226
+ */
227
+ async #handleTabChange(tab) {
228
+ if (!this.controlPanelEl) return;
229
+ if (this.controlPanelEl.shadowRootRef.getElementById("sk-control-panel-main")) {
230
+ const transition = document.startViewTransition(() => {
231
+ this.controlPanelEl?.renderTabContent(tab);
232
+ });
233
+ this.currentTab = tab;
234
+ await transition.finished;
235
+ if (this.currentTab === "inspector") this.#handleInspectorTabState();
236
+ else if (this.currentTab === "compatView") this.#handleCompatViewTabState();
237
+ }
238
+ }
239
+ #handleInspectorTabState() {
240
+ if (!this.controlPanelEl) return;
241
+ const depthLevel = this.controlPanelEl.shadowRootRef.getElementById("sk-depth-level");
242
+ if (depthLevel) {
243
+ this.depthLevelInput = depthLevel;
244
+ this.depthLevelInput.addEventListener("change", this.#handleDepthLevelValue, { signal: this.#panelController?.signal });
245
+ if (this.#stateBind) {
246
+ if (this.#stateBind.multiElements) {
247
+ const checkbox = this.controlPanelEl.shadowRootRef.getElementById("sk-toggle-elements");
248
+ checkbox.checked = true;
249
+ } else this.depthLevelInput.disabled = true;
250
+ if (this.#stateBind.depthLevel > 0) this.depthLevelInput.value = `${this.#stateBind.depthLevel}`;
251
+ }
252
+ }
253
+ if (this.#stateBind) {
254
+ const switchingToggle = this.controlPanelEl.shadowRootRef.getElementById("sk-toggle-switching");
255
+ const inspectorToggle = this.controlPanelEl.shadowRootRef.getElementById("sk-toggle-inspector");
256
+ if (inspectorToggle) if (this.#stateBind.inspectorActive) inspectorToggle.textContent = "Enabled";
257
+ else inspectorToggle.textContent = "Disabled";
258
+ if (switchingToggle) if (this.#stateBind.inspectorSwitching) switchingToggle.textContent = "Enabled";
259
+ else switchingToggle.textContent = "Disabled";
260
+ }
261
+ }
262
+ #handleCompatViewTabState() {
263
+ if (!this.controlPanelEl) return;
264
+ const maxHistory = this.controlPanelEl.shadowRootRef.getElementById("sk-max-history");
265
+ if (maxHistory && maxHistory instanceof HTMLInputElement) {
266
+ this.maxResultsHistoryInput = maxHistory;
267
+ this.maxResultsHistoryInput.addEventListener("change", this.#handleMaxHistoryValue, { signal: this.#panelController?.signal });
268
+ if (this.#stateBind) {
269
+ if (this.#stateBind.maxResultsHistory >= 0 && this.#stateBind.maxResultsHistory != 10) this.maxResultsHistoryInput.value = `${this.#stateBind.maxResultsHistory}`;
270
+ }
271
+ }
272
+ }
273
+ /**
274
+ * Handles the transition when toggling the display.
275
+ * @param {"show" | "hide"} display
276
+ */
277
+ async #handleDisplayTransition(display) {
278
+ if (!this.controlPanelEl) return;
279
+ const controlPanel = this.controlPanelEl.shadowRootRef.getElementById("sk-control-panel");
280
+ if (controlPanel) {
281
+ controlPanel.part.value = "control-panel";
282
+ const transition = document.startViewTransition(() => {
283
+ this.controlPanelEl?.renderDisplayTransition(display);
284
+ });
285
+ try {
286
+ await transition.finished;
287
+ } finally {
288
+ controlPanel.removeAttribute("part");
289
+ }
392
290
  }
291
+ }
292
+ /**
293
+ * Handles the change event for the `maxResultsHistory` input.
294
+ * @param {Event} e
295
+ */
296
+ #handleMaxHistoryValue = (e) => {
297
+ const value = parseInt(
298
+ /**@type {HTMLInputElement} */
299
+ e.target.value,
300
+ 10
301
+ );
302
+ this.maxResultsHistory = value;
303
+ if (this.#stateBind) this.#stateBind.maxResultsHistory = value;
393
304
  };
394
305
  /**
395
306
  * Handles the change event for the `depth_level` input.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shinkom - ui\control-panel\index
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import "./control-panel.js";
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * Shinkom - ui
3
- * @version 1.0.3
3
+ * @version 1.1.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - OneilNvM
6
6
  */
7
7
 
8
8
  import { CompatInspector } from "./inspector/inspector.js";
9
9
  import { CompatControlPanel } from "./control-panel/control-panel.js";
10
+ import { CompatView } from "./compatibility-view/compatibility-view.js";
10
11
  import { CompatUI } from "./compat-ui/compat-ui.js";
11
- export { CompatControlPanel, CompatInspector, CompatUI };
12
+ export { CompatControlPanel, CompatInspector, CompatUI, CompatView };
@@ -1,11 +1,16 @@
1
1
  /**
2
2
  * Shinkom - ui
3
- * @version 1.0.3
3
+ * @version 1.1.0
4
4
  * @license MIT
5
5
  * @copyright 2026 - OneilNvM
6
6
  */
7
7
 
8
8
  import { CompatInspector } from "./inspector/inspector.js";
9
+ import "./inspector/index.js";
9
10
  import { CompatControlPanel } from "./control-panel/control-panel.js";
11
+ import "./control-panel/index.js";
12
+ import { CompatView } from "./compatibility-view/compatibility-view.js";
13
+ import "./compatibility-view/index.js";
10
14
  import { CompatUI } from "./compat-ui/compat-ui.js";
11
- export { CompatControlPanel, CompatInspector, CompatUI };
15
+ import "./compat-ui/index.js";
16
+ export { CompatControlPanel, CompatInspector, CompatUI, CompatView };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shinkom - ui\inspector\index
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import "./inspector.js";