@teipublisher/pb-components 2.26.1-next.2 → 3.0.0-next-4.1
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.
- package/.github/workflows/docker-cypress.yml +54 -0
- package/.github/workflows/main.yml +6 -4
- package/.github/workflows/node.js.yml +56 -21
- package/.github/workflows/release.js.yml +19 -17
- package/.releaserc.json +1 -1
- package/CHANGELOG.md +351 -9
- package/Dockerfile +78 -70
- package/README.md +112 -4
- package/css/components.css +5 -5
- package/css/gridjs/mermaid.min.css +1 -1
- package/css/leaflet/Control.Geocoder.css +1 -126
- package/css/leaflet/images/layers.png +0 -0
- package/css/tify/tify.css +6 -5
- package/css/tom-select/tom-select.bootstrap4.min.css +1 -1
- package/css/tom-select/tom-select.bootstrap5.min.css +1 -1
- package/css/tom-select/tom-select.default.min.css +1 -1
- package/css/tom-select/tom-select.default.min.css.map +1 -0
- package/css/tom-select/tom-select.min.css +1 -1
- package/cypress.config.js +84 -0
- package/dist/api.html +1 -1
- package/dist/css/design-system.css +607 -0
- package/dist/demo/bundle-test.html +4 -3
- package/dist/demo/components.css +46 -1
- package/dist/demo/design-system.html +710 -0
- package/dist/demo/dts-client.html +2 -2
- package/dist/demo/pb-autocomplete.html +23 -11
- package/dist/demo/pb-autocomplete2.html +66 -55
- package/dist/demo/pb-autocomplete3.html +17 -8
- package/dist/demo/pb-blacklab-highlight.html +28 -11
- package/dist/demo/pb-blacklab-results.html +3 -2
- package/dist/demo/pb-browse-docs.html +24 -24
- package/dist/demo/pb-browse-docs2.html +3 -3
- package/dist/demo/pb-clipboard.html +32 -28
- package/dist/demo/pb-code-editor.html +6 -6
- package/dist/demo/pb-code-highlight.html +63 -63
- package/dist/demo/pb-codepen.html +1 -1
- package/dist/demo/pb-collapse.html +1 -1
- package/dist/demo/pb-collapse2.html +2 -2
- package/dist/demo/pb-combo-box.html +135 -130
- package/dist/demo/pb-custom-form.html +64 -55
- package/dist/demo/pb-dialog.html +12 -6
- package/dist/demo/pb-document.html +1 -1
- package/dist/demo/pb-download.html +68 -59
- package/dist/demo/pb-drawer.html +67 -46
- package/dist/demo/pb-drawer2.html +65 -58
- package/dist/demo/pb-edit-app.html +2 -2
- package/dist/demo/pb-edit-xml.html +1 -1
- package/dist/demo/pb-facsimile-2.html +26 -11
- package/dist/demo/pb-facsimile-3.html +25 -10
- package/dist/demo/pb-facsimile-dedup-test-2.html +48 -0
- package/dist/demo/pb-facsimile-dedup-test.html +48 -0
- package/dist/demo/pb-facsimile.html +4 -4
- package/dist/demo/pb-formula.html +1 -1
- package/dist/demo/pb-grid.html +22 -8
- package/dist/demo/pb-highlight.html +2 -2
- package/dist/demo/pb-i18n-simple.html +1 -0
- package/dist/demo/pb-i18n.html +15 -5
- package/dist/demo/pb-image-strip-standalone.html +2 -2
- package/dist/demo/pb-image-strip-view.html +2 -2
- package/dist/demo/pb-leaflet-map.html +3 -3
- package/dist/demo/pb-leaflet-map2.html +2 -2
- package/dist/demo/pb-leaflet-map3.html +3 -3
- package/dist/demo/pb-link.html +1 -1
- package/dist/demo/pb-load.html +2 -6
- package/dist/demo/pb-login.html +1 -3
- package/dist/demo/pb-manage-odds.html +9 -4
- package/dist/demo/pb-markdown.html +1 -1
- package/dist/demo/pb-media-query.html +2 -2
- package/dist/demo/pb-mei.html +2 -2
- package/dist/demo/pb-mei2.html +2 -2
- package/dist/demo/pb-message.html +2 -3
- package/dist/demo/pb-odd-editor.html +54 -52
- package/dist/demo/pb-page-header.html +27 -0
- package/dist/demo/pb-popover.html +1 -1
- package/dist/demo/pb-print-preview.html +2 -2
- package/dist/demo/pb-progress.html +4 -4
- package/dist/demo/pb-repeat.html +32 -36
- package/dist/demo/pb-search.html +16 -5
- package/dist/demo/pb-search2.html +4 -4
- package/dist/demo/pb-search3.html +3 -3
- package/dist/demo/pb-search4.html +3 -3
- package/dist/demo/pb-select-feature.html +4 -4
- package/dist/demo/pb-select-feature2.html +4 -4
- package/dist/demo/pb-select-feature3.html +2 -2
- package/dist/demo/pb-select-i18n.html +58 -53
- package/dist/demo/pb-select-odd.html +1 -1
- package/dist/demo/pb-select.html +190 -75
- package/dist/demo/pb-select2.html +91 -37
- package/dist/demo/pb-select3.html +109 -41
- package/dist/demo/pb-svg.html +1 -1
- package/dist/demo/pb-table-grid.html +26 -15
- package/dist/demo/pb-tabs.html +15 -7
- package/dist/demo/pb-tify.html +7 -7
- package/dist/demo/pb-timeline.html +1 -1
- package/dist/demo/pb-timeline2.html +1 -1
- package/dist/demo/pb-toggle-feature.html +26 -23
- package/dist/demo/pb-toggle-feature2.html +4 -4
- package/dist/demo/pb-toggle-feature3.html +2 -2
- package/dist/demo/pb-toggle-feature4.html +56 -54
- package/dist/demo/pb-version.html +2 -2
- package/dist/demo/pb-view.html +78 -40
- package/dist/demo/pb-view2.html +69 -46
- package/dist/demo/pb-view3.html +53 -48
- package/dist/demo/pb-view4.html +70 -49
- package/dist/demo/pb-zoom.html +2 -2
- package/dist/{es-global-bridge-d8ce175d.js → es-global-bridge-D8ZcUcx_.js} +0 -4
- package/dist/focus-mixin-VCsFap6b.js +768 -0
- package/dist/images/icons.svg +217 -0
- package/dist/jinn-codemirror-DETLdm08.js +1 -0
- package/dist/lib/openseadragon.min.js +80 -0
- package/dist/lib/openseadragon.min.js.map +1 -0
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +414 -3225
- package/dist/pb-components-bundle.js +3046 -4402
- package/dist/pb-dialog-tklYGWfc.js +121 -0
- package/dist/pb-edit-app.js +208 -107
- package/dist/pb-elements.json +716 -249
- package/dist/pb-facsimile.js +46 -0
- package/dist/pb-i18n-C0NDma4h.js +1 -0
- package/dist/pb-leaflet-map.js +23 -23
- package/dist/pb-mei.js +152 -134
- package/dist/pb-mixin-DHoWQheB.js +1 -0
- package/dist/pb-odd-editor.js +1671 -1231
- package/dist/pb-tify.js +1 -27
- package/dist/unsafe-html-D5VGo9Oq.js +1 -0
- package/dist/urls-BEONu_g4.js +1 -0
- package/eslint.config.mjs +92 -0
- package/gh-pages.js +5 -3
- package/i18n/common/en.json +6 -0
- package/i18n/common/pl.json +2 -2
- package/images/icons.svg +217 -0
- package/index.html +0 -5
- package/lib/leaflet-src.js.map +1 -0
- package/lib/leaflet.markercluster-src.js.map +1 -0
- package/lib/openseadragon.min.js +6 -6
- package/package.json +56 -81
- package/pb-elements.json +716 -249
- package/rollup.config.mjs +312 -0
- package/src/assets/components.css +5 -5
- package/src/assets/design-system.css +607 -0
- package/src/authority/airtable.js +20 -21
- package/src/authority/anton.js +129 -129
- package/src/authority/custom.js +70 -27
- package/src/authority/geonames.js +38 -32
- package/src/authority/gnd.js +50 -42
- package/src/authority/kbga.js +136 -134
- package/src/authority/metagrid.js +44 -46
- package/src/authority/reconciliation.js +66 -68
- package/src/authority/registry.js +4 -4
- package/src/docs/demo-utils.js +91 -0
- package/src/docs/pb-component-docs.js +287 -147
- package/src/docs/pb-component-view.js +380 -273
- package/src/docs/pb-components-list.js +115 -51
- package/src/docs/pb-demo-snippet.js +199 -174
- package/src/dts-client.js +306 -303
- package/src/dts-select-endpoint.js +125 -85
- package/src/parse-date-service.js +184 -135
- package/src/pb-ajax.js +175 -173
- package/src/pb-authority-lookup.js +198 -158
- package/src/pb-autocomplete.js +731 -313
- package/src/pb-blacklab-highlight.js +266 -260
- package/src/pb-blacklab-results.js +230 -225
- package/src/pb-browse-docs.js +601 -484
- package/src/pb-browse.js +68 -65
- package/src/pb-clipboard.js +97 -76
- package/src/pb-code-editor.js +111 -103
- package/src/pb-code-highlight.js +234 -204
- package/src/pb-codepen.js +81 -73
- package/src/pb-collapse.js +265 -152
- package/src/pb-combo-box.js +191 -191
- package/src/pb-components-bundle.js +1 -7
- package/src/pb-components.js +2 -6
- package/src/pb-custom-form.js +230 -141
- package/src/pb-dialog.js +99 -63
- package/src/pb-document.js +118 -91
- package/src/pb-download.js +214 -198
- package/src/pb-drawer.js +146 -149
- package/src/pb-edit-app.js +471 -240
- package/src/pb-edit-xml.js +101 -98
- package/src/pb-events.js +126 -107
- package/src/pb-facs-link.js +130 -101
- package/src/pb-facsimile.js +494 -410
- package/src/pb-fetch.js +389 -0
- package/src/pb-formula.js +152 -154
- package/src/pb-geolocation.js +130 -132
- package/src/pb-grid-action.js +59 -56
- package/src/pb-grid.js +388 -228
- package/src/pb-highlight.js +142 -142
- package/src/pb-hotkeys.js +40 -42
- package/src/pb-i18n.js +115 -127
- package/src/pb-icon-button.js +108 -0
- package/src/pb-icon.js +283 -0
- package/src/pb-image-strip.js +85 -79
- package/src/pb-lang.js +142 -57
- package/src/pb-leaflet-map.js +551 -483
- package/src/pb-link.js +132 -126
- package/src/pb-load.js +495 -428
- package/src/pb-login.js +303 -248
- package/src/pb-manage-odds.js +384 -338
- package/src/pb-map-icon.js +90 -90
- package/src/pb-map-layer.js +86 -86
- package/src/pb-markdown.js +107 -110
- package/src/pb-media-query.js +75 -73
- package/src/pb-mei.js +523 -303
- package/src/pb-message.js +144 -98
- package/src/pb-mixin.js +268 -265
- package/src/pb-navigation.js +83 -96
- package/src/pb-observable.js +39 -39
- package/src/pb-odd-editor.js +1209 -948
- package/src/pb-odd-elementspec-editor.js +375 -310
- package/src/pb-odd-model-editor.js +1189 -941
- package/src/pb-odd-parameter-editor.js +269 -170
- package/src/pb-odd-rendition-editor.js +184 -131
- package/src/pb-page.js +451 -422
- package/src/pb-paginate.js +260 -178
- package/src/pb-panel.js +217 -183
- package/src/pb-popover-themes.js +16 -9
- package/src/pb-popover.js +297 -288
- package/src/pb-print-preview.js +128 -128
- package/src/pb-progress.js +52 -52
- package/src/pb-repeat.js +141 -108
- package/src/pb-restricted.js +85 -78
- package/src/pb-search.js +258 -230
- package/src/pb-select-feature.js +210 -126
- package/src/pb-select-odd.js +184 -118
- package/src/pb-select-template.js +113 -78
- package/src/pb-select.js +330 -229
- package/src/pb-split-list.js +181 -176
- package/src/pb-svg.js +81 -80
- package/src/pb-table-column.js +55 -55
- package/src/pb-table-grid.js +334 -205
- package/src/pb-tabs.js +238 -61
- package/src/pb-tify.js +3331 -126
- package/src/pb-timeline.js +394 -255
- package/src/pb-toggle-feature.js +196 -188
- package/src/pb-upload.js +201 -176
- package/src/pb-version.js +22 -34
- package/src/pb-view-annotate.js +138 -102
- package/src/pb-view.js +1722 -1272
- package/src/pb-zoom.js +144 -46
- package/src/search-result-service.js +256 -223
- package/src/seed-element.js +14 -22
- package/src/settings.js +4 -4
- package/src/theming.js +98 -91
- package/src/urls.js +403 -289
- package/src/utils.js +53 -51
- package/vite.config.js +86 -0
- package/css/pb-styles.css +0 -51
- package/dist/iron-form-3b8dcaa7.js +0 -210
- package/dist/jinn-codemirror-da0e2d1f.js +0 -1
- package/dist/paper-checkbox-515a5284.js +0 -1597
- package/dist/paper-icon-button-b1d31571.js +0 -398
- package/dist/paper-listbox-a3b7175c.js +0 -1265
- package/dist/pb-i18n-0611135a.js +0 -1
- package/dist/pb-mixin-b1caa22e.js +0 -158
- package/dist/polymer-hack.js +0 -1
- package/dist/vaadin-element-mixin-6e4cee3a.js +0 -527
- package/lib/Control.Geocoder.min.js +0 -2
- package/lib/Control.Geocoder.min.js.map +0 -1
- package/src/assets/pb-styles.css +0 -51
- package/src/pb-light-dom.js +0 -40
- package/src/polymer-hack.js +0 -6
package/src/pb-mei.js
CHANGED
|
@@ -1,48 +1,41 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit
|
|
2
|
-
import { unsafeHTML } from 'lit
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
3
|
+
import '@lrnwebcomponents/es-global-bridge';
|
|
4
|
+
// Use package export maps supported by verovio 3.x
|
|
5
|
+
import createVerovioModule from 'verovio/wasm';
|
|
6
|
+
import { VerovioToolkit } from 'verovio/esm';
|
|
6
7
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
7
8
|
import { translate } from './pb-i18n.js';
|
|
8
9
|
import { resolveURL } from './utils.js';
|
|
9
|
-
import '@polymer/paper-icon-button';
|
|
10
|
-
import '@polymer/paper-checkbox';
|
|
11
|
-
import '@polymer/iron-icons';
|
|
12
|
-
import '@polymer/iron-icons/av-icons';
|
|
13
10
|
|
|
14
11
|
let _verovio = null;
|
|
15
12
|
|
|
16
13
|
/** Import external script dynamically */
|
|
17
14
|
function _import(name, location) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
() => resolve(),
|
|
24
|
-
{ once: true }
|
|
25
|
-
);
|
|
26
|
-
});
|
|
15
|
+
window.ESGlobalBridge.requestAvailability();
|
|
16
|
+
return new Promise(resolve => {
|
|
17
|
+
window.ESGlobalBridge.instance.load(name, location);
|
|
18
|
+
window.addEventListener(`es-bridge-${name}-loaded`, () => resolve(), { once: true });
|
|
19
|
+
});
|
|
27
20
|
}
|
|
28
21
|
|
|
29
22
|
/**
|
|
30
23
|
* A viewer and player for MEI musical notation based on [Verovio](https://www.verovio.org/).
|
|
31
24
|
* Supports optional MIDI playback using [web-midi-player](https://midi.yvesgurcan.com/).
|
|
32
25
|
* Both libraries are loaded dynamically when the component is used the first time.
|
|
33
|
-
*
|
|
26
|
+
*
|
|
34
27
|
* Viewing options to be selected by the user can be defined via nested `pb-option` elements:
|
|
35
|
-
*
|
|
28
|
+
*
|
|
36
29
|
* ```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"
|
|
30
|
+
* <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
31
|
* footer="none">
|
|
39
32
|
* <pb-option name="appXPath" on="./rdg[contains(@label, 'original')]" off="">Original Clefs</pb-option>
|
|
40
33
|
* </pb-mei>
|
|
41
34
|
* ```
|
|
42
|
-
*
|
|
35
|
+
*
|
|
43
36
|
* The MEI document to display can either be given directly in the `data` property or loaded from an URL
|
|
44
37
|
* specified in `url`.
|
|
45
|
-
*
|
|
38
|
+
*
|
|
46
39
|
* @prop {"auto" | "encoded" | "none" | "always"} footer - Control footer layout
|
|
47
40
|
* @prop {"auto" | "encoded" | "none"} header - Control footer layout
|
|
48
41
|
* @prop {"auto" | "none" | "line" | "encoded" | "smart"} breaks - Define page and system breaks layout (default: "auto")
|
|
@@ -51,323 +44,550 @@ function _import(name, location) {
|
|
|
51
44
|
* @csspart music - the music output area
|
|
52
45
|
*/
|
|
53
46
|
export class PbMei extends pbMixin(LitElement) {
|
|
47
|
+
static get properties() {
|
|
48
|
+
return {
|
|
49
|
+
/**
|
|
50
|
+
* MEI data to display specified as a string. This should represent a complete
|
|
51
|
+
* MEI document.
|
|
52
|
+
*/
|
|
53
|
+
data: {
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* URL of the MEI file to load. Will be used if no `data` property is present.
|
|
58
|
+
* A relative URL would be resolved relative to the TEI Publisher endpoint.
|
|
59
|
+
*/
|
|
60
|
+
url: {
|
|
61
|
+
type: String,
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Set to enable MIDI player
|
|
65
|
+
*/
|
|
66
|
+
player: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
},
|
|
69
|
+
header: {
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
footer: {
|
|
73
|
+
type: String,
|
|
74
|
+
},
|
|
75
|
+
breaks: {
|
|
76
|
+
type: String,
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* Set the XPath query for selecting <app> child elements, for example: "./rdg[contains(@source, 'source-id')]";
|
|
80
|
+
* by default the <lem> or the first <rdg> is selected
|
|
81
|
+
*/
|
|
82
|
+
appXPath: {
|
|
83
|
+
type: String,
|
|
84
|
+
attribute: 'app-xpath',
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Set the xPath query for selecting <choice> child elements, for example: "./orig"; by default the first child is selected
|
|
88
|
+
*/
|
|
89
|
+
choiceXPath: {
|
|
90
|
+
type: String,
|
|
91
|
+
attribute: 'choice-xpath',
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Set the xPath query for selecting the <mdiv> to be rendered; only one <mdiv> can be rendered (default: "")
|
|
95
|
+
*/
|
|
96
|
+
mdivXPath: {
|
|
97
|
+
type: String,
|
|
98
|
+
attribute: 'mdiv-xpath',
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* Set the xPath query for selecting <subst> child elements, for example: "./del"; by default the first child is selected
|
|
102
|
+
*/
|
|
103
|
+
substXPath: {
|
|
104
|
+
type: String,
|
|
105
|
+
attribute: 'subst-xpath',
|
|
106
|
+
},
|
|
107
|
+
_isPlaying: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
},
|
|
110
|
+
_svg: {
|
|
111
|
+
type: String,
|
|
112
|
+
},
|
|
113
|
+
...super.properties,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
54
116
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
+
this._isPlaying = false;
|
|
133
|
+
this._midiPaused = false;
|
|
134
|
+
}
|
|
121
135
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
connectedCallback() {
|
|
137
|
+
super.connectedCallback();
|
|
138
|
+
|
|
139
|
+
this.querySelectorAll('pb-option').forEach(option => {
|
|
140
|
+
this._options.push({
|
|
141
|
+
name: option.getAttribute('name'),
|
|
142
|
+
on: option.getAttribute('on'),
|
|
143
|
+
off: option.getAttribute('off'),
|
|
144
|
+
label: option.innerHTML,
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
firstUpdated() {
|
|
150
|
+
super.firstUpdated();
|
|
151
|
+
|
|
152
|
+
if (this.player) {
|
|
153
|
+
_import('midiPlayer', resolveURL('../lib/web-midi-player/index.js')).then(() => {
|
|
154
|
+
const {
|
|
155
|
+
'web-midi-player': { default: MidiPlayer },
|
|
156
|
+
} = window;
|
|
157
|
+
this._midiPlayer = new MidiPlayer();
|
|
158
|
+
});
|
|
137
159
|
}
|
|
138
160
|
|
|
139
|
-
|
|
140
|
-
|
|
161
|
+
if (!_verovio) {
|
|
162
|
+
createVerovioModule().then(VerovioModule => {
|
|
163
|
+
_verovio = new VerovioToolkit(VerovioModule);
|
|
141
164
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
name: option.getAttribute('name'),
|
|
145
|
-
on: option.getAttribute('on'),
|
|
146
|
-
off: option.getAttribute('off'),
|
|
147
|
-
label: option.innerHTML
|
|
148
|
-
})
|
|
165
|
+
waitOnce('pb-page-ready', () => {
|
|
166
|
+
this.load();
|
|
149
167
|
});
|
|
168
|
+
});
|
|
169
|
+
} else {
|
|
170
|
+
waitOnce('pb-page-ready', () => {
|
|
171
|
+
this.load();
|
|
172
|
+
});
|
|
150
173
|
}
|
|
174
|
+
}
|
|
151
175
|
|
|
152
|
-
|
|
153
|
-
|
|
176
|
+
update(changedProps) {
|
|
177
|
+
super.update(changedProps);
|
|
178
|
+
if (changedProps.get('url') || changedProps.get('data')) {
|
|
179
|
+
this.load();
|
|
180
|
+
} else if (
|
|
181
|
+
(changedProps.has('appXPath') ||
|
|
182
|
+
changedProps.has('choiceXPath') ||
|
|
183
|
+
changedProps.has('mdivXPath') ||
|
|
184
|
+
changedProps.has('substXPath')) &&
|
|
185
|
+
_verovio
|
|
186
|
+
) {
|
|
187
|
+
_verovio.setOptions(this._getOptions());
|
|
188
|
+
try {
|
|
189
|
+
_verovio.loadData(this._data);
|
|
190
|
+
this.showPage();
|
|
191
|
+
} catch (error) {
|
|
192
|
+
console.error('<pb-mei> Failed to reload MEI data:', error);
|
|
193
|
+
this._handleError(error);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
154
197
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
198
|
+
load() {
|
|
199
|
+
if (this.data) {
|
|
200
|
+
console.log('<pb-mei> Rendering data');
|
|
201
|
+
this.show(this.data);
|
|
202
|
+
} else if (this.url) {
|
|
203
|
+
const link = this.toAbsoluteURL(this.url);
|
|
162
204
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
this.load();
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
} else {
|
|
172
|
-
waitOnce('pb-page-ready', () => {
|
|
173
|
-
this.load();
|
|
174
|
-
});
|
|
175
|
-
}
|
|
205
|
+
fetch(link)
|
|
206
|
+
.then(response => response.text())
|
|
207
|
+
.then(async str => {
|
|
208
|
+
this.show(str);
|
|
209
|
+
});
|
|
176
210
|
}
|
|
211
|
+
}
|
|
177
212
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
}
|
|
193
|
-
}
|
|
213
|
+
show(str) {
|
|
214
|
+
this._data = str;
|
|
215
|
+
_verovio.setOptions(this._getOptions());
|
|
194
216
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
.then(async str => {
|
|
205
|
-
this.show(str);
|
|
206
|
-
});
|
|
207
|
-
}
|
|
217
|
+
try {
|
|
218
|
+
_verovio.loadData(this._data);
|
|
219
|
+
this._pages = _verovio.getPageCount();
|
|
220
|
+
this._page = 1;
|
|
221
|
+
console.log('<pb-mei> Loaded %d pages', this._pages);
|
|
222
|
+
this.showPage();
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error('<pb-mei> Failed to load MEI data:', error);
|
|
225
|
+
this._handleError(error);
|
|
208
226
|
}
|
|
227
|
+
}
|
|
209
228
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
229
|
+
showPage() {
|
|
230
|
+
this._svg = _verovio.renderToSVG(this._page, {});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
_handleError(error) {
|
|
234
|
+
// Clear any existing error
|
|
235
|
+
this._clearError();
|
|
236
|
+
|
|
237
|
+
// Create error message element
|
|
238
|
+
const errorDiv = document.createElement('div');
|
|
239
|
+
errorDiv.className = 'pb-mei-error';
|
|
240
|
+
errorDiv.style.cssText = `
|
|
241
|
+
padding: 1rem;
|
|
242
|
+
margin: 1rem;
|
|
243
|
+
background-color: #fee;
|
|
244
|
+
border: 1px solid #fcc;
|
|
245
|
+
border-radius: 4px;
|
|
246
|
+
color: #c33;
|
|
247
|
+
font-family: sans-serif;
|
|
248
|
+
font-size: 14px;
|
|
249
|
+
`;
|
|
250
|
+
|
|
251
|
+
let errorMessage = 'Failed to load MEI data';
|
|
252
|
+
const errorText = error.message || error.toString() || '';
|
|
253
|
+
|
|
254
|
+
if (
|
|
255
|
+
errorText.includes('function or function signature mismatch') ||
|
|
256
|
+
errorText.includes('null function')
|
|
257
|
+
) {
|
|
258
|
+
errorMessage = 'Invalid MEI data format';
|
|
259
|
+
} else if (errorText.includes('parse') || errorText.includes('XML')) {
|
|
260
|
+
errorMessage = 'Invalid XML/MEI syntax';
|
|
261
|
+
} else if (errorText.includes('WASM') || errorText.includes('module')) {
|
|
262
|
+
errorMessage = 'MEI rendering engine error';
|
|
218
263
|
}
|
|
219
264
|
|
|
220
|
-
|
|
221
|
-
|
|
265
|
+
errorDiv.textContent = errorMessage;
|
|
266
|
+
|
|
267
|
+
// Insert error message into the component
|
|
268
|
+
if (this.shadowRoot) {
|
|
269
|
+
const output = this.shadowRoot.querySelector('#output');
|
|
270
|
+
if (output) {
|
|
271
|
+
output.innerHTML = '';
|
|
272
|
+
output.appendChild(errorDiv);
|
|
273
|
+
}
|
|
222
274
|
}
|
|
223
275
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
array[i] = raw.charCodeAt(i);
|
|
243
|
-
}
|
|
244
|
-
this._midiPlayer.play({ arrayBuffer: array });
|
|
245
|
-
}
|
|
276
|
+
// Emit error event
|
|
277
|
+
this.dispatchEvent(
|
|
278
|
+
new CustomEvent('pb-mei-error', {
|
|
279
|
+
detail: {
|
|
280
|
+
error: error.message || 'Unknown error',
|
|
281
|
+
data: this._data,
|
|
282
|
+
},
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
_clearError() {
|
|
288
|
+
if (this.shadowRoot) {
|
|
289
|
+
const output = this.shadowRoot.querySelector('#output');
|
|
290
|
+
if (output) {
|
|
291
|
+
const existingError = output.querySelector('.pb-mei-error');
|
|
292
|
+
if (existingError) {
|
|
293
|
+
existingError.remove();
|
|
246
294
|
}
|
|
295
|
+
}
|
|
247
296
|
}
|
|
297
|
+
}
|
|
248
298
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this._midiPaused = this._midiPlayer.pause();
|
|
253
|
-
if (this._midiPaused) {
|
|
254
|
-
button.icon = 'av:play-arrow';
|
|
255
|
-
button.active = false;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
299
|
+
async play() {
|
|
300
|
+
if (!this.player || !this._midiPlayer) {
|
|
301
|
+
return;
|
|
258
302
|
}
|
|
259
303
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
`;
|
|
304
|
+
this._isPlaying = !this._isPlaying;
|
|
305
|
+
if (!this._isPlaying) {
|
|
306
|
+
this._midiPlayer.stop();
|
|
307
|
+
this._midiPaused = false;
|
|
308
|
+
this.requestUpdate('_isPlaying');
|
|
309
|
+
return;
|
|
277
310
|
}
|
|
278
311
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
312
|
+
if (this._midiPaused) {
|
|
313
|
+
this._midiPaused = false;
|
|
314
|
+
this._midiPlayer.resume();
|
|
315
|
+
this.requestUpdate('_isPlaying');
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
try {
|
|
320
|
+
_verovio.loadData(this._data);
|
|
321
|
+
const mdata = _verovio.renderToMIDI();
|
|
322
|
+
const raw = window.atob(mdata);
|
|
323
|
+
const rawLength = raw.length;
|
|
324
|
+
const array = new Uint8Array(new ArrayBuffer(rawLength));
|
|
325
|
+
|
|
326
|
+
for (let i = 0; i < rawLength; i += 1) {
|
|
327
|
+
array[i] = raw.charCodeAt(i);
|
|
328
|
+
}
|
|
329
|
+
this._midiPlayer.play({ arrayBuffer: array });
|
|
330
|
+
this.requestUpdate('_isPlaying');
|
|
331
|
+
} catch (error) {
|
|
332
|
+
console.error('<pb-mei> Failed to play MIDI:', error);
|
|
333
|
+
this._isPlaying = false;
|
|
334
|
+
this.requestUpdate('_isPlaying');
|
|
335
|
+
this._handleError(error);
|
|
289
336
|
}
|
|
337
|
+
}
|
|
290
338
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
);
|
|
339
|
+
pause() {
|
|
340
|
+
if (!this.player || !this._midiPlayer || !this._isPlaying) {
|
|
341
|
+
return;
|
|
295
342
|
}
|
|
296
343
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
344
|
+
this._midiPaused = this._midiPlayer.pause();
|
|
345
|
+
this._isPlaying = false;
|
|
346
|
+
this.requestUpdate('_isPlaying');
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
render() {
|
|
350
|
+
return html`
|
|
351
|
+
<div id="toolbar" part="toolbar">
|
|
352
|
+
<div class="${this._pages === 1 ? 'hidden' : ''}">
|
|
353
|
+
<button
|
|
354
|
+
id="pageLeft"
|
|
355
|
+
class="pb-button pb-button--icon"
|
|
356
|
+
type="button"
|
|
357
|
+
aria-label="Previous page"
|
|
358
|
+
title="Previous page"
|
|
359
|
+
@click="${this._previousPage}"
|
|
360
|
+
?disabled="${this._page === 1}"
|
|
361
|
+
>
|
|
362
|
+
${this._renderChevron('left')}
|
|
363
|
+
</button>
|
|
364
|
+
<button
|
|
365
|
+
id="pageRight"
|
|
366
|
+
class="pb-button pb-button--icon"
|
|
367
|
+
type="button"
|
|
368
|
+
aria-label="Next page"
|
|
369
|
+
title="Next page"
|
|
370
|
+
@click="${this._nextPage}"
|
|
371
|
+
?disabled="${this._page === this._pages}"
|
|
372
|
+
>
|
|
373
|
+
${this._renderChevron('right')}
|
|
374
|
+
</button>
|
|
375
|
+
</div>
|
|
376
|
+
${this._renderPlayer()}
|
|
377
|
+
<div>${this._renderOptions()}</div>
|
|
378
|
+
</div>
|
|
379
|
+
${this._svg
|
|
380
|
+
? html`<div id="output" part="music">${unsafeHTML(this._svg)}</div>`
|
|
381
|
+
: html`<div id="output" part="music">${translate('dialogs.loading')}</div>`}
|
|
382
|
+
`;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
_renderPlayer() {
|
|
386
|
+
if (this.player) {
|
|
387
|
+
return html`
|
|
388
|
+
<div id="player">
|
|
389
|
+
<button
|
|
390
|
+
id="play"
|
|
391
|
+
class="pb-button pb-button--icon ${this._isPlaying ? 'is-active' : ''}"
|
|
392
|
+
type="button"
|
|
393
|
+
aria-label="${this._isPlaying ? 'Stop playback' : 'Start playback'}"
|
|
394
|
+
aria-pressed="${this._isPlaying ? 'true' : 'false'}"
|
|
395
|
+
title="${this._isPlaying ? 'Stop playback' : 'Start playback'}"
|
|
396
|
+
@click="${this.play}"
|
|
397
|
+
>
|
|
398
|
+
${this._isPlaying ? this._renderStopIcon() : this._renderPlayIcon()}
|
|
399
|
+
</button>
|
|
400
|
+
<button
|
|
401
|
+
class="pb-button pb-button--icon"
|
|
402
|
+
type="button"
|
|
403
|
+
aria-label="Pause playback"
|
|
404
|
+
title="Pause playback"
|
|
405
|
+
@click="${this.pause}"
|
|
406
|
+
>
|
|
407
|
+
${this._renderPauseIcon()}
|
|
408
|
+
</button>
|
|
409
|
+
</div>
|
|
410
|
+
`;
|
|
305
411
|
}
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
306
414
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
415
|
+
_renderOptions() {
|
|
416
|
+
return this._options.map(
|
|
417
|
+
option =>
|
|
418
|
+
html`<label class="option-toggle">
|
|
419
|
+
<input
|
|
420
|
+
type="checkbox"
|
|
421
|
+
class="option-toggle__control"
|
|
422
|
+
@change="${ev => this._setOption(option, ev.target.checked)}"
|
|
423
|
+
.checked=${Boolean(this[option.name])}
|
|
424
|
+
/>
|
|
425
|
+
<span class="option-toggle__label">${option.label}</span>
|
|
426
|
+
</label>`,
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
_renderChevron(direction) {
|
|
431
|
+
const path =
|
|
432
|
+
direction === 'left'
|
|
433
|
+
? 'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z'
|
|
434
|
+
: 'M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z';
|
|
435
|
+
return html`<svg
|
|
436
|
+
width="20"
|
|
437
|
+
height="20"
|
|
438
|
+
viewBox="0 0 24 24"
|
|
439
|
+
aria-hidden="true"
|
|
440
|
+
focusable="false"
|
|
441
|
+
>
|
|
442
|
+
<path d="${path}"></path>
|
|
443
|
+
</svg>`;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
_renderPlayIcon() {
|
|
447
|
+
return html`<svg
|
|
448
|
+
width="20"
|
|
449
|
+
height="20"
|
|
450
|
+
viewBox="0 0 24 24"
|
|
451
|
+
aria-hidden="true"
|
|
452
|
+
focusable="false"
|
|
453
|
+
>
|
|
454
|
+
<path d="M8 5v14l11-7z"></path>
|
|
455
|
+
</svg>`;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
_renderStopIcon() {
|
|
459
|
+
return html`<svg
|
|
460
|
+
width="20"
|
|
461
|
+
height="20"
|
|
462
|
+
viewBox="0 0 24 24"
|
|
463
|
+
aria-hidden="true"
|
|
464
|
+
focusable="false"
|
|
465
|
+
>
|
|
466
|
+
<path d="M6 6h12v12H6z"></path>
|
|
467
|
+
</svg>`;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
_renderPauseIcon() {
|
|
471
|
+
return html`<svg
|
|
472
|
+
width="20"
|
|
473
|
+
height="20"
|
|
474
|
+
viewBox="0 0 24 24"
|
|
475
|
+
aria-hidden="true"
|
|
476
|
+
focusable="false"
|
|
477
|
+
>
|
|
478
|
+
<path d="M6 19h4V5H6zm8-14v14h4V5h-4z"></path>
|
|
479
|
+
</svg>`;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
_setOption(option, checked) {
|
|
483
|
+
let value;
|
|
484
|
+
if (checked) {
|
|
485
|
+
value = option.on && option.on.length > 0 ? option.on : null;
|
|
486
|
+
} else {
|
|
487
|
+
value = option.off && option.off.length > 0 ? option.off : null;
|
|
313
488
|
}
|
|
489
|
+
this[option.name] = value;
|
|
490
|
+
}
|
|
314
491
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
492
|
+
_nextPage(ev) {
|
|
493
|
+
ev.preventDefault();
|
|
494
|
+
if (this._page < this._pages) {
|
|
495
|
+
this._page += 1;
|
|
496
|
+
this.showPage();
|
|
321
497
|
}
|
|
498
|
+
}
|
|
322
499
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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;
|
|
500
|
+
_previousPage(ev) {
|
|
501
|
+
ev.preventDefault();
|
|
502
|
+
if (this._page > 1) {
|
|
503
|
+
this._page -= 1;
|
|
504
|
+
this.showPage();
|
|
339
505
|
}
|
|
506
|
+
}
|
|
340
507
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
margin-right: 1rem;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
#toolbar div:last-child {
|
|
359
|
-
margin-right: 0;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
#output {
|
|
363
|
-
width: 100%;
|
|
364
|
-
overflow: auto;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.hidden {
|
|
368
|
-
display: none;
|
|
369
|
-
}
|
|
370
|
-
`;
|
|
508
|
+
_getOptions() {
|
|
509
|
+
const options = {
|
|
510
|
+
// svg content should scale with the width of the component
|
|
511
|
+
svgViewBox: true,
|
|
512
|
+
adjustPageHeight: true,
|
|
513
|
+
footer: this.footer,
|
|
514
|
+
header: this.header,
|
|
515
|
+
breaks: this.breaks,
|
|
516
|
+
appXPathQuery: [this.appXPath],
|
|
517
|
+
substXPathQuery: [this.substXPath],
|
|
518
|
+
choiceXPathQuery: [this.choiceXPath],
|
|
519
|
+
};
|
|
520
|
+
if (this.mdivXPath) {
|
|
521
|
+
options.mdivXPathQuery = this.mdivXPath;
|
|
371
522
|
}
|
|
523
|
+
return options;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
static get styles() {
|
|
527
|
+
return css`
|
|
528
|
+
:host {
|
|
529
|
+
display: grid;
|
|
530
|
+
grid-template-rows: auto 1fr;
|
|
531
|
+
min-width: var(--pb-mei-min-width, auto);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
#toolbar {
|
|
535
|
+
display: flex;
|
|
536
|
+
align-items: center;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
#toolbar div {
|
|
540
|
+
margin-right: 1rem;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
#toolbar div:last-child {
|
|
544
|
+
margin-right: 0;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
#toolbar button.pb-button--icon {
|
|
548
|
+
margin-right: 0.5rem;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
#toolbar button.pb-button--icon:last-child {
|
|
552
|
+
margin-right: 0;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
#output {
|
|
556
|
+
width: 100%;
|
|
557
|
+
overflow: auto;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.hidden {
|
|
561
|
+
display: none;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
#player {
|
|
565
|
+
display: inline-flex;
|
|
566
|
+
gap: 0.5rem;
|
|
567
|
+
align-items: center;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
#player .pb-button.is-active {
|
|
571
|
+
background-color: var(--pb-primary-color);
|
|
572
|
+
color: var(--pb-on-primary-color);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.option-toggle {
|
|
576
|
+
display: inline-flex;
|
|
577
|
+
align-items: center;
|
|
578
|
+
gap: 0.5rem;
|
|
579
|
+
margin-right: 0.75rem;
|
|
580
|
+
font-size: 0.95em;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.option-toggle:last-child {
|
|
584
|
+
margin-right: 0;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.option-toggle__control {
|
|
588
|
+
accent-color: var(--pb-primary-color, #1976d2);
|
|
589
|
+
}
|
|
590
|
+
`;
|
|
591
|
+
}
|
|
372
592
|
}
|
|
373
|
-
customElements.define('pb-mei', PbMei);
|
|
593
|
+
customElements.define('pb-mei', PbMei);
|