@hortonstudio/main 1.2.12 → 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.
- package/index.js +8 -8
- package/package.json +17 -6
- package/.claude/settings.local.json +0 -21
- package/animations/hero.js +0 -599
- package/animations/text.js +0 -369
- package/animations/transition.js +0 -57
- package/attributes-master/.changeset/README.md +0 -8
- package/attributes-master/.changeset/config.json +0 -11
- package/attributes-master/.gitattributes +0 -2
- package/attributes-master/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
- package/attributes-master/.github/ISSUE_TEMPLATE/feature_request.md +0 -22
- package/attributes-master/.github/workflows/ci.yml +0 -66
- package/attributes-master/.github/workflows/release.yml +0 -40
- package/attributes-master/.prettierignore +0 -3
- package/attributes-master/.prettierrc +0 -8
- package/attributes-master/.vscode/extensions.json +0 -3
- package/attributes-master/.vscode/settings.json +0 -7
- package/attributes-master/CONTRIBUTING.md +0 -72
- package/attributes-master/LICENSE.md +0 -201
- package/attributes-master/README.md +0 -31
- package/attributes-master/eslint.config.js +0 -3
- package/attributes-master/package.json +0 -34
- package/attributes-master/packages/accordion/CHANGELOG.md +0 -89
- package/attributes-master/packages/accordion/README.md +0 -31
- package/attributes-master/packages/accordion/package.json +0 -25
- package/attributes-master/packages/accordion/src/actions/a11y.ts +0 -39
- package/attributes-master/packages/accordion/src/actions/classes.ts +0 -27
- package/attributes-master/packages/accordion/src/actions/content.ts +0 -42
- package/attributes-master/packages/accordion/src/actions/list.ts +0 -36
- package/attributes-master/packages/accordion/src/actions/query.ts +0 -27
- package/attributes-master/packages/accordion/src/actions/settings.ts +0 -61
- package/attributes-master/packages/accordion/src/factory.ts +0 -145
- package/attributes-master/packages/accordion/src/index.ts +0 -3
- package/attributes-master/packages/accordion/src/init.ts +0 -37
- package/attributes-master/packages/accordion/src/utils/constants.ts +0 -62
- package/attributes-master/packages/accordion/src/utils/helpers.ts +0 -5
- package/attributes-master/packages/accordion/src/utils/selectors.ts +0 -12
- package/attributes-master/packages/accordion/src/utils/types.ts +0 -23
- package/attributes-master/packages/accordion/tsconfig.json +0 -3
- package/attributes-master/packages/attributes/CHANGELOG.md +0 -564
- package/attributes-master/packages/attributes/README.md +0 -66
- package/attributes-master/packages/attributes/bin/build.ts +0 -107
- package/attributes-master/packages/attributes/bin/live-reload.js +0 -1
- package/attributes-master/packages/attributes/package.json +0 -77
- package/attributes-master/packages/attributes/playwright.config.ts +0 -89
- package/attributes-master/packages/attributes/src/attributes.ts +0 -153
- package/attributes-master/packages/attributes/src/load.ts +0 -125
- package/attributes-master/packages/attributes/tests/accordion.spec.ts +0 -137
- package/attributes-master/packages/attributes/tests/codehighlight.spec.ts +0 -23
- package/attributes-master/packages/attributes/tests/combobox.spec.ts +0 -321
- package/attributes-master/packages/attributes/tests/copyclip.spec.ts +0 -19
- package/attributes-master/packages/attributes/tests/displayvalues.spec.ts +0 -48
- package/attributes-master/packages/attributes/tests/favcustom.spec.ts +0 -23
- package/attributes-master/packages/attributes/tests/inject.spec.ts +0 -40
- package/attributes-master/packages/attributes/tests/inputactive.spec.ts +0 -77
- package/attributes-master/packages/attributes/tests/inputcounter.spec.ts +0 -83
- package/attributes-master/packages/attributes/tests/list.spec.ts +0 -800
- package/attributes-master/packages/attributes/tests/mirrorclick.spec.ts +0 -22
- package/attributes-master/packages/attributes/tests/mirrorinput.spec.ts +0 -37
- package/attributes-master/packages/attributes/tests/modal.spec.ts +0 -34
- package/attributes-master/packages/attributes/tests/numbercount.spec.ts +0 -40
- package/attributes-master/packages/attributes/tests/readtime.spec.ts +0 -19
- package/attributes-master/packages/attributes/tests/selectcustom.spec.ts +0 -51
- package/attributes-master/packages/attributes/tests/socialshare.spec.ts +0 -54
- package/attributes-master/packages/attributes/tests/starrating.spec.ts +0 -79
- package/attributes-master/packages/attributes/tests/toc.spec.ts +0 -38
- package/attributes-master/packages/attributes/tests/utils/index.ts +0 -16
- package/attributes-master/packages/attributes/tsconfig.json +0 -6
- package/attributes-master/packages/autovideo/CHANGELOG.md +0 -182
- package/attributes-master/packages/autovideo/README.md +0 -31
- package/attributes-master/packages/autovideo/package.json +0 -22
- package/attributes-master/packages/autovideo/src/index.ts +0 -3
- package/attributes-master/packages/autovideo/src/init.ts +0 -52
- package/attributes-master/packages/autovideo/src/types.ts +0 -5
- package/attributes-master/packages/autovideo/src/utils/constants.ts +0 -4
- package/attributes-master/packages/autovideo/tsconfig.json +0 -3
- package/attributes-master/packages/codehighlight/CHANGELOG.md +0 -185
- package/attributes-master/packages/codehighlight/README.md +0 -27
- package/attributes-master/packages/codehighlight/package.json +0 -23
- package/attributes-master/packages/codehighlight/src/actions/import.ts +0 -50
- package/attributes-master/packages/codehighlight/src/index.ts +0 -3
- package/attributes-master/packages/codehighlight/src/init.ts +0 -53
- package/attributes-master/packages/codehighlight/src/utils/constants.ts +0 -24
- package/attributes-master/packages/codehighlight/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/codehighlight/src/utils/themes.ts +0 -202
- package/attributes-master/packages/codehighlight/tsconfig.json +0 -3
- package/attributes-master/packages/combobox/CHANGELOG.md +0 -99
- package/attributes-master/packages/combobox/README.md +0 -27
- package/attributes-master/packages/combobox/package.json +0 -23
- package/attributes-master/packages/combobox/src/actions/a11y.ts +0 -29
- package/attributes-master/packages/combobox/src/actions/body/index.ts +0 -12
- package/attributes-master/packages/combobox/src/actions/clearDropdown/index.ts +0 -37
- package/attributes-master/packages/combobox/src/actions/dropdownList/index.ts +0 -220
- package/attributes-master/packages/combobox/src/actions/dropdownToggle/index.ts +0 -34
- package/attributes-master/packages/combobox/src/actions/events.ts +0 -75
- package/attributes-master/packages/combobox/src/actions/input/index.ts +0 -235
- package/attributes-master/packages/combobox/src/actions/observe.ts +0 -158
- package/attributes-master/packages/combobox/src/actions/populate.ts +0 -97
- package/attributes-master/packages/combobox/src/actions/selectElement/index.ts +0 -23
- package/attributes-master/packages/combobox/src/actions/settings.ts +0 -134
- package/attributes-master/packages/combobox/src/actions/state.ts +0 -34
- package/attributes-master/packages/combobox/src/index.ts +0 -3
- package/attributes-master/packages/combobox/src/init.ts +0 -52
- package/attributes-master/packages/combobox/src/utils/constants.ts +0 -48
- package/attributes-master/packages/combobox/src/utils/dropdowns.ts +0 -120
- package/attributes-master/packages/combobox/src/utils/index.ts +0 -1
- package/attributes-master/packages/combobox/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/combobox/src/utils/types.ts +0 -14
- package/attributes-master/packages/combobox/tsconfig.json +0 -3
- package/attributes-master/packages/copyclip/CHANGELOG.md +0 -213
- package/attributes-master/packages/copyclip/README.md +0 -27
- package/attributes-master/packages/copyclip/package.json +0 -23
- package/attributes-master/packages/copyclip/src/factory.ts +0 -67
- package/attributes-master/packages/copyclip/src/index.ts +0 -3
- package/attributes-master/packages/copyclip/src/init.ts +0 -68
- package/attributes-master/packages/copyclip/src/utils/constants.ts +0 -40
- package/attributes-master/packages/copyclip/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/copyclip/tsconfig.json +0 -3
- package/attributes-master/packages/displayvalues/CHANGELOG.md +0 -164
- package/attributes-master/packages/displayvalues/README.md +0 -27
- package/attributes-master/packages/displayvalues/package.json +0 -22
- package/attributes-master/packages/displayvalues/src/actions/collect.ts +0 -17
- package/attributes-master/packages/displayvalues/src/actions/events.ts +0 -22
- package/attributes-master/packages/displayvalues/src/actions/sync.ts +0 -23
- package/attributes-master/packages/displayvalues/src/index.ts +0 -3
- package/attributes-master/packages/displayvalues/src/init.ts +0 -31
- package/attributes-master/packages/displayvalues/src/utils/constants.ts +0 -20
- package/attributes-master/packages/displayvalues/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/displayvalues/src/utils/stores.ts +0 -3
- package/attributes-master/packages/displayvalues/tsconfig.json +0 -3
- package/attributes-master/packages/docs/CHANGELOG.md +0 -108
- package/attributes-master/packages/docs/README.md +0 -3
- package/attributes-master/packages/docs/bin/build.js +0 -92
- package/attributes-master/packages/docs/bin/live-reload.js +0 -1
- package/attributes-master/packages/docs/package.json +0 -40
- package/attributes-master/packages/docs/src/copy.ts +0 -260
- package/attributes-master/packages/docs/src/x-ray.ts +0 -377
- package/attributes-master/packages/docs/tsconfig.json +0 -3
- package/attributes-master/packages/favcustom/CHANGELOG.md +0 -194
- package/attributes-master/packages/favcustom/README.md +0 -27
- package/attributes-master/packages/favcustom/package.json +0 -22
- package/attributes-master/packages/favcustom/src/index.ts +0 -3
- package/attributes-master/packages/favcustom/src/init.ts +0 -30
- package/attributes-master/packages/favcustom/src/utils/constants.ts +0 -10
- package/attributes-master/packages/favcustom/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/favcustom/tsconfig.json +0 -3
- package/attributes-master/packages/formsubmit/CHANGELOG.md +0 -161
- package/attributes-master/packages/formsubmit/README.md +0 -51
- package/attributes-master/packages/formsubmit/package.json +0 -22
- package/attributes-master/packages/formsubmit/src/actions/redirect.ts +0 -9
- package/attributes-master/packages/formsubmit/src/actions/reset.ts +0 -49
- package/attributes-master/packages/formsubmit/src/actions/submit.ts +0 -34
- package/attributes-master/packages/formsubmit/src/components/Form.ts +0 -231
- package/attributes-master/packages/formsubmit/src/factory.ts +0 -62
- package/attributes-master/packages/formsubmit/src/index.ts +0 -3
- package/attributes-master/packages/formsubmit/src/init.ts +0 -24
- package/attributes-master/packages/formsubmit/src/utils/attributes.ts +0 -19
- package/attributes-master/packages/formsubmit/src/utils/constants.ts +0 -89
- package/attributes-master/packages/formsubmit/src/utils/dom.ts +0 -76
- package/attributes-master/packages/formsubmit/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/formsubmit/src/utils/types.ts +0 -7
- package/attributes-master/packages/formsubmit/tsconfig.json +0 -3
- package/attributes-master/packages/inject/CHANGELOG.md +0 -117
- package/attributes-master/packages/inject/README.md +0 -60
- package/attributes-master/packages/inject/package.json +0 -22
- package/attributes-master/packages/inject/src/actions/collect.ts +0 -125
- package/attributes-master/packages/inject/src/actions/css.ts +0 -27
- package/attributes-master/packages/inject/src/actions/prefetch.ts +0 -44
- package/attributes-master/packages/inject/src/factory.ts +0 -123
- package/attributes-master/packages/inject/src/index.ts +0 -3
- package/attributes-master/packages/inject/src/init.ts +0 -22
- package/attributes-master/packages/inject/src/utils/constants.ts +0 -89
- package/attributes-master/packages/inject/src/utils/helpers.ts +0 -36
- package/attributes-master/packages/inject/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/inject/src/utils/types.ts +0 -16
- package/attributes-master/packages/inject/tsconfig.json +0 -3
- package/attributes-master/packages/inputactive/CHANGELOG.md +0 -58
- package/attributes-master/packages/inputactive/README.md +0 -25
- package/attributes-master/packages/inputactive/package.json +0 -22
- package/attributes-master/packages/inputactive/src/actions/classes.ts +0 -43
- package/attributes-master/packages/inputactive/src/factory.ts +0 -24
- package/attributes-master/packages/inputactive/src/index.ts +0 -3
- package/attributes-master/packages/inputactive/src/init.ts +0 -18
- package/attributes-master/packages/inputactive/src/utils/constants.ts +0 -13
- package/attributes-master/packages/inputactive/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/inputactive/tsconfig.json +0 -3
- package/attributes-master/packages/inputcounter/CHANGELOG.md +0 -110
- package/attributes-master/packages/inputcounter/README.md +0 -25
- package/attributes-master/packages/inputcounter/package.json +0 -22
- package/attributes-master/packages/inputcounter/src/actions/a11y.ts +0 -23
- package/attributes-master/packages/inputcounter/src/actions/buttons.ts +0 -61
- package/attributes-master/packages/inputcounter/src/actions/input.ts +0 -31
- package/attributes-master/packages/inputcounter/src/actions/style.ts +0 -12
- package/attributes-master/packages/inputcounter/src/factory.ts +0 -51
- package/attributes-master/packages/inputcounter/src/index.ts +0 -3
- package/attributes-master/packages/inputcounter/src/init.ts +0 -22
- package/attributes-master/packages/inputcounter/src/utils/constants.ts +0 -59
- package/attributes-master/packages/inputcounter/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/inputcounter/tsconfig.json +0 -3
- package/attributes-master/packages/list/CHANGELOG.md +0 -185
- package/attributes-master/packages/list/README.md +0 -331
- package/attributes-master/packages/list/package.json +0 -37
- package/attributes-master/packages/list/src/combine/index.ts +0 -38
- package/attributes-master/packages/list/src/components/List.ts +0 -861
- package/attributes-master/packages/list/src/components/ListItem.ts +0 -229
- package/attributes-master/packages/list/src/components/index.ts +0 -2
- package/attributes-master/packages/list/src/factory.ts +0 -130
- package/attributes-master/packages/list/src/filter/dynamic/conditions.ts +0 -639
- package/attributes-master/packages/list/src/filter/dynamic/groups.ts +0 -221
- package/attributes-master/packages/list/src/filter/dynamic/index.ts +0 -119
- package/attributes-master/packages/list/src/filter/dynamic/utils.ts +0 -44
- package/attributes-master/packages/list/src/filter/elements.ts +0 -93
- package/attributes-master/packages/list/src/filter/filter.ts +0 -118
- package/attributes-master/packages/list/src/filter/filter.worker.ts +0 -152
- package/attributes-master/packages/list/src/filter/index.ts +0 -94
- package/attributes-master/packages/list/src/filter/standard/conditions.ts +0 -123
- package/attributes-master/packages/list/src/filter/standard/facets.ts +0 -253
- package/attributes-master/packages/list/src/filter/standard/index.ts +0 -176
- package/attributes-master/packages/list/src/filter/standard/query.ts +0 -111
- package/attributes-master/packages/list/src/filter/tags.ts +0 -314
- package/attributes-master/packages/list/src/filter/types.ts +0 -62
- package/attributes-master/packages/list/src/filter/utils.ts +0 -126
- package/attributes-master/packages/list/src/index.ts +0 -4
- package/attributes-master/packages/list/src/init.ts +0 -38
- package/attributes-master/packages/list/src/load/all.ts +0 -27
- package/attributes-master/packages/list/src/load/elements.ts +0 -39
- package/attributes-master/packages/list/src/load/index.ts +0 -63
- package/attributes-master/packages/list/src/load/infinite.ts +0 -79
- package/attributes-master/packages/list/src/load/load.ts +0 -191
- package/attributes-master/packages/list/src/load/more.ts +0 -97
- package/attributes-master/packages/list/src/load/pagination.ts +0 -402
- package/attributes-master/packages/list/src/nest/index.ts +0 -198
- package/attributes-master/packages/list/src/prevnext/index.ts +0 -98
- package/attributes-master/packages/list/src/select/index.ts +0 -56
- package/attributes-master/packages/list/src/slider/index.ts +0 -62
- package/attributes-master/packages/list/src/sort/buttons.ts +0 -96
- package/attributes-master/packages/list/src/sort/dropdown.ts +0 -179
- package/attributes-master/packages/list/src/sort/index.ts +0 -81
- package/attributes-master/packages/list/src/sort/query.ts +0 -63
- package/attributes-master/packages/list/src/sort/select.ts +0 -67
- package/attributes-master/packages/list/src/sort/sort.ts +0 -79
- package/attributes-master/packages/list/src/sort/types.ts +0 -28
- package/attributes-master/packages/list/src/static/index.ts +0 -73
- package/attributes-master/packages/list/src/tabs/index.ts +0 -97
- package/attributes-master/packages/list/src/utils/constants.ts +0 -728
- package/attributes-master/packages/list/src/utils/dom.ts +0 -108
- package/attributes-master/packages/list/src/utils/pagination.ts +0 -14
- package/attributes-master/packages/list/src/utils/selectors.ts +0 -18
- package/attributes-master/packages/list/src/utils/store.ts +0 -5
- package/attributes-master/packages/list/tsconfig.json +0 -3
- package/attributes-master/packages/mirrorclick/CHANGELOG.md +0 -171
- package/attributes-master/packages/mirrorclick/README.md +0 -25
- package/attributes-master/packages/mirrorclick/package.json +0 -22
- package/attributes-master/packages/mirrorclick/src/index.ts +0 -3
- package/attributes-master/packages/mirrorclick/src/init.ts +0 -35
- package/attributes-master/packages/mirrorclick/src/utils/constants.ts +0 -20
- package/attributes-master/packages/mirrorclick/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/mirrorclick/tsconfig.json +0 -3
- package/attributes-master/packages/mirrorinput/CHANGELOG.md +0 -172
- package/attributes-master/packages/mirrorinput/README.md +0 -25
- package/attributes-master/packages/mirrorinput/package.json +0 -22
- package/attributes-master/packages/mirrorinput/src/index.ts +0 -3
- package/attributes-master/packages/mirrorinput/src/init.ts +0 -48
- package/attributes-master/packages/mirrorinput/src/utils/constants.ts +0 -15
- package/attributes-master/packages/mirrorinput/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/mirrorinput/tsconfig.json +0 -3
- package/attributes-master/packages/modal/CHANGELOG.md +0 -94
- package/attributes-master/packages/modal/README.md +0 -29
- package/attributes-master/packages/modal/package.json +0 -23
- package/attributes-master/packages/modal/src/actions/a11y.ts +0 -46
- package/attributes-master/packages/modal/src/actions/modal.ts +0 -164
- package/attributes-master/packages/modal/src/actions/settings.ts +0 -21
- package/attributes-master/packages/modal/src/factory.ts +0 -26
- package/attributes-master/packages/modal/src/index.ts +0 -3
- package/attributes-master/packages/modal/src/init.ts +0 -22
- package/attributes-master/packages/modal/src/utils/constants.ts +0 -54
- package/attributes-master/packages/modal/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/modal/src/utils/types.ts +0 -12
- package/attributes-master/packages/modal/tsconfig.json +0 -3
- package/attributes-master/packages/numbercount/CHANGELOG.md +0 -90
- package/attributes-master/packages/numbercount/README.md +0 -27
- package/attributes-master/packages/numbercount/package.json +0 -23
- package/attributes-master/packages/numbercount/src/actions/a11y.ts +0 -26
- package/attributes-master/packages/numbercount/src/actions/animate.ts +0 -43
- package/attributes-master/packages/numbercount/src/actions/observe.ts +0 -44
- package/attributes-master/packages/numbercount/src/factory.ts +0 -31
- package/attributes-master/packages/numbercount/src/index.ts +0 -3
- package/attributes-master/packages/numbercount/src/init.ts +0 -22
- package/attributes-master/packages/numbercount/src/utils/constants.ts +0 -40
- package/attributes-master/packages/numbercount/src/utils/helpers.ts +0 -31
- package/attributes-master/packages/numbercount/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/numbercount/tsconfig.json +0 -3
- package/attributes-master/packages/queryparam/CHANGELOG.md +0 -118
- package/attributes-master/packages/queryparam/README.md +0 -25
- package/attributes-master/packages/queryparam/package.json +0 -22
- package/attributes-master/packages/queryparam/src/factory.ts +0 -51
- package/attributes-master/packages/queryparam/src/index.ts +0 -3
- package/attributes-master/packages/queryparam/src/init.ts +0 -40
- package/attributes-master/packages/queryparam/src/utils/constants.ts +0 -18
- package/attributes-master/packages/queryparam/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/queryparam/tsconfig.json +0 -3
- package/attributes-master/packages/rangeslider/CHANGELOG.md +0 -236
- package/attributes-master/packages/rangeslider/README.md +0 -95
- package/attributes-master/packages/rangeslider/package.json +0 -23
- package/attributes-master/packages/rangeslider/src/actions/a11y.ts +0 -21
- package/attributes-master/packages/rangeslider/src/actions/events.ts +0 -9
- package/attributes-master/packages/rangeslider/src/actions/settings.ts +0 -97
- package/attributes-master/packages/rangeslider/src/actions/styles.ts +0 -10
- package/attributes-master/packages/rangeslider/src/actions/values.ts +0 -47
- package/attributes-master/packages/rangeslider/src/components/Fill.ts +0 -70
- package/attributes-master/packages/rangeslider/src/components/Handle.ts +0 -281
- package/attributes-master/packages/rangeslider/src/factory.ts +0 -100
- package/attributes-master/packages/rangeslider/src/index.ts +0 -3
- package/attributes-master/packages/rangeslider/src/init.ts +0 -194
- package/attributes-master/packages/rangeslider/src/utils/constants.ts +0 -87
- package/attributes-master/packages/rangeslider/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/rangeslider/src/utils/types.ts +0 -6
- package/attributes-master/packages/rangeslider/tsconfig.json +0 -3
- package/attributes-master/packages/readtime/CHANGELOG.md +0 -108
- package/attributes-master/packages/readtime/README.md +0 -25
- package/attributes-master/packages/readtime/package.json +0 -22
- package/attributes-master/packages/readtime/src/factory.ts +0 -21
- package/attributes-master/packages/readtime/src/index.ts +0 -3
- package/attributes-master/packages/readtime/src/init.ts +0 -19
- package/attributes-master/packages/readtime/src/utils/constants.ts +0 -33
- package/attributes-master/packages/readtime/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/readtime/tsconfig.json +0 -3
- package/attributes-master/packages/removequery/CHANGELOG.md +0 -8
- package/attributes-master/packages/removequery/README.md +0 -25
- package/attributes-master/packages/removequery/package.json +0 -22
- package/attributes-master/packages/removequery/src/index.ts +0 -3
- package/attributes-master/packages/removequery/src/init.ts +0 -18
- package/attributes-master/packages/removequery/src/utils/constants.ts +0 -5
- package/attributes-master/packages/removequery/tsconfig.json +0 -3
- package/attributes-master/packages/scrolldisable/CHANGELOG.md +0 -164
- package/attributes-master/packages/scrolldisable/README.md +0 -29
- package/attributes-master/packages/scrolldisable/package.json +0 -27
- package/attributes-master/packages/scrolldisable/src/click.ts +0 -40
- package/attributes-master/packages/scrolldisable/src/display.ts +0 -117
- package/attributes-master/packages/scrolldisable/src/index.ts +0 -3
- package/attributes-master/packages/scrolldisable/src/init.ts +0 -36
- package/attributes-master/packages/scrolldisable/src/scroll.ts +0 -63
- package/attributes-master/packages/scrolldisable/src/utils/constants.ts +0 -56
- package/attributes-master/packages/scrolldisable/src/utils/selectors.ts +0 -6
- package/attributes-master/packages/scrolldisable/tsconfig.json +0 -3
- package/attributes-master/packages/selectcustom/CHANGELOG.md +0 -242
- package/attributes-master/packages/selectcustom/README.md +0 -25
- package/attributes-master/packages/selectcustom/package.json +0 -23
- package/attributes-master/packages/selectcustom/src/actions/a11y.ts +0 -29
- package/attributes-master/packages/selectcustom/src/actions/events.ts +0 -159
- package/attributes-master/packages/selectcustom/src/actions/observe.ts +0 -83
- package/attributes-master/packages/selectcustom/src/actions/populate.ts +0 -67
- package/attributes-master/packages/selectcustom/src/actions/settings.ts +0 -68
- package/attributes-master/packages/selectcustom/src/actions/state.ts +0 -41
- package/attributes-master/packages/selectcustom/src/index.ts +0 -3
- package/attributes-master/packages/selectcustom/src/init.ts +0 -51
- package/attributes-master/packages/selectcustom/src/utils/constants.ts +0 -34
- package/attributes-master/packages/selectcustom/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/selectcustom/src/utils/types.ts +0 -14
- package/attributes-master/packages/selectcustom/tsconfig.json +0 -3
- package/attributes-master/packages/sliderdots/CHANGELOG.md +0 -220
- package/attributes-master/packages/sliderdots/README.md +0 -27
- package/attributes-master/packages/sliderdots/package.json +0 -22
- package/attributes-master/packages/sliderdots/src/actions/events.ts +0 -26
- package/attributes-master/packages/sliderdots/src/actions/observe.ts +0 -40
- package/attributes-master/packages/sliderdots/src/actions/populate.ts +0 -46
- package/attributes-master/packages/sliderdots/src/actions/sync.ts +0 -28
- package/attributes-master/packages/sliderdots/src/actions/wait.ts +0 -28
- package/attributes-master/packages/sliderdots/src/factory.ts +0 -57
- package/attributes-master/packages/sliderdots/src/index.ts +0 -3
- package/attributes-master/packages/sliderdots/src/init.ts +0 -30
- package/attributes-master/packages/sliderdots/src/utils/constants.ts +0 -33
- package/attributes-master/packages/sliderdots/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/sliderdots/src/utils/types.ts +0 -7
- package/attributes-master/packages/sliderdots/tsconfig.json +0 -3
- package/attributes-master/packages/smartlightbox/CHANGELOG.md +0 -203
- package/attributes-master/packages/smartlightbox/README.md +0 -25
- package/attributes-master/packages/smartlightbox/package.json +0 -22
- package/attributes-master/packages/smartlightbox/src/actions/collect.ts +0 -15
- package/attributes-master/packages/smartlightbox/src/actions/move.ts +0 -25
- package/attributes-master/packages/smartlightbox/src/index.ts +0 -3
- package/attributes-master/packages/smartlightbox/src/init.ts +0 -61
- package/attributes-master/packages/smartlightbox/src/utils/constants.ts +0 -31
- package/attributes-master/packages/smartlightbox/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/smartlightbox/tsconfig.json +0 -3
- package/attributes-master/packages/socialshare/CHANGELOG.md +0 -170
- package/attributes-master/packages/socialshare/README.md +0 -25
- package/attributes-master/packages/socialshare/package.json +0 -25
- package/attributes-master/packages/socialshare/src/actions/collect.ts +0 -93
- package/attributes-master/packages/socialshare/src/actions/share.ts +0 -91
- package/attributes-master/packages/socialshare/src/actions/trigger.ts +0 -46
- package/attributes-master/packages/socialshare/src/factory.ts +0 -149
- package/attributes-master/packages/socialshare/src/index.ts +0 -3
- package/attributes-master/packages/socialshare/src/init.ts +0 -35
- package/attributes-master/packages/socialshare/src/utils/constants.ts +0 -94
- package/attributes-master/packages/socialshare/src/utils/dom.ts +0 -8
- package/attributes-master/packages/socialshare/src/utils/selectors.ts +0 -6
- package/attributes-master/packages/socialshare/src/utils/stores.ts +0 -10
- package/attributes-master/packages/socialshare/src/utils/types.ts +0 -34
- package/attributes-master/packages/socialshare/tsconfig.json +0 -3
- package/attributes-master/packages/starrating/CHANGELOG.md +0 -70
- package/attributes-master/packages/starrating/README.md +0 -25
- package/attributes-master/packages/starrating/package.json +0 -22
- package/attributes-master/packages/starrating/src/actions/classes.ts +0 -41
- package/attributes-master/packages/starrating/src/actions/events.ts +0 -80
- package/attributes-master/packages/starrating/src/factory.ts +0 -24
- package/attributes-master/packages/starrating/src/index.ts +0 -3
- package/attributes-master/packages/starrating/src/init.ts +0 -24
- package/attributes-master/packages/starrating/src/utils/constants.ts +0 -20
- package/attributes-master/packages/starrating/src/utils/helpers.ts +0 -63
- package/attributes-master/packages/starrating/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/starrating/tsconfig.json +0 -3
- package/attributes-master/packages/template/README.md +0 -25
- package/attributes-master/packages/template/package.json +0 -22
- package/attributes-master/packages/template/src/actions/console.ts +0 -4
- package/attributes-master/packages/template/src/index.ts +0 -3
- package/attributes-master/packages/template/src/init.ts +0 -14
- package/attributes-master/packages/template/src/utils/constants.ts +0 -18
- package/attributes-master/packages/template/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/template/tsconfig.json +0 -3
- package/attributes-master/packages/toc/CHANGELOG.md +0 -192
- package/attributes-master/packages/toc/README.md +0 -25
- package/attributes-master/packages/toc/package.json +0 -23
- package/attributes-master/packages/toc/src/actions/collect.ts +0 -136
- package/attributes-master/packages/toc/src/actions/create.ts +0 -44
- package/attributes-master/packages/toc/src/actions/events.ts +0 -29
- package/attributes-master/packages/toc/src/actions/observe.ts +0 -31
- package/attributes-master/packages/toc/src/actions/populate.ts +0 -68
- package/attributes-master/packages/toc/src/actions/prepare.ts +0 -25
- package/attributes-master/packages/toc/src/actions/scroll.ts +0 -33
- package/attributes-master/packages/toc/src/components/TOCItem.ts +0 -88
- package/attributes-master/packages/toc/src/factory.ts +0 -47
- package/attributes-master/packages/toc/src/index.ts +0 -3
- package/attributes-master/packages/toc/src/init.ts +0 -37
- package/attributes-master/packages/toc/src/utils/constants.ts +0 -55
- package/attributes-master/packages/toc/src/utils/helpers.ts +0 -23
- package/attributes-master/packages/toc/src/utils/selectors.ts +0 -6
- package/attributes-master/packages/toc/src/utils/types.ts +0 -21
- package/attributes-master/packages/toc/tsconfig.json +0 -3
- package/attributes-master/packages/utils/CHANGELOG.md +0 -43
- package/attributes-master/packages/utils/package.json +0 -27
- package/attributes-master/packages/utils/src/animations/factory.ts +0 -100
- package/attributes-master/packages/utils/src/animations/index.ts +0 -73
- package/attributes-master/packages/utils/src/animations/types.ts +0 -37
- package/attributes-master/packages/utils/src/components/Interaction.ts +0 -79
- package/attributes-master/packages/utils/src/components/Renderer.ts +0 -59
- package/attributes-master/packages/utils/src/components/index.ts +0 -2
- package/attributes-master/packages/utils/src/constants/a11y.ts +0 -50
- package/attributes-master/packages/utils/src/constants/attributes.ts +0 -57
- package/attributes-master/packages/utils/src/constants/index.ts +0 -5
- package/attributes-master/packages/utils/src/constants/keyboard.ts +0 -10
- package/attributes-master/packages/utils/src/constants/webflow.ts +0 -74
- package/attributes-master/packages/utils/src/helpers/dates.ts +0 -17
- package/attributes-master/packages/utils/src/helpers/dom.ts +0 -82
- package/attributes-master/packages/utils/src/helpers/events.ts +0 -59
- package/attributes-master/packages/utils/src/helpers/fetch.ts +0 -217
- package/attributes-master/packages/utils/src/helpers/forms.ts +0 -238
- package/attributes-master/packages/utils/src/helpers/guards.ts +0 -138
- package/attributes-master/packages/utils/src/helpers/index.ts +0 -11
- package/attributes-master/packages/utils/src/helpers/numbers.ts +0 -86
- package/attributes-master/packages/utils/src/helpers/selectors.ts +0 -249
- package/attributes-master/packages/utils/src/helpers/strings.ts +0 -19
- package/attributes-master/packages/utils/src/helpers/wait.ts +0 -36
- package/attributes-master/packages/utils/src/helpers/webflow.ts +0 -117
- package/attributes-master/packages/utils/src/index.ts +0 -5
- package/attributes-master/packages/utils/src/types/core.ts +0 -100
- package/attributes-master/packages/utils/src/types/dom.ts +0 -31
- package/attributes-master/packages/utils/src/types/index.ts +0 -4
- package/attributes-master/packages/utils/src/types/utils.ts +0 -20
- package/attributes-master/packages/utils/src/types/webflow.ts +0 -147
- package/attributes-master/packages/utils/tsconfig.json +0 -3
- package/attributes-master/packages/videohls/CHANGELOG.md +0 -76
- package/attributes-master/packages/videohls/README.md +0 -27
- package/attributes-master/packages/videohls/package.json +0 -26
- package/attributes-master/packages/videohls/src/actions/list.ts +0 -23
- package/attributes-master/packages/videohls/src/actions/video.ts +0 -44
- package/attributes-master/packages/videohls/src/index.ts +0 -3
- package/attributes-master/packages/videohls/src/init.ts +0 -28
- package/attributes-master/packages/videohls/src/utils/constants.ts +0 -12
- package/attributes-master/packages/videohls/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/videohls/src/utils/stores.ts +0 -3
- package/attributes-master/packages/videohls/tsconfig.json +0 -3
- package/attributes-master/pnpm-lock.yaml +0 -3317
- package/attributes-master/pnpm-workspace.yaml +0 -3
- package/attributes-master/tsconfig.json +0 -6
- package/autoInit/smooth-scroll.js +0 -89
- package/debug-version.html +0 -37
- package/utils/navbar.js +0 -214
- package/utils/scroll-progress.js +0 -29
- 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
|
-
});
|