@pageboard/html 0.15.8 → 0.15.9

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/image.js CHANGED
@@ -4,11 +4,6 @@ exports.image = {
4
4
  menu: 'media',
5
5
  icon: '<i class="icon image"></i>',
6
6
  properties: {
7
- alt: {
8
- title: 'Alternative text',
9
- description: 'Short contextual description.\nLeave empty when used in links.',
10
- type: "string"
11
- },
12
7
  url: {
13
8
  title: 'Address',
14
9
  anyOf: [{
@@ -126,14 +121,20 @@ exports.image = {
126
121
  },
127
122
  group: "block media",
128
123
  tag: 'element-image',
129
- contents: {
124
+ contents: [{
130
125
  id: 'legend',
131
126
  title: 'legend',
132
127
  nodes: "inline*"
133
- },
128
+ }, {
129
+ id: 'alt',
130
+ title: 'Alternative Text',
131
+ name: 'data-alt',
132
+ $helper: {
133
+ name: 'describe'
134
+ }
135
+ }],
134
136
  html: `<element-image
135
137
  class="[display.fit|or:none] [display.horizontal?] [display.vertical?]"
136
- alt="[alt]"
137
138
  data-src="[url]"
138
139
  data-crop="[crop.x|or:50];[crop.y|or:50];[crop.width|or:100];[crop.height|or:100];[crop.zoom|or:100]"
139
140
  >
@@ -489,8 +489,8 @@ exports.input_select = {
489
489
  html: `<div class="field">
490
490
  <label block-content="label">Label</label>
491
491
  <element-select class="ui selection dropdown [multiple]"
492
- name="[name]" disabled="[disabled|as:batt]" required="[required|as:batt]"
493
- multiple="[multiple|as:batt]"
492
+ name="[name]" disabled="[disabled|alt:]" required="[required|alt:]"
493
+ multiple="[multiple|alt:]"
494
494
  value="[value]"
495
495
  >
496
496
  <i class="dropdown icon"></i><div class="text"></div><select></select>
package/elements/link.js CHANGED
@@ -29,7 +29,7 @@ exports.link = {
29
29
  nullable: true,
30
30
  $helper: {
31
31
  name: 'datalist',
32
- url: '/@api/languages'
32
+ url: '/@api/translate/languages'
33
33
  }
34
34
  },
35
35
  id: {
@@ -75,7 +75,7 @@ exports.link_button = {
75
75
  nullable: true,
76
76
  $helper: {
77
77
  name: 'datalist',
78
- url: '/@api/languages'
78
+ url: '/@api/translate/languages'
79
79
  }
80
80
  },
81
81
  full: {
package/elements/menu.js CHANGED
@@ -105,7 +105,7 @@ exports.menu_item_link = {
105
105
  nullable: true,
106
106
  $helper: {
107
107
  name: 'datalist',
108
- url: '/@api/languages'
108
+ url: '/@api/translate/languages'
109
109
  }
110
110
  },
111
111
  labeled: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.15.8",
3
+ "version": "0.15.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/image.js CHANGED
@@ -1,7 +1,8 @@
1
1
  const HTMLElementImageConstructor = Superclass => class extends Superclass {
2
2
  static defaults = {
3
3
  src: null,
4
- crop: null
4
+ crop: null,
5
+ alt: null
5
6
  };
6
7
 
7
8
  static defaultWidth = 240;
@@ -66,26 +67,33 @@ const HTMLElementImageConstructor = Superclass => class extends Superclass {
66
67
  }
67
68
 
68
69
  patch(state) {
70
+ const {
71
+ dataset: d,
72
+ image,
73
+ dimensions: { w, h },
74
+ constructor,
75
+ currentSrc
76
+ } = this;
69
77
  this.classList.remove('loading');
70
- if (this.currentSrc != this.options.src) {
78
+ if (currentSrc != this.options.src) {
71
79
  this.classList.remove('error');
72
80
  }
73
- const d = this.dataset;
81
+
74
82
  if (d.width == null || d.height == null) {
75
83
  const meta = state.scope.$hrefs?.[this.options.src];
76
84
  if (meta?.width) d.width = meta.width;
77
85
  if (meta?.height) d.height = meta.height;
78
86
  }
79
- d.width ??= this.constructor.defaultWidth || "";
80
- d.height ??= this.constructor.defaultHeight || "";
81
- const { w, h } = this.dimensions;
82
- if (w) this.image.width = w || d.width;
83
- if (h) this.image.height = h || d.height;
84
- const cur = this.currentSrc;
87
+ d.width ??= constructor.defaultWidth || "";
88
+ d.height ??= constructor.defaultHeight || "";
89
+ if (w) image.width = w || d.width;
90
+ if (h) image.height = h || d.height;
91
+ image.alt = d.alt ?? "";
92
+ const cur = currentSrc;
85
93
  if (!cur) {
86
94
  this.placeholder();
87
95
  } else if (cur.startsWith('data:')) {
88
- this.image.setAttribute('src', cur);
96
+ image.setAttribute('src', cur);
89
97
  }
90
98
  }
91
99