Skip to content

docs(v4): ship the v4 documentation site - #867

Merged
titouanmathis merged 2 commits into
mainfrom
feat/v4-docs
Aug 26, 2026
Merged

docs(v4): ship the v4 documentation site#867
titouanmathis merged 2 commits into
mainfrom
feat/v4-docs

Conversation

@titouanmathis

Copy link
Copy Markdown
Contributor

Adds the v4 documentation site and deploys it to js-toolkit-v4.studiometa.dev.

The site

123 pages at packages/v4/docs, on the same theme as packages/docs.vitepress/theme/ is copied verbatim (DefaultTheme + Tailwind 4 + @studiometa/tailwind-config + twoslash client + PreviewIframe.vue).

Section Pages
Home + guide — introduction, going further, concepts, migration 24
api/ — Base, HTML, registry, shared state, services, decorators, scheduler, DOM, storage, diagnostics, testing 83
utils/ — 14 category pages + overview 16

Content is written against DESIGN.md and RATIONALE.md, with every signature verified against src/ or the built declarations rather than taken from the spec on trust.

It lives inside the v4 package

Not beside packages/docs. The VitePress, Tailwind and twoslash dependencies are devDependencies of @studiometa/js-toolkit-v4, the scripts are docs:dev / docs:build / docs:preview on that package, and the root exposes docs:v4:dev / docs:v4:build / docs:v4:preview. There is no packages/v4/docs/package.json, so the packages/* workspaces glob is unchanged.

Twoslash caught four wrong claims

Type-checked samples paid for themselves — each of these was a statement that would otherwise have shipped as documentation:

  1. on<Child><Event> methods get no automatic parameter typing. The name is resolved at runtime, so the payload needs DelegatedEvent / RefEvent / GlobalEvent.
  2. @on does not remove that annotation — it checks it. A decorator cannot infer the method's own parameters. The specs confirmed the correction.
  3. Only @on's class form carries the payload type. @on('Child', 'open') leaves payload as unknown, because a string is just a string to the type system. Now a table on the @on page, since a lazy child has no choice but the string form.
  4. An intermediate class must annotate static config: BaseConfig. Left inferred it becomes a literal type, and every subclass that adds an option fails with Class static side … incorrectly extends.

Two claims taken from the design doc that the shipped code does not match were also corrected: ScrollProgressProps carries no delta, and the offset option is "<target> <viewport> / <target> <viewport>" with the default 'start end / end start' — documented from scroll-progress-offset.ts.

Deployment

A second job in .github/workflows/docs.yml, rather than two builds in one, so a v4 docs failure cannot hold back the v3 deploy. It runs npm run build:v4 first: the committed @twoslash-cache comments mean twoslash normally does not run in CI, but the v4 exports map has no typescript condition, so on a cache miss twoslash resolves the package types out of dist.

Important

Two things are needed on the Cloudflare side before the job can succeed:

  1. a Pages project named js-toolkit-v4;
  2. the custom domain js-toolkit-v4.studiometa.dev attached to it.

wrangler pages deploy creates neither. The existing CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets are reused as-is.

Checks

npm run docs:v4:build   → build complete, 124 HTML pages, 0 dead links
npm run lint            → clean
npm run lint:types      → clean

The full CI sequence was also run from a clean tree (rm -rf packages/v4/distbuild:v4docs:v4:build) with no twoslash cache drift.

Notes for review

  • packages/v4/docs/** joins the relaxed .oxlintrc.json override beside test/** and scripts/** — the strict type-aware block for packages/v4/**/*.ts flags the copied VitePress theme.
  • Code samples import @studiometa/js-toolkit-v4 so their types resolve against the package that exists today; the installation page states plainly that readers should read it as @studiometa/js-toolkit.
  • The utils long tail is at category-page depth rather than one page per export. Say the word if the 104 utils/* subpaths should each get their own page.

🤖 Generated with Claude Code

https://claude.ai/code/session_012ioM9dGKVhexCv4NLUcbA7

titouanmathis and others added 2 commits August 26, 2026 19:05
123 pages on the packages/docs theme, written against DESIGN.md and
RATIONALE.md with every signature verified against src/ or the built
declarations: the guide, the full Base API, one page per service,
decorator, registry helper and context function, and the utils reference
by category.

The site lives inside the v4 package rather than beside packages/docs:
its VitePress, Tailwind and twoslash dependencies are v4 devDependencies
and its scripts hang off @studiometa/js-toolkit-v4, so packages/* in the
workspaces glob needs no change.

Samples are twoslash-checked, which caught four claims that were wrong:
on<Child><Event> methods get no automatic parameter typing; @on checks an
annotation rather than replacing it; only @on's class form carries the
payload type, since a string is just a string to the type system; and an
intermediate class must annotate `static config: BaseConfig` or its
inferred literal type breaks every subclass that adds an option.

packages/v4/docs/** joins the relaxed oxlint override beside test/ and
scripts/, since the strict type-aware block for packages/v4/**/*.ts
flags the copied VitePress theme.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ioM9dGKVhexCv4NLUcbA7
A second Cloudflare Pages job rather than two builds in one, so a v4
docs failure cannot hold back the v3 deploy.

It builds the v4 package first. The committed @twoslash-cache comments
mean twoslash normally does not run in CI at all, but the v4 exports map
has no `typescript` condition — so on a cache miss twoslash resolves the
package types out of dist, and without that step the miss would fail the
build instead of type-checking against a stale or absent tree.

The custom domain still has to be attached to the js-toolkit-v4 Pages
project in the Cloudflare dashboard; `pages deploy` does not create one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ioM9dGKVhexCv4NLUcbA7
@github-actions

Copy link
Copy Markdown

Export size

Bundled per export with peer dependencies left external, dynamic imports excluded and the output minified; sizes are gzipped.

✅ No export size changes.

Unchanged (399)

@studiometa/js-toolkit

Export Size (gzip) Diff
(barrel) 17.48 kB
AbstractService 598 B
Base 9.1 kB
ComponentLoader 2.31 kB
DEFAULT_DIAGNOSTIC_PREFIX 102 B
DragService 2.02 kB
IDLE_TIMEOUT 57 B
KeyService 935 B
LoadService 666 B
MutationService 849 B
PointerService 1.13 kB
RafService 1020 B
ResizeService 1.12 kB
ScrollService 1.36 kB
VISIBLE_ROOT_MARGIN 72 B
autoload 2.4 kB
closestComponent 419 B
composeManifests 119 B
createApp 996 B
defineFeatures 326 B
defineManifest 512 B
fromMetaGlob 228 B
fromWebpackContext 131 B
getClosestParent 197 B
getDirectChildren 202 B
getInstanceFromElement 125 B
getInstances 187 B
getScopedGroups 104 B
importOnInteraction 926 B
importOnMediaQuery 243 B
importWhenIdle 225 B
importWhenPrefersMotion 271 B
importWhenVisible 935 B
isDirectChild 218 B
logTree 551 B
queryComponent 594 B
queryComponentAll 601 B
readEagerTokens 201 B
registerComponent 305 B
registerComponents 356 B
registerManifest 2.87 kB
registerManifests 2.89 kB
useDrag 2.05 kB
useKey 943 B
useLoad 676 B
useMutation 876 B
usePointer 1.15 kB
useRaf 1 kB
useResize 1.13 kB
useScroll 1.36 kB
utils 10.08 kB
utils/Queue 291 B
utils/SmartQueue 473 B
utils/addClass 240 B
utils/addStyle 239 B
utils/animate 3.34 kB
utils/boundingRectToCircle 206 B
utils/cache 208 B
utils/camelCase 405 B
utils/clamp 98 B
utils/clamp01 114 B
utils/collideCircleCircle 129 B
utils/collideCircleRect 192 B
utils/collidePointCircle 128 B
utils/collidePointRect 122 B
utils/collideRectRect 128 B
utils/createEaseInOut 123 B
utils/createEaseOut 91 B
utils/createElement 635 B
utils/createLocalStorage 1.32 kB
utils/createLocalStorageProvider 296 B
utils/createMemoryStorageProvider 174 B
utils/createNoopProvider 128 B
utils/createRange 115 B
utils/createSessionStorage 1.32 kB
utils/createSessionStorageProvider 288 B
utils/createStorage 1.3 kB
utils/createUrlSearchParamsInHashProvider 461 B
utils/createUrlSearchParamsInHashStorage 1.35 kB
utils/createUrlSearchParamsProvider 429 B
utils/createUrlSearchParamsStorage 1.34 kB
utils/damp 106 B
utils/dashCase 404 B
utils/debounce 122 B
utils/domScheduler 310 B
utils/ease 519 B
utils/easeInCirc 285 B
utils/easeInCubic 287 B
utils/easeInExpo 286 B
utils/easeInOutCirc 288 B
utils/easeInOutCubic 289 B
utils/easeInOutExpo 288 B
utils/easeInOutQuad 288 B
utils/easeInOutQuart 289 B
utils/easeInOutQuint 289 B
utils/easeInOutSine 288 B
utils/easeInQuad 285 B
utils/easeInQuart 286 B
utils/easeInQuint 286 B
utils/easeInSine 285 B
utils/easeLinear 77 B
utils/easeOutCirc 286 B
utils/easeOutCubic 288 B
utils/easeOutExpo 286 B
utils/easeOutQuad 286 B
utils/easeOutQuart 286 B
utils/easeOutQuint 286 B
utils/easeOutSine 286 B
utils/endsWith 128 B
utils/fold 168 B
utils/getAncestorWhere 123 B
utils/getAncestorWhereUntil 148 B
utils/getComponentResolver 140 B
utils/getOffsetSizes 194 B
utils/hasWindow 88 B
utils/historyPush 524 B
utils/historyReplace 526 B
utils/inertiaFinalValue 169 B
utils/isArray 63 B
utils/isBoolean 78 B
utils/isDefined 75 B
utils/isDev 78 B
utils/isEmpty 206 B
utils/isEmptyString 108 B
utils/isFunction 79 B
utils/isNull 68 B
utils/isNumber 91 B
utils/isObject 108 B
utils/isString 77 B
utils/keyCodes 122 B
utils/lerp 84 B
utils/loadElement 220 B
utils/loadIframe 241 B
utils/loadImage 241 B
utils/loadLink 237 B
utils/loadScript 251 B
utils/localStorageProvider 839 B
utils/lowerCase 404 B
utils/map 93 B
utils/matrix 136 B
utils/mean 126 B
utils/memo 130 B
utils/memoize 228 B
utils/memoryStorageProvider 843 B
utils/nextFrame 179 B
utils/nextMicrotask 133 B
utils/nextTick 148 B
utils/noop 62 B
utils/noopValue 76 B
utils/objectToURLSearchParams 322 B
utils/pascalCase 407 B
utils/random 93 B
utils/randomInt 113 B
utils/randomItem 234 B
utils/removeClass 242 B
utils/removeStyle 243 B
utils/round 95 B
utils/saveActiveElement 92 B
utils/scrollTo 2.31 kB
utils/sessionStorageProvider 838 B
utils/smoothTo 476 B
utils/snakeCase 406 B
utils/spring 154 B
utils/startsWith 125 B
utils/throttle 125 B
utils/toggleClass 242 B
utils/transform 347 B
utils/transition 1010 B
utils/trapFocus 441 B
utils/tween 1.72 kB
utils/untrapFocus 120 B
utils/upperCase 404 B
utils/urlSearchParamsInHashProvider 845 B
utils/urlSearchParamsProvider 839 B
utils/useScheduler 309 B
utils/wait 103 B
utils/withLeadingCharacters 135 B
utils/withLeadingSlash 142 B
utils/withTrailingCharacters 135 B
utils/withTrailingSlash 142 B
utils/withoutLeadingCharacters 122 B
utils/withoutLeadingCharactersRecursive 165 B
utils/withoutLeadingSlash 133 B
utils/withoutTrailingCharacters 122 B
utils/withoutTrailingCharactersRecursive 165 B
utils/withoutTrailingSlash 133 B
utils/wrap 122 B
version 56 B
withBreakpointManager 1.54 kB
withBreakpointObserver 1.71 kB
withDrag 2.18 kB
withExtraConfig 163 B
withFreezedOptions 187 B
withGroup 455 B
withIntersectionObserver 303 B
withMountOnMediaQuery 393 B
withMountWhenInView 347 B
withMountWhenPrefersMotion 431 B
withMutation 1010 B
withName 109 B
withRelativePointer 1.29 kB
withResponsiveOptions 2.4 kB
withScrolledInView 3.05 kB

@studiometa/js-toolkit-v4

Export Size (gzip) Diff
(barrel) 22.73 kB
BREAKPOINTS 778 B
Base 8.59 kB
DIAGNOSTICS 714 B
DRAG_MODES 162 B
EVENTS 153 B
MOUNT_ATTRIBUTE 69 B
SWAP_MODES 129 B
children 244 B
component 11.66 kB
createContext 472 B
createFallbackProvider 1.33 kB
createGroup 1.07 kB
createLocalStorage 2.33 kB
createMemoryStorageProvider 1.21 kB
createService 640 B
createServiceMixin 1015 B
createSessionStorage 2.33 kB
createStorage 2.3 kB
createUrlSearchParamsInHashProvider 1.21 kB
createUrlSearchParamsInHashStorage 2.34 kB
createUrlSearchParamsProvider 1.21 kB
createUrlSearchParamsStorage 2.34 kB
defaultScheduler 1.5 kB
defineManifest 983 B
domUpdate 1.23 kB
emitExtendable 1.09 kB
fromMetaGlob 203 B
fromWebpackContext 131 B
getBreakpoints 776 B
getInstance 131 B
getInstances 2.87 kB
getMountedInstances 2.87 kB
getUnmountedInstances 2.88 kB
inject 176 B
injectContext 675 B
injectContextSync 634 B
jsonSerializer 95 B
localStorageProvider 1.21 kB
memoryStorageProvider 1.21 kB
namespaceQualifier 120 B
nextFrame 115 B
on 8.93 kB
perTarget 322 B
provide 185 B
provideContext 704 B
provideRootContext 748 B
read 126 B
registerComponent 11.27 kB
registerComponents 11.27 kB
registerManifest 11.33 kB
reportDiagnostic 329 B
sessionStorageProvider 1.21 kB
setBreakpoints 806 B
signal 925 B
subscribeContext 1.44 kB
swap 2.9 kB
test 11.77 kB
toggle 177 B
until 172 B
urlSearchParamsInHashProvider 1.21 kB
urlSearchParamsProvider 1.21 kB
useBreakpoint 1.44 kB
useDrag 3.36 kB
useInView 1.43 kB
useKey 1.47 kB
useMediaQuery 1.06 kB
useMutation 1.4 kB
usePointer 1.85 kB
usePrefersReducedMotion 1.09 kB
useRaf 1.95 kB
useResize 1.43 kB
useScroll 2.67 kB
useScrollProgress 3.64 kB
useWindowScroll 2.66 kB
useWindowSize 1.43 kB
utils 9.25 kB
utils/DEFAULT_DAMP_FACTOR 109 B
utils/INERTIA_FRAME 97 B
utils/MAX_SPRING_RATIO 100 B
utils/SCROLL_ALIGNMENTS 117 B
utils/SCROLL_AXES 100 B
utils/TRANSFORM_PROPS 137 B
utils/TRANSITION_OPTIONS 132 B
utils/camelCase 449 B
utils/capitalize 119 B
utils/clamp 133 B
utils/clamp01 149 B
utils/clampDampFactor 157 B
utils/createEaseInOut 120 B
utils/createEaseOut 91 B
utils/createElement 638 B
utils/createRange 205 B
utils/damp 211 B
utils/debounce 121 B
utils/decayOver 162 B
utils/deepmerge 312 B
utils/easeInCirc 94 B
utils/easeInCubic 81 B
utils/easeInExpo 97 B
utils/easeInOutCirc 150 B
utils/easeInOutCubic 141 B
utils/easeInOutExpo 150 B
utils/easeInOutQuad 139 B
utils/easeInOutQuart 140 B
utils/easeInOutQuint 140 B
utils/easeInOutSine 156 B
utils/easeInQuad 80 B
utils/easeInQuart 81 B
utils/easeInQuint 81 B
utils/easeInSine 104 B
utils/easeLinear 77 B
utils/easeOutCirc 121 B
utils/easeOutCubic 111 B
utils/easeOutExpo 124 B
utils/easeOutQuad 110 B
utils/easeOutQuart 112 B
utils/easeOutQuint 111 B
utils/easeOutSine 132 B
utils/enterTransition 679 B
utils/fold 200 B
utils/getOffsetSizes 268 B
utils/historyPush 391 B
utils/historyReplace 392 B
utils/inertiaDecay 199 B
utils/inertiaFinalValue 187 B
utils/inertiaStep 232 B
utils/inertiaTimeConstant 178 B
utils/isBoolean 90 B
utils/isDefined 87 B
utils/isFunction 86 B
utils/isNull 78 B
utils/isNumber 103 B
utils/isObject 115 B
utils/isString 89 B
utils/kebabCase 421 B
utils/leaveTransition 679 B
utils/lerp 120 B
utils/loadImage 245 B
utils/loadLink 776 B
utils/loadScript 697 B
utils/lockScroll 565 B
utils/lowerCase 84 B
utils/map 128 B
utils/matrix 150 B
utils/mean 147 B
utils/memo 217 B
utils/noop 62 B
utils/noopValue 76 B
utils/objectToURLSearchParams 266 B
utils/pascalCase 434 B
utils/random 93 B
utils/randomInt 132 B
utils/randomItem 163 B
utils/round 130 B
utils/saveActiveElement 571 B
utils/scrollPosition 857 B
utils/scrollTo 1.86 kB
utils/selectorFor 2.78 kB
utils/setClassesOrStyles 218 B
utils/smoothTo 2.83 kB
utils/snakeCase 421 B
utils/spring 343 B
utils/throttle 151 B
utils/transform 286 B
utils/transition 577 B
utils/trapFocus 717 B
utils/untrapFocus 587 B
utils/upperCase 84 B
utils/wait 103 B
utils/withLeadingCharacters 142 B
utils/withLeadingSlash 152 B
utils/withTrailingCharacters 143 B
utils/withTrailingSlash 153 B
utils/withoutLeadingCharacters 127 B
utils/withoutLeadingCharactersRecursive 144 B
utils/withoutLeadingSlash 138 B
utils/withoutTrailingCharacters 129 B
utils/withoutTrailingCharactersRecursive 147 B
utils/withoutTrailingSlash 140 B
utils/wrap 154 B
viewTransition 1.66 kB
warn 321 B
watchAttributeNamespace 2.54 kB
watchAttributes 2.02 kB
whenDOMSettled 2.35 kB
withDrag 4.02 kB
withInView 2.11 kB
withKey 2.15 kB
withMutation 2.09 kB
withPointer 2.52 kB
withRaf 2.62 kB
withResize 2.1 kB
withScroll 3.33 kB
withScrollProgress 4.33 kB
write 124 B

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (f2d4994) to head (a14a62c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #867   +/-   ##
=======================================
  Coverage   97.06%   97.06%           
=======================================
  Files         176      176           
  Lines        4561     4561           
  Branches     1330     1331    +1     
=======================================
  Hits         4427     4427           
  Misses        122      122           
  Partials       12       12           
Flag Coverage Δ
eslint-plugin-js-toolkit 94.55% <ø> (ø)
js-toolkit 97.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

Code Review

Risk: Low — No concrete defects were identified in the files opened for review; the documentation site is safe to merge aside from the unreviewed files noted below.

Adds the v4 VitePress documentation content and documents services, decorators, configuration, events, registry APIs, context helpers, and utilities. The reviewed pages consistently describe the v4 API and include the intended typing corrections for delegated events, scroll progress, and component configuration.

Notes:

  • Reviewed: packages/v4/docs/api/services/useScrollProgress.md, packages/v4/docs/api/decorators/on.md, packages/v4/docs/api/configuration.md, packages/v4/docs/api/services/useScroll.md, packages/v4/docs/api/context/createGroup.md, packages/v4/docs/api/registry/getInstance.md, packages/v4/docs/guide/introduction/working-with-events.md, and packages/v4/docs/utils/dom.md.
  • Not opened: all other changed files, including the remaining documentation pages, packages/v4/docs/.vitepress/**, packages/v4/docs/vite.config.ts, packages/v4/package.json, and the skipped diffs under .code-review-skipped/ for workflow, package, root configuration, theme, and documentation files.

Review usage: 423,569 in (327,824 cached) / 2,200 out tokens — $0.0828 (openrouter/openai/gpt-5.6-luna, thinking: low)

Reviewed by @weareikko/code-review v0.9.5 for commit a14a62c.

@github-actions

Copy link
Copy Markdown

v4 mount benchmarks

Base and head measured on this runner, alternating over 3 rounds each; every value is the median of the round medians. Running both sides on one machine is what removes cross-machine noise — a cached baseline from another runner would put it back.

A move under 25%, or on a benchmark under 5 ms, is not reported as a change: it is inside the measured noise of a shared runner.

Group Benchmark Base Head us / component Change
unmount 5000 flat components, one removal flat 14.3 ms 18.7 ms 3.74 +30.8%
Within noise (17)
Group Benchmark Base Head us / component Change
mount 1000 components, one insertion control — declared but unregistered 1.90 ms 1.90 ms 1.90 0.0%
mount 1000 components, one insertion flat 17.8 ms 16.7 ms 16.70 -6.2%
mount 1000 components, one insertion in-view — one controller per element 32.5 ms 31.7 ms 31.70 -2.5%
mount 1000 components, one insertion nested 4 deep 14.7 ms 14.6 ms 14.60 -0.7%
mount 1000 components, one insertion realistic — 5 refs, 3 options, 4 handlers 75.0 ms 75.0 ms 75.00 0.0%
mount 1000 components, one insertion responsive option — breakpoint cascade per mount 17.6 ms 17.1 ms 17.10 -2.8%
mount 1000 flat components, 1 vs 10 insertions 1 insertion 12.4 ms 11.8 ms 11.80 -4.8%
mount 1000 flat components, 1 vs 10 insertions 10 insertions 12.8 ms 12.6 ms 12.60 -1.6%
mount 5000 components, one insertion control — declared but unregistered 18.0 ms 19.3 ms 3.86 +7.2%
mount 5000 components, one insertion flat 64.3 ms 65.2 ms 13.04 +1.4%
mount 5000 components, one insertion in-view — one controller per element 158.7 ms 157.0 ms 31.40 -1.1%
mount 5000 components, one insertion nested 4 deep 69.4 ms 69.0 ms 13.80 -0.6%
mount 5000 components, one insertion realistic — 5 refs, 3 options, 4 handlers 343.1 ms 353.3 ms 70.66 +3.0%
mount 5000 components, one insertion responsive option — breakpoint cascade per mount 86.7 ms 84.9 ms 16.98 -2.1%
mount 5000 flat components, 1 vs 10 insertions 1 insertion 69.1 ms 67.1 ms 13.42 -2.9%
mount 5000 flat components, 1 vs 10 insertions 10 insertions 72.5 ms 66.6 ms 13.32 -8.1%
unmount 1000 flat components, one removal flat 2.50 ms 3.10 ms 3.10 +24.0%

@titouanmathis
titouanmathis merged commit b6d9e6e into main Aug 26, 2026
13 of 15 checks passed
@titouanmathis
titouanmathis deleted the feat/v4-docs branch August 26, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant