@dropins/tools 0.21.2-alpha3 → 0.21.2-alpha389
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/event-bus.js +1 -49
- package/fetch-graphql.js +1 -62
- package/initializer.js +1 -64
- package/package.json +1 -1
- package/preact-compat.js +1 -93
- package/preact-hooks.js +1 -40
- package/preact-jsx-runtime.js +1 -35
- package/preact.js +1 -21
- package/runtime.js +1 -69
- package/components/Accordion/Accordion.d.ts +0 -25
- package/components/Accordion/Accordion.d.ts.map +0 -1
- package/components/Accordion/Accordion.jsx +0 -59
- package/components/Accordion/Accordion.stories.d.ts +0 -22
- package/components/Accordion/Accordion.stories.d.ts.map +0 -1
- package/components/Accordion/Accordion.stories.jsx +0 -320
- package/components/Accordion/Accordion.test.d.ts +0 -3
- package/components/Accordion/Accordion.test.d.ts.map +0 -1
- package/components/Accordion/Accordion.test.jsx +0 -79
- package/components/Accordion/index.d.ts +0 -3
- package/components/Accordion/index.d.ts.map +0 -1
- package/components/Accordion/index.js +0 -2
- package/components/ActionButton/ActionButton.d.ts +0 -11
- package/components/ActionButton/ActionButton.d.ts.map +0 -1
- package/components/ActionButton/ActionButton.jsx +0 -14
- package/components/ActionButton/ActionButton.stories.d.ts +0 -16
- package/components/ActionButton/ActionButton.stories.d.ts.map +0 -1
- package/components/ActionButton/ActionButton.stories.jsx +0 -119
- package/components/ActionButton/ActionButton.test.d.ts +0 -3
- package/components/ActionButton/ActionButton.test.d.ts.map +0 -1
- package/components/ActionButton/ActionButton.test.jsx +0 -47
- package/components/ActionButton/index.d.ts +0 -2
- package/components/ActionButton/index.d.ts.map +0 -1
- package/components/ActionButton/index.js +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.d.ts +0 -20
- package/components/ActionButtonGroup/ActionButtonGroup.d.ts.map +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.jsx +0 -39
- package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts +0 -16
- package/components/ActionButtonGroup/ActionButtonGroup.stories.d.ts.map +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.stories.jsx +0 -72
- package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts +0 -3
- package/components/ActionButtonGroup/ActionButtonGroup.test.d.ts.map +0 -1
- package/components/ActionButtonGroup/ActionButtonGroup.test.jsx +0 -78
- package/components/ActionButtonGroup/index.d.ts +0 -2
- package/components/ActionButtonGroup/index.d.ts.map +0 -1
- package/components/ActionButtonGroup/index.js +0 -1
- package/components/AlertBanner/AlertBanner.d.ts +0 -15
- package/components/AlertBanner/AlertBanner.d.ts.map +0 -1
- package/components/AlertBanner/AlertBanner.jsx +0 -30
- package/components/AlertBanner/AlertBanner.stories.d.ts +0 -17
- package/components/AlertBanner/AlertBanner.stories.d.ts.map +0 -1
- package/components/AlertBanner/AlertBanner.stories.jsx +0 -128
- package/components/AlertBanner/AlertBanner.test.d.ts +0 -3
- package/components/AlertBanner/AlertBanner.test.d.ts.map +0 -1
- package/components/AlertBanner/AlertBanner.test.jsx +0 -40
- package/components/AlertBanner/index.d.ts +0 -3
- package/components/AlertBanner/index.d.ts.map +0 -1
- package/components/AlertBanner/index.js +0 -2
- package/components/Breadcrumbs/Breadcrumbs.d.ts +0 -9
- package/components/Breadcrumbs/Breadcrumbs.d.ts.map +0 -1
- package/components/Breadcrumbs/Breadcrumbs.jsx +0 -26
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -15
- package/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +0 -1
- package/components/Breadcrumbs/Breadcrumbs.stories.jsx +0 -110
- package/components/Breadcrumbs/Breadcrumbs.test.d.ts +0 -3
- package/components/Breadcrumbs/Breadcrumbs.test.d.ts.map +0 -1
- package/components/Breadcrumbs/Breadcrumbs.test.jsx +0 -67
- package/components/Breadcrumbs/index.d.ts +0 -3
- package/components/Breadcrumbs/index.d.ts.map +0 -1
- package/components/Breadcrumbs/index.js +0 -2
- package/components/Button/Button.d.ts +0 -15
- package/components/Button/Button.d.ts.map +0 -1
- package/components/Button/Button.jsx +0 -59
- package/components/Button/Button.stories.d.ts +0 -135
- package/components/Button/Button.stories.d.ts.map +0 -1
- package/components/Button/Button.stories.jsx +0 -354
- package/components/Button/Button.test.d.ts +0 -2
- package/components/Button/Button.test.d.ts.map +0 -1
- package/components/Button/Button.test.jsx +0 -134
- package/components/Button/index.d.ts +0 -3
- package/components/Button/index.d.ts.map +0 -1
- package/components/Button/index.js +0 -2
- package/components/Card/Card.d.ts +0 -9
- package/components/Card/Card.d.ts.map +0 -1
- package/components/Card/Card.jsx +0 -7
- package/components/Card/Card.stories.d.ts +0 -16
- package/components/Card/Card.stories.d.ts.map +0 -1
- package/components/Card/Card.stories.jsx +0 -47
- package/components/Card/Card.test.d.ts +0 -3
- package/components/Card/Card.test.d.ts.map +0 -1
- package/components/Card/Card.test.jsx +0 -26
- package/components/Card/index.d.ts +0 -2
- package/components/Card/index.d.ts.map +0 -1
- package/components/Card/index.js +0 -1
- package/components/CartItem/CartItem.d.ts +0 -25
- package/components/CartItem/CartItem.d.ts.map +0 -1
- package/components/CartItem/CartItem.jsx +0 -124
- package/components/CartItem/CartItem.stories.d.ts +0 -54
- package/components/CartItem/CartItem.stories.d.ts.map +0 -1
- package/components/CartItem/CartItem.stories.jsx +0 -309
- package/components/CartItem/CartItem.test.d.ts +0 -3
- package/components/CartItem/CartItem.test.d.ts.map +0 -1
- package/components/CartItem/CartItem.test.jsx +0 -71
- package/components/CartItem/CartItemSkeleton.d.ts +0 -3
- package/components/CartItem/CartItemSkeleton.d.ts.map +0 -1
- package/components/CartItem/CartItemSkeleton.jsx +0 -25
- package/components/CartItem/CartItemSkeleton.test.d.ts +0 -3
- package/components/CartItem/CartItemSkeleton.test.d.ts.map +0 -1
- package/components/CartItem/CartItemSkeleton.test.jsx +0 -11
- package/components/CartItem/index.d.ts +0 -4
- package/components/CartItem/index.d.ts.map +0 -1
- package/components/CartItem/index.js +0 -3
- package/components/CartList/CartList.d.ts +0 -7
- package/components/CartList/CartList.d.ts.map +0 -1
- package/components/CartList/CartList.jsx +0 -14
- package/components/CartList/CartList.stories.d.ts +0 -17
- package/components/CartList/CartList.stories.d.ts.map +0 -1
- package/components/CartList/CartList.stories.jsx +0 -54
- package/components/CartList/CartList.test.d.ts +0 -3
- package/components/CartList/CartList.test.d.ts.map +0 -1
- package/components/CartList/CartList.test.jsx +0 -12
- package/components/CartList/index.d.ts +0 -3
- package/components/CartList/index.d.ts.map +0 -1
- package/components/CartList/index.js +0 -2
- package/components/Checkbox/Checkbox.d.ts +0 -13
- package/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/components/Checkbox/Checkbox.jsx +0 -51
- package/components/Checkbox/Checkbox.stories.d.ts +0 -22
- package/components/Checkbox/Checkbox.stories.d.ts.map +0 -1
- package/components/Checkbox/Checkbox.stories.jsx +0 -157
- package/components/Checkbox/Checkbox.test.d.ts +0 -3
- package/components/Checkbox/Checkbox.test.d.ts.map +0 -1
- package/components/Checkbox/Checkbox.test.jsx +0 -136
- package/components/Checkbox/index.d.ts +0 -2
- package/components/Checkbox/index.d.ts.map +0 -1
- package/components/Checkbox/index.js +0 -1
- package/components/ColorSwatch/ColorSwatch.d.ts +0 -20
- package/components/ColorSwatch/ColorSwatch.d.ts.map +0 -1
- package/components/ColorSwatch/ColorSwatch.jsx +0 -57
- package/components/ColorSwatch/ColorSwatch.stories.d.ts +0 -20
- package/components/ColorSwatch/ColorSwatch.stories.d.ts.map +0 -1
- package/components/ColorSwatch/ColorSwatch.stories.jsx +0 -206
- package/components/ColorSwatch/ColorSwatch.test.d.ts +0 -3
- package/components/ColorSwatch/ColorSwatch.test.d.ts.map +0 -1
- package/components/ColorSwatch/ColorSwatch.test.jsx +0 -87
- package/components/ColorSwatch/index.d.ts +0 -3
- package/components/ColorSwatch/index.d.ts.map +0 -1
- package/components/ColorSwatch/index.js +0 -2
- package/components/Divider/Divider.d.ts +0 -8
- package/components/Divider/Divider.d.ts.map +0 -1
- package/components/Divider/Divider.jsx +0 -9
- package/components/Divider/Divider.stories.d.ts +0 -11
- package/components/Divider/Divider.stories.d.ts.map +0 -1
- package/components/Divider/Divider.stories.jsx +0 -43
- package/components/Divider/Divider.test.d.ts +0 -2
- package/components/Divider/Divider.test.d.ts.map +0 -1
- package/components/Divider/Divider.test.jsx +0 -19
- package/components/Divider/index.d.ts +0 -3
- package/components/Divider/index.d.ts.map +0 -1
- package/components/Divider/index.js +0 -2
- package/components/Field/Field.d.ts +0 -14
- package/components/Field/Field.d.ts.map +0 -1
- package/components/Field/Field.jsx +0 -29
- package/components/Field/Field.stories.d.ts +0 -37
- package/components/Field/Field.stories.d.ts.map +0 -1
- package/components/Field/Field.stories.jsx +0 -174
- package/components/Field/Field.test.d.ts +0 -3
- package/components/Field/Field.test.d.ts.map +0 -1
- package/components/Field/Field.test.jsx +0 -91
- package/components/Field/index.d.ts +0 -2
- package/components/Field/index.d.ts.map +0 -1
- package/components/Field/index.js +0 -1
- package/components/Icon/Icon.d.ts +0 -11
- package/components/Icon/Icon.d.ts.map +0 -1
- package/components/Icon/Icon.jsx +0 -57
- package/components/Icon/Icon.stories.d.ts +0 -16
- package/components/Icon/Icon.stories.d.ts.map +0 -1
- package/components/Icon/Icon.stories.helpers.d.ts +0 -4
- package/components/Icon/Icon.stories.helpers.d.ts.map +0 -1
- package/components/Icon/Icon.stories.helpers.jsx +0 -7
- package/components/Icon/Icon.stories.jsx +0 -48
- package/components/Icon/Icon.test.d.ts +0 -3
- package/components/Icon/Icon.test.d.ts.map +0 -1
- package/components/Icon/Icon.test.jsx +0 -67
- package/components/Icon/index.d.ts +0 -2
- package/components/Icon/index.d.ts.map +0 -1
- package/components/Icon/index.js +0 -1
- package/components/IllustratedMessage/IllustratedMessage.d.ts +0 -13
- package/components/IllustratedMessage/IllustratedMessage.d.ts.map +0 -1
- package/components/IllustratedMessage/IllustratedMessage.jsx +0 -21
- package/components/IllustratedMessage/IllustratedMessage.stories.d.ts +0 -10
- package/components/IllustratedMessage/IllustratedMessage.stories.d.ts.map +0 -1
- package/components/IllustratedMessage/IllustratedMessage.stories.jsx +0 -90
- package/components/IllustratedMessage/IllustratedMessage.test.d.ts +0 -3
- package/components/IllustratedMessage/IllustratedMessage.test.d.ts.map +0 -1
- package/components/IllustratedMessage/IllustratedMessage.test.jsx +0 -42
- package/components/IllustratedMessage/index.d.ts +0 -3
- package/components/IllustratedMessage/index.d.ts.map +0 -1
- package/components/IllustratedMessage/index.js +0 -2
- package/components/Image/Image.d.ts +0 -11
- package/components/Image/Image.d.ts.map +0 -1
- package/components/Image/Image.jsx +0 -26
- package/components/Image/Image.stories.d.ts +0 -11
- package/components/Image/Image.stories.d.ts.map +0 -1
- package/components/Image/Image.stories.jsx +0 -66
- package/components/Image/Image.test.d.ts +0 -3
- package/components/Image/Image.test.d.ts.map +0 -1
- package/components/Image/Image.test.jsx +0 -82
- package/components/Image/index.d.ts +0 -2
- package/components/Image/index.d.ts.map +0 -1
- package/components/Image/index.js +0 -1
- package/components/ImageSwatch/ImageSwatch.d.ts +0 -20
- package/components/ImageSwatch/ImageSwatch.d.ts.map +0 -1
- package/components/ImageSwatch/ImageSwatch.jsx +0 -49
- package/components/ImageSwatch/ImageSwatch.stories.d.ts +0 -20
- package/components/ImageSwatch/ImageSwatch.stories.d.ts.map +0 -1
- package/components/ImageSwatch/ImageSwatch.stories.jsx +0 -206
- package/components/ImageSwatch/ImageSwatch.test.d.ts +0 -3
- package/components/ImageSwatch/ImageSwatch.test.d.ts.map +0 -1
- package/components/ImageSwatch/ImageSwatch.test.jsx +0 -64
- package/components/ImageSwatch/index.d.ts +0 -3
- package/components/ImageSwatch/index.d.ts.map +0 -1
- package/components/ImageSwatch/index.js +0 -2
- package/components/InLineAlert/InLineAlert.d.ts +0 -16
- package/components/InLineAlert/InLineAlert.d.ts.map +0 -1
- package/components/InLineAlert/InLineAlert.jsx +0 -38
- package/components/InLineAlert/InLineAlert.stories.d.ts +0 -86
- package/components/InLineAlert/InLineAlert.stories.d.ts.map +0 -1
- package/components/InLineAlert/InLineAlert.stories.jsx +0 -193
- package/components/InLineAlert/InLineAlert.test.d.ts +0 -3
- package/components/InLineAlert/InLineAlert.test.d.ts.map +0 -1
- package/components/InLineAlert/InLineAlert.test.jsx +0 -77
- package/components/InLineAlert/index.d.ts +0 -3
- package/components/InLineAlert/index.d.ts.map +0 -1
- package/components/InLineAlert/index.js +0 -2
- package/components/Incrementer/Incrementer.d.ts +0 -17
- package/components/Incrementer/Incrementer.d.ts.map +0 -1
- package/components/Incrementer/Incrementer.jsx +0 -87
- package/components/Incrementer/Incrementer.stories.d.ts +0 -10
- package/components/Incrementer/Incrementer.stories.d.ts.map +0 -1
- package/components/Incrementer/Incrementer.stories.jsx +0 -68
- package/components/Incrementer/Incrementer.test.d.ts +0 -3
- package/components/Incrementer/Incrementer.test.d.ts.map +0 -1
- package/components/Incrementer/Incrementer.test.jsx +0 -112
- package/components/Incrementer/index.d.ts +0 -2
- package/components/Incrementer/index.d.ts.map +0 -1
- package/components/Incrementer/index.js +0 -1
- package/components/Input/Input.d.ts +0 -19
- package/components/Input/Input.d.ts.map +0 -1
- package/components/Input/Input.jsx +0 -73
- package/components/Input/Input.stories.d.ts +0 -11
- package/components/Input/Input.stories.d.ts.map +0 -1
- package/components/Input/Input.stories.jsx +0 -115
- package/components/Input/Input.test.d.ts +0 -3
- package/components/Input/Input.test.d.ts.map +0 -1
- package/components/Input/Input.test.jsx +0 -111
- package/components/Input/index.d.ts +0 -3
- package/components/Input/index.d.ts.map +0 -1
- package/components/Input/index.js +0 -2
- package/components/Modal/Modal.d.ts +0 -15
- package/components/Modal/Modal.d.ts.map +0 -1
- package/components/Modal/Modal.jsx +0 -93
- package/components/Modal/Modal.stories.d.ts +0 -56
- package/components/Modal/Modal.stories.d.ts.map +0 -1
- package/components/Modal/Modal.stories.jsx +0 -189
- package/components/Modal/Modal.test.d.ts +0 -3
- package/components/Modal/Modal.test.d.ts.map +0 -1
- package/components/Modal/Modal.test.jsx +0 -85
- package/components/Modal/index.d.ts +0 -2
- package/components/Modal/index.d.ts.map +0 -1
- package/components/Modal/index.js +0 -14
- package/components/Picker/Picker.d.ts +0 -26
- package/components/Picker/Picker.d.ts.map +0 -1
- package/components/Picker/Picker.jsx +0 -81
- package/components/Picker/Picker.stories.d.ts +0 -22
- package/components/Picker/Picker.stories.d.ts.map +0 -1
- package/components/Picker/Picker.stories.jsx +0 -236
- package/components/Picker/Picker.test.d.ts +0 -2
- package/components/Picker/Picker.test.d.ts.map +0 -1
- package/components/Picker/Picker.test.jsx +0 -190
- package/components/Picker/index.d.ts +0 -2
- package/components/Picker/index.d.ts.map +0 -1
- package/components/Picker/index.js +0 -1
- package/components/Price/Price.d.ts +0 -17
- package/components/Price/Price.d.ts.map +0 -1
- package/components/Price/Price.jsx +0 -24
- package/components/Price/Price.stories.d.ts +0 -17
- package/components/Price/Price.stories.d.ts.map +0 -1
- package/components/Price/Price.stories.jsx +0 -78
- package/components/Price/Price.test.d.ts +0 -3
- package/components/Price/Price.test.d.ts.map +0 -1
- package/components/Price/Price.test.jsx +0 -68
- package/components/Price/index.d.ts +0 -2
- package/components/Price/index.d.ts.map +0 -1
- package/components/Price/index.js +0 -1
- package/components/PriceRange/PriceRange.d.ts +0 -17
- package/components/PriceRange/PriceRange.d.ts.map +0 -1
- package/components/PriceRange/PriceRange.jsx +0 -75
- package/components/PriceRange/PriceRange.stories.d.ts +0 -107
- package/components/PriceRange/PriceRange.stories.d.ts.map +0 -1
- package/components/PriceRange/PriceRange.stories.jsx +0 -210
- package/components/PriceRange/PriceRange.test.d.ts +0 -3
- package/components/PriceRange/PriceRange.test.d.ts.map +0 -1
- package/components/PriceRange/PriceRange.test.jsx +0 -188
- package/components/PriceRange/index.d.ts +0 -3
- package/components/PriceRange/index.d.ts.map +0 -1
- package/components/PriceRange/index.js +0 -2
- package/components/PriceSummary/PriceSummary.d.ts +0 -43
- package/components/PriceSummary/PriceSummary.d.ts.map +0 -1
- package/components/PriceSummary/PriceSummary.jsx +0 -228
- package/components/PriceSummary/PriceSummary.stories.d.ts +0 -127
- package/components/PriceSummary/PriceSummary.stories.d.ts.map +0 -1
- package/components/PriceSummary/PriceSummary.stories.jsx +0 -456
- package/components/PriceSummary/PriceSummary.test.d.ts +0 -3
- package/components/PriceSummary/PriceSummary.test.d.ts.map +0 -1
- package/components/PriceSummary/PriceSummary.test.jsx +0 -275
- package/components/PriceSummary/index.d.ts +0 -3
- package/components/PriceSummary/index.d.ts.map +0 -1
- package/components/PriceSummary/index.js +0 -2
- package/components/ProgressSpinner/ProgressSpinner.d.ts +0 -14
- package/components/ProgressSpinner/ProgressSpinner.d.ts.map +0 -1
- package/components/ProgressSpinner/ProgressSpinner.jsx +0 -31
- package/components/ProgressSpinner/ProgressSpinner.stories.d.ts +0 -19
- package/components/ProgressSpinner/ProgressSpinner.stories.d.ts.map +0 -1
- package/components/ProgressSpinner/ProgressSpinner.stories.jsx +0 -195
- package/components/ProgressSpinner/ProgressSpinner.test.d.ts +0 -3
- package/components/ProgressSpinner/ProgressSpinner.test.d.ts.map +0 -1
- package/components/ProgressSpinner/ProgressSpinner.test.jsx +0 -40
- package/components/ProgressSpinner/index.d.ts +0 -3
- package/components/ProgressSpinner/index.d.ts.map +0 -1
- package/components/ProgressSpinner/index.js +0 -2
- package/components/RadioButton/RadioButton.d.ts +0 -15
- package/components/RadioButton/RadioButton.d.ts.map +0 -1
- package/components/RadioButton/RadioButton.jsx +0 -31
- package/components/RadioButton/RadioButton.stories.d.ts +0 -15
- package/components/RadioButton/RadioButton.stories.d.ts.map +0 -1
- package/components/RadioButton/RadioButton.stories.jsx +0 -92
- package/components/RadioButton/RadioButton.test.d.ts +0 -3
- package/components/RadioButton/RadioButton.test.d.ts.map +0 -1
- package/components/RadioButton/RadioButton.test.jsx +0 -62
- package/components/RadioButton/index.d.ts +0 -3
- package/components/RadioButton/index.d.ts.map +0 -1
- package/components/RadioButton/index.js +0 -2
- package/components/Skeleton/Skeleton.d.ts +0 -17
- package/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/components/Skeleton/Skeleton.jsx +0 -52
- package/components/Skeleton/Skeleton.stories.d.ts +0 -67
- package/components/Skeleton/Skeleton.stories.d.ts.map +0 -1
- package/components/Skeleton/Skeleton.stories.jsx +0 -184
- package/components/Skeleton/Skeleton.test.d.ts +0 -3
- package/components/Skeleton/Skeleton.test.d.ts.map +0 -1
- package/components/Skeleton/Skeleton.test.jsx +0 -62
- package/components/Skeleton/index.d.ts +0 -2
- package/components/Skeleton/index.d.ts.map +0 -1
- package/components/Skeleton/index.js +0 -1
- package/components/TextSwatch/TextSwatch.d.ts +0 -18
- package/components/TextSwatch/TextSwatch.d.ts.map +0 -1
- package/components/TextSwatch/TextSwatch.jsx +0 -56
- package/components/TextSwatch/TextSwatch.stories.d.ts +0 -21
- package/components/TextSwatch/TextSwatch.stories.d.ts.map +0 -1
- package/components/TextSwatch/TextSwatch.stories.jsx +0 -211
- package/components/TextSwatch/TextSwatch.test.d.ts +0 -3
- package/components/TextSwatch/TextSwatch.test.d.ts.map +0 -1
- package/components/TextSwatch/TextSwatch.test.jsx +0 -85
- package/components/TextSwatch/index.d.ts +0 -3
- package/components/TextSwatch/index.d.ts.map +0 -1
- package/components/TextSwatch/index.js +0 -2
- package/components/UIProvider/UIProvider.d.ts +0 -18
- package/components/UIProvider/UIProvider.d.ts.map +0 -1
- package/components/UIProvider/UIProvider.jsx +0 -26
- package/components/UIProvider/UIProvider.test.d.ts +0 -2
- package/components/UIProvider/UIProvider.test.d.ts.map +0 -1
- package/components/UIProvider/UIProvider.test.jsx +0 -9
- package/components/UIProvider/index.d.ts +0 -2
- package/components/UIProvider/index.d.ts.map +0 -1
- package/components/UIProvider/index.js +0 -1
- package/components/index.d.ts +0 -34
- package/components/index.d.ts.map +0 -1
- package/components/index.js +0 -33
- package/docs/Design/designBlocks.d.ts +0 -21
- package/docs/Design/designBlocks.d.ts.map +0 -1
- package/docs/Design/designBlocks.jsx +0 -59
- package/docs/Design/getTokenData.d.ts +0 -7
- package/docs/Design/getTokenData.d.ts.map +0 -1
- package/docs/Design/getTokenData.js +0 -18
- package/docs/Design/getTokenData.test.d.ts +0 -2
- package/docs/Design/getTokenData.test.d.ts.map +0 -1
- package/docs/Design/getTokenData.test.js +0 -92
- package/i18n/en_US.json +0 -112
- package/i18n/index.d.ts +0 -341
- package/i18n/index.d.ts.map +0 -1
- package/i18n/index.js +0 -12
- package/i18n/index.test.d.ts +0 -2
- package/i18n/index.test.d.ts.map +0 -1
- package/i18n/index.test.js +0 -11
- package/icons/index.d.ts +0 -35
- package/icons/index.d.ts.map +0 -1
- package/icons/index.js +0 -34
- package/lib/classes.d.ts +0 -5
- package/lib/classes.d.ts.map +0 -1
- package/lib/classes.js +0 -16
- package/lib/classes.test.d.ts +0 -2
- package/lib/classes.test.d.ts.map +0 -1
- package/lib/classes.test.js +0 -18
- package/lib/config.d.ts +0 -7
- package/lib/config.d.ts.map +0 -1
- package/lib/config.js +0 -12
- package/lib/config.test.d.ts +0 -2
- package/lib/config.test.d.ts.map +0 -1
- package/lib/config.test.js +0 -12
- package/lib/debounce.d.ts +0 -2
- package/lib/debounce.d.ts.map +0 -1
- package/lib/debounce.js +0 -7
- package/lib/debounce.test.d.ts +0 -2
- package/lib/debounce.test.d.ts.map +0 -1
- package/lib/debounce.test.js +0 -40
- package/lib/deepmerge.d.ts +0 -2
- package/lib/deepmerge.d.ts.map +0 -1
- package/lib/deepmerge.js +0 -1
- package/lib/form-values.d.ts +0 -5
- package/lib/form-values.d.ts.map +0 -1
- package/lib/form-values.js +0 -17
- package/lib/form-values.test.d.ts +0 -2
- package/lib/form-values.test.d.ts.map +0 -1
- package/lib/form-values.test.jsx +0 -29
- package/lib/i18n.d.ts +0 -8
- package/lib/i18n.d.ts.map +0 -1
- package/lib/i18n.js +0 -9
- package/lib/i18n.test.d.ts +0 -2
- package/lib/i18n.test.d.ts.map +0 -1
- package/lib/i18n.test.jsx +0 -8
- package/lib/image-params-keymap.d.ts +0 -4
- package/lib/image-params-keymap.d.ts.map +0 -1
- package/lib/image-params-keymap.js +0 -19
- package/lib/image-params-keymap.test.d.ts +0 -2
- package/lib/image-params-keymap.test.d.ts.map +0 -1
- package/lib/image-params-keymap.test.js +0 -7
- package/lib/index.d.ts +0 -14
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -13
- package/lib/initializer.d.ts +0 -81
- package/lib/initializer.d.ts.map +0 -1
- package/lib/initializer.js +0 -96
- package/lib/initializer.test.d.ts +0 -2
- package/lib/initializer.test.d.ts.map +0 -1
- package/lib/initializer.test.js +0 -64
- package/lib/render.d.ts +0 -10
- package/lib/render.d.ts.map +0 -1
- package/lib/render.jsx +0 -34
- package/lib/render.test.d.ts +0 -2
- package/lib/render.test.d.ts.map +0 -1
- package/lib/render.test.jsx +0 -70
- package/lib/resolve-image.d.ts +0 -10
- package/lib/resolve-image.d.ts.map +0 -1
- package/lib/resolve-image.js +0 -57
- package/lib/resolve-image.test.d.ts +0 -2
- package/lib/resolve-image.test.d.ts.map +0 -1
- package/lib/resolve-image.test.jsx +0 -146
- package/lib/slot.d.ts +0 -43
- package/lib/slot.d.ts.map +0 -1
- package/lib/slot.jsx +0 -184
- package/lib/slot.test.d.ts +0 -2
- package/lib/slot.test.d.ts.map +0 -1
- package/lib/slot.test.jsx +0 -325
- package/lib/tests.d.ts +0 -4
- package/lib/tests.d.ts.map +0 -1
- package/lib/tests.jsx +0 -19
- package/lib/tests.test.d.ts +0 -2
- package/lib/tests.test.d.ts.map +0 -1
- package/lib/tests.test.jsx +0 -13
- package/lib/types.d.ts +0 -9
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -1
- package/lib/vcomponent.d.ts +0 -8
- package/lib/vcomponent.d.ts.map +0 -1
- package/lib/vcomponent.jsx +0 -27
- package/lib/vcomponent.test.d.ts +0 -2
- package/lib/vcomponent.test.d.ts.map +0 -1
- package/lib/vcomponent.test.jsx +0 -51
package/lib/render.jsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { render } from 'preact';
|
|
2
|
-
import renderToString from 'preact-render-to-string';
|
|
3
|
-
import { VComponent } from '@adobe/elsie/lib';
|
|
4
|
-
export class Render {
|
|
5
|
-
_provider;
|
|
6
|
-
constructor(provider) {
|
|
7
|
-
this._provider = provider;
|
|
8
|
-
}
|
|
9
|
-
render(Component, props) {
|
|
10
|
-
return async (rootElement) => {
|
|
11
|
-
if (!Component)
|
|
12
|
-
throw new Error('Component is not defined');
|
|
13
|
-
if (!rootElement)
|
|
14
|
-
throw new Error('Root element is not defined');
|
|
15
|
-
const initialData = (await Component.getInitialData?.(props)) ?? {};
|
|
16
|
-
render(<VComponent node={this._provider} {...this._provider.props}>
|
|
17
|
-
<Component {...props} initialData={initialData}/>
|
|
18
|
-
</VComponent>, rootElement);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
unmount(rootElement) {
|
|
22
|
-
if (!rootElement)
|
|
23
|
-
throw new Error('Root element is not defined');
|
|
24
|
-
render(null, rootElement);
|
|
25
|
-
}
|
|
26
|
-
async toString(Component, props, options) {
|
|
27
|
-
if (!Component)
|
|
28
|
-
throw new Error('Component is not defined');
|
|
29
|
-
const initialData = (await Component.getInitialData?.(props)) ?? {};
|
|
30
|
-
return renderToString(<VComponent node={this._provider} {...this._provider.props}>
|
|
31
|
-
<Component {...props} initialData={initialData}/>
|
|
32
|
-
</VComponent>, {}, { ...options });
|
|
33
|
-
}
|
|
34
|
-
}
|
package/lib/render.test.d.ts
DELETED
package/lib/render.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render.test.d.ts","sourceRoot":"","sources":["../../src/lib/render.test.tsx"],"names":[],"mappings":""}
|
package/lib/render.test.jsx
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Render } from './render';
|
|
2
|
-
import { render } from 'preact';
|
|
3
|
-
import renderToString from 'preact-render-to-string';
|
|
4
|
-
import { VComponent } from '.';
|
|
5
|
-
jest.mock('preact');
|
|
6
|
-
jest.mock('preact-render-to-string');
|
|
7
|
-
describe('Render', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
jest.clearAllMocks();
|
|
10
|
-
});
|
|
11
|
-
test('render', async () => {
|
|
12
|
-
const provider = new Render(<div />);
|
|
13
|
-
await provider.render(() => <span />, {})(document.createElement('div'));
|
|
14
|
-
expect(render).toHaveBeenCalled();
|
|
15
|
-
});
|
|
16
|
-
test('render without rootElement', async () => {
|
|
17
|
-
const provider = new Render(<div />);
|
|
18
|
-
//@ts-ignore
|
|
19
|
-
// eslint-disable-next-line jest/valid-expect
|
|
20
|
-
expect(provider.render(() => <span />)(null)).rejects.toThrowError('Root element is not defined');
|
|
21
|
-
});
|
|
22
|
-
test('render wihtout component', async () => {
|
|
23
|
-
const provider = new Render(<div />);
|
|
24
|
-
//@ts-ignore
|
|
25
|
-
// eslint-disable-next-line jest/valid-expect
|
|
26
|
-
expect(provider.render(null)(null)).rejects.toThrowError('Component is not defined');
|
|
27
|
-
});
|
|
28
|
-
test('unmount', async () => {
|
|
29
|
-
const provider = new Render(<div />);
|
|
30
|
-
const root = document.createElement('div');
|
|
31
|
-
provider.unmount(root);
|
|
32
|
-
expect(render).toHaveBeenCalledWith(null, root);
|
|
33
|
-
});
|
|
34
|
-
test('unmount without rootElement', async () => {
|
|
35
|
-
const provider = new Render(<div />);
|
|
36
|
-
//@ts-ignore
|
|
37
|
-
// eslint-disable-next-line jest/valid-expect
|
|
38
|
-
expect(() => provider.unmount()).toThrow('Root element is not defined');
|
|
39
|
-
});
|
|
40
|
-
test('toString', async () => {
|
|
41
|
-
const provider = new Render(<div />);
|
|
42
|
-
const ChildTestComponent = () => <span />;
|
|
43
|
-
await provider.toString(ChildTestComponent, {});
|
|
44
|
-
const newComponent = (<VComponent node={<div />}>
|
|
45
|
-
{(() => (<ChildTestComponent initialData={{}}/>))()}
|
|
46
|
-
</VComponent>);
|
|
47
|
-
// Remove the internal __v properties of components so they can be compared
|
|
48
|
-
const deepOmitInternalProperties = (obj) => {
|
|
49
|
-
if (Array.isArray(obj)) {
|
|
50
|
-
return obj.map(deepOmitInternalProperties);
|
|
51
|
-
}
|
|
52
|
-
else if (obj !== null && typeof obj === 'object') {
|
|
53
|
-
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
54
|
-
const { __v, ...rest } = obj;
|
|
55
|
-
Object.keys(rest).forEach((key) => {
|
|
56
|
-
rest[key] = deepOmitInternalProperties(rest[key]);
|
|
57
|
-
});
|
|
58
|
-
return rest;
|
|
59
|
-
}
|
|
60
|
-
return obj;
|
|
61
|
-
};
|
|
62
|
-
expect(deepOmitInternalProperties(renderToString.mock.calls[0][0])).toEqual(deepOmitInternalProperties(newComponent));
|
|
63
|
-
});
|
|
64
|
-
test('toString without component', async () => {
|
|
65
|
-
const provider = new Render(<div />);
|
|
66
|
-
//@ts-ignore
|
|
67
|
-
// eslint-disable-next-line jest/valid-expect
|
|
68
|
-
expect(provider.toString(null)).rejects.toThrowError('Component is not defined');
|
|
69
|
-
});
|
|
70
|
-
});
|
package/lib/resolve-image.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ResolveImageUrlOptions {
|
|
2
|
-
width: number;
|
|
3
|
-
height?: number;
|
|
4
|
-
auto?: string;
|
|
5
|
-
quality?: number;
|
|
6
|
-
crop?: boolean;
|
|
7
|
-
fit?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const generateSrcset: (imageURL: string, options: ResolveImageUrlOptions) => string | undefined;
|
|
10
|
-
//# sourceMappingURL=resolve-image.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-image.d.ts","sourceRoot":"","sources":["../../src/lib/resolve-image.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAqCD,eAAO,MAAM,cAAc,aACf,MAAM,WACP,sBAAsB,uBAqBhC,CAAC"}
|
package/lib/resolve-image.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { getImageParamsKeyMap } from '@adobe/elsie/lib/';
|
|
2
|
-
const BREAKPOINTS = {
|
|
3
|
-
medium: 768,
|
|
4
|
-
large: 1024,
|
|
5
|
-
xlarge: 1366,
|
|
6
|
-
xxlarge: 1920,
|
|
7
|
-
};
|
|
8
|
-
const resolveImageUrl = (url, _opts) => {
|
|
9
|
-
const [base, query] = url.split('?');
|
|
10
|
-
const params = new URLSearchParams(query);
|
|
11
|
-
const keyMapping = getImageParamsKeyMap();
|
|
12
|
-
let opts = {};
|
|
13
|
-
if (keyMapping && Object.keys(keyMapping).length > 0 && _opts) {
|
|
14
|
-
opts = Object.entries(_opts).reduce((acc, [key, value]) => {
|
|
15
|
-
const newKey = keyMapping[key];
|
|
16
|
-
if (newKey) {
|
|
17
|
-
acc[newKey] = value;
|
|
18
|
-
}
|
|
19
|
-
return acc;
|
|
20
|
-
}, {});
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
opts = {
|
|
24
|
-
auto: 'webp',
|
|
25
|
-
quality: 80,
|
|
26
|
-
crop: false,
|
|
27
|
-
fit: 'cover',
|
|
28
|
-
..._opts,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
// Append image optimization parameters
|
|
32
|
-
Object.entries(opts).forEach(([key, value]) => {
|
|
33
|
-
if (value !== undefined && value !== null) {
|
|
34
|
-
params.set(key, String(value));
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return `${base}?${params.toString()}`;
|
|
38
|
-
};
|
|
39
|
-
export const generateSrcset = (imageURL, options) => {
|
|
40
|
-
if (!imageURL || !options?.width)
|
|
41
|
-
return;
|
|
42
|
-
const generateSrcsetUrl = (options) => {
|
|
43
|
-
return resolveImageUrl(imageURL, {
|
|
44
|
-
...options,
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
return Object.entries(BREAKPOINTS)
|
|
48
|
-
.map(([, value]) => {
|
|
49
|
-
// calculate breakpoints width
|
|
50
|
-
const relativeWidth = (options.width * value) / BREAKPOINTS.xxlarge;
|
|
51
|
-
return `${generateSrcsetUrl({
|
|
52
|
-
...options,
|
|
53
|
-
width: relativeWidth,
|
|
54
|
-
})} ${value}w`;
|
|
55
|
-
})
|
|
56
|
-
.join(',\n');
|
|
57
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-image.test.d.ts","sourceRoot":"","sources":["../../src/lib/resolve-image.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { generateSrcset } from '@adobe/elsie/lib/resolve-image';
|
|
2
|
-
import { getImageParamsKeyMap } from './image-params-keymap';
|
|
3
|
-
jest.mock('@adobe/elsie/lib/image-params-keymap', () => ({
|
|
4
|
-
getImageParamsKeyMap: jest.fn(),
|
|
5
|
-
}));
|
|
6
|
-
const imageURL = 'http://example.com/image.jpeg';
|
|
7
|
-
describe('resolve-image', () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
getImageParamsKeyMap.mockReturnValue(undefined);
|
|
10
|
-
});
|
|
11
|
-
test('generateSrcset should return empty string if either of the arguments are falsey', () => {
|
|
12
|
-
expect(generateSrcset('', { width: 960 })).toBe(undefined);
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
expect(generateSrcset(null, null)).toBe(undefined);
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
expect(generateSrcset(undefined, undefined)).toBe(undefined);
|
|
17
|
-
expect(
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
generateSrcset(imageURL, { width: 90, height: undefined, quality: null })).toMatchInlineSnapshot(`
|
|
20
|
-
"http://example.com/image.jpeg?auto=webp&crop=false&fit=cover&width=36 768w,
|
|
21
|
-
http://example.com/image.jpeg?auto=webp&crop=false&fit=cover&width=48 1024w,
|
|
22
|
-
http://example.com/image.jpeg?auto=webp&crop=false&fit=cover&width=64.03125 1366w,
|
|
23
|
-
http://example.com/image.jpeg?auto=webp&crop=false&fit=cover&width=90 1920w"
|
|
24
|
-
`);
|
|
25
|
-
});
|
|
26
|
-
test('generateSrcset should return srcset for all widths in imageWidths', () => {
|
|
27
|
-
const result = generateSrcset(imageURL, { width: 960 });
|
|
28
|
-
expect(result).toMatchInlineSnapshot(`
|
|
29
|
-
"http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=384 768w,
|
|
30
|
-
http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=512 1024w,
|
|
31
|
-
http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=683 1366w,
|
|
32
|
-
http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=960 1920w"
|
|
33
|
-
`);
|
|
34
|
-
});
|
|
35
|
-
test('resolveImageUrl should accept relative URL', () => {
|
|
36
|
-
const result = generateSrcset('/test.jpg', { width: 960 });
|
|
37
|
-
expect(result).toMatchInlineSnapshot(`
|
|
38
|
-
"/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=384 768w,
|
|
39
|
-
/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=512 1024w,
|
|
40
|
-
/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=683 1366w,
|
|
41
|
-
/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=960 1920w"
|
|
42
|
-
`);
|
|
43
|
-
const result2 = generateSrcset('//domain.com/test.jpg', { width: 960 });
|
|
44
|
-
expect(result2).toMatchInlineSnapshot(`
|
|
45
|
-
"//domain.com/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=384 768w,
|
|
46
|
-
//domain.com/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=512 1024w,
|
|
47
|
-
//domain.com/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=683 1366w,
|
|
48
|
-
//domain.com/test.jpg?auto=webp&quality=80&crop=false&fit=cover&width=960 1920w"
|
|
49
|
-
`);
|
|
50
|
-
});
|
|
51
|
-
describe('custom mappings', () => {
|
|
52
|
-
test('resolveImageUrl should apply custom key mapping when provided', () => {
|
|
53
|
-
getImageParamsKeyMap.mockReturnValue({
|
|
54
|
-
width: 'w',
|
|
55
|
-
quality: 'qual',
|
|
56
|
-
fit: 'f',
|
|
57
|
-
auto: 'a',
|
|
58
|
-
crop: 'cr',
|
|
59
|
-
});
|
|
60
|
-
const result = generateSrcset(imageURL, {
|
|
61
|
-
width: 960,
|
|
62
|
-
quality: 50,
|
|
63
|
-
fit: 'cover',
|
|
64
|
-
auto: 'webp',
|
|
65
|
-
crop: false,
|
|
66
|
-
});
|
|
67
|
-
expect(result).toMatchInlineSnapshot(`
|
|
68
|
-
"http://example.com/image.jpeg?w=384&qual=50&f=cover&a=webp&cr=false 768w,
|
|
69
|
-
http://example.com/image.jpeg?w=512&qual=50&f=cover&a=webp&cr=false 1024w,
|
|
70
|
-
http://example.com/image.jpeg?w=683&qual=50&f=cover&a=webp&cr=false 1366w,
|
|
71
|
-
http://example.com/image.jpeg?w=960&qual=50&f=cover&a=webp&cr=false 1920w"
|
|
72
|
-
`);
|
|
73
|
-
});
|
|
74
|
-
test('resolveImageUrl should ignore custom key mapping if key is not found in options', () => {
|
|
75
|
-
getImageParamsKeyMap.mockReturnValue({
|
|
76
|
-
width: 'w',
|
|
77
|
-
quality: 'qual',
|
|
78
|
-
fit: 'f',
|
|
79
|
-
auto: 'a',
|
|
80
|
-
crop: 'cr',
|
|
81
|
-
height: 'h',
|
|
82
|
-
});
|
|
83
|
-
const result = generateSrcset(imageURL, {
|
|
84
|
-
width: 960,
|
|
85
|
-
quality: 50,
|
|
86
|
-
fit: 'cover',
|
|
87
|
-
auto: 'webp',
|
|
88
|
-
crop: false,
|
|
89
|
-
});
|
|
90
|
-
expect(result).toMatchInlineSnapshot(`
|
|
91
|
-
"http://example.com/image.jpeg?w=384&qual=50&f=cover&a=webp&cr=false 768w,
|
|
92
|
-
http://example.com/image.jpeg?w=512&qual=50&f=cover&a=webp&cr=false 1024w,
|
|
93
|
-
http://example.com/image.jpeg?w=683&qual=50&f=cover&a=webp&cr=false 1366w,
|
|
94
|
-
http://example.com/image.jpeg?w=960&qual=50&f=cover&a=webp&cr=false 1920w"
|
|
95
|
-
`);
|
|
96
|
-
});
|
|
97
|
-
test('resolveImageUrl should ignore option if mapping is not provided', () => {
|
|
98
|
-
getImageParamsKeyMap.mockReturnValue({
|
|
99
|
-
width: 'w',
|
|
100
|
-
quality: 'qual',
|
|
101
|
-
fit: 'f',
|
|
102
|
-
auto: 'a',
|
|
103
|
-
});
|
|
104
|
-
const result = generateSrcset(imageURL, {
|
|
105
|
-
width: 960,
|
|
106
|
-
quality: 50,
|
|
107
|
-
fit: 'cover',
|
|
108
|
-
auto: 'webp',
|
|
109
|
-
crop: false,
|
|
110
|
-
});
|
|
111
|
-
expect(result).toMatchInlineSnapshot(`
|
|
112
|
-
"http://example.com/image.jpeg?w=384&qual=50&f=cover&a=webp 768w,
|
|
113
|
-
http://example.com/image.jpeg?w=512&qual=50&f=cover&a=webp 1024w,
|
|
114
|
-
http://example.com/image.jpeg?w=683&qual=50&f=cover&a=webp 1366w,
|
|
115
|
-
http://example.com/image.jpeg?w=960&qual=50&f=cover&a=webp 1920w"
|
|
116
|
-
`);
|
|
117
|
-
});
|
|
118
|
-
test('resolveImageUrl can support completely custom params', () => {
|
|
119
|
-
getImageParamsKeyMap.mockReturnValue({
|
|
120
|
-
width: 'width',
|
|
121
|
-
scale: 'scale',
|
|
122
|
-
crop: 'crop',
|
|
123
|
-
opacity: 'opacity',
|
|
124
|
-
});
|
|
125
|
-
const result = generateSrcset(imageURL,
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
{ width: 960, scale: 2, crop: 'center', opacity: 75 });
|
|
128
|
-
expect(result).toMatchInlineSnapshot(`
|
|
129
|
-
"http://example.com/image.jpeg?width=384&scale=2&crop=center&opacity=75 768w,
|
|
130
|
-
http://example.com/image.jpeg?width=512&scale=2&crop=center&opacity=75 1024w,
|
|
131
|
-
http://example.com/image.jpeg?width=683&scale=2&crop=center&opacity=75 1366w,
|
|
132
|
-
http://example.com/image.jpeg?width=960&scale=2&crop=center&opacity=75 1920w"
|
|
133
|
-
`);
|
|
134
|
-
});
|
|
135
|
-
test('resolveImageUrl should use default mapping if custom mapping object is empty', () => {
|
|
136
|
-
getImageParamsKeyMap.mockReturnValue({});
|
|
137
|
-
const result = generateSrcset(imageURL, { width: 960 });
|
|
138
|
-
expect(result).toMatchInlineSnapshot(`
|
|
139
|
-
"http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=384 768w,
|
|
140
|
-
http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=512 1024w,
|
|
141
|
-
http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=683 1366w,
|
|
142
|
-
http://example.com/image.jpeg?auto=webp&quality=80&crop=false&fit=cover&width=960 1920w"
|
|
143
|
-
`);
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
package/lib/slot.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { RefObject, VNode } from 'preact';
|
|
2
|
-
import { StateUpdater } from 'preact/hooks';
|
|
3
|
-
import { Lang } from '@adobe/elsie/i18n';
|
|
4
|
-
import { HTMLAttributes } from 'preact/compat';
|
|
5
|
-
type MutateElement = (elem: HTMLElement) => void;
|
|
6
|
-
interface State {
|
|
7
|
-
get: (key: string) => void;
|
|
8
|
-
set: (key: string, value: any) => void;
|
|
9
|
-
}
|
|
10
|
-
interface SlotElement {
|
|
11
|
-
appendChild: MutateElement;
|
|
12
|
-
prependChild: MutateElement;
|
|
13
|
-
appendSibling: MutateElement;
|
|
14
|
-
prependSibling: MutateElement;
|
|
15
|
-
}
|
|
16
|
-
interface PrivateContext<T> {
|
|
17
|
-
_setProps: StateUpdater<{}>;
|
|
18
|
-
_registerMethod: (cb: (next: T & DefaultSlotContext<T>, state: State) => void) => void;
|
|
19
|
-
_htmlElementToVNode: (element: HTMLElement) => VNode;
|
|
20
|
-
}
|
|
21
|
-
interface DefaultSlotContext<T> extends PrivateContext<T> {
|
|
22
|
-
dictionary: Lang;
|
|
23
|
-
getSlotElement: (key: string) => SlotElement;
|
|
24
|
-
replaceWith: MutateElement;
|
|
25
|
-
appendChild: MutateElement;
|
|
26
|
-
prependChild: MutateElement;
|
|
27
|
-
appendSibling: MutateElement;
|
|
28
|
-
prependSibling: MutateElement;
|
|
29
|
-
onChange: (cb: (next: T & DefaultSlotContext<T>) => void) => void;
|
|
30
|
-
}
|
|
31
|
-
type Context<T> = T & ThisType<DefaultSlotContext<T>>;
|
|
32
|
-
export type SlotProps<T = any> = (ctx: T & DefaultSlotContext<T>, element: HTMLDivElement | null) => void;
|
|
33
|
-
export type SlotMethod<P = any> = (callback: (next: unknown, state: State) => P) => void;
|
|
34
|
-
export declare function useSlot<K, V extends HTMLDivElement>(context?: Context<K>, callback?: SlotProps<K>, render?: Function): [RefObject<V>, Record<string, any>];
|
|
35
|
-
interface SlotPropsComponent<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'slot'> {
|
|
36
|
-
name: string;
|
|
37
|
-
slot?: SlotProps<T>;
|
|
38
|
-
context?: Context<T>;
|
|
39
|
-
render?: (props: Record<string, any>) => VNode | VNode[];
|
|
40
|
-
}
|
|
41
|
-
export declare function Slot<T>({ name, slot, context, children, render, ...props }: Readonly<SlotPropsComponent<T>>): import("preact").JSX.Element;
|
|
42
|
-
export {};
|
|
43
|
-
//# sourceMappingURL=slot.d.ts.map
|
package/lib/slot.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../src/lib/slot.tsx"],"names":[],"mappings":"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"}
|
package/lib/slot.jsx
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { useContext, useState, useRef, useEffect, useMemo, useCallback, } from 'preact/hooks';
|
|
2
|
-
import { IntlContext } from '@adobe/elsie/i18n';
|
|
3
|
-
// Slot Hook
|
|
4
|
-
export function useSlot(
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
context = {}, callback, render) {
|
|
7
|
-
// HTML Element
|
|
8
|
-
const elementRef = useRef(null);
|
|
9
|
-
const loadedRef = useRef(false);
|
|
10
|
-
// Methods
|
|
11
|
-
const methodsRef = useRef([]);
|
|
12
|
-
// Children VNodes
|
|
13
|
-
const [props, _setProps] = useState({
|
|
14
|
-
children: [render?.({})],
|
|
15
|
-
});
|
|
16
|
-
// Attributes
|
|
17
|
-
const [_state, setState] = useState({});
|
|
18
|
-
const state = useMemo(() => ({
|
|
19
|
-
get: (key) => _state[key],
|
|
20
|
-
set: (key, value) => {
|
|
21
|
-
setState({ ...state, [key]: value });
|
|
22
|
-
},
|
|
23
|
-
}), [_state]);
|
|
24
|
-
/** Internationalization */
|
|
25
|
-
const { intl } = useContext(IntlContext);
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
context.dictionary = intl.dictionary;
|
|
28
|
-
/** Privates */
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
context._setProps = _setProps;
|
|
31
|
-
const _registerMethod = useCallback((callback) => {
|
|
32
|
-
if (typeof callback === 'function') {
|
|
33
|
-
methodsRef.current.push(callback);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
console.warn('Skipped: Invalid _registerMethod', callback);
|
|
37
|
-
}
|
|
38
|
-
}, []);
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
context._registerMethod = _registerMethod;
|
|
41
|
-
const _htmlElementToVNode = useCallback((elem) => {
|
|
42
|
-
return (<div data-slot-html-element={elem.tagName.toLowerCase()} ref={(refElem) => {
|
|
43
|
-
refElem?.appendChild(elem);
|
|
44
|
-
}}/>);
|
|
45
|
-
}, []);
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
context._htmlElementToVNode = _htmlElementToVNode;
|
|
48
|
-
/** Prebuilt Methods */
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
context.getSlotElement = useCallback((key) => {
|
|
51
|
-
const element = document.querySelector(`[data-slot-key="${key}"]`);
|
|
52
|
-
if (!element)
|
|
53
|
-
return;
|
|
54
|
-
return {
|
|
55
|
-
appendChild: (elem) => {
|
|
56
|
-
element.appendChild(elem);
|
|
57
|
-
},
|
|
58
|
-
prependChild: (elem) => {
|
|
59
|
-
element.insertBefore(elem, element.firstChild);
|
|
60
|
-
},
|
|
61
|
-
appendSibling: (elem) => {
|
|
62
|
-
const parent = element.parentNode;
|
|
63
|
-
parent?.insertBefore(elem, element.nextSibling);
|
|
64
|
-
},
|
|
65
|
-
prependSibling: (elem) => {
|
|
66
|
-
const parent = element.parentNode;
|
|
67
|
-
parent?.insertBefore(elem, element);
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}, []);
|
|
71
|
-
// @ts-ignore
|
|
72
|
-
context.onChange = useCallback((callback) => {
|
|
73
|
-
methodsRef.current.push(callback);
|
|
74
|
-
}, []);
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
context.replaceWith = useCallback((elem) => {
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
_registerMethod((next) => {
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
const children = _htmlElementToVNode(elem);
|
|
81
|
-
next._setProps({ children: [children] });
|
|
82
|
-
});
|
|
83
|
-
}, [_htmlElementToVNode, _registerMethod]);
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
context.appendChild = useCallback((elem) => {
|
|
86
|
-
// @ts-ignore
|
|
87
|
-
_registerMethod((next) => {
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
const vnode = _htmlElementToVNode(elem);
|
|
90
|
-
next._setProps((prev) => {
|
|
91
|
-
return {
|
|
92
|
-
...prev,
|
|
93
|
-
children: [...prev.children, vnode],
|
|
94
|
-
};
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}, [_htmlElementToVNode, _registerMethod]);
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
context.prependChild = useCallback((elem) => {
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
_registerMethod((next) => {
|
|
102
|
-
// @ts-ignore
|
|
103
|
-
const vnode = _htmlElementToVNode(elem);
|
|
104
|
-
next._setProps((prev) => {
|
|
105
|
-
return {
|
|
106
|
-
...prev,
|
|
107
|
-
children: [vnode, ...prev.children],
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}, [_htmlElementToVNode, _registerMethod]);
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
context.appendSibling = useCallback((elem) => {
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
_registerMethod(() => {
|
|
116
|
-
const parent = elementRef.current?.parentNode;
|
|
117
|
-
parent?.insertBefore(elem, elementRef.current?.nextSibling ?? null);
|
|
118
|
-
});
|
|
119
|
-
}, [_registerMethod]);
|
|
120
|
-
// @ts-ignore
|
|
121
|
-
context.prependSibling = useCallback((elem) => {
|
|
122
|
-
// @ts-ignore
|
|
123
|
-
_registerMethod(() => {
|
|
124
|
-
const parent = elementRef.current?.parentNode;
|
|
125
|
-
parent?.insertBefore(elem, elementRef.current);
|
|
126
|
-
});
|
|
127
|
-
}, [_registerMethod]);
|
|
128
|
-
// Initialization
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
const element = elementRef.current;
|
|
131
|
-
if (!callback || !element)
|
|
132
|
-
return;
|
|
133
|
-
// Run callback
|
|
134
|
-
try {
|
|
135
|
-
callback(context, element);
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
console.error(`Error in "${callback.name}" Slot callback`, error);
|
|
139
|
-
}
|
|
140
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
141
|
-
}, []);
|
|
142
|
-
// Lifecycles
|
|
143
|
-
useEffect(() => {
|
|
144
|
-
// Reset
|
|
145
|
-
_setProps({ children: [render?.(props)] });
|
|
146
|
-
// Run all registered methods
|
|
147
|
-
methodsRef.current.forEach((method) => {
|
|
148
|
-
method(context, state);
|
|
149
|
-
});
|
|
150
|
-
// Required to trigger re-render of render method
|
|
151
|
-
if (render?.name === 'render' && loadedRef.current === false) {
|
|
152
|
-
loadedRef.current = true;
|
|
153
|
-
}
|
|
154
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
155
|
-
}, [JSON.stringify(context), JSON.stringify(_state), loadedRef.current]);
|
|
156
|
-
return [elementRef, props];
|
|
157
|
-
}
|
|
158
|
-
export function Slot({ name, slot, context, children, render, ...props }) {
|
|
159
|
-
const [elementRef, slotProps] = useSlot(context, slot, render ?? (() => children));
|
|
160
|
-
useEffect(() => {
|
|
161
|
-
if (!name)
|
|
162
|
-
console.warn('Slot "name" is required');
|
|
163
|
-
}, [name]);
|
|
164
|
-
return (<div {...props} ref={elementRef} data-slot={name}>
|
|
165
|
-
{slotProps.children}
|
|
166
|
-
</div>);
|
|
167
|
-
}
|
|
168
|
-
// Debugger
|
|
169
|
-
// @ts-ignore
|
|
170
|
-
window.DROPINS = window.DROPINS || {};
|
|
171
|
-
// @ts-ignore
|
|
172
|
-
window.DROPINS.showSlots = async (state) => {
|
|
173
|
-
// cache state in session storage
|
|
174
|
-
window.sessionStorage.setItem('dropin-debugger--show-slots', state.toString());
|
|
175
|
-
document.body.classList.toggle('dropin-debugger--show-slots', state);
|
|
176
|
-
if (state) {
|
|
177
|
-
try {
|
|
178
|
-
await import('@adobe/elsie/components/UIProvider/debugger.css');
|
|
179
|
-
}
|
|
180
|
-
catch (error) { }
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
// @ts-ignore
|
|
184
|
-
window.DROPINS.showSlots(window.sessionStorage.getItem('dropin-debugger--show-slots') === 'true');
|
package/lib/slot.test.d.ts
DELETED
package/lib/slot.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot.test.d.ts","sourceRoot":"","sources":["../../src/lib/slot.test.tsx"],"names":[],"mappings":""}
|