@hortonstudio/main 1.2.11 → 1.2.13

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 (489) hide show
  1. package/index.js +23 -10
  2. package/package.json +17 -6
  3. package/.claude/settings.local.json +0 -21
  4. package/animations/hero.js +0 -599
  5. package/animations/text.js +0 -369
  6. package/animations/transition.js +0 -57
  7. package/attributes-master/.changeset/README.md +0 -8
  8. package/attributes-master/.changeset/config.json +0 -11
  9. package/attributes-master/.gitattributes +0 -2
  10. package/attributes-master/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
  11. package/attributes-master/.github/ISSUE_TEMPLATE/feature_request.md +0 -22
  12. package/attributes-master/.github/workflows/ci.yml +0 -66
  13. package/attributes-master/.github/workflows/release.yml +0 -40
  14. package/attributes-master/.prettierignore +0 -3
  15. package/attributes-master/.prettierrc +0 -8
  16. package/attributes-master/.vscode/extensions.json +0 -3
  17. package/attributes-master/.vscode/settings.json +0 -7
  18. package/attributes-master/CONTRIBUTING.md +0 -72
  19. package/attributes-master/LICENSE.md +0 -201
  20. package/attributes-master/README.md +0 -31
  21. package/attributes-master/eslint.config.js +0 -3
  22. package/attributes-master/package.json +0 -34
  23. package/attributes-master/packages/accordion/CHANGELOG.md +0 -89
  24. package/attributes-master/packages/accordion/README.md +0 -31
  25. package/attributes-master/packages/accordion/package.json +0 -25
  26. package/attributes-master/packages/accordion/src/actions/a11y.ts +0 -39
  27. package/attributes-master/packages/accordion/src/actions/classes.ts +0 -27
  28. package/attributes-master/packages/accordion/src/actions/content.ts +0 -42
  29. package/attributes-master/packages/accordion/src/actions/list.ts +0 -36
  30. package/attributes-master/packages/accordion/src/actions/query.ts +0 -27
  31. package/attributes-master/packages/accordion/src/actions/settings.ts +0 -61
  32. package/attributes-master/packages/accordion/src/factory.ts +0 -145
  33. package/attributes-master/packages/accordion/src/index.ts +0 -3
  34. package/attributes-master/packages/accordion/src/init.ts +0 -37
  35. package/attributes-master/packages/accordion/src/utils/constants.ts +0 -62
  36. package/attributes-master/packages/accordion/src/utils/helpers.ts +0 -5
  37. package/attributes-master/packages/accordion/src/utils/selectors.ts +0 -12
  38. package/attributes-master/packages/accordion/src/utils/types.ts +0 -23
  39. package/attributes-master/packages/accordion/tsconfig.json +0 -3
  40. package/attributes-master/packages/attributes/CHANGELOG.md +0 -564
  41. package/attributes-master/packages/attributes/README.md +0 -66
  42. package/attributes-master/packages/attributes/bin/build.ts +0 -107
  43. package/attributes-master/packages/attributes/bin/live-reload.js +0 -1
  44. package/attributes-master/packages/attributes/package.json +0 -77
  45. package/attributes-master/packages/attributes/playwright.config.ts +0 -89
  46. package/attributes-master/packages/attributes/src/attributes.ts +0 -153
  47. package/attributes-master/packages/attributes/src/load.ts +0 -125
  48. package/attributes-master/packages/attributes/tests/accordion.spec.ts +0 -137
  49. package/attributes-master/packages/attributes/tests/codehighlight.spec.ts +0 -23
  50. package/attributes-master/packages/attributes/tests/combobox.spec.ts +0 -321
  51. package/attributes-master/packages/attributes/tests/copyclip.spec.ts +0 -19
  52. package/attributes-master/packages/attributes/tests/displayvalues.spec.ts +0 -48
  53. package/attributes-master/packages/attributes/tests/favcustom.spec.ts +0 -23
  54. package/attributes-master/packages/attributes/tests/inject.spec.ts +0 -40
  55. package/attributes-master/packages/attributes/tests/inputactive.spec.ts +0 -77
  56. package/attributes-master/packages/attributes/tests/inputcounter.spec.ts +0 -83
  57. package/attributes-master/packages/attributes/tests/list.spec.ts +0 -800
  58. package/attributes-master/packages/attributes/tests/mirrorclick.spec.ts +0 -22
  59. package/attributes-master/packages/attributes/tests/mirrorinput.spec.ts +0 -37
  60. package/attributes-master/packages/attributes/tests/modal.spec.ts +0 -34
  61. package/attributes-master/packages/attributes/tests/numbercount.spec.ts +0 -40
  62. package/attributes-master/packages/attributes/tests/readtime.spec.ts +0 -19
  63. package/attributes-master/packages/attributes/tests/selectcustom.spec.ts +0 -51
  64. package/attributes-master/packages/attributes/tests/socialshare.spec.ts +0 -54
  65. package/attributes-master/packages/attributes/tests/starrating.spec.ts +0 -79
  66. package/attributes-master/packages/attributes/tests/toc.spec.ts +0 -38
  67. package/attributes-master/packages/attributes/tests/utils/index.ts +0 -16
  68. package/attributes-master/packages/attributes/tsconfig.json +0 -6
  69. package/attributes-master/packages/autovideo/CHANGELOG.md +0 -182
  70. package/attributes-master/packages/autovideo/README.md +0 -31
  71. package/attributes-master/packages/autovideo/package.json +0 -22
  72. package/attributes-master/packages/autovideo/src/index.ts +0 -3
  73. package/attributes-master/packages/autovideo/src/init.ts +0 -52
  74. package/attributes-master/packages/autovideo/src/types.ts +0 -5
  75. package/attributes-master/packages/autovideo/src/utils/constants.ts +0 -4
  76. package/attributes-master/packages/autovideo/tsconfig.json +0 -3
  77. package/attributes-master/packages/codehighlight/CHANGELOG.md +0 -185
  78. package/attributes-master/packages/codehighlight/README.md +0 -27
  79. package/attributes-master/packages/codehighlight/package.json +0 -23
  80. package/attributes-master/packages/codehighlight/src/actions/import.ts +0 -50
  81. package/attributes-master/packages/codehighlight/src/index.ts +0 -3
  82. package/attributes-master/packages/codehighlight/src/init.ts +0 -53
  83. package/attributes-master/packages/codehighlight/src/utils/constants.ts +0 -24
  84. package/attributes-master/packages/codehighlight/src/utils/selectors.ts +0 -5
  85. package/attributes-master/packages/codehighlight/src/utils/themes.ts +0 -202
  86. package/attributes-master/packages/codehighlight/tsconfig.json +0 -3
  87. package/attributes-master/packages/combobox/CHANGELOG.md +0 -99
  88. package/attributes-master/packages/combobox/README.md +0 -27
  89. package/attributes-master/packages/combobox/package.json +0 -23
  90. package/attributes-master/packages/combobox/src/actions/a11y.ts +0 -29
  91. package/attributes-master/packages/combobox/src/actions/body/index.ts +0 -12
  92. package/attributes-master/packages/combobox/src/actions/clearDropdown/index.ts +0 -37
  93. package/attributes-master/packages/combobox/src/actions/dropdownList/index.ts +0 -220
  94. package/attributes-master/packages/combobox/src/actions/dropdownToggle/index.ts +0 -34
  95. package/attributes-master/packages/combobox/src/actions/events.ts +0 -75
  96. package/attributes-master/packages/combobox/src/actions/input/index.ts +0 -235
  97. package/attributes-master/packages/combobox/src/actions/observe.ts +0 -158
  98. package/attributes-master/packages/combobox/src/actions/populate.ts +0 -97
  99. package/attributes-master/packages/combobox/src/actions/selectElement/index.ts +0 -23
  100. package/attributes-master/packages/combobox/src/actions/settings.ts +0 -134
  101. package/attributes-master/packages/combobox/src/actions/state.ts +0 -34
  102. package/attributes-master/packages/combobox/src/index.ts +0 -3
  103. package/attributes-master/packages/combobox/src/init.ts +0 -52
  104. package/attributes-master/packages/combobox/src/utils/constants.ts +0 -48
  105. package/attributes-master/packages/combobox/src/utils/dropdowns.ts +0 -120
  106. package/attributes-master/packages/combobox/src/utils/index.ts +0 -1
  107. package/attributes-master/packages/combobox/src/utils/selectors.ts +0 -9
  108. package/attributes-master/packages/combobox/src/utils/types.ts +0 -14
  109. package/attributes-master/packages/combobox/tsconfig.json +0 -3
  110. package/attributes-master/packages/copyclip/CHANGELOG.md +0 -213
  111. package/attributes-master/packages/copyclip/README.md +0 -27
  112. package/attributes-master/packages/copyclip/package.json +0 -23
  113. package/attributes-master/packages/copyclip/src/factory.ts +0 -67
  114. package/attributes-master/packages/copyclip/src/index.ts +0 -3
  115. package/attributes-master/packages/copyclip/src/init.ts +0 -68
  116. package/attributes-master/packages/copyclip/src/utils/constants.ts +0 -40
  117. package/attributes-master/packages/copyclip/src/utils/selectors.ts +0 -9
  118. package/attributes-master/packages/copyclip/tsconfig.json +0 -3
  119. package/attributes-master/packages/displayvalues/CHANGELOG.md +0 -164
  120. package/attributes-master/packages/displayvalues/README.md +0 -27
  121. package/attributes-master/packages/displayvalues/package.json +0 -22
  122. package/attributes-master/packages/displayvalues/src/actions/collect.ts +0 -17
  123. package/attributes-master/packages/displayvalues/src/actions/events.ts +0 -22
  124. package/attributes-master/packages/displayvalues/src/actions/sync.ts +0 -23
  125. package/attributes-master/packages/displayvalues/src/index.ts +0 -3
  126. package/attributes-master/packages/displayvalues/src/init.ts +0 -31
  127. package/attributes-master/packages/displayvalues/src/utils/constants.ts +0 -20
  128. package/attributes-master/packages/displayvalues/src/utils/selectors.ts +0 -9
  129. package/attributes-master/packages/displayvalues/src/utils/stores.ts +0 -3
  130. package/attributes-master/packages/displayvalues/tsconfig.json +0 -3
  131. package/attributes-master/packages/docs/CHANGELOG.md +0 -108
  132. package/attributes-master/packages/docs/README.md +0 -3
  133. package/attributes-master/packages/docs/bin/build.js +0 -92
  134. package/attributes-master/packages/docs/bin/live-reload.js +0 -1
  135. package/attributes-master/packages/docs/package.json +0 -40
  136. package/attributes-master/packages/docs/src/copy.ts +0 -260
  137. package/attributes-master/packages/docs/src/x-ray.ts +0 -377
  138. package/attributes-master/packages/docs/tsconfig.json +0 -3
  139. package/attributes-master/packages/favcustom/CHANGELOG.md +0 -194
  140. package/attributes-master/packages/favcustom/README.md +0 -27
  141. package/attributes-master/packages/favcustom/package.json +0 -22
  142. package/attributes-master/packages/favcustom/src/index.ts +0 -3
  143. package/attributes-master/packages/favcustom/src/init.ts +0 -30
  144. package/attributes-master/packages/favcustom/src/utils/constants.ts +0 -10
  145. package/attributes-master/packages/favcustom/src/utils/selectors.ts +0 -5
  146. package/attributes-master/packages/favcustom/tsconfig.json +0 -3
  147. package/attributes-master/packages/formsubmit/CHANGELOG.md +0 -161
  148. package/attributes-master/packages/formsubmit/README.md +0 -51
  149. package/attributes-master/packages/formsubmit/package.json +0 -22
  150. package/attributes-master/packages/formsubmit/src/actions/redirect.ts +0 -9
  151. package/attributes-master/packages/formsubmit/src/actions/reset.ts +0 -49
  152. package/attributes-master/packages/formsubmit/src/actions/submit.ts +0 -34
  153. package/attributes-master/packages/formsubmit/src/components/Form.ts +0 -231
  154. package/attributes-master/packages/formsubmit/src/factory.ts +0 -62
  155. package/attributes-master/packages/formsubmit/src/index.ts +0 -3
  156. package/attributes-master/packages/formsubmit/src/init.ts +0 -24
  157. package/attributes-master/packages/formsubmit/src/utils/attributes.ts +0 -19
  158. package/attributes-master/packages/formsubmit/src/utils/constants.ts +0 -89
  159. package/attributes-master/packages/formsubmit/src/utils/dom.ts +0 -76
  160. package/attributes-master/packages/formsubmit/src/utils/selectors.ts +0 -9
  161. package/attributes-master/packages/formsubmit/src/utils/types.ts +0 -7
  162. package/attributes-master/packages/formsubmit/tsconfig.json +0 -3
  163. package/attributes-master/packages/inject/CHANGELOG.md +0 -117
  164. package/attributes-master/packages/inject/README.md +0 -60
  165. package/attributes-master/packages/inject/package.json +0 -22
  166. package/attributes-master/packages/inject/src/actions/collect.ts +0 -125
  167. package/attributes-master/packages/inject/src/actions/css.ts +0 -27
  168. package/attributes-master/packages/inject/src/actions/prefetch.ts +0 -44
  169. package/attributes-master/packages/inject/src/factory.ts +0 -123
  170. package/attributes-master/packages/inject/src/index.ts +0 -3
  171. package/attributes-master/packages/inject/src/init.ts +0 -22
  172. package/attributes-master/packages/inject/src/utils/constants.ts +0 -89
  173. package/attributes-master/packages/inject/src/utils/helpers.ts +0 -36
  174. package/attributes-master/packages/inject/src/utils/selectors.ts +0 -9
  175. package/attributes-master/packages/inject/src/utils/types.ts +0 -16
  176. package/attributes-master/packages/inject/tsconfig.json +0 -3
  177. package/attributes-master/packages/inputactive/CHANGELOG.md +0 -58
  178. package/attributes-master/packages/inputactive/README.md +0 -25
  179. package/attributes-master/packages/inputactive/package.json +0 -22
  180. package/attributes-master/packages/inputactive/src/actions/classes.ts +0 -43
  181. package/attributes-master/packages/inputactive/src/factory.ts +0 -24
  182. package/attributes-master/packages/inputactive/src/index.ts +0 -3
  183. package/attributes-master/packages/inputactive/src/init.ts +0 -18
  184. package/attributes-master/packages/inputactive/src/utils/constants.ts +0 -13
  185. package/attributes-master/packages/inputactive/src/utils/selectors.ts +0 -5
  186. package/attributes-master/packages/inputactive/tsconfig.json +0 -3
  187. package/attributes-master/packages/inputcounter/CHANGELOG.md +0 -110
  188. package/attributes-master/packages/inputcounter/README.md +0 -25
  189. package/attributes-master/packages/inputcounter/package.json +0 -22
  190. package/attributes-master/packages/inputcounter/src/actions/a11y.ts +0 -23
  191. package/attributes-master/packages/inputcounter/src/actions/buttons.ts +0 -61
  192. package/attributes-master/packages/inputcounter/src/actions/input.ts +0 -31
  193. package/attributes-master/packages/inputcounter/src/actions/style.ts +0 -12
  194. package/attributes-master/packages/inputcounter/src/factory.ts +0 -51
  195. package/attributes-master/packages/inputcounter/src/index.ts +0 -3
  196. package/attributes-master/packages/inputcounter/src/init.ts +0 -22
  197. package/attributes-master/packages/inputcounter/src/utils/constants.ts +0 -59
  198. package/attributes-master/packages/inputcounter/src/utils/selectors.ts +0 -9
  199. package/attributes-master/packages/inputcounter/tsconfig.json +0 -3
  200. package/attributes-master/packages/list/CHANGELOG.md +0 -185
  201. package/attributes-master/packages/list/README.md +0 -331
  202. package/attributes-master/packages/list/package.json +0 -37
  203. package/attributes-master/packages/list/src/combine/index.ts +0 -38
  204. package/attributes-master/packages/list/src/components/List.ts +0 -861
  205. package/attributes-master/packages/list/src/components/ListItem.ts +0 -229
  206. package/attributes-master/packages/list/src/components/index.ts +0 -2
  207. package/attributes-master/packages/list/src/factory.ts +0 -130
  208. package/attributes-master/packages/list/src/filter/dynamic/conditions.ts +0 -639
  209. package/attributes-master/packages/list/src/filter/dynamic/groups.ts +0 -221
  210. package/attributes-master/packages/list/src/filter/dynamic/index.ts +0 -119
  211. package/attributes-master/packages/list/src/filter/dynamic/utils.ts +0 -44
  212. package/attributes-master/packages/list/src/filter/elements.ts +0 -93
  213. package/attributes-master/packages/list/src/filter/filter.ts +0 -118
  214. package/attributes-master/packages/list/src/filter/filter.worker.ts +0 -152
  215. package/attributes-master/packages/list/src/filter/index.ts +0 -94
  216. package/attributes-master/packages/list/src/filter/standard/conditions.ts +0 -123
  217. package/attributes-master/packages/list/src/filter/standard/facets.ts +0 -253
  218. package/attributes-master/packages/list/src/filter/standard/index.ts +0 -176
  219. package/attributes-master/packages/list/src/filter/standard/query.ts +0 -111
  220. package/attributes-master/packages/list/src/filter/tags.ts +0 -314
  221. package/attributes-master/packages/list/src/filter/types.ts +0 -62
  222. package/attributes-master/packages/list/src/filter/utils.ts +0 -126
  223. package/attributes-master/packages/list/src/index.ts +0 -4
  224. package/attributes-master/packages/list/src/init.ts +0 -38
  225. package/attributes-master/packages/list/src/load/all.ts +0 -27
  226. package/attributes-master/packages/list/src/load/elements.ts +0 -39
  227. package/attributes-master/packages/list/src/load/index.ts +0 -63
  228. package/attributes-master/packages/list/src/load/infinite.ts +0 -79
  229. package/attributes-master/packages/list/src/load/load.ts +0 -191
  230. package/attributes-master/packages/list/src/load/more.ts +0 -97
  231. package/attributes-master/packages/list/src/load/pagination.ts +0 -402
  232. package/attributes-master/packages/list/src/nest/index.ts +0 -198
  233. package/attributes-master/packages/list/src/prevnext/index.ts +0 -98
  234. package/attributes-master/packages/list/src/select/index.ts +0 -56
  235. package/attributes-master/packages/list/src/slider/index.ts +0 -62
  236. package/attributes-master/packages/list/src/sort/buttons.ts +0 -96
  237. package/attributes-master/packages/list/src/sort/dropdown.ts +0 -179
  238. package/attributes-master/packages/list/src/sort/index.ts +0 -81
  239. package/attributes-master/packages/list/src/sort/query.ts +0 -63
  240. package/attributes-master/packages/list/src/sort/select.ts +0 -67
  241. package/attributes-master/packages/list/src/sort/sort.ts +0 -79
  242. package/attributes-master/packages/list/src/sort/types.ts +0 -28
  243. package/attributes-master/packages/list/src/static/index.ts +0 -73
  244. package/attributes-master/packages/list/src/tabs/index.ts +0 -97
  245. package/attributes-master/packages/list/src/utils/constants.ts +0 -728
  246. package/attributes-master/packages/list/src/utils/dom.ts +0 -108
  247. package/attributes-master/packages/list/src/utils/pagination.ts +0 -14
  248. package/attributes-master/packages/list/src/utils/selectors.ts +0 -18
  249. package/attributes-master/packages/list/src/utils/store.ts +0 -5
  250. package/attributes-master/packages/list/tsconfig.json +0 -3
  251. package/attributes-master/packages/mirrorclick/CHANGELOG.md +0 -171
  252. package/attributes-master/packages/mirrorclick/README.md +0 -25
  253. package/attributes-master/packages/mirrorclick/package.json +0 -22
  254. package/attributes-master/packages/mirrorclick/src/index.ts +0 -3
  255. package/attributes-master/packages/mirrorclick/src/init.ts +0 -35
  256. package/attributes-master/packages/mirrorclick/src/utils/constants.ts +0 -20
  257. package/attributes-master/packages/mirrorclick/src/utils/selectors.ts +0 -9
  258. package/attributes-master/packages/mirrorclick/tsconfig.json +0 -3
  259. package/attributes-master/packages/mirrorinput/CHANGELOG.md +0 -172
  260. package/attributes-master/packages/mirrorinput/README.md +0 -25
  261. package/attributes-master/packages/mirrorinput/package.json +0 -22
  262. package/attributes-master/packages/mirrorinput/src/index.ts +0 -3
  263. package/attributes-master/packages/mirrorinput/src/init.ts +0 -48
  264. package/attributes-master/packages/mirrorinput/src/utils/constants.ts +0 -15
  265. package/attributes-master/packages/mirrorinput/src/utils/selectors.ts +0 -9
  266. package/attributes-master/packages/mirrorinput/tsconfig.json +0 -3
  267. package/attributes-master/packages/modal/CHANGELOG.md +0 -94
  268. package/attributes-master/packages/modal/README.md +0 -29
  269. package/attributes-master/packages/modal/package.json +0 -23
  270. package/attributes-master/packages/modal/src/actions/a11y.ts +0 -46
  271. package/attributes-master/packages/modal/src/actions/modal.ts +0 -164
  272. package/attributes-master/packages/modal/src/actions/settings.ts +0 -21
  273. package/attributes-master/packages/modal/src/factory.ts +0 -26
  274. package/attributes-master/packages/modal/src/index.ts +0 -3
  275. package/attributes-master/packages/modal/src/init.ts +0 -22
  276. package/attributes-master/packages/modal/src/utils/constants.ts +0 -54
  277. package/attributes-master/packages/modal/src/utils/selectors.ts +0 -9
  278. package/attributes-master/packages/modal/src/utils/types.ts +0 -12
  279. package/attributes-master/packages/modal/tsconfig.json +0 -3
  280. package/attributes-master/packages/numbercount/CHANGELOG.md +0 -90
  281. package/attributes-master/packages/numbercount/README.md +0 -27
  282. package/attributes-master/packages/numbercount/package.json +0 -23
  283. package/attributes-master/packages/numbercount/src/actions/a11y.ts +0 -26
  284. package/attributes-master/packages/numbercount/src/actions/animate.ts +0 -43
  285. package/attributes-master/packages/numbercount/src/actions/observe.ts +0 -44
  286. package/attributes-master/packages/numbercount/src/factory.ts +0 -31
  287. package/attributes-master/packages/numbercount/src/index.ts +0 -3
  288. package/attributes-master/packages/numbercount/src/init.ts +0 -22
  289. package/attributes-master/packages/numbercount/src/utils/constants.ts +0 -40
  290. package/attributes-master/packages/numbercount/src/utils/helpers.ts +0 -31
  291. package/attributes-master/packages/numbercount/src/utils/selectors.ts +0 -9
  292. package/attributes-master/packages/numbercount/tsconfig.json +0 -3
  293. package/attributes-master/packages/queryparam/CHANGELOG.md +0 -118
  294. package/attributes-master/packages/queryparam/README.md +0 -25
  295. package/attributes-master/packages/queryparam/package.json +0 -22
  296. package/attributes-master/packages/queryparam/src/factory.ts +0 -51
  297. package/attributes-master/packages/queryparam/src/index.ts +0 -3
  298. package/attributes-master/packages/queryparam/src/init.ts +0 -40
  299. package/attributes-master/packages/queryparam/src/utils/constants.ts +0 -18
  300. package/attributes-master/packages/queryparam/src/utils/selectors.ts +0 -5
  301. package/attributes-master/packages/queryparam/tsconfig.json +0 -3
  302. package/attributes-master/packages/rangeslider/CHANGELOG.md +0 -236
  303. package/attributes-master/packages/rangeslider/README.md +0 -95
  304. package/attributes-master/packages/rangeslider/package.json +0 -23
  305. package/attributes-master/packages/rangeslider/src/actions/a11y.ts +0 -21
  306. package/attributes-master/packages/rangeslider/src/actions/events.ts +0 -9
  307. package/attributes-master/packages/rangeslider/src/actions/settings.ts +0 -97
  308. package/attributes-master/packages/rangeslider/src/actions/styles.ts +0 -10
  309. package/attributes-master/packages/rangeslider/src/actions/values.ts +0 -47
  310. package/attributes-master/packages/rangeslider/src/components/Fill.ts +0 -70
  311. package/attributes-master/packages/rangeslider/src/components/Handle.ts +0 -281
  312. package/attributes-master/packages/rangeslider/src/factory.ts +0 -100
  313. package/attributes-master/packages/rangeslider/src/index.ts +0 -3
  314. package/attributes-master/packages/rangeslider/src/init.ts +0 -194
  315. package/attributes-master/packages/rangeslider/src/utils/constants.ts +0 -87
  316. package/attributes-master/packages/rangeslider/src/utils/selectors.ts +0 -9
  317. package/attributes-master/packages/rangeslider/src/utils/types.ts +0 -6
  318. package/attributes-master/packages/rangeslider/tsconfig.json +0 -3
  319. package/attributes-master/packages/readtime/CHANGELOG.md +0 -108
  320. package/attributes-master/packages/readtime/README.md +0 -25
  321. package/attributes-master/packages/readtime/package.json +0 -22
  322. package/attributes-master/packages/readtime/src/factory.ts +0 -21
  323. package/attributes-master/packages/readtime/src/index.ts +0 -3
  324. package/attributes-master/packages/readtime/src/init.ts +0 -19
  325. package/attributes-master/packages/readtime/src/utils/constants.ts +0 -33
  326. package/attributes-master/packages/readtime/src/utils/selectors.ts +0 -9
  327. package/attributes-master/packages/readtime/tsconfig.json +0 -3
  328. package/attributes-master/packages/removequery/CHANGELOG.md +0 -8
  329. package/attributes-master/packages/removequery/README.md +0 -25
  330. package/attributes-master/packages/removequery/package.json +0 -22
  331. package/attributes-master/packages/removequery/src/index.ts +0 -3
  332. package/attributes-master/packages/removequery/src/init.ts +0 -18
  333. package/attributes-master/packages/removequery/src/utils/constants.ts +0 -5
  334. package/attributes-master/packages/removequery/tsconfig.json +0 -3
  335. package/attributes-master/packages/scrolldisable/CHANGELOG.md +0 -164
  336. package/attributes-master/packages/scrolldisable/README.md +0 -29
  337. package/attributes-master/packages/scrolldisable/package.json +0 -27
  338. package/attributes-master/packages/scrolldisable/src/click.ts +0 -40
  339. package/attributes-master/packages/scrolldisable/src/display.ts +0 -117
  340. package/attributes-master/packages/scrolldisable/src/index.ts +0 -3
  341. package/attributes-master/packages/scrolldisable/src/init.ts +0 -36
  342. package/attributes-master/packages/scrolldisable/src/scroll.ts +0 -63
  343. package/attributes-master/packages/scrolldisable/src/utils/constants.ts +0 -56
  344. package/attributes-master/packages/scrolldisable/src/utils/selectors.ts +0 -6
  345. package/attributes-master/packages/scrolldisable/tsconfig.json +0 -3
  346. package/attributes-master/packages/selectcustom/CHANGELOG.md +0 -242
  347. package/attributes-master/packages/selectcustom/README.md +0 -25
  348. package/attributes-master/packages/selectcustom/package.json +0 -23
  349. package/attributes-master/packages/selectcustom/src/actions/a11y.ts +0 -29
  350. package/attributes-master/packages/selectcustom/src/actions/events.ts +0 -159
  351. package/attributes-master/packages/selectcustom/src/actions/observe.ts +0 -83
  352. package/attributes-master/packages/selectcustom/src/actions/populate.ts +0 -67
  353. package/attributes-master/packages/selectcustom/src/actions/settings.ts +0 -68
  354. package/attributes-master/packages/selectcustom/src/actions/state.ts +0 -41
  355. package/attributes-master/packages/selectcustom/src/index.ts +0 -3
  356. package/attributes-master/packages/selectcustom/src/init.ts +0 -51
  357. package/attributes-master/packages/selectcustom/src/utils/constants.ts +0 -34
  358. package/attributes-master/packages/selectcustom/src/utils/selectors.ts +0 -9
  359. package/attributes-master/packages/selectcustom/src/utils/types.ts +0 -14
  360. package/attributes-master/packages/selectcustom/tsconfig.json +0 -3
  361. package/attributes-master/packages/sliderdots/CHANGELOG.md +0 -220
  362. package/attributes-master/packages/sliderdots/README.md +0 -27
  363. package/attributes-master/packages/sliderdots/package.json +0 -22
  364. package/attributes-master/packages/sliderdots/src/actions/events.ts +0 -26
  365. package/attributes-master/packages/sliderdots/src/actions/observe.ts +0 -40
  366. package/attributes-master/packages/sliderdots/src/actions/populate.ts +0 -46
  367. package/attributes-master/packages/sliderdots/src/actions/sync.ts +0 -28
  368. package/attributes-master/packages/sliderdots/src/actions/wait.ts +0 -28
  369. package/attributes-master/packages/sliderdots/src/factory.ts +0 -57
  370. package/attributes-master/packages/sliderdots/src/index.ts +0 -3
  371. package/attributes-master/packages/sliderdots/src/init.ts +0 -30
  372. package/attributes-master/packages/sliderdots/src/utils/constants.ts +0 -33
  373. package/attributes-master/packages/sliderdots/src/utils/selectors.ts +0 -9
  374. package/attributes-master/packages/sliderdots/src/utils/types.ts +0 -7
  375. package/attributes-master/packages/sliderdots/tsconfig.json +0 -3
  376. package/attributes-master/packages/smartlightbox/CHANGELOG.md +0 -203
  377. package/attributes-master/packages/smartlightbox/README.md +0 -25
  378. package/attributes-master/packages/smartlightbox/package.json +0 -22
  379. package/attributes-master/packages/smartlightbox/src/actions/collect.ts +0 -15
  380. package/attributes-master/packages/smartlightbox/src/actions/move.ts +0 -25
  381. package/attributes-master/packages/smartlightbox/src/index.ts +0 -3
  382. package/attributes-master/packages/smartlightbox/src/init.ts +0 -61
  383. package/attributes-master/packages/smartlightbox/src/utils/constants.ts +0 -31
  384. package/attributes-master/packages/smartlightbox/src/utils/selectors.ts +0 -9
  385. package/attributes-master/packages/smartlightbox/tsconfig.json +0 -3
  386. package/attributes-master/packages/socialshare/CHANGELOG.md +0 -170
  387. package/attributes-master/packages/socialshare/README.md +0 -25
  388. package/attributes-master/packages/socialshare/package.json +0 -25
  389. package/attributes-master/packages/socialshare/src/actions/collect.ts +0 -93
  390. package/attributes-master/packages/socialshare/src/actions/share.ts +0 -91
  391. package/attributes-master/packages/socialshare/src/actions/trigger.ts +0 -46
  392. package/attributes-master/packages/socialshare/src/factory.ts +0 -149
  393. package/attributes-master/packages/socialshare/src/index.ts +0 -3
  394. package/attributes-master/packages/socialshare/src/init.ts +0 -35
  395. package/attributes-master/packages/socialshare/src/utils/constants.ts +0 -94
  396. package/attributes-master/packages/socialshare/src/utils/dom.ts +0 -8
  397. package/attributes-master/packages/socialshare/src/utils/selectors.ts +0 -6
  398. package/attributes-master/packages/socialshare/src/utils/stores.ts +0 -10
  399. package/attributes-master/packages/socialshare/src/utils/types.ts +0 -34
  400. package/attributes-master/packages/socialshare/tsconfig.json +0 -3
  401. package/attributes-master/packages/starrating/CHANGELOG.md +0 -70
  402. package/attributes-master/packages/starrating/README.md +0 -25
  403. package/attributes-master/packages/starrating/package.json +0 -22
  404. package/attributes-master/packages/starrating/src/actions/classes.ts +0 -41
  405. package/attributes-master/packages/starrating/src/actions/events.ts +0 -80
  406. package/attributes-master/packages/starrating/src/factory.ts +0 -24
  407. package/attributes-master/packages/starrating/src/index.ts +0 -3
  408. package/attributes-master/packages/starrating/src/init.ts +0 -24
  409. package/attributes-master/packages/starrating/src/utils/constants.ts +0 -20
  410. package/attributes-master/packages/starrating/src/utils/helpers.ts +0 -63
  411. package/attributes-master/packages/starrating/src/utils/selectors.ts +0 -9
  412. package/attributes-master/packages/starrating/tsconfig.json +0 -3
  413. package/attributes-master/packages/template/README.md +0 -25
  414. package/attributes-master/packages/template/package.json +0 -22
  415. package/attributes-master/packages/template/src/actions/console.ts +0 -4
  416. package/attributes-master/packages/template/src/index.ts +0 -3
  417. package/attributes-master/packages/template/src/init.ts +0 -14
  418. package/attributes-master/packages/template/src/utils/constants.ts +0 -18
  419. package/attributes-master/packages/template/src/utils/selectors.ts +0 -5
  420. package/attributes-master/packages/template/tsconfig.json +0 -3
  421. package/attributes-master/packages/toc/CHANGELOG.md +0 -192
  422. package/attributes-master/packages/toc/README.md +0 -25
  423. package/attributes-master/packages/toc/package.json +0 -23
  424. package/attributes-master/packages/toc/src/actions/collect.ts +0 -136
  425. package/attributes-master/packages/toc/src/actions/create.ts +0 -44
  426. package/attributes-master/packages/toc/src/actions/events.ts +0 -29
  427. package/attributes-master/packages/toc/src/actions/observe.ts +0 -31
  428. package/attributes-master/packages/toc/src/actions/populate.ts +0 -68
  429. package/attributes-master/packages/toc/src/actions/prepare.ts +0 -25
  430. package/attributes-master/packages/toc/src/actions/scroll.ts +0 -33
  431. package/attributes-master/packages/toc/src/components/TOCItem.ts +0 -88
  432. package/attributes-master/packages/toc/src/factory.ts +0 -47
  433. package/attributes-master/packages/toc/src/index.ts +0 -3
  434. package/attributes-master/packages/toc/src/init.ts +0 -37
  435. package/attributes-master/packages/toc/src/utils/constants.ts +0 -55
  436. package/attributes-master/packages/toc/src/utils/helpers.ts +0 -23
  437. package/attributes-master/packages/toc/src/utils/selectors.ts +0 -6
  438. package/attributes-master/packages/toc/src/utils/types.ts +0 -21
  439. package/attributes-master/packages/toc/tsconfig.json +0 -3
  440. package/attributes-master/packages/utils/CHANGELOG.md +0 -43
  441. package/attributes-master/packages/utils/package.json +0 -27
  442. package/attributes-master/packages/utils/src/animations/factory.ts +0 -100
  443. package/attributes-master/packages/utils/src/animations/index.ts +0 -73
  444. package/attributes-master/packages/utils/src/animations/types.ts +0 -37
  445. package/attributes-master/packages/utils/src/components/Interaction.ts +0 -79
  446. package/attributes-master/packages/utils/src/components/Renderer.ts +0 -59
  447. package/attributes-master/packages/utils/src/components/index.ts +0 -2
  448. package/attributes-master/packages/utils/src/constants/a11y.ts +0 -50
  449. package/attributes-master/packages/utils/src/constants/attributes.ts +0 -57
  450. package/attributes-master/packages/utils/src/constants/index.ts +0 -5
  451. package/attributes-master/packages/utils/src/constants/keyboard.ts +0 -10
  452. package/attributes-master/packages/utils/src/constants/webflow.ts +0 -74
  453. package/attributes-master/packages/utils/src/helpers/dates.ts +0 -17
  454. package/attributes-master/packages/utils/src/helpers/dom.ts +0 -82
  455. package/attributes-master/packages/utils/src/helpers/events.ts +0 -59
  456. package/attributes-master/packages/utils/src/helpers/fetch.ts +0 -217
  457. package/attributes-master/packages/utils/src/helpers/forms.ts +0 -238
  458. package/attributes-master/packages/utils/src/helpers/guards.ts +0 -138
  459. package/attributes-master/packages/utils/src/helpers/index.ts +0 -11
  460. package/attributes-master/packages/utils/src/helpers/numbers.ts +0 -86
  461. package/attributes-master/packages/utils/src/helpers/selectors.ts +0 -249
  462. package/attributes-master/packages/utils/src/helpers/strings.ts +0 -19
  463. package/attributes-master/packages/utils/src/helpers/wait.ts +0 -36
  464. package/attributes-master/packages/utils/src/helpers/webflow.ts +0 -117
  465. package/attributes-master/packages/utils/src/index.ts +0 -5
  466. package/attributes-master/packages/utils/src/types/core.ts +0 -100
  467. package/attributes-master/packages/utils/src/types/dom.ts +0 -31
  468. package/attributes-master/packages/utils/src/types/index.ts +0 -4
  469. package/attributes-master/packages/utils/src/types/utils.ts +0 -20
  470. package/attributes-master/packages/utils/src/types/webflow.ts +0 -147
  471. package/attributes-master/packages/utils/tsconfig.json +0 -3
  472. package/attributes-master/packages/videohls/CHANGELOG.md +0 -76
  473. package/attributes-master/packages/videohls/README.md +0 -27
  474. package/attributes-master/packages/videohls/package.json +0 -26
  475. package/attributes-master/packages/videohls/src/actions/list.ts +0 -23
  476. package/attributes-master/packages/videohls/src/actions/video.ts +0 -44
  477. package/attributes-master/packages/videohls/src/index.ts +0 -3
  478. package/attributes-master/packages/videohls/src/init.ts +0 -28
  479. package/attributes-master/packages/videohls/src/utils/constants.ts +0 -12
  480. package/attributes-master/packages/videohls/src/utils/selectors.ts +0 -5
  481. package/attributes-master/packages/videohls/src/utils/stores.ts +0 -3
  482. package/attributes-master/packages/videohls/tsconfig.json +0 -3
  483. package/attributes-master/pnpm-lock.yaml +0 -3317
  484. package/attributes-master/pnpm-workspace.yaml +0 -3
  485. package/attributes-master/tsconfig.json +0 -6
  486. package/autoInit/smooth-scroll.js +0 -89
  487. package/utils/navbar.js +0 -214
  488. package/utils/scroll-progress.js +0 -29
  489. package/utils/toc.js +0 -77
@@ -1,260 +0,0 @@
1
- /**
2
- * CSS string to be injected into the head of the document.
3
- */
4
- const cssString = `
5
- .copied-text::before {
6
- content: "";
7
- color: black;
8
- position: absolute;
9
- top: -1.8rem;
10
- visibility: hidden;
11
- opacity: 0;
12
- background-color: white;
13
- padding: 0rem 0.2rem;
14
- border-radius: 0.15rem;
15
- left: 50%;
16
- transform: translate(-50%, 0);
17
- font-size: 0.8rem;
18
- font-weight: 500;
19
- transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
20
- }
21
-
22
- .copied-text.copied-visible::before {
23
- visibility: visible;
24
- opacity: 1;
25
- content: "Copied!";
26
- transition-delay: 0s;
27
- }
28
-
29
- .copied-text{
30
- position: relative;
31
- }
32
- `;
33
-
34
- /**
35
- * Injects the specified CSS into the head of the document.
36
- * @param cssString - The CSS string to be injected.
37
- */
38
- const injectCSS = (cssString: string): void => {
39
- const style = document.createElement('style');
40
-
41
- style.setAttribute('type', 'text/css');
42
- style.innerHTML = cssString;
43
-
44
- document.head.appendChild(style);
45
- };
46
-
47
- /**
48
- * Enable an element by setting its pointer events to auto and toggle the copied text.
49
- * @param element - The element to enable.
50
- * @param textToShow - The text to show after copying.
51
- * @returns
52
- */
53
- const enableElement = (element: HTMLElement, textToShow = '') => {
54
- const { textContent } = element;
55
-
56
- if (textToShow) {
57
- const buttonText = element.querySelector('.button_text');
58
-
59
- if (buttonText) buttonText.textContent = textToShow;
60
- else element.textContent = textToShow;
61
-
62
- setTimeout(() => {
63
- if (buttonText) buttonText.textContent = textContent;
64
- else element.textContent = textContent;
65
-
66
- element.style.pointerEvents = 'auto';
67
- }, 1000);
68
-
69
- return;
70
- }
71
-
72
- element.style.pointerEvents = 'auto';
73
- element.classList.add('copied-visible');
74
-
75
- setTimeout(() => {
76
- element.classList.remove('copied-visible');
77
- element.style.pointerEvents = 'auto';
78
- }, 1000);
79
- };
80
-
81
- /**
82
- * Disable an element by setting its pointer events to none.
83
- * @param element - The element to disable.
84
- */
85
- const disableElement = (element: HTMLElement) => {
86
- element.style.pointerEvents = 'none';
87
- };
88
-
89
- /**
90
- * Copy the text to the clipboard.
91
- * @param text - The text to copy.
92
- * @param element - The element to enable after copying.
93
- * @param textToShow - The text to show after copying.
94
- */
95
- const copy = (text: string, element: HTMLElement, textToShow = '') => {
96
- navigator.clipboard
97
- .writeText(text)
98
- .then(() => {
99
- enableElement(element, textToShow);
100
- })
101
- .catch((err) => {
102
- console.error('Failed to copy text: ', err);
103
- enableElement(element, textToShow);
104
- });
105
- };
106
-
107
- /**
108
- * Copy the Finsweet Attributes Script to the clipboard.
109
- * @param element - trigger element
110
- * @param scriptString - script string
111
- * @param textToShow - text to show after copying
112
- * @returns
113
- */
114
- const copyScript = (scriptString: string | null, element: HTMLElement, textToShow = '') => {
115
- if (!navigator.clipboard || !scriptString) {
116
- console.error('Clipboard API not available.');
117
-
118
- return;
119
- }
120
-
121
- const attributes = extractAttributes(scriptString);
122
- disableElement(element);
123
-
124
- const text = `<!-- Finsweet Attributes -->\n<script async type="module"${attributes}\n></script>`;
125
-
126
- // copy
127
- copy(text, element, textToShow);
128
- };
129
-
130
- /**
131
- * Copy the Finsweet Attributes Text to the clipboard.
132
- * @param content - attribute name or value
133
- * @param element - trigger element
134
- * @param textToShow - text to show after copying
135
- * @returns
136
- */
137
- const copyText = (content: string, element: HTMLElement, textToShow = '') => {
138
- if (!navigator.clipboard || !content) {
139
- console.error('Clipboard API not available.');
140
-
141
- return;
142
- }
143
-
144
- disableElement(element);
145
-
146
- // copy
147
- copy(content.trim(), element, textToShow);
148
- };
149
-
150
- /**
151
- * Reformat a script tag string with each attribute on a new line using DOMParser.
152
- * @param scriptString - The script tag as a string.
153
- * @returns The reformatted attributes.
154
- */
155
- const extractAttributes = (scriptString: string): string => {
156
- const parser = new DOMParser();
157
-
158
- const doc = parser.parseFromString(scriptString, 'text/html');
159
- const scriptElement = doc.querySelector('script');
160
-
161
- if (!scriptElement) return '';
162
-
163
- let attributes = ``;
164
-
165
- // handle 'src' or any other attributes on new lines
166
- const otherAttributes = Array.from(scriptElement.attributes).filter((attr) => !['async', 'type'].includes(attr.name));
167
-
168
- for (const attr of otherAttributes) {
169
- attributes += `\n${attr.name}`;
170
- if (attr.value) {
171
- attributes += `="${attr.value.trim()}"`;
172
- }
173
- }
174
-
175
- return attributes;
176
- };
177
-
178
- /**
179
- * Find the closest target element
180
- * @param element
181
- * @returns
182
- */
183
- const findClosestTarget = (element: HTMLElement): HTMLElement | null => {
184
- let currentNode: HTMLElement | null = element;
185
-
186
- while (currentNode) {
187
- // Check all children of current node for target
188
- const target = currentNode.querySelector<HTMLElement>('[fs-docs-copy="target"]');
189
- if (target) return target;
190
-
191
- // Move up to parent node
192
- currentNode = currentNode.parentElement;
193
- }
194
-
195
- return null;
196
- };
197
-
198
- /**
199
- * Handle the trigger element click event.
200
- * @param element - The trigger element that was clicked
201
- * @returns void
202
- */
203
- const handleTrigger = (element: HTMLElement): void => {
204
- const instance = element.getAttribute('fs-docs-instance');
205
- let target: HTMLElement | null = null;
206
-
207
- if (instance) {
208
- target = document.querySelector<HTMLElement>(`[fs-docs-copy="target"][fs-docs-instance="${instance}"]`);
209
- } else {
210
- // If no instance match, look up the DOM tree and find closest target
211
- target = findClosestTarget(element);
212
- }
213
-
214
- if (!target) return;
215
-
216
- const { textContent } = target;
217
-
218
- if (!textContent) return;
219
-
220
- // if script tag, check for 'src' attribute
221
- if (textContent.includes('script') && textContent.includes('src="')) {
222
- copyScript(textContent, element, 'Copied');
223
- return;
224
- }
225
-
226
- copyText(textContent, element, 'Copied');
227
- };
228
-
229
- /**
230
- * Add click event listener to elements.
231
- * @param elements
232
- * @param callback
233
- */
234
- const addClickListener = (elements: NodeListOf<HTMLElement>, callback: (el: HTMLElement) => void) => {
235
- elements.forEach((el) => {
236
- el.classList.add('copied-text');
237
-
238
- el.addEventListener('click', (e) => {
239
- e.preventDefault();
240
- e.stopPropagation();
241
- callback(el);
242
- });
243
- });
244
- };
245
-
246
- // DOM content loaded
247
- document.addEventListener('DOMContentLoaded', () => {
248
- // Inject the CSS into the <head>
249
- injectCSS(cssString);
250
-
251
- // Get all trigger elements
252
- const triggers = document.querySelectorAll<HTMLElement>('[fs-docs-copy="trigger"]');
253
- addClickListener(triggers, handleTrigger);
254
-
255
- // Get all text content triggers
256
- const textContentTriggers = document.querySelectorAll<HTMLElement>('[fs-docs-copy="text-content"]');
257
- addClickListener(textContentTriggers, (el) => {
258
- if (el.textContent) copyText(el.textContent, el);
259
- });
260
- });
@@ -1,377 +0,0 @@
1
- import { animations, type Easings } from '@finsweet/attributes-utils';
2
- import { computePosition, flip, offset, shift } from '@floating-ui/dom';
3
- import debounce from 'just-debounce';
4
-
5
- const voidElements = new Set([
6
- 'area',
7
- 'base',
8
- 'br',
9
- 'col',
10
- 'embed',
11
- 'hr',
12
- 'img',
13
- 'input',
14
- 'link',
15
- 'meta',
16
- 'param',
17
- 'source',
18
- 'track',
19
- 'wbr',
20
- 'select',
21
- ]);
22
-
23
- /**
24
- * X-ray mode active state.
25
- */
26
- let xrayActive = true;
27
- /**
28
- * Tooltip element.
29
- */
30
- let tooltip: HTMLElement | null;
31
- /**
32
- * Store for elements with 'x-ray' attribute.
33
- */
34
- let xrayElements: HTMLElement[] = [];
35
- /**
36
- * Store xray active element
37
- */
38
- let xrayActiveElement: HTMLElement | null;
39
- /**
40
- * Default values for x-ray mode.
41
- */
42
- let textColor = '#003238';
43
- let backgroundColor = '#00e4ff';
44
- let animation: keyof typeof animations = 'fade';
45
- let easing: Easings[number] = 'ease-in-out';
46
- let duration = 150;
47
- let keyCode = '?';
48
- let targetClass = 'x-ray';
49
-
50
- const altTags = ['INPUT'];
51
- const script = document.currentScript as HTMLScriptElement;
52
-
53
- /**
54
- * Searches for the closest element up the DOM tree that has any attribute starting with 'fs-'.
55
- * @param element - The starting HTMLElement to check.
56
- * @returns The found element with 'fs-' attributes or null if none found.
57
- */
58
- const findElementWithFsAttributes = (element: HTMLElement): HTMLElement | null => {
59
- // 1. Check the current element
60
- if (Array.from(element.attributes).some((attr) => attr.name.startsWith('fs-'))) {
61
- return element;
62
- }
63
-
64
- // 2. Check children of the parent element if they have 'fs-' attributes
65
- const { parentElement } = element;
66
- if (parentElement) {
67
- // check its children
68
- for (const child of Array.from(parentElement.children) as HTMLElement[]) {
69
- if (Array.from(child.attributes).some((attr) => attr.name.startsWith('fs-'))) {
70
- return child;
71
- }
72
- }
73
-
74
- // 3. Traverse parents and return the closest one with an 'fs-' attribute
75
- let ancestor: HTMLElement | null = element;
76
- while (ancestor) {
77
- if (Array.from(ancestor.attributes).some((attr) => attr.name.startsWith('fs-'))) {
78
- return ancestor;
79
- }
80
- ancestor = ancestor.parentElement;
81
- }
82
- }
83
-
84
- return null;
85
- };
86
-
87
- /**
88
- * Checks if the given element is a void element and returns the parent to apply styles.
89
- * @param element - The HTMLElement to check.
90
- * @returns The element to apply the xray outline styles to.
91
- */
92
- const getValidElementForPseudo = (element: HTMLElement): HTMLElement | null | undefined => {
93
- if (voidElements.has(element.tagName.toLowerCase())) {
94
- // going 2 levels up seems the perfect approach :)
95
- // like checkboxes and radios have some 2-3 elements wrapping them
96
- return element.parentElement?.parentElement || element;
97
- }
98
- return element;
99
- };
100
-
101
- /**
102
- * Updates the position of the tooltip element relative to the target element.
103
- * @param element - The target element.
104
- * @param tooltip - The tooltip element.
105
- */
106
- const updateTooltipPosition = () => {
107
- if (!tooltip || !xrayActiveElement) return;
108
-
109
- computePosition(xrayActiveElement, tooltip, {
110
- placement: 'top',
111
- middleware: [
112
- offset(10),
113
- flip({
114
- fallbackPlacements: ['top', 'left-start', 'right-start'],
115
- }),
116
- shift({ padding: 5 }),
117
- ],
118
- }).then(({ x, y }) => {
119
- if (!tooltip) return;
120
-
121
- Object.assign(tooltip.style, {
122
- left: `${x}px`,
123
- top: `${y}px`,
124
- });
125
- });
126
- };
127
- /**
128
- * Creates a tooltip element and appends it to the DOM.
129
- * @param element
130
- * @param content
131
- */
132
- const showTooltipElement = async (element: HTMLElement, content: string) => {
133
- if (!tooltip) {
134
- tooltip = document.createElement('div');
135
- tooltip.id = 'tooltip-xray';
136
- tooltip.style.position = 'absolute';
137
- tooltip.style.zIndex = '9999';
138
- tooltip.style.backgroundColor = backgroundColor;
139
- tooltip.style.color = textColor;
140
- tooltip.style.borderRadius = '.25rem';
141
- tooltip.style.padding = '.2rem .5rem';
142
- tooltip.style.margin = '0';
143
- tooltip.style.fontSize = '.85rem';
144
- tooltip.style.fontFamily = 'monospace';
145
- tooltip.style.width = 'max-content';
146
-
147
- document.body.appendChild(tooltip);
148
- }
149
-
150
- tooltip.innerHTML = content;
151
-
152
- // update xray active element state
153
- xrayActiveElement = element;
154
-
155
- // update tooltip position
156
- updateTooltipPosition();
157
-
158
- // animate
159
- await animations[animation].animateIn(tooltip, { duration, easing, display: 'block' });
160
- };
161
-
162
- /**
163
- * Removes the tooltip element from the DOM.
164
- */
165
- const removeTooltip = () => {
166
- const tooltip = document.getElementById('tooltip-xray');
167
-
168
- if (tooltip) {
169
- tooltip.remove();
170
- }
171
- };
172
-
173
- /**
174
- * Checks if the element has an 'x-ray' attribute set to 'ignore' and disables x-ray mode for that element.
175
- * @param element - The element to check.
176
- * @returns true if the element was ignored, otherwise false.
177
- */
178
- const checkAndIgnoreElement = (element: Element | null): boolean => {
179
- if (element?.getAttribute('x-ray') === 'ignore') {
180
- const closestIgnore = element.closest('[x-ray="ignore"]');
181
- // handle closest parent with x-ray ignore
182
- if (closestIgnore) {
183
- closestIgnore.classList.remove(targetClass);
184
- }
185
-
186
- // handle element itself
187
- element.classList.remove(targetClass);
188
-
189
- return true;
190
- }
191
-
192
- return false;
193
- };
194
-
195
- /**
196
- * Debounced mousemove event listener to show tooltips on elements with 'fs-' attributes.
197
- */
198
- const debouncedMouseMove = debounce(async (event: MouseEvent) => {
199
- if (!xrayActive) return;
200
-
201
- tooltip = document.querySelector<HTMLElement>('#tooltip-xray');
202
-
203
- if (tooltip) {
204
- await animations[animation].animateOut(tooltip, { display: 'none', duration, easing });
205
- }
206
-
207
- const target = event.target as HTMLElement;
208
-
209
- const fsElement = findElementWithFsAttributes(target);
210
-
211
- if (!fsElement) {
212
- removeTooltip();
213
-
214
- return;
215
- }
216
-
217
- const fsAttributes = Array.from(fsElement.attributes)
218
- .filter((attr) => attr.name.startsWith('fs-'))
219
- .filter(({ name }) => name.split('-').length === 3);
220
-
221
- const elementToStyle = getValidElementForPseudo(target);
222
-
223
- if (!xrayActive || !elementToStyle) {
224
- return;
225
- }
226
-
227
- if (fsAttributes.length > 0) {
228
- if (checkAndIgnoreElement(elementToStyle) || checkAndIgnoreElement(fsElement)) return;
229
-
230
- const list = fsAttributes
231
- .sort((a, b) => a.name.localeCompare(b.name))
232
- .map(
233
- (attr) =>
234
- `<span style="font-weight:bold;">${attr.name}</span><span style="opacity:0.5">=</span><span style="opacity:0.5">"</span><span style="font-weight:bold;">${attr.value}</span><span style="opacity:0.5">"</span>`
235
- )
236
- .join('<br/>');
237
-
238
- showTooltipElement(fsElement, list);
239
- }
240
- }, 150);
241
-
242
- /**
243
- * Query all elements that have attributes starting with 'fs-'.
244
- * @returns An array of HTMLElements that have attributes starting with 'fs-'.
245
- */
246
- const queryElementsWithFsAttributes = () => {
247
- // Get all elements in the document
248
- const allElements = document.querySelectorAll<HTMLElement>('*');
249
- // get all elements with x-ray class
250
- const xrayElements = document.querySelectorAll<HTMLElement>(targetClass);
251
-
252
- if (xrayElements.length > 0 && !xrayActive) {
253
- xrayElements.forEach((element) => {
254
- element.classList.remove(targetClass);
255
- });
256
- }
257
-
258
- // Filter elements that have at least one attribute starting with 'fs-'
259
- const elementsWithFsAttributes = Array.from(allElements).filter((element) =>
260
- Array.from(element.attributes).some((attr) => attr.name.startsWith('fs-'))
261
- );
262
-
263
- // if element is void element, return the parent element
264
- const elements = elementsWithFsAttributes.map((element) => {
265
- if (
266
- altTags.includes(element.tagName) &&
267
- (element.getAttribute('type') === 'checkbox' || element.getAttribute('type') === 'radio')
268
- ) {
269
- return element.closest('label') || element;
270
- }
271
-
272
- return element;
273
- });
274
-
275
- return elements;
276
- };
277
-
278
- /**
279
- * Set or update the tooltip style in the head of the document.
280
- */
281
- const updateTooltipStyle = () => {
282
- let style = document.getElementById('tooltip-xray-style');
283
-
284
- if (!style) {
285
- style = document.createElement('style');
286
- style.setAttribute('id', 'tooltip-xray-style');
287
-
288
- document.head.appendChild(style);
289
- }
290
- style.innerHTML = `
291
- .${targetClass}, .${targetClass}:hover {
292
- outline-color: ${backgroundColor} !important;
293
- outline-offset: 3px !important;
294
- outline-width: 1px !important;
295
- outline-style: solid !important;
296
- border-radius: 0.25rem !important;
297
- }
298
- `;
299
- };
300
-
301
- /**
302
- * Initialize the mouseover event listener for elements with 'fs-' attributes.
303
- */
304
- const xrayInit = (): void => {
305
- textColor = script?.getAttribute('text-color') || '#003238';
306
- backgroundColor = script?.getAttribute('background-color') || '#00e4ff';
307
- animation = (script?.getAttribute('animation') as keyof typeof animations) || 'fade';
308
- easing = (script?.getAttribute('easing') as Easings[number]) || 'ease-in-out';
309
- duration = Number(script?.getAttribute('duration')) || 150;
310
- keyCode = script?.getAttribute('key') || '?';
311
- targetClass = script?.getAttribute('target-class') || 'x-ray';
312
-
313
- updateTooltipStyle();
314
-
315
- const xrayDefaultElements = document.querySelectorAll('.helper');
316
-
317
- // clear any existing helper classes that were added in webflow so that script can manage it.
318
- if (xrayDefaultElements.length > 0) {
319
- xrayDefaultElements.forEach((xray) => {
320
- xray.classList.remove('helper');
321
- });
322
- }
323
-
324
- xrayElements = queryElementsWithFsAttributes();
325
-
326
- xrayElements.forEach((element) => {
327
- if (checkAndIgnoreElement(element)) return;
328
-
329
- element.classList.toggle(targetClass, xrayActive);
330
- });
331
- };
332
-
333
- /**
334
- * Handle the keydown event to toggle the x-ray mode.
335
- * @param e
336
- */
337
- const handleKeydown = (e: KeyboardEvent) => {
338
- if (e.key === keyCode) {
339
- xrayActive = !xrayActive;
340
-
341
- if (!xrayActive) {
342
- removeTooltip();
343
- }
344
-
345
- xrayElements.forEach((element) => {
346
- if (checkAndIgnoreElement(element)) return;
347
-
348
- element.classList.toggle(targetClass, xrayActive);
349
- });
350
- }
351
- };
352
-
353
- /**
354
- * Handle the scroll event to update the tooltip position.
355
- */
356
- const handleScroll = () => {
357
- if (xrayActiveElement) {
358
- updateTooltipPosition();
359
- }
360
- };
361
-
362
- // dom ready
363
- document.addEventListener('DOMContentLoaded', () => {
364
- document.addEventListener('mouseover', debouncedMouseMove);
365
- document.addEventListener('keydown', handleKeydown);
366
- document.addEventListener('scroll', handleScroll, { passive: true });
367
- window.addEventListener('resize', updateTooltipPosition);
368
-
369
- const config: MutationObserverInit = {
370
- attributes: true,
371
- subtree: true,
372
- };
373
-
374
- const debouncedCallback = debounce(xrayInit, 150);
375
- const observer = new MutationObserver(debouncedCallback);
376
- observer.observe(document.body, config);
377
- });
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json"
3
- }