@mhmo91/schmancy 0.2.139 → 0.2.142

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 (277) hide show
  1. package/dist/{animated-text-D5Ki7KHu.js → animated-text-CWRnkzJa.js} +3 -3
  2. package/dist/{animated-text-D5Ki7KHu.js.map → animated-text-CWRnkzJa.js.map} +1 -1
  3. package/dist/{animated-text-BNbldkLi.cjs → animated-text-UjA34w-f.cjs} +2 -2
  4. package/dist/{animated-text-BNbldkLi.cjs.map → animated-text-UjA34w-f.cjs.map} +1 -1
  5. package/dist/animated-text.cjs +1 -1
  6. package/dist/animated-text.js +1 -1
  7. package/dist/area.cjs +1 -1
  8. package/dist/{area.component-Bm6rP9MT.cjs → area.component-BEDtgjNb.cjs} +2 -2
  9. package/dist/{area.component-Bm6rP9MT.cjs.map → area.component-BEDtgjNb.cjs.map} +1 -1
  10. package/dist/{area.component-D8b2RJic.js → area.component-BzuHoeHG.js} +3 -3
  11. package/dist/{area.component-D8b2RJic.js.map → area.component-BzuHoeHG.js.map} +1 -1
  12. package/dist/area.js +1 -1
  13. package/dist/{autocomplete-BAvxzIpj.js → autocomplete-B3W-MX_R.js} +3 -3
  14. package/dist/{autocomplete-BAvxzIpj.js.map → autocomplete-B3W-MX_R.js.map} +1 -1
  15. package/dist/{autocomplete-nZaZaU-s.cjs → autocomplete-CtqM8VN6.cjs} +2 -2
  16. package/dist/{autocomplete-nZaZaU-s.cjs.map → autocomplete-CtqM8VN6.cjs.map} +1 -1
  17. package/dist/autocomplete.cjs +1 -1
  18. package/dist/autocomplete.js +1 -1
  19. package/dist/busy.cjs +1 -1
  20. package/dist/busy.js +1 -1
  21. package/dist/button.cjs +1 -1
  22. package/dist/button.js +1 -1
  23. package/dist/card.cjs +1 -1
  24. package/dist/card.js +1 -1
  25. package/dist/{checkbox-yuvdefd4.cjs → checkbox-CGAbsupz.cjs} +2 -2
  26. package/dist/{checkbox-yuvdefd4.cjs.map → checkbox-CGAbsupz.cjs.map} +1 -1
  27. package/dist/{checkbox-BPXqV2sc.js → checkbox-gDmmaU-i.js} +2 -2
  28. package/dist/{checkbox-BPXqV2sc.js.map → checkbox-gDmmaU-i.js.map} +1 -1
  29. package/dist/checkbox.cjs +1 -1
  30. package/dist/checkbox.js +1 -1
  31. package/dist/{chips-B8bgmplU.js → chips-DtYGQiRe.js} +12 -12
  32. package/dist/{chips-B8bgmplU.js.map → chips-DtYGQiRe.js.map} +1 -1
  33. package/dist/{chips-CPmmFVGK.cjs → chips-FOChglMy.cjs} +2 -2
  34. package/dist/{chips-CPmmFVGK.cjs.map → chips-FOChglMy.cjs.map} +1 -1
  35. package/dist/chips.cjs +1 -1
  36. package/dist/chips.js +1 -1
  37. package/dist/components.cjs +1 -1
  38. package/dist/components.js +1 -1
  39. package/dist/content-drawer.cjs +1 -1
  40. package/dist/content-drawer.js +1 -1
  41. package/dist/context-array-BrljBA5R.cjs +2 -0
  42. package/dist/context-array-BrljBA5R.cjs.map +1 -0
  43. package/dist/context-array-CSGdoQ1W.js +923 -0
  44. package/dist/context-array-CSGdoQ1W.js.map +1 -0
  45. package/dist/{date-range-Mh7mi060.cjs → date-range-CCBukS6w.cjs} +2 -2
  46. package/dist/{date-range-Mh7mi060.cjs.map → date-range-CCBukS6w.cjs.map} +1 -1
  47. package/dist/{date-range-XD3eHmKe.js → date-range-CKocQ00P.js} +3 -3
  48. package/dist/{date-range-XD3eHmKe.js.map → date-range-CKocQ00P.js.map} +1 -1
  49. package/dist/date-range.cjs +1 -1
  50. package/dist/date-range.js +1 -1
  51. package/dist/{delay-BEh5HtKm.js → delay-Byk3BNTS.js} +11 -11
  52. package/dist/{delay-BEh5HtKm.js.map → delay-Byk3BNTS.js.map} +1 -1
  53. package/dist/{delay-Bz8DPPRF.cjs → delay-DoQ_jIcq.cjs} +2 -2
  54. package/dist/{delay-Bz8DPPRF.cjs.map → delay-DoQ_jIcq.cjs.map} +1 -1
  55. package/dist/delay.cjs +1 -1
  56. package/dist/delay.js +1 -1
  57. package/dist/{divider-BBy32B6r.js → divider-DW1XYPUt.js} +3 -3
  58. package/dist/{divider-BBy32B6r.js.map → divider-DW1XYPUt.js.map} +1 -1
  59. package/dist/{divider-Dxmbn2j0.cjs → divider-Wh-OY6OR.cjs} +2 -2
  60. package/dist/{divider-Dxmbn2j0.cjs.map → divider-Wh-OY6OR.cjs.map} +1 -1
  61. package/dist/divider.cjs +1 -1
  62. package/dist/divider.js +1 -1
  63. package/dist/extra.cjs +1 -1
  64. package/dist/extra.js +1 -1
  65. package/dist/{flex-BbafQvop.js → flex-BCcCTIEB.js} +2 -2
  66. package/dist/{flex-BbafQvop.js.map → flex-BCcCTIEB.js.map} +1 -1
  67. package/dist/{flex-C64fxWPl.cjs → flex-BaRE9ffF.cjs} +2 -2
  68. package/dist/{flex-C64fxWPl.cjs.map → flex-BaRE9ffF.cjs.map} +1 -1
  69. package/dist/{form-WOoGhjQx.cjs → form-B0CyaQwH.cjs} +2 -2
  70. package/dist/{form-WOoGhjQx.cjs.map → form-B0CyaQwH.cjs.map} +1 -1
  71. package/dist/{form-CjB8ReAw.js → form-DvQXRrGJ.js} +2 -2
  72. package/dist/{form-CjB8ReAw.js.map → form-DvQXRrGJ.js.map} +1 -1
  73. package/dist/form.cjs +1 -1
  74. package/dist/form.js +1 -1
  75. package/dist/{icon-D3FyfFuy.cjs → icon-BqQnZfcC.cjs} +2 -2
  76. package/dist/{icon-D3FyfFuy.cjs.map → icon-BqQnZfcC.cjs.map} +1 -1
  77. package/dist/{icon-1L_noI_n.js → icon-CoTwcGO7.js} +3 -3
  78. package/dist/{icon-1L_noI_n.js.map → icon-CoTwcGO7.js.map} +1 -1
  79. package/dist/{icon-button-Bfd0mfs9.cjs → icon-button-B3LSOKYP.cjs} +2 -2
  80. package/dist/{icon-button-Bfd0mfs9.cjs.map → icon-button-B3LSOKYP.cjs.map} +1 -1
  81. package/dist/{icon-button-Dji1Ck9p.js → icon-button-BMkOl7zP.js} +3 -3
  82. package/dist/{icon-button-Dji1Ck9p.js.map → icon-button-BMkOl7zP.js.map} +1 -1
  83. package/dist/icons.cjs +1 -1
  84. package/dist/icons.js +1 -1
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.js +136 -123
  87. package/dist/index.js.map +1 -1
  88. package/dist/{input-leV-sK9y.cjs → input-A8mZ7r9Z.cjs} +2 -2
  89. package/dist/{input-leV-sK9y.cjs.map → input-A8mZ7r9Z.cjs.map} +1 -1
  90. package/dist/{input-DIgPPDf4.js → input-FLgsuB5g.js} +2 -2
  91. package/dist/{input-DIgPPDf4.js.map → input-FLgsuB5g.js.map} +1 -1
  92. package/dist/input.cjs +1 -1
  93. package/dist/input.js +1 -1
  94. package/dist/layout.cjs +1 -1
  95. package/dist/layout.js +1 -1
  96. package/dist/{list-8U7mFDmR.cjs → list-4_krEg2r.cjs} +2 -2
  97. package/dist/{list-8U7mFDmR.cjs.map → list-4_krEg2r.cjs.map} +1 -1
  98. package/dist/{list-DiARM4rT.js → list-DxHWsB3z.js} +2 -2
  99. package/dist/{list-DiARM4rT.js.map → list-DxHWsB3z.js.map} +1 -1
  100. package/dist/list.cjs +1 -1
  101. package/dist/list.js +1 -1
  102. package/dist/{litElement.mixin-DBsn92pk.cjs → litElement.mixin-CssoQifr.cjs} +2 -2
  103. package/dist/{litElement.mixin-DBsn92pk.cjs.map → litElement.mixin-CssoQifr.cjs.map} +1 -1
  104. package/dist/{litElement.mixin-BOOn7U5Z.js → litElement.mixin-fACDhe7J.js} +2 -2
  105. package/dist/{litElement.mixin-BOOn7U5Z.js.map → litElement.mixin-fACDhe7J.js.map} +1 -1
  106. package/dist/{menu-Br6X3wmF.cjs → menu-fEUIZGXJ.cjs} +2 -2
  107. package/dist/{menu-Br6X3wmF.cjs.map → menu-fEUIZGXJ.cjs.map} +1 -1
  108. package/dist/{menu-xQx6N8LO.js → menu-rWt1jKex.js} +3 -3
  109. package/dist/{menu-xQx6N8LO.js.map → menu-rWt1jKex.js.map} +1 -1
  110. package/dist/menu.cjs +1 -1
  111. package/dist/menu.js +1 -1
  112. package/dist/mixins/tailwind.css +5 -0
  113. package/dist/nav-drawer.cjs +1 -1
  114. package/dist/nav-drawer.js +1 -1
  115. package/dist/notification-container-DKLh7Vt2.js +447 -0
  116. package/dist/notification-container-DKLh7Vt2.js.map +1 -0
  117. package/dist/notification-container-DdUjZ0bi.cjs +124 -0
  118. package/dist/notification-container-DdUjZ0bi.cjs.map +1 -0
  119. package/dist/notification-service-DWeUoHi2.js +29 -0
  120. package/dist/notification-service-DWeUoHi2.js.map +1 -0
  121. package/dist/notification-service-DXXrRCmK.cjs +2 -0
  122. package/dist/notification-service-DXXrRCmK.cjs.map +1 -0
  123. package/dist/notification.cjs +1 -1
  124. package/dist/notification.js +7 -4
  125. package/dist/notification.js.map +1 -1
  126. package/dist/{option-C1ZeDVrC.cjs → option-CpmK20dy.cjs} +2 -2
  127. package/dist/{option-C1ZeDVrC.cjs.map → option-CpmK20dy.cjs.map} +1 -1
  128. package/dist/{option-Dx2AWiaj.js → option-ztBnKZ_w.js} +2 -2
  129. package/dist/{option-Dx2AWiaj.js.map → option-ztBnKZ_w.js.map} +1 -1
  130. package/dist/option.cjs +1 -1
  131. package/dist/option.js +1 -1
  132. package/dist/{payment-card-form-CJ4YDbUJ.js → payment-card-form-CUgTRvBS.js} +3 -3
  133. package/dist/{payment-card-form-CJ4YDbUJ.js.map → payment-card-form-CUgTRvBS.js.map} +1 -1
  134. package/dist/{payment-card-form-liiHN2py.cjs → payment-card-form-DmHX_20B.cjs} +2 -2
  135. package/dist/{payment-card-form-liiHN2py.cjs.map → payment-card-form-DmHX_20B.cjs.map} +1 -1
  136. package/dist/{radio-group-C067Z6Sx.js → radio-group-BZMhEi5P.js} +2 -2
  137. package/dist/{radio-group-C067Z6Sx.js.map → radio-group-BZMhEi5P.js.map} +1 -1
  138. package/dist/{radio-group-9pg4qU4Q.cjs → radio-group-DOpJu0Pc.cjs} +2 -2
  139. package/dist/{radio-group-9pg4qU4Q.cjs.map → radio-group-DOpJu0Pc.cjs.map} +1 -1
  140. package/dist/radio-group.cjs +1 -1
  141. package/dist/radio-group.js +1 -1
  142. package/dist/rxjs-utils.js +4 -4
  143. package/dist/{schmancy-steps-container-W8iUrjjQ.cjs → schmancy-steps-container-B5UOYQG8.cjs} +2 -2
  144. package/dist/{schmancy-steps-container-W8iUrjjQ.cjs.map → schmancy-steps-container-B5UOYQG8.cjs.map} +1 -1
  145. package/dist/{schmancy-steps-container-CXOh8tn7.js → schmancy-steps-container-srToeIjV.js} +2 -2
  146. package/dist/{schmancy-steps-container-CXOh8tn7.js.map → schmancy-steps-container-srToeIjV.js.map} +1 -1
  147. package/dist/{select-Ebp9Y6T_.cjs → select-0NLmJErW.cjs} +2 -2
  148. package/dist/{select-Ebp9Y6T_.cjs.map → select-0NLmJErW.cjs.map} +1 -1
  149. package/dist/{select-CbiLYVGN.js → select-Dx6IF984.js} +3 -3
  150. package/dist/{select-CbiLYVGN.js.map → select-Dx6IF984.js.map} +1 -1
  151. package/dist/select.cjs +1 -1
  152. package/dist/select.js +1 -1
  153. package/dist/selector-hook-0691Losv.js +323 -0
  154. package/dist/selector-hook-0691Losv.js.map +1 -0
  155. package/dist/selector-hook-SzNTYQII.cjs +2 -0
  156. package/dist/selector-hook-SzNTYQII.cjs.map +1 -0
  157. package/dist/{sheet-BZ4d5wLR.js → sheet-Bl64wfBe.js} +3 -3
  158. package/dist/{sheet-BZ4d5wLR.js.map → sheet-Bl64wfBe.js.map} +1 -1
  159. package/dist/{sheet-DoWympTj.cjs → sheet-BwsspKto.cjs} +2 -2
  160. package/dist/{sheet-DoWympTj.cjs.map → sheet-BwsspKto.cjs.map} +1 -1
  161. package/dist/sheet.cjs +1 -1
  162. package/dist/sheet.js +1 -1
  163. package/dist/{slider-BGzs57Nd.cjs → slider-9zdabbA2.cjs} +2 -2
  164. package/dist/{slider-BGzs57Nd.cjs.map → slider-9zdabbA2.cjs.map} +1 -1
  165. package/dist/{slider-Bwt5zt67.js → slider-nyTR0hyw.js} +3 -3
  166. package/dist/{slider-Bwt5zt67.js.map → slider-nyTR0hyw.js.map} +1 -1
  167. package/dist/slider.cjs +1 -1
  168. package/dist/slider.js +1 -1
  169. package/dist/{spinner-B6Yx9jX1.js → spinner-37Y-o4jr.js} +3 -3
  170. package/dist/{spinner-B6Yx9jX1.js.map → spinner-37Y-o4jr.js.map} +1 -1
  171. package/dist/{spinner-vlXVxDki.cjs → spinner-D46_Vbxf.cjs} +2 -2
  172. package/dist/{spinner-vlXVxDki.cjs.map → spinner-D46_Vbxf.cjs.map} +1 -1
  173. package/dist/steps.cjs +1 -1
  174. package/dist/steps.js +1 -1
  175. package/dist/store.cjs +1 -1
  176. package/dist/store.js +33 -23
  177. package/dist/{surface-CXwP49Mi.cjs → surface-DFXFQBBC.cjs} +2 -2
  178. package/dist/{surface-CXwP49Mi.cjs.map → surface-DFXFQBBC.cjs.map} +1 -1
  179. package/dist/{surface-C2lcwsKJ.js → surface-RtVWZEdq.js} +2 -2
  180. package/dist/{surface-C2lcwsKJ.js.map → surface-RtVWZEdq.js.map} +1 -1
  181. package/dist/surface.cjs +1 -1
  182. package/dist/surface.js +1 -1
  183. package/dist/{table-2-DnKwRo.cjs → table-BG1_ofOE.cjs} +2 -2
  184. package/dist/{table-2-DnKwRo.cjs.map → table-BG1_ofOE.cjs.map} +1 -1
  185. package/dist/{table-CWfF0shQ.js → table-CGdNPIeN.js} +2 -2
  186. package/dist/{table-CWfF0shQ.js.map → table-CGdNPIeN.js.map} +1 -1
  187. package/dist/table.cjs +1 -1
  188. package/dist/table.js +1 -1
  189. package/dist/{tabs-group-CPUDkhJ_.cjs → tabs-group-BVsNqqN1.cjs} +2 -2
  190. package/dist/{tabs-group-CPUDkhJ_.cjs.map → tabs-group-BVsNqqN1.cjs.map} +1 -1
  191. package/dist/{tabs-group-DXMbbWuO.js → tabs-group-CvHe90C_.js} +2 -2
  192. package/dist/{tabs-group-DXMbbWuO.js.map → tabs-group-CvHe90C_.js.map} +1 -1
  193. package/dist/tabs.cjs +1 -1
  194. package/dist/tabs.js +1 -1
  195. package/dist/tailwind.mixin-1drvGQKC.cjs +2 -0
  196. package/dist/{tailwind.mixin-CWsvBayE.cjs.map → tailwind.mixin-1drvGQKC.cjs.map} +1 -1
  197. package/dist/tailwind.mixin-C7U3gr3P.js +43 -0
  198. package/dist/{tailwind.mixin-C8nuH8uq.js.map → tailwind.mixin-C7U3gr3P.js.map} +1 -1
  199. package/dist/teleport.cjs +1 -1
  200. package/dist/{teleport.component-tDzioCA7.js → teleport.component-Du14Yyxz.js} +63 -63
  201. package/dist/{teleport.component-tDzioCA7.js.map → teleport.component-Du14Yyxz.js.map} +1 -1
  202. package/dist/{teleport.component-BMTMnjJi.cjs → teleport.component-Vicu2fPa.cjs} +2 -2
  203. package/dist/{teleport.component-BMTMnjJi.cjs.map → teleport.component-Vicu2fPa.cjs.map} +1 -1
  204. package/dist/teleport.js +1 -1
  205. package/dist/{textarea-08VY-gi0.cjs → textarea-D1nov2H8.cjs} +2 -2
  206. package/dist/{textarea-08VY-gi0.cjs.map → textarea-D1nov2H8.cjs.map} +1 -1
  207. package/dist/{textarea-KY-H0XE9.js → textarea-Ddi7wWLs.js} +2 -2
  208. package/dist/{textarea-KY-H0XE9.js.map → textarea-Ddi7wWLs.js.map} +1 -1
  209. package/dist/textarea.cjs +1 -1
  210. package/dist/textarea.js +1 -1
  211. package/dist/{theme-button-Cp3y37Mz.js → theme-button-84n-IAL1.js} +2 -2
  212. package/dist/{theme-button-Cp3y37Mz.js.map → theme-button-84n-IAL1.js.map} +1 -1
  213. package/dist/{theme-button-TChFwWi6.cjs → theme-button-C-g9a2ZF.cjs} +2 -2
  214. package/dist/{theme-button-TChFwWi6.cjs.map → theme-button-C-g9a2ZF.cjs.map} +1 -1
  215. package/dist/theme-button.cjs +1 -1
  216. package/dist/theme-button.js +1 -1
  217. package/dist/theme.cjs +1 -1
  218. package/dist/{theme.component-Bgh-j4WN.cjs → theme.component-C61DdKLT.cjs} +2 -2
  219. package/dist/{theme.component-Bgh-j4WN.cjs.map → theme.component-C61DdKLT.cjs.map} +1 -1
  220. package/dist/{theme.component-tcsmGB6n.js → theme.component-Dk0d_7Og.js} +47 -47
  221. package/dist/{theme.component-tcsmGB6n.js.map → theme.component-Dk0d_7Og.js.map} +1 -1
  222. package/dist/theme.js +1 -1
  223. package/dist/{timezone-DwTl04Fb.cjs → timezone-2Eb26kSx.cjs} +2 -4
  224. package/dist/timezone-2Eb26kSx.cjs.map +1 -0
  225. package/dist/{timezone-Cob3Zs1V.js → timezone-C8cbkh7P.js} +3 -5
  226. package/dist/timezone-C8cbkh7P.js.map +1 -0
  227. package/dist/{tree-CBYb1k5W.cjs → tree-CsKV00BK.cjs} +2 -2
  228. package/dist/{tree-CBYb1k5W.cjs.map → tree-CsKV00BK.cjs.map} +1 -1
  229. package/dist/{tree-DR5qkGYr.js → tree-_dvGG1Dk.js} +2 -2
  230. package/dist/{tree-DR5qkGYr.js.map → tree-_dvGG1Dk.js.map} +1 -1
  231. package/dist/tree.cjs +1 -1
  232. package/dist/tree.js +1 -1
  233. package/dist/{typewriter-DKXGVYPg.cjs → typewriter-BTKJ8mPR.cjs} +2 -2
  234. package/dist/{typewriter-DKXGVYPg.cjs.map → typewriter-BTKJ8mPR.cjs.map} +1 -1
  235. package/dist/{typewriter-BJk9hiPU.js → typewriter-D1rGUZyO.js} +4 -4
  236. package/dist/{typewriter-BJk9hiPU.js.map → typewriter-D1rGUZyO.js.map} +1 -1
  237. package/dist/typewriter.cjs +1 -1
  238. package/dist/typewriter.js +1 -1
  239. package/dist/{typography-Czz5ZTwN.cjs → typography-BJzp77zk.cjs} +2 -2
  240. package/dist/{typography-Czz5ZTwN.cjs.map → typography-BJzp77zk.cjs.map} +1 -1
  241. package/dist/{typography-B3-y3gWb.js → typography-C3AU6NFt.js} +2 -2
  242. package/dist/{typography-B3-y3gWb.js.map → typography-C3AU6NFt.js.map} +1 -1
  243. package/dist/typography.cjs +1 -1
  244. package/dist/typography.js +1 -1
  245. package/package.json +2 -1
  246. package/types/src/notification/index.d.ts +6 -3
  247. package/types/src/notification/notification-audio-generator.d.ts +45 -0
  248. package/types/src/notification/notification-audio.d.ts +70 -0
  249. package/types/src/notification/notification-container.d.ts +44 -0
  250. package/types/src/notification/notification-service.d.ts +60 -0
  251. package/types/src/notification/notification.d.ts +33 -4
  252. package/types/src/store/context-array.d.ts +83 -0
  253. package/types/src/store/context-collection.d.ts +20 -41
  254. package/types/src/store/context-create.d.ts +31 -9
  255. package/types/src/store/context-object.d.ts +14 -43
  256. package/types/src/store/filter-directive.d.ts +62 -5
  257. package/types/src/store/immer-integration.d.ts +60 -0
  258. package/types/src/store/selector-hook.d.ts +4 -0
  259. package/types/src/store/selectors.d.ts +29 -20
  260. package/types/src/store/store.class.d.ts +67 -0
  261. package/types/src/store/types.d.ts +102 -0
  262. package/dist/context-object-BDXZ5EKJ.js +0 -306
  263. package/dist/context-object-BDXZ5EKJ.js.map +0 -1
  264. package/dist/context-object-BIywslrO.cjs +0 -2
  265. package/dist/context-object-BIywslrO.cjs.map +0 -1
  266. package/dist/outlet-CI05jyjr.cjs +0 -61
  267. package/dist/outlet-CI05jyjr.cjs.map +0 -1
  268. package/dist/outlet-CScugbm9.js +0 -128
  269. package/dist/outlet-CScugbm9.js.map +0 -1
  270. package/dist/selector-hook-C6VCezv7.js +0 -273
  271. package/dist/selector-hook-C6VCezv7.js.map +0 -1
  272. package/dist/selector-hook-DDaYMsHs.cjs +0 -2
  273. package/dist/selector-hook-DDaYMsHs.cjs.map +0 -1
  274. package/dist/tailwind.mixin-C8nuH8uq.js +0 -43
  275. package/dist/tailwind.mixin-CWsvBayE.cjs +0 -2
  276. package/dist/timezone-Cob3Zs1V.js.map +0 -1
  277. package/dist/timezone-DwTl04Fb.cjs.map +0 -1
@@ -22,9 +22,12 @@ interface SelectOptions {
22
22
  deepClone?: boolean;
23
23
  /** Custom equality function to determine when to update */
24
24
  equals?: (a: any, b: any) => boolean;
25
+ /** Debug mode - logs selector activity */
26
+ debug?: boolean;
25
27
  }
26
28
  /**
27
29
  * Selector decorator that connects a component property to a store selector
30
+ * with improved memory management
28
31
  *
29
32
  * @param store The store to select from
30
33
  * @param selectorFn Optional function to transform the store state
@@ -33,6 +36,7 @@ interface SelectOptions {
33
36
  export declare function select<T, R>(store: IStore<T> | ICollectionStore<T>, selectorFn?: (state: any) => R, options?: SelectOptions): (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<R>) => void;
34
37
  /**
35
38
  * Creates a selector decorator that selects a specific item from a collection store
39
+ * with improved memory management
36
40
  *
37
41
  * @param store The collection store
38
42
  * @param keyGetter Function that returns the key to select
@@ -23,14 +23,6 @@ export declare function createCollectionSelector<T, R>(store: ICollectionStore<T
23
23
  * @returns An observable of all items as an array
24
24
  */
25
25
  export declare function createItemsSelector<T>(store: ICollectionStore<T>): Observable<T[]>;
26
- /**
27
- * Creates a selector that filters items from a collection
28
- *
29
- * @param store The collection store
30
- * @param filterFn Function that returns true for items to include
31
- * @returns An observable of filtered items as an array
32
- */
33
- export declare function createFilterSelector<T>(store: ICollectionStore<T>, filterFn: (item: T, key: string) => boolean): Observable<T[]>;
34
26
  /**
35
27
  * Creates a selector that retrieves a single item from a collection
36
28
  *
@@ -39,14 +31,6 @@ export declare function createFilterSelector<T>(store: ICollectionStore<T>, filt
39
31
  * @returns An observable of the selected item that emits when the item changes
40
32
  */
41
33
  export declare function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined>;
42
- /**
43
- * Creates a selector that counts items in a collection, optionally filtered
44
- *
45
- * @param store The collection store
46
- * @param filterFn Optional function to filter which items to count
47
- * @returns An observable of the count
48
- */
49
- export declare function createCountSelector<T>(store: ICollectionStore<T>, filterFn?: (item: T, key: string) => boolean): Observable<number>;
50
34
  /**
51
35
  * Creates a compound selector that depends on multiple other selectors
52
36
  *
@@ -65,10 +49,6 @@ export declare function createKeysSelector<T>(store: ICollectionStore<T>): Obser
65
49
  * Creates a selector that returns entries (key-value pairs) from a collection
66
50
  */
67
51
  export declare function createEntriesSelector<T>(store: ICollectionStore<T>): Observable<[string, T][]>;
68
- /**
69
- * Creates a selector that maps collection values through a transform function
70
- */
71
- export declare function createMapSelector<T, R>(store: ICollectionStore<T>, mapFn: (item: T, key: string) => R): Observable<R[]>;
72
52
  /**
73
53
  * Creates a selector that sorts collection items
74
54
  */
@@ -77,3 +57,32 @@ export declare function createSortSelector<T>(store: ICollectionStore<T>, compar
77
57
  * Creates a selector that finds the first item matching a predicate
78
58
  */
79
59
  export declare function createFindSelector<T>(store: ICollectionStore<T>, predicate: (item: T, key: string) => boolean): Observable<T | undefined>;
60
+ /**
61
+ * Creates a selector that filters items from a collection - OPTIMIZED
62
+ *
63
+ * @param store The collection store
64
+ * @param filterFn Function that returns true for items to include
65
+ * @returns An observable of filtered items as an array
66
+ */
67
+ export declare function createFilterSelector<T>(store: ICollectionStore<T>, filterFn: (item: T, key: string) => boolean): Observable<T[]>;
68
+ /**
69
+ * Creates a selector that maps collection values through a transform function - OPTIMIZED
70
+ */
71
+ export declare function createMapSelector<T, R>(store: ICollectionStore<T>, mapFn: (item: T, key: string) => R): Observable<R[]>;
72
+ /**
73
+ * Creates a selector that counts items in a collection, optionally filtered - OPTIMIZED
74
+ *
75
+ * @param store The collection store
76
+ * @param filterFn Optional function to filter which items to count
77
+ * @returns An observable of the count
78
+ */
79
+ export declare function createCountSelector<T>(store: ICollectionStore<T>, filterFn?: (item: T, key: string) => boolean): Observable<number>;
80
+ /**
81
+ * Optimized RxJS Pipeline - use share with reset on refCount zero for better memory management
82
+ * in scenarios where selector subscriptions come and go
83
+ *
84
+ * @param store The store to observe
85
+ * @param selectorFn Function that transforms the state
86
+ * @returns An observable of the selected state with improved memory management
87
+ */
88
+ export declare function createOptimizedSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R>;
@@ -0,0 +1,67 @@
1
+ import { BehaviorSubject, Subject } from 'rxjs';
2
+ import { IStorageManager, StorageType, StoreError } from './types';
3
+ /**
4
+ * Base store class to handle common functionality between store types
5
+ * Now with Immer integration for immutability
6
+ */
7
+ export declare abstract class BaseStore<T> {
8
+ protected storageType: StorageType;
9
+ protected key: string;
10
+ protected _ready: boolean;
11
+ protected _destroy$: Subject<void>;
12
+ $: BehaviorSubject<T>;
13
+ error$: BehaviorSubject<StoreError<unknown>>;
14
+ readonly defaultValue: T;
15
+ protected storage: IStorageManager<T>;
16
+ /**
17
+ * Get store ready state
18
+ */
19
+ get ready(): boolean;
20
+ /**
21
+ * Set store ready state
22
+ */
23
+ set ready(value: boolean);
24
+ /**
25
+ * Get the current value
26
+ */
27
+ get value(): T;
28
+ /**
29
+ * Initialize the base store
30
+ * @param storageType Storage type to use
31
+ * @param key Unique key for the store
32
+ * @param defaultValue Default/initial value
33
+ */
34
+ constructor(storageType: StorageType, key: string, defaultValue: T);
35
+ /**
36
+ * Cleanup method for all store types
37
+ */
38
+ destroy(): void;
39
+ /**
40
+ * Replace the entire store state immutably
41
+ */
42
+ replace(newValue: T): void;
43
+ /**
44
+ * Reset to default value - to be implemented by subclasses
45
+ */
46
+ abstract clear(): void;
47
+ /**
48
+ * Update the state with proper error handling and immutability
49
+ */
50
+ protected updateState(newValue: T): void;
51
+ /**
52
+ * Initialize the store from persistent storage
53
+ */
54
+ protected initializeFromStorage(): Promise<void>;
55
+ /**
56
+ * Process stored value (can be overridden by subclasses)
57
+ */
58
+ protected processStoredValue(storedValue: T): T;
59
+ /**
60
+ * Persist state to storage
61
+ */
62
+ protected persistToStorage(state: T): Promise<void>;
63
+ /**
64
+ * Setup development tools
65
+ */
66
+ protected abstract setupDevTools(): void;
67
+ }
@@ -1,3 +1,4 @@
1
+ import { Draft } from 'immer';
1
2
  import { BehaviorSubject, Observable } from 'rxjs';
2
3
  /**
3
4
  * Storage types supported by the store
@@ -137,3 +138,104 @@ export type StoreFactory = <T extends Record<string, any>>(initialData: T, stora
137
138
  * Factory function type for creating collection stores
138
139
  */
139
140
  export type CollectionStoreFactory = <T>(initialData: Map<string, T>, storage: StorageType, key: string) => ICollectionStore<T>;
141
+ /**
142
+ * Interface for array stores with improved typing
143
+ */
144
+ export interface IArrayStore<T> {
145
+ /** Get the current array value */
146
+ readonly value: T[];
147
+ /** Observable stream of array values */
148
+ readonly $: BehaviorSubject<T[]>;
149
+ /** The default/initial value of the array */
150
+ readonly defaultValue: T[];
151
+ /** Whether the store is ready (loaded from storage) */
152
+ ready: boolean;
153
+ /** Observable stream of store errors */
154
+ readonly error$: Observable<StoreError | null>;
155
+ /**
156
+ * Add item(s) to the end of the array
157
+ * @param items Items to add
158
+ */
159
+ push(...items: T[]): void;
160
+ /**
161
+ * Remove and return the last item from the array
162
+ * @returns The removed item or undefined if the array was empty
163
+ */
164
+ pop(): T | undefined;
165
+ /**
166
+ * Add item(s) to the beginning of the array
167
+ * @param items Items to add
168
+ */
169
+ unshift(...items: T[]): void;
170
+ /**
171
+ * Remove and return the first item from the array
172
+ * @returns The removed item or undefined if the array was empty
173
+ */
174
+ shift(): T | undefined;
175
+ /**
176
+ * Update an item at a specific index
177
+ * @param index The index to update
178
+ * @param value The new value
179
+ */
180
+ set(index: number, value: T): void;
181
+ /**
182
+ * Get the item at a specific index
183
+ * @param index The index to get
184
+ * @returns The item or undefined if index is out of bounds
185
+ */
186
+ get(index: number): T | undefined;
187
+ /**
188
+ * Remove items from the array and optionally insert new ones
189
+ * @param start The start index
190
+ * @param deleteCount The number of items to delete
191
+ * @param items Items to insert
192
+ * @returns The removed items
193
+ */
194
+ splice(start: number, deleteCount?: number, ...items: T[]): T[];
195
+ /**
196
+ * Remove an item by value (first occurrence)
197
+ * @param item The item to remove
198
+ * @param compareFn Optional function to compare items
199
+ * @returns True if the item was found and removed
200
+ */
201
+ remove(item: T, compareFn?: (a: T, b: T) => boolean): boolean;
202
+ /**
203
+ * Replace the entire array
204
+ * @param newArray The new array
205
+ */
206
+ replace(newArray: T[]): void;
207
+ /**
208
+ * Filter items in the array
209
+ * @param predicate Function to test each item
210
+ */
211
+ filter(predicate: (value: T, index: number, array: T[]) => boolean): void;
212
+ /**
213
+ * Map over the array and transform items
214
+ * @param mapper Function to transform each item
215
+ * @returns Array of transformed items
216
+ */
217
+ map<U>(mapper: (value: T, index: number, array: T[]) => U): U[];
218
+ /**
219
+ * Sort the array in place
220
+ * @param compareFn Optional function to determine sort order
221
+ */
222
+ sort(compareFn?: (a: T, b: T) => number): void;
223
+ /**
224
+ * Update a specific item using a callback function
225
+ * @param index The index to update
226
+ * @param updater Function that can modify the item
227
+ */
228
+ update(index: number, updater: (item: Draft<T>) => void): void;
229
+ /**
230
+ * Clear all items from the array
231
+ */
232
+ clear(): void;
233
+ /**
234
+ * Clean up resources
235
+ */
236
+ destroy(): void;
237
+ }
238
+ /**
239
+ * Factory function type for creating array stores
240
+ */
241
+ export type ArrayStoreFactory = <T>(initialData: T[], storage: StorageType, key: string) => IArrayStore<T>;
@@ -1,306 +0,0 @@
1
- import { Subject as p, BehaviorSubject as h, throttleTime as w } from "rxjs";
2
- class i extends Error {
3
- constructor(t, e, s) {
4
- super(t), this.name = "StoreError", this.cause = e, this.context = s, this.timestamp = /* @__PURE__ */ new Date(), Error.captureStackTrace && Error.captureStackTrace(this, i);
5
- }
6
- toJSON() {
7
- return { name: this.name, message: this.message, cause: this.cause, context: this.context, timestamp: this.timestamp.toISOString(), stack: this.stack };
8
- }
9
- }
10
- class g {
11
- constructor() {
12
- this.data = null;
13
- }
14
- async load() {
15
- return this.data;
16
- }
17
- async save(t) {
18
- this.data = t;
19
- }
20
- async clear() {
21
- this.data = null;
22
- }
23
- }
24
- class $ {
25
- constructor(t) {
26
- this.key = t;
27
- }
28
- async load() {
29
- try {
30
- const t = localStorage.getItem(this.key);
31
- return t ? JSON.parse(t) : null;
32
- } catch {
33
- return null;
34
- }
35
- }
36
- async save(t) {
37
- try {
38
- localStorage.setItem(this.key, JSON.stringify(t));
39
- } catch (e) {
40
- throw new i(`Failed to save to localStorage (${this.key})`, e);
41
- }
42
- }
43
- async clear() {
44
- localStorage.removeItem(this.key);
45
- }
46
- }
47
- class m {
48
- constructor(t) {
49
- this.key = t;
50
- }
51
- async load() {
52
- try {
53
- const t = sessionStorage.getItem(this.key);
54
- return t ? JSON.parse(t) : null;
55
- } catch {
56
- return null;
57
- }
58
- }
59
- async save(t) {
60
- try {
61
- sessionStorage.setItem(this.key, JSON.stringify(t));
62
- } catch (e) {
63
- throw new i(`Failed to save to sessionStorage (${this.key})`, e);
64
- }
65
- }
66
- async clear() {
67
- sessionStorage.removeItem(this.key);
68
- }
69
- }
70
- const a = class a {
71
- constructor(t) {
72
- this.key = t;
73
- }
74
- openDB() {
75
- return new Promise((t, e) => {
76
- const s = indexedDB.open(a.DB_NAME, a.DB_VERSION);
77
- s.onupgradeneeded = () => {
78
- const r = s.result;
79
- r.objectStoreNames.contains(a.STORE_NAME) || r.createObjectStore(a.STORE_NAME);
80
- }, s.onsuccess = () => t(s.result), s.onerror = () => e(s.error);
81
- });
82
- }
83
- async load() {
84
- try {
85
- const t = await this.openDB();
86
- return new Promise((e, s) => {
87
- const r = t.transaction(a.STORE_NAME, "readonly").objectStore(a.STORE_NAME).get(this.key);
88
- r.onsuccess = () => {
89
- t.close(), e(r.result || null);
90
- }, r.onerror = () => {
91
- t.close(), s(r.error);
92
- };
93
- });
94
- } catch {
95
- return null;
96
- }
97
- }
98
- async save(t) {
99
- try {
100
- const e = await this.openDB();
101
- return new Promise((s, r) => {
102
- const l = e.transaction(a.STORE_NAME, "readwrite").objectStore(a.STORE_NAME).put(t, this.key);
103
- l.onsuccess = () => {
104
- e.close(), s();
105
- }, l.onerror = () => {
106
- e.close(), r(l.error);
107
- };
108
- });
109
- } catch (e) {
110
- throw new i(`Failed to save to IndexedDB (${this.key})`, e);
111
- }
112
- }
113
- async clear() {
114
- try {
115
- const t = await this.openDB();
116
- return new Promise((e, s) => {
117
- const r = t.transaction(a.STORE_NAME, "readwrite").objectStore(a.STORE_NAME).delete(this.key);
118
- r.onsuccess = () => {
119
- t.close(), e();
120
- }, r.onerror = () => {
121
- t.close(), s(r.error);
122
- };
123
- });
124
- } catch (t) {
125
- throw new i(`Failed to clear from IndexedDB (${this.key})`, t);
126
- }
127
- }
128
- };
129
- a.DB_NAME = "StoreDB", a.STORE_NAME = "states", a.DB_VERSION = 1;
130
- let d = a;
131
- function S(c, t) {
132
- switch (c) {
133
- case "local":
134
- return new $(t);
135
- case "session":
136
- return new m(t);
137
- case "indexeddb":
138
- return new d(t);
139
- default:
140
- return new g();
141
- }
142
- }
143
- const o = class o {
144
- constructor(t, e, s) {
145
- this.storageType = t, this.key = e, this._ready = !1, this._destroy$ = new p(), this.error$ = new h(null), this.defaultValue = s, this.$ = new h(/* @__PURE__ */ new Map()), this.storage = S(t, e), t === "memory" ? (this._ready = !0, this.updateState(new Map(s))) : this.initializeFromStorage(), this.setupPersistence();
146
- }
147
- get ready() {
148
- return this._ready;
149
- }
150
- set ready(t) {
151
- this._ready = t, this.updateState(this.$.value);
152
- }
153
- static getInstance(t, e, s) {
154
- const r = `${t}:${e}`;
155
- return this.instances.has(r) || this.instances.set(r, new o(t, e, s)), this.instances.get(r);
156
- }
157
- get value() {
158
- return this.$.getValue();
159
- }
160
- set(t, e) {
161
- try {
162
- const s = new Map(this.value);
163
- s.set(t, e), this.updateState(s), this.error$.next(null);
164
- } catch (s) {
165
- const r = new i(`Error setting value for key ${t} in ${this.key}`, s);
166
- this.error$.next(r);
167
- }
168
- }
169
- delete(t) {
170
- try {
171
- const e = new Map(this.value);
172
- e.delete(t), this.updateState(e), this.error$.next(null);
173
- } catch (e) {
174
- const s = new i(`Error deleting key ${t} from ${this.key}`, e);
175
- this.error$.next(s);
176
- }
177
- }
178
- clear() {
179
- this.updateState(/* @__PURE__ */ new Map());
180
- }
181
- replace(t) {
182
- this.updateState(t);
183
- }
184
- updateState(t) {
185
- try {
186
- this.$.next(t);
187
- } catch (e) {
188
- const s = new i(`Error updating state in ${this.key}`, e);
189
- this.error$.next(s);
190
- }
191
- }
192
- async initializeFromStorage() {
193
- if (this.storageType === "local" || this.storageType === "session") try {
194
- const t = await this.storage.load();
195
- t && this.updateState(t), this._ready = !0;
196
- } catch (t) {
197
- const e = new i(`Error loading from ${this.storageType} storage for ${this.key}`, t);
198
- this.error$.next(e), this._ready = !0;
199
- }
200
- else this.storageType === "indexeddb" ? this.loadFromIndexedDB() : this._ready = !0;
201
- }
202
- async loadFromIndexedDB() {
203
- try {
204
- const t = await this.storage.load();
205
- this.updateState(t || /* @__PURE__ */ new Map()), this._ready = !0;
206
- } catch (t) {
207
- const e = new i(`Error loading from IndexedDB for ${this.key}`, t);
208
- this.error$.next(e), this._ready = !0;
209
- }
210
- }
211
- setupPersistence() {
212
- this.storageType !== "memory" && this.$.pipe(w(100, void 0, { leading: !0, trailing: !0 })).subscribe((t) => {
213
- this.storage.save(t).catch((e) => {
214
- const s = new i(`Error saving to ${this.storageType} storage for ${this.key}`, e);
215
- this.error$.next(s);
216
- });
217
- });
218
- }
219
- setupDevTools() {
220
- typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, set: this.set.bind(this), delete: this.delete.bind(this), clear: this.clear.bind(this), subscribe: (t) => {
221
- const e = this.$.subscribe(t);
222
- return () => e.unsubscribe();
223
- } });
224
- }
225
- destroy() {
226
- this._destroy$.next(), this._destroy$.complete(), this.$.complete(), this.error$.complete();
227
- }
228
- };
229
- o.type = "collection", o.instances = /* @__PURE__ */ new Map();
230
- let u = o;
231
- const n = class n {
232
- constructor(t, e, s) {
233
- this.storageType = t, this.key = e, this._ready = !1, this._destroy$ = new p(), this.error$ = new h(null), this.defaultValue = s, this.$ = new h(s), this.storage = S(t, e), t === "memory" ? this._ready = !0 : this.initializeFromStorage();
234
- }
235
- get ready() {
236
- return this._ready;
237
- }
238
- set ready(t) {
239
- this._ready = t, this.updateState(this.$.value);
240
- }
241
- static getInstance(t, e, s) {
242
- const r = `${t}:${e}`;
243
- return this.instances.has(r) || this.instances.set(r, new n(t, e, s)), this.instances.get(r);
244
- }
245
- get value() {
246
- return this.$.getValue();
247
- }
248
- set(t, e = !0) {
249
- try {
250
- this.updateState(e ? { ...this.value, ...t } : t), this.error$.next(null);
251
- } catch (s) {
252
- const r = new i(`Error updating store: ${this.key}`, s, { value: t, merge: e });
253
- this.error$.next(r);
254
- }
255
- }
256
- clear() {
257
- this.set(this.defaultValue, !1);
258
- }
259
- replace(t) {
260
- this.updateState(t);
261
- }
262
- delete(t) {
263
- const e = { ...this.value };
264
- delete e[t], this.updateState(e);
265
- }
266
- updateState(t) {
267
- try {
268
- this.$.next(t), this.storageType !== "memory" && this.storage.save(t).catch((e) => {
269
- });
270
- } catch (e) {
271
- const s = new i(`Error updating state in ${this.key}`, e);
272
- this.error$.next(s);
273
- }
274
- }
275
- async initializeFromStorage() {
276
- try {
277
- const t = await this.storage.load();
278
- t && this.updateState({ ...this.defaultValue, ...t }), this._ready = !0;
279
- } catch (t) {
280
- const e = new i(`Error loading from ${this.storageType} storage for ${this.key}`, t);
281
- this.error$.next(e), this._ready = !0;
282
- }
283
- }
284
- setupDevTools() {
285
- typeof window < "u" && (window.__STORES__ = window.__STORES__ || {}, window.__STORES__[this.key] = { getState: () => this.value, set: this.set.bind(this), delete: this.delete.bind(this), clear: this.clear.bind(this), subscribe: (t) => {
286
- const e = this.$.subscribe(t);
287
- return () => e.unsubscribe();
288
- } });
289
- }
290
- destroy() {
291
- this._destroy$.next(), this._destroy$.complete(), this.$.complete(), this.error$.complete();
292
- }
293
- };
294
- n.type = "object", n.instances = /* @__PURE__ */ new Map();
295
- let y = n;
296
- export {
297
- d as I,
298
- $ as L,
299
- g as M,
300
- y as S,
301
- m as a,
302
- i as b,
303
- S as c,
304
- u as d
305
- };
306
- //# sourceMappingURL=context-object-BDXZ5EKJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-object-BDXZ5EKJ.js","sources":["../src/store/types.ts","../src/store/storage-manager.ts","../src/store/context-collection.ts","../src/store/context-object.ts"],"sourcesContent":["// src/store/types.ts\nimport { BehaviorSubject, Observable } from 'rxjs'\n\n/**\n * Storage types supported by the store\n */\nexport type StorageType = 'memory' | 'local' | 'session' | 'indexeddb'\n\n/**\n * Base store options\n */\nexport interface StoreOptions<T> {\n\t/** Key used for persistent storage */\n\tkey: string\n\n\t/** Storage type */\n\tstorage: StorageType\n\n\t/** Initial state */\n\tinitialState: T\n\n\t/** Enable dev tools */\n\tdevTools?: boolean\n}\n\n/**\n * Enhanced store error with type information and better context handling\n */\nexport class StoreError<T = unknown> extends Error {\n\t/** Original error that caused this store error */\n\tpublic readonly cause?: T\n\n\t/** Additional contextual information */\n\tpublic readonly context?: Record<string, unknown>\n\n\t/** Timestamp when the error occurred */\n\tpublic readonly timestamp: Date\n\n\tconstructor(message: string, cause?: T, context?: Record<string, unknown>) {\n\t\tsuper(message)\n\t\tthis.name = 'StoreError'\n\t\tthis.cause = cause\n\t\tthis.context = context\n\t\tthis.timestamp = new Date()\n\n\t\t// Capture stack trace if available\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, StoreError)\n\t\t}\n\t}\n\n\t/**\n\t * Returns a JSON-serializable representation of the error\n\t */\n\ttoJSON(): Record<string, unknown> {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.message,\n\t\t\tcause: this.cause,\n\t\t\tcontext: this.context,\n\t\t\ttimestamp: this.timestamp.toISOString(),\n\t\t\tstack: this.stack,\n\t\t}\n\t}\n}\n\n/**\n * Core store interface with improved type definitions\n */\nexport interface IStore<T extends Record<string, any>> {\n\t/** Get the current store value */\n\treadonly value: T\n\n\t/** Observable stream of store values */\n\treadonly $: BehaviorSubject<T>\n\n\t/** The default/initial value of the store */\n\treadonly defaultValue: T\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Observable<StoreError | null>\n\n\t/**\n\t * Update store value with partial data\n\t * @param value Partial data to update\n\t * @param merge Whether to merge with existing data (default: true)\n\t */\n\tset(value: Partial<T>, merge?: boolean): void\n\n\t/**\n\t * Reset store to default value\n\t */\n\tclear(): void\n\n\t/**\n\t * Replace entire store value\n\t * @param newValue New value to set\n\t */\n\treplace(newValue: T): void\n\n\t/**\n\t * Delete a specific key from the store\n\t * @param key Key to delete\n\t */\n\tdelete<K extends keyof T>(key: K): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Interface for collection stores with improved typing\n */\nexport interface ICollectionStore<T> {\n\t/** Get the current collection value */\n\treadonly value: Map<string, T>\n\n\t/** Observable stream of collection values */\n\treadonly $: BehaviorSubject<Map<string, T>>\n\n\t/** The default/initial value of the collection */\n\treadonly defaultValue: Map<string, T>\n\n\t/** Whether the store is ready (loaded from storage) */\n\tready: boolean\n\n\t/** Observable stream of store errors */\n\treadonly error$: Observable<StoreError | null>\n\n\t/**\n\t * Set a value in the collection\n\t * @param key Item key\n\t * @param value Item value\n\t */\n\tset<V = T>(key: string, value: V): void\n\n\t/**\n\t * Delete an item from the collection\n\t * @param key Item key to delete\n\t */\n\tdelete(key: string): void\n\n\t/**\n\t * Clear all items from the collection\n\t */\n\tclear(): void\n\n\t/**\n\t * Replace the entire collection\n\t * @param newValue New collection value\n\t */\n\treplace(newValue: Map<string, T>): void\n\n\t/**\n\t * Clean up resources\n\t */\n\tdestroy(): void\n}\n\n/**\n * Interface for a storage manager\n */\nexport interface IStorageManager<T> {\n\t/**\n\t * Load data from storage\n\t * @returns Promise resolving to stored data or null\n\t */\n\tload(): Promise<T | null>\n\n\t/**\n\t * Save data to storage\n\t * @param state Data to save\n\t */\n\tsave(state: T): Promise<void>\n\n\t/**\n\t * Clear data from storage\n\t */\n\tclear(): Promise<void>\n}\n\n/**\n * Factory function type for creating stores\n */\nexport type StoreFactory = <T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n) => IStore<T>\n\n/**\n * Factory function type for creating collection stores\n */\nexport type CollectionStoreFactory = <T>(\n\tinitialData: Map<string, T>,\n\tstorage: StorageType,\n\tkey: string,\n) => ICollectionStore<T>\n","import { IStorageManager, StorageType, StoreError } from './types'\n\n/**\n * Memory storage manager implementation\n */\nexport class MemoryStorageManager<T> implements IStorageManager<T> {\n\tprivate data: T | null = null\n\n\tasync load(): Promise<T | null> {\n\t\treturn this.data\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\tthis.data = state\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tthis.data = null\n\t}\n}\n\n/**\n * Local storage manager implementation\n */\nexport class LocalStorageManager<T> implements IStorageManager<T> {\n\tconstructor(private key: string) {}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst data = localStorage.getItem(this.key)\n\t\t\treturn data ? JSON.parse(data) : null\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from localStorage (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tlocalStorage.setItem(this.key, JSON.stringify(state))\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to localStorage (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to localStorage (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tlocalStorage.removeItem(this.key)\n\t}\n}\n\n/**\n * Session storage manager implementation\n */\nexport class SessionStorageManager<T> implements IStorageManager<T> {\n\tconstructor(private key: string) {}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst data = sessionStorage.getItem(this.key)\n\t\t\treturn data ? JSON.parse(data) : null\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from sessionStorage (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tsessionStorage.setItem(this.key, JSON.stringify(state))\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to sessionStorage (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to sessionStorage (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tsessionStorage.removeItem(this.key)\n\t}\n}\n\n/**\n * IndexedDB storage manager implementation with better error typing\n */\nexport class IndexedDBStorageManager<T> implements IStorageManager<T> {\n\tprivate static DB_NAME = 'StoreDB'\n\tprivate static STORE_NAME = 'states'\n\tprivate static DB_VERSION = 1\n\n\tconstructor(private key: string) {}\n\n\tprivate openDB(): Promise<IDBDatabase> {\n\t\treturn new Promise<IDBDatabase>((resolve, reject) => {\n\t\t\tconst request = indexedDB.open(IndexedDBStorageManager.DB_NAME, IndexedDBStorageManager.DB_VERSION)\n\n\t\t\trequest.onupgradeneeded = () => {\n\t\t\t\tconst db = request.result\n\t\t\t\tif (!db.objectStoreNames.contains(IndexedDBStorageManager.STORE_NAME)) {\n\t\t\t\t\tdb.createObjectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trequest.onsuccess = () => resolve(request.result)\n\t\t\trequest.onerror = () => reject(request.error)\n\t\t})\n\t}\n\n\tasync load(): Promise<T | null> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<T | null>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readonly')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.get(this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve(request.result || null)\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to load from IndexedDB (${this.key}):`, err)\n\t\t\treturn null\n\t\t}\n\t}\n\n\tasync save(state: T): Promise<void> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readwrite')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.put(state, this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve()\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to save to IndexedDB (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to save to IndexedDB (${this.key})`, err)\n\t\t}\n\t}\n\n\tasync clear(): Promise<void> {\n\t\ttry {\n\t\t\tconst db = await this.openDB()\n\t\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\t\tconst transaction = db.transaction(IndexedDBStorageManager.STORE_NAME, 'readwrite')\n\t\t\t\tconst store = transaction.objectStore(IndexedDBStorageManager.STORE_NAME)\n\t\t\t\tconst request = store.delete(this.key)\n\n\t\t\t\trequest.onsuccess = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\tresolve()\n\t\t\t\t}\n\n\t\t\t\trequest.onerror = () => {\n\t\t\t\t\tdb.close()\n\t\t\t\t\treject(request.error)\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tconsole.error(`Failed to clear from IndexedDB (${this.key}):`, err)\n\t\t\tthrow new StoreError<unknown>(`Failed to clear from IndexedDB (${this.key})`, err)\n\t\t}\n\t}\n}\n\n/**\n * Factory function to create the appropriate storage manager\n */\nexport function createStorageManager<T>(type: StorageType, key: string): IStorageManager<T> {\n\tswitch (type) {\n\t\tcase 'local':\n\t\t\treturn new LocalStorageManager<T>(key)\n\t\tcase 'session':\n\t\t\treturn new SessionStorageManager<T>(key)\n\t\tcase 'indexeddb':\n\t\t\treturn new IndexedDBStorageManager<T>(key)\n\t\tcase 'memory':\n\t\tdefault:\n\t\t\treturn new MemoryStorageManager<T>()\n\t}\n}\n","import { BehaviorSubject, Subject, throttleTime } from 'rxjs'\nimport { createStorageManager } from './storage-manager'\nimport { ICollectionStore, IStorageManager, StorageType, StoreError } from './types'\n\n/**\n * Enhanced collection store with better TypeScript support\n */\nexport default class SchmancyCollectionStore<V = any> implements ICollectionStore<V> {\n\tpublic static type = 'collection'\n\n\t// Static map to hold instances\n\tprivate static instances: Map<string, SchmancyCollectionStore<any>> = new Map()\n\n\t// State management\n\tprivate _ready: boolean = false\n\tprivate _destroy$ = new Subject<void>()\n\n\t// Observable streams - modified to match interface requirements\n\tpublic $: BehaviorSubject<Map<string, V>>\n\tpublic error$ = new BehaviorSubject<StoreError | null>(null)\n\n\t// Default value for the store\n\tpublic readonly defaultValue: Map<string, V>\n\n\t// Storage manager\n\tprivate storage: IStorageManager<Map<string, V>>\n\n\t/**\n\t * Get ready state\n\t */\n\tpublic get ready(): boolean {\n\t\treturn this._ready\n\t}\n\n\t/**\n\t * Set ready state\n\t */\n\tpublic set ready(value: boolean) {\n\t\tthis._ready = value\n\t\tthis.updateState(this.$.value)\n\t}\n\n\tprivate constructor(\n\t\tprivate storageType: StorageType,\n\t\tprivate key: string,\n\t\tdefaultValue: Map<string, V>,\n\t) {\n\t\tthis.defaultValue = defaultValue\n\t\tthis.$ = new BehaviorSubject<Map<string, V>>(new Map<string, V>())\n\t\tthis.storage = createStorageManager<Map<string, V>>(storageType, key)\n\n\t\t// Set ready immediately for memory storage\n\t\tif (storageType === 'memory') {\n\t\t\tthis._ready = true\n\t\t\tthis.updateState(new Map(defaultValue)) // Initialize with default value\n\t\t} else {\n\t\t\t// Initialize from storage\n\t\t\tthis.initializeFromStorage()\n\t\t}\n\n\t\t// Set up persistence\n\t\tthis.setupPersistence()\n\n\t\t// Setup dev tools in development\n\t\tif (import.meta.env.MODE === 'development') {\n\t\t\tthis.setupDevTools()\n\t\t}\n\t}\n\t/**\n\t * Static method to get or create an instance with proper typing\n\t */\n\tpublic static getInstance<V = any>(\n\t\tstorage: StorageType,\n\t\tkey: string,\n\t\tdefaultValue: Map<string, V>,\n\t): SchmancyCollectionStore<V> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyCollectionStore<V>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyCollectionStore<V>\n\t}\n\n\t/**\n\t * Get the current value\n\t */\n\tpublic get value(): Map<string, V> {\n\t\treturn this.$.getValue()\n\t}\n\n\t/**\n\t * Set a value in the collection with proper typing\n\t */\n\tpublic set<T = V>(key: string, value: T): void {\n\t\ttry {\n\t\t\t// Create a new Map to avoid mutating the current value\n\t\t\tconst currentValue = new Map(this.value)\n\t\t\t// Set the new value for the key\n\t\t\tcurrentValue.set(key, value as unknown as V)\n\t\t\t// Update the state with the new Map\n\t\t\tthis.updateState(currentValue)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error setting value for key ${key} in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Delete a value from the collection\n\t */\n\tpublic delete(key: string): void {\n\t\ttry {\n\t\t\tconst currentValue = new Map(this.value)\n\t\t\tcurrentValue.delete(key)\n\t\t\tthis.updateState(currentValue)\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error deleting key ${key} from ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Clear the collection\n\t */\n\tpublic clear(): void {\n\t\tthis.updateState(new Map<string, V>())\n\t}\n\n\tpublic replace(newValue: Map<string, V>): void {\n\t\tthis.updateState(newValue)\n\t}\n\n\t/**\n\t * Update the state with error handling\n\t */\n\tprivate updateState(newValue: Map<string, V>): void {\n\t\ttry {\n\t\t\tthis.$.next(newValue)\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating state in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Initialize from persistent storage\n\t */\n\tprivate async initializeFromStorage(): Promise<void> {\n\t\tif (this.storageType === 'local' || this.storageType === 'session') {\n\t\t\ttry {\n\t\t\t\tconst storedValue = await this.storage.load()\n\t\t\t\tif (storedValue) {\n\t\t\t\t\tthis.updateState(storedValue)\n\t\t\t\t}\n\t\t\t\tthis._ready = true\n\t\t\t} catch (err) {\n\t\t\t\tconst error = new StoreError<unknown>(`Error loading from ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\tthis.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t\tthis._ready = true // Mark as ready even if loading fails\n\t\t\t}\n\t\t} else if (this.storageType === 'indexeddb') {\n\t\t\tthis.loadFromIndexedDB()\n\t\t} else {\n\t\t\t// Memory storage doesn't need loading\n\t\t\tthis._ready = true\n\t\t}\n\t}\n\n\t/**\n\t * Load data from IndexedDB with better typing\n\t */\n\tprivate async loadFromIndexedDB(): Promise<void> {\n\t\ttry {\n\t\t\tconst result = await this.storage.load()\n\t\t\tthis.updateState(result || new Map<string, V>())\n\t\t\tthis._ready = true\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error loading from IndexedDB for ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\tthis._ready = true // Mark as ready even if loading fails\n\t\t}\n\t}\n\n\t/**\n\t * Set up persistence to storage\n\t */\n\tprivate setupPersistence(): void {\n\t\tif (this.storageType === 'memory') return\n\n\t\tthis.$.pipe(throttleTime(100, undefined, { leading: true, trailing: true })).subscribe(currentValue => {\n\t\t\tthis.storage.save(currentValue).catch(err => {\n\t\t\t\tconst error = new StoreError<unknown>(`Error saving to ${this.storageType} storage for ${this.key}`, err)\n\t\t\t\tthis.error$.next(error)\n\t\t\t\tconsole.error(error)\n\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprivate setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tdelete: this.delete.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tsubscribe: (callback: (state: Map<string, V>) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Clean up resources\n\t */\n\tpublic destroy(): void {\n\t\tthis._destroy$.next()\n\t\tthis._destroy$.complete()\n\t\tthis.$.complete()\n\t\tthis.error$.complete()\n\t}\n}\n","import { BehaviorSubject, Subject } from 'rxjs'\nimport { createStorageManager } from './storage-manager'\nimport { IStorageManager, IStore, StorageType, StoreError } from './types'\n\n/**\n * Enhanced store object with better TypeScript support\n */\nexport class SchmancyStoreObject<T extends Record<string, any>> implements IStore<T> {\n\tpublic static type = 'object'\n\n\t// Static map to hold instances with proper typing\n\tprivate static instances: Map<string, SchmancyStoreObject<any>> = new Map()\n\n\t// State tracking\n\tprivate _ready: boolean = false\n\tprivate _destroy$ = new Subject<void>()\n\n\t// Observable streams\n\tpublic $: BehaviorSubject<T>\n\tpublic error$ = new BehaviorSubject<StoreError | null>(null)\n\n\t// Default value for the store\n\tpublic readonly defaultValue: T\n\n\t// Storage manager\n\tprivate storage: IStorageManager<T>\n\n\t/**\n\t * Get store ready state\n\t */\n\tpublic get ready(): boolean {\n\t\treturn this._ready\n\t}\n\n\t/**\n\t * Set store ready state\n\t */\n\tpublic set ready(value: boolean) {\n\t\tthis._ready = value\n\t\tthis.updateState(this.$.value)\n\t}\n\n\t/**\n\t * Private constructor to enforce singleton pattern\n\t */\n\tprivate constructor(\n\t\tprivate storageType: StorageType,\n\t\tprivate key: string,\n\t\tdefaultValue: T,\n\t) {\n\t\tthis.defaultValue = defaultValue\n\t\tthis.$ = new BehaviorSubject<T>(defaultValue)\n\t\tthis.storage = createStorageManager<T>(storageType, key)\n\n\t\t// Set ready immediately for memory storage\n\t\tif (storageType === 'memory') {\n\t\t\tthis._ready = true\n\t\t} else {\n\t\t\t// Initialize from storage for persistent stores\n\t\t\tthis.initializeFromStorage()\n\t\t}\n\n\t\t// Setup dev tools in development\n\t\tif (import.meta.env.MODE === 'development') {\n\t\t\tthis.setupDevTools()\n\t\t}\n\t}\n\t/**\n\t * Static method to get or create an instance with strong typing\n\t */\n\tpublic static getInstance<T extends Record<string, any>>(\n\t\tstorage: StorageType,\n\t\tkey: string,\n\t\tdefaultValue: T,\n\t): SchmancyStoreObject<T> {\n\t\tconst instanceKey = `${storage}:${key}`\n\t\tif (!this.instances.has(instanceKey)) {\n\t\t\tthis.instances.set(instanceKey, new SchmancyStoreObject<T>(storage, key, defaultValue))\n\t\t}\n\t\treturn this.instances.get(instanceKey) as SchmancyStoreObject<T>\n\t}\n\n\t/**\n\t * Get the current value from the store\n\t */\n\tpublic get value(): T {\n\t\treturn this.$.getValue()\n\t}\n\n\t/**\n\t * Set state with proper typing\n\t */\n\tpublic set(value: Partial<T>, merge: boolean = true): void {\n\t\ttry {\n\t\t\tthis.updateState(merge ? { ...this.value, ...value } : (value as T))\n\t\t\tthis.error$.next(null) // Clear any previous errors\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating store: ${this.key}`, err, { value, merge })\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Reset the store to its default value\n\t */\n\tpublic clear(): void {\n\t\tthis.set(this.defaultValue, false)\n\t}\n\n\t/**\n\t * Replace the store with a new value\n\t */\n\tpublic replace(newValue: T): void {\n\t\tthis.updateState(newValue)\n\t}\n\n\t/**\n\t * Delete a specific key from the store with type checking\n\t */\n\tpublic delete<K extends keyof T>(key: K): void {\n\t\tconst value = { ...this.value }\n\t\tdelete value[key]\n\t\tthis.updateState(value)\n\t}\n\n\t/**\n\t * Update the state with proper error handling\n\t */\n\tprivate updateState(newValue: T): void {\n\t\ttry {\n\t\t\tthis.$.next(newValue)\n\n\t\t\t// Persist to storage\n\t\t\tif (this.storageType !== 'memory') {\n\t\t\t\tthis.storage.save(newValue).catch(err => {\n\t\t\t\t\tconsole.error(`Error saving to ${this.storageType} storage:`, err)\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error updating state in ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t}\n\t}\n\n\t/**\n\t * Initialize the store from persistent storage\n\t */\n\tprivate async initializeFromStorage(): Promise<void> {\n\t\ttry {\n\t\t\tconst storedValue = await this.storage.load()\n\t\t\tif (storedValue) {\n\t\t\t\tthis.updateState({ ...this.defaultValue, ...storedValue })\n\t\t\t}\n\t\t\tthis._ready = true\n\t\t} catch (err) {\n\t\t\tconst error = new StoreError<unknown>(`Error loading from ${this.storageType} storage for ${this.key}`, err)\n\t\t\tthis.error$.next(error)\n\t\t\tconsole.error(error)\n\t\t\tthis._ready = true // Mark as ready even if loading fails\n\t\t}\n\t}\n\n\t/**\n\t * Setup development tools for debugging\n\t */\n\tprivate setupDevTools(): void {\n\t\tif (typeof window !== 'undefined') {\n\t\t\t// Add to global store registry\n\t\t\t;(window as any).__STORES__ = (window as any).__STORES__ || {}\n\t\t\t;(window as any).__STORES__[this.key] = {\n\t\t\t\tgetState: () => this.value,\n\t\t\t\tset: this.set.bind(this),\n\t\t\t\tdelete: this.delete.bind(this),\n\t\t\t\tclear: this.clear.bind(this),\n\t\t\t\tsubscribe: (callback: (state: T) => void) => {\n\t\t\t\t\tconst subscription = this.$.subscribe(callback)\n\t\t\t\t\treturn () => subscription.unsubscribe()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Clean up resources\n\t */\n\tpublic destroy(): void {\n\t\tthis._destroy$.next()\n\t\tthis._destroy$.complete()\n\t\tthis.$.complete()\n\t\tthis.error$.complete()\n\t}\n}\n"],"names":["StoreError","Error","message","cause","context","super","this","name","timestamp","Date","captureStackTrace","toISOString","stack","MemoryStorageManager","constructor","data","state","clear","LocalStorageManager","key","load","localStorage","getItem","JSON","parse","setItem","stringify","err","removeItem","SessionStorageManager","sessionStorage","save","IndexedDBStorageManager","Promise","resolve","reject","request","indexedDB","open","DB_NAME","DB_VERSION","onupgradeneeded","db","result","objectStoreNames","contains","STORE_NAME","createObjectStore","onsuccess","onerror","error","openDB","transaction","objectStore","get","close","put","delete","_a","createStorageManager","type","SchmancyCollectionStore","storageType","defaultValue","_ready","_destroy$","Subject","error$","BehaviorSubject","$","Map","storage","updateState","initializeFromStorage","setupPersistence","ready","value","getInstance","instanceKey","instances","has","set","getValue","currentValue","next","newValue","storedValue","loadFromIndexedDB","pipe","throttleTime","leading","trailing","subscribe","catch","window","__STORES__","getState","bind","callback","subscription","unsubscribe","complete","_c","SchmancyStoreObject","merge","_l"],"mappings":";AA4BO,MAAMA,UAAgCC,MAU5C;AAAA,EAAA,YAAYC,GAAiBC,GAAWC,GACvCC;AAAAA,UAAMH,CACNI,GAAAA,KAAKC,OAAO,cACZD,KAAKH,QAAQA,GACbG,KAAKF,UAAUA,GACVE,KAAAE,gCAAgBC,QAGjBR,MAAMS,qBACHT,MAAAS,kBAAkBJ,MAAMN,CAC/B;AAAA,EAAA;AAAA,EAMD,SACQ;AAAA,WAAA,EACNO,MAAMD,KAAKC,MACXL,SAASI,KAAKJ,SACdC,OAAOG,KAAKH,OACZC,SAASE,K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E,WACHhF,KAAKkE,YAAY,EAAKlE,GAAAA,KAAKyD,iBAAiBuB,EAE7ChF,CAAAA,GAAAA,KAAK0D,SAAS;AAAA,aACNrC,GACF;AAAA,YAAAuB,IAAQ,IAAIlD,EAAoB,sBAAsBM,KAAKwD,2BAA2BxD,KAAKa,GAAAA,IAAOQ,CACnGrB;AAAAA,WAAA6D,OAAOiB,KAAKlC,CAAAA,GAEjB5C,KAAK0D,SAAAA;AAAAA,IAAS;AAAA,EACf;AAAA,EAMO;AACe,IAAX8B,OAAAA,SAAW,QAEJA,OAAAC,aAAcD,OAAeC,cAAc,CAAC,GAC5CD,OAAAC,WAAWzF,KAAKa,GAAAA,IAAO,EACvC6E,UAAU,MAAM1F,KAAKsE,OACrBK,KAAK3E,KAAK2E,IAAIgB,KAAK3F,IACnBmD,GAAAA,QAAQnD,KAAKmD,OAAOwC,KAAK3F,IACzBW,GAAAA,OAAOX,KAAKW,MAAMgF,KAAK3F,IACvBsF,GAAAA,WAAYM,OACX;AAAA,YAAMC,IAAe7F,KAAK+D,EAAEuB,UAAUM,CAAAA;AAC/B,aAAA,MAAMC,EAAaC,YAAY;AAAA,IAAA,EAAA;AAAA,EAGzC;AAAA,EAMM;AACN9F,SAAK2D,UAAUmB,KACf9E,GAAAA,KAAK2D,UAAUoC,SAAAA,GACf/F,KAAK+D,EAAEgC,YACP/F,KAAK6D,OAAOkC,SAAS;AAAA,EAAA;AAAA;AAvLtB/F,EAAcsD,OAAO,UAGNtD,EAAAyE,gCAAuDT;AAJhE,IAAMiC,IAANE;"}
@@ -1,2 +0,0 @@
1
- "use strict";const o=require("rxjs");class a extends Error{constructor(t,e,s){super(t),this.name="StoreError",this.cause=e,this.context=s,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,a)}toJSON(){return{name:this.name,message:this.message,cause:this.cause,context:this.context,timestamp:this.timestamp.toISOString(),stack:this.stack}}}class g{constructor(){this.data=null}async load(){return this.data}async save(t){this.data=t}async clear(){this.data=null}}class p{constructor(t){this.key=t}async load(){try{const t=localStorage.getItem(this.key);return t?JSON.parse(t):null}catch{return null}}async save(t){try{localStorage.setItem(this.key,JSON.stringify(t))}catch(e){throw new a(`Failed to save to localStorage (${this.key})`,e)}}async clear(){localStorage.removeItem(this.key)}}class w{constructor(t){this.key=t}async load(){try{const t=sessionStorage.getItem(this.key);return t?JSON.parse(t):null}catch{return null}}async save(t){try{sessionStorage.setItem(this.key,JSON.stringify(t))}catch(e){throw new a(`Failed to save to sessionStorage (${this.key})`,e)}}async clear(){sessionStorage.removeItem(this.key)}}const i=class i{constructor(t){this.key=t}openDB(){return new Promise((t,e)=>{const s=indexedDB.open(i.DB_NAME,i.DB_VERSION);s.onupgradeneeded=()=>{const r=s.result;r.objectStoreNames.contains(i.STORE_NAME)||r.createObjectStore(i.STORE_NAME)},s.onsuccess=()=>t(s.result),s.onerror=()=>e(s.error)})}async load(){try{const t=await this.openDB();return new Promise((e,s)=>{const r=t.transaction(i.STORE_NAME,"readonly").objectStore(i.STORE_NAME).get(this.key);r.onsuccess=()=>{t.close(),e(r.result||null)},r.onerror=()=>{t.close(),s(r.error)}})}catch{return null}}async save(t){try{const e=await this.openDB();return new Promise((s,r)=>{const d=e.transaction(i.STORE_NAME,"readwrite").objectStore(i.STORE_NAME).put(t,this.key);d.onsuccess=()=>{e.close(),s()},d.onerror=()=>{e.close(),r(d.error)}})}catch(e){throw new a(`Failed to save to IndexedDB (${this.key})`,e)}}async clear(){try{const t=await this.openDB();return new Promise((e,s)=>{const r=t.transaction(i.STORE_NAME,"readwrite").objectStore(i.STORE_NAME).delete(this.key);r.onsuccess=()=>{t.close(),e()},r.onerror=()=>{t.close(),s(r.error)}})}catch(t){throw new a(`Failed to clear from IndexedDB (${this.key})`,t)}}};i.DB_NAME="StoreDB",i.STORE_NAME="states",i.DB_VERSION=1;let l=i;function S(h,t){switch(h){case"local":return new p(t);case"session":return new w(t);case"indexeddb":return new l(t);default:return new g}}const n=class n{constructor(t,e,s){this.storageType=t,this.key=e,this._ready=!1,this._destroy$=new o.Subject,this.error$=new o.BehaviorSubject(null),this.defaultValue=s,this.$=new o.BehaviorSubject(new Map),this.storage=S(t,e),t==="memory"?(this._ready=!0,this.updateState(new Map(s))):this.initializeFromStorage(),this.setupPersistence()}get ready(){return this._ready}set ready(t){this._ready=t,this.updateState(this.$.value)}static getInstance(t,e,s){const r=`${t}:${e}`;return this.instances.has(r)||this.instances.set(r,new n(t,e,s)),this.instances.get(r)}get value(){return this.$.getValue()}set(t,e){try{const s=new Map(this.value);s.set(t,e),this.updateState(s),this.error$.next(null)}catch(s){const r=new a(`Error setting value for key ${t} in ${this.key}`,s);this.error$.next(r)}}delete(t){try{const e=new Map(this.value);e.delete(t),this.updateState(e),this.error$.next(null)}catch(e){const s=new a(`Error deleting key ${t} from ${this.key}`,e);this.error$.next(s)}}clear(){this.updateState(new Map)}replace(t){this.updateState(t)}updateState(t){try{this.$.next(t)}catch(e){const s=new a(`Error updating state in ${this.key}`,e);this.error$.next(s)}}async initializeFromStorage(){if(this.storageType==="local"||this.storageType==="session")try{const t=await this.storage.load();t&&this.updateState(t),this._ready=!0}catch(t){const e=new a(`Error loading from ${this.storageType} storage for ${this.key}`,t);this.error$.next(e),this._ready=!0}else this.storageType==="indexeddb"?this.loadFromIndexedDB():this._ready=!0}async loadFromIndexedDB(){try{const t=await this.storage.load();this.updateState(t||new Map),this._ready=!0}catch(t){const e=new a(`Error loading from IndexedDB for ${this.key}`,t);this.error$.next(e),this._ready=!0}}setupPersistence(){this.storageType!=="memory"&&this.$.pipe(o.throttleTime(100,void 0,{leading:!0,trailing:!0})).subscribe(t=>{this.storage.save(t).catch(e=>{const s=new a(`Error saving to ${this.storageType} storage for ${this.key}`,e);this.error$.next(s)})})}setupDevTools(){typeof window<"u"&&(window.__STORES__=window.__STORES__||{},window.__STORES__[this.key]={getState:()=>this.value,set:this.set.bind(this),delete:this.delete.bind(this),clear:this.clear.bind(this),subscribe:t=>{const e=this.$.subscribe(t);return()=>e.unsubscribe()}})}destroy(){this._destroy$.next(),this._destroy$.complete(),this.$.complete(),this.error$.complete()}};n.type="collection",n.instances=new Map;let u=n;const c=class c{constructor(t,e,s){this.storageType=t,this.key=e,this._ready=!1,this._destroy$=new o.Subject,this.error$=new o.BehaviorSubject(null),this.defaultValue=s,this.$=new o.BehaviorSubject(s),this.storage=S(t,e),t==="memory"?this._ready=!0:this.initializeFromStorage()}get ready(){return this._ready}set ready(t){this._ready=t,this.updateState(this.$.value)}static getInstance(t,e,s){const r=`${t}:${e}`;return this.instances.has(r)||this.instances.set(r,new c(t,e,s)),this.instances.get(r)}get value(){return this.$.getValue()}set(t,e=!0){try{this.updateState(e?{...this.value,...t}:t),this.error$.next(null)}catch(s){const r=new a(`Error updating store: ${this.key}`,s,{value:t,merge:e});this.error$.next(r)}}clear(){this.set(this.defaultValue,!1)}replace(t){this.updateState(t)}delete(t){const e={...this.value};delete e[t],this.updateState(e)}updateState(t){try{this.$.next(t),this.storageType!=="memory"&&this.storage.save(t).catch(e=>{})}catch(e){const s=new a(`Error updating state in ${this.key}`,e);this.error$.next(s)}}async initializeFromStorage(){try{const t=await this.storage.load();t&&this.updateState({...this.defaultValue,...t}),this._ready=!0}catch(t){const e=new a(`Error loading from ${this.storageType} storage for ${this.key}`,t);this.error$.next(e),this._ready=!0}}setupDevTools(){typeof window<"u"&&(window.__STORES__=window.__STORES__||{},window.__STORES__[this.key]={getState:()=>this.value,set:this.set.bind(this),delete:this.delete.bind(this),clear:this.clear.bind(this),subscribe:t=>{const e=this.$.subscribe(t);return()=>e.unsubscribe()}})}destroy(){this._destroy$.next(),this._destroy$.complete(),this.$.complete(),this.error$.complete()}};c.type="object",c.instances=new Map;let y=c;exports.IndexedDBStorageManager=l,exports.LocalStorageManager=p,exports.MemoryStorageManager=g,exports.SchmancyCollectionStore=u,exports.SchmancyStoreObject=y,exports.SessionStorageManager=w,exports.StoreError=a,exports.createStorageManager=S;
2
- //# sourceMappingURL=context-object-BIywslrO.cjs.map