react-email 2.0.0-canary.8 → 2.0.0

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/cli/index.d.mts CHANGED
File without changes
package/cli/index.d.ts CHANGED
File without changes
package/cli/index.js CHANGED
@@ -252,7 +252,7 @@ var import_commander = require("commander");
252
252
  // package.json
253
253
  var package_default = {
254
254
  name: "react-email",
255
- version: "2.0.0-canary.8",
255
+ version: "2.0.0",
256
256
  description: "A live preview of your emails right in your browser.",
257
257
  bin: {
258
258
  email: "./cli/index.js"
@@ -283,8 +283,8 @@ var package_default = {
283
283
  "@radix-ui/react-slot": "1.0.2",
284
284
  "@radix-ui/react-toggle-group": "1.0.4",
285
285
  "@radix-ui/react-tooltip": "1.0.6",
286
- "@react-email/components": "0.0.14-canary.0",
287
- "@react-email/render": "0.0.12-canary.0",
286
+ "@react-email/components": "0.0.14",
287
+ "@react-email/render": "0.0.12",
288
288
  "@swc/core": "1.3.101",
289
289
  "@types/react": "^18.2.0",
290
290
  "@types/react-dom": "^18.2.0",
@@ -325,7 +325,7 @@ var package_default = {
325
325
  "@types/mime-types": "2.1.4",
326
326
  "@types/node": "20.10.4",
327
327
  "@types/normalize-path": "3.0.2",
328
- "@types/shelljs": "0.8.12",
328
+ "@types/shelljs": "0.8.15",
329
329
  "@vercel/style-guide": "5.1.0",
330
330
  eslint: "8.50.0",
331
331
  tsup: "7.2.0",
package/cli/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { program } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "react-email",
9
- version: "2.0.0-canary.8",
9
+ version: "2.0.0",
10
10
  description: "A live preview of your emails right in your browser.",
11
11
  bin: {
12
12
  email: "./cli/index.js"
@@ -37,8 +37,8 @@ var package_default = {
37
37
  "@radix-ui/react-slot": "1.0.2",
38
38
  "@radix-ui/react-toggle-group": "1.0.4",
39
39
  "@radix-ui/react-tooltip": "1.0.6",
40
- "@react-email/components": "0.0.14-canary.0",
41
- "@react-email/render": "0.0.12-canary.0",
40
+ "@react-email/components": "0.0.14",
41
+ "@react-email/render": "0.0.12",
42
42
  "@swc/core": "1.3.101",
43
43
  "@types/react": "^18.2.0",
44
44
  "@types/react-dom": "^18.2.0",
@@ -79,7 +79,7 @@ var package_default = {
79
79
  "@types/mime-types": "2.1.4",
80
80
  "@types/node": "20.10.4",
81
81
  "@types/normalize-path": "3.0.2",
82
- "@types/shelljs": "0.8.12",
82
+ "@types/shelljs": "0.8.15",
83
83
  "@vercel/style-guide": "5.1.0",
84
84
  eslint: "8.50.0",
85
85
  tsup: "7.2.0",
package/dist/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "license": "MIT",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/resendlabs/react-email.git",
17
+ "url": "https://github.com/resend/react-email.git",
18
18
  "directory": "packages/react-email"
19
19
  },
20
20
  "keywords": [
File without changes
@@ -54,7 +54,7 @@ var downloadClient = function () { return __awaiter(void 0, void 0, void 0, func
54
54
  return [4 /*yield*/, octokit.repos.downloadTarballArchive({
55
55
  owner: 'resendlabs',
56
56
  repo: 'react-email',
57
- ref: 'v0.0.15-canary.0',
57
+ ref: 'v0.0.15',
58
58
  })];
59
59
  case 1:
60
60
  downloadRes = _a.sent();
package/license.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 Bu Kinoshita and Zeno Rocha
1
+ Copyright 2024 Plus Five Five, Inc
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "react-email",
3
- "version": "2.0.0-canary.8",
3
+ "version": "2.0.0",
4
4
  "description": "A live preview of your emails right in your browser.",
5
5
  "bin": {
6
6
  "email": "./cli/index.js"
7
7
  },
8
+ "scripts": {
9
+ "build": "tsup",
10
+ "dev": "tsup --watch",
11
+ "clean": "rm -rf dist",
12
+ "lint": "eslint . && tsc"
13
+ },
8
14
  "license": "MIT",
9
15
  "repository": {
10
16
  "type": "git",
@@ -25,8 +31,8 @@
25
31
  "@radix-ui/react-slot": "1.0.2",
26
32
  "@radix-ui/react-toggle-group": "1.0.4",
27
33
  "@radix-ui/react-tooltip": "1.0.6",
28
- "@react-email/components": "0.0.14-canary.0",
29
- "@react-email/render": "0.0.12-canary.0",
34
+ "@react-email/components": "0.0.14",
35
+ "@react-email/render": "0.0.12",
30
36
  "@swc/core": "1.3.101",
31
37
  "@types/react": "^18.2.0",
32
38
  "@types/react-dom": "^18.2.0",
@@ -67,18 +73,12 @@
67
73
  "@types/mime-types": "2.1.4",
68
74
  "@types/node": "20.10.4",
69
75
  "@types/normalize-path": "3.0.2",
70
- "@types/shelljs": "0.8.12",
76
+ "@types/shelljs": "0.8.15",
71
77
  "@vercel/style-guide": "5.1.0",
72
78
  "eslint": "8.50.0",
73
79
  "tsup": "7.2.0",
74
80
  "tsx": "4.7.0",
75
81
  "vitest": "1.1.3",
76
82
  "watch": "1.0.2"
77
- },
78
- "scripts": {
79
- "build": "tsup",
80
- "dev": "tsup --watch",
81
- "clean": "rm -rf dist",
82
- "lint": "eslint . && tsc"
83
83
  }
84
- }
84
+ }
@@ -1,5 +1,5 @@
1
1
  'use server';
2
- import fs from 'node:fs';
2
+ import { promises as fs } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { renderAsync } from '@react-email/render';
5
5
  import { getEmailComponent } from '../utils/get-email-component';
@@ -22,22 +22,7 @@ export type EmailRenderingResult =
22
22
  export const renderEmailBySlug = async (
23
23
  emailSlug: string,
24
24
  ): Promise<EmailRenderingResult> => {
25
- const emailPathWithoutExtesion = path.join(
26
- emailsDirectoryAbsolutePath,
27
- emailSlug,
28
- );
29
-
30
- let emailPath: string;
31
- // manually find out what is the file extension for the email
32
- if (fs.existsSync(`${emailPathWithoutExtesion}.tsx`)) {
33
- emailPath = `${emailPathWithoutExtesion}.tsx`;
34
- } else if (fs.existsSync(`${emailPathWithoutExtesion}.jsx`)) {
35
- emailPath = `${emailPathWithoutExtesion}.jsx`;
36
- } else if (fs.existsSync(`${emailPathWithoutExtesion}.js`)) {
37
- emailPath = `${emailPathWithoutExtesion}.js`;
38
- } else {
39
- throw new Error('Could not find the email for that slug!');
40
- }
25
+ const emailPath = path.join(emailsDirectoryAbsolutePath, emailSlug);
41
26
 
42
27
  const result = await getEmailComponent(emailPath);
43
28
 
@@ -57,7 +42,7 @@ export const renderEmailBySlug = async (
57
42
  plainText: true,
58
43
  });
59
44
 
60
- const reactMarkup = await fs.promises.readFile(emailPath, 'utf-8');
45
+ const reactMarkup = await fs.readFile(emailPath, 'utf-8');
61
46
 
62
47
  return {
63
48
  markup,
Binary file
package/src/app/logo.png CHANGED
Binary file
package/src/app/page.tsx CHANGED
@@ -5,7 +5,6 @@ import { Button, Heading, Text } from '../components';
5
5
  import { Shell } from '../components/shell';
6
6
  import { emailsDirectoryAbsolutePath } from '../utils/emails-directory-absolute-path';
7
7
  import logo from './logo.png';
8
- import pattern from './pattern.png';
9
8
 
10
9
  const Home = () => {
11
10
  const baseEmailsDirectoryName = path.basename(emailsDirectoryAbsolutePath);
@@ -13,14 +12,6 @@ const Home = () => {
13
12
  return (
14
13
  <Shell>
15
14
  <div className="relative max-w-lg mx-auto p-8 flex items-center justify-center h-[inherit]">
16
- <Image
17
- alt="React Email Icon"
18
- className="absolute top-0 -translate-x-1/2 left-1/2 -translate-y-[70px] opacity-70"
19
- height={349}
20
- src={pattern}
21
- width={349}
22
- />
23
-
24
15
  <div className="relative z-10 flex flex-col text-center items-center">
25
16
  <Image
26
17
  alt="React Email Icon"
@@ -44,7 +35,7 @@ const Home = () => {
44
35
  folder.
45
36
  </Text>
46
37
 
47
- <Button asChild>
38
+ <Button asChild size="3">
48
39
  <Link href="https://react.email/docs">Check the docs</Link>
49
40
  </Button>
50
41
  </div>
@@ -22,6 +22,7 @@ export const Shell = ({
22
22
  setActiveView,
23
23
  }: ShellProps) => {
24
24
  const [sidebarToggled, setSidebarToggled] = React.useState(false);
25
+ const [triggerTransition, setTriggerTransition] = React.useState(false);
25
26
 
26
27
  return (
27
28
  <div className="flex bg-black text-white flex-col h-screen overflow-x-hidden">
@@ -58,20 +59,31 @@ export const Shell = ({
58
59
  <div className="flex bg-slate-2">
59
60
  <Sidebar
60
61
  className={cn(
61
- 'w-screen max-w-full bg-black h-screen md:bg-inherit lg:h-auto z-50 md:max-w-[275px] transition-transform fixed top-[70px] lg:top-0 left-0',
62
+ 'w-screen max-w-full bg-black h-screen lg:h-auto z-50 lg:max-w-[275px] fixed top-[70px] lg:top-0 left-0',
62
63
  {
63
64
  'translate-x-0 lg:-translate-x-full': sidebarToggled,
64
65
  '-translate-x-full lg:translate-x-0': !sidebarToggled,
65
66
  },
66
67
  )}
67
68
  currentEmailOpenSlug={currentEmailOpenSlug}
69
+ style={{
70
+ transition: triggerTransition ? 'transform 0.2s ease-in-out' : '',
71
+ }}
68
72
  />
69
73
 
70
74
  <main
71
- className={cn('transition-transform will-change-transform h-screen', {
72
- 'lg:translate-x-0 lg:w-[calc(100vw)]': sidebarToggled,
73
- 'lg:translate-x-[275px] lg:w-[calc(100vw-275px)]': !sidebarToggled,
74
- })}
75
+ className={cn(
76
+ 'absolute will-change-width h-screen w-[100vw] right-0',
77
+ {
78
+ 'lg:translate-x-0 lg:w-[calc(100vw)]': sidebarToggled,
79
+ 'lg:translate-x-0 lg:w-[calc(100vw-275px)]': !sidebarToggled,
80
+ },
81
+ )}
82
+ style={{
83
+ transition: triggerTransition
84
+ ? 'width 0.2s ease-in-out, transform 0.2s ease-in-out'
85
+ : '',
86
+ }}
75
87
  >
76
88
  {currentEmailOpenSlug ? (
77
89
  <Topbar
@@ -79,7 +91,15 @@ export const Shell = ({
79
91
  currentEmailOpenSlug={currentEmailOpenSlug}
80
92
  markup={markup}
81
93
  onToggleSidebar={() => {
82
- setSidebarToggled((v) => !v);
94
+ setTriggerTransition(true);
95
+
96
+ requestAnimationFrame(() => {
97
+ setSidebarToggled((v) => !v);
98
+ });
99
+
100
+ setTimeout(() => {
101
+ setTriggerTransition(false);
102
+ }, 300);
83
103
  }}
84
104
  setActiveView={setActiveView}
85
105
  />
@@ -57,10 +57,10 @@ export const SidebarDirectoryChildren = (props: {
57
57
  )}
58
58
 
59
59
  {props.emailsDirectoryMetadata.emailFilenames.map(
60
- (emailFilename) => {
60
+ (emailFilename, index) => {
61
61
  const emailSlug = `${directoryPathRelativeToEmailsDirectory}${
62
62
  !isBaseEmailsDirectory ? pathSeparator : ''
63
- }${emailFilename.replace(/\..+$/, '')}`;
63
+ }${emailFilename}`;
64
64
  const isCurrentPage =
65
65
  props.currentEmailOpenSlug === emailSlug;
66
66
 
@@ -73,7 +73,7 @@ export const SidebarDirectoryChildren = (props: {
73
73
  key={emailSlug}
74
74
  >
75
75
  <motion.span
76
- animate={{ opacity: 1 }}
76
+ animate={{ x: 0, opacity: 1 }}
77
77
  className={cn(
78
78
  'text-[14px] flex items-center align-middle pl-3 h-8 max-w-full rounded-md text-slate-11 relative transition ease-in-out duration-200',
79
79
  {
@@ -82,6 +82,11 @@ export const SidebarDirectoryChildren = (props: {
82
82
  props.currentEmailOpenSlug !== emailSlug,
83
83
  },
84
84
  )}
85
+ initial={{ x: -10 + -index * 1.5, opacity: 0 }}
86
+ transition={{
87
+ x: { delay: 0.03 * index, duration: 0.05 },
88
+ opacity: { delay: 0.03 * index, duration: 0.2 },
89
+ }}
85
90
  >
86
91
  {isCurrentPage ? (
87
92
  <motion.span
@@ -10,17 +10,25 @@ import { SidebarDirectoryChildren } from './sidebar-directory-children';
10
10
  interface SidebarProps {
11
11
  className?: string;
12
12
  currentEmailOpenSlug?: string;
13
+ style?: React.CSSProperties;
13
14
  }
14
15
 
15
- export const Sidebar = ({ className, currentEmailOpenSlug }: SidebarProps) => {
16
+ export const Sidebar = ({
17
+ className,
18
+ currentEmailOpenSlug,
19
+ style,
20
+ }: SidebarProps) => {
16
21
  const { emailsDirectoryMetadata } = useEmails();
17
22
 
18
23
  return (
19
- <aside className={cn('border-r flex flex-col border-slate-6', className)}>
24
+ <aside
25
+ className={cn('border-r flex flex-col border-slate-6', className)}
26
+ style={{ ...style }}
27
+ >
20
28
  <div className="p-4 h-[70px] flex-shrink items-center hidden lg:flex">
21
29
  <Logo />
22
30
  </div>
23
- <nav className="p-4 flex-grow lg:pt-0 pl-0 w-screen h-[calc(100vh_-_70px)] md:w-full md:min-w-[275px] md:max-w-[275px] flex flex-col overflow-y-auto">
31
+ <nav className="p-4 flex-grow lg:pt-0 pl-0 w-screen h-[calc(100vh_-_70px)] lg:w-full lg:min-w-[275px] lg:max-w-[275px] flex flex-col overflow-y-auto">
24
32
  <Collapsible.Root>
25
33
  <SidebarDirectoryChildren
26
34
  currentEmailOpenSlug={currentEmailOpenSlug}
@@ -89,6 +89,18 @@ export const getEmailComponent = async (
89
89
  };
90
90
  }
91
91
 
92
+ if (fakeContext.module.exports.default === undefined) {
93
+ return {
94
+ error: improveErrorWithSourceMap(
95
+ new Error(
96
+ `The email component at ${emailPath} does not contain a default export`,
97
+ ),
98
+ emailPath,
99
+ sourceMapToEmail,
100
+ ),
101
+ };
102
+ }
103
+
92
104
  return {
93
105
  emailComponent: fakeContext.module.exports.default as EmailComponent,
94
106
  sourceMapToOriginalFile: sourceMapToEmail,
package/public/next.svg DELETED
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79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1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
Binary file