@ucd-lib/theme-elements 3.1.3 → 3.2.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.
@@ -18,36 +18,36 @@ export function styles() {
18
18
  }
19
19
  `;
20
20
  return [
21
- listCss,
21
+ listCss,
22
22
  customStyles
23
23
  ]
24
24
  }
25
25
 
26
- export function render() {
26
+ export function render() {
27
27
  return html`
28
28
  <ul class="list--${this.listStyle}">
29
29
  ${this._listItems.map((item, index) => html`
30
30
  ${this._isTitle(index) ? html`
31
- <li
31
+ <li
32
32
  id="accordion-${index}"
33
33
  class="item-title ${this.itemIsExpanded(index, false) ? 'active' : ''}"
34
- item-index="${index}"
34
+ item-index="${index}"
35
35
  tabindex="0"
36
36
  @click=${this._onTitleClick}
37
37
  @keyup=${this._onTitleKeyUp}
38
- aria-controls="accordion-${index}-panel"
38
+ aria-controls="accordion-${index + 1}-panel"
39
39
  aria-expanded="${this.itemIsExpanded(index, false)}">
40
40
  <slot name="${item.slotName}"></slot>
41
41
  </li>
42
42
  ` : html`
43
- <li
44
- id="accordion-${index}-panel"
43
+ <li
44
+ id="accordion-${index}-panel"
45
45
  class="item-content"
46
- aria-labelledby="accordion-${index}"
46
+ aria-labelledby="accordion-${index - 1}"
47
47
  ?hidden="${!this.itemIsExpanded(index, false)}">
48
48
  <slot name="${item.slotName}"></slot>
49
49
  </li>
50
50
  `}
51
51
  `) }
52
52
  </ul>
53
- `;}
53
+ `;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "3.1.3",
3
+ "version": "3.2.0",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "dompurify": "^2.3.9",
15
15
  "ip-cidr": "^3.0.4",
16
16
  "lit": "^3.0.2",
17
- "marked": "^4.0.18",
17
+ "marked": "^16.1.0",
18
18
  "photoswipe": "^4.1.3",
19
19
  "slim-select": "^1.26.2"
20
20
  }
@@ -64,13 +64,15 @@ export default class UcdlibMd extends LitElement {
64
64
  * @method updated
65
65
  * @description Lit method called when element is updated.
66
66
  */
67
- updated() {
67
+ updated(changedProperties) {
68
68
  // config markdown renderer so elements are correctly styled
69
69
  this._setRendererOverrides();
70
70
 
71
- // update markdown data with the latest, either when the content changes or data property is updated
72
- this.data = DOMPurify.sanitize(marked.parse(this.data));
73
- this.renderedElement.innerHTML = this.data;
71
+ // only process markdown if the data property actually changed
72
+ if (changedProperties.has('data')) {
73
+ const parsedData = DOMPurify.sanitize(marked.parse(this.data));
74
+ this.renderedElement.innerHTML = parsedData;
75
+ }
74
76
  }
75
77
 
76
78
  /**