@teipublisher/pb-components 2.25.5 → 2.25.7

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 (130) 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 +15 -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-facsimile.html +2 -2
  9. package/dist/demo/pb-leaflet-map.html +1 -1
  10. package/dist/demo/pb-repeat.html +1 -3
  11. package/dist/demo/pb-view3.html +1 -1
  12. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  13. package/dist/pb-code-editor.js +25 -20
  14. package/dist/pb-component-docs.js +58 -54
  15. package/dist/pb-components-bundle.js +1827 -1520
  16. package/dist/pb-edit-app.js +167 -107
  17. package/dist/pb-elements.json +54 -54
  18. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  19. package/dist/pb-leaflet-map.js +23 -23
  20. package/dist/pb-mei.js +56 -41
  21. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  22. package/dist/pb-odd-editor.js +925 -758
  23. package/dist/pb-tify.js +2 -2
  24. package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
  25. package/gh-pages.js +5 -3
  26. package/lib/openseadragon.min.js +6 -6
  27. package/package.json +3 -2
  28. package/pb-elements.json +54 -54
  29. package/src/assets/components.css +5 -5
  30. package/src/authority/airtable.js +20 -21
  31. package/src/authority/anton.js +129 -129
  32. package/src/authority/custom.js +23 -21
  33. package/src/authority/geonames.js +38 -32
  34. package/src/authority/gnd.js +47 -42
  35. package/src/authority/kbga.js +137 -134
  36. package/src/authority/metagrid.js +44 -46
  37. package/src/authority/reconciliation.js +66 -67
  38. package/src/authority/registry.js +4 -4
  39. package/src/docs/pb-component-docs.js +2 -2
  40. package/src/docs/pb-component-view.js +5 -5
  41. package/src/docs/pb-components-list.js +2 -2
  42. package/src/docs/pb-demo-snippet.js +2 -2
  43. package/src/dts-client.js +299 -297
  44. package/src/dts-select-endpoint.js +90 -82
  45. package/src/parse-date-service.js +184 -135
  46. package/src/pb-ajax.js +171 -167
  47. package/src/pb-authority-lookup.js +96 -81
  48. package/src/pb-autocomplete.js +292 -280
  49. package/src/pb-blacklab-highlight.js +264 -259
  50. package/src/pb-blacklab-results.js +236 -221
  51. package/src/pb-browse-docs.js +540 -475
  52. package/src/pb-browse.js +68 -65
  53. package/src/pb-clipboard.js +79 -76
  54. package/src/pb-code-editor.js +110 -102
  55. package/src/pb-code-highlight.js +209 -204
  56. package/src/pb-codepen.js +79 -72
  57. package/src/pb-collapse.js +149 -146
  58. package/src/pb-combo-box.js +190 -190
  59. package/src/pb-components-bundle.js +1 -1
  60. package/src/pb-custom-form.js +150 -149
  61. package/src/pb-document.js +89 -90
  62. package/src/pb-download.js +208 -195
  63. package/src/pb-drawer.js +145 -148
  64. package/src/pb-edit-app.js +301 -229
  65. package/src/pb-edit-xml.js +99 -96
  66. package/src/pb-events.js +114 -107
  67. package/src/pb-facs-link.js +104 -102
  68. package/src/pb-facsimile.js +444 -410
  69. package/src/pb-formula.js +151 -153
  70. package/src/pb-geolocation.js +129 -131
  71. package/src/pb-grid-action.js +53 -56
  72. package/src/pb-grid.js +231 -228
  73. package/src/pb-highlight.js +140 -140
  74. package/src/pb-hotkeys.js +40 -42
  75. package/src/pb-i18n.js +101 -104
  76. package/src/pb-image-strip.js +84 -78
  77. package/src/pb-lang.js +83 -70
  78. package/src/pb-leaflet-map.js +488 -485
  79. package/src/pb-link.js +126 -124
  80. package/src/pb-load.js +431 -426
  81. package/src/pb-login.js +275 -254
  82. package/src/pb-manage-odds.js +364 -318
  83. package/src/pb-map-icon.js +89 -89
  84. package/src/pb-map-layer.js +85 -85
  85. package/src/pb-markdown.js +90 -99
  86. package/src/pb-media-query.js +74 -72
  87. package/src/pb-mei.js +306 -295
  88. package/src/pb-message.js +143 -130
  89. package/src/pb-mixin.js +269 -264
  90. package/src/pb-navigation.js +80 -82
  91. package/src/pb-observable.js +38 -38
  92. package/src/pb-odd-editor.js +1056 -958
  93. package/src/pb-odd-elementspec-editor.js +348 -297
  94. package/src/pb-odd-model-editor.js +1058 -898
  95. package/src/pb-odd-parameter-editor.js +200 -178
  96. package/src/pb-odd-rendition-editor.js +136 -124
  97. package/src/pb-page.js +432 -422
  98. package/src/pb-paginate.js +202 -190
  99. package/src/pb-panel.js +191 -179
  100. package/src/pb-popover-themes.js +7 -5
  101. package/src/pb-popover.js +296 -287
  102. package/src/pb-print-preview.js +127 -127
  103. package/src/pb-progress.js +49 -49
  104. package/src/pb-repeat.js +105 -104
  105. package/src/pb-restricted.js +84 -77
  106. package/src/pb-search.js +238 -221
  107. package/src/pb-select-feature.js +127 -120
  108. package/src/pb-select-odd.js +132 -124
  109. package/src/pb-select-template.js +89 -78
  110. package/src/pb-select.js +251 -227
  111. package/src/pb-split-list.js +179 -174
  112. package/src/pb-svg.js +80 -79
  113. package/src/pb-table-column.js +54 -54
  114. package/src/pb-table-grid.js +221 -203
  115. package/src/pb-tabs.js +61 -63
  116. package/src/pb-tify.js +154 -154
  117. package/src/pb-timeline.js +271 -229
  118. package/src/pb-toggle-feature.js +198 -185
  119. package/src/pb-upload.js +184 -174
  120. package/src/pb-version.js +30 -30
  121. package/src/pb-view-annotate.js +132 -98
  122. package/src/pb-view.js +1282 -1263
  123. package/src/pb-zoom.js +40 -40
  124. package/src/polymer-hack.js +1 -1
  125. package/src/search-result-service.js +256 -223
  126. package/src/seed-element.js +13 -20
  127. package/src/settings.js +4 -4
  128. package/src/theming.js +91 -91
  129. package/src/urls.js +289 -289
  130. package/src/utils.js +53 -51
@@ -1,9 +1,9 @@
1
1
  import '@polymer/paper-icon-button';
2
- import { css, html } from "lit-element";
2
+ import { css, html } from 'lit-element';
3
3
  import tippy from 'tippy.js';
4
- import uniqolor from "uniqolor/src/index";
5
- import { PbView } from "./pb-view.js";
6
- import { loadTippyStyles } from "./pb-popover.js";
4
+ import uniqolor from 'uniqolor/src/index';
5
+ import { PbView } from './pb-view.js';
6
+ import { loadTippyStyles } from './pb-popover.js';
7
7
  import { get as i18n } from './pb-i18n.js';
8
8
 
9
9
  /**
@@ -79,7 +79,10 @@ function rangeToPoint(node, offset, position = 'start') {
79
79
  const child = container.childNodes[offset];
80
80
  return {
81
81
  parent: container.getAttribute('data-tei'),
82
- offset: position === 'end' ? absoluteOffset(container, child, 0) - 1 : absoluteOffset(container, child, 0),
82
+ offset:
83
+ position === 'end'
84
+ ? absoluteOffset(container, child, 0) - 1
85
+ : absoluteOffset(container, child, 0),
83
86
  };
84
87
  }
85
88
  const container = /** @type {Element} */ (node.parentNode).closest('[data-tei]');
@@ -88,9 +91,8 @@ function rangeToPoint(node, offset, position = 'start') {
88
91
  parent: container.getAttribute('data-tei'),
89
92
  offset: absoluteOffset(container, node, offset),
90
93
  };
91
- } else {
92
- console.error('No container with data-tei found for %o', node.parentNode);
93
94
  }
95
+ console.error('No container with data-tei found for %o', node.parentNode);
94
96
  }
95
97
 
96
98
  function ancestors(node, selector) {
@@ -173,7 +175,10 @@ function kwicText(str, start, end, words = 3) {
173
175
  }
174
176
  p1 += 1;
175
177
  }
176
- return `... ${str.substring(p0, start)}<mark>${str.substring(start, end)}</mark>${str.substring(end, p1 + 1)} ...`;
178
+ return `... ${str.substring(p0, start)}<mark>${str.substring(start, end)}</mark>${str.substring(
179
+ end,
180
+ p1 + 1,
181
+ )} ...`;
177
182
  }
178
183
 
179
184
  function collectText(node) {
@@ -197,7 +202,7 @@ function collectText(node) {
197
202
 
198
203
  function clearProperties(teiRange) {
199
204
  const cleaned = {};
200
- Object.keys(teiRange.properties).forEach((key) => {
205
+ Object.keys(teiRange.properties).forEach(key => {
201
206
  const val = teiRange.properties[key];
202
207
  if (val && val.length > 0) {
203
208
  cleaned[key] = val;
@@ -234,21 +239,21 @@ class PbViewAnnotate extends PbView {
234
239
  * like to use @key for some elements, but @corresp for others.
235
240
  */
236
241
  key: {
237
- type: String
242
+ type: String,
238
243
  },
239
244
  /**
240
245
  * Optional mapping of annotation type names to key properties
241
246
  */
242
247
  keyMap: {
243
248
  type: Object,
244
- attribute: 'key-map'
249
+ attribute: 'key-map',
245
250
  },
246
251
  /**
247
252
  * When searching the displayed text for other potential occurrences of an entity,
248
253
  * should the search be done in case-sensitive manner?
249
254
  */
250
255
  caseSensitive: {
251
- type: Boolean
256
+ type: Boolean,
252
257
  },
253
258
  ...super.properties,
254
259
  };
@@ -329,8 +334,12 @@ class PbViewAnnotate extends PbView {
329
334
  this.emitTo('pb-annotations-changed', { ranges: this._ranges, refresh: true });
330
335
  });
331
336
 
332
- this.addEventListener('pb-disable', () => { this._disabled = true; });
333
- this.addEventListener('pb-enable', () => { this._disabled = false; });
337
+ this.addEventListener('pb-disable', () => {
338
+ this._disabled = true;
339
+ });
340
+ this.addEventListener('pb-enable', () => {
341
+ this._disabled = false;
342
+ });
334
343
 
335
344
  this._resizeHandler();
336
345
  }
@@ -425,17 +434,19 @@ class PbViewAnnotate extends PbView {
425
434
 
426
435
  _handleContent() {
427
436
  super._handleContent();
428
- this.updateComplete.then(() => setTimeout(() => {
429
- this._initAnnotationColors();
430
- this._annotationStyles();
431
- this.updateAnnotations();
432
- this._markIncompleteAnnotations();
433
- if (this._scrollTop) {
434
- this.scrollTop = this._scrollTop;
435
- this._scrollTop = undefined;
436
- }
437
- this.emitTo('pb-annotations-loaded');
438
- }, 300));
437
+ this.updateComplete.then(() =>
438
+ setTimeout(() => {
439
+ this._initAnnotationColors();
440
+ this._annotationStyles();
441
+ this.updateAnnotations();
442
+ this._markIncompleteAnnotations();
443
+ if (this._scrollTop) {
444
+ this.scrollTop = this._scrollTop;
445
+ this._scrollTop = undefined;
446
+ }
447
+ this.emitTo('pb-annotations-loaded');
448
+ }, 300),
449
+ );
439
450
  }
440
451
 
441
452
  _updateAnnotation(teiRange, silent = false, batch = false) {
@@ -485,7 +496,9 @@ class PbViewAnnotate extends PbView {
485
496
  console.log('<pb-view-annotate> Range: %o', range);
486
497
  const span = document.createElement('span');
487
498
  const addClass = teiRange.properties[this.getKey(teiRange.type)] === '' ? 'incomplete' : '';
488
- span.className = `annotation annotation-${teiRange.type} ${teiRange.type} ${addClass} ${teiRange.before ? 'before' : ''}`;
499
+ span.className = `annotation annotation-${teiRange.type} ${teiRange.type} ${addClass} ${
500
+ teiRange.before ? 'before' : ''
501
+ }`;
489
502
  span.dataset.type = teiRange.type;
490
503
  span.dataset.annotation = JSON.stringify(teiRange.properties);
491
504
 
@@ -495,7 +508,9 @@ class PbViewAnnotate extends PbView {
495
508
  if (silent) {
496
509
  return null;
497
510
  }
498
- throw new Error('An error occurred. The annotation may not be displayed. You should consider saving and reloading the document.');
511
+ throw new Error(
512
+ 'An error occurred. The annotation may not be displayed. You should consider saving and reloading the document.',
513
+ );
499
514
  }
500
515
  this._rangesMap.set(span, teiRange);
501
516
 
@@ -507,7 +522,7 @@ class PbViewAnnotate extends PbView {
507
522
  }
508
523
 
509
524
  updateAnnotations(silent = false) {
510
- this._ranges.forEach((teiRange) => {
525
+ this._ranges.forEach(teiRange => {
511
526
  let span;
512
527
  switch (teiRange.type) {
513
528
  case 'delete':
@@ -535,9 +550,7 @@ class PbViewAnnotate extends PbView {
535
550
  }
536
551
 
537
552
  _getSelection() {
538
- return this.shadowRoot.getSelection
539
- ? this.shadowRoot.getSelection()
540
- : window.getSelection();
553
+ return this.shadowRoot.getSelection ? this.shadowRoot.getSelection() : window.getSelection();
541
554
  }
542
555
 
543
556
  _selectionChanged() {
@@ -576,7 +589,11 @@ class PbViewAnnotate extends PbView {
576
589
  }
577
590
  }, 100);
578
591
  }
579
- this.emitTo('pb-selection-changed', { hasContent: true, range, selected: selection.toString()});
592
+ this.emitTo('pb-selection-changed', {
593
+ hasContent: true,
594
+ range,
595
+ selected: selection.toString(),
596
+ });
580
597
  } else {
581
598
  this._clearSelection();
582
599
  this.emitTo('pb-selection-changed', { hasContent: false });
@@ -605,7 +622,7 @@ class PbViewAnnotate extends PbView {
605
622
 
606
623
  _clearSelection() {
607
624
  const markerLayer = this.shadowRoot.getElementById('marker-layer');
608
- markerLayer.querySelectorAll('.selection-marker').forEach((oldMarker) => {
625
+ markerLayer.querySelectorAll('.selection-marker').forEach(oldMarker => {
609
626
  markerLayer.removeChild(oldMarker);
610
627
  });
611
628
  }
@@ -633,10 +650,10 @@ class PbViewAnnotate extends PbView {
633
650
  const endRange = rangeToPoint(range.endContainer, range.endOffset, 'end');
634
651
  const adjustedRange = {
635
652
  context: startRange.parent,
636
- start: (info.position === 'after') ? endRange.offset : startRange.offset,
637
- end: (info === undefined || info.position === 'before') ? startRange.offset : endRange.offset,
653
+ start: info.position === 'after' ? endRange.offset : startRange.offset,
654
+ end: info === undefined || info.position === 'before' ? startRange.offset : endRange.offset,
638
655
  text: info.before ? '' : range.cloneContents().textContent,
639
- before: info.before
656
+ before: info.before,
640
657
  };
641
658
  if (info.type) {
642
659
  adjustedRange.type = info.type;
@@ -707,7 +724,7 @@ class PbViewAnnotate extends PbView {
707
724
  const selection = this._getSelection();
708
725
  selection.removeAllRanges();
709
726
  selection.addRange(newRange);
710
- } catch(e) {
727
+ } catch (e) {
711
728
  console.error('<pb-view-annotate> %s', e.message);
712
729
  } finally {
713
730
  this._inHandler = false;
@@ -731,14 +748,14 @@ class PbViewAnnotate extends PbView {
731
748
  range = clearProperties(range);
732
749
  this.emitTo('pb-annotations-changed', { ranges: this._ranges });
733
750
  } else {
734
- let range = this._rangesMap.get(span);
735
- if (range) {
736
- range.properties = properties;
737
- range = clearProperties(range);
738
- this.emitTo('pb-annotations-changed', { ranges: this._ranges });
739
- } else {
740
- console.error('no range found for edit span %o', span);
741
- }
751
+ let range = this._rangesMap.get(span);
752
+ if (range) {
753
+ range.properties = properties;
754
+ range = clearProperties(range);
755
+ this.emitTo('pb-annotations-changed', { ranges: this._ranges });
756
+ } else {
757
+ console.error('no range found for edit span %o', span);
758
+ }
742
759
  }
743
760
  const jsonOld = JSON.parse(span.dataset.annotation);
744
761
  const json = Object.assign(jsonOld || {}, properties);
@@ -801,7 +818,12 @@ class PbViewAnnotate extends PbView {
801
818
  editBtn.addEventListener('click', () => {
802
819
  const data = JSON.parse(span.dataset.annotation);
803
820
  const text = span.textContent;
804
- this.emitTo('pb-annotation-edit', Object.assign({}, { target: span, type: span.dataset.type, properties: data, text }));
821
+ this.emitTo('pb-annotation-edit', {
822
+ target: span,
823
+ type: span.dataset.type,
824
+ properties: data,
825
+ text,
826
+ });
805
827
  });
806
828
  div.appendChild(editBtn);
807
829
  }
@@ -839,19 +861,21 @@ class PbViewAnnotate extends PbView {
839
861
  onTrigger: (instance, ev) => {
840
862
  ev.preventDefault();
841
863
  ev.stopPropagation();
842
- const type = span.dataset.type;
864
+ const { type } = span.dataset;
843
865
  const data = JSON.parse(span.dataset.annotation) || {};
844
866
  const color = this._annotationColors.get(type);
845
867
  typeInd.innerHTML = type;
846
868
  typeInd.style.backgroundColor = `var(--pb-annotation-${type})`;
847
- typeInd.style.color = `var(${color && color.isLight ? '--pb-color-primary' : '--pb-color-inverse'})`;
869
+ typeInd.style.color = `var(${
870
+ color && color.isLight ? '--pb-color-primary' : '--pb-color-inverse'
871
+ })`;
848
872
  if (data[this.getKey(type)]) {
849
873
  this.emitTo('pb-annotation-detail', {
850
874
  type,
851
875
  id: data[this.getKey(type)],
852
876
  container: info,
853
877
  span,
854
- ready: () => instance.setContent(wrapper)
878
+ ready: () => instance.setContent(wrapper),
855
879
  });
856
880
  } else {
857
881
  // show properties as key/value table
@@ -863,7 +887,7 @@ class PbViewAnnotate extends PbView {
863
887
  info.appendChild(p);
864
888
  } else {
865
889
  const table = document.createElement('table');
866
- keys.forEach((key) => {
890
+ keys.forEach(key => {
867
891
  const tr = document.createElement('tr');
868
892
  const tdKey = document.createElement('td');
869
893
  tdKey.innerHTML = key;
@@ -879,7 +903,7 @@ class PbViewAnnotate extends PbView {
879
903
  },
880
904
  onClickOutside: (instance, ev) => {
881
905
  instance.hideWithInteractivity(ev);
882
- }
906
+ },
883
907
  });
884
908
  }
885
909
 
@@ -892,7 +916,7 @@ class PbViewAnnotate extends PbView {
892
916
  */
893
917
  _showMarker(span, root, rootRect, margin = 0) {
894
918
  const rects = span.getClientRects();
895
- const type = span.dataset.type;
919
+ const { type } = span.dataset;
896
920
  if (!span.classList.contains('before')) {
897
921
  for (let i = 0; i < rects.length; i++) {
898
922
  const rect = rects[i];
@@ -929,20 +953,18 @@ class PbViewAnnotate extends PbView {
929
953
  const markerLayer = this.shadowRoot.getElementById('marker-layer');
930
954
  markerLayer.style.display = 'none';
931
955
  this._clearMarkers();
932
- root.querySelectorAll('.annotation')
933
- .forEach(span => {
934
- if (span._tippy) {
935
- span._tippy.destroy();
936
- }
937
- this._showMarker(span, markerLayer, rootRect, ancestors(span, 'annotation') * 5);
938
- });
939
- markerLayer.style.display = 'block';
956
+ root.querySelectorAll('.annotation').forEach(span => {
957
+ if (span._tippy) {
958
+ span._tippy.destroy();
959
+ }
960
+ this._showMarker(span, markerLayer, rootRect, ancestors(span, 'annotation') * 5);
961
+ });
962
+ markerLayer.style.display = 'block';
940
963
  }
941
964
 
942
965
  search(type, tokens) {
943
966
  function escape(token) {
944
- let regex = token.replace(/[/.?+*\\]/g, (m) => `\\${m}`)
945
- .replace(/[\s\n\t]+/g, '\\s+');
967
+ let regex = token.replace(/[/.?+*\\]/g, m => `\\${m}`).replace(/[\s\n\t]+/g, '\\s+');
946
968
  if (/^\w/.test(regex)) {
947
969
  regex = `\\b${regex}`;
948
970
  }
@@ -966,7 +988,8 @@ class PbViewAnnotate extends PbView {
966
988
  if (!tokens || tokens.length === 0) {
967
989
  return result;
968
990
  }
969
- const expr = tokens.filter(token => token && token.length > 0)
991
+ const expr = tokens
992
+ .filter(token => token && token.length > 0)
970
993
  .map(token => escape(token))
971
994
  .join('|');
972
995
  console.log(`<pb-view-annotate> Searching content for ${expr}...`);
@@ -977,7 +1000,7 @@ class PbViewAnnotate extends PbView {
977
1000
  filter,
978
1001
  );
979
1002
  while (walker.nextNode()) {
980
- let node = walker.currentNode;
1003
+ const node = walker.currentNode;
981
1004
  const matches = Array.from(node.textContent.matchAll(regex));
982
1005
  for (const match of matches) {
983
1006
  const end = match.index + match[0].length;
@@ -1052,8 +1075,8 @@ class PbViewAnnotate extends PbView {
1052
1075
  }
1053
1076
 
1054
1077
  _markIncompleteAnnotations() {
1055
- const elem = this.shadowRoot.getElementById('view')
1056
- elem.querySelectorAll('.annotation.authority').forEach((annotation) => {
1078
+ const elem = this.shadowRoot.getElementById('view');
1079
+ elem.querySelectorAll('.annotation.authority').forEach(annotation => {
1057
1080
  if (annotation.dataset.type) {
1058
1081
  const data = JSON.parse(annotation.dataset.annotation);
1059
1082
  const key = this.getKey(annotation.dataset.type);
@@ -1070,16 +1093,19 @@ class PbViewAnnotate extends PbView {
1070
1093
  this._annotationColors = new Map();
1071
1094
  const types = new Set();
1072
1095
  const elem = this.shadowRoot.getElementById('view');
1073
- elem.querySelectorAll('.annotation').forEach((annotation) => {
1096
+ elem.querySelectorAll('.annotation').forEach(annotation => {
1074
1097
  if (annotation.dataset.type) {
1075
1098
  types.add(annotation.dataset.type);
1076
1099
  }
1077
1100
  });
1078
- types.forEach((type) => {
1079
- this._annotationColors.set(type, uniqolor(`annotation-${type.repeat(4)}`, {
1080
- saturation: 70,
1081
- lightness: [30, 60]
1082
- }));
1101
+ types.forEach(type => {
1102
+ this._annotationColors.set(
1103
+ type,
1104
+ uniqolor(`annotation-${type.repeat(4)}`, {
1105
+ saturation: 70,
1106
+ lightness: [30, 60],
1107
+ }),
1108
+ );
1083
1109
  });
1084
1110
  this.emitTo('pb-annotation-colors', { colors: this._annotationColors });
1085
1111
  }
@@ -1089,16 +1115,19 @@ class PbViewAnnotate extends PbView {
1089
1115
  return;
1090
1116
  }
1091
1117
 
1092
- this._annotationColors.set(type, uniqolor(`annotation-${type.repeat(4)}`, {
1093
- saturation: 70,
1094
- lightness: [30, 60]
1095
- }));
1118
+ this._annotationColors.set(
1119
+ type,
1120
+ uniqolor(`annotation-${type.repeat(4)}`, {
1121
+ saturation: 70,
1122
+ lightness: [30, 60],
1123
+ }),
1124
+ );
1096
1125
  this._annotationStyles();
1097
1126
  this.emitTo('pb-annotation-colors', { colors: this._annotationColors });
1098
1127
  }
1099
1128
 
1100
1129
  _annotationStyles() {
1101
- const view = this.shadowRoot.getElementById('view')
1130
+ const view = this.shadowRoot.getElementById('view');
1102
1131
  let styles = view.querySelector('_annotation-styles');
1103
1132
  if (styles) {
1104
1133
  styles.parentNode.removeChild(styles);
@@ -1119,8 +1148,12 @@ class PbViewAnnotate extends PbView {
1119
1148
  315deg,
1120
1149
  var(--pb-annotation-${type}),
1121
1150
  var(--pb-annotation-${type}) 5px,
1122
- var(${color.isLight ? '--pb-annotation-stripes-light' : '--pb-annotation-stripes-dark'}) 5px,
1123
- var(${color.isLight ? '--pb-annotation-stripes-light' : '--pb-annotation-stripes-dark'}) 10px
1151
+ var(${
1152
+ color.isLight ? '--pb-annotation-stripes-light' : '--pb-annotation-stripes-dark'
1153
+ }) 5px,
1154
+ var(${
1155
+ color.isLight ? '--pb-annotation-stripes-light' : '--pb-annotation-stripes-dark'
1156
+ }) 10px
1124
1157
  );
1125
1158
  color: var(${color.isLight ? '--pb-color-primary' : '--pb-color-inverse'});
1126
1159
  }
@@ -1144,13 +1177,13 @@ class PbViewAnnotate extends PbView {
1144
1177
  super.styles,
1145
1178
  css`
1146
1179
  .annotation-type {
1147
- display: inline-block;
1148
- text-align: right;
1149
- padding: 4px;
1180
+ display: inline-block;
1181
+ text-align: right;
1182
+ padding: 4px;
1150
1183
  }
1151
1184
 
1152
1185
  .annotation-popup .toolbar {
1153
- margin-top: 1em;
1186
+ margin-top: 1em;
1154
1187
  }
1155
1188
 
1156
1189
  .annotation-popup table {
@@ -1166,21 +1199,21 @@ class PbViewAnnotate extends PbView {
1166
1199
  }
1167
1200
 
1168
1201
  .annotation {
1169
- pointer-events: none;
1170
- cursor: pointer;
1202
+ pointer-events: none;
1203
+ cursor: pointer;
1171
1204
  }
1172
1205
 
1173
1206
  .annotation::after {
1174
- content: attr(data-type);
1175
- margin-left: 4px;
1176
- pointer-events: all;
1177
- font-family: var(--pb-base-font-family);
1178
- font-size: .8rem;
1179
- font-style: normal;
1180
- font-weight: normal;
1181
- text-decoration: none;
1182
- font-variant: normal;
1183
- padding: 2px;
1207
+ content: attr(data-type);
1208
+ margin-left: 4px;
1209
+ pointer-events: all;
1210
+ font-family: var(--pb-base-font-family);
1211
+ font-size: 0.8rem;
1212
+ font-style: normal;
1213
+ font-weight: normal;
1214
+ text-decoration: none;
1215
+ font-variant: normal;
1216
+ padding: 2px;
1184
1217
  }
1185
1218
 
1186
1219
  .annotation.before::after {
@@ -1188,12 +1221,13 @@ class PbViewAnnotate extends PbView {
1188
1221
  border-radius: 4px;
1189
1222
  }
1190
1223
 
1191
- [part=highlight] {
1224
+ [part='highlight'] {
1192
1225
  border: 3px solid rgb(255, 174, 0);
1193
1226
  border-radius: 8px;
1194
- }`
1227
+ }
1228
+ `,
1195
1229
  ];
1196
1230
  }
1197
- };
1231
+ }
1198
1232
 
1199
1233
  customElements.define('pb-view-annotate', PbViewAnnotate);