@ucd-lib/theme-elements 0.0.16 → 0.0.17

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/.eslintrc.json CHANGED
@@ -1,3 +1,7 @@
1
1
  {
2
- "ignorePatterns" : ["*.tpl.js"]
2
+ "ignorePatterns" : ["*.tpl.js"],
3
+ "globals": {
4
+ "UCD_LIB_THEME_LOADER" : "readonly",
5
+ "WebComponents" : "readonly"
6
+ }
3
7
  }
@@ -149,7 +149,6 @@ export default class UcdThemeSubnav extends Mixin(LitElement)
149
149
  * @description Fires an 'item-click' event
150
150
  * @param {Object} item - The link item
151
151
  * @param {Array} location - The link location in links array
152
- * @returns
153
152
  */
154
153
  _dispatchItemClick(item, location){
155
154
  if (item.href) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,9 +9,12 @@
9
9
  "author": "jrmerz@ucdavis.edu",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
+ "@lit-labs/task": "^1.0.0",
12
13
  "@ucd-lib/theme-sass": "^5.0.15",
14
+ "dompurify": "^2.3.6",
13
15
  "ip-cidr": "^3.0.4",
14
16
  "lit": "^2.0.2",
17
+ "marked": "^4.0.14",
15
18
  "photoswipe": "^4.1.3",
16
19
  "slim-select": "^1.26.2"
17
20
  }
@@ -0,0 +1,31 @@
1
+ import { LitElement } from 'lit';
2
+ import { MutationObserverController } from '../../utils/controllers';
3
+
4
+ /**
5
+ * @class UcdlibMdContent
6
+ * @classdesc Component class for declaritively wrapping markdown and translating into sanitized html
7
+ */
8
+ export default class UcdlibMdContent extends LitElement {
9
+
10
+ static get properties() {
11
+ return {};
12
+ }
13
+
14
+ mutationObserver = new MutationObserverController(this, { characterData: true, attributes: false, childList: true, subtree: true });
15
+
16
+ constructor() {
17
+ super();
18
+ }
19
+
20
+ createRenderRoot() {
21
+ this.style.display = 'none';
22
+ return this;
23
+ }
24
+
25
+ _onChildListMutation() {
26
+ // send event to ucdlib-md
27
+ this.dispatchEvent(new CustomEvent('content-updated', { bubbles: true }));
28
+ }
29
+ }
30
+
31
+ customElements.define('ucdlib-md-content', UcdlibMdContent);
@@ -0,0 +1,120 @@
1
+ import { LitElement, css } from 'lit';
2
+ import { marked } from 'marked';
3
+ import DOMPurify from 'dompurify';
4
+ import { UcdlibMdContent } from './ucdlib-md-content.js';
5
+ import { MutationObserverController } from '../../utils/controllers/mutation-observer.js';
6
+
7
+ /**
8
+ * @class UcdlibMd
9
+ * @classdesc Component class for translating/displaying markdown into sanitized html
10
+ * @property {String} data - text to hold markdown code
11
+ * @property {Object} renderer - an object holding element functions to override the default markdown behavior
12
+ * Format: reference the Marked Renderer documentation at https://marked.js.org/using_pro#renderer
13
+ * @property {Object} use - marked use object
14
+ * @property {Object} options - marked options object
15
+ */
16
+ export default class UcdlibMd extends LitElement {
17
+
18
+ static get properties() {
19
+ return {
20
+ // ignore: {type: String},
21
+ // exclude: {type: String},
22
+ // subset: {type: String},
23
+ data: {type: String},
24
+ renderer: {type: Object},
25
+ use: {type: Object},
26
+ options: {type: Object}
27
+ };
28
+ }
29
+
30
+ mutationObserver = new MutationObserverController(this, { characterData: true, attributes: false, childList: true, subtree: true });
31
+
32
+ constructor() {
33
+ super();
34
+ this.data = '';
35
+ this.renderer = null;
36
+
37
+ this.renderedElement = document.createElement('div');
38
+ this.renderedElement.setAttribute('rendered', '');
39
+ }
40
+
41
+ createRenderRoot() {
42
+ this.appendChild(this.renderedElement);
43
+ return this;
44
+ }
45
+
46
+ _onChildListMutation() {
47
+ if( this.contentElement ) return;
48
+
49
+ // query children for ucdlib-md-content
50
+ // wire up listener if it exists
51
+ this.contentElement = this.querySelector('ucdlib-md-content');
52
+ if( this.contentElement ) {
53
+ this.contentElement.addEventListener('content-updated', this._updateFromContentElementMd.bind(this));
54
+ }
55
+ }
56
+
57
+ disconnectedCallback() {
58
+ if( this.contentElement ) {
59
+ this.contentElement.removeEventListener('content-updated', this._updateFromContentElementMd.bind(this));
60
+ }
61
+ }
62
+
63
+ /**
64
+ * @method updated
65
+ * @description Lit method called when element is updated.
66
+ */
67
+ updated() {
68
+ // config markdown renderer so elements are correctly styled
69
+ this._setRendererOverrides();
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;
74
+ }
75
+
76
+ /**
77
+ * @method _updateFromContentElementMd
78
+ * @description Updates the local data property with the text from the ucdlib-md-content element (if it exists)
79
+ * @private
80
+ */
81
+ _updateFromContentElementMd() {
82
+ // remove whitespace between lines
83
+ this.data = this.contentElement.innerText.split('\n').map(line => line.trim()).join('\n');
84
+ }
85
+
86
+ /**
87
+ * @method _setRendererOverrides
88
+ * @description Updates the marked package renderer overrides to customize how element types are rendered
89
+ * @private
90
+ */
91
+ _setRendererOverrides() {
92
+ if (!this.renderer) {
93
+ this.renderer = {
94
+ list(body, ordered, start) {
95
+ let renderedContent = '';
96
+ if (ordered) {
97
+ renderedContent = `<ul class="list--multilevel">${body}</ul>`;
98
+ } else {
99
+ renderedContent = `<ul class="list--bordered">${body}</ul>`;
100
+ }
101
+ return renderedContent;
102
+ }
103
+ };
104
+ }
105
+
106
+ if (!this.options) {
107
+ this.options = { breaks: true, gfm: true };
108
+ }
109
+
110
+ if (!this.use) {
111
+ this.use = { renderer: this.renderer };
112
+ }
113
+
114
+ marked.use(this.use);
115
+ marked.setOptions(this.options);
116
+ }
117
+
118
+ }
119
+
120
+ customElements.define('ucdlib-md', UcdlibMd);
@@ -0,0 +1,22 @@
1
+ # SILS Permalink
2
+
3
+ Allows users to easily add links to SILS permalinks in webpages.
4
+
5
+ ## Inline Version
6
+
7
+ By default add simple links to the pages. If you identified a tag inline like
8
+ `<ucdlib-sils-permalink
9
+ href="https://search.library.ucdavis.edu/permalink/01UCD_INST/1uov27j/alma9981249369903126"/>`,
10
+ then the link would format as something like
11
+
12
+ * [Engineering victory : the Union siege of
13
+ Vicksburg](https://search.library.ucdavis.edu/permalink/01UCD_INST/1uov27j/alma9981249369903126)
14
+
15
+ For more citation information, we'd could add
16
+
17
+ * `<ucdlib-sils-permalink href=".." cite="full" />` => [Solonick, Justin
18
+ S. Engineering Victory : the Union Siege of Vicksburg . Carbondale: Southern
19
+ Illinois University
20
+ Press, 2015. Print.](https://search.library.ucdavis.edu/permalink/01UCD_INST/1uov27j/alma9981249369903126)
21
+
22
+ ## Expanded Version
@@ -0,0 +1,36 @@
1
+ import {Task} from '@lit-labs/task';
2
+
3
+ export class PermalinkController {
4
+ // host;
5
+ // value;
6
+ // kinds = Names.kinds;
7
+ // task;
8
+ constructor(host, url) {
9
+ const baseUrl = url;
10
+ this.url = baseUrl;
11
+ this.host = host;
12
+ this.task = new Task(
13
+ this.host,
14
+ async () => {
15
+ const response = await fetch(`${baseUrl}`);
16
+ const result = await response.json();
17
+ const error = result.error;
18
+ if (error !== undefined) {
19
+ throw new Error(error);
20
+ }
21
+ return result;
22
+ },
23
+
24
+ () => [this.url]
25
+ );
26
+
27
+ }
28
+
29
+
30
+ render(renderFunctions) {
31
+ return this.task.render(renderFunctions);
32
+ }
33
+
34
+
35
+
36
+ }
@@ -0,0 +1,322 @@
1
+ import { LitElement} from 'lit';
2
+ import {render, styles} from "./ucdlib-sils-permalink.tpl.js";
3
+ import {PermalinkController} from './ucdlib-sils-permalink-controller.js';
4
+
5
+ /**
6
+ * @class UcdlibSilsPermalink
7
+ * @description This component allows you to easily add individual objects from
8
+ * the UC SILS catalog into your webpage.
9
+ * @property {String} href - Pointer to the permalink
10
+ * @property {String} cite - Specify the citation style
11
+ *
12
+ * <ucdlib-sils-permalink href="https://search.library.ucdavis.edu/permalink/01UCD_INST/1uov27j/alma9981249369903126"/>
13
+ */
14
+
15
+ export default class UcdlibSilsPermalink extends LitElement {
16
+ static get properties() {
17
+ return {
18
+ results : {type: Object, attribute:false},
19
+ permalink : {type: String},
20
+ image : {type: String},
21
+ title : {type: String},
22
+ authorFull : {type: String},
23
+ authorLast : {type: String, attribute:false},
24
+ authorFirst: {type: String, attribute:false},
25
+ authorID: {type: Array, attribute:false},
26
+ year : { type: String},
27
+ summary : {type: String},
28
+ tags : {type: Array},
29
+ host_url : {type: String},
30
+ teaserType : {type: String, attribute:false},
31
+ publisher : {type: String, attribute:false},
32
+ placePublication : {type: String, attribute:false},
33
+ notes : {type: Array, attribute:false},
34
+ language: {type: String, attribute:false},
35
+ randomClass: {type: String, attribute:false},
36
+ elemClass: {type: Array, attribute:false},
37
+ url: {type: String, attribute:false},
38
+ form: {type: Boolean, attribute:false},
39
+ isCustom: {type:Boolean},
40
+ index: {type:Number},
41
+ newPermalink: {type: Array, hasChanged(newVal, oldVal) {
42
+ return newVal !== oldVal;
43
+ }, attribute:false},
44
+
45
+ };
46
+ }
47
+
48
+ static get styles() {
49
+ return styles();
50
+ }
51
+
52
+ constructor() {
53
+ super();
54
+ this.PENDING = false;
55
+ this.LOADING = false;
56
+ this.COMPLETE = false;
57
+ this.ERROR = false;
58
+ this.results = {};
59
+ this.loading = false;
60
+ this.resultsPerPage = 9999;
61
+ this.page = 1;
62
+ this.permalink = '';
63
+ this.authorLast = '';
64
+ this.authorFirst = '';
65
+ this.authorFull = '';
66
+ this.title = '';
67
+ this.year = '';
68
+ this.summary= '';
69
+ this.host_url= '';
70
+ this.tags = [];
71
+ this.authorID = [];
72
+ this.teaserType = '';
73
+ this.publisher = '';
74
+ this.placePublication = '';
75
+ this.notes = [];
76
+ this.language = '';
77
+ this.randomClass = '';
78
+ this.elemClass = ['tahoe', 'california', 'quad'];
79
+ this.image = '';
80
+ this.url = '';
81
+ this.isCustom = false;
82
+ this.newPermalink = [];
83
+ this.form = false;
84
+ this.index = 0;
85
+ this.tagEntryField = [{url: '', label: '', default: true}];
86
+ this.authorEntryField = [{value: '', default: true}];
87
+ this.errorMessage = 'Href is not a permalink.';
88
+ this.render=render.bind(this);
89
+
90
+ }
91
+
92
+ /**
93
+ * @method firstUpdated
94
+ *
95
+ * @description updated when the page first renders
96
+ *
97
+ * @param {Object} changedProperties
98
+ *
99
+ */
100
+ firstUpdated(changedProperties){
101
+ if(this.permalink != ''){
102
+ this.perma = new PermalinkController(this, this._requestUrl());
103
+ this.requestUpdate();
104
+ }
105
+ }
106
+
107
+
108
+
109
+
110
+
111
+ validationLink(url){
112
+ // let match = url.match(/([^\/]+)([a-z0-9]+)$/g);
113
+
114
+ // let id = url.includes("/9fle3i/") ? 'L' : url.includes("/1hjlc2p/") ? 'PC' : 'Error';
115
+ // if(url.match(/https:\/\/search.library.ucdavis.edu\/permalink\/01UCD_INST\/([^\/]+)\/([a-zA-Z0-9_]*)/g)){
116
+ // url = 'https://search.library.ucdavis.edu/primaws/rest/pub/pnxs/' + id + '/' + match[0] +'?vid=01UCD_INST:UCD&lang=en&search_scope=DN_and_CI';
117
+ // return url;
118
+ // }
119
+ let id;
120
+ if(url != "") id = url.split("/alma")[1];
121
+
122
+ url = "https://open-na.hosted.exlibrisgroup.com/alma/01UCD_INST/bibs/" + id;
123
+
124
+
125
+ return url;
126
+ }
127
+
128
+ _onPending(){
129
+ this.PENDING = true;
130
+ }
131
+
132
+
133
+ _onError(e){
134
+ this.ERROR = true;
135
+ console.log("Error:", e);
136
+ }
137
+
138
+ handleEdit() {
139
+ this.form = true;
140
+
141
+ this.requestUpdate();
142
+
143
+ }
144
+ handleDelete(){
145
+ let tempDelete = JSON.parse(sessionStorage.getItem("newPermalink"));
146
+
147
+ delete tempDelete[this.index];
148
+ tempDelete = Object.fromEntries(Object.entries(tempDelete).filter(([_, v]) => v != null));
149
+
150
+ this.requestUpdate;
151
+ sessionStorage.setItem("newPermalink", JSON.stringify(tempDelete));
152
+ location.reload();
153
+ }
154
+
155
+
156
+ /**
157
+ * @method _addTag
158
+ *
159
+ * @description Bound to click event on website add button. adds another
160
+ * iteration of the element to the DOM and List
161
+ *
162
+ * @param {Object} element
163
+ *
164
+ */
165
+ _addTag(){
166
+ this.tagEntryField.push({url: '', label: '', default: false});
167
+ this.requestUpdate();
168
+ }
169
+
170
+ /**
171
+ * @method _addAuthor
172
+ *
173
+ * @description Bound to click event of add email button.
174
+ * adds another iteration of the element to the DOM and List
175
+ *
176
+ * @param {Object} element
177
+ *
178
+ */
179
+ _addAuthor(){
180
+ this.authorEntryField.push({value: '', default: false});
181
+ this.requestUpdate();
182
+ }
183
+
184
+ /**
185
+ * @method _sendValues
186
+ *
187
+ * @description Get the values from the form that is given.
188
+ *
189
+ * @param {Object} element
190
+ *
191
+ */
192
+ _sendValues(){
193
+ let formData = {};
194
+ let authorList = [];
195
+ let tagtitle = [];
196
+ let url = [];
197
+ let image = [];
198
+ let tags = [];
199
+
200
+ formData.title = this.shadowRoot.getElementById("permalink-title").value;
201
+ formData.year = this.shadowRoot.getElementById("permalink-date").value;
202
+ formData.summary = this.shadowRoot.getElementById("permalink-summary").value;
203
+ formData.image = this.shadowRoot.getElementById("permalink-image").value;
204
+ formData.permalink = this.shadowRoot.getElementById("permalink-permalink").value;
205
+
206
+
207
+ for(let i of this.shadowRoot.querySelectorAll("[id^='permalink-author']").values()){
208
+ authorList.push({"label" : i.value});
209
+ }
210
+ formData.author = authorList;
211
+
212
+
213
+ for(let i of this.shadowRoot.querySelectorAll("[id^='permalink-image']").values())
214
+ image.push(i.value);
215
+ formData.image = image[0];
216
+
217
+ for(let i of this.shadowRoot.querySelectorAll("[id^='permalink-tags ']").values())
218
+ tagtitle.push(i.value);
219
+
220
+ for(let i of this.shadowRoot.querySelectorAll("[id^='permalink-tags-url']").values())
221
+ url.push(i.value);
222
+
223
+ for(let i in tagtitle)
224
+ tags[i] = {"@id": url[i], "label": tagtitle[i]};
225
+ formData.tags = tags;
226
+
227
+ if(sessionStorage.getItem("newPermalink")){
228
+ this.newPermalink = JSON.parse(sessionStorage.getItem("newPermalink"));
229
+ this.newPermalink = Object.values(this.newPermalink);
230
+
231
+ }
232
+
233
+ this.newPermalink.push(formData);
234
+
235
+ this.form = false;
236
+
237
+ this.requestUpdate;
238
+ sessionStorage.setItem("newPermalink", JSON.stringify(this.newPermalink));
239
+ location.reload();
240
+
241
+
242
+ }
243
+
244
+ getCreatedPermalink(){
245
+ super.requestUpdate();
246
+
247
+ return this.newPermalink;
248
+ }
249
+
250
+
251
+ _onComplete(results){
252
+
253
+ /* Note:
254
+ ISBN has multiple options so later address which items to pick and whether
255
+ to use default thumbnail
256
+ */
257
+
258
+ this.COMPLETE = true;
259
+ this.PENDING = false;
260
+ this.LOADING = false;
261
+ this.results = results;
262
+ this.teaserType = this.results["@type"];
263
+ let img = [];
264
+ for(let i = 0; i < this.results.identifier.length; i++){
265
+ if(this.results.identifier[i]['@type']){
266
+ if(this.results.identifier[i]['@type'].includes('bibo:isbn'))
267
+ img = img.concat(this.results.identifier[i].label);
268
+ if(this.results.identifier[i]['@type'].includes('bibo:ean'))
269
+ img = img.concat(this.results.identifier[i].label);
270
+
271
+ }
272
+
273
+ }
274
+ let identifer = img[0];
275
+
276
+ if(this.teaserType == 'Video' || this.teaserType == 'Music'){
277
+ this.image = 'https://syndetics.com/index.php?client=primo&isbn='+ identifer + '/sc.gif';
278
+ }
279
+ else{
280
+ this.image = 'https://syndetics.com/index.php?client=primo&isbn='+ identifer + '/sc.jpg';
281
+ }
282
+
283
+ this.year = this.results.date;
284
+ this.title = this.results.title.substring(0, this.results.title.lastIndexOf("/"));
285
+ this.authorFull = !Array.isArray(this.results.creator) ? [this.results.creator] : this.results.creator;
286
+
287
+ this.authorLast = this.authorFull[0];
288
+ this.authorFirst = this.authorFull[1];
289
+ this.summary = this.results.description;
290
+ this.publisher = this.results.publisher;
291
+ this.placePublication = this.results.place_of_publication.split(' ')[0];
292
+ this.language = this.results.language;
293
+
294
+ for (let i = 0; i < Object.keys(this.results.subject).length; i++){
295
+ this.tags = this.tags.concat({"id": this.results.subject[i]["@id"], "subject": this.results.subject[i]["label"]});
296
+ }
297
+ this.tags = this.results.subject;
298
+
299
+ this.notes = this.results.note;
300
+
301
+ }
302
+
303
+
304
+ _requestUrl(){
305
+ let url =this.permalink;
306
+ let validate = this.validationLink(url);
307
+ if(validate == this.errorMessage) console.error(url);
308
+ this.requestUpdate();
309
+
310
+
311
+ url = validate;
312
+ return url;
313
+ }
314
+
315
+ _onLoading(){
316
+ this.LOADING = true;
317
+ }
318
+
319
+
320
+ }
321
+
322
+ customElements.define('ucdlib-sils-permalink',UcdlibSilsPermalink);
@@ -0,0 +1,337 @@
1
+ import { html, css } from 'lit';
2
+
3
+ import normalizeCss from "@ucd-lib/theme-sass/normalize.css.js";
4
+ import teaserStyles from "@ucd-lib/theme-sass/4_component/_index.css.js";
5
+ import baseStyles from "@ucd-lib/theme-sass/1_base_html/_index.css.js";
6
+ import buttons from "@ucd-lib/theme-sass/2_base_class/_index.css.js";
7
+ export function styles() {
8
+ const elementStyles = css`
9
+ :host {
10
+ display: block;
11
+ }
12
+ form {
13
+ width:100%;
14
+ }
15
+ #tag {
16
+ width:75%;
17
+ display: inline-block;
18
+ }
19
+ #tag-color {
20
+ width:24%;
21
+ display: inline-block;
22
+ }
23
+ #delete {
24
+ width:24%;
25
+ display: inline-block;
26
+ }
27
+ #permalink-author {
28
+ width:75%;
29
+ display: inline-block;
30
+ }
31
+ #permalink-tags {
32
+ width:75%;
33
+ display: inline-block;
34
+ }
35
+ #permalink-tags-url {
36
+ width:75%;
37
+ display: inline-block;
38
+ }
39
+
40
+
41
+ `;
42
+
43
+ return [elementStyles,baseStyles,teaserStyles,normalizeCss, buttons];
44
+ }
45
+
46
+ export function render() {
47
+ return html`
48
+ <style>
49
+ .vm-teaser__figure.category_loading{
50
+ background-color:#dcdcdc;
51
+ height:165px;
52
+ width:135px;
53
+ }
54
+ .load_teaser_a{
55
+ background-color:#dcdcdc;
56
+ width: 85%;
57
+ height:25px;
58
+ }
59
+ .load_teaser_b{
60
+ background-color:#dcdcdc;
61
+ width: 67%;
62
+ height:20px;
63
+ }
64
+ .load_teaser_c{
65
+ background-color:#dcdcdc;
66
+ width: 33.3%;
67
+ height:18px;
68
+ }
69
+ </style>
70
+ <!--
71
+ Starts the Permalink Fetch
72
+ -->
73
+ ${this.perma ? html`
74
+ ${this.perma.render({
75
+ complete: (result) => this._onComplete(result),
76
+ initial: () => this._onLoading(),
77
+ pending: () => this._onPending(),
78
+ error: (e) => this._onError(e)
79
+ })
80
+ }`:html``
81
+ }
82
+
83
+ <article class="vm-teaser ">
84
+ ${!this.LOADING ? html`
85
+ <!--
86
+ If it is completed permalink fetch
87
+ -->
88
+ ${!this.form ?
89
+
90
+ html`
91
+ <!--
92
+ This is the original permalink read that fires if there is are
93
+ attributes added to the permalink. If the form is not triggered
94
+ -->
95
+
96
+ <div class="vm-teaser__figure category">
97
+ <a href="${this.image}"><img src="${this.image}" alt="" class="" width="135" loading="eager" />
98
+ </a>
99
+ </div>
100
+ <div class="vm-teaser__body">
101
+ <h3 class="vm-teaser__title"><a href="${this.host_url ? this.host_url : this.permalink}">${this.title}</a></h3>
102
+
103
+ <ul class="vm-teaser__byline">
104
+ <li>
105
+
106
+ ${this.authorFull ?
107
+ typeof this.authorFull === 'string' || this.authorFull instanceof String ?
108
+ JSON.parse(this.authorFull).map(author => author["label"] != "" ? html`<span class="byline"> ${author["label"]}.</span>--<br />` : html``)
109
+ :this.authorFull.map(author => author["label"] != "" ? html`<span class="byline"> ${author["label"]}.</span>--<br />` : html``)
110
+ :html``
111
+ }
112
+ </li>
113
+ <li>${this.year}</li>
114
+ </ul>
115
+ <ul class="vm-teaser__categories">
116
+ ${this.tags ?
117
+ typeof this.tags === 'string' || this.tags instanceof String ?
118
+ JSON.parse(this.tags).map(tag => html`<li class="vm-teaser__cat-marker tahoe"><a href="${tag['@id']}">${tag['label']}</a></li>`)
119
+ :this.tags.map(tag => tag["label"] != "" ? html`<li class="vm-teaser__cat-marker ${this.elemClass[Math.floor(Math.random() * this.elemClass.length)]}"><a href="${tag['@id']}">${tag['label']}</a></li>`:html``)
120
+ :html``
121
+ }
122
+ </ul>
123
+ <div class="vm-teaser__summary">${this.summary}</div>
124
+ </div>
125
+ ${this.isCustom ? html`
126
+ <button id="delete-permalink" class="btn btn--alt2" @click="${this.handleDelete}">Delete Permalink</button>
127
+
128
+ `: html`
129
+ <button id="edit-permalink" class="btn--primary" @click="${this.handleEdit}">Edit Permalink</button>
130
+ `}
131
+
132
+ `:html`
133
+ <!--
134
+ This is if the form is triggered meaning the edit permalink is occuring
135
+ so that it adds to the entries to the session. Also takes info from what
136
+ is already in the permalink. This is the edit form
137
+ -->
138
+ <form method="post">
139
+ <!-- START OF FORM -->
140
+
141
+ <fieldset>
142
+
143
+ <!-- Title -->
144
+ <div class="field-container">
145
+ <label for="permalink-title">Title</label>
146
+ <input id="permalink-title" .value=${this.title ? this.title : ""} type="text" placeholder=${this.title ? this.title : "Enter Your Title"} />
147
+ </div>
148
+
149
+ <!-- Host URL -->
150
+ <div class="field-container">
151
+ <label for="permalink-permalink">Permalink Host URL</label>
152
+ <input id="permalink-permalink" .value=${this.permalink ? this.permalink : ""} type="text" placeholder=${this.permalink ? this.permalink : "Enter Your Title"} />
153
+ </div>
154
+
155
+
156
+ <br />
157
+ <br />
158
+ <br />
159
+
160
+
161
+ <!-- Author -->
162
+ ${this.authorFull ?
163
+ html`
164
+ <!-- If permalink already has authors -->
165
+ <div class="author">
166
+ <div style="border-style: solid; margin: 25px 0; padding:5px;">
167
+ ${this.authorFull.map((author, index) =>
168
+ html`
169
+ <div class="field-container">
170
+ <label for="permalink-author no-${index}">Author</label>
171
+ <input id="permalink-author no-${index}" type="author" .value=${author['label']} placeholder="${author['label'].split(",")[0]}, ${author['label'].split(",")[1] ? author['label'].split(",")[1] : ""} " />
172
+ </div> `
173
+ )}
174
+ </div>
175
+ <br />
176
+ <div>
177
+
178
+ <h5>New Author Entry</h5>
179
+ ${this.authorEntryField.map((item, index) =>
180
+ html`
181
+ <div class="field-container">
182
+ <label for="permalink-author no-${index}">Author</label>
183
+ <input id="permalink-author no-${index}" type="author" .value=${item.value} placeholder="Enter the Authors of the Work" />
184
+ </div>
185
+
186
+ `
187
+ )}
188
+ <a @click="${this._addAuthor}" class="btn--alt3 btn--sm" >Add Author Field</a>
189
+ </div>
190
+ </div>
191
+ `
192
+ :html`
193
+ <!-- If permalink DOES NOT has authors -->
194
+
195
+ <div>
196
+
197
+ <div class="author">
198
+ <br />
199
+ <h5>New Author Entry</h5>
200
+ ${this.authorEntryField.map((item, index) =>
201
+ html`
202
+ <div class="field-container">
203
+ <label for="permalink-author no-${index}">Author</label>
204
+ <input id="permalink-author no-${index}" type="author" .value=${item.value} placeholder="Enter the Authors of the Work" />
205
+ </div>
206
+
207
+ `
208
+ )}
209
+ <a @click="${this._addAuthor}" class="btn--alt3 btn--sm" >Add Author Field</a>
210
+ </div>
211
+ </div>
212
+ `}
213
+
214
+
215
+ <br />
216
+ <br />
217
+ <br />
218
+
219
+ <!-- Year -->
220
+ <div class="field-container">
221
+ <label for="permalink-date">Year of Publication</label>
222
+ <input id="permalink-date" value=${this.year ? this.year : ""} type="text" placeholder=${this.year ? this.year : "Year of Publication"} />
223
+ </div>
224
+
225
+ <!-- Image -->
226
+ <div class="field-container">
227
+ <label for="permalink-image">Image JPEG URL</label>
228
+ <input id="permalink-image" value=${this.image ? this.image : ""} type="url" placeholder=${this.year ? this.year : "Year of Publication"} />
229
+ </div>
230
+
231
+ <br />
232
+ <br />
233
+ <br />
234
+
235
+ <!-- Tags -->
236
+ ${this.tags ?
237
+ html`
238
+
239
+ <!-- If permalink already has Tags -->
240
+ <div class="tag">
241
+ <div style="border-style: solid; margin: 25px 0; padding:5px;">
242
+ ${this.tags.map((tag, index)=>
243
+ html`
244
+ <div id="tag" class="field-container">
245
+ <label for="permalink-tags no-${index}">Tag</label>
246
+ <input id="permalink-tags no-${index}" type="url" .value=${tag['label']} placeholder="${tag['label']}" />
247
+ </div>
248
+
249
+ <label for="permalink-tags-url no-${index}">URL</label>
250
+ <input id="permalink-tags-url no-${index}" .value=${tag['@id'] ? tag['@id']: ''} type="url" placeholder="${tag['@id'] ? tag['@id']: 'URL Not Defined'}" />
251
+
252
+ <br />
253
+ <br />
254
+ <br />
255
+ `
256
+ )}
257
+ </div>
258
+
259
+ <h5>New Tag Entry</h5>
260
+ ${this.tagEntryField.map((item, index) =>
261
+ html`
262
+ <div class="tag">
263
+ <div id="tag" class="field-container">
264
+ <label for="permalink-tags no-${index}">Tag</label>
265
+ <input id="permalink-tags no-${index}" type="url" .value=${item.label} placeholder="Name Your Permalink Tag" />
266
+ <label for="permalink-tags-url no-${index}">URL</label>
267
+ <input id="permalink-tags-url no-${index}" .value=${item.url} type="url" placeholder="URL of Permalink Tag" />
268
+ </div>
269
+ </div>
270
+ `
271
+ )}
272
+
273
+ <br />
274
+ <a @click="${this._addTag}" id="form-apply"class="btn--alt3 btn--sm">Add Tag Field</a>
275
+
276
+
277
+ `:html `
278
+ <!-- If permalink DOES NOT has Tags -->
279
+ <h5>New Tag Entry</h5>
280
+ ${this.tagEntryField.map((item, index) =>
281
+ html`
282
+ <div class="tag">
283
+ <div id="tag" class="field-container">
284
+ <label for="permalink-tags no-${index}">Tag</label>
285
+ <input id="permalink-tags no-${index}" type="url" .value=${item.label} placeholder="Name Your Permalink Tag" />
286
+ <label for="permalink-tags-url no-${index}">URL</label>
287
+ <input id="permalink-tags-url no-${index}" .value=${item.url} type="url" placeholder="URL of Permalink Tag" />
288
+ </div>
289
+ </div>
290
+ `
291
+
292
+ )}
293
+
294
+ <br />
295
+ <a @click="${this._addTag}" id="form-apply"class="btn--alt3 btn--sm">Add Tag Field</a>
296
+
297
+ `}
298
+
299
+ <br />
300
+ <!-- Summary -->
301
+ <div class="field-container">
302
+ <label for="permalink-summary">Summary</label>
303
+ <textarea id="permalink-summary" .value=${this.summary ? this.summary : ""} rows="5" placeholder=${this.summary ? this.summary : "Write Summary Here"}></textarea>
304
+ </div>
305
+
306
+
307
+ </fieldset>
308
+
309
+ <!-- Apply Button -->
310
+ <div class="field-container--small views-filters__submit-field">
311
+ <a @click="${this._sendValues}" class="btn--primary">Apply</a>
312
+ <a onClick="window.location.reload();" class="btn--alt">Cancel</a>
313
+ </div>
314
+
315
+ <!-- END OF FORM -->
316
+ </form>
317
+ `}
318
+ `:html`
319
+ <!--
320
+ If it is in the loading stage of the permalink fetch
321
+ it will render this
322
+ look.
323
+ -->
324
+ <div class="vm-teaser__figure category_loading"></div>
325
+ <div class="vm-teaser__body">
326
+ <div class="load_teaser_a"></div>
327
+ <br/>
328
+ <div class="load_teaser_b"></div>
329
+ <br/>
330
+ <div class="load_teaser_c"></div>
331
+ <br/>
332
+ <div class="load_teaser_c"></div>
333
+ </div>
334
+ `}
335
+ </article>
336
+ `;
337
+ }