@one-million-lines/email-builder 0.1.1 → 0.1.3
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 +19 -1
- package/README.md +62 -20
- package/dist/email-builder.cjs +1 -1
- package/dist/email-builder.cjs.map +1 -1
- package/dist/email-builder.js +2 -2
- package/dist/email-builder.js.map +1 -1
- package/dist/plugins/imageUploader/index.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,13 +6,31 @@ This project adheres to [Semantic Versioning](https://semver.org/) and the
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.2] — 2026-06-30
|
|
10
|
+
|
|
9
11
|
### Added
|
|
10
12
|
- npm library build (`dist/email-builder.js` ESM, `dist/email-builder.cjs` CommonJS).
|
|
11
13
|
- Generated TypeScript declarations (`dist/index.d.ts` + per-module `.d.ts`).
|
|
12
|
-
- Compiled stylesheet at `dist/styles.css`, imported via
|
|
14
|
+
- Compiled stylesheet at `dist/styles.css`, imported via `@one-million-lines/email-builder/styles.css`.
|
|
13
15
|
- `exports` map, `files` allowlist, and publishing metadata in `package.json`.
|
|
14
16
|
- Library-only stylesheet (`src/lib.css`) that omits app `html/body/#root` globals.
|
|
15
17
|
|
|
18
|
+
### Fixed
|
|
19
|
+
- **CSS isolation** — `src/lib.css` no longer imports Tailwind Preflight
|
|
20
|
+
(`@import "tailwindcss"` → `@import "tailwindcss/theme"` + `@import
|
|
21
|
+
"tailwindcss/utilities"`). The global CSS reset no longer leaks into the host
|
|
22
|
+
application.
|
|
23
|
+
- Added `.oml-email-builder` as the root class on the `<App>` element. All
|
|
24
|
+
builder styles are now nested under this class in the DOM.
|
|
25
|
+
- Scoped minimal reset (`box-sizing`, `button`, `input`, `img` defaults) applied
|
|
26
|
+
only inside `.oml-email-builder` via `@layer base`, replacing the Preflight
|
|
27
|
+
rules that were previously global.
|
|
28
|
+
- `[contenteditable="true"]:focus` selector is now scoped to
|
|
29
|
+
`.oml-email-builder` and no longer affects host page content.
|
|
30
|
+
- Replaced `h-screen w-screen` on the builder root with `h-full w-full` so the
|
|
31
|
+
builder fills its container rather than always taking up the full viewport. The
|
|
32
|
+
host is responsible for sizing the container (e.g., `height: 100vh`).
|
|
33
|
+
|
|
16
34
|
### Changed
|
|
17
35
|
- `react` and `react-dom` are now **peer dependencies** (no longer bundled).
|
|
18
36
|
- Runtime dependencies (`@dnd-kit/*`, `lucide-react`, `zod`, `zustand`) are
|
package/README.md
CHANGED
|
@@ -56,15 +56,16 @@ src/
|
|
|
56
56
|
## Install
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
npm install
|
|
59
|
+
npm install @one-million-lines/email-builder react react-dom
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
`react` and `react-dom` (v18 or v19) are **peer dependencies** — install them in
|
|
63
63
|
your app; they are never bundled into the package.
|
|
64
64
|
|
|
65
|
-
> **MANUAL ACTION REQUIRED:**
|
|
66
|
-
>
|
|
67
|
-
>
|
|
65
|
+
> **MANUAL ACTION REQUIRED:** This package is configured to publish under the
|
|
66
|
+
> `@one-million-lines` npm scope. Before publishing, confirm you own/have publish
|
|
67
|
+
> access to that npm organization and that `@one-million-lines/email-builder` is
|
|
68
|
+
> available (or already yours). `publishConfig.access` is set to `public`.
|
|
68
69
|
|
|
69
70
|
## Getting started
|
|
70
71
|
|
|
@@ -88,8 +89,8 @@ The production build uses `/demo/email-builder/` as the Vite base path.
|
|
|
88
89
|
React:
|
|
89
90
|
|
|
90
91
|
```tsx
|
|
91
|
-
import { EmailBuilder } from "
|
|
92
|
-
import "
|
|
92
|
+
import { EmailBuilder } from "@one-million-lines/email-builder";
|
|
93
|
+
import "@one-million-lines/email-builder/styles.css";
|
|
93
94
|
|
|
94
95
|
<EmailBuilder
|
|
95
96
|
initialDocument={emailJson}
|
|
@@ -101,8 +102,8 @@ import "openpostcards-builder/styles.css";
|
|
|
101
102
|
Vanilla JS:
|
|
102
103
|
|
|
103
104
|
```ts
|
|
104
|
-
import { createEmailBuilder } from "
|
|
105
|
-
import "
|
|
105
|
+
import { createEmailBuilder } from "@one-million-lines/email-builder";
|
|
106
|
+
import "@one-million-lines/email-builder/styles.css";
|
|
106
107
|
|
|
107
108
|
const instance = createEmailBuilder({
|
|
108
109
|
container: document.getElementById("builder")!,
|
|
@@ -115,7 +116,7 @@ const instance = createEmailBuilder({
|
|
|
115
116
|
// instance.getDocument(); instance.exportHtml(); instance.exportJson(); instance.destroy();
|
|
116
117
|
```
|
|
117
118
|
|
|
118
|
-
Always import the stylesheet once per app: `import "
|
|
119
|
+
Always import the stylesheet once per app: `import "@one-million-lines/email-builder/styles.css";`
|
|
119
120
|
|
|
120
121
|
### Framework integration
|
|
121
122
|
|
|
@@ -132,17 +133,58 @@ Vue and Angular mount the React-based editor through the framework-neutral
|
|
|
132
133
|
|
|
133
134
|
### Styling & isolation
|
|
134
135
|
|
|
135
|
-
The stylesheet at
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
The stylesheet at `@one-million-lines/email-builder/styles.css` is designed to
|
|
137
|
+
be embedded safely alongside any host design system (Tailwind, Bootstrap,
|
|
138
|
+
shadcn/ui, Material UI, custom CSS):
|
|
139
|
+
|
|
140
|
+
- **No Preflight** — Tailwind Preflight (global CSS reset) is excluded from the
|
|
141
|
+
library stylesheet. Only `theme` variables and `utilities` are imported.
|
|
142
|
+
- **Scoped reset** — A minimal `box-sizing`, `button`, `input`, and `img` reset
|
|
143
|
+
is applied only inside `.oml-email-builder` via `@layer base`.
|
|
144
|
+
- **Root class** — The builder's root element carries the class
|
|
145
|
+
`oml-email-builder`. Every builder style targets this class, so nothing leaks
|
|
146
|
+
to the host page.
|
|
147
|
+
- **`[contenteditable]` focus** — The inline focus outline is scoped to
|
|
148
|
+
`.oml-email-builder [contenteditable]` and never affects host page content.
|
|
149
|
+
- **Tailwind theme variables** — Tailwind v4 CSS custom properties
|
|
150
|
+
(`--color-*`, `--font-*`, `--spacing-*`, etc.) are declared on `:root` as
|
|
151
|
+
part of the Tailwind theme layer. They use Tailwind's own naming convention
|
|
152
|
+
and are unlikely to conflict with host variables; if they do, override them on
|
|
153
|
+
the container.
|
|
154
|
+
|
|
155
|
+
**Sizing the container:**
|
|
156
|
+
|
|
157
|
+
The builder fills its container (`h-full w-full`). Give the container explicit
|
|
158
|
+
dimensions before mounting:
|
|
159
|
+
|
|
160
|
+
```html
|
|
161
|
+
<!-- HTML -->
|
|
162
|
+
<div id="builder" style="height: 100vh; width: 100%;"></div>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
// React
|
|
167
|
+
<div style={{ height: "100vh", width: "100%" }}>
|
|
168
|
+
<EmailBuilder ... />
|
|
169
|
+
</div>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Modals and overlays:**
|
|
173
|
+
|
|
174
|
+
The Templates modal renders with `position: fixed; z-index: 50` to cover the
|
|
175
|
+
viewport. This is intentional for a full-screen editing tool. If your host has
|
|
176
|
+
a higher `z-index` stacking context, wrap the builder container with
|
|
177
|
+
`isolation: isolate` and ensure your modal z-indices are coordinated.
|
|
139
178
|
|
|
140
|
-
|
|
141
|
-
- Scope/encapsulate it (e.g., render inside an iframe or a Shadow DOM host), or
|
|
142
|
-
- Build your own Tailwind stylesheet without Preflight if your app already
|
|
143
|
-
provides resets.
|
|
179
|
+
**Host compatibility:**
|
|
144
180
|
|
|
145
|
-
|
|
181
|
+
| Host design system | Notes |
|
|
182
|
+
|---|---|
|
|
183
|
+
| Tailwind CSS | No conflict. The builder uses the same Tailwind theme tokens. |
|
|
184
|
+
| Bootstrap | No conflict. No Preflight, no overriding resets. |
|
|
185
|
+
| shadcn/ui | No conflict. scoped reset does not override shadcn variables. |
|
|
186
|
+
| Material UI | No conflict. MUI's emotion styles are not affected. |
|
|
187
|
+
| Custom global CSS | As long as your CSS does not target `.oml-email-builder` descendant elements, there is no conflict. |
|
|
146
188
|
|
|
147
189
|
### Server-side rendering
|
|
148
190
|
|
|
@@ -154,7 +196,7 @@ effect, or dynamically import it with SSR disabled in Next.js:
|
|
|
154
196
|
import dynamic from "next/dynamic";
|
|
155
197
|
|
|
156
198
|
const EmailBuilder = dynamic(
|
|
157
|
-
() => import("
|
|
199
|
+
() => import("@one-million-lines/email-builder").then((m) => m.EmailBuilder),
|
|
158
200
|
{ ssr: false }
|
|
159
201
|
);
|
|
160
202
|
```
|
|
@@ -181,7 +223,7 @@ npm pack # create the .tgz to test in a consumer app
|
|
|
181
223
|
To publish (run manually):
|
|
182
224
|
|
|
183
225
|
```bash
|
|
184
|
-
# MANUAL ACTION REQUIRED —
|
|
226
|
+
# MANUAL ACTION REQUIRED — log in to an account with publish access to the @one-million-lines scope, then:
|
|
185
227
|
npm login
|
|
186
228
|
npm publish --access public
|
|
187
229
|
```
|