Skip to content

feat(parser): alias flex-wrap to wrap and warn on unknown classNames (WIND-5)#147

Merged
anilcancakir merged 9 commits into
masterfrom
feat/flex-wrap-alias-unknown-token-warning
Jul 7, 2026
Merged

feat(parser): alias flex-wrap to wrap and warn on unknown classNames (WIND-5)#147
anilcancakir merged 9 commits into
masterfrom
feat/flex-wrap-alias-unknown-token-warning

Conversation

@anilcancakir

@anilcancakir anilcancakir commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

What (WIND-5)

Two developer-experience fixes for silent failures:

  1. flex-wrap -> wrap alias: FlexboxGridParser now maps the Tailwind spelling flex-wrap directly to WindDisplayType.wrap (canParse already accepted flex-*; only the parse() handler was missing). wrap stays the canonical token; flex-wrap prints a one-time kDebugMode hint pointing at it.
  2. Unknown-className warning: WindParser.findAndGroupClasses now emits a one-time kDebugMode debugPrint naming any className no parser recognizes (deduped per unique token per session, via the existing _warnedAliases set). The token is still dropped; release builds print nothing.

An allowlist (_knownUnparsedTokens) exempts valid tokens handled outside the parser map so the warning targets genuine typos, not wind's own vocabulary: the widget-consumed object-* fit family, the inline-* display keywords (emitted by WBadge), and inert compat tokens (transition-colors, antialiased, sr-only, the *-nums family). Verified by an exhaustive sweep of all 20 parsers vs every runtime-emitted className.

Why

flex-wrap from a web codebase silently no-opped; a typo'd className silently no-opped forever. Both now surface a debug hint without changing release behavior.

Changes

  • lib/src/parser/parsers/flexbox_grid_parser.dart, lib/src/parser/wind_parser.dart (+ tests).
  • 13 example pages switched flex-wrap -> wrap.
  • 5-surface doc sync: skills/wind-ui/SKILL.md (2.8.2 -> 2.9.0), skills/wind-ui/references/tailwind-divergence.md, doc/layout/display.md, CHANGELOG.md.

Verification

dart analyze clean, dart format clean, flutter test green (incl. the flex-wrap alias, one-warning-per-token, and allowlist regression tests).

Note

Shares CHANGELOG.md / SKILL.md / tailwind-divergence.md with the WIND-1/3/4 PRs (they were developed as one plan). Whichever merges first, the others need a trivial rebase on those doc surfaces.

Summary by CodeRabbit

  • New Features
    • Added support for the flex-wrap spelling as an alias for wrap.
    • Unknown class tokens now surface a one-time debug hint in development builds instead of failing silently.
  • Documentation
    • Updated layout docs, examples, and guidance to use wrap as the canonical token.
    • Clarified when unknown or unsupported tokens are warned about versus dropped quietly.

Copilot AI review requested due to automatic review settings July 7, 2026 14:08
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 94b35418-e5d2-41af-9d8d-fd2f0bfbbbe5

📥 Commits

Reviewing files that changed from the base of the PR and between 41b23a3 and 72617d8.

📒 Files selected for processing (21)
  • CHANGELOG.md
  • doc/layout/display.md
  • example/lib/pages/backgrounds/colors.dart
  • example/lib/pages/layout/flex_intro.dart
  • example/lib/pages/layout/z_index.dart
  • example/lib/pages/popover/popover_alignment.dart
  • example/lib/pages/responsive/card.dart
  • example/lib/pages/responsive/grid.dart
  • example/lib/pages/responsive/layout.dart
  • example/lib/pages/responsive/spacing.dart
  • example/lib/pages/responsive/typography.dart
  • example/lib/pages/responsive/visibility.dart
  • example/lib/pages/sizing/aspectratio.dart
  • example/lib/pages/typography/colors.dart
  • example/lib/pages/widgets/wind_animation_wrapper_basic.dart
  • lib/src/parser/parsers/flexbox_grid_parser.dart
  • lib/src/parser/wind_parser.dart
  • skills/wind-ui/SKILL.md
  • skills/wind-ui/references/tailwind-divergence.md
  • test/parser/parsers/flexbox_grid_parser_test.dart
  • test/parser/wind_parser_test.dart

📝 Walkthrough

Walkthrough

This PR aliases the Tailwind flex-wrap token to Wind's canonical wrap display type in FlexboxGridParser, emitting a one-time debug hint. WindParser now warns once per unrecognized className token (excluding an allowlist of intentionally inert/externally-handled tokens). Example pages, tests, and documentation are updated accordingly.

Changes

flex-wrap alias and unknown-token diagnostics

Layer / File(s) Summary
FlexboxGridParser alias implementation
lib/src/parser/parsers/flexbox_grid_parser.dart
Adds a parse() branch mapping flex-wrap to WindDisplayType.wrap, plus debug-hint infrastructure (_warnedFlexWrapAlias, helper, resetWarnings()) and updated doc comments.
FlexboxGridParser alias tests
test/parser/parsers/flexbox_grid_parser_test.dart
Adds resetWarnings() calls in setUp, a parse test, a canParse assertion, and a debug-hint-once test group.
WindParser unknown-token diagnostics
lib/src/parser/wind_parser.dart, test/parser/wind_parser_test.dart
Introduces _knownUnparsedTokens allowlist and _warnUnknownToken to emit a one-time debug warning for unclaimed class tokens in findAndGroupClasses, with corresponding tests.
Example pages updated to use wrap
example/lib/pages/backgrounds/colors.dart, example/lib/pages/layout/*, example/lib/pages/popover/popover_alignment.dart, example/lib/pages/responsive/*, example/lib/pages/sizing/aspectratio.dart, example/lib/pages/typography/colors.dart, example/lib/pages/widgets/wind_animation_wrapper_basic.dart
Replaces flex-wrap with wrap in className strings across example pages, keeping other layout classes unchanged.
Documentation updates
CHANGELOG.md, doc/layout/display.md, skills/wind-ui/SKILL.md, skills/wind-ui/references/tailwind-divergence.md
Documents the flex-wrapwrap alias, its debug hint, and the new unknown-token debug diagnostic behavior, replacing prior "silent no-op" descriptions.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • fluttersdk/wind#90: Both PRs modify lib/src/parser/wind_parser.dart's debug diagnostics behavior around token handling.
  • fluttersdk/wind#97: Both PRs modify flex-related parsing logic in lib/src/parser/parsers/flexbox_grid_parser.dart.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/flex-wrap-alias-unknown-token-warning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Wind’s developer experience by (1) adding a Tailwind-compat alias for flex-wrap and (2) emitting debug-only warnings for dropped className tokens that no parser recognizes, while keeping release behavior unchanged.

Changes:

  • Added flex-wrapwrap alias in FlexboxGridParser, with a one-time kDebugMode hint.
  • Added a one-time kDebugMode unknown-token warning in WindParser.findAndGroupClasses, plus an allowlist for valid tokens handled outside the parser map.
  • Updated docs/skill references and migrated example pages from flex-wrap to canonical wrap; added/updated tests for the new diagnostics.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/parser/wind_parser_test.dart Adds coverage for dropping unknown tokens and for one-time unknown-token debug warnings with allowlist exemptions.
test/parser/parsers/flexbox_grid_parser_test.dart Adds tests for flex-wrap alias behavior and one-time alias-hint logging; resets warning state for determinism.
skills/wind-ui/SKILL.md Updates the skill text to describe flex-wrap alias and the new debug-only unknown-token behavior.
skills/wind-ui/references/tailwind-divergence.md Updates Tailwind divergence guidance to reflect the alias and the new debug-only unknown-token diagnostics.
lib/src/parser/wind_parser.dart Implements the unknown-token warning (debug-only, warn-once) and introduces a _knownUnparsedTokens allowlist.
lib/src/parser/parsers/flexbox_grid_parser.dart Implements flex-wrapwrap alias and a one-time debug hint (plus test-only reset hook).
example/lib/pages/widgets/wind_animation_wrapper_basic.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/typography/colors.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/sizing/aspectratio.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/responsive/visibility.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/responsive/typography.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/responsive/spacing.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/responsive/layout.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/responsive/grid.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/responsive/card.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/popover/popover_alignment.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/layout/z_index.dart Replaces flex-wrap usage with canonical wrap in examples.
example/lib/pages/layout/flex_intro.dart Updates explanatory copy to acknowledge the alias and prefer canonical wrap.
example/lib/pages/backgrounds/colors.dart Replaces flex-wrap usage with canonical wrap in examples.
doc/layout/display.md Updates display docs to explain wrap vs flex and note the flex-wrap alias + debug hint.
CHANGELOG.md Records the alias + debug-diagnostic behavior changes and associated doc/example updates under Unreleased.

Comment thread skills/wind-ui/SKILL.md Outdated
Comment thread skills/wind-ui/SKILL.md Outdated
Comment thread skills/wind-ui/references/tailwind-divergence.md
The hint fires only when no parser's canParse matches the token (unknown family).
A recognized family with an unsupported value (text-7xl, claimed by text-*; flex-cow,
matching flex-*) still drops silently with no hint. Corrects Core Law 6, the migration
table, and the tailwind-divergence unknown-tokens row, which overpromised the hint's reach.
@anilcancakir

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Comment thread test/parser/wind_parser_test.dart
@anilcancakir

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…s-unknown-token-warning

# Conflicts:
#	CHANGELOG.md
@anilcancakir anilcancakir merged commit 092cb10 into master Jul 7, 2026
10 of 11 checks passed
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.

2 participants