Screenwide is a Tauri desktop app for macOS and Windows. The frontend uses React, TypeScript, Tailwind CSS, React Aria, and Motion. Native capture, preview, and output processing live in Rust and platform-specific code.
- Preserve unrelated changes. Do not commit, stage, or discard work unless asked.
- Work is committed straight to
main, without branches or pull requests. A commit's subject istype(scope): summary(Conventional Commits, lowercase, imperative, no trailing period). Its only body is an issue line when the work has an issue:Closes #Ncloses it once the commit reachesmain,Refs #Nlinks without closing.scripts/release-notes.mjsdrafts each release's notes from thefeatandfixsubjects and theirCloseslines. - A version is the year and month its release ships in, then which release of that month it is, from zero:
26.11.0,26.11.1,26.12.0; a prerelease adds a suffix (26.12.0-rc.1).package.json,src-tauri/Cargo.tomlandsrc-tauri/tauri.conf.jsoncarry the same one, andpnpm release:check-versionchecks that they match and follow the scheme.RELEASING.mdcovers versions and releases. - Issues are bugs, and work thought through to high-level acceptance criteria, labelled by type (
bug,feature,polish,chore), area (area: editor, …) and, when it happens on one platform only, platform (platform: windows). Ideas, the maintainer's own included, and questions start in Discussions; an idea becomes an issue once it has acceptance criteria. - When asked to record what someone found, file each bug as an issue (what happened, steps, what was expected; acceptance criteria where the fix is known) and each change that is not yet decided as an Ideas discussion, each with its area label.
CONTRIBUTING.mddescribes the same process for people.
src/primitives: single-purpose primitives built on React Aria. They import nothing fromcompositesorfeatures. Story group:Primitives.src/composites: compositions of primitives reused by more than one feature. They import nothing fromfeatures. Story group:Composites.src/features: UI and behaviour owned by one feature. May import fromprimitivesandcomposites. Story group:Features.- A layer's folder and its story group share one name, so a story is found where its source lives.
- Every feature is a folder in
src/features, and its stories sit in a sidebar folder of the same name. They are titledFeatures/<Feature>/<Area>/<Name>:<Feature>is the feature's folder,<Area>the first folder inside it when the story's file sits in one, and<Name>the component. No story sits directly underFeatures. A window with panes, such as Settings, takes each pane as an area, its states as the stories in it (Features/Settings/General/Update Available). An area that holds one component of the same name is left out (Features/Settings/Shortcuts/Hotkey Field), and a name never repeats its area (Timeline/Tracks, notTimeline/Timeline). src/features/editor,src-tauri/src/editor, and theannotations,auto_zoom,compositor,cursor_effects,export,images,keyboard_effects,placement,scenes,text,timeline_editandworkspacecrates insrc-tauri/crates: the Editor feature.textis the text engine: type set on each platform, the style vocabulary and templates, and captions as one of its users.workspaceis the editor workspace every platform shares: the scene its layers are drawn in and the editing engine (workspace::editing) that turns pointer and typing input into gestures, annotations and chrome; a platform surface only provides itsHost.src-tauri/crates: the Rust workspace's crates, each a layer the app crate (src-tauri/src) and the crates above it depend on, never the reverse. New Rust subsystems start as their own crate there, not as a module of the app crate, which wires the crates together: Tauri setup, commands and windows. Test a crate on its own withcargo test -p <crate>.- The island is one window that shows one island at a time. Each part that wants it holds an
IslandClaim(src-tauri/src/app_windows/island/claims.rs): the window comes out, moves and tucks away by the claims alone, and the page shows the island of the claim on top. A new island adds its claim in the order it stands over the others, maps it to what the page draws insrc/features/island/island-kinds.ts(which does not compile until every claim is mapped), and, when its state is one value, holds the island with anIslandSlot, which sends that value and lets the claim go with it. Nothing else shows or hides the island's window. - Shaders are WGSL, and the build compiles every one ahead of time: DXIL on Windows, Metal libraries on macOS. A shader's bind groups and vertex buffers are described once, in its crate's
shader_layouts.rs(screenwide-shader-layout);build.rsprecompiles it against that layout (screenwide_wgsl::precompile), which also checks the layout against what the WGSL declares, and the renderer draws with it throughscreenwide_gpu::Shader, which builds the pipeline from the same layout. Clippy rejectscreate_shader_moduleanywhere else, so nothing compiles WGSL at runtime except where the build compiled nothing. - A renderer draws on the device
screenwide_gpu::sharedopens for itsWorkload.Light(overlays, stills, references, the settings previews, recording) opens on the integrated graphics processor while it draws a screen, so a laptop's discrete one can switch off;Heavy(the editors, their playback, export) opens on the fastest. Each closes after a minute unused, and both share one device where they would land on the same processor, as on every Mac. A texture belongs to the device it was made on, so work that hands textures on stays on one workload; a picture drawn once and read back usesshared_for_readback, which takes whichever device is already open. Recording takes the light processor only where its hardware encoder accepts the recording (recording_devices). src/styles: the design tokens.theme.cssholds the five type roles (title, heading, body, label, caption), two heights (control-heightfor controls,part-heightfor small parts such as badges and keys), the size of a small selection mark (mark, for checkboxes and radios), icon sizes (icon-sm,icon,icon-lg;icon-xsis a utility inutilities.css, since it sets a thinner stroke with its size), semantic spacing (inline,separate,group,inset,inset-sm,traffic-lights) and four radii (smfor small marks such as swatches and checkboxes,partfor small parts,control,panel);colors.cssthe colour roles and materials per appearance;utilities.cssthe utilities over them.src/index.cssimports them and holds the fonts and global styles.src/lib/motion.ts: shared motion timings and easing.src/storybook/feature-story-stage.tsx:featureStage, the decorator that frames a feature story at its production size.src/site: the public website, one short page built fromprimitives,compositesandfeatures(pnpm site:dev,pnpm site:build). It shows the app at work in short recordings of the real app (src/site/public/recordings, each an.mp4with a.jpgposter), not imitations, and the real recording island as its one interactive part. The free tools and the paid Tools tier share one grid, with a card saying what each costs. Its copy is inlocales/en-US/site.ftl; its stylesheet,site.css, brings the app's in and adds only what a page read from a distance needs: the hero, lede and tile sizes.src-tauri/crates/licensing: who may use the paid tools, listed in itsTool: a 14-day trial of each from its first use, then a licence key per tool, proved by a record the licence server signs and the app checks offline, and checked again every few weeks. It holds no network, disk or clock code; the app sends the request, saves the state and passes the time in. Like the tools, it is under the Elastic License 2.0: the gate is theirs.workers/: Cloudflare Workers, each a pnpm workspace package with its own Wrangler config, under the Elastic License 2.0 where it serves the paid tools.workers/licenseis the licence server: it checks a key with Payhip against every tool's product and signs the recordcrates/licensingverifies. Its secrets are set withwrangler secret put, never written into the repository;pnpm --filter screenwide-license-worker typecheckwrites its types and checks them.- Editor is the editing window and its workspace, in internal names, routes, events, and stories. Export means producing or saving finished files.
- Annotation is the only word for a drawn arrow or counter, in identifiers, comments, tests, and user-visible copy. Do not reintroduce "mark" as a synonym. Annotate stays the verb form for the live desktop overlay feature and its settings, routes, and commands.
markin this repository means the brand mark or a timeline tick marker, and nothing else. - Native preview is owned by the native compositor. Browser stories cannot reproduce it; do not add a substitute rendering path just for stories.
- Reuse
primitivesandcomposites. Inspect their APIs before adding custom controls, sizes, padding, typography, or interaction behaviour. - Join class names with
cnfromsrc/lib/styling.ts, neverclsxdirectly:cnrunsclsxand then resolves conflicting Tailwind classes, so a caller'sclassNameoverrides the component's own. ESLint rejectsclsximports anywhere else. - Use the tokens for type, colour, heights, icon sizes, spacing and radii. Spacing tokens are named by what they separate:
gap-inlinebetween things read as one (an icon and its label),gap-separatebetween neighbours that stand on their own (a message and its action, buttons side by side, rows),gap-groupbetween titled groups of rows (a settings pane's sections),p-insetbetween a box's edge and its content, andp-inset-smfor the tight inset: inside a small part (a badge, a key), round a list in its panel and inside its items. A role with no token yet gets one when it appears, rather than a raw step from Tailwind's scale. A raw colour must not replace a token. Text and fills are translucent so the native window material shows through; keep them so. A value one feature needs, such as a column's width, stays in that feature rather than becoming a token. Use stories underFeaturesas reference for current usage. - One look on every platform. What the OS dictates (traffic lights versus caption buttons, ⌘ versus Ctrl) keys off
data-platformwhere it is used; thewindows:variants left in components go as each is redone. - Colour is monochrome, and each role is chosen by meaning.
primaryfills the primary action, the one control a window exists for, anything checked or on (a switch, a checked box, a held toggle, the selected clip), the chosen segment of a segmented control, progress, and the playhead, withon-primaryon it: a warm black, a warm near-white in dark. State that should be read at a glance takesprimary.focusis that ink at a third of its strength, ringing the focused control.selectedis a quieter choice made in place, where the item itself carries the meaning: a grey surface with the text unchanged, such as a chosen style tile or a selected range.emphasisis orange, the one colour beside the monochrome palette, kept for the selection on the picture: a mark, never text. Text Recognition's marks (the area read, the lines found, the selection and its QR codes) take the blue the Ruler draws its guides in,info. Neutrals and the status colours are the app's own, drawn in OKLCH beside the orange. - The material follows what is drawn. A control you press, and the state of a control, is raised:
control-raisedfor a neutral one (a button, aSelect, aPathFieldorHotkeyField),primary-raisedoverbg-primaryfor the primary action and anything on, checked or chosen (a toggle that is on, a checked box, a switch that is on, the chosen segment, the selectedSidebarNavrow). A mark or measure drawn on content or a track is flatprimary, without the bevel: the playhead, selected timeline clips and lanes, spring and cut handles, slider and progress fills, the minimap's marks, the storage strip, the Glide destination tile. Greyselectedstays the quieter choice made in place (tiles, the export look cards), and the field material (control-sunken) stays for what you type into and for tracks. Islands draw their ghost controls with no fill of their own: the island's fill (IslandFill) grows in under the pointer, and a ghost control that is on or chosen there takes that fill, deepened, rather than the raised material. The island's primary action, a choice that stands as a card (the recording modes) and a toggle laid over a picture, where the fill would not read (the camera's Flip), stay raised primary. - Name a component's colour prop
color. Use status names (error,success) only when the colour means that status. Colours that only tell things apart, such as rotation axes, take hue names (red,green,blue) drawn with the status colours, so the app keeps one palette. - Use
WindowHeaderfor window titles. It is one look on every platform: macOS leaves room for the traffic lights, Windows ends in the caption buttons. A window's commands go in its actions area; version text belongs there too and uses the mono font. Tools do not go in the title bar, except the Editor's modes, a recording's Tracks and the Library, centred between the project's name and the actions (center), each its glyph alone with its name in a tooltip; the Editor's tools for drawing on the picture stay in its left column. - Window layout owns the inset and header/content gap. Use flex/grid gaps for sibling separation rather than adding spacing inside the header.
- Use
ScrollAreafor scrolling regions. Where there is more to scroll it fades the content at that edge, a mask rather than a painted band, so it reads on any background including a native panel's material;edgeEffect="none"turns that off. A settings pane groups its rows in boxes (SettingsGroup: the fill a notice sits in, panel radius), each named by a heading above it, with no dividers between rows. Every shortcut lives in the Shortcuts pane, grouped by feature. - Copy takes its type and colour from
Text's role (title,heading,body,label,caption), not from classes written by hand, so a role reads the same everywhere.captionis a note about something: a row's description, a group's note, a footnote. Text inside a control (a switch's or checkbox's label, a select's value, a list item, a pill, a badge, a keycap, a field's value) is styled by the control, which changes it with its states, as a button styles its label. - Use
ControlRowfor title/control rows, in Settings and editor tool panels alike. Descriptions are optional: omit them when the label is sufficient, otherwise use plain language and at most ten words in Settings. Avoid repeating the label. - Editor tool panels and islands order their rows in fixed groups, skipping any a tool lacks: (1) mode: the tool's on/off switch, a choice that changes which rows appear (Show shortcuts, Redaction and its Style, Fit), or an image's picture rows (Image, Frame, Playback); (2) size: Dimensions, Size or Width, Zoom, Block size or Strength; (3) shape: Radius, Inset; (4) placement: Position, then Angle or Rotation; (5) options: Head, Alignment, Hand-drawn, Shadow, Follow face, other switches; (6) animation: Animate, Animation, Click animation; (7) colour: the colour grid, Background, Appearance; (8) footnotes; (9) one-shot actions (Reverse, Recenter, Reset, Restore, Trim) at the end of their own row, each as wide as its label. An image's Flip is the exception: it sits beside Replace in the Image row, since a button acts on the row it sits in. Recording-only and conditional rows sit late so their absence never reorders the rows above.
- The Camera island reads: Inset (a camera-only recording), Radius and Rotation (a camera-only recording), then one line of Enhance, Shadow and Follow face, then Remove background on a line of its own with the rows it brings (Background, Objects) under it. Its row ends with whether the camera is drawn into the video (
CameraInVideoToggle), the Export island's choice too, while the recording keeps both its screen and its camera; saved as its own file, the camera is not in the picture, so the island holds only that toggle and a note saying so. - Islands are built from
src/primitives/island: a row (IslandRow, or the editor island's own), an optional line under it in the row's black (below), and a section hanging beneath; what each holds comes, goes and changes over withIslandParts. Shared primitives and composites draw themselves in the island skin; do not restyle them per island. Say what is in hand, or what is going on, at the row's start withIslandRowTitle; name a control in a section withControlRow; a quiet icon button takestext-fg-secondary enabled:hover:text-fg; a cut, delete or discard asks twice withConfirmActionButton(variant="ghost"on the row). Islands show no tooltips: a control whose glyph stands for its words carries them as its accessible name alone. - Island spacing, measured from the black's edge, keeps two lines: what is filled at the section's edge, and what is read on a text column inside it. The row's and a line's controls sit 8 px in; a section's controls (circles, pills, switches, fields, lists, tiles, buttons, meters, a progress bar) sit flush with the section's 10 px inset. Everything read, words and glyphs that stand on no fill of their own, sits on one text column 16 px in, which is
px-inset-sminside a section andpx-insetin a line: a row title's glyph, aControlRow's name, anIslandWorkLine's words, hints, notes, a transcript, and a labelled toggle's glyph and words, its pill paddedpx-inset-smso its edge stays on the 10 px line while it draws no fill. A section that is only a list of named switches, such as Tracks, has no other fill holding the 10 px line, so its switches come in to the text column too (pe-inset-sm) and the list sits evenly between the island's sides. Neighbouring controls standgap-separateapart, rows in a sectiongap-inline. A hint is a caption intext-fg-secondary, with keys asKeyboardkeycaps. AnAlerton an island speaks as a hint does, a caption intext-fg-secondarywith a small icon: alone it is centred under the parts it is about, its lines starting at the icon rather than each centred, and with an action it starts on the text column, the action at the line's end. A choice between looks (sides, sizes, corners) is drawn as glyphs on a line (AnnotationLine), named only for assistive technology. An option on or off in an editor island's section is anOptionToggleshowing its glyph and then its name. Each island lays its options out for what it holds rather than by one rule: on the line beside its choices, on a line of their own, or two to a line (AnnotationOptions, its columns flush with the section's start and end). Rows named at their start (Radius, Inset, Rotation) come first and the lines of named toggles after them, before the footnotes and actions, so the toggles do not split the named rows. A choice left alone between named options is named at its row's start (AnnotationChoiceRow), as the Camera and Image islands' Radius and the camera's Background are, rather than floating centred between them. Toggles among the glyphs at the end of a row, in a picker's rows, and on the compact islands keep their glyph alone (isLabelHidden). A typed figure keeps itsControlRowname, since a bare number does not say what it measures. A figure shows its unit. Each island is as wide as its own content needs; islands do not share a width. Parts that wrap or fill (tiles, wrapping text) take the width the island's controls set (w-0 min-w-full) rather than setting it, and a part with no width of its own (a waveform, a transcript, scrolling tiles) takes one its island sets, kept in that island's folder. A field whose figures are typed keeps room for them, so typing does not resize the island. Every island story offers anisShowncontrol. - An island's shape follows what it is. The editor island is an inspector and is one block: everything under its row spans the row (
sectionSpansRow), a note such as a hint, an alert or a transcript's status sits at the block's foot, and only a column of choices too many to hold inline opens beside it (IslandAside, as text's template and font pickers do). A hint for one row's gesture, such as how to pick the camera's objects, sits under that row instead, while the gesture is under way. A pinned annotation's tracking status (AnnotationPinNote) answers the pin toggle in the island's row, so it comes first in the section, its answers at its end; it stays on one line and keeps the room of its widest form while the annotation is pinned, so the island does not change width as the playhead moves. The compact islands (recording, annotate, ruler, text recognition) hang each part under the part of the row it belongs to, at its own width. Parts that come and go anywhere in an island (the row, a line, a section, a line in a section) useIslandParts; a row or line that changes into another while the island stays out swaps withIslandSwap. - Parts several islands need are shared in
src/features/editor/island: a tool's missing model isIslandModelLine(its name, the model's size and Download, then the bar), a tool at workIslandWorkLine, a crop's shapeCropAspectChoice, following the faceFollowFaceToggle, a scene's own settingsSceneOnlyNote. A failure is an errorAlert, not a grey note. An on/off option is anOptionTogglewhose glyph draws both states, or anIconToggleButtonwith one glyph, which the island fills while on; never a single glyph handed toOptionToggle, which would show no state. AnIconToggleButtongiven alabelshows it after its glyph, as a pill. A reset names what it puts back where more than one thing could be meant (Reset crop). - Use switches for settings that take effect immediately. Use checkboxes for selection or checklist semantics, such as release-note task lists.
- Use
KeyboardandShortcutfor shortcut display,HotkeyField(src/features/settings/shortcuts/hotkey-field) for capture, andPathFieldfor file/folder controls. A shortcut is set by pressing its key and picking: the field offers the free combinations as chips, best first, with the modifiers as toggles beside the key; another Screenwide shortcut's combination is marked and never taken, and a reserved one (the system's or most apps', both platforms' lists inreserved-shortcuts.ts) only once chosen and then confirmed, by Return or a second click. A whole chord held is taken at once when free. Ruler and OCR keep bare keys, and Glide's hold keys their own capture. - Use Lucide icons at a size token:
size-icon-xsfor an icon laid over a small part such as a swatch (it brings a thinner stroke with it),size-icon-smbeside caption text,size-iconbeside body text and control labels,size-icon-lgfor an icon standing alone that needs more presence. A primitive sizes the icons it contains; do not reach into nested primitives with ancestor selectors to resize them. Play and pause are always drawn filled (fill-current), wherever they appear. - Text buttons carry no icon, primary or neutral: dialogs, sheets, Settings, forms, footers, and tool panel actions are text only, as on macOS and Windows. A window toolbar (the Editor titlebar) is the exception: there every text command takes a leading icon, and an action always uses the same icon. Icon-only buttons are unaffected. Exempt are icons that belong to a control or its content rather than decorating a label:
PathField,HotkeyField,Select,NumberFieldsteppers, and source thumbnails. - No ellipsis ("…" or "...") in labels, buttons, menu items, or status and loading text. Truncating content that does not fit, such as a shortened file path, may still use one.
- Preserve keyboard navigation, accessible names, focus behaviour, and disabled states. Reuse the existing Escape-cancellation handling where applicable.
- Every primitive tells assistive technology what it is and what value it holds: build it on React Aria's hook or component for that role (
useMeter,useSlider,useSwitch). A control with no visible label takes a requiredaria-label, and its value text is a translated message. Parts that only decorate (ticks, glyphs, a readout beside an announced value) arearia-hidden. - Nothing floats in the page. Menus, pop-up lists, colour grids, popovers and tooltips open in native panel windows (
src/features/popup-panelfor panels,TooltipTriggerfrom the Tooltip primitive for tooltips), never as in-page overlays such as React Aria'sPopoverorTooltip. Every panel and tooltip is drawn in the island's look, wherever it opens, so they read the same across the app: the window has no material and no native shadow, whose rim reads as a border, and the panel host (popup-panel-window.tsx) or the Tooltip primitive paints the island's black with a faint inset ring, in the dark appearance. What draws inside a panel paints no surface of its own: the content has no background, border or shadow, and states such as a hovered item use the translucent fills over the black. A primitive meant for a panel is written that way too, and its stories render it bare; check it inpnpm dev:storybook-native, which shows it in the real panel window. A story's own menus open there too, in the app's menu window; browser Storybook has no native windows, so they do nothing there. - Settings uses
SidebarNav, expanded, its rows showing their labels. Its panes are General, Recording, Tools, Moments, Models, Shortcuts and Licences; what changes a recording (the island's camera and sound, file size, countdown, frame rate, auto zoom, anti-flicker) lives in Recording, not General. Licences (src/features/settings/licences, under the Elastic License with the gate) lists each paid tool's state, the bundle and the keys held; a paid tool turned away opens Settings on it. A pane's picture is pinned above its rows (src/features/settings/stage), follows the hovered or focused row, and has no caption: the row names itself. A picture shows its whole subject, scaled down into the stage where it does not fit (StageScreen). Pictures are the real thing: the islands themselves on the user's wallpaper, the camera only when access is already granted, and native settings previews (src/features/settings/previewover thesettings_previewcrate) that draw Ruler, OCR and Annotate and play recording scenes through the export's compositor and theauto_zoomplanner; never a CSS imitation.
- User-visible text lives in
locales/en-US/*.ftl(Fluent). The webviews read it withtfromsrc/i18n/i18n.tsand Rust withscreenwide_i18n::t!. Do not write copy into components or native code. Rust error details, logs and text written into exported files stay English; titles and messages a person reads are translated.TRANSLATING.mdis the contributor guide. - A message id starts with its file's name (
project-browser-…) and holds one string: no attributes. Pass ids totandt!as literals sopnpm i18n:checkcan find them. The Annotation wording rule applies to ids as well as text. - Write whole sentences in the message, with placeholders and variants for counts (
$count) and platforms ($platform, fromplatformArg()). Never join fragments or choose plurals in code. - Call
twhile rendering, not at module scope. Format dates, numbers and lists with React Aria'suseDateFormatter,useNumberFormatteranduseListFormatter, or withappLocale().formatLocaleoutside components; neverIntl.*(undefined). - After adding a language, or adding, renaming or removing an
en-USmessage, or changing its placeholders, runpnpm i18n:generate. It writessrc/i18n/messages.tsand the macOS bundle strings insrc-tauri/macos-localizations. Tests compare text inen-USwith Fluent's direction isolates (U+2068, U+2069) removed. screenwide/no-literal-copyflags literal copy anywhere insrc; stories, tests, fixtures and dev previews are exempt ineslint.config.js.- Try a language with
SCREENWIDE_LOCALE=<tag>for the app, or Storybook's Language toolbar.en-XAis the pseudo-locale: accented, longer English that shows text skipping translation and layouts that break.en-XBis its right-to-left twin, and Storybook's Direction toolbar mirrors any language. - Layouts mirror in right-to-left languages. Name sides by start and end:
ms-/me-,ps-/pe-,start-/end-,text-start,rounded-s,border-e, andinsetInlineStart-style keys instyle.screenwide/logical-directionflags left and right. Where something must sit on a physical side, say so with anrtl:orltr:variant; a sidewaystranslate-xneeds itsrtl:twin by hand. Directional icons (arrows, chevrons) flip withrtl:-scale-x-100. The timeline, the picture and screen geometry stay left to right: their roots carrydir="ltr", and their files are exempt from the rule ineslint.config.js. - Names that come from the system or the user (devices, windows, projects, files, moments) take
dir="auto", so an English name in a right-to-left window keeps its own order and is cut short at its own end.
- A model is usable when the licence on its weights permits it. Go by the licence the authors attach to the weights; do not trace the licences of the datasets they were trained on.
- Weights with no licence of their own take the licence of the repository that publishes them. Weights published with no licence anywhere are not usable.
- Every feature is redesigned on the current primitives, and its stories live under
Features. - Frame every feature story with the
featureStagedecorator, so the canvas scrolls instead of squeezing it. A window insrc-tauri/tauri.conf.jsontakesfeatureStage({ window: "<label>" }), never copied numbers: a resizable window then fills the canvas down to its minimum size. A window sized at runtime, a Rust-built window or a part of one takesfeatureStage({ width, height }); omitheightwhen the content sets it. Pass a function to pick the size from args. Other decorators go before it in the array, so the stage wraps them. A window's root fills its parent, asWindowShelldoes by default, never the viewport (h-screen,w-screen,dvh): in a story the viewport is the canvas, not the window. - Keep each story focused on one useful state. Avoid explanatory filler and artificial backgrounds unrelated to the feature. Use safe preview callbacks instead of triggering native saves, updates, or other live actions.
- Give every event prop (
onPress,onChange, …) anfn()fromstorybook/testinmeta.args, so the Actions panel logs each event, and leave it out of Controls, where it only offers to replace the function. A story that renders its own grid passes the arg on to every instance, and a render that handles an event itself, such as one keeping Controls in step, still calls the arg. - Storybook Docs shows a component's JSDoc. A primitive whose name says what it does gets no component JSDoc; notes for whoever edits it go in
//comments. Prop JSDoc gives the unit or meaning in a few words ("Angle in degrees."), or is omitted when the name says it. Stories take no JSDoc: the story's name says what it shows. - Stories import
MetaandStoryObjas types from@storybook/react-viteand declaremetawithsatisfies Meta<typeof Component>. - A story not framed by
featureStageuseslayout: "centered", set once inmeta; no story switches topadded. - Give a
coloror variant prop aninline-radiocontrol with its default intable.defaultValue, and one story that shows every value side by side, with Controls disabled. Lay it out withStoryGridand aStoryGridRowper value, fromsrc/storybook/story-grid.tsx; when a second prop changes how the first looks, pass its values ascolumns. Set the shown value after spreadingargs(<Button {...args} color={color} />), or the story's args override it. Pass elements to a story's components as JSX children, never inside object props: Storybook's source printer recurses through such objects until the stack overflows. - Do not add a story that only changes a value Controls already sets, such as a number or text. Interaction states such as disabled keep their own story, as does an optional part that changes the layout when present, such as a description under a label. A control with a few distinct states (unchecked, checked, indeterminate) shows them side by side in a
Statesstory, and itsDisabledstory repeats that grid disabled. - Verify in proportion to the change. Use existing meaningful tests; do not add tests that merely repeat implementation details.
- For UI changes, inspect the relevant story. Native visual behaviour still needs native verification; lint and type checks do not prove appearance.
- Report unrelated pre-existing failures separately from failures introduced by the change. Do not quietly fix unrelated code to make checks pass.
- Respect the source-size checks and SPDX headers. Split responsibilities instead of raising a file's ceiling in
scripts/source-size-debt.json. The paid tools (today Ruler, References, Glide and live Annotate) and their licence gate are under the Elastic License 2.0 and everything else under the GPL;ELASTIC_PATHSinscripts/check-spdx.mjslists their paths, and a file's header names the licence its path takes. A new file that belongs to a paid tool goes under one of those paths, or the path is added to the list. Annotations in the editor are free and stay GPL; only the live Annotate overlay is paid.
Choose commands relevant to the change, run from the repository root; this is not a checklist. Reserve pnpm check for broad changes or required full verification:
pnpm exec eslint <changed files>pnpm exec prettier --check <changed files>pnpm exec tsc --noEmitpnpm exec vitest run <relevant tests>pnpm storybook/pnpm dev:storybook-nativepnpm build-storybookcargo check --manifest-path src-tauri/Cargo.toml --all-targetspnpm architecture:check/pnpm license:checkpnpm classes:checkafter renaming or removing a token insrc/stylespnpm checkfor the full repository verification pipeline.