@teipublisher/pb-components 2.25.5 → 2.25.6

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 (128) hide show
  1. package/.github/workflows/main.yml +3 -3
  2. package/.github/workflows/node.js.yml +3 -3
  3. package/.github/workflows/release.js.yml +3 -3
  4. package/CHANGELOG.md +8 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/pb-drawer2.html +1 -1
  8. package/dist/demo/pb-leaflet-map.html +1 -1
  9. package/dist/demo/pb-repeat.html +1 -3
  10. package/dist/demo/pb-view3.html +1 -1
  11. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  12. package/dist/pb-code-editor.js +25 -20
  13. package/dist/pb-component-docs.js +58 -54
  14. package/dist/pb-components-bundle.js +1827 -1520
  15. package/dist/pb-edit-app.js +167 -107
  16. package/dist/pb-elements.json +54 -54
  17. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  18. package/dist/pb-leaflet-map.js +23 -23
  19. package/dist/pb-mei.js +56 -41
  20. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  21. package/dist/pb-odd-editor.js +925 -758
  22. package/dist/pb-tify.js +2 -2
  23. package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
  24. package/gh-pages.js +5 -3
  25. package/package.json +2 -2
  26. package/pb-elements.json +54 -54
  27. package/src/assets/components.css +5 -5
  28. package/src/authority/airtable.js +20 -21
  29. package/src/authority/anton.js +129 -129
  30. package/src/authority/custom.js +23 -21
  31. package/src/authority/geonames.js +38 -32
  32. package/src/authority/gnd.js +47 -42
  33. package/src/authority/kbga.js +137 -134
  34. package/src/authority/metagrid.js +44 -46
  35. package/src/authority/reconciliation.js +66 -67
  36. package/src/authority/registry.js +4 -4
  37. package/src/docs/pb-component-docs.js +2 -2
  38. package/src/docs/pb-component-view.js +5 -5
  39. package/src/docs/pb-components-list.js +2 -2
  40. package/src/docs/pb-demo-snippet.js +2 -2
  41. package/src/dts-client.js +299 -297
  42. package/src/dts-select-endpoint.js +90 -82
  43. package/src/parse-date-service.js +184 -135
  44. package/src/pb-ajax.js +171 -167
  45. package/src/pb-authority-lookup.js +96 -81
  46. package/src/pb-autocomplete.js +292 -280
  47. package/src/pb-blacklab-highlight.js +264 -259
  48. package/src/pb-blacklab-results.js +236 -221
  49. package/src/pb-browse-docs.js +540 -475
  50. package/src/pb-browse.js +68 -65
  51. package/src/pb-clipboard.js +79 -76
  52. package/src/pb-code-editor.js +110 -102
  53. package/src/pb-code-highlight.js +209 -204
  54. package/src/pb-codepen.js +79 -72
  55. package/src/pb-collapse.js +149 -146
  56. package/src/pb-combo-box.js +190 -190
  57. package/src/pb-components-bundle.js +1 -1
  58. package/src/pb-custom-form.js +150 -149
  59. package/src/pb-document.js +89 -90
  60. package/src/pb-download.js +208 -195
  61. package/src/pb-drawer.js +145 -148
  62. package/src/pb-edit-app.js +301 -229
  63. package/src/pb-edit-xml.js +99 -96
  64. package/src/pb-events.js +114 -107
  65. package/src/pb-facs-link.js +104 -102
  66. package/src/pb-facsimile.js +411 -413
  67. package/src/pb-formula.js +151 -153
  68. package/src/pb-geolocation.js +129 -131
  69. package/src/pb-grid-action.js +53 -56
  70. package/src/pb-grid.js +231 -228
  71. package/src/pb-highlight.js +140 -140
  72. package/src/pb-hotkeys.js +40 -42
  73. package/src/pb-i18n.js +101 -104
  74. package/src/pb-image-strip.js +84 -78
  75. package/src/pb-lang.js +83 -70
  76. package/src/pb-leaflet-map.js +488 -485
  77. package/src/pb-link.js +126 -124
  78. package/src/pb-load.js +431 -426
  79. package/src/pb-login.js +275 -254
  80. package/src/pb-manage-odds.js +364 -318
  81. package/src/pb-map-icon.js +89 -89
  82. package/src/pb-map-layer.js +85 -85
  83. package/src/pb-markdown.js +90 -99
  84. package/src/pb-media-query.js +74 -72
  85. package/src/pb-mei.js +306 -295
  86. package/src/pb-message.js +143 -130
  87. package/src/pb-mixin.js +269 -264
  88. package/src/pb-navigation.js +80 -82
  89. package/src/pb-observable.js +38 -38
  90. package/src/pb-odd-editor.js +1056 -958
  91. package/src/pb-odd-elementspec-editor.js +348 -297
  92. package/src/pb-odd-model-editor.js +1058 -898
  93. package/src/pb-odd-parameter-editor.js +200 -178
  94. package/src/pb-odd-rendition-editor.js +136 -124
  95. package/src/pb-page.js +432 -422
  96. package/src/pb-paginate.js +202 -190
  97. package/src/pb-panel.js +191 -179
  98. package/src/pb-popover-themes.js +7 -5
  99. package/src/pb-popover.js +296 -287
  100. package/src/pb-print-preview.js +127 -127
  101. package/src/pb-progress.js +49 -49
  102. package/src/pb-repeat.js +105 -104
  103. package/src/pb-restricted.js +84 -77
  104. package/src/pb-search.js +238 -221
  105. package/src/pb-select-feature.js +127 -120
  106. package/src/pb-select-odd.js +132 -124
  107. package/src/pb-select-template.js +89 -78
  108. package/src/pb-select.js +251 -227
  109. package/src/pb-split-list.js +179 -174
  110. package/src/pb-svg.js +80 -79
  111. package/src/pb-table-column.js +54 -54
  112. package/src/pb-table-grid.js +221 -203
  113. package/src/pb-tabs.js +61 -63
  114. package/src/pb-tify.js +154 -154
  115. package/src/pb-timeline.js +271 -229
  116. package/src/pb-toggle-feature.js +198 -185
  117. package/src/pb-upload.js +184 -174
  118. package/src/pb-version.js +30 -30
  119. package/src/pb-view-annotate.js +132 -98
  120. package/src/pb-view.js +1282 -1263
  121. package/src/pb-zoom.js +40 -40
  122. package/src/polymer-hack.js +1 -1
  123. package/src/search-result-service.js +256 -223
  124. package/src/seed-element.js +13 -20
  125. package/src/settings.js +4 -4
  126. package/src/theming.js +91 -91
  127. package/src/urls.js +289 -289
  128. package/src/utils.js +53 -51
@@ -1,19 +1,19 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
3
3
  import { pbMixin, waitOnce } from './pb-mixin.js';
4
- import { translate } from "./pb-i18n.js";
5
- import { createConnectors } from "./authority/connectors.js";
6
- import "./pb-restricted.js";
4
+ import { translate } from './pb-i18n.js';
5
+ import { createConnectors } from './authority/connectors.js';
6
+ import './pb-restricted.js';
7
7
  import '@polymer/paper-input/paper-input';
8
8
  import '@polymer/paper-icon-button';
9
9
 
10
10
  /**
11
11
  * Performs authority lookups via configurable connectors.
12
- *
12
+ *
13
13
  * @fires pb-authority-select - Fired when user selects an entry from the list
14
14
  * @fires pb-authority-edit-entity - Fired when user clicks the edit button next to an entry
15
15
  * @fires pb-authority-new-entity - Fired when user clicks the add new entity button
16
- * @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
16
+ * @fires pb-authority-lookup - When received, starts a lookup using the passed in query string and
17
17
  * authority type
18
18
  */
19
19
  export class PbAuthorityLookup extends pbMixin(LitElement) {
@@ -32,7 +32,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
32
32
  */
33
33
  sortByLabel: {
34
34
  type: Boolean,
35
- attribute: 'sort-by-label'
35
+ attribute: 'sort-by-label',
36
36
  },
37
37
  /**
38
38
  * A list of comma-separated stopwords which should be excluded
@@ -40,16 +40,16 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
40
40
  * HTML text
41
41
  */
42
42
  stopwords: {
43
- type: String
43
+ type: String,
44
44
  },
45
45
  /**
46
46
  * A list of space- or comma-separated group names, whose members will be
47
47
  * allowed to add or edit entries in the local register (if enabled).
48
- *
48
+ *
49
49
  * @default "tei"
50
50
  */
51
51
  group: {
52
- type: String
52
+ type: String,
53
53
  },
54
54
  /**
55
55
  * The authority type to use. Should correspond to a name defined for one of the connectors.
@@ -95,19 +95,21 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
95
95
 
96
96
  this._stopwordSet = new Set();
97
97
  if (this.stopwords) {
98
- this.stopwords.split(/\s*,\s*/).forEach((sw) => this._stopwordSet.add(sw.toLowerCase()));
98
+ this.stopwords.split(/\s*,\s*/).forEach(sw => this._stopwordSet.add(sw.toLowerCase()));
99
99
  }
100
100
 
101
101
  this.subscribeTo('pb-authority-lookup', ev => {
102
- this.query = ev.detail.query;
103
- this.type = ev.detail.type;
104
- this._results = [];
105
- this._query();
102
+ this.query = ev.detail.query;
103
+ this.type = ev.detail.type;
104
+ this._results = [];
105
+ this._query();
106
106
  });
107
107
 
108
108
  waitOnce('pb-page-ready', () => {
109
109
  const connectors = createConnectors(this.getEndpoint(), this);
110
- connectors.forEach(connector => { this._authorities[connector.register] = connector });
110
+ connectors.forEach(connector => {
111
+ this._authorities[connector.register] = connector;
112
+ });
111
113
  if (this.autoLookup) {
112
114
  this._query();
113
115
  }
@@ -126,14 +128,17 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
126
128
  @change="${this._queryChanged}"
127
129
  >
128
130
  <iron-icon icon="icons:search" slot="prefix"></iron-icon>
129
- ${
130
- this._authorities[this.type] && this._authorities[this.type].editable ?
131
- html`
132
- <pb-restricted group="${this.group}" slot="suffix">
133
- <paper-icon-button icon="icons:add" @click="${this._addEntity}" title="${translate('annotations.add-entity')}"></paper-icon-button>
134
- </pb-restricted>
135
- ` : null
136
- }
131
+ ${this._authorities[this.type] && this._authorities[this.type].editable
132
+ ? html`
133
+ <pb-restricted group="${this.group}" slot="suffix">
134
+ <paper-icon-button
135
+ icon="icons:add"
136
+ @click="${this._addEntity}"
137
+ title="${translate('annotations.add-entity')}"
138
+ ></paper-icon-button>
139
+ </pb-restricted>
140
+ `
141
+ : null}
137
142
  </paper-input>
138
143
  <slot name="authform"></slot>
139
144
  <div id="output">
@@ -151,11 +156,16 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
151
156
  return Promise.resolve();
152
157
  }
153
158
  const authority = this._authorities[register];
154
- console.log('<pb-authority-lookup> Retrieving info for %s from %s using %s', id, register, authority.constructor.name);
159
+ console.log(
160
+ '<pb-authority-lookup> Retrieving info for %s from %s using %s',
161
+ id,
162
+ register,
163
+ authority.constructor.name,
164
+ );
155
165
  let info = await authority.info(id, container);
156
166
  if (info.strings) {
157
167
  info = Object.assign(info, {
158
- strings: info.strings.filter((s) => s && !this._stopwordSet.has(s.toLowerCase()))
168
+ strings: info.strings.filter(s => s && !this._stopwordSet.has(s.toLowerCase())),
159
169
  });
160
170
  }
161
171
  return info;
@@ -164,43 +174,42 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
164
174
  _formatItem(item) {
165
175
  return html`
166
176
  <li>
167
- <div class="icons">
168
- <paper-icon-button
169
- icon="icons:link"
170
- @click="${() => this._select(item)}"
171
- title="link to"
172
- ></paper-icon-button>
173
- </div>
174
- <div class="link">
175
- ${item.link
176
- ? html`<a target="_blank" href="${item.link}">${unsafeHTML(item.label)}</a>`
177
- : html`${unsafeHTML(item.label)}`
178
- }
179
- </div>
180
- ${item.occurrences > 0 ? html`<div><span class="occurrences" part="occurrences">${item.occurrences}</span></div>` : null}
181
- ${item.provider ? html`<div><span class="source" part="source">${item.provider}</span></div>` :null}
177
+ <div class="icons">
178
+ <paper-icon-button
179
+ icon="icons:link"
180
+ @click="${() => this._select(item)}"
181
+ title="link to"
182
+ ></paper-icon-button>
183
+ </div>
184
+ <div class="link">
185
+ ${item.link
186
+ ? html`<a target="_blank" href="${item.link}">${unsafeHTML(item.label)}</a>`
187
+ : html`${unsafeHTML(item.label)}`}
188
+ </div>
189
+ ${item.occurrences > 0
190
+ ? html`<div><span class="occurrences" part="occurrences">${item.occurrences}</span></div>`
191
+ : null}
192
+ ${item.provider
193
+ ? html`<div><span class="source" part="source">${item.provider}</span></div>`
194
+ : null}
182
195
  <div><span class="register" part="register">${item.register}</span></div>
183
196
 
184
- ${
185
- this._authorities[this.type] && this._authorities[this.type].editable ?
186
- html`
187
- <pb-restricted group="${this.group}">
197
+ ${this._authorities[this.type] && this._authorities[this.type].editable
198
+ ? html` <pb-restricted group="${this.group}">
188
199
  <div class="icons">
189
- <paper-icon-button
190
- icon="editor:mode-edit"
191
- @click="${() => this._editEntity(item)}"
192
- title="${translate('annotations.edit-entity')}"
193
- ></paper-icon-button>
200
+ <paper-icon-button
201
+ icon="editor:mode-edit"
202
+ @click="${() => this._editEntity(item)}"
203
+ title="${translate('annotations.edit-entity')}"
204
+ ></paper-icon-button>
194
205
  </div>
195
- </pb-restricted>` : null
196
- }
206
+ </pb-restricted>`
207
+ : null}
197
208
  ${item.details ? html`<div class="details" part="details">${item.details}</div>` : null}
198
-
199
209
  </li>
200
210
  `;
201
211
  }
202
212
 
203
-
204
213
  _select(item) {
205
214
  const connector = this._authorities[item.register];
206
215
  const options = {
@@ -208,13 +217,13 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
208
217
  type: item.register,
209
218
  properties: {
210
219
  ref: item.id,
211
- }
220
+ },
212
221
  };
213
222
  if (connector) {
214
223
  connector
215
224
  .select(item)
216
225
  .then(() => this.emitTo('pb-authority-select', options))
217
- .catch((e) => this.emitTo('pb-authority-error', {status: e.message}));
226
+ .catch(e => this.emitTo('pb-authority-error', { status: e.message }));
218
227
  } else {
219
228
  this.emitTo('pb-authority-select', options);
220
229
  }
@@ -225,24 +234,23 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
225
234
  if (connector) {
226
235
  connector
227
236
  .select(item)
228
- .then(() => this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register}));
237
+ .then(() => this.emitTo('pb-authority-edit-entity', { id: item.id, type: item.register }));
229
238
  } else {
230
- this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register});
239
+ this.emitTo('pb-authority-edit-entity', { id: item.id, type: item.register });
231
240
  }
232
241
  }
233
242
 
234
243
  _queryChanged() {
235
244
  this._results = [];
236
- this.query = this.shadowRoot.getElementById('query').value;
237
- this._query();
245
+ this.query = this.shadowRoot.getElementById('query').value;
246
+ this._query();
238
247
  }
239
248
 
240
249
  _query() {
241
250
  this.emitTo('pb-start-update');
242
251
  this._authorities[this.type].query(this.query).then(results => {
243
- this._occurrences(results.items)
244
- .then((merged) => {
245
- this._results = merged;
252
+ this._occurrences(results.items).then(merged => {
253
+ this._results = merged;
246
254
  });
247
255
  this.emitTo('pb-end-update');
248
256
  // this.shadowRoot.getElementById('query').focus();
@@ -250,7 +258,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
250
258
  }
251
259
 
252
260
  _addEntity() {
253
- this.emitTo('pb-authority-new-entity', {query: this.query, type: this.type});
261
+ this.emitTo('pb-authority-new-entity', { query: this.query, type: this.type });
254
262
  }
255
263
 
256
264
  _occurrences(items) {
@@ -259,13 +267,13 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
259
267
  }
260
268
  const params = new FormData();
261
269
  params.append('register', this.type);
262
- items.forEach((item) => {
270
+ items.forEach(item => {
263
271
  params.append('id', item.id);
264
272
  });
265
- return new Promise((resolve) => {
273
+ return new Promise(resolve => {
266
274
  fetch(`${this.getEndpoint()}/api/annotations/occurrences`, {
267
275
  method: 'POST',
268
- body: params
276
+ body: params,
269
277
  })
270
278
  .then(response => {
271
279
  if (response.ok) {
@@ -273,7 +281,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
273
281
  }
274
282
  })
275
283
  .then(json => {
276
- items.forEach((item) => {
284
+ items.forEach(item => {
277
285
  if (json[item.id]) {
278
286
  item.occurrences = json[item.id];
279
287
  } else {
@@ -295,7 +303,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
295
303
  });
296
304
  resolve(items);
297
305
  });
298
- });
306
+ });
299
307
  }
300
308
 
301
309
  static get styles() {
@@ -334,26 +342,33 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
334
342
  list-style: none;
335
343
  }
336
344
  #output li {
337
- display: flex;
338
- justify-content: space-between;
339
- flex-wrap: wrap;
340
- align-items: center;
341
- border-bottom: 1px solid #efefef;
345
+ display: flex;
346
+ justify-content: space-between;
347
+ flex-wrap: wrap;
348
+ align-items: center;
349
+ border-bottom: 1px solid #efefef;
342
350
  }
343
- #output li:hover{
344
- background:#efefef;
345
- }
346
- #output td:nth-child(3), #output td:nth-child(4), #output td:nth-child(5) {
351
+ #output li:hover {
352
+ background: #efefef;
353
+ }
354
+ #output td:nth-child(3),
355
+ #output td:nth-child(4),
356
+ #output td:nth-child(5) {
347
357
  text-align: right;
348
358
  vertical-align: middle;
349
359
  }
350
360
 
351
- .details, .source, .register, .occurrences {
352
- font-size: .85rem;
353
- width: 100%;
361
+ .details,
362
+ .source,
363
+ .register,
364
+ .occurrences {
365
+ font-size: 0.85rem;
366
+ width: 100%;
354
367
  }
355
368
 
356
- .source, .register, .occurrences {
369
+ .source,
370
+ .register,
371
+ .occurrences {
357
372
  border-radius: 4px;
358
373
  padding: 4px;
359
374
  color: var(--pb-color-inverse);