@pageboard/html 0.16.14 → 0.16.15

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.
@@ -20,7 +20,7 @@ exports.consent_form = {
20
20
  <template block-content="content"></template>
21
21
  <div class="view"></div>
22
22
  </form>`,
23
- scripts: ['../ui/storage.js', '../ui/consent.js'],
23
+ scripts: ['../ui/consent.js'],
24
24
  stylesheets: ['../ui/consent.css']
25
25
  };
26
26
 
package/elements/embed.js CHANGED
@@ -32,6 +32,15 @@ exports.embed = {
32
32
  title: 'Additional query parameters',
33
33
  type: 'object',
34
34
  nullable: true
35
+ },
36
+ ratio: {
37
+ title: 'Default height/width',
38
+ description: 'Inverse of ratio in percents',
39
+ type: 'number',
40
+ minimum: 10,
41
+ maximum: 500,
42
+ multipleOf: 0.01,
43
+ nullable: true
35
44
  }
36
45
  },
37
46
  group: "block",
@@ -42,7 +51,7 @@ exports.embed = {
42
51
  };
43
52
  },
44
53
  tag: 'iframe,element-embed',
45
- html: `<element-embed data-src="[url]" data-query="[query|as:query]" id="[id]">
54
+ html: `<element-embed data-src="[url]" data-query="[query|as:query]" id="[id]" style-padding-bottom="[ratio|fail:]%">
46
55
  <a aria-hidden="true" class="linkable" href="[$loc.pathname][$loc.search][id|pre:%23]">[linkable|prune:*]#</a>
47
56
  <iframe loading="lazy" allowfullscreen frameborder="0" scrolling="no"></iframe>
48
57
  </element-embed>`,
@@ -130,7 +130,7 @@ exports.fieldlist_button = {
130
130
  float: {
131
131
  title: 'Float',
132
132
  anyOf: [{
133
- type: 'null',
133
+ const: null,
134
134
  title: 'No'
135
135
  }, {
136
136
  const: 'left',
package/elements/grid.js CHANGED
@@ -7,7 +7,7 @@ exports.grid = {
7
7
  width: {
8
8
  title: 'Width',
9
9
  anyOf: [{
10
- type: 'null',
10
+ const: null,
11
11
  title: 'normal'
12
12
  }, {
13
13
  const: "min",
@@ -24,7 +24,7 @@ exports.grid = {
24
24
  title: 'Responsive',
25
25
  anyOf: [{
26
26
  title: 'No',
27
- type: 'null'
27
+ const: null
28
28
  }, {
29
29
  title: 'Stackable',
30
30
  const: 'stackable'
@@ -76,7 +76,7 @@ exports.grid_row = {
76
76
  title: 'Responsive',
77
77
  anyOf: [{
78
78
  title: 'No',
79
- type: 'null'
79
+ const: null
80
80
  }, {
81
81
  title: 'Stackable',
82
82
  const: 'stackable'
@@ -70,7 +70,7 @@ exports.input_button = {
70
70
  float: {
71
71
  title: 'Float',
72
72
  anyOf: [{
73
- type: 'null',
73
+ const: null,
74
74
  title: 'No'
75
75
  }, {
76
76
  const: 'left',
@@ -157,7 +157,7 @@ exports.input_submit = {
157
157
  float: {
158
158
  title: 'Float',
159
159
  anyOf: [{
160
- type: 'null',
160
+ const: null,
161
161
  title: 'No'
162
162
  }, {
163
163
  const: 'left',
@@ -458,8 +458,8 @@ exports.input_checkbox = {
458
458
  <div class="ui [toggle] checkbox">
459
459
  <input type="checkbox" required="[required]" disabled="[disabled]"
460
460
  name="[name]" value="[value]" checked="[checked]"
461
- id="for-[name][value|pre:-]" />
462
- <label block-content="label" for="for-[name][value|pre:-]">Label</label>
461
+ id="for-[name]" />
462
+ <label block-content="label" for="for-[name]">Label</label>
463
463
  </div>
464
464
  </div>`,
465
465
  stylesheets: [
@@ -516,8 +516,8 @@ exports.input_radio = {
516
516
  <div class="ui radio [button|alt::checkbox]">
517
517
  <input type="radio" disabled="[disabled]" required="[required]"
518
518
  name="[name]" value="[value]" checked="[checked]"
519
- id="for-[name][value|pre:-]" />
520
- <label block-content="label" for="for-[name][value|pre:-]">Label</label>
519
+ id="for-[name]" />
520
+ <label block-content="label" for="for-[name]">Label</label>
521
521
  </div>
522
522
  </div>`,
523
523
  stylesheets: [
@@ -89,7 +89,7 @@ exports.layout = {
89
89
  wrap: {
90
90
  title: 'Wrap',
91
91
  anyOf: [{
92
- type: 'null',
92
+ const: null,
93
93
  title: 'No wrap'
94
94
  }, {
95
95
  const: 'wrap',
@@ -102,7 +102,7 @@ exports.layout = {
102
102
  width: {
103
103
  title: 'Width',
104
104
  anyOf: [{
105
- type: "null",
105
+ const: null,
106
106
  title: "None"
107
107
  }, {
108
108
  const: "full",
@@ -160,7 +160,7 @@ exports.layout = {
160
160
  fill: {
161
161
  title: 'Fill',
162
162
  anyOf: [{
163
- type: 'null',
163
+ const: null,
164
164
  title: 'Auto'
165
165
  }, {
166
166
  const: 'balance',
package/elements/link.js CHANGED
@@ -100,7 +100,7 @@ exports.link_button = {
100
100
  float: {
101
101
  title: 'Float',
102
102
  anyOf: [{
103
- type: 'null',
103
+ const: null,
104
104
  title: 'No'
105
105
  }, {
106
106
  const: 'left',
@@ -50,7 +50,7 @@ exports.segment = {
50
50
  const: 'mini',
51
51
  title: 'Mini'
52
52
  }, {
53
- type: 'null',
53
+ const: null,
54
54
  title: 'Normal'
55
55
  }, {
56
56
  const: 'large',
@@ -21,7 +21,7 @@ exports.statistic = {
21
21
  size: {
22
22
  title: 'Size',
23
23
  anyOf: [{
24
- type: 'null',
24
+ const: null,
25
25
  title: 'Default'
26
26
  }, {
27
27
  const: 'mini',
@@ -0,0 +1,5 @@
1
+ exports.storage = {
2
+ priority: -1,
3
+ group: "block",
4
+ scripts: ['../ui/storage.js']
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.16.14",
3
+ "version": "0.16.15",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -137,7 +137,11 @@ class HTMLElementFieldsetList extends Page.Element {
137
137
  }
138
138
  }
139
139
 
140
+ const view = this.ownView;
141
+ view.textContent = '';
142
+
140
143
  const subtpl = inputs.map(node => node.closest('.fields') ?? node).ancestor();
144
+ if (!subtpl) return;
141
145
  subtpl.appendChild(
142
146
  subtpl.ownerDocument.createTextNode(
143
147
  `[$fields|at:${this.dataset.at || '*'}|repeat:field|const:]`
@@ -186,8 +190,6 @@ class HTMLElementFieldsetList extends Page.Element {
186
190
  node.disabled = list.length >= max;
187
191
  });
188
192
 
189
- const view = this.ownView;
190
- view.textContent = '';
191
193
  view.appendChild(tpl);
192
194
  }
193
195
 
package/ui/form.js CHANGED
@@ -20,15 +20,13 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
20
20
 
21
21
  static patch(state) {
22
22
  state.finish(() => {
23
- let index = 0;
24
- for (const node of document.querySelectorAll('label[for]')) {
25
- const prev = node.previousElementSibling;
26
- if (prev?.nodeName != "INPUT") continue;
27
- const others = document.querySelectorAll(`input[id="${node.htmlFor}"]`);
28
- if (others.length > 1) {
29
- node.htmlFor += `-${index++}`;
30
- prev.id = node.htmlFor;
31
- }
23
+ const indexes = {};
24
+ for (const label of document.querySelectorAll('input+label[for^="for-"]')) {
25
+ const { previousElementSibling: input, htmlFor } = label;
26
+ const [pre, name] = htmlFor.split('-');
27
+ if (input.name != name) continue;
28
+ const index = indexes[name] = (indexes[name] ?? 0) + 1;
29
+ input.id = label.htmlFor = `${pre}-${name}-${index}`;
32
30
  }
33
31
  });
34
32
  }
@@ -1,5 +1,8 @@
1
1
  .field.button > .radio > input {
2
- display:none;
2
+ /* none or hidden doesn't allow focus when validating form */
3
+ position: absolute;
4
+ height:0px;
5
+ opacity:0;
3
6
  }
4
7
  .field.button > .radio > input + label {
5
8
  opacity: 0.5;