mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
## What this adds A developer can style an HTML tag once and have that style apply across every page, including content imported into Content Blocks. The selected element's matching **Tag style** appears first in Style Sources. Its chip is temporary; its saved styles remain global. ## Plan and todos 1. [x] Add a distinct `tag` style source with a fixed tag and ID. Create it on the first edit, without a migration or instance attachment. 2. [x] Emit Tag style CSS in the canvas and published output after presets and before instance styles. Keep normal CSS specificity and source order. Include global styles when collecting page assets. 3. [x] Show only the selected element's Tag style in the picker. Keep its temporary chip first and fixed, and identify it in the property source tooltip. 4. [x] Support scoped descendant tag selectors in ordinary tokens, while limiting Tag styles to states of their own tag. 5. [x] Regenerate the runtime contract and cover CSS output, selector validation, runtime updates, and style provenance with focused tests. 6. [x] Revalidate and version the eight stored fixture bundles for the renamed source type, then rerun fixture checks. 7. [x] Use the raw lowercase tag name as the Tag style label, use a singular picker heading, and fix scoped tag-state preview so only matching descendants are highlighted. 8. [x] Let Global root select and edit the `html` Tag style with the same temporary, fixed-first behavior as other tags. 9. [x] Name the feature Tag styles in the UI and code, and replace the draft-only saved type and ID. 10. [x] Rebase onto `main`, keep the publish CSS validation integration working, and move the PR to `5657.staging`. 11. [x] Review the new PR's CI and staging deployment. 12. [x] Make Tag styles discoverable through MCP, verify the existing edit path, and add focused coverage. 13. [x] Update Tag styles product docs and add paired light/dark screenshots. 14. [x] Pin the visual regression runner to supported Ubuntu and review the visual diff. 15. [x] Make the selected Tag style source distinct from unselected tokens in dark mode, review both themes, and refresh documentation screenshots. 16. [x] Copy and paste Tag styles through the style source menu, merging declarations into the matching tag with pasted values winning. 17. [x] Copy and paste Local styles into the selected instance’s Local source, merge with pasted declarations winning, and share one source-transfer command pair with Tag styles. 18. [x] Adjust the compact MCP schema size budget for the new source type input, then rerun the CLI schema test and CI. 19. [x] Add Tag style to the shared design-system style-source color and label variants, and use its shared color in the Builder. 20. [x] Restore the style source and input colors from `main`; use the Slot global color for Tag styles in Builder and design-system variants; refresh and review paired documentation screenshots. 21. [x] Monitor CI for `aba723fc0a` to completion. 22. [x] Address the four canvas cascade and live-preview review comments, add focused regression coverage, and verify the Builder and published CSS agree. 23. [x] Review documentation impact and monitor CI for the review fixes. 24. [x] Normalize the HTTP client paste-style-source result for Token clipboard data, preserve paste-design-token, and verify both response shapes. 25. [x] Use `tag` for Style panel items and verify the picker and menu. 26. [x] Check CI for the Style panel rename. 27. [x] Use `tag` across saved Tag style records, Builder items, and CLI and MCP inputs and results. Keep existing Tag style IDs and the CSS clipboard format. 28. [x] Regenerate runtime contracts and MCP docs, refresh fixture bundle versions, and verify the updated schema, CSS, and transfers. 29. [x] Check CI for the saved style source rename. 30. [x] Fix Select option descriptions clipping in narrow menus, allow wrapped descriptions to grow vertically, and review documentation impact (no docs update needed). 31. [x] Fix marketplace consent checkbox vertical alignment and keep checked and unchecked dimensions identical; add both states to Storybook and review documentation impact (no docs update needed). 32. [x] Resolve Tag-style review comments for selected-state cascade preview, active-state discovery, and html Tag CSS-variable clipboard dependencies. 33. [x] Describe Copy for Tag styles, disable copying empty sources, and keep the style source menu width stable while descriptions change. 34. [x] Increase the splash screen logo-to-progress gap by 8px in total. 35. [x] Align the style source menu to the chip’s left edge when space allows, and determine Copy availability from all saved declarations. 36. [x] Keep arrow-key navigation inside the open style source menu so it does not toggle the combobox. 37. [x] Move focus left and right across source chips, input, and Local at the matching caret boundaries. 38. [x] Preserve instance-style precedence while previewing ephemeral Tag-state edits. 39. [x] Synchronize temporary Tag style selection to the canvas so saved Tag-state previews render. 40. [x] Keep the selected Tag style in autocomplete and ensure keyboard events reach the combobox once. 41. [x] Show a 1px keyboard focus outline one pixel outside each style source chip, and open the focused source’s menu with Arrow Down. 42. [x] Preserve Tag-state preview precedence across breakpoints and include matching Tag states without requiring the temporary chip. 43. [x] Rename the autocomplete section labels to “Tag” and “Tokens.” 44. [x] Return focus to the input when Escape closes a style source menu. 45. [x] Rename Tag style color recipe and design-system variant keys from `tagStyle` to `tag`. 46. [x] Review and simplify style-source changes while preserving keyboard behavior. 47. [x] Simplify style source menu alignment offset arguments to numbers. 48. [x] Import React’s `KeyboardEvent` type directly without an alias. ## Deferred and blocked - **Agent evaluations:** Repository guidance requires separate approval before running them. ## Technical choices and compatibility Tag styles use the same global purple and contrasting text as Slot outlines. The style source field, inactive chips, and their hover behavior match `main`; the earlier neutral color experiments in this PR are superseded. Tag styles are saved with `type: "tag"` and an ID such as `tag-style:button`. Projects from released versions need no migration. Draft development records with `type: "tagStyle"` are incompatible with this revision. They emit CSS even when no instance uses them. Ordinary tokens still need an instance selection and can target descendants such as `.card p`. The CSS cascade decides conflicts; there is no custom priority rule. Token, Tag, and Local styles share the existing `copy-design-token` and `paste-design-token` MCP/CLI commands. Copy accepts `styleSourceId` and `sourceType` (`token`, `tag`, or `local`). The older `tokenId` input remains valid. The CSS clipboard payload identifies the source type on paste. Tokens still create a numbered copy. Tag styles merge into the matching global tag, and Local styles merge into the selected instance’s Local source, creating it when needed. Pasted declarations win for matching properties, states, and breakpoints. All three share asset and breakpoint transfer. The original Tag style feature added about 435 net non-test lines. This follow-up reuses the Token transfer path for Tag and Local styles and adds no new MCP/CLI commands. Older clients that do not recognize the new source type may need to update before editing a project that contains Tag styles. ## Verification - Imported React’s `KeyboardEvent` type directly; no alias is needed. Oxfmt and `git diff --check` passed. - Replaced `Pick<DOMRect, "left">` alignment-helper inputs with `number`, and updated the existing focused assertion. Oxfmt and `git diff --check` passed; tests were not run locally. - Style-source simplification reviewed by a Sol medium subagent: consolidated duplicate input arrow checks, removing 13 non-test lines. Oxfmt and `git diff --check` passed; tests were not run locally. - On `2a11120b69`: renamed Tag color recipe and Label/NestedIconLabel variant keys from `tagStyle` to `tag` without changing colors. The focus outline is 1px, offset outside the chip. Oxfmt and `git diff --check` passed; CI is running. - On `80803a5094`: moved the source chip focus outline one pixel outside its bounds and return focus to the input when Escape closes its menu. Oxfmt and `git diff --check` passed. Tests were not run locally; CI is running. - On `55681dda89`: formatted the keyboard handler with Oxfmt after CI caught the line wrap; `pnpm dlx oxfmt@0.58.0` and `git diff --check` passed. Tests were not run locally. - On `3b00225d33`: arrow navigation now traverses source chips in both directions, with the input between global sources and Local. `git diff --check` passed; local tests were not run. No documentation update is needed. - On `256ad1e797`: increased the splash logo-to-progress distance by another 4px (8px total from the original spacing). `git diff --check` passed. No documentation or tests changed. - On `4167ba4b85`: moved the keyboard focus ring from the inner label button to the full source chip edge. `git diff --check` passed; local formatting was unavailable because this worktree has no installed `oxfmt` executable. No documentation or tests changed. - On `4167ba4b85`: moved the keyboard focus ring from the inner label button to the full source chip edge. `git diff --check` passed; formatting was unavailable because this worktree has no installed `oxfmt` executable. No docs or tests are affected. - Passed on `3b4a2bc3ce`: style-source input tests (10), formatting, and diff checks. The autocomplete section labels now read “Tag” and “Tokens.” - Passed on `bb2c60d3e4`: canvas style tests (65), formatting, and diff checks. Tag state previews use lower selector specificity than instance styles across breakpoints, and matching Tag states participate even when the temporary Tag chip is absent. The full Builder typecheck uses a local shared dependency tree with unrelated stale color-variable declarations; CI is rerunning. - Passed on `7bac6f25cb`: style-source input tests (10), formatting, and diff checks. Keyboard focus now has a visible ring, and Arrow Down opens the focused source menu, including on an unselected source. - Passed on `11df83f889`: style-source input tests (10), formatting, and diff checks. Arrow-key autocomplete now retains the selected Tag style ahead of Tokens; the combobox key handler runs once per input event. The local Builder typecheck has only the pre-existing shared color-variable declaration errors; CI is rerunning. - Passed on `10060fac6c`: sync-store tests (15), formatting, and diff checks. Temporary Tag style selection now synchronizes to the canvas for saved-state previews. - Passed on `b775384f2f`: Builder canvas/style-source tests (75), formatting, and diff checks. Ephemeral Tag-state edits now respect the effective source reported by the style model when an instance declaration overrides them. CI is running. - Passed on `87d5f0529e`: style source input/menu tests (12), formatting, and diff checks. Arrow-key focus moves between the input, last global source, and Local source; open menu arrow keys no longer bubble to the outer combobox. CI is running. - Passed on `1e34af257f`: Builder style source menu tests (10), formatting, and diff checks. Menu aligns to the chip’s left edge, with viewport collision handling retained. Copy availability now checks saved declarations across states and breakpoints. CI is running. - Passed on `699bd8ee81`: formatting and diff checks. Increased the logo-to-progress gap by 4px using the next spacing token. CI is running. - Passed on `af8affb589`: style source menu browser tests (6), formatting, and diff checks. Copy now has a focused description, is disabled without declarations, and the menu keeps its 176px width when the description changes. CI is running. - Passed on `1485781bca`: focused HTTP-client tests (52), project-build token-transfer tests (27), and Builder canvas tests (67); formatting and diff checks passed. CI is running. Local HTTP-client typecheck passed. Project-build and Builder typechecks could not complete because the temporary shared `node_modules` links resolved workspace packages incompletely; errors were missing package exports/dependencies and color variable declarations. - Passed on `bae690edc4` (with Select fix `b1e49b1cfd`): checkbox browser regression (both states remain 14×14 px and align to the first label line), design-system and Builder typechecks, focused lint and formatting, and diff check. Reviewed the checked and unchecked Storybook example in light and dark themes. Docs review found no user-facing documentation change needed; no fixture inputs or outputs are affected. - Passed on `b1e49b1cfd`: the focused Select description browser regression passed in light and dark themes (2 tests); design-system and Builder typechecks, focused lint and formatting, and diff check passed. Reviewed the narrow Select dropdown story in both themes; the description wraps without clipping. Docs review found no user-facing documentation update needed. - CI on `ba274d0dec` passed, including Linux and Windows fixture sync and builds, staging and development deployments, and all ten Builder browser shards. Shard 6 passed on retry after Chromium failed to start in the original run. The approved visual rerun passed after comparison with `6f2404d987` confirmed all 272 story results and all 549 screenshots were identical. - Passed on `ba274d0dec`: focused SDK (14), project-build (353), Builder (78), CLI (168), protocol (15), and HTTP-client (51) tests. Builder, SDK, project-build, protocol, CLI, and MCP docs typechecks passed. The HTTP-client typecheck passed with an unrelated local test edit excluded. The SDK test for `type: "tag"` failed with the earlier schema and passed with the updated schema. Generated contracts and MCP docs, focused lint and formatting, package boundaries, and diff check passed. All eight validated bundles use `bundle-1u9ug3c`, and all eight local fixture builds passed. - CI on `6f2404d987`: 34 latest checks passed and 4 were skipped, including all ten Builder browser shards and the approved visual comparison. The five previously approved visual differences had identical screenshots. - Passed on `6f2404d987`: 16 focused Builder browser tests, Builder typecheck, focused lint and formatting, package boundaries, and diff check. Only the Style panel item value changes. No documentation, fixture, clipboard, or saved project changes. - Passed on `aba723fc0a`: design-system and Builder type checks, focused lint and formatting, package boundaries, and diff check. Restored main's field and inactive source colors; Tag styles now use Slot's `--background-accent-secondary` and matching foreground. Refreshed and reviewed the paired light/dark source screenshots; the menu screenshots were unchanged. All 51 check runs completed; the approved visual comparison and all ten Builder browser shards passed. The earlier unapproved visual comparison showed the intended color changes. - Passed on `bd39fb09e5`: Builder typecheck, focused lint and format, package boundaries, and diff check. The style source field keeps its default 8% neutral fill while no longer following the theme surface-contrast slider, so the track (4%), field (8%), chip hover (about 10%), and selected Tag style (14% light / 22% dark) stay ordered. The default-theme docs screenshots remain accurate; no documentation text changed. All CI checks completed. The approved visual comparison passed with the same six differences as the prior revision; all ten Builder browser shards passed after two shards were retried for CI Chromium startup errors. - Passed on `5c782e8d09`: design-system and Builder type checks, focused lint and formatting, package boundaries, and diff check. The shared Tag color now drives the Builder chip and label variants. Documentation review found no product behavior or screenshot change; the palette story now shows Tag. All 49 CI check runs completed: the approved visual rerun and all ten Builder browser shards passed. The initial unapproved visual comparison reported the expected story changes before approval. - Passed on `091dea695c`: Builder and design-system type checks, lint, package boundaries, formatting, and Storybook inspection of idle, hover, and selected sources in both themes. Refreshed the light docs screenshot; the dark idle screenshot is unchanged. - On `53826757d6`, CI completed: 43 passed, 5 skipped, and one superseded visual run was cancelled. The approved visual check and all ten Builder browser shards passed. - Passed on `53826757d6`: design-system and Builder type checks, lint, package boundaries, formatting, and paired light/dark Storybook inspection. The light screenshot is unchanged; the dark screenshot was refreshed. - Passed on `50bc57eb70`: the focused 11-test CLI schema file, formatting, and diff checks. The MCP handshake is 224,046 bytes with the three source type options; the budget is now 224,500 bytes. - Passed on `3c38222811`: focused runtime (270), Builder (3), CLI (5), and HTTP client (51) tests; five package type checks; lint; package boundaries; generated API and docs checks. The paired light/dark screenshots were reviewed. Local fixture inputs and outputs are unchanged by this follow-up. - Passed: workspace type checks, lint, package boundaries, generated contract regeneration, focused SDK/CSS-data/runtime/Builder tests, token-transfer and copy/paste tests, all local fixture builds, and fixture bundle tests. - Passed: CLI prebuild suite (152 tests) and the 54-test publish validation file after fixing its fixture. - Blocked: remote fixture sync reports a bundle-version mismatch against the development API. Agent evaluations require separate approval. - Passed on `38d1705f8a`: Builder app, project-build, CLI, core, and package CI suites; all ten Builder browser shards; Linux and Windows fixture checks; visual regression; and staging/development builds. Oxfmt and `git diff --check` passed locally. Local Vitest was unavailable because this worktree has no installed `node_modules`. Ref #5657 - Rebased onto `main` at `0589b18ce` and moved to `5657.staging`. Focused checks, five package type checks, generated API, lint, formatting, and package boundaries passed locally. On `9e38ff743b`, 38 CI checks passed, one was skipped, and visual regression found the intended Tag style color change. Staging deployment and all ten browser test shards passed. A focused Tag style story and paired light/dark documentation screenshots were reviewed. - MCP discovery and edit support passed focused project-build, protocol, CLI, type, lint, and generated-doc checks locally. The missing runtime cutover and HTTP client entries were fixed; both package suites now pass on the latest commit. - Tag styles docs now explain global application, temporary source selection, states, and CSS cascade. Two paired screenshots show the source and states menu; Storybook rendering, Builder typecheck, formatting, and relative links passed. Visual regression now passes on Ubuntu 24.04 with the reviewed change approved. - On `a8a3c27423`, all 44 CI checks completed: 39 passed and 5 were skipped. Visual regression and all ten Builder browser shards passed. Replaces #6663. - Review fixes on `f9af16d063`: canvas root presets now yield to `html` Tag styles; responsive Tag styles no longer displace instance styles in the style model; selected Tag states and descendant selectors update during live edits. The existing Tag styles documentation needs no change for these bug fixes. Builder focused tests (133), SDK CSS tests (11), Builder typecheck, lint, formatting, and diff checks passed locally. Each new regression test was verified against the old behavior. No fixture inputs or outputs changed. CI completed on `f9af16d063`: 35 latest checks passed and 3 were skipped, including all ten Builder browser shards and the approved visual check. 49. [x] Move the Tag and Token focus outline to the chip edge; no documentation update is needed. 50. [x] Return focus to the style source input when Escape closes its autocomplete; no documentation update is needed. 51. [x] Return focus to the style source input when Escape closes a source chip menu; no documentation update is needed. 52. [x] Add a regression test that Escape in a style source chip menu returns focus to the input; no documentation update is needed. 53. [x] Avoid duplicating an html Tag's own variables as root dependencies when copying it. 54. [x] Exclude descendant selectors from active-state matching. 55. [x] Preserve Tag state preview specificity over base styles and instance state precedence during saved and ephemeral previews. 56. [x] Restore the style source dropdown's default Radix placement from main; remove the custom chip offset.
10 KiB
10 KiB
Table of contents
Basics
university
- ⚛️ Foundations
- 🏠 Dashboard
- 🛠️ Anatomy of the Webstudio builder
- 🗺️ Navigator
- 📐 Layout & Flexbox
- 📐 Layout & Grid
- 📱 Responsive design
- 📱 Breakpoints
- 🧱 CSS variables
- 🖌️ Design tokens
- 🎨 Style panel
- Tag styles
- 🎯 States and selectors
- 🔡 Variables
- ➕ Expression editor
- 🎨 Custom classes & attributes
- 🔄 Transforms
- 🎬 Animations
- 💾 CMS
- ♻️ Reusability & maintainability
- ↔️ Copy-Paste
- 🔍 Commands & search
- 🗂️ Assets
- 📚 Content Engine
- 🎯 SEO settings
- ⚡ Performance
- ⌨️ Shortcuts
- 📄 Page settings
- 📄 Page templates
- ⚙️ Project settings
- 🌐 HTTP response headers
- 🔀 Path patterns
- 🎭 Modes
- 🔗 Share links
- 🌐 Publishing & custom domains
- 🧩 Core Components
- 📦 Element
- 🔗 Link
- 🔲 Slot
- ➖ Separator
- 📝 Text
- 🔤 Heading
- 📄 Paragraph
- ✏️ Inline Text
- 💬 Blockquote
- ⚠️ Alert
- 📄 Code Text
- ✍️ Form
- ✍️ Webhook Form (deprecated)
- 🔘 Button
- 🏷️ Label
- 📝 Input
- 📝 Text Area
- 📋 Select
- ☑️ Checkbox
- 🔘 Radio Button
- 🖼️ Image
- 🎬 Video
- ⏯️ Vimeo
- ▶️ Vimeo Background Video
- ▶️ YouTube
- 💾 Collection
- 🪜 Content Embed
- 🪜 Markdown Embed
- 📝 Content Block
- 📃 List
- ⌨️ HTML Embed
- 🎬 Animation Group
- Text Animation
- 🎥 Video Animation
- 👨👨👦👦 Stagger Animation
- 🗂️ Head Slot
- 🏷️ JSON-LD
- 📘 XML Node
- 🕐 XML Time
- 🕐 Time
- 📛 Built with Webstudio
- ⬛ CLI
- 🤖 MCP
- ✨ Inception
- ▫️ Radix UI Components
- Marketplace
- 🤖 Webstudio AI
- 📤 Self-Hosting
- 🧑🏫 How-Tos
- ▶️ How to add icons
- ▶️ How to use custom fonts
- ▶️ How to create fluid video backgrounds with Vimeo
- ▶️ How to crop an image without cropping the original
- ▶️ How to create responsive navigation
- 🍀 How to add a GSAP animation
- ▶️ How to make a custom 404 page
- ▶️ Build Your Own Directory Website with Airtable
- ▶️ Using filters to dynamically display content
- 🔗 Integrations
- How to build a frontend for Supabase using Webstudio
- How to build a frontend for Airtable using Webstudio
- How to integrate a Webhook Form with Airtable (deprecated)
- How to build a frontend for Baserow using Webstudio
- How to build a frontend for Hygraph using Webstudio
- How to build a WordPress frontend using Webstudio (no-code builder)
- How to integrate a Notion database with Webstudio
- How to integrate Webhook Form with Pabbly (deprecated)
- How to integrate Webhook Form with Zapier (deprecated)
- How to integrate Webhook Form with N8N (deprecated)
- How to integrate Flotiq with Webstudio
- Craft