@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
package/src/utils.js
CHANGED
|
@@ -1,52 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
cmp
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @param {
|
|
38
|
-
* @param {
|
|
39
|
-
* @
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return defaultValue;
|
|
1
|
+
export function resolveURL(relPath) {
|
|
2
|
+
const src = document.querySelector('script[src*=pb-components]');
|
|
3
|
+
if (src) {
|
|
4
|
+
return new URL(relPath, src.src).href;
|
|
5
|
+
}
|
|
6
|
+
return new URL(relPath, window.location.href).href;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function cmpVersion(a, b) {
|
|
10
|
+
var i, cmp, len;
|
|
11
|
+
a = (a + '').split('.');
|
|
12
|
+
b = (b + '').split('.');
|
|
13
|
+
len = Math.max(a.length, b.length);
|
|
14
|
+
for (i = 0; i < len; i++) {
|
|
15
|
+
if (a[i] === undefined) {
|
|
16
|
+
a[i] = '0';
|
|
17
|
+
}
|
|
18
|
+
if (b[i] === undefined) {
|
|
19
|
+
b[i] = '0';
|
|
20
|
+
}
|
|
21
|
+
cmp = parseInt(a[i], 10) - parseInt(b[i], 10);
|
|
22
|
+
if (cmp !== 0) {
|
|
23
|
+
return (cmp < 0 ? -1 : 1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function minVersion(given, required) {
|
|
30
|
+
return cmpVersion(given, required) >= 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve value of a CSS property.
|
|
35
|
+
*
|
|
36
|
+
* @param {Element} elem the component
|
|
37
|
+
* @param {string} name name of the property
|
|
38
|
+
* @param {any} defaultValue default value
|
|
39
|
+
* @returns the value or defaultValue if it does not exist
|
|
40
|
+
*/
|
|
41
|
+
export function getCSSProperty(elem, name, defaultValue) {
|
|
42
|
+
const property = getComputedStyle(elem).getPropertyValue(name);
|
|
43
|
+
if (property) {
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse(property);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
return defaultValue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return defaultValue;
|
|
52
51
|
}
|