@lit-pigeon/editor 0.3.3 → 0.4.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/dist/templates.js CHANGED
@@ -1,270 +1,12 @@
1
- import { LitElement as u, html as l, css as v } from "lit";
2
- import { property as g, state as p, customElement as f } from "lit/decorators.js";
3
- const m = {
4
- // toolbar
5
- "toolbar.undo": "Undo",
6
- "toolbar.redo": "Redo",
7
- "toolbar.preview-device": "Preview device",
8
- "toolbar.desktop-view": "Desktop view",
9
- "toolbar.tablet-view-title": "Tablet view (768px)",
10
- "toolbar.tablet-view": "Tablet view",
11
- "toolbar.mobile-view-title": "Mobile view (375px)",
12
- "toolbar.mobile-view": "Mobile view",
13
- "toolbar.fullscreen": "Fullscreen",
14
- "toolbar.exit-fullscreen": "Exit fullscreen",
15
- "toolbar.enter-fullscreen": "Enter fullscreen",
16
- "toolbar.templates": "Templates",
17
- "toolbar.preview": "Preview",
18
- "toolbar.export": "Export",
19
- "toolbar.export-format": "Export format",
20
- "toolbar.export-html": "Export HTML",
21
- "toolbar.export-mjml": "Export MJML",
22
- "toolbar.export-json": "Export JSON",
23
- // palette
24
- "palette.label": "Palette",
25
- "palette.tab.content": "Content",
26
- "palette.tab.layers": "Layers",
27
- "palette.tab.brand": "Brand",
28
- "palette.tab.saved": "Saved",
29
- // palette — layout section
30
- "palette.layout.section-content": "Content",
31
- "palette.layout.section-layout": "Layout",
32
- "palette.layout.1-col": "1 Column",
33
- "palette.layout.2-col": "2 Columns",
34
- "palette.layout.3-col": "3 Columns",
35
- "palette.layout.4-col": "4 Columns",
36
- // palette — brand tab
37
- "palette.brand.colors": "Colors",
38
- "palette.brand.fonts": "Fonts",
39
- "palette.brand.logos": "Logos",
40
- "palette.brand.add": "+ Add",
41
- "palette.brand.no-colors": "No colors yet",
42
- "palette.brand.no-fonts": "No fonts yet",
43
- "palette.brand.no-logos": "No logos yet",
44
- "palette.brand.color-name-label": "Color name",
45
- "palette.brand.color-value-label": "Color value",
46
- "palette.brand.delete-title": "Delete",
47
- "palette.brand.insert-logo-title": "Insert logo",
48
- // palette — saved tab
49
- "palette.saved.empty": "No saved rows yet. Use the bookmark action on a row to save it here.",
50
- "palette.saved.delete-title": "Delete",
51
- // preview
52
- "preview.heading": "Preview",
53
- "preview.tab-group-label": "Preview format",
54
- "preview.tab.preview": "Preview",
55
- "preview.tab.html": "HTML",
56
- "preview.tab.mjml": "MJML",
57
- "preview.tab.json": "JSON",
58
- "preview.device.desktop": "Desktop preview",
59
- "preview.device.mobile": "Mobile preview",
60
- "preview.close": "Close preview",
61
- "preview.loading": "Rendering...",
62
- // template picker
63
- "template.heading": "Templates",
64
- "template.close": "Close",
65
- "template.section.choose": "Choose a template",
66
- "template.empty": "No templates available yet.",
67
- "template.section.save": "Save current as template",
68
- "template.field.name": "Name",
69
- "template.field.name-placeholder": "My template",
70
- "template.field.category": "Category",
71
- "template.field.description": "Description (optional)",
72
- "template.field.description-placeholder": "What is this template for?",
73
- "template.cancel": "Cancel",
74
- "template.save": "Save template",
75
- "template.error.name-required": "Name is required",
76
- // asset manager
77
- "asset.title": "Select asset",
78
- "asset.title-upload": "Select image",
79
- "asset.close": "Close",
80
- "asset.tab.library": "Library",
81
- "asset.tab.upload": "Upload",
82
- "asset.folder.all": "All folders",
83
- "asset.search": "Search assets",
84
- "asset.tag-filter-label": "Filter by tag",
85
- "asset.loading": "Loading…",
86
- "asset.empty.filtered": "No assets match your filters.",
87
- "asset.empty.no-assets": "No saved assets yet. Upload one to get started.",
88
- "asset.drop-zone.label": "Drag & drop an image here",
89
- "asset.drop-zone.hint": "or click to browse",
90
- "asset.url.separator": "or enter URL",
91
- "asset.url.placeholder": "https://example.com/image.jpg",
92
- "asset.url.use": "Use URL",
93
- // asset manager — stock tab
94
- "asset.tab.stock": "Stock",
95
- "asset.stock.search": "Search free photos…",
96
- "asset.stock.idle": "Search Unsplash and Pexels for free photos.",
97
- "asset.stock.empty": "No photos found. Try another search.",
98
- "asset.stock.load-more": "Load more",
99
- "asset.stock.photo-by": "Photo by",
100
- "asset.stock.on": "on",
101
- "asset.stock.error": "Couldn’t load photos. Check the API key or try again.",
102
- "asset.stock.rate-limited": "Rate limit reached. Try again shortly.",
103
- // property panels — shared (common) labels
104
- "panel.common.backgroundColor": "Background Color",
105
- "panel.common.padding": "Padding",
106
- "panel.common.outerPadding": "Outer Padding",
107
- "panel.common.innerPadding": "Inner Padding",
108
- "panel.common.alignment": "Alignment",
109
- "panel.common.fontSize": "Font Size",
110
- "panel.common.borderRadius": "Border Radius",
111
- "panel.common.linkUrl": "Link URL",
112
- "panel.common.urlPlaceholder": "https://example.com",
113
- "panel.common.contentHtml": "Content (HTML)",
114
- "panel.common.insertMergeTag": "Insert merge tag",
115
- "panel.common.tagBtn": "{ } Tag",
116
- "panel.common.uploadImage": "Upload Image",
117
- "panel.common.left": "Left",
118
- "panel.common.center": "Center",
119
- // property panels — body
120
- "panel.body.title": "Email Body",
121
- "panel.body.contentWidth": "Content Width",
122
- "panel.body.fontFamily": "Font Family",
123
- "panel.body.contentAlignment": "Content Alignment",
124
- "panel.body.emailName": "Email Name",
125
- "panel.body.previewText": "Preview Text",
126
- "panel.body.previewTextPlaceholder": "Email preview text...",
127
- // property panels — text
128
- "panel.text.title": "Text Properties",
129
- "panel.text.textAlign": "Text Align",
130
- "panel.text.lineHeight": "Line Height",
131
- // property panels — button
132
- "panel.button.title": "Button Properties",
133
- "panel.button.buttonText": "Button Text",
134
- "panel.button.textColor": "Text Color",
135
- "panel.button.fontWeight": "Font Weight",
136
- "panel.button.fontWeight.normal": "Normal (400)",
137
- "panel.button.fontWeight.medium": "Medium (500)",
138
- "panel.button.fontWeight.semibold": "Semibold (600)",
139
- "panel.button.fontWeight.bold": "Bold (700)",
140
- "panel.button.fullWidth": "Full Width",
141
- // property panels — image
142
- "panel.image.title": "Image Properties",
143
- "panel.image.imageUrl": "Image URL",
144
- "panel.image.urlPlaceholder": "https://example.com/image.jpg",
145
- "panel.image.altText": "Alt Text",
146
- "panel.image.altPlaceholder": "Image description",
147
- "panel.image.width": "Width (0 = auto)",
148
- // property panels — hero
149
- "panel.hero.title": "Hero Properties",
150
- "panel.hero.backgroundUrl": "Background URL",
151
- "panel.hero.backgroundUrlPlaceholder": "https://example.com/hero.jpg",
152
- "panel.hero.backgroundPosition": "Background Position",
153
- "panel.hero.mode": "Mode",
154
- "panel.hero.modeFluidHeight": "Fluid Height",
155
- "panel.hero.modeFixedHeight": "Fixed Height",
156
- "panel.hero.height": "Height",
157
- "panel.hero.width": "Width",
158
- "panel.hero.verticalAlign": "Vertical Align",
159
- "panel.hero.verticalAlignTop": "Top",
160
- "panel.hero.verticalAlignMiddle": "Middle",
161
- "panel.hero.verticalAlignBottom": "Bottom",
162
- // property panels — navbar
163
- "panel.navbar.title": "Navbar Properties",
164
- "panel.navbar.links": "Links",
165
- "panel.navbar.linkLabel": "Link",
166
- "panel.navbar.removeLink": "Remove",
167
- "panel.navbar.linkText": "Text",
168
- "panel.navbar.url": "URL",
169
- "panel.navbar.addLink": "+ Add Link",
170
- "panel.navbar.hamburger": "Hamburger (mobile)",
171
- "panel.navbar.hamburgerShow": "Show",
172
- "panel.navbar.hamburgerHide": "Hide",
173
- "panel.navbar.linkColor": "Link Color",
174
- "panel.navbar.linkFontSize": "Link Font Size",
175
- "panel.navbar.linkPadding": "Link Padding",
176
- // property panels — divider
177
- "panel.divider.title": "Divider Properties",
178
- "panel.divider.style": "Style",
179
- "panel.divider.styleSolid": "Solid",
180
- "panel.divider.styleDashed": "Dashed",
181
- "panel.divider.styleDotted": "Dotted",
182
- "panel.divider.color": "Color",
183
- "panel.divider.width": "Width",
184
- "panel.divider.lineWidth": "Line Width",
185
- // property panels — spacer
186
- "panel.spacer.title": "Spacer Properties",
187
- "panel.spacer.height": "Height",
188
- // property panels — social
189
- "panel.social.title": "Social Properties",
190
- "panel.social.icons": "Icons",
191
- "panel.social.iconLabel": "Icon",
192
- "panel.social.removeIcon": "Remove",
193
- "panel.social.network": "Network",
194
- "panel.social.url": "URL",
195
- "panel.social.iconUrl": "Icon URL",
196
- "panel.social.altText": "Label (alt text)",
197
- "panel.social.addIcon": "+ Add Icon",
198
- "panel.social.iconSize": "Icon Size",
199
- "panel.social.spacing": "Spacing",
200
- // property panels — html
201
- "panel.html.title": "HTML Properties",
202
- "panel.html.rawHtml": "Raw HTML",
203
- // property panels — row
204
- "panel.row.title": "Row Properties",
205
- "panel.row.columnLayout": "Column Layout",
206
- "panel.row.layout1col": "1 Column",
207
- "panel.row.layout2col": "2 Equal",
208
- "panel.row.layout3col": "3 Equal",
209
- "panel.row.layout4col": "4 Equal",
210
- "panel.row.backgroundImageUrl": "Background Image URL",
211
- "panel.row.fullWidth": "Full Width",
212
- "panel.row.displayCondition": "Display condition",
213
- // controls — color picker
214
- "control.color.label": "Color",
215
- // controls — font picker
216
- "control.fontPicker.label": "Font Family",
217
- // controls — link type picker
218
- "control.linkType.ariaLabel": "Insert a special link",
219
- "control.linkType.placeholder": "+ Special link",
220
- "control.linkType.emailPrompt": "Email address",
221
- "control.linkType.telPrompt": "Phone number",
222
- // controls — spacing input
223
- "control.spacing.top": "Top",
224
- "control.spacing.right": "Right",
225
- "control.spacing.bottom": "Bottom",
226
- "control.spacing.left": "Left",
227
- "control.spacing.topTitle": "Top (px)",
228
- "control.spacing.rightTitle": "Right (px)",
229
- "control.spacing.bottomTitle": "Bottom (px)",
230
- "control.spacing.leftTitle": "Left (px)",
231
- // controls — alignment picker
232
- "control.alignment.left": "Align left",
233
- "control.alignment.center": "Align center",
234
- "control.alignment.right": "Align right",
235
- // controls — merge tag picker
236
- "control.mergeTag.searchPlaceholder": "Search tags...",
237
- "control.mergeTag.noMatches": "No matching tags",
238
- // rich text bubble toolbar
239
- "richtext.bold": "Bold (Cmd+B)",
240
- "richtext.italic": "Italic (Cmd+I)",
241
- "richtext.underline": "Underline (Cmd+U)",
242
- "richtext.strike": "Strike",
243
- "richtext.code": "Code",
244
- "richtext.link": "Link",
245
- "richtext.apply": "Apply",
246
- "richtext.removeLink": "Remove link",
247
- "richtext.urlPlaceholder": "https://…"
248
- }, x = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "ps", "sd", "dv", "yi"]);
249
- let h = "en", b = { en: m };
250
- function L(e, t) {
251
- h = e || "en", b = { en: m, ...t ?? {} };
252
- }
253
- function o(e) {
254
- var t;
255
- return ((t = b[h]) == null ? void 0 : t[e]) ?? m[e] ?? e;
256
- }
257
- function T(e, t) {
258
- if (t) return t;
259
- const n = (e || "en").toLowerCase().split(/[-_]/)[0];
260
- return x.has(n) ? "rtl" : "ltr";
261
- }
262
- var y = Object.defineProperty, w = Object.getOwnPropertyDescriptor, r = (e, t, n, s) => {
263
- for (var i = s > 1 ? void 0 : s ? w(t, n) : t, d = e.length - 1, c; d >= 0; d--)
264
- (c = e[d]) && (i = (s ? c(t, n, i) : c(i)) || i);
265
- return s && i && y(t, n, i), i;
1
+ import { LitElement as m, html as r, css as g } from "lit";
2
+ import { property as f, state as n, customElement as h } from "lit/decorators.js";
3
+ import { t } from "./rich-text-bridge.js";
4
+ var b = Object.defineProperty, v = Object.getOwnPropertyDescriptor, i = (e, a, l, p) => {
5
+ for (var s = p > 1 ? void 0 : p ? v(a, l) : a, d = e.length - 1, c; d >= 0; d--)
6
+ (c = e[d]) && (s = (p ? c(a, l, s) : c(s)) || s);
7
+ return p && s && b(a, l, s), s;
266
8
  };
267
- const k = [
9
+ const u = [
268
10
  { v: "welcome", l: "Welcome" },
269
11
  { v: "newsletter", l: "Newsletter" },
270
12
  { v: "transactional", l: "Transactional" },
@@ -272,21 +14,21 @@ const k = [
272
14
  { v: "announcement", l: "Announcement" },
273
15
  { v: "other", l: "Other" }
274
16
  ];
275
- let a = class extends u {
17
+ let o = class extends m {
276
18
  constructor() {
277
19
  super(...arguments), this.open = !1, this._templates = [], this._name = "", this._description = "", this._category = "other", this._formError = "", this._close = () => {
278
20
  this.open = !1, this._formError = "";
279
21
  }, this._onSubmit = (e) => {
280
22
  e.preventDefault();
281
- const t = this._name.trim();
282
- if (!t) {
283
- this._formError = o("template.error.name-required");
23
+ const a = this._name.trim();
24
+ if (!a) {
25
+ this._formError = t("template.error.name-required");
284
26
  return;
285
27
  }
286
28
  this._formError = "", this.dispatchEvent(
287
29
  new CustomEvent("template-save", {
288
30
  detail: {
289
- name: t,
31
+ name: a,
290
32
  description: this._description.trim() || void 0,
291
33
  category: this._category
292
34
  },
@@ -312,61 +54,61 @@ let a = class extends u {
312
54
  }
313
55
  }
314
56
  render() {
315
- return l`
57
+ return r`
316
58
  <div class="overlay" @click=${this._close}></div>
317
59
  <div class="modal">
318
60
  <div class="header">
319
- <h3>${o("template.heading")}</h3>
320
- <button class="close-btn" title=${o("template.close")} @click=${this._close}>&times;</button>
61
+ <h3>${t("template.heading")}</h3>
62
+ <button class="close-btn" title=${t("template.close")} @click=${this._close}>&times;</button>
321
63
  </div>
322
64
  <div class="body">
323
65
  <div>
324
- <h4 class="section-title">${o("template.section.choose")}</h4>
325
- ${this._templates.length === 0 ? l`<div class="empty">${o("template.empty")}</div>` : l`<div class="grid">${this._templates.map((e) => this._renderCard(e))}</div>`}
66
+ <h4 class="section-title">${t("template.section.choose")}</h4>
67
+ ${this._templates.length === 0 ? r`<div class="empty">${t("template.empty")}</div>` : r`<div class="grid">${this._templates.map((e) => this._renderCard(e))}</div>`}
326
68
  </div>
327
69
 
328
70
  <form class="save-form" @submit=${this._onSubmit}>
329
- <h4 class="section-title">${o("template.section.save")}</h4>
71
+ <h4 class="section-title">${t("template.section.save")}</h4>
330
72
  <div class="save-row">
331
73
  <div class="field">
332
- <label for="template-name">${o("template.field.name")}</label>
74
+ <label for="template-name">${t("template.field.name")}</label>
333
75
  <input
334
76
  id="template-name"
335
77
  name="template-name"
336
78
  type="text"
337
- placeholder=${o("template.field.name-placeholder")}
79
+ placeholder=${t("template.field.name-placeholder")}
338
80
  .value=${this._name}
339
81
  @input=${(e) => this._name = e.target.value}
340
82
  />
341
83
  </div>
342
84
  <div class="field">
343
- <label for="template-category">${o("template.field.category")}</label>
85
+ <label for="template-category">${t("template.field.category")}</label>
344
86
  <select
345
87
  id="template-category"
346
88
  name="template-category"
347
89
  .value=${this._category}
348
90
  @change=${(e) => this._category = e.target.value}
349
91
  >
350
- ${k.map(
351
- (e) => l`<option value=${e.v} ?selected=${this._category === e.v}>${e.l}</option>`
92
+ ${u.map(
93
+ (e) => r`<option value=${e.v} ?selected=${this._category === e.v}>${e.l}</option>`
352
94
  )}
353
95
  </select>
354
96
  </div>
355
97
  </div>
356
98
  <div class="field">
357
- <label for="template-description">${o("template.field.description")}</label>
99
+ <label for="template-description">${t("template.field.description")}</label>
358
100
  <textarea
359
101
  id="template-description"
360
102
  name="template-description"
361
- placeholder=${o("template.field.description-placeholder")}
103
+ placeholder=${t("template.field.description-placeholder")}
362
104
  .value=${this._description}
363
105
  @input=${(e) => this._description = e.target.value}
364
106
  ></textarea>
365
107
  </div>
366
- ${this._formError ? l`<div class="error">${this._formError}</div>` : ""}
108
+ ${this._formError ? r`<div class="error">${this._formError}</div>` : ""}
367
109
  <div class="form-actions">
368
- <button type="button" class="secondary" @click=${this._close}>${o("template.cancel")}</button>
369
- <button type="submit">${o("template.save")}</button>
110
+ <button type="button" class="secondary" @click=${this._close}>${t("template.cancel")}</button>
111
+ <button type="submit">${t("template.save")}</button>
370
112
  </div>
371
113
  </form>
372
114
  </div>
@@ -374,11 +116,11 @@ let a = class extends u {
374
116
  `;
375
117
  }
376
118
  _renderCard(e) {
377
- return l`
119
+ return r`
378
120
  <button class="template-card" @click=${() => this._onPick(e)} title="Load ${e.name}">
379
- ${e.thumbnail ? l`<img class="thumb" src=${e.thumbnail} alt="" />` : l`<div class="thumb-placeholder">${e.category ?? "template"}</div>`}
121
+ ${e.thumbnail ? r`<img class="thumb" src=${e.thumbnail} alt="" />` : r`<div class="thumb-placeholder">${e.category ?? "template"}</div>`}
380
122
  <span class="name">${e.name}</span>
381
- ${e.description ? l`<span class="description">${e.description}</span>` : ""}
123
+ ${e.description ? r`<span class="description">${e.description}</span>` : ""}
382
124
  </button>
383
125
  `;
384
126
  }
@@ -392,7 +134,7 @@ let a = class extends u {
392
134
  );
393
135
  }
394
136
  };
395
- a.styles = v`
137
+ o.styles = g`
396
138
  :host { display: none; }
397
139
  :host([open]) { display: block; position: fixed; inset: 0; z-index: 10000; }
398
140
  .overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
@@ -504,40 +246,30 @@ a.styles = v`
504
246
  .form-actions button.secondary:hover { background: var(--pigeon-surface-hover, #f1f5f9); }
505
247
  .error { color: var(--pigeon-danger, #ef4444); font-size: 12px; }
506
248
  `;
507
- r([
508
- g({ attribute: !1 })
509
- ], a.prototype, "storage", 2);
510
- r([
511
- g({ type: Boolean, reflect: !0 })
512
- ], a.prototype, "open", 2);
513
- r([
514
- p()
515
- ], a.prototype, "_templates", 2);
516
- r([
517
- p()
518
- ], a.prototype, "_name", 2);
519
- r([
520
- p()
521
- ], a.prototype, "_description", 2);
522
- r([
523
- p()
524
- ], a.prototype, "_category", 2);
525
- r([
526
- p()
527
- ], a.prototype, "_formError", 2);
528
- a = r([
529
- f("pigeon-template-picker")
530
- ], a);
531
- const C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
532
- __proto__: null,
533
- get PigeonTemplatePicker() {
534
- return a;
535
- }
536
- }, Symbol.toStringTag, { value: "Module" }));
249
+ i([
250
+ f({ attribute: !1 })
251
+ ], o.prototype, "storage", 2);
252
+ i([
253
+ f({ type: Boolean, reflect: !0 })
254
+ ], o.prototype, "open", 2);
255
+ i([
256
+ n()
257
+ ], o.prototype, "_templates", 2);
258
+ i([
259
+ n()
260
+ ], o.prototype, "_name", 2);
261
+ i([
262
+ n()
263
+ ], o.prototype, "_description", 2);
264
+ i([
265
+ n()
266
+ ], o.prototype, "_category", 2);
267
+ i([
268
+ n()
269
+ ], o.prototype, "_formError", 2);
270
+ o = i([
271
+ h("pigeon-template-picker")
272
+ ], o);
537
273
  export {
538
- a as P,
539
- L as c,
540
- C as p,
541
- T as r,
542
- o as t
274
+ o as PigeonTemplatePicker
543
275
  };