@comet/mail-react 9.0.0-canary-20260121104514 → 9.0.0-canary-20260122072113

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/lib/index.d.ts CHANGED
@@ -1,7 +1 @@
1
- export { BlocksBlock } from "./blocks/factories/BlocksBlock.js";
2
- export { ListBlock } from "./blocks/factories/ListBlock.js";
3
- export { OneOfBlock } from "./blocks/factories/OneOfBlock.js";
4
- export { OptionalBlock } from "./blocks/factories/OptionalBlock.js";
5
- export type { SupportedBlocks } from "./blocks/factories/types.js";
6
- export type { PropsWithData } from "./blocks/helpers/PropsWithData.js";
7
- export { css } from "./utils/css.js";
1
+ export { css } from "./utils/css";
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { BlocksBlock } from "./blocks/factories/BlocksBlock.js";
2
- export { ListBlock } from "./blocks/factories/ListBlock.js";
3
- export { OneOfBlock } from "./blocks/factories/OneOfBlock.js";
4
- export { OptionalBlock } from "./blocks/factories/OptionalBlock.js";
5
- export { css } from "./utils/css.js";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.css = void 0;
4
+ var css_1 = require("./utils/css");
5
+ Object.defineProperty(exports, "css", { enumerable: true, get: function () { return css_1.css; } });
package/lib/utils/css.js CHANGED
@@ -1,4 +1,23 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.css = void 0;
1
13
  /**
2
14
  * Helper function to enable syntax highlighting & auto-formatting for CSS strings when using certain IDE plugins, e.g. the "styled-components" plugin in VSCode.
3
15
  */
4
- export const css = (strings, ...rest) => String.raw({ raw: strings }, ...rest);
16
+ var css = function (strings) {
17
+ var rest = [];
18
+ for (var _i = 1; _i < arguments.length; _i++) {
19
+ rest[_i - 1] = arguments[_i];
20
+ }
21
+ return String.raw.apply(String, __spreadArray([{ raw: strings }], rest, false));
22
+ };
23
+ exports.css = css;
package/package.json CHANGED
@@ -1,33 +1,20 @@
1
1
  {
2
2
  "name": "@comet/mail-react",
3
- "version": "9.0.0-canary-20260121104514",
3
+ "version": "9.0.0-canary-20260122072113",
4
4
  "description": "Utilities for building HTML emails with React",
5
- "type": "module",
6
- "exports": {
7
- ".": {
8
- "types": "./lib/index.d.ts",
9
- "default": "./lib/index.js"
10
- }
11
- },
5
+ "type": "commonjs",
6
+ "main": "lib/index.js",
7
+ "types": "lib/index.d.ts",
12
8
  "files": [
13
9
  "lib/*"
14
10
  ],
15
11
  "devDependencies": {
16
- "@faire/mjml-react": "^3.5.3",
17
- "@types/react": "^18.3.27",
18
- "chokidar-cli": "^3.0.0",
19
12
  "eslint": "^9.30.1",
20
13
  "npm-run-all2": "^8.0.4",
21
14
  "prettier": "^3.6.2",
22
- "react": "^18.3.1",
23
15
  "rimraf": "^6.1.2",
24
16
  "typescript": "5.9.3",
25
- "@comet/cli": "9.0.0-canary-20260121104514",
26
- "@comet/eslint-config": "9.0.0-canary-20260121104514"
27
- },
28
- "peerDependencies": {
29
- "@faire/mjml-react": "^3.0.0",
30
- "react": "^18.0.0"
17
+ "@comet/eslint-config": "9.0.0-canary-20260122072113"
31
18
  },
32
19
  "engines": {
33
20
  "node": ">=22.0.0"
@@ -37,12 +24,10 @@
37
24
  "registry": "https://registry.npmjs.org"
38
25
  },
39
26
  "scripts": {
40
- "build": "pnpm run clean && pnpm run generate-block-types && tsc",
41
- "clean": "rimraf lib 'src/**/*.generated.ts'",
42
- "dev": "pnpm run clean && pnpm generate-block-types && tsc --watch",
43
- "generate-block-types": "comet generate-block-types",
44
- "generate-block-types:watch": "chokidar -s \"**/block-meta.json\" -c \"$npm_execpath generate-block-types\"",
45
- "lint": "pnpm generate-block-types && run-p lint:prettier lint:eslint lint:tsc",
27
+ "build": "pnpm run clean && tsc",
28
+ "clean": "rimraf lib",
29
+ "dev": "tsc --watch",
30
+ "lint": "run-p lint:prettier lint:eslint lint:tsc",
46
31
  "lint:ci": "pnpm run lint",
47
32
  "lint:eslint": "eslint --max-warnings 0 src/ **/*.json --no-warn-ignored",
48
33
  "lint:prettier": "pnpm exec prettier --check '*.{ts,js,json,md,yml,yaml}'",
@@ -1,14 +0,0 @@
1
- import { type SupportedBlocks } from "./types.js";
2
- interface Props {
3
- supportedBlocks: SupportedBlocks;
4
- data: {
5
- blocks: Array<{
6
- key: string;
7
- type: string;
8
- visible: boolean;
9
- props: unknown;
10
- }>;
11
- };
12
- }
13
- export declare const BlocksBlock: ({ supportedBlocks, data: { blocks } }: Props) => import("react/jsx-runtime").JSX.Element;
14
- export {};
@@ -1,15 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { MjmlText } from "@faire/mjml-react";
3
- import { Fragment } from "react";
4
- export const BlocksBlock = ({ supportedBlocks, data: { blocks } }) => {
5
- return (_jsx(_Fragment, { children: blocks.map((block) => {
6
- const blockFunction = supportedBlocks[block.type];
7
- if (!blockFunction) {
8
- if (process.env.NODE_ENV === "development") {
9
- return (_jsxs(MjmlText, { children: ["Unknown type (", block.type, "): ", JSON.stringify(block.props)] }, block.key));
10
- }
11
- return null;
12
- }
13
- return _jsx(Fragment, { children: blockFunction(block.props) }, block.key);
14
- }) }));
15
- };
@@ -1,13 +0,0 @@
1
- import { type ReactNode } from "react";
2
- interface Props {
3
- block: (props: any) => ReactNode;
4
- data: {
5
- blocks: Array<{
6
- key: string;
7
- visible: boolean;
8
- props: unknown;
9
- }>;
10
- };
11
- }
12
- export declare const ListBlock: ({ block: blockFunction, data: { blocks } }: Props) => import("react/jsx-runtime").JSX.Element;
13
- export {};
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Fragment } from "react";
3
- export const ListBlock = ({ block: blockFunction, data: { blocks } }) => {
4
- return (_jsx(_Fragment, { children: blocks.map((block) => (_jsx(Fragment, { children: blockFunction(block.props) }, block.key))) }));
5
- };
@@ -1,14 +0,0 @@
1
- import { type PropsWithChildren } from "react";
2
- import { type SupportedBlocks } from "./types.js";
3
- interface Props extends PropsWithChildren {
4
- data: {
5
- block?: {
6
- type: string;
7
- props: any;
8
- };
9
- };
10
- supportedBlocks: SupportedBlocks;
11
- className?: string;
12
- }
13
- export declare const OneOfBlock: ({ data: { block, ...additionalProps }, supportedBlocks, children, className }: Props) => import("react/jsx-runtime").JSX.Element;
14
- export {};
@@ -1,15 +0,0 @@
1
- import { jsxs as _jsxs, Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { MjmlText } from "@faire/mjml-react";
3
- export const OneOfBlock = ({ data: { block, ...additionalProps }, supportedBlocks, children, className }) => {
4
- if (!block) {
5
- return null;
6
- }
7
- const blockFunction = supportedBlocks[block.type];
8
- if (!blockFunction) {
9
- if (process.env.NODE_ENV === "development") {
10
- return (_jsxs(MjmlText, { children: ["Unknown type (", block.type, "): ", JSON.stringify(block.props)] }));
11
- }
12
- return null;
13
- }
14
- return _jsx(_Fragment, { children: blockFunction({ ...block.props, ...additionalProps, children, className }) });
15
- };
@@ -1,10 +0,0 @@
1
- import { type PropsWithChildren, type ReactNode } from "react";
2
- interface Props extends PropsWithChildren {
3
- block: (props: any) => ReactNode;
4
- data: {
5
- visible: boolean;
6
- block?: any;
7
- };
8
- }
9
- export declare const OptionalBlock: ({ block: blockFunction, data: { visible, block }, children }: Props) => import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1,7 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- export const OptionalBlock = ({ block: blockFunction, data: { visible, block }, children }) => {
3
- if (!visible || !block) {
4
- return null;
5
- }
6
- return _jsx(_Fragment, { children: blockFunction({ ...block, children }) });
7
- };
@@ -1,4 +0,0 @@
1
- import { type ReactNode } from "react";
2
- export interface SupportedBlocks {
3
- [key: string]: (props: any) => ReactNode | undefined;
4
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export interface PropsWithData<Data = unknown> {
2
- data: Data;
3
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,139 +0,0 @@
1
- export interface AnchorBlockData {
2
- name?: string;
3
- }
4
- export interface DamFileDownloadLinkBlockData {
5
- file?: {
6
- id: string;
7
- name: string;
8
- fileUrl: string;
9
- size: number;
10
- mimetype: string;
11
- scope?: unknown;
12
- altText?: string;
13
- title?: string;
14
- };
15
- openFileType: "NewTab" | "Download";
16
- }
17
- export interface DamImageBlockData {
18
- attachedBlocks: Array<{
19
- type: string;
20
- props: PixelImageBlockData | SvgImageBlockData;
21
- }>;
22
- activeType?: string;
23
- block?: {
24
- type: string;
25
- props: PixelImageBlockData | SvgImageBlockData;
26
- };
27
- }
28
- export interface DamVideoBlockData {
29
- autoplay?: boolean;
30
- showControls?: boolean;
31
- loop?: boolean;
32
- previewImage: PixelImageBlockData;
33
- damFile?: {
34
- id: string;
35
- name: string;
36
- size: number;
37
- mimetype: string;
38
- contentHash: string;
39
- title?: string;
40
- altText?: string;
41
- archived: boolean;
42
- scope?: unknown;
43
- fileUrl: string;
44
- captions?: Array<{
45
- id: string;
46
- language: string;
47
- fileUrl: string;
48
- }>;
49
- };
50
- }
51
- export interface EmailLinkBlockData {
52
- email?: string;
53
- }
54
- export interface ExternalLinkBlockData {
55
- targetUrl?: string;
56
- openInNewWindow: boolean;
57
- }
58
- export interface InternalLinkBlockData {
59
- targetPageAnchor?: string;
60
- targetPage?: {
61
- id: string;
62
- name: string;
63
- path: string;
64
- scope?: unknown;
65
- documentType: string;
66
- };
67
- }
68
- export interface NewsletterImageBlockData {
69
- image: PixelImageBlockData;
70
- }
71
- export interface PhoneLinkBlockData {
72
- phone?: string;
73
- }
74
- export interface PixelImageBlockData {
75
- damFile?: {
76
- id: string;
77
- name: string;
78
- size: number;
79
- mimetype: string;
80
- contentHash: string;
81
- title?: string;
82
- altText?: string;
83
- archived: boolean;
84
- scope?: unknown;
85
- image?: {
86
- width: number;
87
- height: number;
88
- cropArea: {
89
- focalPoint: "SMART" | "CENTER" | "NORTHWEST" | "NORTHEAST" | "SOUTHWEST" | "SOUTHEAST";
90
- width?: number;
91
- height?: number;
92
- x?: number;
93
- y?: number;
94
- };
95
- dominantColor?: string;
96
- };
97
- fileUrl: string;
98
- };
99
- cropArea?: {
100
- focalPoint: "SMART" | "CENTER" | "NORTHWEST" | "NORTHEAST" | "SOUTHWEST" | "SOUTHEAST";
101
- width?: number;
102
- height?: number;
103
- x?: number;
104
- y?: number;
105
- };
106
- urlTemplate: string;
107
- }
108
- export interface SpaceBlockData {
109
- height: number;
110
- }
111
- export interface SvgImageBlockData {
112
- damFile?: {
113
- id: string;
114
- name: string;
115
- size: number;
116
- mimetype: string;
117
- contentHash: string;
118
- title?: string;
119
- altText?: string;
120
- archived: boolean;
121
- scope?: unknown;
122
- fileUrl: string;
123
- };
124
- }
125
- export interface VimeoVideoBlockData {
126
- autoplay?: boolean;
127
- showControls?: boolean;
128
- loop?: boolean;
129
- previewImage: PixelImageBlockData;
130
- vimeoIdentifier?: string;
131
- }
132
- export interface YouTubeVideoBlockData {
133
- autoplay?: boolean;
134
- showControls?: boolean;
135
- loop?: boolean;
136
- previewImage: PixelImageBlockData;
137
- youtubeIdentifier?: string;
138
- }
139
- export type AllBlockNames = "Anchor" | "DamFileDownloadLink" | "DamImage" | "DamVideo" | "EmailLink" | "ExternalLink" | "InternalLink" | "NewsletterImage" | "PhoneLink" | "PixelImage" | "Space" | "SvgImage" | "VimeoVideo" | "YouTubeVideo";
@@ -1 +0,0 @@
1
- export {};