@pageboard/html 0.11.18 → 0.11.20
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/input-date.js +6 -4
- package/elements/menu.js +12 -1
- package/elements/paragraph.js +3 -0
- package/elements/sitemap.js +2 -0
- package/package.json +3 -3
- package/ui/heading-helper.js +2 -2
- package/ui/heading.js +9 -0
- package/ui/input-date-slot.js +1 -3
- package/ui/input-date.js +4 -0
- package/ui/menu.css +0 -3
- package/ui/menu.js +16 -5
- package/ui/sitemap.js +1 -1
package/elements/input-date.js
CHANGED
|
@@ -49,13 +49,15 @@ exports.input_date_time = {
|
|
|
49
49
|
}]
|
|
50
50
|
},
|
|
51
51
|
step: {
|
|
52
|
-
title: '
|
|
53
|
-
description: '
|
|
52
|
+
title: 'Time steps',
|
|
53
|
+
description: 'Ignored for dates',
|
|
54
54
|
type: 'integer',
|
|
55
|
-
default:
|
|
55
|
+
default: null,
|
|
56
56
|
anyOf: [{
|
|
57
|
-
const:
|
|
57
|
+
const: null,
|
|
58
58
|
title: '1 minute'
|
|
59
|
+
}, {
|
|
60
|
+
const: 60
|
|
59
61
|
}, {
|
|
60
62
|
const: 60 * 5,
|
|
61
63
|
title: '5 minutes'
|
package/elements/menu.js
CHANGED
|
@@ -43,6 +43,17 @@ exports.menu_group = {
|
|
|
43
43
|
const: "right",
|
|
44
44
|
title: "Right"
|
|
45
45
|
}]
|
|
46
|
+
},
|
|
47
|
+
responsive: {
|
|
48
|
+
title: 'Responsive',
|
|
49
|
+
default: 'popup',
|
|
50
|
+
anyOf: [{
|
|
51
|
+
const: null,
|
|
52
|
+
title: 'None'
|
|
53
|
+
}, {
|
|
54
|
+
const: 'popup',
|
|
55
|
+
title: 'Popup'
|
|
56
|
+
}]
|
|
46
57
|
}
|
|
47
58
|
},
|
|
48
59
|
contents: {
|
|
@@ -51,7 +62,7 @@ exports.menu_group = {
|
|
|
51
62
|
},
|
|
52
63
|
html: `<element-menu class="[position] menu">
|
|
53
64
|
<div block-content="items"></div>
|
|
54
|
-
<div tabindex="0" class="ui fixed popup item">
|
|
65
|
+
<div tabindex="0" class="ui fixed popup item [responsive|eq:popup|bmagnet:*]">
|
|
55
66
|
<div class="icon">≡</div>
|
|
56
67
|
<div class="dropdown placer"><div class="menu"></div></div>
|
|
57
68
|
</div>
|
package/elements/paragraph.js
CHANGED
package/elements/sitemap.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
exports.sitemap = {
|
|
2
2
|
title: "Sitemap",
|
|
3
3
|
group: "block",
|
|
4
|
+
bundle: true,
|
|
4
5
|
icon: '<i class="sitemap icon"></i>',
|
|
5
6
|
menu: 'link',
|
|
6
7
|
contents: {
|
|
@@ -38,6 +39,7 @@ exports.sitemap = {
|
|
|
38
39
|
...schema.properties
|
|
39
40
|
},
|
|
40
41
|
menu: "link",
|
|
42
|
+
bundle: 'sitemap',
|
|
41
43
|
group: 'sitemap_item',
|
|
42
44
|
virtual: true,
|
|
43
45
|
contents: leaf ? undefined : {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pageboard/html",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/pageboard/client#readme",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"postinstall": "^0.
|
|
22
|
+
"postinstall": "^0.8.0",
|
|
23
23
|
"semantic-ui-css": "^2.4.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"formdata-polyfill": "^4.0.10",
|
|
27
|
-
"nouislider": "^15.6.
|
|
27
|
+
"nouislider": "^15.6.1",
|
|
28
28
|
"object-fit-images": "^3.2.4",
|
|
29
29
|
"postinstall-bundle": "^0.7.4"
|
|
30
30
|
},
|
package/ui/heading-helper.js
CHANGED
|
@@ -5,8 +5,8 @@ class HTMLElementHeadingHelper extends HTMLHeadingElement {
|
|
|
5
5
|
}
|
|
6
6
|
init() {
|
|
7
7
|
this.willSync = Pageboard.debounce(this.sync, 100);
|
|
8
|
-
this.observer = new MutationObserver(
|
|
9
|
-
if (records.some(
|
|
8
|
+
this.observer = new MutationObserver(records => {
|
|
9
|
+
if (records.some(mut => {
|
|
10
10
|
return mut.type == "characterData" || mut.type == "childList" && mut.addedNodes.length;
|
|
11
11
|
})) this.willSync();
|
|
12
12
|
});
|
package/ui/heading.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Page.patch(state => {
|
|
2
|
+
state.finish(() => {
|
|
3
|
+
const heading = document.body.querySelector('element-template > .view h1');
|
|
4
|
+
if (!heading) return;
|
|
5
|
+
const title = document.head.querySelector('title');
|
|
6
|
+
if (!title) return;
|
|
7
|
+
title.textContent = heading.textContent.trim() + ' - ' + title.textContent;
|
|
8
|
+
});
|
|
9
|
+
});
|
package/ui/input-date-slot.js
CHANGED
|
@@ -62,10 +62,8 @@ class HTMLElementInputDateSlot extends VirtualHTMLElement {
|
|
|
62
62
|
patch(state) {
|
|
63
63
|
const [ start, end ] = this.#inputs();
|
|
64
64
|
const type = this.type;
|
|
65
|
-
|
|
66
|
-
if (type == "date" && step < 86400) step = 0;
|
|
65
|
+
const step = type == "date" ? 0 : this.step;
|
|
67
66
|
if (step) {
|
|
68
|
-
if (type == "date") step = Math.round(step / 86400);
|
|
69
67
|
start.setAttribute('step', step);
|
|
70
68
|
end.setAttribute('step', step);
|
|
71
69
|
} else {
|
package/ui/input-date.js
CHANGED
package/ui/menu.css
CHANGED
|
@@ -102,13 +102,10 @@ element-menu > [block-content="items"] {
|
|
|
102
102
|
}
|
|
103
103
|
element-menu.burger > [block-content="items"] {
|
|
104
104
|
left:0;
|
|
105
|
-
}
|
|
106
|
-
element-menu.burger.right > [block-content="items"] {
|
|
107
105
|
position: absolute;
|
|
108
106
|
pointer-events: none;
|
|
109
107
|
height: 0;
|
|
110
108
|
}
|
|
111
|
-
|
|
112
109
|
element-menu:not(.burger) > .item {
|
|
113
110
|
display:none !important;
|
|
114
111
|
}
|
package/ui/menu.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
Page.patch((state) => {
|
|
2
|
-
function isSameOrParent(loc, state) {
|
|
2
|
+
function isSameOrParent(loc, state, isItem) {
|
|
3
3
|
if (!state.sameDomain(loc)) {
|
|
4
4
|
return false;
|
|
5
5
|
} else if (state.samePathname(loc)) {
|
|
6
|
-
if (loc.sameQuery({query:{}})) return true;
|
|
7
|
-
if (state.query.develop !== undefined)
|
|
6
|
+
if (!isItem && loc.sameQuery({query:{}})) return true;
|
|
7
|
+
if (state.query.develop !== undefined) {
|
|
8
|
+
// kept for backward compatibility
|
|
9
|
+
loc.query.develop = state.query.develop;
|
|
10
|
+
}
|
|
8
11
|
if (state.sameQuery(loc)) return true;
|
|
9
12
|
} else {
|
|
10
13
|
return state.pathname.startsWith(loc.pathname + '/');
|
|
@@ -14,7 +17,7 @@ Page.patch((state) => {
|
|
|
14
17
|
for (const item of document.querySelectorAll('[block-type="menu"] [href]')) {
|
|
15
18
|
const loc = item.getAttribute('href');
|
|
16
19
|
if (!loc) continue;
|
|
17
|
-
if (isSameOrParent(Page.parse(loc), state)) {
|
|
20
|
+
if (isSameOrParent(Page.parse(loc), state, item.matches('.item'))) {
|
|
18
21
|
item.classList.add('active');
|
|
19
22
|
}
|
|
20
23
|
}
|
|
@@ -26,6 +29,10 @@ class HTMLElementMenu extends VirtualHTMLElement {
|
|
|
26
29
|
if (this.isContentEditable || this.matches('.vertical')) return;
|
|
27
30
|
const menu = this.firstElementChild;
|
|
28
31
|
const helper = this.lastElementChild;
|
|
32
|
+
if (helper == menu) {
|
|
33
|
+
// not a popup
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
29
36
|
helper.lastElementChild.lastElementChild.appendChild(this.toHelper(menu));
|
|
30
37
|
state.finish(() => {
|
|
31
38
|
this.observer = new ResizeObserver((entries, observer) => {
|
|
@@ -43,10 +50,14 @@ class HTMLElementMenu extends VirtualHTMLElement {
|
|
|
43
50
|
if (this.observer) this.observer.disconnect();
|
|
44
51
|
}
|
|
45
52
|
handleAllClick(e, state) {
|
|
53
|
+
const tosser = this.lastElementChild;
|
|
54
|
+
if (tosser == this.firstElementChild) {
|
|
55
|
+
// not a popup
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
46
58
|
if (this.active) {
|
|
47
59
|
this.active.classList.toggle('active', false);
|
|
48
60
|
}
|
|
49
|
-
const tosser = this.lastElementChild;
|
|
50
61
|
tosser.classList.remove('inactive');
|
|
51
62
|
let item = tosser.contains(e.target) && !e.target.closest('a') && e.target.closest('.item');
|
|
52
63
|
if (item == tosser) {
|
package/ui/sitemap.js
CHANGED
|
@@ -8,7 +8,7 @@ class HTMLElementSitemap extends VirtualHTMLElement {
|
|
|
8
8
|
if (parent.content == null) parent.content = {};
|
|
9
9
|
if (parent.content.children == null) parent.content.children = "";
|
|
10
10
|
if (typeof parent.content.children == "string") {
|
|
11
|
-
parent.content.children += `<div block-id="${page.id}" block-type="
|
|
11
|
+
parent.content.children += `<div block-id="${page.id}" block-type="${page.type}"></div>`;
|
|
12
12
|
}
|
|
13
13
|
delete tree._;
|
|
14
14
|
} else {
|