@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,93 @@
|
|
1
|
+
import { getAttribute, queryElement } from '../utils/selectors';
|
2
|
+
import type {
|
3
|
+
FacebookSocialShare,
|
4
|
+
PinterestSocialShare,
|
5
|
+
SocialShare,
|
6
|
+
SocialShareTypes,
|
7
|
+
XSocialShare,
|
8
|
+
} from './../utils/types';
|
9
|
+
|
10
|
+
export function collectFacebookData(
|
11
|
+
trigger: HTMLElement,
|
12
|
+
instance: string | null,
|
13
|
+
scope: HTMLElement | undefined
|
14
|
+
): FacebookSocialShare {
|
15
|
+
const socialData = collectSocialData(trigger, 'facebook', instance, scope);
|
16
|
+
|
17
|
+
const hashtagsElement = queryElement('facebook-hashtags', { instance, scope });
|
18
|
+
const hashtagsText = hashtagsElement ? hashtagsElement.textContent : null;
|
19
|
+
|
20
|
+
return {
|
21
|
+
...socialData,
|
22
|
+
type: 'facebook',
|
23
|
+
hashtags: hashtagsText,
|
24
|
+
};
|
25
|
+
}
|
26
|
+
|
27
|
+
export function collectXData(
|
28
|
+
trigger: HTMLElement,
|
29
|
+
instance: string | null,
|
30
|
+
scope: HTMLElement | undefined
|
31
|
+
): XSocialShare {
|
32
|
+
const socialData = collectSocialData(trigger, 'x', instance, scope);
|
33
|
+
|
34
|
+
const hashtagsElement = queryElement('x-hashtags', { instance, scope });
|
35
|
+
const hashtagsText =
|
36
|
+
hashtagsElement && hashtagsElement.textContent ? hashtagsElement.textContent.replace(/[^a-zA-Z0-9_,]/g, '') : null;
|
37
|
+
|
38
|
+
const usernameElement = queryElement('x-username', { instance, scope });
|
39
|
+
const userNameText = usernameElement ? usernameElement.textContent : null;
|
40
|
+
|
41
|
+
return {
|
42
|
+
...socialData,
|
43
|
+
type: 'x',
|
44
|
+
hashtags: hashtagsText,
|
45
|
+
username: userNameText,
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
export function collectPinterestData(
|
50
|
+
trigger: HTMLElement,
|
51
|
+
instance: string | null,
|
52
|
+
scope: HTMLElement | undefined
|
53
|
+
): PinterestSocialShare {
|
54
|
+
const socialData = collectSocialData(trigger, 'pinterest', instance, scope);
|
55
|
+
|
56
|
+
const imageElement = queryElement<HTMLImageElement>('pinterest-image', { instance, scope });
|
57
|
+
const imageSrc = imageElement && imageElement.src ? imageElement.src : null;
|
58
|
+
|
59
|
+
const descriptionElement = queryElement('pinterest-description', { instance, scope });
|
60
|
+
|
61
|
+
const descriptionText = descriptionElement ? descriptionElement.textContent : null;
|
62
|
+
|
63
|
+
return {
|
64
|
+
...socialData,
|
65
|
+
type: 'pinterest',
|
66
|
+
image: imageSrc,
|
67
|
+
description: descriptionText,
|
68
|
+
};
|
69
|
+
}
|
70
|
+
|
71
|
+
export function collectSocialData(
|
72
|
+
socialShareButton: HTMLElement,
|
73
|
+
elementKey: SocialShareTypes,
|
74
|
+
instance: string | null,
|
75
|
+
scope: HTMLElement | undefined
|
76
|
+
): SocialShare {
|
77
|
+
const width = getAttribute(socialShareButton, 'width');
|
78
|
+
const height = getAttribute(socialShareButton, 'height');
|
79
|
+
|
80
|
+
const contentElement = queryElement('content', { instance, scope });
|
81
|
+
const contentText = contentElement ? contentElement.textContent : null;
|
82
|
+
|
83
|
+
const urlElement = queryElement('url', { instance, scope });
|
84
|
+
const contentUrl = urlElement && urlElement.textContent ? urlElement.textContent : window.location.href;
|
85
|
+
|
86
|
+
return {
|
87
|
+
content: contentText,
|
88
|
+
url: contentUrl,
|
89
|
+
width,
|
90
|
+
height,
|
91
|
+
type: elementKey,
|
92
|
+
};
|
93
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import { SOCIAL_SHARE_PLATFORMS } from '../utils/constants';
|
2
|
+
import type {
|
3
|
+
FacebookSocialShare,
|
4
|
+
PinterestSocialShare,
|
5
|
+
SocialShare,
|
6
|
+
SocialShareStoreData,
|
7
|
+
SocialShareTypes,
|
8
|
+
XSocialShare,
|
9
|
+
} from './../utils/types';
|
10
|
+
|
11
|
+
export function createFacebookShare({ type, url, hashtags, content, width, height }: FacebookSocialShare) {
|
12
|
+
return createSocialShare(type, { u: url, hashtag: hashtags, quote: content }, width, height);
|
13
|
+
}
|
14
|
+
|
15
|
+
export function createXShare({ type, content, username, hashtags, url, width, height }: XSocialShare) {
|
16
|
+
return createSocialShare(
|
17
|
+
type,
|
18
|
+
{
|
19
|
+
url,
|
20
|
+
hashtags,
|
21
|
+
text: content,
|
22
|
+
via: username,
|
23
|
+
},
|
24
|
+
width,
|
25
|
+
height
|
26
|
+
);
|
27
|
+
}
|
28
|
+
|
29
|
+
export function createPinterestShare({ type, url, image, description, width, height }: PinterestSocialShare) {
|
30
|
+
return createSocialShare(
|
31
|
+
type,
|
32
|
+
{
|
33
|
+
url,
|
34
|
+
description,
|
35
|
+
media: image,
|
36
|
+
},
|
37
|
+
width,
|
38
|
+
height
|
39
|
+
);
|
40
|
+
}
|
41
|
+
|
42
|
+
export function createLinkedinShare({ type, url, width, height }: SocialShare) {
|
43
|
+
return createSocialShare(type, { url: url }, width, height);
|
44
|
+
}
|
45
|
+
|
46
|
+
export function createRedditShare({ type, url, content, width, height }: SocialShare) {
|
47
|
+
return createSocialShare(
|
48
|
+
type,
|
49
|
+
{
|
50
|
+
url,
|
51
|
+
title: content,
|
52
|
+
},
|
53
|
+
width,
|
54
|
+
height
|
55
|
+
);
|
56
|
+
}
|
57
|
+
|
58
|
+
export function createTelegramShare({ type, content, url, width, height }: SocialShare) {
|
59
|
+
return createSocialShare(
|
60
|
+
type,
|
61
|
+
{
|
62
|
+
url,
|
63
|
+
text: content,
|
64
|
+
},
|
65
|
+
width,
|
66
|
+
height
|
67
|
+
);
|
68
|
+
}
|
69
|
+
|
70
|
+
function createSocialShare(
|
71
|
+
type: SocialShareTypes,
|
72
|
+
params: { [key: string]: string | null },
|
73
|
+
width: number,
|
74
|
+
height: number
|
75
|
+
): SocialShareStoreData {
|
76
|
+
const urlSocialMedia = SOCIAL_SHARE_PLATFORMS[type];
|
77
|
+
|
78
|
+
const shareUrl = new URL(urlSocialMedia);
|
79
|
+
const shareParams = Object.entries(params);
|
80
|
+
|
81
|
+
for (const [key, value] of shareParams) {
|
82
|
+
if (value) shareUrl.searchParams.append(key, value);
|
83
|
+
}
|
84
|
+
|
85
|
+
return {
|
86
|
+
height,
|
87
|
+
width,
|
88
|
+
type,
|
89
|
+
shareUrl,
|
90
|
+
};
|
91
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { addListener, isElement } from '@finsweet/attributes-utils';
|
2
|
+
|
3
|
+
import { SOCIAL_SHARE_PLATFORMS } from '../utils/constants';
|
4
|
+
import { getElementSelector } from '../utils/selectors';
|
5
|
+
import { stores } from '../utils/stores';
|
6
|
+
import type { SocialShareStoreData, SocialShareTypes } from '../utils/types';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Listens for trigger clicks on the document.
|
10
|
+
*
|
11
|
+
* @returns A callback to remove the event listener.
|
12
|
+
*/
|
13
|
+
export const listenTriggerClicks = () => {
|
14
|
+
const clickCleanup = addListener(document, 'click', (e) => {
|
15
|
+
const { target } = e;
|
16
|
+
if (!isElement(target)) return;
|
17
|
+
|
18
|
+
for (const key in SOCIAL_SHARE_PLATFORMS) {
|
19
|
+
const platform = key as SocialShareTypes;
|
20
|
+
|
21
|
+
const trigger = target.closest<HTMLElement>(getElementSelector(platform));
|
22
|
+
if (!trigger) continue;
|
23
|
+
|
24
|
+
const socialShareData = stores[platform].get(trigger);
|
25
|
+
if (socialShareData) triggerSocialShare(socialShareData);
|
26
|
+
break;
|
27
|
+
}
|
28
|
+
});
|
29
|
+
|
30
|
+
return clickCleanup;
|
31
|
+
};
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Triggers a social share.
|
35
|
+
* @param storeData
|
36
|
+
*/
|
37
|
+
const triggerSocialShare = ({ width, height, shareUrl }: SocialShareStoreData) => {
|
38
|
+
const left = window.innerWidth / 2 - width / 2 + window.screenX;
|
39
|
+
const top = window.innerHeight / 2 - height / 2 + window.screenY;
|
40
|
+
const popParams = `scrollbars=no, width=${width}, height=${height}, top=${top}, left=${left}`;
|
41
|
+
const newWindow = window.open(shareUrl, '', popParams);
|
42
|
+
|
43
|
+
if (newWindow) {
|
44
|
+
newWindow.focus();
|
45
|
+
}
|
46
|
+
};
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import { collectFacebookData, collectPinterestData, collectSocialData, collectXData } from './actions/collect';
|
2
|
+
import {
|
3
|
+
createFacebookShare,
|
4
|
+
createLinkedinShare,
|
5
|
+
createPinterestShare,
|
6
|
+
createRedditShare,
|
7
|
+
createTelegramShare,
|
8
|
+
createXShare,
|
9
|
+
} from './actions/share';
|
10
|
+
import { SOCIAL_SHARE_PLATFORMS } from './utils/constants';
|
11
|
+
import { getCMSItemWrapper } from './utils/dom';
|
12
|
+
import { getAttribute, getInstance, queryAllElements } from './utils/selectors';
|
13
|
+
import { stores } from './utils/stores';
|
14
|
+
import type { SocialShareTypes } from './utils/types';
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Creates a social share instance for all matching elements under a scope.
|
18
|
+
* @param scope Optional. Defaults to the document.
|
19
|
+
*/
|
20
|
+
export const createSocialShareInstances = (scope?: HTMLElement) => {
|
21
|
+
for (const key in SOCIAL_SHARE_PLATFORMS) {
|
22
|
+
const platform = key as SocialShareTypes;
|
23
|
+
|
24
|
+
const elements = queryAllElements(platform, { scope });
|
25
|
+
|
26
|
+
// fix leaking elements of different attributes when using the same prefix
|
27
|
+
const abovePrefixBounds = `${key}[-0-9]*[a-zA-Z]+`;
|
28
|
+
const socialShareButtons = elements.filter((element) => {
|
29
|
+
// if attribute is out of bounds, return false.
|
30
|
+
return !getAttribute(element, 'element')?.toLocaleLowerCase().match(new RegExp(abovePrefixBounds));
|
31
|
+
});
|
32
|
+
|
33
|
+
const create = creators[platform];
|
34
|
+
socialShareButtons.forEach(create);
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Holds an instance creator for each platform.
|
40
|
+
*/
|
41
|
+
const creators: Record<SocialShareTypes, (trigger: HTMLElement) => void> = {
|
42
|
+
/**
|
43
|
+
* Facebook creator.
|
44
|
+
* @param trigger
|
45
|
+
*/
|
46
|
+
facebook(trigger) {
|
47
|
+
if (stores.facebook.has(trigger)) return;
|
48
|
+
|
49
|
+
const instance = getInstance(trigger);
|
50
|
+
|
51
|
+
const cmsListItem = getCMSItemWrapper(trigger);
|
52
|
+
|
53
|
+
const facebook = collectFacebookData(trigger, instance, cmsListItem);
|
54
|
+
|
55
|
+
const shareData = createFacebookShare(facebook);
|
56
|
+
|
57
|
+
stores.facebook.set(trigger, shareData);
|
58
|
+
},
|
59
|
+
|
60
|
+
/**
|
61
|
+
* X creator.
|
62
|
+
* @param trigger
|
63
|
+
*/
|
64
|
+
x(trigger) {
|
65
|
+
if (stores.x.has(trigger)) return;
|
66
|
+
|
67
|
+
const instance = getInstance(trigger);
|
68
|
+
|
69
|
+
const cmsListItem = getCMSItemWrapper(trigger);
|
70
|
+
|
71
|
+
const x = collectXData(trigger, instance, cmsListItem);
|
72
|
+
|
73
|
+
const shareData = createXShare(x);
|
74
|
+
|
75
|
+
stores.x.set(trigger, shareData);
|
76
|
+
},
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Pinterest creator.
|
80
|
+
* @param trigger
|
81
|
+
*/
|
82
|
+
pinterest(trigger) {
|
83
|
+
if (stores.pinterest.has(trigger)) return;
|
84
|
+
|
85
|
+
const instance = getInstance(trigger);
|
86
|
+
|
87
|
+
const cmsListItem = getCMSItemWrapper(trigger);
|
88
|
+
|
89
|
+
const pinterest = collectPinterestData(trigger, instance, cmsListItem);
|
90
|
+
|
91
|
+
const shareData = createPinterestShare(pinterest);
|
92
|
+
|
93
|
+
stores.pinterest.set(trigger, shareData);
|
94
|
+
},
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Telegram creator.
|
98
|
+
* @param trigger
|
99
|
+
*/
|
100
|
+
telegram(trigger) {
|
101
|
+
if (stores.telegram.has(trigger)) return;
|
102
|
+
|
103
|
+
const instance = getInstance(trigger);
|
104
|
+
|
105
|
+
const cmsListItem = getCMSItemWrapper(trigger);
|
106
|
+
|
107
|
+
const telegram = collectSocialData(trigger, 'telegram', instance, cmsListItem);
|
108
|
+
|
109
|
+
const shareData = createTelegramShare(telegram);
|
110
|
+
|
111
|
+
stores.telegram.set(trigger, shareData);
|
112
|
+
},
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Linkedin creator.
|
116
|
+
* @param trigger
|
117
|
+
*/
|
118
|
+
linkedin(trigger) {
|
119
|
+
if (stores.linkedin.has(trigger)) return;
|
120
|
+
|
121
|
+
const instance = getInstance(trigger);
|
122
|
+
|
123
|
+
const cmsListItem = getCMSItemWrapper(trigger);
|
124
|
+
|
125
|
+
const linkedin = collectSocialData(trigger, 'linkedin', instance, cmsListItem);
|
126
|
+
|
127
|
+
const shareData = createLinkedinShare(linkedin);
|
128
|
+
|
129
|
+
stores.linkedin.set(trigger, shareData);
|
130
|
+
},
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Reddit creator.
|
134
|
+
* @param trigger
|
135
|
+
*/
|
136
|
+
reddit(trigger) {
|
137
|
+
if (stores.reddit.has(trigger)) return;
|
138
|
+
|
139
|
+
const instance = getInstance(trigger);
|
140
|
+
|
141
|
+
const cmsListItem = getCMSItemWrapper(trigger);
|
142
|
+
|
143
|
+
const reddit = collectSocialData(trigger, 'reddit', instance, cmsListItem);
|
144
|
+
|
145
|
+
const shareData = createRedditShare(reddit);
|
146
|
+
|
147
|
+
stores.reddit.set(trigger, shareData);
|
148
|
+
},
|
149
|
+
};
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { List } from '@finsweet/attributes-list';
|
2
|
+
import { type FinsweetAttributeInit, waitAttributeLoaded, waitWebflowReady } from '@finsweet/attributes-utils';
|
3
|
+
|
4
|
+
import { listenTriggerClicks } from './actions/trigger';
|
5
|
+
import { createSocialShareInstances } from './factory';
|
6
|
+
import { stores } from './utils/stores';
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Inits the attribute.
|
10
|
+
*/
|
11
|
+
export const init: FinsweetAttributeInit = async () => {
|
12
|
+
await waitWebflowReady();
|
13
|
+
|
14
|
+
// Init global click listener
|
15
|
+
const removeClickListener = listenTriggerClicks();
|
16
|
+
|
17
|
+
// create button for static items
|
18
|
+
createSocialShareInstances();
|
19
|
+
|
20
|
+
// create button from dynamic list in memory
|
21
|
+
const listInstances: List[] = (await waitAttributeLoaded('list')) || [];
|
22
|
+
|
23
|
+
for (const { items } of listInstances) {
|
24
|
+
for (const { element } of items.value) {
|
25
|
+
createSocialShareInstances(element);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
return {
|
30
|
+
result: stores,
|
31
|
+
destroy() {
|
32
|
+
removeClickListener();
|
33
|
+
},
|
34
|
+
};
|
35
|
+
};
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import { type AttributeElements, type AttributeSettings } from '@finsweet/attributes-utils';
|
2
|
+
|
3
|
+
export const ELEMENTS = [
|
4
|
+
/**
|
5
|
+
* Defines a Facebook social button
|
6
|
+
*/
|
7
|
+
'facebook',
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Defines a X social button
|
11
|
+
*/
|
12
|
+
'x',
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Defines a Pinterest social button
|
16
|
+
*/
|
17
|
+
'pinterest',
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Defines a Linked In social button
|
21
|
+
*/
|
22
|
+
'linkedin',
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Defines a Telegram social button
|
26
|
+
*/
|
27
|
+
'telegram',
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Defines a Reddit social button
|
31
|
+
*/
|
32
|
+
'reddit',
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Defines the Content to be share into social media
|
36
|
+
*/
|
37
|
+
'content',
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Defines a custom URL to be share into social media
|
41
|
+
*/
|
42
|
+
'url',
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Defines Facebook hashtags
|
46
|
+
*/
|
47
|
+
'facebook-hashtags',
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Defines X hashtags
|
51
|
+
*/
|
52
|
+
'x-hashtags',
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Defines X username
|
56
|
+
*/
|
57
|
+
'x-username',
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Defines Pinterest image
|
61
|
+
*/
|
62
|
+
'pinterest-image',
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Defines Pinterest description
|
66
|
+
*/
|
67
|
+
'pinterest-description',
|
68
|
+
] as const satisfies AttributeElements;
|
69
|
+
|
70
|
+
export const SETTINGS = {
|
71
|
+
/**
|
72
|
+
* Defines the width of popup window.
|
73
|
+
*/
|
74
|
+
width: { key: 'width', defaultValue: '600', isNumeric: true },
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Defines the height of popup window.
|
78
|
+
*/
|
79
|
+
height: { key: 'height', defaultValue: '480', isNumeric: true },
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Defines an element.
|
83
|
+
*/
|
84
|
+
element: { key: 'element' },
|
85
|
+
} as const satisfies AttributeSettings;
|
86
|
+
|
87
|
+
export const SOCIAL_SHARE_PLATFORMS = {
|
88
|
+
facebook: 'https://www.facebook.com/sharer/sharer.php',
|
89
|
+
x: 'https://x.com/intent/post/',
|
90
|
+
pinterest: 'https://www.pinterest.com/pin/create/trigger/',
|
91
|
+
reddit: 'https://www.reddit.com/submit',
|
92
|
+
linkedin: 'https://www.linkedin.com/sharing/share-offsite',
|
93
|
+
telegram: 'https://t.me/share',
|
94
|
+
} as const;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { CMS_CSS_CLASSES, type CollectionItemElement } from '@finsweet/attributes-utils';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @returns A parent CMS Item element, if existing.
|
5
|
+
* @param element
|
6
|
+
*/
|
7
|
+
export const getCMSItemWrapper = (element: HTMLElement) =>
|
8
|
+
element.closest<CollectionItemElement>(`.${CMS_CSS_CLASSES.item}`) || undefined;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { generateSelectors, SOCIAL_SHARE_ATTRIBUTE } from '@finsweet/attributes-utils';
|
2
|
+
|
3
|
+
import { ELEMENTS, SETTINGS } from './constants';
|
4
|
+
|
5
|
+
export const { queryElement, getAttribute, getSettingSelector, getElementSelector, queryAllElements, getInstance } =
|
6
|
+
generateSelectors(SOCIAL_SHARE_ATTRIBUTE, ELEMENTS, SETTINGS);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { SocialShareStore, SocialShareTypes } from './types';
|
2
|
+
|
3
|
+
export const stores: Record<SocialShareTypes, SocialShareStore> = {
|
4
|
+
facebook: new Map(),
|
5
|
+
x: new Map(),
|
6
|
+
pinterest: new Map(),
|
7
|
+
telegram: new Map(),
|
8
|
+
linkedin: new Map(),
|
9
|
+
reddit: new Map(),
|
10
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { SOCIAL_SHARE_PLATFORMS } from './constants';
|
2
|
+
|
3
|
+
export type SocialShareTypes = keyof typeof SOCIAL_SHARE_PLATFORMS;
|
4
|
+
|
5
|
+
export interface SocialShare {
|
6
|
+
width: number;
|
7
|
+
height: number;
|
8
|
+
type: SocialShareTypes;
|
9
|
+
content: string | null;
|
10
|
+
url: string | null;
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface FacebookSocialShare extends SocialShare {
|
14
|
+
hashtags: string | null;
|
15
|
+
type: 'facebook';
|
16
|
+
}
|
17
|
+
|
18
|
+
export interface XSocialShare extends SocialShare {
|
19
|
+
hashtags: string | null;
|
20
|
+
username: string | null;
|
21
|
+
type: 'x';
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface PinterestSocialShare extends SocialShare {
|
25
|
+
image: string | null;
|
26
|
+
description: string | null;
|
27
|
+
type: 'pinterest';
|
28
|
+
}
|
29
|
+
|
30
|
+
export type SocialShareStoreData = Pick<SocialShare, 'height' | 'width' | 'type'> & {
|
31
|
+
shareUrl: URL;
|
32
|
+
};
|
33
|
+
|
34
|
+
export type SocialShareStore = Map<HTMLElement, SocialShareStoreData>;
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# @finsweet/attributes-starrating
|
2
|
+
|
3
|
+
## 1.0.9
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [2af0bad]
|
8
|
+
- @finsweet/attributes-utils@0.1.0
|
9
|
+
|
10
|
+
## 1.0.8
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- Updated dependencies [378d74d]
|
15
|
+
- @finsweet/attributes-utils@0.0.6
|
16
|
+
|
17
|
+
## 1.0.7
|
18
|
+
|
19
|
+
### Patch Changes
|
20
|
+
|
21
|
+
- Updated dependencies [01973d8]
|
22
|
+
- @finsweet/attributes-utils@0.0.5
|
23
|
+
|
24
|
+
## 1.0.6
|
25
|
+
|
26
|
+
### Patch Changes
|
27
|
+
|
28
|
+
- Updated dependencies [deef758]
|
29
|
+
- @finsweet/attributes-utils@0.0.4
|
30
|
+
|
31
|
+
## 1.0.5
|
32
|
+
|
33
|
+
### Patch Changes
|
34
|
+
|
35
|
+
- Updated dependencies [d21cbca]
|
36
|
+
- @finsweet/attributes-utils@0.0.3
|
37
|
+
|
38
|
+
## 1.0.4
|
39
|
+
|
40
|
+
### Patch Changes
|
41
|
+
|
42
|
+
- c7b544d: chore: updated dependencies
|
43
|
+
- Updated dependencies [c7b544d]
|
44
|
+
- @finsweet/attributes-utils@0.0.2
|
45
|
+
|
46
|
+
## 1.0.3
|
47
|
+
|
48
|
+
### Patch Changes
|
49
|
+
|
50
|
+
- b56e5e5: rename fsAttribute in places of usage to finsweetAttribute
|
51
|
+
- Updated dependencies [b56e5e5]
|
52
|
+
- @finsweet/attributes-utils@0.0.1
|
53
|
+
|
54
|
+
## 1.0.2
|
55
|
+
|
56
|
+
### Patch Changes
|
57
|
+
|
58
|
+
- 1126763c: Fixed star selection not working correctly on iOS devices
|
59
|
+
|
60
|
+
## 1.0.1
|
61
|
+
|
62
|
+
### Patch Changes
|
63
|
+
|
64
|
+
- 5144fe6b: Changed default `is-active` class name to `is-active-starrating`.
|
65
|
+
|
66
|
+
## 1.0.0
|
67
|
+
|
68
|
+
### Major Changes
|
69
|
+
|
70
|
+
- 3111ec89: Created `fs-starrating` Attribute.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# `starrating` Attribute
|
2
|
+
|
3
|
+
Star rating radio button component inside any Webflow form.
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
Please follow the documentation at [finsweet.com/attributes](https://www.finsweet.com/attributes) to learn how to use Attributes in your Webflow projects.
|
8
|
+
|
9
|
+
## Accessing the API
|
10
|
+
|
11
|
+
To learn how to access the API, please check the general [API Reference](../attributes/README.md#api-reference) documentation:
|
12
|
+
|
13
|
+
```javascript
|
14
|
+
window.FinsweetAttributes ||= [];
|
15
|
+
window.FinsweetAttributes.push([
|
16
|
+
'starrating',
|
17
|
+
() => {
|
18
|
+
// Your code goes here.
|
19
|
+
},
|
20
|
+
]);
|
21
|
+
```
|
22
|
+
|
23
|
+
## License
|
24
|
+
|
25
|
+
[Apache 2.0](../../LICENSE.md)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "@finsweet/attributes-starrating",
|
3
|
+
"version": "1.0.9",
|
4
|
+
"description": "Star rating radio button component inside any Webflow form.",
|
5
|
+
"private": true,
|
6
|
+
"type": "module",
|
7
|
+
"types": "src/index.ts",
|
8
|
+
"scripts": {
|
9
|
+
"lint": "eslint ./src && prettier --check ./src",
|
10
|
+
"lint:fix": "eslint ./src --fix && prettier --write ./src",
|
11
|
+
"check": "tsc --noEmit"
|
12
|
+
},
|
13
|
+
"exports": {
|
14
|
+
".": {
|
15
|
+
"types": "./src/index.ts",
|
16
|
+
"import": "./src/index.ts"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"dependencies": {
|
20
|
+
"@finsweet/attributes-utils": "workspace:*"
|
21
|
+
}
|
22
|
+
}
|