@pageboard/html 0.14.27 → 0.14.29

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
@@ -4,9 +4,11 @@ exports.embed = {
4
4
  icon: '<i class="external square alternate icon"></i>',
5
5
  properties: {
6
6
  id: {
7
+ title: 'Link name',
8
+ description: 'Target for anchors',
7
9
  nullable: true,
8
10
  type: 'string',
9
- pattern: /^[a-z0-9-]*$/.source
11
+ format: 'grant'
10
12
  },
11
13
  linkable: {
12
14
  title: 'Show hash link',
@@ -53,4 +55,3 @@ exports.embed = {
53
55
  '../ui/linkable.css'
54
56
  ]
55
57
  };
56
- exports.editor?.scripts.push('../ui/embed-helper.js');
@@ -32,9 +32,11 @@ exports.heading = {
32
32
  }]
33
33
  },
34
34
  id: {
35
+ title: 'Link name',
36
+ description: 'Target for anchors',
35
37
  nullable: true,
36
38
  type: 'string',
37
- pattern: /^[a-z0-9-]*$/.source
39
+ format: 'grant'
38
40
  },
39
41
  linkable: {
40
42
  title: 'Show hash link',
@@ -60,6 +62,7 @@ exports.heading = {
60
62
  </hn>`,
61
63
  parse: function (dom) {
62
64
  return {
65
+ id: dom.getAttribute('id') || null,
63
66
  level: parseInt(dom.nodeName.substring(1))
64
67
  };
65
68
  },
@@ -71,7 +74,6 @@ exports.heading = {
71
74
  '../ui/heading.js'
72
75
  ]
73
76
  };
74
- exports.editor?.scripts.push('../ui/heading-helper.js');
75
77
 
76
78
  exports.heading_nolink = {
77
79
  ...exports.heading,
@@ -7,7 +7,8 @@ exports.units = {
7
7
  { const: 'ch' },
8
8
  { const: 'vw' },
9
9
  { const: 'rem' },
10
- { const: 'px' }
10
+ { const: 'px' },
11
+ { const: '%' }
11
12
  ],
12
13
  default: 'em',
13
14
  $helper: 'units'
@@ -114,6 +115,15 @@ exports.layout = {
114
115
  title: "Contained"
115
116
  }]
116
117
  },
118
+ maxWidth: {
119
+ title: 'Max width',
120
+ type: 'number',
121
+ minimum: 0,
122
+ nullable: true
123
+ },
124
+ maxWidthUnits: {
125
+ $ref: "#/definitions/units/properties/data/properties/inline"
126
+ },
117
127
  height: {
118
128
  title: 'Height',
119
129
  type: 'number',
@@ -374,6 +384,7 @@ exports.layout = {
374
384
  style-margin-inline="[margins.inline|fail:][margins.inlineUnits]"
375
385
  style-padding-block="[padding.block|fail:][padding.blockUnits]"
376
386
  style-padding-inline="[padding.inline|fail:][padding.inlineUnits]"
387
+ style-max-width="[maxWidth|fail:][maxWidthUnits]"
377
388
  style-height="[height|fail:][heightUnits]"
378
389
  style-background-color="[background.color]"
379
390
  style-background-size="[background.size]"
package/elements/link.js CHANGED
@@ -31,13 +31,20 @@ exports.link = {
31
31
  name: 'datalist',
32
32
  url: '/.api/languages'
33
33
  }
34
- }
34
+ },
35
+ id: {
36
+ title: 'Link name',
37
+ description: 'Target for anchors',
38
+ nullable: true,
39
+ type: 'string',
40
+ format: 'grant'
41
+ },
35
42
  },
36
43
  contents: "text*",
37
44
  inline: true,
38
45
  group: "inline",
39
46
  tag: 'a:not([block-type]),a[block-type="link"]',
40
- html: '<a href="[url]" hreflang="[lang]" class="[button|alt:ui button]"></a>',
47
+ html: '<a href="[url]" hreflang="[lang]" class="[button|alt:ui button]" id="[id]"></a>',
41
48
  stylesheets: [
42
49
  '../ui/components/button.css'
43
50
  ]
package/elements/page.js CHANGED
@@ -6,6 +6,11 @@ exports.page.stylesheets = [
6
6
  '../ui/transition.css'
7
7
  ];
8
8
 
9
+ exports.page.resources = {
10
+ reset: '../ui/components/reset.css',
11
+ site: '../ui/site.css'
12
+ };
13
+
9
14
  exports.page.scripts = [
10
15
  ...exports.page.scripts,
11
16
  '../ui/transition.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.14.27",
3
+ "version": "0.14.29",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/linkable.css CHANGED
@@ -1,5 +1,6 @@
1
1
  [block-type][id] > a.linkable[aria-hidden="true"] {
2
2
  display: block;
3
3
  position: absolute;
4
- left: -2ch;
4
+ left: -1ch;
5
+ text-decoration: none;
5
6
  }
@@ -1,11 +0,0 @@
1
- Page.extend('element-embed', class HTMLElementEmbedHelper {
2
- paint(state) {
3
- if (!state.scope.$write) return;
4
- const { editor } = state.scope;
5
- if (!editor) return;
6
- const id = editor.slug(this.title).slice(0, 32);
7
- if (id != this.id) {
8
- editor.blocks.mutate(this, { id });
9
- }
10
- }
11
- });
@@ -1,37 +0,0 @@
1
- class HTMLElementHeadingHelper extends Page.create(HTMLHeadingElement) {
2
- setup(state) {
3
- this.willSync = state.debounce(() => this.sync(state.scope), 100);
4
- this.observer = new MutationObserver(records => {
5
- if (records.some(mut => {
6
- return mut.type == "characterData" || mut.type == "childList" && mut.addedNodes.length;
7
- })) this.willSync();
8
- });
9
- this.observer.observe(this, {
10
- childList: true,
11
- subtree: true,
12
- characterData: true
13
- });
14
- }
15
- close() {
16
- if (this.observer) this.observer.disconnect();
17
- }
18
- sync(scope) {
19
- const { editor } = scope;
20
- if (!editor) return;
21
- if (this.firstElementChild?.nodeName != "A") return;
22
- const txt = editor.slug(this.textContent);
23
- const id = txt.length <= 64 ? txt : null;
24
- if (id != this.id) {
25
- editor.blocks.mutate(this, { id });
26
- }
27
- }
28
- }
29
-
30
-
31
- for (let i = 1; i <= 6; i++) {
32
- Page.define(
33
- `h${i}-helper`,
34
- class extends HTMLElementHeadingHelper { },
35
- `h${i}`
36
- );
37
- }