@pageboard/html 0.15.5 → 0.15.7

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/form.js CHANGED
@@ -9,12 +9,12 @@ exports.query_form = {
9
9
  title: 'Name',
10
10
  description: 'Useful for query tags',
11
11
  type: 'string',
12
- format: 'id',
12
+ format: 'name',
13
13
  nullable: true
14
14
  },
15
- masked: {
16
- title: 'Masked',
17
- description: 'Hidden and disabled, unmasked by $query.toggle',
15
+ hidden: {
16
+ title: 'Hidden',
17
+ description: 'Hidden and disabled\nShown by $query.toggle',
18
18
  type: 'boolean',
19
19
  default: false
20
20
  },
@@ -52,7 +52,7 @@ exports.query_form = {
52
52
  },
53
53
  contents: 'block+',
54
54
  tag: 'form[method="get"]',
55
- html: `<form is="element-form" method="get" name="[name]" masked="[masked]"
55
+ html: `<form is="element-form" method="get" id="[name|else:$id]" hidden="[hidden]"
56
56
  action="[redirection.url][redirection.parameters|as:query]"
57
57
  autocomplete="off" class="ui form"></form>`,
58
58
  stylesheets: [
@@ -87,16 +87,11 @@ exports.api_form = {
87
87
  },
88
88
  hidden: {
89
89
  title: 'Hidden',
90
+ description: 'Hidden and disabled\nShown by $query.toggle',
90
91
  type: 'boolean',
91
92
  default: false,
92
93
  context: 'template'
93
94
  },
94
- masked: {
95
- title: 'Masked',
96
- description: 'Hidden and disabled, unmasked by $query.toggle',
97
- type: 'boolean',
98
- default: false
99
- },
100
95
  action: {
101
96
  title: 'Action',
102
97
  description: 'Choose a service',
@@ -178,14 +173,15 @@ exports.api_form = {
178
173
  },
179
174
  contents: 'block+',
180
175
  tag: 'form[method="post"]',
181
- html: `<form is="element-form" method="post" name="[name]" masked="[masked]"
182
- action="/@api/form/[name|else:$id]"
176
+ html: `<form is="element-form" method="post" hidden="[hidden]"
177
+ id="[name|else:$id]"
178
+ action="/@api/form/[$id]"
183
179
  parameters="[action?.request|as:expressions]"
184
180
  success="[redirection.parameters|as:query]"
185
181
  badrequest="[badrequest.parameters|as:query]"
186
182
  unauthorized="[unauthorized.parameters|as:query]"
187
183
  notfound="[notfound.parameters|as:query]"
188
- class="ui form [hidden]"></form>`,
184
+ class="ui form"></form>`,
189
185
  stylesheets: [
190
186
  '../ui/components/form.css',
191
187
  '../ui/form.css'
@@ -38,6 +38,16 @@ exports.input_button = {
38
38
  type: "string",
39
39
  format: "singleline"
40
40
  },
41
+ form: {
42
+ title: 'Target form',
43
+ type: 'string',
44
+ format: 'name',
45
+ nullable: true,
46
+ $filter: {
47
+ name: 'action',
48
+ action: 'write'
49
+ }
50
+ },
41
51
  disabled: {
42
52
  title: 'Disabled',
43
53
  type: 'boolean',
@@ -73,7 +83,7 @@ exports.input_button = {
73
83
  default: null
74
84
  }
75
85
  },
76
- html: '<button type="[type]" disabled="[disabled]" class="ui [full|alt:fluid:] [icon] [compact] [float|post:%20floated] button" name="[name]" value="[value]">[type|schema:title]</button>',
86
+ html: '<button type="[type]" form="[form]" disabled="[disabled]" class="ui [full|alt:fluid:] [icon] [compact] [float|post:%20floated] button" name="[name]" value="[value]">[type|schema:title]</button>',
77
87
  stylesheets: [
78
88
  '../ui/components/button.css',
79
89
  '../ui/button.css'
@@ -7,9 +7,9 @@ exports.pagination = {
7
7
  isolating: true,
8
8
  properties: {
9
9
  fetch: {
10
- title: 'Name of fetch block',
10
+ title: 'Target fetch',
11
11
  type: 'string',
12
- format: 'id',
12
+ format: 'name',
13
13
  $filter: {
14
14
  name: 'action',
15
15
  action: 'read'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.15.5",
3
+ "version": "0.15.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/form.js CHANGED
@@ -74,12 +74,10 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
74
74
  if (typeof toggle == "string") toggles.push(...toggle.split('-'));
75
75
  else if (Array.isArray(toggle)) toggles.push(...toggle);
76
76
 
77
- const masked = this.hasAttribute('masked');
78
-
79
77
  if (this.method != "get") {
80
78
  // ?submit=<name> for auto-submit
81
79
  if (submit && submit == this.name) {
82
- if (masked) toggles.push(submit);
80
+ if (this.hidden) toggles.push(submit);
83
81
  state.vars.submit = true;
84
82
  }
85
83
  const actionLoc = Page.parse(this.getAttribute('action'));
@@ -94,9 +92,9 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
94
92
  if (toggles.includes(this.name)) {
95
93
  // ?toggle=<name> for toggling hidden state
96
94
  if (toggle) state.vars.toggle = true;
97
- this.disabled = this.hidden = !masked;
95
+ this.disabled = !this.hidden;
98
96
  } else {
99
- this.disabled = this.hidden = masked;
97
+ this.disabled = this.hidden;
100
98
  }
101
99
  }
102
100
  paint(state) {
@@ -366,7 +364,13 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
366
364
  vary = "patch";
367
365
  }
368
366
  }
369
- state.push(loc, { vary });
367
+ state.debounce(
368
+ () => {
369
+ msg?.classList.remove('visible');
370
+ return state.push(loc, { vary });
371
+ },
372
+ msg?.dataset.fading ? 1000 : 100
373
+ )();
370
374
  }
371
375
  }
372
376
  window.HTMLElementForm = HTMLElementForm;
package/ui/pagination.js CHANGED
@@ -9,7 +9,7 @@ class HTMLElementPagination extends Page.create(HTMLAnchorElement) {
9
9
  #update(state) {
10
10
  const { fetch } = this.dataset;
11
11
  const node = this.ownerDocument.querySelector(
12
- `element-template[action="/@api/query/${fetch}"]`
12
+ `element-template[id="${fetch}"]`
13
13
  );
14
14
  if (!node) {
15
15
  console.warn("pagination does not find fetch node", fetch);