@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-mei.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
3
- import "@lrnwebcomponents/es-global-bridge";
3
+ import '@lrnwebcomponents/es-global-bridge';
4
4
  import createVerovioModule from 'verovio/dist/verovio-module.mjs';
5
5
  import { VerovioToolkit } from 'verovio/dist/verovio.mjs';
6
6
  import { pbMixin, waitOnce } from './pb-mixin.js';
@@ -15,34 +15,30 @@ let _verovio = null;
15
15
 
16
16
  /** Import external script dynamically */
17
17
  function _import(name, location) {
18
- window.ESGlobalBridge.requestAvailability();
19
- return new Promise(resolve => {
20
- window.ESGlobalBridge.instance.load(name, location);
21
- window.addEventListener(
22
- `es-bridge-${name}-loaded`,
23
- () => resolve(),
24
- { once: true }
25
- );
26
- });
18
+ window.ESGlobalBridge.requestAvailability();
19
+ return new Promise(resolve => {
20
+ window.ESGlobalBridge.instance.load(name, location);
21
+ window.addEventListener(`es-bridge-${name}-loaded`, () => resolve(), { once: true });
22
+ });
27
23
  }
28
24
 
29
25
  /**
30
26
  * A viewer and player for MEI musical notation based on [Verovio](https://www.verovio.org/).
31
27
  * Supports optional MIDI playback using [web-midi-player](https://midi.yvesgurcan.com/).
32
28
  * Both libraries are loaded dynamically when the component is used the first time.
33
- *
29
+ *
34
30
  * Viewing options to be selected by the user can be defined via nested `pb-option` elements:
35
- *
31
+ *
36
32
  * ```html
37
- * <pb-mei id="viewer" player url="http://www.marenzio.org/mei/M-06-5/M_06_5_01_S_io_parto_i_moro_e_pur_partir_conviene.mei"
33
+ * <pb-mei id="viewer" player url="http://www.marenzio.org/mei/M-06-5/M_06_5_01_S_io_parto_i_moro_e_pur_partir_conviene.mei"
38
34
  * footer="none">
39
35
  * <pb-option name="appXPath" on="./rdg[contains(@label, 'original')]" off="">Original Clefs</pb-option>
40
36
  * </pb-mei>
41
37
  * ```
42
- *
38
+ *
43
39
  * The MEI document to display can either be given directly in the `data` property or loaded from an URL
44
40
  * specified in `url`.
45
- *
41
+ *
46
42
  * @prop {"auto" | "encoded" | "none" | "always"} footer - Control footer layout
47
43
  * @prop {"auto" | "encoded" | "none"} header - Control footer layout
48
44
  * @prop {"auto" | "none" | "line" | "encoded" | "smart"} breaks - Define page and system breaks layout (default: "auto")
@@ -51,323 +47,338 @@ function _import(name, location) {
51
47
  * @csspart music - the music output area
52
48
  */
53
49
  export class PbMei extends pbMixin(LitElement) {
50
+ static get properties() {
51
+ return {
52
+ /**
53
+ * MEI data to display specified as a string. This should represent a complete
54
+ * MEI document.
55
+ */
56
+ data: {
57
+ type: String,
58
+ },
59
+ /**
60
+ * URL of the MEI file to load. Will be used if no `data` property is present.
61
+ * A relative URL would be resolved relative to the TEI Publisher endpoint.
62
+ */
63
+ url: {
64
+ type: String,
65
+ },
66
+ /**
67
+ * Set to enable MIDI player
68
+ */
69
+ player: {
70
+ type: Boolean,
71
+ },
72
+ header: {
73
+ type: String,
74
+ },
75
+ footer: {
76
+ type: String,
77
+ },
78
+ breaks: {
79
+ type: String,
80
+ },
81
+ /**
82
+ * Set the XPath query for selecting <app> child elements, for example: "./rdg[contains(@source, 'source-id')]";
83
+ * by default the <lem> or the first <rdg> is selected
84
+ */
85
+ appXPath: {
86
+ type: String,
87
+ attribute: 'app-xpath',
88
+ },
89
+ /**
90
+ * Set the xPath query for selecting <choice> child elements, for example: "./orig"; by default the first child is selected
91
+ */
92
+ choiceXPath: {
93
+ type: String,
94
+ attribute: 'choice-xpath',
95
+ },
96
+ /**
97
+ * Set the xPath query for selecting the <mdiv> to be rendered; only one <mdiv> can be rendered (default: "")
98
+ */
99
+ mdivXPath: {
100
+ type: String,
101
+ attribute: 'mdiv-xpath',
102
+ },
103
+ /**
104
+ * Set the xPath query for selecting <subst> child elements, for example: "./del"; by default the first child is selected
105
+ */
106
+ substXPath: {
107
+ type: String,
108
+ attribute: 'subst-xpath',
109
+ },
110
+ _svg: {
111
+ type: String,
112
+ },
113
+ ...super.properties,
114
+ };
115
+ }
54
116
 
55
- static get properties() {
56
- return {
57
- /**
58
- * MEI data to display specified as a string. This should represent a complete
59
- * MEI document.
60
- */
61
- data: {
62
- type: String
63
- },
64
- /**
65
- * URL of the MEI file to load. Will be used if no `data` property is present.
66
- * A relative URL would be resolved relative to the TEI Publisher endpoint.
67
- */
68
- url: {
69
- type: String,
70
- },
71
- /**
72
- * Set to enable MIDI player
73
- */
74
- player: {
75
- type: Boolean,
76
- },
77
- header: {
78
- type: String,
79
- },
80
- footer: {
81
- type: String,
82
- },
83
- breaks: {
84
- type: String,
85
- },
86
- /**
87
- * Set the XPath query for selecting <app> child elements, for example: "./rdg[contains(@source, 'source-id')]";
88
- * by default the <lem> or the first <rdg> is selected
89
- */
90
- appXPath: {
91
- type: String,
92
- attribute: 'app-xpath',
93
- },
94
- /**
95
- * Set the xPath query for selecting <choice> child elements, for example: "./orig"; by default the first child is selected
96
- */
97
- choiceXPath: {
98
- type: String,
99
- attribute: 'choice-xpath',
100
- },
101
- /**
102
- * Set the xPath query for selecting the <mdiv> to be rendered; only one <mdiv> can be rendered (default: "")
103
- */
104
- mdivXPath: {
105
- type: String,
106
- attribute: 'mdiv-xpath',
107
- },
108
- /**
109
- * Set the xPath query for selecting <subst> child elements, for example: "./del"; by default the first child is selected
110
- */
111
- substXPath: {
112
- type: String,
113
- attribute: 'subst-xpath',
114
- },
115
- _svg: {
116
- type: String,
117
- },
118
- ...super.properties,
119
- };
120
- }
117
+ constructor() {
118
+ super();
119
+ this._data = null;
120
+ this._svg = null;
121
+ this._pages = 0;
122
+ this._page = 0;
123
+ this._midiPlayer = null;
124
+ this.footer = 'auto';
125
+ this.header = 'auto';
126
+ this.breaks = 'auto';
127
+ this.appXPath = null;
128
+ this.choiceXPath = null;
129
+ this.mdivXPath = null;
130
+ this.substXPath = null;
131
+ this._options = [];
132
+ }
121
133
 
122
- constructor() {
123
- super();
124
- this._data = null;
125
- this._svg = null;
126
- this._pages = 0;
127
- this._page = 0;
128
- this._midiPlayer = null;
129
- this.footer = 'auto';
130
- this.header = 'auto';
131
- this.breaks = 'auto';
132
- this.appXPath = null;
133
- this.choiceXPath = null;
134
- this.mdivXPath = null;
135
- this.substXPath = null;
136
- this._options = [];
137
- }
134
+ connectedCallback() {
135
+ super.connectedCallback();
138
136
 
139
- connectedCallback() {
140
- super.connectedCallback();
137
+ this.querySelectorAll('pb-option').forEach(option => {
138
+ this._options.push({
139
+ name: option.getAttribute('name'),
140
+ on: option.getAttribute('on'),
141
+ off: option.getAttribute('off'),
142
+ label: option.innerHTML,
143
+ });
144
+ });
145
+ }
141
146
 
142
- this.querySelectorAll('pb-option').forEach((option) => {
143
- this._options.push({
144
- name: option.getAttribute('name'),
145
- on: option.getAttribute('on'),
146
- off: option.getAttribute('off'),
147
- label: option.innerHTML
148
- })
149
- });
147
+ firstUpdated() {
148
+ super.firstUpdated();
149
+
150
+ if (this.player) {
151
+ _import('midiPlayer', resolveURL('../lib/web-midi-player/index.js')).then(() => {
152
+ const {
153
+ 'web-midi-player': { default: MidiPlayer },
154
+ } = window;
155
+ this._midiPlayer = new MidiPlayer();
156
+ });
150
157
  }
151
158
 
152
- firstUpdated() {
153
- super.firstUpdated();
159
+ if (!_verovio) {
160
+ createVerovioModule().then(VerovioModule => {
161
+ _verovio = new VerovioToolkit(VerovioModule);
154
162
 
155
- if (this.player) {
156
- _import("midiPlayer", resolveURL('../lib/web-midi-player/index.js'))
157
- .then(() => {
158
- const { 'web-midi-player': { default: MidiPlayer } } = window;
159
- this._midiPlayer = new MidiPlayer();
160
- });
161
- }
162
-
163
- if (!_verovio) {
164
- createVerovioModule().then(VerovioModule => {
165
- _verovio = new VerovioToolkit(VerovioModule);
166
-
167
- waitOnce('pb-page-ready', () => {
168
- this.load();
169
- });
170
- });
171
- } else {
172
- waitOnce('pb-page-ready', () => {
173
- this.load();
174
- });
175
- }
163
+ waitOnce('pb-page-ready', () => {
164
+ this.load();
165
+ });
166
+ });
167
+ } else {
168
+ waitOnce('pb-page-ready', () => {
169
+ this.load();
170
+ });
176
171
  }
172
+ }
177
173
 
178
- update(changedProps) {
179
- super.update(changedProps);
180
- if (changedProps.get('url') || changedProps.get('data')) {
181
- this.load();
182
- } else if (
183
- (changedProps.has('appXPath') ||
184
- changedProps.has('choiceXPath') ||
185
- changedProps.has('mdivXPath') ||
186
- changedProps.has('substXPath')) &&
187
- _verovio
188
- ) {
189
- _verovio.setOptions(this._getOptions());
190
- _verovio.loadData(this._data);
191
- this.showPage();
192
- }
174
+ update(changedProps) {
175
+ super.update(changedProps);
176
+ if (changedProps.get('url') || changedProps.get('data')) {
177
+ this.load();
178
+ } else if (
179
+ (changedProps.has('appXPath') ||
180
+ changedProps.has('choiceXPath') ||
181
+ changedProps.has('mdivXPath') ||
182
+ changedProps.has('substXPath')) &&
183
+ _verovio
184
+ ) {
185
+ _verovio.setOptions(this._getOptions());
186
+ _verovio.loadData(this._data);
187
+ this.showPage();
193
188
  }
189
+ }
194
190
 
195
- load() {
196
- if (this.data) {
197
- console.log('<pb-mei> Rendering data');
198
- this.show(this.data);
199
- } else if (this.url) {
200
- const link = this.toAbsoluteURL(this.url);
191
+ load() {
192
+ if (this.data) {
193
+ console.log('<pb-mei> Rendering data');
194
+ this.show(this.data);
195
+ } else if (this.url) {
196
+ const link = this.toAbsoluteURL(this.url);
201
197
 
202
- fetch(link)
203
- .then(response => response.text())
204
- .then(async str => {
205
- this.show(str);
206
- });
207
- }
198
+ fetch(link)
199
+ .then(response => response.text())
200
+ .then(async str => {
201
+ this.show(str);
202
+ });
208
203
  }
204
+ }
209
205
 
210
- show(str) {
211
- this._data = str;
212
- _verovio.setOptions(this._getOptions());
213
- _verovio.loadData(this._data);
214
- this._pages = _verovio.getPageCount();
215
- this._page = 1;
216
- console.log('<pb-mei> Loaded %d pages', this._pages);
217
- this.showPage();
218
- }
206
+ show(str) {
207
+ this._data = str;
208
+ _verovio.setOptions(this._getOptions());
209
+ _verovio.loadData(this._data);
210
+ this._pages = _verovio.getPageCount();
211
+ this._page = 1;
212
+ console.log('<pb-mei> Loaded %d pages', this._pages);
213
+ this.showPage();
214
+ }
219
215
 
220
- showPage() {
221
- this._svg = _verovio.renderToSVG(this._page, {});
222
- }
216
+ showPage() {
217
+ this._svg = _verovio.renderToSVG(this._page, {});
218
+ }
223
219
 
224
- async play() {
225
- const button = this.shadowRoot.getElementById('play');
226
- if (!button.active) {
227
- this._midiPlayer.stop();
228
- button.icon = 'av:play-arrow';
229
- } else {
230
- button.icon = 'av:stop';
231
- if (this._midiPaused) {
232
- this._midiPaused = false;
233
- this._midiPlayer.resume();
234
- } else {
235
- _verovio.loadData(this._data);
236
- const mdata = _verovio.renderToMIDI();
237
- const raw = window.atob(mdata);
238
- const rawLength = raw.length;
239
- const array = new Uint8Array(new ArrayBuffer(rawLength));
220
+ async play() {
221
+ const button = this.shadowRoot.getElementById('play');
222
+ if (!button.active) {
223
+ this._midiPlayer.stop();
224
+ button.icon = 'av:play-arrow';
225
+ } else {
226
+ button.icon = 'av:stop';
227
+ if (this._midiPaused) {
228
+ this._midiPaused = false;
229
+ this._midiPlayer.resume();
230
+ } else {
231
+ _verovio.loadData(this._data);
232
+ const mdata = _verovio.renderToMIDI();
233
+ const raw = window.atob(mdata);
234
+ const rawLength = raw.length;
235
+ const array = new Uint8Array(new ArrayBuffer(rawLength));
240
236
 
241
- for (let i = 0; i < rawLength; i += 1) {
242
- array[i] = raw.charCodeAt(i);
243
- }
244
- this._midiPlayer.play({ arrayBuffer: array });
245
- }
237
+ for (let i = 0; i < rawLength; i += 1) {
238
+ array[i] = raw.charCodeAt(i);
246
239
  }
240
+ this._midiPlayer.play({ arrayBuffer: array });
241
+ }
247
242
  }
243
+ }
248
244
 
249
- pause() {
250
- const button = this.shadowRoot.getElementById('play');
251
- if (button.active) {
252
- this._midiPaused = this._midiPlayer.pause();
253
- if (this._midiPaused) {
254
- button.icon = 'av:play-arrow';
255
- button.active = false;
256
- }
257
- }
245
+ pause() {
246
+ const button = this.shadowRoot.getElementById('play');
247
+ if (button.active) {
248
+ this._midiPaused = this._midiPlayer.pause();
249
+ if (this._midiPaused) {
250
+ button.icon = 'av:play-arrow';
251
+ button.active = false;
252
+ }
258
253
  }
254
+ }
259
255
 
260
- render() {
261
- return html`
262
- <div id="toolbar" part="toolbar">
263
- <div class="${this._pages === 1 ? 'hidden' : ''}">
264
- <paper-icon-button id="pageLeft" icon="icons:chevron-left" @click="${this._previousPage}"
265
- ?disabled="${this._page === 1}"></paper-icon-button>
266
- <paper-icon-button id="pageRight" icon="icons:chevron-right" @click="${this._nextPage}"
267
- ?disabled="${this._page === this._pages}"></paper-icon-button>
268
- </div>
269
- ${ this._renderPlayer() }
270
- <div>${ this._renderOptions() }</div>
271
- </div>
272
- ${ this._svg ?
273
- html`<div id="output" part="music">${unsafeHTML(this._svg)}</div>` :
274
- html`<div id="output" part="music">${translate('dialogs.loading')}</div>`
275
- }
276
- `;
277
- }
256
+ render() {
257
+ return html`
258
+ <div id="toolbar" part="toolbar">
259
+ <div class="${this._pages === 1 ? 'hidden' : ''}">
260
+ <paper-icon-button
261
+ id="pageLeft"
262
+ icon="icons:chevron-left"
263
+ @click="${this._previousPage}"
264
+ ?disabled="${this._page === 1}"
265
+ ></paper-icon-button>
266
+ <paper-icon-button
267
+ id="pageRight"
268
+ icon="icons:chevron-right"
269
+ @click="${this._nextPage}"
270
+ ?disabled="${this._page === this._pages}"
271
+ ></paper-icon-button>
272
+ </div>
273
+ ${this._renderPlayer()}
274
+ <div>${this._renderOptions()}</div>
275
+ </div>
276
+ ${this._svg
277
+ ? html`<div id="output" part="music">${unsafeHTML(this._svg)}</div>`
278
+ : html`<div id="output" part="music">${translate('dialogs.loading')}</div>`}
279
+ `;
280
+ }
278
281
 
279
- _renderPlayer() {
280
- if (this.player) {
281
- return html`
282
- <div id="player">
283
- <paper-icon-button id="play" icon="av:play-arrow" toggles @click="${this.play}"></paper-icon-button>
284
- <paper-icon-button icon="av:pause" @click="${this.pause}"></paper-icon-button>
285
- </div>
286
- `;
287
- }
288
- return null;
282
+ _renderPlayer() {
283
+ if (this.player) {
284
+ return html`
285
+ <div id="player">
286
+ <paper-icon-button
287
+ id="play"
288
+ icon="av:play-arrow"
289
+ toggles
290
+ @click="${this.play}"
291
+ ></paper-icon-button>
292
+ <paper-icon-button icon="av:pause" @click="${this.pause}"></paper-icon-button>
293
+ </div>
294
+ `;
289
295
  }
296
+ return null;
297
+ }
290
298
 
291
- _renderOptions() {
292
- return this._options.map(option =>
293
- html`<paper-checkbox @change="${(ev) => this._setOption(option, ev.target.checked)}">${option.label}</paper-checkbox>`
294
- );
295
- }
299
+ _renderOptions() {
300
+ return this._options.map(
301
+ option =>
302
+ html`<paper-checkbox @change="${ev => this._setOption(option, ev.target.checked)}"
303
+ >${option.label}</paper-checkbox
304
+ >`,
305
+ );
306
+ }
296
307
 
297
- _setOption(option, checked) {
298
- let value;
299
- if (checked) {
300
- value = option.on && option.on.length > 0 ? option.on : null;
301
- } else {
302
- value = option.off && option.off.length > 0 ? option.off : null;
303
- }
304
- this[option.name] = value;
308
+ _setOption(option, checked) {
309
+ let value;
310
+ if (checked) {
311
+ value = option.on && option.on.length > 0 ? option.on : null;
312
+ } else {
313
+ value = option.off && option.off.length > 0 ? option.off : null;
305
314
  }
315
+ this[option.name] = value;
316
+ }
306
317
 
307
- _nextPage(ev) {
308
- ev.preventDefault();
309
- if (this._page < this._pages) {
310
- this._page += 1;
311
- this.showPage();
312
- }
318
+ _nextPage(ev) {
319
+ ev.preventDefault();
320
+ if (this._page < this._pages) {
321
+ this._page += 1;
322
+ this.showPage();
313
323
  }
324
+ }
314
325
 
315
- _previousPage(ev) {
316
- ev.preventDefault();
317
- if (this._page > 1) {
318
- this._page -= 1;
319
- this.showPage();
320
- }
326
+ _previousPage(ev) {
327
+ ev.preventDefault();
328
+ if (this._page > 1) {
329
+ this._page -= 1;
330
+ this.showPage();
321
331
  }
332
+ }
322
333
 
323
- _getOptions() {
324
- const options = {
325
- // svg content should scale with the width of the component
326
- svgViewBox: true,
327
- adjustPageHeight: true,
328
- footer: this.footer,
329
- header: this.header,
330
- breaks: this.breaks,
331
- appXPathQuery: [this.appXPath],
332
- substXPathQuery: [this.substXPath],
333
- choiceXPathQuery: [this.choiceXPath]
334
- };
335
- if (this.mdivXPath) {
336
- options.mdivXPathQuery = this.mdivXPath;
337
- }
338
- return options;
334
+ _getOptions() {
335
+ const options = {
336
+ // svg content should scale with the width of the component
337
+ svgViewBox: true,
338
+ adjustPageHeight: true,
339
+ footer: this.footer,
340
+ header: this.header,
341
+ breaks: this.breaks,
342
+ appXPathQuery: [this.appXPath],
343
+ substXPathQuery: [this.substXPath],
344
+ choiceXPathQuery: [this.choiceXPath],
345
+ };
346
+ if (this.mdivXPath) {
347
+ options.mdivXPathQuery = this.mdivXPath;
339
348
  }
349
+ return options;
350
+ }
340
351
 
341
- static get styles() {
342
- return css`
343
- :host {
344
- display: grid;
345
- grid-template-rows: auto 1fr;
346
- min-width: var(--pb-mei-min-width, auto);
347
- }
352
+ static get styles() {
353
+ return css`
354
+ :host {
355
+ display: grid;
356
+ grid-template-rows: auto 1fr;
357
+ min-width: var(--pb-mei-min-width, auto);
358
+ }
348
359
 
349
- #toolbar {
350
- display: flex;
351
- align-items: center;
352
- }
360
+ #toolbar {
361
+ display: flex;
362
+ align-items: center;
363
+ }
353
364
 
354
- #toolbar div {
355
- margin-right: 1rem;
356
- }
365
+ #toolbar div {
366
+ margin-right: 1rem;
367
+ }
357
368
 
358
- #toolbar div:last-child {
359
- margin-right: 0;
360
- }
369
+ #toolbar div:last-child {
370
+ margin-right: 0;
371
+ }
361
372
 
362
- #output {
363
- width: 100%;
364
- overflow: auto;
365
- }
373
+ #output {
374
+ width: 100%;
375
+ overflow: auto;
376
+ }
366
377
 
367
- .hidden {
368
- display: none;
369
- }
370
- `;
371
- }
378
+ .hidden {
379
+ display: none;
380
+ }
381
+ `;
382
+ }
372
383
  }
373
- customElements.define('pb-mei', PbMei);
384
+ customElements.define('pb-mei', PbMei);