@teipublisher/pb-components 2.10.6 → 2.11.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.
- package/CHANGELOG.md +14 -0
- package/dist/demo/pb-facsimile-2.html +1 -1
- package/dist/es-global-bridge-4240f389.js +5 -0
- package/dist/pb-components-bundle.js +119 -119
- package/dist/pb-elements.json +2 -13
- package/dist/pb-leaflet-map.js +1 -1
- package/dist/pb-odd-editor.js +60 -60
- package/i18n/common/de.json +3 -0
- package/i18n/common/en.json +3 -0
- package/package.json +8 -7
- package/pb-elements.json +2 -13
- package/src/pb-facsimile.js +4 -6
- package/src/pb-odd-editor.js +34 -4
- package/src/pb-view.js +6 -3
- package/dist/es-global-bridge-5c039c0b.js +0 -5
package/i18n/common/en.json
CHANGED
|
@@ -148,6 +148,9 @@
|
|
|
148
148
|
"save": "Save",
|
|
149
149
|
"saving": "Saving ...",
|
|
150
150
|
"saved": "Saved",
|
|
151
|
+
"unsaved": "There are unsaved changes, which will be included in the export! Continue anyway?",
|
|
152
|
+
"download": "Download ODD",
|
|
153
|
+
"save-as": "Save ODD to directory",
|
|
151
154
|
"denied": "Permission Denied",
|
|
152
155
|
"denied-message": "You do not have permission to save {{odd}}",
|
|
153
156
|
"reload": "Reload",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teipublisher/pb-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Collection of webcomponents underlying TEI Publisher",
|
|
5
5
|
"repository": "https://github.com/eeditiones/tei-publisher-components.git",
|
|
6
6
|
"main": "index.html",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@babel/runtime": "7.11.2",
|
|
40
40
|
"@cwmr/paper-autocomplete": "^4.0.0",
|
|
41
41
|
"@jinntec/jinn-codemirror": "^1.13.5",
|
|
42
|
-
"@lrnwebcomponents/es-global-bridge": "^
|
|
42
|
+
"@lrnwebcomponents/es-global-bridge": "^7.0.4",
|
|
43
43
|
"@polymer/app-layout": "^3.1.0",
|
|
44
44
|
"@polymer/iron-ajax": "^3.0.1",
|
|
45
45
|
"@polymer/iron-collapse": "^3.0.1",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"@vaadin/vaadin-upload": "^4.4.0",
|
|
70
70
|
"@webcomponents/webcomponentsjs": "latest",
|
|
71
71
|
"animejs": "^3.2.0",
|
|
72
|
+
"browser-fs-access": "^0.34.1",
|
|
72
73
|
"construct-style-sheets-polyfill": "^3.1.0",
|
|
73
74
|
"gridjs": "^5.0.2",
|
|
74
75
|
"hotkeys-js": "^3.8.1",
|
|
@@ -77,16 +78,16 @@
|
|
|
77
78
|
"i18next-chained-backend": "^2.0.1",
|
|
78
79
|
"i18next-xhr-backend": "^3.2.2",
|
|
79
80
|
"js-cookie": "^2.2.1",
|
|
80
|
-
"leaflet": "^1.
|
|
81
|
+
"leaflet": "^1.9.4",
|
|
81
82
|
"leaflet.markercluster": "^1.5.3",
|
|
82
83
|
"lit-element": "^2.5.1",
|
|
83
84
|
"lit-html": "^1.3.0",
|
|
84
85
|
"marked": "^1.2.0",
|
|
85
|
-
"pagedjs": "^0.4.
|
|
86
|
+
"pagedjs": "^0.4.3",
|
|
86
87
|
"path-to-regexp": "^6.2.1",
|
|
87
|
-
"prismjs": "^1.
|
|
88
|
+
"prismjs": "^1.29.0",
|
|
88
89
|
"tify": "^0.28.1",
|
|
89
|
-
"tippy.js": "^6.
|
|
90
|
+
"tippy.js": "^6.3.7",
|
|
90
91
|
"tom-select": "^2.2.2",
|
|
91
92
|
"uniqolor": "^1.1.0",
|
|
92
93
|
"web-animations-js": "^2.3.2"
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
"karma": "^6.4.1",
|
|
110
111
|
"lint-staged": "^10.4.0",
|
|
111
112
|
"recursive-copy": "^2.0.14",
|
|
112
|
-
"rimraf": "^
|
|
113
|
+
"rimraf": "^5.0.1",
|
|
113
114
|
"rollup": "^1.21.0",
|
|
114
115
|
"rollup-plugin-analyzer": "^3.2.3",
|
|
115
116
|
"rollup-plugin-babel": "^4.4.0",
|
package/pb-elements.json
CHANGED
|
@@ -4145,11 +4145,6 @@
|
|
|
4145
4145
|
"type": "number",
|
|
4146
4146
|
"default": "0.2"
|
|
4147
4147
|
},
|
|
4148
|
-
{
|
|
4149
|
-
"name": "src",
|
|
4150
|
-
"type": "string",
|
|
4151
|
-
"default": "\"\""
|
|
4152
|
-
},
|
|
4153
4148
|
{
|
|
4154
4149
|
"name": "prefix-url",
|
|
4155
4150
|
"description": "Path pointing to the location of openseadragon user interface images.",
|
|
@@ -4293,12 +4288,6 @@
|
|
|
4293
4288
|
"type": "number",
|
|
4294
4289
|
"default": "0.2"
|
|
4295
4290
|
},
|
|
4296
|
-
{
|
|
4297
|
-
"name": "src",
|
|
4298
|
-
"attribute": "src",
|
|
4299
|
-
"type": "string",
|
|
4300
|
-
"default": "\"\""
|
|
4301
|
-
},
|
|
4302
4291
|
{
|
|
4303
4292
|
"name": "prefixUrl",
|
|
4304
4293
|
"attribute": "prefix-url",
|
|
@@ -4357,8 +4346,8 @@
|
|
|
4357
4346
|
"description": "When received, resets the facsimile viewer"
|
|
4358
4347
|
},
|
|
4359
4348
|
{
|
|
4360
|
-
"name": "pb-
|
|
4361
|
-
"description": "
|
|
4349
|
+
"name": "pb-load-facsimile",
|
|
4350
|
+
"description": "When received, adds an image to the current image sequence. Emitted by \n`pb-facs-link`. The event detail should contain an object with the properties `url`, `order` and `element`,\nwhere `url` is the relative or absolute URL to the image, `order` is an integer specifying the position at which\nthe image should be inserted in the list, and `element` points to the `pb-facs-link` element triggering the event."
|
|
4362
4351
|
},
|
|
4363
4352
|
{
|
|
4364
4353
|
"name": "pb-show-annotation",
|
package/src/pb-facsimile.js
CHANGED
|
@@ -7,7 +7,10 @@ import { resolveURL } from './utils.js';
|
|
|
7
7
|
* View zoomable images using a IIIF server.
|
|
8
8
|
*
|
|
9
9
|
* @fires pb-start-update - When received, resets the facsimile viewer
|
|
10
|
-
* @fires pb-
|
|
10
|
+
* @fires pb-load-facsimile - When received, adds an image to the current image sequence. Emitted by
|
|
11
|
+
* `pb-facs-link`. The event detail should contain an object with the properties `url`, `order` and `element`,
|
|
12
|
+
* where `url` is the relative or absolute URL to the image, `order` is an integer specifying the position at which
|
|
13
|
+
* the image should be inserted in the list, and `element` points to the `pb-facs-link` element triggering the event.
|
|
11
14
|
* @fires pb-show-annotation - When received, sets up the viewer to select a particular image and highlight coordinates
|
|
12
15
|
* @fires pb-facsimile-status - Indicates the status of loading an image into the viewer. The status is indicated
|
|
13
16
|
* by the `status` property in event.detail as follows: `loading` - image was requested; `loaded` - image is displayed;
|
|
@@ -24,10 +27,6 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
24
27
|
static get properties() {
|
|
25
28
|
return {
|
|
26
29
|
...super.properties,
|
|
27
|
-
// Image source
|
|
28
|
-
src: {
|
|
29
|
-
type: String
|
|
30
|
-
},
|
|
31
30
|
/**
|
|
32
31
|
* Set to false to prevent the appearance of the default navigation controls.
|
|
33
32
|
* Note that if set to false, the customs buttons set by the options
|
|
@@ -159,7 +158,6 @@ export class PbFacsimile extends pbMixin(LitElement) {
|
|
|
159
158
|
this.constrainDuringPan = false;
|
|
160
159
|
this.referenceStrip = false;
|
|
161
160
|
this.referenceStripSizeRatio = 0.2;
|
|
162
|
-
this.src = '';
|
|
163
161
|
this.prefixUrl = '../images/openseadragon/';
|
|
164
162
|
this.loaded = false;
|
|
165
163
|
}
|
package/src/pb-odd-editor.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { LitElement, html, css } from 'lit-element'
|
|
2
|
+
import { LitElement, html, css } from 'lit-element';
|
|
3
|
+
import { supported as fsSupported, fileSave } from "browser-fs-access";
|
|
3
4
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
4
5
|
import { pbHotkeys } from './pb-hotkeys.js';
|
|
5
6
|
import { repeat } from 'lit-html/directives/repeat';
|
|
@@ -290,6 +291,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
290
291
|
this.hotkeys = {
|
|
291
292
|
save: 'ctrl+shift+s,command+shift+s'
|
|
292
293
|
}
|
|
294
|
+
this._hasChanges = false;
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
render() {
|
|
@@ -311,6 +313,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
311
313
|
|
|
312
314
|
<span class="icons">
|
|
313
315
|
<pb-edit-xml id="editSource"><paper-icon-button icon="code" title="${translate('odd.editor.odd-source')}"></paper-icon-button></pb-edit-xml>
|
|
316
|
+
<paper-icon-button @click="${this._download}" icon="icons:cloud-download" title="${fsSupported ? translate('odd.editor.save-as'): translate('odd.editor.download')}"></paper-icon-button>
|
|
314
317
|
<paper-icon-button @click="${this._reload}" icon="refresh" title="${translate('odd.editor.reload')}"></paper-icon-button>
|
|
315
318
|
<paper-icon-button @click="${this.save}" icon="save" title="${translate('odd.editor.save')} ${this.display('save')}"
|
|
316
319
|
?disabled="${!this.loggedIn}"></paper-icon-button>
|
|
@@ -473,6 +476,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
473
476
|
this.loadContent.url = `${this.getEndpoint()}/${this.lessThanApiVersion('1.0.0') ? 'modules/editor.xql' : 'api/odd/' + this.odd}`;
|
|
474
477
|
const request = this.loadContent.generateRequest();
|
|
475
478
|
|
|
479
|
+
this._hasChanges = false;
|
|
476
480
|
request.completes.then(r => this.handleOdd(r));
|
|
477
481
|
}
|
|
478
482
|
|
|
@@ -888,10 +892,34 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
888
892
|
return code;
|
|
889
893
|
}
|
|
890
894
|
|
|
891
|
-
|
|
895
|
+
_download() {
|
|
896
|
+
if (this._hasChanges) {
|
|
897
|
+
const dialog = this.shadowRoot.getElementById('dialog');
|
|
898
|
+
dialog.confirm(i18n("odd.editor.save"), i18n('odd.editor.unsaved'))
|
|
899
|
+
.then(
|
|
900
|
+
() => this._downloadOdd(),
|
|
901
|
+
() => console.log('<pb-odd-editor> Download aborted'));
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
this._downloadOdd();
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
_downloadOdd() {
|
|
908
|
+
const data = this.serializeOdd();
|
|
909
|
+
const blob = new Blob([data], { type: 'application/xml'});
|
|
910
|
+
fileSave(blob, {
|
|
911
|
+
fileName: this.odd,
|
|
912
|
+
extensions: ['.odd'],
|
|
913
|
+
})
|
|
914
|
+
.then(
|
|
915
|
+
() => console.log(`<pb-odd-editor> ${this.odd} exported`),
|
|
916
|
+
() => console.log('<pb-odd-editor> export aborted')
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
save() {
|
|
892
921
|
document.dispatchEvent(new CustomEvent('pb-start-update'));
|
|
893
|
-
const data = this.serializeOdd()
|
|
894
|
-
console.log('serialised ODD:', data)
|
|
922
|
+
const data = this.serializeOdd();
|
|
895
923
|
|
|
896
924
|
this.shadowRoot.getElementById('dialog').show(i18n("odd.editor.save"), i18n('odd.editor.saving'));
|
|
897
925
|
|
|
@@ -964,6 +992,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
964
992
|
|
|
965
993
|
this.shadowRoot.getElementById('dialog').set(i18n("odd.editor.saved"), msg);
|
|
966
994
|
|
|
995
|
+
this._hasChanges = false;
|
|
967
996
|
document.dispatchEvent(new CustomEvent('pb-end-update'));
|
|
968
997
|
}
|
|
969
998
|
|
|
@@ -1040,6 +1069,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
1040
1069
|
|
|
1041
1070
|
handleElementSpecChanged(e) {
|
|
1042
1071
|
// console.log('handleElementSpecChanged ',e);
|
|
1072
|
+
this._hasChanges = true;
|
|
1043
1073
|
const elementSpec = this.elementSpecs.find(es => es.ident === e.detail.ident);
|
|
1044
1074
|
const index = this.elementSpecs.indexOf(elementSpec);
|
|
1045
1075
|
const newSpec = Object.assign({}, elementSpec, { models: e.detail.models });
|
package/src/pb-view.js
CHANGED
|
@@ -575,6 +575,8 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
575
575
|
}
|
|
576
576
|
if (ev.detail.id) {
|
|
577
577
|
this.xmlId = ev.detail.id;
|
|
578
|
+
} else if (ev.detail.id == null) {
|
|
579
|
+
this.xmlId = null;
|
|
578
580
|
}
|
|
579
581
|
this.odd = ev.detail.odd || this.odd;
|
|
580
582
|
if (ev.detail.columnSeparator !== undefined) {
|
|
@@ -783,7 +785,6 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
783
785
|
this.previousId = resp.previousId;
|
|
784
786
|
this.nodeId = resp.root;
|
|
785
787
|
this.switchView = resp.switchView;
|
|
786
|
-
this.xmlId = null;
|
|
787
788
|
|
|
788
789
|
this.updateComplete.then(() => {
|
|
789
790
|
const view = this.shadowRoot.getElementById('view');
|
|
@@ -1102,7 +1103,8 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1102
1103
|
root: this.previousId ? null : this.previous
|
|
1103
1104
|
});
|
|
1104
1105
|
}
|
|
1105
|
-
this.
|
|
1106
|
+
this.xmlId = this.previousId;
|
|
1107
|
+
this._load(this.xmlId ? null : this.previous, direction);
|
|
1106
1108
|
}
|
|
1107
1109
|
} else if (this.next) {
|
|
1108
1110
|
if (!this.disableHistory && !this.map) {
|
|
@@ -1111,7 +1113,8 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1111
1113
|
root: this.nextId ? null : this.next
|
|
1112
1114
|
});
|
|
1113
1115
|
}
|
|
1114
|
-
this.
|
|
1116
|
+
this.xmlId = this.nextId;
|
|
1117
|
+
this._load(this.xmlId ? null : this.next, direction);
|
|
1115
1118
|
}
|
|
1116
1119
|
}
|
|
1117
1120
|
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2018 The Pennsylvania State University
|
|
3
|
-
* @license Apache-2.0, see License.md for full text.
|
|
4
|
-
*/
|
|
5
|
-
class o{constructor(){this.load=(o,i,e=!1)=>{let l=window.ESGlobalBridge.imports&&window.ESGlobalBridge.imports[o];if(!(!e&&window.ESGlobalBridge.webpack&&window.ESGlobalBridge.webpack[o])&&!l)return new Promise((e,l)=>{const d=document.createElement("script");d.src=i,d.setAttribute("data-name",o),window.ESGlobalBridge.imports[o]=i,d.onload=()=>{e(window.ESGlobalBridge.imports[o]),window.ESGlobalBridge.imports[o]=!0,setTimeout(()=>{const e=new CustomEvent(`es-bridge-${o}-loaded`,{bubbles:!0,cancelable:!0,detail:{name:o,location:i}});document.dispatchEvent(e)},100)},d.onerror=()=>{l(new Error(`Failed to load ${o} script with location ${i}.`)),delete window.ESGlobalBridge.imports[o],window.ESGlobalBridge.imports[o]=!1},document.documentElement.appendChild(d)})}}}window.ESGlobalBridge=window.ESGlobalBridge||{},window.ESGlobalBridge.imports=window.ESGlobalBridge.imports||{},window.ESGlobalBridge.requestAvailability=()=>(window.ESGlobalBridge.instance||(window.ESGlobalBridge.instance=new o),window.ESGlobalBridge);window.ESGlobalBridge.requestAvailability();
|