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
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shinkom - compatibility-view
|
|
3
|
+
* @version 1.1.0
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2026 - OneilNvM
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { UIComponent } from "../../core/ui-component.js";
|
|
9
|
+
import { RecentResultItem } from "../../core/elements/recent-result-item.js";
|
|
10
|
+
import { ResultsHistoryItem } from "../../core/elements/results-history-item.js";
|
|
11
|
+
import { CompatViewElement } from "../../core/elements/compat-view-element.js";
|
|
12
|
+
import "../../core/elements/index.js";
|
|
13
|
+
import "../../core/index.js";
|
|
14
|
+
//#region src/ui/compatibility-view/compatibility-view.js
|
|
15
|
+
/**@typedef {import("../../types/public").UISharedState} UISharedState */
|
|
16
|
+
/**@typedef {import("../../types/public").UISharedStateProps} UISharedStateProps */
|
|
17
|
+
/**@typedef {import("../../types/public").CompatResult} CompatResult */
|
|
18
|
+
/**
|
|
19
|
+
* CompatView manages the compatibility results panel that displays
|
|
20
|
+
* inspection overview, result details, and history.
|
|
21
|
+
*
|
|
22
|
+
* It mounts the `<sk-compat-view>` custom element, binds the view to
|
|
23
|
+
* shared state, listens for result updates from the Shinkom bus, and
|
|
24
|
+
* handles UI interactions such as tab switching and show/hide transitions.
|
|
25
|
+
*
|
|
26
|
+
* @extends {UIComponent}
|
|
27
|
+
*/
|
|
28
|
+
var CompatView = class CompatView extends UIComponent {
|
|
29
|
+
/**@type {AbortController | null} */
|
|
30
|
+
#compatViewController = null;
|
|
31
|
+
/**@type {UISharedState | null} */
|
|
32
|
+
#stateBind = null;
|
|
33
|
+
/**@type {ShinkomState | null} */
|
|
34
|
+
#stateService = null;
|
|
35
|
+
/**
|
|
36
|
+
* Initializes the compatibility view.
|
|
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-view>` custom element.
|
|
42
|
+
*
|
|
43
|
+
* @param {ShinkomBus} bus
|
|
44
|
+
* @param {ShinkomState} state
|
|
45
|
+
*/
|
|
46
|
+
constructor(bus, state) {
|
|
47
|
+
super(bus, state);
|
|
48
|
+
this.#stateService = state;
|
|
49
|
+
CompatView.register();
|
|
50
|
+
/**@type {CompatViewElement | null} */
|
|
51
|
+
this.compatViewEl = null;
|
|
52
|
+
/**@type {"overview" | "results" | "history"} */
|
|
53
|
+
this.currentTab = "overview";
|
|
54
|
+
/**@type {boolean} */
|
|
55
|
+
this.active = false;
|
|
56
|
+
/**@type {() => void} */
|
|
57
|
+
this.unsubEvent = () => {};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Register custom elements to the CustomElementRegistry.
|
|
61
|
+
*/
|
|
62
|
+
static register() {
|
|
63
|
+
if (typeof window !== "undefined" && "customElements" in globalThis) {
|
|
64
|
+
if (!globalThis.customElements.get("sk-compat-view")) globalThis.customElements.define("sk-compat-view", CompatViewElement);
|
|
65
|
+
if (!globalThis.customElements.get("sk-recent-result-item")) globalThis.customElements.define("sk-recent-result-item", RecentResultItem);
|
|
66
|
+
if (!globalThis.customElements.get("sk-history-item")) globalThis.customElements.define("sk-history-item", ResultsHistoryItem);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Subscribes to compatibility result events from the Shinkom bus.
|
|
71
|
+
*
|
|
72
|
+
* When a new result payload is available, the view element is updated
|
|
73
|
+
* with the latest compatibility data.
|
|
74
|
+
*/
|
|
75
|
+
#setupEventBusListeners() {
|
|
76
|
+
this.unsubEvent = this.bus.on("results:ready", (e) => {
|
|
77
|
+
if (this.compatViewEl) this.compatViewEl.results = e;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Unsubscribes from compatibility result events.
|
|
82
|
+
*/
|
|
83
|
+
#cleanupEventBusListeners() {
|
|
84
|
+
this.unsubEvent();
|
|
85
|
+
}
|
|
86
|
+
mount() {
|
|
87
|
+
if (this.compatViewEl || document.querySelector("sk-compat-view")) return;
|
|
88
|
+
this.compatViewEl = document.createElement("sk-compat-view");
|
|
89
|
+
this.compatViewEl.state = this.#stateService;
|
|
90
|
+
this.compatViewEl.bus = this.bus;
|
|
91
|
+
document.body.appendChild(this.compatViewEl);
|
|
92
|
+
this.#setupShadowListeners();
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Sets up shadow DOM listeners for the compatibility view.
|
|
96
|
+
*
|
|
97
|
+
* The controller allows all panel click listeners to be removed cleanly
|
|
98
|
+
* when the view is unmounted.
|
|
99
|
+
*/
|
|
100
|
+
#setupShadowListeners() {
|
|
101
|
+
if (!this.compatViewEl) return;
|
|
102
|
+
this.#compatViewController = new AbortController();
|
|
103
|
+
const { signal } = this.#compatViewController;
|
|
104
|
+
this.compatViewEl.shadowHost.addEventListener("click", this.#handleClickEvents, { signal });
|
|
105
|
+
this.#setupEventBusListeners();
|
|
106
|
+
}
|
|
107
|
+
unmount() {
|
|
108
|
+
if (!this.compatViewEl) return;
|
|
109
|
+
this.compatViewEl.remove();
|
|
110
|
+
this.compatViewEl = null;
|
|
111
|
+
this.#cleanupEventBusListeners();
|
|
112
|
+
this.#resetInternalState();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Resets internal state and aborts all shadow DOM event listeners.
|
|
116
|
+
*
|
|
117
|
+
* This clears the active view state, resets the current tab, and removes
|
|
118
|
+
* the compatibility view element from the shared ignore state.
|
|
119
|
+
*/
|
|
120
|
+
#resetInternalState() {
|
|
121
|
+
if (this.#compatViewController) this.#compatViewController.abort();
|
|
122
|
+
this.#compatViewController = null;
|
|
123
|
+
this.currentTab = "overview";
|
|
124
|
+
this.active = false;
|
|
125
|
+
if (this.#stateBind) this.#stateBind.ignoreCompatViewEl = null;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @param {UISharedState} state
|
|
129
|
+
*/
|
|
130
|
+
bindState(state) {
|
|
131
|
+
if (!this.#stateBind) this.#stateBind = state;
|
|
132
|
+
this.#stateBind.ignoreCompatViewEl = this.compatViewEl;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @param {UISharedStateProps} prop
|
|
136
|
+
* @param {*} val
|
|
137
|
+
*/
|
|
138
|
+
onStateChange(prop, val) {
|
|
139
|
+
if (prop === "compatViewTab") this.currentTab = val;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Handles click events inside the compatibility view shadow DOM.
|
|
143
|
+
*
|
|
144
|
+
* Supported actions include toggling the panel display, switching tabs,
|
|
145
|
+
* and requesting a full inspection from the engine.
|
|
146
|
+
*
|
|
147
|
+
* @param {PointerEvent} e
|
|
148
|
+
*/
|
|
149
|
+
#handleClickEvents = async (e) => {
|
|
150
|
+
switch (e.target.id) {
|
|
151
|
+
case "sk-toggle-compat-view":
|
|
152
|
+
if (!this.compatViewEl) break;
|
|
153
|
+
if (!document.startViewTransition) {
|
|
154
|
+
this.compatViewEl.renderDisplayTransition(this.active ? "hide" : "show");
|
|
155
|
+
this.active = !this.active;
|
|
156
|
+
} else {
|
|
157
|
+
const container = this.compatViewEl.shadowRootRef.getElementById("sk-compat-view-container");
|
|
158
|
+
if (container) {
|
|
159
|
+
container.part.value = "compat-view";
|
|
160
|
+
const transition = document.startViewTransition(() => {
|
|
161
|
+
this.compatViewEl?.renderDisplayTransition(this.active ? "hide" : "show");
|
|
162
|
+
});
|
|
163
|
+
try {
|
|
164
|
+
await transition.finished;
|
|
165
|
+
} finally {
|
|
166
|
+
this.active = !this.active;
|
|
167
|
+
container.removeAttribute("part");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case "sk-overview-tab":
|
|
173
|
+
if (this.currentTab === "overview") break;
|
|
174
|
+
this.#handleTabChange("overview");
|
|
175
|
+
break;
|
|
176
|
+
case "sk-results-tab":
|
|
177
|
+
if (this.currentTab === "results") break;
|
|
178
|
+
this.#handleTabChange("results");
|
|
179
|
+
break;
|
|
180
|
+
case "sk-history-tab":
|
|
181
|
+
if (this.currentTab === "history") break;
|
|
182
|
+
this.#handleTabChange("history");
|
|
183
|
+
break;
|
|
184
|
+
case "sk-full-inspect":
|
|
185
|
+
this.bus.emit("engine:full");
|
|
186
|
+
break;
|
|
187
|
+
default: break;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Handles navigation between compatibility view tabs.
|
|
192
|
+
*
|
|
193
|
+
* This method renders the selected tab content and updates shared state.
|
|
194
|
+
* When view transitions are available, it performs an animated tab change.
|
|
195
|
+
*
|
|
196
|
+
* @param {"overview" | "results" | "history"} tab
|
|
197
|
+
*/
|
|
198
|
+
async #handleTabChange(tab) {
|
|
199
|
+
if (!this.compatViewEl) return;
|
|
200
|
+
if (!document.startViewTransition) {
|
|
201
|
+
this.compatViewEl.renderTabContent(tab);
|
|
202
|
+
if (this.#stateBind) this.#stateBind.compatViewTab = tab;
|
|
203
|
+
} else {
|
|
204
|
+
const mainSection = this.compatViewEl.shadowRootRef.getElementById("sk-compat-view-main");
|
|
205
|
+
if (mainSection) {
|
|
206
|
+
const tabs = [
|
|
207
|
+
"overview",
|
|
208
|
+
"results",
|
|
209
|
+
"history"
|
|
210
|
+
];
|
|
211
|
+
const direction = tabs.indexOf(tab) > tabs.indexOf(this.currentTab) ? "forward" : "backward";
|
|
212
|
+
mainSection.part.value = "compat-view";
|
|
213
|
+
document.documentElement.dataset.transition = direction;
|
|
214
|
+
const transition = document.startViewTransition(() => {
|
|
215
|
+
this.compatViewEl?.renderTabContent(tab);
|
|
216
|
+
});
|
|
217
|
+
if (this.#stateBind) this.#stateBind.compatViewTab = tab;
|
|
218
|
+
try {
|
|
219
|
+
await transition.finished;
|
|
220
|
+
} finally {
|
|
221
|
+
mainSection.removeAttribute("part");
|
|
222
|
+
delete document.documentElement.dataset.transition;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
//#endregion
|
|
229
|
+
export { CompatView };
|
|
@@ -1,36 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shinkom - control-panel
|
|
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 { CompatControlPanelElement } from "../../core/elements/control-panel-element.js";
|
|
9
10
|
import { UISharedState as UISharedState$1, UISharedStateProps as UISharedStateProps$1 } from "../../types/public.js";
|
|
10
11
|
|
|
11
12
|
//#region src/ui/control-panel/control-panel.d.ts
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* CompatControlPanel manages the visibility, tabs, and input controls of
|
|
15
|
+
* the compatibility control panel overlay.
|
|
16
|
+
*
|
|
17
|
+
* It mounts the `<sk-control-panel>` custom element, binds control values
|
|
18
|
+
* to shared UI state, and dispatches user-driven commands over the Shinkom
|
|
19
|
+
* event bus.
|
|
20
|
+
*
|
|
21
|
+
* The panel supports inspector controls, compatibility view settings,
|
|
22
|
+
* tab switching, and display transitions with or without view transition
|
|
23
|
+
* support.
|
|
24
|
+
*
|
|
25
|
+
* @extends {UIComponent}
|
|
26
|
+
*/
|
|
13
27
|
declare class CompatControlPanel extends UIComponent {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Register custom elements to the CustomElementRegistry.
|
|
30
|
+
*/
|
|
31
|
+
static register(): void;
|
|
32
|
+
/**@type {CompatControlPanelElement | null} */
|
|
33
|
+
controlPanelEl: CompatControlPanelElement | null;
|
|
18
34
|
/**@type {HTMLInputElement | null} */
|
|
19
35
|
depthLevelInput: HTMLInputElement | null;
|
|
20
|
-
/**@type {
|
|
21
|
-
|
|
22
|
-
/**@type {
|
|
23
|
-
|
|
24
|
-
/**@type {HTMLButtonElement | null} */
|
|
25
|
-
toggleInspectorEl: HTMLButtonElement | null;
|
|
36
|
+
/**@type {HTMLInputElement | null} */
|
|
37
|
+
maxResultsHistoryInput: HTMLInputElement | null;
|
|
38
|
+
/**@type {number} */
|
|
39
|
+
maxResultsHistory: number;
|
|
26
40
|
/**@type {number} */
|
|
27
41
|
depthLevel: number;
|
|
28
42
|
/**@type {boolean} */
|
|
29
43
|
multiElements: boolean;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
/**@type {"inspector" | "compatView"} */
|
|
45
|
+
currentTab: "inspector" | "compatView";
|
|
46
|
+
/**@type {() => void} */
|
|
47
|
+
unsubState: () => void;
|
|
34
48
|
#private;
|
|
35
49
|
}
|
|
36
50
|
type UISharedState = UISharedState$1;
|