Skip to content

feat(storybook): copyable snippets, usage guides on docs pages, toolbar globals and RTL fixes - #415

Merged
maksimzinchuk merged 1 commit into
mainfrom
feat/storybook-audit-fixes
Nov 16, 2026
Merged

maksimzinchuk merged 1 commit into
mainfrom
feat/storybook-audit-fixes

Conversation

@maksimzinchuk

@maksimzinchuk maksimzinchuk commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Why

A Storybook audit found these problems:

  • "Show code" mostly printed the raw CSF object or a bare self-closing tag. Nothing there was worth copying.
  • The *.docs.md usage guides never appeared in Storybook.
  • Only 1 of 687 stories had a play function.
  • Some argTypes described props and slots the components no longer have.
  • There was no theme, language or direction switcher, and several components rendered wrongly in RTL.

What changes

Docs pages

  • Show code. Prints a story as a copyable <script setup> + <template> SFC with @vc-shell/framework imports (.storybook/source-snippet.ts). An explicit docs.source.code still wins. The same snippet appears in the Code panel of every story (docs.codePanel).
  • Usage guide. The component's *.docs.md is rendered under "Usage guide" (.storybook/docs-page.ts). Its links open the matching Storybook page, or the docs site when the target is not in Storybook.
  • Guide markup. Guides render what vc-docs renders:
    • ```mermaid blocks become diagrams. Mermaid loads only on a page that has one.
    • mkdocs admonitions (!!! tip "...") become coloured callouts.
    • Code blocks keep Storybook's code style and Copy button.
  • Performance. Guides load in a separate chunk, prefetched only in the top-level frame. Bundling them into the preview froze the VcDataTable docs page, which boots a full preview per story iframe.
  • Scrolling. Docs pages scroll the window instead of an inner div. Popups teleported to body, such as the date picker calendar, were cut off at the viewport edge.
  • Toast stories. They now reserve their toast's height. Long toasts were clipped, because a toast is position: absolute.

Toolbar

  • Theme: light / dark.
  • Language: every framework locale.
    • It also emulates navigator.language, which the framework uses for date, number and money formats.
    • Arabic and Hebrew switch the page to RTL.
  • Direction: auto / LTR / RTL.
  • Stories rendered in nested docs iframes follow the toolbar too.
  • Stories sit on the blade content surface (--additional-50), not Storybook's white, so the dark theme looks as it does in apps.
  • Hardcoded light colours in 44 story files are replaced with theme tokens:
    • gray Tailwind utilities become --neutrals-*;
    • hex values in CSS become theme tokens;
    • colours passed to JS, such as chart series, are untouched.

Checks and tooling

  • yarn check:story-argtypes. Fails when a story documents a prop, event or slot the component no longer has. It runs in yarn check and CI. Stale entries are removed in VcStatus and VcScheduler.
  • yarn generate:component-manifest. Writes cli/vc-app-skill/runtime/knowledge/components.json with props, events, slots, docs path and story ids for the vc-app skill. The release regenerates it.
  • Stories. Play functions on key stories (input, select, checkbox, switch, pagination, popup, data table). Deprecated API stories are hidden from docs pages.
  • Dependencies.
    • Removed the unused @chromatic-com/storybook and @storybook/addon-onboarding.
    • New preview deps are pre-bundled. Without that, a cold cache failed yarn test:storybook.
  • README. .storybook/README.md is rewritten.

RTL fixes in the framework

  • VcDatePicker. The field and the calendar follow the page direction. The library forced LTR inside the field, and its menu wrapper overflowed the wrong way.
  • VcBadge. Custom position uses inset-inline-end instead of right.
  • DraggableDashboard. Gridstack mirrors on RTL pages. Its rtl: 'auto' reads only the element's inline style. Covered by unit tests.
  • Story examples. Physical CSS replaced with logical properties.

The RTL fixes come from an audit of all 679 stories in both directions. The mirrored element boxes were compared, and popups were checked separately.

Not changed

The framework still formats dates and money by the browser locale, not the app language. That is documented behavior, and changing it is a separate decision.

Verification

  • yarn check is green: lint, format, stylelint, typecheck, locales, circular, layers, story argTypes.
  • yarn test:storybook: 95 files, 684 tests passed.
  • Unit tests for the touched code pass.
  • Checked manually in a browser:
    • the snippets, guides and guide links;
    • the toolbar switches;
    • the date picker in Docs and in RTL;
    • the toast and VcDataTable docs pages.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

📦 Preview published for commit 60da4d1

Install the preview with dist-tag:

npm install @vc-shell/framework@pr-415

Or pin to the exact commit:

npm install @vc-shell/framework@2.11.0-pr415.60da4d1

Published packages (dist-tag pr-415, version 2.11.0-pr415.60da4d1):

  • @vc-shell/framework
  • @vc-shell/api-client-generator
  • @vc-shell/create-vc-app
  • @vc-shell/config-generator
  • @vc-shell/migrate
  • @vc-shell/ts-config
  • @vc-shell/mf-config
  • @vc-shell/mf-host
  • @vc-shell/mf-module
  • @vc-shell/vc-app-skill

@maksimzinchuk
maksimzinchuk force-pushed the feat/storybook-audit-fixes branch 2 times, most recently from 6eb8eb8 to 97520fc Compare November 16, 2026 13:15
…ar globals and RTL fixes

Docs pages
- "Show code" prints a story as a <script setup> + <template> SFC with @vc-shell/framework imports (source-snippet.ts).
- The component's *.docs.md is rendered under "Usage guide"; its links open the matching Storybook page or the docs site.
- Guides load in a separate chunk, prefetched only in the top frame, so the VcDataTable docs page no longer freezes.
- Docs pages scroll the window instead of an inner div, so popups teleported to body (date picker) are no longer cut off.
- Toast stories reserve the height of their toast; long toasts were clipped.

Toolbar
- Theme, language (every framework locale) and direction (auto/ltr/rtl).
- Language also emulates navigator.language, which the framework uses for date, number and money formats.
- Stories rendered in nested docs iframes follow the toolbar.

Checks and tooling
- yarn check:story-argtypes fails when a story documents a prop, event or slot the component no longer has; runs in yarn check and CI.
- yarn generate:component-manifest writes cli/vc-app-skill/runtime/knowledge/components.json for the vc-app skill; regenerated on release.
- Play functions on key stories; deprecated stories hidden from docs pages; stale argTypes removed.
- Removed the unused chromatic and onboarding addons; pre-bundled new preview deps to avoid cold-cache test failures.

RTL fixes in the framework
- VcDatePicker: the field and the calendar follow the page direction.
- VcBadge: custom position uses inset-inline-end.
- DraggableDashboard: gridstack mirrors when the page is right-to-left.
@maksimzinchuk
maksimzinchuk force-pushed the feat/storybook-audit-fixes branch from 97520fc to 60da4d1 Compare November 16, 2026 13:24
@maksimzinchuk
maksimzinchuk merged commit 24a9cae into main Nov 16, 2026
14 checks passed
@maksimzinchuk
maksimzinchuk deleted the feat/storybook-audit-fixes branch November 16, 2026 13:38
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