shinkom 1.1.0 → 1.1.1

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 (84) hide show
  1. package/dist/bundles/_virtual/_rolldown/runtime.js +14 -14
  2. package/dist/bundles/core/constants.d.ts +15 -15
  3. package/dist/bundles/core/constants.js +23 -23
  4. package/dist/bundles/core/elements/compat-view-element.d.ts +99 -99
  5. package/dist/bundles/core/elements/compat-view-element.js +440 -440
  6. package/dist/bundles/core/elements/control-panel-element.d.ts +44 -44
  7. package/dist/bundles/core/elements/control-panel-element.js +99 -99
  8. package/dist/bundles/core/elements/index.d.ts +12 -12
  9. package/dist/bundles/core/elements/index.js +13 -13
  10. package/dist/bundles/core/elements/inspector-element.d.ts +26 -26
  11. package/dist/bundles/core/elements/inspector-element.js +58 -58
  12. package/dist/bundles/core/elements/recent-result-item.js +46 -46
  13. package/dist/bundles/core/elements/results-history-item.js +46 -46
  14. package/dist/bundles/core/elements/templates/compat-view.templates.js +462 -462
  15. package/dist/bundles/core/elements/templates/control-panel.templates.js +335 -335
  16. package/dist/bundles/core/elements/templates/root-styles.template.js +40 -40
  17. package/dist/bundles/core/event-bus.d.ts +46 -46
  18. package/dist/bundles/core/event-bus.js +49 -49
  19. package/dist/bundles/core/helpers.js +47 -47
  20. package/dist/bundles/core/index.d.ts +14 -14
  21. package/dist/bundles/core/index.js +16 -16
  22. package/dist/bundles/core/state-service.d.ts +56 -56
  23. package/dist/bundles/core/state-service.js +80 -80
  24. package/dist/bundles/core/ui-component.d.ts +63 -63
  25. package/dist/bundles/core/ui-component.js +71 -71
  26. package/dist/bundles/engine/engine.d.ts +108 -108
  27. package/dist/bundles/engine/engine.js +238 -238
  28. package/dist/bundles/engine/index.js +8 -8
  29. package/dist/bundles/gen/index.js +14 -14
  30. package/dist/bundles/index.d.ts +19 -19
  31. package/dist/bundles/index.js +23 -23
  32. package/dist/bundles/pkg/shinkore.d.ts +50 -50
  33. package/dist/bundles/pkg/shinkore.js +465 -465
  34. package/dist/bundles/pkg/shinkore_bg.wasm +0 -0
  35. package/dist/bundles/shinkom.d.ts +41 -41
  36. package/dist/bundles/shinkom.js +80 -80
  37. package/dist/bundles/ui/compat-ui/compat-ui.d.ts +42 -42
  38. package/dist/bundles/ui/compat-ui/compat-ui.js +59 -59
  39. package/dist/bundles/ui/compat-ui/index.js +8 -8
  40. package/dist/bundles/ui/compatibility-view/compatibility-view.d.ts +41 -41
  41. package/dist/bundles/ui/compatibility-view/compatibility-view.js +229 -229
  42. package/dist/bundles/ui/compatibility-view/index.js +8 -8
  43. package/dist/bundles/ui/control-panel/control-panel.d.ts +52 -52
  44. package/dist/bundles/ui/control-panel/control-panel.js +320 -320
  45. package/dist/bundles/ui/control-panel/index.js +8 -8
  46. package/dist/bundles/ui/index.d.ts +11 -11
  47. package/dist/bundles/ui/index.js +16 -16
  48. package/dist/bundles/ui/inspector/index.js +8 -8
  49. package/dist/bundles/ui/inspector/inspector.d.ts +97 -97
  50. package/dist/bundles/ui/inspector/inspector.js +394 -394
  51. package/dist/modules/core/constants.cjs +17 -17
  52. package/dist/modules/core/elements/compat-view-element.cjs +434 -434
  53. package/dist/modules/core/elements/control-panel-element.cjs +93 -93
  54. package/dist/modules/core/elements/index.cjs +11 -11
  55. package/dist/modules/core/elements/inspector-element.cjs +52 -52
  56. package/dist/modules/core/elements/recent-result-item.cjs +39 -39
  57. package/dist/modules/core/elements/results-history-item.cjs +39 -39
  58. package/dist/modules/core/elements/templates/compat-view.templates.cjs +458 -458
  59. package/dist/modules/core/elements/templates/control-panel.templates.cjs +332 -332
  60. package/dist/modules/core/elements/templates/root-styles.template.cjs +33 -33
  61. package/dist/modules/core/event-bus.cjs +43 -43
  62. package/dist/modules/core/helpers.cjs +41 -41
  63. package/dist/modules/core/index.cjs +16 -16
  64. package/dist/modules/core/state-service.cjs +74 -74
  65. package/dist/modules/core/ui-component.cjs +65 -65
  66. package/dist/modules/engine/engine.cjs +232 -232
  67. package/dist/modules/gen/browser-data.cjs +100 -100
  68. package/dist/modules/gen/browser-usage-data.cjs +675 -675
  69. package/dist/modules/gen/compat-data.cjs +31015 -31015
  70. package/dist/modules/gen/index.cjs +7 -7
  71. package/dist/modules/index.cjs +27 -27
  72. package/dist/modules/pkg/shinkore.cjs +459 -459
  73. package/dist/modules/pkg/shinkore_bg.wasm +0 -0
  74. package/dist/modules/shinkom.cjs +73 -73
  75. package/dist/modules/ui/compat-ui/compat-ui.cjs +53 -53
  76. package/dist/modules/ui/compat-ui/index.cjs +1 -1
  77. package/dist/modules/ui/compatibility-view/compatibility-view.cjs +223 -223
  78. package/dist/modules/ui/compatibility-view/index.cjs +1 -1
  79. package/dist/modules/ui/control-panel/control-panel.cjs +314 -314
  80. package/dist/modules/ui/control-panel/index.cjs +1 -1
  81. package/dist/modules/ui/index.cjs +13 -13
  82. package/dist/modules/ui/inspector/index.cjs +1 -1
  83. package/dist/modules/ui/inspector/inspector.cjs +388 -388
  84. package/package.json +1 -1
@@ -1,33 +1,33 @@
1
- //#region src/core/elements/templates/root-styles.template.js
2
- const hostStyles = `
3
- :host {
4
- --sk-primary: #050021;
5
- --sk-secondary: #1E0074;
6
- --sk-accent: #C9D1FF;
7
- --sk-hover-color: #03001a;
8
- --sk-background-variant-1: #191B1C;
9
- --sk-background-variant-2: #1E1E1E;
10
- --sk-background-variant-3: #0c0c0c;
11
-
12
- --sk-text-grey: #5f5f5f;
13
- --sk-results-blue-foreground: #3172ff;
14
- --sk-results-yellow-foreground: #ffe600;
15
- --sk-results-green-foreground: #40ff2f;
16
- --sk-results-red-foreground: #ff2b2b;
17
- --sk-indicator-green: #36ff46;
18
- --sk-indicator-yellow: #fafe09;
19
- --sk-indicator-red: #de291f;
20
- --sk-indicator-blue: #1b72e4;
21
-
22
- --sk-text-xs: 0.75rem;
23
- --sk-text-sm: 0.875rem;
24
- --sk-text-base: 1rem;
25
- --sk-text-md: 1.075rem;
26
- --sk-text-lg: 1.125rem;
27
- --sk-text-xl: 1.25rem;
28
- --sk-text-2xl: 1.5rem;
29
- --sk-text-3xl: 2rem;
30
- --sk-text-4xl: 3rem;
31
- }`;
32
- //#endregion
33
- exports.hostStyles = hostStyles;
1
+ //#region src/core/elements/templates/root-styles.template.js
2
+ const hostStyles = `
3
+ :host {
4
+ --sk-primary: #050021;
5
+ --sk-secondary: #1E0074;
6
+ --sk-accent: #C9D1FF;
7
+ --sk-hover-color: #03001a;
8
+ --sk-background-variant-1: #191B1C;
9
+ --sk-background-variant-2: #1E1E1E;
10
+ --sk-background-variant-3: #0c0c0c;
11
+
12
+ --sk-text-grey: #5f5f5f;
13
+ --sk-results-blue-foreground: #3172ff;
14
+ --sk-results-yellow-foreground: #ffe600;
15
+ --sk-results-green-foreground: #40ff2f;
16
+ --sk-results-red-foreground: #ff2b2b;
17
+ --sk-indicator-green: #36ff46;
18
+ --sk-indicator-yellow: #fafe09;
19
+ --sk-indicator-red: #de291f;
20
+ --sk-indicator-blue: #1b72e4;
21
+
22
+ --sk-text-xs: 0.75rem;
23
+ --sk-text-sm: 0.875rem;
24
+ --sk-text-base: 1rem;
25
+ --sk-text-md: 1.075rem;
26
+ --sk-text-lg: 1.125rem;
27
+ --sk-text-xl: 1.25rem;
28
+ --sk-text-2xl: 1.5rem;
29
+ --sk-text-3xl: 2rem;
30
+ --sk-text-4xl: 3rem;
31
+ }`;
32
+ //#endregion
33
+ exports.hostStyles = hostStyles;
@@ -1,43 +1,43 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/core/event-bus.js
3
- /**@typedef {import("../types/types").ShinkomEventTarget} ShinkomEventTarget */
4
- /**@typedef {import("../types/types").ShinkomEventMap} ShinkomEventMap */
5
- /**@typedef {import("../types/types").ShinkomEventListener<keyof ShinkomEventMap>} ShinkomEventListener */
6
- /**
7
- * ShinkomBus is the application event bus used to coordinate cross-cutting
8
- * actions across Shinkom UI components and the engine.
9
- *
10
- * It wraps a standard `EventTarget` and exposes a small typed API for
11
- * emitting custom events and subscribing to them with cleanup support.
12
- */
13
- var ShinkomBus = class {
14
- #customEventTarget = new EventTarget();
15
- /**
16
- * Emits an event to the event bus.
17
- *
18
- * @param {string} event
19
- * @param {object | undefined} detail
20
- */
21
- emit(event, detail = void 0) {
22
- this.#customEventTarget.dispatchEvent(new CustomEvent(event, detail));
23
- }
24
- /**
25
- * Registers a listener on the event bus.
26
- *
27
- * The returned cleanup function removes the listener so callers can stop
28
- * receiving events and avoid leaking handlers when the listener is no
29
- * longer needed.
30
- *
31
- * @param {keyof ShinkomEventMap} eventName
32
- * @param {Function} cb
33
- * @returns {() => void} cleanup function
34
- */
35
- on(eventName, cb) {
36
- /**@type {ShinkomEventListener} */
37
- const wrapper = (e) => cb(e.detail);
38
- this.#customEventTarget.addEventListener(eventName, wrapper);
39
- return () => this.#customEventTarget.removeEventListener(eventName, wrapper);
40
- }
41
- };
42
- //#endregion
43
- exports.ShinkomBus = ShinkomBus;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/core/event-bus.js
3
+ /**@typedef {import("../types/types").ShinkomEventTarget} ShinkomEventTarget */
4
+ /**@typedef {import("../types/types").ShinkomEventMap} ShinkomEventMap */
5
+ /**@typedef {import("../types/types").ShinkomEventListener<keyof ShinkomEventMap>} ShinkomEventListener */
6
+ /**
7
+ * ShinkomBus is the application event bus used to coordinate cross-cutting
8
+ * actions across Shinkom UI components and the engine.
9
+ *
10
+ * It wraps a standard `EventTarget` and exposes a small typed API for
11
+ * emitting custom events and subscribing to them with cleanup support.
12
+ */
13
+ var ShinkomBus = class {
14
+ #customEventTarget = new EventTarget();
15
+ /**
16
+ * Emits an event to the event bus.
17
+ *
18
+ * @param {string} event
19
+ * @param {object | undefined} detail
20
+ */
21
+ emit(event, detail = void 0) {
22
+ this.#customEventTarget.dispatchEvent(new CustomEvent(event, detail));
23
+ }
24
+ /**
25
+ * Registers a listener on the event bus.
26
+ *
27
+ * The returned cleanup function removes the listener so callers can stop
28
+ * receiving events and avoid leaking handlers when the listener is no
29
+ * longer needed.
30
+ *
31
+ * @param {keyof ShinkomEventMap} eventName
32
+ * @param {Function} cb
33
+ * @returns {() => void} cleanup function
34
+ */
35
+ on(eventName, cb) {
36
+ /**@type {ShinkomEventListener} */
37
+ const wrapper = (e) => cb(e.detail);
38
+ this.#customEventTarget.addEventListener(eventName, wrapper);
39
+ return () => this.#customEventTarget.removeEventListener(eventName, wrapper);
40
+ }
41
+ };
42
+ //#endregion
43
+ exports.ShinkomBus = ShinkomBus;
@@ -1,41 +1,41 @@
1
- //#region src/core/helpers.js
2
- /**
3
- * Get the resolved module path as a string or URL.
4
- * @param {string} modulePath
5
- * @returns {Promise<string | URL>} module path
6
- */
7
- const getModulePath = async (modulePath) => {
8
- const path = await import("node:url");
9
- const module = await import("node:module");
10
- try {
11
- return module.createRequire({}.url).resolve(modulePath);
12
- } catch (_error) {
13
- return path.pathToFileURL(require.resolve(modulePath));
14
- }
15
- };
16
- /**
17
- * Splits a version string into parts.
18
- * @param {string} version
19
- * @returns {number[]} version number in parts
20
- */
21
- function versionToParts(version) {
22
- return version.replace(/^v/, "").split(".").map(Number);
23
- }
24
- /**
25
- * Creates a CSSStyleSheet and applies styles to it.
26
- * @param {CSSStyleSheet | null} cache
27
- * @param {string} styles
28
- * @returns {CSSStyleSheet | null} A CSS stylesheet
29
- */
30
- function getStyleSheet(cache, styles) {
31
- if (typeof window === "undefined") return null;
32
- if (!cache) {
33
- cache = new CSSStyleSheet();
34
- cache.replaceSync(styles);
35
- }
36
- return cache;
37
- }
38
- //#endregion
39
- exports.getModulePath = getModulePath;
40
- exports.getStyleSheet = getStyleSheet;
41
- exports.versionToParts = versionToParts;
1
+ //#region src/core/helpers.js
2
+ /**
3
+ * Get the resolved module path as a string or URL.
4
+ * @param {string} modulePath
5
+ * @returns {Promise<string | URL>} module path
6
+ */
7
+ const getModulePath = async (modulePath) => {
8
+ const path = await import("node:url");
9
+ const module = await import("node:module");
10
+ try {
11
+ return module.createRequire({}.url).resolve(modulePath);
12
+ } catch (_error) {
13
+ return path.pathToFileURL(require.resolve(modulePath));
14
+ }
15
+ };
16
+ /**
17
+ * Splits a version string into parts.
18
+ * @param {string} version
19
+ * @returns {number[]} version number in parts
20
+ */
21
+ function versionToParts(version) {
22
+ return version.replace(/^v/, "").split(".").map(Number);
23
+ }
24
+ /**
25
+ * Creates a CSSStyleSheet and applies styles to it.
26
+ * @param {CSSStyleSheet | null} cache
27
+ * @param {string} styles
28
+ * @returns {CSSStyleSheet | null} A CSS stylesheet
29
+ */
30
+ function getStyleSheet(cache, styles) {
31
+ if (typeof window === "undefined") return null;
32
+ if (!cache) {
33
+ cache = new CSSStyleSheet();
34
+ cache.replaceSync(styles);
35
+ }
36
+ return cache;
37
+ }
38
+ //#endregion
39
+ exports.getModulePath = getModulePath;
40
+ exports.getStyleSheet = getStyleSheet;
41
+ exports.versionToParts = versionToParts;
@@ -1,16 +1,16 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_core_event_bus = require("./event-bus.cjs");
3
- const require_core_constants = require("./constants.cjs");
4
- const require_core_state_service = require("./state-service.cjs");
5
- const require_core_ui_component = require("./ui-component.cjs");
6
- const require_core_elements_compat_view_element = require("./elements/compat-view-element.cjs");
7
- const require_core_elements_control_panel_element = require("./elements/control-panel-element.cjs");
8
- const require_core_elements_inspector_element = require("./elements/inspector-element.cjs");
9
- require("./elements/index.cjs");
10
- exports.CompatControlPanelElement = require_core_elements_control_panel_element.CompatControlPanelElement;
11
- exports.CompatInspectorElement = require_core_elements_inspector_element.CompatInspectorElement;
12
- exports.CompatViewElement = require_core_elements_compat_view_element.CompatViewElement;
13
- exports.DEFAULT_STATE = require_core_constants.DEFAULT_STATE;
14
- exports.ShinkomBus = require_core_event_bus.ShinkomBus;
15
- exports.ShinkomState = require_core_state_service.ShinkomState;
16
- exports.UIComponent = require_core_ui_component.UIComponent;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_core_event_bus = require("./event-bus.cjs");
3
+ const require_core_constants = require("./constants.cjs");
4
+ const require_core_state_service = require("./state-service.cjs");
5
+ const require_core_ui_component = require("./ui-component.cjs");
6
+ const require_core_elements_compat_view_element = require("./elements/compat-view-element.cjs");
7
+ const require_core_elements_control_panel_element = require("./elements/control-panel-element.cjs");
8
+ const require_core_elements_inspector_element = require("./elements/inspector-element.cjs");
9
+ require("./elements/index.cjs");
10
+ exports.CompatControlPanelElement = require_core_elements_control_panel_element.CompatControlPanelElement;
11
+ exports.CompatInspectorElement = require_core_elements_inspector_element.CompatInspectorElement;
12
+ exports.CompatViewElement = require_core_elements_compat_view_element.CompatViewElement;
13
+ exports.DEFAULT_STATE = require_core_constants.DEFAULT_STATE;
14
+ exports.ShinkomBus = require_core_event_bus.ShinkomBus;
15
+ exports.ShinkomState = require_core_state_service.ShinkomState;
16
+ exports.UIComponent = require_core_ui_component.UIComponent;
@@ -1,74 +1,74 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_core_constants = require("./constants.cjs");
3
- //#region src/core/state-service.js
4
- /**@typedef {import('../types/public').UISharedState} UISharedState */
5
- /**@typedef {import('../types/public').UISharedStateProps} UISharedStateProps */
6
- /**
7
- * ShinkomState provides shared UI state management for the application.
8
- *
9
- * It wraps a proxied state object and notifies subscribed listeners whenever
10
- * a state property changes. Components can subscribe to update events and
11
- * access the reactive state through `getState()`.
12
- */
13
- var ShinkomState = class {
14
- /**@type {UISharedState}*/
15
- #state;
16
- /**@type {function[]} */
17
- #listeners = [];
18
- /**
19
- * Initializes the shared state service.
20
- *
21
- * The returned state object is proxied so that property assignments
22
- * automatically notify listeners when values change.
23
- *
24
- * @param {UISharedState} initalState
25
- */
26
- constructor(initalState = require_core_constants.DEFAULT_STATE) {
27
- const notify = (prop, val) => {
28
- this.#listeners.forEach((fn) => fn(prop, val));
29
- };
30
- this.#state = new Proxy(initalState, {
31
- get(obj, prop) {
32
- return obj[prop];
33
- },
34
- set(obj, prop, val) {
35
- if (obj[prop] === val) return true;
36
- notify(prop, val);
37
- /**@type {any} */ obj[prop] = val;
38
- console.log(`Setting ${prop} -> ${val}`);
39
- return true;
40
- }
41
- });
42
- }
43
- /**
44
- * @callback Listener
45
- * @param {UISharedStateProps} prop
46
- * @param {any} val
47
- */
48
- /**
49
- * Subscribes a listener to state change notifications.
50
- *
51
- * When any property on the shared state changes, the callback receives the
52
- * changed property and its new value.
53
- *
54
- * @param {Listener} callback
55
- * @returns {() => void} cleanup function
56
- */
57
- subscribe(callback) {
58
- this.#listeners.push(callback);
59
- return () => {
60
- this.#listeners = this.#listeners.filter((fn) => fn !== callback);
61
- };
62
- }
63
- /**
64
- * Returns the proxied shared state object.
65
- *
66
- * Callers can read and write state properties directly, and writes will
67
- * trigger listener notifications when values change.
68
- *
69
- * @returns {UISharedState}
70
- */
71
- getState = () => this.#state;
72
- };
73
- //#endregion
74
- exports.ShinkomState = ShinkomState;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_core_constants = require("./constants.cjs");
3
+ //#region src/core/state-service.js
4
+ /**@typedef {import('../types/public').UISharedState} UISharedState */
5
+ /**@typedef {import('../types/public').UISharedStateProps} UISharedStateProps */
6
+ /**
7
+ * ShinkomState provides shared UI state management for the application.
8
+ *
9
+ * It wraps a proxied state object and notifies subscribed listeners whenever
10
+ * a state property changes. Components can subscribe to update events and
11
+ * access the reactive state through `getState()`.
12
+ */
13
+ var ShinkomState = class {
14
+ /**@type {UISharedState}*/
15
+ #state;
16
+ /**@type {function[]} */
17
+ #listeners = [];
18
+ /**
19
+ * Initializes the shared state service.
20
+ *
21
+ * The returned state object is proxied so that property assignments
22
+ * automatically notify listeners when values change.
23
+ *
24
+ * @param {UISharedState} initalState
25
+ */
26
+ constructor(initalState = require_core_constants.DEFAULT_STATE) {
27
+ const notify = (prop, val) => {
28
+ this.#listeners.forEach((fn) => fn(prop, val));
29
+ };
30
+ this.#state = new Proxy(initalState, {
31
+ get(obj, prop) {
32
+ return obj[prop];
33
+ },
34
+ set(obj, prop, val) {
35
+ if (obj[prop] === val) return true;
36
+ notify(prop, val);
37
+ /**@type {any} */ obj[prop] = val;
38
+ console.log(`Setting ${prop} -> ${val}`);
39
+ return true;
40
+ }
41
+ });
42
+ }
43
+ /**
44
+ * @callback Listener
45
+ * @param {UISharedStateProps} prop
46
+ * @param {any} val
47
+ */
48
+ /**
49
+ * Subscribes a listener to state change notifications.
50
+ *
51
+ * When any property on the shared state changes, the callback receives the
52
+ * changed property and its new value.
53
+ *
54
+ * @param {Listener} callback
55
+ * @returns {() => void} cleanup function
56
+ */
57
+ subscribe(callback) {
58
+ this.#listeners.push(callback);
59
+ return () => {
60
+ this.#listeners = this.#listeners.filter((fn) => fn !== callback);
61
+ };
62
+ }
63
+ /**
64
+ * Returns the proxied shared state object.
65
+ *
66
+ * Callers can read and write state properties directly, and writes will
67
+ * trigger listener notifications when values change.
68
+ *
69
+ * @returns {UISharedState}
70
+ */
71
+ getState = () => this.#state;
72
+ };
73
+ //#endregion
74
+ exports.ShinkomState = ShinkomState;
@@ -1,65 +1,65 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/core/ui-component.js
3
- /**
4
- * Base UI component class for Shinkom UI modules.
5
- *
6
- * UIComponent is abstract and provides shared integration with the Shinkom
7
- * event bus and shared state service. Subclasses must implement lifecycle
8
- * methods for mounting, unmounting, binding state, and responding to state
9
- * changes.
10
- */
11
- var UIComponent = class UIComponent {
12
- /**
13
- * @param {ShinkomBus} bus
14
- * @param {ShinkomState} stateService
15
- */
16
- constructor(bus, stateService) {
17
- if (this.constructor === UIComponent) throw new Error("UIComponent is an abstract class and cannot be instantiated.");
18
- this.bus = bus;
19
- this.stateService = stateService;
20
- stateService.subscribe((prop, val) => {
21
- this.onStateChange(prop, val);
22
- });
23
- }
24
- /**
25
- * Mounts the component into the DOM.
26
- *
27
- * Subclasses must implement this method to create and attach their UI.
28
- */
29
- mount() {
30
- throw new Error("mount() method must be implemented.");
31
- }
32
- /**
33
- * Unmounts the component from the DOM.
34
- *
35
- * Subclasses must implement this method to remove their UI and cleanup.
36
- */
37
- unmount() {
38
- throw new Error("unmount() method must be implemented.");
39
- }
40
- /**
41
- * Binds shared UI state to the component instance.
42
- *
43
- * Implementations should store the bound state reference and apply any
44
- * initial state values needed by the component.
45
- *
46
- * @param {UISharedState} _state
47
- */
48
- bindState(_state) {
49
- throw new Error("bindState() method must be implemented.");
50
- }
51
- /**
52
- * Called when a shared state property changes.
53
- *
54
- * Components should override this to react to updates from the shared state
55
- * service.
56
- *
57
- * @param {UISharedStateProps} _prop
58
- * @param {any} _val
59
- */
60
- onStateChange(_prop, _val) {
61
- throw new Error("onStateChange() method must be implemented.");
62
- }
63
- };
64
- //#endregion
65
- exports.UIComponent = UIComponent;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/core/ui-component.js
3
+ /**
4
+ * Base UI component class for Shinkom UI modules.
5
+ *
6
+ * UIComponent is abstract and provides shared integration with the Shinkom
7
+ * event bus and shared state service. Subclasses must implement lifecycle
8
+ * methods for mounting, unmounting, binding state, and responding to state
9
+ * changes.
10
+ */
11
+ var UIComponent = class UIComponent {
12
+ /**
13
+ * @param {ShinkomBus} bus
14
+ * @param {ShinkomState} stateService
15
+ */
16
+ constructor(bus, stateService) {
17
+ if (this.constructor === UIComponent) throw new Error("UIComponent is an abstract class and cannot be instantiated.");
18
+ this.bus = bus;
19
+ this.stateService = stateService;
20
+ stateService.subscribe((prop, val) => {
21
+ this.onStateChange(prop, val);
22
+ });
23
+ }
24
+ /**
25
+ * Mounts the component into the DOM.
26
+ *
27
+ * Subclasses must implement this method to create and attach their UI.
28
+ */
29
+ mount() {
30
+ throw new Error("mount() method must be implemented.");
31
+ }
32
+ /**
33
+ * Unmounts the component from the DOM.
34
+ *
35
+ * Subclasses must implement this method to remove their UI and cleanup.
36
+ */
37
+ unmount() {
38
+ throw new Error("unmount() method must be implemented.");
39
+ }
40
+ /**
41
+ * Binds shared UI state to the component instance.
42
+ *
43
+ * Implementations should store the bound state reference and apply any
44
+ * initial state values needed by the component.
45
+ *
46
+ * @param {UISharedState} _state
47
+ */
48
+ bindState(_state) {
49
+ throw new Error("bindState() method must be implemented.");
50
+ }
51
+ /**
52
+ * Called when a shared state property changes.
53
+ *
54
+ * Components should override this to react to updates from the shared state
55
+ * service.
56
+ *
57
+ * @param {UISharedStateProps} _prop
58
+ * @param {any} _val
59
+ */
60
+ onStateChange(_prop, _val) {
61
+ throw new Error("onStateChange() method must be implemented.");
62
+ }
63
+ };
64
+ //#endregion
65
+ exports.UIComponent = UIComponent;