Widget: general Jsonable widget, support pre / post slots in all widgets - #71
Open
hon-gyu wants to merge 16 commits into
Open
Widget: general Jsonable widget, support pre / post slots in all widgets#71hon-gyu wants to merge 16 commits into
hon-gyu wants to merge 16 commits into
Conversation
- fold: require whitespace after the `:`/`-` introducing a block scalar, so a plain scalar merely ending in `-|` / `->` no longer swallows the keys that follow it into an opaque block body - fold: close a block-header node once its body is consumed, so a trailing blank line lands after the fold rather than inside it - nb_hooks: key a region decomposition's `pre` off `errors` as well as off an empty panel -- a result can report errors *and* lay out region groups, and those errors were going unreported - nb_hooks: `# type: ignore` the nullable-traitlet assignments (stubs do not model `allow_none`), keeping ty and pyright clean - adapters: note that `nb_hooks` never sends `[]`, so the empty-array path is reachable only for a directly constructed widget
Kept diffable, unlike the built bundles: pydantic2ts output is readable and the change is worth reviewing when a model changes.
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.
::: ai-generated
Overview:
Replaces the old "empty result →
text/plainfallback" mechanism with a compositional one:JsonableWidget— Python renders anyJSONValueto YAML (yaml_utils.to_yaml_str) and syncs the string; the front end (src/jsonable/{fold,highlight,view,style}.ts) recovers fold structure from indentation alone and hand-rolls YAML highlighting, plus a toolbar (expand/collapse all, copy, line count).pre/postslots onTasksWidget/RegionDecompWidget, stacked bysrc/common/stack.ts. Their native data traitlets become nullable:nulldrops the native panel entirely,[]still draws it with its own "No tasks." / "No regions."nb_hooksnow dumps the whole result intopreas YAML when the native panel would be empty, instead oftext/plain.:::