@blockquote-web-components/blockquote-base-embedded-webview 1.11.0 → 1.11.2

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/README.md CHANGED
@@ -201,17 +201,16 @@ It will create a `select` tag with the provided demo HTML files and add the `[da
201
201
  ```html
202
202
  <blockquote-base-embedded-webview-size
203
203
  screen-sizes="[
204
- { width: 360, height: 640, id: '360x640' },
205
- { width: 360, height: 800, id: '360x800' },
206
- { width: 414, height: 896, id: '414x896' },
207
- { width: 768, height: 1024, id: '768x1024' },
208
- { width: 810, height: 1080, id: '810x1080' },
209
- { width: 1280, height: 800, id: '1280x800' },
210
- { width: 1366, height: 768, id: '1366x768' },
211
- { width: 1536, height: 864, id: '1536x864' },
212
- { width: 1920, height: 1080, id: '1920x1080' },
213
- ]"
214
- ></blockquote-base-embedded-webview-size>
204
+ { width: 360, height: 800, id: '360x800' },
205
+ { width: 390, height: 864, id: '390x864' },
206
+ { width: 414, height: 896, id: '414x896' },
207
+ { width: 768, height: 1024, id: '768x1024' },
208
+ { width: 810, height: 1080, id: '810x1080' },
209
+ { width: 1280, height: 720, id: '1280x800' },
210
+ { width: 1366, height: 768, id: '1366x768' },
211
+ { width: 1536, height: 864, id: '1536x864' },
212
+ { width: 1920, height: 1080, id: '1920x1080' },
213
+ ]"></blockquote-base-embedded-webview-size>
215
214
  ```
216
215
 
217
216
 
@@ -1,6 +1,6 @@
1
- import { BlockquoteBaseEmbeddedWebviewElement } from '../src/BlockquoteBaseEmbeddedWebviewElement.js';
1
+ import {BlockquoteBaseEmbeddedWebviewElement} from '../src/BlockquoteBaseEmbeddedWebviewElement.js';
2
2
 
3
3
  window.customElements.define(
4
4
  'blockquote-base-embedded-webview-element',
5
- BlockquoteBaseEmbeddedWebviewElement,
5
+ BlockquoteBaseEmbeddedWebviewElement
6
6
  );
@@ -1,6 +1,6 @@
1
- import { BlockquoteBaseEmbeddedWebviewResize } from '../src/BlockquoteBaseEmbeddedWebviewResize.js';
1
+ import {BlockquoteBaseEmbeddedWebviewResize} from '../src/BlockquoteBaseEmbeddedWebviewResize.js';
2
2
 
3
3
  window.customElements.define(
4
4
  'blockquote-base-embedded-webview-resize',
5
- BlockquoteBaseEmbeddedWebviewResize,
5
+ BlockquoteBaseEmbeddedWebviewResize
6
6
  );
@@ -1,6 +1,6 @@
1
- import { BlockquoteBaseEmbeddedWebviewSize } from '../src/BlockquoteBaseEmbeddedWebviewSize.js';
1
+ import {BlockquoteBaseEmbeddedWebviewSize} from '../src/BlockquoteBaseEmbeddedWebviewSize.js';
2
2
 
3
3
  window.customElements.define(
4
4
  'blockquote-base-embedded-webview-size',
5
- BlockquoteBaseEmbeddedWebviewSize,
5
+ BlockquoteBaseEmbeddedWebviewSize
6
6
  );
@@ -1,3 +1,3 @@
1
- import { BlockquoteBaseEmbeddedWebview } from '../src/BlockquoteBaseEmbeddedWebview.js';
1
+ import {BlockquoteBaseEmbeddedWebview} from '../src/BlockquoteBaseEmbeddedWebview.js';
2
2
 
3
3
  window.customElements.define('blockquote-base-embedded-webview', BlockquoteBaseEmbeddedWebview);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockquote-web-components/blockquote-base-embedded-webview",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "Webcomponent blockquote-base-embedded-webview following open-wc recommendations",
5
5
  "keywords": [
6
6
  "lit",
@@ -98,12 +98,12 @@
98
98
  ]
99
99
  },
100
100
  "prettier": {
101
- "arrowParens": "avoid",
102
101
  "bracketSameLine": true,
102
+ "bracketSpacing": false,
103
103
  "htmlWhitespaceSensitivity": "ignore",
104
104
  "printWidth": 100,
105
105
  "singleQuote": true,
106
- "trailingComma": "all",
106
+ "trailingComma": "es5",
107
107
  "overrides": [
108
108
  {
109
109
  "files": "*.{scss,css}",
@@ -128,11 +128,11 @@
128
128
  },
129
129
  "devDependencies": {
130
130
  "@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.9.1",
131
- "@blockquote-web-components/blockquote-foundations-sass": "^1.1.3"
131
+ "@blockquote-web-components/blockquote-foundations-sass": "^1.1.4"
132
132
  },
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
136
136
  "customElements": "custom-elements.json",
137
- "gitHead": "015e61740035c23471a5164f460ce03b05adab32"
137
+ "gitHead": "0d8e9582b65cca369553640cc72d2ca93f2c0a61"
138
138
  }
@@ -1,9 +1,9 @@
1
- import { html, LitElement, render as LitHtmlRender } from 'lit';
2
- import { ref, createRef } from 'lit/directives/ref.js';
1
+ import {html, LitElement, render as LitHtmlRender} from 'lit';
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
- import { styles } from './styles/blockquote-base-embedded-webview-styles.css.js';
6
+ import {styles} from './styles/blockquote-base-embedded-webview-styles.css.js';
7
7
 
8
8
  const chevronDownIcon = html`
9
9
  <svg
@@ -143,9 +143,9 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
143
143
  this.heading = '';
144
144
  this.__resetResizing = false;
145
145
  this.__selectArrow = chevronDownIcon;
146
- this.__readDataPos = { x: '0', y: '0', resizing: false, cursor: '' };
146
+ this.__readDataPos = {x: '0', y: '0', resizing: false, cursor: ''};
147
147
  this.limitHeight = false;
148
- this._sources = [{ src: '', option: '', description: '' }];
148
+ this._sources = [{src: '', option: '', description: ''}];
149
149
  this._embeddedResizeRef = createRef();
150
150
  }
151
151
 
@@ -153,8 +153,8 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
153
153
  super.connectedCallback?.();
154
154
  await this.updateComplete;
155
155
 
156
- this.shadowRoot?.addEventListener('webviewresize', ev => {
157
- const { detail } = /** @type {CustomEvent} */ (ev);
156
+ this.shadowRoot?.addEventListener('webviewresize', (ev) => {
157
+ const {detail} = /** @type {CustomEvent} */ (ev);
158
158
 
159
159
  Object.assign(this.__readDataPos, detail);
160
160
  this.__resetResizing = true;
@@ -173,8 +173,8 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
173
173
 
174
174
  const _sources = Array.from(this.querySelectorAll('template'));
175
175
  if (_sources.length) {
176
- this._sources = _sources.map(item => {
177
- const { src = '', option = '', description = '' } = item.dataset;
176
+ this._sources = _sources.map((item) => {
177
+ const {src = '', option = '', description = ''} = item.dataset;
178
178
  return {
179
179
  src,
180
180
  option,
@@ -188,19 +188,19 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
188
188
  this.embedded = this.shadowRoot?.querySelector('[slot="embedded"]');
189
189
  if (this._embeddedResizeRef.value) {
190
190
  this._controlBottom = parseFloat(
191
- window.getComputedStyle(this._embeddedResizeRef.value).paddingBottom,
191
+ window.getComputedStyle(this._embeddedResizeRef.value).paddingBottom
192
192
  );
193
193
  }
194
194
  }
195
195
 
196
- _updateSize = ({ detail }) => {
196
+ _updateSize = ({detail}) => {
197
197
  /** @type {HTMLElement} */ (this._embeddedResizeRef?.value)?.style.setProperty(
198
198
  '--blockquote-base-embedded-webview-resize-rect-width',
199
- `${detail.width}px`,
199
+ `${detail.width}px`
200
200
  );
201
201
  /** @type {HTMLElement} */ (this._embeddedResizeRef?.value)?.style.setProperty(
202
202
  '--blockquote-base-embedded-webview-resize-rect-height',
203
- this.limitHeight ? '100%' : `${detail.height}px`,
203
+ this.limitHeight ? '100%' : `${detail.height}px`
204
204
  );
205
205
 
206
206
  this.__resetResizing = false;
@@ -218,7 +218,7 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
218
218
  }
219
219
 
220
220
  _litHtmlRender() {
221
- LitHtmlRender(this._lightDomTpl, this, { host: this });
221
+ LitHtmlRender(this._lightDomTpl, this, {host: this});
222
222
  }
223
223
 
224
224
  get _lightDomTpl() {
@@ -251,7 +251,7 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
251
251
 
252
252
  get _selectTpl() {
253
253
  return html`
254
- ${this._sources.some(options => options.option)
254
+ ${this._sources.some((options) => options.option)
255
255
  ? html`
256
256
  <div class="select">
257
257
  <select @change="${this._onChangeFile}" aria-label="Cases">
@@ -260,7 +260,7 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
260
260
  <option ?selected="${this.selected === index}" value="${index}">
261
261
  ${item.option}
262
262
  </option>
263
- `,
263
+ `
264
264
  )}
265
265
  </select>
266
266
  ${this.__selectArrow}
@@ -328,7 +328,7 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
328
328
  `;
329
329
  }
330
330
 
331
- _onChangeFile({ target }) {
331
+ _onChangeFile({target}) {
332
332
  this.selected = target.selectedIndex;
333
333
  this._src = this._sources[this.selected].src;
334
334
  }
@@ -1,5 +1,5 @@
1
- import { html, LitElement, render as LitHtmlRender } from 'lit';
2
- import { styles } from './styles/blockquote-base-embedded-webview-element-styles.css.js';
1
+ import {html, LitElement, render as LitHtmlRender} from 'lit';
2
+ import {styles} from './styles/blockquote-base-embedded-webview-element-styles.css.js';
3
3
 
4
4
  /**
5
5
  * ![Lit](https://img.shields.io/badge/lit-3.0.0-blue.svg)
@@ -78,7 +78,7 @@ export class BlockquoteBaseEmbeddedWebviewElement extends LitElement {
78
78
  }
79
79
 
80
80
  _litHtmlRender() {
81
- LitHtmlRender(this._lightDomTpl, this, { host: this });
81
+ LitHtmlRender(this._lightDomTpl, this, {host: this});
82
82
  }
83
83
 
84
84
  get _lightDomTpl() {
@@ -104,7 +104,7 @@ export class BlockquoteBaseEmbeddedWebviewElement extends LitElement {
104
104
  allowFullscreen: true,
105
105
  loading: 'lazy',
106
106
  },
107
- this.embeddedTitle && { title: this.embeddedTitle },
107
+ this.embeddedTitle && {title: this.embeddedTitle}
108
108
  );
109
109
 
110
110
  Object.assign(this._embeddedElement ?? {}, {
@@ -117,12 +117,12 @@ export class BlockquoteBaseEmbeddedWebviewElement extends LitElement {
117
117
  this._embeddedElement?.style ?? {},
118
118
  resource.indexOf('http') !== 0 && {
119
119
  opacity: 0,
120
- },
120
+ }
121
121
  );
122
122
  }
123
123
  }
124
124
 
125
- _onLoadElement = ({ target }) => {
125
+ _onLoadElement = ({target}) => {
126
126
  if (!target.contentDocument || !target.contentDocument.head.childNodes.length) {
127
127
  return;
128
128
  }
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import { styles } from './styles/blockquote-base-embedded-webview-resize-styles.css.js';
1
+ import {html, LitElement} from 'lit';
2
+ import {styles} from './styles/blockquote-base-embedded-webview-resize-styles.css.js';
3
3
 
4
4
  // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#value - window.scrollY to get a bounding rectangle which is independent from the current scrolling position.
5
5
  // https://www.browserstack.com/guide/ideal-screen-sizes-for-responsive-design
@@ -86,21 +86,21 @@ export class BlockquoteBaseEmbeddedWebviewResize extends LitElement {
86
86
  this._getBoundingClientRecDOMRect = DOMRect;
87
87
  this._getBoundingClientRectWidth = this._getBoundingClientRect('width');
88
88
  this._getBoundingClientRectHeight = this._getBoundingClientRect('height');
89
- const { target, pointerId, clientX: trackDistanceX, clientY: trackDistanceY } = ev;
89
+ const {target, pointerId, clientX: trackDistanceX, clientY: trackDistanceY} = ev;
90
90
 
91
91
  /** @type {Element} */ (target)?.setPointerCapture(pointerId);
92
92
 
93
93
  /**
94
94
  * @param {!PointerEvent} moveEvent
95
95
  */
96
- const addResizer = ({ clientX, clientY }) => {
96
+ const addResizer = ({clientX, clientY}) => {
97
97
  const dx = Math.floor(clientX - trackDistanceX);
98
98
  const dy = Math.floor(clientY - trackDistanceY);
99
- this._resize({ detail: { dx, dy } });
99
+ this._resize({detail: {dx, dy}});
100
100
  };
101
101
  target?.addEventListener(
102
102
  'pointermove',
103
- /** @type {EventListenerOrEventListenerObject} */ (addResizer),
103
+ /** @type {EventListenerOrEventListenerObject} */ (addResizer)
104
104
  );
105
105
 
106
106
  const removeResizer = () => {
@@ -108,7 +108,7 @@ export class BlockquoteBaseEmbeddedWebviewResize extends LitElement {
108
108
  /** @type {Element} */ (target)?.releasePointerCapture(pointerId);
109
109
  target?.removeEventListener(
110
110
  'pointermove',
111
- /** @type {EventListenerOrEventListenerObject} */ (addResizer),
111
+ /** @type {EventListenerOrEventListenerObject} */ (addResizer)
112
112
  );
113
113
  target?.removeEventListener('pointerup', removeResizer);
114
114
 
@@ -117,7 +117,7 @@ export class BlockquoteBaseEmbeddedWebviewResize extends LitElement {
117
117
  target?.addEventListener('pointerup', removeResizer);
118
118
  }
119
119
 
120
- _resize({ detail }) {
120
+ _resize({detail}) {
121
121
  let cssOffsetX;
122
122
  let cssOffsetY;
123
123
  const dx = Math.floor(detail.dx * 2.04);
@@ -164,10 +164,10 @@ export class BlockquoteBaseEmbeddedWebviewResize extends LitElement {
164
164
  bubbles: true,
165
165
  detail: {
166
166
  x: getComputedStyle(this).getPropertyValue(
167
- '--blockquote-base-embedded-webview-resize-rect-width',
167
+ '--blockquote-base-embedded-webview-resize-rect-width'
168
168
  ),
169
169
  y: getComputedStyle(this).getPropertyValue(
170
- '--blockquote-base-embedded-webview-resize-rect-height',
170
+ '--blockquote-base-embedded-webview-resize-rect-height'
171
171
  ),
172
172
  resizing: this.hasAttribute('resizing'),
173
173
  cursor: this._cursor,
@@ -1,5 +1,5 @@
1
- import { html, LitElement } from 'lit';
2
- import { styles } from './styles/blockquote-base-embedded-webview-size-styles.css.js';
1
+ import {html, LitElement} from 'lit';
2
+ import {styles} from './styles/blockquote-base-embedded-webview-size-styles.css.js';
3
3
  // https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/emulation/DeviceModeView.ts;l=164
4
4
 
5
5
  /**
@@ -11,17 +11,16 @@ import { styles } from './styles/blockquote-base-embedded-webview-size-styles.cs
11
11
  * ```html
12
12
  * <blockquote-base-embedded-webview-size
13
13
  * screen-sizes="[
14
- * { width: 360, height: 640, id: '360x640' },
15
- * { width: 360, height: 800, id: '360x800' },
16
- * { width: 414, height: 896, id: '414x896' },
17
- * { width: 768, height: 1024, id: '768x1024' },
18
- * { width: 810, height: 1080, id: '810x1080' },
19
- * { width: 1280, height: 800, id: '1280x800' },
20
- * { width: 1366, height: 768, id: '1366x768' },
21
- * { width: 1536, height: 864, id: '1536x864' },
22
- * { width: 1920, height: 1080, id: '1920x1080' },
23
- * ]"
24
- * ></blockquote-base-embedded-webview-size>
14
+ * { width: 360, height: 800, id: '360x800' },
15
+ * { width: 390, height: 864, id: '390x864' },
16
+ * { width: 414, height: 896, id: '414x896' },
17
+ * { width: 768, height: 1024, id: '768x1024' },
18
+ * { width: 810, height: 1080, id: '810x1080' },
19
+ * { width: 1280, height: 720, id: '1280x800' },
20
+ * { width: 1366, height: 768, id: '1366x768' },
21
+ * { width: 1536, height: 864, id: '1536x864' },
22
+ * { width: 1920, height: 1080, id: '1920x1080' },
23
+ * ]"></blockquote-base-embedded-webview-size>
25
24
  * ```
26
25
  *
27
26
  * @attribute screen-sizes
@@ -82,15 +81,15 @@ export class BlockquoteBaseEmbeddedWebviewSize extends LitElement {
82
81
  this.selected = 0;
83
82
  this.disabledSelectedSizeText = false;
84
83
  this.screenSizes = [
85
- { width: 360, height: 800, id: '360x800' },
86
- { width: 390, height: 864, id: '390x864' },
87
- { width: 414, height: 896, id: '414x896' },
88
- { width: 768, height: 1024, id: '768x1024' },
89
- { width: 810, height: 1080, id: '810x1080' },
90
- { width: 1280, height: 720, id: '1280x800' },
91
- { width: 1366, height: 768, id: '1366x768' },
92
- { width: 1536, height: 864, id: '1536x864' },
93
- { width: 1920, height: 1080, id: '1920x1080' },
84
+ {width: 360, height: 800, id: '360x800'},
85
+ {width: 390, height: 864, id: '390x864'},
86
+ {width: 414, height: 896, id: '414x896'},
87
+ {width: 768, height: 1024, id: '768x1024'},
88
+ {width: 810, height: 1080, id: '810x1080'},
89
+ {width: 1280, height: 720, id: '1280x800'},
90
+ {width: 1366, height: 768, id: '1366x768'},
91
+ {width: 1536, height: 864, id: '1536x864'},
92
+ {width: 1920, height: 1080, id: '1920x1080'},
94
93
  ];
95
94
  this.widthInPercent = false;
96
95
  }
@@ -100,7 +99,7 @@ export class BlockquoteBaseEmbeddedWebviewSize extends LitElement {
100
99
  }
101
100
 
102
101
  get selectedDetail() {
103
- return { ...this.selectedSize, ...{ index: this.selected } };
102
+ return {...this.selectedSize, ...{index: this.selected}};
104
103
  }
105
104
 
106
105
  get computedStyleWidth() {
@@ -173,7 +172,7 @@ export class BlockquoteBaseEmbeddedWebviewSize extends LitElement {
173
172
  : `width: ${item.width}px;`}">
174
173
  <span>${item.id}</span>
175
174
  </button>
176
- `,
175
+ `
177
176
  )}
178
177
  `;
179
178
  }
@@ -186,7 +185,7 @@ export class BlockquoteBaseEmbeddedWebviewSize extends LitElement {
186
185
  `;
187
186
  }
188
187
 
189
- _onResize = ev => {
188
+ _onResize = (ev) => {
190
189
  ev.preventDefault();
191
190
  ev.stopPropagation();
192
191
  window.requestAnimationFrame(() => {
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { BlockquoteBaseEmbeddedWebview } from './BlockquoteBaseEmbeddedWebview.js';
2
- export { BlockquoteBaseEmbeddedWebviewSize } from './BlockquoteBaseEmbeddedWebviewSize.js';
3
- export { BlockquoteBaseEmbeddedWebviewResize } from './BlockquoteBaseEmbeddedWebviewResize.js';
4
- export { BlockquoteBaseEmbeddedWebviewElement } from './BlockquoteBaseEmbeddedWebviewElement.js';
1
+ export {BlockquoteBaseEmbeddedWebview} from './BlockquoteBaseEmbeddedWebview.js';
2
+ export {BlockquoteBaseEmbeddedWebviewSize} from './BlockquoteBaseEmbeddedWebviewSize.js';
3
+ export {BlockquoteBaseEmbeddedWebviewResize} from './BlockquoteBaseEmbeddedWebviewResize.js';
4
+ export {BlockquoteBaseEmbeddedWebviewElement} from './BlockquoteBaseEmbeddedWebviewElement.js';