@apple-pie/slice 0.1.9 → 0.1.11

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 (300) hide show
  1. package/dist/cjs/chunks/{Avatar-Czt-12Ih.js → Avatar-CUaQ3kN1.js} +5 -5
  2. package/dist/cjs/chunks/{AvatarGroup-CGH2zY7a.js → AvatarGroup-B3M7o4Hh.js} +23 -20
  3. package/dist/cjs/chunks/{Button-mVVfNCqC.js → Button-ID8wGXIa.js} +12 -11
  4. package/dist/cjs/chunks/{ButtonBar-CFAb4bfQ.js → ButtonBar-BZ6sme27.js} +7 -7
  5. package/dist/cjs/chunks/{Camera-BGV_tNUP.js → Camera-rVC4KI4v.js} +1 -1
  6. package/dist/cjs/chunks/{CheckBox-DyOgP15i.js → CheckBox-DQRLqTAK.js} +1 -1
  7. package/dist/cjs/chunks/{Chip-Z8erRdWG.js → Chip-CflUNqhY.js} +11 -10
  8. package/dist/cjs/chunks/{DivInput-DdZA8S1k.js → DivInput-DrwFMexA.js} +4 -4
  9. package/dist/cjs/chunks/{DropDown-Ce8aU2va.js → DropDown-C3AZ5b_b.js} +49 -50
  10. package/dist/cjs/chunks/{ErrorSummary-By4CjJ9a.js → ErrorSummary-BTgAd3sK.js} +47 -25
  11. package/dist/cjs/chunks/{FileList-CCAtVNDo.js → FileList-BHwBIics.js} +4 -4
  12. package/dist/cjs/chunks/{Grouper-BbovOSYw.js → Grouper-D4yyHHkM.js} +1 -1
  13. package/dist/cjs/chunks/{Icon-N0YJuKQf.js → Icon-D1EB8S5r.js} +6 -5
  14. package/dist/cjs/chunks/{IconButton-BXotgG2u.js → IconButton-B07Ttxbr.js} +11 -11
  15. package/dist/cjs/chunks/{IndexedDB-BxQn7aHU.js → IndexedDB-BaVmQgkK.js} +12 -10
  16. package/dist/cjs/chunks/Label-CTzvGcds.js +102 -0
  17. package/dist/cjs/chunks/{Pager-Da9AqSFN.js → Pager-BN37VYEC.js} +1 -1
  18. package/dist/cjs/chunks/{ProgressIndicator-CyFcr6Dk.js → ProgressIndicator-BGqIwycX.js} +1 -1
  19. package/dist/cjs/chunks/{PromptInput-B-Wlfnhx.js → PromptInput-D0aehf9X.js} +1 -1
  20. package/dist/cjs/chunks/{RadioButton-B8GIKGm-.js → RadioButton-DuIsM4lu.js} +21 -17
  21. package/dist/cjs/chunks/{RadioButtonList-3o1IvhdC.js → RadioButtonList-bu11ILyw.js} +20 -13
  22. package/dist/cjs/chunks/{Switch-BiTshVLM.js → Switch-Cbn0ql3B.js} +15 -11
  23. package/dist/cjs/chunks/{TabBar-DZ2y7owf.js → TabBar-Bcq_n4Mk.js} +8 -8
  24. package/dist/cjs/chunks/{TextArea-D7E8loob.js → TextArea-CEwhpWXT.js} +17 -24
  25. package/dist/cjs/chunks/{TextField-BAcYBHb1.js → TextField-Dl9sTcC4.js} +50 -70
  26. package/dist/cjs/chunks/{Tip-59T3TUN4.js → Tip-BTIo1xG2.js} +7 -6
  27. package/dist/cjs/chunks/{Toast-skIBuJ3b.js → Toast-CZzAWG0S.js} +1 -1
  28. package/dist/cjs/chunks/{UploadArea-Bfrwzo4O.js → UploadArea-z9-1YjIV.js} +6 -6
  29. package/dist/cjs/chunks/localDBStore-zyDhaEiP.js +289 -0
  30. package/dist/cjs/components/Avatar/index.js +1 -1
  31. package/dist/cjs/components/AvatarGroup/index.js +2 -2
  32. package/dist/cjs/components/Button/index.js +3 -3
  33. package/dist/cjs/components/ButtonBar/index.js +2 -2
  34. package/dist/cjs/components/Camera/index.js +3 -3
  35. package/dist/cjs/components/CheckBox/index.js +2 -2
  36. package/dist/cjs/components/Chip/index.js +2 -2
  37. package/dist/cjs/components/DivInput/index.js +1 -1
  38. package/dist/cjs/components/DropDown/index.js +2 -2
  39. package/dist/cjs/components/ErrorSummary/index.js +6 -2
  40. package/dist/cjs/components/FileList/index.js +3 -3
  41. package/dist/cjs/components/Grouper/index.js +2 -2
  42. package/dist/cjs/components/Icon/index.js +1 -1
  43. package/dist/cjs/components/IconButton/index.js +2 -2
  44. package/dist/cjs/components/Label/index.js +7 -5
  45. package/dist/cjs/components/Pager/index.js +1 -1
  46. package/dist/cjs/components/Progress/index.js +2 -2
  47. package/dist/cjs/components/PromptInput/index.js +5 -5
  48. package/dist/cjs/components/RadioButton/index.js +2 -2
  49. package/dist/cjs/components/RadioButtonList/index.js +3 -3
  50. package/dist/cjs/components/Switch/index.js +1 -1
  51. package/dist/cjs/components/TabBar/index.js +3 -3
  52. package/dist/cjs/components/TextArea/index.js +4 -4
  53. package/dist/cjs/components/Textfield/index.js +5 -6
  54. package/dist/cjs/components/Tip/index.js +1 -1
  55. package/dist/cjs/components/Toast/index.js +2 -2
  56. package/dist/cjs/components/UploadArea/index.js +7 -8
  57. package/dist/cjs/index.js +8 -3
  58. package/dist/cjs/stores/LocalDB.js +6 -5
  59. package/dist/cjs/stores.js +7 -7
  60. package/dist/cjs/utils/index.js +1 -1
  61. package/dist/cjs/utils/objects/index.js +1 -1
  62. package/dist/css/flexBox.module.css +85 -0
  63. package/dist/css/type.module.css +206 -0
  64. package/dist/esm/chunks/{Avatar-DCCbj2eA.mjs → Avatar-CSLVUF_y.mjs} +5 -5
  65. package/dist/esm/chunks/{AvatarGroup-BaD2Xmda.mjs → AvatarGroup--ELW-bO1.mjs} +23 -20
  66. package/dist/esm/chunks/{Button-m0XAJsq5.mjs → Button-D24zg6UY.mjs} +13 -12
  67. package/dist/esm/chunks/{ButtonBar-CNQHRn77.mjs → ButtonBar-DXK8meQq.mjs} +7 -7
  68. package/dist/esm/chunks/{Camera-7TuowjX_.mjs → Camera-BqmVsVKy.mjs} +2 -2
  69. package/dist/esm/chunks/{CheckBox-DO9hTdv8.mjs → CheckBox-BsaYFNC6.mjs} +1 -1
  70. package/dist/esm/chunks/{Chip-BqneFUOR.mjs → Chip-DdgYV-Ct.mjs} +11 -10
  71. package/dist/esm/chunks/{DivInput-Ch9XjfWd.mjs → DivInput-B7sawFbK.mjs} +4 -4
  72. package/dist/esm/chunks/{DropDown-Cvf2d_3u.mjs → DropDown-DOJvg96J.mjs} +48 -51
  73. package/dist/esm/chunks/{ErrorSummary-S0shes-m.mjs → ErrorSummary-CHLkvdHk.mjs} +52 -27
  74. package/dist/esm/chunks/{FileList-Ckix8gUY.mjs → FileList-5LElsgoE.mjs} +5 -5
  75. package/dist/esm/chunks/{Grouper-B_FutfjV.mjs → Grouper-DR14qDXP.mjs} +1 -1
  76. package/dist/esm/chunks/{Icon-C92f63Ib.mjs → Icon-CUSQtytG.mjs} +6 -5
  77. package/dist/esm/chunks/{IconButton-4O5S9S9G.mjs → IconButton-DG69Vlhj.mjs} +11 -11
  78. package/dist/esm/chunks/{IndexedDB-CNOziQ6p.mjs → IndexedDB-CJgzPHPB.mjs} +12 -10
  79. package/dist/esm/chunks/Label-CRsE7o3D.mjs +115 -0
  80. package/dist/esm/chunks/{Pager-BlLYeA2F.mjs → Pager-BYT7_mCb.mjs} +1 -1
  81. package/dist/esm/chunks/{ProgressIndicator-CfM2c4ty.mjs → ProgressIndicator-D7paCpgY.mjs} +1 -1
  82. package/dist/esm/chunks/{PromptInput-Cmist_vy.mjs → PromptInput-yf2ir2-x.mjs} +3 -3
  83. package/dist/esm/chunks/{RadioButton-COEnChNW.mjs → RadioButton-B5ZF5oJ_.mjs} +22 -18
  84. package/dist/esm/chunks/{RadioButtonList-De3rbLQb.mjs → RadioButtonList-D9ZAZgkK.mjs} +22 -13
  85. package/dist/esm/chunks/{Switch-Cv6LABsW.mjs → Switch-BhCOo5Lu.mjs} +15 -11
  86. package/dist/esm/chunks/{TabBar-qiozE5zA.mjs → TabBar-BK7OcjPl.mjs} +9 -9
  87. package/dist/esm/chunks/{TextArea-Ff5hxF1H.mjs → TextArea-CWmzQA0V.mjs} +18 -25
  88. package/dist/esm/chunks/{TextField-CGOR6507.mjs → TextField-6Aq-AT47.mjs} +54 -72
  89. package/dist/esm/chunks/{Tip-CroDIKO4.mjs → Tip-DfmcLbBf.mjs} +7 -6
  90. package/dist/esm/chunks/{Toast-CM493gMR.mjs → Toast-DPHLwDES.mjs} +1 -1
  91. package/dist/esm/chunks/{UploadArea-6z-mVZs3.mjs → UploadArea-igD1l2Ht.mjs} +9 -9
  92. package/dist/esm/chunks/localDBStore-B4jkR5Jx.mjs +297 -0
  93. package/dist/esm/components/Avatar/index.mjs +1 -1
  94. package/dist/esm/components/AvatarGroup/index.mjs +2 -2
  95. package/dist/esm/components/Button/index.mjs +3 -3
  96. package/dist/esm/components/ButtonBar/index.mjs +2 -2
  97. package/dist/esm/components/Camera/index.mjs +3 -3
  98. package/dist/esm/components/CheckBox/index.mjs +2 -2
  99. package/dist/esm/components/Chip/index.mjs +2 -2
  100. package/dist/esm/components/DivInput/index.mjs +1 -1
  101. package/dist/esm/components/DropDown/index.mjs +5 -5
  102. package/dist/esm/components/ErrorSummary/index.mjs +21 -1
  103. package/dist/esm/components/FileList/index.mjs +3 -3
  104. package/dist/esm/components/Grouper/index.mjs +2 -2
  105. package/dist/esm/components/Icon/index.mjs +1 -1
  106. package/dist/esm/components/IconButton/index.mjs +2 -2
  107. package/dist/esm/components/Label/index.mjs +1 -19
  108. package/dist/esm/components/Pager/index.mjs +1 -1
  109. package/dist/esm/components/Progress/index.mjs +2 -2
  110. package/dist/esm/components/PromptInput/index.mjs +5 -5
  111. package/dist/esm/components/RadioButton/index.mjs +2 -2
  112. package/dist/esm/components/RadioButtonList/index.mjs +4 -4
  113. package/dist/esm/components/Switch/index.mjs +1 -1
  114. package/dist/esm/components/TabBar/index.mjs +3 -3
  115. package/dist/esm/components/TextArea/index.mjs +4 -4
  116. package/dist/esm/components/Textfield/index.mjs +7 -7
  117. package/dist/esm/components/Tip/index.mjs +1 -1
  118. package/dist/esm/components/Toast/index.mjs +2 -2
  119. package/dist/esm/components/UploadArea/index.mjs +7 -7
  120. package/dist/esm/index.mjs +27 -27
  121. package/dist/esm/stores/LocalDB.mjs +6 -2
  122. package/dist/esm/stores.mjs +6 -2
  123. package/dist/esm/utils/index.mjs +1 -1
  124. package/dist/esm/utils/objects/index.mjs +1 -1
  125. package/dist/types/components/Avatar/Avatar.d.ts +3 -0
  126. package/dist/types/components/Avatar/_types.d.ts +25 -0
  127. package/dist/types/components/Avatar/index.d.ts +2 -0
  128. package/dist/types/components/AvatarGroup/AvatarGroup.d.ts +3 -0
  129. package/dist/types/components/AvatarGroup/_types.d.ts +28 -0
  130. package/dist/types/components/AvatarGroup/index.d.ts +2 -0
  131. package/dist/types/components/Badge/Badge.d.ts +3 -0
  132. package/dist/types/components/Badge/_types.d.ts +8 -0
  133. package/dist/types/components/Badge/index.d.ts +2 -0
  134. package/dist/types/components/Button/Button.d.ts +80 -0
  135. package/dist/types/components/Button/_types.d.ts +47 -0
  136. package/dist/types/components/Button/index.d.ts +2 -0
  137. package/dist/types/components/ButtonBar/ButtonBar.d.ts +17 -0
  138. package/dist/types/components/ButtonBar/_types.d.ts +31 -0
  139. package/dist/types/components/ButtonBar/index.d.ts +2 -0
  140. package/dist/types/components/Camera/Camera.d.ts +11 -0
  141. package/dist/types/components/Camera/_types.d.ts +79 -0
  142. package/dist/types/components/Camera/index.d.ts +2 -0
  143. package/dist/types/components/CheckBox/CheckBox.d.ts +3 -0
  144. package/dist/types/components/CheckBox/_types.d.ts +11 -0
  145. package/dist/types/components/CheckBox/index.d.ts +2 -0
  146. package/dist/types/components/Chip/Chip.d.ts +3 -0
  147. package/dist/types/components/Chip/_types.d.ts +35 -0
  148. package/dist/types/components/Chip/index.d.ts +3 -0
  149. package/dist/types/components/DivInput/DivInput.d.ts +3 -0
  150. package/dist/types/components/DivInput/_types.d.ts +25 -0
  151. package/dist/types/components/DivInput/index.d.ts +2 -0
  152. package/dist/types/components/Dot/Dot.d.ts +3 -0
  153. package/dist/types/components/Dot/_types.d.ts +19 -0
  154. package/dist/types/components/Dot/index.d.ts +2 -0
  155. package/dist/types/components/DraggablePanel/DrggablePanel.d.ts +44 -0
  156. package/dist/types/components/DraggablePanel/_types.d.ts +5 -0
  157. package/dist/types/components/DraggablePanel/index.d.ts +1 -0
  158. package/dist/types/components/DropDown/DropDown.d.ts +3 -0
  159. package/dist/types/components/DropDown/_types.d.ts +40 -0
  160. package/dist/types/components/DropDown/index.d.ts +2 -0
  161. package/dist/types/components/ErrorSummary/ErrorSummary.d.ts +3 -0
  162. package/dist/types/components/ErrorSummary/_types.d.ts +15 -0
  163. package/dist/types/components/ErrorSummary/index.d.ts +2 -0
  164. package/dist/types/components/FileIcon/FileIcon.d.ts +3 -0
  165. package/dist/types/components/FileIcon/_types.d.ts +27 -0
  166. package/dist/types/components/FileIcon/fileIconRegistry.d.ts +4 -0
  167. package/dist/types/components/FileIcon/index.d.ts +3 -0
  168. package/dist/types/components/FileList/FileList.d.ts +3 -0
  169. package/dist/types/components/FileList/_types.d.ts +25 -0
  170. package/dist/types/components/FileList/index.d.ts +2 -0
  171. package/dist/types/components/FlexDiv/FlexDiv.d.ts +60 -0
  172. package/dist/types/components/FlexDiv/_types.d.ts +34 -0
  173. package/dist/types/components/FlexDiv/index.d.ts +2 -0
  174. package/dist/types/components/Grouper/Grouper.d.ts +3 -0
  175. package/dist/types/components/Grouper/_types.d.ts +20 -0
  176. package/dist/types/components/Grouper/index.d.ts +2 -0
  177. package/dist/types/components/Icon/Icon.d.ts +3 -0
  178. package/dist/types/components/Icon/_types.d.ts +131 -0
  179. package/dist/types/components/Icon/iconRegistry.d.ts +17 -0
  180. package/dist/types/components/Icon/index.d.ts +2 -0
  181. package/dist/types/components/IconButton/IconButton.d.ts +3 -0
  182. package/dist/types/components/IconButton/_types.d.ts +37 -0
  183. package/dist/types/components/IconButton/index.d.ts +2 -0
  184. package/dist/types/components/Label/Label.d.ts +2 -0
  185. package/dist/types/components/Label/_types.d.ts +26 -0
  186. package/dist/types/components/Label/index.d.ts +3 -0
  187. package/dist/types/components/Overlay/Overlay.d.ts +3 -0
  188. package/dist/types/components/Overlay/_types.d.ts +12 -0
  189. package/dist/types/components/Overlay/index.d.ts +2 -0
  190. package/dist/types/components/Pager/Pager.d.ts +3 -0
  191. package/dist/types/components/Pager/_types.d.ts +13 -0
  192. package/dist/types/components/Pager/index.d.ts +2 -0
  193. package/dist/types/components/Progress/DoneCheck/DoneCheck.d.ts +3 -0
  194. package/dist/types/components/Progress/DoneCheck/_types.d.ts +13 -0
  195. package/dist/types/components/Progress/ProgressIndicator/ProgressIndicator.d.ts +3 -0
  196. package/dist/types/components/Progress/ProgressIndicator/_types.d.ts +14 -0
  197. package/dist/types/components/Progress/index.d.ts +4 -0
  198. package/dist/types/components/PromptInput/PromptInput.d.ts +63 -0
  199. package/dist/types/components/PromptInput/_types.d.ts +35 -0
  200. package/dist/types/components/PromptInput/index.d.ts +2 -0
  201. package/dist/types/components/RadioButton/RadioButton.d.ts +3 -0
  202. package/dist/types/components/RadioButton/_types.d.ts +27 -0
  203. package/dist/types/components/RadioButton/index.d.ts +2 -0
  204. package/dist/types/components/RadioButtonList/RadioButtonList.d.ts +3 -0
  205. package/dist/types/components/RadioButtonList/_types.d.ts +26 -0
  206. package/dist/types/components/RadioButtonList/index.d.ts +2 -0
  207. package/dist/types/components/Slider/Slider.d.ts +3 -0
  208. package/dist/types/components/Slider/_types.d.ts +18 -0
  209. package/dist/types/components/Slider/index.d.ts +2 -0
  210. package/dist/types/components/Spacer/Spacer.d.ts +3 -0
  211. package/dist/types/components/Spacer/_types.d.ts +6 -0
  212. package/dist/types/components/Spacer/index.d.ts +2 -0
  213. package/dist/types/components/Switch/Switch.d.ts +3 -0
  214. package/dist/types/components/Switch/Switch.stories.d.ts +5 -0
  215. package/dist/types/components/Switch/_types.d.ts +17 -0
  216. package/dist/types/components/Switch/index.d.ts +2 -0
  217. package/dist/types/components/TabBar/TabBar.d.ts +3 -0
  218. package/dist/types/components/TabBar/_types.d.ts +52 -0
  219. package/dist/types/components/TabBar/index.d.ts +2 -0
  220. package/dist/types/components/TextArea/TextArea.d.ts +3 -0
  221. package/dist/types/components/TextArea/_types.d.ts +40 -0
  222. package/dist/types/components/TextArea/index.d.ts +2 -0
  223. package/dist/types/components/Textfield/TextField.d.ts +3 -0
  224. package/dist/types/components/Textfield/_types.d.ts +73 -0
  225. package/dist/types/components/Textfield/index.d.ts +2 -0
  226. package/dist/types/components/Tip/Tip.d.ts +3 -0
  227. package/dist/types/components/Tip/_types.d.ts +31 -0
  228. package/dist/types/components/Tip/index.d.ts +2 -0
  229. package/dist/types/components/Toast/Toast.d.ts +3 -0
  230. package/dist/types/components/Toast/_types.d.ts +24 -0
  231. package/dist/types/components/Toast/index.d.ts +2 -0
  232. package/dist/types/components/UploadArea/UploadArea.d.ts +62 -0
  233. package/dist/types/components/UploadArea/_types.d.ts +50 -0
  234. package/dist/types/components/UploadArea/index.d.ts +3 -0
  235. package/dist/types/components/playHelpers.d.ts +35 -0
  236. package/dist/types/components/sharedTypes.d.ts +21 -0
  237. package/dist/types/hooks/index.d.ts +9 -0
  238. package/dist/types/hooks/useDoubleClick/useDoubleClick.d.ts +1 -0
  239. package/dist/types/hooks/useKeyboardShortcuts/useKeyboardShortcuts.d.ts +9 -0
  240. package/dist/types/hooks/useLastUpdated/useLastUpdated.d.ts +4 -0
  241. package/dist/types/hooks/useLocalStore/useLocalStore.d.ts +1 -0
  242. package/dist/types/hooks/useObserveResize/useObserveResize.d.ts +9 -0
  243. package/dist/types/hooks/useObserveTheme/useObserveTheme.d.ts +2 -0
  244. package/dist/types/hooks/useTheme/useTheme.d.ts +47 -0
  245. package/dist/types/hooks/useToolTip/useToolTip.d.ts +6 -0
  246. package/dist/types/hooks/useTrackRenders/useTrackRenders.d.ts +5 -0
  247. package/dist/types/hooks/useWindow/useWindow.d.ts +43 -0
  248. package/dist/types/index.d.ts +75 -0
  249. package/dist/types/providers/ThemeProvider.d.ts +13 -0
  250. package/dist/types/providers/index.d.ts +1 -0
  251. package/dist/types/stores/LocalDB/_types.d.ts +43 -0
  252. package/dist/types/stores/LocalDB/index.d.ts +2 -0
  253. package/dist/types/stores/LocalDB/localDBStore.d.ts +18 -0
  254. package/dist/types/stores/SSE/_types.d.ts +17 -0
  255. package/dist/types/stores/SSE/index.d.ts +2 -0
  256. package/dist/types/stores/SSE/sseStore.d.ts +28 -0
  257. package/dist/types/stores/WS/_types.d.ts +17 -0
  258. package/dist/types/stores/WS/index.d.ts +2 -0
  259. package/dist/types/stores/WS/wsStore.d.ts +19 -0
  260. package/dist/types/stores/index.d.ts +6 -0
  261. package/dist/types/stores/tip/_types.d.ts +8 -0
  262. package/dist/types/stores/tip/index.d.ts +2 -0
  263. package/dist/types/stores/tip/tipStore.d.ts +12 -0
  264. package/dist/types/stores/toast/_types.d.ts +14 -0
  265. package/dist/types/stores/toast/index.d.ts +2 -0
  266. package/dist/types/stores/toast/toastStore.d.ts +12 -0
  267. package/dist/types/stores/uploads/_types.d.ts +16 -0
  268. package/dist/types/stores/uploads/index.d.ts +2 -0
  269. package/dist/types/stores/uploads/uploadsStore.d.ts +22 -0
  270. package/dist/types/stores/window/_types.d.ts +33 -0
  271. package/dist/types/stores/window/index.d.ts +3 -0
  272. package/dist/types/stores/window/windowStore.d.ts +25 -0
  273. package/dist/types/theme/colors/colors.d.ts +6 -0
  274. package/dist/types/theme/colors/types.d.ts +174 -0
  275. package/dist/types/theme/corners/corners.d.ts +2 -0
  276. package/dist/types/theme/corners/types.d.ts +10 -0
  277. package/dist/types/theme/elevations/_types.d.ts +10 -0
  278. package/dist/types/theme/elevations/elevations.d.ts +5 -0
  279. package/dist/types/theme/index.d.ts +9 -0
  280. package/dist/types/theme/motion/_types.d.ts +8 -0
  281. package/dist/types/theme/motion/motion.d.ts +5 -0
  282. package/dist/types/theme/themes.d.ts +16 -0
  283. package/dist/types/theme/type/type.d.ts +5 -0
  284. package/dist/types/theme/type/types.d.ts +25 -0
  285. package/dist/types/utils/functions/colors.d.ts +8 -0
  286. package/dist/types/utils/functions/debounce.d.ts +9 -0
  287. package/dist/types/utils/functions/files.d.ts +15 -0
  288. package/dist/types/utils/functions/misc.d.ts +61 -0
  289. package/dist/types/utils/index.d.ts +5 -0
  290. package/dist/types/utils/objects/IndexedDB/IndexedDB.d.ts +62 -0
  291. package/dist/types/utils/objects/SSEConnection/SSEConnection.d.ts +187 -0
  292. package/dist/types/utils/objects/WSConnection/WSConnection.d.ts +159 -0
  293. package/dist/types/utils/objects/index.d.ts +6 -0
  294. package/dist/types/workers/uploads/uploads-worker.d.ts +129 -0
  295. package/dist/types/workers/uploads/uploads.d.ts +1 -0
  296. package/package.json +1 -1
  297. package/dist/cjs/chunks/Label-CZvJbATa.js +0 -118
  298. package/dist/cjs/chunks/localDBStore-Cl1YFPIe.js +0 -182
  299. package/dist/esm/chunks/Label-7ezP3eHw.mjs +0 -131
  300. package/dist/esm/chunks/localDBStore-CbCoeN66.mjs +0 -186
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), jsxRuntime = require("react/jsx-runtime"), React = require("react"), hooks_useTheme = require("../hooks/useTheme.js");
4
-
5
- require("../theme/colors.js"), require("../hooks/useWindow.js");
6
-
7
- var misc = require("./misc-BTF7BCZW.js"), styleInject_es = require("./style-inject.es-CMuL-BfJ.js"), css = {
8
- label: "Label-module_label__RaRvM flexBox-module_row__z24tF",
9
- button: "Label-module_button__N8bcQ type-module_body-m-regular__LuQBA",
10
- s: "Label-module_s__Zh8Gp type-module_body-s-regular__vRHSP",
11
- m: "Label-module_m__BJtGL type-module_body-m-regular__LuQBA",
12
- l: "Label-module_l__t70tt type-module_body-l-regular__lOYbg",
13
- red: "Label-module_red__yqrNW",
14
- green: "Label-module_green__R6cDO",
15
- yellow: "Label-module_yellow__IoDDg",
16
- grey: "Label-module_grey__qIkSh",
17
- lightgrey: "Label-module_lightgrey__nZC6N",
18
- white: "Label-module_white__OFwCs",
19
- blue: "Label-module_blue__lqM0T"
20
- };
21
-
22
- styleInject_es.styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__ZAFft {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__s3KvF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__Lhqqq {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__vRHSP {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__tjdFc {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__Iy-VX {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__LuQBA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__uW1on {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__UBcvQ {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__lOYbg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__BqRC7 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__Fh2dt {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__pF2kC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__BeyrH {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__Ruknj {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__z8L3G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__0O3g6 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__KXxEB {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__cJeEA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__eRe05 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Xmwtf {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__5q1m3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__k9VFV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.Label-module_label__RaRvM {\n\tdisplay: var(--label-inline) !important;\n\tline-height: 1em;\n\twhite-space: nowrap;\n\tpadding: var(--label-padding) !important;\n\twidth: min-content;\n\tcolor: var(--label-color);\n\tborder-radius: var(--label-border-radius);\n\tborder: var(--label-border-size) solid var(--core-outline-primary);\n\tcursor: var(--label-cursor);\n}\n\n.Label-module_button__N8bcQ {\n\tappearance: none;\n\t-webkit-appearance: none;\n\tbackground-image: none;\n\toutline: none;\n}\n\n.Label-module_s__Zh8Gp {\n}\n\n.Label-module_m__BJtGL {\n}\n\n.Label-module_l__t70tt {\n}\n\n.Label-module_red__yqrNW {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-light);\n\tborder-color: var(--label-border-color-red);\n}\n\n.Label-module_green__R6cDO {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-light);\n\tborder-color: var(--label-border-color-green);\n}\n\n.Label-module_yellow__IoDDg {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-primary);\n\tborder-color: var(--label-border-color-yellow);\n}\n\n.Label-module_grey__qIkSh {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-secondary);\n\tborder-color: var(--label-border-color-grey);\n}\n\n.Label-module_lightgrey__nZC6N {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-disabled);\n\tborder-color: var(--label-border-color-lightgrey);\n}\n\n.Label-module_white__OFwCs {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-primary);\n\tborder-color: var(--label-border-color-white);\n}\n\n.Label-module_blue__lqM0T {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-light);\n\tborder-color: var(--label-border-color-blue);\n}\n"),
23
- exports.Label = function(props) {
24
- const theme = hooks_useTheme.useTheme(), {children: children, state: state, noFill: noFill = !1, button: button = !1, round: round = !1, border: border = 1, padding: padding, color: color, inline: inline = !0, size: size = "m", onClick: onClick} = props, divAttributes = tslib_es6.__rest(props, [ "children", "state", "noFill", "button", "round", "border", "padding", "color", "inline", "size", "onClick" ]), {id: divId, className: className, style: style} = divAttributes, rest = tslib_es6.__rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", isInteractive = Boolean(onClick), handleClick = React.useCallback(e => {
25
- isInteractive && (null == onClick || onClick(e));
26
- }, [ isInteractive, onClick ]), backgroundColor = React.useMemo(() => {
27
- if (noFill) return "var(--core-surface-primary)";
28
- switch (state) {
29
- case "red":
30
- case "green":
31
- return theme.current.colors["feedback-warning"];
32
-
33
- case "yellow":
34
- return theme.current.colors["array-yellow"];
35
-
36
- case "grey":
37
- case "white":
38
- return theme.current.colors["core-surface-secondary"];
39
-
40
- case "lightgrey":
41
- return theme.current.colors["core-button-disabled"];
42
-
43
- case "blue":
44
- return theme.current.colors["core-button-primary"];
45
-
46
- default:
47
- return "var(--core-surface-primary)";
48
- }
49
- }, [ noFill, state, theme ]), borderColors = React.useMemo(() => {
50
- const getBorderColor = colorState => {
51
- switch (colorState) {
52
- case "red":
53
- return theme.current.colors["core-button-disabled"];
54
-
55
- case "green":
56
- return noFill ? theme.current.colors["feedback-positive"] : theme.current.colors["core-button-disabled"];
57
-
58
- case "yellow":
59
- return theme.current.colors["array-yellow-label"];
60
-
61
- case "grey":
62
- return noFill ? theme.current.colors["core-text-secondary"] : theme.current.colors["core-button-disabled"];
63
-
64
- case "lightgrey":
65
- return noFill ? theme.current.colors["core-outline-primary"] : theme.current.colors["core-button-disabled"];
66
-
67
- case "white":
68
- return noFill ? theme.current.colors["core-text-secondary"] : theme.current.colors["core-badge-secondary"];
69
-
70
- case "blue":
71
- return noFill ? theme.current.colors["core-text-secondary"] : theme.current.colors["core-button-primary"];
72
-
73
- default:
74
- return "var(--core-outline-primary)";
75
- }
76
- };
77
- return {
78
- red: getBorderColor("red"),
79
- green: getBorderColor("green"),
80
- yellow: getBorderColor("yellow"),
81
- grey: getBorderColor("grey"),
82
- lightgrey: getBorderColor("lightgrey"),
83
- white: getBorderColor("white"),
84
- blue: getBorderColor("blue")
85
- };
86
- }, [ noFill, theme ]), setPadding = React.useMemo(() => padding ? misc.setStyle(padding) : button ? "6px 12px" : "4px 6px", [ padding, button ]), cssVars = React.useMemo(() => ({
87
- "--label-padding": setPadding,
88
- "--label-border-radius": round ? "100px" : "4px",
89
- "--label-cursor": button ? "pointer" : "default",
90
- "--label-color": null != color ? color : "var(--core-text-primary)",
91
- "--label-background": backgroundColor,
92
- "--label-border-size": border ? `${border}px` : "0",
93
- "--label-border-color-red": borderColors.red,
94
- "--label-border-color-green": borderColors.green,
95
- "--label-border-color-yellow": borderColors.yellow,
96
- "--label-border-color-grey": borderColors.grey,
97
- "--label-border-color-lightgrey": borderColors.lightgrey,
98
- "--label-border-color-white": borderColors.white,
99
- "--label-border-color-blue": borderColors.blue,
100
- "--label-inline": inline ? "inline-flex" : "flex"
101
- }), [ button, border, round, backgroundColor, borderColors, setPadding, color, inline ]), classNames = [ css.label, button || isInteractive ? css.button : css.regular, state ? css[state] : "" ].filter(Boolean).join(" ");
102
- return isInteractive ? jsxRuntime.jsx("button", Object.assign({
103
- id: divId,
104
- type: "button",
105
- className: `${classNames} ${css[size]}${divClass}`,
106
- style: Object.assign(Object.assign({}, divStyle), cssVars),
107
- "aria-label": "Label button",
108
- onClick: e => handleClick(e)
109
- }, rest, {
110
- children: children
111
- })) : jsxRuntime.jsx("span", Object.assign({
112
- id: divId,
113
- className: `${classNames} ${css[size]}${divClass}`,
114
- style: Object.assign(Object.assign({}, divStyle), cssVars)
115
- }, rest, {
116
- children: children
117
- }));
118
- };
@@ -1,182 +0,0 @@
1
- "use strict";
2
-
3
- var tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), zustand = require("zustand"), IndexedDB = require("./IndexedDB-BxQn7aHU.js");
4
-
5
- function isValidIDBKey(key) {
6
- return "string" == typeof key || "number" == typeof key || key instanceof Date || key instanceof ArrayBuffer || (Array.isArray(key) ? key.every(entry => isValidIDBKey(entry)) : ArrayBuffer.isView(key));
7
- }
8
-
9
- function areKeysEqual(left, right) {
10
- return left instanceof Date && right instanceof Date ? left.getTime() === right.getTime() : Array.isArray(left) && Array.isArray(right) ? left.length === right.length && left.every((value, index) => areKeysEqual(value, right[index])) : left === right;
11
- }
12
-
13
- function normalizeValues(value) {
14
- return Array.isArray(value) ? value : [ value ];
15
- }
16
-
17
- function readStoreRecords(connection) {
18
- return tslib_es6.__awaiter(this, void 0, void 0, function*() {
19
- const [keys, values] = yield Promise.all([ connection.getAllKeys(), connection.getAll() ]);
20
- return keys.map((key, index) => {
21
- var _a;
22
- return {
23
- key: key,
24
- value: null !== (_a = values[index]) && void 0 !== _a ? _a : null
25
- };
26
- });
27
- });
28
- }
29
-
30
- function getConnection(stores, name) {
31
- const connection = stores.find(entry => entry.name === name);
32
- if (!connection) throw new Error(`IndexedDB store "${name}" is not registered.`);
33
- return connection;
34
- }
35
-
36
- function applyConnectionState(name, patch) {
37
- useLocalDBStore.setState(state => ({
38
- stores: state.stores.map(entry => entry.name === name ? Object.assign(Object.assign({}, entry), patch) : entry)
39
- }));
40
- }
41
-
42
- function applyStoreError(name, error) {
43
- applyConnectionState(name, {
44
- error: error instanceof Error ? error.message : String(error)
45
- });
46
- }
47
-
48
- function deriveRecordKey(store, value) {
49
- const keyField = function(store) {
50
- if (!store.key) throw new Error(`IndexedDB store "${store.name}" requires a configured key field for value-driven actions.`);
51
- return store.key;
52
- }(store);
53
- if (!value || "object" != typeof value) throw new Error(`IndexedDB store "${store.name}" expects object values for value-driven actions.`);
54
- const candidate = value[keyField];
55
- if (void 0 === candidate) throw new Error(`IndexedDB store "${store.name}" expected field "${keyField}" on the provided value.`);
56
- if (!isValidIDBKey(candidate)) throw new Error(`IndexedDB store "${store.name}" field "${keyField}" does not contain a valid IndexedDB key.`);
57
- return candidate;
58
- }
59
-
60
- const useLocalDBStore = zustand.create((set, get) => ({
61
- stores: [],
62
- actions: {
63
- addStore: (name_1, ...args_1) => tslib_es6.__awaiter(void 0, [ name_1, ...args_1 ], void 0, function*(name, options = {}) {
64
- var _a;
65
- const existing = get().stores.find(entry => entry.name === name);
66
- yield null == existing ? void 0 : existing.connection.close();
67
- const {create: create = !0} = options, connectionOptions = tslib_es6.__rest(options, [ "create" ]), connection = new IndexedDB.IndexedDB(name, connectionOptions);
68
- yield connection.initialize(create);
69
- const records = yield readStoreRecords(connection);
70
- !function(connection) {
71
- useLocalDBStore.setState(state => ({
72
- stores: [ ...state.stores.filter(entry => entry.name !== connection.name), connection ]
73
- }));
74
- }({
75
- name: name,
76
- connection: connection,
77
- key: null !== (_a = options.key) && void 0 !== _a ? _a : null,
78
- records: records,
79
- initialized: !0,
80
- error: null
81
- });
82
- }),
83
- removeStore: name => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
84
- const existing = get().stores.find(entry => entry.name === name);
85
- existing && (yield existing.connection.close(), set(state => ({
86
- stores: state.stores.filter(entry => entry.name !== name)
87
- })));
88
- }),
89
- refreshStore: name => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
90
- const existing = getConnection(get().stores, name), records = yield readStoreRecords(existing.connection);
91
- applyConnectionState(name, {
92
- records: records,
93
- initialized: !0,
94
- error: null
95
- });
96
- }),
97
- setValue: (name, value) => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
98
- const existing = getConnection(get().stores, name);
99
- try {
100
- const values = normalizeValues(value), resolvedKeys = [];
101
- for (const item of values) {
102
- const key = deriveRecordKey(existing, item), resolvedKey = yield existing.connection.set(key, item);
103
- resolvedKeys.push(resolvedKey);
104
- }
105
- const records = yield readStoreRecords(existing.connection);
106
- return applyConnectionState(name, {
107
- records: records,
108
- error: null
109
- }), Array.isArray(value) ? resolvedKeys : resolvedKeys[0];
110
- } catch (error) {
111
- throw applyStoreError(name, error), error;
112
- }
113
- }),
114
- addValue: (name, value) => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
115
- const existing = getConnection(get().stores, name);
116
- try {
117
- const values = normalizeValues(value), resolvedKeys = [];
118
- for (const item of values) {
119
- const resolvedKey = yield existing.connection.add(item);
120
- resolvedKeys.push(resolvedKey);
121
- }
122
- const records = yield readStoreRecords(existing.connection);
123
- return applyConnectionState(name, {
124
- records: records,
125
- error: null
126
- }), Array.isArray(value) ? resolvedKeys : resolvedKeys[0];
127
- } catch (error) {
128
- throw applyStoreError(name, error), error;
129
- }
130
- }),
131
- removeValue: (name, value) => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
132
- const existing = getConnection(get().stores, name);
133
- try {
134
- const values = normalizeValues(value);
135
- for (const item of values) {
136
- const key = deriveRecordKey(existing, item);
137
- yield existing.connection.remove(key);
138
- }
139
- const records = yield readStoreRecords(existing.connection);
140
- applyConnectionState(name, {
141
- records: records,
142
- error: null
143
- });
144
- } catch (error) {
145
- throw applyStoreError(name, error), error;
146
- }
147
- }),
148
- clearStore: name => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
149
- const existing = getConnection(get().stores, name);
150
- yield existing.connection.clear(), applyConnectionState(name, {
151
- records: [],
152
- error: null
153
- });
154
- }),
155
- destroyStore: name => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
156
- const existing = get().stores.find(entry => entry.name === name);
157
- existing && (yield existing.connection.destroy(), set(state => ({
158
- stores: state.stores.filter(entry => entry.name !== name)
159
- })));
160
- })
161
- }
162
- }));
163
-
164
- const localDBActions = useLocalDBStore.getState().actions;
165
-
166
- exports.localDBActions = localDBActions, exports.useLocalDB = name => useLocalDBStore(state => ({
167
- refresh: () => state.actions.refreshStore(name),
168
- set: value => state.actions.setValue(name, value),
169
- add: value => state.actions.addValue(name, value),
170
- remove: value => state.actions.removeValue(name, value),
171
- clear: () => state.actions.clearStore(name),
172
- destroy: () => state.actions.destroyStore(name)
173
- })), exports.useLocalDBError = name => useLocalDBStore(state => {
174
- var _a, _b;
175
- return null !== (_b = null === (_a = state.stores.find(entry => entry.name === name)) || void 0 === _a ? void 0 : _a.error) && void 0 !== _b ? _b : null;
176
- }), exports.useLocalDBStore = useLocalDBStore, exports.useLocalDBValues = function(name, fieldOrKey, value) {
177
- return useLocalDBStore(state => {
178
- var _a, _b, _c, _d;
179
- const records = null !== (_b = null === (_a = state.stores.find(entry => entry.name === name)) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : [], values = records.map(record => record.value);
180
- return void 0 === fieldOrKey ? values : void 0 === value ? null !== (_d = null === (_c = records.find(record => areKeysEqual(record.key, fieldOrKey))) || void 0 === _c ? void 0 : _c.value) && void 0 !== _d ? _d : null : values.filter(entry => (null == entry ? void 0 : entry[fieldOrKey]) === value);
181
- });
182
- };
@@ -1,131 +0,0 @@
1
- import { _ as __rest } from "./tslib.es6-c-7TIv71.mjs";
2
-
3
- import { jsx } from "react/jsx-runtime";
4
-
5
- import { useCallback, useMemo } from "react";
6
-
7
- import { useTheme } from "../hooks/useTheme.mjs";
8
-
9
- import "../theme/colors.mjs";
10
-
11
- import "../hooks/useWindow.mjs";
12
-
13
- import { s as setStyle } from "./misc-N8KLjOXc.mjs";
14
-
15
- import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
16
-
17
- var css = {
18
- label: "Label-module_label__RaRvM flexBox-module_row__z24tF",
19
- button: "Label-module_button__N8bcQ type-module_body-m-regular__LuQBA",
20
- s: "Label-module_s__Zh8Gp type-module_body-s-regular__vRHSP",
21
- m: "Label-module_m__BJtGL type-module_body-m-regular__LuQBA",
22
- l: "Label-module_l__t70tt type-module_body-l-regular__lOYbg",
23
- red: "Label-module_red__yqrNW",
24
- green: "Label-module_green__R6cDO",
25
- yellow: "Label-module_yellow__IoDDg",
26
- grey: "Label-module_grey__qIkSh",
27
- lightgrey: "Label-module_lightgrey__nZC6N",
28
- white: "Label-module_white__OFwCs",
29
- blue: "Label-module_blue__lqM0T"
30
- };
31
-
32
- function Label(props) {
33
- const theme = useTheme(), {children: children, state: state, noFill: noFill = !1, button: button = !1, round: round = !1, border: border = 1, padding: padding, color: color, inline: inline = !0, size: size = "m", onClick: onClick} = props, divAttributes = __rest(props, [ "children", "state", "noFill", "button", "round", "border", "padding", "color", "inline", "size", "onClick" ]), {id: divId, className: className, style: style} = divAttributes, rest = __rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", isInteractive = Boolean(onClick), handleClick = useCallback(e => {
34
- isInteractive && (null == onClick || onClick(e));
35
- }, [ isInteractive, onClick ]), backgroundColor = useMemo(() => {
36
- if (noFill) return "var(--core-surface-primary)";
37
- switch (state) {
38
- case "red":
39
- case "green":
40
- return theme.current.colors["feedback-warning"];
41
-
42
- case "yellow":
43
- return theme.current.colors["array-yellow"];
44
-
45
- case "grey":
46
- case "white":
47
- return theme.current.colors["core-surface-secondary"];
48
-
49
- case "lightgrey":
50
- return theme.current.colors["core-button-disabled"];
51
-
52
- case "blue":
53
- return theme.current.colors["core-button-primary"];
54
-
55
- default:
56
- return "var(--core-surface-primary)";
57
- }
58
- }, [ noFill, state, theme ]), borderColors = useMemo(() => {
59
- const getBorderColor = colorState => {
60
- switch (colorState) {
61
- case "red":
62
- return theme.current.colors["core-button-disabled"];
63
-
64
- case "green":
65
- return noFill ? theme.current.colors["feedback-positive"] : theme.current.colors["core-button-disabled"];
66
-
67
- case "yellow":
68
- return theme.current.colors["array-yellow-label"];
69
-
70
- case "grey":
71
- return noFill ? theme.current.colors["core-text-secondary"] : theme.current.colors["core-button-disabled"];
72
-
73
- case "lightgrey":
74
- return noFill ? theme.current.colors["core-outline-primary"] : theme.current.colors["core-button-disabled"];
75
-
76
- case "white":
77
- return noFill ? theme.current.colors["core-text-secondary"] : theme.current.colors["core-badge-secondary"];
78
-
79
- case "blue":
80
- return noFill ? theme.current.colors["core-text-secondary"] : theme.current.colors["core-button-primary"];
81
-
82
- default:
83
- return "var(--core-outline-primary)";
84
- }
85
- };
86
- return {
87
- red: getBorderColor("red"),
88
- green: getBorderColor("green"),
89
- yellow: getBorderColor("yellow"),
90
- grey: getBorderColor("grey"),
91
- lightgrey: getBorderColor("lightgrey"),
92
- white: getBorderColor("white"),
93
- blue: getBorderColor("blue")
94
- };
95
- }, [ noFill, theme ]), setPadding = useMemo(() => padding ? setStyle(padding) : button ? "6px 12px" : "4px 6px", [ padding, button ]), cssVars = useMemo(() => ({
96
- "--label-padding": setPadding,
97
- "--label-border-radius": round ? "100px" : "4px",
98
- "--label-cursor": button ? "pointer" : "default",
99
- "--label-color": null != color ? color : "var(--core-text-primary)",
100
- "--label-background": backgroundColor,
101
- "--label-border-size": border ? `${border}px` : "0",
102
- "--label-border-color-red": borderColors.red,
103
- "--label-border-color-green": borderColors.green,
104
- "--label-border-color-yellow": borderColors.yellow,
105
- "--label-border-color-grey": borderColors.grey,
106
- "--label-border-color-lightgrey": borderColors.lightgrey,
107
- "--label-border-color-white": borderColors.white,
108
- "--label-border-color-blue": borderColors.blue,
109
- "--label-inline": inline ? "inline-flex" : "flex"
110
- }), [ button, border, round, backgroundColor, borderColors, setPadding, color, inline ]), classNames = [ css.label, button || isInteractive ? css.button : css.regular, state ? css[state] : "" ].filter(Boolean).join(" ");
111
- return isInteractive ? jsx("button", Object.assign({
112
- id: divId,
113
- type: "button",
114
- className: `${classNames} ${css[size]}${divClass}`,
115
- style: Object.assign(Object.assign({}, divStyle), cssVars),
116
- "aria-label": "Label button",
117
- onClick: e => handleClick(e)
118
- }, rest, {
119
- children: children
120
- })) : jsx("span", Object.assign({
121
- id: divId,
122
- className: `${classNames} ${css[size]}${divClass}`,
123
- style: Object.assign(Object.assign({}, divStyle), cssVars)
124
- }, rest, {
125
- children: children
126
- }));
127
- }
128
-
129
- styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__ZAFft {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__s3KvF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__Lhqqq {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__vRHSP {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__tjdFc {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__Iy-VX {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__LuQBA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__uW1on {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__UBcvQ {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__lOYbg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__BqRC7 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__Fh2dt {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__pF2kC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__BeyrH {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__Ruknj {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__z8L3G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__0O3g6 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__KXxEB {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__cJeEA {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__eRe05 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Xmwtf {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__5q1m3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__k9VFV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.Label-module_label__RaRvM {\n\tdisplay: var(--label-inline) !important;\n\tline-height: 1em;\n\twhite-space: nowrap;\n\tpadding: var(--label-padding) !important;\n\twidth: min-content;\n\tcolor: var(--label-color);\n\tborder-radius: var(--label-border-radius);\n\tborder: var(--label-border-size) solid var(--core-outline-primary);\n\tcursor: var(--label-cursor);\n}\n\n.Label-module_button__N8bcQ {\n\tappearance: none;\n\t-webkit-appearance: none;\n\tbackground-image: none;\n\toutline: none;\n}\n\n.Label-module_s__Zh8Gp {\n}\n\n.Label-module_m__BJtGL {\n}\n\n.Label-module_l__t70tt {\n}\n\n.Label-module_red__yqrNW {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-light);\n\tborder-color: var(--label-border-color-red);\n}\n\n.Label-module_green__R6cDO {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-light);\n\tborder-color: var(--label-border-color-green);\n}\n\n.Label-module_yellow__IoDDg {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-primary);\n\tborder-color: var(--label-border-color-yellow);\n}\n\n.Label-module_grey__qIkSh {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-secondary);\n\tborder-color: var(--label-border-color-grey);\n}\n\n.Label-module_lightgrey__nZC6N {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-disabled);\n\tborder-color: var(--label-border-color-lightgrey);\n}\n\n.Label-module_white__OFwCs {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-primary);\n\tborder-color: var(--label-border-color-white);\n}\n\n.Label-module_blue__lqM0T {\n\tbackground: var(--label-background);\n\tcolor: var(--core-text-light);\n\tborder-color: var(--label-border-color-blue);\n}\n");
130
-
131
- export { Label as L };
@@ -1,186 +0,0 @@
1
- import { a as __awaiter, _ as __rest } from "./tslib.es6-c-7TIv71.mjs";
2
-
3
- import { create } from "zustand";
4
-
5
- import { I as IndexedDB } from "./IndexedDB-CNOziQ6p.mjs";
6
-
7
- function isValidIDBKey(key) {
8
- return "string" == typeof key || "number" == typeof key || key instanceof Date || key instanceof ArrayBuffer || (Array.isArray(key) ? key.every(entry => isValidIDBKey(entry)) : ArrayBuffer.isView(key));
9
- }
10
-
11
- function areKeysEqual(left, right) {
12
- return left instanceof Date && right instanceof Date ? left.getTime() === right.getTime() : Array.isArray(left) && Array.isArray(right) ? left.length === right.length && left.every((value, index) => areKeysEqual(value, right[index])) : left === right;
13
- }
14
-
15
- function normalizeValues(value) {
16
- return Array.isArray(value) ? value : [ value ];
17
- }
18
-
19
- function readStoreRecords(connection) {
20
- return __awaiter(this, void 0, void 0, function*() {
21
- const [keys, values] = yield Promise.all([ connection.getAllKeys(), connection.getAll() ]);
22
- return keys.map((key, index) => {
23
- var _a;
24
- return {
25
- key: key,
26
- value: null !== (_a = values[index]) && void 0 !== _a ? _a : null
27
- };
28
- });
29
- });
30
- }
31
-
32
- function getConnection(stores, name) {
33
- const connection = stores.find(entry => entry.name === name);
34
- if (!connection) throw new Error(`IndexedDB store "${name}" is not registered.`);
35
- return connection;
36
- }
37
-
38
- function applyConnectionState(name, patch) {
39
- useLocalDBStore.setState(state => ({
40
- stores: state.stores.map(entry => entry.name === name ? Object.assign(Object.assign({}, entry), patch) : entry)
41
- }));
42
- }
43
-
44
- function applyStoreError(name, error) {
45
- applyConnectionState(name, {
46
- error: error instanceof Error ? error.message : String(error)
47
- });
48
- }
49
-
50
- function deriveRecordKey(store, value) {
51
- const keyField = function(store) {
52
- if (!store.key) throw new Error(`IndexedDB store "${store.name}" requires a configured key field for value-driven actions.`);
53
- return store.key;
54
- }(store);
55
- if (!value || "object" != typeof value) throw new Error(`IndexedDB store "${store.name}" expects object values for value-driven actions.`);
56
- const candidate = value[keyField];
57
- if (void 0 === candidate) throw new Error(`IndexedDB store "${store.name}" expected field "${keyField}" on the provided value.`);
58
- if (!isValidIDBKey(candidate)) throw new Error(`IndexedDB store "${store.name}" field "${keyField}" does not contain a valid IndexedDB key.`);
59
- return candidate;
60
- }
61
-
62
- const useLocalDBStore = create((set, get) => ({
63
- stores: [],
64
- actions: {
65
- addStore: (name_1, ...args_1) => __awaiter(void 0, [ name_1, ...args_1 ], void 0, function*(name, options = {}) {
66
- var _a;
67
- const existing = get().stores.find(entry => entry.name === name);
68
- yield null == existing ? void 0 : existing.connection.close();
69
- const {create: create = !0} = options, connectionOptions = __rest(options, [ "create" ]), connection = new IndexedDB(name, connectionOptions);
70
- yield connection.initialize(create);
71
- const records = yield readStoreRecords(connection);
72
- !function(connection) {
73
- useLocalDBStore.setState(state => ({
74
- stores: [ ...state.stores.filter(entry => entry.name !== connection.name), connection ]
75
- }));
76
- }({
77
- name: name,
78
- connection: connection,
79
- key: null !== (_a = options.key) && void 0 !== _a ? _a : null,
80
- records: records,
81
- initialized: !0,
82
- error: null
83
- });
84
- }),
85
- removeStore: name => __awaiter(void 0, void 0, void 0, function*() {
86
- const existing = get().stores.find(entry => entry.name === name);
87
- existing && (yield existing.connection.close(), set(state => ({
88
- stores: state.stores.filter(entry => entry.name !== name)
89
- })));
90
- }),
91
- refreshStore: name => __awaiter(void 0, void 0, void 0, function*() {
92
- const existing = getConnection(get().stores, name), records = yield readStoreRecords(existing.connection);
93
- applyConnectionState(name, {
94
- records: records,
95
- initialized: !0,
96
- error: null
97
- });
98
- }),
99
- setValue: (name, value) => __awaiter(void 0, void 0, void 0, function*() {
100
- const existing = getConnection(get().stores, name);
101
- try {
102
- const values = normalizeValues(value), resolvedKeys = [];
103
- for (const item of values) {
104
- const key = deriveRecordKey(existing, item), resolvedKey = yield existing.connection.set(key, item);
105
- resolvedKeys.push(resolvedKey);
106
- }
107
- const records = yield readStoreRecords(existing.connection);
108
- return applyConnectionState(name, {
109
- records: records,
110
- error: null
111
- }), Array.isArray(value) ? resolvedKeys : resolvedKeys[0];
112
- } catch (error) {
113
- throw applyStoreError(name, error), error;
114
- }
115
- }),
116
- addValue: (name, value) => __awaiter(void 0, void 0, void 0, function*() {
117
- const existing = getConnection(get().stores, name);
118
- try {
119
- const values = normalizeValues(value), resolvedKeys = [];
120
- for (const item of values) {
121
- const resolvedKey = yield existing.connection.add(item);
122
- resolvedKeys.push(resolvedKey);
123
- }
124
- const records = yield readStoreRecords(existing.connection);
125
- return applyConnectionState(name, {
126
- records: records,
127
- error: null
128
- }), Array.isArray(value) ? resolvedKeys : resolvedKeys[0];
129
- } catch (error) {
130
- throw applyStoreError(name, error), error;
131
- }
132
- }),
133
- removeValue: (name, value) => __awaiter(void 0, void 0, void 0, function*() {
134
- const existing = getConnection(get().stores, name);
135
- try {
136
- const values = normalizeValues(value);
137
- for (const item of values) {
138
- const key = deriveRecordKey(existing, item);
139
- yield existing.connection.remove(key);
140
- }
141
- const records = yield readStoreRecords(existing.connection);
142
- applyConnectionState(name, {
143
- records: records,
144
- error: null
145
- });
146
- } catch (error) {
147
- throw applyStoreError(name, error), error;
148
- }
149
- }),
150
- clearStore: name => __awaiter(void 0, void 0, void 0, function*() {
151
- const existing = getConnection(get().stores, name);
152
- yield existing.connection.clear(), applyConnectionState(name, {
153
- records: [],
154
- error: null
155
- });
156
- }),
157
- destroyStore: name => __awaiter(void 0, void 0, void 0, function*() {
158
- const existing = get().stores.find(entry => entry.name === name);
159
- existing && (yield existing.connection.destroy(), set(state => ({
160
- stores: state.stores.filter(entry => entry.name !== name)
161
- })));
162
- })
163
- }
164
- })), useLocalDB = name => useLocalDBStore(state => ({
165
- refresh: () => state.actions.refreshStore(name),
166
- set: value => state.actions.setValue(name, value),
167
- add: value => state.actions.addValue(name, value),
168
- remove: value => state.actions.removeValue(name, value),
169
- clear: () => state.actions.clearStore(name),
170
- destroy: () => state.actions.destroyStore(name)
171
- }));
172
-
173
- function useLocalDBValues(name, fieldOrKey, value) {
174
- return useLocalDBStore(state => {
175
- var _a, _b, _c, _d;
176
- const records = null !== (_b = null === (_a = state.stores.find(entry => entry.name === name)) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : [], values = records.map(record => record.value);
177
- return void 0 === fieldOrKey ? values : void 0 === value ? null !== (_d = null === (_c = records.find(record => areKeysEqual(record.key, fieldOrKey))) || void 0 === _c ? void 0 : _c.value) && void 0 !== _d ? _d : null : values.filter(entry => (null == entry ? void 0 : entry[fieldOrKey]) === value);
178
- });
179
- }
180
-
181
- const useLocalDBError = name => useLocalDBStore(state => {
182
- var _a, _b;
183
- return null !== (_b = null === (_a = state.stores.find(entry => entry.name === name)) || void 0 === _a ? void 0 : _a.error) && void 0 !== _b ? _b : null;
184
- }), localDBActions = useLocalDBStore.getState().actions;
185
-
186
- export { useLocalDBError as a, useLocalDBStore as b, useLocalDBValues as c, localDBActions as l, useLocalDB as u };