@pageboard/html 0.12.9 → 0.12.10

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/elements/embed.js CHANGED
@@ -40,7 +40,7 @@ exports.embed = {
40
40
  };
41
41
  },
42
42
  tag: 'iframe,element-embed',
43
- html: `<element-embed data-url="[url]" data-query="[query|as:query]" id="[id]">
43
+ html: `<element-embed data-src="[url]" data-query="[query|as:query]" id="[id]">
44
44
  <a aria-hidden="true" class="linkable" href="[$loc.pathname][$loc.search][id|pre:%23]">[linkable|prune:*]#</a>
45
45
  <iframe loading="lazy" allowfullscreen frameborder="0" scrolling="no"></iframe>
46
46
  </element-embed>`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.12.9",
3
+ "version": "0.12.10",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/embed.js CHANGED
@@ -14,14 +14,11 @@ class HTMLElementEmbed extends Page.Element {
14
14
  return this.querySelector('iframe')?.src ?? "about:blank";
15
15
  }
16
16
  patch(state) {
17
- const meta = state.scope.$hrefs?.[this.options.src];
18
- if (meta) {
19
- this.title = meta.title;
20
- if (meta.source) this.setAttribute('data-source', meta.source);
21
- this.style.paddingBottom = `calc(${meta.height} / ${meta.width} * 100%)`;
22
- } else {
23
- console.warn("Missing href", this.options.src);
24
- }
17
+ const { src } = this.options;
18
+ if (!src) return;
19
+ const { width, height, source } = state.scope.$hrefs?.[src] ?? {};
20
+ if (source) this.dataset.source = source;
21
+ if (width && height) this.style.paddingBottom = `calc(${height} / ${width} * 100%)`;
25
22
  }
26
23
  consent(state) {
27
24
  const consent = state.scope.$consent;
package/ui/media.js CHANGED
@@ -34,14 +34,11 @@ class HTMLElementVideo extends HTMLElementMediaConstructor(Page.create(HTMLVideo
34
34
  patch(state) {
35
35
  super.patch(state);
36
36
  const { url } = this.options;
37
- const meta = state.scope.$hrefs?.[url];
38
- if (meta) {
39
- this.title = meta.title;
40
- this.width = meta.width;
41
- this.height = meta.height;
42
- } else {
43
- console.warn("Missing href", url);
44
- }
37
+ if (!url) return;
38
+ const { title, width, height } = state.scope.$hrefs?.[url] ?? {};
39
+ if (title) this.title = title;
40
+ if (width) this.width = width;
41
+ if (height) this.height = height;
45
42
  }
46
43
  }
47
44
  Page.define('element-video', HTMLElementVideo, 'video');