@emabuild/core 0.0.2 → 0.0.4

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.
Files changed (74) hide show
  1. package/README.md +410 -0
  2. package/dist/dnd/drag-manager.d.ts +13 -14
  3. package/dist/dnd/drag-manager.d.ts.map +1 -1
  4. package/dist/dnd/drop-indicator.d.ts +24 -0
  5. package/dist/dnd/drop-indicator.d.ts.map +1 -0
  6. package/dist/dnd/shadow-dom-utils.d.ts +29 -0
  7. package/dist/dnd/shadow-dom-utils.d.ts.map +1 -0
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/{mail-editor-CoB2C5CT.js → mail-editor-D0FbEUZu.js} +677 -870
  12. package/dist/mail-editor-D0FbEUZu.js.map +1 -0
  13. package/dist/mail-editor.d.ts +3 -3
  14. package/dist/mail-editor.d.ts.map +1 -1
  15. package/dist/mail-editor.js +1 -1
  16. package/dist/properties/property-panel.d.ts +4 -9
  17. package/dist/properties/property-panel.d.ts.map +1 -1
  18. package/dist/properties/widgets/alignment-widget.d.ts +4 -0
  19. package/dist/properties/widgets/alignment-widget.d.ts.map +1 -0
  20. package/dist/properties/widgets/color-picker-widget.d.ts +4 -0
  21. package/dist/properties/widgets/color-picker-widget.d.ts.map +1 -0
  22. package/dist/properties/widgets/dropdown-widget.d.ts +4 -0
  23. package/dist/properties/widgets/dropdown-widget.d.ts.map +1 -0
  24. package/dist/properties/widgets/index.d.ts +8 -0
  25. package/dist/properties/widgets/index.d.ts.map +1 -0
  26. package/dist/properties/widgets/padding-widget.d.ts +4 -0
  27. package/dist/properties/widgets/padding-widget.d.ts.map +1 -0
  28. package/dist/properties/widgets/text-input-widget.d.ts +4 -0
  29. package/dist/properties/widgets/text-input-widget.d.ts.map +1 -0
  30. package/dist/properties/widgets/textarea-widget.d.ts +4 -0
  31. package/dist/properties/widgets/textarea-widget.d.ts.map +1 -0
  32. package/dist/properties/widgets/toggle-widget.d.ts +4 -0
  33. package/dist/properties/widgets/toggle-widget.d.ts.map +1 -0
  34. package/dist/sidebar/body-settings.d.ts +15 -0
  35. package/dist/sidebar/body-settings.d.ts.map +1 -0
  36. package/dist/sidebar/editor-sidebar.d.ts +0 -3
  37. package/dist/sidebar/editor-sidebar.d.ts.map +1 -1
  38. package/dist/state/design-factory.d.ts +9 -0
  39. package/dist/state/design-factory.d.ts.map +1 -0
  40. package/dist/state/design-lookup.d.ts +14 -0
  41. package/dist/state/design-lookup.d.ts.map +1 -0
  42. package/dist/state/editor-store.d.ts +27 -10
  43. package/dist/state/editor-store.d.ts.map +1 -1
  44. package/dist/state/history-manager.d.ts +20 -0
  45. package/dist/state/history-manager.d.ts.map +1 -0
  46. package/dist/tools/built-in/button-tool.d.ts.map +1 -1
  47. package/dist/tools/built-in/divider-tool.d.ts.map +1 -1
  48. package/dist/tools/built-in/form-tool.d.ts.map +1 -1
  49. package/dist/tools/built-in/heading-tool.d.ts.map +1 -1
  50. package/dist/tools/built-in/html-tool.d.ts.map +1 -1
  51. package/dist/tools/built-in/image-tool.d.ts.map +1 -1
  52. package/dist/tools/built-in/menu-tool.d.ts.map +1 -1
  53. package/dist/tools/built-in/paragraph-tool.d.ts.map +1 -1
  54. package/dist/tools/built-in/social-tool.d.ts.map +1 -1
  55. package/dist/tools/built-in/table-tool.d.ts.map +1 -1
  56. package/dist/tools/built-in/text-tool.d.ts.map +1 -1
  57. package/dist/tools/built-in/timer-tool.d.ts.map +1 -1
  58. package/dist/tools/built-in/video-tool.d.ts.map +1 -1
  59. package/dist/tools/helpers/email-html.d.ts +55 -0
  60. package/dist/tools/helpers/email-html.d.ts.map +1 -0
  61. package/dist/tools/helpers/index.d.ts +5 -0
  62. package/dist/tools/helpers/index.d.ts.map +1 -0
  63. package/dist/tools/helpers/types.d.ts +36 -0
  64. package/dist/tools/helpers/types.d.ts.map +1 -0
  65. package/dist/tools/helpers/value-extractor.d.ts +31 -0
  66. package/dist/tools/helpers/value-extractor.d.ts.map +1 -0
  67. package/dist/utils/event-emitter.d.ts +32 -4
  68. package/dist/utils/event-emitter.d.ts.map +1 -1
  69. package/dist/utils/id-generator.d.ts +17 -3
  70. package/dist/utils/id-generator.d.ts.map +1 -1
  71. package/package.json +16 -4
  72. package/dist/mail-editor-CoB2C5CT.js.map +0 -1
  73. package/dist/utils/deep-clone.d.ts +0 -2
  74. package/dist/utils/deep-clone.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea-widget.d.ts","sourceRoot":"","sources":["../../../src/properties/widgets/textarea-widget.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAE3C,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAW1G"}
@@ -0,0 +1,4 @@
1
+ import { TemplateResult } from 'lit';
2
+ /** Render a toggle checkbox */
3
+ export declare function renderToggle(value: boolean, onChange: (v: boolean) => void, label: string): TemplateResult;
4
+ //# sourceMappingURL=toggle-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-widget.d.ts","sourceRoot":"","sources":["../../../src/properties/widgets/toggle-widget.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAE3C,+BAA+B;AAC/B,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAU1G"}
@@ -0,0 +1,15 @@
1
+ import { LitElement } from 'lit';
2
+ import { EditorStore } from '../state/editor-store.js';
3
+ declare const BodySettings_base: (new (...args: any[]) => LitElement) & typeof LitElement;
4
+ export declare class BodySettings extends BodySettings_base {
5
+ static styles: import('lit').CSSResult;
6
+ store: EditorStore;
7
+ private update_;
8
+ private updateLinkStyle;
9
+ private updateFontFamily;
10
+ render(): import('lit').TemplateResult<1>;
11
+ /** Reusable color field (swatch + hex input) */
12
+ private renderColorField;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=body-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-settings.d.ts","sourceRoot":"","sources":["../../src/sidebar/body-settings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;;AAc5D,qBACa,YAAa,SAAQ,iBAA2B;IAC3D,MAAM,CAAC,MAAM,0BAwBX;IAE8B,KAAK,EAAG,WAAW,CAAC;IAEpD,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAKxB,MAAM;IAmDN,gDAAgD;IAChD,OAAO,CAAC,gBAAgB;CAWzB"}
@@ -13,9 +13,6 @@ export declare class EditorSidebar extends EditorSidebar_base {
13
13
  private renderContentTab;
14
14
  private renderLayoutOption;
15
15
  private renderBlocksTab;
16
- private handleBodyChange;
17
- private handleLinkStyleChange;
18
- private handleFontFamilyChange;
19
16
  private renderBodyTab;
20
17
  }
21
18
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"editor-sidebar.d.ts","sourceRoot":"","sources":["../../src/sidebar/editor-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,2BAA2B,CAAC;;AAIjF,qBACa,aAAc,SAAQ,kBAA2B;IAC5D,MAAM,CAAC,MAAM,0BAkHX;IAE8B,KAAK,EAAG,WAAW,CAAC;IACpB,YAAY,EAAG,YAAY,CAAC;IAE5D,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,gBAAgB;IAKxB,MAAM;IAmBN,OAAO,CAAC,gBAAgB;IA8BxB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,aAAa;CAsEtB"}
1
+ {"version":3,"file":"editor-sidebar.d.ts","sourceRoot":"","sources":["../../src/sidebar/editor-sidebar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,2BAA2B,CAAC;AAGjF,OAAO,oBAAoB,CAAC;;AAE5B,qBACa,aAAc,SAAQ,kBAA2B;IAC5D,MAAM,CAAC,MAAM,0BAkHX;IAE8B,KAAK,EAAG,WAAW,CAAC;IACpB,YAAY,EAAG,YAAY,CAAC;IAE5D,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,gBAAgB;IAKxB,MAAM;IAmBN,OAAO,CAAC,gBAAgB;IA8BxB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa;CAGtB"}
@@ -0,0 +1,9 @@
1
+ import { EmailDesign, DesignRow, DesignContent } from '@emabuild/types';
2
+ import { CounterManager } from '../utils/id-generator.js';
3
+ /** Create a blank design */
4
+ export declare function createEmptyDesign(): EmailDesign;
5
+ /** Create a new row with the given column proportions (e.g. [1,1] for 50/50) */
6
+ export declare function createRow(cm: CounterManager, cellProportions: number[]): DesignRow;
7
+ /** Create a new content block for the given tool type */
8
+ export declare function createContent(cm: CounterManager, type: string, values?: Record<string, unknown>): DesignContent;
9
+ //# sourceMappingURL=design-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-factory.d.ts","sourceRoot":"","sources":["../../src/state/design-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,4BAA4B;AAC5B,wBAAgB,iBAAiB,IAAI,WAAW,CA4C/C;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,SAAS,CAmClF;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,aAAa,CAiBnH"}
@@ -0,0 +1,14 @@
1
+ import { EmailDesign, DesignRow, DesignColumn, DesignContent } from '@emabuild/types';
2
+ /** Find a row by ID */
3
+ export declare function findRow(design: EmailDesign, rowId: string): DesignRow | undefined;
4
+ /** Find a column by ID across all rows */
5
+ export declare function findColumn(design: EmailDesign, columnId: string): DesignColumn | undefined;
6
+ /** Find a content block by ID across all rows and columns */
7
+ export declare function findContent(design: EmailDesign, contentId: string): DesignContent | undefined;
8
+ /** Find the column that contains a given content block */
9
+ export declare function findParentColumn(design: EmailDesign, contentId: string): DesignColumn | undefined;
10
+ /** Find the row that contains a given column */
11
+ export declare function findParentRow(design: EmailDesign, columnId: string): DesignRow | undefined;
12
+ /** Get the index of a row within the design */
13
+ export declare function getRowIndex(design: EmailDesign, rowId: string): number;
14
+ //# sourceMappingURL=design-lookup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-lookup.d.ts","sourceRoot":"","sources":["../../src/state/design-lookup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3F,uBAAuB;AACvB,wBAAgB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEjF;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAM1F;AAED,6DAA6D;AAC7D,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAQ7F;AAED,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAOjG;AAED,gDAAgD;AAChD,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAK1F;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtE"}
@@ -1,24 +1,28 @@
1
- import { UnlayerDesign, DesignBody, DesignRow, DesignColumn, DesignContent, BodyValues, RowValues, ColumnValues, ContentValues } from '@emabuild/types';
1
+ import { EmailDesign, DesignBody, DesignRow, DesignColumn, DesignContent, BodyValues, RowValues, ColumnValues, ContentValues } from '@emabuild/types';
2
2
  import { EventEmitter } from '../utils/event-emitter.js';
3
3
  export type StoreSubscriber = () => void;
4
4
  export declare class EditorStore {
5
5
  private design;
6
- private undoStack;
7
- private redoStack;
8
- private maxHistory;
9
- private subscribers;
6
+ private history;
10
7
  private counterManager;
8
+ private subscribers;
9
+ /** Public event emitter for design:loaded, design:updated, etc. */
11
10
  readonly events: EventEmitter;
12
11
  private _selectedId;
13
12
  private _hoveredId;
14
13
  private _viewMode;
15
14
  private _activeTab;
16
15
  constructor();
16
+ /** Subscribe to all state changes. Returns an unsubscribe function. */
17
17
  subscribe(fn: StoreSubscriber): () => void;
18
18
  private notify;
19
- getDesign(): UnlayerDesign;
19
+ /** Get the full design document */
20
+ getDesign(): EmailDesign;
21
+ /** Get the design body */
20
22
  getBody(): DesignBody;
23
+ /** Get all rows */
21
24
  getRows(): DesignRow[];
25
+ /** Get body-level values (background, fonts, etc.) */
22
26
  getBodyValues(): BodyValues;
23
27
  get selectedId(): string | null;
24
28
  get hoveredId(): string | null;
@@ -26,35 +30,48 @@ export declare class EditorStore {
26
30
  get activeTab(): string;
27
31
  get canUndo(): boolean;
28
32
  get canRedo(): boolean;
29
- loadDesign(design: UnlayerDesign): void;
30
- private pushHistory;
33
+ /** Load a design document, resetting history and selection */
34
+ loadDesign(design: EmailDesign): void;
31
35
  undo(): void;
32
36
  redo(): void;
33
37
  select(id: string | null): void;
34
38
  hover(id: string | null): void;
35
39
  setViewMode(mode: 'desktop' | 'mobile'): void;
36
40
  setActiveTab(tab: string): void;
41
+ /** Add a row at the given index (or at the end) */
37
42
  addRow(row: DesignRow, index?: number): void;
43
+ /** Remove a row by ID */
38
44
  removeRow(rowId: string): void;
45
+ /** Move a row from one index to another */
39
46
  moveRow(fromIndex: number, toIndex: number): void;
47
+ /** Duplicate a row, assigning fresh IDs to all nested elements */
40
48
  duplicateRow(rowId: string): void;
49
+ /** Get the index of a row */
41
50
  getRowIndex(rowId: string): number;
51
+ /** Update row-level values */
42
52
  updateRowValues(rowId: string, patch: Partial<RowValues>): void;
53
+ /** Update column-level values */
43
54
  updateColumnValues(columnId: string, patch: Partial<ColumnValues>): void;
55
+ /** Add content to a column at the given index */
44
56
  addContent(columnId: string, content: DesignContent, index?: number): void;
57
+ /** Remove a content block by ID */
45
58
  removeContent(contentId: string): void;
59
+ /** Update content values by ID */
46
60
  updateContentValues(contentId: string, patch: Partial<ContentValues>): void;
61
+ /** Move a content block to a different column at a given index */
47
62
  moveContent(contentId: string, targetColumnId: string, targetIndex: number): void;
63
+ /** Duplicate a content block, inserting the copy right after the original */
48
64
  duplicateContent(contentId: string): void;
65
+ /** Update body-level values (background, fonts, etc.) */
49
66
  updateBodyValues(patch: Partial<BodyValues>): void;
50
67
  findRow(rowId: string): DesignRow | undefined;
51
68
  findColumn(columnId: string): DesignColumn | undefined;
52
69
  findContent(contentId: string): DesignContent | undefined;
53
70
  findParentColumn(contentId: string): DesignColumn | undefined;
54
71
  findParentRow(columnId: string): DesignRow | undefined;
55
- /** Creates a new row with the given column layout */
72
+ /** Create a new row with the given column layout */
56
73
  createRow(cellProportions: number[]): DesignRow;
57
- /** Creates a new content block for the given tool type */
74
+ /** Create a new content block for the given tool type */
58
75
  createContent(type: string, values?: Record<string, unknown>): DesignContent;
59
76
  private syncCounters;
60
77
  private emitUpdate;
@@ -1 +1 @@
1
- {"version":3,"file":"editor-store.d.ts","sourceRoot":"","sources":["../../src/state/editor-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EAKd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAwDzD,MAAM,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC;AAEzC,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,cAAc,CAA0B;IAChD,QAAQ,CAAC,MAAM,eAAsB;IAGrC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,UA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AAI;IAkBjF,6EAA6E;IAC7E,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAwBzC,yDAAyD;IACzD,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI;IASlD,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAC7C,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IACtD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IACzD,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAC7D,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAItD,oDAAoD;IACpD,SAAS,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,SAAS;IAM/C,yDAAyD;IACzD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,aAAa;IAQhF,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,UAAU;CAGnB"}
@@ -0,0 +1,20 @@
1
+ import { EmailDesign } from '@emabuild/types';
2
+ export declare class HistoryManager {
3
+ private undoStack;
4
+ private redoStack;
5
+ private readonly maxHistory;
6
+ constructor(maxHistory?: number);
7
+ /** Whether there are states to undo to */
8
+ get canUndo(): boolean;
9
+ /** Whether there are states to redo to */
10
+ get canRedo(): boolean;
11
+ /** Save current design to the undo stack before a mutation */
12
+ push(design: EmailDesign): void;
13
+ /** Restore the previous state, pushing current state to redo. Returns the restored design or undefined. */
14
+ undo(currentDesign: EmailDesign): EmailDesign | undefined;
15
+ /** Restore the next state, pushing current state to undo. Returns the restored design or undefined. */
16
+ redo(currentDesign: EmailDesign): EmailDesign | undefined;
17
+ /** Clear all history (e.g. when loading a new design) */
18
+ clear(): void;
19
+ }
20
+ //# sourceMappingURL=history-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history-manager.d.ts","sourceRoot":"","sources":["../../src/state/history-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,UAAU,SAAK;IAI3B,0CAA0C;IAC1C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,0CAA0C;IAC1C,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,8DAA8D;IAC9D,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAQ/B,2GAA2G;IAC3G,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS;IAOzD,uGAAuG;IACvG,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS;IAOzD,yDAAyD;IACzD,KAAK,IAAI,IAAI;CAId"}
@@ -1 +1 @@
1
- {"version":3,"file":"button-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/button-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,UAAU,EAAE,iBAsJxB,CAAC"}
1
+ {"version":3,"file":"button-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/button-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,UAAU,EAAE,iBAmHxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"divider-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/divider-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,WAAW,EAAE,iBA2EzB,CAAC"}
1
+ {"version":3,"file":"divider-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/divider-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,WAAW,EAAE,iBAqDzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/form-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,QAAQ,EAAE,iBA6FtB,CAAC"}
1
+ {"version":3,"file":"form-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/form-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAU7D,eAAO,MAAM,QAAQ,EAAE,iBAuEtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"heading-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/heading-tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,WAAW,EAAE,iBAkIzB,CAAC"}
1
+ {"version":3,"file":"heading-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/heading-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,WAAW,EAAE,iBAyGzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"html-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/html-tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,QAAQ,EAAE,iBAmDtB,CAAC"}
1
+ {"version":3,"file":"html-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/html-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,QAAQ,EAAE,iBAyCtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"image-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/image-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,SAAS,EAAE,iBA6GvB,CAAC"}
1
+ {"version":3,"file":"image-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/image-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,SAAS,EAAE,iBAgFvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"menu-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/menu-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAa7D,eAAO,MAAM,QAAQ,EAAE,iBAiFtB,CAAC"}
1
+ {"version":3,"file":"menu-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/menu-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAW7D,eAAO,MAAM,QAAQ,EAAE,iBAgEtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"paragraph-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/paragraph-tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,aAAa,EAAE,iBA+D3B,CAAC"}
1
+ {"version":3,"file":"paragraph-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/paragraph-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,aAAa,EAAE,iBAuD3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"social-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/social-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAgB7D,eAAO,MAAM,UAAU,EAAE,iBAiFxB,CAAC"}
1
+ {"version":3,"file":"social-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/social-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAY7D,eAAO,MAAM,UAAU,EAAE,iBA2DxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"table-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/table-tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAQ7D,eAAO,MAAM,SAAS,EAAE,iBAuGvB,CAAC"}
1
+ {"version":3,"file":"table-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/table-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAU7D,eAAO,MAAM,SAAS,EAAE,iBAiEvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"text-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/text-tool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,QAAQ,EAAE,iBAoGtB,CAAC"}
1
+ {"version":3,"file":"text-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/text-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,QAAQ,EAAE,iBAoFtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"timer-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/timer-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,SAAS,EAAE,iBA0EvB,CAAC"}
1
+ {"version":3,"file":"timer-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/timer-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,eAAO,MAAM,SAAS,EAAE,iBAsDvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"video-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/video-tool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAY7D,eAAO,MAAM,SAAS,EAAE,iBAqFvB,CAAC"}
1
+ {"version":3,"file":"video-tool.d.ts","sourceRoot":"","sources":["../../../src/tools/built-in/video-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAU7D,eAAO,MAAM,SAAS,EAAE,iBAqDvB,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module email-html
3
+ *
4
+ * Shared HTML generation utilities for email-safe output.
5
+ * Provides the table-cell wrapper used by every tool's `renderHtml()`,
6
+ * plus VML helpers for Outlook compatibility.
7
+ */
8
+ /** Options for the standard email table cell wrapper */
9
+ export interface TableCellOptions {
10
+ /** CSS padding (e.g. "10px" or "10px 20px") */
11
+ padding: string;
12
+ /** Horizontal alignment: "left" | "center" | "right" */
13
+ align?: string;
14
+ /** Additional inline styles on the `<td>` element */
15
+ extraTdStyle?: string;
16
+ }
17
+ /**
18
+ * Wrap content in the standard email-safe table cell structure.
19
+ * This is the `<table role="presentation">` pattern used by every tool.
20
+ *
21
+ * @param content - The inner HTML content
22
+ * @param options - Cell configuration (padding, alignment, extra styles)
23
+ * @returns Complete table HTML string
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * return emailTableCell('<p>Hello</p>', { padding: '10px', align: 'left' });
28
+ * ```
29
+ */
30
+ export declare function emailTableCell(content: string, options: TableCellOptions): string;
31
+ /** Options for VML rounded-rectangle button (Outlook fallback) */
32
+ export interface VmlButtonOptions {
33
+ /** Background color */
34
+ bgColor: string;
35
+ /** Text color */
36
+ textColor: string;
37
+ /** Font size (e.g. "14px") */
38
+ fontSize: string;
39
+ /** Font weight (e.g. "700") */
40
+ fontWeight: string;
41
+ /** CSS border-radius (e.g. "6px") */
42
+ borderRadius: string;
43
+ }
44
+ /**
45
+ * Generate a VML roundrect button for Outlook email clients.
46
+ * Outlook doesn't support CSS border-radius on `<a>` tags,
47
+ * so VML is needed for rounded buttons.
48
+ *
49
+ * @param text - Button label
50
+ * @param href - Button link URL
51
+ * @param options - Visual styling options
52
+ * @returns VML HTML wrapped in MSO conditional comments
53
+ */
54
+ export declare function vmlRoundrectButton(text: string, href: string, options: VmlButtonOptions): string;
55
+ //# sourceMappingURL=email-html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-html.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/email-html.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAQjF;AAED,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAYhG"}
@@ -0,0 +1,5 @@
1
+ export { str, num, jsonParse } from './value-extractor.js';
2
+ export { emailTableCell, vmlRoundrectButton } from './email-html.js';
3
+ export type { TableCellOptions, VmlButtonOptions } from './email-html.js';
4
+ export type { SocialIcon, MenuItem, FormField } from './types.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @module tool-types
3
+ *
4
+ * Shared interfaces used across multiple built-in tools.
5
+ * Extracted from individual tool files to avoid duplication.
6
+ */
7
+ /** Social media icon configuration (used by social-tool) */
8
+ export interface SocialIcon {
9
+ /** Display name (e.g. "Facebook") */
10
+ name: string;
11
+ /** Link URL */
12
+ url: string;
13
+ /** Icon character or emoji (e.g. "f", "in", "X") */
14
+ icon: string;
15
+ /** Background color for the icon circle (hex) */
16
+ color: string;
17
+ }
18
+ /** Menu navigation item (used by menu-tool) */
19
+ export interface MenuItem {
20
+ /** Display text */
21
+ text: string;
22
+ /** Link URL */
23
+ href: string;
24
+ }
25
+ /** Form field definition (used by form-tool) */
26
+ export interface FormField {
27
+ /** Field label displayed above the input */
28
+ label: string;
29
+ /** HTML name attribute for the input */
30
+ name: string;
31
+ /** Input type: "text", "email", "tel", "number", etc. */
32
+ type: string;
33
+ /** Placeholder text */
34
+ placeholder: string;
35
+ }
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,+CAA+C;AAC/C,MAAM,WAAW,QAAQ;IACvB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gDAAgD;AAChD,MAAM,WAAW,SAAS;IACxB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,31 @@
1
+ import { ContentValues } from '@emabuild/types';
2
+ /**
3
+ * Extract a string value with a fallback default.
4
+ * @param values - The content values map
5
+ * @param key - The property key to extract
6
+ * @param fallback - Default value if key is missing or empty
7
+ */
8
+ export declare function str(values: ContentValues, key: string, fallback?: string): string;
9
+ /**
10
+ * Extract a numeric value with a fallback default.
11
+ * Parses strings like "14px" or "100%" to their numeric part.
12
+ * @param values - The content values map
13
+ * @param key - The property key to extract
14
+ * @param fallback - Default value if key is missing or not a number
15
+ */
16
+ export declare function num(values: ContentValues, key: string, fallback?: number): number;
17
+ /**
18
+ * Safely parse a JSON string with a typed fallback.
19
+ * Used by tools that store structured data as JSON strings
20
+ * (social icons, menu items, table data, form fields).
21
+ *
22
+ * @param value - The raw value (expected to be a JSON string)
23
+ * @param fallback - Returned if parsing fails or value is not a string
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const items = jsonParse<MenuItem[]>(values.items, defaultItems);
28
+ * ```
29
+ */
30
+ export declare function jsonParse<T>(value: unknown, fallback: T): T;
31
+ //# sourceMappingURL=value-extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-extractor.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/value-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAK,GAAG,MAAM,CAI7E;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAQ5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAO3D"}
@@ -1,9 +1,37 @@
1
- type Listener = (...args: unknown[]) => void;
1
+ /**
2
+ * Type-safe event emitter with error isolation.
3
+ *
4
+ * Each listener is wrapped in a try/catch so a failing listener
5
+ * doesn't break other listeners or the emitting code.
6
+ */
7
+ /** Map of event names to their payload types */
8
+ export interface EditorEventMap {
9
+ 'design:loaded': {
10
+ design: unknown;
11
+ };
12
+ 'design:updated': {
13
+ type: string;
14
+ item?: unknown;
15
+ changes?: unknown;
16
+ };
17
+ 'editor:ready': void;
18
+ 'image:uploaded': {
19
+ url: string;
20
+ width?: number;
21
+ height?: number;
22
+ };
23
+ }
24
+ type EventName = keyof EditorEventMap | (string & {});
25
+ type Listener<T = unknown> = (payload: T) => void;
2
26
  export declare class EventEmitter {
3
27
  private listeners;
4
- on(event: string, listener: Listener): void;
5
- off(event: string, listener: Listener): void;
6
- emit(event: string, ...args: unknown[]): void;
28
+ /** Register a listener for an event */
29
+ on<K extends EventName>(event: K, listener: Listener<K extends keyof EditorEventMap ? EditorEventMap[K] : unknown>): void;
30
+ /** Remove a specific listener */
31
+ off<K extends EventName>(event: K, listener: Listener): void;
32
+ /** Emit an event with a payload. Errors in listeners are caught and logged. */
33
+ emit<K extends EventName>(event: K, payload?: K extends keyof EditorEventMap ? EditorEventMap[K] : unknown): void;
34
+ /** Remove all listeners, optionally scoped to a single event */
7
35
  removeAllListeners(event?: string): void;
8
36
  }
9
37
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"event-emitter.d.ts","sourceRoot":"","sources":["../../src/utils/event-emitter.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAE7C,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,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AAiC;IACjC,GAAG,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAI5D,+EAA+E;IAC/E,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,MAAM,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,IAAI;IAUjH,gEAAgE;IAChE,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CAOzC"}
@@ -1,7 +1,21 @@
1
+ /**
2
+ * Unique ID generator and counter manager.
3
+ *
4
+ * The counter manager tracks incrementing IDs per prefix
5
+ * (e.g. `u_row`, `u_column`, `u_content_text`) to match
6
+ * email editor's `counters` field in the design JSON.
7
+ */
8
+ /** Generate a unique ID for internal use (not email editor-compatible) */
1
9
  export declare function generateId(): string;
2
- export declare function createCounterManager(): {
10
+ /** Counter manager return type */
11
+ export interface CounterManager {
12
+ /** Get a snapshot of all current counters */
3
13
  getCounters(): Record<string, number>;
4
- setCounters(c: Record<string, number>): void;
14
+ /** Replace all counters (used when loading a design) */
15
+ setCounters(counters: Record<string, number>): void;
16
+ /** Increment and return the next value for a given prefix */
5
17
  next(prefix: string): number;
6
- };
18
+ }
19
+ /** Create an counter manager for ID generation */
20
+ export declare function createCounterManager(): CounterManager;
7
21
  //# sourceMappingURL=id-generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../../src/utils/id-generator.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,oBAAoB;mBAIjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;mBAItB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;iBAK/B,MAAM,GAAG,MAAM;EAM/B"}
1
+ {"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../../src/utils/id-generator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,0EAA0E;AAC1E,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,kCAAkC;AAClC,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,wDAAwD;IACxD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACpD,6DAA6D;IAC7D,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,kDAAkD;AAClD,wBAAgB,oBAAoB,IAAI,cAAc,CAqBrD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@emabuild/core",
3
- "version": "0.0.2",
4
- "description": "Drag & drop email editor Web Component — Unlayer-compatible",
3
+ "version": "0.0.4",
4
+ "description": "Drag & drop email editor Web Component — embeddable anywhere",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -26,8 +26,8 @@
26
26
  "customElements": "custom-elements.json",
27
27
  "dependencies": {
28
28
  "lit": "^3.2.0",
29
- "@emabuild/types": "0.0.2",
30
- "@emabuild/email-renderer": "0.0.2"
29
+ "@emabuild/types": "0.0.4",
30
+ "@emabuild/email-renderer": "0.0.4"
31
31
  },
32
32
  "devDependencies": {
33
33
  "vite": "^6.2.0",
@@ -36,6 +36,18 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
+ "keywords": [
40
+ "email",
41
+ "editor",
42
+ "drag-and-drop",
43
+ "email-builder",
44
+ "web-component",
45
+ "lit",
46
+ "newsletter",
47
+ "html-email",
48
+ "wysiwyg",
49
+ "email-template"
50
+ ],
39
51
  "license": "MIT",
40
52
  "sideEffects": false,
41
53
  "scripts": {