@aiquants/markdown-explorer 0.24.0 → 0.25.0
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/CHANGELOG.md +45 -0
- package/README.md +25 -11
- package/dist/{EditSurface-CcWEczj3.js → EditSurface-Blymamic.js} +3 -3
- package/dist/{EditSurface-CRc4g0Qa.cjs → EditSurface-Co4Rvfa1.cjs} +1 -1
- package/dist/{ExplorerSplit-97SeIAOS.js → ExplorerSplit-BZ0PA3z3.js} +47 -47
- package/dist/{ExplorerSplit-ByxxXlgs.cjs → ExplorerSplit-WApgYMPb.cjs} +1 -1
- package/dist/{MultiLayout-CnbuAlxd.js → MultiLayout-B5-1N3JD.js} +3 -3
- package/dist/{MultiLayout-B_yMVDt_.cjs → MultiLayout-dAW_JCzg.cjs} +1 -1
- package/dist/{NativeScrollBar-BXdaM3EA.js → NativeScrollBar-BraWuZvN.js} +1 -1
- package/dist/{NativeScrollBar-D4a7fBOS.cjs → NativeScrollBar-ThVMbI0Y.cjs} +1 -1
- package/dist/{TreeLayout-C6QDpEBS.cjs → TreeLayout-C60lb9hP.cjs} +1 -1
- package/dist/{TreeLayout-BIQBKAkV.js → TreeLayout-CChoxh9W.js} +3 -3
- package/dist/core/labels.d.cts +3 -0
- package/dist/core/labels.d.ts +3 -0
- package/dist/core/textEncoding.d.cts +1 -0
- package/dist/core/textEncoding.d.ts +1 -0
- package/dist/index-B6FkGD-p.cjs +13 -0
- package/dist/{index-CeZDCyEl.js → index-Bd6hgisa.js} +546 -537
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/location-D3DgoELB.cjs +1 -0
- package/dist/{location-gXXmC7CQ.js → location-DIxIjqs7.js} +147 -140
- package/dist/{merge-DqjUgcV_.js → merge-CgSp-0Dd.js} +1 -1
- package/dist/{merge-QLktbpZY.cjs → merge-DRWmjC24.cjs} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +785 -725
- package/dist/{useSplitPersistence-Bmpb2prR.cjs → useSplitPersistence-D-T75Hlh.cjs} +1 -1
- package/dist/{useSplitPersistence-BPNjvuJi.js → useSplitPersistence-Df63lnQZ.js} +1 -1
- package/docs/behavior/layout.md +7 -4
- package/docs/behavior/localization.md +6 -3
- package/docs/behavior/security.md +7 -3
- package/docs/behavior/url-contract.md +3 -3
- package/package.json +3 -3
- package/dist/index-BwTVYkTR.cjs +0 -13
- package/dist/location-CasigkBk.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.25.0 (2026-10-27) — Open in a new tab names the encoding the explorer reads a file in
|
|
4
|
+
|
|
5
|
+
### Breaking
|
|
6
|
+
|
|
7
|
+
- **The `asset` port's `open` is called for a HEAD and before a range of the plain-text display (`&as=text`)**, to
|
|
8
|
+
read the first 64 KiB that name its `charset`: a HEAD opens them (as a range, or the whole file, cancelled after them,
|
|
9
|
+
when `size` is `null`), where it opened nothing, and a range opens them and then its own bytes, two calls in one
|
|
10
|
+
request. A host whose `open` can serve a file only once per request, or meters each call, must allow for it; one that
|
|
11
|
+
opens a fresh stream on every call, as `createFileSystemSource` does, needs no change.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **The plain-text display (`as=text`, a text or table file's Open in a new tab) names its `charset`**: it is
|
|
16
|
+
`text/plain; charset=<encoding>`, the encoding the explorer's one text rule reads the file's first 64 KiB in (a byte
|
|
17
|
+
order mark's, else UTF-8, else `legacyTextEncoding`, by the written name), where it was `text/plain; charset=utf-8`
|
|
18
|
+
whatever the file. A file in the legacy encoding (a Shift_JIS CSV, for example) now shows in the tab as the table and
|
|
19
|
+
the Source view read it, instead of garbled. The bytes are still sent as stored. A file whose text outside ASCII
|
|
20
|
+
starts past its first 64 KiB is named UTF-8 (Known limitations).
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **The plain-text display's ETag names the legacy encoding**: `"<legacy encoding>;<version>"` (the written name,
|
|
25
|
+
nothing when none is configured), so a copy a browser cached with the old `charset`, or before the configuration
|
|
26
|
+
changed, revalidates into a new answer instead of a 304 that keeps it. The stored file's ETag stays `"<version>"`.
|
|
27
|
+
- **The plain-text display reads the file's beginning before it answers**: a GET of the whole file opens it once and
|
|
28
|
+
sends the bytes read first, holding the host's chunks that carry the first 64 KiB until they are sent; a range
|
|
29
|
+
carries the `charset` of the file's beginning (see Breaking). A failure to read that beginning, and a beginning that
|
|
30
|
+
ends before the reported `size`, are answered `failed` (logged) before any header, where they broke the body after
|
|
31
|
+
the headers.
|
|
32
|
+
|
|
33
|
+
## 0.24.1 (2026-10-27) — An SVG image inside a document copies as an image, labelled in both languages
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- **The peer floor is `@aiquants/markdown` ^11.3.0**, whose SVG image toolbar copies the image as a PNG that pastes as
|
|
38
|
+
an image while the image shows (the source's Copy still copies the text) and puts the source in a `<code>`, so the
|
|
39
|
+
Zenn style's light colour scheme no longer paints it dark on dark.
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- Labels for the image's Copy: `viewerSvgImageCopyImage` («Copy the image» / 「画像をコピー」),
|
|
44
|
+
`viewerSvgImageCopiedImage` («Copied the image.» / 「画像をコピーしました。」) and `viewerSvgImageCopyImageFailed`
|
|
45
|
+
(«Could not copy the image.» / 「画像をコピーできませんでした。」), handed to the viewer's `svgImageCopyImage`,
|
|
46
|
+
`svgImageCopiedImage` and `svgImageCopyImageFailed`.
|
|
47
|
+
|
|
3
48
|
## 0.24.0 (2026-10-27) — Table files shown as tables: CSV, TSV and a workbook's first sheet
|
|
4
49
|
|
|
5
50
|
### Breaking
|
package/README.md
CHANGED
|
@@ -26,7 +26,8 @@ offers none. The choice is part of the URL
|
|
|
26
26
|
the tree and multi views carry it; another document opens rendered.
|
|
27
27
|
Inside a rendered document, a storage SVG image that stands alone in a paragraph gets its own Copy and Source toggle in
|
|
28
28
|
a toolbar above it, at the row's end: the toggle shows the image's SVG in its place through the same operation, and the
|
|
29
|
-
image again on a second press, and Copy copies that
|
|
29
|
+
image again on a second press, and Copy copies the image as a PNG that pastes as an image while the image shows, and the
|
|
30
|
+
SVG as written while the source shows.
|
|
30
31
|
A table file — a CSV or TSV file, or a workbook the host exports as one, such as a Google Sheets spreadsheet's first
|
|
31
32
|
sheet — shows as a read-only grid under its file header, named after the file: the browser reads the file itself in its
|
|
32
33
|
encoding (a byte order mark's, UTF-8 or the configured legacy encoding) and stops once the table holds as much as a
|
|
@@ -47,7 +48,7 @@ A single-view (embedding) page never downloads the tree and multi-panel views, w
|
|
|
47
48
|
|
|
48
49
|
- React 19.2.7 or later and React Router 8 in framework mode (route modules with `loader` / `headers`).
|
|
49
50
|
- Node.js 22.22 or later (the floor React Router 8 declares). The package ships ES modules and CommonJS; the CommonJS entries load the ESM-only `react-router` through `require(esm)`.
|
|
50
|
-
- The peer packages, at these versions or later within the caret ranges the package declares: `@aiquants/markdown` ^11.
|
|
51
|
+
- The peer packages, at these versions or later within the caret ranges the package declares: `@aiquants/markdown` ^11.3.0 (document rendering; the Source toggle of a storage SVG image that stands alone in a paragraph, read through `imageSource`, and a Copy that copies the image as a PNG image or its source, the source readable in every display style, a notice in place of a block that cannot render and plain text for a fence in a language it does not know; its components' stylesheet without utilities,
|
|
51
52
|
its controls' 44 px targets under every pointer, ```spreadsheets tables — inside list items and quotes too, and in a pane of their own (`layout="fill"`) never fewer than three rows — and their write-back through an editor that answers what came of each write (written, changed, a line that would close the fence, unwritable), reads a block's body back and tells them of its other changes,
|
|
52
53
|
the React-free `@aiquants/markdown/code-blocks` that names the `data-code-meta` the sanitizer keeps on `code`, holds the converter's reading of a fenced block's lines and the table labels with their placeholders,
|
|
53
54
|
its Mermaid labels and drawings that finish inside the document when a diagram's text changes or it unmounts mid-drawing, its math diagnostics, gantt sizing, embeds, link cards and their sizes, the React-free `@aiquants/markdown/embeds` the sanitizer worker loads and `@aiquants/markdown/source-lines` the editor and the sanitizer read, and the Node-only link-card handler of `@aiquants/markdown/server`, which needs Node.js 22.13 or later — below the explorer's own floor),
|
|
@@ -84,7 +85,8 @@ export const explorerConfig = defineExplorerConfig({
|
|
|
84
85
|
})
|
|
85
86
|
```
|
|
86
87
|
|
|
87
|
-
`defineExplorerConfig` validates everything once and returns a frozen value: mount paths, view slugs (`tree`, `multi`, `single` by default), the multi-view limits (`maxPanels` 12, `columns` 4), Expand all's budget per press (`maxFolders` 500, `maxDepth` 16), the deepest document the reader's reveal opens folders for (`maxDepth` 16), the document styles, the iframe host allow-list, the embeds and link cards, the reader's default tree settings, the legacy text encoding and a table file's byte budget.
|
|
88
|
+
`defineExplorerConfig` validates everything once and returns a frozen value: mount paths, view slugs (`tree`, `multi`, `single` by default), the multi-view limits (`maxPanels` 12, `columns` 4), Expand all's budget per press (`maxFolders` 500, `maxDepth` 16), the deepest document the reader's reveal opens folders for (`maxDepth` 16), the document styles, the iframe host allow-list, the embeds and link cards, the reader's default tree settings, the legacy text encoding and a table file's byte budget.
|
|
89
|
+
A mistake throws at startup instead of producing links that point nowhere, a key that is not an option (a misspelled `legacyEncoding`, a singular `spreadsheet`) included: it throws a `RangeError` naming it instead of leaving the option it meant at its default.
|
|
88
90
|
The source ids are not part of it: they are the ids of the server's `sources` (a runtime setting of the server), and the browser learns them from the page data. `withExplorerSources(config, sourceIds)` joins them to the configuration where the URL codec needs them (see [Views and URLs](#views-and-urls)).
|
|
89
91
|
|
|
90
92
|
| Option | Type | Purpose |
|
|
@@ -444,8 +446,10 @@ The deny rules are checked on the document's path only: a parser that expands in
|
|
|
444
446
|
A spreadsheet document shows its file under the file header (its name; Open in a new tab, which shows the file as plain text; Download) as a read-only table: `@aiquants/markdown`'s table block — the grid of `@aiquants/spreadsheet`, with its zoom, copy, save as TSV and full screen —, named after the file, in the UI language and the explorer's colour scheme, filling a page pane (the block's `fill` layout, never fewer than three rows at the grid's zoom) and taking the height of its rows in a multi-view panel.
|
|
445
447
|
The file's notes and its table share one scroller under the file header, the document's scroller: in a page pane the table fills what the notes leave, and the body scrolls only when the pane is shorter than the file header, the notes, the stage's padding and the table block at its fewest — its toolbar and notice line and those three rows (at a 400 % zoom, for example).
|
|
446
448
|
|
|
447
|
-
- **Reading**: the browser reads the file itself, through the asset's plain-text delivery (`&as=text`: one request on the page's origin, never redirected to the storage), as a stream. At looks that each wait for twice the bytes the one before saw (the first after 64 KiB) it makes the table of what it has, so the looks together parse less than twice the bytes read, and it stops reading — cancelling the rest of the request — once the cell budget refuses a row (the 100,000 cells a grid operates on at once, `SPREADSHEET_MAX_OPERATION_CELLS`)
|
|
448
|
-
|
|
449
|
+
- **Reading**: the browser reads the file itself, through the asset's plain-text delivery (`&as=text`: one request on the page's origin, never redirected to the storage), as a stream. At looks that each wait for twice the bytes the one before saw (the first after 64 KiB) it makes the table of what it has, so the looks together parse less than twice the bytes read, and it stops reading — cancelling the rest of the request — once the cell budget refuses a row (the 100,000 cells a grid operates on at once, `SPREADSHEET_MAX_OPERATION_CELLS`)
|
|
450
|
+
or the bytes reach `spreadsheets.maxBytes` (default 2 MiB);
|
|
451
|
+
columns past the 1,000th are left out, so the widest table still shows 100 rows, and a cell keeps at most the 32,767 characters a cell of Excel holds, so one long cell cannot stall the grid's layout. A file read partway yields only the rows the rest of it cannot change — every row a line break ends, up to a quoted cell the bytes read do not close —, so the rows shown are always the file's first rows, wherever the reading stopped.
|
|
452
|
+
A table that is not the whole file says so above it (the label `spreadsheetTruncated`), and a file in whose first `spreadsheets.maxBytes` no row ends — its first row runs past them, or, in a TSV, a quote that opens in it closes nowhere within them — shows a note that it cannot be shown as a table (`spreadsheetLongRow`), with the download.
|
|
449
453
|
- **Text**: the bytes are read by the explorer's one rule: the encoding a byte order mark names (UTF-8, UTF-16LE or UTF-16BE), else UTF-8, else the configuration's `legacyTextEncoding` (for example `Shift_JIS`, in which a Japanese spreadsheet application writes CSV), each strictly and never guessed, and decided on the bytes read when the reading stops: a file that is UTF-8 up to there shows as UTF-8 even if a later byte is not. Bytes none of them reads show a note naming the encodings tried by their written names (`spreadsheetUnreadableEncoding`:
|
|
450
454
|
the one a byte order mark names, or UTF-8 and the legacy encoding), text holding NUL a note that the file is not text (`spreadsheetNotText`), each with the download, and a file without data — read whole, its cells, taken whole within the budget, all empty, or none at all — a note that it has no data (`spreadsheetEmpty`; a file whose empty cells run past the budget shows them as a table that is only part of the file).
|
|
451
455
|
- **Rows**: CSV by RFC 4180 — rows end at CRLF, LF or CR; a cell that starts with `"` is quoted and holds commas and line breaks, `""` standing for one `"`; the text after its closing quote joins the cell up to the next comma or line break, as Excel reads it; a quote that never closes holds the rest of the file — and TSV by `@aiquants/spreadsheet`'s grammar, the one a ```spreadsheets block reads. Rows of different widths are padded with empty cells.
|
|
@@ -538,7 +542,8 @@ Names the tree cannot carry — not in NFC, with a colon, ending in a dot or a s
|
|
|
538
542
|
|
|
539
543
|
Any other option key (a misspelt limit, an option this source does not have) throws a `TypeError` naming it when the source is created, instead of being ignored.
|
|
540
544
|
|
|
541
|
-
A host's own sources read text by the same rule through the exports of `@aiquants/markdown-explorer/server`: `legacyTextEncodingOf(label)` (a label's written name, or a `RangeError` for a label that cannot name the legacy encoding), `decodeText(bytes, complete, legacyEncoding)` (strict: the text, or `null` when no encoding of the rule reads the bytes) and `decodeTextLeniently(bytes, complete, legacyEncoding)` (the first encoding tried, with U+FFFD, when none reads them).
|
|
545
|
+
A host's own sources read text by the same rule through the exports of `@aiquants/markdown-explorer/server`: `legacyTextEncodingOf(label)` (a label's written name, or a `RangeError` for a label that cannot name the legacy encoding), `decodeText(bytes, complete, legacyEncoding)` (strict: the text, or `null` when no encoding of the rule reads the bytes) and `decodeTextLeniently(bytes, complete, legacyEncoding)` (the first encoding tried, with U+FFFD, when none reads them).
|
|
546
|
+
`legacyEncoding` is a label `legacyTextEncodingOf` accepts, or `null` for none — the resolved configuration's `legacyTextEncoding` as it is —, and the decoders refuse the labels it refuses with the same `RangeError`. `complete` says the bytes are the whole file; otherwise a character their end cut is left out, and bytes that end within a byte order mark read nothing yet.
|
|
542
547
|
|
|
543
548
|
The source's `document(context, path, readPath)` reads the file `readPath` names and shows it as `path` (its parser receives `path`); every other kind (image, media, text, file) reports the file's version, `<size>-<mtimeNs>`, and an image its `imageType`: `"svg"` for the `.svg` extension, the one its `asset` serves as `image/svg+xml`, and `"raster"` for the other image extensions. A file of an unknown extension, and a text file whose decoded preview holds NUL, is a `file` document.
|
|
544
549
|
The source's `ancestors(context, path, readPath)` answers the folders down to the file `readPath` names from its path prefixes (`<prefix>a` and `<prefix>a/b` for `<prefix>a/b/c.md`, `[]` for a file at the top level), which are exactly its tree's row paths, and `null` for any path its walk would not list (outside the prefix, missing, not a regular file, denied, or reached through a symbolic link). A wrapper that turns a folder lazy (as the demo's `withLazyFolder` does) keeps it, because the row paths do not change.
|
|
@@ -572,7 +577,8 @@ export const explorer = createMarkdownExplorer({
|
|
|
572
577
|
### Serving files
|
|
573
578
|
|
|
574
579
|
The explorer serves every file it shows or offers for download itself, through the `asset` operation of its data route: `<dataPath>/asset?path=<document path>[&v=<version>][&as=text]` (GET and HEAD; see [URL contract](docs/behavior/url-contract.md#asset-urls)).
|
|
575
|
-
Images, audio, video and PDF are shown in place; every other file (Markdown, text, table files, workbooks, anything else) is delivered as a download, except that `&as=text` asks for any file as
|
|
580
|
+
Images, audio, video and PDF are shown in place; every other file (Markdown, text, table files, workbooks, anything else) is delivered as a download, except that `&as=text` asks for any file as plain text shown in place (`text/plain; charset=<encoding>`, the encoding the explorer's one text rule reads the file's first 64 KiB in, under the same `nosniff` and sandboxing policy).
|
|
581
|
+
That is where a text viewer's Open in a new tab goes, since a browser downloads Markdown or cannot show it, and what a table file's preview reads (one request on the page's origin, since the operation reads the bytes itself and never redirects).
|
|
576
582
|
The host supplies only the bytes, through the `asset` port:
|
|
577
583
|
|
|
578
584
|
| `ExplorerAssetFile` field | Type | Meaning |
|
|
@@ -580,8 +586,8 @@ The host supplies only the bytes, through the `asset` port:
|
|
|
580
586
|
| `name` | `string` | The name offered when the file is saved (not empty; it may contain `/`, the explorer percent-encodes it). |
|
|
581
587
|
| `contentType` | `string` | The media type the storage declares, `""` when unknown (answered as a download, never guessed from the name). |
|
|
582
588
|
| `size` | `number \| null` | The length in bytes, `null` when the storage cannot tell (then the response has no `Content-Length` and no ranges). |
|
|
583
|
-
| `version` | `string` | An opaque validator (1 to 256 visible ASCII characters other than `"`), sent as the ETag; the same `version` the `document` port reports for the file. |
|
|
584
|
-
| `open` | `(range: ExplorerByteRange \| null) => Promise<ReadableStream<Uint8Array>>` | Opens the bytes of `range` (`{ offset, length }`, or `null` for the whole file) of the file `version` and `size` describe (when the storage can tell that the file has changed since the port found it, refuse rather than open other bytes); called at most once per request, never for HEAD, 304, 416 or an empty file. Abort with the `context.signal` the port received; throw `ExplorerError` to refuse. |
|
|
589
|
+
| `version` | `string` | An opaque validator (1 to 256 visible ASCII characters other than `"`), sent as the ETag (behind the legacy encoding for `&as=text`); the same `version` the `document` port reports for the file. |
|
|
590
|
+
| `open` | `(range: ExplorerByteRange \| null) => Promise<ReadableStream<Uint8Array>>` | Opens the bytes of `range` (`{ offset, length }`, or `null` for the whole file) of the file `version` and `size` describe (when the storage can tell that the file has changed since the port found it, refuse rather than open other bytes); called at most once per request, never for HEAD, 304, 416 or an empty file — except that `&as=text` also opens the file for a HEAD and before a range, to read the first 64 KiB that name its `charset` (those bytes as a range, or the whole file, cancelled after them, when `size` is `null`). Abort with the `context.signal` the port received; throw `ExplorerError` to refuse. |
|
|
585
591
|
|
|
586
592
|
The port serves any regular file the document admission admits, whatever its kind; a malformed answer is logged and answered `failed`. The explorer decides everything else, in this order:
|
|
587
593
|
|
|
@@ -607,7 +613,15 @@ Every 200, 206 and 304 carries the declared type as a browser parses it (the las
|
|
|
607
613
|
`Cross-Origin-Resource-Policy: same-origin` on every type;
|
|
608
614
|
and `Cache-Control: private, max-age=60, stale-while-revalidate=600, no-transform` with `Vary: Cookie`. Failures are the data route's JSON failures with its statuses (400, 401, 403, 404, 413, 500).
|
|
609
615
|
The body of a 200 or 206 with a `Content-Length` carries exactly that many bytes: the explorer drops the bytes past it and cancels the stream `open` returned, and fails the response when that stream ends short, so a file that changes while it is served never gets a body that disagrees with its length and ETag.
|
|
610
|
-
|
|
616
|
+
`&as=text` answers by the same table, with these differences:
|
|
617
|
+
|
|
618
|
+
- Every 200, 206 and 304 carries `Content-Disposition: inline; filename*=UTF-8''<name>`, the sandboxing policy, `nosniff` and same-origin CORP, whatever the declared type.
|
|
619
|
+
- The `Content-Type` is `text/plain; charset=<encoding>`: the encoding's written name as the explorer's one text rule (see the `text` operation below) reads the file's first 64 KiB, so a browser shows a file in `legacyTextEncoding` as the explorer's own views read it. A file whose first 64 KiB are ASCII alone is named UTF-8, and an empty file is UTF-8. The bytes are sent as stored, never converted.
|
|
620
|
+
- The ETag is `"<legacy encoding>;<version>"`: the configuration's `legacyTextEncoding` (its written name, nothing when it is `null`), `;`, and the version. A change of either is a new validator, so a copy a browser cached before a change of the configuration revalidates into the new `charset`, never into a 304 that keeps the old one.
|
|
621
|
+
- A GET of the whole file opens it once and sends the bytes read to name the encoding first; a HEAD and a range read the first 64 KiB on their own (a range then opens its own bytes), so a ranged part carries the `charset` of the file's beginning.
|
|
622
|
+
The server holds the host's chunks that carry those 64 KiB until they are sent, and a beginning that ends before `size` is answered `failed` (logged) before any header, rather than with a body that breaks.
|
|
623
|
+
|
|
624
|
+
The URL carries the path in its query, so no name needs an extra escape and the request's own path never ends in `.data`; a document's URL carries `v=<version>` as a cache-buster, which the server never reads (the ETag always names the current version).
|
|
611
625
|
|
|
612
626
|
The data route's `text` operation reads a file through the same port for the Source toggles (the document bar's — a Markdown document, an SVG image, a table file — and that of an SVG image inside a rendered document) and that image's Copy:
|
|
613
627
|
`<dataPath>/text?path=<document path>` (GET and HEAD) takes the same authentication, deny rules (a refusal logged once with the operation `text`) and admission as `asset`, then answers JSON like a document request — status 200 with a text document (`name`, `text`, `truncated`, and the file's asset `url` with its version) or a failure document, and the reader's scope header.
|
|
@@ -925,7 +939,7 @@ Tests and host styling may rely on the `data-testid` and `data-aqmx-*` attribute
|
|
|
925
939
|
a UTF-8 file with a few stray bytes shows the encoding note instead of a table (or, with a legacy encoding configured, is read in that encoding). The encoding is decided on the bytes each view reads, so the table and the Source view of a file whose encoding changes past where one of them stopped reading may read it differently.
|
|
926
940
|
- A TSV file read partway shows only the rows before the first cell that opens a quote the bytes read do not close (a lone `"` used as a ditto mark, for example), since the rest of the file could still close it: a TSV larger than `spreadsheets.maxBytes` with such a cell near its start shows only the rows above it — or, with no row above it, the note that no row ends within the part read (`spreadsheetLongRow`) —, where read whole it shows every row (an unclosed quote is literal in a whole TSV). A CSV is not affected (an unclosed quote holds the rest of a whole CSV too).
|
|
927
941
|
- Text is decoded by the runtime's `TextDecoder`, and runtimes answer a few bytes differently from the Encoding Standard: Node refuses the byte 0x80 in Shift_JIS (the standard reads it as U+0080) and reads it as U+0080 in Big5 and EUC-KR (the standard refuses it). A file holding such a byte can therefore show as a table in the browser while its Source, read on the server, falls back to the first encoding tried with U+FFFD, or the other way round.
|
|
928
|
-
- Open in a new tab
|
|
942
|
+
- Open in a new tab (`as=text`) names its `charset` from a file's first 64 KiB, which the server reads before it answers: a file whose text outside ASCII starts past them is named UTF-8 there, and text in the legacy encoding past that point shows garbled in the tab, while the explorer's own views decide on the bytes they read (a table on what it reads, a Source view on its first `textMaxBytes`).
|
|
929
943
|
- HTML larger than `sanitizer.maxHtmlBytes` (4 MiB), placed deeper than 512 levels while it is parsed, making the parser create more elements than it has characters, more nodes than the worker's heap holds (81,920 elements, attributes and comments by default) or more than 4,096 comments, holding a tag with more than 1,024 attributes (counted before parsing for every `<` or `</` followed by a letter, so text in a script, a comment or an attribute value that looks like such a tag counts too), giving `html` or `body` more than 1,024 attributes through repeated tags,
|
|
930
944
|
carrying attributes whose characters, counting every copy of a reopened formatting element, exceed `maxHtmlBytes`, sanitizing to HTML longer than four characters per byte of `maxHtmlBytes`, or not sanitized within `sanitizer.deadlineMs` (30 s) shows as `too-large`.
|
|
931
945
|
- All anonymous readers share one scope, so they share the admission budget as well as the running share: with `anonymousAccess`, the `jobsPerScope` documents running or waiting are counted for all visitors together, and panels beyond that budget come back `failed` until a reload or "Try again". For a public deployment, set `jobsPerScope` to the number of visitors expected to open a multi view at the same moment times `multiView.maxPanels`; `maxQueuedJobs` then defaults to four times that.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as R, jsxs as le } from "react/jsx-runtime";
|
|
2
2
|
import { useState as te, useRef as D, useLayoutEffect as B, useEffectEvent as ve, useEffect as Pe, useImperativeHandle as je, useMemo as J, startTransition as Ye, useCallback as X, useId as Je } from "react";
|
|
3
|
-
import { v as ne, g as me, h as Qe, u as se, i as Ze, l as et, j as tt, k as De, m as nt, n as rt, o as ot, p as it, E as lt, q as st, s as ct, t as at, w as we, x as be, A as ut, y as Ee, z as dt, B as ft, G as mt, H as pt } from "./index-
|
|
3
|
+
import { v as ne, g as me, h as Qe, u as se, i as Ze, l as et, j as tt, k as De, m as nt, n as rt, o as ot, p as it, E as lt, q as st, s as ct, t as at, w as we, x as be, A as ut, y as Ee, z as dt, B as ft, G as mt, H as pt } from "./index-Bd6hgisa.js";
|
|
4
4
|
import { fencedBodyAsRead as ht, planFencedBodyEdit as gt, fencedCodeLanguageOf as vt, SPREADSHEETS_LANGUAGE as wt, readFencedLine as bt, listItemWidthOn as Et, openingFenceOn as xt } from "@aiquants/markdown/code-blocks";
|
|
5
5
|
import { history as St, historyKeymap as yt, defaultKeymap as kt, historyField as Tt, redo as At, undo as It, isolateHistory as Lt } from "@codemirror/commands";
|
|
6
6
|
import { markdown as Ct, markdownLanguage as Ot } from "@codemirror/lang-markdown";
|
|
@@ -15,8 +15,8 @@ import { d as Xt, f as re, E as jt } from "./dataRoute-BEvesOvN.js";
|
|
|
15
15
|
import { H as Yt, c as Jt, M as Qt } from "./sanitizePolicy-gVKBhabq.js";
|
|
16
16
|
import Zt from "isomorphic-dompurify";
|
|
17
17
|
import { PanelGroup as en, Panel as xe, PanelResizeHandle as tn } from "@aiquants/resize-panels";
|
|
18
|
-
import { C as nn, F as rn, E as on, a as ln, b as oe, d as sn } from "./location-
|
|
19
|
-
import { u as cn, a as an } from "./useSplitPersistence-
|
|
18
|
+
import { C as nn, F as rn, E as on, a as ln, b as oe, d as sn } from "./location-DIxIjqs7.js";
|
|
19
|
+
import { u as cn, a as an } from "./useSplitPersistence-Df63lnQZ.js";
|
|
20
20
|
const ze = { history: Tt }, un = Rt.define([
|
|
21
21
|
{ tag: [N.heading1, N.heading2, N.heading3, N.heading4, N.heading5, N.heading6, N.heading], color: "var(--aqmx-syntax-heading)", fontWeight: "700" },
|
|
22
22
|
{ tag: N.strong, fontWeight: "700" },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),h=require("react"),y=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),h=require("react"),y=require("./index-B6FkGD-p.cjs"),J=require("@aiquants/markdown/code-blocks"),K=require("@codemirror/commands"),pe=require("@codemirror/lang-markdown"),oe=require("@codemirror/language"),ge=require("@codemirror/search"),$=require("@codemirror/state"),P=require("@codemirror/view"),V=require("@lezer/highlight"),je=require("@aiquants/markdown"),ue=require("@aiquants/markdown/source-lines"),ee=require("./dataRoute-Cv7fgCW7.cjs"),de=require("./sanitizePolicy-CZwOaJ92.cjs"),ze=require("isomorphic-dompurify"),se=require("@aiquants/resize-panels"),X=require("./location-D3DgoELB.cjs"),ve=require("./useSplitPersistence-D-T75Hlh.cjs"),qe={history:K.historyField},Fe=oe.HighlightStyle.define([{tag:[V.tags.heading1,V.tags.heading2,V.tags.heading3,V.tags.heading4,V.tags.heading5,V.tags.heading6,V.tags.heading],color:"var(--aqmx-syntax-heading)",fontWeight:"700"},{tag:V.tags.strong,fontWeight:"700"},{tag:V.tags.emphasis,fontStyle:"italic"},{tag:V.tags.strikethrough,textDecoration:"line-through"},{tag:V.tags.link,color:"var(--aqmx-syntax-link)",textDecoration:"underline"},{tag:V.tags.url,color:"var(--aqmx-syntax-url)"},{tag:V.tags.monospace,color:"var(--aqmx-syntax-code)"},{tag:V.tags.quote,color:"var(--aqmx-syntax-quote)"},{tag:[V.tags.processingInstruction,V.tags.contentSeparator,V.tags.labelName,V.tags.meta],color:"var(--aqmx-syntax-mark)"}]),Ue=P.EditorView.theme({"&":{height:"100%",color:"var(--aqmx-text)",backgroundColor:"var(--aqmx-surface)",fontSize:"var(--aqmx-font-size-title)"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',lineHeight:"var(--aqmx-line-height-prose)"},".cm-content":{caretColor:"var(--aqmx-text)",paddingBlock:"var(--aqmx-space-6)"},".cm-line":{paddingInline:"var(--aqmx-space-6)"},"&.cm-focused .cm-cursor":{borderLeftColor:"var(--aqmx-text)"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--aqmx-editor-selection)"},".cm-activeLine":{backgroundColor:"var(--aqmx-editor-active-line)"},".cm-gutters":{backgroundColor:"var(--aqmx-surface-raised)",color:"var(--aqmx-editor-gutter)",borderInlineEnd:"var(--aqmx-space-1) solid var(--aqmx-border)"},".cm-activeLineGutter":{backgroundColor:"var(--aqmx-editor-active-line)"},".cm-searchMatch":{outline:"var(--aqmx-space-1) solid var(--aqmx-border-strong)"},".cm-panels":{backgroundColor:"var(--aqmx-surface-raised)",color:"var(--aqmx-text)"}}),Me="data-aqmx-conflict-actions",Ge=P.Decoration.line({attributes:{"data-aqmx-conflict-line":"marker"}}),We=P.Decoration.line({attributes:{"data-aqmx-conflict-line":"ours"}}),Xe=P.Decoration.line({attributes:{"data-aqmx-conflict-line":"theirs"}});class $e extends P.WidgetType{constructor(t,n){super(),this.index=t,this.labels=n}index;labels;eq(t){return t.index===this.index&&t.labels===this.labels}toDOM(t){const n=document.createElement("div");n.setAttribute(Me,String(this.index));for(const[r,i]of[["ours",this.labels.useOurs],["theirs",this.labels.useTheirs],["both",this.labels.keepBoth]]){const o=document.createElement("button");o.type="button",o.textContent=i,o.setAttribute("data-aqmx-conflict-choice",r),o.addEventListener("mousedown",l=>l.preventDefault()),o.addEventListener("click",()=>{const l=re(t.state.doc)[this.index];l!==void 0&&(_e(t,l,r),t.focus())}),n.append(o)}return n}ignoreEvent(){return!0}}const re=e=>y.findConflictsInLines(e.iterLines()),we=(e,t)=>{const n=new $.RangeSetBuilder;return re(e).forEach((r,i)=>{const o=e.line(r.start);n.add(o.from,o.from,P.Decoration.widget({widget:new $e(i,t),block:!0,side:-1}));for(let l=r.start;l<=r.end;l+=1){const s=e.line(l).from,d=l===r.start||l===r.separator||l===r.end?Ge:l<r.separator?We:Xe;n.add(s,s,d)}}),n.finish()},Ke=e=>$.StateField.define({create:t=>we(t.doc,e),update:(t,n)=>n.docChanged?we(n.state.doc,e):t,provide:t=>P.EditorView.decorations.from(t)}),_e=(e,t,n)=>{const{doc:r}=e.state,i=(k,c)=>{const E=[];for(let u=k;u<=c;u+=1)E.push(r.line(u).text);return E},o=i(t.start+1,t.separator-1),l=i(t.separator+1,t.end-1),s=n==="ours"?o:n==="theirs"?l:[...o,...l];let d=r.line(t.start).from,f=r.line(t.end).to;s.length===0&&(t.end<r.lines?f+=1:t.start>1&&(d-=1));const p=s.join(`
|
|
2
2
|
`);e.dispatch({changes:{from:d,to:f,insert:p},selection:$.EditorSelection.cursor(d),scrollIntoView:!0,userEvent:"input.resolve"})},Ee="input.preview",Ye=20,Je=P.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.schedule()}view;cancel=null;update(e){e.docChanged&&this.schedule()}schedule(){if(this.cancel!==null||oe.syntaxTreeAvailable(this.view.state))return;const e=this.view.dom.ownerDocument.defaultView;if(e===null)return;const t=()=>{this.cancel=null,oe.ensureSyntaxTree(this.view.state,this.view.state.doc.length,Ye),this.schedule()};if(typeof e.requestIdleCallback=="function"){const n=e.requestIdleCallback(t);this.cancel=()=>e.cancelIdleCallback(n)}else{const n=e.setTimeout(t,0);this.cancel=()=>e.clearTimeout(n)}}destroy(){this.cancel?.(),this.cancel=null}}),Qe=/`{3,}|~{3,}/u,te=Object.freeze({kind:"absent"}),ce=Object.freeze({kind:"unreadable"}),Ze=(e,t,n)=>{const r=[];for(let d=t.parent;d!==null;d=d.parent)(d.name==="Blockquote"||d.name==="ListItem")&&r.unshift(d);const i=[],o=[],l=d=>{const f=o.indexOf(d);return f===-1?o.length:f};for(const d of r){const f=e.lineAt(d.from).number;if(d.name==="ListItem"){const p=J.listItemWidthOn(e.line(f).text,i,l(f));if(p===null)return null;i.push({kind:"listItem",width:p})}else i.push({kind:"quote"});o.push(f)}const s=J.openingFenceOn(n.text,i,l(n.number));return s===null?null:{containers:i,...s}},et=(e,t)=>{const{doc:n}=e;let r=n.lineAt(t).to;for(;;){const i=oe.ensureSyntaxTree(e,r,Number.POSITIVE_INFINITY);if(i===null)return null;const o=i.resolveInner(t,1),l=o.parent;if(o.name!=="CodeMark"||l===null||l.name!=="FencedCode"||l.from!==o.from)return null;if(l.to<r||r>=n.length)return l;r=Math.min(n.length,l.to+Math.max(l.to-t,1))}},be=(e,t)=>{const{doc:n}=e;if(!Number.isInteger(t)||t<1||t>n.lines)return te;const r=n.line(t),i=Qe.exec(r.text);if(i===null)return te;const o=et(e,r.from+i.index);if(o===null)return te;const l=o.getChild("CodeInfo");if(l===null)return te;const s=J.fencedCodeLanguageOf(n.sliceString(l.from,l.to));if(s===null)return ce;if(s!==J.SPREADSHEETS_LANGUAGE)return te;const d=Ze(n,o,r);if(d===null)return ce;const[,...f]=o.getChildren("CodeMark"),p=f.at(-1),k=p===void 0?n.lineAt(o.to).number:n.lineAt(p.from).number-1,c=[];let E="";for(let u=t+1;u<=k;u+=1){const m=n.line(u).text,v=J.readFencedLine(m,d);if(v===null)return ce;c.push(m),E+=u<n.lines?`${v.content}
|
|
3
3
|
`:v.content}return{kind:"found",firstLine:t+1,lines:c,layout:d,body:E}},tt=({parent:e,scroll:t,text:n,saved:r,labels:i,revisions:o,onChange:l,onGeometry:s,onSave:d})=>{let f=!1;const p=[P.EditorView.scrollHandler.of((u,m,v)=>(nt(u,m.head,v,t),!0)),P.lineNumbers(),P.highlightActiveLineGutter(),K.history(),P.drawSelection(),P.highlightActiveLine(),ge.highlightSelectionMatches(),P.EditorView.lineWrapping,pe.markdown({base:pe.markdownLanguage}),Je,oe.syntaxHighlighting(Fe),Ke(i),P.keymap.of([{key:"Mod-s",preventDefault:!0,run:()=>(d(),!0)},...ge.searchKeymap,...K.historyKeymap,...K.defaultKeymap]),P.EditorView.contentAttributes.of({"aria-label":i.editor,"aria-multiline":"true"}),P.EditorView.updateListener.of(u=>{for(const m of u.transactions)m.docChanged&&o.record(m.changes,m.newDoc);u.docChanged&&l(u.transactions.every(m=>!m.docChanged||m.isUserEvent(Ee))),(u.docChanged||u.heightChanged||u.geometryChanged)&&s(u.docChanged&&!f)}),Ue],k=st(r,p)??$.EditorState.create({doc:n,extensions:p}),c=new P.EditorView({state:k,parent:e});o.mount(c.state.doc);const E=u=>{f=!0;try{u()}finally{f=!1}};return{text:()=>c.state.doc.toString(),replaceText:u=>{const m=c.state.doc.toString();if(m===u)return;let v=0;const S=Math.min(m.length,u.length);for(;v<S&&m.charCodeAt(v)===u.charCodeAt(v);)v+=1;let g=0;for(;g<S-v&&m.charCodeAt(m.length-1-g)===u.charCodeAt(u.length-1-g);)g+=1;c.dispatch({changes:{from:v,to:m.length-g,insert:u.slice(v,u.length-g)},userEvent:"input.replace"})},replaceBody:(u,m,v,S)=>{const{doc:g}=c.state,L=o.lineOf(S,u);if(L===null)return"changed";const O=be(c.state,L);if(O.kind==="absent")return"changed";if(O.kind==="unreadable")return"unwritable";if(O.body!==J.fencedBodyAsRead(m,O.layout))return"changed";const I=J.planFencedBodyEdit(O.lines,O.layout,v);if(I.kind!=="edit")return I.kind;if(I.from===I.to&&I.lines.length===0)return"written";const D=j=>{const H=O.firstLine+j;return H<=g.lines?g.line(H).from:g.length},M=D(I.from),B=`${M===g.length&&g.sliceString(g.length-1)!==`
|
|
4
4
|
`?`
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as m, jsxs as L, Fragment as Qe } from "react/jsx-runtime";
|
|
2
|
-
import { u as $, p as kt, Q as Pe, M as Je, R as At, y as Oe, S as Lt, T as Pt, k as Ot, U as qt, V as Ct, W as Ft } from "./index-
|
|
2
|
+
import { u as $, p as kt, Q as Pe, M as Je, R as At, y as Oe, S as Lt, T as Pt, k as Ot, U as qt, V as Ct, W as Ft } from "./index-Bd6hgisa.js";
|
|
3
3
|
import * as f from "react";
|
|
4
4
|
import { use as ye, createContext as qe, useState as F, useCallback as w, useMemo as C, useRef as E, useLayoutEffect as H, useEffect as D, useSyncExternalStore as Ce, Suspense as et, useId as Re } from "react";
|
|
5
|
-
import { s as Mt,
|
|
5
|
+
import { s as Mt, u as _t, v as tt, x as It, y as Dt, z as Ht, C as $t, F as Zt, A as Ve, B as Bt, D as zt, b as Ee, G as Vt } from "./location-DIxIjqs7.js";
|
|
6
6
|
import { useDirectoryTreeState as jt, DirectoryTree as Kt } from "@aiquants/directory-tree";
|
|
7
|
-
import { T as
|
|
8
|
-
import { s as
|
|
9
|
-
import { PanelGroup as
|
|
10
|
-
import { a as Yt, u as Qt } from "./useSplitPersistence-
|
|
7
|
+
import { T as Gt } from "./tapScrollCircle-u4EXeLhx.js";
|
|
8
|
+
import { s as Ut } from "./storage-CmGHg7OA.js";
|
|
9
|
+
import { PanelGroup as Wt, Panel as je, PanelResizeHandle as Xt } from "@aiquants/resize-panels";
|
|
10
|
+
import { a as Yt, u as Qt } from "./useSplitPersistence-Df63lnQZ.js";
|
|
11
11
|
import { useLocation as Jt } from "react-router";
|
|
12
12
|
function en({
|
|
13
13
|
title: e,
|
|
@@ -310,8 +310,8 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
310
310
|
o((p) => p.state === "running" && p.opened === i ? p : { state: "running", opened: i });
|
|
311
311
|
}, []);
|
|
312
312
|
return C(() => ({ status: r, start: c, end: l, advance: a }), [r, c, l, a]);
|
|
313
|
-
},
|
|
314
|
-
const s = E(null), d = E(!0), u = E(
|
|
313
|
+
}, Ge = ["pointerdown", "wheel", "touchstart", "keydown", "focusin"], Pn = 8, Ue = { least: Number.POSITIVE_INFINITY, stalled: 0 }, On = ({ tree: e, container: t, path: n, chain: r, rows: o, cancel: c, displayed: l, placement: a }) => {
|
|
314
|
+
const s = E(null), d = E(!0), u = E(Ue), i = E(null), p = E(null), h = E(r), g = E(a);
|
|
315
315
|
H(() => {
|
|
316
316
|
h.current = r, g.current = a;
|
|
317
317
|
}, [r, a]);
|
|
@@ -345,17 +345,17 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
345
345
|
b.phase === "opening" && h.current?.progress(b.folders, k) !== "loading" && P();
|
|
346
346
|
}));
|
|
347
347
|
}, [e, t, v, P]), q = w(() => {
|
|
348
|
-
d.current = !1, u.current =
|
|
348
|
+
d.current = !1, u.current = Ue, A();
|
|
349
349
|
}, [A]);
|
|
350
350
|
D(() => {
|
|
351
351
|
const R = t.current;
|
|
352
352
|
if (R === null) return;
|
|
353
353
|
const k = typeof ResizeObserver > "u" ? null : new ResizeObserver(q);
|
|
354
354
|
k?.observe(R);
|
|
355
|
-
for (const S of
|
|
355
|
+
for (const S of Ge) R.addEventListener(S, P, { passive: !0 });
|
|
356
356
|
return () => {
|
|
357
357
|
k?.disconnect();
|
|
358
|
-
for (const S of
|
|
358
|
+
for (const S of Ge) R.removeEventListener(S, P);
|
|
359
359
|
p.current !== null && cancelAnimationFrame(p.current), p.current = null, v();
|
|
360
360
|
};
|
|
361
361
|
}, [t, q, P, v]);
|
|
@@ -423,13 +423,13 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
423
423
|
enableArrowButtons: !0,
|
|
424
424
|
enableArrowButtonTabStops: !1,
|
|
425
425
|
enableScrollToTopBottomButtons: !0,
|
|
426
|
-
tapScrollCircleOptions:
|
|
426
|
+
tapScrollCircleOptions: Gt
|
|
427
427
|
},
|
|
428
428
|
behaviorOptions: { enablePointerDrag: !0 }
|
|
429
|
-
}, Bn = { hoverClassName: "", directorySelectedClassName: "", itemSelectedClassName: "" }, zn = { color: "inherit", fontSize: "inherit" }, Vn = { fontSize: "inherit" }, jn = /* @__PURE__ */ new Set(), Kn = /* @__PURE__ */ new Map(),
|
|
429
|
+
}, Bn = { hoverClassName: "", directorySelectedClassName: "", itemSelectedClassName: "" }, zn = { color: "inherit", fontSize: "inherit" }, Vn = { fontSize: "inherit" }, jn = /* @__PURE__ */ new Set(), Kn = /* @__PURE__ */ new Map(), Gn = { color: "var(--aqmx-tree-line)" }, Un = (e) => {
|
|
430
430
|
const t = e instanceof Element ? e.closest(`[${ce}]`) : null;
|
|
431
431
|
return t === null || t.getAttribute("data-entry-type") !== "file" ? null : t.getAttribute(ce);
|
|
432
|
-
}, ct = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth),
|
|
432
|
+
}, ct = (e, t, n, r) => n === "folder-limit" ? e.expandAllFolderLimit(r, t.maxFolders, e.expandAll) : e.expandAllDepthLimit(r, t.maxDepth), Wn = (e, t, n) => n.kind === "done" ? e.expandAllDone(n.opened, n.failed, n.complete) : ct(e, t, n.kind, n.opened), it = () => {
|
|
433
433
|
const { labels: e } = $();
|
|
434
434
|
return /* @__PURE__ */ L("div", { className: "aqmx-explorer-loading", "aria-busy": "true", "data-testid": "markdown-explorer-tree-loading", children: [
|
|
435
435
|
/* @__PURE__ */ m("p", { className: "aqmx-explorer-loading-text", children: e.treeLoading }),
|
|
@@ -494,10 +494,10 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
494
494
|
expandAll: v,
|
|
495
495
|
revealCancel: P
|
|
496
496
|
}) => {
|
|
497
|
-
const { trees: A, documents: q, labels: y, locale: Z, theme: N, data: R, config: k, sources: S, reveals: b } = $(), _ = ye(Fe), [B] = F(wn), ie = E(null), { rowHeight: re, lineColor: K } = Dn(ie, N), { isExpanded:
|
|
497
|
+
const { trees: A, documents: q, labels: y, locale: Z, theme: N, data: R, config: k, sources: S, reveals: b } = $(), _ = ye(Fe), [B] = F(wn), ie = E(null), { rowHeight: re, lineColor: K } = Dn(ie, N), { isExpanded: G, toggle: ae, expandMultiple: z, collapseMultiple: Q, expanded: J, isPending: ee } = i, { alwaysExpanded: M, sortMode: le, folderPlacement: de, readmePlacement: he } = o, { direct: oe, markDirect: U, unmarkDirect: te, pruneDirect: we } = h, { running: ue, advance: me } = v, xe = E(null), se = E(null), W = C(() => _t({ sortMode: le, folderPlacement: de, readmePlacement: he }), [le, de, he]), O = C(() => gn(W), [W]), I = w((x) => A.children(r, x), [A, r]), V = C(() => bn(e), [e]), ne = w((x) => !pe(x) && (G(x) || M && !V.has(x)), [G, M, V]), X = E({ shownExpanded: ne, isExpanded: G, unloadedFolders: V, entries: e, childrenOf: I });
|
|
498
498
|
H(() => {
|
|
499
|
-
X.current = { shownExpanded: ne, isExpanded:
|
|
500
|
-
}, [ne,
|
|
499
|
+
X.current = { shownExpanded: ne, isExpanded: G, unloadedFolders: V, entries: e, childrenOf: I };
|
|
500
|
+
}, [ne, G, V, e, I]);
|
|
501
501
|
const Ie = w((x) => {
|
|
502
502
|
xe.current?.scrollToPath(x, { align: "nearest" }), requestAnimationFrame(() => {
|
|
503
503
|
const T = se.current, j = T === null ? void 0 : st(T, x);
|
|
@@ -509,9 +509,9 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
509
509
|
Ie(pn(x));
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
512
|
-
X.current.isExpanded(x) ? te([x]) : X.current.unloadedFolders.has(x) &&
|
|
512
|
+
X.current.isExpanded(x) ? te([x]) : X.current.unloadedFolders.has(x) && U(x), ae(x);
|
|
513
513
|
},
|
|
514
|
-
[Ie,
|
|
514
|
+
[Ie, U, te, ae]
|
|
515
515
|
), Se = w(
|
|
516
516
|
(x) => {
|
|
517
517
|
const T = x.filter((j) => !pe(j));
|
|
@@ -530,14 +530,14 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
530
530
|
{
|
|
531
531
|
name: x.name,
|
|
532
532
|
onRetry: () => {
|
|
533
|
-
|
|
533
|
+
U(x.path), A.retryChildren(r, x.path), X.current.shownExpanded(x.path) || z([x.path]);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
),
|
|
537
|
-
[A, r,
|
|
538
|
-
), He = n === "multi" ? l : jn, { loopFolderName: $e } = y, wt = C(() => B(e, { openPaths: He, childrenOf: I, renderFailedFolder: De, loopFolderName: $e }), [B, e, He, I, De, $e, t]), gt = At(q,
|
|
539
|
-
for (const x of Ze.current) X.current.unloadedFolders.has(x) &&
|
|
540
|
-
}, [
|
|
537
|
+
[A, r, U, z]
|
|
538
|
+
), He = n === "multi" ? l : jn, { loopFolderName: $e } = y, wt = C(() => B(e, { openPaths: He, childrenOf: I, renderFailedFolder: De, loopFolderName: $e }), [B, e, He, I, De, $e, t]), gt = At(q, Un), Ze = E([]), ge = w(() => {
|
|
539
|
+
for (const x of Ze.current) X.current.unloadedFolders.has(x) && U(x);
|
|
540
|
+
}, [U]), { maxDepth: Te } = k.revealDocument, Be = E(u);
|
|
541
541
|
H(() => {
|
|
542
542
|
Be.current = u;
|
|
543
543
|
}, [u]);
|
|
@@ -563,12 +563,12 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
563
563
|
D(() => ge(), [ge, V]);
|
|
564
564
|
const bt = C(() => [e, t, J], [e, t, J]), Et = w((x) => se.current === null ? Number.POSITIVE_INFINITY : $n(se.current, x), []);
|
|
565
565
|
On({ tree: xe, container: se, path: c.path, chain: c.openFolders ? vt : null, rows: bt, cancel: P, displayed: _, placement: Et });
|
|
566
|
-
const ze = w((x) => oe.has(x), [oe]), ve = C(() => vn(e, { isShownExpanded: ne, childrenOf: I, compare:
|
|
566
|
+
const ze = w((x) => oe.has(x), [oe]), ve = C(() => vn(e, { isShownExpanded: ne, childrenOf: I, compare: W, isDirect: ze }), [e, ne, I, W, ze, t]), be = _ && g;
|
|
567
567
|
H(() => {
|
|
568
568
|
p(e);
|
|
569
569
|
}, [e, p]), H(() => () => p(null), [p]), D(() => A.claimChildren(r, be ? ve.folders : Kn), [A, r, be, ve]), D(() => we(V), [we, V]), D(() => {
|
|
570
|
-
be && ue && me({ entries: e, isShownExpanded: ne, childrenOf: I, compare:
|
|
571
|
-
}, [be, ue, me, e, ne, I,
|
|
570
|
+
be && ue && me({ entries: e, isShownExpanded: ne, childrenOf: I, compare: W, expanded: J, waiting: ve.waiting, expansionPending: ee });
|
|
571
|
+
}, [be, ue, me, e, ne, I, W, J, ve, ee]);
|
|
572
572
|
const yt = w(
|
|
573
573
|
(x) => {
|
|
574
574
|
const T = x.entry.absolutePath;
|
|
@@ -617,7 +617,7 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
617
617
|
ariaLabel: y.treeRegion,
|
|
618
618
|
...Nt,
|
|
619
619
|
showExpandIcons: o.expandIcons,
|
|
620
|
-
expandIconStyle:
|
|
620
|
+
expandIconStyle: Gn,
|
|
621
621
|
showDirectoryIcons: o.directoryIcons,
|
|
622
622
|
showFileIcons: o.fileIcons,
|
|
623
623
|
expandIconSize: o.expandIconSize,
|
|
@@ -668,7 +668,7 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
668
668
|
const c = r?.(o.failure);
|
|
669
669
|
return /* @__PURE__ */ m("div", { className: "aqmx-explorer-tree-message", "data-testid": "markdown-explorer-tree-failure", "data-aqmx-failure": o.failure.reason, children: c !== void 0 ? c : /* @__PURE__ */ m(kt, { failure: o.failure, alert: !0, onRetry: t, testId: null }) });
|
|
670
670
|
}, rr = ({ onControls: e, ...t }) => {
|
|
671
|
-
const { trees: n, storageNamespace: r, labels: o, announcer: c, config: l } = $(), { sourceId: a } = t, s = jt({ storageKey:
|
|
671
|
+
const { trees: n, storageNamespace: r, labels: o, announcer: c, config: l } = $(), { sourceId: a } = t, s = jt({ storageKey: Ut(r).treeExpansion(a) });
|
|
672
672
|
Ce(n.subscribe, n.version, n.version);
|
|
673
673
|
const d = n.read(a), u = w(() => n.retry(a), [n, a]);
|
|
674
674
|
H(() => n.open(a), [n, a]);
|
|
@@ -676,8 +676,8 @@ const un = /* @__PURE__ */ f.forwardRef(dn), Fe = qe(!0), nt = "\0loop\0", rt =
|
|
|
676
676
|
H(() => {
|
|
677
677
|
q.current = p;
|
|
678
678
|
}, [p]);
|
|
679
|
-
const y = l.expandAll, Z = w(() => c.announce(o.expandAllStarted), [c, o]), N = w((M) => c.announce(
|
|
680
|
-
re.current = M,
|
|
679
|
+
const y = l.expandAll, Z = w(() => c.announce(o.expandAllStarted), [c, o]), N = w((M) => c.announce(Wn(o, y, M)), [c, o, y]), R = Ln({ budget: y, expandMultiple: h, onStart: Z, onFinish: N }), { status: k, start: S, end: b, advance: _ } = R, B = k.state === "running", ie = C(() => ({ running: B, advance: _ }), [B, _]), re = E(null), [K, G] = F(!1), ae = w((M) => {
|
|
680
|
+
re.current = M, G(M !== null);
|
|
681
681
|
}, []);
|
|
682
682
|
D(
|
|
683
683
|
() => n.subscribeChildrenFailures((M) => {
|
|
@@ -722,10 +722,10 @@ function ar({
|
|
|
722
722
|
clipRule: "evenodd"
|
|
723
723
|
}));
|
|
724
724
|
}
|
|
725
|
-
const dt = /* @__PURE__ */ f.forwardRef(ar),
|
|
725
|
+
const dt = /* @__PURE__ */ f.forwardRef(ar), We = "markdown-explorer-selection-remove", lr = ({ selection: e, onRemove: t, onClear: n, onOpenSelection: r, onLeave: o }) => {
|
|
726
726
|
const { labels: c } = $(), l = Re(), a = E(null), s = [...e], d = (i, p) => {
|
|
727
727
|
if (p.ownerDocument.activeElement === p) {
|
|
728
|
-
const h = a.current === null ? [] : [...a.current.querySelectorAll(`[data-testid="${
|
|
728
|
+
const h = a.current === null ? [] : [...a.current.querySelectorAll(`[data-testid="${We}"]`)], g = h.indexOf(p), v = [h[g + 1], h[g - 1]].find((P) => P !== void 0);
|
|
729
729
|
v === void 0 ? o() : v.focus();
|
|
730
730
|
}
|
|
731
731
|
t(i);
|
|
@@ -747,7 +747,7 @@ const dt = /* @__PURE__ */ f.forwardRef(ar), Ge = "markdown-explorer-selection-r
|
|
|
747
747
|
className: "aqmx-icon-button aqmx-explorer-tray-remove",
|
|
748
748
|
"aria-label": c.removeFromSelection(p),
|
|
749
749
|
title: c.removeFromSelection(p),
|
|
750
|
-
"data-testid":
|
|
750
|
+
"data-testid": We,
|
|
751
751
|
"data-aqmx-path": i,
|
|
752
752
|
onClick: (h) => d(i, h.currentTarget),
|
|
753
753
|
children: /* @__PURE__ */ m(dt, { "aria-hidden": "true" })
|
|
@@ -1192,7 +1192,7 @@ const Fr = /* @__PURE__ */ f.forwardRef(Cr), Mr = Object.freeze({
|
|
|
1192
1192
|
return I.selectionMode !== "multiple" && y?.(Ae), I;
|
|
1193
1193
|
},
|
|
1194
1194
|
[P, y]
|
|
1195
|
-
), _ = Ir({ settings: v, descriptors: A, onAdvance: b }), B = w((O) => y?.((I) => or(I, O)), [y]), ie = w((O) => y?.((I) => sr(I, O)), [y]), re = w(() => y?.(Ae), [y]), K = E(null),
|
|
1195
|
+
), _ = Ir({ settings: v, descriptors: A, onAdvance: b }), B = w((O) => y?.((I) => or(I, O)), [y]), ie = w((O) => y?.((I) => sr(I, O)), [y]), re = w(() => y?.(Ae), [y]), K = E(null), G = w(() => {
|
|
1196
1196
|
const O = K.current;
|
|
1197
1197
|
if (O === null) return;
|
|
1198
1198
|
[Hr, $r, '[data-testid="markdown-explorer-tree-settings"]'].map((V) => O.querySelector(V)).find((V) => V !== null)?.focus();
|
|
@@ -1211,23 +1211,23 @@ const Fr = /* @__PURE__ */ f.forwardRef(Cr), Mr = Object.freeze({
|
|
|
1211
1211
|
r !== null && g.settle(r), l(O);
|
|
1212
1212
|
},
|
|
1213
1213
|
[r, g, l]
|
|
1214
|
-
), [M, le] = F(null), [de, he] = F(!1), [oe,
|
|
1214
|
+
), [M, le] = F(null), [de, he] = F(!1), [oe, U] = F(null), te = E(!1), we = w(async () => {
|
|
1215
1215
|
if (!te.current) {
|
|
1216
|
-
te.current = !0, he(!0),
|
|
1216
|
+
te.current = !0, he(!0), U(null);
|
|
1217
1217
|
try {
|
|
1218
1218
|
const O = await i.refresh(n);
|
|
1219
1219
|
if (O.status === "superseded") return;
|
|
1220
|
-
p.invalidate(), O.status === "failed" ?
|
|
1220
|
+
p.invalidate(), O.status === "failed" ? U({ sourceId: n, failure: O.failure }) : h.announce(d.treeRefreshed);
|
|
1221
1221
|
} finally {
|
|
1222
1222
|
te.current = !1, he(!1);
|
|
1223
1223
|
}
|
|
1224
1224
|
}
|
|
1225
|
-
}, [i, p, n, h, d]), ue = M === null ? null : M.expandAll, me = M?.expanding === !0, xe = u.find((O) => O.id === n), se = s.target === "multi" ? sn : ln,
|
|
1225
|
+
}, [i, p, n, h, d]), ue = M === null ? null : M.expandAll, me = M?.expanding === !0, xe = u.find((O) => O.id === n), se = s.target === "multi" ? sn : ln, W = s.target === "multi" ? d.switchToMulti : d.switchToTree;
|
|
1226
1226
|
return /* @__PURE__ */ L("nav", { ref: K, "aria-label": d.explorerRegion, className: "aqmx-explorer", "data-testid": "markdown-explorer-explorer", "data-aqmx-mode": t, children: [
|
|
1227
1227
|
/* @__PURE__ */ L("div", { className: "aqmx-explorer-header", children: [
|
|
1228
1228
|
u.length > 1 ? /* @__PURE__ */ m("select", { className: "aqmx-explorer-source", "aria-label": d.sourceLabel, title: xe?.label, value: n, onChange: (O) => ee(O.currentTarget.value), "data-testid": "markdown-explorer-source-select", children: u.map((O) => /* @__PURE__ */ m("option", { value: O.id, children: O.label }, O.id)) }) : null,
|
|
1229
1229
|
/* @__PURE__ */ L("div", { className: "aqmx-explorer-actions", children: [
|
|
1230
|
-
/* @__PURE__ */ m(Pt, { to: s.href, navigation: "switch-view", className: "aqmx-icon-button", "aria-label":
|
|
1230
|
+
/* @__PURE__ */ m(Pt, { to: s.href, navigation: "switch-view", className: "aqmx-icon-button", "aria-label": W, title: W, "data-testid": "markdown-explorer-view-switch", "data-aqmx-target": s.target, children: /* @__PURE__ */ m(se, { "aria-hidden": "true" }) }),
|
|
1231
1231
|
/* @__PURE__ */ L(
|
|
1232
1232
|
"button",
|
|
1233
1233
|
{
|
|
@@ -1270,7 +1270,7 @@ const Fr = /* @__PURE__ */ f.forwardRef(Cr), Mr = Object.freeze({
|
|
|
1270
1270
|
oe !== null && oe.sourceId === n ? /* @__PURE__ */ m("p", { role: "alert", className: "aqmx-explorer-refresh-failure", "data-testid": "markdown-explorer-refresh-failure", "data-aqmx-failure": oe.failure.reason, children: d.treeRefreshFailed(Ot(d, oe.failure.reason)) }) : null,
|
|
1271
1271
|
/* @__PURE__ */ m(et, { fallback: null, children: /* @__PURE__ */ m(cn, {}) }),
|
|
1272
1272
|
/* @__PURE__ */ m(rr, { mode: t, sourceId: n, settings: v, reveal: J, openPaths: o, selection: Q, onOpenDocument: c, folders: k, onRevealSource: a, onControls: le }, n),
|
|
1273
|
-
q && S.size > 0 ? /* @__PURE__ */ m(lr, { selection: S, onRemove: ie, onClear: re, onOpenSelection: Z, onLeave:
|
|
1273
|
+
q && S.size > 0 ? /* @__PURE__ */ m(lr, { selection: S, onRemove: ie, onClear: re, onOpenSelection: Z, onLeave: G }) : null,
|
|
1274
1274
|
_.menu
|
|
1275
1275
|
] })
|
|
1276
1276
|
] });
|
|
@@ -1330,13 +1330,13 @@ const Br = /* @__PURE__ */ f.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1330
1330
|
/* @__PURE__ */ m(Ct, { holds: s, testId: "markdown-explorer-sheet-announcer" })
|
|
1331
1331
|
] }) })
|
|
1332
1332
|
] });
|
|
1333
|
-
}, Vr = qe(null), Me = "aqmx-explorer", ft = "aqmx-content", jr = "--aqmx-split-band", _e = '[role="tree"] [role="treeitem"]', Kr = `${_e}[tabindex="0"]`,
|
|
1333
|
+
}, Vr = qe(null), Me = "aqmx-explorer", ft = "aqmx-content", jr = "--aqmx-split-band", _e = '[role="tree"] [role="treeitem"]', Kr = `${_e}[tabindex="0"]`, Gr = "[data-directory-tree-tab-stop]", Ur = (e, t) => {
|
|
1334
1334
|
for (const n of e.querySelectorAll(`[data-panel-id="${Me}"] ${_e}`)) if (n.getAttribute(ce) === t) return n;
|
|
1335
1335
|
return null;
|
|
1336
1336
|
}, Ye = (e, t) => ({
|
|
1337
1337
|
inlineSize: e > 0 ? e : null,
|
|
1338
1338
|
rootFontPixels: t > 0 ? t : Vt
|
|
1339
|
-
}),
|
|
1339
|
+
}), Wr = (e, t) => {
|
|
1340
1340
|
const [n, r] = F(() => Ye(0, 0));
|
|
1341
1341
|
return H(() => {
|
|
1342
1342
|
const o = e.current, c = t.current;
|
|
@@ -1397,15 +1397,15 @@ const Br = /* @__PURE__ */ f.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1397
1397
|
if (a.current !== e || !o.current) return;
|
|
1398
1398
|
const u = c.current, i = `[data-panel-id="${Me}"]`;
|
|
1399
1399
|
d([
|
|
1400
|
-
u === null ? null :
|
|
1400
|
+
u === null ? null : Ur(s, u),
|
|
1401
1401
|
s.querySelector(`${i} ${Kr}`),
|
|
1402
|
-
s.querySelector(`${i} ${
|
|
1402
|
+
s.querySelector(`${i} ${Gr}`),
|
|
1403
1403
|
s.querySelector(`[data-resize-handle-id="${r}"]`)
|
|
1404
1404
|
]);
|
|
1405
1405
|
});
|
|
1406
1406
|
}, [e, t, n, r]);
|
|
1407
1407
|
}, ia = ({ view: e, explorer: t, content: n, contentCoversPage: r = !1, sheetDismissals: o = 0, onDraggingChange: c }) => {
|
|
1408
|
-
const l = E(null), [a, s] = F(null), d = E(null), u = E(null), { inlineSize: i, rootFontPixels: p } =
|
|
1408
|
+
const l = E(null), [a, s] = F(null), d = E(null), u = E(null), { inlineSize: i, rootFontPixels: p } = Wr(l, d), h = i !== null && i < Dt(p);
|
|
1409
1409
|
return Xr(h, { frameRef: l, sheetToggleRef: u, handleId: pt(e) }), /* @__PURE__ */ L("div", { ref: l, className: "aqmx-split-frame", "data-aqmx-explorer-mode": h ? "sheet" : "split", children: [
|
|
1410
1410
|
/* @__PURE__ */ m("span", { ref: d, className: "aqmx-rem-probe", "aria-hidden": "true", "data-aqmx-rem-probe": "" }),
|
|
1411
1411
|
h ? /* @__PURE__ */ m(zr, { explorer: t, toggleRef: u, covered: r, onNoticeSlotChange: s, dismissals: o }) : null,
|
|
@@ -1454,7 +1454,7 @@ const Br = /* @__PURE__ */ f.forwardRef(Zr), zr = ({ explorer: e, toggleRef: t,
|
|
|
1454
1454
|
},
|
|
1455
1455
|
[c, v]
|
|
1456
1456
|
);
|
|
1457
|
-
return /* @__PURE__ */ L(
|
|
1457
|
+
return /* @__PURE__ */ L(Wt, { id: `aqmx-split-${e}`, direction: "horizontal", onLayout: y, className: "aqmx-split", style: q, "data-aqmx-split": e, children: [
|
|
1458
1458
|
t ? null : /* @__PURE__ */ m(
|
|
1459
1459
|
je,
|
|
1460
1460
|
{
|