@hortonstudio/main 1.2.12 → 1.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -8
- package/package.json +17 -6
- package/.claude/settings.local.json +0 -21
- package/animations/hero.js +0 -599
- package/animations/text.js +0 -369
- package/animations/transition.js +0 -57
- package/attributes-master/.changeset/README.md +0 -8
- package/attributes-master/.changeset/config.json +0 -11
- package/attributes-master/.gitattributes +0 -2
- package/attributes-master/.github/ISSUE_TEMPLATE/bug_report.md +0 -42
- package/attributes-master/.github/ISSUE_TEMPLATE/feature_request.md +0 -22
- package/attributes-master/.github/workflows/ci.yml +0 -66
- package/attributes-master/.github/workflows/release.yml +0 -40
- package/attributes-master/.prettierignore +0 -3
- package/attributes-master/.prettierrc +0 -8
- package/attributes-master/.vscode/extensions.json +0 -3
- package/attributes-master/.vscode/settings.json +0 -7
- package/attributes-master/CONTRIBUTING.md +0 -72
- package/attributes-master/LICENSE.md +0 -201
- package/attributes-master/README.md +0 -31
- package/attributes-master/eslint.config.js +0 -3
- package/attributes-master/package.json +0 -34
- package/attributes-master/packages/accordion/CHANGELOG.md +0 -89
- package/attributes-master/packages/accordion/README.md +0 -31
- package/attributes-master/packages/accordion/package.json +0 -25
- package/attributes-master/packages/accordion/src/actions/a11y.ts +0 -39
- package/attributes-master/packages/accordion/src/actions/classes.ts +0 -27
- package/attributes-master/packages/accordion/src/actions/content.ts +0 -42
- package/attributes-master/packages/accordion/src/actions/list.ts +0 -36
- package/attributes-master/packages/accordion/src/actions/query.ts +0 -27
- package/attributes-master/packages/accordion/src/actions/settings.ts +0 -61
- package/attributes-master/packages/accordion/src/factory.ts +0 -145
- package/attributes-master/packages/accordion/src/index.ts +0 -3
- package/attributes-master/packages/accordion/src/init.ts +0 -37
- package/attributes-master/packages/accordion/src/utils/constants.ts +0 -62
- package/attributes-master/packages/accordion/src/utils/helpers.ts +0 -5
- package/attributes-master/packages/accordion/src/utils/selectors.ts +0 -12
- package/attributes-master/packages/accordion/src/utils/types.ts +0 -23
- package/attributes-master/packages/accordion/tsconfig.json +0 -3
- package/attributes-master/packages/attributes/CHANGELOG.md +0 -564
- package/attributes-master/packages/attributes/README.md +0 -66
- package/attributes-master/packages/attributes/bin/build.ts +0 -107
- package/attributes-master/packages/attributes/bin/live-reload.js +0 -1
- package/attributes-master/packages/attributes/package.json +0 -77
- package/attributes-master/packages/attributes/playwright.config.ts +0 -89
- package/attributes-master/packages/attributes/src/attributes.ts +0 -153
- package/attributes-master/packages/attributes/src/load.ts +0 -125
- package/attributes-master/packages/attributes/tests/accordion.spec.ts +0 -137
- package/attributes-master/packages/attributes/tests/codehighlight.spec.ts +0 -23
- package/attributes-master/packages/attributes/tests/combobox.spec.ts +0 -321
- package/attributes-master/packages/attributes/tests/copyclip.spec.ts +0 -19
- package/attributes-master/packages/attributes/tests/displayvalues.spec.ts +0 -48
- package/attributes-master/packages/attributes/tests/favcustom.spec.ts +0 -23
- package/attributes-master/packages/attributes/tests/inject.spec.ts +0 -40
- package/attributes-master/packages/attributes/tests/inputactive.spec.ts +0 -77
- package/attributes-master/packages/attributes/tests/inputcounter.spec.ts +0 -83
- package/attributes-master/packages/attributes/tests/list.spec.ts +0 -800
- package/attributes-master/packages/attributes/tests/mirrorclick.spec.ts +0 -22
- package/attributes-master/packages/attributes/tests/mirrorinput.spec.ts +0 -37
- package/attributes-master/packages/attributes/tests/modal.spec.ts +0 -34
- package/attributes-master/packages/attributes/tests/numbercount.spec.ts +0 -40
- package/attributes-master/packages/attributes/tests/readtime.spec.ts +0 -19
- package/attributes-master/packages/attributes/tests/selectcustom.spec.ts +0 -51
- package/attributes-master/packages/attributes/tests/socialshare.spec.ts +0 -54
- package/attributes-master/packages/attributes/tests/starrating.spec.ts +0 -79
- package/attributes-master/packages/attributes/tests/toc.spec.ts +0 -38
- package/attributes-master/packages/attributes/tests/utils/index.ts +0 -16
- package/attributes-master/packages/attributes/tsconfig.json +0 -6
- package/attributes-master/packages/autovideo/CHANGELOG.md +0 -182
- package/attributes-master/packages/autovideo/README.md +0 -31
- package/attributes-master/packages/autovideo/package.json +0 -22
- package/attributes-master/packages/autovideo/src/index.ts +0 -3
- package/attributes-master/packages/autovideo/src/init.ts +0 -52
- package/attributes-master/packages/autovideo/src/types.ts +0 -5
- package/attributes-master/packages/autovideo/src/utils/constants.ts +0 -4
- package/attributes-master/packages/autovideo/tsconfig.json +0 -3
- package/attributes-master/packages/codehighlight/CHANGELOG.md +0 -185
- package/attributes-master/packages/codehighlight/README.md +0 -27
- package/attributes-master/packages/codehighlight/package.json +0 -23
- package/attributes-master/packages/codehighlight/src/actions/import.ts +0 -50
- package/attributes-master/packages/codehighlight/src/index.ts +0 -3
- package/attributes-master/packages/codehighlight/src/init.ts +0 -53
- package/attributes-master/packages/codehighlight/src/utils/constants.ts +0 -24
- package/attributes-master/packages/codehighlight/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/codehighlight/src/utils/themes.ts +0 -202
- package/attributes-master/packages/codehighlight/tsconfig.json +0 -3
- package/attributes-master/packages/combobox/CHANGELOG.md +0 -99
- package/attributes-master/packages/combobox/README.md +0 -27
- package/attributes-master/packages/combobox/package.json +0 -23
- package/attributes-master/packages/combobox/src/actions/a11y.ts +0 -29
- package/attributes-master/packages/combobox/src/actions/body/index.ts +0 -12
- package/attributes-master/packages/combobox/src/actions/clearDropdown/index.ts +0 -37
- package/attributes-master/packages/combobox/src/actions/dropdownList/index.ts +0 -220
- package/attributes-master/packages/combobox/src/actions/dropdownToggle/index.ts +0 -34
- package/attributes-master/packages/combobox/src/actions/events.ts +0 -75
- package/attributes-master/packages/combobox/src/actions/input/index.ts +0 -235
- package/attributes-master/packages/combobox/src/actions/observe.ts +0 -158
- package/attributes-master/packages/combobox/src/actions/populate.ts +0 -97
- package/attributes-master/packages/combobox/src/actions/selectElement/index.ts +0 -23
- package/attributes-master/packages/combobox/src/actions/settings.ts +0 -134
- package/attributes-master/packages/combobox/src/actions/state.ts +0 -34
- package/attributes-master/packages/combobox/src/index.ts +0 -3
- package/attributes-master/packages/combobox/src/init.ts +0 -52
- package/attributes-master/packages/combobox/src/utils/constants.ts +0 -48
- package/attributes-master/packages/combobox/src/utils/dropdowns.ts +0 -120
- package/attributes-master/packages/combobox/src/utils/index.ts +0 -1
- package/attributes-master/packages/combobox/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/combobox/src/utils/types.ts +0 -14
- package/attributes-master/packages/combobox/tsconfig.json +0 -3
- package/attributes-master/packages/copyclip/CHANGELOG.md +0 -213
- package/attributes-master/packages/copyclip/README.md +0 -27
- package/attributes-master/packages/copyclip/package.json +0 -23
- package/attributes-master/packages/copyclip/src/factory.ts +0 -67
- package/attributes-master/packages/copyclip/src/index.ts +0 -3
- package/attributes-master/packages/copyclip/src/init.ts +0 -68
- package/attributes-master/packages/copyclip/src/utils/constants.ts +0 -40
- package/attributes-master/packages/copyclip/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/copyclip/tsconfig.json +0 -3
- package/attributes-master/packages/displayvalues/CHANGELOG.md +0 -164
- package/attributes-master/packages/displayvalues/README.md +0 -27
- package/attributes-master/packages/displayvalues/package.json +0 -22
- package/attributes-master/packages/displayvalues/src/actions/collect.ts +0 -17
- package/attributes-master/packages/displayvalues/src/actions/events.ts +0 -22
- package/attributes-master/packages/displayvalues/src/actions/sync.ts +0 -23
- package/attributes-master/packages/displayvalues/src/index.ts +0 -3
- package/attributes-master/packages/displayvalues/src/init.ts +0 -31
- package/attributes-master/packages/displayvalues/src/utils/constants.ts +0 -20
- package/attributes-master/packages/displayvalues/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/displayvalues/src/utils/stores.ts +0 -3
- package/attributes-master/packages/displayvalues/tsconfig.json +0 -3
- package/attributes-master/packages/docs/CHANGELOG.md +0 -108
- package/attributes-master/packages/docs/README.md +0 -3
- package/attributes-master/packages/docs/bin/build.js +0 -92
- package/attributes-master/packages/docs/bin/live-reload.js +0 -1
- package/attributes-master/packages/docs/package.json +0 -40
- package/attributes-master/packages/docs/src/copy.ts +0 -260
- package/attributes-master/packages/docs/src/x-ray.ts +0 -377
- package/attributes-master/packages/docs/tsconfig.json +0 -3
- package/attributes-master/packages/favcustom/CHANGELOG.md +0 -194
- package/attributes-master/packages/favcustom/README.md +0 -27
- package/attributes-master/packages/favcustom/package.json +0 -22
- package/attributes-master/packages/favcustom/src/index.ts +0 -3
- package/attributes-master/packages/favcustom/src/init.ts +0 -30
- package/attributes-master/packages/favcustom/src/utils/constants.ts +0 -10
- package/attributes-master/packages/favcustom/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/favcustom/tsconfig.json +0 -3
- package/attributes-master/packages/formsubmit/CHANGELOG.md +0 -161
- package/attributes-master/packages/formsubmit/README.md +0 -51
- package/attributes-master/packages/formsubmit/package.json +0 -22
- package/attributes-master/packages/formsubmit/src/actions/redirect.ts +0 -9
- package/attributes-master/packages/formsubmit/src/actions/reset.ts +0 -49
- package/attributes-master/packages/formsubmit/src/actions/submit.ts +0 -34
- package/attributes-master/packages/formsubmit/src/components/Form.ts +0 -231
- package/attributes-master/packages/formsubmit/src/factory.ts +0 -62
- package/attributes-master/packages/formsubmit/src/index.ts +0 -3
- package/attributes-master/packages/formsubmit/src/init.ts +0 -24
- package/attributes-master/packages/formsubmit/src/utils/attributes.ts +0 -19
- package/attributes-master/packages/formsubmit/src/utils/constants.ts +0 -89
- package/attributes-master/packages/formsubmit/src/utils/dom.ts +0 -76
- package/attributes-master/packages/formsubmit/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/formsubmit/src/utils/types.ts +0 -7
- package/attributes-master/packages/formsubmit/tsconfig.json +0 -3
- package/attributes-master/packages/inject/CHANGELOG.md +0 -117
- package/attributes-master/packages/inject/README.md +0 -60
- package/attributes-master/packages/inject/package.json +0 -22
- package/attributes-master/packages/inject/src/actions/collect.ts +0 -125
- package/attributes-master/packages/inject/src/actions/css.ts +0 -27
- package/attributes-master/packages/inject/src/actions/prefetch.ts +0 -44
- package/attributes-master/packages/inject/src/factory.ts +0 -123
- package/attributes-master/packages/inject/src/index.ts +0 -3
- package/attributes-master/packages/inject/src/init.ts +0 -22
- package/attributes-master/packages/inject/src/utils/constants.ts +0 -89
- package/attributes-master/packages/inject/src/utils/helpers.ts +0 -36
- package/attributes-master/packages/inject/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/inject/src/utils/types.ts +0 -16
- package/attributes-master/packages/inject/tsconfig.json +0 -3
- package/attributes-master/packages/inputactive/CHANGELOG.md +0 -58
- package/attributes-master/packages/inputactive/README.md +0 -25
- package/attributes-master/packages/inputactive/package.json +0 -22
- package/attributes-master/packages/inputactive/src/actions/classes.ts +0 -43
- package/attributes-master/packages/inputactive/src/factory.ts +0 -24
- package/attributes-master/packages/inputactive/src/index.ts +0 -3
- package/attributes-master/packages/inputactive/src/init.ts +0 -18
- package/attributes-master/packages/inputactive/src/utils/constants.ts +0 -13
- package/attributes-master/packages/inputactive/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/inputactive/tsconfig.json +0 -3
- package/attributes-master/packages/inputcounter/CHANGELOG.md +0 -110
- package/attributes-master/packages/inputcounter/README.md +0 -25
- package/attributes-master/packages/inputcounter/package.json +0 -22
- package/attributes-master/packages/inputcounter/src/actions/a11y.ts +0 -23
- package/attributes-master/packages/inputcounter/src/actions/buttons.ts +0 -61
- package/attributes-master/packages/inputcounter/src/actions/input.ts +0 -31
- package/attributes-master/packages/inputcounter/src/actions/style.ts +0 -12
- package/attributes-master/packages/inputcounter/src/factory.ts +0 -51
- package/attributes-master/packages/inputcounter/src/index.ts +0 -3
- package/attributes-master/packages/inputcounter/src/init.ts +0 -22
- package/attributes-master/packages/inputcounter/src/utils/constants.ts +0 -59
- package/attributes-master/packages/inputcounter/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/inputcounter/tsconfig.json +0 -3
- package/attributes-master/packages/list/CHANGELOG.md +0 -185
- package/attributes-master/packages/list/README.md +0 -331
- package/attributes-master/packages/list/package.json +0 -37
- package/attributes-master/packages/list/src/combine/index.ts +0 -38
- package/attributes-master/packages/list/src/components/List.ts +0 -861
- package/attributes-master/packages/list/src/components/ListItem.ts +0 -229
- package/attributes-master/packages/list/src/components/index.ts +0 -2
- package/attributes-master/packages/list/src/factory.ts +0 -130
- package/attributes-master/packages/list/src/filter/dynamic/conditions.ts +0 -639
- package/attributes-master/packages/list/src/filter/dynamic/groups.ts +0 -221
- package/attributes-master/packages/list/src/filter/dynamic/index.ts +0 -119
- package/attributes-master/packages/list/src/filter/dynamic/utils.ts +0 -44
- package/attributes-master/packages/list/src/filter/elements.ts +0 -93
- package/attributes-master/packages/list/src/filter/filter.ts +0 -118
- package/attributes-master/packages/list/src/filter/filter.worker.ts +0 -152
- package/attributes-master/packages/list/src/filter/index.ts +0 -94
- package/attributes-master/packages/list/src/filter/standard/conditions.ts +0 -123
- package/attributes-master/packages/list/src/filter/standard/facets.ts +0 -253
- package/attributes-master/packages/list/src/filter/standard/index.ts +0 -176
- package/attributes-master/packages/list/src/filter/standard/query.ts +0 -111
- package/attributes-master/packages/list/src/filter/tags.ts +0 -314
- package/attributes-master/packages/list/src/filter/types.ts +0 -62
- package/attributes-master/packages/list/src/filter/utils.ts +0 -126
- package/attributes-master/packages/list/src/index.ts +0 -4
- package/attributes-master/packages/list/src/init.ts +0 -38
- package/attributes-master/packages/list/src/load/all.ts +0 -27
- package/attributes-master/packages/list/src/load/elements.ts +0 -39
- package/attributes-master/packages/list/src/load/index.ts +0 -63
- package/attributes-master/packages/list/src/load/infinite.ts +0 -79
- package/attributes-master/packages/list/src/load/load.ts +0 -191
- package/attributes-master/packages/list/src/load/more.ts +0 -97
- package/attributes-master/packages/list/src/load/pagination.ts +0 -402
- package/attributes-master/packages/list/src/nest/index.ts +0 -198
- package/attributes-master/packages/list/src/prevnext/index.ts +0 -98
- package/attributes-master/packages/list/src/select/index.ts +0 -56
- package/attributes-master/packages/list/src/slider/index.ts +0 -62
- package/attributes-master/packages/list/src/sort/buttons.ts +0 -96
- package/attributes-master/packages/list/src/sort/dropdown.ts +0 -179
- package/attributes-master/packages/list/src/sort/index.ts +0 -81
- package/attributes-master/packages/list/src/sort/query.ts +0 -63
- package/attributes-master/packages/list/src/sort/select.ts +0 -67
- package/attributes-master/packages/list/src/sort/sort.ts +0 -79
- package/attributes-master/packages/list/src/sort/types.ts +0 -28
- package/attributes-master/packages/list/src/static/index.ts +0 -73
- package/attributes-master/packages/list/src/tabs/index.ts +0 -97
- package/attributes-master/packages/list/src/utils/constants.ts +0 -728
- package/attributes-master/packages/list/src/utils/dom.ts +0 -108
- package/attributes-master/packages/list/src/utils/pagination.ts +0 -14
- package/attributes-master/packages/list/src/utils/selectors.ts +0 -18
- package/attributes-master/packages/list/src/utils/store.ts +0 -5
- package/attributes-master/packages/list/tsconfig.json +0 -3
- package/attributes-master/packages/mirrorclick/CHANGELOG.md +0 -171
- package/attributes-master/packages/mirrorclick/README.md +0 -25
- package/attributes-master/packages/mirrorclick/package.json +0 -22
- package/attributes-master/packages/mirrorclick/src/index.ts +0 -3
- package/attributes-master/packages/mirrorclick/src/init.ts +0 -35
- package/attributes-master/packages/mirrorclick/src/utils/constants.ts +0 -20
- package/attributes-master/packages/mirrorclick/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/mirrorclick/tsconfig.json +0 -3
- package/attributes-master/packages/mirrorinput/CHANGELOG.md +0 -172
- package/attributes-master/packages/mirrorinput/README.md +0 -25
- package/attributes-master/packages/mirrorinput/package.json +0 -22
- package/attributes-master/packages/mirrorinput/src/index.ts +0 -3
- package/attributes-master/packages/mirrorinput/src/init.ts +0 -48
- package/attributes-master/packages/mirrorinput/src/utils/constants.ts +0 -15
- package/attributes-master/packages/mirrorinput/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/mirrorinput/tsconfig.json +0 -3
- package/attributes-master/packages/modal/CHANGELOG.md +0 -94
- package/attributes-master/packages/modal/README.md +0 -29
- package/attributes-master/packages/modal/package.json +0 -23
- package/attributes-master/packages/modal/src/actions/a11y.ts +0 -46
- package/attributes-master/packages/modal/src/actions/modal.ts +0 -164
- package/attributes-master/packages/modal/src/actions/settings.ts +0 -21
- package/attributes-master/packages/modal/src/factory.ts +0 -26
- package/attributes-master/packages/modal/src/index.ts +0 -3
- package/attributes-master/packages/modal/src/init.ts +0 -22
- package/attributes-master/packages/modal/src/utils/constants.ts +0 -54
- package/attributes-master/packages/modal/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/modal/src/utils/types.ts +0 -12
- package/attributes-master/packages/modal/tsconfig.json +0 -3
- package/attributes-master/packages/numbercount/CHANGELOG.md +0 -90
- package/attributes-master/packages/numbercount/README.md +0 -27
- package/attributes-master/packages/numbercount/package.json +0 -23
- package/attributes-master/packages/numbercount/src/actions/a11y.ts +0 -26
- package/attributes-master/packages/numbercount/src/actions/animate.ts +0 -43
- package/attributes-master/packages/numbercount/src/actions/observe.ts +0 -44
- package/attributes-master/packages/numbercount/src/factory.ts +0 -31
- package/attributes-master/packages/numbercount/src/index.ts +0 -3
- package/attributes-master/packages/numbercount/src/init.ts +0 -22
- package/attributes-master/packages/numbercount/src/utils/constants.ts +0 -40
- package/attributes-master/packages/numbercount/src/utils/helpers.ts +0 -31
- package/attributes-master/packages/numbercount/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/numbercount/tsconfig.json +0 -3
- package/attributes-master/packages/queryparam/CHANGELOG.md +0 -118
- package/attributes-master/packages/queryparam/README.md +0 -25
- package/attributes-master/packages/queryparam/package.json +0 -22
- package/attributes-master/packages/queryparam/src/factory.ts +0 -51
- package/attributes-master/packages/queryparam/src/index.ts +0 -3
- package/attributes-master/packages/queryparam/src/init.ts +0 -40
- package/attributes-master/packages/queryparam/src/utils/constants.ts +0 -18
- package/attributes-master/packages/queryparam/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/queryparam/tsconfig.json +0 -3
- package/attributes-master/packages/rangeslider/CHANGELOG.md +0 -236
- package/attributes-master/packages/rangeslider/README.md +0 -95
- package/attributes-master/packages/rangeslider/package.json +0 -23
- package/attributes-master/packages/rangeslider/src/actions/a11y.ts +0 -21
- package/attributes-master/packages/rangeslider/src/actions/events.ts +0 -9
- package/attributes-master/packages/rangeslider/src/actions/settings.ts +0 -97
- package/attributes-master/packages/rangeslider/src/actions/styles.ts +0 -10
- package/attributes-master/packages/rangeslider/src/actions/values.ts +0 -47
- package/attributes-master/packages/rangeslider/src/components/Fill.ts +0 -70
- package/attributes-master/packages/rangeslider/src/components/Handle.ts +0 -281
- package/attributes-master/packages/rangeslider/src/factory.ts +0 -100
- package/attributes-master/packages/rangeslider/src/index.ts +0 -3
- package/attributes-master/packages/rangeslider/src/init.ts +0 -194
- package/attributes-master/packages/rangeslider/src/utils/constants.ts +0 -87
- package/attributes-master/packages/rangeslider/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/rangeslider/src/utils/types.ts +0 -6
- package/attributes-master/packages/rangeslider/tsconfig.json +0 -3
- package/attributes-master/packages/readtime/CHANGELOG.md +0 -108
- package/attributes-master/packages/readtime/README.md +0 -25
- package/attributes-master/packages/readtime/package.json +0 -22
- package/attributes-master/packages/readtime/src/factory.ts +0 -21
- package/attributes-master/packages/readtime/src/index.ts +0 -3
- package/attributes-master/packages/readtime/src/init.ts +0 -19
- package/attributes-master/packages/readtime/src/utils/constants.ts +0 -33
- package/attributes-master/packages/readtime/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/readtime/tsconfig.json +0 -3
- package/attributes-master/packages/removequery/CHANGELOG.md +0 -8
- package/attributes-master/packages/removequery/README.md +0 -25
- package/attributes-master/packages/removequery/package.json +0 -22
- package/attributes-master/packages/removequery/src/index.ts +0 -3
- package/attributes-master/packages/removequery/src/init.ts +0 -18
- package/attributes-master/packages/removequery/src/utils/constants.ts +0 -5
- package/attributes-master/packages/removequery/tsconfig.json +0 -3
- package/attributes-master/packages/scrolldisable/CHANGELOG.md +0 -164
- package/attributes-master/packages/scrolldisable/README.md +0 -29
- package/attributes-master/packages/scrolldisable/package.json +0 -27
- package/attributes-master/packages/scrolldisable/src/click.ts +0 -40
- package/attributes-master/packages/scrolldisable/src/display.ts +0 -117
- package/attributes-master/packages/scrolldisable/src/index.ts +0 -3
- package/attributes-master/packages/scrolldisable/src/init.ts +0 -36
- package/attributes-master/packages/scrolldisable/src/scroll.ts +0 -63
- package/attributes-master/packages/scrolldisable/src/utils/constants.ts +0 -56
- package/attributes-master/packages/scrolldisable/src/utils/selectors.ts +0 -6
- package/attributes-master/packages/scrolldisable/tsconfig.json +0 -3
- package/attributes-master/packages/selectcustom/CHANGELOG.md +0 -242
- package/attributes-master/packages/selectcustom/README.md +0 -25
- package/attributes-master/packages/selectcustom/package.json +0 -23
- package/attributes-master/packages/selectcustom/src/actions/a11y.ts +0 -29
- package/attributes-master/packages/selectcustom/src/actions/events.ts +0 -159
- package/attributes-master/packages/selectcustom/src/actions/observe.ts +0 -83
- package/attributes-master/packages/selectcustom/src/actions/populate.ts +0 -67
- package/attributes-master/packages/selectcustom/src/actions/settings.ts +0 -68
- package/attributes-master/packages/selectcustom/src/actions/state.ts +0 -41
- package/attributes-master/packages/selectcustom/src/index.ts +0 -3
- package/attributes-master/packages/selectcustom/src/init.ts +0 -51
- package/attributes-master/packages/selectcustom/src/utils/constants.ts +0 -34
- package/attributes-master/packages/selectcustom/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/selectcustom/src/utils/types.ts +0 -14
- package/attributes-master/packages/selectcustom/tsconfig.json +0 -3
- package/attributes-master/packages/sliderdots/CHANGELOG.md +0 -220
- package/attributes-master/packages/sliderdots/README.md +0 -27
- package/attributes-master/packages/sliderdots/package.json +0 -22
- package/attributes-master/packages/sliderdots/src/actions/events.ts +0 -26
- package/attributes-master/packages/sliderdots/src/actions/observe.ts +0 -40
- package/attributes-master/packages/sliderdots/src/actions/populate.ts +0 -46
- package/attributes-master/packages/sliderdots/src/actions/sync.ts +0 -28
- package/attributes-master/packages/sliderdots/src/actions/wait.ts +0 -28
- package/attributes-master/packages/sliderdots/src/factory.ts +0 -57
- package/attributes-master/packages/sliderdots/src/index.ts +0 -3
- package/attributes-master/packages/sliderdots/src/init.ts +0 -30
- package/attributes-master/packages/sliderdots/src/utils/constants.ts +0 -33
- package/attributes-master/packages/sliderdots/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/sliderdots/src/utils/types.ts +0 -7
- package/attributes-master/packages/sliderdots/tsconfig.json +0 -3
- package/attributes-master/packages/smartlightbox/CHANGELOG.md +0 -203
- package/attributes-master/packages/smartlightbox/README.md +0 -25
- package/attributes-master/packages/smartlightbox/package.json +0 -22
- package/attributes-master/packages/smartlightbox/src/actions/collect.ts +0 -15
- package/attributes-master/packages/smartlightbox/src/actions/move.ts +0 -25
- package/attributes-master/packages/smartlightbox/src/index.ts +0 -3
- package/attributes-master/packages/smartlightbox/src/init.ts +0 -61
- package/attributes-master/packages/smartlightbox/src/utils/constants.ts +0 -31
- package/attributes-master/packages/smartlightbox/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/smartlightbox/tsconfig.json +0 -3
- package/attributes-master/packages/socialshare/CHANGELOG.md +0 -170
- package/attributes-master/packages/socialshare/README.md +0 -25
- package/attributes-master/packages/socialshare/package.json +0 -25
- package/attributes-master/packages/socialshare/src/actions/collect.ts +0 -93
- package/attributes-master/packages/socialshare/src/actions/share.ts +0 -91
- package/attributes-master/packages/socialshare/src/actions/trigger.ts +0 -46
- package/attributes-master/packages/socialshare/src/factory.ts +0 -149
- package/attributes-master/packages/socialshare/src/index.ts +0 -3
- package/attributes-master/packages/socialshare/src/init.ts +0 -35
- package/attributes-master/packages/socialshare/src/utils/constants.ts +0 -94
- package/attributes-master/packages/socialshare/src/utils/dom.ts +0 -8
- package/attributes-master/packages/socialshare/src/utils/selectors.ts +0 -6
- package/attributes-master/packages/socialshare/src/utils/stores.ts +0 -10
- package/attributes-master/packages/socialshare/src/utils/types.ts +0 -34
- package/attributes-master/packages/socialshare/tsconfig.json +0 -3
- package/attributes-master/packages/starrating/CHANGELOG.md +0 -70
- package/attributes-master/packages/starrating/README.md +0 -25
- package/attributes-master/packages/starrating/package.json +0 -22
- package/attributes-master/packages/starrating/src/actions/classes.ts +0 -41
- package/attributes-master/packages/starrating/src/actions/events.ts +0 -80
- package/attributes-master/packages/starrating/src/factory.ts +0 -24
- package/attributes-master/packages/starrating/src/index.ts +0 -3
- package/attributes-master/packages/starrating/src/init.ts +0 -24
- package/attributes-master/packages/starrating/src/utils/constants.ts +0 -20
- package/attributes-master/packages/starrating/src/utils/helpers.ts +0 -63
- package/attributes-master/packages/starrating/src/utils/selectors.ts +0 -9
- package/attributes-master/packages/starrating/tsconfig.json +0 -3
- package/attributes-master/packages/template/README.md +0 -25
- package/attributes-master/packages/template/package.json +0 -22
- package/attributes-master/packages/template/src/actions/console.ts +0 -4
- package/attributes-master/packages/template/src/index.ts +0 -3
- package/attributes-master/packages/template/src/init.ts +0 -14
- package/attributes-master/packages/template/src/utils/constants.ts +0 -18
- package/attributes-master/packages/template/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/template/tsconfig.json +0 -3
- package/attributes-master/packages/toc/CHANGELOG.md +0 -192
- package/attributes-master/packages/toc/README.md +0 -25
- package/attributes-master/packages/toc/package.json +0 -23
- package/attributes-master/packages/toc/src/actions/collect.ts +0 -136
- package/attributes-master/packages/toc/src/actions/create.ts +0 -44
- package/attributes-master/packages/toc/src/actions/events.ts +0 -29
- package/attributes-master/packages/toc/src/actions/observe.ts +0 -31
- package/attributes-master/packages/toc/src/actions/populate.ts +0 -68
- package/attributes-master/packages/toc/src/actions/prepare.ts +0 -25
- package/attributes-master/packages/toc/src/actions/scroll.ts +0 -33
- package/attributes-master/packages/toc/src/components/TOCItem.ts +0 -88
- package/attributes-master/packages/toc/src/factory.ts +0 -47
- package/attributes-master/packages/toc/src/index.ts +0 -3
- package/attributes-master/packages/toc/src/init.ts +0 -37
- package/attributes-master/packages/toc/src/utils/constants.ts +0 -55
- package/attributes-master/packages/toc/src/utils/helpers.ts +0 -23
- package/attributes-master/packages/toc/src/utils/selectors.ts +0 -6
- package/attributes-master/packages/toc/src/utils/types.ts +0 -21
- package/attributes-master/packages/toc/tsconfig.json +0 -3
- package/attributes-master/packages/utils/CHANGELOG.md +0 -43
- package/attributes-master/packages/utils/package.json +0 -27
- package/attributes-master/packages/utils/src/animations/factory.ts +0 -100
- package/attributes-master/packages/utils/src/animations/index.ts +0 -73
- package/attributes-master/packages/utils/src/animations/types.ts +0 -37
- package/attributes-master/packages/utils/src/components/Interaction.ts +0 -79
- package/attributes-master/packages/utils/src/components/Renderer.ts +0 -59
- package/attributes-master/packages/utils/src/components/index.ts +0 -2
- package/attributes-master/packages/utils/src/constants/a11y.ts +0 -50
- package/attributes-master/packages/utils/src/constants/attributes.ts +0 -57
- package/attributes-master/packages/utils/src/constants/index.ts +0 -5
- package/attributes-master/packages/utils/src/constants/keyboard.ts +0 -10
- package/attributes-master/packages/utils/src/constants/webflow.ts +0 -74
- package/attributes-master/packages/utils/src/helpers/dates.ts +0 -17
- package/attributes-master/packages/utils/src/helpers/dom.ts +0 -82
- package/attributes-master/packages/utils/src/helpers/events.ts +0 -59
- package/attributes-master/packages/utils/src/helpers/fetch.ts +0 -217
- package/attributes-master/packages/utils/src/helpers/forms.ts +0 -238
- package/attributes-master/packages/utils/src/helpers/guards.ts +0 -138
- package/attributes-master/packages/utils/src/helpers/index.ts +0 -11
- package/attributes-master/packages/utils/src/helpers/numbers.ts +0 -86
- package/attributes-master/packages/utils/src/helpers/selectors.ts +0 -249
- package/attributes-master/packages/utils/src/helpers/strings.ts +0 -19
- package/attributes-master/packages/utils/src/helpers/wait.ts +0 -36
- package/attributes-master/packages/utils/src/helpers/webflow.ts +0 -117
- package/attributes-master/packages/utils/src/index.ts +0 -5
- package/attributes-master/packages/utils/src/types/core.ts +0 -100
- package/attributes-master/packages/utils/src/types/dom.ts +0 -31
- package/attributes-master/packages/utils/src/types/index.ts +0 -4
- package/attributes-master/packages/utils/src/types/utils.ts +0 -20
- package/attributes-master/packages/utils/src/types/webflow.ts +0 -147
- package/attributes-master/packages/utils/tsconfig.json +0 -3
- package/attributes-master/packages/videohls/CHANGELOG.md +0 -76
- package/attributes-master/packages/videohls/README.md +0 -27
- package/attributes-master/packages/videohls/package.json +0 -26
- package/attributes-master/packages/videohls/src/actions/list.ts +0 -23
- package/attributes-master/packages/videohls/src/actions/video.ts +0 -44
- package/attributes-master/packages/videohls/src/index.ts +0 -3
- package/attributes-master/packages/videohls/src/init.ts +0 -28
- package/attributes-master/packages/videohls/src/utils/constants.ts +0 -12
- package/attributes-master/packages/videohls/src/utils/selectors.ts +0 -5
- package/attributes-master/packages/videohls/src/utils/stores.ts +0 -3
- package/attributes-master/packages/videohls/tsconfig.json +0 -3
- package/attributes-master/pnpm-lock.yaml +0 -3317
- package/attributes-master/pnpm-workspace.yaml +0 -3
- package/attributes-master/tsconfig.json +0 -6
- package/autoInit/smooth-scroll.js +0 -89
- package/debug-version.html +0 -37
- package/utils/navbar.js +0 -214
- package/utils/scroll-progress.js +0 -29
- package/utils/toc.js +0 -77
@@ -1,56 +0,0 @@
|
|
1
|
-
import { isHTMLSelectElement } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import type { List } from '../components';
|
4
|
-
import { queryAllElements } from '../utils/selectors';
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Inits the list select dropdowns.
|
8
|
-
* @param list
|
9
|
-
* @param selectElements
|
10
|
-
*/
|
11
|
-
export const initListSelects = (list: List, selectElements: HTMLElement[]) => {
|
12
|
-
list.webflowModules.add('slider');
|
13
|
-
|
14
|
-
selectElements.forEach((sliderReference) => initListSelect(list, sliderReference));
|
15
|
-
};
|
16
|
-
|
17
|
-
/**
|
18
|
-
* Inits a list select dropdown.
|
19
|
-
* @param list
|
20
|
-
* @param selectElement
|
21
|
-
*/
|
22
|
-
const initListSelect = (list: List, selectElement: HTMLElement) => {
|
23
|
-
if (!isHTMLSelectElement(selectElement)) return;
|
24
|
-
|
25
|
-
// Store rendered options
|
26
|
-
const renderedOptions = new Map<string, HTMLOptionElement>();
|
27
|
-
|
28
|
-
// Handle items
|
29
|
-
list.addHook('render', (items = []) => {
|
30
|
-
const allOptionValues = new Set<string>();
|
31
|
-
|
32
|
-
for (const item of items) {
|
33
|
-
const optionValues = queryAllElements('select-value', { scope: item.element });
|
34
|
-
|
35
|
-
for (const optionValue of optionValues) {
|
36
|
-
allOptionValues.add(optionValue.innerText);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
for (const optionValue of allOptionValues) {
|
41
|
-
if (renderedOptions.has(optionValue)) continue;
|
42
|
-
|
43
|
-
const option = new Option(optionValue, optionValue);
|
44
|
-
|
45
|
-
selectElement.options.add(option);
|
46
|
-
renderedOptions.set(optionValue, option);
|
47
|
-
}
|
48
|
-
|
49
|
-
for (const [optionValue, option] of renderedOptions) {
|
50
|
-
if (allOptionValues.has(optionValue)) continue;
|
51
|
-
|
52
|
-
option?.remove();
|
53
|
-
renderedOptions.delete(optionValue);
|
54
|
-
}
|
55
|
-
});
|
56
|
-
};
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import { ARIA_ROLE_KEY, SLIDER_CSS_CLASSES } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import type { List, ListItem } from '../components';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Inits the list sliders.
|
7
|
-
* @param list
|
8
|
-
* @param slidersReferences
|
9
|
-
*/
|
10
|
-
export const initListSliders = (list: List, slidersReferences: HTMLElement[]) => {
|
11
|
-
list.webflowModules.add('slider');
|
12
|
-
|
13
|
-
slidersReferences.forEach((sliderReference) => initListSlider(list, sliderReference));
|
14
|
-
};
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Inits a list slider.
|
18
|
-
* @param list
|
19
|
-
* @param sliderReference
|
20
|
-
*/
|
21
|
-
const initListSlider = (list: List, sliderReference: HTMLElement) => {
|
22
|
-
const sliderElement = sliderReference.closest(`.${SLIDER_CSS_CLASSES.slider}`);
|
23
|
-
if (!sliderElement) return;
|
24
|
-
|
25
|
-
const sliderMask = sliderElement.querySelector(`.${SLIDER_CSS_CLASSES.sliderMask}`);
|
26
|
-
if (!sliderMask) return;
|
27
|
-
|
28
|
-
const existingSlides = sliderElement.querySelectorAll(`.${SLIDER_CSS_CLASSES.slide}`);
|
29
|
-
if (!existingSlides.length) return;
|
30
|
-
|
31
|
-
// Store the template CSS classes
|
32
|
-
const slideCSS = existingSlides[0].classList.value;
|
33
|
-
|
34
|
-
// Remove existing slides
|
35
|
-
for (const slide of existingSlides) slide.remove();
|
36
|
-
|
37
|
-
// Store rendered items
|
38
|
-
const renderedItems = new Map<ListItem, HTMLDivElement>();
|
39
|
-
|
40
|
-
list.addHook('render', (items = []) => {
|
41
|
-
for (const item of items) {
|
42
|
-
if (renderedItems.has(item)) continue;
|
43
|
-
|
44
|
-
item.element.removeAttribute(ARIA_ROLE_KEY);
|
45
|
-
|
46
|
-
const newSlide = document.createElement('div');
|
47
|
-
newSlide.setAttribute('class', slideCSS);
|
48
|
-
|
49
|
-
newSlide.appendChild(item.element);
|
50
|
-
sliderMask.appendChild(newSlide);
|
51
|
-
|
52
|
-
renderedItems.set(item, newSlide);
|
53
|
-
}
|
54
|
-
|
55
|
-
for (const [item, slide] of renderedItems) {
|
56
|
-
if (items.includes(item)) continue;
|
57
|
-
|
58
|
-
slide?.remove();
|
59
|
-
renderedItems.delete(item);
|
60
|
-
}
|
61
|
-
});
|
62
|
-
};
|
@@ -1,96 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
addListener,
|
3
|
-
ARIA_ROLE_KEY,
|
4
|
-
ARIA_ROLE_VALUES,
|
5
|
-
ARIA_SORT_KEY,
|
6
|
-
ARIA_SORT_VALUES,
|
7
|
-
isNotEmpty,
|
8
|
-
TABINDEX_KEY,
|
9
|
-
} from '@finsweet/attributes-utils';
|
10
|
-
import { computed, effect, ref } from '@vue/reactivity';
|
11
|
-
|
12
|
-
import type { List } from '../components/List';
|
13
|
-
import { getAttribute, hasAttributeValue } from '../utils/selectors';
|
14
|
-
import type { SortingDirection } from './types';
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Inits the sorting with a group of Buttons.
|
18
|
-
* @param buttons The button elements.
|
19
|
-
* @param list The {@link List} instance.
|
20
|
-
|
21
|
-
*/
|
22
|
-
export const initButtons = (buttons: HTMLElement[], list: List) => {
|
23
|
-
const activeButton = ref<HTMLElement | undefined>();
|
24
|
-
|
25
|
-
const cleanups = buttons
|
26
|
-
.flatMap((button) => {
|
27
|
-
const fieldKey = getAttribute(button, 'field')?.trim();
|
28
|
-
if (!fieldKey) return;
|
29
|
-
|
30
|
-
const reverse = hasAttributeValue(button, 'reverse', 'true');
|
31
|
-
const ascClass = getAttribute(button, 'ascclass');
|
32
|
-
const desClass = getAttribute(button, 'descclass');
|
33
|
-
|
34
|
-
const currentDirection = ref<SortingDirection | undefined>();
|
35
|
-
|
36
|
-
button.setAttribute(ARIA_ROLE_KEY, ARIA_ROLE_VALUES.columnheader);
|
37
|
-
button.setAttribute(TABINDEX_KEY, '0');
|
38
|
-
|
39
|
-
// Dynamically set the `aria-sort` attribute
|
40
|
-
const ariaSort = computed(() => {
|
41
|
-
if (activeButton.value !== button) return 'none';
|
42
|
-
|
43
|
-
return currentDirection.value === 'asc' ? ARIA_SORT_VALUES.ascending : ARIA_SORT_VALUES.descending;
|
44
|
-
});
|
45
|
-
|
46
|
-
const ariaSortRunner = effect(() => {
|
47
|
-
button.setAttribute(ARIA_SORT_KEY, ariaSort.value);
|
48
|
-
});
|
49
|
-
|
50
|
-
// Dynamically set the direction CSS class
|
51
|
-
const cssClass = computed(() => {
|
52
|
-
if (activeButton.value !== button) return null;
|
53
|
-
|
54
|
-
return currentDirection.value === 'asc' ? ascClass : desClass;
|
55
|
-
});
|
56
|
-
|
57
|
-
const cssClassRunner = effect(() => {
|
58
|
-
button.classList.remove(ascClass, desClass);
|
59
|
-
|
60
|
-
if (cssClass.value) {
|
61
|
-
button.classList.add(cssClass.value);
|
62
|
-
}
|
63
|
-
});
|
64
|
-
|
65
|
-
// Sort on click
|
66
|
-
const clickCleanup = addListener(button, 'click', async (e) => {
|
67
|
-
e.preventDefault();
|
68
|
-
|
69
|
-
activeButton.value = button;
|
70
|
-
currentDirection.value = getNextDirection(currentDirection.value, reverse);
|
71
|
-
|
72
|
-
list.sorting.value = {
|
73
|
-
fieldKey,
|
74
|
-
direction: currentDirection.value,
|
75
|
-
interacted: true,
|
76
|
-
};
|
77
|
-
});
|
78
|
-
|
79
|
-
return [() => ariaSortRunner.effect.stop(), () => cssClassRunner.effect.stop(), clickCleanup];
|
80
|
-
})
|
81
|
-
.filter(isNotEmpty);
|
82
|
-
|
83
|
-
return () => {
|
84
|
-
for (const cleanup of cleanups) cleanup();
|
85
|
-
};
|
86
|
-
};
|
87
|
-
|
88
|
-
/**
|
89
|
-
* @returns The new direction of a button.
|
90
|
-
* @param currentDirection The current direction of a button.
|
91
|
-
*/
|
92
|
-
const getNextDirection = (currentDirection: SortingDirection | undefined, reverse: boolean): SortingDirection => {
|
93
|
-
if (!currentDirection) return reverse ? 'desc' : 'asc';
|
94
|
-
|
95
|
-
return currentDirection === 'desc' ? 'asc' : 'desc';
|
96
|
-
};
|
@@ -1,179 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
addListener,
|
3
|
-
ARIA_HASPOPUP_KEY,
|
4
|
-
ARIA_MULTISELECTABLE_KEY,
|
5
|
-
ARIA_ROLE_KEY,
|
6
|
-
ARIA_ROLE_VALUES,
|
7
|
-
ARIA_SELECTED_KEY,
|
8
|
-
closeDropdown,
|
9
|
-
CURRENT_CSS_CLASS,
|
10
|
-
DROPDOWN_CSS_CLASSES,
|
11
|
-
type DropdownElement,
|
12
|
-
type DropdownList,
|
13
|
-
type DropdownToggle,
|
14
|
-
isElement,
|
15
|
-
} from '@finsweet/attributes-utils';
|
16
|
-
import { effect, type Ref, ref } from '@vue/reactivity';
|
17
|
-
|
18
|
-
import type { List } from '../components/List';
|
19
|
-
import { getAttribute, queryElement } from '../utils/selectors';
|
20
|
-
import type { SortingDirection } from './types';
|
21
|
-
|
22
|
-
type DropdownOption = {
|
23
|
-
element: HTMLAnchorElement;
|
24
|
-
fieldKey?: string;
|
25
|
-
direction?: SortingDirection;
|
26
|
-
cleanup: () => void;
|
27
|
-
};
|
28
|
-
|
29
|
-
type DropdownOptions = Map<HTMLAnchorElement, DropdownOption>;
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Inits sorting on a `Dropdown` component.
|
33
|
-
* @param dropdown The {@link DropdownElement} element.
|
34
|
-
* @param list The {@link List} instance.
|
35
|
-
*/
|
36
|
-
export const initDropdown = (dropdown: DropdownElement, list: List) => {
|
37
|
-
const dropdownToggle = dropdown.querySelector<DropdownToggle>(`.${DROPDOWN_CSS_CLASSES.dropdownToggle}`);
|
38
|
-
const dropdownList = dropdown.querySelector<DropdownList>(`.${DROPDOWN_CSS_CLASSES.dropdownList}`);
|
39
|
-
|
40
|
-
if (!dropdownToggle || !dropdownList) {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
|
44
|
-
setDropdownAria(dropdownToggle, dropdownList);
|
45
|
-
|
46
|
-
const activeOption = ref<DropdownOption | undefined>();
|
47
|
-
|
48
|
-
// Listen events
|
49
|
-
const dropdownLabelCleanup = initDropdownLabel(dropdownToggle, activeOption);
|
50
|
-
|
51
|
-
const dropdownOptions = initDropdownOptions(dropdownList, activeOption);
|
52
|
-
if (!dropdownOptions) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
|
56
|
-
const clickCleanup = addListener(dropdownList, 'click', async (e) => {
|
57
|
-
e.preventDefault();
|
58
|
-
|
59
|
-
const { target } = e;
|
60
|
-
|
61
|
-
if (!isElement(target)) {
|
62
|
-
return;
|
63
|
-
}
|
64
|
-
|
65
|
-
const optionElement = target.closest('a');
|
66
|
-
if (!optionElement) return;
|
67
|
-
|
68
|
-
const optionData = dropdownOptions.get(optionElement);
|
69
|
-
if (!optionData) return;
|
70
|
-
|
71
|
-
const isSelected = activeOption.value?.element === optionElement;
|
72
|
-
if (isSelected) return;
|
73
|
-
|
74
|
-
activeOption.value = optionData;
|
75
|
-
|
76
|
-
list.sorting.value = {
|
77
|
-
fieldKey: optionData.fieldKey,
|
78
|
-
direction: optionData.direction,
|
79
|
-
interacted: true,
|
80
|
-
};
|
81
|
-
|
82
|
-
closeDropdown(dropdownToggle);
|
83
|
-
});
|
84
|
-
|
85
|
-
return () => {
|
86
|
-
dropdownLabelCleanup?.();
|
87
|
-
clickCleanup();
|
88
|
-
};
|
89
|
-
};
|
90
|
-
|
91
|
-
/**
|
92
|
-
* Collects all options in the Dropdown.
|
93
|
-
* @param dropdownList The {@link DropdownList} element.
|
94
|
-
* @returns
|
95
|
-
*/
|
96
|
-
const initDropdownOptions = (dropdownList: DropdownList, activeOption: Ref<DropdownOption | undefined>) => {
|
97
|
-
const dropdownOptions: DropdownOptions = new Map();
|
98
|
-
|
99
|
-
const options = [...dropdownList.querySelectorAll('a')];
|
100
|
-
if (!options.length) return;
|
101
|
-
|
102
|
-
for (const element of options) {
|
103
|
-
element.setAttribute(ARIA_ROLE_KEY, ARIA_ROLE_VALUES.option);
|
104
|
-
|
105
|
-
const rawField = getAttribute(element, 'field')?.trim();
|
106
|
-
|
107
|
-
let fieldKey: string | undefined;
|
108
|
-
let direction: SortingDirection | undefined;
|
109
|
-
|
110
|
-
if (rawField) {
|
111
|
-
if (rawField.endsWith('-asc')) {
|
112
|
-
direction = 'asc';
|
113
|
-
fieldKey = rawField.slice(0, -4);
|
114
|
-
} else if (rawField.endsWith('-desc')) {
|
115
|
-
direction = 'desc';
|
116
|
-
fieldKey = rawField.slice(0, -5);
|
117
|
-
} else {
|
118
|
-
direction = 'asc';
|
119
|
-
fieldKey = rawField;
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
// Handle active state
|
124
|
-
const runner = effect(() => {
|
125
|
-
const isSelected = activeOption.value?.element === element;
|
126
|
-
|
127
|
-
if (isSelected) {
|
128
|
-
element.setAttribute(ARIA_SELECTED_KEY, 'true');
|
129
|
-
element.classList.add(CURRENT_CSS_CLASS);
|
130
|
-
} else {
|
131
|
-
element.removeAttribute(ARIA_SELECTED_KEY);
|
132
|
-
element.classList.remove(CURRENT_CSS_CLASS);
|
133
|
-
}
|
134
|
-
});
|
135
|
-
|
136
|
-
dropdownOptions.set(element, {
|
137
|
-
element,
|
138
|
-
fieldKey,
|
139
|
-
direction,
|
140
|
-
cleanup: () => runner.effect.stop(),
|
141
|
-
});
|
142
|
-
}
|
143
|
-
|
144
|
-
return dropdownOptions;
|
145
|
-
};
|
146
|
-
|
147
|
-
/**
|
148
|
-
* Dynamically updates the Dropdown label with the selected option.
|
149
|
-
* @param dropdownToggle The {@link DropdownToggle}.
|
150
|
-
* @returns A cleanup function.
|
151
|
-
*/
|
152
|
-
const initDropdownLabel = (dropdownToggle: DropdownToggle, activeOption: Ref<DropdownOption | undefined>) => {
|
153
|
-
const dropdownLabel = queryElement('dropdown-label', { scope: dropdownToggle });
|
154
|
-
if (!dropdownLabel) return;
|
155
|
-
|
156
|
-
const originalHTML = dropdownLabel.innerHTML;
|
157
|
-
|
158
|
-
const runner = effect(() => {
|
159
|
-
if (!activeOption.value) {
|
160
|
-
dropdownLabel.innerHTML = originalHTML;
|
161
|
-
return;
|
162
|
-
}
|
163
|
-
|
164
|
-
dropdownLabel.innerHTML = activeOption.value.element.innerHTML;
|
165
|
-
});
|
166
|
-
|
167
|
-
return () => runner.effect.stop();
|
168
|
-
};
|
169
|
-
|
170
|
-
/**
|
171
|
-
* Adds `a11y` attributes to the Dropdown elements.
|
172
|
-
* @param dropdownToggle The {@link DropdownToggle} element.
|
173
|
-
* @param dropdownList The {@link DropdownList} element.
|
174
|
-
*/
|
175
|
-
const setDropdownAria = (dropdownToggle: DropdownToggle, dropdownList: DropdownList) => {
|
176
|
-
dropdownToggle.setAttribute(ARIA_HASPOPUP_KEY, ARIA_ROLE_VALUES.listbox);
|
177
|
-
dropdownList.setAttribute(ARIA_ROLE_KEY, ARIA_ROLE_VALUES.listbox);
|
178
|
-
dropdownList.setAttribute(ARIA_MULTISELECTABLE_KEY, 'false');
|
179
|
-
};
|
@@ -1,81 +0,0 @@
|
|
1
|
-
import { DROPDOWN_CSS_CLASSES, type DropdownElement, isHTMLSelectElement } from '@finsweet/attributes-utils';
|
2
|
-
import { watch } from '@vue/reactivity';
|
3
|
-
import debounce from 'just-debounce';
|
4
|
-
|
5
|
-
import type { List } from '../components/List';
|
6
|
-
import { getAttribute } from '../utils/selectors';
|
7
|
-
import { initButtons } from './buttons';
|
8
|
-
import { initDropdown } from './dropdown';
|
9
|
-
import { getListSortingQuery, setListSortingQuery } from './query';
|
10
|
-
import { initHTMLSelect } from './select';
|
11
|
-
import { sortListItems } from './sort';
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Inits sorting functionality for the list.
|
15
|
-
*/
|
16
|
-
export const initListSorting = (list: List, triggers: HTMLElement[]) => {
|
17
|
-
const sortingClass = getAttribute(list.listElement, 'sortingclass');
|
18
|
-
|
19
|
-
// Init mode
|
20
|
-
const [firstTrigger] = triggers;
|
21
|
-
const isSelect = isHTMLSelectElement(firstTrigger);
|
22
|
-
const isDropdown = firstTrigger.closest<DropdownElement>(`.${DROPDOWN_CSS_CLASSES.dropdown}`);
|
23
|
-
|
24
|
-
const modeCleanup = isSelect
|
25
|
-
? initHTMLSelect(firstTrigger, list)
|
26
|
-
: isDropdown
|
27
|
-
? initDropdown(isDropdown, list)
|
28
|
-
: initButtons(triggers, list);
|
29
|
-
|
30
|
-
// Set up hooks
|
31
|
-
const sortHookCleanup = list.addHook('sort', (items) => {
|
32
|
-
const sortedItems = sortListItems(items, list.sorting.value);
|
33
|
-
return sortedItems;
|
34
|
-
});
|
35
|
-
|
36
|
-
const beforeRenderHookCleanup = list.addHook('beforeRender', async (items) => {
|
37
|
-
if (list.triggeredHook === 'sort') {
|
38
|
-
list.wrapperElement.classList.add(sortingClass);
|
39
|
-
|
40
|
-
const animations = list.wrapperElement.getAnimations({ subtree: true });
|
41
|
-
|
42
|
-
await Promise.all(animations.map((a) => a.finished));
|
43
|
-
}
|
44
|
-
|
45
|
-
return items;
|
46
|
-
});
|
47
|
-
|
48
|
-
const afterRenderHookCleanup = list.addHook('afterRender', (items) => {
|
49
|
-
list.wrapperElement.classList.remove(sortingClass);
|
50
|
-
|
51
|
-
return items;
|
52
|
-
});
|
53
|
-
|
54
|
-
// Set up reactivity
|
55
|
-
const sortingCleanup = watch(
|
56
|
-
list.sorting,
|
57
|
-
debounce(() => {
|
58
|
-
list.triggerHook('sort', {
|
59
|
-
scrollToAnchor: list.hasInteracted.value,
|
60
|
-
resetCurrentPage: list.hasInteracted.value,
|
61
|
-
});
|
62
|
-
|
63
|
-
// Handle query params
|
64
|
-
if (list.showQuery) {
|
65
|
-
setListSortingQuery(list);
|
66
|
-
}
|
67
|
-
}, 0),
|
68
|
-
{ deep: true, immediate: true }
|
69
|
-
);
|
70
|
-
|
71
|
-
// Read query params
|
72
|
-
getListSortingQuery(list);
|
73
|
-
|
74
|
-
return () => {
|
75
|
-
modeCleanup?.();
|
76
|
-
sortHookCleanup();
|
77
|
-
beforeRenderHookCleanup();
|
78
|
-
afterRenderHookCleanup();
|
79
|
-
sortingCleanup();
|
80
|
-
};
|
81
|
-
};
|
@@ -1,63 +0,0 @@
|
|
1
|
-
import type { List } from '../components';
|
2
|
-
import { listInstancesStore } from '../utils/store';
|
3
|
-
import type { SortingDirection } from './types';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @param list
|
7
|
-
* @returns A regex to match the filters query string.
|
8
|
-
*/
|
9
|
-
const getListSortingQueryRegex = (list: List) => {
|
10
|
-
const allFieldKeys = Object.keys(list.allFieldsData.value);
|
11
|
-
|
12
|
-
const regex = new RegExp(`sort_(${allFieldKeys.join('|')})$`);
|
13
|
-
return regex;
|
14
|
-
};
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Gets the filters query string for the list.
|
18
|
-
* @param list
|
19
|
-
*/
|
20
|
-
export const getListSortingQuery = async (list: List) => {
|
21
|
-
const usePrefix = listInstancesStore.size > 1;
|
22
|
-
const existingParams = await list.getAllSearchParams(usePrefix);
|
23
|
-
|
24
|
-
const regex = getListSortingQueryRegex(list);
|
25
|
-
|
26
|
-
const param = existingParams.find(([key, value]) => key.match(regex) && (value === 'asc' || value === 'desc'));
|
27
|
-
if (!param) return;
|
28
|
-
|
29
|
-
const [key, value] = param;
|
30
|
-
|
31
|
-
const match = key.match(regex);
|
32
|
-
if (!match) return;
|
33
|
-
|
34
|
-
const fieldKey = match[1];
|
35
|
-
|
36
|
-
list.sorting.value.fieldKey = fieldKey;
|
37
|
-
list.sorting.value.direction = value as SortingDirection;
|
38
|
-
list.sorting.value.interacted = true;
|
39
|
-
};
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Sets the filters query string for the list.
|
43
|
-
* @param list
|
44
|
-
*/
|
45
|
-
export const setListSortingQuery = async (list: List) => {
|
46
|
-
const usePrefix = listInstancesStore.size > 1;
|
47
|
-
const existingParams = await list.getAllSearchParams(usePrefix);
|
48
|
-
|
49
|
-
const regex = getListSortingQueryRegex(list);
|
50
|
-
|
51
|
-
for (const [key] of existingParams) {
|
52
|
-
if (!key.match(regex)) continue;
|
53
|
-
|
54
|
-
await list.setSearchParam(key, null, usePrefix);
|
55
|
-
}
|
56
|
-
|
57
|
-
const { fieldKey, direction } = list.sorting.value;
|
58
|
-
if (!fieldKey || !direction) return;
|
59
|
-
|
60
|
-
const key = `sort_${fieldKey}`;
|
61
|
-
|
62
|
-
list.setSearchParam(key, direction, usePrefix);
|
63
|
-
};
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import { addListener } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import type { List } from '../components/List';
|
4
|
-
import { hasAttributeValue } from '../utils/selectors';
|
5
|
-
import type { Sorting, SortingDirection } from './types';
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Inits sorting on an `HTMLSelectElement`.
|
9
|
-
* @param selectElement The {@link HTMLSelectElement}.
|
10
|
-
* @param list The {@link List} instance.
|
11
|
-
*/
|
12
|
-
export const initHTMLSelect = (selectElement: HTMLSelectElement, list: List) => {
|
13
|
-
const handleSelect = (interacted = false) => {
|
14
|
-
list.sorting.value = getSortingParams(selectElement.value, interacted);
|
15
|
-
};
|
16
|
-
|
17
|
-
// Sort on change
|
18
|
-
const changeCleanup = addListener(selectElement, 'change', () => handleSelect(true));
|
19
|
-
|
20
|
-
// Sort on init
|
21
|
-
handleSelect();
|
22
|
-
|
23
|
-
// Prevent submit events on the form
|
24
|
-
const form = selectElement.closest('form');
|
25
|
-
|
26
|
-
const allowSubmit = hasAttributeValue(selectElement, 'allowsubmit', 'true');
|
27
|
-
|
28
|
-
const submitCleanup = allowSubmit ? addListener(form, 'submit', handleFormSubmit) : undefined;
|
29
|
-
|
30
|
-
return () => {
|
31
|
-
changeCleanup();
|
32
|
-
submitCleanup?.();
|
33
|
-
};
|
34
|
-
};
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Handles `submit` events on the parent form of the `HTMLSelect` element.
|
38
|
-
* @param e The `submit` event.
|
39
|
-
*/
|
40
|
-
const handleFormSubmit = (e: Event) => {
|
41
|
-
e.preventDefault();
|
42
|
-
e.stopImmediatePropagation();
|
43
|
-
return false;
|
44
|
-
};
|
45
|
-
|
46
|
-
/**
|
47
|
-
* Extracts the `sortKey` and `direction` from a Select element value.
|
48
|
-
* @param value The Select element value.
|
49
|
-
* @param interacted Indicates if the user interacted with the select element.
|
50
|
-
*/
|
51
|
-
const getSortingParams = (value: string, interacted = false): Sorting => {
|
52
|
-
let fieldKey: string;
|
53
|
-
let direction: SortingDirection;
|
54
|
-
|
55
|
-
if (value.endsWith('-asc')) {
|
56
|
-
direction = 'asc';
|
57
|
-
fieldKey = value.slice(0, -4);
|
58
|
-
} else if (value.endsWith('-desc')) {
|
59
|
-
direction = 'desc';
|
60
|
-
fieldKey = value.slice(0, -5);
|
61
|
-
} else {
|
62
|
-
direction = 'asc';
|
63
|
-
fieldKey = value;
|
64
|
-
}
|
65
|
-
|
66
|
-
return { fieldKey, direction, interacted };
|
67
|
-
};
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import type { ListItem } from '../components/ListItem';
|
2
|
-
import type { Sorting } from './types';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Sorts the items of a `CMSList`.
|
6
|
-
* **Important:** This method mutates the {@link ListItem.items} property.
|
7
|
-
*
|
8
|
-
* @param listInstance The {@link CMSList} instance.
|
9
|
-
* @param direction The direction to sort.
|
10
|
-
* @param sortKey The key of the field to use as sorting reference.
|
11
|
-
*/
|
12
|
-
export const sortListItems = (items: ListItem[], { fieldKey, direction }: Sorting): ListItem[] | undefined => {
|
13
|
-
const validField = !!direction && !!fieldKey && items.some(({ fields }) => fieldKey in fields);
|
14
|
-
if (!validField) return;
|
15
|
-
|
16
|
-
const sorted = [...items].sort((firstItem, secondItem) => {
|
17
|
-
const firstItemProp = firstItem.fields[fieldKey];
|
18
|
-
const secondItemProp = secondItem.fields[fieldKey];
|
19
|
-
|
20
|
-
if (!firstItemProp) return 1;
|
21
|
-
if (!secondItemProp) return -1;
|
22
|
-
|
23
|
-
// Number sorting
|
24
|
-
if (firstItemProp.type === 'number' && secondItemProp.type === 'number') {
|
25
|
-
const firstItemValue = getItemValue(firstItemProp.value);
|
26
|
-
const secondItemValue = getItemValue(secondItemProp.value);
|
27
|
-
|
28
|
-
if (isNaN(firstItemValue)) return 1;
|
29
|
-
if (isNaN(secondItemValue)) return -1;
|
30
|
-
|
31
|
-
if (direction === 'asc') return firstItemValue - secondItemValue;
|
32
|
-
|
33
|
-
return secondItemValue - firstItemValue;
|
34
|
-
}
|
35
|
-
|
36
|
-
// Dates sorting
|
37
|
-
if (firstItemProp.type === 'date' && secondItemProp.type === 'date') {
|
38
|
-
const firstItemValue = getItemValue(firstItemProp.value).getTime();
|
39
|
-
const secondItemValue = getItemValue(secondItemProp.value).getTime();
|
40
|
-
|
41
|
-
if (direction === 'asc') return firstItemValue - secondItemValue;
|
42
|
-
|
43
|
-
return secondItemValue - firstItemValue;
|
44
|
-
}
|
45
|
-
|
46
|
-
// Text sorting
|
47
|
-
if (firstItemProp.type === 'text' && secondItemProp.type === 'text') {
|
48
|
-
const firstItemValue = getItemValue(firstItemProp.value);
|
49
|
-
const secondItemValue = getItemValue(secondItemProp.value);
|
50
|
-
|
51
|
-
const collatorOptions: Intl.CollatorOptions = {
|
52
|
-
numeric: true,
|
53
|
-
sensitivity: 'base',
|
54
|
-
};
|
55
|
-
|
56
|
-
if (direction === 'asc') return firstItemValue.localeCompare(secondItemValue, undefined, collatorOptions);
|
57
|
-
|
58
|
-
return secondItemValue.localeCompare(firstItemValue, undefined, collatorOptions);
|
59
|
-
}
|
60
|
-
|
61
|
-
return 0;
|
62
|
-
});
|
63
|
-
|
64
|
-
return sorted;
|
65
|
-
};
|
66
|
-
|
67
|
-
/**
|
68
|
-
* @returns The first value of the array or the value itself.
|
69
|
-
* @param value
|
70
|
-
*/
|
71
|
-
const getItemValue = <
|
72
|
-
Value extends number | string | Date | number[] | string[] | Date[],
|
73
|
-
ReturnValue = Value extends (infer U)[] ? U : Value,
|
74
|
-
>(
|
75
|
-
value: Value
|
76
|
-
) => {
|
77
|
-
const [firstValue] = Array.isArray(value) ? value : [value];
|
78
|
-
return firstValue as ReturnValue;
|
79
|
-
};
|