@pageboard/html 0.15.1 → 0.15.2

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
@@ -72,6 +72,7 @@ exports.api_form = {
72
72
  group: 'block form',
73
73
  menu: "form",
74
74
  required: ["action"],
75
+ unique: ["name"],
75
76
  expressions: true,
76
77
  $lock: {
77
78
  'data.action.parameters': 'webmaster'
@@ -101,64 +102,9 @@ exports.api_form = {
101
102
  description: 'Choose a service',
102
103
  $ref: '/writes'
103
104
  },
104
- request: {
105
- title: 'Map inputs',
106
- description: `
107
- expr is supposed to be used to merge stuff into html,
108
- not really to merge stuff into methods parameters
109
- Also expr has a bad design because
110
- - it can be replaced by a binding element inside the block
111
- - it forces the expression to be in a specific attribute,
112
- and mostly when a block has no content (so a binding cannot be used)
113
- - the editor is ugly and shows fields that might not even be merged into html
114
- Use cases
115
- - links in anchors, images
116
- - input or buttons values, checked attributes
117
- - hidden attributes
118
- - show/hide blocks depending on response
119
- The "expr" mecanism could instead be a list of expressions like
120
- [url|as:url|assign:.query.reservation:$query.reservation]
121
- [url][$query|pick:text:cover|as:query]
122
-
123
- Things to solve:
124
- - do we want expr to be able to do changes outside the DOM of the block itself ? (no, this should be done by a binding element)
125
- - do we want expr to change only data before merge - outside of any dom context ? Possibly ! In which case the current system is not that bad,
126
- but it should not use matchdom dom plugin at all
127
- - how to deal with "template" expressions when one cannot insert a binding
128
- element ? Is it really something that happens ?
129
-
130
-
131
-
132
- `,
133
- type: 'object',
134
- nullable: true
135
- },
136
- response: {
137
- title: 'Map outputs',
138
- description: `
139
- 'item.id': '[item.data.id]'
140
- 'item.title': '[item.content.title]'
141
- // etc...
142
- `,
143
- type: 'object',
144
- nullable: true
145
- },
146
105
  redirection: {
147
106
  title: 'Success',
148
- description: `
149
- redirection can be used by client,
150
- to change the page state. In which case the "url" is not an api url.
151
- It can be used by the server, in which case the "url" is an api url.
152
- The parameters for a page url make the query, and $query, $request, $response are available.
153
- The parameters for a user api call are...?
154
- The user api endpoint is a real url (/@api/xxx) that can expect
155
- a body ($request) and a query ($query) too.
156
- Currently client pages use a trick to redirect and submit: a specific parameter triggers a form submit on the redirected page. This makes sense in the context of page navigation - the body is filled by the form that is triggered by the parameters.
157
- How can that be transposed for internal user api redirection ?
158
- 1. since it redirects, output mapping can be done to format the $response
159
- 2. in the next api call, parameters mean $query, $response becomes $request ?
160
- 3. this works if output can merge $query, $request as well
161
- `,
107
+ description: 'Page state or action',
162
108
  type: 'object',
163
109
  properties: {
164
110
  url: {
@@ -217,7 +163,7 @@ exports.api_form = {
217
163
  tag: 'form[method="post"]',
218
164
  html: `<form is="element-form" method="post" name="[name]" masked="[masked]"
219
165
  action="/@api/form/[name|else:$id]"
220
- parameters="[$expr?.action?.parameters|as:expressions]"
166
+ parameters="[action?.request|as:expressions]"
221
167
  success="[redirection.url][redirection.parameters|as:query]"
222
168
  badrequest="[badrequest.url][badrequest.parameters|as:query]"
223
169
  unauthorized="[unauthorized.url][unauthorized.parameters|as:query]"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/otp.js CHANGED
@@ -6,6 +6,7 @@ class HTMLElementInputOtp extends Page.create(HTMLInputElement) {
6
6
  this.value = "";
7
7
  }
8
8
  paint() {
9
+ if (this.isContentEditable) return;
9
10
  this.focus();
10
11
  }
11
12
  }