@lit-pigeon/editor 0.3.2 → 0.3.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.
@@ -1,7 +1,7 @@
1
1
  import { LitElement as b, html as a, css as g } from "lit";
2
2
  import { property as h, customElement as u } from "lit/decorators.js";
3
3
  import { generateId as p } from "@lit-pigeon/core";
4
- import { t as i } from "./templates.js";
4
+ import { t as i } from "./rich-text-bridge.js";
5
5
  var m = Object.defineProperty, f = Object.getOwnPropertyDescriptor, c = (e, t, o, n) => {
6
6
  for (var r = n > 1 ? void 0 : n ? f(t, o) : t, s = e.length - 1, d; s >= 0; s--)
7
7
  (d = e[s]) && (r = (n ? d(t, o, r) : d(r)) || r);
@@ -1,7 +1,7 @@
1
1
  import { LitElement as c, html as l, css as f } from "lit";
2
2
  import { property as b, state as g, customElement as u } from "lit/decorators.js";
3
3
  import { writeDragTransfer as m } from "./index.js";
4
- import { t as d } from "./templates.js";
4
+ import { t as d } from "./rich-text-bridge.js";
5
5
  var v = Object.defineProperty, h = Object.getOwnPropertyDescriptor, p = (e, t, n, o) => {
6
6
  for (var r = o > 1 ? void 0 : o ? h(t, n) : t, i = e.length - 1, s; i >= 0; i--)
7
7
  (s = e[i]) && (r = (o ? s(t, n, r) : s(r)) || r);
@@ -1,6 +1,6 @@
1
1
  import { LitElement as b, nothing as v, html as d, css as y } from "lit";
2
2
  import { property as x, state as u, customElement as k } from "lit/decorators.js";
3
- import { t as c } from "./templates.js";
3
+ import { t as c } from "./rich-text-bridge.js";
4
4
  const m = 24;
5
5
  class g extends Error {
6
6
  constructor(r) {
@@ -1,15 +1,276 @@
1
- let t = null;
2
- function r() {
3
- return t || (t = import("./rich-text.js").then((s) => s.default)), t;
1
+ import { css as u, LitElement as b, html as s } from "lit";
2
+ import { property as v, customElement as f } from "lit/decorators.js";
3
+ const d = {
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
+ }, y = /* @__PURE__ */ new Set(["ar", "he", "fa", "ur", "ps", "sd", "dv", "yi"]);
249
+ let m = "en", h = { en: d };
250
+ function P(t, e) {
251
+ m = t || "en", h = { en: d, ...e ?? {} };
4
252
  }
5
- class l {
253
+ function r(t) {
254
+ var e;
255
+ return ((e = h[m]) == null ? void 0 : e[t]) ?? d[t] ?? t;
256
+ }
257
+ function C(t, e) {
258
+ if (e) return e;
259
+ const a = (t || "en").toLowerCase().split(/[-_]/)[0];
260
+ return y.has(a) ? "rtl" : "ltr";
261
+ }
262
+ let c = null;
263
+ function S() {
264
+ return c || (c = import("./rich-text.js").then((t) => t.default)), c;
265
+ }
266
+ class k {
6
267
  constructor() {
7
268
  this._active = null, this._listeners = /* @__PURE__ */ new Set(), this._held = !1;
8
269
  }
9
270
  setActive(e) {
10
271
  if (this._active !== e) {
11
272
  this._active = e;
12
- for (const i of this._listeners) i(e);
273
+ for (const a of this._listeners) a(e);
13
274
  }
14
275
  }
15
276
  /** Clear only if `editor` is the currently-active one (avoids races on rapid focus changes). */
@@ -40,8 +301,67 @@ class l {
40
301
  return this._listeners.add(e), () => this._listeners.delete(e);
41
302
  }
42
303
  }
43
- const h = new l();
304
+ const A = new k();
305
+ var w = Object.defineProperty, x = Object.getOwnPropertyDescriptor, g = (t, e, a, o) => {
306
+ for (var l = o > 1 ? void 0 : o ? x(e, a) : e, n = t.length - 1, p; n >= 0; n--)
307
+ (p = t[n]) && (l = (o ? p(e, a, l) : p(l)) || l);
308
+ return o && l && w(e, a, l), l;
309
+ };
310
+ let i = class extends b {
311
+ constructor() {
312
+ super(...arguments), this.linkTypes = [];
313
+ }
314
+ render() {
315
+ return this.linkTypes.length === 0 ? s`` : s`
316
+ <select aria-label=${r("control.linkType.ariaLabel")} @change=${this._onChange}>
317
+ <option value="">${r("control.linkType.placeholder")}</option>
318
+ ${this.linkTypes.map((t) => s`<option value=${t.id}>${t.label}</option>`)}
319
+ </select>
320
+ `;
321
+ }
322
+ _onChange(t) {
323
+ const e = t.target, a = e.value;
324
+ if (e.value = "", !a) return;
325
+ const o = this.linkTypes.find((n) => n.id === a);
326
+ if (!o) return;
327
+ let l;
328
+ if (o.prompt) {
329
+ const n = window.prompt(o.prompt === "email" ? r("control.linkType.emailPrompt") : r("control.linkType.telPrompt"));
330
+ if (!n || !n.trim()) return;
331
+ l = (o.prompt === "email" ? "mailto:" : "tel:") + n.trim();
332
+ } else o.href && (l = o.href);
333
+ l && this.dispatchEvent(new CustomEvent("link-type-select", {
334
+ detail: { href: l },
335
+ bubbles: !0,
336
+ composed: !0
337
+ }));
338
+ }
339
+ };
340
+ i.styles = u`
341
+ :host { display: inline-block; }
342
+ select {
343
+ height: 32px;
344
+ border: 1px solid var(--pigeon-input, #cbd5e1);
345
+ border-radius: var(--pigeon-radius-sm, 4px);
346
+ padding: 0 6px;
347
+ font-family: var(--pigeon-font);
348
+ font-size: 12px;
349
+ color: var(--pigeon-text-secondary, #64748b);
350
+ background: var(--pigeon-bg, #ffffff);
351
+ cursor: pointer;
352
+ max-width: 160px;
353
+ }
354
+ `;
355
+ g([
356
+ v({ attribute: !1 })
357
+ ], i.prototype, "linkTypes", 2);
358
+ i = g([
359
+ f("pigeon-link-type-picker")
360
+ ], i);
44
361
  export {
45
- r as l,
46
- h as r
362
+ C as a,
363
+ P as c,
364
+ S as l,
365
+ A as r,
366
+ r as t
47
367
  };