@teipublisher/pb-components 2.26.0-next-3.1 → 2.26.0-next-3.3
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 +19 -0
- package/dist/pb-components-bundle.js +76 -27
- package/dist/pb-elements.json +11 -0
- package/i18n/common/en.json +6 -0
- package/package.json +1 -1
- package/pb-elements.json +11 -0
- package/src/pb-lang.js +64 -20
- package/src/pb-login.js +3 -3
- package/src/pb-zoom.js +25 -5
package/dist/pb-elements.json
CHANGED
|
@@ -5518,6 +5518,11 @@
|
|
|
5518
5518
|
"name": "selected",
|
|
5519
5519
|
"type": "string"
|
|
5520
5520
|
},
|
|
5521
|
+
{
|
|
5522
|
+
"name": "display",
|
|
5523
|
+
"description": "How should the selected value be displayed?\n\n- `text` - Display the text content of the selected option\n- other - Attribute name to use",
|
|
5524
|
+
"type": "string"
|
|
5525
|
+
},
|
|
5521
5526
|
{
|
|
5522
5527
|
"name": "label",
|
|
5523
5528
|
"description": "The label for a language in the dropdown",
|
|
@@ -5562,6 +5567,12 @@
|
|
|
5562
5567
|
"attribute": "selected",
|
|
5563
5568
|
"type": "string"
|
|
5564
5569
|
},
|
|
5570
|
+
{
|
|
5571
|
+
"name": "display",
|
|
5572
|
+
"attribute": "display",
|
|
5573
|
+
"description": "How should the selected value be displayed?\n\n- `text` - Display the text content of the selected option\n- other - Attribute name to use",
|
|
5574
|
+
"type": "string"
|
|
5575
|
+
},
|
|
5565
5576
|
{
|
|
5566
5577
|
"name": "label",
|
|
5567
5578
|
"attribute": "label",
|
package/i18n/common/en.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teipublisher/pb-components",
|
|
3
|
-
"version": "2.26.0-next-3.
|
|
3
|
+
"version": "2.26.0-next-3.3",
|
|
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
|
@@ -5518,6 +5518,11 @@
|
|
|
5518
5518
|
"name": "selected",
|
|
5519
5519
|
"type": "string"
|
|
5520
5520
|
},
|
|
5521
|
+
{
|
|
5522
|
+
"name": "display",
|
|
5523
|
+
"description": "How should the selected value be displayed?\n\n- `text` - Display the text content of the selected option\n- other - Attribute name to use",
|
|
5524
|
+
"type": "string"
|
|
5525
|
+
},
|
|
5521
5526
|
{
|
|
5522
5527
|
"name": "label",
|
|
5523
5528
|
"description": "The label for a language in the dropdown",
|
|
@@ -5562,6 +5567,12 @@
|
|
|
5562
5567
|
"attribute": "selected",
|
|
5563
5568
|
"type": "string"
|
|
5564
5569
|
},
|
|
5570
|
+
{
|
|
5571
|
+
"name": "display",
|
|
5572
|
+
"attribute": "display",
|
|
5573
|
+
"description": "How should the selected value be displayed?\n\n- `text` - Display the text content of the selected option\n- other - Attribute name to use",
|
|
5574
|
+
"type": "string"
|
|
5575
|
+
},
|
|
5565
5576
|
{
|
|
5566
5577
|
"name": "label",
|
|
5567
5578
|
"attribute": "label",
|
package/src/pb-lang.js
CHANGED
|
@@ -21,11 +21,41 @@ export class PbLang extends themableMixin(pbMixin(LitElement)) {
|
|
|
21
21
|
::slotted(*) {
|
|
22
22
|
display: none;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
details {
|
|
25
|
+
position: relative;
|
|
25
26
|
display: inline-block;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
summary {
|
|
28
29
|
color: var(--pb-lang-input-color, inherit);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
list-style: none;
|
|
32
|
+
padding: 0.5em;
|
|
33
|
+
}
|
|
34
|
+
summary::-webkit-details-marker {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
ul {
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 100%;
|
|
40
|
+
left: 0;
|
|
41
|
+
max-height: 80vh;
|
|
42
|
+
overflow-y: auto;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
list-style: none;
|
|
46
|
+
background: white;
|
|
47
|
+
border: 1px solid #ccc;
|
|
48
|
+
border-radius: 4px;
|
|
49
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
50
|
+
z-index: 1000;
|
|
51
|
+
}
|
|
52
|
+
li {
|
|
53
|
+
list-style: none;
|
|
54
|
+
padding: 0.5em 1em;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
}
|
|
57
|
+
li:hover {
|
|
58
|
+
background: #f0f0f0;
|
|
29
59
|
}
|
|
30
60
|
`;
|
|
31
61
|
}
|
|
@@ -41,6 +71,16 @@ export class PbLang extends themableMixin(pbMixin(LitElement)) {
|
|
|
41
71
|
},
|
|
42
72
|
selected: {
|
|
43
73
|
type: String
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* How should the selected value be displayed?
|
|
77
|
+
*
|
|
78
|
+
* - `text` - Display the text content of the selected option
|
|
79
|
+
* - other - Attribute name to use
|
|
80
|
+
*/
|
|
81
|
+
display: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: 'value'
|
|
44
84
|
}
|
|
45
85
|
};
|
|
46
86
|
}
|
|
@@ -65,36 +105,40 @@ export class PbLang extends themableMixin(pbMixin(LitElement)) {
|
|
|
65
105
|
|
|
66
106
|
render() {
|
|
67
107
|
return html`
|
|
68
|
-
<
|
|
108
|
+
<details>
|
|
109
|
+
<summary aria-label="${translate(this.label)}" title="${translate(this.label)}"></summary>
|
|
110
|
+
<ul></ul>
|
|
111
|
+
</details>
|
|
69
112
|
<slot @slotchange="${this._syncOptions}"></slot>
|
|
70
113
|
`;
|
|
71
114
|
}
|
|
72
115
|
|
|
73
116
|
_syncOptions() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (!select) {
|
|
78
|
-
select = this.shadowRoot.querySelector('select');
|
|
79
|
-
}
|
|
80
|
-
if (!select) return;
|
|
117
|
+
const ul = this.shadowRoot.querySelector('ul');
|
|
118
|
+
const summary = this.shadowRoot.querySelector('summary');
|
|
119
|
+
if (!ul || !summary) return;
|
|
81
120
|
|
|
82
121
|
// Clear existing options
|
|
83
|
-
|
|
122
|
+
ul.innerHTML = '';
|
|
84
123
|
|
|
85
124
|
// Get all option elements from the light DOM
|
|
86
125
|
const options = Array.from(this.querySelectorAll('option, paper-item'));
|
|
87
126
|
options.forEach(option => {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
127
|
+
const li = document.createElement('li');
|
|
128
|
+
li.textContent = option.textContent;
|
|
129
|
+
li.dataset.value = option.value || option.getAttribute('value');
|
|
130
|
+
|
|
131
|
+
if (li.dataset.value === this.selected) {
|
|
132
|
+
summary.textContent = this.display === 'text' ? option.textContent : option[this.display];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
li.addEventListener('click', () => {
|
|
136
|
+
this._changed({ target: { value: li.dataset.value } });
|
|
137
|
+
this.shadowRoot.querySelector('details').removeAttribute('open');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
ul.appendChild(li);
|
|
92
141
|
});
|
|
93
|
-
|
|
94
|
-
// Set the selected value
|
|
95
|
-
if (this.selected) {
|
|
96
|
-
select.value = this.selected;
|
|
97
|
-
}
|
|
98
142
|
}
|
|
99
143
|
|
|
100
144
|
_changed(e) {
|
package/src/pb-login.js
CHANGED
|
@@ -167,14 +167,14 @@ export class PbLogin extends themableMixin(pbMixin(LitElement)) {
|
|
|
167
167
|
|
|
168
168
|
<form action="login">
|
|
169
169
|
<pb-dialog ?modal="${this.auto}">
|
|
170
|
-
<
|
|
170
|
+
<div slot="title">${translate('login.login')}</div>
|
|
171
171
|
<label>
|
|
172
172
|
${ translate('login.user') }
|
|
173
|
-
<input name="user" value="${this.user}" autofocus></input>
|
|
173
|
+
<input name="user" value="${this.user}" autofocus placeholder="${translate('login.user')}"></input>
|
|
174
174
|
</label>
|
|
175
175
|
<label>
|
|
176
176
|
${ translate('login.password') }
|
|
177
|
-
<input name="password" type="password"></input>
|
|
177
|
+
<input name="password" type="password" placeholder="${translate('login.password')}"></input>
|
|
178
178
|
</label>
|
|
179
179
|
<slot name="information"></slot>
|
|
180
180
|
${ this._invalid ? html`<p id="message" part="message-invalid">${translate('login.invalid')}<span part="group-invalid">${this.group ? html` (${translate('login.requiredGroup', { group: this.group })})` : null}</span>.</p>` : null }
|
package/src/pb-zoom.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LitElement, html } from 'lit-element';
|
|
1
|
+
import { LitElement, css, html } from 'lit-element';
|
|
2
2
|
import { pbMixin } from './pb-mixin';
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
3
|
+
import { translate } from './pb-i18n';
|
|
4
|
+
import { themableMixin } from './theming';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Zoom button to enlarge/shrink the font for the views. This component does not
|
|
@@ -9,7 +9,7 @@ import '@polymer/paper-icon-button';
|
|
|
9
9
|
*
|
|
10
10
|
* @fires pb-zoom - sends an event for e.g. pb-views to react to
|
|
11
11
|
*/
|
|
12
|
-
export class PbZoom extends pbMixin(LitElement) {
|
|
12
|
+
export class PbZoom extends themableMixin(pbMixin(LitElement)) {
|
|
13
13
|
static get properties() {
|
|
14
14
|
return {
|
|
15
15
|
...super.properties,
|
|
@@ -44,7 +44,27 @@ export class PbZoom extends pbMixin(LitElement) {
|
|
|
44
44
|
|
|
45
45
|
render() {
|
|
46
46
|
return html`
|
|
47
|
-
<
|
|
47
|
+
<a href="#" @click="${this._handleClick}" title="${this.direction === 'in' ? translate('toolbar.zoom.in') : translate('toolbar.zoom.out')}">
|
|
48
|
+
<slot name="icon">
|
|
49
|
+
${this.direction === 'in' ? html`
|
|
50
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM10 10V7H12V10H15V12H12V15H10V12H7V10H10Z"></path></svg>
|
|
51
|
+
` : html`
|
|
52
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM7 10H15V12H7V10Z"></path></svg>
|
|
53
|
+
`}
|
|
54
|
+
</slot>
|
|
55
|
+
</a>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static get styles() {
|
|
60
|
+
return css`
|
|
61
|
+
a {
|
|
62
|
+
color: inherit;
|
|
63
|
+
text-decoration: none;
|
|
64
|
+
}
|
|
65
|
+
a:hover {
|
|
66
|
+
color: inherit;
|
|
67
|
+
}
|
|
48
68
|
`;
|
|
49
69
|
}
|
|
50
70
|
|