@pageboard/html 0.12.8 → 0.12.9

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.
@@ -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|or:|pre:-]-[$id|slice:0:6]" />
327
- <label block-content="label" for="for-[name][value|or:|pre:-]-[$id|slice:0:6]">Label</label>
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|or:|pre:-]-[$id|slice:0:6]" />
374
- <label block-content="label" for="for-[name][value|or:|pre:-]-[$id|slice:0:6]">Label</label>
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.12.8",
3
+ "version": "0.12.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/embed.js CHANGED
@@ -1,6 +1,6 @@
1
1
  class HTMLElementEmbed extends Page.Element {
2
2
  static defaults = {
3
- url: null,
3
+ src: null,
4
4
  query: null,
5
5
  hash: null
6
6
  };
@@ -14,13 +14,13 @@ 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.url];
17
+ const meta = state.scope.$hrefs?.[this.options.src];
18
18
  if (meta) {
19
19
  this.title = meta.title;
20
- this.setAttribute('data-src', meta.source);
20
+ if (meta.source) this.setAttribute('data-source', meta.source);
21
21
  this.style.paddingBottom = `calc(${meta.height} / ${meta.width} * 100%)`;
22
22
  } else {
23
- console.warn("Missing href", this.options.url);
23
+ console.warn("Missing href", this.options.src);
24
24
  }
25
25
  }
26
26
  consent(state) {
@@ -37,7 +37,7 @@ class HTMLElementEmbed extends Page.Element {
37
37
 
38
38
  const opts = this.options;
39
39
  const prev = Page.parse(this.currentSrc);
40
- const cur = Page.parse(this.dataset.src || "about:blank");
40
+ const cur = Page.parse(this.dataset.source || this.options.src || "about:blank");
41
41
  cur.hash = opts.hash;
42
42
  const curSrc = cur.toString();
43
43
 
@@ -66,8 +66,8 @@ class HTMLElementEmbed extends Page.Element {
66
66
  this.classList.add('error');
67
67
  }
68
68
  handleAllMessage(e, state) {
69
- if (!e.origin || !this.options.source) return;
70
- if (this.options.source.startsWith(e.origin) == false) return;
69
+ if (!e.origin || !this.currentSrc) return;
70
+ if (this.currentSrc?.startsWith(e.origin) == false) return;
71
71
  if (this.receiveMessage) this.receiveMessage(e.data ?? {});
72
72
  }
73
73
  close() {
@@ -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 => {