@pageboard/html 0.14.34 → 0.14.36

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.
@@ -102,22 +102,26 @@ exports.style = {
102
102
  const: null,
103
103
  title: 'Default',
104
104
  icon: '<span class="icon">∅</span>'
105
+ }, {
106
+ const: 'tiny',
107
+ title: 'Tiny',
108
+ icon: '<span class="icon char" style="font-size:0.6em;margin-inline:0.6rem">aA</span>'
105
109
  }, {
106
110
  const: 'small',
107
111
  title: 'Small',
108
- icon: '<span class="icon char" style="font-size:0.6em">aA</span>'
112
+ icon: '<span class="icon char" style="font-size:0.8em;margin-inline:0.6rem">aA</span>'
109
113
  }, {
110
114
  const: 'base',
111
115
  title: 'Base',
112
- icon: '<span class="icon char" style="font-size:0.8em">aA</span>'
116
+ icon: '<span class="icon char" style="font-size:1em;margin-inline:0.6rem">aA</span>'
113
117
  }, {
114
118
  const: 'large',
115
119
  title: 'Large',
116
- icon: '<span class="icon char" style="font-size:1.2em">aA</span>'
120
+ icon: '<span class="icon char" style="font-size:1.2em;margin-inline:0.6rem">aA</span>'
117
121
  }, {
118
122
  const: 'extra',
119
123
  title: 'Extra',
120
- icon: '<span class="icon char" style="font-size:1.6em">aA</span>'
124
+ icon: '<span class="icon char" style="font-size:1.6em;margin-inline:0.6rem">aA</span>'
121
125
  }]
122
126
  },
123
127
  transform: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.14.34",
3
+ "version": "0.14.36",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "dependencies": {},
17
17
  "devDependencies": {
18
18
  "nouislider": "^15.7.1",
19
- "postinstall": "^0.8.0"
19
+ "postinstall": "^0.9.0"
20
20
  },
21
21
  "postinstall": {},
22
22
  "prepare": {
@@ -224,14 +224,28 @@ class HTMLElementFieldsetList extends Page.Element {
224
224
  }
225
225
  }
226
226
 
227
- #findIndex(btn) {
227
+ #findIndex(btn, add) {
228
228
  let node = btn;
229
229
  const sel = `[name^="${this.#prefixStr}"]`;
230
230
  while ((node = node.parentNode)) {
231
- const input = Array.from(node.querySelectorAll(sel)).pop();
232
- if (!input) continue;
231
+ const list = Array.from(node.querySelectorAll(sel));
232
+ if (!list.length) continue;
233
+ const first = list[0];
234
+ const last = list.pop();
235
+ let offset = 0;
236
+ let input;
237
+ if (btn.compareDocumentPosition(last) & Node.DOCUMENT_POSITION_PRECEDING) {
238
+ // after last
239
+ if (add) offset += 1;
240
+ input = last;
241
+ } else if (first.compareDocumentPosition(btn) & Node.DOCUMENT_POSITION_PRECEDING) {
242
+ input = first;
243
+ }
244
+
233
245
  const { index } = this.#parseName(input.name);
234
- if (index >= 0 && index < this.#list.length) return index;
246
+ if (index >= 0 && index < this.#list.length) {
247
+ return index + offset;
248
+ }
235
249
  }
236
250
  }
237
251
 
@@ -246,7 +260,7 @@ class HTMLElementFieldsetList extends Page.Element {
246
260
 
247
261
  switch (action) {
248
262
  case "add":
249
- list.splice((this.#findIndex(btn) ?? 0), 0, { ...this.#model });
263
+ list.splice((this.#findIndex(btn, true) ?? 0), 0, { ...this.#model });
250
264
  break;
251
265
  case "del":
252
266
  list.splice(this.#findIndex(btn) ?? 0, 1);
package/ui/form.js CHANGED
@@ -82,10 +82,9 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
82
82
  if (masked) toggles.push(submit);
83
83
  state.vars.submit = true;
84
84
  }
85
- const vars = state.templatesQuery(this) || {};
86
- for (const [key, val] of Object.entries(vars)) {
87
- this.setAttribute('data-' + key, val);
88
- }
85
+ const actionLoc = Page.parse(this.getAttribute('action'));
86
+ Object.assign(actionLoc.query, state.templatesQuery(this));
87
+ this.setAttribute('action', Page.format(actionLoc));
89
88
  this.restore(state.scope);
90
89
  } else {
91
90
  for (const name of this.fill(state.query)) {
@@ -324,10 +323,9 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
324
323
  scope.$request = form.read(true, e.submitter);
325
324
  form.disable();
326
325
  form.classList.add('loading');
327
- scope.$response = await state.fetch(form.method, Page.format({
328
- pathname: form.getAttribute('action'),
329
- query: form.dataset // because patch populates data from parameters
330
- }), scope.$request);
326
+ scope.$response = await state.fetch(
327
+ form.method, form.getAttribute('action'), scope.$request
328
+ );
331
329
  } catch (err) {
332
330
  scope.$response = err;
333
331
  }
package/ui/inlines.css CHANGED
@@ -37,6 +37,9 @@ span.blue {
37
37
  span.purple {
38
38
  color: purple;
39
39
  }
40
+ span.tiny {
41
+ font-size: 0.5715em;
42
+ }
40
43
  span.small {
41
44
  font-size: 0.8em;
42
45
  }
package/ui/layout.css CHANGED
@@ -34,6 +34,17 @@
34
34
  &.column {
35
35
  flex-direction: column;
36
36
  align-items:stretch;
37
+
38
+ & > img,
39
+ &.left > img {
40
+ align-self:flex-start;
41
+ }
42
+ &.hcenter > img {
43
+ align-self:center;
44
+ }
45
+ &.right > img {
46
+ align-self:flex-end;
47
+ }
37
48
  }
38
49
 
39
50
  &.top {
@@ -67,17 +78,7 @@
67
78
  justify-content: flex-end;
68
79
  }
69
80
 
70
- &.column {
71
- > img, &.left > img {
72
- align-self:flex-start;
73
- }
74
- &.hcenter > img {
75
- align-self:center;
76
- }
77
- &.right > img {
78
- align-self:flex-end;
79
- }
80
- }
81
+
81
82
 
82
83
  &.fullwidth {
83
84
  width:100%;
package/ui/transition.js CHANGED
@@ -26,11 +26,11 @@ const loader = new class {
26
26
  update(state) {
27
27
  document.documentElement.dataset.stage = state.stage;
28
28
  }
29
- setup(state) {
29
+ async setup(state) {
30
30
  const tr = state.scope.transition;
31
+ await document.fonts?.ready;
32
+ document.body.hidden = false;
31
33
  state.finish(async () => {
32
- await document.fonts?.ready;
33
- document.body.hidden = false;
34
34
  if (tr?.ok) return tr.start();
35
35
  });
36
36
  tr?.end();