@pageboard/html 0.11.20 → 0.11.22
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/fieldsets.js +2 -4
- package/elements/form.js +2 -1
- package/elements/inlines.js +6 -2
- package/elements/input-date.js +6 -3
- package/elements/input-file.js +2 -1
- package/elements/input-property.js +4 -5
- package/elements/inputs.js +8 -4
- package/elements/list.js +2 -2
- package/package.json +7 -8
- package/ui/card.css +0 -0
- package/ui/consent.js +1 -1
- package/ui/embed.js +1 -1
- package/ui/form.js +5 -5
- package/ui/image.js +4 -4
- package/ui/input-range.js +2 -2
- package/ui/item.css +0 -0
- package/ui/menu.js +2 -2
- package/ui/pagination.js +2 -2
- package/ui/query-tags.js +1 -1
- package/ui/rating.css +0 -0
- package/ui/select.js +2 -2
- package/ui/sitemap-helper.js +2 -2
- package/ui/tab-helper.js +1 -1
- package/ui/transition.js +3 -3
package/elements/fieldsets.js
CHANGED
|
@@ -10,10 +10,7 @@ exports.fieldset = {
|
|
|
10
10
|
type: 'string',
|
|
11
11
|
format: 'singleline',
|
|
12
12
|
nullable: true,
|
|
13
|
-
$helper:
|
|
14
|
-
name: 'element-property',
|
|
15
|
-
existing: true
|
|
16
|
-
}
|
|
13
|
+
$helper: 'form-element'
|
|
17
14
|
},
|
|
18
15
|
value: {
|
|
19
16
|
title: 'matches this value',
|
|
@@ -39,6 +36,7 @@ exports.fieldset = {
|
|
|
39
36
|
|
|
40
37
|
exports.fieldset_legend = {
|
|
41
38
|
inplace: true,
|
|
39
|
+
context: 'fieldset//',
|
|
42
40
|
contents: "inline*",
|
|
43
41
|
html: '<legend>Title</legend>'
|
|
44
42
|
};
|
package/elements/form.js
CHANGED
package/elements/inlines.js
CHANGED
|
@@ -101,7 +101,10 @@ exports.caps = {
|
|
|
101
101
|
inline: true,
|
|
102
102
|
inplace: true,
|
|
103
103
|
group: "inline nolink",
|
|
104
|
-
|
|
104
|
+
parse: function(dom) {
|
|
105
|
+
return { transform: dom.className };
|
|
106
|
+
},
|
|
107
|
+
tag: 'span.uppercase,span.lowercase,span.capitalize,span.smallcaps',
|
|
105
108
|
properties: {
|
|
106
109
|
transform: {
|
|
107
110
|
title: 'Transform',
|
|
@@ -168,7 +171,7 @@ exports.color = {
|
|
|
168
171
|
},
|
|
169
172
|
parse: function(dom) {
|
|
170
173
|
const prop = this.properties.color;
|
|
171
|
-
const color = (prop.anyOf.find(
|
|
174
|
+
const color = (prop.anyOf.find(item => {
|
|
172
175
|
return item.const && dom.classList.contains(item.const);
|
|
173
176
|
}) || { const: prop.default }).const;
|
|
174
177
|
return { color: color };
|
|
@@ -176,6 +179,7 @@ exports.color = {
|
|
|
176
179
|
contents: "text*",
|
|
177
180
|
inline: true,
|
|
178
181
|
inplace: true,
|
|
182
|
+
tag: 'span.color',
|
|
179
183
|
group: "inline nolink",
|
|
180
184
|
html: '<span class="[color] color"></span>'
|
|
181
185
|
};
|
package/elements/input-date.js
CHANGED
|
@@ -10,7 +10,8 @@ exports.input_date_time = {
|
|
|
10
10
|
title: "Name",
|
|
11
11
|
description: "The form object key",
|
|
12
12
|
type: "string",
|
|
13
|
-
format: "singleline"
|
|
13
|
+
format: "singleline",
|
|
14
|
+
$helper: 'element-property'
|
|
14
15
|
},
|
|
15
16
|
value: {
|
|
16
17
|
title: "Default value",
|
|
@@ -105,13 +106,15 @@ exports.input_date_slot = {
|
|
|
105
106
|
title: "Name for start date",
|
|
106
107
|
description: "The form object key",
|
|
107
108
|
type: "string",
|
|
108
|
-
format: "singleline"
|
|
109
|
+
format: "singleline",
|
|
110
|
+
$helper: 'element-property'
|
|
109
111
|
},
|
|
110
112
|
nameEnd: {
|
|
111
113
|
title: "Name for end date",
|
|
112
114
|
description: "The form object key",
|
|
113
115
|
type: "string",
|
|
114
|
-
format: "singleline"
|
|
116
|
+
format: "singleline",
|
|
117
|
+
$helper: 'element-property'
|
|
115
118
|
},
|
|
116
119
|
valueStart: {
|
|
117
120
|
title: 'Start time',
|
package/elements/input-file.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
exports.input_property = {
|
|
2
|
-
|
|
2
|
+
// deprecated
|
|
3
3
|
menu: 'form',
|
|
4
4
|
group: 'block',
|
|
5
5
|
context: 'form//',
|
|
6
|
-
icon: '<i class="icon">X</i>',
|
|
7
6
|
properties: {
|
|
8
7
|
name: {
|
|
9
8
|
title: 'Name',
|
|
@@ -108,7 +107,7 @@ exports.input_property = {
|
|
|
108
107
|
|
|
109
108
|
let listOf = propType.anyOf || propType.oneOf;
|
|
110
109
|
if (listOf) {
|
|
111
|
-
const listOfNo = listOf.filter(
|
|
110
|
+
const listOfNo = listOf.filter(item => item.type != "null");
|
|
112
111
|
if (listOfNo.length != listOf.length) {
|
|
113
112
|
required = false;
|
|
114
113
|
}
|
|
@@ -119,7 +118,7 @@ exports.input_property = {
|
|
|
119
118
|
listOf = listOfNo;
|
|
120
119
|
}
|
|
121
120
|
} else if (Array.isArray(prop.type)) {
|
|
122
|
-
listOf = prop.type.filter(
|
|
121
|
+
listOf = prop.type.filter(type => {
|
|
123
122
|
if (type == "null") {
|
|
124
123
|
required = false;
|
|
125
124
|
return false;
|
|
@@ -301,7 +300,7 @@ exports.input_property = {
|
|
|
301
300
|
};
|
|
302
301
|
const filter = propType.$helper.filter;
|
|
303
302
|
if (filter && filter.type) {
|
|
304
|
-
limits.types = filter.type.map(
|
|
303
|
+
limits.types = filter.type.map(type => {
|
|
305
304
|
if (type == "image") return "image/*";
|
|
306
305
|
else if (type == "video") return "video/*";
|
|
307
306
|
else return "*/*";
|
package/elements/inputs.js
CHANGED
|
@@ -84,7 +84,8 @@ exports.input_text = {
|
|
|
84
84
|
title: "Name",
|
|
85
85
|
description: "The form object key",
|
|
86
86
|
type: "string",
|
|
87
|
-
format: "singleline"
|
|
87
|
+
format: "singleline",
|
|
88
|
+
$helper: 'element-property'
|
|
88
89
|
},
|
|
89
90
|
value: {
|
|
90
91
|
title: "Default value",
|
|
@@ -285,7 +286,8 @@ exports.input_checkbox = {
|
|
|
285
286
|
name: {
|
|
286
287
|
title: "Name",
|
|
287
288
|
type: "string",
|
|
288
|
-
format: "singleline"
|
|
289
|
+
format: "singleline",
|
|
290
|
+
$helper: 'element-property'
|
|
289
291
|
},
|
|
290
292
|
value: {
|
|
291
293
|
title: "Value",
|
|
@@ -341,7 +343,8 @@ exports.input_radio = {
|
|
|
341
343
|
name: {
|
|
342
344
|
title: "name",
|
|
343
345
|
type: "string",
|
|
344
|
-
format: "singleline"
|
|
346
|
+
format: "singleline",
|
|
347
|
+
$helper: 'element-property'
|
|
345
348
|
},
|
|
346
349
|
checked: {
|
|
347
350
|
title: "Checked",
|
|
@@ -388,7 +391,8 @@ exports.input_select = {
|
|
|
388
391
|
title: "Name",
|
|
389
392
|
description: "The form object key",
|
|
390
393
|
type: "string",
|
|
391
|
-
format: "singleline"
|
|
394
|
+
format: "singleline",
|
|
395
|
+
$helper: 'element-property'
|
|
392
396
|
},
|
|
393
397
|
placeholder: {
|
|
394
398
|
title: "Placeholder",
|
package/elements/list.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.textblock = {
|
|
|
9
9
|
title: 'Text',
|
|
10
10
|
inplace: true,
|
|
11
11
|
contents: "inline*",
|
|
12
|
-
html: '<span></span>'
|
|
12
|
+
html: '<span class="textblock"></span>'
|
|
13
13
|
};
|
|
14
14
|
exports.list = {
|
|
15
15
|
title: 'List',
|
|
@@ -69,7 +69,7 @@ exports.list = {
|
|
|
69
69
|
parse: function(dom) {
|
|
70
70
|
let marker = null;
|
|
71
71
|
const style = dom.style.listStyleType;
|
|
72
|
-
if (style && this.properties.marker.anyOf.some(
|
|
72
|
+
if (style && this.properties.marker.anyOf.some(item => item.const == style)) {
|
|
73
73
|
marker = style;
|
|
74
74
|
} else if (dom.nodeName == "OL") {
|
|
75
75
|
marker = 'decimal';
|
package/package.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pageboard/html",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"postinstall": "postinstall",
|
|
9
|
-
"prepare": "postinstall"
|
|
10
|
-
},
|
|
11
6
|
"repository": {
|
|
12
7
|
"type": "git",
|
|
13
8
|
"url": "git+https://github.com/pageboard/client.git"
|
|
@@ -26,7 +21,7 @@
|
|
|
26
21
|
"formdata-polyfill": "^4.0.10",
|
|
27
22
|
"nouislider": "^15.6.1",
|
|
28
23
|
"object-fit-images": "^3.2.4",
|
|
29
|
-
"postinstall-bundle": "^0.
|
|
24
|
+
"postinstall-bundle": "^0.8.0"
|
|
30
25
|
},
|
|
31
26
|
"postinstall": {
|
|
32
27
|
"semantic-ui-css/components": "link lib/components",
|
|
@@ -48,5 +43,9 @@
|
|
|
48
43
|
"elements": [
|
|
49
44
|
"elements/"
|
|
50
45
|
]
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
49
|
+
"postinstall": "postinstall"
|
|
51
50
|
}
|
|
52
|
-
}
|
|
51
|
+
}
|
package/ui/card.css
CHANGED
|
File without changes
|
package/ui/consent.js
CHANGED
package/ui/embed.js
CHANGED
|
@@ -10,7 +10,7 @@ class HTMLElementEmbed extends VirtualHTMLElement {
|
|
|
10
10
|
}
|
|
11
11
|
reveal(state) {
|
|
12
12
|
let done;
|
|
13
|
-
this.promise = new Promise(
|
|
13
|
+
this.promise = new Promise(resolve => done = resolve);
|
|
14
14
|
this.promise.done = done;
|
|
15
15
|
this.classList.add('waiting');
|
|
16
16
|
|
package/ui/form.js
CHANGED
|
@@ -213,7 +213,7 @@ class HTMLCustomFormElement extends HTMLFormElement {
|
|
|
213
213
|
const p = this.ignoreInputChange
|
|
214
214
|
? state.replace(loc)
|
|
215
215
|
: state.push(loc);
|
|
216
|
-
return p.catch(
|
|
216
|
+
return p.catch(err => {
|
|
217
217
|
if (err.status != null) status = err.status;
|
|
218
218
|
else status = 0;
|
|
219
219
|
}).then(() => {
|
|
@@ -228,9 +228,9 @@ class HTMLCustomFormElement extends HTMLFormElement {
|
|
|
228
228
|
form.classList.add('loading');
|
|
229
229
|
|
|
230
230
|
const data = { $query };
|
|
231
|
-
return Promise.all(Array.from(form.elements).filter(
|
|
231
|
+
return Promise.all(Array.from(form.elements).filter(node => {
|
|
232
232
|
return Boolean(node.presubmit);
|
|
233
|
-
}).map(
|
|
233
|
+
}).map(input => {
|
|
234
234
|
return input.presubmit();
|
|
235
235
|
})).then(() => {
|
|
236
236
|
data.$query = state.query;
|
|
@@ -240,7 +240,7 @@ class HTMLCustomFormElement extends HTMLFormElement {
|
|
|
240
240
|
pathname: form.getAttribute('action'),
|
|
241
241
|
query: data.$query
|
|
242
242
|
}), data.$request);
|
|
243
|
-
}).catch(
|
|
243
|
+
}).catch(err => err).then(res => {
|
|
244
244
|
if (res?.grants) state.data.$grants = res.grants;
|
|
245
245
|
state.scope.$response = res;
|
|
246
246
|
form.enable();
|
|
@@ -396,7 +396,7 @@ Object.defineProperty(HTMLInputElement.prototype, 'defaultValue', {
|
|
|
396
396
|
}
|
|
397
397
|
});
|
|
398
398
|
|
|
399
|
-
Page.setup(
|
|
399
|
+
Page.setup(state => {
|
|
400
400
|
// https://daverupert.com/2017/11/happier-html5-forms/
|
|
401
401
|
Page.connect({
|
|
402
402
|
captureBlur: (e, state) => blurHandler(e, false),
|
package/ui/image.js
CHANGED
|
@@ -33,7 +33,7 @@ class HTMLElementImage extends VirtualHTMLElement {
|
|
|
33
33
|
this.promise.done = function () { };
|
|
34
34
|
}
|
|
35
35
|
findClass(list) {
|
|
36
|
-
return list.find(
|
|
36
|
+
return list.find(name => this.matches(`.${name}`)) || list[0];
|
|
37
37
|
}
|
|
38
38
|
get fit() {
|
|
39
39
|
return this.findClass(['none', 'contain', 'cover']);
|
|
@@ -47,12 +47,12 @@ class HTMLElementImage extends VirtualHTMLElement {
|
|
|
47
47
|
this.classList.add(val);
|
|
48
48
|
}
|
|
49
49
|
set position(val) {
|
|
50
|
-
(val || '').split(' ').forEach(
|
|
50
|
+
(val || '').split(' ').forEach(val => {
|
|
51
51
|
if (val) this.classList.add(val);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
get crop() {
|
|
55
|
-
let [x, y, w, h, z] = (this.dataset.crop || ";;;;").split(";").map(
|
|
55
|
+
let [x, y, w, h, z] = (this.dataset.crop || ";;;;").split(";").map(x => parseFloat(x));
|
|
56
56
|
if (Number.isNaN(x)) x = 50;
|
|
57
57
|
if (Number.isNaN(y)) y = 50;
|
|
58
58
|
if (Number.isNaN(w)) w = 100;
|
|
@@ -150,7 +150,7 @@ class HTMLElementImage extends VirtualHTMLElement {
|
|
|
150
150
|
}
|
|
151
151
|
this.classList.add('loading');
|
|
152
152
|
let done;
|
|
153
|
-
this.promise = new Promise(
|
|
153
|
+
this.promise = new Promise(resolve => done = resolve);
|
|
154
154
|
this.promise.done = done;
|
|
155
155
|
img.setAttribute('src', curSrc);
|
|
156
156
|
}
|
package/ui/input-range.js
CHANGED
|
@@ -6,7 +6,7 @@ class HTMLElementInputRange extends HTMLInputElement {
|
|
|
6
6
|
static parse(x) {
|
|
7
7
|
return (x == null ? '' : x)
|
|
8
8
|
.split('⩽')
|
|
9
|
-
.map(
|
|
9
|
+
.map(n => {
|
|
10
10
|
n = parseFloat(n);
|
|
11
11
|
return Number.isNaN(n) ? null : n;
|
|
12
12
|
});
|
|
@@ -89,7 +89,7 @@ class HTMLElementInputRange extends HTMLInputElement {
|
|
|
89
89
|
if (this.isContentEditable) return;
|
|
90
90
|
const isInt = parseInt(opts.step) == opts.step;
|
|
91
91
|
helper.classList.remove('indeterminate');
|
|
92
|
-
if (isInt) values = values.map(
|
|
92
|
+
if (isInt) values = values.map(n => parseInt(n));
|
|
93
93
|
this.rangeValue = values;
|
|
94
94
|
this.dispatchEvent(new Event('change', {
|
|
95
95
|
bubbles: true,
|
package/ui/item.css
CHANGED
|
File without changes
|
package/ui/menu.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Page.patch(
|
|
1
|
+
Page.patch(state => {
|
|
2
2
|
function isSameOrParent(loc, state, isItem) {
|
|
3
3
|
if (!state.sameDomain(loc)) {
|
|
4
4
|
return false;
|
|
@@ -79,7 +79,7 @@ class HTMLElementMenu extends VirtualHTMLElement {
|
|
|
79
79
|
}
|
|
80
80
|
toHelper(root) {
|
|
81
81
|
const frag = root.ownerDocument.createDocumentFragment();
|
|
82
|
-
root.children.forEach(
|
|
82
|
+
root.children.forEach(item => {
|
|
83
83
|
frag.append(item.cloneNode(true));
|
|
84
84
|
});
|
|
85
85
|
return frag;
|
package/ui/pagination.js
CHANGED
|
@@ -95,8 +95,8 @@ class HTMLElementPagination extends HTMLAnchorElement {
|
|
|
95
95
|
setup(state) {
|
|
96
96
|
if (this.isContentEditable || !this.#infinite) return;
|
|
97
97
|
this.#queue = Promise.resolve();
|
|
98
|
-
this.#observer = new IntersectionObserver(
|
|
99
|
-
entries.forEach(
|
|
98
|
+
this.#observer = new IntersectionObserver(entries => {
|
|
99
|
+
entries.forEach(entry => {
|
|
100
100
|
if (this.#reached) return;
|
|
101
101
|
if (this.offsetParent && (entry.intersectionRatio || 0) !== 0) {
|
|
102
102
|
this.#visible = true;
|
package/ui/query-tags.js
CHANGED
|
@@ -44,7 +44,7 @@ class HTMLElementQueryTags extends VirtualHTMLElement {
|
|
|
44
44
|
}
|
|
45
45
|
add(name, value) {
|
|
46
46
|
const labels = this.labels;
|
|
47
|
-
this.find(name, value).forEach(
|
|
47
|
+
this.find(name, value).forEach(control => {
|
|
48
48
|
if (control.type == "hidden") return;
|
|
49
49
|
const field = control.closest('.field');
|
|
50
50
|
if (!field) return;
|
package/ui/rating.css
CHANGED
|
File without changes
|
package/ui/select.js
CHANGED
|
@@ -137,7 +137,7 @@ class HTMLElementSelect extends VirtualHTMLElement {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
setup(state) {
|
|
140
|
-
this.#observer = new MutationObserver(
|
|
140
|
+
this.#observer = new MutationObserver(mutations => this.#fillSelect());
|
|
141
141
|
this.#observer.observe(this.#menu, {
|
|
142
142
|
childList: true
|
|
143
143
|
});
|
|
@@ -175,7 +175,7 @@ class HTMLElementSelect extends VirtualHTMLElement {
|
|
|
175
175
|
|
|
176
176
|
state.finish(() => {
|
|
177
177
|
// synchronize after form has filled select
|
|
178
|
-
this.#select.children.forEach(
|
|
178
|
+
this.#select.children.forEach(opt => {
|
|
179
179
|
if (opt.value) {
|
|
180
180
|
if (opt.selected) this.#selectItem(opt.value);
|
|
181
181
|
else this.#deselectItem(opt.value);
|
package/ui/sitemap-helper.js
CHANGED
|
@@ -10,7 +10,7 @@ class HTMLElementSitepage extends VirtualHTMLElement {
|
|
|
10
10
|
setup(state) {
|
|
11
11
|
const content = this.querySelector('[block-content="children"]');
|
|
12
12
|
if (!content) return;
|
|
13
|
-
this.observer = new MutationObserver(
|
|
13
|
+
this.observer = new MutationObserver(mutations => this.updateChildren());
|
|
14
14
|
this.observer.observe(content, {
|
|
15
15
|
childList: true
|
|
16
16
|
});
|
|
@@ -52,7 +52,7 @@ class HTMLElementSitepage extends VirtualHTMLElement {
|
|
|
52
52
|
const block = editor.blocks.get(this.getAttribute('block-id'));
|
|
53
53
|
if (!block.data) block.data = {};
|
|
54
54
|
const data = this.options;
|
|
55
|
-
if (Object.keys(data).some(
|
|
55
|
+
if (Object.keys(data).some(key => data[key] != block.data[key])) {
|
|
56
56
|
Object.assign(block.data, data);
|
|
57
57
|
editor.dispatch(editor.utils.refreshTr(editor.state.tr, this, block));
|
|
58
58
|
this.updateChildren();
|
package/ui/tab-helper.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Page.setup(() => {
|
|
2
2
|
VirtualHTMLElement.extend('element-tabs', class TabsHelper {
|
|
3
3
|
setup(state) {
|
|
4
|
-
if (!this.observer) this.observer = new MutationObserver(
|
|
4
|
+
if (!this.observer) this.observer = new MutationObserver(records => {
|
|
5
5
|
for (const record of records) this.mutate(record, state);
|
|
6
6
|
});
|
|
7
7
|
this.observer.observe(this.items, {
|
package/ui/transition.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(document, 'body', {
|
|
|
4
4
|
return this.documentElement.querySelector('body:last-of-type');
|
|
5
5
|
}
|
|
6
6
|
});
|
|
7
|
-
Page.init(
|
|
7
|
+
Page.init(state => {
|
|
8
8
|
const root = document.documentElement;
|
|
9
9
|
function dtr(state) {
|
|
10
10
|
root.dataset.stage = state.stage;
|
|
@@ -30,7 +30,7 @@ Page.State.prototype.mergeBody = function(body, corpse) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
Page.setup(
|
|
33
|
+
Page.setup(state => {
|
|
34
34
|
if (state.transition) {
|
|
35
35
|
if (state.transition.ok) {
|
|
36
36
|
state.finish(() => {
|
|
@@ -79,7 +79,7 @@ Page.Transition = class {
|
|
|
79
79
|
from.after(to);
|
|
80
80
|
}
|
|
81
81
|
start() {
|
|
82
|
-
return new Promise(
|
|
82
|
+
return new Promise(resolve => {
|
|
83
83
|
this.resolve = resolve;
|
|
84
84
|
if (!this.ok) {
|
|
85
85
|
this.destroy();
|