@adobe-commerce/elsie 1.0.0-alpha04071347
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/.elsie.js +21 -0
- package/.eslintrc.js +18 -0
- package/README.md +52 -0
- package/__mocks__/svg.js +11 -0
- package/bin/builders/build/index.js +20 -0
- package/bin/builders/generate/api/index.js +65 -0
- package/bin/builders/generate/api/templates/function.js +9 -0
- package/bin/builders/generate/api/templates/index.js +7 -0
- package/bin/builders/generate/api/templates/story.js +23 -0
- package/bin/builders/generate/api/templates/unit-test.js +15 -0
- package/bin/builders/generate/component/index.js +87 -0
- package/bin/builders/generate/component/templates/Component.js +43 -0
- package/bin/builders/generate/component/templates/css.js +24 -0
- package/bin/builders/generate/component/templates/index.js +8 -0
- package/bin/builders/generate/component/templates/stories.js +46 -0
- package/bin/builders/generate/component/templates/unit-test.js +19 -0
- package/bin/builders/generate/config/index.js +54 -0
- package/bin/builders/generate/config/templates/elsie.js +29 -0
- package/bin/builders/generate/container/index.js +65 -0
- package/bin/builders/generate/container/templates/Component.js +18 -0
- package/bin/builders/generate/container/templates/index.js +8 -0
- package/bin/builders/generate/container/templates/stories.js +34 -0
- package/bin/builders/generate/container/templates/unit-test.js +19 -0
- package/bin/builders/generate/index.js +283 -0
- package/bin/builders/gql/createOrClearDirectory.js +33 -0
- package/bin/builders/gql/getSchemaRef.js +25 -0
- package/bin/builders/gql/index.js +71 -0
- package/bin/builders/lint/index.js +5 -0
- package/bin/builders/serve/index.js +44 -0
- package/bin/builders/storybook/index.js +5 -0
- package/bin/builders/test/index.js +5 -0
- package/bin/index.js +26 -0
- package/bin/lib/cli.js +8 -0
- package/bin/lib/config.js +12 -0
- package/bin/lib/log-message.js +11 -0
- package/bin/lib/string.js +26 -0
- package/bin/lib/validate-typeof.js +28 -0
- package/bin/lib/write-file.js +30 -0
- package/bin/lib/write-parent-index.js +45 -0
- package/config/eslint.js +113 -0
- package/config/jest.js +90 -0
- package/config/prettier.js +16 -0
- package/config/setEnvVars.js +14 -0
- package/config/storybook/addon.js +130 -0
- package/config/storybook/components/FileTree/FileTree.jsx +192 -0
- package/config/storybook/components/FileTree/index.js +10 -0
- package/config/storybook/components/Flex/Flex.jsx +21 -0
- package/config/storybook/components/Flex/Flex.module.css +29 -0
- package/config/storybook/components/Flex/index.js +10 -0
- package/config/storybook/components/OptionsTable/OptionsTable.jsx +88 -0
- package/config/storybook/components/OptionsTable/OptionsTable.module.css +104 -0
- package/config/storybook/components/OptionsTable/index.js +10 -0
- package/config/storybook/components/Panel/Panel.module.css +56 -0
- package/config/storybook/components/Panel/Panel.tsx +46 -0
- package/config/storybook/components/Panel/index.ts +10 -0
- package/config/storybook/components/Screenshot/Screenshot.jsx +23 -0
- package/config/storybook/components/Screenshot/Screenshot.module.css +28 -0
- package/config/storybook/components/Screenshot/index.js +10 -0
- package/config/storybook/components/Steps/Steps.jsx +21 -0
- package/config/storybook/components/Steps/Steps.module.css +43 -0
- package/config/storybook/components/Steps/index.js +10 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.jsx +18 -0
- package/config/storybook/components/StoryWrapper/StoryWrapper.module.css +22 -0
- package/config/storybook/components/StoryWrapper/index.js +10 -0
- package/config/storybook/components/Summary/Summary.jsx +19 -0
- package/config/storybook/components/Summary/Summary.module.css +20 -0
- package/config/storybook/components/Summary/index.js +10 -0
- package/config/storybook/components/Variants/Variants.js +57 -0
- package/config/storybook/components/Variants/docs.css +48 -0
- package/config/storybook/components/Variants/index.js +10 -0
- package/config/storybook/components/video/index.jsx +28 -0
- package/config/storybook/manager.js +23 -0
- package/config/storybook/preview.jsx +88 -0
- package/config/storybook/theming/fonts.css +68 -0
- package/config/storybook/theming/logo.svg +19 -0
- package/config/storybook/theming/manager.css +63 -0
- package/config/storybook/theming/preview.css +93 -0
- package/config/storybook/theming/theme.js +61 -0
- package/config/tsconfig-base.json +16 -0
- package/config/tsconfig-preact.json +15 -0
- package/config/vite.mjs +306 -0
- package/package.json +113 -0
- package/post-release.sh +5 -0
- package/src/components/Accordion/Accordion.css +88 -0
- package/src/components/Accordion/Accordion.stories.tsx +582 -0
- package/src/components/Accordion/Accordion.tsx +177 -0
- package/src/components/Accordion/index.ts +11 -0
- package/src/components/ActionButton/ActionButton.css +100 -0
- package/src/components/ActionButton/ActionButton.stories.tsx +169 -0
- package/src/components/ActionButton/ActionButton.tsx +53 -0
- package/src/components/ActionButton/index.ts +10 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.css +77 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +97 -0
- package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +91 -0
- package/src/components/ActionButtonGroup/index.ts +10 -0
- package/src/components/AlertBanner/AlertBanner.css +144 -0
- package/src/components/AlertBanner/AlertBanner.stories.tsx +165 -0
- package/src/components/AlertBanner/AlertBanner.tsx +90 -0
- package/src/components/AlertBanner/index.ts +11 -0
- package/src/components/Breadcrumbs/Breadcrumbs.css +60 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +195 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +71 -0
- package/src/components/Breadcrumbs/index.ts +11 -0
- package/src/components/Button/Button.css +213 -0
- package/src/components/Button/Button.mdx +133 -0
- package/src/components/Button/Button.stories.tsx +398 -0
- package/src/components/Button/Button.tsx +121 -0
- package/src/components/Button/index.ts +11 -0
- package/src/components/Card/Card.css +34 -0
- package/src/components/Card/Card.stories.tsx +76 -0
- package/src/components/Card/Card.tsx +34 -0
- package/src/components/Card/index.ts +10 -0
- package/src/components/CartItem/CartItem.css +509 -0
- package/src/components/CartItem/CartItem.stories.tsx +628 -0
- package/src/components/CartItem/CartItem.tsx +467 -0
- package/src/components/CartItem/CartItemSkeleton.tsx +38 -0
- package/src/components/CartItem/index.ts +12 -0
- package/src/components/CartList/CartList.css +35 -0
- package/src/components/CartList/CartList.stories.tsx +111 -0
- package/src/components/CartList/CartList.tsx +40 -0
- package/src/components/CartList/index.ts +11 -0
- package/src/components/Checkbox/Checkbox.css +255 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +290 -0
- package/src/components/Checkbox/Checkbox.tsx +138 -0
- package/src/components/Checkbox/index.ts +10 -0
- package/src/components/ColorSwatch/ColorSwatch.css +132 -0
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +274 -0
- package/src/components/ColorSwatch/ColorSwatch.tsx +127 -0
- package/src/components/ColorSwatch/index.ts +11 -0
- package/src/components/ContentGrid/ContentGrid.css +54 -0
- package/src/components/ContentGrid/ContentGrid.stories.tsx +137 -0
- package/src/components/ContentGrid/ContentGrid.tsx +57 -0
- package/src/components/ContentGrid/index.ts +11 -0
- package/src/components/Divider/Divider.css +22 -0
- package/src/components/Divider/Divider.stories.tsx +62 -0
- package/src/components/Divider/Divider.tsx +33 -0
- package/src/components/Divider/index.ts +11 -0
- package/src/components/Field/Field.css +83 -0
- package/src/components/Field/Field.stories.tsx +238 -0
- package/src/components/Field/Field.tsx +84 -0
- package/src/components/Field/index.ts +10 -0
- package/src/components/Header/Header.css +56 -0
- package/src/components/Header/Header.stories.tsx +180 -0
- package/src/components/Header/Header.tsx +81 -0
- package/src/components/Header/index.ts +11 -0
- package/src/components/Icon/Icon.css +26 -0
- package/src/components/Icon/Icon.stories.helpers.jsx +21 -0
- package/src/components/Icon/Icon.stories.tsx +98 -0
- package/src/components/Icon/Icon.tsx +112 -0
- package/src/components/Icon/index.ts +10 -0
- package/src/components/IllustratedMessage/IllustratedMessage.css +61 -0
- package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +126 -0
- package/src/components/IllustratedMessage/IllustratedMessage.tsx +78 -0
- package/src/components/IllustratedMessage/index.ts +11 -0
- package/src/components/Image/Image.css +52 -0
- package/src/components/Image/Image.stories.tsx +89 -0
- package/src/components/Image/Image.tsx +66 -0
- package/src/components/Image/index.ts +10 -0
- package/src/components/ImageSwatch/ImageSwatch.css +154 -0
- package/src/components/ImageSwatch/ImageSwatch.stories.tsx +310 -0
- package/src/components/ImageSwatch/ImageSwatch.tsx +123 -0
- package/src/components/ImageSwatch/index.ts +11 -0
- package/src/components/InLineAlert/InLineAlert.css +116 -0
- package/src/components/InLineAlert/InLineAlert.stories.tsx +326 -0
- package/src/components/InLineAlert/InLineAlert.tsx +128 -0
- package/src/components/InLineAlert/index.ts +11 -0
- package/src/components/Incrementer/Incrementer.css +165 -0
- package/src/components/Incrementer/Incrementer.stories.tsx +172 -0
- package/src/components/Incrementer/Incrementer.tsx +192 -0
- package/src/components/Incrementer/index.ts +10 -0
- package/src/components/Input/Input.css +304 -0
- package/src/components/Input/Input.stories.tsx +155 -0
- package/src/components/Input/Input.tsx +166 -0
- package/src/components/Input/index.ts +11 -0
- package/src/components/InputDate/InputDate.css +56 -0
- package/src/components/InputDate/InputDate.stories.tsx +117 -0
- package/src/components/InputDate/InputDate.tsx +120 -0
- package/src/components/InputDate/index.ts +11 -0
- package/src/components/InputPassword/InputPassword.css +31 -0
- package/src/components/InputPassword/InputPassword.stories.tsx +148 -0
- package/src/components/InputPassword/InputPassword.tsx +135 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.css +31 -0
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +96 -0
- package/src/components/InputPassword/PasswordStatusIndicator/index.ts +11 -0
- package/src/components/InputPassword/index.ts +11 -0
- package/src/components/Modal/Modal.css +125 -0
- package/src/components/Modal/Modal.stories.tsx +250 -0
- package/src/components/Modal/Modal.tsx +157 -0
- package/src/components/Modal/index.ts +10 -0
- package/src/components/Pagination/Pagination.css +95 -0
- package/src/components/Pagination/Pagination.stories.tsx +117 -0
- package/src/components/Pagination/Pagination.tsx +149 -0
- package/src/components/Pagination/index.ts +11 -0
- package/src/components/Picker/Picker.css +220 -0
- package/src/components/Picker/Picker.stories.tsx +318 -0
- package/src/components/Picker/Picker.tsx +203 -0
- package/src/components/Picker/index.ts +10 -0
- package/src/components/Price/Price.css +57 -0
- package/src/components/Price/Price.stories.tsx +110 -0
- package/src/components/Price/Price.tsx +75 -0
- package/src/components/Price/index.ts +10 -0
- package/src/components/PriceRange/PriceRange.css +66 -0
- package/src/components/PriceRange/PriceRange.stories.tsx +240 -0
- package/src/components/PriceRange/PriceRange.tsx +248 -0
- package/src/components/PriceRange/index.ts +11 -0
- package/src/components/ProgressSpinner/ProgressSpinner.css +91 -0
- package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +300 -0
- package/src/components/ProgressSpinner/ProgressSpinner.tsx +86 -0
- package/src/components/ProgressSpinner/index.ts +11 -0
- package/src/components/RadioButton/RadioButton.css +134 -0
- package/src/components/RadioButton/RadioButton.stories.tsx +126 -0
- package/src/components/RadioButton/RadioButton.tsx +86 -0
- package/src/components/RadioButton/index.ts +11 -0
- package/src/components/Skeleton/Skeleton.css +145 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +265 -0
- package/src/components/Skeleton/Skeleton.tsx +133 -0
- package/src/components/Skeleton/index.ts +10 -0
- package/src/components/Tag/Tag.css +26 -0
- package/src/components/Tag/Tag.stories.tsx +103 -0
- package/src/components/Tag/Tag.tsx +38 -0
- package/src/components/Tag/index.ts +11 -0
- package/src/components/TextArea/TextArea.css +140 -0
- package/src/components/TextArea/TextArea.stories.tsx +130 -0
- package/src/components/TextArea/TextArea.tsx +89 -0
- package/src/components/TextArea/index.ts +11 -0
- package/src/components/TextSwatch/TextSwatch.css +152 -0
- package/src/components/TextSwatch/TextSwatch.stories.tsx +277 -0
- package/src/components/TextSwatch/TextSwatch.tsx +131 -0
- package/src/components/TextSwatch/index.ts +11 -0
- package/src/components/ToggleButton/ToggleButton.css +95 -0
- package/src/components/ToggleButton/ToggleButton.stories.tsx +190 -0
- package/src/components/ToggleButton/ToggleButton.tsx +75 -0
- package/src/components/ToggleButton/index.ts +11 -0
- package/src/components/UIProvider/UIProvider.css +140 -0
- package/src/components/UIProvider/UIProvider.tsx +61 -0
- package/src/components/UIProvider/debugger.css +47 -0
- package/src/components/UIProvider/index.ts +10 -0
- package/src/components/UIProvider/normalize.css +26 -0
- package/src/components/index.ts +49 -0
- package/src/docs/API/event-bus.mdx +52 -0
- package/src/docs/API/graphql.mdx +214 -0
- package/src/docs/API/initializer.mdx +119 -0
- package/src/docs/API/render.mdx +125 -0
- package/src/docs/Design/colors.mdx +202 -0
- package/src/docs/Design/designBlocks.jsx +87 -0
- package/src/docs/Design/getTokenData.ts +28 -0
- package/src/docs/Design/grid.mdx +365 -0
- package/src/docs/Design/overview.mdx +69 -0
- package/src/docs/Design/shapes.mdx +100 -0
- package/src/docs/Design/spacing.mdx +22 -0
- package/src/docs/Design/typography.mdx +126 -0
- package/src/docs/Utilities/classList.mdx +52 -0
- package/src/docs/Utilities/debounce.mdx +49 -0
- package/src/docs/Utilities/deepmerge.mdx +12 -0
- package/src/docs/Utilities/getFormErrors.mdx +41 -0
- package/src/docs/Utilities/getFormValues.mdx +38 -0
- package/src/docs/assets/Banner.png +0 -0
- package/src/docs/assets/Colors.png +0 -0
- package/src/docs/assets/DropinBanner.png +0 -0
- package/src/docs/assets/ShapeStyles.png +0 -0
- package/src/docs/assets/Spacing.png +0 -0
- package/src/docs/assets/Typography.png +0 -0
- package/src/docs/cli-usage.mdx +181 -0
- package/src/docs/components/overview.mdx +124 -0
- package/src/docs/quick-start.mdx +245 -0
- package/src/docs/slots.mdx +211 -0
- package/src/docs/welcome.mdx +52 -0
- package/src/i18n/en_US.json +146 -0
- package/src/i18n/index.ts +26 -0
- package/src/icons/Add.svg +9 -0
- package/src/icons/AddressBook.svg +3 -0
- package/src/icons/Bulk.svg +24 -0
- package/src/icons/Burger.svg +5 -0
- package/src/icons/Card.svg +7 -0
- package/src/icons/Cart.svg +11 -0
- package/src/icons/Check.svg +8 -0
- package/src/icons/CheckWithCircle.svg +4 -0
- package/src/icons/ChevronDown.svg +3 -0
- package/src/icons/ChevronRight.svg +8 -0
- package/src/icons/ChevronUp.svg +3 -0
- package/src/icons/Close.svg +4 -0
- package/src/icons/Coupon.svg +3 -0
- package/src/icons/Date.svg +4 -0
- package/src/icons/Delivery.svg +11 -0
- package/src/icons/EmptyBox.svg +3 -0
- package/src/icons/Eye.svg +3 -0
- package/src/icons/EyeClose.svg +3 -0
- package/src/icons/Gift.svg +3 -0
- package/src/icons/GiftCard.svg +3 -0
- package/src/icons/Heart.svg +3 -0
- package/src/icons/HeartFilled.svg +3 -0
- package/src/icons/InfoFilled.svg +3 -0
- package/src/icons/Locker.svg +11 -0
- package/src/icons/Minus.svg +3 -0
- package/src/icons/Order.svg +6 -0
- package/src/icons/OrderError.svg +15 -0
- package/src/icons/OrderSuccess.svg +15 -0
- package/src/icons/PaymentError.svg +16 -0
- package/src/icons/Placeholder.svg +3 -0
- package/src/icons/PlaceholderFilled.svg +4 -0
- package/src/icons/Search.svg +9 -0
- package/src/icons/SearchFilled.svg +10 -0
- package/src/icons/Sort.svg +12 -0
- package/src/icons/Star.svg +8 -0
- package/src/icons/Trash.svg +7 -0
- package/src/icons/User.svg +5 -0
- package/src/icons/View.svg +14 -0
- package/src/icons/Wallet.svg +6 -0
- package/src/icons/Warning.svg +12 -0
- package/src/icons/WarningFilled.svg +3 -0
- package/src/icons/WarningWithCircle.svg +4 -0
- package/src/icons/index.ts +42 -0
- package/src/lib/classes.ts +34 -0
- package/src/lib/config.ts +24 -0
- package/src/lib/debounce.ts +16 -0
- package/src/lib/deepmerge.ts +45 -0
- package/src/lib/deviceUtils.ts +16 -0
- package/src/lib/form-values.ts +31 -0
- package/src/lib/i18n.ts +18 -0
- package/src/lib/image-params-keymap.ts +36 -0
- package/src/lib/index.ts +24 -0
- package/src/lib/initializer.ts +134 -0
- package/src/lib/is-number.ts +12 -0
- package/src/lib/render.tsx +138 -0
- package/src/lib/resolve-image.ts +101 -0
- package/src/lib/signals.ts +11 -0
- package/src/lib/slot.tsx +434 -0
- package/src/lib/tests.tsx +47 -0
- package/src/lib/types.ts +16 -0
- package/src/lib/vcomponent.tsx +42 -0
- package/static/assets/images/Card.png +0 -0
- package/static/assets/images/example.jpg +0 -0
- package/static/assets/images/index.ts +11 -0
- package/static/dropin.png +0 -0
- package/static/favicon.svg +14 -0
- package/storybook-stories.js +21 -0
- package/tests/__mocks__/browserMocks.ts +28 -0
- package/tests/__mocks__/fileMocks.ts +12 -0
- package/tests/__mocks__/styleMock.ts +0 -0
- package/types/icons.d.ts +18 -0
package/config/vite.mjs
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
import { glob } from 'glob';
|
|
11
|
+
import { createRequire } from 'node:module';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { loadEnv } from 'vite';
|
|
14
|
+
|
|
15
|
+
// Plugins
|
|
16
|
+
import preact from '@preact/preset-vite';
|
|
17
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
18
|
+
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
|
19
|
+
import dts from 'vite-plugin-dts';
|
|
20
|
+
import svgr from 'vite-plugin-svgr';
|
|
21
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
22
|
+
import banner from 'vite-plugin-banner';
|
|
23
|
+
|
|
24
|
+
// Load .env files
|
|
25
|
+
const env = loadEnv('', process.cwd());
|
|
26
|
+
|
|
27
|
+
// Load Elsie Config
|
|
28
|
+
const elsieConfig = await import(
|
|
29
|
+
path.resolve(process.cwd(), './.elsie.js')
|
|
30
|
+
).then((m) => m.default);
|
|
31
|
+
|
|
32
|
+
// Paths
|
|
33
|
+
const paths = {
|
|
34
|
+
api: elsieConfig.api?.root
|
|
35
|
+
? path.resolve(process.cwd(), elsieConfig.api.root)
|
|
36
|
+
: undefined,
|
|
37
|
+
|
|
38
|
+
containers: elsieConfig.containers?.root
|
|
39
|
+
? path.resolve(process.cwd(), elsieConfig.containers.root)
|
|
40
|
+
: undefined,
|
|
41
|
+
|
|
42
|
+
fragments: elsieConfig.api?.fragments
|
|
43
|
+
? path.resolve(
|
|
44
|
+
process.cwd(),
|
|
45
|
+
elsieConfig.api.root,
|
|
46
|
+
elsieConfig.api.fragments
|
|
47
|
+
)
|
|
48
|
+
: undefined,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const isProd = process.env.NODE_ENV !== 'development';
|
|
52
|
+
|
|
53
|
+
const currentYear = new Date().getFullYear();
|
|
54
|
+
const input = {
|
|
55
|
+
// render.js
|
|
56
|
+
render: path.resolve(process.cwd(), './src/render/index.ts'),
|
|
57
|
+
|
|
58
|
+
// containers/*.js
|
|
59
|
+
...(paths.containers
|
|
60
|
+
? glob
|
|
61
|
+
.sync(path.resolve(paths.containers, '**/*/index.ts'))
|
|
62
|
+
.reduce((entries, entry) => {
|
|
63
|
+
const containerRegEx = new RegExp(
|
|
64
|
+
`${paths.containers}/(.*)/index.ts`
|
|
65
|
+
);
|
|
66
|
+
const key = RegExp(containerRegEx).exec(entry)[1];
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
...entries,
|
|
70
|
+
[`containers/${key}`]: entry,
|
|
71
|
+
};
|
|
72
|
+
}, {})
|
|
73
|
+
: {}),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
if (paths.api) {
|
|
77
|
+
input.api = path.resolve(paths.api, 'index.ts');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (paths.fragments) {
|
|
81
|
+
input.fragments = path.resolve(paths.fragments);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default {
|
|
85
|
+
preview: {
|
|
86
|
+
host: true,
|
|
87
|
+
port: env.PORT ?? 3002,
|
|
88
|
+
strictPort: true,
|
|
89
|
+
cors: {
|
|
90
|
+
origin: '*',
|
|
91
|
+
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
|
|
92
|
+
allowedHeaders: ['X-Requested-With', 'content-type', 'Authorization'],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
resolve: {
|
|
97
|
+
alias: {
|
|
98
|
+
react: 'preact/compat',
|
|
99
|
+
'react-dom/test-utils': 'preact/test-utils',
|
|
100
|
+
'react-dom': 'preact/compat', // Must be below test-utils
|
|
101
|
+
'react/jsx-runtime': 'preact/jsx-runtime',
|
|
102
|
+
'@adobe-commerce/elsie/config': '@adobe-commerce/elsie/config', // storybook
|
|
103
|
+
'@adobe-commerce/elsie': '@adobe-commerce/elsie/src',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
build: {
|
|
108
|
+
rollupOptions: {
|
|
109
|
+
preserveEntrySignatures: 'allow-extension',
|
|
110
|
+
|
|
111
|
+
input,
|
|
112
|
+
|
|
113
|
+
output: {
|
|
114
|
+
format: 'esm',
|
|
115
|
+
minifyInternalExports: true,
|
|
116
|
+
entryFileNames: '[name].js',
|
|
117
|
+
assetFileNames: '[name].[ext]',
|
|
118
|
+
chunkFileNames: 'chunks/[name].js',
|
|
119
|
+
|
|
120
|
+
manualChunks: (id) => {
|
|
121
|
+
if (id.includes(paths.fragments)) {
|
|
122
|
+
// Fragments file does not accept chunking
|
|
123
|
+
return 'no-chunk';
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
paths: {
|
|
129
|
+
// Preact
|
|
130
|
+
preact: '@dropins/tools/preact.js',
|
|
131
|
+
'preact/compat': '@dropins/tools/preact-compat.js',
|
|
132
|
+
'preact/hooks': '@dropins/tools/preact-hooks.js',
|
|
133
|
+
'preact/jsx-runtime': '@dropins/tools/preact-jsx-runtime.js',
|
|
134
|
+
'preact-i18n': '@dropins/tools/i18n.js',
|
|
135
|
+
|
|
136
|
+
// Signals
|
|
137
|
+
'@preact/signals': '@dropins/tools/signals.js',
|
|
138
|
+
|
|
139
|
+
// SDK Tools
|
|
140
|
+
'@adobe-commerce/event-bus': '@dropins/tools/event-bus.js',
|
|
141
|
+
'@adobe-commerce/fetch-graphql': '@dropins/tools/fetch-graphql.js',
|
|
142
|
+
'@adobe-commerce/recaptcha': '@dropins/tools/recaptcha.js',
|
|
143
|
+
|
|
144
|
+
// Lib
|
|
145
|
+
'@adobe-commerce/elsie/lib': '@dropins/tools/lib.js',
|
|
146
|
+
|
|
147
|
+
// Components
|
|
148
|
+
'@adobe-commerce/elsie/components': '@dropins/tools/components.js',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
external: [
|
|
153
|
+
// Preact
|
|
154
|
+
'preact',
|
|
155
|
+
'preact/compat',
|
|
156
|
+
'preact/hooks',
|
|
157
|
+
'preact/jsx-runtime',
|
|
158
|
+
'preact-i18n',
|
|
159
|
+
|
|
160
|
+
// Signals
|
|
161
|
+
'@preact/signals',
|
|
162
|
+
|
|
163
|
+
// SDK Tools
|
|
164
|
+
'@adobe-commerce/event-bus',
|
|
165
|
+
'@adobe-commerce/fetch-graphql',
|
|
166
|
+
'@adobe-commerce/recaptcha',
|
|
167
|
+
|
|
168
|
+
// Lib
|
|
169
|
+
'@adobe-commerce/elsie/lib',
|
|
170
|
+
|
|
171
|
+
// Components
|
|
172
|
+
'@adobe-commerce/elsie/components',
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
modulePreload: false,
|
|
177
|
+
commonjsOptions: { transformMixedEsModules: true },
|
|
178
|
+
minify: !!isProd,
|
|
179
|
+
sourcemap: !isProd,
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
optimizeDeps: {},
|
|
183
|
+
|
|
184
|
+
esbuild: {
|
|
185
|
+
jsx: 'automatic',
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
plugins: [
|
|
189
|
+
banner(`Copyright ${currentYear} Adobe\nAll Rights Reserved.`),
|
|
190
|
+
|
|
191
|
+
tsconfigPaths(),
|
|
192
|
+
|
|
193
|
+
cssInjectedByJsPlugin({
|
|
194
|
+
styleId: `${elsieConfig.name}`,
|
|
195
|
+
injectionCodeFormat: 'esm',
|
|
196
|
+
|
|
197
|
+
jsAssetsFilterFunction: function jsAssetsFilterFunction(asset) {
|
|
198
|
+
// include CSS injection code in the render
|
|
199
|
+
return (
|
|
200
|
+
// for dropins
|
|
201
|
+
asset.fileName.endsWith('render.js') ||
|
|
202
|
+
// for storybook
|
|
203
|
+
asset.fileName.startsWith('assets/UIProvider')
|
|
204
|
+
);
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
injectCodeFunction: function injectCodeCustomRunTimeFunction(
|
|
208
|
+
cssCode,
|
|
209
|
+
options
|
|
210
|
+
) {
|
|
211
|
+
try {
|
|
212
|
+
if (typeof document != 'undefined') {
|
|
213
|
+
const elem = document.createElement('style');
|
|
214
|
+
const name = options.styleId;
|
|
215
|
+
|
|
216
|
+
// SET ALL ATTRIBUTES
|
|
217
|
+
for (const attribute in options.attributes) {
|
|
218
|
+
elem.setAttribute(attribute, options.attributes[attribute]);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
elem.setAttribute('data-dropin', name);
|
|
222
|
+
|
|
223
|
+
elem.appendChild(document.createTextNode(cssCode));
|
|
224
|
+
|
|
225
|
+
const sdk = document.querySelector('style[data-dropin="sdk"]');
|
|
226
|
+
|
|
227
|
+
if (sdk) {
|
|
228
|
+
// add after sdk
|
|
229
|
+
sdk.after(elem);
|
|
230
|
+
} else {
|
|
231
|
+
// Inject in head before the first <link> or <style> tag.
|
|
232
|
+
const base = document.querySelector(
|
|
233
|
+
'link[rel="stylesheet"], style'
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
if (base) {
|
|
237
|
+
// add before base
|
|
238
|
+
base.before(elem);
|
|
239
|
+
} else {
|
|
240
|
+
// inject at the top of head
|
|
241
|
+
document.head.append(elem);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} catch (e) {
|
|
246
|
+
console.error('dropin-styles (injectCodeFunction)', e);
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
}),
|
|
250
|
+
|
|
251
|
+
preact(),
|
|
252
|
+
|
|
253
|
+
svgr({ include: '**/*.svg' }),
|
|
254
|
+
|
|
255
|
+
dts({
|
|
256
|
+
logLevel: 'silent',
|
|
257
|
+
clearPureImport: true,
|
|
258
|
+
insertTypesEntry: true,
|
|
259
|
+
include: [
|
|
260
|
+
path.resolve(process.cwd(), 'src'),
|
|
261
|
+
path.resolve(process.cwd(), 'types'),
|
|
262
|
+
],
|
|
263
|
+
exclude: [
|
|
264
|
+
'**/*.stories.tsx',
|
|
265
|
+
'**/*.test.tsx',
|
|
266
|
+
'**/*.stories.ts',
|
|
267
|
+
'**/*.test.ts',
|
|
268
|
+
'node_modules',
|
|
269
|
+
],
|
|
270
|
+
|
|
271
|
+
beforeWriteFile: (filePath, content) => {
|
|
272
|
+
// Don't include d.t.s maps for prod builds.
|
|
273
|
+
if (isProd && filePath.endsWith('.d.ts.map')) return false;
|
|
274
|
+
|
|
275
|
+
// Normalize elsie imports to point to the correct paths
|
|
276
|
+
content = content.replace(
|
|
277
|
+
/'(.*@adobe\/elsie\/src\/)/g,
|
|
278
|
+
"'@dropins/tools/types/elsie/src/"
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
content = content.replace(
|
|
282
|
+
/'(@adobe\/elsie\/icons)'/g,
|
|
283
|
+
"'@dropins/tools/types/elsie/src/icons'"
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
return { filePath, content };
|
|
287
|
+
},
|
|
288
|
+
}),
|
|
289
|
+
|
|
290
|
+
process.env.ANALYZE
|
|
291
|
+
? visualizer({
|
|
292
|
+
title: `${elsieConfig.name} Dropin Bundle Analysis`,
|
|
293
|
+
filename: 'dist/stats.html',
|
|
294
|
+
open: true,
|
|
295
|
+
template: 'treemap',
|
|
296
|
+
})
|
|
297
|
+
: null,
|
|
298
|
+
],
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export function getPathFromModule(module, pathname = '.') {
|
|
302
|
+
const require = createRequire(import.meta.url);
|
|
303
|
+
const pkgJSON = require.resolve(`${module}/package.json`);
|
|
304
|
+
const pkgPath = path.dirname(pkgJSON);
|
|
305
|
+
return path.resolve(pkgPath, pathname);
|
|
306
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adobe-commerce/elsie",
|
|
3
|
+
"version": "1.0.0-alpha04071347",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
|
+
"description": "Domain Package SDK",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18"
|
|
8
|
+
},
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"main": "./package.json",
|
|
11
|
+
"bin": {
|
|
12
|
+
"elsie": "./bin/index.js"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "concurrently 'yarn storybook' 'yarn serve'",
|
|
16
|
+
"storybook": "elsie storybook",
|
|
17
|
+
"serve": "elsie serve --config vite.config.mjs",
|
|
18
|
+
"lint": "elsie lint --max-warnings=0",
|
|
19
|
+
"test": "elsie test",
|
|
20
|
+
"test:ci": "jest --config jest.config.js --passWithNoTests --coverage",
|
|
21
|
+
"build": "elsie build --config vite.config.mjs",
|
|
22
|
+
"analyze": "ANALYZE=true elsie build --config vite.config.mjs",
|
|
23
|
+
"build-storybook": "storybook build --disable-telemetry",
|
|
24
|
+
"test-storybook": "test-storybook",
|
|
25
|
+
"test-storybook-ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npx http-server storybook-static --port 6006 --silent\" \"npx wait-on tcp:127.0.0.1:6006 && test-storybook\"",
|
|
26
|
+
"cleanup": "rimraf dist"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@adobe-commerce/event-bus": "~1.0.0",
|
|
30
|
+
"@adobe-commerce/fetch-graphql": "~1.0.0",
|
|
31
|
+
"@adobe-commerce/recaptcha": "~1.0.0",
|
|
32
|
+
"@adobe-commerce/storefront-design": "~1.0.0",
|
|
33
|
+
"@dropins/build-tools": "~1.0.0",
|
|
34
|
+
"preact": "~10.22.1",
|
|
35
|
+
"vite-plugin-banner": "^0.8.0"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@babel/core": "^7.24.9",
|
|
39
|
+
"@babel/preset-env": "^7.24.8",
|
|
40
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
41
|
+
"@chromatic-com/storybook": "^1",
|
|
42
|
+
"@graphql-codegen/cli": "^5.0.0",
|
|
43
|
+
"@graphql-codegen/client-preset": "^4.1.0",
|
|
44
|
+
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
45
|
+
"@preact/preset-vite": "^2.8.2",
|
|
46
|
+
"@preact/signals": "1.3.0",
|
|
47
|
+
"@storybook/addon-a11y": "^8.2.3",
|
|
48
|
+
"@storybook/addon-actions": "^8.2.3",
|
|
49
|
+
"@storybook/addon-coverage": "^1.0.1",
|
|
50
|
+
"@storybook/addon-essentials": "^8.2.3",
|
|
51
|
+
"@storybook/addon-interactions": "^8.2.3",
|
|
52
|
+
"@storybook/addon-links": "^8.2.3",
|
|
53
|
+
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
|
|
54
|
+
"@storybook/blocks": "^8.2.3",
|
|
55
|
+
"@storybook/manager-api": "^8.2.3",
|
|
56
|
+
"@storybook/preact": "^8.2.3",
|
|
57
|
+
"@storybook/preact-vite": "^8.2.3",
|
|
58
|
+
"@storybook/preact-webpack5": "^8.2.3",
|
|
59
|
+
"@storybook/storybook-deployer": "^2.8.16",
|
|
60
|
+
"@storybook/test": "^8.2.3",
|
|
61
|
+
"@storybook/test-runner": "^0.19.1",
|
|
62
|
+
"@storybook/theming": "^8.2.3",
|
|
63
|
+
"@svgr/webpack": "^8.1.0",
|
|
64
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
65
|
+
"@testing-library/preact": "^3.2.4",
|
|
66
|
+
"@types/css-modules": "^1.0.2",
|
|
67
|
+
"@types/jest": "^29.5.12",
|
|
68
|
+
"@types/preact-i18n": "^2.3.1",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
|
70
|
+
"@typescript-eslint/parser": "^5.32.0",
|
|
71
|
+
"axe-playwright": "^2.0.1",
|
|
72
|
+
"babel-jest": "^29.7.0",
|
|
73
|
+
"babel-loader": "^9.1.3",
|
|
74
|
+
"babel-plugin-tsconfig-paths": "^1.0.3",
|
|
75
|
+
"common-tags": "^1.8.2",
|
|
76
|
+
"concurrently": "^7.3.0",
|
|
77
|
+
"core-js": "^3.24.0",
|
|
78
|
+
"cssnano": "^6.0.1",
|
|
79
|
+
"deepmerge": "^4.2.2",
|
|
80
|
+
"detect-package-manager": "^3.0.2",
|
|
81
|
+
"dotenv": "^16.0.1",
|
|
82
|
+
"eslint": "^8.21.0",
|
|
83
|
+
"eslint-config-preact": "^1.3.0",
|
|
84
|
+
"eslint-config-prettier": "^8.5.0",
|
|
85
|
+
"eslint-plugin-mdx": "^2.1.0",
|
|
86
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
87
|
+
"glob": "^10.3.15",
|
|
88
|
+
"graphql": "^16.7.1",
|
|
89
|
+
"graphql-codegen-typescript-mock-data": "^3.5.0",
|
|
90
|
+
"graphql-config": "^5.0.2",
|
|
91
|
+
"jest": "^29.7.0",
|
|
92
|
+
"jest-preset-preact": "^4.1.1",
|
|
93
|
+
"optimize-plugin": "^1.3.1",
|
|
94
|
+
"postcss": "^8.4.39",
|
|
95
|
+
"preact-i18n": "2.4.0-preactx",
|
|
96
|
+
"preact-render-to-string": "^5.1.4",
|
|
97
|
+
"prettier": "^2.7.1",
|
|
98
|
+
"react": "^18.2.0",
|
|
99
|
+
"react-dom": "^18.2.0",
|
|
100
|
+
"rimraf": "^3.0.2",
|
|
101
|
+
"rollup-plugin-visualizer": "^5.12.0",
|
|
102
|
+
"storybook": "^8.2.3",
|
|
103
|
+
"typescript": "^4.7.3",
|
|
104
|
+
"vite": "^5.2.10",
|
|
105
|
+
"vite-plugin-banner": "^0.8.0",
|
|
106
|
+
"vite-plugin-css-injected-by-js": "^3.5.1",
|
|
107
|
+
"vite-plugin-dts": "^3.9.1",
|
|
108
|
+
"vite-plugin-svgr": "^4.2.0",
|
|
109
|
+
"vite-tsconfig-paths": "^4.3.2",
|
|
110
|
+
"webpack": "^5.93.0",
|
|
111
|
+
"yargs": "^17.5.1"
|
|
112
|
+
}
|
|
113
|
+
}
|
package/post-release.sh
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2024 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
|
|
10
|
+
/* https://cssguidelin.es/#bem-like-naming */
|
|
11
|
+
|
|
12
|
+
.dropin-accordion-section__heading {
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: 1fr max-content;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dropin-accordion-section p {
|
|
18
|
+
font: var(--type-body-1-default-font);
|
|
19
|
+
letter-spacing: var(--type-body-1-default-letter-spacing);
|
|
20
|
+
color: var(--color-neutral-700);
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dropin-accordion-section__flex {
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dropin-accordion-section__title-container,
|
|
32
|
+
.dropin-accordion-section__secondary-text-container {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: var(--spacing-xsmall);
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dropin-accordion-section__secondary-text-container h4 {
|
|
39
|
+
margin: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dropin-accordion-section__title-container h3 {
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dropin-accordion-section__title {
|
|
47
|
+
color: var(--color-neutral-800);
|
|
48
|
+
font: var(--type-body-1-strong-font);
|
|
49
|
+
letter-spacing: var(--type-body-1-strong-letter-spacing);
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.dropin-accordion-section__secondary-text {
|
|
54
|
+
color: var(--color-neutral-700);
|
|
55
|
+
font: var(--type-body-2-default-font);
|
|
56
|
+
letter-spacing: var(--type-body-1-default-letter-spacing);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.dropin-accordion-section__secondary-text a {
|
|
60
|
+
font: var(--type-body-2-strong-font);
|
|
61
|
+
letter-spacing: var(--type-body-2-strong-letter-spacing);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dropin-accordion-section svg {
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dropin-accordion-section__content-container {
|
|
69
|
+
display: grid;
|
|
70
|
+
margin: var(--spacing-medium) 0;
|
|
71
|
+
gap: var(--spacing-medium);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.dropin-accordion-section__content-container:empty {
|
|
75
|
+
margin: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Medium (portrait tablets and large phones, 768px and up) */
|
|
79
|
+
/* @media only screen and (min-width: 768px) { } */
|
|
80
|
+
|
|
81
|
+
/* Large (landscape tablets, 1024px and up) */
|
|
82
|
+
/* @media only screen and (min-width: 1024px) { } */
|
|
83
|
+
|
|
84
|
+
/* XLarge (laptops/desktops, 1366px and up) */
|
|
85
|
+
/* @media only screen and (min-width: 1366px) { } */
|
|
86
|
+
|
|
87
|
+
/* XXlarge (large laptops and desktops, 1920px and up) */
|
|
88
|
+
/* @media only screen and (min-width: 1920px) { } */
|