@pageboard/html 0.12.8 → 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 +1 -1
- package/elements/inputs.js +4 -4
- package/package.json +1 -1
- package/ui/embed.js +9 -12
- package/ui/fieldset-list.js +7 -0
- package/ui/form.js +1 -1
- package/ui/media.js +5 -8
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-
|
|
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/elements/inputs.js
CHANGED
|
@@ -323,8 +323,8 @@ exports.input_checkbox = {
|
|
|
323
323
|
<div class="ui [toggle] checkbox">
|
|
324
324
|
<input type="checkbox" required="[required]" disabled="[disabled]"
|
|
325
325
|
name="[name]" value="[value]" checked="[checked]"
|
|
326
|
-
id="for-[name][value|
|
|
327
|
-
<label block-content="label" for="for-[name][value|
|
|
326
|
+
id="for-[name][value|pre:-]" />
|
|
327
|
+
<label block-content="label" for="for-[name][value|pre:-]">Label</label>
|
|
328
328
|
</div>
|
|
329
329
|
</div>`,
|
|
330
330
|
stylesheets: [
|
|
@@ -370,8 +370,8 @@ exports.input_radio = {
|
|
|
370
370
|
<div class="ui radio checkbox">
|
|
371
371
|
<input type="radio" disabled="[disabled]"
|
|
372
372
|
name="[name]" value="[value|or:]" checked="[checked]"
|
|
373
|
-
id="for-[name][value|
|
|
374
|
-
<label block-content="label" for="for-[name][value|
|
|
373
|
+
id="for-[name][value|pre:-]" />
|
|
374
|
+
<label block-content="label" for="for-[name][value|pre:-]">Label</label>
|
|
375
375
|
</div>
|
|
376
376
|
</div>`,
|
|
377
377
|
stylesheets: [
|
package/package.json
CHANGED
package/ui/embed.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class HTMLElementEmbed extends Page.Element {
|
|
2
2
|
static defaults = {
|
|
3
|
-
|
|
3
|
+
src: null,
|
|
4
4
|
query: null,
|
|
5
5
|
hash: null
|
|
6
6
|
};
|
|
@@ -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
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} else {
|
|
23
|
-
console.warn("Missing href", this.options.url);
|
|
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;
|
|
@@ -37,7 +34,7 @@ class HTMLElementEmbed extends Page.Element {
|
|
|
37
34
|
|
|
38
35
|
const opts = this.options;
|
|
39
36
|
const prev = Page.parse(this.currentSrc);
|
|
40
|
-
const cur = Page.parse(this.dataset.src || "about:blank");
|
|
37
|
+
const cur = Page.parse(this.dataset.source || this.options.src || "about:blank");
|
|
41
38
|
cur.hash = opts.hash;
|
|
42
39
|
const curSrc = cur.toString();
|
|
43
40
|
|
|
@@ -66,8 +63,8 @@ class HTMLElementEmbed extends Page.Element {
|
|
|
66
63
|
this.classList.add('error');
|
|
67
64
|
}
|
|
68
65
|
handleAllMessage(e, state) {
|
|
69
|
-
if (!e.origin || !this.
|
|
70
|
-
if (this.
|
|
66
|
+
if (!e.origin || !this.currentSrc) return;
|
|
67
|
+
if (this.currentSrc?.startsWith(e.origin) == false) return;
|
|
71
68
|
if (this.receiveMessage) this.receiveMessage(e.data ?? {});
|
|
72
69
|
}
|
|
73
70
|
close() {
|
package/ui/fieldset-list.js
CHANGED
|
@@ -138,6 +138,13 @@ class HTMLElementFieldsetList extends Page.Element {
|
|
|
138
138
|
for (const node of inputs) {
|
|
139
139
|
const name = this.#incrementkey('[fielditem.index]', node.name);
|
|
140
140
|
if (name != null) {
|
|
141
|
+
const id = node.id;
|
|
142
|
+
if (id?.startsWith(`for-${node.name}`)) {
|
|
143
|
+
node.id = id.replace(node.name, name);
|
|
144
|
+
}
|
|
145
|
+
if (node.nextElementSibling?.htmlFor == id) {
|
|
146
|
+
node.nextElementSibling.htmlFor = node.id;
|
|
147
|
+
}
|
|
141
148
|
node.name = name;
|
|
142
149
|
}
|
|
143
150
|
}
|
package/ui/form.js
CHANGED
|
@@ -299,7 +299,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
299
299
|
if (loc.samePathname(state)) {
|
|
300
300
|
loc.query = { ...state.query, ...loc.query };
|
|
301
301
|
}
|
|
302
|
-
const nstate = this.ignoreInputChange
|
|
302
|
+
const nstate = this.ignoreInputChange && state.referrer
|
|
303
303
|
? state.replace(loc)
|
|
304
304
|
: state.push(loc);
|
|
305
305
|
nstate.catch(state => {
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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');
|