@blockquote-web-components/blockquote-base-embedded-webview 1.4.1 → 1.5.1

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.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Webcomponent blockquote-base-embedded-webview following open-wc recommendations",
5
5
  "keywords": [
6
6
  "lit",
@@ -170,7 +170,7 @@
170
170
  "lit": "^2.0.2"
171
171
  },
172
172
  "devDependencies": {
173
- "@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.4.2",
173
+ "@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.4.3",
174
174
  "@blockquote-web-components/blockquote-foundations-sass": "^1.0.0",
175
175
  "@polymer/iron-test-helpers": "^3.0.1"
176
176
  },
@@ -178,5 +178,5 @@
178
178
  "access": "public"
179
179
  },
180
180
  "customElements": "custom-elements.json",
181
- "gitHead": "66c59383666d74cc2f3d0b1e1655e820027a6d5e"
181
+ "gitHead": "f04990017fefa9a43d78e091ccaafe516f3c2c81"
182
182
  }
@@ -1,4 +1,4 @@
1
- import { html, LitElement } from 'lit';
1
+ import { html, LitElement, render as LitHtmlRender } 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';
@@ -195,7 +195,6 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
195
195
  this._controlBottom = parseFloat(
196
196
  window.getComputedStyle(this._embeddedResizeRef.value).paddingBottom,
197
197
  );
198
- this.append(this.embedded);
199
198
  }
200
199
 
201
200
  _updateSize({ detail }) {
@@ -217,7 +216,15 @@ export class BlockquoteBaseEmbeddedWebview extends LitElement {
217
216
  }
218
217
 
219
218
  render() {
220
- return html` ${this._headerTpl} ${this._mainTpl} `;
219
+ return html` ${this._headerTpl} ${this._mainTpl} ${this._litHtmlRender()}`;
220
+ }
221
+
222
+ _litHtmlRender() {
223
+ LitHtmlRender(this._lightDomTpl, this);
224
+ }
225
+
226
+ get _lightDomTpl() {
227
+ return this.embedded;
221
228
  }
222
229
 
223
230
  get _headerTpl() {
@@ -1,4 +1,4 @@
1
- import { html, LitElement } from 'lit';
1
+ import { html, LitElement, render as LitHtmlRender } from 'lit';
2
2
  import { styles } from './styles/blockquote-base-embedded-webview-element-styles.css.js';
3
3
  /**
4
4
  ![Lit](https://img.shields.io/badge/lit-2.0.0-blue)
@@ -70,21 +70,26 @@ export class BlockquoteBaseEmbeddedWebviewElement extends LitElement {
70
70
  });
71
71
 
72
72
  this._embeddedElement.addEventListener('load', this._onLoadElement);
73
-
74
- // append element after add listener `load`
75
- this.append(this._embeddedElement);
76
73
  }
77
74
 
78
75
  willUpdate(props) {
79
76
  super.willUpdate && super.willUpdate(props);
80
77
 
81
- if (props.has('src') && this.src !== '') {
78
+ if ((props.has('src') || props.has('embeddedTitle')) && this.src !== '') {
82
79
  this._fetch(this.src);
83
80
  }
84
81
  }
85
82
 
86
83
  render() {
87
- return html` ${this._embeddedTpl} `;
84
+ return html` ${this._embeddedTpl} ${this._litHtmlRender()} `;
85
+ }
86
+
87
+ _litHtmlRender() {
88
+ LitHtmlRender(this._lightDomTpl, this);
89
+ }
90
+
91
+ get _lightDomTpl() {
92
+ return this._embeddedElement;
88
93
  }
89
94
 
90
95
  get _loadResource() {
@@ -172,18 +172,19 @@ export class BlockquoteBaseEmbeddedWebviewSize extends LitElement {
172
172
  get _toolbarTpl() {
173
173
  return html`
174
174
  ${this.screenSizes.map(
175
- (item, index) => html`<button
176
- @click="${this._setSelected}"
177
- id="${item.id}"
178
- data-index="${index + 1}"
179
- ?data-selected="${this.selected === index + 1}"
180
- ?hidden="${!this.showOverflowSize && item.width > this.computedStyleWidth}"
181
- style="${this.widthInPercent
182
- ? `width: calc(100% / ${index + 1});`
183
- : `width: ${item.width}px;`}"
184
- >
185
- <span>${item.id}</span>
186
- </button>`,
175
+ (item, index) =>
176
+ html`<button
177
+ @click="${this._setSelected}"
178
+ id="${item.id}"
179
+ data-index="${index + 1}"
180
+ ?data-selected="${this.selected === index + 1}"
181
+ ?hidden="${!this.showOverflowSize && item.width > this.computedStyleWidth}"
182
+ style="${this.widthInPercent
183
+ ? `width: calc(100% / ${index + 1});`
184
+ : `width: ${item.width}px;`}"
185
+ >
186
+ <span>${item.id}</span>
187
+ </button>`,
187
188
  )}
188
189
  `;
189
190
  }