@dotrino/support 0.4.2 → 0.6.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +26 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/support",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "Web Component (custom element) de modal de soporte/donaciones reutilizable por cualquier app del ecosistema Dotrino. Autohosteado, sin JS de terceros ni cookies.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -28,6 +28,8 @@
28
28
  * message Cuerpo del modal (override)
29
29
  * lang 'es' | 'en' | 'auto' (default 'auto')
30
30
  * variant 'solid' (default) | 'ghost' — estilo del disparador
31
+ * x-handle Cuenta de X que se menciona al compartir en X ("vía @handle").
32
+ * Default '@imdotrino'. No cross-network: solo aplica a X.
31
33
  * Métodos: el.open(), el.close()
32
34
  * Eventos: 'cc-support-open', 'cc-support-close' (bubbles, composed)
33
35
  */
@@ -135,11 +137,11 @@ const STYLE = `
135
137
  border: 1px solid transparent;
136
138
  }
137
139
  .trigger.solid {
138
- background: #3498db;
140
+ background: var(--ds-accent, #3498db);
139
141
  color: #fff;
140
142
  box-shadow: 0 2px 10px rgba(52, 152, 219, 0.35);
141
143
  }
142
- .trigger.solid:hover { background: #2980b9; transform: translateY(-1px); }
144
+ .trigger.solid:hover { background: var(--ds-accent-press, #2980b9); transform: translateY(-1px); }
143
145
  .trigger.ghost {
144
146
  background: transparent;
145
147
  color: currentColor;
@@ -216,7 +218,7 @@ const STYLE = `
216
218
  /* Caras con icono (compartir / bug). El transform de rotación va inline
217
219
  porque depende de si hay 2 o 3 caras. */
218
220
  .face.icon {
219
- background: #3498db;
221
+ background: var(--ds-accent, #3498db);
220
222
  display: flex;
221
223
  align-items: center;
222
224
  justify-content: center;
@@ -237,7 +239,7 @@ const STYLE = `
237
239
  top: calc(100% + 8px);
238
240
  right: 0;
239
241
  z-index: 2147483000;
240
- background: #3498db;
242
+ background: var(--ds-accent, #3498db);
241
243
  color: #fff;
242
244
  padding: 0.5rem 0.85rem;
243
245
  border-radius: 10px;
@@ -261,7 +263,7 @@ const STYLE = `
261
263
  right: 13px;
262
264
  border: 6px solid transparent;
263
265
  border-top: 0;
264
- border-bottom-color: #3498db;
266
+ border-bottom-color: var(--ds-accent, #3498db);
265
267
  }
266
268
  @media (max-width: 480px) {
267
269
  .bubble { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
@@ -278,14 +280,14 @@ const STYLE = `
278
280
  max-width: 100vw;
279
281
  max-height: 100vh;
280
282
  overflow: visible;
281
- color: #fff;
283
+ color: var(--ds-modal-text, #fff);
282
284
  }
283
285
  .overlay::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); }
284
286
 
285
287
  .modal {
286
- background: #1f2c3a;
287
- color: #fff;
288
- border: 1px solid rgba(255, 255, 255, 0.12);
288
+ background: var(--ds-modal-bg, #1f2c3a);
289
+ color: var(--ds-modal-text, #fff);
290
+ border: 1px solid var(--ds-modal-border, rgba(255, 255, 255, 0.12));
289
291
  border-radius: 16px;
290
292
  max-width: 420px;
291
293
  width: 100%;
@@ -305,16 +307,16 @@ const STYLE = `
305
307
  height: 2rem;
306
308
  border: none;
307
309
  background: transparent;
308
- color: rgba(255, 255, 255, 0.7);
310
+ color: var(--ds-modal-muted, rgba(255, 255, 255, 0.7));
309
311
  font-size: 1.4rem;
310
312
  line-height: 1;
311
313
  cursor: pointer;
312
314
  border-radius: 50%;
313
315
  transition: all 0.2s ease;
314
316
  }
315
- .close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
317
+ .close:hover { background: var(--ds-modal-hover, rgba(255, 255, 255, 0.1)); color: var(--ds-modal-text, #fff); }
316
318
 
317
- .heading { font-size: 1.4rem; font-weight: 700; margin: 0 0 1.1rem; color: #3498db; }
319
+ .heading { font-size: 1.4rem; font-weight: 700; margin: 0 0 1.1rem; color: var(--ds-accent, #3498db); }
318
320
  .message { font-size: 0.98rem; line-height: 1.6; margin: 0 0 1.5rem; opacity: 0.92; }
319
321
 
320
322
  .links { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
@@ -329,12 +331,12 @@ const STYLE = `
329
331
  font-size: 0.95rem;
330
332
  padding: 0.7rem 1.4rem;
331
333
  border-radius: 50px;
332
- background: #3498db;
334
+ background: var(--ds-accent, #3498db);
333
335
  color: #fff;
334
336
  transition: all 0.25s ease;
335
337
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
336
338
  }
337
- .link:hover { background: #2980b9; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4); }
339
+ .link:hover { background: var(--ds-accent-press, #2980b9); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4); }
338
340
  .link-ico { display: inline-flex; width: 1.4rem; height: 1.4rem; }
339
341
  .link-ico img { width: 100%; height: 100%; display: block; object-fit: contain; }
340
342
 
@@ -342,7 +344,7 @@ const STYLE = `
342
344
  .share {
343
345
  margin-top: 1.5rem;
344
346
  padding-top: 1.25rem;
345
- border-top: 1px solid rgba(255, 255, 255, 0.12);
347
+ border-top: 1px solid var(--ds-modal-border, rgba(255, 255, 255, 0.12));
346
348
  }
347
349
  .share-heading {
348
350
  font-size: 0.95rem;
@@ -388,19 +390,19 @@ const STYLE = `
388
390
  .bug {
389
391
  margin-top: 1.25rem;
390
392
  padding-top: 1.1rem;
391
- border-top: 1px solid rgba(255, 255, 255, 0.12);
393
+ border-top: 1px solid var(--ds-modal-border, rgba(255, 255, 255, 0.12));
392
394
  }
393
395
  .bug-link {
394
396
  display: inline-flex;
395
397
  align-items: center;
396
398
  gap: 0.5rem;
397
- color: rgba(255, 255, 255, 0.7);
399
+ color: var(--ds-modal-muted, rgba(255, 255, 255, 0.7));
398
400
  text-decoration: none;
399
401
  font-size: 0.9rem;
400
402
  font-weight: 600;
401
403
  transition: color 0.2s ease;
402
404
  }
403
- .bug-link:hover { color: #fff; }
405
+ .bug-link:hover { color: var(--ds-modal-text, #fff); }
404
406
  .bug-ico {
405
407
  display: inline-flex;
406
408
  width: 1.15rem;
@@ -412,7 +414,7 @@ const STYLE = `
412
414
  .discord {
413
415
  margin-top: 1.25rem;
414
416
  padding-top: 1.1rem;
415
- border-top: 1px solid rgba(255, 255, 255, 0.12);
417
+ border-top: 1px solid var(--ds-modal-border, rgba(255, 255, 255, 0.12));
416
418
  }
417
419
  .discord-link {
418
420
  display: inline-flex;
@@ -598,9 +600,13 @@ class DotrinoSupport extends HTMLElement {
598
600
  const url = this._shareUrl
599
601
  const u = encodeURIComponent(url)
600
602
  const text = encodeURIComponent(this._shareText)
603
+ // Al compartir en X mencionamos NUESTRA cuenta de esa misma red ("vía @handle"),
604
+ // no cross-network. Override por proyecto con el atributo `x-handle`; default Dotrino.
605
+ const xHandle = (this.getAttribute('x-handle') || '@imdotrino').trim().replace(/^@*/, '@')
606
+ const xText = encodeURIComponent(`${this._shareText} vía ${xHandle}`)
601
607
  return [
602
608
  { key: 'whatsapp', href: `https://wa.me/?text=${text}%20${u}` },
603
- { key: 'x', href: `https://twitter.com/intent/tweet?url=${u}&text=${text}` },
609
+ { key: 'x', href: `https://twitter.com/intent/tweet?url=${u}&text=${xText}` },
604
610
  { key: 'facebook', href: `https://www.facebook.com/sharer/sharer.php?u=${u}` },
605
611
  { key: 'instagram', href: null }, // copia al portapapeles
606
612
  ]