feat: add structured shadows/elevation token category - #163
Conversation
…w dimension units; generalize PropertyDef
…ion token refs; surface non-string values as findings
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
@googlebot I signed it! |
|
CLA signed and confirmed. Pushed an empty commit to retrigger checks. |
|
Hi @SomSamantray, this draft looks really clean! Standardizing structured I noticed that the exporters ( Are you planning to add the exporter support to this draft, or would you mind if I opened a follow-up PR to handle the serialization once this is merged? Happy to help out if you'd like. |
|
You can go ahead and open a follow-up PR to handle the serialization! Fell free to! |
Summary
Adds a structured
shadows:token category to the DESIGN.md spec, giving shadow/elevation values the same first-class treatmentcolors,typography,rounded, andspacingalready have: a schema, model resolution, lint validation, generated spec docs, and an example.Closes #92.
What's in here
spec-config.yaml/.ts): ashadow_propertiesdefinition (offsetX,offsetY,blur,spread,color) and aboxShadowcomponent sub-token, mirroring the existingtypography_propertiespattern.model/spec.ts,model/handler.ts): a compositeResolvedShadowtype resolved the same waytypographyis — each dimension sub-field is unit-validated (px/rem/em, matching typography/rounded/spacing), andcoloraccepts either a literal CSS color or a{colors.*}token reference, resolved through the existing reference-chasing logic.parser/spec.ts,parser/handler.ts):shadowsrecognized as a known top-level key (typo suggestions via the existingunknown-keyrule pick it up automatically).shadow-orphanedrule flags shadow tokens never referenced by a component, sharing acomputeReferencedPathshelper with the existingorphaned-tokensrule rather than duplicating the reference-scan.spec.mdxgained a### Design Tokenssubsection underElevation & Depth;docs/spec.mdwas regenerated viabun run spec:gen(never hand-edited).examples/paws-and-paths/DESIGN.mdnow has ashadows.cardtoken referenced fromcard-profile.boxShadow.Review notes
This went through an internal simplify + multi-lens review pass before opening. Two things worth flagging for reviewers:
shadows.broken:with no value) would throw inside parsing, get caught by the model's outer try/catch, and silently discard all findings for the entire file — now it emits a scoped error instead.offsetX/offsetY/blur/spread) now resolve{rounded.*}/{spacing.*}token references the same waycolorresolves{colors.*}— previously a token reference on those fields was silently dropped with no value and no diagnostic.Testing
bun test— 331 pass, 0 fail (up from the pre-change 310; new coverage for happy path, chained/indirect color references, non-color reference rejection, malformed input, and unit validation).bunx tsc --noEmitclean.bun run spec:gen --checkconfirms the generated doc is deterministic.design.md lint.🤖 Assisted by Compound Engineering