@morscherlab/mld-sdk 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (714) hide show
  1. package/README.md +326 -0
  2. package/dist/__tests__/components/AppLayout.test.d.ts +1 -0
  3. package/dist/__tests__/components/AppSidebar.test.d.ts +1 -0
  4. package/dist/__tests__/components/AppTopBar.test.d.ts +1 -0
  5. package/dist/__tests__/components/BaseInput.test.d.ts +1 -0
  6. package/dist/__tests__/components/BasePill.test.d.ts +1 -0
  7. package/dist/__tests__/components/Calendar.test.d.ts +1 -0
  8. package/dist/__tests__/components/CollapsibleCard.test.d.ts +1 -0
  9. package/dist/__tests__/components/DataFrame.test.d.ts +1 -0
  10. package/dist/__tests__/components/DropdownButton.test.d.ts +1 -0
  11. package/dist/__tests__/composables/useAuth.test.d.ts +1 -0
  12. package/dist/__tests__/composables/useForm.test.d.ts +1 -0
  13. package/dist/components/AlertBox.vue.d.ts +30 -0
  14. package/dist/components/AlertBox.vue.js +125 -0
  15. package/dist/components/AlertBox.vue.js.map +1 -0
  16. package/dist/components/AlertBox.vue3.js +6 -0
  17. package/dist/components/AlertBox.vue3.js.map +1 -0
  18. package/dist/components/AppContainer.vue.d.ts +28 -0
  19. package/dist/components/AppContainer.vue.js +28 -0
  20. package/dist/components/AppContainer.vue.js.map +1 -0
  21. package/dist/components/AppContainer.vue2.js +5 -0
  22. package/dist/components/AppContainer.vue2.js.map +1 -0
  23. package/dist/components/AppLayout.vue.d.ts +31 -0
  24. package/dist/components/AppLayout.vue.js +51 -0
  25. package/dist/components/AppLayout.vue.js.map +1 -0
  26. package/dist/components/AppLayout.vue3.js +6 -0
  27. package/dist/components/AppLayout.vue3.js.map +1 -0
  28. package/dist/components/AppSidebar.vue.d.ts +44 -0
  29. package/dist/components/AppSidebar.vue.js +79 -0
  30. package/dist/components/AppSidebar.vue.js.map +1 -0
  31. package/dist/components/AppSidebar.vue3.js +6 -0
  32. package/dist/components/AppSidebar.vue3.js.map +1 -0
  33. package/dist/components/AppTopBar.vue.d.ts +77 -0
  34. package/dist/components/AppTopBar.vue.js +564 -0
  35. package/dist/components/AppTopBar.vue.js.map +1 -0
  36. package/dist/components/AppTopBar.vue3.js +6 -0
  37. package/dist/components/AppTopBar.vue3.js.map +1 -0
  38. package/dist/components/AuditTrail.vue.d.ts +47 -0
  39. package/dist/components/AuditTrail.vue.js +189 -0
  40. package/dist/components/AuditTrail.vue.js.map +1 -0
  41. package/dist/components/AuditTrail.vue3.js +6 -0
  42. package/dist/components/AuditTrail.vue3.js.map +1 -0
  43. package/dist/components/Avatar.vue.d.ts +13 -0
  44. package/dist/components/Avatar.vue.js +64 -0
  45. package/dist/components/Avatar.vue.js.map +1 -0
  46. package/dist/components/Avatar.vue3.js +6 -0
  47. package/dist/components/Avatar.vue3.js.map +1 -0
  48. package/dist/components/BaseButton.vue.d.ts +37 -0
  49. package/dist/components/BaseButton.vue.js +64 -0
  50. package/dist/components/BaseButton.vue.js.map +1 -0
  51. package/dist/components/BaseButton.vue3.js +6 -0
  52. package/dist/components/BaseButton.vue3.js.map +1 -0
  53. package/dist/components/BaseCheckbox.vue.d.ts +16 -0
  54. package/dist/components/BaseCheckbox.vue.js +71 -0
  55. package/dist/components/BaseCheckbox.vue.js.map +1 -0
  56. package/dist/components/BaseCheckbox.vue3.js +6 -0
  57. package/dist/components/BaseCheckbox.vue3.js.map +1 -0
  58. package/dist/components/BaseInput.vue.d.ts +33 -0
  59. package/dist/components/BaseInput.vue.js +57 -0
  60. package/dist/components/BaseInput.vue.js.map +1 -0
  61. package/dist/components/BaseInput.vue3.js +6 -0
  62. package/dist/components/BaseInput.vue3.js.map +1 -0
  63. package/dist/components/BaseModal.vue.d.ts +38 -0
  64. package/dist/components/BaseModal.vue.js +118 -0
  65. package/dist/components/BaseModal.vue.js.map +1 -0
  66. package/dist/components/BaseModal.vue3.js +6 -0
  67. package/dist/components/BaseModal.vue3.js.map +1 -0
  68. package/dist/components/BasePill.vue.d.ts +54 -0
  69. package/dist/components/BasePill.vue.js +68 -0
  70. package/dist/components/BasePill.vue.js.map +1 -0
  71. package/dist/components/BasePill.vue3.js +6 -0
  72. package/dist/components/BasePill.vue3.js.map +1 -0
  73. package/dist/components/BaseRadioGroup.vue.d.ts +19 -0
  74. package/dist/components/BaseRadioGroup.vue.js +80 -0
  75. package/dist/components/BaseRadioGroup.vue.js.map +1 -0
  76. package/dist/components/BaseRadioGroup.vue3.js +6 -0
  77. package/dist/components/BaseRadioGroup.vue3.js.map +1 -0
  78. package/dist/components/BaseSelect.vue.d.ts +19 -0
  79. package/dist/components/BaseSelect.vue.js +70 -0
  80. package/dist/components/BaseSelect.vue.js.map +1 -0
  81. package/dist/components/BaseSelect.vue3.js +6 -0
  82. package/dist/components/BaseSelect.vue3.js.map +1 -0
  83. package/dist/components/BaseSlider.vue.d.ts +22 -0
  84. package/dist/components/BaseSlider.vue.js +97 -0
  85. package/dist/components/BaseSlider.vue.js.map +1 -0
  86. package/dist/components/BaseSlider.vue3.js +6 -0
  87. package/dist/components/BaseSlider.vue3.js.map +1 -0
  88. package/dist/components/BaseTabs.vue.d.ts +14 -0
  89. package/dist/components/BaseTabs.vue.js +63 -0
  90. package/dist/components/BaseTabs.vue.js.map +1 -0
  91. package/dist/components/BaseTabs.vue3.js +6 -0
  92. package/dist/components/BaseTabs.vue3.js.map +1 -0
  93. package/dist/components/BaseTextarea.vue.d.ts +28 -0
  94. package/dist/components/BaseTextarea.vue.js +49 -0
  95. package/dist/components/BaseTextarea.vue.js.map +1 -0
  96. package/dist/components/BaseTextarea.vue3.js +6 -0
  97. package/dist/components/BaseTextarea.vue3.js.map +1 -0
  98. package/dist/components/BaseToggle.vue.d.ts +16 -0
  99. package/dist/components/BaseToggle.vue.js +65 -0
  100. package/dist/components/BaseToggle.vue.js.map +1 -0
  101. package/dist/components/BaseToggle.vue3.js +6 -0
  102. package/dist/components/BaseToggle.vue3.js.map +1 -0
  103. package/dist/components/BatchProgressList.vue.d.ts +59 -0
  104. package/dist/components/BatchProgressList.vue.js +250 -0
  105. package/dist/components/BatchProgressList.vue.js.map +1 -0
  106. package/dist/components/BatchProgressList.vue3.js +6 -0
  107. package/dist/components/BatchProgressList.vue3.js.map +1 -0
  108. package/dist/components/Breadcrumb.vue.d.ts +37 -0
  109. package/dist/components/Breadcrumb.vue.js +71 -0
  110. package/dist/components/Breadcrumb.vue.js.map +1 -0
  111. package/dist/components/Breadcrumb.vue3.js +6 -0
  112. package/dist/components/Breadcrumb.vue3.js.map +1 -0
  113. package/dist/components/Calendar.vue.d.ts +107 -0
  114. package/dist/components/Calendar.vue.js +328 -0
  115. package/dist/components/Calendar.vue.js.map +1 -0
  116. package/dist/components/Calendar.vue3.js +6 -0
  117. package/dist/components/Calendar.vue3.js.map +1 -0
  118. package/dist/components/ChartContainer.vue.d.ts +31 -0
  119. package/dist/components/ChartContainer.vue.js +78 -0
  120. package/dist/components/ChartContainer.vue.js.map +1 -0
  121. package/dist/components/ChartContainer.vue3.js +6 -0
  122. package/dist/components/ChartContainer.vue3.js.map +1 -0
  123. package/dist/components/ChemicalFormula.vue.d.ts +8 -0
  124. package/dist/components/ChemicalFormula.vue.js +57 -0
  125. package/dist/components/ChemicalFormula.vue.js.map +1 -0
  126. package/dist/components/ChemicalFormula.vue3.js +6 -0
  127. package/dist/components/ChemicalFormula.vue3.js.map +1 -0
  128. package/dist/components/CollapsibleCard.vue.d.ts +39 -0
  129. package/dist/components/CollapsibleCard.vue.js +175 -0
  130. package/dist/components/CollapsibleCard.vue.js.map +1 -0
  131. package/dist/components/CollapsibleCard.vue3.js +6 -0
  132. package/dist/components/CollapsibleCard.vue3.js.map +1 -0
  133. package/dist/components/ColorSlider.vue.d.ts +34 -0
  134. package/dist/components/ColorSlider.vue.js +131 -0
  135. package/dist/components/ColorSlider.vue.js.map +1 -0
  136. package/dist/components/ColorSlider.vue3.js +6 -0
  137. package/dist/components/ColorSlider.vue3.js.map +1 -0
  138. package/dist/components/ConcentrationInput.vue.d.ts +25 -0
  139. package/dist/components/ConcentrationInput.vue.js +161 -0
  140. package/dist/components/ConcentrationInput.vue.js.map +1 -0
  141. package/dist/components/ConcentrationInput.vue3.js +6 -0
  142. package/dist/components/ConcentrationInput.vue3.js.map +1 -0
  143. package/dist/components/ConfirmDialog.vue.d.ts +41 -0
  144. package/dist/components/ConfirmDialog.vue.js +140 -0
  145. package/dist/components/ConfirmDialog.vue.js.map +1 -0
  146. package/dist/components/ConfirmDialog.vue3.js +6 -0
  147. package/dist/components/ConfirmDialog.vue3.js.map +1 -0
  148. package/dist/components/DataFrame.vue.d.ts +107 -0
  149. package/dist/components/DataFrame.vue.js +430 -0
  150. package/dist/components/DataFrame.vue.js.map +1 -0
  151. package/dist/components/DataFrame.vue3.js +6 -0
  152. package/dist/components/DataFrame.vue3.js.map +1 -0
  153. package/dist/components/DatePicker.vue.d.ts +23 -0
  154. package/dist/components/DatePicker.vue.js +278 -0
  155. package/dist/components/DatePicker.vue.js.map +1 -0
  156. package/dist/components/DatePicker.vue3.js +6 -0
  157. package/dist/components/DatePicker.vue3.js.map +1 -0
  158. package/dist/components/DateTimePicker.vue.d.ts +30 -0
  159. package/dist/components/DateTimePicker.vue.js +413 -0
  160. package/dist/components/DateTimePicker.vue.js.map +1 -0
  161. package/dist/components/DateTimePicker.vue3.js +6 -0
  162. package/dist/components/DateTimePicker.vue3.js.map +1 -0
  163. package/dist/components/Divider.vue.d.ts +11 -0
  164. package/dist/components/Divider.vue.js +42 -0
  165. package/dist/components/Divider.vue.js.map +1 -0
  166. package/dist/components/Divider.vue3.js +6 -0
  167. package/dist/components/Divider.vue3.js.map +1 -0
  168. package/dist/components/DoseCalculator.vue.d.ts +19 -0
  169. package/dist/components/DoseCalculator.vue.js +470 -0
  170. package/dist/components/DoseCalculator.vue.js.map +1 -0
  171. package/dist/components/DoseCalculator.vue3.js +6 -0
  172. package/dist/components/DoseCalculator.vue3.js.map +1 -0
  173. package/dist/components/DropdownButton.vue.d.ts +47 -0
  174. package/dist/components/DropdownButton.vue.js +171 -0
  175. package/dist/components/DropdownButton.vue.js.map +1 -0
  176. package/dist/components/DropdownButton.vue3.js +6 -0
  177. package/dist/components/DropdownButton.vue3.js.map +1 -0
  178. package/dist/components/EmptyState.vue.d.ts +33 -0
  179. package/dist/components/EmptyState.vue.js +80 -0
  180. package/dist/components/EmptyState.vue.js.map +1 -0
  181. package/dist/components/EmptyState.vue3.js +6 -0
  182. package/dist/components/EmptyState.vue3.js.map +1 -0
  183. package/dist/components/ExperimentTimeline.vue.d.ts +44 -0
  184. package/dist/components/ExperimentTimeline.vue.js +395 -0
  185. package/dist/components/ExperimentTimeline.vue.js.map +1 -0
  186. package/dist/components/ExperimentTimeline.vue3.js +6 -0
  187. package/dist/components/ExperimentTimeline.vue3.js.map +1 -0
  188. package/dist/components/FileUploader.vue.d.ts +23 -0
  189. package/dist/components/FileUploader.vue.js +416 -0
  190. package/dist/components/FileUploader.vue.js.map +1 -0
  191. package/dist/components/FileUploader.vue3.js +6 -0
  192. package/dist/components/FileUploader.vue3.js.map +1 -0
  193. package/dist/components/FormField.vue.d.ts +24 -0
  194. package/dist/components/FormField.vue.js +45 -0
  195. package/dist/components/FormField.vue.js.map +1 -0
  196. package/dist/components/FormField.vue3.js +6 -0
  197. package/dist/components/FormField.vue3.js.map +1 -0
  198. package/dist/components/FormulaInput.vue.d.ts +25 -0
  199. package/dist/components/FormulaInput.vue.js +121 -0
  200. package/dist/components/FormulaInput.vue.js.map +1 -0
  201. package/dist/components/FormulaInput.vue3.js +6 -0
  202. package/dist/components/FormulaInput.vue3.js.map +1 -0
  203. package/dist/components/GroupAssigner.vue.d.ts +25 -0
  204. package/dist/components/GroupAssigner.vue.js +311 -0
  205. package/dist/components/GroupAssigner.vue.js.map +1 -0
  206. package/dist/components/GroupAssigner.vue3.js +6 -0
  207. package/dist/components/GroupAssigner.vue3.js.map +1 -0
  208. package/dist/components/GroupingModal.vue.d.ts +12 -0
  209. package/dist/components/GroupingModal.vue.js +446 -0
  210. package/dist/components/GroupingModal.vue.js.map +1 -0
  211. package/dist/components/GroupingModal.vue3.js +6 -0
  212. package/dist/components/GroupingModal.vue3.js.map +1 -0
  213. package/dist/components/IconButton.vue.d.ts +34 -0
  214. package/dist/components/IconButton.vue.js +67 -0
  215. package/dist/components/IconButton.vue.js.map +1 -0
  216. package/dist/components/IconButton.vue3.js +6 -0
  217. package/dist/components/IconButton.vue3.js.map +1 -0
  218. package/dist/components/LoadingSpinner.vue.d.ts +11 -0
  219. package/dist/components/LoadingSpinner.vue.js +47 -0
  220. package/dist/components/LoadingSpinner.vue.js.map +1 -0
  221. package/dist/components/LoadingSpinner.vue3.js +6 -0
  222. package/dist/components/LoadingSpinner.vue3.js.map +1 -0
  223. package/dist/components/MoleculeInput.vue.d.ts +30 -0
  224. package/dist/components/MoleculeInput.vue.js +327 -0
  225. package/dist/components/MoleculeInput.vue.js.map +1 -0
  226. package/dist/components/MoleculeInput.vue3.js +6 -0
  227. package/dist/components/MoleculeInput.vue3.js.map +1 -0
  228. package/dist/components/MultiSelect.vue.d.ts +19 -0
  229. package/dist/components/MultiSelect.vue.js +109 -0
  230. package/dist/components/MultiSelect.vue.js.map +1 -0
  231. package/dist/components/MultiSelect.vue3.js +6 -0
  232. package/dist/components/MultiSelect.vue3.js.map +1 -0
  233. package/dist/components/NumberInput.vue.d.ts +21 -0
  234. package/dist/components/NumberInput.vue.js +133 -0
  235. package/dist/components/NumberInput.vue.js.map +1 -0
  236. package/dist/components/NumberInput.vue3.js +6 -0
  237. package/dist/components/NumberInput.vue3.js.map +1 -0
  238. package/dist/components/PlateMapEditor.vue.d.ts +50 -0
  239. package/dist/components/PlateMapEditor.vue.js +480 -0
  240. package/dist/components/PlateMapEditor.vue.js.map +1 -0
  241. package/dist/components/PlateMapEditor.vue3.js +6 -0
  242. package/dist/components/PlateMapEditor.vue3.js.map +1 -0
  243. package/dist/components/ProgressBar.vue.d.ts +17 -0
  244. package/dist/components/ProgressBar.vue.js +65 -0
  245. package/dist/components/ProgressBar.vue.js.map +1 -0
  246. package/dist/components/ProgressBar.vue3.js +6 -0
  247. package/dist/components/ProgressBar.vue3.js.map +1 -0
  248. package/dist/components/ProtocolStepEditor.vue.d.ts +24 -0
  249. package/dist/components/ProtocolStepEditor.vue.js +491 -0
  250. package/dist/components/ProtocolStepEditor.vue.js.map +1 -0
  251. package/dist/components/ProtocolStepEditor.vue3.js +6 -0
  252. package/dist/components/ProtocolStepEditor.vue3.js.map +1 -0
  253. package/dist/components/RackEditor.vue.d.ts +40 -0
  254. package/dist/components/RackEditor.vue.js +325 -0
  255. package/dist/components/RackEditor.vue.js.map +1 -0
  256. package/dist/components/RackEditor.vue3.js +6 -0
  257. package/dist/components/RackEditor.vue3.js.map +1 -0
  258. package/dist/components/ReagentList.vue.d.ts +46 -0
  259. package/dist/components/ReagentList.vue.js +526 -0
  260. package/dist/components/ReagentList.vue.js.map +1 -0
  261. package/dist/components/ReagentList.vue3.js +6 -0
  262. package/dist/components/ReagentList.vue3.js.map +1 -0
  263. package/dist/components/ResourceCard.vue.d.ts +50 -0
  264. package/dist/components/ResourceCard.vue.js +212 -0
  265. package/dist/components/ResourceCard.vue.js.map +1 -0
  266. package/dist/components/ResourceCard.vue3.js +6 -0
  267. package/dist/components/ResourceCard.vue3.js.map +1 -0
  268. package/dist/components/SampleHierarchyTree.vue.d.ts +37 -0
  269. package/dist/components/SampleHierarchyTree.vue.js +217 -0
  270. package/dist/components/SampleHierarchyTree.vue.js.map +1 -0
  271. package/dist/components/SampleHierarchyTree.vue3.js +6 -0
  272. package/dist/components/SampleHierarchyTree.vue3.js.map +1 -0
  273. package/dist/components/SampleLegend.vue.d.ts +32 -0
  274. package/dist/components/SampleLegend.vue.js +129 -0
  275. package/dist/components/SampleLegend.vue.js.map +1 -0
  276. package/dist/components/SampleLegend.vue3.js +6 -0
  277. package/dist/components/SampleLegend.vue3.js.map +1 -0
  278. package/dist/components/SampleSelector.vue.d.ts +29 -0
  279. package/dist/components/SampleSelector.vue.js +1076 -0
  280. package/dist/components/SampleSelector.vue.js.map +1 -0
  281. package/dist/components/SampleSelector.vue3.js +6 -0
  282. package/dist/components/SampleSelector.vue3.js.map +1 -0
  283. package/dist/components/ScheduleCalendar.vue.d.ts +110 -0
  284. package/dist/components/ScheduleCalendar.vue.js +535 -0
  285. package/dist/components/ScheduleCalendar.vue.js.map +1 -0
  286. package/dist/components/ScheduleCalendar.vue3.js +6 -0
  287. package/dist/components/ScheduleCalendar.vue3.js.map +1 -0
  288. package/dist/components/ScientificNumber.vue.d.ts +14 -0
  289. package/dist/components/ScientificNumber.vue.js +190 -0
  290. package/dist/components/ScientificNumber.vue.js.map +1 -0
  291. package/dist/components/ScientificNumber.vue3.js +6 -0
  292. package/dist/components/ScientificNumber.vue3.js.map +1 -0
  293. package/dist/components/SegmentedControl.vue.d.ts +20 -0
  294. package/dist/components/SegmentedControl.vue.js +71 -0
  295. package/dist/components/SegmentedControl.vue.js.map +1 -0
  296. package/dist/components/SegmentedControl.vue3.js +6 -0
  297. package/dist/components/SegmentedControl.vue3.js.map +1 -0
  298. package/dist/components/SequenceInput.vue.d.ts +54 -0
  299. package/dist/components/SequenceInput.vue.js +204 -0
  300. package/dist/components/SequenceInput.vue.js.map +1 -0
  301. package/dist/components/SequenceInput.vue3.js +6 -0
  302. package/dist/components/SequenceInput.vue3.js.map +1 -0
  303. package/dist/components/SettingsButton.vue.d.ts +30 -0
  304. package/dist/components/SettingsButton.vue.js +72 -0
  305. package/dist/components/SettingsButton.vue.js.map +1 -0
  306. package/dist/components/SettingsButton.vue3.js +6 -0
  307. package/dist/components/SettingsButton.vue3.js.map +1 -0
  308. package/dist/components/SettingsModal.vue.d.ts +40 -0
  309. package/dist/components/SettingsModal.vue.js +141 -0
  310. package/dist/components/SettingsModal.vue.js.map +1 -0
  311. package/dist/components/SettingsModal.vue3.js +6 -0
  312. package/dist/components/SettingsModal.vue3.js.map +1 -0
  313. package/dist/components/Skeleton.vue.d.ts +11 -0
  314. package/dist/components/Skeleton.vue.js +65 -0
  315. package/dist/components/Skeleton.vue.js.map +1 -0
  316. package/dist/components/Skeleton.vue3.js +6 -0
  317. package/dist/components/Skeleton.vue3.js.map +1 -0
  318. package/dist/components/StatusIndicator.vue.d.ts +13 -0
  319. package/dist/components/StatusIndicator.vue.js +38 -0
  320. package/dist/components/StatusIndicator.vue.js.map +1 -0
  321. package/dist/components/StatusIndicator.vue3.js +6 -0
  322. package/dist/components/StatusIndicator.vue3.js.map +1 -0
  323. package/dist/components/StepWizard.vue.d.ts +72 -0
  324. package/dist/components/StepWizard.vue.js +213 -0
  325. package/dist/components/StepWizard.vue.js.map +1 -0
  326. package/dist/components/StepWizard.vue3.js +6 -0
  327. package/dist/components/StepWizard.vue3.js.map +1 -0
  328. package/dist/components/TagsInput.vue.d.ts +23 -0
  329. package/dist/components/TagsInput.vue.js +124 -0
  330. package/dist/components/TagsInput.vue.js.map +1 -0
  331. package/dist/components/TagsInput.vue3.js +6 -0
  332. package/dist/components/TagsInput.vue3.js.map +1 -0
  333. package/dist/components/ThemeToggle.vue.d.ts +7 -0
  334. package/dist/components/ThemeToggle.vue.js +49 -0
  335. package/dist/components/ThemeToggle.vue.js.map +1 -0
  336. package/dist/components/ThemeToggle.vue3.js +6 -0
  337. package/dist/components/ThemeToggle.vue3.js.map +1 -0
  338. package/dist/components/TimePicker.vue.d.ts +29 -0
  339. package/dist/components/TimePicker.vue.js +275 -0
  340. package/dist/components/TimePicker.vue.js.map +1 -0
  341. package/dist/components/TimePicker.vue3.js +6 -0
  342. package/dist/components/TimePicker.vue3.js.map +1 -0
  343. package/dist/components/TimeRangeInput.vue.d.ts +27 -0
  344. package/dist/components/TimeRangeInput.vue.js +115 -0
  345. package/dist/components/TimeRangeInput.vue.js.map +1 -0
  346. package/dist/components/TimeRangeInput.vue3.js +6 -0
  347. package/dist/components/TimeRangeInput.vue3.js.map +1 -0
  348. package/dist/components/ToastNotification.vue.d.ts +2 -0
  349. package/dist/components/ToastNotification.vue.js +113 -0
  350. package/dist/components/ToastNotification.vue.js.map +1 -0
  351. package/dist/components/ToastNotification.vue3.js +6 -0
  352. package/dist/components/ToastNotification.vue3.js.map +1 -0
  353. package/dist/components/Tooltip.vue.d.ts +25 -0
  354. package/dist/components/Tooltip.vue.js +52 -0
  355. package/dist/components/Tooltip.vue.js.map +1 -0
  356. package/dist/components/Tooltip.vue3.js +6 -0
  357. package/dist/components/Tooltip.vue3.js.map +1 -0
  358. package/dist/components/UnitInput.vue.d.ts +44 -0
  359. package/dist/components/UnitInput.vue.js +178 -0
  360. package/dist/components/UnitInput.vue.js.map +1 -0
  361. package/dist/components/UnitInput.vue3.js +6 -0
  362. package/dist/components/UnitInput.vue3.js.map +1 -0
  363. package/dist/components/WellEditPopup.vue.d.ts +25 -0
  364. package/dist/components/WellEditPopup.vue.js +250 -0
  365. package/dist/components/WellEditPopup.vue.js.map +1 -0
  366. package/dist/components/WellEditPopup.vue3.js +6 -0
  367. package/dist/components/WellEditPopup.vue3.js.map +1 -0
  368. package/dist/components/WellPlate.vue.d.ts +69 -0
  369. package/dist/components/WellPlate.vue.js +531 -0
  370. package/dist/components/WellPlate.vue.js.map +1 -0
  371. package/dist/components/WellPlate.vue3.js +6 -0
  372. package/dist/components/WellPlate.vue3.js.map +1 -0
  373. package/dist/components/index.d.ts +71 -0
  374. package/dist/components/index.js +215 -0
  375. package/dist/components/index.js.map +1 -0
  376. package/dist/composables/index.d.ts +17 -0
  377. package/dist/composables/index.js +49 -0
  378. package/dist/composables/index.js.map +1 -0
  379. package/dist/composables/useApi.d.ts +19 -0
  380. package/dist/composables/useApi.js +101 -0
  381. package/dist/composables/useApi.js.map +1 -0
  382. package/dist/composables/useAsync.d.ts +127 -0
  383. package/dist/composables/useAsync.js +141 -0
  384. package/dist/composables/useAsync.js.map +1 -0
  385. package/dist/composables/useAuth.d.ts +44 -0
  386. package/dist/composables/useAuth.js +286 -0
  387. package/dist/composables/useAuth.js.map +1 -0
  388. package/dist/composables/useChemicalFormula.d.ts +20 -0
  389. package/dist/composables/useChemicalFormula.js +228 -0
  390. package/dist/composables/useChemicalFormula.js.map +1 -0
  391. package/dist/composables/useConcentrationUnits.d.ts +28 -0
  392. package/dist/composables/useConcentrationUnits.js +154 -0
  393. package/dist/composables/useConcentrationUnits.js.map +1 -0
  394. package/dist/composables/useDoseCalculator.d.ts +57 -0
  395. package/dist/composables/useDoseCalculator.js +228 -0
  396. package/dist/composables/useDoseCalculator.js.map +1 -0
  397. package/dist/composables/useForm.d.ts +91 -0
  398. package/dist/composables/useForm.js +253 -0
  399. package/dist/composables/useForm.js.map +1 -0
  400. package/dist/composables/usePasskey.d.ts +9 -0
  401. package/dist/composables/usePasskey.js +171 -0
  402. package/dist/composables/usePasskey.js.map +1 -0
  403. package/dist/composables/usePlatformContext.d.ts +125 -0
  404. package/dist/composables/usePlatformContext.js +149 -0
  405. package/dist/composables/usePlatformContext.js.map +1 -0
  406. package/dist/composables/useProtocolTemplates.d.ts +43 -0
  407. package/dist/composables/useProtocolTemplates.js +437 -0
  408. package/dist/composables/useProtocolTemplates.js.map +1 -0
  409. package/dist/composables/useRackEditor.d.ts +30 -0
  410. package/dist/composables/useRackEditor.js +168 -0
  411. package/dist/composables/useRackEditor.js.map +1 -0
  412. package/dist/composables/useScheduleDrag.d.ts +77 -0
  413. package/dist/composables/useScheduleDrag.js +183 -0
  414. package/dist/composables/useScheduleDrag.js.map +1 -0
  415. package/dist/composables/useSequenceUtils.d.ts +13 -0
  416. package/dist/composables/useSequenceUtils.js +93 -0
  417. package/dist/composables/useSequenceUtils.js.map +1 -0
  418. package/dist/composables/useTheme.d.ts +7 -0
  419. package/dist/composables/useTheme.js +40 -0
  420. package/dist/composables/useTheme.js.map +1 -0
  421. package/dist/composables/useTimeUtils.d.ts +15 -0
  422. package/dist/composables/useTimeUtils.js +105 -0
  423. package/dist/composables/useTimeUtils.js.map +1 -0
  424. package/dist/composables/useToast.d.ts +19 -0
  425. package/dist/composables/useToast.js +33 -0
  426. package/dist/composables/useToast.js.map +1 -0
  427. package/dist/composables/useWellPlateEditor.d.ts +31 -0
  428. package/dist/composables/useWellPlateEditor.js +315 -0
  429. package/dist/composables/useWellPlateEditor.js.map +1 -0
  430. package/dist/histoire.setup.d.ts +1 -0
  431. package/dist/index.d.ts +5 -0
  432. package/dist/index.js +265 -0
  433. package/dist/index.js.map +1 -0
  434. package/dist/install.d.ts +16 -0
  435. package/dist/install.js +15 -0
  436. package/dist/install.js.map +1 -0
  437. package/dist/stores/auth.d.ts +146 -0
  438. package/dist/stores/auth.js +122 -0
  439. package/dist/stores/auth.js.map +1 -0
  440. package/dist/stores/index.d.ts +2 -0
  441. package/dist/stores/index.js +8 -0
  442. package/dist/stores/index.js.map +1 -0
  443. package/dist/stores/settings.d.ts +75 -0
  444. package/dist/stores/settings.js +180 -0
  445. package/dist/stores/settings.js.map +1 -0
  446. package/dist/styles.css +23264 -0
  447. package/dist/tailwind.preset.d.ts +56 -0
  448. package/dist/tailwind.preset.js +59 -0
  449. package/dist/tailwind.preset.js.map +1 -0
  450. package/dist/types/auth.d.ts +42 -0
  451. package/dist/types/components.d.ts +405 -0
  452. package/dist/types/index.d.ts +3 -0
  453. package/dist/types/index.js +2 -0
  454. package/dist/types/index.js.map +1 -0
  455. package/dist/types/platform.d.ts +66 -0
  456. package/package.json +111 -0
  457. package/src/__tests__/components/AppLayout.test.ts +163 -0
  458. package/src/__tests__/components/AppSidebar.test.ts +292 -0
  459. package/src/__tests__/components/AppTopBar.test.ts +590 -0
  460. package/src/__tests__/components/BaseInput.test.ts +99 -0
  461. package/src/__tests__/components/BasePill.test.ts +291 -0
  462. package/src/__tests__/components/Calendar.test.ts +566 -0
  463. package/src/__tests__/components/CollapsibleCard.test.ts +524 -0
  464. package/src/__tests__/components/DataFrame.test.ts +767 -0
  465. package/src/__tests__/components/DropdownButton.test.ts +471 -0
  466. package/src/__tests__/composables/useAuth.test.ts +141 -0
  467. package/src/__tests__/composables/useForm.test.ts +205 -0
  468. package/src/components/AlertBox.story.vue +100 -0
  469. package/src/components/AlertBox.vue +68 -0
  470. package/src/components/AppContainer.story.vue +104 -0
  471. package/src/components/AppContainer.vue +33 -0
  472. package/src/components/AppLayout.story.vue +218 -0
  473. package/src/components/AppLayout.vue +75 -0
  474. package/src/components/AppSidebar.story.vue +300 -0
  475. package/src/components/AppSidebar.vue +114 -0
  476. package/src/components/AppTopBar.story.vue +112 -0
  477. package/src/components/AppTopBar.vue +471 -0
  478. package/src/components/AuditTrail.story.vue +163 -0
  479. package/src/components/AuditTrail.vue +161 -0
  480. package/src/components/Avatar.story.vue +92 -0
  481. package/src/components/Avatar.vue +65 -0
  482. package/src/components/BaseButton.story.vue +96 -0
  483. package/src/components/BaseButton.vue +72 -0
  484. package/src/components/BaseCheckbox.story.vue +73 -0
  485. package/src/components/BaseCheckbox.vue +68 -0
  486. package/src/components/BaseInput.story.vue +98 -0
  487. package/src/components/BaseInput.vue +70 -0
  488. package/src/components/BaseModal.story.vue +126 -0
  489. package/src/components/BaseModal.vue +118 -0
  490. package/src/components/BasePill.story.vue +131 -0
  491. package/src/components/BasePill.vue +84 -0
  492. package/src/components/BaseRadioGroup.story.vue +116 -0
  493. package/src/components/BaseRadioGroup.vue +83 -0
  494. package/src/components/BaseSelect.story.vue +110 -0
  495. package/src/components/BaseSelect.vue +67 -0
  496. package/src/components/BaseSlider.story.vue +82 -0
  497. package/src/components/BaseSlider.vue +112 -0
  498. package/src/components/BaseTabs.story.vue +106 -0
  499. package/src/components/BaseTabs.vue +58 -0
  500. package/src/components/BaseTextarea.story.vue +91 -0
  501. package/src/components/BaseTextarea.vue +58 -0
  502. package/src/components/BaseToggle.story.vue +81 -0
  503. package/src/components/BaseToggle.vue +72 -0
  504. package/src/components/BatchProgressList.story.vue +92 -0
  505. package/src/components/BatchProgressList.vue +202 -0
  506. package/src/components/Breadcrumb.story.vue +93 -0
  507. package/src/components/Breadcrumb.vue +73 -0
  508. package/src/components/Calendar.story.vue +106 -0
  509. package/src/components/Calendar.vue +362 -0
  510. package/src/components/ChartContainer.story.vue +113 -0
  511. package/src/components/ChartContainer.vue +63 -0
  512. package/src/components/ChemicalFormula.story.vue +102 -0
  513. package/src/components/ChemicalFormula.vue +38 -0
  514. package/src/components/CollapsibleCard.story.vue +124 -0
  515. package/src/components/CollapsibleCard.vue +164 -0
  516. package/src/components/ColorSlider.story.vue +120 -0
  517. package/src/components/ColorSlider.vue +163 -0
  518. package/src/components/ConcentrationInput.story.vue +77 -0
  519. package/src/components/ConcentrationInput.vue +184 -0
  520. package/src/components/ConfirmDialog.story.vue +145 -0
  521. package/src/components/ConfirmDialog.vue +96 -0
  522. package/src/components/DataFrame.story.vue +148 -0
  523. package/src/components/DataFrame.vue +418 -0
  524. package/src/components/DatePicker.story.vue +104 -0
  525. package/src/components/DatePicker.vue +298 -0
  526. package/src/components/DateTimePicker.story.vue +112 -0
  527. package/src/components/DateTimePicker.vue +391 -0
  528. package/src/components/Divider.story.vue +72 -0
  529. package/src/components/Divider.vue +45 -0
  530. package/src/components/DoseCalculator.story.vue +68 -0
  531. package/src/components/DoseCalculator.vue +475 -0
  532. package/src/components/DropdownButton.story.vue +102 -0
  533. package/src/components/DropdownButton.vue +180 -0
  534. package/src/components/EmptyState.story.vue +124 -0
  535. package/src/components/EmptyState.vue +64 -0
  536. package/src/components/ExperimentTimeline.story.vue +161 -0
  537. package/src/components/ExperimentTimeline.vue +381 -0
  538. package/src/components/FileUploader.story.vue +106 -0
  539. package/src/components/FileUploader.vue +397 -0
  540. package/src/components/FormField.story.vue +119 -0
  541. package/src/components/FormField.vue +37 -0
  542. package/src/components/FormulaInput.story.vue +96 -0
  543. package/src/components/FormulaInput.vue +123 -0
  544. package/src/components/GroupAssigner.story.vue +83 -0
  545. package/src/components/GroupAssigner.vue +283 -0
  546. package/src/components/GroupingModal.story.vue +52 -0
  547. package/src/components/GroupingModal.vue +420 -0
  548. package/src/components/IconButton.story.vue +135 -0
  549. package/src/components/IconButton.vue +72 -0
  550. package/src/components/LoadingSpinner.story.vue +70 -0
  551. package/src/components/LoadingSpinner.vue +49 -0
  552. package/src/components/MoleculeInput.story.vue +66 -0
  553. package/src/components/MoleculeInput.vue +414 -0
  554. package/src/components/MultiSelect.story.vue +121 -0
  555. package/src/components/MultiSelect.vue +117 -0
  556. package/src/components/NumberInput.story.vue +90 -0
  557. package/src/components/NumberInput.vue +128 -0
  558. package/src/components/PlateMapEditor.story.vue +92 -0
  559. package/src/components/PlateMapEditor.vue +512 -0
  560. package/src/components/ProgressBar.story.vue +117 -0
  561. package/src/components/ProgressBar.vue +63 -0
  562. package/src/components/ProtocolStepEditor.story.vue +69 -0
  563. package/src/components/ProtocolStepEditor.vue +521 -0
  564. package/src/components/RackEditor.story.vue +100 -0
  565. package/src/components/RackEditor.vue +370 -0
  566. package/src/components/ReagentList.story.vue +137 -0
  567. package/src/components/ReagentList.vue +487 -0
  568. package/src/components/ResourceCard.story.vue +150 -0
  569. package/src/components/ResourceCard.vue +160 -0
  570. package/src/components/SampleHierarchyTree.story.vue +161 -0
  571. package/src/components/SampleHierarchyTree.vue +279 -0
  572. package/src/components/SampleLegend.story.vue +91 -0
  573. package/src/components/SampleLegend.vue +118 -0
  574. package/src/components/SampleSelector.story.vue +100 -0
  575. package/src/components/SampleSelector.vue +955 -0
  576. package/src/components/ScheduleCalendar.story.vue +195 -0
  577. package/src/components/ScheduleCalendar.vue +568 -0
  578. package/src/components/ScientificNumber.story.vue +128 -0
  579. package/src/components/ScientificNumber.vue +197 -0
  580. package/src/components/SegmentedControl.story.vue +112 -0
  581. package/src/components/SegmentedControl.vue +78 -0
  582. package/src/components/SequenceInput.story.vue +119 -0
  583. package/src/components/SequenceInput.vue +208 -0
  584. package/src/components/SettingsButton.story.vue +58 -0
  585. package/src/components/SettingsButton.vue +75 -0
  586. package/src/components/SettingsModal.story.vue +145 -0
  587. package/src/components/SettingsModal.vue +151 -0
  588. package/src/components/Skeleton.story.vue +120 -0
  589. package/src/components/Skeleton.vue +73 -0
  590. package/src/components/StatusIndicator.story.vue +99 -0
  591. package/src/components/StatusIndicator.vue +39 -0
  592. package/src/components/StepWizard.story.vue +155 -0
  593. package/src/components/StepWizard.vue +231 -0
  594. package/src/components/TagsInput.story.vue +104 -0
  595. package/src/components/TagsInput.vue +127 -0
  596. package/src/components/ThemeToggle.story.vue +36 -0
  597. package/src/components/ThemeToggle.vue +53 -0
  598. package/src/components/TimePicker.story.vue +96 -0
  599. package/src/components/TimePicker.vue +272 -0
  600. package/src/components/TimeRangeInput.story.vue +104 -0
  601. package/src/components/TimeRangeInput.vue +121 -0
  602. package/src/components/ToastNotification.story.vue +130 -0
  603. package/src/components/ToastNotification.vue +54 -0
  604. package/src/components/Tooltip.story.vue +102 -0
  605. package/src/components/Tooltip.vue +61 -0
  606. package/src/components/UnitInput.story.vue +170 -0
  607. package/src/components/UnitInput.vue +218 -0
  608. package/src/components/WellEditPopup.vue +234 -0
  609. package/src/components/WellPlate.story.vue +198 -0
  610. package/src/components/WellPlate.vue +637 -0
  611. package/src/components/index.ts +96 -0
  612. package/src/composables/index.ts +87 -0
  613. package/src/composables/useApi.ts +145 -0
  614. package/src/composables/useAsync.ts +322 -0
  615. package/src/composables/useAuth.ts +427 -0
  616. package/src/composables/useChemicalFormula.ts +274 -0
  617. package/src/composables/useConcentrationUnits.ts +245 -0
  618. package/src/composables/useDoseCalculator.ts +369 -0
  619. package/src/composables/useForm.ts +415 -0
  620. package/src/composables/usePasskey.ts +209 -0
  621. package/src/composables/usePlatformContext.ts +232 -0
  622. package/src/composables/useProtocolTemplates.ts +517 -0
  623. package/src/composables/useRackEditor.ts +221 -0
  624. package/src/composables/useScheduleDrag.ts +244 -0
  625. package/src/composables/useSequenceUtils.ts +104 -0
  626. package/src/composables/useTheme.ts +49 -0
  627. package/src/composables/useTimeUtils.ts +114 -0
  628. package/src/composables/useToast.ts +39 -0
  629. package/src/composables/useWellPlateEditor.ts +408 -0
  630. package/src/histoire.setup.ts +17 -0
  631. package/src/index.ts +283 -0
  632. package/src/install.ts +32 -0
  633. package/src/stores/auth.ts +144 -0
  634. package/src/stores/index.ts +2 -0
  635. package/src/stores/settings.ts +229 -0
  636. package/src/styles/components/alert-box.css +94 -0
  637. package/src/styles/components/app-container.css +32 -0
  638. package/src/styles/components/app-layout.css +99 -0
  639. package/src/styles/components/app-sidebar.css +133 -0
  640. package/src/styles/components/app-top-bar.css +396 -0
  641. package/src/styles/components/audit-trail.css +143 -0
  642. package/src/styles/components/avatar.css +64 -0
  643. package/src/styles/components/batch-progress-list.css +196 -0
  644. package/src/styles/components/breadcrumb.css +45 -0
  645. package/src/styles/components/button.css +119 -0
  646. package/src/styles/components/calendar.css +192 -0
  647. package/src/styles/components/chart-container.css +69 -0
  648. package/src/styles/components/checkbox.css +112 -0
  649. package/src/styles/components/chemical-formula.css +46 -0
  650. package/src/styles/components/collapsible-card.css +184 -0
  651. package/src/styles/components/color-slider.css +110 -0
  652. package/src/styles/components/concentration-input.css +142 -0
  653. package/src/styles/components/confirm-dialog.css +137 -0
  654. package/src/styles/components/dataframe.css +382 -0
  655. package/src/styles/components/date-picker.css +239 -0
  656. package/src/styles/components/datetime-picker.css +225 -0
  657. package/src/styles/components/divider.css +62 -0
  658. package/src/styles/components/dose-calculator.css +301 -0
  659. package/src/styles/components/dropdown-button.css +236 -0
  660. package/src/styles/components/empty-state.css +148 -0
  661. package/src/styles/components/experiment-timeline.css +529 -0
  662. package/src/styles/components/file-uploader.css +517 -0
  663. package/src/styles/components/form-field.css +35 -0
  664. package/src/styles/components/formula-input.css +96 -0
  665. package/src/styles/components/group-assigner.css +200 -0
  666. package/src/styles/components/grouping-modal.css +323 -0
  667. package/src/styles/components/icon-button.css +128 -0
  668. package/src/styles/components/input.css +53 -0
  669. package/src/styles/components/loading-spinner.css +67 -0
  670. package/src/styles/components/modal.css +122 -0
  671. package/src/styles/components/molecule-input.css +186 -0
  672. package/src/styles/components/multi-select.css +131 -0
  673. package/src/styles/components/number-input.css +110 -0
  674. package/src/styles/components/pill.css +172 -0
  675. package/src/styles/components/plate-map-editor.css +464 -0
  676. package/src/styles/components/progress-bar.css +88 -0
  677. package/src/styles/components/protocol-step-editor.css +449 -0
  678. package/src/styles/components/rack-editor.css +259 -0
  679. package/src/styles/components/radio-group.css +158 -0
  680. package/src/styles/components/reagent-list.css +407 -0
  681. package/src/styles/components/resource-card.css +360 -0
  682. package/src/styles/components/sample-hierarchy-tree.css +314 -0
  683. package/src/styles/components/sample-legend.css +201 -0
  684. package/src/styles/components/sample-selector.css +701 -0
  685. package/src/styles/components/schedule-calendar.css +478 -0
  686. package/src/styles/components/scientific-number.css +63 -0
  687. package/src/styles/components/segmented-control.css +190 -0
  688. package/src/styles/components/select.css +72 -0
  689. package/src/styles/components/sequence-input.css +184 -0
  690. package/src/styles/components/settings-button.css +75 -0
  691. package/src/styles/components/settings-modal.css +95 -0
  692. package/src/styles/components/skeleton.css +36 -0
  693. package/src/styles/components/slider.css +78 -0
  694. package/src/styles/components/status-indicator.css +59 -0
  695. package/src/styles/components/step-wizard.css +187 -0
  696. package/src/styles/components/tabs.css +108 -0
  697. package/src/styles/components/tags-input.css +118 -0
  698. package/src/styles/components/textarea.css +65 -0
  699. package/src/styles/components/theme-toggle.css +50 -0
  700. package/src/styles/components/time-picker.css +171 -0
  701. package/src/styles/components/time-range-input.css +42 -0
  702. package/src/styles/components/toast.css +72 -0
  703. package/src/styles/components/toggle.css +115 -0
  704. package/src/styles/components/tooltip.css +98 -0
  705. package/src/styles/components/unit-input.css +138 -0
  706. package/src/styles/components/well-edit-popup.css +252 -0
  707. package/src/styles/components/well-plate.css +310 -0
  708. package/src/styles/index.css +80 -0
  709. package/src/styles/variables.css +1078 -0
  710. package/src/tailwind.preset.ts +59 -0
  711. package/src/types/auth.ts +55 -0
  712. package/src/types/components.ts +560 -0
  713. package/src/types/index.ts +146 -0
  714. package/src/types/platform.ts +101 -0
@@ -0,0 +1,228 @@
1
+ import { useConcentrationUnits } from "./useConcentrationUnits.js";
2
+ const VOLUME_UNITS = ["µL", "mL", "L"];
3
+ const VOLUME_FACTORS = {
4
+ "µL": 1e-6,
5
+ "mL": 1e-3,
6
+ "L": 1
7
+ };
8
+ function useDoseCalculator() {
9
+ const { convert } = useConcentrationUnits();
10
+ function convertVolume(value, from, to) {
11
+ if (from === to) return value;
12
+ const baseValue = value * VOLUME_FACTORS[from];
13
+ return baseValue / VOLUME_FACTORS[to];
14
+ }
15
+ function formatVolume(volume, precision = 3) {
16
+ const { value, unit } = volume;
17
+ if (value === 0) return `0 ${unit}`;
18
+ let formattedValue;
19
+ if (Math.abs(value) >= 1e3) {
20
+ formattedValue = value.toExponential(precision - 1);
21
+ } else if (Math.abs(value) < 1e-3) {
22
+ formattedValue = value.toExponential(precision - 1);
23
+ } else {
24
+ formattedValue = value.toPrecision(precision);
25
+ }
26
+ formattedValue = formattedValue.replace(/\.?0+$/, "");
27
+ formattedValue = formattedValue.replace(/\.?0+e/, "e");
28
+ return `${formattedValue} ${unit}`;
29
+ }
30
+ function calculateDilution(params) {
31
+ const { stockConcentration, finalConcentration, finalVolume } = params;
32
+ if (stockConcentration.value <= 0) {
33
+ return {
34
+ stockVolume: { value: 0, unit: "µL" },
35
+ diluentVolume: { value: 0, unit: "µL" },
36
+ dilutionFactor: 0,
37
+ valid: false,
38
+ error: "Stock concentration must be positive"
39
+ };
40
+ }
41
+ if (finalConcentration.value <= 0) {
42
+ return {
43
+ stockVolume: { value: 0, unit: "µL" },
44
+ diluentVolume: { value: 0, unit: "µL" },
45
+ dilutionFactor: 0,
46
+ valid: false,
47
+ error: "Final concentration must be positive"
48
+ };
49
+ }
50
+ if (finalVolume.value <= 0) {
51
+ return {
52
+ stockVolume: { value: 0, unit: "µL" },
53
+ diluentVolume: { value: 0, unit: "µL" },
54
+ dilutionFactor: 0,
55
+ valid: false,
56
+ error: "Final volume must be positive"
57
+ };
58
+ }
59
+ const convertedFinal = convert(
60
+ finalConcentration.value,
61
+ finalConcentration.unit,
62
+ stockConcentration.unit
63
+ );
64
+ if (convertedFinal === null) {
65
+ return {
66
+ stockVolume: { value: 0, unit: "µL" },
67
+ diluentVolume: { value: 0, unit: "µL" },
68
+ dilutionFactor: 0,
69
+ valid: false,
70
+ error: "Cannot convert between concentration units. Provide molecular weight for mass↔molarity conversion."
71
+ };
72
+ }
73
+ if (convertedFinal >= stockConcentration.value) {
74
+ return {
75
+ stockVolume: { value: 0, unit: "µL" },
76
+ diluentVolume: { value: 0, unit: "µL" },
77
+ dilutionFactor: 0,
78
+ valid: false,
79
+ error: "Stock concentration must be higher than final concentration"
80
+ };
81
+ }
82
+ const dilutionFactor = stockConcentration.value / convertedFinal;
83
+ const finalVolumeInL = convertVolume(finalVolume.value, finalVolume.unit, "L");
84
+ const stockVolumeInL = finalVolumeInL / dilutionFactor;
85
+ const diluentVolumeInL = finalVolumeInL - stockVolumeInL;
86
+ let outputUnit = "µL";
87
+ if (stockVolumeInL >= 1e-3) outputUnit = "mL";
88
+ if (stockVolumeInL >= 1) outputUnit = "L";
89
+ return {
90
+ stockVolume: {
91
+ value: convertVolume(stockVolumeInL, "L", outputUnit),
92
+ unit: outputUnit
93
+ },
94
+ diluentVolume: {
95
+ value: convertVolume(diluentVolumeInL, "L", outputUnit),
96
+ unit: outputUnit
97
+ },
98
+ dilutionFactor,
99
+ valid: true
100
+ };
101
+ }
102
+ function calculateSerialDilution(params) {
103
+ const { startingConcentration, dilutionFactor, numberOfDilutions, volumePerWell } = params;
104
+ if (startingConcentration.value <= 0) {
105
+ return {
106
+ steps: [],
107
+ totalStockVolume: { value: 0, unit: "µL" },
108
+ valid: false,
109
+ error: "Starting concentration must be positive"
110
+ };
111
+ }
112
+ if (dilutionFactor <= 1) {
113
+ return {
114
+ steps: [],
115
+ totalStockVolume: { value: 0, unit: "µL" },
116
+ valid: false,
117
+ error: "Dilution factor must be greater than 1"
118
+ };
119
+ }
120
+ if (numberOfDilutions < 1) {
121
+ return {
122
+ steps: [],
123
+ totalStockVolume: { value: 0, unit: "µL" },
124
+ valid: false,
125
+ error: "Number of dilutions must be at least 1"
126
+ };
127
+ }
128
+ if (volumePerWell.value <= 0) {
129
+ return {
130
+ steps: [],
131
+ totalStockVolume: { value: 0, unit: "µL" },
132
+ valid: false,
133
+ error: "Volume per well must be positive"
134
+ };
135
+ }
136
+ const steps = [];
137
+ let currentConcentration = startingConcentration.value;
138
+ const transferVolume = volumePerWell.value / (dilutionFactor - 1);
139
+ const diluentVolume = volumePerWell.value - transferVolume;
140
+ for (let i = 0; i < numberOfDilutions; i++) {
141
+ steps.push({
142
+ stepNumber: i + 1,
143
+ concentration: {
144
+ value: currentConcentration,
145
+ unit: startingConcentration.unit
146
+ },
147
+ transferVolume: {
148
+ value: i === 0 ? volumePerWell.value : transferVolume,
149
+ unit: volumePerWell.unit
150
+ },
151
+ diluentVolume: {
152
+ value: i === 0 ? 0 : diluentVolume,
153
+ unit: volumePerWell.unit
154
+ }
155
+ });
156
+ currentConcentration /= dilutionFactor;
157
+ }
158
+ const totalStockVolume = {
159
+ value: volumePerWell.value + transferVolume * (numberOfDilutions - 1),
160
+ unit: volumePerWell.unit
161
+ };
162
+ return {
163
+ steps,
164
+ totalStockVolume,
165
+ valid: true
166
+ };
167
+ }
168
+ function convertMassToMolar(mass, massUnit, mw) {
169
+ const converted = convert(mass, massUnit, "µM", mw);
170
+ if (converted !== null) {
171
+ return { value: converted, unit: "µM" };
172
+ }
173
+ const massInGML = mass * getMassVolumeFactor(massUnit);
174
+ const molarConc = massInGML / mw;
175
+ return { value: molarConc * 1e6, unit: "µM" };
176
+ }
177
+ function convertMolarToMass(molar, molarUnit, mw) {
178
+ const converted = convert(molar, molarUnit, "µg/mL", mw);
179
+ if (converted !== null) {
180
+ return { value: converted, unit: "µg/mL" };
181
+ }
182
+ const molarInM = molar * getMolarityFactor(molarUnit);
183
+ const massConc = molarInM * mw * 1e6;
184
+ return { value: massConc, unit: "µg/mL" };
185
+ }
186
+ function getMassVolumeFactor(unit) {
187
+ const factors = {
188
+ "pg/mL": 1e-12,
189
+ "ng/mL": 1e-9,
190
+ "µg/mL": 1e-6,
191
+ "mg/mL": 1e-3,
192
+ "g/mL": 1
193
+ };
194
+ return factors[unit];
195
+ }
196
+ function getMolarityFactor(unit) {
197
+ const factors = {
198
+ "pM": 1e-12,
199
+ "nM": 1e-9,
200
+ "µM": 1e-6,
201
+ "mM": 1e-3,
202
+ "M": 1
203
+ };
204
+ return factors[unit];
205
+ }
206
+ function generateWellConcentrations(result, wellIds) {
207
+ if (!result.valid || result.steps.length === 0) return [];
208
+ return result.steps.slice(0, wellIds.length).map((step, index) => ({
209
+ wellId: wellIds[index],
210
+ concentration: step.concentration,
211
+ volume: step.transferVolume
212
+ }));
213
+ }
214
+ return {
215
+ volumeUnits: VOLUME_UNITS,
216
+ calculateDilution,
217
+ calculateSerialDilution,
218
+ convertMassToMolar,
219
+ convertMolarToMass,
220
+ convertVolume,
221
+ formatVolume,
222
+ generateWellConcentrations
223
+ };
224
+ }
225
+ export {
226
+ useDoseCalculator
227
+ };
228
+ //# sourceMappingURL=useDoseCalculator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDoseCalculator.js","sources":["../../src/composables/useDoseCalculator.ts"],"sourcesContent":["import {\n useConcentrationUnits,\n type ConcentrationValue,\n type MolarityUnit,\n type MassVolumeUnit,\n} from './useConcentrationUnits'\n\n// Volume units\nexport type VolumeUnit = 'µL' | 'mL' | 'L'\n\nexport interface VolumeValue {\n value: number\n unit: VolumeUnit\n}\n\n// Dilution calculation types\nexport interface DilutionParams {\n stockConcentration: ConcentrationValue\n finalConcentration: ConcentrationValue\n finalVolume: VolumeValue\n}\n\nexport interface DilutionResult {\n stockVolume: VolumeValue\n diluentVolume: VolumeValue\n dilutionFactor: number\n valid: boolean\n error?: string\n}\n\n// Serial dilution types\nexport interface SerialDilutionParams {\n startingConcentration: ConcentrationValue\n dilutionFactor: number\n numberOfDilutions: number\n volumePerWell: VolumeValue\n}\n\nexport interface SerialDilutionStep {\n stepNumber: number\n concentration: ConcentrationValue\n transferVolume: VolumeValue\n diluentVolume: VolumeValue\n}\n\nexport interface SerialDilutionResult {\n steps: SerialDilutionStep[]\n totalStockVolume: VolumeValue\n valid: boolean\n error?: string\n}\n\n// Conversion types\nexport interface ConversionResult {\n result: ConcentrationValue\n valid: boolean\n error?: string\n}\n\n// Well concentration for plate integration\nexport interface WellConcentration {\n wellId: string\n concentration: ConcentrationValue\n volume?: VolumeValue\n}\n\nexport interface UseDoseCalculatorReturn {\n volumeUnits: VolumeUnit[]\n calculateDilution: (params: DilutionParams) => DilutionResult\n calculateSerialDilution: (params: SerialDilutionParams) => SerialDilutionResult\n convertMassToMolar: (\n mass: number,\n massUnit: MassVolumeUnit,\n mw: number\n ) => ConcentrationValue\n convertMolarToMass: (\n molar: number,\n molarUnit: MolarityUnit,\n mw: number\n ) => ConcentrationValue\n convertVolume: (value: number, from: VolumeUnit, to: VolumeUnit) => number\n formatVolume: (volume: VolumeValue, precision?: number) => string\n generateWellConcentrations: (\n result: SerialDilutionResult,\n wellIds: string[]\n ) => WellConcentration[]\n}\n\nconst VOLUME_UNITS: VolumeUnit[] = ['µL', 'mL', 'L']\n\nconst VOLUME_FACTORS: Record<VolumeUnit, number> = {\n 'µL': 1e-6,\n 'mL': 1e-3,\n 'L': 1,\n}\n\nexport function useDoseCalculator(): UseDoseCalculatorReturn {\n const { convert } = useConcentrationUnits()\n\n function convertVolume(value: number, from: VolumeUnit, to: VolumeUnit): number {\n if (from === to) return value\n const baseValue = value * VOLUME_FACTORS[from]\n return baseValue / VOLUME_FACTORS[to]\n }\n\n function formatVolume(volume: VolumeValue, precision: number = 3): string {\n const { value, unit } = volume\n if (value === 0) return `0 ${unit}`\n\n let formattedValue: string\n if (Math.abs(value) >= 1000) {\n formattedValue = value.toExponential(precision - 1)\n } else if (Math.abs(value) < 0.001) {\n formattedValue = value.toExponential(precision - 1)\n } else {\n formattedValue = value.toPrecision(precision)\n }\n\n // Remove trailing zeros\n formattedValue = formattedValue.replace(/\\.?0+$/, '')\n formattedValue = formattedValue.replace(/\\.?0+e/, 'e')\n\n return `${formattedValue} ${unit}`\n }\n\n function calculateDilution(params: DilutionParams): DilutionResult {\n const { stockConcentration, finalConcentration, finalVolume } = params\n\n // Validate inputs\n if (stockConcentration.value <= 0) {\n return {\n stockVolume: { value: 0, unit: 'µL' },\n diluentVolume: { value: 0, unit: 'µL' },\n dilutionFactor: 0,\n valid: false,\n error: 'Stock concentration must be positive',\n }\n }\n\n if (finalConcentration.value <= 0) {\n return {\n stockVolume: { value: 0, unit: 'µL' },\n diluentVolume: { value: 0, unit: 'µL' },\n dilutionFactor: 0,\n valid: false,\n error: 'Final concentration must be positive',\n }\n }\n\n if (finalVolume.value <= 0) {\n return {\n stockVolume: { value: 0, unit: 'µL' },\n diluentVolume: { value: 0, unit: 'µL' },\n dilutionFactor: 0,\n valid: false,\n error: 'Final volume must be positive',\n }\n }\n\n // Convert concentrations to same unit\n const convertedFinal = convert(\n finalConcentration.value,\n finalConcentration.unit,\n stockConcentration.unit\n )\n\n if (convertedFinal === null) {\n return {\n stockVolume: { value: 0, unit: 'µL' },\n diluentVolume: { value: 0, unit: 'µL' },\n dilutionFactor: 0,\n valid: false,\n error: 'Cannot convert between concentration units. Provide molecular weight for mass↔molarity conversion.',\n }\n }\n\n // Check that stock is more concentrated than final\n if (convertedFinal >= stockConcentration.value) {\n return {\n stockVolume: { value: 0, unit: 'µL' },\n diluentVolume: { value: 0, unit: 'µL' },\n dilutionFactor: 0,\n valid: false,\n error: 'Stock concentration must be higher than final concentration',\n }\n }\n\n // Calculate using C1V1 = C2V2\n const dilutionFactor = stockConcentration.value / convertedFinal\n const finalVolumeInL = convertVolume(finalVolume.value, finalVolume.unit, 'L')\n const stockVolumeInL = finalVolumeInL / dilutionFactor\n const diluentVolumeInL = finalVolumeInL - stockVolumeInL\n\n // Convert to appropriate unit (µL for small volumes, mL for larger)\n let outputUnit: VolumeUnit = 'µL'\n if (stockVolumeInL >= 0.001) outputUnit = 'mL'\n if (stockVolumeInL >= 1) outputUnit = 'L'\n\n return {\n stockVolume: {\n value: convertVolume(stockVolumeInL, 'L', outputUnit),\n unit: outputUnit,\n },\n diluentVolume: {\n value: convertVolume(diluentVolumeInL, 'L', outputUnit),\n unit: outputUnit,\n },\n dilutionFactor,\n valid: true,\n }\n }\n\n function calculateSerialDilution(params: SerialDilutionParams): SerialDilutionResult {\n const { startingConcentration, dilutionFactor, numberOfDilutions, volumePerWell } = params\n\n // Validate inputs\n if (startingConcentration.value <= 0) {\n return {\n steps: [],\n totalStockVolume: { value: 0, unit: 'µL' },\n valid: false,\n error: 'Starting concentration must be positive',\n }\n }\n\n if (dilutionFactor <= 1) {\n return {\n steps: [],\n totalStockVolume: { value: 0, unit: 'µL' },\n valid: false,\n error: 'Dilution factor must be greater than 1',\n }\n }\n\n if (numberOfDilutions < 1) {\n return {\n steps: [],\n totalStockVolume: { value: 0, unit: 'µL' },\n valid: false,\n error: 'Number of dilutions must be at least 1',\n }\n }\n\n if (volumePerWell.value <= 0) {\n return {\n steps: [],\n totalStockVolume: { value: 0, unit: 'µL' },\n valid: false,\n error: 'Volume per well must be positive',\n }\n }\n\n const steps: SerialDilutionStep[] = []\n let currentConcentration = startingConcentration.value\n const transferVolume = volumePerWell.value / (dilutionFactor - 1)\n const diluentVolume = volumePerWell.value - transferVolume\n\n for (let i = 0; i < numberOfDilutions; i++) {\n steps.push({\n stepNumber: i + 1,\n concentration: {\n value: currentConcentration,\n unit: startingConcentration.unit,\n },\n transferVolume: {\n value: i === 0 ? volumePerWell.value : transferVolume,\n unit: volumePerWell.unit,\n },\n diluentVolume: {\n value: i === 0 ? 0 : diluentVolume,\n unit: volumePerWell.unit,\n },\n })\n currentConcentration /= dilutionFactor\n }\n\n // Total stock needed for first well\n const totalStockVolume: VolumeValue = {\n value: volumePerWell.value + (transferVolume * (numberOfDilutions - 1)),\n unit: volumePerWell.unit,\n }\n\n return {\n steps,\n totalStockVolume,\n valid: true,\n }\n }\n\n function convertMassToMolar(\n mass: number,\n massUnit: MassVolumeUnit,\n mw: number\n ): ConcentrationValue {\n // Convert mass to g/mL, then to M using MW\n const converted = convert(mass, massUnit, 'µM', mw)\n if (converted !== null) {\n return { value: converted, unit: 'µM' }\n }\n // Fallback to manual calculation\n // mass (g/mL) / MW (g/mol) = mol/L = M\n const massInGML = mass * getMassVolumeFactor(massUnit)\n const molarConc = massInGML / mw\n return { value: molarConc * 1e6, unit: 'µM' }\n }\n\n function convertMolarToMass(\n molar: number,\n molarUnit: MolarityUnit,\n mw: number\n ): ConcentrationValue {\n // Convert M to mass using MW\n const converted = convert(molar, molarUnit, 'µg/mL', mw)\n if (converted !== null) {\n return { value: converted, unit: 'µg/mL' }\n }\n // Fallback to manual calculation\n // mol/L * MW (g/mol) = g/L = mg/mL\n const molarInM = molar * getMolarityFactor(molarUnit)\n const massConc = molarInM * mw * 1e6 // µg/mL\n return { value: massConc, unit: 'µg/mL' }\n }\n\n function getMassVolumeFactor(unit: MassVolumeUnit): number {\n const factors: Record<MassVolumeUnit, number> = {\n 'pg/mL': 1e-12,\n 'ng/mL': 1e-9,\n 'µg/mL': 1e-6,\n 'mg/mL': 1e-3,\n 'g/mL': 1,\n }\n return factors[unit]\n }\n\n function getMolarityFactor(unit: MolarityUnit): number {\n const factors: Record<MolarityUnit, number> = {\n 'pM': 1e-12,\n 'nM': 1e-9,\n 'µM': 1e-6,\n 'mM': 1e-3,\n 'M': 1,\n }\n return factors[unit]\n }\n\n function generateWellConcentrations(\n result: SerialDilutionResult,\n wellIds: string[]\n ): WellConcentration[] {\n if (!result.valid || result.steps.length === 0) return []\n\n return result.steps.slice(0, wellIds.length).map((step, index) => ({\n wellId: wellIds[index],\n concentration: step.concentration,\n volume: step.transferVolume,\n }))\n }\n\n return {\n volumeUnits: VOLUME_UNITS,\n calculateDilution,\n calculateSerialDilution,\n convertMassToMolar,\n convertMolarToMass,\n convertVolume,\n formatVolume,\n generateWellConcentrations,\n }\n}\n"],"names":[],"mappings":";AAwFA,MA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AK;AAAA,IAAA;AAEP,WAAO,QAAQ,IAAI;AAAA,EACrB;AAEA,WAAS,2BACP,QACA,SACqB;AACrB,QAAI,CAAC,OAAO,SAAS,OAAO,MAAM,WAAW,UAAU,CAAA;AAEvD,WAAO,OAAO,MAAM,MAAM,GAAG,QAAQ,MAAM,EAAE,IAAI,CAAC,MAAM,WAAW;AAAA,MACjE,QAAQ,QAAQ,KAAK;AAAA,MACrB,eAAe,KAAK;AAAA,MACpB,QAAQ,KAAK;AAAA,IAAA,EACb;AAAA,EACJ;AAEA,SAAO;AAAA,IACL,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,91 @@
1
+ import { Ref } from 'vue';
2
+ /**
3
+ * Validation rule function type.
4
+ * Returns error message string if invalid, undefined/null if valid.
5
+ */
6
+ export type ValidationRule<T = unknown> = (value: T, formData: Record<string, unknown>) => string | undefined | null;
7
+ /**
8
+ * Field validation rules configuration.
9
+ */
10
+ export interface FieldRules<T = unknown> {
11
+ required?: boolean | string;
12
+ minLength?: number | {
13
+ value: number;
14
+ message: string;
15
+ };
16
+ maxLength?: number | {
17
+ value: number;
18
+ message: string;
19
+ };
20
+ min?: number | {
21
+ value: number;
22
+ message: string;
23
+ };
24
+ max?: number | {
25
+ value: number;
26
+ message: string;
27
+ };
28
+ pattern?: RegExp | {
29
+ value: RegExp;
30
+ message: string;
31
+ };
32
+ email?: boolean | string;
33
+ custom?: ValidationRule<T> | ValidationRule<T>[];
34
+ }
35
+ /**
36
+ * Field validation rules configuration.
37
+ */
38
+ export interface FieldState {
39
+ value: unknown;
40
+ error: string | null;
41
+ touched: boolean;
42
+ dirty: boolean;
43
+ }
44
+ /**
45
+ * Form state and methods.
46
+ */
47
+ export interface UseFormReturn<T extends Record<string, unknown>> {
48
+ data: T;
49
+ errors: Record<string, string | null>;
50
+ touched: Record<string, boolean>;
51
+ dirty: Record<string, boolean>;
52
+ isValid: Ref<boolean>;
53
+ isDirty: Ref<boolean>;
54
+ isSubmitting: Ref<boolean>;
55
+ setFieldValue: <K extends keyof T>(field: K, value: T[K]) => void;
56
+ setFieldError: (field: string, error: string | null) => void;
57
+ setFieldTouched: (field: string, touched?: boolean) => void;
58
+ validateField: (field: string) => boolean;
59
+ validate: () => boolean;
60
+ reset: (values?: Partial<T>) => void;
61
+ handleSubmit: (onSubmit: (data: T) => Promise<void> | void) => (e?: Event) => Promise<void>;
62
+ getFieldProps: <K extends keyof T>(field: K) => {
63
+ modelValue: T[K];
64
+ 'onUpdate:modelValue': (value: T[K]) => void;
65
+ onBlur: () => void;
66
+ error: string | null;
67
+ };
68
+ }
69
+ /**
70
+ * Form state management composable with validation.
71
+ *
72
+ * @param initialValues - Initial form values
73
+ * @param rules - Validation rules for each field
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const { data, errors, isValid, handleSubmit, getFieldProps } = useForm(
78
+ * { email: '', password: '' },
79
+ * {
80
+ * email: { required: true, email: true },
81
+ * password: { required: true, minLength: 8 },
82
+ * }
83
+ * )
84
+ *
85
+ * // In template
86
+ * <BaseInput v-bind="getFieldProps('email')" label="Email" />
87
+ * <BaseInput v-bind="getFieldProps('password')" type="password" label="Password" />
88
+ * <BaseButton @click="handleSubmit(onSubmit)" :disabled="!isValid">Submit</BaseButton>
89
+ * ```
90
+ */
91
+ export declare function useForm<T extends Record<string, unknown>>(initialValues: T, rules?: Partial<Record<keyof T, FieldRules>>): UseFormReturn<T>;
@@ -0,0 +1,253 @@
1
+ import { reactive, ref, watch, computed } from "vue";
2
+ const validators = {
3
+ required: (value, message = "This field is required") => {
4
+ if (value === null || value === void 0 || value === "") {
5
+ return message;
6
+ }
7
+ if (Array.isArray(value) && value.length === 0) {
8
+ return message;
9
+ }
10
+ return null;
11
+ },
12
+ minLength: (value, min, message) => {
13
+ if (typeof value !== "string") return null;
14
+ if (value.length < min) {
15
+ return message || `Must be at least ${min} characters`;
16
+ }
17
+ return null;
18
+ },
19
+ maxLength: (value, max, message) => {
20
+ if (typeof value !== "string") return null;
21
+ if (value.length > max) {
22
+ return message || `Must be at most ${max} characters`;
23
+ }
24
+ return null;
25
+ },
26
+ min: (value, min, message) => {
27
+ if (typeof value !== "number") return null;
28
+ if (value < min) {
29
+ return message || `Must be at least ${min}`;
30
+ }
31
+ return null;
32
+ },
33
+ max: (value, max, message) => {
34
+ if (typeof value !== "number") return null;
35
+ if (value > max) {
36
+ return message || `Must be at most ${max}`;
37
+ }
38
+ return null;
39
+ },
40
+ pattern: (value, pattern, message) => {
41
+ if (typeof value !== "string") return null;
42
+ if (!pattern.test(value)) {
43
+ return message || "Invalid format";
44
+ }
45
+ return null;
46
+ },
47
+ email: (value, message = "Invalid email address") => {
48
+ if (typeof value !== "string" || !value) return null;
49
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
50
+ if (!emailRegex.test(value)) {
51
+ return message;
52
+ }
53
+ return null;
54
+ }
55
+ };
56
+ function useForm(initialValues, rules = {}) {
57
+ const _initialValues = { ...initialValues };
58
+ const data = reactive({ ...initialValues });
59
+ const errors = reactive(
60
+ Object.keys(initialValues).reduce((acc, key) => {
61
+ acc[key] = null;
62
+ return acc;
63
+ }, {})
64
+ );
65
+ const touched = reactive(
66
+ Object.keys(initialValues).reduce((acc, key) => {
67
+ acc[key] = false;
68
+ return acc;
69
+ }, {})
70
+ );
71
+ const dirty = reactive(
72
+ Object.keys(initialValues).reduce((acc, key) => {
73
+ acc[key] = false;
74
+ return acc;
75
+ }, {})
76
+ );
77
+ const isSubmitting = ref(false);
78
+ watch(
79
+ () => ({ ...data }),
80
+ (newData) => {
81
+ for (const key of Object.keys(newData)) {
82
+ dirty[key] = newData[key] !== _initialValues[key];
83
+ }
84
+ },
85
+ { deep: true }
86
+ );
87
+ function validateField(field) {
88
+ const value = data[field];
89
+ const fieldRules = rules[field];
90
+ if (!fieldRules) {
91
+ errors[field] = null;
92
+ return true;
93
+ }
94
+ if (fieldRules.required) {
95
+ const message = typeof fieldRules.required === "string" ? fieldRules.required : void 0;
96
+ const error = validators.required(value, message);
97
+ if (error) {
98
+ errors[field] = error;
99
+ return false;
100
+ }
101
+ }
102
+ if (value === null || value === void 0 || value === "") {
103
+ errors[field] = null;
104
+ return true;
105
+ }
106
+ if (fieldRules.minLength !== void 0) {
107
+ const config = typeof fieldRules.minLength === "number" ? { value: fieldRules.minLength, message: void 0 } : fieldRules.minLength;
108
+ const error = validators.minLength(value, config.value, config.message);
109
+ if (error) {
110
+ errors[field] = error;
111
+ return false;
112
+ }
113
+ }
114
+ if (fieldRules.maxLength !== void 0) {
115
+ const config = typeof fieldRules.maxLength === "number" ? { value: fieldRules.maxLength, message: void 0 } : fieldRules.maxLength;
116
+ const error = validators.maxLength(value, config.value, config.message);
117
+ if (error) {
118
+ errors[field] = error;
119
+ return false;
120
+ }
121
+ }
122
+ if (fieldRules.min !== void 0) {
123
+ const config = typeof fieldRules.min === "number" ? { value: fieldRules.min, message: void 0 } : fieldRules.min;
124
+ const error = validators.min(value, config.value, config.message);
125
+ if (error) {
126
+ errors[field] = error;
127
+ return false;
128
+ }
129
+ }
130
+ if (fieldRules.max !== void 0) {
131
+ const config = typeof fieldRules.max === "number" ? { value: fieldRules.max, message: void 0 } : fieldRules.max;
132
+ const error = validators.max(value, config.value, config.message);
133
+ if (error) {
134
+ errors[field] = error;
135
+ return false;
136
+ }
137
+ }
138
+ if (fieldRules.pattern !== void 0) {
139
+ const config = fieldRules.pattern instanceof RegExp ? { value: fieldRules.pattern, message: void 0 } : fieldRules.pattern;
140
+ const error = validators.pattern(value, config.value, config.message);
141
+ if (error) {
142
+ errors[field] = error;
143
+ return false;
144
+ }
145
+ }
146
+ if (fieldRules.email) {
147
+ const message = typeof fieldRules.email === "string" ? fieldRules.email : void 0;
148
+ const error = validators.email(value, message);
149
+ if (error) {
150
+ errors[field] = error;
151
+ return false;
152
+ }
153
+ }
154
+ if (fieldRules.custom) {
155
+ const customRules = Array.isArray(fieldRules.custom) ? fieldRules.custom : [fieldRules.custom];
156
+ for (const rule of customRules) {
157
+ const error = rule(value, data);
158
+ if (error) {
159
+ errors[field] = error;
160
+ return false;
161
+ }
162
+ }
163
+ }
164
+ errors[field] = null;
165
+ return true;
166
+ }
167
+ function validate() {
168
+ let isAllValid = true;
169
+ for (const field of Object.keys(data)) {
170
+ if (!validateField(field)) {
171
+ isAllValid = false;
172
+ }
173
+ }
174
+ return isAllValid;
175
+ }
176
+ const isValid = computed(() => {
177
+ return Object.values(errors).every((error) => error === null);
178
+ });
179
+ const isDirty = computed(() => {
180
+ return Object.values(dirty).some((d) => d);
181
+ });
182
+ function setFieldValue(field, value) {
183
+ data[field] = value;
184
+ if (touched[field]) {
185
+ validateField(field);
186
+ }
187
+ }
188
+ function setFieldError(field, error) {
189
+ errors[field] = error;
190
+ }
191
+ function setFieldTouched(field, isTouched = true) {
192
+ touched[field] = isTouched;
193
+ if (isTouched) {
194
+ validateField(field);
195
+ }
196
+ }
197
+ function reset(values) {
198
+ const resetValues = values ? { ..._initialValues, ...values } : _initialValues;
199
+ for (const key of Object.keys(data)) {
200
+ data[key] = resetValues[key];
201
+ errors[key] = null;
202
+ touched[key] = false;
203
+ dirty[key] = false;
204
+ }
205
+ }
206
+ function handleSubmit(onSubmit) {
207
+ return async (e) => {
208
+ e == null ? void 0 : e.preventDefault();
209
+ for (const field of Object.keys(data)) {
210
+ touched[field] = true;
211
+ }
212
+ if (!validate()) {
213
+ return;
214
+ }
215
+ isSubmitting.value = true;
216
+ try {
217
+ await onSubmit(data);
218
+ } finally {
219
+ isSubmitting.value = false;
220
+ }
221
+ };
222
+ }
223
+ function getFieldProps(field) {
224
+ const fieldStr = field;
225
+ return {
226
+ modelValue: data[field],
227
+ "onUpdate:modelValue": (value) => setFieldValue(field, value),
228
+ onBlur: () => setFieldTouched(fieldStr),
229
+ error: touched[fieldStr] ? errors[fieldStr] : null
230
+ };
231
+ }
232
+ return {
233
+ data,
234
+ errors,
235
+ touched,
236
+ dirty,
237
+ isValid,
238
+ isDirty,
239
+ isSubmitting,
240
+ setFieldValue,
241
+ setFieldError,
242
+ setFieldTouched,
243
+ validateField,
244
+ validate,
245
+ reset,
246
+ handleSubmit,
247
+ getFieldProps
248
+ };
249
+ }
250
+ export {
251
+ useForm
252
+ };
253
+ //# sourceMappingURL=useForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useForm.js","sources":["../../src/composables/useForm.ts"],"sourcesContent":["import { ref, reactive, computed, watch, type Ref } from 'vue'\n\n/**\n * Validation rule function type.\n * Returns error message string if invalid, undefined/null if valid.\n */\nexport type ValidationRule<T = unknown> = (value: T, formData: Record<string, unknown>) => string | undefined | null\n\n/**\n * Field validation rules configuration.\n */\nexport interface FieldRules<T = unknown> {\n required?: boolean | string\n minLength?: number | { value: number; message: string }\n maxLength?: number | { value: number; message: string }\n min?: number | { value: number; message: string }\n max?: number | { value: number; message: string }\n pattern?: RegExp | { value: RegExp; message: string }\n email?: boolean | string\n custom?: ValidationRule<T> | ValidationRule<T>[]\n}\n\n/**\n * Field validation rules configuration.\n */\nexport interface FieldState {\n value: unknown\n error: string | null\n touched: boolean\n dirty: boolean\n}\n\n/**\n * Form state and methods.\n */\nexport interface UseFormReturn<T extends Record<string, unknown>> {\n // Form data (reactive)\n data: T\n\n // Field errors\n errors: Record<string, string | null>\n\n // Field touched state\n touched: Record<string, boolean>\n\n // Field dirty state (value changed from initial)\n dirty: Record<string, boolean>\n\n // Overall form state\n isValid: Ref<boolean>\n isDirty: Ref<boolean>\n isSubmitting: Ref<boolean>\n\n // Methods\n setFieldValue: <K extends keyof T>(field: K, value: T[K]) => void\n setFieldError: (field: string, error: string | null) => void\n setFieldTouched: (field: string, touched?: boolean) => void\n validateField: (field: string) => boolean\n validate: () => boolean\n reset: (values?: Partial<T>) => void\n handleSubmit: (onSubmit: (data: T) => Promise<void> | void) => (e?: Event) => Promise<void>\n getFieldProps: <K extends keyof T>(field: K) => {\n modelValue: T[K]\n 'onUpdate:modelValue': (value: T[K]) => void\n onBlur: () => void\n error: string | null\n }\n}\n\n// Built-in validators\nconst validators = {\n required: (value: unknown, message = 'This field is required'): string | null => {\n if (value === null || value === undefined || value === '') {\n return message\n }\n if (Array.isArray(value) && value.length === 0) {\n return message\n }\n return null\n },\n\n minLength: (value: unknown, min: number, message?: string): string | null => {\n if (typeof value !== 'string') return null\n if (value.length < min) {\n return message || `Must be at least ${min} characters`\n }\n return null\n },\n\n maxLength: (value: unknown, max: number, message?: string): string | null => {\n if (typeof value !== 'string') return null\n if (value.length > max) {\n return message || `Must be at most ${max} characters`\n }\n return null\n },\n\n min: (value: unknown, min: number, message?: string): string | null => {\n if (typeof value !== 'number') return null\n if (value < min) {\n return message || `Must be at least ${min}`\n }\n return null\n },\n\n max: (value: unknown, max: number, message?: string): string | null => {\n if (typeof value !== 'number') return null\n if (value > max) {\n return message || `Must be at most ${max}`\n }\n return null\n },\n\n pattern: (value: unknown, pattern: RegExp, message?: string): string | null => {\n if (typeof value !== 'string') return null\n if (!pattern.test(value)) {\n return message || 'Invalid format'\n }\n return null\n },\n\n email: (value: unknown, message = 'Invalid email address'): string | null => {\n if (typeof value !== 'string' || !value) return null\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n if (!emailRegex.test(value)) {\n return message\n }\n return null\n },\n}\n\n/**\n * Form state management composable with validation.\n *\n * @param initialValues - Initial form values\n * @param rules - Validation rules for each field\n *\n * @example\n * ```typescript\n * const { data, errors, isValid, handleSubmit, getFieldProps } = useForm(\n * { email: '', password: '' },\n * {\n * email: { required: true, email: true },\n * password: { required: true, minLength: 8 },\n * }\n * )\n *\n * // In template\n * <BaseInput v-bind=\"getFieldProps('email')\" label=\"Email\" />\n * <BaseInput v-bind=\"getFieldProps('password')\" type=\"password\" label=\"Password\" />\n * <BaseButton @click=\"handleSubmit(onSubmit)\" :disabled=\"!isValid\">Submit</BaseButton>\n * ```\n */\nexport function useForm<T extends Record<string, unknown>>(\n initialValues: T,\n rules: Partial<Record<keyof T, FieldRules>> = {}\n): UseFormReturn<T> {\n // Store initial values for reset\n const _initialValues = { ...initialValues }\n\n // Reactive form data\n const data = reactive({ ...initialValues }) as T\n\n // Field state - use simple Record types for better TS compatibility\n const errors = reactive<Record<string, string | null>>(\n Object.keys(initialValues).reduce((acc, key) => {\n acc[key] = null\n return acc\n }, {} as Record<string, string | null>)\n )\n\n const touched = reactive<Record<string, boolean>>(\n Object.keys(initialValues).reduce((acc, key) => {\n acc[key] = false\n return acc\n }, {} as Record<string, boolean>)\n )\n\n const dirty = reactive<Record<string, boolean>>(\n Object.keys(initialValues).reduce((acc, key) => {\n acc[key] = false\n return acc\n }, {} as Record<string, boolean>)\n )\n\n const isSubmitting = ref(false)\n\n // Watch data changes to track dirty state\n watch(\n () => ({ ...data }),\n (newData) => {\n for (const key of Object.keys(newData)) {\n dirty[key] = newData[key as keyof T] !== _initialValues[key as keyof T]\n }\n },\n { deep: true }\n )\n\n // Validate a single field\n function validateField(field: string): boolean {\n const value = data[field as keyof T]\n const fieldRules = rules[field as keyof T]\n\n if (!fieldRules) {\n errors[field] = null\n return true\n }\n\n // Check required\n if (fieldRules.required) {\n const message = typeof fieldRules.required === 'string' ? fieldRules.required : undefined\n const error = validators.required(value, message)\n if (error) {\n errors[field] = error\n return false\n }\n }\n\n // Skip other validations if empty and not required\n if (value === null || value === undefined || value === '') {\n errors[field] = null\n return true\n }\n\n // Check minLength\n if (fieldRules.minLength !== undefined) {\n const config = typeof fieldRules.minLength === 'number'\n ? { value: fieldRules.minLength, message: undefined }\n : fieldRules.minLength\n const error = validators.minLength(value, config.value, config.message)\n if (error) {\n errors[field] = error\n return false\n }\n }\n\n // Check maxLength\n if (fieldRules.maxLength !== undefined) {\n const config = typeof fieldRules.maxLength === 'number'\n ? { value: fieldRules.maxLength, message: undefined }\n : fieldRules.maxLength\n const error = validators.maxLength(value, config.value, config.message)\n if (error) {\n errors[field] = error\n return false\n }\n }\n\n // Check min\n if (fieldRules.min !== undefined) {\n const config = typeof fieldRules.min === 'number'\n ? { value: fieldRules.min, message: undefined }\n : fieldRules.min\n const error = validators.min(value, config.value, config.message)\n if (error) {\n errors[field] = error\n return false\n }\n }\n\n // Check max\n if (fieldRules.max !== undefined) {\n const config = typeof fieldRules.max === 'number'\n ? { value: fieldRules.max, message: undefined }\n : fieldRules.max\n const error = validators.max(value, config.value, config.message)\n if (error) {\n errors[field] = error\n return false\n }\n }\n\n // Check pattern\n if (fieldRules.pattern !== undefined) {\n const config = fieldRules.pattern instanceof RegExp\n ? { value: fieldRules.pattern, message: undefined }\n : fieldRules.pattern\n const error = validators.pattern(value, config.value, config.message)\n if (error) {\n errors[field] = error\n return false\n }\n }\n\n // Check email\n if (fieldRules.email) {\n const message = typeof fieldRules.email === 'string' ? fieldRules.email : undefined\n const error = validators.email(value, message)\n if (error) {\n errors[field] = error\n return false\n }\n }\n\n // Check custom validators\n if (fieldRules.custom) {\n const customRules = Array.isArray(fieldRules.custom) ? fieldRules.custom : [fieldRules.custom]\n for (const rule of customRules) {\n const error = rule(value, data as Record<string, unknown>)\n if (error) {\n errors[field] = error\n return false\n }\n }\n }\n\n errors[field] = null\n return true\n }\n\n // Validate all fields\n function validate(): boolean {\n let isAllValid = true\n for (const field of Object.keys(data)) {\n if (!validateField(field)) {\n isAllValid = false\n }\n }\n return isAllValid\n }\n\n // Computed overall validity\n const isValid = computed(() => {\n return Object.values(errors).every(error => error === null)\n })\n\n // Computed overall dirty state\n const isDirty = computed(() => {\n return Object.values(dirty).some(d => d)\n })\n\n // Set field value\n function setFieldValue<K extends keyof T>(field: K, value: T[K]): void {\n ;(data as Record<string, unknown>)[field as string] = value\n if (touched[field as string]) {\n validateField(field as string)\n }\n }\n\n // Set field error\n function setFieldError(field: string, error: string | null): void {\n errors[field] = error\n }\n\n // Set field touched\n function setFieldTouched(field: string, isTouched = true): void {\n touched[field] = isTouched\n if (isTouched) {\n validateField(field)\n }\n }\n\n // Reset form\n function reset(values?: Partial<T>): void {\n const resetValues = values ? { ..._initialValues, ...values } : _initialValues\n for (const key of Object.keys(data)) {\n ;(data as Record<string, unknown>)[key] = resetValues[key as keyof T]\n errors[key] = null\n touched[key] = false\n dirty[key] = false\n }\n }\n\n // Handle submit\n function handleSubmit(onSubmit: (data: T) => Promise<void> | void) {\n return async (e?: Event): Promise<void> => {\n e?.preventDefault()\n\n // Mark all fields as touched\n for (const field of Object.keys(data)) {\n touched[field] = true\n }\n\n if (!validate()) {\n return\n }\n\n isSubmitting.value = true\n try {\n await onSubmit(data)\n } finally {\n isSubmitting.value = false\n }\n }\n }\n\n // Get props for a field (for v-bind)\n function getFieldProps<K extends keyof T>(field: K) {\n const fieldStr = field as string\n return {\n modelValue: data[field],\n 'onUpdate:modelValue': (value: T[K]) => setFieldValue(field, value),\n onBlur: () => setFieldTouched(fieldStr),\n error: touched[fieldStr] ? errors[fieldStr] : null,\n }\n }\n\n return {\n data,\n errors,\n touched,\n dirty,\n isValid,\n isDirty,\n isSubmitting,\n setFieldValue,\n setFieldError,\n setFieldTouched,\n validateField,\n validate,\n reset,\n handleSubmit,\n getFieldProps,\n }\n}\n"],"names":[],"mappings":";AAsEA,MAAM,aAAa;AAAA,EACjB,UAAU,CAAC,OAAgB,UAAU,6BAA4C;AAC/E,QAAI,UAAU,QAAQ,UAAU,UAAa,UAAU,IAAI;AACzD,aAAO;AAAA,IACT;AACA,QAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;AAC9C,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAAA,EAEA,WAAW,CAAC,OAAgB,KAAa,YAAoC;AAC3E,QAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAI,MAAM,SAAS,KAAK;AACtB,aAAO,WAAW,oBAAoB,GAAG;AAAA,IAC3C;AACA,WAAO;AAAA,EACT;AAAA,EAEA,WAAW,CAAC,OAAgB,KAAa,YAAoC;AAC3E,QAAI,OAAO,UAAU,SAAU,QAAO;AAC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ACzC,6BAAG;AAGH,iBAAW,SAAS,OAAO,KAAK,IAAI,GAAG;AACrC,gBAAQ,KAAK,IAAI;AAAA,MACnB;AAEA,UAAI,CAAC,YAAY;AACf;AAAA,MACF;AAEA,mBAAa,QAAQ;AACrB,UAAI;AACF,cAAM,SAAS,IAAI;AAAA,MACrB,UAAA;AACE,qBAAa,QAAQ;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AAGA,WAAS,cAAiC,OAAU;AAClD,UAAM,WAAW;AACjB,WAAO;AAAA,MACL,YAAY,KAAK,KAAK;AAAA,MACtB,uBAAuB,CAAC,UAAgB,cAAc,OAAO,KAAK;AAAA,MAClE,QAAQ,MAAM,gBAAgB,QAAQ;AAAA,MACtC,OAAO,QAAQ,QAAQ,IAAI,OAAO,QAAQ,IAAI;AAAA,IAAA;AAAA,EAElD;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,9 @@
1
+ import { CredentialInfo } from '../types';
2
+ export declare function usePasskey(): {
3
+ isSupported: () => boolean;
4
+ registerPasskey: (deviceName?: string) => Promise<boolean>;
5
+ loginWithPasskey: () => Promise<boolean>;
6
+ listCredentials: () => Promise<CredentialInfo[]>;
7
+ deleteCredential: (credentialId: string) => Promise<boolean>;
8
+ deleteAllCredentials: () => Promise<boolean>;
9
+ };