@teipublisher/pb-components 1.42.6 → 1.43.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/components.css +12 -0
- package/dist/demo/pb-code-highlight.html +63 -63
- package/dist/demo/pb-table-grid.html +16 -16
- package/dist/pb-code-editor.js +1 -1
- package/dist/pb-component-docs.js +12 -12
- package/dist/pb-components-bundle.js +170 -171
- package/dist/pb-edit-app.js +1 -1
- package/dist/pb-elements.json +610 -597
- package/dist/{pb-i18n-6ad23bcf.js → pb-i18n-dc551878.js} +1 -1
- package/dist/pb-leaflet-map.js +1 -1
- package/dist/{pb-message-0fb0b538.js → pb-message-c4cd7861.js} +1 -1
- package/dist/{pb-mixin-15ff531f.js → pb-mixin-f8b22e51.js} +1 -1
- package/dist/pb-odd-editor.js +1 -1
- package/package.json +1 -1
- package/pb-elements.json +610 -597
- package/src/pb-code-highlight.js +194 -193
- package/src/pb-mixin.js +542 -529
- package/src/pb-page.js +396 -384
- package/src/pb-repeat.js +5 -1
- package/src/pb-split-list.js +3 -2
- package/src/pb-table-grid.js +218 -211
- package/src/theming.js +115 -0
- package/src/utils.js +50 -51
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as t,L as e,N as n,A as s}from"./pb-mixin-
|
|
1
|
+
import{d as t,L as e,N as n,A as s}from"./pb-mixin-f8b22e51.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};
|
package/dist/pb-leaflet-map.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{L as t,p as e,r as i,h as s,c as a}from"./pb-mixin-
|
|
1
|
+
import{L as t,p as e,r as i,h as s,c as a}from"./pb-mixin-f8b22e51.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>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as t,h as e,u as i,f as a,B as n,d as o,b as h,I as l,T as s,v as c,w as r,x as p,D as d,y as v,l as m}from"./paper-checkbox-102e3b43.js";import{d as u,N as g,i as z,p as f,L as y,h as H,c as M}from"./pb-mixin-
|
|
1
|
+
import{P as t,h as e,u as i,f as a,B as n,d as o,b as h,I as l,T as s,v as c,w as r,x as p,D as d,y as v,l as m}from"./paper-checkbox-102e3b43.js";import{d as u,N as g,i as z,p as f,L as y,h as H,c as M}from"./pb-mixin-f8b22e51.js";import{t as b}from"./pb-i18n-dc551878.js";
|
|
2
2
|
/**
|
|
3
3
|
@license
|
|
4
4
|
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
|
|
@@ -155,4 +155,4 @@ const ae=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 pe={};class me extends oe{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,s)=>e.reduceRight((e,s)=>Array.isArray(s)?t(s,e):(e.add(s),e),s),s=t(e,new Set),i=[];s.forEach(e=>i.unshift(e)),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!ae){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return ce(t)}return e})}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 e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?ae?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==pe&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return pe}}function fe(e){const t=document.querySelector("script[src*=pb-components]");return t?new URL(e,t.src).href:new URL(e,window.location.href).href}function _e(e,t){var s,i,r;for(e=(e+"").split("."),t=(t+"").split("."),r=Math.max(e.length,t.length),s=0;s<r;s++)if(void 0===e[s]&&(e[s]="0"),void 0===t[s]&&(t[s]="0"),0!==(i=parseInt(e[s],10)-parseInt(t[s],10)))return i<0?-1:1;return 0}function ge(e,t){return _e(e,t)>=0}function ye(e,t,s){const i=getComputedStyle(e).getPropertyValue(t);if(i)try{return JSON.parse(i)}catch(e){return s}return s}me.finalized=!0,me.render=Q,me.shadowRootOptions={mode:"open"},window.TeiPublisher||(window.TeiPublisher={},TeiPublisher.url=new URL(window.location.href));const be=new Set,Se=new Map;function we(){Se.clear()}const
|
|
158
|
+
(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const pe={};class me extends oe{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,s)=>e.reduceRight((e,s)=>Array.isArray(s)?t(s,e):(e.add(s),e),s),s=t(e,new Set),i=[];s.forEach(e=>i.unshift(e)),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!ae){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return ce(t)}return e})}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 e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?ae?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==pe&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return pe}}function fe(e){const t=document.querySelector("script[src*=pb-components]");return t?new URL(e,t.src).href:new URL(e,window.location.href).href}function _e(e,t){var s,i,r;for(e=(e+"").split("."),t=(t+"").split("."),r=Math.max(e.length,t.length),s=0;s<r;s++)if(void 0===e[s]&&(e[s]="0"),void 0===t[s]&&(t[s]="0"),0!==(i=parseInt(e[s],10)-parseInt(t[s],10)))return i<0?-1:1;return 0}function ge(e,t){return _e(e,t)>=0}function ye(e,t,s){const i=getComputedStyle(e).getPropertyValue(t);if(i)try{return JSON.parse(i)}catch(e){return s}return s}me.finalized=!0,me.render=Q,me.shadowRootOptions={mode:"open"},window.TeiPublisher||(window.TeiPublisher={},TeiPublisher.url=new URL(window.location.href));const be=new Set,Se=new Map;function we(){Se.clear()}function ve(e,t){Se.has(e)?t(Se.get(e)):document.addEventListener(e,s=>{Se.set(e,s.detail),t(s.detail)},{once:!0})}const Pe=e=>class t extends e{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(),ve("pb-page-ready",e=>{this._endpoint=e.endpoint,this._apiVersion=e.apiVersion})}disconnectedCallback(){super.disconnectedCallback(),this._subscriptions.forEach((e,t)=>{e.forEach(e=>{document.removeEventListener(t,e)})})}command(e,t){"disable"===e&&(this.disabled=t)}wait(e){if(this.waitFor){const t=Array.from(document.querySelectorAll(this.waitFor)).filter(e=>this.emitsOnSameChannel(e)),s=t.length;if(0===s)return e();let i=0;t.forEach(t=>{if(t._isReady)i++,s===i&&e();else{const r=t.addEventListener("pb-ready",n=>{n.detail.source!=this&&(i++,s===i&&(t.removeEventListener("pb-ready",r),e()))})}})}else e()}waitForChannel(e){if(this.subscribeConfig)for(const t in this.subscribeConfig)this.subscribeConfig[t].forEach(s=>{if("pb-ready"===s&&be.has(t))return e()});else if(this.subscribe&&be.has(this.subscribe)||!this.subscribe&&be.has("__default__"))return e();const t=this.subscribeTo("pb-ready",s=>{s.detail._source!=this&&(t.forEach(e=>document.removeEventListener("pb-ready",e)),e())})}static waitOnce(e,t){ve(e,t)}signalReady(e="pb-ready",t){this._isReady=!0,Se.set(e,t),this.dispatchEvent(new CustomEvent(e,{detail:{data:t,source:this}})),this.emitTo(e,t)}getSubscribedChannels(){const e=[];return this.subscribeConfig?Object.keys(this.subscribeConfig).forEach(t=>{e.push(t)}):this.subscribe&&e.push(this.subscribe),e}emitsOnSameChannel(e){const s=this.getSubscribedChannels(),i=t.getEmittedChannels(e);return 0===s.length&&0===i.length||s.some(e=>i.includes(e))}static getEmittedChannels(e){const t=[],s=e.getAttribute("emit-config");if(s){const e=JSON.parse(s);Object.keys(e).forEach(e=>{t.push(e)})}else{const s=e.getAttribute("emit");s&&t.push(s)}return t}subscribeTo(e,t,s){let i;const r=s||this.getSubscribedChannels();if(0===r.length){const s=e=>{e.detail&&e.detail.key||t(e)};document.addEventListener(e,s),i=[s]}else i=r.map(s=>{const i=e=>{e.detail&&e.detail.key&&e.detail.key===s&&t(e)};return document.addEventListener(e,i),i});return this._subscriptions.set(e,i),i}emitTo(e,s,i){const r=i||t.getEmittedChannels(this);if(0==r.length){"pb-ready"===e&&be.add("__default__"),s=s?Object.assign({_source:this},s):{_source:this};const t=new CustomEvent(e,{detail:s,composed:!0,bubbles:!0});this.dispatchEvent(t)}else r.forEach(t=>{const i={key:t,_source:this};if(s)for(const e in s)s.hasOwnProperty(e)&&(i[e]=s[e]);"pb-ready"===e&&be.add(t);const r=new CustomEvent(e,{detail:i,composed:!0,bubbles:!0});this.dispatchEvent(r)})}getDocument(){if(this.src){const e=document.getElementById(this.src);if(e)return e}return null}getParameter(e,t){const s=TeiPublisher.url.searchParams&&TeiPublisher.url.searchParams.getAll(e);return s&&1==s.length?s[0]:s&&s.length>1?s:t}getParameterValues(e){return TeiPublisher.url.searchParams.getAll(e)}setParameter(e,t){void 0===t?TeiPublisher.url.searchParams.delete(e):Array.isArray(t)?(TeiPublisher.url.searchParams.delete(e),t.forEach((function(t){TeiPublisher.url.searchParams.append(e,t)}))):TeiPublisher.url.searchParams.set(e,t)}setParameters(e){TeiPublisher.url.search="";for(let t in e)e.hasOwnProperty(t)&&this.setParameter(t,e[t])}getParameters(){const e={};for(let t of TeiPublisher.url.searchParams.keys())e[t]=this.getParameter(t);return e}getParametersMatching(e){const t={};for(let s of TeiPublisher.url.searchParams.entries())if(e.test(s[0])){const e=t[s[0]];e?e.push(s[1]):t[s[0]]=[s[1]]}return t}clearParametersMatching(e){for(let t of TeiPublisher.url.searchParams.entries())e.test(t[0])&&TeiPublisher.url.searchParams.delete(t[0])}setPath(e){const t=document.querySelector("pb-page");if(t){const s=t.appRoot;this.getUrl().pathname=s+"/"+e}}getUrl(){return TeiPublisher.url}pushHistory(e,t){history.pushState(t,e,TeiPublisher.url.toString())}getEndpoint(){return this._endpoint}toAbsoluteURL(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e))return e;const s=t||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(e,i).href}minApiVersion(e){return _e(this._apiVersion,e)>=0}lessThanApiVersion(e){return _e(this._apiVersion,e)<0}compareApiVersion(e){return _e(this._apiVersion,e)}};export{A,me as L,V as N,_e as a,we as b,ue as c,y as d,c as e,t as f,ye as g,$ as h,T as i,s as j,ge as m,Pe as p,fe as r,ve as w};
|
package/dist/pb-odd-editor.js
CHANGED
|
@@ -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"./pb-message-
|
|
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"./pb-message-c4cd7861.js";import{d as h,N as m,e as u,f as b,j as g,A as v,L as f,c as w,h as y,a as _,p as x}from"./pb-mixin-f8b22e51.js";import{t as $,g as E}from"./pb-i18n-dc551878.js";import"./jinn-codemirror-50ed5bc1.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
package/package.json
CHANGED