pollcatch 2.2.1 → 2.2.3

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/pc.js +99 -34
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pollcatch",
3
3
  "private": false,
4
- "version": "2.2.1",
4
+ "version": "2.2.3",
5
5
  "type": "module",
6
6
  "main": "pc.js",
7
7
  "module": "pc.js",
package/pc.js CHANGED
@@ -35,7 +35,7 @@ const Ae = (e) => new le(typeof e == "string" ? e : e + "", void 0, Et), F = (e,
35
35
  const r = document.createElement("style"), s = it.litNonce;
36
36
  s !== void 0 && r.setAttribute("nonce", s), r.textContent = o.cssText, e.appendChild(r);
37
37
  }
38
- }, Ut = _t ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
38
+ }, jt = _t ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
39
39
  let o = "";
40
40
  for (const r of t.cssRules) o += r.cssText;
41
41
  return Ae(o);
@@ -45,7 +45,7 @@ const Ae = (e) => new le(typeof e == "string" ? e : e + "", void 0, Et), F = (e,
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
47
  */
48
- const { is: Ee, defineProperty: Pe, getOwnPropertyDescriptor: Oe, getOwnPropertyNames: Te, getOwnPropertySymbols: ze, getPrototypeOf: Ie } = Object, T = globalThis, jt = T.trustedTypes, Ne = jt ? jt.emptyScript : "", bt = T.reactiveElementPolyfillSupport, K = (e, t) => e, at = { toAttribute(e, t) {
48
+ const { is: Ee, defineProperty: Pe, getOwnPropertyDescriptor: Oe, getOwnPropertyNames: Te, getOwnPropertySymbols: ze, getPrototypeOf: Ie } = Object, T = globalThis, Ut = T.trustedTypes, Ne = Ut ? Ut.emptyScript : "", bt = T.reactiveElementPolyfillSupport, K = (e, t) => e, at = { toAttribute(e, t) {
49
49
  switch (t) {
50
50
  case Boolean:
51
51
  e = e ? Ne : null;
@@ -75,7 +75,7 @@ const { is: Ee, defineProperty: Pe, getOwnPropertyDescriptor: Oe, getOwnProperty
75
75
  return o;
76
76
  } }, Pt = (e, t) => !Ee(e, t), Bt = { attribute: !0, type: String, converter: at, reflect: !1, hasChanged: Pt };
77
77
  Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), T.litPropertyMetadata ?? (T.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
78
- let U = class extends HTMLElement {
78
+ let j = class extends HTMLElement {
79
79
  static addInitializer(t) {
80
80
  this._$Ei(), (this.l ?? (this.l = [])).push(t);
81
81
  }
@@ -131,8 +131,8 @@ let U = class extends HTMLElement {
131
131
  const o = [];
132
132
  if (Array.isArray(t)) {
133
133
  const r = new Set(t.flat(1 / 0).reverse());
134
- for (const s of r) o.unshift(Ut(s));
135
- } else t !== void 0 && o.push(Ut(t));
134
+ for (const s of r) o.unshift(jt(s));
135
+ } else t !== void 0 && o.push(jt(t));
136
136
  return o;
137
137
  }
138
138
  static _$Eu(t, o) {
@@ -273,7 +273,7 @@ let U = class extends HTMLElement {
273
273
  firstUpdated(t) {
274
274
  }
275
275
  };
276
- U.elementStyles = [], U.shadowRootOptions = { mode: "open" }, U[K("elementProperties")] = /* @__PURE__ */ new Map(), U[K("finalized")] = /* @__PURE__ */ new Map(), bt == null || bt({ ReactiveElement: U }), (T.reactiveElementVersions ?? (T.reactiveElementVersions = [])).push("2.0.4");
276
+ j.elementStyles = [], j.shadowRootOptions = { mode: "open" }, j[K("elementProperties")] = /* @__PURE__ */ new Map(), j[K("finalized")] = /* @__PURE__ */ new Map(), bt == null || bt({ ReactiveElement: j }), (T.reactiveElementVersions ?? (T.reactiveElementVersions = [])).push("2.0.4");
277
277
  /**
278
278
  * @license
279
279
  * Copyright 2017 Google LLC
@@ -286,7 +286,7 @@ function ue(e, t) {
286
286
  if (!Ot(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
287
287
  return Dt !== void 0 ? Dt.createHTML(t) : t;
288
288
  }
289
- const Ue = (e, t) => {
289
+ const je = (e, t) => {
290
290
  const o = e.length - 1, r = [];
291
291
  let s, i = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", a = Z;
292
292
  for (let n = 0; n < o; n++) {
@@ -303,7 +303,7 @@ let At = class he {
303
303
  let s;
304
304
  this.parts = [];
305
305
  let i = 0, a = 0;
306
- const n = t.length - 1, l = this.parts, [p, c] = Ue(t, o);
306
+ const n = t.length - 1, l = this.parts, [p, c] = je(t, o);
307
307
  if (this.el = he.createElement(p, r), M.currentNode = this.el.content, o === 2 || o === 3) {
308
308
  const u = this.el.content.firstChild;
309
309
  u.replaceWith(...u.childNodes);
@@ -342,7 +342,7 @@ function D(e, t, o = e, r) {
342
342
  const i = Q(t) ? void 0 : t._$litDirective$;
343
343
  return (s == null ? void 0 : s.constructor) !== i && ((n = s == null ? void 0 : s._$AO) == null || n.call(s, !1), i === void 0 ? s = void 0 : (s = new i(e), s._$AT(e, o, r)), r !== void 0 ? (o._$Co ?? (o._$Co = []))[r] = s : o._$Cl = s), s !== void 0 && (t = D(e, s._$AS(e, t.values), s, r)), t;
344
344
  }
345
- let je = class {
345
+ let Ue = class {
346
346
  constructor(t, o) {
347
347
  this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = o;
348
348
  }
@@ -406,7 +406,7 @@ class et {
406
406
  const { values: o, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = At.createElement(ue(r.h, r.h[0]), this.options)), r);
407
407
  if (((i = this._$AH) == null ? void 0 : i._$AD) === s) this._$AH.p(o);
408
408
  else {
409
- const a = new je(s, this), n = a.u(this.options);
409
+ const a = new Ue(s, this), n = a.u(this.options);
410
410
  a.p(o), this.T(n), this._$AH = a;
411
411
  }
412
412
  }
@@ -515,7 +515,7 @@ const He = (e, t, o) => {
515
515
  * Copyright 2017 Google LLC
516
516
  * SPDX-License-Identifier: BSD-3-Clause
517
517
  */
518
- let j = class extends U {
518
+ let U = class extends j {
519
519
  constructor() {
520
520
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
521
521
  }
@@ -541,9 +541,9 @@ let j = class extends U {
541
541
  }
542
542
  };
543
543
  var ne;
544
- j._$litElement$ = !0, j.finalized = !0, (ne = globalThis.litElementHydrateSupport) == null || ne.call(globalThis, { LitElement: j });
544
+ U._$litElement$ = !0, U.finalized = !0, (ne = globalThis.litElementHydrateSupport) == null || ne.call(globalThis, { LitElement: U });
545
545
  const yt = globalThis.litElementPolyfillSupport;
546
- yt == null || yt({ LitElement: j });
546
+ yt == null || yt({ LitElement: U });
547
547
  (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
548
548
  /**
549
549
  * @license
@@ -596,7 +596,53 @@ function Tt(e) {
596
596
  return f({ ...e, state: !0, attribute: !1 });
597
597
  }
598
598
  var x = /* @__PURE__ */ ((e) => (e.reaction = "reaction", e.stars = "stars", e.poll = "poll", e.text = "text", e.nps = "nps", e))(x || {});
599
- const Ze = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M640-160v-280h160v280H640Zm-240%200v-640h160v640H400Zm-240%200v-440h160v440H160Z'/%3e%3c/svg%3e", Ge = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='%23434343'%3e%3cpath%20d='M160-160v-440h160v440H160Zm240%200v-400l160%20160v240H400Zm160-354L400-674v-126h160v286Zm240%20240L640-434v-6h160v166Zm-9%20219L55-791l57-57%20736%20736-57%2057Z'/%3e%3c/svg%3e", Ke = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='24px'%20viewBox='0%20-960%20960%20960'%20width='24px'%20fill='currentColor'%3e%3cpath%20d='M200-200h57l391-391-57-57-391%20391v57Zm-80%2080v-170l528-527q12-11%2026.5-17t30.5-6q16%200%2031%206t26%2018l55%2056q12%2011%2017.5%2026t5.5%2030q0%2016-5.5%2030.5T817-647L290-120H120Zm640-584-56-56%2056%2056Zm-141%2085-28-29%2057%2057-29-28Z'/%3e%3c/svg%3e", We = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20fill='%23666666'%20class='bi%20bi-x'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M4.646%204.646a.5.5%200%200%201%20.708%200L8%207.293l2.646-2.647a.5.5%200%200%201%20.708.708L8.707%208l2.647%202.646a.5.5%200%200%201-.708.708L8%208.707l-2.646%202.647a.5.5%200%200%201-.708-.708L7.293%208%204.646%205.354a.5.5%200%200%201%200-.708'/%3e%3c/svg%3e";
599
+ const Ze = d`
600
+ <svg
601
+ xmlns="http://www.w3.org/2000/svg"
602
+ height="24px"
603
+ viewBox="0 -960 960 960"
604
+ width="24px"
605
+ fill="currentColor"
606
+ >
607
+ <path d="M640-160v-280h160v280H640Zm-240 0v-640h160v640H400Zm-240 0v-440h160v440H160Z" />
608
+ </svg>
609
+ `, Ge = d`
610
+ <svg
611
+ xmlns="http://www.w3.org/2000/svg"
612
+ height="24px"
613
+ viewBox="0 -960 960 960"
614
+ width="24px"
615
+ fill="currentColor"
616
+ >
617
+ <path
618
+ d="M160-160v-440h160v440H160Zm240 0v-400l160 160v240H400Zm160-354L400-674v-126h160v286Zm240 240L640-434v-6h160v166Zm-9 219L55-791l57-57 736 736-57 57Z"
619
+ />
620
+ </svg>
621
+ `, Ke = d`
622
+ <svg
623
+ xmlns="http://www.w3.org/2000/svg"
624
+ height="24px"
625
+ viewBox="0 -960 960 960"
626
+ width="24px"
627
+ fill="currentColor"
628
+ >
629
+ <path
630
+ d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"
631
+ />
632
+ </svg>
633
+ `, We = d`
634
+ <svg
635
+ xmlns="http://www.w3.org/2000/svg"
636
+ width="16"
637
+ height="16"
638
+ fill="currentColor"
639
+ viewBox="0 0 16 16"
640
+ >
641
+ <path
642
+ d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"
643
+ />
644
+ </svg>
645
+ `;
600
646
  var Je = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, A = function(e) {
601
647
  return typeof e == "string" ? e.length > 0 : typeof e == "number";
602
648
  }, $ = function(e, t, o) {
@@ -1584,7 +1630,7 @@ const st = {
1584
1630
  mobile: "480px",
1585
1631
  tablet: "768px",
1586
1632
  desktop: "1024px"
1587
- }, Rt = class Rt extends j {
1633
+ }, Rt = class Rt extends U {
1588
1634
  constructor() {
1589
1635
  super(...arguments), this.dataController = new _o(this), this.displayController = new Eo(this, this.dataController), this.hasEditButton = !0, this.showStats = "never", this.showChart = !1, this.initialized = !1, this.lockAnswer = !1, this.ariaLabel = null, this.minContrast = ge.AA_NORMAL, this.options = [], this.project = "public", this.questionPosition = "top", this.statsText = "{count} votes", this.buttonText = "Submit", this.buttonRadius = "sm", this.multiple = !1, this.readOnly = !1, this.handleEditToggleKeyDown = (t) => {
1590
1636
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.handleEnterEditMode());
@@ -1721,16 +1767,16 @@ const st = {
1721
1767
  */
1722
1768
  renderEditToggleIcon(t = "edit-toggle-button") {
1723
1769
  return this.displayController.shouldShowEditButton() ? d`
1724
- <img
1725
- src="${Ke}"
1726
- alt="Edit vote"
1770
+ <span
1727
1771
  class="edit-toggle-icon"
1728
1772
  data-testid="${t}"
1729
1773
  @click="${this.handleEnterEditMode}"
1730
1774
  role="button"
1731
1775
  tabindex="0"
1776
+ aria-label="Edit vote"
1732
1777
  @keydown="${this.handleEditToggleKeyDown}"
1733
- />
1778
+ >${Ke}</span
1779
+ >
1734
1780
  ` : h;
1735
1781
  }
1736
1782
  renderStatsText() {
@@ -1740,16 +1786,16 @@ const st = {
1740
1786
  }
1741
1787
  renderChartToggle() {
1742
1788
  return this.displayController.shouldShowChartToggle() ? d`
1743
- <img
1744
- src="${this.displayController.isChartVisible ? Ge : Ze}"
1745
- alt="${this.displayController.isChartVisible ? "Hide chart" : "Show chart"}"
1789
+ <span
1746
1790
  class="chart-toggle-icon"
1747
1791
  data-testid="chart-toggle-button"
1748
1792
  @click="${() => this.displayController.toggleChartVisibility()}"
1749
1793
  role="button"
1750
1794
  tabindex="0"
1795
+ aria-label="${this.displayController.isChartVisible ? "Hide chart" : "Show chart"}"
1751
1796
  @keydown="${() => this.displayController.toggleChartVisibility()}"
1752
- />
1797
+ >${this.displayController.isChartVisible ? Ge : Ze}</span
1798
+ >
1753
1799
  ` : h;
1754
1800
  }
1755
1801
  renderStatus() {
@@ -1781,14 +1827,14 @@ const st = {
1781
1827
  <div class="pc-thank-you" data-testid="thank-you">
1782
1828
  <div class="pc-thank-you-msg" data-testid="thank-you-msg">
1783
1829
  ${t}
1784
- <img
1785
- src="${We}"
1786
- alt="Close"
1830
+ <span
1787
1831
  class="thank-you-close-icon"
1788
1832
  data-testid="close-thank-you-button"
1789
1833
  @click="${() => this.displayController.toggleThankYouVisibility(!1)}"
1790
1834
  role="button"
1791
- />
1835
+ aria-label="Close"
1836
+ >${We}</span
1837
+ >
1792
1838
  </div>
1793
1839
  </div>
1794
1840
  </div>
@@ -2369,6 +2415,9 @@ const zo = F`
2369
2415
  /* Inline chart toggle icon - shared between components */
2370
2416
  .chart-toggle-icon,
2371
2417
  .edit-toggle-icon {
2418
+ display: inline-flex;
2419
+ align-items: center;
2420
+ justify-content: center;
2372
2421
  margin-left: 0.2em;
2373
2422
  width: 1.2em;
2374
2423
  height: 1.2em;
@@ -2376,6 +2425,13 @@ const zo = F`
2376
2425
  cursor: pointer;
2377
2426
  transition: opacity 0.2s ease;
2378
2427
  vertical-align: middle;
2428
+ color: var(--pc-text-color, var(--default-text-color));
2429
+ }
2430
+
2431
+ .chart-toggle-icon svg,
2432
+ .edit-toggle-icon svg {
2433
+ width: 100%;
2434
+ height: 100%;
2379
2435
  }
2380
2436
 
2381
2437
  .chart-toggle-icon:hover,
@@ -2535,7 +2591,7 @@ const zo = F`
2535
2591
  .pc-thank-you-msg {
2536
2592
  font-size: 0.8em;
2537
2593
  color: var(--pc-text-color, var(--default-text-color));
2538
- background: var(--pc-option-bg-color, var(--default-option-bg-color));
2594
+ background-color: light-dark(rgba(255, 255, 255, 0.8), rgba(0, 0, 0, 0.8));
2539
2595
  padding: 1em 1.8em 1em 1em;
2540
2596
  border-radius: var(--pc-border-radius, var(--default-border-radius));
2541
2597
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
@@ -2567,7 +2623,6 @@ const zo = F`
2567
2623
  left: 0;
2568
2624
  right: 0;
2569
2625
  bottom: 0;
2570
- background-color: rgba(255, 255, 255, 0.2);
2571
2626
  backdrop-filter: blur(2px);
2572
2627
  display: flex;
2573
2628
  align-items: center;
@@ -2577,6 +2632,9 @@ const zo = F`
2577
2632
  }
2578
2633
 
2579
2634
  .thank-you-close-icon {
2635
+ display: inline-flex;
2636
+ align-items: center;
2637
+ justify-content: center;
2580
2638
  width: 1.2em;
2581
2639
  height: 1.2em;
2582
2640
  cursor: pointer;
@@ -2584,6 +2642,13 @@ const zo = F`
2584
2642
  position: absolute;
2585
2643
  top: 0.2em;
2586
2644
  right: 0.2em;
2645
+ color: var(--pc-text-color, var(--default-text-color));
2646
+ opacity: 0.6;
2647
+ }
2648
+
2649
+ .thank-you-close-icon svg {
2650
+ width: 100%;
2651
+ height: 100%;
2587
2652
  }
2588
2653
 
2589
2654
  .thank-you-close-icon:hover {
@@ -3331,7 +3396,7 @@ Mt([
3331
3396
  tt = Mt([
3332
3397
  ot("pc-poll")
3333
3398
  ], tt);
3334
- const Uo = F`
3399
+ const jo = F`
3335
3400
  /* CSS variables inherit from parent - defaults are specified at usage sites */
3336
3401
 
3337
3402
  .pc-section {
@@ -3424,7 +3489,7 @@ const Uo = F`
3424
3489
  * Copyright 2018 Google LLC
3425
3490
  * SPDX-License-Identifier: BSD-3-Clause
3426
3491
  */
3427
- const ke = "important", jo = " !" + ke, Bo = Se(class extends Ce {
3492
+ const ke = "important", Uo = " !" + ke, Bo = Se(class extends Ce {
3428
3493
  constructor(e) {
3429
3494
  var t;
3430
3495
  if (super(e), e.type !== xe.ATTRIBUTE || e.name !== "style" || ((t = e.strings) == null ? void 0 : t.length) > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
@@ -3443,7 +3508,7 @@ const ke = "important", jo = " !" + ke, Bo = Se(class extends Ce {
3443
3508
  const s = t[r];
3444
3509
  if (s != null) {
3445
3510
  this.ft.add(r);
3446
- const i = typeof s == "string" && s.endsWith(jo);
3511
+ const i = typeof s == "string" && s.endsWith(Uo);
3447
3512
  r.includes("-") || i ? o.setProperty(r, i ? s.slice(0, -11) : s, i ? ke : "") : o[r] = s;
3448
3513
  }
3449
3514
  }
@@ -3715,7 +3780,7 @@ let V = class extends m {
3715
3780
  `;
3716
3781
  }
3717
3782
  };
3718
- V.styles = [...m.styles, ut, Uo];
3783
+ V.styles = [...m.styles, ut, jo];
3719
3784
  ht([
3720
3785
  f({ type: String })
3721
3786
  ], V.prototype, "icon", 2);
@@ -4163,7 +4228,7 @@ var Go = Object.defineProperty, Ko = Object.getOwnPropertyDescriptor, mt = (e, t
4163
4228
  (a = e[i]) && (s = (r ? a(t, o, s) : a(s)) || s);
4164
4229
  return r && s && Go(t, o, s), s;
4165
4230
  };
4166
- let H = class extends j {
4231
+ let H = class extends U {
4167
4232
  constructor() {
4168
4233
  super(), this.options = "", this.parsedOptions = [], H.injectGlobalStyle();
4169
4234
  }