@teipublisher/pb-components 2.12.5 → 2.12.7
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 +16 -0
- package/dist/pb-code-editor.js +1 -1
- package/dist/pb-components-bundle.js +6 -6
- package/dist/pb-edit-app.js +1 -1
- package/dist/pb-elements.json +23 -10
- package/dist/pb-i18n-375ccc5c.js +1 -0
- package/dist/pb-mei.js +1 -1
- package/dist/pb-odd-editor.js +1 -1
- package/dist/{vaadin-element-mixin-660b2157.js → vaadin-element-mixin-ec93018d.js} +1 -1
- package/i18n/common/en.json +4 -1
- package/package.json +1 -1
- package/pb-elements.json +23 -10
- package/src/pb-authority-lookup.js +1 -1
- package/src/pb-i18n.js +7 -2
- package/src/pb-link.js +7 -0
- package/src/pb-split-list.js +10 -8
- package/src/pb-view-annotate.js +9 -0
- package/dist/pb-i18n-9000294c.js +0 -1
package/dist/pb-odd-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as e,g as t,F as o,D as i,x as s,y as r,c as a}from"./paper-checkbox-c9177e35.js";import{a as n}from"./paper-listbox-1fc346ac.js";import{E as l,T as d,D as c,p}from"./vaadin-element-mixin-
|
|
1
|
+
import{h as e,g as t,F as o,D as i,x as s,y as r,c as a}from"./paper-checkbox-c9177e35.js";import{a as n}from"./paper-listbox-1fc346ac.js";import{E as l,T as d,D as c,p}from"./vaadin-element-mixin-ec93018d.js";import{f as h,N as m,j as u,k as b,l as g,A as v,L as f,c as y,h as w,b as _,w as x,p as E}from"./pb-mixin-d61c06b6.js";import{t as $,g as S}from"./pb-i18n-375ccc5c.js";import"./paper-icon-button-be4dc644.js";import"./jinn-codemirror-dc6c3c7c.js";const k=(()=>{if("undefined"==typeof self)return!1;if("top"in self&&self!==top)try{top}catch(e){return!1}return"showOpenFilePicker"in self})(),C=(k?Promise.resolve().then((function(){return P})):Promise.resolve().then((function(){return B})),k?Promise.resolve().then((function(){return T})):Promise.resolve().then((function(){return z})),k?Promise.resolve().then((function(){return O})):Promise.resolve().then((function(){return j})));async function A(...e){return(await C).default(...e)}const R=async e=>{const t=await e.getFile();return t.handle=e,t};var P={__proto__:null,default:async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((e,o)=>{t[o]={description:e.description||"Files",accept:{}},e.mimeTypes?e.mimeTypes.map(i=>{t[o].accept[i]=e.extensions||[]}):t[o].accept["*/*"]=e.extensions||[]});const o=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),i=await Promise.all(o.map(R));return e[0].multiple?i:i[0]}};function M(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(M=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var o=this.s.return;return void 0===o?Promise.resolve({value:e,done:!0}):t(o.apply(this.s,arguments))},throw:function(e){var o=this.s.return;return void 0===o?Promise.reject(e):t(o.apply(this.s,arguments))}},new M(e)}const I=async(e,t,o=e.name,i)=>{const s=[],r=[];var a,n=!1,l=!1;try{for(var d,c=function(e){var t,o,i,s=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,i=Symbol.iterator);s--;){if(o&&null!=(t=e[o]))return t.call(e);if(i&&null!=(t=e[i]))return new M(t.call(e));o="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());n=!(d=await c.next()).done;n=!1){const a=d.value,n=`${o}/${a.name}`;"file"===a.kind?r.push(a.getFile().then(t=>(t.directoryHandle=e,t.handle=a,Object.defineProperty(t,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>n})))):"directory"!==a.kind||!t||i&&i(a)||s.push(I(a,t,n,i))}}catch(e){l=!0,a=e}finally{try{n&&null!=c.return&&await c.return()}finally{if(l)throw a}}return[...(await Promise.all(s)).flat(),...await Promise.all(r)]};var T={__proto__:null,default:async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:I(t,e.recursive,void 0,e.skipDirectory)}},O={__proto__:null,default:async(e,t=[{}],o=null,i=!1,s=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const r=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((e,t)=>{r[t]={description:e.description||"Files",accept:{}},e.mimeTypes?(0===t&&a&&e.mimeTypes.push(a),e.mimeTypes.map(o=>{r[t].accept[o]=e.extensions||[]})):a?r[t].accept[a]=e.extensions||[]:r[t].accept["*/*"]=e.extensions||[]}),o)try{await o.getFile()}catch(e){if(o=null,i)throw e}const n=o||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:r,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!o&&s&&s(n);const l=await n.createWritable();if("stream"in e){const t=e.stream();return await t.pipeTo(l),n}return"body"in e?(await e.body.pipeTo(l),n):(await l.write(await e),await l.close(),n)}},B={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,o)=>{const i=document.createElement("input");i.type="file";const s=[...e.map(e=>e.mimeTypes||[]),...e.map(e=>e.extensions||[])].join();i.multiple=e[0].multiple||!1,i.accept=s||"",i.style.display="none",document.body.append(i);const r=e=>{"function"==typeof a&&a(),t(e)},a=e[0].legacySetup&&e[0].legacySetup(r,()=>a(o),i),n=()=>{window.removeEventListener("focus",n),i.remove()};i.addEventListener("click",()=>{window.addEventListener("focus",n)}),i.addEventListener("change",()=>{window.removeEventListener("focus",n),i.remove(),r(i.multiple?Array.from(i.files):i.files[0])}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},z={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,o)=>{const i=document.createElement("input");i.type="file",i.webkitdirectory=!0;const s=e=>{"function"==typeof r&&r(),t(e)},r=e[0].legacySetup&&e[0].legacySetup(s,()=>r(o),i);i.addEventListener("change",()=>{let t=Array.from(i.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(t=t.filter(t=>t.webkitRelativePath.split("/").every(t=>!e[0].skipDirectory({name:t,kind:"directory"})))):t=t.filter(e=>2===e.webkitRelativePath.split("/").length),s(t)}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},j={__proto__:null,default:async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const o=document.createElement("a");let i=e;"body"in e&&(i=await async function(e,t){const o=e.getReader(),i=new ReadableStream({start:e=>async function t(){return o.read().then(({done:o,value:i})=>{if(!o)return e.enqueue(i),t();e.close()})}()}),s=new Response(i),r=await s.blob();return o.releaseLock(),new Blob([r],{type:t})}(e.body,e.headers.get("content-type"))),o.download=t.fileName||"Untitled",o.href=URL.createObjectURL(await i);const s=()=>{"function"==typeof r&&r()},r=t.legacySetup&&t.legacySetup(s,()=>r(),o);return o.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(o.href),3e4),s()}),o.click(),null}};
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as e,h as t,p as n,B as o,d as i,a as s,I as a,T as r,q as l,s as c,D as u,t as p,f as d}from"./paper-checkbox-c9177e35.js";import{a as h}from"./paper-listbox-1fc346ac.js";import{w as m,p as g,L as f,h as y,c as v}from"./pb-mixin-d61c06b6.js";import{t as b}from"./pb-i18n-
|
|
1
|
+
import{P as e,h as t,p as n,B as o,d as i,a as s,I as a,T as r,q as l,s as c,D as u,t as p,f as d}from"./paper-checkbox-c9177e35.js";import{a as h}from"./paper-listbox-1fc346ac.js";import{w as m,p as g,L as f,h as y,c as v}from"./pb-mixin-d61c06b6.js";import{t as b}from"./pb-i18n-375ccc5c.js";import{u as x}from"./paper-icon-button-be4dc644.js";
|
|
2
2
|
/**
|
|
3
3
|
@license
|
|
4
4
|
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
package/i18n/common/en.json
CHANGED
|
@@ -273,7 +273,10 @@
|
|
|
273
273
|
"run": "Run",
|
|
274
274
|
"model": "Select a model",
|
|
275
275
|
"denied": "Unsaved changes found: please store or discard them first."
|
|
276
|
-
}
|
|
276
|
+
},
|
|
277
|
+
"confirm-discard-title": "Discard",
|
|
278
|
+
"confirm-discard": "Discard the list of occurrences?",
|
|
279
|
+
"doc-count": "{{count}} von {{total}}"
|
|
277
280
|
},
|
|
278
281
|
"ner": {
|
|
279
282
|
"title": "Train a Named Entity Recognition Model",
|
package/package.json
CHANGED
package/pb-elements.json
CHANGED
|
@@ -5090,31 +5090,31 @@
|
|
|
5090
5090
|
"path": "./src/pb-i18n.js",
|
|
5091
5091
|
"description": "Insert translated text somewhere on an HTML page. If no translation is found,\ndisplay the contained content.",
|
|
5092
5092
|
"attributes": [
|
|
5093
|
+
{
|
|
5094
|
+
"name": "options",
|
|
5095
|
+
"description": "Optional interpolation parameters to be passed to the\ntranslation function",
|
|
5096
|
+
"type": "object"
|
|
5097
|
+
},
|
|
5093
5098
|
{
|
|
5094
5099
|
"name": "key",
|
|
5095
5100
|
"description": "The i18n key to use for looking up the translation.",
|
|
5096
5101
|
"type": "string",
|
|
5097
5102
|
"default": "\"missing-key\""
|
|
5098
|
-
}
|
|
5103
|
+
}
|
|
5104
|
+
],
|
|
5105
|
+
"properties": [
|
|
5099
5106
|
{
|
|
5100
5107
|
"name": "options",
|
|
5108
|
+
"attribute": "options",
|
|
5101
5109
|
"description": "Optional interpolation parameters to be passed to the\ntranslation function",
|
|
5102
5110
|
"type": "object"
|
|
5103
|
-
}
|
|
5104
|
-
],
|
|
5105
|
-
"properties": [
|
|
5111
|
+
},
|
|
5106
5112
|
{
|
|
5107
5113
|
"name": "key",
|
|
5108
5114
|
"attribute": "key",
|
|
5109
5115
|
"description": "The i18n key to use for looking up the translation.",
|
|
5110
5116
|
"type": "string",
|
|
5111
5117
|
"default": "\"missing-key\""
|
|
5112
|
-
},
|
|
5113
|
-
{
|
|
5114
|
-
"name": "options",
|
|
5115
|
-
"attribute": "options",
|
|
5116
|
-
"description": "Optional interpolation parameters to be passed to the\ntranslation function",
|
|
5117
|
-
"type": "object"
|
|
5118
5118
|
}
|
|
5119
5119
|
]
|
|
5120
5120
|
},
|
|
@@ -5642,6 +5642,10 @@
|
|
|
5642
5642
|
"name": "hash",
|
|
5643
5643
|
"type": "string"
|
|
5644
5644
|
},
|
|
5645
|
+
{
|
|
5646
|
+
"name": "xpath",
|
|
5647
|
+
"type": "string"
|
|
5648
|
+
},
|
|
5645
5649
|
{
|
|
5646
5650
|
"name": "path",
|
|
5647
5651
|
"description": "Browse to a different document",
|
|
@@ -5718,6 +5722,11 @@
|
|
|
5718
5722
|
"attribute": "hash",
|
|
5719
5723
|
"type": "string"
|
|
5720
5724
|
},
|
|
5725
|
+
{
|
|
5726
|
+
"name": "xpath",
|
|
5727
|
+
"attribute": "xpath",
|
|
5728
|
+
"type": "string"
|
|
5729
|
+
},
|
|
5721
5730
|
{
|
|
5722
5731
|
"name": "path",
|
|
5723
5732
|
"attribute": "path",
|
|
@@ -11938,6 +11947,10 @@
|
|
|
11938
11947
|
}
|
|
11939
11948
|
],
|
|
11940
11949
|
"events": [
|
|
11950
|
+
{
|
|
11951
|
+
"name": "pb-annotations-loaded",
|
|
11952
|
+
"description": "fired after text was loaded and annotations were drawn"
|
|
11953
|
+
},
|
|
11941
11954
|
{
|
|
11942
11955
|
"name": "pb-selection-changed",
|
|
11943
11956
|
"description": "fired when user selects text"
|
|
@@ -78,7 +78,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
|
|
|
78
78
|
return html`
|
|
79
79
|
<paper-input
|
|
80
80
|
id="query"
|
|
81
|
-
label="${translate('
|
|
81
|
+
label="${translate('annotations.lookup')}"
|
|
82
82
|
always-float-label
|
|
83
83
|
value="${this.query}"
|
|
84
84
|
@change="${this._queryChanged}"
|
package/src/pb-i18n.js
CHANGED
|
@@ -128,7 +128,7 @@ export class PbI18n extends LitElement {
|
|
|
128
128
|
constructor() {
|
|
129
129
|
super();
|
|
130
130
|
this.key = 'missing-key';
|
|
131
|
-
this.
|
|
131
|
+
this._options = null;
|
|
132
132
|
this._translated = null;
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -142,8 +142,13 @@ export class PbI18n extends LitElement {
|
|
|
142
142
|
this._translate();
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
set options(value) {
|
|
146
|
+
this._options = value;
|
|
147
|
+
this._translate();
|
|
148
|
+
}
|
|
149
|
+
|
|
145
150
|
_translate() {
|
|
146
|
-
const transl = get(this.key, this.
|
|
151
|
+
const transl = get(this.key, this._options);
|
|
147
152
|
if (transl && transl !== this.key) {
|
|
148
153
|
this._translated = transl;
|
|
149
154
|
} else {
|
package/src/pb-link.js
CHANGED
|
@@ -29,6 +29,10 @@ export class PbLink extends pbMixin(LitElement) {
|
|
|
29
29
|
type: String,
|
|
30
30
|
reflect: true
|
|
31
31
|
},
|
|
32
|
+
xpath: {
|
|
33
|
+
type: String,
|
|
34
|
+
reflect: true
|
|
35
|
+
},
|
|
32
36
|
/** Browse to a different document */
|
|
33
37
|
path: {
|
|
34
38
|
type: String
|
|
@@ -117,6 +121,9 @@ export class PbLink extends pbMixin(LitElement) {
|
|
|
117
121
|
if (this.view) {
|
|
118
122
|
params.view = this.view;
|
|
119
123
|
}
|
|
124
|
+
if (this.xpath) {
|
|
125
|
+
params.xpath = this.xpath;
|
|
126
|
+
}
|
|
120
127
|
if (this.params) {
|
|
121
128
|
Object.assign(params, this.params);
|
|
122
129
|
}
|
package/src/pb-split-list.js
CHANGED
|
@@ -111,7 +111,7 @@ export class PbSplitList extends themableMixin(pbMixin(LitElement)) {
|
|
|
111
111
|
registry.subscribe(this, (state) => {
|
|
112
112
|
console.log('<pb-split-list> popstate: %o', state);
|
|
113
113
|
this.selected = state.category;
|
|
114
|
-
this.submit();
|
|
114
|
+
this.submit(false);
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -126,19 +126,21 @@ export class PbSplitList extends themableMixin(pbMixin(LitElement)) {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
submit() {
|
|
130
|
-
this.load();
|
|
129
|
+
submit(commit = true) {
|
|
130
|
+
this.load(commit);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
load() {
|
|
133
|
+
load(commit = true) {
|
|
134
134
|
const formParams = this._paramsFromSubforms({});
|
|
135
135
|
if (this.selected) {
|
|
136
136
|
formParams.category = this.selected;
|
|
137
137
|
}
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
if (commit) {
|
|
139
|
+
if (!this._initialized) {
|
|
140
|
+
registry.replace(this, formParams);
|
|
141
|
+
} else {
|
|
142
|
+
registry.commit(this, formParams);
|
|
143
|
+
}
|
|
142
144
|
}
|
|
143
145
|
this._initialized = true;
|
|
144
146
|
|
package/src/pb-view-annotate.js
CHANGED
|
@@ -215,6 +215,7 @@ function clearProperties(teiRange) {
|
|
|
215
215
|
* The class itself does not provide any editing facility, except for
|
|
216
216
|
* handling deletions.
|
|
217
217
|
*
|
|
218
|
+
* @fires pb-annotations-loaded - fired after text was loaded and annotations were drawn
|
|
218
219
|
* @fires pb-selection-changed - fired when user selects text
|
|
219
220
|
* @fires pb-annotations-changed - fired when an annotation was added or changed
|
|
220
221
|
* @fires pb-annotation-detail - fired to request additional details about an annotation
|
|
@@ -335,6 +336,7 @@ class PbViewAnnotate extends PbView {
|
|
|
335
336
|
set annotations(annoData) {
|
|
336
337
|
this._ranges = annoData;
|
|
337
338
|
this.updateAnnotations(true);
|
|
339
|
+
this._markIncompleteAnnotations();
|
|
338
340
|
this._initAnnotationColors();
|
|
339
341
|
this._annotationStyles();
|
|
340
342
|
}
|
|
@@ -426,6 +428,7 @@ class PbViewAnnotate extends PbView {
|
|
|
426
428
|
this.scrollTop = this._scrollTop;
|
|
427
429
|
this._scrollTop = undefined;
|
|
428
430
|
}
|
|
431
|
+
this.emitTo('pb-annotations-loaded');
|
|
429
432
|
}, 300));
|
|
430
433
|
}
|
|
431
434
|
|
|
@@ -511,6 +514,10 @@ class PbViewAnnotate extends PbView {
|
|
|
511
514
|
break;
|
|
512
515
|
case 'modify':
|
|
513
516
|
span = this.shadowRoot.querySelector(`[data-tei="${teiRange.node}"]`);
|
|
517
|
+
if (!span) {
|
|
518
|
+
console.error('<pb-view-annotate> Target node not found for %o', teiRange.node);
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
514
521
|
span.dataset.annotation = JSON.stringify(teiRange.properties);
|
|
515
522
|
break;
|
|
516
523
|
default:
|
|
@@ -997,6 +1004,8 @@ class PbViewAnnotate extends PbView {
|
|
|
997
1004
|
const key = this.getKey(annotation.dataset.type);
|
|
998
1005
|
if (!data[key] || data[key].length === 0) {
|
|
999
1006
|
annotation.classList.add('incomplete');
|
|
1007
|
+
} else {
|
|
1008
|
+
annotation.classList.remove('incomplete');
|
|
1000
1009
|
}
|
|
1001
1010
|
}
|
|
1002
1011
|
});
|
package/dist/pb-i18n-9000294c.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as t,L as e,N as n,A as s}from"./pb-mixin-d61c06b6.js";const i=new Map;let a;function r(t){a=t}function o(t){return t instanceof n?t.startNode.isConnected:t instanceof s?t.committer.element.isConnected:t.element.isConnected}function c(){Object.keys(i).forEach(t=>{o(t)||i.delete(t)})}function l(t){"requestIdleCallback"in window?window.requestIdleCallback(t):setTimeout(t)}function d(t,e){const n=e();t.value!==n&&(t.setValue(n),t.commit())}function u(t){a=t.t,i.forEach((t,e)=>{o(e)&&d(e,t)})}function p(t,e){return a?a(t,e):t}const h=t(t=>e=>{i.set(e,t),d(e,t)}),b=(t,e)=>h(()=>p(t,e));document.addEventListener("pb-i18n-update",t=>{u(t.detail)}),setInterval(()=>l(()=>c()),6e4);class f extends e{static get properties(){return Object.assign(Object.assign({},super.properties),{},{key:{type:String},options:{type:Object},_translated:{type:String}})}constructor(){super(),this.key="missing-key",this.options=null,this._translated=null}connectedCallback(){super.connectedCallback(),this._fallback=this.innerHTML,document.addEventListener("pb-i18n-update",this._translate.bind(this)),this._translate()}_translate(){const t=p(this.key,this.options);t&&t!==this.key?this._translated=t:this._translated=null}render(){return this._translated?this._translated:this._fallback}createRenderRoot(){return this}}customElements.define("pb-i18n",f);export{p as g,r as i,b as t};
|