@teipublisher/pb-components 2.26.0-next-3.12 → 2.26.0-next-3.14

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 (136) 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 +43 -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-grid.html +19 -6
  9. package/dist/demo/pb-leaflet-map.html +1 -1
  10. package/dist/demo/pb-progress.html +2 -2
  11. package/dist/demo/pb-repeat.html +1 -3
  12. package/dist/demo/pb-view3.html +1 -1
  13. package/dist/{iron-form-277f9d42.js → iron-form-78b43d38.js} +1 -1
  14. package/dist/{paper-checkbox-4f410b1f.js → paper-checkbox-d16f23be.js} +44 -44
  15. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-2cd9e0b4.js} +3 -3
  16. package/dist/{paper-listbox-c2468542.js → paper-listbox-2ad5c882.js} +7 -7
  17. package/dist/pb-code-editor.js +25 -20
  18. package/dist/pb-component-docs.js +58 -54
  19. package/dist/pb-components-bundle.js +2057 -2351
  20. package/dist/pb-edit-app.js +167 -107
  21. package/dist/pb-elements.json +45 -45
  22. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  23. package/dist/pb-leaflet-map.js +23 -23
  24. package/dist/pb-mei.js +56 -41
  25. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  26. package/dist/pb-odd-editor.js +923 -756
  27. package/dist/pb-tify.js +2 -2
  28. package/dist/{vaadin-element-mixin-49ab4037.js → vaadin-element-mixin-c200b196.js} +179 -164
  29. package/gh-pages.js +5 -3
  30. package/i18n/common/pl.json +2 -2
  31. package/lib/openseadragon.min.js +1 -1
  32. package/package.json +2 -2
  33. package/pb-elements.json +45 -45
  34. package/src/assets/components.css +5 -5
  35. package/src/authority/airtable.js +20 -21
  36. package/src/authority/anton.js +129 -129
  37. package/src/authority/custom.js +23 -21
  38. package/src/authority/geonames.js +38 -32
  39. package/src/authority/gnd.js +47 -42
  40. package/src/authority/kbga.js +137 -134
  41. package/src/authority/metagrid.js +44 -46
  42. package/src/authority/reconciliation.js +66 -67
  43. package/src/authority/registry.js +4 -4
  44. package/src/docs/pb-component-docs.js +2 -2
  45. package/src/docs/pb-component-view.js +5 -5
  46. package/src/docs/pb-components-list.js +2 -2
  47. package/src/docs/pb-demo-snippet.js +2 -2
  48. package/src/dts-client.js +299 -297
  49. package/src/dts-select-endpoint.js +90 -82
  50. package/src/parse-date-service.js +184 -135
  51. package/src/pb-ajax.js +150 -146
  52. package/src/pb-authority-lookup.js +183 -146
  53. package/src/pb-autocomplete.js +292 -280
  54. package/src/pb-blacklab-highlight.js +264 -259
  55. package/src/pb-blacklab-results.js +236 -221
  56. package/src/pb-browse-docs.js +540 -475
  57. package/src/pb-browse.js +68 -65
  58. package/src/pb-clipboard.js +79 -76
  59. package/src/pb-code-editor.js +110 -102
  60. package/src/pb-code-highlight.js +209 -204
  61. package/src/pb-codepen.js +79 -72
  62. package/src/pb-collapse.js +212 -207
  63. package/src/pb-combo-box.js +190 -190
  64. package/src/pb-components-bundle.js +1 -1
  65. package/src/pb-custom-form.js +151 -149
  66. package/src/pb-dialog.js +94 -85
  67. package/src/pb-document.js +89 -90
  68. package/src/pb-download.js +210 -198
  69. package/src/pb-drawer.js +145 -148
  70. package/src/pb-edit-app.js +301 -229
  71. package/src/pb-edit-xml.js +98 -96
  72. package/src/pb-events.js +114 -107
  73. package/src/pb-facs-link.js +104 -102
  74. package/src/pb-facsimile.js +419 -414
  75. package/src/pb-formula.js +151 -153
  76. package/src/pb-geolocation.js +129 -131
  77. package/src/pb-grid-action.js +53 -56
  78. package/src/pb-grid.js +231 -228
  79. package/src/pb-highlight.js +140 -140
  80. package/src/pb-hotkeys.js +40 -42
  81. package/src/pb-i18n.js +101 -104
  82. package/src/pb-image-strip.js +84 -78
  83. package/src/pb-lang.js +132 -128
  84. package/src/pb-leaflet-map.js +488 -485
  85. package/src/pb-link.js +126 -124
  86. package/src/pb-load.js +431 -426
  87. package/src/pb-login.js +291 -248
  88. package/src/pb-manage-odds.js +364 -318
  89. package/src/pb-map-icon.js +89 -89
  90. package/src/pb-map-layer.js +85 -85
  91. package/src/pb-markdown.js +90 -99
  92. package/src/pb-media-query.js +74 -72
  93. package/src/pb-mei.js +306 -295
  94. package/src/pb-message.js +144 -144
  95. package/src/pb-mixin.js +269 -264
  96. package/src/pb-navigation.js +80 -82
  97. package/src/pb-observable.js +38 -38
  98. package/src/pb-odd-editor.js +1053 -955
  99. package/src/pb-odd-elementspec-editor.js +348 -297
  100. package/src/pb-odd-model-editor.js +1061 -901
  101. package/src/pb-odd-parameter-editor.js +200 -178
  102. package/src/pb-odd-rendition-editor.js +136 -124
  103. package/src/pb-page.js +431 -421
  104. package/src/pb-paginate.js +202 -190
  105. package/src/pb-panel.js +198 -182
  106. package/src/pb-popover-themes.js +7 -5
  107. package/src/pb-popover.js +296 -287
  108. package/src/pb-print-preview.js +127 -127
  109. package/src/pb-progress.js +51 -51
  110. package/src/pb-repeat.js +105 -104
  111. package/src/pb-restricted.js +84 -77
  112. package/src/pb-search.js +252 -241
  113. package/src/pb-select-feature.js +127 -120
  114. package/src/pb-select-odd.js +132 -124
  115. package/src/pb-select-template.js +89 -78
  116. package/src/pb-select.js +251 -227
  117. package/src/pb-split-list.js +179 -174
  118. package/src/pb-svg.js +80 -79
  119. package/src/pb-table-column.js +54 -54
  120. package/src/pb-table-grid.js +221 -203
  121. package/src/pb-tabs.js +61 -63
  122. package/src/pb-tify.js +154 -154
  123. package/src/pb-timeline.js +271 -229
  124. package/src/pb-toggle-feature.js +182 -175
  125. package/src/pb-upload.js +184 -174
  126. package/src/pb-version.js +30 -30
  127. package/src/pb-view-annotate.js +132 -98
  128. package/src/pb-view.js +1290 -1270
  129. package/src/pb-zoom.js +75 -59
  130. package/src/polymer-hack.js +1 -1
  131. package/src/search-result-service.js +256 -223
  132. package/src/seed-element.js +13 -20
  133. package/src/settings.js +4 -4
  134. package/src/theming.js +96 -96
  135. package/src/urls.js +289 -289
  136. package/src/utils.js +53 -51
package/src/pb-panel.js CHANGED
@@ -1,10 +1,7 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { pbMixin } from './pb-mixin.js';
3
3
  import './pb-view.js';
4
- import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
5
- import '@polymer/paper-listbox';
6
- import '@polymer/paper-item';
7
- import '@polymer/app-layout';
4
+ import { themableMixin } from './theming.js';
8
5
 
9
6
  /**
10
7
  * A container for different views. Only one view will be shown at a time.
@@ -19,194 +16,213 @@ import '@polymer/app-layout';
19
16
  * @fires pb-refresh - Fired after a new content panel is shown to allow connected components to refresh.
20
17
  * @cssprop --pb-panel-max-height - The max height of the panel content. Set to enable scrolling.
21
18
  */
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
- };
19
+ export class PbPanel extends themableMixin(pbMixin(LitElement)) {
20
+
21
+ static get properties() {
22
+ return {
23
+ ...super.properties,
24
+ /**
25
+ * the index of the active view
26
+ */
27
+ active: {
28
+ type: Number,
29
+ reflect: true,
30
+ },
31
+ /**
32
+ * the label displayed above the dropdown for selecting the view to show
33
+ */
34
+ label: {
35
+ type: String,
36
+ },
37
+ /**
38
+ * a name for each available panel, to be displayed in the dropdown. If not set,
39
+ * each template will be checked for a title attribute, which will be taken as name.
40
+ */
41
+ panels: {
42
+ type: Array,
43
+ reflect: true,
44
+ },
45
+ /**
46
+ * if set, the panel can be dragged to another position in the grid. A button will
47
+ * be added to the toolbar to allow dragging.
48
+ */
49
+ draggable: {
50
+ type: Boolean,
51
+ },
52
+ };
53
+ }
54
+
55
+ constructor() {
56
+ super();
57
+ this.active = 0;
58
+ this.label = 'View';
59
+ this.panels = null;
60
+ this.position = -1;
61
+ this.draggable = false;
62
+ }
63
+
64
+ connectedCallback() {
65
+ super.connectedCallback();
66
+
67
+ if (!this.panels) {
68
+ const titles = [];
69
+ this.querySelectorAll('template').forEach(template => titles.push(template.title));
70
+ this.panels = titles;
55
71
  }
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;
72
+ this._show();
73
+ }
74
+
75
+ firstUpdated() {
76
+ const dragHandle = this.shadowRoot.querySelector('button[draggable="true"]');
77
+ let initiator = null;
78
+
79
+ if (this.draggable) {
80
+ dragHandle.addEventListener('dragstart', ev => {
81
+ ev.dataTransfer.setDragImage(this, 10, 10);
82
+ ev.dataTransfer.setData('text', this.position);
83
+ initiator = this;
84
+ });
64
85
  }
65
86
 
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;
87
+ this.addEventListener('dragover', ev => {
88
+ ev.preventDefault();
89
+ });
90
+ document.addEventListener('dragenter', ev => {
91
+ ev.stopPropagation();
92
+ ev.preventDefault();
93
+ if (initiator === this) {
94
+ return;
95
+ }
96
+ if (this.contains(ev.target)) {
97
+ this.classList.add('dragover');
98
+ } else {
99
+ this.classList.remove('dragover');
100
+ }
101
+ });
102
+ this.addEventListener('drop', ev => {
103
+ ev.stopPropagation();
104
+ ev.preventDefault();
105
+
106
+ initiator = null;
107
+ this.dispatchEvent(
108
+ new CustomEvent('pb-drop', {
109
+ detail: {
110
+ panel: ev.dataTransfer.getData('text'),
111
+ target: this,
112
+ },
113
+ bubbles: true,
114
+ composed: true,
115
+ }),
116
+ );
117
+ });
118
+ }
119
+
120
+ render() {
121
+ return html`
122
+ <nav>
123
+ <ul>
124
+ <li>
125
+ <select name="panels" class="dropdown" @change="${this._update}">
126
+ ${ this.panels.map((item, index) => html`<option value="${index}" ?selected=${index === this.active}>${item}</option>`) }
127
+ </select>
128
+ </li>
129
+ </ul>
130
+ <ul>
131
+ ${this.draggable
132
+ ? html`
133
+ <li>
134
+ <button draggable="true">
135
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrows-move" viewBox="0 0 16 16">
136
+ <path fill-rule="evenodd" d="M7.646.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1-.708.708L8.5 1.707V5.5a.5.5 0 0 1-1 0V1.707L6.354 2.854a.5.5 0 1 1-.708-.708zM8 10a.5.5 0 0 1 .5.5v3.793l1.146-1.147a.5.5 0 0 1 .708.708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 0 1 .708-.708L7.5 14.293V10.5A.5.5 0 0 1 8 10M.146 8.354a.5.5 0 0 1 0-.708l2-2a.5.5 0 1 1 .708.708L1.707 7.5H5.5a.5.5 0 0 1 0 1H1.707l1.147 1.146a.5.5 0 0 1-.708.708zM10 8a.5.5 0 0 1 .5-.5h3.793l-1.147-1.146a.5.5 0 0 1 .708-.708l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L14.293 8.5H10.5A.5.5 0 0 1 10 8"/>
137
+ </svg>
138
+ </button>
139
+ </li>`
140
+ : ''}
141
+ <slot name="toolbar"></slot>
142
+ </ul>
143
+ </nav>
144
+ <slot></slot>
145
+ `;
146
+ }
147
+
148
+ static get styles() {
149
+ return css`
150
+ :host {
151
+ display: block;
152
+ }
153
+
154
+ nav, nav ul {
155
+ display: flex;
156
+ padding: 0;
157
+ justify-content: space-between;
158
+ align-items: center;
159
+ column-gap: 1rem;
160
+ }
161
+
162
+ nav ul, nav ul li {
163
+ list-style: none;
164
+ margin: 0;
165
+ padding: 0;
166
+ }
167
+
168
+ ::slotted(._pb_panel) {
169
+ overflow: auto;
170
+ max-height: calc(var(--pb-panel-max-height) - 72px);
171
+ }
172
+
173
+ :host(.dragover) {
174
+ background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color));
175
+ animation: highlight 1s;
176
+ }
177
+
178
+ @keyframes highlight {
179
+ from {
180
+ background-color: transparent;
73
181
  }
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
- });
182
+ to {
183
+ background-color: var(--pb-grid-highlight-color, var(--pb-highlight-color));
87
184
  }
185
+ }
186
+ `;
187
+ }
88
188
 
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
- }
189
+ _update() {
190
+ const panel = this.shadowRoot.querySelector('[name="panels"]').value;
191
+ if (this.active !== panel) {
192
+ this.active = panel;
193
+ this._show();
135
194
 
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
- `;
195
+ this.refresh();
170
196
  }
197
+ }
171
198
 
172
- _update() {
173
- const panel = this.shadowRoot.getElementById('panels').selected;
174
- if (this.active !== panel) {
175
- this.active = panel;
176
- this._show();
177
- }
199
+ _show() {
200
+ const templates = this.querySelectorAll('template');
201
+ if (this.active >= templates.length) {
202
+ this.active = templates.length - 1;
178
203
  }
179
-
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
- }
205
- }
206
-
207
- refresh() {
208
- this.emitTo('pb-refresh', null);
204
+ console.log('<pb-panel> showing panel %s', this.active);
205
+ // Close other panels
206
+ for (const panel of this.querySelectorAll('._pb_panel')) {
207
+ panel.remove();
209
208
  }
210
209
 
210
+ // Open the correct one
211
+ const template = templates[this.active];
212
+ const clone = document.importNode(template.content, true);
213
+ const div = document.createElement('div');
214
+ div.className = `_pb_panel _pb_panel${this.active}`;
215
+ div.appendChild(clone);
216
+ this.appendChild(div);
217
+
218
+ this.emitTo('pb-panel', {
219
+ panel: this,
220
+ active: this.active
221
+ });
222
+ }
223
+
224
+ refresh() {
225
+ this.emitTo('pb-refresh', null);
226
+ }
211
227
  }
212
- customElements.define('pb-panel', PbPanel);
228
+ 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
+ `;