wiki-formant 0.85.0 → 0.85.1

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/dist/revisions.js CHANGED
@@ -33,8 +33,14 @@ export function extractBlocks(blocks, containers, basePath = 'root') {
33
33
  });
34
34
  return out;
35
35
  }
36
+ /** A value with every object's keys in one order: jsonb hands a stored block's keys back in its own. */
37
+ const canonical = (v) => Array.isArray(v)
38
+ ? v.map(canonical)
39
+ : v && typeof v === 'object'
40
+ ? Object.fromEntries(Object.keys(v).sort().map(k => [k, canonical(v[k])]))
41
+ : v;
36
42
  /**
37
- * Which scalar fields differ. Nested block arrays are skipped: they are walked
43
+ * Which scalar fields differ, whatever order their keys are in. Nested block arrays are skipped: they are walked
38
44
  * as their own entries, and comparing them here would report a container as
39
45
  * modified every time anything inside it moved.
40
46
  */
@@ -57,7 +63,7 @@ function diffAttributes(oldBlock, newBlock, containers) {
57
63
  continue;
58
64
  const from = oldBlock[key];
59
65
  const to = newBlock[key];
60
- if (JSON.stringify(from) !== JSON.stringify(to))
66
+ if (JSON.stringify(canonical(from)) !== JSON.stringify(canonical(to)))
61
67
  diffs[key] = { from, to };
62
68
  }
63
69
  return Object.keys(diffs).length > 0 ? diffs : undefined;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * An href acceptable to persist: http, https, mailto, or a relative path or
2
+ * An href acceptable to persist: http, https, mailto, tel, or a relative path or
3
3
  * fragment. Everything else — `javascript:`, `data:`, `vbscript:`, a
4
4
  * protocol-relative `//host` — comes back null.
5
5
  *
@@ -10,7 +10,7 @@
10
10
  // block type is a compile error there until it is handled.
11
11
  import { LIST_SOURCES } from './blocks.js';
12
12
  /**
13
- * An href acceptable to persist: http, https, mailto, or a relative path or
13
+ * An href acceptable to persist: http, https, mailto, tel, or a relative path or
14
14
  * fragment. Everything else — `javascript:`, `data:`, `vbscript:`, a
15
15
  * protocol-relative `//host` — comes back null.
16
16
  *
@@ -36,7 +36,7 @@ export function safeLinkHref(raw) {
36
36
  const scheme = href.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);
37
37
  if (scheme) {
38
38
  const s = scheme[1].toLowerCase();
39
- if (s !== 'http' && s !== 'https' && s !== 'mailto')
39
+ if (s !== 'http' && s !== 'https' && s !== 'mailto' && s !== 'tel')
40
40
  return null;
41
41
  }
42
42
  return href;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-formant",
3
- "version": "0.85.0",
3
+ "version": "0.85.1",
4
4
  "description": "The portable half of a wiki: derived taxonomy and facet controls, a version-negotiating MCP transport, markdown twins, block rendering, a rich-text editor engine, conditional-GET plumbing, and the headers and CSP every origin sends.",
5
5
  "type": "module",
6
6
  "license": "MIT",