Migrate kit/ components to Svelte 5 runes (fixes broken docstring tooltips) - #795
Merged
Conversation
Migrated all 110 src/ components with `migrate()` from svelte/compiler ($props/$state/$derived, event attributes, snippets), then hand-finished: - tooltip action rewritten from the removed class API (new Component/$set/ $destroy) to mount/unmount with reactive $state props, in a .svelte.ts module. This FIXES docstring parameter tooltips, which have been silently broken since #792 (`new Tooltip()` throws on Svelte 5 components; hover handlers swallowed the error). Verified against the Svelte 4 baseline. - FrameworkContent, InferenceApi, TokenizersLanguageContent intentionally stay in legacy syntax: their named slots collide with same-named props, which snippets cannot express; mixing legacy and runes is supported. - svelte/legacy shims (preventDefault/stopPropagation/handlers) replaced with plain event handlers; component prop types moved from constructor signatures to `Component<...>`. - `state_referenced_locally` warnings silenced in onwarn: initial-value capture matches the previous Svelte 4 semantics (doc pages pass static props), and they'd flood every downstream doc build log. Verified: svelte-check 0 errors; accelerate e2e output equivalent to the Svelte 4 baseline (identical metadata/links/ids, known whitespace-only diffs); hub-docs build (268 pages) byte-identical on all compared dimensions vs pre-migration; browser tests pass (hydration, SPA nav, shorthand URLs, HfOptions tabs, docstring tooltips mount/unmount). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mishig25
added a commit
that referenced
this pull request
Jul 4, 2026
…irectly (#797) * refactor: emit the <Docstring> svelte component directly from python autodoc.py previously serialized docstring metadata into a zoo of custom tags (<docstring><name>...<paramgroups>N) that kit/preprocessors/ docstring.js regex-parsed back into a <Docstring .../> component. Python now emits the component open tag with all metadata props inline (name/anchor/source/parameters/isGetSetDescriptor as final JSON values, MDX escaping undone since JS strings need none); the component body carries only the markdown-bearing sections, which the kit preprocessor renders with mdsvex into the remaining props and closes the component. - parameter groups become nested <paramsgroup> blocks instead of numbered tags + a count - the rendered-<ul> parsing stays (documented): parameter lists must be rendered as one markdown list to keep exact tight/loose list semantics - fixes a long-standing tag mismatch: python emits <yielddesc> but the old regex matched <yieldesc>, silently dropping yield descriptions Verified byte-identical output (48/48 pages, modulo hashed asset names and nondeterministic python object addresses) on the accelerate e2e build; python test suite updated and passing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(kit): silence state_referenced_locally warnings (runes follow-up) This hunk was part of the runes migration verification but was left out of #795 (staged with `git add kit/src`, which misses kit/svelte.config.js). The flagged initial-value captures have the same semantics as the pre-runes svelte 4 code — doc pages pass static props — and the warning floods every downstream doc build log otherwise. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
What
Migrates all
kit/srccomponents (110 files) from Svelte 4 legacy syntax to runes ($props/$state/$derived, event attributes, snippets), usingmigrate()fromsvelte/compilerplus manual finishing. Follow-up to #792.Docstring parameter tooltips have been silently broken since #792:
src/lib/tooltip.tsused the Svelte 4 class API (new Tooltip({...}),$set,$destroy), which throws on Svelte 5 components — the error was swallowed by the hover handler, so nothing surfaced in builds. Rewritten as a.svelte.tsaction usingmount/unmountwith reactive$stateprops. Verified in a browser against the Svelte 4 baseline: tooltips mount on hover and unmount on leave, exactly like before the upgrade.Notable decisions
FrameworkContent,InferenceApi,TokenizersLanguageContent): they expose named slots (pytorch,python, …) that collide with same-named props, which snippet props cannot express. Their slot API is consumed by the generated doc pages (also legacy syntax); mixing legacy and runes components is fully supported by Svelte 5. Each carries a comment explaining this.+page.svelte) remain legacy syntax by design — they're emitted by the Python/mdsvex pipeline; legacy pages rendering runes components (children snippets) is standard interop.svelte/legacyshims the migrator inserted (preventDefault,stopPropagation,handlers) were replaced with plain event handlers — zerosvelte/legacyimports remain.Component<{ classNames?: string }>instead of constructor signatures.state_referenced_locallywarnings are silenced inonwarn: the flagged initial-value captures have identical semantics to the previous Svelte 4 code (doc pages pass static props), and they would flood every downstream doc build log. They remain visible insvelte-check.Verification
svelte-check: 0 errors🤖 Generated with Claude Code