@teipublisher/pb-components 2.1.0 → 2.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
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",
@@ -27,7 +27,8 @@
27
27
  "format:prettier": "prettier \"**/*.js\" --write --ignore-path .gitignore",
28
28
  "lint": "npm run lint:eslint && npm run lint:prettier",
29
29
  "format": "npm run format:eslint && npm run format:prettier",
30
- "clean": "rimraf dist lib css images/leaflet images/openseadragon demo/build docs",
30
+ "clean": "npm run clean-lib && rimraf dist css images/leaflet demo/build docs",
31
+ "clean-lib": "rimraf -g lib/leaflet* lib/paged*",
31
32
  "prepare": "npm run docs && npm run build:production",
32
33
  "semantic-release": "semantic-release",
33
34
  "gh-pages": "node gh-pages.js"
@@ -81,7 +82,6 @@
81
82
  "lit-element": "latest",
82
83
  "lit-html": "^1.3.0",
83
84
  "marked": "^1.2.0",
84
- "openseadragon": "github:Jinntec/openseadragon",
85
85
  "pagedjs": "^0.4.0",
86
86
  "prismjs": "^1.21.0",
87
87
  "tippy.js": "^6.2.7",
package/pb-elements.json CHANGED
@@ -2500,7 +2500,7 @@
2500
2500
  {
2501
2501
  "name": "pb-collapse",
2502
2502
  "path": "./src/pb-collapse.js",
2503
- "description": "A collapsible block: in collapsed state it only shows a header and expands if clicked.\r\nThe header should go into slot `collapse-trigger`, the content into `collapse-content`.\r\nExample:\r\n\r\n```html\r\n<pb-collapse>\r\n <div slot=\"collapse-trigger\">\r\n Metadata\r\n </div>\r\n <pb-view slot=\"collapse-content\" src=\"document1\" subscribe=\"transcription\" xpath=\"//teiHeader\"></pb-view>\r\n</pb-collapse>\r\n```",
2503
+ "description": "A collapsible block: in collapsed state it only shows a header and expands if clicked.\nThe header should go into slot `collapse-trigger`, the content into `collapse-content`.\nExample:\n\n```html\n<pb-collapse>\n <div slot=\"collapse-trigger\">\n Metadata\n </div>\n <pb-view slot=\"collapse-content\" src=\"document1\" subscribe=\"transcription\" xpath=\"//teiHeader\"></pb-view>\n</pb-collapse>\n```\n\nBy adding a CSS 'icon-right' to a `pb-collapse` the icon can be placed on the right side\n```\n<pb-collapse class='icon-right'>\n```",
2504
2504
  "attributes": [
2505
2505
  {
2506
2506
  "name": "horizontal",
@@ -2540,7 +2540,7 @@
2540
2540
  },
2541
2541
  {
2542
2542
  "name": "toggles",
2543
- "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\r\nSet to true to keep multiple pb-collapse open at the same time.",
2543
+ "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\nSet to true to keep multiple pb-collapse open at the same time.",
2544
2544
  "type": "boolean",
2545
2545
  "default": "false"
2546
2546
  },
@@ -2622,7 +2622,7 @@
2622
2622
  {
2623
2623
  "name": "toggles",
2624
2624
  "attribute": "toggles",
2625
- "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\r\nSet to true to keep multiple pb-collapse open at the same time.",
2625
+ "description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\nSet to true to keep multiple pb-collapse open at the same time.",
2626
2626
  "type": "boolean",
2627
2627
  "default": "false"
2628
2628
  },
@@ -1,184 +1,197 @@
1
- import { LitElement, html, css } from 'lit-element';
2
- import { pbMixin } from './pb-mixin.js';
3
- import { themableMixin } from "./theming.js";
4
- import '@polymer/iron-icon';
5
- import '@polymer/iron-icons';
6
- import '@polymer/iron-collapse';
7
-
8
-
9
- /**
10
- * A collapsible block: in collapsed state it only shows a header and expands if clicked.
11
- * The header should go into slot `collapse-trigger`, the content into `collapse-content`.
12
- * Example:
13
- *
14
- * ```html
15
- * <pb-collapse>
16
- * <div slot="collapse-trigger">
17
- * Metadata
18
- * </div>
19
- * <pb-view slot="collapse-content" src="document1" subscribe="transcription" xpath="//teiHeader"></pb-view>
20
- * </pb-collapse>
21
- * ```
22
- *
23
- * @slot collapse-trigger - trigger toggling collapsed content on/off
24
- * @slot collapse-content - content to be collapsed
25
- * @cssprop [--pb-collapse-icon-padding=0 4px 0 0] - padding in px for the "caret-down" icon left to the collapsible item
26
- * @fires pb-collapse-open - Fires opening the collapsed section
27
- */
28
- export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
29
- static get properties() {
30
- return {
31
- ...super.properties,
32
- /**
33
- * @deprecated
34
- * Corresponds to the iron-collapse's horizontal property.
35
- */
36
- horizontal: {
37
- type: Boolean
38
- },
39
- /**
40
- * Corresponds to the iron-collapse's noAnimation property.
41
- *
42
- */
43
- noAnimation: {
44
- type: Boolean,
45
- attribute: 'no-animation'
46
- },
47
- /**
48
- * Whether currently expanded.
49
- *
50
- */
51
- opened: {
52
- type: Boolean
53
- },
54
- /**
55
- * By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.
56
- * Set to true to keep multiple pb-collapse open at the same time.
57
- */
58
- toggles: {
59
- type: Boolean
60
- },
61
- /**
62
- * The iron-icon when collapsed. Value must be one of the icons defined by iron-icons
63
- */
64
- expandIcon: {
65
- type: String,
66
- attribute: 'expand-icon'
67
- },
68
- /**
69
- * The icon when expanded.
70
- */
71
- collapseIcon: {
72
- type: String,
73
- attribute: 'collapse-icon'
74
- },
75
- /**
76
- * Whether to hide the expand/collapse icon.
77
- */
78
- noIcons: {
79
- type: Boolean,
80
- attribute: 'no-icons'
81
- }
82
- };
83
- }
84
-
85
- constructor() {
86
- super();
87
- this.horizontal = false;
88
- this.noAnimation = false;
89
- this.opened = false;
90
- this.expandIcon = 'icons:expand-more';
91
- this.collapseIcon = 'icons:expand-less';
92
- this.noIcons = false;
93
- this.toggles = false;
94
- }
95
-
96
- connectedCallback() {
97
- super.connectedCallback();
98
- this.addEventListener('pb-collapse-open', () => {
99
- this.open();
100
- });
101
- if (this.toggles) {
102
- this.subscribeTo('pb-collapse-open', (ev) => {
103
- if (!ev.detail || ev.detail._source === this) {
104
- return;
105
- }
106
- for (const collapse of this.querySelectorAll('pb-collapse')) {
107
- if (collapse === ev.detail._source) {
108
- return;
109
- }
110
- }
111
- this.close();
112
- });
113
- }
114
- }
115
-
116
- /**
117
- * opens the collapsible section
118
- */
119
- open() {
120
- if (this.opened) {
121
- return;
122
- }
123
- this.opened = true;
124
-
125
- this.emitTo('pb-collapse-open', this);
126
- }
127
-
128
- /**
129
- * closes the collapsible section
130
- */
131
- close() {
132
- if (this.opened) {
133
- this.opened = false;
134
- }
135
- }
136
-
137
- /**
138
- * toggles the collapsible state
139
- */
140
- toggle() {
141
- this.opened = !this.opened;
142
- if (this.opened) {
143
- this.emitTo('pb-collapse-open', this.data);
144
- }
145
- }
146
-
147
- render() {
148
- return html`
149
- <div id="trigger" @click="${this.toggle}" class="collapse-trigger">
150
- ${
151
- !this.noIcons ?
152
- html`<iron-icon icon="${this.opened ? this.collapseIcon : this.expandIcon}"></iron-icon>` :
153
- null
154
- }
155
- <slot id="collapseTrigger" name="collapse-trigger"></slot>
156
- </div>
157
- <iron-collapse id="collapse" horizontal="${this.horizontal}" no-animation="${this.noAnimation}" .opened="${this.opened}">
158
- <slot name="collapse-content"></slot>
159
- </iron-collapse>
160
- `;
161
- }
162
-
163
- static get styles() {
164
- return css`
165
- :host {
166
- display: block;
167
- }
168
-
169
- #trigger {
170
- display: table-row;
171
- }
172
-
173
- #trigger iron-icon {
174
- display: table-cell;
175
- padding: var(--pb-collapse-icon-padding, 0 4px 0 0);
176
- }
177
-
178
- slot[name="collapse-trigger"] {
179
- display: table-cell;
180
- }
181
- `;
182
- }
183
- }
184
- customElements.define('pb-collapse', PbCollapse);
1
+ import {LitElement, html, css} from 'lit-element';
2
+ import {pbMixin} from './pb-mixin.js';
3
+ import {themableMixin} from "./theming.js";
4
+ import '@polymer/iron-icon';
5
+ import '@polymer/iron-icons';
6
+ import '@polymer/iron-collapse';
7
+
8
+
9
+ /**
10
+ * A collapsible block: in collapsed state it only shows a header and expands if clicked.
11
+ * The header should go into slot `collapse-trigger`, the content into `collapse-content`.
12
+ * Example:
13
+ *
14
+ * ```html
15
+ * <pb-collapse>
16
+ * <div slot="collapse-trigger">
17
+ * Metadata
18
+ * </div>
19
+ * <pb-view slot="collapse-content" src="document1" subscribe="transcription" xpath="//teiHeader"></pb-view>
20
+ * </pb-collapse>
21
+ * ```
22
+ *
23
+ * By adding a CSS 'icon-right' to a `pb-collapse` the icon can be placed on the right side
24
+ * ```
25
+ * <pb-collapse class='icon-right'>
26
+ * ```
27
+ *
28
+ * @slot collapse-trigger - trigger toggling collapsed content on/off
29
+ * @slot collapse-content - content to be collapsed
30
+ * @cssprop [--pb-collapse-icon-padding=0 4px 0 0] - padding in px for the "caret-down" icon left to the collapsible item
31
+ * @fires pb-collapse-open - Fires opening the collapsed section
32
+ */
33
+ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
34
+ static get properties() {
35
+ return {
36
+ ...super.properties,
37
+ /**
38
+ * @deprecated
39
+ * Corresponds to the iron-collapse's horizontal property.
40
+ */
41
+ horizontal: {
42
+ type: Boolean
43
+ },
44
+ /**
45
+ * Corresponds to the iron-collapse's noAnimation property.
46
+ *
47
+ */
48
+ noAnimation: {
49
+ type: Boolean,
50
+ attribute: 'no-animation'
51
+ },
52
+ /**
53
+ * Whether currently expanded.
54
+ *
55
+ */
56
+ opened: {
57
+ type: Boolean
58
+ },
59
+ /**
60
+ * By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.
61
+ * Set to true to keep multiple pb-collapse open at the same time.
62
+ */
63
+ toggles: {
64
+ type: Boolean
65
+ },
66
+ /**
67
+ * The iron-icon when collapsed. Value must be one of the icons defined by iron-icons
68
+ */
69
+ expandIcon: {
70
+ type: String,
71
+ attribute: 'expand-icon'
72
+ },
73
+ /**
74
+ * The icon when expanded.
75
+ */
76
+ collapseIcon: {
77
+ type: String,
78
+ attribute: 'collapse-icon'
79
+ },
80
+ /**
81
+ * Whether to hide the expand/collapse icon.
82
+ */
83
+ noIcons: {
84
+ type: Boolean,
85
+ attribute: 'no-icons'
86
+ }
87
+ };
88
+ }
89
+
90
+ constructor() {
91
+ super();
92
+ this.horizontal = false;
93
+ this.noAnimation = false;
94
+ this.opened = false;
95
+ this.expandIcon = 'icons:expand-more';
96
+ this.collapseIcon = 'icons:expand-less';
97
+ this.noIcons = false;
98
+ this.toggles = false;
99
+ }
100
+
101
+ connectedCallback() {
102
+ super.connectedCallback();
103
+ this.addEventListener('pb-collapse-open', () => {
104
+ this.open();
105
+ });
106
+ if (this.toggles) {
107
+ this.subscribeTo('pb-collapse-open', (ev) => {
108
+ if (!ev.detail || ev.detail._source === this) {
109
+ return;
110
+ }
111
+ for (const collapse of this.querySelectorAll('pb-collapse')) {
112
+ if (collapse === ev.detail._source) {
113
+ return;
114
+ }
115
+ }
116
+ this.close();
117
+ });
118
+ }
119
+ }
120
+
121
+ /**
122
+ * opens the collapsible section
123
+ */
124
+ open() {
125
+ if (this.opened) {
126
+ return;
127
+ }
128
+ this.opened = true;
129
+
130
+ this.emitTo('pb-collapse-open', this);
131
+ }
132
+
133
+ /**
134
+ * closes the collapsible section
135
+ */
136
+ close() {
137
+ if (this.opened) {
138
+ this.opened = false;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * toggles the collapsible state
144
+ */
145
+ toggle() {
146
+ this.opened = !this.opened;
147
+ if (this.opened) {
148
+ this.emitTo('pb-collapse-open', this.data);
149
+ }
150
+ }
151
+
152
+ render() {
153
+ return html`
154
+ <div id="trigger" @click="${this.toggle}" class="collapse-trigger">
155
+ ${
156
+ !this.noIcons ?
157
+ html`<iron-icon icon="${this.opened ? this.collapseIcon : this.expandIcon}"></iron-icon>` :
158
+ null
159
+ }
160
+ <slot id="collapseTrigger" name="collapse-trigger"></slot>
161
+ </div>
162
+ <iron-collapse id="collapse" horizontal="${this.horizontal}" no-animation="${this.noAnimation}" .opened="${this.opened}">
163
+ <slot name="collapse-content"></slot>
164
+ </iron-collapse>
165
+ `;
166
+ }
167
+
168
+ static get styles() {
169
+ return css`
170
+ :host {
171
+ display: block;
172
+ position: relative;
173
+ }
174
+
175
+ #trigger {
176
+ display: table-row;
177
+ }
178
+
179
+ iron-icon {
180
+ display: table-cell;
181
+ padding: var(--pb-collapse-icon-padding, 0 4px 0 0);
182
+ }
183
+
184
+ :host(.icon-right) iron-icon {
185
+ position: absolute;
186
+ right: 0;
187
+ }
188
+
189
+ slot[name="collapse-trigger"] {
190
+ display: table-cell;
191
+ }
192
+ `;
193
+ }
194
+ }
195
+ if (!customElements.get('pb-collapse')) {
196
+ customElements.define('pb-collapse', PbCollapse);
197
+ }
package/src/pb-login.js CHANGED
@@ -129,16 +129,22 @@ export class PbLogin extends pbMixin(LitElement) {
129
129
  };
130
130
  this._checkLogin.generateRequest();
131
131
  });
132
+ this.addEventListener('keyup', event => {
133
+ if (event.keyCode === 13) {
134
+ event.preventDefault();
135
+ this._confirmLogin();
136
+ }
137
+ });
132
138
  }
133
139
 
134
140
  render() {
135
141
  return html`
136
- <a href="#" @click="${this._show}" title="${this.user}">
142
+ <a href="#" @click="${this._show}" role="button" title="${this.user ? this.user : this.loginLabel}">
137
143
  ${
138
144
  this.loggedIn ?
139
145
  html`<iron-icon icon="${this.logoutIcon}"></iron-icon> <span class="label">${translate(this.logoutLabel, { user: this.user })}</span>` :
140
146
  html`<iron-icon icon="${this.loginIcon}"></iron-icon> <span class="label">${translate(this.loginLabel)}</span>`
141
- }
147
+ }
142
148
  </a>
143
149
 
144
150
  <paper-dialog id="loginDialog">
@@ -191,12 +197,8 @@ export class PbLogin extends pbMixin(LitElement) {
191
197
  a {
192
198
  color: var(--pb-login-link-color, --pb-link-color);
193
199
  text-decoration: none;
194
- }
195
-
196
- @media (max-width: 1024px) {
197
- .label {
198
- display: none;
199
- }
200
+ display: flex;
201
+ gap:0.5rem;
200
202
  }
201
203
 
202
204
  #message {
@@ -280,4 +282,4 @@ export class PbLogin extends pbMixin(LitElement) {
280
282
  * @param {Array<String>} groups groups the user is a member of
281
283
  */
282
284
  }
283
- customElements.define('pb-login', PbLogin);
285
+ customElements.define('pb-login', PbLogin);
package/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- dist: xenial
2
- language: node_js
3
- node_js:
4
- - 14
5
- services:
6
- - docker
7
- env:
8
- - img=existdb/teipublisher:6.0.0-RC1
9
- before_install:
10
- - docker pull $img
11
- - docker create --name exist-ci -p 8080:8080 $img
12
- - npm prune
13
- install:
14
- - npm install -q
15
- before_script:
16
- - docker start exist-ci
17
- # exist needs time
18
- - sleep 30
19
- script:
20
- - npm test