rapier-html 1.1.91 → 1.1.93

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/BUILD.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "package": "rapier-html",
3
- "version": "1.1.91",
3
+ "version": "1.1.93",
4
4
  "path": "dist/rapier.html",
5
- "bytes": 2322217,
6
- "sha256": "80bdd3c617f3869514e8eab6b4d7b15a7c78ac0b57ad658dda9d6c2f45a2e005",
7
- "builtAt": "2026-10-10T13:37:30.843Z",
5
+ "bytes": 2328188,
6
+ "sha256": "e4ae46d69c8b724026ff9cee44952049938b28b5f002e6b3eaa55e17e0dede34",
7
+ "builtAt": "2026-10-10T18:17:09.057Z",
8
8
  "node": "v22.23.3",
9
9
  "canonical": true,
10
10
  "packing": "zopfli",
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Turn Markdown into one offline HTML file with the full Rapier editor. It opens in any browser on a phone or
4
4
  computer, with no account. People read, edit, draw and paint watercolor. Agents deliver documents, show what
5
- changed and receive the person's edited copy through the door. Start with `npx rapier-html@1.1.91 notes.md`.
5
+ changed and receive the person's edited copy through the door. Start with `npx rapier-html@1.1.93 notes.md`.
6
6
 
7
7
  Use it for a plan to rearrange, an illustrated guide to annotate, a draft to continue writing, or a revision
8
8
  to review. Text and drawings stay editable, and the file remains usable independently of a hosted workspace.
@@ -18,14 +18,14 @@ to review. Text and drawings stay editable, and the file remains usable independ
18
18
  Node 22 or newer.
19
19
 
20
20
  ```sh
21
- npx -- rapier-html@1.1.91 notes.md # the editor, notes.md inside it, written beside the file
22
- npx -- rapier-html@1.1.91 notes.md --view draw # opens on Draw: sketch and paint, the document behind it
23
- npx -- rapier-html@1.1.91 notes.md --view notes # opens the Notes library
24
- npx -- rapier-html@1.1.91 notes.md --drawing sketch.svg # carries a drawing, opened on Draw over the document
25
- npx -- rapier-html@1.1.91 revised.md --compare original.md # opens showing what changed
26
- npx -- rapier-html@1.1.91 notes.md --return "$RETURN_URL" --return-expires-at "$RETURN_EXPIRES_AT" # Send back
27
- npx -- rapier-html@1.1.91 notes.md out.html # a named output
28
- npm install rapier-html@1.1.91 # as a library: wrap, unwrap
21
+ npx -- rapier-html@1.1.93 notes.md # the editor, notes.md inside it, written beside the file
22
+ npx -- rapier-html@1.1.93 notes.md --view draw # opens on Draw: sketch and paint, the document behind it
23
+ npx -- rapier-html@1.1.93 notes.md --view notes # opens the Notes library
24
+ npx -- rapier-html@1.1.93 notes.md --drawing sketch.svg # carries a drawing, opened on Draw over the document
25
+ npx -- rapier-html@1.1.93 revised.md --compare original.md # opens showing what changed
26
+ npx -- rapier-html@1.1.93 notes.md --return "$RETURN_URL" --return-expires-at "$RETURN_EXPIRES_AT" # Send back
27
+ npx -- rapier-html@1.1.93 notes.md out.html # a named output
28
+ npm install rapier-html@1.1.93 # as a library: wrap, unwrap
29
29
  ```
30
30
 
31
31
  The first `--` is for npm, so `--help` reaches the command. It never overwrites a file.
@@ -47,7 +47,7 @@ editor and lightweight reader (about 190 kB gzipped). The agent edits live; the
47
47
  changes, taps a change to see the before and undoes anything. Use `comparison.present` to show a diff deliberately.
48
48
 
49
49
  1. **Work together live.** Connect to `https://mcp.rapier.website/mcp`, then call `rapier.open` to share one document with the person.
50
- 2. **Deliver an offline editor.** Run `npx rapier-html@1.1.91 notes.md` to put the document and editor in one HTML file ([rapier-html](https://github.com/jackskip22/rapier-plugins/tree/main/npm/rapier-html)).
50
+ 2. **Deliver an offline editor.** Run `npx rapier-html@1.1.93 notes.md` to put the document and editor in one HTML file ([rapier-html](https://github.com/jackskip22/rapier-plugins/tree/main/npm/rapier-html)).
51
51
  3. **Embed in your app.** Install [rapier-embed](https://github.com/jackskip22/rapier-plugins/tree/main/npm/rapier-embed); mount the editor or reader, with your app's agent over WebMCP in the editor.
52
52
  4. **Keep portable Markdown.** Use [rapier-markdown-kit](https://github.com/jackskip22/rapier-plugins/tree/main/npm/rapier-markdown-kit) for pictures, editable SVG drawings and layout in one `.md` file. Respect [Will/1](https://github.com/jackskip22/will) `keep`, `append` and `edit` regions.
53
53
  5. **Encode JPEG XL.** Install [rapier-jxl](https://github.com/jackskip22/rapier-jxl) to encode pixels, photographs and existing JPEGs in JavaScript.
@@ -21,27 +21,33 @@ const K = new Uint32Array([
21
21
  0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
22
22
  0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2,
23
23
  ]);
24
- const rotate = (x, n) => (x >>> n) | (x << (32 - n));
24
+ // The rounds run on plain 32-bit locals: no array is made per block, so a megabyte (a painting's text) hashes about five times
25
+ // faster than through destructured arrays, with the same digest.
26
+ const W = new Int32Array(64);
25
27
  export function sha256(text) {
26
- const bytes = new TextEncoder().encode(text);
27
- const padded = new Uint8Array(Math.ceil((bytes.length + 9) / 64) * 64);
28
- padded.set(bytes); padded[bytes.length] = 0x80;
29
- const data = new DataView(padded.buffer), bits = bytes.length * 8;
30
- data.setUint32(padded.length - 8, Math.floor(bits / 0x100000000)); data.setUint32(padded.length - 4, bits >>> 0);
31
- const h = new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]), w = new Uint32Array(64);
32
- for (let offset = 0; offset < padded.length; offset += 64) {
33
- for (let i = 0; i < 16; i++) w[i] = data.getUint32(offset + i * 4);
28
+ const bytes = new TextEncoder().encode(text), length = bytes.length;
29
+ const padded = new Uint8Array(Math.ceil((length + 9) / 64) * 64), end = padded.length;
30
+ padded.set(bytes); padded[length] = 0x80;
31
+ const high = Math.floor(length * 8 / 0x100000000), low = (length * 8) >>> 0;
32
+ padded[end - 8] = high >>> 24; padded[end - 7] = high >>> 16; padded[end - 6] = high >>> 8; padded[end - 5] = high;
33
+ padded[end - 4] = low >>> 24; padded[end - 3] = low >>> 16; padded[end - 2] = low >>> 8; padded[end - 1] = low;
34
+ let h0 = 0x6a09e667 | 0, h1 = 0xbb67ae85 | 0, h2 = 0x3c6ef372 | 0, h3 = 0xa54ff53a | 0, h4 = 0x510e527f | 0, h5 = 0x9b05688c | 0, h6 = 0x1f83d9ab | 0, h7 = 0x5be0cd19 | 0;
35
+ const w = W;
36
+ for (let offset = 0; offset < end; offset += 64) {
37
+ for (let i = 0, j = offset; i < 16; i++, j += 4) w[i] = padded[j] << 24 | padded[j + 1] << 16 | padded[j + 2] << 8 | padded[j + 3];
34
38
  for (let i = 16; i < 64; i++) {
35
39
  const x = w[i - 15], y = w[i - 2];
36
- w[i] = w[i - 16] + (rotate(x, 7) ^ rotate(x, 18) ^ (x >>> 3)) + w[i - 7] + (rotate(y, 17) ^ rotate(y, 19) ^ (y >>> 10));
40
+ w[i] = (w[i - 16] + ((x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3) + w[i - 7] + ((y >>> 17 | y << 15) ^ (y >>> 19 | y << 13) ^ y >>> 10)) | 0;
37
41
  }
38
- let [a,b,c,d,e,f,g,k] = h;
42
+ let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, k = h7;
39
43
  for (let i = 0; i < 64; i++) {
40
- const t1 = (k + (rotate(e, 6) ^ rotate(e, 11) ^ rotate(e, 25)) + ((e & f) ^ (~e & g)) + K[i] + w[i]) >>> 0;
41
- const t2 = ((rotate(a, 2) ^ rotate(a, 13) ^ rotate(a, 22)) + ((a & b) ^ (a & c) ^ (b & c))) >>> 0;
42
- k = g; g = f; f = e; e = (d + t1) >>> 0; d = c; c = b; b = a; a = (t1 + t2) >>> 0;
44
+ const t1 = (k + ((e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7)) + (e & f ^ ~e & g) + K[i] + w[i]) | 0;
45
+ const t2 = (((a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10)) + (a & b ^ a & c ^ b & c)) | 0;
46
+ k = g; g = f; f = e; e = (d + t1) | 0; d = c; c = b; b = a; a = (t1 + t2) | 0;
43
47
  }
44
- for (const [i, value] of [a,b,c,d,e,f,g,k].entries()) h[i] += value;
48
+ h0 = (h0 + a) | 0; h1 = (h1 + b) | 0; h2 = (h2 + c) | 0; h3 = (h3 + d) | 0; h4 = (h4 + e) | 0; h5 = (h5 + f) | 0; h6 = (h6 + g) | 0; h7 = (h7 + k) | 0;
45
49
  }
46
- return [...h].map(x => x.toString(16).padStart(8, '0')).join('');
50
+ let out = '';
51
+ for (const x of [h0, h1, h2, h3, h4, h5, h6, h7]) out += (x >>> 0).toString(16).padStart(8, '0');
52
+ return out;
47
53
  }