@teipublisher/pb-components 2.25.4 → 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 (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 +4 -4
  4. package/.releaserc.json +1 -1
  5. package/CHANGELOG.md +15 -0
  6. package/Dockerfile +78 -70
  7. package/css/components.css +5 -5
  8. package/dist/demo/pb-drawer2.html +1 -1
  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/i18n/common/pl.json +2 -2
  27. package/package.json +2 -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 +411 -413
  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
package/src/pb-panel.js CHANGED
@@ -20,193 +20,205 @@ import '@polymer/app-layout';
20
20
  * @cssprop --pb-panel-max-height - The max height of the panel content. Set to enable scrolling.
21
21
  */
22
22
  export class PbPanel extends pbMixin(LitElement) {
23
- static get properties() {
24
- return {
25
- ...super.properties,
26
- /**
27
- * the index of the active view
28
- */
29
- active: {
30
- type: Number,
31
- reflect: true
32
- },
33
- /**
34
- * the label displayed above the dropdown for selecting the view to show
35
- */
36
- label: {
37
- type: String
38
- },
39
- /**
40
- * a name for each available panel, to be displayed in the dropdown. If not set,
41
- * each template will be checked for a title attribute, which will be taken as name.
42
- */
43
- panels: {
44
- type: Array,
45
- reflect: true
46
- },
47
- /**
48
- * if set, the panel can be dragged to another position in the grid. A button will
49
- * be added to the toolbar to allow dragging.
50
- */
51
- draggable: {
52
- type: Boolean
53
- }
54
- };
23
+ static get properties() {
24
+ return {
25
+ ...super.properties,
26
+ /**
27
+ * the index of the active view
28
+ */
29
+ active: {
30
+ type: Number,
31
+ reflect: true,
32
+ },
33
+ /**
34
+ * the label displayed above the dropdown for selecting the view to show
35
+ */
36
+ label: {
37
+ type: String,
38
+ },
39
+ /**
40
+ * a name for each available panel, to be displayed in the dropdown. If not set,
41
+ * each template will be checked for a title attribute, which will be taken as name.
42
+ */
43
+ panels: {
44
+ type: Array,
45
+ reflect: true,
46
+ },
47
+ /**
48
+ * if set, the panel can be dragged to another position in the grid. A button will
49
+ * be added to the toolbar to allow dragging.
50
+ */
51
+ draggable: {
52
+ type: Boolean,
53
+ },
54
+ };
55
+ }
56
+
57
+ constructor() {
58
+ super();
59
+ this.active = 0;
60
+ this.label = 'View';
61
+ this.panels = null;
62
+ this.position = -1;
63
+ this.draggable = false;
64
+ }
65
+
66
+ connectedCallback() {
67
+ super.connectedCallback();
68
+
69
+ if (!this.panels) {
70
+ const titles = [];
71
+ this.querySelectorAll('template').forEach(template => titles.push(template.title));
72
+ this.panels = titles;
55
73
  }
56
-
57
- constructor() {
58
- super();
59
- this.active = 0;
60
- this.label = 'View';
61
- this.panels = null;
62
- this.position = -1;
63
- this.draggable = false;
64
- }
65
-
66
- connectedCallback() {
67
- super.connectedCallback();
68
-
69
- if (!this.panels) {
70
- const titles = [];
71
- this.querySelectorAll('template').forEach(template => titles.push(template.title));
72
- this.panels = titles;
73
- }
74
- this._show();
74
+ this._show();
75
+ }
76
+
77
+ firstUpdated() {
78
+ const dragHandle = this.shadowRoot.getElementById('drag-handle');
79
+ let initiator = null;
80
+
81
+ if (this.draggable) {
82
+ dragHandle.addEventListener('dragstart', ev => {
83
+ ev.dataTransfer.setDragImage(this, 10, 10);
84
+ ev.dataTransfer.setData('text', this.position);
85
+ initiator = this;
86
+ });
75
87
  }
76
88
 
77
- firstUpdated() {
78
- const dragHandle = this.shadowRoot.getElementById('drag-handle');
79
- let initiator = null;
80
-
81
- if (this.draggable) {
82
- dragHandle.addEventListener('dragstart', (ev) => {
83
- ev.dataTransfer.setDragImage(this, 10, 10);
84
- ev.dataTransfer.setData("text", this.position);
85
- initiator = this;
86
- });
89
+ this.addEventListener('dragover', ev => {
90
+ ev.preventDefault();
91
+ });
92
+ document.addEventListener('dragenter', ev => {
93
+ ev.stopPropagation();
94
+ ev.preventDefault();
95
+ if (initiator === this) {
96
+ return;
97
+ }
98
+ if (this.contains(ev.target)) {
99
+ this.classList.add('dragover');
100
+ } else {
101
+ this.classList.remove('dragover');
102
+ }
103
+ });
104
+ this.addEventListener('drop', ev => {
105
+ ev.stopPropagation();
106
+ ev.preventDefault();
107
+
108
+ initiator = null;
109
+ this.dispatchEvent(
110
+ new CustomEvent('pb-drop', {
111
+ detail: {
112
+ panel: ev.dataTransfer.getData('text'),
113
+ target: this,
114
+ },
115
+ bubbles: true,
116
+ composed: true,
117
+ }),
118
+ );
119
+ });
120
+ }
121
+
122
+ render() {
123
+ return html`
124
+ <app-toolbar id="toolbar">
125
+ <paper-dropdown-menu id="menu" label="${this.label}">
126
+ <paper-listbox
127
+ id="panels"
128
+ slot="dropdown-content"
129
+ class="dropdown-content"
130
+ selected="${this.active}"
131
+ @selected-item-changed="${this._update}"
132
+ >
133
+ ${this.panels.map(item => html`<paper-item>${item}</paper-item>`)}
134
+ </paper-listbox>
135
+ </paper-dropdown-menu>
136
+ ${this.draggable
137
+ ? html`<paper-icon-button
138
+ id="drag-handle"
139
+ icon="icons:open-with"
140
+ draggable="true"
141
+ ></paper-icon-button>`
142
+ : ''}
143
+ <slot name="toolbar"></slot>
144
+ </app-toolbar>
145
+ <slot></slot>
146
+ `;
147
+ }
148
+
149
+ static get styles() {
150
+ return css`
151
+ :host {
152
+ display: block;
153
+ }
154
+
155
+ app-toolbar {
156
+ padding: 0;
157
+ justify-content: space-between;
158
+ }
159
+
160
+ ::slotted(._pb_panel) {
161
+ overflow: auto;
162
+ max-height: calc(var(--pb-panel-max-height) - 72px);
163
+ }
164
+
165
+ app-toolbar {
166
+ font-size: 75%;
167
+ }
168
+
169
+ :host(.dragover) {
170
+ background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color));
171
+ animation: highlight 1s;
172
+ }
173
+
174
+ @keyframes highlight {
175
+ from {
176
+ background-color: transparent;
87
177
  }
88
-
89
- this.addEventListener('dragover', (ev) => {
90
- ev.preventDefault();
91
- });
92
- document.addEventListener('dragenter', (ev) => {
93
- ev.stopPropagation();
94
- ev.preventDefault();
95
- if (initiator === this) {
96
- return;
97
- }
98
- if (this.contains(ev.target)) {
99
- this.classList.add('dragover');
100
- } else {
101
- this.classList.remove('dragover');
102
- }
103
- });
104
- this.addEventListener('drop', (ev) => {
105
- ev.stopPropagation();
106
- ev.preventDefault();
107
-
108
- initiator = null;
109
- this.dispatchEvent(new CustomEvent('pb-drop', {
110
- detail: {
111
- panel: ev.dataTransfer.getData("text"),
112
- target: this
113
- },
114
- bubbles: true,
115
- composed: true
116
- }));
117
- });
118
- }
119
-
120
- render() {
121
- return html`
122
- <app-toolbar id="toolbar">
123
- <paper-dropdown-menu id="menu" label="${this.label}">
124
- <paper-listbox id="panels" slot="dropdown-content" class="dropdown-content"
125
- selected="${this.active}" @selected-item-changed="${this._update}">
126
- ${this.panels.map((item) => html`<paper-item>${item}</paper-item>`)}
127
- </paper-listbox>
128
- </paper-dropdown-menu>
129
- ${this.draggable ? html`<paper-icon-button id="drag-handle" icon="icons:open-with" draggable="true"></paper-icon-button>` : ''}
130
- <slot name="toolbar"></slot>
131
- </app-toolbar>
132
- <slot></slot>
133
- `;
134
- }
135
-
136
- static get styles() {
137
- return css`
138
- :host {
139
- display: block;
140
- }
141
-
142
- app-toolbar {
143
- padding: 0;
144
- justify-content: space-between;
145
- }
146
-
147
- ::slotted(._pb_panel) {
148
- overflow: auto;
149
- max-height: calc(var(--pb-panel-max-height) - 72px);
150
- }
151
-
152
- app-toolbar {
153
- font-size: 75%;
154
- }
155
-
156
- :host(.dragover) {
157
- background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color));
158
- animation: highlight 1s;
159
- }
160
-
161
- @keyframes highlight {
162
- from {
163
- background-color: transparent;
164
- }
165
- to {
166
- background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color));
167
- }
168
- }
169
- `;
170
- }
171
-
172
- _update() {
173
- const panel = this.shadowRoot.getElementById('panels').selected;
174
- if (this.active !== panel) {
175
- this.active = panel;
176
- this._show();
178
+ to {
179
+ background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color));
177
180
  }
181
+ }
182
+ `;
183
+ }
184
+
185
+ _update() {
186
+ const panel = this.shadowRoot.getElementById('panels').selected;
187
+ if (this.active !== panel) {
188
+ this.active = panel;
189
+ this._show();
178
190
  }
191
+ }
179
192
 
180
- _show() {
181
- const templates = this.querySelectorAll('template');
182
- if (this.active >= templates.length) {
183
- this.active = templates.length - 1;
184
- }
185
- console.log('<pb-panel> showing panel %s', this.active);
186
- this.querySelectorAll('._pb_panel').forEach(div => div.style.display = 'none');
187
- const existingPanel = this.querySelector('._pb_panel' + this.active);
188
- if (existingPanel) {
189
- existingPanel.style.display = '';
190
- } else {
191
- const template = templates[this.active];
192
- const clone = document.importNode(template.content, true);
193
- const div = document.createElement('div');
194
- div.className = '_pb_panel _pb_panel' + this.active;
195
- div.appendChild(clone);
196
- this.appendChild(div);
197
-
198
- this.emitTo('pb-panel', {
199
- panel: this,
200
- active: this.active
201
- });
202
-
203
- // this.refresh();
204
- }
193
+ _show() {
194
+ const templates = this.querySelectorAll('template');
195
+ if (this.active >= templates.length) {
196
+ this.active = templates.length - 1;
205
197
  }
206
-
207
- refresh() {
208
- this.emitTo('pb-refresh', null);
198
+ console.log('<pb-panel> showing panel %s', this.active);
199
+ this.querySelectorAll('._pb_panel').forEach(div => (div.style.display = 'none'));
200
+ const existingPanel = this.querySelector(`._pb_panel${this.active}`);
201
+ if (existingPanel) {
202
+ existingPanel.style.display = '';
203
+ } else {
204
+ const template = templates[this.active];
205
+ const clone = document.importNode(template.content, true);
206
+ const div = document.createElement('div');
207
+ div.className = `_pb_panel _pb_panel${this.active}`;
208
+ div.appendChild(clone);
209
+ this.appendChild(div);
210
+
211
+ this.emitTo('pb-panel', {
212
+ panel: this,
213
+ active: this.active,
214
+ });
215
+
216
+ // this.refresh();
209
217
  }
218
+ }
210
219
 
220
+ refresh() {
221
+ this.emitTo('pb-refresh', null);
222
+ }
211
223
  }
212
- customElements.define('pb-panel', PbPanel);
224
+ customElements.define('pb-panel', PbPanel);
@@ -1,10 +1,12 @@
1
1
  import { css } from 'lit-element';
2
2
 
3
3
  export function camelize(str) {
4
- return str.replace(/(?:^\w|[A-Z]|\b\w)/g, (match, index) => {
5
- if (+match === 0) return "";
6
- return index === 0 ? match.toLowerCase() : match.toUpperCase();
7
- }).replace('-', '');
4
+ return str
5
+ .replace(/(?:^\w|[A-Z]|\b\w)/g, (match, index) => {
6
+ if (+match === 0) return '';
7
+ return index === 0 ? match.toLowerCase() : match.toUpperCase();
8
+ })
9
+ .replace('-', '');
8
10
  }
9
11
 
10
12
  export const base = `
@@ -324,4 +326,4 @@ export const translucent = `
324
326
  .tippy-box[data-theme~=translucent]>.tippy-svg-arrow {
325
327
  fill: rgba(0, 0, 0, .7)
326
328
  }
327
- `;
329
+ `;