@pageboard/html 0.12.10 → 0.12.12

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/embed.js CHANGED
@@ -3,6 +3,16 @@ exports.embed = {
3
3
  menu: "media",
4
4
  icon: '<i class="external square alternate icon"></i>',
5
5
  properties: {
6
+ id: {
7
+ nullable: true,
8
+ type: 'string',
9
+ pattern: /^[a-z0-9-]*$/.source
10
+ },
11
+ linkable: {
12
+ title: 'Show hash link',
13
+ type: 'boolean',
14
+ default: false
15
+ },
6
16
  url: {
7
17
  title: 'Address',
8
18
  description: 'The iframe src URL',
@@ -16,16 +26,6 @@ exports.embed = {
16
26
  }
17
27
  }
18
28
  },
19
- linkable: {
20
- title: 'Show hash link',
21
- type: 'boolean',
22
- default: false
23
- },
24
- id: {
25
- nullable: true,
26
- type: 'string',
27
- pattern: /^[a-z0-9-]*$/.source
28
- },
29
29
  query: {
30
30
  title: 'Additional query parameters',
31
31
  type: 'object',
@@ -31,16 +31,16 @@ exports.heading = {
31
31
  icon: '<i class="icon align justify"></i>'
32
32
  }]
33
33
  },
34
- linkable: {
35
- title: 'Show hash link',
36
- type: 'boolean',
37
- default: false
38
- },
39
34
  id: {
40
35
  nullable: true,
41
36
  type: 'string',
42
37
  pattern: /^[a-z0-9-]*$/.source
43
38
  },
39
+ linkable: {
40
+ title: 'Show hash link',
41
+ type: 'boolean',
42
+ default: false
43
+ },
44
44
  entitled: {
45
45
  title: 'H1 is a page title',
46
46
  type: 'boolean',
@@ -3,7 +3,7 @@ exports.input_date_time = {
3
3
  icon: '<i class="calendar outline icon"></i>',
4
4
  menu: "form",
5
5
  required: ["name"],
6
- group: "block",
6
+ group: "block input_field",
7
7
  context: 'form//',
8
8
  properties: {
9
9
  name: {
@@ -3,7 +3,7 @@ exports.input_file = {
3
3
  icon: '<i class="upload icon"></i>',
4
4
  menu: "form",
5
5
  required: ["name"],
6
- group: "block",
6
+ group: "block input_field",
7
7
  context: 'form//',
8
8
  properties: {
9
9
  name: {
@@ -2,7 +2,7 @@ exports.input_button = {
2
2
  title: 'Button',
3
3
  icon: '<i class="hand pointer icon"></i>',
4
4
  menu: "form",
5
- group: "block",
5
+ group: "block input_field",
6
6
  context: 'form//',
7
7
  contents: {
8
8
  nodes: "inline*",
@@ -68,7 +68,7 @@ exports.input_fields = {
68
68
  default: false
69
69
  }
70
70
  },
71
- contents: "(input_text|input_range|input_checkbox|input_radio|input_select|input_button)+",
71
+ contents: "input_field+",
72
72
  html: `<div class="[inline] fields"></div>`
73
73
  };
74
74
 
@@ -77,7 +77,7 @@ exports.input_text = {
77
77
  icon: '<i class="text cursor icon"></i>',
78
78
  menu: "form",
79
79
  required: ["name"],
80
- group: "block",
80
+ group: "block input_field",
81
81
  context: 'form//',
82
82
  properties: {
83
83
  name: {
@@ -186,7 +186,7 @@ exports.input_number = {
186
186
  icon: '<i class="text cursor icon"></i>',
187
187
  menu: "form",
188
188
  required: ["name"],
189
- group: "block",
189
+ group: "block input_field",
190
190
  context: 'form//',
191
191
  properties: {
192
192
  name: exports.input_text.properties.name,
@@ -232,7 +232,7 @@ exports.input_range = {
232
232
  title: 'Range',
233
233
  icon: '<i class="options icon"></i>',
234
234
  menu: "form",
235
- group: "block",
235
+ group: "block input_field",
236
236
  context: 'form//',
237
237
  properties: Object.assign({}, exports.input_number.properties, {
238
238
  multiple: {
@@ -279,7 +279,7 @@ exports.input_checkbox = {
279
279
  title: 'Checkbox',
280
280
  icon: '<i class="checkmark box icon"></i>',
281
281
  menu: "form",
282
- group: "block",
282
+ group: "block input_field",
283
283
  context: 'form//',
284
284
  required: ["name"],
285
285
  properties: {
@@ -336,7 +336,7 @@ exports.input_radio = {
336
336
  title: 'Radio',
337
337
  icon: '<i class="selected radio icon"></i>',
338
338
  menu: "form",
339
- group: "block",
339
+ group: "block input_field",
340
340
  context: 'form//',
341
341
  required: ["name"],
342
342
  properties: {
@@ -360,6 +360,11 @@ exports.input_radio = {
360
360
  title: "Disabled",
361
361
  type: "boolean",
362
362
  default: false
363
+ },
364
+ required: {
365
+ title: 'Required',
366
+ type: 'boolean',
367
+ default: false
363
368
  }
364
369
  },
365
370
  contents: {
@@ -368,7 +373,7 @@ exports.input_radio = {
368
373
  },
369
374
  html: `<div class="field">
370
375
  <div class="ui radio checkbox">
371
- <input type="radio" disabled="[disabled]"
376
+ <input type="radio" disabled="[disabled]" required="[required]"
372
377
  name="[name]" value="[value|or:]" checked="[checked]"
373
378
  id="for-[name][value|pre:-]" />
374
379
  <label block-content="label" for="for-[name][value|pre:-]">Label</label>
@@ -384,7 +389,7 @@ exports.input_select = {
384
389
  icon: '<i class="caret down icon"></i>',
385
390
  menu: "form",
386
391
  required: ["name"],
387
- group: "block",
392
+ group: "block input_field",
388
393
  context: 'form//',
389
394
  properties: {
390
395
  name: {
@@ -1,6 +1,9 @@
1
1
  exports.layout = {
2
2
  title: "Layout",
3
3
  icon: '<i class="icon move"></i>',
4
+ upgrade: {
5
+ 'data.invert': 'data.background.invert'
6
+ },
4
7
  properties: {
5
8
  horizontal: {
6
9
  title: 'Horizontal',
@@ -121,17 +124,23 @@ exports.layout = {
121
124
  }
122
125
  }
123
126
  },
124
- invert: {
125
- title: 'Invert',
126
- description: 'Invert background',
127
- default: false,
128
- type: 'boolean'
129
- },
130
127
  background: {
131
128
  title: 'Background',
132
129
  type: 'object',
133
130
  nullable: true,
134
131
  properties: {
132
+ invert: {
133
+ title: 'Invert',
134
+ description: 'Invert background',
135
+ default: false,
136
+ type: 'boolean'
137
+ },
138
+ color: {
139
+ title: 'Color',
140
+ type: 'string',
141
+ format: 'hex-color',
142
+ $helper: 'color'
143
+ },
135
144
  image: {
136
145
  title: 'Image',
137
146
  description: 'Local or remote URL',
@@ -285,17 +294,18 @@ exports.layout = {
285
294
  [horizontal]
286
295
  [vertical]
287
296
  [direction]
288
- [invert|alt:inverted]"
297
+ [background.invert|alt:inverted]"
289
298
  is="element-layout"
299
+ data-src="[background.image]"
300
+ data-crop="[background.crop.x];[background.crop.y];[background.crop.width];[background.crop.height];[background.crop.zoom]"
290
301
  style-margin-block="[margins.block|fail:][margins.blockUnits]"
291
302
  style-margin-inline="[margins.inline|fail:][margins.inlineUnits]"
292
303
  style-height="[height|fail:][heightUnits]"
293
- data-src="[background.image]"
294
- data-crop="[background.crop.x];[background.crop.y];[background.crop.width];[background.crop.height];[background.crop.zoom]"
295
- data-size="[background.size]"
296
- data-repeat="[background.repeat]"
297
- data-attachment="[background.attachment]"
298
- data-position="[background.position]"
304
+ style-background-color="[background.color]"
305
+ style-background-size="[background.size]"
306
+ style-background-repeat="[background.repeat]"
307
+ style-background-attachment="[background.attachment]"
308
+ style-background-position="[background.position]"
299
309
  ></div>`,
300
310
  stylesheets: [
301
311
  '../lib/components/container.css',
package/elements/menu.js CHANGED
@@ -29,8 +29,8 @@ exports.menu = {
29
29
  };
30
30
 
31
31
  exports.menu_group = {
32
- title: 'Menu Group',
33
- icon: '<b class="icon">Group</b>',
32
+ title: 'Group',
33
+ icon: '<b class="icon">Menu</b>',
34
34
  menu: "link",
35
35
  context: "menu//",
36
36
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.12.10",
3
+ "version": "0.12.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/form.js CHANGED
@@ -168,6 +168,9 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
168
168
  case "file":
169
169
  query[name] = val;
170
170
  break;
171
+ case "textarea":
172
+ query[name] = val;
173
+ break;
171
174
  case "radio":
172
175
  if (!withDefaults && node.checked == node.defaultChecked) {
173
176
  if (query[name] == val) {
package/ui/image.js CHANGED
@@ -162,6 +162,7 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
162
162
  const curSrc = loc.toString();
163
163
  if (curSrc != this.currentSrc) {
164
164
  this.classList.add('loading');
165
+ this.#defer?.reject();
165
166
  this.#defer = new Deferred();
166
167
  img.setAttribute('src', curSrc);
167
168
  return this.#defer;
@@ -181,6 +182,9 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
181
182
  placeholder(error) {
182
183
  this.image.removeAttribute('src');
183
184
  }
185
+ close() {
186
+ this.#defer?.reject();
187
+ }
184
188
  };
185
189
 
186
190
  const HTMLElementImage = HTMLElementImageConstructor(Page.Element);
package/ui/layout.js CHANGED
@@ -1,23 +1,15 @@
1
1
  class HTMLElementLayout extends Page.create(HTMLDivElement) {
2
2
  static defaults = {
3
3
  dataSrc: null,
4
- dataCrop: null,
5
- dataRepeat: null,
6
- dataSize: null,
7
- dataAttachment: null,
8
- dataPosition:null
4
+ dataCrop: null
9
5
  };
10
6
 
11
7
  #defer;
12
8
 
13
9
  get fit() {
14
- return this.options.size || 'none';
10
+ return this.style.backgroundSize || 'none';
15
11
  }
16
12
  reveal(state) {
17
- this.style.backgroundRepeat = this.options.repeat;
18
- this.style.backgroundSize = this.options.size;
19
- this.style.backgroundAttachment = this.options.attachment;
20
- this.style.backgroundPosition = this.options.position;
21
13
  if (!this.options.src) {
22
14
  this.style.backgroundImage = '';
23
15
  return;
@@ -64,15 +56,19 @@ class HTMLElementLayout extends Page.create(HTMLDivElement) {
64
56
  } catch(e) {
65
57
  // pass
66
58
  }
67
- this.style.backgroundImage = `url(${curSrc})`;
59
+ this.#defer?.reject();
68
60
  this.#defer = new Deferred();
69
61
  const img = new Image();
70
62
  img.addEventListener('load', this.#defer.resolve);
71
63
  img.addEventListener('error', this.#defer.resolve);
72
64
  img.src = curSrc;
65
+ this.style.backgroundImage = `url("${curSrc}")`;
73
66
  return this.#defer;
74
67
  }
75
68
  }
69
+ close() {
70
+ this.#defer?.reject();
71
+ }
76
72
  }
77
73
 
78
74
  (function(HTMLElementImage) {