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