@bquery/bquery 1.4.0 → 1.5.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 (127) hide show
  1. package/README.md +139 -120
  2. package/dist/component/component.d.ts.map +1 -1
  3. package/dist/component/index.d.ts +2 -0
  4. package/dist/component/index.d.ts.map +1 -1
  5. package/dist/component/library.d.ts +34 -0
  6. package/dist/component/library.d.ts.map +1 -0
  7. package/dist/component/types.d.ts +10 -6
  8. package/dist/component/types.d.ts.map +1 -1
  9. package/dist/component-CY5MVoYN.js +531 -0
  10. package/dist/component-CY5MVoYN.js.map +1 -0
  11. package/dist/component.es.mjs +6 -184
  12. package/dist/config-DRmZZno3.js +40 -0
  13. package/dist/config-DRmZZno3.js.map +1 -0
  14. package/dist/core-CK2Mfpf4.js +648 -0
  15. package/dist/core-CK2Mfpf4.js.map +1 -0
  16. package/dist/core-DPdbItcq.js +112 -0
  17. package/dist/core-DPdbItcq.js.map +1 -0
  18. package/dist/core.es.mjs +45 -1261
  19. package/dist/full.d.ts +6 -6
  20. package/dist/full.d.ts.map +1 -1
  21. package/dist/full.es.mjs +98 -92
  22. package/dist/full.iife.js +173 -3
  23. package/dist/full.iife.js.map +1 -1
  24. package/dist/full.umd.js +173 -3
  25. package/dist/full.umd.js.map +1 -1
  26. package/dist/index.es.mjs +143 -139
  27. package/dist/motion/transition.d.ts +1 -1
  28. package/dist/motion/transition.d.ts.map +1 -1
  29. package/dist/motion/types.d.ts +11 -1
  30. package/dist/motion/types.d.ts.map +1 -1
  31. package/dist/motion-C5DRdPnO.js +415 -0
  32. package/dist/motion-C5DRdPnO.js.map +1 -0
  33. package/dist/motion.es.mjs +25 -361
  34. package/dist/object-qGpWr6-J.js +38 -0
  35. package/dist/object-qGpWr6-J.js.map +1 -0
  36. package/dist/platform/announcer.d.ts +59 -0
  37. package/dist/platform/announcer.d.ts.map +1 -0
  38. package/dist/platform/config.d.ts +92 -0
  39. package/dist/platform/config.d.ts.map +1 -0
  40. package/dist/platform/cookies.d.ts +45 -0
  41. package/dist/platform/cookies.d.ts.map +1 -0
  42. package/dist/platform/index.d.ts +8 -0
  43. package/dist/platform/index.d.ts.map +1 -1
  44. package/dist/platform/meta.d.ts +62 -0
  45. package/dist/platform/meta.d.ts.map +1 -0
  46. package/dist/platform-B7JhGBc7.js +361 -0
  47. package/dist/platform-B7JhGBc7.js.map +1 -0
  48. package/dist/platform.es.mjs +11 -248
  49. package/dist/reactive/async-data.d.ts +114 -0
  50. package/dist/reactive/async-data.d.ts.map +1 -0
  51. package/dist/reactive/index.d.ts +2 -2
  52. package/dist/reactive/index.d.ts.map +1 -1
  53. package/dist/reactive/signal.d.ts +2 -0
  54. package/dist/reactive/signal.d.ts.map +1 -1
  55. package/dist/reactive-BDya-ia8.js +253 -0
  56. package/dist/reactive-BDya-ia8.js.map +1 -0
  57. package/dist/reactive.es.mjs +18 -34
  58. package/dist/router-CijiICxt.js +188 -0
  59. package/dist/router-CijiICxt.js.map +1 -0
  60. package/dist/router.es.mjs +11 -200
  61. package/dist/sanitize-jyJ2ryE2.js +302 -0
  62. package/dist/sanitize-jyJ2ryE2.js.map +1 -0
  63. package/dist/security/constants.d.ts.map +1 -1
  64. package/dist/security.es.mjs +10 -56
  65. package/dist/store-CPK9E62U.js +262 -0
  66. package/dist/store-CPK9E62U.js.map +1 -0
  67. package/dist/store.es.mjs +12 -25
  68. package/dist/view-Cdi0g-qo.js +396 -0
  69. package/dist/view-Cdi0g-qo.js.map +1 -0
  70. package/dist/view.es.mjs +10 -430
  71. package/package.json +15 -11
  72. package/src/component/component.ts +319 -289
  73. package/src/component/index.ts +42 -40
  74. package/src/component/library.ts +504 -0
  75. package/src/component/types.ts +91 -85
  76. package/src/core/collection.ts +628 -628
  77. package/src/core/element.ts +774 -774
  78. package/src/core/index.ts +48 -48
  79. package/src/core/utils/function.ts +151 -151
  80. package/src/full.ts +223 -187
  81. package/src/motion/animate.ts +113 -113
  82. package/src/motion/flip.ts +176 -176
  83. package/src/motion/scroll.ts +57 -57
  84. package/src/motion/spring.ts +150 -150
  85. package/src/motion/timeline.ts +246 -246
  86. package/src/motion/transition.ts +53 -7
  87. package/src/motion/types.ts +208 -198
  88. package/src/platform/announcer.ts +208 -0
  89. package/src/platform/config.ts +163 -0
  90. package/src/platform/cookies.ts +165 -0
  91. package/src/platform/index.ts +39 -18
  92. package/src/platform/meta.ts +168 -0
  93. package/src/platform/storage.ts +215 -215
  94. package/src/reactive/async-data.ts +486 -0
  95. package/src/reactive/core.ts +114 -114
  96. package/src/reactive/effect.ts +54 -54
  97. package/src/reactive/index.ts +37 -23
  98. package/src/reactive/internals.ts +122 -122
  99. package/src/reactive/signal.ts +29 -20
  100. package/src/security/constants.ts +211 -209
  101. package/src/security/sanitize-core.ts +364 -364
  102. package/src/view/evaluate.ts +290 -290
  103. package/dist/batch-x7b2eZST.js +0 -13
  104. package/dist/batch-x7b2eZST.js.map +0 -1
  105. package/dist/component.es.mjs.map +0 -1
  106. package/dist/core-BhpuvPhy.js +0 -170
  107. package/dist/core-BhpuvPhy.js.map +0 -1
  108. package/dist/core.es.mjs.map +0 -1
  109. package/dist/full.es.mjs.map +0 -1
  110. package/dist/index.es.mjs.map +0 -1
  111. package/dist/motion.es.mjs.map +0 -1
  112. package/dist/persisted-DHoi3uEs.js +0 -278
  113. package/dist/persisted-DHoi3uEs.js.map +0 -1
  114. package/dist/platform.es.mjs.map +0 -1
  115. package/dist/reactive.es.mjs.map +0 -1
  116. package/dist/router.es.mjs.map +0 -1
  117. package/dist/sanitize-Cxvxa-DX.js +0 -283
  118. package/dist/sanitize-Cxvxa-DX.js.map +0 -1
  119. package/dist/security.es.mjs.map +0 -1
  120. package/dist/store.es.mjs.map +0 -1
  121. package/dist/type-guards-BdKlYYlS.js +0 -32
  122. package/dist/type-guards-BdKlYYlS.js.map +0 -1
  123. package/dist/untrack-DNnnqdlR.js +0 -6
  124. package/dist/untrack-DNnnqdlR.js.map +0 -1
  125. package/dist/view.es.mjs.map +0 -1
  126. package/dist/watch-DXXv3iAI.js +0 -58
  127. package/dist/watch-DXXv3iAI.js.map +0 -1
@@ -0,0 +1,262 @@
1
+ import { n as $ } from "./core-DPdbItcq.js";
2
+ import { f as x, p as S, u as T } from "./reactive-BDya-ia8.js";
3
+ var R = () => {
4
+ if (!(typeof window > "u"))
5
+ return window.__BQUERY_DEVTOOLS__ || (window.__BQUERY_DEVTOOLS__ = { stores: /* @__PURE__ */ new Map() }), window.__BQUERY_DEVTOOLS__;
6
+ }, V = (e, t) => {
7
+ const r = R();
8
+ r && (r.stores.set(e, t), r.onStoreCreated?.(e, t));
9
+ }, B = (e) => {
10
+ typeof window > "u" || !window.__BQUERY_DEVTOOLS__ || window.__BQUERY_DEVTOOLS__.stores.delete(e);
11
+ }, M = (e, t) => {
12
+ typeof window > "u" || window.__BQUERY_DEVTOOLS__?.onStateChange?.(e, t);
13
+ }, j = [], Y = (e) => {
14
+ j.push(e);
15
+ }, Q = (e, t) => {
16
+ for (const r of j) {
17
+ const a = r({
18
+ store: e,
19
+ options: t
20
+ });
21
+ a && Object.assign(e, a);
22
+ }
23
+ }, h = /* @__PURE__ */ new Map(), A = (e) => h.has(e), N = (e, t) => {
24
+ h.set(e, t);
25
+ }, E = (e) => h.get(e), q = () => Array.from(h.keys()), z = (e) => {
26
+ h.delete(e), B(e);
27
+ }, D = (e) => e !== null && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype, v = (e) => {
28
+ if (e === null || typeof e != "object") return e;
29
+ if (Array.isArray(e)) return e.map(v);
30
+ if (e instanceof Date) return new Date(e.getTime());
31
+ if (e instanceof Map) return new Map(Array.from(e.entries()).map(([r, a]) => [r, v(a)]));
32
+ if (e instanceof Set) return new Set(Array.from(e).map(v));
33
+ const t = {};
34
+ for (const r of Object.keys(e)) t[r] = v(e[r]);
35
+ return t;
36
+ }, w = (e, t) => {
37
+ if (e === t) return !0;
38
+ if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
39
+ if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
40
+ if (e instanceof Map && t instanceof Map) {
41
+ if (e.size !== t.size) return !1;
42
+ for (const [i, f] of e.entries()) if (!t.has(i) || !w(f, t.get(i))) return !1;
43
+ return !0;
44
+ }
45
+ if (e instanceof Set && t instanceof Set) {
46
+ if (e.size !== t.size) return !1;
47
+ for (const i of e.values()) {
48
+ let f = !1;
49
+ for (const n of t.values()) if (w(i, n)) {
50
+ f = !0;
51
+ break;
52
+ }
53
+ if (!f) return !1;
54
+ }
55
+ return !0;
56
+ }
57
+ if (Array.isArray(e) && Array.isArray(t))
58
+ return e.length !== t.length ? !1 : e.every((i, f) => w(i, t[f]));
59
+ if (Array.isArray(e) !== Array.isArray(t)) return !1;
60
+ const r = Object.keys(e), a = Object.keys(t);
61
+ return r.length !== a.length ? !1 : r.every((i) => w(e[i], t[i]));
62
+ }, U = (e, t, r) => {
63
+ const a = [];
64
+ for (const i of Object.keys(t)) {
65
+ const f = e[i], n = t[i];
66
+ r.get(i) === n && D(f) && D(n) && !w(f, n) && a.push(i);
67
+ }
68
+ return a;
69
+ }, _ = (() => {
70
+ try {
71
+ const e = globalThis.process;
72
+ return !(typeof e < "u" && e.env?.NODE_ENV === "production");
73
+ } catch {
74
+ return !0;
75
+ }
76
+ })(), P = (e) => {
77
+ const { id: t, state: r, getters: a = {}, actions: i = {} } = e;
78
+ if (A(t))
79
+ return console.warn(`bQuery store: Store "${t}" already exists. Returning existing instance.`), E(t);
80
+ const f = r(), n = /* @__PURE__ */ new Map();
81
+ for (const s of Object.keys(f)) n.set(s, $(f[s]));
82
+ const y = [], p = () => T(() => ({ ...b })), m = () => {
83
+ const s = typeof window < "u" && typeof window.__BQUERY_DEVTOOLS__?.onStateChange == "function";
84
+ if (y.length === 0 && !s) return;
85
+ const o = p();
86
+ for (const u of y) u(o);
87
+ M(t, o);
88
+ }, b = new Proxy({}, {
89
+ get: (s, o) => {
90
+ const u = o;
91
+ if (n.has(u)) return n.get(u).value;
92
+ },
93
+ ownKeys: () => Array.from(n.keys()),
94
+ getOwnPropertyDescriptor: (s, o) => {
95
+ if (n.has(o)) return {
96
+ enumerable: !0,
97
+ configurable: !0
98
+ };
99
+ },
100
+ has: (s, o) => n.has(o)
101
+ }), O = /* @__PURE__ */ new Map(), g = {};
102
+ for (const s of Object.keys(f)) Object.defineProperty(g, s, {
103
+ get: () => n.get(s).value,
104
+ set: (o) => {
105
+ n.get(s).value = o, m();
106
+ },
107
+ enumerable: !0,
108
+ configurable: !1
109
+ });
110
+ for (const s of Object.keys(a)) {
111
+ const o = a[s], u = x(() => o(b, new Proxy({}, { get: (d, l) => {
112
+ const c = l;
113
+ if (O.has(c)) return O.get(c).value;
114
+ } })));
115
+ O.set(s, u), Object.defineProperty(g, s, {
116
+ get: () => u.value,
117
+ enumerable: !0,
118
+ configurable: !1
119
+ });
120
+ }
121
+ for (const s of Object.keys(i)) {
122
+ const o = i[s];
123
+ g[s] = function(...u) {
124
+ const d = new Proxy(g, {
125
+ get: (l, c) => typeof c == "string" && n.has(c) ? n.get(c).value : l[c],
126
+ set: (l, c, k) => typeof c == "string" && n.has(c) ? (n.get(c).value = k, m(), !0) : Reflect.set(l, c, k)
127
+ });
128
+ return o.apply(d, u);
129
+ };
130
+ }
131
+ return Object.defineProperties(g, {
132
+ $id: {
133
+ value: t,
134
+ writable: !1,
135
+ enumerable: !1
136
+ },
137
+ $reset: {
138
+ value: () => {
139
+ const s = r();
140
+ S(() => {
141
+ for (const [o, u] of n) u.value = s[o];
142
+ }), m();
143
+ },
144
+ writable: !1,
145
+ enumerable: !1
146
+ },
147
+ $subscribe: {
148
+ value: (s) => (y.push(s), () => {
149
+ const o = y.indexOf(s);
150
+ o > -1 && y.splice(o, 1);
151
+ }),
152
+ writable: !1,
153
+ enumerable: !1
154
+ },
155
+ $patch: {
156
+ value: (s) => {
157
+ S(() => {
158
+ if (typeof s == "function") {
159
+ const o = _ ? v(p()) : null, u = _ ? new Map(Array.from(n.entries()).map(([l, c]) => [l, c.value])) : null, d = p();
160
+ if (s(d), _ && o && u) {
161
+ const l = U(o, d, u);
162
+ l.length > 0 && console.warn(`[bQuery store "${t}"] Nested mutation detected in $patch() for keys: ${l.map(String).join(", ")}.
163
+ Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.
164
+ To fix this, either:
165
+ 1. Replace the entire object: state.user = { ...state.user, name: "New" }
166
+ 2. Use $patchDeep() for automatic deep cloning
167
+ See: https://bquery.dev/guide/store#deep-reactivity`);
168
+ }
169
+ for (const [l, c] of Object.entries(d)) n.has(l) && (n.get(l).value = c);
170
+ } else for (const [o, u] of Object.entries(s)) n.has(o) && (n.get(o).value = u);
171
+ }), m();
172
+ },
173
+ writable: !1,
174
+ enumerable: !1
175
+ },
176
+ $patchDeep: {
177
+ value: (s) => {
178
+ S(() => {
179
+ if (typeof s == "function") {
180
+ const o = v(p());
181
+ s(o);
182
+ for (const [u, d] of Object.entries(o)) n.has(u) && (n.get(u).value = d);
183
+ } else for (const [o, u] of Object.entries(s)) n.has(o) && (n.get(o).value = v(u));
184
+ }), m();
185
+ },
186
+ writable: !1,
187
+ enumerable: !1
188
+ },
189
+ $state: {
190
+ get: () => p(),
191
+ enumerable: !1
192
+ }
193
+ }), N(t, g), Q(g, e), V(t, g), g;
194
+ }, F = (e, t) => () => A(e) ? E(e) : P({
195
+ id: e,
196
+ ...t
197
+ }), K = (e, t) => {
198
+ const r = {};
199
+ for (const a of t) Object.defineProperty(r, a, {
200
+ get: () => e[a],
201
+ enumerable: !0
202
+ });
203
+ return r;
204
+ }, G = (e, t) => {
205
+ const r = {};
206
+ for (const a of t) Object.defineProperty(r, a, {
207
+ get: () => e[a],
208
+ enumerable: !0
209
+ });
210
+ return r;
211
+ }, I = (e, t) => {
212
+ const r = {};
213
+ for (const a of t) r[a] = (...i) => e[a](...i);
214
+ return r;
215
+ }, J = (e, t) => {
216
+ const r = t ?? `bquery-store-${e.id}`, a = e.state, i = P({
217
+ ...e,
218
+ state: () => {
219
+ const f = a();
220
+ if (typeof window < "u") try {
221
+ const n = localStorage.getItem(r);
222
+ if (n) return {
223
+ ...f,
224
+ ...JSON.parse(n)
225
+ };
226
+ } catch {
227
+ }
228
+ return f;
229
+ }
230
+ });
231
+ return i.$subscribe((f) => {
232
+ if (typeof window < "u") try {
233
+ localStorage.setItem(r, JSON.stringify(f));
234
+ } catch {
235
+ }
236
+ }), i;
237
+ }, H = (e, t, r, a = {}) => {
238
+ const i = a.equals ?? (a.deep ? w : Object.is);
239
+ let f = t(e.$state);
240
+ return a.immediate && r(f, void 0), e.$subscribe((n) => {
241
+ const y = t(n);
242
+ if (!i(y, f)) {
243
+ const p = f;
244
+ f = y, r(y, p);
245
+ }
246
+ });
247
+ };
248
+ export {
249
+ K as a,
250
+ z as c,
251
+ Y as d,
252
+ G as i,
253
+ E as l,
254
+ J as n,
255
+ F as o,
256
+ I as r,
257
+ P as s,
258
+ H as t,
259
+ q as u
260
+ };
261
+
262
+ //# sourceMappingURL=store-CPK9E62U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-CPK9E62U.js","names":[],"sources":["../src/store/devtools.ts","../src/store/plugins.ts","../src/store/registry.ts","../src/store/utils.ts","../src/store/create-store.ts","../src/store/define-store.ts","../src/store/mapping.ts","../src/store/persisted.ts","../src/store/watch.ts"],"sourcesContent":["/**\n * Devtools integration for stores.\n * @internal\n */\n\ndeclare global {\n interface Window {\n __BQUERY_DEVTOOLS__?: {\n stores: Map<string, unknown>;\n onStoreCreated?: (id: string, store: unknown) => void;\n onStateChange?: (id: string, state: unknown) => void;\n };\n }\n}\n\nexport type DevtoolsHook = {\n stores: Map<string, unknown>;\n onStoreCreated?: (id: string, store: unknown) => void;\n onStateChange?: (id: string, state: unknown) => void;\n};\n\nconst ensureDevtools = (): DevtoolsHook | undefined => {\n if (typeof window === 'undefined') return undefined;\n if (!window.__BQUERY_DEVTOOLS__) {\n window.__BQUERY_DEVTOOLS__ = { stores: new Map() };\n }\n return window.__BQUERY_DEVTOOLS__;\n};\n\nexport const registerDevtoolsStore = (id: string, store: unknown): void => {\n const devtools = ensureDevtools();\n if (!devtools) return;\n devtools.stores.set(id, store);\n devtools.onStoreCreated?.(id, store);\n};\n\nexport const unregisterDevtoolsStore = (id: string): void => {\n if (typeof window === 'undefined' || !window.__BQUERY_DEVTOOLS__) return;\n window.__BQUERY_DEVTOOLS__.stores.delete(id);\n};\n\nexport const notifyDevtoolsStateChange = (id: string, state: unknown): void => {\n if (typeof window === 'undefined') return;\n window.__BQUERY_DEVTOOLS__?.onStateChange?.(id, state);\n};\n","/**\n * Store plugins API.\n */\n\nimport type { Store, StoreDefinition, StorePlugin } from './types';\n\n/** @internal Registered plugins */\nconst plugins: StorePlugin[] = [];\n\n/**\n * Registers a plugin that extends all stores.\n *\n * @param plugin - The plugin function\n */\nexport const registerPlugin = (plugin: StorePlugin): void => {\n plugins.push(plugin);\n};\n\n/** @internal */\nexport const applyPlugins = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n store: Store<any, any, any>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n options: StoreDefinition<any, any, any>\n): void => {\n for (const plugin of plugins) {\n const extension = plugin({ store, options });\n if (extension) {\n Object.assign(store, extension);\n }\n }\n};\n","/**\n * Store registry utilities.\n */\n\nimport { unregisterDevtoolsStore } from './devtools';\nimport type { Store } from './types';\n\n/** @internal Registry of all stores for devtools */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst storeRegistry = new Map<string, Store<any, any, any>>();\n\n/** @internal */\nexport const hasStore = (id: string): boolean => storeRegistry.has(id);\n\n/** @internal */\nexport const registerStore = (\n id: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n store: Store<any, any, any>\n): void => {\n storeRegistry.set(id, store);\n};\n\n/**\n * Retrieves an existing store by its ID.\n *\n * @param id - The store identifier\n * @returns The store instance or undefined if not found\n */\nexport const getStore = <T = unknown>(id: string): T | undefined => {\n return storeRegistry.get(id) as T | undefined;\n};\n\n/**\n * Lists all registered store IDs.\n *\n * @returns Array of store IDs\n */\nexport const listStores = (): string[] => {\n return Array.from(storeRegistry.keys());\n};\n\n/**\n * Removes a store from the registry.\n *\n * @param id - The store identifier\n */\nexport const destroyStore = (id: string): void => {\n storeRegistry.delete(id);\n unregisterDevtoolsStore(id);\n};\n","/**\n * Internal utilities for the store module.\n * @internal\n */\n\n/**\n * Check if a value is a plain object (not array, null, Date, etc.).\n * @internal\n */\nexport const isPlainObject = (value: unknown): value is Record<string, unknown> => {\n return (\n value !== null && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype\n );\n};\n\n/**\n * Deep clones an object. Used for deep reactivity support.\n * @internal\n */\nexport const deepClone = <T>(obj: T): T => {\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(deepClone) as T;\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as T;\n }\n\n if (obj instanceof Map) {\n return new Map(Array.from(obj.entries()).map(([k, v]) => [k, deepClone(v)])) as T;\n }\n\n if (obj instanceof Set) {\n return new Set(Array.from(obj).map(deepClone)) as T;\n }\n\n const cloned = {} as T;\n for (const key of Object.keys(obj)) {\n (cloned as Record<string, unknown>)[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return cloned;\n};\n\n/**\n * Compares two values for deep equality.\n * @internal\n */\nexport const deepEqual = (a: unknown, b: unknown): boolean => {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false;\n for (const [key, value] of a.entries()) {\n if (!b.has(key) || !deepEqual(value, b.get(key))) return false;\n }\n return true;\n }\n\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false;\n for (const value of a.values()) {\n let found = false;\n for (const candidate of b.values()) {\n if (deepEqual(value, candidate)) {\n found = true;\n break;\n }\n }\n if (!found) return false;\n }\n return true;\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n return a.every((item, i) => deepEqual(item, b[i]));\n }\n\n if (Array.isArray(a) !== Array.isArray(b)) return false;\n\n const keysA = Object.keys(a as object);\n const keysB = Object.keys(b as object);\n\n if (keysA.length !== keysB.length) return false;\n\n return keysA.every((key) =>\n deepEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])\n );\n};\n\n/**\n * Detects if nested objects were mutated but the reference stayed the same.\n * Returns the keys where nested mutations were detected.\n * @internal\n */\nexport const detectNestedMutations = <S extends Record<string, unknown>>(\n before: S,\n after: S,\n signalValues: Map<keyof S, unknown>\n): Array<keyof S> => {\n const mutatedKeys: Array<keyof S> = [];\n\n for (const key of Object.keys(after) as Array<keyof S>) {\n const beforeValue = before[key];\n const afterValue = after[key];\n const signalValue = signalValues.get(key);\n\n // Check if it's the same reference but content changed\n if (\n signalValue === afterValue &&\n isPlainObject(beforeValue) &&\n isPlainObject(afterValue) &&\n !deepEqual(beforeValue, afterValue)\n ) {\n mutatedKeys.push(key);\n }\n }\n\n return mutatedKeys;\n};\n\n/** @internal Flag to enable/disable development warnings */\nexport const isDev = (() => {\n try {\n const globalProcess = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process;\n // Default to dev mode unless explicitly set to production\n return !(typeof globalProcess !== 'undefined' && globalProcess.env?.NODE_ENV === 'production');\n } catch {\n return true;\n }\n})();\n","/**\n * Store creation logic.\n */\n\nimport {\n batch,\n computed,\n signal,\n untrack,\n type ReadonlySignal,\n type Signal,\n} from '../reactive/index';\nimport { notifyDevtoolsStateChange, registerDevtoolsStore } from './devtools';\nimport { applyPlugins } from './plugins';\nimport { getStore, hasStore, registerStore } from './registry';\nimport type { Getters, Store, StoreDefinition, StoreSubscriber } from './types';\nimport { deepClone, detectNestedMutations, isDev } from './utils';\n\n/**\n * Creates a reactive store with state, getters, and actions.\n *\n * @template S - State type\n * @template G - Getters type\n * @template A - Actions type\n * @param definition - Store definition\n * @returns The reactive store instance\n */\nexport const createStore = <\n S extends Record<string, unknown>,\n G extends Record<string, unknown> = Record<string, never>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n A extends Record<string, (...args: any[]) => any> = Record<string, never>,\n>(\n definition: StoreDefinition<S, G, A>\n): Store<S, G, A> => {\n const { id, state: stateFactory, getters = {} as Getters<S, G>, actions = {} as A } = definition;\n\n // Check for duplicate store IDs\n if (hasStore(id)) {\n console.warn(`bQuery store: Store \"${id}\" already exists. Returning existing instance.`);\n return getStore(id) as Store<S, G, A>;\n }\n\n // Create initial state\n const initialState = stateFactory();\n\n // Create signals for each state property\n const stateSignals = new Map<keyof S, Signal<unknown>>();\n for (const key of Object.keys(initialState) as Array<keyof S>) {\n stateSignals.set(key, signal(initialState[key]));\n }\n\n // Subscribers for $subscribe\n const subscribers: Array<StoreSubscriber<S>> = [];\n\n /**\n * Gets the current state.\n *\n * For subscriber notifications (where a plain object snapshot is needed),\n * this creates a shallow copy. For internal reads, use stateProxy directly.\n *\n * **Note:** Returns a shallow snapshot. Nested object mutations will NOT\n * trigger reactive updates. This differs from frameworks like Pinia that\n * use deep reactivity. To update nested state, replace the entire object.\n *\n * Uses `untrack()` to prevent accidental dependency tracking when called\n * from within reactive contexts (e.g., `effect()` or `computed()`).\n *\n * @internal\n */\n const getCurrentState = (): S =>\n untrack(() => {\n return { ...stateProxy };\n });\n\n /**\n * Notifies subscribers of state changes.\n * Short-circuits if there are no subscribers and devtools aren't active\n * to avoid unnecessary snapshot overhead.\n * @internal\n */\n const notifySubscribers = (): void => {\n // Early return if no subscribers and no devtools hook\n const hasDevtools =\n typeof window !== 'undefined' &&\n typeof window.__BQUERY_DEVTOOLS__?.onStateChange === 'function';\n if (subscribers.length === 0 && !hasDevtools) {\n return;\n }\n\n const currentState = getCurrentState();\n for (const callback of subscribers) {\n callback(currentState);\n }\n\n notifyDevtoolsStateChange(id, currentState);\n };\n\n /**\n * Cached state proxy that lazily reads signal values.\n * Uses a Proxy to avoid creating new objects on each access.\n *\n * **Note:** This returns a shallow snapshot of the state. Nested object\n * mutations will NOT trigger reactive updates. For nested reactivity,\n * replace the entire object or use signals for nested properties.\n *\n * @internal\n */\n const stateProxy = new Proxy({} as S, {\n get: (_, prop: string | symbol) => {\n const key = prop as keyof S;\n if (stateSignals.has(key)) {\n return stateSignals.get(key)!.value;\n }\n return undefined;\n },\n ownKeys: () => Array.from(stateSignals.keys()) as string[],\n getOwnPropertyDescriptor: (_, prop) => {\n if (stateSignals.has(prop as keyof S)) {\n return { enumerable: true, configurable: true };\n }\n return undefined;\n },\n has: (_, prop) => stateSignals.has(prop as keyof S),\n });\n\n // Create computed getters\n const getterComputed = new Map<keyof G, ReadonlySignal<unknown>>();\n\n // Build the store proxy\n const store = {} as Store<S, G, A>;\n\n // Define state properties with getters/setters\n for (const key of Object.keys(initialState) as Array<keyof S>) {\n Object.defineProperty(store, key, {\n get: () => stateSignals.get(key)!.value,\n set: (value: unknown) => {\n stateSignals.get(key)!.value = value;\n notifySubscribers();\n },\n enumerable: true,\n configurable: false,\n });\n }\n\n // Define getters as computed properties\n for (const key of Object.keys(getters) as Array<keyof G>) {\n const getterFn = getters[key];\n\n // Create computed that reads from state signals via proxy (more efficient)\n const computedGetter = computed(() => {\n const state = stateProxy;\n // For getter dependencies, pass a proxy that reads from computed getters\n const getterProxy = new Proxy({} as G, {\n get: (_, prop: string | symbol) => {\n const propKey = prop as keyof G;\n if (getterComputed.has(propKey)) {\n return getterComputed.get(propKey)!.value;\n }\n return undefined;\n },\n });\n return getterFn(state, getterProxy);\n });\n\n getterComputed.set(key, computedGetter as unknown as ReadonlySignal<unknown>);\n\n Object.defineProperty(store, key, {\n get: () => computedGetter.value,\n enumerable: true,\n configurable: false,\n });\n }\n\n // Bind actions to the store context\n for (const key of Object.keys(actions) as Array<keyof A>) {\n const actionFn = actions[key];\n\n // Wrap action to enable 'this' binding\n (store as Record<string, unknown>)[key as string] = function (...args: unknown[]) {\n // Create a context that allows 'this.property' access\n const context = new Proxy(store, {\n get: (target, prop) => {\n if (typeof prop === 'string' && stateSignals.has(prop as keyof S)) {\n return stateSignals.get(prop as keyof S)!.value;\n }\n return (target as Record<string, unknown>)[prop as string];\n },\n set: (target, prop, value) => {\n if (typeof prop === 'string' && stateSignals.has(prop as keyof S)) {\n stateSignals.get(prop as keyof S)!.value = value;\n notifySubscribers();\n return true;\n }\n // Allow non-state property assignments (e.g., temporary variables in actions)\n // by delegating to the target object rather than returning false\n return Reflect.set(target, prop, value);\n },\n });\n\n return actionFn.apply(context, args);\n };\n }\n\n // Add store utility methods\n Object.defineProperties(store, {\n $id: {\n value: id,\n writable: false,\n enumerable: false,\n },\n $reset: {\n value: () => {\n const fresh = stateFactory();\n batch(() => {\n for (const [key, sig] of stateSignals) {\n sig.value = fresh[key];\n }\n });\n notifySubscribers();\n },\n writable: false,\n enumerable: false,\n },\n $subscribe: {\n value: (callback: StoreSubscriber<S>) => {\n subscribers.push(callback);\n return () => {\n const index = subscribers.indexOf(callback);\n if (index > -1) subscribers.splice(index, 1);\n };\n },\n writable: false,\n enumerable: false,\n },\n $patch: {\n value: (partial: Partial<S> | ((state: S) => void)) => {\n batch(() => {\n if (typeof partial === 'function') {\n // Capture state before mutation for nested mutation detection\n const stateBefore = isDev ? deepClone(getCurrentState()) : null;\n const signalValuesBefore = isDev\n ? new Map(Array.from(stateSignals.entries()).map(([k, s]) => [k, s.value]))\n : null;\n\n // Mutation function\n const state = getCurrentState();\n partial(state);\n\n // Detect nested mutations in development mode\n if (isDev && stateBefore && signalValuesBefore) {\n const mutatedKeys = detectNestedMutations(stateBefore, state, signalValuesBefore);\n if (mutatedKeys.length > 0) {\n console.warn(\n `[bQuery store \"${id}\"] Nested mutation detected in $patch() for keys: ${mutatedKeys\n .map(String)\n .join(', ')}.\\n` +\n 'Nested object mutations do not trigger reactive updates because the store uses shallow reactivity.\\n' +\n 'To fix this, either:\\n' +\n ' 1. Replace the entire object: state.user = { ...state.user, name: \"New\" }\\n' +\n ' 2. Use $patchDeep() for automatic deep cloning\\n' +\n 'See: https://bquery.dev/guide/store#deep-reactivity'\n );\n }\n }\n\n for (const [key, value] of Object.entries(state) as Array<[keyof S, unknown]>) {\n if (stateSignals.has(key)) {\n stateSignals.get(key)!.value = value;\n }\n }\n } else {\n // Partial object\n for (const [key, value] of Object.entries(partial) as Array<[keyof S, unknown]>) {\n if (stateSignals.has(key)) {\n stateSignals.get(key)!.value = value;\n }\n }\n }\n });\n notifySubscribers();\n },\n writable: false,\n enumerable: false,\n },\n $patchDeep: {\n value: (partial: Partial<S> | ((state: S) => void)) => {\n batch(() => {\n if (typeof partial === 'function') {\n // Deep clone state before mutation to ensure new references\n const state = deepClone(getCurrentState());\n partial(state);\n\n for (const [key, value] of Object.entries(state) as Array<[keyof S, unknown]>) {\n if (stateSignals.has(key)) {\n stateSignals.get(key)!.value = value;\n }\n }\n } else {\n // Deep clone each value in partial to ensure new references\n for (const [key, value] of Object.entries(partial) as Array<[keyof S, unknown]>) {\n if (stateSignals.has(key)) {\n stateSignals.get(key)!.value = deepClone(value);\n }\n }\n }\n });\n notifySubscribers();\n },\n writable: false,\n enumerable: false,\n },\n $state: {\n get: () => getCurrentState(),\n enumerable: false,\n },\n });\n\n // Register store\n registerStore(id, store);\n\n // Apply plugins\n applyPlugins(store, definition);\n\n // Notify devtools\n registerDevtoolsStore(id, store);\n\n return store;\n};\n","/**\n * Store factory helpers.\n */\n\nimport { createStore } from './create-store';\nimport { getStore, hasStore } from './registry';\nimport type { Store, StoreDefinition } from './types';\n\n/**\n * Creates a store factory that returns the store instance.\n *\n * The store is lazily created on first call and cached in the global store\n * registry. Subsequent calls return the same instance. After calling\n * `destroyStore(id)`, the next factory call will create a fresh store.\n *\n * @param id - Store identifier\n * @param definition - Store definition without id\n * @returns A function that returns the store instance\n *\n * @example\n * ```ts\n * const useCounter = defineStore('counter', {\n * state: () => ({ count: 0 }),\n * actions: { increment() { this.count++; } },\n * });\n *\n * const counter = useCounter();\n * counter.increment();\n * ```\n */\nexport const defineStore = <\n S extends Record<string, unknown>,\n G extends Record<string, unknown> = Record<string, never>,\n A extends Record<string, (...args: unknown[]) => unknown> = Record<string, never>,\n>(\n id: string,\n definition: Omit<StoreDefinition<S, G, A>, 'id'>\n): (() => Store<S, G, A>) => {\n // Check registry first to avoid noisy warnings from createStore()\n // when the factory is called multiple times (intended usage pattern).\n // createStore() only called when store doesn't exist or was destroyed.\n return () => {\n if (hasStore(id)) {\n return getStore(id) as Store<S, G, A>;\n }\n return createStore({ id, ...definition });\n };\n};\n","/**\n * Mapping helpers for store state and actions.\n */\n\n/**\n * Maps store state properties to a reactive object for use in components.\n *\n * @param store - The store instance\n * @param keys - State keys to map\n * @returns Object with mapped properties\n */\nexport const mapState = <S extends Record<string, unknown>, K extends keyof S>(\n store: S,\n keys: K[]\n): Pick<S, K> => {\n const mapped = {} as Pick<S, K>;\n\n for (const key of keys) {\n Object.defineProperty(mapped, key, {\n get: () => store[key],\n enumerable: true,\n });\n }\n\n return mapped;\n};\n\n/**\n * Maps store getters to a reactive object for use in components.\n *\n * @param store - The store instance\n * @param keys - Getter keys to map\n * @returns Object with mapped getters\n */\nexport const mapGetters = <G extends Record<string, unknown>, K extends keyof G>(\n store: G,\n keys: K[]\n): Pick<G, K> => {\n const mapped = {} as Pick<G, K>;\n\n for (const key of keys) {\n Object.defineProperty(mapped, key, {\n get: () => store[key],\n enumerable: true,\n });\n }\n\n return mapped;\n};\n\n/**\n * Maps store actions to an object for easier destructuring.\n *\n * @param store - The store instance\n * @param keys - Action keys to map\n * @returns Object with mapped actions\n */\nexport const mapActions = <\n A extends Record<string, (...args: unknown[]) => unknown>,\n K extends keyof A,\n>(\n store: A,\n keys: K[]\n): Pick<A, K> => {\n const mapped = {} as Pick<A, K>;\n\n for (const key of keys) {\n (mapped as Record<string, unknown>)[key as string] = (...args: unknown[]) =>\n (store[key] as (...args: unknown[]) => unknown)(...args);\n }\n\n return mapped;\n};\n","/**\n * Store persistence helpers.\n */\n\nimport { createStore } from './create-store';\nimport type { Store, StoreDefinition } from './types';\n\n/**\n * Creates a store with automatic persistence to localStorage.\n *\n * @param definition - Store definition\n * @param storageKey - Optional custom storage key\n * @returns The reactive store instance\n */\nexport const createPersistedStore = <\n S extends Record<string, unknown>,\n G extends Record<string, unknown> = Record<string, never>,\n A extends Record<string, (...args: unknown[]) => unknown> = Record<string, never>,\n>(\n definition: StoreDefinition<S, G, A>,\n storageKey?: string\n): Store<S, G, A> => {\n const key = storageKey ?? `bquery-store-${definition.id}`;\n\n const originalStateFactory = definition.state;\n\n const wrappedDefinition: StoreDefinition<S, G, A> = {\n ...definition,\n state: () => {\n const defaultState = originalStateFactory();\n\n if (typeof window !== 'undefined') {\n try {\n const saved = localStorage.getItem(key);\n if (saved) {\n return { ...defaultState, ...JSON.parse(saved) } as S;\n }\n } catch {\n // Ignore parse errors\n }\n }\n\n return defaultState;\n },\n };\n\n const store = createStore(wrappedDefinition);\n\n // Subscribe to save changes\n store.$subscribe((state) => {\n if (typeof window !== 'undefined') {\n try {\n localStorage.setItem(key, JSON.stringify(state));\n } catch {\n // Ignore quota errors\n }\n }\n });\n\n return store;\n};\n","/**\n * Store watch helpers.\n */\n\nimport type { Store } from './types';\nimport { deepEqual } from './utils';\n\nexport type WatchStoreOptions<T> = {\n /** Call the callback immediately with the current value. */\n immediate?: boolean;\n /** Use deep comparison when determining changes. */\n deep?: boolean;\n /** Custom equality check for selected values. */\n equals?: (a: T, b: T) => boolean;\n};\n\n/**\n * Watch a selected slice of store state.\n *\n * @param store - The store instance\n * @param selector - Function to select the watched value\n * @param callback - Called when the selected value changes\n * @param options - Watch options\n * @returns Unsubscribe function\n */\nexport const watchStore = <\n S extends Record<string, unknown>,\n G extends Record<string, unknown>,\n A extends Record<string, (...args: unknown[]) => unknown>,\n T,\n>(\n store: Store<S, G, A>,\n selector: (state: S) => T,\n callback: (value: T, previous: T | undefined) => void,\n options: WatchStoreOptions<T> = {}\n): (() => void) => {\n const equals = options.equals ?? (options.deep ? deepEqual : Object.is);\n let previous = selector(store.$state);\n\n if (options.immediate) {\n callback(previous, undefined);\n }\n\n return store.$subscribe((state) => {\n const current = selector(state);\n if (!equals(current, previous)) {\n const prev = previous;\n previous = current;\n callback(current, prev);\n }\n });\n};\n"],"mappings":";;AAqBA,IAAM,IAAA,MAAiD;AACrD,MAAI,SAAO,SAAW;AACtB,WAAK,OAAO,wBACV,OAAO,sBAAsB,EAAE,QAAQ,oBAAI,IAAA,EAAK,IAE3C,OAAO;GAGH,IAAA,CAAyB,GAAY,MAAyB;AACzE,QAAM,IAAW,EAAA;AACjB,EAAK,MACL,EAAS,OAAO,IAAI,GAAI,CAAA,GACxB,EAAS,iBAAiB,GAAI,CAAA;GAGnB,IAAA,CAA2B,MAAqB;AAC3D,EAAI,OAAO,SAAW,OAAe,CAAC,OAAO,uBAC7C,OAAO,oBAAoB,OAAO,OAAO,CAAA;GAG9B,IAAA,CAA6B,GAAY,MAAyB;AAC7E,EAAI,OAAO,SAAW,OACtB,OAAO,qBAAqB,gBAAgB,GAAI,CAAA;GCpC5C,IAAyB,CAAA,GAOlB,IAAA,CAAkB,MAA8B;AAC3D,EAAA,EAAQ,KAAK,CAAA;GAIF,IAAA,CAEX,GAEA,MACS;AACT,aAAW,KAAU,GAAS;AAC5B,UAAM,IAAY,EAAO;AAAA,MAAE,OAAA;AAAA,MAAO,SAAA;AAAA,KAAS;AAC3C,IAAI,KACF,OAAO,OAAO,GAAO,CAAA;AAAA;GCnBrB,IAAgB,oBAAI,IAAA,GAGb,IAAA,CAAY,MAAwB,EAAc,IAAI,CAAA,GAGtD,IAAA,CACX,GAEA,MACS;AACT,EAAA,EAAc,IAAI,GAAI,CAAA;GASX,IAAA,CAAyB,MAC7B,EAAc,IAAI,CAAA,GAQd,IAAA,MACJ,MAAM,KAAK,EAAc,KAAA,CAAM,GAQ3B,IAAA,CAAgB,MAAqB;AAChD,EAAA,EAAc,OAAO,CAA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AClD,GAAG;AAAA,IACH,OAAA,MAAa;AACX,YAAM,IAAe,EAAA;AAErB,UAAI,OAAO,SAAW,IACpB,KAAI;AACF,cAAM,IAAQ,aAAa,QAAQ,CAAA;AACnC,YAAI,EACF,QAAO;AAAA,UAAE,GAAG;AAAA,UAAc,GAAG,KAAK,MAAM,CAAA;AAAA;cAEpC;AAAA,MAAA;AAKV,aAAO;AAAA;GAEV;AAKD,SAAA,EAAM,WAAA,CAAY,MAAU;AAC1B,QAAI,OAAO,SAAW,IACpB,KAAI;AACF,mBAAa,QAAQ,GAAK,KAAK,UAAU,CAAA,CAAM;AAAA,YACzC;AAAA,IAAA;AAAA,MAML;GClCI,IAAA,CAMX,GACA,GACA,GACA,IAAgC,CAAA,MACf;AACjB,QAAM,IAAS,EAAQ,WAAW,EAAQ,OAAO,IAAY,OAAO;AACpE,MAAI,IAAW,EAAS,EAAM,MAAA;AAE9B,SAAI,EAAQ,aACV,EAAS,GAAU,MAAA,GAGd,EAAM,WAAA,CAAY,MAAU;AACjC,UAAM,IAAU,EAAS,CAAA;AACzB,QAAI,CAAC,EAAO,GAAS,CAAA,GAAW;AAC9B,YAAM,IAAO;AACb,MAAA,IAAW,GACX,EAAS,GAAS,CAAA;AAAA"}
package/dist/store.es.mjs CHANGED
@@ -1,27 +1,14 @@
1
- import { h as c, g as m, a as S, f as p } from "./persisted-DHoi3uEs.js";
2
- import { c as h, d as q, l as v, m as x, e as P, b as $, r as j } from "./persisted-DHoi3uEs.js";
3
- const d = (e, t) => () => c(e) ? m(e) : S({ id: e, ...t }), g = (e, t, o, s = {}) => {
4
- const i = s.equals ?? (s.deep ? p : Object.is);
5
- let r = t(e.$state);
6
- return s.immediate && o(r, void 0), e.$subscribe((n) => {
7
- const a = t(n);
8
- if (!i(a, r)) {
9
- const u = r;
10
- r = a, o(a, u);
11
- }
12
- });
13
- };
1
+ import { a as t, c as s, d as a, i as r, l as o, n as i, o as S, r as c, s as m, t as p, u as d } from "./store-CPK9E62U.js";
14
2
  export {
15
- h as createPersistedStore,
16
- S as createStore,
17
- d as defineStore,
18
- q as destroyStore,
19
- m as getStore,
20
- v as listStores,
21
- x as mapActions,
22
- P as mapGetters,
23
- $ as mapState,
24
- j as registerPlugin,
25
- g as watchStore
3
+ i as createPersistedStore,
4
+ m as createStore,
5
+ S as defineStore,
6
+ s as destroyStore,
7
+ o as getStore,
8
+ d as listStores,
9
+ c as mapActions,
10
+ r as mapGetters,
11
+ t as mapState,
12
+ a as registerPlugin,
13
+ p as watchStore
26
14
  };
27
- //# sourceMappingURL=store.es.mjs.map