@chromahq/store 1.0.58 → 1.0.62
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.js +2 -13
- package/dist/index.es.js +2 -13
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -116,7 +116,7 @@ function useStoreReset(store) {
|
|
|
116
116
|
return store.reset;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
const STORE_ENABLE_LOGS = typeof globalThis !== "undefined" && globalThis.__CHROMA_ENABLE_LOGS__ ===
|
|
119
|
+
const STORE_ENABLE_LOGS = typeof globalThis !== "undefined" && globalThis.__CHROMA_ENABLE_LOGS__ === true;
|
|
120
120
|
class BridgeStore {
|
|
121
121
|
// Consider state stale after 30s hidden
|
|
122
122
|
constructor(bridge, initialState, storeName = "default", readyCallbacks = /* @__PURE__ */ new Set()) {
|
|
@@ -855,24 +855,14 @@ function autoRegisterStoreHandlers(store, storeName = "default") {
|
|
|
855
855
|
if (typeof store.setState !== "function") {
|
|
856
856
|
throw new Error("autoRegisterStoreHandlers: store must have setState method");
|
|
857
857
|
}
|
|
858
|
-
console.log(`[Store] Creating handlers for store "${storeName}"`, {
|
|
859
|
-
hasGetState: typeof store.getState === "function",
|
|
860
|
-
hasSetState: typeof store.setState === "function"
|
|
861
|
-
});
|
|
862
858
|
class AutoGetStoreStateMessage {
|
|
863
859
|
handle() {
|
|
864
|
-
console.log(`[Store] GetState handler called for "${storeName}"`);
|
|
865
860
|
if (!store) {
|
|
866
861
|
console.error(`[Store] Store instance not available for "${storeName}"`);
|
|
867
862
|
throw new Error("Store instance not available");
|
|
868
863
|
}
|
|
869
864
|
try {
|
|
870
|
-
|
|
871
|
-
console.log(`[Store] GetState returning state for "${storeName}"`, {
|
|
872
|
-
hasState: state !== void 0 && state !== null,
|
|
873
|
-
stateType: typeof state
|
|
874
|
-
});
|
|
875
|
-
return state;
|
|
865
|
+
return store.getState();
|
|
876
866
|
} catch (error) {
|
|
877
867
|
console.error(`[Store] GetState failed for "${storeName}":`, error);
|
|
878
868
|
throw error;
|
|
@@ -917,7 +907,6 @@ function autoRegisterStoreHandlers(store, storeName = "default") {
|
|
|
917
907
|
}
|
|
918
908
|
class AutoResetStoreMessage {
|
|
919
909
|
handle() {
|
|
920
|
-
console.log(`[Store] Reset handler called for "${storeName}"`);
|
|
921
910
|
if (!store) {
|
|
922
911
|
console.error(`[Store] Store instance not available for "${storeName}"`);
|
|
923
912
|
throw new Error("Store instance not available");
|
package/dist/index.es.js
CHANGED
|
@@ -96,7 +96,7 @@ function useStoreReset(store) {
|
|
|
96
96
|
return store.reset;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const STORE_ENABLE_LOGS = typeof globalThis !== "undefined" && globalThis.__CHROMA_ENABLE_LOGS__ ===
|
|
99
|
+
const STORE_ENABLE_LOGS = typeof globalThis !== "undefined" && globalThis.__CHROMA_ENABLE_LOGS__ === true;
|
|
100
100
|
class BridgeStore {
|
|
101
101
|
// Consider state stale after 30s hidden
|
|
102
102
|
constructor(bridge, initialState, storeName = "default", readyCallbacks = /* @__PURE__ */ new Set()) {
|
|
@@ -835,24 +835,14 @@ function autoRegisterStoreHandlers(store, storeName = "default") {
|
|
|
835
835
|
if (typeof store.setState !== "function") {
|
|
836
836
|
throw new Error("autoRegisterStoreHandlers: store must have setState method");
|
|
837
837
|
}
|
|
838
|
-
console.log(`[Store] Creating handlers for store "${storeName}"`, {
|
|
839
|
-
hasGetState: typeof store.getState === "function",
|
|
840
|
-
hasSetState: typeof store.setState === "function"
|
|
841
|
-
});
|
|
842
838
|
class AutoGetStoreStateMessage {
|
|
843
839
|
handle() {
|
|
844
|
-
console.log(`[Store] GetState handler called for "${storeName}"`);
|
|
845
840
|
if (!store) {
|
|
846
841
|
console.error(`[Store] Store instance not available for "${storeName}"`);
|
|
847
842
|
throw new Error("Store instance not available");
|
|
848
843
|
}
|
|
849
844
|
try {
|
|
850
|
-
|
|
851
|
-
console.log(`[Store] GetState returning state for "${storeName}"`, {
|
|
852
|
-
hasState: state !== void 0 && state !== null,
|
|
853
|
-
stateType: typeof state
|
|
854
|
-
});
|
|
855
|
-
return state;
|
|
845
|
+
return store.getState();
|
|
856
846
|
} catch (error) {
|
|
857
847
|
console.error(`[Store] GetState failed for "${storeName}":`, error);
|
|
858
848
|
throw error;
|
|
@@ -897,7 +887,6 @@ function autoRegisterStoreHandlers(store, storeName = "default") {
|
|
|
897
887
|
}
|
|
898
888
|
class AutoResetStoreMessage {
|
|
899
889
|
handle() {
|
|
900
|
-
console.log(`[Store] Reset handler called for "${storeName}"`);
|
|
901
890
|
if (!store) {
|
|
902
891
|
console.error(`[Store] Store instance not available for "${storeName}"`);
|
|
903
892
|
throw new Error("Store instance not available");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chromahq/store",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.62",
|
|
4
4
|
"description": "Centralized, persistent store for Chrome extensions using zustand, accessible from service workers and React, with chrome.storage.local persistence.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|