Repository navigation
JSON fold gutter and Generate types; Diff transforms in a worker - #25
Merged
Merged
Conversation
Moves the editor's base theme out of the Diff route into src/lib/codemirror so the JSON tool can use it, and pins @codemirror/lang-json 6.0.2 and @codemirror/language 6.12.4 (already in the lockfile) for the JSON output's fold gutter.
The old check gzipped only index-*.js, so the registry chunk index.html modulepreloads (~13.8 kB gzip) was never measured. The step now sums every script dist/index.html loads (entry, modulepreloads, registerSW.js): 98,355 B today against a 107,520 B (105 KiB) budget, the same headroom as before.
…nd String Escaper YAML / JSON / TOML drops its private copy of the issue card for components/ui/IssueCard, whose column is now nullable to fit the YAML/TOML engine's messages. Base64, URL and String Escaper turn soft-wrap off on input and output once a line passes 100k characters (hasLongLine from core /text), as JSON and Text to Binary / Hex already do, so a multi-MB single line stays editable. Trims the JSON to Types SEO paragraph from 141 to 119 words.
…ine breaks A #d= share link pasted into an already-open Diff tab now loads without a reload: the tool listens for hashchange, as List does, decodes the fragment, clears it with history.replaceState and ignores a fragment it is already decoding or that was replaced meanwhile. The sorted-lines and key-sorted JSON views are built in a worker (transform.worker.ts) driven by useWorkerJob, so toggling them on a large input no longer freezes the page. The worker is spawned only while a transform is on (TransformRunner is mounted only then) and is killed by Show original. While a run is pending the panes keep the previous view of the same transform, or show a busy message, never the raw text; Copy patch is disabled until the view matches the text; after 2 s a Cancel button appears. The size verdict is computed on the transformed text in the worker, before it reaches CodeMirror. The JSON parser and the line sort leave the diff route chunk. longestLineOf, and so assessSize, now ends a line at \r\n, \n or a lone \r, matching CodeMirror's /\r\n?|\n/ split, so a large classic-Mac file is no longer refused as one long line. It stays two indexOf cursors, linear. Unit and property tests in the package, and a parity test against CodeMirror's own line splitting.
Formatted output (format mode, text view, ok size tier, md and up) now renders in a read-only CodeMirror view with lang-json, line numbers and a chevron fold gutter. It is a lazily loaded component (FoldableOutput), so CodeMirror stays out of the entry and the JSON route chunk; the textarea output shows while it loads. Text changes are applied as one minimal replace transaction, so folds and scroll outside the edit survive typing. Fold all folds every object and array below the root; Unfold all uses unfoldAll. No syntax colours. The large tier, escape/unescape, the tree view, errors, output over the 2 MB inline limit and viewports below md keep the plain textarea. Below md the Tree view, with 44px rows, is the way to fold. Generate types hands the output (filtered, expanded and sorted as shown) to JSON to Types through handOff and navigates there, with a visible message if the write fails. NDJSON input gets the same button in its banner and sends the records as they are, since JSON to Types reads each line as a sample. Output past the inline limit is sent minified. The private IssueCard is replaced by the shared one from components/ui. useNarrow moves out of TreeView into narrow.ts so both components share it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
Changed
Fixed
\rcounts as a line break in the size check