diff --git a/.changeset/feat-styled-tags-export.md b/.changeset/feat-styled-tags-export.md new file mode 100644 index 0000000000..ff713f9323 --- /dev/null +++ b/.changeset/feat-styled-tags-export.md @@ -0,0 +1,5 @@ +--- +"@emotion/styled": minor +--- + +Added ability to import tags directly from '@emotion/styled/tags' \ No newline at end of file diff --git a/packages/styled/package.json b/packages/styled/package.json index c79ba24c25..2571f6f764 100644 --- a/packages/styled/package.json +++ b/packages/styled/package.json @@ -39,11 +39,66 @@ "files": [ "src", "dist", + "tags", "base", "macro.*" ], "umd:main": "dist/emotion-styled.umd.min.js", "exports": { + "./tags": { + "types": { + "import": "./tags/dist/emotion-styled-tags.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.cjs.js" + }, + "development": { + "edge-light": { + "module": "./tags/dist/emotion-styled-tags.development.edge-light.esm.js", + "import": "./tags/dist/emotion-styled-tags.development.edge-light.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.development.edge-light.cjs.js" + }, + "worker": { + "module": "./tags/dist/emotion-styled-tags.development.edge-light.esm.js", + "import": "./tags/dist/emotion-styled-tags.development.edge-light.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.development.edge-light.cjs.js" + }, + "workerd": { + "module": "./tags/dist/emotion-styled-tags.development.edge-light.esm.js", + "import": "./tags/dist/emotion-styled-tags.development.edge-light.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.development.edge-light.cjs.js" + }, + "browser": { + "module": "./tags/dist/emotion-styled-tags.browser.development.esm.js", + "import": "./tags/dist/emotion-styled-tags.browser.development.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.browser.development.cjs.js" + }, + "module": "./tags/dist/emotion-styled-tags.development.esm.js", + "import": "./tags/dist/emotion-styled-tags.development.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.development.cjs.js" + }, + "edge-light": { + "module": "./tags/dist/emotion-styled-tags.edge-light.esm.js", + "import": "./tags/dist/emotion-styled-tags.edge-light.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.edge-light.cjs.js" + }, + "worker": { + "module": "./tags/dist/emotion-styled-tags.edge-light.esm.js", + "import": "./tags/dist/emotion-styled-tags.edge-light.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.edge-light.cjs.js" + }, + "workerd": { + "module": "./tags/dist/emotion-styled-tags.edge-light.esm.js", + "import": "./tags/dist/emotion-styled-tags.edge-light.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.edge-light.cjs.js" + }, + "browser": { + "module": "./tags/dist/emotion-styled-tags.browser.esm.js", + "import": "./tags/dist/emotion-styled-tags.browser.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.browser.cjs.js" + }, + "module": "./tags/dist/emotion-styled-tags.esm.js", + "import": "./tags/dist/emotion-styled-tags.cjs.mjs", + "default": "./tags/dist/emotion-styled-tags.cjs.js" + }, "./base": { "types": { "import": "./base/dist/emotion-styled-base.cjs.mjs", @@ -177,6 +232,7 @@ "preconstruct": { "umdName": "emotionStyled", "entrypoints": [ + "./tags.ts", "./index.ts", "./base.tsx" ], diff --git a/packages/styled/src/index.ts b/packages/styled/src/index.ts index 2d8877ff1a..7d145b1f5e 100644 --- a/packages/styled/src/index.ts +++ b/packages/styled/src/index.ts @@ -1,7 +1,7 @@ import { Theme } from '@emotion/react' import styled from './base' import { ReactJSXIntrinsicElements } from './jsx-namespace' -import { tags } from './tags' +import tags from './tags' import { CreateStyledComponent, CreateStyled as BaseCreateStyled diff --git a/packages/styled/src/tags.ts b/packages/styled/src/tags.ts index 437bd1a03f..35d312bdfe 100644 --- a/packages/styled/src/tags.ts +++ b/packages/styled/src/tags.ts @@ -1,4 +1,4 @@ -export const tags = [ +export default [ 'a', 'abbr', 'address', diff --git a/packages/styled/tags/package.json b/packages/styled/tags/package.json new file mode 100644 index 0000000000..b22de201f2 --- /dev/null +++ b/packages/styled/tags/package.json @@ -0,0 +1,9 @@ +{ + "main": "dist/emotion-styled-tags.cjs.js", + "module": "dist/emotion-styled-tags.esm.js", + "umd:main": "dist/emotion-styled-tags.umd.min.js", + "types": "dist/emotion-styled-tags.cjs.d.ts", + "preconstruct": { + "umdName": "emotionStyledTags" + } +}