@streamscloud/embeddable 1.1.2

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 (337) hide show
  1. package/README.md +1 -0
  2. package/dist/advertising/ad-view/cmp.ad-view.svelte +82 -0
  3. package/dist/advertising/ad-view/cmp.ad-view.svelte.d.ts +8 -0
  4. package/dist/advertising/ad-view/index.d.ts +2 -0
  5. package/dist/advertising/ad-view/index.js +1 -0
  6. package/dist/advertising/ad-view/mapper.d.ts +3 -0
  7. package/dist/advertising/ad-view/mapper.js +16 -0
  8. package/dist/advertising/ad-view/operations.generated.d.ts +17 -0
  9. package/dist/advertising/ad-view/operations.generated.js +46 -0
  10. package/dist/advertising/ad-view/operations.graphql +14 -0
  11. package/dist/advertising/ad-view/types.d.ts +10 -0
  12. package/dist/advertising/ad-view/types.js +1 -0
  13. package/dist/advertising/index.d.ts +1 -0
  14. package/dist/advertising/index.js +1 -0
  15. package/dist/advertising/types.d.ts +5 -0
  16. package/dist/advertising/types.js +6 -0
  17. package/dist/core/continuation-token.d.ts +10 -0
  18. package/dist/core/continuation-token.js +32 -0
  19. package/dist/core/cursor-result.d.ts +9 -0
  20. package/dist/core/cursor-result.js +1 -0
  21. package/dist/core/data-loaders/cursor-data-loader.svelte.d.ts +14 -0
  22. package/dist/core/data-loaders/cursor-data-loader.svelte.js +35 -0
  23. package/dist/core/data-loaders/data-loader.d.ts +4 -0
  24. package/dist/core/data-loaders/data-loader.js +1 -0
  25. package/dist/core/data-loaders/index.d.ts +2 -0
  26. package/dist/core/data-loaders/index.js +1 -0
  27. package/dist/core/deferred.d.ts +6 -0
  28. package/dist/core/deferred.js +13 -0
  29. package/dist/core/graphql.d.ts +1 -0
  30. package/dist/core/graphql.js +10 -0
  31. package/dist/core/media/image-helper.d.ts +10 -0
  32. package/dist/core/media/image-helper.js +30 -0
  33. package/dist/core/media/images-size-detector.service.d.ts +6 -0
  34. package/dist/core/media/images-size-detector.service.js +15 -0
  35. package/dist/core/media/index.d.ts +4 -0
  36. package/dist/core/media/index.js +4 -0
  37. package/dist/core/media/media-item-url.service.d.ts +2 -0
  38. package/dist/core/media/media-item-url.service.js +2 -0
  39. package/dist/core/media/types.d.ts +28 -0
  40. package/dist/core/media/types.js +19 -0
  41. package/dist/core/toastr.d.ts +1 -0
  42. package/dist/core/toastr.js +26 -0
  43. package/dist/core/transitions/index.d.ts +1 -0
  44. package/dist/core/transitions/index.js +1 -0
  45. package/dist/core/transitions/slide-horizontally.d.ts +7 -0
  46. package/dist/core/transitions/slide-horizontally.js +55 -0
  47. package/dist/core/utils/array-helper.d.ts +23 -0
  48. package/dist/core/utils/array-helper.js +148 -0
  49. package/dist/core/utils/date-helper.d.ts +29 -0
  50. package/dist/core/utils/date-helper.js +146 -0
  51. package/dist/core/utils/dom-helper.d.ts +12 -0
  52. package/dist/core/utils/dom-helper.js +76 -0
  53. package/dist/core/utils/html-helper.d.ts +40 -0
  54. package/dist/core/utils/html-helper.js +97 -0
  55. package/dist/core/utils/index.d.ts +3 -0
  56. package/dist/core/utils/index.js +3 -0
  57. package/dist/core/utils/number-helper.d.ts +6 -0
  58. package/dist/core/utils/number-helper.js +28 -0
  59. package/dist/core/utils/string-generator.d.ts +2 -0
  60. package/dist/core/utils/string-generator.js +15 -0
  61. package/dist/core/utils/string-helper.d.ts +10 -0
  62. package/dist/core/utils/string-helper.js +53 -0
  63. package/dist/core/utils/url-helper.d.ts +3 -0
  64. package/dist/core/utils/url-helper.js +13 -0
  65. package/dist/core/utils/utils.d.ts +28 -0
  66. package/dist/core/utils/utils.js +100 -0
  67. package/dist/index.d.ts +4 -0
  68. package/dist/index.js +4 -0
  69. package/dist/products/index.d.ts +1 -0
  70. package/dist/products/index.js +1 -0
  71. package/dist/products/price-helper.d.ts +4 -0
  72. package/dist/products/price-helper.js +36 -0
  73. package/dist/products/product-card/cmp.product-card.svelte +121 -0
  74. package/dist/products/product-card/cmp.product-card.svelte.d.ts +10 -0
  75. package/dist/products/product-card/index.d.ts +3 -0
  76. package/dist/products/product-card/index.js +3 -0
  77. package/dist/products/product-card/mapper.d.ts +3 -0
  78. package/dist/products/product-card/mapper.js +14 -0
  79. package/dist/products/product-card/operations.generated.d.ts +22 -0
  80. package/dist/products/product-card/operations.generated.js +65 -0
  81. package/dist/products/product-card/operations.graphql +19 -0
  82. package/dist/products/product-card/product-card-localization.svelte.d.ts +7 -0
  83. package/dist/products/product-card/product-card-localization.svelte.js +11 -0
  84. package/dist/products/product-card/types.d.ts +10 -0
  85. package/dist/products/product-card/types.js +1 -0
  86. package/dist/products/types.d.ts +5 -0
  87. package/dist/products/types.js +6 -0
  88. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte +71 -0
  89. package/dist/short-videos/short-video-viewer/cmp.attachments.svelte.d.ts +7 -0
  90. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte +145 -0
  91. package/dist/short-videos/short-video-viewer/cmp.short-video-details.svelte.d.ts +10 -0
  92. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte +86 -0
  93. package/dist/short-videos/short-video-viewer/cmp.short-video-heading.svelte.d.ts +9 -0
  94. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte +133 -0
  95. package/dist/short-videos/short-video-viewer/cmp.short-video-viewer.svelte.d.ts +12 -0
  96. package/dist/short-videos/short-video-viewer/description.svelte +46 -0
  97. package/dist/short-videos/short-video-viewer/description.svelte.d.ts +9 -0
  98. package/dist/short-videos/short-video-viewer/index.d.ts +6 -0
  99. package/dist/short-videos/short-video-viewer/index.js +4 -0
  100. package/dist/short-videos/short-video-viewer/mapper.d.ts +3 -0
  101. package/dist/short-videos/short-video-viewer/mapper.js +28 -0
  102. package/dist/short-videos/short-video-viewer/operations.generated.d.ts +56 -0
  103. package/dist/short-videos/short-video-viewer/operations.generated.js +187 -0
  104. package/dist/short-videos/short-video-viewer/operations.graphql +26 -0
  105. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.d.ts +14 -0
  106. package/dist/short-videos/short-video-viewer/short-video-details-localization.svelte.js +21 -0
  107. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.d.ts +10 -0
  108. package/dist/short-videos/short-video-viewer/short-video-viewer-localization.svelte.js +13 -0
  109. package/dist/short-videos/short-video-viewer/types.d.ts +17 -0
  110. package/dist/short-videos/short-video-viewer/types.js +1 -0
  111. package/dist/short-videos/short-video-viewer/ui-manager.svelte.d.ts +12 -0
  112. package/dist/short-videos/short-video-viewer/ui-manager.svelte.js +26 -0
  113. package/dist/short-videos/short-videos-player/action-button.svelte +38 -0
  114. package/dist/short-videos/short-videos-player/action-button.svelte.d.ts +10 -0
  115. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +91 -0
  116. package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +13 -0
  117. package/dist/short-videos/short-videos-player/controls.svelte +215 -0
  118. package/dist/short-videos/short-videos-player/controls.svelte.d.ts +15 -0
  119. package/dist/short-videos/short-videos-player/index.d.ts +2 -0
  120. package/dist/short-videos/short-videos-player/index.js +1 -0
  121. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.d.ts +14 -0
  122. package/dist/short-videos/short-videos-player/short-videos-player-localization.svelte.js +21 -0
  123. package/dist/short-videos/short-videos-player/ui-manager.svelte.d.ts +16 -0
  124. package/dist/short-videos/short-videos-player/ui-manager.svelte.js +25 -0
  125. package/dist/short-videos/short-videos-player-modal/cmp.short-videos-player-modal.svelte +485 -0
  126. package/dist/short-videos/short-videos-player-modal/cmp.short-videos-player-modal.svelte.d.ts +3 -0
  127. package/dist/short-videos/short-videos-player-modal/index.d.ts +79 -0
  128. package/dist/short-videos/short-videos-player-modal/index.js +78 -0
  129. package/dist/short-videos/short-videos-player-modal/short-videos-player-modal-state.svelte.d.ts +16 -0
  130. package/dist/short-videos/short-videos-player-modal/short-videos-player-modal-state.svelte.js +13 -0
  131. package/dist/streams/components/cmp.stream-page-component.svelte +16 -0
  132. package/dist/streams/components/cmp.stream-page-component.svelte.d.ts +10 -0
  133. package/dist/streams/components/components.factory.d.ts +22 -0
  134. package/dist/streams/components/components.factory.js +34 -0
  135. package/dist/streams/components/images/cmp.images-component.svelte +7 -0
  136. package/dist/streams/components/images/cmp.images-component.svelte.d.ts +7 -0
  137. package/dist/streams/components/images/index.d.ts +2 -0
  138. package/dist/streams/components/images/index.js +1 -0
  139. package/dist/streams/components/images/types.d.ts +8 -0
  140. package/dist/streams/components/images/types.js +5 -0
  141. package/dist/streams/components/index.d.ts +7 -0
  142. package/dist/streams/components/index.js +6 -0
  143. package/dist/streams/components/mapper.d.ts +3 -0
  144. package/dist/streams/components/mapper.js +43 -0
  145. package/dist/streams/components/operations.generated.d.ts +178 -0
  146. package/dist/streams/components/operations.generated.js +653 -0
  147. package/dist/streams/components/operations.graphql +35 -0
  148. package/dist/streams/components/product/cmp.product-component.svelte +148 -0
  149. package/dist/streams/components/product/cmp.product-component.svelte.d.ts +8 -0
  150. package/dist/streams/components/product/index.d.ts +3 -0
  151. package/dist/streams/components/product/index.js +2 -0
  152. package/dist/streams/components/product/mapper.d.ts +3 -0
  153. package/dist/streams/components/product/mapper.js +14 -0
  154. package/dist/streams/components/product/operations.generated.d.ts +22 -0
  155. package/dist/streams/components/product/operations.generated.js +53 -0
  156. package/dist/streams/components/product/operations.graphql +19 -0
  157. package/dist/streams/components/product/types.d.ts +10 -0
  158. package/dist/streams/components/product/types.js +1 -0
  159. package/dist/streams/components/short-video/cmp.short-video-component.svelte +9 -0
  160. package/dist/streams/components/short-video/cmp.short-video-component.svelte.d.ts +10 -0
  161. package/dist/streams/components/short-video/index.d.ts +3 -0
  162. package/dist/streams/components/short-video/index.js +2 -0
  163. package/dist/streams/components/short-video/mapper.d.ts +3 -0
  164. package/dist/streams/components/short-video/mapper.js +4 -0
  165. package/dist/streams/components/short-video/operations.generated.d.ts +56 -0
  166. package/dist/streams/components/short-video/operations.generated.js +193 -0
  167. package/dist/streams/components/short-video/operations.graphql +3 -0
  168. package/dist/streams/components/short-video/types.d.ts +2 -0
  169. package/dist/streams/components/short-video/types.js +1 -0
  170. package/dist/streams/components/stream-components-localization.svelte.d.ts +10 -0
  171. package/dist/streams/components/stream-components-localization.svelte.js +13 -0
  172. package/dist/streams/components/types.d.ts +27 -0
  173. package/dist/streams/components/types.js +6 -0
  174. package/dist/streams/slots/cmp.stream-component-slot.svelte +35 -0
  175. package/dist/streams/slots/cmp.stream-component-slot.svelte.d.ts +9 -0
  176. package/dist/streams/slots/index.d.ts +3 -0
  177. package/dist/streams/slots/index.js +2 -0
  178. package/dist/streams/slots/mapper.d.ts +3 -0
  179. package/dist/streams/slots/mapper.js +18 -0
  180. package/dist/streams/slots/operations.generated.d.ts +17 -0
  181. package/dist/streams/slots/operations.generated.js +34 -0
  182. package/dist/streams/slots/operations.graphql +14 -0
  183. package/dist/streams/slots/styles-transformer.d.ts +6 -0
  184. package/dist/streams/slots/styles-transformer.js +12 -0
  185. package/dist/streams/slots/types.d.ts +16 -0
  186. package/dist/streams/slots/types.js +1 -0
  187. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte +47 -0
  188. package/dist/streams/stream-page-viewer/cmp.stream-page-viewer.svelte.d.ts +9 -0
  189. package/dist/streams/stream-page-viewer/index.d.ts +2 -0
  190. package/dist/streams/stream-page-viewer/index.js +1 -0
  191. package/dist/streams/stream-page-viewer/mapper.d.ts +3 -0
  192. package/dist/streams/stream-page-viewer/mapper.js +23 -0
  193. package/dist/streams/stream-page-viewer/operations.generated.d.ts +113 -0
  194. package/dist/streams/stream-page-viewer/operations.generated.js +400 -0
  195. package/dist/streams/stream-page-viewer/operations.graphql +13 -0
  196. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.d.ts +10 -0
  197. package/dist/streams/stream-page-viewer/stream-page-viewer-localization.svelte.js +13 -0
  198. package/dist/streams/stream-page-viewer/types.d.ts +18 -0
  199. package/dist/streams/stream-page-viewer/types.js +1 -0
  200. package/dist/streams/stream-player/action-button.svelte +38 -0
  201. package/dist/streams/stream-player/action-button.svelte.d.ts +10 -0
  202. package/dist/streams/stream-player/cmp.stream-player.svelte +141 -0
  203. package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +16 -0
  204. package/dist/streams/stream-player/controls.svelte +222 -0
  205. package/dist/streams/stream-player/controls.svelte.d.ts +14 -0
  206. package/dist/streams/stream-player/index.d.ts +2 -0
  207. package/dist/streams/stream-player/index.js +1 -0
  208. package/dist/streams/stream-player/mapper.d.ts +3 -0
  209. package/dist/streams/stream-player/mapper.js +15 -0
  210. package/dist/streams/stream-player/operations.generated.d.ts +161 -0
  211. package/dist/streams/stream-player/operations.generated.js +559 -0
  212. package/dist/streams/stream-player/operations.graphql +32 -0
  213. package/dist/streams/stream-player/stream-overview.svelte +239 -0
  214. package/dist/streams/stream-player/stream-overview.svelte.d.ts +17 -0
  215. package/dist/streams/stream-player/stream-player-buffer.svelte.d.ts +25 -0
  216. package/dist/streams/stream-player/stream-player-buffer.svelte.js +84 -0
  217. package/dist/streams/stream-player/stream-player-localization.svelte.d.ts +18 -0
  218. package/dist/streams/stream-player/stream-player-localization.svelte.js +29 -0
  219. package/dist/streams/stream-player/types.d.ts +12 -0
  220. package/dist/streams/stream-player/types.js +1 -0
  221. package/dist/streams/stream-player/ui-manager.svelte.d.ts +17 -0
  222. package/dist/streams/stream-player/ui-manager.svelte.js +26 -0
  223. package/dist/streams/stream-player-modal/cmp.stream-player-modal.svelte +486 -0
  224. package/dist/streams/stream-player-modal/cmp.stream-player-modal.svelte.d.ts +3 -0
  225. package/dist/streams/stream-player-modal/index.d.ts +79 -0
  226. package/dist/streams/stream-player-modal/index.js +78 -0
  227. package/dist/streams/stream-player-modal/stream-player-modal-state.svelte.d.ts +17 -0
  228. package/dist/streams/stream-player-modal/stream-player-modal-state.svelte.js +14 -0
  229. package/dist/ui/button/cmp.button.svelte +10 -0
  230. package/dist/ui/button/cmp.button.svelte.d.ts +16 -0
  231. package/dist/ui/button/index.d.ts +2 -0
  232. package/dist/ui/button/index.js +2 -0
  233. package/dist/ui/button/resources/button-base.svelte +84 -0
  234. package/dist/ui/button/resources/button-base.svelte.d.ts +13 -0
  235. package/dist/ui/button/resources/button-theme.svelte +204 -0
  236. package/dist/ui/button/resources/button-theme.svelte.d.ts +10 -0
  237. package/dist/ui/button/resources/button-types.d.ts +21 -0
  238. package/dist/ui/button/resources/button-types.js +23 -0
  239. package/dist/ui/dynamic-component/cmp.dynamic-component.svelte +5 -0
  240. package/dist/ui/dynamic-component/cmp.dynamic-component.svelte.d.ts +7 -0
  241. package/dist/ui/dynamic-component/index.d.ts +2 -0
  242. package/dist/ui/dynamic-component/index.js +2 -0
  243. package/dist/ui/dynamic-component/types.svelte.d.ts +11 -0
  244. package/dist/ui/dynamic-component/types.svelte.js +13 -0
  245. package/dist/ui/icon/cmp.icon.svelte +113 -0
  246. package/dist/ui/icon/cmp.icon.svelte.d.ts +8 -0
  247. package/dist/ui/icon/index.d.ts +2 -0
  248. package/dist/ui/icon/index.js +2 -0
  249. package/dist/ui/icon/types.d.ts +9 -0
  250. package/dist/ui/icon/types.js +10 -0
  251. package/dist/ui/image/cmp.image-round.svelte +41 -0
  252. package/dist/ui/image/cmp.image-round.svelte.d.ts +11 -0
  253. package/dist/ui/image/cmp.image-rounded.svelte +71 -0
  254. package/dist/ui/image/cmp.image-rounded.svelte.d.ts +11 -0
  255. package/dist/ui/image/cmp.image-stub.svelte +34 -0
  256. package/dist/ui/image/cmp.image-stub.svelte.d.ts +18 -0
  257. package/dist/ui/image/cmp.image.svelte +82 -0
  258. package/dist/ui/image/cmp.image.svelte.d.ts +13 -0
  259. package/dist/ui/image/image-state.d.ts +6 -0
  260. package/dist/ui/image/image-state.js +17 -0
  261. package/dist/ui/image/index.d.ts +4 -0
  262. package/dist/ui/image/index.js +4 -0
  263. package/dist/ui/infinite-scrolling/cmp.infinite-scrolling.svelte +84 -0
  264. package/dist/ui/infinite-scrolling/cmp.infinite-scrolling.svelte.d.ts +11 -0
  265. package/dist/ui/infinite-scrolling/index.d.ts +1 -0
  266. package/dist/ui/infinite-scrolling/index.js +1 -0
  267. package/dist/ui/line-clamp/cmp.line-clamp.svelte +89 -0
  268. package/dist/ui/line-clamp/cmp.line-clamp.svelte.d.ts +12 -0
  269. package/dist/ui/line-clamp/index.d.ts +2 -0
  270. package/dist/ui/line-clamp/index.js +2 -0
  271. package/dist/ui/line-clamp/line-clamp-localization.svelte.d.ts +9 -0
  272. package/dist/ui/line-clamp/line-clamp-localization.svelte.js +15 -0
  273. package/dist/ui/line-clamp/line-clamp-types.d.ts +3 -0
  274. package/dist/ui/line-clamp/line-clamp-types.js +1 -0
  275. package/dist/ui/line-clamp/line-clamp-utils.d.ts +8 -0
  276. package/dist/ui/line-clamp/line-clamp-utils.js +33 -0
  277. package/dist/ui/loading/cmp.loading.svelte +97 -0
  278. package/dist/ui/loading/cmp.loading.svelte.d.ts +9 -0
  279. package/dist/ui/loading/index.d.ts +1 -0
  280. package/dist/ui/loading/index.js +1 -0
  281. package/dist/ui/media-item-view/cmp.media-item-view.svelte +90 -0
  282. package/dist/ui/media-item-view/cmp.media-item-view.svelte.d.ts +12 -0
  283. package/dist/ui/media-item-view/index.d.ts +1 -0
  284. package/dist/ui/media-item-view/index.js +1 -0
  285. package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte +277 -0
  286. package/dist/ui/media-items-gallery/cmp.media-items-gallery.svelte.d.ts +12 -0
  287. package/dist/ui/media-items-gallery/index.d.ts +1 -0
  288. package/dist/ui/media-items-gallery/index.js +1 -0
  289. package/dist/ui/media-items-gallery/types.d.ts +12 -0
  290. package/dist/ui/media-items-gallery/types.js +35 -0
  291. package/dist/ui/media-playback/index.d.ts +2 -0
  292. package/dist/ui/media-playback/index.js +2 -0
  293. package/dist/ui/media-playback/playback-manager.svelte.d.ts +25 -0
  294. package/dist/ui/media-playback/playback-manager.svelte.js +62 -0
  295. package/dist/ui/media-playback/volume-manager.svelte.d.ts +10 -0
  296. package/dist/ui/media-playback/volume-manager.svelte.js +27 -0
  297. package/dist/ui/player/cmp.player-slider.svelte +161 -0
  298. package/dist/ui/player/cmp.player-slider.svelte.d.ts +33 -0
  299. package/dist/ui/player/index.d.ts +4 -0
  300. package/dist/ui/player/index.js +3 -0
  301. package/dist/ui/player/player-buffer.svelte.d.ts +28 -0
  302. package/dist/ui/player/player-buffer.svelte.js +64 -0
  303. package/dist/ui/player/prevent-slider-scroll.d.ts +5 -0
  304. package/dist/ui/player/prevent-slider-scroll.js +11 -0
  305. package/dist/ui/player/types.d.ts +14 -0
  306. package/dist/ui/player/types.js +1 -0
  307. package/dist/ui/progress/cmp.progress.svelte +37 -0
  308. package/dist/ui/progress/cmp.progress.svelte.d.ts +6 -0
  309. package/dist/ui/progress/index.d.ts +1 -0
  310. package/dist/ui/progress/index.js +1 -0
  311. package/dist/ui/proportional-container/cmp.proportional-container.svelte +39 -0
  312. package/dist/ui/proportional-container/cmp.proportional-container.svelte.d.ts +8 -0
  313. package/dist/ui/proportional-container/index.d.ts +1 -0
  314. package/dist/ui/proportional-container/index.js +1 -0
  315. package/dist/ui/seek-bar/cmp.seek-bar.svelte +63 -0
  316. package/dist/ui/seek-bar/cmp.seek-bar.svelte.d.ts +12 -0
  317. package/dist/ui/seek-bar/index.d.ts +1 -0
  318. package/dist/ui/seek-bar/index.js +1 -0
  319. package/dist/ui/shadow-dom/cmp.shadow-dom.svelte +26 -0
  320. package/dist/ui/shadow-dom/cmp.shadow-dom.svelte.d.ts +7 -0
  321. package/dist/ui/shadow-dom/index.d.ts +1 -0
  322. package/dist/ui/shadow-dom/index.js +1 -0
  323. package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte +120 -0
  324. package/dist/ui/spotlight-layout/cmp.spotlight-layout.svelte.d.ts +18 -0
  325. package/dist/ui/spotlight-layout/index.d.ts +1 -0
  326. package/dist/ui/spotlight-layout/index.js +1 -0
  327. package/dist/ui/time-ago/cmp.time-ago.svelte +69 -0
  328. package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +9 -0
  329. package/dist/ui/time-ago/index.d.ts +2 -0
  330. package/dist/ui/time-ago/index.js +1 -0
  331. package/dist/ui/time-ago/time-ago-localization.svelte.d.ts +21 -0
  332. package/dist/ui/time-ago/time-ago-localization.svelte.js +39 -0
  333. package/dist/ui/video/cmp.video.svelte +377 -0
  334. package/dist/ui/video/cmp.video.svelte.d.ts +24 -0
  335. package/dist/ui/video/index.d.ts +1 -0
  336. package/dist/ui/video/index.js +1 -0
  337. package/package.json +89 -0
@@ -0,0 +1,23 @@
1
+ export declare class ArrayHelper {
2
+ static distinct<T>(items: T[]): T[];
3
+ static distinctBy<T>(items: T[], keyFn: (elem: T) => unknown): T[];
4
+ static intersect<T>(arrays: T[][]): T[];
5
+ static assertHasValue<T>(value: T | null | undefined): value is T;
6
+ /**
7
+ * Find position ("from" and "to" indexes) of the element that was moved inside array (only one element should be moved)
8
+ */
9
+ static findMovedElement(initial: unknown[], modified: unknown[]): {
10
+ from: number;
11
+ to: number;
12
+ } | undefined;
13
+ static moveArrayItem<T>(arr: T[], from: number, to: number): T[];
14
+ static replaceArrayItem<T>(arr: T[], originalItem: T, newItem: T): T[];
15
+ static randomElement<T>(arr: T[]): T;
16
+ static randomElements<T>(arr: T[], count: number): T[];
17
+ static sortArray<T>(array: T[], propertyFunc: (elem: T) => unknown): T[];
18
+ static sortArrayDescending<T>(array: T[], propertyFunc: (elem: T) => unknown): T[];
19
+ static groupBy<T>(array: T[], keyResolver: (elem: T) => string): Record<string, T[]>;
20
+ static repeat<T>(itemFn: (i: number) => T, length: number): T[];
21
+ static areEqual<T>(array1?: T[] | null, array2?: T[] | null): boolean;
22
+ private static sortArrayInternal;
23
+ }
@@ -0,0 +1,148 @@
1
+ export class ArrayHelper {
2
+ static distinct(items) {
3
+ return Array.from(new Set(items));
4
+ }
5
+ static distinctBy(items, keyFn) {
6
+ return Array.from(new Map(items.map((item) => [keyFn(item), item])).values());
7
+ }
8
+ static intersect(arrays) {
9
+ if (!arrays?.length) {
10
+ return [];
11
+ }
12
+ return arrays.reduce((result, current) => result.filter((item) => current.includes(item)));
13
+ }
14
+ static assertHasValue(value) {
15
+ return value !== null && value !== undefined;
16
+ }
17
+ /**
18
+ * Find position ("from" and "to" indexes) of the element that was moved inside array (only one element should be moved)
19
+ */
20
+ static findMovedElement(initial, modified) {
21
+ if (initial.length !== modified.length) {
22
+ throw new Error('Arrays should have the same number of elements.');
23
+ }
24
+ if (initial.length !== new Set(initial).size || modified.length !== new Set(modified).size) {
25
+ throw new Error("Arrays shouldn't have duplicates.");
26
+ }
27
+ const res = { from: -1, to: -1 };
28
+ let i = 0;
29
+ for (i; i < initial.length; i++) {
30
+ if (initial[i] !== modified[i]) {
31
+ if (initial[i] === modified[i + 1]) {
32
+ res.to = i;
33
+ }
34
+ else {
35
+ res.from = i;
36
+ }
37
+ break;
38
+ }
39
+ }
40
+ if (i === initial.length) {
41
+ return;
42
+ }
43
+ let j = initial.length;
44
+ for (j; j > i; j--) {
45
+ if (initial[j] !== modified[j]) {
46
+ if (res.from === -1) {
47
+ res.from = j;
48
+ }
49
+ else {
50
+ res.to = j;
51
+ }
52
+ break;
53
+ }
54
+ }
55
+ return res;
56
+ }
57
+ static moveArrayItem(arr, from, to) {
58
+ if (!arr?.length || from < 0 || from >= arr.length || to < 0 || to >= arr.length || from === to) {
59
+ return arr;
60
+ }
61
+ arr.splice(to, 0, arr.splice(from, 1)[0]);
62
+ return arr;
63
+ }
64
+ static replaceArrayItem(arr, originalItem, newItem) {
65
+ const index = arr.indexOf(originalItem);
66
+ if (index < 0) {
67
+ return arr;
68
+ }
69
+ arr.splice(index, 1, newItem);
70
+ return arr;
71
+ }
72
+ static randomElement(arr) {
73
+ if (!Array.isArray(arr)) {
74
+ throw new Error('Parameter is not an array.');
75
+ }
76
+ return arr[Math.floor(Math.random() * arr.length)];
77
+ }
78
+ static randomElements(arr, count) {
79
+ const result = [];
80
+ for (let i = 0; i < count; i++) {
81
+ let newItem = null;
82
+ while (!newItem) {
83
+ const item = ArrayHelper.randomElement(arr);
84
+ if (!result.includes(item)) {
85
+ newItem = item;
86
+ }
87
+ }
88
+ result.push(newItem);
89
+ }
90
+ return result;
91
+ }
92
+ static sortArray(array, propertyFunc) {
93
+ return ArrayHelper.sortArrayInternal(array, true, propertyFunc);
94
+ }
95
+ static sortArrayDescending(array, propertyFunc) {
96
+ return ArrayHelper.sortArrayInternal(array, false, propertyFunc);
97
+ }
98
+ static groupBy(array, keyResolver) {
99
+ return array.reduce((resultValue, value) => {
100
+ const groupKey = keyResolver(value);
101
+ (resultValue[groupKey] = resultValue[groupKey] || []).push(value);
102
+ return resultValue;
103
+ }, {});
104
+ }
105
+ static repeat(itemFn, length) {
106
+ return [...Array(length)].map((_, i) => itemFn(i));
107
+ }
108
+ static areEqual(array1, array2) {
109
+ if (array1 === array2) {
110
+ return true;
111
+ }
112
+ if (!array1 && !array2) {
113
+ return true;
114
+ }
115
+ if (!array1 || !array2) {
116
+ return false;
117
+ }
118
+ return array1.length === array2.length && array1.every((element, index) => element === array2[index]);
119
+ }
120
+ static sortArrayInternal(array, ascending, propertyFunc) {
121
+ const clone = [...array];
122
+ return clone.sort((val1, val2) => {
123
+ const a = propertyFunc(val1);
124
+ const b = propertyFunc(val2);
125
+ const left = ascending ? a : b;
126
+ const right = ascending ? b : a;
127
+ if (!left && !right) {
128
+ return 0;
129
+ }
130
+ if (!left) {
131
+ return -1;
132
+ }
133
+ if (!right) {
134
+ return 1;
135
+ }
136
+ if (typeof left === 'string' && typeof right === 'string') {
137
+ return left.localeCompare(right);
138
+ }
139
+ if (left < right) {
140
+ return -1;
141
+ }
142
+ if (left > right) {
143
+ return 1;
144
+ }
145
+ return 0;
146
+ });
147
+ }
148
+ }
@@ -0,0 +1,29 @@
1
+ export declare class DateHelper {
2
+ static toDate(date: LikeDate, resetTime?: boolean): Date;
3
+ static secondsToTimeRepresentation(seconds: number, duration: number): string;
4
+ static getDate(date: LikeDate): number;
5
+ static getYear(date: LikeDate): number;
6
+ static getMonthName(date: LikeDate, locale: string, short?: boolean): string;
7
+ static getWeekdayName(date: LikeDate, locale: string, short?: boolean): string;
8
+ static getMonthRange(date: LikeDate): MonthRange;
9
+ static daysInMonth(date: LikeDate): number;
10
+ static getDayOfWeek(date: LikeDate): number;
11
+ static getShiftedDate(date: LikeDate, daysShift: number): Date;
12
+ static getDateOnlyString(date?: LikeDate): string | null;
13
+ static formatDateRange(startDate: LikeDate, endDate: LikeDate, locale: string): string;
14
+ static dateRangeDescriptionString(startDate: LikeDate, endDate: LikeDate | null | undefined, locale: string): string;
15
+ }
16
+ export declare class DateFormatOptions {
17
+ static dateTimeFormat: Intl.DateTimeFormatOptions;
18
+ static dateTimeWithoutYearFormat: Intl.DateTimeFormatOptions;
19
+ static timeFormat: Intl.DateTimeFormatOptions;
20
+ static dateFormat: Intl.DateTimeFormatOptions;
21
+ static dateFormatWithoutYear: Intl.DateTimeFormatOptions;
22
+ static dateFullMonthFormat: Intl.DateTimeFormatOptions;
23
+ }
24
+ export type MonthRange = {
25
+ firstDay: Date;
26
+ lastDay: Date;
27
+ };
28
+ type LikeDate = string | number | Date;
29
+ export {};
@@ -0,0 +1,146 @@
1
+ export class DateHelper {
2
+ static toDate(date, resetTime = false) {
3
+ date = new Date(date);
4
+ if (resetTime) {
5
+ date.setHours(0, 0, 0, 0);
6
+ }
7
+ return date;
8
+ }
9
+ static secondsToTimeRepresentation(seconds, duration) {
10
+ const longerThanHour = Math.floor(duration / 3600) > 0;
11
+ if (!seconds) {
12
+ return longerThanHour ? '0:00:00' : '0:00';
13
+ }
14
+ const hours = Math.floor(seconds / 3600);
15
+ const mins = Math.floor((seconds - hours * 3600) / 60);
16
+ seconds = seconds - hours * 3600 - mins * 60;
17
+ let res = '';
18
+ if (longerThanHour) {
19
+ if (hours) {
20
+ res += `${hours}:`;
21
+ }
22
+ else {
23
+ res += '0:';
24
+ }
25
+ if (mins < 10) {
26
+ res += '0';
27
+ }
28
+ }
29
+ res += `${mins}:`;
30
+ if (seconds < 10) {
31
+ res += '0';
32
+ }
33
+ res += seconds;
34
+ return res;
35
+ }
36
+ static getDate(date) {
37
+ date = DateHelper.toDate(date);
38
+ return date.getDate();
39
+ }
40
+ static getYear(date) {
41
+ date = DateHelper.toDate(date);
42
+ return date.getFullYear();
43
+ }
44
+ static getMonthName(date, locale, short = false) {
45
+ date = DateHelper.toDate(date);
46
+ return date.toLocaleString(locale, { month: short ? 'short' : 'long' });
47
+ }
48
+ static getWeekdayName(date, locale, short = false) {
49
+ date = DateHelper.toDate(date);
50
+ return date.toLocaleString(locale, { weekday: short ? 'short' : 'long' });
51
+ }
52
+ static getMonthRange(date) {
53
+ date = DateHelper.toDate(date);
54
+ const fullYear = date.getFullYear();
55
+ const month = date.getMonth();
56
+ const firstDay = new Date(fullYear, month, 1);
57
+ const lastDay = new Date(fullYear, month + 1, 1);
58
+ lastDay.setMilliseconds(-1);
59
+ return { firstDay, lastDay };
60
+ }
61
+ static daysInMonth(date) {
62
+ date = DateHelper.toDate(date);
63
+ return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
64
+ }
65
+ static getDayOfWeek(date) {
66
+ date = DateHelper.toDate(date);
67
+ const day = date.getDay();
68
+ return day === 0 ? 7 : day;
69
+ }
70
+ static getShiftedDate(date, daysShift) {
71
+ date = DateHelper.toDate(date);
72
+ date.setDate(date.getDate() + daysShift);
73
+ return date;
74
+ }
75
+ static getDateOnlyString(date) {
76
+ if (!date) {
77
+ return null;
78
+ }
79
+ date = DateHelper.toDate(date);
80
+ const year = date.getFullYear();
81
+ const month = date.getMonth() + 1;
82
+ const day = date.getDate();
83
+ return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
84
+ }
85
+ static formatDateRange(startDate, endDate, locale) {
86
+ const startTime = DateHelper.toDate(startDate);
87
+ const endTime = DateHelper.toDate(endDate);
88
+ const startMonthName = DateHelper.getMonthName(startDate, locale).toLocaleLowerCase();
89
+ const endMonthName = DateHelper.getMonthName(endDate, locale).toLocaleLowerCase();
90
+ const isSameDateWithStart = startTime.getDate() === endTime.getDate() && startTime.getMonth() === endTime.getMonth() && startTime.getFullYear() === endTime.getFullYear();
91
+ const isSameMonth = startTime.getMonth() === endTime.getMonth();
92
+ if (isSameDateWithStart) {
93
+ return `${startTime.getDate()}. ${startMonthName}`;
94
+ }
95
+ if (isSameMonth) {
96
+ return `${startTime.getDate()}. –${endTime.getDate()}. ${startMonthName}`;
97
+ }
98
+ return `${startTime.getDate()}. ${startMonthName} – ${endTime.getDate()}. ${endMonthName}`;
99
+ }
100
+ static dateRangeDescriptionString(startDate, endDate, locale) {
101
+ let eventTime;
102
+ const currentDate = new Date();
103
+ const startTime = DateHelper.toDate(startDate);
104
+ const getFormattedDate = (d) => {
105
+ const month = DateHelper.getMonthName(d, locale, false);
106
+ const date = d.getDate();
107
+ const year = d.getFullYear() === currentDate.getFullYear() ? '' : d.getFullYear().toString();
108
+ const dateString = [month, date, year].join(' ');
109
+ return dateString;
110
+ };
111
+ const getFormattedTime = (d) => {
112
+ return `${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}`;
113
+ };
114
+ const getWeekday = (d) => DateHelper.getWeekdayName(d, locale, false);
115
+ if (!endDate) {
116
+ eventTime = [getWeekday(startTime), getFormattedDate(startTime), getFormattedTime(startTime)].join(' · ');
117
+ }
118
+ else {
119
+ const endTime = DateHelper.toDate(endDate);
120
+ const isSameDateWithStart = startTime.getDate() === endTime.getDate() && startTime.getMonth() === endTime.getMonth() && startTime.getFullYear() === endTime.getFullYear();
121
+ if (isSameDateWithStart) {
122
+ eventTime = [getWeekday(startTime), getFormattedDate(startTime), `${getFormattedTime(startTime)}-${getFormattedTime(endTime)}`].join(' · ');
123
+ }
124
+ else {
125
+ const getFormattedDateWithTime = (d) => [getFormattedDate(d), getFormattedTime(d)].join(' · ');
126
+ eventTime = `${getFormattedDateWithTime(startTime)} - ${getFormattedDateWithTime(endTime)}`;
127
+ }
128
+ }
129
+ return eventTime;
130
+ }
131
+ }
132
+ export class DateFormatOptions {
133
+ static dateTimeFormat = {
134
+ day: '2-digit',
135
+ month: 'short',
136
+ year: 'numeric',
137
+ hour: '2-digit',
138
+ minute: '2-digit',
139
+ hour12: false
140
+ };
141
+ static dateTimeWithoutYearFormat = { day: '2-digit', month: 'short', hour: '2-digit', minute: '2-digit', hour12: false };
142
+ static timeFormat = { hour: '2-digit', minute: '2-digit', hour12: false };
143
+ static dateFormat = { day: '2-digit', month: 'short', year: 'numeric' };
144
+ static dateFormatWithoutYear = { day: '2-digit', month: 'short' };
145
+ static dateFullMonthFormat = { day: '2-digit', month: 'long' };
146
+ }
@@ -0,0 +1,12 @@
1
+ export declare class DomHelper {
2
+ /**
3
+ * Checks whether initial object is located inside specified boundaries
4
+ * @param {HTMLElement} element The initial element
5
+ * @param {HTMLElement[]} boundaryElements Parent elements concerned to be valid boundaries
6
+ * @return {boolean} true if initial element is located inside specified boundaries, otherwise false
7
+ */
8
+ static checkElementOutsideSpecifiedBoundaries(element: Element | EventTarget | null, boundaryElements: Array<Element | EventTarget>): boolean;
9
+ static calsHeightBasedOnRows(element: HTMLElement, rows: number): string;
10
+ static scaleFontSize(el: HTMLElement, text: string, minFontSize?: number, maxFontSize?: number): void;
11
+ private static measureText;
12
+ }
@@ -0,0 +1,76 @@
1
+ export class DomHelper {
2
+ /**
3
+ * Checks whether initial object is located inside specified boundaries
4
+ * @param {HTMLElement} element The initial element
5
+ * @param {HTMLElement[]} boundaryElements Parent elements concerned to be valid boundaries
6
+ * @return {boolean} true if initial element is located inside specified boundaries, otherwise false
7
+ */
8
+ static checkElementOutsideSpecifiedBoundaries(element, boundaryElements) {
9
+ let node = element;
10
+ boundaryElements = boundaryElements || [];
11
+ while (node) {
12
+ if (boundaryElements.includes(node)) {
13
+ return false;
14
+ }
15
+ node = node.parentElement;
16
+ }
17
+ return true;
18
+ }
19
+ static calsHeightBasedOnRows(element, rows) {
20
+ const computed = window.getComputedStyle(element);
21
+ const paddingTop = parseFloat(computed.getPropertyValue('padding-top'));
22
+ const paddingBottom = parseFloat(computed.getPropertyValue('padding-bottom'));
23
+ const lineHeightPx = computed.getPropertyValue('line-height');
24
+ let lineHeight;
25
+ if (lineHeightPx === 'normal') {
26
+ lineHeight = parseFloat(computed.getPropertyValue('font-size')) * 1.2;
27
+ }
28
+ else {
29
+ lineHeight = parseFloat(lineHeightPx);
30
+ }
31
+ const computedHeight = paddingBottom + paddingTop + lineHeight * rows;
32
+ return `${computedHeight}px`;
33
+ }
34
+ static scaleFontSize(el, text, minFontSize = 12, maxFontSize = 150) {
35
+ el.style.fontSize = ``;
36
+ window.setTimeout(() => {
37
+ let fontSize = minFontSize;
38
+ const fontFamily = window.getComputedStyle(el).fontFamily;
39
+ const fontWeight = window.getComputedStyle(el).fontWeight;
40
+ const maxHeight = el.clientHeight;
41
+ const maxWidth = el.clientWidth;
42
+ let attempts = maxFontSize - minFontSize;
43
+ let measured = this.measureText(text, fontSize, fontFamily, fontWeight, maxWidth);
44
+ if (measured.height < maxHeight) {
45
+ let adjusted = false;
46
+ while (measured.height <= maxHeight && measured.width <= maxWidth && attempts > 0) {
47
+ attempts--;
48
+ measured = this.measureText(text, ++fontSize, fontFamily, fontWeight, maxWidth);
49
+ adjusted = true;
50
+ }
51
+ if (adjusted) {
52
+ el.style.fontSize = `${--fontSize}px`;
53
+ }
54
+ }
55
+ });
56
+ }
57
+ static measureText(pText, pFontSize, pFamily, pWeight, width) {
58
+ const tempDiv = document.createElement('div');
59
+ document.body.appendChild(tempDiv);
60
+ tempDiv.style.fontFamily = pFamily;
61
+ tempDiv.style.fontWeight = pWeight;
62
+ tempDiv.style.fontSize = `${pFontSize}px`;
63
+ tempDiv.style.position = 'absolute';
64
+ tempDiv.style.left = '-1000';
65
+ tempDiv.style.top = '-1000';
66
+ tempDiv.style.width = `${width}px`;
67
+ tempDiv.innerHTML = pText;
68
+ const lResult = {
69
+ width: tempDiv.scrollWidth,
70
+ height: tempDiv.clientHeight
71
+ };
72
+ document.body.removeChild(tempDiv);
73
+ tempDiv.remove();
74
+ return lResult;
75
+ }
76
+ }
@@ -0,0 +1,40 @@
1
+ export declare class HtmlHelper {
2
+ static clearSelection(): void;
3
+ static elementFromString(html: string): Element;
4
+ /**
5
+ * Replaces reserved html characters with html entities e.g. '<' with '&lt;'
6
+ */
7
+ static escapeSpecialChars(s: string): string;
8
+ /**
9
+ * Inserts new element into DOM before specified sibling
10
+ * @param newElement Element to be inserted
11
+ * @param siblingElement Anchor element to determine new element position
12
+ * @return Returns nothing
13
+ *
14
+ * Usage
15
+ * DomHelper.insertBefore(siblingElement, newContentField);
16
+ */
17
+ static insertBefore(newElement: Element, siblingElement: Element): void;
18
+ /**
19
+ * Inserts new element into DOM after specified sibling
20
+ * @param newElement Element to be inserted
21
+ * @param siblingElement Anchor element to determine new element position
22
+ * @return Returns nothing
23
+ *
24
+ * Usage
25
+ * DomHelper.insertAfter(siblingElement, newContentField);
26
+ */
27
+ static insertAfter(newElement: Element, siblingElement: Element): void;
28
+ /**
29
+ * Inserts new element into DOM after/before specified sibling
30
+ * @param newElement Element to be inserted
31
+ * @param siblingElement Anchor element to determine new element position
32
+ * @param insertBefore Mark new position
33
+ * @return Returns nothing
34
+ *
35
+ * Usage
36
+ * DomHelper.insert(siblingElement, newContentField, false);
37
+ */
38
+ static insert(newElement: Element, siblingElement: Element, insertBefore?: boolean): void;
39
+ static pasteIntoInput(value: string, element: HTMLInputElement | HTMLTextAreaElement): void;
40
+ }
@@ -0,0 +1,97 @@
1
+ export class HtmlHelper {
2
+ static clearSelection() {
3
+ if (window.getSelection) {
4
+ const selection = window.getSelection();
5
+ if (!selection) {
6
+ return;
7
+ }
8
+ if (selection.empty) {
9
+ // Chrome
10
+ selection.empty();
11
+ }
12
+ else if (selection.removeAllRanges) {
13
+ // Firefox
14
+ selection.removeAllRanges();
15
+ }
16
+ }
17
+ }
18
+ static elementFromString(html) {
19
+ const wrapper = document.createElement('div');
20
+ wrapper.innerHTML = html;
21
+ const result = wrapper.firstElementChild;
22
+ wrapper.remove();
23
+ return result;
24
+ }
25
+ /**
26
+ * Replaces reserved html characters with html entities e.g. '<' with '&lt;'
27
+ */
28
+ static escapeSpecialChars(s) {
29
+ return s.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;').replaceAll("'", '&#039;');
30
+ }
31
+ /**
32
+ * Inserts new element into DOM before specified sibling
33
+ * @param newElement Element to be inserted
34
+ * @param siblingElement Anchor element to determine new element position
35
+ * @return Returns nothing
36
+ *
37
+ * Usage
38
+ * DomHelper.insertBefore(siblingElement, newContentField);
39
+ */
40
+ static insertBefore(newElement, siblingElement) {
41
+ siblingElement.parentNode?.insertBefore(newElement, siblingElement);
42
+ }
43
+ /**
44
+ * Inserts new element into DOM after specified sibling
45
+ * @param newElement Element to be inserted
46
+ * @param siblingElement Anchor element to determine new element position
47
+ * @return Returns nothing
48
+ *
49
+ * Usage
50
+ * DomHelper.insertAfter(siblingElement, newContentField);
51
+ */
52
+ static insertAfter(newElement, siblingElement) {
53
+ siblingElement.parentNode?.insertBefore(newElement, siblingElement.nextSibling);
54
+ }
55
+ /**
56
+ * Inserts new element into DOM after/before specified sibling
57
+ * @param newElement Element to be inserted
58
+ * @param siblingElement Anchor element to determine new element position
59
+ * @param insertBefore Mark new position
60
+ * @return Returns nothing
61
+ *
62
+ * Usage
63
+ * DomHelper.insert(siblingElement, newContentField, false);
64
+ */
65
+ static insert(newElement, siblingElement, insertBefore = false) {
66
+ if (insertBefore) {
67
+ HtmlHelper.insertBefore(newElement, siblingElement);
68
+ }
69
+ else {
70
+ HtmlHelper.insertAfter(newElement, siblingElement);
71
+ }
72
+ }
73
+ static pasteIntoInput(value, element) {
74
+ if (element.selectionStart || element.selectionStart === 0) {
75
+ const startPos = element.selectionStart;
76
+ const endPos = element.selectionEnd;
77
+ if (endPos === null) {
78
+ element.value = value;
79
+ }
80
+ else {
81
+ const beforeSelection = element.value.substring(0, startPos);
82
+ const afterSelection = element.value.substring(endPos, element.value.length);
83
+ element.value = `${beforeSelection}${value}${afterSelection}`;
84
+ }
85
+ const newCursor = startPos + value.length;
86
+ element.setSelectionRange(newCursor, newCursor);
87
+ }
88
+ else {
89
+ element.value += value;
90
+ }
91
+ element.dispatchEvent(new Event('input', {
92
+ bubbles: true,
93
+ cancelable: true
94
+ }));
95
+ element.focus();
96
+ }
97
+ }
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './string-helper';
3
+ export * from './number-helper';
@@ -0,0 +1,3 @@
1
+ export * from './utils';
2
+ export * from './string-helper';
3
+ export * from './number-helper';
@@ -0,0 +1,6 @@
1
+ export declare class NumberHelper {
2
+ static formatNumber: (n: number | string) => string;
3
+ static randomIntFromInterval: (min: number, max: number) => number;
4
+ static quotient: (number: number, denominator: number) => number;
5
+ static remainder: (number: number, denominator: number) => number;
6
+ }
@@ -0,0 +1,28 @@
1
+ export class NumberHelper {
2
+ static formatNumber = (n) => {
3
+ if (!n) {
4
+ return '0';
5
+ }
6
+ if (typeof n === 'string') {
7
+ n = parseInt(n);
8
+ }
9
+ const isNegative = n < 0;
10
+ let modulo = isNegative ? 0 - n : n;
11
+ const output = [];
12
+ for (; modulo >= 1000; modulo = Math.floor(n / 1000)) {
13
+ output.unshift(String(modulo % 1000).padStart(3, '0'));
14
+ }
15
+ output.unshift(modulo);
16
+ return `${isNegative ? '-' : ''}${output.join(' ')}`;
17
+ };
18
+ static randomIntFromInterval = (min, max) => {
19
+ // min and max included
20
+ return Math.floor(Math.random() * (max - min + 1) + min);
21
+ };
22
+ static quotient = (number, denominator) => {
23
+ return Math.floor(number / denominator);
24
+ };
25
+ static remainder = (number, denominator) => {
26
+ return number % denominator;
27
+ };
28
+ }
@@ -0,0 +1,2 @@
1
+ export declare function generateString(length: number): string;
2
+ export declare const randomNanoid: (size?: number) => string;
@@ -0,0 +1,15 @@
1
+ import { nanoid } from 'nanoid';
2
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
3
+ export function generateString(length) {
4
+ let result = '';
5
+ const charactersLength = characters.length;
6
+ let counter = 0;
7
+ while (counter < length) {
8
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
9
+ counter += 1;
10
+ }
11
+ return result;
12
+ }
13
+ export const randomNanoid = (size = 15) => {
14
+ return nanoid(size);
15
+ };
@@ -0,0 +1,10 @@
1
+ export declare class StringHelper {
2
+ static isBlobUrl(val: string | null | undefined): boolean;
3
+ static isEmail(val: string): boolean;
4
+ static isNumeric(n: string): boolean;
5
+ static isUrl(val: string): boolean;
6
+ static toKebabCase(str: string): string;
7
+ static toSnakeCase(str: string): string;
8
+ static truncate(str: string, length: number): string;
9
+ static capitalizeFirstLetter(word: string): string;
10
+ }