@teipublisher/pb-components 2.26.1-next.3 → 3.0.0

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 (154) 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 +2 -2
  5. package/CHANGELOG.md +262 -11
  6. package/Dockerfile +78 -70
  7. package/css/components.css +5 -5
  8. package/css/leaflet/images/layers.png +0 -0
  9. package/dist/demo/components.css +46 -1
  10. package/dist/demo/pb-browse-docs2.html +1 -1
  11. package/dist/demo/pb-dialog.html +3 -5
  12. package/dist/demo/pb-drawer2.html +1 -1
  13. package/dist/demo/pb-facsimile.html +2 -2
  14. package/dist/demo/pb-grid.html +19 -6
  15. package/dist/demo/pb-leaflet-map.html +1 -1
  16. package/dist/demo/pb-login.html +0 -2
  17. package/dist/demo/pb-message.html +1 -2
  18. package/dist/demo/pb-progress.html +2 -2
  19. package/dist/demo/pb-repeat.html +1 -3
  20. package/dist/demo/pb-search.html +7 -4
  21. package/dist/demo/pb-search3.html +1 -1
  22. package/dist/demo/pb-search4.html +2 -2
  23. package/dist/demo/pb-view3.html +1 -1
  24. package/dist/{iron-form-3b8dcaa7.js → iron-form-dfb3e3b1.js} +95 -95
  25. package/dist/paper-checkbox-645e1077.js +200 -0
  26. package/dist/{paper-icon-button-b1d31571.js → paper-icon-button-984162bd.js} +1 -1
  27. package/dist/{paper-checkbox-515a5284.js → paper-inky-focus-behavior-fa16796b.js} +58 -247
  28. package/dist/{paper-listbox-a3b7175c.js → paper-listbox-5f5d1cec.js} +152 -162
  29. package/dist/pb-code-editor.js +25 -20
  30. package/dist/pb-component-docs.js +68 -64
  31. package/dist/pb-components-bundle.js +1983 -2293
  32. package/dist/pb-edit-app.js +167 -107
  33. package/dist/pb-elements.json +176 -120
  34. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  35. package/dist/pb-leaflet-map.js +23 -23
  36. package/dist/pb-mei.js +56 -41
  37. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  38. package/dist/pb-odd-editor.js +1023 -782
  39. package/dist/pb-tify.js +2 -2
  40. package/dist/vaadin-element-mixin-beb74ffd.js +545 -0
  41. package/gh-pages.js +5 -3
  42. package/i18n/common/en.json +6 -0
  43. package/i18n/common/pl.json +2 -2
  44. package/lib/openseadragon.min.js +6 -6
  45. package/package.json +3 -3
  46. package/pb-elements.json +176 -120
  47. package/src/assets/components.css +5 -5
  48. package/src/authority/airtable.js +20 -21
  49. package/src/authority/anton.js +129 -129
  50. package/src/authority/custom.js +23 -21
  51. package/src/authority/geonames.js +38 -32
  52. package/src/authority/gnd.js +50 -42
  53. package/src/authority/kbga.js +137 -134
  54. package/src/authority/metagrid.js +44 -46
  55. package/src/authority/reconciliation.js +66 -67
  56. package/src/authority/registry.js +4 -4
  57. package/src/docs/pb-component-docs.js +2 -2
  58. package/src/docs/pb-component-view.js +5 -5
  59. package/src/docs/pb-components-list.js +2 -2
  60. package/src/docs/pb-demo-snippet.js +2 -2
  61. package/src/dts-client.js +299 -297
  62. package/src/dts-select-endpoint.js +90 -82
  63. package/src/parse-date-service.js +184 -135
  64. package/src/pb-ajax.js +158 -171
  65. package/src/pb-authority-lookup.js +191 -156
  66. package/src/pb-autocomplete.js +292 -280
  67. package/src/pb-blacklab-highlight.js +264 -259
  68. package/src/pb-blacklab-results.js +236 -221
  69. package/src/pb-browse-docs.js +540 -475
  70. package/src/pb-browse.js +68 -65
  71. package/src/pb-clipboard.js +79 -76
  72. package/src/pb-code-editor.js +110 -102
  73. package/src/pb-code-highlight.js +209 -204
  74. package/src/pb-codepen.js +79 -72
  75. package/src/pb-collapse.js +211 -151
  76. package/src/pb-combo-box.js +190 -190
  77. package/src/pb-components-bundle.js +1 -1
  78. package/src/pb-components.js +1 -0
  79. package/src/pb-custom-form.js +173 -153
  80. package/src/pb-dialog.js +98 -62
  81. package/src/pb-document.js +89 -90
  82. package/src/pb-download.js +212 -196
  83. package/src/pb-drawer.js +145 -148
  84. package/src/pb-edit-app.js +301 -229
  85. package/src/pb-edit-xml.js +100 -97
  86. package/src/pb-events.js +114 -107
  87. package/src/pb-facs-link.js +104 -102
  88. package/src/pb-facsimile.js +474 -410
  89. package/src/pb-formula.js +151 -153
  90. package/src/pb-geolocation.js +129 -131
  91. package/src/pb-grid-action.js +53 -56
  92. package/src/pb-grid.js +231 -228
  93. package/src/pb-highlight.js +140 -140
  94. package/src/pb-hotkeys.js +40 -42
  95. package/src/pb-i18n.js +101 -104
  96. package/src/pb-image-strip.js +84 -78
  97. package/src/pb-lang.js +142 -57
  98. package/src/pb-leaflet-map.js +488 -485
  99. package/src/pb-link.js +126 -124
  100. package/src/pb-load.js +431 -429
  101. package/src/pb-login.js +299 -244
  102. package/src/pb-manage-odds.js +352 -336
  103. package/src/pb-map-icon.js +89 -89
  104. package/src/pb-map-layer.js +85 -85
  105. package/src/pb-markdown.js +90 -99
  106. package/src/pb-media-query.js +74 -72
  107. package/src/pb-mei.js +306 -295
  108. package/src/pb-message.js +139 -97
  109. package/src/pb-mixin.js +269 -264
  110. package/src/pb-navigation.js +80 -95
  111. package/src/pb-observable.js +38 -38
  112. package/src/pb-odd-editor.js +1054 -958
  113. package/src/pb-odd-elementspec-editor.js +349 -298
  114. package/src/pb-odd-model-editor.js +1075 -909
  115. package/src/pb-odd-parameter-editor.js +200 -178
  116. package/src/pb-odd-rendition-editor.js +136 -124
  117. package/src/pb-page.js +431 -422
  118. package/src/pb-paginate.js +228 -179
  119. package/src/pb-panel.js +198 -182
  120. package/src/pb-popover-themes.js +15 -8
  121. package/src/pb-popover.js +296 -287
  122. package/src/pb-print-preview.js +127 -127
  123. package/src/pb-progress.js +51 -51
  124. package/src/pb-repeat.js +105 -104
  125. package/src/pb-restricted.js +84 -77
  126. package/src/pb-search.js +256 -228
  127. package/src/pb-select-feature.js +127 -120
  128. package/src/pb-select-odd.js +132 -124
  129. package/src/pb-select-template.js +89 -78
  130. package/src/pb-select.js +251 -227
  131. package/src/pb-split-list.js +179 -174
  132. package/src/pb-svg.js +80 -79
  133. package/src/pb-table-column.js +54 -54
  134. package/src/pb-table-grid.js +221 -203
  135. package/src/pb-tabs.js +61 -63
  136. package/src/pb-tify.js +154 -154
  137. package/src/pb-timeline.js +382 -249
  138. package/src/pb-toggle-feature.js +195 -187
  139. package/src/pb-upload.js +184 -174
  140. package/src/pb-version.js +30 -30
  141. package/src/pb-view-annotate.js +135 -98
  142. package/src/pb-view.js +1282 -1270
  143. package/src/pb-zoom.js +127 -45
  144. package/src/polymer-hack.js +1 -1
  145. package/src/search-result-service.js +256 -223
  146. package/src/seed-element.js +13 -20
  147. package/src/settings.js +4 -4
  148. package/src/theming.js +98 -91
  149. package/src/urls.js +289 -289
  150. package/src/utils.js +53 -51
  151. package/css/pb-styles.css +0 -51
  152. package/dist/vaadin-element-mixin-fe4a4883.js +0 -527
  153. package/src/assets/pb-styles.css +0 -51
  154. package/src/pb-light-dom.js +0 -41
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 = `
@@ -26,13 +28,18 @@ export const base = `
26
28
  background-color: #333;
27
29
  color: #fff;
28
30
  border-radius: 4px;
29
- font-size: var(--pb-popover-font-size, var(--pb-base-font-size, 14px));
30
- line-height: var(--pb-popover-line-height, var(--pb-base-line-height, 1.4));
31
+ font-size: clamp(
32
+ calc(var(--pb-popover-font-size, 1rem) * var(--pb-min-zoom, 0.5)),
33
+ calc(var(--pb-popover-font-size, 1rem) * var(--pb-zoom-factor)),
34
+ calc(var(--pb-popover-font-size, 1rem) * var(--pb-max-zoom, 3.0))
35
+ );
36
+ line-height: calc(var(--pb-popover-line-height, 1.5) * var(--pb-zoom-factor));
37
+
31
38
  text-align: left;
32
39
  font-style: normal;
33
40
  font-weight: normal;
34
41
  outline: 0;
35
- transition-property: transform, visibility, opacity
42
+ transition-property: transform, visibility, opacity;
36
43
  }
37
44
 
38
45
  .tippy-box[data-placement^=top]>.tippy-arrow {
@@ -324,4 +331,4 @@ export const translucent = `
324
331
  .tippy-box[data-theme~=translucent]>.tippy-svg-arrow {
325
332
  fill: rgba(0, 0, 0, .7)
326
333
  }
327
- `;
334
+ `;