@teipublisher/pb-components 2.25.5 → 2.25.6

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.
Files changed (128) hide show
  1. package/.github/workflows/main.yml +3 -3
  2. package/.github/workflows/node.js.yml +3 -3
  3. package/.github/workflows/release.js.yml +3 -3
  4. package/CHANGELOG.md +8 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/pb-drawer2.html +1 -1
  8. package/dist/demo/pb-leaflet-map.html +1 -1
  9. package/dist/demo/pb-repeat.html +1 -3
  10. package/dist/demo/pb-view3.html +1 -1
  11. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  12. package/dist/pb-code-editor.js +25 -20
  13. package/dist/pb-component-docs.js +58 -54
  14. package/dist/pb-components-bundle.js +1827 -1520
  15. package/dist/pb-edit-app.js +167 -107
  16. package/dist/pb-elements.json +54 -54
  17. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  18. package/dist/pb-leaflet-map.js +23 -23
  19. package/dist/pb-mei.js +56 -41
  20. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  21. package/dist/pb-odd-editor.js +925 -758
  22. package/dist/pb-tify.js +2 -2
  23. package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
  24. package/gh-pages.js +5 -3
  25. package/package.json +2 -2
  26. package/pb-elements.json +54 -54
  27. package/src/assets/components.css +5 -5
  28. package/src/authority/airtable.js +20 -21
  29. package/src/authority/anton.js +129 -129
  30. package/src/authority/custom.js +23 -21
  31. package/src/authority/geonames.js +38 -32
  32. package/src/authority/gnd.js +47 -42
  33. package/src/authority/kbga.js +137 -134
  34. package/src/authority/metagrid.js +44 -46
  35. package/src/authority/reconciliation.js +66 -67
  36. package/src/authority/registry.js +4 -4
  37. package/src/docs/pb-component-docs.js +2 -2
  38. package/src/docs/pb-component-view.js +5 -5
  39. package/src/docs/pb-components-list.js +2 -2
  40. package/src/docs/pb-demo-snippet.js +2 -2
  41. package/src/dts-client.js +299 -297
  42. package/src/dts-select-endpoint.js +90 -82
  43. package/src/parse-date-service.js +184 -135
  44. package/src/pb-ajax.js +171 -167
  45. package/src/pb-authority-lookup.js +96 -81
  46. package/src/pb-autocomplete.js +292 -280
  47. package/src/pb-blacklab-highlight.js +264 -259
  48. package/src/pb-blacklab-results.js +236 -221
  49. package/src/pb-browse-docs.js +540 -475
  50. package/src/pb-browse.js +68 -65
  51. package/src/pb-clipboard.js +79 -76
  52. package/src/pb-code-editor.js +110 -102
  53. package/src/pb-code-highlight.js +209 -204
  54. package/src/pb-codepen.js +79 -72
  55. package/src/pb-collapse.js +149 -146
  56. package/src/pb-combo-box.js +190 -190
  57. package/src/pb-components-bundle.js +1 -1
  58. package/src/pb-custom-form.js +150 -149
  59. package/src/pb-document.js +89 -90
  60. package/src/pb-download.js +208 -195
  61. package/src/pb-drawer.js +145 -148
  62. package/src/pb-edit-app.js +301 -229
  63. package/src/pb-edit-xml.js +99 -96
  64. package/src/pb-events.js +114 -107
  65. package/src/pb-facs-link.js +104 -102
  66. package/src/pb-facsimile.js +411 -413
  67. package/src/pb-formula.js +151 -153
  68. package/src/pb-geolocation.js +129 -131
  69. package/src/pb-grid-action.js +53 -56
  70. package/src/pb-grid.js +231 -228
  71. package/src/pb-highlight.js +140 -140
  72. package/src/pb-hotkeys.js +40 -42
  73. package/src/pb-i18n.js +101 -104
  74. package/src/pb-image-strip.js +84 -78
  75. package/src/pb-lang.js +83 -70
  76. package/src/pb-leaflet-map.js +488 -485
  77. package/src/pb-link.js +126 -124
  78. package/src/pb-load.js +431 -426
  79. package/src/pb-login.js +275 -254
  80. package/src/pb-manage-odds.js +364 -318
  81. package/src/pb-map-icon.js +89 -89
  82. package/src/pb-map-layer.js +85 -85
  83. package/src/pb-markdown.js +90 -99
  84. package/src/pb-media-query.js +74 -72
  85. package/src/pb-mei.js +306 -295
  86. package/src/pb-message.js +143 -130
  87. package/src/pb-mixin.js +269 -264
  88. package/src/pb-navigation.js +80 -82
  89. package/src/pb-observable.js +38 -38
  90. package/src/pb-odd-editor.js +1056 -958
  91. package/src/pb-odd-elementspec-editor.js +348 -297
  92. package/src/pb-odd-model-editor.js +1058 -898
  93. package/src/pb-odd-parameter-editor.js +200 -178
  94. package/src/pb-odd-rendition-editor.js +136 -124
  95. package/src/pb-page.js +432 -422
  96. package/src/pb-paginate.js +202 -190
  97. package/src/pb-panel.js +191 -179
  98. package/src/pb-popover-themes.js +7 -5
  99. package/src/pb-popover.js +296 -287
  100. package/src/pb-print-preview.js +127 -127
  101. package/src/pb-progress.js +49 -49
  102. package/src/pb-repeat.js +105 -104
  103. package/src/pb-restricted.js +84 -77
  104. package/src/pb-search.js +238 -221
  105. package/src/pb-select-feature.js +127 -120
  106. package/src/pb-select-odd.js +132 -124
  107. package/src/pb-select-template.js +89 -78
  108. package/src/pb-select.js +251 -227
  109. package/src/pb-split-list.js +179 -174
  110. package/src/pb-svg.js +80 -79
  111. package/src/pb-table-column.js +54 -54
  112. package/src/pb-table-grid.js +221 -203
  113. package/src/pb-tabs.js +61 -63
  114. package/src/pb-tify.js +154 -154
  115. package/src/pb-timeline.js +271 -229
  116. package/src/pb-toggle-feature.js +198 -185
  117. package/src/pb-upload.js +184 -174
  118. package/src/pb-version.js +30 -30
  119. package/src/pb-view-annotate.js +132 -98
  120. package/src/pb-view.js +1282 -1263
  121. package/src/pb-zoom.js +40 -40
  122. package/src/polymer-hack.js +1 -1
  123. package/src/search-result-service.js +256 -223
  124. package/src/seed-element.js +13 -20
  125. package/src/settings.js +4 -4
  126. package/src/theming.js +91 -91
  127. package/src/urls.js +289 -289
  128. package/src/utils.js +53 -51
@@ -1,204 +1,209 @@
1
- import { LitElement, html, css } from 'lit-element';
2
- import "prismjs/prism";
3
- import 'prismjs/components/prism-xquery';
4
- import 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace';
5
- import 'prismjs/plugins/line-numbers/prism-line-numbers';
6
- import { resolveURL, getCSSProperty } from './utils.js';
7
- import { themableMixin } from "./theming.js";
8
-
9
- const PRISM_THEMES = new Map();
10
-
11
- function loadTheme(theme) {
12
- const themeName = theme === 'default' ? 'prism.css' : `prism-${theme}.css`;
13
- if (PRISM_THEMES.has(themeName)) {
14
- console.log('Using cached theme: %s', themeName);
15
- return PRISM_THEMES.get(themeName);
16
- }
17
-
18
- const promise = new Promise((resolve) => {
19
- const resource = resolveURL('../css/prismjs/') + themeName;
20
- console.log('<pb-code-highlight> loading theme %s from %s', theme, resource);
21
- fetch(resource)
22
- .then(response => response.text())
23
- .catch(() => resolve(''))
24
- .then(text => {
25
- resolve(html`<style>${text}</style>`);
26
- });
27
- });
28
- PRISM_THEMES.set(themeName, promise);
29
- return promise;
30
- }
31
-
32
- /**
33
- * Highlight a code snippet. The snippet may either be passed in a template child
34
- * element, which could contain HTML or text. If no template child is present, the
35
- * component will take any text content contained in it and highlight it. One can also
36
- * pass the code to be highlighted in the `code` property.
37
- *
38
- * @cssprop [--pb-code-highlight-white-space=pre] - configures line wrapping
39
- * @cssprop [--pb-code-highlight-theme=default] - configures the default theme to be used
40
- */
41
- export class PbCodeHighlight extends themableMixin(LitElement) {
42
- static get properties() {
43
- return {
44
- /**
45
- * The language to be used for syntax highlighting.
46
- */
47
- language: {
48
- type: String
49
- },
50
- /**
51
- * The code to be highlighted as a string. If not set,
52
- * this will be populated from either a template child element
53
- * or the element's text content.
54
- * The value of the property can be changed programmatically from JavaScript.
55
- */
56
- code: {
57
- type: String
58
- },
59
- /**
60
- * Highlighting theme to use: 'coy', 'dark', 'funky', 'okaida', 'solarizedlight',
61
- * 'tomorrow', 'twilight' or 'default'.
62
- */
63
- theme: {
64
- type: String
65
- },
66
- lineNumbers: {
67
- type: Boolean,
68
- attribute: 'line-numbers'
69
- },
70
- _themeStyles: {
71
- type: String
72
- }
73
- };
74
- }
75
-
76
- constructor() {
77
- super();
78
- this.language = 'xml';
79
- this.theme = 'default';
80
- this.lineNumbers = false;
81
- this._themeStyles = null;
82
- }
83
-
84
- connectedCallback() {
85
- super.connectedCallback();
86
- let theme = this.getAttribute('theme');
87
- if (theme === null) {
88
- theme = getCSSProperty(this, '--pb-code-highlight-theme', 'default');
89
- this.setAttribute('theme', theme);
90
- }
91
- }
92
-
93
- firstUpdated() {
94
- super.firstUpdated();
95
-
96
- if (!this.code) {
97
- const template = this.querySelector('template');
98
- if (template) {
99
- this.code = Prism.plugins.NormalizeWhitespace.normalize(template.innerHTML);
100
- } else {
101
- this.code = Prism.plugins.NormalizeWhitespace.normalize(this.textContent);
102
- }
103
- }
104
- }
105
-
106
- attributeChangedCallback(name, oldValue, newValue) {
107
- super.attributeChangedCallback(name, oldValue, newValue);
108
- switch (name) {
109
- case 'theme':
110
- loadTheme(newValue).then(loadedStyles => {
111
- this._themeStyles = loadedStyles;
112
- });
113
- break;
114
- default:
115
- break;
116
- }
117
- }
118
-
119
- updated(changedProperties) {
120
- super.updated(changedProperties);
121
- if (changedProperties.has('code')) {
122
- //if the code property is changed, the content of the <code> element is replaced
123
- const pre = this.shadowRoot.getElementById("pb-code-highlight");
124
- if(pre != null) {
125
- const code = document.createElement("code");
126
- code.textContent = this.code; //textContent property keeps new lines in the code
127
- pre.replaceChildren(code);
128
-
129
- }
130
- this.highlight();
131
- }
132
- }
133
-
134
- highlight() {
135
- Prism.highlightAllUnder(this.shadowRoot);
136
- }
137
-
138
- render() {
139
- if (this.code) {
140
- return html`
141
- ${this._themeStyles}
142
- <pre id="pb-code-highlight" class="${this.lineNumbers ? 'line-numbers' : ''} language-${this.language}"><code>${this.code}</code></pre>
143
- `;
144
- }
145
- return html`<pre class="line-numbers"><code><code></pre>`;
146
- }
147
-
148
- static get styles() {
149
- return css`
150
- :host {
151
- display: block;
152
- }
153
- pre[class*='language-'] {
154
- margin: 0;
155
- }
156
- code[class*='language-'] {
157
- white-space: var(--pb-code-highlight-white-space, pre);
158
- }
159
- pre.line-numbers {
160
- position: relative;
161
- padding-left: 3.8em;
162
- counter-reset: linenumber;
163
- }
164
-
165
- pre.line-numbers > code {
166
- position: relative;
167
- white-space: inherit;
168
- }
169
-
170
- .line-numbers .line-numbers-rows {
171
- position: absolute;
172
- pointer-events: none;
173
- top: 0;
174
- font-size: 100%;
175
- left: -3.8em;
176
- width: 3em; /* works for line-numbers below 1000 lines */
177
- letter-spacing: -1px;
178
- border-right: 1px solid #999;
179
-
180
- -webkit-user-select: none;
181
- -moz-user-select: none;
182
- -ms-user-select: none;
183
- user-select: none;
184
-
185
- }
186
-
187
- .line-numbers-rows > span {
188
- pointer-events: none;
189
- display: block;
190
- counter-increment: linenumber;
191
- height: auto !important;
192
- }
193
-
194
- .line-numbers-rows > span:before {
195
- content: counter(linenumber);
196
- color: #999;
197
- display: block;
198
- padding-right: 0.8em;
199
- text-align: right;
200
- }
201
- `;
202
- }
203
- }
204
- customElements.define('pb-code-highlight', PbCodeHighlight);
1
+ import { LitElement, html, css } from 'lit-element';
2
+ import 'prismjs/prism';
3
+ import 'prismjs/components/prism-xquery';
4
+ import 'prismjs/plugins/normalize-whitespace/prism-normalize-whitespace';
5
+ import 'prismjs/plugins/line-numbers/prism-line-numbers';
6
+ import { resolveURL, getCSSProperty } from './utils.js';
7
+ import { themableMixin } from './theming.js';
8
+
9
+ const PRISM_THEMES = new Map();
10
+
11
+ function loadTheme(theme) {
12
+ const themeName = theme === 'default' ? 'prism.css' : `prism-${theme}.css`;
13
+ if (PRISM_THEMES.has(themeName)) {
14
+ console.log('Using cached theme: %s', themeName);
15
+ return PRISM_THEMES.get(themeName);
16
+ }
17
+
18
+ const promise = new Promise(resolve => {
19
+ const resource = resolveURL('../css/prismjs/') + themeName;
20
+ console.log('<pb-code-highlight> loading theme %s from %s', theme, resource);
21
+ fetch(resource)
22
+ .then(response => response.text())
23
+ .catch(() => resolve(''))
24
+ .then(text => {
25
+ resolve(
26
+ html`<style>
27
+ ${text}
28
+ </style>`,
29
+ );
30
+ });
31
+ });
32
+ PRISM_THEMES.set(themeName, promise);
33
+ return promise;
34
+ }
35
+
36
+ /**
37
+ * Highlight a code snippet. The snippet may either be passed in a template child
38
+ * element, which could contain HTML or text. If no template child is present, the
39
+ * component will take any text content contained in it and highlight it. One can also
40
+ * pass the code to be highlighted in the `code` property.
41
+ *
42
+ * @cssprop [--pb-code-highlight-white-space=pre] - configures line wrapping
43
+ * @cssprop [--pb-code-highlight-theme=default] - configures the default theme to be used
44
+ */
45
+ export class PbCodeHighlight extends themableMixin(LitElement) {
46
+ static get properties() {
47
+ return {
48
+ /**
49
+ * The language to be used for syntax highlighting.
50
+ */
51
+ language: {
52
+ type: String,
53
+ },
54
+ /**
55
+ * The code to be highlighted as a string. If not set,
56
+ * this will be populated from either a template child element
57
+ * or the element's text content.
58
+ * The value of the property can be changed programmatically from JavaScript.
59
+ */
60
+ code: {
61
+ type: String,
62
+ },
63
+ /**
64
+ * Highlighting theme to use: 'coy', 'dark', 'funky', 'okaida', 'solarizedlight',
65
+ * 'tomorrow', 'twilight' or 'default'.
66
+ */
67
+ theme: {
68
+ type: String,
69
+ },
70
+ lineNumbers: {
71
+ type: Boolean,
72
+ attribute: 'line-numbers',
73
+ },
74
+ _themeStyles: {
75
+ type: String,
76
+ },
77
+ };
78
+ }
79
+
80
+ constructor() {
81
+ super();
82
+ this.language = 'xml';
83
+ this.theme = 'default';
84
+ this.lineNumbers = false;
85
+ this._themeStyles = null;
86
+ }
87
+
88
+ connectedCallback() {
89
+ super.connectedCallback();
90
+ let theme = this.getAttribute('theme');
91
+ if (theme === null) {
92
+ theme = getCSSProperty(this, '--pb-code-highlight-theme', 'default');
93
+ this.setAttribute('theme', theme);
94
+ }
95
+ }
96
+
97
+ firstUpdated() {
98
+ super.firstUpdated();
99
+
100
+ if (!this.code) {
101
+ const template = this.querySelector('template');
102
+ if (template) {
103
+ this.code = Prism.plugins.NormalizeWhitespace.normalize(template.innerHTML);
104
+ } else {
105
+ this.code = Prism.plugins.NormalizeWhitespace.normalize(this.textContent);
106
+ }
107
+ }
108
+ }
109
+
110
+ attributeChangedCallback(name, oldValue, newValue) {
111
+ super.attributeChangedCallback(name, oldValue, newValue);
112
+ switch (name) {
113
+ case 'theme':
114
+ loadTheme(newValue).then(loadedStyles => {
115
+ this._themeStyles = loadedStyles;
116
+ });
117
+ break;
118
+ default:
119
+ break;
120
+ }
121
+ }
122
+
123
+ updated(changedProperties) {
124
+ super.updated(changedProperties);
125
+ if (changedProperties.has('code')) {
126
+ // if the code property is changed, the content of the <code> element is replaced
127
+ const pre = this.shadowRoot.getElementById('pb-code-highlight');
128
+ if (pre != null) {
129
+ const code = document.createElement('code');
130
+ code.textContent = this.code; // textContent property keeps new lines in the code
131
+ pre.replaceChildren(code);
132
+ }
133
+ this.highlight();
134
+ }
135
+ }
136
+
137
+ highlight() {
138
+ Prism.highlightAllUnder(this.shadowRoot);
139
+ }
140
+
141
+ render() {
142
+ if (this.code) {
143
+ return html`
144
+ ${this._themeStyles}
145
+ <pre
146
+ id="pb-code-highlight"
147
+ class="${this.lineNumbers ? 'line-numbers' : ''} language-${this.language}"
148
+ ><code>${this.code}</code></pre>
149
+ `;
150
+ }
151
+ return html`<pre class="line-numbers"><code><code></pre>`;
152
+ }
153
+
154
+ static get styles() {
155
+ return css`
156
+ :host {
157
+ display: block;
158
+ }
159
+ pre[class*='language-'] {
160
+ margin: 0;
161
+ }
162
+ code[class*='language-'] {
163
+ white-space: var(--pb-code-highlight-white-space, pre);
164
+ }
165
+ pre.line-numbers {
166
+ position: relative;
167
+ padding-left: 3.8em;
168
+ counter-reset: linenumber;
169
+ }
170
+
171
+ pre.line-numbers > code {
172
+ position: relative;
173
+ white-space: inherit;
174
+ }
175
+
176
+ .line-numbers .line-numbers-rows {
177
+ position: absolute;
178
+ pointer-events: none;
179
+ top: 0;
180
+ font-size: 100%;
181
+ left: -3.8em;
182
+ width: 3em; /* works for line-numbers below 1000 lines */
183
+ letter-spacing: -1px;
184
+ border-right: 1px solid #999;
185
+
186
+ -webkit-user-select: none;
187
+ -moz-user-select: none;
188
+ -ms-user-select: none;
189
+ user-select: none;
190
+ }
191
+
192
+ .line-numbers-rows > span {
193
+ pointer-events: none;
194
+ display: block;
195
+ counter-increment: linenumber;
196
+ height: auto !important;
197
+ }
198
+
199
+ .line-numbers-rows > span:before {
200
+ content: counter(linenumber);
201
+ color: #999;
202
+ display: block;
203
+ padding-right: 0.8em;
204
+ text-align: right;
205
+ }
206
+ `;
207
+ }
208
+ }
209
+ customElements.define('pb-code-highlight', PbCodeHighlight);
package/src/pb-codepen.js CHANGED
@@ -1,85 +1,92 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
 
3
-
4
3
  /**
5
4
  * Embed a codepen project to show live code. Used for some documentation examples.
6
5
  *
7
6
  */
8
7
  export class PbCodepen extends LitElement {
8
+ static get properties() {
9
+ return {
10
+ ...super.properties,
11
+ /**
12
+ * The user which created the codepen
13
+ */
14
+ user: {
15
+ type: String,
16
+ },
17
+ /**
18
+ * Identifies the pen
19
+ */
20
+ hash: {
21
+ type: String,
22
+ },
23
+ /**
24
+ * Height of the iframe in pixel
25
+ */
26
+ height: {
27
+ type: Number,
28
+ },
29
+ /**
30
+ * Either 'dark' or 'light'
31
+ */
32
+ theme: {
33
+ type: String,
34
+ },
35
+ /**
36
+ * If set, the codepen will not load before being
37
+ * clicked by the user
38
+ */
39
+ preview: {
40
+ type: Boolean,
41
+ },
42
+ /**
43
+ * Make the codepen editable (requires paid account)
44
+ */
45
+ editable: {
46
+ type: Boolean,
47
+ },
48
+ };
49
+ }
9
50
 
10
- static get properties() {
11
- return {
12
- ...super.properties,
13
- /**
14
- * The user which created the codepen
15
- */
16
- user: {
17
- type: String
18
- },
19
- /**
20
- * Identifies the pen
21
- */
22
- hash: {
23
- type: String
24
- },
25
- /**
26
- * Height of the iframe in pixel
27
- */
28
- height: {
29
- type: Number
30
- },
31
- /**
32
- * Either 'dark' or 'light'
33
- */
34
- theme: {
35
- type: String
36
- },
37
- /**
38
- * If set, the codepen will not load before being
39
- * clicked by the user
40
- */
41
- preview: {
42
- type: Boolean
43
- },
44
- /**
45
- * Make the codepen editable (requires paid account)
46
- */
47
- editable: {
48
- type: Boolean
49
- }
50
- };
51
- }
51
+ constructor() {
52
+ super();
53
+ this.height = 256;
54
+ this.theme = 'light';
55
+ }
52
56
 
53
- constructor() {
54
- super();
55
- this.height = 256;
56
- this.theme = 'light';
57
+ render() {
58
+ let params = `height=${this.height}&theme-id=${this.theme}&default-tab=html,result`;
59
+ if (this.editable) {
60
+ params = `${params}&editable=true`;
57
61
  }
62
+ const url = `https://codepen.io/${this.user}/embed/${this.preview ? 'preview/' : ''}${
63
+ this.hash
64
+ }?${params}`;
65
+ return html`
66
+ <iframe
67
+ height="${this.height}"
68
+ scrolling="no"
69
+ title="${this.labe}l"
70
+ src="${url}"
71
+ frameborder="no"
72
+ allowtransparency="true"
73
+ allowfullscreen
74
+ >
75
+ Loading codepen ...
76
+ </iframe>
77
+ `;
78
+ }
58
79
 
59
- render() {
60
- let params = `height=${this.height}&theme-id=${this.theme}&default-tab=html,result`;
61
- if (this.editable) {
62
- params = `${params}&editable=true`;
63
- }
64
- const url = `https://codepen.io/${this.user}/embed/${this.preview ? 'preview/' : ''}${this.hash}?${params}`;
65
- return html`
66
- <iframe height="${this.height}" scrolling="no" title="${this.labe}l"
67
- src="${url}" frameborder="no" allowtransparency="true" allowfullscreen>
68
- Loading codepen ...
69
- </iframe>
70
- `;
71
- }
80
+ static get styles() {
81
+ return css`
82
+ :host {
83
+ display: block;
84
+ }
72
85
 
73
- static get styles() {
74
- return css`
75
- :host {
76
- display: block;
77
- }
78
-
79
- iframe {
80
- width: 100%;
81
- }
82
- `;
83
- }
86
+ iframe {
87
+ width: 100%;
88
+ }
89
+ `;
90
+ }
84
91
  }
85
- customElements.define('pb-codepen', PbCodepen);
92
+ customElements.define('pb-codepen', PbCodepen);