@hortonstudio/main 1.2.5 → 1.2.6
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/attributes-master/.changeset/README.md +8 -0
- package/attributes-master/.changeset/config.json +11 -0
- package/attributes-master/.gitattributes +2 -0
- package/attributes-master/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
- package/attributes-master/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- package/attributes-master/.github/workflows/ci.yml +66 -0
- package/attributes-master/.github/workflows/release.yml +40 -0
- package/attributes-master/.prettierignore +3 -0
- package/attributes-master/.prettierrc +8 -0
- package/attributes-master/.vscode/extensions.json +3 -0
- package/attributes-master/.vscode/settings.json +7 -0
- package/attributes-master/CONTRIBUTING.md +72 -0
- package/attributes-master/LICENSE.md +201 -0
- package/attributes-master/README.md +31 -0
- package/attributes-master/eslint.config.js +3 -0
- package/attributes-master/package.json +34 -0
- package/attributes-master/packages/accordion/CHANGELOG.md +89 -0
- package/attributes-master/packages/accordion/README.md +31 -0
- package/attributes-master/packages/accordion/package.json +25 -0
- package/attributes-master/packages/accordion/src/actions/a11y.ts +39 -0
- package/attributes-master/packages/accordion/src/actions/classes.ts +27 -0
- package/attributes-master/packages/accordion/src/actions/content.ts +42 -0
- package/attributes-master/packages/accordion/src/actions/list.ts +36 -0
- package/attributes-master/packages/accordion/src/actions/query.ts +27 -0
- package/attributes-master/packages/accordion/src/actions/settings.ts +61 -0
- package/attributes-master/packages/accordion/src/factory.ts +145 -0
- package/attributes-master/packages/accordion/src/index.ts +3 -0
- package/attributes-master/packages/accordion/src/init.ts +37 -0
- package/attributes-master/packages/accordion/src/utils/constants.ts +62 -0
- package/attributes-master/packages/accordion/src/utils/helpers.ts +5 -0
- package/attributes-master/packages/accordion/src/utils/selectors.ts +12 -0
- package/attributes-master/packages/accordion/src/utils/types.ts +23 -0
- package/attributes-master/packages/accordion/tsconfig.json +3 -0
- package/attributes-master/packages/attributes/CHANGELOG.md +564 -0
- package/attributes-master/packages/attributes/README.md +66 -0
- package/attributes-master/packages/attributes/bin/build.ts +107 -0
- package/attributes-master/packages/attributes/bin/live-reload.js +1 -0
- package/attributes-master/packages/attributes/package.json +77 -0
- package/attributes-master/packages/attributes/playwright.config.ts +89 -0
- package/attributes-master/packages/attributes/src/attributes.ts +153 -0
- package/attributes-master/packages/attributes/src/load.ts +125 -0
- package/attributes-master/packages/attributes/tests/accordion.spec.ts +137 -0
- package/attributes-master/packages/attributes/tests/codehighlight.spec.ts +23 -0
- package/attributes-master/packages/attributes/tests/combobox.spec.ts +321 -0
- package/attributes-master/packages/attributes/tests/copyclip.spec.ts +19 -0
- package/attributes-master/packages/attributes/tests/displayvalues.spec.ts +48 -0
- package/attributes-master/packages/attributes/tests/favcustom.spec.ts +23 -0
- package/attributes-master/packages/attributes/tests/inject.spec.ts +40 -0
- package/attributes-master/packages/attributes/tests/inputactive.spec.ts +77 -0
- package/attributes-master/packages/attributes/tests/inputcounter.spec.ts +83 -0
- package/attributes-master/packages/attributes/tests/list.spec.ts +800 -0
- package/attributes-master/packages/attributes/tests/mirrorclick.spec.ts +22 -0
- package/attributes-master/packages/attributes/tests/mirrorinput.spec.ts +37 -0
- package/attributes-master/packages/attributes/tests/modal.spec.ts +34 -0
- package/attributes-master/packages/attributes/tests/numbercount.spec.ts +40 -0
- package/attributes-master/packages/attributes/tests/readtime.spec.ts +19 -0
- package/attributes-master/packages/attributes/tests/selectcustom.spec.ts +51 -0
- package/attributes-master/packages/attributes/tests/socialshare.spec.ts +54 -0
- package/attributes-master/packages/attributes/tests/starrating.spec.ts +79 -0
- package/attributes-master/packages/attributes/tests/toc.spec.ts +38 -0
- package/attributes-master/packages/attributes/tests/utils/index.ts +16 -0
- package/attributes-master/packages/attributes/tsconfig.json +6 -0
- package/attributes-master/packages/autovideo/CHANGELOG.md +182 -0
- package/attributes-master/packages/autovideo/README.md +31 -0
- package/attributes-master/packages/autovideo/package.json +22 -0
- package/attributes-master/packages/autovideo/src/index.ts +3 -0
- package/attributes-master/packages/autovideo/src/init.ts +52 -0
- package/attributes-master/packages/autovideo/src/types.ts +5 -0
- package/attributes-master/packages/autovideo/src/utils/constants.ts +4 -0
- package/attributes-master/packages/autovideo/tsconfig.json +3 -0
- package/attributes-master/packages/codehighlight/CHANGELOG.md +185 -0
- package/attributes-master/packages/codehighlight/README.md +27 -0
- package/attributes-master/packages/codehighlight/package.json +23 -0
- package/attributes-master/packages/codehighlight/src/actions/import.ts +50 -0
- package/attributes-master/packages/codehighlight/src/index.ts +3 -0
- package/attributes-master/packages/codehighlight/src/init.ts +53 -0
- package/attributes-master/packages/codehighlight/src/utils/constants.ts +24 -0
- package/attributes-master/packages/codehighlight/src/utils/selectors.ts +5 -0
- package/attributes-master/packages/codehighlight/src/utils/themes.ts +202 -0
- package/attributes-master/packages/codehighlight/tsconfig.json +3 -0
- package/attributes-master/packages/combobox/CHANGELOG.md +99 -0
- package/attributes-master/packages/combobox/README.md +27 -0
- package/attributes-master/packages/combobox/package.json +23 -0
- package/attributes-master/packages/combobox/src/actions/a11y.ts +29 -0
- package/attributes-master/packages/combobox/src/actions/body/index.ts +12 -0
- package/attributes-master/packages/combobox/src/actions/clearDropdown/index.ts +37 -0
- package/attributes-master/packages/combobox/src/actions/dropdownList/index.ts +220 -0
- package/attributes-master/packages/combobox/src/actions/dropdownToggle/index.ts +34 -0
- package/attributes-master/packages/combobox/src/actions/events.ts +75 -0
- package/attributes-master/packages/combobox/src/actions/input/index.ts +235 -0
- package/attributes-master/packages/combobox/src/actions/observe.ts +158 -0
- package/attributes-master/packages/combobox/src/actions/populate.ts +97 -0
- package/attributes-master/packages/combobox/src/actions/selectElement/index.ts +23 -0
- package/attributes-master/packages/combobox/src/actions/settings.ts +134 -0
- package/attributes-master/packages/combobox/src/actions/state.ts +34 -0
- package/attributes-master/packages/combobox/src/index.ts +3 -0
- package/attributes-master/packages/combobox/src/init.ts +52 -0
- package/attributes-master/packages/combobox/src/utils/constants.ts +48 -0
- package/attributes-master/packages/combobox/src/utils/dropdowns.ts +120 -0
- package/attributes-master/packages/combobox/src/utils/index.ts +1 -0
- package/attributes-master/packages/combobox/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/combobox/src/utils/types.ts +14 -0
- package/attributes-master/packages/combobox/tsconfig.json +3 -0
- package/attributes-master/packages/copyclip/CHANGELOG.md +213 -0
- package/attributes-master/packages/copyclip/README.md +27 -0
- package/attributes-master/packages/copyclip/package.json +23 -0
- package/attributes-master/packages/copyclip/src/factory.ts +67 -0
- package/attributes-master/packages/copyclip/src/index.ts +3 -0
- package/attributes-master/packages/copyclip/src/init.ts +68 -0
- package/attributes-master/packages/copyclip/src/utils/constants.ts +40 -0
- package/attributes-master/packages/copyclip/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/copyclip/tsconfig.json +3 -0
- package/attributes-master/packages/displayvalues/CHANGELOG.md +164 -0
- package/attributes-master/packages/displayvalues/README.md +27 -0
- package/attributes-master/packages/displayvalues/package.json +22 -0
- package/attributes-master/packages/displayvalues/src/actions/collect.ts +17 -0
- package/attributes-master/packages/displayvalues/src/actions/events.ts +22 -0
- package/attributes-master/packages/displayvalues/src/actions/sync.ts +23 -0
- package/attributes-master/packages/displayvalues/src/index.ts +3 -0
- package/attributes-master/packages/displayvalues/src/init.ts +31 -0
- package/attributes-master/packages/displayvalues/src/utils/constants.ts +20 -0
- package/attributes-master/packages/displayvalues/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/displayvalues/src/utils/stores.ts +3 -0
- package/attributes-master/packages/displayvalues/tsconfig.json +3 -0
- package/attributes-master/packages/docs/CHANGELOG.md +108 -0
- package/attributes-master/packages/docs/README.md +3 -0
- package/attributes-master/packages/docs/bin/build.js +92 -0
- package/attributes-master/packages/docs/bin/live-reload.js +1 -0
- package/attributes-master/packages/docs/package.json +40 -0
- package/attributes-master/packages/docs/src/copy.ts +260 -0
- package/attributes-master/packages/docs/src/x-ray.ts +377 -0
- package/attributes-master/packages/docs/tsconfig.json +3 -0
- package/attributes-master/packages/favcustom/CHANGELOG.md +194 -0
- package/attributes-master/packages/favcustom/README.md +27 -0
- package/attributes-master/packages/favcustom/package.json +22 -0
- package/attributes-master/packages/favcustom/src/index.ts +3 -0
- package/attributes-master/packages/favcustom/src/init.ts +30 -0
- package/attributes-master/packages/favcustom/src/utils/constants.ts +10 -0
- package/attributes-master/packages/favcustom/src/utils/selectors.ts +5 -0
- package/attributes-master/packages/favcustom/tsconfig.json +3 -0
- package/attributes-master/packages/formsubmit/CHANGELOG.md +161 -0
- package/attributes-master/packages/formsubmit/README.md +51 -0
- package/attributes-master/packages/formsubmit/package.json +22 -0
- package/attributes-master/packages/formsubmit/src/actions/redirect.ts +9 -0
- package/attributes-master/packages/formsubmit/src/actions/reset.ts +49 -0
- package/attributes-master/packages/formsubmit/src/actions/submit.ts +34 -0
- package/attributes-master/packages/formsubmit/src/components/Form.ts +231 -0
- package/attributes-master/packages/formsubmit/src/factory.ts +62 -0
- package/attributes-master/packages/formsubmit/src/index.ts +3 -0
- package/attributes-master/packages/formsubmit/src/init.ts +24 -0
- package/attributes-master/packages/formsubmit/src/utils/attributes.ts +19 -0
- package/attributes-master/packages/formsubmit/src/utils/constants.ts +89 -0
- package/attributes-master/packages/formsubmit/src/utils/dom.ts +76 -0
- package/attributes-master/packages/formsubmit/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/formsubmit/src/utils/types.ts +7 -0
- package/attributes-master/packages/formsubmit/tsconfig.json +3 -0
- package/attributes-master/packages/inject/CHANGELOG.md +117 -0
- package/attributes-master/packages/inject/README.md +60 -0
- package/attributes-master/packages/inject/package.json +22 -0
- package/attributes-master/packages/inject/src/actions/collect.ts +125 -0
- package/attributes-master/packages/inject/src/actions/css.ts +27 -0
- package/attributes-master/packages/inject/src/actions/prefetch.ts +44 -0
- package/attributes-master/packages/inject/src/factory.ts +123 -0
- package/attributes-master/packages/inject/src/index.ts +3 -0
- package/attributes-master/packages/inject/src/init.ts +22 -0
- package/attributes-master/packages/inject/src/utils/constants.ts +89 -0
- package/attributes-master/packages/inject/src/utils/helpers.ts +36 -0
- package/attributes-master/packages/inject/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/inject/src/utils/types.ts +16 -0
- package/attributes-master/packages/inject/tsconfig.json +3 -0
- package/attributes-master/packages/inputactive/CHANGELOG.md +58 -0
- package/attributes-master/packages/inputactive/README.md +25 -0
- package/attributes-master/packages/inputactive/package.json +22 -0
- package/attributes-master/packages/inputactive/src/actions/classes.ts +43 -0
- package/attributes-master/packages/inputactive/src/factory.ts +24 -0
- package/attributes-master/packages/inputactive/src/index.ts +3 -0
- package/attributes-master/packages/inputactive/src/init.ts +18 -0
- package/attributes-master/packages/inputactive/src/utils/constants.ts +13 -0
- package/attributes-master/packages/inputactive/src/utils/selectors.ts +5 -0
- package/attributes-master/packages/inputactive/tsconfig.json +3 -0
- package/attributes-master/packages/inputcounter/CHANGELOG.md +110 -0
- package/attributes-master/packages/inputcounter/README.md +25 -0
- package/attributes-master/packages/inputcounter/package.json +22 -0
- package/attributes-master/packages/inputcounter/src/actions/a11y.ts +23 -0
- package/attributes-master/packages/inputcounter/src/actions/buttons.ts +61 -0
- package/attributes-master/packages/inputcounter/src/actions/input.ts +31 -0
- package/attributes-master/packages/inputcounter/src/actions/style.ts +12 -0
- package/attributes-master/packages/inputcounter/src/factory.ts +51 -0
- package/attributes-master/packages/inputcounter/src/index.ts +3 -0
- package/attributes-master/packages/inputcounter/src/init.ts +22 -0
- package/attributes-master/packages/inputcounter/src/utils/constants.ts +59 -0
- package/attributes-master/packages/inputcounter/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/inputcounter/tsconfig.json +3 -0
- package/attributes-master/packages/list/CHANGELOG.md +185 -0
- package/attributes-master/packages/list/README.md +331 -0
- package/attributes-master/packages/list/package.json +37 -0
- package/attributes-master/packages/list/src/combine/index.ts +38 -0
- package/attributes-master/packages/list/src/components/List.ts +861 -0
- package/attributes-master/packages/list/src/components/ListItem.ts +229 -0
- package/attributes-master/packages/list/src/components/index.ts +2 -0
- package/attributes-master/packages/list/src/factory.ts +130 -0
- package/attributes-master/packages/list/src/filter/dynamic/conditions.ts +639 -0
- package/attributes-master/packages/list/src/filter/dynamic/groups.ts +221 -0
- package/attributes-master/packages/list/src/filter/dynamic/index.ts +119 -0
- package/attributes-master/packages/list/src/filter/dynamic/utils.ts +44 -0
- package/attributes-master/packages/list/src/filter/elements.ts +93 -0
- package/attributes-master/packages/list/src/filter/filter.ts +118 -0
- package/attributes-master/packages/list/src/filter/filter.worker.ts +152 -0
- package/attributes-master/packages/list/src/filter/index.ts +94 -0
- package/attributes-master/packages/list/src/filter/standard/conditions.ts +123 -0
- package/attributes-master/packages/list/src/filter/standard/facets.ts +253 -0
- package/attributes-master/packages/list/src/filter/standard/index.ts +176 -0
- package/attributes-master/packages/list/src/filter/standard/query.ts +111 -0
- package/attributes-master/packages/list/src/filter/tags.ts +314 -0
- package/attributes-master/packages/list/src/filter/types.ts +62 -0
- package/attributes-master/packages/list/src/filter/utils.ts +126 -0
- package/attributes-master/packages/list/src/index.ts +4 -0
- package/attributes-master/packages/list/src/init.ts +38 -0
- package/attributes-master/packages/list/src/load/all.ts +27 -0
- package/attributes-master/packages/list/src/load/elements.ts +39 -0
- package/attributes-master/packages/list/src/load/index.ts +63 -0
- package/attributes-master/packages/list/src/load/infinite.ts +79 -0
- package/attributes-master/packages/list/src/load/load.ts +191 -0
- package/attributes-master/packages/list/src/load/more.ts +97 -0
- package/attributes-master/packages/list/src/load/pagination.ts +402 -0
- package/attributes-master/packages/list/src/nest/index.ts +198 -0
- package/attributes-master/packages/list/src/prevnext/index.ts +98 -0
- package/attributes-master/packages/list/src/select/index.ts +56 -0
- package/attributes-master/packages/list/src/slider/index.ts +62 -0
- package/attributes-master/packages/list/src/sort/buttons.ts +96 -0
- package/attributes-master/packages/list/src/sort/dropdown.ts +179 -0
- package/attributes-master/packages/list/src/sort/index.ts +81 -0
- package/attributes-master/packages/list/src/sort/query.ts +63 -0
- package/attributes-master/packages/list/src/sort/select.ts +67 -0
- package/attributes-master/packages/list/src/sort/sort.ts +79 -0
- package/attributes-master/packages/list/src/sort/types.ts +28 -0
- package/attributes-master/packages/list/src/static/index.ts +73 -0
- package/attributes-master/packages/list/src/tabs/index.ts +97 -0
- package/attributes-master/packages/list/src/utils/constants.ts +728 -0
- package/attributes-master/packages/list/src/utils/dom.ts +108 -0
- package/attributes-master/packages/list/src/utils/pagination.ts +14 -0
- package/attributes-master/packages/list/src/utils/selectors.ts +18 -0
- package/attributes-master/packages/list/src/utils/store.ts +5 -0
- package/attributes-master/packages/list/tsconfig.json +3 -0
- package/attributes-master/packages/mirrorclick/CHANGELOG.md +171 -0
- package/attributes-master/packages/mirrorclick/README.md +25 -0
- package/attributes-master/packages/mirrorclick/package.json +22 -0
- package/attributes-master/packages/mirrorclick/src/index.ts +3 -0
- package/attributes-master/packages/mirrorclick/src/init.ts +35 -0
- package/attributes-master/packages/mirrorclick/src/utils/constants.ts +20 -0
- package/attributes-master/packages/mirrorclick/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/mirrorclick/tsconfig.json +3 -0
- package/attributes-master/packages/mirrorinput/CHANGELOG.md +172 -0
- package/attributes-master/packages/mirrorinput/README.md +25 -0
- package/attributes-master/packages/mirrorinput/package.json +22 -0
- package/attributes-master/packages/mirrorinput/src/index.ts +3 -0
- package/attributes-master/packages/mirrorinput/src/init.ts +48 -0
- package/attributes-master/packages/mirrorinput/src/utils/constants.ts +15 -0
- package/attributes-master/packages/mirrorinput/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/mirrorinput/tsconfig.json +3 -0
- package/attributes-master/packages/modal/CHANGELOG.md +94 -0
- package/attributes-master/packages/modal/README.md +29 -0
- package/attributes-master/packages/modal/package.json +23 -0
- package/attributes-master/packages/modal/src/actions/a11y.ts +46 -0
- package/attributes-master/packages/modal/src/actions/modal.ts +164 -0
- package/attributes-master/packages/modal/src/actions/settings.ts +21 -0
- package/attributes-master/packages/modal/src/factory.ts +26 -0
- package/attributes-master/packages/modal/src/index.ts +3 -0
- package/attributes-master/packages/modal/src/init.ts +22 -0
- package/attributes-master/packages/modal/src/utils/constants.ts +54 -0
- package/attributes-master/packages/modal/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/modal/src/utils/types.ts +12 -0
- package/attributes-master/packages/modal/tsconfig.json +3 -0
- package/attributes-master/packages/numbercount/CHANGELOG.md +90 -0
- package/attributes-master/packages/numbercount/README.md +27 -0
- package/attributes-master/packages/numbercount/package.json +23 -0
- package/attributes-master/packages/numbercount/src/actions/a11y.ts +26 -0
- package/attributes-master/packages/numbercount/src/actions/animate.ts +43 -0
- package/attributes-master/packages/numbercount/src/actions/observe.ts +44 -0
- package/attributes-master/packages/numbercount/src/factory.ts +31 -0
- package/attributes-master/packages/numbercount/src/index.ts +3 -0
- package/attributes-master/packages/numbercount/src/init.ts +22 -0
- package/attributes-master/packages/numbercount/src/utils/constants.ts +40 -0
- package/attributes-master/packages/numbercount/src/utils/helpers.ts +31 -0
- package/attributes-master/packages/numbercount/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/numbercount/tsconfig.json +3 -0
- package/attributes-master/packages/queryparam/CHANGELOG.md +118 -0
- package/attributes-master/packages/queryparam/README.md +25 -0
- package/attributes-master/packages/queryparam/package.json +22 -0
- package/attributes-master/packages/queryparam/src/factory.ts +51 -0
- package/attributes-master/packages/queryparam/src/index.ts +3 -0
- package/attributes-master/packages/queryparam/src/init.ts +40 -0
- package/attributes-master/packages/queryparam/src/utils/constants.ts +18 -0
- package/attributes-master/packages/queryparam/src/utils/selectors.ts +5 -0
- package/attributes-master/packages/queryparam/tsconfig.json +3 -0
- package/attributes-master/packages/rangeslider/CHANGELOG.md +236 -0
- package/attributes-master/packages/rangeslider/README.md +95 -0
- package/attributes-master/packages/rangeslider/package.json +23 -0
- package/attributes-master/packages/rangeslider/src/actions/a11y.ts +21 -0
- package/attributes-master/packages/rangeslider/src/actions/events.ts +9 -0
- package/attributes-master/packages/rangeslider/src/actions/settings.ts +97 -0
- package/attributes-master/packages/rangeslider/src/actions/styles.ts +10 -0
- package/attributes-master/packages/rangeslider/src/actions/values.ts +47 -0
- package/attributes-master/packages/rangeslider/src/components/Fill.ts +70 -0
- package/attributes-master/packages/rangeslider/src/components/Handle.ts +281 -0
- package/attributes-master/packages/rangeslider/src/factory.ts +100 -0
- package/attributes-master/packages/rangeslider/src/index.ts +3 -0
- package/attributes-master/packages/rangeslider/src/init.ts +194 -0
- package/attributes-master/packages/rangeslider/src/utils/constants.ts +87 -0
- package/attributes-master/packages/rangeslider/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/rangeslider/src/utils/types.ts +6 -0
- package/attributes-master/packages/rangeslider/tsconfig.json +3 -0
- package/attributes-master/packages/readtime/CHANGELOG.md +108 -0
- package/attributes-master/packages/readtime/README.md +25 -0
- package/attributes-master/packages/readtime/package.json +22 -0
- package/attributes-master/packages/readtime/src/factory.ts +21 -0
- package/attributes-master/packages/readtime/src/index.ts +3 -0
- package/attributes-master/packages/readtime/src/init.ts +19 -0
- package/attributes-master/packages/readtime/src/utils/constants.ts +33 -0
- package/attributes-master/packages/readtime/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/readtime/tsconfig.json +3 -0
- package/attributes-master/packages/removequery/CHANGELOG.md +8 -0
- package/attributes-master/packages/removequery/README.md +25 -0
- package/attributes-master/packages/removequery/package.json +22 -0
- package/attributes-master/packages/removequery/src/index.ts +3 -0
- package/attributes-master/packages/removequery/src/init.ts +18 -0
- package/attributes-master/packages/removequery/src/utils/constants.ts +5 -0
- package/attributes-master/packages/removequery/tsconfig.json +3 -0
- package/attributes-master/packages/scrolldisable/CHANGELOG.md +164 -0
- package/attributes-master/packages/scrolldisable/README.md +29 -0
- package/attributes-master/packages/scrolldisable/package.json +27 -0
- package/attributes-master/packages/scrolldisable/src/click.ts +40 -0
- package/attributes-master/packages/scrolldisable/src/display.ts +117 -0
- package/attributes-master/packages/scrolldisable/src/index.ts +3 -0
- package/attributes-master/packages/scrolldisable/src/init.ts +36 -0
- package/attributes-master/packages/scrolldisable/src/scroll.ts +63 -0
- package/attributes-master/packages/scrolldisable/src/utils/constants.ts +56 -0
- package/attributes-master/packages/scrolldisable/src/utils/selectors.ts +6 -0
- package/attributes-master/packages/scrolldisable/tsconfig.json +3 -0
- package/attributes-master/packages/selectcustom/CHANGELOG.md +242 -0
- package/attributes-master/packages/selectcustom/README.md +25 -0
- package/attributes-master/packages/selectcustom/package.json +23 -0
- package/attributes-master/packages/selectcustom/src/actions/a11y.ts +29 -0
- package/attributes-master/packages/selectcustom/src/actions/events.ts +159 -0
- package/attributes-master/packages/selectcustom/src/actions/observe.ts +83 -0
- package/attributes-master/packages/selectcustom/src/actions/populate.ts +67 -0
- package/attributes-master/packages/selectcustom/src/actions/settings.ts +68 -0
- package/attributes-master/packages/selectcustom/src/actions/state.ts +41 -0
- package/attributes-master/packages/selectcustom/src/index.ts +3 -0
- package/attributes-master/packages/selectcustom/src/init.ts +51 -0
- package/attributes-master/packages/selectcustom/src/utils/constants.ts +34 -0
- package/attributes-master/packages/selectcustom/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/selectcustom/src/utils/types.ts +14 -0
- package/attributes-master/packages/selectcustom/tsconfig.json +3 -0
- package/attributes-master/packages/sliderdots/CHANGELOG.md +220 -0
- package/attributes-master/packages/sliderdots/README.md +27 -0
- package/attributes-master/packages/sliderdots/package.json +22 -0
- package/attributes-master/packages/sliderdots/src/actions/events.ts +26 -0
- package/attributes-master/packages/sliderdots/src/actions/observe.ts +40 -0
- package/attributes-master/packages/sliderdots/src/actions/populate.ts +46 -0
- package/attributes-master/packages/sliderdots/src/actions/sync.ts +28 -0
- package/attributes-master/packages/sliderdots/src/actions/wait.ts +28 -0
- package/attributes-master/packages/sliderdots/src/factory.ts +57 -0
- package/attributes-master/packages/sliderdots/src/index.ts +3 -0
- package/attributes-master/packages/sliderdots/src/init.ts +30 -0
- package/attributes-master/packages/sliderdots/src/utils/constants.ts +33 -0
- package/attributes-master/packages/sliderdots/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/sliderdots/src/utils/types.ts +7 -0
- package/attributes-master/packages/sliderdots/tsconfig.json +3 -0
- package/attributes-master/packages/smartlightbox/CHANGELOG.md +203 -0
- package/attributes-master/packages/smartlightbox/README.md +25 -0
- package/attributes-master/packages/smartlightbox/package.json +22 -0
- package/attributes-master/packages/smartlightbox/src/actions/collect.ts +15 -0
- package/attributes-master/packages/smartlightbox/src/actions/move.ts +25 -0
- package/attributes-master/packages/smartlightbox/src/index.ts +3 -0
- package/attributes-master/packages/smartlightbox/src/init.ts +61 -0
- package/attributes-master/packages/smartlightbox/src/utils/constants.ts +31 -0
- package/attributes-master/packages/smartlightbox/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/smartlightbox/tsconfig.json +3 -0
- package/attributes-master/packages/socialshare/CHANGELOG.md +170 -0
- package/attributes-master/packages/socialshare/README.md +25 -0
- package/attributes-master/packages/socialshare/package.json +25 -0
- package/attributes-master/packages/socialshare/src/actions/collect.ts +93 -0
- package/attributes-master/packages/socialshare/src/actions/share.ts +91 -0
- package/attributes-master/packages/socialshare/src/actions/trigger.ts +46 -0
- package/attributes-master/packages/socialshare/src/factory.ts +149 -0
- package/attributes-master/packages/socialshare/src/index.ts +3 -0
- package/attributes-master/packages/socialshare/src/init.ts +35 -0
- package/attributes-master/packages/socialshare/src/utils/constants.ts +94 -0
- package/attributes-master/packages/socialshare/src/utils/dom.ts +8 -0
- package/attributes-master/packages/socialshare/src/utils/selectors.ts +6 -0
- package/attributes-master/packages/socialshare/src/utils/stores.ts +10 -0
- package/attributes-master/packages/socialshare/src/utils/types.ts +34 -0
- package/attributes-master/packages/socialshare/tsconfig.json +3 -0
- package/attributes-master/packages/starrating/CHANGELOG.md +70 -0
- package/attributes-master/packages/starrating/README.md +25 -0
- package/attributes-master/packages/starrating/package.json +22 -0
- package/attributes-master/packages/starrating/src/actions/classes.ts +41 -0
- package/attributes-master/packages/starrating/src/actions/events.ts +80 -0
- package/attributes-master/packages/starrating/src/factory.ts +24 -0
- package/attributes-master/packages/starrating/src/index.ts +3 -0
- package/attributes-master/packages/starrating/src/init.ts +24 -0
- package/attributes-master/packages/starrating/src/utils/constants.ts +20 -0
- package/attributes-master/packages/starrating/src/utils/helpers.ts +63 -0
- package/attributes-master/packages/starrating/src/utils/selectors.ts +9 -0
- package/attributes-master/packages/starrating/tsconfig.json +3 -0
- package/attributes-master/packages/template/README.md +25 -0
- package/attributes-master/packages/template/package.json +22 -0
- package/attributes-master/packages/template/src/actions/console.ts +4 -0
- package/attributes-master/packages/template/src/index.ts +3 -0
- package/attributes-master/packages/template/src/init.ts +14 -0
- package/attributes-master/packages/template/src/utils/constants.ts +18 -0
- package/attributes-master/packages/template/src/utils/selectors.ts +5 -0
- package/attributes-master/packages/template/tsconfig.json +3 -0
- package/attributes-master/packages/toc/CHANGELOG.md +192 -0
- package/attributes-master/packages/toc/README.md +25 -0
- package/attributes-master/packages/toc/package.json +23 -0
- package/attributes-master/packages/toc/src/actions/collect.ts +136 -0
- package/attributes-master/packages/toc/src/actions/create.ts +44 -0
- package/attributes-master/packages/toc/src/actions/events.ts +29 -0
- package/attributes-master/packages/toc/src/actions/observe.ts +31 -0
- package/attributes-master/packages/toc/src/actions/populate.ts +68 -0
- package/attributes-master/packages/toc/src/actions/prepare.ts +25 -0
- package/attributes-master/packages/toc/src/actions/scroll.ts +33 -0
- package/attributes-master/packages/toc/src/components/TOCItem.ts +88 -0
- package/attributes-master/packages/toc/src/factory.ts +47 -0
- package/attributes-master/packages/toc/src/index.ts +3 -0
- package/attributes-master/packages/toc/src/init.ts +37 -0
- package/attributes-master/packages/toc/src/utils/constants.ts +55 -0
- package/attributes-master/packages/toc/src/utils/helpers.ts +23 -0
- package/attributes-master/packages/toc/src/utils/selectors.ts +6 -0
- package/attributes-master/packages/toc/src/utils/types.ts +21 -0
- package/attributes-master/packages/toc/tsconfig.json +3 -0
- package/attributes-master/packages/utils/CHANGELOG.md +43 -0
- package/attributes-master/packages/utils/package.json +27 -0
- package/attributes-master/packages/utils/src/animations/factory.ts +100 -0
- package/attributes-master/packages/utils/src/animations/index.ts +73 -0
- package/attributes-master/packages/utils/src/animations/types.ts +37 -0
- package/attributes-master/packages/utils/src/components/Interaction.ts +79 -0
- package/attributes-master/packages/utils/src/components/Renderer.ts +59 -0
- package/attributes-master/packages/utils/src/components/index.ts +2 -0
- package/attributes-master/packages/utils/src/constants/a11y.ts +50 -0
- package/attributes-master/packages/utils/src/constants/attributes.ts +57 -0
- package/attributes-master/packages/utils/src/constants/index.ts +5 -0
- package/attributes-master/packages/utils/src/constants/keyboard.ts +10 -0
- package/attributes-master/packages/utils/src/constants/webflow.ts +74 -0
- package/attributes-master/packages/utils/src/helpers/dates.ts +17 -0
- package/attributes-master/packages/utils/src/helpers/dom.ts +82 -0
- package/attributes-master/packages/utils/src/helpers/events.ts +59 -0
- package/attributes-master/packages/utils/src/helpers/fetch.ts +217 -0
- package/attributes-master/packages/utils/src/helpers/forms.ts +238 -0
- package/attributes-master/packages/utils/src/helpers/guards.ts +138 -0
- package/attributes-master/packages/utils/src/helpers/index.ts +11 -0
- package/attributes-master/packages/utils/src/helpers/numbers.ts +86 -0
- package/attributes-master/packages/utils/src/helpers/selectors.ts +249 -0
- package/attributes-master/packages/utils/src/helpers/strings.ts +19 -0
- package/attributes-master/packages/utils/src/helpers/wait.ts +36 -0
- package/attributes-master/packages/utils/src/helpers/webflow.ts +117 -0
- package/attributes-master/packages/utils/src/index.ts +5 -0
- package/attributes-master/packages/utils/src/types/core.ts +100 -0
- package/attributes-master/packages/utils/src/types/dom.ts +31 -0
- package/attributes-master/packages/utils/src/types/index.ts +4 -0
- package/attributes-master/packages/utils/src/types/utils.ts +20 -0
- package/attributes-master/packages/utils/src/types/webflow.ts +147 -0
- package/attributes-master/packages/utils/tsconfig.json +3 -0
- package/attributes-master/packages/videohls/CHANGELOG.md +76 -0
- package/attributes-master/packages/videohls/README.md +27 -0
- package/attributes-master/packages/videohls/package.json +26 -0
- package/attributes-master/packages/videohls/src/actions/list.ts +23 -0
- package/attributes-master/packages/videohls/src/actions/video.ts +44 -0
- package/attributes-master/packages/videohls/src/index.ts +3 -0
- package/attributes-master/packages/videohls/src/init.ts +28 -0
- package/attributes-master/packages/videohls/src/utils/constants.ts +12 -0
- package/attributes-master/packages/videohls/src/utils/selectors.ts +5 -0
- package/attributes-master/packages/videohls/src/utils/stores.ts +3 -0
- package/attributes-master/packages/videohls/tsconfig.json +3 -0
- package/attributes-master/pnpm-lock.yaml +3317 -0
- package/attributes-master/pnpm-workspace.yaml +3 -0
- package/attributes-master/tsconfig.json +6 -0
- package/index.js +173 -275
- package/package.json +1 -1
@@ -0,0 +1,43 @@
|
|
1
|
+
# @finsweet/attributes-utils
|
2
|
+
|
3
|
+
## 0.1.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- 2af0bad: feat: `removequery`
|
8
|
+
|
9
|
+
## 0.0.6
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- 378d74d: fix: unify public API under FinsweetAttributes and remove finsweetAttributes
|
14
|
+
|
15
|
+
## 0.0.5
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- 01973d8: fix: missing customValueAttribute param
|
20
|
+
|
21
|
+
## 0.0.4
|
22
|
+
|
23
|
+
### Patch Changes
|
24
|
+
|
25
|
+
- deef758: chore: rename `finsweetAttributes.solutions` -> `modules`
|
26
|
+
|
27
|
+
## 0.0.3
|
28
|
+
|
29
|
+
### Patch Changes
|
30
|
+
|
31
|
+
- d21cbca: refactor: unify form field value getters and setters
|
32
|
+
|
33
|
+
## 0.0.2
|
34
|
+
|
35
|
+
### Patch Changes
|
36
|
+
|
37
|
+
- c7b544d: chore: updated dependencies
|
38
|
+
|
39
|
+
## 0.0.1
|
40
|
+
|
41
|
+
### Patch Changes
|
42
|
+
|
43
|
+
- b56e5e5: rename fsAttribute in places of usage to finsweetAttribute
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"name": "@finsweet/attributes-utils",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"description": "Attributes utils",
|
5
|
+
"private": true,
|
6
|
+
"sideEffects": false,
|
7
|
+
"type": "module",
|
8
|
+
"types": "src/index.ts",
|
9
|
+
"scripts": {
|
10
|
+
"lint": "eslint ./src && prettier --check ./src",
|
11
|
+
"lint:fix": "eslint ./src --fix && prettier --write ./src",
|
12
|
+
"check": "tsc --noEmit"
|
13
|
+
},
|
14
|
+
"exports": {
|
15
|
+
".": {
|
16
|
+
"types": "./src/index.ts",
|
17
|
+
"import": "./src/index.ts"
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"devDependencies": {
|
21
|
+
"@motionone/dom": "^10.16.2",
|
22
|
+
"@motionone/types": "^10.15.1"
|
23
|
+
},
|
24
|
+
"dependencies": {
|
25
|
+
"motion": "^10.16.2"
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import { animate, stagger as staggerDelay } from 'motion';
|
2
|
+
|
3
|
+
import type { AnimationFunctions, AnimationProps } from './types';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Creates a new Animation.
|
7
|
+
* @param props The animaiton props.
|
8
|
+
* @returns A new `in` and `out` Animation functions.
|
9
|
+
*/
|
10
|
+
export const createAnimation = ({ initialStyles, keyframes }: AnimationProps): AnimationFunctions => {
|
11
|
+
/**
|
12
|
+
* Prepares the {@link animateIn} elements by setting the initial styles and rendering them to the DOM.
|
13
|
+
* @param elements The elements to prepare.
|
14
|
+
* @param options.target If defined, the element will be appended to the target.
|
15
|
+
* @param options.insertAfter A child of the target. If defined, the element will be appended right after this anchor element.
|
16
|
+
*/
|
17
|
+
const prepareIn: AnimationFunctions['prepareIn'] = (elements, options = {}) => {
|
18
|
+
const { target, insertAfter, display = '' } = options;
|
19
|
+
|
20
|
+
if (!Array.isArray(elements)) elements = [elements];
|
21
|
+
|
22
|
+
for (const element of elements) {
|
23
|
+
element.style.display = display;
|
24
|
+
Object.assign(element.style, initialStyles);
|
25
|
+
|
26
|
+
if (target && insertAfter !== undefined) {
|
27
|
+
if (insertAfter) target.insertBefore(element, insertAfter.nextSibling);
|
28
|
+
else target.prepend(element);
|
29
|
+
} else if (target) target.appendChild(element);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
|
33
|
+
/**
|
34
|
+
* In animation.
|
35
|
+
* @param elements The elements to animate.
|
36
|
+
* @param options.target If defined, the element will be appended to the target.
|
37
|
+
* @param options.insertAfter A child of the target. If defined, the element will be appended right after this anchor element.
|
38
|
+
* @param options.prepared Defines if the animation has been prepared beforehand, useful to avoid performing double preparation.
|
39
|
+
* @param options.stagger If defined, the animation will be staggered using this time value.
|
40
|
+
* @param options.animationOptions The main options of the animation. Reference: {@link [Motion One](https://motion.dev/dom/animate#options)}.
|
41
|
+
* @returns An awaitable promise.
|
42
|
+
*/
|
43
|
+
const animateIn: AnimationFunctions['animateIn'] = async (elements, options = {}) => {
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
45
|
+
const { prepared, stagger, display, duration, ...animationOptions } = options;
|
46
|
+
|
47
|
+
const durationInSeconds = duration ? duration / 1000 : undefined;
|
48
|
+
|
49
|
+
if (!prepared) prepareIn(elements, options);
|
50
|
+
|
51
|
+
const { finished } = animate(elements, keyframes, {
|
52
|
+
...animationOptions,
|
53
|
+
delay: stagger ? staggerDelay(stagger / 1000) : undefined,
|
54
|
+
duration: durationInSeconds,
|
55
|
+
});
|
56
|
+
|
57
|
+
return await finished;
|
58
|
+
};
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Out animation.
|
62
|
+
* @param elements The elements to animate.
|
63
|
+
* @param options.remove If defined, the element will be removed from the DOM after the animation ends.
|
64
|
+
* @param options.stagger If defined, the animation will be staggered using this time value.
|
65
|
+
* @param options.animationOptions The main options of the animation. Reference: {@link [Motion One](https://motion.dev/dom/animate#options)}.
|
66
|
+
* @returns An awaitable promise.
|
67
|
+
*/
|
68
|
+
const animateOut: AnimationFunctions['animateOut'] = async (elements, options = {}) => {
|
69
|
+
const { remove, stagger, target, insertAfter, display = 'none', duration, ...animationOptions } = options;
|
70
|
+
|
71
|
+
const durationInSeconds = duration ? duration / 1000 : undefined;
|
72
|
+
|
73
|
+
if (!Array.isArray(elements)) elements = [elements];
|
74
|
+
|
75
|
+
elements = elements.filter((element) => document.body.contains(element));
|
76
|
+
|
77
|
+
if (!elements.length) return;
|
78
|
+
|
79
|
+
const { finished } = animate(elements, keyframes, {
|
80
|
+
...animationOptions,
|
81
|
+
duration: durationInSeconds,
|
82
|
+
delay: stagger ? staggerDelay(stagger / 1000) : undefined,
|
83
|
+
direction: 'reverse',
|
84
|
+
});
|
85
|
+
|
86
|
+
await finished;
|
87
|
+
|
88
|
+
for (const element of elements) {
|
89
|
+
if (target && insertAfter !== undefined) {
|
90
|
+
if (insertAfter) target.insertBefore(element, insertAfter.nextSibling);
|
91
|
+
else target.prepend(element);
|
92
|
+
} else if (target) target.appendChild(element);
|
93
|
+
|
94
|
+
if (remove) element.remove();
|
95
|
+
else element.style.display = display;
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
99
|
+
return { prepareIn, animateIn, animateOut };
|
100
|
+
};
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { createAnimation } from './factory';
|
2
|
+
import type { AnimationsObject } from './types';
|
3
|
+
|
4
|
+
export * from './types';
|
5
|
+
|
6
|
+
// Constants
|
7
|
+
export const easings = ['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out'] as const;
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Contains all animation functions.
|
11
|
+
*/
|
12
|
+
export const animations: AnimationsObject = {
|
13
|
+
/**
|
14
|
+
* Fade
|
15
|
+
*/
|
16
|
+
fade: createAnimation({ keyframes: { opacity: [0, 1] }, initialStyles: { opacity: '0' } }),
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Slide Up
|
20
|
+
*/
|
21
|
+
'slide-up': createAnimation({
|
22
|
+
keyframes: { y: [100, 0], opacity: [0, 1] },
|
23
|
+
initialStyles: { transform: 'translateY(100px)', opacity: '0' },
|
24
|
+
}),
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Slide Down
|
28
|
+
*/
|
29
|
+
'slide-down': createAnimation({
|
30
|
+
keyframes: { y: [-100, 0], opacity: [0, 1] },
|
31
|
+
initialStyles: { transform: 'translateY(-100px)', opacity: '0' },
|
32
|
+
}),
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Slide Right
|
36
|
+
*/
|
37
|
+
'slide-right': createAnimation({
|
38
|
+
keyframes: { x: [-100, 0], opacity: [0, 1] },
|
39
|
+
initialStyles: { transform: 'translateX(-100px)', opacity: '0' },
|
40
|
+
}),
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Slide Left
|
44
|
+
*/
|
45
|
+
'slide-left': createAnimation({
|
46
|
+
keyframes: { x: [100, 0], opacity: [0, 1] },
|
47
|
+
initialStyles: { transform: 'translateX(100px)', opacity: '0' },
|
48
|
+
}),
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Grow
|
52
|
+
*/
|
53
|
+
grow: createAnimation({
|
54
|
+
keyframes: { scale: [0, 1], opacity: [0, 1] },
|
55
|
+
initialStyles: { transform: 'scale(0)', opacity: '0' },
|
56
|
+
}),
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Shrink
|
60
|
+
*/
|
61
|
+
shrink: createAnimation({
|
62
|
+
keyframes: { scale: [1.25, 1], opacity: [0, 1] },
|
63
|
+
initialStyles: { transform: 'scale(1.25)', opacity: '0' },
|
64
|
+
}),
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Spin
|
68
|
+
*/
|
69
|
+
spin: createAnimation({
|
70
|
+
keyframes: { rotate: [900, 0], opacity: [0, 1] },
|
71
|
+
initialStyles: { transform: 'rotate(900deg)', opacity: '0' },
|
72
|
+
}),
|
73
|
+
} as const;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import type { MotionKeyframesDefinition } from '@motionone/dom';
|
2
|
+
import type { AnimationOptions } from '@motionone/types';
|
3
|
+
|
4
|
+
import type { easings } from '.';
|
5
|
+
|
6
|
+
export interface AnimationProps {
|
7
|
+
keyframes: MotionKeyframesDefinition;
|
8
|
+
initialStyles: {
|
9
|
+
[key: string]: string;
|
10
|
+
};
|
11
|
+
}
|
12
|
+
|
13
|
+
type FilteredAnimationOptions = Pick<AnimationOptions, 'duration' | 'easing'> & { stagger?: number };
|
14
|
+
|
15
|
+
type AnimationPrepare<T> = (element: HTMLElement | HTMLElement[], options?: T) => void;
|
16
|
+
type AnimationBase<T> = (element: HTMLElement | HTMLElement[], options?: T & FilteredAnimationOptions) => Promise<void>;
|
17
|
+
|
18
|
+
type PrepareProps = { target?: Element; insertAfter?: Node | null; display?: string };
|
19
|
+
type AnimationInProps = PrepareProps & { prepared?: true };
|
20
|
+
type AnimationOutProps = PrepareProps & { remove?: boolean };
|
21
|
+
|
22
|
+
type PrepareIn = AnimationPrepare<PrepareProps>;
|
23
|
+
|
24
|
+
type AnimationIn = AnimationBase<AnimationInProps>;
|
25
|
+
type AnimationOut = AnimationBase<AnimationOutProps>;
|
26
|
+
|
27
|
+
export type AnimationFunctions = { prepareIn: PrepareIn; animateIn: AnimationIn; animateOut: AnimationOut };
|
28
|
+
export type Animation = AnimationFunctions & { options?: FilteredAnimationOptions };
|
29
|
+
|
30
|
+
export type AnimationsObject = Readonly<
|
31
|
+
Record<
|
32
|
+
'fade' | 'slide-up' | 'slide-down' | 'slide-right' | 'slide-left' | 'grow' | 'shrink' | 'spin',
|
33
|
+
AnimationFunctions
|
34
|
+
>
|
35
|
+
>;
|
36
|
+
|
37
|
+
export type Easings = typeof easings;
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { simulateEvent } from '../helpers';
|
2
|
+
import { wait } from '../helpers/wait';
|
3
|
+
|
4
|
+
// Types
|
5
|
+
export interface InteractionParams {
|
6
|
+
/**
|
7
|
+
* The element that has a Webflow Ix2 Click interaction binded to it.
|
8
|
+
*/
|
9
|
+
element: HTMLElement | string;
|
10
|
+
|
11
|
+
/**
|
12
|
+
* The duration of the interaction.
|
13
|
+
* If a single number is passed, it will be used for both first and second interactions.
|
14
|
+
* If an object is passed, you can specify the duration for each interaction.
|
15
|
+
*/
|
16
|
+
duration?: number | Partial<Interaction['duration']>;
|
17
|
+
}
|
18
|
+
|
19
|
+
export class Interaction {
|
20
|
+
private readonly element: HTMLElement;
|
21
|
+
private active = false;
|
22
|
+
private running = false;
|
23
|
+
private runningPromise?: Promise<unknown>;
|
24
|
+
|
25
|
+
public readonly duration: {
|
26
|
+
first: number;
|
27
|
+
second: number;
|
28
|
+
};
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Acts as the controller for a Webflow Interaction.
|
32
|
+
* It accepts an element that will be clicked when required (firing a Mouse Click interaction).
|
33
|
+
* @param element Element that has the Mouse Click interaction.
|
34
|
+
* @param duration Optionally, the duration can be explicitly set so the trigger methods will return an awaitable Promise.
|
35
|
+
*/
|
36
|
+
constructor({ element, duration }: InteractionParams) {
|
37
|
+
this.element = typeof element === 'string' ? document.querySelector<HTMLElement>(element)! : element;
|
38
|
+
|
39
|
+
this.duration = {
|
40
|
+
first: typeof duration === 'number' ? duration : (duration?.first ?? 0),
|
41
|
+
second: typeof duration === 'number' ? duration : (duration?.second ?? 0),
|
42
|
+
};
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Trigger the interaction
|
47
|
+
* @param click Perform first or second click
|
48
|
+
* @returns True if the interaction was fired
|
49
|
+
*/
|
50
|
+
public async trigger(click?: 'first' | 'second'): Promise<boolean> {
|
51
|
+
if ((click === 'first' && this.active) || (click === 'second' && !this.active)) return false;
|
52
|
+
if (!click) click = this.active ? 'second' : 'first';
|
53
|
+
|
54
|
+
simulateEvent(this.element, 'click');
|
55
|
+
|
56
|
+
this.running = true;
|
57
|
+
this.runningPromise = wait(this.duration[click]);
|
58
|
+
await this.runningPromise;
|
59
|
+
this.running = false;
|
60
|
+
|
61
|
+
this.active = click === 'first';
|
62
|
+
return true;
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @returns If the interaction is active
|
67
|
+
*/
|
68
|
+
public isActive = (): boolean => this.active;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* @returns If the interaction is running
|
72
|
+
*/
|
73
|
+
public isRunning = (): boolean => this.running;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @returns A promise that fulfills when the current running interaction has finished
|
77
|
+
*/
|
78
|
+
public untilFinished = (): Promise<unknown> | undefined => this.runningPromise;
|
79
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/**
|
2
|
+
* A render controller for an element.
|
3
|
+
* It allows to render and remove the element from the DOM.
|
4
|
+
*/
|
5
|
+
export class Renderer {
|
6
|
+
#rendered = true;
|
7
|
+
#anchor = new Comment();
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Creates a render controller instance for an element.
|
11
|
+
* @param element The element to control.
|
12
|
+
*/
|
13
|
+
constructor(public readonly element: Element) {}
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Renders the element using the anchor as a reference.
|
17
|
+
*/
|
18
|
+
render() {
|
19
|
+
if (this.#rendered) return;
|
20
|
+
|
21
|
+
this.#anchor.after(this.element);
|
22
|
+
this.#anchor.remove();
|
23
|
+
|
24
|
+
this.#rendered = true;
|
25
|
+
}
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Removes the element from the DOM and replaces it with the anchor.
|
29
|
+
*/
|
30
|
+
remove() {
|
31
|
+
if (!this.#rendered) return;
|
32
|
+
|
33
|
+
this.element.after(this.#anchor);
|
34
|
+
this.element.remove();
|
35
|
+
|
36
|
+
this.#rendered = false;
|
37
|
+
}
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Updates the element's rendering state.
|
41
|
+
* @param shouldRender Whether the element should be rendered or not.
|
42
|
+
*/
|
43
|
+
update(shouldRender: boolean) {
|
44
|
+
if (shouldRender) this.render();
|
45
|
+
else this.remove();
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Destroys the render controller.
|
50
|
+
* @param forceRender Whether to force the element to be rendered after destroying the controller.
|
51
|
+
*/
|
52
|
+
destroy = (forceRender = true) => {
|
53
|
+
if (forceRender) {
|
54
|
+
this.render();
|
55
|
+
}
|
56
|
+
|
57
|
+
this.#anchor.remove();
|
58
|
+
};
|
59
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
export const ARIA_ROLE_KEY = 'role';
|
2
|
+
export const enum ARIA_ROLE_VALUES {
|
3
|
+
slider = 'slider',
|
4
|
+
listbox = 'listbox',
|
5
|
+
option = 'option',
|
6
|
+
columnheader = 'columnheader',
|
7
|
+
link = 'link',
|
8
|
+
marquee = 'marquee',
|
9
|
+
button = 'button',
|
10
|
+
radiogroup = 'radiogroup',
|
11
|
+
dialog = 'dialog',
|
12
|
+
}
|
13
|
+
export const TABINDEX_KEY = 'tabindex';
|
14
|
+
export const ARIA_LABEL_KEY = 'aria-label';
|
15
|
+
export const ARIA_LABELLEDBY_KEY = 'aria-labelledby';
|
16
|
+
export const ARIA_VALUENOW_KEY = 'aria-valuenow';
|
17
|
+
export const ARIA_VALUEMIN_KEY = 'aria-valuemin';
|
18
|
+
export const ARIA_VALUEMAX_KEY = 'aria-valuemax';
|
19
|
+
export const ARIA_SELECTED_KEY = 'aria-selected';
|
20
|
+
export const ARIA_HASPOPUP_KEY = 'aria-haspopup';
|
21
|
+
export const ARIA_MULTISELECTABLE_KEY = 'aria-multiselectable';
|
22
|
+
export const ARIA_EXPANDED_KEY = 'aria-expanded';
|
23
|
+
export const ARIA_CURRENT_KEY = 'aria-current';
|
24
|
+
export const ARIA_ACTIVEDESCENDANT_KEY = 'aria-activedescendant';
|
25
|
+
export const ARIA_PRESSED_KEY = 'aria-pressed';
|
26
|
+
export const ARIA_CONTROLS_KEY = 'aria-controls';
|
27
|
+
export const ARIA_OWNS_KEY = 'aria-owns';
|
28
|
+
export const ARIA_ROLEDESCRIPTION_KEY = 'aria-roledescription';
|
29
|
+
export const ARIA_DESCRIPTION_KEY = 'aria-description';
|
30
|
+
export const ARIA_HIDDEN_KEY = 'aria-hidden';
|
31
|
+
export const AUTOCOMPLETE_KEY = 'autocomplete';
|
32
|
+
export const AUTOCAPITALIZE_KEY = 'autocapitalize';
|
33
|
+
export const ARIA_AUTOCOMPLETE_KEY = 'aria-autocomplete';
|
34
|
+
export const ROLE_KEY = 'role';
|
35
|
+
export const REQUIRED_KEY = 'required';
|
36
|
+
export const NAME_KEY = 'name';
|
37
|
+
export const ARIA_SETSIZE_KEY = 'aria-setsize';
|
38
|
+
export const ARIA_POSINSET_KEY = 'aria-posinset';
|
39
|
+
export const ID_KEY = 'id';
|
40
|
+
export const ARIA_MODAL_KEY = 'aria-modal';
|
41
|
+
export const enum ARIA_MODAL_VALUES {
|
42
|
+
true = 'true',
|
43
|
+
}
|
44
|
+
|
45
|
+
export const ARIA_SORT_KEY = 'aria-sort';
|
46
|
+
export const enum ARIA_SORT_VALUES {
|
47
|
+
ascending = 'ascending',
|
48
|
+
descending = 'descending',
|
49
|
+
}
|
50
|
+
export const CONTENT_EDITABLE_KEY = 'contenteditable';
|
@@ -0,0 +1,57 @@
|
|
1
|
+
export const ACCORDION_ATTRIBUTE = 'accordion';
|
2
|
+
|
3
|
+
export const AUTO_VIDEO_ATTRIBUTE = 'autovideo';
|
4
|
+
|
5
|
+
export const CODE_HIGHLIGHT_ATTRIBUTE = 'codehighlight';
|
6
|
+
|
7
|
+
export const COMBO_BOX_ATTRIBUTE = 'combobox';
|
8
|
+
|
9
|
+
export const INJECT_ATTRIBUTE = 'inject';
|
10
|
+
|
11
|
+
export const COPY_CLIP_ATTRIBUTE = 'copyclip';
|
12
|
+
|
13
|
+
export const DISPLAY_VALUES_ATTRIBUTE = 'displayvalues';
|
14
|
+
|
15
|
+
export const DOCS_ATTRIBUTE = 'docs';
|
16
|
+
|
17
|
+
export const FAV_CUSTOM_ATTRIBUTE = 'favcustom';
|
18
|
+
|
19
|
+
export const FORM_SUBMIT_ATTRIBUTE = 'formsubmit';
|
20
|
+
|
21
|
+
export const INPUT_ACTIVE_ATTRIBUTE = 'inputactive';
|
22
|
+
|
23
|
+
export const INPUT_COUNTER_ATTRIBUTE = 'inputcounter';
|
24
|
+
|
25
|
+
export const MIRROR_CLICK_ATTRIBUTE = 'mirrorclick';
|
26
|
+
|
27
|
+
export const MIRROR_INPUT_ATTRIBUTE = 'mirrorinput';
|
28
|
+
|
29
|
+
export const MODAL_ATTRIBUTE = 'modal';
|
30
|
+
|
31
|
+
export const NUMBER_COUNT_ATTRIBUTE = 'numbercount';
|
32
|
+
|
33
|
+
export const LIST_ATTRIBUTE = 'list';
|
34
|
+
|
35
|
+
export const QUERY_PARAM_ATTRIBUTE = 'queryparam';
|
36
|
+
|
37
|
+
export const RANGE_SLIDER_ATTRIBUTE = 'rangeslider';
|
38
|
+
|
39
|
+
export const SCROLL_DISABLE_ATTRIBUTE = 'scrolldisable';
|
40
|
+
|
41
|
+
export const SELECT_CUSTOM_ATTRIBUTE = 'selectcustom';
|
42
|
+
|
43
|
+
export const SLIDER_DOTS_ATTRIBUTE = 'sliderdots';
|
44
|
+
|
45
|
+
export const SMART_LIGHTBOX_ATTRIBUTE = 'smartlightbox';
|
46
|
+
|
47
|
+
export const SOCIAL_SHARE_ATTRIBUTE = 'socialshare';
|
48
|
+
|
49
|
+
export const STAR_RATING_ATTRIBUTE = 'starrating';
|
50
|
+
|
51
|
+
export const TOC_ATTRIBUTE = 'toc';
|
52
|
+
|
53
|
+
export const READ_TIME_ATTRIBUTE = 'readtime';
|
54
|
+
|
55
|
+
export const REMOVE_QUERY_ATTRIBUTE = 'removequery';
|
56
|
+
|
57
|
+
export const VIDEO_HLS_ATTRIBUTE = 'videohls';
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export const SPACE_KEY = ' ';
|
2
|
+
export const ENTER_KEY = 'Enter';
|
3
|
+
export const ESCAPE_KEY = 'Escape';
|
4
|
+
export const TAB_KEY = 'Tab';
|
5
|
+
export const CLICK = 'click';
|
6
|
+
export const BACKSPACE_KEY = 'Backspace';
|
7
|
+
export const ARROW_UP_KEY = 'ArrowUp';
|
8
|
+
export const ARROW_DOWN_KEY = 'ArrowDown';
|
9
|
+
export const ARROW_RIGHT_KEY = 'ArrowRight';
|
10
|
+
export const ARROW_LEFT_KEY = 'ArrowLeft';
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import type { WebflowBreakpoint } from '../types';
|
2
|
+
|
3
|
+
export const CURRENT_CSS_CLASS = 'w--current';
|
4
|
+
|
5
|
+
export const RICH_TEXT_BLOCK_CSS_CLASS = 'w-richtext';
|
6
|
+
|
7
|
+
export const HTML_EMBED_CSS_CLASS = 'w-embed';
|
8
|
+
|
9
|
+
export const SLIDER_CSS_CLASSES = {
|
10
|
+
slider: 'w-slider',
|
11
|
+
slide: 'w-slide',
|
12
|
+
sliderMask: 'w-slider-mask',
|
13
|
+
sliderNav: 'w-slider-nav',
|
14
|
+
sliderDot: 'w-slider-dot',
|
15
|
+
activeSliderDot: 'w-active',
|
16
|
+
} as const;
|
17
|
+
|
18
|
+
export const TABS_CSS_CLASSES = {
|
19
|
+
tabs: 'w-tabs',
|
20
|
+
tabsContent: 'w-tab-content',
|
21
|
+
tabPane: 'w-tab-pane',
|
22
|
+
tabsMenu: 'w-tab-menu',
|
23
|
+
tabLink: 'w-tab-link',
|
24
|
+
activeTab: 'w--tab-active',
|
25
|
+
} as const;
|
26
|
+
|
27
|
+
export const NAVBAR_CSS_CLASSES = {
|
28
|
+
navMenu: 'w-nav-menu',
|
29
|
+
} as const;
|
30
|
+
|
31
|
+
export const CMS_CSS_CLASSES = {
|
32
|
+
wrapper: 'w-dyn-list',
|
33
|
+
list: 'w-dyn-items',
|
34
|
+
item: 'w-dyn-item',
|
35
|
+
paginationWrapper: 'w-pagination-wrapper',
|
36
|
+
paginationNext: 'w-pagination-next',
|
37
|
+
paginationPrevious: 'w-pagination-previous',
|
38
|
+
pageCount: 'w-page-count',
|
39
|
+
emptyState: 'w-dyn-empty',
|
40
|
+
} as const;
|
41
|
+
|
42
|
+
export const FORM_CSS_CLASSES = {
|
43
|
+
formBlock: 'w-form',
|
44
|
+
checkboxField: 'w-checkbox',
|
45
|
+
checkboxInput: 'w-checkbox-input',
|
46
|
+
radioField: 'w-radio',
|
47
|
+
radioInput: 'w-radio-input',
|
48
|
+
checkboxOrRadioLabel: 'w-form-label',
|
49
|
+
checkboxOrRadioFocus: 'w--redirected-focus',
|
50
|
+
checkboxOrRadioChecked: 'w--redirected-checked',
|
51
|
+
successMessage: 'w-form-done',
|
52
|
+
errorMessage: 'w-form-fail',
|
53
|
+
} as const;
|
54
|
+
|
55
|
+
export const DROPDOWN_CSS_CLASSES = {
|
56
|
+
dropdown: 'w-dropdown',
|
57
|
+
dropdownToggle: 'w-dropdown-toggle',
|
58
|
+
dropdownList: 'w-dropdown-list',
|
59
|
+
} as const;
|
60
|
+
|
61
|
+
export const COMMERCE_CSS_CLASSES = {
|
62
|
+
addToCartForm: 'w-commerce-commerceaddtocartform',
|
63
|
+
} as const;
|
64
|
+
|
65
|
+
export const LIGHTBOX_CSS_CLASSES = {
|
66
|
+
trigger: 'w-lightbox',
|
67
|
+
} as const;
|
68
|
+
|
69
|
+
export const WEBFLOW_BREAKPOINTS: Map<WebflowBreakpoint, string> = new Map([
|
70
|
+
['tiny', '(max-width: 479px)'],
|
71
|
+
['small', '(max-width: 767px)'],
|
72
|
+
['medium', '(max-width: 991px)'],
|
73
|
+
['main', '(min-width: 992px)'],
|
74
|
+
]);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { isDate } from './guards';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Converts a string to a `Date`.
|
5
|
+
* @param value
|
6
|
+
* @returns The `Date` object, if the conversion is successful.
|
7
|
+
*/
|
8
|
+
export const normalizeDate = (value: string | number | Date) => {
|
9
|
+
if (isDate(value)) return value;
|
10
|
+
if (value === '') return;
|
11
|
+
|
12
|
+
const date = new Date(value);
|
13
|
+
|
14
|
+
if (!isNaN(date.getTime())) {
|
15
|
+
return date;
|
16
|
+
}
|
17
|
+
};
|