@dodlhuat/basix 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (430) hide show
  1. package/README.md +482 -0
  2. package/css/accordion.css +109 -0
  3. package/css/accordion.css.map +1 -0
  4. package/css/accordion.scss +78 -0
  5. package/css/alert.css +57 -0
  6. package/css/alert.css.map +1 -0
  7. package/css/alert.scss +86 -0
  8. package/css/button.css +69 -0
  9. package/css/button.css.map +1 -0
  10. package/css/button.scss +102 -0
  11. package/css/card.css +144 -0
  12. package/css/card.css.map +1 -0
  13. package/css/card.scss +66 -0
  14. package/css/carousel.css +118 -0
  15. package/css/carousel.css.map +1 -0
  16. package/css/carousel.scss +87 -0
  17. package/css/chart.css +159 -0
  18. package/css/chart.css.map +1 -0
  19. package/css/chart.scss +159 -0
  20. package/css/chat-bubbles.css +97 -0
  21. package/css/chat-bubbles.css.map +1 -0
  22. package/css/chat-bubbles.scss +68 -0
  23. package/css/checkbox.css +77 -0
  24. package/css/checkbox.css.map +1 -0
  25. package/css/checkbox.scss +55 -0
  26. package/css/chips.css +72 -0
  27. package/css/chips.css.map +1 -0
  28. package/css/chips.scss +52 -0
  29. package/css/code-viewer.css +97 -0
  30. package/css/code-viewer.css.map +1 -0
  31. package/css/code-viewer.scss +98 -0
  32. package/css/colors.css +63 -0
  33. package/css/colors.css.map +1 -0
  34. package/css/colors.scss +33 -0
  35. package/css/datepicker.css +264 -0
  36. package/css/datepicker.css.map +1 -0
  37. package/css/datepicker.scss +317 -0
  38. package/css/defaults.css +118 -0
  39. package/css/defaults.css.map +1 -0
  40. package/css/defaults.scss +91 -0
  41. package/css/dropdown.css +146 -0
  42. package/css/dropdown.css.map +1 -0
  43. package/css/dropdown.scss +137 -0
  44. package/css/editor.css +413 -0
  45. package/css/editor.scss +458 -0
  46. package/css/file-uploader.css +194 -0
  47. package/css/file-uploader.css.map +1 -0
  48. package/css/file-uploader.scss +195 -0
  49. package/css/flyout-menu.css +345 -0
  50. package/css/flyout-menu.css.map +1 -0
  51. package/css/flyout-menu.scss +355 -0
  52. package/css/form-builder.css +9 -0
  53. package/css/form-builder.css.map +1 -0
  54. package/css/form-builder.scss +11 -0
  55. package/css/form.css +130 -0
  56. package/css/form.css.map +1 -0
  57. package/css/form.scss +115 -0
  58. package/css/gallery.css +91 -0
  59. package/css/gallery.css.map +1 -0
  60. package/css/gallery.scss +63 -0
  61. package/css/grid.css +44 -0
  62. package/css/grid.css.map +1 -0
  63. package/css/grid.scss +41 -0
  64. package/css/guitar-chords.css +251 -0
  65. package/css/icons.css +327 -0
  66. package/css/icons.css.map +1 -0
  67. package/css/icons.scss +331 -0
  68. package/css/modal.css +97 -0
  69. package/css/modal.css.map +1 -0
  70. package/css/modal.scss +72 -0
  71. package/css/parameters.css +1 -0
  72. package/css/parameters.css.map +1 -0
  73. package/css/parameters.scss +4 -0
  74. package/css/placeholder.css +50 -0
  75. package/css/placeholder.css.map +1 -0
  76. package/css/placeholder.scss +28 -0
  77. package/css/progress.css +51 -0
  78. package/css/progress.css.map +1 -0
  79. package/css/progress.scss +32 -0
  80. package/css/properties.css +31 -0
  81. package/css/properties.css.map +1 -0
  82. package/css/properties.scss +31 -0
  83. package/css/push-menu.css +145 -0
  84. package/css/push-menu.css.map +1 -0
  85. package/css/push-menu.scss +127 -0
  86. package/css/radiobutton.css +91 -0
  87. package/css/radiobutton.css.map +1 -0
  88. package/css/radiobutton.scss +64 -0
  89. package/css/reset.css +46 -0
  90. package/css/reset.css.map +1 -0
  91. package/css/reset.scss +40 -0
  92. package/css/scrollbar.css +91 -0
  93. package/css/scrollbar.css.map +1 -0
  94. package/css/scrollbar.scss +69 -0
  95. package/css/spinner.css +118 -0
  96. package/css/spinner.css.map +1 -0
  97. package/css/spinner.scss +91 -0
  98. package/css/style.css +3735 -0
  99. package/css/style.css.map +1 -0
  100. package/css/style.min.css +1 -0
  101. package/css/style.scss +38 -0
  102. package/css/switch.css +66 -0
  103. package/css/switch.css.map +1 -0
  104. package/css/switch.scss +42 -0
  105. package/css/table.css +201 -0
  106. package/css/table.css.map +1 -0
  107. package/css/table.scss +178 -0
  108. package/css/tabs.css +135 -0
  109. package/css/tabs.css.map +1 -0
  110. package/css/tabs.scss +118 -0
  111. package/css/timeline.css +69 -0
  112. package/css/timeline.css.map +1 -0
  113. package/css/timeline.scss +69 -0
  114. package/css/timepicker.scss +72 -0
  115. package/css/toast.css +98 -0
  116. package/css/toast.css.map +1 -0
  117. package/css/toast.scss +81 -0
  118. package/css/tooltip.css +151 -0
  119. package/css/tooltip.css.map +1 -0
  120. package/css/tooltip.scss +122 -0
  121. package/css/tree.css +199 -0
  122. package/css/tree.css.map +1 -0
  123. package/css/tree.scss +192 -0
  124. package/css/typography.css +137 -0
  125. package/css/typography.css.map +1 -0
  126. package/css/typography.scss +100 -0
  127. package/css/virtual-dropdown.css +149 -0
  128. package/css/virtual-dropdown.css.map +1 -0
  129. package/css/virtual-dropdown.scss +142 -0
  130. package/fonts/MaterialSymbolsOutlined.woff2 +0 -0
  131. package/fonts/Outfit-VariableFont_wght.woff +0 -0
  132. package/fonts/Outfit-VariableFont_wght.woff2 +0 -0
  133. package/fonts/material-icons.woff2 +0 -0
  134. package/icons/activity-outline.svg +1 -0
  135. package/icons/alert-circle-outline.svg +1 -0
  136. package/icons/alert-triangle-outline.svg +1 -0
  137. package/icons/archive-outline.svg +1 -0
  138. package/icons/arrow-back-outline.svg +1 -0
  139. package/icons/arrow-circle-down-outline.svg +1 -0
  140. package/icons/arrow-circle-left-outline.svg +1 -0
  141. package/icons/arrow-circle-right-outline.svg +1 -0
  142. package/icons/arrow-circle-up-outline.svg +1 -0
  143. package/icons/arrow-down-outline.svg +1 -0
  144. package/icons/arrow-downward-outline.svg +1 -0
  145. package/icons/arrow-forward-outline.svg +1 -0
  146. package/icons/arrow-ios-back-outline.svg +1 -0
  147. package/icons/arrow-ios-downward-outline.svg +1 -0
  148. package/icons/arrow-ios-forward-outline.svg +1 -0
  149. package/icons/arrow-ios-upward-outline.svg +1 -0
  150. package/icons/arrow-left-outline.svg +1 -0
  151. package/icons/arrow-right-outline.svg +1 -0
  152. package/icons/arrow-up-outline.svg +1 -0
  153. package/icons/arrow-upward-outline.svg +1 -0
  154. package/icons/arrowhead-down-outline.svg +1 -0
  155. package/icons/arrowhead-left-outline.svg +1 -0
  156. package/icons/arrowhead-right-outline.svg +1 -0
  157. package/icons/arrowhead-up-outline.svg +1 -0
  158. package/icons/at-outline.svg +1 -0
  159. package/icons/attach-2-outline.svg +1 -0
  160. package/icons/attach-outline.svg +1 -0
  161. package/icons/award-outline.svg +1 -0
  162. package/icons/backspace-outline.svg +1 -0
  163. package/icons/bar-chart-2-outline.svg +1 -0
  164. package/icons/bar-chart-outline.svg +1 -0
  165. package/icons/battery-outline.svg +1 -0
  166. package/icons/behance-outline.svg +1 -0
  167. package/icons/bell-off-outline.svg +1 -0
  168. package/icons/bell-outline.svg +1 -0
  169. package/icons/bluetooth-outline.svg +1 -0
  170. package/icons/book-open-outline.svg +1 -0
  171. package/icons/book-outline.svg +1 -0
  172. package/icons/bookmark-outline.svg +1 -0
  173. package/icons/briefcase-outline.svg +1 -0
  174. package/icons/browser-outline.svg +1 -0
  175. package/icons/brush-outline.svg +1 -0
  176. package/icons/bulb-outline.svg +1 -0
  177. package/icons/calendar-outline.svg +1 -0
  178. package/icons/camera-outline.svg +1 -0
  179. package/icons/car-outline.svg +1 -0
  180. package/icons/cast-outline.svg +1 -0
  181. package/icons/charging-outline.svg +1 -0
  182. package/icons/checkmark-circle-2-outline.svg +1 -0
  183. package/icons/checkmark-circle-outline.svg +1 -0
  184. package/icons/checkmark-outline.svg +1 -0
  185. package/icons/checkmark-square-2-outline.svg +1 -0
  186. package/icons/checkmark-square-outline.svg +1 -0
  187. package/icons/chevron-down-outline.svg +1 -0
  188. package/icons/chevron-left-outline.svg +1 -0
  189. package/icons/chevron-right-outline.svg +1 -0
  190. package/icons/chevron-up-outline.svg +1 -0
  191. package/icons/clipboard-outline.svg +1 -0
  192. package/icons/clock-outline.svg +1 -0
  193. package/icons/close-circle-outline.svg +1 -0
  194. package/icons/close-outline.svg +1 -0
  195. package/icons/close-square-outline.svg +1 -0
  196. package/icons/cloud-download-outline.svg +1 -0
  197. package/icons/cloud-upload-outline.svg +1 -0
  198. package/icons/code-download-outline.svg +1 -0
  199. package/icons/code-outline.svg +1 -0
  200. package/icons/collapse-outline.svg +1 -0
  201. package/icons/color-palette-outline.svg +1 -0
  202. package/icons/color-picker-outline.svg +1 -0
  203. package/icons/compass-outline.svg +1 -0
  204. package/icons/copy-outline.svg +1 -0
  205. package/icons/corner-down-left-outline.svg +1 -0
  206. package/icons/corner-down-right-outline.svg +1 -0
  207. package/icons/corner-left-down-outline.svg +1 -0
  208. package/icons/corner-left-up-outline.svg +1 -0
  209. package/icons/corner-right-down-outline.svg +1 -0
  210. package/icons/corner-right-up-outline.svg +1 -0
  211. package/icons/corner-up-left-outline.svg +1 -0
  212. package/icons/corner-up-right-outline.svg +1 -0
  213. package/icons/credit-card-outline.svg +1 -0
  214. package/icons/crop-outline.svg +1 -0
  215. package/icons/cube-outline.svg +1 -0
  216. package/icons/diagonal-arrow-left-down-outline.svg +1 -0
  217. package/icons/diagonal-arrow-left-up-outline.svg +1 -0
  218. package/icons/diagonal-arrow-right-down-outline.svg +1 -0
  219. package/icons/diagonal-arrow-right-up-outline.svg +1 -0
  220. package/icons/done-all-outline.svg +1 -0
  221. package/icons/download-outline.svg +1 -0
  222. package/icons/droplet-off-outline.svg +1 -0
  223. package/icons/droplet-outline.svg +1 -0
  224. package/icons/edit-2-outline.svg +1 -0
  225. package/icons/edit-outline.svg +1 -0
  226. package/icons/email-outline.svg +1 -0
  227. package/icons/expand-outline.svg +1 -0
  228. package/icons/external-link-outline.svg +1 -0
  229. package/icons/eye-off-2-outline.svg +1 -0
  230. package/icons/eye-off-outline.svg +1 -0
  231. package/icons/eye-outline.svg +1 -0
  232. package/icons/facebook-outline.svg +1 -0
  233. package/icons/file-add-outline.svg +1 -0
  234. package/icons/file-outline.svg +1 -0
  235. package/icons/file-remove-outline.svg +1 -0
  236. package/icons/file-text-outline.svg +1 -0
  237. package/icons/film-outline.svg +1 -0
  238. package/icons/flag-outline.svg +1 -0
  239. package/icons/flash-off-outline.svg +1 -0
  240. package/icons/flash-outline.svg +1 -0
  241. package/icons/flip-2-outline.svg +1 -0
  242. package/icons/flip-outline.svg +1 -0
  243. package/icons/folder-add-outline.svg +1 -0
  244. package/icons/folder-outline.svg +1 -0
  245. package/icons/folder-remove-outline.svg +1 -0
  246. package/icons/funnel-outline.svg +1 -0
  247. package/icons/gift-outline.svg +1 -0
  248. package/icons/github-outline.svg +1 -0
  249. package/icons/globe-2-outline.svg +1 -0
  250. package/icons/globe-outline.svg +1 -0
  251. package/icons/google-outline.svg +1 -0
  252. package/icons/grid-outline.svg +1 -0
  253. package/icons/hard-drive-outline.svg +1 -0
  254. package/icons/hash-outline.svg +1 -0
  255. package/icons/headphones-outline.svg +1 -0
  256. package/icons/heart-outline.svg +1 -0
  257. package/icons/home-outline.svg +1 -0
  258. package/icons/image-outline.svg +1 -0
  259. package/icons/inbox-outline.svg +1 -0
  260. package/icons/info-outline.svg +1 -0
  261. package/icons/keypad-outline.svg +1 -0
  262. package/icons/layers-outline.svg +1 -0
  263. package/icons/layout-outline.svg +1 -0
  264. package/icons/link-2-outline.svg +1 -0
  265. package/icons/link-outline.svg +1 -0
  266. package/icons/linkedin-outline.svg +1 -0
  267. package/icons/list-outline.svg +1 -0
  268. package/icons/loader-outline.svg +1 -0
  269. package/icons/lock-outline.svg +1 -0
  270. package/icons/log-in-outline.svg +1 -0
  271. package/icons/log-out-outline.svg +1 -0
  272. package/icons/map-outline.svg +1 -0
  273. package/icons/maximize-outline.svg +1 -0
  274. package/icons/menu-2-outline.svg +1 -0
  275. package/icons/menu-arrow-outline.svg +1 -0
  276. package/icons/menu-outline.svg +1 -0
  277. package/icons/message-circle-outline.svg +1 -0
  278. package/icons/message-square-outline.svg +1 -0
  279. package/icons/mic-off-outline.svg +1 -0
  280. package/icons/mic-outline.svg +1 -0
  281. package/icons/minimize-outline.svg +1 -0
  282. package/icons/minus-circle-outline.svg +1 -0
  283. package/icons/minus-outline.svg +1 -0
  284. package/icons/minus-square-outline.svg +1 -0
  285. package/icons/monitor-outline.svg +1 -0
  286. package/icons/moon-outline.svg +1 -0
  287. package/icons/more-horizontal-outline.svg +1 -0
  288. package/icons/more-vertical-outline.svg +1 -0
  289. package/icons/move-outline.svg +1 -0
  290. package/icons/music-outline.svg +1 -0
  291. package/icons/navigation-2-outline.svg +1 -0
  292. package/icons/navigation-outline.svg +1 -0
  293. package/icons/npm-outline.svg +1 -0
  294. package/icons/options-2-outline.svg +1 -0
  295. package/icons/options-outline.svg +1 -0
  296. package/icons/pantone-outline.svg +1 -0
  297. package/icons/paper-plane-outline.svg +1 -0
  298. package/icons/pause-circle-outline.svg +1 -0
  299. package/icons/people-outline.svg +1 -0
  300. package/icons/percent-outline.svg +1 -0
  301. package/icons/person-add-outline.svg +1 -0
  302. package/icons/person-delete-outline.svg +1 -0
  303. package/icons/person-done-outline.svg +1 -0
  304. package/icons/person-outline.svg +1 -0
  305. package/icons/person-remove-outline.svg +1 -0
  306. package/icons/phone-call-outline.svg +1 -0
  307. package/icons/phone-missed-outline.svg +1 -0
  308. package/icons/phone-off-outline.svg +1 -0
  309. package/icons/phone-outline.svg +1 -0
  310. package/icons/pie-chart-outline.svg +1 -0
  311. package/icons/pin-outline.svg +1 -0
  312. package/icons/play-circle-outline.svg +1 -0
  313. package/icons/plus-circle-outline.svg +1 -0
  314. package/icons/plus-outline.svg +1 -0
  315. package/icons/plus-square-outline.svg +1 -0
  316. package/icons/power-outline.svg +1 -0
  317. package/icons/pricetags-outline.svg +1 -0
  318. package/icons/printer-outline.svg +1 -0
  319. package/icons/question-mark-circle-outline.svg +1 -0
  320. package/icons/question-mark-outline.svg +1 -0
  321. package/icons/radio-button-off-outline.svg +1 -0
  322. package/icons/radio-button-on-outline.svg +1 -0
  323. package/icons/radio-outline.svg +1 -0
  324. package/icons/recording-outline.svg +1 -0
  325. package/icons/refresh-outline.svg +1 -0
  326. package/icons/repeat-outline.svg +1 -0
  327. package/icons/rewind-left-outline.svg +1 -0
  328. package/icons/rewind-right-outline.svg +1 -0
  329. package/icons/save-outline.svg +1 -0
  330. package/icons/scissors-outline.svg +1 -0
  331. package/icons/search-outline.svg +1 -0
  332. package/icons/settings-2-outline.svg +1 -0
  333. package/icons/settings-outline.svg +1 -0
  334. package/icons/shake-outline.svg +1 -0
  335. package/icons/share-outline.svg +1 -0
  336. package/icons/shield-off-outline.svg +1 -0
  337. package/icons/shield-outline.svg +1 -0
  338. package/icons/shopping-bag-outline.svg +1 -0
  339. package/icons/shopping-cart-outline.svg +1 -0
  340. package/icons/shuffle-2-outline.svg +1 -0
  341. package/icons/shuffle-outline.svg +1 -0
  342. package/icons/skip-back-outline.svg +1 -0
  343. package/icons/skip-forward-outline.svg +1 -0
  344. package/icons/slash-outline.svg +1 -0
  345. package/icons/smartphone-outline.svg +1 -0
  346. package/icons/smiling-face-outline.svg +1 -0
  347. package/icons/speaker-outline.svg +1 -0
  348. package/icons/square-outline.svg +1 -0
  349. package/icons/star-outline.svg +1 -0
  350. package/icons/stop-circle-outline.svg +1 -0
  351. package/icons/sun-outline.svg +1 -0
  352. package/icons/swap-outline.svg +1 -0
  353. package/icons/sync-outline.svg +1 -0
  354. package/icons/text-outline.svg +1 -0
  355. package/icons/thermometer-minus-outline.svg +1 -0
  356. package/icons/thermometer-outline.svg +1 -0
  357. package/icons/thermometer-plus-outline.svg +1 -0
  358. package/icons/toggle-left-outline.svg +1 -0
  359. package/icons/toggle-right-outline.svg +1 -0
  360. package/icons/trash-2-outline.svg +1 -0
  361. package/icons/trash-outline.svg +1 -0
  362. package/icons/trending-down-outline.svg +1 -0
  363. package/icons/trending-up-outline.svg +1 -0
  364. package/icons/tv-outline.svg +1 -0
  365. package/icons/twitter-outline.svg +1 -0
  366. package/icons/umbrella-outline.svg +1 -0
  367. package/icons/undo-outline.svg +1 -0
  368. package/icons/unlock-outline.svg +1 -0
  369. package/icons/upload-outline.svg +1 -0
  370. package/icons/video-off-outline.svg +1 -0
  371. package/icons/video-outline.svg +1 -0
  372. package/icons/volume-down-outline.svg +1 -0
  373. package/icons/volume-mute-outline.svg +1 -0
  374. package/icons/volume-off-outline.svg +1 -0
  375. package/icons/volume-up-outline.svg +1 -0
  376. package/icons/wifi-off-outline.svg +1 -0
  377. package/icons/wifi-outline.svg +1 -0
  378. package/js/carousel.js +133 -0
  379. package/js/carousel.ts +173 -0
  380. package/js/chart.js +257 -0
  381. package/js/code-viewer.js +148 -0
  382. package/js/code-viewer.ts +188 -0
  383. package/js/datepicker.js +497 -0
  384. package/js/datepicker.ts +619 -0
  385. package/js/dropdown.js +122 -0
  386. package/js/dropdown.ts +180 -0
  387. package/js/editor.js +421 -0
  388. package/js/editor.ts +426 -0
  389. package/js/file-uploader.js +268 -0
  390. package/js/file-uploader.ts +350 -0
  391. package/js/flyout-menu.js +195 -0
  392. package/js/flyout-menu.ts +250 -0
  393. package/js/form-builder.js +107 -0
  394. package/js/gallery.js +177 -0
  395. package/js/gallery.ts +231 -0
  396. package/js/guitar-chords.js +268 -0
  397. package/js/index.js +720 -0
  398. package/js/index.ts +874 -0
  399. package/js/lazy-loader.js +121 -0
  400. package/js/modal.js +113 -0
  401. package/js/modal.ts +167 -0
  402. package/js/push-menu.js +101 -0
  403. package/js/push-menu.ts +130 -0
  404. package/js/request.js +51 -0
  405. package/js/scroll.js +27 -0
  406. package/js/scroll.ts +47 -0
  407. package/js/scrollbar.js +219 -0
  408. package/js/scrollbar.ts +308 -0
  409. package/js/select.js +158 -0
  410. package/js/select.ts +217 -0
  411. package/js/table.js +359 -0
  412. package/js/table.ts +453 -0
  413. package/js/tabs.js +225 -0
  414. package/js/tabs.ts +280 -0
  415. package/js/theme.js +194 -0
  416. package/js/theme.ts +225 -0
  417. package/js/timepicker.js +98 -0
  418. package/js/timepicker.ts +131 -0
  419. package/js/toast.js +93 -0
  420. package/js/toast.ts +138 -0
  421. package/js/tooltip.js +193 -0
  422. package/js/tooltip.ts +252 -0
  423. package/js/tree.js +162 -0
  424. package/js/tree.ts +218 -0
  425. package/js/tsconfig.json +18 -0
  426. package/js/utils.js +69 -0
  427. package/js/utils.ts +84 -0
  428. package/js/virtual-dropdown.js +277 -0
  429. package/js/virtual-dropdown.ts +366 -0
  430. package/package.json +38 -0
package/js/carousel.ts ADDED
@@ -0,0 +1,173 @@
1
+ interface CarouselOptions {
2
+ loop?: boolean;
3
+ autoPlay?: boolean;
4
+ autoPlayInterval?: number;
5
+ }
6
+
7
+ class Carousel {
8
+ private root: HTMLElement;
9
+ private options: CarouselOptions;
10
+ private track!: HTMLUListElement;
11
+ private slides!: HTMLElement[];
12
+ private slideWidth!: number;
13
+ private currentIndex!: number;
14
+ private prevButton!: HTMLButtonElement;
15
+ private nextButton!: HTMLButtonElement;
16
+ private dotsNav!: HTMLDivElement;
17
+ private dots!: HTMLButtonElement[];
18
+
19
+ constructor(elementOrSelector: string | HTMLElement, options: CarouselOptions = {}) {
20
+ const element = typeof elementOrSelector === 'string'
21
+ ? document.querySelector<HTMLElement>(elementOrSelector)
22
+ : elementOrSelector;
23
+
24
+ this.options = {
25
+ loop: options.loop ?? false,
26
+ autoPlay: options.autoPlay ?? false,
27
+ autoPlayInterval: options.autoPlayInterval ?? 3000
28
+ };
29
+
30
+ if (!element) {
31
+ throw new Error(`Carousel: Element not found for selector "${elementOrSelector}"`);
32
+ }
33
+
34
+ this.root = element;
35
+
36
+ this.init();
37
+ }
38
+
39
+ private init(): void {
40
+ this.setupDOM();
41
+ this.slides = Array.from(this.track.children) as HTMLElement[];
42
+ this.slideWidth = this.slides[0].getBoundingClientRect().width;
43
+ this.currentIndex = 0;
44
+ this.bindEvents();
45
+ this.updateDots(0);
46
+ if (this.options.autoPlay) {
47
+ this.startAutoPlay();
48
+ }
49
+ }
50
+
51
+ private setupDOM(): void {
52
+ const slides = Array.from(this.root.children) as HTMLElement[];
53
+ const container = document.createElement('div');
54
+ container.classList.add('carousel-track-container');
55
+
56
+ this.track = document.createElement('ul');
57
+ this.track.classList.add('carousel-track');
58
+
59
+ slides.forEach(slide => {
60
+ slide.classList.add('carousel-slide');
61
+ this.track.appendChild(slide);
62
+ });
63
+
64
+ container.appendChild(this.track);
65
+ this.root.appendChild(container);
66
+
67
+ this.prevButton = document.createElement('button');
68
+ this.prevButton.classList.add('carousel-button', 'carousel-button--left');
69
+ this.prevButton.innerHTML = '<span class="icon-navigate_before icon"></span>';
70
+ this.prevButton.setAttribute('aria-label', 'Previous Slide');
71
+
72
+ this.nextButton = document.createElement('button');
73
+ this.nextButton.classList.add('carousel-button', 'carousel-button--right');
74
+ this.nextButton.innerHTML = '<span class="icon-navigate_next icon"></span>';
75
+ this.nextButton.setAttribute('aria-label', 'Next Slide');
76
+
77
+ this.root.appendChild(this.prevButton);
78
+ this.root.appendChild(this.nextButton);
79
+
80
+ this.dotsNav = document.createElement('div');
81
+ this.dotsNav.classList.add('carousel-nav');
82
+
83
+ this.dots = [];
84
+ slides.forEach((_, index) => {
85
+ const dot = document.createElement('button');
86
+ dot.classList.add('carousel-indicator');
87
+ dot.setAttribute('aria-label', `Slide ${index + 1}`);
88
+ this.dotsNav.appendChild(dot);
89
+ this.dots.push(dot);
90
+ });
91
+
92
+ this.root.appendChild(this.dotsNav);
93
+ }
94
+
95
+ private bindEvents(): void {
96
+ this.nextButton.addEventListener('click', () => this.moveToNextSlide());
97
+ this.prevButton.addEventListener('click', () => this.moveToPrevSlide());
98
+
99
+ this.dotsNav.addEventListener('click', (e: MouseEvent) => {
100
+ const targetDot = (e.target as HTMLElement).closest('button');
101
+ if (!targetDot) return;
102
+
103
+ const targetIndex = this.dots.findIndex(dot => dot === targetDot);
104
+ this.moveToSlide(targetIndex);
105
+ });
106
+
107
+ window.addEventListener('resize', () => {
108
+ this.slideWidth = this.slides[0].getBoundingClientRect().width;
109
+ this.moveToSlide(this.currentIndex, false);
110
+ });
111
+
112
+ this.addTouchSupport();
113
+ }
114
+
115
+ private moveToSlide(targetIndex: number, animate: boolean = true): void {
116
+ if (targetIndex < 0) {
117
+ if (this.options.loop) targetIndex = this.slides.length - 1;
118
+ else targetIndex = 0;
119
+ } else if (targetIndex >= this.slides.length) {
120
+ if (this.options.loop) targetIndex = 0;
121
+ else targetIndex = this.slides.length - 1;
122
+ }
123
+
124
+ const amountToMove = -1 * (this.slideWidth * targetIndex);
125
+ this.track.style.transform = `translateX(${amountToMove}px)`;
126
+
127
+ this.updateDots(targetIndex);
128
+ this.currentIndex = targetIndex;
129
+ }
130
+
131
+ private moveToNextSlide(): void {
132
+ this.moveToSlide(this.currentIndex + 1);
133
+ }
134
+
135
+ private moveToPrevSlide(): void {
136
+ this.moveToSlide(this.currentIndex - 1);
137
+ }
138
+
139
+ private updateDots(targetIndex: number): void {
140
+ this.dots.forEach(dot => dot.classList.remove('current-slide'));
141
+ this.dots[targetIndex].classList.add('current-slide');
142
+ }
143
+
144
+ private addTouchSupport(): void {
145
+ let startX = 0;
146
+ let isDragging = false;
147
+
148
+ this.track.addEventListener('touchstart', (e: TouchEvent) => {
149
+ startX = e.touches[0].clientX;
150
+ isDragging = true;
151
+ }, { passive: true });
152
+
153
+ this.track.addEventListener('touchend', (e: TouchEvent) => {
154
+ if (!isDragging) return;
155
+ const endX = e.changedTouches[0].clientX;
156
+ const diffX = startX - endX;
157
+
158
+ if (Math.abs(diffX) > 50) {
159
+ if (diffX > 0) this.moveToNextSlide();
160
+ else this.moveToPrevSlide();
161
+ }
162
+ isDragging = false;
163
+ });
164
+ }
165
+
166
+ private startAutoPlay(): void {
167
+ setInterval(() => {
168
+ this.moveToNextSlide();
169
+ }, this.options.autoPlayInterval);
170
+ }
171
+ }
172
+ export { Carousel };
173
+ export type { CarouselOptions };
package/js/chart.js ADDED
@@ -0,0 +1,257 @@
1
+ class ChartConfig {
2
+ constructor() {
3
+ this.minVal = 19;
4
+ this.maxVal = 81;
5
+ this.gridLines = [19, 27, 34, 38, 41, 45, 47, 50, 53, 55, 59, 62, 66, 73, 81];
6
+ this.zoneBoundaries = [43, 55]; // Left < 43, 43 <= Mid <= 55, Right > 55
7
+ this.rowHeight = 40; // Must match CSS .chart-row height
8
+ this.headerHeight = 40; // Must match CSS #chart-container padding-top
9
+ this.infoColumnWidth = 350; // Must match CSS .row-info width
10
+ this.valueSpans = [
11
+ {min: 19, max: 23, text: "Bad"},
12
+ {min: 24, max: 38, text: "Better"},
13
+ {min: 39, max: 44, text: "Ok"},
14
+ {min: 45, max: 55, text: "Good"},
15
+ {min: 56, max: 81, text: "Excellent"}
16
+ ];
17
+ }
18
+ }
19
+
20
+ class Row {
21
+ constructor(data) {
22
+ this.id = data.id;
23
+ this.position = data.position;
24
+ this.name = data.name;
25
+ this.description = data.description || '';
26
+ this.value = data.value;
27
+ }
28
+
29
+ render() {
30
+ const div = document.createElement('div');
31
+ div.className = 'chart-row';
32
+ div.innerHTML = `
33
+ <div class="row-info">
34
+ <div class="row-name">${this.name}</div>
35
+ <div class="row-meta">${this.description ? this.description : ''}</div>
36
+ </div>
37
+ `;
38
+ return div;
39
+ }
40
+ }
41
+
42
+ class Chart {
43
+ constructor(containerId, data) {
44
+ this.container = document.getElementById(containerId);
45
+ this.data = data.map(d => new Row(d));
46
+ this.config = new ChartConfig();
47
+
48
+ // Sort data by position just in case
49
+ this.data.sort((a, b) => a.position - b.position);
50
+
51
+ // Create tooltip element
52
+ this.tooltip = document.createElement('div');
53
+ this.tooltip.className = 'chart-tooltip';
54
+ this.tooltip.style.display = 'none';
55
+ document.body.appendChild(this.tooltip);
56
+
57
+ // Handle resize
58
+ window.addEventListener('resize', () => {
59
+ this.render();
60
+ });
61
+ }
62
+
63
+ // Helper to map value to percentage width
64
+ // The chart area starts after the info column.
65
+ // But wait, the prompt implies the values 19-81 are the positions.
66
+ // If the grid lines are fixed at 19...81, then the X axis represents this range.
67
+ // So 19 is 0% (or left edge of graph area) and 81 is 100% (or right edge).
68
+ getPercentage(value) {
69
+ const range = this.config.maxVal - this.config.minVal;
70
+ // Clamp value
71
+ const clamped = Math.max(this.config.minVal, Math.min(this.config.maxVal, value));
72
+ return ((clamped - this.config.minVal) / range) * 100;
73
+ }
74
+
75
+ updateRowValue(id, newValue) {
76
+ const row = this.data.find(r => r.id === id);
77
+ if (row) {
78
+ row.value = Math.max(this.config.minVal, Math.min(this.config.maxVal, newValue));
79
+ this.render(); // Re-render to update line and dots
80
+ }
81
+ }
82
+
83
+ render() {
84
+ this.container.innerHTML = '';
85
+
86
+ // 1. Render Background Zones
87
+ this.renderBackgroundZones();
88
+
89
+ // 2. Render Grid Lines
90
+ this.renderGridLines();
91
+
92
+ // 3. Render Content Rows
93
+ const contentLayer = document.createElement('div');
94
+ contentLayer.className = 'chart-content';
95
+ this.data.forEach(row => {
96
+ contentLayer.appendChild(row.render());
97
+ });
98
+ this.container.appendChild(contentLayer);
99
+
100
+ // 4. Render Connecting Line (SVG)
101
+ this.renderLine();
102
+ }
103
+
104
+ renderBackgroundZones() {
105
+ const bgLayer = document.createElement('div');
106
+ bgLayer.className = 'chart-background';
107
+
108
+ // Calculate widths based on boundaries
109
+ // Range: 19 to 81.
110
+ // Zone 1: 19 to 43
111
+ // Zone 2: 43 to 55
112
+ // Zone 3: 55 to 81
113
+
114
+ const width1 = this.getPercentage(this.config.zoneBoundaries[0]);
115
+ const width2 = this.getPercentage(this.config.zoneBoundaries[1]) - width1;
116
+ const width3 = 100 - (width1 + width2);
117
+
118
+ // We need to account for the info column width which is not part of the graph area?
119
+ // Actually, usually in these charts, the grid is the background of the whole row or just the right side?
120
+ // Let's assume the graph area is to the right of the info column.
121
+ // We will use CSS calc or absolute positioning.
122
+ // To make it simple, let's make the background layer only cover the graph area.
123
+ // The graph area width is calc(100% - 200px).
124
+
125
+ bgLayer.style.left = `${this.config.infoColumnWidth}px`;
126
+ bgLayer.style.width = `calc(100% - ${this.config.infoColumnWidth}px)`;
127
+
128
+ const zone1 = document.createElement('div');
129
+ zone1.className = 'zone zone-left';
130
+ zone1.style.width = `${width1}%`;
131
+
132
+ const zone2 = document.createElement('div');
133
+ zone2.className = 'zone zone-mid';
134
+ zone2.style.width = `${width2}%`;
135
+
136
+ const zone3 = document.createElement('div');
137
+ zone3.className = 'zone zone-right';
138
+ zone3.style.width = `${width3}%`;
139
+
140
+ bgLayer.appendChild(zone1);
141
+ bgLayer.appendChild(zone2);
142
+ bgLayer.appendChild(zone3);
143
+
144
+ this.container.appendChild(bgLayer);
145
+ }
146
+
147
+ renderGridLines() {
148
+ const gridLayer = document.createElement('div');
149
+ gridLayer.className = 'grid-lines';
150
+ gridLayer.style.left = `${this.config.infoColumnWidth}px`;
151
+ gridLayer.style.width = `calc(100% - ${this.config.infoColumnWidth}px)`;
152
+
153
+ this.config.gridLines.forEach(val => {
154
+ const line = document.createElement('div');
155
+ line.className = 'grid-line';
156
+ line.style.left = `${this.getPercentage(val)}%`;
157
+
158
+ const label = document.createElement('div');
159
+ label.className = 'grid-label';
160
+ label.innerText = val;
161
+ label.style.left = `${this.getPercentage(val)}%`;
162
+
163
+ gridLayer.appendChild(line);
164
+ gridLayer.appendChild(label);
165
+ });
166
+
167
+ this.container.appendChild(gridLayer);
168
+ }
169
+
170
+ renderLine() {
171
+ const svgLayer = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
172
+ svgLayer.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
173
+ svgLayer.setAttribute('class', 'chart-svg-layer');
174
+ // The SVG covers the whole container, but we need to map points to the graph area.
175
+
176
+ const polyline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');
177
+ polyline.classList.add('chart-polyline');
178
+
179
+ const points = [];
180
+
181
+ // We need the actual width of the graph area to calculate X coordinates in pixels
182
+ // or we can use percentage coordinates if we set viewBox?
183
+ // Let's use getBoundingClientRect for simplicity to get pixels,
184
+ // but that requires the element to be in DOM. It is.
185
+
186
+ // Wait for layout? No, we can just calculate based on percentages if we use percentage in SVG?
187
+ // SVG doesn't support percentage points easily in polyline without viewBox.
188
+ // Let's use a resize observer or just calculate once.
189
+
190
+ const graphAreaWidth = this.container.clientWidth - this.config.infoColumnWidth;
191
+
192
+ this.data.forEach((row, index) => {
193
+ // X calculation
194
+ const pct = this.getPercentage(row.value);
195
+ const x = this.config.infoColumnWidth + (graphAreaWidth * (pct / 100));
196
+
197
+ // Y calculation: headerHeight + (index * rowHeight) + (rowHeight / 2)
198
+ const y = this.config.headerHeight + (index * this.config.rowHeight) + (this.config.rowHeight / 2);
199
+
200
+ points.push(`${x},${y}`);
201
+
202
+ // Draw circle for point
203
+ const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
204
+ circle.classList.add('chart-point');
205
+ circle.setAttribute('cx', x);
206
+ circle.setAttribute('cy', y);
207
+ circle.setAttribute('r', 10); // Increased radius
208
+ circle.setAttribute('fill', '#d32f2f'); // Direct fill color
209
+ circle.setAttribute('stroke', 'white');
210
+ circle.setAttribute('stroke-width', '2');
211
+ circle.style.pointerEvents = 'all'; // Enable pointer events for hover
212
+
213
+ // Add hover events
214
+ circle.addEventListener('mouseover', (e) => this.showTooltip(e, row.value));
215
+ circle.addEventListener('mouseout', () => this.hideTooltip());
216
+
217
+ // Add title for hover (native tooltip as backup)
218
+ const title = document.createElementNS('http://www.w3.org/2000/svg', 'title');
219
+ title.textContent = `Value: ${row.value}`;
220
+ circle.appendChild(title);
221
+
222
+ svgLayer.appendChild(circle);
223
+
224
+ // Draw text for value
225
+ const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
226
+ text.setAttribute('x', x); // Centered horizontally
227
+ text.setAttribute('y', y + 4); // Centered vertically (approx)
228
+ text.textContent = row.value;
229
+ text.setAttribute('fill', 'white'); // White text
230
+ text.setAttribute('font-size', '10px');
231
+ text.setAttribute('font-family', 'sans-serif');
232
+ text.setAttribute('font-weight', 'bold');
233
+ text.setAttribute('text-anchor', 'middle'); // Center text
234
+ text.style.pointerEvents = 'none'; // Let clicks pass through to circle
235
+ svgLayer.appendChild(text);
236
+ });
237
+
238
+ polyline.setAttribute('points', points.join(' '));
239
+ svgLayer.prepend(polyline); // Put line behind points
240
+
241
+ this.container.appendChild(svgLayer);
242
+ }
243
+
244
+ showTooltip(e, value) {
245
+ const span = this.config.valueSpans.find(s => value >= s.min && value <= s.max);
246
+ if (span) {
247
+ this.tooltip.innerText = `${span.text} (${value})`;
248
+ this.tooltip.style.display = 'block';
249
+ this.tooltip.style.left = `${e.pageX + 10}px`;
250
+ this.tooltip.style.top = `${e.pageY + 10}px`;
251
+ }
252
+ }
253
+
254
+ hideTooltip() {
255
+ this.tooltip.style.display = 'none';
256
+ }
257
+ }
@@ -0,0 +1,148 @@
1
+ class CodeViewer {
2
+ constructor(elementOrSelector, code, language = 'javascript') {
3
+ const element = typeof elementOrSelector === 'string'
4
+ ? document.querySelector(elementOrSelector)
5
+ : elementOrSelector;
6
+ if (!element) {
7
+ throw new Error(`CodeViewer: Element not found for selector "${elementOrSelector}"`);
8
+ }
9
+ this.container = element;
10
+ this.code = code;
11
+ this.language = language.toLowerCase();
12
+ this.render();
13
+ }
14
+ highlight(code) {
15
+ switch (this.language) {
16
+ case 'javascript':
17
+ case 'js':
18
+ return this.highlightJavaScript(code);
19
+ case 'html':
20
+ return this.highlightHTML(code);
21
+ case 'css':
22
+ return this.highlightCSS(code);
23
+ default:
24
+ return this.escape(code);
25
+ }
26
+ }
27
+ escape(str) {
28
+ return str
29
+ .replace(/&/g, '&amp;')
30
+ .replace(/</g, '&lt;')
31
+ .replace(/>/g, '&gt;')
32
+ .replace(/"/g, '&quot;')
33
+ .replace(/'/g, '&#039;');
34
+ }
35
+ highlightJavaScript(code) {
36
+ const strings = [];
37
+ code = code.replace(/`(?:[^`\\]|\\[\s\S])*`/g, (match) => {
38
+ strings.push(match);
39
+ return `###STRING${strings.length - 1}###`;
40
+ });
41
+ code = code.replace(/"(?:[^"\\]|\\[\s\S])*"/g, (match) => {
42
+ strings.push(match);
43
+ return `###STRING${strings.length - 1}###`;
44
+ });
45
+ code = code.replace(/'(?:[^'\\]|\\[\s\S])*'/g, (match) => {
46
+ strings.push(match);
47
+ return `###STRING${strings.length - 1}###`;
48
+ });
49
+ const comments = [];
50
+ code = code.replace(/(\/\/.*$)/gm, (match) => {
51
+ comments.push(match);
52
+ return `###COMMENT${comments.length - 1}###`;
53
+ });
54
+ code = code.replace(/(\/\*[\s\S]*?\*\/)/g, (match) => {
55
+ comments.push(match);
56
+ return `###COMMENT${comments.length - 1}###`;
57
+ });
58
+ code = this.escape(code);
59
+ const keywords = 'const|let|var|function|class|if|else|for|while|return|new|this|super|extends|import|export|from|default|async|await|try|catch|throw|switch|case|break|continue';
60
+ code = code.replace(new RegExp(`\\b(${keywords})\\b`, 'g'), '<span class="keyword">$1</span>');
61
+ code = code.replace(/\b(\d+(?:\.\d+)?)\b/g, '<span class="number">$1</span>');
62
+ strings.forEach((str, i) => {
63
+ code = code.replace(`###STRING${i}###`, '<span class="string">' + this.escape(str) + '</span>');
64
+ });
65
+ comments.forEach((comment, i) => {
66
+ code = code.replace(`###COMMENT${i}###`, '<span class="comment">' + this.escape(comment) + '</span>');
67
+ });
68
+ return code;
69
+ }
70
+ highlightHTML(code) {
71
+ code = this.escape(code);
72
+ code = code.replace(/(&lt;!--[\s\S]*?--&gt;)/g, '###COMMENT_START###$1###COMMENT_END###');
73
+ code = code.replace(/(&lt;\/?)([a-zA-Z0-9]+)([^&]*?)(&gt;)/g, (match, open, tagName, attrs, close) => {
74
+ attrs = attrs.replace(/\s+([a-zA-Z-]+)(=?)(&quot;[^&]*?&quot;|&#039;[^&]*?&#039;)?/g, (m, attrName, eq, attrValue) => {
75
+ let result = ' <span class="attribute">' + attrName + '</span>';
76
+ if (eq)
77
+ result += eq;
78
+ if (attrValue)
79
+ result += '<span class="string">' + attrValue + '</span>';
80
+ return result;
81
+ });
82
+ return open + '<span class="tag">' + tagName + '</span>' + attrs + '<span class="punctuation">' + close + '</span>';
83
+ });
84
+ code = code.replace(/###COMMENT_START###(.*?)###COMMENT_END###/g, '<span class="comment">$1</span>');
85
+ return code;
86
+ }
87
+ highlightCSS(code) {
88
+ code = this.escape(code);
89
+ const comments = [];
90
+ code = code.replace(/(\/\*[\s\S]*?\*\/)/g, (match) => {
91
+ comments.push(match);
92
+ return `###COMMENT${comments.length - 1}###`;
93
+ });
94
+ const strings = [];
95
+ code = code.replace(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/g, (match) => {
96
+ strings.push(match);
97
+ return `###STRING${strings.length - 1}###`;
98
+ });
99
+ code = code.replace(/^([^{]+)(?={)/gm, (match) => {
100
+ return '<span class="selector">' + match.trim() + '</span>';
101
+ });
102
+ code = code.replace(/([a-z-]+)(\s*):/gi, '<span class="property">$1</span>$2:');
103
+ code = code.replace(/:\s*([0-9.]+(?:px|em|rem|%|vh|vw|s|ms)?)/g, ': <span class="number">$1</span>');
104
+ strings.forEach((str, i) => {
105
+ code = code.replace(`###STRING${i}###`, '<span class="string">' + str + '</span>');
106
+ });
107
+ comments.forEach((comment, i) => {
108
+ code = code.replace(`###COMMENT${i}###`, '<span class="comment">' + comment + '</span>');
109
+ });
110
+ return code;
111
+ }
112
+ async copyCode() {
113
+ try {
114
+ await navigator.clipboard.writeText(this.code);
115
+ const btn = this.container.querySelector('.copy-button');
116
+ if (!btn)
117
+ return;
118
+ btn.textContent = 'copied!';
119
+ btn.classList.add('copied');
120
+ setTimeout(() => {
121
+ btn.textContent = 'Copy';
122
+ btn.classList.remove('copied');
123
+ }, 2000);
124
+ }
125
+ catch (err) {
126
+ console.error('Error:', err);
127
+ }
128
+ }
129
+ render() {
130
+ const highlighted = this.highlight(this.code);
131
+ this.container.innerHTML = `
132
+ <div class="code-display">
133
+ <div class="code-header">
134
+ <span class="code-language">${this.language}</span>
135
+ <button class="copy-button">Copy</button>
136
+ </div>
137
+ <div class="code-content">
138
+ <pre>${highlighted}</pre>
139
+ </div>
140
+ </div>
141
+ `;
142
+ const copyButton = this.container.querySelector('.copy-button');
143
+ if (copyButton) {
144
+ copyButton.addEventListener('click', () => this.copyCode());
145
+ }
146
+ }
147
+ }
148
+ export { CodeViewer };