@depup/react-email 5.2.10-depup.1 → 6.9.0-depup.1
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/CHANGELOG.md +313 -0
- package/README.md +11 -10
- package/changes.json +21 -17
- package/dev/CHANGELOG.md +2 -0
- package/dev/index.js +1 -1
- package/dev/package.json +1 -1
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cli/index.mjs +7801 -0
- package/dist/components/body/body.cjs +39 -0
- package/dist/components/body/body.d.cts +7 -0
- package/dist/components/body/body.d.mts +7 -0
- package/dist/components/body/body.mjs +37 -0
- package/dist/components/body/index.d.cts +1 -0
- package/dist/components/body/index.d.mts +1 -0
- package/dist/components/body/margin-properties.cjs +30 -0
- package/dist/components/body/margin-properties.mjs +29 -0
- package/dist/components/button/button.cjs +64 -0
- package/dist/components/button/button.d.cts +13 -0
- package/dist/components/button/button.d.mts +13 -0
- package/dist/components/button/button.mjs +62 -0
- package/dist/components/button/index.d.cts +1 -0
- package/dist/components/button/index.d.mts +1 -0
- package/dist/components/button/utils/parse-padding.cjs +90 -0
- package/dist/components/button/utils/parse-padding.mjs +90 -0
- package/dist/components/button/utils/px-to-pt.cjs +4 -0
- package/dist/components/button/utils/px-to-pt.mjs +4 -0
- package/dist/components/code-block/code-block.cjs +79 -0
- package/dist/components/code-block/code-block.d.cts +20 -0
- package/dist/components/code-block/code-block.d.mts +20 -0
- package/dist/components/code-block/code-block.mjs +77 -0
- package/dist/components/code-block/index.d.cts +3 -0
- package/dist/components/code-block/index.d.mts +3 -0
- package/dist/components/code-block/languages-available.d.cts +4 -0
- package/dist/components/code-block/languages-available.d.mts +4 -0
- package/dist/components/code-block/prism.cjs +14564 -0
- package/dist/components/code-block/prism.mjs +14562 -0
- package/dist/components/code-block/themes.cjs +2578 -0
- package/dist/components/code-block/themes.d.cts +4877 -0
- package/dist/components/code-block/themes.d.mts +4877 -0
- package/dist/components/code-block/themes.mjs +2541 -0
- package/dist/components/code-inline/code-inline.cjs +43 -0
- package/dist/components/code-inline/code-inline.d.cts +12 -0
- package/dist/components/code-inline/code-inline.d.mts +12 -0
- package/dist/components/code-inline/code-inline.mjs +41 -0
- package/dist/components/code-inline/index.d.cts +1 -0
- package/dist/components/code-inline/index.d.mts +1 -0
- package/dist/components/column/column.cjs +19 -0
- package/dist/components/column/column.d.cts +7 -0
- package/dist/components/column/column.d.mts +7 -0
- package/dist/components/column/column.mjs +17 -0
- package/dist/components/column/index.d.cts +1 -0
- package/dist/components/column/index.d.mts +1 -0
- package/dist/components/container/container.cjs +42 -0
- package/dist/components/container/container.d.cts +7 -0
- package/dist/components/container/container.d.mts +7 -0
- package/dist/components/container/container.mjs +40 -0
- package/dist/components/container/index.d.cts +1 -0
- package/dist/components/container/index.d.mts +1 -0
- package/dist/components/element-marker.cjs +8 -0
- package/dist/components/element-marker.mjs +7 -0
- package/dist/components/font/font.cjs +22 -0
- package/dist/components/font/font.d.cts +26 -0
- package/dist/components/font/font.d.mts +26 -0
- package/dist/components/font/font.mjs +21 -0
- package/dist/components/font/index.d.cts +1 -0
- package/dist/components/font/index.d.mts +1 -0
- package/dist/components/head/head.cjs +20 -0
- package/dist/components/head/head.d.cts +7 -0
- package/dist/components/head/head.d.mts +7 -0
- package/dist/components/head/head.mjs +18 -0
- package/dist/components/head/index.d.cts +1 -0
- package/dist/components/head/index.d.mts +1 -0
- package/dist/components/heading/heading.cjs +30 -0
- package/dist/components/heading/heading.d.cts +22 -0
- package/dist/components/heading/heading.d.mts +22 -0
- package/dist/components/heading/heading.mjs +28 -0
- package/dist/components/heading/index.d.cts +1 -0
- package/dist/components/heading/index.d.mts +1 -0
- package/dist/components/heading/utils/as.d.cts +16 -0
- package/dist/components/heading/utils/as.d.mts +16 -0
- package/dist/components/heading/utils/spaces.cjs +24 -0
- package/dist/components/heading/utils/spaces.d.cts +14 -0
- package/dist/components/heading/utils/spaces.d.mts +14 -0
- package/dist/components/heading/utils/spaces.mjs +24 -0
- package/dist/components/hr/hr.cjs +21 -0
- package/dist/components/hr/hr.d.cts +7 -0
- package/dist/components/hr/hr.d.mts +7 -0
- package/dist/components/hr/hr.mjs +19 -0
- package/dist/components/hr/index.d.cts +1 -0
- package/dist/components/hr/index.d.mts +1 -0
- package/dist/components/html/html.cjs +15 -0
- package/dist/components/html/html.d.cts +7 -0
- package/dist/components/html/html.d.mts +7 -0
- package/dist/components/html/html.mjs +13 -0
- package/dist/components/html/index.d.cts +1 -0
- package/dist/components/html/index.d.mts +1 -0
- package/dist/components/img/img.cjs +25 -0
- package/dist/components/img/img.d.cts +7 -0
- package/dist/components/img/img.d.mts +7 -0
- package/dist/components/img/img.mjs +23 -0
- package/dist/components/img/index.d.cts +1 -0
- package/dist/components/img/index.d.mts +1 -0
- package/dist/components/index.d.cts +24 -0
- package/dist/components/index.d.mts +24 -0
- package/dist/components/link/index.d.cts +1 -0
- package/dist/components/link/index.d.mts +1 -0
- package/dist/components/link/link.cjs +21 -0
- package/dist/components/link/link.d.cts +7 -0
- package/dist/components/link/link.d.mts +7 -0
- package/dist/components/link/link.mjs +19 -0
- package/dist/components/markdown/index.d.cts +1 -0
- package/dist/components/markdown/index.d.mts +1 -0
- package/dist/components/markdown/markdown.cjs +101 -0
- package/dist/components/markdown/markdown.d.cts +16 -0
- package/dist/components/markdown/markdown.d.mts +16 -0
- package/dist/components/markdown/markdown.mjs +99 -0
- package/dist/components/markdown/styles.cjs +92 -0
- package/dist/components/markdown/styles.d.cts +31 -0
- package/dist/components/markdown/styles.d.mts +31 -0
- package/dist/components/markdown/styles.mjs +92 -0
- package/dist/components/markdown/utils/parse-css-in-js-to-inline-css.cjs +60 -0
- package/dist/components/markdown/utils/parse-css-in-js-to-inline-css.mjs +60 -0
- package/dist/components/preview/index.d.cts +1 -0
- package/dist/components/preview/index.d.mts +1 -0
- package/dist/components/preview/preview.cjs +34 -0
- package/dist/components/preview/preview.d.cts +21 -0
- package/dist/components/preview/preview.d.mts +21 -0
- package/dist/components/preview/preview.mjs +31 -0
- package/dist/components/row/index.d.cts +1 -0
- package/dist/components/row/index.d.mts +1 -0
- package/dist/components/row/row.cjs +30 -0
- package/dist/components/row/row.d.cts +11 -0
- package/dist/components/row/row.d.mts +11 -0
- package/dist/components/row/row.mjs +28 -0
- package/dist/components/section/index.d.cts +1 -0
- package/dist/components/section/index.d.mts +1 -0
- package/dist/components/section/section.cjs +36 -0
- package/dist/components/section/section.d.cts +7 -0
- package/dist/components/section/section.d.mts +7 -0
- package/dist/components/section/section.mjs +34 -0
- package/dist/components/tailwind/hooks/use-suspended-promise.cjs +15 -0
- package/dist/components/tailwind/hooks/use-suspended-promise.mjs +15 -0
- package/dist/components/tailwind/index.d.cts +4 -0
- package/dist/components/tailwind/index.d.mts +4 -0
- package/dist/components/tailwind/inline-styles.cjs +11 -0
- package/dist/components/tailwind/inline-styles.d.cts +6 -0
- package/dist/components/tailwind/inline-styles.d.mts +6 -0
- package/dist/components/tailwind/inline-styles.mjs +11 -0
- package/dist/components/tailwind/sanitize-stylesheet.cjs +11 -0
- package/dist/components/tailwind/sanitize-stylesheet.d.cts +6 -0
- package/dist/components/tailwind/sanitize-stylesheet.d.mts +6 -0
- package/dist/components/tailwind/sanitize-stylesheet.mjs +11 -0
- package/dist/components/tailwind/tailwind.cjs +120 -0
- package/dist/components/tailwind/tailwind.d.cts +25 -0
- package/dist/components/tailwind/tailwind.d.mts +25 -0
- package/dist/components/tailwind/tailwind.mjs +117 -0
- package/dist/components/tailwind/utils/compatibility/get-react-property.cjs +10 -0
- package/dist/components/tailwind/utils/compatibility/get-react-property.mjs +10 -0
- package/dist/components/tailwind/utils/compatibility/sanitize-class-name.cjs +26 -0
- package/dist/components/tailwind/utils/compatibility/sanitize-class-name.mjs +26 -0
- package/dist/components/tailwind/utils/css/downlevel-for-email-clients.cjs +126 -0
- package/dist/components/tailwind/utils/css/downlevel-for-email-clients.mjs +125 -0
- package/dist/components/tailwind/utils/css/extract-rules-per-class.cjs +45 -0
- package/dist/components/tailwind/utils/css/extract-rules-per-class.mjs +44 -0
- package/dist/components/tailwind/utils/css/get-custom-properties.cjs +35 -0
- package/dist/components/tailwind/utils/css/get-custom-properties.mjs +34 -0
- package/dist/components/tailwind/utils/css/is-part-inlinable.cjs +10 -0
- package/dist/components/tailwind/utils/css/is-part-inlinable.mjs +9 -0
- package/dist/components/tailwind/utils/css/is-rule-inlinable.cjs +10 -0
- package/dist/components/tailwind/utils/css/is-rule-inlinable.mjs +9 -0
- package/dist/components/tailwind/utils/css/make-inline-styles-for.cjs +52 -0
- package/dist/components/tailwind/utils/css/make-inline-styles-for.mjs +51 -0
- package/dist/components/tailwind/utils/css/resolve-all-css-variables.cjs +89 -0
- package/dist/components/tailwind/utils/css/resolve-all-css-variables.mjs +88 -0
- package/dist/components/tailwind/utils/css/resolve-calc-expressions.cjs +92 -0
- package/dist/components/tailwind/utils/css/resolve-calc-expressions.mjs +91 -0
- package/dist/components/tailwind/utils/css/sanitize-declarations.cjs +310 -0
- package/dist/components/tailwind/utils/css/sanitize-declarations.mjs +309 -0
- package/dist/components/tailwind/utils/css/sanitize-non-inlinable-rules.cjs +46 -0
- package/dist/components/tailwind/utils/css/sanitize-non-inlinable-rules.mjs +45 -0
- package/dist/components/tailwind/utils/css/split-mixed-rule.cjs +41 -0
- package/dist/components/tailwind/utils/css/split-mixed-rule.mjs +40 -0
- package/dist/components/tailwind/utils/css/strip-empty-tailwind-vars.cjs +52 -0
- package/dist/components/tailwind/utils/css/strip-empty-tailwind-vars.mjs +51 -0
- package/dist/components/tailwind/utils/css/unwrap-value.cjs +7 -0
- package/dist/components/tailwind/utils/css/unwrap-value.mjs +7 -0
- package/dist/components/tailwind/utils/react/is-component.cjs +7 -0
- package/dist/components/tailwind/utils/react/is-component.mjs +7 -0
- package/dist/components/tailwind/utils/react/map-react-tree.cjs +32 -0
- package/dist/components/tailwind/utils/react/map-react-tree.mjs +30 -0
- package/dist/components/tailwind/utils/tailwindcss/clone-element-with-inlined-styles.cjs +37 -0
- package/dist/components/tailwind/utils/tailwindcss/clone-element-with-inlined-styles.mjs +35 -0
- package/dist/components/tailwind/utils/tailwindcss/setup-tailwind.cjs +77 -0
- package/dist/components/tailwind/utils/tailwindcss/setup-tailwind.d.cts +19 -0
- package/dist/components/tailwind/utils/tailwindcss/setup-tailwind.d.mts +19 -0
- package/dist/components/tailwind/utils/tailwindcss/setup-tailwind.mjs +76 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/index.cjs +901 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/index.mjs +901 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/preflight.cjs +398 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/preflight.mjs +398 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/theme.cjs +467 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/theme.mjs +467 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/utilities.cjs +6 -0
- package/dist/components/tailwind/utils/tailwindcss/tailwind-stylesheets/utilities.mjs +6 -0
- package/dist/components/tailwind/utils/text/from-dash-case-to-camel-case.cjs +6 -0
- package/dist/components/tailwind/utils/text/from-dash-case-to-camel-case.mjs +6 -0
- package/dist/components/text/index.d.cts +1 -0
- package/dist/components/text/index.d.mts +1 -0
- package/dist/components/text/text.cjs +43 -0
- package/dist/components/text/text.d.cts +7 -0
- package/dist/components/text/text.d.mts +7 -0
- package/dist/components/text/text.mjs +41 -0
- package/dist/components/text/utils/compute-margins.cjs +62 -0
- package/dist/components/text/utils/compute-margins.mjs +62 -0
- package/dist/index.cjs +95 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.mjs +25 -7326
- package/package.json +64 -32
- package/src/components/body/__snapshots__/body.spec.tsx.snap +23 -0
- package/src/components/body/body.spec.tsx +78 -0
- package/src/components/body/body.tsx +62 -0
- package/src/components/body/index.ts +1 -0
- package/src/components/body/margin-properties.ts +27 -0
- package/src/components/button/button.spec.tsx +53 -0
- package/src/components/button/button.tsx +114 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button/utils/parse-padding.ts +137 -0
- package/src/components/button/utils/px-to-pt.ts +4 -0
- package/src/components/button/utils/utils.spec.ts +153 -0
- package/src/components/code-block/code-block.tsx +136 -0
- package/src/components/code-block/index.ts +3 -0
- package/src/components/code-block/languages-available.ts +402 -0
- package/src/components/code-block/prism.ts +15618 -0
- package/src/components/code-block/themes.ts +4929 -0
- package/src/components/code-inline/code-inline.tsx +60 -0
- package/src/components/code-inline/index.ts +1 -0
- package/src/components/column/column.spec.tsx +28 -0
- package/src/components/column/column.tsx +17 -0
- package/src/components/column/index.ts +1 -0
- package/src/components/container/container.spec.tsx +33 -0
- package/src/components/container/container.tsx +59 -0
- package/src/components/container/index.ts +1 -0
- package/src/components/element-marker.ts +5 -0
- package/src/components/font/font.spec.tsx +63 -0
- package/src/components/font/font.tsx +76 -0
- package/src/components/font/index.ts +1 -0
- package/src/components/head/head.spec.tsx +34 -0
- package/src/components/head/head.tsx +15 -0
- package/src/components/head/index.ts +1 -0
- package/src/components/heading/heading.spec.tsx +32 -0
- package/src/components/heading/heading.tsx +31 -0
- package/src/components/heading/index.ts +1 -0
- package/src/components/heading/utils/as.ts +26 -0
- package/src/components/heading/utils/spaces.ts +64 -0
- package/src/components/heading/utils/utils.spec.ts +70 -0
- package/src/components/hr/hr.spec.tsx +22 -0
- package/src/components/hr/hr.tsx +23 -0
- package/src/components/hr/index.ts +1 -0
- package/src/components/html/html.spec.tsx +26 -0
- package/src/components/html/html.tsx +13 -0
- package/src/components/html/index.ts +1 -0
- package/src/components/img/img.spec.tsx +30 -0
- package/src/components/img/img.tsx +27 -0
- package/src/components/img/index.ts +1 -0
- package/src/components/index.ts +19 -0
- package/src/components/link/index.ts +1 -0
- package/src/components/link/link.spec.tsx +37 -0
- package/src/components/link/link.tsx +24 -0
- package/src/components/markdown/index.ts +1 -0
- package/src/components/markdown/markdown.spec.tsx +221 -0
- package/src/components/markdown/markdown.tsx +239 -0
- package/src/components/markdown/styles.ts +130 -0
- package/src/components/markdown/utils/parse-css-in-js-to-inline-css.spec.ts +42 -0
- package/src/components/markdown/utils/parse-css-in-js-to-inline-css.ts +73 -0
- package/src/components/preview/index.ts +1 -0
- package/src/components/preview/preview.spec.tsx +49 -0
- package/src/components/preview/preview.tsx +56 -0
- package/src/components/row/index.ts +1 -0
- package/src/components/row/row.spec.tsx +28 -0
- package/src/components/row/row.tsx +33 -0
- package/src/components/section/index.ts +1 -0
- package/src/components/section/section.spec.tsx +58 -0
- package/src/components/section/section.tsx +59 -0
- package/src/components/tailwind/e2e/integrations.spec.ts +44 -0
- package/src/components/tailwind/e2e/nextjs/README.md +9 -0
- package/src/components/tailwind/e2e/nextjs/emails/vercel-invite-user.tsx +151 -0
- package/src/components/tailwind/e2e/nextjs/next.config.mjs +6 -0
- package/src/components/tailwind/e2e/nextjs/package.json +24 -0
- package/src/components/tailwind/e2e/nextjs/src/app/favicon.ico +0 -0
- package/src/components/tailwind/e2e/nextjs/src/app/layout.tsx +23 -0
- package/src/components/tailwind/e2e/nextjs/src/app/page.tsx +7 -0
- package/src/components/tailwind/e2e/nextjs/tsconfig.json +27 -0
- package/src/components/tailwind/e2e/vite/README.md +9 -0
- package/src/components/tailwind/e2e/vite/emails/vercel-invite-user.tsx +151 -0
- package/src/components/tailwind/e2e/vite/index.html +13 -0
- package/src/components/tailwind/e2e/vite/package.json +25 -0
- package/src/components/tailwind/e2e/vite/public/vite.svg +1 -0
- package/src/components/tailwind/e2e/vite/src/App.tsx +10 -0
- package/src/components/tailwind/e2e/vite/src/main.tsx +9 -0
- package/src/components/tailwind/e2e/vite/src/vite-env.d.ts +1 -0
- package/src/components/tailwind/e2e/vite/tsconfig.json +25 -0
- package/src/components/tailwind/e2e/vite/tsconfig.node.json +11 -0
- package/src/components/tailwind/e2e/vite/vite.config.ts +7 -0
- package/src/components/tailwind/hooks/use-suspended-promise.ts +34 -0
- package/src/components/tailwind/hooks/use-suspensed-promise.spec.ts +263 -0
- package/src/components/tailwind/index.ts +4 -0
- package/src/components/tailwind/inline-styles.spec.ts +49 -0
- package/src/components/tailwind/inline-styles.ts +21 -0
- package/src/components/tailwind/sanitize-stylesheet.ts +10 -0
- package/src/components/tailwind/tailwind.spec.tsx +1390 -0
- package/src/components/tailwind/tailwind.tsx +178 -0
- package/src/components/tailwind/utils/__snapshots__/quick-safe-render-to-string.spec.tsx.snap +3 -0
- package/src/components/tailwind/utils/compatibility/escape-class-name.spec.ts +17 -0
- package/src/components/tailwind/utils/compatibility/escape-class-name.ts +18 -0
- package/src/components/tailwind/utils/compatibility/get-react-property.ts +15 -0
- package/src/components/tailwind/utils/compatibility/sanitize-class-name.spec.ts +7 -0
- package/src/components/tailwind/utils/compatibility/sanitize-class-name.ts +36 -0
- package/src/components/tailwind/utils/compatibility/unescape-class.ts +3 -0
- package/src/components/tailwind/utils/css/__snapshots__/extract-rules-matching-classes.spec.ts.snap +23 -0
- package/src/components/tailwind/utils/css/__snapshots__/remove-rule-duplicates-from-root.spec.ts.snap +3 -0
- package/src/components/tailwind/utils/css/__snapshots__/sanitize-non-inlinable-classes.spec.ts.snap +7 -0
- package/src/components/tailwind/utils/css/downlevel-for-email-clients.spec.ts +119 -0
- package/src/components/tailwind/utils/css/downlevel-for-email-clients.ts +244 -0
- package/src/components/tailwind/utils/css/extract-rules-per-class.spec.ts +232 -0
- package/src/components/tailwind/utils/css/extract-rules-per-class.ts +76 -0
- package/src/components/tailwind/utils/css/get-custom-properties.ts +49 -0
- package/src/components/tailwind/utils/css/is-part-inlinable.ts +15 -0
- package/src/components/tailwind/utils/css/is-rule-inlinable.ts +15 -0
- package/src/components/tailwind/utils/css/make-inline-styles-for.spec.ts +124 -0
- package/src/components/tailwind/utils/css/make-inline-styles-for.ts +73 -0
- package/src/components/tailwind/utils/css/resolve-all-css-variables.spec.ts +296 -0
- package/src/components/tailwind/utils/css/resolve-all-css-variables.ts +236 -0
- package/src/components/tailwind/utils/css/resolve-calc-expressions.spec.ts +36 -0
- package/src/components/tailwind/utils/css/resolve-calc-expressions.ts +147 -0
- package/src/components/tailwind/utils/css/sanitize-declarations.spec.ts +491 -0
- package/src/components/tailwind/utils/css/sanitize-declarations.ts +443 -0
- package/src/components/tailwind/utils/css/sanitize-non-inlinable-rules.spec.ts +72 -0
- package/src/components/tailwind/utils/css/sanitize-non-inlinable-rules.ts +48 -0
- package/src/components/tailwind/utils/css/split-mixed-rule.ts +68 -0
- package/src/components/tailwind/utils/css/strip-empty-tailwind-vars.spec.ts +128 -0
- package/src/components/tailwind/utils/css/strip-empty-tailwind-vars.ts +70 -0
- package/src/components/tailwind/utils/css/unwrap-value.ts +9 -0
- package/src/components/tailwind/utils/react/is-component.ts +12 -0
- package/src/components/tailwind/utils/react/map-react-tree.spec.tsx +58 -0
- package/src/components/tailwind/utils/react/map-react-tree.ts +58 -0
- package/src/components/tailwind/utils/tailwindcss/clone-element-with-inlined-styles.ts +61 -0
- package/src/components/tailwind/utils/tailwindcss/setup-tailwind.spec.ts +25 -0
- package/src/components/tailwind/utils/tailwindcss/setup-tailwind.ts +121 -0
- package/src/components/tailwind/utils/tailwindcss/tailwind-stylesheets/index.ts +900 -0
- package/src/components/tailwind/utils/tailwindcss/tailwind-stylesheets/preflight.ts +397 -0
- package/src/components/tailwind/utils/tailwindcss/tailwind-stylesheets/theme.ts +466 -0
- package/src/components/tailwind/utils/tailwindcss/tailwind-stylesheets/utilities.ts +5 -0
- package/src/components/tailwind/utils/text/from-dash-case-to-camel-case.ts +3 -0
- package/src/components/text/index.ts +1 -0
- package/src/components/text/text.spec.tsx +35 -0
- package/src/components/text/text.tsx +50 -0
- package/src/components/text/utils/compute-margins.spec.ts +67 -0
- package/src/components/text/utils/compute-margins.ts +102 -0
- package/src/index.ts +2 -110
- package/tsconfig.json +9 -4
- package/tsdown.config.ts +51 -6
- package/vitest.config.ts +1 -0
- package/vitest.e2e.config.ts +17 -0
- package/src/commands/build.ts +0 -269
- package/src/commands/dev.ts +0 -27
- package/src/commands/export.ts +0 -204
- package/src/commands/resend/reset.ts +0 -8
- package/src/commands/resend/setup.ts +0 -29
- package/src/commands/start.ts +0 -38
- package/src/utils/conf.ts +0 -9
- package/src/utils/esbuild/escape-string-for-regex.ts +0 -3
- package/src/utils/esbuild/renderring-utilities-exporter.ts +0 -63
- package/src/utils/get-emails-directory-metadata.spec.ts +0 -82
- package/src/utils/get-emails-directory-metadata.ts +0 -140
- package/src/utils/get-preview-server-location.ts +0 -50
- package/src/utils/index.ts +0 -2
- package/src/utils/packageJson.ts +0 -4
- package/src/utils/preview/get-env-variables-for-preview-app.ts +0 -20
- package/src/utils/preview/hot-reloading/create-dependency-graph.spec.ts +0 -226
- package/src/utils/preview/hot-reloading/create-dependency-graph.ts +0 -343
- package/src/utils/preview/hot-reloading/get-imported-modules.spec.ts +0 -151
- package/src/utils/preview/hot-reloading/get-imported-modules.ts +0 -49
- package/src/utils/preview/hot-reloading/resolve-path-aliases.spec.ts +0 -11
- package/src/utils/preview/hot-reloading/resolve-path-aliases.ts +0 -32
- package/src/utils/preview/hot-reloading/setup-hot-reloading.ts +0 -121
- package/src/utils/preview/hot-reloading/test/dependency-graph/inner/data-to-import.json +0 -1
- package/src/utils/preview/hot-reloading/test/dependency-graph/inner/file-a.ts +0 -5
- package/src/utils/preview/hot-reloading/test/dependency-graph/inner/file-b.ts +0 -5
- package/src/utils/preview/hot-reloading/test/dependency-graph/inner/general-importing-file.ts +0 -9
- package/src/utils/preview/hot-reloading/test/dependency-graph/inner/outer-dependency.ts +0 -3
- package/src/utils/preview/hot-reloading/test/dependency-graph/inner/path-aliases.ts +0 -1
- package/src/utils/preview/hot-reloading/test/dependency-graph/outer.ts +0 -5
- package/src/utils/preview/hot-reloading/test/some-file.ts +0 -0
- package/src/utils/preview/hot-reloading/test/tsconfig.json +0 -8
- package/src/utils/preview/index.ts +0 -2
- package/src/utils/preview/serve-static-file.ts +0 -51
- package/src/utils/preview/start-dev-server.ts +0 -252
- package/src/utils/register-spinner-autostopping.ts +0 -28
- package/src/utils/style-text.ts +0 -11
- package/src/utils/tree.spec.ts +0 -29
- package/src/utils/tree.ts +0 -76
- package/src/utils/types/hot-reload-change.ts +0 -6
- package/src/utils/types/hot-reload-event.ts +0 -3
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CssNode,
|
|
3
|
+
type Declaration,
|
|
4
|
+
generate,
|
|
5
|
+
type List,
|
|
6
|
+
type ListItem,
|
|
7
|
+
parse,
|
|
8
|
+
type Raw,
|
|
9
|
+
type SelectorList,
|
|
10
|
+
type Value,
|
|
11
|
+
walk,
|
|
12
|
+
} from 'css-tree';
|
|
13
|
+
|
|
14
|
+
interface VariableUse {
|
|
15
|
+
declaration: Declaration;
|
|
16
|
+
path: CssNode[];
|
|
17
|
+
fallback?: string;
|
|
18
|
+
variableName: string;
|
|
19
|
+
raw: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface VariableDefinition {
|
|
23
|
+
declaration: Declaration;
|
|
24
|
+
path: CssNode[];
|
|
25
|
+
variableName: string;
|
|
26
|
+
definition: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function doSelectorsIntersect(
|
|
30
|
+
first: SelectorList | Raw,
|
|
31
|
+
second: SelectorList | Raw,
|
|
32
|
+
): boolean {
|
|
33
|
+
const firstStringified = generate(first);
|
|
34
|
+
const secondStringified = generate(second);
|
|
35
|
+
if (firstStringified === secondStringified) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let hasSomeUniversal = false;
|
|
40
|
+
const walker = (
|
|
41
|
+
node: CssNode,
|
|
42
|
+
_parentListItem: ListItem<CssNode>,
|
|
43
|
+
parentList: List<CssNode>,
|
|
44
|
+
) => {
|
|
45
|
+
if (hasSomeUniversal) return;
|
|
46
|
+
if (node.type === 'PseudoClassSelector' && node.name === 'root') {
|
|
47
|
+
hasSomeUniversal = true;
|
|
48
|
+
}
|
|
49
|
+
if (
|
|
50
|
+
node.type === 'TypeSelector' &&
|
|
51
|
+
node.name === '*' &&
|
|
52
|
+
parentList.size === 1
|
|
53
|
+
) {
|
|
54
|
+
hasSomeUniversal = true;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
walk(first, walker);
|
|
58
|
+
walk(second, walker);
|
|
59
|
+
|
|
60
|
+
if (hasSomeUniversal) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function resolveAllCssVariables(node: CssNode) {
|
|
68
|
+
const variableDefinitions = new Set<VariableDefinition>();
|
|
69
|
+
const variableUses = new Set<VariableUse>();
|
|
70
|
+
|
|
71
|
+
const path: CssNode[] = [];
|
|
72
|
+
|
|
73
|
+
walk(node, {
|
|
74
|
+
leave() {
|
|
75
|
+
path.shift();
|
|
76
|
+
},
|
|
77
|
+
enter(node: CssNode) {
|
|
78
|
+
if (node.type === 'Declaration') {
|
|
79
|
+
const declaration = node;
|
|
80
|
+
// Ignores @layer (properties) { ... } to avoid variable resolution conflicts
|
|
81
|
+
if (
|
|
82
|
+
path.some(
|
|
83
|
+
(ancestor) =>
|
|
84
|
+
ancestor.type === 'Atrule' &&
|
|
85
|
+
ancestor.name === 'layer' &&
|
|
86
|
+
ancestor.prelude !== null &&
|
|
87
|
+
generate(ancestor.prelude).includes('properties'),
|
|
88
|
+
)
|
|
89
|
+
) {
|
|
90
|
+
path.unshift(node);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (/--[\S]+/.test(declaration.property)) {
|
|
95
|
+
variableDefinitions.add({
|
|
96
|
+
declaration,
|
|
97
|
+
path: [...path],
|
|
98
|
+
variableName: declaration.property,
|
|
99
|
+
definition: generate(declaration.value),
|
|
100
|
+
});
|
|
101
|
+
} else {
|
|
102
|
+
function parseVariableUsesFrom(node: CssNode) {
|
|
103
|
+
walk(node, {
|
|
104
|
+
visit: 'Function',
|
|
105
|
+
enter(funcNode) {
|
|
106
|
+
if (funcNode.name === 'var') {
|
|
107
|
+
const children = funcNode.children.toArray();
|
|
108
|
+
const name = generate(children[0]!);
|
|
109
|
+
const fallback =
|
|
110
|
+
// The second argument should be an "," Operator Node,
|
|
111
|
+
// such that the actual fallback is only in the third argument
|
|
112
|
+
children[2] ? generate(children[2]) : undefined;
|
|
113
|
+
|
|
114
|
+
variableUses.add({
|
|
115
|
+
declaration,
|
|
116
|
+
path: [...path],
|
|
117
|
+
fallback,
|
|
118
|
+
variableName: name,
|
|
119
|
+
raw: generate(funcNode),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
if (fallback?.includes('var(')) {
|
|
123
|
+
const parsedFallback = parse(fallback, {
|
|
124
|
+
context: 'value',
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
parseVariableUsesFrom(parsedFallback);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
parseVariableUsesFrom(declaration.value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
path.unshift(node);
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
for (const use of variableUses) {
|
|
142
|
+
let hasReplaced = false;
|
|
143
|
+
|
|
144
|
+
for (const definition of variableDefinitions) {
|
|
145
|
+
if (use.variableName !== definition.variableName) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (
|
|
150
|
+
use.path[0]?.type === 'Block' &&
|
|
151
|
+
use.path[1]?.type === 'Atrule' &&
|
|
152
|
+
use.path[2]?.type === 'Block' &&
|
|
153
|
+
use.path[3]?.type === 'Rule' &&
|
|
154
|
+
definition.path[0]!.type === 'Block' &&
|
|
155
|
+
definition.path[1]!.type === 'Rule' &&
|
|
156
|
+
doSelectorsIntersect(use.path[3].prelude, definition.path[1].prelude)
|
|
157
|
+
) {
|
|
158
|
+
use.declaration.value = parse(
|
|
159
|
+
generate(use.declaration.value).replaceAll(
|
|
160
|
+
use.raw,
|
|
161
|
+
definition.definition,
|
|
162
|
+
),
|
|
163
|
+
{
|
|
164
|
+
context: 'value',
|
|
165
|
+
},
|
|
166
|
+
) as Raw | Value;
|
|
167
|
+
hasReplaced = true;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (
|
|
172
|
+
use.path[0]?.type === 'Block' &&
|
|
173
|
+
use.path[1]?.type === 'Rule' &&
|
|
174
|
+
definition.path[0]?.type === 'Block' &&
|
|
175
|
+
definition.path[1]?.type === 'Rule' &&
|
|
176
|
+
doSelectorsIntersect(use.path[1].prelude, definition.path[1].prelude)
|
|
177
|
+
) {
|
|
178
|
+
use.declaration.value = parse(
|
|
179
|
+
generate(use.declaration.value).replaceAll(
|
|
180
|
+
use.raw,
|
|
181
|
+
definition.definition,
|
|
182
|
+
),
|
|
183
|
+
{
|
|
184
|
+
context: 'value',
|
|
185
|
+
},
|
|
186
|
+
) as Raw | Value;
|
|
187
|
+
hasReplaced = true;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Both use and definition live inside the same nested @media (or other
|
|
192
|
+
// at-rule) block of the same rule — e.g. Tailwind v4's
|
|
193
|
+
// .print_invert { @media print { --tw-invert: invert(100%); filter: var(--tw-invert,) ... } }
|
|
194
|
+
// The previous two checks only cover a Rule directly containing the
|
|
195
|
+
// declaration; this one covers Rule → Block → Atrule → Block → Declaration
|
|
196
|
+
// on both sides.
|
|
197
|
+
if (
|
|
198
|
+
use.path[0]?.type === 'Block' &&
|
|
199
|
+
use.path[1]?.type === 'Atrule' &&
|
|
200
|
+
use.path[2]?.type === 'Block' &&
|
|
201
|
+
use.path[3]?.type === 'Rule' &&
|
|
202
|
+
definition.path[0]?.type === 'Block' &&
|
|
203
|
+
definition.path[1]?.type === 'Atrule' &&
|
|
204
|
+
definition.path[2]?.type === 'Block' &&
|
|
205
|
+
definition.path[3]?.type === 'Rule' &&
|
|
206
|
+
use.path[1].name === definition.path[1].name &&
|
|
207
|
+
(use.path[1].prelude
|
|
208
|
+
? definition.path[1].prelude
|
|
209
|
+
? generate(use.path[1].prelude) ===
|
|
210
|
+
generate(definition.path[1].prelude)
|
|
211
|
+
: false
|
|
212
|
+
: definition.path[1].prelude === null) &&
|
|
213
|
+
doSelectorsIntersect(use.path[3].prelude, definition.path[3].prelude)
|
|
214
|
+
) {
|
|
215
|
+
use.declaration.value = parse(
|
|
216
|
+
generate(use.declaration.value).replaceAll(
|
|
217
|
+
use.raw,
|
|
218
|
+
definition.definition,
|
|
219
|
+
),
|
|
220
|
+
{
|
|
221
|
+
context: 'value',
|
|
222
|
+
},
|
|
223
|
+
) as Raw | Value;
|
|
224
|
+
hasReplaced = true;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (!hasReplaced && use.fallback) {
|
|
230
|
+
use.declaration.value = parse(
|
|
231
|
+
generate(use.declaration.value).replaceAll(use.raw, use.fallback),
|
|
232
|
+
{ context: 'value' },
|
|
233
|
+
) as Raw | Value;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { generate, parse } from 'css-tree';
|
|
2
|
+
import { resolveCalcExpressions } from './resolve-calc-expressions.js';
|
|
3
|
+
|
|
4
|
+
describe('resolveCalcExpressions()', () => {
|
|
5
|
+
it('resolves spacing calc expressions from tailwind v4', () => {
|
|
6
|
+
const root = parse(`
|
|
7
|
+
.px-3{padding-inline:calc(0.25rem*3)}
|
|
8
|
+
.py-2{padding-block:calc(0.25rem*2)}
|
|
9
|
+
`);
|
|
10
|
+
resolveCalcExpressions(root);
|
|
11
|
+
expect(generate(root)).toMatchInlineSnapshot(
|
|
12
|
+
`".px-3{padding-inline:0.75rem}.py-2{padding-block:0.5rem}"`,
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('resolves calc expressions repeating decimals', () => {
|
|
17
|
+
const root = parse(`
|
|
18
|
+
.w-1/3 { width: calc(0.3333333333333333*100%); }
|
|
19
|
+
`);
|
|
20
|
+
resolveCalcExpressions(root);
|
|
21
|
+
expect(generate(root)).toMatchInlineSnapshot(
|
|
22
|
+
`".w-1/3{width:33.33333333333333%}"`,
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('does not modify complex calc expressions', () => {
|
|
27
|
+
const root = parse(`
|
|
28
|
+
.px-3{padding-inline:calc(0.25rem*(3 + 1px))}
|
|
29
|
+
.py-2{padding-block:calc(0.25rem*(2 + 1px))}
|
|
30
|
+
`);
|
|
31
|
+
resolveCalcExpressions(root);
|
|
32
|
+
expect(generate(root)).toMatchInlineSnapshot(
|
|
33
|
+
`".px-3{padding-inline:calc(0.25rem*(3 + 1px))}.py-2{padding-block:calc(0.25rem*(2 + 1px))}"`,
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type CssNode, walk } from 'css-tree';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Intentionally only resolves `*` and `/` operations without dealing with parenthesis, because this is the only thing required to run Tailwind v4
|
|
5
|
+
*/
|
|
6
|
+
export function resolveCalcExpressions(node: CssNode) {
|
|
7
|
+
walk(node, {
|
|
8
|
+
visit: 'Function',
|
|
9
|
+
enter(func, funcListItem) {
|
|
10
|
+
if (func.name === 'calc') {
|
|
11
|
+
/*
|
|
12
|
+
[
|
|
13
|
+
{ type: 'Dimension', loc: null, value: '0.25', unit: 'rem' },
|
|
14
|
+
{ type: 'Operator', loc: null, value: '*' },
|
|
15
|
+
{ type: 'Number', loc: null, value: '2' }
|
|
16
|
+
{ type: 'Percentage', loc: null, value: '2' }
|
|
17
|
+
]
|
|
18
|
+
*/
|
|
19
|
+
func.children.forEach((child, item) => {
|
|
20
|
+
const left = item.prev;
|
|
21
|
+
const right = item.next;
|
|
22
|
+
if (
|
|
23
|
+
left &&
|
|
24
|
+
right &&
|
|
25
|
+
child.type === 'Operator' &&
|
|
26
|
+
(left.data.type === 'Dimension' ||
|
|
27
|
+
left.data.type === 'Number' ||
|
|
28
|
+
left.data.type === 'Percentage') &&
|
|
29
|
+
(right.data.type === 'Dimension' ||
|
|
30
|
+
right.data.type === 'Number' ||
|
|
31
|
+
right.data.type === 'Percentage')
|
|
32
|
+
) {
|
|
33
|
+
if (child.value === '*' || child.value === '/') {
|
|
34
|
+
const value = (() => {
|
|
35
|
+
if (child.value === '*') {
|
|
36
|
+
return String(
|
|
37
|
+
Number.parseFloat(left.data.value) *
|
|
38
|
+
Number.parseFloat(right.data.value),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
if (right.data.value === '0') {
|
|
42
|
+
return '0';
|
|
43
|
+
}
|
|
44
|
+
return String(
|
|
45
|
+
Number.parseFloat(left.data.value) /
|
|
46
|
+
Number.parseFloat(right.data.value),
|
|
47
|
+
);
|
|
48
|
+
})();
|
|
49
|
+
if (
|
|
50
|
+
left.data.type === 'Dimension' &&
|
|
51
|
+
right.data.type === 'Number'
|
|
52
|
+
) {
|
|
53
|
+
item.data = {
|
|
54
|
+
type: 'Dimension',
|
|
55
|
+
unit: left.data.unit,
|
|
56
|
+
value,
|
|
57
|
+
};
|
|
58
|
+
func.children.remove(left);
|
|
59
|
+
func.children.remove(right);
|
|
60
|
+
} else if (
|
|
61
|
+
left.data.type === 'Number' &&
|
|
62
|
+
right.data.type === 'Dimension'
|
|
63
|
+
) {
|
|
64
|
+
item.data = {
|
|
65
|
+
type: 'Dimension',
|
|
66
|
+
unit: right.data.unit,
|
|
67
|
+
value,
|
|
68
|
+
};
|
|
69
|
+
func.children.remove(left);
|
|
70
|
+
func.children.remove(right);
|
|
71
|
+
} else if (
|
|
72
|
+
left.data.type === 'Number' &&
|
|
73
|
+
right.data.type === 'Number'
|
|
74
|
+
) {
|
|
75
|
+
item.data = {
|
|
76
|
+
type: 'Number',
|
|
77
|
+
value,
|
|
78
|
+
};
|
|
79
|
+
func.children.remove(left);
|
|
80
|
+
func.children.remove(right);
|
|
81
|
+
} else if (
|
|
82
|
+
left.data.type === 'Dimension' &&
|
|
83
|
+
right.data.type === 'Dimension' &&
|
|
84
|
+
left.data.unit === right.data.unit
|
|
85
|
+
) {
|
|
86
|
+
if (child.value === '/') {
|
|
87
|
+
item.data = {
|
|
88
|
+
type: 'Number',
|
|
89
|
+
value,
|
|
90
|
+
};
|
|
91
|
+
} else {
|
|
92
|
+
item.data = {
|
|
93
|
+
type: 'Dimension',
|
|
94
|
+
unit: left.data.unit,
|
|
95
|
+
value,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
func.children.remove(left);
|
|
99
|
+
func.children.remove(right);
|
|
100
|
+
} else if (
|
|
101
|
+
left.data.type === 'Percentage' &&
|
|
102
|
+
right.data.type === 'Number'
|
|
103
|
+
) {
|
|
104
|
+
item.data = {
|
|
105
|
+
type: 'Percentage',
|
|
106
|
+
value,
|
|
107
|
+
};
|
|
108
|
+
func.children.remove(left);
|
|
109
|
+
func.children.remove(right);
|
|
110
|
+
} else if (
|
|
111
|
+
left.data.type === 'Number' &&
|
|
112
|
+
right.data.type === 'Percentage'
|
|
113
|
+
) {
|
|
114
|
+
item.data = {
|
|
115
|
+
type: 'Percentage',
|
|
116
|
+
value,
|
|
117
|
+
};
|
|
118
|
+
func.children.remove(left);
|
|
119
|
+
func.children.remove(right);
|
|
120
|
+
} else if (
|
|
121
|
+
left.data.type === 'Percentage' &&
|
|
122
|
+
right.data.type === 'Percentage'
|
|
123
|
+
) {
|
|
124
|
+
if (child.value === '/') {
|
|
125
|
+
item.data = {
|
|
126
|
+
type: 'Number',
|
|
127
|
+
value,
|
|
128
|
+
};
|
|
129
|
+
} else {
|
|
130
|
+
item.data = {
|
|
131
|
+
type: 'Percentage',
|
|
132
|
+
value,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
func.children.remove(left);
|
|
136
|
+
func.children.remove(right);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if (func.children.size === 1 && func.children.first) {
|
|
142
|
+
funcListItem.data = func.children.first;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|