@ucd-lib/theme-elements 3.1.4 → 3.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucd-lib/theme-elements",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.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": "^
|
|
17
|
+
"marked": "^16.1.0",
|
|
18
18
|
"photoswipe": "^4.1.3",
|
|
19
19
|
"slim-select": "^1.26.2"
|
|
20
20
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import "@ucd-lib/theme-elements/ucdlib/ucdlib-iconset/ucdlib-iconset";
|
|
2
|
-
import "@ucd-lib/theme-elements/ucdlib/ucdlib-icon/ucdlib-icon";
|
|
3
|
-
|
|
4
1
|
import { html, render } from "lit-html";
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
4
|
* @description Creates iconset and moves to document head
|
|
8
5
|
* @param {TemplateResult} icons - SVG html string of icons
|
|
9
|
-
* @param {String} name - name of iconset.
|
|
6
|
+
* @param {String} name - name of iconset.
|
|
10
7
|
* @param {Number} size - size of icons
|
|
11
|
-
* @param {String} label - Friendly name of iconset
|
|
8
|
+
* @param {String} label - Friendly name of iconset
|
|
12
9
|
*/
|
|
13
10
|
function renderIconSet(icons, name, size=24, label=""){
|
|
14
11
|
const containerId = `ucdlib-icons--${name}`;
|
|
@@ -17,8 +14,8 @@ function renderIconSet(icons, name, size=24, label=""){
|
|
|
17
14
|
container = document.createElement("div");
|
|
18
15
|
container.style.display = "none";
|
|
19
16
|
container.id = containerId;
|
|
20
|
-
document.head.appendChild(container);
|
|
21
|
-
}
|
|
17
|
+
document.head.appendChild(container);
|
|
18
|
+
}
|
|
22
19
|
const template = html`
|
|
23
20
|
<ucdlib-iconset name=${name} size=${size} label=${label}>
|
|
24
21
|
${icons}
|
|
@@ -27,4 +24,4 @@ function renderIconSet(icons, name, size=24, label=""){
|
|
|
27
24
|
render(template, container);
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
export { renderIconSet };
|
|
27
|
+
export { renderIconSet };
|
|
@@ -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
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
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
|
/**
|