@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,82 +0,0 @@
|
|
1
|
-
import { isHTMLElement } from './guards';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Ensures that an element has a unique ID.
|
5
|
-
* If the element already has a unique ID, that one is preserved.
|
6
|
-
* @param element
|
7
|
-
* @returns Returns the unique ID assigned to the element.
|
8
|
-
*/
|
9
|
-
export const ensureUniqueId = (element: Element) => {
|
10
|
-
if (!element.id || document.getElementById(element.id) !== element) {
|
11
|
-
const id = crypto.randomUUID();
|
12
|
-
element.id = id;
|
13
|
-
return id;
|
14
|
-
}
|
15
|
-
|
16
|
-
return element.id;
|
17
|
-
};
|
18
|
-
|
19
|
-
/**
|
20
|
-
* Checks if an element is visible
|
21
|
-
* @param element
|
22
|
-
*/
|
23
|
-
export const isVisible = (element: HTMLElement): boolean =>
|
24
|
-
!!(element.offsetWidth || element.offsetHeight || element.getClientRects().length);
|
25
|
-
|
26
|
-
/**
|
27
|
-
* Clone a node that has the same type as the original one
|
28
|
-
* @param node
|
29
|
-
*/
|
30
|
-
export const cloneNode = <T extends Node>(node: T, deep = true): T => <T>node.cloneNode(deep);
|
31
|
-
|
32
|
-
/**
|
33
|
-
* Finds the first child text node of an element
|
34
|
-
* @param element The element to search into.
|
35
|
-
*/
|
36
|
-
export const findTextNode = (element: HTMLElement): ChildNode | undefined => {
|
37
|
-
let textNode: ChildNode | undefined;
|
38
|
-
|
39
|
-
for (const node of element.childNodes) {
|
40
|
-
if (isHTMLElement(node) && node.childNodes.length) textNode = findTextNode(node);
|
41
|
-
else if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim()) textNode = node;
|
42
|
-
|
43
|
-
if (textNode) break;
|
44
|
-
}
|
45
|
-
|
46
|
-
return textNode;
|
47
|
-
};
|
48
|
-
|
49
|
-
/**
|
50
|
-
* @returns The first hidden parent element, or the element itself (if hidden).
|
51
|
-
* If the element is already visible, the function returns `undefined`.
|
52
|
-
*
|
53
|
-
* @param element The reference element.
|
54
|
-
*/
|
55
|
-
export const getHiddenParent = (element: HTMLElement): HTMLElement | undefined => {
|
56
|
-
if (isVisible(element)) return;
|
57
|
-
|
58
|
-
let previousElement = element;
|
59
|
-
|
60
|
-
const checkParent = ({ parentElement }: HTMLElement) => {
|
61
|
-
if (!parentElement) return;
|
62
|
-
|
63
|
-
if (isVisible(parentElement)) return;
|
64
|
-
|
65
|
-
previousElement = parentElement;
|
66
|
-
checkParent(parentElement);
|
67
|
-
};
|
68
|
-
|
69
|
-
checkParent(element);
|
70
|
-
|
71
|
-
return previousElement;
|
72
|
-
};
|
73
|
-
|
74
|
-
/**
|
75
|
-
* Check if an element is scrollable
|
76
|
-
* @param element
|
77
|
-
* @returns True or false
|
78
|
-
*/
|
79
|
-
export const isScrollable = (element: Element): boolean => {
|
80
|
-
const { overflow } = getComputedStyle(element);
|
81
|
-
return overflow === 'auto' || overflow === 'scroll';
|
82
|
-
};
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { noop } from './guards';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Adds an event listener to an element.
|
5
|
-
* @returns A callback to remove the event listener from the element.
|
6
|
-
*
|
7
|
-
* @param target
|
8
|
-
* @param type
|
9
|
-
* @param listener
|
10
|
-
* @param options
|
11
|
-
*/
|
12
|
-
export function addListener<
|
13
|
-
TargetInterface extends EventTarget,
|
14
|
-
Type extends TargetInterface extends Window
|
15
|
-
? keyof WindowEventMap | string
|
16
|
-
: TargetInterface extends Document
|
17
|
-
? keyof DocumentEventMap | string
|
18
|
-
: TargetInterface extends HTMLElement
|
19
|
-
? keyof HTMLElementEventMap | string
|
20
|
-
: keyof ElementEventMap | string,
|
21
|
-
Listener extends Type extends keyof WindowEventMap
|
22
|
-
? (this: Document, ev: WindowEventMap[Type]) => unknown
|
23
|
-
: Type extends keyof DocumentEventMap
|
24
|
-
? (this: Document, ev: DocumentEventMap[Type]) => unknown
|
25
|
-
: Type extends keyof HTMLElementEventMap
|
26
|
-
? (this: HTMLElement, ev: HTMLElementEventMap[Type]) => unknown
|
27
|
-
: Type extends keyof ElementEventMap
|
28
|
-
? (this: Element, ev: ElementEventMap[Type]) => unknown
|
29
|
-
: EventListenerOrEventListenerObject,
|
30
|
-
>(
|
31
|
-
target: TargetInterface | TargetInterface[] | Set<TargetInterface> | null | undefined,
|
32
|
-
type: Type,
|
33
|
-
listener: Listener,
|
34
|
-
options?: boolean | AddEventListenerOptions
|
35
|
-
): () => void {
|
36
|
-
if (!target) return noop;
|
37
|
-
|
38
|
-
const targets = Array.isArray(target) ? target : target instanceof Set ? [...target] : [target];
|
39
|
-
|
40
|
-
targets.forEach((target) => target.addEventListener(type, listener, options));
|
41
|
-
|
42
|
-
return () => targets.forEach((target) => target.removeEventListener(type, listener, options));
|
43
|
-
}
|
44
|
-
|
45
|
-
type AllowedEvent = keyof DocumentEventMap | 'w-close';
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Dispatches a custom event that bubbles from the target.
|
49
|
-
* @param target The element where the event will originate.
|
50
|
-
* @param events The event name or an array of event names.
|
51
|
-
* @returns True if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
|
52
|
-
*/
|
53
|
-
export const simulateEvent = (target: EventTarget, events: AllowedEvent | Array<AllowedEvent>): boolean => {
|
54
|
-
if (!Array.isArray(events)) events = [events];
|
55
|
-
|
56
|
-
const eventsSuccess = events.map((event) => target.dispatchEvent(new Event(event, { bubbles: true })));
|
57
|
-
|
58
|
-
return eventsSuccess.every((success) => success);
|
59
|
-
};
|
@@ -1,217 +0,0 @@
|
|
1
|
-
import { getPublishDate, getSiteId } from './webflow';
|
2
|
-
|
3
|
-
const DB_OBJECT_STORE_NAME = 'pages';
|
4
|
-
|
5
|
-
const memoryCache = new Map<string, Promise<string>>();
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Fetches and parses an external page.
|
9
|
-
* Stores the page response in an {@link IDBDatabase} if the page belongs to the same site.
|
10
|
-
*
|
11
|
-
* @param source The URL of the page.
|
12
|
-
*
|
13
|
-
* @param params.cache Whether to cache fetched documents. Defaults to `true`.
|
14
|
-
*
|
15
|
-
* @param params.cacheExternal Whether to cache external documents.
|
16
|
-
* If set to true, it will follow a [stale-while-revalidate](https://web.dev/stale-while-revalidate/) strategy.
|
17
|
-
*
|
18
|
-
* @param params.cacheKey Defines a manual database name for the IndexedDB instance.
|
19
|
-
* @param params.cacheVersion Defines a manual version for the IndexedDB instance.
|
20
|
-
*
|
21
|
-
* @returns The page's {@link Document} if successful, `null` otherwise.
|
22
|
-
*/
|
23
|
-
export const fetchPageDocument = async (
|
24
|
-
source: string | URL,
|
25
|
-
{
|
26
|
-
cache = true,
|
27
|
-
cacheExternal,
|
28
|
-
cacheKey,
|
29
|
-
cacheVersion,
|
30
|
-
}: { cache?: boolean; cacheExternal?: boolean; cacheKey?: string; cacheVersion?: number } = {}
|
31
|
-
): Promise<Document | null> => {
|
32
|
-
try {
|
33
|
-
const url = new URL(source, window.location.origin);
|
34
|
-
|
35
|
-
// If the same page is being fetched simultaneously, return it from the memory cache.
|
36
|
-
const pageFromMemory = await getPageFromMemory(url);
|
37
|
-
if (pageFromMemory) return pageFromMemory;
|
38
|
-
|
39
|
-
// Try to create a DB instance.
|
40
|
-
const siteId = getSiteId();
|
41
|
-
const publishDate = getPublishDate();
|
42
|
-
|
43
|
-
const dbName = siteId || cacheKey;
|
44
|
-
const dbVersion = publishDate?.getTime() ?? cacheVersion ?? 1;
|
45
|
-
const db = dbName ? await createCacheDB(dbName, dbVersion) : null;
|
46
|
-
|
47
|
-
// If no caching enabled or no DB created, fetch the page and store it in the memory cache.
|
48
|
-
if (!cache || !db) {
|
49
|
-
const { page } = await fetchAndCachePageInMemory(url);
|
50
|
-
return page;
|
51
|
-
}
|
52
|
-
|
53
|
-
// If the page is in the DB, return it from there.
|
54
|
-
const rawPageFromDB = await getRawPageFromDB(db, url.href);
|
55
|
-
if (rawPageFromDB) {
|
56
|
-
const page = parseRawPage(rawPageFromDB);
|
57
|
-
|
58
|
-
// Cached external documents are considered stale,
|
59
|
-
// so in the background we refetch the page and store it to the DB again.
|
60
|
-
if (cacheExternal && !isPageSameSite(page, siteId)) {
|
61
|
-
fetchAndCachePageInDB(db, url, siteId, cacheExternal);
|
62
|
-
}
|
63
|
-
|
64
|
-
return page;
|
65
|
-
}
|
66
|
-
|
67
|
-
// If the page is not in the DB, fetch it and store it in the DB.
|
68
|
-
const page = await fetchAndCachePageInDB(db, url, siteId, cacheExternal);
|
69
|
-
return page;
|
70
|
-
} catch {
|
71
|
-
return null;
|
72
|
-
}
|
73
|
-
};
|
74
|
-
|
75
|
-
/**
|
76
|
-
* @returns A page from the memory cache, if existing.
|
77
|
-
* @param url The URL of the page.
|
78
|
-
*/
|
79
|
-
const getPageFromMemory = async (url: URL) => {
|
80
|
-
const rawPagePromise = await memoryCache.get(url.href);
|
81
|
-
if (rawPagePromise) {
|
82
|
-
return parseRawPage(rawPagePromise);
|
83
|
-
}
|
84
|
-
};
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Fetches a page and stores it in memory.
|
88
|
-
* @param url The URL of the page.
|
89
|
-
* @returns The page's {@link Document} and raw HTML text.
|
90
|
-
*/
|
91
|
-
const fetchAndCachePageInMemory = async (url: URL) => {
|
92
|
-
const rawPagePromise = fetch(url.href).then((response) => response.text());
|
93
|
-
|
94
|
-
memoryCache.set(url.href, rawPagePromise);
|
95
|
-
|
96
|
-
const rawPage = await rawPagePromise;
|
97
|
-
const page = parseRawPage(rawPage);
|
98
|
-
return { page, rawPage };
|
99
|
-
};
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Fetches a page and stores it in a {@link IDBDatabase}.
|
103
|
-
* @param db The DB instance.
|
104
|
-
* @param url The URL of the page.
|
105
|
-
* @param siteId The current site ID.
|
106
|
-
* @param cacheExternal Whether to cache external documents.
|
107
|
-
* @returns The page's {@link Document}.
|
108
|
-
*/
|
109
|
-
const fetchAndCachePageInDB = async (db: IDBDatabase, url: URL, siteId: string | null, cacheExternal?: boolean) => {
|
110
|
-
const { page, rawPage } = await fetchAndCachePageInMemory(url);
|
111
|
-
|
112
|
-
const isSameSite = isPageSameSite(page, siteId);
|
113
|
-
|
114
|
-
// If it can't be cached, just return the page.
|
115
|
-
if (!isSameSite && !cacheExternal) return page;
|
116
|
-
|
117
|
-
// Otherwise store it in the DB
|
118
|
-
await storeRawPageInDB(db, url.href, rawPage);
|
119
|
-
|
120
|
-
// If the page belongs to the same site, we can remove it from the memory cache as it's already in the DB.
|
121
|
-
// If the page is external, we want to keep it in memory to avoid refetching it, as in every request is considered stale.
|
122
|
-
if (isSameSite) {
|
123
|
-
memoryCache.delete(url.href);
|
124
|
-
}
|
125
|
-
|
126
|
-
return page;
|
127
|
-
};
|
128
|
-
|
129
|
-
/**
|
130
|
-
* Checks if a fetched page document is from the same Webflow site as the current page.
|
131
|
-
* @param page The fetched page document.
|
132
|
-
* @param siteId The current site ID.
|
133
|
-
*/
|
134
|
-
const isPageSameSite = (page: Document, siteId: string | null) => {
|
135
|
-
if (!siteId) return false;
|
136
|
-
|
137
|
-
const pageSiteId = getSiteId(page);
|
138
|
-
return pageSiteId && pageSiteId === siteId;
|
139
|
-
};
|
140
|
-
|
141
|
-
/**
|
142
|
-
* Parses a raw page's HTML text into a {@link Document}.
|
143
|
-
* @param rawPage
|
144
|
-
*/
|
145
|
-
const parseRawPage = (rawPage: string) => new DOMParser().parseFromString(rawPage, 'text/html');
|
146
|
-
|
147
|
-
/**
|
148
|
-
* Creates a DB instance.
|
149
|
-
* @param dbName The DB name.
|
150
|
-
* @param dbVersion The DB version.
|
151
|
-
* @returns An {@link IDBDatabase} instance.
|
152
|
-
*/
|
153
|
-
const createCacheDB = (dbName: string, dbVersion: number) => {
|
154
|
-
return new Promise<IDBDatabase | null>((resolve) => {
|
155
|
-
try {
|
156
|
-
const dbOpenRequest = window.indexedDB.open(dbName, dbVersion);
|
157
|
-
|
158
|
-
dbOpenRequest.onblocked = () => {
|
159
|
-
resolve(null);
|
160
|
-
};
|
161
|
-
|
162
|
-
dbOpenRequest.onupgradeneeded = () => {
|
163
|
-
const db = dbOpenRequest.result;
|
164
|
-
|
165
|
-
if (db.objectStoreNames.contains(DB_OBJECT_STORE_NAME)) {
|
166
|
-
db.deleteObjectStore(DB_OBJECT_STORE_NAME);
|
167
|
-
}
|
168
|
-
|
169
|
-
db.createObjectStore(DB_OBJECT_STORE_NAME);
|
170
|
-
};
|
171
|
-
|
172
|
-
dbOpenRequest.onerror = () => resolve(null);
|
173
|
-
dbOpenRequest.onsuccess = () => {
|
174
|
-
const db = dbOpenRequest.result;
|
175
|
-
|
176
|
-
db.onversionchange = () => db.close();
|
177
|
-
|
178
|
-
resolve(db);
|
179
|
-
};
|
180
|
-
} catch {
|
181
|
-
resolve(null);
|
182
|
-
}
|
183
|
-
});
|
184
|
-
};
|
185
|
-
|
186
|
-
/**
|
187
|
-
* Gets a page from the DB.
|
188
|
-
* @param db
|
189
|
-
* @param href
|
190
|
-
*/
|
191
|
-
const getRawPageFromDB = async (db: IDBDatabase, href: string) => {
|
192
|
-
return new Promise<string | null>((resolve) => {
|
193
|
-
const transaction = db.transaction(DB_OBJECT_STORE_NAME);
|
194
|
-
const objectStore = transaction.objectStore(DB_OBJECT_STORE_NAME);
|
195
|
-
const request = objectStore.get(href);
|
196
|
-
|
197
|
-
request.onerror = () => resolve(null);
|
198
|
-
request.onsuccess = () => resolve(request.result);
|
199
|
-
});
|
200
|
-
};
|
201
|
-
|
202
|
-
/**
|
203
|
-
* Stores a page in the DB.
|
204
|
-
* @param db
|
205
|
-
* @param href
|
206
|
-
* @param rawPage
|
207
|
-
*/
|
208
|
-
const storeRawPageInDB = async (db: IDBDatabase, href: string, rawPage: string) => {
|
209
|
-
return new Promise<void>((resolve) => {
|
210
|
-
const transaction = db.transaction(DB_OBJECT_STORE_NAME, 'readwrite');
|
211
|
-
const objectStore = transaction.objectStore(DB_OBJECT_STORE_NAME);
|
212
|
-
const request = objectStore.put(rawPage, href);
|
213
|
-
|
214
|
-
request.onerror = () => resolve();
|
215
|
-
request.onsuccess = () => resolve();
|
216
|
-
});
|
217
|
-
};
|
@@ -1,238 +0,0 @@
|
|
1
|
-
import { FORM_CSS_CLASSES } from '../constants';
|
2
|
-
import type { FormField, FormFieldType } from '../types';
|
3
|
-
import { simulateEvent } from './events';
|
4
|
-
import { isBoolean, isHTMLInputElement, isHTMLSelectElement, isNotEmpty } from './guards';
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Gets the value of a given form field.
|
8
|
-
* @param formField A {@link FormField} element.
|
9
|
-
* @param customValueAttribute Optional custom value attribute used to identify checkboxes and radios.
|
10
|
-
*/
|
11
|
-
export const getFormFieldValue = (formField: FormField, customValueAttribute?: string): string | string[] => {
|
12
|
-
const type = formField.type as FormFieldType;
|
13
|
-
|
14
|
-
let value: string | string[];
|
15
|
-
|
16
|
-
switch (type) {
|
17
|
-
// Checkbox
|
18
|
-
case 'checkbox': {
|
19
|
-
// Group
|
20
|
-
const groupCheckboxes = getCheckboxGroup(formField.name, formField.form, customValueAttribute);
|
21
|
-
if (groupCheckboxes?.length) {
|
22
|
-
value = [];
|
23
|
-
|
24
|
-
for (const checkbox of groupCheckboxes) {
|
25
|
-
const checkboxValue = customValueAttribute
|
26
|
-
? (checkbox.getAttribute(customValueAttribute) ?? checkbox.value)
|
27
|
-
: checkbox.value;
|
28
|
-
|
29
|
-
if (!checkboxValue || !checkbox.checked) continue;
|
30
|
-
|
31
|
-
value.push(checkboxValue);
|
32
|
-
}
|
33
|
-
|
34
|
-
break;
|
35
|
-
}
|
36
|
-
|
37
|
-
// Single
|
38
|
-
const { checked } = formField as HTMLInputElement;
|
39
|
-
value = checked ? 'true' : '';
|
40
|
-
|
41
|
-
break;
|
42
|
-
}
|
43
|
-
|
44
|
-
// Radio
|
45
|
-
case 'radio': {
|
46
|
-
const checkedRadio = formField.form?.querySelector<HTMLInputElement>(
|
47
|
-
`input[name="${formField.name}"][type="radio"]:checked`
|
48
|
-
);
|
49
|
-
|
50
|
-
value = checkedRadio
|
51
|
-
? customValueAttribute
|
52
|
-
? (checkedRadio.getAttribute(customValueAttribute) ?? checkedRadio.value)
|
53
|
-
: checkedRadio.value
|
54
|
-
: '';
|
55
|
-
|
56
|
-
break;
|
57
|
-
}
|
58
|
-
|
59
|
-
// Select multiple
|
60
|
-
case 'select-multiple': {
|
61
|
-
value = [...(formField as HTMLSelectElement).selectedOptions].map((option) => option.value).filter(Boolean);
|
62
|
-
|
63
|
-
break;
|
64
|
-
}
|
65
|
-
|
66
|
-
// Dates
|
67
|
-
case 'date':
|
68
|
-
case 'month':
|
69
|
-
case 'week':
|
70
|
-
case 'time': {
|
71
|
-
const { valueAsDate, value: _value } = formField as HTMLInputElement;
|
72
|
-
value = valueAsDate ? valueAsDate.toISOString() : _value;
|
73
|
-
|
74
|
-
break;
|
75
|
-
}
|
76
|
-
|
77
|
-
// Default - Text
|
78
|
-
default: {
|
79
|
-
value = formField.value;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
return value;
|
84
|
-
};
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Sets a value to a FormField element and emits `click`, `input` and `change` Events.
|
88
|
-
*
|
89
|
-
* @param element The FormField to update.
|
90
|
-
* @param value `boolean` for Checkboxes and Radios, `string` for the rest.
|
91
|
-
*/
|
92
|
-
export const setFormFieldValue = (
|
93
|
-
formField: FormField,
|
94
|
-
value: string | boolean | string[],
|
95
|
-
customValueAttribute?: string
|
96
|
-
): void => {
|
97
|
-
const type = formField.type as FormFieldType;
|
98
|
-
|
99
|
-
switch (type) {
|
100
|
-
// Checkboxes
|
101
|
-
case 'checkbox': {
|
102
|
-
if (!isHTMLInputElement(formField)) break;
|
103
|
-
|
104
|
-
// Single checkbox
|
105
|
-
if (!Array.isArray(value)) {
|
106
|
-
const check = isBoolean(value) ? value : value === 'true';
|
107
|
-
|
108
|
-
if (check !== formField.checked) {
|
109
|
-
formField.checked = check;
|
110
|
-
|
111
|
-
simulateEvent(formField, ['click', 'input', 'change']);
|
112
|
-
}
|
113
|
-
|
114
|
-
break;
|
115
|
-
}
|
116
|
-
|
117
|
-
const groupCheckboxes = getCheckboxGroup(formField.name, formField.form, customValueAttribute);
|
118
|
-
if (!groupCheckboxes?.length) break;
|
119
|
-
|
120
|
-
for (const checkbox of groupCheckboxes) {
|
121
|
-
const checkboxValue = customValueAttribute
|
122
|
-
? (checkbox.getAttribute(customValueAttribute) ?? checkbox.value)
|
123
|
-
: checkbox.value;
|
124
|
-
|
125
|
-
const check = value.includes(checkboxValue);
|
126
|
-
|
127
|
-
if (check !== checkbox.checked) {
|
128
|
-
checkbox.checked = check;
|
129
|
-
|
130
|
-
simulateEvent(checkbox, ['click', 'input', 'change']);
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
break;
|
135
|
-
}
|
136
|
-
|
137
|
-
// Radios
|
138
|
-
case 'radio': {
|
139
|
-
if (Array.isArray(value)) break;
|
140
|
-
|
141
|
-
const groupRadios = getRadioGroupInputs(formField);
|
142
|
-
|
143
|
-
for (const radio of groupRadios) {
|
144
|
-
const radioValue = customValueAttribute
|
145
|
-
? (radio.getAttribute(customValueAttribute) ?? radio.value)
|
146
|
-
: radio.value;
|
147
|
-
|
148
|
-
const check = radioValue === value;
|
149
|
-
|
150
|
-
if (check !== radio.checked) {
|
151
|
-
radio.checked = check;
|
152
|
-
|
153
|
-
simulateEvent(radio, ['click', 'input', 'change']);
|
154
|
-
|
155
|
-
if (check) continue;
|
156
|
-
|
157
|
-
// When unchecking a custom Webflow radio, we need to manually remove the focus and checked classes
|
158
|
-
const customRadio = radio.parentElement?.querySelector(`.${FORM_CSS_CLASSES.radioInput}`);
|
159
|
-
if (!customRadio) continue;
|
160
|
-
|
161
|
-
customRadio.classList.remove(FORM_CSS_CLASSES.checkboxOrRadioFocus, FORM_CSS_CLASSES.checkboxOrRadioChecked);
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
break;
|
166
|
-
}
|
167
|
-
|
168
|
-
// Select-multiple
|
169
|
-
case 'select-multiple': {
|
170
|
-
if (!Array.isArray(value) || !isHTMLSelectElement(formField)) break;
|
171
|
-
|
172
|
-
for (const option of formField.options) {
|
173
|
-
const select = value.includes(option.value);
|
174
|
-
|
175
|
-
if (select !== option.selected) {
|
176
|
-
option.selected = select;
|
177
|
-
|
178
|
-
simulateEvent(option, ['input', 'change']);
|
179
|
-
}
|
180
|
-
}
|
181
|
-
|
182
|
-
break;
|
183
|
-
}
|
184
|
-
|
185
|
-
// Other
|
186
|
-
default: {
|
187
|
-
if (Array.isArray(value)) break;
|
188
|
-
|
189
|
-
if (formField.value !== value) {
|
190
|
-
formField.value = value.toString();
|
191
|
-
|
192
|
-
simulateEvent(formField, ['input', 'change']);
|
193
|
-
}
|
194
|
-
}
|
195
|
-
}
|
196
|
-
};
|
197
|
-
|
198
|
-
/**
|
199
|
-
* Retrieves all radio inputs that belong to the same group.
|
200
|
-
* @param radio A radio input element that belongs to the group.
|
201
|
-
* @param form The form element that contains the radio inputs. If not provided, it will be inferred from the radio input.
|
202
|
-
* @returns An array of radio inputs.
|
203
|
-
*/
|
204
|
-
export const getRadioGroupInputs = (radio: FormField): HTMLInputElement[] => {
|
205
|
-
if (!radio.form) return [];
|
206
|
-
|
207
|
-
return [...radio.form.querySelectorAll<HTMLInputElement>(`input[name="${radio.name}"][type="${radio.type}"]`)];
|
208
|
-
};
|
209
|
-
|
210
|
-
/**
|
211
|
-
* @returns All the checkboxes in a group.
|
212
|
-
* @param name The name of the group.
|
213
|
-
* @param form The form element containing the group.
|
214
|
-
* @param customValueAttribute Optional custom value attribute used to identify checkboxes.
|
215
|
-
*/
|
216
|
-
export const getCheckboxGroup = (name: string, form: HTMLFormElement | null, customValueAttribute?: string) => {
|
217
|
-
const groupSelector = [
|
218
|
-
`input[name="${name}"][type="checkbox"][value]`,
|
219
|
-
customValueAttribute && `input[name="${name}"][type="checkbox"][${customValueAttribute}]`,
|
220
|
-
]
|
221
|
-
.filter(isNotEmpty)
|
222
|
-
.join(',');
|
223
|
-
|
224
|
-
const groupCheckboxes = form?.querySelectorAll<HTMLInputElement>(groupSelector);
|
225
|
-
return groupCheckboxes;
|
226
|
-
};
|
227
|
-
|
228
|
-
/**
|
229
|
-
* Gets the wrapper element for a given form field.
|
230
|
-
* @param formField The FormField element to get the wrapper for.
|
231
|
-
* @returns The closest wrapper element or the formField itself if no wrapper is found.
|
232
|
-
*/
|
233
|
-
export const getFormFieldWrapper = (formField: FormField) => {
|
234
|
-
const wrapper = formField.closest<HTMLElement>(
|
235
|
-
`.${FORM_CSS_CLASSES.checkboxField}, .${FORM_CSS_CLASSES.radioField}, label`
|
236
|
-
);
|
237
|
-
return wrapper || formField;
|
238
|
-
};
|