sveltekit-ui 1.1.74 → 1.1.76

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 (619) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/LICENSE +21 -0
  3. package/README.md +45 -18
  4. package/dist/Components/Alert/index.svelte +8 -1
  5. package/dist/Components/Alert/index.svelte.d.ts +15 -0
  6. package/dist/Components/Alert/manager.svelte.d.ts +13 -0
  7. package/dist/Components/Alert/{index.svelte.js → manager.svelte.js} +30 -5
  8. package/dist/Components/ArrowToggle/index.svelte.d.ts +15 -0
  9. package/dist/Components/Attachment/index.svelte +18 -8
  10. package/dist/Components/Attachment/index.svelte.d.ts +11 -0
  11. package/dist/Components/Attachment/manager.svelte.d.ts +14 -0
  12. package/dist/Components/Attachment/manager.svelte.js +224 -0
  13. package/dist/Components/Audio/index.svelte +20 -16
  14. package/dist/Components/Audio/index.svelte.d.ts +11 -0
  15. package/dist/Components/Audio/manager.svelte.d.ts +55 -0
  16. package/dist/Components/Audio/{index.svelte.js → manager.svelte.js} +225 -66
  17. package/dist/Components/AudioEditor/index.svelte +6 -3
  18. package/dist/Components/AudioEditor/index.svelte.d.ts +13 -0
  19. package/dist/Components/AudioEditor/manager.svelte.d.ts +254 -0
  20. package/dist/Components/AudioEditor/{index.svelte.js → manager.svelte.js} +249 -157
  21. package/dist/Components/AuthCodeInput/index.svelte +2 -0
  22. package/dist/Components/AuthCodeInput/index.svelte.d.ts +11 -0
  23. package/dist/Components/AuthCodeInput/manager.svelte.d.ts +18 -0
  24. package/dist/Components/AuthCodeInput/{index.svelte.js → manager.svelte.js} +16 -6
  25. package/dist/Components/Breadcrumbs/index.svelte +2 -2
  26. package/dist/Components/Breadcrumbs/index.svelte.d.ts +11 -0
  27. package/dist/Components/Breadcrumbs/manager.svelte.d.ts +8 -0
  28. package/{src/lib/Components/Breadcrumbs/index.svelte.js → dist/Components/Breadcrumbs/manager.svelte.js} +12 -4
  29. package/dist/Components/Button/index.svelte +4 -2
  30. package/dist/Components/Button/index.svelte.d.ts +13 -0
  31. package/dist/Components/Button/manager.svelte.d.ts +79 -0
  32. package/dist/Components/Button/{index.svelte.js → manager.svelte.js} +46 -10
  33. package/dist/Components/Chart/Klines/index.svelte.d.ts +11 -0
  34. package/dist/Components/Chart/index.svelte.d.ts +11 -0
  35. package/dist/Components/Chart/manager.svelte.d.ts +46 -0
  36. package/{src/lib/Components/Chart/index.svelte.js → dist/Components/Chart/manager.svelte.js} +37 -46
  37. package/dist/Components/ChartInput/DisplayNav/Klines/index.svelte.d.ts +21 -0
  38. package/dist/Components/ChartInput/DisplayNav/Lines/index.svelte.d.ts +19 -0
  39. package/dist/Components/ChartInput/DisplayNav/index.svelte.d.ts +11 -0
  40. package/dist/Components/ChartInput/EditPanel/index.svelte.d.ts +11 -0
  41. package/dist/Components/ChartInput/index.svelte.d.ts +11 -0
  42. package/dist/Components/ChartInput/manager.svelte.d.ts +34 -0
  43. package/dist/Components/ChartInput/{index.svelte.js → manager.svelte.js} +12 -21
  44. package/dist/Components/Checkbox/index.svelte +7 -9
  45. package/dist/Components/Checkbox/index.svelte.d.ts +11 -0
  46. package/dist/Components/Checkbox/manager.svelte.d.ts +97 -0
  47. package/dist/Components/Checkbox/{index.svelte.js → manager.svelte.js} +11 -5
  48. package/dist/Components/Code/index.svelte +2 -1
  49. package/dist/Components/Code/index.svelte.d.ts +11 -0
  50. package/dist/Components/Code/manager.svelte.d.ts +7 -0
  51. package/dist/Components/Code/{index.svelte.js → manager.svelte.js} +6 -1
  52. package/dist/Components/Color/index.svelte +29 -24
  53. package/dist/Components/Color/index.svelte.d.ts +11 -0
  54. package/dist/Components/Color/manager.svelte.d.ts +9 -0
  55. package/{src/lib/Components/Color/index.svelte.js → dist/Components/Color/manager.svelte.js} +10 -2
  56. package/dist/Components/ColorInput/ChromaPicker/index.svelte +13 -8
  57. package/dist/Components/ColorInput/ChromaPicker/index.svelte.d.ts +11 -0
  58. package/dist/Components/ColorInput/ColorPalette/index.svelte +17 -10
  59. package/dist/Components/ColorInput/ColorPalette/index.svelte.d.ts +11 -0
  60. package/dist/Components/ColorInput/OpacityPicker/index.svelte +14 -9
  61. package/dist/Components/ColorInput/OpacityPicker/index.svelte.d.ts +11 -0
  62. package/dist/Components/ColorInput/ShowcasePicker/index.svelte +18 -10
  63. package/dist/Components/ColorInput/ShowcasePicker/index.svelte.d.ts +11 -0
  64. package/dist/Components/ColorInput/index.svelte.d.ts +11 -0
  65. package/dist/Components/ColorInput/manager.svelte.d.ts +41 -0
  66. package/dist/Components/ColorInput/{index.svelte.js → manager.svelte.js} +38 -16
  67. package/dist/Components/ConditionsInput/index.svelte.d.ts +11 -0
  68. package/dist/Components/ConditionsInput/manager.svelte.d.ts +16 -0
  69. package/dist/Components/ConditionsInput/{index.svelte.js → manager.svelte.js} +5 -8
  70. package/dist/Components/Confetti/index.svelte +15 -1
  71. package/dist/Components/Confetti/index.svelte.d.ts +11 -0
  72. package/dist/Components/Confetti/manager.svelte.d.ts +12 -0
  73. package/dist/Components/Confetti/{index.svelte.js → manager.svelte.js} +22 -5
  74. package/dist/Components/Content/index.svelte +92 -23
  75. package/dist/Components/Content/index.svelte.d.ts +11 -0
  76. package/dist/Components/Content/manager.svelte.d.ts +7 -0
  77. package/dist/Components/Content/{index.svelte.js → manager.svelte.js} +30 -34
  78. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte.d.ts +11 -0
  79. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/manager.svelte.d.ts +39 -0
  80. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Audio/{index.svelte.js → manager.svelte.js} +4 -5
  81. package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte.d.ts +11 -0
  82. package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/manager.svelte.d.ts +39 -0
  83. package/dist/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/{index.svelte.js → manager.svelte.js} +4 -5
  84. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.d.ts +11 -0
  85. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/manager.svelte.d.ts +19 -0
  86. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/{index.svelte.js → manager.svelte.js} +5 -5
  87. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte.d.ts +11 -0
  88. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/manager.svelte.d.ts +34 -0
  89. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Image/{index.svelte.js → manager.svelte.js} +4 -5
  90. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte +1 -5
  91. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.d.ts +11 -0
  92. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/manager.svelte.d.ts +23 -0
  93. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Number/{index.svelte.js → manager.svelte.js} +14 -7
  94. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.d.ts +11 -0
  95. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/manager.svelte.d.ts +19 -0
  96. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Qr/{index.svelte.js → manager.svelte.js} +6 -6
  97. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.d.ts +11 -0
  98. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/manager.svelte.d.ts +10 -0
  99. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Slider/{index.svelte.js → manager.svelte.js} +4 -4
  100. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.d.ts +11 -0
  101. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/manager.svelte.d.ts +44 -0
  102. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/{index.svelte.js → manager.svelte.js} +10 -12
  103. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte.d.ts +11 -0
  104. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/manager.svelte.d.ts +190 -0
  105. package/dist/Components/ContentInput/AttributesInput/CustomConfig/Tag/{index.svelte.js → manager.svelte.js} +7 -9
  106. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.d.ts +11 -0
  107. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/manager.svelte.d.ts +19 -0
  108. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TextInput/{index.svelte.js → manager.svelte.js} +5 -5
  109. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.d.ts +11 -0
  110. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/manager.svelte.d.ts +8 -0
  111. package/dist/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/{index.svelte.js → manager.svelte.js} +4 -4
  112. package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.d.ts +13 -0
  113. package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/manager.svelte.d.ts +11 -0
  114. package/dist/Components/ContentInput/AttributesInput/DefinedTypeInput/{index.svelte.js → manager.svelte.js} +3 -3
  115. package/dist/Components/ContentInput/AttributesInput/index.svelte +2 -0
  116. package/dist/Components/ContentInput/AttributesInput/index.svelte.d.ts +11 -0
  117. package/dist/Components/ContentInput/AttributesInput/manager.svelte.d.ts +13 -0
  118. package/dist/Components/ContentInput/AttributesInput/{index.svelte.js → manager.svelte.js} +28 -24
  119. package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte.d.ts +11 -0
  120. package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/manager.svelte.d.ts +9 -0
  121. package/dist/Components/ContentInput/ContentPanelBuilder/AddElement/{index.svelte.js → manager.svelte.js} +3 -3
  122. package/dist/Components/ContentInput/ContentPanelBuilder/ElementList/index.svelte +4 -6
  123. package/dist/Components/ContentInput/ContentPanelBuilder/ElementList/index.svelte.d.ts +13 -0
  124. package/dist/Components/ContentInput/ContentPanelBuilder/index.svelte +1 -1
  125. package/dist/Components/ContentInput/ContentPanelBuilder/index.svelte.d.ts +11 -0
  126. package/dist/Components/ContentInput/index.svelte +1 -1
  127. package/dist/Components/ContentInput/index.svelte.d.ts +13 -0
  128. package/dist/Components/ContentInput/manager.svelte.d.ts +59 -0
  129. package/dist/Components/ContentInput/{index.svelte.js → manager.svelte.js} +8 -8
  130. package/dist/Components/CronInput/index.svelte +2 -2
  131. package/dist/Components/CronInput/index.svelte.d.ts +11 -0
  132. package/dist/Components/CronInput/manager.svelte.d.ts +19 -0
  133. package/dist/Components/CronInput/{index.svelte.js → manager.svelte.js} +6 -4
  134. package/dist/Components/DataTypeInput/index.svelte +3 -3
  135. package/dist/Components/DataTypeInput/index.svelte.d.ts +11 -0
  136. package/dist/Components/DataTypeInput/manager.svelte.d.ts +36 -0
  137. package/dist/Components/DataTypeInput/{index.svelte.js → manager.svelte.js} +11 -12
  138. package/dist/Components/Dropdown/index.svelte.d.ts +11 -0
  139. package/dist/Components/Dropdown/manager.svelte.d.ts +51 -0
  140. package/dist/Components/Dropdown/{index.svelte.js → manager.svelte.js} +39 -19
  141. package/dist/Components/EmailAddress/index.svelte.d.ts +11 -0
  142. package/dist/Components/EmailAddress/manager.svelte.d.ts +164 -0
  143. package/dist/Components/EmailAddress/manager.svelte.js +52 -0
  144. package/dist/Components/ErrorX/index.svelte +2 -0
  145. package/dist/Components/ErrorX/index.svelte.d.ts +15 -0
  146. package/dist/Components/Eye/index.svelte.d.ts +19 -0
  147. package/dist/Components/FileInput/index.svelte +6 -3
  148. package/dist/Components/FileInput/index.svelte.d.ts +11 -0
  149. package/dist/Components/FileInput/manager.svelte.d.ts +31 -0
  150. package/dist/Components/FileInput/{index.svelte.js → manager.svelte.js} +22 -13
  151. package/dist/Components/Hamburger/index.svelte.d.ts +19 -0
  152. package/dist/Components/HorizScrollBox/index.svelte +72 -31
  153. package/dist/Components/HorizScrollBox/index.svelte.d.ts +13 -0
  154. package/dist/Components/Icon/index.svelte +2 -2
  155. package/dist/Components/Icon/index.svelte.d.ts +11 -0
  156. package/dist/Components/Icon/manager.svelte.d.ts +23 -0
  157. package/dist/Components/IconInput/index.svelte.d.ts +11 -0
  158. package/dist/Components/IconInput/manager.svelte.d.ts +17 -0
  159. package/dist/Components/IconInput/{index.svelte.js → manager.svelte.js} +5 -5
  160. package/dist/Components/Image/index.svelte.d.ts +11 -0
  161. package/dist/Components/Image/manager.svelte.d.ts +18 -0
  162. package/dist/Components/Image/{index.svelte.js → manager.svelte.js} +17 -5
  163. package/dist/Components/ImageEditor/Image/CropBox/index.svelte.d.ts +11 -0
  164. package/dist/Components/ImageEditor/Image/index.svelte +6 -1
  165. package/dist/Components/ImageEditor/Image/index.svelte.d.ts +11 -0
  166. package/dist/Components/ImageEditor/Panels/AI/index.svelte.d.ts +11 -0
  167. package/dist/Components/ImageEditor/Panels/Crop/index.svelte.d.ts +11 -0
  168. package/dist/Components/ImageEditor/Panels/File/QualityPicker/index.svelte.d.ts +11 -0
  169. package/dist/Components/ImageEditor/Panels/File/index.svelte.d.ts +11 -0
  170. package/dist/Components/ImageEditor/Panels/Filters/index.svelte.d.ts +11 -0
  171. package/dist/Components/ImageEditor/Panels/Resize/index.svelte.d.ts +11 -0
  172. package/dist/Components/ImageEditor/index.svelte.d.ts +11 -0
  173. package/dist/Components/ImageEditor/manager.svelte.d.ts +117 -0
  174. package/dist/Components/ImageEditor/{index.svelte.js → manager.svelte.js} +259 -132
  175. package/dist/Components/ImageSlider/index.svelte.d.ts +11 -0
  176. package/dist/Components/ImageSlider/manager.svelte.d.ts +91 -0
  177. package/dist/Components/ImageSlider/{index.svelte.js → manager.svelte.js} +3 -3
  178. package/dist/Components/InfoBox/index.svelte +9 -4
  179. package/dist/Components/InfoBox/index.svelte.d.ts +29 -0
  180. package/dist/Components/Json/Nested/index.svelte.d.ts +13 -0
  181. package/dist/Components/Json/index.svelte.d.ts +11 -0
  182. package/dist/Components/Json/manager.svelte.d.ts +21 -0
  183. package/dist/Components/Json/{index.svelte.js → manager.svelte.js} +19 -22
  184. package/dist/Components/LabeledItem/index.svelte.d.ts +41 -0
  185. package/dist/Components/Layout/NavBar/FullNav/index.svelte.d.ts +13 -0
  186. package/dist/Components/Layout/NavBar/NavGuts/index.svelte.d.ts +15 -0
  187. package/dist/Components/Layout/NavBar/index.svelte +2 -2
  188. package/dist/Components/Layout/NavBar/index.svelte.d.ts +19 -0
  189. package/dist/Components/Layout/index.svelte +13 -7
  190. package/dist/Components/Layout/index.svelte.d.ts +23 -0
  191. package/dist/Components/Layout/manager.svelte.d.ts +80 -0
  192. package/dist/Components/Layout/{index.svelte.js → manager.svelte.js} +10 -7
  193. package/dist/Components/Link/index.svelte +30 -20
  194. package/dist/Components/Link/index.svelte.d.ts +13 -0
  195. package/dist/Components/Link/manager.svelte.d.ts +18 -0
  196. package/dist/Components/Link/{index.svelte.js → manager.svelte.js} +22 -8
  197. package/dist/Components/LoadingSuccessDiv/index.svelte +3 -0
  198. package/dist/Components/LoadingSuccessDiv/index.svelte.d.ts +25 -0
  199. package/dist/Components/LoadingWheel/index.svelte +8 -2
  200. package/dist/Components/LoadingWheel/index.svelte.d.ts +19 -0
  201. package/dist/Components/Location/index.svelte +31 -6
  202. package/dist/Components/Location/index.svelte.d.ts +11 -0
  203. package/dist/Components/Location/manager.svelte.d.ts +17 -0
  204. package/dist/Components/Location/manager.svelte.js +303 -0
  205. package/dist/Components/LocationInput/index.svelte +23 -5
  206. package/dist/Components/LocationInput/index.svelte.d.ts +11 -0
  207. package/dist/Components/LocationInput/manager.svelte.d.ts +36 -0
  208. package/dist/Components/LocationInput/{index.svelte.js → manager.svelte.js} +59 -54
  209. package/dist/Components/Number/index.svelte.d.ts +11 -0
  210. package/dist/Components/Number/manager.svelte.d.ts +4 -0
  211. package/dist/Components/Number/manager.svelte.js +132 -0
  212. package/dist/Components/PhoneCountryCode/index.svelte +3 -1
  213. package/dist/Components/PhoneCountryCode/index.svelte.d.ts +11 -0
  214. package/dist/Components/PhoneCountryCode/manager.svelte.d.ts +5 -0
  215. package/{src/lib/Components/PhoneCountryCode/index.svelte.js → dist/Components/PhoneCountryCode/manager.svelte.js} +4 -3
  216. package/dist/Components/PhoneNumber/index.svelte.d.ts +11 -0
  217. package/dist/Components/PhoneNumber/manager.svelte.d.ts +84 -0
  218. package/dist/Components/PhoneNumber/manager.svelte.js +51 -0
  219. package/dist/Components/Popover/index.svelte +46 -6
  220. package/dist/Components/Popover/index.svelte.d.ts +19 -0
  221. package/dist/Components/Popover/manager.svelte.d.ts +115 -0
  222. package/dist/Components/Popover/{index.svelte.js → manager.svelte.js} +26 -13
  223. package/dist/Components/Qr/index.svelte +7 -4
  224. package/dist/Components/Qr/index.svelte.d.ts +11 -0
  225. package/dist/Components/Qr/manager.svelte.d.ts +34 -0
  226. package/{src/lib/Components/Qr/index.svelte.js → dist/Components/Qr/manager.svelte.js} +107 -54
  227. package/dist/Components/QrInput/index.svelte.d.ts +11 -0
  228. package/dist/Components/QrInput/manager.svelte.d.ts +37 -0
  229. package/dist/Components/QrInput/{index.svelte.js → manager.svelte.js} +12 -9
  230. package/dist/Components/Slider/index.svelte +16 -8
  231. package/dist/Components/Slider/index.svelte.d.ts +11 -0
  232. package/dist/Components/Slider/manager.svelte.d.ts +54 -0
  233. package/dist/Components/Slider/{index.svelte.js → manager.svelte.js} +34 -12
  234. package/dist/Components/Spacer/index.svelte.d.ts +25 -0
  235. package/dist/Components/StoragePicker/DisplayFile/index.svelte.d.ts +11 -0
  236. package/dist/Components/StoragePicker/index.svelte +6 -0
  237. package/dist/Components/StoragePicker/index.svelte.d.ts +11 -0
  238. package/dist/Components/StoragePicker/manager.svelte.d.ts +48 -0
  239. package/dist/Components/StoragePicker/{index.svelte.js → manager.svelte.js} +233 -137
  240. package/dist/Components/SuccessCheck/index.svelte +2 -0
  241. package/dist/Components/SuccessCheck/index.svelte.d.ts +15 -0
  242. package/dist/Components/TableAdvanced/ColumnInput/index.svelte.d.ts +11 -0
  243. package/dist/Components/TableAdvanced/ColumnInput/manager.svelte.d.ts +62 -0
  244. package/dist/Components/TableAdvanced/ColumnInput/{index.svelte.js → manager.svelte.js} +9 -11
  245. package/dist/Components/TableAdvanced/FilterInput/index.svelte.d.ts +11 -0
  246. package/dist/Components/TableAdvanced/FilterInput/manager.svelte.d.ts +17 -0
  247. package/dist/Components/TableAdvanced/FilterInput/{index.svelte.js → manager.svelte.js} +6 -8
  248. package/dist/Components/TableAdvanced/Pagination/index.svelte.d.ts +11 -0
  249. package/dist/Components/TableAdvanced/Pagination/manager.svelte.d.ts +12 -0
  250. package/dist/Components/TableAdvanced/Pagination/{index.svelte.js → manager.svelte.js} +1 -1
  251. package/dist/Components/TableAdvanced/SortByInput/index.svelte.d.ts +11 -0
  252. package/dist/Components/TableAdvanced/SortByInput/manager.svelte.d.ts +17 -0
  253. package/dist/Components/TableAdvanced/SortByInput/{index.svelte.js → manager.svelte.js} +4 -5
  254. package/dist/Components/TableAdvanced/index.svelte.d.ts +13 -0
  255. package/dist/Components/TableAdvanced/manager.svelte.d.ts +89 -0
  256. package/dist/Components/TableAdvanced/{index.svelte.js → manager.svelte.js} +20 -29
  257. package/dist/Components/Tag/index.svelte +3 -3
  258. package/dist/Components/Tag/index.svelte.d.ts +11 -0
  259. package/dist/Components/Tag/manager.svelte.d.ts +10 -0
  260. package/dist/Components/Tag/manager.svelte.js +118 -0
  261. package/dist/Components/TextArrayInput/index.svelte.d.ts +11 -0
  262. package/dist/Components/TextArrayInput/manager.svelte.d.ts +26 -0
  263. package/dist/Components/TextArrayInput/{index.svelte.js → manager.svelte.js} +10 -3
  264. package/dist/Components/TextInput/PasswordTooltip/index.svelte.d.ts +21 -0
  265. package/dist/Components/TextInput/index.svelte +3 -3
  266. package/dist/Components/TextInput/index.svelte.d.ts +11 -0
  267. package/dist/Components/TextInput/manager.svelte.d.ts +56 -0
  268. package/dist/Components/TextInput/{index.svelte.js → manager.svelte.js} +49 -21
  269. package/dist/Components/Time/index.svelte.d.ts +11 -0
  270. package/dist/Components/Time/manager.svelte.d.ts +31 -0
  271. package/dist/Components/Time/manager.svelte.js +44 -0
  272. package/dist/Components/TimeInput/NumberToggler/index.svelte.d.ts +11 -0
  273. package/dist/Components/TimeInput/NumberToggler/manager.svelte.d.ts +8 -0
  274. package/{src/lib/Components/TimeInput/NumberToggler/index.svelte.js → dist/Components/TimeInput/NumberToggler/manager.svelte.js} +4 -2
  275. package/dist/Components/TimeInput/index.d.ts +193 -0
  276. package/dist/Components/TimeInput/index.js +36 -12
  277. package/dist/Components/TimeInput/index.svelte +8 -4
  278. package/dist/Components/TimeInput/index.svelte.d.ts +11 -0
  279. package/dist/Components/TimeInput/manager.svelte.d.ts +67 -0
  280. package/dist/Components/TimeInput/{index.svelte.js → manager.svelte.js} +26 -13
  281. package/dist/Components/Tooltip/index.svelte +13 -5
  282. package/dist/Components/Tooltip/index.svelte.d.ts +15 -0
  283. package/dist/Components/TransparentBackground/index.svelte.d.ts +17 -0
  284. package/dist/Components/TypingDots/index.svelte.d.ts +11 -0
  285. package/dist/Components/VariablePathInput/index.svelte.d.ts +11 -0
  286. package/dist/Components/VariablePathInput/manager.svelte.d.ts +13 -0
  287. package/dist/Components/VariablePathInput/{index.svelte.js → manager.svelte.js} +7 -7
  288. package/dist/Components/VideoTBD/index.svelte.d.ts +6 -0
  289. package/dist/Components/XFollow/index.svelte +34 -6
  290. package/dist/Components/XFollow/index.svelte.d.ts +13 -0
  291. package/dist/Components/XPost/index.svelte +12 -4
  292. package/dist/Components/XPost/index.svelte.d.ts +11 -0
  293. package/dist/Components/XPost/manager.svelte.d.ts +14 -0
  294. package/dist/Components/XPost/manager.svelte.js +173 -0
  295. package/dist/Components/YoutubeChannelButton/index.svelte +23 -5
  296. package/dist/Components/YoutubeChannelButton/index.svelte.d.ts +13 -0
  297. package/dist/Components/YoutubeVideo/index.svelte +14 -6
  298. package/dist/Components/YoutubeVideo/index.svelte.d.ts +11 -0
  299. package/dist/Components/YoutubeVideo/manager.svelte.d.ts +24 -0
  300. package/dist/Components/YoutubeVideo/manager.svelte.js +186 -0
  301. package/dist/actions/draggable.d.ts +3 -0
  302. package/dist/actions/draggable.js +16 -8
  303. package/dist/actions/index.d.ts +3 -0
  304. package/dist/actions/no_spaces.d.ts +4 -0
  305. package/dist/actions/no_spaces.js +1 -1
  306. package/dist/actions/numbers_only.d.ts +3 -0
  307. package/dist/actions/numbers_only.js +1 -1
  308. package/dist/actions/scroll_y.d.ts +3 -0
  309. package/dist/actions/scroll_y.js +6 -2
  310. package/dist/actions/stop_scroll_propagation_y.d.ts +3 -0
  311. package/dist/actions/stop_scroll_propagation_y.js +20 -12
  312. package/dist/actions/swipe_handler.d.ts +3 -0
  313. package/dist/actions/swipe_handler.js +26 -9
  314. package/dist/client/astc_formatting/index.d.ts +25 -0
  315. package/dist/client/astc_formatting/index.js +113 -60
  316. package/dist/client/index.d.ts +61 -0
  317. package/dist/client/index.js +221 -89
  318. package/dist/client/links.d.ts +7 -0
  319. package/dist/client/links.js +68 -0
  320. package/dist/client/mapkit.d.ts +4 -0
  321. package/dist/client/mapkit.js +103 -0
  322. package/dist/client/types/index.d.ts +5678 -0
  323. package/dist/client/types/index.js +1 -21
  324. package/dist/index.d.ts +117 -0
  325. package/dist/index.js +56 -45
  326. package/package.json +44 -7
  327. package/dist/Components/Attachment/index.svelte.js +0 -119
  328. package/dist/Components/Breadcrumbs/index.svelte.js +0 -88
  329. package/dist/Components/Chart/index.svelte.js +0 -1917
  330. package/dist/Components/Color/index.svelte.js +0 -31
  331. package/dist/Components/EmailAddress/index.svelte.js +0 -45
  332. package/dist/Components/Location/index.svelte.js +0 -288
  333. package/dist/Components/Number/index.svelte.js +0 -151
  334. package/dist/Components/PhoneCountryCode/index.svelte.js +0 -260
  335. package/dist/Components/PhoneNumber/index.svelte.js +0 -41
  336. package/dist/Components/Qr/index.svelte.js +0 -301
  337. package/dist/Components/Tag/index.svelte.js +0 -76
  338. package/dist/Components/Time/index.svelte.js +0 -38
  339. package/dist/Components/TimeInput/NumberToggler/index.svelte.js +0 -79
  340. package/dist/Components/XPost/index.svelte.js +0 -64
  341. package/dist/Components/YoutubeVideo/index.svelte.js +0 -133
  342. package/dist/client/docs/index.js +0 -7670
  343. package/jsconfig.json +0 -9
  344. package/scripts/clean-dist.js +0 -11
  345. package/scripts/use-next-npm-version.js +0 -80
  346. package/src/app.html +0 -17
  347. package/src/hooks.server.js +0 -7
  348. package/src/lib/Components/Alert/index.svelte +0 -88
  349. package/src/lib/Components/Alert/index.svelte.js +0 -101
  350. package/src/lib/Components/ArrowToggle/index.svelte +0 -62
  351. package/src/lib/Components/Attachment/index.svelte +0 -77
  352. package/src/lib/Components/Attachment/index.svelte.js +0 -119
  353. package/src/lib/Components/Audio/index.svelte +0 -199
  354. package/src/lib/Components/Audio/index.svelte.js +0 -543
  355. package/src/lib/Components/AudioEditor/index.svelte +0 -252
  356. package/src/lib/Components/AudioEditor/index.svelte.js +0 -977
  357. package/src/lib/Components/AudioEditor/samples/alloy-voice-sample.mp3 +0 -0
  358. package/src/lib/Components/AudioEditor/samples/echo-voice-sample.mp3 +0 -0
  359. package/src/lib/Components/AudioEditor/samples/fable-voice-sample.mp3 +0 -0
  360. package/src/lib/Components/AudioEditor/samples/nova-voice-sample.mp3 +0 -0
  361. package/src/lib/Components/AudioEditor/samples/onyx-voice-sample.mp3 +0 -0
  362. package/src/lib/Components/AudioEditor/samples/shimmer-voice-sample.mp3 +0 -0
  363. package/src/lib/Components/AuthCodeInput/index.svelte +0 -85
  364. package/src/lib/Components/AuthCodeInput/index.svelte.js +0 -95
  365. package/src/lib/Components/Breadcrumbs/index.svelte +0 -27
  366. package/src/lib/Components/Button/index.svelte +0 -735
  367. package/src/lib/Components/Button/index.svelte.js +0 -408
  368. package/src/lib/Components/Chart/Klines/index.svelte +0 -87
  369. package/src/lib/Components/Chart/index.svelte +0 -279
  370. package/src/lib/Components/ChartInput/DisplayNav/Klines/index.svelte +0 -157
  371. package/src/lib/Components/ChartInput/DisplayNav/Lines/index.svelte +0 -55
  372. package/src/lib/Components/ChartInput/DisplayNav/index.svelte +0 -297
  373. package/src/lib/Components/ChartInput/EditPanel/index.svelte +0 -155
  374. package/src/lib/Components/ChartInput/index.svelte +0 -21
  375. package/src/lib/Components/ChartInput/index.svelte.js +0 -671
  376. package/src/lib/Components/Checkbox/index.svelte +0 -410
  377. package/src/lib/Components/Checkbox/index.svelte.js +0 -178
  378. package/src/lib/Components/Code/index.svelte +0 -23
  379. package/src/lib/Components/Code/index.svelte.js +0 -33
  380. package/src/lib/Components/Color/index.svelte +0 -51
  381. package/src/lib/Components/ColorInput/ChromaPicker/index.svelte +0 -50
  382. package/src/lib/Components/ColorInput/ColorPalette/index.svelte +0 -62
  383. package/src/lib/Components/ColorInput/OpacityPicker/index.svelte +0 -68
  384. package/src/lib/Components/ColorInput/ShowcasePicker/index.svelte +0 -136
  385. package/src/lib/Components/ColorInput/index.svelte +0 -70
  386. package/src/lib/Components/ColorInput/index.svelte.js +0 -386
  387. package/src/lib/Components/ConditionsInput/index.svelte +0 -46
  388. package/src/lib/Components/ConditionsInput/index.svelte.js +0 -201
  389. package/src/lib/Components/Confetti/index.svelte +0 -98
  390. package/src/lib/Components/Confetti/index.svelte.js +0 -94
  391. package/src/lib/Components/Content/index.svelte +0 -500
  392. package/src/lib/Components/Content/index.svelte.js +0 -910
  393. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte +0 -31
  394. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Audio/index.svelte.js +0 -258
  395. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte +0 -31
  396. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/AudioAdvanced/index.svelte.js +0 -258
  397. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte +0 -58
  398. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Dropdown/index.svelte.js +0 -206
  399. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte +0 -28
  400. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Image/index.svelte.js +0 -224
  401. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte +0 -44
  402. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Number/index.svelte.js +0 -272
  403. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte +0 -41
  404. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Qr/index.svelte.js +0 -202
  405. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte +0 -19
  406. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Slider/index.svelte.js +0 -117
  407. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte +0 -60
  408. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TableAdvanced/index.svelte.js +0 -542
  409. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte +0 -47
  410. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/Tag/index.svelte.js +0 -185
  411. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte +0 -35
  412. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TextInput/index.svelte.js +0 -222
  413. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte +0 -20
  414. package/src/lib/Components/ContentInput/AttributesInput/CustomConfig/TimeInput/index.svelte.js +0 -84
  415. package/src/lib/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte +0 -25
  416. package/src/lib/Components/ContentInput/AttributesInput/DefinedTypeInput/index.svelte.js +0 -91
  417. package/src/lib/Components/ContentInput/AttributesInput/index.svelte +0 -352
  418. package/src/lib/Components/ContentInput/AttributesInput/index.svelte.js +0 -1436
  419. package/src/lib/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte +0 -64
  420. package/src/lib/Components/ContentInput/ContentPanelBuilder/AddElement/index.svelte.js +0 -97
  421. package/src/lib/Components/ContentInput/ContentPanelBuilder/ElementList/index.svelte +0 -184
  422. package/src/lib/Components/ContentInput/ContentPanelBuilder/index.svelte +0 -41
  423. package/src/lib/Components/ContentInput/index.svelte +0 -78
  424. package/src/lib/Components/ContentInput/index.svelte.js +0 -1197
  425. package/src/lib/Components/CronInput/index.svelte +0 -78
  426. package/src/lib/Components/CronInput/index.svelte.js +0 -198
  427. package/src/lib/Components/DataTypeInput/index.svelte +0 -174
  428. package/src/lib/Components/DataTypeInput/index.svelte.js +0 -565
  429. package/src/lib/Components/Dropdown/index.svelte +0 -116
  430. package/src/lib/Components/Dropdown/index.svelte.js +0 -403
  431. package/src/lib/Components/EmailAddress/index.svelte +0 -22
  432. package/src/lib/Components/EmailAddress/index.svelte.js +0 -45
  433. package/src/lib/Components/ErrorX/index.svelte +0 -58
  434. package/src/lib/Components/Eye/index.svelte +0 -57
  435. package/src/lib/Components/FileInput/index.svelte +0 -146
  436. package/src/lib/Components/FileInput/index.svelte.js +0 -249
  437. package/src/lib/Components/Hamburger/index.svelte +0 -99
  438. package/src/lib/Components/HorizScrollBox/index.svelte +0 -145
  439. package/src/lib/Components/Icon/index.svelte +0 -412
  440. package/src/lib/Components/Icon/index.svelte.js +0 -116
  441. package/src/lib/Components/IconInput/index.svelte +0 -77
  442. package/src/lib/Components/IconInput/index.svelte.js +0 -259
  443. package/src/lib/Components/Image/index.svelte +0 -128
  444. package/src/lib/Components/Image/index.svelte.js +0 -116
  445. package/src/lib/Components/ImageEditor/Image/CropBox/index.svelte +0 -165
  446. package/src/lib/Components/ImageEditor/Image/index.svelte +0 -104
  447. package/src/lib/Components/ImageEditor/Panels/AI/index.svelte +0 -44
  448. package/src/lib/Components/ImageEditor/Panels/Crop/index.svelte +0 -96
  449. package/src/lib/Components/ImageEditor/Panels/File/QualityPicker/index.svelte +0 -124
  450. package/src/lib/Components/ImageEditor/Panels/File/index.svelte +0 -74
  451. package/src/lib/Components/ImageEditor/Panels/Filters/index.svelte +0 -46
  452. package/src/lib/Components/ImageEditor/Panels/Resize/index.svelte +0 -58
  453. package/src/lib/Components/ImageEditor/index.svelte +0 -93
  454. package/src/lib/Components/ImageEditor/index.svelte.js +0 -1961
  455. package/src/lib/Components/ImageSlider/index.svelte +0 -124
  456. package/src/lib/Components/ImageSlider/index.svelte.js +0 -99
  457. package/src/lib/Components/InfoBox/index.svelte +0 -89
  458. package/src/lib/Components/Json/Nested/index.svelte +0 -157
  459. package/src/lib/Components/Json/index.svelte +0 -60
  460. package/src/lib/Components/Json/index.svelte.js +0 -594
  461. package/src/lib/Components/LabeledItem/index.svelte +0 -102
  462. package/src/lib/Components/Layout/NavBar/FullNav/index.svelte +0 -52
  463. package/src/lib/Components/Layout/NavBar/NavGuts/index.svelte +0 -87
  464. package/src/lib/Components/Layout/NavBar/index.svelte +0 -72
  465. package/src/lib/Components/Layout/index.svelte +0 -149
  466. package/src/lib/Components/Layout/index.svelte.js +0 -363
  467. package/src/lib/Components/Link/index.svelte +0 -47
  468. package/src/lib/Components/Link/index.svelte.js +0 -133
  469. package/src/lib/Components/LoadingSuccessDiv/index.svelte +0 -51
  470. package/src/lib/Components/LoadingWheel/index.svelte +0 -38
  471. package/src/lib/Components/Location/index.svelte +0 -79
  472. package/src/lib/Components/Location/index.svelte.js +0 -288
  473. package/src/lib/Components/LocationInput/index.svelte +0 -197
  474. package/src/lib/Components/LocationInput/index.svelte.js +0 -965
  475. package/src/lib/Components/Number/index.svelte +0 -47
  476. package/src/lib/Components/Number/index.svelte.js +0 -151
  477. package/src/lib/Components/PhoneCountryCode/index.svelte +0 -7
  478. package/src/lib/Components/PhoneNumber/index.svelte +0 -22
  479. package/src/lib/Components/PhoneNumber/index.svelte.js +0 -41
  480. package/src/lib/Components/Popover/index.svelte +0 -396
  481. package/src/lib/Components/Popover/index.svelte.js +0 -319
  482. package/src/lib/Components/Qr/index.svelte +0 -85
  483. package/src/lib/Components/QrInput/index.svelte +0 -47
  484. package/src/lib/Components/QrInput/index.svelte.js +0 -218
  485. package/src/lib/Components/Slider/index.svelte +0 -239
  486. package/src/lib/Components/Slider/index.svelte.js +0 -469
  487. package/src/lib/Components/Spacer/index.svelte +0 -41
  488. package/src/lib/Components/StoragePicker/DisplayFile/index.svelte +0 -15
  489. package/src/lib/Components/StoragePicker/index.svelte +0 -187
  490. package/src/lib/Components/StoragePicker/index.svelte.js +0 -592
  491. package/src/lib/Components/SuccessCheck/index.svelte +0 -56
  492. package/src/lib/Components/TableAdvanced/ColumnInput/index.svelte +0 -117
  493. package/src/lib/Components/TableAdvanced/ColumnInput/index.svelte.js +0 -456
  494. package/src/lib/Components/TableAdvanced/FilterInput/index.svelte +0 -54
  495. package/src/lib/Components/TableAdvanced/FilterInput/index.svelte.js +0 -247
  496. package/src/lib/Components/TableAdvanced/Pagination/index.svelte +0 -43
  497. package/src/lib/Components/TableAdvanced/Pagination/index.svelte.js +0 -97
  498. package/src/lib/Components/TableAdvanced/SortByInput/index.svelte +0 -72
  499. package/src/lib/Components/TableAdvanced/SortByInput/index.svelte.js +0 -176
  500. package/src/lib/Components/TableAdvanced/index.svelte +0 -275
  501. package/src/lib/Components/TableAdvanced/index.svelte.js +0 -1565
  502. package/src/lib/Components/Tag/index.svelte +0 -45
  503. package/src/lib/Components/Tag/index.svelte.js +0 -76
  504. package/src/lib/Components/TextArrayInput/index.svelte +0 -108
  505. package/src/lib/Components/TextArrayInput/index.svelte.js +0 -239
  506. package/src/lib/Components/TextInput/PasswordTooltip/index.svelte +0 -89
  507. package/src/lib/Components/TextInput/index.svelte +0 -223
  508. package/src/lib/Components/TextInput/index.svelte.js +0 -424
  509. package/src/lib/Components/Time/index.svelte +0 -7
  510. package/src/lib/Components/Time/index.svelte.js +0 -38
  511. package/src/lib/Components/TimeInput/NumberToggler/index.svelte +0 -34
  512. package/src/lib/Components/TimeInput/index.js +0 -702
  513. package/src/lib/Components/TimeInput/index.svelte +0 -211
  514. package/src/lib/Components/TimeInput/index.svelte.js +0 -638
  515. package/src/lib/Components/Tooltip/index.svelte +0 -143
  516. package/src/lib/Components/TransparentBackground/index.svelte +0 -153
  517. package/src/lib/Components/TypingDots/index.svelte +0 -84
  518. package/src/lib/Components/VariablePathInput/index.svelte +0 -63
  519. package/src/lib/Components/VariablePathInput/index.svelte.js +0 -273
  520. package/src/lib/Components/VideoTBD/index.svelte +0 -100
  521. package/src/lib/Components/XFollow/index.svelte +0 -42
  522. package/src/lib/Components/XPost/index.svelte +0 -52
  523. package/src/lib/Components/XPost/index.svelte.js +0 -64
  524. package/src/lib/Components/YoutubeChannelButton/index.svelte +0 -82
  525. package/src/lib/Components/YoutubeVideo/index.svelte +0 -164
  526. package/src/lib/Components/YoutubeVideo/index.svelte.js +0 -133
  527. package/src/lib/actions/draggable.js +0 -49
  528. package/src/lib/actions/index.js +0 -24
  529. package/src/lib/actions/no_spaces.js +0 -33
  530. package/src/lib/actions/numbers_only.js +0 -26
  531. package/src/lib/actions/scroll_y.js +0 -28
  532. package/src/lib/actions/stop_scroll_propagation_y.js +0 -42
  533. package/src/lib/actions/swipe_handler.js +0 -295
  534. package/src/lib/client/astc_formatting/index.js +0 -1128
  535. package/src/lib/client/docs/index.js +0 -7670
  536. package/src/lib/client/index.js +0 -735
  537. package/src/lib/client/types/index.js +0 -2815
  538. package/src/lib/index.js +0 -181
  539. package/src/lib/style.css +0 -682
  540. package/src/routes/+layout.js +0 -8
  541. package/src/routes/+layout.svelte +0 -241
  542. package/src/routes/+page.svelte +0 -369
  543. package/src/routes/components/[component]/+page.svelte +0 -174
  544. package/src/routes/components/[component]/Showcase/Alert/index.svelte +0 -26
  545. package/src/routes/components/[component]/Showcase/Audio/index.svelte +0 -87
  546. package/src/routes/components/[component]/Showcase/AudioEditor/index.svelte +0 -93
  547. package/src/routes/components/[component]/Showcase/AuthCodeInput/index.svelte +0 -13
  548. package/src/routes/components/[component]/Showcase/Breadcrumbs/index.svelte +0 -44
  549. package/src/routes/components/[component]/Showcase/Button/index.svelte +0 -350
  550. package/src/routes/components/[component]/Showcase/Chart/index.svelte +0 -11117
  551. package/src/routes/components/[component]/Showcase/Checkbox/index.svelte +0 -52
  552. package/src/routes/components/[component]/Showcase/Code/index.svelte +0 -13
  553. package/src/routes/components/[component]/Showcase/Color/index.svelte +0 -28
  554. package/src/routes/components/[component]/Showcase/ColorInput/index.svelte +0 -35
  555. package/src/routes/components/[component]/Showcase/ConditionsInput/index.svelte +0 -18
  556. package/src/routes/components/[component]/Showcase/Confetti/index.svelte +0 -22
  557. package/src/routes/components/[component]/Showcase/Content/index.svelte +0 -110
  558. package/src/routes/components/[component]/Showcase/ContentInput/index.svelte +0 -1943
  559. package/src/routes/components/[component]/Showcase/CronInput/index.svelte +0 -30
  560. package/src/routes/components/[component]/Showcase/DocsDefinition/index.svelte +0 -155
  561. package/src/routes/components/[component]/Showcase/Dropdown/index.svelte +0 -88
  562. package/src/routes/components/[component]/Showcase/FileInput/index.svelte +0 -40
  563. package/src/routes/components/[component]/Showcase/Icon/index.svelte +0 -120
  564. package/src/routes/components/[component]/Showcase/IconInput/index.svelte +0 -15
  565. package/src/routes/components/[component]/Showcase/Image/index.svelte +0 -167
  566. package/src/routes/components/[component]/Showcase/ImageEditor/index.svelte +0 -90
  567. package/src/routes/components/[component]/Showcase/ImageSlider/index.svelte +0 -26
  568. package/src/routes/components/[component]/Showcase/InfoBox/index.svelte +0 -44
  569. package/src/routes/components/[component]/Showcase/Json/index.svelte +0 -80
  570. package/src/routes/components/[component]/Showcase/LabeledItem/index.svelte +0 -18
  571. package/src/routes/components/[component]/Showcase/Link/index.svelte +0 -15
  572. package/src/routes/components/[component]/Showcase/LoadingWheel/index.svelte +0 -10
  573. package/src/routes/components/[component]/Showcase/Location/index.svelte +0 -681
  574. package/src/routes/components/[component]/Showcase/LocationInput/index.svelte +0 -121
  575. package/src/routes/components/[component]/Showcase/Number/index.svelte +0 -55
  576. package/src/routes/components/[component]/Showcase/Popover/index.svelte +0 -225
  577. package/src/routes/components/[component]/Showcase/Qr/index.svelte +0 -77
  578. package/src/routes/components/[component]/Showcase/QrInput/index.svelte +0 -34
  579. package/src/routes/components/[component]/Showcase/Slider/index.svelte +0 -92
  580. package/src/routes/components/[component]/Showcase/Spacer/index.svelte +0 -27
  581. package/src/routes/components/[component]/Showcase/StoragePicker/index.svelte +0 -139
  582. package/src/routes/components/[component]/Showcase/TableAdvanced/index.svelte +0 -1568
  583. package/src/routes/components/[component]/Showcase/Tag/index.svelte +0 -27
  584. package/src/routes/components/[component]/Showcase/TextArrayInput/index.svelte +0 -23
  585. package/src/routes/components/[component]/Showcase/TextInput/index.svelte +0 -95
  586. package/src/routes/components/[component]/Showcase/Time/index.svelte +0 -43
  587. package/src/routes/components/[component]/Showcase/TimeInput/index.svelte +0 -100
  588. package/src/routes/components/[component]/Showcase/Tooltip/index.svelte +0 -37
  589. package/src/routes/components/[component]/Showcase/TransparentBackground/index.svelte +0 -26
  590. package/src/routes/components/[component]/Showcase/XFollow/index.svelte +0 -7
  591. package/src/routes/components/[component]/Showcase/XPost/index.svelte +0 -24
  592. package/src/routes/components/[component]/Showcase/YoutubeChannelButton/index.svelte +0 -7
  593. package/src/routes/components/[component]/Showcase/YoutubeVideo/index.svelte +0 -15
  594. package/src/routes/sitemap.xml/+server.js +0 -80
  595. package/src/routes/test/+page.svelte +0 -53
  596. package/src/routes/test2/+page.svelte +0 -10908
  597. package/src/routes/test3/+page.server.js +0 -9469
  598. package/src/routes/test3/+page.svelte +0 -109
  599. package/static/android-chrome-192x192.png +0 -0
  600. package/static/android-chrome-512x512.png +0 -0
  601. package/static/apple-touch-icon.png +0 -0
  602. package/static/favicon-inactive.svg +0 -4
  603. package/static/favicon-themed.svg +0 -11
  604. package/static/favicon-transparent-bg.webp +0 -0
  605. package/static/favicon-transparent.webp +0 -0
  606. package/static/favicon.png +0 -0
  607. package/static/favicon.svg +0 -3
  608. package/static/favicon.webp +0 -0
  609. package/static/fonts/ProximaVara.woff2 +0 -0
  610. package/static/fonts/Quicksand-VariableFont.woff2 +0 -0
  611. package/static/fonts/RobotoSerif-VariableFont.woff2 +0 -0
  612. package/static/full_logo.webp +0 -0
  613. package/static/icon.png +0 -0
  614. package/static/site.webmanifest +0 -21
  615. package/static/thumbnail.png +0 -0
  616. package/static/thumbnail.webp +0 -0
  617. package/svelte.config.js +0 -12
  618. package/vite.config.js +0 -6
  619. /package/dist/Components/Icon/{index.svelte.js → manager.svelte.js} +0 -0
@@ -1,1917 +0,0 @@
1
- import { color_var, deep_copy } from "../../client/index.js"
2
-
3
- export function create_chart_manager(config) {
4
- const y_axis_width = 70
5
- const x_axis_height = 30
6
-
7
- let range_to_show_default = $state(500)
8
- let min_visible_bars = $state(20)
9
- let x_edge_padding_ratio = $state(0.5)
10
- const min_y_axis_pinch_dist_px = 8
11
- let datasets = $state(null)
12
- let chart_prepped = $state(null)
13
- let grid_width = $state(null)
14
- let frame_width = $derived(grid_width ? grid_width - y_axis_width : 0)
15
-
16
- function set_grid_width(input) {
17
- grid_width = input
18
- if (!chart_prepped) {
19
- chart_prepped = prep_chart({ ...config?.chart })
20
- }
21
- }
22
-
23
- function gen_color(
24
- l,
25
- c,
26
- h,
27
- o = 16,
28
- is_theme_based = true,
29
- dark_l_offset = 0,
30
- is_dark_theme = true,
31
- is_safari = false,
32
- ) {
33
- const l_try = l + dark_l_offset
34
- const l_limited = l_try > 16 ? 16 : l_try < 1 ? 1 : l_try
35
- const l_corrected = is_dark_theme ? l_limited : l
36
- return color_var(l_corrected, c, h, o, is_theme_based, is_safari)
37
- }
38
-
39
- function normalize(x, min, max) {
40
- const numerator = x - min
41
- const denominator = max - min
42
- return numerator != 0 && denominator != 0 ? numerator / denominator : 0
43
- }
44
-
45
- function denormalize(x, min, max) {
46
- const range = max - min
47
- return x != 0 && range != 0 ? x * range + min : min
48
- }
49
-
50
- function is_finite_num(input) {
51
- return input !== null && input !== undefined && Number.isFinite(Number(input))
52
- }
53
-
54
- function get_min_period_sec_from_chart(chart_like = chart_prepped) {
55
- let min_period_sec = null
56
- if (!Array.isArray(chart_like?.frames)) return min_period_sec
57
- for (let frame of chart_like.frames) {
58
- if (!Array.isArray(frame?.shared_y_axiss)) continue
59
- for (let shared_y_axis of frame.shared_y_axiss) {
60
- if (!Array.isArray(shared_y_axis?.datasets)) continue
61
- for (let dataset of shared_y_axis.datasets) {
62
- const period_x = Number(dataset?.period_x)
63
- if (Number.isFinite(period_x) && period_x > 0) {
64
- min_period_sec = min_period_sec == null ? period_x : Math.min(min_period_sec, period_x)
65
- }
66
- }
67
- }
68
- }
69
- return min_period_sec
70
- }
71
-
72
- function get_safe_y_range(low_y, high_y) {
73
- const range_y = Number(high_y) - Number(low_y)
74
- if (Number.isFinite(range_y) && range_y > 0) return range_y
75
- const center_y =
76
- is_finite_num(low_y) && is_finite_num(high_y)
77
- ? (Number(low_y) + Number(high_y)) / 2
78
- : is_finite_num(low_y)
79
- ? Number(low_y)
80
- : is_finite_num(high_y)
81
- ? Number(high_y)
82
- : 0
83
- return Math.max(Math.abs(center_y) * 0.01, 1e-8)
84
- }
85
-
86
- function get_padded_y_bounds(low_y, high_y, top_padding_pd = 0.2, bottom_padding_pd = 0.2) {
87
- const safe_top_padding_pd = clamp(top_padding_pd, 0, 0.45)
88
- const safe_bottom_padding_pd = clamp(bottom_padding_pd, 0, 0.45)
89
- const data_range_y = get_safe_y_range(low_y, high_y)
90
- const inner_chart_pd = clamp(1 - safe_top_padding_pd - safe_bottom_padding_pd, 0.1, 1)
91
- const shown_y_range = data_range_y / inner_chart_pd
92
- return {
93
- shown_low_y: Number(low_y) - safe_bottom_padding_pd * shown_y_range,
94
- shown_high_y: Number(high_y) + safe_top_padding_pd * shown_y_range,
95
- shown_y_range,
96
- }
97
- }
98
-
99
- function get_data_range_sec(chart_like = chart_prepped) {
100
- const data_start_x = chart_like?.all_data_start_x
101
- const data_end_x = chart_like?.all_data_end_x
102
- const data_range_sec = data_end_x - data_start_x
103
- return Number.isFinite(data_range_sec) && data_range_sec > 0 ? data_range_sec : null
104
- }
105
-
106
- function get_max_range_sec_from_chart(chart_like = chart_prepped) {
107
- const data_range_sec = get_data_range_sec(chart_like)
108
- if (!Number.isFinite(data_range_sec) || data_range_sec <= 0) return data_range_sec
109
- return data_range_sec * (1 + x_edge_padding_ratio * 2)
110
- }
111
-
112
- function get_x_edge_padding_sec(range_sec) {
113
- return Math.max((Number(range_sec) || 0) * x_edge_padding_ratio, 0)
114
- }
115
-
116
- const period_to_sec = {
117
- "5m": 300, //5m
118
- "10m": 600, //10m
119
- "15m": 900, //15m
120
- "20m": 1200, //20m
121
- "30m": 1800, //30m
122
- "45m": 2700, //45m
123
- "1h": 3600, //1h
124
- "2h": 7200, //2h
125
- "3h": 10800, //3h
126
- "4h": 14400, //4h
127
- "6h": 21600, //6h
128
- "8h": 28800, //8h
129
- "12h": 43200, //12h
130
- "1d": 86400, //1d
131
- "2d": 172800, //2d
132
- "3d": 259200, //3d
133
- "4d": 345600, //4d
134
- "1w": 604800, //1w
135
- "2w": 1209600, //2w
136
- }
137
-
138
- function generate_id(prefix) {
139
- return prefix + "-" + Math.floor(Math.random() * 1000000000000)
140
- }
141
-
142
- function add_val_to_obj_with_path(obj, pathList) {
143
- let current = obj
144
- for (let key of pathList) {
145
- if (!(key in current)) {
146
- current[key] = {}
147
- }
148
- current = current[key]
149
- }
150
- return obj
151
- }
152
- function add_val_to_obj_with_path_2(obj, pathList, val) {
153
- let current = obj
154
- for (let [index, key] of pathList.entries()) {
155
- if (!(key in current)) {
156
- current[key] = {}
157
- }
158
- if (index === pathList.length - 1) {
159
- current[key] = val ? val : {}
160
- }
161
- current = current[key]
162
- }
163
- return obj
164
- }
165
-
166
- function does_path_exist_on_obj(obj, pathList) {
167
- let current = obj
168
- for (let [index, key] of pathList.entries()) {
169
- if (index < pathList.length && !(key in current)) {
170
- return false
171
- }
172
- current = current[key]
173
- }
174
- return true
175
- }
176
-
177
- function remove_val_to_obj_with_path(obj, pathList) {
178
- let current = obj
179
- for (let [index, key] of pathList.entries()) {
180
- if (index === pathList.length - 1) {
181
- delete current[key]
182
- }
183
- current = current[key]
184
- }
185
- return obj
186
- }
187
-
188
- function get_obj_from_path(obj, path) {
189
- let current = obj
190
- for (let i = 0; i < path.length; i++) {
191
- if (!(path[i] in current)) return false
192
- current = current[path[i]]
193
- }
194
- return current
195
- }
196
-
197
- function scroll_frame(
198
- e,
199
- shown_start_x,
200
- shown_end_x,
201
- min_x_scrollable,
202
- max_x_scrollable,
203
- frame_width,
204
- min_period_sec = 60,
205
- max_range_sec = null,
206
- ) {
207
- const shown_x_range = shown_end_x - shown_start_x
208
- const change_sec = (Math.round((shown_x_range * 0.01) / 60) + 1) * 60
209
- const min_range_sec = Math.max(Number(min_visible_bars) || 0, 1) * min_period_sec
210
- const max_allowed_range_sec =
211
- Number.isFinite(max_range_sec) && max_range_sec > 0 ? max_range_sec : min_period_sec * 10000
212
- let shown_end_x_loc = shown_end_x
213
- let shown_start_x_loc = shown_start_x
214
- if (e.deltaX < -1) {
215
- shown_start_x_loc -= change_sec
216
- shown_end_x_loc -= change_sec
217
- } else if (e.deltaX > 1) {
218
- shown_start_x_loc += change_sec
219
- shown_end_x_loc += change_sec
220
- }
221
- let x_pd = e.offsetX / frame_width
222
- if (e.deltaY < -1 && shown_x_range > min_range_sec) {
223
- shown_start_x_loc += Math.round((change_sec * x_pd) / 10) * 10
224
- shown_end_x_loc -= Math.round((change_sec * (1 - x_pd)) / 10) * 10
225
- } else if (e.deltaY > 1 && shown_x_range < max_allowed_range_sec) {
226
- shown_start_x_loc -= Math.round((change_sec * x_pd) / 10) * 10
227
- shown_end_x_loc += Math.round((change_sec * (1 - x_pd)) / 10) * 10
228
- }
229
- return {
230
- shown_start_x: shown_start_x_loc,
231
- shown_end_x: shown_end_x_loc,
232
- }
233
- }
234
-
235
- function get_kline_details(o, l, h, c) {
236
- let res = {}
237
- const is_closed_higher = c > o ? 1 : 0
238
- const kline_height = Math.max(h - l, 1e-8)
239
- const kline_box_height = Math.abs(c - o)
240
- let kline_top_wick_height = h - o
241
- let kline_bottom_wick_height = c - l
242
- if (is_closed_higher) {
243
- kline_top_wick_height = h - c
244
- kline_bottom_wick_height = o - l
245
- }
246
- const kline_box_height_pd = kline_box_height / kline_height
247
- const kline_top_wick_height_pd = kline_top_wick_height / kline_height
248
- const kline_bottom_wick_height_pd = kline_bottom_wick_height / kline_height
249
- const kline_close_height_pd = (c - l) / kline_height
250
- res["is_closed_higher"] = is_closed_higher
251
- res["kline_height"] = kline_height
252
- res["kline_box_height"] = kline_box_height
253
- res["kline_top_wick_height"] = kline_top_wick_height
254
- res["kline_bottom_wick_height"] = kline_bottom_wick_height
255
- res["kline_box_height_pd"] = kline_box_height_pd
256
- res["kline_top_wick_height_pd"] = kline_top_wick_height_pd
257
- res["kline_bottom_wick_height_pd"] = kline_bottom_wick_height_pd
258
- res["kline_close_height_pd"] = kline_close_height_pd
259
- return res
260
- }
261
-
262
- function time_tic_size(seconds) {
263
- const tic_options = [
264
- 300, //5m
265
- 600, //10m
266
- 900, //15m
267
- 1200, //20m
268
- 1800, //30m
269
- 2700, //45m
270
- 3600, //1h
271
- 7200, //2h
272
- 10800, //3h
273
- 14400, //4h
274
- 21600, //6h
275
- 28800, //8h
276
- 43200, //12h
277
- 86400, //1d
278
- 172800, //2d
279
- 259200, //3d
280
- 345600, //4d
281
- 604800, //1w
282
- 1209600, //2w
283
- 2635200, //1m (30.5d)
284
- 7905600, //3m (91.5d)
285
- 15768000, //6m
286
- 31536000, //1y
287
- ]
288
- for (let i = 0; i < tic_options.length - 1; i++) {
289
- if (tic_options[i] < seconds && tic_options[i + 1] > seconds) {
290
- return tic_options[i + 1]
291
- }
292
- }
293
- return "-"
294
- }
295
-
296
- function base_time(high, clean_tic_time_change) {
297
- const d_high = new Date(high * 1000)
298
- const year = d_high.getFullYear()
299
- const month = d_high.getMonth()
300
- const day = d_high.getDate()
301
- const hour = d_high.getHours()
302
- const minute = d_high.getMinutes()
303
- const ticBases = {
304
- 31536000: { focus: "y", values: [] }, //1y
305
- 15768000: { focus: "M", values: [11, 5, 0] }, //6m
306
- 7905600: { focus: "M", values: [11, 8, 5, 2, 0] }, //3m (91.5d)
307
- 2635200: { focus: "M", values: [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] }, //1m (30.5d)
308
- 1209600: { focus: "d", values: [28, 14, 0] }, //2w
309
- 604800: { focus: "d", values: [28, 21, 14, 7, 0] }, //1w
310
- 345600: { focus: "d", values: [28, 24, 20, 16, 12, 8, 4, 0] }, //4d
311
- 259200: { focus: "d", values: [30, 27, 24, 21, 18, 15, 12, 9, 6, 3, 0] }, //3d
312
- 172800: { focus: "d", values: [30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0] }, //2d
313
- 86400: {
314
- focus: "d",
315
- values: [
316
- 31, 30, 19, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3,
317
- 2, 1, 0,
318
- ],
319
- }, //1d
320
- 43200: { focus: "h", values: [12, 0] }, //12h
321
- 28800: { focus: "h", values: [16, 8, 0] }, //8h
322
- 21600: { focus: "h", values: [18, 12, 6, 0] }, //6h
323
- 14400: { focus: "h", values: [20, 16, 12, 8, 4, 0] }, //4h
324
- 10800: { focus: "h", values: [21, 18, 15, 12, 9, 6, 3, 0] }, //3h
325
- 7200: { focus: "h", values: [22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0] }, //2h
326
- 3600: {
327
- focus: "h",
328
- values: [23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],
329
- }, //1h
330
- 2700: { focus: "m", values: [45, 0] }, //45m
331
- 1800: { focus: "m", values: [30, 0] }, //30m
332
- 1200: { focus: "m", values: [40, 20, 0] }, //20m
333
- 900: { focus: "m", values: [45, 30, 15, 0] }, //15m
334
- 600: { focus: "m", values: [50, 40, 30, 20, 10, 0] }, //10m
335
- 300: { focus: "m", values: [55, 50, 45, 40, 35, 30, 25, 20, 25, 20, 5, 0] }, //5m
336
- }
337
- var d = new Date()
338
- d.setFullYear(year)
339
- d.setMonth(0)
340
- d.setDate(1)
341
- d.setHours(0)
342
- d.setMinutes(0)
343
- d.setMilliseconds(0)
344
- switch (ticBases[clean_tic_time_change]?.focus) {
345
- case "y": {
346
- break
347
- }
348
- case "M": {
349
- d.setFullYear(year)
350
- for (let item of ticBases[clean_tic_time_change].values) {
351
- if (item < month) {
352
- d.setMonth(item)
353
- break
354
- }
355
- }
356
- break
357
- }
358
- case "d": {
359
- d.setFullYear(year)
360
- d.setMonth(month)
361
- for (let item of ticBases[clean_tic_time_change].values) {
362
- if (item < day) {
363
- d.setDate(item)
364
- break
365
- }
366
- }
367
- break
368
- }
369
- case "h": {
370
- d.setFullYear(year)
371
- d.setMonth(month)
372
- d.setDate(day)
373
- for (let item of ticBases[clean_tic_time_change].values) {
374
- if (item < hour) {
375
- d.setHours(item)
376
- break
377
- }
378
- }
379
- break
380
- }
381
- case "m": {
382
- d.setFullYear(year)
383
- d.setMonth(month)
384
- d.setDate(day)
385
- d.setHours(hour)
386
- for (let item of ticBases[clean_tic_time_change].values) {
387
- if (item < minute) {
388
- d.setMinutes(item)
389
- break
390
- }
391
- }
392
- break
393
- }
394
- default: {
395
- d.setMonth(month)
396
- d.setDate(day)
397
- d.setHours(hour)
398
- const remainer5min = minute % 300000
399
- const floor5min = minute - remainer5min
400
- d.setMinutes(floor5min)
401
- break
402
- }
403
- }
404
- return Math.floor(d.getTime() / 1000)
405
- }
406
-
407
- function readable_time(seconds) {
408
- const months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]
409
- const date_object = new Date(seconds * 1000)
410
- const year = date_object.getFullYear()
411
- const month = date_object.getMonth()
412
- const day = date_object.getDate()
413
- const hour = date_object.getHours()
414
- const minute = date_object.getMinutes()
415
- const year_st = JSON.stringify(year)
416
- const month_st = months[month]
417
- let day_st = JSON.stringify(day)
418
- // if(day_st.length < 2){ day_st = '0' + day_st }
419
- let hour_st = JSON.stringify(hour)
420
- // if(hour_st.length < 2){ hour_st = '0' + hour_st }
421
- let minute_st = JSON.stringify(minute)
422
- if (minute_st.length < 2) {
423
- minute_st = "0" + minute_st
424
- }
425
- const hour_minute_st = hour_st + ":" + minute_st
426
- if (minute > 0 || hour > 0) {
427
- return hour_minute_st
428
- } else if (day > 1) {
429
- return day_st
430
- } else if (month > 0) {
431
- return month_st
432
- }
433
- return year_st
434
- }
435
-
436
- function prep_x_axis(
437
- start_x,
438
- end_x,
439
- frame_width = 500,
440
- min_tic_spacing_x_axis = 20,
441
- min_tic_text_spacing_x_axis = 50,
442
- ) {
443
- const amount_of_tics = Math.floor(frame_width / min_tic_spacing_x_axis)
444
- const x_range = end_x - start_x
445
- const tic_x_change = x_range / amount_of_tics
446
- const clean_x_change = time_tic_size(tic_x_change)
447
- const clean_x = base_time(end_x, clean_x_change)
448
- const clean_x_text = readable_time(clean_x)
449
- const clean_x_norm = (clean_x - start_x) / x_range
450
- // const is_remaining_room_for_text = (1 - clean_x_norm) * frame_width >= (min_tic_text_spacing_x_axis / 2)
451
- let tics = [
452
- {
453
- x: clean_x,
454
- norm: clean_x_norm,
455
- text: clean_x_text,
456
- },
457
- ]
458
- let last_tic_with_text_x_norm = clean_x_norm
459
- for (let i = 1; i < amount_of_tics; i++) {
460
- const iter_x = clean_x + clean_x_change * i
461
- const iter_x_norm = (iter_x - start_x) / x_range
462
- // const is_remaining_room = ((end_x - iter_x) / x_range) * frame_width >= (min_tic_text_spacing_x_axis / 2)
463
- const is_far_enough_from_prev_text =
464
- !last_tic_with_text_x_norm ||
465
- (iter_x_norm - last_tic_with_text_x_norm) * frame_width >= min_tic_text_spacing_x_axis
466
- if (iter_x <= end_x) {
467
- if (is_far_enough_from_prev_text) {
468
- tics = [
469
- ...tics,
470
- {
471
- x: iter_x,
472
- norm: iter_x_norm,
473
- text: readable_time(iter_x),
474
- },
475
- ]
476
- last_tic_with_text_x_norm = iter_x_norm
477
- } else {
478
- tics = [
479
- ...tics,
480
- {
481
- x: iter_x,
482
- norm: iter_x_norm,
483
- text: null,
484
- },
485
- ]
486
- }
487
- } else {
488
- break
489
- }
490
- }
491
- last_tic_with_text_x_norm = clean_x_norm
492
- for (let i = 1; i < amount_of_tics; i++) {
493
- const iter_x = clean_x - clean_x_change * i
494
- const iter_x_norm = (iter_x - start_x) / x_range
495
- // const is_remaining_room = iter_x_norm * frame_width >= (min_tic_text_spacing_x_axis / 2)
496
- const is_far_enough_from_prev_text =
497
- !last_tic_with_text_x_norm ||
498
- (last_tic_with_text_x_norm - iter_x_norm) * frame_width >= min_tic_text_spacing_x_axis
499
- if (iter_x >= start_x) {
500
- if (is_far_enough_from_prev_text) {
501
- tics = [
502
- {
503
- x: iter_x,
504
- norm: iter_x_norm,
505
- text: readable_time(iter_x),
506
- },
507
- ...tics,
508
- ]
509
- last_tic_with_text_x_norm = iter_x_norm
510
- } else {
511
- tics = [
512
- {
513
- x: iter_x,
514
- norm: iter_x_norm,
515
- text: null,
516
- },
517
- ...tics,
518
- ]
519
- }
520
- } else {
521
- break
522
- }
523
- }
524
- return tics
525
- }
526
-
527
- function notable_num(low, high) {
528
- let abs_closest_to_zero = low
529
- let abs_farther_to_zero = high
530
- let is_positive = true
531
- if (high < 0) {
532
- abs_closest_to_zero = Math.abs(high)
533
- abs_farther_to_zero = Math.abs(low)
534
- is_positive = false
535
- }
536
- let accumulated_num = 0
537
- while (accumulated_num < abs_farther_to_zero) {
538
- const ceiling = abs_farther_to_zero - accumulated_num
539
- const res = next_big_num_under_target(ceiling)
540
- accumulated_num += res
541
- if (accumulated_num > abs_closest_to_zero) {
542
- if (is_positive) {
543
- return accumulated_num
544
- } else {
545
- return -1 * accumulated_num
546
- }
547
- }
548
- }
549
- return "-"
550
- }
551
-
552
- function next_big_num_under_target(target) {
553
- const num_bases = [
554
- 100000000000000, 10000000000000, 1000000000000, 100000000000, 10000000000, 1000000000, 100000000, 50000000,
555
- 20000000, 10000000, 5000000, 2000000, 1000000, 750000, 500000, 400000, 250000, 200000, 150000, 100000, 75000,
556
- 50000, 40000, 25000, 20000, 15000, 10000, 7500, 5000, 4000, 3000, 2500, 2000, 1500, 1250, 1000, 750, 500, 400,
557
- 300, 200, 150, 100, 75, 50, 40, 25, 20, 15, 12, 10, 8, 5, 4, 3, 2.5, 2, 1, 0.8, 0.5, 0.4, 0.3, 0.2, 0.1, 0.08,
558
- 0.05, 0.04, 0.03, 0.02, 0.01, 0.008, 0.005, 0.004, 0.003, 0.002, 0.001, 0.0008, 0.0005, 0.0004, 0.0003, 0.0002,
559
- 0.0001, 0.00008, 0.00005, 0.00004, 0.00003, 0.00002, 0.00001, 0.000008, 0.000005, 0.000004, 0.000003, 0.000002,
560
- 0.000001, 0.0000008, 0.0000005, 0.0000004, 0.0000003, 0.0000002, 0.0000001,
561
- ]
562
- for (let num of num_bases) {
563
- if (num < target) {
564
- return num
565
- }
566
- }
567
- return 1
568
- }
569
-
570
- function tic_size(num) {
571
- const tic_options = [
572
- 0.0000001, 0.0000002, 0.0000003, 0.0000004, 0.0000005, 0.0000008, 0.000001, 0.000002, 0.000003, 0.000004,
573
- 0.000005, 0.000008, 0.00001, 0.00002, 0.00003, 0.00004, 0.00005, 0.00008, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005,
574
- 0.0008, 0.001, 0.002, 0.003, 0.004, 0.005, 0.008, 0.01, 0.02, 0.03, 0.04, 0.05, 0.08, 0.1, 0.2, 0.3, 0.4, 0.5,
575
- 0.8, 1, 2, 2.5, 3, 4, 5, 8, 10, 12, 15, 20, 25, 40, 50, 75, 100, 150, 200, 300, 400, 500, 750, 1000, 1250, 1500,
576
- 2000, 2500, 3000, 4000, 5000, 7500, 10000, 15000, 20000, 25000, 40000, 50000, 75000, 100000, 150000, 200000,
577
- 250000, 400000, 500000, 750000, 1000000, 2000000, 5000000, 10000000, 20000000, 50000000, 100000000, 1000000000,
578
- 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000,
579
- ]
580
- for (let i = 0; i < tic_options.length - 1; i++) {
581
- if (tic_options[i] < num && tic_options[i + 1] > num) {
582
- return tic_options[i + 1]
583
- }
584
- }
585
- return "-"
586
- }
587
-
588
- function prep_y_axis(
589
- shown_low_y,
590
- shown_high_y,
591
- frame_height = 300,
592
- min_tic_spacing_y_axis = 10,
593
- min_tic_text_spacing_y_axis = 30,
594
- ) {
595
- const amount_of_tics = Math.floor(frame_height / min_tic_spacing_y_axis)
596
- const y_range = shown_high_y - shown_low_y
597
- const tic_y_change = y_range / amount_of_tics
598
- const clean_y_change = tic_size(tic_y_change)
599
- const clean_y = notable_num(shown_low_y, shown_high_y)
600
- const clean_y_norm = (clean_y - shown_low_y) / y_range
601
- const clean_y_text = short_lab(clean_y)
602
- const is_remaining_room_for_text = (1 - clean_y_norm) * frame_height >= min_tic_text_spacing_y_axis / 2
603
- let tics = [
604
- {
605
- y: clean_y,
606
- norm: clean_y_norm,
607
- text: is_remaining_room_for_text ? clean_y_text : null,
608
- ppp: (1 - clean_y_norm) * frame_height,
609
- },
610
- ]
611
- let last_tic_with_text_y_norm = is_remaining_room_for_text ? clean_y_norm : null
612
- for (let i = 1; i < amount_of_tics; i++) {
613
- const iter_y = clean_y + clean_y_change * i
614
- const iter_y_norm = (iter_y - shown_low_y) / y_range
615
- const is_remaining_room = ((shown_high_y - iter_y) / y_range) * frame_height >= min_tic_text_spacing_y_axis / 2
616
- const is_far_enough_from_prev_text =
617
- !last_tic_with_text_y_norm ||
618
- (iter_y_norm - last_tic_with_text_y_norm) * frame_height >= min_tic_text_spacing_y_axis
619
- if (iter_y <= shown_high_y) {
620
- if (is_far_enough_from_prev_text && is_remaining_room) {
621
- tics = [
622
- ...tics,
623
- {
624
- y: iter_y,
625
- norm: iter_y_norm,
626
- text: short_lab(iter_y),
627
- },
628
- ]
629
- last_tic_with_text_y_norm = iter_y_norm
630
- } else {
631
- tics = [
632
- ...tics,
633
- {
634
- y: iter_y,
635
- norm: iter_y_norm,
636
- text: null,
637
- },
638
- ]
639
- }
640
- } else {
641
- break
642
- }
643
- }
644
- last_tic_with_text_y_norm = clean_y_norm
645
- for (let i = 1; i < amount_of_tics; i++) {
646
- const iter_y = clean_y - clean_y_change * i
647
- const iter_y_norm = (iter_y - shown_low_y) / y_range
648
- const is_remaining_room = iter_y_norm * frame_height >= min_tic_text_spacing_y_axis / 2
649
- const is_far_enough_from_prev_text =
650
- !last_tic_with_text_y_norm ||
651
- (last_tic_with_text_y_norm - iter_y_norm) * frame_height >= min_tic_text_spacing_y_axis
652
- if (iter_y >= shown_low_y) {
653
- if (is_far_enough_from_prev_text && is_remaining_room) {
654
- tics = [
655
- {
656
- y: iter_y,
657
- norm: iter_y_norm,
658
- text: short_lab(iter_y),
659
- },
660
- ...tics,
661
- ]
662
- last_tic_with_text_y_norm = iter_y_norm
663
- } else {
664
- tics = [
665
- {
666
- x: iter_y,
667
- norm: iter_y_norm,
668
- text: null,
669
- },
670
- ...tics,
671
- ]
672
- }
673
- } else {
674
- break
675
- }
676
- }
677
- return tics
678
- }
679
-
680
- function short_lab(num) {
681
- var if_neg = 1
682
- if ((typeof num === typeof null) | (typeof num === typeof undefined)) {
683
- return "-"
684
- }
685
- if (num < 0) {
686
- if_neg = -1
687
- }
688
- var amount
689
- amount = Math.abs(num)
690
- if (amount === 0) {
691
- return 0
692
- } else if (amount >= 0 && amount < 0.0001) {
693
- return Math.round((if_neg * amount).toFixed(8) * 10000000 + Number.EPSILON) / 10000000
694
- } else if (amount >= 0.0001 && amount < 0.001) {
695
- return Math.round((if_neg * amount).toFixed(7) * 1000000 + Number.EPSILON) / 1000000
696
- } else if (amount >= 0.001 && amount < 0.01) {
697
- return Math.round((if_neg * amount).toFixed(6) * 100000 + Number.EPSILON) / 100000
698
- } else if (amount >= 0.01 && amount < 0.1) {
699
- return Math.round((if_neg * amount).toFixed(5) * 10000 + Number.EPSILON) / 10000
700
- } else if (amount >= 0.1 && amount < 10) {
701
- return Math.round((if_neg * amount).toFixed(4) * 1000 + Number.EPSILON) / 1000
702
- } else if (amount >= 10 && amount < 1000) {
703
- return (if_neg * amount).toFixed(2)
704
- } else if (amount >= 1000 && amount < 1000000) {
705
- return (if_neg * amount).toFixed().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
706
- } else if (amount >= 1000000 && amount < 10000000) {
707
- return (if_neg * (amount / 1000000)).toFixed(2) + " M"
708
- } else if (amount >= 10000000 && amount < 100000000) {
709
- return (if_neg * (amount / 1000000)).toFixed(1) + " M"
710
- } else if (amount >= 100000000 && amount < 1000000000) {
711
- return (if_neg * (amount / 1000000)).toFixed() + " M"
712
- } else if (amount >= 1000000000 && amount < 10000000000) {
713
- return (if_neg * (amount / 1000000000)).toFixed(2) + " B"
714
- } else if (amount >= 10000000000 && amount < 100000000000) {
715
- return (if_neg * (amount / 1000000000)).toFixed(1) + " B"
716
- } else if (amount >= 100000000000 && amount < 1000000000000) {
717
- return (if_neg * (amount / 1000000000)).toFixed() + " B"
718
- } else if (amount >= 1000000000000 && amount < 10000000000000) {
719
- return (if_neg * (amount / 1000000000000)).toFixed(2) + " T"
720
- } else if (amount >= 10000000000000 && amount < 100000000000000) {
721
- return (if_neg * (amount / 1000000000000)).toFixed(1) + " T"
722
- } else if (amount >= 100000000000000 && amount < 1000000000000000) {
723
- return (if_neg * (amount / 1000000000000)).toFixed() + " T"
724
- } else if (amount >= 1000000000000000 && amount < 10000000000000000n) {
725
- return (if_neg * (amount / 1000000000000000)).toFixed(2) + " Q"
726
- } else if (amount >= 10000000000000000n && amount < 100000000000000000n) {
727
- return (if_neg * (amount / 1000000000000000)).toFixed(1) + " Q"
728
- } else if (amount >= 100000000000000000n && amount < 1000000000000000000n) {
729
- return (if_neg * (amount / 1000000000000000)).toFixed() + " Q"
730
- } else if (amount >= 1000000000000000000n && amount < 10000000000000000000n) {
731
- return (if_neg * (amount / 1000000000000000000n)).toFixed(2) + " QN"
732
- } else if (amount >= 10000000000000000000n && amount < 100000000000000000000n) {
733
- return (if_neg * (amount / 1000000000000000000n)).toFixed(1) + " QN"
734
- } else if (amount >= 100000000000000000000n && amount < 1000000000000000000000n) {
735
- return (if_neg * (amount / 1000000000000000000n)).toFixed() + " QN"
736
- } else {
737
- return "Big"
738
- }
739
- }
740
-
741
- function handle_scroll_frame(e) {
742
- e.preventDefault()
743
- const min_period_sec = get_min_period_sec_from_chart() ?? 60
744
- const max_range_sec = get_max_range_sec_from_chart()
745
- const res = scroll_frame(
746
- e,
747
- chart_prepped.shown_start_x,
748
- chart_prepped.shown_end_x,
749
- chart_prepped?.min_x_scrollable,
750
- chart_prepped?.max_x_scrollable,
751
- frame_width,
752
- min_period_sec,
753
- max_range_sec,
754
- )
755
- apply_view(res.shown_start_x, res.shown_end_x)
756
- }
757
-
758
- function get_y_axis_zoom_factor_from_wheel(delta_y) {
759
- const clamped_delta = clamp(Number(delta_y) || 0, -120, 120)
760
- return Math.exp(clamped_delta * 0.00045)
761
- }
762
-
763
- function get_y_axis_state(frame_index) {
764
- const frame = chart_prepped?.frames?.[frame_index]
765
- const axis_index = frame?.shown_y_axis_index ?? 0
766
- const axis = frame?.shared_y_axiss?.[axis_index]
767
- return { frame, axis_index, axis }
768
- }
769
-
770
- function get_current_y_bounds(axis) {
771
- return {
772
- low_y: is_finite_num(axis?.manual_low_y) ? Number(axis.manual_low_y) : Number(axis?.shown_low_y),
773
- high_y: is_finite_num(axis?.manual_high_y) ? Number(axis.manual_high_y) : Number(axis?.shown_high_y),
774
- }
775
- }
776
-
777
- function set_manual_y_bounds(axis, low_y, high_y) {
778
- axis.manual_low_y = parseFloat(low_y.toPrecision(10))
779
- axis.manual_high_y = parseFloat(high_y.toPrecision(10))
780
- chart_prepped = prep_chart(deep_copy(chart_prepped))
781
- }
782
-
783
- let pointer_cache = new Map()
784
- let touch_hover_memory = {
785
- frame_index: null,
786
- x_hovered_percent_decimal: null,
787
- y_hovered_percent_decimal: null,
788
- }
789
- let gesture_state = {
790
- mode: null,
791
- start_shown_start_x: null,
792
- start_shown_end_x: null,
793
- start_range_sec: null,
794
- start_primary_x: null,
795
- start_primary_y: null,
796
- start_dist_px: null,
797
- start_center_pd: null,
798
- touch_hover_offset_x: null,
799
- touch_hover_offset_y: null,
800
- touch_hover_frame_index: null,
801
- }
802
- let y_axis_gesture_state = {
803
- mode: null,
804
- frame_index: null,
805
- start_y: null,
806
- start_dist_px: null,
807
- start_range_y: null,
808
- start_low_y: null,
809
- start_high_y: null,
810
- anchor_pd: null,
811
- anchor_y: null,
812
- did_drag: false,
813
- suppress_click: false,
814
- }
815
- let y_axis_pointer_cache = new Map()
816
-
817
- function clamp(n, min, max) {
818
- return n < min ? min : n > max ? max : n
819
- }
820
-
821
- function clamp_range_to_limits(range_sec) {
822
- const min_period_sec = get_min_period_sec_from_chart() ?? 60
823
- const min_range = Math.max(Number(min_visible_bars) || 0, 1) * min_period_sec
824
- const max_range = get_max_range_sec_from_chart()
825
- return clamp(range_sec, min_range, max_range ?? range_sec)
826
- }
827
-
828
- function clamp_y_range_to_limits(range_y, axis) {
829
- const data_low_y = axis?.data_low_y
830
- const data_high_y = axis?.data_high_y
831
- const data_range_y = get_safe_y_range(data_low_y, data_high_y)
832
- const center_y =
833
- is_finite_num(data_low_y) && is_finite_num(data_high_y)
834
- ? (Number(data_low_y) + Number(data_high_y)) / 2
835
- : is_finite_num(data_low_y)
836
- ? Number(data_low_y)
837
- : is_finite_num(data_high_y)
838
- ? Number(data_high_y)
839
- : 0
840
- const min_range_y = Math.max(data_range_y * 0.02, Math.abs(center_y) * 0.000001, 1e-8)
841
- const max_range_y = Math.max(data_range_y * 1000, min_range_y * 10)
842
- return clamp(range_y, min_range_y, max_range_y)
843
- }
844
-
845
- function clamp_view_to_data(shown_start_x, shown_end_x) {
846
- if (!chart_prepped) return { shown_start_x, shown_end_x }
847
- const range = shown_end_x - shown_start_x
848
- if (!isFinite(range) || range <= 0) return { shown_start_x, shown_end_x }
849
- const edge_padding_sec = get_x_edge_padding_sec(range)
850
- const min_x = chart_prepped.all_data_start_x - edge_padding_sec
851
- const max_x = chart_prepped.all_data_end_x + edge_padding_sec
852
- let start = shown_start_x
853
- let end = shown_end_x
854
- if (end > max_x) {
855
- const diff = end - max_x
856
- start -= diff
857
- end -= diff
858
- }
859
- if (start < min_x) {
860
- const diff = min_x - start
861
- start += diff
862
- end += diff
863
- }
864
- if (start < min_x) start = min_x
865
- if (end > max_x) end = max_x
866
- if (end - start < 1) end = start + 1
867
- return { shown_start_x: start, shown_end_x: end }
868
- }
869
-
870
- function reset_gesture_state() {
871
- gesture_state.mode = null
872
- gesture_state.start_shown_start_x = null
873
- gesture_state.start_shown_end_x = null
874
- gesture_state.start_range_sec = null
875
- gesture_state.start_primary_x = null
876
- gesture_state.start_primary_y = null
877
- gesture_state.start_dist_px = null
878
- gesture_state.start_center_pd = null
879
- gesture_state.touch_hover_offset_x = null
880
- gesture_state.touch_hover_offset_y = null
881
- gesture_state.touch_hover_frame_index = null
882
- }
883
-
884
- function get_two_pointer_info() {
885
- const pts = [...pointer_cache.values()]
886
- if (pts.length < 2) return null
887
- const a = pts[0]
888
- const b = pts[1]
889
- const dx = b.x - a.x
890
- const dy = b.y - a.y
891
- const dist = Math.sqrt(dx * dx + dy * dy)
892
- const center_x = (a.x + b.x) / 2
893
- const center_y = (a.y + b.y) / 2
894
- return { dist, center_x, center_y }
895
- }
896
-
897
- function apply_view(shown_start_x, shown_end_x) {
898
- const clamped = clamp_view_to_data(shown_start_x, shown_end_x)
899
- chart_prepped.set_shown_start_x(clamped.shown_start_x)
900
- chart_prepped.set_shown_end_x(clamped.shown_end_x)
901
- chart_prepped = prep_chart(deep_copy(chart_prepped))
902
- }
903
-
904
- function get_chart_point_from_event(e, frame_index) {
905
- const rect = e.currentTarget?.getBoundingClientRect?.()
906
- const frame_height = chart_prepped?.frames?.[frame_index]?.frame_height
907
- const width = rect?.width || frame_width || 1
908
- const height = rect?.height || frame_height || 1
909
- const x = clamp((rect ? e.clientX - rect.left : e.offsetX) ?? 0, 0, width)
910
- const y = clamp((rect ? e.clientY - rect.top : e.offsetY) ?? 0, 0, height)
911
- return { x, y, width, height }
912
- }
913
-
914
- function clear_chart_hover(frame_index, { clear_x = true } = {}) {
915
- if (!chart_prepped) return
916
- if (clear_x) {
917
- chart_prepped.x_hovered_percent_decimal = null
918
- chart_prepped.x_axis_highlight_tic = null
919
- }
920
- const frame = chart_prepped?.frames?.[frame_index]
921
- if (!frame) return
922
- frame.y_hovered_percent_decimal = null
923
- for (let i = 0; i < frame.shared_y_axiss.length; i++) {
924
- frame.shared_y_axiss[i].y_axis_highlight_tic = null
925
- }
926
- }
927
-
928
- function clear_all_chart_hover() {
929
- if (!chart_prepped) return
930
- chart_prepped.x_hovered_percent_decimal = null
931
- chart_prepped.x_axis_highlight_tic = null
932
- for (let frame of chart_prepped?.frames ?? []) {
933
- frame.y_hovered_percent_decimal = null
934
- for (let shared_y_axis of frame?.shared_y_axiss ?? []) {
935
- shared_y_axis.y_axis_highlight_tic = null
936
- }
937
- }
938
- }
939
-
940
- function set_chart_hover(frame_index, x, y, width = frame_width, height = null) {
941
- if (!chart_prepped) return
942
- const frame = chart_prepped?.frames?.[frame_index]
943
- if (!frame) return
944
-
945
- const safe_width = Number(width) > 0 ? Number(width) : frame_width || 1
946
- const safe_height = Number(height) > 0 ? Number(height) : frame?.frame_height || 1
947
- const hover_x_pd = clamp(x / safe_width, 0, 1)
948
- const hover_y_pd = clamp((safe_height - y) / safe_height, 0, 1)
949
-
950
- chart_prepped.set_x_hovered_percent_decimal(parseFloat(hover_x_pd.toPrecision(4)))
951
-
952
- for (let i = 0; i < (chart_prepped?.frames?.length ?? 0); i++) {
953
- if (i === frame_index) continue
954
- const inactive_frame = chart_prepped.frames[i]
955
- inactive_frame.y_hovered_percent_decimal = null
956
- for (let shared_y_axis of inactive_frame?.shared_y_axiss ?? []) {
957
- shared_y_axis.y_axis_highlight_tic = null
958
- }
959
- }
960
-
961
- frame.y_hovered_percent_decimal = parseFloat(hover_y_pd.toPrecision(4))
962
-
963
- for (let i = 0; i < frame.shared_y_axiss.length; i++) {
964
- frame.shared_y_axiss[i].y_axis_highlight_tic =
965
- hover_y_pd * (frame.shared_y_axiss[i].shown_high_y - frame.shared_y_axiss[i].shown_low_y) +
966
- frame.shared_y_axiss[i].shown_low_y
967
- }
968
- }
969
-
970
- function get_current_hover_point(frame_index, width = frame_width, height = null) {
971
- if (!chart_prepped) return null
972
- const frame = chart_prepped?.frames?.[frame_index]
973
- let hover_x_pd = Number(chart_prepped?.x_hovered_percent_decimal)
974
- let hover_y_pd = Number(frame?.y_hovered_percent_decimal)
975
- if ((!Number.isFinite(hover_x_pd) || !Number.isFinite(hover_y_pd)) && touch_hover_memory.frame_index === frame_index) {
976
- hover_x_pd = Number(touch_hover_memory.x_hovered_percent_decimal)
977
- hover_y_pd = Number(touch_hover_memory.y_hovered_percent_decimal)
978
- }
979
- if (!frame || !Number.isFinite(hover_x_pd) || !Number.isFinite(hover_y_pd)) return null
980
-
981
- const safe_width = Number(width) > 0 ? Number(width) : frame_width || 1
982
- const safe_height = Number(height) > 0 ? Number(height) : frame?.frame_height || 1
983
- return {
984
- x: clamp(hover_x_pd * safe_width, 0, safe_width),
985
- y: clamp(safe_height - hover_y_pd * safe_height, 0, safe_height),
986
- width: safe_width,
987
- height: safe_height,
988
- }
989
- }
990
-
991
- function remember_touch_hover(frame_index) {
992
- touch_hover_memory.frame_index = frame_index
993
- touch_hover_memory.x_hovered_percent_decimal = chart_prepped?.x_hovered_percent_decimal ?? null
994
- touch_hover_memory.y_hovered_percent_decimal = chart_prepped?.frames?.[frame_index]?.y_hovered_percent_decimal ?? null
995
- }
996
-
997
- function restore_touch_hover_from_memory(frame_index = touch_hover_memory.frame_index) {
998
- if (!chart_prepped || !Number.isInteger(frame_index)) return false
999
-
1000
- const hover_x_pd = Number(touch_hover_memory.x_hovered_percent_decimal)
1001
- const hover_y_pd = Number(touch_hover_memory.y_hovered_percent_decimal)
1002
- const frame_height = chart_prepped?.frames?.[frame_index]?.frame_height
1003
- if (!Number.isFinite(hover_x_pd) || !Number.isFinite(hover_y_pd) || !Number.isFinite(frame_height)) return false
1004
-
1005
- const hover_x = hover_x_pd * (frame_width || 1)
1006
- const hover_y = frame_height - hover_y_pd * frame_height
1007
- set_chart_hover(frame_index, hover_x, hover_y, frame_width, frame_height)
1008
- return true
1009
- }
1010
-
1011
- function begin_touch_hover(frame_index, pointer_x, pointer_y, width = frame_width, height = null) {
1012
- const current_hover = get_current_hover_point(frame_index, width, height)
1013
- const hover_x = current_hover?.x ?? pointer_x
1014
- const hover_y = current_hover?.y ?? pointer_y
1015
-
1016
- gesture_state.touch_hover_offset_x = hover_x - pointer_x
1017
- gesture_state.touch_hover_offset_y = hover_y - pointer_y
1018
- gesture_state.touch_hover_frame_index = frame_index
1019
-
1020
- set_chart_hover(frame_index, hover_x, hover_y, width, height)
1021
- remember_touch_hover(frame_index)
1022
- }
1023
-
1024
- function update_touch_hover(frame_index, pointer_x, pointer_y, width = frame_width, height = null) {
1025
- const hover_frame_index = Number.isInteger(gesture_state.touch_hover_frame_index)
1026
- ? gesture_state.touch_hover_frame_index
1027
- : frame_index
1028
- const hover_frame_height = chart_prepped?.frames?.[hover_frame_index]?.frame_height
1029
- const safe_height = Number(height) > 0 ? Number(height) : hover_frame_height
1030
- const hover_x = pointer_x + (gesture_state.touch_hover_offset_x ?? 0)
1031
- const hover_y = pointer_y + (gesture_state.touch_hover_offset_y ?? 0)
1032
-
1033
- set_chart_hover(hover_frame_index, hover_x, hover_y, width, safe_height)
1034
- remember_touch_hover(hover_frame_index)
1035
- }
1036
-
1037
- function handle_pointer_down(e, frame_index) {
1038
- if (!chart_prepped) return
1039
- e.preventDefault()
1040
-
1041
- // keep getting moves even if finger drifts off
1042
- e.currentTarget?.setPointerCapture?.(e.pointerId)
1043
-
1044
- const point = get_chart_point_from_event(e, frame_index)
1045
- const { x, y, width, height } = point
1046
-
1047
- pointer_cache.set(e.pointerId, { x, y, frame_index, pointer_type: e.pointerType })
1048
-
1049
- if (e.pointerType !== "mouse") {
1050
- begin_touch_hover(frame_index, x, y, width, height)
1051
- }
1052
-
1053
- if (pointer_cache.size === 1) {
1054
- gesture_state.mode = "pan"
1055
- gesture_state.start_shown_start_x = chart_prepped.shown_start_x
1056
- gesture_state.start_shown_end_x = chart_prepped.shown_end_x
1057
- gesture_state.start_range_sec = chart_prepped.shown_end_x - chart_prepped.shown_start_x
1058
- gesture_state.start_primary_x = x
1059
- gesture_state.start_primary_y = y
1060
- }
1061
-
1062
- if (pointer_cache.size === 2) {
1063
- clear_all_chart_hover()
1064
- gesture_state.touch_hover_offset_x = null
1065
- gesture_state.touch_hover_offset_y = null
1066
- gesture_state.touch_hover_frame_index = null
1067
- const info = get_two_pointer_info()
1068
- if (!info) return
1069
- gesture_state.mode = "pinch"
1070
- gesture_state.start_shown_start_x = chart_prepped.shown_start_x
1071
- gesture_state.start_shown_end_x = chart_prepped.shown_end_x
1072
- gesture_state.start_range_sec = chart_prepped.shown_end_x - chart_prepped.shown_start_x
1073
- gesture_state.start_dist_px = info.dist
1074
- gesture_state.start_center_pd = frame_width ? clamp(info.center_x / frame_width, 0, 1) : 0.5
1075
- }
1076
- }
1077
-
1078
- function handle_pointer_move(e, frame_index) {
1079
- if (!chart_prepped) return
1080
- if (!pointer_cache.has(e.pointerId)) return
1081
- e.preventDefault()
1082
-
1083
- const point = get_chart_point_from_event(e, frame_index)
1084
- const { x, y, width, height } = point
1085
-
1086
- const cached_pointer = pointer_cache.get(e.pointerId)
1087
- pointer_cache.set(e.pointerId, { ...cached_pointer, x, y, frame_index, pointer_type: e.pointerType })
1088
-
1089
- if (pointer_cache.size === 1 && gesture_state.mode === "pan") {
1090
- if (e.pointerType !== "mouse") {
1091
- update_touch_hover(frame_index, x, y, width, height)
1092
- return
1093
- }
1094
-
1095
- const dx_px = x - gesture_state.start_primary_x
1096
- const start_range = gesture_state.start_range_sec
1097
- if (!frame_width || !start_range) return
1098
-
1099
- const delta_sec = (-dx_px / frame_width) * start_range
1100
- apply_view(gesture_state.start_shown_start_x + delta_sec, gesture_state.start_shown_end_x + delta_sec)
1101
- return
1102
- }
1103
-
1104
- if (pointer_cache.size >= 2) {
1105
- clear_all_chart_hover()
1106
- if (gesture_state.mode !== "pinch") {
1107
- const info0 = get_two_pointer_info()
1108
- if (!info0) return
1109
- gesture_state.mode = "pinch"
1110
- gesture_state.start_shown_start_x = chart_prepped.shown_start_x
1111
- gesture_state.start_shown_end_x = chart_prepped.shown_end_x
1112
- gesture_state.start_range_sec = chart_prepped.shown_end_x - chart_prepped.shown_start_x
1113
- gesture_state.start_dist_px = info0.dist
1114
- gesture_state.start_center_pd = frame_width ? clamp(info0.center_x / frame_width, 0, 1) : 0.5
1115
- }
1116
-
1117
- const info = get_two_pointer_info()
1118
- if (!info || !gesture_state.start_dist_px) return
1119
-
1120
- const dist_ratio = info.dist / gesture_state.start_dist_px
1121
- if (!dist_ratio || dist_ratio <= 0) return
1122
-
1123
- const start_range = gesture_state.start_range_sec
1124
- const center_pd = gesture_state.start_center_pd ?? 0.5
1125
- const start_start = gesture_state.start_shown_start_x
1126
- const center_time = start_start + center_pd * start_range
1127
-
1128
- let next_range = start_range / dist_ratio
1129
- next_range = clamp_range_to_limits(next_range)
1130
-
1131
- let next_start = center_time - center_pd * next_range
1132
- let next_end = next_start + next_range
1133
-
1134
- apply_view(next_start, next_end)
1135
- }
1136
- }
1137
-
1138
- function handle_pointer_up(e, frame_index) {
1139
- const pointer_details = pointer_cache.get(e.pointerId)
1140
- pointer_cache.delete(e.pointerId)
1141
-
1142
- if (pointer_cache.size === 0) {
1143
- if ((pointer_details?.pointer_type ?? e.pointerType) !== "mouse") {
1144
- restore_touch_hover_from_memory(pointer_details?.frame_index ?? frame_index)
1145
- }
1146
- reset_gesture_state()
1147
- return
1148
- }
1149
-
1150
- if (pointer_cache.size === 1) {
1151
- const remaining = [...pointer_cache.values()][0]
1152
- gesture_state.mode = "pan"
1153
- gesture_state.start_shown_start_x = chart_prepped?.shown_start_x
1154
- gesture_state.start_shown_end_x = chart_prepped?.shown_end_x
1155
- gesture_state.start_range_sec = chart_prepped?.shown_end_x - chart_prepped?.shown_start_x
1156
- gesture_state.start_primary_x = remaining?.x
1157
- gesture_state.start_primary_y = remaining?.y
1158
- gesture_state.start_dist_px = null
1159
- gesture_state.start_center_pd = null
1160
-
1161
- if (remaining?.pointer_type !== "mouse" && Number.isInteger(remaining?.frame_index)) {
1162
- begin_touch_hover(
1163
- remaining.frame_index,
1164
- remaining.x,
1165
- remaining.y,
1166
- frame_width,
1167
- chart_prepped?.frames?.[remaining.frame_index]?.frame_height,
1168
- )
1169
- }
1170
- }
1171
- }
1172
-
1173
- function handle_pointer_cancel(e, frame_index) {
1174
- const pointer_details = pointer_cache.get(e.pointerId)
1175
- pointer_cache.delete(e.pointerId)
1176
- if (pointer_cache.size === 0) {
1177
- if ((pointer_details?.pointer_type ?? e.pointerType) !== "mouse") {
1178
- restore_touch_hover_from_memory(pointer_details?.frame_index ?? frame_index)
1179
- }
1180
- reset_gesture_state()
1181
- return
1182
- }
1183
-
1184
- if (pointer_cache.size === 1) {
1185
- const remaining = [...pointer_cache.values()][0]
1186
- gesture_state.mode = "pan"
1187
- gesture_state.start_shown_start_x = chart_prepped?.shown_start_x
1188
- gesture_state.start_shown_end_x = chart_prepped?.shown_end_x
1189
- gesture_state.start_range_sec = chart_prepped?.shown_end_x - chart_prepped?.shown_start_x
1190
- gesture_state.start_primary_x = remaining?.x
1191
- gesture_state.start_primary_y = remaining?.y
1192
- gesture_state.start_dist_px = null
1193
- gesture_state.start_center_pd = null
1194
-
1195
- if (remaining?.pointer_type !== "mouse" && Number.isInteger(remaining?.frame_index)) {
1196
- begin_touch_hover(
1197
- remaining.frame_index,
1198
- remaining.x,
1199
- remaining.y,
1200
- frame_width,
1201
- chart_prepped?.frames?.[remaining.frame_index]?.frame_height,
1202
- )
1203
- }
1204
- }
1205
- }
1206
-
1207
- function handle_scroll_y_axis(e, frame_index) {
1208
- if (!chart_prepped) return
1209
- e.preventDefault()
1210
- e.stopPropagation()
1211
-
1212
- const { frame, axis } = get_y_axis_state(frame_index)
1213
- if (!axis) return
1214
-
1215
- const zoom_factor = get_y_axis_zoom_factor_from_wheel(e.deltaY)
1216
- if (!Number.isFinite(zoom_factor) || zoom_factor === 1) return
1217
-
1218
- const { low_y: current_low_y, high_y: current_high_y } = get_current_y_bounds(axis)
1219
- const current_range_y = current_high_y - current_low_y
1220
- if (!Number.isFinite(current_range_y) || current_range_y <= 0) return
1221
-
1222
- const rect = e.currentTarget?.getBoundingClientRect?.()
1223
- const height = rect?.height || frame?.frame_height || 1
1224
- const offset_y = rect ? e.clientY - rect.top : e.offsetY
1225
- const anchor_pd = clamp((height - offset_y) / height, 0, 1)
1226
- const anchor_y = current_low_y + anchor_pd * current_range_y
1227
-
1228
- const next_range_y = clamp_y_range_to_limits(current_range_y * zoom_factor, axis)
1229
- const next_low_y = anchor_y - anchor_pd * next_range_y
1230
- const next_high_y = next_low_y + next_range_y
1231
-
1232
- set_manual_y_bounds(axis, next_low_y, next_high_y)
1233
- }
1234
-
1235
- function reset_y_axis_gesture_state() {
1236
- y_axis_pointer_cache.clear()
1237
- y_axis_gesture_state.mode = null
1238
- y_axis_gesture_state.frame_index = null
1239
- y_axis_gesture_state.start_y = null
1240
- y_axis_gesture_state.start_dist_px = null
1241
- y_axis_gesture_state.start_range_y = null
1242
- y_axis_gesture_state.start_low_y = null
1243
- y_axis_gesture_state.start_high_y = null
1244
- y_axis_gesture_state.anchor_pd = null
1245
- y_axis_gesture_state.anchor_y = null
1246
- y_axis_gesture_state.did_drag = false
1247
- }
1248
-
1249
- function get_y_axis_point_from_event(e, frame_index) {
1250
- const { frame } = get_y_axis_state(frame_index)
1251
- const rect = e.currentTarget?.getBoundingClientRect?.()
1252
- const height = rect?.height || frame?.frame_height || 1
1253
- const y = clamp((rect ? e.clientY - rect.top : e.offsetY) ?? 0, 0, height)
1254
- const y_pd = clamp((height - y) / height, 0, 1)
1255
- return { y, y_pd, height }
1256
- }
1257
-
1258
- function get_two_y_axis_pointer_info() {
1259
- const pts = [...y_axis_pointer_cache.values()]
1260
- if (pts.length < 2) return null
1261
- const a = pts[0]
1262
- const b = pts[1]
1263
- const dist = Math.max(Math.abs(b.y - a.y), min_y_axis_pinch_dist_px)
1264
- const center_y = (a.y + b.y) / 2
1265
- const height = a.height || b.height || 1
1266
- const center_pd = clamp((height - center_y) / height, 0, 1)
1267
- return { dist, center_y, center_pd, height }
1268
- }
1269
-
1270
- function set_y_axis_gesture_baseline(frame_index, start_y, anchor_pd, axis, mode = "pan", start_dist_px = null) {
1271
- const { low_y: start_low_y, high_y: start_high_y } = get_current_y_bounds(axis)
1272
- const start_range_y = start_high_y - start_low_y
1273
- if (!Number.isFinite(start_range_y) || start_range_y <= 0) return false
1274
-
1275
- y_axis_gesture_state.mode = mode
1276
- y_axis_gesture_state.frame_index = frame_index
1277
- y_axis_gesture_state.start_y = start_y
1278
- y_axis_gesture_state.start_dist_px = start_dist_px
1279
- y_axis_gesture_state.start_range_y = start_range_y
1280
- y_axis_gesture_state.start_low_y = start_low_y
1281
- y_axis_gesture_state.start_high_y = start_high_y
1282
- y_axis_gesture_state.anchor_pd = anchor_pd
1283
- y_axis_gesture_state.anchor_y = start_low_y + anchor_pd * start_range_y
1284
- return true
1285
- }
1286
-
1287
- function handle_y_axis_pointer_down(e, frame_index) {
1288
- if (!chart_prepped || e.button > 0) return
1289
- const { frame, axis } = get_y_axis_state(frame_index)
1290
- if (!frame || !axis) return
1291
-
1292
- e.preventDefault()
1293
- e.stopPropagation()
1294
- e.currentTarget?.setPointerCapture?.(e.pointerId)
1295
-
1296
- const point = get_y_axis_point_from_event(e, frame_index)
1297
- y_axis_pointer_cache.set(e.pointerId, { y: point.y, height: point.height, frame_index })
1298
- y_axis_gesture_state.did_drag = false
1299
-
1300
- if (y_axis_pointer_cache.size >= 2) {
1301
- const info = get_two_y_axis_pointer_info()
1302
- if (!info) return
1303
- if (!set_y_axis_gesture_baseline(frame_index, info.center_y, info.center_pd, axis, "pinch", info.dist)) {
1304
- y_axis_pointer_cache.delete(e.pointerId)
1305
- }
1306
- return
1307
- }
1308
-
1309
- if (!set_y_axis_gesture_baseline(frame_index, point.y, point.y_pd, axis, "pan")) {
1310
- y_axis_pointer_cache.delete(e.pointerId)
1311
- }
1312
- }
1313
-
1314
- function handle_y_axis_pointer_move(e, frame_index) {
1315
- if (!chart_prepped) return
1316
- if (!y_axis_pointer_cache.has(e.pointerId) || y_axis_gesture_state.frame_index !== frame_index) return
1317
-
1318
- const { frame, axis } = get_y_axis_state(frame_index)
1319
- if (!frame || !axis) return
1320
-
1321
- e.preventDefault()
1322
- e.stopPropagation()
1323
-
1324
- const point = get_y_axis_point_from_event(e, frame_index)
1325
- y_axis_pointer_cache.set(e.pointerId, { y: point.y, height: point.height, frame_index })
1326
-
1327
- if (y_axis_pointer_cache.size >= 2) {
1328
- if (y_axis_gesture_state.mode !== "pinch") {
1329
- const info0 = get_two_y_axis_pointer_info()
1330
- if (!info0) return
1331
- set_y_axis_gesture_baseline(frame_index, info0.center_y, info0.center_pd, axis, "pinch", info0.dist)
1332
- }
1333
-
1334
- const info = get_two_y_axis_pointer_info()
1335
- if (!info || !y_axis_gesture_state.start_dist_px) return
1336
- if (Math.abs(info.dist - y_axis_gesture_state.start_dist_px) > 4) y_axis_gesture_state.did_drag = true
1337
-
1338
- const dist_ratio = info.dist / y_axis_gesture_state.start_dist_px
1339
- if (!Number.isFinite(dist_ratio) || dist_ratio <= 0) return
1340
-
1341
- const next_range_y = clamp_y_range_to_limits(y_axis_gesture_state.start_range_y / dist_ratio, axis)
1342
- const next_low_y = y_axis_gesture_state.anchor_y - y_axis_gesture_state.anchor_pd * next_range_y
1343
- const next_high_y = next_low_y + next_range_y
1344
-
1345
- set_manual_y_bounds(axis, next_low_y, next_high_y)
1346
- return
1347
- }
1348
-
1349
- const height = point.height
1350
- const delta_y = point.y - y_axis_gesture_state.start_y
1351
- if (Math.abs(delta_y) > 4) y_axis_gesture_state.did_drag = true
1352
- if (!Number.isFinite(height) || height <= 0 || !Number.isFinite(y_axis_gesture_state.start_range_y)) return
1353
-
1354
- const price_delta_y = (delta_y / height) * y_axis_gesture_state.start_range_y
1355
- const next_low_y = y_axis_gesture_state.start_low_y + price_delta_y
1356
- const next_high_y = y_axis_gesture_state.start_high_y + price_delta_y
1357
-
1358
- set_manual_y_bounds(axis, next_low_y, next_high_y)
1359
- }
1360
-
1361
- function handle_y_axis_pointer_up(e, frame_index) {
1362
- if (!y_axis_pointer_cache.has(e.pointerId) || y_axis_gesture_state.frame_index !== frame_index) return
1363
- e.preventDefault()
1364
- e.stopPropagation()
1365
- y_axis_pointer_cache.delete(e.pointerId)
1366
- if (y_axis_pointer_cache.size === 0) {
1367
- y_axis_gesture_state.suppress_click = y_axis_gesture_state.did_drag
1368
- reset_y_axis_gesture_state()
1369
- return
1370
- }
1371
-
1372
- const remaining = [...y_axis_pointer_cache.values()][0]
1373
- const { axis } = get_y_axis_state(remaining.frame_index)
1374
- if (axis) {
1375
- const anchor_pd = clamp((remaining.height - remaining.y) / remaining.height, 0, 1)
1376
- set_y_axis_gesture_baseline(remaining.frame_index, remaining.y, anchor_pd, axis, "pan")
1377
- }
1378
- }
1379
-
1380
- function handle_y_axis_pointer_cancel(e, frame_index) {
1381
- if (!y_axis_pointer_cache.has(e.pointerId) || y_axis_gesture_state.frame_index !== frame_index) return
1382
- e.preventDefault()
1383
- e.stopPropagation()
1384
- y_axis_pointer_cache.delete(e.pointerId)
1385
- if (y_axis_pointer_cache.size === 0) {
1386
- y_axis_gesture_state.suppress_click = y_axis_gesture_state.did_drag
1387
- reset_y_axis_gesture_state()
1388
- return
1389
- }
1390
-
1391
- const remaining = [...y_axis_pointer_cache.values()][0]
1392
- const { axis } = get_y_axis_state(remaining.frame_index)
1393
- if (axis) {
1394
- const anchor_pd = clamp((remaining.height - remaining.y) / remaining.height, 0, 1)
1395
- set_y_axis_gesture_baseline(remaining.frame_index, remaining.y, anchor_pd, axis, "pan")
1396
- }
1397
- }
1398
-
1399
- function handle_y_axis_click(frame_index) {
1400
- if (y_axis_gesture_state.suppress_click) {
1401
- y_axis_gesture_state.suppress_click = false
1402
- return
1403
- }
1404
- chart_prepped?.frames?.[frame_index]?.change_shown_y_axis?.()
1405
- }
1406
-
1407
- function handle_chart_hover(e, frame_index) {
1408
- const point = get_chart_point_from_event(e, frame_index)
1409
- set_chart_hover(frame_index, point.x, point.y, point.width, point.height)
1410
- }
1411
-
1412
- function handle_chart_hover_leave(e, frame_index) {
1413
- if (e?.relatedTarget?.closest?.(".floater")) {
1414
- clear_chart_hover(frame_index, { clear_x: false })
1415
- return
1416
- }
1417
-
1418
- clear_chart_hover(frame_index)
1419
- }
1420
-
1421
- function refresh_chart(opts = {}) {
1422
- const keep_view = typeof opts.keep_view === "boolean" ? opts.keep_view : true
1423
- if (!grid_width || !datasets) return
1424
- if (!chart_prepped) {
1425
- chart_prepped = prep_chart({ ...config?.chart })
1426
- return
1427
- }
1428
- const next_chart = { ...chart_prepped }
1429
- if (!keep_view) {
1430
- next_chart.shown_start_x = null
1431
- next_chart.shown_end_x = null
1432
- }
1433
- chart_prepped = prep_chart(next_chart)
1434
- }
1435
-
1436
- function pad2(n) {
1437
- const s = String(n)
1438
- return s.length < 2 ? "0" + s : s
1439
- }
1440
-
1441
- function readable_time_full_to_minute(seconds) {
1442
- if (seconds == null || isNaN(seconds)) return "-"
1443
- const d = new Date(seconds * 1000)
1444
- const y = d.getFullYear()
1445
- const m = pad2(d.getMonth() + 1)
1446
- const day = pad2(d.getDate())
1447
- const h = pad2(d.getHours())
1448
- const min = pad2(d.getMinutes())
1449
- return `${y}-${m}-${day} ${h}:${min}`
1450
- }
1451
-
1452
- function get_path_d(data) {
1453
- if (!Array.isArray(data) || data.length === 0) return null
1454
- let path_d = null
1455
- for (let datapoint of data) {
1456
- const x = Number(datapoint?.x)
1457
- const y = Number(datapoint?.y)
1458
- if (!Number.isFinite(x) || !Number.isFinite(y)) continue
1459
-
1460
- const point = `${(x * 100).toPrecision(4)} ${(100 - y * 100).toPrecision(4)}`
1461
- path_d = path_d == null ? `M${point}` : `${path_d} L${point}`
1462
- }
1463
- return path_d
1464
- }
1465
-
1466
- function prep_chart(input) {
1467
- if (!input || !datasets || !grid_width) {
1468
- chart_prepped = null
1469
- return
1470
- }
1471
- let id = $state(input?.id)
1472
- let x_axis_type = $state(input?.x_axis_type)
1473
- let x_axis_title = $state(input?.x_axis_title)
1474
- let shown_start_x = $state(input?.shown_start_x)
1475
- let shown_end_x = $state(input?.shown_end_x)
1476
- let frames = $state(input?.frames)
1477
- let min_x_scrollable = $state(input?.min_x_scrollable)
1478
- let max_x_scrollable = $state(input?.max_x_scrollable)
1479
- let x_axis_highlight_tic = $state(input?.x_axis_highlight_tic)
1480
- let x_hovered_percent_decimal = $state(input?.x_hovered_percent_decimal)
1481
- let all_data_start_x_loc = $state(null)
1482
- let all_data_end_x_loc = $state(null)
1483
- let most_datapoints_for_x_dataset = 0
1484
- if (Array.isArray(frames)) {
1485
- for (let frame of frames) {
1486
- if (Array.isArray(frame?.shared_y_axiss)) {
1487
- for (let shared_y_axis of frame.shared_y_axiss) {
1488
- if (Array.isArray(shared_y_axis?.datasets)) {
1489
- for (let dataset of shared_y_axis.datasets) {
1490
- let most_datapoints_for_x_dataset_loc = 0
1491
- if (
1492
- ["klines", "path", "points"].some((h) => h == dataset.type) &&
1493
- Array.isArray(datasets[dataset?.dataset_id]?.data) &&
1494
- datasets[dataset?.dataset_id]?.data.length > 0
1495
- ) {
1496
- for (let datapoint of datasets[dataset.dataset_id].data) {
1497
- most_datapoints_for_x_dataset_loc++
1498
- if (
1499
- all_data_start_x_loc == undefined ||
1500
- all_data_start_x_loc == null ||
1501
- isNaN(all_data_start_x_loc) ||
1502
- datapoint?.[dataset?.keys?.[0]] < all_data_start_x_loc
1503
- ) {
1504
- all_data_start_x_loc = datapoint?.[dataset?.keys?.[0]]
1505
- }
1506
- if (
1507
- all_data_end_x_loc == undefined ||
1508
- all_data_end_x_loc == null ||
1509
- isNaN(all_data_end_x_loc) ||
1510
- datapoint?.[dataset?.keys?.[0]] > all_data_end_x_loc
1511
- ) {
1512
- all_data_end_x_loc = datapoint?.[dataset?.keys?.[0]]
1513
- }
1514
- }
1515
- }
1516
- if (most_datapoints_for_x_dataset_loc > most_datapoints_for_x_dataset) {
1517
- most_datapoints_for_x_dataset = most_datapoints_for_x_dataset_loc
1518
- }
1519
- }
1520
- }
1521
- }
1522
- }
1523
- }
1524
- }
1525
- const x_range = all_data_end_x_loc - all_data_start_x_loc
1526
- let range_to_show = x_range
1527
- let shown_start_x_loc = all_data_start_x_loc
1528
- if (most_datapoints_for_x_dataset > 20) {
1529
- range_to_show = (x_range * range_to_show_default) / most_datapoints_for_x_dataset
1530
- shown_start_x_loc = all_data_end_x_loc - parseFloat(range_to_show.toPrecision(8))
1531
- }
1532
- // console.log("x_range0", {
1533
- // x_range,
1534
- // range_to_show,
1535
- // all_data_end_x_loc,
1536
- // all_data_start_x_loc,
1537
- // shown_start_x,
1538
- // shown_end_x,
1539
- // most_datapoints_for_x_dataset,
1540
- // })
1541
- min_x_scrollable = all_data_start_x_loc + Math.floor(range_to_show * 0.1)
1542
- max_x_scrollable = all_data_end_x_loc - Math.floor(range_to_show * 0.1)
1543
- if (shown_start_x == null || isNaN(shown_start_x)) {
1544
- shown_start_x = shown_start_x_loc
1545
- }
1546
- if (shown_end_x == null || isNaN(shown_end_x)) {
1547
- shown_end_x = all_data_end_x_loc
1548
- }
1549
- let prepped_frames = []
1550
- for (let frame of frames) {
1551
- const frame_height = frame_width / frame.aspect_ratio
1552
- let shown_y_axis_index = $state(Number.isInteger(frame?.shown_y_axis_index) ? frame.shown_y_axis_index : 0)
1553
- let prepped_shared_y_axiss = []
1554
- for (let shared_y_axis of frame.shared_y_axiss) {
1555
- let data_low_y = Infinity
1556
- let data_high_y = -Infinity
1557
- let fallback_low_y = Infinity
1558
- let fallback_high_y = -Infinity
1559
- let pre_prepped_datasets = []
1560
- function register_y_value(value, include_in_primary = true) {
1561
- if (!is_finite_num(value)) return
1562
- const safe_value = Number(value)
1563
- fallback_low_y = Math.min(fallback_low_y, safe_value)
1564
- fallback_high_y = Math.max(fallback_high_y, safe_value)
1565
- if (!include_in_primary) return
1566
- data_low_y = Math.min(data_low_y, safe_value)
1567
- data_high_y = Math.max(data_high_y, safe_value)
1568
- }
1569
- for (let dataset of shared_y_axis.datasets) {
1570
- const affects_y_scale = dataset?.affects_y_scale ?? dataset?.type !== "lines"
1571
- let shown_data = []
1572
- let d_loc = null
1573
- if (dataset.type === "klines" && dataset?.keys?.length == 5 && datasets[dataset?.dataset_id]?.data) {
1574
- for (let kline of datasets[dataset?.dataset_id]?.data) {
1575
- if (
1576
- !isNaN(kline[dataset?.keys[0]]) &&
1577
- !isNaN(kline[dataset?.keys[1]]) &&
1578
- !isNaN(kline[dataset?.keys[2]]) &&
1579
- !isNaN(kline[dataset?.keys[3]]) &&
1580
- !isNaN(kline[dataset?.keys[4]]) &&
1581
- shown_start_x <= kline[dataset?.keys[0]] &&
1582
- kline[dataset?.keys[0]] < shown_end_x
1583
- ) {
1584
- const item_to_add = {
1585
- x: kline[dataset?.keys[0]],
1586
- o: kline[dataset?.keys[1]],
1587
- l: kline[dataset?.keys[2]],
1588
- h: kline[dataset?.keys[3]],
1589
- c: kline[dataset?.keys[4]],
1590
- }
1591
- shown_data.push(item_to_add)
1592
- register_y_value(item_to_add.l, affects_y_scale)
1593
- register_y_value(item_to_add.h, affects_y_scale)
1594
- }
1595
- }
1596
- } else if (
1597
- ["points", "path"].some((h) => h == dataset.type) &&
1598
- dataset?.keys?.length == 2 &&
1599
- datasets[dataset?.dataset_id]?.data
1600
- ) {
1601
- for (let datapoint of datasets[dataset?.dataset_id]?.data) {
1602
- if (
1603
- !isNaN(datapoint[dataset?.keys[0]]) &&
1604
- !isNaN(datapoint[dataset?.keys[1]]) &&
1605
- shown_start_x <= datapoint[dataset?.keys[0]] &&
1606
- datapoint[dataset?.keys[0]] < shown_end_x
1607
- ) {
1608
- const item_to_add = {
1609
- x: datapoint[dataset?.keys[0]],
1610
- y: datapoint[dataset?.keys[1]],
1611
- }
1612
- shown_data.push(item_to_add)
1613
- register_y_value(item_to_add.y, affects_y_scale)
1614
- }
1615
- }
1616
- } else if (dataset.type == "lines" && dataset?.keys?.length > 1 && datasets[dataset?.dataset_id]?.data) {
1617
- for (let datapoint of datasets[dataset?.dataset_id]?.data) {
1618
- if (!isNaN(datapoint[dataset?.keys[0]]) && !isNaN(datapoint[dataset?.keys[1]])) {
1619
- const item_to_add = {
1620
- m: datapoint[dataset?.keys[0]],
1621
- b: datapoint[dataset?.keys[1]],
1622
- s: dataset?.keys?.length > 2 ? datapoint[dataset?.keys[2]] : null,
1623
- }
1624
- shown_data.push(item_to_add)
1625
- register_y_value(item_to_add.m * shown_start_x + item_to_add.b, affects_y_scale)
1626
- register_y_value(item_to_add.m * shown_end_x + item_to_add.b, affects_y_scale)
1627
- register_y_value(datasets[dataset?.dataset_id]?.y_min, affects_y_scale)
1628
- register_y_value(datasets[dataset?.dataset_id]?.y_max, affects_y_scale)
1629
- }
1630
- }
1631
- }
1632
- let color_one =
1633
- dataset?.colors.length > 0
1634
- ? gen_color(
1635
- dataset?.colors[0].l,
1636
- dataset?.colors[0].c,
1637
- dataset?.colors[0].h,
1638
- dataset?.colors[0].o,
1639
- dataset?.colors[0].is_theme_based,
1640
- )
1641
- : "#44ff4450"
1642
- let color_two =
1643
- dataset?.colors.length > 1
1644
- ? gen_color(
1645
- dataset?.colors[1].l,
1646
- dataset?.colors[1].c,
1647
- dataset?.colors[1].h,
1648
- dataset?.colors[1].o,
1649
- dataset?.colors[1].is_theme_based,
1650
- )
1651
- : color_one
1652
- ? color_one
1653
- : "#ff444450"
1654
- pre_prepped_datasets.push({
1655
- type: dataset.type,
1656
- data: shown_data,
1657
- dataset_id: dataset.dataset_id,
1658
- name: dataset.name,
1659
- period_x: dataset.period_x,
1660
- colors: dataset.colors,
1661
- color_one: color_one,
1662
- color_two: color_two,
1663
- d: d_loc,
1664
- keys: dataset.keys,
1665
- affects_y_scale: affects_y_scale,
1666
- })
1667
- }
1668
- if (!Number.isFinite(data_low_y) || !Number.isFinite(data_high_y)) {
1669
- data_low_y = fallback_low_y
1670
- data_high_y = fallback_high_y
1671
- }
1672
- const has_visible_y_bounds = Number.isFinite(data_low_y) && Number.isFinite(data_high_y)
1673
- if (!has_visible_y_bounds) {
1674
- data_low_y = 0
1675
- data_high_y = 1
1676
- }
1677
- const has_manual_y_bounds =
1678
- is_finite_num(shared_y_axis?.manual_low_y) &&
1679
- is_finite_num(shared_y_axis?.manual_high_y) &&
1680
- Number(shared_y_axis.manual_high_y) > Number(shared_y_axis.manual_low_y)
1681
- let shown_low_y = has_manual_y_bounds ? Number(shared_y_axis.manual_low_y) : null
1682
- let shown_high_y = has_manual_y_bounds ? Number(shared_y_axis.manual_high_y) : null
1683
- if (!has_manual_y_bounds) {
1684
- const padded_y_bounds = get_padded_y_bounds(
1685
- data_low_y,
1686
- data_high_y,
1687
- shared_y_axis.top_padding_pd,
1688
- shared_y_axis.bottom_padding_pd,
1689
- )
1690
- shown_low_y = padded_y_bounds.shown_low_y
1691
- shown_high_y = padded_y_bounds.shown_high_y
1692
- }
1693
- let shown_y_range = shown_high_y - shown_low_y
1694
- if (!Number.isFinite(shown_y_range) || shown_y_range <= 0) {
1695
- shown_y_range = get_safe_y_range(shown_low_y, shown_high_y)
1696
- shown_low_y = Number(shown_low_y) - shown_y_range / 2
1697
- shown_high_y = shown_low_y + shown_y_range
1698
- }
1699
- const shown_x_range = shown_end_x - shown_start_x
1700
- let prepped_datasets = []
1701
- for (let pre_prepped_dataset of pre_prepped_datasets) {
1702
- const kline_width_pd = (pre_prepped_dataset.period_x * 1) / shown_x_range
1703
- let normalized_datapoints_in_range_loc = []
1704
- for (let datapoint of pre_prepped_dataset.data) {
1705
- if (pre_prepped_dataset.type === "klines") {
1706
- const norm_x = (datapoint.x - shown_start_x) / shown_x_range
1707
- const norm_o = (datapoint.o - shown_low_y) / shown_y_range
1708
- const norm_l = (datapoint.l - shown_low_y) / shown_y_range
1709
- const norm_h = (datapoint.h - shown_low_y) / shown_y_range
1710
- const norm_c = (datapoint.c - shown_low_y) / shown_y_range
1711
- const norm_details = get_kline_details(norm_o, norm_l, norm_h, norm_c)
1712
- normalized_datapoints_in_range_loc.push({
1713
- x: parseFloat(norm_x.toPrecision(6)),
1714
- o: parseFloat(norm_o.toPrecision(6)),
1715
- l: parseFloat(norm_l.toPrecision(6)),
1716
- h: parseFloat(norm_h.toPrecision(6)),
1717
- c: parseFloat(norm_c.toPrecision(6)),
1718
- ...norm_details,
1719
- })
1720
- } else if (pre_prepped_dataset.type === "lines") {
1721
- let x1 = shown_start_x
1722
- let y1 = datapoint.m * x1 + datapoint.b
1723
- if (y1 < shown_low_y) {
1724
- x1 = (shown_low_y - datapoint.b) / datapoint.m
1725
- y1 = shown_low_y
1726
- } else if (y1 > shown_high_y) {
1727
- x1 = (shown_high_y - datapoint.b) / datapoint.m
1728
- y1 = shown_high_y
1729
- }
1730
- let x2 = shown_end_x
1731
- let y2 = datapoint.m * x2 + datapoint.b
1732
- if (y2 < shown_low_y) {
1733
- x2 = (shown_low_y - datapoint.b) / datapoint.m
1734
- y2 = shown_low_y
1735
- } else if (y2 > shown_high_y) {
1736
- x2 = (shown_high_y - datapoint.b) / datapoint.m
1737
- y2 = shown_high_y
1738
- }
1739
- const norm_y1 = (y1 - shown_low_y) / shown_y_range
1740
- const norm_y2 = (y2 - shown_low_y) / shown_y_range
1741
- const norm_x1 = (x1 - shown_start_x) / shown_x_range
1742
- const norm_x2 = (x2 - shown_start_x) / shown_x_range
1743
- normalized_datapoints_in_range_loc.push({
1744
- x1: parseFloat(norm_x1.toPrecision(6)),
1745
- y1: parseFloat(norm_y1.toPrecision(6)),
1746
- x2: parseFloat(norm_x2.toPrecision(6)),
1747
- y2: parseFloat(norm_y2.toPrecision(6)),
1748
- s: datapoint?.s,
1749
- })
1750
- } else {
1751
- const norm_x = (datapoint.x - shown_start_x) / shown_x_range
1752
- const norm_y = (datapoint.y - shown_low_y) / shown_y_range
1753
- normalized_datapoints_in_range_loc.push({
1754
- x: parseFloat(norm_x.toPrecision(6)),
1755
- y: parseFloat(norm_y.toPrecision(6)),
1756
- })
1757
- }
1758
- }
1759
- const d_loc_normalized =
1760
- pre_prepped_dataset.type === "path" ? get_path_d(normalized_datapoints_in_range_loc) : pre_prepped_dataset.d
1761
- pre_prepped_dataset.data = normalized_datapoints_in_range_loc
1762
- pre_prepped_dataset.d = d_loc_normalized
1763
- prepped_datasets.push({
1764
- ...pre_prepped_dataset,
1765
- kline_width_pd: parseFloat(kline_width_pd.toPrecision(8)),
1766
- })
1767
- }
1768
- const y_tics = prep_y_axis(shown_low_y, shown_high_y, frame_height)
1769
- prepped_shared_y_axiss.push({
1770
- bottom_padding_pd: shared_y_axis.bottom_padding_pd,
1771
- top_padding_pd: shared_y_axis.top_padding_pd,
1772
- y_axis_title: shared_y_axis.y_axis_title,
1773
- y_axis_type: shared_y_axis.y_axis_type,
1774
- data_low_y: parseFloat(data_low_y.toPrecision(8)),
1775
- data_high_y: parseFloat(data_high_y.toPrecision(8)),
1776
- manual_low_y: has_manual_y_bounds ? parseFloat(Number(shared_y_axis.manual_low_y).toPrecision(10)) : null,
1777
- manual_high_y: has_manual_y_bounds ? parseFloat(Number(shared_y_axis.manual_high_y).toPrecision(10)) : null,
1778
- shown_low_y: parseFloat(shown_low_y.toPrecision(8)),
1779
- shown_high_y: parseFloat(shown_high_y.toPrecision(8)),
1780
- y_axis_tics: y_tics,
1781
- y_axis_highlight_tic: null,
1782
- datasets: prepped_datasets,
1783
- })
1784
- }
1785
- function change_shown_y_axis() {
1786
- shown_y_axis_index = shown_y_axis_index < frame?.shared_y_axiss.length - 1 ? shown_y_axis_index + 1 : 0
1787
- }
1788
- prepped_frames.push({
1789
- get aspect_ratio() {
1790
- return frame.aspect_ratio
1791
- },
1792
- get frame_height() {
1793
- return frame_height
1794
- },
1795
- get shared_y_axiss() {
1796
- return prepped_shared_y_axiss
1797
- },
1798
- get shown_y_axis_index() {
1799
- return shown_y_axis_index
1800
- },
1801
- y_hovered_percent_decimal: null,
1802
- change_shown_y_axis,
1803
- })
1804
- }
1805
- frames = prepped_frames
1806
- let x_axis_tics = prep_x_axis(shown_start_x, shown_end_x, frame_width)
1807
- function set_shown_start_x(input) {
1808
- shown_start_x = input
1809
- }
1810
- function set_shown_end_x(input) {
1811
- shown_end_x = input
1812
- }
1813
- function set_x_hovered_percent_decimal(input) {
1814
- x_hovered_percent_decimal = input
1815
- const hover_x_sec = input * (shown_end_x - shown_start_x) + shown_start_x
1816
- const hover_x_min_sec = Math.round(hover_x_sec / 60) * 60
1817
- x_axis_highlight_tic = readable_time_full_to_minute(hover_x_min_sec)
1818
- }
1819
- return {
1820
- get id() {
1821
- return id
1822
- },
1823
- get x_axis_type() {
1824
- return x_axis_type
1825
- },
1826
- get x_axis_title() {
1827
- return x_axis_title
1828
- },
1829
- get shown_start_x() {
1830
- return shown_start_x
1831
- },
1832
- get shown_end_x() {
1833
- return shown_end_x
1834
- },
1835
- get all_data_start_x() {
1836
- return all_data_start_x_loc
1837
- },
1838
- get all_data_end_x() {
1839
- return all_data_end_x_loc
1840
- },
1841
- get frames() {
1842
- return frames
1843
- },
1844
- get min_x_scrollable() {
1845
- return min_x_scrollable
1846
- },
1847
- get max_x_scrollable() {
1848
- return max_x_scrollable
1849
- },
1850
- get x_axis_tics() {
1851
- return x_axis_tics
1852
- },
1853
- get x_axis_highlight_tic() {
1854
- return x_axis_highlight_tic
1855
- },
1856
- get x_hovered_percent_decimal() {
1857
- return x_hovered_percent_decimal
1858
- },
1859
- set_shown_start_x,
1860
- set_shown_end_x,
1861
- set_x_hovered_percent_decimal,
1862
- }
1863
- }
1864
-
1865
- function set_datasets(input) {
1866
- datasets = input
1867
- }
1868
-
1869
- function init(config) {
1870
- range_to_show_default = config?.range_to_show_default ?? 500
1871
- min_visible_bars = config?.min_visible_bars ?? 20
1872
- x_edge_padding_ratio = config?.x_edge_padding_ratio ?? 0.5
1873
- datasets = config?.datasets
1874
- chart_prepped = prep_chart({ ...config?.chart })
1875
- }
1876
-
1877
- init(config)
1878
-
1879
- return {
1880
- get datasets() {
1881
- return datasets
1882
- },
1883
- get chart_prepped() {
1884
- return chart_prepped
1885
- },
1886
- get y_axis_width() {
1887
- return y_axis_width
1888
- },
1889
- get x_axis_height() {
1890
- return x_axis_height
1891
- },
1892
- get grid_width() {
1893
- return grid_width
1894
- },
1895
- get frame_width() {
1896
- return frame_width
1897
- },
1898
- period_to_sec,
1899
- handle_scroll_frame,
1900
- handle_pointer_down,
1901
- handle_pointer_move,
1902
- handle_pointer_up,
1903
- handle_pointer_cancel,
1904
- handle_y_axis_pointer_down,
1905
- handle_y_axis_pointer_move,
1906
- handle_y_axis_pointer_up,
1907
- handle_y_axis_pointer_cancel,
1908
- handle_y_axis_click,
1909
- handle_scroll_y_axis,
1910
- handle_chart_hover,
1911
- handle_chart_hover_leave,
1912
- set_grid_width,
1913
- gen_color,
1914
- set_datasets,
1915
- refresh_chart,
1916
- }
1917
- }