@blockquote-web-components/blockquote-base-embedded-webview 1.3.3 → 1.4.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": "@blockquote-web-components/blockquote-base-embedded-webview",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "Webcomponent blockquote-base-embedded-webview following open-wc recommendations",
5
5
  "keywords": [
6
6
  "lit",
@@ -169,11 +169,12 @@
169
169
  },
170
170
  "devDependencies": {
171
171
  "@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.4.1",
172
+ "@blockquote-web-components/blockquote-foundations-sass": "^1.0.0",
172
173
  "@polymer/iron-test-helpers": "^3.0.1"
173
174
  },
174
175
  "publishConfig": {
175
176
  "access": "public"
176
177
  },
177
178
  "customElements": "custom-elements.json",
178
- "gitHead": "5251771346031c1b7333ffa0b16a3086f39684c0"
179
+ "gitHead": "0c5ec040de2e96a0464da78debdc5329d99ba700"
179
180
  }
@@ -1,14 +1,38 @@
1
- import { html, LitElement, svg } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { ref, createRef } from 'lit/directives/ref.js';
3
3
  import '../define/blockquote-base-embedded-webview-size.js';
4
4
  import '../define/blockquote-base-embedded-webview-resize.js';
5
5
  import '../define/blockquote-base-embedded-webview-element.js';
6
6
  import { styles } from './styles/blockquote-base-embedded-webview-styles.css.js';
7
7
 
8
- const chevronDownIcon = svg`<svg aria-hidden="true" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
9
- <polyline points="6 9 12 15 18 9" />
8
+ const chevronDownIcon = html`<svg
9
+ aria-hidden="true"
10
+ viewBox="0 0 24 24"
11
+ stroke-width="2"
12
+ stroke="currentcolor"
13
+ fill="none"
14
+ stroke-linecap="round"
15
+ stroke-linejoin="round"
16
+ >
17
+ <polyline points="6 9 12 15 18 9" />
10
18
  </svg>`;
11
19
 
20
+ // https://github.com/ChromeDevTools/devtools-frontend/blob/main/front_end/Images/src/open-externally.svg
21
+ const openExternallyIcon = html`
22
+ <svg
23
+ viewBox="0 0 20 20"
24
+ fill-rule="evenodd"
25
+ fill="currentcolor"
26
+ preserveAspectRatio="xMidYMid meet"
27
+ focusable="false"
28
+ xmlns="http://www.w3.org/2000/svg"
29
+ >
30
+ <path
31
+ d="M4.5 17C4.08333 17 3.72933 16.854 3.438 16.562C3.146 16.2707 3 15.9167 3 15.5V4.5C3 4.08333 3.146 3.72933 3.438 3.438C3.72933 3.146 4.08333 3 4.5 3H10V4.5H4.5V15.5H15.5V10H17V15.5C17 15.9167 16.854 16.2707 16.562 16.562C16.2707 16.854 15.9167 17 15.5 17H4.5ZM8.062 13L7 11.938L14.438 4.5H12V3H17V8H15.5V5.562L8.062 13Z"
32
+ />
33
+ </svg>
34
+ `;
35
+
12
36
  /**
13
37
  ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
14
38
 
@@ -200,7 +224,8 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
200
224
  return html`
201
225
  <header>
202
226
  <div>
203
- ${this._headingTpl} ${this._selectTpl} ${this._descriptionTpl} ${this._readDataPosTpl}
227
+ ${this._headingTpl} ${this._navigationDemosTpl} ${this._descriptionTpl}
228
+ ${this._readDataPosTpl}
204
229
  </div>
205
230
  ${this._screenSizeTpl}
206
231
  </header>
@@ -211,6 +236,10 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
211
236
  return html`<div aria-level="${this._headingLevel}" role="heading">${this.heading}</div>`;
212
237
  }
213
238
 
239
+ get _navigationDemosTpl() {
240
+ return html` <div>${this._selectTpl}${this._externalLinkTpl}</div> `;
241
+ }
242
+
214
243
  get _selectTpl() {
215
244
  return html`
216
245
  ${this._sources.some(options => options.option)
@@ -232,6 +261,13 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
232
261
  `;
233
262
  }
234
263
 
264
+ get _externalLinkTpl() {
265
+ return html`<a href="${this._src}" target="_blank" class="open-externally">
266
+ <span class="sr-only">View demo in a new tab</span
267
+ ><span aria-hidden="true">${openExternallyIcon}</span></a
268
+ >`;
269
+ }
270
+
235
271
  get _descriptionTpl() {
236
272
  return html` <p class="description">${this._sources[this.selected].description}</p>`;
237
273
  }
@@ -20,6 +20,18 @@ export const styles = css`:host {
20
20
  display: none !important;
21
21
  }
22
22
 
23
+ .sr-only {
24
+ position: absolute;
25
+ width: 1px;
26
+ height: 1px;
27
+ padding: 0;
28
+ margin: -1px;
29
+ overflow: hidden;
30
+ clip: rect(0, 0, 0, 0);
31
+ white-space: nowrap;
32
+ border: 0;
33
+ }
34
+
23
35
  .main {
24
36
  contain: content;
25
37
  flex: 1;
@@ -36,11 +48,6 @@ export const styles = css`:host {
36
48
  box-sizing: inherit;
37
49
  }
38
50
 
39
- [role=heading] {
40
- font-size: 1.25rem;
41
- margin-bottom: 0.5rem;
42
- }
43
-
44
51
  header > div {
45
52
  position: relative;
46
53
  max-width: 80rem;
@@ -48,6 +55,26 @@ header > div {
48
55
  padding: 0.5rem 1.5rem;
49
56
  }
50
57
 
58
+ [role=heading] {
59
+ font-size: 1.25rem;
60
+ margin-bottom: 0.5rem;
61
+ }
62
+
63
+ [role=heading] + div {
64
+ display: flex;
65
+ align-items: center;
66
+ }
67
+
68
+ .open-externally {
69
+ width: 1rem;
70
+ display: inline-block;
71
+ margin-left: 1rem;
72
+ color: inherit;
73
+ }
74
+ .open-externally svg {
75
+ vertical-align: bottom;
76
+ }
77
+
51
78
  .select {
52
79
  display: inline-grid;
53
80
  grid-template-areas: select;