myio-js-library 0.1.86 → 0.1.89

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/dist/index.cjs CHANGED
@@ -1913,6 +1913,14 @@ init_template_card();
1913
1913
  // src/components/SelectionStore.js
1914
1914
  var MyIOSelectionStoreClass = class {
1915
1915
  constructor() {
1916
+ console.log("[SelectionStore] \u{1F50D} Constructor called - checking for existing instance...");
1917
+ console.log("[SelectionStore] typeof window:", typeof window);
1918
+ console.log("[SelectionStore] window.__MyIOSelectionStore_INSTANCE__:", !!window?.__MyIOSelectionStore_INSTANCE__);
1919
+ if (typeof window !== "undefined" && window.__MyIOSelectionStore_INSTANCE__) {
1920
+ console.warn("[SelectionStore] \u26A0\uFE0F Constructor called but instance already exists! Returning existing instance.");
1921
+ console.log("[SelectionStore] Existing instance has listeners:", window.__MyIOSelectionStore_INSTANCE__.eventListeners.get("selection:change")?.length || 0);
1922
+ return window.__MyIOSelectionStore_INSTANCE__;
1923
+ }
1916
1924
  console.log("[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
1917
1925
  console.trace("[SelectionStore] Constructor called from:");
1918
1926
  this.state = { selectedDevice: null };
@@ -1926,6 +1934,11 @@ var MyIOSelectionStoreClass = class {
1926
1934
  this.eventListeners.set("selection:totals", []);
1927
1935
  this.eventListeners.set("comparison:open", []);
1928
1936
  this.eventListeners.set("comparison:too_many", []);
1937
+ if (typeof window !== "undefined") {
1938
+ console.log("[SelectionStore] \u{1F4BE} Storing instance in window.__MyIOSelectionStore_INSTANCE__");
1939
+ window.__MyIOSelectionStore_INSTANCE__ = this;
1940
+ console.log("[SelectionStore] \u2705 Stored! Verify:", !!window.__MyIOSelectionStore_INSTANCE__);
1941
+ }
1929
1942
  }
1930
1943
  // Core Selection Methods
1931
1944
  add(id) {
@@ -2243,30 +2256,44 @@ var MyIOSelectionStoreClass = class {
2243
2256
  }
2244
2257
  };
2245
2258
  var MyIOSelectionStore;
2259
+ var _singletonInstance = null;
2246
2260
  if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
2247
- const descriptor = Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore");
2248
- if (descriptor && !descriptor.configurable) {
2249
- console.log("[SelectionStore] \u{1F504} REUSING locked global instance");
2250
- MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
2251
- } else if (globalThis.window.MyIOSelectionStore) {
2252
- console.log("[SelectionStore] \u{1F512} LOCKING existing instance");
2261
+ if (globalThis.window.__MyIOSelectionStore_INSTANCE__) {
2262
+ console.log("[SelectionStore] \u{1F504} REUSING constructor-created instance from __MyIOSelectionStore_INSTANCE__");
2263
+ _singletonInstance = globalThis.window.__MyIOSelectionStore_INSTANCE__;
2264
+ MyIOSelectionStore = _singletonInstance;
2265
+ } else if (Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore")?.get) {
2266
+ console.log("[SelectionStore] \u{1F504} REUSING protected global instance via getter");
2253
2267
  MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
2268
+ } else if (globalThis.window.MyIOSelectionStore && typeof globalThis.window.MyIOSelectionStore === "object") {
2269
+ console.log("[SelectionStore] \u{1F512} UPGRADING existing instance to protected");
2270
+ _singletonInstance = globalThis.window.MyIOSelectionStore;
2271
+ MyIOSelectionStore = _singletonInstance;
2254
2272
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
2255
- value: MyIOSelectionStore,
2256
- writable: false,
2273
+ get: function() {
2274
+ return _singletonInstance;
2275
+ },
2276
+ set: function(value) {
2277
+ console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2278
+ },
2257
2279
  configurable: false,
2258
2280
  enumerable: true
2259
2281
  });
2260
2282
  } else {
2261
- console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
2262
- MyIOSelectionStore = new MyIOSelectionStoreClass();
2283
+ console.log("[SelectionStore] \u{1F195} Creating new protected singleton instance");
2284
+ _singletonInstance = new MyIOSelectionStoreClass();
2285
+ MyIOSelectionStore = _singletonInstance;
2263
2286
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
2264
- value: MyIOSelectionStore,
2265
- writable: false,
2287
+ get: function() {
2288
+ return _singletonInstance;
2289
+ },
2290
+ set: function(value) {
2291
+ console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2292
+ },
2266
2293
  configurable: false,
2267
2294
  enumerable: true
2268
2295
  });
2269
- console.log("[SelectionStore] \u{1F512} Instance locked and ready");
2296
+ console.log("[SelectionStore] \u{1F512} Instance protected and ready");
2270
2297
  }
2271
2298
  if (!globalThis.window.MyIOSelectionStoreClass) {
2272
2299
  globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
package/dist/index.js CHANGED
@@ -1825,6 +1825,14 @@ init_template_card();
1825
1825
  // src/components/SelectionStore.js
1826
1826
  var MyIOSelectionStoreClass = class {
1827
1827
  constructor() {
1828
+ console.log("[SelectionStore] \u{1F50D} Constructor called - checking for existing instance...");
1829
+ console.log("[SelectionStore] typeof window:", typeof window);
1830
+ console.log("[SelectionStore] window.__MyIOSelectionStore_INSTANCE__:", !!window?.__MyIOSelectionStore_INSTANCE__);
1831
+ if (typeof window !== "undefined" && window.__MyIOSelectionStore_INSTANCE__) {
1832
+ console.warn("[SelectionStore] \u26A0\uFE0F Constructor called but instance already exists! Returning existing instance.");
1833
+ console.log("[SelectionStore] Existing instance has listeners:", window.__MyIOSelectionStore_INSTANCE__.eventListeners.get("selection:change")?.length || 0);
1834
+ return window.__MyIOSelectionStore_INSTANCE__;
1835
+ }
1828
1836
  console.log("[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
1829
1837
  console.trace("[SelectionStore] Constructor called from:");
1830
1838
  this.state = { selectedDevice: null };
@@ -1838,6 +1846,11 @@ var MyIOSelectionStoreClass = class {
1838
1846
  this.eventListeners.set("selection:totals", []);
1839
1847
  this.eventListeners.set("comparison:open", []);
1840
1848
  this.eventListeners.set("comparison:too_many", []);
1849
+ if (typeof window !== "undefined") {
1850
+ console.log("[SelectionStore] \u{1F4BE} Storing instance in window.__MyIOSelectionStore_INSTANCE__");
1851
+ window.__MyIOSelectionStore_INSTANCE__ = this;
1852
+ console.log("[SelectionStore] \u2705 Stored! Verify:", !!window.__MyIOSelectionStore_INSTANCE__);
1853
+ }
1841
1854
  }
1842
1855
  // Core Selection Methods
1843
1856
  add(id) {
@@ -2155,30 +2168,44 @@ var MyIOSelectionStoreClass = class {
2155
2168
  }
2156
2169
  };
2157
2170
  var MyIOSelectionStore;
2171
+ var _singletonInstance = null;
2158
2172
  if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
2159
- const descriptor = Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore");
2160
- if (descriptor && !descriptor.configurable) {
2161
- console.log("[SelectionStore] \u{1F504} REUSING locked global instance");
2162
- MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
2163
- } else if (globalThis.window.MyIOSelectionStore) {
2164
- console.log("[SelectionStore] \u{1F512} LOCKING existing instance");
2173
+ if (globalThis.window.__MyIOSelectionStore_INSTANCE__) {
2174
+ console.log("[SelectionStore] \u{1F504} REUSING constructor-created instance from __MyIOSelectionStore_INSTANCE__");
2175
+ _singletonInstance = globalThis.window.__MyIOSelectionStore_INSTANCE__;
2176
+ MyIOSelectionStore = _singletonInstance;
2177
+ } else if (Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore")?.get) {
2178
+ console.log("[SelectionStore] \u{1F504} REUSING protected global instance via getter");
2165
2179
  MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
2180
+ } else if (globalThis.window.MyIOSelectionStore && typeof globalThis.window.MyIOSelectionStore === "object") {
2181
+ console.log("[SelectionStore] \u{1F512} UPGRADING existing instance to protected");
2182
+ _singletonInstance = globalThis.window.MyIOSelectionStore;
2183
+ MyIOSelectionStore = _singletonInstance;
2166
2184
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
2167
- value: MyIOSelectionStore,
2168
- writable: false,
2185
+ get: function() {
2186
+ return _singletonInstance;
2187
+ },
2188
+ set: function(value) {
2189
+ console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2190
+ },
2169
2191
  configurable: false,
2170
2192
  enumerable: true
2171
2193
  });
2172
2194
  } else {
2173
- console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
2174
- MyIOSelectionStore = new MyIOSelectionStoreClass();
2195
+ console.log("[SelectionStore] \u{1F195} Creating new protected singleton instance");
2196
+ _singletonInstance = new MyIOSelectionStoreClass();
2197
+ MyIOSelectionStore = _singletonInstance;
2175
2198
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
2176
- value: MyIOSelectionStore,
2177
- writable: false,
2199
+ get: function() {
2200
+ return _singletonInstance;
2201
+ },
2202
+ set: function(value) {
2203
+ console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2204
+ },
2178
2205
  configurable: false,
2179
2206
  enumerable: true
2180
2207
  });
2181
- console.log("[SelectionStore] \u{1F512} Instance locked and ready");
2208
+ console.log("[SelectionStore] \u{1F512} Instance protected and ready");
2182
2209
  }
2183
2210
  if (!globalThis.window.MyIOSelectionStoreClass) {
2184
2211
  globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
@@ -1831,6 +1831,14 @@
1831
1831
  // src/components/SelectionStore.js
1832
1832
  var MyIOSelectionStoreClass = class {
1833
1833
  constructor() {
1834
+ console.log("[SelectionStore] \u{1F50D} Constructor called - checking for existing instance...");
1835
+ console.log("[SelectionStore] typeof window:", typeof window);
1836
+ console.log("[SelectionStore] window.__MyIOSelectionStore_INSTANCE__:", !!window?.__MyIOSelectionStore_INSTANCE__);
1837
+ if (typeof window !== "undefined" && window.__MyIOSelectionStore_INSTANCE__) {
1838
+ console.warn("[SelectionStore] \u26A0\uFE0F Constructor called but instance already exists! Returning existing instance.");
1839
+ console.log("[SelectionStore] Existing instance has listeners:", window.__MyIOSelectionStore_INSTANCE__.eventListeners.get("selection:change")?.length || 0);
1840
+ return window.__MyIOSelectionStore_INSTANCE__;
1841
+ }
1834
1842
  console.log("[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
1835
1843
  console.trace("[SelectionStore] Constructor called from:");
1836
1844
  this.state = { selectedDevice: null };
@@ -1844,6 +1852,11 @@
1844
1852
  this.eventListeners.set("selection:totals", []);
1845
1853
  this.eventListeners.set("comparison:open", []);
1846
1854
  this.eventListeners.set("comparison:too_many", []);
1855
+ if (typeof window !== "undefined") {
1856
+ console.log("[SelectionStore] \u{1F4BE} Storing instance in window.__MyIOSelectionStore_INSTANCE__");
1857
+ window.__MyIOSelectionStore_INSTANCE__ = this;
1858
+ console.log("[SelectionStore] \u2705 Stored! Verify:", !!window.__MyIOSelectionStore_INSTANCE__);
1859
+ }
1847
1860
  }
1848
1861
  // Core Selection Methods
1849
1862
  add(id) {
@@ -2161,30 +2174,44 @@
2161
2174
  }
2162
2175
  };
2163
2176
  exports.MyIOSelectionStore = void 0;
2177
+ var _singletonInstance = null;
2164
2178
  if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
2165
- const descriptor = Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore");
2166
- if (descriptor && !descriptor.configurable) {
2167
- console.log("[SelectionStore] \u{1F504} REUSING locked global instance");
2168
- exports.MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
2169
- } else if (globalThis.window.MyIOSelectionStore) {
2170
- console.log("[SelectionStore] \u{1F512} LOCKING existing instance");
2179
+ if (globalThis.window.__MyIOSelectionStore_INSTANCE__) {
2180
+ console.log("[SelectionStore] \u{1F504} REUSING constructor-created instance from __MyIOSelectionStore_INSTANCE__");
2181
+ _singletonInstance = globalThis.window.__MyIOSelectionStore_INSTANCE__;
2182
+ exports.MyIOSelectionStore = _singletonInstance;
2183
+ } else if (Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore")?.get) {
2184
+ console.log("[SelectionStore] \u{1F504} REUSING protected global instance via getter");
2171
2185
  exports.MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
2186
+ } else if (globalThis.window.MyIOSelectionStore && typeof globalThis.window.MyIOSelectionStore === "object") {
2187
+ console.log("[SelectionStore] \u{1F512} UPGRADING existing instance to protected");
2188
+ _singletonInstance = globalThis.window.MyIOSelectionStore;
2189
+ exports.MyIOSelectionStore = _singletonInstance;
2172
2190
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
2173
- value: exports.MyIOSelectionStore,
2174
- writable: false,
2191
+ get: function() {
2192
+ return _singletonInstance;
2193
+ },
2194
+ set: function(value) {
2195
+ console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2196
+ },
2175
2197
  configurable: false,
2176
2198
  enumerable: true
2177
2199
  });
2178
2200
  } else {
2179
- console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
2180
- exports.MyIOSelectionStore = new MyIOSelectionStoreClass();
2201
+ console.log("[SelectionStore] \u{1F195} Creating new protected singleton instance");
2202
+ _singletonInstance = new MyIOSelectionStoreClass();
2203
+ exports.MyIOSelectionStore = _singletonInstance;
2181
2204
  Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
2182
- value: exports.MyIOSelectionStore,
2183
- writable: false,
2205
+ get: function() {
2206
+ return _singletonInstance;
2207
+ },
2208
+ set: function(value) {
2209
+ console.warn("[SelectionStore] \u26A0\uFE0F Attempted to overwrite singleton - ignoring");
2210
+ },
2184
2211
  configurable: false,
2185
2212
  enumerable: true
2186
2213
  });
2187
- console.log("[SelectionStore] \u{1F512} Instance locked and ready");
2214
+ console.log("[SelectionStore] \u{1F512} Instance protected and ready");
2188
2215
  }
2189
2216
  if (!globalThis.window.MyIOSelectionStoreClass) {
2190
2217
  globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;