@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,60 +0,0 @@
|
|
1
|
-
# `inject` Attribute
|
2
|
-
|
3
|
-
Import components from any internal or external Webflow project.
|
4
|
-
|
5
|
-
## Getting Started
|
6
|
-
|
7
|
-
Please follow the documentation at [finsweet.com/attributes](https://www.finsweet.com/attributes) to learn how to use Attributes in your Webflow projects.
|
8
|
-
|
9
|
-
## Accessing the API
|
10
|
-
|
11
|
-
To learn how to access the API, please check the general [API Reference](../attributes/README.md#api-reference) documentation:
|
12
|
-
|
13
|
-
```javascript
|
14
|
-
window.FinsweetAttributes ||= [];
|
15
|
-
window.FinsweetAttributes.push([
|
16
|
-
'inject',
|
17
|
-
(componentsData) => {
|
18
|
-
// Your code goes here.
|
19
|
-
},
|
20
|
-
]);
|
21
|
-
```
|
22
|
-
|
23
|
-
The `result` object contains the [ComponentData](#the-componentdata-object) instances that are currently active on the page.
|
24
|
-
|
25
|
-
## The `ComponentData` object
|
26
|
-
|
27
|
-
```typescript
|
28
|
-
type ComponentData = ComponentTargetData & {
|
29
|
-
component: HTMLElement; // The component element
|
30
|
-
target: HTMLElement; // The target element where the component is injected
|
31
|
-
shadowRoot?: ShadowRoot; // The shadow root of the component, if external CSS was injected
|
32
|
-
instance: string | null; // The instance ID of the component
|
33
|
-
source?: URL; // The source URL of the component
|
34
|
-
proxiedSource?: URL; // The proxied source URL of the component, if a proxy is defined
|
35
|
-
loadCSS: boolean; // Whether to load CSS for the component
|
36
|
-
autoRender: boolean; // Whether to automatically render the component
|
37
|
-
resetIx: boolean; // Whether to reset IX2 interactions after injecting the component
|
38
|
-
positions: number[]; // The positions of the component in the target element
|
39
|
-
};
|
40
|
-
```
|
41
|
-
|
42
|
-
## How to programmatically render a component
|
43
|
-
|
44
|
-
If the `fs-inject-render="false"` attribute is set, the component will not be rendered automatically. You can render it programmatically by accessing it via the `ComponentData` object.
|
45
|
-
|
46
|
-
```javascript
|
47
|
-
window.FinsweetAttributes ||= [];
|
48
|
-
window.FinsweetAttributes.push([
|
49
|
-
'inject',
|
50
|
-
(componentsData) => {
|
51
|
-
const { component, target } = componentsData[0];
|
52
|
-
|
53
|
-
target.append(component);
|
54
|
-
},
|
55
|
-
]);
|
56
|
-
```
|
57
|
-
|
58
|
-
## License
|
59
|
-
|
60
|
-
[Apache 2.0](../../LICENSE.md)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@finsweet/attributes-inject",
|
3
|
-
"version": "2.4.0",
|
4
|
-
"description": "Import components from any internal or external Webflow project.",
|
5
|
-
"private": true,
|
6
|
-
"type": "module",
|
7
|
-
"types": "src/index.ts",
|
8
|
-
"scripts": {
|
9
|
-
"lint": "eslint ./src && prettier --check ./src",
|
10
|
-
"lint:fix": "eslint ./src --fix && prettier --write ./src",
|
11
|
-
"check": "tsc --noEmit"
|
12
|
-
},
|
13
|
-
"exports": {
|
14
|
-
".": {
|
15
|
-
"types": "./src/index.ts",
|
16
|
-
"import": "./src/index.ts"
|
17
|
-
}
|
18
|
-
},
|
19
|
-
"dependencies": {
|
20
|
-
"@finsweet/attributes-utils": "workspace:*"
|
21
|
-
}
|
22
|
-
}
|
@@ -1,125 +0,0 @@
|
|
1
|
-
import { extractCommaSeparatedValues, isNotEmpty, RICH_TEXT_BLOCK_CSS_CLASS } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import { getAttribute, getInstance, hasAttributeValue, queryAllElements } from '../utils/selectors';
|
4
|
-
import type { ComponentTargetData } from '../utils/types';
|
5
|
-
|
6
|
-
const RICHTEXT_COMPONENT_REGEX = /\{\{([^=}"]+)(?:="([^"]*)")?\}\}/;
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Collects the component targets.
|
10
|
-
*/
|
11
|
-
export const collectComponentTargetsData = () => {
|
12
|
-
const targetElements = queryAllElements('target');
|
13
|
-
|
14
|
-
const targetsData = targetElements.map((target) => collectComponentTargetData(target)).filter(isNotEmpty);
|
15
|
-
|
16
|
-
const richTextBlocks = document.querySelectorAll(`.${RICH_TEXT_BLOCK_CSS_CLASS}`);
|
17
|
-
|
18
|
-
for (const rtb of richTextBlocks) {
|
19
|
-
const children = [...rtb.querySelectorAll('*')];
|
20
|
-
|
21
|
-
for (const child of children) {
|
22
|
-
const match = child.innerHTML.match(RICHTEXT_COMPONENT_REGEX);
|
23
|
-
if (!match) continue;
|
24
|
-
if (targetsData.some((data) => data.target === child)) continue;
|
25
|
-
|
26
|
-
const targetData = collectComponentTargetData(child, match[1], match[2], true);
|
27
|
-
if (!targetData) continue;
|
28
|
-
|
29
|
-
targetsData.push(targetData);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
return targetsData;
|
34
|
-
};
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Collects a component target data.
|
38
|
-
* @param target
|
39
|
-
* @param instance
|
40
|
-
* @param rawSource
|
41
|
-
* @returns The component target data.
|
42
|
-
*/
|
43
|
-
const collectComponentTargetData = (
|
44
|
-
target: Element,
|
45
|
-
instance?: string | null,
|
46
|
-
rawSource?: string,
|
47
|
-
replace?: boolean
|
48
|
-
): ComponentTargetData | undefined => {
|
49
|
-
instance ||= getInstance(target);
|
50
|
-
rawSource ||= getAttribute(target, 'source');
|
51
|
-
|
52
|
-
const proxy = getAttribute(null, 'proxy');
|
53
|
-
const rawPosition = getAttribute(target, 'position');
|
54
|
-
const noCSS = hasAttributeValue(target, 'css', 'false');
|
55
|
-
const autoRender = hasAttributeValue(target, 'render', 'true');
|
56
|
-
const resetIx = hasAttributeValue(target, 'resetix', 'true');
|
57
|
-
|
58
|
-
const positions = rawPosition ? extractCommaSeparatedValues(rawPosition).map(getPosition) : [0.5];
|
59
|
-
|
60
|
-
let source: URL | undefined;
|
61
|
-
let proxiedSource: URL | undefined;
|
62
|
-
|
63
|
-
if (rawSource) {
|
64
|
-
try {
|
65
|
-
source = new URL(rawSource, window.location.origin);
|
66
|
-
|
67
|
-
// If source is external, prefix it with the proxy if provided
|
68
|
-
if (source.origin !== window.location.origin && proxy) {
|
69
|
-
proxiedSource = new URL(proxy + source.href);
|
70
|
-
}
|
71
|
-
} catch {
|
72
|
-
// Source is invalid
|
73
|
-
return;
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
return { target, instance, source, proxiedSource, noCSS, autoRender, resetIx, positions, replace };
|
78
|
-
};
|
79
|
-
|
80
|
-
/**
|
81
|
-
* @param rawPosition
|
82
|
-
* @returns The position of a component inside the target, as a number between 0 and 1.
|
83
|
-
*/
|
84
|
-
const getPosition = (rawPosition: string) => {
|
85
|
-
switch (rawPosition) {
|
86
|
-
case 'first':
|
87
|
-
case 'start': {
|
88
|
-
return 0;
|
89
|
-
}
|
90
|
-
|
91
|
-
case 'one-quarter': {
|
92
|
-
return 0.25;
|
93
|
-
}
|
94
|
-
|
95
|
-
case 'one-third': {
|
96
|
-
return 0.33;
|
97
|
-
}
|
98
|
-
|
99
|
-
case 'middle':
|
100
|
-
case 'center':
|
101
|
-
case 'half':
|
102
|
-
case 'one-half': {
|
103
|
-
return 0.5;
|
104
|
-
}
|
105
|
-
|
106
|
-
case 'two-thirds': {
|
107
|
-
return 0.66;
|
108
|
-
}
|
109
|
-
|
110
|
-
case 'three-quarters': {
|
111
|
-
return 0.75;
|
112
|
-
}
|
113
|
-
|
114
|
-
case 'end':
|
115
|
-
case 'last': {
|
116
|
-
return 1;
|
117
|
-
}
|
118
|
-
|
119
|
-
default: {
|
120
|
-
const position = parseFloat(rawPosition);
|
121
|
-
|
122
|
-
return isNaN(position) ? 0.5 : position / 100;
|
123
|
-
}
|
124
|
-
}
|
125
|
-
};
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { cloneNode } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Attaches the page styles to a Shadow DOM.
|
5
|
-
* @param shadowRoot The root of the Shadow DOM.
|
6
|
-
* @param source The source's page document.
|
7
|
-
* @returns A Promise that fulfills when all styles have been 100% loaded (with a 10s max timeout).
|
8
|
-
*/
|
9
|
-
export const attachPageStyles = async (shadowRoot: ShadowRoot, source: Document) => {
|
10
|
-
const styleTags = [...source.querySelectorAll('style, link[rel="stylesheet"]')];
|
11
|
-
|
12
|
-
return Promise.all(
|
13
|
-
styleTags.map(
|
14
|
-
(styleTag) =>
|
15
|
-
new Promise((resolve) => {
|
16
|
-
const clone = cloneNode(styleTag);
|
17
|
-
|
18
|
-
// Load styles
|
19
|
-
clone.addEventListener('load', () => resolve(undefined), { once: true });
|
20
|
-
shadowRoot.append(clone);
|
21
|
-
|
22
|
-
// Max 10s timeout
|
23
|
-
window.setTimeout(() => resolve(undefined), 10000);
|
24
|
-
})
|
25
|
-
)
|
26
|
-
);
|
27
|
-
};
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import { fetchPageDocument } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import { getAttribute } from '../utils/selectors';
|
4
|
-
import type { ComponentTargetData } from '../utils/types';
|
5
|
-
|
6
|
-
const componentsPages: Map<string, Promise<Document | null>> = new Map();
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Prefetches the pages of the components.
|
10
|
-
* This is a hack to work around all components being initted in parallel and not hitting the cache.
|
11
|
-
* The {@link fetchPageDocument} helper already caches the pages in memory and in an IndexedDB instance,
|
12
|
-
* but when initting all components in parallel, it doesn't have enough time to cache them
|
13
|
-
* before other components try to fetch the same resource.
|
14
|
-
* So with this trick we filter and prefetch all the pages before initting the components.
|
15
|
-
*
|
16
|
-
* @param componentsData
|
17
|
-
*/
|
18
|
-
export const prefetchComponentsPages = (componentTargetsData: ComponentTargetData[]) => {
|
19
|
-
const cache = getAttribute(null, 'cache') !== 'false';
|
20
|
-
const cacheKey = getAttribute(null, 'cachekey');
|
21
|
-
const cacheVersion = getAttribute(null, 'cacheversion') ?? 1;
|
22
|
-
|
23
|
-
for (const { proxiedSource, source } of componentTargetsData) {
|
24
|
-
const href = proxiedSource?.href || source?.href;
|
25
|
-
if (!href) continue;
|
26
|
-
|
27
|
-
if (componentsPages.has(href)) continue;
|
28
|
-
|
29
|
-
const promise = fetchPageDocument(href, {
|
30
|
-
cache,
|
31
|
-
cacheKey,
|
32
|
-
cacheExternal: cache,
|
33
|
-
cacheVersion,
|
34
|
-
});
|
35
|
-
|
36
|
-
componentsPages.set(href, promise);
|
37
|
-
}
|
38
|
-
};
|
39
|
-
|
40
|
-
/**
|
41
|
-
* @returns A prefetched component page.
|
42
|
-
* @param source The source URL of the component.
|
43
|
-
*/
|
44
|
-
export const getComponentPage = (source: URL) => componentsPages.get(source.href);
|
@@ -1,123 +0,0 @@
|
|
1
|
-
import { cloneNode, isNotEmpty, restartWebflow, RICH_TEXT_BLOCK_CSS_CLASS } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import { attachPageStyles } from './actions/css';
|
4
|
-
import { getComponentPage } from './actions/prefetch';
|
5
|
-
import { convertRelativeUrlsToAbsolute, isSameWebflowProject } from './utils/helpers';
|
6
|
-
import { queryAllElements } from './utils/selectors';
|
7
|
-
import type { ComponentData, ComponentTargetData } from './utils/types';
|
8
|
-
|
9
|
-
/**
|
10
|
-
* Inits the component targets.
|
11
|
-
* @param componentTargetsData
|
12
|
-
* @returns The components data.
|
13
|
-
*/
|
14
|
-
export const initComponents = async (componentTargetsData: ComponentTargetData[]): Promise<ComponentData[]> => {
|
15
|
-
const componentsData = (await Promise.all(componentTargetsData.map(initComponent))).filter(isNotEmpty).flat();
|
16
|
-
|
17
|
-
const shouldResetIx = componentsData.some(({ resetIx }) => resetIx);
|
18
|
-
if (shouldResetIx) {
|
19
|
-
await restartWebflow();
|
20
|
-
}
|
21
|
-
|
22
|
-
return componentsData;
|
23
|
-
};
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Inits the component target.
|
27
|
-
* @param componentTargetData
|
28
|
-
* @returns The component data.
|
29
|
-
*/
|
30
|
-
const initComponent = async (componentTargetData: ComponentTargetData): Promise<Array<ComponentData> | undefined> => {
|
31
|
-
const { target, instance, proxiedSource, source, noCSS, autoRender, positions } = componentTargetData;
|
32
|
-
|
33
|
-
const componentsSource = proxiedSource || source;
|
34
|
-
|
35
|
-
const page = componentsSource ? await getComponentPage(componentsSource) : document;
|
36
|
-
if (!page) return;
|
37
|
-
|
38
|
-
const components = [
|
39
|
-
...queryAllElements('component', { instance, scope: page }),
|
40
|
-
...queryAllElements('element', { instance, scope: page }),
|
41
|
-
].map((component) => cloneNode(component));
|
42
|
-
|
43
|
-
if (!components.length) return;
|
44
|
-
|
45
|
-
const targetChildren = [...target.children];
|
46
|
-
const isSamePage = page === document;
|
47
|
-
const isSameSite = isSameWebflowProject(page);
|
48
|
-
const isRTB = target.classList.contains(RICH_TEXT_BLOCK_CSS_CLASS);
|
49
|
-
|
50
|
-
const componentsToInject = isRTB ? components : [components[0]];
|
51
|
-
if (!componentsToInject.length) return;
|
52
|
-
|
53
|
-
return Promise.all(
|
54
|
-
components
|
55
|
-
.map<ComponentData | undefined>((component, index) => {
|
56
|
-
let shadowRoot: ShadowRoot | undefined;
|
57
|
-
let shadowRootWrapper: HTMLElement | undefined;
|
58
|
-
|
59
|
-
const render = (element: HTMLElement) => {
|
60
|
-
// Handle CSS
|
61
|
-
if (!isSamePage && !noCSS) {
|
62
|
-
shadowRootWrapper = document.createElement('div');
|
63
|
-
shadowRootWrapper.style.display = 'contents';
|
64
|
-
|
65
|
-
shadowRoot = shadowRootWrapper.attachShadow({ mode: 'open' });
|
66
|
-
|
67
|
-
attachPageStyles(shadowRoot, page).then(() => {
|
68
|
-
shadowRoot!.append(element);
|
69
|
-
});
|
70
|
-
}
|
71
|
-
|
72
|
-
const toRender = shadowRootWrapper || element;
|
73
|
-
|
74
|
-
// Rich Text Block component injection
|
75
|
-
if (isRTB) {
|
76
|
-
const position = positions[index] ?? 0.5;
|
77
|
-
|
78
|
-
let targetPosition = Math.round(targetChildren.length * position);
|
79
|
-
let referenceNode = targetChildren[targetPosition];
|
80
|
-
let previousNode = targetChildren[targetPosition - 1];
|
81
|
-
|
82
|
-
while (previousNode && /^h[1-6]$/i.test(previousNode.tagName)) {
|
83
|
-
targetPosition -= 1;
|
84
|
-
referenceNode = targetChildren[targetPosition];
|
85
|
-
previousNode = targetChildren[targetPosition - 1];
|
86
|
-
}
|
87
|
-
|
88
|
-
if (targetPosition < 0) {
|
89
|
-
target.prepend(toRender);
|
90
|
-
} else {
|
91
|
-
target.insertBefore(toRender, referenceNode || null);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
|
95
|
-
// Normal component injection
|
96
|
-
else {
|
97
|
-
if (componentTargetData.replace) {
|
98
|
-
target.replaceWith(toRender);
|
99
|
-
} else {
|
100
|
-
target.append(toRender);
|
101
|
-
}
|
102
|
-
}
|
103
|
-
};
|
104
|
-
|
105
|
-
// Convert relative URLs to absolute URLs
|
106
|
-
if (!isSameSite && source) {
|
107
|
-
convertRelativeUrlsToAbsolute(component, source);
|
108
|
-
}
|
109
|
-
|
110
|
-
// Render the component
|
111
|
-
if (autoRender) {
|
112
|
-
render(component);
|
113
|
-
}
|
114
|
-
|
115
|
-
return {
|
116
|
-
...componentTargetData,
|
117
|
-
shadowRoot,
|
118
|
-
component,
|
119
|
-
};
|
120
|
-
})
|
121
|
-
.filter(isNotEmpty)
|
122
|
-
);
|
123
|
-
};
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { type FinsweetAttributeInit, waitWebflowReady } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import { collectComponentTargetsData } from './actions/collect';
|
4
|
-
import { prefetchComponentsPages } from './actions/prefetch';
|
5
|
-
import { initComponents } from './factory';
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Inits the attribute.
|
9
|
-
*/
|
10
|
-
export const init: FinsweetAttributeInit = async () => {
|
11
|
-
await waitWebflowReady();
|
12
|
-
|
13
|
-
const componentTargetsData = collectComponentTargetsData();
|
14
|
-
|
15
|
-
prefetchComponentsPages(componentTargetsData);
|
16
|
-
|
17
|
-
const componentsData = await initComponents(componentTargetsData);
|
18
|
-
|
19
|
-
return {
|
20
|
-
result: componentsData,
|
21
|
-
};
|
22
|
-
};
|
@@ -1,89 +0,0 @@
|
|
1
|
-
import type { AttributeElements, AttributeSettings } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
export const ELEMENTS = [
|
4
|
-
/**
|
5
|
-
* Defines a target where to load the component.
|
6
|
-
*/
|
7
|
-
'target',
|
8
|
-
|
9
|
-
/**
|
10
|
-
* Defines a component to be loaded.
|
11
|
-
*/
|
12
|
-
'component',
|
13
|
-
'element', // Alias for component
|
14
|
-
] as const satisfies AttributeElements;
|
15
|
-
|
16
|
-
export const SETTINGS = {
|
17
|
-
/**
|
18
|
-
* Defines a component source.
|
19
|
-
*/
|
20
|
-
source: {
|
21
|
-
key: 'source',
|
22
|
-
},
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Defines a specific position of the component inside the target.
|
26
|
-
*/
|
27
|
-
position: { key: 'position' },
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Defines if the CSS of the component should be imported when the component is external.
|
31
|
-
* If the component is external and this setting is set to true,
|
32
|
-
* the component will be loaded with the CSS inside a Shadow DOM.
|
33
|
-
* Defaults to `true`.
|
34
|
-
*/
|
35
|
-
css: {
|
36
|
-
key: 'css',
|
37
|
-
values: ['false'],
|
38
|
-
},
|
39
|
-
|
40
|
-
/**
|
41
|
-
* Defines if the component should be automatically rendered after loading it.
|
42
|
-
* If set to false, the component will be loaded but not rendered,
|
43
|
-
* and it will be up to the developer to render it,
|
44
|
-
* accessing the node via `Webflow.push([`component`, (componentsData) => {}])`.
|
45
|
-
* Defaults to `true`.
|
46
|
-
*/
|
47
|
-
render: {
|
48
|
-
key: 'render',
|
49
|
-
values: ['true'],
|
50
|
-
defaultValue: 'true',
|
51
|
-
},
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Defines a CORS Proxy prefix.
|
55
|
-
*/
|
56
|
-
proxy: {
|
57
|
-
key: 'proxy',
|
58
|
-
},
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Defines if the component should be loaded from the cache.
|
62
|
-
* By default, the component will be loaded from the cache if available.
|
63
|
-
* If set to false, the component will never be loaded from the cache.
|
64
|
-
*/
|
65
|
-
cache: {
|
66
|
-
key: 'cache',
|
67
|
-
values: ['false'],
|
68
|
-
},
|
69
|
-
|
70
|
-
/**
|
71
|
-
* Defines a cache key for the fetched external components.
|
72
|
-
*/
|
73
|
-
cachekey: {
|
74
|
-
key: 'cachekey',
|
75
|
-
},
|
76
|
-
|
77
|
-
/**
|
78
|
-
* Defines a cache version for the fetched external components.
|
79
|
-
*/
|
80
|
-
cacheversion: {
|
81
|
-
key: 'cacheversion',
|
82
|
-
isNumeric: true,
|
83
|
-
},
|
84
|
-
|
85
|
-
/**
|
86
|
-
* Defines if Webflow should be restarted after rendering the loaded components.
|
87
|
-
*/
|
88
|
-
resetix: { key: 'resetix', values: ['true'] },
|
89
|
-
} as const satisfies AttributeSettings;
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { getSiteId } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Checks if an external page is from the same Webflow project.
|
5
|
-
* @param page
|
6
|
-
* @returns True if the page is from the same Webflow project, false otherwise.
|
7
|
-
*/
|
8
|
-
export const isSameWebflowProject = (page: Document) => {
|
9
|
-
const currentPageSiteId = getSiteId();
|
10
|
-
const fetchedPageSiteId = getSiteId(page);
|
11
|
-
|
12
|
-
if (!currentPageSiteId || !fetchedPageSiteId) return false;
|
13
|
-
|
14
|
-
return currentPageSiteId === fetchedPageSiteId;
|
15
|
-
};
|
16
|
-
|
17
|
-
/**
|
18
|
-
* Converts all the relative URLs in a component to absolute URLs using the current window's origin.
|
19
|
-
* @param component
|
20
|
-
* @param source
|
21
|
-
*/
|
22
|
-
export const convertRelativeUrlsToAbsolute = (component: HTMLElement, source: URL) => {
|
23
|
-
const links = component.querySelectorAll<HTMLAnchorElement>('a[href^="/"]');
|
24
|
-
|
25
|
-
for (const link of links) {
|
26
|
-
const href = link.getAttribute('href');
|
27
|
-
if (!href) continue;
|
28
|
-
|
29
|
-
try {
|
30
|
-
const url = new URL(href, source.origin);
|
31
|
-
link.href = url.toString();
|
32
|
-
} catch {
|
33
|
-
//
|
34
|
-
}
|
35
|
-
}
|
36
|
-
};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { generateSelectors, INJECT_ATTRIBUTE } from '@finsweet/attributes-utils';
|
2
|
-
|
3
|
-
import { ELEMENTS, SETTINGS } from './constants';
|
4
|
-
|
5
|
-
export const { getAttribute, hasAttributeValue, getInstance, queryAllElements, queryElement } = generateSelectors(
|
6
|
-
INJECT_ATTRIBUTE,
|
7
|
-
ELEMENTS,
|
8
|
-
SETTINGS
|
9
|
-
);
|
@@ -1,16 +0,0 @@
|
|
1
|
-
export type ComponentTargetData = {
|
2
|
-
target: Element;
|
3
|
-
instance: string | null;
|
4
|
-
source?: URL;
|
5
|
-
proxiedSource?: URL;
|
6
|
-
noCSS: boolean;
|
7
|
-
autoRender: boolean;
|
8
|
-
resetIx: boolean;
|
9
|
-
positions: number[];
|
10
|
-
replace?: boolean;
|
11
|
-
};
|
12
|
-
|
13
|
-
export type ComponentData = ComponentTargetData & {
|
14
|
-
component: HTMLElement;
|
15
|
-
shadowRoot?: ShadowRoot;
|
16
|
-
};
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# @finsweet/attributes-inputactive
|
2
|
-
|
3
|
-
## 1.0.7
|
4
|
-
|
5
|
-
### Patch Changes
|
6
|
-
|
7
|
-
- Updated dependencies [2af0bad]
|
8
|
-
- @finsweet/attributes-utils@0.1.0
|
9
|
-
|
10
|
-
## 1.0.6
|
11
|
-
|
12
|
-
### Patch Changes
|
13
|
-
|
14
|
-
- Updated dependencies [378d74d]
|
15
|
-
- @finsweet/attributes-utils@0.0.6
|
16
|
-
|
17
|
-
## 1.0.5
|
18
|
-
|
19
|
-
### Patch Changes
|
20
|
-
|
21
|
-
- Updated dependencies [01973d8]
|
22
|
-
- @finsweet/attributes-utils@0.0.5
|
23
|
-
|
24
|
-
## 1.0.4
|
25
|
-
|
26
|
-
### Patch Changes
|
27
|
-
|
28
|
-
- Updated dependencies [deef758]
|
29
|
-
- @finsweet/attributes-utils@0.0.4
|
30
|
-
|
31
|
-
## 1.0.3
|
32
|
-
|
33
|
-
### Patch Changes
|
34
|
-
|
35
|
-
- Updated dependencies [d21cbca]
|
36
|
-
- @finsweet/attributes-utils@0.0.3
|
37
|
-
|
38
|
-
## 1.0.2
|
39
|
-
|
40
|
-
### Patch Changes
|
41
|
-
|
42
|
-
- c7b544d: chore: updated dependencies
|
43
|
-
- Updated dependencies [c7b544d]
|
44
|
-
- @finsweet/attributes-utils@0.0.2
|
45
|
-
|
46
|
-
## 1.0.1
|
47
|
-
|
48
|
-
### Patch Changes
|
49
|
-
|
50
|
-
- b56e5e5: rename fsAttribute in places of usage to finsweetAttribute
|
51
|
-
- Updated dependencies [b56e5e5]
|
52
|
-
- @finsweet/attributes-utils@0.0.1
|
53
|
-
|
54
|
-
## 1.0.0
|
55
|
-
|
56
|
-
### Major Changes
|
57
|
-
|
58
|
-
- 489412f8: Created `fs-inputactive` Attribute.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# `inputactive` Attribute
|
2
|
-
|
3
|
-
Set custom active CSS classes for Webflow form elements.
|
4
|
-
|
5
|
-
## Getting Started
|
6
|
-
|
7
|
-
Please follow the documentation at [finsweet.com/attributes](https://www.finsweet.com/attributes) to learn how to use Attributes in your Webflow projects.
|
8
|
-
|
9
|
-
## Accessing the API
|
10
|
-
|
11
|
-
To learn how to access the API, please check the general [API Reference](../attributes/README.md#api-reference) documentation:
|
12
|
-
|
13
|
-
```javascript
|
14
|
-
window.FinsweetAttributes ||= [];
|
15
|
-
window.FinsweetAttributes.push([
|
16
|
-
'inputactive',
|
17
|
-
() => {
|
18
|
-
// Your code goes here.
|
19
|
-
},
|
20
|
-
]);
|
21
|
-
```
|
22
|
-
|
23
|
-
## License
|
24
|
-
|
25
|
-
[Apache 2.0](../../LICENSE.md)
|