@teipublisher/pb-components 1.36.3 → 1.38.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.
@@ -0,0 +1,101 @@
1
+ import { LitElement } from 'lit-element';
2
+
3
+ function sizeConverter(value, type) {
4
+ try {
5
+ return value.split(/\s*,\s*/).map(s => parseInt(s, 10));
6
+ } catch (e) {
7
+ console.error(`<pb-map-icon> Invalid size specified: ${value}`);
8
+ return null;
9
+ }
10
+ }
11
+ /**
12
+ * Configure a map icon type to be used for markers.
13
+ * Should be nested inside `pb-leaflet-map`.
14
+ *
15
+ */
16
+ export class PbMapIcon extends LitElement {
17
+ static get properties() {
18
+ return {
19
+ /**
20
+ * Name of the icon. Set to 'active' to configure the icon used for
21
+ * places which were target of a previous `pb-geolocation` event (i.e. are currently 'active').
22
+ */
23
+ name: {
24
+ type: String
25
+ },
26
+ /**
27
+ * The URL to load the icon from. Should be relative to the path set via the `imagesPath` property on `pb-leaflet-map`.
28
+ */
29
+ iconUrl: {
30
+ type: String,
31
+ attribute: 'icon-url'
32
+ },
33
+ /**
34
+ * Size of the icon as comma-separated string, i.e. 'height, width'.
35
+ */
36
+ iconSize: {
37
+ type: Array,
38
+ converter: sizeConverter,
39
+ attribute: 'icon-size'
40
+ },
41
+ /**
42
+ * Anchor position of the icon as comma-separated string, i.e. 'height, width'.
43
+ */
44
+ iconAnchor: {
45
+ type: Array,
46
+ converter: sizeConverter,
47
+ attribute: 'icon-anchor'
48
+ },
49
+ /**
50
+ * The URL to load the shadow icon from. Should be relative to the path set via the `imagesPath` property on `pb-leaflet-map`.
51
+ */
52
+ shadowUrl: {
53
+ type: String,
54
+ attribute: 'shadow-url'
55
+ },
56
+ /**
57
+ * Size of the shadow icon as comma-separated string, i.e. 'height, width'.
58
+ */
59
+ shadowSize: {
60
+ type: Array,
61
+ converter: sizeConverter,
62
+ attribute: 'shadow-size'
63
+ },
64
+ /**
65
+ * Anchor position of the shadow icon as comma-separated string, i.e. 'height, width'.
66
+ */
67
+ shadowAnchor: {
68
+ type: Array,
69
+ converter: sizeConverter,
70
+ attribute: 'shadow-anchor'
71
+ },
72
+ /**
73
+ * Anchor position of the popup as comma-separated string, i.e. 'height, width'.
74
+ */
75
+ popupAncor: {
76
+ type: Array,
77
+ converter: sizeConverter,
78
+ attribute: 'popup-anchor'
79
+ }
80
+ };
81
+ }
82
+
83
+ constructor() {
84
+ super();
85
+ this.name = 'default';
86
+ this.type = 'image';
87
+ this.iconUrl = null;
88
+ }
89
+
90
+ get options() {
91
+ const options = {};
92
+ Object.keys(PbMapIcon.properties).forEach(key => {
93
+ if (this[key]) {
94
+ options[key] = this[key];
95
+ }
96
+ });
97
+ console.log('<pb-map-icon> Options: %o', options);
98
+ return options;
99
+ }
100
+ }
101
+ customElements.define('pb-map-icon', PbMapIcon);
package/src/pb-page.js CHANGED
@@ -229,6 +229,15 @@ class PbPage extends pbMixin(LitElement) {
229
229
  return;
230
230
  }
231
231
 
232
+ const slot = this.shadowRoot.querySelector('slot');
233
+ slot.addEventListener('slotchange', () => {
234
+ const ev = new CustomEvent('pb-page-loaded', {
235
+ bubbles: true,
236
+ composed: true
237
+ });
238
+ this.dispatchEvent(ev);
239
+ }, { once: true });
240
+
232
241
  const defaultLocales = resolveURL('../i18n/') + '{{ns}}/{{lng}}.json';
233
242
  console.log('<pb-page> Loading locales. common: %s; additional: %s; namespaces: %o',
234
243
  defaultLocales, this.locales, this._localeFallbacks);
package/src/pb-popover.js CHANGED
@@ -74,7 +74,7 @@ export function loadTippyStyles(root, theme) {
74
74
  * unless defined otherwise; clicking anywhere on the page will close the popup.
75
75
  * @prop {"click" | "mouseenter" | "focus" | "focusin"} trigger - Defines one or more actions (space separated) which should cause
76
76
  * the popover to show. If property `persistent` is set, `trigger` will by default be set to `click`.
77
- * @prop {String} poupClass - Additional class names which will be added to the popup element.
77
+ * @prop {String} popupClass - Additional class names which will be added to the popup element.
78
78
  * Use this to apply a specific style to certain popovers, but not others.
79
79
  * @prop {String} remote - An optional URL to asynchronously load the popover's content from. Content will
80
80
  * be loaded after the popover is displayed. The downloaded HTML content will replace the text set via the alternate slot.