Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(headless,atomic): add type "module" to atomic, atomic-react and headless #4442

Merged
merged 21 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/atomic-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@coveo/atomic-react",
"sideEffects": false,
"type": "module",
"version": "3.0.2",
"description": "React specific wrapper for the Atomic component library",
"repository": {
Expand Down
File renamed without changes.
14 changes: 13 additions & 1 deletion packages/atomic/.storybook/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isCDN = process.env.DEPLOYMENT_ENVIRONMENT === 'CDN';

const config: StorybookConfig = {
stories: ['../src/**/*.new.stories.@(js|jsx|ts|tsx|mdx)'],
staticDirs: [{from: '../dist/atomic', to: './assets'}],
staticDirs: [{from: '../dist/atomic', to: './assets'},{from: '../dist/atomic/lang', to: './lang'}],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-interactions',
Expand All @@ -24,11 +24,23 @@ const config: StorybookConfig = {
mergeConfig(config, {
plugins: [
nxViteTsPaths(),
resolveStorybookUtils(),
configType === 'PRODUCTION' && isCDN && externalizeDependencies(),
],
}),
};

function resolveStorybookUtils() {
return {
name: 'resolve-storybook-utils',
async resolveId(source: string, importer: unknown, options: unknown) {
if (source.startsWith('@coveo/atomic-storybook-utils')) {
return this.resolve(source.replace('@coveo/atomic-storybook-utils', path.resolve(__dirname, '../storybookUtils')),importer,options);
}
},
};
}1

function externalizeDependencies() {
return {
name: 'externalize-dependencies',
Expand Down
6 changes: 4 additions & 2 deletions packages/atomic/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import '@coveo/atomic/dist/atomic/atomic.esm.js';
import '@coveo/atomic/dist/atomic/themes/coveo.css';
import {defineCustomElements} from '@coveo/atomic/loader';
import '@coveo/atomic/themes/coveo.css';
import {setCustomElementsManifest} from '@storybook/web-components';
import customElements from '../custom-elements.json';

defineCustomElements();

setCustomElementsManifest(customElements);

export const parameters = {
Expand Down
35 changes: 27 additions & 8 deletions packages/atomic/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@coveo/atomic",
"type": "module",
"version": "3.1.1",
"description": "A web-component library for building modern UIs interfacing with the Coveo platform",
"homepage": "https://docs.coveo.com/en/atomic/latest/",
Expand All @@ -10,18 +11,36 @@
},
"main": "dist/index.cjs.js",
"module": "dist/index.js",
"es2015": "dist/esm/index.mjs",
"es2017": "dist/esm/index.mjs",
"types": "dist/types/index.d.ts",
"collection": "collection-manifest.json",
"collection:main": "dist/index.js",
"unpkg": "dist/atomic/atomic.esm.js",
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
"exports": {
"./loader": {
"import": "./loader/index.js",
"require": "./loader/index.cjs.js",
"types": "./loader/index.d.ts"
},
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs.js",
"types": "./dist/types/index.d.ts"
},
"./themes/*": {
"import": "./dist/atomic/themes/*",
"require": "./dist/atomic/themes/*"
},
"./assets/*": {
"import": "./dist/atomic/assets/*",
"require": "./dist/atomic/assets/*"
},
"./lang/*": {
"import": "./dist/atomic/lang/*",
"require": "./dist/atomic/lang/*"
}
},
"files": [
"dist/",
"loader/",
louis-bompart marked this conversation as resolved.
Show resolved Hide resolved
"docs/",
"licenses/",
"collection-manifest.json"
"licenses/"
],
"scripts": {
"clean": "rimraf -rf dist/*",
Expand Down Expand Up @@ -66,7 +85,7 @@
"devDependencies": {
"@axe-core/playwright": "4.9.1",
"@babel/core": "7.24.9",
"@coveo/atomic": "file:.",
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
"@coveo/atomic-storybook-utils": "file:./storybookUtils",
"@coveo/release": "1.0.0",
"@coveo/rollup-plugin-replace-with-ast": "1.0.0",
"@custom-elements-manifest/analyzer": "0.10.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
playExecuteFirstSearch,
wrapInCommerceInterface,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {
CommerceEngineConfiguration,
getSampleCommerceEngineConfiguration,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {getSampleCommerceEngineConfiguration} from '@coveo/headless/commerce';
import type {Meta, StoryObj as Story} from '@storybook/web-components';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
playExecuteFirstSearch,
wrapInCommerceInterface,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
playExecuteFirstSearch,
wrapInCommerceInterface,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
playExecuteFirstSearch,
wrapInCommerceInterface,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';

const {decorator, play} = wrapInCommerceInterface({skipFirstSearch: true});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
playExecuteFirstSearch,
wrapInCommerceInterface,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {CommerceEngineConfiguration} from '@coveo/headless/dist/definitions/commerce.index';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit-html/static.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {wrapInCommerceInterface} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInCommerceInterface} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {wrapInCommerceInterface} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInCommerceInterface} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';

const {decorator, play} = wrapInCommerceInterface({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {wrapInCommerceInterface} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInCommerceInterface} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {CommerceEngineConfiguration} from '@coveo/headless/commerce';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
playExecuteFirstSearch,
wrapInCommerceInterface,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {wrapInCommerceInterface} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInCommerceInterface} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {within} from '@storybook/test';
import type {Meta, StoryObj as Story} from '@storybook/web-components';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
wrapInCommerceInterface,
playExecuteFirstSearch,
playKeepOnlyFirstFacetOfType,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit-html';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
wrapInCommerceInterface,
playExecuteFirstSearch,
playKeepOnlyFirstFacetOfType,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit-html';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
playExecuteFirstSearch,
wrapInCommerceInterface,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
wrapInCommerceInterface,
playExecuteFirstSearch,
playKeepOnlyFirstFacetOfType,
} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit-html';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {wrapInCommerceInterface} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {wrapInCommerceProductList} from '@coveo/atomic/storybookUtils/commerce/commerce-product-list-wrapper';
import {wrapInProductTemplate} from '@coveo/atomic/storybookUtils/commerce/commerce-product-template-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInCommerceInterface} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {wrapInCommerceProductList} from '@coveo/atomic-storybook-utils/commerce/commerce-product-list-wrapper';
import {wrapInProductTemplate} from '@coveo/atomic-storybook-utils/commerce/commerce-product-template-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit-html';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {wrapInCommerceInterface} from '@coveo/atomic/storybookUtils/commerce/commerce-interface-wrapper';
import {wrapInCommerceProductList} from '@coveo/atomic/storybookUtils/commerce/commerce-product-list-wrapper';
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponentWithoutCodeRoot} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInCommerceInterface} from '@coveo/atomic-storybook-utils/commerce/commerce-interface-wrapper';
import {wrapInCommerceProductList} from '@coveo/atomic-storybook-utils/commerce/commerce-product-list-wrapper';
import {wrapInCommerceRecommendationInterface} from '@coveo/atomic-storybook-utils/commerce/commerce-recommendation-interface-wrapper';
import {wrapInCommerceRecommendationList} from '@coveo/atomic-storybook-utils/commerce/commerce-recommendation-list-wrapper';
import {wrapInCommerceSearchBoxInstantProducts} from '@coveo/atomic-storybook-utils/commerce/commerce-searchbox-instant-products-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponentWithoutCodeRoot} from '@coveo/atomic-storybook-utils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {within} from 'shadow-dom-testing-library';
import {wrapInCommerceRecommendationInterface} from '../../../../storybookUtils/commerce/commerce-recommendation-interface-wrapper';
import {wrapInCommerceRecommendationList} from '../../../../storybookUtils/commerce/commerce-recommendation-list-wrapper';
import {wrapInCommerceSearchBoxInstantProducts} from '../../../../storybookUtils/commerce/commerce-searchbox-instant-products-wrapper';

const TEMPLATE_EXAMPLE = `<template>
<atomic-product-section-name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInSearchInterface} from '@coveo/atomic/storybookUtils/search/search-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {wrapInSearchInterface} from '@coveo/atomic-storybook-utils/search/search-interface-wrapper';
import bgIcons from '@salesforce-ux/design-system/design-tokens/dist/bg-standard.common';
import {userEvent, waitFor, expect} from '@storybook/test';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInSearchInterface} from '@coveo/atomic/storybookUtils/search/search-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {wrapInSearchInterface} from '@coveo/atomic-storybook-utils/search/search-interface-wrapper';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import {wrapInSearchInterface} from '@coveo/atomic/storybookUtils/search/search-interface-wrapper';
import {parameters} from '@coveo/atomic-storybook-utils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic-storybook-utils/common/render-component';
import {wrapInSearchInterface} from '@coveo/atomic-storybook-utils/search/search-interface-wrapper';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {html} from 'lit/static-html.js';

Expand Down
Loading
Loading