@lit-pigeon/angular 0.1.5 → 0.2.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/README.md CHANGED
@@ -11,7 +11,8 @@ idiomatic Angular `@Input()`s and `@Output()`s.
11
11
  npm install @lit-pigeon/angular
12
12
  ```
13
13
 
14
- Requires `@angular/core` >= 17 as a peer dependency.
14
+ Requires `@angular/core` >= 22 as a peer dependency. The package is compiled
15
+ with ng-packagr in partial (Ivy) mode, so it works in AOT production builds.
15
16
 
16
17
  ## Usage
17
18
 
@@ -48,11 +49,137 @@ export class AppComponent {
48
49
 
49
50
  ### Inputs & outputs
50
51
 
51
- `@Input()` — `document`, `config`. `@Output()` — `pigeonChange`,
52
- `pigeonSelect`, `pigeonReady`, `pigeonPreview`, `pigeonExport`,
53
- `pigeonExportJson`, `pigeonExportMjml`, `pigeonExportHtml`. The component also
54
- exposes imperative helpers: `getDocument()`, `loadDocument(doc)`, `undo()`,
55
- `redo()`. Core types are re-exported for convenience.
52
+ `@Input()` — `document`, `config`, `renderer`, `documentToMjml`, `theme`,
53
+ `themeOverrides`, `templateStorage`, `assetStorage`. `@Output()` —
54
+ `pigeonChange`, `pigeonSelect`, `pigeonReady`, `pigeonPreview`,
55
+ `pigeonExport`, `pigeonExportJson`, `pigeonExportMjml`, `pigeonExportHtml`
56
+ (`{ document, html }`, with `html` null when no `renderer` is set). The
57
+ component also exposes imperative helpers: `getDocument()`,
58
+ `loadDocument(doc)`, `undo()`, `redo()`, `exportMjml()` and `exportHtml()`.
59
+ Core types are re-exported for convenience.
60
+
61
+ Binding `[document]` to the object the editor last emitted through
62
+ `pigeonChange` does nothing; binding a different object loads it and resets
63
+ undo history, including resetting back to the original document.
64
+
65
+ ### MJML and HTML export
66
+
67
+ The wrapper does not set a renderer for you. Pass one from
68
+ `@lit-pigeon/renderer-mjml`; without it the Preview button does nothing and
69
+ `exportMjml()` / `exportHtml()` return `null`.
70
+
71
+ ```typescript
72
+ import { Component, ViewChild } from '@angular/core';
73
+ import { PigeonEditorComponent, type PigeonDocument } from '@lit-pigeon/angular';
74
+ import { mjmlToDocument } from '@lit-pigeon/parser-mjml';
75
+ import { MjmlRenderer, documentToMjml } from '@lit-pigeon/renderer-mjml';
76
+
77
+ @Component({
78
+ selector: 'app-template-editor',
79
+ imports: [PigeonEditorComponent],
80
+ template: `
81
+ <pigeon-editor-wrapper
82
+ #editor
83
+ [document]="doc"
84
+ [renderer]="renderer"
85
+ [documentToMjml]="toMjml"
86
+ (pigeonChange)="doc = $event.document"
87
+ />
88
+ `,
89
+ })
90
+ export class TemplateEditorComponent {
91
+ @ViewChild('editor') editor!: PigeonEditorComponent;
92
+
93
+ doc: PigeonDocument = mjmlToDocument(savedMjml).document;
94
+ renderer = new MjmlRenderer();
95
+ toMjml = documentToMjml;
96
+
97
+ async save() {
98
+ const mjml = this.editor.exportMjml();
99
+ const html = await this.editor.exportHtml();
100
+ // store { mjml, html }
101
+ }
102
+ }
103
+ ```
104
+
105
+ `@lit-pigeon/renderer-mjml` imports `mjml`, which is Node-only; an Angular
106
+ build fails with `Could not resolve "fs"` (and `path`, `url`, `os`, `http`,
107
+ `https`). Alias it to the browser build in your app's `package.json`:
108
+
109
+ ```json
110
+ {
111
+ "overrides": {
112
+ "mjml": "npm:mjml-browser@^4.18.0"
113
+ }
114
+ }
115
+ ```
116
+
117
+ (`pnpm.overrides` with pnpm, `resolutions` with Yarn.) `mjml-browser` is
118
+ CommonJS, so allow it in `angular.json` to silence the
119
+ `Module 'mjml' ... is not ESM` warning:
120
+
121
+ ```json
122
+ "build": {
123
+ "options": {
124
+ "allowedCommonJsDependencies": ["mjml"]
125
+ }
126
+ }
127
+ ```
128
+
129
+ `mjml-browser` adds about 1.2 MB (raw) to the bundle, which exceeds the default
130
+ `initial` budget of a new Angular app. Lazy-load the route that hosts the
131
+ editor, or raise the budget.
132
+
133
+ ### Image uploads with auth headers
134
+
135
+ Uploads are configured through `[config]`'s `assetManager`, an
136
+ `AssetManagerConfig`:
137
+
138
+ ```typescript
139
+ interface AssetManagerConfig {
140
+ enabled?: boolean;
141
+ uploadUrl?: string;
142
+ uploadHeaders?: Record<string, string>;
143
+ acceptedTypes?: string[];
144
+ maxFileSize?: number;
145
+ uploadHandler?: (file: File) => Promise<string>;
146
+ presignedUpload?: {
147
+ getUploadParams: (file: File) => Promise<PresignedUploadParams>;
148
+ };
149
+ stock?: StockConfig;
150
+ }
151
+ ```
152
+
153
+ `uploadHandler` takes precedence over `presignedUpload` and `uploadUrl`, and
154
+ resolves to the public URL of the uploaded image:
155
+
156
+ ```typescript
157
+ import type { EditorConfig } from '@lit-pigeon/angular';
158
+
159
+ config: Partial<EditorConfig> = {
160
+ assetManager: {
161
+ uploadHandler: async (file) => {
162
+ const body = new FormData();
163
+ body.append('file', file);
164
+ const res = await fetch('/api/email-assets', {
165
+ method: 'POST',
166
+ headers: { Authorization: `Bearer ${this.auth.token()}` },
167
+ body,
168
+ });
169
+ if (!res.ok) throw new Error(`Upload failed: ${res.status}`);
170
+ return (await res.json()).url;
171
+ },
172
+ },
173
+ };
174
+ ```
175
+
176
+ ```html
177
+ <pigeon-editor-wrapper [document]="doc" [config]="config" />
178
+ ```
179
+
180
+ For a fixed header set, `uploadUrl` plus `uploadHeaders` also works: the editor
181
+ POSTs the file as multipart field `file` and reads `url`, `src` or `location`
182
+ from the JSON response.
56
183
 
57
184
  Part of [Lit Pigeon](https://github.com/snxstudio/lit-pigeon) — open-source drag-and-drop email editor.
58
185
 
@@ -0,0 +1,172 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Output, Input, ViewChild, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
3
+ import '@lit-pigeon/editor';
4
+
5
+ const PASSTHROUGH_INPUTS = [
6
+ 'renderer',
7
+ 'documentToMjml',
8
+ 'theme',
9
+ 'themeOverrides',
10
+ 'templateStorage',
11
+ 'assetStorage',
12
+ ];
13
+ class PigeonEditorComponent {
14
+ constructor() {
15
+ this.pigeonChange = new EventEmitter();
16
+ this.pigeonSelect = new EventEmitter();
17
+ this.pigeonReady = new EventEmitter();
18
+ this.pigeonPreview = new EventEmitter();
19
+ this.pigeonExport = new EventEmitter();
20
+ this.pigeonExportJson = new EventEmitter();
21
+ this.pigeonExportMjml = new EventEmitter();
22
+ this.pigeonExportHtml = new EventEmitter();
23
+ this._listeners = [];
24
+ }
25
+ ngAfterViewInit() {
26
+ const el = this.editorRef?.nativeElement;
27
+ if (!el)
28
+ return;
29
+ // Set initial properties
30
+ if (this.document) {
31
+ el.document = this.document;
32
+ }
33
+ if (this.config) {
34
+ el.config = this.config;
35
+ }
36
+ for (const key of PASSTHROUGH_INPUTS) {
37
+ this._syncInput(el, key);
38
+ }
39
+ // Wire event listeners
40
+ this._addListener(el, 'pigeon:change', (e) => {
41
+ this.pigeonChange.emit(e.detail);
42
+ });
43
+ this._addListener(el, 'pigeon:select', (e) => {
44
+ this.pigeonSelect.emit(e.detail);
45
+ });
46
+ this._addListener(el, 'pigeon:ready', () => {
47
+ this.pigeonReady.emit();
48
+ });
49
+ this._addListener(el, 'pigeon:preview', () => {
50
+ this.pigeonPreview.emit();
51
+ });
52
+ this._addListener(el, 'pigeon:export', () => {
53
+ this.pigeonExport.emit();
54
+ });
55
+ this._addListener(el, 'pigeon:export-json', (e) => {
56
+ this.pigeonExportJson.emit(e.detail);
57
+ });
58
+ this._addListener(el, 'pigeon:export-mjml', (e) => {
59
+ this.pigeonExportMjml.emit(e.detail);
60
+ });
61
+ this._addListener(el, 'pigeon:export-html', (e) => {
62
+ this.pigeonExportHtml.emit(e.detail);
63
+ });
64
+ }
65
+ ngOnChanges(changes) {
66
+ const el = this.editorRef?.nativeElement;
67
+ if (!el)
68
+ return;
69
+ // Setting el.document is a no-op when a host resets back to the original
70
+ // object, so load genuinely different documents explicitly.
71
+ if (changes['document'] && this.document && this.document !== el.getDocument()) {
72
+ el.loadDocument(this.document);
73
+ }
74
+ if (changes['config'] && this.config) {
75
+ el.config = this.config;
76
+ }
77
+ for (const key of PASSTHROUGH_INPUTS) {
78
+ if (changes[key])
79
+ this._syncInput(el, key);
80
+ }
81
+ }
82
+ ngOnDestroy() {
83
+ const el = this.editorRef?.nativeElement;
84
+ if (!el)
85
+ return;
86
+ for (const [event, listener] of this._listeners) {
87
+ el.removeEventListener(event, listener);
88
+ }
89
+ this._listeners = [];
90
+ }
91
+ /** Returns the current document from the editor. */
92
+ getDocument() {
93
+ return this.editorRef?.nativeElement?.getDocument();
94
+ }
95
+ /** Loads a new document into the editor (resets history). */
96
+ loadDocument(doc) {
97
+ this.editorRef?.nativeElement?.loadDocument(doc);
98
+ }
99
+ /** Undo the last change. */
100
+ undo() {
101
+ return this.editorRef?.nativeElement?.undo() ?? false;
102
+ }
103
+ /** Redo the last undone change. */
104
+ redo() {
105
+ return this.editorRef?.nativeElement?.redo() ?? false;
106
+ }
107
+ /** Export the current document as MJML. Requires `documentToMjml`. */
108
+ exportMjml() {
109
+ return this.editorRef?.nativeElement?.exportMjml() ?? null;
110
+ }
111
+ /** Export the current document as HTML. Requires `renderer`. */
112
+ async exportHtml() {
113
+ return (await this.editorRef?.nativeElement?.exportHtml()) ?? null;
114
+ }
115
+ _syncInput(el, key) {
116
+ if (this[key] !== undefined) {
117
+ Object.assign(el, { [key]: this[key] });
118
+ }
119
+ }
120
+ _addListener(el, event, handler) {
121
+ el.addEventListener(event, handler);
122
+ this._listeners.push([event, handler]);
123
+ }
124
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PigeonEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
125
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: PigeonEditorComponent, isStandalone: true, selector: "pigeon-editor-wrapper", inputs: { document: "document", config: "config", renderer: "renderer", documentToMjml: "documentToMjml", theme: "theme", themeOverrides: "themeOverrides", templateStorage: "templateStorage", assetStorage: "assetStorage" }, outputs: { pigeonChange: "pigeonChange", pigeonSelect: "pigeonSelect", pigeonReady: "pigeonReady", pigeonPreview: "pigeonPreview", pigeonExport: "pigeonExport", pigeonExportJson: "pigeonExportJson", pigeonExportMjml: "pigeonExportMjml", pigeonExportHtml: "pigeonExportHtml" }, viewQueries: [{ propertyName: "editorRef", first: true, predicate: ["editorEl"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `<pigeon-editor #editorEl></pigeon-editor>`, isInline: true, styles: [":host{display:block;width:100%;height:100%}pigeon-editor{width:100%;height:100%}\n"] }); }
126
+ }
127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: PigeonEditorComponent, decorators: [{
128
+ type: Component,
129
+ args: [{ selector: 'pigeon-editor-wrapper', standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA], template: `<pigeon-editor #editorEl></pigeon-editor>`, styles: [":host{display:block;width:100%;height:100%}pigeon-editor{width:100%;height:100%}\n"] }]
130
+ }], propDecorators: { editorRef: [{
131
+ type: ViewChild,
132
+ args: ['editorEl', { static: false }]
133
+ }], document: [{
134
+ type: Input
135
+ }], config: [{
136
+ type: Input
137
+ }], renderer: [{
138
+ type: Input
139
+ }], documentToMjml: [{
140
+ type: Input
141
+ }], theme: [{
142
+ type: Input
143
+ }], themeOverrides: [{
144
+ type: Input
145
+ }], templateStorage: [{
146
+ type: Input
147
+ }], assetStorage: [{
148
+ type: Input
149
+ }], pigeonChange: [{
150
+ type: Output
151
+ }], pigeonSelect: [{
152
+ type: Output
153
+ }], pigeonReady: [{
154
+ type: Output
155
+ }], pigeonPreview: [{
156
+ type: Output
157
+ }], pigeonExport: [{
158
+ type: Output
159
+ }], pigeonExportJson: [{
160
+ type: Output
161
+ }], pigeonExportMjml: [{
162
+ type: Output
163
+ }], pigeonExportHtml: [{
164
+ type: Output
165
+ }] } });
166
+
167
+ /**
168
+ * Generated bundle index. Do not edit.
169
+ */
170
+
171
+ export { PigeonEditorComponent };
172
+ //# sourceMappingURL=lit-pigeon-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lit-pigeon-angular.mjs","sources":["../../src/lib/pigeon-editor.component.ts","../../src/lit-pigeon-angular.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n EventEmitter,\n Input,\n Output,\n ViewChild,\n AfterViewInit,\n OnChanges,\n OnDestroy,\n SimpleChanges,\n CUSTOM_ELEMENTS_SCHEMA,\n} from '@angular/core';\nimport type { PigeonDocument, EditorConfig, Selection } from '@lit-pigeon/core';\nimport '@lit-pigeon/editor';\nimport type { PigeonEditor } from '@lit-pigeon/editor';\n\nconst PASSTHROUGH_INPUTS = [\n 'renderer',\n 'documentToMjml',\n 'theme',\n 'themeOverrides',\n 'templateStorage',\n 'assetStorage',\n] as const;\ntype PassthroughInput = (typeof PASSTHROUGH_INPUTS)[number];\n\n@Component({\n selector: 'pigeon-editor-wrapper',\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n template: `<pigeon-editor #editorEl></pigeon-editor>`,\n styles: [`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n pigeon-editor {\n width: 100%;\n height: 100%;\n }\n `],\n})\nexport class PigeonEditorComponent implements AfterViewInit, OnChanges, OnDestroy {\n @ViewChild('editorEl', { static: false })\n private editorRef!: ElementRef<PigeonEditor>;\n\n @Input() document?: PigeonDocument;\n @Input() config?: Partial<EditorConfig>;\n @Input() renderer?: PigeonEditor['renderer'];\n @Input() documentToMjml?: PigeonEditor['documentToMjml'];\n @Input() theme?: PigeonEditor['theme'];\n @Input() themeOverrides?: PigeonEditor['themeOverrides'];\n @Input() templateStorage?: PigeonEditor['templateStorage'];\n @Input() assetStorage?: PigeonEditor['assetStorage'];\n\n @Output() pigeonChange = new EventEmitter<{ document: PigeonDocument }>();\n @Output() pigeonSelect = new EventEmitter<{ selection: Selection | null }>();\n @Output() pigeonReady = new EventEmitter<void>();\n @Output() pigeonPreview = new EventEmitter<void>();\n @Output() pigeonExport = new EventEmitter<void>();\n @Output() pigeonExportJson = new EventEmitter<{ document: PigeonDocument }>();\n @Output() pigeonExportMjml = new EventEmitter<{ mjml: string }>();\n @Output() pigeonExportHtml = new EventEmitter<{ document: PigeonDocument; html: string | null }>();\n\n private _listeners: Array<[string, EventListener]> = [];\n\n ngAfterViewInit(): void {\n const el = this.editorRef?.nativeElement;\n if (!el) return;\n\n // Set initial properties\n if (this.document) {\n el.document = this.document;\n }\n if (this.config) {\n el.config = this.config;\n }\n for (const key of PASSTHROUGH_INPUTS) {\n this._syncInput(el, key);\n }\n\n // Wire event listeners\n this._addListener(el, 'pigeon:change', (e: Event) => {\n this.pigeonChange.emit((e as CustomEvent).detail);\n });\n this._addListener(el, 'pigeon:select', (e: Event) => {\n this.pigeonSelect.emit((e as CustomEvent).detail);\n });\n this._addListener(el, 'pigeon:ready', () => {\n this.pigeonReady.emit();\n });\n this._addListener(el, 'pigeon:preview', () => {\n this.pigeonPreview.emit();\n });\n this._addListener(el, 'pigeon:export', () => {\n this.pigeonExport.emit();\n });\n this._addListener(el, 'pigeon:export-json', (e: Event) => {\n this.pigeonExportJson.emit((e as CustomEvent).detail);\n });\n this._addListener(el, 'pigeon:export-mjml', (e: Event) => {\n this.pigeonExportMjml.emit((e as CustomEvent).detail);\n });\n this._addListener(el, 'pigeon:export-html', (e: Event) => {\n this.pigeonExportHtml.emit((e as CustomEvent).detail);\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n const el = this.editorRef?.nativeElement;\n if (!el) return;\n\n // Setting el.document is a no-op when a host resets back to the original\n // object, so load genuinely different documents explicitly.\n if (changes['document'] && this.document && this.document !== el.getDocument()) {\n el.loadDocument(this.document);\n }\n if (changes['config'] && this.config) {\n el.config = this.config;\n }\n for (const key of PASSTHROUGH_INPUTS) {\n if (changes[key]) this._syncInput(el, key);\n }\n }\n\n ngOnDestroy(): void {\n const el = this.editorRef?.nativeElement;\n if (!el) return;\n\n for (const [event, listener] of this._listeners) {\n el.removeEventListener(event, listener);\n }\n this._listeners = [];\n }\n\n /** Returns the current document from the editor. */\n getDocument(): PigeonDocument | undefined {\n return this.editorRef?.nativeElement?.getDocument();\n }\n\n /** Loads a new document into the editor (resets history). */\n loadDocument(doc: PigeonDocument): void {\n this.editorRef?.nativeElement?.loadDocument(doc);\n }\n\n /** Undo the last change. */\n undo(): boolean {\n return this.editorRef?.nativeElement?.undo() ?? false;\n }\n\n /** Redo the last undone change. */\n redo(): boolean {\n return this.editorRef?.nativeElement?.redo() ?? false;\n }\n\n /** Export the current document as MJML. Requires `documentToMjml`. */\n exportMjml(): string | null {\n return this.editorRef?.nativeElement?.exportMjml() ?? null;\n }\n\n /** Export the current document as HTML. Requires `renderer`. */\n async exportHtml(): Promise<string | null> {\n return (await this.editorRef?.nativeElement?.exportHtml()) ?? null;\n }\n\n private _syncInput(el: PigeonEditor, key: PassthroughInput): void {\n if (this[key] !== undefined) {\n Object.assign(el, { [key]: this[key] });\n }\n }\n\n private _addListener(el: HTMLElement, event: string, handler: EventListener): void {\n el.addEventListener(event, handler);\n this._listeners.push([event, handler]);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAiBA,MAAM,kBAAkB,GAAG;IACzB,UAAU;IACV,gBAAgB;IAChB,OAAO;IACP,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;CACN;MAoBG,qBAAqB,CAAA;AAjBlC,IAAA,WAAA,GAAA;AA8BY,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,YAAY,EAAgC;AAC/D,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,YAAY,EAAmC;AAClE,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,YAAY,EAAQ;AACtC,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,YAAY,EAAQ;AACxC,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,YAAY,EAAQ;AACvC,QAAA,IAAA,CAAA,gBAAgB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B,EAAA;AACzE,QAAA,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC;8GApIW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,ksBAbtB,CAAA,yCAAA,CAA2C,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,oFAAA,CAAA,EAAA,CAAA,CAAA;;2FAa1C,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAjBjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,uBAAuB,cACrB,IAAI,EAAA,OAAA,EACP,CAAC,sBAAsB,CAAC,YACvB,CAAA,yCAAA,CAA2C,EAAA,MAAA,EAAA,CAAA,oFAAA,CAAA,EAAA;;sBAcpD,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;sBAGvC;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBAEA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;sBACA;;;AChEH;;AAEG;;"}
package/package.json CHANGED
@@ -1,42 +1,23 @@
1
1
  {
2
2
  "name": "@lit-pigeon/angular",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Angular wrapper for the Pigeon email editor web component",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.cjs",
13
- "types": "./dist/index.d.ts"
14
- }
15
- },
16
- "files": [
17
- "dist",
18
- "README.md",
19
- "LICENSE"
20
- ],
21
5
  "dependencies": {
22
- "@lit-pigeon/core": "^0.3.1",
23
- "@lit-pigeon/editor": "^0.3.1"
6
+ "tslib": "^2.3.0",
7
+ "@lit-pigeon/core": "^0.3.3",
8
+ "@lit-pigeon/editor": "^0.3.3"
24
9
  },
25
10
  "peerDependencies": {
26
- "@angular/core": ">=17.0.0"
11
+ "@angular/core": ">=22.0.0"
27
12
  },
28
13
  "peerDependenciesMeta": {
29
14
  "@angular/core": {
30
15
  "optional": false
31
16
  }
32
17
  },
33
- "devDependencies": {
34
- "typescript": "^5.5.0",
35
- "vite": "^5.4.0",
36
- "vite-plugin-dts": "^4.0.0"
37
- },
38
18
  "publishConfig": {
39
- "access": "public"
19
+ "access": "public",
20
+ "directory": "dist"
40
21
  },
41
22
  "repository": {
42
23
  "type": "git",
@@ -57,9 +38,17 @@
57
38
  "web-components",
58
39
  "angular"
59
40
  ],
60
- "scripts": {
61
- "build": "vite build",
62
- "dev": "vite build --watch",
63
- "clean": "rm -rf dist"
64
- }
41
+ "module": "fesm2022/lit-pigeon-angular.mjs",
42
+ "typings": "types/lit-pigeon-angular.d.ts",
43
+ "exports": {
44
+ "./package.json": {
45
+ "default": "./package.json"
46
+ },
47
+ ".": {
48
+ "types": "./types/lit-pigeon-angular.d.ts",
49
+ "default": "./fesm2022/lit-pigeon-angular.mjs"
50
+ }
51
+ },
52
+ "sideEffects": false,
53
+ "type": "module"
65
54
  }
@@ -0,0 +1,58 @@
1
+ import * as i0 from '@angular/core';
2
+ import { AfterViewInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges } from '@angular/core';
3
+ import { PigeonDocument, EditorConfig, Selection } from '@lit-pigeon/core';
4
+ export { AssetManagerConfig, BlockType, ButtonBlock, ColumnNode, ContentBlock, DividerBlock, EditorConfig, HeroBlock, HtmlBlock, ImageBlock, MergeTag, MergeTagConfig, NavBarBlock, NavLink, PigeonDocument, RenderOptions, RenderResult, Renderer, RowNode, Selection, SocialBlock, SocialIcon, SpacerBlock, Spacing, TextBlock } from '@lit-pigeon/core';
5
+ import { PigeonEditor } from '@lit-pigeon/editor';
6
+
7
+ declare class PigeonEditorComponent implements AfterViewInit, OnChanges, OnDestroy {
8
+ private editorRef;
9
+ document?: PigeonDocument;
10
+ config?: Partial<EditorConfig>;
11
+ renderer?: PigeonEditor['renderer'];
12
+ documentToMjml?: PigeonEditor['documentToMjml'];
13
+ theme?: PigeonEditor['theme'];
14
+ themeOverrides?: PigeonEditor['themeOverrides'];
15
+ templateStorage?: PigeonEditor['templateStorage'];
16
+ assetStorage?: PigeonEditor['assetStorage'];
17
+ pigeonChange: EventEmitter<{
18
+ document: PigeonDocument;
19
+ }>;
20
+ pigeonSelect: EventEmitter<{
21
+ selection: Selection | null;
22
+ }>;
23
+ pigeonReady: EventEmitter<void>;
24
+ pigeonPreview: EventEmitter<void>;
25
+ pigeonExport: EventEmitter<void>;
26
+ pigeonExportJson: EventEmitter<{
27
+ document: PigeonDocument;
28
+ }>;
29
+ pigeonExportMjml: EventEmitter<{
30
+ mjml: string;
31
+ }>;
32
+ pigeonExportHtml: EventEmitter<{
33
+ document: PigeonDocument;
34
+ html: string | null;
35
+ }>;
36
+ private _listeners;
37
+ ngAfterViewInit(): void;
38
+ ngOnChanges(changes: SimpleChanges): void;
39
+ ngOnDestroy(): void;
40
+ /** Returns the current document from the editor. */
41
+ getDocument(): PigeonDocument | undefined;
42
+ /** Loads a new document into the editor (resets history). */
43
+ loadDocument(doc: PigeonDocument): void;
44
+ /** Undo the last change. */
45
+ undo(): boolean;
46
+ /** Redo the last undone change. */
47
+ redo(): boolean;
48
+ /** Export the current document as MJML. Requires `documentToMjml`. */
49
+ exportMjml(): string | null;
50
+ /** Export the current document as HTML. Requires `renderer`. */
51
+ exportHtml(): Promise<string | null>;
52
+ private _syncInput;
53
+ private _addListener;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<PigeonEditorComponent, never>;
55
+ static ɵcmp: i0.ɵɵComponentDeclaration<PigeonEditorComponent, "pigeon-editor-wrapper", never, { "document": { "alias": "document"; "required": false; }; "config": { "alias": "config"; "required": false; }; "renderer": { "alias": "renderer"; "required": false; }; "documentToMjml": { "alias": "documentToMjml"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "themeOverrides": { "alias": "themeOverrides"; "required": false; }; "templateStorage": { "alias": "templateStorage"; "required": false; }; "assetStorage": { "alias": "assetStorage"; "required": false; }; }, { "pigeonChange": "pigeonChange"; "pigeonSelect": "pigeonSelect"; "pigeonReady": "pigeonReady"; "pigeonPreview": "pigeonPreview"; "pigeonExport": "pigeonExport"; "pigeonExportJson": "pigeonExportJson"; "pigeonExportMjml": "pigeonExportMjml"; "pigeonExportHtml": "pigeonExportHtml"; }, never, never, true, never>;
56
+ }
57
+
58
+ export { PigeonEditorComponent };
package/dist/index.cjs DELETED
@@ -1,11 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@angular/core");require("@lit-pigeon/editor");var g=Object.defineProperty,m=Object.getOwnPropertyDescriptor,n=(p,e,t,o)=>{for(var r=o>1?void 0:o?m(e,t):e,s=p.length-1,d;s>=0;s--)(d=p[s])&&(r=(o?d(e,t,r):d(r))||r);return o&&r&&g(e,t,r),r};exports.PigeonEditorComponent=class{constructor(){this.pigeonChange=new i.EventEmitter,this.pigeonSelect=new i.EventEmitter,this.pigeonReady=new i.EventEmitter,this.pigeonPreview=new i.EventEmitter,this.pigeonExport=new i.EventEmitter,this.pigeonExportJson=new i.EventEmitter,this.pigeonExportMjml=new i.EventEmitter,this.pigeonExportHtml=new i.EventEmitter,this._listeners=[]}ngAfterViewInit(){var t;const e=(t=this.editorRef)==null?void 0:t.nativeElement;e&&(this.document&&(e.document=this.document),this.config&&(e.config=this.config),this._addListener(e,"pigeon:change",o=>{this.pigeonChange.emit(o.detail)}),this._addListener(e,"pigeon:select",o=>{this.pigeonSelect.emit(o.detail)}),this._addListener(e,"pigeon:ready",()=>{this.pigeonReady.emit()}),this._addListener(e,"pigeon:preview",()=>{this.pigeonPreview.emit()}),this._addListener(e,"pigeon:export",()=>{this.pigeonExport.emit()}),this._addListener(e,"pigeon:export-json",o=>{this.pigeonExportJson.emit(o.detail)}),this._addListener(e,"pigeon:export-mjml",o=>{this.pigeonExportMjml.emit(o.detail)}),this._addListener(e,"pigeon:export-html",o=>{this.pigeonExportHtml.emit(o.detail)}))}ngOnChanges(e){var o;const t=(o=this.editorRef)==null?void 0:o.nativeElement;t&&(e.document&&this.document&&(t.document=this.document),e.config&&this.config&&(t.config=this.config))}ngOnDestroy(){var t;const e=(t=this.editorRef)==null?void 0:t.nativeElement;if(e){for(const[o,r]of this._listeners)e.removeEventListener(o,r);this._listeners=[]}}getDocument(){var e,t;return(t=(e=this.editorRef)==null?void 0:e.nativeElement)==null?void 0:t.getDocument()}loadDocument(e){var t,o;(o=(t=this.editorRef)==null?void 0:t.nativeElement)==null||o.loadDocument(e)}undo(){var e,t;return((t=(e=this.editorRef)==null?void 0:e.nativeElement)==null?void 0:t.undo())??!1}redo(){var e,t;return((t=(e=this.editorRef)==null?void 0:e.nativeElement)==null?void 0:t.redo())??!1}_addListener(e,t,o){e.addEventListener(t,o),this._listeners.push([t,o])}};n([i.ViewChild("editorEl",{static:!1})],exports.PigeonEditorComponent.prototype,"editorRef",2);n([i.Input()],exports.PigeonEditorComponent.prototype,"document",2);n([i.Input()],exports.PigeonEditorComponent.prototype,"config",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonChange",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonSelect",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonReady",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonPreview",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonExport",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonExportJson",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonExportMjml",2);n([i.Output()],exports.PigeonEditorComponent.prototype,"pigeonExportHtml",2);exports.PigeonEditorComponent=n([i.Component({selector:"pigeon-editor-wrapper",standalone:!0,schemas:[i.CUSTOM_ELEMENTS_SCHEMA],template:"<pigeon-editor #editorEl></pigeon-editor>",styles:[`
2
- :host {
3
- display: block;
4
- width: 100%;
5
- height: 100%;
6
- }
7
- pigeon-editor {
8
- width: 100%;
9
- height: 100%;
10
- }
11
- `]})],exports.PigeonEditorComponent);
package/dist/index.d.ts DELETED
@@ -1,119 +0,0 @@
1
- import { AfterViewInit } from '@angular/core';
2
- import { AssetManagerConfig } from '@lit-pigeon/core';
3
- import { BlockType } from '@lit-pigeon/core';
4
- import { ButtonBlock } from '@lit-pigeon/core';
5
- import { ColumnNode } from '@lit-pigeon/core';
6
- import { ContentBlock } from '@lit-pigeon/core';
7
- import { DividerBlock } from '@lit-pigeon/core';
8
- import { EditorConfig } from '@lit-pigeon/core';
9
- import { EventEmitter } from '@angular/core';
10
- import { HeroBlock } from '@lit-pigeon/core';
11
- import { HtmlBlock } from '@lit-pigeon/core';
12
- import { ImageBlock } from '@lit-pigeon/core';
13
- import { MergeTag } from '@lit-pigeon/core';
14
- import { MergeTagConfig } from '@lit-pigeon/core';
15
- import { NavBarBlock } from '@lit-pigeon/core';
16
- import { NavLink } from '@lit-pigeon/core';
17
- import { OnChanges } from '@angular/core';
18
- import { OnDestroy } from '@angular/core';
19
- import { PigeonDocument } from '@lit-pigeon/core';
20
- import { Renderer } from '@lit-pigeon/core';
21
- import { RenderOptions } from '@lit-pigeon/core';
22
- import { RenderResult } from '@lit-pigeon/core';
23
- import { RowNode } from '@lit-pigeon/core';
24
- import { Selection as Selection_2 } from '@lit-pigeon/core';
25
- import { SimpleChanges } from '@angular/core';
26
- import { SocialBlock } from '@lit-pigeon/core';
27
- import { SocialIcon } from '@lit-pigeon/core';
28
- import { SpacerBlock } from '@lit-pigeon/core';
29
- import { Spacing } from '@lit-pigeon/core';
30
- import { TextBlock } from '@lit-pigeon/core';
31
-
32
- export { AssetManagerConfig }
33
-
34
- export { BlockType }
35
-
36
- export { ButtonBlock }
37
-
38
- export { ColumnNode }
39
-
40
- export { ContentBlock }
41
-
42
- export { DividerBlock }
43
-
44
- export { EditorConfig }
45
-
46
- export { HeroBlock }
47
-
48
- export { HtmlBlock }
49
-
50
- export { ImageBlock }
51
-
52
- export { MergeTag }
53
-
54
- export { MergeTagConfig }
55
-
56
- export { NavBarBlock }
57
-
58
- export { NavLink }
59
-
60
- export { PigeonDocument }
61
-
62
- export declare class PigeonEditorComponent implements AfterViewInit, OnChanges, OnDestroy {
63
- private editorRef;
64
- document?: PigeonDocument;
65
- config?: Partial<EditorConfig>;
66
- pigeonChange: EventEmitter<{
67
- document: PigeonDocument;
68
- }>;
69
- pigeonSelect: EventEmitter<{
70
- selection: Selection_2 | null;
71
- }>;
72
- pigeonReady: EventEmitter<void>;
73
- pigeonPreview: EventEmitter<void>;
74
- pigeonExport: EventEmitter<void>;
75
- pigeonExportJson: EventEmitter<{
76
- document: PigeonDocument;
77
- }>;
78
- pigeonExportMjml: EventEmitter<{
79
- mjml: string;
80
- }>;
81
- pigeonExportHtml: EventEmitter<{
82
- html: string;
83
- }>;
84
- private _listeners;
85
- ngAfterViewInit(): void;
86
- ngOnChanges(changes: SimpleChanges): void;
87
- ngOnDestroy(): void;
88
- /** Returns the current document from the editor. */
89
- getDocument(): PigeonDocument | undefined;
90
- /** Loads a new document into the editor (resets history). */
91
- loadDocument(doc: PigeonDocument): void;
92
- /** Undo the last change. */
93
- undo(): boolean;
94
- /** Redo the last undone change. */
95
- redo(): boolean;
96
- private _addListener;
97
- }
98
-
99
- export { Renderer }
100
-
101
- export { RenderOptions }
102
-
103
- export { RenderResult }
104
-
105
- export { RowNode }
106
-
107
- export { Selection_2 as Selection }
108
-
109
- export { SocialBlock }
110
-
111
- export { SocialIcon }
112
-
113
- export { SpacerBlock }
114
-
115
- export { Spacing }
116
-
117
- export { TextBlock }
118
-
119
- export { }
package/dist/index.js DELETED
@@ -1,125 +0,0 @@
1
- import { ViewChild as m, Input as l, Output as s, Component as a, CUSTOM_ELEMENTS_SCHEMA as c, EventEmitter as r } from "@angular/core";
2
- import "@lit-pigeon/editor";
3
- var f = Object.defineProperty, E = Object.getOwnPropertyDescriptor, n = (e, t, i, d) => {
4
- for (var p = d > 1 ? void 0 : d ? E(t, i) : t, h = e.length - 1, g; h >= 0; h--)
5
- (g = e[h]) && (p = (d ? g(t, i, p) : g(p)) || p);
6
- return d && p && f(t, i, p), p;
7
- };
8
- let o = class {
9
- constructor() {
10
- this.pigeonChange = new r(), this.pigeonSelect = new r(), this.pigeonReady = new r(), this.pigeonPreview = new r(), this.pigeonExport = new r(), this.pigeonExportJson = new r(), this.pigeonExportMjml = new r(), this.pigeonExportHtml = new r(), this._listeners = [];
11
- }
12
- ngAfterViewInit() {
13
- var t;
14
- const e = (t = this.editorRef) == null ? void 0 : t.nativeElement;
15
- e && (this.document && (e.document = this.document), this.config && (e.config = this.config), this._addListener(e, "pigeon:change", (i) => {
16
- this.pigeonChange.emit(i.detail);
17
- }), this._addListener(e, "pigeon:select", (i) => {
18
- this.pigeonSelect.emit(i.detail);
19
- }), this._addListener(e, "pigeon:ready", () => {
20
- this.pigeonReady.emit();
21
- }), this._addListener(e, "pigeon:preview", () => {
22
- this.pigeonPreview.emit();
23
- }), this._addListener(e, "pigeon:export", () => {
24
- this.pigeonExport.emit();
25
- }), this._addListener(e, "pigeon:export-json", (i) => {
26
- this.pigeonExportJson.emit(i.detail);
27
- }), this._addListener(e, "pigeon:export-mjml", (i) => {
28
- this.pigeonExportMjml.emit(i.detail);
29
- }), this._addListener(e, "pigeon:export-html", (i) => {
30
- this.pigeonExportHtml.emit(i.detail);
31
- }));
32
- }
33
- ngOnChanges(e) {
34
- var i;
35
- const t = (i = this.editorRef) == null ? void 0 : i.nativeElement;
36
- t && (e.document && this.document && (t.document = this.document), e.config && this.config && (t.config = this.config));
37
- }
38
- ngOnDestroy() {
39
- var t;
40
- const e = (t = this.editorRef) == null ? void 0 : t.nativeElement;
41
- if (e) {
42
- for (const [i, d] of this._listeners)
43
- e.removeEventListener(i, d);
44
- this._listeners = [];
45
- }
46
- }
47
- /** Returns the current document from the editor. */
48
- getDocument() {
49
- var e, t;
50
- return (t = (e = this.editorRef) == null ? void 0 : e.nativeElement) == null ? void 0 : t.getDocument();
51
- }
52
- /** Loads a new document into the editor (resets history). */
53
- loadDocument(e) {
54
- var t, i;
55
- (i = (t = this.editorRef) == null ? void 0 : t.nativeElement) == null || i.loadDocument(e);
56
- }
57
- /** Undo the last change. */
58
- undo() {
59
- var e, t;
60
- return ((t = (e = this.editorRef) == null ? void 0 : e.nativeElement) == null ? void 0 : t.undo()) ?? !1;
61
- }
62
- /** Redo the last undone change. */
63
- redo() {
64
- var e, t;
65
- return ((t = (e = this.editorRef) == null ? void 0 : e.nativeElement) == null ? void 0 : t.redo()) ?? !1;
66
- }
67
- _addListener(e, t, i) {
68
- e.addEventListener(t, i), this._listeners.push([t, i]);
69
- }
70
- };
71
- n([
72
- m("editorEl", { static: !1 })
73
- ], o.prototype, "editorRef", 2);
74
- n([
75
- l()
76
- ], o.prototype, "document", 2);
77
- n([
78
- l()
79
- ], o.prototype, "config", 2);
80
- n([
81
- s()
82
- ], o.prototype, "pigeonChange", 2);
83
- n([
84
- s()
85
- ], o.prototype, "pigeonSelect", 2);
86
- n([
87
- s()
88
- ], o.prototype, "pigeonReady", 2);
89
- n([
90
- s()
91
- ], o.prototype, "pigeonPreview", 2);
92
- n([
93
- s()
94
- ], o.prototype, "pigeonExport", 2);
95
- n([
96
- s()
97
- ], o.prototype, "pigeonExportJson", 2);
98
- n([
99
- s()
100
- ], o.prototype, "pigeonExportMjml", 2);
101
- n([
102
- s()
103
- ], o.prototype, "pigeonExportHtml", 2);
104
- o = n([
105
- a({
106
- selector: "pigeon-editor-wrapper",
107
- standalone: !0,
108
- schemas: [c],
109
- template: "<pigeon-editor #editorEl></pigeon-editor>",
110
- styles: [`
111
- :host {
112
- display: block;
113
- width: 100%;
114
- height: 100%;
115
- }
116
- pigeon-editor {
117
- width: 100%;
118
- height: 100%;
119
- }
120
- `]
121
- })
122
- ], o);
123
- export {
124
- o as PigeonEditorComponent
125
- };