@apple-pie/slice 0.0.6 → 0.0.8

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 (413) hide show
  1. package/README.md +34 -4
  2. package/dist/cjs/chunks/Avatar-0EXaRG4e.js +54 -0
  3. package/dist/cjs/chunks/AvatarGroup-BsRUAZl0.js +37 -0
  4. package/dist/cjs/chunks/Badge-Bv6c2YVC.js +23 -0
  5. package/dist/cjs/chunks/Button-DFAWHJmQ.js +246 -0
  6. package/dist/cjs/chunks/ButtonBar-DOgYDAda.js +53 -0
  7. package/dist/cjs/chunks/Card-BPClSuHa.js +37 -0
  8. package/dist/cjs/chunks/CheckBox-tsExpwtr.js +56 -0
  9. package/dist/cjs/chunks/Chip-CPHF1zn-.js +84 -0
  10. package/dist/cjs/chunks/DivInput-DDQVtlot.js +102 -0
  11. package/dist/cjs/chunks/DocIcons-B5TcBqSH.js +108 -0
  12. package/dist/cjs/chunks/Dot-BSSClfHQ.js +73 -0
  13. package/dist/cjs/chunks/DrggablePanel-wWLPesc8.js +202 -0
  14. package/dist/cjs/chunks/DropDown-COdCr77A.js +102 -0
  15. package/dist/cjs/chunks/ErrorSummary-CIUqlSLC.js +60 -0
  16. package/dist/cjs/chunks/FileIcon-DTQaXxfC.js +221 -0
  17. package/dist/cjs/chunks/FileList-J2EgJyCo.js +217 -0
  18. package/dist/cjs/chunks/FlexDiv-CW5gSa4V.js +65 -0
  19. package/dist/cjs/chunks/Grouper-QwwunKen.js +61 -0
  20. package/dist/cjs/chunks/IconButton-B53y3z1_.js +77 -0
  21. package/dist/cjs/chunks/Label-DoiS07-y.js +111 -0
  22. package/dist/cjs/chunks/Logos-CAHU-eIP.js +483 -0
  23. package/dist/cjs/chunks/Overlay-Bb2YoSKr.js +36 -0
  24. package/dist/cjs/chunks/Pager-CN2z8M9E.js +37 -0
  25. package/dist/cjs/chunks/ProgressIndicator-BbrZ7Aoc.js +157 -0
  26. package/dist/cjs/chunks/PromptInput-BXDqUXFQ.js +150 -0
  27. package/dist/cjs/chunks/RadioButton-GKRhZEmb.js +56 -0
  28. package/dist/cjs/chunks/RadioButtonList-CFpZmyAX.js +59 -0
  29. package/dist/cjs/chunks/Slider-CZvCAodl.js +136 -0
  30. package/dist/cjs/chunks/Spacer-CtxV2Pww.js +18 -0
  31. package/dist/cjs/chunks/Switch-C94aofxQ.js +37 -0
  32. package/dist/cjs/chunks/TabBar-D6akzNUf.js +123 -0
  33. package/dist/cjs/chunks/TextArea-DjF8Koup.js +82 -0
  34. package/dist/cjs/chunks/TextField-Cg6mQcYl.js +204 -0
  35. package/dist/cjs/chunks/Tip-CjMHa-fD.js +88 -0
  36. package/dist/cjs/chunks/Toast-Cdyh6T-l.js +163 -0
  37. package/dist/cjs/chunks/UploadArea-BmZ50EEl.js +123 -0
  38. package/dist/cjs/chunks/_types-B5xXv4NA.js +1386 -0
  39. package/dist/cjs/chunks/sharedTypes-gCECyn2N.js +6 -0
  40. package/dist/cjs/chunks/style-inject.es-CMuL-BfJ.js +11 -0
  41. package/dist/cjs/chunks/tipStore-Ck4NLvml.js +17 -0
  42. package/dist/cjs/chunks/toastStore-CSStgB9d.js +17 -0
  43. package/dist/cjs/chunks/tslib.es6-C8dZW5nY.js +49 -0
  44. package/dist/cjs/chunks/uploads-worker-mD8pcsGP.js +221 -0
  45. package/dist/cjs/chunks/uploadsStore-CxWIctvI.js +75 -0
  46. package/dist/cjs/chunks/utils-BsBHecUI.js +70 -0
  47. package/dist/cjs/chunks/windowStore-RaJswiHM.js +70 -0
  48. package/dist/cjs/hooks/useDoubleClick.js +11 -23
  49. package/dist/cjs/hooks/useKeyboardShortcuts.js +18 -35
  50. package/dist/cjs/hooks/useLastUpdated.js +20 -42
  51. package/dist/cjs/hooks/useLocalStore.js +23 -39
  52. package/dist/cjs/hooks/useObserveResize.js +26 -44
  53. package/dist/cjs/hooks/useObserveTheme.js +18 -36
  54. package/dist/cjs/hooks/useTheme.js +17 -40
  55. package/dist/cjs/hooks/useToolTip.js +19 -32
  56. package/dist/cjs/hooks/useTrackRenders.js +11 -29
  57. package/dist/cjs/hooks/useWindow.js +29 -65
  58. package/dist/cjs/hooks.js +12 -30
  59. package/dist/cjs/index.js +46 -134
  60. package/dist/cjs/providers/ThemeProvider.js +27 -45
  61. package/dist/cjs/providers.js +5 -12
  62. package/dist/cjs/stores/tip.js +4 -9
  63. package/dist/cjs/stores/toast.js +4 -9
  64. package/dist/cjs/stores/uploads.js +11 -0
  65. package/dist/cjs/stores/window.js +8 -10
  66. package/dist/cjs/stores.js +18 -21
  67. package/dist/cjs/theme/colors.js +371 -379
  68. package/dist/cjs/theme/corners.js +10 -12
  69. package/dist/cjs/theme/elevations.js +10 -13
  70. package/dist/cjs/theme/themes.js +8 -13
  71. package/dist/cjs/theme/type.js +225 -384
  72. package/dist/cjs/theme.js +5 -13
  73. package/dist/cjs/uikit/Avatar/index.js +6 -0
  74. package/dist/cjs/uikit/AvatarGroup/index.js +7 -0
  75. package/dist/cjs/uikit/Badge/index.js +6 -0
  76. package/dist/cjs/uikit/Button/index.js +12 -0
  77. package/dist/cjs/uikit/ButtonBar/index.js +12 -0
  78. package/dist/cjs/uikit/Card/index.js +10 -0
  79. package/dist/cjs/uikit/CheckBox/index.js +10 -0
  80. package/dist/cjs/uikit/Chip/index.js +11 -0
  81. package/dist/cjs/uikit/DivInput/index.js +7 -0
  82. package/dist/cjs/uikit/DocIcon/index.js +9 -0
  83. package/dist/cjs/uikit/Dot/index.js +6 -0
  84. package/dist/cjs/uikit/DraggablePanel/index.js +10 -0
  85. package/dist/cjs/uikit/DropDown/index.js +10 -0
  86. package/dist/cjs/uikit/ErrorSummary/index.js +6 -0
  87. package/dist/cjs/uikit/FileIcon/index.js +15 -0
  88. package/dist/cjs/uikit/FileList/index.js +11 -0
  89. package/dist/cjs/uikit/FlexDiv/index.js +6 -0
  90. package/dist/cjs/uikit/Grouper/index.js +11 -0
  91. package/dist/cjs/uikit/Icon/index.js +14 -0
  92. package/dist/cjs/uikit/IconButton/index.js +12 -0
  93. package/dist/cjs/uikit/Label/index.js +10 -0
  94. package/dist/cjs/uikit/Logos/index.js +9 -0
  95. package/dist/cjs/uikit/Overlay/index.js +6 -0
  96. package/dist/cjs/uikit/Pager/index.js +7 -0
  97. package/dist/cjs/uikit/Progress/index.js +10 -0
  98. package/dist/cjs/uikit/PromptInput/index.js +14 -0
  99. package/dist/cjs/uikit/RadioButton/index.js +12 -0
  100. package/dist/cjs/uikit/RadioButtonList/index.js +13 -0
  101. package/dist/cjs/uikit/Slider/index.js +7 -0
  102. package/dist/cjs/uikit/Spacer/index.js +6 -0
  103. package/dist/cjs/uikit/Switch/index.js +6 -0
  104. package/dist/cjs/uikit/TabBar/index.js +12 -0
  105. package/dist/cjs/uikit/TextArea/index.js +13 -0
  106. package/dist/cjs/uikit/Textfield/index.js +13 -0
  107. package/dist/cjs/uikit/Tip/index.js +7 -0
  108. package/dist/cjs/uikit/Toast/index.js +16 -0
  109. package/dist/cjs/uikit/UploadArea/index.js +15 -0
  110. package/dist/cjs/workers/uploads/uploads.js +5 -0
  111. package/dist/esm/chunks/Avatar-D_W5zErj.mjs +60 -0
  112. package/dist/esm/chunks/AvatarGroup-Dbfmz0Yz.mjs +45 -0
  113. package/dist/esm/chunks/Badge-BISGWj5-.mjs +29 -0
  114. package/dist/esm/chunks/Button-B_aIY6wE.mjs +264 -0
  115. package/dist/esm/chunks/ButtonBar-Cr6TFvvD.mjs +66 -0
  116. package/dist/esm/chunks/Card-BzKBF0ny.mjs +45 -0
  117. package/dist/esm/chunks/CheckBox-CYggPKaT.mjs +68 -0
  118. package/dist/esm/chunks/Chip-B3wb9g1U.mjs +96 -0
  119. package/dist/esm/chunks/DivInput-_VL6PAqT.mjs +114 -0
  120. package/dist/esm/chunks/DocIcons-BxtcXsWI.mjs +114 -0
  121. package/dist/esm/chunks/Dot-C-Xu24wF.mjs +81 -0
  122. package/dist/esm/chunks/DrggablePanel-Bg3UKK1k.mjs +214 -0
  123. package/dist/esm/chunks/DropDown-D7KyGLkM.mjs +114 -0
  124. package/dist/esm/chunks/ErrorSummary-CZw06dSh.mjs +68 -0
  125. package/dist/esm/chunks/FileIcon-BcIJzIwA.mjs +233 -0
  126. package/dist/esm/chunks/FileList-DUzgHfE-.mjs +229 -0
  127. package/dist/esm/chunks/FlexDiv-BLYDgWu2.mjs +73 -0
  128. package/dist/esm/chunks/Grouper-CRldBHSw.mjs +75 -0
  129. package/dist/esm/chunks/IconButton-BBiZrXlS.mjs +93 -0
  130. package/dist/esm/chunks/Label-DPIAVkn1.mjs +124 -0
  131. package/dist/esm/chunks/Logos-CpcaarOG.mjs +493 -0
  132. package/dist/esm/chunks/Overlay-Bh0enFIe.mjs +44 -0
  133. package/dist/esm/chunks/Pager-B-1ZRUzU.mjs +45 -0
  134. package/dist/esm/chunks/ProgressIndicator-CNOBQ_Fv.mjs +167 -0
  135. package/dist/esm/chunks/PromptInput-DdsIgZ3T.mjs +160 -0
  136. package/dist/esm/chunks/RadioButton-D-TdQu3a.mjs +66 -0
  137. package/dist/esm/chunks/RadioButtonList-CEScWkbT.mjs +67 -0
  138. package/dist/esm/chunks/Slider-C3A8GCfH.mjs +142 -0
  139. package/dist/esm/chunks/Spacer-BlgEdKEM.mjs +20 -0
  140. package/dist/esm/chunks/Switch-obpmvCGd.mjs +45 -0
  141. package/dist/esm/chunks/TabBar-DFj021UP.mjs +141 -0
  142. package/dist/esm/chunks/TextArea-D_hq6VF3.mjs +90 -0
  143. package/dist/esm/chunks/TextField-Co0u-xdd.mjs +222 -0
  144. package/dist/esm/chunks/Tip-CHQh-Yq0.mjs +98 -0
  145. package/dist/esm/chunks/Toast-BiXzVFtM.mjs +179 -0
  146. package/dist/esm/chunks/UploadArea-B9685Z06.mjs +133 -0
  147. package/dist/esm/chunks/_types-KZDzhaiK.mjs +1395 -0
  148. package/dist/esm/chunks/sharedTypes-tn9-uJvb.mjs +8 -0
  149. package/dist/esm/chunks/style-inject.es-D0BjEaN8.mjs +11 -0
  150. package/dist/esm/chunks/tipStore-CL5a95Bl.mjs +15 -0
  151. package/dist/esm/chunks/toastStore-D2PEIqCo.mjs +15 -0
  152. package/dist/esm/chunks/tslib.es6-c-7TIv71.mjs +53 -0
  153. package/dist/esm/chunks/uploads-worker-Dv-4zGnC.mjs +224 -0
  154. package/dist/esm/chunks/uploadsStore-D69fEXMY.mjs +72 -0
  155. package/dist/esm/chunks/utils-BQ1v7VE4.mjs +74 -0
  156. package/dist/esm/chunks/windowStore-CwW0i_le.mjs +71 -0
  157. package/dist/esm/hooks/useDoubleClick.mjs +14 -0
  158. package/dist/esm/hooks/useKeyboardShortcuts.mjs +27 -0
  159. package/dist/esm/hooks/useLastUpdated.mjs +31 -0
  160. package/dist/esm/hooks/useLocalStore.mjs +36 -0
  161. package/dist/esm/hooks/useObserveResize.mjs +38 -0
  162. package/dist/esm/hooks/useObserveTheme.mjs +34 -0
  163. package/dist/esm/hooks/useTheme.mjs +73 -0
  164. package/dist/esm/hooks/useToolTip.mjs +23 -0
  165. package/dist/esm/hooks/useTrackRenders.mjs +23 -0
  166. package/dist/esm/hooks/useWindow.mjs +52 -0
  167. package/dist/esm/hooks.mjs +29 -0
  168. package/dist/esm/index.mjs +117 -0
  169. package/dist/esm/providers/ThemeProvider.mjs +49 -0
  170. package/dist/esm/providers.mjs +15 -0
  171. package/dist/esm/stores/tip.mjs +3 -0
  172. package/dist/esm/stores/toast.mjs +3 -0
  173. package/dist/esm/stores/uploads.mjs +7 -0
  174. package/dist/esm/stores/window.mjs +3 -0
  175. package/dist/esm/stores.mjs +13 -0
  176. package/dist/esm/theme/colors.mjs +373 -0
  177. package/dist/esm/theme/corners.mjs +12 -0
  178. package/dist/esm/theme/elevations.mjs +15 -0
  179. package/dist/esm/theme/themes.mjs +25 -0
  180. package/dist/esm/theme/type.mjs +236 -0
  181. package/dist/esm/theme.mjs +9 -0
  182. package/dist/esm/uikit/Avatar/index.mjs +9 -0
  183. package/dist/esm/uikit/AvatarGroup/index.mjs +11 -0
  184. package/dist/esm/uikit/Badge/index.mjs +9 -0
  185. package/dist/esm/uikit/Button/index.mjs +39 -0
  186. package/dist/esm/uikit/ButtonBar/index.mjs +39 -0
  187. package/dist/esm/uikit/Card/index.mjs +29 -0
  188. package/dist/esm/uikit/CheckBox/index.mjs +31 -0
  189. package/dist/esm/uikit/Chip/index.mjs +31 -0
  190. package/dist/esm/uikit/DivInput/index.mjs +13 -0
  191. package/dist/esm/uikit/DocIcon/index.mjs +23 -0
  192. package/dist/esm/uikit/Dot/index.mjs +11 -0
  193. package/dist/esm/uikit/DraggablePanel/index.mjs +29 -0
  194. package/dist/esm/uikit/DropDown/index.mjs +29 -0
  195. package/dist/esm/uikit/ErrorSummary/index.mjs +11 -0
  196. package/dist/esm/uikit/FileIcon/index.mjs +25 -0
  197. package/dist/esm/uikit/FileList/index.mjs +35 -0
  198. package/dist/esm/uikit/FlexDiv/index.mjs +11 -0
  199. package/dist/esm/uikit/Grouper/index.mjs +33 -0
  200. package/dist/esm/uikit/Icon/index.mjs +25 -0
  201. package/dist/esm/uikit/IconButton/index.mjs +37 -0
  202. package/dist/esm/uikit/Label/index.mjs +27 -0
  203. package/dist/esm/uikit/Logos/index.mjs +23 -0
  204. package/dist/esm/uikit/Overlay/index.mjs +11 -0
  205. package/dist/esm/uikit/Pager/index.mjs +11 -0
  206. package/dist/esm/uikit/Progress/index.mjs +27 -0
  207. package/dist/esm/uikit/PromptInput/index.mjs +45 -0
  208. package/dist/esm/uikit/RadioButton/index.mjs +39 -0
  209. package/dist/esm/uikit/RadioButtonList/index.mjs +41 -0
  210. package/dist/esm/uikit/Slider/index.mjs +13 -0
  211. package/dist/esm/uikit/Spacer/index.mjs +7 -0
  212. package/dist/esm/uikit/Switch/index.mjs +11 -0
  213. package/dist/esm/uikit/TabBar/index.mjs +39 -0
  214. package/dist/esm/uikit/TextArea/index.mjs +41 -0
  215. package/dist/esm/uikit/Textfield/index.mjs +43 -0
  216. package/dist/esm/uikit/Tip/index.mjs +13 -0
  217. package/dist/esm/uikit/Toast/index.mjs +31 -0
  218. package/dist/esm/uikit/UploadArea/index.mjs +37 -0
  219. package/dist/esm/workers/uploads/uploads.mjs +5 -0
  220. package/dist/types/stores/index.d.ts +1 -0
  221. package/dist/types/stores/uploads/_types.d.ts +16 -0
  222. package/dist/types/stores/uploads/index.d.ts +2 -0
  223. package/dist/types/stores/uploads/uploadsStore.d.ts +22 -0
  224. package/dist/types/workers/uploads/uploads-worker.d.ts +129 -0
  225. package/dist/types/workers/uploads/uploads.d.ts +1 -0
  226. package/dist/types/workers/uploads/uploads.runtime.d.ts +1 -0
  227. package/package.json +23 -17
  228. package/dist/cjs/chunks/Avatar-z2YcOAoP.js +0 -68
  229. package/dist/cjs/chunks/AvatarGroup-Cz8369zI.js +0 -39
  230. package/dist/cjs/chunks/Badge-COSg__VJ.js +0 -41
  231. package/dist/cjs/chunks/Button-BNXqiA13.js +0 -312
  232. package/dist/cjs/chunks/ButtonBar-CeDdAOlH.js +0 -58
  233. package/dist/cjs/chunks/Card-Cc_c-S7i.js +0 -36
  234. package/dist/cjs/chunks/CheckBox-hTWIPqV_.js +0 -76
  235. package/dist/cjs/chunks/Chip-CLKVldi4.js +0 -93
  236. package/dist/cjs/chunks/DivInput-DnY2emt-.js +0 -204
  237. package/dist/cjs/chunks/DocIcons-BRWOzK96.js +0 -41
  238. package/dist/cjs/chunks/Dot-B5dO8kSS.js +0 -80
  239. package/dist/cjs/chunks/DrggablePanel-BtsURL9o.js +0 -302
  240. package/dist/cjs/chunks/DropDown-COr9u96t.js +0 -154
  241. package/dist/cjs/chunks/ErrorSummary-BrSHbGpk.js +0 -42
  242. package/dist/cjs/chunks/FileIcon-CEMQK_Je.js +0 -132
  243. package/dist/cjs/chunks/FileList-BHMne9Mr.js +0 -163
  244. package/dist/cjs/chunks/FlexDiv-BHl29ywz.js +0 -103
  245. package/dist/cjs/chunks/Grouper-EyHoeA8w.js +0 -50
  246. package/dist/cjs/chunks/IconButton-9QZ4eKBZ.js +0 -84
  247. package/dist/cjs/chunks/Label-s1aCv2Y1.js +0 -134
  248. package/dist/cjs/chunks/Logos-DSlAUz8l.js +0 -119
  249. package/dist/cjs/chunks/Overlay-DV3C5NDO.js +0 -45
  250. package/dist/cjs/chunks/Pager-CRjpl1FZ.js +0 -42
  251. package/dist/cjs/chunks/ProgressIndicator-BAwAaw58.js +0 -121
  252. package/dist/cjs/chunks/PromptInput-CfzofBTJ.js +0 -212
  253. package/dist/cjs/chunks/RadioButton-DA9YUGEF.js +0 -65
  254. package/dist/cjs/chunks/RadioButtonList-BtsT7GJc.js +0 -116
  255. package/dist/cjs/chunks/Slider-CqrIwn-L.js +0 -285
  256. package/dist/cjs/chunks/Spacer-BEY2-_PB.js +0 -16
  257. package/dist/cjs/chunks/Switch-CtkFtogd.js +0 -43
  258. package/dist/cjs/chunks/TabBar-WsNlr-aZ.js +0 -176
  259. package/dist/cjs/chunks/TextArea-BMJWUH2H.js +0 -153
  260. package/dist/cjs/chunks/TextField-mfwz79cD.js +0 -248
  261. package/dist/cjs/chunks/Tip-Af6FMEDi.js +0 -91
  262. package/dist/cjs/chunks/Toast-CxAEOW4z.js +0 -158
  263. package/dist/cjs/chunks/UploadArea-DunGYE1_.js +0 -155
  264. package/dist/cjs/chunks/_types-BNlHsGMQ.js +0 -714
  265. package/dist/cjs/chunks/sharedTypes-BvTjh6M5.js +0 -9
  266. package/dist/cjs/chunks/style-inject.es-XZHJH68X.js +0 -30
  267. package/dist/cjs/chunks/tipStore-C9oV9SIh.js +0 -23
  268. package/dist/cjs/chunks/toastStore-C-ETP9H6.js +0 -23
  269. package/dist/cjs/chunks/tslib.es6-4H29ixHs.js +0 -48
  270. package/dist/cjs/chunks/utils-BwNacfBU.js +0 -128
  271. package/dist/cjs/chunks/windowStore-CPcVHJq6.js +0 -93
  272. package/dist/cjs/uikit/Avatar.js +0 -11
  273. package/dist/cjs/uikit/AvatarGroup.js +0 -12
  274. package/dist/cjs/uikit/Badge.js +0 -11
  275. package/dist/cjs/uikit/Button.js +0 -26
  276. package/dist/cjs/uikit/ButtonBar.js +0 -26
  277. package/dist/cjs/uikit/Card.js +0 -21
  278. package/dist/cjs/uikit/CheckBox.js +0 -22
  279. package/dist/cjs/uikit/Chip.js +0 -22
  280. package/dist/cjs/uikit/DivInput.js +0 -13
  281. package/dist/cjs/uikit/DocIcon.js +0 -18
  282. package/dist/cjs/uikit/Dot.js +0 -12
  283. package/dist/cjs/uikit/DraggablePanel.js +0 -21
  284. package/dist/cjs/uikit/DropDown.js +0 -21
  285. package/dist/cjs/uikit/ErrorSummary.js +0 -12
  286. package/dist/cjs/uikit/FileIcon.js +0 -23
  287. package/dist/cjs/uikit/FileList.js +0 -24
  288. package/dist/cjs/uikit/FlexDiv.js +0 -12
  289. package/dist/cjs/uikit/Grouper.js +0 -23
  290. package/dist/cjs/uikit/Icon.js +0 -23
  291. package/dist/cjs/uikit/IconButton.js +0 -25
  292. package/dist/cjs/uikit/Label.js +0 -20
  293. package/dist/cjs/uikit/Logos.js +0 -18
  294. package/dist/cjs/uikit/Overlay.js +0 -12
  295. package/dist/cjs/uikit/Pager.js +0 -12
  296. package/dist/cjs/uikit/Progress.js +0 -21
  297. package/dist/cjs/uikit/PromptInput.js +0 -29
  298. package/dist/cjs/uikit/RadioButton.js +0 -26
  299. package/dist/cjs/uikit/RadioButtonList.js +0 -27
  300. package/dist/cjs/uikit/Slider.js +0 -13
  301. package/dist/cjs/uikit/Spacer.js +0 -10
  302. package/dist/cjs/uikit/Switch.js +0 -12
  303. package/dist/cjs/uikit/TabBar.js +0 -26
  304. package/dist/cjs/uikit/TextArea.js +0 -27
  305. package/dist/cjs/uikit/Textfield.js +0 -28
  306. package/dist/cjs/uikit/Tip.js +0 -13
  307. package/dist/cjs/uikit/Toast.js +0 -26
  308. package/dist/cjs/uikit/UploadArea.js +0 -31
  309. package/dist/esm/chunks/Avatar-BtkvMV1v.js +0 -66
  310. package/dist/esm/chunks/AvatarGroup-pbqdS56o.js +0 -37
  311. package/dist/esm/chunks/Badge-DtxDLSO0.js +0 -39
  312. package/dist/esm/chunks/Button-BUJkJqdO.js +0 -310
  313. package/dist/esm/chunks/ButtonBar-Bl0oCxd8.js +0 -56
  314. package/dist/esm/chunks/Card-Bjk0kgQh.js +0 -34
  315. package/dist/esm/chunks/CheckBox-CvkZuSeB.js +0 -74
  316. package/dist/esm/chunks/Chip-o-YG_HAf.js +0 -91
  317. package/dist/esm/chunks/DivInput-D6ORPrkT.js +0 -202
  318. package/dist/esm/chunks/DocIcons-CbOX4n8Y.js +0 -39
  319. package/dist/esm/chunks/Dot-BZcEZbnm.js +0 -78
  320. package/dist/esm/chunks/DrggablePanel-DWrTjXvf.js +0 -300
  321. package/dist/esm/chunks/DropDown-BDIvYWI-.js +0 -152
  322. package/dist/esm/chunks/ErrorSummary-DzDnacH0.js +0 -40
  323. package/dist/esm/chunks/FileIcon-Cxh-QsYb.js +0 -130
  324. package/dist/esm/chunks/FileList-CdUgbpYF.js +0 -161
  325. package/dist/esm/chunks/FlexDiv-CFyndG99.js +0 -101
  326. package/dist/esm/chunks/Grouper-NJbpaaQG.js +0 -48
  327. package/dist/esm/chunks/IconButton-3m9ugITV.js +0 -82
  328. package/dist/esm/chunks/Label-BRon-ejm.js +0 -132
  329. package/dist/esm/chunks/Logos-DwZP-TR2.js +0 -117
  330. package/dist/esm/chunks/Overlay-BolsHW9S.js +0 -43
  331. package/dist/esm/chunks/Pager-BHLyXq9p.js +0 -40
  332. package/dist/esm/chunks/ProgressIndicator-uI9BZwBB.js +0 -118
  333. package/dist/esm/chunks/PromptInput-DodTBG82.js +0 -210
  334. package/dist/esm/chunks/RadioButton-D8otD_Jj.js +0 -63
  335. package/dist/esm/chunks/RadioButtonList-CtX1j7rO.js +0 -114
  336. package/dist/esm/chunks/Slider-O6UelMjh.js +0 -283
  337. package/dist/esm/chunks/Spacer-DbZSG5x3.js +0 -14
  338. package/dist/esm/chunks/Switch-DjfrSiQz.js +0 -41
  339. package/dist/esm/chunks/TabBar-C0NgwRa2.js +0 -174
  340. package/dist/esm/chunks/TextArea-DK0giDGR.js +0 -151
  341. package/dist/esm/chunks/TextField-CQ4XYYNm.js +0 -246
  342. package/dist/esm/chunks/Tip-iFECDhwN.js +0 -89
  343. package/dist/esm/chunks/Toast-ZxMZtbd0.js +0 -156
  344. package/dist/esm/chunks/UploadArea-C0YHy4Z9.js +0 -147
  345. package/dist/esm/chunks/_types-RJ7q8S0B.js +0 -712
  346. package/dist/esm/chunks/sharedTypes-BfZzG1KX.js +0 -9
  347. package/dist/esm/chunks/style-inject.es-tgCJW-Cu.js +0 -28
  348. package/dist/esm/chunks/tipStore-nBYJ6tmE.js +0 -17
  349. package/dist/esm/chunks/toastStore-r3pvNa28.js +0 -17
  350. package/dist/esm/chunks/tslib.es6-0pkUdtrF.js +0 -45
  351. package/dist/esm/chunks/utils-CZ1LWeN6.js +0 -121
  352. package/dist/esm/chunks/windowStore-Cu4W4zJM.js +0 -91
  353. package/dist/esm/hooks/useDoubleClick.js +0 -24
  354. package/dist/esm/hooks/useKeyboardShortcuts.js +0 -42
  355. package/dist/esm/hooks/useLastUpdated.js +0 -51
  356. package/dist/esm/hooks/useLocalStore.js +0 -50
  357. package/dist/esm/hooks/useObserveResize.js +0 -54
  358. package/dist/esm/hooks/useObserveTheme.js +0 -41
  359. package/dist/esm/hooks/useTheme.js +0 -84
  360. package/dist/esm/hooks/useToolTip.js +0 -34
  361. package/dist/esm/hooks/useTrackRenders.js +0 -37
  362. package/dist/esm/hooks/useWindow.js +0 -84
  363. package/dist/esm/hooks.js +0 -15
  364. package/dist/esm/index.js +0 -59
  365. package/dist/esm/providers/ThemeProvider.js +0 -56
  366. package/dist/esm/providers.js +0 -8
  367. package/dist/esm/stores/tip.js +0 -2
  368. package/dist/esm/stores/toast.js +0 -2
  369. package/dist/esm/stores/window.js +0 -2
  370. package/dist/esm/stores.js +0 -4
  371. package/dist/esm/theme/colors.js +0 -377
  372. package/dist/esm/theme/corners.js +0 -12
  373. package/dist/esm/theme/elevations.js +0 -15
  374. package/dist/esm/theme/themes.js +0 -23
  375. package/dist/esm/theme/type.js +0 -393
  376. package/dist/esm/theme.js +0 -5
  377. package/dist/esm/uikit/Avatar.js +0 -5
  378. package/dist/esm/uikit/AvatarGroup.js +0 -6
  379. package/dist/esm/uikit/Badge.js +0 -5
  380. package/dist/esm/uikit/Button.js +0 -20
  381. package/dist/esm/uikit/ButtonBar.js +0 -20
  382. package/dist/esm/uikit/Card.js +0 -15
  383. package/dist/esm/uikit/CheckBox.js +0 -16
  384. package/dist/esm/uikit/Chip.js +0 -16
  385. package/dist/esm/uikit/DivInput.js +0 -7
  386. package/dist/esm/uikit/DocIcon.js +0 -12
  387. package/dist/esm/uikit/Dot.js +0 -6
  388. package/dist/esm/uikit/DraggablePanel.js +0 -15
  389. package/dist/esm/uikit/DropDown.js +0 -15
  390. package/dist/esm/uikit/ErrorSummary.js +0 -6
  391. package/dist/esm/uikit/FileIcon.js +0 -13
  392. package/dist/esm/uikit/FileList.js +0 -18
  393. package/dist/esm/uikit/FlexDiv.js +0 -6
  394. package/dist/esm/uikit/Grouper.js +0 -17
  395. package/dist/esm/uikit/Icon.js +0 -13
  396. package/dist/esm/uikit/IconButton.js +0 -19
  397. package/dist/esm/uikit/Label.js +0 -14
  398. package/dist/esm/uikit/Logos.js +0 -12
  399. package/dist/esm/uikit/Overlay.js +0 -6
  400. package/dist/esm/uikit/Pager.js +0 -6
  401. package/dist/esm/uikit/Progress.js +0 -14
  402. package/dist/esm/uikit/PromptInput.js +0 -23
  403. package/dist/esm/uikit/RadioButton.js +0 -20
  404. package/dist/esm/uikit/RadioButtonList.js +0 -21
  405. package/dist/esm/uikit/Slider.js +0 -7
  406. package/dist/esm/uikit/Spacer.js +0 -4
  407. package/dist/esm/uikit/Switch.js +0 -6
  408. package/dist/esm/uikit/TabBar.js +0 -20
  409. package/dist/esm/uikit/TextArea.js +0 -21
  410. package/dist/esm/uikit/Textfield.js +0 -22
  411. package/dist/esm/uikit/Tip.js +0 -7
  412. package/dist/esm/uikit/Toast.js +0 -16
  413. package/dist/esm/uikit/UploadArea.js +0 -19
@@ -1,9 +0,0 @@
1
- var ToolTipType;
2
- (function (ToolTipType) {
3
- ToolTipType["menu"] = "menu";
4
- ToolTipType["button"] = "button";
5
- ToolTipType["general"] = "general";
6
- ToolTipType["other"] = "other";
7
- })(ToolTipType || (ToolTipType = {}));
8
-
9
- export { ToolTipType as T };
@@ -1,28 +0,0 @@
1
- function styleInject(css, ref) {
2
- if ( ref === void 0 ) ref = {};
3
- var insertAt = ref.insertAt;
4
-
5
- if (!css || typeof document === 'undefined') { return; }
6
-
7
- var head = document.head || document.getElementsByTagName('head')[0];
8
- var style = document.createElement('style');
9
- style.type = 'text/css';
10
-
11
- if (insertAt === 'top') {
12
- if (head.firstChild) {
13
- head.insertBefore(style, head.firstChild);
14
- } else {
15
- head.appendChild(style);
16
- }
17
- } else {
18
- head.appendChild(style);
19
- }
20
-
21
- if (style.styleSheet) {
22
- style.styleSheet.cssText = css;
23
- } else {
24
- style.appendChild(document.createTextNode(css));
25
- }
26
- }
27
-
28
- export { styleInject as s };
@@ -1,17 +0,0 @@
1
- import { create } from 'zustand';
2
-
3
- const useTipStore = create((set) => ({
4
- tip: null,
5
- actions: {
6
- push: (tip) => set({ tip }),
7
- clear: () => set({ tip: null }),
8
- },
9
- }));
10
- // atomic hook exports for use in React components
11
- const useTip = () => useTipStore((state) => state.tip);
12
- const useTipActions = () => useTipStore((state) => state.actions);
13
- // non-reactive imperative exports for use outside the React context
14
- const tipActions = useTipStore.getState().actions;
15
- const getTip = () => useTipStore.getState().tip;
16
-
17
- export { useTipActions as a, useTipStore as b, getTip as g, tipActions as t, useTip as u };
@@ -1,17 +0,0 @@
1
- import { create } from 'zustand';
2
-
3
- const useToastStore = create((set) => ({
4
- toast: null,
5
- actions: {
6
- push: (toast) => set({ toast }),
7
- clear: () => set({ toast: null }),
8
- },
9
- }));
10
- // atomic hook exports for use in React components
11
- const useToast = () => useToastStore((state) => state.toast);
12
- const useToastActions = () => useToastStore((state) => state.actions);
13
- // non-reactive imperative exports for use outside the React context
14
- const toastActions = useToastStore.getState().actions;
15
- const getToast = () => useToastStore.getState().toast;
16
-
17
- export { useToastActions as a, useToastStore as b, getToast as g, toastActions as t, useToast as u };
@@ -1,45 +0,0 @@
1
- /******************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
16
-
17
-
18
- function __rest(s, e) {
19
- var t = {};
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
21
- t[p] = s[p];
22
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
23
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
24
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25
- t[p[i]] = s[p[i]];
26
- }
27
- return t;
28
- }
29
-
30
- function __awaiter(thisArg, _arguments, P, generator) {
31
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
32
- return new (P || (P = Promise))(function (resolve, reject) {
33
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
34
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
35
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
- step((generator = generator.apply(thisArg, _arguments || [])).next());
37
- });
38
- }
39
-
40
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
41
- var e = new Error(message);
42
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
43
- };
44
-
45
- export { __rest as _, __awaiter as a };
@@ -1,121 +0,0 @@
1
- import './tslib.es6-0pkUdtrF.js';
2
-
3
- /**
4
- * Clean up string with html
5
- */
6
- function cleanString(input, removeInvisible = true, removeHtml = true) {
7
- let clean = input;
8
- const scriptsRegEx = /\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
9
- clean = clean.replaceAll(scriptsRegEx, '');
10
- if (removeInvisible) {
11
- const invisibleRegEx = /[\r\n\t]/gi;
12
- clean = clean.replaceAll(invisibleRegEx, '');
13
- }
14
- if (removeHtml) {
15
- const htmlRegEx = /<\/?[a-z][^>]*>/gi;
16
- clean = clean.replaceAll(htmlRegEx, '');
17
- }
18
- return clean;
19
- }
20
- /**
21
- * Debug component rendering
22
- * Code removed when built / deployed
23
- */
24
- function debug(previous, updated, name = 'component') {
25
- if (process.env.NODE_ENV === 'test')
26
- return; // exit if running tests
27
- const props = previous.current.props;
28
- const mount = previous.current.mount;
29
- const unmount = previous.current.unmount;
30
- if (mount) {
31
- console.log({
32
- component: name,
33
- '(re)render': true,
34
- event: 'Component Mount',
35
- });
36
- }
37
- else if (unmount) {
38
- console.log({
39
- component: name,
40
- '(re)render': false,
41
- event: 'Component Unmount',
42
- });
43
- }
44
- else {
45
- const reasons = createPropChangeArray(props, updated);
46
- console.log({
47
- component: name,
48
- '(re)render': true,
49
- event: 'Props Change',
50
- props: reasons,
51
- });
52
- }
53
- return { props: updated, mount: false, unmount: false };
54
- }
55
- function createPropChangeArray(props, updated) {
56
- const reasons = [];
57
- for (const key of Object.keys(updated)) {
58
- if (updated[key] !== props[key]) {
59
- try {
60
- const propName = `${key}:`;
61
- const prev = JSON.stringify(props[key]);
62
- const next = JSON.stringify(updated[key]);
63
- const valueChanged = `${prev} > ${next}`;
64
- reasons.push(`${propName} ${valueChanged}`);
65
- }
66
- catch (error) {
67
- let message = 'Unknown error';
68
- if (error instanceof Error)
69
- message = error.message;
70
- if (typeof error === 'string')
71
- message = error;
72
- reasons.push(`${key} ${message}`);
73
- }
74
- }
75
- }
76
- return reasons;
77
- }
78
- /**
79
- * Utility to accessibility - mimics click event with designated keys event
80
- */
81
- function accessibleKeyDown(e, clickFunction, keys) {
82
- const activateWith = ['Enter', ' '];
83
- const match = activateWith.includes(e.key);
84
- if (match) {
85
- e.preventDefault();
86
- clickFunction();
87
- }
88
- }
89
- /**
90
- * Get the pointer position from a DOM touch or mouse event
91
- */
92
- function pointerPosition(e) {
93
- if (e.type.startsWith('touch')) {
94
- const touchEvent = e;
95
- return touchEvent.touches[0].clientX;
96
- }
97
- const mouseEvent = e;
98
- return mouseEvent.clientX;
99
- }
100
- /**
101
- * Filter and trim class name array
102
- */
103
- function filterClasses(classNames) {
104
- return classNames
105
- .filter((item) => item !== '')
106
- .join(' ')
107
- .trim();
108
- }
109
- /**
110
- * Takes a style string or number and returns a valid CSS style string
111
- */
112
- function setStyle(value, defaultVal = undefined) {
113
- const useValue = value !== null && value !== void 0 ? value : defaultVal;
114
- if (!useValue)
115
- return 'unset';
116
- if (typeof useValue === 'string')
117
- return useValue;
118
- return `${useValue}px`;
119
- }
120
-
121
- export { accessibleKeyDown as a, cleanString as c, debug as d, filterClasses as f, pointerPosition as p, setStyle as s };
@@ -1,91 +0,0 @@
1
- import { create } from 'zustand';
2
-
3
- /**
4
- * Form factor names
5
- */
6
- var FormFactor;
7
- (function (FormFactor) {
8
- FormFactor["Mobile"] = "mobile";
9
- FormFactor["Tablet"] = "tablet";
10
- FormFactor["Desktop"] = "desktop";
11
- FormFactor["DesktopL"] = "desktopL";
12
- FormFactor["DesktopXL"] = "desktopXL";
13
- })(FormFactor || (FormFactor = {}));
14
- /**
15
- * Use bootstrap breakpoints
16
- */
17
- const bootstrapBreakPoints = {
18
- [FormFactor.Mobile]: 576,
19
- [FormFactor.Tablet]: 768,
20
- [FormFactor.Desktop]: 992,
21
- [FormFactor.DesktopL]: 1200,
22
- [FormFactor.DesktopXL]: 1400,
23
- };
24
-
25
- // pre-ordered break points from larget to smallest
26
- const orderedBps = Object.entries(bootstrapBreakPoints).sort((a, b) => -b[1] - a[1]);
27
- // get form factor from break point and current viewport width
28
- const getFormFactor = (width) => {
29
- if (!width || width <= 0)
30
- return FormFactor.Mobile;
31
- for (const [formFactor, breakpoint] of orderedBps) {
32
- if (width >= breakpoint)
33
- return formFactor;
34
- }
35
- return FormFactor.Mobile;
36
- };
37
- const initialSize = processWindowSize();
38
- const useWindowStore = create((set, get) => {
39
- var _a;
40
- return ({
41
- formFactor: initialSize.formFactor,
42
- viewportWidth: initialSize.viewportWidth,
43
- viewportHeight: initialSize.viewportHeight,
44
- height: initialSize.height,
45
- isElectron: checkElectron(),
46
- isAppleDevice: navigator.platform.startsWith('Mac') || navigator.platform === 'iPhone',
47
- isTouchDevice: 'ontouchstart' in globalThis || navigator.maxTouchPoints > 0,
48
- dpr: (_a = Math.min(Math.ceil(window.devicePixelRatio), 3)) !== null && _a !== void 0 ? _a : 1,
49
- actions: {
50
- initialize: () => {
51
- var _a;
52
- const win = (_a = globalThis.top) !== null && _a !== void 0 ? _a : globalThis;
53
- win === null || win === void 0 ? void 0 : win.addEventListener('resize', handleResize);
54
- return () => win === null || win === void 0 ? void 0 : win.removeEventListener('resize', handleResize);
55
- },
56
- },
57
- });
58
- });
59
- //check electron
60
- function checkElectron() {
61
- const userAgent = navigator.userAgent.toLowerCase();
62
- return userAgent.includes('electron/');
63
- }
64
- // resize handler
65
- function handleResize() {
66
- // process size
67
- const { formFactor, viewportWidth, viewportHeight, height } = processWindowSize();
68
- // update store directly
69
- useWindowStore.setState({
70
- formFactor,
71
- viewportWidth,
72
- viewportHeight,
73
- height,
74
- });
75
- }
76
- // return size related store values
77
- function processWindowSize(top = true) {
78
- var _a, _b, _c;
79
- const viewport = (_a = globalThis.top) !== null && _a !== void 0 ? _a : globalThis;
80
- const touch = 'ontouchstart' in globalThis || navigator.maxTouchPoints > 0;
81
- const windowWidth = (_b = viewport === null || viewport === void 0 ? void 0 : viewport.innerWidth) !== null && _b !== void 0 ? _b : -1;
82
- const windowHeight = (_c = viewport === null || viewport === void 0 ? void 0 : viewport.innerHeight) !== null && _c !== void 0 ? _c : -1;
83
- return {
84
- formFactor: getFormFactor(windowWidth),
85
- viewportWidth: windowWidth,
86
- viewportHeight: windowHeight,
87
- height: viewport && touch ? `${windowHeight}px` : '100vh',
88
- };
89
- }
90
-
91
- export { FormFactor as F, useWindowStore as u };
@@ -1,24 +0,0 @@
1
- import { useRef } from 'react';
2
-
3
- function useDoubleClick(onClick, onDblClick, delay = 200) {
4
- const timer = useRef(null);
5
- const didClick = (payload) => {
6
- if (timer.current)
7
- clearTimeout(timer.current);
8
- timer.current = setTimeout(() => {
9
- onClick(payload);
10
- }, delay);
11
- return () => {
12
- if (timer.current)
13
- clearTimeout(timer.current);
14
- };
15
- };
16
- const didDblClick = (payload) => {
17
- if (timer.current)
18
- clearTimeout(timer.current);
19
- onDblClick(payload);
20
- };
21
- return [didClick, didDblClick];
22
- }
23
-
24
- export { useDoubleClick };
@@ -1,42 +0,0 @@
1
- import { useCallback, useEffect } from 'react';
2
-
3
- function useKeyboardShortcuts(shortcuts, shortCutHandler, isAppleDevice) {
4
- // don't process shortcuts on editable elements, like inputs, editable divs, etc.
5
- const isEditable = useCallback((e) => {
6
- const target = e.target;
7
- if (target) {
8
- const tag = target.tagName;
9
- return (target.isContentEditable ||
10
- tag === 'INPUT' ||
11
- tag === 'TEXTAREA' ||
12
- tag === 'SELECT');
13
- }
14
- return false;
15
- }, []);
16
- // get keyboard event check if it's a shortcut
17
- const handleKeyPress = useCallback((e) => {
18
- if (isEditable(e))
19
- return;
20
- const isMeta = (isAppleDevice && e.metaKey) || (!isAppleDevice && e.ctrlKey);
21
- for (const s of shortcuts) {
22
- if (s.metaPressed && !isMeta)
23
- continue;
24
- if (s.key.toLowerCase() === e.key.toLowerCase()) {
25
- e.preventDefault();
26
- shortCutHandler(s);
27
- break;
28
- }
29
- }
30
- }, [isAppleDevice, shortcuts, shortCutHandler, isEditable]);
31
- // set keyboard listener
32
- useEffect(() => {
33
- if (shortcuts.length === 0)
34
- return;
35
- globalThis.addEventListener('keydown', handleKeyPress, false);
36
- return () => {
37
- globalThis.removeEventListener('keydown', handleKeyPress, false);
38
- };
39
- }, [shortcuts, handleKeyPress]);
40
- }
41
-
42
- export { useKeyboardShortcuts };
@@ -1,51 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
-
3
- function getTimeDifference(date, labelPrefix) {
4
- const compareDate = date instanceof Date ? date : new Date(date);
5
- if (Number.isNaN(compareDate.getTime()))
6
- return `${labelPrefix}Invalid date`;
7
- // getTime = milliseconds since Jan 1 1970 UTC
8
- const secondsDiff = Math.max(0, Math.floor((Date.now() - compareDate.getTime()) / 1000));
9
- const minutes = Math.floor(secondsDiff / 60);
10
- const hours = Math.floor(minutes / 60);
11
- const days = Math.floor(hours / 24);
12
- if (minutes < 1)
13
- return `${labelPrefix}Just now`;
14
- if (minutes === 1)
15
- return `${labelPrefix}1 min. ago`;
16
- if (minutes < 60)
17
- return `${labelPrefix}${minutes} mins. ago`;
18
- if (hours === 1)
19
- return `${labelPrefix}1 hour ago`;
20
- if (hours < 24)
21
- return `${labelPrefix}${hours} hours ago`;
22
- if (days === 1)
23
- return `${labelPrefix}1 day ago`;
24
- if (days < 15)
25
- return `${labelPrefix}${days} days ago`;
26
- return compareDate.toLocaleDateString('en-US', {
27
- day: '2-digit',
28
- month: 'short',
29
- year: 'numeric',
30
- });
31
- }
32
- function useLastUpdated(timestamp, prefix = '', interval = 1) {
33
- const [lastUpdated, setLastUpdated] = useState(timestamp ? getTimeDifference(timestamp, prefix) : '');
34
- useEffect(() => {
35
- if (!timestamp) {
36
- setLastUpdated('');
37
- return;
38
- }
39
- setLastUpdated(getTimeDifference(timestamp, prefix));
40
- const refreshMinutes = Math.max(interval, 1);
41
- const intervalTimer = setInterval(() => {
42
- setLastUpdated(getTimeDifference(timestamp, prefix));
43
- }, refreshMinutes * 60 * 1000);
44
- return () => {
45
- clearInterval(intervalTimer);
46
- };
47
- }, [interval, prefix, timestamp]);
48
- return { lastUpdated, timer: interval };
49
- }
50
-
51
- export { useLastUpdated };
@@ -1,50 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
-
3
- function canUseLocalStorage() {
4
- return (typeof globalThis !== 'undefined' &&
5
- 'localStorage' in globalThis &&
6
- globalThis.localStorage !== undefined &&
7
- globalThis.localStorage !== null);
8
- }
9
- function readLocalStorageValue(key, fallback) {
10
- if (!canUseLocalStorage())
11
- return fallback;
12
- try {
13
- const raw = globalThis.localStorage.getItem(key);
14
- if (raw === null) {
15
- // If not set, initialize with fallback.
16
- globalThis.localStorage.setItem(key, JSON.stringify(fallback));
17
- return fallback;
18
- }
19
- return JSON.parse(raw);
20
- }
21
- catch (error) {
22
- console.error(`Error parsing local storage item for key ${key}:`, {
23
- error,
24
- });
25
- return fallback;
26
- }
27
- }
28
- function useLocalStore(key, value) {
29
- const [item, setItem] = useState(() => readLocalStorageValue(key, value));
30
- // rehydrate on prop changes
31
- useEffect(() => {
32
- setItem(readLocalStorageValue(key, value));
33
- }, [key, value]);
34
- function updateItem(data) {
35
- if (canUseLocalStorage()) {
36
- try {
37
- globalThis.localStorage.setItem(key, JSON.stringify(data));
38
- }
39
- catch (error) {
40
- console.error(`Error setting local storage item for key ${key}:`, {
41
- error,
42
- });
43
- }
44
- }
45
- setItem(data);
46
- }
47
- return [item, updateItem];
48
- }
49
-
50
- export { useLocalStore };
@@ -1,54 +0,0 @@
1
- import { useState, useCallback, useEffect } from 'react';
2
-
3
- function useObserveResize(element, options) {
4
- const [size, setSize] = useState({ width: 0, height: 0 });
5
- const ignore = options === null || options === void 0 ? void 0 : options.ignore;
6
- const handleResize = useCallback((entries) => {
7
- var _a, _b;
8
- if (!entries[0])
9
- return;
10
- const width = ((_a = element === null || element === void 0 ? void 0 : element.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
11
- const height = ((_b = element === null || element === void 0 ? void 0 : element.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
12
- setSize((prev) => {
13
- const next = {
14
- width: ignore === 'width' ? prev.width : width,
15
- height: ignore === 'height' ? prev.height : height,
16
- };
17
- if (prev.width === next.width && prev.height === next.height) {
18
- return prev;
19
- }
20
- return next;
21
- });
22
- }, [element, ignore]);
23
- useEffect(() => {
24
- if (element === undefined)
25
- return;
26
- const el = element.current;
27
- if (!el)
28
- return;
29
- // Get initial size
30
- const newWidth = el.offsetWidth || 0;
31
- const newHeight = el.offsetHeight || 0;
32
- // set the new size of different to previous
33
- setSize((prev) => {
34
- const next = {
35
- width: ignore === 'width' ? prev.width : newWidth,
36
- height: ignore === 'height' ? prev.height : newHeight,
37
- };
38
- if (prev.width === next.width && prev.height === next.height) {
39
- return prev; // same so no need to trigger re-renders
40
- }
41
- return next;
42
- });
43
- // Observe size changes
44
- const resizeObserver = new ResizeObserver(handleResize);
45
- resizeObserver.observe(el);
46
- return () => {
47
- resizeObserver.unobserve(el);
48
- resizeObserver.disconnect();
49
- };
50
- }, [element, handleResize, ignore]);
51
- return size;
52
- }
53
-
54
- export { useObserveResize };
@@ -1,41 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import { lightTheme, darkTheme } from '../theme/themes.js';
3
- import '../theme/colors.js';
4
- import '../theme/corners.js';
5
- import '../theme/elevations.js';
6
- import '../theme/type.js';
7
-
8
- function resolveTheme(themeName) {
9
- if (!themeName || themeName === '' || themeName.includes(lightTheme.name)) {
10
- return lightTheme;
11
- }
12
- return darkTheme;
13
- }
14
- function useObserveTheme() {
15
- const [theme, setTheme] = useState(() => {
16
- if (typeof document === 'undefined')
17
- return lightTheme;
18
- return resolveTheme(document.documentElement.dataset.theme);
19
- });
20
- useEffect(() => {
21
- // Sync once on mount in case the theme was set before this hook subscribed.
22
- setTheme(resolveTheme(document.documentElement.dataset.theme));
23
- const observer = new MutationObserver((mutations) => {
24
- for (const mutation of mutations) {
25
- if (mutation.type === 'attributes' &&
26
- mutation.attributeName === 'data-theme') {
27
- const newTheme = document.documentElement.dataset.theme;
28
- setTheme(resolveTheme(newTheme));
29
- }
30
- }
31
- });
32
- observer.observe(document.documentElement, {
33
- attributes: true,
34
- attributeFilter: ['data-theme'],
35
- });
36
- return () => observer.disconnect();
37
- }, []);
38
- return theme;
39
- }
40
-
41
- export { useObserveTheme };
@@ -1,84 +0,0 @@
1
- import { useCallback, useMemo } from 'react';
2
- import { darkTheme, lightTheme } from '../theme/themes.js';
3
- import { colorClass, colorCssVars } from '../theme/colors.js';
4
- import { typeStyles, typeCssClasses } from '../theme/type.js';
5
- import { useObserveTheme } from './useObserveTheme.js';
6
- import '../theme/corners.js';
7
- import '../theme/elevations.js';
8
-
9
- /**
10
- * Hook to manage Slice theming
11
- */
12
- function useTheme() {
13
- const current = useObserveTheme();
14
- const set = useCallback((newTheme) => {
15
- console.log('set theme', newTheme);
16
- let theme;
17
- if (typeof newTheme === 'string') {
18
- if (newTheme === 'system') {
19
- const darkModeMediaQuery = globalThis.matchMedia('(prefers-color-scheme: dark)');
20
- const isDark = darkModeMediaQuery.matches;
21
- theme = isDark ? darkTheme : lightTheme;
22
- }
23
- else {
24
- theme = newTheme === darkTheme.name ? darkTheme : lightTheme;
25
- }
26
- }
27
- else
28
- theme = newTheme;
29
- document.documentElement.dataset.theme = theme.name;
30
- }, []);
31
- const toggle = () => {
32
- const lightMode = current.name === lightTheme.name;
33
- const newTheme = lightMode ? darkTheme : lightTheme;
34
- document.documentElement.dataset.theme = newTheme.name;
35
- };
36
- const isDark = useMemo(() => {
37
- return current.name === darkTheme.name;
38
- }, [current]);
39
- return {
40
- /**
41
- * Slice's default dark theme
42
- */
43
- darkTheme,
44
- /**
45
- * Slice's default light theme
46
- */
47
- lightTheme,
48
- /**
49
- * The currently active SliceTheme
50
- */
51
- current,
52
- /**
53
- * CSS variables for theme colors
54
- */
55
- colors: colorCssVars,
56
- /**
57
- * CSS Class names for the theme colors
58
- */
59
- colorsClass: colorClass,
60
- /**
61
- * CSS class names for theme typefaces
62
- */
63
- typeClass: typeCssClasses,
64
- /**
65
- * CSS typeface styles as inline style properties
66
- */
67
- typeStyle: typeStyles,
68
- /**
69
- * Set a new theme by name or passing in a SliceTheme object
70
- * @param newTheme
71
- */
72
- set,
73
- /**
74
- * Toggle between light and dark themes
75
- */
76
- toggle,
77
- /**
78
- * If the currently active theme is the Slice's default dark theme'
79
- */
80
- isDark,
81
- };
82
- }
83
-
84
- export { useTheme };