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,45 @@
1
+ /**
2
+ * Shinkom - core
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { ShinkomBus } from "./event-bus.js";
9
+ import { ShinkomState } from "./state-service.js";
10
+ import { UISharedState as UISharedState$1, UISharedStateProps as UISharedStateProps$1 } from "../types/public.js";
11
+
12
+ //#region src/core/ui-component.d.ts
13
+ declare class UIComponent {
14
+ /**
15
+ * @param {ShinkomBus} bus
16
+ * @param {ShinkomState} stateService
17
+ */
18
+ constructor(bus: ShinkomBus, stateService: ShinkomState);
19
+ bus: ShinkomBus;
20
+ /**
21
+ * Mount UIComponent to the DOM.
22
+ */
23
+ mount(): void;
24
+ /**
25
+ * Unmount UIComponent from the DOM.
26
+ */
27
+ unmount(): void;
28
+ /**
29
+ * Used to bind state from a proxy to a UIComponent instance.
30
+ *
31
+ * Sets any initial state defined by the component.
32
+ * @param {UISharedState} _state
33
+ */
34
+ bindState(_state: UISharedState): void;
35
+ /**
36
+ * Notify UIComponent of a state change in the `stateBind`.
37
+ * @param {UISharedStateProps} _prop
38
+ * @param {any} _val
39
+ */
40
+ onStateChange(_prop: UISharedStateProps, _val: any): void;
41
+ }
42
+ type UISharedState = UISharedState$1;
43
+ type UISharedStateProps = UISharedStateProps$1;
44
+ //#endregion
45
+ export { UIComponent, UISharedState, UISharedStateProps };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Shinkom - core
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ //#region src/core/ui-component.js
9
+ var UIComponent = class UIComponent {
10
+ /**
11
+ * @param {ShinkomBus} bus
12
+ * @param {ShinkomState} stateService
13
+ */
14
+ constructor(bus, stateService) {
15
+ if (this.constructor === UIComponent) throw new Error("UIComponent is an abstract class and cannot be instantiated.");
16
+ this.bus = bus;
17
+ stateService.subscribe((prop, val) => {
18
+ this.onStateChange(prop, val);
19
+ });
20
+ }
21
+ /**
22
+ * Mount UIComponent to the DOM.
23
+ */
24
+ mount() {
25
+ throw new Error("mount() method must be implemented.");
26
+ }
27
+ /**
28
+ * Unmount UIComponent from the DOM.
29
+ */
30
+ unmount() {
31
+ throw new Error("unmount() method must be implemented.");
32
+ }
33
+ /**
34
+ * Used to bind state from a proxy to a UIComponent instance.
35
+ *
36
+ * Sets any initial state defined by the component.
37
+ * @param {UISharedState} _state
38
+ */
39
+ bindState(_state) {
40
+ throw new Error("bindState() method must be implemented.");
41
+ }
42
+ /**
43
+ * Notify UIComponent of a state change in the `stateBind`.
44
+ * @param {UISharedStateProps} _prop
45
+ * @param {any} _val
46
+ */
47
+ onStateChange(_prop, _val) {
48
+ throw new Error("onStateChange() method must be implemented.");
49
+ }
50
+ };
51
+ //#endregion
52
+ export { UIComponent };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Shinkom - engine
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { ShinkomBus } from "../core/event-bus.js";
9
+ import { CompatResult as CompatResult$1, CustomEventEngineDetail as CustomEventEngineDetail$1 } from "../types/public.js";
10
+ import { CompatEngine } from "../pkg/shinkore.js";
11
+
12
+ //#region src/engine/engine.d.ts
13
+ declare class SKEngine {
14
+ /**
15
+ * @param {ShinkomBus | null} bus
16
+ */
17
+ constructor(bus?: ShinkomBus | null);
18
+ /**@type {CompatEngine | null} */
19
+ compatEngine: CompatEngine | null;
20
+ /**@type {ShinkomBus | null} */
21
+ bus: ShinkomBus | null;
22
+ /**
23
+ * Loads WASM for the Browser or Node.
24
+ * @param {string | undefined} wasmURL
25
+ */
26
+ loadWasm(wasmURL?: string | undefined): Promise<void>;
27
+ /**
28
+ * Initializes Rust/WASM engine.
29
+ * @param {string | undefined} wasmURL
30
+ */
31
+ initEngine(wasmURL?: string | undefined): Promise<void>;
32
+ /**
33
+ * Used for checking the compatibility of a single element.
34
+ * @param {string} element
35
+ * @returns {CompatResult | null}
36
+ */
37
+ checkElement(element: string): CompatResult | null;
38
+ /**
39
+ * Used for checking the compatibility of a multiple elements, depending on `depthLevel`.
40
+ * @param {string} html
41
+ * @param {number} depthLevel
42
+ * @returns {CompatResult | null}
43
+ */
44
+ checkElements(html: string, depthLevel: number): CompatResult | null;
45
+ /**
46
+ * Used for checking the compatibility of a full page.
47
+ *
48
+ * Only available in `browser` environments.
49
+ * @returns {CompatResult | null}
50
+ */
51
+ fullInspect(): CompatResult | null;
52
+ /**
53
+ * Free WASM memory and dereference engine.
54
+ */
55
+ destroy(): void;
56
+ #private;
57
+ }
58
+ type CustomEventEngineDetail = CustomEventEngineDetail$1;
59
+ type CompatResult = CompatResult$1;
60
+ //#endregion
61
+ export { CompatResult, CustomEventEngineDetail, SKEngine };
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Shinkom - engine
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import { CompatEngine, __wbg_init } from "../pkg/shinkore.js";
9
+ import browser_data_default from "../gen/browser-data.js";
10
+ import browser_usage_data_default from "../gen/browser-usage-data.js";
11
+ import gen_default from "../gen/index.js";
12
+ import { getModulePath } from "../core/helpers.js";
13
+ //#region src/engine/engine.js
14
+ /**@typedef {import('../types/public').CustomEventEngineDetail} CustomEventEngineDetail */
15
+ /**@typedef {import('../types/public').CompatResult} CompatResult */
16
+ var SKEngine = class {
17
+ /**@type {Promise<void> | null} */
18
+ #wasmLoaded = null;
19
+ /**
20
+ * @param {ShinkomBus | null} bus
21
+ */
22
+ constructor(bus = null) {
23
+ /**@type {CompatEngine | null} */
24
+ this.compatEngine = null;
25
+ /**@type {ShinkomBus | null} */
26
+ this.bus = bus;
27
+ if (this.bus) {
28
+ this.bus.on("engine:inspect", (e) => {
29
+ if (typeof e === "object") if (e.multiElements) this.checkElements(e.elem, e.depthLevel);
30
+ else this.checkElement(e.elem);
31
+ });
32
+ this.bus.on("engine:full", () => {
33
+ this.fullInspect();
34
+ });
35
+ }
36
+ }
37
+ /**
38
+ * Loads WASM for the Browser or Node.
39
+ * @param {string | undefined} wasmURL
40
+ */
41
+ async loadWasm(wasmURL = void 0) {
42
+ if (this.#wasmLoaded) return this.#wasmLoaded;
43
+ const isNode = typeof window === "undefined";
44
+ try {
45
+ if (isNode) {
46
+ const path = await import("node:path");
47
+ const fs = await import("node:fs");
48
+ let wasmPath = await getModulePath("shinkom/wasm");
49
+ let wasmBuffer;
50
+ if (wasmPath.toString().endsWith("shinkore_bg.wasm")) {
51
+ if (fs.existsSync(wasmPath)) wasmBuffer = fs.readFileSync(wasmPath);
52
+ else {
53
+ wasmPath = path.resolve(__dirname, "../../pkg/shinkore_bg.wasm");
54
+ wasmBuffer = fs.readFileSync(wasmPath);
55
+ }
56
+ this.#wasmLoaded = (async () => {
57
+ await __wbg_init({ module_or_path: wasmBuffer });
58
+ })();
59
+ } else throw new Error("Path does not lead to WASM file.");
60
+ } else if (wasmURL) this.#wasmLoaded = (async () => {
61
+ await __wbg_init({ module_or_path: wasmURL });
62
+ })();
63
+ else this.#wasmLoaded = (async () => {
64
+ await __wbg_init();
65
+ })();
66
+ console.log("loaded WASM");
67
+ return this.#wasmLoaded;
68
+ } catch (error) {
69
+ throw error;
70
+ }
71
+ }
72
+ /**
73
+ * Initializes Rust/WASM engine.
74
+ * @param {string | undefined} wasmURL
75
+ */
76
+ async initEngine(wasmURL = void 0) {
77
+ try {
78
+ if (!this.compatEngine) {
79
+ if (!this.#wasmLoaded) {
80
+ console.log("loading WASM through initializer");
81
+ if (wasmURL) await this.loadWasm(wasmURL);
82
+ else await this.loadWasm();
83
+ }
84
+ this.compatEngine = new CompatEngine(gen_default.html, gen_default.svg, browser_data_default, browser_usage_data_default);
85
+ console.log("initialized engine");
86
+ }
87
+ } catch (error) {
88
+ console.error(`Engine initialization error: ${error}`);
89
+ }
90
+ }
91
+ /**
92
+ * Used for checking the compatibility of a single element.
93
+ * @param {string} element
94
+ * @returns {CompatResult | null}
95
+ */
96
+ checkElement(element) {
97
+ try {
98
+ /**@type {CompatResult} */
99
+ const result = this.compatEngine?.check_element(element);
100
+ console.dir(result);
101
+ return result;
102
+ } catch (error) {
103
+ console.error(error);
104
+ return null;
105
+ }
106
+ }
107
+ /**
108
+ * Used for checking the compatibility of a multiple elements, depending on `depthLevel`.
109
+ * @param {string} html
110
+ * @param {number} depthLevel
111
+ * @returns {CompatResult | null}
112
+ */
113
+ checkElements(html, depthLevel) {
114
+ try {
115
+ const result = this.compatEngine?.check_elements(html, depthLevel);
116
+ console.dir(result);
117
+ return result;
118
+ } catch (error) {
119
+ console.error(error);
120
+ return null;
121
+ }
122
+ }
123
+ /**
124
+ * Used for checking the compatibility of a full page.
125
+ *
126
+ * Only available in `browser` environments.
127
+ * @returns {CompatResult | null}
128
+ */
129
+ fullInspect() {
130
+ try {
131
+ const result = this.compatEngine?.full_inspect(document.documentElement.outerHTML);
132
+ console.dir(result);
133
+ return result;
134
+ } catch (error) {
135
+ if (error instanceof ReferenceError) console.error("fullInspect is only available in browser environments");
136
+ else console.error(`fullInspect error: ${error}`);
137
+ return null;
138
+ }
139
+ }
140
+ /**
141
+ * Free WASM memory and dereference engine.
142
+ */
143
+ destroy() {
144
+ if (!this.compatEngine) {
145
+ console.warn("Shinkom Engine cannot be destroyed as it is not initialized.");
146
+ return;
147
+ }
148
+ this.compatEngine?.free();
149
+ this.#wasmLoaded = null;
150
+ this.compatEngine = null;
151
+ }
152
+ };
153
+ //#endregion
154
+ export { SKEngine };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shinkom - engine\index
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2026 - OneilNvM
6
+ */
7
+
8
+ import "./engine.js";
@@ -0,0 +1,96 @@
1
+
2
+ //#region gen/browser-data.json
3
+ var browser_data_default = { browsers: {
4
+ "chrome": { "147": {
5
+ "engine": "Blink",
6
+ "engine_version": "147",
7
+ "release_date": "2026-04-07",
8
+ "release_notes": "https://developer.chrome.com/release-notes/147",
9
+ "status": "current"
10
+ } },
11
+ "chrome_android": { "147": {
12
+ "engine": "Blink",
13
+ "engine_version": "147",
14
+ "release_date": "2026-04-07",
15
+ "release_notes": "https://developer.chrome.com/release-notes/147",
16
+ "status": "current"
17
+ } },
18
+ "edge": { "147": {
19
+ "engine": "Blink",
20
+ "engine_version": "147",
21
+ "release_date": "2026-04-10",
22
+ "release_notes": "https://learn.microsoft.com/en-us/microsoft-edge/web-platform/release-notes/147",
23
+ "status": "current"
24
+ } },
25
+ "firefox": { "150": {
26
+ "engine": "Gecko",
27
+ "engine_version": "150",
28
+ "release_date": "2026-04-21",
29
+ "release_notes": "https://developer.mozilla.org/docs/Mozilla/Firefox/Releases/150",
30
+ "status": "current"
31
+ } },
32
+ "firefox_android": { "150": {
33
+ "engine": "Gecko",
34
+ "engine_version": "150",
35
+ "release_date": "2026-04-21",
36
+ "release_notes": "https://developer.mozilla.org/docs/Mozilla/Firefox/Releases/150",
37
+ "status": "current"
38
+ } },
39
+ "oculus": { "42.0": {
40
+ "engine": "Blink",
41
+ "engine_version": "142",
42
+ "release_date": "2026-01-26",
43
+ "release_notes": "https://developers.meta.com/horizon/downloads/package/browser/42.0/",
44
+ "status": "current"
45
+ } },
46
+ "opera": { "130": {
47
+ "engine": "Blink",
48
+ "engine_version": "146",
49
+ "release_date": "2026-04-08",
50
+ "release_notes": "https://blogs.opera.com/desktop/2026/04/opera-130-stable/",
51
+ "status": "current"
52
+ } },
53
+ "opera_android": { "97": {
54
+ "engine": "Blink",
55
+ "engine_version": "146",
56
+ "release_date": "2026-04-16",
57
+ "release_notes": "https://forums.opera.com/topic/88511/opera-for-android-97",
58
+ "status": "current"
59
+ } },
60
+ "safari": { "26.4": {
61
+ "engine": "WebKit",
62
+ "engine_version": "624.1.16",
63
+ "release_date": "2026-03-24",
64
+ "release_notes": "https://developer.apple.com/documentation/safari-release-notes/safari-26_4-release-notes",
65
+ "status": "current"
66
+ } },
67
+ "safari_ios": { "26.4": {
68
+ "engine": "WebKit",
69
+ "engine_version": "624.1.16",
70
+ "release_date": "2026-03-24",
71
+ "release_notes": "https://developer.apple.com/documentation/safari-release-notes/safari-26_4-release-notes",
72
+ "status": "current"
73
+ } },
74
+ "samsunginternet_android": { "29.0": {
75
+ "engine": "Blink",
76
+ "engine_version": "136",
77
+ "release_date": "2025-10-25",
78
+ "status": "current"
79
+ } },
80
+ "webview_android": { "147": {
81
+ "engine": "Blink",
82
+ "engine_version": "147",
83
+ "release_date": "2026-04-07",
84
+ "release_notes": "https://developer.chrome.com/release-notes/147",
85
+ "status": "current"
86
+ } },
87
+ "webview_ios": { "26.4": {
88
+ "engine": "WebKit",
89
+ "engine_version": "624.1.16",
90
+ "release_date": "2026-03-24",
91
+ "release_notes": "https://developer.apple.com/documentation/safari-release-notes/safari-26_4-release-notes",
92
+ "status": "current"
93
+ } }
94
+ } };
95
+ //#endregion
96
+ export { browser_data_default as default };