@pageboard/html 0.11.19 → 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.
@@ -150,6 +150,9 @@ exports.heading = {
150
150
  stylesheets: [
151
151
  '../ui/heading.css'
152
152
  ],
153
+ scripts: [
154
+ '../ui/heading.js'
155
+ ],
153
156
  resources: {
154
157
  helper: '../ui/heading-helper.js'
155
158
  },
@@ -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.19",
3
+ "version": "0.11.20",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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((records) => {
9
- if (records.some((mut) => {
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/menu.js CHANGED
@@ -1,9 +1,9 @@
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;
6
+ if (!isItem && loc.sameQuery({query:{}})) return true;
7
7
  if (state.query.develop !== undefined) {
8
8
  // kept for backward compatibility
9
9
  loc.query.develop = state.query.develop;
@@ -17,7 +17,7 @@ Page.patch((state) => {
17
17
  for (const item of document.querySelectorAll('[block-type="menu"] [href]')) {
18
18
  const loc = item.getAttribute('href');
19
19
  if (!loc) continue;
20
- if (isSameOrParent(Page.parse(loc), state)) {
20
+ if (isSameOrParent(Page.parse(loc), state, item.matches('.item'))) {
21
21
  item.classList.add('active');
22
22
  }
23
23
  }
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="site${page.type}"></div>`;
11
+ parent.content.children += `<div block-id="${page.id}" block-type="${page.type}"></div>`;
12
12
  }
13
13
  delete tree._;
14
14
  } else {