@teipublisher/pb-components 2.4.8 → 2.5.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.
@@ -1,4 +1,4 @@
1
- import"./paper-checkbox-102e3b43.js";import{p as e,L as t,w as p,h as o,c as a}from"./pb-mixin-47974747.js";import{t as i}from"./pb-i18n-aa0bfb74.js";import"./iron-form-9e72ac45.js";class n extends(e(t)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{error:{type:String},url:{type:String},templates:{type:Array},odds:{type:Array}})}constructor(){super(),this.templates=[],this.odds=[]}connectedCallback(){super.connectedCallback()}firstUpdated(){const e=this.shadowRoot.getElementById("form"),t=this.shadowRoot.getElementById("defaultView"),o=this.shadowRoot.getElementById("index"),a=this.shadowRoot.getElementById("template");this.subscribeTo("pb-i18n-update",e=>{const t=this.shadowRoot.querySelector("#defaultView paper-listbox");let p=t.selected;t.selected=void 0,t.selected=p;const o=this.shadowRoot.querySelector("#index paper-listbox");p=o.selected,o.selected=void 0,o.selected=p},[]),p("pb-page-ready",e=>{let t;t=this.minApiVersion("1.0.0")?e.endpoint+"/api/templates":e.endpoint+"/modules/lib/components-list-templates.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.templates=e}),t=this.minApiVersion("1.0.0")?e.endpoint+"/api/odd":e.endpoint+"/modules/lib/components-list-odds.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.odds=e});const p=this.shadowRoot.querySelector("form");this.minApiVersion("1.0.0")?p.action=e.endpoint+"/api/apps/generate":p.action=e.endpoint+"/modules/components-generate.xql"}),e.addEventListener("iron-form-presubmit",(function(){const e=t.selectedItem.getAttribute("value");this.request.body["default-view"]=e,this.request.body.index=o.selectedItem.getAttribute("value"),this.request.body.template=a.selectedItem.getAttribute("value")})),e.addEventListener("iron-form-response",e=>{console.log(e),e.detail.completes.then(e=>{this.emitTo("pb-end-update");const t=e.parseResponse();if(console.log("<pb-edit-app> Received response: %o",t),t.target){const e=window.location.href.replace(/^(.*)\/tei-publisher\/.*/,"$1");this.url=e+"/"+this.shadowRoot.querySelector("paper-input[name=abbrev]").value,this.error=null}else this.error=t.description;this.shadowRoot.getElementById("dialog").open()})}),e.addEventListener("iron-form-error",e=>{this.emitTo("pb-end-update"),console.log("<pb-edit-app> Received response: %o",e.detail.request.response),this.error=e.detail.request.response.description,this.shadowRoot.getElementById("dialog").open()}),e.addEventListener("iron-form-invalid",()=>this.emitTo("pb-end-update"))}_doSubmit(){this.emitTo("pb-start-update");this.shadowRoot.getElementById("form").submit()}render(){return o`
1
+ import"./paper-checkbox-102e3b43.js";import{p as e,L as t,w as p,h as o,c as a}from"./pb-mixin-ea2e9070.js";import{t as i}from"./pb-i18n-f7a50012.js";import"./iron-form-9e72ac45.js";class n extends(e(t)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{error:{type:String},url:{type:String},templates:{type:Array},odds:{type:Array}})}constructor(){super(),this.templates=[],this.odds=[]}connectedCallback(){super.connectedCallback()}firstUpdated(){const e=this.shadowRoot.getElementById("form"),t=this.shadowRoot.getElementById("defaultView"),o=this.shadowRoot.getElementById("index"),a=this.shadowRoot.getElementById("template");this.subscribeTo("pb-i18n-update",e=>{const t=this.shadowRoot.querySelector("#defaultView paper-listbox");let p=t.selected;t.selected=void 0,t.selected=p;const o=this.shadowRoot.querySelector("#index paper-listbox");p=o.selected,o.selected=void 0,o.selected=p},[]),p("pb-page-ready",e=>{let t;t=this.minApiVersion("1.0.0")?e.endpoint+"/api/templates":e.endpoint+"/modules/lib/components-list-templates.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.templates=e}),t=this.minApiVersion("1.0.0")?e.endpoint+"/api/odd":e.endpoint+"/modules/lib/components-list-odds.xql",fetch(t,{method:"GET",mode:"cors",credentials:"same-origin"}).then(e=>e.json()).then(e=>{this.odds=e});const p=this.shadowRoot.querySelector("form");this.minApiVersion("1.0.0")?p.action=e.endpoint+"/api/apps/generate":p.action=e.endpoint+"/modules/components-generate.xql"}),e.addEventListener("iron-form-presubmit",(function(){const e=t.selectedItem.getAttribute("value");this.request.body["default-view"]=e,this.request.body.index=o.selectedItem.getAttribute("value"),this.request.body.template=a.selectedItem.getAttribute("value")})),e.addEventListener("iron-form-response",e=>{console.log(e),e.detail.completes.then(e=>{this.emitTo("pb-end-update");const t=e.parseResponse();if(console.log("<pb-edit-app> Received response: %o",t),t.target){const e=window.location.href.replace(/^(.*)\/tei-publisher\/.*/,"$1");this.url=e+"/"+this.shadowRoot.querySelector("paper-input[name=abbrev]").value,this.error=null}else this.error=t.description;this.shadowRoot.getElementById("dialog").open()})}),e.addEventListener("iron-form-error",e=>{this.emitTo("pb-end-update"),console.log("<pb-edit-app> Received response: %o",e.detail.request.response),this.error=e.detail.request.response.description,this.shadowRoot.getElementById("dialog").open()}),e.addEventListener("iron-form-invalid",()=>this.emitTo("pb-end-update"))}_doSubmit(){this.emitTo("pb-start-update");this.shadowRoot.getElementById("form").submit()}render(){return o`
2
2
  <iron-form id="form">
3
3
  <form method="POST" accept="application/json" enctype="application/json">
4
4
  <fieldset>
@@ -8183,6 +8183,17 @@
8183
8183
  "type": "boolean",
8184
8184
  "default": "false"
8185
8185
  },
8186
+ {
8187
+ "name": "supported-languages",
8188
+ "description": "Comma-separated list of languages supported. If the detected language\nis not in this list, fall back to the configured fallback language.",
8189
+ "type": "array"
8190
+ },
8191
+ {
8192
+ "name": "fallback-language",
8193
+ "description": "The fallback language to use if the detected language is not supported.\nDefaults to 'en'.",
8194
+ "type": "string",
8195
+ "default": "\"en\""
8196
+ },
8186
8197
  {
8187
8198
  "name": "theme",
8188
8199
  "type": "string"
@@ -8295,6 +8306,19 @@
8295
8306
  "type": "boolean",
8296
8307
  "default": "false"
8297
8308
  },
8309
+ {
8310
+ "name": "supportedLanguages",
8311
+ "attribute": "supported-languages",
8312
+ "description": "Comma-separated list of languages supported. If the detected language\nis not in this list, fall back to the configured fallback language.",
8313
+ "type": "array"
8314
+ },
8315
+ {
8316
+ "name": "fallbackLanguage",
8317
+ "attribute": "fallback-language",
8318
+ "description": "The fallback language to use if the detected language is not supported.\nDefaults to 'en'.",
8319
+ "type": "string",
8320
+ "default": "\"en\""
8321
+ },
8298
8322
  {
8299
8323
  "name": "theme",
8300
8324
  "attribute": "theme",
@@ -11433,8 +11457,7 @@
11433
11457
  {
11434
11458
  "name": "not-found",
11435
11459
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
11436
- "type": "string",
11437
- "default": "\"the server did not return any content\""
11460
+ "type": "string"
11438
11461
  },
11439
11462
  {
11440
11463
  "name": "animation",
@@ -11635,8 +11658,7 @@
11635
11658
  "name": "notFound",
11636
11659
  "attribute": "not-found",
11637
11660
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
11638
- "type": "string",
11639
- "default": "\"the server did not return any content\""
11661
+ "type": "string"
11640
11662
  },
11641
11663
  {
11642
11664
  "name": "animation",
@@ -11919,8 +11941,7 @@
11919
11941
  {
11920
11942
  "name": "not-found",
11921
11943
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
11922
- "type": "string",
11923
- "default": "\"the server did not return any content\""
11944
+ "type": "string"
11924
11945
  },
11925
11946
  {
11926
11947
  "name": "animation",
@@ -12097,8 +12118,7 @@
12097
12118
  "name": "notFound",
12098
12119
  "attribute": "not-found",
12099
12120
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
12100
- "type": "string",
12101
- "default": "\"the server did not return any content\""
12121
+ "type": "string"
12102
12122
  },
12103
12123
  {
12104
12124
  "name": "animation",
@@ -1 +1 @@
1
- import{f as t,L as e,N as n,A as s}from"./pb-mixin-47974747.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)}),f=(t,e)=>h(()=>p(t,e));document.addEventListener("pb-i18n-update",t=>{u(t.detail)}),setInterval(()=>l(()=>c()),6e4);class b 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",b);export{p as g,r as i,f as t};
1
+ import{f as t,L as e,N as n,A as s}from"./pb-mixin-ea2e9070.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)}),f=(t,e)=>h(()=>p(t,e));document.addEventListener("pb-i18n-update",t=>{u(t.detail)}),setInterval(()=>l(()=>c()),6e4);class b 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",b);export{p as g,r as i,f as t};
@@ -1,4 +1,4 @@
1
- import{L as t,p as e,r as i,h as s,c as a}from"./pb-mixin-47974747.js";import"./es-global-bridge-6abe3a88.js";const o=["type","url","label","base","show"];class r extends t{static get properties(){return{type:{type:String},url:{type:String},base:{type:Boolean},show:{type:Boolean},label:{type:String},attribution:{type:String},minZoom:{type:Number,attribute:"min-zoom"},maxZoom:{type:Number,attribute:"max-zoom"},zoomOffset:{type:Number,attribute:"zoom-offset"},opacity:{type:Number},tileSize:{type:Number},id:{type:String},accessToken:{type:String,attribute:"access-token"}}}constructor(){super(),this.type="tile",this.url=null}get options(){const t={};return Object.keys(r.properties).forEach(e=>{o.indexOf(e)<0&&this[e]&&(t[e]=this[e])}),console.log("<pb-leaflet-map-layer> Options: %o",t),t}async data(){return new Promise(t=>{fetch(this.url).then(t=>t.json()).then(e=>t(e))})}}function l(t,e){try{return t.split(/\s*,\s*/).map(t=>parseInt(t,10))}catch(e){return console.error("<pb-map-icon> Invalid size specified: "+t),null}}customElements.define("pb-map-layer",r);class n extends t{static get properties(){return{name:{type:String},iconUrl:{type:String,attribute:"icon-url"},iconSize:{type:Array,converter:l,attribute:"icon-size"},iconAnchor:{type:Array,converter:l,attribute:"icon-anchor"},shadowUrl:{type:String,attribute:"shadow-url"},shadowSize:{type:Array,converter:l,attribute:"shadow-size"},shadowAnchor:{type:Array,converter:l,attribute:"shadow-anchor"},popupAncor:{type:Array,converter:l,attribute:"popup-anchor"}}}constructor(){super(),this.name="default",this.type="image",this.iconUrl=null}get options(){const t={};return Object.keys(n.properties).forEach(e=>{this[e]&&(t[e]=this[e])}),console.log("<pb-map-icon> Options: %o",t),t}}customElements.define("pb-map-icon",n);class c extends(e(t)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{latitude:{type:Number},longitude:{type:Number},zoom:{type:Number},crs:{type:String},fitMarkers:{type:Boolean,attribute:"fit-markers"},cluster:{type:Boolean},disableClusteringAt:{type:Number,attribute:"disable-clustering-at"},noScroll:{type:Boolean,attribute:"no-scroll"},accessToken:{type:String,attribute:"access-token"},toggle:{type:Boolean},imagesPath:{type:String,attribute:"images-path"},cssPath:{type:String,attribute:"css-path"},_map:{type:Object}})}constructor(){super(),this.latitude=51.505,this.longitude=-.09,this.zoom=15,this.crs="EPSG3857",this.accessToken="",this.imagesPath="../images/leaflet/",this.cssPath="../css/leaflet",this.toggle=!1,this.noScroll=!1,this.disabled=!0,this.cluster=!1,this.fitMarkers=!1,this.disableClusteringAt=null,this._icons={}}connectedCallback(){super.connectedCallback(),this._layers=this.querySelectorAll("pb-map-layer"),this._markers=this.querySelectorAll("pb-map-icon"),this.subscribeTo("pb-update-map",t=>{this._markerLayer.clearLayers(),t.detail.forEach(t=>{const e=L.marker([t.latitude,t.longitude]);t.label&&e.bindTooltip(t.label),e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),e.bindTooltip(t.label),this.setMarkerIcon(e),this._markerLayer.addLayer(e)}),this._fitBounds()}),this.subscribeTo("pb-update",t=>{this._markerLayer.clearLayers();t.detail.root.querySelectorAll("pb-geolocation").forEach(t=>{const e=L.latLng(t.latitude,t.longitude),i=L.marker(e).addTo(this._markerLayer);t.label&&i.bindTooltip(t.label),t.popup&&i.bindPopup(t.popup),i.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),this.setMarkerIcon(i)}),this._fitBounds()}),this.subscribeTo("pb-geolocation",t=>{if(t.detail.coordinates){if(this.latitude=t.detail.coordinates.latitude,this.longitude=t.detail.coordinates.longitude,this._hasMarker(this.latitude,this.longitude))console.log("<pb-leaflet-map> Marker already added to map");else{const e=L.marker([this.latitude,this.longitude]);e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t.detail.element)}),t.detail.label&&e.bindTooltip(t.detail.label),t.detail.popup&&e.bindPopup(t.detail.popup),this.setMarkerIcon(e),e.addTo(this._markerLayer),t.detail.fitBounds&&this._fitBounds(),console.log("<pb-leaflet-map> added marker")}this.toggle&&(this.disabled=!1);const e=t.detail.event;this._locationChanged(this.latitude,this.longitude,t.detail.zoom,e)}})}get map(){return this._map}setMarkerIcon(t){this._icons&&this._icons.default&&t.setIcon(this._icons.default)}firstUpdated(){this.toggle||(this.disabled=!1),window.ESGlobalBridge.requestAvailability();const t=i("../lib/leaflet-src.js"),e=i("../lib/leaflet.markercluster-src.js");window.ESGlobalBridge.instance.load("leaflet",t).then(()=>window.ESGlobalBridge.instance.load("plugin",e)),window.addEventListener("es-bridge-plugin-loaded",this._initMap.bind(this),{once:!0})}render(){const t=i(this.cssPath);return s`
1
+ import{L as t,p as e,r as i,h as s,c as a}from"./pb-mixin-ea2e9070.js";import"./es-global-bridge-6abe3a88.js";const o=["type","url","label","base","show"];class r extends t{static get properties(){return{type:{type:String},url:{type:String},base:{type:Boolean},show:{type:Boolean},label:{type:String},attribution:{type:String},minZoom:{type:Number,attribute:"min-zoom"},maxZoom:{type:Number,attribute:"max-zoom"},zoomOffset:{type:Number,attribute:"zoom-offset"},opacity:{type:Number},tileSize:{type:Number},id:{type:String},accessToken:{type:String,attribute:"access-token"}}}constructor(){super(),this.type="tile",this.url=null}get options(){const t={};return Object.keys(r.properties).forEach(e=>{o.indexOf(e)<0&&this[e]&&(t[e]=this[e])}),console.log("<pb-leaflet-map-layer> Options: %o",t),t}async data(){return new Promise(t=>{fetch(this.url).then(t=>t.json()).then(e=>t(e))})}}function l(t,e){try{return t.split(/\s*,\s*/).map(t=>parseInt(t,10))}catch(e){return console.error("<pb-map-icon> Invalid size specified: "+t),null}}customElements.define("pb-map-layer",r);class n extends t{static get properties(){return{name:{type:String},iconUrl:{type:String,attribute:"icon-url"},iconSize:{type:Array,converter:l,attribute:"icon-size"},iconAnchor:{type:Array,converter:l,attribute:"icon-anchor"},shadowUrl:{type:String,attribute:"shadow-url"},shadowSize:{type:Array,converter:l,attribute:"shadow-size"},shadowAnchor:{type:Array,converter:l,attribute:"shadow-anchor"},popupAncor:{type:Array,converter:l,attribute:"popup-anchor"}}}constructor(){super(),this.name="default",this.type="image",this.iconUrl=null}get options(){const t={};return Object.keys(n.properties).forEach(e=>{this[e]&&(t[e]=this[e])}),console.log("<pb-map-icon> Options: %o",t),t}}customElements.define("pb-map-icon",n);class c extends(e(t)){static get properties(){return Object.assign(Object.assign({},super.properties),{},{latitude:{type:Number},longitude:{type:Number},zoom:{type:Number},crs:{type:String},fitMarkers:{type:Boolean,attribute:"fit-markers"},cluster:{type:Boolean},disableClusteringAt:{type:Number,attribute:"disable-clustering-at"},noScroll:{type:Boolean,attribute:"no-scroll"},accessToken:{type:String,attribute:"access-token"},toggle:{type:Boolean},imagesPath:{type:String,attribute:"images-path"},cssPath:{type:String,attribute:"css-path"},_map:{type:Object}})}constructor(){super(),this.latitude=51.505,this.longitude=-.09,this.zoom=15,this.crs="EPSG3857",this.accessToken="",this.imagesPath="../images/leaflet/",this.cssPath="../css/leaflet",this.toggle=!1,this.noScroll=!1,this.disabled=!0,this.cluster=!1,this.fitMarkers=!1,this.disableClusteringAt=null,this._icons={}}connectedCallback(){super.connectedCallback(),this._layers=this.querySelectorAll("pb-map-layer"),this._markers=this.querySelectorAll("pb-map-icon"),this.subscribeTo("pb-update-map",t=>{this._markerLayer.clearLayers(),t.detail.forEach(t=>{const e=L.marker([t.latitude,t.longitude]);t.label&&e.bindTooltip(t.label),e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),e.bindTooltip(t.label),this.setMarkerIcon(e),this._markerLayer.addLayer(e)}),this._fitBounds()}),this.subscribeTo("pb-update",t=>{this._markerLayer.clearLayers();t.detail.root.querySelectorAll("pb-geolocation").forEach(t=>{const e=L.latLng(t.latitude,t.longitude),i=L.marker(e).addTo(this._markerLayer);t.label&&i.bindTooltip(t.label),t.popup&&i.bindPopup(t.popup),i.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t)}),this.setMarkerIcon(i)}),this._fitBounds()}),this.subscribeTo("pb-geolocation",t=>{if(t.detail.coordinates){if(this.latitude=t.detail.coordinates.latitude,this.longitude=t.detail.coordinates.longitude,this._hasMarker(this.latitude,this.longitude))console.log("<pb-leaflet-map> Marker already added to map");else{const e=L.marker([this.latitude,this.longitude]);e.addEventListener("click",()=>{this.emitTo("pb-leaflet-marker-click",t.detail.element)}),t.detail.label&&e.bindTooltip(t.detail.label),t.detail.popup&&e.bindPopup(t.detail.popup),this.setMarkerIcon(e),e.addTo(this._markerLayer),t.detail.fitBounds&&this._fitBounds(),console.log("<pb-leaflet-map> added marker")}this.toggle&&(this.disabled=!1);const e=t.detail.event;this._locationChanged(this.latitude,this.longitude,t.detail.zoom,e)}})}get map(){return this._map}setMarkerIcon(t){this._icons&&this._icons.default&&t.setIcon(this._icons.default)}firstUpdated(){this.toggle||(this.disabled=!1),window.ESGlobalBridge.requestAvailability();const t=i("../lib/leaflet-src.js"),e=i("../lib/leaflet.markercluster-src.js");window.ESGlobalBridge.instance.load("leaflet",t).then(()=>window.ESGlobalBridge.instance.load("plugin",e)),window.addEventListener("es-bridge-plugin-loaded",this._initMap.bind(this),{once:!0})}render(){const t=i(this.cssPath);return s`
2
2
  <link rel="Stylesheet" href="${t}/leaflet.css">
3
3
  <link rel="Stylesheet" href="${t}/MarkerCluster.Default.css">
4
4
  <div id="map" style="height: 100%; width: 100%"></div>
@@ -155,4 +155,4 @@ const at=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeSha
155
155
  * subject to an additional IP rights grant found at
156
156
  * http://polymer.github.io/PATENTS.txt
157
157
  */
158
- (window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const pt={};class mt extends ot{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,s)=>t.reduceRight((t,s)=>Array.isArray(s)?e(s,t):(t.add(s),t),s),s=e(t,new Set),i=[];s.forEach(t=>i.unshift(t)),this._styles=i}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!at){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return ht(e)}return t})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?at?this.renderRoot.adoptedStyleSheets=t.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==pt&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){return pt}}function _t(t){const e=document.querySelector("script[src*=pb-components]");return e?new URL(t,e.src).href:new URL(t,window.location.href).href}function ft(t,e){var s,i,n;for(t=(t+"").split("."),e=(e+"").split("."),n=Math.max(t.length,e.length),s=0;s<n;s++)if(void 0===t[s]&&(t[s]="0"),void 0===e[s]&&(e[s]="0"),0!==(i=parseInt(t[s],10)-parseInt(e[s],10)))return i<0?-1:1;return 0}function yt(t,e){return ft(t,e)>=0}function gt(t,e,s){const i=getComputedStyle(t).getPropertyValue(e);if(i)try{return JSON.parse(i)}catch(t){return s}return s}mt.finalized=!0,mt.render=Q,mt.shadowRootOptions={mode:"open"},window.TeiPublisher||(window.TeiPublisher={},TeiPublisher.url=new URL(window.location.href));const St=new Set,bt=new Map,wt="__default__";function vt(){bt.clear()}function Pt(t,e){bt.has(t)?e(bt.get(t)):document.addEventListener(t,s=>{bt.set(t,s.detail),e(s.detail)},{once:!0})}function xt(t){const e=t.getAttribute("emit-config");if(e){const t=JSON.parse(e);return Object.keys(t)}const s=t.getAttribute("emit");return s?[s]:[wt]}function Ct(t){const e=t.getAttribute("subscribe-config");if(e){const t=JSON.parse(e);return Object.keys(t)}const s=t.getAttribute("subscribe");return s?[s]:[wt]}const Nt=t=>class extends t{static get properties(){return{subscribe:{type:String},subscribeConfig:{type:Object,attribute:"subscribe-config"},emit:{type:String},emitConfig:{type:Object,attribute:"emit-config"},waitFor:{type:String,attribute:"wait-for"},_isReady:{type:Boolean},disabled:{type:Boolean,reflect:!0},_endpoint:{type:String},_apiVersion:{type:String}}}constructor(){super(),this._isReady=!1,this.disabled=!1,this._subscriptions=new Map}connectedCallback(){super.connectedCallback(),Pt("pb-page-ready",t=>{this._endpoint=t.endpoint,this._apiVersion=t.apiVersion})}disconnectedCallback(){super.disconnectedCallback(),this._subscriptions.forEach((t,e)=>{t.forEach(t=>{document.removeEventListener(e,t)})})}command(t,e){"disable"===t&&(this.disabled=e)}wait(t){if(!this.waitFor)return void t();const e=Array.from(document.querySelectorAll(this.waitFor)).filter(t=>this.emitsOnSameChannel(t)),s=e.length;if(0===s)return void t();let i=s;e.forEach(e=>{if(e._isReady)return i-=1,void(0===i&&t());const s=e.addEventListener("pb-ready",n=>{n.detail.source!==this&&(i-=1,0===i&&(e.removeEventListener("pb-ready",s),t()))})})}waitForChannel(t){if(this.subscribeConfig)for(const e in this.subscribeConfig)this.subscribeConfig[e].forEach(s=>{if("pb-ready"===s&&St.has(e))return t()});else if(this.subscribe&&St.has(this.subscribe)||!this.subscribe&&St.has("__default__"))return t();const e=this.subscribeTo("pb-ready",s=>{s.detail._source!=this&&(e.forEach(t=>document.removeEventListener("pb-ready",t)),t())})}static waitOnce(t,e){Pt(t,e)}signalReady(t="pb-ready",e){this._isReady=!0,bt.set(t,e),this.dispatchEvent(new CustomEvent(t,{detail:{data:e,source:this}})),this.emitTo(t,e)}emitsOnSameChannel(t){const e=Ct(this),s=xt(t);return 0===e.length&&0===s.length||e.some(t=>s.includes(t))}subscribeTo(t,e,s=[]){const i=(s&&s.length?s:Ct(this)).map(s=>{const i=t=>{t.detail&&t.detail.key&&t.detail.key===s&&e(t)};return document.addEventListener(t,i),i});return this._subscriptions.set(t,i),i}emitTo(t,e,s=[]){(s&&s.length?s:xt(this)).forEach(s=>this._emit(s,t,e))}_emit(t,e,s){"pb-ready"===e&&St.add(t);const i=Object.assign({key:t,_source:this},s),n=new CustomEvent(e,{detail:i,composed:!0,bubbles:!0});this.dispatchEvent(n)}getDocument(){if(this.src){const t=document.getElementById(this.src);if(t)return t}return null}getParameter(t,e){const s=TeiPublisher.url.searchParams&&TeiPublisher.url.searchParams.getAll(t);return s&&1==s.length?s[0]:s&&s.length>1?s:e}getParameters(){const t={};for(let e of TeiPublisher.url.searchParams.keys())t[e]=this.getParameter(e);return t}getUrl(){return TeiPublisher.url}getEndpoint(){return this._endpoint}toAbsoluteURL(t,e){if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t))return t;const s=""===e?"":e||this.getEndpoint();let i;return i="."===s?new URL(window.location.href):"about:"===window.location.protocol?document.baseURI:new URL(s+"/",`${window.location.protocol}//${window.location.host}`),new URL(t,i).href}minApiVersion(t){return ft(this._apiVersion,t)>=0}lessThanApiVersion(t){return ft(this._apiVersion,t)<0}compareApiVersion(t){return ft(this._apiVersion,t)}};export{A,mt as L,V as N,Ct as a,ft as b,ut as c,wt as d,vt as e,g as f,gt as g,$ as h,N as i,h as j,e as k,s as l,yt as m,Nt as p,_t as r,Pt as w};
158
+ (window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const pt={};class mt extends ot{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,s)=>t.reduceRight((t,s)=>Array.isArray(s)?e(s,t):(t.add(s),t),s),s=e(t,new Set),i=[];s.forEach(t=>i.unshift(t)),this._styles=i}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!at){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return ht(e)}return t})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?at?this.renderRoot.adoptedStyleSheets=t.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==pt&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){return pt}}function _t(t){const e=document.querySelector("script[src*=pb-components]");return e?new URL(t,e.src).href:new URL(t,window.location.href).href}function ft(t,e){var s,i,n;for(t=(t+"").split("."),e=(e+"").split("."),n=Math.max(t.length,e.length),s=0;s<n;s++)if(void 0===t[s]&&(t[s]="0"),void 0===e[s]&&(e[s]="0"),0!==(i=parseInt(t[s],10)-parseInt(e[s],10)))return i<0?-1:1;return 0}function yt(t,e){return ft(t,e)>=0}function gt(t,e,s){const i=getComputedStyle(t).getPropertyValue(e);if(i)try{return JSON.parse(i)}catch(t){return s}return s}mt.finalized=!0,mt.render=Q,mt.shadowRootOptions={mode:"open"},window.TeiPublisher||(window.TeiPublisher={},TeiPublisher.url=new URL(window.location.href));const St=new Set,bt=new Map,wt="__default__";function vt(){bt.clear()}function Pt(t,e){bt.has(t)?e(bt.get(t)):document.addEventListener(t,s=>{bt.set(t,s.detail),e(s.detail)},{once:!0})}function xt(t){const e=t.getAttribute("emit-config");if(e){const t=JSON.parse(e);return Object.keys(t)}const s=t.getAttribute("emit");return s?[s]:[wt]}function Ct(t){const e=t.getAttribute("subscribe-config");if(e){const t=JSON.parse(e);return Object.keys(t)}const s=t.getAttribute("subscribe");return s?[s]:[wt]}const Nt=t=>class extends t{static get properties(){return{subscribe:{type:String},subscribeConfig:{type:Object,attribute:"subscribe-config"},emit:{type:String},emitConfig:{type:Object,attribute:"emit-config"},waitFor:{type:String,attribute:"wait-for"},_isReady:{type:Boolean},disabled:{type:Boolean,reflect:!0},_endpoint:{type:String},_apiVersion:{type:String}}}constructor(){super(),this._isReady=!1,this.disabled=!1,this._subscriptions=new Map}connectedCallback(){super.connectedCallback(),Pt("pb-page-ready",t=>{this._endpoint=t.endpoint,this._apiVersion=t.apiVersion})}disconnectedCallback(){super.disconnectedCallback(),this._subscriptions.forEach((t,e)=>{t.forEach(t=>{document.removeEventListener(e,t)})})}command(t,e){"disable"===t&&(this.disabled=e)}wait(t){if(!this.waitFor)return void t();const e=Array.from(document.querySelectorAll(this.waitFor)).filter(t=>this.emitsOnSameChannel(t)),s=e.length;if(0===s)return void t();let i=s;e.forEach(e=>{if(e._isReady)return i-=1,void(0===i&&t());const s=e.addEventListener("pb-ready",n=>{n.detail.source!==this&&(i-=1,0===i&&(e.removeEventListener("pb-ready",s),t()))})})}waitForChannel(t){if(this.subscribeConfig)for(const e in this.subscribeConfig)this.subscribeConfig[e].forEach(s=>{if("pb-ready"===s&&St.has(e))return t()});else if(this.subscribe&&St.has(this.subscribe)||!this.subscribe&&St.has("__default__"))return t();const e=this.subscribeTo("pb-ready",s=>{s.detail._source!=this&&(e.forEach(t=>document.removeEventListener("pb-ready",t)),t())})}static waitOnce(t,e){Pt(t,e)}signalReady(t="pb-ready",e){this._isReady=!0,bt.set(t,e),this.dispatchEvent(new CustomEvent(t,{detail:{data:e,source:this}})),this.emitTo(t,e)}emitsOnSameChannel(t){const e=Ct(this),s=xt(t);return 0===e.length&&0===s.length||e.some(t=>s.includes(t))}subscribeTo(t,e,s){let i;i=s?0===s.length?[wt]:s:Ct(this);const n=i.map(s=>{const i=t=>{t.detail&&t.detail.key&&t.detail.key===s&&e(t)};return document.addEventListener(t,i),i});return this._subscriptions.set(t,n),n}emitTo(t,e,s){let i;i=s?0===s.length?[wt]:s:xt(this),i.forEach(s=>this._emit(s,t,e))}_emit(t,e,s){"pb-ready"===e&&St.add(t);const i=Object.assign({key:t,_source:this},s),n=new CustomEvent(e,{detail:i,composed:!0,bubbles:!0});this.dispatchEvent(n)}getDocument(){if(this.src){const t=document.getElementById(this.src);if(t)return t}return null}getParameter(t,e){const s=TeiPublisher.url.searchParams&&TeiPublisher.url.searchParams.getAll(t);return s&&1==s.length?s[0]:s&&s.length>1?s:e}getParameters(){const t={};for(let e of TeiPublisher.url.searchParams.keys())t[e]=this.getParameter(e);return t}getUrl(){return TeiPublisher.url}getEndpoint(){return this._endpoint}toAbsoluteURL(t,e){if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t))return t;const s=""===e?"":e||this.getEndpoint();let i;return i="."===s?new URL(window.location.href):"about:"===window.location.protocol?document.baseURI:new URL(s+"/",`${window.location.protocol}//${window.location.host}`),new URL(t,i).href}minApiVersion(t){return ft(this._apiVersion,t)>=0}lessThanApiVersion(t){return ft(this._apiVersion,t)<0}compareApiVersion(t){return ft(this._apiVersion,t)}};export{A,mt as L,V as N,Ct as a,ft as b,ut as c,wt as d,vt as e,g as f,gt as g,$ as h,N as i,h as j,e as k,s as l,yt as m,Nt as p,_t as r,Pt as w};
@@ -1,4 +1,4 @@
1
- import{h as e,m as t,F as o,D as i,z as s,A as r,j as a,f as n}from"./paper-checkbox-102e3b43.js";import{E as d,T as l,D as p,p as c}from"./vaadin-element-mixin-ba82e638.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 w,h as y,b as _,w as x,p as $}from"./pb-mixin-47974747.js";import{t as E,g as S}from"./pb-i18n-aa0bfb74.js";import"./jinn-codemirror-9718e0e0.js";
1
+ import{h as e,m as t,F as o,D as i,z as s,A as r,j as a,f as n}from"./paper-checkbox-102e3b43.js";import{E as d,T as l,D as p,p as c}from"./vaadin-element-mixin-b6179444.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 w,h as y,b as _,w as x,p as $}from"./pb-mixin-ea2e9070.js";import{t as E,g as S}from"./pb-i18n-f7a50012.js";import"./jinn-codemirror-9718e0e0.js";
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 t,h as e,u as n,f as i,B as o,d as a,b as h,I as s,T as l,v as c,w as r,x as p,D as d,y as u,l as m}from"./paper-checkbox-102e3b43.js";import{w as v,f as g,N as z,i as f,p as y,L as H,h as M,c as b}from"./pb-mixin-47974747.js";import{t as V}from"./pb-i18n-aa0bfb74.js";
1
+ import{P as t,h as e,u as n,f as i,B as o,d as a,b as h,I as s,T as l,v as c,w as r,x as p,D as d,y as u,l as m}from"./paper-checkbox-102e3b43.js";import{w as v,f as g,N as z,i as f,p as y,L as H,h as M,c as b}from"./pb-mixin-ea2e9070.js";import{t as V}from"./pb-i18n-f7a50012.js";
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "2.4.8",
3
+ "version": "2.5.1",
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",
package/pb-elements.json CHANGED
@@ -8183,6 +8183,17 @@
8183
8183
  "type": "boolean",
8184
8184
  "default": "false"
8185
8185
  },
8186
+ {
8187
+ "name": "supported-languages",
8188
+ "description": "Comma-separated list of languages supported. If the detected language\nis not in this list, fall back to the configured fallback language.",
8189
+ "type": "array"
8190
+ },
8191
+ {
8192
+ "name": "fallback-language",
8193
+ "description": "The fallback language to use if the detected language is not supported.\nDefaults to 'en'.",
8194
+ "type": "string",
8195
+ "default": "\"en\""
8196
+ },
8186
8197
  {
8187
8198
  "name": "theme",
8188
8199
  "type": "string"
@@ -8295,6 +8306,19 @@
8295
8306
  "type": "boolean",
8296
8307
  "default": "false"
8297
8308
  },
8309
+ {
8310
+ "name": "supportedLanguages",
8311
+ "attribute": "supported-languages",
8312
+ "description": "Comma-separated list of languages supported. If the detected language\nis not in this list, fall back to the configured fallback language.",
8313
+ "type": "array"
8314
+ },
8315
+ {
8316
+ "name": "fallbackLanguage",
8317
+ "attribute": "fallback-language",
8318
+ "description": "The fallback language to use if the detected language is not supported.\nDefaults to 'en'.",
8319
+ "type": "string",
8320
+ "default": "\"en\""
8321
+ },
8298
8322
  {
8299
8323
  "name": "theme",
8300
8324
  "attribute": "theme",
@@ -11433,8 +11457,7 @@
11433
11457
  {
11434
11458
  "name": "not-found",
11435
11459
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
11436
- "type": "string",
11437
- "default": "\"the server did not return any content\""
11460
+ "type": "string"
11438
11461
  },
11439
11462
  {
11440
11463
  "name": "animation",
@@ -11635,8 +11658,7 @@
11635
11658
  "name": "notFound",
11636
11659
  "attribute": "not-found",
11637
11660
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
11638
- "type": "string",
11639
- "default": "\"the server did not return any content\""
11661
+ "type": "string"
11640
11662
  },
11641
11663
  {
11642
11664
  "name": "animation",
@@ -11919,8 +11941,7 @@
11919
11941
  {
11920
11942
  "name": "not-found",
11921
11943
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
11922
- "type": "string",
11923
- "default": "\"the server did not return any content\""
11944
+ "type": "string"
11924
11945
  },
11925
11946
  {
11926
11947
  "name": "animation",
@@ -12097,8 +12118,7 @@
12097
12118
  "name": "notFound",
12098
12119
  "attribute": "not-found",
12099
12120
  "description": "Message to display if no content was returned by the server.\nSet to empty string to show nothing.",
12100
- "type": "string",
12101
- "default": "\"the server did not return any content\""
12121
+ "type": "string"
12102
12122
  },
12103
12123
  {
12104
12124
  "name": "animation",
package/src/pb-mixin.js CHANGED
@@ -331,8 +331,13 @@ export const pbMixin = (superclass) => class PbMixin extends superclass {
331
331
  * @param {String[]} [channels] Optional: explicitely specify the channels to emit to. This overwrites
332
332
  * the emit property. Pass empty array to target the default channel.
333
333
  */
334
- subscribeTo(type, listener, channels = []) {
335
- const chs = channels && channels.length ? channels : getSubscribedChannels(this);
334
+ subscribeTo(type, listener, channels) {
335
+ let chs;
336
+ if (channels) {
337
+ chs = channels.length === 0 ? [defaultChannel] : channels;
338
+ } else {
339
+ chs = getSubscribedChannels(this);
340
+ }
336
341
  const handlers = chs.map(key => {
337
342
  const handle = ev => {
338
343
  if (!ev.detail || !ev.detail.key || ev.detail.key !== key) {
@@ -357,8 +362,13 @@ export const pbMixin = (superclass) => class PbMixin extends superclass {
357
362
  * @param {String[]} [channels] Optional: explicitely specify the channels to emit to. This overwrites
358
363
  * the 'emit' property setting. Pass empty array to target the default channel.
359
364
  */
360
- emitTo(type, options, channels = []) {
361
- const chs = channels && channels.length ? channels : getEmittedChannels(this);
365
+ emitTo(type, options, channels) {
366
+ let chs;
367
+ if (channels) {
368
+ chs = channels.length === 0 ? [defaultChannel] : channels;
369
+ } else {
370
+ chs = getEmittedChannels(this);
371
+ }
362
372
  chs.forEach(ch => this._emit(ch, type, options));
363
373
  }
364
374
 
package/src/pb-page.js CHANGED
@@ -111,6 +111,25 @@ export class PbPage extends pbMixin(LitElement) {
111
111
  type: String,
112
112
  attribute: 'locale-fallback-ns'
113
113
  },
114
+ /**
115
+ * Comma-separated list of languages supported. If the detected language
116
+ * is not in this list, fall back to the configured fallback language.
117
+ */
118
+ supportedLanguages: {
119
+ type: Array,
120
+ attribute: 'supported-languages',
121
+ converter(value) {
122
+ return value.split(/\s*,\s*/);
123
+ }
124
+ },
125
+ /**
126
+ * The fallback language to use if the detected language is not supported.
127
+ * Defaults to 'en'.
128
+ */
129
+ fallbackLanguage: {
130
+ type: String,
131
+ attribute: 'fallback-language'
132
+ },
114
133
  /**
115
134
  * Set a language for i18n (e.g. 'en' or 'de'). If not set, browser language
116
135
  * detection will be used.
@@ -165,6 +184,8 @@ export class PbPage extends pbMixin(LitElement) {
165
184
  this.idHash = false;
166
185
  this.apiVersion = undefined;
167
186
  this.requireLanguage = false;
187
+ this.supportedLanguages = null;
188
+ this.fallbackLanguage = 'en';
168
189
  this.theme = null;
169
190
  this._localeFallbacks = [];
170
191
  this._i18nInstance = null;
@@ -301,7 +322,7 @@ export class PbPage extends pbMixin(LitElement) {
301
322
  });
302
323
  }
303
324
  const options = {
304
- fallbackLng: 'en',
325
+ fallbackLng: this.fallbackLanguage,
305
326
  defaultNS: 'common',
306
327
  ns: ['common'],
307
328
  debug: false,
@@ -317,6 +338,10 @@ export class PbPage extends pbMixin(LitElement) {
317
338
  if (this.language) {
318
339
  options.lng = this.language;
319
340
  }
341
+ console.log('supported langs: %o', this.supportedLanguages);
342
+ if (this.supportedLanguages) {
343
+ options.supportedLngs = this.supportedLanguages;
344
+ }
320
345
 
321
346
  if (this._localeFallbacks.length > 0) {
322
347
  const fallbacks = this._localeFallbacks.slice();
package/src/pb-view.js CHANGED
@@ -331,7 +331,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
331
331
  this.url = null;
332
332
  this.onUpdate = false;
333
333
  this.appendFootnotes = false;
334
- this.notFound = "the server did not return any content";
334
+ this.notFound = null;
335
335
  this.animation = false;
336
336
  this.direction = 'ltr';
337
337
  this.suppressHighlight = false;
@@ -719,10 +719,12 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
719
719
  message = '<pb-i18n key="dialogs.serverError"></pb-i18n>';
720
720
  }
721
721
 
722
- const content = `
723
- <p>${this.notFound}</p>
724
- <p><pb-i18n key="dialogs.serverError"></pb-i18n>: ${message} </p>
725
- `;
722
+ let content;
723
+ if (this.notFound != null) {
724
+ content = `<p>${this.notFound}</p>`;
725
+ } else {
726
+ content = `<p><pb-i18n key="dialogs.serverError"></pb-i18n>: ${message} </p>`;
727
+ }
726
728
 
727
729
  this._replaceContent({ content });
728
730
  this.emitTo('pb-end-update');
@@ -738,7 +740,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
738
740
  return;
739
741
  }
740
742
  if (resp.error) {
741
- if (this.notFound) {
743
+ if (this.notFound != null) {
742
744
  this._content = this.notFound;
743
745
  }
744
746
  this.emitTo('pb-end-update', null);