rapier-html 1.2.45 → 1.2.46

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.
Files changed (44) hide show
  1. package/BUILD.json +16 -16
  2. package/README.md +11 -11
  3. package/dist/ledger/LICENSE +12 -5
  4. package/dist/ledger/authored-origin.mjs +2 -2
  5. package/dist/ledger/authorship.mjs +5 -5
  6. package/dist/ledger/carried.mjs +5 -5
  7. package/dist/ledger/diff/concerns.mjs +1 -1
  8. package/dist/ledger/diff/diff.mjs +6 -6
  9. package/dist/ledger/diff/index.mjs +2 -2
  10. package/dist/ledger/diff/merge.mjs +3 -3
  11. package/dist/ledger/diff/moves.mjs +1 -1
  12. package/dist/ledger/diff/walk.mjs +1 -1
  13. package/dist/ledger/document-fonts.mjs +242 -0
  14. package/dist/ledger/document-settings.mjs +2 -2
  15. package/dist/ledger/format.mjs +14 -12
  16. package/dist/ledger/history.mjs +7 -7
  17. package/dist/ledger/inverse-source.mjs +5 -5
  18. package/dist/ledger/journal-records.mjs +3 -3
  19. package/dist/ledger/math/delimiters.mjs +38 -0
  20. package/dist/ledger/math/markdown-rules.mjs +103 -0
  21. package/dist/ledger/md-assets.mjs +3 -2
  22. package/dist/ledger/md-comments.mjs +384 -0
  23. package/dist/ledger/md-engine.mjs +157 -0
  24. package/dist/ledger/md-marks.mjs +10 -1
  25. package/dist/ledger/md-parser-config.mjs +463 -0
  26. package/dist/ledger/md-parser-runtime.mjs +23 -0
  27. package/dist/ledger/md-source.mjs +1 -1
  28. package/dist/ledger/template-page.mjs +1 -1
  29. package/dist/ledger/transport.mjs +66 -7
  30. package/dist/ledger/vendor/BROWSER-ENTITIES.json +36 -0
  31. package/dist/ledger/vendor/MARKDOWN-RUNTIME.json +136 -0
  32. package/dist/ledger/vendor/MARKDOWNIT.json +582 -0
  33. package/dist/ledger/vendor/NOTICE.txt +60 -0
  34. package/dist/ledger/vendor/markdown-licenses/entities-LICENSE.txt +11 -0
  35. package/dist/ledger/vendor/markdown-licenses/linkify-it-LICENSE.txt +22 -0
  36. package/dist/ledger/vendor/markdown-licenses/markdown-it-LICENSE.txt +22 -0
  37. package/dist/ledger/vendor/markdown-licenses/mdurl-LICENSE.txt +45 -0
  38. package/dist/ledger/vendor/markdown-licenses/punycode.js-LICENSE-MIT.txt +20 -0
  39. package/dist/ledger/vendor/markdown-licenses/uc.micro-LICENSE.txt +20 -0
  40. package/dist/ledger/vendor/markdown-plugins.json +46 -0
  41. package/dist/ledger/vendor/markdown-plugins.mjs +27 -0
  42. package/dist/ledger/vendor/markdown-runtime.mjs +13 -0
  43. package/dist/rapier.html +59 -67
  44. package/package.json +1 -1
@@ -1,9 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
- import {_rapierTransformSplices, _rapierValidAuthored, _rapierHistoryEffects} from './journal-records.mjs';
3
- import {projectInverseSource} from './inverse-source.mjs';
4
- import {authoredBasis, authoredPlacement, authoredPlacements} from './authored-origin.mjs';
5
- import {sha256} from './hash.mjs';
6
- import {canonicalJSON} from './data.mjs';
2
+ import {_rapierTransformSplices, _rapierValidAuthored, _rapierHistoryEffects} from "./journal-records.mjs";
3
+ import {projectInverseSource} from "./inverse-source.mjs";
4
+ import {authoredBasis, authoredPlacement, authoredPlacements} from "./authored-origin.mjs";
5
+ import {sha256} from "./hash.mjs";
6
+ import {canonicalJSON} from "./data.mjs";
7
+ import {parseComments, commentSplices, derivedCommentEdits} from "./md-comments.mjs";
7
8
 
8
9
  const whole = text => typeof text === 'string' && !/[\uD800-\uDFFF]/u.test(text);
9
10
  function admitted(rows) {
@@ -59,7 +60,65 @@ function applyBatch(text, rows) {
59
60
  return {text: after, splices: exact};
60
61
  }
61
62
 
62
- export function transposeRecord(base, splices, id, records) {
63
+ export function transposeRecord(base, splices, id, records, derivedCommentIndex) {
64
+ const comments = transposeCommentRecord(base, splices, id, records, derivedCommentIndex);
65
+ return comments || transposeTextRecord(base, splices, id, records);
66
+ }
67
+
68
+ function commentRecordProof(source, splices, index) {
69
+ if (typeof source !== 'string' || !source.includes('<!-- md-comments:') ||
70
+ !Array.isArray(splices) || !Number.isSafeInteger(index) || index !== splices.length - 1) return null;
71
+ try {
72
+ const parsed = parseComments(source), proof = derivedCommentEdits(source, splices);
73
+ if (!parsed.record || parsed.reason || !parsed.current || !proof || proof.edits.length !== index ||
74
+ canonicalJSON(proof.edits) !== canonicalJSON(splices.slice(0, index))) return null;
75
+ let start = parsed.record.start;
76
+ for (const row of proof.edits) {
77
+ if (row.pos >= start || row.pos + row.removed.length > start) return null;
78
+ start += row.inserted.length - row.removed.length;
79
+ }
80
+ const derived = commentSplices(source, proof.edits);
81
+ if (derived.length !== 1 || canonicalJSON(derived[0]) !== canonicalJSON(splices[index])) return null;
82
+ return {parsed, edits: proof.edits, text: _rapierTransformSplices(source, splices)};
83
+ } catch (_) { return null; }
84
+ }
85
+
86
+ function transposeCommentRecord(base, splices, id, records, derivedCommentIndex) {
87
+ if (!Array.isArray(records) || !records.length) return null;
88
+ const local = commentRecordProof(base, splices, derivedCommentIndex);
89
+ if (!local) return null;
90
+ const bodyRecords = []; let current = base;
91
+ for (const record of records) {
92
+ const proof = commentRecordProof(current, record.splices, record.derivedCommentIndex);
93
+ if (!proof) return null;
94
+ bodyRecords.push({...record, splices: proof.edits}); current = proof.text;
95
+ }
96
+ const moved = transposeTextRecord(local.parsed.body, local.edits, id, bodyRecords);
97
+ const derive = (source, rows) => {
98
+ const parsed = parseComments(source); let start = parsed.record?.start;
99
+ if (!parsed.record || parsed.reason || !parsed.current) throw new RangeError('canonical_act_rebase_conflict');
100
+ for (const row of rows) {
101
+ if (row.pos >= start || row.pos + row.removed.length > start) throw new RangeError('canonical_act_rebase_conflict');
102
+ start += row.inserted.length - row.removed.length;
103
+ }
104
+ const footer = commentSplices(source, rows), splices = [...rows, ...footer];
105
+ const text = _rapierTransformSplices(source, splices), after = text === null ? null : parseComments(text);
106
+ if (!after?.record || after.reason || !after.current) throw new RangeError('canonical_act_rebase_conflict');
107
+ return {text, splices, footer};
108
+ };
109
+ const accepted = derive(current, moved.splices);
110
+ let reciprocal = local.text;
111
+ const against = moved.against.map(record => {
112
+ const value = derive(reciprocal, record.splices); reciprocal = value.text;
113
+ return {...record, splices: value.splices};
114
+ });
115
+ if (reciprocal !== accepted.text || parseComments(accepted.text).body !== moved.text)
116
+ throw new RangeError('canonical_transport_invalid');
117
+ return {text: accepted.text, splices: accepted.splices, against,
118
+ sourceIndices: [...moved.sourceIndices, ...accepted.footer.map(() => derivedCommentIndex)]};
119
+ }
120
+
121
+ function transposeTextRecord(base, splices, id, records) {
63
122
  if (typeof base !== 'string' || !Array.isArray(splices) || typeof id !== 'string' || !Array.isArray(records))
64
123
  throw new RangeError('canonical_transport_invalid');
65
124
  let source = base, current = base;
@@ -305,7 +364,7 @@ function authoredReplay(base, records, append = null) {
305
364
  throw new RangeError('canonical_origin_invalid');
306
365
  const accepted = projectInverse(text, aligned.records, id);
307
366
  moved = {text: accepted.after, splices: accepted.splices};
308
- } else moved = transposeRecord(basis.text, origin.splices, id, crossed);
367
+ } else moved = transposeRecord(basis.text, origin.splices, id, crossed, original.derivedCommentIndex);
309
368
  if (_rapierTransformSplices(text, moved.splices) !== moved.text) throw new RangeError('canonical_origin_invalid');
310
369
  placed.push({...original, splices: moved.splices}); text = moved.text; ids.add(id);
311
370
  if (original.derivedCommentIndex != null) sourceIndices.set(id, moved.sourceIndices);
@@ -0,0 +1,36 @@
1
+ {
2
+ "description": "The page and Node use the same native ES2022 build of unchanged markdown-it 15.0.3 release source (MARKDOWNIT.json). tools/entities-vendor.mjs re-encodes its 2,125 HTML entity names as a compact list with the strict decoder its callers require, then minifies with the pinned options. The normal Rapier core rule in agent/markdown-spec.mjs owns auto-link token expansion; the vendor has no parser rule changes. Each vendor pins upstream and derived bytes; a changed source or derivation requires grammar and entity equivalence before repinning.",
3
+ "vendors": [
4
+ {
5
+ "id": "lib-markdownit",
6
+ "upstream": {
7
+ "name": "markdown-it-15.0.3.es2022.umd.js",
8
+ "bytes": 144327,
9
+ "sha256": "ab352b33693b8a4c88c0c0a977f12b30df9aa42bc163f73e59397939e397182a"
10
+ },
11
+ "entities": {
12
+ "names": 2125,
13
+ "legacy": 106
14
+ },
15
+ "derived": {
16
+ "name": "markdown-it-15.0.3.es2022.umd.rapier.min.js",
17
+ "bytes": 94470,
18
+ "sha256": "09d16498c075e83b0ba986dab07e83f0850f601f6f7551bd4aaf79d3167f7bc4"
19
+ }
20
+ }
21
+ ],
22
+ "tool": {
23
+ "name": "terser",
24
+ "version": "5.51.2",
25
+ "options": {
26
+ "ecma": 2022,
27
+ "compress": {
28
+ "passes": 2
29
+ },
30
+ "mangle": true,
31
+ "format": {
32
+ "comments": "/^!|@license|copyright/i"
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,136 @@
1
+ {
2
+ "format": "rapier-markdown-vendor/1",
3
+ "description": "Existing pinned parser and plugins; upstream bytes and license texts unchanged.",
4
+ "runtime": {
5
+ "path": "agent/vendor/markdown-runtime.mjs",
6
+ "prefix": "// MIT; exact embedded Rapier vendor source (tools/entities-vendor.mjs --write). See NOTICE.txt.\n// One lazy constructor serves named browser/worker imports and the default Node facade.\nlet owned = null;\nexport function markdownItConstructor() {\n if (!owned) {\nconst exports = {}; const module = {exports};\n",
7
+ "suffix": "\n owned = module.exports;\n }\n return owned;\n}\n",
8
+ "bodyBytes": 94470,
9
+ "bodySha256": "09d16498c075e83b0ba986dab07e83f0850f601f6f7551bd4aaf79d3167f7bc4"
10
+ },
11
+ "files": [
12
+ {
13
+ "path": "agent/vendor/markdown-runtime.mjs",
14
+ "bytes": 94829,
15
+ "sha256": "147b86b69ee4d0b1237a793b09300342e8c14d149c9e84bb0bea5ed2fa431998"
16
+ },
17
+ {
18
+ "path": "agent/vendor/markdown-plugins.mjs",
19
+ "bytes": 24196,
20
+ "sha256": "0081e0e557379cdf908b652124e82e2456e965af365a65464a610b867d350008"
21
+ },
22
+ {
23
+ "path": "agent/vendor/MARKDOWNIT.json",
24
+ "bytes": 18685,
25
+ "sha256": "2c42169e3233c6cb2b7e31cdefa83dde78e4ba05ed995805e749070db8c76ff4"
26
+ },
27
+ {
28
+ "path": "agent/vendor/BROWSER-ENTITIES.json",
29
+ "bytes": 1344,
30
+ "sha256": "9b2b9db3a8bfc2a90c54a703da8cd08c65eed62de85dc16fc334f59ed95347b8"
31
+ },
32
+ {
33
+ "path": "agent/vendor/markdown-plugins.json",
34
+ "bytes": 1585,
35
+ "sha256": "c52a02dd0946e150d4023199ccbd9f1afa93b008797ee5b2c325d9fcd249d4ee"
36
+ },
37
+ {
38
+ "path": "agent/vendor/NOTICE.txt",
39
+ "bytes": 2774,
40
+ "sha256": "05a252057f4eed3ba3b4149d404294f3a9bfb059f9bfde14d57128005acbe8ca"
41
+ },
42
+ {
43
+ "path": "agent/vendor/markdown-licenses/markdown-it-LICENSE.txt",
44
+ "bytes": 1073,
45
+ "sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
46
+ },
47
+ {
48
+ "path": "agent/vendor/markdown-licenses/entities-LICENSE.txt",
49
+ "bytes": 1260,
50
+ "sha256": "cb992345949ccd6e8394b2cd6c465f7b897c864f845937dbf64e8997f389e164"
51
+ },
52
+ {
53
+ "path": "agent/vendor/markdown-licenses/linkify-it-LICENSE.txt",
54
+ "bytes": 1058,
55
+ "sha256": "95e3f7f0e81e9b4940cdfaa1956aaff5e4dfd2fb1565041e7c78eb9a606f23e3"
56
+ },
57
+ {
58
+ "path": "agent/vendor/markdown-licenses/mdurl-LICENSE.txt",
59
+ "bytes": 2303,
60
+ "sha256": "6b6a356c4337e2446841f30f3cdf7e7023af8c5260b5e347c0f987b9f6aa2644"
61
+ },
62
+ {
63
+ "path": "agent/vendor/markdown-licenses/uc.micro-LICENSE.txt",
64
+ "bytes": 1077,
65
+ "sha256": "483acb265f182907d1caf6cff9c16c96f31325ed23792832cc5d8b12d5f88c8a"
66
+ },
67
+ {
68
+ "path": "agent/vendor/markdown-licenses/punycode.js-LICENSE-MIT.txt",
69
+ "bytes": 1077,
70
+ "sha256": "483acb265f182907d1caf6cff9c16c96f31325ed23792832cc5d8b12d5f88c8a"
71
+ }
72
+ ],
73
+ "licenses": [
74
+ {
75
+ "path": "agent/vendor/markdown-licenses/markdown-it-LICENSE.txt",
76
+ "source": {
77
+ "scope": "source",
78
+ "path": "LICENSE",
79
+ "bytes": 1073,
80
+ "sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
81
+ }
82
+ },
83
+ {
84
+ "path": "agent/vendor/markdown-licenses/entities-LICENSE.txt",
85
+ "source": {
86
+ "scope": "dependencies",
87
+ "path": "entities/LICENSE",
88
+ "bytes": 1260,
89
+ "sha256": "cb992345949ccd6e8394b2cd6c465f7b897c864f845937dbf64e8997f389e164"
90
+ }
91
+ },
92
+ {
93
+ "path": "agent/vendor/markdown-licenses/linkify-it-LICENSE.txt",
94
+ "source": {
95
+ "scope": "dependencies",
96
+ "path": "linkify-it/LICENSE",
97
+ "bytes": 1058,
98
+ "sha256": "95e3f7f0e81e9b4940cdfaa1956aaff5e4dfd2fb1565041e7c78eb9a606f23e3"
99
+ }
100
+ },
101
+ {
102
+ "path": "agent/vendor/markdown-licenses/mdurl-LICENSE.txt",
103
+ "source": {
104
+ "scope": "dependencies",
105
+ "path": "mdurl/LICENSE",
106
+ "bytes": 2303,
107
+ "sha256": "6b6a356c4337e2446841f30f3cdf7e7023af8c5260b5e347c0f987b9f6aa2644"
108
+ }
109
+ },
110
+ {
111
+ "path": "agent/vendor/markdown-licenses/uc.micro-LICENSE.txt",
112
+ "source": {
113
+ "scope": "dependencies",
114
+ "path": "uc.micro/LICENSE.txt",
115
+ "bytes": 1077,
116
+ "sha256": "483acb265f182907d1caf6cff9c16c96f31325ed23792832cc5d8b12d5f88c8a"
117
+ }
118
+ },
119
+ {
120
+ "path": "agent/vendor/markdown-licenses/punycode.js-LICENSE-MIT.txt",
121
+ "source": {
122
+ "scope": "dependencies",
123
+ "path": "punycode.js/LICENSE-MIT.txt",
124
+ "bytes": 1077,
125
+ "sha256": "483acb265f182907d1caf6cff9c16c96f31325ed23792832cc5d8b12d5f88c8a"
126
+ }
127
+ }
128
+ ],
129
+ "plugins": {
130
+ "path": "agent/vendor/markdown-plugins.mjs",
131
+ "prefix": "// Exact pinned plugin bodies; the caller supplies their runtime context. See NOTICE.txt and markdown-plugins.json.\nexport function createMarkdownPlugins(Math) {\nif (!Math || typeof Math.ceil !== 'function' || typeof Math.random !== 'function') throw new TypeError('Markdown plugins need a Math context.');\nconst root = {};\n{\nconst globalThis = root, window = root, global = root, self = root;\nconst exports = undefined, module = undefined, define = undefined;\n",
132
+ "suffix": "\n}\nreturn Object.freeze(root);\n}\n",
133
+ "bodyBytes": 23702,
134
+ "bodySha256": "78e105dbba1e97275141f92253b776a8261c18e20b78f3bf40a6d22873f6b100"
135
+ }
136
+ }