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.
Files changed (91) 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 +36 -36
  31. package/dist/bundles/gen/browser-usage-data.js +224 -222
  32. package/dist/bundles/gen/compat-data.js +1 -1
  33. package/dist/bundles/gen/index.js +1 -1
  34. package/dist/bundles/index.d.ts +6 -2
  35. package/dist/bundles/index.js +8 -2
  36. package/dist/bundles/pkg/shinkore.d.ts +1 -1
  37. package/dist/bundles/pkg/shinkore.js +1 -1
  38. package/dist/bundles/pkg/shinkore_bg.wasm +0 -0
  39. package/dist/bundles/shinkom.d.ts +9 -1
  40. package/dist/bundles/shinkom.js +31 -6
  41. package/dist/bundles/types/public.d.ts +13 -29
  42. package/dist/bundles/types/types.d.ts +99 -0
  43. package/dist/bundles/ui/compat-ui/compat-ui.d.ts +12 -2
  44. package/dist/bundles/ui/compat-ui/compat-ui.js +12 -2
  45. package/dist/bundles/ui/compat-ui/index.js +8 -0
  46. package/dist/bundles/ui/compatibility-view/compatibility-view.d.ts +42 -0
  47. package/dist/bundles/ui/compatibility-view/compatibility-view.js +229 -0
  48. package/dist/bundles/ui/compatibility-view/index.js +8 -0
  49. package/dist/bundles/ui/control-panel/control-panel.d.ts +30 -16
  50. package/dist/bundles/ui/control-panel/control-panel.js +188 -277
  51. package/dist/bundles/ui/control-panel/index.js +8 -0
  52. package/dist/bundles/ui/index.d.ts +3 -2
  53. package/dist/bundles/ui/index.js +7 -2
  54. package/dist/bundles/ui/inspector/index.js +8 -0
  55. package/dist/bundles/ui/inspector/inspector.d.ts +60 -6
  56. package/dist/bundles/ui/inspector/inspector.js +149 -69
  57. package/dist/modules/core/constants.cjs +17 -1
  58. package/dist/modules/core/elements/compat-view-element.cjs +434 -0
  59. package/dist/modules/core/elements/control-panel-element.cjs +93 -0
  60. package/dist/modules/core/elements/index.cjs +11 -0
  61. package/dist/modules/core/elements/inspector-element.cjs +52 -0
  62. package/dist/modules/core/elements/recent-result-item.cjs +39 -0
  63. package/dist/modules/core/elements/results-history-item.cjs +39 -0
  64. package/dist/modules/core/elements/templates/compat-view.templates.cjs +458 -0
  65. package/dist/modules/core/elements/templates/control-panel.templates.cjs +332 -0
  66. package/dist/modules/core/elements/templates/root-styles.template.cjs +33 -0
  67. package/dist/modules/core/event-bus.cjs +43 -1
  68. package/dist/modules/core/helpers.cjs +41 -1
  69. package/dist/modules/core/index.cjs +16 -1
  70. package/dist/modules/core/state-service.cjs +74 -1
  71. package/dist/modules/core/ui-component.cjs +65 -1
  72. package/dist/modules/engine/engine.cjs +232 -1
  73. package/dist/modules/gen/browser-data.cjs +100 -1
  74. package/dist/modules/gen/browser-usage-data.cjs +675 -1
  75. package/dist/modules/gen/compat-data.cjs +31015 -1
  76. package/dist/modules/gen/index.cjs +7 -1
  77. package/dist/modules/index.cjs +27 -1
  78. package/dist/modules/pkg/shinkore.cjs +459 -1
  79. package/dist/modules/pkg/shinkore_bg.wasm +0 -0
  80. package/dist/modules/shinkom.cjs +73 -1
  81. package/dist/modules/ui/compat-ui/compat-ui.cjs +53 -1
  82. package/dist/modules/ui/compat-ui/index.cjs +1 -0
  83. package/dist/modules/ui/compatibility-view/compatibility-view.cjs +223 -0
  84. package/dist/modules/ui/compatibility-view/index.cjs +1 -0
  85. package/dist/modules/ui/control-panel/control-panel.cjs +314 -182
  86. package/dist/modules/ui/control-panel/index.cjs +1 -0
  87. package/dist/modules/ui/index.cjs +13 -1
  88. package/dist/modules/ui/inspector/index.cjs +1 -0
  89. package/dist/modules/ui/inspector/inspector.cjs +388 -1
  90. package/package.json +15 -8
  91. package/dist/bundles/node_modules/@mdn/browser-compat-data/types.d.ts +0 -78
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Shinkom - elements
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { getStyleSheet } from "../helpers.js";
9
+ import { hostStyles } from "./templates/root-styles.template.js";
10
+ import { controlPanelCompatViewTab, controlPanelHTML, controlPanelInspectorTab, controlPanelStyles, controlPanelTransitions } from "./templates/control-panel.templates.js";
11
+ //#region src/core/elements/control-panel-element.js
12
+ /**
13
+ * @type {typeof HTMLElement}
14
+ */
15
+ const BaseElement = typeof window !== "undefined" ? HTMLElement : class {};
16
+ /**@type {CSSStyleSheet | null} */
17
+ let cachedHostStyleSheet = null;
18
+ /**@type {CSSStyleSheet | null} */
19
+ let cachedStyleSheet = null;
20
+ /**@type {CSSStyleSheet | null} */
21
+ let cachedTransitions = null;
22
+ /**
23
+ * A custom element for the `CompatControlPanel` UI component.
24
+ *
25
+ * An autonomous custom element created via the [Web Components API](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).
26
+ * This component contains methods for rendering components for the `CompatControlPanel` and providing settings for customization of different
27
+ * UI components.
28
+ *
29
+ * Since this element is defined via the Web Components API, to use this element outside of the `CompatControlPanel`, it must be registered
30
+ * as a custom element on the `window` object.
31
+ * @extends {BaseElement}
32
+ */
33
+ var CompatControlPanelElement = class extends BaseElement {
34
+ constructor() {
35
+ super();
36
+ /**@type {ShadowRoot} */
37
+ this.shadowRootRef = this.attachShadow({ mode: "open" });
38
+ this.shadowHost = document.createElement("div");
39
+ this.shadowHost.id = "sk-shadow-host";
40
+ cachedHostStyleSheet = getStyleSheet(cachedHostStyleSheet, hostStyles);
41
+ cachedStyleSheet = getStyleSheet(cachedStyleSheet, controlPanelStyles);
42
+ cachedTransitions = getStyleSheet(cachedTransitions, controlPanelTransitions);
43
+ }
44
+ connectedCallback() {
45
+ Object.assign(this.shadowHost.style, {
46
+ position: "fixed",
47
+ top: "2rem",
48
+ left: "2rem",
49
+ zIndex: "992"
50
+ });
51
+ if (cachedTransitions) document.adoptedStyleSheets.push(cachedTransitions);
52
+ if (cachedHostStyleSheet) this.shadowRootRef.adoptedStyleSheets = [cachedHostStyleSheet];
53
+ if (cachedStyleSheet) this.shadowRootRef.adoptedStyleSheets.push(cachedStyleSheet);
54
+ this.shadowRootRef.appendChild(this.shadowHost);
55
+ this.render();
56
+ }
57
+ disconnectedCallback() {
58
+ document.adoptedStyleSheets = document.adoptedStyleSheets.filter((sheet) => sheet !== cachedTransitions);
59
+ }
60
+ /**
61
+ * Renders the `ControlPanelElement` on a specific tab.
62
+ *
63
+ * Renders the `inspector` tab by default.
64
+ * @param {"inspector" | "compatView" | undefined} tab
65
+ */
66
+ render(tab = void 0) {
67
+ this.shadowHost.innerHTML = controlPanelHTML;
68
+ tab ? this.renderTabContent(tab) : this.renderTabContent("inspector");
69
+ }
70
+ /**
71
+ * Renders content for a specific tab.
72
+ * @param {"inspector" | "compatView"} tab
73
+ */
74
+ renderTabContent(tab) {
75
+ const main = this.shadowRootRef.getElementById("sk-control-panel-main");
76
+ switch (tab) {
77
+ case "inspector":
78
+ if (main) main.innerHTML = controlPanelInspectorTab;
79
+ break;
80
+ case "compatView":
81
+ if (main) main.innerHTML = controlPanelCompatViewTab;
82
+ break;
83
+ default: break;
84
+ }
85
+ }
86
+ /**
87
+ * Renders the display of the `ControlPanelElement`.
88
+ * @param {"show" | "hide"} display
89
+ */
90
+ renderDisplayTransition(display) {
91
+ const panel = this.shadowRootRef.getElementById("sk-control-panel");
92
+ if (panel) {
93
+ if (display === "show") panel.style.display = "flex";
94
+ else if (display === "hide") panel.style.display = "none";
95
+ }
96
+ }
97
+ };
98
+ //#endregion
99
+ export { CompatControlPanelElement };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Shinkom - elements
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { RecentResultItem } from "./recent-result-item.js";
9
+ import { ResultsHistoryItem } from "./results-history-item.js";
10
+ import { CompatViewElement } from "./compat-view-element.js";
11
+ import { CompatControlPanelElement } from "./control-panel-element.js";
12
+ import { CompatInspectorElement } from "./inspector-element.js";
13
+ export { CompatControlPanelElement, CompatInspectorElement, CompatViewElement, RecentResultItem, ResultsHistoryItem };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Shinkom - elements
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { RecentResultItem } from "./recent-result-item.js";
9
+ import { ResultsHistoryItem } from "./results-history-item.js";
10
+ import { CompatViewElement } from "./compat-view-element.js";
11
+ import { CompatControlPanelElement } from "./control-panel-element.js";
12
+ import { CompatInspectorElement } from "./inspector-element.js";
13
+ export { CompatControlPanelElement, CompatInspectorElement, CompatViewElement, RecentResultItem, ResultsHistoryItem };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Shinkom - elements
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ //#region src/core/elements/inspector-element.d.ts
9
+ /**
10
+ * A custom element for the `CompatInspector` UI component.
11
+ *
12
+ * An autonomous custom element created via the [Web Components API](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).
13
+ * This component is used for defining and initializing the styling and structure of the `CompatInspector`.
14
+ *
15
+ * Since this element is defined via the Web Components API, to use this element outside of the `CompatInspector`, it must be registered
16
+ * as a custom element on the `window` object.
17
+ * @extends {BaseElement}
18
+ */
19
+ declare class CompatInspectorElement extends HTMLElement {
20
+ /**@type {ShadowRoot} */
21
+ shadowRootRef: ShadowRoot;
22
+ shadowHost: HTMLDivElement;
23
+ styles: HTMLStyleElement;
24
+ connectedCallback(): void;
25
+ }
26
+ //#endregion
27
+ export { CompatInspectorElement };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Shinkom - elements
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ //#region src/core/elements/inspector-element.js
9
+ /**
10
+ * @type {typeof HTMLElement}
11
+ */
12
+ const BaseElement = typeof window !== "undefined" ? HTMLElement : class {};
13
+ /**
14
+ * A custom element for the `CompatInspector` UI component.
15
+ *
16
+ * An autonomous custom element created via the [Web Components API](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).
17
+ * This component is used for defining and initializing the styling and structure of the `CompatInspector`.
18
+ *
19
+ * Since this element is defined via the Web Components API, to use this element outside of the `CompatInspector`, it must be registered
20
+ * as a custom element on the `window` object.
21
+ * @extends {BaseElement}
22
+ */
23
+ var CompatInspectorElement = class extends BaseElement {
24
+ constructor() {
25
+ super();
26
+ /**@type {ShadowRoot} */
27
+ this.shadowRootRef = this.attachShadow({ mode: "open" });
28
+ this.shadowHost = document.createElement("div");
29
+ this.styles = document.createElement("style");
30
+ this.shadowHost.id = "sk-compat-inspector";
31
+ }
32
+ connectedCallback() {
33
+ this.styles.textContent = `
34
+ #sk-compat-inspector {
35
+ position: absolute;
36
+ top: 0;
37
+ background-color: rgba(0, 255, 0, .3);
38
+ outline-width: 1px;
39
+ outline-style: dashed;
40
+ outline-color: rgb(0, 255, 0);
41
+ outline-offset: 4px;
42
+ z-index: 990;
43
+ transition-property: width, height, transform;
44
+ transition-duration: 300ms;
45
+ transition-timing-function: ease-out;
46
+ will-change: width, height, transform;
47
+ pointer-events: none;
48
+ }
49
+ `;
50
+ try {
51
+ this.shadowRootRef.replaceChildren(...[this.styles, this.shadowHost]);
52
+ } catch (error) {
53
+ console.error(error);
54
+ }
55
+ }
56
+ };
57
+ //#endregion
58
+ export { CompatInspectorElement };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shinkom - core\elements\recent-result-item
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ //#region src/core/elements/recent-result-item.js
9
+ /**@typedef {import('../../types/public').CompatSnapshot} CompatSnapshot */
10
+ /**
11
+ * @type {typeof HTMLElement}
12
+ */
13
+ const BaseElement = typeof window !== "undefined" ? HTMLElement : class {};
14
+ /**
15
+ * A custom element for rendering a recent compatibility result item.
16
+ *
17
+ * An autonomous custom element created via the [Web Components API](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).
18
+ * This component is used for creating unique items that store their assigned compatibility result for future viewing.
19
+ *
20
+ * Since this element is defined via the Web Components API it must be registered
21
+ * as a custom element on the `window` object.
22
+ * @extends {BaseElement}
23
+ */
24
+ var RecentResultItem = class extends BaseElement {
25
+ constructor() {
26
+ super();
27
+ /**@type {CompatSnapshot | null} */
28
+ this._result = null;
29
+ /** @type {function(CompatSnapshot): void} */
30
+ this.viewResult = () => {};
31
+ }
32
+ get result() {
33
+ return this._result;
34
+ }
35
+ set result(val) {
36
+ if (val) this._result = val;
37
+ }
38
+ connectedCallback() {
39
+ const detailsButton = this.querySelector(".sk-view-result");
40
+ if (detailsButton instanceof HTMLButtonElement) detailsButton.addEventListener("click", () => {
41
+ if (this.result) this.viewResult(this.result);
42
+ });
43
+ }
44
+ };
45
+ //#endregion
46
+ export { RecentResultItem };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shinkom - core\elements\results-history-item
3
+ * @version 1.1.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ //#region src/core/elements/results-history-item.js
9
+ /**@typedef {import("../../types/public").CompatSnapshot} CompatSnapshot */
10
+ /**
11
+ * @type {typeof HTMLElement}
12
+ */
13
+ const BaseElement = typeof window !== "undefined" ? HTMLElement : class {};
14
+ /**
15
+ * A custom element for rendering a compatibility result item from the results history object.
16
+ *
17
+ * An autonomous custom element created via the [Web Components API](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).
18
+ * This component is used for creating unique items that store their assigned compatibility result for future viewing.
19
+ *
20
+ * Since this element is defined via the Web Components API it must be registered
21
+ * as a custom element on the `window` object.
22
+ * @extends {BaseElement}
23
+ */
24
+ var ResultsHistoryItem = class extends BaseElement {
25
+ constructor() {
26
+ super();
27
+ /**@type {CompatSnapshot | null} */
28
+ this._result = null;
29
+ /**@type {function(CompatSnapshot): void} */
30
+ this.viewResult = () => {};
31
+ }
32
+ get result() {
33
+ return this._result;
34
+ }
35
+ set result(val) {
36
+ if (val) this._result = val;
37
+ }
38
+ connectedCallback() {
39
+ const historyItem = this.querySelector(".sk-history-item");
40
+ if (historyItem instanceof HTMLDivElement) historyItem.addEventListener("click", () => {
41
+ if (this.result) this.viewResult(this.result);
42
+ });
43
+ }
44
+ };
45
+ //#endregion
46
+ export { ResultsHistoryItem };